Skip to content

Commit

Permalink
Merge branch '1.0.0' into dependabot-npm_and_yarn-1.0.0-scure-bip39-1…
Browse files Browse the repository at this point in the history
….5.1
  • Loading branch information
fabiorigam authored Jan 23, 2025
2 parents b2c1c05 + 9999f37 commit e6a5d81
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 42 deletions.
2 changes: 1 addition & 1 deletion apps/sdk-vite-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/browser": "^2.1.5",
"@vitest/browser": "^2.1.8",
"eslint": "^9.13.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
workerThreads: true,
coverageThreshold: {
global: {
branches: 95,
branches: 94,
functions: 97,
lines: 97,
statements: 97
Expand Down
15 changes: 3 additions & 12 deletions packages/core/src/hdkey/HDKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,24 +234,15 @@ class HDKey extends s_bip32.HDKey {
}

/**
* Checks if derivation path is valid.
* Checks if BIP32 derivation path is valid.
*
* @param derivationPath - Derivation path to check.
*
* @returns `true` if derivation path is valid, otherwise `false`.
*/
public static isDerivationPathValid(derivationPath: string): boolean {
// Split derivation path into parts
const pathComponents = derivationPath.split('/');

// Check each component
for (let i = 0; i < pathComponents.length; i++) {
// If single component is not valid, return false
if (!this.isDerivationPathComponentValid(pathComponents[i], i))
return false;
}

return true;
const bip32Regex = /^m(\/\d+'?){3}(\/\d+){1,2}$/;
return bip32Regex.test(derivationPath);
}
}

Expand Down
11 changes: 7 additions & 4 deletions packages/core/tests/hdkey/HDKey.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ const HDKeyFixture = {
correctValidationPaths: [
HDKey.VET_DERIVATION_PATH,
'm/0/1/2/3/4',
"m/0'/1'/2'/3'/4'",
"m/0'/1'/2'/3'/4",
"m/0'/1'/2/3'/4'"
"m/0'/1'/2'/3/4",
"m/44'/60'/0'/0/0",
"m/44'/60'/0'/0",
'm/0/1/2/3'
],

/**
Expand All @@ -64,7 +65,9 @@ const HDKeyFixture = {
'm/0/b',
'incorrect',
'inco/rre/01/ct',
'0/1/4/2/4/h'
'0/1/4/2/4/h',
'1/0/1',
"m/0'/1'/2/3'/4'"
]
};

Expand Down
48 changes: 24 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5453,15 +5453,15 @@
"@types/babel__core" "^7.20.5"
react-refresh "^0.14.2"

"@vitest/browser@^2.1.5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@vitest/browser/-/browser-2.1.5.tgz#3e3bf7b93b17dcb6a35174ae12a594af98a4be25"
integrity sha512-JrpnxvkrjlBrF7oXbK/YytWVYfJIzWYeDKppANlUaisBKwDso+yXlWocAJrANx8gUxyirF355Yx80S+SKQqayg==
"@vitest/browser@^2.1.8":
version "2.1.8"
resolved "https://registry.yarnpkg.com/@vitest/browser/-/browser-2.1.8.tgz#c87cf383eb5b6f3630f5654767f8525413b53c74"
integrity sha512-OWVvEJThRgxlNMYNVLEK/9qVkpRcLvyuKLngIV3Hob01P56NjPHprVBYn+rx4xAJudbM9yrCrywPIEuA3Xyo8A==
dependencies:
"@testing-library/dom" "^10.4.0"
"@testing-library/user-event" "^14.5.2"
"@vitest/mocker" "2.1.5"
"@vitest/utils" "2.1.5"
"@vitest/mocker" "2.1.8"
"@vitest/utils" "2.1.8"
magic-string "^0.30.12"
msw "^2.6.4"
sirv "^3.0.0"
Expand All @@ -5487,12 +5487,12 @@
estree-walker "^3.0.3"
magic-string "^0.30.12"

"@vitest/[email protected].5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@vitest/mocker/-/mocker-2.1.5.tgz#54ee50648bc0bb606dfc58e13edfacb8b9208324"
integrity sha512-XYW6l3UuBmitWqSUXTNXcVBUCRytDogBsWuNXQijc00dtnU/9OqpXWp4OJroVrad/gLIomAq9aW8yWDBtMthhQ==
"@vitest/[email protected].8":
version "2.1.8"
resolved "https://registry.yarnpkg.com/@vitest/mocker/-/mocker-2.1.8.tgz#51dec42ac244e949d20009249e033e274e323f73"
integrity sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA==
dependencies:
"@vitest/spy" "2.1.5"
"@vitest/spy" "2.1.8"
estree-walker "^3.0.3"
magic-string "^0.30.12"

Expand All @@ -5503,10 +5503,10 @@
dependencies:
tinyrainbow "^1.2.0"

"@vitest/[email protected].5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-2.1.5.tgz#bc79b8826d4a63dc04f2a75d2944694039fa50aa"
integrity sha512-4ZOwtk2bqG5Y6xRGHcveZVr+6txkH7M2e+nPFd6guSoN638v/1XQ0K06eOpi0ptVU/2tW/pIU4IoPotY/GZ9fw==
"@vitest/[email protected].8":
version "2.1.8"
resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-2.1.8.tgz#88f47726e5d0cf4ba873d50c135b02e4395e2bca"
integrity sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ==
dependencies:
tinyrainbow "^1.2.0"

Expand Down Expand Up @@ -5534,10 +5534,10 @@
dependencies:
tinyspy "^3.0.2"

"@vitest/[email protected].5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-2.1.5.tgz#f790d1394a5030644217ce73562e92465e83147e"
integrity sha512-aWZF3P0r3w6DiYTVskOYuhBc7EMc3jvn1TkBg8ttylFFRqNN2XGD7V5a4aQdk6QiUzZQ4klNBSpCLJgWNdIiNw==
"@vitest/[email protected].8":
version "2.1.8"
resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-2.1.8.tgz#bc41af3e1e6a41ae3b67e51f09724136b88fa447"
integrity sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==
dependencies:
tinyspy "^3.0.2"

Expand All @@ -5550,12 +5550,12 @@
loupe "^3.1.2"
tinyrainbow "^1.2.0"

"@vitest/[email protected].5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-2.1.5.tgz#0e19ce677c870830a1573d33ee86b0d6109e9546"
integrity sha512-yfj6Yrp0Vesw2cwJbP+cl04OC+IHFsuQsrsJBL9pyGeQXE56v1UAOQco+SR55Vf1nQzfV0QJg1Qum7AaWUwwYg==
"@vitest/[email protected].8":
version "2.1.8"
resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-2.1.8.tgz#f8ef85525f3362ebd37fd25d268745108d6ae388"
integrity sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==
dependencies:
"@vitest/pretty-format" "2.1.5"
"@vitest/pretty-format" "2.1.8"
loupe "^3.1.2"
tinyrainbow "^1.2.0"

Expand Down

0 comments on commit e6a5d81

Please sign in to comment.