Skip to content

Commit

Permalink
feat: add flag to Keyidentifier
Browse files Browse the repository at this point in the history
  • Loading branch information
feri42 committed Jun 21, 2024
1 parent 3a0eae8 commit 4c2b86f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libraries/key-identifier/src/key-identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ export default class KeyIdentifier {
/** @type {DerivationPath} */
#derivationPath

constructor({ derivationAlgorithm, derivationPath, assetName, keyType }) {
constructor({ derivationAlgorithm, derivationPath, assetName, keyType, uncompressed = false }) {
assert(typeof derivationAlgorithm === 'string', 'derivationAlgorithm not a string')
assert(typeof uncompressed === 'boolean', 'uncompressed not a boolean')
assert(
SUPPORTED_KDFS.has(derivationAlgorithm),
`${derivationAlgorithm} is not a valid derivationAlgorithm`
Expand All @@ -38,6 +39,7 @@ export default class KeyIdentifier {
this.#derivationPath = isDerivationPath(derivationPath)
? derivationPath
: DerivationPath.from(derivationPath)
this.uncompressed = uncompressed

// Freeze the object on construction, disallow tampering with derivation path.
// Ensures immutability of key identifiers passed to keychain.
Expand Down Expand Up @@ -65,6 +67,7 @@ export default class KeyIdentifier {
assetName: this.assetName,
keyType: this.keyType,
derivationPath: this.derivationPath,
uncompressed: this.uncompressed,
}
}

Expand All @@ -83,7 +86,7 @@ export default class KeyIdentifier {
return false
}

return !['derivationAlgorithm', 'derivationPath', 'assetName', 'keyType'].some(
return !['derivationAlgorithm', 'derivationPath', 'assetName', 'keyType', 'uncompressed'].some(
(fieldName) => keyIdA[fieldName] !== keyIdB[fieldName]
)
}
Expand Down

0 comments on commit 4c2b86f

Please sign in to comment.