@interop/wallet-core 0.69.0 → 0.71.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.
- package/README.md +22 -36
- package/dist/clientAnnex/ladder.d.ts +103 -57
- package/dist/clientAnnex/ladder.d.ts.map +1 -1
- package/dist/clientAnnex/ladder.js +254 -335
- package/dist/clientAnnex/ladder.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +10 -5
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +3 -15
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.js +22 -3
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/selfEnroll.js +1 -1
- package/dist/clientAnnex/selfEnroll.js.map +1 -1
- package/dist/clientAnnex/zcap.js +1 -1
- package/dist/clientAnnex/zcap.js.map +1 -1
- package/dist/clients/grantState.d.ts +67 -0
- package/dist/clients/grantState.d.ts.map +1 -0
- package/dist/clients/grantState.js +72 -0
- package/dist/clients/grantState.js.map +1 -0
- package/dist/clients/index.d.ts +7 -0
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +6 -0
- package/dist/clients/index.js.map +1 -1
- package/dist/enrollment/connectCode.d.ts +4 -3
- package/dist/enrollment/connectCode.d.ts.map +1 -1
- package/dist/enrollment/connectCode.js +4 -3
- package/dist/enrollment/connectCode.js.map +1 -1
- package/dist/enrollment/enrollment.js +1 -1
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/enrollment/index.d.ts +2 -2
- package/dist/enrollment/index.js +2 -2
- package/dist/enrollment/onboardingInvite.d.ts +1 -1
- package/dist/enrollment/onboardingInvite.js +1 -1
- package/dist/enrollment/onboardingResponse.js +1 -1
- package/dist/index.d.ts +4 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -11
- package/dist/index.js.map +1 -1
- package/dist/keyring/index.d.ts +1 -1
- package/dist/keyring/index.js +1 -1
- package/dist/keyring/kdf.d.ts +34 -20
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +37 -26
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keys/userKey.js +1 -1
- package/dist/keys/userKey.js.map +1 -1
- package/dist/recovery/continuation.d.ts +5 -4
- package/dist/recovery/continuation.d.ts.map +1 -1
- package/dist/recovery/continuation.js +14 -13
- package/dist/recovery/continuation.js.map +1 -1
- package/dist/resourceLog/document.d.ts +10 -2
- package/dist/resourceLog/document.d.ts.map +1 -1
- package/dist/resourceLog/document.js +1 -2
- package/dist/resourceLog/document.js.map +1 -1
- package/dist/space/index.d.ts +4 -2
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +4 -2
- package/dist/space/index.js.map +1 -1
- package/dist/space/wasLink.d.ts +13 -2
- package/dist/space/wasLink.d.ts.map +1 -1
- package/dist/space/wasLink.js +28 -2
- package/dist/space/wasLink.js.map +1 -1
- package/dist/unlock/index.d.ts +1 -1
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js.map +1 -1
- package/dist/unlock/standingClient.d.ts +1 -1
- package/dist/unlock/standingClient.d.ts.map +1 -1
- package/dist/unlock/standingClient.js +3 -3
- package/dist/unlock/standingClient.js.map +1 -1
- package/dist/unlock/standingWebvh.d.ts +81 -19
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +170 -30
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/webvh/did.d.ts +2 -4
- package/dist/webvh/did.d.ts.map +1 -1
- package/dist/webvh/did.js +2 -4
- package/dist/webvh/did.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +3 -2
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +2 -1
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/index.d.ts +1 -1
- package/dist/webvh/index.js +1 -1
- package/dist/webvh/revokeClient.d.ts +13 -7
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +14 -7
- package/dist/webvh/revokeClient.js.map +1 -1
- package/dist/webvh/zcap.js +1 -1
- package/dist/webvh/zcap.js.map +1 -1
- package/package.json +2 -23
- package/dist/identity/agents.d.ts +0 -100
- package/dist/identity/agents.d.ts.map +0 -1
- package/dist/identity/agents.js +0 -120
- package/dist/identity/agents.js.map +0 -1
- package/dist/identity/index.d.ts +0 -24
- package/dist/identity/index.d.ts.map +0 -1
- package/dist/identity/index.js +0 -23
- package/dist/identity/index.js.map +0 -1
- package/dist/identity/keyResolver.d.ts +0 -30
- package/dist/identity/keyResolver.d.ts.map +0 -1
- package/dist/identity/keyResolver.js +0 -25
- package/dist/identity/keyResolver.js.map +0 -1
- package/dist/request/appKey.d.ts +0 -295
- package/dist/request/appKey.d.ts.map +0 -1
- package/dist/request/appKey.js +0 -516
- package/dist/request/appKey.js.map +0 -1
- package/dist/request/capabilityRequest.d.ts +0 -41
- package/dist/request/capabilityRequest.d.ts.map +0 -1
- package/dist/request/capabilityRequest.js +0 -46
- package/dist/request/capabilityRequest.js.map +0 -1
- package/dist/request/classify.d.ts +0 -226
- package/dist/request/classify.d.ts.map +0 -1
- package/dist/request/classify.js +0 -416
- package/dist/request/classify.js.map +0 -1
- package/dist/request/composeVp.d.ts +0 -52
- package/dist/request/composeVp.d.ts.map +0 -1
- package/dist/request/composeVp.js +0 -176
- package/dist/request/composeVp.js.map +0 -1
- package/dist/request/ephemeralExchange.d.ts +0 -100
- package/dist/request/ephemeralExchange.d.ts.map +0 -1
- package/dist/request/ephemeralExchange.js +0 -230
- package/dist/request/ephemeralExchange.js.map +0 -1
- package/dist/request/exchangeClient.d.ts +0 -142
- package/dist/request/exchangeClient.d.ts.map +0 -1
- package/dist/request/exchangeClient.js +0 -241
- package/dist/request/exchangeClient.js.map +0 -1
- package/dist/request/index.d.ts +0 -59
- package/dist/request/index.d.ts.map +0 -1
- package/dist/request/index.js +0 -59
- package/dist/request/index.js.map +0 -1
- package/dist/request/interactionRequest.d.ts +0 -23
- package/dist/request/interactionRequest.d.ts.map +0 -1
- package/dist/request/interactionRequest.js +0 -46
- package/dist/request/interactionRequest.js.map +0 -1
- package/dist/request/interactionUrl.d.ts +0 -42
- package/dist/request/interactionUrl.d.ts.map +0 -1
- package/dist/request/interactionUrl.js +0 -104
- package/dist/request/interactionUrl.js.map +0 -1
- package/dist/request/matching.d.ts +0 -95
- package/dist/request/matching.d.ts.map +0 -1
- package/dist/request/matching.js +0 -205
- package/dist/request/matching.js.map +0 -1
- package/dist/request/onboarding.d.ts +0 -94
- package/dist/request/onboarding.d.ts.map +0 -1
- package/dist/request/onboarding.js +0 -167
- package/dist/request/onboarding.js.map +0 -1
- package/dist/request/parse.d.ts +0 -63
- package/dist/request/parse.d.ts.map +0 -1
- package/dist/request/parse.js +0 -153
- package/dist/request/parse.js.map +0 -1
- package/dist/request/presentationSuite.d.ts +0 -71
- package/dist/request/presentationSuite.d.ts.map +0 -1
- package/dist/request/presentationSuite.js +0 -143
- package/dist/request/presentationSuite.js.map +0 -1
- package/dist/request/processRequest.d.ts +0 -45
- package/dist/request/processRequest.d.ts.map +0 -1
- package/dist/request/processRequest.js +0 -147
- package/dist/request/processRequest.js.map +0 -1
- package/dist/request/queryPredicates.d.ts +0 -98
- package/dist/request/queryPredicates.d.ts.map +0 -1
- package/dist/request/queryPredicates.js +0 -107
- package/dist/request/queryPredicates.js.map +0 -1
- package/dist/request/types.d.ts +0 -257
- package/dist/request/types.d.ts.map +0 -1
- package/dist/request/types.js +0 -2
- package/dist/request/types.js.map +0 -1
- package/dist/request/walletInput.d.ts +0 -93
- package/dist/request/walletInput.d.ts.map +0 -1
- package/dist/request/walletInput.js +0 -179
- package/dist/request/walletInput.js.map +0 -1
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import type { CHAPIProtocols, FetchLike, IVerifiablePresentation, IVPRDetails, IZcap, VCAPIExchangeResponse } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* The exchange URL a CHAPI request defers to, if any. Present when the verifier
|
|
4
|
-
* or issuer chose an exchange-based protocol, in which case the request's VPR
|
|
5
|
-
* (or store) body is empty and everything of substance lives behind this URL.
|
|
6
|
-
*
|
|
7
|
-
* Two protocol handles carry such a URL: the classic `vcapi` key, and the
|
|
8
|
-
* `interact` key of the newer `chapi.interact()` API (a "meta" protocol whose
|
|
9
|
-
* URL is opaque -- the underlying exchange is negotiated behind it, exactly as
|
|
10
|
-
* with `vcapi`). Both are plain HTTP exchange endpoints the wallet POSTs to, so
|
|
11
|
-
* they are handled identically here; `interact` is preferred when a request
|
|
12
|
-
* carries both.
|
|
13
|
-
*
|
|
14
|
-
* @param options {object}
|
|
15
|
-
* @param [options.protocols] {CHAPIProtocols}
|
|
16
|
-
* @returns {string | undefined}
|
|
17
|
-
*/
|
|
18
|
-
export declare function vcApiExchangeUrl({ protocols }: {
|
|
19
|
-
protocols?: CHAPIProtocols;
|
|
20
|
-
}): string | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Opens the exchange and retrieves the Verifiable Presentation Request the
|
|
23
|
-
* verifier is actually asking for. The wallet begins an exchange by POSTing an
|
|
24
|
-
* empty body; the reply carries the VPR.
|
|
25
|
-
*
|
|
26
|
-
* @param options {object}
|
|
27
|
-
* @param options.exchangeUrl {string}
|
|
28
|
-
* @param [options.fetch] {FetchLike}
|
|
29
|
-
* @returns {Promise<IVPRDetails>}
|
|
30
|
-
*/
|
|
31
|
-
export declare function startExchange({ exchangeUrl, fetch }: {
|
|
32
|
-
exchangeUrl: string;
|
|
33
|
-
fetch?: FetchLike;
|
|
34
|
-
}): Promise<IVPRDetails>;
|
|
35
|
-
/**
|
|
36
|
-
* Opens an exchange: the wallet's first message is always an empty JSON body,
|
|
37
|
-
* whether the exchange goes on to request a presentation (a verifier) or to
|
|
38
|
-
* offer one (an issuer).
|
|
39
|
-
*
|
|
40
|
-
* @param options {object}
|
|
41
|
-
* @param options.exchangeUrl {string}
|
|
42
|
-
* @param [options.fetch] {FetchLike}
|
|
43
|
-
* @returns {Promise<VCAPIExchangeResponse>}
|
|
44
|
-
*/
|
|
45
|
-
export declare function beginExchange({ exchangeUrl, fetch }: {
|
|
46
|
-
exchangeUrl: string;
|
|
47
|
-
fetch?: FetchLike;
|
|
48
|
-
}): Promise<VCAPIExchangeResponse>;
|
|
49
|
-
/**
|
|
50
|
-
* Delivers the wallet's composed presentation to a verifier's exchange and
|
|
51
|
-
* confirms the exchange finished. The exchange, not the CHAPI channel, is the
|
|
52
|
-
* verifier's system of record, so an unfinished (multi-step) reply is a failed
|
|
53
|
-
* delivery.
|
|
54
|
-
*
|
|
55
|
-
* @param options {object}
|
|
56
|
-
* @param options.request {IVPRDetails} - The VPR the exchange handed back.
|
|
57
|
-
* @param options.exchangeUrl {string}
|
|
58
|
-
* @param options.verifiablePresentation {IVerifiablePresentation}
|
|
59
|
-
* @param [options.fetch] {FetchLike}
|
|
60
|
-
* @returns {Promise<void>}
|
|
61
|
-
*/
|
|
62
|
-
export declare function deliverPresentation({ request, exchangeUrl, verifiablePresentation, fetch }: {
|
|
63
|
-
request: IVPRDetails;
|
|
64
|
-
exchangeUrl: string;
|
|
65
|
-
verifiablePresentation: IVerifiablePresentation;
|
|
66
|
-
fetch?: FetchLike;
|
|
67
|
-
}): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Answers an issuance exchange's holder-binding step: POSTs the wallet's
|
|
70
|
-
* DID-Auth presentation and collects the credentials the issuer hands back in
|
|
71
|
-
* return. A reply carrying yet another `verifiablePresentationRequest` means a
|
|
72
|
-
* further round this wallet does not answer.
|
|
73
|
-
*
|
|
74
|
-
* @param options {object}
|
|
75
|
-
* @param options.request {IVPRDetails} - The VPR the exchange opened with.
|
|
76
|
-
* @param options.exchangeUrl {string}
|
|
77
|
-
* @param options.verifiablePresentation {IVerifiablePresentation} - The signed
|
|
78
|
-
* DID-Auth presentation proving control of the holder DID.
|
|
79
|
-
* @param [options.fetch] {FetchLike}
|
|
80
|
-
* @returns {Promise<IVerifiablePresentation>} The offered presentation.
|
|
81
|
-
*/
|
|
82
|
-
export declare function collectIssuedPresentation({ request, exchangeUrl, verifiablePresentation, fetch }: {
|
|
83
|
-
request: IVPRDetails;
|
|
84
|
-
exchangeUrl: string;
|
|
85
|
-
verifiablePresentation: IVerifiablePresentation;
|
|
86
|
-
fetch?: FetchLike;
|
|
87
|
-
}): Promise<IVerifiablePresentation>;
|
|
88
|
-
/**
|
|
89
|
-
* Where to POST the composed presentation: the VPR's unmediated HTTP
|
|
90
|
-
* presentation service, when it names one, else the exchange URL itself (which
|
|
91
|
-
* every exchange accepts, and which is all vcplayground.org's VPR offers).
|
|
92
|
-
*
|
|
93
|
-
* @param options {object}
|
|
94
|
-
* @param options.request {IVPRDetails}
|
|
95
|
-
* @param options.exchangeUrl {string}
|
|
96
|
-
* @returns {string}
|
|
97
|
-
*/
|
|
98
|
-
export declare function presentationEndpointFor({ request, exchangeUrl }: {
|
|
99
|
-
request: IVPRDetails;
|
|
100
|
-
exchangeUrl: string;
|
|
101
|
-
}): string;
|
|
102
|
-
/**
|
|
103
|
-
* Delivers the wallet's composed presentation to the exchange and returns the
|
|
104
|
-
* raw reply. The exchange is complete unless the reply carries a further
|
|
105
|
-
* `verifiablePresentationRequest`; the finalize helpers (`deliverPresentation`,
|
|
106
|
-
* `collectIssuedPresentation`) inspect the reply via `assertExchangeComplete`.
|
|
107
|
-
*
|
|
108
|
-
* @param options {object}
|
|
109
|
-
* @param options.request {IVPRDetails} - The VPR the exchange handed back.
|
|
110
|
-
* @param options.exchangeUrl {string}
|
|
111
|
-
* @param options.verifiablePresentation {IVerifiablePresentation}
|
|
112
|
-
* @param [options.fetch] {FetchLike}
|
|
113
|
-
* @returns {Promise<VCAPIExchangeResponse>}
|
|
114
|
-
*/
|
|
115
|
-
export declare function submitPresentation({ request, exchangeUrl, verifiablePresentation, fetch }: {
|
|
116
|
-
request: IVPRDetails;
|
|
117
|
-
exchangeUrl: string;
|
|
118
|
-
verifiablePresentation: IVerifiablePresentation;
|
|
119
|
-
fetch?: FetchLike;
|
|
120
|
-
}): Promise<VCAPIExchangeResponse>;
|
|
121
|
-
/**
|
|
122
|
-
* Sends the whole Wallet Response object -- a VP and/or delegated `zcap`s -- to
|
|
123
|
-
* an exchanger endpoint (DCW's response envelope, which threads the grants
|
|
124
|
-
* *beside* the VP rather than embedding them inside it). Returns the parsed JSON
|
|
125
|
-
* reply, or `null` for an empty body. Kept alongside `submitPresentation` (whose
|
|
126
|
-
* envelope carries only the VP) because the two apps POST different shapes.
|
|
127
|
-
*
|
|
128
|
-
* @param options {object}
|
|
129
|
-
* @param options.exchangeUrl {string}
|
|
130
|
-
* @param options.payload {{ verifiablePresentation?, zcap? }}
|
|
131
|
-
* @param [options.fetch] {FetchLike}
|
|
132
|
-
* @returns {Promise<unknown>}
|
|
133
|
-
*/
|
|
134
|
-
export declare function sendToExchanger({ exchangeUrl, payload, fetch }: {
|
|
135
|
-
exchangeUrl: string;
|
|
136
|
-
payload: {
|
|
137
|
-
verifiablePresentation?: IVerifiablePresentation;
|
|
138
|
-
zcap?: IZcap[];
|
|
139
|
-
};
|
|
140
|
-
fetch?: FetchLike;
|
|
141
|
-
}): Promise<unknown>;
|
|
142
|
-
//# sourceMappingURL=exchangeClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exchangeClient.d.ts","sourceRoot":"","sources":["../../src/request/exchangeClient.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,uBAAuB,EACvB,WAAW,EACX,KAAK,EACL,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAQnB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACV,EAAE;IACD,SAAS,CAAC,EAAE,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EACvC,OAAO,EACP,WAAW,EACX,sBAAsB,EACtB,KAAwB,EACzB,EAAE;IACD,OAAO,EAAE,WAAW,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,sBAAsB,EAAE,uBAAuB,CAAA;IAC/C,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAMjC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,OAAO,EACP,KAAwB,EACzB,EAAE;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE;QACP,sBAAsB,CAAC,EAAE,uBAAuB,CAAA;QAChD,IAAI,CAAC,EAAE,KAAK,EAAE,CAAA;KACf,CAAA;IACD,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,GAAG,OAAO,CAAC,OAAO,CAAC,CAQnB"}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* VC API exchange client. A verifier may hand the wallet a CHAPI request whose
|
|
6
|
-
* `VerifiablePresentation` body is empty and whose `protocols.vcapi` names an
|
|
7
|
-
* exchange URL instead: the real Verifiable Presentation Request lives on the
|
|
8
|
-
* verifier's exchange endpoint, and the wallet POSTs its response back there
|
|
9
|
-
* rather than (only) over the CHAPI channel. vcplayground.org's verifier does
|
|
10
|
-
* exactly this whenever it mints an exchange, which is always.
|
|
11
|
-
*
|
|
12
|
-
* Two calls make up the wallet's side of the exchange: `startExchange` (POST an
|
|
13
|
-
* empty body, receive the VPR) and `submitPresentation` (POST the composed VP
|
|
14
|
-
* to the VPR's presentation service endpoint, defaulting to the exchange URL).
|
|
15
|
-
* An issuance exchange runs the same two calls in the other direction.
|
|
16
|
-
*
|
|
17
|
-
* Ported from Freewallet's `src/lib/walletRequest/vcApiExchange.ts`, with the
|
|
18
|
-
* network transport injected ({@link FetchLike}, default `globalThis.fetch`) and
|
|
19
|
-
* DCW's `sendToExchanger` (the whole-`WalletResponse` POST, envelope carrying
|
|
20
|
-
* `zcap`) added alongside `submitPresentation` (VP-only body).
|
|
21
|
-
*
|
|
22
|
-
* @see https://w3c-ccg.github.io/vc-api/#exchange-examples
|
|
23
|
-
*/
|
|
24
|
-
import { EphemeralExchangeGoneError } from './ephemeralExchange.js';
|
|
25
|
-
/**
|
|
26
|
-
* The `interact.service` type naming an endpoint that accepts a Verifiable
|
|
27
|
-
* Presentation over plain HTTP POST, with no mediator in between.
|
|
28
|
-
*/
|
|
29
|
-
const PRESENTATION_SERVICE_TYPE = 'UnmediatedHttpPresentationService2021';
|
|
30
|
-
/**
|
|
31
|
-
* The exchange URL a CHAPI request defers to, if any. Present when the verifier
|
|
32
|
-
* or issuer chose an exchange-based protocol, in which case the request's VPR
|
|
33
|
-
* (or store) body is empty and everything of substance lives behind this URL.
|
|
34
|
-
*
|
|
35
|
-
* Two protocol handles carry such a URL: the classic `vcapi` key, and the
|
|
36
|
-
* `interact` key of the newer `chapi.interact()` API (a "meta" protocol whose
|
|
37
|
-
* URL is opaque -- the underlying exchange is negotiated behind it, exactly as
|
|
38
|
-
* with `vcapi`). Both are plain HTTP exchange endpoints the wallet POSTs to, so
|
|
39
|
-
* they are handled identically here; `interact` is preferred when a request
|
|
40
|
-
* carries both.
|
|
41
|
-
*
|
|
42
|
-
* @param options {object}
|
|
43
|
-
* @param [options.protocols] {CHAPIProtocols}
|
|
44
|
-
* @returns {string | undefined}
|
|
45
|
-
*/
|
|
46
|
-
export function vcApiExchangeUrl({ protocols }) {
|
|
47
|
-
const candidates = [protocols?.interact, protocols?.vcapi];
|
|
48
|
-
return candidates.find(url => typeof url === 'string' && url.length > 0);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* POSTs a JSON body to an exchange endpoint and parses the reply. A 2xx with an
|
|
52
|
-
* empty body is normal (a completed exchange), and yields `{}`. A `404` is
|
|
53
|
-
* reported as {@link EphemeralExchangeGoneError} (dispatch on `err.name`): the
|
|
54
|
-
* exchange expired or was never there.
|
|
55
|
-
*
|
|
56
|
-
* @param options {object}
|
|
57
|
-
* @param options.url {string}
|
|
58
|
-
* @param options.body {object}
|
|
59
|
-
* @param options.fetch {FetchLike}
|
|
60
|
-
* @returns {Promise<VCAPIExchangeResponse>}
|
|
61
|
-
*/
|
|
62
|
-
async function postToExchange({ url, body, fetch }) {
|
|
63
|
-
const response = await fetch(url, {
|
|
64
|
-
method: 'POST',
|
|
65
|
-
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
66
|
-
body: JSON.stringify(body)
|
|
67
|
-
});
|
|
68
|
-
if (response.status === 404) {
|
|
69
|
-
throw new EphemeralExchangeGoneError(`The exchange at ${url} is no longer available.`);
|
|
70
|
-
}
|
|
71
|
-
if (!response.ok) {
|
|
72
|
-
throw new Error(`The exchange at ${url} responded ${response.status} ` +
|
|
73
|
-
`${response.statusText}.`);
|
|
74
|
-
}
|
|
75
|
-
const text = await response.text();
|
|
76
|
-
if (!text) {
|
|
77
|
-
return {};
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
return JSON.parse(text);
|
|
81
|
-
}
|
|
82
|
-
catch (err) {
|
|
83
|
-
throw new Error(`The exchange at ${url} returned malformed JSON.`, {
|
|
84
|
-
cause: err
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Opens the exchange and retrieves the Verifiable Presentation Request the
|
|
90
|
-
* verifier is actually asking for. The wallet begins an exchange by POSTing an
|
|
91
|
-
* empty body; the reply carries the VPR.
|
|
92
|
-
*
|
|
93
|
-
* @param options {object}
|
|
94
|
-
* @param options.exchangeUrl {string}
|
|
95
|
-
* @param [options.fetch] {FetchLike}
|
|
96
|
-
* @returns {Promise<IVPRDetails>}
|
|
97
|
-
*/
|
|
98
|
-
export async function startExchange({ exchangeUrl, fetch = globalThis.fetch }) {
|
|
99
|
-
const { verifiablePresentationRequest } = await beginExchange({
|
|
100
|
-
exchangeUrl,
|
|
101
|
-
fetch
|
|
102
|
-
});
|
|
103
|
-
if (!verifiablePresentationRequest) {
|
|
104
|
-
throw new Error(`The exchange at ${exchangeUrl} did not return a ` +
|
|
105
|
-
'verifiablePresentationRequest.');
|
|
106
|
-
}
|
|
107
|
-
return verifiablePresentationRequest;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Opens an exchange: the wallet's first message is always an empty JSON body,
|
|
111
|
-
* whether the exchange goes on to request a presentation (a verifier) or to
|
|
112
|
-
* offer one (an issuer).
|
|
113
|
-
*
|
|
114
|
-
* @param options {object}
|
|
115
|
-
* @param options.exchangeUrl {string}
|
|
116
|
-
* @param [options.fetch] {FetchLike}
|
|
117
|
-
* @returns {Promise<VCAPIExchangeResponse>}
|
|
118
|
-
*/
|
|
119
|
-
export async function beginExchange({ exchangeUrl, fetch = globalThis.fetch }) {
|
|
120
|
-
return postToExchange({ url: exchangeUrl, body: {}, fetch });
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Reply inspection shared by both exchange directions. This wallet answers a
|
|
124
|
-
* single round, so a reply carrying a further `verifiablePresentationRequest` is
|
|
125
|
-
* a multi-step exchange it cannot continue: throw rather than pretend the
|
|
126
|
-
* exchange closed. A reply without one is a completed round and returns
|
|
127
|
-
* normally.
|
|
128
|
-
*/
|
|
129
|
-
function assertExchangeComplete({ reply, exchangeUrl }) {
|
|
130
|
-
if (reply.verifiablePresentationRequest) {
|
|
131
|
-
throw new Error(`The exchange at ${exchangeUrl} asked for a further presentation; ` +
|
|
132
|
-
'multi-step exchanges are not supported.');
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Delivers the wallet's composed presentation to a verifier's exchange and
|
|
137
|
-
* confirms the exchange finished. The exchange, not the CHAPI channel, is the
|
|
138
|
-
* verifier's system of record, so an unfinished (multi-step) reply is a failed
|
|
139
|
-
* delivery.
|
|
140
|
-
*
|
|
141
|
-
* @param options {object}
|
|
142
|
-
* @param options.request {IVPRDetails} - The VPR the exchange handed back.
|
|
143
|
-
* @param options.exchangeUrl {string}
|
|
144
|
-
* @param options.verifiablePresentation {IVerifiablePresentation}
|
|
145
|
-
* @param [options.fetch] {FetchLike}
|
|
146
|
-
* @returns {Promise<void>}
|
|
147
|
-
*/
|
|
148
|
-
export async function deliverPresentation({ request, exchangeUrl, verifiablePresentation, fetch = globalThis.fetch }) {
|
|
149
|
-
const reply = await submitPresentation({
|
|
150
|
-
request,
|
|
151
|
-
exchangeUrl,
|
|
152
|
-
verifiablePresentation,
|
|
153
|
-
fetch
|
|
154
|
-
});
|
|
155
|
-
assertExchangeComplete({ reply, exchangeUrl });
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Answers an issuance exchange's holder-binding step: POSTs the wallet's
|
|
159
|
-
* DID-Auth presentation and collects the credentials the issuer hands back in
|
|
160
|
-
* return. A reply carrying yet another `verifiablePresentationRequest` means a
|
|
161
|
-
* further round this wallet does not answer.
|
|
162
|
-
*
|
|
163
|
-
* @param options {object}
|
|
164
|
-
* @param options.request {IVPRDetails} - The VPR the exchange opened with.
|
|
165
|
-
* @param options.exchangeUrl {string}
|
|
166
|
-
* @param options.verifiablePresentation {IVerifiablePresentation} - The signed
|
|
167
|
-
* DID-Auth presentation proving control of the holder DID.
|
|
168
|
-
* @param [options.fetch] {FetchLike}
|
|
169
|
-
* @returns {Promise<IVerifiablePresentation>} The offered presentation.
|
|
170
|
-
*/
|
|
171
|
-
export async function collectIssuedPresentation({ request, exchangeUrl, verifiablePresentation, fetch = globalThis.fetch }) {
|
|
172
|
-
const reply = await submitPresentation({
|
|
173
|
-
request,
|
|
174
|
-
exchangeUrl,
|
|
175
|
-
verifiablePresentation,
|
|
176
|
-
fetch
|
|
177
|
-
});
|
|
178
|
-
if (reply.verifiablePresentation) {
|
|
179
|
-
return reply.verifiablePresentation;
|
|
180
|
-
}
|
|
181
|
-
assertExchangeComplete({ reply, exchangeUrl });
|
|
182
|
-
throw new Error(`The exchange at ${exchangeUrl} offered no verifiablePresentation.`);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Where to POST the composed presentation: the VPR's unmediated HTTP
|
|
186
|
-
* presentation service, when it names one, else the exchange URL itself (which
|
|
187
|
-
* every exchange accepts, and which is all vcplayground.org's VPR offers).
|
|
188
|
-
*
|
|
189
|
-
* @param options {object}
|
|
190
|
-
* @param options.request {IVPRDetails}
|
|
191
|
-
* @param options.exchangeUrl {string}
|
|
192
|
-
* @returns {string}
|
|
193
|
-
*/
|
|
194
|
-
export function presentationEndpointFor({ request, exchangeUrl }) {
|
|
195
|
-
const services = request.interact?.service ?? [];
|
|
196
|
-
const unmediated = services.find(({ type, serviceEndpoint }) => type === PRESENTATION_SERVICE_TYPE && !!serviceEndpoint);
|
|
197
|
-
return unmediated?.serviceEndpoint ?? exchangeUrl;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Delivers the wallet's composed presentation to the exchange and returns the
|
|
201
|
-
* raw reply. The exchange is complete unless the reply carries a further
|
|
202
|
-
* `verifiablePresentationRequest`; the finalize helpers (`deliverPresentation`,
|
|
203
|
-
* `collectIssuedPresentation`) inspect the reply via `assertExchangeComplete`.
|
|
204
|
-
*
|
|
205
|
-
* @param options {object}
|
|
206
|
-
* @param options.request {IVPRDetails} - The VPR the exchange handed back.
|
|
207
|
-
* @param options.exchangeUrl {string}
|
|
208
|
-
* @param options.verifiablePresentation {IVerifiablePresentation}
|
|
209
|
-
* @param [options.fetch] {FetchLike}
|
|
210
|
-
* @returns {Promise<VCAPIExchangeResponse>}
|
|
211
|
-
*/
|
|
212
|
-
export async function submitPresentation({ request, exchangeUrl, verifiablePresentation, fetch = globalThis.fetch }) {
|
|
213
|
-
return postToExchange({
|
|
214
|
-
url: presentationEndpointFor({ request, exchangeUrl }),
|
|
215
|
-
body: { verifiablePresentation },
|
|
216
|
-
fetch
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Sends the whole Wallet Response object -- a VP and/or delegated `zcap`s -- to
|
|
221
|
-
* an exchanger endpoint (DCW's response envelope, which threads the grants
|
|
222
|
-
* *beside* the VP rather than embedding them inside it). Returns the parsed JSON
|
|
223
|
-
* reply, or `null` for an empty body. Kept alongside `submitPresentation` (whose
|
|
224
|
-
* envelope carries only the VP) because the two apps POST different shapes.
|
|
225
|
-
*
|
|
226
|
-
* @param options {object}
|
|
227
|
-
* @param options.exchangeUrl {string}
|
|
228
|
-
* @param options.payload {{ verifiablePresentation?, zcap? }}
|
|
229
|
-
* @param [options.fetch] {FetchLike}
|
|
230
|
-
* @returns {Promise<unknown>}
|
|
231
|
-
*/
|
|
232
|
-
export async function sendToExchanger({ exchangeUrl, payload, fetch = globalThis.fetch }) {
|
|
233
|
-
const response = await fetch(exchangeUrl, {
|
|
234
|
-
method: 'POST',
|
|
235
|
-
headers: { 'Content-Type': 'application/json' },
|
|
236
|
-
body: JSON.stringify(payload)
|
|
237
|
-
});
|
|
238
|
-
const text = await response.text();
|
|
239
|
-
return text ? JSON.parse(text) : null;
|
|
240
|
-
}
|
|
241
|
-
//# sourceMappingURL=exchangeClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exchangeClient.js","sourceRoot":"","sources":["../../src/request/exchangeClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAUnE;;;GAGG;AACH,MAAM,yBAAyB,GAAG,uCAAuC,CAAA;AAEzE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,SAAS,EAGV;IACC,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;IAC1D,OAAO,UAAU,CAAC,IAAI,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kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IAClC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACvC,CAAC"}
|
package/dist/request/index.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The `@interop/wallet-core/request` subpath: wallet-request / exchange-protocol
|
|
6
|
-
* handling shared by the Interop wallet apps (DCW and Freewallet).
|
|
7
|
-
*
|
|
8
|
-
* - `types` re-exports the VPR message vocabulary from
|
|
9
|
-
* `@interop/data-integrity-core` and declares the request-local types (CHAPI
|
|
10
|
-
* events, the classified-request profile, and the `PresentationSigner` /
|
|
11
|
-
* `FetchLike` / `RequestProcessors` injection seams).
|
|
12
|
-
* - `parse` / `classify` turn a raw URL, JSON string, or CHAPI event into a
|
|
13
|
-
* typed message and dispatch on what it asks for.
|
|
14
|
-
* - `matching` filters stored credentials against a QueryByExample (both the
|
|
15
|
-
* deep matcher and the type/issuer matcher).
|
|
16
|
-
* - `onboarding` is the `WalletOnboardingQuery` transport vocabulary: the
|
|
17
|
-
* inviter's compose helper and the enrollee's classification, over a query
|
|
18
|
-
* carrying the account pointer (did:webvh id, `spaceId`, `host`) and the
|
|
19
|
-
* account controller did:key (the response envelope itself lives in
|
|
20
|
-
* `@interop/wallet-core/enrollment`, beside the connect code it carries).
|
|
21
|
-
* - `appKey` is the App Connect app-key credential module: the wire constants,
|
|
22
|
-
* the matching / minting / legacy re-issue paths, and the store-time
|
|
23
|
-
* refusal policy.
|
|
24
|
-
* - `presentationSuite` negotiates the response cryptosuite; `composeVp` builds
|
|
25
|
-
* the (optionally signed, optionally grant-embedding) response VP.
|
|
26
|
-
* - `exchangeClient` is the fetch-injectable VC-API exchange client;
|
|
27
|
-
* `interactionUrl` resolves VCALM `interaction:` URLs; `interactionRequest`
|
|
28
|
-
* composes the two into `openInteractionRequest`, the answering wallet's
|
|
29
|
-
* one-call entry point for an interaction URL.
|
|
30
|
-
* - `ephemeralExchange` is the requester's side of a WAS server's ephemeral
|
|
31
|
-
* exchange: create one carrying a VPR, poll it (with an optional deadline)
|
|
32
|
-
* until the wallet answers. `capabilityRequest` composes the zcap-only VPR
|
|
33
|
-
* a requester stores on it.
|
|
34
|
-
* - `processRequest` is the pure request-to-response pipeline, with the
|
|
35
|
-
* app-side side effects injected.
|
|
36
|
-
* - `classifyWalletInput` / `handleWalletInput` are the ordered
|
|
37
|
-
* discrimination every "scan or paste something" entry point runs, with the
|
|
38
|
-
* per-grammar handlers injected.
|
|
39
|
-
*
|
|
40
|
-
* The signing / document-loader dependency graph lives entirely behind this
|
|
41
|
-
* subpath; `@interop/wallet-core`'s plaintext consumers never pull it in.
|
|
42
|
-
*/
|
|
43
|
-
export * from './types.js';
|
|
44
|
-
export * from './parse.js';
|
|
45
|
-
export * from './queryPredicates.js';
|
|
46
|
-
export * from './classify.js';
|
|
47
|
-
export * from './onboarding.js';
|
|
48
|
-
export * from './matching.js';
|
|
49
|
-
export * from './appKey.js';
|
|
50
|
-
export * from './presentationSuite.js';
|
|
51
|
-
export * from './composeVp.js';
|
|
52
|
-
export * from './exchangeClient.js';
|
|
53
|
-
export * from './interactionUrl.js';
|
|
54
|
-
export * from './interactionRequest.js';
|
|
55
|
-
export * from './ephemeralExchange.js';
|
|
56
|
-
export * from './capabilityRequest.js';
|
|
57
|
-
export * from './processRequest.js';
|
|
58
|
-
export * from './walletInput.js';
|
|
59
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
package/dist/request/index.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The `@interop/wallet-core/request` subpath: wallet-request / exchange-protocol
|
|
6
|
-
* handling shared by the Interop wallet apps (DCW and Freewallet).
|
|
7
|
-
*
|
|
8
|
-
* - `types` re-exports the VPR message vocabulary from
|
|
9
|
-
* `@interop/data-integrity-core` and declares the request-local types (CHAPI
|
|
10
|
-
* events, the classified-request profile, and the `PresentationSigner` /
|
|
11
|
-
* `FetchLike` / `RequestProcessors` injection seams).
|
|
12
|
-
* - `parse` / `classify` turn a raw URL, JSON string, or CHAPI event into a
|
|
13
|
-
* typed message and dispatch on what it asks for.
|
|
14
|
-
* - `matching` filters stored credentials against a QueryByExample (both the
|
|
15
|
-
* deep matcher and the type/issuer matcher).
|
|
16
|
-
* - `onboarding` is the `WalletOnboardingQuery` transport vocabulary: the
|
|
17
|
-
* inviter's compose helper and the enrollee's classification, over a query
|
|
18
|
-
* carrying the account pointer (did:webvh id, `spaceId`, `host`) and the
|
|
19
|
-
* account controller did:key (the response envelope itself lives in
|
|
20
|
-
* `@interop/wallet-core/enrollment`, beside the connect code it carries).
|
|
21
|
-
* - `appKey` is the App Connect app-key credential module: the wire constants,
|
|
22
|
-
* the matching / minting / legacy re-issue paths, and the store-time
|
|
23
|
-
* refusal policy.
|
|
24
|
-
* - `presentationSuite` negotiates the response cryptosuite; `composeVp` builds
|
|
25
|
-
* the (optionally signed, optionally grant-embedding) response VP.
|
|
26
|
-
* - `exchangeClient` is the fetch-injectable VC-API exchange client;
|
|
27
|
-
* `interactionUrl` resolves VCALM `interaction:` URLs; `interactionRequest`
|
|
28
|
-
* composes the two into `openInteractionRequest`, the answering wallet's
|
|
29
|
-
* one-call entry point for an interaction URL.
|
|
30
|
-
* - `ephemeralExchange` is the requester's side of a WAS server's ephemeral
|
|
31
|
-
* exchange: create one carrying a VPR, poll it (with an optional deadline)
|
|
32
|
-
* until the wallet answers. `capabilityRequest` composes the zcap-only VPR
|
|
33
|
-
* a requester stores on it.
|
|
34
|
-
* - `processRequest` is the pure request-to-response pipeline, with the
|
|
35
|
-
* app-side side effects injected.
|
|
36
|
-
* - `classifyWalletInput` / `handleWalletInput` are the ordered
|
|
37
|
-
* discrimination every "scan or paste something" entry point runs, with the
|
|
38
|
-
* per-grammar handlers injected.
|
|
39
|
-
*
|
|
40
|
-
* The signing / document-loader dependency graph lives entirely behind this
|
|
41
|
-
* subpath; `@interop/wallet-core`'s plaintext consumers never pull it in.
|
|
42
|
-
*/
|
|
43
|
-
export * from './types.js';
|
|
44
|
-
export * from './parse.js';
|
|
45
|
-
export * from './queryPredicates.js';
|
|
46
|
-
export * from './classify.js';
|
|
47
|
-
export * from './onboarding.js';
|
|
48
|
-
export * from './matching.js';
|
|
49
|
-
export * from './appKey.js';
|
|
50
|
-
export * from './presentationSuite.js';
|
|
51
|
-
export * from './composeVp.js';
|
|
52
|
-
export * from './exchangeClient.js';
|
|
53
|
-
export * from './interactionUrl.js';
|
|
54
|
-
export * from './interactionRequest.js';
|
|
55
|
-
export * from './ephemeralExchange.js';
|
|
56
|
-
export * from './capabilityRequest.js';
|
|
57
|
-
export * from './processRequest.js';
|
|
58
|
-
export * from './walletInput.js';
|
|
59
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { FetchLike, IVPRDetails } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves an interaction URL to the Verifiable Presentation Request it names.
|
|
4
|
-
* Throws a plain `Error` when the text is not an interaction URL, or when the
|
|
5
|
-
* resolved protocols map names no usable exchange (`interact` or `vcapi`); a
|
|
6
|
-
* `404` on either the protocols fetch or the exchange's begin POST surfaces as
|
|
7
|
-
* {@link EphemeralExchangeGoneError} (dispatch on `err.name`), since either
|
|
8
|
-
* one means the exchange expired or the link is wrong.
|
|
9
|
-
*
|
|
10
|
-
* @param options {object}
|
|
11
|
-
* @param options.url {string}
|
|
12
|
-
* @param [options.fetch] {FetchLike}
|
|
13
|
-
* @returns {Promise<{ interactionUrl: string, exchangeUrl: string, request: IVPRDetails }>}
|
|
14
|
-
*/
|
|
15
|
-
export declare function openInteractionRequest({ url, fetch }: {
|
|
16
|
-
url: string;
|
|
17
|
-
fetch?: FetchLike;
|
|
18
|
-
}): Promise<{
|
|
19
|
-
interactionUrl: string;
|
|
20
|
-
exchangeUrl: string;
|
|
21
|
-
request: IVPRDetails;
|
|
22
|
-
}>;
|
|
23
|
-
//# sourceMappingURL=interactionRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interactionRequest.d.ts","sourceRoot":"","sources":["../../src/request/interactionRequest.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExD;;;;;;;;;;;;GAYG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,GAAG,EACH,KAAwB,EACzB,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,GAAG,OAAO,CAAC;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,WAAW,CAAA;CACrB,CAAC,CAeD"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Opens a VCALM interaction URL end to end: resolves its protocols map, begins
|
|
6
|
-
* the exchange it names, and hands back the Verifiable Presentation Request the
|
|
7
|
-
* exchange is actually asking for. This is the answering wallet's counterpart
|
|
8
|
-
* of `createEphemeralExchange` (`ephemeralExchange.ts`): a requester stores a
|
|
9
|
-
* VPR on an ephemeral exchange and prints the interaction URL; this opens it.
|
|
10
|
-
*
|
|
11
|
-
* Classification is deliberately not done here. The caller runs its own
|
|
12
|
-
* `classifyRequest` over the returned `request` -- freewallet's App
|
|
13
|
-
* Connect-aware classifier must refuse an `AppConnectQuery` that arrives with
|
|
14
|
-
* no attested origin, and the shared classifier here would silently filter it
|
|
15
|
-
* out instead.
|
|
16
|
-
*/
|
|
17
|
-
import { fetchInteractionProtocols, isInteractionUrl, parseInteractionUrl } from './interactionUrl.js';
|
|
18
|
-
import { startExchange, vcApiExchangeUrl } from './exchangeClient.js';
|
|
19
|
-
/**
|
|
20
|
-
* Resolves an interaction URL to the Verifiable Presentation Request it names.
|
|
21
|
-
* Throws a plain `Error` when the text is not an interaction URL, or when the
|
|
22
|
-
* resolved protocols map names no usable exchange (`interact` or `vcapi`); a
|
|
23
|
-
* `404` on either the protocols fetch or the exchange's begin POST surfaces as
|
|
24
|
-
* {@link EphemeralExchangeGoneError} (dispatch on `err.name`), since either
|
|
25
|
-
* one means the exchange expired or the link is wrong.
|
|
26
|
-
*
|
|
27
|
-
* @param options {object}
|
|
28
|
-
* @param options.url {string}
|
|
29
|
-
* @param [options.fetch] {FetchLike}
|
|
30
|
-
* @returns {Promise<{ interactionUrl: string, exchangeUrl: string, request: IVPRDetails }>}
|
|
31
|
-
*/
|
|
32
|
-
export async function openInteractionRequest({ url, fetch = globalThis.fetch }) {
|
|
33
|
-
if (!isInteractionUrl(url)) {
|
|
34
|
-
throw new Error(`Not an interaction URL: ${url}`);
|
|
35
|
-
}
|
|
36
|
-
const interactionUrl = parseInteractionUrl(url);
|
|
37
|
-
const protocols = await fetchInteractionProtocols(interactionUrl, { fetch });
|
|
38
|
-
const exchangeUrl = vcApiExchangeUrl({ protocols });
|
|
39
|
-
if (!exchangeUrl) {
|
|
40
|
-
throw new Error(`The interaction URL's protocols map names no usable exchange ` +
|
|
41
|
-
`("interact" or "vcapi"): ${interactionUrl}`);
|
|
42
|
-
}
|
|
43
|
-
const request = await startExchange({ exchangeUrl, fetch });
|
|
44
|
-
return { interactionUrl, exchangeUrl, request };
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=interactionRequest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interactionRequest.js","sourceRoot":"","sources":["../../src/request/interactionRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAGrE;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,EAC3C,GAAG,EACH,KAAK,GAAG,UAAU,CAAC,KAAK,EAIzB;IAKC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAA;IACnD,CAAC;IACD,MAAM,cAAc,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAA;IAC/C,MAAM,SAAS,GAAG,MAAM,yBAAyB,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IAC5E,MAAM,WAAW,GAAG,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;IACnD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,+DAA+D;YAC7D,4BAA4B,cAAc,EAAE,CAC/C,CAAA;IACH,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAA;IAC3D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,CAAA;AACjD,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { FetchLike } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Detects whether a URL is a VCALM interaction URL.
|
|
4
|
-
*
|
|
5
|
-
* Two formats:
|
|
6
|
-
* - `interaction:` scheme: `interaction:https://example.com/path?iuv=1`
|
|
7
|
-
* - HTTPS URL with an `iuv` query param: `https://example.com/path?iuv=1`
|
|
8
|
-
*
|
|
9
|
-
* @param url {string}
|
|
10
|
-
* @returns {boolean}
|
|
11
|
-
*/
|
|
12
|
-
export declare function isInteractionUrl(url: string): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Normalizes any interaction URL to the inner HTTPS interaction URL. Accepts any
|
|
15
|
-
* URL that passed {@link isInteractionUrl}.
|
|
16
|
-
*
|
|
17
|
-
* - `interaction:https://...?iuv=1` strips the prefix
|
|
18
|
-
* - `interaction:https%3A%2F%2F...` strips the prefix and decodes (URL-encoded
|
|
19
|
-
* after `interaction:` is non-standard, but handled for robustness)
|
|
20
|
-
* - `https://...?iuv=1` is returned as-is
|
|
21
|
-
*
|
|
22
|
-
* @param url {string}
|
|
23
|
-
* @returns {string}
|
|
24
|
-
*/
|
|
25
|
-
export declare function parseInteractionUrl(url: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Fetches the interaction protocols response from a VCALM interaction URL. Sends
|
|
28
|
-
* GET with `Accept: application/json` per the VCALM spec, and returns the
|
|
29
|
-
* protocols map. Logs a warning if the `iuv` param value is not `1`; throws if
|
|
30
|
-
* the response is not ok or the `protocols` key is missing. A `404` is reported
|
|
31
|
-
* as {@link EphemeralExchangeGoneError} (dispatch on `err.name`): the
|
|
32
|
-
* interaction URL points at an exchange that expired or was never there.
|
|
33
|
-
*
|
|
34
|
-
* @param interactionUrl {string}
|
|
35
|
-
* @param [options] {object}
|
|
36
|
-
* @param [options.fetch] {FetchLike}
|
|
37
|
-
* @returns {Promise<Record<string, string>>}
|
|
38
|
-
*/
|
|
39
|
-
export declare function fetchInteractionProtocols(interactionUrl: string, { fetch }?: {
|
|
40
|
-
fetch?: FetchLike;
|
|
41
|
-
}): Promise<Record<string, string>>;
|
|
42
|
-
//# sourceMappingURL=interactionUrl.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interactionUrl.d.ts","sourceRoot":"","sources":["../../src/request/interactionUrl.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAI3C;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAUrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAWvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,yBAAyB,CAC7C,cAAc,EAAE,MAAM,EACtB,EAAE,KAAwB,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAO,GACvD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAmCjC"}
|