@frequency-chain/recovery-sdk 1.17.5-rc8 → 1.17.6-rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -18,8 +18,8 @@ exports.generateRecoverySecret = generateRecoverySecret;
18
18
  exports.getIntermediaryHashes = getIntermediaryHashes;
19
19
  exports.getRecoveryCommitment = getRecoveryCommitment;
20
20
  exports.getRecoveryCommitmentFromIntermediary = getRecoveryCommitmentFromIntermediary;
21
- const sha3_1 = require("@noble/hashes/sha3");
22
- const utils_1 = require("@noble/hashes/utils");
21
+ const sha3_js_1 = require("@noble/hashes/sha3.js");
22
+ const utils_js_1 = require("@noble/hashes/utils.js");
23
23
  const standardize_js_1 = require("./standardize.js");
24
24
  __exportStar(require("./types.js"), exports);
25
25
  /**
@@ -28,7 +28,7 @@ __exportStar(require("./types.js"), exports);
28
28
  * @returns A new recovery secret string formatted for user consumption
29
29
  */
30
30
  function generateRecoverySecret() {
31
- const unformatted = (0, utils_1.bytesToHex)((0, utils_1.randomBytes)(32)).split('');
31
+ const unformatted = (0, utils_js_1.bytesToHex)((0, utils_js_1.randomBytes)(32)).split('');
32
32
  return [...Array(64 / 4)]
33
33
  .map((_a) => unformatted.splice(0, 4).join(''))
34
34
  .join('-')
@@ -45,16 +45,16 @@ function generateRecoverySecret() {
45
45
  function getIntermediaryHashes(recoverySecret, contactType, contact) {
46
46
  const { a, b } = getIntermediaryHashesAsUint8Array(recoverySecret, contactType, contact);
47
47
  return {
48
- a: `0x${(0, utils_1.bytesToHex)(a)}`,
49
- b: `0x${(0, utils_1.bytesToHex)(b)}`,
48
+ a: `0x${(0, utils_js_1.bytesToHex)(a)}`,
49
+ b: `0x${(0, utils_js_1.bytesToHex)(b)}`,
50
50
  };
51
51
  }
52
52
  function getIntermediaryHashesAsUint8Array(recoverySecret, contactType, contact) {
53
- const s = (0, utils_1.hexToBytes)(recoverySecret.replaceAll('-', ''));
53
+ const s = (0, utils_js_1.hexToBytes)(recoverySecret.replaceAll('-', ''));
54
54
  const contactStandard = (0, standardize_js_1.standardizeContact)(contactType, contact);
55
55
  return {
56
- a: (0, sha3_1.keccak_256)(s),
57
- b: (0, sha3_1.keccak_256)((0, utils_1.concatBytes)(s, (0, utils_1.hexToBytes)(contactType.replace('0x', '')), (0, utils_1.utf8ToBytes)(contactStandard))),
56
+ a: (0, sha3_js_1.keccak_256)(s),
57
+ b: (0, sha3_js_1.keccak_256)((0, utils_js_1.concatBytes)(s, (0, utils_js_1.hexToBytes)(contactType.replace('0x', '')), (0, utils_js_1.utf8ToBytes)(contactStandard))),
58
58
  };
59
59
  }
60
60
  /**
@@ -67,7 +67,7 @@ function getIntermediaryHashesAsUint8Array(recoverySecret, contactType, contact)
67
67
  */
68
68
  function getRecoveryCommitment(recoverySecret, contactType, contact) {
69
69
  const { a, b } = getIntermediaryHashesAsUint8Array(recoverySecret, contactType, contact);
70
- return `0x${(0, utils_1.bytesToHex)((0, sha3_1.keccak_256)((0, utils_1.concatBytes)(a, b)))}`;
70
+ return `0x${(0, utils_js_1.bytesToHex)((0, sha3_js_1.keccak_256)((0, utils_js_1.concatBytes)(a, b)))}`;
71
71
  }
72
72
  /**
73
73
  * Gets the Recovery Commitment that is stored on chain for the validation at time of recovery from the Intermediary Hashes
@@ -77,7 +77,7 @@ function getRecoveryCommitment(recoverySecret, contactType, contact) {
77
77
  * @returns the hex string of the Recovery Commitment
78
78
  */
79
79
  function getRecoveryCommitmentFromIntermediary(aHash, bHash) {
80
- const a = (0, utils_1.hexToBytes)(aHash.replace('0x', ''));
81
- const b = (0, utils_1.hexToBytes)(bHash.replace('0x', ''));
82
- return `0x${(0, utils_1.bytesToHex)((0, sha3_1.keccak_256)((0, utils_1.concatBytes)(a, b)))}`;
80
+ const a = (0, utils_js_1.hexToBytes)(aHash.replace('0x', ''));
81
+ const b = (0, utils_js_1.hexToBytes)(bHash.replace('0x', ''));
82
+ return `0x${(0, utils_js_1.bytesToHex)((0, sha3_js_1.keccak_256)((0, utils_js_1.concatBytes)(a, b)))}`;
83
83
  }
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { keccak_256 } from '@noble/hashes/sha3';
2
- import { bytesToHex, randomBytes, concatBytes, hexToBytes, utf8ToBytes } from '@noble/hashes/utils';
1
+ import { keccak_256 } from '@noble/hashes/sha3.js';
2
+ import { bytesToHex, randomBytes, concatBytes, hexToBytes, utf8ToBytes } from '@noble/hashes/utils.js';
3
3
  import { standardizeContact } from './standardize.js';
4
4
  export * from './types.js';
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frequency-chain/recovery-sdk",
3
- "version": "1.17.5-rc8",
3
+ "version": "1.17.6-rc1",
4
4
  "bugs": {
5
5
  "url": "https://github.com/frequency-chain/frequency/issues"
6
6
  },
@@ -15,8 +15,8 @@
15
15
  "author": "frequency-chain",
16
16
  "license": "Apache-2.0",
17
17
  "dependencies": {
18
- "@noble/hashes": "1.8.0",
19
- "libphonenumber-js": "1.12.10"
18
+ "@noble/hashes": "2.0.1",
19
+ "libphonenumber-js": "1.12.24"
20
20
  },
21
21
  "module": "./esm/index.js",
22
22
  "types": "index.d.ts",