@learncard/openid4vc-plugin 0.1.2 → 0.2.0

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.
Files changed (44) hide show
  1. package/dist/dcql/adapt.d.ts +18 -6
  2. package/dist/dcql/adapt.d.ts.map +1 -1
  3. package/dist/dcql/build.d.ts +48 -7
  4. package/dist/dcql/build.d.ts.map +1 -1
  5. package/dist/dcql/index.d.ts +3 -3
  6. package/dist/dcql/index.d.ts.map +1 -1
  7. package/dist/dcql/respond.d.ts +19 -6
  8. package/dist/dcql/respond.d.ts.map +1 -1
  9. package/dist/dcql/select.d.ts +11 -1
  10. package/dist/dcql/select.d.ts.map +1 -1
  11. package/dist/openid4vc-plugin.cjs.development.cjs +32538 -1387
  12. package/dist/openid4vc-plugin.cjs.development.cjs.map +4 -4
  13. package/dist/openid4vc-plugin.cjs.production.min.cjs +63 -19
  14. package/dist/openid4vc-plugin.cjs.production.min.cjs.map +4 -4
  15. package/dist/openid4vc-plugin.esm.js +32538 -1387
  16. package/dist/openid4vc-plugin.esm.js.map +4 -4
  17. package/dist/plugin.d.ts.map +1 -1
  18. package/dist/types.d.ts +39 -1
  19. package/dist/types.d.ts.map +1 -1
  20. package/dist/vci/accept.d.ts +15 -1
  21. package/dist/vci/accept.d.ts.map +1 -1
  22. package/dist/vci/auth-code.d.ts +32 -0
  23. package/dist/vci/auth-code.d.ts.map +1 -1
  24. package/dist/vci/decode.d.ts +18 -0
  25. package/dist/vci/decode.d.ts.map +1 -1
  26. package/dist/vci/index.d.ts +1 -0
  27. package/dist/vci/index.d.ts.map +1 -1
  28. package/dist/vci/nonce.d.ts +10 -0
  29. package/dist/vci/nonce.d.ts.map +1 -0
  30. package/dist/vci/sd-jwt-vc.d.ts +10 -0
  31. package/dist/vci/sd-jwt-vc.d.ts.map +1 -0
  32. package/dist/vci/store.d.ts +24 -2
  33. package/dist/vci/store.d.ts.map +1 -1
  34. package/dist/vci/types.d.ts +2 -0
  35. package/dist/vci/types.d.ts.map +1 -1
  36. package/dist/vp/index.d.ts +3 -3
  37. package/dist/vp/index.d.ts.map +1 -1
  38. package/dist/vp/present.d.ts +31 -1
  39. package/dist/vp/present.d.ts.map +1 -1
  40. package/dist/vp/select.d.ts +33 -1
  41. package/dist/vp/select.d.ts.map +1 -1
  42. package/dist/vp/sign.d.ts +41 -3
  43. package/dist/vp/sign.d.ts.map +1 -1
  44. package/package.json +5 -5
@@ -34,10 +34,11 @@
34
34
  * `DcqlMdocCredential` shape requires a CBOR-decoded namespace
35
35
  * tree we don't compute.
36
36
  */
37
- import type { DcqlW3cVcCredential } from './types';
37
+ import type { DcqlSdJwtVcCredential, DcqlW3cVcCredential } from './types';
38
+ import type { SdJwtParser } from '../vp/select';
38
39
  /** Subset of {@link CandidateCredential} this adapter consumes. */
39
40
  export interface AdaptableCredential {
40
- /** Wire-shape credential — string for JWT-VCs, object for LD-VCs. */
41
+ /** Wire-shape credential — string for JWT-VCs, object for LD-VCs, compact for SD-JWT. */
41
42
  credential: unknown;
42
43
  /**
43
44
  * Optional explicit format hint. When omitted the adapter infers
@@ -48,6 +49,16 @@ export interface AdaptableCredential {
48
49
  */
49
50
  format?: string;
50
51
  }
