@pagopa/io-react-native-wallet 0.28.2 → 0.30.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 +43 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +5 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +12 -0
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +5 -0
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +13 -2
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +10 -0
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/presentation/01-start-flow.js +9 -8
- package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/commonjs/credential/presentation/03-get-request-object.js +3 -2
- package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/05-verify-request-object.js +57 -22
- package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +43 -16
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +16 -4
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js +85 -3
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/README.md +27 -9
- package/lib/commonjs/credential/presentation/errors.js +28 -23
- package/lib/commonjs/credential/presentation/errors.js.map +1 -1
- package/lib/commonjs/credential/presentation/index.js +6 -0
- package/lib/commonjs/credential/presentation/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +14 -7
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/credential/status/02-status-attestation.js +2 -0
- package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -1
- package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +3 -0
- package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -1
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +5 -0
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -1
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/decoder.js +2 -0
- package/lib/commonjs/utils/decoder.js.map +1 -1
- package/lib/commonjs/utils/error-codes.js +9 -1
- package/lib/commonjs/utils/error-codes.js.map +1 -1
- package/lib/commonjs/utils/errors.js +31 -14
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/commonjs/utils/logging.js +68 -0
- package/lib/commonjs/utils/logging.js.map +1 -0
- package/lib/commonjs/utils/misc.js +2 -0
- package/lib/commonjs/utils/misc.js.map +1 -1
- package/lib/commonjs/utils/par.js +2 -0
- package/lib/commonjs/utils/par.js.map +1 -1
- package/lib/commonjs/wallet-instance/index.js +4 -0
- package/lib/commonjs/wallet-instance/index.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/issuing.js +5 -0
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/credential/issuance/03-start-user-authorization.js +5 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +12 -0
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +5 -0
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +13 -2
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +10 -0
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/presentation/01-start-flow.js +9 -8
- package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/module/credential/presentation/03-get-request-object.js +3 -2
- package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/module/credential/presentation/05-verify-request-object.js +58 -23
- package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js +44 -17
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +17 -5
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js +82 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/README.md +27 -9
- package/lib/module/credential/presentation/errors.js +17 -19
- package/lib/module/credential/presentation/errors.js.map +1 -1
- package/lib/module/credential/presentation/index.js +2 -2
- package/lib/module/credential/presentation/index.js.map +1 -1
- package/lib/module/credential/presentation/types.js +12 -6
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/credential/status/02-status-attestation.js +2 -0
- package/lib/module/credential/status/02-status-attestation.js.map +1 -1
- package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +3 -0
- package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -1
- package/lib/module/credential/trustmark/get-credential-trustmark.js +5 -0
- package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/decoder.js +2 -0
- package/lib/module/utils/decoder.js.map +1 -1
- package/lib/module/utils/error-codes.js +7 -0
- package/lib/module/utils/error-codes.js.map +1 -1
- package/lib/module/utils/errors.js +23 -14
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/module/utils/logging.js +62 -0
- package/lib/module/utils/logging.js.map +1 -0
- package/lib/module/utils/misc.js +2 -0
- package/lib/module/utils/misc.js.map +1 -1
- package/lib/module/utils/par.js +2 -0
- package/lib/module/utils/par.js.map +1 -1
- package/lib/module/wallet-instance/index.js +4 -0
- package/lib/module/wallet-instance/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/issuing.js +5 -0
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/01-start-flow.d.ts +17 -14
- package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts +1 -3
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +2 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +30 -2
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/errors.d.ts +17 -12
- package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/index.d.ts +3 -3
- package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +24 -17
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -1
- package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -1
- package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/decoder.d.ts.map +1 -1
- package/lib/typescript/utils/error-codes.d.ts +8 -0
- package/lib/typescript/utils/error-codes.d.ts.map +1 -1
- package/lib/typescript/utils/errors.d.ts +32 -18
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/logging.d.ts +35 -0
- package/lib/typescript/utils/logging.d.ts.map +1 -0
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/utils/par.d.ts.map +1 -1
- package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/credential/issuance/03-start-user-authorization.ts +18 -0
- package/src/credential/issuance/04-complete-user-authorization.ts +51 -0
- package/src/credential/issuance/05-authorize-access.ts +16 -0
- package/src/credential/issuance/06-obtain-credential.ts +31 -2
- package/src/credential/issuance/07-verify-and-parse-credential.ts +27 -1
- package/src/credential/presentation/01-start-flow.ts +12 -11
- package/src/credential/presentation/03-get-request-object.ts +5 -5
- package/src/credential/presentation/05-verify-request-object.ts +73 -15
- package/src/credential/presentation/07-evaluate-dcql-query.ts +43 -18
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +25 -13
- package/src/credential/presentation/08-send-authorization-response.ts +110 -3
- package/src/credential/presentation/README.md +27 -9
- package/src/credential/presentation/errors.ts +24 -17
- package/src/credential/presentation/index.ts +4 -0
- package/src/credential/presentation/types.ts +22 -10
- package/src/credential/status/02-status-attestation.ts +3 -0
- package/src/credential/status/03-verify-and-parse-status-attestation.ts +10 -0
- package/src/credential/trustmark/get-credential-trustmark.ts +19 -0
- package/src/index.ts +2 -0
- package/src/utils/decoder.ts +5 -0
- package/src/utils/error-codes.ts +11 -0
- package/src/utils/errors.ts +59 -29
- package/src/utils/logging.ts +68 -0
- package/src/utils/misc.ts +5 -0
- package/src/utils/par.ts +6 -0
- package/src/wallet-instance/index.ts +17 -1
- package/src/wallet-instance-attestation/issuing.ts +19 -0
@@ -1,5 +1,5 @@
|
|
1
|
-
import { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes } from "./error-codes";
|
2
|
-
export { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes };
|
1
|
+
import { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes, RelyingPartyResponseErrorCodes } from "./error-codes";
|
2
|
+
export { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes, RelyingPartyResponseErrorCodes };
|
3
3
|
|
4
4
|
// An error reason that supports both a string and a generic JSON object
|
5
5
|
|
@@ -94,8 +94,6 @@ export class UnexpectedStatusCodeError extends IoWalletError {
|
|
94
94
|
/**
|
95
95
|
* An error subclass thrown when an Issuer HTTP request fails.
|
96
96
|
* The specific error can be found in the `code` property.
|
97
|
-
*
|
98
|
-
* The class is generic over the error code to narrow down the reason.
|
99
97
|
*/
|
100
98
|
export class IssuerResponseError extends UnexpectedStatusCodeError {
|
101
99
|
constructor(params) {
|
@@ -115,6 +113,17 @@ export class WalletProviderResponseError extends UnexpectedStatusCodeError {
|
|
115
113
|
this.code = params.code ?? WalletProviderResponseErrorCodes.WalletProviderGenericError;
|
116
114
|
}
|
117
115
|
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* An error subclass thrown when a Relying Party HTTP request fails.
|
119
|
+
* The specific error can be found in the `code` property.
|
120
|
+
*/
|
121
|
+
export class RelyingPartyResponseError extends UnexpectedStatusCodeError {
|
122
|
+
constructor(params) {
|
123
|
+
super(params);
|
124
|
+
this.code = params.code ?? RelyingPartyResponseErrorCodes.RelyingPartyGenericError;
|
125
|
+
}
|
126
|
+
}
|
118
127
|
/**
|
119
128
|
* Function to extract the error message from the Entity Configuration's supported error codes.
|
120
129
|
* @param errorCode The error code to map to a meaningful message
|
@@ -152,18 +161,18 @@ export function extractErrorMessageFromIssuerConf(errorCode, _ref5) {
|
|
152
161
|
}
|
153
162
|
|
154
163
|
/**
|
155
|
-
*
|
156
|
-
*
|
157
|
-
* @param
|
164
|
+
* Factory function to create a type guard for specific error classes.
|
165
|
+
*
|
166
|
+
* @param errorClass The error class to create the type guard for
|
167
|
+
* @returns A type guard that checks if the error is an instance of the given class and has the expected code
|
158
168
|
*/
|
159
|
-
|
169
|
+
const makeErrorTypeGuard = ErrorClass => (error, code) => error instanceof ErrorClass && error.code === (code ?? error.code);
|
170
|
+
export const isIssuerResponseError = makeErrorTypeGuard(IssuerResponseError);
|
171
|
+
export const isWalletProviderResponseError = makeErrorTypeGuard(WalletProviderResponseError);
|
172
|
+
export const isRelyingPartyResponseError = makeErrorTypeGuard(RelyingPartyResponseError);
|
173
|
+
|
174
|
+
// Mapping type between error classes and their allowed codes
|
160
175
|
|
161
|
-
/**
|
162
|
-
* Type guard for wallet provider errors.
|
163
|
-
* @param error The error to check
|
164
|
-
* @param code Optional code to narrow down the wallet provider error
|
165
|
-
*/
|
166
|
-
export const isWalletProviderResponseError = (error, code) => error instanceof WalletProviderResponseError && error.code === (code ?? error.code);
|
167
176
|
/**
|
168
177
|
* Builder class used to create specialized errors from type {@link UnexpectedStatusCodeError} that handles multiple status codes.
|
169
178
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IssuerResponseErrorCodes","WalletProviderResponseErrorCodes","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerGenericError","WalletProviderResponseError","WalletProviderGenericError","extractErrorMessageFromIssuerConf","errorCode","_ref5","issuerConf","credentialType","credentialConfiguration","openid_credential_issuer","credential_configurations_supported","issuance_errors_supported","localesList","display","reduce","acc","_ref6","locale","rest","
|
1
|
+
{"version":3,"names":["IssuerResponseErrorCodes","WalletProviderResponseErrorCodes","RelyingPartyResponseErrorCodes","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerGenericError","WalletProviderResponseError","WalletProviderGenericError","RelyingPartyResponseError","RelyingPartyGenericError","extractErrorMessageFromIssuerConf","errorCode","_ref5","issuerConf","credentialType","credentialConfiguration","openid_credential_issuer","credential_configurations_supported","issuance_errors_supported","localesList","display","reduce","acc","_ref6","locale","rest","makeErrorTypeGuard","ErrorClass","error","isIssuerResponseError","isWalletProviderResponseError","isRelyingPartyResponseError","ResponseErrorBuilder","errorCases","handle","status","buildFrom","originalError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":"AAEA,SACEA,wBAAwB,EACxBC,gCAAgC,EAChCC,8BAA8B,QAIzB,eAAe;AAEtB,SACEF,wBAAwB,EACxBC,gCAAgC,EAChCC,8BAA8B;;AAGhC;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GACzBC,KAA8E,IAE9EC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,MAAM,CAACC,IAAA;EAAA,IAAC,GAAGC,CAAC,CAAC,GAAAD,IAAA;EAAA,OAAKC,CAAC,KAAKC,SAAS;AAAA,EAAC,CAClCC,GAAG,CAACC,KAAA,IAAY;EAAA,IAAX,CAACC,CAAC,EAAEJ,CAAC,CAAC,GAAAG,KAAA;EACV,IAAIE,KAAK,CAACC,OAAO,CAACN,CAAC,CAAC,EAAE,OAAO,CAACI,CAAC,EAAG,IAAGJ,CAAC,CAACO,IAAI,CAAC,IAAI,CAAE,GAAE,CAAC;EACrD,IAAI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,CAAC,IAAI,IAAI,CAAC+B,UAAU,CAAC,GAAG,CAAC;IAEnE,IAAI7B,MAAM,EAAE;MACV,OAAO,IAAI,IAAI,CAACuB,UAAU,CAAC;QAAE,GAAGU,aAAa;QAAE,GAAGjC;MAAO,CAAC,CAAC;IAC7D;IAEA,OAAOiC,aAAa;EACtB;AACF"}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
/**
|
2
|
+
* Logger interface which can be provided to the Logger class as a custom implementation.
|
3
|
+
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Supported debug levels.
|
7
|
+
*/
|
8
|
+
export let LogLevel = /*#__PURE__*/function (LogLevel) {
|
9
|
+
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
10
|
+
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
11
|
+
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
12
|
+
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
13
|
+
return LogLevel;
|
14
|
+
}({});
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Logger singleton class which provides a simple logging interface with an init function to set the logging context and
|
18
|
+
* a static log function to log messages based on the debug level.
|
19
|
+
* This can be used as follows:
|
20
|
+
* const logger = Logger.getInstance();
|
21
|
+
* logger.initLogging(yourLoggingContext);
|
22
|
+
* logger.log(LogLevel.DEBUG, "Debug message");
|
23
|
+
*/
|
24
|
+
export class Logger {
|
25
|
+
static instance = null;
|
26
|
+
// Private constructor to prevent direct instantiation
|
27
|
+
constructor() {}
|
28
|
+
|
29
|
+
// Public static method to get the Logger instance
|
30
|
+
static getInstance() {
|
31
|
+
if (Logger.instance === null) {
|
32
|
+
Logger.instance = new Logger();
|
33
|
+
}
|
34
|
+
return Logger.instance;
|
35
|
+
}
|
36
|
+
|
37
|
+
// Method to initialize the logging context
|
38
|
+
initLogging(loggingCtx) {
|
39
|
+
Logger.loggingContext = loggingCtx;
|
40
|
+
}
|
41
|
+
|
42
|
+
// Method to log based on the level which wraps the null check for the logging context
|
43
|
+
static log(level, msg) {
|
44
|
+
if (Logger.loggingContext) {
|
45
|
+
switch (level) {
|
46
|
+
case LogLevel.DEBUG:
|
47
|
+
Logger.loggingContext.logDebug(msg);
|
48
|
+
break;
|
49
|
+
case LogLevel.INFO:
|
50
|
+
Logger.loggingContext.logInfo(msg);
|
51
|
+
break;
|
52
|
+
case LogLevel.WARN:
|
53
|
+
Logger.loggingContext.logWarn(msg);
|
54
|
+
break;
|
55
|
+
case LogLevel.ERROR:
|
56
|
+
Logger.loggingContext.logError(msg);
|
57
|
+
break;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
//# sourceMappingURL=logging.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["LogLevel","Logger","instance","constructor","getInstance","initLogging","loggingCtx","loggingContext","log","level","msg","DEBUG","logDebug","INFO","logInfo","WARN","logWarn","ERROR","logError"],"sourceRoot":"../../../src","sources":["utils/logging.ts"],"mappings":"AAAA;AACA;AACA;;AAQA;AACA;AACA;AACA,WAAYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;;AAOpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,CAAC;EAClB,OAAeC,QAAQ,GAAkB,IAAI;EAG7C;EACQC,WAAWA,CAAA,EAAG,CAAC;;EAEvB;EACA,OAAcC,WAAWA,CAAA,EAAW;IAClC,IAAIH,MAAM,CAACC,QAAQ,KAAK,IAAI,EAAE;MAC5BD,MAAM,CAACC,QAAQ,GAAG,IAAID,MAAM,CAAC,CAAC;IAChC;IACA,OAAOA,MAAM,CAACC,QAAQ;EACxB;;EAEA;EACOG,WAAWA,CAACC,UAA0B,EAAQ;IACnDL,MAAM,CAACM,cAAc,GAAGD,UAAU;EACpC;;EAEA;EACA,OAAcE,GAAGA,CAACC,KAAe,EAAEC,GAAW,EAAQ;IACpD,IAAIT,MAAM,CAACM,cAAc,EAAE;MACzB,QAAQE,KAAK;QACX,KAAKT,QAAQ,CAACW,KAAK;UACjBV,MAAM,CAACM,cAAc,CAACK,QAAQ,CAACF,GAAG,CAAC;UACnC;QACF,KAAKV,QAAQ,CAACa,IAAI;UAChBZ,MAAM,CAACM,cAAc,CAACO,OAAO,CAACJ,GAAG,CAAC;UAClC;QACF,KAAKV,QAAQ,CAACe,IAAI;UAChBd,MAAM,CAACM,cAAc,CAACS,OAAO,CAACN,GAAG,CAAC;UAClC;QACF,KAAKV,QAAQ,CAACiB,KAAK;UACjBhB,MAAM,CAACM,cAAc,CAACW,QAAQ,CAACR,GAAG,CAAC;UACnC;MACJ;IACF;EACF;AACF"}
|
package/lib/module/utils/misc.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { IoWalletError, UnexpectedStatusCodeError } from "./errors";
|
2
2
|
import { sha256 } from "js-sha256";
|
3
|
+
import { LogLevel, Logger } from "./logging";
|
3
4
|
|
4
5
|
/**
|
5
6
|
* Check if a response is in the expected status, otherwise throw an error
|
@@ -11,6 +12,7 @@ import { sha256 } from "js-sha256";
|
|
11
12
|
export const hasStatusOrThrow = (status, customError) => async res => {
|
12
13
|
if (res.status !== status) {
|
13
14
|
const ErrorClass = customError ?? UnexpectedStatusCodeError;
|
15
|
+
Logger.log(LogLevel.ERROR, `Http request failed. Expected ${status}, got ${res.status}, url: ${res.url}`);
|
14
16
|
throw new ErrorClass({
|
15
17
|
message: `Http request failed. Expected ${status}, got ${res.status}, url: ${res.url}`,
|
16
18
|
statusCode: res.status,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IoWalletError","UnexpectedStatusCodeError","sha256","hasStatusOrThrow","status","customError","res","ErrorClass","
|
1
|
+
{"version":3,"names":["IoWalletError","UnexpectedStatusCodeError","sha256","LogLevel","Logger","hasStatusOrThrow","status","customError","res","ErrorClass","log","ERROR","url","message","statusCode","reason","parseRawHttpResponse","response","_response$headers$get","headers","get","includes","json","text","generateRandomAlphaNumericString","size","Array","from","Math","floor","random","toString","join","getCredentialHashWithouDiscloures","credential","tildeIndex","indexOf","slice","safeJsonParse","withDefault","JSON","parse","_"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,yBAAyB,QAAQ,UAAU;AACnE,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,QAAQ,EAAEC,MAAM,QAAQ,WAAW;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAC3BA,CAACC,MAAc,EAAEC,WAA8C,KAC/D,MAAOC,GAAa,IAAwB;EAC1C,IAAIA,GAAG,CAACF,MAAM,KAAKA,MAAM,EAAE;IACzB,MAAMG,UAAU,GAAGF,WAAW,IAAIN,yBAAyB;IAC3DG,MAAM,CAACM,GAAG,CACRP,QAAQ,CAACQ,KAAK,EACb,iCAAgCL,MAAO,SAAQE,GAAG,CAACF,MAAO,UAASE,GAAG,CAACI,GAAI,EAC9E,CAAC;IACD,MAAM,IAAIH,UAAU,CAAC;MACnBI,OAAO,EAAG,iCAAgCP,MAAO,SAAQE,GAAG,CAACF,MAAO,UAASE,GAAG,CAACI,GAAI,EAAC;MACtFE,UAAU,EAAEN,GAAG,CAACF,MAAM;MACtBS,MAAM,EAAE,MAAMC,oBAAoB,CAACR,GAAG,CAAC,CAAE;IAC3C,CAAC,CAAC;EACJ;;EACA,OAAOA,GAAG;AACZ,CAAC;;AAEH;AACA;AACA;AACA,OAAO,MAAMQ,oBAAoB,GAC/BC,QAAkB;EAAA,IAAAC,qBAAA;EAAA,OAElB,CAAAA,qBAAA,GAAAD,QAAQ,CAACE,OAAO,CAACC,GAAG,CAAC,cAAc,CAAC,cAAAF,qBAAA,eAApCA,qBAAA,CAAsCG,QAAQ,CAAC,kBAAkB,CAAC,GAC7DJ,QAAQ,CAACK,IAAI,CAAC,CAAC,GAChBL,QAAQ,CAACM,IAAI,CAAC,CAAC;AAAA;;AAErB;AACA;AAOA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gCAAgC,GAAIC,IAAY,IAC3DC,KAAK,CAACC,IAAI,CAACD,KAAK,CAACD,IAAI,CAAC,EAAE,MACtBG,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAACC,QAAQ,CAAC,EAAE,CAC5C,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;;AAEZ;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iCAAiC,GAAG,MAC/CC,UAAkB,IACE;EACpB,MAAMC,UAAU,GAAGD,UAAU,CAACE,OAAO,CAAC,GAAG,CAAC;EAC1C,IAAID,UAAU,KAAK,CAAC,CAAC,EAAE;IACrB,MAAM,IAAInC,aAAa,CAAC,2BAA2B,CAAC;EACtD;EACA,OAAOE,MAAM,CAACgC,UAAU,CAACG,KAAK,CAAC,CAAC,EAAEF,UAAU,CAAC,CAAC;AAChD,CAAC;AAED,OAAO,MAAMG,aAAa,GAAGA,CAAIf,IAAY,EAAEgB,WAAe,KAAe;EAC3E,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAAClB,IAAI,CAAC;EACzB,CAAC,CAAC,OAAOmB,CAAC,EAAE;IACV,OAAOH,WAAW,IAAI,IAAI;EAC5B;AACF,CAAC"}
|
package/lib/module/utils/par.js
CHANGED
@@ -5,6 +5,7 @@ import * as WalletInstanceAttestation from "../wallet-instance-attestation";
|
|
5
5
|
import { generateRandomAlphaNumericString, hasStatusOrThrow } from "./misc";
|
6
6
|
import { createPopToken } from "./pop";
|
7
7
|
import { IssuerResponseError } from "./errors";
|
8
|
+
import { LogLevel, Logger } from "./logging";
|
8
9
|
export const AuthorizationDetail = z.object({
|
9
10
|
credential_configuration_id: z.string(),
|
10
11
|
format: z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]),
|
@@ -71,6 +72,7 @@ export const makeParRequest = _ref => {
|
|
71
72
|
client_assertion_type: assertionType,
|
72
73
|
client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
|
73
74
|
});
|
75
|
+
Logger.log(LogLevel.DEBUG, `Sending to PAR endpoint ${parEndpoint}: ${formBody}`);
|
74
76
|
return await appFetch(parEndpoint, {
|
75
77
|
method: "POST",
|
76
78
|
headers: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["sha256ToBase64","SignJWT","v4","uuidv4","z","WalletInstanceAttestation","generateRandomAlphaNumericString","hasStatusOrThrow","createPopToken","IssuerResponseError","AuthorizationDetail","object","credential_configuration_id","string","format","union","literal","type","AuthorizationDetails","array","makeParRequest","_ref","wiaCryptoContext","appFetch","clientId","codeVerifier","redirectUri","responseMode","parEndpoint","walletInstanceAttestation","authorizationDetails","assertionType","wiaPublicKey","getPublicKey","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","signedWiaPoP","jti","codeChallengeMethod","codeChallenge","signedJwtForPar","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","code_challenge","code_challenge_method","authorization_details","redirect_uri","client_assertion_type","client_assertion","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","request","method","headers","body","toString","then","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":"AAAA,SACEA,cAAc,EAEdC,OAAO,QACF,6BAA6B;AACpC,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,OAAO,KAAKC,yBAAyB,MAAM,gCAAgC;AAC3E,SAASC,gCAAgC,EAAEC,gBAAgB,QAAQ,QAAQ;AAC3E,SAASC,cAAc,QAAQ,OAAO;AACtC,SAASC,mBAAmB,QAAQ,UAAU;
|
1
|
+
{"version":3,"names":["sha256ToBase64","SignJWT","v4","uuidv4","z","WalletInstanceAttestation","generateRandomAlphaNumericString","hasStatusOrThrow","createPopToken","IssuerResponseError","LogLevel","Logger","AuthorizationDetail","object","credential_configuration_id","string","format","union","literal","type","AuthorizationDetails","array","makeParRequest","_ref","wiaCryptoContext","appFetch","clientId","codeVerifier","redirectUri","responseMode","parEndpoint","walletInstanceAttestation","authorizationDetails","assertionType","wiaPublicKey","getPublicKey","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","signedWiaPoP","jti","codeChallengeMethod","codeChallenge","signedJwtForPar","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","code_challenge","code_challenge_method","authorization_details","redirect_uri","client_assertion_type","client_assertion","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","request","log","DEBUG","method","headers","body","toString","then","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":"AAAA,SACEA,cAAc,EAEdC,OAAO,QACF,6BAA6B;AACpC,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,OAAO,KAAKC,yBAAyB,MAAM,gCAAgC;AAC3E,SAASC,gCAAgC,EAAEC,gBAAgB,QAAQ,QAAQ;AAC3E,SAASC,cAAc,QAAQ,OAAO;AACtC,SAASC,mBAAmB,QAAQ,UAAU;AAC9C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,WAAW;AAG5C,OAAO,MAAMC,mBAAmB,GAAGR,CAAC,CAACS,MAAM,CAAC;EAC1CC,2BAA2B,EAAEV,CAAC,CAACW,MAAM,CAAC,CAAC;EACvCC,MAAM,EAAEZ,CAAC,CAACa,KAAK,CAAC,CAACb,CAAC,CAACc,OAAO,CAAC,WAAW,CAAC,EAAEd,CAAC,CAACc,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;EACpEC,IAAI,EAAEf,CAAC,CAACc,OAAO,CAAC,mBAAmB;AACrC,CAAC,CAAC;AAGF,OAAO,MAAME,oBAAoB,GAAGhB,CAAC,CAACiB,K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ResponseErrorBuilder, WalletProviderResponseError, WalletProviderResponseErrorCodes } from "../utils/errors";
|
3
|
+
import { LogLevel, Logger } from "../utils/logging";
|
3
4
|
export async function createWalletInstance(context) {
|
4
5
|
const {
|
5
6
|
integrityContext
|
@@ -8,8 +9,10 @@ export async function createWalletInstance(context) {
|
|
8
9
|
|
9
10
|
//1. Obtain nonce
|
10
11
|
const challenge = await api.get("/nonce").then(response => response.nonce);
|
12
|
+
Logger.log(LogLevel.DEBUG, `Challenge obtained from ${context.walletProviderBaseUrl}: ${challenge}`);
|
11
13
|
const keyAttestation = await integrityContext.getAttestation(challenge);
|
12
14
|
const hardwareKeyTag = integrityContext.getHardwareKeyTag();
|
15
|
+
Logger.log(LogLevel.DEBUG, `Key attestation: ${keyAttestation}\nAssociated hardware key tag: ${hardwareKeyTag}`);
|
13
16
|
|
14
17
|
//2. Create Wallet Instance
|
15
18
|
await api.post("/wallet-instances", {
|
@@ -22,6 +25,7 @@ export async function createWalletInstance(context) {
|
|
22
25
|
return hardwareKeyTag;
|
23
26
|
}
|
24
27
|
const handleCreateWalletInstanceError = e => {
|
28
|
+
Logger.log(LogLevel.ERROR, `An error occurred while calling /wallet-instances endpoint: ${e}`);
|
25
29
|
if (!(e instanceof WalletProviderResponseError)) {
|
26
30
|
throw e;
|
27
31
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getWalletProviderClient","ResponseErrorBuilder","WalletProviderResponseError","WalletProviderResponseErrorCodes","createWalletInstance","context","integrityContext","api","challenge","get","then","response","nonce","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag","catch","handleCreateWalletInstanceError","e","handle","code","WalletInstanceIntegrityFailed","message","WalletInstanceCreationFailed","buildFrom","revokeWalletInstance","put","path","id","status","getWalletInstanceStatus","getCurrentWalletInstanceStatus"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,WAAW;AACnD,SACEC,oBAAoB,EACpBC,2BAA2B,EAC3BC,gCAAgC,QAC3B,iBAAiB;
|
1
|
+
{"version":3,"names":["getWalletProviderClient","ResponseErrorBuilder","WalletProviderResponseError","WalletProviderResponseErrorCodes","LogLevel","Logger","createWalletInstance","context","integrityContext","api","challenge","get","then","response","nonce","log","DEBUG","walletProviderBaseUrl","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag","catch","handleCreateWalletInstanceError","e","ERROR","handle","code","WalletInstanceIntegrityFailed","message","WalletInstanceCreationFailed","buildFrom","revokeWalletInstance","put","path","id","status","getWalletInstanceStatus","getCurrentWalletInstanceStatus"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,WAAW;AACnD,SACEC,oBAAoB,EACpBC,2BAA2B,EAC3BC,gCAAgC,QAC3B,iBAAiB;AAGxB,SAASC,QAAQ,EAAEC,MAAM,QAAQ,kBAAkB;AAEnD,OAAO,eAAeC,oBAAoBA,CAACC,OAI1C,EAAE;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EACpC,MAAME,GAAG,GAAGT,uBAAuB,CAACO,OAAO,CAAC;;EAE5C;EACA,MAAMG,SAAS,GAAG,MAAMD,GAAG,CAACE,GAAG,CAAC,QAAQ,CAAC,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,KAAK,CAAC;EAE5ET,MAAM,CAACU,GAAG,CACRX,QAAQ,CAACY,KAAK,EACb,2BAA0BT,OAAO,CAACU,qBAAsB,KAAIP,SAAU,EACzE,CAAC;EAED,MAAMQ,cAAc,GAAG,MAAMV,gBAAgB,CAACW,cAAc,CAACT,SAAS,CAAC;EAEvE,MAAMU,cAAc,GAAGZ,gBAAgB,CAACa,iBAAiB,CAAC,CAAC;EAE3DhB,MAAM,CAACU,GAAG,CACRX,QAAQ,CAACY,KAAK,EACb,oBAAmBE,cAAe,kCAAiCE,cAAe,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CAAC,+BAA+B,EAAE;IAC9C2B,IAAI,EAAE;MAAEC,EAAE,EAAEhC,OAAO,CAACgC;IAAG;EACzB,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAeG,8BAA8BA,CAACnC,OAGpD,EAA+B;EAC9B,MAAME,GAAG,GAAGT,uBAAuB,CAACO,OAAO,CAAC;EAE5C,OAAOE,GAAG,CAACE,GAAG,CAAC,kCAAkC,CAAC;AACpD"}
|
@@ -3,6 +3,7 @@ import { fixBase64EncodingOnKey, JWK } from "../utils/jwk";
|
|
3
3
|
import { getWalletProviderClient } from "../client";
|
4
4
|
import { ResponseErrorBuilder, WalletProviderResponseError, WalletProviderResponseErrorCodes } from "../utils/errors";
|
5
5
|
import { TokenResponse } from "./types";
|
6
|
+
import { LogLevel, Logger } from "../utils/logging";
|
6
7
|
|
7
8
|
/**
|
8
9
|
* Getter for an attestation request. The attestation request is a JWT that will be sent to the Wallet Provider to request a Wallet Instance Attestation.
|
@@ -69,9 +70,11 @@ export const getAttestation = async _ref => {
|
|
69
70
|
|
70
71
|
// 1. Get nonce from backend
|
71
72
|
const challenge = await api.get("/nonce").then(response => response.nonce);
|
73
|
+
Logger.log(LogLevel.DEBUG, `Challenge obtained from ${walletProviderBaseUrl}: ${challenge} `);
|
72
74
|
|
73
75
|
// 2. Get a signed attestation request
|
74
76
|
const signedAttestationRequest = await getAttestationRequest(challenge, wiaCryptoContext, integrityContext, walletProviderBaseUrl);
|
77
|
+
Logger.log(LogLevel.DEBUG, `Signed attestation request: ${signedAttestationRequest}`);
|
75
78
|
|
76
79
|
// 3. Request WIA
|
77
80
|
const tokenResponse = await api.post("/token", {
|
@@ -80,9 +83,11 @@ export const getAttestation = async _ref => {
|
|
80
83
|
assertion: signedAttestationRequest
|
81
84
|
}
|
82
85
|
}).then(result => TokenResponse.parse(result)).catch(handleAttestationCreationError);
|
86
|
+
Logger.log(LogLevel.DEBUG, `Obtained wallet attestation: ${tokenResponse.wallet_attestation}`);
|
83
87
|
return tokenResponse.wallet_attestation;
|
84
88
|
};
|
85
89
|
const handleAttestationCreationError = e => {
|
90
|
+
Logger.log(LogLevel.ERROR, `An error occurred while calling /token endpoint: ${e}`);
|
86
91
|
if (!(e instanceof WalletProviderResponseError)) {
|
87
92
|
throw e;
|
88
93
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["SignJWT","thumbprint","fixBase64EncodingOnKey","JWK","getWalletProviderClient","ResponseErrorBuilder","WalletProviderResponseError","WalletProviderResponseErrorCodes","TokenResponse","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","parse","keyThumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","get","then","response","nonce","signedAttestationRequest","tokenResponse","post","body","grant_type","assertion","result","catch","handleAttestationCreationError","wallet_attestation","e","handle","code","WalletInstanceRevoked","message","WalletInstanceNotFound","WalletInstanceIntegrityFailed","WalletInstanceAttestationIssuingFailed","buildFrom"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":"AAAA,SAEEA,OAAO,EACPC,UAAU,QACL,6BAA6B;AACpC,SAASC,sBAAsB,EAAEC,GAAG,QAAQ,cAAc;AAC1D,SAASC,uBAAuB,QAAQ,WAAW;AAEnD,SACEC,oBAAoB,EACpBC,2BAA2B,EAC3BC,gCAAgC,QAC3B,iBAAiB;AACxB,SAASC,aAAa,QAAQ,SAAS;;
|
1
|
+
{"version":3,"names":["SignJWT","thumbprint","fixBase64EncodingOnKey","JWK","getWalletProviderClient","ResponseErrorBuilder","WalletProviderResponseError","WalletProviderResponseErrorCodes","TokenResponse","LogLevel","Logger","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","parse","keyThumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","get","then","response","nonce","log","DEBUG","signedAttestationRequest","tokenResponse","post","body","grant_type","assertion","result","catch","handleAttestationCreationError","wallet_attestation","e","ERROR","handle","code","WalletInstanceRevoked","message","WalletInstanceNotFound","WalletInstanceIntegrityFailed","WalletInstanceAttestationIssuingFailed","buildFrom"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":"AAAA,SAEEA,OAAO,EACPC,UAAU,QACL,6BAA6B;AACpC,SAASC,sBAAsB,EAAEC,GAAG,QAAQ,cAAc;AAC1D,SAASC,uBAAuB,QAAQ,WAAW;AAEnD,SACEC,oBAAoB,EACpBC,2BAA2B,EAC3BC,gCAAgC,QAC3B,iBAAiB;AACxB,SAASC,aAAa,QAAQ,SAAS;AACvC,SAASC,QAAQ,EAAEC,MAAM,QAAQ,kBAAkB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,qBAAqBA,CACzCC,SAAiB,EACjBC,gBAA+B,EAC/BC,gBAAkC,EAClCC,qBAA6B,EACZ;EACjB,MAAMC,GAAG,GAAG,MAAMH,gBAAgB,CAACI,YAAY,CAAC,CAAC;EACjD,MAAMC,SAAS,GAAGf,GAAG,CAACgB,KAAK,CAACH,GAAG,CAAC;EAChC,MAAMI,aAAa,GAAG,MAAMnB,UAAU,CAACiB,SAAS,CAAC;EACjD,MAAMG,SAAS,GAAG;IAAE,GAAGH,SAAS;IAAEI,GAAG,EAAEF;EAAc,CAAC;EAEtD,MAAMG,UAAU,GAAG;IACjBX,SAAS;IACTY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AAC,CAAC,CACDH,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAE7D,gCAAgC,CAACkE,sCAAsC;IAC7EH,OAAO,EAAE;EACX,CAAC,CAAC,CACDI,SAAS,CAACT,CAAC,CAAC;AACjB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"03-start-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/03-start-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAoC,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAkB,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"03-start-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/03-start-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAoC,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAkB,MAAM,iBAAiB,CAAC;AAItE,MAAM,MAAM,sBAAsB,GAAG,CACnC,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,cAAc,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,EAChD,OAAO,EAAE;IACP,gBAAgB,EAAE,aAAa,CAAC;IAChC,yBAAyB,EAAE,MAAM,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,mBAAmB,CAAC;CAC3C,CAAC,CAAC;AAsEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBA0CpC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"04-complete-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/04-complete-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
1
|
+
{"version":3,"file":"04-complete-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/04-complete-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAOtD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AmC,EAAE,mCAsC/C,CAAC;AAEJ;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,4CAA4C,EAAE,4CAgIxD,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,YAC5B,OAAO,KACf,mBAqBF,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"05-authorize-access.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/05-authorize-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAK5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,kCAAkC,CAAC;
|
1
|
+
{"version":3,"file":"05-authorize-access.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/05-authorize-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAK5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,kCAAkC,CAAC;AAG/F,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,IAAI,EAAE,GAAG,CAAC,sCAAsC,CAAC,CAAC,MAAM,CAAC,EACzD,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,YAAY,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,cAAc,CAAC,EACzD,OAAO,EAAE;IACP,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,gBAAgB,EAAE,aAAa,CAAC;IAChC,iBAAiB,EAAE,aAAa,CAAC;CAClC,KACE,OAAO,CAAC;IAAE,WAAW,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAE7C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe,EAAE,eAwF7B,CAAC"}
|
@@ -8,7 +8,7 @@ export type ObtainCredential = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf
|
|
8
8
|
dPopCryptoContext: CryptoContext;
|
9
9
|
credentialCryptoContext: CryptoContext;
|
10
10
|
appFetch?: GlobalFetch["fetch"];
|
11
|
-
}) => Promise<CredentialResponse>;
|
11
|
+
}, operationType?: "reissuing") => Promise<CredentialResponse>;
|
12
12
|
export declare const createNonceProof: (nonce: string, issuer: string, audience: string, ctx: CryptoContext) => Promise<string>;
|
13
13
|
/**
|
14
14
|
* Obtains the credential from the issuer.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"06-obtain-credential.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/06-obtain-credential.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAQ5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"06-obtain-credential.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/06-obtain-credential.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAQ5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAK7C,MAAM,MAAM,gBAAgB,GAAG,CAC7B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,WAAW,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,aAAa,CAAC,EAChD,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,oBAAoB,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,EACzE,OAAO,EAAE;IACP,iBAAiB,EAAE,aAAa,CAAC;IACjC,uBAAuB,EAAE,aAAa,CAAC;IACvC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,EACD,aAAa,CAAC,EAAE,WAAW,KACxB,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,eAAO,MAAM,gBAAgB,UACpB,MAAM,UACL,MAAM,YACJ,MAAM,OACX,aAAa,KACjB,QAAQ,MAAM,CAehB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBA+G9B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"07-verify-and-parse-credential.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/07-verify-and-parse-credential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAMtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
1
|
+
{"version":3,"file":"07-verify-and-parse-credential.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/07-verify-and-parse-credential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAMtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,MAAM,MAAM,wBAAwB,GAAG,CACrC,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,UAAU,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC,EAC/C,MAAM,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,EACvC,OAAO,EAAE;IACP,uBAAuB,EAAE,aAAa,CAAC;IACvC;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,KACE,OAAO,CAAC;IACX,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,UAAU,EAAE,IAAI,CAAC;IACjB,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;CAC5B,CAAC,CAAC;AAGH,KAAK,gBAAgB,GAAG,MAAM;AAC5B,oBAAoB;AACpB,MAAM,EACN;IACE,2CAA2C;IAC3C,IAAI,EACA,yBAAyB,CAAC,MAAM,CAC9B,MAAM,EACN,MAAM,CACP,GACD,4BAA4B,CAAC,MAAM,GACnC,SAAS,CAAC;IACd,wCAAwC;IACxC,KAAK,EAAE,OAAO,CAAC;CAChB,CACF,CAAC;AAyMF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,EAAE,wBAkBtC,CAAC"}
|
@@ -1,18 +1,18 @@
|
|
1
1
|
import * as z from "zod";
|
2
2
|
declare const PresentationParams: z.ZodObject<{
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
client_id: z.ZodString;
|
4
|
+
request_uri: z.ZodString;
|
5
|
+
request_uri_method: z.ZodEnum<["get", "post"]>;
|
6
6
|
state: z.ZodOptional<z.ZodString>;
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
client_id: string;
|
9
|
+
request_uri: string;
|
10
|
+
request_uri_method: "get" | "post";
|
11
11
|
state?: string | undefined;
|
12
12
|
}, {
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
client_id: string;
|
14
|
+
request_uri: string;
|
15
|
+
request_uri_method: "get" | "post";
|
16
16
|
state?: string | undefined;
|
17
17
|
}>;
|
18
18
|
export type PresentationParams = z.infer<typeof PresentationParams>;
|
@@ -20,16 +20,19 @@ export type PresentationParams = z.infer<typeof PresentationParams>;
|
|
20
20
|
* The beginning of the presentation flow.
|
21
21
|
* To be implemented accordind to the user touchpoint
|
22
22
|
*
|
23
|
-
* @param params Presentation parameters, depending on the starting
|
23
|
+
* @param params Presentation parameters, depending on the starting touchpoint
|
24
24
|
* @returns The url for the Relying Party to connect with
|
25
25
|
*/
|
26
|
-
export type StartFlow = (params:
|
26
|
+
export type StartFlow = (params: {
|
27
|
+
[K in keyof PresentationParams]?: PresentationParams[K] | null;
|
28
|
+
}) => PresentationParams;
|
27
29
|
/**
|
28
|
-
* Start a presentation flow by
|
30
|
+
* Start a presentation flow by validating the required parameters.
|
31
|
+
* Parameters are extracted from a url encoded in a QR code or in a deep link.
|
29
32
|
*
|
30
|
-
* @param params The
|
33
|
+
* @param params The parameters to be validated
|
31
34
|
* @returns The url for the Relying Party to connect with
|
32
|
-
* @throws If the provided
|
35
|
+
* @throws If the provided parameters are not valid
|
33
36
|
*/
|
34
37
|
export declare const startFlowFromQR: StartFlow;
|
35
38
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"01-start-flow.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/01-start-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;EAKtB,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,
|
1
|
+
{"version":3,"file":"01-start-flow.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/01-start-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;EAKtB,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE;KAC9B,CAAC,IAAI,MAAM,kBAAkB,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI;CAC/D,KAAK,kBAAkB,CAAC;AAEzB;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,SAW7B,CAAC"}
|
@@ -1,7 +1,5 @@
|
|
1
|
-
import { type Out } from "../../utils/misc";
|
2
|
-
import type { StartFlow } from "./01-start-flow";
|
3
1
|
import { RequestObjectWalletCapabilities } from "./types";
|
4
|
-
export type GetRequestObject = (requestUri:
|
2
|
+
export type GetRequestObject = (requestUri: string, context?: {
|
5
3
|
appFetch?: GlobalFetch["fetch"];
|
6
4
|
walletCapabilities?: RequestObjectWalletCapabilities;
|
7
5
|
}) => Promise<{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"03-get-request-object.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/03-get-request-object.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"03-get-request-object.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/03-get-request-object.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,MAAM,gBAAgB,GAAG,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,kBAAkB,CAAC,EAAE,+BAA+B,CAAC;CACtD,KACE,OAAO,CAAC;IAAE,uBAAuB,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAElD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAsC9B,CAAC"}
|
@@ -9,12 +9,13 @@ export type VerifyRequestObject = (requestObjectEncodedJwt: string, context: {
|
|
9
9
|
requestObject: RequestObject;
|
10
10
|
}>;
|
11
11
|
/**
|
12
|
-
* Function to verify the Request Object's signature
|
12
|
+
* Function to verify the Request Object's validity, from the signature to the required properties.
|
13
13
|
* @param requestObjectEncodedJwt The Request Object in JWT format
|
14
14
|
* @param context.clientId The client ID to verify
|
15
15
|
* @param context.rpConf The Entity Configuration of the Relying Party
|
16
16
|
* @param context.state Optional state
|
17
17
|
* @returns The verified Request Object
|
18
|
+
* @throws {InvalidRequestObjectError} if the Request Object cannot be validated
|
18
19
|
*/
|
19
20
|
export declare const verifyRequestObject: VerifyRequestObject;
|
20
21
|
//# sourceMappingURL=05-verify-request-object.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"05-verify-request-object.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/05-verify-request-object.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,MAAM,MAAM,mBAAmB,GAAG,CAChC,uBAAuB,EAAE,MAAM,EAC/B,OAAO,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,+BAA+B,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,KACE,OAAO,CAAC;IAAE,aAAa,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAE/C
|
1
|
+
{"version":3,"file":"05-verify-request-object.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/05-verify-request-object.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,MAAM,MAAM,mBAAmB,GAAG,CAChC,uBAAuB,EAAE,MAAM,EAC/B,OAAO,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,+BAA+B,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,KACE,OAAO,CAAC;IAAE,aAAa,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAE/C;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,mBAsCjC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"07-evaluate-dcql-query.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/07-evaluate-dcql-query.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"07-evaluate-dcql-query.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/07-evaluate-dcql-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,MAAM,CAAC;AAG7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGlD;;GAEG;AACH,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAC9B,gBAAgB,EAAE,CAAC,MAAM,EAAe,MAAM,CAAkB,EAAE,EAClE,KAAK,EAAE,SAAS,CAAC,KAAK,KACnB;IACH,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,UAAU,EAAE,CAAC;IAClC,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B,EAAE,CAAC;AAEJ,MAAM,MAAM,0BAA0B,GAAG,CACvC,WAAW,EAAE;IACX,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,EAAE,EACH,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;AAwEnC,eAAO,MAAM,iBAAiB,EAAE,iBAkE/B,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,0BAqBxC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"07-evaluate-input-descriptor.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/07-evaluate-input-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAU1E,MAAM,MAAM,oBAAoB,GAAG;IACjC,mBAAmB,EAAE,qBAAqB,EAAE,CAAC;IAC7C,mBAAmB,EAAE,qBAAqB,EAAE,CAAC;IAC7C,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,CAC5C,eAAe,EAAE,eAAe,EAChC,iBAAiB,EAAE,QAAQ,CAAC,SAAS,CAAC,EACtC,WAAW,EAAE,qBAAqB,EAAE,KACjC,oBAAoB,CAAC;AAE1B,MAAM,MAAM,wBAAwB,GAAG,CACrC,WAAW,EAAE,eAAe,EAAE,EAC9B,gBAAgB,EAAE,CAAC,MAAM,EAAe,MAAM,CAAkB,EAAE,KAC/D,OAAO,CACV;IACE,mBAAmB,EAAE,oBAAoB,CAAC;IAC1C,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,EAAE,CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG,CAC7C,wBAAwB,EAAE;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,EAAE,EACH,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;AA+EzC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kCAAkC,EAAE,+BAsG9C,CAAC;AAEJ,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;IAChB,WAAW,EAAE,qBAAqB,EAAE,CAAC;CACtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,oBACb,eAAe,2BACP,sBAAsB,EAAE,KAChD;IACD,iBAAiB,EAAE,oBAAoB,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"07-evaluate-input-descriptor.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/07-evaluate-input-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAU1E,MAAM,MAAM,oBAAoB,GAAG;IACjC,mBAAmB,EAAE,qBAAqB,EAAE,CAAC;IAC7C,mBAAmB,EAAE,qBAAqB,EAAE,CAAC;IAC7C,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,CAC5C,eAAe,EAAE,eAAe,EAChC,iBAAiB,EAAE,QAAQ,CAAC,SAAS,CAAC,EACtC,WAAW,EAAE,qBAAqB,EAAE,KACjC,oBAAoB,CAAC;AAE1B,MAAM,MAAM,wBAAwB,GAAG,CACrC,WAAW,EAAE,eAAe,EAAE,EAC9B,gBAAgB,EAAE,CAAC,MAAM,EAAe,MAAM,CAAkB,EAAE,KAC/D,OAAO,CACV;IACE,mBAAmB,EAAE,oBAAoB,CAAC;IAC1C,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,EAAE,CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG,CAC7C,wBAAwB,EAAE;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,EAAE,EACH,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;AA+EzC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kCAAkC,EAAE,+BAsG9C,CAAC;AAEJ,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;IAChB,WAAW,EAAE,qBAAqB,EAAE,CAAC;CACtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,oBACb,eAAe,2BACP,sBAAsB,EAAE,KAChD;IACD,iBAAiB,EAAE,oBAAoB,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;CAgC3B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,EAAE,wBA0CtC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gCAAgC,EAAE,gCA6B5C,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type FetchJwks } from "./04-retrieve-rp-jwks";
|
2
2
|
import type { VerifyRequestObject } from "./05-verify-request-object";
|
3
3
|
import { type Out } from "../../utils/misc";
|
4
|
-
import { type RemotePresentation, DirectAuthorizationBodyPayload, type LegacyRemotePresentation
|
4
|
+
import { type RemotePresentation, DirectAuthorizationBodyPayload, ErrorResponse, type LegacyRemotePresentation } from "./types";
|
5
5
|
import * as z from "zod";
|
6
6
|
import type { JWK } from "../../utils/jwk";
|
7
7
|
import type { RelyingPartyEntityConfiguration } from "../../trust";
|
@@ -36,7 +36,15 @@ export declare const choosePublicKeyToEncrypt: (rpJwkKeys: Out<FetchJwks>["keys"
|
|
36
36
|
* @param payload - Object that contains the VP token to encrypt and the mapping of the credential disclosures
|
37
37
|
* @returns A URL-encoded string for an `application/x-www-form-urlencoded` POST body, where `response` contains the encrypted JWE.
|
38
38
|
*/
|
39
|
-
export declare const buildDirectPostJwtBody: (requestObject: Out<VerifyRequestObject>["requestObject"], rpConf: RelyingPartyEntityConfiguration["payload"]["metadata"], payload: DirectAuthorizationBodyPayload
|
39
|
+
export declare const buildDirectPostJwtBody: (requestObject: Out<VerifyRequestObject>["requestObject"], rpConf: RelyingPartyEntityConfiguration["payload"]["metadata"], payload: DirectAuthorizationBodyPayload) => Promise<string>;
|
40
|
+
/**
|
41
|
+
* Builds a URL-encoded form body for a direct POST response without encryption.
|
42
|
+
*
|
43
|
+
* @param requestObject - Contains state, nonce, and other relevant info.
|
44
|
+
* @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
|
45
|
+
* @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
|
46
|
+
*/
|
47
|
+
export declare const buildDirectPostBody: (requestObject: Out<VerifyRequestObject>["requestObject"], payload: DirectAuthorizationBodyPayload) => Promise<string>;
|
40
48
|
/**
|
41
49
|
* Type definition for the function that sends the authorization response
|
42
50
|
* to the Relying Party, completing the presentation flow.
|
@@ -67,4 +75,24 @@ export type SendAuthorizationResponse = (requestObject: Out<VerifyRequestObject>
|
|
67
75
|
appFetch?: GlobalFetch["fetch"];
|
68
76
|
}) => Promise<AuthorizationResponse>;
|
69
77
|
export declare const sendAuthorizationResponse: SendAuthorizationResponse;
|
78
|
+
/**
|
79
|
+
* Type definition for the function that sends the authorization response
|
80
|
+
* to the Relying Party, completing the presentation flow.
|
81
|
+
*/
|
82
|
+
export type SendAuthorizationErrorResponse = (requestObject: Out<VerifyRequestObject>["requestObject"], error: {
|
83
|
+
error: ErrorResponse;
|
84
|
+
errorDescription: string;
|
85
|
+
}, context?: {
|
86
|
+
appFetch?: GlobalFetch["fetch"];
|
87
|
+
}) => Promise<AuthorizationResponse>;
|
88
|
+
/**
|
89
|
+
* Sends the authorization error response to the Relying Party (RP) using the specified `response_mode`.
|
90
|
+
* This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
|
91
|
+
*
|
92
|
+
* @param requestObject - The request details, including presentation requirements.
|
93
|
+
* @param error - The response error value, with description
|
94
|
+
* @param context - Contains optional custom fetch implementation.
|
95
|
+
* @returns Parsed and validated authorization response from the Relying Party.
|
96
|
+
*/
|
97
|
+
export declare const sendAuthorizationErrorResponse: SendAuthorizationErrorResponse;
|
70
98
|
//# sourceMappingURL=08-send-authorization-response.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"08-send-authorization-response.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/08-send-authorization-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,KAAK,kBAAkB,EACvB,8BAA8B,EAC9B,KAAK,wBAAwB,
|
1
|
+
{"version":3,"file":"08-send-authorization-response.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/08-send-authorization-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,KAAK,kBAAkB,EACvB,8BAA8B,EAC9B,aAAa,EACb,KAAK,wBAAwB,EAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,CAAC,MAAM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