@pagopa/io-react-native-wallet 0.25.0 → 0.27.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 +1 -35
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +19 -57
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +1 -0
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +1 -2
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/errors.js +1 -18
- package/lib/commonjs/credential/issuance/errors.js.map +1 -1
- package/lib/commonjs/credential/issuance/index.js +6 -0
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/credential/status/02-status-attestation.js +2 -4
- package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -1
- package/lib/commonjs/index.js +1 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/misc.js +19 -58
- package/lib/commonjs/utils/misc.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/issuing.js +1 -2
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/credential/issuance/03-start-user-authorization.js +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +19 -58
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +1 -0
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +1 -2
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/errors.js +0 -16
- package/lib/module/credential/issuance/errors.js.map +1 -1
- package/lib/module/credential/issuance/index.js +2 -2
- package/lib/module/credential/issuance/index.js.map +1 -1
- package/lib/module/credential/status/02-status-attestation.js +2 -4
- package/lib/module/credential/status/02-status-attestation.js.map +1 -1
- package/lib/module/index.js +1 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/misc.js +14 -51
- package/lib/module/utils/misc.js.map +1 -1
- package/lib/module/wallet-instance-attestation/issuing.js +1 -2
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +16 -15
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts +1 -0
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/errors.d.ts +0 -9
- package/lib/typescript/credential/issuance/errors.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/index.d.ts +3 -3
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/credential/status/02-status-attestation.d.ts +1 -2
- package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/misc.d.ts +5 -25
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts +2 -2
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/package.json +2 -6
- package/src/credential/issuance/03-start-user-authorization.ts +1 -1
- package/src/credential/issuance/04-complete-user-authorization.ts +42 -103
- package/src/credential/issuance/05-authorize-access.ts +1 -0
- package/src/credential/issuance/06-obtain-credential.ts +1 -2
- package/src/credential/issuance/errors.ts +0 -15
- package/src/credential/issuance/index.ts +4 -0
- package/src/credential/status/02-status-attestation.ts +2 -4
- package/src/index.ts +0 -2
- package/src/utils/misc.ts +16 -63
- package/src/wallet-instance-attestation/issuing.ts +1 -2
- package/lib/commonjs/cie/README.md +0 -6
- package/lib/commonjs/cie/component.js +0 -182
- package/lib/commonjs/cie/component.js.map +0 -1
- package/lib/commonjs/cie/error.js +0 -44
- package/lib/commonjs/cie/error.js.map +0 -1
- package/lib/commonjs/cie/index.js +0 -32
- package/lib/commonjs/cie/index.js.map +0 -1
- package/lib/commonjs/cie/manager.js +0 -142
- package/lib/commonjs/cie/manager.js.map +0 -1
- package/lib/module/cie/README.md +0 -6
- package/lib/module/cie/component.js +0 -172
- package/lib/module/cie/component.js.map +0 -1
- package/lib/module/cie/error.js +0 -36
- package/lib/module/cie/error.js.map +0 -1
- package/lib/module/cie/index.js +0 -4
- package/lib/module/cie/index.js.map +0 -1
- package/lib/module/cie/manager.js +0 -133
- package/lib/module/cie/manager.js.map +0 -1
- package/lib/typescript/cie/component.d.ts +0 -46
- package/lib/typescript/cie/component.d.ts.map +0 -1
- package/lib/typescript/cie/error.d.ts +0 -31
- package/lib/typescript/cie/error.d.ts.map +0 -1
- package/lib/typescript/cie/index.d.ts +0 -4
- package/lib/typescript/cie/index.d.ts.map +0 -1
- package/lib/typescript/cie/manager.d.ts +0 -5
- package/lib/typescript/cie/manager.d.ts.map +0 -1
- package/src/cie/README.md +0 -6
- package/src/cie/component.tsx +0 -218
- package/src/cie/error.ts +0 -58
- package/src/cie/index.ts +0 -4
- package/src/cie/manager.ts +0 -183
package/README.md
CHANGED
|
@@ -5,9 +5,7 @@ Follows the [eudi-wallet-it-docs](https://github.com/italia/eudi-wallet-it-docs)
|
|
|
5
5
|
|
|
6
6
|
## Dependencies
|
|
7
7
|
|
|
8
|
-
- [@pagopa/io-react-native-jwt](https://github.com/pagopa/io-react-native-jwt) is used to manage JWT tokens
|
|
9
|
-
- [@pagopa/react-native-cie](https://github.com/pagopa/io-cie-sdk) is used to manage CIE authentication;
|
|
10
|
-
- [react-native-webview](https://github.com/react-native-webview/react-native-webview) is used to manage the webview for the CIE authentication flow.
|
|
8
|
+
- [@pagopa/io-react-native-jwt](https://github.com/pagopa/io-react-native-jwt) is used to manage JWT tokens.
|
|
11
9
|
|
|
12
10
|
## Installation
|
|
13
11
|
|
|
@@ -70,36 +68,6 @@ The
|
|
|
70
68
|
|
|
71
69
|
</details>
|
|
72
70
|
|
|
73
|
-
<details>
|
|
74
|
-
<summary>AuthorizationContext (strong authentication handling)</summary>
|
|
75
|
-
|
|
76
|
-
Whenever a strong authentication is required, the library asks the consumer application to provide a way to perform the user authentication. This is done by providing a AuthenticationContext object formed as follows:
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
/**
|
|
80
|
-
* Context for authorization during the {@link 03-start-user-authorization.ts} phase.
|
|
81
|
-
* It consists of a single method to identify the user which takes a URL and a redirect schema as input.
|
|
82
|
-
* Once the authorization is completed and the URL calls the redirect schema, the method should return the redirect URL.
|
|
83
|
-
*/
|
|
84
|
-
export interface AuthorizationContext {
|
|
85
|
-
authorize: (url: string, redirectSchema: string) => Promise<string>;
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
The authorize function is called with the URL to be opened and the schema to be used to redirect the user back to the application. The function should return a promise that resolves with the URL that the user has been redirected to.
|
|
90
|
-
The suggested library to manage authorizations is [io-react-native-login-utils](https://github.com/pagopa/io-react-native-login-utils), an example is shown below:
|
|
91
|
-
|
|
92
|
-
```ts
|
|
93
|
-
import { type AuthorizationContext } from "@pagopa/io-react-native-wallet";
|
|
94
|
-
import { openAuthenticationSession } from "@pagopa/io-react-native-login-utils";
|
|
95
|
-
|
|
96
|
-
const authorizationContext: AuthorizationContext = {
|
|
97
|
-
authorize: openAuthenticationSession,
|
|
98
|
-
};
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
</details>
|
|
102
|
-
|
|
103
71
|
<details>
|
|
104
72
|
<summary>IntegrityToken (device integrity)</summary>
|
|
105
73
|
|
|
@@ -159,7 +127,6 @@ Below there's a list of the libraries and a schema of how they interact with eac
|
|
|
159
127
|
|
|
160
128
|
- [@pagopa/io-react-native-crypto](https://github.com/pagopa/io-react-native-crypto) - Used to manage cryptographic keys and signatures
|
|
161
129
|
- [@pagopa/io-react-native-integrity](https://github.com/pagopa/io-react-native-integrity) - Used to manage and verify the integrity of the device
|
|
162
|
-
- [@pagopa/io-react-native-login-utils](https://github.com/pagopa/io-react-native-login-utils) - Used to manage strong authentication flows securely
|
|
163
130
|
- [@pagopa/io-react-native-secure-storage](https://github.com/pagopa/io-react-native-secure-storage) - Used to store data securely on the device
|
|
164
131
|
|
|
165
132
|
```mermaid
|
|
@@ -168,7 +135,6 @@ graph TD;
|
|
|
168
135
|
iornw[io-react-native-wallet]
|
|
169
136
|
iornc[io-react-native-crypto]
|
|
170
137
|
iorni[io-react-native-integrity]
|
|
171
|
-
iornlu[io-react-native-login-utils]
|
|
172
138
|
iornss[io-react-native-secure-storage]
|
|
173
139
|
iornjwt[io-react-native-jwt]
|
|
174
140
|
rncie[react-native-cie]
|
|
@@ -57,7 +57,7 @@ const selectResponseMode = (issuerConf, credentialType) => {
|
|
|
57
57
|
* the application session identifier on the Wallet Instance side (state),
|
|
58
58
|
* the method (query or form_post.jwt) by which the Authorization Server
|
|
59
59
|
* should transmit the Authorization Response containing the authorization code issued upon the end user's authentication (response_mode)
|
|
60
|
-
* to the Wallet Instance's Token Endpoint to obtain the Access Token, and the
|
|
60
|
+
* to the Wallet Instance's Token Endpoint to obtain the Access Token, and the redirectUri of the Wallet Instance where the Authorization Response
|
|
61
61
|
* should be delivered. The redirect is achived by using a custom URL scheme that the Wallet Instance is registered to handle.
|
|
62
62
|
* @param issuerConf The issuer configuration
|
|
63
63
|
* @param credentialType The type of the credential to be requested returned by {@link selectCredentialDefinition}
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.parseAuthorizationResponse = exports.getRequestedCredentialToBePresented = exports.completeUserAuthorizationWithQueryMode = exports.completeUserAuthorizationWithFormPostJwtMode = void 0;
|
|
6
|
+
exports.parseAuthorizationResponse = exports.getRequestedCredentialToBePresented = exports.completeUserAuthorizationWithQueryMode = exports.completeUserAuthorizationWithFormPostJwtMode = exports.buildAuthorizationUrl = void 0;
|
|
7
7
|
var _auth = require("../../utils/auth");
|
|
8
8
|
var _misc = require("../../utils/misc");
|
|
9
9
|
var _parseUrl = _interopRequireDefault(require("parse-url"));
|
|
10
10
|
var _errors = require("../../utils/errors");
|
|
11
|
-
var _reactNative = require("react-native");
|
|
12
11
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
|
13
12
|
var _types = require("../presentation/types");
|
|
14
13
|
var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
|
|
@@ -21,25 +20,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
21
20
|
*/
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
|
-
* WARNING: This function must be called after {@link startUserAuthorization}. The
|
|
25
|
-
*
|
|
26
|
-
* It is used to complete the user authorization by catching the redirectSchema from the authorization server which then contains the authorization response.
|
|
27
|
-
* This function utilizes the authorization context to open an in-app browser capable of catching the redirectSchema to perform a get request to the authorization endpoint.
|
|
28
|
-
* If the 302 redirect happens and the redirectSchema is caught, the function will return the authorization response after parsing it from the query string.
|
|
23
|
+
* WARNING: This function must be called after {@link startUserAuthorization}. The generated authUrl must be used to open a browser or webview capable of catching the redirectSchema to perform a get request to the authorization endpoint.
|
|
24
|
+
* Builds the authorization URL to which the end user should be redirected to continue the authentication flow.
|
|
29
25
|
* @param issuerRequestUri the URI of the issuer where the request is sent
|
|
30
26
|
* @param clientId Identifies the current client across all the requests of the issuing flow returned by {@link startUserAuthorization}
|
|
31
27
|
* @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
|
|
32
|
-
* @param
|
|
33
|
-
*
|
|
34
|
-
* @param idphint Unique identifier of the SPID IDP selected by the user
|
|
35
|
-
* @param redirectUri The url to reach to complete the user authorization which is the custom URL scheme that the Wallet Instance is registered to handle, usually a custom URL or deeplink
|
|
36
|
-
* @param signal An optional {@link AbortSignal} to abort the operation when using the default browser
|
|
37
|
-
* @throws {AuthorizationError} if an error occurs during the authorization process
|
|
38
|
-
* @throws {AuthorizationIdpError} if an error occurs during the authorization process and the error is related to the IDP
|
|
39
|
-
* @throws {OperationAbortedError} if the caller aborts the operation via the provided signal
|
|
40
|
-
* @returns the authorization response which contains code, state and iss
|
|
28
|
+
* @param idpHint Unique identifier of the IDP selected by the user
|
|
29
|
+
* @returns An object containing the authorization URL
|
|
41
30
|
*/
|
|
42
|
-
const
|
|
31
|
+
const buildAuthorizationUrl = async (issuerRequestUri, clientId, issuerConf, idpHint) => {
|
|
43
32
|
const authzRequestEndpoint = issuerConf.oauth_authorization_server.authorization_endpoint;
|
|
44
33
|
const params = new URLSearchParams({
|
|
45
34
|
client_id: clientId,
|
|
@@ -47,47 +36,20 @@ const completeUserAuthorizationWithQueryMode = async (issuerRequestUri, clientId
|
|
|
47
36
|
idphint: idpHint
|
|
48
37
|
});
|
|
49
38
|
const authUrl = `${authzRequestEndpoint}?${params}`;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
throw new _errors2.AuthorizationError(e.message);
|
|
55
|
-
});
|
|
56
|
-
} else {
|
|
57
|
-
// handler for redirectUri
|
|
58
|
-
const urlEventListener = _reactNative.Linking.addEventListener("url", _ref => {
|
|
59
|
-
let {
|
|
60
|
-
url
|
|
61
|
-
} = _ref;
|
|
62
|
-
if (url.includes(redirectUri)) {
|
|
63
|
-
authRedirectUrl = url;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
const operationIsAborted = signal ? (0, _misc.createAbortPromiseFromSignal)(signal) : undefined;
|
|
67
|
-
await _reactNative.Linking.openURL(authUrl);
|
|
68
|
-
|
|
69
|
-
/*
|
|
70
|
-
* Waits for 120 seconds for the identificationRedirectUrl variable to be set
|
|
71
|
-
* by the custom url handler. If the timeout is exceeded, throw an exception
|
|
72
|
-
*/
|
|
73
|
-
const unitAuthRedirectIsNotUndefined = (0, _misc.until)(() => authRedirectUrl !== undefined, 120);
|
|
39
|
+
return {
|
|
40
|
+
authUrl
|
|
41
|
+
};
|
|
42
|
+
};
|
|
74
43
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (winner === "OPERATION_ABORTED") {
|
|
85
|
-
throw new _errors2.OperationAbortedError("DefaultQueryModeAuthorization");
|
|
86
|
-
}
|
|
87
|
-
if (authRedirectUrl === undefined) {
|
|
88
|
-
throw new _errors2.AuthorizationError("Invalid authentication redirect url");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
44
|
+
/**
|
|
45
|
+
* WARNING: This function must be called after obtaining the authorization redirect URL from the webviews (SPID and CIE L3) or browser for CIEID.
|
|
46
|
+
* Complete User authorization via strong identification when the response mode is "query" and the request credential is a PersonIdentificationData.
|
|
47
|
+
* This function parses the authorization redirect URL to extract the authorization response.
|
|
48
|
+
* @param authRedirectUrl The URL to which the end user should be redirected to start the authentication flow
|
|
49
|
+
* @returns the authorization response which contains code, state and iss
|
|
50
|
+
*/
|
|
51
|
+
exports.buildAuthorizationUrl = buildAuthorizationUrl;
|
|
52
|
+
const completeUserAuthorizationWithQueryMode = async authRedirectUrl => {
|
|
91
53
|
const query = (0, _parseUrl.default)(authRedirectUrl).query;
|
|
92
54
|
return parseAuthorizationResponse(query);
|
|
93
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","
|
|
1
|
+
{"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_ioReactNativeJwt","_types","_reactNativeUuid","_types2","_decoder","_errors2","obj","__esModule","default","buildAuthorizationUrl","issuerRequestUri","clientId","issuerConf","idpHint","authzRequestEndpoint","oauth_authorization_server","authorization_endpoint","params","URLSearchParams","client_id","request_uri","idphint","authUrl","exports","completeUserAuthorizationWithQueryMode","authRedirectUrl","query","parseUrl","parseAuthorizationResponse","getRequestedCredentialToBePresented","appFetch","arguments","length","undefined","fetch","requestObject","toString","method","then","hasStatusOrThrow","IssuerResponseError","res","text","jws","decode","reqObj","RequestObject","safeParse","payload","success","ValidationFailed","message","reason","error","data","completeUserAuthorizationWithFormPostJwtMode","ctx","wiaCryptoContext","pidCryptoContext","pid","walletInstanceAttestation","wiaWpToken","SignJWT","setProtectedHeader","alg","typ","setPayload","vp","jti","uuid","v4","nonce","setIssuedAt","setExpirationTime","setAudience","response_uri","sign","pidWpToken","presentationSubmission","definition_id","id","descriptor_map","path","format","authzResponsePayload","encodeBase64","JSON","stringify","state","presentation_submission","vp_token","body","response","resUriRes","headers","reqUri","json","responseUri","ResponseUriResultShape","redirect_uri","getJwtFromFormPost","cbRes","decodedJwt","authRes","authResParsed","AuthorizationResultShape","authErr","AuthorizationErrorShape","AuthorizationError","AuthorizationIdpError","error_description"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAL,OAAA;AAMA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AAAqE,SAAAG,uBAAAQ,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAErE;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MA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IAC1B,MAAMyD,OAAO,GAAGC,6BAAuB,CAAC5D,SAAS,CAACwD,OAAO,CAAC;IAC1D,IAAI,CAACG,OAAO,CAACzD,OAAO,EAAE;MACpB,MAAM,IAAI2D,2BAAkB,CAACJ,aAAa,CAACnD,KAAK,CAACF,OAAO,CAAC,CAAC,CAAC;IAC7D;;IACA,MAAM,IAAI0D,8BAAqB,CAC7BH,OAAO,CAACpD,IAAI,CAACD,KAAK,EAClBqD,OAAO,CAACpD,IAAI,CAACwD,iBACf,CAAC;EACH;EACA,OAAON,aAAa,CAAClD,IAAI;AAC3B,CAAC;AAAC/B,OAAA,CAAAK,0BAAA,GAAAA,0BAAA"}
|
|
@@ -30,6 +30,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
30
30
|
* @param context.dPopCryptoContext The DPoP crypto context
|
|
31
31
|
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
|
32
32
|
* @throws {ValidationFailed} if an error occurs while parsing the token response
|
|
33
|
+
* @throws {IssuerResponseError} with a specific code for more context
|
|
33
34
|
* @return The token response containing the access token along with the token request signed with DPoP which has to be used in the {@link obtainCredential} step.
|
|
34
35
|
*/
|
|
35
36
|
const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVerifier, context) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_misc","require","_dpop","_reactNativeUuid","_interopRequireDefault","_pop","WalletInstanceAttestation","_interopRequireWildcard","_const","_types","_errors","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","dPopCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuid","v4","signedWiaPoP","createPopToken","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","ASSERTION_TYPE","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","hasStatusOrThrow","IssuerResponseError","res","json","TokenResponse","safeParse","success","ValidationFailed","message","reason","error","accessToken","data","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAC,uBAAA,CAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAA2E,SAAAU,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAL,wBAAAS,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA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,IAAIC,wBAAgB,CAAC;MACzBC,OAAO,EAAE,kCAAkC;MAC3CC,MAAM,EAAEhB,QAAQ,CAACiB,KAAK,CAACF;IACzB,CAAC,CAAC;EACJ;EAEA,OAAO;IAAEG,WAAW,EAAElB,QAAQ,CAACmB;EAAK,CAAC;AACvC,CAAC;AAACC,OAAA,CAAAnE,eAAA,GAAAA,eAAA"}
|
|
1
|
+
{"version":3,"names":["_misc","require","_dpop","_reactNativeUuid","_interopRequireDefault","_pop","WalletInstanceAttestation","_interopRequireWildcard","_const","_types","_errors","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","dPopCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuid","v4","signedWiaPoP","createPopToken","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","ASSERTION_TYPE","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","hasStatusOrThrow","IssuerResponseError","res","json","TokenResponse","safeParse","success","ValidationFailed","message","reason","error","accessToken","data","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAC,uBAAA,CAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ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AqB,EAAEC,qBAAc;IACrCC,gBAAgB,EAAEnC,yBAAyB,GAAG,GAAG,GAAG0B;EACtD,CAAC;EAED,MAAMU,4BAA4B,GAAG,IAAIC,eAAe,CAACT,WAAW,CAAC;EACrE,MAAMU,QAAQ,GAAG,MAAMxC,QAAQ,CAACmB,QAAQ,EAAE;IACxCsB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,mCAAmC;MACnDC,IAAI,EAAEtB;IACR,CAAC;IACDuB,IAAI,EAAEN,4BAA4B,CAACO,QAAQ,CAAC;EAC9C,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,EAAEC,2BAAmB,CAAC,CAAC,CAChDF,IAAI,CAAEG,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBJ,IAAI,CAAEF,IAAI,IAAKO,oBAAa,CAACC,SAAS,CAACR,IAAI,CAAC,CAAC;EAEhD,IAAI,CAACJ,QAAQ,CAACa,OAAO,EAAE;IACrB,MAAM,IAAIC,wBAAgB,CAAC;MACzBC,OAAO,EAAE,kCAAkC;MAC3CC,MAAM,EAAEhB,QAAQ,CAACiB,KAAK,CAACF;IACzB,CAAC,CAAC;EACJ;EAEA,OAAO;IAAEG,WAAW,EAAElB,QAAQ,CAACmB;EAAK,CAAC;AACvC,CAAC;AAACC,OAAA,CAAAnE,eAAA,GAAAA,eAAA"}
|
|
@@ -100,8 +100,7 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
|
|
|
100
100
|
* Handle the credential error by mapping it to a custom exception.
|
|
101
101
|
* If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
|
|
102
102
|
* @param e - The error to be handled
|
|
103
|
-
* @throws {
|
|
104
|
-
* @throws {@link CredentialInvalidStatusError} if the status code is 404 (meaning the credential is invalid)
|
|
103
|
+
* @throws {IssuerResponseError} with a specific code for more context
|
|
105
104
|
*/
|
|
106
105
|
exports.obtainCredential = obtainCredential;
|
|
107
106
|
const handleObtainCredentialError = e => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","_dpop","_reactNativeUuid","_interopRequireDefault","obj","__esModule","default","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","context","credentialCryptoContext","appFetch","fetch","dPopCryptoContext","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","containsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","ValidationFailed","message","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuid","v4","ath","sha256ToBase64","access_token","credentialRes","method","headers","DPoP","Authorization","token_type","body","JSON","stringify","then","hasStatusOrThrow","res","json","CredentialResponse","safeParse","catch","handleObtainCredentialError","success","reason","error","data","e","UnexpectedStatusCodeError","ResponseErrorBuilder","IssuerResponseError","handle","code","IssuerResponseErrorCodes","CredentialIssuingNotSynchronous","CredentialInvalidStatus","CredentialRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAC,sBAAA,CAAAN,OAAA;AAAqC,SAAAM,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAc9B,MAAMG,gBAAgB,GAAG,MAAAA,CAC9BC,KAAa,EACbC,MAAc,EACdC,QAAgB,EAChBC,GAA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EAAElB,aAAa,CAACmB,KAAK,CAACnC;IAC9B,CAAC,CAAC;EACJ;EAEA,OAAOgB,aAAa,CAACoB,IAAI;AAC3B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","_dpop","_reactNativeUuid","_interopRequireDefault","obj","__esModule","default","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","context","credentialCryptoContext","appFetch","fetch","dPopCryptoContext","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","containsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","ValidationFailed","message","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuid","v4","ath","sha256ToBase64","access_token","credentialRes","method","headers","DPoP","Authorization","token_type","body","JSON","stringify","then","hasStatusOrThrow","res","json","CredentialResponse","safeParse","catch","handleObtainCredentialError","success","reason","error","data","e","UnexpectedStatusCodeError","ResponseErrorBuilder","IssuerResponseError","handle","code","IssuerResponseErrorCodes","CredentialIssuingNotSynchronous","CredentialInvalidStatus","CredentialRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAC,sBAAA,CAAAN,OAAA;AAAqC,SAAAM,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAc9B,MAAMG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B,MAAM,IAAIlC,wBAAgB,CAAC;MACzBC,OAAO,EAAE,uCAAuC;MAChDkC,MAAM,EAAElB,aAAa,CAACmB,KAAK,CAACnC;IAC9B,CAAC,CAAC;EACJ;EAEA,OAAOgB,aAAa,CAACoB,IAAI;AAC3B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA5D,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAMA,MAAMuD,2BAA2B,GAAIK,CAAU,IAAK;EAClD,IAAI,EAAEA,CAAC,YAAYC,iCAAyB,CAAC,EAAE;IAC7C,MAAMD,CAAC;EACT;EAEA,MAAM,IAAIE,4BAAoB,CAACC,2BAAmB,CAAC,CAChDC,MAAM,CAAC,GAAG,EAAE;IACX;IACA;IACAC,IAAI,EAAEC,gCAAwB,CAACC,+BAA+B;IAC9D5C,OAAO,EACL;EACJ,CAAC,CAAC,CACDyC,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,gCAAwB,CAACE,uBAAuB;IACtD7C,OAAO,EAAE;EACX,CAAC,CAAC,CACDyC,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,gCAAwB,CAACE,uBAAuB;IACtD7C,OAAO,EAAE;EACX,CAAC,CAAC,CACDyC,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,gCAAwB,CAACG,uBAAuB;IACtD9C,OAAO,EAAE;EACX,CAAC,CAAC,CACD+C,SAAS,CAACV,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.AuthorizationIdpError = exports.AuthorizationError = void 0;
|
|
7
7
|
var _errors = require("../../utils/errors");
|
|
8
8
|
/**
|
|
9
9
|
* An error subclass thrown when an error occurs during the authorization process.
|
|
@@ -31,22 +31,5 @@ class AuthorizationIdpError extends _errors.IoWalletError {
|
|
|
31
31
|
this.errorDescription = errorDescription;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Error subclass thrown when an operation has been aborted.
|
|
37
|
-
*/
|
|
38
34
|
exports.AuthorizationIdpError = AuthorizationIdpError;
|
|
39
|
-
class OperationAbortedError extends _errors.IoWalletError {
|
|
40
|
-
code = "ERR_IO_WALLET_OPERATION_ABORTED";
|
|
41
|
-
|
|
42
|
-
/** The aborted operation */
|
|
43
|
-
|
|
44
|
-
constructor(operation) {
|
|
45
|
-
super((0, _errors.serializeAttrs)({
|
|
46
|
-
operation
|
|
47
|
-
}));
|
|
48
|
-
this.operation = operation;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.OperationAbortedError = OperationAbortedError;
|
|
52
35
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_errors","require","AuthorizationError","IoWalletError","code","constructor","message","exports","AuthorizationIdpError","error","errorDescription","serializeAttrs"
|
|
1
|
+
{"version":3,"names":["_errors","require","AuthorizationError","IoWalletError","code","constructor","message","exports","AuthorizationIdpError","error","errorDescription","serializeAttrs"],"sourceRoot":"../../../../src","sources":["credential/issuance/errors.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACO,MAAMC,kBAAkB,SAASC,qBAAa,CAAC;EACpDC,IAAI,GAAG,mCAAmC;EAE1CC,WAAWA,CAACC,OAAgB,EAAE;IAC5B,KAAK,CAACA,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AAHAC,OAAA,CAAAL,kBAAA,GAAAA,kBAAA;AAIO,MAAMM,qBAAqB,SAASL,qBAAa,CAAC;EACvDC,IAAI,GAAG,sDAAsD;EAK7DC,WAAWA,CAACI,KAAa,EAAEC,gBAAyB,EAAE;IACpD,KAAK,CAAC,IAAAC,sBAAc,EAAC;MAAEF,KAAK;MAAEC;IAAiB,CAAC,CAAC,CAAC;IAClD,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,gBAAgB,GAAGA,gBAAgB;EAC1C;AACF;AAACH,OAAA,CAAAC,qBAAA,GAAAA,qBAAA"}
|
|
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "authorizeAccess", {
|
|
|
10
10
|
return _authorizeAccess.authorizeAccess;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
+
Object.defineProperty(exports, "buildAuthorizationUrl", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _completeUserAuthorization.buildAuthorizationUrl;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
13
19
|
Object.defineProperty(exports, "completeUserAuthorizationWithFormPostJwtMode", {
|
|
14
20
|
enumerable: true,
|
|
15
21
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_evaluateIssuerTrust","require","_startUserAuthorization","_completeUserAuthorization","_authorizeAccess","_obtainCredential","_verifyAndParseCredential","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_evaluateIssuerTrust","require","_startUserAuthorization","_completeUserAuthorization","_authorizeAccess","_obtainCredential","_verifyAndParseCredential","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
|
|
@@ -17,8 +17,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
* @param credential - The credential to be verified
|
|
18
18
|
* @param credentialCryptoContext - The credential's crypto context
|
|
19
19
|
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
|
20
|
-
* @throws {
|
|
21
|
-
* @throws {@link StatusAttestationError} if an error occurs during the status attestation
|
|
20
|
+
* @throws {IssuerResponseError} with a specific code for more context
|
|
22
21
|
* @returns The credential status attestation
|
|
23
22
|
*/
|
|
24
23
|
const statusAttestation = async function (issuerConf, credential, credentialCryptoContext) {
|
|
@@ -55,8 +54,7 @@ const statusAttestation = async function (issuerConf, credential, credentialCryp
|
|
|
55
54
|
* Handle the status attestation error by mapping it to a custom exception.
|
|
56
55
|
* If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
|
|
57
56
|
* @param e - The error to be handled
|
|
58
|
-
* @throws {
|
|
59
|
-
* @throws {@link CredentialInvalidStatusError} if the status code is 404 (meaning the credential is invalid)
|
|
57
|
+
* @throws {IssuerResponseError} with a specific code for more context
|
|
60
58
|
*/
|
|
61
59
|
exports.statusAttestation = statusAttestation;
|
|
62
60
|
const handleStatusAttestationError = e => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_misc","require","_ioReactNativeJwt","_reactNativeUuid","_interopRequireDefault","_types","_errors","obj","__esModule","default","statusAttestation","issuerConf","credential","credentialCryptoContext","appFetch","arguments","length","undefined","fetch","jwk","getPublicKey","credentialHash","getCredentialHashWithouDiscloures","statusAttUrl","openid_credential_issuer","status_attestation_endpoint","credentialPop","SignJWT","setPayload","aud","jti","uuid","v4","toString","credential_hash","credential_hash_alg","setProtectedHeader","alg","typ","kid","setIssuedAt","setExpirationTime","sign","body","credential_pop","result","method","headers","JSON","stringify","then","hasStatusOrThrow","raw","json","StatusAttestationResponse","parse","catch","handleStatusAttestationError","status_attestation","exports","e","UnexpectedStatusCodeError","ResponseErrorBuilder","IssuerResponseError","handle","code","IssuerResponseErrorCodes","CredentialInvalidStatus","message","StatusAttestationRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/status/02-status-attestation.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAK4B,SAAAG,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAW5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"names":["_misc","require","_ioReactNativeJwt","_reactNativeUuid","_interopRequireDefault","_types","_errors","obj","__esModule","default","statusAttestation","issuerConf","credential","credentialCryptoContext","appFetch","arguments","length","undefined","fetch","jwk","getPublicKey","credentialHash","getCredentialHashWithouDiscloures","statusAttUrl","openid_credential_issuer","status_attestation_endpoint","credentialPop","SignJWT","setPayload","aud","jti","uuid","v4","toString","credential_hash","credential_hash_alg","setProtectedHeader","alg","typ","kid","setIssuedAt","setExpirationTime","sign","body","credential_pop","result","method","headers","JSON","stringify","then","hasStatusOrThrow","raw","json","StatusAttestationResponse","parse","catch","handleStatusAttestationError","status_attestation","exports","e","UnexpectedStatusCodeError","ResponseErrorBuilder","IssuerResponseError","handle","code","IssuerResponseErrorCodes","CredentialInvalidStatus","message","StatusAttestationRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/status/02-status-attestation.ts"],"mappings":";;;;;;AAA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MmB,MAAM,GAAG,MAAM/B,QAAQ,CAACS,YAAY,EAAE;IAC1CuB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE;IAClB,CAAC;IACDJ,IAAI,EAAEK,IAAI,CAACC,SAAS,CAACN,IAAI;EAC3B,CAAC,CAAC,CACCO,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,CAAC,CAAC,CAC3BD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAEG,IAAI,IAAKC,gCAAyB,CAACC,KAAK,CAACF,IAAI,CAAC,CAAC,CACrDG,KAAK,CAACC,4BAA4B,CAAC;EAEtC,OAAO;IAAE/C,iBAAiB,EAAEmC,MAAM,CAACa;EAAmB,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALAC,OAAA,CAAAjD,iBAAA,GAAAA,iBAAA;AAMA,MAAM+C,4BAA4B,GAAIG,CAAU,IAAK;EACnD,IAAI,EAAEA,CAAC,YAAYC,iCAAyB,CAAC,EAAE;IAC7C,MAAMD,CAAC;EACT;EAEA,MAAM,IAAIE,4BAAoB,CAACC,2BAAmB,CAAC,CAChDC,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,gCAAwB,CAACC,uBAAuB;IACtDC,OAAO,EAAE;EACX,CAAC,CAAC,CACDJ,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,gCAAwB,CAACG,8BAA8B;IAC7DD,OAAO,EAAG;EACZ,CAAC,CAAC,CACDE,SAAS,CAACV,CAAC,CAAC;AACjB,CAAC"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "AuthorizationDetails", {
|
|
|
15
15
|
return _par.AuthorizationDetails;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
exports.WalletInstanceAttestation = exports.WalletInstance = exports.Trust = exports.SdJwt = exports.PID = exports.Errors = exports.Credential =
|
|
18
|
+
exports.WalletInstanceAttestation = exports.WalletInstance = exports.Trust = exports.SdJwt = exports.PID = exports.Errors = exports.Credential = void 0;
|
|
19
19
|
Object.defineProperty(exports, "createCryptoContextFor", {
|
|
20
20
|
enumerable: true,
|
|
21
21
|
get: function () {
|
|
@@ -44,8 +44,6 @@ var Trust = _interopRequireWildcard(require("./trust"));
|
|
|
44
44
|
exports.Trust = Trust;
|
|
45
45
|
var WalletInstance = _interopRequireWildcard(require("./wallet-instance"));
|
|
46
46
|
exports.WalletInstance = WalletInstance;
|
|
47
|
-
var Cie = _interopRequireWildcard(require("./cie"));
|
|
48
|
-
exports.Cie = Cie;
|
|
49
47
|
var _par = require("./utils/par");
|
|
50
48
|
var _crypto = require("./utils/crypto");
|
|
51
49
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_jwk","require","Credential","_interopRequireWildcard","exports","PID","SdJwt","Errors","WalletInstanceAttestation","Trust","WalletInstance","
|
|
1
|
+
{"version":3,"names":["_jwk","require","Credential","_interopRequireWildcard","exports","PID","SdJwt","Errors","WalletInstanceAttestation","Trust","WalletInstance","_par","_crypto","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAGAA,OAAA;AAEA,IAAAC,UAAA,GAAAC,uBAAA,CAAAF,OAAA;AAA2CG,OAAA,CAAAF,UAAA,GAAAA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AAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.safeJsonParse = exports.parseRawHttpResponse = exports.hasStatusOrThrow = exports.getCredentialHashWithouDiscloures = exports.generateRandomAlphaNumericString = void 0;
|
|
7
7
|
var _errors = require("./errors");
|
|
8
8
|
var _jsSha = require("js-sha256");
|
|
9
9
|
/**
|
|
@@ -26,9 +26,18 @@ const hasStatusOrThrow = (status, customError) => async res => {
|
|
|
26
26
|
return res;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Utility function to parse a raw HTTP response as JSON if supported, otherwise as text.
|
|
31
|
+
*/
|
|
32
|
+
exports.hasStatusOrThrow = hasStatusOrThrow;
|
|
33
|
+
const parseRawHttpResponse = response => {
|
|
34
|
+
var _response$headers$get;
|
|
35
|
+
return (_response$headers$get = response.headers.get("content-type")) !== null && _response$headers$get !== void 0 && _response$headers$get.includes("application/json") ? response.json() : response.text();
|
|
36
|
+
};
|
|
37
|
+
|
|
29
38
|
// extract a type from an async function output
|
|
30
39
|
// helpful to bind the input of a function to the output of another
|
|
31
|
-
exports.
|
|
40
|
+
exports.parseRawHttpResponse = parseRawHttpResponse;
|
|
32
41
|
/**
|
|
33
42
|
* TODO [SIW-1310]: replace this function with a cryptographically secure one.
|
|
34
43
|
* @param size - The size of the string to generate
|
|
@@ -36,39 +45,13 @@ exports.hasStatusOrThrow = hasStatusOrThrow;
|
|
|
36
45
|
*/
|
|
37
46
|
const generateRandomAlphaNumericString = size => Array.from(Array(size), () => Math.floor(Math.random() * 36).toString(36)).join("");
|
|
38
47
|
|
|
39
|
-
/**
|
|
40
|
-
* Repeatedly checks a condition function until it returns true,
|
|
41
|
-
* then resolves the returned promise. If the condition function does not return true
|
|
42
|
-
* within the specified timeout, the promise is rejected.
|
|
43
|
-
*
|
|
44
|
-
* @param conditionFunction - A function that returns a boolean value.
|
|
45
|
-
* The promise resolves when this function returns true.
|
|
46
|
-
* @param timeout - An optional timeout in seconds. The promise is rejected if the
|
|
47
|
-
* condition function does not return true within this time.
|
|
48
|
-
* @returns A promise that resolves once the conditionFunction returns true or rejects if timed out.
|
|
49
|
-
*/
|
|
50
|
-
exports.generateRandomAlphaNumericString = generateRandomAlphaNumericString;
|
|
51
|
-
const until = (conditionFunction, timeoutSeconds) => new Promise((resolve, reject) => {
|
|
52
|
-
const start = Date.now();
|
|
53
|
-
const poll = () => {
|
|
54
|
-
if (conditionFunction()) {
|
|
55
|
-
resolve();
|
|
56
|
-
} else if (timeoutSeconds !== undefined && Date.now() - start >= timeoutSeconds * 1000) {
|
|
57
|
-
reject(new Error("Timeout exceeded"));
|
|
58
|
-
} else {
|
|
59
|
-
setTimeout(poll, 400);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
poll();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
48
|
/**
|
|
66
49
|
* Get the hash of a credential without discloures.
|
|
67
50
|
* A credential is a string like `header.body.sign~sd1~sd2....` where `~` is the separator between the credential and the discloures.
|
|
68
51
|
* @param credential - The credential to hash
|
|
69
52
|
* @returns The hash of the credential without discloures
|
|
70
53
|
*/
|
|
71
|
-
exports.
|
|
54
|
+
exports.generateRandomAlphaNumericString = generateRandomAlphaNumericString;
|
|
72
55
|
const getCredentialHashWithouDiscloures = async credential => {
|
|
73
56
|
const tildeIndex = credential.indexOf("~");
|
|
74
57
|
if (tildeIndex === -1) {
|
|
@@ -76,35 +59,13 @@ const getCredentialHashWithouDiscloures = async credential => {
|
|
|
76
59
|
}
|
|
77
60
|
return (0, _jsSha.sha256)(credential.slice(0, tildeIndex));
|
|
78
61
|
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Creates a promise that waits until the provided signal is aborted.
|
|
82
|
-
* @returns {Object} An object with `listen` and `remove` methods to handle subscribing and unsubscribing.
|
|
83
|
-
*/
|
|
84
62
|
exports.getCredentialHashWithouDiscloures = getCredentialHashWithouDiscloures;
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
listener = () => resolve("OPERATION_ABORTED");
|
|
93
|
-
signal.addEventListener("abort", listener);
|
|
94
|
-
}),
|
|
95
|
-
remove: () => signal.removeEventListener("abort", listener)
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
exports.createAbortPromiseFromSignal = createAbortPromiseFromSignal;
|
|
99
|
-
const isDefined = x => Boolean(x);
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Utility function to parse a raw HTTP response as JSON if supported, otherwise as text.
|
|
103
|
-
*/
|
|
104
|
-
exports.isDefined = isDefined;
|
|
105
|
-
const parseRawHttpResponse = response => {
|
|
106
|
-
var _response$headers$get;
|
|
107
|
-
return (_response$headers$get = response.headers.get("content-type")) !== null && _response$headers$get !== void 0 && _response$headers$get.includes("application/json") ? response.json() : response.text();
|
|
63
|
+
const safeJsonParse = (text, withDefault) => {
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(text);
|
|
66
|
+
} catch (_) {
|
|
67
|
+
return withDefault ?? null;
|
|
68
|
+
}
|
|
108
69
|
};
|
|
109
|
-
exports.
|
|
70
|
+
exports.safeJsonParse = safeJsonParse;
|
|
110
71
|
//# sourceMappingURL=misc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_errors","require","_jsSha","hasStatusOrThrow","status","customError","res","ErrorClass","UnexpectedStatusCodeError","message","url","statusCode","reason","parseRawHttpResponse","exports","
|
|
1
|
+
{"version":3,"names":["_errors","require","_jsSha","hasStatusOrThrow","status","customError","res","ErrorClass","UnexpectedStatusCodeError","message","url","statusCode","reason","parseRawHttpResponse","exports","response","_response$headers$get","headers","get","includes","json","text","generateRandomAlphaNumericString","size","Array","from","Math","floor","random","toString","join","getCredentialHashWithouDiscloures","credential","tildeIndex","indexOf","IoWalletError","sha256","slice","safeJsonParse","withDefault","JSON","parse","_"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,gBAAgB,GAC3BA,CAACC,MAAc,EAAEC,WAA8C,KAC/D,MAAOC,GAAa,IAAwB;EAC1C,IAAIA,GAAG,CAACF,MAAM,KAAKA,MAAM,EAAE;IACzB,MAAMG,UAAU,GAAGF,WAAW,IAAIG,iCAAyB;IAC3D,MAAM,IAAID,UAAU,CAAC;MACnBE,OAAO,EAAG,iCAAgCL,MAAO,SAAQE,GAAG,CAACF,MAAO,UAASE,GAAG,CAACI,GAAI,EAAC;MACtFC,UAAU,EAAEL,GAAG,CAACF,MAAM;MACtBQ,MAAM,EAAE,MAAMC,oBAAoB,CAACP,GAAG,CAAC,CAAE;IAC3C,CAAC,CAAC;EACJ;;EACA,OAAOA,GAAG;AACZ,CAAC;;AAEH;AACA;AACA;AAFAQ,OAAA,CAAAX,gBAAA,GAAAA,gBAAA;AAGO,MAAMU,oBAAoB,GAC/BE,QAAkB;EAAA,IAAAC,qBA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aAAA"}
|
|
@@ -59,8 +59,7 @@ async function getAttestationRequest(challenge, wiaCryptoContext, integrityConte
|
|
|
59
59
|
* @param params.appFetch (optional) Http client
|
|
60
60
|
* @param walletProviderBaseUrl Base url for the Wallet Provider
|
|
61
61
|
* @returns The retrieved Wallet Instance Attestation token
|
|
62
|
-
* @throws {
|
|
63
|
-
* @throws {WalletInstanceNotFoundError} The Wallet Instance does not exist
|
|
62
|
+
* @throws {WalletProviderResponseError} with a specific code for more context
|
|
64
63
|
*/
|
|
65
64
|
const getAttestation = async _ref => {
|
|
66
65
|
let {
|