@qrlwallet/connect 5.0.3 → 5.1.1

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 CHANGED
@@ -9,8 +9,9 @@ Account validation and message-signature verification use the complete 64-byte
9
9
  address. Applications using legacy 20-byte addresses must remain on version 4
10
10
  until their network and wallet support QIP-55.
11
11
 
12
- Wallet typed-data requests are disabled pending a versioned 64-byte address
13
- encoding. The local verifier remains available for address-free typed data.
12
+ `qrl_signTypedData` signs payloads with QIP-55 address fields under
13
+ `QRL-SIGN-TYPED-v2` (one 64-byte word per value); address-free payloads keep
14
+ `QRL-SIGN-TYPED-v1`. See docs/JSON-RPC-REFERENCE.md.
14
15
  The private v3 network is a test network; its availability does not establish
15
16
  compatibility with legacy deployments or contracts.
16
17
 
@@ -173,16 +174,16 @@ The main class. Creates a connection manager and EIP-1193 provider.
173
174
  **Require user approval:**
174
175
  `qrl_requestAccounts`, `qrl_sendTransaction`, `qrl_signTransaction`, `qrl_signMessage`, `qrl_signTypedData`, `wallet_switchQrlChain`
175
176
 
176
- `qrl_signMessage` uses SHAKE256 plus native ML-DSA-87 ctx and returns a rich `{ signature, publicKey, descriptor, signer, digest, schemeVersion }` object. During the QIP-55 port, `qrl_signTypedData` stays in the approval policy and fails locally before relay use. Its v1 encoding fixes addresses to a 32-byte slot, so a new 64-byte encoding needs a new scheme version and regenerated wallet parity vectors.
177
+ `qrl_signMessage` and `qrl_signTypedData` use SHAKE256 plus native ML-DSA-87 ctx and return a rich `{ signature, publicKey, descriptor, signer, digest, schemeVersion }` object (typed data also echoes `domain`). Typed data with QIP-55 address fields is signed under `QRL-SIGN-TYPED-v2`, address-free typed data under `QRL-SIGN-TYPED-v1`.
177
178
 
178
179
  `request()` returns `unknown`. First validate the exact response shape with
179
180
  `isQrlSignedMessageResult` or `isQrlSignedTypedDataResult`, then require
180
181
  `hasSigningDescriptor`. PQP3 authenticates the paired transport session. It
181
182
  does not prove that the returned ML-DSA signature is valid or that its public
182
183
  key belongs to the claimed signer. Authentication and authorization flows must
183
- call `verifyMessageForSigner` or the historical v1 `verifyTypedDataForSigner`
184
- with the original challenge or payload and the expected QIP-55 Q + 128 hex
185
- address.
184
+ call `verifyMessageForSigner` or `verifyTypedDataForSigner` (pass the
185
+ response's `schemeVersion`) with the original challenge or payload and the
186
+ expected QIP-55 Q + 128 hex address.
186
187
 
187
188
  The lower-level `verifyMessageSignature` / `verifyTypedDataSignature` helpers
188
189
  verify only the supplied key and signature; they do not prove that the key
package/dist/index.d.mts CHANGED
@@ -269,8 +269,8 @@ interface EIP6963ProviderInfoOverride {
269
269
  rdns?: string;
270
270
  }
271
271
  /**
272
- * Rich response object returned by `qrl_signMessage` and retained for locked
273
- * `qrl_signTypedData` v1 fixtures. The signature alone is not enough to
272
+ * Rich response object returned by `qrl_signMessage` and
273
+ * `qrl_signTypedData`. The signature alone is not enough to
274
274
  * verify since ML-DSA-87 public keys cannot be recovered from a signature,
275
275
  * so the wallet returns the public key explicitly. Stateless verifiers need
276
276
  * the original payload plus the signature fields below.
@@ -290,24 +290,26 @@ interface QrlSignedResult {
290
290
  signer: string;
291
291
  /** 0x-hex of the 64-byte SHAKE256 digest that was signed. */
292
292
  digest: string;
293
- /** Scheme tag: 'QRL-SIGN-MSG-v1' or 'QRL-SIGN-TYPED-v1'. */
293
+ /** Scheme tag: 'QRL-SIGN-MSG-v1', 'QRL-SIGN-TYPED-v1' or 'QRL-SIGN-TYPED-v2'. */
294
294
  schemeVersion: QrlSigningSchemeVersion;
295
295
  }
296
296
  /** A current wallet response whose descriptor can be signer-bound. */
297
297
  interface QrlSignedResultWithDescriptor extends QrlSignedResult {
298
298
  descriptor: string;
299
299
  }
