@pagopa/io-react-native-wallet 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. package/README.md +57 -24
  2. package/lib/commonjs/index.js +13 -0
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/rp/__test__/index.test.js +8 -1
  5. package/lib/commonjs/rp/__test__/index.test.js.map +1 -1
  6. package/lib/commonjs/rp/index.js +4 -13
  7. package/lib/commonjs/rp/index.js.map +1 -1
  8. package/lib/commonjs/rp/types.js +7 -27
  9. package/lib/commonjs/rp/types.js.map +1 -1
  10. package/lib/commonjs/trust/chain.js +94 -0
  11. package/lib/commonjs/trust/chain.js.map +1 -0
  12. package/lib/commonjs/trust/index.js +44 -0
  13. package/lib/commonjs/trust/index.js.map +1 -0
  14. package/lib/commonjs/trust/types.js +64 -0
  15. package/lib/commonjs/trust/types.js.map +1 -0
  16. package/lib/commonjs/wallet-instance-attestation/issuing.js +4 -4
  17. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  18. package/lib/commonjs/wallet-instance-attestation/types.js +6 -9
  19. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  20. package/lib/module/index.js +2 -1
  21. package/lib/module/index.js.map +1 -1
  22. package/lib/module/rp/__test__/index.test.js +8 -1
  23. package/lib/module/rp/__test__/index.test.js.map +1 -1
  24. package/lib/module/rp/index.js +4 -13
  25. package/lib/module/rp/index.js.map +1 -1
  26. package/lib/module/rp/types.js +7 -27
  27. package/lib/module/rp/types.js.map +1 -1
  28. package/lib/module/trust/chain.js +86 -0
  29. package/lib/module/trust/chain.js.map +1 -0
  30. package/lib/module/trust/index.js +34 -0
  31. package/lib/module/trust/index.js.map +1 -0
  32. package/lib/module/trust/types.js +52 -0
  33. package/lib/module/trust/types.js.map +1 -0
  34. package/lib/module/wallet-instance-attestation/issuing.js +4 -4
  35. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  36. package/lib/module/wallet-instance-attestation/types.js +6 -9
  37. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  38. package/lib/typescript/index.d.ts +2 -1
  39. package/lib/typescript/index.d.ts.map +1 -1
  40. package/lib/typescript/rp/index.d.ts.map +1 -1
  41. package/lib/typescript/rp/types.d.ts +232 -145
  42. package/lib/typescript/rp/types.d.ts.map +1 -1
  43. package/lib/typescript/trust/chain.d.ts +17 -0
  44. package/lib/typescript/trust/chain.d.ts.map +1 -0
  45. package/lib/typescript/trust/index.d.ts +16 -0
  46. package/lib/typescript/trust/index.d.ts.map +1 -0
  47. package/lib/typescript/trust/types.d.ts +1041 -0
  48. package/lib/typescript/trust/types.d.ts.map +1 -0
  49. package/lib/typescript/wallet-instance-attestation/types.d.ts +30 -50
  50. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  51. package/package.json +1 -1
  52. package/src/index.ts +3 -0
  53. package/src/rp/__test__/index.test.ts +8 -1
  54. package/src/rp/index.ts +4 -19
  55. package/src/rp/types.ts +17 -34
  56. package/src/trust/chain.ts +109 -0
  57. package/src/trust/index.ts +43 -0
  58. package/src/trust/types.ts +56 -0
  59. package/src/wallet-instance-attestation/issuing.ts +4 -4
  60. package/src/wallet-instance-attestation/types.ts +6 -9
@@ -36,16 +36,16 @@ class Issuing {
36
36
  };
37
37
  const walletInstanceAttestationRequest = new _ioReactNativeJwt.SignJWT({
38
38
  iss: keyThumbprint,
39
- sub: this.walletProviderBaseUrl,
39
+ aud: this.walletProviderBaseUrl,
40
40
  jti: `${_reactNativeUuid.default.v4()}`,
41
- type: "WalletInstanceAttestationRequest",
41
+ nonce: `${_reactNativeUuid.default.v4()}`,
42
42
  cnf: {
43
43
  jwk: (0, _jwk.fixBase64EncodingOnKey)(publicKey)
44
44
  }
45
45
  }).setProtectedHeader({
46
46
  alg: "ES256",
47
47
  kid: publicKey.kid,
48
- typ: "var+jwt"
48
+ typ: "wiar+jwt"
49
49
  }).setIssuedAt().setExpirationTime("1h").toSign();
50
50
  return walletInstanceAttestationRequest;
51
51
  }
