UNPKG

@turnkey/react-native-passkey-stamper

Version:

Passkey stamper for React Native

85 lines 2.66 kB
import type { TurnkeyApiTypes } from "@turnkey/http"; /** * https://www.w3.org/TR/webauthn-2/#dictionary-credential-descriptor * Copied from https://github.com/f-23/react-native-passkey/blob/17184a1b1f6f3ac61e07aa784c9b64efb28b570e/src/Passkey.tsx#L80C1-L85C2 * TODO: can we import this type instead? */ export interface PublicKeyCredentialDescriptor { type: string; id: string; transports?: Array<AuthenticatorTransport>; } export declare enum AuthenticatorTransport { usb = "usb", nfc = "nfc", ble = "ble", smartCard = "smart-card", hybrid = "hybrid", internal = "internal" } /** * Authenticator params expected by the Turnkey API (for authenticator, user, or sub-organization creation) */ export type TurnkeyAuthenticatorParams = TurnkeyApiTypes["v1AuthenticatorParamsV2"]; export type TPasskeyRegistrationConfig = { rp: { id: string; name: string; }; user: { id: string; name: string; displayName: string; }; authenticatorName: string; challenge?: string; timeout?: number; userVerification?: UserVerificationRequirement; excludeCredentials?: PublicKeyCredentialDescriptor[]; authenticatorSelection?: { authenticatorAttachment?: string; requireResidentKey?: boolean; residentKey?: string; userVerification?: string; }; attestation?: string; extensions?: Record<string, unknown>; }; export type TPasskeyStamperConfig = { rpId: string; timeout?: number; userVerification?: UserVerificationRequirement; allowCredentials?: PublicKeyCredentialDescriptor[]; withSecurityKey?: boolean; withPlatformKey?: boolean; extensions?: Record<string, unknown>; }; /** * Re-export of the underlying library's `isSupported` method */ export declare function isSupported(): boolean; /** * Creates a passkey and returns authenticator params */ export declare function createPasskey(config: TPasskeyRegistrationConfig, options?: { withSecurityKey: boolean; withPlatformKey: boolean; }): Promise<TurnkeyAuthenticatorParams>; /** * Stamper to use with `@turnkey/http`'s `TurnkeyClient` */ export declare class PasskeyStamper { rpId: string; timeout: number; userVerification: UserVerificationRequirement; allowCredentials: PublicKeyCredentialDescriptor[]; extensions: Record<string, unknown>; forcePlatformKey: boolean; forceSecurityKey: boolean; constructor(config: TPasskeyStamperConfig); stamp(payload: string): Promise<{ stampHeaderName: string; stampHeaderValue: string; }>; } //# sourceMappingURL=index.d.ts.map