300
- type QrlSigningSchemeVersion = 'QRL-SIGN-MSG-v1' | 'QRL-SIGN-TYPED-v1';
300
+ type QrlSigningSchemeVersion = 'QRL-SIGN-MSG-v1' | 'QRL-SIGN-TYPED-v1' | 'QRL-SIGN-TYPED-v2';
301
301
  /** Strict wire shape returned by `qrl_signMessage`. */
302
302
  interface QrlSignedMessageResult extends QrlSignedResult {
303
303
  schemeVersion: 'QRL-SIGN-MSG-v1';
304
304
  }
305
305
  /**
306
- * Historical v1 response from `qrl_signTypedData`. It echoes `domain` so a
307
- * stateless verifier does not need to be told the domain out-of-band.
306
+ * Response from `qrl_signTypedData`. It echoes `domain` so a stateless
307
+ * verifier does not need to be told the domain out-of-band. The scheme is
308
+ * v2 when the payload's types reach an `address` field and v1 otherwise;
309
+ * pass `schemeVersion` to `verifyTypedDataForSigner` to have it checked.
308
310
  */
309
311
  interface QrlSignedTypedDataResult extends QrlSignedResult {
310
- schemeVersion: 'QRL-SIGN-TYPED-v1';
312
+ schemeVersion: 'QRL-SIGN-TYPED-v1' | 'QRL-SIGN-TYPED-v2';
311
313
  domain: Record<string, unknown>;
312
314
  }
313
315
  /** Every strict signing-result wire shape understood by this SDK. */
@@ -338,10 +340,9 @@ declare function hasSigningDescriptor(result: unknown): result is QrlSigningResu
338
340
  */
339
341
  type QrlSignMessageParams = [string, string];
340
342
  /**
341
- * Reserved `qrl_signTypedData` params: `[signer, payload]`. This interface
342
- * describes the historical v1 payload retained by the verifier exports. The
343
- * QIP-55 provider rejects requests until a versioned 64-byte encoding is
344
- * defined.
343
+ * `qrl_signTypedData` params: `[signer, payload]`. A payload whose types
344
+ * reach an `address` field is signed under QRL-SIGN-TYPED-v2, any other
345
+ * under v1.
345
346
  */
