@wishknish/knishio-client-js 0.9.0 → 0.9.2
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/dist/client.cjs.js +29 -29
- package/dist/client.cjs.js.map +1 -1
- package/dist/client.es.mjs +810 -818
- package/dist/client.es.mjs.map +1 -1
- package/dist/client.iife.js +29 -29
- package/dist/client.iife.js.map +1 -1
- package/package.json +9 -13
- package/src/Wallet.js +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wishknish/knishio-client-js",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"productName": "Knish.IO Javascript SDK Client",
|
|
6
6
|
"description": "JavaScript implementation of the Knish.IO SDK to consume Knish.IO GraphQL APIs.",
|
|
@@ -65,22 +65,18 @@
|
|
|
65
65
|
"wonka": "^6.3.5"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@jest/globals": "^
|
|
68
|
+
"@jest/globals": "^30.4.1",
|
|
69
69
|
"@rollup/plugin-babel": "^6.1.0",
|
|
70
70
|
"@rollup/plugin-commonjs": "^28.0.9",
|
|
71
71
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
72
|
+
"@swc/core": "^1.15.43",
|
|
73
|
+
"@swc/jest": "^0.2.39",
|
|
72
74
|
"buffer": "^6.0.3",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"eslint-plugin-import": "^2.32.0",
|
|
77
|
-
"eslint-plugin-n": "^16.6.2",
|
|
78
|
-
"eslint-plugin-promise": "^6.6.0",
|
|
79
|
-
"eslint-plugin-vue": "^9.33.0",
|
|
80
|
-
"esmock": "^2.7.3",
|
|
81
|
-
"jest": "^29.7.0",
|
|
75
|
+
"eslint": "^9.39.0",
|
|
76
|
+
"jest": "^30.4.2",
|
|
77
|
+
"neostandard": "^0.13.0",
|
|
82
78
|
"rollup": "^4.57.1",
|
|
83
|
-
"vite": "^
|
|
79
|
+
"vite": "^7.3.5"
|
|
84
80
|
},
|
|
85
81
|
"browserslist": [
|
|
86
82
|
"> 1%",
|
|
@@ -89,7 +85,7 @@
|
|
|
89
85
|
],
|
|
90
86
|
"scripts": {
|
|
91
87
|
"build": "vite build --config build/vite.config.mjs",
|
|
92
|
-
"lint": "eslint
|
|
88
|
+
"lint": "eslint src",
|
|
93
89
|
"test": "jest",
|
|
94
90
|
"test:coverage": "jest --coverage",
|
|
95
91
|
"selftest": "npm run build && node tests/scripts/self-test.js",
|
package/src/Wallet.js
CHANGED
|
@@ -486,6 +486,18 @@ export default class Wallet {
|
|
|
486
486
|
const messageString = JSON.stringify(message)
|
|
487
487
|
const messageUint8 = new TextEncoder().encode(messageString)
|
|
488
488
|
const deserializedPubkey = this.deserializeKey(recipientPubkey)
|
|
489
|
+
// ML-KEM-768 public keys are exactly 1184 bytes. A wrong-length key here almost always means the
|
|
490
|
+
// node did not advertise an ML-KEM public key in its auth `key` field (e.g. a validator predating
|
|
491
|
+
// the PQ-transport build). Fail with an actionable message rather than the crypto lib's cryptic
|
|
492
|
+
// `"publicKey" expected Uint8Array of length 1184, got length=N` assertion.
|
|
493
|
+
const ML_KEM_768_PUBLIC_KEY_BYTES = 1184
|
|
494
|
+
if (deserializedPubkey.length !== ML_KEM_768_PUBLIC_KEY_BYTES) {
|
|
495
|
+
throw new Error(
|
|
496
|
+
`KnishIO: cannot ML-KEM-encrypt — recipient public key is ${deserializedPubkey.length} bytes, ` +
|
|
497
|
+
`expected ${ML_KEM_768_PUBLIC_KEY_BYTES} (ML-KEM-768). The node likely did not advertise an ML-KEM ` +
|
|
498
|
+
'public key (upgrade the validator to a PQ-transport build), or authenticate with { encrypt: false }.'
|
|
499
|
+
)
|
|
500
|
+
}
|
|
489
501
|
const { cipherText, sharedSecret } = MlKEM768.encapsulate(deserializedPubkey)
|
|
490
502
|
const encryptedMessage = await this.encryptWithSharedSecret(messageUint8, sharedSecret)
|
|
491
503
|
return {
|