diff options
Diffstat (limited to 'packages/typescript-types')
-rw-r--r-- | packages/typescript-types/src/index.ts | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts index 58cc90c..2d9f8d2 100644 --- a/packages/typescript-types/src/index.ts +++ b/packages/typescript-types/src/index.ts @@ -6,6 +6,36 @@ export type AttestationCredentials = { }; /** + * A variant of AttestationCredentials suitable for JSON transmission to the browser + * + * Noteworthy values: + * @param challenge A random string of characters. Will be converted to a Uint8Array in the browser + * @param user.id Your unique, internal ID for the user. Will be converted to a Uint8Array in the + * browser + */ +export type AttestationCredentialsJSON = { + publicKey: { + challenge: string, + // The organization registering and authenticating the user + rp: { + name: string, + id: string, + }, + user: { + id: string, + name: string, + displayName: string, + }, + pubKeyCredParams: [{ + alg: -7, + type: 'public-key', + }], + timeout?: number, + attestation: 'direct' | 'indirect', + }, +}; + +/** * An object that can be passed into navigator.credentials.get(...) in the browser */ export type AssertionCredentials = { @@ -13,6 +43,31 @@ export type AssertionCredentials = { }; /** + * A variant of AssertionCredentials suitable for JSON transmission to the browser + * + * Noteworthy values: + * @param challenge A random string of characters. Will be converted to a Uint8Array in the browser + * @param allowCredentials.id Base64-encoded credentialId. Will be converted to a Uint8Array in the + * browser + */ +export type AssertionCredentialsJSON = { + publicKey: { + // + challenge: string, + allowCredentials: { + // Will be converted to a Uint8Array in the browser + id: string, + type: 'public-key', + transports?: AuthenticatorTransport[], + }[], + // extensions?: AuthenticationExtensionsClientInputs, + rpId?: string, + timeout?: number, + userVerification?: UserVerificationRequirement, + }, +}; + +/** * A slightly-modified AuthenticatorAttestationResponse to simplify working with ArrayBuffers that * are base64-encoded in the browser so that they can be sent as JSON to the server. */ @@ -33,6 +88,7 @@ AuthenticatorAssertionResponse, 'clientDataJSON' | 'authenticatorData' | 'signat base64AuthenticatorData: string; base64ClientDataJSON: string; base64Signature: string; + base64UserHandle: string; } export enum ATTESTATION_FORMATS { |