@wishknish/knishio-client-ts 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wishknish/knishio-client-ts",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "productName": "Knish.IO TypeScript SDK Client",
5
5
  "description": "TypeScript implementation of the Knish.IO SDK to consume Knish.IO GraphQL APIs with enhanced type safety.",
6
6
  "license": "GPL-3.0-or-later",
@@ -72,17 +72,18 @@
72
72
  "devDependencies": {
73
73
  "@types/isomorphic-fetch": "^0.0.39",
74
74
  "@types/jssha": "^3.0.0",
75
- "@types/node": "^22.8.1",
76
- "@typescript-eslint/eslint-plugin": "^8.15.0",
77
- "@typescript-eslint/parser": "^8.15.0",
78
- "eslint": "^9.16.0",
79
- "prettier": "^3.4.2",
80
- "tsup": "^8.3.5",
81
- "tsx": "^4.20.5",
82
- "typescript": "^5.6.3",
83
- "vite": "^6.3.5",
84
- "vite-plugin-dts": "^4.2.3",
85
- "vitest": "^2.1.8"
75
+ "@types/node": "^22",
76
+ "@typescript-eslint/eslint-plugin": "^8.63.0",
77
+ "@typescript-eslint/parser": "^8.63.0",
78
+ "@vitest/coverage-v8": "^4.1.10",
79
+ "eslint": "^9",
80
+ "prettier": "^3",
81
+ "tsup": "^8.5.1",
82
+ "tsx": "^4.23.0",
83
+ "typescript": "^5",
84
+ "vite": "^7",
85
+ "vite-plugin-dts": "^5.0.3",
86
+ "vitest": "^4.1.10"
86
87
  },
87
88
  "browserslist": [
88
89
  "> 1%",
@@ -437,6 +437,18 @@ export default class Wallet {
437
437
  const messageString = JSON.stringify(message)
438
438
  const messageUint8 = new TextEncoder().encode(messageString)
439
439
  const deserializedPubkey = this.deserializeKey(recipientPubkey)
440
+ // ML-KEM-768 public keys are exactly 1184 bytes. A wrong-length key here almost always means the
441
+ // node did not advertise an ML-KEM public key in its auth `key` field (e.g. a validator predating
442
+ // the PQ-transport build). Fail with an actionable message rather than @noble's cryptic
443
+ // `"publicKey" expected Uint8Array of length 1184, got length=N` assertion.
444
+ const ML_KEM_768_PUBLIC_KEY_BYTES = 1184
445
+ if (deserializedPubkey.length !== ML_KEM_768_PUBLIC_KEY_BYTES) {
446
+ throw new Error(
447
+ `KnishIO: cannot ML-KEM-encrypt — recipient public key is ${deserializedPubkey.length} bytes, ` +
448
+ `expected ${ML_KEM_768_PUBLIC_KEY_BYTES} (ML-KEM-768). The node likely did not advertise an ML-KEM ` +
449
+ `public key (upgrade the validator to a PQ-transport build), or authenticate with { encrypt: false }.`
450
+ )
451
+ }
440
452
  const { cipherText, sharedSecret } = ml_kem768.encapsulate(deserializedPubkey)
441
453
  const encryptedMessage = await this.encryptWithSharedSecret(messageUint8, sharedSecret)
442
454
  return {