Chris Duncan [Mon, 18 Nov 2024 21:48:07 +0000 (13:48 -0800)]
Move performance tests to separate file. Move warning about sending funds to test vectors into TEST_VECTORS file only. In Wallet class, expand documentation of accounts method.
Chris Duncan [Mon, 18 Nov 2024 20:15:01 +0000 (12:15 -0800)]
Refactor passkey function to immediately execute polyfill if needed and export the function as a data URL string instead of a blob URL which doesn't work for creating workers. Test replacing key creation in Safe class with message to worker. Add data shape checks to wallet creation test. Add wallet gen performance tests.
Chris Duncan [Mon, 18 Nov 2024 18:02:46 +0000 (10:02 -0800)]
Create web worker to generate AES-GCM keys for locking wallets and accounts since generating them from a password involves the long-running PBKDF2 process.
Chris Duncan [Mon, 18 Nov 2024 14:21:03 +0000 (06:21 -0800)]
In BIP-32/44 keygen, add type guard against input to serialization functions and replace positional set of typed array with padding argument in call to Convert function. In Safe class, fix session storage reference. In Tools class, remove littleEndian function deprecated by bugfix. In Wallet class, substitute blakejs package for blake2b-wasm; refer to getter for Ledger service instead of private property; throw error if Ledger account ckd fails so that parent abstract ckd method can return an Account guaranteed; refactor accounts function to save an allocation; add type guard to ckd implementations; remove unused imports. In TEST_VECTORS, move session storage custom polyfill for testing to separate GLOBALS file; document source of Trezor test vectors; tweak names of constants for clarity when using. In tests, use new GLOBALS file; add ckd performance test for generating 2^15 accounts; fix BLAKE2b ckd tests by adding more public/private key checks; skip sweep tool test since it can cause test failures due to node limits; reorganize wallet generation and account derivation test suites to separate concerns; remove unknown test vectors from original library.
Chris Duncan [Wed, 6 Nov 2024 07:08:21 +0000 (23:08 -0800)]
Nano spec indicates account derivation should use index in unsigned 32-bit big endian format. This is opposite of many processor architectures, so add a check for endianness for BLAKE2b wallet accounts. Also move function to be in alphabetical order.
Chris Duncan [Sun, 13 Oct 2024 09:11:46 +0000 (02:11 -0700)]
Update Safe to use browser session storage. Mock global sessionStorage in tests. Update wallet to pack ID and both secrets in one JSON object when locking and unpack it all when unlocking.
Chris Duncan [Tue, 8 Oct 2024 09:02:56 +0000 (02:02 -0700)]
Return bigint directly from account properties to let consumers do math on the raw amounts since they can call toString() if necessary. Allow bigint to be passed to denomination converter and explicitly check its amount type.
Chris Duncan [Thu, 3 Oct 2024 09:10:17 +0000 (02:10 -0700)]
libname: A reimagining of the nanocurrency-web package.
Greater Changes
* Completely replace crypto-js dependency with the browser native Web Crypto API.
* Overhaul wallet system to align more with object-oriented design and to consolidate related but separated functionality.
* Add support for Ledger hardware wallets.
* Encrypt wallet secrets by default on initialization, and add lock/unlock feature to encrypt/decrypt on-demand.
* Add rolodex feature to enable contact management including signature verification using contact name associated with a public key in your rolodex.
* Add online functions to interact with nodes like fetching account info, generating PoW, and sending blocks for processing.
* Add sweep feature similar to the offering from Nault which sends all funds in a specified range of accounts in a wallet to a specific address.
* Refactor key derivation functions to align closer with spec as designed in the relevant BIPs.
* Adopt GPLv3 license and achieve REUSE compliance.
Lesser Changes
* Refactor as ESM instead of CJS and build for ESMNext target to enable more modern browser features.
* Utilize browser native features like bigint instead of bignumber.js dependency.
* Deprecate 'box' feature and with it the dependency on byte-base64.
* Replace chai/mocha test framework with built-in Node.js test runner, and add tons of tests.
* Replace webpack (and dependency ts-loader) with esbuild which offers faster builds and minification.
* Add online function to get the next unopened account of a wallet with the idea that a business could distribute addresses to customers in a custodial manner.
* Add tons of type checking to validate inputs and outputs.
* Deprecate lots of unused code or replace with native features.
Chris Duncan [Sat, 31 Aug 2024 20:13:26 +0000 (13:13 -0700)]
Fix module imports. Replace arrow functions on 'describe' calls since they mess up 'this' and prevent test data setup. Set mocha 'slow' to zero in order to report all test durations.
* Added new functionality to encrypt/decrypt strings with Diffie-Hellman
key exchange with Nano addresses and private keys by converting the keys
to Curve25519 keys suitable for encryption and using Box functionality
from NaCl. The library will generate a random nonce to each encryption
and pass the nonce along with the encrypted message encoded in Base64
* Some code refactoring (use static classes and make sure ed25519 and
curve classes are always freshly created)
* New feature: verify signatures with the public key
* New feature: convert nano address to a public key
* Add documentation about how to verify ownership of user's Nano address
by doing a signature challenge
* npm audit fix
Miro Metsänheimo [Tue, 12 Jan 2021 20:30:58 +0000 (22:30 +0200)]
Version 1.3.0
* Add the possibility to generate legacy seeds and mnemonics
* Add the possibility to import legacy mnemonic phrases
* Stop throwing errors if given an upper case hex as input
* Return mnemonic also when creating wallet with a legacy seed
* npm audit fix
* Small refactoring
Miro Metsänheimo [Wed, 27 May 2020 20:03:12 +0000 (23:03 +0300)]
Version 1.2.1
* Fixed an issue where address importer threw an error on mnemonic words
that had a checksum hex value with a leading zero
* Added the possibility to validate mnemonic words and nano addresses
* Separate block signer to it's own class
* Add JSDOC to some functions
* Renamed converter to tools
* Added the ability to sign any strings with the private key