@sd-jwt/sd-jwt-vc 0.7.1 → 0.7.2-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.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +12 -2
- package/dist/index.mjs +12 -2
- package/package.json +7 -7
- package/src/sd-jwt-vc-instance.ts +16 -2
- package/test/app-e2e.spec.ts +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _sd_jwt_types from '@sd-jwt/types';
|
|
1
2
|
import { SDJWTConfig, DisclosureFrame } from '@sd-jwt/types';
|
|
2
3
|
import { SdJwtPayload, SDJwtInstance } from '@sd-jwt/core';
|
|
3
4
|
|
|
@@ -57,6 +58,10 @@ declare class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
57
58
|
verify(encodedSDJwt: string, requiredClaimKeys?: string[], requireKeyBindings?: boolean): Promise<{
|
|
58
59
|
payload: SdJwtVcPayload;
|
|
59
60
|
header: Record<string, unknown> | undefined;
|
|
61
|
+
kb: {
|
|
62
|
+
payload: _sd_jwt_types.kbPayload;
|
|
63
|
+
header: _sd_jwt_types.kbHeader;
|
|
64
|
+
} | undefined;
|
|
60
65
|
}>;
|
|
61
66
|
}
|
|
62
67
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _sd_jwt_types from '@sd-jwt/types';
|
|
1
2
|
import { SDJWTConfig, DisclosureFrame } from '@sd-jwt/types';
|
|
2
3
|
import { SdJwtPayload, SDJwtInstance } from '@sd-jwt/core';
|
|
3
4
|
|
|
@@ -57,6 +58,10 @@ declare class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
57
58
|
verify(encodedSDJwt: string, requiredClaimKeys?: string[], requireKeyBindings?: boolean): Promise<{
|
|
58
59
|
payload: SdJwtVcPayload;
|
|
59
60
|
header: Record<string, unknown> | undefined;
|
|
61
|
+
kb: {
|
|
62
|
+
payload: _sd_jwt_types.kbPayload;
|
|
63
|
+
header: _sd_jwt_types.kbHeader;
|
|
64
|
+
} | undefined;
|
|
60
65
|
}>;
|
|
61
66
|
}
|
|
62
67
|
|
package/dist/index.js
CHANGED
|
@@ -86,12 +86,18 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
|
|
|
86
86
|
const controller = new AbortController();
|
|
87
87
|
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
88
88
|
try {
|
|
89
|
-
const response = yield fetch(uri, {
|
|
89
|
+
const response = yield fetch(uri, {
|
|
90
|
+
signal: controller.signal,
|
|
91
|
+
headers: { Accept: "application/statuslist+jwt" }
|
|
92
|
+
});
|
|
90
93
|
if (!response.ok) {
|
|
91
94
|
throw new Error(
|
|
92
95
|
`Error fetching status list: ${response.status} ${yield response.text()}`
|
|
93
96
|
);
|
|
94
97
|
}
|
|
98
|
+
if (response.headers.get("content-type") !== "application/statuslist+jwt") {
|
|
99
|
+
throw new Error("Invalid content type");
|
|
100
|
+
}
|
|
95
101
|
return response.text();
|
|
96
102
|
} finally {
|
|
97
103
|
clearTimeout(timeoutId);
|
|
@@ -117,7 +123,11 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
|
|
|
117
123
|
return __async(this, null, function* () {
|
|
118
124
|
var _a, _b, _c;
|
|
119
125
|
const result = yield __superGet(_SDJwtVcInstance.prototype, this, "verify").call(this, encodedSDJwt, requiredClaimKeys, requireKeyBindings).then((res) => {
|
|
120
|
-
return {
|
|
126
|
+
return {
|
|
127
|
+
payload: res.payload,
|
|
128
|
+
header: res.header,
|
|
129
|
+
kb: res.kb
|
|
130
|
+
};
|
|
121
131
|
});
|
|
122
132
|
if (result.payload.status) {
|
|
123
133
|
if (result.payload.status.status_list) {
|
package/dist/index.mjs
CHANGED
|
@@ -63,12 +63,18 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends SDJwtInstance {
|
|
|
63
63
|
const controller = new AbortController();
|
|
64
64
|
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
65
65
|
try {
|
|
66
|
-
const response = yield fetch(uri, {
|
|
66
|
+
const response = yield fetch(uri, {
|
|
67
|
+
signal: controller.signal,
|
|
68
|
+
headers: { Accept: "application/statuslist+jwt" }
|
|
69
|
+
});
|
|
67
70
|
if (!response.ok) {
|
|
68
71
|
throw new Error(
|
|
69
72
|
`Error fetching status list: ${response.status} ${yield response.text()}`
|
|
70
73
|
);
|
|
71
74
|
}
|
|
75
|
+
if (response.headers.get("content-type") !== "application/statuslist+jwt") {
|
|
76
|
+
throw new Error("Invalid content type");
|
|
77
|
+
}
|
|
72
78
|
return response.text();
|
|
73
79
|
} finally {
|
|
74
80
|
clearTimeout(timeoutId);
|
|
@@ -94,7 +100,11 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends SDJwtInstance {
|
|
|
94
100
|
return __async(this, null, function* () {
|
|
95
101
|
var _a, _b, _c;
|
|
96
102
|
const result = yield __superGet(_SDJwtVcInstance.prototype, this, "verify").call(this, encodedSDJwt, requiredClaimKeys, requireKeyBindings).then((res) => {
|
|
97
|
-
return {
|
|
103
|
+
return {
|
|
104
|
+
payload: res.payload,
|
|
105
|
+
header: res.header,
|
|
106
|
+
kb: res.kb
|
|
107
|
+
};
|
|
98
108
|
});
|
|
99
109
|
if (result.payload.status) {
|
|
100
110
|
if (result.payload.status.status_list) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/sd-jwt-vc",
|
|
3
|
-
"version": "0.7.1",
|
|
3
|
+
"version": "0.7.2-next.1+6747319",
|
|
4
4
|
"description": "sd-jwt draft 7 implementation in typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
},
|
|
40
40
|
"license": "Apache-2.0",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@sd-jwt/core": "0.7.1",
|
|
43
|
-
"@sd-jwt/jwt-status-list": "0.7.1",
|
|
44
|
-
"@sd-jwt/utils": "0.7.1"
|
|
42
|
+
"@sd-jwt/core": "0.7.2-next.1+6747319",
|
|
43
|
+
"@sd-jwt/jwt-status-list": "0.7.2-next.1+6747319",
|
|
44
|
+
"@sd-jwt/utils": "0.7.2-next.1+6747319"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@sd-jwt/crypto-nodejs": "0.7.1",
|
|
48
|
-
"@sd-jwt/types": "0.7.1",
|
|
47
|
+
"@sd-jwt/crypto-nodejs": "0.7.2-next.1+6747319",
|
|
48
|
+
"@sd-jwt/types": "0.7.2-next.1+6747319",
|
|
49
49
|
"jose": "^5.2.2"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"esm"
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "6747319c6f8ee748d84d1cb6ced43fcaec5f4fca"
|
|
68
68
|
}
|
|
@@ -57,7 +57,10 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
57
57
|
const timeoutId = setTimeout(() => controller.abort(), 10000);
|
|
58
58
|
|
|
59
59
|
try {
|
|
60
|
-
const response = await fetch(uri, {
|
|
60
|
+
const response = await fetch(uri, {
|
|
61
|
+
signal: controller.signal,
|
|
62
|
+
headers: { Accept: 'application/statuslist+jwt' },
|
|
63
|
+
});
|
|
61
64
|
if (!response.ok) {
|
|
62
65
|
throw new Error(
|
|
63
66
|
`Error fetching status list: ${
|
|
@@ -66,6 +69,13 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
66
69
|
);
|
|
67
70
|
}
|
|
68
71
|
|
|
72
|
+
// according to the spec the content type should be application/statuslist+jwt
|
|
73
|
+
if (
|
|
74
|
+
response.headers.get('content-type') !== 'application/statuslist+jwt'
|
|
75
|
+
) {
|
|
76
|
+
throw new Error('Invalid content type');
|
|
77
|
+
}
|
|
78
|
+
|
|
69
79
|
return response.text();
|
|
70
80
|
} finally {
|
|
71
81
|
clearTimeout(timeoutId);
|
|
@@ -94,7 +104,11 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
94
104
|
const result = await super
|
|
95
105
|
.verify(encodedSDJwt, requiredClaimKeys, requireKeyBindings)
|
|
96
106
|
.then((res) => {
|
|
97
|
-
return {
|
|
107
|
+
return {
|
|
108
|
+
payload: res.payload as SdJwtVcPayload,
|
|
109
|
+
header: res.header,
|
|
110
|
+
kb: res.kb,
|
|
111
|
+
};
|
|
98
112
|
});
|
|
99
113
|
|
|
100
114
|
if (result.payload.status) {
|