Skip to content

Principal

Following a successful passkey registration or authentication operation, your frontend code will receive a code and id_token (JWT). Exchanging the code or verifying the id_token will result in a Principal:

Principal.ts
export interface Principal {
_tag: "Principal";
id: string;
userId: string;
authenticatorId: string;
authenticatorType: "passkey";
passkey?: {
verified: boolean;
userVerified: boolean;
};
createdAt: number;
expiresAt: number;
}
PropertyDescription
_tagDiscriminator, always Principal
idGenerated every time a Principal is created. Equivalent to the JWT jti property
userIdImmutable application user ID associated with the passkey. This is supplied by your backend before the browser creates the passkey. See linking accounts
authenticatorIdUnique identifier i.e. the Passlock passkey ID. Store this for passkey management, deletion, audit logs and duplicate-prevention queries
authenticatorTypeCurrently hardcoded as “passkey”, but in the future this will be extended to support additional authenticator types e.g. Apple and Google sign-in
passkey.verifiedShould always be true
passkey.userVerifiedWhether the device re-authenticated the user locally
createdAtTimestamp, milliseconds since epoch
expiresAtTimestamp, milliseconds since epoch. Derived from the JWT exp property

When exchanging a code Passlock will return an ExtendedPrincipal which includes additional properties:

PropertyDescription
_tagDiscriminator, always ExtendedPrincipal
metadataRequest metadata captured during the registration or authentication operation
passkey.platformNameThe platform/ecosystem used to create the passkey e.g. Apple iCloud
metadata.ipAddressIP address of the client using the passkey
metadata.userAgentClient user agent