expo-passkey
Version:
Passkey authentication for Expo apps with Better Auth integration
96 lines • 4.67 kB
TypeScript
/**
* @file Error type definitions and constants
* @module expo-passkey/types/errors
*/
/**
* Error codes for the Expo Passkey plugin
*/
export declare const ERROR_CODES: {
readonly ENVIRONMENT: {
readonly NOT_SUPPORTED: "environment_not_supported";
readonly MODULE_NOT_FOUND: "module_not_found";
};
readonly BIOMETRIC: {
readonly NOT_SUPPORTED: "biometric_not_supported";
readonly NOT_ENROLLED: "biometric_not_enrolled";
readonly AUTHENTICATION_FAILED: "biometric_authentication_failed";
};
readonly DEVICE: {
readonly ID_GENERATION_FAILED: "device_id_generation_failed";
};
readonly NETWORK: {
readonly REQUEST_FAILED: "network_request_failed";
};
readonly WEBAUTHN: {
readonly NOT_SUPPORTED: "webauthn_not_supported";
readonly CANCELED: "webauthn_canceled";
readonly TIMEOUT: "webauthn_timeout";
readonly OPERATION_FAILED: "webauthn_operation_failed";
readonly INVALID_STATE: "webauthn_invalid_state";
readonly CHALLENGE_EXPIRED: "webauthn_challenge_expired";
readonly INVALID_RESPONSE: "webauthn_invalid_response";
readonly NOT_SECURE_CONTEXT: "webauthn_not_secure_context";
readonly INVALID_CREDENTIAL: "webauthn_invalid_credential";
readonly NATIVE_MODULE_ERROR: "webauthn_native_module_error";
};
readonly SERVER: {
readonly CREDENTIAL_EXISTS: "device_already_registered";
readonly INVALID_CREDENTIAL: "invalid_credential";
readonly CREDENTIAL_NOT_FOUND: "credential_not_found";
readonly REGISTRATION_FAILED: "registration_failed";
readonly AUTHENTICATION_FAILED: "authentication_failed";
readonly REVOCATION_FAILED: "revocation_failed";
readonly INVALID_ORIGIN: "invalid_origin";
readonly INVALID_CLIENT: "invalid_client";
readonly PASSKEYS_RETRIEVAL_FAILED: "passkeys_retrieval_failed";
readonly USER_NOT_FOUND: "user_not_found";
readonly CHALLENGE_GENERATION_FAILED: "challenge_generation_failed";
readonly INVALID_CHALLENGE: "invalid_challenge";
readonly EXPIRED_CHALLENGE: "expired_challenge";
readonly VERIFICATION_FAILED: "verification_failed";
};
};
/**
* Error messages mapped to error codes
*/
export declare const ERROR_MESSAGES: {
readonly environment_not_supported: "Environment not supported";
readonly module_not_found: "Required module not found";
readonly biometric_not_supported: "Biometric authentication not supported on this device";
readonly biometric_not_enrolled: "Biometric authentication not enrolled on this device";
readonly biometric_authentication_failed: "Biometric authentication failed";
readonly device_id_generation_failed: "Failed to generate device ID";
readonly network_request_failed: "Network request failed";
readonly webauthn_not_supported: "WebAuthn is not supported on this device";
readonly webauthn_canceled: "WebAuthn operation was canceled by the user";
readonly webauthn_timeout: "WebAuthn operation timed out";
readonly webauthn_operation_failed: "WebAuthn operation failed";
readonly webauthn_invalid_state: "WebAuthn is in an invalid state";
readonly webauthn_challenge_expired: "WebAuthn challenge has expired";
readonly webauthn_invalid_response: "Invalid WebAuthn response";
readonly webauthn_not_secure_context: "WebAuthn requires a secure context (HTTPS)";
readonly webauthn_invalid_credential: "Invalid WebAuthn credential";
readonly webauthn_native_module_error: "Error in WebAuthn native module";
readonly device_already_registered: "Device already registered";
readonly invalid_credential: "Invalid credential";
readonly credential_not_found: "Credential not found";
readonly registration_failed: "Failed to register device";
readonly authentication_failed: "Authentication failed";
readonly revocation_failed: "Failed to revoke credential";
readonly invalid_origin: "Invalid origin";
readonly invalid_client: "Invalid client";
readonly passkeys_retrieval_failed: "Failed to retrieve passkeys";
readonly user_not_found: "User not found";
readonly challenge_generation_failed: "Failed to generate challenge";
readonly invalid_challenge: "Invalid challenge";
readonly expired_challenge: "Challenge has expired";
readonly verification_failed: "WebAuthn verification failed";
};
/**
* Custom error class for passkey errors
*/
export declare class PasskeyError extends Error {
code: string;
constructor(code: string, message?: string);
}
//# sourceMappingURL=errors.d.ts.map