@@ -74,7 +74,7 @@ class Issuing {
74
74
  await (0, _ioReactNativeJwt.verify)(signedAttestationRequest, publicKey);
75
75
  const tokenUrl = new URL("token", this.walletProviderBaseUrl).href;
76
76
  const requestBody = {
77
- grant_type: "urn:ietf:params:oauth:client-assertion-type:jwt-key-attestation",
77
+ grant_type: "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation",
78
78
  assertion: signedAttestationRequest
79
79
  };
80
80
  const response = await this.appFetch(tokenUrl, {
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_jwk","_types","_reactNativeUuid","_interopRequireDefault","_errors","obj","__esModule","default","Issuing","constructor","walletProviderBaseUrl","appFetch","arguments","length","undefined","fetch","getAttestationRequestToSign","jwk","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","walletInstanceAttestationRequest","SignJWT","iss","sub","jti","uuid","v4","type","cnf","fixBase64EncodingOnKey","setProtectedHeader","alg","typ","setIssuedAt","setExpirationTime","toSign","getAttestation","attestationRequest","signature","signedAttestationRequest","appendSignature","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;AAGA,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;AAEjE,MAAMG,OAAO,CAAC;EAGnBC,WAAWA,CACTC,qBAA6B,EAE7B;IAAA,IADAC,QAA8B,GAA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AAAC,wBAAS,EAACH,wBAAwB,CAAC;IAC1D,MAAMI,aAAa,GAAGC,0CAAmC,CAAC7B,KAAK,CAAC;MAC9D8B,OAAO,EAAEJ,cAAc,CAACI,OAAO;MAC/BC,MAAM,EAAEL,cAAc,CAACM;IACzB,CAAC,CAAC;IACF,MAAM7B,SAAS,GAAGyB,aAAa,CAACE,OAAO,CAACjB,GAAG,CAAChB,GAAG;IAE/C,MAAM,IAAAoC,wBAAS,EAACT,wBAAwB,EAAErB,SAAS,CAAC;IAEpD,MAAM+B,QAAQ,GAAG,IAAIC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC7C,qBAAqB,CAAC,CAAC8C,IAAI;IAClE,MAAMC,WAAW,GAAG;MAClBC,UAAU,EACR,iEAAiE;MACnEC,SAAS,EAAEf;IACb,CAAC;IACD,MAAMgB,QAAQ,GAAG,MAAM,IAAI,CAACjD,QAAQ,CAAC2C,QAAQ,EAAE;MAC7CO,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;AACF;AAACG,OAAA,CAAA7D,OAAA,GAAAA,OAAA"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_jwk","_types","_reactNativeUuid","_interopRequireDefault","_errors","obj","__esModule","default","Issuing","constructor","walletProviderBaseUrl","appFetch","arguments","length","undefined","fetch","getAttestationRequestToSign","jwk","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","walletInstanceAttestationRequest","SignJWT","iss","aud","jti","uuid","v4","nonce","cnf","fixBase64EncodingOnKey","setProtectedHeader","alg","typ","setIssuedAt","setExpirationTime","toSign","getAttestation","attestationRequest","signature","signedAttestationRequest","appendSignature","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;AAGA,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;AAEjE,MAAMG,OAAO,CAAC;EAGnBC,WAAWA,CACTC,qBAA6B,EAE7B;IAAA,IADAC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;IAEtC,IAAI,CAACL,qBAAqB,GAAGA,qBAAqB;IAClD,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC1B;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMK,2BAA2BA,CAACC,GAAQ,EAAmB;IAC3D,MAAMC,SAAS,GAAGC,QAAG,CAACC,KAAK,CAACH,GAAG,CAAC;IAChC,MAAMI,aAAa,GAAG,MAAM,IAAAC,4BAAU,EAACJ,SAAS,CAAC;IACjD,MAAMK,SAAS,GAAG;MAAE,GAAGL,SAAS;MAAEM,GAAG,EAAEH;IAAc,CAAC;IAEtD,MAAMI,gCAAgC,GAAG,IAAIC,yBAAO,CAAC;MACnDC,GAAG,EAAEN,aAAa;MAClBO,GAAG,EAAE,IAAI,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G,MAAM,IAAI,CAACjD,QAAQ,CAAC2C,QAAQ,EAAE;MAC7CO,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;AACF;AAACG,OAAA,CAAA7D,OAAA,GAAAA,OAAA"}
@@ -19,7 +19,6 @@ const Jwt = z.object({
19
19
  }),
20
20
  payload: z.object({
21
21
  iss: z.string(),
22
- sub: z.string(),
23
22
  iat: UnixTime,
24
23
  exp: UnixTime,
25
24
  cnf: z.object({
@@ -33,24 +32,22 @@ const Jwt = z.object({
33
32
  });
34
33
  const WalletInstanceAttestationRequestJwt = z.object({
35
34
  header: z.intersection(Jwt.shape.header, z.object({
36
- typ: z.literal("var+jwt")
35
+ typ: z.literal("wiar+jwt")
37
36
  })),
38
37
  payload: z.intersection(Jwt.shape.payload, z.object({
38
+ aud: z.string(),
39
39
  jti: z.string(),
40
- type: z.literal("WalletInstanceAttestationRequest")
40
+ nonce: z.string()
41
41
  }))
42
42
  });
43
43
  exports.WalletInstanceAttestationRequestJwt = WalletInstanceAttestationRequestJwt;
44
44
  const WalletInstanceAttestationJwt = z.object({
45
45
  header: z.intersection(Jwt.shape.header, z.object({
46
- typ: z.literal("va+jwt")
46
+ typ: z.literal("wallet-attestation+jwt")
47
47
  })),
48
48
  payload: z.intersection(Jwt.shape.payload, z.object({
49
- type: z.literal("WalletInstanceAttestation"),
50
- policy_uri: z.string().url(),
51
- tos_uri: z.string().url(),
52
- logo_uri: z.string().url(),
53
- asc: z.string(),
49
+ sub: z.string(),
50
+ attested_security_context: z.string(),
54
51
  authorization_endpoint: z.string(),
55
52
  response_types_supported: z.array(z.string()),
56
53
  vp_formats_supported: z.object({
@@ -1 +1 @@
1
- {"version":3,"names":["_jwk","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","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","sub","iat","exp","cnf","jwk","intersection","JWK","WalletInstanceAttestationRequestJwt","shape","literal","jti","type","exports","WalletInstanceAttestationJwt","policy_uri","url","tos_uri","logo_uri","asc","authorization_endpoint","response_types_supported","vp_formats_supported","jwt_vp_json","alg_values_supported","jwt_vc_json","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,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,GAAA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rBlB,GAAG,CAACqB,KAAK,CAACV,OAAO,EACjBvC,CAAC,CAAC6B,MAAM,CAAC;IACPuB,IAAI,EAAEpD,CAAC,CAACkD,OAAO,CAAC,2BAA2B,CAAC;IAC5CK,UAAU,EAAEvD,CAAC,CAACgC,MAAM,CAAC,CAAC,CAACwB,GAAG,CAAC,CAAC;IAC5BC,OAAO,EAAEzD,CAAC,CAACgC,MAAM,CAAC,CAAC,CAACwB,GAAG,CAAC,CAAC;IACzBE,QAAQ,EAAE1D,CAAC,CAACgC,MAAM,CAAC,CAAC,CAACwB,GAAG,CAAC,CAAC;IAC1BG,GAAG,EAAE3D,CAAC,CAACgC,MAAM,CAAC,CAAC;IACf4B,sBAAsB,EAAE5D,CAAC,CAACgC,MAAM,CAAC,CAAC;IAClC6B,wBAAwB,EAAE7D,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC,CAAC;IAC7C8B,oBAAoB,EAAE9D,CAAC,CAAC6B,MAAM,CAAC;MAC7BkC,WAAW,EAAE/D,CAAC,CAAC6B,MAAM,CAAC;QACpBmC,oBAAoB,EAAEhE,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC;MAC1C,CAAC,CAAC;MACFiC,WAAW,EAAEjE,CAAC,CAAC6B,MAAM,CAAC;QACpBmC,oBAAoB,EAAEhE,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC;MAC1C,CAAC;IACH,CAAC,CAAC;IACFkC,2CAA2C,EAAElE,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC,CAAC;IAChEmC,qCAAqC,EAAEnE,CAAC,CAACoE,OAAO,CAAC;EACnD,CAAC,CACH;AACF,CAAC,CAAC;AAACf,OAAA,CAAAC,4BAAA,GAAAA,4BAAA"}
1
+ {"version":3,"names":["_jwk","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","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","iat","exp","cnf","jwk","intersection","JWK","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","exports","WalletInstanceAttestationJwt","sub","attested_security_context","authorization_endpoint","response_types_supported","vp_formats_supported","jwt_vp_json","alg_values_supported","jwt_vc_json","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,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,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AAEzD,CAAC,CAACgC,MAAM,CAAC,CAAC;IAClC0B,wBAAwB,EAAE1D,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC,CAAC;IAC7C2B,oBAAoB,EAAE3D,CAAC,CAAC6B,MAAM,CAAC;MAC7B+B,WAAW,EAAE5D,CAAC,CAAC6B,MAAM,CAAC;QACpBgC,oBAAoB,EAAE7D,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC;MAC1C,CAAC,CAAC;MACF8B,WAAW,EAAE9D,CAAC,CAAC6B,MAAM,CAAC;QACpBgC,oBAAoB,EAAE7D,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC;MAC1C,CAAC;IACH,CAAC,CAAC;IACF+B,2CAA2C,EAAE/D,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC,CAAC;IAChEgC,qCAAqC,EAAEhE,CAAC,CAACiE,OAAO,CAAC;EACnD,CAAC,CACH;AACF,CAAC,CAAC;AAACZ,OAAA,CAAAC,4BAAA,GAAAA,4BAAA"}
@@ -7,5 +7,6 @@ import * as Errors from "./utils/errors";
7
7
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
8
8
  import { getUnsignedDPop } from "./utils/dpop";
9
9
  import { RelyingPartySolution } from "./rp";
10
- export { PID, RP, WalletInstanceAttestation, Errors, getUnsignedDPop, RelyingPartySolution };
10
+ import { verifyTrustChain, getEntityConfiguration } from "./trust";
11
+ export { PID, RP, WalletInstanceAttestation, Errors, getUnsignedDPop, RelyingPartySolution, verifyTrustChain, getEntityConfiguration };
11
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PID","RP","Errors","WalletInstanceAttestation","getUnsignedDPop","RelyingPartySolution"],"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,SAASC,eAAe,QAAQ,cAAc;AAC9C,SAASC,oBAAoB,QAAQ,MAAM;AAE3C,SACEL,GAAG,EACHC,EAAE,EACFE,yBAAyB,EACzBD,MAAM,EACNE,eAAe,EACfC,oBAAoB"}
1
+ {"version":3,"names":["PID","RP","Errors","WalletInstanceAttestation","getUnsignedDPop","RelyingPartySolution","verifyTrustChain","getEntityConfiguration"],"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,SAASC,eAAe,QAAQ,cAAc;AAC9C,SAASC,oBAAoB,QAAQ,MAAM;AAC3C,SAASC,gBAAgB,EAAEC,sBAAsB,QAAQ,SAAS;AAElE,SACEP,GAAG,EACHC,EAAE,EACFE,yBAAyB,EACzBD,MAAM,EACNE,eAAe,EACfC,oBAAoB,EACpBC,gBAAgB,EAChBC,sBAAsB"}
@@ -13,7 +13,7 @@ describe("decodeAuthRequestQR", () => {
13
13
  });
14
14
  });
15
15
  describe("RpEntityConfiguration", () => {
16
- it("should parse a valid confdsfashdhasd", async () => {
16
+ it("should parse a valid conf", async () => {
17
17
  const pp = {
18
18
  header: {
19
19
  alg: "RS256",
@@ -34,6 +34,13 @@ describe("RpEntityConfiguration", () => {
34
34
  }]
35
35
  },
36
36
  metadata: {
37
+ federation_entity: {
38
+ organization_name: "wallet-provider",
39
+ homepage_uri: "https://wallet-provider.example",
40
+ policy_uri: "https://wallet-provider.example",
41
+ logo_uri: "https://wallet-provider.example",
42
+ contacts: ["https://wallet-provider.example"]
43
+ },
37
44
  wallet_relying_party: {
38
45
  application_type: "web",
39
46
  authorization_encrypted_response_alg: ["RSA-OAEP", "RSA-OAEP-256", "ECDH-ES", "ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW"],
@@ -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","wallet_relying_party","application_type","authorization_encrypted_response_alg","authorization_encrypted_response_enc","authorization_signed_response_alg","client_id","client_name","contacts","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,oBAAoB,QAAQ,IAAI;AACzC,SAASC,sBAAsB,QAAQ,oBAAoB;AAC3D,SAASC,qBAAqB,QAAQ,UAAU;AAEhDC,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpCC,EAAE,CAAC,0CAA0C,EAAE,YAAY;IACzD,MAAMC,MAAM,GACV,sJAAsJ;IACxJ,MAAMC,MAAM,GAAGN,oBAAoB,CAACO,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,MAAMR,oBAAoB,CAACO,mBAAmB,CAACF,MAAM,CAAC,CAAC,CAACM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,MAAM,GAAGJ,qBAAqB,CAACmE,SAAS,CAACzD,EAAE,CAAC;IAClD,IAAIN,MAAM,CAACgE,OAAO,KAAK,KAAK,EAAE;MAC5B,MAAMhE,MAAM,CAACiE,KAAK;IACpB;IACA/D,MAAM,CAACF,MAAM,CAACgE,OAAO,CAAC,CAACE,IAAI,CAAC,IAAI,CAAC;EACnC,CAAC,CAAC;AACJ,CAAC,CAAC"}
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,SAASA,oBAAoB,QAAQ,IAAI;AACzC,SAASC,sBAAsB,QAAQ,oBAAoB;AAC3D,SAASC,qBAAqB,QAAQ,UAAU;AAEhDC,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpCC,EAAE,CAAC,0CAA0C,EAAE,YAAY;IACzD,MAAMC,MAAM,GACV,sJAAsJ;IACxJ,MAAMC,MAAM,GAAGN,oBAAoB,CAACO,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,Y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,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"}
@@ -3,6 +3,7 @@ import { decode as decodeJwt, decodeBase64, sha256ToBase64, SignJWT, EncryptJwe,
3
3
  import { QRCodePayload, RequestObject, RpEntityConfiguration } from "./types";
4
4
  import uuid from "react-native-uuid";
5
5
  import { disclose } from "../sd-jwt";
6
+ import { getEntityConfiguration } from "../trust";
6
7
  export class RelyingPartySolution {
7
8
  constructor(relyingPartyBaseUrl, walletInstanceAttestation) {
8
9
  let appFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : fetch;
@@ -232,19 +233,9 @@ export class RelyingPartySolution {
232
233
  * Obtain the relying party entity configuration.
233
234
  */
234
235
  async getEntityConfiguration() {
235
- const wellKnownUrl = this.relyingPartyBaseUrl + "/.well-known/openid-federation";
236
- const response = await this.appFetch(wellKnownUrl, {
237
- method: "GET"
238
- });
239
- if (response.status === 200) {
240
- const responseText = await response.text();
241
- const responseJwt = await decodeJwt(responseText);
242
- return RpEntityConfiguration.parse({
243
- header: responseJwt.protectedHeader,
244
- payload: responseJwt.payload
245
- });
246
- }
247
- throw new IoWalletError(`Unable to obtain RP Entity Configuration. Response code: ${response.status}`);
236
+ return getEntityConfiguration(this.relyingPartyBaseUrl, {
237
+ appFetch: this.appFetch
238
+ }).then(RpEntityConfiguration.parse);
248
239
  }
249
240
  }
250
241
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AuthRequestDecodeError","IoWalletError","NoSuitableKeysFoundInEntityConfiguration","decode","decodeJwt","decodeBase64","sha256ToBase64","SignJWT","EncryptJwe","verify","QRCodePayload","RequestObject","RpEntityConfiguration","uuid","disclose","RelyingPartySolution","constructor","relyingPartyBaseUrl","walletInstanceAttestation","appFetch","arguments","length","undefined","fetch","decodeAuthRequestQR","qrcode","decoded","decodedUrl","URL","protocol","resource","hostname","requestURI","searchParams","get","clientId","result","safeParse","success","data","error","message","getUnsignedWalletInstanceDPoP","walletInstanceAttestationJwk","authRequestUrl","jti","v4","htm","htu","ath","setProtectedHeader","alg","jwk","typ","setIssuedAt","setExpirationTime","toSign","getRequestObject","signedWalletInstanceDPoP","requestUri","entity","response","method","headers","Authorization","DPoP","status","responseJson","json","responseEncodedJwt","responseJwt","pubKey","payload","metadata","wallet_relying_party","jwks","find","_ref","kid","protectedHeader","requestObj","parse","header","prepareVpToken","walletInstanceIdentifier","_ref2","signKeyId","vc","claims","token","vp","paths","vp_token","iss","nonce","setAudience","response_uri","vc_scope","scope","presentation_submission","definition_id","id","descriptor_map","map","p","path","format","sendAuthorizationResponse","chooseRSAPublicKeyToEncrypt","authzResponsePayload","JSON","stringify","state","encrypted","enc","encrypt","formBody","URLSearchParams","body","toString","text","usingRsa256","filter","use","kty","getEntityConfiguration","wellKnownUrl","responseText"],"sourceRoot":"../../../src","sources":["rp/index.ts"],"mappings":"AAAA,SACEA,sBAAsB,EACtBC,aAAa,EACbC,wCAAwC,QACnC,iBAAiB;AACxB,SACEC,MAAM,IAAIC,SAAS,EACnBC,YAAY,EACZC,cAAc,EACdC,OAAO,EACPC,UAAU,EACVC,MAAM,QACD,6BAA6B;AACpC,SAC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Y,GAAG,MAAMlE,QAAQ,CAAC2D,IAAI,CAAC,CAAC;MAC1C,MAAMlD,WAAW,GAAG,MAAMlE,SAAS,CAAC2H,YAAY,CAAC;MACjD,OAAOnH,qBAAqB,CAACqE,KAAK,CAAC;QACjCC,MAAM,EAAEZ,WAAW,CAACS,eAAe;QACnCP,OAAO,EAAEF,WAAW,CAACE;MACvB,CAAC,CAAC;IACJ;IAEA,MAAM,IAAIvE,aAAa,CACpB,4DAA2D4D,QAAQ,CAACK,MAAO,EAC9E,CAAC;EACH;AACF"}
1
+ {"version":3,"names":["AuthRequestDecodeError","IoWalletError","NoSuitableKeysFoundInEntityConfiguration","decode","decodeJwt","decodeBase64","sha256ToBase64","SignJWT","EncryptJwe","verify","QRCodePayload","RequestObject","RpEntityConfiguration","uuid","disclose","getEntityConfiguration","RelyingPartySolution","constructor","relyingPartyBaseUrl","walletInstanceAttestation","appFetch","arguments","length","undefined","fetch","decodeAuthRequestQR","qrcode","decoded","decodedUrl","URL","protocol","resource","hostname","requestURI","searchParams","get","clientId","result","safeParse","success","data","error","message","getUnsignedWalletInstanceDPoP","walletInstanceAttestationJwk","authRequestUrl","jti","v4","htm","htu","ath","setProtectedHeader","alg","jwk","typ","setIssuedAt","setExpirationTime","toSign","getRequestObject","signedWalletInstanceDPoP","requestUri","entity","response","method","headers","Authorization","DPoP","status","responseJson","json","responseEncodedJwt","responseJwt","pubKey","payload","metadata","wallet_relying_party","jwks","find","_ref","kid","protectedHeader","requestObj","parse","header","prepareVpToken","walletInstanceIdentifier","_ref2","signKeyId","vc","claims","token","vp","paths","vp_token","iss","nonce","setAudience","response_uri","vc_scope","scope","presentation_submission","definition_id","id","descriptor_map","map","p","path","format","sendAuthorizationResponse","chooseRSAPublicKeyToEncrypt","authzResponsePayload","JSON","stringify","state","encrypted","enc","encrypt","formBody","URLSearchParams","body","toString","text","usingRsa256","filter","use","kty","then"],"sourceRoot":"../../../src","sources":["rp/index.ts"],"mappings":"AAAA,SACEA,sBAAsB,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DE,QAAQ,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC,CAAC0G,IAAI,CAAClH,qBAAqB,CAACsE,KAAK,CAAC;EACtC;AACF"}
@@ -1,6 +1,7 @@
1
1
  import { JWK } from "../utils/jwk";
2
2
  import { UnixTime } from "../sd-jwt/types";
3
3
  import * as z from "zod";
4
+ import { EntityConfiguration } from "../trust/types";
4
5
  export const RequestObject = z.object({
5
6
  header: z.object({
6
7
  // FIXME: SIW-421 type field must be either required or omitted, optional isn't useful
@@ -24,22 +25,12 @@ export const RequestObject = z.object({
24
25
  })
25
26
  });
26
27
 
27
- // TODO: This types is WIP in technical rules
28
+ /**
29
+ * EntityConfiguration plus the metadata specific for a Relying Party entity.
30
+ */
28
31
 
29
- export const RpEntityConfiguration = z.object({
30
- header: z.object({
31
- typ: z.literal("entity-statement+jwt"),
32
- alg: z.string(),
33
- kid: z.string()
34
- }),
32
+ export const RpEntityConfiguration = EntityConfiguration.and(z.object({
35
33
  payload: z.object({
36
- exp: UnixTime,
37
- iat: UnixTime,
38
- iss: z.string(),
39
- sub: z.string(),
40
- jwks: z.object({
41
- keys: z.array(JWK)
42
- }),
43
34
  metadata: z.object({
44
35
  wallet_relying_party: z.object({
45
36
  application_type: z.string(),
@@ -48,20 +39,9 @@ export const RpEntityConfiguration = z.object({
48
39
  jwks: z.array(JWK),
49
40
  contacts: z.array(z.string())
50
41
  })
51
- // FIXME: SIW-422 require federation_metadata field
52
- // Actual RP implementation does not comply with the spec
53
- /* federation_entity: z.object({
54
- organization_name: z.string(),
55
- homepage_uri: z.string(),
56
- policy_uri: z.string(),
57
- logo_uri: z.string(),
58
- contacts: z.array(z.string()),
59
- }), */
60
- }),
61
-
62
- authority_hints: z.array(z.string())
42
+ })
63
43
  })
64
- });
44
+ }));
65
45
  export const QRCodePayload = z.object({
66
46
  protocol: z.string(),
67
47
  resource: z.string(),
@@ -1 +1 @@
1
- {"version":3,"names":["JWK","UnixTime","z","RequestObject","object","header","typ","literal","optional","alg","string","kid","trust_chain","array","payload","iss","iat","exp","state","nonce","response_uri","response_type","response_mode","client_id","client_id_scheme","scope","RpEntityConfiguration","sub","jwks","keys","metadata","wallet_relying_party","application_type","client_name","contacts","authority_hints","QRCodePayload","protocol","resource","clientId","requestURI"],"sourceRoot":"../../../src","sources":["rp/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,CAAC,MAAM,KAAK;AAGxB,OAAO,MAAMC,aAAa,GAAGD,CAAC,CAACE,MAAM,CAAC;EACpCC,MAAM,EAAEH,CAAC,CAACE,MAAM,CAAC;IACf;IACAE,GAAG,EAAEJ,CAAC,CAACK,OAAO,CAAC,KAAK,CAAC,CAACC,QAAQ,CAAC,CAAC;IAChCC,GAAG,EAAEP,CAAC,CAACQ,MAAM,CAAC,CAAC;IACfC,GAAG,EAAET,CAAC,CAACQ,MAAM,CAAC,CAAC;IACfE,WAAW,EAAEV,CAAC,CAACW,KAAK,CAACX,CAAC,CAACQ,MAAM,CAAC,CAAC;EACjC,CAAC,CAAC;EACFI,OAAO,EAAEZ,CAAC,CAACE,MAAM,CAAC;IAChBW,GAAG,EAAEb,CAAC,CAACQ,MAAM,CAAC,CAAC;IACfM,GAAG,EAAEf,QAAQ;IACbgB,GAAG,EAAEhB,QAAQ;IACbiB,KAAK,EAAEhB,CAAC,CAACQ,MAAM,CAAC,CAAC;IACjBS,KAAK,EAAEjB,CAAC,CAACQ,MAAM,CAAC,CAAC;IACjBU,YAAY,EAAElB,CAAC,CAACQ,MAAM,CAAC,CAAC;IACxBW,aAAa,EAAEnB,CAAC,CAACK,OAAO,CAAC,UAAU,CAAC;IACpCe,aAAa,EAAEpB,CAAC,CAACK,OAAO,CAAC,iBAAiB,CAAC;IAC3CgB,SAAS,EAAErB,CAAC,CAACQ,MAAM,CAAC,CAAC;IACrBc,gBAAgB,EAAEtB,CAAC,CAACK,OAAO,CAAC,WAAW,CAAC;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AC;EACrC,CAAC;AACH,CAAC,CAAC;AAGF,OAAO,MAAM0B,aAAa,GAAGlC,CAAC,CAACE,MAAM,CAAC;EACpCiC,QAAQ,EAAEnC,CAAC,CAACQ,MAAM,CAAC,CAAC;EACpB4B,QAAQ,EAAEpC,CAAC,CAACQ,MAAM,CAAC,CAAC;EAAE;EACtB6B,QAAQ,EAAErC,CAAC,CAACQ,MAAM,CAAC,CAAC;EACpB8B,UAAU,EAAEtC,CAAC,CAACQ,MAAM,CAAC;AACvB,CAAC,CAAC;;AAEF;AACA;AACA"}
1
+ {"version":3,"names":["JWK","UnixTime","z","EntityConfiguration","RequestObject","object","header","typ","literal","optional","alg","string","kid","trust_chain","array","payload","iss","iat","exp","state","nonce","response_uri","response_type","response_mode","client_id","client_id_scheme","scope","RpEntityConfiguration","and","metadata","wallet_relying_party","application_type","client_name","jwks","contacts","QRCodePayload","protocol","resource","clientId","requestURI"],"sourceRoot":"../../../src","sources":["rp/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,SAASC,mBAAmB,QAAQ,gBAAgB;AAGpD,OAAO,MAAMC,aAAa,GAAGF,CAAC,CAACG,MAAM,CAAC;EACpCC,MAAM,EAAEJ,CAAC,CAACG,MAAM,CAAC;IACf;IACAE,GAAG,EAAEL,CAAC,CAACM,OAAO,CAAC,KAAK,CAAC,CAACC,QAAQ,CAAC,CAAC;IAChCC,GAAG,EAAER,CAAC,CAACS,MAAM,CAAC,CAAC;IACfC,GAAG,EAAEV,CAAC,CAACS,MAAM,CAAC,CAAC;IACfE,WAAW,EAAEX,CAAC,CAACY,KAAK,CAACZ,CAAC,CAACS,MAAM,CAAC,CAAC;EACjC,CAAC,CAAC;EACFI,OAAO,EAAEb,CAAC,CAACG,MAAM,CAAC;IAChBW,GAAG,EAAEd,CAAC,CAACS,MAAM,CAAC,CAAC;IACfM,GA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B0B,QAAQ,EAAEnC,CAAC,CAACS,MAAM,CAAC,CAAC;EAAE;EACtB2B,QAAQ,EAAEpC,CAAC,CAACS,MAAM,CAAC,CAAC;EACpB4B,UAAU,EAAErC,CAAC,CAACS,MAAM,CAAC;AACvB,CAAC,CAAC;;AAEF;AACA;AACA"}
@@ -0,0 +1,86 @@
1
+ import { decode as decodeJwt, verify as verifyJwt } from "@pagopa/io-react-native-jwt";
2
+ import { EntityConfiguration, EntityStatement, TrustAnchorEntityConfiguration } from "./types";
3
+ import { IoWalletError } from "../utils/errors";
4
+ import * as z from "zod";
5
+ // Verify a token signature
6
+ // The kid is extracted from the token header
7
+ const verify = async (token, kid, jwks) => {
8
+ const jwk = jwks.find(k => k.kid === kid);
9
+ if (!jwk) {
10
+ throw new Error(`Invalid kid: ${kid}, token: ${token}`);
11
+ }
12
+ const {
13
+ protectedHeader: header,
14
+ payload
15
+ } = await verifyJwt(token, jwk);
16
+ return {
17
+ header,
18
+ payload
19
+ };
20
+ };
21
+ const decode = token => {
22
+ const {
23
+ protectedHeader: header,
24
+ payload
25
+ } = decodeJwt(token);
26
+ return {
27
+ header,
28
+ payload
29
+ };
30
+ };
31
+
32
+ // The first element of the chain is supposed to be the Entity Configuration for the document issuer
33
+ const FirstElementShape = EntityConfiguration;
34
+ // Each element but the first is supposed to be an Entity Statement
35
+ const MiddleElementShape = EntityStatement;
36
+ // The last element of the chain can either be an Entity Statement
37
+ // or the Entity Configuration for the known Trust Anchor
38
+ const LastElementShape = z.union([EntityStatement, TrustAnchorEntityConfiguration]);
39
+
40
+ /**
41
+ * Validates a provided trust chain against a known trust
42
+ *
43
+ * @param trustAnchorEntity
44
+ * @param chain
45
+ * @returns The list of parsed token representing the chain
46
+ * @throws {IoWalletError} If the chain is not valid
47
+ */
48
+ export async function verifyTrustChain(trustAnchorEntity, chain) {
49
+ // If the chain is empty, fail
50
+ if (chain.length === 0) {
51
+ throw new IoWalletError("Cannot verify empty trust chain");
52
+ }
53
+
54
+ // Select the expected token shape
55
+ const selectTokenShape = elementIndex => elementIndex === 0 ? FirstElementShape : elementIndex === chain.length - 1 ? LastElementShape : MiddleElementShape;
56
+
57
+ // select the kid from the current index
58
+ const selectKid = currentIndex => {
59
+ const token = chain[currentIndex];
60
+ if (!token) {
61
+ throw new IoWalletError(`Cannot select kid: empty token`);
62
+ }
63
+ const shape = selectTokenShape(currentIndex);
64
+ return shape.parse(decode(token)).header.kid;
65
+ };
66
+
67
+ // select keys from the next token
68
+ // if the current token is the last, keys fro trust anchor will be used
69
+ const selectKeys = currentIndex => {
70
+ if (currentIndex === chain.length - 1) {
71
+ return trustAnchorEntity.payload.jwks.keys;
72
+ }
73
+ const nextIndex = currentIndex + 1;
74
+ const nextToken = chain[nextIndex];
75
+ if (!nextToken) {
76
+ throw new IoWalletError(`Cannot select keys: empty nextToken`);
77
+ }
78
+ const shape = selectTokenShape(nextIndex);
79
+ return shape.parse(decode(nextToken)).payload.jwks.keys;
80
+ };
81
+
82
+ // Iterate the chain and validate each element's signature against the public keys of its next
83
+ // If there is no next, hence it's the end of the chain and it must be verified by the Trust Anchor
84
+ return Promise.all(chain.map((token, i) => [token, selectKid(i), selectKeys(i)]).map(args => verify(...args)));
85
+ }
86
+ //# sourceMappingURL=chain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","EntityConfiguration","EntityStatement","TrustAnchorEntityConfiguration","IoWalletError","z","token","kid","jwks","jwk","find","k","Error","protectedHeader","header","payload","FirstElementShape","MiddleElementShape","LastElementShape","union","verifyTrustChain","trustAnchorEntity","chain","length","selectTokenShape","elementIndex","selectKid","currentIndex","shape","parse","selectKeys","keys","nextIndex","nextToken","Promise","all","map","i","args"],"sourceRoot":"../../../src","sources":["trust/chain.ts"],"mappings":"AAAA,SACEA,MAAM,IAAIC,SAAS,EACnBC,MAAM,IAAIC,SAAS,QACd,6BAA6B;AACpC,SACEC,mBAAmB,EACnBC,eAAe,EACfC,8BAA8B,QACzB,S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 -0,0 +1,34 @@
1
+ import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
2
+ import { EntityConfiguration } from "./types";
3
+ import { IoWalletError } from "../utils/errors";
4
+ import { verifyTrustChain } from "./chain";
5
+ export { verifyTrustChain };
6
+
7
+ /**
8
+ * Fetch and parse teh entity configuration document for a given federation entity
9
+ *
10
+ * @param entityBaseUrl The base url of the entity.
11
+ * @param options.appFetch An optional instance of the http client to be used.
12
+ * @returns The parsed entity configuration object
13
+ * @throws {IoWalletError} If the http request fails
14
+ * @throws Parse error if the document is not in the expected shape.
15
+ */
16
+ export async function getEntityConfiguration(entityBaseUrl) {
17
+ let {
18
+ appFetch = fetch
19
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20
+ const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-federation`;
21
+ const response = await appFetch(wellKnownUrl, {
22
+ method: "GET"
23
+ });
24
+ if (response.status === 200) {
25
+ const responseText = await response.text();
26
+ const responseJwt = decodeJwt(responseText);
27
+ return EntityConfiguration.parse({
28
+ header: responseJwt.protectedHeader,
29
+ payload: responseJwt.payload
30
+ });
31
+ }
32
+ throw new IoWalletError(`Unable to obtain Entity Configuration at ${wellKnownUrl}. Response code: ${response.status}`);
33
+ }
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["decode","decodeJwt","EntityConfiguration","IoWalletError","verifyTrustChain","getEntityConfiguration","entityBaseUrl","appFetch","fetch","arguments","length","undefined","wellKnownUrl","response","method","status","responseText","text","responseJwt","parse","header","protectedHeader","payload"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,gBAAgB,QAAQ,SAAS;AAE1C,SAASA,gBAAgB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,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,GAAGjB,SAAS,CAACe,YAAY,CAAC;IAC3C,OAAOd,mBAAmB,CAACiB,KAAK,CAAC;MAC/BC,MAAM,EAAEF,WAAW,CAACG,eAAe;MACnCC,OAAO,EAAEJ,WAAW,CAACI;IACvB,CAAC,CAAC;EACJ;EAEA,MAAM,IAAInB,aAAa,CACpB,4CAA2CS,YAAa,oBAAmBC,QAAQ,CAACE,MAAO,EAC9F,CAAC;AACH"}
@@ -0,0 +1,52 @@
1
+ import { UnixTime } from "../sd-jwt/types";
2
+ import { JWK } from "../utils/jwk";
3
+ import * as z from "zod";
4
+ export const TrustMark = z.object({
5
+ id: z.string(),
6
+ trust_mark: z.string()
7
+ });
8
+ export const EntityStatement = z.object({
9
+ header: z.object({
10
+ typ: z.literal("entity-statement+jwt"),
11
+ alg: z.string(),
12
+ kid: z.string()
13
+ }),
14
+ payload: z.object({
15
+ iss: z.string(),
16
+ sub: z.string(),
17
+ jwks: z.object({
18
+ keys: z.array(JWK)
19
+ }),
20
+ trust_marks: z.array(TrustMark),
21
+ iat: z.number(),
22
+ exp: z.number()
23
+ })
24
+ });
25
+ export const EntityConfiguration = z.object({
26
+ header: z.object({
27
+ typ: z.literal("entity-statement+jwt"),
28
+ alg: z.string(),
29
+ kid: z.string()
30
+ }),
31
+ payload: z.object({
32
+ exp: UnixTime,
33
+ iat: UnixTime,
34
+ iss: z.string(),
35
+ sub: z.string(),
36
+ jwks: z.object({
37
+ keys: z.array(JWK)
38
+ }),
39
+ metadata: z.object({
40
+ federation_entity: z.object({
41
+ organization_name: z.string(),
42
+ homepage_uri: z.string(),
43
+ policy_uri: z.string(),
44
+ logo_uri: z.string(),
45
+ contacts: z.array(z.string())
46
+ })
47
+ }),
48
+ authority_hints: z.array(z.string())
49
+ })
50
+ });
51
+ export const TrustAnchorEntityConfiguration = EntityConfiguration;
52
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnixTime","JWK","z","TrustMark","object","id","string","trust_mark","EntityStatement","header","typ","literal","alg","kid","payload","iss","sub","jwks","keys","array","trust_marks","iat","number","exp","EntityConfiguration","metadata","federation_entity","organization_name","homepage_uri","policy_uri","logo_uri","contacts","authority_hints","TrustAnchorEntityConfiguration"],"sourceRoot":"../../../src","sources":["trust/types.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,GAAG,QAAQ,cAAc;AAClC,OAAO,KAAKC,CAAC,MAAM,KAAK;AAExB,OAAO,MAAMC,SAAS,GAAGD,CAAC,CAACE,MAAM,CAAC;EAAEC,EAAE,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EAAEC,UAAU,EAAEL,CAAC,CAACI,MAAM,CAAC;AAAE,CAAC,CAAC;AAI7E,OAAO,MAAME,eAAe,GAAGN,CAAC,CAACE,MAAM,CAAC;EACtCK,MAAM,EAAEP,CAAC,CAACE,MAAM,CAAC;IACfM,GAAG,EAAER,CAAC,CAACS,OAAO,CAAC,sBAAsB,CAAC;IACtCC,GAAG,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC;IACfO,GAAG,EAAEX,CAAC,CAACI,MAAM,CAAC;EAChB,CAAC,CAAC;EACFQ,OAAO,EAAEZ,CAAC,CAACE,MAAM,CAAC;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I,MAAM,CAAC,CAAC;QACtBwB,QAAQ,EAAE5B,CAAC,CAACI,MAAM,CAAC,CAAC;QACpByB,QAAQ,EAAE7B,CAAC,CAACiB,KAAK,CAACjB,CAAC,CAACI,MAAM,CAAC,CAAC;MAC9B,CAAC;IACH,CAAC,CAAC;IACF0B,eAAe,EAAE9B,CAAC,CAACiB,KAAK,CAACjB,CAAC,CAACI,MAAM,CAAC,CAAC;EACrC,CAAC;AACH,CAAC,CAAC;AAKF,OAAO,MAAM2B,8BAA8B,GAAGT,mBAAmB"}
@@ -31,16 +31,16 @@ export class Issuing {
31
31
  };
32
32
  const walletInstanceAttestationRequest = new SignJWT({
33
33
  iss: keyThumbprint,
34
- sub: this.walletProviderBaseUrl,
34
+ aud: this.walletProviderBaseUrl,
35
35
  jti: `${uuid.v4()}`,
36
- type: "WalletInstanceAttestationRequest",
36
+ nonce: `${uuid.v4()}`,
37
37
  cnf: {
38
38
  jwk: fixBase64EncodingOnKey(publicKey)
39
39
  }
40
40
  }).setProtectedHeader({
41
41
  alg: "ES256",
42
42
  kid: publicKey.kid,
43
- typ: "var+jwt"
43
+ typ: "wiar+jwt"
44
44
  }).setIssuedAt().setExpirationTime("1h").toSign();
45
45
  return walletInstanceAttestationRequest;
46
46
  }
@@ -69,7 +69,7 @@ export class Issuing {
69
69
  await verifyJwt(signedAttestationRequest, publicKey);
70
70
  const tokenUrl = new URL("token", this.walletProviderBaseUrl).href;
71
71
  const requestBody = {
72
- grant_type: "urn:ietf:params:oauth:client-assertion-type:jwt-key-attestation",
72
+ grant_type: "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation",
73
73
  assertion: signedAttestationRequest
74
74
  };
75
75
  const response = await this.appFetch(tokenUrl, {
@@ -1 +1 @@
1
- {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","SignJWT","thumbprint","JWK","fixBase64EncodingOnKey","WalletInstanceAttestationRequestJwt","uuid","WalletInstanceAttestationIssuingError","Issuing","constructor","walletProviderBaseUrl","appFetch","arguments","length","undefined","fetch","getAttestationRequestToSign","jwk","parsedJwk","parse","keyThumbprint","publicKey","kid","walletInstanceAttestationRequest","iss","sub","jti","v4","type","cnf","setProtectedHeader","alg","typ","setIssuedAt","setExpirationTime","toSign","getAttestation","attestationRequest","signature","signedAttestationRequest","appendSignature","decodedRequest","parsedRequest","payload","header","protectedHeader","tokenUrl","URL","href","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,OAAO,EAAEC,UAAU,QAAQ,6BAA6B;AACjE,SAASC,GAAG,EAAEC,sBAAsB,QAAQ,cAAc;AAC1D,SAASC,mCAAmC,QAAQ,SAAS;AAC7D,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,qCAAqC,QAAQ,iBAAiB;AAEvE,OAAO,MAAMC,OAAO,CAAC;EAGnBC,WAAWA,CACTC,qBAA6B,EAE7B;IAAA,IADAC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;IAEtC,IAAI,CAACL,qBAAqB,GAAGA,qBAAqB;IAClD,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC1B;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMK,2BAA2BA,CAACC,GAAQ,EAAmB;IAC3D,MAAMC,SAAS,GAAGf,GAAG,CAACgB,KAAK,CAACF,GAAG,CAAC;IAChC,MAAMG,aAAa,GAAG,MAAMlB,UAAU,CAACgB,SAAS,CAAC;IACjD,MAAMG,SAAS,GAAG;MAAE,GAAGH,SAAS;MAAEI,GAAG,EAAEF;IAAc,CAAC;IAEtD,MAAMG,gCAAgC,GAAG,IAAItB,OAAO,CAAC;MACnDuB,G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ACzC,QAAQ,CAACmC,QAAQ,EAAE;MAC7CO,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,IAAIpD,qCAAqC,CAC7C,mEAAmE,EAClE,kBAAiB6C,QAAQ,CAACM,MAAO,EACpC,CAAC;EACH;AACF"}
1
+ {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","SignJWT","thumbprint","JWK","fixBase64EncodingOnKey","WalletInstanceAttestationRequestJwt","uuid","WalletInstanceAttestationIssuingError","Issuing","constructor","walletProviderBaseUrl","appFetch","arguments","length","undefined","fetch","getAttestationRequestToSign","jwk","parsedJwk","parse","keyThumbprint","publicKey","kid","walletInstanceAttestationRequest","iss","aud","jti","v4","nonce","cnf","setProtectedHeader","alg","typ","setIssuedAt","setExpirationTime","toSign","getAttestation","attestationRequest","signature","signedAttestationRequest","appendSignature","decodedRequest","parsedRequest","payload","header","protectedHeader","tokenUrl","URL","href","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,OAAO,EAAEC,UAAU,QAAQ,6BAA6B;AACjE,SAASC,GAAG,EAAEC,sBAAsB,QAAQ,cAAc;AAC1D,SAASC,mCAAmC,QAAQ,SAAS;AAC7D,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,qCAAqC,QAAQ,iBAAiB;AAEvE,OAAO,MAAMC,OAAO,CAAC;EAGnBC,WAAWA,CACTC,qBAA6B,EAE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