Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add WebAuthn sign in and sign up flows (#881)
- Loading branch information
1 parent
5f8d3fc
commit ce834ee
Showing
9 changed files
with
476 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./core"; | ||
export * from "./pkce"; | ||
export * from "./consts"; | ||
export * from "./types"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
export interface PublicKeyCredentialCreationOptionsJSON { | ||
rp: PublicKeyCredentialRpEntity; | ||
user: PublicKeyCredentialUserEntityJSON; | ||
challenge: Base64URLString; | ||
pubKeyCredParams: PublicKeyCredentialParameters[]; | ||
timeout?: number; | ||
excludeCredentials?: PublicKeyCredentialDescriptorJSON[]; | ||
authenticatorSelection?: AuthenticatorSelectionCriteria; | ||
attestation?: AttestationConveyancePreference; | ||
extensions?: AuthenticationExtensionsClientInputs; | ||
} | ||
|
||
export interface PublicKeyCredentialRequestOptionsJSON { | ||
challenge: Base64URLString; | ||
timeout?: number; | ||
rpId?: string; | ||
allowCredentials?: PublicKeyCredentialDescriptorJSON[]; | ||
userVerification?: UserVerificationRequirement; | ||
extensions?: AuthenticationExtensionsClientInputs; | ||
} | ||
|
||
export interface RegistrationResponseJSON { | ||
id: Base64URLString; | ||
rawId: Base64URLString; | ||
response: AuthenticatorAttestationResponseJSON; | ||
authenticatorAttachment?: AuthenticatorAttachment; | ||
clientExtensionResults: AuthenticationExtensionsClientOutputs; | ||
type: PublicKeyCredentialType; | ||
} | ||
|
||
export interface AuthenticationResponseJSON { | ||
id: Base64URLString; | ||
rawId: Base64URLString; | ||
response: AuthenticatorAssertionResponseJSON; | ||
authenticatorAttachment?: AuthenticatorAttachment; | ||
clientExtensionResults: AuthenticationExtensionsClientOutputs; | ||
type: PublicKeyCredentialType; | ||
} | ||
|
||
type Base64URLString = string; | ||
|
||
export interface PublicKeyCredentialUserEntityJSON { | ||
id: Base64URLString; | ||
name: string; | ||
displayName: string; | ||
} | ||
|
||
export interface PublicKeyCredentialDescriptorJSON { | ||
id: Base64URLString; | ||
type: PublicKeyCredentialType; | ||
transports?: AuthenticatorTransport[]; | ||
} | ||
|
||
export interface AuthenticatorAttestationResponseJSON { | ||
clientDataJSON: Base64URLString; | ||
attestationObject: Base64URLString; | ||
// Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation | ||
authenticatorData?: Base64URLString; | ||
// Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation | ||
transports?: AuthenticatorTransport[]; | ||
// Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation | ||
publicKeyAlgorithm?: COSEAlgorithmIdentifier; | ||
publicKey?: Base64URLString; | ||
} | ||
|
||
export interface AuthenticatorAssertionResponseJSON { | ||
clientDataJSON: Base64URLString; | ||
authenticatorData: Base64URLString; | ||
signature: Base64URLString; | ||
userHandle?: string; | ||
} | ||
|
||
export interface TokenData { | ||
auth_token: string; | ||
identity_id: string | null; | ||
provider_token: string | null; | ||
provider_refresh_token: string | null; | ||
} | ||
|
||
export type RegistrationResponse = | ||
| { code: string } | ||
| { verification_email_sent_at: string }; | ||
|
||
export type SignupResponse = | ||
| { status: "complete"; verifier: string; tokenData: TokenData } | ||
| { status: "verificationRequired"; verifier: string }; |
Oops, something went wrong.