@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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single ACT entry: lookup key + encrypted access key
|
|
3
|
+
*/
|
|
4
|
+
export interface ActEntry {
|
|
5
|
+
lookupKey: Uint8Array;
|
|
6
|
+
encryptedAccessKey: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Serialize ACT entries to JSON bytes (Bee-compatible Simple Manifest format)
|
|
10
|
+
*
|
|
11
|
+
* @param entries - Array of ACT entries
|
|
12
|
+
* @returns JSON-encoded bytes
|
|
13
|
+
*/
|
|
14
|
+
export declare function serializeAct(entries: ActEntry[]): Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Deserialize ACT entries from JSON bytes (Bee-compatible Simple Manifest format)
|
|
17
|
+
*
|
|
18
|
+
* @param data - JSON-encoded bytes
|
|
19
|
+
* @returns Array of ACT entries
|
|
20
|
+
*/
|
|
21
|
+
export declare function deserializeAct(data: Uint8Array): ActEntry[];
|
|
22
|
+
/**
|
|
23
|
+
* Find an ACT entry by lookup key
|
|
24
|
+
*
|
|
25
|
+
* @param entries - Array of ACT entries
|
|
26
|
+
* @param lookupKey - 32-byte lookup key
|
|
27
|
+
* @returns The entry if found, undefined otherwise
|
|
28
|
+
*/
|
|
29
|
+
export declare function findEntryByLookupKey(entries: ActEntry[], lookupKey: Uint8Array): ActEntry | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Check if two public keys are equal
|
|
32
|
+
*/
|
|
33
|
+
export declare function publicKeysEqual(a: {
|
|
34
|
+
x: Uint8Array;
|
|
35
|
+
y: Uint8Array;
|
|
36
|
+
}, b: {
|
|
37
|
+
x: Uint8Array;
|
|
38
|
+
y: Uint8Array;
|
|
39
|
+
}): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Helper to collect all ACT entries from JSON-encoded ACT data
|
|
42
|
+
*
|
|
43
|
+
* This is a convenience function for working with JSON ACT data directly from storage.
|
|
44
|
+
*
|
|
45
|
+
* @param actData - JSON-encoded ACT data from storage
|
|
46
|
+
* @returns Array of ACT entries
|
|
47
|
+
*/
|
|
48
|
+
export declare function collectActEntriesFromJson(actData: Uint8Array): ActEntry[];
|
|
49
|
+
/**
|
|
50
|
+
* Helper to find an ACT entry by lookup key from JSON-encoded ACT data
|
|
51
|
+
*
|
|
52
|
+
* This is a convenience function for working with JSON ACT data directly from storage.
|
|
53
|
+
*
|
|
54
|
+
* @param actData - JSON-encoded ACT data from storage
|
|
55
|
+
* @param lookupKey - 32-byte lookup key to search for
|
|
56
|
+
* @returns The encrypted access key if found, undefined otherwise
|
|
57
|
+
*/
|
|
58
|
+
export declare function findActEntryByKey(actData: Uint8Array, lookupKey: Uint8Array): Uint8Array | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { generateRandomKey } from "../../chunk";
|
|
2
|
+
export { generateRandomKey };
|
|
3
|
+
/**
|
|
4
|
+
* Derive public key from private key
|
|
5
|
+
*/
|
|
6
|
+
export declare function publicKeyFromPrivate(privKey: Uint8Array): {
|
|
7
|
+
x: Uint8Array;
|
|
8
|
+
y: Uint8Array;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Compute ECDH shared secret (x-coordinate of shared point)
|
|
12
|
+
*
|
|
13
|
+
* The public key point is validated to be on secp256k1 (rejects off-curve
|
|
14
|
+
* points and the point at infinity) before multiplying — feeding an
|
|
15
|
+
* unvalidated point to scalar multiplication would enable an invalid-curve
|
|
16
|
+
* attack on the private key.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ecdhSharedSecret(privKey: Uint8Array, pubX: Uint8Array, pubY: Uint8Array): Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* Derive lookup key and access key decryption key from ECDH shared secret
|
|
21
|
+
*/
|
|
22
|
+
export declare function deriveKeys(privKey: Uint8Array, pubX: Uint8Array, pubY: Uint8Array): {
|
|
23
|
+
lookupKey: Uint8Array;
|
|
24
|
+
accessKeyDecryptionKey: Uint8Array;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Counter-mode encryption/decryption
|
|
28
|
+
* Matches Bee's Go implementation (bee/pkg/encryption/encryption.go:134-168)
|
|
29
|
+
* For each 32-byte block i: data[i] XOR keccak256(keccak256(key || uint32LE(i)))
|
|
30
|
+
*/
|
|
31
|
+
export declare function counterModeEncrypt(data: Uint8Array, key: Uint8Array): Uint8Array;
|
|
32
|
+
/**
|
|
33
|
+
* Counter-mode decryption (symmetric with encryption)
|
|
34
|
+
*/
|
|
35
|
+
export declare const counterModeDecrypt: typeof counterModeEncrypt;
|
|
36
|
+
/**
|
|
37
|
+
* Parse compressed public key (33 bytes) to uncompressed coordinates
|
|
38
|
+
*/
|
|
39
|
+
export declare function publicKeyFromCompressed(compressed: Uint8Array): {
|
|
40
|
+
x: Uint8Array;
|
|
41
|
+
y: Uint8Array;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Compress public key to 33 bytes
|
|
45
|
+
*/
|
|
46
|
+
export declare function compressPublicKey(x: Uint8Array, y: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public key in uncompressed format
|
|
3
|
+
*/
|
|
4
|
+
export interface UncompressedPublicKey {
|
|
5
|
+
x: Uint8Array;
|
|
6
|
+
y: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Derive the encryption key for the grantee list
|
|
10
|
+
*
|
|
11
|
+
* This is different from the legacy format key derivation.
|
|
12
|
+
* The grantee list is encrypted with a key derived from the publisher's private key.
|
|
13
|
+
*/
|
|
14
|
+
export declare function deriveGranteeListEncryptionKey(publisherPrivKey: Uint8Array): Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Serialize grantee list to Bee-compatible format
|
|
17
|
+
*
|
|
18
|
+
* Bee stores grantees as concatenated 65-byte uncompressed secp256k1 public keys.
|
|
19
|
+
* Format: [0x04 || X (32 bytes) || Y (32 bytes)] for each key
|
|
20
|
+
*
|
|
21
|
+
* @param grantees - Array of public keys with x and y coordinates
|
|
22
|
+
* @returns Serialized grantee list
|
|
23
|
+
*/
|
|
24
|
+
export declare function serializeGranteeList(grantees: UncompressedPublicKey[]): Uint8Array;
|
|
25
|
+
/**
|
|
26
|
+
* Deserialize grantee list from Bee-compatible format
|
|
27
|
+
*
|
|
28
|
+
* @param data - Serialized grantee list (concatenated 65-byte uncompressed keys)
|
|
29
|
+
* @returns Array of public keys with x and y coordinates
|
|
30
|
+
*/
|
|
31
|
+
export declare function deserializeGranteeList(data: Uint8Array): UncompressedPublicKey[];
|
|
32
|
+
/**
|
|
33
|
+
* Encrypt a serialized grantee list for storage
|
|
34
|
+
*
|
|
35
|
+
* @param granteeList - Serialized grantee list
|
|
36
|
+
* @param publisherPrivKey - Publisher's private key for key derivation
|
|
37
|
+
* @returns Encrypted grantee list
|
|
38
|
+
*/
|
|
39
|
+
export declare function encryptGranteeList(granteeList: Uint8Array, publisherPrivKey: Uint8Array): Uint8Array;
|
|
40
|
+
/**
|
|
41
|
+
* Decrypt an encrypted grantee list
|
|
42
|
+
*
|
|
43
|
+
* @param encryptedList - Encrypted grantee list
|
|
44
|
+
* @param publisherPrivKey - Publisher's private key for key derivation
|
|
45
|
+
* @returns Decrypted serialized grantee list
|
|
46
|
+
*/
|
|
47
|
+
export declare function decryptGranteeList(encryptedList: Uint8Array, publisherPrivKey: Uint8Array): Uint8Array;
|
|
48
|
+
/**
|
|
49
|
+
* Serialize and encrypt grantee list in one step
|
|
50
|
+
*
|
|
51
|
+
* @param grantees - Array of public keys
|
|
52
|
+
* @param publisherPrivKey - Publisher's private key
|
|
53
|
+
* @returns Encrypted serialized grantee list ready for upload
|
|
54
|
+
*/
|
|
55
|
+
export declare function serializeAndEncryptGranteeList(grantees: UncompressedPublicKey[], publisherPrivKey: Uint8Array): Uint8Array;
|
|
56
|
+
/**
|
|
57
|
+
* Decrypt and deserialize grantee list in one step
|
|
58
|
+
*
|
|
59
|
+
* @param encryptedList - Encrypted serialized grantee list
|
|
60
|
+
* @param publisherPrivKey - Publisher's private key
|
|
61
|
+
* @returns Array of public keys
|
|
62
|
+
*/
|
|
63
|
+
export declare function decryptAndDeserializeGranteeList(encryptedList: Uint8Array, publisherPrivKey: Uint8Array): UncompressedPublicKey[];
|
|
64
|
+
/**
|
|
65
|
+
* Add grantees to an existing encrypted grantee list
|
|
66
|
+
*
|
|
67
|
+
* @param encryptedList - Existing encrypted grantee list
|
|
68
|
+
* @param newGrantees - New grantees to add
|
|
69
|
+
* @param publisherPrivKey - Publisher's private key
|
|
70
|
+
* @returns New encrypted grantee list with added grantees
|
|
71
|
+
*/
|
|
72
|
+
export declare function addToGranteeList(encryptedList: Uint8Array, newGrantees: UncompressedPublicKey[], publisherPrivKey: Uint8Array): Uint8Array;
|
|
73
|
+
/**
|
|
74
|
+
* Remove grantees from an existing encrypted grantee list
|
|
75
|
+
*
|
|
76
|
+
* @param encryptedList - Existing encrypted grantee list
|
|
77
|
+
* @param revokeGrantees - Grantees to remove
|
|
78
|
+
* @param publisherPrivKey - Publisher's private key
|
|
79
|
+
* @returns New encrypted grantee list with removed grantees
|
|
80
|
+
*/
|
|
81
|
+
export declare function removeFromGranteeList(encryptedList: Uint8Array, revokeGrantees: UncompressedPublicKey[], publisherPrivKey: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ACT History Management
|
|
3
|
+
*
|
|
4
|
+
* This module provides timestamped versioning of ACT entries, matching Bee's
|
|
5
|
+
* approach to tracking ACT versions over time.
|
|
6
|
+
*
|
|
7
|
+
* Key concepts:
|
|
8
|
+
* - Each ACT update creates a new history entry
|
|
9
|
+
* - Entries are keyed by reversed timestamp (MaxInt64 - timestamp)
|
|
10
|
+
* - History enables looking up ACT state at any point in time
|
|
11
|
+
* - Encrypted grantee list reference is stored in metadata
|
|
12
|
+
*
|
|
13
|
+
* This implementation uses the MantarayNode class from bee-js to produce
|
|
14
|
+
* Bee-compatible binary manifests with the proper version hash header.
|
|
15
|
+
*
|
|
16
|
+
* IMPORTANT: Mantaray manifests are hierarchical - each child node must be
|
|
17
|
+
* uploaded separately to Swarm. The root node references children by their
|
|
18
|
+
* content addresses (selfAddress). To read entries, all child nodes must be
|
|
19
|
+
* loaded recursively.
|
|
20
|
+
*/
|
|
21
|
+
import { MantarayNode } from "@ethersphere/core-sdk";
|
|
22
|
+
/**
|
|
23
|
+
* Single history entry metadata
|
|
24
|
+
*/
|
|
25
|
+
export interface HistoryEntryMetadata {
|
|
26
|
+
actReference: string;
|
|
27
|
+
encryptedGranteeListRef?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* History entry with timestamp
|
|
31
|
+
*/
|
|
32
|
+
export interface HistoryEntry {
|
|
33
|
+
timestamp: number;
|
|
34
|
+
metadata: HistoryEntryMetadata;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Result of serializing a history tree
|
|
38
|
+
*/
|
|
39
|
+
export interface SerializedHistoryTree {
|
|
40
|
+
blobs: Map<string, Uint8Array>;
|
|
41
|
+
rootReference: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Result of saving a history tree
|
|
45
|
+
*/
|
|
46
|
+
export interface SaveHistoryTreeResult {
|
|
47
|
+
rootReference: string;
|
|
48
|
+
tagUid?: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Calculate reversed timestamp key for history lookup
|
|
52
|
+
*
|
|
53
|
+
* Bee uses reversed timestamps so that the latest entry sorts first.
|
|
54
|
+
* Key = MaxInt64 - timestamp
|
|
55
|
+
*
|
|
56
|
+
* @param timestamp - Unix timestamp in seconds
|
|
57
|
+
* @returns Reversed timestamp as string (for use as path)
|
|
58
|
+
*/
|
|
59
|
+
export declare function calculateReversedTimestamp(timestamp: number): string;
|
|
60
|
+
/**
|
|
61
|
+
* Calculate original timestamp from reversed key
|
|
62
|
+
*
|
|
63
|
+
* @param reversedKey - Reversed timestamp string
|
|
64
|
+
* @returns Original Unix timestamp in seconds
|
|
65
|
+
*/
|
|
66
|
+
export declare function calculateOriginalTimestamp(reversedKey: string): number;
|
|
67
|
+
/**
|
|
68
|
+
* Create a new empty history manifest using MantarayNode
|
|
69
|
+
*/
|
|
70
|
+
export declare function createHistoryManifest(): MantarayNode;
|
|
71
|
+
/**
|
|
72
|
+
* Add an entry to the history manifest
|
|
73
|
+
*
|
|
74
|
+
* This mutates the manifest in place by adding a fork.
|
|
75
|
+
*
|
|
76
|
+
* @param manifest - Existing history manifest (MantarayNode)
|
|
77
|
+
* @param timestamp - Unix timestamp for this entry
|
|
78
|
+
* @param actReference - Reference to the ACT manifest (hex string)
|
|
79
|
+
* @param encryptedGranteeListRef - Optional reference to encrypted grantee list (hex string)
|
|
80
|
+
*/
|
|
81
|
+
export declare function addHistoryEntry(manifest: MantarayNode, timestamp: number, actReference: string, encryptedGranteeListRef?: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* Get the latest history entry (most recent timestamp)
|
|
84
|
+
*
|
|
85
|
+
* Since keys are reversed timestamps, the smallest key is the latest entry.
|
|
86
|
+
* NOTE: This requires the manifest to have been loaded with loadRecursively()
|
|
87
|
+
* or to have been populated locally with addHistoryEntry().
|
|
88
|
+
*
|
|
89
|
+
* @param manifest - History manifest (MantarayNode)
|
|
90
|
+
* @returns Latest entry with its timestamp, or undefined if empty
|
|
91
|
+
*/
|
|
92
|
+
export declare function getLatestEntry(manifest: MantarayNode): HistoryEntry | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Get entry at or before a specific timestamp
|
|
95
|
+
*
|
|
96
|
+
* This finds the ACT state that was valid at the given timestamp.
|
|
97
|
+
* NOTE: This requires the manifest to have been loaded with loadRecursively().
|
|
98
|
+
*
|
|
99
|
+
* @param manifest - History manifest (MantarayNode)
|
|
100
|
+
* @param timestamp - Target timestamp
|
|
101
|
+
* @returns Entry at or before timestamp, or undefined if none exists
|
|
102
|
+
*/
|
|
103
|
+
export declare function getEntryAtTimestamp(manifest: MantarayNode, timestamp: number): HistoryEntry | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Get all history entries sorted by timestamp (newest first)
|
|
106
|
+
*
|
|
107
|
+
* @param manifest - History manifest (MantarayNode)
|
|
108
|
+
* @returns Array of entries sorted newest first
|
|
109
|
+
*/
|
|
110
|
+
export declare function getAllEntries(manifest: MantarayNode): HistoryEntry[];
|
|
111
|
+
/**
|
|
112
|
+
* Serialize the entire history manifest tree to individual blobs
|
|
113
|
+
*
|
|
114
|
+
* Mantaray manifests are hierarchical - each node is stored at its content
|
|
115
|
+
* address. This function returns all blobs that need to be uploaded, keyed
|
|
116
|
+
* by their content addresses.
|
|
117
|
+
*
|
|
118
|
+
* @deprecated Use saveHistoryTreeRecursively instead which uploads bottom-up
|
|
119
|
+
* and uses Bee's actual returned references to avoid address mismatches.
|
|
120
|
+
*
|
|
121
|
+
* @param manifest - History manifest (MantarayNode)
|
|
122
|
+
* @returns Map of content address -> serialized data, plus root reference
|
|
123
|
+
*/
|
|
124
|
+
export declare function serializeHistoryTree(manifest: MantarayNode): Promise<SerializedHistoryTree>;
|
|
125
|
+
/**
|
|
126
|
+
* Upload callback type for saveHistoryTreeRecursively
|
|
127
|
+
*/
|
|
128
|
+
export type UploadCallback = (data: Uint8Array, isRoot: boolean) => Promise<{
|
|
129
|
+
reference: string;
|
|
130
|
+
tagUid?: number;
|
|
131
|
+
}>;
|
|
132
|
+
/**
|
|
133
|
+
* Save the entire history manifest tree by uploading bottom-up
|
|
134
|
+
*
|
|
135
|
+
* This function uploads nodes in the correct order (children before parents)
|
|
136
|
+
* and uses Bee's actual returned references to update selfAddress before
|
|
137
|
+
* marshaling parents. This avoids address mismatches between local hash
|
|
138
|
+
* computation and Bee's storage.
|
|
139
|
+
*
|
|
140
|
+
* The flow mirrors MantarayNode.saveRecursively() from bee-js:
|
|
141
|
+
* 1. Recursively save all child forks first
|
|
142
|
+
* 2. Marshal this node (which uses children's updated selfAddress)
|
|
143
|
+
* 3. Upload and set selfAddress from Bee's response
|
|
144
|
+
*
|
|
145
|
+
* @param manifest - History manifest (MantarayNode)
|
|
146
|
+
* @param uploadFn - Callback to upload data, returns reference from Bee
|
|
147
|
+
* @returns Root reference from Bee and optional tag UID
|
|
148
|
+
*/
|
|
149
|
+
export declare function saveHistoryTreeRecursively(manifest: MantarayNode, uploadFn: UploadCallback): Promise<SaveHistoryTreeResult>;
|
|
150
|
+
/**
|
|
151
|
+
* Serialize history manifest root to Mantaray binary format
|
|
152
|
+
*
|
|
153
|
+
* @deprecated Use serializeHistoryTree for proper Mantaray serialization
|
|
154
|
+
* @param manifest - History manifest (MantarayNode)
|
|
155
|
+
* @returns Serialized root manifest as Uint8Array
|
|
156
|
+
*/
|
|
157
|
+
export declare function serializeHistory(manifest: MantarayNode): Promise<Uint8Array>;
|
|
158
|
+
/**
|
|
159
|
+
* Deserialize history manifest from Mantaray binary format
|
|
160
|
+
*
|
|
161
|
+
* NOTE: After deserialization, call loadRecursively() or manually load
|
|
162
|
+
* child nodes to populate targetAddress for entries.
|
|
163
|
+
*
|
|
164
|
+
* @param data - Serialized manifest
|
|
165
|
+
* @param selfAddress - The reference/address of the manifest (32 bytes as Uint8Array)
|
|
166
|
+
* @returns Parsed history manifest (MantarayNode)
|
|
167
|
+
*/
|
|
168
|
+
export declare function deserializeHistory(data: Uint8Array, selfAddress: Uint8Array): MantarayNode;
|
|
169
|
+
/**
|
|
170
|
+
* Load child node data into a deserialized manifest
|
|
171
|
+
*
|
|
172
|
+
* After deserializing the root node, this function loads all child node data
|
|
173
|
+
* so that targetAddress is available for each entry.
|
|
174
|
+
*
|
|
175
|
+
* @param manifest - Deserialized root manifest
|
|
176
|
+
* @param loadData - Callback to load data for a given reference
|
|
177
|
+
*/
|
|
178
|
+
export declare function loadHistoryEntries(manifest: MantarayNode, loadData: (reference: string) => Promise<Uint8Array>): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Get current Unix timestamp in seconds
|
|
181
|
+
*/
|
|
182
|
+
export declare function getCurrentTimestamp(): number;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ACT (Access Control Tries) - Bee-Compatible Implementation
|
|
3
|
+
*
|
|
4
|
+
* This module provides client-side ACT operations with Bee-compatible
|
|
5
|
+
* Simple Manifest (JSON) format:
|
|
6
|
+
* - ACT manifest (JSON with lookup key -> encrypted access key mappings)
|
|
7
|
+
* - Encrypted grantee list (stored separately)
|
|
8
|
+
* - History manifest (tracks ACT versions over time)
|
|
9
|
+
*/
|
|
10
|
+
import type { Bee, BeeRequestOptions, UploadOptions } from "@ethersphere/bee-js";
|
|
11
|
+
import type { UploadProgress } from "../types";
|
|
12
|
+
import { type UploadTarget } from "../upload";
|
|
13
|
+
type ActUploadOptions = UploadOptions & {
|
|
14
|
+
beeCompatible?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The private keys one session may read or publish with. A proxy holds two —
|
|
18
|
+
* the origin-bound app key and the account-wide sharing key (#519) — and does
|
|
19
|
+
* not know which one a share was made out to, so every reader/publisher entry
|
|
20
|
+
* point takes candidates and uses the one the ACT names.
|
|
21
|
+
*/
|
|
22
|
+
export type ActKeyCandidates = Uint8Array | Uint8Array[];
|
|
23
|
+
/**
|
|
24
|
+
* Result of ACT upload operation
|
|
25
|
+
*/
|
|
26
|
+
export interface ActUploadResult {
|
|
27
|
+
encryptedReference: string;
|
|
28
|
+
historyReference: string;
|
|
29
|
+
granteeListReference: string;
|
|
30
|
+
publisherPubKey: string;
|
|
31
|
+
actReference: string;
|
|
32
|
+
tagUid?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Result of ACT grantee modification
|
|
36
|
+
*/
|
|
37
|
+
export interface ActGranteeModifyResult {
|
|
38
|
+
historyReference: string;
|
|
39
|
+
granteeListReference: string;
|
|
40
|
+
actReference: string;
|
|
41
|
+
tagUid?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Result of ACT revocation. `encryptedReference` is returned unchanged (#496):
|
|
45
|
+
* revocation drops the revoked entries but must not re-encrypt the reference.
|
|
46
|
+
*/
|
|
47
|
+
export interface ActRevocationResult extends ActGranteeModifyResult {
|
|
48
|
+
encryptedReference: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create an ACT-protected upload
|
|
52
|
+
*
|
|
53
|
+
* This creates:
|
|
54
|
+
* 1. ACT manifest (JSON Simple Manifest with lookup key -> encrypted access key mappings)
|
|
55
|
+
* 2. Encrypted grantee list (for publisher management)
|
|
56
|
+
* 3. History manifest (tracks ACT versions over time)
|
|
57
|
+
*
|
|
58
|
+
* @param config - Upload configuration (stamper or subsidised gateway)
|
|
59
|
+
* @param contentReference - The reference to protect (32 or 64 bytes)
|
|
60
|
+
* @param publisherPrivateKey - Publisher's private key (32 bytes)
|
|
61
|
+
* @param granteePublicKeys - Array of grantee public keys
|
|
62
|
+
* @param options - Upload options
|
|
63
|
+
* @param requestOptions - Bee request options
|
|
64
|
+
* @param onProgress - Progress callback
|
|
65
|
+
* @returns Multiple references for ACT
|
|
66
|
+
*/
|
|
67
|
+
export declare function createActForContent(target: UploadTarget, contentReference: Uint8Array, publisherPrivateKey: Uint8Array, granteePublicKeys: Array<{
|
|
68
|
+
x: Uint8Array;
|
|
69
|
+
y: Uint8Array;
|
|
70
|
+
}>, options?: ActUploadOptions, requestOptions?: BeeRequestOptions, onProgress?: (progress: UploadProgress) => void): Promise<ActUploadResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Decrypt an ACT-protected reference
|
|
73
|
+
*
|
|
74
|
+
* @param bee - Bee instance
|
|
75
|
+
* @param encryptedReference - The encrypted reference (hex string)
|
|
76
|
+
* @param historyReference - History manifest reference
|
|
77
|
+
* @param publisherPubKeyHex - Publisher's compressed public key (hex)
|
|
78
|
+
* @param readerPrivateKeys - Reader's private key(s), 32 bytes each; the first
|
|
79
|
+
* one the ACT names (as a grantee, or as the publisher itself) decrypts
|
|
80
|
+
* @param timestamp - Optional timestamp to look up specific ACT version
|
|
81
|
+
* @param requestOptions - Bee request options
|
|
82
|
+
* @returns Decrypted content reference (hex string)
|
|
83
|
+
*/
|
|
84
|
+
export declare function decryptActReference(bee: Bee, encryptedReference: string, historyReference: string, publisherPubKeyHex: string, readerPrivateKeys: ActKeyCandidates, timestamp?: number, requestOptions?: BeeRequestOptions): Promise<string>;
|
|
85
|
+
/**
|
|
86
|
+
* Add grantees to an existing ACT
|
|
87
|
+
*/
|
|
88
|
+
export declare function addGranteesToAct(target: UploadTarget, bee: Bee, historyReference: string, publisherCandidates: ActKeyCandidates, newGranteePublicKeys: Array<{
|
|
89
|
+
x: Uint8Array;
|
|
90
|
+
y: Uint8Array;
|
|
91
|
+
}>, options?: ActUploadOptions, requestOptions?: BeeRequestOptions, onProgress?: (progress: UploadProgress) => void): Promise<ActGranteeModifyResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Revoke grantees from an ACT by dropping their entries. The content reference is
|
|
94
|
+
* returned unchanged — revocation must not re-encrypt it (#496).
|
|
95
|
+
*/
|
|
96
|
+
export declare function revokeGranteesFromAct(target: UploadTarget, bee: Bee, historyReference: string, encryptedReference: string, publisherCandidates: ActKeyCandidates, revokePublicKeys: Array<{
|
|
97
|
+
x: Uint8Array;
|
|
98
|
+
y: Uint8Array;
|
|
99
|
+
}>, options?: ActUploadOptions, requestOptions?: BeeRequestOptions, onProgress?: (progress: UploadProgress) => void): Promise<ActRevocationResult>;
|
|
100
|
+
/**
|
|
101
|
+
* Get grantees from an ACT
|
|
102
|
+
*/
|
|
103
|
+
export declare function getGranteesFromAct(bee: Bee, historyReference: string, publisherCandidates: ActKeyCandidates, requestOptions?: BeeRequestOptions): Promise<string[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Parse a compressed public key from hex string
|
|
106
|
+
*/
|
|
107
|
+
export declare function parseCompressedPublicKey(hex: string): {
|
|
108
|
+
x: Uint8Array;
|
|
109
|
+
y: Uint8Array;
|
|
110
|
+
};
|
|
111
|
+
export { type ActEntry } from "./act";
|
|
112
|
+
export { type UncompressedPublicKey } from "./grantee-list";
|
|
113
|
+
export { type HistoryEntry, type HistoryEntryMetadata } from "./history";
|
|
114
|
+
export { publicKeyFromPrivate, compressPublicKey, publicKeyFromCompressed, } from "./crypto";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one app may stamp with the account's stamp through `stampChunk`. A
|
|
3
|
+
* hacked or greedy app could otherwise fill the person's stamp, so each app
|
|
4
|
+
* origin gets a count per stamp, a rate, and a share of any one bucket. The
|
|
5
|
+
* frame keeps the usage per app origin and per stamp in its own storage, so a
|
|
6
|
+
* reload of the app does not reset it. A new stamp starts a new count.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { SwarmIdError } from "../errors";
|
|
10
|
+
/** Slots one app may spend from one of the account's stamps, ever. A stamp again at a slot already held spends none */
|
|
11
|
+
export declare const APP_STAMP_COUNT_LIMIT = 10000;
|
|
12
|
+
/** Stamps one app may take within one {@link APP_STAMP_RATE_WINDOW_MS} */
|
|
13
|
+
export declare const APP_STAMP_RATE_LIMIT = 60;
|
|
14
|
+
/** The rate limit's window. A window starts at the first stamp after the last one ended */
|
|
15
|
+
export declare const APP_STAMP_RATE_WINDOW_MS: number;
|
|
16
|
+
/**
|
|
17
|
+
* Share of a bucket's data lane one app may use. Rounded down, so at the
|
|
18
|
+
* smallest usable depth (lane of 7) an app gets 2 slots in any one bucket.
|
|
19
|
+
*/
|
|
20
|
+
export declare const APP_BUCKET_SHARE: number;
|
|
21
|
+
declare const AppStampUsageSchema: z.ZodObject<{
|
|
22
|
+
count: z.ZodNumber;
|
|
23
|
+
windowStart: z.ZodNumber;
|
|
24
|
+
windowCount: z.ZodNumber;
|
|
25
|
+
buckets: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
/** What one app has stamped with one of the account's stamps */
|
|
28
|
+
export type AppStampUsage = z.infer<typeof AppStampUsageSchema>;
|
|
29
|
+
export declare function emptyAppStampUsage(): AppStampUsage;
|
|
30
|
+
/**
|
|
31
|
+
* The stored usage, or an empty one when there is none. Only the frame writes
|
|
32
|
+
* the record, so a malformed one is a bug of ours and starts over rather than
|
|
33
|
+
* locking the app out for good.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseAppStampUsage(raw: string | null): AppStampUsage;
|
|
36
|
+
/** Slots one app may use in one bucket of a lane this size */
|
|
37
|
+
export declare function appBucketCap(laneCapacity: number): number;
|
|
38
|
+
/**
|
|
39
|
+
* Why stamping a single-owner chunk again at the slot it already holds is
|
|
40
|
+
* refused for this app, or undefined when it is allowed. No slot is spent, so
|
|
41
|
+
* only the count and the rate apply, not the bucket share.
|
|
42
|
+
*/
|
|
43
|
+
export declare function appRestampRefusal(usage: AppStampUsage, now: number): SwarmIdError | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Why the next stamp for this app is refused, or undefined when it is allowed.
|
|
46
|
+
*
|
|
47
|
+
* @param target.bucket - The bucket the chunk's address lands in
|
|
48
|
+
* @param target.laneCapacity - Data chunks the stamper's lane holds per bucket
|
|
49
|
+
*/
|
|
50
|
+
export declare function appStampRefusal(usage: AppStampUsage, target: {
|
|
51
|
+
bucket: number;
|
|
52
|
+
laneCapacity: number;
|
|
53
|
+
now: number;
|
|
54
|
+
}): SwarmIdError | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* The usage once one more stamp at a slot already held is counted. It spends
|
|
57
|
+
* no slot, and the count bounds slots spent, so only the rate counts it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function recordAppRestamp(usage: AppStampUsage, now: number): AppStampUsage;
|
|
60
|
+
/** The usage once one more stamp in `bucket` is counted */
|
|
61
|
+
export declare function recordAppStamp(usage: AppStampUsage, bucket: number, now: number): AppStampUsage;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface ChunkUploadStreamOptions {
|
|
2
|
+
tag?: number;
|
|
3
|
+
concurrency?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class ChunkUploadStream {
|
|
6
|
+
private beeUrl;
|
|
7
|
+
private options?;
|
|
8
|
+
private ws;
|
|
9
|
+
private pendingAcks;
|
|
10
|
+
private concurrency;
|
|
11
|
+
private closed;
|
|
12
|
+
private errorMessage;
|
|
13
|
+
constructor(beeUrl: string, options?: ChunkUploadStreamOptions | undefined);
|
|
14
|
+
getConcurrency(): number;
|
|
15
|
+
/**
|
|
16
|
+
* Open the WebSocket connection to Bee's chunk stream endpoint.
|
|
17
|
+
* Resolves when the connection is established.
|
|
18
|
+
*/
|
|
19
|
+
open(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Send a stamped chunk over the WebSocket.
|
|
22
|
+
* The data should already have the 113-byte stamp prepended.
|
|
23
|
+
*
|
|
24
|
+
* Respects concurrency limits — will wait if too many chunks are in-flight.
|
|
25
|
+
*/
|
|
26
|
+
uploadChunk(stampedData: Uint8Array): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Wait for all pending acks to resolve, then close the WebSocket.
|
|
29
|
+
*/
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
private buildWsUrl;
|
|
32
|
+
/**
|
|
33
|
+
* Wait for the next ack to arrive (used for concurrency back-pressure).
|
|
34
|
+
*/
|
|
35
|
+
private waitForAck;
|
|
36
|
+
private rejectAllPending;
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Reference } from "@ethersphere/bee-js";
|
|
2
|
+
import { type ContentAddressedChunk } from "../chunk";
|
|
3
|
+
import type { ChunkReference } from "./types";
|
|
4
|
+
export declare const CHUNK_SIZE = 4096;
|
|
5
|
+
export declare const PLAIN_REFS_PER_CHUNK = 128;
|
|
6
|
+
export declare const ENCRYPTED_REFS_PER_CHUNK = 64;
|
|
7
|
+
/**
|
|
8
|
+
* Split data into 4096-byte chunks
|
|
9
|
+
*/
|
|
10
|
+
export declare function splitDataIntoChunks(data: Uint8Array): Uint8Array[];
|
|
11
|
+
/**
|
|
12
|
+
* Build merkle tree from chunk references
|
|
13
|
+
* Returns root reference (32 bytes)
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildMerkleTree(chunkRefs: ChunkReference[], onIntermediateChunk: (chunk: ContentAddressedChunk) => Promise<void>): Promise<Reference>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Bee, BeeRequestOptions } from "@ethersphere/bee-js";
|
|
2
|
+
import { type UploadTarget } from "./upload";
|
|
3
|
+
import type { UploadProgress, CollectionFile, CollectionEntry } from "../types";
|
|
4
|
+
export interface UploadCollectionOptions {
|
|
5
|
+
/** Encrypt file content (default true). `false` also leaves the manifest plain */
|
|
6
|
+
encrypt?: boolean;
|
|
7
|
+
/** Encrypt the manifest too, so the root reference carries a key (default true) */
|
|
8
|
+
encryptManifest?: boolean;
|
|
9
|
+
pin?: boolean;
|
|
10
|
+
deferred?: boolean;
|
|
11
|
+
tag?: number;
|
|
12
|
+
/** Served for the bare `/bzz/<reference>/` (`website-index-document`) */
|
|
13
|
+
indexDocument?: string;
|
|
14
|
+
/** Served for a path that is not in the folder (`website-error-document`) */
|
|
15
|
+
errorDocument?: string;
|
|
16
|
+
/** Called once per file */
|
|
17
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
18
|
+
requestOptions?: BeeRequestOptions;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* What `uploadFile` and `uploadFiles` encrypt: everything by default, so the
|
|
22
|
+
* root reference carries a key. `encryptManifest: false` bares the manifest
|
|
23
|
+
* over encrypted content; `encrypt: false` bares everything — a plain manifest
|
|
24
|
+
* over plain content is the only shape a bare-manifest reader can use.
|
|
25
|
+
*/
|
|
26
|
+
export declare function manifestEncryption(options: {
|
|
27
|
+
encrypt?: boolean;
|
|
28
|
+
encryptManifest?: boolean;
|
|
29
|
+
} | undefined): {
|
|
30
|
+
content: boolean;
|
|
31
|
+
manifest: boolean;
|
|
32
|
+
};
|
|
33
|
+
export declare function uploadCollection(target: UploadTarget, files: CollectionFile[], options?: UploadCollectionOptions): Promise<{
|
|
34
|
+
reference: string;
|
|
35
|
+
tagUid?: number;
|
|
36
|
+
}>;
|
|
37
|
+
/** The files of a manifest: every node with content, the docs fork excluded. */
|
|
38
|
+
export declare function listCollection(bee: Bee, reference: string, requestOptions?: BeeRequestOptions): Promise<CollectionEntry[]>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EthAddress, Identifier } from "@ethersphere/bee-js";
|
|
2
|
+
import type { Bee, BeeRequestOptions, DownloadOptions } from "@ethersphere/bee-js";
|
|
3
|
+
import type { UploadProgress } from "./types";
|
|
4
|
+
import type { SingleOwnerChunk } from "../types";
|
|
5
|
+
/**
|
|
6
|
+
* The slice of a Bee client that reading chunks needs.
|
|
7
|
+
*
|
|
8
|
+
* Everything that only downloads — the feed finders and the chunk readers
|
|
9
|
+
* here — takes this rather than a whole `Bee`, so a test can hand in a
|
|
10
|
+
* store-backed mock without casting, and the signature says which of the
|
|
11
|
+
* client's surface the caller actually depends on. `url` is there for the
|
|
12
|
+
* log lines only.
|
|
13
|
+
*/
|
|
14
|
+
export type ChunkDownloader = Pick<Bee, "url"> & {
|
|
15
|
+
chunk: Pick<Bee["chunk"], "download">;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Download data using only the chunk API
|
|
19
|
+
* This ensures encrypted data remains encrypted during transmission and avoids metadata leakage
|
|
20
|
+
*
|
|
21
|
+
* Supports both:
|
|
22
|
+
* - Regular references (64 hex chars = 32 bytes)
|
|
23
|
+
* - Encrypted references (128 hex chars = 64 bytes: 32-byte address + 32-byte encryption key)
|
|
24
|
+
*/
|
|
25
|
+
export declare function downloadDataWithChunkAPI(bee: ChunkDownloader, reference: string, _options?: DownloadOptions, onProgress?: (progress: UploadProgress) => void, requestOptions?: BeeRequestOptions): Promise<Uint8Array>;
|
|
26
|
+
export declare function downloadSOC(bee: ChunkDownloader, owner: string | Uint8Array | EthAddress, identifier: string | Uint8Array | Identifier, requestOptions?: BeeRequestOptions): Promise<SingleOwnerChunk>;
|
|
27
|
+
export declare function downloadEncryptedSOC(bee: ChunkDownloader, owner: string | Uint8Array | EthAddress, identifier: string | Uint8Array | Identifier, encryptionKey: string | Uint8Array, requestOptions?: BeeRequestOptions): Promise<SingleOwnerChunk>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WireError } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* The endpoint that refused, without its host: bee-js joins the node's base
|
|
4
|
+
* URL in, and the user's node — a LAN address, an internal hostname — is
|
|
5
|
+
* theirs, not the dApp's to learn from an error.
|
|
6
|
+
*/
|
|
7
|
+
export declare function refusedPath(url: string): string | undefined;
|
|
8
|
+
export declare function toWireError(error: unknown, fallback: string): WireError;
|