cojson-core-wasm 0.20.12 → 0.20.15
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/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cojson-core-wasm",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.20.
|
|
4
|
+
"version": "0.20.15",
|
|
5
5
|
"files": [
|
|
6
6
|
"public/cojson_core_wasm.js",
|
|
7
7
|
"public/cojson_core_wasm.d.ts",
|
|
8
8
|
"public/cojson_core_wasm.wasm.js",
|
|
9
9
|
"public/cojson_core_wasm.wasm.d.ts",
|
|
10
10
|
"public/cojson_core_wasm.wasm",
|
|
11
|
+
"public/snippets",
|
|
11
12
|
"edge-lite.js",
|
|
12
13
|
"index.js",
|
|
13
14
|
"index.d.ts"
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function init(): void;
|
|
4
|
+
/**
|
|
5
|
+
* WASM-exposed function for unsealing a message using X25519 + XSalsa20-Poly1305.
|
|
6
|
+
* Provides authenticated decryption with perfect forward secrecy.
|
|
7
|
+
* - `sealed_message`: The sealed bytes to decrypt
|
|
8
|
+
* - `recipient_secret`: Base58-encoded recipient's private key with "sealerSecret_z" prefix
|
|
9
|
+
* - `sender_id`: Base58-encoded sender's public key with "sealer_z" prefix
|
|
10
|
+
* - `nonce_material`: Raw bytes used to generate the nonce (must match sealing)
|
|
11
|
+
* Returns unsealed bytes or throws JsError if unsealing fails.
|
|
12
|
+
*/
|
|
13
|
+
export function unseal(sealed_message: Uint8Array, recipient_secret: string, sender_id: string, nonce_material: Uint8Array): Uint8Array;
|
|
3
14
|
/**
|
|
4
15
|
* WASM-exposed function for sealing a message for a group (anonymous box pattern).
|
|
5
16
|
* Uses an ephemeral key pair, so no sender authentication is provided.
|
|
@@ -19,16 +30,6 @@ export function sealForGroup(message: Uint8Array, recipient_id: string, nonce_ma
|
|
|
19
30
|
* Returns sealed bytes or throws JsError if sealing fails.
|
|
20
31
|
*/
|
|
21
32
|
export function seal(message: Uint8Array, sender_secret: string, recipient_id: string, nonce_material: Uint8Array): Uint8Array;
|
|
22
|
-
/**
|
|
23
|
-
* WASM-exposed function for unsealing a message using X25519 + XSalsa20-Poly1305.
|
|
24
|
-
* Provides authenticated decryption with perfect forward secrecy.
|
|
25
|
-
* - `sealed_message`: The sealed bytes to decrypt
|
|
26
|
-
* - `recipient_secret`: Base58-encoded recipient's private key with "sealerSecret_z" prefix
|
|
27
|
-
* - `sender_id`: Base58-encoded sender's public key with "sealer_z" prefix
|
|
28
|
-
* - `nonce_material`: Raw bytes used to generate the nonce (must match sealing)
|
|
29
|
-
* Returns unsealed bytes or throws JsError if unsealing fails.
|
|
30
|
-
*/
|
|
31
|
-
export function unseal(sealed_message: Uint8Array, recipient_secret: string, sender_id: string, nonce_material: Uint8Array): Uint8Array;
|
|
32
33
|
/**
|
|
33
34
|
* WASM-exposed function for unsealing a message sealed for a group (anonymous box pattern).
|
|
34
35
|
* Extracts the ephemeral public key and decrypts the message.
|
|
@@ -38,50 +39,6 @@ export function unseal(sealed_message: Uint8Array, recipient_secret: string, sen
|
|
|
38
39
|
* Returns unsealed bytes or throws JsError if unsealing fails.
|
|
39
40
|
*/
|
|
40
41
|
export function unsealForGroup(sealed_message: Uint8Array, recipient_secret: string, nonce_material: Uint8Array): Uint8Array;
|
|
41
|
-
/**
|
|
42
|
-
* WASM-exposed function to encrypt bytes with a key secret and nonce material.
|
|
43
|
-
* - `value`: The raw bytes to encrypt
|
|
44
|
-
* - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
|
|
45
|
-
* - `nonce_material`: Raw bytes used to generate the nonce
|
|
46
|
-
* Returns the encrypted bytes or throws a JsError if encryption fails.
|
|
47
|
-
*/
|
|
48
|
-
export function encrypt(value: Uint8Array, key_secret: string, nonce_material: Uint8Array): Uint8Array;
|
|
49
|
-
/**
|
|
50
|
-
* WASM-exposed function to decrypt bytes with a key secret and nonce material.
|
|
51
|
-
* - `ciphertext`: The encrypted bytes to decrypt
|
|
52
|
-
* - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
|
|
53
|
-
* - `nonce_material`: Raw bytes used to generate the nonce (must match encryption)
|
|
54
|
-
* Returns the decrypted bytes or throws a JsError if decryption fails.
|
|
55
|
-
*/
|
|
56
|
-
export function decrypt(ciphertext: Uint8Array, key_secret: string, nonce_material: Uint8Array): Uint8Array;
|
|
57
|
-
/**
|
|
58
|
-
* Generate a 24-byte nonce from input material using BLAKE3.
|
|
59
|
-
* - `nonce_material`: Raw bytes to derive the nonce from
|
|
60
|
-
* Returns 24 bytes suitable for use as a nonce in cryptographic operations.
|
|
61
|
-
* This function is deterministic - the same input will produce the same nonce.
|
|
62
|
-
*/
|
|
63
|
-
export function generateNonce(nonce_material: Uint8Array): Uint8Array;
|
|
64
|
-
/**
|
|
65
|
-
* Compute a short hash of a stable-stringified JSON value.
|
|
66
|
-
* The input should already be serialized using stableStringify on the JS side.
|
|
67
|
-
* Returns a string prefixed with "shortHash_z" followed by base58-encoded hash.
|
|
68
|
-
*/
|
|
69
|
-
export function shortHash(value: string): string;
|
|
70
|
-
/**
|
|
71
|
-
* Hash data once using BLAKE3 with a context prefix.
|
|
72
|
-
* - `data`: Raw bytes to hash
|
|
73
|
-
* - `context`: Context bytes to prefix to the data
|
|
74
|
-
* Returns 32 bytes of hash output.
|
|
75
|
-
* This is useful for domain separation - the same data hashed with different contexts will produce different outputs.
|
|
76
|
-
*/
|
|
77
|
-
export function blake3HashOnceWithContext(data: Uint8Array, context: Uint8Array): Uint8Array;
|
|
78
|
-
/**
|
|
79
|
-
* Hash data once using BLAKE3.
|
|
80
|
-
* - `data`: Raw bytes to hash
|
|
81
|
-
* Returns 32 bytes of hash output.
|
|
82
|
-
* This is the simplest way to compute a BLAKE3 hash of a single piece of data.
|
|
83
|
-
*/
|
|
84
|
-
export function blake3HashOnce(data: Uint8Array): Uint8Array;
|
|
85
42
|
/**
|
|
86
43
|
* WASM-exposed function to derive a sealer ID from a sealer secret.
|
|
87
44
|
* - `secret`: Raw bytes of the sealer secret
|
|
@@ -107,6 +64,22 @@ export function x25519PublicKey(private_key: Uint8Array): Uint8Array;
|
|
|
107
64
|
* Returns 32 bytes of shared secret material or throws JsError if key exchange fails.
|
|
108
65
|
*/
|
|
109
66
|
export function x25519DiffieHellman(private_key: Uint8Array, public_key: Uint8Array): Uint8Array;
|
|
67
|
+
/**
|
|
68
|
+
* WASM-exposed function to encrypt bytes with a key secret and nonce material.
|
|
69
|
+
* - `value`: The raw bytes to encrypt
|
|
70
|
+
* - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
|
|
71
|
+
* - `nonce_material`: Raw bytes used to generate the nonce
|
|
72
|
+
* Returns the encrypted bytes or throws a JsError if encryption fails.
|
|
73
|
+
*/
|
|
74
|
+
export function encrypt(value: Uint8Array, key_secret: string, nonce_material: Uint8Array): Uint8Array;
|
|
75
|
+
/**
|
|
76
|
+
* WASM-exposed function to decrypt bytes with a key secret and nonce material.
|
|
77
|
+
* - `ciphertext`: The encrypted bytes to decrypt
|
|
78
|
+
* - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
|
|
79
|
+
* - `nonce_material`: Raw bytes used to generate the nonce (must match encryption)
|
|
80
|
+
* Returns the decrypted bytes or throws a JsError if decryption fails.
|
|
81
|
+
*/
|
|
82
|
+
export function decrypt(ciphertext: Uint8Array, key_secret: string, nonce_material: Uint8Array): Uint8Array;
|
|
110
83
|
/**
|
|
111
84
|
* WASM-exposed function for XSalsa20 decryption without authentication.
|
|
112
85
|
* - `key`: 32-byte key for decryption (must match encryption key)
|
|
@@ -132,6 +105,12 @@ export function encryptXsalsa20(key: Uint8Array, nonce_material: Uint8Array, pla
|
|
|
132
105
|
* Returns base58-encoded signature with "signature_z" prefix or throws JsError if signing fails.
|
|
133
106
|
*/
|
|
134
107
|
export function sign(message: Uint8Array, secret: Uint8Array): string;
|
|
108
|
+
/**
|
|
109
|
+
* WASM-exposed function to derive a signer ID from a signing key.
|
|
110
|
+
* - `secret`: Raw Ed25519 signing key bytes
|
|
111
|
+
* Returns base58-encoded verifying key with "signer_z" prefix or throws JsError if derivation fails.
|
|
112
|
+
*/
|
|
113
|
+
export function getSignerId(secret: Uint8Array): string;
|
|
135
114
|
/**
|
|
136
115
|
* WASM-exposed function to verify an Ed25519 signature.
|
|
137
116
|
* - `signature`: Raw signature bytes
|
|
@@ -141,40 +120,54 @@ export function sign(message: Uint8Array, secret: Uint8Array): string;
|
|
|
141
120
|
*/
|
|
142
121
|
export function verify(signature: Uint8Array, message: Uint8Array, id: Uint8Array): boolean;
|
|
143
122
|
/**
|
|
144
|
-
*
|
|
145
|
-
* - `
|
|
146
|
-
* Returns
|
|
123
|
+
* Hash data once using BLAKE3.
|
|
124
|
+
* - `data`: Raw bytes to hash
|
|
125
|
+
* Returns 32 bytes of hash output.
|
|
126
|
+
* This is the simplest way to compute a BLAKE3 hash of a single piece of data.
|
|
147
127
|
*/
|
|
148
|
-
export function
|
|
128
|
+
export function blake3HashOnce(data: Uint8Array): Uint8Array;
|
|
149
129
|
/**
|
|
150
|
-
*
|
|
151
|
-
* - `
|
|
152
|
-
* Returns
|
|
130
|
+
* Generate a 24-byte nonce from input material using BLAKE3.
|
|
131
|
+
* - `nonce_material`: Raw bytes to derive the nonce from
|
|
132
|
+
* Returns 24 bytes suitable for use as a nonce in cryptographic operations.
|
|
133
|
+
* This function is deterministic - the same input will produce the same nonce.
|
|
153
134
|
*/
|
|
154
|
-
export function
|
|
135
|
+
export function generateNonce(nonce_material: Uint8Array): Uint8Array;
|
|
155
136
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* Returns
|
|
137
|
+
* Compute a short hash of a stable-stringified JSON value.
|
|
138
|
+
* The input should already be serialized using stableStringify on the JS side.
|
|
139
|
+
* Returns a string prefixed with "shortHash_z" followed by base58-encoded hash.
|
|
159
140
|
*/
|
|
160
|
-
export function
|
|
141
|
+
export function shortHash(value: string): string;
|
|
161
142
|
/**
|
|
162
|
-
*
|
|
163
|
-
* - `
|
|
164
|
-
*
|
|
143
|
+
* Hash data once using BLAKE3 with a context prefix.
|
|
144
|
+
* - `data`: Raw bytes to hash
|
|
145
|
+
* - `context`: Context bytes to prefix to the data
|
|
146
|
+
* Returns 32 bytes of hash output.
|
|
147
|
+
* This is useful for domain separation - the same data hashed with different contexts will produce different outputs.
|
|
165
148
|
*/
|
|
166
|
-
export function
|
|
149
|
+
export function blake3HashOnceWithContext(data: Uint8Array, context: Uint8Array): Uint8Array;
|
|
167
150
|
/**
|
|
168
|
-
* WASM-exposed function to
|
|
151
|
+
* WASM-exposed function to verify an Ed25519 signature.
|
|
152
|
+
* - `verifying_key`: 32 bytes of verifying key material
|
|
153
|
+
* - `message`: Raw bytes that were signed
|
|
154
|
+
* - `signature`: 64 bytes of signature material
|
|
155
|
+
* Returns true if signature is valid, false otherwise, or throws JsError if verification fails.
|
|
156
|
+
*/
|
|
157
|
+
export function ed25519Verify(verifying_key: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* WASM-exposed function to sign a message with an Ed25519 signing key.
|
|
169
160
|
* - `signing_key`: 32 bytes of signing key material
|
|
170
|
-
*
|
|
161
|
+
* - `message`: Raw bytes to sign
|
|
162
|
+
* Returns 64 bytes of signature material or throws JsError if signing fails.
|
|
171
163
|
*/
|
|
172
|
-
export function
|
|
164
|
+
export function ed25519SigningKeySign(signing_key: Uint8Array, message: Uint8Array): Uint8Array;
|
|
173
165
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
166
|
+
* WASM-exposed function to validate and copy Ed25519 signing key bytes.
|
|
167
|
+
* - `bytes`: 32 bytes of signing key material to validate
|
|
168
|
+
* Returns the same 32 bytes if valid or throws JsError if invalid.
|
|
176
169
|
*/
|
|
177
|
-
export function
|
|
170
|
+
export function ed25519SigningKeyFromBytes(bytes: Uint8Array): Uint8Array;
|
|
178
171
|
/**
|
|
179
172
|
* WASM-exposed function to sign a message using Ed25519.
|
|
180
173
|
* - `signing_key`: 32 bytes of signing key material
|
|
@@ -183,26 +176,34 @@ export function newEd25519SigningKey(): Uint8Array;
|
|
|
183
176
|
*/
|
|
184
177
|
export function ed25519Sign(signing_key: Uint8Array, message: Uint8Array): Uint8Array;
|
|
185
178
|
/**
|
|
186
|
-
* WASM-exposed function to validate and copy Ed25519
|
|
187
|
-
* - `bytes`:
|
|
179
|
+
* WASM-exposed function to validate and copy Ed25519 signature bytes.
|
|
180
|
+
* - `bytes`: 64 bytes of signature material to validate
|
|
181
|
+
* Returns the same 64 bytes if valid or throws JsError if invalid.
|
|
182
|
+
*/
|
|
183
|
+
export function ed25519SignatureFromBytes(bytes: Uint8Array): Uint8Array;
|
|
184
|
+
/**
|
|
185
|
+
* WASM-exposed function to validate and copy Ed25519 verifying key bytes.
|
|
186
|
+
* - `bytes`: 32 bytes of verifying key material to validate
|
|
188
187
|
* Returns the same 32 bytes if valid or throws JsError if invalid.
|
|
189
188
|
*/
|
|
190
|
-
export function
|
|
189
|
+
export function ed25519VerifyingKeyFromBytes(bytes: Uint8Array): Uint8Array;
|
|
191
190
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* - `message`: Raw bytes that were signed
|
|
195
|
-
* - `signature`: 64 bytes of signature material
|
|
196
|
-
* Returns true if signature is valid, false otherwise, or throws JsError if verification fails.
|
|
191
|
+
* Generate a new Ed25519 signing key using secure random number generation.
|
|
192
|
+
* Returns 32 bytes of raw key material suitable for use with other Ed25519 functions.
|
|
197
193
|
*/
|
|
198
|
-
export function
|
|
194
|
+
export function newEd25519SigningKey(): Uint8Array;
|
|
199
195
|
/**
|
|
200
|
-
* WASM-exposed function to
|
|
196
|
+
* WASM-exposed function to derive the public key from an Ed25519 signing key.
|
|
201
197
|
* - `signing_key`: 32 bytes of signing key material
|
|
202
|
-
*
|
|
203
|
-
* Returns 64 bytes of signature material or throws JsError if signing fails.
|
|
198
|
+
* Returns 32 bytes of public key material or throws JsError if key is invalid.
|
|
204
199
|
*/
|
|
205
|
-
export function
|
|
200
|
+
export function ed25519SigningKeyToPublic(signing_key: Uint8Array): Uint8Array;
|
|
201
|
+
/**
|
|
202
|
+
* WASM-exposed function to derive an Ed25519 verifying key from a signing key.
|
|
203
|
+
* - `signing_key`: 32 bytes of signing key material
|
|
204
|
+
* Returns 32 bytes of verifying key material or throws JsError if key is invalid.
|
|
205
|
+
*/
|
|
206
|
+
export function ed25519VerifyingKey(signing_key: Uint8Array): Uint8Array;
|
|
206
207
|
export class Blake3Hasher {
|
|
207
208
|
free(): void;
|
|
208
209
|
constructor();
|
|
@@ -220,6 +221,10 @@ export class SessionMap {
|
|
|
220
221
|
* Check if this CoValue is deleted
|
|
221
222
|
*/
|
|
222
223
|
isDeleted(): boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Check whether the CoValue still has pending streaming content.
|
|
226
|
+
*/
|
|
227
|
+
isStreaming(): boolean;
|
|
223
228
|
/**
|
|
224
229
|
* Get the known state as a native JavaScript object
|
|
225
230
|
*/
|
|
@@ -316,17 +321,28 @@ export interface InitOutput {
|
|
|
316
321
|
readonly sessionmap_getTransaction: (a: number, b: number, c: number, d: number) => [number, number];
|
|
317
322
|
readonly sessionmap_getTransactionCount: (a: number, b: number, c: number) => number;
|
|
318
323
|
readonly sessionmap_isDeleted: (a: number) => number;
|
|
324
|
+
readonly sessionmap_isStreaming: (a: number) => number;
|
|
319
325
|
readonly sessionmap_makeNewPrivateTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => [number, number, number, number];
|
|
320
326
|
readonly sessionmap_makeNewTrustingTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
|
|
321
327
|
readonly sessionmap_markAsDeleted: (a: number) => void;
|
|
322
328
|
readonly sessionmap_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
323
329
|
readonly sessionmap_setStreamingKnownState: (a: number, b: number, c: number) => [number, number];
|
|
330
|
+
readonly init: () => void;
|
|
324
331
|
readonly decrypt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
332
|
+
readonly decryptXsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
325
333
|
readonly encrypt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
334
|
+
readonly encryptXsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
335
|
+
readonly getSealerId: (a: number, b: number) => [number, number, number, number];
|
|
336
|
+
readonly newX25519PrivateKey: () => [number, number];
|
|
326
337
|
readonly seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
327
338
|
readonly sealForGroup: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
328
339
|
readonly unseal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
329
340
|
readonly unsealForGroup: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
341
|
+
readonly x25519DiffieHellman: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
342
|
+
readonly x25519PublicKey: (a: number, b: number) => [number, number, number, number];
|
|
343
|
+
readonly getSignerId: (a: number, b: number) => [number, number, number, number];
|
|
344
|
+
readonly sign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
345
|
+
readonly verify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
330
346
|
readonly __wbg_blake3hasher_free: (a: number, b: number) => void;
|
|
331
347
|
readonly blake3HashOnce: (a: number, b: number) => [number, number];
|
|
332
348
|
readonly blake3HashOnceWithContext: (a: number, b: number, c: number, d: number) => [number, number];
|
|
@@ -336,15 +352,6 @@ export interface InitOutput {
|
|
|
336
352
|
readonly blake3hasher_update: (a: number, b: number, c: number) => void;
|
|
337
353
|
readonly generateNonce: (a: number, b: number) => [number, number];
|
|
338
354
|
readonly shortHash: (a: number, b: number) => [number, number];
|
|
339
|
-
readonly decryptXsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
340
|
-
readonly encryptXsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
341
|
-
readonly getSealerId: (a: number, b: number) => [number, number, number, number];
|
|
342
|
-
readonly getSignerId: (a: number, b: number) => [number, number, number, number];
|
|
343
|
-
readonly newX25519PrivateKey: () => [number, number];
|
|
344
|
-
readonly sign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
345
|
-
readonly verify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
346
|
-
readonly x25519DiffieHellman: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
347
|
-
readonly x25519PublicKey: (a: number, b: number) => [number, number, number, number];
|
|
348
355
|
readonly ed25519Sign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
349
356
|
readonly ed25519SignatureFromBytes: (a: number, b: number) => [number, number, number, number];
|
|
350
357
|
readonly ed25519SigningKeyFromBytes: (a: number, b: number) => [number, number, number, number];
|