UNPKG

bigblocks

Version:

Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React

72 lines (71 loc) 2.92 kB
// Combined BAP Identity Hook - Combines encryption, signing, key rotation, and profile sync import { useBapEncryption } from "./useBapEncryption.js"; import { useBapKeyRotation } from "./useBapKeyRotation.js"; import { useBapProfileSync } from "./useBapProfileSync.js"; import { useBapSigning } from "./useBapSigning.js"; export function useBapIdentity(options = {}) { const encryption = useBapEncryption(options.encryption); const signing = useBapSigning(options.signing); const keyRotation = useBapKeyRotation(options.keyRotation); const profileSync = useBapProfileSync(options.profileSync); return { // Encryption operations encrypt: encryption.encrypt, encryptAsync: encryption.encryptAsync, decrypt: encryption.decrypt, decryptAsync: encryption.decryptAsync, getEncryptionKey: encryption.getEncryptionKey, // Signing operations signFile: signing.signFile, signFileAsync: signing.signFileAsync, verifyFile: signing.verifyFile, verifyFileAsync: signing.verifyFileAsync, broadcastSignature: signing.broadcastSignature, broadcastSignatureAsync: signing.broadcastSignatureAsync, // Key rotation operations rotateKey: keyRotation.rotateKey, rotateKeyAsync: keyRotation.rotateKeyAsync, rotationHistory: keyRotation.rotationHistory, currentKeyInfo: keyRotation.currentKeyInfo, // Profile synchronization operations syncProfiles: profileSync.syncProfiles, resetProfileSync: profileSync.resetSync, fetchProfile: profileSync.fetchProfile, validateByAddress: profileSync.validateByAddress, // Profile sync state isScanning: profileSync.isScanning, syncProgress: profileSync.progress, currentSyncId: profileSync.currentId, foundProfileCount: profileSync.foundCount, syncResult: profileSync.result, isSyncSuccess: profileSync.isSuccess, // Combined state isLoading: encryption.isLoading || signing.isLoading || keyRotation.isLoading || profileSync.isScanning, isError: encryption.isError || signing.isError || keyRotation.isError || !!profileSync.error, isSuccess: encryption.isSuccess || signing.isSuccess || keyRotation.isSuccess || profileSync.isSuccess, hasError: encryption.isError || signing.isError || keyRotation.isError || !!profileSync.error, error: encryption.error || signing.error || keyRotation.error || profileSync.error, // Combined reset reset: () => { encryption.reset(); signing.reset(); keyRotation.reset(); profileSync.resetSync(); }, }; }