52
+ export interface AdaptOptions {
53
+ /**
54
+ * Required when SD-JWT candidates are in the pool. Plugin-level
55
+ * callers wire this to `learnCard.invoke.parseSdJwtVc` (same
56
+ * runtime feature-detect convention as the PEX matcher); test
57
+ * callers can skip it when none of their fixtures are SD-JWT.
58
+ */
59
+ sdJwtParser?: SdJwtParser;
60
+ }
61
+ type AdaptedCredential = DcqlW3cVcCredential | DcqlSdJwtVcCredential;
51
62
  /**
52
63
  * Convert a single held credential into a `DcqlW3cVcCredential` ready
53
64
  * for `DcqlQuery.query()` to evaluate.
@@ -64,7 +75,7 @@ export interface AdaptableCredential {
64
75
  * caller to wrap in try/catch and degrade UX for "I have a weird
65
76
  * credential" cases that are otherwise harmless.
66
77
  */
67
- export declare const adaptCredentialForDcql: (candidate: AdaptableCredential) => DcqlW3cVcCredential | undefined;
78
+ export declare const adaptCredentialForDcql: (candidate: AdaptableCredential, options?: AdaptOptions) => Promise<AdaptedCredential | undefined>;
68
79
  /**
69
80
  * Batch adapter — runs {@link adaptCredentialForDcql} over a candidate
70
81
  * pool, dropping any that don't normalize. Returns the filtered list
@@ -73,8 +84,9 @@ export declare const adaptCredentialForDcql: (candidate: AdaptableCredential) =>
73
84
  * present (the matcher only sees the normalized shape; submission
74
85
  * needs the original).
75
86
  */
76
- export declare const adaptCredentialsForDcql: (candidates: readonly AdaptableCredential[]) => Array<{
87
+ export declare const adaptCredentialsForDcql: (candidates: readonly AdaptableCredential[], options?: AdaptOptions) => Promise<Array<{
77
88
  original: AdaptableCredential;
78
- adapted: DcqlW3cVcCredential;
79
- }>;
89
+ adapted: AdaptedCredential;
90
+ }>>;
91
+ export {};
80
92
  //# sourceMappingURL=adapt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapt.d.ts","sourceRoot":"","sources":["../../src/dcql/adapt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,mEAAmE;AACnE,MAAM,WAAW,mBAAmB;IAChC,qEAAqE;IACrE,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,cACpB,mBAAmB,KAC/B,mBAAmB,GAAG,SAaxB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,eACpB,SAAS,mBAAmB,EAAE,KAC3C,KAAK,CAAC;IAAE,QAAQ,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,CASvE,CAAC"}
