@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/dist/index.cjs CHANGED
@@ -3669,6 +3669,12 @@ var Wallet = class _Wallet {
3669
3669
  const messageString = JSON.stringify(message);
3670
3670
  const messageUint8 = new TextEncoder().encode(messageString);
3671
3671
  const deserializedPubkey = this.deserializeKey(recipientPubkey);
3672
+ const ML_KEM_768_PUBLIC_KEY_BYTES = 1184;
3673
+ if (deserializedPubkey.length !== ML_KEM_768_PUBLIC_KEY_BYTES) {
3674
+ throw new Error(
3675
+ `KnishIO: cannot ML-KEM-encrypt \u2014 recipient public key is ${deserializedPubkey.length} bytes, expected ${ML_KEM_768_PUBLIC_KEY_BYTES} (ML-KEM-768). The node likely did not advertise an ML-KEM public key (upgrade the validator to a PQ-transport build), or authenticate with { encrypt: false }.`
3676
+ );
3677
+ }
3672
3678
  const { cipherText, sharedSecret } = mlKem_js.ml_kem768.encapsulate(deserializedPubkey);
3673
3679
  const encryptedMessage = await this.encryptWithSharedSecret(messageUint8, sharedSecret);
3674
3680
  return {