@kynesyslabs/demosdk 2.1.14 → 2.2.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.
Files changed (40) hide show
  1. package/build/abstraction/Identities.js.map +1 -1
  2. package/build/encryption/PQC/enigma.d.ts +83 -0
  3. package/build/encryption/PQC/enigma.js +243 -0
  4. package/build/encryption/PQC/enigma.js.map +1 -0
  5. package/build/encryption/PQC/falconts/falcon.d.ts +130 -0
  6. package/build/encryption/PQC/falconts/falcon.js +228 -0
  7. package/build/encryption/PQC/falconts/falcon.js.map +1 -0
  8. package/build/encryption/PQC/falconts/index.d.ts +4 -0
  9. package/build/encryption/PQC/falconts/index.js +19 -0
  10. package/build/encryption/PQC/falconts/index.js.map +1 -0
  11. package/build/encryption/PQC/falconts/mnemonic.d.ts +27 -0
  12. package/build/encryption/PQC/falconts/mnemonic.js +109 -0
  13. package/build/encryption/PQC/falconts/mnemonic.js.map +1 -0
  14. package/build/encryption/PQC/falconts/wordlist.d.ts +5 -0
  15. package/build/encryption/PQC/falconts/wordlist.js +216 -0
  16. package/build/encryption/PQC/falconts/wordlist.js.map +1 -0
  17. package/build/encryption/PQC/utils.d.ts +8 -0
  18. package/build/encryption/PQC/utils.js +16 -0
  19. package/build/encryption/PQC/utils.js.map +1 -0
  20. package/build/encryption/index.d.ts +2 -1
  21. package/build/encryption/index.js +4 -2
  22. package/build/encryption/index.js.map +1 -1
  23. package/build/encryption/unifiedCrypto.d.ts +125 -0
  24. package/build/encryption/unifiedCrypto.js +408 -0
  25. package/build/encryption/unifiedCrypto.js.map +1 -0
  26. package/build/instant_messaging/index.d.ts +300 -0
  27. package/build/instant_messaging/index.js +630 -0
  28. package/build/instant_messaging/index.js.map +1 -0
  29. package/build/multichain/core/btc.d.ts +4 -2
  30. package/build/multichain/core/btc.js +27 -4
  31. package/build/multichain/core/btc.js.map +1 -1
  32. package/build/utils/uint8Serialize.d.ts +2 -0
  33. package/build/utils/uint8Serialize.js +22 -0
  34. package/build/utils/uint8Serialize.js.map +1 -0
  35. package/build/websdk/utils/sha256.js +5 -1
  36. package/build/websdk/utils/sha256.js.map +1 -1
  37. package/package.json +9 -2
  38. package/build/encryption/PQC/index.d.ts +0 -136
  39. package/build/encryption/PQC/index.js +0 -405
  40. package/build/encryption/PQC/index.js.map +0 -1
