@pagopa/io-react-native-wallet 0.11.1 → 0.13.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/lib/commonjs/client/generated/wallet-provider.js +126 -0
- package/lib/commonjs/client/generated/wallet-provider.js.map +1 -0
- package/lib/commonjs/client/index.js +40 -0
- package/lib/commonjs/client/index.js.map +1 -0
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +2 -1
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
- package/lib/commonjs/credential/issuance/03-start-credential-issuance.js +287 -0
- package/lib/commonjs/credential/issuance/03-start-credential-issuance.js.map +1 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +56 -83
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +88 -0
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +56 -33
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +51 -78
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +21 -44
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/index.js +7 -0
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/types.js +28 -0
- package/lib/commonjs/credential/issuance/types.js.map +1 -0
- package/lib/commonjs/index.js +10 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/pid/sd-jwt/converters.js +5 -9
- package/lib/commonjs/pid/sd-jwt/converters.js.map +1 -1
- package/lib/commonjs/pid/sd-jwt/types.js +3 -3
- package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/converters.test.js +1 -1
- package/lib/commonjs/sd-jwt/__test__/converters.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/index.test.js +30 -43
- package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/types.test.js +16 -24
- package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/index.js +3 -9
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +11 -16
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/trust/types.js +70 -29
- package/lib/commonjs/trust/types.js.map +1 -1
- package/lib/commonjs/utils/auth.js +44 -0
- package/lib/commonjs/utils/auth.js.map +1 -0
- package/lib/commonjs/utils/errors.js +104 -1
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/commonjs/utils/integrity.js +2 -0
- package/lib/commonjs/utils/integrity.js.map +1 -0
- package/lib/commonjs/utils/misc.js +34 -1
- package/lib/commonjs/utils/misc.js.map +1 -1
- package/lib/commonjs/utils/par.js +23 -15
- package/lib/commonjs/utils/par.js.map +1 -1
- package/lib/commonjs/utils/pop.js +33 -0
- package/lib/commonjs/utils/pop.js.map +1 -0
- package/lib/commonjs/wallet-instance/index.js +29 -0
- package/lib/commonjs/wallet-instance/index.js.map +1 -0
- package/lib/commonjs/wallet-instance-attestation/issuing.js +62 -65
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/types.js +8 -8
- package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
- package/lib/module/client/generated/wallet-provider.js +102 -0
- package/lib/module/client/generated/wallet-provider.js.map +1 -0
- package/lib/module/client/index.js +33 -0
- package/lib/module/client/index.js.map +1 -0
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +2 -1
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
- package/lib/module/credential/issuance/03-start-credential-issuance.js +276 -0
- package/lib/module/credential/issuance/03-start-credential-issuance.js.map +1 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js +56 -80
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +85 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +54 -33
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +50 -75
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +21 -44
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/issuance/index.js +2 -1
- package/lib/module/credential/issuance/index.js.map +1 -1
- package/lib/module/credential/issuance/types.js +18 -0
- package/lib/module/credential/issuance/types.js.map +1 -0
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/pid/sd-jwt/converters.js +5 -9
- package/lib/module/pid/sd-jwt/converters.js.map +1 -1
- package/lib/module/pid/sd-jwt/types.js +3 -3
- package/lib/module/pid/sd-jwt/types.js.map +1 -1
- package/lib/module/sd-jwt/__test__/converters.test.js +1 -1
- package/lib/module/sd-jwt/__test__/converters.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/index.test.js +30 -43
- package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/types.test.js +16 -24
- package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/module/sd-jwt/index.js +3 -9
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/sd-jwt/types.js +11 -16
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/trust/types.js +70 -29
- package/lib/module/trust/types.js.map +1 -1
- package/lib/module/utils/auth.js +35 -0
- package/lib/module/utils/auth.js.map +1 -0
- package/lib/module/utils/errors.js +98 -0
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/module/utils/integrity.js +2 -0
- package/lib/module/utils/integrity.js.map +1 -0
- package/lib/module/utils/misc.js +31 -0
- package/lib/module/utils/misc.js.map +1 -1
- package/lib/module/utils/par.js +24 -16
- package/lib/module/utils/par.js.map +1 -1
- package/lib/module/utils/pop.js +24 -0
- package/lib/module/utils/pop.js.map +1 -0
- package/lib/module/wallet-instance/index.js +23 -0
- package/lib/module/wallet-instance/index.js.map +1 -0
- package/lib/module/wallet-instance-attestation/issuing.js +63 -67
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/wallet-instance-attestation/types.js +8 -8
- package/lib/module/wallet-instance-attestation/types.js.map +1 -1
- package/lib/typescript/client/generated/wallet-provider.d.ts +264 -0
- package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -0
- package/lib/typescript/client/index.d.ts +7 -0
- package/lib/typescript/client/index.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -0
- package/lib/typescript/credential/issuance/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +2 -1
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts +41 -0
- package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +23 -18
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +24 -12
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts +22 -16
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +19 -26
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +10 -15
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/index.d.ts +3 -4
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/types.d.ts +63 -0
- package/lib/typescript/credential/issuance/types.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/types.d.ts +6 -6
- package/lib/typescript/index.d.ts +6 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/pid/sd-jwt/converters.d.ts.map +1 -1
- package/lib/typescript/pid/sd-jwt/types.d.ts +36 -36
- package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +40 -68
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +64 -121
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/trust/index.d.ts +150 -48
- package/lib/typescript/trust/index.d.ts.map +1 -1
- package/lib/typescript/trust/types.d.ts +2838 -1740
- package/lib/typescript/trust/types.d.ts.map +1 -1
- package/lib/typescript/utils/auth.d.ts +52 -0
- package/lib/typescript/utils/auth.d.ts.map +1 -0
- package/lib/typescript/utils/errors.d.ts +48 -0
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/integrity.d.ts +21 -0
- package/lib/typescript/utils/integrity.d.ts.map +1 -0
- package/lib/typescript/utils/misc.d.ts +18 -0
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/utils/par.d.ts +8 -31
- package/lib/typescript/utils/par.d.ts.map +1 -1
- package/lib/typescript/utils/pop.d.ts +26 -0
- package/lib/typescript/utils/pop.d.ts.map +1 -0
- package/lib/typescript/wallet-instance/index.d.ts +7 -0
- package/lib/typescript/wallet-instance/index.d.ts.map +1 -0
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts +17 -4
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +64 -64
- package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
- package/package.json +9 -5
- package/src/client/generated/wallet-provider.ts +173 -0
- package/src/client/index.ts +53 -0
- package/src/credential/issuance/01-start-flow.ts +1 -0
- package/src/credential/issuance/02-evaluate-issuer-trust.ts +2 -1
- package/src/credential/issuance/03-start-credential-issuance.ts +407 -0
- package/src/credential/issuance/03-start-user-authorization.ts +91 -92
- package/src/credential/issuance/04-complete-user-authorization.ts +114 -13
- package/src/credential/issuance/05-authorize-access.ts +74 -49
- package/src/credential/issuance/06-obtain-credential.ts +77 -111
- package/src/credential/issuance/07-verify-and-parse-credential.ts +30 -67
- package/src/credential/issuance/index.ts +6 -4
- package/src/credential/issuance/types.ts +25 -0
- package/src/index.ts +8 -0
- package/src/pid/sd-jwt/converters.ts +5 -11
- package/src/pid/sd-jwt/types.ts +8 -6
- package/src/sd-jwt/__test__/converters.test.ts +1 -1
- package/src/sd-jwt/__test__/index.test.ts +45 -74
- package/src/sd-jwt/__test__/types.test.ts +21 -33
- package/src/sd-jwt/index.ts +3 -12
- package/src/sd-jwt/types.ts +17 -22
- package/src/trust/types.ts +64 -32
- package/src/utils/auth.ts +37 -0
- package/src/utils/errors.ts +112 -0
- package/src/utils/integrity.ts +23 -0
- package/src/utils/misc.ts +43 -0
- package/src/utils/par.ts +29 -17
- package/src/utils/pop.ts +34 -0
- package/src/wallet-instance/index.ts +29 -0
- package/src/wallet-instance-attestation/issuing.ts +101 -97
- package/src/wallet-instance-attestation/types.ts +12 -8
- package/lib/commonjs/credential/issuance/07-confirm-credential.js +0 -6
- package/lib/commonjs/credential/issuance/07-confirm-credential.js.map +0 -1
- package/lib/commonjs/credential/issuance/08-confirm-credential.js +0 -6
- package/lib/commonjs/credential/issuance/08-confirm-credential.js.map +0 -1
- package/lib/module/credential/issuance/07-confirm-credential.js +0 -2
- package/lib/module/credential/issuance/07-confirm-credential.js.map +0 -1
- package/lib/module/credential/issuance/08-confirm-credential.js +0 -2
- package/lib/module/credential/issuance/08-confirm-credential.js.map +0 -1
- package/lib/typescript/credential/issuance/07-confirm-credential.d.ts +0 -11
- package/lib/typescript/credential/issuance/07-confirm-credential.d.ts.map +0 -1
- package/lib/typescript/credential/issuance/08-confirm-credential.d.ts +0 -11
- package/lib/typescript/credential/issuance/08-confirm-credential.d.ts.map +0 -1
- package/src/credential/issuance/07-confirm-credential.ts +0 -14
- package/src/credential/issuance/08-confirm-credential.ts +0 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["z","SignJWT","createPopToken","payload","crypto","kid","getPublicKey","then","_","setPayload","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","PoPPayload","object","jti","string","aud","iss"],"sourceRoot":"../../../src","sources":["utils/pop.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;AAExB,SAASC,OAAO,QAA4B,6BAA6B;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAG,MAAAA,CAC5BC,OAAmB,EACnBC,MAAqB,KACD;EACpB,MAAMC,GAAG,GAAG,MAAMD,MAAM,CAACE,YAAY,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACH,GAAG,CAAC;EAC1D,OAAO,IAAIJ,OAAO,CAACG,MAAM,CAAC,CACvBK,UAAU,CAACN,OAAO,CAAC,CACnBO,kBAAkB,CAAC;IAClBC,GAAG,EAAE,4BAA4B;IACjCN;EACF,CAAC,CAAC,CACDO,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,MAAM,CAAC,CACzBC,IAAI,CAAC,CAAC;AACX,CAAC;AAGD,OAAO,MAAMC,UAAU,GAAGf,CAAC,CAACgB,MAAM,CAAC;EACjCC,GAAG,EAAEjB,CAAC,CAACkB,MAAM,CAAC,CAAC;EACfC,GAAG,EAAEnB,CAAC,CAACkB,MAAM,CAAC,CAAC;EACfE,GAAG,EAAEpB,CAAC,CAACkB,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getWalletProviderClient } from "../client";
|
|
2
|
+
export async function createWalletInstance(context) {
|
|
3
|
+
const {
|
|
4
|
+
integrityContext
|
|
5
|
+
} = context;
|
|
6
|
+
const api = getWalletProviderClient(context);
|
|
7
|
+
|
|
8
|
+
//1. Obtain nonce
|
|
9
|
+
const challenge = await api.get("/nonce").then(response => response.nonce);
|
|
10
|
+
const keyAttestation = await integrityContext.getAttestation(challenge);
|
|
11
|
+
const hardwareKeyTag = integrityContext.getHardwareKeyTag();
|
|
12
|
+
|
|
13
|
+
//2. Create Wallet Instance
|
|
14
|
+
await api.post("/wallet-instances", {
|
|
15
|
+
body: {
|
|
16
|
+
challenge,
|
|
17
|
+
key_attestation: keyAttestation,
|
|
18
|
+
hardware_key_tag: hardwareKeyTag
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return hardwareKeyTag;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getWalletProviderClient","createWalletInstance","context","integrityContext","api","challenge","get","then","response","nonce","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,WAAW;AAGnD,OAAO,eAAeC,oBAAoBA,CAACC,OAI1C,EAAE;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EAEpC,MAAME,GAAG,GAAGJ,uBAAuB,CAACE,OAAO,CAAC;;EAE5C;EACA,MAAMG,SAAS,GAAG,MAAMD,GAAG,CAACE,GAAG,CAAC,QAAQ,CAAC,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,KAAK,CAAC;EAE5E,MAAMC,cAAc,GAAG,MAAMP,gBAAgB,CAACQ,cAAc,CAACN,SAAS,CAAC;EACvE,MAAMO,cAAc,GAAGT,gBAAgB,CAACU,iBAAiB,CAAC,CAAC;;EAE3D;EACA,MAAMT,GAAG,CAACU,IAAI,CAAC,mBAAmB,EAAE;IAClCC,IAAI,EAAE;MACJV,SAAS;MACTW,eAAe,EAAEN,cAAc;MAC/BO,gBAAgB,EAAEL;IACpB;EACF,CAAC,CAAC;EAEF,OAAOA,cAAc;AACvB"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
|
|
2
|
-
import { verify as verifyJwt } from "@pagopa/io-react-native-jwt";
|
|
3
1
|
import { SignJWT, thumbprint } from "@pagopa/io-react-native-jwt";
|
|
2
|
+
import { z } from "zod";
|
|
4
3
|
import { JWK, fixBase64EncodingOnKey } from "../utils/jwk";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { getWalletProviderClient } from "../client";
|
|
5
|
+
import { WalletProviderResponseError, WalletInstanceRevokedError, WalletInstanceNotFoundError, WalletInstanceAttestationIssuingError } from "../utils/errors";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Getter for an attestation request. The attestation request is a JWT that will be sent to the Wallet Provider to request a Wallet Instance Attestation.
|
|
9
|
+
*
|
|
10
|
+
* @param challenge - The nonce received from the Wallet Provider which is part of the signed clientData
|
|
11
|
+
* @param wiaCryptoContext - The key pair associated with the WIA. Will be use to prove the ownership of the attestation
|
|
12
|
+
* @param integrityContext - The integrity context which exposes a set of functions to interact with the device integrity service
|
|
13
|
+
* @param walletProviderBaseUrl - Base url for the Wallet Provider
|
|
14
|
+
* @returns A JWT containing the attestation request
|
|
15
|
+
*/
|
|
16
|
+
export async function getAttestationRequest(challenge, wiaCryptoContext, integrityContext, walletProviderBaseUrl) {
|
|
9
17
|
const jwk = await wiaCryptoContext.getPublicKey();
|
|
10
18
|
const parsedJwk = JWK.parse(jwk);
|
|
11
19
|
const keyThumbprint = await thumbprint(parsedJwk);
|
|
@@ -13,50 +21,31 @@ async function getAttestationRequest(wiaCryptoContext, walletProviderEntityConfi
|
|
|
13
21
|
...parsedJwk,
|
|
14
22
|
kid: keyThumbprint
|
|
15
23
|
};
|
|
24
|
+
const clientData = {
|
|
25
|
+
challenge,
|
|
26
|
+
jwk_thumbprint: keyThumbprint
|
|
27
|
+
};
|
|
28
|
+
const hardwareKeyTag = integrityContext.getHardwareKeyTag();
|
|
29
|
+
const {
|
|
30
|
+
signature,
|
|
31
|
+
authenticatorData
|
|
32
|
+
} = await integrityContext.getHardwareSignatureWithAuthData(JSON.stringify(clientData));
|
|
16
33
|
return new SignJWT(wiaCryptoContext).setPayload({
|
|
17
34
|
iss: keyThumbprint,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
35
|
+
sub: walletProviderBaseUrl,
|
|
36
|
+
challenge,
|
|
37
|
+
hardware_signature: signature,
|
|
38
|
+
integrity_assertion: authenticatorData,
|
|
39
|
+
hardware_key_tag: hardwareKeyTag,
|
|
21
40
|
cnf: {
|
|
22
41
|
jwk: fixBase64EncodingOnKey(publicKey)
|
|
23
42
|
}
|
|
24
43
|
}).setProtectedHeader({
|
|
25
44
|
kid: publicKey.kid,
|
|
26
|
-
typ: "
|
|
45
|
+
typ: "war+jwt"
|
|
27
46
|
}).setIssuedAt().setExpirationTime("1h").sign();
|
|
28
47
|
}
|
|
29
48
|
|
|
30
|
-
/**
|
|
31
|
-
* Validate a Wallet Instance Attestation token.
|
|
32
|
-
* Either return true or throw an exception.
|
|
33
|
-
*
|
|
34
|
-
* @param wia Signed Wallet Instance Attestation token
|
|
35
|
-
* @param walletProviderEntityConfiguration Entity Configuration object for the issuing Wallet Provider
|
|
36
|
-
* @returns The token is valid
|
|
37
|
-
* @throws {WalletInstanceAttestationIssuingError} When the received token fails to validate. This can happen due to invalid signature, expired token or malformed JWT token.
|
|
38
|
-
*/
|
|
39
|
-
async function verifyWalletInstanceAttestation(wia, walletProviderEntityConfiguration) {
|
|
40
|
-
const {
|
|
41
|
-
payload: {
|
|
42
|
-
sub,
|
|
43
|
-
metadata: {
|
|
44
|
-
wallet_provider: {
|
|
45
|
-
jwks: {
|
|
46
|
-
keys
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
} = walletProviderEntityConfiguration;
|
|
52
|
-
return verifyJwt(wia, keys, {
|
|
53
|
-
issuer: sub
|
|
54
|
-
}).then(_ => true).catch(ex => {
|
|
55
|
-
const reason = ex && ex instanceof Error ? ex.message : "unknown reason";
|
|
56
|
-
throw new WalletInstanceAttestationIssuingError("Unable to validate received wallet instance attestation", reason);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
49
|
/**
|
|
61
50
|
* Request a Wallet Instance Attestation (WIA) to the Wallet provider
|
|
62
51
|
*
|
|
@@ -64,39 +53,46 @@ async function verifyWalletInstanceAttestation(wia, walletProviderEntityConfigur
|
|
|
64
53
|
* @param params.appFetch (optional) Http client
|
|
65
54
|
* @param walletProviderBaseUrl Base url for the Wallet Provider
|
|
66
55
|
* @returns The retrieved Wallet Instance Attestation token
|
|
56
|
+
* @throws {WalletInstanceRevokedError} The Wallet Instance was revoked
|
|
57
|
+
* @throws {WalletInstanceNotFoundError} The Wallet Instance does not exist
|
|
67
58
|
*/
|
|
68
|
-
export const getAttestation = _ref => {
|
|
59
|
+
export const getAttestation = async _ref => {
|
|
69
60
|
let {
|
|
70
61
|
wiaCryptoContext,
|
|
62
|
+
integrityContext,
|
|
63
|
+
walletProviderBaseUrl,
|
|
71
64
|
appFetch = fetch
|
|
72
65
|
} = _ref;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
66
|
+
const api = getWalletProviderClient({
|
|
67
|
+
walletProviderBaseUrl,
|
|
68
|
+
appFetch
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// 1. Get nonce from backend
|
|
72
|
+
const challenge = await api.get("/nonce").then(response => response.nonce);
|
|
73
|
+
|
|
74
|
+
// 2. Get a signed attestation request
|
|
75
|
+
const signedAttestationRequest = await getAttestationRequest(challenge, wiaCryptoContext, integrityContext, walletProviderBaseUrl);
|
|
76
|
+
|
|
77
|
+
// 3. Request WIA
|
|
78
|
+
const wia = await api.post("/token", {
|
|
79
|
+
body: {
|
|
80
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
|
85
81
|
assertion: signedAttestationRequest
|
|
86
|
-
};
|
|
87
|
-
const response = await appFetch(tokenUrl, {
|
|
88
|
-
method: "POST",
|
|
89
|
-
headers: {
|
|
90
|
-
"Content-Type": "application/json"
|
|
91
|
-
},
|
|
92
|
-
body: JSON.stringify(requestBody)
|
|
93
|
-
});
|
|
94
|
-
if (response.status !== 201) {
|
|
95
|
-
throw new WalletInstanceAttestationIssuingError("Unable to obtain wallet instance attestation from wallet provider", `Response code: ${response.status}`);
|
|
96
82
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
83
|
+
}).then(result => z.string().parse(result)).catch(handleAttestationCreationError);
|
|
84
|
+
return wia;
|
|
85
|
+
};
|
|
86
|
+
const handleAttestationCreationError = e => {
|
|
87
|
+
if (!(e instanceof WalletProviderResponseError)) {
|
|
88
|
+
throw e;
|
|
89
|
+
}
|
|
90
|
+
if (e.statusCode === 403) {
|
|
91
|
+
throw new WalletInstanceRevokedError("Unable to get an attestation for a revoked Wallet Instance", e.claim, e.reason);
|
|
92
|
+
}
|
|
93
|
+
if (e.statusCode === 404) {
|
|
94
|
+
throw new WalletInstanceNotFoundError("Unable to get an attestation for a Wallet Instance that does not exist", e.claim, e.reason);
|
|
95
|
+
}
|
|
96
|
+
throw new WalletInstanceAttestationIssuingError(`Unable to obtain wallet instance attestation [response status code: ${e.statusCode}]`, e.claim, e.reason);
|
|
101
97
|
};
|
|
102
98
|
//# sourceMappingURL=issuing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["SignJWT","thumbprint","z","JWK","fixBase64EncodingOnKey","getWalletProviderClient","WalletProviderResponseError","WalletInstanceRevokedError","WalletInstanceNotFoundError","WalletInstanceAttestationIssuingError","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","parse","keyThumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","get","then","response","nonce","signedAttestationRequest","wia","post","body","grant_type","assertion","result","string","catch","handleAttestationCreationError","e","statusCode","claim","reason"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":"AACA,SAASA,OAAO,EAAEC,UAAU,QAAQ,6BAA6B;AACjE,SAASC,CAAC,QAAQ,KAAK;AACvB,SAASC,GAAG,EAAEC,sBAAsB,QAAQ,cAAc;AAC1D,SAASC,uBAAuB,QAAQ,WAAW;AAEnD,SACEC,2BAA2B,EAC3BC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,qCAAqC,QAChC,iBAAiB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,qBAAqBA,CACzCC,SAAiB,EACjBC,gBAA+B,EAC/BC,gBAAkC,EAClCC,qBAA6B,EACZ;EACjB,MAAMC,GAAG,GAAG,MAAMH,gBAAgB,CAACI,YAAY,CAAC,CAAC;EACjD,MAAMC,SAAS,GAAGd,GAAG,CAACe,KAAK,CAACH,G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oC,GAAG,CAACC,GAAG,CAAC,QAAQ,CAAC,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,KAAK,CAAC;;EAE5E;EACA,MAAMC,wBAAwB,GAAG,MAAM1C,qBAAqB,CAC1DC,SAAS,EACTC,gBAAgB,EAChBC,gBAAgB,EAChBC,qBACF,CAAC;;EAED;EACA,MAAMuC,GAAG,GAAG,MAAMN,GAAG,CAClBO,IAAI,CAAC,QAAQ,EAAE;IACdC,IAAI,EAAE;MACJC,UAAU,EAAE,6CAA6C;MACzDC,SAAS,EAAEL;IACb;EACF,CAAC,CAAC,CACDH,IAAI,CAAES,MAAM,IAAKxD,CAAC,CAACyD,MAAM,CAAC,CAAC,CAACzC,KAAK,CAACwC,MAAM,CAAC,CAAC,CAC1CE,KAAK,CAACC,8BAA8B,CAAC;EAExC,OAAOR,GAAG;AACZ,CAAC;AAED,MAAMQ,8BAA8B,GAAIC,CAAU,IAAK;EACrD,IAAI,EAAEA,CAAC,YAAYxD,2BAA2B,CAAC,EAAE;IAC/C,MAAMwD,CAAC;EACT;EAEA,IAAIA,CAAC,CAACC,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAIxD,0BAA0B,CAClC,4DAA4D,EAC5DuD,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;EACH;EAEA,IAAIH,CAAC,CAACC,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAIvD,2BAA2B,CACnC,wEAAwE,EACxEsD,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;EACH;EAEA,MAAM,IAAIxD,qCAAqC,CAC5C,uEAAsEqD,CAAC,CAACC,UAAW,GAAE,EACtFD,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;AACH,CAAC"}
|
|
@@ -24,7 +24,7 @@ const Jwt = z.object({
|
|
|
24
24
|
});
|
|
25
25
|
export const WalletInstanceAttestationRequestJwt = z.object({
|
|
26
26
|
header: z.intersection(Jwt.shape.header, z.object({
|
|
27
|
-
typ: z.literal("
|
|
27
|
+
typ: z.literal("war+jwt")
|
|
28
28
|
})),
|
|
29
29
|
payload: z.intersection(Jwt.shape.payload, z.object({
|
|
30
30
|
aud: z.string(),
|
|
@@ -38,16 +38,16 @@ export const WalletInstanceAttestationJwt = z.object({
|
|
|
38
38
|
})),
|
|
39
39
|
payload: z.intersection(Jwt.shape.payload, z.object({
|
|
40
40
|
sub: z.string(),
|
|
41
|
-
|
|
41
|
+
aal: z.string(),
|
|
42
42
|
authorization_endpoint: z.string(),
|
|
43
43
|
response_types_supported: z.array(z.string()),
|
|
44
44
|
vp_formats_supported: z.object({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
})
|
|
45
|
+
"vc+sd-jwt": z.object({
|
|
46
|
+
"sd-jwt_alg_values": z.array(z.string())
|
|
47
|
+
}).optional(),
|
|
48
|
+
"vp+sd-jwt": z.object({
|
|
49
|
+
"sd-jwt_alg_values": z.array(z.string())
|
|
50
|
+
}).optional()
|
|
51
51
|
}),
|
|
52
52
|
request_object_signing_alg_values_supported: z.array(z.string()),
|
|
53
53
|
presentation_definition_uri_supported: z.boolean()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["JWK","z","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","iat","exp","cnf","jwk","intersection","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","WalletInstanceAttestationJwt","sub","
|
|
1
|
+
{"version":3,"names":["JWK","z","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","iat","exp","cnf","jwk","intersection","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","WalletInstanceAttestationJwt","sub","aal","authorization_endpoint","response_types_supported","vp_formats_supported","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean"],"sourceRoot":"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ACXM,MAAM,CAAC;QACN,mBAAmB,EAAEN,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC;MACzC,CAAC,CAAC,CACDK,QAAQ,CAAC;IACd,CAAC,CAAC;IACFqB,2CAA2C,EAAEnC,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC,CAAC;IAChE2B,qCAAqC,EAAEpC,CAAC,CAACqC,OAAO,CAAC;EACnD,CAAC,CACH;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export type NonceDetailView = z.infer<typeof NonceDetailView>;
|
|
3
|
+
export declare const NonceDetailView: z.ZodObject<{
|
|
4
|
+
nonce: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
nonce: string;
|
|
7
|
+
}, {
|
|
8
|
+
nonce: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type WalletAttestationView = z.infer<typeof WalletAttestationView>;
|
|
11
|
+
export declare const WalletAttestationView: z.ZodString;
|
|
12
|
+
export type CreateWalletInstanceBody = z.infer<typeof CreateWalletInstanceBody>;
|
|
13
|
+
export declare const CreateWalletInstanceBody: z.ZodObject<{
|
|
14
|
+
challenge: z.ZodString;
|
|
15
|
+
key_attestation: z.ZodString;
|
|
16
|
+
hardware_key_tag: z.ZodString;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
challenge: string;
|
|
19
|
+
key_attestation: string;
|
|
20
|
+
hardware_key_tag: string;
|
|
21
|
+
}, {
|
|
22
|
+
challenge: string;
|
|
23
|
+
key_attestation: string;
|
|
24
|
+
hardware_key_tag: string;
|
|
25
|
+
}>;
|
|
26
|
+
export type CreateWalletAttestationBody = z.infer<typeof CreateWalletAttestationBody>;
|
|
27
|
+
export declare const CreateWalletAttestationBody: z.ZodObject<{
|
|
28
|
+
grant_type: z.ZodLiteral<"urn:ietf:params:oauth:grant-type:jwt-bearer">;
|
|
29
|
+
assertion: z.ZodString;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
32
|
+
assertion: string;
|
|
33
|
+
}, {
|
|
34
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
35
|
+
assertion: string;
|
|
36
|
+
}>;
|
|
37
|
+
export type ProblemDetail = z.infer<typeof ProblemDetail>;
|
|
38
|
+
export declare const ProblemDetail: z.ZodObject<{
|
|
39
|
+
type: z.ZodOptional<z.ZodString>;
|
|
40
|
+
title: z.ZodOptional<z.ZodString>;
|
|
41
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
43
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
type?: string | undefined;
|
|
46
|
+
title?: string | undefined;
|
|
47
|
+
status?: number | undefined;
|
|
48
|
+
detail?: string | undefined;
|
|
49
|
+
instance?: string | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
type?: string | undefined;
|
|
52
|
+
title?: string | undefined;
|
|
53
|
+
status?: number | undefined;
|
|
54
|
+
detail?: string | undefined;
|
|
55
|
+
instance?: string | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
export type FiscalCode = z.infer<typeof FiscalCode>;
|
|
58
|
+
export declare const FiscalCode: z.ZodString;
|
|
59
|
+
export type Id = z.infer<typeof Id>;
|
|
60
|
+
export declare const Id: z.ZodString;
|
|
61
|
+
export type get_GetNonce = typeof get_GetNonce;
|
|
62
|
+
export declare const get_GetNonce: {
|
|
63
|
+
method: z.ZodLiteral<"GET">;
|
|
64
|
+
path: z.ZodLiteral<"/nonce">;
|
|
65
|
+
parameters: z.ZodNever;
|
|
66
|
+
response: z.ZodObject<{
|
|
67
|
+
nonce: z.ZodString;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
nonce: string;
|
|
70
|
+
}, {
|
|
71
|
+
nonce: string;
|
|
72
|
+
}>;
|
|
73
|
+
};
|
|
74
|
+
export type post_CreateWalletInstance = typeof post_CreateWalletInstance;
|
|
75
|
+
export declare const post_CreateWalletInstance: {
|
|
76
|
+
method: z.ZodLiteral<"POST">;
|
|
77
|
+
path: z.ZodLiteral<"/wallet-instances">;
|
|
78
|
+
parameters: z.ZodObject<{
|
|
79
|
+
body: z.ZodObject<{
|
|
80
|
+
challenge: z.ZodString;
|
|
81
|
+
key_attestation: z.ZodString;
|
|
82
|
+
hardware_key_tag: z.ZodString;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
challenge: string;
|
|
85
|
+
key_attestation: string;
|
|
86
|
+
hardware_key_tag: string;
|
|
87
|
+
}, {
|
|
88
|
+
challenge: string;
|
|
89
|
+
key_attestation: string;
|
|
90
|
+
hardware_key_tag: string;
|
|
91
|
+
}>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
body: {
|
|
94
|
+
challenge: string;
|
|
95
|
+
key_attestation: string;
|
|
96
|
+
hardware_key_tag: string;
|
|
97
|
+
};
|
|
98
|
+
}, {
|
|
99
|
+
body: {
|
|
100
|
+
challenge: string;
|
|
101
|
+
key_attestation: string;
|
|
102
|
+
hardware_key_tag: string;
|
|
103
|
+
};
|
|
104
|
+
}>;
|
|
105
|
+
response: z.ZodUnknown;
|
|
106
|
+
};
|
|
107
|
+
export type post_CreateWalletAttestation = typeof post_CreateWalletAttestation;
|
|
108
|
+
export declare const post_CreateWalletAttestation: {
|
|
109
|
+
method: z.ZodLiteral<"POST">;
|
|
110
|
+
path: z.ZodLiteral<"/token">;
|
|
111
|
+
parameters: z.ZodObject<{
|
|
112
|
+
body: z.ZodObject<{
|
|
113
|
+
grant_type: z.ZodLiteral<"urn:ietf:params:oauth:grant-type:jwt-bearer">;
|
|
114
|
+
assertion: z.ZodString;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
117
|
+
assertion: string;
|
|
118
|
+
}, {
|
|
119
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
120
|
+
assertion: string;
|
|
121
|
+
}>;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
body: {
|
|
124
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
125
|
+
assertion: string;
|
|
126
|
+
};
|
|
127
|
+
}, {
|
|
128
|
+
body: {
|
|
129
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
130
|
+
assertion: string;
|
|
131
|
+
};
|
|
132
|
+
}>;
|
|
133
|
+
response: z.ZodUnknown;
|
|
134
|
+
};
|
|
135
|
+
export declare const EndpointByMethod: {
|
|
136
|
+
get: {
|
|
137
|
+
"/nonce": {
|
|
138
|
+
method: z.ZodLiteral<"GET">;
|
|
139
|
+
path: z.ZodLiteral<"/nonce">;
|
|
140
|
+
parameters: z.ZodNever;
|
|
141
|
+
response: z.ZodObject<{
|
|
142
|
+
nonce: z.ZodString;
|
|
143
|
+
}, "strip", z.ZodTypeAny, {
|
|
144
|
+
nonce: string;
|
|
145
|
+
}, {
|
|
146
|
+
nonce: string;
|
|
147
|
+
}>;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
post: {
|
|
151
|
+
"/wallet-instances": {
|
|
152
|
+
method: z.ZodLiteral<"POST">;
|
|
153
|
+
path: z.ZodLiteral<"/wallet-instances">;
|
|
154
|
+
parameters: z.ZodObject<{
|
|
155
|
+
body: z.ZodObject<{
|
|
156
|
+
challenge: z.ZodString;
|
|
157
|
+
key_attestation: z.ZodString;
|
|
158
|
+
hardware_key_tag: z.ZodString;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
challenge: string;
|
|
161
|
+
key_attestation: string;
|
|
162
|
+
hardware_key_tag: string;
|
|
163
|
+
}, {
|
|
164
|
+
challenge: string;
|
|
165
|
+
key_attestation: string;
|
|
166
|
+
hardware_key_tag: string;
|
|
167
|
+
}>;
|
|
168
|
+
}, "strip", z.ZodTypeAny, {
|
|
169
|
+
body: {
|
|
170
|
+
challenge: string;
|
|
171
|
+
key_attestation: string;
|
|
172
|
+
hardware_key_tag: string;
|
|
173
|
+
};
|
|
174
|
+
}, {
|
|
175
|
+
body: {
|
|
176
|
+
challenge: string;
|
|
177
|
+
key_attestation: string;
|
|
178
|
+
hardware_key_tag: string;
|
|
179
|
+
};
|
|
180
|
+
}>;
|
|
181
|
+
response: z.ZodUnknown;
|
|
182
|
+
};
|
|
183
|
+
"/token": {
|
|
184
|
+
method: z.ZodLiteral<"POST">;
|
|
185
|
+
path: z.ZodLiteral<"/token">;
|
|
186
|
+
parameters: z.ZodObject<{
|
|
187
|
+
body: z.ZodObject<{
|
|
188
|
+
grant_type: z.ZodLiteral<"urn:ietf:params:oauth:grant-type:jwt-bearer">;
|
|
189
|
+
assertion: z.ZodString;
|
|
190
|
+
}, "strip", z.ZodTypeAny, {
|
|
191
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
192
|
+
assertion: string;
|
|
193
|
+
}, {
|
|
194
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
195
|
+
assertion: string;
|
|
196
|
+
}>;
|
|
197
|
+
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
body: {
|
|
199
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
200
|
+
assertion: string;
|
|
201
|
+
};
|
|
202
|
+
}, {
|
|
203
|
+
body: {
|
|
204
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
205
|
+
assertion: string;
|
|
206
|
+
};
|
|
207
|
+
}>;
|
|
208
|
+
response: z.ZodUnknown;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
export type EndpointByMethod = typeof EndpointByMethod;
|
|
213
|
+
export type GetEndpoints = EndpointByMethod["get"];
|
|
214
|
+
export type PostEndpoints = EndpointByMethod["post"];
|
|
215
|
+
export type AllEndpoints = EndpointByMethod[keyof EndpointByMethod];
|
|
216
|
+
export type EndpointParameters = {
|
|
217
|
+
body?: unknown;
|
|
218
|
+
query?: Record<string, unknown>;
|
|
219
|
+
header?: Record<string, unknown>;
|
|
220
|
+
path?: Record<string, unknown>;
|
|
221
|
+
};
|
|
222
|
+
export type MutationMethod = "post" | "put" | "patch" | "delete";
|
|
223
|
+
export type Method = "get" | "head" | MutationMethod;
|
|
224
|
+
export type DefaultEndpoint = {
|
|
225
|
+
parameters?: EndpointParameters | undefined;
|
|
226
|
+
response: unknown;
|
|
227
|
+
};
|
|
228
|
+
export type Endpoint<TConfig extends DefaultEndpoint = DefaultEndpoint> = {
|
|
229
|
+
operationId: string;
|
|
230
|
+
method: Method;
|
|
231
|
+
path: string;
|
|
232
|
+
parameters?: TConfig["parameters"];
|
|
233
|
+
meta: {
|
|
234
|
+
alias: string;
|
|
235
|
+
hasParameters: boolean;
|
|
236
|
+
areParametersRequired: boolean;
|
|
237
|
+
};
|
|
238
|
+
response: TConfig["response"];
|
|
239
|
+
};
|
|
240
|
+
type Fetcher = (method: Method, url: string, parameters?: EndpointParameters | undefined) => Promise<Endpoint["response"]>;
|
|
241
|
+
type RequiredKeys<T> = {
|
|
242
|
+
[P in keyof T]-?: undefined extends T[P] ? never : P;
|
|
243
|
+
}[keyof T];
|
|
244
|
+
type MaybeOptionalArg<T> = RequiredKeys<T> extends never ? [config?: T] : [config: T];
|
|
245
|
+
export declare class ApiClient {
|
|
246
|
+
fetcher: Fetcher;
|
|
247
|
+
baseUrl: string;
|
|
248
|
+
constructor(fetcher: Fetcher);
|
|
249
|
+
setBaseUrl(baseUrl: string): this;
|
|
250
|
+
get<Path extends keyof GetEndpoints, TEndpoint extends GetEndpoints[Path]>(path: Path, ...params: MaybeOptionalArg<z.infer<TEndpoint["parameters"]>>): Promise<z.infer<TEndpoint["response"]>>;
|
|
251
|
+
post<Path extends keyof PostEndpoints, TEndpoint extends PostEndpoints[Path]>(path: Path, ...params: MaybeOptionalArg<z.infer<TEndpoint["parameters"]>>): Promise<z.infer<TEndpoint["response"]>>;
|
|
252
|
+
}
|
|
253
|
+
export declare function createApiClient(fetcher: Fetcher, baseUrl?: string): ApiClient;
|
|
254
|
+
export {};
|
|
255
|
+
/**
|
|
256
|
+
Example usage:
|
|
257
|
+
const api = createApiClient((method, url, params) =>
|
|
258
|
+
fetch(url, { method, body: JSON.stringify(params) }).then((res) => res.json()),
|
|
259
|
+
);
|
|
260
|
+
api.get("/users").then((users) => console.log(users));
|
|
261
|
+
api.post("/users", { body: { name: "John" } }).then((user) => console.log(user));
|
|
262
|
+
api.put("/users/:id", { path: { id: 1 }, body: { name: "John" } }).then((user) => console.log(user));
|
|
263
|
+
*/
|
|
264
|
+
//# sourceMappingURL=wallet-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-provider.d.ts","sourceRoot":"","sources":["../../../../src/client/generated/wallet-provider.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,eAAO,MAAM,eAAe;;;;;;EAE1B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAChF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAInC,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACtF,eAAO,MAAM,2BAA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CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAKtF,qBAAa,SAAS;IAGD,OAAO,EAAE,OAAO;IAFnC,OAAO,EAAE,MAAM,CAAM;gBAEF,OAAO,EAAE,OAAO;IAEnC,UAAU,CAAC,OAAO,EAAE,MAAM;IAM1B,GAAG,CAAC,IAAI,SAAS,MAAM,YAAY,EAAE,SAAS,SAAS,YAAY,CAAC,IAAI,CAAC,EACvE,IAAI,EAAE,IAAI,EACV,GAAG,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,GAC5D,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAM1C,IAAI,CAAC,IAAI,SAAS,MAAM,aAAa,EAAE,SAAS,SAAS,aAAa,CAAC,IAAI,CAAC,EAC1E,IAAI,EAAE,IAAI,EACV,GAAG,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,GAC5D,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;CAI3C;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,aAEjE;;AAED;;;;;;;;EAQE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApiClient as WalletProviderApiClient } from "./generated/wallet-provider";
|
|
2
|
+
export type WalletProviderClient = WalletProviderApiClient;
|
|
3
|
+
export declare const getWalletProviderClient: (context: {
|
|
4
|
+
walletProviderBaseUrl: string;
|
|
5
|
+
appFetch?: GlobalFetch["fetch"];
|
|
6
|
+
}) => WalletProviderApiClient;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEnF,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAuB3D,eAAO,MAAM,uBAAuB,YAAa;IAC/C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,4BAmBA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"01-start-flow.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/01-start-flow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"01-start-flow.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/01-start-flow.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC"}
|
|
@@ -7,10 +7,11 @@ export type EvaluateIssuerTrust = (issuerUrl: Out<StartFlow>["issuerUrl"], conte
|
|
|
7
7
|
issuerConf: CredentialIssuerEntityConfiguration["payload"]["metadata"];
|
|
8
8
|
}>;
|
|
9
9
|
/**
|
|
10
|
+
* WARNING: This function must be called after {@link startFlow}. The next function to be called is {@link startUserAuthorization}.
|
|
10
11
|
* The Issuer trust evaluation phase.
|
|
11
12
|
* Fetch the Issuer's configuration and verify trust.
|
|
12
13
|
*
|
|
13
|
-
* @param issuerUrl The base url of the Issuer
|
|
14
|
+
* @param issuerUrl The base url of the Issuer returned by {@link startFlow}
|
|
14
15
|
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
|
15
16
|
* @returns The Issuer's configuration
|
|
16
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"02-evaluate-issuer-trust.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/02-evaluate-issuer-trust.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG,CAChC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EACtC,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IACX,UAAU,EAAE,mCAAmC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;CACxE,CAAC,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"02-evaluate-issuer-trust.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/02-evaluate-issuer-trust.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG,CAChC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EACtC,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IACX,UAAU,EAAE,mCAAmC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;CACxE,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,mBAQjC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
|
2
|
+
import { type Out } from "../../utils/misc";
|
|
3
|
+
import type { StartFlow } from "./01-start-flow";
|
|
4
|
+
import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
|
|
5
|
+
import { type AuthorizationContext, type AuthorizationResult } from "../../utils/auth";
|
|
6
|
+
import { CredentialResponse } from "./types";
|
|
7
|
+
export type StartCredentialIssuance = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], credentialType: Out<StartFlow>["credentialType"], context: {
|
|
8
|
+
wiaCryptoContext: CryptoContext;
|
|
9
|
+
credentialCryptoContext: CryptoContext;
|
|
10
|
+
authorizationContext?: AuthorizationContext;
|
|
11
|
+
walletInstanceAttestation: string;
|
|
12
|
+
redirectUri: string;
|
|
13
|
+
idphint: string;
|
|
14
|
+
appFetch?: GlobalFetch["fetch"];
|
|
15
|
+
}) => Promise<CredentialResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Starts the credential issuance flow to obtain a credential from the issuer.
|
|
18
|
+
* @param issuerConf The Issuer configuration
|
|
19
|
+
* @param credentialType The type of the credential to be requested
|
|
20
|
+
* @param context.wiaCryptoContext The context to access the key associated with the Wallet Instance Attestation
|
|
21
|
+
* @param context.credentialCryptoContext The context to access the key to associat with credential
|
|
22
|
+
* @param context.walletInstanceAttestation The Wallet Instance Attestation token
|
|
23
|
+
* @param context.authorizationContext The context to identify the user which will be used to start the authorization. It's needed only when requesting a PersonalIdentificationData credential. The implementantion should open an in-app browser capable of catching the redirectSchema. If not specified, the default browser is used.
|
|
24
|
+
* @param context.redirectUri The internal URL to which to redirect has passed the in-app browser login phase. If you don't use authorizationContext remember to register this URL as customUrl or deepLink. See https://reactnative.dev/docs/linking
|
|
25
|
+
* @param context.idphint Unique identifier of the SPID IDP
|
|
26
|
+
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
|
27
|
+
* @throws {AuthorizationError} When the response from the authorization response is not parsable
|
|
28
|
+
* @returns The credential obtained
|
|
29
|
+
*/
|
|
30
|
+
export declare const startCredentialIssuance: StartCredentialIssuance;
|
|
31
|
+
/**
|
|
32
|
+
* Authorizes the user using the query mode and the authorization context.
|
|
33
|
+
* @param authzRequestEndpoint The authorization endpoint of the authorization server
|
|
34
|
+
* @param params The query parameters to be used in the request
|
|
35
|
+
* @param redirectUri The URL to which the redirect is made is usually a custom URL or deeplink
|
|
36
|
+
* @param authorizationContext The AuthorizationContext to manage the internal webview. If not specified, the default browser is used
|
|
37
|
+
* @returns The authrozation result containing the authorization code, state and issuer
|
|
38
|
+
*/
|
|
39
|
+
export declare const authorizeUserWithQueryMode: (authzRequestEndpoint: string, params: URLSearchParams, redirectUri: string, authorizationContext?: AuthorizationContext) => Promise<AuthorizationResult>;
|
|
40
|
+
export declare const createNonceProof: (nonce: string, issuer: string, audience: string, ctx: CryptoContext) => Promise<string>;
|
|
41
|
+
//# sourceMappingURL=03-start-credential-issuance.d.ts.map
|