@pagopa/io-react-native-wallet 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,7 @@ var _errors = require("../utils/errors");
|
|
11
11
|
var _dpop = require("../utils/dpop");
|
12
12
|
var _ioReactNativeCrypto = require("@pagopa/io-react-native-crypto");
|
13
13
|
var _metadata = require("./metadata");
|
14
|
+
var _jwk2 = require("./../utils/jwk");
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
16
|
// This is a temporary type that will be used for demo purposes only
|
16
17
|
|
@@ -115,7 +116,7 @@ class Issuing {
|
|
115
116
|
*/
|
116
117
|
async getUnsignedDPoP(jwk) {
|
117
118
|
const tokenUrl = new URL("/token", this.pidProviderBaseUrl).href;
|
118
|
-
const dPop = (0, _dpop.getUnsignedDPop)(jwk, {
|
119
|
+
const dPop = (0, _dpop.getUnsignedDPop)((0, _jwk2.fixBase64EncodingOnKey)(jwk), {
|
119
120
|
htm: "POST",
|
120
121
|
htu: tokenUrl,
|
121
122
|
jti: `${_reactNativeUuid.default.v4()}`
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_jwk","_reactNativeUuid","_interopRequireDefault","_errors","_dpop","_ioReactNativeCrypto","_metadata","obj","__esModule","default","Issuing","constructor","pidProviderBaseUrl","walletProviderBaseUrl","walletInstanceAttestation","clientId","appFetch","arguments","length","undefined","fetch","state","uuid","v4","codeVerifier","authorizationCode","getUnsignedJwtForPar","jwk","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","codeChallenge","sha256ToBase64","unsignedJwtForPar","SignJWT","client_assertion_type","authorization_details","credentialDefinition","type","format","response_type","code_challenge_method","redirect_uri","client_id","code_challenge","setProtectedHeader","alg","setIssuedAt","setExpirationTime","toSign","getPar","signature","signedJwtForPar","appendSignature","parUrl","URL","href","requestBody","client_assertion","request","formBody","URLSearchParams","response","method","headers","body","toString","status","result","json","request_uri","PidIssuingError","text","getUnsignedDPoP","tokenUrl","dPop","getUnsignedDPop","htm","htu","jti","getAuthToken","dPopKeyTag","dPopKey","generate","unsignedDPopForToken","dPopTokenSignature","sign","deleteKey","signedDPop","decodedJwtDPop","decodeJwt","payload","grant_type","code","code_verifier","DPoP","getUnsignedNonceProof","nonce","unsignedProof","setAudience","setIssuer","getCredential","unsignedDPopForPid","dPopPidSignature","unsignedNonceProof","nonceProofSignature","accessToken","cieData","signedDPopForPid","signedNonceProof","credentialUrl","credential_definition","JSON","stringify","proof","jwt","proof_type","Authorization","getEntityConfiguration","metadataUrl","jwtMetadata","PidIssuerEntityConfiguration","safeParse","success","parsedMetadata","data","verifyJwt","jwks","keys","PidMetadataError","error","message","exports"],"sourceRoot":"../../../src","sources":["pid/issuing.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_jwk","_reactNativeUuid","_interopRequireDefault","_errors","_dpop","_ioReactNativeCrypto","_metadata","_jwk2","obj","__esModule","default","Issuing","constructor","pidProviderBaseUrl","walletProviderBaseUrl","walletInstanceAttestation","clientId","appFetch","arguments","length","undefined","fetch","state","uuid","v4","codeVerifier","authorizationCode","getUnsignedJwtForPar","jwk","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","codeChallenge","sha256ToBase64","unsignedJwtForPar","SignJWT","client_assertion_type","authorization_details","credentialDefinition","type","format","response_type","code_challenge_method","redirect_uri","client_id","code_challenge","setProtectedHeader","alg","setIssuedAt","setExpirationTime","toSign","getPar","signature","signedJwtForPar","appendSignature","parUrl","URL","href","requestBody","client_assertion","request","formBody","URLSearchParams","response","method","headers","body","toString","status","result","json","request_uri","PidIssuingError","text","getUnsignedDPoP","tokenUrl","dPop","getUnsignedDPop","fixBase64EncodingOnKey","htm","htu","jti","getAuthToken","dPopKeyTag","dPopKey","generate","unsignedDPopForToken","dPopTokenSignature","sign","deleteKey","signedDPop","decodedJwtDPop","decodeJwt","payload","grant_type","code","code_verifier","DPoP","getUnsignedNonceProof","nonce","unsignedProof","setAudience","setIssuer","getCredential","unsignedDPopForPid","dPopPidSignature","unsignedNonceProof","nonceProofSignature","accessToken","cieData","signedDPopForPid","signedNonceProof","credentialUrl","credential_definition","JSON","stringify","proof","jwt","proof_type","Authorization","getEntityConfiguration","metadataUrl","jwtMetadata","PidIssuerEntityConfiguration","safeParse","success","parsedMetadata","data","verifyJwt","jwks","keys","PidMetadataError","error","message","exports"],"sourceRoot":"../../../src","sources":["pid/issuing.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAAwD,SAAAG,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAExD;;AAgBO,MAAMG,OAAO,CAAC;EAUnBC,WAAWA,CACTC,kBAA0B,EAC1BC,qBAA6B,EAC7BC,yBAAiC,EACjCC,QAAgB,EAEhB;IAAA,IADAC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;IAEtC,IAAI,CAACR,kBAAkB,GAAGA,kBAAkB;IAC5C,IAAI,CAACC,qBAAqB,GAAGA,qBAAq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CAAA,EAA0C;IACpE,MAAMC,WAAW,GAAG,IAAIjE,GAAG,CACzB,kCAAkC,EAClC,IAAI,CAAC/C,kBACP,CAAC,CAACgD,IAAI;IAEN,MAAMM,QAAQ,GAAG,MAAM,IAAI,CAAClD,QAAQ,CAAC4G,WAAW,CAAC;IAEjD,IAAI1D,QAAQ,CAACK,MAAM,KAAK,GAAG,EAAE;MAC3B,MAAMsD,WAAW,GAAG,MAAM3D,QAAQ,CAACU,IAAI,CAAC,CAAC;MACzC,MAAM;QAAEoB;MAAQ,CAAC,GAAG,IAAAD,wBAAS,EAAC8B,WAAW,CAAC;MAC1C,MAAMrD,MAAM,GAAGsD,sCAA4B,CAACC,SAAS,CAAC/B,OAAO,CAAC;MAC9D,IAAIxB,MAAM,CAACwD,OAAO,EAAE;QAClB,MAAMC,cAAc,GAAGzD,MAAM,CAAC0D,IAAI;QAClC,MAAM,IAAAC,wBAAS,EAACN,WAAW,EAAEI,cAAc,CAACG,IAAI,CAACC,IAAI,CAAC;QACtD,OAAOJ,cAAc;MACvB,CAAC,MAAM;QACL,MAAM,IAAIK,wBAAgB,CAAC9D,MAAM,CAAC+D,KAAK,CAACC,OAAO,CAAC;MAClD;IACF;IAEA,MAAM,IAAIF,wBAAgB,CACvB,4CAA2C,MAAMpE,QAAQ,CAACU,IAAI,CAAC,CAAE,iBAChEV,QAAQ,CAACK,MACV,EACH,CAAC;EACH;AACF;AAACkE,OAAA,CAAA/H,OAAA,GAAAA,OAAA"}
|
@@ -6,6 +6,7 @@ import { PidIssuingError, PidMetadataError } from "../utils/errors";
|
|
6
6
|
import { getUnsignedDPop } from "../utils/dpop";
|
7
7
|
import { sign, generate, deleteKey } from "@pagopa/io-react-native-crypto";
|
8
8
|
import { PidIssuerEntityConfiguration } from "./metadata";
|
9
|
+
import { fixBase64EncodingOnKey } from "./../utils/jwk";
|
9
10
|
|
10
11
|
// This is a temporary type that will be used for demo purposes only
|
11
12
|
|
@@ -110,7 +111,7 @@ export class Issuing {
|
|
110
111
|
*/
|
111
112
|
async getUnsignedDPoP(jwk) {
|
112
113
|
const tokenUrl = new URL("/token", this.pidProviderBaseUrl).href;
|
113
|
-
const dPop = getUnsignedDPop(jwk, {
|
114
|
+
const dPop = getUnsignedDPop(fixBase64EncodingOnKey(jwk), {
|
114
115
|
htm: "POST",
|
115
116
|
htu: tokenUrl,
|
116
117
|
jti: `${uuid.v4()}`
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["decode","decodeJwt","verify","verifyJwt","sha256ToBase64","SignJWT","thumbprint","JWK","uuid","PidIssuingError","PidMetadataError","getUnsignedDPop","sign","generate","deleteKey","PidIssuerEntityConfiguration","Issuing","constructor","pidProviderBaseUrl","walletProviderBaseUrl","walletInstanceAttestation","clientId","appFetch","arguments","length","undefined","fetch","state","v4","codeVerifier","authorizationCode","getUnsignedJwtForPar","jwk","parsedJwk","parse","keyThumbprint","publicKey","kid","codeChallenge","unsignedJwtForPar","client_assertion_type","authorization_details","credentialDefinition","type","format","response_type","code_challenge_method","redirect_uri","client_id","code_challenge","setProtectedHeader","alg","setIssuedAt","setExpirationTime","toSign","getPar","signature","signedJwtForPar","appendSignature","parUrl","URL","href","requestBody","client_assertion","request","formBody","URLSearchParams","response","method","headers","body","toString","status","result","json","request_uri","text","getUnsignedDPoP","tokenUrl","dPop","htm","htu","jti","getAuthToken","dPopKeyTag","dPopKey","unsignedDPopForToken","dPopTokenSignature","signedDPop","decodedJwtDPop","payload","grant_type","code","code_verifier","DPoP","getUnsignedNonceProof","nonce","unsignedProof","setAudience","setIssuer","getCredential","unsignedDPopForPid","dPopPidSignature","unsignedNonceProof","nonceProofSignature","accessToken","cieData","signedDPopForPid","signedNonceProof","credentialUrl","credential_definition","JSON","stringify","proof","jwt","proof_type","Authorization","getEntityConfiguration","metadataUrl","jwtMetadata","safeParse","success","parsedMetadata","data","jwks","keys","error","message"],"sourceRoot":"../../../src","sources":["pid/issuing.ts"],"mappings":"AAAA,SACEA,MAAM,IAAIC,SAAS,EACnBC,MAAM,IAAIC,SAAS,EACnBC,cAAc,QACT,6BAA6B;AAEpC,SAASC,OAAO,EAAEC,UAAU,QAAQ,6BAA6B;AACjE,SAASC,GAAG,QAAQ,cAAc;AAClC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,iBAAiB;AACnE,SAASC,eAAe,QAAQ,eAAe;AAC/C,SAASC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,gCAAgC;AAC1E,SAASC,4BAA4B,QAAQ,YAAY;;
|
1
|
+
{"version":3,"names":["decode","decodeJwt","verify","verifyJwt","sha256ToBase64","SignJWT","thumbprint","JWK","uuid","PidIssuingError","PidMetadataError","getUnsignedDPop","sign","generate","deleteKey","PidIssuerEntityConfiguration","fixBase64EncodingOnKey","Issuing","constructor","pidProviderBaseUrl","walletProviderBaseUrl","walletInstanceAttestation","clientId","appFetch","arguments","length","undefined","fetch","state","v4","codeVerifier","authorizationCode","getUnsignedJwtForPar","jwk","parsedJwk","parse","keyThumbprint","publicKey","kid","codeChallenge","unsignedJwtForPar","client_assertion_type","authorization_details","credentialDefinition","type","format","response_type","code_challenge_method","redirect_uri","client_id","code_challenge","setProtectedHeader","alg","setIssuedAt","setExpirationTime","toSign","getPar","signature","signedJwtForPar","appendSignature","parUrl","URL","href","requestBody","client_assertion","request","formBody","URLSearchParams","response","method","headers","body","toString","status","result","json","request_uri","text","getUnsignedDPoP","tokenUrl","dPop","htm","htu","jti","getAuthToken","dPopKeyTag","dPopKey","unsignedDPopForToken","dPopTokenSignature","signedDPop","decodedJwtDPop","payload","grant_type","code","code_verifier","DPoP","getUnsignedNonceProof","nonce","unsignedProof","setAudience","setIssuer","getCredential","unsignedDPopForPid","dPopPidSignature","unsignedNonceProof","nonceProofSignature","accessToken","cieData","signedDPopForPid","signedNonceProof","credentialUrl","credential_definition","JSON","stringify","proof","jwt","proof_type","Authorization","getEntityConfiguration","metadataUrl","jwtMetadata","safeParse","success","parsedMetadata","data","jwks","keys","error","message"],"sourceRoot":"../../../src","sources":["pid/issuing.ts"],"mappings":"AAAA,SACEA,MAAM,IAAIC,SAAS,EACnBC,MAAM,IAAIC,SAAS,EACnBC,cAAc,QACT,6BAA6B;AAEpC,SAASC,OAAO,EAAEC,UAAU,QAAQ,6BAA6B;AACjE,SAASC,GAAG,QAAQ,cAAc;AAClC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,iBAAiB;AACnE,SAASC,eAAe,QAAQ,eAAe;AAC/C,SAASC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,gCAAgC;AAC1E,SAASC,4BAA4B,QAAQ,YAAY;AACzD,SAASC,sBAAsB,QAAQ,gBAAgB;;AAEvD;;AAgBA,OAAO,MAAMC,OAAO,CAAC;EAUnBC,WAAWA,CACTC,kBAA0B,EAC1BC,qBAA6B,EAC7BC,yBAAiC,EACjCC,QAAgB,EAEhB;IAAA,IADAC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;IAEtC,IAAI,CAACR,kBAAkB,GAAGA,kBAAkB;IAC5C,IAAI,CAACC,qBAAqB,GAAGA,qBAAqB;IAClD,IAAI,CAACQ,KAAK,GAAI,GAAEpB,IAAI,CAACqB,EAAE,CAAC,CAAE,EAAC;IAC3B,IAAI,CAACC,YAAY,GAAI,GAAEtB,IAAI,CAACqB,EAAE,CAAC,CAAE,EAAC;IAClC,IAAI,CAACE,iBAAiB,GAAI,GAAEvB,IAAI,CAACqB,EAAE,CAAC,CAAE,EAAC;IACvC,IAAI,CAACR,yBAAyB,GAAGA,yBAAyB;IAC1D,IAAI,CAACC,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC1B;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMS,oBAAoBA,CAACC,G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D,OAAO,EAAE;QAClB,MAAMC,cAAc,GAAGjD,MAAM,CAACkD,IAAI;QAClC,MAAMzH,SAAS,CAACqH,WAAW,EAAEG,cAAc,CAACE,IAAI,CAACC,IAAI,CAAC;QACtD,OAAOH,cAAc;MACvB,CAAC,MAAM;QACL,MAAM,IAAIjH,gBAAgB,CAACgE,MAAM,CAACqD,KAAK,CAACC,OAAO,CAAC;MAClD;IACF;IAEA,MAAM,IAAItH,gBAAgB,CACvB,4CAA2C,MAAM0D,QAAQ,CAACS,IAAI,CAAC,CAAE,iBAChET,QAAQ,CAACK,MACV,EACH,CAAC;EACH;AACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/pid/issuing.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKnC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/pid/issuing.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKnC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAI1D,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AACtE,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,OAAO;IAClB,kBAAk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idMetadataError } from "../utils/errors";
|
|
11
11
|
import { getUnsignedDPop } from "../utils/dpop";
|
12
12
|
import { sign, generate, deleteKey } from "@pagopa/io-react-native-crypto";
|
13
13
|
import { PidIssuerEntityConfiguration } from "./metadata";
|
14
|
+
import { fixBase64EncodingOnKey } from "./../utils/jwk";
|
14
15
|
|
15
16
|
// This is a temporary type that will be used for demo purposes only
|
16
17
|
export type CieData = {
|
@@ -161,7 +162,7 @@ export class Issuing {
|
|
161
162
|
*/
|
162
163
|
async getUnsignedDPoP(jwk: JWK): Promise<string> {
|
163
164
|
const tokenUrl = new URL("/token", this.pidProviderBaseUrl).href;
|
164
|
-
const dPop = getUnsignedDPop(jwk, {
|
165
|
+
const dPop = getUnsignedDPop(fixBase64EncodingOnKey(jwk), {
|
165
166
|
htm: "POST",
|
166
167
|
htu: tokenUrl,
|
167
168
|
jti: `${uuid.v4()}`,
|