@qrlwallet/connect 2.0.0 → 3.1.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/README.md +3 -1
- package/dist/index.d.mts +285 -18
- package/dist/index.d.ts +285 -18
- package/dist/index.js +914 -144
- package/dist/index.mjs +896 -143
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -131,7 +131,9 @@ The main class. Creates a connection manager and EIP-1193 provider.
|
|
|
131
131
|
### Supported RPC methods
|
|
132
132
|
|
|
133
133
|
**Require user approval:**
|
|
134
|
-
`qrl_requestAccounts`, `qrl_sendTransaction`, `qrl_signTransaction`, `
|
|
134
|
+
`qrl_requestAccounts`, `qrl_sendTransaction`, `qrl_signTransaction`, `qrl_signMessage`, `qrl_signTypedData`, `wallet_addQrlChain`, `wallet_switchQrlChain`
|
|
135
|
+
|
|
136
|
+
`qrl_signMessage` and `qrl_signTypedData` (v3.0.0) replace the Ethereum-flavored `personal_sign` / `qrl_sign` / `qrl_signTypedData_v3` / `qrl_signTypedData_v4`. Both use SHAKE256 + native ML-DSA-87 ctx and return a rich `{ signature, publicKey, signer, digest, schemeVersion }` object; verify locally with `verifyMessage` / `verifyTypedData` exported from this package.
|
|
135
137
|
|
|
136
138
|
**Auto-proxied (no approval needed):**
|
|
137
139
|
`qrl_getBalance`, `qrl_call`, `qrl_estimateGas`, `qrl_blockNumber`, `qrl_chainId`, `qrl_getTransactionReceipt`, and 30+ more read-only methods.
|
package/dist/index.d.mts
CHANGED
|
@@ -61,6 +61,7 @@ declare class KeyExchange extends EventEmitter<KeyExchangeEvents> {
|
|
|
61
61
|
private awaitingSynAck;
|
|
62
62
|
private awaitingAck;
|
|
63
63
|
private keysExchanged;
|
|
64
|
+
private lastAck;
|
|
64
65
|
constructor(isOriginator: boolean, restored?: Session);
|
|
65
66
|
/**
|
|
66
67
|
* Originator (dApp) side: begin a fresh handshake by generating an
|
|
@@ -91,6 +92,8 @@ declare class KeyExchange extends EventEmitter<KeyExchangeEvents> {
|
|
|
91
92
|
reset(): void;
|
|
92
93
|
private resetInternal;
|
|
93
94
|
areKeysExchanged(): boolean;
|
|
95
|
+
/** The ACK produced for the current handshake, for duplicate-SYNACK replies. */
|
|
96
|
+
getLastAck(): AckMessage | null;
|
|
94
97
|
getSession(): Session | null;
|
|
95
98
|
getCurrentStep(): KeyExchangeMessageType;
|
|
96
99
|
/** Export the current session as a JSON-safe persisted record. */
|
|
@@ -104,16 +107,26 @@ interface DAppMetadata {
|
|
|
104
107
|
name: string;
|
|
105
108
|
url: string;
|
|
106
109
|
icon?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Optional "return to dApp" target (a URL or app deep-link scheme). Sent to
|
|
112
|
+
* the wallet in ORIGINATOR_INFO; after the wallet resolves a restricted
|
|
113
|
+
* request it bounces the user back here (WalletConnect-style peer redirect)
|
|
114
|
+
* so a same-device deep-link flow does not strand the user in the wallet.
|
|
115
|
+
*/
|
|
116
|
+
redirectUrl?: string;
|
|
107
117
|
}
|
|
108
118
|
/**
|
|
109
119
|
* Stored session for reconnection.
|
|
110
120
|
*
|
|
111
|
-
*
|
|
121
|
+
* Persists the derived AES-256 session key (not the ML-KEM secret key);
|
|
112
122
|
* the ML-KEM keypair is ephemeral and zeroized after the handshake.
|
|
113
123
|
* Re-pair (generate a new QR) to rotate the session key.
|
|
124
|
+
*
|
|
125
|
+
* v3 checkpoints the AEAD counters on every seal/open. v2 records (sparse
|
|
126
|
+
* checkpoints, stale-counter nonce-reuse risk on restore) are dropped.
|
|
114
127
|
*/
|
|
115
128
|
interface DAppSession {
|
|
116
|
-
version:
|
|
129
|
+
version: 3;
|
|
117
130
|
channelId: string;
|
|
118
131
|
keyExchange: PersistedSession;
|
|
119
132
|
dappMetadata: DAppMetadata;
|
|
@@ -126,7 +139,7 @@ interface DAppSession {
|
|
|
126
139
|
interface PendingRequest {
|
|
127
140
|
id: string | number;
|
|
128
141
|
method: string;
|
|
129
|
-
params?: unknown[];
|
|
142
|
+
params?: unknown[] | undefined;
|
|
130
143
|
resolve: (result: unknown) => void;
|
|
131
144
|
reject: (error: Error) => void;
|
|
132
145
|
timestamp: number;
|
|
@@ -135,7 +148,7 @@ interface PendingRequest {
|
|
|
135
148
|
* Key-exchange wire-message types.
|
|
136
149
|
*
|
|
137
150
|
* v2 note: only SYNACK (wallet→dApp) and ACK (dApp→wallet) are transmitted
|
|
138
|
-
* over the relay. The SYN step is carried by the QR code itself
|
|
151
|
+
* over the relay. The SYN step is carried by the QR code itself - the dApp's
|
|
139
152
|
* ML-KEM-768 encapsulation key is embedded in the URI, not sent on the wire.
|
|
140
153
|
*/
|
|
141
154
|
declare enum KeyExchangeMessageType {
|
|
@@ -191,7 +204,7 @@ interface JsonRpcRequest {
|
|
|
191
204
|
jsonrpc?: string;
|
|
192
205
|
id?: string | number;
|
|
193
206
|
method: string;
|
|
194
|
-
params?: unknown[];
|
|
207
|
+
params?: unknown[] | undefined;
|
|
195
208
|
}
|
|
196
209
|
/** JSON-RPC response */
|
|
197
210
|
interface JsonRpcResponse {
|
|
@@ -204,6 +217,66 @@ interface JsonRpcResponse {
|
|
|
204
217
|
data?: unknown;
|
|
205
218
|
};
|
|
206
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* EIP-6963 wallet identity advertised to dApps.
|
|
222
|
+
*
|
|
223
|
+
* `rdns` MUST be unique to this wallet and SHOULD be a reverse-DNS string
|
|
224
|
+
* (per EIP-6963). Defaults work for most consumers - override only when
|
|
225
|
+
* embedding the SDK inside a different branded wallet.
|
|
226
|
+
*/
|
|
227
|
+
interface EIP6963ProviderInfoOverride {
|
|
228
|
+
name?: string;
|
|
229
|
+
icon?: string;
|
|
230
|
+
rdns?: string;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Rich response object returned by both `qrl_signMessage` and
|
|
234
|
+
* `qrl_signTypedData`. The signature alone is not enough to verify since
|
|
235
|
+
* ML-DSA-87 public keys cannot be recovered from a signature, so the
|
|
236
|
+
* wallet always returns the public key explicitly. Stateless verifiers
|
|
237
|
+
* (e.g. the SDK's `verifyMessage` / `verifyTypedData`) need every field.
|
|
238
|
+
*/
|
|
239
|
+
interface QrlSignedResult {
|
|
240
|
+
/** 0x-hex of the 4595-byte ML-DSA-87 signature. */
|
|
241
|
+
signature: string;
|
|
242
|
+
/** 0x-hex of the 2592-byte ML-DSA-87 public key. */
|
|
243
|
+
publicKey: string;
|
|
244
|
+
/** 41-char checksummed Q-address derived from `publicKey`. */
|
|
245
|
+
signer: string;
|
|
246
|
+
/** 0x-hex of the 64-byte SHAKE256 digest that was signed. */
|
|
247
|
+
digest: string;
|
|
248
|
+
/** Scheme tag: 'QRL-SIGN-MSG-v1' or 'QRL-SIGN-TYPED-v1'. */
|
|
249
|
+
schemeVersion: string;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Response from `qrl_signTypedData`. Echoes `domain` so a stateless
|
|
253
|
+
* verifier doesn't need to be told the domain out-of-band.
|
|
254
|
+
*/
|
|
255
|
+
interface QrlSignedTypedDataResult extends QrlSignedResult {
|
|
256
|
+
domain: Record<string, unknown>;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* `qrl_signMessage` params: `[signer, messageHex]`. `signer` must equal the
|
|
260
|
+
* dApp's currently-connected account; the wallet rejects mismatches before
|
|
261
|
+
* unlocking. `messageHex` is strict `0x`-prefixed bytes (no UTF-8 strings).
|
|
262
|
+
*/
|
|
263
|
+
type QrlSignMessageParams = [string, string];
|
|
264
|
+
/**
|
|
265
|
+
* `qrl_signTypedData` params: `[signer, payload]`. Payload mirrors EIP-712
|
|
266
|
+
* shape: `{ types, primaryType, domain, message }`, but with `QRLDomain`
|
|
267
|
+
* in place of `EIP712Domain` and SHAKE256-based hashing. See `signing/`
|
|
268
|
+
* for the full encoder.
|
|
269
|
+
*/
|
|
270
|
+
interface QrlTypedDataPayload {
|
|
271
|
+
types: Record<string, readonly {
|
|
272
|
+
name: string;
|
|
273
|
+
type: string;
|
|
274
|
+
}[]>;
|
|
275
|
+
primaryType: string;
|
|
276
|
+
domain: Record<string, unknown>;
|
|
277
|
+
message: Record<string, unknown>;
|
|
278
|
+
}
|
|
279
|
+
type QrlSignTypedDataParams = [string, QrlTypedDataPayload];
|
|
207
280
|
/** QRL Connect configuration */
|
|
208
281
|
interface QRLConnectOptions {
|
|
209
282
|
dappMetadata: DAppMetadata;
|
|
@@ -215,6 +288,15 @@ interface QRLConnectOptions {
|
|
|
215
288
|
storageKey?: string;
|
|
216
289
|
/** Enable debug logging */
|
|
217
290
|
debug?: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Announce the provider via EIP-6963 so dApp wallet pickers can see it
|
|
293
|
+
* alongside the QRL browser extension. Defaults to true in browser
|
|
294
|
+
* environments. Set false to suppress (e.g. when the dApp wires the
|
|
295
|
+
* provider in manually).
|
|
296
|
+
*/
|
|
297
|
+
announceProvider?: boolean;
|
|
298
|
+
/** Override the EIP-6963 announce metadata (name / icon / rdns). */
|
|
299
|
+
providerInfo?: EIP6963ProviderInfoOverride;
|
|
218
300
|
}
|
|
219
301
|
|
|
220
302
|
/**
|
|
@@ -222,12 +304,46 @@ interface QRLConnectOptions {
|
|
|
222
304
|
* Bridges JSON-RPC requests from dApp to QRL Wallet via the relay.
|
|
223
305
|
*/
|
|
224
306
|
|
|
307
|
+
/**
|
|
308
|
+
* Default EIP-6963 identity for the QRL Connect provider. The `rdns` is
|
|
309
|
+
* deliberately distinct from the QRL browser extension (`theqrl.org`) so
|
|
310
|
+
* both wallets can coexist in the same dApp picker.
|
|
311
|
+
*/
|
|
312
|
+
declare const QRL_CONNECT_PROVIDER_INFO: {
|
|
313
|
+
readonly name: "MyQRLWallet (Mobile)";
|
|
314
|
+
readonly rdns: "com.qrlwallet.connect";
|
|
315
|
+
readonly icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAAXNSR0IArs4c6QAAH1dJREFUeF7tnXt8XGWZ+L/Pma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YglHYrfSDLj6F/NyXEls5rNjTwAPe0cKo6sFphVTUXZuovXwBAAel9LghOKL6U8OSMPQP81zM1skfsRDimPCmyp5daACplG9IBZLuUNu1KEIJEHwMjU4/L3DnKTnQYV0cNRyKJ6T3MXp0Vp8TuilpoAQG9iau96ngTZLwr9adsQXAMKKRE9Me7ycPBclUtZEwAYdaxfwsFOTB4UIV459diaStKA2e709PaX3uTCA2+NzuHXaJlqBgB1aUjBF0Wl04TEL6ljbOaya2DIbVyfUTi8mOeeyt7A4QpqBgB/LXAVzTKVR8SR99v1QKVMpLh6VPl9rFE/2tSeOxhXcaWGn6umADDi97vMS3vcjshx5v9rToDw+zB6Jaqm1eOk+POskpVkotfAHS2qSfvZ4LLLoCercXivmBfZ7S9CGtD/QTil2eWRfLGJotDomjWedS7zG5TlIJ8cHdOyZgWKgjWU0gb//TN93vM4z0SkE3eC99JKqSfkvDVtL4+4NLzPY7Eg1/nL4qjH6wy58yJTnDF91bviczlPPh8dX/8g+qlpAEYE7GlnfxEWI3K8QGsQwW2aEDSgbFb0CXW4bf16vheliy5BpasLAIyw+hWm9/Wx27aAVuercpEg00bcqEeiJNSNsEF7txzphp56VRH9oedxIw6/irv01sJ8P5c66s4m/MC159GQmsup0sCxiOyB0qZKswgzUaZplCI6l8NIQyhTzLQGBkT8J01Tah7sVv29Oqz20jzU1s3voujaUKjodQdAtgKSLnFJ00YDzQqzxGNqxqv9J48K7eiC0zvoFIetXobNoqQGlU2tL7A26tuahcpZ9wBMoJDJLHsQO4l6/K8gMuRNY40gr4psgnrWgAWgnnvXypZXAxaAvCqyCepZAxaAeu5dK1teDVgA8qrIJqhnDVgA6rl3rWx5NfC/zGV/wHfd+nEAAAAASUVORK5CYII=";
|
|
316
|
+
};
|
|
225
317
|
declare class QRLConnectProvider extends EventEmitter<ProviderEvents> {
|
|
226
318
|
private connectionManager;
|
|
227
319
|
private pendingRequests;
|
|
228
320
|
private options;
|
|
321
|
+
private eip6963Detail;
|
|
322
|
+
private eip6963RequestListener;
|
|
323
|
+
private resumeListener;
|
|
324
|
+
private resumeDebounce;
|
|
325
|
+
private readonly requestIdPrefix;
|
|
326
|
+
private requestCounter;
|
|
229
327
|
readonly isQRLConnect = true;
|
|
230
328
|
constructor(options: QRLConnectOptions);
|
|
329
|
+
private startEip6963Announce;
|
|
330
|
+
/**
|
|
331
|
+
* Re-open the relay socket when the dApp tab regains focus or the network
|
|
332
|
+
* comes back. Debounced because visibilitychange + online can fire together.
|
|
333
|
+
* No-op when already connected (ConnectionManager.resume guards that).
|
|
334
|
+
*/
|
|
335
|
+
private setupResumeListeners;
|
|
336
|
+
/**
|
|
337
|
+
* Remove the foreground/online resume listeners. Called on disconnect so a
|
|
338
|
+
* torn-down session can't be silently revived by a later tab focus; the
|
|
339
|
+
* listeners are re-armed by getConnectionURI()/newConnection() if the same
|
|
340
|
+
* provider is re-paired. Safe in any env.
|
|
341
|
+
*/
|
|
342
|
+
private teardownResumeListeners;
|
|
343
|
+
/**
|
|
344
|
+
* Stop announcing this provider over EIP-6963. Safe to call from any env.
|
|
345
|
+
*/
|
|
346
|
+
stopEip6963Announce(): void;
|
|
231
347
|
private setupConnectionListeners;
|
|
232
348
|
/**
|
|
233
349
|
* Generate a connection URI for QR code display or deep link redirect.
|
|
@@ -277,14 +393,14 @@ declare class QRLConnectProvider extends EventEmitter<ProviderEvents> {
|
|
|
277
393
|
/**
|
|
278
394
|
* Disconnect from wallet and clean up. Returns once the TERMINATE has
|
|
279
395
|
* either been flushed to the relay or the 800ms best-effort window has
|
|
280
|
-
* elapsed
|
|
396
|
+
* elapsed - the wallet gets an instant disconnect instead of landing in
|
|
281
397
|
* its stale-session grace period.
|
|
282
398
|
*/
|
|
283
399
|
disconnect(): Promise<void>;
|
|
284
400
|
}
|
|
285
401
|
|
|
286
402
|
/**
|
|
287
|
-
* Connection Manager
|
|
403
|
+
* Connection Manager - orchestrates socket lifecycle, the post-quantum
|
|
288
404
|
* handshake, encrypted message routing, and session persistence for the
|
|
289
405
|
* dApp side of QRL Connect v2.
|
|
290
406
|
*/
|
|
@@ -312,16 +428,18 @@ declare class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
|
|
|
312
428
|
private connectedAccounts;
|
|
313
429
|
private storageKey;
|
|
314
430
|
private unresponsiveTimer;
|
|
431
|
+
private reconnectProbeTimer;
|
|
315
432
|
private failedReconnects;
|
|
316
433
|
private walletPresent;
|
|
317
434
|
private pendingRestore;
|
|
318
435
|
private messageQueue;
|
|
436
|
+
private outboundQueue;
|
|
319
437
|
private static MAX_RECONNECT_FAILURES;
|
|
320
438
|
constructor(options: {
|
|
321
439
|
dappMetadata: DAppMetadata;
|
|
322
|
-
relayUrl?: string;
|
|
323
|
-
chainId?: string;
|
|
324
|
-
storageKey?: string;
|
|
440
|
+
relayUrl?: string | undefined;
|
|
441
|
+
chainId?: string | undefined;
|
|
442
|
+
storageKey?: string | undefined;
|
|
325
443
|
});
|
|
326
444
|
private setupSocketListeners;
|
|
327
445
|
private setupKeyExchangeListeners;
|
|
@@ -335,6 +453,30 @@ declare class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
|
|
|
335
453
|
* Returns false if there is nothing to restore.
|
|
336
454
|
*/
|
|
337
455
|
reconnect(): Promise<boolean>;
|
|
456
|
+
/**
|
|
457
|
+
* (Re)open the socket, join the persisted channel, drain buffered relay
|
|
458
|
+
* messages, and settle status. Shared by the cold-restore reconnect() and
|
|
459
|
+
* the warm resume() path whose socket was torn down by the reconnect probe.
|
|
460
|
+
* Assumes channelId and a hydrated keyExchange are already in place, and
|
|
461
|
+
* that the caller has reset walletPresent + set RECONNECTING status.
|
|
462
|
+
*/
|
|
463
|
+
private joinAndSettle;
|
|
464
|
+
/**
|
|
465
|
+
* Nudge the connection back to life after the dApp tab / wallet app was
|
|
466
|
+
* backgrounded. Idempotent and safe to call from visibilitychange / online
|
|
467
|
+
* / pageshow handlers. If a restored session has not yet been hydrated,
|
|
468
|
+
* runs the full reconnect(); otherwise just re-opens the socket, whose
|
|
469
|
+
* own connect handler re-joins the channel and drains the relay buffer.
|
|
470
|
+
*/
|
|
471
|
+
resume(): void;
|
|
472
|
+
/**
|
|
473
|
+
* A session was terminated for good (wallet sent a relay 'close', or the
|
|
474
|
+
* join ack reported a tombstone). Clear local state and surface
|
|
475
|
+
* DISCONNECTED so the consumer drops to a fresh-pairing UI.
|
|
476
|
+
*/
|
|
477
|
+
private handleSessionTerminated;
|
|
478
|
+
private armReconnectProbe;
|
|
479
|
+
private clearReconnectProbe;
|
|
338
480
|
/**
|
|
339
481
|
* Send a JSON-RPC request to the wallet (async, fire-and-forget).
|
|
340
482
|
*/
|
|
@@ -365,7 +507,16 @@ declare class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
|
|
|
365
507
|
private handleSynAck;
|
|
366
508
|
private handleDecryptedMessage;
|
|
367
509
|
private sendPlaintext;
|
|
510
|
+
/**
|
|
511
|
+
* Serialize every encrypt+persist+send on a single outbound queue.
|
|
512
|
+
* Callers like sendJsonRpc() are fire-and-forget, so without the queue two
|
|
513
|
+
* rapid provider.request() calls would interleave inside encryptMessage()
|
|
514
|
+
* across its await and could complete out of order; the receiver's
|
|
515
|
+
* contiguous-seq check would then drop the late one. (Nonce reuse itself is
|
|
516
|
+
* already prevented by the synchronous seq reservation in KeyExchange.)
|
|
517
|
+
*/
|
|
368
518
|
private sendEncrypted;
|
|
519
|
+
private sendEncryptedNow;
|
|
369
520
|
private startUnresponsiveTimer;
|
|
370
521
|
private clearUnresponsiveTimer;
|
|
371
522
|
private setStatus;
|
|
@@ -384,7 +535,7 @@ interface SocketClientEvents {
|
|
|
384
535
|
message: (data: RelayMessage) => void;
|
|
385
536
|
connected: () => void;
|
|
386
537
|
disconnected: (reason: string) => void;
|
|
387
|
-
reconnected: () => void;
|
|
538
|
+
reconnected: (result: JoinResult) => void;
|
|
388
539
|
participants_changed: (data: {
|
|
389
540
|
event: string;
|
|
390
541
|
clientType?: string;
|
|
@@ -396,9 +547,21 @@ interface JoinResult {
|
|
|
396
547
|
/**
|
|
397
548
|
* Base64-encoded KEM public key the relay has bound to this channel.
|
|
398
549
|
* Populated for wallet joins (v2 protocol). `null` if the dApp hasn't
|
|
399
|
-
* registered a PK yet
|
|
550
|
+
* registered a PK yet - wallet callers must treat this as a retry signal.
|
|
400
551
|
*/
|
|
401
552
|
channelPublicKey: string | null;
|
|
553
|
+
/**
|
|
554
|
+
* Client types of the OTHER participants already in the channel at join
|
|
555
|
+
* time (e.g. `['wallet']` or `[]`). Lets a (re)joining peer detect an
|
|
556
|
+
* absent counterparty immediately instead of waiting on a future
|
|
557
|
+
* participants_changed event. Empty array on older relays.
|
|
558
|
+
*/
|
|
559
|
+
participants: string[];
|
|
560
|
+
/**
|
|
561
|
+
* True if the channel was explicitly closed (a terminated tombstone). The
|
|
562
|
+
* peer should drop its stored session rather than wait or re-pair.
|
|
563
|
+
*/
|
|
564
|
+
terminated: boolean;
|
|
402
565
|
}
|
|
403
566
|
declare class SocketClient extends EventEmitter<SocketClientEvents> {
|
|
404
567
|
private socket;
|
|
@@ -449,6 +612,100 @@ declare class SocketClient extends EventEmitter<SocketClientEvents> {
|
|
|
449
612
|
getChannelId(): string | null;
|
|
450
613
|
}
|
|
451
614
|
|
|
615
|
+
/**
|
|
616
|
+
* Per-scheme domain-separation tags + version strings.
|
|
617
|
+
*
|
|
618
|
+
* The tag bytes are mixed into both:
|
|
619
|
+
* 1. The SHAKE256 preimage that produces the signed digest (so the digest
|
|
620
|
+
* itself commits to which scheme is in use), and
|
|
621
|
+
* 2. The ML-DSA-87 `ctx` parameter (so the signature verifier rejects
|
|
622
|
+
* cross-scheme replay even if a digest collision were ever found).
|
|
623
|
+
*
|
|
624
|
+
* Both stay well under FIPS 204's 255-byte ctx cap.
|
|
625
|
+
*
|
|
626
|
+
* NOTE: This file is byte-identical with the wallet's
|
|
627
|
+
* `myqrlwallet-frontend/src/utils/signing/ctx.ts`. Any divergence is a
|
|
628
|
+
* cross-repo bug that will surface as fixture mismatches in both test
|
|
629
|
+
* suites; keep them in lock-step.
|
|
630
|
+
*/
|
|
631
|
+
declare const SCHEME_VERSION_MSG = "QRL-SIGN-MSG-v1";
|
|
632
|
+
declare const SCHEME_VERSION_TYPED = "QRL-SIGN-TYPED-v1";
|
|
633
|
+
declare const SCHEME_TAG_MSG: Uint8Array;
|
|
634
|
+
declare const SCHEME_TAG_TYPED: Uint8Array;
|
|
635
|
+
/** SHAKE256 output length used throughout the signing module (NIST L5-matched). */
|
|
636
|
+
declare const DIGEST_LEN = 64;
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Pure SHAKE256 digest for `qrl_signMessage` v1.
|
|
640
|
+
*
|
|
641
|
+
* digest = SHAKE256("QRL-SIGN-MSG-v1" || messageBytes, 64)
|
|
642
|
+
*
|
|
643
|
+
* The scheme tag is committed into the preimage so a signature produced for
|
|
644
|
+
* this scheme cannot be re-interpreted as belonging to typed-data signing
|
|
645
|
+
* (or vice versa) even if the `ctx` parameter were ever stripped.
|
|
646
|
+
*/
|
|
647
|
+
declare function computeMessageDigest(messageBytes: Uint8Array): Uint8Array;
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* EIP-712-shaped typed-data encoding for `qrl_signTypedData` v1.
|
|
651
|
+
*
|
|
652
|
+
* Byte-identical algorithm with the wallet's signing/typedData.ts; this
|
|
653
|
+
* file is the SDK port (only the import block differs: the SDK routes
|
|
654
|
+
* SHAKE256 through src/crypto/primitives.ts, its crypto boundary). See
|
|
655
|
+
* the wallet copy for the spec-level comments; behavior must stay in
|
|
656
|
+
* lock-step or the cross-repo parity test fails on next CI.
|
|
657
|
+
*/
|
|
658
|
+
type FieldType = string;
|
|
659
|
+
interface TypedField {
|
|
660
|
+
name: string;
|
|
661
|
+
type: FieldType;
|
|
662
|
+
}
|
|
663
|
+
type StructDef = readonly TypedField[];
|
|
664
|
+
type TypeMap = Record<string, StructDef>;
|
|
665
|
+
type Domain = Record<string, unknown>;
|
|
666
|
+
type Message = Record<string, unknown>;
|
|
667
|
+
interface TypedDataPayload {
|
|
668
|
+
types: TypeMap;
|
|
669
|
+
primaryType: string;
|
|
670
|
+
domain: Domain;
|
|
671
|
+
message: Message;
|
|
672
|
+
}
|
|
673
|
+
declare function encodeType(primary: string, types: TypeMap): string;
|
|
674
|
+
declare function typeHash(primary: string, types: TypeMap): Uint8Array;
|
|
675
|
+
declare function encodeField(type: FieldType, value: unknown, types: TypeMap): Uint8Array;
|
|
676
|
+
declare function hashStruct(primary: string, data: Message, types: TypeMap): Uint8Array;
|
|
677
|
+
declare function computeTypedDataDigest(payload: TypedDataPayload): Uint8Array;
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Stateless verifiers for the two PQ signing schemes. The SDK exposes these
|
|
681
|
+
* so a dApp can re-verify the rich response object returned by the wallet
|
|
682
|
+
* without round-tripping back through the relay. They never touch a secret
|
|
683
|
+
* key and never derive an address; that's the wallet's job.
|
|
684
|
+
*/
|
|
685
|
+
|
|
686
|
+
interface VerifyMessageParams {
|
|
687
|
+
signature: Uint8Array | string;
|
|
688
|
+
publicKey: Uint8Array | string;
|
|
689
|
+
/** 0x-hex bytes that were originally signed. */
|
|
690
|
+
messageBytes: Uint8Array | string;
|
|
691
|
+
}
|
|
692
|
+
declare function verifyMessage({ signature, publicKey, messageBytes, }: VerifyMessageParams): boolean;
|
|
693
|
+
interface VerifyTypedDataParams {
|
|
694
|
+
signature: Uint8Array | string;
|
|
695
|
+
publicKey: Uint8Array | string;
|
|
696
|
+
payload: TypedDataPayload;
|
|
697
|
+
}
|
|
698
|
+
declare function verifyTypedData({ signature, publicKey, payload }: VerifyTypedDataParams): boolean;
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Local hex/bytes utilities for the signing module.
|
|
702
|
+
*
|
|
703
|
+
* Byte-identical with the wallet's signing/bytes.ts.
|
|
704
|
+
*/
|
|
705
|
+
declare function hexToBytes(hex: string): Uint8Array;
|
|
706
|
+
declare function bytesToHex(bytes: Uint8Array): string;
|
|
707
|
+
declare function concatBytes(...parts: Uint8Array[]): Uint8Array;
|
|
708
|
+
|
|
452
709
|
/**
|
|
453
710
|
* v2 QR URI codec (PQP2).
|
|
454
711
|
*
|
|
@@ -471,7 +728,7 @@ declare class SocketClient extends EventEmitter<SocketClientEvents> {
|
|
|
471
728
|
* substitution of a maliciously-crafted PK with the same fingerprint.
|
|
472
729
|
*
|
|
473
730
|
* Legacy v2.0 URIs (magic=PQP1, 1208-byte blob with embedded PK) are
|
|
474
|
-
* rejected with a clear error by parseConnectionURI
|
|
731
|
+
* rejected with a clear error by parseConnectionURI - this is a hard
|
|
475
732
|
* break before 2.0.0 ships, no backcompat.
|
|
476
733
|
*/
|
|
477
734
|
declare const CID_LEN = 16;
|
|
@@ -490,18 +747,18 @@ declare function computeFingerprint(cid: Uint8Array, pk: Uint8Array): Promise<Ui
|
|
|
490
747
|
declare function fingerprintEquals(a: Uint8Array, b: Uint8Array): boolean;
|
|
491
748
|
/**
|
|
492
749
|
* Encode (cid, pk) as a qrlconnect:// URI. Note the PK is not stored in the
|
|
493
|
-
* URI
|
|
750
|
+
* URI - we compute its fingerprint and embed only that. The caller must
|
|
494
751
|
* upload the PK to the relay separately before publishing this URI.
|
|
495
752
|
*
|
|
496
753
|
* The optional `relayUrl` rides as a sibling query param (not inside the
|
|
497
754
|
* fp-bound blob) so a tampered relay can cause the pairing to fail but
|
|
498
|
-
* cannot substitute the PK
|
|
755
|
+
* cannot substitute the PK - the fp still pins that.
|
|
499
756
|
*/
|
|
500
757
|
declare function generateConnectionURI(cid: Uint8Array, pk: Uint8Array, relayUrl?: string): Promise<string>;
|
|
501
758
|
interface ParsedURI {
|
|
502
759
|
cid: Uint8Array;
|
|
503
760
|
fp: Uint8Array;
|
|
504
|
-
relayUrl?: string;
|
|
761
|
+
relayUrl?: string | undefined;
|
|
505
762
|
}
|
|
506
763
|
declare function parseConnectionURI(uri: string): Promise<ParsedURI>;
|
|
507
764
|
/** Convert 16 raw cid bytes to RFC 4122 UUID hex string. */
|
|
@@ -523,9 +780,19 @@ declare function getAppStoreUrl(): string;
|
|
|
523
780
|
|
|
524
781
|
declare const DEFAULT_RELAY_URL = "https://qrlwallet.com";
|
|
525
782
|
declare const PROTOCOL_VERSION = 2;
|
|
526
|
-
/**
|
|
783
|
+
/**
|
|
784
|
+
* RPC methods that require user approval in the wallet.
|
|
785
|
+
*
|
|
786
|
+
* v3.0.0 replaces the Ethereum-flavored signing surface with two
|
|
787
|
+
* post-quantum-native methods: `qrl_signMessage` for opaque bytes and
|
|
788
|
+
* `qrl_signTypedData` for structured payloads (EIP-712-shaped, but with
|
|
789
|
+
* SHAKE256 + native Dilithium ctx). The legacy methods (`personal_sign`,
|
|
790
|
+
* `qrl_sign`, `qrl_signTypedData_v3`, `qrl_signTypedData_v4`) are no
|
|
791
|
+
* longer accepted; a dApp calling them via this SDK will get a
|
|
792
|
+
* "method not supported" error before the relay round-trip.
|
|
793
|
+
*/
|
|
527
794
|
declare const RESTRICTED_METHODS: Set<string>;
|
|
528
795
|
/** RPC methods that can be auto-proxied without approval */
|
|
529
796
|
declare const UNRESTRICTED_METHODS: Set<string>;
|
|
530
797
|
|
|
531
|
-
export { type AckMessage, BLOB_LEN, CID_LEN, ConnectionManager, ConnectionStatus, type DAppMetadata, type DAppSession, DEFAULT_RELAY_URL, FP_LEN, type JsonRpcRequest, type JsonRpcResponse, KeyExchange, KeyExchangeMessageType, MessageType, PROTOCOL_VERSION, type ParsedURI, type PendingRequest, type PersistedSession, type ProviderEvents, QRLConnectProvider as QRLConnect, type QRLConnectOptions, QRLConnectProvider, RESTRICTED_METHODS, type RelayMessage, type Session, SocketClient, type SynAckMessage, UNRESTRICTED_METHODS, cidFromString, cidRandom, cidToString, computeFingerprint, fingerprintEquals, generateConnectionURI, getAppStoreUrl, isMobileBrowser, parseConnectionURI };
|
|
798
|
+
export { type AckMessage, BLOB_LEN, CID_LEN, ConnectionManager, ConnectionStatus, type DAppMetadata, type DAppSession, DEFAULT_RELAY_URL, DIGEST_LEN, type Domain, type EIP6963ProviderInfoOverride, FP_LEN, type JsonRpcRequest, type JsonRpcResponse, KeyExchange, KeyExchangeMessageType, type Message, MessageType, PROTOCOL_VERSION, type ParsedURI, type PendingRequest, type PersistedSession, type ProviderEvents, QRLConnectProvider as QRLConnect, type QRLConnectOptions, QRLConnectProvider, QRL_CONNECT_PROVIDER_INFO, type QrlSignMessageParams, type QrlSignTypedDataParams, type QrlSignedResult, type QrlSignedTypedDataResult, type QrlTypedDataPayload, RESTRICTED_METHODS, type RelayMessage, SCHEME_TAG_MSG, SCHEME_TAG_TYPED, SCHEME_VERSION_MSG, SCHEME_VERSION_TYPED, type Session, SocketClient, type StructDef, type SynAckMessage, type TypeMap, type TypedDataPayload, type TypedField, UNRESTRICTED_METHODS, type VerifyMessageParams, type VerifyTypedDataParams, bytesToHex, cidFromString, cidRandom, cidToString, computeFingerprint, computeMessageDigest, computeTypedDataDigest, concatBytes, encodeField, encodeType, fingerprintEquals, generateConnectionURI, getAppStoreUrl, hashStruct, hexToBytes, isMobileBrowser, parseConnectionURI, typeHash, verifyMessage, verifyTypedData };
|