IF Commons GitHub

certificate

concept

A certificate that a principal proves itself with: only the public half is kept

Model identityPki. Written in commons/data/models/identity-pki/mod.ts:33. Identified by credential.

Governance: attributes

fingerprinttextrequired

The SHA-256 thumbprint of the certificate, unique; it is also the value mutual TLS binds a token to

Becomes the column fingerprint of certificate.

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

keyAlgorithmtextrequired

The algorithm of its key

Becomes the column key_algorithm of certificate.

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

notAfterinstantrequired

When it stops

Becomes the column not_after of certificate.

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

notBeforeinstantrequired

When the certificate starts to be valid

Becomes the column not_before of certificate.

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

revokedReasontextoptional

Why it was revoked, where it was

Becomes the column revoked_reason of certificate.

Written at commons/data/models/identity-pki/mod.ts:44

sanDnstextmany

The domain names in the certificate's alternative name

Becomes the column san_dns of certificate.

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

sanUritextoptional

The identifier in the certificate's alternative name, such as a SPIFFE ID

Becomes the column san_uri of certificate.

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

serialtextrequired

The certificate's serial number

Becomes the column serial of certificate.

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

subjectNametextrequired

The name the certificate is for

Becomes the column subject_name of certificate.

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

Governance: relationships

credentialone

The credential it is To credential. Written at commons/data/models/identity-pki/mod.ts:33

issueroptional

The anchor that vouches for it To trustAnchor. Written at commons/data/models/identity-pki/mod.ts:33

Logical: the table

Projects to the table certificate with the primary key credential_id.

ColumnTypeNullRoleFrom
credential_idtextfalsereferencecertificate.credential
fingerprinttextfalseattributecertificate.fingerprint
issuer_trust_anchor_idtexttruereferencecertificate.issuer
key_algorithmtextfalseattributecertificate.keyAlgorithm
not_aftertimestampfalseattributecertificate.notAfter
not_beforetimestampfalseattributecertificate.notBefore
revoked_reasontexttrueattributecertificate.revokedReason
san_uritexttrueattributecertificate.sanUri
serialtextfalseattributecertificate.serial
subject_nametextfalseattributecertificate.subjectName

Physical: SQL

CREATE TABLE IF NOT EXISTS "certificate" (
    "credential_id" VARCHAR NOT NULL PRIMARY KEY,
    "fingerprint" VARCHAR NOT NULL,
    "serial" VARCHAR NOT NULL,
    "subject_name" VARCHAR NOT NULL,
    "san_uri" VARCHAR,
    "not_before" TIMESTAMPTZ NOT NULL,
    "not_after" TIMESTAMPTZ NOT NULL,
    "key_algorithm" VARCHAR NOT NULL,
    "revoked_reason" VARCHAR,
    "issuer_trust_anchor_id" VARCHAR,
    CONSTRAINT "certificate_credential_id_fk" FOREIGN KEY ("credential_id") REFERENCES "credential" ("credential_id"),
    CONSTRAINT "certificate_issuer_trust_anchor_id_fk" FOREIGN KEY ("issuer_trust_anchor_id") REFERENCES "trust_anchor" ("trust_anchor_id"),
    CONSTRAINT "certificate_fingerprint_uq" UNIQUE ("fingerprint")
);

Physical: the typed table

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

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

const rows = await from(certificate).select((s) => ({ credentialId: s.certificate.credentialId, fingerprint: s.certificate.fingerprint })).run(runner);

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