/** * React Native package entry for @ajna-inc/vaults. * * This entry is picked by the package.json `exports."react-native"` condition * and by Metro. It re-exports the same surface as `./index` BUT routes the * crypto layer through `./crypto/index.rn` (no WASM). * * Mobile consumers (e.g. bifold-wallet-v2) get this file. Server consumers * keep using `./index` which loads the WASM. * * Implementation note: * We need every service/handler in this package to use the RN crypto * provider. Those modules import `'../crypto'` relatively, so we cannot * switch them at the package.json `exports` level. Instead, this entry is * bundled by tsdown (`unbundle: false`) and imports `./crypto/index.rn` * FIRST — that re-exports the same symbol names with the RN provider, and * the bundler resolves the rest of the graph from there. * * The trick: when bundling starts at this entry and we re-export * everything via `export *` from a barrel that references `./crypto`, the * bundler will choose the relative `./crypto/index.ts` resolution. To * avoid that we explicitly substitute every internal `from './crypto'` * import to `from './crypto/index.rn'` inside this entry's tree. The * build config achieves this by listing `./crypto` as an alias (see * tsdown.config.ts → React Native entry). * * As of 0.2.4 we DO re-export VaultsModule / VaultsApi: the platform- * extension trick (`crypto/index.native.ts`) routes `'../crypto'` to the * RN provider transparently, so services/* is safe to pull into the RN * bundle. Wallets can register the module and pick up the inbound * message handlers (vault-stored-ack, vault-data, etc.) for free * instead of writing their own one-shot handlers. * * Original (pre-0.2.4) note kept below for context: * * Pragmatic shortcut taken below: we don't re-export VaultsModule/services * directly. Mobile-side consumption of vaults primitives goes through this * entry's exported low-level crypto + DIDComm message classes; the agent- * module surface (VaultsModule, VaultsApi) is intentionally not exposed on * RN today because it would require pulling in services/* which import * '../crypto' (resolves to Node provider). Mobile uses the low-level * crypto + message classes directly (see bifold-wallet-v2 BackupService). */ export { aesGcmEncrypt, aesGcmDecrypt, xchachaEncrypt, xchachaDecrypt, argon2id, hkdfExpand, hkdfJoin, deriveCek, deriveKid, deriveSymmetricKid, kemGenerateKeypair, kemEncapsulate, kemDecapsulate, kemWrapCek, kemUnwrapCek, shamirSplit, shamirReconstruct, shamirSplitAndWrap, shamirUnwrapAndReconstruct, SecretShare, randomBytes, generateCek, generateNonceAesGcm, generateNonceXchacha, keyCommitment, verifyKeyCommitment, sha256, blake2s256, computeSummary, constantTimeEq, toBase64Url, fromBase64Url, toHex, fromHex, generateUuid, zeroize, canonicalAad, buildContext, crypto, } from './crypto/index.native'; export type { AeadResult, KemKeypair, KemEncapResult, SecretShareLike, KeyInput, CryptoProvider } from './crypto/provider'; export { VaultsModule } from './VaultsModule'; export type { VaultsModuleConfig } from './VaultsModule'; export { VaultsApi } from './VaultsApi'; export * from './models'; export * from './messages'; export { VaultEventTypes } from './VaultsEvents'; export type { VaultEvent, ProposeReceivedEvent, OfferReceivedEvent, AccessGrantedEvent, SealedEvent, RetiredEvent, ProblemReportReceivedEvent, } from './VaultsEvents'; export * from './jwe'; export * from './zcap'; export * from './errors'; export { encryptWithPassphraseRn, decryptWithPassphraseRn, } from './rn-helpers'; export { deriveBackupKeysFromSeed, BackupKeyLabels } from './seed-keys'; export type { BackupKeys } from './seed-keys';