IF Commons GitHub

passwordCredential

concept

A password, kept only as a hash that carries its algorithm, its parameters and its salt

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

Governance: attributes

algorithmcode of passwordAlgorithmrequired

How it was hashed

Becomes the column password_algorithm_code of password_credential.

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

changedAtinstantrequired

When the password was set

Becomes the column changed_at of password_credential.

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

hashtextrequired

The hash in the PHC string form; never the password, never reversible

Becomes the column hash of password_credential.

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

mustChangebooleanrequired

Whether the user must choose another at the next sign-in

Becomes the column must_change of password_credential.

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

Governance: relationships

credentialone

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

Logical: the table

Projects to the table password_credential with the primary key credential_id.

ColumnTypeNullRoleFrom
changed_attimestampfalseattributepasswordCredential.changedAt
credential_idtextfalsereferencepasswordCredential.credential
hashtextfalseattributepasswordCredential.hash
must_changebooleanfalseattributepasswordCredential.mustChange
password_algorithm_codetextfalsereferencepasswordCredential.algorithm

Physical: SQL

CREATE TABLE IF NOT EXISTS "password_credential" (
    "credential_id" VARCHAR NOT NULL PRIMARY KEY,
    "hash" VARCHAR NOT NULL,
    "password_algorithm_code" VARCHAR NOT NULL,
    "changed_at" TIMESTAMPTZ NOT NULL,
    "must_change" BOOLEAN NOT NULL,
    CONSTRAINT "password_credential_credential_id_fk" FOREIGN KEY ("credential_id") REFERENCES "credential" ("credential_id"),
    CONSTRAINT "password_credential_password_algorithm_code_fk" FOREIGN KEY ("password_algorithm_code") REFERENCES "password_algorithm" ("code")
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { passwordCredential } 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 { passwordCredential } from "@intellectual-frontiers/data/sql/typed/models";

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

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