UNPKG

expo-crypto-universal

Version:

Universal crypto implementation for Expo that works across all platforms including web

46 lines (42 loc) 1.7 kB
/** * Abstract class implementing the CryptoModule interface, providing * common functionality for cryptographic operations. */ export declare abstract class AbstractCryptoModule implements CryptoModule { /** * Generates random bytes of specified size. * @param size - The number of random bytes to generate. Defaults to 32 if not specified. * @returns Uint8Array containing random bytes. */ getRandomBytes: (size?: number) => Uint8Array; /** * Fills the passed Uint8Array with cryptographically secure random values. * @param values - The Uint8Array to fill with random values. * @returns The same Uint8Array filled with random values. */ abstract getRandomValues: (values: Uint8Array) => Uint8Array; } /** * Interface for crypto operations that can be implemented by different platforms */ export declare interface CryptoModule { /** * Fills the passed Uint8Array with cryptographically secure random values * @param values - The Uint8Array to fill with random values * @returns The same Uint8Array filled with random values */ getRandomValues: (values: Uint8Array) => Uint8Array; /** * Generates random bytes of specified size * @param size - The number of random bytes to generate. Defaults to 32 if not specified * @returns Uint8Array containing random bytes */ getRandomBytes: (size?: number) => Uint8Array; } /** * Checks if the current environment is a web environment. * * @returns {boolean} True if the current environment is a web environment, false otherwise. */ export declare const isWeb: () => boolean; export { }