IF Commons GitHub

recoveryCode

concept

A code kept for when the other ways are lost, kept as a hash and used once

Model identity. Written in commons/data/models/identity/concepts.ts:203. Identified by credential.

Governance: attributes

hashtextrequired

The hash of the code

Becomes the column hash of recovery_code.

Written at commons/data/models/identity/concepts.ts:203

usedAtinstantoptional

When it was used

Becomes the column used_at of recovery_code.

Written at commons/data/models/identity/concepts.ts:301

Governance: relationships

credentialone

The credential it is To credential. Written at commons/data/models/identity/concepts.ts:203

Logical: the table

Projects to the table recovery_code with the primary key credential_id.

ColumnTypeNullRoleFrom
credential_idtextfalsereferencerecoveryCode.credential
hashtextfalseattributerecoveryCode.hash
used_attimestamptrueattributerecoveryCode.usedAt

Physical: SQL

CREATE TABLE IF NOT EXISTS "recovery_code" (
    "credential_id" VARCHAR NOT NULL PRIMARY KEY,
    "hash" VARCHAR NOT NULL,
    "used_at" TIMESTAMPTZ,
    CONSTRAINT "recovery_code_credential_id_fk" FOREIGN KEY ("credential_id") REFERENCES "credential" ("credential_id")
);

Physical: the typed table

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

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

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

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