@minca/core 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/elements/auth-styles.d.ts +1 -1
- package/dist/elements/auth-styles.d.ts.map +1 -1
- package/dist/elements/auth-styles.js +21 -4
- package/dist/elements/auth-styles.js.map +1 -1
- package/dist/elements/minca-auth.d.ts.map +1 -1
- package/dist/elements/minca-auth.js +151 -57
- package/dist/elements/minca-auth.js.map +1 -1
- package/dist/identity/abilities.d.ts +2 -0
- package/dist/identity/abilities.d.ts.map +1 -1
- package/dist/identity/abilities.js +2 -0
- package/dist/identity/abilities.js.map +1 -1
- package/dist/identity/account-vault.d.ts +15 -71
- package/dist/identity/account-vault.d.ts.map +1 -1
- package/dist/identity/account-vault.js +45 -104
- package/dist/identity/account-vault.js.map +1 -1
- package/dist/identity/channel.d.ts +3 -9
- package/dist/identity/channel.d.ts.map +1 -1
- package/dist/identity/channel.js +42 -42
- package/dist/identity/channel.js.map +1 -1
- package/dist/identity/contact-key.d.ts +14 -29
- package/dist/identity/contact-key.d.ts.map +1 -1
- package/dist/identity/contact-key.js +31 -51
- package/dist/identity/contact-key.js.map +1 -1
- package/dist/identity/crypto-p256.d.ts.map +1 -1
- package/dist/identity/crypto-p256.js +39 -53
- package/dist/identity/crypto-p256.js.map +1 -1
- package/dist/identity/hpke.d.ts.map +1 -1
- package/dist/identity/hpke.js +19 -19
- package/dist/identity/hpke.js.map +1 -1
- package/dist/identity/identity-manager.d.ts.map +1 -1
- package/dist/identity/identity-manager.js +1 -2
- package/dist/identity/identity-manager.js.map +1 -1
- package/dist/identity/policy.d.ts.map +1 -1
- package/dist/identity/policy.js +35 -61
- package/dist/identity/policy.js.map +1 -1
- package/dist/identity/recovery-code.d.ts +2 -8
- package/dist/identity/recovery-code.d.ts.map +1 -1
- package/dist/identity/recovery-code.js +4 -11
- package/dist/identity/recovery-code.js.map +1 -1
- package/dist/identity/root-signer.d.ts +1 -6
- package/dist/identity/root-signer.d.ts.map +1 -1
- package/dist/identity/root-signer.js +12 -15
- package/dist/identity/root-signer.js.map +1 -1
- package/dist/identity/ucan.d.ts.map +1 -1
- package/dist/identity/ucan.js +48 -39
- package/dist/identity/ucan.js.map +1 -1
- package/dist/identity/webauthn.d.ts +6 -11
- package/dist/identity/webauthn.d.ts.map +1 -1
- package/dist/identity/webauthn.js +18 -30
- package/dist/identity/webauthn.js.map +1 -1
- package/dist/inbox/inbox.d.ts.map +1 -1
- package/dist/inbox/inbox.js +40 -30
- package/dist/inbox/inbox.js.map +1 -1
- package/dist/inbox/index.d.ts +2 -0
- package/dist/inbox/index.d.ts.map +1 -1
- package/dist/inbox/index.js +1 -0
- package/dist/inbox/index.js.map +1 -1
- package/dist/inbox/names.d.ts +54 -0
- package/dist/inbox/names.d.ts.map +1 -0
- package/dist/inbox/names.js +299 -0
- package/dist/inbox/names.js.map +1 -0
- package/dist/index.d.ts +3 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -12
- package/dist/index.js.map +1 -1
- package/dist/network/mesh.d.ts +7 -20
- package/dist/network/mesh.d.ts.map +1 -1
- package/dist/network/mesh.js +267 -245
- package/dist/network/mesh.js.map +1 -1
- package/dist/network/relay-link.d.ts +31 -0
- package/dist/network/relay-link.d.ts.map +1 -0
- package/dist/network/relay-link.js +62 -0
- package/dist/network/relay-link.js.map +1 -0
- package/dist/network/relay-minca.d.ts.map +1 -1
- package/dist/network/relay-minca.js +11 -49
- package/dist/network/relay-minca.js.map +1 -1
- package/dist/network/relay-nostr.d.ts.map +1 -1
- package/dist/network/relay-nostr.js +23 -63
- package/dist/network/relay-nostr.js.map +1 -1
- package/dist/network/relay-socket.d.ts +1 -1
- package/dist/network/relay-socket.d.ts.map +1 -1
- package/dist/network/relay-socket.js +3 -1
- package/dist/network/relay-socket.js.map +1 -1
- package/dist/node/actions.d.ts.map +1 -1
- package/dist/node/actions.js +50 -38
- package/dist/node/actions.js.map +1 -1
- package/dist/node/api.d.ts +6 -0
- package/dist/node/api.d.ts.map +1 -1
- package/dist/node/api.js +6 -0
- package/dist/node/api.js.map +1 -1
- package/dist/node/carrier.d.ts +5 -0
- package/dist/node/carrier.d.ts.map +1 -1
- package/dist/node/carrier.js +94 -73
- package/dist/node/carrier.js.map +1 -1
- package/dist/node/copy.d.ts +8 -7
- package/dist/node/copy.d.ts.map +1 -1
- package/dist/node/copy.js +54 -56
- package/dist/node/copy.js.map +1 -1
- package/dist/node/host.d.ts +39 -65
- package/dist/node/host.d.ts.map +1 -1
- package/dist/node/host.js +362 -379
- package/dist/node/host.js.map +1 -1
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/node-carriers.d.ts +35 -0
- package/dist/node/node-carriers.d.ts.map +1 -0
- package/dist/node/node-carriers.js +562 -0
- package/dist/node/node-carriers.js.map +1 -0
- package/dist/node/node-contacts.d.ts +11 -0
- package/dist/node/node-contacts.d.ts.map +1 -0
- package/dist/node/node-contacts.js +808 -0
- package/dist/node/node-contacts.js.map +1 -0
- package/dist/node/node-context.d.ts +76 -0
- package/dist/node/node-context.d.ts.map +1 -0
- package/dist/node/node-context.js +54 -0
- package/dist/node/node-context.js.map +1 -0
- package/dist/node/node-hosting.d.ts +20 -0
- package/dist/node/node-hosting.d.ts.map +1 -0
- package/dist/node/node-hosting.js +449 -0
- package/dist/node/node-hosting.js.map +1 -0
- package/dist/node/node-records.d.ts +18 -0
- package/dist/node/node-records.d.ts.map +1 -0
- package/dist/node/node-records.js +262 -0
- package/dist/node/node-records.js.map +1 -0
- package/dist/node/node.d.ts.map +1 -1
- package/dist/node/node.js +198 -1990
- package/dist/node/node.js.map +1 -1
- package/dist/node/remote.d.ts +5 -6
- package/dist/node/remote.d.ts.map +1 -1
- package/dist/node/remote.js +272 -260
- package/dist/node/remote.js.map +1 -1
- package/dist/node/space-catalog.d.ts +40 -0
- package/dist/node/space-catalog.d.ts.map +1 -0
- package/dist/node/space-catalog.js +158 -0
- package/dist/node/space-catalog.js.map +1 -0
- package/dist/node/space-checks.d.ts +25 -0
- package/dist/node/space-checks.d.ts.map +1 -0
- package/dist/node/space-checks.js +343 -0
- package/dist/node/space-checks.js.map +1 -0
- package/dist/node/space-history.d.ts +37 -0
- package/dist/node/space-history.d.ts.map +1 -0
- package/dist/node/space-history.js +350 -0
- package/dist/node/space-history.js.map +1 -0
- package/dist/node/space-holding.d.ts +49 -0
- package/dist/node/space-holding.d.ts.map +1 -0
- package/dist/node/space-holding.js +267 -0
- package/dist/node/space-holding.js.map +1 -0
- package/dist/node/space-index.d.ts +41 -0
- package/dist/node/space-index.d.ts.map +1 -0
- package/dist/node/space-index.js +217 -0
- package/dist/node/space-index.js.map +1 -0
- package/dist/node/space-keys.d.ts +34 -0
- package/dist/node/space-keys.d.ts.map +1 -0
- package/dist/node/space-keys.js +309 -0
- package/dist/node/space-keys.js.map +1 -0
- package/dist/node/space-lines.d.ts +33 -0
- package/dist/node/space-lines.d.ts.map +1 -0
- package/dist/node/space-lines.js +145 -0
- package/dist/node/space-lines.js.map +1 -0
- package/dist/node/space-membership.d.ts +69 -0
- package/dist/node/space-membership.d.ts.map +1 -0
- package/dist/node/space-membership.js +242 -0
- package/dist/node/space-membership.js.map +1 -0
- package/dist/node/space-mirrors.d.ts +43 -0
- package/dist/node/space-mirrors.d.ts.map +1 -0
- package/dist/node/space-mirrors.js +125 -0
- package/dist/node/space-mirrors.js.map +1 -0
- package/dist/node/space-peers.d.ts +104 -0
- package/dist/node/space-peers.d.ts.map +1 -0
- package/dist/node/space-peers.js +595 -0
- package/dist/node/space-peers.js.map +1 -0
- package/dist/node/space-profiles.d.ts +18 -0
- package/dist/node/space-profiles.d.ts.map +1 -0
- package/dist/node/space-profiles.js +105 -0
- package/dist/node/space-profiles.js.map +1 -0
- package/dist/node/space-rules.d.ts +29 -0
- package/dist/node/space-rules.d.ts.map +1 -0
- package/dist/node/space-rules.js +144 -0
- package/dist/node/space-rules.js.map +1 -0
- package/dist/node/space-runtime.d.ts +103 -142
- package/dist/node/space-runtime.d.ts.map +1 -1
- package/dist/node/space-runtime.js +290 -3963
- package/dist/node/space-runtime.js.map +1 -1
- package/dist/node/space-standing.d.ts +20 -0
- package/dist/node/space-standing.d.ts.map +1 -0
- package/dist/node/space-standing.js +317 -0
- package/dist/node/space-standing.js.map +1 -0
- package/dist/node/space-versions.d.ts +104 -0
- package/dist/node/space-versions.d.ts.map +1 -0
- package/dist/node/space-versions.js +153 -0
- package/dist/node/space-versions.js.map +1 -0
- package/dist/node/space-warrants.d.ts +25 -0
- package/dist/node/space-warrants.d.ts.map +1 -0
- package/dist/node/space-warrants.js +214 -0
- package/dist/node/space-warrants.js.map +1 -0
- package/dist/node/space-writing.d.ts +72 -0
- package/dist/node/space-writing.d.ts.map +1 -0
- package/dist/node/space-writing.js +440 -0
- package/dist/node/space-writing.js.map +1 -0
- package/dist/node/stores.d.ts +19 -50
- package/dist/node/stores.d.ts.map +1 -1
- package/dist/node/stores.js +14 -33
- package/dist/node/stores.js.map +1 -1
- package/dist/node/types.d.ts +225 -306
- package/dist/node/types.d.ts.map +1 -1
- package/dist/node/usage.d.ts +2 -24
- package/dist/node/usage.d.ts.map +1 -1
- package/dist/node/usage.js +118 -102
- package/dist/node/usage.js.map +1 -1
- package/dist/node/watch-notifications.d.ts.map +1 -1
- package/dist/node/watch-notifications.js +32 -29
- package/dist/node/watch-notifications.js.map +1 -1
- package/dist/node/worker.d.ts +5 -6
- package/dist/node/worker.d.ts.map +1 -1
- package/dist/node/worker.js +80 -72
- package/dist/node/worker.js.map +1 -1
- package/dist/node/writer-keys.d.ts +5 -6
- package/dist/node/writer-keys.d.ts.map +1 -1
- package/dist/node/writer-keys.js +66 -57
- package/dist/node/writer-keys.js.map +1 -1
- package/dist/node/writers.d.ts +12 -19
- package/dist/node/writers.d.ts.map +1 -1
- package/dist/node/writers.js +7 -15
- package/dist/node/writers.js.map +1 -1
- package/dist/privacy/direct.d.ts.map +1 -1
- package/dist/privacy/direct.js +31 -27
- package/dist/privacy/direct.js.map +1 -1
- package/dist/privacy/space-encryption.d.ts.map +1 -1
- package/dist/privacy/space-encryption.js +5 -9
- package/dist/privacy/space-encryption.js.map +1 -1
- package/dist/query/computed.d.ts.map +1 -1
- package/dist/query/computed.js +78 -77
- package/dist/query/computed.js.map +1 -1
- package/dist/query/engine.d.ts +3 -4
- package/dist/query/engine.d.ts.map +1 -1
- package/dist/query/engine.js +93 -86
- package/dist/query/engine.js.map +1 -1
- package/dist/query/filter.d.ts +8 -10
- package/dist/query/filter.d.ts.map +1 -1
- package/dist/query/filter.js +144 -161
- package/dist/query/filter.js.map +1 -1
- package/dist/records/cel-types.d.ts.map +1 -1
- package/dist/records/cel-types.js +13 -27
- package/dist/records/cel-types.js.map +1 -1
- package/dist/records/cel.d.ts.map +1 -1
- package/dist/records/cel.js +177 -242
- package/dist/records/cel.js.map +1 -1
- package/dist/records/rules.d.ts.map +1 -1
- package/dist/records/rules.js +46 -50
- package/dist/records/rules.js.map +1 -1
- package/dist/records/topics.d.ts.map +1 -1
- package/dist/records/topics.js +18 -22
- package/dist/records/topics.js.map +1 -1
- package/dist/schemas/automations.d.ts +8 -15
- package/dist/schemas/automations.d.ts.map +1 -1
- package/dist/schemas/automations.js +203 -165
- package/dist/schemas/automations.js.map +1 -1
- package/dist/schemas/blueprints.d.ts.map +1 -1
- package/dist/schemas/blueprints.js +14 -13
- package/dist/schemas/blueprints.js.map +1 -1
- package/dist/schemas/connectors.d.ts.map +1 -1
- package/dist/schemas/connectors.js +16 -11
- package/dist/schemas/connectors.js.map +1 -1
- package/dist/schemas/contacts.d.ts +57 -0
- package/dist/schemas/contacts.d.ts.map +1 -1
- package/dist/schemas/contacts.js +32 -0
- package/dist/schemas/contacts.js.map +1 -1
- package/dist/schemas/cron.d.ts.map +1 -1
- package/dist/schemas/cron.js +27 -28
- package/dist/schemas/cron.js.map +1 -1
- package/dist/schemas/defined.d.ts +6 -0
- package/dist/schemas/defined.d.ts.map +1 -0
- package/dist/schemas/defined.js +7 -0
- package/dist/schemas/defined.js.map +1 -0
- package/dist/schemas/guides.d.ts +3 -1
- package/dist/schemas/guides.d.ts.map +1 -1
- package/dist/schemas/guides.js +13 -12
- package/dist/schemas/guides.js.map +1 -1
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +18 -14
- package/dist/schemas/index.js.map +1 -1
- package/dist/session/account-hint.d.ts.map +1 -1
- package/dist/session/account-hint.js +8 -5
- package/dist/session/account-hint.js.map +1 -1
- package/dist/session/auth.d.ts +36 -2
- package/dist/session/auth.d.ts.map +1 -1
- package/dist/session/auth.js +95 -2
- package/dist/session/auth.js.map +1 -1
- package/dist/session/connect.d.ts +1 -0
- package/dist/session/connect.d.ts.map +1 -1
- package/dist/session/connect.js +3 -1
- package/dist/session/connect.js.map +1 -1
- package/dist/session/credentials.d.ts +8 -26
- package/dist/session/credentials.d.ts.map +1 -1
- package/dist/session/credentials.js +14 -32
- package/dist/session/credentials.js.map +1 -1
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +1 -0
- package/dist/session/index.js.map +1 -1
- package/dist/session/pairing.d.ts.map +1 -1
- package/dist/session/pairing.js +92 -88
- package/dist/session/pairing.js.map +1 -1
- package/dist/session/password-strength.d.ts.map +1 -1
- package/dist/session/password-strength.js +37 -37
- package/dist/session/password-strength.js.map +1 -1
- package/dist/session/places.d.ts.map +1 -1
- package/dist/session/places.js +18 -13
- package/dist/session/places.js.map +1 -1
- package/dist/session/popup.d.ts +13 -0
- package/dist/session/popup.d.ts.map +1 -0
- package/dist/session/popup.js +23 -0
- package/dist/session/popup.js.map +1 -0
- package/dist/space/constitution.d.ts.map +1 -1
- package/dist/space/constitution.js +22 -29
- package/dist/space/constitution.js.map +1 -1
- package/dist/space/grants.d.ts.map +1 -1
- package/dist/space/grants.js +37 -39
- package/dist/space/grants.js.map +1 -1
- package/dist/space/invite-link.d.ts.map +1 -1
- package/dist/space/invite-link.js +33 -33
- package/dist/space/invite-link.js.map +1 -1
- package/dist/space/own-automations.d.ts +13 -24
- package/dist/space/own-automations.d.ts.map +1 -1
- package/dist/space/own-automations.js +47 -37
- package/dist/space/own-automations.js.map +1 -1
- package/dist/space/roles.d.ts +56 -80
- package/dist/space/roles.d.ts.map +1 -1
- package/dist/space/roles.js +448 -441
- package/dist/space/roles.js.map +1 -1
- package/dist/space/space-access.d.ts +3 -4
- package/dist/space/space-access.d.ts.map +1 -1
- package/dist/space/space-access.js +3 -8
- package/dist/space/space-access.js.map +1 -1
- package/dist/storage/blob/directory.d.ts.map +1 -1
- package/dist/storage/blob/directory.js +39 -32
- package/dist/storage/blob/directory.js.map +1 -1
- package/dist/storage/blob/s3.d.ts.map +1 -1
- package/dist/storage/blob/s3.js +21 -19
- package/dist/storage/blob/s3.js.map +1 -1
- package/dist/storage/blob-store.d.ts +0 -9
- package/dist/storage/blob-store.d.ts.map +1 -1
- package/dist/storage/directory-access.d.ts +8 -32
- package/dist/storage/directory-access.d.ts.map +1 -1
- package/dist/storage/directory-access.js +11 -36
- package/dist/storage/directory-access.js.map +1 -1
- package/dist/storage/encrypted-adapter.d.ts +12 -32
- package/dist/storage/encrypted-adapter.d.ts.map +1 -1
- package/dist/storage/encrypted-adapter.js +31 -54
- package/dist/storage/encrypted-adapter.js.map +1 -1
- package/dist/storage/folder-adapter.d.ts +12 -26
- package/dist/storage/folder-adapter.d.ts.map +1 -1
- package/dist/storage/folder-adapter.js +37 -54
- package/dist/storage/folder-adapter.js.map +1 -1
- package/dist/storage/folder-reconcile.d.ts +12 -26
- package/dist/storage/folder-reconcile.d.ts.map +1 -1
- package/dist/storage/folder-reconcile.js +39 -48
- package/dist/storage/folder-reconcile.js.map +1 -1
- package/dist/storage/indexeddb-adapter.d.ts +2 -6
- package/dist/storage/indexeddb-adapter.d.ts.map +1 -1
- package/dist/storage/indexeddb-adapter.js +60 -114
- package/dist/storage/indexeddb-adapter.js.map +1 -1
- package/dist/storage/mirror.d.ts +0 -29
- package/dist/storage/mirror.d.ts.map +1 -1
- package/dist/storage/mirror.js +153 -110
- package/dist/storage/mirror.js.map +1 -1
- package/dist/storage/segment.d.ts.map +1 -1
- package/dist/storage/segment.js +3 -7
- package/dist/storage/segment.js.map +1 -1
- package/dist/storage/storage-provider.d.ts +6 -11
- package/dist/storage/storage-provider.d.ts.map +1 -1
- package/dist/storage/storage-provider.js +112 -116
- package/dist/storage/storage-provider.js.map +1 -1
- package/dist/sync/sync-engine.d.ts +10 -44
- package/dist/sync/sync-engine.d.ts.map +1 -1
- package/dist/sync/sync-engine.js +245 -247
- package/dist/sync/sync-engine.js.map +1 -1
- package/dist/sync/sync-messages.d.ts +1 -1
- package/dist/sync/sync-messages.d.ts.map +1 -1
- package/dist/sync/sync-messages.js +1 -1
- package/dist/sync/sync-messages.js.map +1 -1
- package/dist/utils/guards.d.ts +1 -0
- package/dist/utils/guards.d.ts.map +1 -1
- package/dist/utils/guards.js +1 -0
- package/dist/utils/guards.js.map +1 -1
- package/dist/utils/hmac.d.ts +5 -0
- package/dist/utils/hmac.d.ts.map +1 -0
- package/dist/utils/hmac.js +20 -0
- package/dist/utils/hmac.js.map +1 -0
- package/dist/utils/map.d.ts +10 -0
- package/dist/utils/map.d.ts.map +1 -0
- package/dist/utils/map.js +30 -0
- package/dist/utils/map.js.map +1 -0
- package/dist/utils/serial.d.ts +2 -0
- package/dist/utils/serial.d.ts.map +1 -1
- package/dist/utils/serial.js +9 -0
- package/dist/utils/serial.js.map +1 -1
- package/dist/validation/capability-gate.d.ts +7 -15
- package/dist/validation/capability-gate.d.ts.map +1 -1
- package/dist/validation/capability-gate.js +32 -36
- package/dist/validation/capability-gate.js.map +1 -1
- package/dist/validation/crypto-gate.d.ts.map +1 -1
- package/dist/validation/crypto-gate.js +12 -21
- package/dist/validation/crypto-gate.js.map +1 -1
- package/docs/README.md +1 -0
- package/docs/actions.md +1 -1
- package/docs/automations.md +1 -1
- package/docs/blueprints-and-guides.md +17 -1
- package/docs/building-an-app.md +7 -4
- package/docs/collections.md +3 -3
- package/docs/contacts.md +34 -1
- package/docs/contracts.md +1 -1
- package/docs/direct-messages.md +1 -1
- package/docs/inbox.md +5 -11
- package/docs/node.md +22 -14
- package/docs/records-and-queries.md +1 -1
- package/docs/sign-in.md +54 -26
- package/docs/spaces.md +6 -6
- package/docs/standard-library.md +7 -6
- package/docs/storage.md +4 -5
- package/docs/usernames.md +161 -0
- package/docs/warrants.md +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob-store.d.ts","sourceRoot":"","sources":["../../src/storage/blob-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAC7C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,uDAAuD;IACvD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"blob-store.d.ts","sourceRoot":"","sources":["../../src/storage/blob-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAC7C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,uDAAuD;IACvD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACzC"}
|
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Getting hold of the user's data folder, and getting it back on the next visit.
|
|
3
3
|
*
|
|
4
|
-
* A directory handle
|
|
5
|
-
*
|
|
6
|
-
* from a user gesture, and permission has to be re-confirmed when a new session
|
|
7
|
-
* starts. The handle itself is structured-cloneable, which means it can be kept
|
|
8
|
-
* in IndexedDB — origin-local storage of a *pointer* to origin-independent data.
|
|
4
|
+
* A directory handle comes only from a user gesture, and its permission must
|
|
5
|
+
* be confirmed again each session. The handle itself can be kept in IndexedDB.
|
|
9
6
|
*/
|
|
10
7
|
import type { DirectoryHandleLike } from './folder-adapter.js';
|
|
11
8
|
/** Read or read-write, in the browser's vocabulary */
|
|
12
9
|
export type FolderAccessMode = 'read' | 'readwrite';
|
|
13
|
-
/**
|
|
14
|
-
* Whether this browser can hand out a directory at all.
|
|
15
|
-
*
|
|
16
|
-
* Chrome, Edge and Opera on the desktop can. Firefox and Safari cannot, and
|
|
17
|
-
* neither can any mobile browser, so a caller has to have something else to
|
|
18
|
-
* offer — this returning false is a normal state, not a broken one.
|
|
19
|
-
*/
|
|
10
|
+
/** Whether this browser can hand out a directory at all: only desktop Chrome, Edge and Opera can */
|
|
20
11
|
export declare function isFolderStorageAvailable(): boolean;
|
|
21
12
|
/**
|
|
22
13
|
* Asks the user to choose their data folder. Must be called from a click.
|
|
23
14
|
*
|
|
24
|
-
* @param options.id Groups the picker's memory of where it last opened.
|
|
25
|
-
* this stable across apps means the second view of the same data opens the
|
|
26
|
-
* picker already pointing at the right folder.
|
|
15
|
+
* @param options.id Groups the picker's memory of where it last opened.
|
|
27
16
|
*/
|
|
28
17
|
export declare function pickDataFolder(options?: {
|
|
29
18
|
id?: string;
|
|
@@ -31,29 +20,16 @@ export declare function pickDataFolder(options?: {
|
|
|
31
20
|
/** Asks what this origin is currently allowed to do with a folder. */
|
|
32
21
|
export declare function queryFolderPermission(handle: DirectoryHandleLike, mode?: FolderAccessMode): Promise<PermissionState>;
|
|
33
22
|
/**
|
|
34
|
-
* Makes sure this origin may use a folder, prompting if
|
|
35
|
-
*
|
|
36
|
-
* The prompt needs a user gesture, so `request` should only be true on a path
|
|
37
|
-
* that began with a click — call it with `false` on page load to find out
|
|
38
|
-
* whether a button needs showing at all.
|
|
23
|
+
* Makes sure this origin may use a folder, prompting if `request` is true.
|
|
24
|
+
* The prompt needs a user gesture, so only pass it on a path that began with a click.
|
|
39
25
|
*/
|
|
40
26
|
export declare function ensureFolderPermission(handle: DirectoryHandleLike, options?: {
|
|
41
27
|
request?: boolean;
|
|
42
28
|
mode?: FolderAccessMode;
|
|
43
29
|
}): Promise<boolean>;
|
|
44
|
-
/**
|
|
45
|
-
* Remembers a folder so the next visit can skip the picker.
|
|
46
|
-
*
|
|
47
|
-
* Only the handle is stored, never the contents — this origin keeps a pointer,
|
|
48
|
-
* and the data stays where the user put it.
|
|
49
|
-
*/
|
|
30
|
+
/** Remembers a folder's handle, so the next visit can skip the picker */
|
|
50
31
|
export declare function rememberDataFolder(handle: DirectoryHandleLike): Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* The folder this origin used last, if the browser still has it.
|
|
53
|
-
*
|
|
54
|
-
* Says nothing about permission — a recalled handle usually needs
|
|
55
|
-
* {@link ensureFolderPermission} with a gesture before it can be read.
|
|
56
|
-
*/
|
|
32
|
+
/** The folder this origin used last, if the browser still has it; it may still need {@link ensureFolderPermission} */
|
|
57
33
|
export declare function recallDataFolder(): Promise<DirectoryHandleLike | null>;
|
|
58
34
|
/** Forgets the remembered folder. The folder and everything in it stay put. */
|
|
59
35
|
export declare function forgetDataFolder(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-access.d.ts","sourceRoot":"","sources":["../../src/storage/directory-access.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"directory-access.d.ts","sourceRoot":"","sources":["../../src/storage/directory-access.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK/D,sDAAsD;AACtD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,CAAC;AAuCpD,oGAAoG;AACpG,wBAAgB,wBAAwB,IAAI,OAAO,CAElD;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,OAAO,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAiB5F;AAED,sEAAsE;AACtE,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,GAAE,gBAA8B,GACnC,OAAO,CAAC,eAAe,CAAC,CAI1B;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,gBAAgB,CAAA;CAAE,GACvD,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED,yEAAyE;AACzE,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnF;AAED,sHAAsH;AACtH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAO5E;AAED,+EAA+E;AAC/E,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAMtD"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Getting hold of the user's data folder, and getting it back on the next visit.
|
|
3
3
|
*
|
|
4
|
-
* A directory handle
|
|
5
|
-
*
|
|
6
|
-
* from a user gesture, and permission has to be re-confirmed when a new session
|
|
7
|
-
* starts. The handle itself is structured-cloneable, which means it can be kept
|
|
8
|
-
* in IndexedDB — origin-local storage of a *pointer* to origin-independent data.
|
|
4
|
+
* A directory handle comes only from a user gesture, and its permission must
|
|
5
|
+
* be confirmed again each session. The handle itself can be kept in IndexedDB.
|
|
9
6
|
*/
|
|
10
7
|
import { protocolError } from '../utils/errors.js';
|
|
11
8
|
import { isObject } from '../utils/guards.js';
|
|
@@ -25,22 +22,14 @@ function canRequest(handle) {
|
|
|
25
22
|
function isDirectoryHandle(value) {
|
|
26
23
|
return isObject(value) && typeof value.getDirectoryHandle === 'function';
|
|
27
24
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Whether this browser can hand out a directory at all.
|
|
30
|
-
*
|
|
31
|
-
* Chrome, Edge and Opera on the desktop can. Firefox and Safari cannot, and
|
|
32
|
-
* neither can any mobile browser, so a caller has to have something else to
|
|
33
|
-
* offer — this returning false is a normal state, not a broken one.
|
|
34
|
-
*/
|
|
25
|
+
/** Whether this browser can hand out a directory at all: only desktop Chrome, Edge and Opera can */
|
|
35
26
|
export function isFolderStorageAvailable() {
|
|
36
27
|
return hasPicker(globalThis);
|
|
37
28
|
}
|
|
38
29
|
/**
|
|
39
30
|
* Asks the user to choose their data folder. Must be called from a click.
|
|
40
31
|
*
|
|
41
|
-
* @param options.id Groups the picker's memory of where it last opened.
|
|
42
|
-
* this stable across apps means the second view of the same data opens the
|
|
43
|
-
* picker already pointing at the right folder.
|
|
32
|
+
* @param options.id Groups the picker's memory of where it last opened.
|
|
44
33
|
*/
|
|
45
34
|
export async function pickDataFolder(options) {
|
|
46
35
|
const scope = globalThis;
|
|
@@ -57,42 +46,28 @@ export async function pickDataFolder(options) {
|
|
|
57
46
|
}
|
|
58
47
|
/** Asks what this origin is currently allowed to do with a folder. */
|
|
59
48
|
export async function queryFolderPermission(handle, mode = 'readwrite') {
|
|
49
|
+
// A handle from a runtime without permissions
|
|
60
50
|
if (!canQuery(handle))
|
|
61
|
-
return 'granted';
|
|
51
|
+
return 'granted';
|
|
62
52
|
return handle.queryPermission({ mode });
|
|
63
53
|
}
|
|
64
54
|
/**
|
|
65
|
-
* Makes sure this origin may use a folder, prompting if
|
|
66
|
-
*
|
|
67
|
-
* The prompt needs a user gesture, so `request` should only be true on a path
|
|
68
|
-
* that began with a click — call it with `false` on page load to find out
|
|
69
|
-
* whether a button needs showing at all.
|
|
55
|
+
* Makes sure this origin may use a folder, prompting if `request` is true.
|
|
56
|
+
* The prompt needs a user gesture, so only pass it on a path that began with a click.
|
|
70
57
|
*/
|
|
71
58
|
export async function ensureFolderPermission(handle, options) {
|
|
72
59
|
const mode = options?.mode ?? 'readwrite';
|
|
73
60
|
if ((await queryFolderPermission(handle, mode)) === 'granted')
|
|
74
61
|
return true;
|
|
75
|
-
if (!options?.request)
|
|
76
|
-
return false;
|
|
77
|
-
if (!canRequest(handle))
|
|
62
|
+
if (!options?.request || !canRequest(handle))
|
|
78
63
|
return false;
|
|
79
64
|
return (await handle.requestPermission({ mode })) === 'granted';
|
|
80
65
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Remembers a folder so the next visit can skip the picker.
|
|
83
|
-
*
|
|
84
|
-
* Only the handle is stored, never the contents — this origin keeps a pointer,
|
|
85
|
-
* and the data stays where the user put it.
|
|
86
|
-
*/
|
|
66
|
+
/** Remembers a folder's handle, so the next visit can skip the picker */
|
|
87
67
|
export async function rememberDataFolder(handle) {
|
|
88
68
|
await idbOnce(HANDLE_DB, HANDLE_STORE, 'readwrite', (store) => store.put(handle, HANDLE_KEY));
|
|
89
69
|
}
|
|
90
|
-
/**
|
|
91
|
-
* The folder this origin used last, if the browser still has it.
|
|
92
|
-
*
|
|
93
|
-
* Says nothing about permission — a recalled handle usually needs
|
|
94
|
-
* {@link ensureFolderPermission} with a gesture before it can be read.
|
|
95
|
-
*/
|
|
70
|
+
/** The folder this origin used last, if the browser still has it; it may still need {@link ensureFolderPermission} */
|
|
96
71
|
export async function recallDataFolder() {
|
|
97
72
|
try {
|
|
98
73
|
const value = await idbOnce(HANDLE_DB, HANDLE_STORE, 'readonly', (store) => store.get(HANDLE_KEY));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-access.js","sourceRoot":"","sources":["../../src/storage/directory-access.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"directory-access.js","sourceRoot":"","sources":["../../src/storage/directory-access.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAsB7C,MAAM,SAAS,GAAG,cAAc,CAAC;AACjC,MAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,MAAM,UAAU,GAAG,aAAa,CAAC;AAEjC,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,qBAAqB,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,mBAAmB,KAAK,UAAU,CAAC;AAC3F,CAAC;AAED,SAAS,QAAQ,CAAC,MAAc;IAC9B,OAAO,iBAAiB,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,eAAe,KAAK,UAAU,CAAC;AACrF,CAAC;AAED,SAAS,UAAU,CAAC,MAAc;IAChC,OAAO,mBAAmB,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,iBAAiB,KAAK,UAAU,CAAC;AACzF,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,kBAAkB,KAAK,UAAU,CAAC;AAC3E,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,wBAAwB;IACtC,OAAO,SAAS,CAAC,UAAU,CAAC,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAyB;IAC5D,MAA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AAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAChG,CAAC;AAED,sHAAsH;AACtH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;QACnG,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3F,CAAC;IAAC,MAAM,CAAC;QACP,qBAAqB;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module encrypted-adapter
|
|
3
|
-
* Encryption at rest for the
|
|
4
|
-
* whole folder away.
|
|
3
|
+
* Encryption at rest for the entries that would give a whole folder away.
|
|
5
4
|
*
|
|
6
|
-
* A private space
|
|
7
|
-
* the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* they are readable only once the folder has actually been unlocked.
|
|
12
|
-
*
|
|
13
|
-
* Scoped deliberately narrowly. Versions and their index entries pass
|
|
14
|
-
* straight through: bodies are already encrypted where it matters, files are
|
|
15
|
-
* content addressed, and sealing them would cost the property that makes a folder worth
|
|
16
|
-
* having — that you can open it and see what is in it. What stays legible is
|
|
17
|
-
* each record's author, timestamp and collection, plus anything in a space its
|
|
18
|
-
* owner made public.
|
|
5
|
+
* A private space's bodies are already encrypted, but its key is written into
|
|
6
|
+
* the same store. So the space registry — each space, its key and secrets — is
|
|
7
|
+
* sealed under a key derived from the account seed, readable only once the
|
|
8
|
+
* folder is unlocked. Versions pass straight through: their bodies are
|
|
9
|
+
* encrypted where it matters, and a folder stays legible to whoever opens it.
|
|
19
10
|
*/
|
|
20
11
|
import type { StorageAdapter } from '../types.js';
|
|
21
12
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* for it and its relays — and nothing else.
|
|
25
|
-
*
|
|
26
|
-
* A prefix match, so each must end in its colon: `space:` does not cover
|
|
27
|
-
* `spaceinvite:`, and an invite secret left out here is anyone-with-the-folder
|
|
28
|
-
* joining a space in your place.
|
|
13
|
+
* The space registry's prefixes: what is sealed by default. Each ends in its
|
|
14
|
+
* colon, so `space:` does not cover `spaceinvite:`.
|
|
29
15
|
*/
|
|
30
16
|
export declare const DEFAULT_ENCRYPTED_PREFIXES: ReadonlyArray<string>;
|
|
31
17
|
export interface EncryptedAdapterOptions {
|
|
@@ -33,18 +19,12 @@ export interface EncryptedAdapterOptions {
|
|
|
33
19
|
readonly prefixes?: ReadonlyArray<string>;
|
|
34
20
|
}
|
|
35
21
|
/**
|
|
36
|
-
* Wraps
|
|
37
|
-
* and
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* cannot be swapped between entries. A value under a sealed prefix that does
|
|
41
|
-
* not open is refused, not trusted: anyone who can write the folder could
|
|
42
|
-
* otherwise plant a space, or a key, in the clear.
|
|
22
|
+
* Wraps an adapter so values under the sealed prefixes are encrypted on the
|
|
23
|
+
* way in and opened on the way out. Each is bound to its storage key, so they
|
|
24
|
+
* can't be swapped between entries, and one that does not open is refused:
|
|
25
|
+
* otherwise anyone who can write the folder could plant a space in the clear.
|
|
43
26
|
*
|
|
44
|
-
* @param inner The adapter doing the actual storing
|
|
45
27
|
* @param key The account's local key (`deriveLocalKey`)
|
|
46
|
-
* @param options Which keys to seal
|
|
47
|
-
* @returns An adapter with the same contract
|
|
48
28
|
*/
|
|
49
29
|
export declare function createEncryptedAdapter(inner: StorageAdapter, key: CryptoKey, options?: EncryptedAdapterOptions): StorageAdapter;
|
|
50
30
|
//# sourceMappingURL=encrypted-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encrypted-adapter.d.ts","sourceRoot":"","sources":["../../src/storage/encrypted-adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"encrypted-adapter.d.ts","sourceRoot":"","sources":["../../src/storage/encrypted-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAW,MAAM,aAAa,CAAC;AAM3D;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,aAAa,CAAC,MAAM,CAO5D,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,cAAc,EACrB,GAAG,EAAE,SAAS,EACd,OAAO,CAAC,EAAE,uBAAuB,GAChC,cAAc,CAqChB"}
|
|
@@ -1,33 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module encrypted-adapter
|
|
3
|
-
* Encryption at rest for the
|
|
4
|
-
* whole folder away.
|
|
3
|
+
* Encryption at rest for the entries that would give a whole folder away.
|
|
5
4
|
*
|
|
6
|
-
* A private space
|
|
7
|
-
* the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* they are readable only once the folder has actually been unlocked.
|
|
12
|
-
*
|
|
13
|
-
* Scoped deliberately narrowly. Versions and their index entries pass
|
|
14
|
-
* straight through: bodies are already encrypted where it matters, files are
|
|
15
|
-
* content addressed, and sealing them would cost the property that makes a folder worth
|
|
16
|
-
* having — that you can open it and see what is in it. What stays legible is
|
|
17
|
-
* each record's author, timestamp and collection, plus anything in a space its
|
|
18
|
-
* owner made public.
|
|
5
|
+
* A private space's bodies are already encrypted, but its key is written into
|
|
6
|
+
* the same store. So the space registry — each space, its key and secrets — is
|
|
7
|
+
* sealed under a key derived from the account seed, readable only once the
|
|
8
|
+
* folder is unlocked. Versions pass straight through: their bodies are
|
|
9
|
+
* encrypted where it matters, and a folder stays legible to whoever opens it.
|
|
19
10
|
*/
|
|
20
11
|
import { openEnvelope, sealEnvelope } from '../identity/envelope.js';
|
|
21
12
|
/** The envelope label of a value sealed at rest; bound to `{ entry }`, its storage key */
|
|
22
13
|
const AT_REST_LABEL = 'minca/at-rest/v1';
|
|
23
14
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* for it and its relays — and nothing else.
|
|
27
|
-
*
|
|
28
|
-
* A prefix match, so each must end in its colon: `space:` does not cover
|
|
29
|
-
* `spaceinvite:`, and an invite secret left out here is anyone-with-the-folder
|
|
30
|
-
* joining a space in your place.
|
|
15
|
+
* The space registry's prefixes: what is sealed by default. Each ends in its
|
|
16
|
+
* colon, so `space:` does not cover `spaceinvite:`.
|
|
31
17
|
*/
|
|
32
18
|
export const DEFAULT_ENCRYPTED_PREFIXES = [
|
|
33
19
|
'space:',
|
|
@@ -38,53 +24,44 @@ export const DEFAULT_ENCRYPTED_PREFIXES = [
|
|
|
38
24
|
'spacerelays:',
|
|
39
25
|
];
|
|
40
26
|
/**
|
|
41
|
-
* Wraps
|
|
42
|
-
* and
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* cannot be swapped between entries. A value under a sealed prefix that does
|
|
46
|
-
* not open is refused, not trusted: anyone who can write the folder could
|
|
47
|
-
* otherwise plant a space, or a key, in the clear.
|
|
27
|
+
* Wraps an adapter so values under the sealed prefixes are encrypted on the
|
|
28
|
+
* way in and opened on the way out. Each is bound to its storage key, so they
|
|
29
|
+
* can't be swapped between entries, and one that does not open is refused:
|
|
30
|
+
* otherwise anyone who can write the folder could plant a space in the clear.
|
|
48
31
|
*
|
|
49
|
-
* @param inner The adapter doing the actual storing
|
|
50
32
|
* @param key The account's local key (`deriveLocalKey`)
|
|
51
|
-
* @param options Which keys to seal
|
|
52
|
-
* @returns An adapter with the same contract
|
|
53
33
|
*/
|
|
54
34
|
export function createEncryptedAdapter(inner, key, options) {
|
|
55
35
|
const prefixes = options?.prefixes ?? DEFAULT_ENCRYPTED_PREFIXES;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
async function unseal(storageKey, bytes) {
|
|
61
|
-
const opened = await openEnvelope(key, AT_REST_LABEL, { entry: storageKey }, bytes);
|
|
36
|
+
const sealed = (entry) => prefixes.some((prefix) => entry.startsWith(prefix));
|
|
37
|
+
const seal = (entry, value) => sealEnvelope(key, AT_REST_LABEL, { entry }, value);
|
|
38
|
+
async function unseal(entry, bytes) {
|
|
39
|
+
const opened = await openEnvelope(key, AT_REST_LABEL, { entry }, bytes);
|
|
62
40
|
if (!opened)
|
|
63
|
-
throw new Error(`${
|
|
41
|
+
throw new Error(`${entry} should be sealed under this account, and is not — refusing it`);
|
|
64
42
|
return opened;
|
|
65
43
|
}
|
|
44
|
+
async function sealOp(op) {
|
|
45
|
+
if (op.type !== 'put' || !sealed(op.key))
|
|
46
|
+
return op;
|
|
47
|
+
return { type: 'put', key: op.key, value: await seal(op.key, op.value) };
|
|
48
|
+
}
|
|
66
49
|
return Object.freeze({
|
|
67
|
-
async get(
|
|
68
|
-
const bytes = await inner.get(
|
|
69
|
-
if (!bytes || !
|
|
50
|
+
async get(entry) {
|
|
51
|
+
const bytes = await inner.get(entry);
|
|
52
|
+
if (!bytes || !sealed(entry))
|
|
70
53
|
return bytes;
|
|
71
|
-
return unseal(
|
|
54
|
+
return unseal(entry, bytes);
|
|
72
55
|
},
|
|
73
|
-
async put(
|
|
74
|
-
return inner.put(
|
|
56
|
+
async put(entry, value) {
|
|
57
|
+
return inner.put(entry, sealed(entry) ? await seal(entry, value) : value);
|
|
75
58
|
},
|
|
76
59
|
async batch(ops) {
|
|
77
|
-
|
|
78
|
-
? { type: 'put', key: op.key, value: await seal(op.key, op.value) }
|
|
79
|
-
: op));
|
|
80
|
-
return inner.batch(prepared);
|
|
60
|
+
return inner.batch(await Promise.all(ops.map(sealOp)));
|
|
81
61
|
},
|
|
82
|
-
// Key names
|
|
83
|
-
|
|
84
|
-
// and its key live in the value, which is sealed.
|
|
85
|
-
delete: (storageKey) => inner.delete(storageKey),
|
|
62
|
+
// Key names stay in the clear: a space id is a content hash and says nothing.
|
|
63
|
+
delete: (entry) => inner.delete(entry),
|
|
86
64
|
list: (prefix) => inner.list(prefix),
|
|
87
|
-
// Versions carry their own encryption where the space calls for it.
|
|
88
65
|
putVersion: inner.putVersion.bind(inner),
|
|
89
66
|
getVersion: (id) => inner.getVersion(id),
|
|
90
67
|
deleteVersion: (id) => inner.deleteVersion(id),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encrypted-adapter.js","sourceRoot":"","sources":["../../src/storage/encrypted-adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"encrypted-adapter.js","sourceRoot":"","sources":["../../src/storage/encrypted-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAErE,0FAA0F;AAC1F,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAA0B;IAC/D,QAAQ;IACR,WAAW;IACX,cAAc;IACd,YAAY;IACZ,iBAAiB;IACjB,cAAc;CACf,CAAC;AAOF;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAqB,EACrB,GAAc,EACd,OAAiC;IAEjC,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAA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QACD,KAAK,CAAC,GAAG,CAAC,KAAa,EAAE,KAAiB;YACxC,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC5E,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,GAA2B;YACrC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC;QACD,8EAA8E;QAC9E,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;QAC9C,IAAI,EAAE,CAAC,MAAe,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAC7C,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;QACxC,UAAU,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QAChD,aAAa,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QACtD,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE;KAC3B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -14,12 +14,10 @@
|
|
|
14
14
|
* versions/<cid>.json
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
|
-
* **Versions are the truth; the entries are an index over them.**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* mutable thing, which version is current, is derived state that either side
|
|
22
|
-
* can put right. {@link reconcileFolder} is what puts it right.
|
|
17
|
+
* **Versions are the truth; the entries are an index over them.** Version
|
|
18
|
+
* files are immutable and named by their content hash, so two origins can
|
|
19
|
+
* share a folder without locking; which version is current is derived, and
|
|
20
|
+
* {@link reconcileFolder} puts it right.
|
|
23
21
|
*/
|
|
24
22
|
import type { StorageAdapter } from '../types.js';
|
|
25
23
|
export interface WritableFileLike {
|
|
@@ -61,24 +59,16 @@ export interface FolderAdapter extends StorageAdapter {
|
|
|
61
59
|
/** Where inside the folder this adapter keeps its files */
|
|
62
60
|
readonly namespace: string;
|
|
63
61
|
/**
|
|
64
|
-
* Re-reads the directory, picking up writes made by another origin or
|
|
65
|
-
*
|
|
66
|
-
* There is no filesystem change notification on the web, so freshness is
|
|
67
|
-
* something the caller asks for — on an interval, on focus, or after a sync
|
|
68
|
-
* round. Pair it with {@link reconcileFolder} to fold what turns up into the
|
|
69
|
-
* local tree.
|
|
62
|
+
* Re-reads the directory, picking up writes made by another origin or
|
|
63
|
+
* device; the web has no change notification. Pair it with {@link reconcileFolder}.
|
|
70
64
|
*/
|
|
71
65
|
reload(): Promise<FolderReload>;
|
|
72
66
|
/** Every version id currently on disk, whatever the entries believe */
|
|
73
67
|
listVersionIds(): Promise<ReadonlyArray<string>>;
|
|
74
68
|
}
|
|
75
69
|
/**
|
|
76
|
-
* Percent-encodes a storage key into a filename.
|
|
77
|
-
*
|
|
78
|
-
* Only lowercase is left unescaped, which looks excessive until you remember
|
|
79
|
-
* that macOS and Windows filesystems are case-insensitive by default: without
|
|
80
|
-
* this, the keys `space:Abc` and `space:abc` would quietly become one file and
|
|
81
|
-
* one of the two values would be lost.
|
|
70
|
+
* Percent-encodes a storage key into a filename. Upper case is escaped too:
|
|
71
|
+
* on a case-insensitive filesystem `space:Abc` and `space:abc` would be one file.
|
|
82
72
|
*/
|
|
83
73
|
export declare function encodeKey(key: string): string;
|
|
84
74
|
/** Reverses {@link encodeKey}. */
|
|
@@ -94,15 +84,11 @@ export declare function writeFolderFile(dir: DirectoryHandleLike, name: string,
|
|
|
94
84
|
/** Deletes a file, ignoring one that is already gone. */
|
|
95
85
|
export declare function removeFile(dir: DirectoryHandleLike, name: string): Promise<void>;
|
|
96
86
|
/**
|
|
97
|
-
* Opens a storage adapter backed by a directory on the user's disk.
|
|
98
|
-
*
|
|
99
|
-
* Versions are held in memory as well as on disk — a query would otherwise
|
|
100
|
-
* mean one file read per record, and the example app re-lists on every render.
|
|
101
|
-
* The cost is that the working set has to fit in memory.
|
|
87
|
+
* Opens a storage adapter backed by a directory on the user's disk. Versions
|
|
88
|
+
* are held in memory too, or a query would read one file per record.
|
|
102
89
|
*
|
|
103
|
-
* @param path Where to keep these files
|
|
104
|
-
* subdirectories
|
|
105
|
-
* accounts can each have a subtree of their own.
|
|
90
|
+
* @param path Where to keep these files from the folder root, `/` separating
|
|
91
|
+
* subdirectories, so several accounts can each have a subtree.
|
|
106
92
|
*/
|
|
107
93
|
export declare function createFolderAdapter(root: DirectoryHandleLike, path: string): Promise<FolderAdapter>;
|
|
108
94
|
//# sourceMappingURL=folder-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-adapter.d.ts","sourceRoot":"","sources":["../../src/storage/folder-adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"folder-adapter.d.ts","sourceRoot":"","sources":["../../src/storage/folder-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,aAAa,CAAC;AAOpE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,IAAI,OAAO,CAAC;QAAE,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC,CAAC;IAC5D,cAAc,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC7C;AAED,MAAM,WA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