@sd-jwt/hash 0.15.2-next.8 → 0.16.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.16.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.15.1...v0.16.0) (2025-10-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * change repo url from labs to other one ([#323](https://github.com/openwallet-foundation/sd-jwt-js/issues/323)) ([f68c847](https://github.com/openwallet-foundation/sd-jwt-js/commit/f68c8476c2f04bb9d53acd4059b59caf271df015))
12
+ * set correct url in package json ([#321](https://github.com/openwallet-foundation/sd-jwt-js/issues/321)) ([554152c](https://github.com/openwallet-foundation/sd-jwt-js/commit/554152cc819bbc3afb504b25f4a2018a92fb72f1))
13
+
14
+
15
+ ### Features
16
+
17
+ * updates all dependencies to latest versions + biome updates ([#324](https://github.com/openwallet-foundation/sd-jwt-js/issues/324)) ([75d5780](https://github.com/openwallet-foundation/sd-jwt-js/commit/75d5780fb53c5e2c886537b283503fc6fb088a4a))
18
+
19
+
20
+
21
+
22
+
6
23
  # [0.15.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.14.1...v0.15.0) (2025-08-20)
7
24
 
8
25
  **Note:** Version bump only for package @sd-jwt/hash
package/dist/index.d.mts CHANGED
@@ -2,6 +2,6 @@ declare const sha256: (text: string | ArrayBuffer) => Uint8Array;
2
2
  declare const sha384: (text: string | ArrayBuffer) => Uint8Array;
3
3
  declare const sha512: (text: string | ArrayBuffer) => Uint8Array;
4
4
  type HasherAlgorithm = 'sha256' | 'sha384' | 'sha512' | (string & {});
5
- declare const hasher: (data: string | ArrayBuffer, algorithm?: HasherAlgorithm) => Uint8Array;
5
+ declare const hasher: (data: string | ArrayBuffer, algorithm?: HasherAlgorithm) => Uint8Array<ArrayBufferLike>;
6
6
 
7
7
  export { hasher, sha256, sha384, sha512 };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,6 @@ declare const sha256: (text: string | ArrayBuffer) => Uint8Array;
2
2
  declare const sha384: (text: string | ArrayBuffer) => Uint8Array;
3
3
  declare const sha512: (text: string | ArrayBuffer) => Uint8Array;
4
4
  type HasherAlgorithm = 'sha256' | 'sha384' | 'sha512' | (string & {});
5
- declare const hasher: (data: string | ArrayBuffer, algorithm?: HasherAlgorithm) => Uint8Array;
5
+ declare const hasher: (data: string | ArrayBuffer, algorithm?: HasherAlgorithm) => Uint8Array<ArrayBufferLike>;
6
6
 
7
7
  export { hasher, sha256, sha384, sha512 };
package/dist/index.js CHANGED
@@ -46,15 +46,14 @@ var sha512 = (text) => {
46
46
  return hashBytes;
47
47
  };
48
48
  var hasher = (data, algorithm = "sha256") => {
49
- const msg = typeof data === "string" ? toUTF8Array(data) : new Uint8Array(data);
50
49
  const alg = toCryptoAlg(algorithm);
51
50
  switch (alg) {
52
51
  case "sha256":
53
- return sha256(msg);
52
+ return sha256(data);
54
53
  case "sha384":
55
- return sha384(msg);
54
+ return sha384(data);
56
55
  case "sha512":
57
- return sha512(msg);
56
+ return sha512(data);
58
57
  default:
59
58
  throw new import_utils.SDJWTException(`Unsupported algorithm: ${algorithm}`);
60
59
  }
package/dist/index.mjs CHANGED
@@ -21,15 +21,14 @@ var sha512 = (text) => {
21
21
  return hashBytes;
22
22
  };
23
23
  var hasher = (data, algorithm = "sha256") => {
24
- const msg = typeof data === "string" ? toUTF8Array(data) : new Uint8Array(data);
25
24
  const alg = toCryptoAlg(algorithm);
26
25
  switch (alg) {
27
26
  case "sha256":
28
- return sha256(msg);
27
+ return sha256(data);
29
28
  case "sha384":
30
- return sha384(msg);
29
+ return sha384(data);
31
30
  case "sha512":
32
- return sha512(msg);
31
+ return sha512(data);
33
32
  default:
34
33
  throw new SDJWTException(`Unsupported algorithm: ${algorithm}`);
35
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sd-jwt/hash",
3
- "version": "0.15.2-next.8+f68c847",
3
+ "version": "0.16.0",
4
4
  "description": "sd-jwt draft 7 implementation in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,7 +25,7 @@
25
25
  "sd-jwt-vc"
26
26
  ],
27
27
  "engines": {
28
- "node": ">=18"
28
+ "node": ">=20"
29
29
  },
30
30
  "repository": {
31
31
  "url": "https://github.com/openwallet-foundation/sd-jwt-js"
@@ -37,11 +37,11 @@
37
37
  },
38
38
  "license": "Apache-2.0",
39
39
  "devDependencies": {
40
- "@sd-jwt/crypto-nodejs": "0.15.2-next.8+f68c847"
40
+ "@sd-jwt/crypto-nodejs": "0.16.0"
41
41
  },
42
42
  "dependencies": {
43
- "@noble/hashes": "^1.8.0",
44
- "@sd-jwt/utils": "0.15.2-next.8+f68c847"
43
+ "@noble/hashes": "^2.0.1",
44
+ "@sd-jwt/utils": "0.16.0"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
@@ -59,5 +59,5 @@
59
59
  "esm"
60
60
  ]
61
61
  },
62
- "gitHead": "f68c8476c2f04bb9d53acd4059b59caf271df015"
62
+ "gitHead": "910c79c1607e91ae61e048a0c1b81c9ba0886684"
63
63
  }
package/src/sha.ts CHANGED
@@ -32,18 +32,15 @@ export const hasher = (
32
32
  data: string | ArrayBuffer,
33
33
  algorithm: HasherAlgorithm = 'sha256',
34
34
  ) => {
35
- const msg =
36
- typeof data === 'string' ? toUTF8Array(data) : new Uint8Array(data);
37
-
38
35
  const alg = toCryptoAlg(algorithm);
39
36
 
40
37
  switch (alg) {
41
38
  case 'sha256':
42
- return sha256(msg);
39
+ return sha256(data);
43
40
  case 'sha384':
44
- return sha384(msg);
41
+ return sha384(data);
45
42
  case 'sha512':
46
- return sha512(msg);
43
+ return sha512(data);
47
44
  default:
48
45
  throw new SDJWTException(`Unsupported algorithm: ${algorithm}`);
49
46
  }
@@ -1,8 +1,8 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { bytesToHex } from '@noble/hashes/utils.js';
1
3
  import { digest } from '@sd-jwt/crypto-nodejs';
2
- import { bytesToHex } from '@noble/hashes/utils';
3
- import { hasher, sha256 } from '../index';
4
4
  import { describe, expect, test } from 'vitest';
5
- import { createHash } from 'node:crypto';
5
+ import { hasher, sha256 } from '../index';
6
6
 
7
7
  describe('hashing tests', () => {
8
8
  test('test#1', async () => {
@@ -119,7 +119,7 @@ describe('hashing tests', () => {
119
119
 
120
120
  test('Hasher failed', async () => {
121
121
  try {
122
- const s1 = hasher('test', 'sha-512');
122
+ hasher('test', 'sha-512');
123
123
  } catch (e) {
124
124
  expect(e).toBeInstanceOf(Error);
125
125
  }