@sd-jwt/decode 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 +23 -23
- package/README.md +5 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +9 -10
- package/src/decode.ts +1 -1
- package/src/test/decode.spec.ts +3 -3
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/decode
|
|
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/decode
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ 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
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
25
25
|
|
|
@@ -27,7 +27,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
# [0.12.0](https://github.com/openwallet-foundation
|
|
30
|
+
# [0.12.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.11.0...v0.12.0) (2025-06-21)
|
|
31
31
|
|
|
32
32
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
# [0.11.0](https://github.com/openwallet-foundation
|
|
38
|
+
# [0.11.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.10.0...v0.11.0) (2025-06-17)
|
|
39
39
|
|
|
40
40
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
41
41
|
|
|
@@ -43,7 +43,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
# [0.10.0](https://github.com/openwallet-foundation
|
|
46
|
+
# [0.10.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.2...v0.10.0) (2025-03-24)
|
|
47
47
|
|
|
48
48
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
49
49
|
|
|
@@ -51,7 +51,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
## [0.9.2](https://github.com/openwallet-foundation
|
|
54
|
+
## [0.9.2](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.1...v0.9.2) (2025-01-29)
|
|
55
55
|
|
|
56
56
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
57
57
|
|
|
@@ -59,7 +59,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
## [0.9.1](https://github.com/openwallet-foundation
|
|
62
|
+
## [0.9.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.0...v0.9.1) (2024-12-13)
|
|
63
63
|
|
|
64
64
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
65
65
|
|
|
@@ -67,7 +67,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
# [0.9.0](https://github.com/openwallet-foundation
|
|
70
|
+
# [0.9.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.8.0...v0.9.0) (2024-12-10)
|
|
71
71
|
|
|
72
72
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
73
73
|
|
|
@@ -75,7 +75,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
# [0.8.0](https://github.com/openwallet-foundation
|
|
78
|
+
# [0.8.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.2...v0.8.0) (2024-11-26)
|
|
79
79
|
|
|
80
80
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
81
81
|
|
|
@@ -83,7 +83,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
## [0.7.2](https://github.com/openwallet-foundation
|
|
86
|
+
## [0.7.2](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.1...v0.7.2) (2024-07-19)
|
|
87
87
|
|
|
88
88
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
89
89
|
|
|
@@ -91,7 +91,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
|
|
94
|
-
## [0.7.1](https://github.com/openwallet-foundation
|
|
94
|
+
## [0.7.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.0...v0.7.1) (2024-05-21)
|
|
95
95
|
|
|
96
96
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
97
97
|
|
|
@@ -99,29 +99,29 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
# [0.7.0](https://github.com/openwallet-foundation
|
|
102
|
+
# [0.7.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.6.1...v0.7.0) (2024-05-13)
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
### Features
|
|
106
106
|
|
|
107
|
-
* add clone ojbect logic in unpackObj ([#181](https://github.com/openwallet-foundation
|
|
107
|
+
* add clone ojbect logic in unpackObj ([#181](https://github.com/openwallet-foundation/sd-jwt-js/issues/181)) ([2e92cb3](https://github.com/openwallet-foundation/sd-jwt-js/commit/2e92cb3abc27f6dbde19c7c016bc1f8ba60f9ff6))
|
|
108
108
|
|
|
109
109
|
|
|
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
|
|
|
116
116
|
### Bug Fixes
|
|
117
117
|
|
|
118
|
-
* base64url convention ([#179](https://github.com/openwallet-foundation
|
|
118
|
+
* base64url convention ([#179](https://github.com/openwallet-foundation/sd-jwt-js/issues/179)) ([f8db275](https://github.com/openwallet-foundation/sd-jwt-js/commit/f8db275690dab88000a039838680a3478b3b61ec))
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
|
|
123
123
|
|
|
124
|
-
# [0.6.0](https://github.com/openwallet-foundation
|
|
124
|
+
# [0.6.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.5.0...v0.6.0) (2024-03-12)
|
|
125
125
|
|
|
126
126
|
**Note:** Version bump only for package @sd-jwt/decode
|
|
127
127
|
|
|
@@ -129,12 +129,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
# [0.5.0](https://github.com/openwallet-foundation
|
|
132
|
+
# [0.5.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.4.0...v0.5.0) (2024-03-11)
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
### Features
|
|
136
136
|
|
|
137
|
-
* make _digest value public in disclosure ([#151](https://github.com/openwallet-foundation
|
|
137
|
+
* 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))
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
@@ -145,7 +145,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
145
145
|
|
|
146
146
|
### Bug Fixes
|
|
147
147
|
|
|
148
|
-
* add publish config ([#93](https://github.com/openwallet-foundation
|
|
149
|
-
* change SDJwtPayload to SdJwtPayload ([9f06ef7](https://github.com/openwallet-foundation
|
|
150
|
-
* convert any usage into or typed version ([#80](https://github.com/openwallet-foundation
|
|
151
|
-
* make sdjwt instance non abstract ([#122](https://github.com/openwallet-foundation
|
|
148
|
+
* 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))
|
|
149
|
+
* change SDJwtPayload to SdJwtPayload ([9f06ef7](https://github.com/openwallet-foundation/sd-jwt-js/commit/9f06ef7bd31a1dff4e9bf988e425200a5e1aa82d))
|
|
150
|
+
* convert any usage into or typed version ([#80](https://github.com/openwallet-foundation/sd-jwt-js/issues/80)) ([de4df54](https://github.com/openwallet-foundation/sd-jwt-js/commit/de4df54f2a0a77fdbf97e10abac555a98e70c6e0))
|
|
151
|
+
* make sdjwt instance non abstract ([#122](https://github.com/openwallet-foundation/sd-jwt-js/issues/122)) ([e85aae8](https://github.com/openwallet-foundation/sd-jwt-js/commit/e85aae89910f5d9468e29ef14ef3b3d3215b86fd))
|
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
|
Decode SD JWT into objects
|
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Disclosure } from '@sd-jwt/utils';
|
|
2
1
|
import { Hasher, HasherAndAlg } from '@sd-jwt/types';
|
|
3
2
|
import { HasherSync, HasherAndAlgSync } from '@sd-jwt/types/src/type';
|
|
3
|
+
import { Disclosure } from '@sd-jwt/utils';
|
|
4
4
|
|
|
5
5
|
declare const decodeJwt: <H extends Record<string, unknown>, T extends Record<string, unknown>>(jwt: string) => {
|
|
6
6
|
header: H;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Disclosure } from '@sd-jwt/utils';
|
|
2
1
|
import { Hasher, HasherAndAlg } from '@sd-jwt/types';
|
|
3
2
|
import { HasherSync, HasherAndAlgSync } from '@sd-jwt/types/src/type';
|
|
3
|
+
import { Disclosure } from '@sd-jwt/utils';
|
|
4
4
|
|
|
5
5
|
declare const decodeJwt: <H extends Record<string, unknown>, T extends Record<string, unknown>>(jwt: string) => {
|
|
6
6
|
header: H;
|
package/dist/index.js
CHANGED
|
@@ -70,8 +70,8 @@ __export(index_exports, {
|
|
|
70
70
|
module.exports = __toCommonJS(index_exports);
|
|
71
71
|
|
|
72
72
|
// src/decode.ts
|
|
73
|
-
var import_utils = require("@sd-jwt/utils");
|
|
74
73
|
var import_types = require("@sd-jwt/types");
|
|
74
|
+
var import_utils = require("@sd-jwt/utils");
|
|
75
75
|
var decodeJwt = (jwt) => {
|
|
76
76
|
const { 0: header, 1: payload, 2: signature, length } = jwt.split(".");
|
|
77
77
|
if (length !== 3) {
|
|
@@ -98,7 +98,7 @@ var splitSdJwt = (sdjwt) => {
|
|
|
98
98
|
kbJwt: encodedKeyBindingJwt || void 0
|
|
99
99
|
};
|
|
100
100
|
};
|
|
101
|
-
var decodeSdJwt = (sdjwt, hasher) => __async(
|
|
101
|
+
var decodeSdJwt = (sdjwt, hasher) => __async(null, null, function* () {
|
|
102
102
|
const [encodedJwt, ...encodedDisclosures] = sdjwt.split(import_types.SD_SEPARATOR);
|
|
103
103
|
const jwt = decodeJwt(encodedJwt);
|
|
104
104
|
if (encodedDisclosures.length === 0) {
|
|
@@ -142,7 +142,7 @@ var decodeSdJwtSync = (sdjwt, hasher) => {
|
|
|
142
142
|
kbJwt
|
|
143
143
|
};
|
|
144
144
|
};
|
|
145
|
-
var getClaims = (rawPayload, disclosures, hasher) => __async(
|
|
145
|
+
var getClaims = (rawPayload, disclosures, hasher) => __async(null, null, function* () {
|
|
146
146
|
const { unpackedObj } = yield unpack(rawPayload, disclosures, hasher);
|
|
147
147
|
return unpackedObj;
|
|
148
148
|
});
|
|
@@ -214,7 +214,7 @@ var unpackObjInternal = (obj, map, prefix = "") => {
|
|
|
214
214
|
}
|
|
215
215
|
return { unpackedObj: obj, disclosureKeymap: keys };
|
|
216
216
|
};
|
|
217
|
-
var createHashMapping = (disclosures, hash) => __async(
|
|
217
|
+
var createHashMapping = (disclosures, hash) => __async(null, null, function* () {
|
|
218
218
|
const map = {};
|
|
219
219
|
for (let i = 0; i < disclosures.length; i++) {
|
|
220
220
|
const disclosure = disclosures[i];
|
|
@@ -239,7 +239,7 @@ var getSDAlgAndPayload = (SdJwtPayload) => {
|
|
|
239
239
|
}
|
|
240
240
|
return { _sd_alg, payload };
|
|
241
241
|
};
|
|
242
|
-
var unpack = (SdJwtPayload, disclosures, hasher) => __async(
|
|
242
|
+
var unpack = (SdJwtPayload, disclosures, hasher) => __async(null, null, function* () {
|
|
243
243
|
const { _sd_alg, payload } = getSDAlgAndPayload(SdJwtPayload);
|
|
244
244
|
const hash = { hasher, alg: _sd_alg };
|
|
245
245
|
const map = yield createHashMapping(disclosures, hash);
|
package/dist/index.mjs
CHANGED
|
@@ -35,12 +35,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
// src/decode.ts
|
|
38
|
-
import { base64urlDecode, SDJWTException, Disclosure } from "@sd-jwt/utils";
|
|
39
38
|
import {
|
|
40
39
|
SD_DIGEST,
|
|
41
40
|
SD_LIST_KEY,
|
|
42
41
|
SD_SEPARATOR
|
|
43
42
|
} from "@sd-jwt/types";
|
|
43
|
+
import { base64urlDecode, Disclosure, SDJWTException } from "@sd-jwt/utils";
|
|
44
44
|
var decodeJwt = (jwt) => {
|
|
45
45
|
const { 0: header, 1: payload, 2: signature, length } = jwt.split(".");
|
|
46
46
|
if (length !== 3) {
|
|
@@ -67,7 +67,7 @@ var splitSdJwt = (sdjwt) => {
|
|
|
67
67
|
kbJwt: encodedKeyBindingJwt || void 0
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
|
-
var decodeSdJwt = (sdjwt, hasher) => __async(
|
|
70
|
+
var decodeSdJwt = (sdjwt, hasher) => __async(null, null, function* () {
|
|
71
71
|
const [encodedJwt, ...encodedDisclosures] = sdjwt.split(SD_SEPARATOR);
|
|
72
72
|
const jwt = decodeJwt(encodedJwt);
|
|
73
73
|
if (encodedDisclosures.length === 0) {
|
|
@@ -111,7 +111,7 @@ var decodeSdJwtSync = (sdjwt, hasher) => {
|
|
|
111
111
|
kbJwt
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
|
-
var getClaims = (rawPayload, disclosures, hasher) => __async(
|
|
114
|
+
var getClaims = (rawPayload, disclosures, hasher) => __async(null, null, function* () {
|
|
115
115
|
const { unpackedObj } = yield unpack(rawPayload, disclosures, hasher);
|
|
116
116
|
return unpackedObj;
|
|
117
117
|
});
|
|
@@ -183,7 +183,7 @@ var unpackObjInternal = (obj, map, prefix = "") => {
|
|
|
183
183
|
}
|
|
184
184
|
return { unpackedObj: obj, disclosureKeymap: keys };
|
|
185
185
|
};
|
|
186
|
-
var createHashMapping = (disclosures, hash) => __async(
|
|
186
|
+
var createHashMapping = (disclosures, hash) => __async(null, null, function* () {
|
|
187
187
|
const map = {};
|
|
188
188
|
for (let i = 0; i < disclosures.length; i++) {
|
|
189
189
|
const disclosure = disclosures[i];
|
|
@@ -208,7 +208,7 @@ var getSDAlgAndPayload = (SdJwtPayload) => {
|
|
|
208
208
|
}
|
|
209
209
|
return { _sd_alg, payload };
|
|
210
210
|
};
|
|
211
|
-
var unpack = (SdJwtPayload, disclosures, hasher) => __async(
|
|
211
|
+
var unpack = (SdJwtPayload, disclosures, hasher) => __async(null, null, function* () {
|
|
212
212
|
const { _sd_alg, payload } = getSDAlgAndPayload(SdJwtPayload);
|
|
213
213
|
const hash = { hasher, alg: _sd_alg };
|
|
214
214
|
const map = yield createHashMapping(disclosures, hash);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/decode",
|
|
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",
|
|
@@ -24,24 +24,23 @@
|
|
|
24
24
|
"sd-jwt-vc"
|
|
25
25
|
],
|
|
26
26
|
"engines": {
|
|
27
|
-
"node": ">=
|
|
27
|
+
"node": ">=20"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
|
-
"
|
|
31
|
-
"url": "https://github.com/openwallet-foundation-labs/sd-jwt-js"
|
|
30
|
+
"url": "https://github.com/openwallet-foundation/sd-jwt-js"
|
|
32
31
|
},
|
|
33
32
|
"author": "Lukas.J.Han <lukas.j.han@gmail.com>",
|
|
34
|
-
"homepage": "https://github.com/openwallet-foundation
|
|
33
|
+
"homepage": "https://github.com/openwallet-foundation/sd-jwt-js/wiki",
|
|
35
34
|
"bugs": {
|
|
36
|
-
"url": "https://github.com/openwallet-foundation
|
|
35
|
+
"url": "https://github.com/openwallet-foundation/sd-jwt-js/issues"
|
|
37
36
|
},
|
|
38
37
|
"license": "Apache-2.0",
|
|
39
38
|
"devDependencies": {
|
|
40
|
-
"@sd-jwt/crypto-nodejs": "0.15.2-next.
|
|
39
|
+
"@sd-jwt/crypto-nodejs": "0.15.2-next.9+75d5780"
|
|
41
40
|
},
|
|
42
41
|
"dependencies": {
|
|
43
|
-
"@sd-jwt/types": "0.15.2-next.
|
|
44
|
-
"@sd-jwt/utils": "0.15.2-next.
|
|
42
|
+
"@sd-jwt/types": "0.15.2-next.9+75d5780",
|
|
43
|
+
"@sd-jwt/utils": "0.15.2-next.9+75d5780"
|
|
45
44
|
},
|
|
46
45
|
"publishConfig": {
|
|
47
46
|
"access": "public"
|
|
@@ -59,5 +58,5 @@
|
|
|
59
58
|
"esm"
|
|
60
59
|
]
|
|
61
60
|
},
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "75d5780fb53c5e2c886537b283503fc6fb088a4a"
|
|
63
62
|
}
|
package/src/decode.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { base64urlDecode, SDJWTException, Disclosure } from '@sd-jwt/utils';
|
|
2
1
|
import {
|
|
3
2
|
type Hasher,
|
|
4
3
|
type HasherAndAlg,
|
|
@@ -7,6 +6,7 @@ import {
|
|
|
7
6
|
SD_SEPARATOR,
|
|
8
7
|
} from '@sd-jwt/types';
|
|
9
8
|
import type { HasherAndAlgSync, HasherSync } from '@sd-jwt/types/src/type';
|
|
9
|
+
import { base64urlDecode, Disclosure, SDJWTException } from '@sd-jwt/utils';
|
|
10
10
|
|
|
11
11
|
export const decodeJwt = <
|
|
12
12
|
H extends Record<string, unknown>,
|
package/src/test/decode.spec.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { digest } from '@sd-jwt/crypto-nodejs';
|
|
1
2
|
import { describe, expect, test } from 'vitest';
|
|
2
3
|
import {
|
|
3
4
|
createHashMapping,
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
splitSdJwt,
|
|
11
12
|
unpackObj,
|
|
12
13
|
} from '../index';
|
|
13
|
-
import { digest } from '@sd-jwt/crypto-nodejs';
|
|
14
14
|
|
|
15
15
|
describe('decode tests', () => {
|
|
16
16
|
test('decode jwt', () => {
|
|
@@ -180,7 +180,7 @@ describe('decode tests', () => {
|
|
|
180
180
|
});
|
|
181
181
|
|
|
182
182
|
test('Test default sd hash algorithm', () => {
|
|
183
|
-
const { _sd_alg
|
|
183
|
+
const { _sd_alg } = getSDAlgAndPayload({});
|
|
184
184
|
expect(_sd_alg).toBe('sha-256');
|
|
185
185
|
});
|
|
186
186
|
|
|
@@ -190,7 +190,7 @@ describe('decode tests', () => {
|
|
|
190
190
|
const decodedSdJwt = await decodeSdJwt(sdjwt, digest);
|
|
191
191
|
const jwtPayload = JSON.parse(JSON.stringify(decodedSdJwt.jwt.payload));
|
|
192
192
|
|
|
193
|
-
const { _sd_alg
|
|
193
|
+
const { _sd_alg } = getSDAlgAndPayload(decodedSdJwt.jwt.payload);
|
|
194
194
|
const hash = { hasher: digest, alg: _sd_alg };
|
|
195
195
|
const map = await createHashMapping(decodedSdJwt.disclosures, hash);
|
|
196
196
|
|