@derec-alliance/nodejs 0.0.1-alpha.10
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 +201 -0
- package/README.md +551 -0
- package/derec_library.d.ts +466 -0
- package/derec_library.js +2008 -0
- package/derec_library_bg.wasm +0 -0
- package/derec_library_bg.wasm.d.ts +92 -0
- package/index.d.ts +1547 -0
- package/index.js +106 -0
- package/package.json +34 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Fluent builder for [`DeRecProtocolWasm`]. Mirrors the Rust
|
|
6
|
+
* [`crate::protocol::DeRecProtocolBuilder`] and the dotnet
|
|
7
|
+
* `DeRecProtocolBuilder` method-for-method so a developer who already
|
|
8
|
+
* knows one SDK can move between them without reaching for reference
|
|
9
|
+
* docs.
|
|
10
|
+
*
|
|
11
|
+
* Required setters: `withChannelStore`, `withShareStore`,
|
|
12
|
+
* `withSecretStore`, `withTransport`, `withOwnTransport`. Calling
|
|
13
|
+
* `build()` without all five throws.
|
|
14
|
+
*
|
|
15
|
+
* All optional setters carry the defaults documented on the Rust
|
|
16
|
+
* builder.
|
|
17
|
+
*/
|
|
18
|
+
export class DeRecProtocolBuilder {
|
|
19
|
+
free(): void;
|
|
20
|
+
[Symbol.dispose](): void;
|
|
21
|
+
/**
|
|
22
|
+
* Finalize the configuration. Throws if any of the required
|
|
23
|
+
* setters was not called.
|
|
24
|
+
*/
|
|
25
|
+
build(): DeRecProtocolWasm;
|
|
26
|
+
/**
|
|
27
|
+
* `secretId` is a JS `bigint` or `number`. Identifies the single
|
|
28
|
+
* secret this protocol instance manages; apps that juggle multiple
|
|
29
|
+
* secrets instantiate one protocol per id.
|
|
30
|
+
*/
|
|
31
|
+
constructor(secret_id: any);
|
|
32
|
+
/**
|
|
33
|
+
* Per-flow auto-accept policy.
|
|
34
|
+
*
|
|
35
|
+
* `policy` shape (all fields optional, default `false`):
|
|
36
|
+
* `{ pairing, prePair, storeShare, verifyShare, discovery, getShare, unpair, updateChannelInfo }`.
|
|
37
|
+
*
|
|
38
|
+
* When a field is `true`, `process()` internally accepts the
|
|
39
|
+
* matching incoming request and emits an `AutoAccepted` event in
|
|
40
|
+
* place of `ActionRequired`. See the Rust-side
|
|
41
|
+
* `AutoAcceptPolicy` rustdoc for the per-flow trade-offs.
|
|
42
|
+
* Default: every field `false`.
|
|
43
|
+
*/
|
|
44
|
+
withAutoAccept(policy: any): DeRecProtocolBuilder;
|
|
45
|
+
/**
|
|
46
|
+
* Whether outbound requests stamp `replyTo = ownTransport`.
|
|
47
|
+
* Default: false.
|
|
48
|
+
*/
|
|
49
|
+
withAutoReplyTo(enabled: boolean): DeRecProtocolBuilder;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the protocol auto-replies on failed inbound processing.
|
|
52
|
+
* Default: false.
|
|
53
|
+
*/
|
|
54
|
+
withAutoRespondOnFailure(enabled: boolean): DeRecProtocolBuilder;
|
|
55
|
+
withChannelStore(store: any): DeRecProtocolBuilder;
|
|
56
|
+
/**
|
|
57
|
+
* `info` shape: `Record<string, string>`. Default: empty.
|
|
58
|
+
*/
|
|
59
|
+
withCommunicationInfo(info: any): DeRecProtocolBuilder;
|
|
60
|
+
/**
|
|
61
|
+
* Number of recent versions each helper must retain. Default: 3.
|
|
62
|
+
*/
|
|
63
|
+
withKeepVersionsCount(count: number): DeRecProtocolBuilder;
|
|
64
|
+
/**
|
|
65
|
+
* `endpoint` shape: `{ uri: string, protocol: string }`.
|
|
66
|
+
* `protocol` must be `"https"` (the only protocol supported today).
|
|
67
|
+
*/
|
|
68
|
+
withOwnTransport(endpoint: any): DeRecProtocolBuilder;
|
|
69
|
+
/**
|
|
70
|
+
* Declare the local node's acceptable parameter range for pair
|
|
71
|
+
* negotiation. `range` is a JS object whose keys mirror the
|
|
72
|
+
* `ParameterRange` proto (`minShareSize`, `maxShareSize`,
|
|
73
|
+
* `minTimeBetweenVerifications`, ...). Each field is `i64` —
|
|
74
|
+
* accept either a number or a `BigInt` on the JS side. Default:
|
|
75
|
+
* unset (no constraints advertised, every peer range accepted).
|
|
76
|
+
*/
|
|
77
|
+
withParameterRange(range: any): DeRecProtocolBuilder;
|
|
78
|
+
/**
|
|
79
|
+
* `id` is a JS `bigint` or `number`. Default: unset.
|
|
80
|
+
*/
|
|
81
|
+
withReplicaId(id: any): DeRecProtocolBuilder;
|
|
82
|
+
withSecretStore(store: any): DeRecProtocolBuilder;
|
|
83
|
+
withShareStore(store: any): DeRecProtocolBuilder;
|
|
84
|
+
withStateStore(store: any): DeRecProtocolBuilder;
|
|
85
|
+
/**
|
|
86
|
+
* Minimum number of shares required to reconstruct the secret.
|
|
87
|
+
* Default: 3.
|
|
88
|
+
*/
|
|
89
|
+
withThreshold(threshold: number): DeRecProtocolBuilder;
|
|
90
|
+
/**
|
|
91
|
+
* Configure the four waiting periods in one call.
|
|
92
|
+
*
|
|
93
|
+
* Object shape — every field optional, and **absent means "keep the
|
|
94
|
+
* library default"**:
|
|
95
|
+
*
|
|
96
|
+
* ```text
|
|
97
|
+
* {
|
|
98
|
+
* inbound_message_secs?: number, // staleness / replay window
|
|
99
|
+
* sharing_round_secs?: number,
|
|
100
|
+
* unpair_ack_secs?: number,
|
|
101
|
+
* expired_channels?: { enabled: boolean, timeout_in_secs: number },
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* Values are forwarded verbatim; clamping and the meaning of a disabled
|
|
106
|
+
* `expired_channels` are library decisions, not this shim's. Not calling
|
|
107
|
+
* this leaves every default in force.
|
|
108
|
+
*/
|
|
109
|
+
withTimeouts(timeouts: any): DeRecProtocolBuilder;
|
|
110
|
+
withTransport(transport: any): DeRecProtocolBuilder;
|
|
111
|
+
/**
|
|
112
|
+
* `ack` is `"required"` (default) or `"not_required"`.
|
|
113
|
+
*/
|
|
114
|
+
withUnpairAck(ack: string): DeRecProtocolBuilder;
|
|
115
|
+
/**
|
|
116
|
+
* Accept plaintext `http://` transport endpoints. **Development only.**
|
|
117
|
+
* Default `false`.
|
|
118
|
+
*
|
|
119
|
+
* With it `false`, plaintext is accepted only for an endpoint this
|
|
120
|
+
* device configured for *itself* that names loopback (`localhost`,
|
|
121
|
+
* `127.0.0.1`, `::1`) — so a local dev server needs no configuration.
|
|
122
|
+
* With it `true`, plaintext is accepted for any host on any path,
|
|
123
|
+
* including endpoints a peer supplies. That is what makes the LAN case
|
|
124
|
+
* work (a phone against a laptop), and why the name is blunt.
|
|
125
|
+
*/
|
|
126
|
+
withUnsafeHttp(allow: boolean): DeRecProtocolBuilder;
|
|
127
|
+
withUserSecretStore(store: any): DeRecProtocolBuilder;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Higher-level DeRec protocol orchestrator for TypeScript/JavaScript consumers.
|
|
132
|
+
*
|
|
133
|
+
* Wraps [`DeRecProtocol`](crate::protocol::DeRecProtocol) with JS-side store
|
|
134
|
+
* and transport adapters so that a TypeScript application can drive all five
|
|
135
|
+
* protocol flows without routing raw bytes manually.
|
|
136
|
+
*
|
|
137
|
+
* # Stores
|
|
138
|
+
*
|
|
139
|
+
* Pass four JS objects that implement the interfaces documented on each
|
|
140
|
+
* parameter. All store methods must return `Promise`s — synchronous
|
|
141
|
+
* implementations can wrap their result with `Promise.resolve(...)`.
|
|
142
|
+
*
|
|
143
|
+
* # Events
|
|
144
|
+
*
|
|
145
|
+
* [`process`](DeRecProtocolWasm::process) returns an `Array` of plain JS
|
|
146
|
+
* objects, each with a `type` discriminant field:
|
|
147
|
+
*
|
|
148
|
+
* | `type` | Additional fields |
|
|
149
|
+
* |--------------------|--------------------------------------------------------|
|
|
150
|
+
* | `PairingCompleted` | `channel_id: string`, `pairing_channel_id: string`, `kind: number` |
|
|
151
|
+
* | `ShareStored` | `channel_id: string`, `version: number` |
|
|
152
|
+
* | `ShareConfirmed` | `channel_id: string`, `version: number` |
|
|
153
|
+
* | `ShareVerified` | `channel_id: string`, `version: number` |
|
|
154
|
+
* | `SecretsDiscovered`| `channel_id: string`, `secrets: SecretVersionEntry[]` |
|
|
155
|
+
* | `SecretRecovered` | `secret: { helpers, secrets, replicas }` (same nested shape as `ReplicaSecretReceived.secret`) |
|
|
156
|
+
* | `NoOp` | _(none)_ |
|
|
157
|
+
*
|
|
158
|
+
* `SecretVersionEntry = { secret_id: bigint, versions: { version: number, description: string }[] }`
|
|
159
|
+
*/
|
|
160
|
+
export class DeRecProtocolWasm {
|
|
161
|
+
private constructor();
|
|
162
|
+
free(): void;
|
|
163
|
+
[Symbol.dispose](): void;
|
|
164
|
+
/**
|
|
165
|
+
* Accept a pending action from an `ActionRequired` event.
|
|
166
|
+
*
|
|
167
|
+
* # Arguments
|
|
168
|
+
*
|
|
169
|
+
* * `action_bytes` — Opaque `Uint8Array` from the `action` field of an `ActionRequired` event.
|
|
170
|
+
*
|
|
171
|
+
* # Returns
|
|
172
|
+
*
|
|
173
|
+
* An `Array` of event objects (same format as `process()`).
|
|
174
|
+
*/
|
|
175
|
+
accept(action_bytes: Uint8Array): Promise<any>;
|
|
176
|
+
/**
|
|
177
|
+
* Single entry point for all three contact modes (`InlineKeys`,
|
|
178
|
+
* `HashedKeys`, `NoKeys`).
|
|
179
|
+
*
|
|
180
|
+
* * `channel_id` — `null`/`undefined` lets the library mint a
|
|
181
|
+
* random id; otherwise `bigint` / `number` is used verbatim.
|
|
182
|
+
* * `contact_mode` — `0` (InlineKeys), `1` (HashedKeys), `2` (NoKeys).
|
|
183
|
+
* * `nonce` — `null`/`undefined` lets the library generate a fresh
|
|
184
|
+
* random `u64`; otherwise the supplied `bigint`/`number` is used.
|
|
185
|
+
* Required for `NoKeys` where callers typically pick a small
|
|
186
|
+
* human-typable value.
|
|
187
|
+
*/
|
|
188
|
+
createContact(channel_id: any, contact_mode: number, nonce: any): Promise<any>;
|
|
189
|
+
/**
|
|
190
|
+
* Derive the human-readable fingerprint for a paired channel. Both
|
|
191
|
+
* sides of a replica pair derive the same fingerprint from the
|
|
192
|
+
* shared key, enabling out-of-band confirmation before the channel
|
|
193
|
+
* transitions from `Pending` to `Paired`.
|
|
194
|
+
*/
|
|
195
|
+
getFingerprint(channel_id: any): Promise<string>;
|
|
196
|
+
/**
|
|
197
|
+
* Feed any incoming wire bytes to the protocol.
|
|
198
|
+
*
|
|
199
|
+
* Returns an `Array` of plain JS event objects (see struct-level docs for shapes).
|
|
200
|
+
* Every inbound flow — pairing, sharing, verification, discovery,
|
|
201
|
+
* recovery, unpairing, channel-info updates and the replica flows — is
|
|
202
|
+
* handled through this single entry point.
|
|
203
|
+
*
|
|
204
|
+
* # Arguments
|
|
205
|
+
*
|
|
206
|
+
* * `message` — Raw wire bytes of an incoming `DeRecMessage`.
|
|
207
|
+
*/
|
|
208
|
+
process(message: Uint8Array): Promise<any>;
|
|
209
|
+
/**
|
|
210
|
+
* Reject a pending action from an `ActionRequired` event.
|
|
211
|
+
*
|
|
212
|
+
* # Arguments
|
|
213
|
+
*
|
|
214
|
+
* * `action_bytes` — Opaque `Uint8Array` from the `action` field of an `ActionRequired` event.
|
|
215
|
+
* * `status` — Numeric status code from `StatusEnum` (e.g. 2 for FAIL, 10 for REJECTED).
|
|
216
|
+
* * `memo` — Human-readable rejection reason.
|
|
217
|
+
*/
|
|
218
|
+
reject(action_bytes: Uint8Array, status: number, memo: string): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Remove `Pending` channels older than `older_than_secs`, along with
|
|
221
|
+
* their pairing keys.
|
|
222
|
+
*
|
|
223
|
+
* Independent of the configured cleanup policy — it sweeps at the
|
|
224
|
+
* threshold given, even when the policy is disabled. The age
|
|
225
|
+
* comparison is strict, so a channel created within the current
|
|
226
|
+
* second survives even `0`.
|
|
227
|
+
*
|
|
228
|
+
* # Returns
|
|
229
|
+
*
|
|
230
|
+
* An `Array` of removed channel ids as decimal strings.
|
|
231
|
+
*/
|
|
232
|
+
removeExpiredChannels(older_than_secs: number): Promise<any>;
|
|
233
|
+
/**
|
|
234
|
+
* Rebuild this protocol's `secret_id` namespace from a recovered
|
|
235
|
+
* `Secret`. Mirrors [`crate::protocol::DeRecProtocol::restore`] —
|
|
236
|
+
* see that method for the full contract.
|
|
237
|
+
*
|
|
238
|
+
* `recoveredSecret` is the typed `Secret` object carried by the
|
|
239
|
+
* `SecretRecovered` event; pass it verbatim.
|
|
240
|
+
*
|
|
241
|
+
* Errors surface as structured JS errors with a `code` field:
|
|
242
|
+
*
|
|
243
|
+
* | code | meaning |
|
|
244
|
+
* |--------------------|------------------------------------------------------------------|
|
|
245
|
+
* | `ALREADY_RESTORED` | A user-secret snapshot already exists for this `secret_id`. |
|
|
246
|
+
* | `CONFLICT` | Channels live at canonical helper / replica ids. The error |
|
|
247
|
+
* | | carries `channel_ids: string[]` listing the collisions. |
|
|
248
|
+
* | `INVARIANT` | The recovered `Secret` is internally inconsistent. |
|
|
249
|
+
* | `STORAGE` | A store I/O call failed mid-restore. |
|
|
250
|
+
*/
|
|
251
|
+
restore(recovered_secret: any, version: number): Promise<any>;
|
|
252
|
+
/**
|
|
253
|
+
* Generate an out-of-band contact message (QR code payload, deep link, …).
|
|
254
|
+
*
|
|
255
|
+
* Returns a plain JS `ContactMessage` object. The `channel_id` field identifies
|
|
256
|
+
* the pairing session and will match the `channel_id` in the eventual
|
|
257
|
+
* `PairingCompleted` event — read it directly from the returned object.
|
|
258
|
+
*
|
|
259
|
+
* The caller is responsible for serializing the contact for out-of-band
|
|
260
|
+
* delivery (QR code, deep link, etc.). The peer passes the deserialized object
|
|
261
|
+
* to [`start`](Self::start) with `FlowKind::Pairing`.
|
|
262
|
+
*
|
|
263
|
+
* # Arguments
|
|
264
|
+
*
|
|
265
|
+
* * `channel_id` — Optional `BigInt` channel identifier. Pass `null` or
|
|
266
|
+
* `undefined` to have the library generate a random one.
|
|
267
|
+
* * `contact_mode` — `0` for `InlineKeys` (keys embedded directly), `1`
|
|
268
|
+
* for `HashedKeys` (contact carries only a SHA-384 binding hash; the
|
|
269
|
+
* scanner fetches keys via a `PrePair` round-trip). `HashedKeys`
|
|
270
|
+
* requires the protocol's `own_transport` to be ephemeral.
|
|
271
|
+
* The secret identifier this protocol instance is bound to.
|
|
272
|
+
*/
|
|
273
|
+
secretId(): bigint;
|
|
274
|
+
/**
|
|
275
|
+
* Replace this node's local communication info. Does not contact peers —
|
|
276
|
+
* follow up with a `start(UpdateChannelInfo, ...)` to propagate.
|
|
277
|
+
*/
|
|
278
|
+
setCommunicationInfo(info: any): void;
|
|
279
|
+
/**
|
|
280
|
+
* Replace this node's local transport endpoint. See
|
|
281
|
+
* `setCommunicationInfo` for the matching update-propagation flow.
|
|
282
|
+
* IMPORTANT: keep the old endpoint operational during the changeover —
|
|
283
|
+
* see the Rust docs on `set_own_transport` for the discipline.
|
|
284
|
+
*/
|
|
285
|
+
setOwnTransport(uri: string, protocol: string): void;
|
|
286
|
+
/**
|
|
287
|
+
* Unified entry point for initiating any protocol flow.
|
|
288
|
+
*
|
|
289
|
+
* # Arguments
|
|
290
|
+
*
|
|
291
|
+
* * `flow_kind` — Flow discriminant:
|
|
292
|
+
* - `0` = Pairing (params: `{ kind: number, contact: ContactMessage, name?: string }`)
|
|
293
|
+
* - `1` = Discovery (params: `{ target: BigInt | BigInt[] | null }`)
|
|
294
|
+
* - `2` = ProtectSecret (params: `{ secrets: UserSecret[], description?: string }`)
|
|
295
|
+
* - `3` = VerifyShares (params: `{ version: number, target: BigInt | BigInt[] | null }`)
|
|
296
|
+
* - `4` = RecoverSecret (params: `{ secretId: Uint8Array, version: number }`)
|
|
297
|
+
*
|
|
298
|
+
* # Returns
|
|
299
|
+
*
|
|
300
|
+
* An `Array` of `*Started` / `*Failed` events describing the
|
|
301
|
+
* dispatched requests. Same shape as `process()`.
|
|
302
|
+
*/
|
|
303
|
+
start(flow_kind: number, params: any): Promise<any>;
|
|
304
|
+
/**
|
|
305
|
+
* Advance time-driven state without an inbound message.
|
|
306
|
+
*
|
|
307
|
+
* Timeouts are otherwise only evaluated by `process`, so a publish whose
|
|
308
|
+
* helpers all go quiet has nothing left to close it. Call this from a
|
|
309
|
+
* timer — `setInterval`, a service-worker alarm, a job runner — at an
|
|
310
|
+
* interval shorter than the configured timeout.
|
|
311
|
+
*
|
|
312
|
+
* Returns an `Array` of plain JS event objects, empty when nothing was
|
|
313
|
+
* in flight. Safe to call at any time.
|
|
314
|
+
*/
|
|
315
|
+
tick(): Promise<any>;
|
|
316
|
+
/**
|
|
317
|
+
* Verify a fingerprint against the channel's locally-derived one. On
|
|
318
|
+
* match, the channel transitions from `Pending` to `Paired`. Returns
|
|
319
|
+
* `true` when the fingerprint matches and the channel is confirmed,
|
|
320
|
+
* `false` otherwise.
|
|
321
|
+
*/
|
|
322
|
+
verifyFingerprint(channel_id: any, fingerprint: string): Promise<boolean>;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export function discovery_request_extract(envelope_bytes: Uint8Array, shared_key: Uint8Array): any;
|
|
326
|
+
|
|
327
|
+
export function discovery_request_produce(channel_id: bigint, shared_key: Uint8Array, reply_to: any): any;
|
|
328
|
+
|
|
329
|
+
export function discovery_response_extract(envelope_bytes: Uint8Array, shared_key: Uint8Array): any;
|
|
330
|
+
|
|
331
|
+
export function discovery_response_process(response: any): any;
|
|
332
|
+
|
|
333
|
+
export function discovery_response_produce(channel_id: bigint, secret_list: any, shared_key: Uint8Array): any;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Overwrite `trace_id` on a primitive-produced envelope and return the
|
|
337
|
+
* re-encoded bytes. The outer envelope is plaintext, so this does no
|
|
338
|
+
* crypto work.
|
|
339
|
+
*
|
|
340
|
+
* Useful for consumers driving the protocol through primitives directly
|
|
341
|
+
* (the orchestrator-level `DeRecProtocol` already handles trace_id
|
|
342
|
+
* end-to-end on its own).
|
|
343
|
+
*/
|
|
344
|
+
export function envelope_apply_trace_id(envelope_bytes: Uint8Array, trace_id: bigint): Uint8Array;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Read `trace_id` off an inbound envelope without touching the encrypted
|
|
348
|
+
* inner payload. Returns `0` when the sender didn't set one — the protobuf
|
|
349
|
+
* default is indistinguishable from an explicit zero.
|
|
350
|
+
*/
|
|
351
|
+
export function envelope_read_trace_id(envelope_bytes: Uint8Array): bigint;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Structurally validate a JS-side [`ContactMessage`]. Throws on any
|
|
355
|
+
* mode/field inconsistency (unknown `contact_mode`, mode/field mismatch,
|
|
356
|
+
* wrong binding-hash length).
|
|
357
|
+
*/
|
|
358
|
+
export function pairing_contact_message_validate(contact_message: any): void;
|
|
359
|
+
|
|
360
|
+
export function pairing_request_create_contact(channel_id: bigint, contact_mode: number, transport_protocol: any, nonce: any): any;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Decodes a proto-encoded [`ContactMessage`]. Structurally validates the
|
|
364
|
+
* decoded value before returning it to application code so consumers can
|
|
365
|
+
* trust the mode/field invariants documented on the wire format.
|
|
366
|
+
*/
|
|
367
|
+
export function pairing_request_decode_contact(bytes: Uint8Array): any;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Encodes a [`ContactMessage`] to proto wire bytes. Structurally validates
|
|
371
|
+
* the input first so a locally-constructed contact that violates the
|
|
372
|
+
* mode/field invariant is rejected at the boundary rather than silently
|
|
373
|
+
* serialized.
|
|
374
|
+
*/
|
|
375
|
+
export function pairing_request_encode_contact(contact_message: any): Uint8Array;
|
|
376
|
+
|
|
377
|
+
export function pairing_request_extract(envelope_bytes: Uint8Array, secret_key: Uint8Array): any;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Initiator-side: decode an inbound plaintext `PrePairRequest` envelope.
|
|
381
|
+
*/
|
|
382
|
+
export function pairing_request_extract_pre_pair(envelope_bytes: Uint8Array): any;
|
|
383
|
+
|
|
384
|
+
export function pairing_request_produce(kind: number, transport_protocol: any, contact_message: any, communication_info: any, parameter_range: any): any;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Scanner-side: build the plaintext `PrePairRequest` envelope for a
|
|
388
|
+
* `HASHED_KEYS` contact.
|
|
389
|
+
*/
|
|
390
|
+
export function pairing_request_produce_pre_pair(transport_protocol: any, contact_message: any): any;
|
|
391
|
+
|
|
392
|
+
export function pairing_response_extract(envelope_bytes: Uint8Array, secret_key: Uint8Array): any;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Scanner-side: decode the inbound plaintext `PrePairResponse` envelope.
|
|
396
|
+
*/
|
|
397
|
+
export function pairing_response_extract_pre_pair(envelope_bytes: Uint8Array): any;
|
|
398
|
+
|
|
399
|
+
export function pairing_response_process(contact_message: any, response: any, secret_key: Uint8Array): any;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Scanner-side: validate the `PrePairResponse` against the contact's
|
|
403
|
+
* SHA-384 binding hash. Returns the validated keys + nonce on match.
|
|
404
|
+
*/
|
|
405
|
+
export function pairing_response_process_pre_pair(contact_message: any, response: any): any;
|
|
406
|
+
|
|
407
|
+
export function pairing_response_produce(channel_id: bigint, request: any, secret_key: Uint8Array, communication_info: any, parameter_range: any): any;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Contact-creator side: publish the actual public keys back to the scanner.
|
|
411
|
+
*/
|
|
412
|
+
export function pairing_response_produce_pre_pair(channel_id: bigint, request: any, secret_key: Uint8Array): any;
|
|
413
|
+
|
|
414
|
+
export function recovery_request_extract(envelope_bytes: Uint8Array, shared_key: Uint8Array): any;
|
|
415
|
+
|
|
416
|
+
export function recovery_request_produce(channel_id: bigint, secret_id: bigint, version: number, shared_key: Uint8Array, reply_to: any): any;
|
|
417
|
+
|
|
418
|
+
export function recovery_response_extract(envelope_bytes: Uint8Array, shared_key: Uint8Array): any;
|
|
419
|
+
|
|
420
|
+
export function recovery_response_produce(channel_id: bigint, request: any, stored_share_request: any, shared_key: Uint8Array): any;
|
|
421
|
+
|
|
422
|
+
export function recovery_response_recover(secret_id: bigint, version: number, responses: any): any;
|
|
423
|
+
|
|
424
|
+
export function sharing_request_extract(envelope_bytes: Uint8Array, shared_key: Uint8Array): any;
|
|
425
|
+
|
|
426
|
+
export function sharing_request_produce(channel_id: bigint, version: number, secret_id: bigint, committed_share: any, keep_list: any, description: string, shared_key: Uint8Array, reply_to: any): any;
|
|
427
|
+
|
|
428
|
+
export function sharing_request_split(channels: any, secret_id: bigint, version: number, secret_data: Uint8Array, threshold: number): any;
|
|
429
|
+
|
|
430
|
+
export function sharing_response_extract(envelope_bytes: Uint8Array, shared_key: Uint8Array): any;
|
|
431
|
+
|
|
432
|
+
export function sharing_response_process(version: number, response: any): void;
|
|
433
|
+
|
|
434
|
+
export function sharing_response_produce(channel_id: bigint, request: any, shared_key: Uint8Array): any;
|
|
435
|
+
|
|
436
|
+
export function unpairing_request_extract(envelope_bytes: Uint8Array, shared_key: Uint8Array): any;
|
|
437
|
+
|
|
438
|
+
export function unpairing_request_produce(channel_id: bigint, memo: string, shared_key: Uint8Array, reply_to: any): any;
|
|
439
|
+
|
|
440
|
+
export function unpairing_response_extract(envelope_bytes: Uint8Array, shared_key: Uint8Array): any;
|
|
441
|
+
|
|
442
|
+
export function unpairing_response_process(response: any): any;
|
|
443
|
+
|
|
444
|
+
export function unpairing_response_produce(channel_id: bigint, shared_key: Uint8Array): any;
|
|
445
|
+
|
|
446
|
+
export function verification_request_extract(envelope_bytes: Uint8Array, shared_key: Uint8Array): any;
|
|
447
|
+
|
|
448
|
+
export function verification_request_produce(channel_id: bigint, secret_id: bigint, version: number, shared_key: Uint8Array, reply_to: any): any;
|
|
449
|
+
|
|
450
|
+
export function verification_response_extract(envelope_bytes: Uint8Array, shared_key: Uint8Array): any;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Verify a `VerifyShareResponseMessage` against the originating
|
|
454
|
+
* `VerifyShareRequestMessage` and the expected share content.
|
|
455
|
+
*
|
|
456
|
+
* `request` must be the request the **owner** previously produced for
|
|
457
|
+
* this challenge (kept by the caller in a per-`channel_id` pending-
|
|
458
|
+
* verification map). The primitive rejects any response whose
|
|
459
|
+
* `(nonce, secret_id, version)` triple doesn't match — that's the
|
|
460
|
+
* anti-replay gate.
|
|
461
|
+
*/
|
|
462
|
+
export function verification_response_process(request: any, response: any, share_content: Uint8Array): boolean;
|
|
463
|
+
|
|
464
|
+
export function verification_response_produce(channel_id: bigint, request: any, shared_key: Uint8Array, share_content: Uint8Array): any;
|
|
465
|
+
|
|
466
|
+
export function wasm_start(): void;
|