@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.
- package/build/abstraction/Identities.js.map +1 -1
- package/build/encryption/PQC/enigma.d.ts +83 -0
- package/build/encryption/PQC/enigma.js +243 -0
- package/build/encryption/PQC/enigma.js.map +1 -0
- package/build/encryption/PQC/falconts/falcon.d.ts +130 -0
- package/build/encryption/PQC/falconts/falcon.js +228 -0
- package/build/encryption/PQC/falconts/falcon.js.map +1 -0
- package/build/encryption/PQC/falconts/index.d.ts +4 -0
- package/build/encryption/PQC/falconts/index.js +19 -0
- package/build/encryption/PQC/falconts/index.js.map +1 -0
- package/build/encryption/PQC/falconts/mnemonic.d.ts +27 -0
- package/build/encryption/PQC/falconts/mnemonic.js +109 -0
- package/build/encryption/PQC/falconts/mnemonic.js.map +1 -0
- package/build/encryption/PQC/falconts/wordlist.d.ts +5 -0
- package/build/encryption/PQC/falconts/wordlist.js +216 -0
- package/build/encryption/PQC/falconts/wordlist.js.map +1 -0
- package/build/encryption/PQC/utils.d.ts +8 -0
- package/build/encryption/PQC/utils.js +16 -0
- package/build/encryption/PQC/utils.js.map +1 -0
- package/build/encryption/index.d.ts +2 -1
- package/build/encryption/index.js +4 -2
- package/build/encryption/index.js.map +1 -1
- package/build/encryption/unifiedCrypto.d.ts +125 -0
- package/build/encryption/unifiedCrypto.js +408 -0
- package/build/encryption/unifiedCrypto.js.map +1 -0
- package/build/instant_messaging/index.d.ts +300 -0
- package/build/instant_messaging/index.js +630 -0
- package/build/instant_messaging/index.js.map +1 -0
- package/build/multichain/core/btc.d.ts +4 -2
- package/build/multichain/core/btc.js +27 -4
- package/build/multichain/core/btc.js.map +1 -1
- package/build/utils/uint8Serialize.d.ts +2 -0
- package/build/utils/uint8Serialize.js +22 -0
- package/build/utils/uint8Serialize.js.map +1 -0
- package/build/websdk/utils/sha256.js +5 -1
- package/build/websdk/utils/sha256.js.map +1 -1
- package/package.json +9 -2
- package/build/encryption/PQC/index.d.ts +0 -136
- package/build/encryption/PQC/index.js +0 -405
- package/build/encryption/PQC/index.js.map +0 -1
|
@@ -0,0 +1,408 @@
|
|
|
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
|
+
exports.unifiedCrypto = exports.UnifiedCrypto = void 0;
|
|
37
|
+
exports.uint8ArrayToHex = uint8ArrayToHex;
|
|
38
|
+
exports.hexToUint8Array = hexToUint8Array;
|
|
39
|
+
exports.getUnifiedCryptoInstance = getUnifiedCryptoInstance;
|
|
40
|
+
const enigma_1 = require("./PQC/enigma");
|
|
41
|
+
const hkdf_1 = require("@noble/hashes/hkdf");
|
|
42
|
+
const sha2_1 = require("@noble/hashes/sha2");
|
|
43
|
+
const utils_1 = require("@noble/hashes/utils");
|
|
44
|
+
const forge = __importStar(require("node-forge"));
|
|
45
|
+
const Cryptography_1 = require("./Cryptography");
|
|
46
|
+
// SECTION Utilities
|
|
47
|
+
/**
|
|
48
|
+
* Converts a Uint8Array to a hexadecimal string representation, prefixed with '0x'.
|
|
49
|
+
*
|
|
50
|
+
* @param bytes - The Uint8Array to convert.
|
|
51
|
+
* @returns The hexadecimal string representation (e.g., "0x0a1b2c").
|
|
52
|
+
*/
|
|
53
|
+
function uint8ArrayToHex(bytes) {
|
|
54
|
+
// Convert each byte to a 2-digit hex string and pad with '0' if needed.
|
|
55
|
+
const hexBytes = Array.from(bytes, byte => {
|
|
56
|
+
return byte.toString(16).padStart(2, "0");
|
|
57
|
+
});
|
|
58
|
+
// Join the hex strings and prefix with '0x'.
|
|
59
|
+
return "0x" + hexBytes.join("");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Converts a hexadecimal string (with or without '0x' prefix) to a Uint8Array.
|
|
63
|
+
*
|
|
64
|
+
* @param hexString - The hexadecimal string to convert (e.g., "0x0a1b2c" or "0a1b2c").
|
|
65
|
+
* @returns The corresponding Uint8Array.
|
|
66
|
+
* @throws {Error} If the input string (after removing '0x') has an odd length
|
|
67
|
+
* or contains non-hexadecimal characters.
|
|
68
|
+
*/
|
|
69
|
+
function hexToUint8Array(hexString) {
|
|
70
|
+
// Remove the '0x' prefix if it exists.
|
|
71
|
+
const normalizedHexString = hexString.startsWith("0x")
|
|
72
|
+
? hexString.slice(2)
|
|
73
|
+
: hexString;
|
|
74
|
+
// Handle empty string case after normalization
|
|
75
|
+
if (normalizedHexString.length === 0) {
|
|
76
|
+
return new Uint8Array(0); // Return an empty Uint8Array for an empty hex string
|
|
77
|
+
}
|
|
78
|
+
// Check if the string has an even number of characters.
|
|
79
|
+
if (normalizedHexString.length % 2 !== 0) {
|
|
80
|
+
throw new Error("Invalid hex string: Hex string must have an even number of characters.");
|
|
81
|
+
}
|
|
82
|
+
// Check if the string contains only valid hexadecimal characters.
|
|
83
|
+
if (!/^[0-9a-fA-F]+$/.test(normalizedHexString)) {
|
|
84
|
+
throw new Error("Invalid hex string: Contains non-hexadecimal characters.");
|
|
85
|
+
}
|
|
86
|
+
// Create an array to store the byte values.
|
|
87
|
+
const bytes = new Uint8Array(normalizedHexString.length / 2);
|
|
88
|
+
// Iterate over the string, taking two characters at a time.
|
|
89
|
+
for (let i = 0; i < normalizedHexString.length; i += 2) {
|
|
90
|
+
const byteString = normalizedHexString.substring(i, i + 2);
|
|
91
|
+
const byteValue = parseInt(byteString, 16); // Parse the hex pair into a number.
|
|
92
|
+
bytes[i / 2] = byteValue;
|
|
93
|
+
}
|
|
94
|
+
return bytes;
|
|
95
|
+
}
|
|
96
|
+
// SECTION UnifiedCrypto
|
|
97
|
+
/**
|
|
98
|
+
* UnifiedCrypto is a class that provides a unified interface for the different encryption algorithms
|
|
99
|
+
* It is used to encrypt and decrypt messages, sign and verify messages, and generate identities for the different algorithms
|
|
100
|
+
* It uses Enigma for PQC encryption/decryption and Cryptography for RSA encryption/decryption
|
|
101
|
+
* It uses Enigma for PQC signing and Cryptography for Ed25519 signing
|
|
102
|
+
* It uses the master seed to derive seeds for the different algorithms using HKDF
|
|
103
|
+
* Manages encryptedObjects and signedObjects to route data through the supported algorithms
|
|
104
|
+
* REVIEW: Check race conditions
|
|
105
|
+
* REVIEW: Check stability of the master seed transformation
|
|
106
|
+
* TODO: Build a test suite for the UnifiedCrypto class
|
|
107
|
+
*/
|
|
108
|
+
class UnifiedCrypto {
|
|
109
|
+
constructor(instanceId, masterSeed) {
|
|
110
|
+
this.enigma = new enigma_1.Enigma();
|
|
111
|
+
this.masterSeed = masterSeed;
|
|
112
|
+
this.instanceId = instanceId;
|
|
113
|
+
}
|
|
114
|
+
// Multiton pattern: get an instance by ID or create a new one
|
|
115
|
+
static getInstance(instanceId, masterSeed) {
|
|
116
|
+
// If no instanceId is provided, use the default instance
|
|
117
|
+
const id = instanceId || UnifiedCrypto.DEFAULT_INSTANCE_ID;
|
|
118
|
+
// Check if the instance exists
|
|
119
|
+
if (!UnifiedCrypto.instances.has(id)) {
|
|
120
|
+
// Create a new instance
|
|
121
|
+
UnifiedCrypto.instances.set(id, new UnifiedCrypto(id, masterSeed));
|
|
122
|
+
}
|
|
123
|
+
else if (masterSeed && !UnifiedCrypto.instances.get(id).masterSeed) {
|
|
124
|
+
// Update the master seed if provided and not already set
|
|
125
|
+
UnifiedCrypto.instances.get(id).masterSeed = masterSeed;
|
|
126
|
+
}
|
|
127
|
+
return UnifiedCrypto.instances.get(id);
|
|
128
|
+
}
|
|
129
|
+
// Get the instance ID
|
|
130
|
+
getId() {
|
|
131
|
+
return this.instanceId;
|
|
132
|
+
}
|
|
133
|
+
// Get all instance IDs
|
|
134
|
+
static getInstanceIds() {
|
|
135
|
+
return Array.from(UnifiedCrypto.instances.keys());
|
|
136
|
+
}
|
|
137
|
+
// Remove an instance
|
|
138
|
+
static removeInstance(instanceId) {
|
|
139
|
+
return UnifiedCrypto.instances.delete(instanceId);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Ensures that the master seed is set and generates a new one if not set
|
|
143
|
+
* @param masterSeed (optional) The master seed to set, or undefined to generate a new one
|
|
144
|
+
*/
|
|
145
|
+
async ensureSeed(masterSeed) {
|
|
146
|
+
if (!masterSeed && !this.masterSeed) {
|
|
147
|
+
masterSeed = (0, utils_1.randomBytes)(128);
|
|
148
|
+
this.masterSeed = masterSeed;
|
|
149
|
+
}
|
|
150
|
+
else if (masterSeed) {
|
|
151
|
+
this.masterSeed = masterSeed;
|
|
152
|
+
}
|
|
153
|
+
// Check if the master seed is at least 128 bytes
|
|
154
|
+
if (this.masterSeed.length < 128) {
|
|
155
|
+
console.log("[UnifiedCrypto] WARNING: Master seed is shorter than 128 bytes; this is not recommended.");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Derives a seed for the given algorithm
|
|
160
|
+
* @param algorithm The algorithm to derive the seed for
|
|
161
|
+
* @param seed (optional) The seed to derive the seed from, or undefined to generate a new one or use the master seed if set
|
|
162
|
+
* @returns The derived seed
|
|
163
|
+
*/
|
|
164
|
+
async deriveSeed(algorithm, seed) {
|
|
165
|
+
// Creating a new seed if none is provided and the master seed is not set
|
|
166
|
+
await this.ensureSeed(seed);
|
|
167
|
+
//console.log("[UnifiedCrypto] Master seed:", this.masterSeed)
|
|
168
|
+
// Deriving the seed for the given algorithms
|
|
169
|
+
if (algorithm === "ed25519") {
|
|
170
|
+
return (0, hkdf_1.hkdf)(sha2_1.sha256, this.masterSeed, "master seed", "ed25519", 32);
|
|
171
|
+
}
|
|
172
|
+
else if (algorithm === "falcon") {
|
|
173
|
+
return (0, hkdf_1.hkdf)(sha2_1.sha256, this.masterSeed, "master seed", "falcon", 48);
|
|
174
|
+
}
|
|
175
|
+
else if (algorithm === "ml-dsa") {
|
|
176
|
+
return (0, hkdf_1.hkdf)(sha2_1.sha256, this.masterSeed, "master seed", "ml-dsa", 32);
|
|
177
|
+
}
|
|
178
|
+
else if (algorithm === "ml-kem-aes") {
|
|
179
|
+
return (0, hkdf_1.hkdf)(sha2_1.sha256, this.masterSeed, "master seed", "ml-kem-aes", 64);
|
|
180
|
+
}
|
|
181
|
+
else if (algorithm === "rsa") {
|
|
182
|
+
return (0, hkdf_1.hkdf)(sha2_1.sha256, this.masterSeed, "master seed", "rsa", 32);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
throw new Error("Invalid algorithm");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// helper for all identities at once
|
|
189
|
+
async generateAllIdentities(masterSeed) {
|
|
190
|
+
await this.generateIdentity("ed25519", masterSeed);
|
|
191
|
+
await this.generateIdentity("falcon", masterSeed);
|
|
192
|
+
await this.generateIdentity("ml-dsa", masterSeed);
|
|
193
|
+
await this.generateIdentity("ml-kem-aes", masterSeed);
|
|
194
|
+
}
|
|
195
|
+
async generateIdentity(algorithm, masterSeed) {
|
|
196
|
+
let seed;
|
|
197
|
+
// Generating a seed for the given algorithm
|
|
198
|
+
if (masterSeed) {
|
|
199
|
+
seed = await this.deriveSeed(algorithm, masterSeed);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
seed = await this.deriveSeed(algorithm); // will either generate a new seed or use the master seed if set
|
|
203
|
+
}
|
|
204
|
+
// Generating the identity for the given algorithm
|
|
205
|
+
if (algorithm === "ed25519") {
|
|
206
|
+
this.ed25519KeyPair = Cryptography_1.Cryptography.newFromSeed(seed);
|
|
207
|
+
}
|
|
208
|
+
else if (algorithm === "falcon") {
|
|
209
|
+
await this.enigma.generate_falcon_signing_keypair(seed);
|
|
210
|
+
}
|
|
211
|
+
else if (algorithm === "ml-dsa") {
|
|
212
|
+
await this.enigma.generate_ml_dsa_signing_keypair(seed);
|
|
213
|
+
}
|
|
214
|
+
else if (algorithm === "ml-kem-aes") {
|
|
215
|
+
await this.enigma.generate_ml_kem_encryption_keypair(seed);
|
|
216
|
+
}
|
|
217
|
+
else if (algorithm === "rsa") {
|
|
218
|
+
// Using forge's prng to generate the key pair from the seed
|
|
219
|
+
var prng = forge.random.createInstance();
|
|
220
|
+
// Convert the seed to a string
|
|
221
|
+
const seedString = new TextDecoder().decode(seed);
|
|
222
|
+
prng.seedFileSync = () => seedString;
|
|
223
|
+
this.rsaKeyPair = await forge.pki.rsa.generateKeyPair({
|
|
224
|
+
bits: 3072,
|
|
225
|
+
prng,
|
|
226
|
+
workers: 2,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
throw new Error("Invalid algorithm");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// Getters
|
|
234
|
+
async getIdentity(algorithm) {
|
|
235
|
+
if (algorithm === "falcon") {
|
|
236
|
+
return this.enigma.falcon_signing_keypair;
|
|
237
|
+
}
|
|
238
|
+
else if (algorithm === "ml-dsa") {
|
|
239
|
+
return this.enigma.ml_dsa_signing_keypair;
|
|
240
|
+
}
|
|
241
|
+
else if (algorithm === "ml-kem-aes") {
|
|
242
|
+
return this.enigma.ml_kem_encryption_keypair;
|
|
243
|
+
}
|
|
244
|
+
else if (algorithm === "ed25519") {
|
|
245
|
+
return {
|
|
246
|
+
publicKey: this.ed25519KeyPair.publicKey,
|
|
247
|
+
privateKey: this.ed25519KeyPair.privateKey,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
else if (algorithm === "rsa") {
|
|
251
|
+
return {
|
|
252
|
+
publicKey: this.rsaKeyPair.publicKey,
|
|
253
|
+
privateKey: this.rsaKeyPair.privateKey,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
throw new Error("Invalid algorithm");
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// Routing methods
|
|
261
|
+
/**
|
|
262
|
+
* Encrypts a message based on the algorithm using the previously generated identity
|
|
263
|
+
* @param algorithm The algorithm to encrypt the message with
|
|
264
|
+
* @param data The message to encrypt
|
|
265
|
+
* @param peerPublicKey The public key of the peer to encrypt the message to
|
|
266
|
+
* @returns The encrypted object as an encryptedObject
|
|
267
|
+
*/
|
|
268
|
+
async encrypt(algorithm, data, peerPublicKey) {
|
|
269
|
+
let encryptedObject = {
|
|
270
|
+
algorithm: algorithm,
|
|
271
|
+
encryptedData: new Uint8Array(),
|
|
272
|
+
};
|
|
273
|
+
// Routing through the unified crypto system
|
|
274
|
+
if (algorithm === "ml-kem-aes") {
|
|
275
|
+
const { cipherText, encryptedMessage } = await this.enigma.encrypt_ml_kem_aes(data, peerPublicKey);
|
|
276
|
+
encryptedObject.cipherText = cipherText;
|
|
277
|
+
encryptedObject.encryptedData = encryptedMessage;
|
|
278
|
+
}
|
|
279
|
+
else if (algorithm === "rsa") {
|
|
280
|
+
if (!this.rsaKeyPair) {
|
|
281
|
+
throw new Error("RSA key pair not generated");
|
|
282
|
+
}
|
|
283
|
+
// Convert the data to a string
|
|
284
|
+
const dataString = new TextDecoder().decode(data);
|
|
285
|
+
let encryptedData = this.rsaKeyPair.publicKey.encrypt(dataString);
|
|
286
|
+
// Convert the encrypted data to a Uint8Array
|
|
287
|
+
encryptedObject.encryptedData = new TextEncoder().encode(encryptedData);
|
|
288
|
+
}
|
|
289
|
+
return encryptedObject;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Signs a message based on the algorithm using the previously generated identity
|
|
293
|
+
* @param algorithm The algorithm to sign the message with
|
|
294
|
+
* @param data The message to sign
|
|
295
|
+
* @returns The signed object as a signedObject
|
|
296
|
+
*/
|
|
297
|
+
async sign(algorithm, data) {
|
|
298
|
+
let signedObject;
|
|
299
|
+
if (algorithm === "ed25519") {
|
|
300
|
+
if (!this.ed25519KeyPair) {
|
|
301
|
+
throw new Error("Ed25519 key pair not generated");
|
|
302
|
+
}
|
|
303
|
+
signedObject = {
|
|
304
|
+
algorithm: "ed25519",
|
|
305
|
+
signedData: Cryptography_1.Cryptography.sign(new TextDecoder().decode(data), this.ed25519KeyPair.privateKey),
|
|
306
|
+
message: data,
|
|
307
|
+
publicKey: this.ed25519KeyPair.publicKey,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
else if (algorithm === "ml-dsa") {
|
|
311
|
+
signedObject = {
|
|
312
|
+
algorithm: algorithm,
|
|
313
|
+
signedData: await this.enigma.sign_ml_dsa(data),
|
|
314
|
+
message: data,
|
|
315
|
+
publicKey: this.enigma.ml_dsa_signing_keypair.publicKey,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
else if (algorithm === "falcon") {
|
|
319
|
+
let dataString = new TextDecoder().decode(data);
|
|
320
|
+
signedObject = {
|
|
321
|
+
algorithm: algorithm,
|
|
322
|
+
signedData: await this.enigma.sign_falcon(dataString),
|
|
323
|
+
message: data,
|
|
324
|
+
publicKey: this.enigma.falcon_signing_keypair.publicKey,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
return signedObject;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Decrypts an encrypted object based on the algorithm
|
|
331
|
+
* @param encryptedObject The encrypted object to decrypt
|
|
332
|
+
* @returns The decrypted data
|
|
333
|
+
*/
|
|
334
|
+
async decrypt(encryptedObject) {
|
|
335
|
+
if (encryptedObject.algorithm === "ml-kem-aes") {
|
|
336
|
+
return this.enigma.decrypt_ml_kem_aes(encryptedObject.encryptedData, encryptedObject.cipherText);
|
|
337
|
+
}
|
|
338
|
+
else if (encryptedObject.algorithm === "rsa") {
|
|
339
|
+
// Convert the encrypted data to a string
|
|
340
|
+
const encryptedDataString = new TextDecoder().decode(encryptedObject.encryptedData);
|
|
341
|
+
let decryptedData = this.rsaKeyPair.privateKey.decrypt(encryptedDataString);
|
|
342
|
+
// Convert the decrypted data to a Uint8Array
|
|
343
|
+
return new TextEncoder().encode(decryptedData);
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
throw new Error("Invalid algorithm");
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Verifies a signed object based on the algorithm
|
|
351
|
+
* @param signedObject The signed object to verify
|
|
352
|
+
* @returns True if the signed object is valid, false otherwise
|
|
353
|
+
* @throws Error if publicKey is not in the expected format for the algorithm
|
|
354
|
+
*/
|
|
355
|
+
async verify(signedObject) {
|
|
356
|
+
if (signedObject.algorithm === "ml-dsa") {
|
|
357
|
+
return await enigma_1.Enigma.verify_ml_dsa(signedObject.signedData, signedObject.message, signedObject.publicKey);
|
|
358
|
+
}
|
|
359
|
+
else if (signedObject.algorithm === "falcon") {
|
|
360
|
+
// Convert the message to a string
|
|
361
|
+
const messageString = new TextDecoder().decode(signedObject.message);
|
|
362
|
+
return await enigma_1.Enigma.verify_falcon(signedObject.signedData, messageString, signedObject.publicKey);
|
|
363
|
+
}
|
|
364
|
+
else if (signedObject.algorithm === "ed25519") {
|
|
365
|
+
/*if (!isForgePublicKey(signedObject.publicKey)) {
|
|
366
|
+
throw new Error(
|
|
367
|
+
"Ed25519 verification requires a forge.pki.PublicKey",
|
|
368
|
+
)
|
|
369
|
+
}*/
|
|
370
|
+
// Convert the message to a string
|
|
371
|
+
const messageString = new TextDecoder().decode(signedObject.message);
|
|
372
|
+
return Cryptography_1.Cryptography.verify(messageString, signedObject.signedData, signedObject.publicKey);
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
throw new Error("Invalid algorithm");
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
exports.UnifiedCrypto = UnifiedCrypto;
|
|
380
|
+
// Multiton pattern: store multiple instances
|
|
381
|
+
UnifiedCrypto.instances = new Map();
|
|
382
|
+
UnifiedCrypto.DEFAULT_INSTANCE_ID = "default";
|
|
383
|
+
// Create a proxy that automatically calls getInstance with the default instance
|
|
384
|
+
// and also provides access to static methods
|
|
385
|
+
exports.unifiedCrypto = new Proxy({}, {
|
|
386
|
+
get(target, prop) {
|
|
387
|
+
// Check if the property is a static method or property
|
|
388
|
+
if (prop in UnifiedCrypto &&
|
|
389
|
+
typeof UnifiedCrypto[prop] ===
|
|
390
|
+
"function") {
|
|
391
|
+
// Return the static method bound to the UnifiedCrypto class
|
|
392
|
+
return UnifiedCrypto[prop].bind(UnifiedCrypto);
|
|
393
|
+
}
|
|
394
|
+
// For instance methods and properties, get the default instance
|
|
395
|
+
const instance = UnifiedCrypto.getInstance();
|
|
396
|
+
const value = instance[prop];
|
|
397
|
+
// If it's a method, bind it to the instance
|
|
398
|
+
if (typeof value === "function") {
|
|
399
|
+
return value.bind(instance);
|
|
400
|
+
}
|
|
401
|
+
return value;
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
// Export a function to get a named instance
|
|
405
|
+
function getUnifiedCryptoInstance(instanceId, masterSeed) {
|
|
406
|
+
return UnifiedCrypto.getInstance(instanceId, masterSeed);
|
|
407
|
+
}
|
|
408
|
+
//# sourceMappingURL=unifiedCrypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unifiedCrypto.js","sourceRoot":"","sources":["../../../src/encryption/unifiedCrypto.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,0CAOC;AAUD,0CAoCC;AAuYD,4DAKC;AAnfD,yCAAqC;AACrC,6CAAyC;AACzC,6CAA2C;AAC3C,+CAAiD;AACjD,kDAAmC;AACnC,iDAA6C;AAqC7C,oBAAoB;AAEpB;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAAiB;IAC7C,wEAAwE;IACxE,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;IACF,6CAA6C;IAC7C,OAAO,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACnC,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,SAAiB;IAC7C,uCAAuC;IACvC,MAAM,mBAAmB,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;QAClD,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC,SAAS,CAAA;IAEf,+CAA+C;IAC/C,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EA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