expo-passkey
Version:
Passkey authentication for Expo apps with Better Auth integration
61 lines • 2.82 kB
TypeScript
/**
* @file Device information and credential management utilities
* @module expo-passkey/client/utils/device
*/
import type { DeviceInfo, ExpoPasskeyClientOptions } from "../../types";
/**
* Gets or generates a device identifier
* This is used for device identification, but not directly related to WebAuthn credentials
*
* @param options Client options with storage prefix
* @param generateIfMissing If true, will generate and store a new ID if none exists
* @returns Promise resolving to a device ID or null if not found and generation is disabled
* @throws {PasskeyError} If device ID generation fails
*/
export declare function getDeviceId(options?: ExpoPasskeyClientOptions, generateIfMissing?: boolean): Promise<string | null>;
/**
* Checks if this device has any registered passkeys by looking
* at the credential metadata stored locally
*
* @param options Client options with storage prefix
* @returns Promise resolving to boolean indicating if any passkeys are registered
*/
export declare function hasPasskeysRegistered(options?: ExpoPasskeyClientOptions): Promise<boolean>;
/**
* Checks if a specific user has registered passkeys on this device
*
* @param userId The user ID to check
* @param options Client options with storage prefix
* @returns Promise resolving to boolean indicating if user has passkeys
*/
export declare function hasUserPasskeysRegistered(userId: string, options?: ExpoPasskeyClientOptions): Promise<boolean>;
/**
* Checks if the device is capable of handling passkeys
* This does not check if a passkey is registered, only if the device
* has the hardware and software capabilities to use passkeys
*
* @returns Promise resolving to boolean indicating if device supports passkeys
*/
export declare function isDevicePasskeyCapable(): Promise<boolean>;
/**
* Generates a fallback device identifier using crypto random values
* @returns Promise resolving to a random device ID
*/
export declare function generateFallbackDeviceId(): Promise<string>;
/**
* Clears all passkey-related storage data
* This only clears local storage data, not the actual WebAuthn credentials
* which are managed by the platform
*
* @param options Client options with storage prefix
* @returns Promise resolving when all passkey data is cleared
*/
export declare function clearPasskeyData(options?: ExpoPasskeyClientOptions): Promise<void>;
/**
* Gets comprehensive device information including biometric and WebAuthn support
* @param options Client options with storage prefix
* @param generateDeviceId Whether to generate a device ID if none exists
* @returns Promise resolving to device information
*/
export declare function getDeviceInfo(options?: ExpoPasskeyClientOptions, generateDeviceId?: boolean): Promise<DeviceInfo>;
//# sourceMappingURL=device.d.ts.map