@sd-jwt/hash 0.15.2-next.4 → 0.15.2-next.9
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 +19 -19
- package/README.md +5 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -4
- package/dist/index.mjs +3 -4
- package/package.json +9 -10
- package/src/sha.ts +3 -6
- package/src/test/sha.spec.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.15.0](https://github.com/openwallet-foundation
|
|
6
|
+
# [0.15.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.14.1...v0.15.0) (2025-08-20)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
# [0.14.0](https://github.com/openwallet-foundation
|
|
14
|
+
# [0.14.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.13.0...v0.14.0) (2025-06-30)
|
|
15
15
|
|
|
16
16
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
17
17
|
|
|
@@ -19,18 +19,18 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
# [0.13.0](https://github.com/openwallet-foundation
|
|
22
|
+
# [0.13.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.12.0...v0.13.0) (2025-06-25)
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
### Features
|
|
26
26
|
|
|
27
|
-
* add sha384, sha512 support ([#282](https://github.com/openwallet-foundation
|
|
27
|
+
* add sha384, sha512 support ([#282](https://github.com/openwallet-foundation/sd-jwt-js/issues/282)) ([0a2f20b](https://github.com/openwallet-foundation/sd-jwt-js/commit/0a2f20b6383d2356540e7a9cc37748c7b9caced2))
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
# [0.12.0](https://github.com/openwallet-foundation
|
|
33
|
+
# [0.12.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.11.0...v0.12.0) (2025-06-21)
|
|
34
34
|
|
|
35
35
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
# [0.11.0](https://github.com/openwallet-foundation
|
|
41
|
+
# [0.11.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.10.0...v0.11.0) (2025-06-17)
|
|
42
42
|
|
|
43
43
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
# [0.10.0](https://github.com/openwallet-foundation
|
|
49
|
+
# [0.10.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.2...v0.10.0) (2025-03-24)
|
|
50
50
|
|
|
51
51
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
## [0.9.2](https://github.com/openwallet-foundation
|
|
57
|
+
## [0.9.2](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.1...v0.9.2) (2025-01-29)
|
|
58
58
|
|
|
59
59
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
## [0.9.1](https://github.com/openwallet-foundation
|
|
65
|
+
## [0.9.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.0...v0.9.1) (2024-12-13)
|
|
66
66
|
|
|
67
67
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
68
68
|
|
|
@@ -70,7 +70,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
# [0.9.0](https://github.com/openwallet-foundation
|
|
73
|
+
# [0.9.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.8.0...v0.9.0) (2024-12-10)
|
|
74
74
|
|
|
75
75
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
76
76
|
|
|
@@ -78,7 +78,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
# [0.8.0](https://github.com/openwallet-foundation
|
|
81
|
+
# [0.8.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.2...v0.8.0) (2024-11-26)
|
|
82
82
|
|
|
83
83
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
84
84
|
|
|
@@ -86,7 +86,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
|
|
89
|
-
## [0.7.2](https://github.com/openwallet-foundation
|
|
89
|
+
## [0.7.2](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.1...v0.7.2) (2024-07-19)
|
|
90
90
|
|
|
91
91
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
92
92
|
|
|
@@ -94,7 +94,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
## [0.7.1](https://github.com/openwallet-foundation
|
|
97
|
+
## [0.7.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.0...v0.7.1) (2024-05-21)
|
|
98
98
|
|
|
99
99
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
100
100
|
|
|
@@ -102,7 +102,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
# [0.7.0](https://github.com/openwallet-foundation
|
|
105
|
+
# [0.7.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.6.1...v0.7.0) (2024-05-13)
|
|
106
106
|
|
|
107
107
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
108
108
|
|
|
@@ -110,7 +110,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
## [0.6.1](https://github.com/openwallet-foundation
|
|
113
|
+
## [0.6.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.6.0...v0.6.1) (2024-03-18)
|
|
114
114
|
|
|
115
115
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
116
116
|
|
|
@@ -118,7 +118,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
# [0.6.0](https://github.com/openwallet-foundation
|
|
121
|
+
# [0.6.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.5.0...v0.6.0) (2024-03-12)
|
|
122
122
|
|
|
123
123
|
**Note:** Version bump only for package @sd-jwt/hash
|
|
124
124
|
|
|
@@ -126,12 +126,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
129
|
-
# [0.5.0](https://github.com/openwallet-foundation
|
|
129
|
+
# [0.5.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.4.0...v0.5.0) (2024-03-11)
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
### Features
|
|
133
133
|
|
|
134
|
-
* make _digest value public in disclosure ([#151](https://github.com/openwallet-foundation
|
|
134
|
+
* make _digest value public in disclosure ([#151](https://github.com/openwallet-foundation/sd-jwt-js/issues/151)) ([7a3fbd7](https://github.com/openwallet-foundation/sd-jwt-js/commit/7a3fbd7db19b6501978340c972b171743d287285))
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
|
|
@@ -142,4 +142,4 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
142
142
|
|
|
143
143
|
### Bug Fixes
|
|
144
144
|
|
|
145
|
-
* add publish config ([#93](https://github.com/openwallet-foundation
|
|
145
|
+
* add publish config ([#93](https://github.com/openwallet-foundation/sd-jwt-js/issues/93)) ([2e4c5c1](https://github.com/openwallet-foundation/sd-jwt-js/commit/2e4c5c176dc88e58e49d06783b7658d8ad872313))
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-

|
|
2
2
|

|
|
3
|
-

|
|
4
|
+

|
|
5
5
|
|
|
6
6
|
# SD-JWT Implementation in JavaScript (TypeScript)
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
SHA-256 support for SD JWT
|
|
13
13
|
|
|
14
|
-
Check the detail description in our github [repo](https://github.com/openwallet-foundation
|
|
14
|
+
Check the detail description in our github [repo](https://github.com/openwallet-foundation/sd-jwt-js).
|
|
15
15
|
|
|
16
16
|
### Installation
|
|
17
17
|
|
|
@@ -32,7 +32,7 @@ Ensure you have Node.js installed as a prerequisite.
|
|
|
32
32
|
|
|
33
33
|
### Usage
|
|
34
34
|
|
|
35
|
-
Check out more details in our [documentation](https://github.com/openwallet-foundation
|
|
35
|
+
Check out more details in our [documentation](https://github.com/openwallet-foundation/sd-jwt-js/tree/main/docs) or [examples](https://github.com/openwallet-foundation/sd-jwt-js/tree/main/examples)
|
|
36
36
|
|
|
37
37
|
### Dependencies
|
|
38
38
|
|
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(
|
|
52
|
+
return sha256(data);
|
|
54
53
|
case "sha384":
|
|
55
|
-
return sha384(
|
|
54
|
+
return sha384(data);
|
|
56
55
|
case "sha512":
|
|
57
|
-
return sha512(
|
|
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(
|
|
27
|
+
return sha256(data);
|
|
29
28
|
case "sha384":
|
|
30
|
-
return sha384(
|
|
29
|
+
return sha384(data);
|
|
31
30
|
case "sha512":
|
|
32
|
-
return sha512(
|
|
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.
|
|
3
|
+
"version": "0.15.2-next.9+75d5780",
|
|
4
4
|
"description": "sd-jwt draft 7 implementation in typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -25,24 +25,23 @@
|
|
|
25
25
|
"sd-jwt-vc"
|
|
26
26
|
],
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
28
|
+
"node": ">=20"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
|
-
"
|
|
32
|
-
"url": "https://github.com/openwallet-foundation-labs/sd-jwt-js"
|
|
31
|
+
"url": "https://github.com/openwallet-foundation/sd-jwt-js"
|
|
33
32
|
},
|
|
34
33
|
"author": "Lukas.J.Han <lukas.j.han@gmail.com>",
|
|
35
|
-
"homepage": "https://github.com/openwallet-foundation
|
|
34
|
+
"homepage": "https://github.com/openwallet-foundation/sd-jwt-js/wiki",
|
|
36
35
|
"bugs": {
|
|
37
|
-
"url": "https://github.com/openwallet-foundation
|
|
36
|
+
"url": "https://github.com/openwallet-foundation/sd-jwt-js/issues"
|
|
38
37
|
},
|
|
39
38
|
"license": "Apache-2.0",
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"@sd-jwt/crypto-nodejs": "0.15.2-next.
|
|
40
|
+
"@sd-jwt/crypto-nodejs": "0.15.2-next.9+75d5780"
|
|
42
41
|
},
|
|
43
42
|
"dependencies": {
|
|
44
|
-
"@noble/hashes": "^
|
|
45
|
-
"@sd-jwt/utils": "0.15.2-next.
|
|
43
|
+
"@noble/hashes": "^2.0.1",
|
|
44
|
+
"@sd-jwt/utils": "0.15.2-next.9+75d5780"
|
|
46
45
|
},
|
|
47
46
|
"publishConfig": {
|
|
48
47
|
"access": "public"
|
|
@@ -60,5 +59,5 @@
|
|
|
60
59
|
"esm"
|
|
61
60
|
]
|
|
62
61
|
},
|
|
63
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "75d5780fb53c5e2c886537b283503fc6fb088a4a"
|
|
64
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(
|
|
39
|
+
return sha256(data);
|
|
43
40
|
case 'sha384':
|
|
44
|
-
return sha384(
|
|
41
|
+
return sha384(data);
|
|
45
42
|
case 'sha512':
|
|
46
|
-
return sha512(
|
|
43
|
+
return sha512(data);
|
|
47
44
|
default:
|
|
48
45
|
throw new SDJWTException(`Unsupported algorithm: ${algorithm}`);
|
|
49
46
|
}
|
package/src/test/sha.spec.ts
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
122
|
+
hasher('test', 'sha-512');
|
|
123
123
|
} catch (e) {
|
|
124
124
|
expect(e).toBeInstanceOf(Error);
|
|
125
125
|
}
|