Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bippath

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bippath - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

12

index.js

@@ -10,3 +10,13 @@ /*

BIPPath.validateString = function (text) {
try {
BIPPath.fromString(text)
return true
} catch (e) {
return false
}
}
BIPPath.fromTrezor = function (path) {
// FIXME: check input?
return new BIPPath(path)

@@ -31,2 +41,4 @@ }

ret[i] |= 0x80000000
} else if (tmp[2].length != 0) {
throw new Error('Invalid modifier')
}

@@ -33,0 +45,0 @@ }

2

package.json
{
"name": "bippath",
"version": "0.1.0",
"version": "0.2.0",
"description": "Bitcoin BIP32 ('HD Wallet') path helpers.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,6 +11,6 @@ # BIPPath

Some useful links:
- [https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki](BIP32)
- [https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki](BIP44)
- [https://dcpos.github.io/bip39/](BIP39, an online tool to convert/derive keys)
- [https://bip32jp.github.io/english/index.html](BIP32JP, an online tool to convert/derive keys)
- [BIP32 specification](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
- [BIP44 specification](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)
- [BIP39, an online tool to convert/derive keys](https://dcpos.github.io/bip39/)
- [BIP32JP, an online tool to convert/derive keys](https://bip32jp.github.io/english/index.html)

@@ -25,2 +25,3 @@

- `<bippath>.toString(noRoot, oldStyle)` - returns a text encoded path. Set to `noRoot` to true to omit the `m/` prefix. Set `oldStyle` true to use `h` instead of `'` for marking hardened nodes.
- `BIPPath.validateString(path)` - returns true if the input is a valid path

@@ -27,0 +28,0 @@ Trezor-style arrays contain each node as a separate number, where hardened nodes are marked by setting the 32th bit: `m/44'/1/1/0` corresponds to `[ 44 | 0x80000000, 1, 1, 0 ]`

@@ -44,1 +44,15 @@ /* global describe, it */

})
describe('validateString()', function () {
it('should work', function () {
assert.equal(bippath.validateString('m/44/1'), true);
assert.equal(bippath.validateString('m/44\'/1'), true);
assert.equal(bippath.validateString('44/1'), true);
assert.equal(bippath.validateString('44\'/1'), true);
})
it('should fail', function () {
assert.equal(bippath.validateString('wrong'), false);
assert.equal(bippath.validateString('m/44 /'), false);
assert.equal(bippath.validateString(''), false);
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc