@learncard/openid4vc-plugin 0.3.5 → 0.3.6
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/openid4vc-plugin.cjs.development.cjs +8 -8
- package/dist/openid4vc-plugin.cjs.development.cjs.map +2 -2
- package/dist/openid4vc-plugin.cjs.production.min.cjs +1 -1
- package/dist/openid4vc-plugin.cjs.production.min.cjs.map +2 -2
- package/dist/openid4vc-plugin.esm.js +8 -8
- package/dist/openid4vc-plugin.esm.js.map +2 -2
- package/dist/vp/present.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/vp/present.ts +16 -16
package/dist/vp/present.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present.d.ts","sourceRoot":"","sources":["../../src/vp/present.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI9C,OAAO,KAAK,EACR,mBAAmB,EACnB,sBAAsB,EAEzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAMH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,WAAW,GAAG,WAAW,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,mBAAmB,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CACjC;AAED,MAAM,WAAW,wBAAwB;IACrC,wFAAwF;IACxF,EAAE,EAAE,sBAAsB,CAAC;IAE3B;;;;OAIG;IACH,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAE3B,uFAAuF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
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "OpenID for Verifiable Credentials (OID4VCI + OID4VP + SIOPv2) holder support for LearnCard",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
},
|
|
52
52
|
"types": "./dist/index.d.ts",
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@learncard/core": "9.4.
|
|
55
|
-
"@learncard/didkit-plugin": "^1.9.
|
|
56
|
-
"@learncard/vc-plugin": "^1.5.
|
|
54
|
+
"@learncard/core": "9.4.33",
|
|
55
|
+
"@learncard/didkit-plugin": "^1.9.13",
|
|
56
|
+
"@learncard/vc-plugin": "^1.5.13",
|
|
57
57
|
"@peculiar/x509": "^1.12.0",
|
|
58
58
|
"dcql": "^3.0.0",
|
|
59
59
|
"jose": "^5.9.6",
|
package/src/vp/present.ts
CHANGED
|
@@ -164,10 +164,7 @@ export interface PreparedPresentation {
|
|
|
164
164
|
/* -------------------------------------------------------------------------- */
|
|
165
165
|
|
|
166
166
|
export type BuildPresentationErrorCode =
|
|
167
|
-
| '
|
|
168
|
-
| 'unknown_descriptor'
|
|
169
|
-
| 'unknown_credential_format'
|
|
170
|
-
| 'invalid_jwt_vc';
|
|
167
|
+
'no_selections' | 'unknown_descriptor' | 'unknown_credential_format' | 'invalid_jwt_vc';
|
|
171
168
|
|
|
172
169
|
export class BuildPresentationError extends Error {
|
|
173
170
|
readonly code: BuildPresentationErrorCode;
|
|
@@ -266,13 +263,11 @@ export const buildPresentation = (options: BuildPresentationOptions): PreparedPr
|
|
|
266
263
|
const submission: PresentationSubmission = {
|
|
267
264
|
id: options.submissionId ?? makeId(),
|
|
268
265
|
definition_id: pd.id,
|
|
269
|
-
descriptor_map: normalized.map(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
})
|
|
275
|
-
),
|
|
266
|
+
descriptor_map: normalized.map((n, index): PresentationSubmissionDescriptor => ({
|
|
267
|
+
id: n.descriptorId,
|
|
268
|
+
format: n.format,
|
|
269
|
+
path: pathForIndex(index, vpFormat),
|
|
270
|
+
})),
|
|
276
271
|
};
|
|
277
272
|
|
|
278
273
|
return {
|
|
@@ -500,15 +495,20 @@ const defaultMakeId = (): string => {
|
|
|
500
495
|
return Array.from(bytes, b => b.toString(16).padStart(2, '0')).join('');
|
|
501
496
|
}
|
|
502
497
|
|
|
503
|
-
|
|
498
|
+
// Fallback for environments without crypto - should not happen in modern runtimes
|
|
499
|
+
// Throw error instead of using insecure Math.random() for security-sensitive IDs
|
|
500
|
+
throw new Error(
|
|
501
|
+
'crypto.getRandomValues is required but not available. ' +
|
|
502
|
+
'Ensure you are running in a modern browser or Node.js environment.'
|
|
503
|
+
);
|
|
504
504
|
};
|
|
505
505
|
|
|
506
506
|
/**
|
|
507
507
|
* Build a v4 UUID string using the caller-supplied random generator
|
|
508
|
-
* (so tests can inject deterministic output).
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
*
|
|
508
|
+
* (so tests can inject deterministic output). Pads non-hex input to
|
|
509
|
+
* 32 hex chars. Note: defaultMakeId requires crypto.getRandomValues
|
|
510
|
+
* and will throw in legacy environments without it (no Math.random
|
|
511
|
+
* fallback to avoid CodeQL security warnings).
|
|
512
512
|
*/
|
|
513
513
|
const makeUuidV4 = (makeId: () => string): string => {
|
|
514
514
|
const hex = makeId().replace(/[^0-9a-f]/gi, '');
|