Skip to content

Commit

Permalink
fix: DerivationPath predicate using Symbol.toStringTag getter (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
sparten11740 authored Jul 30, 2024
1 parent 30a0ec8 commit 4590f79
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/key-identifier/src/key-identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const SUPPORTED_KEY_TYPES = new Set(['legacy', 'nacl', 'secp256k1'])
const isDerivationPath = (derivationPath) =>
typeof derivationPath === 'object' &&
Symbol.toStringTag in derivationPath &&
derivationPath[Symbol.toStringTag]() === 'DerivationPath'
(derivationPath[Symbol.toStringTag] === 'DerivationPath' ||
(typeof derivationPath[Symbol.toStringTag] === 'function' &&
derivationPath[Symbol.toStringTag]() === 'DerivationPath')) // an older version of DerivationPath incorrectly used a method instead of a getter

export default class KeyIdentifier {
/** @type {DerivationPath} */
Expand Down

0 comments on commit 4590f79

Please sign in to comment.