IF Commons GitHub

device

conceptpersonal data

Hardware that has an identity and an owner: an endpoint, a server or a thing

Model identityDevice. Written in commons/data/models/identity-device/mod.ts:32. Identified by principal.

Governance: attributes

deviceKindcode of deviceKindrequired

What kind of device it is

Becomes the column device_kind of device.

Written at commons/data/models/identity-device/mod.ts:35

enrolledAtinstantrequired

When it was enrolled

Becomes the column enrolled_at of device.

Written at commons/data/models/identity-device/mod.ts:41

hardwareHashtextrequiredpersonal data

A hash of its serial number or hardware identifier

Becomes the column hardware_hash of device.

Annotations: privacy.personal={"category":"DeviceBased","purposes":["tell one device from another"]}

Written at commons/data/models/identity-device/mod.ts:37

labeltextoptional

What it is called

Becomes the column label of device.

Written at commons/data/models/identity-device/mod.ts:38

lastSeenAtinstantoptional

When it was last seen

Becomes the column last_seen_at of device.

Written at commons/data/models/identity-device/mod.ts:42

managementStatecode of managementStaterequired

How far it is managed

Becomes the column management_state of device.

Written at commons/data/models/identity-device/mod.ts:39

ownershipcode of ownershiprequired

Whose it is

Becomes the column ownership of device.

Written at commons/data/models/identity-device/mod.ts:40

platformcode of platformrequired

What it runs

Becomes the column platform_code of device.

Written at commons/data/models/identity-device/mod.ts:36

trustedUntilinstantoptional

Until when it is trusted without a fresh attestation

Becomes the column trusted_until of device.

Written at commons/data/models/identity-device/mod.ts:43

Governance: relationships

principalone

The principal the device is To principal. Written at commons/data/models/identity-device/mod.ts:32

Logical: the table

Projects to the table device with the primary key principal_id.

ColumnTypeNullRoleFrom
device_kindtextfalseattributedevice.deviceKind
enrolled_attimestampfalseattributedevice.enrolledAt
hardware_hashtextfalseattributedevice.hardwareHash
labeltexttrueattributedevice.label
last_seen_attimestamptrueattributedevice.lastSeenAt
management_statetextfalseattributedevice.managementState
ownershiptextfalseattributedevice.ownership
platform_codetextfalsereferencedevice.platform
principal_idtextfalsereferencedevice.principal
trusted_untiltimestamptrueattributedevice.trustedUntil

Physical: SQL

CREATE TABLE IF NOT EXISTS "device" (
    "principal_id" VARCHAR NOT NULL PRIMARY KEY,
    "device_kind" VARCHAR NOT NULL,
    "platform_code" VARCHAR NOT NULL,
    "hardware_hash" VARCHAR NOT NULL,
    "label" VARCHAR,
    "management_state" VARCHAR NOT NULL,
    "ownership" VARCHAR NOT NULL,
    "enrolled_at" TIMESTAMPTZ NOT NULL,
    "last_seen_at" TIMESTAMPTZ,
    "trusted_until" TIMESTAMPTZ,
    CONSTRAINT "device_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
    CONSTRAINT "device_platform_code_fk" FOREIGN KEY ("platform_code") REFERENCES "platform" ("code"),
    CONSTRAINT "device_device_kind_ck" CHECK ("device_kind" IN ('laptop', 'phone', 'tablet', 'server', 'iot', 'other')),
    CONSTRAINT "device_management_state_ck" CHECK ("management_state" IN ('unmanaged', 'registered', 'managed', 'retired')),
    CONSTRAINT "device_ownership_ck" CHECK ("ownership" IN ('corporate', 'personal', 'shared'))
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { device } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity-device.auto.ts: do not edit.

import { from } from "@intellectual-frontiers/data/sql/typed";
import { device } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(device).select((s) => ({ principalId: s.device.principalId, deviceKind: s.device.deviceKind })).run(runner);

Titles, headings, exports, tables, columns and requirements. Esc closes.