@pagopa/io-react-native-wallet 0.24.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/client/generated/wallet-provider.js +39 -16
- package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
- package/lib/commonjs/client/index.js +25 -10
- package/lib/commonjs/client/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +21 -14
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +5 -2
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +26 -17
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/README.md +8 -14
- package/lib/commonjs/credential/issuance/errors.js +52 -0
- package/lib/commonjs/credential/issuance/errors.js.map +1 -0
- package/lib/commonjs/credential/issuance/index.js +7 -2
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/types.js +1 -5
- package/lib/commonjs/credential/issuance/types.js.map +1 -1
- package/lib/commonjs/credential/presentation/01-start-flow.js +1 -1
- package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/commonjs/credential/presentation/03-get-request-object.js +2 -2
- package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/04-send-authorization-response.js +2 -2
- package/lib/commonjs/credential/presentation/04-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/errors.js +49 -0
- package/lib/commonjs/credential/presentation/errors.js.map +1 -0
- package/lib/commonjs/credential/presentation/index.js +5 -0
- package/lib/commonjs/credential/presentation/index.js.map +1 -1
- package/lib/commonjs/credential/status/02-status-attestation.js +8 -6
- package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -1
- package/lib/commonjs/credential/status/README.md +5 -2
- package/lib/commonjs/credential/status/types.js +1 -14
- package/lib/commonjs/credential/status/types.js.map +1 -1
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +14 -5
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -1
- package/lib/commonjs/sd-jwt/errors.js +40 -0
- package/lib/commonjs/sd-jwt/errors.js.map +1 -0
- package/lib/commonjs/sd-jwt/index.js +8 -4
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/verifier.js +5 -1
- package/lib/commonjs/sd-jwt/verifier.js.map +1 -1
- package/lib/commonjs/trust/index.js +2 -2
- package/lib/commonjs/trust/index.js.map +1 -1
- package/lib/commonjs/utils/decoder.js +3 -1
- package/lib/commonjs/utils/decoder.js.map +1 -1
- package/lib/commonjs/utils/error-codes.js +51 -0
- package/lib/commonjs/utils/error-codes.js.map +1 -0
- package/lib/commonjs/utils/errors.js +119 -463
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/commonjs/utils/misc.js +21 -14
- package/lib/commonjs/utils/misc.js.map +1 -1
- package/lib/commonjs/utils/par.js +2 -1
- package/lib/commonjs/utils/par.js.map +1 -1
- package/lib/commonjs/wallet-instance/README.md +26 -5
- package/lib/commonjs/wallet-instance/index.js +33 -7
- package/lib/commonjs/wallet-instance/index.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/README.md +8 -2
- package/lib/commonjs/wallet-instance-attestation/issuing.js +13 -10
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/client/generated/wallet-provider.js +31 -11
- package/lib/module/client/generated/wallet-provider.js.map +1 -1
- package/lib/module/client/index.js +22 -8
- package/lib/module/client/index.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 +16 -9
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +7 -4
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +29 -20
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/README.md +8 -14
- package/lib/module/credential/issuance/errors.js +44 -0
- package/lib/module/credential/issuance/errors.js.map +1 -0
- package/lib/module/credential/issuance/index.js +3 -2
- package/lib/module/credential/issuance/index.js.map +1 -1
- package/lib/module/credential/issuance/types.js +0 -3
- package/lib/module/credential/issuance/types.js.map +1 -1
- package/lib/module/credential/presentation/01-start-flow.js +1 -1
- package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/module/credential/presentation/03-get-request-object.js +3 -3
- package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/module/credential/presentation/04-send-authorization-response.js +3 -3
- package/lib/module/credential/presentation/04-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/errors.js +42 -0
- package/lib/module/credential/presentation/errors.js.map +1 -0
- package/lib/module/credential/presentation/index.js +2 -1
- package/lib/module/credential/presentation/index.js.map +1 -1
- package/lib/module/credential/status/02-status-attestation.js +11 -9
- package/lib/module/credential/status/02-status-attestation.js.map +1 -1
- package/lib/module/credential/status/README.md +5 -2
- package/lib/module/credential/status/types.js +0 -12
- package/lib/module/credential/status/types.js.map +1 -1
- package/lib/module/credential/trustmark/get-credential-trustmark.js +14 -5
- package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -1
- package/lib/module/sd-jwt/errors.js +32 -0
- package/lib/module/sd-jwt/errors.js.map +1 -0
- package/lib/module/sd-jwt/index.js +5 -5
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/sd-jwt/verifier.js +5 -1
- package/lib/module/sd-jwt/verifier.js.map +1 -1
- package/lib/module/trust/index.js +3 -3
- package/lib/module/trust/index.js.map +1 -1
- package/lib/module/utils/decoder.js +3 -1
- package/lib/module/utils/decoder.js.map +1 -1
- package/lib/module/utils/error-codes.js +43 -0
- package/lib/module/utils/error-codes.js.map +1 -0
- package/lib/module/utils/errors.js +98 -438
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/module/utils/misc.js +18 -11
- package/lib/module/utils/misc.js.map +1 -1
- package/lib/module/utils/par.js +3 -2
- package/lib/module/utils/par.js.map +1 -1
- package/lib/module/wallet-instance/README.md +26 -5
- package/lib/module/wallet-instance/index.js +32 -7
- package/lib/module/wallet-instance/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/README.md +8 -2
- package/lib/module/wallet-instance-attestation/issuing.js +15 -12
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/typescript/client/generated/wallet-provider.d.ts +138 -27
- package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
- package/lib/typescript/client/index.d.ts +7 -1
- package/lib/typescript/client/index.d.ts.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 +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.map +1 -1
- package/lib/typescript/credential/issuance/errors.d.ts +28 -0
- package/lib/typescript/credential/issuance/errors.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/index.d.ts +3 -2
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/types.d.ts +0 -8
- package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/04-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/errors.d.ts +25 -0
- package/lib/typescript/credential/presentation/errors.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/index.d.ts +2 -1
- package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
- package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -1
- package/lib/typescript/credential/status/types.d.ts +0 -15
- package/lib/typescript/credential/status/types.d.ts.map +1 -1
- package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +4 -2
- package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/errors.d.ts +20 -0
- package/lib/typescript/sd-jwt/errors.d.ts.map +1 -0
- package/lib/typescript/sd-jwt/index.d.ts +3 -2
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/utils/error-codes.d.ts +45 -0
- package/lib/typescript/utils/error-codes.d.ts.map +1 -0
- package/lib/typescript/utils/errors.d.ts +88 -225
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/misc.d.ts +9 -4
- 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 +17 -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/lib/typescript/wallet-instance-attestation/types.d.ts +4 -4
- package/package.json +1 -1
- package/src/client/generated/wallet-provider.ts +43 -13
- package/src/client/index.ts +28 -15
- package/src/credential/issuance/03-start-user-authorization.ts +1 -1
- package/src/credential/issuance/04-complete-user-authorization.ts +21 -21
- package/src/credential/issuance/05-authorize-access.ts +7 -4
- package/src/credential/issuance/06-obtain-credential.ts +39 -39
- package/src/credential/issuance/README.md +8 -14
- package/src/credential/issuance/errors.ts +44 -0
- package/src/credential/issuance/index.ts +4 -2
- package/src/credential/issuance/types.ts +0 -8
- package/src/credential/presentation/01-start-flow.ts +1 -1
- package/src/credential/presentation/03-get-request-object.ts +3 -3
- package/src/credential/presentation/04-send-authorization-response.ts +3 -3
- package/src/credential/presentation/errors.ts +41 -0
- package/src/credential/presentation/index.ts +2 -0
- package/src/credential/status/02-status-attestation.ts +17 -25
- package/src/credential/status/README.md +5 -2
- package/src/credential/status/types.ts +0 -15
- package/src/credential/trustmark/get-credential-trustmark.ts +13 -4
- package/src/sd-jwt/errors.ts +39 -0
- package/src/sd-jwt/index.ts +5 -8
- package/src/sd-jwt/verifier.ts +5 -5
- package/src/trust/index.ts +3 -3
- package/src/utils/decoder.ts +3 -3
- package/src/utils/error-codes.ts +50 -0
- package/src/utils/errors.ts +152 -476
- package/src/utils/misc.ts +20 -17
- package/src/utils/par.ts +3 -2
- package/src/wallet-instance/README.md +26 -5
- package/src/wallet-instance/index.ts +40 -18
- package/src/wallet-instance-attestation/README.md +8 -2
- package/src/wallet-instance-attestation/issuing.ts +28 -36
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["serializeAttrs","attrs","Object","entries","map","_ref","k","v","Array","isArray","join","_","exports","IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","UnexpectedStatusCodeError","statusCode","responseBody","toString","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","ClaimsNotFoundInToken","NoSuitableKeysFoundInEntityConfiguration","scenario","PidMetadataError","WalletProviderResponseError","WalletInstanceRevokedError","WalletInstanceNotFoundError","WalletInstanceIntegrityFailedError","WalletInstanceCreationError","WalletInstanceCreationIntegrityError","AuthorizationError","AuthorizationIdpError","error","errorDescription","OperationAbortedError","operation","CredentialInvalidStatusError","errorCode","StatusAttestationError","CredentialRequestError","CredentialIssuingNotSynchronousError","extractErrorMessageFromIssuerConf","_ref2","issuerConf","credentialType","credentialConfiguration","openid_credential_issuer","credential_configurations_supported","issuance_errors_supported","localesList","display","reduce","acc","_ref3","locale","rest"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,GACzBC,KAAsC,IAEtCC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,GAAG,CAACC,IA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MAAMqC,WAAW,GAAGD,yBAAyB,CAACX,SAAS,CAAC,CAAEa,OAAO;EAEjE,OAAOD,WAAW,CAACE,MAAM,CACvB,CAACC,GAAG,EAAAC,KAAA;IAAA,IAAE;MAAEC,MAAM;MAAE,GAAGC;IAAK,CAAC,GAAAF,KAAA;IAAA,OAAM;MAAE,GAAGD,GAAG;MAAE,CAACE,MAAM,GAAGC;IAAK,CAAC;EAAA,CAAC,EAC1D,CAAC,CACH,CAAC;AACH"}
|
1
|
+
{"version":3,"names":["_errorCodes","require","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","exports","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerResponseErrorCodes","IssuerGenericError","WalletProviderResponseError","WalletProviderResponseErrorCodes","WalletProviderGenericError","extractErrorMessageFromIssuerConf","errorCode","_ref5","issuerConf","credentialType","credentialConfiguration","openid_credential_issuer","credential_configurations_supported","issuance_errors_supported","localesList","display","reduce","acc","_ref6","locale","rest","isIssuerResponseError","error","isWalletProviderResponseError","ResponseErrorBuilder","errorCases","ErrorClass","handle","status","buildFrom","originalError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,WAAA,GAAAC,OAAA;AASA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,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,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UAAU,CAACG,MAAM,CAAC,GAAG7B,MAAM;IAChC,OAAO,IAAI;EACb;EAEA8B,SAASA,CAACC,aAAwC,EAAE;IAClD,MAAM/B,MAAM,GACV,IAAI,CAAC0B,UAAU,CAACK,aAAa,CAACjC,UAAU,CAAC,IAAI,IAAI,CAAC4B,UAAU,CAAC,GAAG,CAAC;IAEnE,IAAI1B,MAAM,EAAE;MACV,OAAO,IAAI,IAAI,CAAC2B,UAAU,CAAC;QAAE,GAAGI,aAAa;QAAE,GAAG/B;MAAO,CAAC,CAAC;IAC7D;IAEA,OAAO+B,aAAa;EACtB;AACF;AAAC9C,OAAA,CAAAwC,oBAAA,GAAAA,oBAAA"}
|
@@ -3,26 +3,32 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.until = exports.
|
6
|
+
exports.until = exports.parseRawHttpResponse = exports.isDefined = exports.hasStatusOrThrow = exports.getCredentialHashWithouDiscloures = exports.generateRandomAlphaNumericString = exports.createAbortPromiseFromSignal = void 0;
|
7
7
|
var _errors = require("./errors");
|
8
8
|
var _jsSha = require("js-sha256");
|
9
9
|
/**
|
10
|
-
* Check if a response is in the expected status,
|
10
|
+
* Check if a response is in the expected status, otherwise throw an error
|
11
11
|
* @param status - The expected status
|
12
|
-
* @
|
12
|
+
* @param customError - A custom error compatible with {@link UnexpectedStatusCodeError}
|
13
|
+
* @throws UnexpectedStatusCodeError if the status is different from the one expected
|
13
14
|
* @returns The given response object
|
14
15
|
*/
|
15
|
-
const
|
16
|
+
const hasStatusOrThrow = (status, customError) => async res => {
|
16
17
|
if (res.status !== status) {
|
17
|
-
const
|
18
|
-
throw new
|
18
|
+
const ErrorClass = customError ?? _errors.UnexpectedStatusCodeError;
|
19
|
+
throw new ErrorClass({
|
20
|
+
message: `Http request failed. Expected ${status}, got ${res.status}, url: ${res.url}`,
|
21
|
+
statusCode: res.status,
|
22
|
+
reason: await parseRawHttpResponse(res) // Pass the response body as reason so the original error can surface
|
23
|
+
});
|
19
24
|
}
|
25
|
+
|
20
26
|
return res;
|
21
27
|
};
|
22
28
|
|
23
29
|
// extract a type from an async function output
|
24
30
|
// helpful to bind the input of a function to the output of another
|
25
|
-
exports.
|
31
|
+
exports.hasStatusOrThrow = hasStatusOrThrow;
|
26
32
|
/**
|
27
33
|
* TODO [SIW-1310]: replace this function with a cryptographically secure one.
|
28
34
|
* @param size - The size of the string to generate
|
@@ -91,13 +97,14 @@ const createAbortPromiseFromSignal = signal => {
|
|
91
97
|
};
|
92
98
|
exports.createAbortPromiseFromSignal = createAbortPromiseFromSignal;
|
93
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
|
+
*/
|
94
104
|
exports.isDefined = isDefined;
|
95
|
-
const
|
96
|
-
|
97
|
-
|
98
|
-
} catch (_) {
|
99
|
-
return withDefault ?? null;
|
100
|
-
}
|
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();
|
101
108
|
};
|
102
|
-
exports.
|
109
|
+
exports.parseRawHttpResponse = parseRawHttpResponse;
|
103
110
|
//# sourceMappingURL=misc.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_errors","require","_jsSha","
|
1
|
+
{"version":3,"names":["_errors","require","_jsSha","hasStatusOrThrow","status","customError","res","ErrorClass","UnexpectedStatusCodeError","message","url","statusCode","reason","parseRawHttpResponse","exports","generateRandomAlphaNumericString","size","Array","from","Math","floor","random","toString","join","until","conditionFunction","timeoutSeconds","Promise","resolve","reject","start","Date","now","poll","undefined","Error","setTimeout","getCredentialHashWithouDiscloures","credential","tildeIndex","indexOf","IoWalletError","sha256","slice","createAbortPromiseFromSignal","signal","listener","listen","aborted","addEventListener","remove","removeEventListener","isDefined","x","Boolean","response","_response$headers$get","headers","get","includes","json","text"],"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;AAAAQ,OAAA,CAAAX,gBAAA,GAAAA,gBAAA;AAOA;AACA;AACA;AACA;AACA;AACO,MAAMY,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;AACA;AACA;AACA;AACA;AAVAT,OAAA,CAAAC,gCAAA,GAAAA,gCAAA;AAWO,MAAMS,KAAK,GAAGA,CACnBC,iBAAgC,EAChCC,cAAuB,KAEvB,IAAIC,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;EACrC,MAAMC,KAAK,GAAGC,IAAI,CAACC,GAAG,CAAC,C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I,MAAM,EAAEA,CAAA,KAAML,MAAM,CAACM,mBAAmB,CAAC,OAAO,EAAEL,QAAQ;EAC5D,CAAC;AACH,CAAC;AAAChC,OAAA,CAAA8B,4BAAA,GAAAA,4BAAA;AAEK,MAAMQ,SAAS,GAAOC,CAA4B,IACvDC,OAAO,CAACD,CAAC,CAAC;;AAEZ;AACA;AACA;AAFAvC,OAAA,CAAAsC,SAAA,GAAAA,SAAA;AAGO,MAAMvC,oBAAoB,GAC/B0C,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;AAAC/C,OAAA,CAAAD,oBAAA,GAAAA,oBAAA"}
|
@@ -10,6 +10,7 @@ var z = _interopRequireWildcard(require("zod"));
|
|
10
10
|
var WalletInstanceAttestation = _interopRequireWildcard(require("../wallet-instance-attestation"));
|
11
11
|
var _misc = require("./misc");
|
12
12
|
var _pop = require("./pop");
|
13
|
+
var _errors = require("./errors");
|
13
14
|
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); }
|
14
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -87,7 +88,7 @@ const makeParRequest = _ref => {
|
|
87
88
|
"Content-Type": "application/x-www-form-urlencoded"
|
88
89
|
},
|
89
90
|
body: formBody.toString()
|
90
|
-
}).then((0, _misc.
|
91
|
+
}).then((0, _misc.hasStatusOrThrow)(201, _errors.IssuerResponseError)).then(res => res.json()).then(result => result.request_uri);
|
91
92
|
};
|
92
93
|
};
|
93
94
|
exports.makeParRequest = makeParRequest;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","z","_interopRequireWildcard","WalletInstanceAttestation","_misc","_pop","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationDetail","object","credential_configuration_id","string","format","union","literal","type","exports","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","createPopToken","jti","uuid","v4","codeChallengeMethod","codeChallenge","sha256ToBase64","signedJwtForPar","SignJWT","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","generateRandomAlphaNumericString","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","
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","z","_interopRequireWildcard","WalletInstanceAttestation","_misc","_pop","_errors","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationDetail","object","credential_configuration_id","string","format","union","literal","type","exports","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","createPopToken","jti","uuid","v4","codeChallengeMethod","codeChallenge","sha256ToBase64","signedJwtForPar","SignJWT","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","generateRandomAlphaNumericString","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","hasStatusOrThrow","IssuerResponseError","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAKA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,CAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAA+C,SAAAS,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD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,CAAEG,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBJ,IAAI,CAAEK,MAAM,IAAKA,MAAM,CAACC,WAAW,CAAC;EACzC,CAAC;AAAA;AAACpE,OAAA,CAAAG,cAAA,GAAAA,cAAA"}
|
@@ -6,7 +6,8 @@ The suggested way to implement this service is to use [io-react-native-integrity
|
|
6
6
|
|
7
7
|
The following methods are available:
|
8
8
|
- `createWalletInstance` creates a new wallet instance;
|
9
|
-
- `
|
9
|
+
- `revokeWalletInstance` revokes a wallet instance by ID;
|
10
|
+
- `getWalletInstanceStatus` fetches the status of a wallet instance by ID without the need to require an attestation.
|
10
11
|
|
11
12
|
Examples are provided as follows:
|
12
13
|
|
@@ -35,12 +36,29 @@ return integrityKeyTag;
|
|
35
36
|
|
36
37
|
The returned `integrityKeyTag` is supposed to be stored and used to verify the integrity of the device in the future when using an `IntegrityContext` object. It must be regenerated if another wallet instance is created.
|
37
38
|
|
38
|
-
### Wallet
|
39
|
+
### Wallet Instance revocation
|
40
|
+
|
41
|
+
Revoke a Wallet Instance by ID. The ID matches the hardware/integrity key tag used for creation.
|
42
|
+
|
43
|
+
```ts
|
44
|
+
const { WALLET_PROVIDER_BASE_URL } = env;
|
45
|
+
|
46
|
+
await WalletInstance.revokeWalletInstance({
|
47
|
+
id: "495e5bec-b93f-4fd7-952a-94b27233abdb"
|
48
|
+
walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
|
49
|
+
appFetch,
|
50
|
+
});
|
51
|
+
|
52
|
+
```
|
53
|
+
### Wallet Instance status
|
54
|
+
|
55
|
+
Get the status of a Wallet Instance by ID. The ID matches the hardware/integrity key tag used for creation.
|
39
56
|
|
40
57
|
```ts
|
41
58
|
const { WALLET_PROVIDER_BASE_URL } = env;
|
42
59
|
|
43
|
-
await WalletInstance.
|
60
|
+
const status = await WalletInstance.getWalletInstanceStatus({
|
61
|
+
id: "495e5bec-b93f-4fd7-952a-94b27233abdb"
|
44
62
|
walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
|
45
63
|
appFetch,
|
46
64
|
});
|
@@ -48,6 +66,9 @@ await WalletInstance.revokeCurrentWalletInstance({
|
|
48
66
|
|
49
67
|
## Mapped results
|
50
68
|
|
51
|
-
|
69
|
+
The following errors are mapped to a `WalletProviderResponseError` with specific codes.
|
52
70
|
|
53
|
-
|
71
|
+
|HTTP Status|Error Code|Description|
|
72
|
+
|-----------|----------|-----------|
|
73
|
+
|`409 Conflict`|`ERR_IO_WALLET_INSTANCE_INTEGRITY_FAILED`|This response is returned by the wallet provider when an integrity check fails.|
|
74
|
+
|`*`|`ERR_IO_WALLET_PROVIDER_GENERIC_ERROR`|This is a generic error code to map unexpected errors that occurred when interacting with the Wallet Provider.|
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createWalletInstance = createWalletInstance;
|
7
|
-
exports.
|
7
|
+
exports.getWalletInstanceStatus = getWalletInstanceStatus;
|
8
|
+
exports.revokeWalletInstance = revokeWalletInstance;
|
8
9
|
var _client = require("../client");
|
9
10
|
var _errors = require("../utils/errors");
|
10
11
|
async function createWalletInstance(context) {
|
@@ -32,17 +33,42 @@ const handleCreateWalletInstanceError = e => {
|
|
32
33
|
if (!(e instanceof _errors.WalletProviderResponseError)) {
|
33
34
|
throw e;
|
34
35
|
}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
throw new _errors.ResponseErrorBuilder(_errors.WalletProviderResponseError).handle(409, {
|
37
|
+
code: _errors.WalletProviderResponseErrorCodes.WalletInstanceIntegrityFailed,
|
38
|
+
message: "Unable to create a wallet instance with a device that failed the integrity check"
|
39
|
+
}).handle("*", {
|
40
|
+
code: _errors.WalletProviderResponseErrorCodes.WalletInstanceCreationFailed,
|
41
|
+
message: "Unable to create wallet instance"
|
42
|
+
}).buildFrom(e);
|
39
43
|
};
|
40
|
-
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Revoke a Wallet Instance by ID.
|
47
|
+
* @param context.id The Wallet Instance ID. It matches the hardware key tag used for creation.
|
48
|
+
*/
|
49
|
+
async function revokeWalletInstance(context) {
|
41
50
|
const api = (0, _client.getWalletProviderClient)(context);
|
42
|
-
await api.put("/wallet-instances/
|
51
|
+
await api.put("/wallet-instances/{id}/status", {
|
52
|
+
path: {
|
53
|
+
id: context.id
|
54
|
+
},
|
43
55
|
body: {
|
44
56
|
status: "REVOKED"
|
45
57
|
}
|
46
58
|
});
|
47
59
|
}
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Get the status of a Wallet Instance by ID.
|
63
|
+
* @param context.id The Wallet Instance ID. It matches the hardware key tag used for creation.
|
64
|
+
* @returns Details on the status of the Wallet Instance
|
65
|
+
*/
|
66
|
+
async function getWalletInstanceStatus(context) {
|
67
|
+
const api = (0, _client.getWalletProviderClient)(context);
|
68
|
+
return api.get("/wallet-instances/{id}/status", {
|
69
|
+
path: {
|
70
|
+
id: context.id
|
71
|
+
}
|
72
|
+
});
|
73
|
+
}
|
48
74
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_client","require","_errors","createWalletInstance","context","integrityContext","api","getWalletProviderClient","challenge","get","then","response","nonce","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag","catch","handleCreateWalletInstanceError","e","WalletProviderResponseError","
|
1
|
+
{"version":3,"names":["_client","require","_errors","createWalletInstance","context","integrityContext","api","getWalletProviderClient","challenge","get","then","response","nonce","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag","catch","handleCreateWalletInstanceError","e","WalletProviderResponseError","ResponseErrorBuilder","handle","code","WalletProviderResponseErrorCodes","WalletInstanceIntegrityFailed","message","WalletInstanceCreationFailed","buildFrom","revokeWalletInstance","put","path","id","status","getWalletInstanceStatus"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],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IAAAC,+BAAuB,EAACH,OAAO,CAAC;EAE5C,MAAME,GAAG,CAAC4B,GAAG,CAAC,+BAA+B,EAAE;IAC7CC,IAAI,EAAE;MAAEC,EAAE,EAAEhC,OAAO,CAACgC;IAAG,CAAC;IACxBlB,IAAI,EAAE;MAAEmB,MAAM,EAAE;IAAU;EAC5B,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACO,eAAeC,uBAAuBA,CAAClC,OAI7C,EAA+B;EAC9B,MAAME,GAAG,GAAG,IAAAC,+BAAuB,EAACH,OAAO,CAAC;EAE5C,OAAOE,GAAG,CAACG,GAAG,CAAC,+BAA+B,EAAE;IAC9C0B,IAAI,EAAE;MAAEC,EAAE,EAAEhC,OAAO,CAACgC;IAAG;EACzB,CAAC,CAAC;AACJ"}
|
@@ -36,6 +36,12 @@ The returned `issuedAttestation` is supposed to be stored and used for any futur
|
|
36
36
|
|
37
37
|
## Mapped results
|
38
38
|
|
39
|
-
|
39
|
+
The following errors are mapped to a `WalletProviderResponseError` with specific codes.
|
40
|
+
|
41
|
+
|HTTP Status|Error Code|Description|
|
42
|
+
|-----------|----------|-----------|
|
43
|
+
|`403 Forbidden`|`ERR_IO_WALLET_INSTANCE_REVOKED`|This response is returned by the wallet provider when the wallet instance has been revoked.|
|
44
|
+
|`404 Not Found`|`ERR_IO_WALLET_INSTANCE_NOT_FOUND`|This response is returned by the wallet provider when the wallet instance does not exist.|
|
45
|
+
|`409 Conflict`|`ERR_IO_WALLET_INSTANCE_INTEGRITY_FAILED`|This response is returned by the wallet provider when an integrity check fails.|
|
46
|
+
|`*`|`ERR_IO_WALLET_PROVIDER_GENERIC_ERROR`|This is a generic error code to map unexpected errors that occurred when interacting with the Wallet Provider.|
|
40
47
|
|
41
|
-
A `409 Conflict` response is returned by the wallet provider when an integrity check fails.
|
@@ -94,15 +94,18 @@ const handleAttestationCreationError = e => {
|
|
94
94
|
if (!(e instanceof _errors.WalletProviderResponseError)) {
|
95
95
|
throw e;
|
96
96
|
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
97
|
+
throw new _errors.ResponseErrorBuilder(_errors.WalletProviderResponseError).handle(403, {
|
98
|
+
code: _errors.WalletProviderResponseErrorCodes.WalletInstanceRevoked,
|
99
|
+
message: "Unable to get an attestation for a revoked Wallet Instance"
|
100
|
+
}).handle(404, {
|
101
|
+
code: _errors.WalletProviderResponseErrorCodes.WalletInstanceNotFound,
|
102
|
+
message: "Unable to get an attestation for a Wallet Instance that does not exist"
|
103
|
+
}).handle(409, {
|
104
|
+
code: _errors.WalletProviderResponseErrorCodes.WalletInstanceIntegrityFailed,
|
105
|
+
message: "Unable to get an attestation for a Wallet Instance that failed the integrity check"
|
106
|
+
}).handle("*", {
|
107
|
+
code: _errors.WalletProviderResponseErrorCodes.WalletInstanceAttestationIssuingFailed,
|
108
|
+
message: "Unable to obtain wallet instance attestation"
|
109
|
+
}).buildFrom(e);
|
107
110
|
};
|
108
111
|
//# sourceMappingURL=issuing.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_jwk","_client","_errors","_types","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","SignJWT","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","fixBase64EncodingOnKey","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","getWalletProviderClient","get","then","response","nonce","signedAttestationRequest","tokenResponse","post","body","grant_type","assertion","result","TokenResponse","catch","handleAttestationCreationError","wallet_attestation","exports","e","WalletProviderResponseError","
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_jwk","_client","_errors","_types","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","SignJWT","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","fixBase64EncodingOnKey","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","getWalletProviderClient","get","then","response","nonce","signedAttestationRequest","tokenResponse","post","body","grant_type","assertion","result","TokenResponse","catch","handleAttestationCreationError","wallet_attestation","exports","e","WalletProviderResponseError","ResponseErrorBuilder","handle","code","WalletProviderResponseErrorCodes","WalletInstanceRevoked","message","WalletInstanceNotFound","WalletInstanceIntegrityFailed","WalletInstanceAttestationIssuingFailed","buildFrom"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAKA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeK,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,GAAGC,QAAG,CAACC,KAAK,CAACJ,GAAG,CAAC;EAChC,MAAMK,aAAa,GAAG,MAAM,IAAAC,4BAAU,EAACJ,SAAS,CAAC;EACjD,MAAMK,SAAS,GAAG;IAAE,GAAGL,SAAS;IAAEM,GAAG,EAAEH;EAAc,CAAC;EAEtD,MAAMI,UAAU,GA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C,SAAS,EACTC,gBAAgB,EAChBC,gBAAgB,EAChBC,qBACF,CAAC;;EAED;EACA,MAAM4C,aAAa,GAAG,MAAMP,GAAG,CAC5BQ,IAAI,CAAC,QAAQ,EAAE;IACdC,IAAI,EAAE;MACJC,UAAU,EAAE,6CAA6C;MACzDC,SAAS,EAAEL;IACb;EACF,CAAC,CAAC,CACDH,IAAI,CAAES,MAAM,IAAKC,oBAAa,CAAC7C,KAAK,CAAC4C,MAAM,CAAC,CAAC,CAC7CE,KAAK,CAACC,8BAA8B,CAAC;EAExC,OAAOR,aAAa,CAACS,kBAAkB;AACzC,CAAC;AAACC,OAAA,CAAArB,cAAA,GAAAA,cAAA;AAEF,MAAMmB,8BAA8B,GAAIG,CAAU,IAAK;EACrD,IAAI,EAAEA,CAAC,YAAYC,mCAA2B,CAAC,EAAE;IAC/C,MAAMD,CAAC;EACT;EAEA,MAAM,IAAIE,4BAAoB,CAACD,mCAA2B,CAAC,CACxDE,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,wCAAgC,CAACC,qBAAqB;IAC5DC,OAAO,EAAE;EACX,CAAC,CAAC,CACDJ,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,wCAAgC,CAACG,sBAAsB;IAC7DD,OAAO,EACL;EACJ,CAAC,CAAC,CACDJ,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,wCAAgC,CAACI,6BAA6B;IACpEF,OAAO,EACL;EACJ,CAAC,CAAC,CACDJ,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,wCAAgC,CAACK,sCAAsC;IAC7EH,OAAO,EAAE;EACX,CAAC,CAAC,CACDI,SAAS,CAACX,CAAC,CAAC;AACjB,CAAC"}
|
@@ -21,9 +21,15 @@ export const ProblemDetail = z.object({
|
|
21
21
|
detail: z.string().optional(),
|
22
22
|
instance: z.string().optional()
|
23
23
|
});
|
24
|
-
export const
|
24
|
+
export const SetWalletInstanceStatusBody = z.object({
|
25
25
|
status: z.literal("REVOKED")
|
26
26
|
});
|
27
|
+
export const RevocationReason = z.union([z.literal("CERTIFICATE_REVOKED_BY_ISSUER"), z.literal("NEW_WALLET_INSTANCE_CREATED"), z.literal("REVOKED_BY_USER")]);
|
28
|
+
export const WalletInstanceData = z.object({
|
29
|
+
id: z.string(),
|
30
|
+
is_revoked: z.boolean(),
|
31
|
+
revocation_reason: z.union([RevocationReason, z.undefined()]).optional()
|
32
|
+
});
|
27
33
|
export const get_GetNonce = {
|
28
34
|
method: z.literal("GET"),
|
29
35
|
path: z.literal("/nonce"),
|
@@ -38,34 +44,48 @@ export const post_CreateWalletInstance = {
|
|
38
44
|
}),
|
39
45
|
response: z.unknown()
|
40
46
|
};
|
41
|
-
export const
|
42
|
-
method: z.literal("
|
43
|
-
path: z.literal("/
|
47
|
+
export const get_GetWalletInstanceStatus = {
|
48
|
+
method: z.literal("GET"),
|
49
|
+
path: z.literal("/wallet-instances/{id}/status"),
|
44
50
|
parameters: z.object({
|
45
|
-
|
51
|
+
path: z.object({
|
52
|
+
id: z.string()
|
53
|
+
})
|
46
54
|
}),
|
47
|
-
response:
|
55
|
+
response: WalletInstanceData
|
48
56
|
};
|
49
|
-
export const
|
57
|
+
export const put_SetWalletInstanceStatus = {
|
50
58
|
method: z.literal("PUT"),
|
51
|
-
path: z.literal("/wallet-instances/
|
59
|
+
path: z.literal("/wallet-instances/{id}/status"),
|
52
60
|
parameters: z.object({
|
53
|
-
|
61
|
+
path: z.object({
|
62
|
+
id: z.string()
|
63
|
+
}),
|
64
|
+
body: SetWalletInstanceStatusBody
|
54
65
|
}),
|
55
66
|
response: z.unknown()
|
56
67
|
};
|
68
|
+
export const post_CreateWalletAttestation = {
|
69
|
+
method: z.literal("POST"),
|
70
|
+
path: z.literal("/token"),
|
71
|
+
parameters: z.object({
|
72
|
+
body: CreateWalletAttestationBody
|
73
|
+
}),
|
74
|
+
response: WalletAttestationView
|
75
|
+
};
|
57
76
|
|
58
77
|
// <EndpointByMethod>
|
59
78
|
export const EndpointByMethod = {
|
60
79
|
get: {
|
61
|
-
"/nonce": get_GetNonce
|
80
|
+
"/nonce": get_GetNonce,
|
81
|
+
"/wallet-instances/{id}/status": get_GetWalletInstanceStatus
|
62
82
|
},
|
63
83
|
post: {
|
64
84
|
"/wallet-instances": post_CreateWalletInstance,
|
65
85
|
"/token": post_CreateWalletAttestation
|
66
86
|
},
|
67
87
|
put: {
|
68
|
-
"/wallet-instances/
|
88
|
+
"/wallet-instances/{id}/status": put_SetWalletInstanceStatus
|
69
89
|
}
|
70
90
|
};
|
71
91
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["z","NonceDetailView","object","nonce","string","WalletAttestationView","wallet_attestation","CreateWalletInstanceBody","challenge","key_attestation","hardware_key_tag","CreateWalletAttestationBody","grant_type","literal","assertion","ProblemDetail","type","optional","title","status","number","detail","instance","
|
1
|
+
{"version":3,"names":["z","NonceDetailView","object","nonce","string","WalletAttestationView","wallet_attestation","CreateWalletInstanceBody","challenge","key_attestation","hardware_key_tag","CreateWalletAttestationBody","grant_type","literal","assertion","ProblemDetail","type","optional","title","status","number","detail","instance","SetWalletInstanceStatusBody","RevocationReason","union","WalletInstanceData","id","is_revoked","boolean","revocation_reason","undefined","get_GetNonce","method","path","parameters","never","response","post_CreateWalletInstance","body","unknown","get_GetWalletInstanceStatus","put_SetWalletInstanceStatus","post_CreateWalletAttestation","EndpointByMethod","get","post","put","ApiClient","baseUrl","constructor","fetcher","setBaseUrl","arguments","length","createApiClient"],"sourceRoot":"../../../../src","sources":["client/generated/wallet-provider.ts"],"mappings":"AAAA,OAAOA,CAAC,MAAM,KAAK;AAGnB,OAAO,MAAMC,eAAe,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtCC,KAAK,EAAEH,CAAC,CAACI,MAAM,CAAC;AAClB,CAAC,CAAC;AAGF,OAAO,MAAMC,qBAAqB,GAAGL,CAAC,CAACE,MAAM,CAAC;EAC5CI,kBAAkB,EAAEN,CAAC,C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;IACzC,OAAO,IAAI,CAACiB,OAAO,CAAC,KAAK,EAAE,IAAI,CAACF,OAAO,GAAGf,IAAI,EAAAmB,SAAA,CAAAC,MAAA,QAAAvB,SAAA,GAAAsB,SAAA,GAAW,CAAC;EAC5D;EACA;;EAEA;EACAP,IAAIA,CACFZ,IAAU,EAE+B;IACzC,OAAO,IAAI,CAACiB,OAAO,CAAC,MAAM,EAAE,IAAI,CAACF,OAAO,GAAGf,IAAI,EAAAmB,SAAA,CAAAC,MAAA,QAAAvB,SAAA,GAAAsB,SAAA,GAAW,CAAC;EAC7D;EACA;;EAEA;EACAN,GAAGA,CACDb,IAAU,EAE+B;IACzC,OAAO,IAAI,CAACiB,OAAO,CAAC,KAAK,EAAE,IAAI,CAACF,OAAO,GAAGf,IAAI,EAAAmB,SAAA,CAAAC,MAAA,QAAAvB,SAAA,GAAAsB,SAAA,GAAW,CAAC;EAC5D;EACA;AACF;;AAEA,OAAO,SAASE,eAAeA,CAACJ,OAAgB,EAAEF,OAAgB,EAAE;EAClE,OAAO,IAAID,SAAS,CAACG,OAAO,CAAC,CAACC,UAAU,CAACH,OAAO,IAAI,EAAE,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { parseRawHttpResponse } from "../utils/misc";
|
1
2
|
import { WalletProviderResponseError } from "../utils/errors";
|
2
3
|
import { ProblemDetail, createApiClient as createWalletProviderApiClient } from "./generated/wallet-provider";
|
3
4
|
const validateResponse = async response => {
|
@@ -10,7 +11,11 @@ const validateResponse = async response => {
|
|
10
11
|
title: "Invalid response from Wallet Provider"
|
11
12
|
};
|
12
13
|
}
|
13
|
-
throw new WalletProviderResponseError(
|
14
|
+
throw new WalletProviderResponseError({
|
15
|
+
message: problemDetail.title ?? "Invalid response from Wallet Provider",
|
16
|
+
reason: problemDetail,
|
17
|
+
statusCode: response.status
|
18
|
+
});
|
14
19
|
}
|
15
20
|
return response;
|
16
21
|
};
|
@@ -19,18 +24,27 @@ export const getWalletProviderClient = context => {
|
|
19
24
|
walletProviderBaseUrl,
|
20
25
|
appFetch = fetch
|
21
26
|
} = context;
|
22
|
-
return createWalletProviderApiClient((method, url, params) => appFetch(url, {
|
27
|
+
return createWalletProviderApiClient((method, url, params) => appFetch(interpolateUrl(url, params), {
|
23
28
|
method,
|
24
29
|
body: params ? JSON.stringify(params.body) : undefined,
|
25
30
|
headers: {
|
26
31
|
"Content-Type": "application/json"
|
27
32
|
}
|
28
|
-
}).then(validateResponse).then(
|
29
|
-
|
30
|
-
|
31
|
-
|
33
|
+
}).then(validateResponse).then(parseRawHttpResponse), walletProviderBaseUrl);
|
34
|
+
};
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Function to interpolate the url when the request includes path params.
|
38
|
+
* The client generator expects the literal name of the param in the url
|
39
|
+
* and passes the actual values in a separate object.
|
40
|
+
*/
|
41
|
+
export const interpolateUrl = (url, params) => {
|
42
|
+
if (!(params !== null && params !== void 0 && params.path)) return url;
|
43
|
+
for (const [key, value] of Object.entries(params.path)) {
|
44
|
+
if (typeof value === "string") {
|
45
|
+
url = url.replace(`{${key}}`, value);
|
32
46
|
}
|
33
|
-
|
34
|
-
|
47
|
+
}
|
48
|
+
return url;
|
35
49
|
};
|
36
50
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["WalletProviderResponseError","ProblemDetail","createApiClient","createWalletProviderApiClient","validateResponse","response","ok","problemDetail","parse","json","title","
|
1
|
+
{"version":3,"names":["parseRawHttpResponse","WalletProviderResponseError","ProblemDetail","createApiClient","createWalletProviderApiClient","validateResponse","response","ok","problemDetail","parse","json","title","message","reason","statusCode","status","getWalletProviderClient","context","walletProviderBaseUrl","appFetch","fetch","method","url","params","interpolateUrl","body","JSON","stringify","undefined","headers","then","path","key","value","Object","entries","replace"],"sourceRoot":"../../../src","sources":["client/index.ts"],"mappings":"AAAA,SAASA,oBAAoB,QAA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EAC1E,IAAI,EAACA,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEQ,IAAI,GAAE,OAAOT,GAAG;EAE7B,KAAK,MAAM,CAACU,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACZ,MAAM,CAACQ,IAAI,CAAC,EAAE;IACtD,IAAI,OAAOE,KAAK,KAAK,QAAQ,EAAE;MAC7BX,GAAG,GAAGA,GAAG,CAACc,OAAO,CAAE,IAAGJ,GAAI,GAAE,EAAEC,KAAK,CAAC;IACtC;EACF;EACA,OAAOX,GAAG;AACZ,CAAC"}
|
@@ -42,7 +42,7 @@ const selectResponseMode = (issuerConf, credentialType) => {
|
|
42
42
|
|
43
43
|
/**
|
44
44
|
* WARNING: This function must be called after {@link evaluateIssuerTrust} and {@link startFlow}. The next steam is {@link compeUserAuthorizationWithQueryMode} or {@link compeUserAuthorizationWithFormPostJwtMode}
|
45
|
-
* Creates and sends a PAR request to the /as/par endpoint of the
|
45
|
+
* Creates and sends a PAR request to the /as/par endpoint of the authorization server.
|
46
46
|
* This starts the authentication flow to obtain an access token.
|
47
47
|
* This token enables the Wallet Instance to request a digital credential from the Credential Endpoint of the Credential Issuer.
|
48
48
|
* This is an HTTP POST request containing the Wallet Instance identifier (client id), the code challenge and challenge method as specified by PKCE according to RFC 9126
|