1
+ {"version":3,"file":"adapt.d.ts","sourceRoot":"","sources":["../../src/dcql/adapt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,mEAAmE;AACnE,MAAM,WAAW,mBAAmB;IAChC,yFAAyF;IACzF,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC7B;AAED,KAAK,iBAAiB,GAAG,mBAAmB,GAAG,qBAAqB,CAAC;AAErE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,cACpB,mBAAmB,YACrB,YAAY,KACtB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAgBvC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,eACpB,SAAS,mBAAmB,EAAE,YACjC,YAAY,KACtB,OAAO,CAAC,KAAK,CAAC;IAAE,QAAQ,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAY9E,CAAC"}
@@ -48,8 +48,15 @@
48
48
  import type { UnsignedVP } from '@learncard/types';
49
49
  import type { AdaptableCredential } from './adapt';
50
50
  import type { DcqlQuery } from './types';
51
- /** Outer presentation envelope format produced for a DCQL response. */
52
- export type DcqlVpFormat = 'jwt_vp_json' | 'ldp_vp';
51
+ import type { SdJwtDiscloseFrame } from '../vp/sign';
52
+ /**
53
+ * Outer envelope format for a DCQL per-query response. The first two
54
+ * are W3C VP envelopes signed by the signing layer; the last two are
55
+ * SD-JWT-VC passthroughs that carry the compact form directly into the
56
+ * `vp_token` value (no VP envelope per OID4VP §6.1.1 — the issuer JWT
57
+ * + disclosures + KB-JWT IS the presentation).
58
+ */
59
+ export type DcqlVpFormat = 'jwt_vp_json' | 'ldp_vp' | 'dc+sd-jwt' | 'vc+sd-jwt';
53
60
  /**
54
61
  * One holder pick: "this candidate satisfies this credential query."
55
62
  *
@@ -59,8 +66,14 @@ export type DcqlVpFormat = 'jwt_vp_json' | 'ldp_vp';
59
66
  export interface DcqlChosenCredential {
60
67
  /** Matches `DcqlQuery.credentials[N].id` from the verifier's query. */
61
68
  credentialQueryId: string;
62
- /** Wire-shape credential (JWT-VC string or LD-VC object). */
69
+ /** Wire-shape credential (JWT-VC string, LD-VC object, or SD-JWT compact). */
63
70
  candidate: AdaptableCredential;
71
+ /**
72
+ * Optional per-claim consent frame, honored only when this entry
73
+ * resolves to an SD-JWT-VC passthrough. Omitted = release every
74
+ * disclosable claim (no selective disclosure).
75
+ */
76
+ disclose?: SdJwtDiscloseFrame;
64
77
  }
65
78
  export interface BuildDcqlPresentationsInput {
66
79
  /**
@@ -81,14 +94,29 @@ export interface BuildDcqlPresentationsInput {
81
94
  */
82
95
  makeId?: () => string;
83
96
  }
84
- /** One unsigned VP, ready for the signing layer. */
85
- export interface BuiltDcqlPresentation {
97
+ /**
98
+ * Per-query build output. Discriminated by `kind`:
99
+ *
100
+ * - `vp` — verifiable presentation envelope (jwt_vp_json or ldp_vp).
101
+ * The signing layer wraps the chosen credentials in `unsignedVp` and
102
+ * produces a signed VP. This is the path for `jwt_vc_json` / `ldp_vc`
103
+ * inner formats.
104
+ * - `sd-jwt-vc` — passthrough for `dc+sd-jwt` / `vc+sd-jwt` queries. The
105
+ * compact SD-JWT-VC IS the presentation per OID4VP §6.1.1; the
106
+ * signing layer asks `learnCard.invoke.presentSdJwtVc` to apply
107
+ * selective disclosure + KB-JWT and emits the resulting compact string
108
+ * as the `vp_token` value for this query id. DCQL's `multiple: true`
109
+ * is not yet implemented for SD-JWT (one compact per query id).
110
+ */
111
+ export type BuiltDcqlPresentation = BuiltDcqlVpPresentation | BuiltDcqlSdJwtPresentation;
112
+ export interface BuiltDcqlVpPresentation {
113
+ kind: 'vp';
86
114
  /** Matches `DcqlQuery.credentials[N].id`. */
87
115
  credentialQueryId: string;
88
116
  /** Unsigned VP wrapping the chosen credentials for this query. */
89
117
  unsignedVp: UnsignedVP;
90
118
  /** Envelope format the signing layer should use. */
91
- vpFormat: DcqlVpFormat;
119
+ vpFormat: 'jwt_vp_json' | 'ldp_vp';
92
120
  /**
93
121
  * Original wire-shape candidates packed into this VP, in the
94
122
  * order they appear in `unsignedVp.verifiableCredential`. The
@@ -97,7 +125,20 @@ export interface BuiltDcqlPresentation {
97
125
  */
98
126
  candidates: AdaptableCredential[];
99
127
  }
100
- export type BuildDcqlPresentationErrorCode = 'no_selections' | 'unknown_credential_query' | 'unsupported_format' | 'invalid_jwt_vc';
128
+ export interface BuiltDcqlSdJwtPresentation {
129
+ kind: 'sd-jwt-vc';
130
+ /** Matches `DcqlQuery.credentials[N].id`. */
131
+ credentialQueryId: string;
132
+ /** Source compact SD-JWT-VC the holder chose. The signing layer feeds this into `presentSdJwtVc`. */
133
+ compact: string;
134
+ /** Format declared by the verifier on this query entry; passed back so the response can echo it. */
135
+ vpFormat: 'dc+sd-jwt' | 'vc+sd-jwt';
136
+ /** Original wire-shape candidates (always length-1 in this slice; `multiple: true` is a follow-up). */
137
+ candidates: AdaptableCredential[];
138
+ /** Per-claim consent frame from the holder UI, forwarded to the SD-JWT presenter at sign time. */
139
+ disclose?: SdJwtDiscloseFrame;
140
+ }
141
+ export type BuildDcqlPresentationErrorCode = 'no_selections' | 'unknown_credential_query' | 'unsupported_format' | 'invalid_jwt_vc' | 'invalid_sd_jwt_vc';
101
142
  export declare class BuildDcqlPresentationError extends Error {
102
143
  readonly code: BuildDcqlPresentationErrorCode;
103
144
  constructor(code: BuildDcqlPresentationErrorCode, message: string);
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/dcql/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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mBAAmB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,0BAA0B;IACvC,IAAI,EAAE,WAAW,CAAC;IAClB,6CAA6C;IAC7C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qGAAqG;IACrG,OAAO,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,QAAQ,EAAE,WAAW,GAAG,WAAW,CAAC;IACpC,uGAAuG;IACvG,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,kGAAkG;IAClG,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CACjC;AAMD,MAAM,MAAM,8BAA8B,GACpC,eAAe,GACf,0BAA0B,GAC1B,oBAAoB,GACpB,gBAAgB,GAChB,mBAAmB,CAAC;AAE1B,qBAAa,0BAA2B,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,EAAE,8BAA8B,CAAC;gBAElC,IAAI,EAAE,8BAA8B,EAAE,OAAO,EAAE,MAAM;CAKpE;AAMD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,UACxB,2BAA2B,KACnC,qBAAqB,EA4DvB,CAAC"}
@@ -10,9 +10,9 @@
10
10
  */
11
11
  export type { DcqlQuery, DcqlQueryResult, DcqlCredential, DcqlW3cVcCredential, DcqlSdJwtVcCredential, DcqlMdocCredential, DcqlPresentation, DcqlPresentationResult, DcqlPresentationEntry, } from './types';
12
12
  export { parseDcqlQuery } from './parse';
13
- export { adaptCredentialForDcql, adaptCredentialsForDcql, type AdaptableCredential, } from './adapt';
13
+ export { adaptCredentialForDcql, adaptCredentialsForDcql, type AdaptableCredential } from './adapt';
14
14
  export { selectCredentialsForDcql, type DcqlSelectionResult, type DcqlCredentialMatch, } from './select';
15
- export { buildDcqlPresentations, BuildDcqlPresentationError, type BuildDcqlPresentationsInput, type BuiltDcqlPresentation, type DcqlChosenCredential, type DcqlVpFormat, type BuildDcqlPresentationErrorCode, } from './build';
16
- export { signDcqlPresentations, buildDcqlResponse, assembleDcqlVpToken, type DcqlSignedPresentation, type DcqlInnerVpToken, type DcqlResponse, type SignDcqlPresentationsInput, type SignDcqlPresentationsHelpers, } from './respond';
15
+ export { buildDcqlPresentations, BuildDcqlPresentationError, type BuildDcqlPresentationsInput, type BuiltDcqlPresentation, type BuiltDcqlVpPresentation, type BuiltDcqlSdJwtPresentation, type DcqlChosenCredential, type DcqlVpFormat, type BuildDcqlPresentationErrorCode, } from './build';
16
+ export { signDcqlPresentations, buildDcqlResponse, assembleDcqlVpToken, DcqlSignError, type DcqlSignedPresentation, type DcqlInnerVpToken, type DcqlResponse, type SignDcqlPresentationsInput, type SignDcqlPresentationsHelpers, } from './respond';
17
17
  export { buildDcqlQuery, requestW3cVc, type RequestW3cVcSpec, type RequestW3cVcClaim, } from './compose';
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dcql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,YAAY,EACR,SAAS,EACT,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACxB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,mBAAmB,GAC3B,MAAM,SAAS,CAAC;AAEjB,OAAO,EACH,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GAC3B,MAAM,UAAU,CAAC;AAElB,OAAO,EACH,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,8BAA8B,GACtC,MAAM,SAAS,CAAC;AAEjB,OAAO,EACH,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,GACpC,MAAM,WAAW,CAAC;AAGnB,OAAO,EACH,cAAc,EACd,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACzB,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dcql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,YAAY,EACR,SAAS,EACT,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACxB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEpG,OAAO,EACH,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GAC3B,MAAM,UAAU,CAAC;AAElB,OAAO,EACH,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,8BAA8B,GACtC,MAAM,SAAS,CAAC;AAEjB,OAAO,EACH,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,GACpC,MAAM,WAAW,CAAC;AAGnB,OAAO,EACH,cAAc,EACd,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACzB,MAAM,WAAW,CAAC"}
@@ -32,9 +32,10 @@
32
32
  * Submission to `response_uri` happens in the next slice via an
33
33
  * extension to `vp/submit.ts` that takes an object-form `vp_token`.
34
34
  */
35
- import { type LdpVpSigner } from '../vp/sign';
35
+ import { type LdpVpSigner, type SdJwtPresenter } from '../vp/sign';
36
36
  import type { ProofJwtSigner } from '../vci/types';
37
37
  import type { BuiltDcqlPresentation } from './build';
38
+ export type { SdJwtPresenter };
38
39
  export interface SignDcqlPresentationsInput {
39
40
  /** Output of `buildDcqlPresentations(...)`. */
40
41
  built: readonly BuiltDcqlPresentation[];
@@ -52,6 +53,8 @@ export interface SignDcqlPresentationsHelpers {
52
53
  jwtSigner?: ProofJwtSigner;
53
54
  /** Required when any `built[].vpFormat === 'ldp_vp'`. */
54
55
  ldpVpSigner?: LdpVpSigner;
56
+ /** Required when any `built[].kind === 'sd-jwt-vc'`. */
57
+ sdJwtPresenter?: SdJwtPresenter;
55
58
  }
56
59
  /**
57
60
  * One signed presentation in a DCQL response. The value type is the
@@ -80,15 +83,25 @@ export interface DcqlResponse {
80
83
  */
81
84
  presentations: DcqlSignedPresentation[];
82
85
  }
86
+ export declare class DcqlSignError extends Error {
87
+ readonly code: 'missing_sd_jwt_presenter' | 'sd_jwt_present_failed';
88
+ constructor(code: DcqlSignError['code'], message: string, options?: {
89
+ cause?: unknown;
90
+ });
91
+ }
83
92
  /**
84
93
  * Sign each unsigned VP from {@link buildDcqlPresentations} using the
85
94
  * appropriate signer (jwt for jwt_vp_json, ldp for ldp_vp), preserving
86
- * the per-query `credentialQueryId` association.
95
+ * the per-query `credentialQueryId` association. SD-JWT-VC entries
96
+ * (`kind: 'sd-jwt-vc'`) are routed through `helpers.sdJwtPresenter`
97
+ * instead of the VP signing path — the compact form they produce IS
98
+ * the vp_token value for that query id.
87
99
  *
88
- * Throws `VpSignError` (the same code path as PEX signing) on signer
89
- * misconfiguration; the per-query signing is sequential rather than
90
- * parallel both because Ed25519 signing is fast (sub-ms per VP) and
91
- * because some host signers maintain ordered nonce state.
100
+ * Throws `VpSignError` for VP signing failures and `DcqlSignError`
101
+ * for SD-JWT presenter failures. Per-query signing is sequential
102
+ * rather than parallel both because Ed25519 signing is fast (sub-ms
103
+ * per VP) and because some host signers maintain ordered nonce
104
+ * state.
92
105
  */
93
106
  export declare const signDcqlPresentations: (input: SignDcqlPresentationsInput, helpers: SignDcqlPresentationsHelpers) => Promise<DcqlSignedPresentation[]>;
94
107
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"respond.d.ts","sourceRoot":"","sources":["../../src/dcql/respond.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAEH,KAAK,WAAW,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAMrD,MAAM,WAAW,0BAA0B;IACvC,+CAA+C;IAC/C,KAAK,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxC,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,4BAA4B;IACzC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,yDAAyD;IACzD,WAAW,CAAC,EAAE,WAAW,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,kBAAkB,EAAE,EAAE,CAAC;AAEtE,MAAM,WAAW,sBAAsB;IACnC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,OAAO,E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DAAwD;IACxD,cAAc,CAAC,EAAE,cAAc,CAAC;CACnC;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,kBAAkB,EAAE,EAAE,CAAC;AAEtE,MAAM,WAAW,sBAAsB;IACnC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAE1C;;;;OAIG;IACH,aAAa,EAAE,sBAAsB,EAAE,CAAC;CAC3C;AAMD,qBAAa,aAAc,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,0BAA0B,GAAG,uBAAuB,CAAC;gBAExD,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAQ1F;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,UACvB,0BAA0B,WACxB,4BAA4B,KACtC,OAAO,CAAC,sBAAsB,EAAE,CA6BlC,CAAC;AAsCF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,UACnB,0BAA0B,WACxB,4BAA4B,KACtC,OAAO,CAAC,YAAY,CAMtB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,kBACb,SAAS,sBAAsB,EAAE,KACjD,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAMjC,CAAC"}
@@ -1,5 +1,15 @@
1
1
  import { type AdaptableCredential } from './adapt';
2
2
  import type { DcqlQueryResult } from './types';
3
+ import type { SdJwtParser } from '../vp/select';
4
+ export interface SelectForDcqlOptions {
5
+ /**
6
+ * Required when SD-JWT candidates are in the pool; ignored otherwise.
7
+ * Same runtime-feature-detect injection seam as the PEX matcher's
8
+ * `SelectCredentialsOptions.sdJwtParser`. Plugin-level callers wire
9
+ * this to `learnCard.invoke.parseSdJwtVc`.
10
+ */
11
+ sdJwtParser?: SdJwtParser;
12
+ }
3
13
  /**
4
14
  * Per-credential-query result. Each `DcqlQuery.credentials[]` entry
5
15
  * gets exactly one of these in `DcqlSelectionResult.matches[]`,
@@ -59,5 +69,5 @@ export interface DcqlSelectionResult {
59
69
  * (sd-jwt-vc, mso_mdoc — see `./adapt.ts`) without erroring; those
60
70
  * simply don't appear in `matches[*].candidates`.
61
71
  */
62
- export declare const selectCredentialsForDcql: (candidates: readonly AdaptableCredential[], query: import("./types").DcqlQuery) => DcqlSelectionResult;
72
+ export declare const selectCredentialsForDcql: (candidates: readonly AdaptableCredential[], query: import("./types").DcqlQuery, options?: SelectForDcqlOptions) => Promise<DcqlSelectionResult>;
63
73
  //# sourceMappingURL=select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/dcql/select.ts"],"names":[],"mappings":"AAiCA,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,SAAS,CAAC;AAM1D;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAChC,uEAAuE;IACvE,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAElC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;;;OAKG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAE7C,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IAC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