deviceKindcode of deviceKindrequiredWhat kind of device it is
Becomes the column device_kind of device.
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.
deviceKindcode of deviceKindrequiredWhat kind of device it is
Becomes the column device_kind of device.
enrolledAtinstantrequiredWhen it was enrolled
Becomes the column enrolled_at of device.
hardwareHashtextrequiredpersonal dataA 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"]}
labeltextoptionalWhat it is called
Becomes the column label of device.
lastSeenAtinstantoptionalWhen it was last seen
Becomes the column last_seen_at of device.
managementStatecode of managementStaterequiredHow far it is managed
Becomes the column management_state of device.
ownershipcode of ownershiprequiredWhose it is
Becomes the column ownership of device.
platformcode of platformrequiredWhat it runs
Becomes the column platform_code of device.
trustedUntilinstantoptionalUntil when it is trusted without a fresh attestation
Becomes the column trusted_until of device.
principaloneThe principal the device is To principal. Written at commons/data/models/identity-device/mod.ts:32
Projects to the table device with the primary key principal_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
device_kind | text | false | attribute | device.deviceKind |
enrolled_at | timestamp | false | attribute | device.enrolledAt |
hardware_hash | text | false | attribute | device.hardwareHash |
label | text | true | attribute | device.label |
last_seen_at | timestamp | true | attribute | device.lastSeenAt |
management_state | text | false | attribute | device.managementState |
ownership | text | false | attribute | device.ownership |
platform_code | text | false | reference | device.platform |
principal_id | text | false | reference | device.principal |
trusted_until | timestamp | true | attribute | device.trustedUntil |
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'))
);CREATE TABLE IF NOT EXISTS "device" (
"principal_id" TEXT NOT NULL PRIMARY KEY,
"device_kind" TEXT NOT NULL,
"platform_code" TEXT NOT NULL,
"hardware_hash" TEXT NOT NULL,
"label" TEXT,
"management_state" TEXT NOT NULL,
"ownership" TEXT 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'))
);CREATE TABLE IF NOT EXISTS "device" (
"principal_id" TEXT NOT NULL PRIMARY KEY,
"device_kind" TEXT NOT NULL,
"platform_code" TEXT NOT NULL,
"hardware_hash" TEXT NOT NULL,
"label" TEXT,
"management_state" TEXT NOT NULL,
"ownership" TEXT NOT NULL,
"enrolled_at" TEXT NOT NULL,
"last_seen_at" TEXT,
"trusted_until" TEXT,
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'))
);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);