shogun-core 6.2.4 → 6.3.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/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed448_js.shogun-core.js +93 -341
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed448_js.shogun-core.js.map +1 -1
- package/dist/browser/shogun-core.js +138979 -146789
- package/dist/browser/shogun-core.js.map +1 -1
- package/dist/{core.js → src/core.js} +167 -107
- package/dist/src/crypto/asymmetric.js +168 -0
- package/dist/src/crypto/double-ratchet.js +908 -0
- package/dist/src/crypto/file-encryption.js +352 -0
- package/dist/src/crypto/hashing.js +160 -0
- package/dist/src/crypto/index.js +18 -0
- package/dist/{crypto → src/crypto}/mls-codec.js +24 -34
- package/dist/src/crypto/mls.js +734 -0
- package/dist/src/crypto/pgp.js +619 -0
- package/dist/{crypto → src/crypto}/random-generation.js +125 -103
- package/dist/src/crypto/sframe.js +466 -0
- package/dist/src/crypto/signal-protocol.js +943 -0
- package/dist/src/crypto/symmetric.js +165 -0
- package/dist/src/crypto/utils.js +220 -0
- package/dist/src/examples/auth-test.js +535 -0
- package/dist/src/examples/crypto-identity-example.js +294 -0
- package/dist/src/examples/crypto-working-test.js +149 -0
- package/dist/src/examples/double-ratchet-test.js +240 -0
- package/dist/src/examples/mls-3-member-test.js +183 -0
- package/dist/src/examples/mls-multi-member.js +439 -0
- package/dist/src/examples/mls-sframe-test.js +491 -0
- package/dist/src/examples/mls-simple-test.js +122 -0
- package/dist/src/examples/pgp-example.js +354 -0
- package/dist/src/examples/random-generation-test.js +191 -0
- package/dist/src/examples/shogun-core-example.js +204 -0
- package/dist/src/examples/signal-protocol-test.js +82 -0
- package/dist/src/examples/zkproof-credentials-example.js +357 -0
- package/dist/src/examples/zkproof-example.js +357 -0
- package/dist/src/gundb/crypto.js +420 -0
- package/dist/src/gundb/db.js +728 -0
- package/dist/src/gundb/derive.js +327 -0
- package/dist/src/gundb/errors.js +115 -0
- package/dist/src/gundb/gun-es.js +8 -0
- package/dist/src/gundb/index.js +5 -0
- package/dist/{gundb → src/gundb}/rxjs.js +147 -111
- package/dist/{gundb → src/gundb}/types.js +1 -2
- package/dist/src/index.js +19 -0
- package/dist/src/interfaces/events.js +57 -0
- package/dist/{interfaces → src/interfaces}/shogun.js +4 -7
- package/dist/src/managers/AuthManager.js +301 -0
- package/dist/src/managers/CoreInitializer.js +304 -0
- package/dist/src/managers/CryptoIdentityManager.js +230 -0
- package/dist/{managers → src/managers}/EventManager.js +19 -21
- package/dist/{managers → src/managers}/PluginManager.js +123 -89
- package/dist/src/plugins/base.js +90 -0
- package/dist/src/plugins/index.js +17 -0
- package/dist/src/plugins/nostr/index.js +4 -0
- package/dist/src/plugins/nostr/nostrConnector.js +539 -0
- package/dist/src/plugins/nostr/nostrConnectorPlugin.js +663 -0
- package/dist/src/plugins/nostr/nostrSigner.js +414 -0
- package/dist/src/plugins/smartwallet/index.js +2 -0
- package/dist/src/plugins/smartwallet/smartWalletPlugin.js +824 -0
- package/dist/src/plugins/web3/index.js +4 -0
- package/dist/src/plugins/web3/types.js +1 -0
- package/dist/src/plugins/web3/web3Connector.js +738 -0
- package/dist/src/plugins/web3/web3ConnectorPlugin.js +639 -0
- package/dist/src/plugins/web3/web3Signer.js +432 -0
- package/dist/src/plugins/webauthn/index.js +3 -0
- package/dist/{plugins → src/plugins}/webauthn/types.js +2 -5
- package/dist/src/plugins/webauthn/webauthn.js +647 -0
- package/dist/src/plugins/webauthn/webauthnPlugin.js +689 -0
- package/dist/src/plugins/webauthn/webauthnSigner.js +419 -0
- package/dist/{plugins → src/plugins}/zkproof/index.js +3 -10
- package/dist/src/plugins/zkproof/types.js +1 -0
- package/dist/src/plugins/zkproof/zkCredentials.js +287 -0
- package/dist/src/plugins/zkproof/zkProofConnector.js +267 -0
- package/dist/src/plugins/zkproof/zkProofPlugin.js +405 -0
- package/dist/src/storage/storage.js +189 -0
- package/dist/src/utils/errorHandler.js +339 -0
- package/dist/{utils → src/utils}/eventEmitter.js +26 -26
- package/dist/{utils → src/utils}/seedPhrase.js +23 -32
- package/dist/{utils → src/utils}/validation.js +14 -21
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/{crypto → src/crypto}/double-ratchet.d.ts +1 -1
- package/dist/types/{crypto → src/crypto}/signal-protocol.d.ts +25 -0
- package/dist/types/{crypto → src/crypto}/types.d.ts +3 -1
- package/dist/types/src/examples/crypto-working-test.d.ts +1 -0
- package/dist/types/src/examples/double-ratchet-test.d.ts +1 -0
- package/dist/types/src/examples/mls-sframe-test.d.ts +1 -0
- package/dist/types/src/examples/random-generation-test.d.ts +1 -0
- package/dist/types/src/examples/signal-protocol-test.d.ts +1 -0
- package/dist/types/{gundb → src/gundb}/db.d.ts +14 -1
- package/dist/types/src/gundb/gun-es.d.ts +8 -0
- package/dist/types/src/gundb/min.d.ts +3 -0
- package/dist/types/{index.d.ts → src/index.d.ts} +1 -0
- package/package.json +14 -11
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_curve_js-node_modules_noble_curves_esm_-1ce4ed.shogun-core.js +0 -1651
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_curve_js-node_modules_noble_curves_esm_-1ce4ed.shogun-core.js.map +0 -1
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_nist_js.shogun-core.js +0 -1608
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_nist_js.shogun-core.js.map +0 -1
- package/dist/crypto/asymmetric.js +0 -99
- package/dist/crypto/double-ratchet.js +0 -392
- package/dist/crypto/file-encryption.js +0 -213
- package/dist/crypto/hashing.js +0 -87
- package/dist/crypto/index.js +0 -34
- package/dist/crypto/mls.js +0 -569
- package/dist/crypto/pgp.js +0 -390
- package/dist/crypto/sframe.js +0 -352
- package/dist/crypto/signal-protocol.js +0 -456
- package/dist/crypto/symmetric.js +0 -91
- package/dist/crypto/types.js +0 -2
- package/dist/crypto/utils.js +0 -140
- package/dist/examples/auth-test.js +0 -453
- package/dist/examples/crypto-identity-example.js +0 -196
- package/dist/examples/crypto-working-test.js +0 -83
- package/dist/examples/double-ratchet-test.js +0 -155
- package/dist/examples/mls-3-member-test.js +0 -97
- package/dist/examples/mls-multi-member.js +0 -153
- package/dist/examples/mls-sframe-test.js +0 -307
- package/dist/examples/mls-simple-test.js +0 -58
- package/dist/examples/pgp-example.js +0 -200
- package/dist/examples/random-generation-test.js +0 -151
- package/dist/examples/shogun-core-example.js +0 -150
- package/dist/examples/signal-protocol-test.js +0 -38
- package/dist/examples/zkproof-credentials-example.js +0 -217
- package/dist/examples/zkproof-example.js +0 -242
- package/dist/gundb/crypto.js +0 -306
- package/dist/gundb/db.js +0 -485
- package/dist/gundb/derive.js +0 -232
- package/dist/gundb/errors.js +0 -76
- package/dist/gundb/gun-es.js +0 -12
- package/dist/gundb/index.js +0 -21
- package/dist/gundb/min.js +0 -10
- package/dist/index.esm.js +0 -22
- package/dist/index.js +0 -47
- package/dist/interfaces/common.js +0 -2
- package/dist/interfaces/events.js +0 -40
- package/dist/interfaces/plugin.js +0 -2
- package/dist/managers/AuthManager.js +0 -226
- package/dist/managers/CoreInitializer.js +0 -250
- package/dist/managers/CryptoIdentityManager.js +0 -138
- package/dist/plugins/base.js +0 -50
- package/dist/plugins/index.js +0 -32
- package/dist/plugins/nostr/index.js +0 -20
- package/dist/plugins/nostr/nostrConnector.js +0 -419
- package/dist/plugins/nostr/nostrConnectorPlugin.js +0 -453
- package/dist/plugins/nostr/nostrSigner.js +0 -319
- package/dist/plugins/nostr/types.js +0 -2
- package/dist/plugins/smartwallet/index.js +0 -18
- package/dist/plugins/smartwallet/smartWalletPlugin.js +0 -511
- package/dist/plugins/smartwallet/types.js +0 -2
- package/dist/plugins/web3/index.js +0 -20
- package/dist/plugins/web3/types.js +0 -2
- package/dist/plugins/web3/web3Connector.js +0 -533
- package/dist/plugins/web3/web3ConnectorPlugin.js +0 -455
- package/dist/plugins/web3/web3Signer.js +0 -314
- package/dist/plugins/webauthn/index.js +0 -19
- package/dist/plugins/webauthn/webauthn.js +0 -496
- package/dist/plugins/webauthn/webauthnPlugin.js +0 -490
- package/dist/plugins/webauthn/webauthnSigner.js +0 -310
- package/dist/plugins/zkproof/types.js +0 -2
- package/dist/plugins/zkproof/zkCredentials.js +0 -216
- package/dist/plugins/zkproof/zkProofConnector.js +0 -198
- package/dist/plugins/zkproof/zkProofPlugin.js +0 -272
- package/dist/storage/storage.js +0 -145
- package/dist/types/gundb/gun-es.d.ts +0 -8
- package/dist/utils/errorHandler.js +0 -246
- /package/dist/{types/examples/crypto-working-test.d.ts → src/crypto/types.js} +0 -0
- /package/dist/{types/gundb/min.d.ts → src/gundb/min.js} +0 -0
- /package/dist/{types/examples/double-ratchet-test.d.ts → src/interfaces/common.js} +0 -0
- /package/dist/{types/examples/mls-sframe-test.d.ts → src/interfaces/plugin.js} +0 -0
- /package/dist/{types/examples/random-generation-test.d.ts → src/plugins/nostr/types.js} +0 -0
- /package/dist/{types/examples/signal-protocol-test.d.ts → src/plugins/smartwallet/types.js} +0 -0
- /package/dist/types/{core.d.ts → src/core.d.ts} +0 -0
- /package/dist/types/{crypto → src/crypto}/asymmetric.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/file-encryption.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/hashing.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/index.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/mls-codec.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/mls.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/pgp.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/random-generation.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/sframe.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/symmetric.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/utils.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/auth-test.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/crypto-identity-example.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/mls-3-member-test.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/mls-multi-member.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/mls-simple-test.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/pgp-example.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/shogun-core-example.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/zkproof-credentials-example.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/zkproof-example.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/crypto.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/derive.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/errors.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/index.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/rxjs.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/types.d.ts +0 -0
- /package/dist/types/{interfaces → src/interfaces}/common.d.ts +0 -0
- /package/dist/types/{interfaces → src/interfaces}/events.d.ts +0 -0
- /package/dist/types/{interfaces → src/interfaces}/plugin.d.ts +0 -0
- /package/dist/types/{interfaces → src/interfaces}/shogun.d.ts +0 -0
- /package/dist/types/{managers → src/managers}/AuthManager.d.ts +0 -0
- /package/dist/types/{managers → src/managers}/CoreInitializer.d.ts +0 -0
- /package/dist/types/{managers → src/managers}/CryptoIdentityManager.d.ts +0 -0
- /package/dist/types/{managers → src/managers}/EventManager.d.ts +0 -0
- /package/dist/types/{managers → src/managers}/PluginManager.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/base.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/nostr/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/nostr/nostrConnector.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/nostr/nostrConnectorPlugin.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/nostr/nostrSigner.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/nostr/types.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/smartwallet/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/smartwallet/smartWalletPlugin.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/smartwallet/types.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/web3/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/web3/types.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/web3/web3Connector.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/web3/web3ConnectorPlugin.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/web3/web3Signer.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/webauthn/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/webauthn/types.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/webauthn/webauthn.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/webauthn/webauthnPlugin.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/webauthn/webauthnSigner.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/zkproof/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/zkproof/types.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/zkproof/zkCredentials.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/zkproof/zkProofConnector.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/zkproof/zkProofPlugin.d.ts +0 -0
- /package/dist/types/{storage → src/storage}/storage.d.ts +0 -0
- /package/dist/types/{utils → src/utils}/errorHandler.d.ts +0 -0
- /package/dist/types/{utils → src/utils}/eventEmitter.d.ts +0 -0
- /package/dist/types/{utils → src/utils}/seedPhrase.d.ts +0 -0
- /package/dist/types/{utils → src/utils}/validation.d.ts +0 -0
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* PGP Example - Simple and Immediate
|
|
4
|
-
* Demonstrates basic PGP functionality:
|
|
5
|
-
* - Key generation
|
|
6
|
-
* - Message encryption/decryption
|
|
7
|
-
* - Digital signing
|
|
8
|
-
* - Signature verification
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.simplePGPExample = simplePGPExample;
|
|
12
|
-
exports.advancedPGPExample = advancedPGPExample;
|
|
13
|
-
exports.runAllPGPExamples = runAllPGPExamples;
|
|
14
|
-
const crypto_1 = require("../crypto");
|
|
15
|
-
// Simple PGP usage example
|
|
16
|
-
async function simplePGPExample() {
|
|
17
|
-
try {
|
|
18
|
-
console.log("🔐 Starting Simple PGP Example");
|
|
19
|
-
console.log("=".repeat(40));
|
|
20
|
-
// Method 1: Using factory functions (simplest)
|
|
21
|
-
console.log("\n📋 Method 1: Factory Functions");
|
|
22
|
-
// Generate key pairs
|
|
23
|
-
const aliceKeys = await (0, crypto_1.generatePGPKeyPair)("Alice", "alice@example.com", "alice123");
|
|
24
|
-
const bobKeys = await (0, crypto_1.generatePGPKeyPair)("Bob", "bob@example.com", "bob123");
|
|
25
|
-
console.log("✅ Key pairs generated");
|
|
26
|
-
console.log("Alice Key ID:", aliceKeys.keyId);
|
|
27
|
-
console.log("Bob Key ID:", bobKeys.keyId);
|
|
28
|
-
// Encrypt message from Alice to Bob
|
|
29
|
-
const message = "Hello Bob! This is a secret message from Alice. 🔐";
|
|
30
|
-
const encrypted = await (0, crypto_1.encryptPGPMessage)(message, bobKeys.publicKey);
|
|
31
|
-
console.log("✅ Message encrypted");
|
|
32
|
-
console.log("Encrypted message length:", encrypted.message.length);
|
|
33
|
-
// Bob decrypts the message
|
|
34
|
-
const decrypted = await (0, crypto_1.decryptPGPMessage)(encrypted.message, bobKeys.privateKey, "bob123");
|
|
35
|
-
console.log("✅ Message decrypted");
|
|
36
|
-
console.log("Original message:", message);
|
|
37
|
-
console.log("Decrypted message:", decrypted);
|
|
38
|
-
console.log("Messages match:", message === decrypted);
|
|
39
|
-
// Alice signs a message
|
|
40
|
-
const signedMessage = "This is a signed message from Alice. ✍️";
|
|
41
|
-
const signature = await (0, crypto_1.signPGPMessage)(signedMessage, aliceKeys.privateKey, "alice123");
|
|
42
|
-
console.log("✅ Message signed");
|
|
43
|
-
console.log("Signature length:", signature.signature.length);
|
|
44
|
-
// Bob verifies Alice's signature
|
|
45
|
-
const verification = await (0, crypto_1.verifyPGPSignature)(signedMessage, signature.signature, aliceKeys.publicKey);
|
|
46
|
-
console.log("✅ Signature verified");
|
|
47
|
-
console.log("Signature valid:", verification.valid);
|
|
48
|
-
console.log("\n🎉 Simple PGP Example completed successfully!");
|
|
49
|
-
return {
|
|
50
|
-
success: true,
|
|
51
|
-
messageDecrypted: message === decrypted,
|
|
52
|
-
signatureValid: verification.valid,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
console.error("❌ Simple PGP Example failed:", error);
|
|
57
|
-
return {
|
|
58
|
-
success: false,
|
|
59
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// Advanced PGP usage with manager
|
|
64
|
-
async function advancedPGPExample() {
|
|
65
|
-
let manager;
|
|
66
|
-
try {
|
|
67
|
-
console.log("\n🔐 Starting Advanced PGP Example");
|
|
68
|
-
console.log("=".repeat(40));
|
|
69
|
-
// Method 2: Using PGPManager (more control)
|
|
70
|
-
manager = await (0, crypto_1.createPGPManager)();
|
|
71
|
-
console.log("✅ PGP Manager created");
|
|
72
|
-
// Generate multiple key pairs
|
|
73
|
-
const users = [
|
|
74
|
-
{ name: "Alice", email: "alice@example.com", passphrase: "alice123" },
|
|
75
|
-
{ name: "Bob", email: "bob@example.com", passphrase: "bob123" },
|
|
76
|
-
{
|
|
77
|
-
name: "Charlie",
|
|
78
|
-
email: "charlie@example.com",
|
|
79
|
-
passphrase: "charlie123",
|
|
80
|
-
},
|
|
81
|
-
];
|
|
82
|
-
const userKeys = new Map();
|
|
83
|
-
for (const user of users) {
|
|
84
|
-
const keys = await manager.generateKeyPair(user.name, user.email, user.passphrase);
|
|
85
|
-
userKeys.set(user.name, keys);
|
|
86
|
-
console.log(`✅ ${user.name} key pair generated: ${keys.keyId}`);
|
|
87
|
-
}
|
|
88
|
-
// Test group messaging (Alice sends to Bob and Charlie)
|
|
89
|
-
console.log("\n📧 Group Messaging Test");
|
|
90
|
-
const groupMessage = "Hello everyone! This is a group message from Alice. 👥";
|
|
91
|
-
// Encrypt for Bob
|
|
92
|
-
const encryptedForBob = await manager.encryptMessage(groupMessage, userKeys.get("Bob").publicKey, userKeys.get("Alice").privateKey, // Alice signs
|
|
93
|
-
"alice123");
|
|
94
|
-
// Encrypt for Charlie
|
|
95
|
-
const encryptedForCharlie = await manager.encryptMessage(groupMessage, userKeys.get("Charlie").publicKey, userKeys.get("Alice").privateKey, // Alice signs
|
|
96
|
-
"alice123");
|
|
97
|
-
console.log("✅ Messages encrypted for Bob and Charlie");
|
|
98
|
-
// Bob decrypts
|
|
99
|
-
const bobDecrypted = await manager.decryptMessage(encryptedForBob.message, userKeys.get("Bob").privateKey, "bob123");
|
|
100
|
-
// Charlie decrypts
|
|
101
|
-
const charlieDecrypted = await manager.decryptMessage(encryptedForCharlie.message, userKeys.get("Charlie").privateKey, "charlie123");
|
|
102
|
-
console.log("✅ Messages decrypted by Bob and Charlie");
|
|
103
|
-
console.log("Bob received:", bobDecrypted);
|
|
104
|
-
console.log("Charlie received:", charlieDecrypted);
|
|
105
|
-
// Test key information
|
|
106
|
-
console.log("\n🔍 Key Information");
|
|
107
|
-
for (const [name, keys] of userKeys) {
|
|
108
|
-
const keyInfo = await manager.getKeyInfo(keys.publicKey);
|
|
109
|
-
console.log(`${name}:`, {
|
|
110
|
-
keyId: keyInfo.keyId,
|
|
111
|
-
fingerprint: keyInfo.fingerprint,
|
|
112
|
-
algorithm: keyInfo.algorithm,
|
|
113
|
-
created: keyInfo.created,
|
|
114
|
-
isPrivate: keyInfo.isPrivate,
|
|
115
|
-
isPublic: keyInfo.isPublic,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
// Test key export/import
|
|
119
|
-
console.log("\n📤 Key Export/Import Test");
|
|
120
|
-
const aliceKeyArmored = await manager.exportKey(userKeys.get("Alice").publicKey, "armored");
|
|
121
|
-
const aliceKeyBinary = await manager.exportKey(userKeys.get("Alice").publicKey, "binary");
|
|
122
|
-
console.log("✅ Alice's key exported in armored and binary formats");
|
|
123
|
-
console.log("Armored length:", aliceKeyArmored.length);
|
|
124
|
-
console.log("Binary length:", aliceKeyBinary.length);
|
|
125
|
-
// Import the binary key back
|
|
126
|
-
const importedKey = await manager.importKey(aliceKeyBinary, "binary");
|
|
127
|
-
console.log("✅ Key imported from binary format");
|
|
128
|
-
console.log("Imported key matches original:", importedKey === userKeys.get("Alice").publicKey);
|
|
129
|
-
console.log("\n🎉 Advanced PGP Example completed successfully!");
|
|
130
|
-
return {
|
|
131
|
-
success: true,
|
|
132
|
-
groupMessaging: true,
|
|
133
|
-
keyManagement: true,
|
|
134
|
-
exportImport: true,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
console.error("❌ Advanced PGP Example failed:", error);
|
|
139
|
-
return {
|
|
140
|
-
success: false,
|
|
141
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
finally {
|
|
145
|
-
// Clean up
|
|
146
|
-
if (typeof manager !== "undefined") {
|
|
147
|
-
manager.destroy();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
// Run all examples
|
|
152
|
-
async function runAllPGPExamples() {
|
|
153
|
-
console.log("🚀 Running All PGP Examples");
|
|
154
|
-
console.log("=".repeat(50));
|
|
155
|
-
// Example 1: Simple usage
|
|
156
|
-
console.log("\n=== Example 1: Simple PGP Usage ===");
|
|
157
|
-
const simpleResult = await simplePGPExample();
|
|
158
|
-
// Example 2: Advanced usage
|
|
159
|
-
console.log("\n=== Example 2: Advanced PGP Usage ===");
|
|
160
|
-
const advancedResult = await advancedPGPExample();
|
|
161
|
-
// Example 3: Full demonstration
|
|
162
|
-
console.log("\n=== Example 3: Full PGP Demonstration ===");
|
|
163
|
-
const demoResult = await (0, crypto_1.demonstratePGP)();
|
|
164
|
-
console.log("\n📊 Final Results:");
|
|
165
|
-
console.log("Simple PGP:", simpleResult.success ? "✅ PASSED" : "❌ FAILED");
|
|
166
|
-
console.log("Advanced PGP:", advancedResult.success ? "✅ PASSED" : "❌ FAILED");
|
|
167
|
-
console.log("Full Demo:", demoResult.success ? "✅ PASSED" : "❌ FAILED");
|
|
168
|
-
const allPassed = simpleResult.success && advancedResult.success && demoResult.success;
|
|
169
|
-
if (allPassed) {
|
|
170
|
-
console.log("\n🎉 All PGP examples completed successfully!");
|
|
171
|
-
console.log("🔐 PGP Features Demonstrated:");
|
|
172
|
-
console.log(" ✅ Key generation (RSA 4096-bit)");
|
|
173
|
-
console.log(" ✅ Message encryption/decryption");
|
|
174
|
-
console.log(" ✅ Digital signing and verification");
|
|
175
|
-
console.log(" ✅ Key management and information");
|
|
176
|
-
console.log(" ✅ Key export/import (armored/binary)");
|
|
177
|
-
console.log(" ✅ Group messaging with signing");
|
|
178
|
-
console.log(" ✅ OpenPGP standard compliance");
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
console.log("\n❌ Some PGP examples failed");
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
simple: simpleResult,
|
|
185
|
-
advanced: advancedResult,
|
|
186
|
-
demo: demoResult,
|
|
187
|
-
allPassed,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
// Run the examples
|
|
191
|
-
if (require.main === module) {
|
|
192
|
-
runAllPGPExamples()
|
|
193
|
-
.then((result) => {
|
|
194
|
-
console.log("\n📊 Final Test Summary:");
|
|
195
|
-
console.log(JSON.stringify(result, null, 2));
|
|
196
|
-
})
|
|
197
|
-
.catch((error) => {
|
|
198
|
-
console.error("💥 PGP examples execution failed:", error);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Random Generation test
|
|
4
|
-
const crypto_1 = require("../crypto");
|
|
5
|
-
// Test Random Generation
|
|
6
|
-
async function testRandomGeneration() {
|
|
7
|
-
try {
|
|
8
|
-
console.log("🎲 Starting Random Generation test...");
|
|
9
|
-
// Test 1: Basic random string generation
|
|
10
|
-
console.log("\n1. Testing basic random string generation...");
|
|
11
|
-
const randomStr = (0, crypto_1.generateRandomString)(16, "test-");
|
|
12
|
-
console.log("✅ Random string:", randomStr);
|
|
13
|
-
// Test 2: Random bytes
|
|
14
|
-
console.log("\n2. Testing random bytes...");
|
|
15
|
-
const bytes = (0, crypto_1.randomBytes)(8);
|
|
16
|
-
console.log("✅ Random bytes:", Array.from(bytes)
|
|
17
|
-
.map((b) => b.toString(16).padStart(2, "0"))
|
|
18
|
-
.join(""));
|
|
19
|
-
// Test 3: Random integer
|
|
20
|
-
console.log("\n3. Testing random integer...");
|
|
21
|
-
const randomNum = (0, crypto_1.randomInt)(1, 100);
|
|
22
|
-
console.log("✅ Random integer (1-100):", randomNum);
|
|
23
|
-
// Test 4: Random float
|
|
24
|
-
console.log("\n4. Testing random float...");
|
|
25
|
-
const randomFloatVal = (0, crypto_1.randomFloat)();
|
|
26
|
-
console.log("✅ Random float:", randomFloatVal);
|
|
27
|
-
// Test 5: Random boolean
|
|
28
|
-
console.log("\n5. Testing random boolean...");
|
|
29
|
-
const randomBoolVal = (0, crypto_1.randomBool)();
|
|
30
|
-
console.log("✅ Random boolean:", randomBoolVal);
|
|
31
|
-
// Test 6: Random UUID
|
|
32
|
-
console.log("\n6. Testing random UUID...");
|
|
33
|
-
const uuid = (0, crypto_1.randomUUID)();
|
|
34
|
-
console.log("✅ Random UUID:", uuid);
|
|
35
|
-
// Test 7: Deterministic random
|
|
36
|
-
console.log("\n7. Testing deterministic random...");
|
|
37
|
-
const detRandom = (0, crypto_1.createDeterministicRandom)("test-seed");
|
|
38
|
-
const detInt1 = detRandom.integer(1, 100);
|
|
39
|
-
const detInt2 = detRandom.integer(1, 100);
|
|
40
|
-
const detFloat = detRandom.floating(0, 1, 4);
|
|
41
|
-
const detBool = detRandom.bool();
|
|
42
|
-
const detString = detRandom.string(10);
|
|
43
|
-
const detGuid = detRandom.guid();
|
|
44
|
-
console.log("✅ Deterministic integer 1:", detInt1);
|
|
45
|
-
console.log("✅ Deterministic integer 2:", detInt2);
|
|
46
|
-
console.log("✅ Deterministic float:", detFloat);
|
|
47
|
-
console.log("✅ Deterministic boolean:", detBool);
|
|
48
|
-
console.log("✅ Deterministic string:", detString);
|
|
49
|
-
console.log("✅ Deterministic GUID:", detGuid);
|
|
50
|
-
// Test 8: Chance.js compatibility
|
|
51
|
-
console.log("\n8. Testing Chance.js compatibility...");
|
|
52
|
-
const chanceInstance = (0, crypto_1.chance)("chance-seed");
|
|
53
|
-
const chanceInt = chanceInstance.integer(1, 50);
|
|
54
|
-
const chanceFloat = chanceInstance.floating(0, 10, 2);
|
|
55
|
-
const chanceBool = chanceInstance.bool();
|
|
56
|
-
console.log("✅ Chance integer:", chanceInt);
|
|
57
|
-
console.log("✅ Chance float:", chanceFloat);
|
|
58
|
-
console.log("✅ Chance boolean:", chanceBool);
|
|
59
|
-
// Test 9: Array utilities
|
|
60
|
-
console.log("\n9. Testing array utilities...");
|
|
61
|
-
const testArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
62
|
-
const choice = (0, crypto_1.randomChoice)(testArray);
|
|
63
|
-
const shuffled = (0, crypto_1.randomShuffle)(testArray);
|
|
64
|
-
console.log("✅ Random choice from array:", choice);
|
|
65
|
-
console.log("✅ Shuffled array:", shuffled);
|
|
66
|
-
// Test 10: Random color
|
|
67
|
-
console.log("\n10. Testing random color...");
|
|
68
|
-
const color = (0, crypto_1.randomColor)();
|
|
69
|
-
console.log("✅ Random color:", color);
|
|
70
|
-
// Test 11: Random password
|
|
71
|
-
console.log("\n11. Testing random password...");
|
|
72
|
-
const password = (0, crypto_1.randomPassword)({
|
|
73
|
-
length: 16,
|
|
74
|
-
includeUppercase: true,
|
|
75
|
-
includeLowercase: true,
|
|
76
|
-
includeNumbers: true,
|
|
77
|
-
includeSymbols: true,
|
|
78
|
-
excludeSimilar: true,
|
|
79
|
-
});
|
|
80
|
-
console.log("✅ Random password:", password);
|
|
81
|
-
// Test 12: Random seed phrase
|
|
82
|
-
console.log("\n12. Testing random seed phrase...");
|
|
83
|
-
const seedPhrase = (0, crypto_1.randomSeedPhrase)(12);
|
|
84
|
-
console.log("✅ Random seed phrase:", seedPhrase.join(" "));
|
|
85
|
-
// Test 13: Deterministic consistency
|
|
86
|
-
console.log("\n13. Testing deterministic consistency...");
|
|
87
|
-
const det1 = (0, crypto_1.createDeterministicRandom)("consistency-test");
|
|
88
|
-
const det2 = (0, crypto_1.createDeterministicRandom)("consistency-test");
|
|
89
|
-
const val1_1 = det1.integer(1, 100);
|
|
90
|
-
const val1_2 = det1.integer(1, 100);
|
|
91
|
-
const val2_1 = det2.integer(1, 100);
|
|
92
|
-
const val2_2 = det2.integer(1, 100);
|
|
93
|
-
console.log("✅ Deterministic consistency test:");
|
|
94
|
-
console.log(" Same seed, first value:", val1_1 === val2_1 ? "✅ MATCH" : "❌ MISMATCH");
|
|
95
|
-
console.log(" Same seed, second value:", val1_2 === val2_2 ? "✅ MATCH" : "❌ MISMATCH");
|
|
96
|
-
console.log("\n🎉 All Random Generation tests completed successfully!");
|
|
97
|
-
return {
|
|
98
|
-
success: true,
|
|
99
|
-
tests: {
|
|
100
|
-
randomString: randomStr,
|
|
101
|
-
randomBytes: Array.from(bytes)
|
|
102
|
-
.map((b) => b.toString(16).padStart(2, "0"))
|
|
103
|
-
.join(""),
|
|
104
|
-
randomInt: randomNum,
|
|
105
|
-
randomFloat: randomFloatVal,
|
|
106
|
-
randomBool: randomBoolVal,
|
|
107
|
-
randomUUID: uuid,
|
|
108
|
-
deterministic: {
|
|
109
|
-
int1: detInt1,
|
|
110
|
-
int2: detInt2,
|
|
111
|
-
float: detFloat,
|
|
112
|
-
bool: detBool,
|
|
113
|
-
string: detString,
|
|
114
|
-
guid: detGuid,
|
|
115
|
-
},
|
|
116
|
-
chance: {
|
|
117
|
-
int: chanceInt,
|
|
118
|
-
float: chanceFloat,
|
|
119
|
-
bool: chanceBool,
|
|
120
|
-
},
|
|
121
|
-
arrayUtils: {
|
|
122
|
-
choice,
|
|
123
|
-
shuffledLength: shuffled.length,
|
|
124
|
-
},
|
|
125
|
-
color,
|
|
126
|
-
password,
|
|
127
|
-
seedPhrase: seedPhrase.join(" "),
|
|
128
|
-
consistency: {
|
|
129
|
-
firstMatch: val1_1 === val2_1,
|
|
130
|
-
secondMatch: val1_2 === val2_2,
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
console.error("❌ Random Generation test error:", error);
|
|
137
|
-
return {
|
|
138
|
-
success: false,
|
|
139
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
// Run the test
|
|
144
|
-
testRandomGeneration()
|
|
145
|
-
.then((result) => {
|
|
146
|
-
console.log("\n📊 Final Result:");
|
|
147
|
-
console.log(JSON.stringify(result, null, 2));
|
|
148
|
-
})
|
|
149
|
-
.catch((error) => {
|
|
150
|
-
console.error("💥 Test execution failed:", error);
|
|
151
|
-
});
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ShogunCore Example with Existing Gun Instance
|
|
4
|
-
*
|
|
5
|
-
* This example shows how to use ShogunCore with an existing Gun instance.
|
|
6
|
-
* ShogunCore now requires an existing Gun instance to be passed in.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.shogunCoreExample = shogunCoreExample;
|
|
10
|
-
const index_1 = require("../index");
|
|
11
|
-
const core_1 = require("../core");
|
|
12
|
-
async function shogunCoreExample() {
|
|
13
|
-
console.log("🚀 ShogunCore Example with Existing Gun Instance\n");
|
|
14
|
-
// === STEP 1: CREATE GUN INSTANCE ===
|
|
15
|
-
console.log("📦 === CREATING GUN INSTANCE ===\n");
|
|
16
|
-
const peers = [
|
|
17
|
-
"https://g3ru5bwxmezpuu3ktnoclbpiw4.srv.us/gun",
|
|
18
|
-
"https://5eh4twk2f62autunsje4panime.srv.us/gun",
|
|
19
|
-
];
|
|
20
|
-
console.log(`Using peers: ${peers.join(", ")}`);
|
|
21
|
-
console.log("ℹ️ Note: If peers are unreachable, operations may timeout.");
|
|
22
|
-
console.log(" Consider using localStorage: true for offline testing.\n");
|
|
23
|
-
const gunInstance = (0, index_1.Gun)({
|
|
24
|
-
peers,
|
|
25
|
-
radisk: false,
|
|
26
|
-
localStorage: true, // Enable localStorage for offline operations and faster testing
|
|
27
|
-
// Reduce log noise from SEA verification errors (these are expected when checking invalid credentials)
|
|
28
|
-
log: () => { }, // Disable Gun.js console logging to reduce noise
|
|
29
|
-
});
|
|
30
|
-
console.log("✓ Gun instance created");
|
|
31
|
-
// === STEP 2: INITIALIZE SHOGUN CORE ===
|
|
32
|
-
console.log("\n🔧 === INITIALIZING SHOGUN CORE ===\n");
|
|
33
|
-
const shogun = new core_1.ShogunCore({
|
|
34
|
-
gunInstance: gunInstance, // Required: existing Gun instance
|
|
35
|
-
webauthn: {
|
|
36
|
-
enabled: true,
|
|
37
|
-
rpName: "ShogunCore Example",
|
|
38
|
-
},
|
|
39
|
-
web3: {
|
|
40
|
-
enabled: true,
|
|
41
|
-
},
|
|
42
|
-
silent: false, // Enable console logs
|
|
43
|
-
});
|
|
44
|
-
console.log("✓ ShogunCore initialized with existing Gun instance");
|
|
45
|
-
// === STEP 3: USE SHOGUN CORE ===
|
|
46
|
-
console.log("\n🎯 === USING SHOGUN CORE ===\n");
|
|
47
|
-
// Access the database
|
|
48
|
-
const db = shogun.db;
|
|
49
|
-
console.log("Database available:", !!db);
|
|
50
|
-
// Check if user is logged in
|
|
51
|
-
console.log("User logged in:", shogun.isLoggedIn());
|
|
52
|
-
// Example: Sign up a new user
|
|
53
|
-
console.log("\n--- Sign Up Example ---");
|
|
54
|
-
const username = `testuser_${Date.now()}`;
|
|
55
|
-
const password = "testpass123";
|
|
56
|
-
console.log(`Attempting signup for: ${username}`);
|
|
57
|
-
console.log("⏳ This may take up to 30 seconds if peers are unreachable...\n");
|
|
58
|
-
let signupResult;
|
|
59
|
-
try {
|
|
60
|
-
const signupStartTime = Date.now();
|
|
61
|
-
signupResult = await shogun.signUp(username, password);
|
|
62
|
-
const signupDuration = Date.now() - signupStartTime;
|
|
63
|
-
if (signupResult.success) {
|
|
64
|
-
console.log(`✓ User signed up successfully in ${signupDuration}ms`);
|
|
65
|
-
console.log(" Username:", signupResult.username);
|
|
66
|
-
console.log(" UserPub:", signupResult.userPub?.substring(0, 20) + "...");
|
|
67
|
-
console.log(" Has SEA Pair:", !!signupResult.sea);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
console.log(`❌ Sign up failed after ${signupDuration}ms`);
|
|
71
|
-
console.log(" Error:", signupResult.error);
|
|
72
|
-
console.log("\n💡 Troubleshooting:");
|
|
73
|
-
console.log(" - Check if username already exists");
|
|
74
|
-
console.log(" - Verify network connection to peers");
|
|
75
|
-
console.log(" - Try with localStorage: true for offline testing");
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
console.log("❌ Sign up exception:", error);
|
|
80
|
-
console.log(" Error type:", error instanceof Error ? error.constructor.name : typeof error);
|
|
81
|
-
signupResult = { success: false, error: String(error) };
|
|
82
|
-
}
|
|
83
|
-
// Example: Login (only if signup succeeded or user already exists)
|
|
84
|
-
console.log("\n--- Login Example ---");
|
|
85
|
-
const canLogin = signupResult?.success || signupResult?.error?.includes("already");
|
|
86
|
-
if (canLogin) {
|
|
87
|
-
if (signupResult?.success) {
|
|
88
|
-
console.log("✓ User created, attempting login...");
|
|
89
|
-
}
|
|
90
|
-
else if (signupResult?.error?.includes("already")) {
|
|
91
|
-
console.log("ℹ️ User already exists, attempting login...");
|
|
92
|
-
}
|
|
93
|
-
try {
|
|
94
|
-
console.log("⏳ Login may take up to 30 seconds if peers are unreachable...");
|
|
95
|
-
const loginStartTime = Date.now();
|
|
96
|
-
const loginResult = await shogun.login(username, password);
|
|
97
|
-
const loginDuration = Date.now() - loginStartTime;
|
|
98
|
-
if (loginResult.success) {
|
|
99
|
-
console.log(`✓ User logged in successfully in ${loginDuration}ms`);
|
|
100
|
-
console.log(" Username:", loginResult.username);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
console.log(`❌ Login failed after ${loginDuration}ms`);
|
|
104
|
-
console.log(" Error:", loginResult.error);
|
|
105
|
-
console.log("\n💡 Troubleshooting:");
|
|
106
|
-
console.log(" - Verify username and password are correct");
|
|
107
|
-
console.log(" - Check network connection to peers");
|
|
108
|
-
console.log(" - User may not have been created successfully");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
console.log("❌ Login exception:", error);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
console.log("⚠️ Skipping login - signup failed:", signupResult?.error);
|
|
117
|
-
}
|
|
118
|
-
// Example: Check current user
|
|
119
|
-
console.log("\n--- Current User ---");
|
|
120
|
-
const isLoggedInNow = shogun.isLoggedIn();
|
|
121
|
-
const currentUser = shogun.getCurrentUser();
|
|
122
|
-
console.log("Is logged in:", isLoggedInNow);
|
|
123
|
-
if (currentUser) {
|
|
124
|
-
console.log("Current user:", {
|
|
125
|
-
pub: currentUser.pub?.substring(0, 20) + "..." || "N/A",
|
|
126
|
-
hasUser: !!currentUser.user,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
console.log("Current user: null (not logged in)");
|
|
131
|
-
}
|
|
132
|
-
// Example: Logout
|
|
133
|
-
console.log("\n--- Logout Example ---");
|
|
134
|
-
if (isLoggedInNow) {
|
|
135
|
-
shogun.logout();
|
|
136
|
-
console.log("✓ User logged out");
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
console.log("ℹ️ No user to logout");
|
|
140
|
-
}
|
|
141
|
-
console.log("\n🎉 Example completed!");
|
|
142
|
-
console.log("\n💡 Tips:");
|
|
143
|
-
console.log(" - Enable localStorage: true for offline testing");
|
|
144
|
-
console.log(" - Use unique usernames to avoid conflicts");
|
|
145
|
-
console.log(" - Timeout errors usually indicate peer connectivity issues");
|
|
146
|
-
}
|
|
147
|
-
// Run the example
|
|
148
|
-
if (require.main === module) {
|
|
149
|
-
shogunCoreExample().catch(console.error);
|
|
150
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Signal Protocol test
|
|
4
|
-
const crypto_1 = require("../crypto");
|
|
5
|
-
// Test Signal Protocol
|
|
6
|
-
async function testSignalProtocol() {
|
|
7
|
-
try {
|
|
8
|
-
console.log("📡 Starting Signal Protocol test...");
|
|
9
|
-
const result = await (0, crypto_1.demonstrateSignalProtocol)();
|
|
10
|
-
if (result.success) {
|
|
11
|
-
console.log("✅ Signal Protocol test successful!");
|
|
12
|
-
console.log("Alice and Bob have the same secret:", result.aliceSecret === result.bobSecret);
|
|
13
|
-
console.log("One-time prekey used:", result.usedOneTimePrekey);
|
|
14
|
-
console.log("Alice secret (first 20 chars):", result.aliceSecret.substring(0, 20) + "...");
|
|
15
|
-
console.log("Bob secret (first 20 chars):", result.bobSecret.substring(0, 20) + "...");
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
console.log("❌ Signal Protocol test failed");
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
console.error("❌ Signal Protocol test error:", error);
|
|
24
|
-
return {
|
|
25
|
-
success: false,
|
|
26
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
// Run the test
|
|
31
|
-
testSignalProtocol()
|
|
32
|
-
.then((result) => {
|
|
33
|
-
console.log("\n📊 Signal Protocol Result:");
|
|
34
|
-
console.log(JSON.stringify(result, null, 2));
|
|
35
|
-
})
|
|
36
|
-
.catch((error) => {
|
|
37
|
-
console.error("💥 Signal Protocol test execution failed:", error);
|
|
38
|
-
});
|