Storacha Backup
Backup and restore uses UCAN-delegated access to Storacha decentralized storage with IPNS recovery manifests.
Auth Flow
The library uses UCAN-only authentication for Storacha — no key+proof credential login.
Key Functions
import {
createStorachaClient,
parseDelegation,
storeDelegation,
loadStoredDelegation,
clearStoredDelegation,
} from 'p2pass';
parseDelegation(proofString)— Parse multibase, base64, or CAR bytescreateStorachaClient(principal, delegation)— Create authenticated clientstoreDelegation(base64, registryDb?, spaceDid?)— Store in registry or localStorageloadStoredDelegation(registryDb?)— Load stored delegationclearStoredDelegation(registryDb?)— Clear delegation(s)
Backup & Restore
The OrbitDBStorachaBridge handles block-level backup and restore:
import { OrbitDBStorachaBridge } from 'orbitdb-storacha-bridge';
const bridge = new OrbitDBStorachaBridge({ ucanClient: client });
bridge.spaceDID = currentSpace.did();
// Backup
const result = await bridge.backup(orbitdb, database.address);
// Restore
const result = await bridge.restoreFromSpace(orbitdb, {
timeout: 120000,
preferredDatabaseName: 'my-db',
restartAfterRestore: true,
verifyIntegrity: true,
});
IPNS Recovery Manifest
After backup, an IPNS manifest is published containing:
registryAddress— OrbitDB registry addressdelegation— UCAN delegation stringownerDid— The user's Ed25519 DIDarchiveCID— IPFS CID of the encrypted key archive
import {
createManifest,
publishManifest,
resolveManifest,
uploadArchiveToIPFS,
fetchArchiveFromIPFS,
} from 'p2pass';
Storage Hierarchy
- Registry DB (preferred) — OrbitDB keyvalue database, replicated across devices
- localStorage (fallback) — Used before registry is available
p2p_passkeys_registry_address— Registry OrbitDB addressp2p_passkeys_owner_did— Owner DID for local-first recoveryp2p_passkeys_worker_archive— Encrypted Ed25519 archive for bootstrap
Key Files
src/lib/ucan/storacha-auth.js— UCAN client creation and delegation storagesrc/lib/backup/registry-backup.js— Registry DB backup/restoresrc/lib/recovery/manifest.js— IPNS manifest publish/resolvesrc/lib/recovery/ipns-key.js— Deterministic IPNS keypair derivation