@exodus/key-utils
Advanced tools
Comparing version
@@ -6,87 +6,62 @@ # Change Log | ||
## [3.6.1](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@3.6.0...@exodus/key-utils@3.6.1) (2024-07-31) | ||
## 3.7.0 (2024-10-03) | ||
### Features | ||
### Bug Fixes | ||
- update bip32 in key-utils ([#1162](https://github.com/ExodusMovement/exodus-hydra/issues/9602)) ([5d4a2cb](https://github.com/ExodusMovement/exodus-hydra/commit/5d4a2cb2b1ecc96f4246f9bdaca488cf09d8733d)) | ||
* `Symbol.toStringTag` usage in DerivationPath ([#1290](https://github.com/ExodusMovement/exodus-core/issues/1290)) ([99c4757](https://github.com/ExodusMovement/exodus-core/commit/99c4757808c4bc987d294f9baffa4c9dd82b49a4)) | ||
## [3.6.1](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@3.6.0...@exodus/key-utils@3.6.1) (2024-07-31) | ||
### Bug Fixes | ||
- `Symbol.toStringTag` usage in DerivationPath ([#1290](https://github.com/ExodusMovement/exodus-core/issues/1290)) ([99c4757](https://github.com/ExodusMovement/exodus-core/commit/99c4757808c4bc987d294f9baffa4c9dd82b49a4)) | ||
## [3.6.0](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@3.5.1...@exodus/key-utils@3.6.0) (2024-07-31) | ||
### Features | ||
* add method to get path index ([#1291](https://github.com/ExodusMovement/exodus-core/issues/1291)) ([77f1fb6](https://github.com/ExodusMovement/exodus-core/commit/77f1fb615f8d31901eec8396ad031e405863b239)) | ||
- add method to get path index ([#1291](https://github.com/ExodusMovement/exodus-core/issues/1291)) ([77f1fb6](https://github.com/ExodusMovement/exodus-core/commit/77f1fb615f8d31901eec8396ad031e405863b239)) | ||
## [3.5.1](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@3.5.0...@exodus/key-utils@3.5.1) (2024-07-05) | ||
### Bug Fixes | ||
* make key-utils a proper ESM package ([#1214](https://github.com/ExodusMovement/exodus-core/issues/1214)) ([53ecfdf](https://github.com/ExodusMovement/exodus-core/commit/53ecfdf7d9f6041ddb8d82d088552125131d3ab4)) | ||
- make key-utils a proper ESM package ([#1214](https://github.com/ExodusMovement/exodus-core/issues/1214)) ([53ecfdf](https://github.com/ExodusMovement/exodus-core/commit/53ecfdf7d9f6041ddb8d82d088552125131d3ab4)) | ||
## [3.5.0](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@3.4.0...@exodus/key-utils@3.5.0) (2024-07-04) | ||
### Features | ||
* add `replaceAtIndex` ([#1211](https://github.com/ExodusMovement/exodus-core/issues/1211)) ([015309f](https://github.com/ExodusMovement/exodus-core/commit/015309fb8b9cd9b9f934dd0486a77c7d744d819b)) | ||
- add `replaceAtIndex` ([#1211](https://github.com/ExodusMovement/exodus-core/issues/1211)) ([015309f](https://github.com/ExodusMovement/exodus-core/commit/015309fb8b9cd9b9f934dd0486a77c7d744d819b)) | ||
## [3.4.0](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@3.3.0...@exodus/key-utils@3.4.0) (2024-06-04) | ||
### Features | ||
* parse full address paths in parseDerivationPath ([#1192](https://github.com/ExodusMovement/exodus-core/issues/1192)) ([a60f288](https://github.com/ExodusMovement/exodus-core/commit/a60f28811c3e8cb223beadf00e2e190c6ad5ffa0)) | ||
- parse full address paths in parseDerivationPath ([#1192](https://github.com/ExodusMovement/exodus-core/issues/1192)) ([a60f288](https://github.com/ExodusMovement/exodus-core/commit/a60f28811c3e8cb223beadf00e2e190c6ad5ffa0)) | ||
## [3.3.0](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@3.2.1...@exodus/key-utils@3.3.0) (2024-05-07) | ||
### Features | ||
* add `DerivationPath` class ([#1162](https://github.com/ExodusMovement/exodus-core/issues/1162)) ([74f2b77](https://github.com/ExodusMovement/exodus-core/commit/74f2b77e18781fffbf1ba0a541db31578308079d)) | ||
- add `DerivationPath` class ([#1162](https://github.com/ExodusMovement/exodus-core/issues/1162)) ([74f2b77](https://github.com/ExodusMovement/exodus-core/commit/74f2b77e18781fffbf1ba0a541db31578308079d)) | ||
## [3.2.1](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@3.2.0...@exodus/key-utils@3.2.1) (2024-04-09) | ||
### Bug Fixes | ||
* default allowXPUB to true for bip32 + secp256k1 ([#1143](https://github.com/ExodusMovement/exodus-core/issues/1143)) ([f717af5](https://github.com/ExodusMovement/exodus-core/commit/f717af582c4e3f0b54bd32ebe74fab8ed24d7391)) | ||
- default allowXPUB to true for bip32 + secp256k1 ([#1143](https://github.com/ExodusMovement/exodus-core/issues/1143)) ([f717af5](https://github.com/ExodusMovement/exodus-core/commit/f717af582c4e3f0b54bd32ebe74fab8ed24d7391)) | ||
# [3.2.0](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@3.1.0...@exodus/key-utils@3.2.0) (2024-02-27) | ||
### Features | ||
* add `getSeedId` ([#1096](https://github.com/ExodusMovement/exodus-core/issues/1096)) ([f59ecf4](https://github.com/ExodusMovement/exodus-core/commit/f59ecf4bca74265bab0f93191bf22d04e7f1af90)) | ||
- add `getSeedId` ([#1096](https://github.com/ExodusMovement/exodus-core/issues/1096)) ([f59ecf4](https://github.com/ExodusMovement/exodus-core/commit/f59ecf4bca74265bab0f93191bf22d04e7f1af90)) | ||
# [3.1.0](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@3.0.0...@exodus/key-utils@3.1.0) (2023-08-23) | ||
### Features | ||
* **key-utils:** add xpub & multi address support ([#936](https://github.com/ExodusMovement/exodus-core/issues/936)) ([b06bf9a](https://github.com/ExodusMovement/exodus-core/commit/b06bf9afa2c2aaf9b261893d34c4ddaf243d5db0)) | ||
- **key-utils:** add xpub & multi address support ([#936](https://github.com/ExodusMovement/exodus-core/issues/936)) ([b06bf9a](https://github.com/ExodusMovement/exodus-core/commit/b06bf9afa2c2aaf9b261893d34c4ddaf243d5db0)) | ||
## [3.0.0](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@2.0.0...@exodus/key-utils@3.0.0) (2023-08-11) | ||
@@ -96,8 +71,4 @@ | ||
* feat(key-utils)!: derivation path logic ([#926](https://github.com/ExodusMovement/exodus-core/issues/926)) ([22edf4e](https://github.com/ExodusMovement/exodus-core/commit/22edf4e2a8acd7ed2ef62b925f7ddf2d892aeab2)) | ||
- feat(key-utils)!: derivation path logic ([#926](https://github.com/ExodusMovement/exodus-core/issues/926)) ([22edf4e](https://github.com/ExodusMovement/exodus-core/commit/22edf4e2a8acd7ed2ef62b925f7ddf2d892aeab2)) | ||
## [2.0.0](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@1.0.1...@exodus/key-utils@2.0.0) (2023-07-19) | ||
@@ -107,11 +78,6 @@ | ||
## [1.0.1](https://github.com/ExodusMovement/exodus-core/compare/@exodus/key-utils@1.0.0...@exodus/key-utils@1.0.1) (2023-07-18) | ||
### Bug Fixes | ||
* allow trezor compat mode ([#899](https://github.com/ExodusMovement/exodus-core/issues/899)) ([7ab4dbe](https://github.com/ExodusMovement/exodus-core/commit/7ab4dbeb3c14f7e9750520c75457b066d4e006e5)) | ||
- allow trezor compat mode ([#899](https://github.com/ExodusMovement/exodus-core/issues/899)) ([7ab4dbe](https://github.com/ExodusMovement/exodus-core/commit/7ab4dbeb3c14f7e9750520c75457b066d4e006e5)) |
{ | ||
"name": "@exodus/key-utils", | ||
"version": "3.6.1", | ||
"author": "Exodus Movement Inc", | ||
"version": "3.7.0", | ||
"author": "Exodus Movement, Inc.", | ||
"description": "Utilities to manage derivation paths and key identifier aspects.", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ExodusMovement/exodus-core.git" | ||
"url": "git+https://github.com/ExodusMovement/exodus-hydra.git" | ||
}, | ||
"homepage": "https://github.com/ExodusMovement/exodus-core/tree/master/packages/key-utils", | ||
"homepage": "https://github.com/ExodusMovement/exodus-hydra/tree/master/libraries/key-utils", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ExodusMovement/exodus-core/issues?q=is%3Aissue+is%3Aopen+label%3Akey-utils" | ||
"url": "https://github.com/ExodusMovement/exodus-hydra/issues?q=is%3Aissue+is%3Aopen+label%3Akey-utils" | ||
}, | ||
@@ -27,12 +27,11 @@ "type": "module", | ||
"test": "run -T exodus-test --jest", | ||
"lint": "run -T eslint . --ignore-path ../../.gitignore", | ||
"lint": "run -T eslint .", | ||
"lint:fix": "yarn lint --fix" | ||
}, | ||
"dependencies": { | ||
"@exodus/bip32": "^2.1.0", | ||
"@exodus/hdkey": "^2.1.0-exodus.0", | ||
"@exodus/bip32": "^3.3.0", | ||
"bip32-path": "^0.4.2", | ||
"minimalistic-assert": "^1.0.1" | ||
}, | ||
"gitHead": "88766818be9c56d1087a66d58cb3e9034934d32c" | ||
"gitHead": "9a53234070791ffabcda667a1ed67b67a732a83f" | ||
} |
import BIPPath from 'bip32-path' | ||
import assert from 'minimalistic-assert' | ||
import HDKey from '@exodus/hdkey' | ||
import { HARDENED_OFFSET } from '@exodus/bip32' | ||
import { BIP32_PURPOSES } from './constants.js' | ||
@@ -152,3 +152,3 @@ | ||
if (hardeningChar === "'") { | ||
return Number(unhardenedIndex) + HDKey.HARDENED_OFFSET | ||
return Number(unhardenedIndex) + HARDENED_OFFSET | ||
} | ||
@@ -172,4 +172,4 @@ | ||
const unharden = (index) => index - HDKey.HARDENED_OFFSET | ||
const isHardened = (index) => index >= HDKey.HARDENED_OFFSET | ||
const unharden = (index) => index - HARDENED_OFFSET | ||
const isHardened = (index) => index >= HARDENED_OFFSET | ||
@@ -181,11 +181,9 @@ export const parseDerivationPath = (path) => { | ||
).toPathArray() | ||
purpose -= HDKey.HARDENED_OFFSET | ||
coinIndex -= HDKey.HARDENED_OFFSET | ||
accountIndex -= HDKey.HARDENED_OFFSET | ||
purpose -= HARDENED_OFFSET | ||
coinIndex -= HARDENED_OFFSET | ||
accountIndex -= HARDENED_OFFSET | ||
// some assets are so naughty | ||
if (chainIndex !== undefined && chainIndex >= HDKey.HARDENED_OFFSET) | ||
chainIndex -= HDKey.HARDENED_OFFSET | ||
if (addressIndex !== undefined && addressIndex >= HDKey.HARDENED_OFFSET) | ||
addressIndex -= HDKey.HARDENED_OFFSET | ||
if (chainIndex !== undefined && chainIndex >= HARDENED_OFFSET) chainIndex -= HARDENED_OFFSET | ||
if (addressIndex !== undefined && addressIndex >= HARDENED_OFFSET) addressIndex -= HARDENED_OFFSET | ||
@@ -294,3 +292,3 @@ return { | ||
export const unhardenDerivationIndex = (hardenedIndex) => { | ||
return hardenedIndex - HDKey.HARDENED_OFFSET | ||
return hardenedIndex - HARDENED_OFFSET | ||
} |
@@ -13,6 +13,3 @@ import assert from 'minimalistic-assert' | ||
export const assertKeyIdentifierParameters = ( | ||
params, | ||
rules = {} // eslint-disable-line unicorn/no-object-as-default-parameter | ||
) => { | ||
export const assertKeyIdentifierParameters = (params, rules = {}) => { | ||
assert(isSafeObject(params), 'arguments for getKeyIdentifier were not an object') | ||
@@ -44,5 +41,5 @@ assert(isSafeObject(rules), 'rules for getKeyIdentifier were not an object') | ||
) | ||
assert(isSafeNonNegativeInteger(accountIndex), 'accountIndex must be a positive integer') | ||
assert(isSafeNonNegativeInteger(accountIndex), 'accountIndex must be a non-negative integer') | ||
if (chainIndex !== undefined) { | ||
assert(isSafeNonNegativeInteger(chainIndex), 'chainIndex must be a positive integer') | ||
assert(isSafeNonNegativeInteger(chainIndex), 'chainIndex must be a non-negative integer') | ||
@@ -56,3 +53,3 @@ assert( | ||
if (addressIndex !== undefined) { | ||
assert(isSafeNonNegativeInteger(addressIndex), 'addressIndex must be a positive integer') | ||
assert(isSafeNonNegativeInteger(addressIndex), 'addressIndex must be a non-negative integer') | ||
@@ -59,0 +56,0 @@ if (!allowMultipleAddresses) { |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
20371
0.11%3
-25%353
-1.4%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated