@pagopa/io-react-native-wallet 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. package/README.md +52 -19
  2. package/lib/commonjs/index.js +13 -24
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/pid/issuing.js +22 -28
  5. package/lib/commonjs/pid/issuing.js.map +1 -1
  6. package/lib/commonjs/rp/__test__/index.test.js +2 -2
  7. package/lib/commonjs/rp/__test__/index.test.js.map +1 -1
  8. package/lib/commonjs/rp/index.js +5 -19
  9. package/lib/commonjs/rp/index.js.map +1 -1
  10. package/lib/commonjs/rp/types.js +1 -21
  11. package/lib/commonjs/rp/types.js.map +1 -1
  12. package/lib/commonjs/trust/index.js +24 -5
  13. package/lib/commonjs/trust/index.js.map +1 -1
  14. package/lib/commonjs/trust/types.js +95 -4
  15. package/lib/commonjs/trust/types.js.map +1 -1
  16. package/lib/commonjs/wallet-instance-attestation/issuing.js +5 -13
  17. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  18. package/lib/module/index.js +2 -5
  19. package/lib/module/index.js.map +1 -1
  20. package/lib/module/pid/issuing.js +16 -23
  21. package/lib/module/pid/issuing.js.map +1 -1
  22. package/lib/module/rp/__test__/index.test.js +2 -2
  23. package/lib/module/rp/__test__/index.test.js.map +1 -1
  24. package/lib/module/rp/index.js +2 -17
  25. package/lib/module/rp/index.js.map +1 -1
  26. package/lib/module/rp/types.js +0 -20
  27. package/lib/module/rp/types.js.map +1 -1
  28. package/lib/module/trust/index.js +19 -5
  29. package/lib/module/trust/index.js.map +1 -1
  30. package/lib/module/trust/types.js +94 -2
  31. package/lib/module/trust/types.js.map +1 -1
  32. package/lib/module/wallet-instance-attestation/issuing.js +5 -13
  33. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  34. package/lib/typescript/index.d.ts +2 -5
  35. package/lib/typescript/index.d.ts.map +1 -1
  36. package/lib/typescript/pid/issuing.d.ts +3 -12
  37. package/lib/typescript/pid/issuing.d.ts.map +1 -1
  38. package/lib/typescript/rp/index.d.ts +4 -12
  39. package/lib/typescript/rp/index.d.ts.map +1 -1
  40. package/lib/typescript/rp/types.d.ts +4 -1256
  41. package/lib/typescript/rp/types.d.ts.map +1 -1
  42. package/lib/typescript/trust/index.d.ts +806 -3
  43. package/lib/typescript/trust/index.d.ts.map +1 -1
  44. package/lib/typescript/trust/types.d.ts +8637 -5
  45. package/lib/typescript/trust/types.d.ts.map +1 -1
  46. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +2 -1
  47. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  48. package/lib/typescript/wallet-instance-attestation/types.d.ts +4 -4
  49. package/package.json +1 -1
  50. package/src/index.ts +11 -12
  51. package/src/pid/issuing.ts +24 -30
  52. package/src/rp/__test__/index.test.ts +2 -2
  53. package/src/rp/index.ts +8 -22
  54. package/src/rp/types.ts +0 -24
  55. package/src/trust/index.ts +106 -5
  56. package/src/trust/types.ts +114 -3
  57. package/src/wallet-instance-attestation/issuing.ts +10 -15
  58. package/lib/commonjs/pid/metadata.js +0 -52
  59. package/lib/commonjs/pid/metadata.js.map +0 -1
  60. package/lib/module/pid/metadata.js +0 -44
  61. package/lib/module/pid/metadata.js.map +0 -1
  62. package/lib/typescript/pid/metadata.d.ts +0 -1412
  63. package/lib/typescript/pid/metadata.d.ts.map +0 -1
  64. package/src/pid/metadata.ts +0 -51
@@ -1 +1 @@
1
- {"version":3,"names":["_jwk","require","_types","z","_interopRequireWildcard","_types2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","RequestObject","object","header","typ","literal","optional","alg","string","kid","trust_chain","array","payload","iss","iat","UnixTime","exp","state","nonce","response_uri","response_type","response_mode","client_id","client_id_scheme","scope","exports","RpEntityConfiguration","EntityConfiguration","and","metadata","wallet_relying_party","application_type","client_name","jwks","JWK","contacts","passthrough","QRCodePayload","protocol","resource","clientId","requestURI"],"sourceRoot":"../../../src","sources":["rp/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAAqD,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,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AAG,CAC1DpD,CAAC,CAAC0B,MAAM,CAAC;EACPU,OAAO,EAAEpC,CAAC,CAAC0B,MAAM,CAAC;IAChB2B,QAAQ,EAAErD,CAAC,CAAC0B,MAAM,CAAC;MACjB4B,oBAAoB,EAAEtD,CAAC,CACpB0B,MAAM,CAAC;QACN6B,gBAAgB,EAAEvD,CAAC,CAACgC,MAAM,CAAC,CAAC,CAACF,QAAQ,CAAC,CAAC;QACvCgB,SAAS,EAAE9C,CAAC,CAACgC,MAAM,CAAC,CAAC,CAACF,QAAQ,CAAC,CAAC;QAChC0B,WAAW,EAAExD,CAAC,CAACgC,MAAM,CAAC,CAAC,CAACF,QAAQ,CAAC,CAAC;QAClC2B,IAAI,EAAEzD,CAAC,CAACmC,KAAK,CAACuB,QAAG,CAAC;QAClBC,QAAQ,EAAE3D,CAAC,CAACmC,KAAK,CAACnC,CAAC,CAACgC,MAAM,CAAC,CAAC,CAAC,CAACF,QAAQ,CAAC;MACzC,CAAC,CAAC,CACD8B,WAAW,CAAC;IACjB,CAAC;EACH,CAAC;AACH,CAAC,CACH,CAAC;AAACX,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAGK,MAAMW,aAAa,GAAG7D,CAAC,CAAC0B,MAAM,CAAC;EACpCoC,QAAQ,EAAE9D,CAAC,CAACgC,MAAM,CAAC,CAAC;EACpB+B,QAAQ,EAAE/D,CAAC,CAACgC,MAAM,CAAC,CAAC;EAAE;EACtBgC,QAAQ,EAAEhE,CAAC,CAACgC,MAAM,CAAC,CAAC;EACpBiC,UAAU,EAAEjE,CAAC,CAACgC,MAAM,CAAC;AACvB,CAAC,CAAC;;AAEF;AACA;AACA;AAFAiB,OAAA,CAAAY,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_types","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","RequestObject","object","header","typ","literal","optional","alg","string","kid","trust_chain","array","payload","iss","iat","UnixTime","exp","state","nonce","response_uri","response_type","response_mode","client_id","client_id_scheme","scope","exports","QRCodePayload","protocol","resource","clientId","requestURI"],"sourceRoot":"../../../src","sources":["rp/types.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAyB,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,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AAa,GAAGjD,CAAC,CAACyB,MAAM,CAAC;EACpCyB,QAAQ,EAAElD,CAAC,CAAC+B,MAAM,CAAC,CAAC;EACpBoB,QAAQ,EAAEnD,CAAC,CAAC+B,MAAM,CAAC,CAAC;EAAE;EACtBqB,QAAQ,EAAEpD,CAAC,CAAC+B,MAAM,CAAC,CAAC;EACpBsB,UAAU,EAAErD,CAAC,CAAC+B,MAAM,CAAC;AACvB,CAAC,CAAC;;AAEF;AACA;AACA;AAFAiB,OAAA,CAAAC,aAAA,GAAAA,aAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getEntityConfiguration = getEntityConfiguration;
6
+ exports.getWalletProviderEntityConfiguration = exports.getTrustAnchorEntityConfiguration = exports.getRelyingPartyEntityConfiguration = exports.getEntityConfiguration = exports.getCredentialIssuerEntityConfiguration = void 0;
7
7
  Object.defineProperty(exports, "verifyTrustChain", {
8
8
  enumerable: true,
9
9
  get: function () {
@@ -15,18 +15,27 @@ var _types = require("./types");
15
15
  var _errors = require("../utils/errors");
16
16
  var _chain = require("./chain");
17
17
  /**
18
- * Fetch and parse teh entity configuration document for a given federation entity
18
+ * Fetch and parse the entity configuration document for a given federation entity.
19
+ * This is an inner method to serve public interfaces.
20
+ *
21
+ * To add another entity configuration type (example: Foo entity type):
22
+ * - create its zod schema and type by inherit from the base type (example: FooEntityConfiguration = BaseEntityConfiguration.and(...))
23
+ * - add such type to EntityConfiguration union
24
+ * - add an overload to this function
25
+ * - create a public function which use such type (example: getFooEntityConfiguration = (url, options) => Promise<FooEntityConfiguration>)
19
26
  *
20
27
  * @param entityBaseUrl The base url of the entity.
28
+ * @param schema The expected schema of the entity configuration, according to the kind of entity we are fetching from.
21
29
  * @param options.appFetch An optional instance of the http client to be used.
22
30
  * @returns The parsed entity configuration object
23
31
  * @throws {IoWalletError} If the http request fails
24
32
  * @throws Parse error if the document is not in the expected shape.
25
33
  */
26
- async function getEntityConfiguration(entityBaseUrl) {
34
+
35
+ async function fetchAndParseEntityConfiguration(entityBaseUrl, schema) {
27
36
  let {
28
37
  appFetch = fetch
29
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
38
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
30
39
  const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-federation`;
31
40
  const response = await appFetch(wellKnownUrl, {
32
41
  method: "GET"
@@ -34,11 +43,21 @@ async function getEntityConfiguration(entityBaseUrl) {
34
43
  if (response.status === 200) {
35
44
  const responseText = await response.text();
36
45
  const responseJwt = (0, _ioReactNativeJwt.decode)(responseText);
37
- return _types.EntityConfiguration.parse({
46
+ return schema.parse({
38
47
  header: responseJwt.protectedHeader,
39
48
  payload: responseJwt.payload
40
49
  });
41
50
  }
42
51
  throw new _errors.IoWalletError(`Unable to obtain Entity Configuration at ${wellKnownUrl}. Response code: ${response.status}`);
43
52
  }
53
+ const getWalletProviderEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.WalletProviderEntityConfiguration, options);
54
+ exports.getWalletProviderEntityConfiguration = getWalletProviderEntityConfiguration;
55
+ const getCredentialIssuerEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.CredentialIssuerEntityConfiguration, options);
56
+ exports.getCredentialIssuerEntityConfiguration = getCredentialIssuerEntityConfiguration;
57
+ const getTrustAnchorEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.TrustAnchorEntityConfiguration, options);
58
+ exports.getTrustAnchorEntityConfiguration = getTrustAnchorEntityConfiguration;
59
+ const getRelyingPartyEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.RelyingPartyEntityConfiguration, options);
60
+ exports.getRelyingPartyEntityConfiguration = getRelyingPartyEntityConfiguration;
61
+ const getEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.EntityConfiguration, options);
62
+ exports.getEntityConfiguration = getEntityConfiguration;
44
63
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_types","_errors","_chain","getEntityConfiguration","entityBaseUrl","appFetch","fetch","arguments","length","undefined","wellKnownUrl","response","method","status","responseText","text","responseJwt","decodeJwt","EntityConfiguration","parse","header","protectedHeader","payload","IoWalletError"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeI,sBAAsBA,CAC1CC,aAAqB,EAMS;EAAA,IAL9B;IACEC,QAAQ,GAAGC;EAGb,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEN,MAAMG,YAAY,GAAI,GAAEN,aAAc,gCAA+B;EAErE,MAAMO,QAAQ,GAAG,MAAMN,QAAQ,CAACK,YAAY,EAAE;IAC5CE,MAAM,EAAE;EACV,CAAC,CAAC;EAEF,IAAID,QAAQ,CAACE,MAAM,KAAK,GAAG,EAAE;IAC3B,MAAMC,YAAY,GAAG,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;IAC1C,MAAMC,WAAW,GAAG,IAAAC,wBAAS,EAACH,YAAY,CAAC;IAC3C,OAAOI,0BAAmB,CAACC,KAAK,CAAC;MAC/BC,MAAM,EAAEJ,WAAW,CAACK,eAAe;MACnCC,OAAO,EAAEN,WAAW,CAACM;IACvB,CAAC,CAAC;EACJ;EAEA,MAAM,IAAIC,qBAAa,CACpB,4CAA2Cb,YAAa,oBAAmBC,QAAQ,CAACE,MAAO,EAC9F,CAAC;AACH"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_types","_errors","_chain","fetchAndParseEntityConfiguration","entityBaseUrl","schema","appFetch","fetch","arguments","length","undefined","wellKnownUrl","response","method","status","responseText","text","responseJwt","decodeJwt","parse","header","protectedHeader","payload","IoWalletError","getWalletProviderEntityConfiguration","options","WalletProviderEntityConfiguration","exports","getCredentialIssuerEntityConfiguration","CredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","TrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","RelyingPartyEntityConfiguration","getEntityConfiguration","EntityConfiguration"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAOA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoCA,eAAeI,gCAAgCA,CAC7CC,aAAqB,EACrBC,MAK8B,EAM9B;EAAA,IALA;IACEC,QAAQ,GAAGC;EAGb,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEN,MAAMG,YAAY,GAAI,GAAEP,aAAc,gCAA+B;EAErE,MAAMQ,QAAQ,GAAG,MAAMN,QAAQ,CAACK,YAAY,EAAE;IAC5CE,MAAM,EAAE;EACV,CAAC,CAAC;EAEF,IAAID,QAAQ,CAACE,MAAM,KAAK,GAAG,EAAE;IAC3B,MAAMC,YAAY,GAAG,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;IAC1C,MAAMC,WAAW,GAAG,IAAAC,wBAAS,EAACH,YAAY,CAAC;IAC3C,OAAOV,MAAM,CAACc,KAAK,CAAC;MAClBC,MAAM,EAAEH,WAAW,CAACI,eAAe;MACnCC,OAAO,EAAEL,WAAW,CAACK;IACvB,CAAC,CAAC;EACJ;EAEA,MAAM,IAAIC,qBAAa,CACpB,4CAA2CZ,YAAa,oBAAmBC,QAAQ,CAACE,MAAO,EAC9F,CAAC;AACH;AAEO,MAAMU,oCAAoC,GAAGA,CAClDpB,aAAqE,EACrEqB,OAAgE,KAEhEtB,gCAAgC,CAC9BC,aAAa,EACbsB,wCAAiC,EACjCD,OACF,CAAC;AAACE,OAAA,CAAAH,oCAAA,GAAAA,oCAAA;AAEG,MAAMI,sCAAsC,GAAGA,CACpDxB,aAAqE,EACrEqB,OAAgE,KAEhEtB,gCAAgC,CAC9BC,aAAa,EACbyB,0CAAmC,EACnCJ,OACF,CAAC;AAACE,OAAA,CAAAC,sCAAA,GAAAA,sCAAA;AAEG,MAAME,iCAAiC,GAAGA,CAC/C1B,aAAqE,EACrEqB,OAAgE,KAEhEtB,gCAAgC,CAC9BC,aAAa,EACb2B,qCAA8B,EAC9BN,OACF,CAAC;AAACE,OAAA,CAAAG,iCAAA,GAAAA,iCAAA;AAEG,MAAME,kCAAkC,GAAGA,CAChD5B,aAAqE,EACrEqB,OAAgE,KAEhEtB,gCAAgC,CAC9BC,aAAa,EACb6B,sCAA+B,EAC/BR,OACF,CAAC;AAACE,OAAA,CAAAK,kCAAA,GAAAA,kCAAA;AAEG,MAAME,sBAAsB,GAAGA,CACpC9B,aAAqE,EACrEqB,OAAgE,KAEhEtB,gCAAgC,CAACC,aAAa,EAAE+B,0BAAmB,EAAEV,OAAO,CAAC;AAACE,OAAA,CAAAO,sBAAA,GAAAA,sBAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TrustMark = exports.TrustAnchorEntityConfiguration = exports.EntityStatement = exports.EntityConfigurationHeader = exports.EntityConfiguration = void 0;
6
+ exports.WalletProviderEntityConfiguration = exports.TrustMark = exports.TrustAnchorEntityConfiguration = exports.RelyingPartyEntityConfiguration = exports.EntityStatement = exports.EntityConfigurationHeader = exports.EntityConfiguration = exports.CredentialIssuerEntityConfiguration = void 0;
7
7
  var _types = require("../sd-jwt/types");
8
8
  var _jwk = require("../utils/jwk");
9
9
  var z = _interopRequireWildcard(require("zod"));
@@ -13,7 +13,29 @@ const TrustMark = z.object({
13
13
  id: z.string(),
14
14
  trust_mark: z.string()
15
15
  });
16
+
17
+ // Display metadata for a credential, used by the issuer to
18
+ // instruct the Wallet Solution on how to render the credential correctly
16
19
  exports.TrustMark = TrustMark;
20
+ const CredentialDisplayMetadata = z.object({
21
+ name: z.string(),
22
+ locale: z.string(),
23
+ logo: z.object({
24
+ url: z.string(),
25
+ alt_text: z.string()
26
+ }),
27
+ background_color: z.string(),
28
+ text_color: z.string()
29
+ });
30
+
31
+ // Metadata for a credentia which i supported by a Issuer
32
+
33
+ const SupportedCredentialMetadata = z.object({
34
+ format: z.literal("vc+sd-jwt"),
35
+ cryptographic_binding_methods_supported: z.array(z.string()),
36
+ cryptographic_suites_supported: z.array(z.string()),
37
+ display: z.array(CredentialDisplayMetadata)
38
+ });
17
39
  const EntityStatement = z.object({
18
40
  header: z.object({
19
41
  typ: z.literal("entity-statement+jwt"),
@@ -37,8 +59,10 @@ const EntityConfigurationHeader = z.object({
37
59
  alg: z.string(),
38
60
  kid: z.string()
39
61
  });
62
+
63
+ // Structuire common to every Entity Configuration document
40
64
  exports.EntityConfigurationHeader = EntityConfigurationHeader;
41
- const EntityConfiguration = z.object({
65
+ const BaseEntityConfiguration = z.object({
42
66
  header: EntityConfigurationHeader,
43
67
  payload: z.object({
44
68
  exp: _types.UnixTime,
@@ -64,7 +88,74 @@ const EntityConfiguration = z.object({
64
88
  authority_hints: z.array(z.string()).optional()
65
89
  }).passthrough()
66
90
  });
67
- exports.EntityConfiguration = EntityConfiguration;
68
- const TrustAnchorEntityConfiguration = EntityConfiguration;
91
+
92
+ // Entity configuration for a Trust Anchor (it has no specific metadata section)
93
+
94
+ const TrustAnchorEntityConfiguration = BaseEntityConfiguration;
95
+
96
+ // Entity configuration for a Credential Issuer
69
97
  exports.TrustAnchorEntityConfiguration = TrustAnchorEntityConfiguration;
98
+ const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(z.object({
99
+ payload: z.object({
100
+ jwks: z.object({
101
+ keys: z.array(_jwk.JWK)
102
+ }),
103
+ metadata: z.object({
104
+ openid_credential_issuer: z.object({
105
+ credential_issuer: z.string(),
106
+ authorization_endpoint: z.string(),
107
+ token_endpoint: z.string(),
108
+ pushed_authorization_request_endpoint: z.string(),
109
+ dpop_signing_alg_values_supported: z.array(z.string()),
110
+ credential_endpoint: z.string(),
111
+ credentials_supported: z.array(SupportedCredentialMetadata),
112
+ jwks: z.object({
113
+ keys: z.array(_jwk.JWK)
114
+ })
115
+ })
116
+ })
117
+ })
118
+ }));
119
+
120
+ // Entity configuration for a Wallet Provider
121
+ exports.CredentialIssuerEntityConfiguration = CredentialIssuerEntityConfiguration;
122
+ const WalletProviderEntityConfiguration = BaseEntityConfiguration.and(z.object({
123
+ payload: z.object({
124
+ metadata: z.object({
125
+ wallet_provider: z.object({
126
+ token_endpoint: z.string(),
127
+ attested_security_context_values_supported: z.array(z.string()).optional(),
128
+ grant_types_supported: z.array(z.string()),
129
+ token_endpoint_auth_methods_supported: z.array(z.string()),
130
+ token_endpoint_auth_signing_alg_values_supported: z.array(z.string()),
131
+ jwks: z.object({
132
+ keys: z.array(_jwk.JWK)
133
+ })
134
+ }).passthrough()
135
+ })
136
+ })
137
+ }));
138
+
139
+ // Entity configuration for a Relying Party
140
+ exports.WalletProviderEntityConfiguration = WalletProviderEntityConfiguration;
141
+ const RelyingPartyEntityConfiguration = BaseEntityConfiguration.and(z.object({
142
+ payload: z.object({
143
+ metadata: z.object({
144
+ wallet_relying_party: z.object({
145
+ application_type: z.string().optional(),
146
+ client_id: z.string().optional(),
147
+ client_name: z.string().optional(),
148
+ jwks: z.array(_jwk.JWK),
149
+ contacts: z.array(z.string()).optional()
150
+ }).passthrough()
151
+ })
152
+ })
153
+ }));
154
+
155
+ // Maps any entity configuration by the union of every possible shapes
156
+ exports.RelyingPartyEntityConfiguration = RelyingPartyEntityConfiguration;
157
+ const EntityConfiguration = z.union([WalletProviderEntityConfiguration, CredentialIssuerEntityConfiguration, TrustAnchorEntityConfiguration, RelyingPartyEntityConfiguration], {
158
+ description: "Any kind of Entity Configuration allowed in the ecosystem"
159
+ });
160
+ exports.EntityConfiguration = EntityConfiguration;
70
161
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_jwk","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","TrustMark","object","id","string","trust_mark","exports","EntityStatement","header","typ","literal","alg","kid","payload","iss","sub","jwks","keys","array","JWK","trust_marks","iat","number","exp","EntityConfigurationHeader","EntityConfiguration","UnixTime","metadata","federation_entity","federation_fetch_endpoint","optional","federation_list_endpoint","federation_resolve_endpoint","federation_trust_mark_status_endpoint","federation_trust_mark_list_endpoint","homepage_uri","policy_uri","logo_uri","contacts","passthrough","authority_hints","TrustAnchorEntityConfiguration"],"sourceRoot":"../../../src","sources":["trust/types.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAC,uBAAA,CAAAH,OAAA;AAAyB,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QA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BAAA,GAAAA,8BAAA"}
1
+ {"version":3,"names":["_types","require","_jwk","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","TrustMark","object","id","string","trust_mark","exports","CredentialDisplayMetadata","name","locale","logo","url","alt_text","background_color","text_color","SupportedCredentialMetadata","format","literal","cryptographic_binding_methods_supported","array","cryptographic_suites_supported","display","EntityStatement","header","typ","alg","kid","payload","iss","sub","jwks","keys","JWK","trust_marks","iat","number","exp","EntityConfigurationHeader","BaseEntityConfiguration","UnixTime","metadata","federation_entity","federation_fetch_endpoint","optional","federation_list_endpoint","federation_resolve_endpoint","federation_trust_mark_status_endpoint","federation_trust_mark_list_endpoint","homepage_uri","policy_uri","logo_uri","contacts","passthrough","authority_hints","TrustAnchorEntityConfiguration","CredentialIssuerEntityConfiguration","and","openid_credential_issuer","credential_issuer","authorization_endpoint","token_endpoint","pushed_authorization_request_endpoint","dpop_signing_alg_values_supported","credential_endpoint","credentials_supported","WalletProviderEntityConfiguration","wallet_provider","attested_security_context_values_supported","grant_types_supported","token_endpoint_auth_methods_supported","token_endpoint_auth_signing_alg_values_supported","RelyingPartyEntityConfiguration","wallet_relying_party","application_type","client_id","client_name","EntityConfiguration","union","description"],"sourceRoot":"../../../src","sources":["trust/types.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAC,uBAAA,CAAAH,OAAA;AAAyB,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAA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K,mBAAmB,GAAGnG,CAAC,CAACoG,KAAK,CACxC,CACEZ,iCAAiC,EACjCV,mCAAmC,EACnCD,8BAA8B,EAC9BiB,+BAA+B,CAChC,EACD;EACEO,WAAW,EAAE;AACf,CACF,CAAC;AAACxE,OAAA,CAAAsE,mBAAA,GAAAA,mBAAA"}
@@ -10,7 +10,7 @@ var _types = require("./types");
10
10
  var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
11
11
  var _errors = require("../utils/errors");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- async function getAttestationRequest(wiaCryptoContext, walletProviderBaseUrl) {
13
+ async function getAttestationRequest(wiaCryptoContext, walletProviderEntityConfiguration) {
14
14
  const jwk = await wiaCryptoContext.getPublicKey();
15
15
  const parsedJwk = _jwk.JWK.parse(jwk);
16
16
  const keyThumbprint = await (0, _ioReactNativeJwt.thumbprint)(parsedJwk);
@@ -20,7 +20,7 @@ async function getAttestationRequest(wiaCryptoContext, walletProviderBaseUrl) {
20
20
  };
21
21
  return new _ioReactNativeJwt.SignJWT(wiaCryptoContext).setPayload({
22
22
  iss: keyThumbprint,
23
- aud: walletProviderBaseUrl,
23
+ aud: walletProviderEntityConfiguration.payload.iss,
24
24
  jti: `${_reactNativeUuid.default.v4()}`,
25
25
  nonce: `${_reactNativeUuid.default.v4()}`,
26
26
  cnf: {
@@ -29,14 +29,6 @@ async function getAttestationRequest(wiaCryptoContext, walletProviderBaseUrl) {
29
29
  }).setProtectedHeader({
30
30
  kid: publicKey.kid,
31
31
  typ: "wiar+jwt"
32
- }).setPayload({
33
- iss: keyThumbprint,
34
- sub: walletProviderBaseUrl,
35
- jti: `${_reactNativeUuid.default.v4()}`,
36
- type: "WalletInstanceAttestationRequest",
37
- cnf: {
38
- jwk: (0, _jwk.fixBase64EncodingOnKey)(publicKey)
39
- }
40
32
  }).setIssuedAt().setExpirationTime("1h").sign();
41
33
  }
42
34
 
@@ -53,8 +45,8 @@ const getAttestation = _ref => {
53
45
  wiaCryptoContext,
54
46
  appFetch = fetch
55
47
  } = _ref;
56
- return async walletProviderBaseUrl => {
57
- const signedAttestationRequest = await getAttestationRequest(wiaCryptoContext, walletProviderBaseUrl);
48
+ return async walletProviderEntityConfiguration => {
49
+ const signedAttestationRequest = await getAttestationRequest(wiaCryptoContext, walletProviderEntityConfiguration);
58
50
  const decodedRequest = (0, _ioReactNativeJwt.decode)(signedAttestationRequest);
59
51
  const parsedRequest = _types.WalletInstanceAttestationRequestJwt.parse({
60
52
  payload: decodedRequest.payload,
@@ -62,7 +54,7 @@ const getAttestation = _ref => {
62
54
  });
63
55
  const publicKey = parsedRequest.payload.cnf.jwk;
64
56
  await (0, _ioReactNativeJwt.verify)(signedAttestationRequest, publicKey);
65
- const tokenUrl = new URL("token", walletProviderBaseUrl).href;
57
+ const tokenUrl = walletProviderEntityConfiguration.payload.metadata.wallet_provider.token_endpoint;
66
58
  const requestBody = {
67
59
  grant_type: "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation",
68
60
  assertion: signedAttestationRequest
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_jwk","_types","_reactNativeUuid","_interopRequireDefault","_errors","obj","__esModule","default","getAttestationRequest","wiaCryptoContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","SignJWT","setPayload","iss","aud","jti","uuid","v4","nonce","cnf","fixBase64EncodingOnKey","setProtectedHeader","typ","sub","type","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","signedAttestationRequest","decodedRequest","decodeJwt","parsedRequest","WalletInstanceAttestationRequestJwt","payload","header","protectedHeader","verifyJwt","tokenUrl","URL","href","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text","WalletInstanceAttestationIssuingError","exports"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;A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A,MAAM,IAAIC,6CAAqC,CAC7C,mEAAmE,EAClE,kBAAiBR,QAAQ,CAACM,MAAO,EACpC,CAAC;EACH,CAAC;AAAA;AAACG,OAAA,CAAA5B,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_jwk","_types","_reactNativeUuid","_interopRequireDefault","_errors","obj","__esModule","default","getAttestationRequest","wiaCryptoContext","walletProviderEntityConfiguration","jwk","getPublicKey","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","SignJWT","setPayload","iss","aud","payload","jti","uuid","v4","nonce","cnf","fixBase64EncodingOnKey","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","signedAttestationRequest","decodedRequest","decodeJwt","parsedRequest","WalletInstanceAttestationRequestJwt","header","protectedHeader","verifyJwt","tokenUrl","metadata","wallet_provider","token_endpoint","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text","WalletInstanceAttestationIssuingError","exports"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAMA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAAwE,SAAAI,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGxE,eAAeG,qBAAqBA,CAClCC,gBAA+B,EAC/BC,iCAAoE,EACnD;EACjB,MAAMC,GAAG,GAAG,MAAMF,gBAAgB,CAACG,YAAY,CAAC,CAAC;EACjD,MAAMC,SAAS,GAAGC,QAAG,CAACC,KAAK,CAACJ,GAAG,CAAC;EAChC,MAAMK,aAAa,GAAG,MAAM,IAAAC,4BAAU,EAACJ,SAAS,CAAC;EACjD,MA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MAAM8B,QAAQ,GACZtC,iCAAiC,CAACc,OAAO,CAACyB,QAAQ,CAACC,eAAe,CAC/DC,cAAc;IACnB,MAAMC,WAAW,GAAG;MAClBC,UAAU,EACR,oEAAoE;MACtEC,SAAS,EAAEd;IACb,CAAC;IACD,MAAMe,QAAQ,GAAG,MAAMjB,QAAQ,CAACU,QAAQ,EAAE;MACxCQ,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACR,WAAW;IAClC,CAAC,CAAC;IAEF,IAAIG,QAAQ,CAACM,MAAM,KAAK,GAAG,EAAE;MAC3B,OAAO,MAAMN,QAAQ,CAACO,IAAI,CAAC,CAAC;IAC9B;IAEA,MAAM,IAAIC,6CAAqC,CAC7C,mEAAmE,EAClE,kBAAiBR,QAAQ,CAACM,MAAO,EACpC,CAAC;EACH,CAAC;AAAA;AAACG,OAAA,CAAA5B,cAAA,GAAAA,cAAA"}
@@ -6,10 +6,7 @@ import * as RP from "./rp";
6
6
  import * as Errors from "./utils/errors";
7
7
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
8
8
  import * as RelyingPartySolution from "./rp";
9
- import { RpEntityConfiguration } from "./rp/types";
10
- import { verifyTrustChain, getEntityConfiguration } from "./trust";
11
- import { EntityConfiguration, EntityStatement, TrustAnchorEntityConfiguration } from "./trust/types";
9
+ import { verifyTrustChain, getEntityConfiguration, getCredentialIssuerEntityConfiguration, getRelyingPartyEntityConfiguration, getTrustAnchorEntityConfiguration, getWalletProviderEntityConfiguration } from "./trust";
12
10
  import { createCryptoContextFor } from "./utils/crypto";
13
- import { PidIssuerEntityConfiguration } from "./pid/metadata";
14
- export { PID, RP, WalletInstanceAttestation, Errors, RelyingPartySolution, verifyTrustChain, getEntityConfiguration, EntityConfiguration, EntityStatement, RpEntityConfiguration, PidIssuerEntityConfiguration, TrustAnchorEntityConfiguration, createCryptoContextFor };
11
+ export { PID, RP, WalletInstanceAttestation, Errors, RelyingPartySolution, verifyTrustChain, getEntityConfiguration, getCredentialIssuerEntityConfiguration, getRelyingPartyEntityConfiguration, getTrustAnchorEntityConfiguration, getWalletProviderEntityConfiguration, createCryptoContextFor };
15
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PID","RP","Errors","WalletInstanceAttestation","RelyingPartySolution","RpEntityConfiguration","verifyTrustChain","getEntityConfiguration","EntityConfiguration","EntityStatement","TrustAnchorEntityConfiguration","createCryptoContextFor","PidIssuerEntityConfiguration"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKA,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,EAAE,MAAM,MAAM;AAC1B,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,oBAAoB,MAAM,MAAM;AAC5C,SAASC,qBAAqB,QAAQ,YAAY;AAClD,SAASC,gBAAgB,EAAEC,sBAAsB,QAAQ,SAAS;AAClE,SACEC,mBAAmB,EACnBC,eAAe,EACfC,8BAA8B,QACzB,eAAe;AACtB,SAASC,sBAAsB,QAAQ,gBAAgB;AACvD,SAASC,4BAA4B,QAAQ,gBAAgB;AAE7D,SACEZ,GAAG,EACHC,EAAE,EACFE,yBAAyB,EACzBD,MAAM,EACNE,oBAAoB,EACpBE,gBAAgB,EAChBC,sBAAsB,EACtBC,mBAAmB,EACnBC,eAAe,EACfJ,qBAAqB,EACrBO,4BAA4B,EAC5BF,8BAA8B,EAC9BC,sBAAsB"}
1
+ {"version":3,"names":["PID","RP","Errors","WalletInstanceAttestation","RelyingPartySolution","verifyTrustChain","getEntityConfiguration","getCredentialIssuerEntityConfiguration","getRelyingPartyEntityConfiguration","getTrustAnchorEntityConfiguration","getWalletProviderEntityConfiguration","createCryptoContextFor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKA,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,EAAE,MAAM,MAAM;AAC1B,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,oBAAoB,MAAM,MAAM;AAC5C,SACEC,gBAAgB,EAChBC,sBAAsB,EACtBC,sCAAsC,EACtCC,kCAAkC,EAClCC,iCAAiC,EACjCC,oCAAoC,QAC/B,SAAS;AAChB,SAASC,sBAAsB,QAAQ,gBAAgB;AAEvD,SACEX,GAAG,EACHC,EAAE,EACFE,yBAAyB,EACzBD,MAAM,EACNE,oBAAoB,EACpBC,gBAAgB,EAChBC,sBAAsB,EACtBC,sCAAsC,EACtCC,kCAAkC,EAClCC,iCAAiC,EACjCC,oCAAoC,EACpCC,sBAAsB"}
@@ -3,25 +3,13 @@ import { JWK } from "../utils/jwk";
3
3
  import uuid from "react-native-uuid";
4
4
  import { PidIssuingError } from "../utils/errors";
5
5
  import { createDPopToken } from "../utils/dpop";
6
- import { PidIssuerEntityConfiguration } from "./metadata";
7
- import { createCryptoContextFor, getEntityConfiguration as getGenericEntityConfiguration } from "..";
6
+ import * as WalletInstanceAttestation from "../wallet-instance-attestation";
8
7
  import { generate, deleteKey } from "@pagopa/io-react-native-crypto";
9
8
  import { SdJwt } from ".";
9
+ import { createCryptoContextFor } from "../utils/crypto";
10
10
  // This is a temporary type that will be used for demo purposes only
11
11
 
12
- /**
13
- * Obtain the PID provider entity configuration.
14
- */
15
- export const getEntityConfiguration = function () {
16
- let {
17
- appFetch = fetch
18
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
19
- return async relyingPartyBaseUrl => {
20
- return getGenericEntityConfiguration(relyingPartyBaseUrl, {
21
- appFetch: appFetch
22
- }).then(PidIssuerEntityConfiguration.parse);
23
- };
24
- };
12
+ const assertionType = "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation";
25
13
 
26
14
  /**
27
15
  * Make a PAR request to the PID issuer and return the response url
@@ -37,17 +25,21 @@ const getPar = _ref => {
37
25
  // The signature can be verified by reading the public key from the key set shippet with the it will ship the Wallet Instance Attestation;
38
26
  // key is matched by its kid, which is supposed to be the thumbprint of its public key.
39
27
  const keyThumbprint = await wiaCryptoContext.getPublicKey().then(JWK.parse).then(thumbprint);
28
+ const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
40
29
  const codeChallenge = await sha256ToBase64(codeVerifier);
41
30
  const signedJwtForPar = await new SignJWT(wiaCryptoContext).setProtectedHeader({
42
31
  kid: keyThumbprint
43
32
  }).setPayload({
44
- client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
33
+ iss,
34
+ aud: pidProviderEntityConfiguration.payload.iss,
35
+ jti: `${uuid.v4()}`,
36
+ client_assertion_type: assertionType,
45
37
  authorization_details: [{
46
- credentialDefinition: {
47
- type: ["eu.eudiw.pid.it"]
38
+ credential_definition: {
39
+ type: "PersonIdentificationData"
48
40
  },
49
41
  format: "vc+sd-jwt",
50
- type: "type"
42
+ type: "openid_credential"
51
43
  }],
52
44
  response_type: "code",
53
45
  code_challenge_method: "s256",
@@ -62,7 +54,7 @@ const getPar = _ref => {
62
54
  client_id: clientId,
63
55
  code_challenge: codeChallenge,
64
56
  code_challenge_method: "S256",
65
- client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
57
+ client_assertion_type: assertionType,
66
58
  client_assertion: walletInstanceAttestation,
67
59
  request: signedJwtForPar
68
60
  };
@@ -123,7 +115,7 @@ export const authorizeIssuing = _ref2 => {
123
115
  client_id: clientId,
124
116
  code: authorizationCode,
125
117
  code_verifier: codeVerifier,
126
- client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
118
+ client_assertion_type: assertionType,
127
119
  client_assertion: walletInstanceAttestation,
128
120
  redirect_uri: walletProviderBaseUrl
129
121
  };
@@ -159,7 +151,8 @@ export const authorizeIssuing = _ref2 => {
159
151
  */
160
152
  const createNonceProof = async (nonce, issuer, audience, ctx) => {
161
153
  return new SignJWT(ctx).setPayload({
162
- nonce
154
+ nonce,
155
+ jwk: await ctx.getPublicKey()
163
156
  }).setProtectedHeader({
164
157
  type: "openid4vci-proof+jwt"
165
158
  }).setAudience(audience).setIssuer(issuer).setIssuedAt().setExpirationTime("1h").sign();
@@ -195,7 +188,7 @@ export const getCredential = _ref3 => {
195
188
  const credentialUrl = pidProviderEntityConfiguration.payload.metadata.openid_credential_issuer.credential_endpoint;
196
189
  const requestBody = {
197
190
  credential_definition: JSON.stringify({
198
- type: ["eu.eudiw.pid.it"]
191
+ type: ["PersonIdentificationData"]
199
192
  }),
200
193
  format: "vc+sd-jwt",
201
194
  proof: JSON.stringify({
@@ -1 +1 @@
1
- {"version":3,"names":["sha256ToBase64","SignJWT","thumbprint","JWK","uuid","PidIssuingError","createDPopToken","PidIssuerEntityConfiguration","createCryptoContextFor","getEntityConfiguration","getGenericEntityConfiguration","generate","deleteKey","SdJwt","appFetch","fetch","arguments","length","undefined","relyingPartyBaseUrl","then","parse","getPar","_ref","wiaCryptoContext","clientId","codeVerifier","walletProviderBaseUrl","pidProviderEntityConfiguration","walletInstanceAttestation","keyThumbprint","getPublicKey","codeChallenge","signedJwtForPar","setProtectedHeader","kid","setPayload","client_assertion_type","authorization_details","credentialDefinition","type","format","response_type","code_challenge_method","redirect_uri","state","v4","client_id","code_challenge","setIssuedAt","setExpirationTime","sign","parUrl","payload","metadata","openid_credential_issuer","pushed_authorization_request_endpoint","requestBody","client_assertion","request","formBody","URLSearchParams","response","method","headers","body","toString","status","result","json","request_uri","text","authorizeIssuing","_ref2","_","authorizationCode","tokenUrl","token_endpoint","keytag","ephemeralContext","signedDPop","htm","htu","jti","grant_type","code","code_verifier","DPoP","c_nonce","access_token","accessToken","nonce","createNonceProof","issuer","audience","ctx","setAudience","setIssuer","getCredential","_ref3","pidCryptoContext","_ref4","cieData","signedDPopForPid","signedNonceProof","credentialUrl","credential_endpoint","credential_definition","JSON","stringify","proof","jwt","proof_type","Authorization","pidResponse","validatePid","credential","pidJwt","decoded","decode","pidKey","holderBindedKey","sdJwt","cnf","jwk"],"sourceRoot":"../../../src","sources":["pid/issuing.ts"],"mappings":"AAAA,SACEA,cAAc,EAEdC,OAAO,EACPC,UAAU,QACL,6BAA6B;AACpC,SAASC,GAAG,QAAQ,cAAc;AAClC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,eAAe,QAAQ,eAAe;AAC/C,SAASC,4BAA4B,QAAQ,YAAY;AACzD,SACEC,sBAAsB,EACtBC,sBAAsB,IAAIC,6BAA6B,QAClD,IAAI;AACX,SAASC,QAAQ,EAAEC,SAAS,QAAQ,gCAAgC;AACpE,SAASC,KAAK,QAAQ,GAAG;AACzB;;AAwBA;AACA;AACA;AACA,OAAO,MAAMJ,sBAAsB,GACjC,SAAAA,CAAA;EAAA,IAAC;IAAEK,QAAQ,GAAGC;EAA2C,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,OAC/D,MACEG,mBAA2B,IACe;IAC1C,OAAOT,6BAA6B,CAACS,mBAAmB,EAAE;MACxDL,QAAQ,EAAEA;IACZ,CAAC,CAAC,CAACM,IAAI,CAACb,4BAA4B,CAACc,KAAK,CAAC;EAC7C,CAAC;AAAA;;AAEH;AACA;AACA;AACA,MAAMC,MAAM,GACVC,IAAA;EAAA,IAAC;IACCC,gBAAgB;IAChBV,QAAQ,GAAGC;EAIb,CAAC,GAAAQ,IAAA;EAAA,OACD,OACEE,QAAgB,EAChBC,YAAoB,EACpBC,qBAA6B,EAC7BC,8BAA4D,EAC5DC,yBAAiC,KACb;IACpB;IACA;IACA;IACA;IACA,MAAMC,aAAa,GAAG,MAAMN,gBAAgB,CAC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ErD,IAAI,CAAC,MAAM1H,UAAU,CAACsH,MAAM,CAAC,OAAO,MAAMtH,UAAU,CAACuH,eAAe,CAAC,CAAC,EAAE;IACtE,MAAM,IAAIpH,eAAe,CACtB,uGAAsGuG,IAAI,CAACC,SAAS,CACnHW,MACF,CAAE,kCAAiCZ,IAAI,CAACC,SAAS,CAACY,eAAe,CAAE,EACrE,CAAC;EACH;AACF,CAAC"}
1
+ {"version":3,"names":["sha256ToBase64","SignJWT","thumbprint","JWK","uuid","PidIssuingError","createDPopToken","WalletInstanceAttestation","generate","deleteKey","SdJwt","createCryptoContextFor","assertionType","getPar","_ref","wiaCryptoContext","appFetch","fetch","clientId","codeVerifier","walletProviderBaseUrl","pidProviderEntityConfiguration","walletInstanceAttestation","keyThumbprint","getPublicKey","then","parse","iss","decode","payload","cnf","jwk","kid","codeChallenge","signedJwtForPar","setProtectedHeader","setPayload","aud","jti","v4","client_assertion_type","authorization_details","credential_definition","type","format","response_type","code_challenge_method","redirect_uri","state","client_id","code_challenge","setIssuedAt","setExpirationTime","sign","parUrl","metadata","openid_credential_issuer","pushed_authorization_request_endpoint","requestBody","client_assertion","request","formBody","URLSearchParams","response","method","headers","body","toString","status","result","json","request_uri","text","authorizeIssuing","_ref2","_","authorizationCode","tokenUrl","token_endpoint","keytag","ephemeralContext","signedDPop","htm","htu","grant_type","code","code_verifier","DPoP","c_nonce","access_token","accessToken","nonce","createNonceProof","issuer","audience","ctx","setAudience","setIssuer","getCredential","_ref3","pidCryptoContext","_ref4","cieData","signedDPopForPid","signedNonceProof","credentialUrl","credential_endpoint","JSON","stringify","proof","jwt","proof_type","Authorization","pidResponse","validatePid","credential","pidJwt","decoded","pidKey","holderBindedKey","sdJwt"],"sourceRoot":"../../../src","sources":["pid/issuing.ts"],"mappings":"AAAA,SACEA,cAAc,EAEdC,OAAO,EACPC,UAAU,QACL,6BAA6B;AACpC,SAASC,GAAG,QAAQ,cAAc;AAClC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,S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OAAO,EAAE;QACP,cAAc,EAAE,mCAAmC;QACnDsB,IAAI,EAAEgB,gBAAgB;QACtBS,aAAa,EAAEtB;MACjB,CAAC;MACDxB,IAAI,EAAEL,QAAQ,CAACM,QAAQ,CAAC;IAC1B,CAAC,CAAC;IAEF,IAAIJ,QAAQ,CAACK,MAAM,KAAK,GAAG,EAAE;MAC3B,MAAM6C,WAAW,GAAI,MAAMlD,QAAQ,CAACO,IAAI,CAAC,CAAiB;MAC1D,MAAM4C,WAAW,CAACD,WAAW,CAACE,UAAU,EAAEf,gBAAgB,CAAC;MAC3D,OAAOa,WAAW;IACpB;IAEA,MAAM,IAAI5G,eAAe,CACtB,oCAAmCoG,aAAc,WAChD1C,QAAQ,CAACK,MACV,SAAQ,MAAML,QAAQ,CAACS,IAAI,CAAC,CAAE,EACjC,CAAC;EACH,CAAC;AAAA;AAEH,MAAM0C,WAAW,GAAG,MAAAA,CAAOE,MAAc,EAAEhB,gBAA+B,KAAK;EAC7E,MAAMiB,OAAO,GAAG3G,KAAK,CAACkB,MAAM,CAACwF,MAAM,CAAC;EACpC,MAAME,MAAM,GAAG,MAAMlB,gBAAgB,CAAC5E,YAAY,CAAC,CAAC;EACpD,MAAM+F,eAAe,GAAGF,OAAO,CAACG,KAAK,CAAC3F,OAAO,CAACC,GAAG,CAACC,GAAG;EAErD,IAAI,CAAC,MAAM7B,UAAU,CAACoH,MAAM,CAAC,OAAO,MAAMpH,UAAU,CAACqH,eAAe,CAAC,CAAC,EAAE;IACtE,MAAM,IAAIlH,eAAe,CACtB,uGAAsGsG,IAAI,CAACC,SAAS,CACnHU,MACF,CAAE,kCAAiCX,IAAI,CAACC,SAAS,CAACW,eAAe,CAAE,EACrE,CAAC;EACH;AACF,CAAC"}
@@ -1,6 +1,6 @@
1
+ import { RelyingPartyEntityConfiguration } from "../../trust/types";
1
2
  import * as RelyingPartySolution from "..";
2
3
  import { AuthRequestDecodeError } from "../../utils/errors";
3
- import { RpEntityConfiguration } from "../types";
4
4
  describe("decodeAuthRequestQR", () => {
5
5
  it("should return authentication request URL", async () => {
6
6
  const qrcode = "ZXVkaXc6Ly9hdXRob3JpemU/Y2xpZW50X2lkPWh0dHBzOi8vdmVyaWZpZXIuZXhhbXBsZS5vcmcmcmVxdWVzdF91cmk9aHR0cHM6Ly92ZXJpZmllci5leGFtcGxlLm9yZy9yZXF1ZXN0X3VyaQ==";
@@ -156,7 +156,7 @@ describe("RpEntityConfiguration", () => {
156
156
  authority_hints: ["https://demo.federation.eudi.wallet.developers.italia.it"]
157
157
  }
158
158
  };
159
- const result = RpEntityConfiguration.safeParse(pp);
159
+ const result = RelyingPartyEntityConfiguration.safeParse(pp);
160
160
  if (result.success === false) {
161
161
  throw result.error;
162
162
  }
@@ -1 +1 @@
1
- {"version":3,"names":["RelyingPartySolution","AuthRequestDecodeError","RpEntityConfiguration","describe","it","qrcode","result","decodeAuthRequestQR","expect","requestURI","toEqual","toThrowError","pp","header","alg","kid","typ","payload","exp","iat","iss","sub","jwks","keys","kty","e","n","metadata","federation_entity","organization_name","homepage_uri","policy_uri","logo_uri","contacts","wallet_relying_party","application_type","authorization_encrypted_response_alg","authorization_encrypted_response_enc","authorization_signed_response_alg","client_id","client_name","default_acr_values","default_max_age","id_token_encrypted_response_alg","id_token_encrypted_response_enc","id_token_signed_response_alg","presentation_definitions","id","input_descriptors","format","constraints","fields","filter","const","type","path","intent_to_retain","limit_disclosure","jwt","mso_mdoc","redirect_uris","request_uris","require_auth_time","subject_type","vp_formats","jwt_vp_json","crv","d","use","x","y","p","q","authority_hints","safeParse","success","error","toBe"],"sourceRoot":"../../../../src","sources":["rp/__test__/index.test.ts"],"mappings":"AAAA,OAAO,KAAKA,oBAAoB,MAAM,IAAI;AAC1C,SAASC,sBAAsB,QAAQ,oBAAoB;AAC3D,SAASC,qBAAqB,QAAQ,UAAU;AAEhDC,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpCC,EAAE,CAAC,0CAA0C,EAAE,YAAY;IACzD,MAAMC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C;YACDQ,IAAI,EAAE,CACJ;cACE4C,GAAG,EAAE,OAAO;cACZC,CAAC,EAAE,6CAA6C;cAChDpD,GAAG,EAAE,6CAA6C;cAClDqD,GAAG,EAAE,KAAK;cACV5C,GAAG,EAAE,IAAI;cACT6C,CAAC,EAAE,6CAA6C;cAChDC,CAAC,EAAE;YACL,CAAC,EACD;cACE9C,GAAG,EAAE,KAAK;cACV2C,CAAC,EAAE,wVAAwV;cAC3V1C,CAAC,EAAE,MAAM;cACT2C,GAAG,EAAE,KAAK;cACVrD,GAAG,EAAE,6CAA6C;cAClDW,CAAC,EAAE,wVAAwV;cAC3V6C,CAAC,EAAE,6KAA6K;cAChLC,CAAC,EAAE;YACL,CAAC;UAEL;QACF,CAAC;QACDC,eAAe,EAAE,CACf,0DAA0D;MAE9D;IACF,CAAC;IACD,MAAMnE,MAAM,GAAGJ,qBAAqB,CAACwE,SAAS,CAAC9D,EAAE,CAAC;IAClD,IAAIN,MAAM,CAACqE,OAAO,KAAK,KAAK,EAAE;MAC5B,MAAMrE,MAAM,CAACsE,KAAK;IACpB;IACApE,MAAM,CAACF,MAAM,CAACqE,OAAO,CAAC,CAACE,IAAI,CAAC,IAAI,CAAC;EACnC,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["RelyingPartyEntityConfiguration","RelyingPartySolution","AuthRequestDecodeError","describe","it","qrcode","result","decodeAuthRequestQR","expect","requestURI","toEqual","toThrowError","pp","header","alg","kid","typ","payload","exp","iat","iss","sub","jwks","keys","kty","e","n","metadata","federation_entity","organization_name","homepage_uri","policy_uri","logo_uri","contacts","wallet_relying_party","application_type","authorization_encrypted_response_alg","authorization_encrypted_response_enc","authorization_signed_response_alg","client_id","client_name","default_acr_values","default_max_age","id_token_encrypted_response_alg","id_token_encrypted_response_enc","id_token_signed_response_alg","presentation_definitions","id","input_descriptors","format","constraints","fields","filter","const","type","path","intent_to_retain","limit_disclosure","jwt","mso_mdoc","redirect_uris","request_uris","require_auth_time","subject_type","vp_formats","jwt_vp_json","crv","d","use","x","y","p","q","authority_hints","safeParse","success","error","toBe"],"sourceRoot":"../../../../src","sources":["rp/__test__/index.test.ts"],"mappings":"AAAA,SAASA,+BAA+B,QAAQ,mBAAmB;AACnE,OAAO,KAAKC,oBAAoB,MAAM,IAAI;AAC1C,SAASC,sBAAsB,QAAQ,oBAAoB;AAE3DC,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpCC,EAAE,CAAC,0CAA0C,EAAE,YAAY;IACzD,MAAMC,MAAM,GACV,sJAAsJ;IACxJ,MAAMC,MAAM,GAAGL,oBAAoB,CAACM,mBAAmB,CAACF,MAAM,CAAC;IAC/DG,MAAM,CAACF,MAAM,CAACG,UAAU,CAAC,CAACC,OAAO,CAC/B,0CACF,CAAC;EACH,CAAC,CAAC;EACFN,EAAE,CAAC,wCAAwC,EAAE,YAAY;IACvD,MAAMC,MAAM,GAAG,0BAA0B;IACzCG,MAAM,CAAC,MAAMP,oBAAoB,CAACM,mBAAmB,CAACF,MAAM,CAAC,CAAC,CAACM,YAAY,CACzET,sBACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEFC,QAAQ,CAAC,uBAAuB,EAAE,MAAM;EACtCC,EAAE,CAAC,2BAA2B,EAAE,YAAY;IAC1C,MAAMQ,EAAE,GAAG;MACTC,MAAM,EAAE;QACNC,GAAG,EAAE,OAAO;QACZC,GAAG,EAAE,6CAA6C;QAClDC,GAAG,EAAE;MACP,CAAC;MACDC,OAAO,EAAE;QACPC,GAAG,EAAE,UAAU;QACfC,GAAG,EAAE,UAAU;QACfC,GAAG,EAAE,+DAA+D;QACpEC,GAAG,EAAE,+DAA+D;QACpEC,IAAI,EAAE;UACJC,IAAI,EAAE,CACJ;YACEC,GAAG,EAAE,KAAK;YACVT,GAAG,EAAE,6CAA6C;YAClDU,CAAC,EAAE,MAAM;YACTC,CAAC,EAAE;UACL,CAAC;QAEL,CAAC;QACDC,QAAQ,EAAE;UACRC,iBAAi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CAAC,OAAO,EAAE,OAAO;kBACxB;gBACF,CAAC;gBACDiC,EAAE,EAAE;cACN,CAAC;YAEL,CAAC,CACF;YACDa,aAAa,EAAE,CACb,4EAA4E,CAC7E;YACDC,YAAY,EAAE,CACZ,2EAA2E,CAC5E;YACDC,iBAAiB,EAAE,IAAI;YACvBC,YAAY,EAAE,UAAU;YACxBC,UAAU,EAAE;cACVC,WAAW,EAAE;gBACXnD,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ;cACzB;YACF,CAAC;YACDQ,IAAI,EAAE,CACJ;cACE4C,GAAG,EAAE,OAAO;cACZC,CAAC,EAAE,6CAA6C;cAChDpD,GAAG,EAAE,6CAA6C;cAClDqD,GAAG,EAAE,KAAK;cACV5C,GAAG,EAAE,IAAI;cACT6C,CAAC,EAAE,6CAA6C;cAChDC,CAAC,EAAE;YACL,CAAC,EACD;cACE9C,GAAG,EAAE,KAAK;cACV2C,CAAC,EAAE,wVAAwV;cAC3V1C,CAAC,EAAE,MAAM;cACT2C,GAAG,EAAE,KAAK;cACVrD,GAAG,EAAE,6CAA6C;cAClDW,CAAC,EAAE,wVAAwV;cAC3V6C,CAAC,EAAE,6KAA6K;cAChLC,CAAC,EAAE;YACL,CAAC;UAEL;QACF,CAAC;QACDC,eAAe,EAAE,CACf,0DAA0D;MAE9D;IACF,CAAC;IACD,MAAMnE,MAAM,GAAGN,+BAA+B,CAAC0E,SAAS,CAAC9D,EAAE,CAAC;IAC5D,IAAIN,MAAM,CAACqE,OAAO,KAAK,KAAK,EAAE;MAC5B,MAAMrE,MAAM,CAACsE,KAAK;IACpB;IACApE,MAAM,CAACF,MAAM,CAACqE,OAAO,CAAC,CAACE,IAAI,CAAC,IAAI,CAAC;EACnC,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,11 +1,10 @@
1
1
  import { AuthRequestDecodeError, IoWalletError, NoSuitableKeysFoundInEntityConfiguration } from "../utils/errors";
2
2
  import { decode as decodeJwt, decodeBase64, sha256ToBase64, SignJWT, EncryptJwe, verify } from "@pagopa/io-react-native-jwt";
3
- import { QRCodePayload, RequestObject, RpEntityConfiguration } from "./types";
3
+ import { QRCodePayload, RequestObject } from "./types";
4
4
  import uuid from "react-native-uuid";
5
5
  import { disclose } from "../sd-jwt";
6
- import { getEntityConfiguration as getGenericEntityConfiguration } from "../trust";
7
6
  import { createDPopToken } from "../utils/dpop";
8
- import { WalletInstanceAttestation } from "..";
7
+ import * as WalletInstanceAttestation from "../wallet-instance-attestation";
9
8
 
10
9
  /**
11
10
  * Select a RSA public key from those provided by the RP to encrypt.
@@ -24,20 +23,6 @@ const chooseRSAPublicKeyToEncrypt = entity => {
24
23
  throw new NoSuitableKeysFoundInEntityConfiguration("Encrypt with RP public key");
25
24
  };
26
25
 
27
- /**
28
- * Obtain the relying party entity configuration.
29
- */
30
- export const getEntityConfiguration = function () {
31
- let {
32
- appFetch = fetch
33
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
34
- return async relyingPartyBaseUrl => {
35
- return getGenericEntityConfiguration(relyingPartyBaseUrl, {
36
- appFetch: appFetch
37
- }).then(RpEntityConfiguration.parse);
38
- };
39
- };
40
-
41
26
  /**
42
27
  * Decode a QR code content to an authentication request url.
43
28
  * @function