@sd-jwt/jwt-status-list 0.18.0 → 0.18.1-next.1
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/dist/index.js +0 -3
- package/dist/index.mjs +0 -3
- package/package.json +4 -4
- package/src/status-list-jwt.ts +0 -4
- package/src/test/status-list-jwt.spec.ts +3 -16
package/dist/index.js
CHANGED
|
@@ -189,9 +189,6 @@ function decodeJwt(jwt) {
|
|
|
189
189
|
return JSON.parse((0, import_utils2.base64urlDecode)(parts[1]));
|
|
190
190
|
}
|
|
191
191
|
function createHeaderAndPayload(list, payload, header) {
|
|
192
|
-
if (!payload.iss) {
|
|
193
|
-
throw new SLException("iss field is required");
|
|
194
|
-
}
|
|
195
192
|
if (!payload.sub) {
|
|
196
193
|
throw new SLException("sub field is required");
|
|
197
194
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -159,9 +159,6 @@ function decodeJwt(jwt) {
|
|
|
159
159
|
return JSON.parse(base64urlDecode(parts[1]));
|
|
160
160
|
}
|
|
161
161
|
function createHeaderAndPayload(list, payload, header) {
|
|
162
|
-
if (!payload.iss) {
|
|
163
|
-
throw new SLException("iss field is required");
|
|
164
|
-
}
|
|
165
162
|
if (!payload.sub) {
|
|
166
163
|
throw new SLException("sub field is required");
|
|
167
164
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/jwt-status-list",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.1-next.1+a11aff6",
|
|
4
4
|
"description": "Implementation based on https://datatracker.ietf.org/doc/draft-ietf-oauth-status-list/",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"jose": "^6.1.2"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@sd-jwt/types": "0.18.
|
|
45
|
-
"@sd-jwt/utils": "0.18.
|
|
44
|
+
"@sd-jwt/types": "0.18.1-next.1+a11aff6",
|
|
45
|
+
"@sd-jwt/utils": "0.18.1-next.1+a11aff6",
|
|
46
46
|
"pako": "^2.1.0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"esm"
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "a11aff63d3c88139de5dd4fcfe03a25c56a64803"
|
|
65
65
|
}
|
package/src/status-list-jwt.ts
CHANGED
|
@@ -32,10 +32,6 @@ export function createHeaderAndPayload(
|
|
|
32
32
|
header: StatusListJWTHeaderParameters,
|
|
33
33
|
) {
|
|
34
34
|
// validate if the required fieds are present based on https://www.ietf.org/archive/id/draft-ietf-oauth-status-list-02.html#section-5.1
|
|
35
|
-
|
|
36
|
-
if (!payload.iss) {
|
|
37
|
-
throw new SLException('iss field is required');
|
|
38
|
-
}
|
|
39
35
|
if (!payload.sub) {
|
|
40
36
|
throw new SLException('sub field is required');
|
|
41
37
|
}
|
|
@@ -35,7 +35,6 @@ describe('JWTStatusList', () => {
|
|
|
35
35
|
const statusList = new StatusList([1, 0, 1, 1, 1], 1);
|
|
36
36
|
const iss = 'https://example.com';
|
|
37
37
|
const payload: JwtPayload = {
|
|
38
|
-
iss,
|
|
39
38
|
sub: `${iss}/statuslist/1`,
|
|
40
39
|
iat: Math.floor(Date.now() / 1000),
|
|
41
40
|
};
|
|
@@ -59,7 +58,6 @@ describe('JWTStatusList', () => {
|
|
|
59
58
|
const statusList = new StatusList(list, 1);
|
|
60
59
|
const iss = 'https://example.com';
|
|
61
60
|
const payload: JwtPayload = {
|
|
62
|
-
iss,
|
|
63
61
|
sub: `${iss}/statuslist/1`,
|
|
64
62
|
iat: Math.floor(Date.now() / 1000),
|
|
65
63
|
};
|
|
@@ -80,34 +78,23 @@ describe('JWTStatusList', () => {
|
|
|
80
78
|
const list = [1, 0, 1, 0, 1];
|
|
81
79
|
const statusList = new StatusList(list, 2);
|
|
82
80
|
const iss = 'https://example.com';
|
|
83
|
-
|
|
84
|
-
sub: `${iss}/statuslist/1`,
|
|
85
|
-
iat: Math.floor(Date.now() / 1000),
|
|
86
|
-
};
|
|
87
|
-
expect(() => {
|
|
88
|
-
createHeaderAndPayload(statusList, payload as JwtPayload, header);
|
|
89
|
-
}).toThrow('iss field is required');
|
|
90
|
-
|
|
91
|
-
payload = {
|
|
92
|
-
iss,
|
|
81
|
+
const payload = {
|
|
93
82
|
iat: Math.floor(Date.now() / 1000),
|
|
94
83
|
};
|
|
95
84
|
expect(() => createHeaderAndPayload(statusList, payload, header)).toThrow(
|
|
96
85
|
'sub field is required',
|
|
97
86
|
);
|
|
98
87
|
|
|
99
|
-
|
|
100
|
-
iss,
|
|
88
|
+
const payload2 = {
|
|
101
89
|
sub: `${iss}/statuslist/1`,
|
|
102
90
|
};
|
|
103
|
-
expect(() => createHeaderAndPayload(statusList,
|
|
91
|
+
expect(() => createHeaderAndPayload(statusList, payload2, header)).toThrow(
|
|
104
92
|
'iat field is required',
|
|
105
93
|
);
|
|
106
94
|
});
|
|
107
95
|
|
|
108
96
|
it('should get the status entry from a JWT', async () => {
|
|
109
97
|
const payload: JWTwithStatusListPayload = {
|
|
110
|
-
iss: 'https://example.com',
|
|
111
98
|
sub: 'https://example.com/status/1',
|
|
112
99
|
iat: Math.floor(Date.now() / 1000),
|
|
113
100
|
status: {
|