@verii/crypto 1.0.0-pre.1756073963 → 1.0.0-pre.1756096826

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.
Files changed (2) hide show
  1. package/package.json +3 -4
  2. package/src/crypto.js +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verii/crypto",
3
- "version": "1.0.0-pre.1756073963",
3
+ "version": "1.0.0-pre.1756096826",
4
4
  "description": "Set of crypto functions used in Verii projects",
5
5
  "repository": "https://github.com/LFDT-Verii/core",
6
6
  "main": "index.js",
@@ -16,14 +16,13 @@
16
16
  "license": "Apache-2.0",
17
17
  "dependencies": {
18
18
  "@trust/keyto": "~2.0.0-alpha1",
19
- "@verii/test-regexes": "1.0.0-pre.1756073963",
19
+ "@verii/test-regexes": "1.0.0-pre.1756096826",
20
20
  "argon2": "0.43.1",
21
21
  "bigint-crypto-utils": "3.3.0",
22
22
  "canonicalize": "^2.1.0",
23
23
  "cborg": "4.2.13",
24
24
  "elliptic": "^6.6.1",
25
25
  "lodash": "^4.17.21",
26
- "multihashing": "~0.3.3",
27
26
  "random-number-csprng": "^1.0.2"
28
27
  },
29
28
  "devDependencies": {
@@ -44,5 +43,5 @@
44
43
  "lib"
45
44
  ]
46
45
  },
47
- "gitHead": "0f350929452085961d9af66df58692a2554f3c04"
46
+ "gitHead": "7f7dc1af30929dd31608d446ca6bd98cd83e8294"
48
47
  }
package/src/crypto.js CHANGED
@@ -19,7 +19,6 @@ const crypto = require('crypto');
19
19
  const argon2 = require('argon2');
20
20
  const { flow, isString, omit } = require('lodash/fp');
21
21
  const randomNumber = require('random-number-csprng');
22
- const multihash = require('multihashing');
23
22
  const keyto = require('@trust/keyto');
24
23
  const { HEX_FORMAT } = require('@verii/test-regexes');
25
24
  const { KeyAlgorithms } = require('./constants');
@@ -32,8 +31,13 @@ const generatePositive256BitHexString = () =>
32
31
  `0x${crypto.randomBytes(32).toString('hex')}`;
33
32
 
34
33
  const createCommitment = (val) => {
35
- const hash = multihash(val, 'sha2-256');
36
- return Buffer.from(hash).toString('base64');
34
+ const hash = calculateDigest('sha256')(val);
35
+ const multihashBuffer = Buffer.concat([
36
+ Buffer.from([0x12]), // sha256 code
37
+ Buffer.from(hash.length.toString(16), 'hex'), // digest length
38
+ hash,
39
+ ]);
40
+ return multihashBuffer.toString('base64');
37
41
  };
38
42
 
39
43
  const generateJWAKeyPair = (dsaOrConfig) => {