733ecd2681
Add root Cargo workspace with 9 crates: salvium-crypto (extended), salvium-types, salvium-consensus, salvium-wallet, salvium-tx, salvium-rpc, salvium-miner (extended), salvium-cli, salvium-multisig. New modules: chain_state, block_weight, alt_chain, validation, offline signing, stake lifecycle, wallet sync/query/encryption/utxo, randomx utilities, and full multisig crate with CARROT support. Delete 188 JS test/helper/debug files; archive integration test scripts to test/legacy-js/ for live testnet use. Testnet integration tests (transfer, stake, burn, convert, sweep) remain as #[ignore]- gated Rust tests runnable with --ignored against a live daemon.
39 lines
5.9 KiB
JavaScript
39 lines
5.9 KiB
JavaScript
|
|
import { Wallet } from '../src/wallet.js';
|
|
import { setCryptoBackend } from '../src/crypto/index.js';
|
|
await setCryptoBackend('wasm');
|
|
|
|
const w = Wallet.create({ network: 'mainnet' });
|
|
|
|
console.log('salvium-js v0.5.0');
|
|
console.log('─'.repeat(50));
|
|
console.log();
|
|
console.log('Wallet Security:');
|
|
console.log(' Encryption at rest: ML-KEM-768 (CRYSTALS-Kyber)');
|
|
console.log(' Key derivation: Argon2id (64 MB, 3 iterations)');
|
|
console.log(' Symmetric cipher: AES-256-GCM');
|
|
console.log(' Hybrid scheme: PQ-KEM + classical KDF');
|
|
console.log();
|
|
console.log('Protocol Support:');
|
|
console.log(' Address formats: CryptoNote (SaLv) + CARROT (SC1)');
|
|
console.log(' Transaction types: Transfer, Sweep, Stake, Burn, Convert');
|
|
console.log(' Ring signatures: TCLSAG (16-member rings)');
|
|
console.log(' Range proofs: Bulletproofs+');
|
|
console.log(' Amount hiding: Pedersen commitments');
|
|
console.log();
|
|
|
|
// Time the encrypt/decrypt
|
|
const start = performance.now();
|
|
const enc = w.toEncryptedJSON('benchmark');
|
|
const mid = performance.now();
|
|
Wallet.fromEncryptedJSON(enc, 'benchmark');
|
|
const end = performance.now();
|
|
|
|
console.log('Performance:');
|
|
console.log(' PQ encrypt wallet: ' + (mid - start).toFixed(0) + ' ms');
|
|
console.log(' PQ decrypt wallet: ' + (end - mid).toFixed(0) + ' ms');
|
|
console.log(' Kyber ciphertext: ' + (enc.encryption.kyberCiphertext.length / 2) + ' bytes');
|
|
console.log();
|
|
console.log('Your keys are quantum-safe. Are yours?');
|
|
|