bitcore
bitcore copied to clipboard
Draft: [BC/CWC] Wallet private key updates [1]
bitcore-client
Encryption
- adds encryptBuffer - enables normalized buffer input
- adds decryptToBuffer - enables improved security by not decrypting directly to string
Storage
- adds
addKeysSafe- incoming keys' private key is encrypted, so not immediately available to be used to retrieve pubkey, which should be available anyway. Throws if missing a pubkey
Wallet
- Adds version: 2 & version checks for backwards compatibility (note: to create an old Wallet would require version: 0 - so 1 is skipped - looking for feedback on numbering/versioning).
-
createencrypts HDPrivateKey xprivkey and privateKey so they can be decrypted as buffers instead of serializing the whole masterKey and THEN encrypting -
importKeysdoes the same for signing keys -
signTxdecrypts to buffers then uses deriver for chain-aware decoding. In the next phase, this decoding should be made unnecessary by passing the buffer all the way through to use, if possible
Tests
- update prior tests to include versioning
- introduce new tests for version 2 specifics
crypto-wallet-core
Derivation
- Add two passthrough methods on DeriverProxy to buffer & serialize private keys
- Adds
privateKeyToBufferandprivateKeyBufferToNativePrivateKeyto IDeriver & implement for each Deriver - no need to override for any of the extending classes (UTXOs to AbstractBitcoreLibDeriver & EVM to EthDeriver)