UNPKG

@one-payments/adapters-native

Version:

React Native platform adapters for One Payments SDK

76 lines (64 loc) 2.2 kB
import { HttpAdapter, StorageAdapter, CryptoAdapter, TimerAdapter, Adapters } from '@one-payments/core'; /** * React Native HTTP Adapter * @module @one-payments/adapters-native */ /** * Native HTTP Adapter using React Native fetch with strict generics */ declare class NativeHttpAdapter implements HttpAdapter { get<T>(url: string, headers?: Record<string, string>): Promise<T>; post<T>(url: string, body: unknown, headers?: Record<string, string>): Promise<T>; put<T>(url: string, body: unknown, headers?: Record<string, string>): Promise<T>; patch<T>(url: string, body: unknown, headers?: Record<string, string>): Promise<T>; delete<T>(url: string, headers?: Record<string, string>): Promise<T>; } /** * React Native Storage Adapter * @module @one-payments/adapters-native */ /** * Native Storage Adapter using AsyncStorage */ declare class NativeStorageAdapter implements StorageAdapter { private readonly prefix; constructor(prefix?: string); get(key: string): Promise<string | null>; set(key: string, value: string): Promise<void>; remove(key: string): Promise<void>; clear(): Promise<void>; } /** * React Native Crypto Adapter * @module @one-payments/adapters-native */ /** * Native Crypto Adapter using crypto-js with strict typing */ declare class NativeCryptoAdapter implements CryptoAdapter { sha256(input: string | Uint8Array): Promise<string>; hmacSHA256(secret: string, message: string): Promise<string>; uuid(): string; randomBytes(length: number): Uint8Array; private uint8ArrayToWordArray; } /** * React Native Timer Adapter * @module @one-payments/adapters-native */ /** * Native Timer Adapter using native JavaScript APIs */ declare class NativeTimerAdapter implements TimerAdapter { now(): number; delay(ms: number): Promise<void>; } /** * @one-payments/adapters-native - React Native platform adapters * @module @one-payments/adapters-native */ /** * Create native adapters - convenience factory function */ declare function createNativeAdapters(): Adapters; export { NativeCryptoAdapter, NativeHttpAdapter, NativeStorageAdapter, NativeTimerAdapter, createNativeAdapters };