cojson-core-wasm 0.20.7 → 0.20.8

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,7 +1,7 @@
1
1
  {
2
2
  "name": "cojson-core-wasm",
3
3
  "type": "module",
4
- "version": "0.20.7",
4
+ "version": "0.20.8",
5
5
  "files": [
6
6
  "public/cojson_core_wasm.js",
7
7
  "public/cojson_core_wasm.d.ts",
@@ -1,68 +1,92 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * WASM-exposed function to derive the public key from an Ed25519 signing key.
5
- * - `signing_key`: 32 bytes of signing key material
6
- * Returns 32 bytes of public key material or throws JsError if key is invalid.
4
+ * Compute a short hash of a stable-stringified JSON value.
5
+ * The input should already be serialized using stableStringify on the JS side.
6
+ * Returns a string prefixed with "shortHash_z" followed by base58-encoded hash.
7
7
  */
8
- export function ed25519SigningKeyToPublic(signing_key: Uint8Array): Uint8Array;
8
+ export function shortHash(value: string): string;
9
9
  /**
10
- * WASM-exposed function to validate and copy Ed25519 signing key bytes.
11
- * - `bytes`: 32 bytes of signing key material to validate
12
- * Returns the same 32 bytes if valid or throws JsError if invalid.
10
+ * Generate a 24-byte nonce from input material using BLAKE3.
11
+ * - `nonce_material`: Raw bytes to derive the nonce from
12
+ * Returns 24 bytes suitable for use as a nonce in cryptographic operations.
13
+ * This function is deterministic - the same input will produce the same nonce.
13
14
  */
14
- export function ed25519SigningKeyFromBytes(bytes: Uint8Array): Uint8Array;
15
+ export function generateNonce(nonce_material: Uint8Array): Uint8Array;
15
16
  /**
16
- * WASM-exposed function to sign a message using Ed25519.
17
- * - `signing_key`: 32 bytes of signing key material
18
- * - `message`: Raw bytes to sign
19
- * Returns 64 bytes of signature material or throws JsError if signing fails.
17
+ * Hash data once using BLAKE3.
18
+ * - `data`: Raw bytes to hash
19
+ * Returns 32 bytes of hash output.
20
+ * This is the simplest way to compute a BLAKE3 hash of a single piece of data.
20
21
  */
21
- export function ed25519Sign(signing_key: Uint8Array, message: Uint8Array): Uint8Array;
22
+ export function blake3HashOnce(data: Uint8Array): Uint8Array;
22
23
  /**
23
- * Generate a new Ed25519 signing key using secure random number generation.
24
- * Returns 32 bytes of raw key material suitable for use with other Ed25519 functions.
24
+ * Hash data once using BLAKE3 with a context prefix.
25
+ * - `data`: Raw bytes to hash
26
+ * - `context`: Context bytes to prefix to the data
27
+ * Returns 32 bytes of hash output.
28
+ * This is useful for domain separation - the same data hashed with different contexts will produce different outputs.
25
29
  */
26
- export function newEd25519SigningKey(): Uint8Array;
30
+ export function blake3HashOnceWithContext(data: Uint8Array, context: Uint8Array): Uint8Array;
27
31
  /**
28
- * WASM-exposed function to validate and copy Ed25519 signature bytes.
29
- * - `bytes`: 64 bytes of signature material to validate
30
- * Returns the same 64 bytes if valid or throws JsError if invalid.
32
+ * WASM-exposed function to encrypt bytes with a key secret and nonce material.
33
+ * - `value`: The raw bytes to encrypt
34
+ * - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
35
+ * - `nonce_material`: Raw bytes used to generate the nonce
36
+ * Returns the encrypted bytes or throws a JsError if encryption fails.
31
37
  */
32
- export function ed25519SignatureFromBytes(bytes: Uint8Array): Uint8Array;
38
+ export function encrypt(value: Uint8Array, key_secret: string, nonce_material: Uint8Array): Uint8Array;
33
39
  /**
34
- * WASM-exposed function to derive an Ed25519 verifying key from a signing key.
35
- * - `signing_key`: 32 bytes of signing key material
36
- * Returns 32 bytes of verifying key material or throws JsError if key is invalid.
40
+ * WASM-exposed function to decrypt bytes with a key secret and nonce material.
41
+ * - `ciphertext`: The encrypted bytes to decrypt
42
+ * - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
43
+ * - `nonce_material`: Raw bytes used to generate the nonce (must match encryption)
44
+ * Returns the decrypted bytes or throws a JsError if decryption fails.
37
45
  */
38
- export function ed25519VerifyingKey(signing_key: Uint8Array): Uint8Array;
46
+ export function decrypt(ciphertext: Uint8Array, key_secret: string, nonce_material: Uint8Array): Uint8Array;
39
47
  /**
40
- * WASM-exposed function to sign a message with an Ed25519 signing key.
41
- * - `signing_key`: 32 bytes of signing key material
42
- * - `message`: Raw bytes to sign
43
- * Returns 64 bytes of signature material or throws JsError if signing fails.
48
+ * Generate a new X25519 private key using secure random number generation.
49
+ * Returns 32 bytes of raw key material suitable for use with other X25519 functions.
50
+ * This key can be reused for multiple Diffie-Hellman exchanges.
44
51
  */
45
- export function ed25519SigningKeySign(signing_key: Uint8Array, message: Uint8Array): Uint8Array;
52
+ export function newX25519PrivateKey(): Uint8Array;
46
53
  /**
47
- * WASM-exposed function to validate and copy Ed25519 verifying key bytes.
48
- * - `bytes`: 32 bytes of verifying key material to validate
49
- * Returns the same 32 bytes if valid or throws JsError if invalid.
54
+ * WASM-exposed function to derive an X25519 public key from a private key.
55
+ * - `private_key`: 32 bytes of private key material
56
+ * Returns 32 bytes of public key material or throws JsError if key is invalid.
50
57
  */
51
- export function ed25519VerifyingKeyFromBytes(bytes: Uint8Array): Uint8Array;
58
+ export function x25519PublicKey(private_key: Uint8Array): Uint8Array;
52
59
  /**
53
- * WASM-exposed function to verify an Ed25519 signature.
54
- * - `verifying_key`: 32 bytes of verifying key material
55
- * - `message`: Raw bytes that were signed
56
- * - `signature`: 64 bytes of signature material
57
- * Returns true if signature is valid, false otherwise, or throws JsError if verification fails.
60
+ * WASM-exposed function to perform X25519 Diffie-Hellman key exchange.
61
+ * - `private_key`: 32 bytes of private key material
62
+ * - `public_key`: 32 bytes of public key material
63
+ * Returns 32 bytes of shared secret material or throws JsError if key exchange fails.
58
64
  */
59
- export function ed25519Verify(verifying_key: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
65
+ export function x25519DiffieHellman(private_key: Uint8Array, public_key: Uint8Array): Uint8Array;
60
66
  /**
61
- * WASM-exposed function to derive a signer ID from a signing key.
62
- * - `secret`: Raw Ed25519 signing key bytes
63
- * Returns base58-encoded verifying key with "signer_z" prefix or throws JsError if derivation fails.
67
+ * WASM-exposed function to derive a sealer ID from a sealer secret.
68
+ * - `secret`: Raw bytes of the sealer secret
69
+ * Returns a base58-encoded sealer ID with "sealer_z" prefix or throws JsError if derivation fails.
64
70
  */
65
- export function getSignerId(secret: Uint8Array): string;
71
+ export function getSealerId(secret: Uint8Array): string;
72
+ /**
73
+ * WASM-exposed function for XSalsa20 encryption without authentication.
74
+ * - `key`: 32-byte key for encryption
75
+ * - `nonce_material`: Raw bytes used to generate a 24-byte nonce via BLAKE3
76
+ * - `plaintext`: Raw bytes to encrypt
77
+ * Returns the encrypted bytes or throws a JsError if encryption fails.
78
+ * Note: This function does not provide authentication. Use encrypt_xsalsa20_poly1305 for authenticated encryption.
79
+ */
80
+ export function encryptXsalsa20(key: Uint8Array, nonce_material: Uint8Array, plaintext: Uint8Array): Uint8Array;
81
+ /**
82
+ * WASM-exposed function for XSalsa20 decryption without authentication.
83
+ * - `key`: 32-byte key for decryption (must match encryption key)
84
+ * - `nonce_material`: Raw bytes used to generate a 24-byte nonce (must match encryption)
85
+ * - `ciphertext`: Encrypted bytes to decrypt
86
+ * Returns the decrypted bytes or throws a JsError if decryption fails.
87
+ * Note: This function does not provide authentication. Use decrypt_xsalsa20_poly1305 for authenticated decryption.
88
+ */
89
+ export function decryptXsalsa20(key: Uint8Array, nonce_material: Uint8Array, ciphertext: Uint8Array): Uint8Array;
66
90
  /**
67
91
  * WASM-exposed function to sign a message using Ed25519.
68
92
  * - `message`: Raw bytes to sign
@@ -79,45 +103,21 @@ export function sign(message: Uint8Array, secret: Uint8Array): string;
79
103
  */
80
104
  export function verify(signature: Uint8Array, message: Uint8Array, id: Uint8Array): boolean;
81
105
  /**
82
- * Generate a 24-byte nonce from input material using BLAKE3.
83
- * - `nonce_material`: Raw bytes to derive the nonce from
84
- * Returns 24 bytes suitable for use as a nonce in cryptographic operations.
85
- * This function is deterministic - the same input will produce the same nonce.
86
- */
87
- export function generateNonce(nonce_material: Uint8Array): Uint8Array;
88
- /**
89
- * Hash data once using BLAKE3.
90
- * - `data`: Raw bytes to hash
91
- * Returns 32 bytes of hash output.
92
- * This is the simplest way to compute a BLAKE3 hash of a single piece of data.
93
- */
94
- export function blake3HashOnce(data: Uint8Array): Uint8Array;
95
- /**
96
- * Hash data once using BLAKE3 with a context prefix.
97
- * - `data`: Raw bytes to hash
98
- * - `context`: Context bytes to prefix to the data
99
- * Returns 32 bytes of hash output.
100
- * This is useful for domain separation - the same data hashed with different contexts will produce different outputs.
101
- */
102
- export function blake3HashOnceWithContext(data: Uint8Array, context: Uint8Array): Uint8Array;
103
- /**
104
- * WASM-exposed function for XSalsa20 decryption without authentication.
105
- * - `key`: 32-byte key for decryption (must match encryption key)
106
- * - `nonce_material`: Raw bytes used to generate a 24-byte nonce (must match encryption)
107
- * - `ciphertext`: Encrypted bytes to decrypt
108
- * Returns the decrypted bytes or throws a JsError if decryption fails.
109
- * Note: This function does not provide authentication. Use decrypt_xsalsa20_poly1305 for authenticated decryption.
106
+ * WASM-exposed function to derive a signer ID from a signing key.
107
+ * - `secret`: Raw Ed25519 signing key bytes
108
+ * Returns base58-encoded verifying key with "signer_z" prefix or throws JsError if derivation fails.
110
109
  */
111
- export function decryptXsalsa20(key: Uint8Array, nonce_material: Uint8Array, ciphertext: Uint8Array): Uint8Array;
110
+ export function getSignerId(secret: Uint8Array): string;
112
111
  /**
113
- * WASM-exposed function for XSalsa20 encryption without authentication.
114
- * - `key`: 32-byte key for encryption
115
- * - `nonce_material`: Raw bytes used to generate a 24-byte nonce via BLAKE3
116
- * - `plaintext`: Raw bytes to encrypt
117
- * Returns the encrypted bytes or throws a JsError if encryption fails.
118
- * Note: This function does not provide authentication. Use encrypt_xsalsa20_poly1305 for authenticated encryption.
112
+ * WASM-exposed function for sealing a message using X25519 + XSalsa20-Poly1305.
113
+ * Provides authenticated encryption with perfect forward secrecy.
114
+ * - `message`: Raw bytes to seal
115
+ * - `sender_secret`: Base58-encoded sender's private key with "sealerSecret_z" prefix
116
+ * - `recipient_id`: Base58-encoded recipient's public key with "sealer_z" prefix
117
+ * - `nonce_material`: Raw bytes used to generate the nonce
118
+ * Returns sealed bytes or throws JsError if sealing fails.
119
119
  */
120
- export function encryptXsalsa20(key: Uint8Array, nonce_material: Uint8Array, plaintext: Uint8Array): Uint8Array;
120
+ export function seal(message: Uint8Array, sender_secret: string, recipient_id: string, nonce_material: Uint8Array): Uint8Array;
121
121
  /**
122
122
  * WASM-exposed function for unsealing a message using X25519 + XSalsa20-Poly1305.
123
123
  * Provides authenticated decryption with perfect forward secrecy.
@@ -129,135 +129,231 @@ export function encryptXsalsa20(key: Uint8Array, nonce_material: Uint8Array, pla
129
129
  */
130
130
  export function unseal(sealed_message: Uint8Array, recipient_secret: string, sender_id: string, nonce_material: Uint8Array): Uint8Array;
131
131
  /**
132
- * WASM-exposed function for sealing a message using X25519 + XSalsa20-Poly1305.
133
- * Provides authenticated encryption with perfect forward secrecy.
132
+ * WASM-exposed function for sealing a message for a group (anonymous box pattern).
133
+ * Uses an ephemeral key pair, so no sender authentication is provided.
134
134
  * - `message`: Raw bytes to seal
135
- * - `sender_secret`: Base58-encoded sender's private key with "sealerSecret_z" prefix
136
- * - `recipient_id`: Base58-encoded recipient's public key with "sealer_z" prefix
135
+ * - `recipient_id`: Base58-encoded recipient's public key with "sealer_z" prefix (the group's sealer)
137
136
  * - `nonce_material`: Raw bytes used to generate the nonce
138
- * Returns sealed bytes or throws JsError if sealing fails.
137
+ * Returns ephemeral_public_key (32 bytes) || ciphertext, or throws JsError if sealing fails.
139
138
  */
140
- export function seal(message: Uint8Array, sender_secret: string, recipient_id: string, nonce_material: Uint8Array): Uint8Array;
139
+ export function sealForGroup(message: Uint8Array, recipient_id: string, nonce_material: Uint8Array): Uint8Array;
141
140
  /**
142
- * WASM-exposed function to encrypt bytes with a key secret and nonce material.
143
- * - `value`: The raw bytes to encrypt
144
- * - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
145
- * - `nonce_material`: Raw bytes used to generate the nonce
146
- * Returns the encrypted bytes or throws a JsError if encryption fails.
141
+ * WASM-exposed function for unsealing a message sealed for a group (anonymous box pattern).
142
+ * Extracts the ephemeral public key and decrypts the message.
143
+ * - `sealed_message`: ephemeral_public_key (32 bytes) || ciphertext
144
+ * - `recipient_secret`: Base58-encoded recipient's private key with "sealerSecret_z" prefix
145
+ * - `nonce_material`: Raw bytes used to generate the nonce (must match sealing)
146
+ * Returns unsealed bytes or throws JsError if unsealing fails.
147
147
  */
148
- export function encrypt(value: Uint8Array, key_secret: string, nonce_material: Uint8Array): Uint8Array;
148
+ export function unsealForGroup(sealed_message: Uint8Array, recipient_secret: string, nonce_material: Uint8Array): Uint8Array;
149
149
  /**
150
- * WASM-exposed function to decrypt bytes with a key secret and nonce material.
151
- * - `ciphertext`: The encrypted bytes to decrypt
152
- * - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
153
- * - `nonce_material`: Raw bytes used to generate the nonce (must match encryption)
154
- * Returns the decrypted bytes or throws a JsError if decryption fails.
150
+ * Generate a new Ed25519 signing key using secure random number generation.
151
+ * Returns 32 bytes of raw key material suitable for use with other Ed25519 functions.
155
152
  */
156
- export function decrypt(ciphertext: Uint8Array, key_secret: string, nonce_material: Uint8Array): Uint8Array;
153
+ export function newEd25519SigningKey(): Uint8Array;
157
154
  /**
158
- * WASM-exposed function to derive an X25519 public key from a private key.
159
- * - `private_key`: 32 bytes of private key material
155
+ * WASM-exposed function to derive an Ed25519 verifying key from a signing key.
156
+ * - `signing_key`: 32 bytes of signing key material
157
+ * Returns 32 bytes of verifying key material or throws JsError if key is invalid.
158
+ */
159
+ export function ed25519VerifyingKey(signing_key: Uint8Array): Uint8Array;
160
+ /**
161
+ * WASM-exposed function to sign a message using Ed25519.
162
+ * - `signing_key`: 32 bytes of signing key material
163
+ * - `message`: Raw bytes to sign
164
+ * Returns 64 bytes of signature material or throws JsError if signing fails.
165
+ */
166
+ export function ed25519Sign(signing_key: Uint8Array, message: Uint8Array): Uint8Array;
167
+ /**
168
+ * WASM-exposed function to verify an Ed25519 signature.
169
+ * - `verifying_key`: 32 bytes of verifying key material
170
+ * - `message`: Raw bytes that were signed
171
+ * - `signature`: 64 bytes of signature material
172
+ * Returns true if signature is valid, false otherwise, or throws JsError if verification fails.
173
+ */
174
+ export function ed25519Verify(verifying_key: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
175
+ /**
176
+ * WASM-exposed function to validate and copy Ed25519 signing key bytes.
177
+ * - `bytes`: 32 bytes of signing key material to validate
178
+ * Returns the same 32 bytes if valid or throws JsError if invalid.
179
+ */
180
+ export function ed25519SigningKeyFromBytes(bytes: Uint8Array): Uint8Array;
181
+ /**
182
+ * WASM-exposed function to derive the public key from an Ed25519 signing key.
183
+ * - `signing_key`: 32 bytes of signing key material
160
184
  * Returns 32 bytes of public key material or throws JsError if key is invalid.
161
185
  */
162
- export function x25519PublicKey(private_key: Uint8Array): Uint8Array;
186
+ export function ed25519SigningKeyToPublic(signing_key: Uint8Array): Uint8Array;
163
187
  /**
164
- * WASM-exposed function to perform X25519 Diffie-Hellman key exchange.
165
- * - `private_key`: 32 bytes of private key material
166
- * - `public_key`: 32 bytes of public key material
167
- * Returns 32 bytes of shared secret material or throws JsError if key exchange fails.
188
+ * WASM-exposed function to sign a message with an Ed25519 signing key.
189
+ * - `signing_key`: 32 bytes of signing key material
190
+ * - `message`: Raw bytes to sign
191
+ * Returns 64 bytes of signature material or throws JsError if signing fails.
168
192
  */
169
- export function x25519DiffieHellman(private_key: Uint8Array, public_key: Uint8Array): Uint8Array;
193
+ export function ed25519SigningKeySign(signing_key: Uint8Array, message: Uint8Array): Uint8Array;
170
194
  /**
171
- * WASM-exposed function to derive a sealer ID from a sealer secret.
172
- * - `secret`: Raw bytes of the sealer secret
173
- * Returns a base58-encoded sealer ID with "sealer_z" prefix or throws JsError if derivation fails.
195
+ * WASM-exposed function to validate and copy Ed25519 verifying key bytes.
196
+ * - `bytes`: 32 bytes of verifying key material to validate
197
+ * Returns the same 32 bytes if valid or throws JsError if invalid.
174
198
  */
175
- export function getSealerId(secret: Uint8Array): string;
199
+ export function ed25519VerifyingKeyFromBytes(bytes: Uint8Array): Uint8Array;
176
200
  /**
177
- * Generate a new X25519 private key using secure random number generation.
178
- * Returns 32 bytes of raw key material suitable for use with other X25519 functions.
179
- * This key can be reused for multiple Diffie-Hellman exchanges.
201
+ * WASM-exposed function to validate and copy Ed25519 signature bytes.
202
+ * - `bytes`: 64 bytes of signature material to validate
203
+ * Returns the same 64 bytes if valid or throws JsError if invalid.
180
204
  */
181
- export function newX25519PrivateKey(): Uint8Array;
205
+ export function ed25519SignatureFromBytes(bytes: Uint8Array): Uint8Array;
182
206
  export class Blake3Hasher {
183
207
  free(): void;
184
208
  constructor();
185
- clone(): Blake3Hasher;
186
209
  update(data: Uint8Array): void;
187
210
  finalize(): Uint8Array;
211
+ clone(): Blake3Hasher;
188
212
  }
189
- export class SessionLog {
213
+ export class SessionMap {
190
214
  free(): void;
191
215
  /**
192
- * Commit pending transactions to the main state.
193
- * If skip_validate is false, validates the signature first.
194
- * If skip_validate is true, commits without validation.
216
+ * Create a new SessionMap for a CoValue
217
+ * `max_tx_size` is the threshold for recording in-between signatures (default: 100KB)
218
+ * Create a new SessionMap for a CoValue.
219
+ * Validates the header and verifies that `co_id` matches the hash of the header.
220
+ * `max_tx_size` is the threshold for recording in-between signatures (default: 100KB)
221
+ * `skip_verify` if true, skips uniqueness and ID validation (for trusted storage shards)
222
+ */
223
+ constructor(co_id: string, header_json: string, max_tx_size?: number | null, skip_verify?: boolean | null);
224
+ /**
225
+ * Get the header as JSON
226
+ */
227
+ getHeader(): string;
228
+ /**
229
+ * Add transactions to a session
230
+ */
231
+ addTransactions(session_id: string, signer_id: string | null | undefined, transactions_json: string, signature: string, skip_verify: boolean): void;
232
+ /**
233
+ * Create new private transaction (for local writes)
234
+ * Returns JSON: { signature: string, transaction: Transaction }
235
+ */
236
+ makeNewPrivateTransaction(session_id: string, signer_secret: string, changes_json: string, key_id: string, key_secret: string, meta_json: string | null | undefined, made_at: number): string;
237
+ /**
238
+ * Create new trusting transaction (for local writes)
239
+ * Returns JSON: { signature: string, transaction: Transaction }
240
+ */
241
+ makeNewTrustingTransaction(session_id: string, signer_secret: string, changes_json: string, meta_json: string | null | undefined, made_at: number): string;
242
+ /**
243
+ * Get all session IDs as native array
244
+ */
245
+ getSessionIds(): string[];
246
+ /**
247
+ * Get transaction count for a session (returns -1 if session not found)
248
+ */
249
+ getTransactionCount(session_id: string): number;
250
+ /**
251
+ * Get single transaction by index as JSON string (returns undefined if not found)
252
+ */
253
+ getTransaction(session_id: string, tx_index: number): string | undefined;
254
+ /**
255
+ * Get transactions for a session from index as JSON strings (returns undefined if session not found)
256
+ */
257
+ getSessionTransactions(session_id: string, from_index: number): string[] | undefined;
258
+ /**
259
+ * Get last signature for a session (returns undefined if session not found)
260
+ */
261
+ getLastSignature(session_id: string): string | undefined;
262
+ /**
263
+ * Get signature after specific transaction index
264
+ */
265
+ getSignatureAfter(session_id: string, tx_index: number): string | undefined;
266
+ /**
267
+ * Get the last signature checkpoint index (-1 if no checkpoints, undefined if session not found)
268
+ */
269
+ getLastSignatureCheckpoint(session_id: string): number | undefined;
270
+ /**
271
+ * Get the known state as a native JavaScript object
272
+ */
273
+ getKnownState(): any;
274
+ /**
275
+ * Get the known state with streaming as a native JavaScript object
276
+ */
277
+ getKnownStateWithStreaming(): any;
278
+ /**
279
+ * Set streaming known state
280
+ */
281
+ setStreamingKnownState(streaming_json: string): void;
282
+ /**
283
+ * Mark this CoValue as deleted
284
+ */
285
+ markAsDeleted(): void;
286
+ /**
287
+ * Check if this CoValue is deleted
195
288
  */
196
- commitTransactions(new_signature_str: string, skip_validate: boolean): void;
197
- addNewPrivateTransaction(changes_json: string, signer_secret: string, encryption_key: string, key_id: string, made_at: number, meta?: string | null): string;
198
- addNewTrustingTransaction(changes_json: string, signer_secret: string, made_at: number, meta?: string | null): string;
289
+ isDeleted(): boolean;
199
290
  /**
200
- * Add an existing private transaction to the staging area.
201
- * The transaction is NOT committed until commitTransactions() succeeds.
202
- * Note: made_at uses f64 because JavaScript's number type is f64.
291
+ * Decrypt transaction changes
203
292
  */
204
- addExistingPrivateTransaction(encrypted_changes: string, key_used: string, made_at: number, meta?: string | null): void;
293
+ decryptTransaction(session_id: string, tx_index: number, key_secret: string): string | undefined;
205
294
  /**
206
- * Add an existing trusting transaction to the staging area.
207
- * The transaction is NOT committed until commitTransactions() succeeds.
208
- * Note: made_at uses f64 because JavaScript's number type is f64.
295
+ * Decrypt transaction meta
209
296
  */
210
- addExistingTrustingTransaction(changes: string, made_at: number, meta?: string | null): void;
211
- decryptNextTransactionMetaJson(tx_index: number, encryption_key: string): string | undefined;
212
- decryptNextTransactionChangesJson(tx_index: number, encryption_key: string): string;
213
- constructor(co_id: string, session_id: string, signer_id?: string | null);
214
- clone(): SessionLog;
297
+ decryptTransactionMeta(session_id: string, tx_index: number, key_secret: string): string | undefined;
215
298
  }
216
299
 
217
300
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
218
301
 
219
302
  export interface InitOutput {
220
303
  readonly memory: WebAssembly.Memory;
221
- readonly __wbg_sessionlog_free: (a: number, b: number) => void;
222
- readonly sessionlog_addExistingPrivateTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
223
- readonly sessionlog_addExistingTrustingTransaction: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
224
- readonly sessionlog_addNewPrivateTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
225
- readonly sessionlog_addNewTrustingTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
226
- readonly sessionlog_clone: (a: number) => number;
227
- readonly sessionlog_commitTransactions: (a: number, b: number, c: number, d: number) => [number, number];
228
- readonly sessionlog_decryptNextTransactionChangesJson: (a: number, b: number, c: number, d: number) => [number, number, number, number];
229
- readonly sessionlog_decryptNextTransactionMetaJson: (a: number, b: number, c: number, d: number) => [number, number, number, number];
230
- readonly sessionlog_new: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
231
- readonly ed25519Sign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
232
- readonly ed25519SignatureFromBytes: (a: number, b: number) => [number, number, number, number];
233
- readonly ed25519SigningKeyFromBytes: (a: number, b: number) => [number, number, number, number];
234
- readonly ed25519SigningKeyToPublic: (a: number, b: number) => [number, number, number, number];
235
- readonly ed25519Verify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
236
- readonly ed25519VerifyingKey: (a: number, b: number) => [number, number, number, number];
237
- readonly ed25519VerifyingKeyFromBytes: (a: number, b: number) => [number, number, number, number];
238
- readonly newEd25519SigningKey: () => [number, number];
239
- readonly ed25519SigningKeySign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
240
- readonly getSignerId: (a: number, b: number) => [number, number, number, number];
241
- readonly sign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
242
- readonly verify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
243
- readonly __wbg_blake3hasher_free: (a: number, b: number) => void;
304
+ readonly __wbg_sessionmap_free: (a: number, b: number) => void;
305
+ readonly sessionmap_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
306
+ readonly sessionmap_getHeader: (a: number) => [number, number];
307
+ readonly sessionmap_addTransactions: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
308
+ 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];
309
+ 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];
310
+ readonly sessionmap_getSessionIds: (a: number) => [number, number];
311
+ readonly sessionmap_getTransactionCount: (a: number, b: number, c: number) => number;
312
+ readonly sessionmap_getTransaction: (a: number, b: number, c: number, d: number) => [number, number];
313
+ readonly sessionmap_getSessionTransactions: (a: number, b: number, c: number, d: number) => [number, number];
314
+ readonly sessionmap_getLastSignature: (a: number, b: number, c: number) => [number, number];
315
+ readonly sessionmap_getSignatureAfter: (a: number, b: number, c: number, d: number) => [number, number];
316
+ readonly sessionmap_getLastSignatureCheckpoint: (a: number, b: number, c: number) => number;
317
+ readonly sessionmap_getKnownState: (a: number) => any;
318
+ readonly sessionmap_getKnownStateWithStreaming: (a: number) => any;
319
+ readonly sessionmap_setStreamingKnownState: (a: number, b: number, c: number) => [number, number];
320
+ readonly sessionmap_markAsDeleted: (a: number) => void;
321
+ readonly sessionmap_isDeleted: (a: number) => number;
322
+ readonly sessionmap_decryptTransaction: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
323
+ readonly sessionmap_decryptTransactionMeta: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
324
+ readonly shortHash: (a: number, b: number) => [number, number];
325
+ readonly generateNonce: (a: number, b: number) => [number, number];
244
326
  readonly blake3HashOnce: (a: number, b: number) => [number, number];
245
327
  readonly blake3HashOnceWithContext: (a: number, b: number, c: number, d: number) => [number, number];
246
- readonly blake3hasher_clone: (a: number) => number;
247
- readonly blake3hasher_finalize: (a: number) => [number, number];
328
+ readonly __wbg_blake3hasher_free: (a: number, b: number) => void;
248
329
  readonly blake3hasher_new: () => number;
249
330
  readonly blake3hasher_update: (a: number, b: number, c: number) => void;
250
- readonly decryptXsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
251
- readonly encryptXsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
252
- readonly generateNonce: (a: number, b: number) => [number, number];
253
- readonly decrypt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
331
+ readonly blake3hasher_finalize: (a: number) => [number, number];
332
+ readonly blake3hasher_clone: (a: number) => number;
254
333
  readonly encrypt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
255
- readonly seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
256
- readonly unseal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
257
- readonly getSealerId: (a: number, b: number) => [number, number, number, number];
334
+ readonly decrypt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
258
335
  readonly newX25519PrivateKey: () => [number, number];
259
- readonly x25519DiffieHellman: (a: number, b: number, c: number, d: number) => [number, number, number, number];
260
336
  readonly x25519PublicKey: (a: number, b: number) => [number, number, number, number];
337
+ readonly x25519DiffieHellman: (a: number, b: number, c: number, d: number) => [number, number, number, number];
338
+ readonly getSealerId: (a: number, b: number) => [number, number, number, number];
339
+ readonly encryptXsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
340
+ readonly decryptXsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
341
+ readonly sign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
342
+ readonly verify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
343
+ readonly getSignerId: (a: number, b: number) => [number, number, number, number];
344
+ readonly seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
345
+ readonly unseal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
346
+ readonly sealForGroup: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
347
+ readonly unsealForGroup: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
348
+ readonly newEd25519SigningKey: () => [number, number];
349
+ readonly ed25519VerifyingKey: (a: number, b: number) => [number, number, number, number];
350
+ readonly ed25519Sign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
351
+ readonly ed25519Verify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
352
+ readonly ed25519SigningKeyFromBytes: (a: number, b: number) => [number, number, number, number];
353
+ readonly ed25519SigningKeyToPublic: (a: number, b: number) => [number, number, number, number];
354
+ readonly ed25519VerifyingKeyFromBytes: (a: number, b: number) => [number, number, number, number];
355
+ readonly ed25519SignatureFromBytes: (a: number, b: number) => [number, number, number, number];
356
+ readonly ed25519SigningKeySign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
261
357
  readonly __wbindgen_malloc: (a: number, b: number) => number;
262
358
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
263
359
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -265,6 +361,7 @@ export interface InitOutput {
265
361
  readonly __wbindgen_export_4: WebAssembly.Table;
266
362
  readonly __externref_table_dealloc: (a: number) => void;
267
363
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
364
+ readonly __externref_drop_slice: (a: number, b: number) => void;
268
365
  readonly __wbindgen_start: () => void;
269
366
  }
270
367