@@ -1,405 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- /* INFO Enigma - An experimental wrapper for Post Quantum Cryptography in Typescript designed with ease of use in mind
37
-
38
- LICENSE
39
-
40
- © 2023 by KyneSys Labs, licensed under CC BY-NC-ND 4.0
41
-
42
- Full license text: https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
43
- Human readable license: https://creativecommons.org/licenses/by-nc-nd/4.0/
44
-
45
- KyneSys Labs: https://www.kynesys.xyz/
46
-
47
- This module incorporates two Post Quantum Cryptography methods:
48
- - Rijndael: symmetric encryption algorithm considered the state of the art of its category
49
- - SHA-3: quantum-safe hashing algorithm
50
- - McEliece: post-quantum cryptography algorithm that uses a keypair to share secrets between two parties.
51
- - Dilithium: post-quantum cryptography algorithm that uses a keypair to sign and verify messages.
52
-
53
- The Rijdael algorithm is a symmetric encryption algorithm and as many of the most used symmetric encryption algorithms
54
- is considered to be quantum-safe. While even standard AES-256 is considered to be quantum-safe, the Rijndael algorithm
55
- is considered to improve robustness, performance, and security when compared to standard AES-256 as AES specification
56
- is a subset of Rijdael algorithm itself.
57
-
58
- The SHA-3 algorithm is a quantum-safe hashing algorithm that is designed to protect against various dehashing attacks.
59
- It is used to replace less secure hashing algorithms such as SHA-1, SHA-256, and so on.
60
-
61
- The McEliece algorithm is used to encrypt and decrypt messages, much like a symmetric classic encryption algorithm.
62
- Thanks to its post-quantum security, however, it is not possible to retrieve the secrets as easily as with a classic algorithm.
63
- We use McEliece to exchange a long-term secret between two parties. This secret will be the base to generate one-time secrets
64
- encrypted with McEliece itself that will be used to generate one-time symmetric keys.
65
-
66
- The Dilithium algorithm is used to sign and verify messages, much like algorithms like ed25519.
67
- Apart from providing post quantum security, the Dilithium algorithm is also capable of generating combined signed messages
68
- that can be used to verify signatures without sharing the initial message, as proofs of authenticity.
69
-
70
- Credits:
71
- - https://github.com/Snack-X for https://github.com/Snack-X/rijndael-js
72
- - https://github.com/ranisalt for https://github.com/ranisalt/node-argon2
73
- - https://github.com/cyph for its https://github.com/cyph/pqcrypto.js library (superdilithium, supersphincs and a lot of knowledge)
74
- - https://github.com/tniessen for its https://github.com/tniessen/node-mceliece-nist library (mceliece and a lot of knowledge too)
75
- - I can't find the ntru library developer unfortunately, feel free to contact me if its you
76
-
77
- */
78
- const mceliece_nist_1 = require("mceliece-nist");
79
- const superdilithium_1 = require("superdilithium");
80
- const js_sha3_1 = require("js-sha3");
81
- const crypto = __importStar(require("crypto"));
82
- const ntru_1 = require("ntru");
83
- // INFO Main class
84
- class Enigma {
85
- constructor() {
86
- this.signingKeyPair = null;
87
- this.mcelieceKeypair = null;
88
- this.ntruKeyPair = null;
89
- this.kem = new mceliece_nist_1.McEliece("mceliece8192128");
90
- // Nonce size for ChaCha20-Poly1305 (12 bytes = 96 bits)
91
- this.NONCE_SIZE = 12;
92
- }
93
- /**
94
- * Generates a cryptographically secure random value of specified length
95
- * @param length The length of the random value in bytes
96
- * @returns A Buffer containing random bytes
97
- */
98
- generateRandomBytes(length) {
99
- return crypto.randomBytes(length);
100
- }
101
- /**
102
- * Initializes the cryptographic key pairs for signing and key encapsulation
103
- * @returns A promise that resolves when initialization is complete
104
- */
105
- async init() {
106
- this.signingKeyPair = await superdilithium_1.superDilithium.keyPair();
107
- this.mcelieceKeypair = this.kem.keypair();
108
- this.ntruKeyPair = await ntru_1.ntru.keyPair();
109
- }
110
- /* SECTION Signatures with superDilithium */
111
- /**
112
- * Signs a message and combines it with the original message
113
- * @param message The message to sign
114
- * @param additionalData Optional additional data to include in the signature
115
- * @returns A promise that resolves to the combined signed message
116
- */
117
- async combinedSign(message, additionalData = null) {
118
- let bufMessage = Buffer.from(message, "utf8");
119
- let signed;
120
- if (additionalData) {
121
- let bufAdditionalData = Buffer.from(additionalData, "utf8");
122
- signed = await superdilithium_1.superDilithium.sign(bufMessage, this.signingKeyPair.privateKey, bufAdditionalData);
123
- }
124
- else {
125
- signed = await superdilithium_1.superDilithium.sign(bufMessage, this.signingKeyPair.privateKey);
126
- }
127
- return signed;
128
- }
129
- /**
130
- * Verifies a combined signed message
131
- * @param signed The combined signed message
132
- * @param publicKey The public key to use for verification
133
- * @param additionalData Optional additional data that was included in the signature
134
- * @returns A promise that resolves to the original message if verification succeeds
135
- */
136
- async combinedVerify(signed, publicKey, additionalData = null) {
137
- let verifyData;
138
- if (additionalData) {
139
- let bufAdditionalData = Buffer.from(additionalData, "utf8");
140
- verifyData = await superdilithium_1.superDilithium.open(signed, publicKey, bufAdditionalData);
141
- }
142
- else {
143
- verifyData = await superdilithium_1.superDilithium.open(signed, publicKey);
144
- }
145
- return verifyData;
146
- }
147
- /**
148
- * Signs a message without combining it with the original message
149
- * @param message The message to sign
150
- * @param additionalData Optional additional data to include in the signature
151
- * @returns A promise that resolves to the signature
152
- */
153
- async sign(message, additionalData = null) {
154
- if (typeof message === "string") {
155
- message = Buffer.from(message, "utf8");
156
- }
157
- if (typeof additionalData === "string") {
158
- additionalData = Buffer.from(additionalData, "utf8");
159
- }
160
- // Signing
161
- let signed;
162
- if (additionalData) {
163
- signed = await superdilithium_1.superDilithium.signDetached(message, this.signingKeyPair.privateKey, additionalData);
164
- }
165
- else {
166
- signed = await superdilithium_1.superDilithium.signDetached(message, this.signingKeyPair.privateKey);
167
- }
168
- return signed;
169
- }
170
- /**
171
- * Verifies a signature
172
- * @param signature The signature to verify
173
- * @param message The original message
174
- * @param publicKey The public key to use for verification
175
- * @param additionalData Optional additional data that was included in the signature
176
- * @returns A promise that resolves to true if verification succeeds
177
- */
178
- async verify(signature, message, publicKey, additionalData = null) {
179
- if (typeof message === "string") {
180
- message = Buffer.from(message, "utf8");
181
- }
182
- if (typeof additionalData === "string") {
183
- additionalData = Buffer.from(additionalData, "utf8");
184
- }
185
- // Verifying
186
- let verified;
187
- if (additionalData) {
188
- verified = await superdilithium_1.superDilithium.verifyDetached(signature, message, publicKey, additionalData);
189
- }
190
- else {
191
- verified = await superdilithium_1.superDilithium.verifyDetached(signature, message, publicKey);
192
- }
193
- return verified;
194
- }
195
- /**
196
- * Exports the signing key pair
197
- * @param passphrase Optional passphrase to encrypt the keys
198
- * @returns A promise that resolves to the exported keys
199
- */
200
- async exportSigningKeys(passphrase = null) {
201
- let storage;
202
- if (passphrase) {
203
- storage = await superdilithium_1.superDilithium.exportKeys(this.signingKeyPair, passphrase);
204
- }
205
- else {
206
- storage = await superdilithium_1.superDilithium.exportKeys(this.signingKeyPair);
207
- }
208
- return storage;
209
- }
210
- /**
211
- * Imports a signing key pair
212
- * @param storage The exported keys to import
213
- * @param passphrase Optional passphrase to decrypt the keys
214
- * @returns A promise that resolves to the imported key pair
215
- */
216
- async importSigningKeys(storage, passphrase = null) {
217
- if (passphrase) {
218
- this.signingKeyPair = await superdilithium_1.superDilithium.importKeys(storage, passphrase);
219
- }
220
- else {
221
- this.signingKeyPair = await superdilithium_1.superDilithium.importKeys(storage);
222
- }
223
- return this.signingKeyPair;
224
- }
225
- /* SECTION Keys generation and incapsulation with McEliece */
226
- /**
227
- * Generates a shared secret using the McEliece key encapsulation mechanism
228
- * @param peerPublicKey The public key of the peer
229
- * @returns A promise that resolves to an object containing the secret and encrypted key
230
- */
231
- async generateSecrets(peerPublicKey) {
232
- let { key, encryptedKey } = await this.kem.generateKey(peerPublicKey);
233
- let normalizedResult = {
234
- secret: key,
235
- shared: encryptedKey,
236
- };
237
- return normalizedResult;
238
- }
239
- /**
240
- * Derives a shared secret using the McEliece key encapsulation mechanism
241
- * @param shared The encrypted key
242
- * @returns A promise that resolves to the derived secret
243
- */
244
- async deriveSharedSecret(shared) {
245
- let secret = await this.kem.decryptKey(this.mcelieceKeypair.privateKey, shared);
246
- return secret;
247
- }
248
- /* SECTION Hashing with SHA-3 */
249
- /**
250
- * Hashes data using SHA-3 (Keccak-256)
251
- * @param input The data to hash
252
- * @returns A promise that resolves to the hash as a hex string
253
- */
254
- async hash(input) {
255
- if (typeof input === "string") {
256
- input = Buffer.from(input, "utf8");
257
- }
258
- // Use keccak_256 (SHA-3) for hashing
259
- // Convert Buffer to hex string for js-sha3
260
- const hash = (0, js_sha3_1.keccak_256)(input);
261
- return hash;
262
- }
263
- /**
264
- * Verifies if a hash matches the hash of the input data
265
- * @param input The data to hash
266
- * @param hash The hash to verify against
267
- * @returns A promise that resolves to true if the hash matches
268
- */
269
- async checkHash(input, hash) {
270
- if (typeof input === "string") {
271
- input = Buffer.from(input, "utf8");
272
- }
273
- // Calculate hash and compare
274
- const calculatedHash = (0, js_sha3_1.keccak_256)(input);
275
- return calculatedHash === hash;
276
- }
277
- /* SECTION Symmetric encryption and decryption with ChaCha20-Poly1305 */
278
- /**
279
- * Encrypts data using ChaCha20-Poly1305 with a secure random nonce
280
- * @param input The data to encrypt
281
- * @param key The encryption key (32 bytes for 256 bits)
282
- * @returns A Buffer containing the nonce prepended to the ciphertext
283
- */
284
- async encrypt(input, key) {
285
- // Convert key to Buffer if it's a string
286
- const keyBuffer = typeof key === 'string' ? Buffer.from(key, 'hex') : key;
287
- // Validate key length - ChaCha20-Poly1305 requires a 32-byte key
288
- if (keyBuffer.length !== 32) {
289
- throw new Error("Key must be 32 bytes long for ChaCha20-Poly1305");
290
- }
291
- // Generate a secure random nonce
292
- const nonce = this.generateRandomBytes(this.NONCE_SIZE);
293
- // Convert input to Buffer if it's a string
294
- const inputBuffer = typeof input === 'string' ? Buffer.from(input, 'utf8') : input;
295
- // Create cipher with the key and nonce
296
- const cipher = crypto.createCipheriv('chacha20-poly1305', keyBuffer, nonce, {
297
- authTagLength: 16 // 128-bit authentication tag
298
- });
299
- // Encrypt the data
300
- const encrypted = Buffer.concat([
301
- cipher.update(inputBuffer),
302
- cipher.final()
303
- ]);
304
- // Get the authentication tag
305
- const authTag = cipher.getAuthTag();
306
- // Prepend the nonce and append the auth tag to the ciphertext
307
- return Buffer.concat([nonce, encrypted, authTag]);
308
- }
309
- /**
310
- * Decrypts data using ChaCha20-Poly1305
311
- * @param input The encrypted data with nonce prepended and auth tag appended
312
- * @param key The decryption key (32 bytes for 256 bits)
313
- * @returns A Buffer containing the decrypted plaintext
314
- */
315
- async decrypt(input, key) {
316
- // Convert key to Buffer if it's a string
317
- const keyBuffer = typeof key === 'string' ? Buffer.from(key, 'hex') : key;
318
- // Validate key length - ChaCha20-Poly1305 requires a 32-byte key
319
- if (keyBuffer.length !== 32) {
320
- throw new Error("Key must be 32 bytes long for ChaCha20-Poly1305");
321
- }
322
- // Extract the nonce, ciphertext, and auth tag
323
- const nonce = input.subarray(0, this.NONCE_SIZE);
324
- const authTag = input.subarray(input.length - 16); // 16 bytes for auth tag
325
- const ciphertext = input.subarray(this.NONCE_SIZE, input.length - 16);
326
- // Create decipher with the key and nonce
327
- const decipher = crypto.createDecipheriv('chacha20-poly1305', keyBuffer, nonce, {
328
- authTagLength: 16 // 128-bit authentication tag
329
- });
330
- // Set the authentication tag
331
- decipher.setAuthTag(authTag);
332
- // Decrypt the data
333
- const decrypted = Buffer.concat([
334
- decipher.update(ciphertext),
335
- decipher.final()
336
- ]);
337
- return decrypted;
338
- }
339
- /* SECTION NTRU Encryption and Decryption */
340
- /**
341
- * Encrypts data using NTRU
342
- * @param input The data to encrypt
343
- * @param publicKey The public key to use for encryption
344
- * @returns A promise that resolves to an object containing the encrypted data and secret
345
- */
346
- async ntruEncrypt(input, publicKey) {
347
- // Convert input to Uint8Array if it's a string
348
- const inputData = typeof input === 'string' ? new TextEncoder().encode(input) : input;
349
- // Validate public key length
350
- const publicKeyBytes = await ntru_1.ntru.publicKeyBytes;
351
- if (publicKey.length !== publicKeyBytes) {
352
- throw new Error(`Public key must be ${publicKeyBytes} bytes long for NTRU`);
353
- }
354
- // Encrypt the data using NTRU
355
- const { cyphertext, secret } = await ntru_1.ntru.encrypt(publicKey);
356
- // Combine the encrypted data with the input
357
- const combined = new Uint8Array(cyphertext.length + inputData.length);
358
- combined.set(cyphertext, 0);
359
- combined.set(inputData, cyphertext.length);
360
- return {
361
- encrypted: combined,
362
- secret: secret
363
- };
364
- }
365
- /**
366
- * Decrypts data using NTRU
367
- * @param encrypted The encrypted data
368
- * @param privateKey The private key to use for decryption
369
- * @returns A promise that resolves to the decrypted data
370
- */
371
- async ntruDecrypt(encrypted, privateKey) {
372
- // Validate private key length
373
- const privateKeyBytes = await ntru_1.ntru.privateKeyBytes;
374
- if (privateKey.length !== privateKeyBytes) {
375
- throw new Error(`Private key must be ${privateKeyBytes} bytes long for NTRU`);
376
- }
377
- // Extract the cyphertext from the combined data
378
- const cyphertextBytes = await ntru_1.ntru.cyphertextBytes;
379
- const cyphertext = encrypted.subarray(0, cyphertextBytes);
380
- const data = encrypted.subarray(cyphertextBytes);
381
- // Decrypt the data using NTRU
382
- const secret = await ntru_1.ntru.decrypt(cyphertext, privateKey);
383
- // Return the decrypted data
384
- return data;
385
- }
386
- /**
387
- * Exports the NTRU key pair
388
- * @returns The NTRU key pair
389
- */
390
- exportNtruKeys() {
391
- if (!this.ntruKeyPair) {
392
- throw new Error("NTRU key pair not initialized. Call init() first.");
393
- }
394
- return this.ntruKeyPair;
395
- }
396
- /**
397
- * Imports an NTRU key pair
398
- * @param keyPair The key pair to import
399
- */
400
- importNtruKeys(keyPair) {
401
- this.ntruKeyPair = keyPair;
402
- }
403
- }
404
- exports.default = Enigma;
405
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/encryption/PQC/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCE;AACF,iDAAwC;AACxC,mDAA+C;AAC/C,qCAAoC;AACpC,+CAAgC;AAChC,+BAA2B;AAQ3B,kBAAkB;AAClB,MAAqB,MAAM;IAUvB;QATA,mBAAc,GAAa,IAAI,CAAA;QAC/B,oBAAe,GAAa,IAAI,CAAA;QAChC,gBAAW,GAAa,IAAI,CAAA;QAEpB,QAAG,GAAa,IAAI,wBAAQ,CAAC,iBAAiB,CAAC,CAAA;QAEvD,wDAAwD;QACvC,eAAU,GAAG,EAAE,CAAA;IAEjB,CAAC;IAEhB;;;;OAIG;IACK,mBAAmB,CAAC,MAAc;QACtC,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI;QACN,IAAI,CAAC,cAA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