@solarpunkltd/swarm-id 0.0.0-stage → 0.8.0
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/LICENSE +202 -0
- package/README.md +86 -2
- package/dist/bus/account-bus.d.ts +104 -0
- package/dist/bus/account-delta.d.ts +52 -0
- package/dist/bus/bus-context.d.ts +7 -0
- package/dist/bus/envelope.d.ts +9 -0
- package/dist/bus/messages.d.ts +241 -0
- package/dist/bus/presence.d.ts +62 -0
- package/dist/bus/signaling-transport.d.ts +79 -0
- package/dist/chunk/bmt.d.ts +16 -0
- package/dist/chunk/cac.d.ts +17 -0
- package/dist/chunk/constants.d.ts +10 -0
- package/dist/chunk/encrypted-cac.d.ts +47 -0
- package/dist/chunk/encryption.d.ts +85 -0
- package/dist/chunk/index.d.ts +5 -0
- package/dist/chunks/chat-binding-DlH_ZkTn.js +23 -0
- package/dist/chunks/chat-binding-DlH_ZkTn.js.map +1 -0
- package/dist/errors.d.ts +35 -0
- package/dist/index.d.ts +27 -0
- package/dist/internal.d.ts +49 -0
- package/dist/internal.esm.js +2 -0
- package/dist/internal.esm.js.map +1 -0
- package/dist/proxy/act/act.d.ts +58 -0
- package/dist/proxy/act/crypto.d.ts +46 -0
- package/dist/proxy/act/grantee-list.d.ts +81 -0
- package/dist/proxy/act/history.d.ts +182 -0
- package/dist/proxy/act/index.d.ts +114 -0
- package/dist/proxy/app-stamp-limits.d.ts +62 -0
- package/dist/proxy/chunk-upload-stream.d.ts +37 -0
- package/dist/proxy/chunking.d.ts +15 -0
- package/dist/proxy/collection.d.ts +38 -0
- package/dist/proxy/download-data.d.ts +27 -0
- package/dist/proxy/errors.d.ts +8 -0
- package/dist/proxy/feed-manifest.d.ts +60 -0
- package/dist/proxy/feeds/epochs/async-finder.d.ts +70 -0
- package/dist/proxy/feeds/epochs/epoch.d.ts +79 -0
- package/dist/proxy/feeds/epochs/finder.d.ts +60 -0
- package/dist/proxy/feeds/epochs/index.d.ts +30 -0
- package/dist/proxy/feeds/epochs/types.d.ts +110 -0
- package/dist/proxy/feeds/epochs/updater.d.ts +76 -0
- package/dist/proxy/feeds/epochs/utils.d.ts +21 -0
- package/dist/proxy/feeds/index.d.ts +4 -0
- package/dist/proxy/feeds/sequence/async-finder.d.ts +14 -0
- package/dist/proxy/feeds/sequence/finder.d.ts +11 -0
- package/dist/proxy/feeds/sequence/index.d.ts +22 -0
- package/dist/proxy/feeds/sequence/types.d.ts +82 -0
- package/dist/proxy/feeds/sequence/updater.d.ts +20 -0
- package/dist/proxy/index.d.ts +5 -0
- package/dist/proxy/manifest-builder.d.ts +164 -0
- package/dist/proxy/mantaray.d.ts +76 -0
- package/dist/proxy/soc-restamp-slots.d.ts +48 -0
- package/dist/proxy/stamp-chunk.d.ts +45 -0
- package/dist/proxy/stamp-worker-handler.d.ts +32 -0
- package/dist/proxy/stamp-worker-pool.d.ts +52 -0
- package/dist/proxy/stamp-worker.d.ts +1 -0
- package/dist/proxy/types.d.ts +38 -0
- package/dist/proxy/upload.d.ts +207 -0
- package/dist/schemas.d.ts +665 -0
- package/dist/stamp-worker.iife.js +1 -0
- package/dist/storage/debounced-uploader.d.ts +61 -0
- package/dist/storage/utilization-store.d.ts +113 -0
- package/dist/swarm-id-client.d.ts +1114 -0
- package/dist/swarm-id-proxy.d.ts +1031 -0
- package/dist/swarm-id.esm.js +2 -0
- package/dist/swarm-id.esm.js.map +1 -0
- package/dist/sync/batch-write-coordinator.d.ts +347 -0
- package/dist/sync/device-roster.d.ts +59 -0
- package/dist/sync/device-state.d.ts +199 -0
- package/dist/sync/fold-account-from-swarm.d.ts +53 -0
- package/dist/sync/index.d.ts +11 -0
- package/dist/sync/merge-snapshot.d.ts +57 -0
- package/dist/sync/partition-intent.d.ts +218 -0
- package/dist/sync/partition-lease.d.ts +531 -0
- package/dist/sync/partition-lock.d.ts +218 -0
- package/dist/sync/partition-state.d.ts +287 -0
- package/dist/sync/session-check.d.ts +29 -0
- package/dist/sync/store-interfaces.d.ts +48 -0
- package/dist/sync/sync-account.d.ts +45 -0
- package/dist/sync/timing-constants.d.ts +32 -0
- package/dist/sync/types.d.ts +18 -0
- package/dist/types.d.ts +3007 -0
- package/dist/utils/account-state-snapshot.d.ts +43 -0
- package/dist/utils/active-devices.d.ts +45 -0
- package/dist/utils/avatar.d.ts +30 -0
- package/dist/utils/batch-utilization.d.ts +840 -0
- package/dist/utils/batch-write-lock.d.ts +12 -0
- package/dist/utils/bee-error.d.ts +11 -0
- package/dist/utils/chat-binding.d.ts +113 -0
- package/dist/utils/coalesced-task.d.ts +28 -0
- package/dist/utils/collection.d.ts +6 -0
- package/dist/utils/connection-info.d.ts +11 -0
- package/dist/utils/constants.d.ts +28 -0
- package/dist/utils/device-id.d.ts +109 -0
- package/dist/utils/hex.d.ts +31 -0
- package/dist/utils/json-rpc.d.ts +34 -0
- package/dist/utils/key-derivation.d.ts +124 -0
- package/dist/utils/lock-soc.d.ts +35 -0
- package/dist/utils/postage-contract.d.ts +143 -0
- package/dist/utils/postage-stamp-association.d.ts +39 -0
- package/dist/utils/promise.d.ts +37 -0
- package/dist/utils/sealed-values.d.ts +23 -0
- package/dist/utils/seed-encryption.d.ts +17 -0
- package/dist/utils/site-allow-list.d.ts +54 -0
- package/dist/utils/stamp-lifespan.d.ts +37 -0
- package/dist/utils/storage-managers.d.ts +62 -0
- package/dist/utils/storage-probe.d.ts +40 -0
- package/dist/utils/tag.d.ts +11 -0
- package/dist/utils/ttl.d.ts +120 -0
- package/dist/utils/url.d.ts +47 -0
- package/dist/utils/versioned-storage.d.ts +183 -0
- package/package.json +91 -3
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SwarmIdErrorCode, UploadUnavailableReason, WireError } from "./types";
|
|
2
|
+
/** The optional fields of a `SwarmIdError`, by code */
|
|
3
|
+
export interface SwarmIdErrorDetails {
|
|
4
|
+
/** With `upload-unavailable`: why the session refuses to stamp */
|
|
5
|
+
reason?: UploadUnavailableReason;
|
|
6
|
+
/** With `bee-rejected`: the HTTP status Bee or the gateway answered */
|
|
7
|
+
status?: number;
|
|
8
|
+
/** With `bee-rejected`: Bee's own message from the response body */
|
|
9
|
+
beeMessage?: string;
|
|
10
|
+
/** With `bee-rejected`: the path of the request that was refused (no host) */
|
|
11
|
+
url?: string;
|
|
12
|
+
cause?: unknown;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Every rejection a `SwarmIdClient` call produces (#761). `message` is the
|
|
16
|
+
* text a caller always got; `code` is the stable part to branch on, and the
|
|
17
|
+
* details are set for the codes that have them.
|
|
18
|
+
*
|
|
19
|
+
* Constructed on the client side from the wire fields: an `Error` posted
|
|
20
|
+
* through the iframe bridge arrives as a plain `Error` (structured clone keeps
|
|
21
|
+
* `name` and `message` only), so the instance never crosses it. Prefer
|
|
22
|
+
* `error.code` over `instanceof` in a dApp that may bundle two copies of the
|
|
23
|
+
* package.
|
|
24
|
+
*/
|
|
25
|
+
export declare class SwarmIdError extends Error {
|
|
26
|
+
readonly code: SwarmIdErrorCode;
|
|
27
|
+
readonly reason?: UploadUnavailableReason;
|
|
28
|
+
readonly status?: number;
|
|
29
|
+
readonly beeMessage?: string;
|
|
30
|
+
readonly url?: string;
|
|
31
|
+
constructor(code: SwarmIdErrorCode, message: string, details?: SwarmIdErrorDetails);
|
|
32
|
+
/** The fields that cross the bridge */
|
|
33
|
+
toWire(): WireError;
|
|
34
|
+
static fromWire(wire: WireError): SwarmIdError;
|
|
35
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@solarpunkltd/swarm-id` — what a dApp imports.
|
|
3
|
+
*
|
|
4
|
+
* The identity UI's half (sync, key derivation, the account bus, the proxy)
|
|
5
|
+
* is `@solarpunkltd/swarm-id/internal`; see `internal.ts`. Nothing is exported here
|
|
6
|
+
* for the lib's own sake: the proxy and the client import their modules
|
|
7
|
+
* directly, and tests do the same.
|
|
8
|
+
*/
|
|
9
|
+
export { SwarmIdClient } from "./swarm-id-client";
|
|
10
|
+
export type { ClientOptions, AuthStatus, ConnectionInfo, Avatar, AvatarSource, PostageBatch, AppMetadata, ButtonConfig, RequestOptions, UploadOptions, DownloadOptions, UploadResult, UploadUnavailableReason, FileData, SingleOwnerChunk, SocUploadResult, SocRawUploadResult, StampChunkInput, StampedChunk, SOCReader, SOCWriter, FeedReader, FeedWriter, SequentialFeedReader, SequentialFeedWriter, SequentialFeedPayloadResult, SequentialFeedReferenceResult, SequentialFeedUploadResult, ActUploadOptions, UploadFilesOptions, CollectionFileInput, CollectionEntry, } from "./types";
|
|
11
|
+
export type { Reference } from "./schemas";
|
|
12
|
+
export { DEFAULT_BEE_NODE_URL } from "./schemas";
|
|
13
|
+
export { generatedAvatar, generatedAvatarSvg } from "./utils/avatar";
|
|
14
|
+
export { buildBzzManifestNode, extractContentFromFlatManifest, extractEntryFromManifest, } from "./proxy/manifest-builder";
|
|
15
|
+
export { saveMantarayTreeRecursively } from "./proxy/mantaray";
|
|
16
|
+
export type { UploadCallback } from "./proxy/mantaray";
|
|
17
|
+
export { collectionPath } from "./utils/collection";
|
|
18
|
+
export { formatTTL } from "./utils/ttl";
|
|
19
|
+
export { hexToUint8Array, uint8ArrayToHex } from "./utils/hex";
|
|
20
|
+
export { SwarmIdError } from "./errors";
|
|
21
|
+
export type { SwarmIdErrorDetails } from "./errors";
|
|
22
|
+
export type { SwarmIdErrorCode } from "./types";
|
|
23
|
+
export { withTimeout, TimeoutError } from "./utils/promise";
|
|
24
|
+
export { jsonRpcCall, jsonRpcBatch } from "./utils/json-rpc";
|
|
25
|
+
export type { JsonRpcOptions } from "./utils/json-rpc";
|
|
26
|
+
export { CHAT_BINDING_TITLE, acceptedChatBinding, buildChatBindingMessage, isCleanSiteOrigin, parseChatBindingMessage, verifyChatBinding, } from "./utils/chat-binding";
|
|
27
|
+
export type { ChatBinding, ChatBindingFields, ExpectedChatBinding, SiteOriginOptions, VerifiedChatBinding, } from "./utils/chat-binding";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@solarpunkltd/swarm-id/internal` — the identity UI's half of the trusted domain.
|
|
3
|
+
*
|
|
4
|
+
* Everything here takes the account record, the master key or the
|
|
5
|
+
* `derivationKey`, none of which ever leaves the trusted domain, so a dApp has
|
|
6
|
+
* no use for any of it; a dApp holds a `SwarmIdClient` from the package root.
|
|
7
|
+
* The proxy iframe, which lives in the same lib, reaches these modules directly.
|
|
8
|
+
* A name is on this list because `ui/` (its tests included) imports it, or
|
|
9
|
+
* because the docs' "Storage layout" page names it for a host that writes the
|
|
10
|
+
* identity UI's `localStorage` itself (#815) — and for no other reason:
|
|
11
|
+
* nothing is re-exported for a caller that does not exist (#801).
|
|
12
|
+
*/
|
|
13
|
+
export { AccountBus } from "./bus/account-bus";
|
|
14
|
+
export { accountDeltaSnapshot, restoreLocalSessionFields, } from "./bus/account-delta";
|
|
15
|
+
export { deriveBusContext } from "./bus/bus-context";
|
|
16
|
+
export { PRESENCE_INTERVAL_MS, PresenceTracker } from "./bus/presence";
|
|
17
|
+
export { SignalingTransport } from "./bus/signaling-transport";
|
|
18
|
+
export { downloadEncryptedSOC } from "./proxy/download-data";
|
|
19
|
+
export { SocUploadError, uploadSOC } from "./proxy/upload";
|
|
20
|
+
export type { UploadTarget } from "./proxy/upload";
|
|
21
|
+
export { BatchIdSchema, DEFAULT_GNOSIS_RPC_URL, LocalAccountSchemaV1, NetworkSettingsSchemaV1, PostageStampSchemaV1, PrivateKeySchema, SyncedAccountSchemaV1, isSignedOutAccount, } from "./schemas";
|
|
22
|
+
export type { AccessMethod, Account, ConnectedApp, Device, LocalVault, NetworkSettings, PostageStamp, SignedInAccount, SignedOutAccount, SyncedAccount, } from "./schemas";
|
|
23
|
+
export { DebouncedUtilizationUploader } from "./storage/debounced-uploader";
|
|
24
|
+
export { PASSWORD_KDF_ITERATIONS, decryptSeed, deriveKeyFromPassword, deriveKeyFromPrf, deriveKeyFromSecret, deriveKeyFromSignature, encryptSeed, randomSalt, } from "./utils/seed-encryption";
|
|
25
|
+
export { UtilizationStoreDB } from "./storage/utilization-store";
|
|
26
|
+
export { initProxy } from "./swarm-id-proxy";
|
|
27
|
+
export { createSyncAccount, deriveAccountDerivationKey, derivePostageSignerKey, deriveSwarmEncryptionKey, foldAccountFromSwarm, foldedToSyncedAccount, mergeConnectedApps, mergeDevicesList, mergePostageStamps, } from "./sync";
|
|
28
|
+
export type { SyncAccountFunction, SyncResult } from "./sync";
|
|
29
|
+
export { PartitionLease } from "./sync/partition-lease";
|
|
30
|
+
export type { PartitionLeaseStateSnapshot } from "./sync/partition-lease";
|
|
31
|
+
export { AuthDataSchema, STORAGE_CHALLENGE_KEY, STORAGE_KEY_ACCOUNTS, STORAGE_KEY_NETWORK_SETTINGS, leaseCacheStorageKey, } from "./types";
|
|
32
|
+
export type { AccountStateSnapshot } from "./utils/account-state-snapshot";
|
|
33
|
+
export { BUCKET_DEPTH, MIN_USABLE_BATCH_DEPTH, PARTITION_COUNT, UtilizationAwareStamper, } from "./utils/batch-utilization";
|
|
34
|
+
export { runCoalescedAcrossTabs } from "./utils/coalesced-task";
|
|
35
|
+
export { DAY, appSessionDuration } from "./utils/constants";
|
|
36
|
+
export { detectDeviceName, getOrCreateDeviceId, mergeDevices, } from "./utils/device-id";
|
|
37
|
+
export { createChatBinding, onlySiteChatBinding, siteChatAddress, } from "./utils/chat-binding";
|
|
38
|
+
export { DEFAULT_SITE_ALLOW_LIST_ENS_NAME, DEFAULT_SITE_ALLOW_LIST_RECORD_KEY, createSiteAllowList, } from "./utils/site-allow-list";
|
|
39
|
+
export type { SiteAllowList, SiteAllowListSettings, SiteCheck, } from "./utils/site-allow-list";
|
|
40
|
+
export { hexAddress } from "./utils/hex";
|
|
41
|
+
export { deriveChatKey, derivePostageSignerKeySync, deriveSecret, deriveSecretSync, deriveSharingKey, } from "./utils/key-derivation";
|
|
42
|
+
export { calculateContractTTLSeconds, fetchOnChainBatchStateResult, } from "./utils/postage-contract";
|
|
43
|
+
export { stampsReachableByApp } from "./utils/postage-stamp-association";
|
|
44
|
+
export { sleep, withIdleTimeout } from "./utils/promise";
|
|
45
|
+
export { remainingLifespanSeconds } from "./utils/stamp-lifespan";
|
|
46
|
+
export { createAccountsStorageManager, createNetworkSettingsStorageManager, serializePostageStamp, serializeSyncedAccount, } from "./utils/storage-managers";
|
|
47
|
+
export { markFirstPartyStorage } from "./utils/storage-probe";
|
|
48
|
+
export { GNOSIS_BLOCK_TIME, calculateStampAmountForDays } from "./utils/ttl";
|
|
49
|
+
export { isHttpUrl } from "./utils/url";
|