346
347
  interface QrlTypedDataPayload {
347
348
  types: Record<string, readonly {
@@ -870,8 +871,17 @@ declare class SocketClient extends EventEmitter<SocketClientEvents> {
870
871
  */
871
872
  declare const SCHEME_VERSION_MSG = "QRL-SIGN-MSG-v1";
872
873
  declare const SCHEME_VERSION_TYPED = "QRL-SIGN-TYPED-v1";
874
+ /**
875
+ * Typed data with 64-byte slots, one QRVM word per atomic value, so a QIP-55
876
+ * address fits. A payload uses it exactly when an `address` type is
877
+ * reachable from QRLDomain or the primary type; every other payload keeps
878
+ * v1. See typedData.ts.
879
+ */
880
+ declare const SCHEME_VERSION_TYPED_V2 = "QRL-SIGN-TYPED-v2";
881
+ type TypedDataSchemeVersion = typeof SCHEME_VERSION_TYPED | typeof SCHEME_VERSION_TYPED_V2;
873
882
  declare const SCHEME_TAG_MSG: Uint8Array;
874
883
  declare const SCHEME_TAG_TYPED: Uint8Array;
884
+ declare const SCHEME_TAG_TYPED_V2: Uint8Array;
875
885
  /** SHAKE256 output length used throughout the signing module (NIST L5-matched). */
876
886
  declare const DIGEST_LEN = 64;
877
887
 
@@ -887,7 +897,7 @@ declare const DIGEST_LEN = 64;
887
897
  declare function computeMessageDigest(messageBytes: Uint8Array): Uint8Array;
888
898
 
889
899
  /**
890
- * Historical EIP-712-shaped typed-data encoding for `qrl_signTypedData` v1.
900
+ * EIP-712-shaped typed-data encoding for `qrl_signTypedData`.
891
901
  *
892
902
  * Byte-identical algorithm with the wallet's signing/typedData.ts; this
893
903
  * file is the SDK port (only the import block differs: the SDK routes
@@ -895,10 +905,19 @@ declare function computeMessageDigest(messageBytes: Uint8Array): Uint8Array;
895
905
  * the wallet copy for the spec-level comments; behavior must stay in
896
906
  * lock-step or the cross-repo parity test fails on next CI.
897
907
  *
898
- * The v1 address slot is 32 bytes. QIP-55 address fields fail closed until a
899
- * 64-byte encoding receives a new scheme tag and lockstep wallet fixtures.
900
- * Address-free digests retain their existing encoding.
908
+ * Two schemes share this codec and differ only in the atomic slot size:
909
+ * - QRL-SIGN-TYPED-v1: 32-byte slots, the original layout.
910
+ * - QRL-SIGN-TYPED-v2: 64-byte slots, one QRVM word per atomic value, so a
911
+ * 64-byte QIP-55 address fits one slot. Integers are zero- or
912
+ * sign-extended over 512 bits, bool and address are left-padded, bytesN
913
+ * is right-padded.
914
+ * Strings, bytes, arrays, structs and type hashes are 64-byte SHAKE256
915
+ * digests in both. A payload uses v2 exactly when an `address` type
916
+ * (including address arrays) is reachable from QRLDomain or the primary
917
+ * type, so address-free payloads keep their v1 digests and older verifiers
918
+ * keep working for them.
901
919
  */
920
+
902
921
  declare const TYPED_DATA_LIMITS: Readonly<{
903
922
  maxTypes: 32;
904
923
  maxFieldsPerType: 32;
@@ -928,8 +947,25 @@ interface TypedDataPayload {
928
947
  }
929
948
  declare function encodeType(primary: string, types: TypeMap): string;
930
949
  declare function typeHash(primary: string, types: TypeMap): Uint8Array;
931
- declare function encodeField(type: FieldType, value: unknown, types: TypeMap): Uint8Array;
932
- declare function hashStruct(primary: string, data: Message, types: TypeMap): Uint8Array;
950
+ /**
951
+ * Encode one field. The scheme defaults to the one `types` selects (v2 when
952
+ * any struct has an address field), which matches computeTypedDataDigest
953
+ * when `types` is a payload's full type map.
954
+ */
955
+ declare function encodeField(type: FieldType, value: unknown, types: TypeMap, schemeVersion?: TypedDataSchemeVersion): Uint8Array;
956
+ /**
957
+ * Hash one struct. The scheme defaults to the one `types` selects (v2 when
958
+ * any struct has an address field), which matches computeTypedDataDigest
959
+ * when `types` is a payload's full type map.
960
+ */
961
+ declare function hashStruct(primary: string, data: Message, types: TypeMap, schemeVersion?: TypedDataSchemeVersion): Uint8Array;
962
+ /**
963
+ * The scheme a payload is signed and verified under. It follows from the
964
+ * payload's types alone, so wallet and verifier agree without negotiating.
965
+ */
966
+ declare function typedDataSchemeVersion(payload: unknown): TypedDataSchemeVersion;
967
+ /** The digest-preimage and ML-DSA-87 ctx tag of a typed-data scheme. */
968
+ declare function typedDataSchemeTag(schemeVersion: TypedDataSchemeVersion): Uint8Array;
933
969
  declare function computeTypedDataDigest(payload: unknown): Uint8Array;
934
970
 
935
971
  /**
@@ -961,13 +997,18 @@ interface VerifyTypedDataParams {
961
997
  signature: Uint8Array | string;
962
998
  publicKey: Uint8Array | string;
963
999
  payload: TypedDataPayload;
1000
+ /**
1001
+ * The `schemeVersion` from the wallet response. Optional: the payload's
1002
+ * types decide the scheme, and a supplied value must match it.
1003
+ */
1004
+ schemeVersion?: string | undefined;
964
1005
  }
965
1006
  /**
966
1007
  * Verify against an explicitly supplied ML-DSA public key only. This does not
967
1008
  * bind that key to a Q-address. Use verifyTypedDataForSigner when signer
968
1009
  * identity matters.
969
1010
  */
970
- declare function verifyTypedDataSignature({ signature, publicKey, payload, }: VerifyTypedDataParams): boolean;
1011
+ declare function verifyTypedDataSignature({ signature, publicKey, payload, schemeVersion, }: VerifyTypedDataParams): boolean;
971
1012
  interface VerifyMessageForSignerParams extends VerifyMessageParams {
972
1013
  /** QIP-55 Q + 128 hex address expected by the dApp. */
973
1014
  expectedSigner: string;
@@ -983,7 +1024,7 @@ interface VerifyTypedDataForSignerParams extends VerifyTypedDataParams {
983
1024
  descriptor?: Uint8Array | string | undefined;
984
1025
  }
985
1026
  /** Verify both the typed-data signature and public-key-to-signer binding. */
986
- declare function verifyTypedDataForSigner({ expectedSigner, descriptor, signature, publicKey, payload, }: VerifyTypedDataForSignerParams): boolean;
1027
+ declare function verifyTypedDataForSigner({ expectedSigner, descriptor, signature, publicKey, payload, schemeVersion, }: VerifyTypedDataForSignerParams): boolean;
987
1028
  /**
988
1029
  * @deprecated Use verifyMessageSignature for a key-only check, or
989
1030
  * verifyMessageForSigner when signer identity matters.
@@ -1135,4 +1176,4 @@ declare function isValidJsonRpcMethod(value: unknown): value is string;
1135
1176
  */
1136
1177
  declare function classifyRpcMethod(method: string): RpcMethodPolicy;
1137
1178
 
1138
- export { type AckMessage, BLOB_LEN, CAP_LEN, CID_LEN, ConnectionManager, ConnectionStatus, type DAppMetadata, type DAppSession, DEFAULT_RELAY_URL, DIGEST_LEN, type Domain, type EIP6963ProviderInfoOverride, EXPLICITLY_UNSUPPORTED_METHODS, FP_LEN, type InitiatedKeyExchange, type JsonRpcRequest, type JsonRpcResponse, KeyExchange, KeyExchangeMessageType, MAX_CONNECTION_URI_LENGTH, MAX_JSON_RPC_ID_LENGTH, MAX_JSON_RPC_METHOD_LENGTH, MAX_RELAY_URL_LENGTH, ML_DSA_87_PUBLIC_KEY_BYTES, ML_DSA_87_SIGNATURE_BYTES, ML_DSA_DESCRIPTOR_BYTES, type Message, MessageType, PAIRING_CAPABILITY_LEN, PROTOCOL_VERSION, type ParsedURI, type PendingRequest, type PersistedSession, type ProviderEvents, QRLConnectProvider as QRLConnect, type QRLConnectOptions, QRLConnectProvider, QRL_ADDRESS_BYTES, QRL_ADDRESS_HEX_LENGTH, QRL_CONNECT_PROVIDER_INFO, type QrlSignMessageParams, type QrlSignTypedDataParams, type QrlSignedMessageResult, type QrlSignedResult, type QrlSignedResultWithDescriptor, type QrlSignedTypedDataResult, type QrlSigningResult, type QrlSigningSchemeVersion, type QrlTypedDataPayload, RESTRICTED_METHODS, type RelayMessage, type RpcMethodPolicy, SCHEME_TAG_MSG, SCHEME_TAG_TYPED, SCHEME_VERSION_MSG, SCHEME_VERSION_TYPED, type Session, SocketClient, type StructDef, type SynAckMessage, TYPED_DATA_LIMITS, type TypeMap, type TypedDataPayload, type TypedField, UNRESTRICTED_METHODS, type VerifyMessageForSignerParams, type VerifyMessageParams, type VerifyTypedDataForSignerParams, type VerifyTypedDataParams, attemptWalletRedirect, bytesToHex, cidFromString, cidRandom, cidToString, classifyRpcMethod, computeFingerprint, computeMessageDigest, computeTypedDataDigest, concatBytes, encodeField, encodeType, fingerprintEquals, formatQrlAddressFingerprint, generateConnectionURI, getAppStoreUrl, hasSigningDescriptor, hashStruct, hexToBytes, isCurrentQrlAddress, isMobileBrowser, isQrlSignedMessageResult, isQrlSignedResult, isQrlSignedTypedDataResult, isValidJsonRpcId, isValidJsonRpcMethod, normalizeRelayUrl, parseConnectionURI, qip55AddressFromBytes, typeHash, verifyMessage, verifyMessageForSigner, verifyMessageSignature, verifyTypedData, verifyTypedDataForSigner, verifyTypedDataSignature };
1179
+ export { type AckMessage, BLOB_LEN, CAP_LEN, CID_LEN, ConnectionManager, ConnectionStatus, type DAppMetadata, type DAppSession, DEFAULT_RELAY_URL, DIGEST_LEN, type Domain, type EIP6963ProviderInfoOverride, EXPLICITLY_UNSUPPORTED_METHODS, FP_LEN, type InitiatedKeyExchange, type JsonRpcRequest, type JsonRpcResponse, KeyExchange, KeyExchangeMessageType, MAX_CONNECTION_URI_LENGTH, MAX_JSON_RPC_ID_LENGTH, MAX_JSON_RPC_METHOD_LENGTH, MAX_RELAY_URL_LENGTH, ML_DSA_87_PUBLIC_KEY_BYTES, ML_DSA_87_SIGNATURE_BYTES, ML_DSA_DESCRIPTOR_BYTES, type Message, MessageType, PAIRING_CAPABILITY_LEN, PROTOCOL_VERSION, type ParsedURI, type PendingRequest, type PersistedSession, type ProviderEvents, QRLConnectProvider as QRLConnect, type QRLConnectOptions, QRLConnectProvider, QRL_ADDRESS_BYTES, QRL_ADDRESS_HEX_LENGTH, QRL_CONNECT_PROVIDER_INFO, type QrlSignMessageParams, type QrlSignTypedDataParams, type QrlSignedMessageResult, type QrlSignedResult, type QrlSignedResultWithDescriptor, type QrlSignedTypedDataResult, type QrlSigningResult, type QrlSigningSchemeVersion, type QrlTypedDataPayload, RESTRICTED_METHODS, type RelayMessage, type RpcMethodPolicy, SCHEME_TAG_MSG, SCHEME_TAG_TYPED, SCHEME_TAG_TYPED_V2, SCHEME_VERSION_MSG, SCHEME_VERSION_TYPED, SCHEME_VERSION_TYPED_V2, type Session, SocketClient, type StructDef, type SynAckMessage, TYPED_DATA_LIMITS, type TypeMap, type TypedDataPayload, type TypedDataSchemeVersion, type TypedField, UNRESTRICTED_METHODS, type VerifyMessageForSignerParams, type VerifyMessageParams, type VerifyTypedDataForSignerParams, type VerifyTypedDataParams, attemptWalletRedirect, bytesToHex, cidFromString, cidRandom, cidToString, classifyRpcMethod, computeFingerprint, computeMessageDigest, computeTypedDataDigest, concatBytes, encodeField, encodeType, fingerprintEquals, formatQrlAddressFingerprint, generateConnectionURI, getAppStoreUrl, hasSigningDescriptor, hashStruct, hexToBytes, isCurrentQrlAddress, isMobileBrowser, isQrlSignedMessageResult, isQrlSignedResult, isQrlSignedTypedDataResult, isValidJsonRpcId, isValidJsonRpcMethod, normalizeRelayUrl, parseConnectionURI, qip55AddressFromBytes, typeHash, typedDataSchemeTag, typedDataSchemeVersion, verifyMessage, verifyMessageForSigner, verifyMessageSignature, verifyTypedData, verifyTypedDataForSigner, verifyTypedDataSignature };
package/dist/index.d.ts CHANGED
@@ -269,8 +269,8 @@ interface EIP6963ProviderInfoOverride {
269
269
  rdns?: string;
270
270
  }
271
271
  /**
272
- * Rich response object returned by `qrl_signMessage` and retained for locked
273
- * `qrl_signTypedData` v1 fixtures. The signature alone is not enough to
272
+ * Rich response object returned by `qrl_signMessage` and
273
+ * `qrl_signTypedData`. The signature alone is not enough to
274
274
  * verify since ML-DSA-87 public keys cannot be recovered from a signature,
275
275
  * so the wallet returns the public key explicitly. Stateless verifiers need
276
276
  * the original payload plus the signature fields below.
@@ -290,24 +290,26 @@ interface QrlSignedResult {
290
290
  signer: string;
291
291
  /** 0x-hex of the 64-byte SHAKE256 digest that was signed. */
292
292
  digest: string;
293
- /** Scheme tag: 'QRL-SIGN-MSG-v1' or 'QRL-SIGN-TYPED-v1'. */
293
+ /** Scheme tag: 'QRL-SIGN-MSG-v1', 'QRL-SIGN-TYPED-v1' or 'QRL-SIGN-TYPED-v2'. */
294
294
  schemeVersion: QrlSigningSchemeVersion;
295
295
  }
296
296
  /** A current wallet response whose descriptor can be signer-bound. */
297
297
  interface QrlSignedResultWithDescriptor extends QrlSignedResult {
298
298
  descriptor: string;
299
299
  }
300
- type QrlSigningSchemeVersion = 'QRL-SIGN-MSG-v1' | 'QRL-SIGN-TYPED-v1';
300
+ type QrlSigningSchemeVersion = 'QRL-SIGN-MSG-v1' | 'QRL-SIGN-TYPED-v1' | 'QRL-SIGN-TYPED-v2';
301
301
  /** Strict wire shape returned by `qrl_signMessage`. */
302
302
  interface QrlSignedMessageResult extends QrlSignedResult {
303
303
  schemeVersion: 'QRL-SIGN-MSG-v1';
304
304
  }
305
305
  /**
306
- * Historical v1 response from `qrl_signTypedData`. It echoes `domain` so a
307
- * stateless verifier does not need to be told the domain out-of-band.
306
+ * Response from `qrl_signTypedData`. It echoes `domain` so a stateless
307
+ * verifier does not need to be told the domain out-of-band. The scheme is
308
+ * v2 when the payload's types reach an `address` field and v1 otherwise;
309
+ * pass `schemeVersion` to `verifyTypedDataForSigner` to have it checked.
308
310
  */
309
311
  interface QrlSignedTypedDataResult extends QrlSignedResult {
310
- schemeVersion: 'QRL-SIGN-TYPED-v1';
312
+ schemeVersion: 'QRL-SIGN-TYPED-v1' | 'QRL-SIGN-TYPED-v2';
311
313
  domain: Record<string, unknown>;
312
314
  }
313
315
  /** Every strict signing-result wire shape understood by this SDK. */
@@ -338,10 +340,9 @@ declare function hasSigningDescriptor(result: unknown): result is QrlSigningResu
338
340
  */
339
341
  type QrlSignMessageParams = [string, string];
340
342
  /**
341
- * Reserved `qrl_signTypedData` params: `[signer, payload]`. This interface
342
- * describes the historical v1 payload retained by the verifier exports. The
343
- * QIP-55 provider rejects requests until a versioned 64-byte encoding is
344
- * defined.
343
+ * `qrl_signTypedData` params: `[signer, payload]`. A payload whose types
344
+ * reach an `address` field is signed under QRL-SIGN-TYPED-v2, any other
345
+ * under v1.
345
346
  */
346
347
  interface QrlTypedDataPayload {
347
348
  types: Record<string, readonly {
@@ -870,8 +871,17 @@ declare class SocketClient extends EventEmitter<SocketClientEvents> {
870
871
  */
871
872
  declare const SCHEME_VERSION_MSG = "QRL-SIGN-MSG-v1";
872
873
  declare const SCHEME_VERSION_TYPED = "QRL-SIGN-TYPED-v1";
874
+ /**
875
+ * Typed data with 64-byte slots, one QRVM word per atomic value, so a QIP-55
876
+ * address fits. A payload uses it exactly when an `address` type is
877
+ * reachable from QRLDomain or the primary type; every other payload keeps
878
+ * v1. See typedData.ts.
879
+ */
880
+ declare const SCHEME_VERSION_TYPED_V2 = "QRL-SIGN-TYPED-v2";
881
+ type TypedDataSchemeVersion = typeof SCHEME_VERSION_TYPED | typeof SCHEME_VERSION_TYPED_V2;
873
882
  declare const SCHEME_TAG_MSG: Uint8Array;
874
883
  declare const SCHEME_TAG_TYPED: Uint8Array;
884
+ declare const SCHEME_TAG_TYPED_V2: Uint8Array;
875
885
  /** SHAKE256 output length used throughout the signing module (NIST L5-matched). */
876
886
  declare const DIGEST_LEN = 64;
877
887
 
@@ -887,7 +897,7 @@ declare const DIGEST_LEN = 64;
887
897
  declare function computeMessageDigest(messageBytes: Uint8Array): Uint8Array;
888
898
 
889
899
  /**
890
- * Historical EIP-712-shaped typed-data encoding for `qrl_signTypedData` v1.
900
+ * EIP-712-shaped typed-data encoding for `qrl_signTypedData`.
891
901
  *
892
902
  * Byte-identical algorithm with the wallet's signing/typedData.ts; this
893
903
  * file is the SDK port (only the import block differs: the SDK routes
@@ -895,10 +905,19 @@ declare function computeMessageDigest(messageBytes: Uint8Array): Uint8Array;
895
905
  * the wallet copy for the spec-level comments; behavior must stay in
896
906
  * lock-step or the cross-repo parity test fails on next CI.
897
907
  *
898
- * The v1 address slot is 32 bytes. QIP-55 address fields fail closed until a
899
- * 64-byte encoding receives a new scheme tag and lockstep wallet fixtures.
900
- * Address-free digests retain their existing encoding.
908
+ * Two schemes share this codec and differ only in the atomic slot size:
909
+ * - QRL-SIGN-TYPED-v1: 32-byte slots, the original layout.
910
+ * - QRL-SIGN-TYPED-v2: 64-byte slots, one QRVM word per atomic value, so a
911
+ * 64-byte QIP-55 address fits one slot. Integers are zero- or
912
+ * sign-extended over 512 bits, bool and address are left-padded, bytesN
913
+ * is right-padded.
914
+ * Strings, bytes, arrays, structs and type hashes are 64-byte SHAKE256
915
+ * digests in both. A payload uses v2 exactly when an `address` type
916
+ * (including address arrays) is reachable from QRLDomain or the primary
917
+ * type, so address-free payloads keep their v1 digests and older verifiers
918
+ * keep working for them.
901
919
  */
920
+
902
921
  declare const TYPED_DATA_LIMITS: Readonly<{
903
922
  maxTypes: 32;
904
923
  maxFieldsPerType: 32;
@@ -928,8 +947,25 @@ interface TypedDataPayload {
928
947
  }
929
948
  declare function encodeType(primary: string, types: TypeMap): string;
930
949
  declare function typeHash(primary: string, types: TypeMap): Uint8Array;
931
- declare function encodeField(type: FieldType, value: unknown, types: TypeMap): Uint8Array;
932
- declare function hashStruct(primary: string, data: Message, types: TypeMap): Uint8Array;
950
+ /**
951
+ * Encode one field. The scheme defaults to the one `types` selects (v2 when
952
+ * any struct has an address field), which matches computeTypedDataDigest
953
+ * when `types` is a payload's full type map.
954
+ */
955
+ declare function encodeField(type: FieldType, value: unknown, types: TypeMap, schemeVersion?: TypedDataSchemeVersion): Uint8Array;
956
+ /**
957
+ * Hash one struct. The scheme defaults to the one `types` selects (v2 when
958
+ * any struct has an address field), which matches computeTypedDataDigest
959
+ * when `types` is a payload's full type map.
960
+ */
961
+ declare function hashStruct(primary: string, data: Message, types: TypeMap, schemeVersion?: TypedDataSchemeVersion): Uint8Array;
962
+ /**
963
+ * The scheme a payload is signed and verified under. It follows from the
964
+ * payload's types alone, so wallet and verifier agree without negotiating.
965
+ */
966
+ declare function typedDataSchemeVersion(payload: unknown): TypedDataSchemeVersion;
967
+ /** The digest-preimage and ML-DSA-87 ctx tag of a typed-data scheme. */
968
+ declare function typedDataSchemeTag(schemeVersion: TypedDataSchemeVersion): Uint8Array;
933
969
  declare function computeTypedDataDigest(payload: unknown): Uint8Array;
934
970
 
935
971
  /**
@@ -961,13 +997,18 @@ interface VerifyTypedDataParams {
961
997
  signature: Uint8Array | string;
962
998
  publicKey: Uint8Array | string;
963
999
  payload: TypedDataPayload;
1000
+ /**
1001
+ * The `schemeVersion` from the wallet response. Optional: the payload's
1002
+ * types decide the scheme, and a supplied value must match it.
1003
+ */
1004
+ schemeVersion?: string | undefined;
964
1005
  }
965
1006
  /**
966
1007
  * Verify against an explicitly supplied ML-DSA public key only. This does not
967
1008
  * bind that key to a Q-address. Use verifyTypedDataForSigner when signer
968
1009
  * identity matters.
969
1010
  */
970
- declare function verifyTypedDataSignature({ signature, publicKey, payload, }: VerifyTypedDataParams): boolean;
1011
+ declare function verifyTypedDataSignature({ signature, publicKey, payload, schemeVersion, }: VerifyTypedDataParams): boolean;
971
1012
  interface VerifyMessageForSignerParams extends VerifyMessageParams {
972
1013
  /** QIP-55 Q + 128 hex address expected by the dApp. */
973
1014
  expectedSigner: string;
@@ -983,7 +1024,7 @@ interface VerifyTypedDataForSignerParams extends VerifyTypedDataParams {
983
1024
  descriptor?: Uint8Array | string | undefined;
984
1025
  }
985
1026
  /** Verify both the typed-data signature and public-key-to-signer binding. */
986
- declare function verifyTypedDataForSigner({ expectedSigner, descriptor, signature, publicKey, payload, }: VerifyTypedDataForSignerParams): boolean;
1027
+ declare function verifyTypedDataForSigner({ expectedSigner, descriptor, signature, publicKey, payload, schemeVersion, }: VerifyTypedDataForSignerParams): boolean;
987
1028
  /**
988
1029
  * @deprecated Use verifyMessageSignature for a key-only check, or
989
1030
  * verifyMessageForSigner when signer identity matters.
@@ -1135,4 +1176,4 @@ declare function isValidJsonRpcMethod(value: unknown): value is string;
1135
1176
  */
1136
1177
  declare function classifyRpcMethod(method: string): RpcMethodPolicy;
1137
1178
 
1138
- export { type AckMessage, BLOB_LEN, CAP_LEN, CID_LEN, ConnectionManager, ConnectionStatus, type DAppMetadata, type DAppSession, DEFAULT_RELAY_URL, DIGEST_LEN, type Domain, type EIP6963ProviderInfoOverride, EXPLICITLY_UNSUPPORTED_METHODS, FP_LEN, type InitiatedKeyExchange, type JsonRpcRequest, type JsonRpcResponse, KeyExchange, KeyExchangeMessageType, MAX_CONNECTION_URI_LENGTH, MAX_JSON_RPC_ID_LENGTH, MAX_JSON_RPC_METHOD_LENGTH, MAX_RELAY_URL_LENGTH, ML_DSA_87_PUBLIC_KEY_BYTES, ML_DSA_87_SIGNATURE_BYTES, ML_DSA_DESCRIPTOR_BYTES, type Message, MessageType, PAIRING_CAPABILITY_LEN, PROTOCOL_VERSION, type ParsedURI, type PendingRequest, type PersistedSession, type ProviderEvents, QRLConnectProvider as QRLConnect, type QRLConnectOptions, QRLConnectProvider, QRL_ADDRESS_BYTES, QRL_ADDRESS_HEX_LENGTH, QRL_CONNECT_PROVIDER_INFO, type QrlSignMessageParams, type QrlSignTypedDataParams, type QrlSignedMessageResult, type QrlSignedResult, type QrlSignedResultWithDescriptor, type QrlSignedTypedDataResult, type QrlSigningResult, type QrlSigningSchemeVersion, type QrlTypedDataPayload, RESTRICTED_METHODS, type RelayMessage, type RpcMethodPolicy, SCHEME_TAG_MSG, SCHEME_TAG_TYPED, SCHEME_VERSION_MSG, SCHEME_VERSION_TYPED, type Session, SocketClient, type StructDef, type SynAckMessage, TYPED_DATA_LIMITS, type TypeMap, type TypedDataPayload, type TypedField, UNRESTRICTED_METHODS, type VerifyMessageForSignerParams, type VerifyMessageParams, type VerifyTypedDataForSignerParams, type VerifyTypedDataParams, attemptWalletRedirect, bytesToHex, cidFromString, cidRandom, cidToString, classifyRpcMethod, computeFingerprint, computeMessageDigest, computeTypedDataDigest, concatBytes, encodeField, encodeType, fingerprintEquals, formatQrlAddressFingerprint, generateConnectionURI, getAppStoreUrl, hasSigningDescriptor, hashStruct, hexToBytes, isCurrentQrlAddress, isMobileBrowser, isQrlSignedMessageResult, isQrlSignedResult, isQrlSignedTypedDataResult, isValidJsonRpcId, isValidJsonRpcMethod, normalizeRelayUrl, parseConnectionURI, qip55AddressFromBytes, typeHash, verifyMessage, verifyMessageForSigner, verifyMessageSignature, verifyTypedData, verifyTypedDataForSigner, verifyTypedDataSignature };
1179
+ export { type AckMessage, BLOB_LEN, CAP_LEN, CID_LEN, ConnectionManager, ConnectionStatus, type DAppMetadata, type DAppSession, DEFAULT_RELAY_URL, DIGEST_LEN, type Domain, type EIP6963ProviderInfoOverride, EXPLICITLY_UNSUPPORTED_METHODS, FP_LEN, type InitiatedKeyExchange, type JsonRpcRequest, type JsonRpcResponse, KeyExchange, KeyExchangeMessageType, MAX_CONNECTION_URI_LENGTH, MAX_JSON_RPC_ID_LENGTH, MAX_JSON_RPC_METHOD_LENGTH, MAX_RELAY_URL_LENGTH, ML_DSA_87_PUBLIC_KEY_BYTES, ML_DSA_87_SIGNATURE_BYTES, ML_DSA_DESCRIPTOR_BYTES, type Message, MessageType, PAIRING_CAPABILITY_LEN, PROTOCOL_VERSION, type ParsedURI, type PendingRequest, type PersistedSession, type ProviderEvents, QRLConnectProvider as QRLConnect, type QRLConnectOptions, QRLConnectProvider, QRL_ADDRESS_BYTES, QRL_ADDRESS_HEX_LENGTH, QRL_CONNECT_PROVIDER_INFO, type QrlSignMessageParams, type QrlSignTypedDataParams, type QrlSignedMessageResult, type QrlSignedResult, type QrlSignedResultWithDescriptor, type QrlSignedTypedDataResult, type QrlSigningResult, type QrlSigningSchemeVersion, type QrlTypedDataPayload, RESTRICTED_METHODS, type RelayMessage, type RpcMethodPolicy, SCHEME_TAG_MSG, SCHEME_TAG_TYPED, SCHEME_TAG_TYPED_V2, SCHEME_VERSION_MSG, SCHEME_VERSION_TYPED, SCHEME_VERSION_TYPED_V2, type Session, SocketClient, type StructDef, type SynAckMessage, TYPED_DATA_LIMITS, type TypeMap, type TypedDataPayload, type TypedDataSchemeVersion, type TypedField, UNRESTRICTED_METHODS, type VerifyMessageForSignerParams, type VerifyMessageParams, type VerifyTypedDataForSignerParams, type VerifyTypedDataParams, attemptWalletRedirect, bytesToHex, cidFromString, cidRandom, cidToString, classifyRpcMethod, computeFingerprint, computeMessageDigest, computeTypedDataDigest, concatBytes, encodeField, encodeType, fingerprintEquals, formatQrlAddressFingerprint, generateConnectionURI, getAppStoreUrl, hasSigningDescriptor, hashStruct, hexToBytes, isCurrentQrlAddress, isMobileBrowser, isQrlSignedMessageResult, isQrlSignedResult, isQrlSignedTypedDataResult, isValidJsonRpcId, isValidJsonRpcMethod, normalizeRelayUrl, parseConnectionURI, qip55AddressFromBytes, typeHash, typedDataSchemeTag, typedDataSchemeVersion, verifyMessage, verifyMessageForSigner, verifyMessageSignature, verifyTypedData, verifyTypedDataForSigner, verifyTypedDataSignature };