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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. package/README.md +98 -22
  2. package/lib/commonjs/index.js +12 -8
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/pid/index.js +3 -8
  5. package/lib/commonjs/pid/index.js.map +1 -1
  6. package/lib/commonjs/pid/issuing.js +152 -168
  7. package/lib/commonjs/pid/issuing.js.map +1 -1
  8. package/lib/commonjs/pid/metadata.js +28 -25
  9. package/lib/commonjs/pid/metadata.js.map +1 -1
  10. package/lib/commonjs/rp/__test__/index.test.js +5 -3
  11. package/lib/commonjs/rp/__test__/index.test.js.map +1 -1
  12. package/lib/commonjs/rp/index.js +158 -154
  13. package/lib/commonjs/rp/index.js.map +1 -1
  14. package/lib/commonjs/trust/types.js +9 -7
  15. package/lib/commonjs/trust/types.js.map +1 -1
  16. package/lib/commonjs/utils/crypto.js +46 -0
  17. package/lib/commonjs/utils/crypto.js.map +1 -0
  18. package/lib/commonjs/utils/dpop.js +14 -7
  19. package/lib/commonjs/utils/dpop.js.map +1 -1
  20. package/lib/commonjs/wallet-instance-attestation/index.js +3 -3
  21. package/lib/commonjs/wallet-instance-attestation/issuing.js +50 -60
  22. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  23. package/lib/module/index.js +4 -3
  24. package/lib/module/index.js.map +1 -1
  25. package/lib/module/pid/index.js +1 -1
  26. package/lib/module/pid/index.js.map +1 -1
  27. package/lib/module/pid/issuing.js +151 -171
  28. package/lib/module/pid/issuing.js.map +1 -1
  29. package/lib/module/pid/metadata.js +28 -25
  30. package/lib/module/pid/metadata.js.map +1 -1
  31. package/lib/module/rp/__test__/index.test.js +1 -1
  32. package/lib/module/rp/__test__/index.test.js.map +1 -1
  33. package/lib/module/rp/index.js +155 -153
  34. package/lib/module/rp/index.js.map +1 -1
  35. package/lib/module/trust/types.js +7 -6
  36. package/lib/module/trust/types.js.map +1 -1
  37. package/lib/module/utils/crypto.js +40 -0
  38. package/lib/module/utils/crypto.js.map +1 -0
  39. package/lib/module/utils/dpop.js +13 -5
  40. package/lib/module/utils/dpop.js.map +1 -1
  41. package/lib/module/wallet-instance-attestation/index.js +2 -2
  42. package/lib/module/wallet-instance-attestation/index.js.map +1 -1
  43. package/lib/module/wallet-instance-attestation/issuing.js +48 -58
  44. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  45. package/lib/typescript/index.d.ts +4 -3
  46. package/lib/typescript/index.d.ts.map +1 -1
  47. package/lib/typescript/pid/index.d.ts +1 -1
  48. package/lib/typescript/pid/index.d.ts.map +1 -1
  49. package/lib/typescript/pid/issuing.d.ts +51 -87
  50. package/lib/typescript/pid/issuing.d.ts.map +1 -1
  51. package/lib/typescript/pid/metadata.d.ts +1338 -408
  52. package/lib/typescript/pid/metadata.d.ts.map +1 -1
  53. package/lib/typescript/rp/index.d.ts +48 -86
  54. package/lib/typescript/rp/index.d.ts.map +1 -1
  55. package/lib/typescript/rp/types.d.ts +413 -57
  56. package/lib/typescript/rp/types.d.ts.map +1 -1
  57. package/lib/typescript/sd-jwt/index.d.ts +1 -1
  58. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  59. package/lib/typescript/trust/types.d.ts +1000 -274
  60. package/lib/typescript/trust/types.d.ts.map +1 -1
  61. package/lib/typescript/utils/crypto.d.ts +10 -0
  62. package/lib/typescript/utils/crypto.d.ts.map +1 -0
  63. package/lib/typescript/utils/dpop.d.ts +10 -2
  64. package/lib/typescript/utils/dpop.d.ts.map +1 -1
  65. package/lib/typescript/wallet-instance-attestation/index.d.ts +2 -2
  66. package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
  67. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +17 -31
  68. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  69. package/package.json +2 -2
  70. package/src/index.ts +5 -3
  71. package/src/pid/index.ts +1 -1
  72. package/src/pid/issuing.ts +233 -225
  73. package/src/pid/metadata.ts +32 -27
  74. package/src/rp/__test__/index.test.ts +1 -1
  75. package/src/rp/index.ts +180 -188
  76. package/src/sd-jwt/index.ts +1 -1
  77. package/src/trust/types.ts +39 -32
  78. package/src/utils/crypto.ts +41 -0
  79. package/src/utils/dpop.ts +17 -7
  80. package/src/wallet-instance-attestation/index.ts +2 -2
  81. package/src/wallet-instance-attestation/issuing.ts +55 -62
@@ -1 +1 @@
1
- {"version":3,"names":["_errors","require","_ioReactNativeJwt","_types","_reactNativeUuid","_interopRequireDefault","_sdJwt","_trust","obj","__esModule","default","RelyingPartySolution","constructor","relyingPartyBaseUrl","walletInstanceAttestation","appFetch","arguments","length","undefined","fetch","decodeAuthRequestQR","qrcode","decoded","decodeBase64","decodedUrl","URL","protocol","resource","hostname","requestURI","searchParams","get","clientId","result","QRCodePayload","safeParse","success","data","AuthRequestDecodeError","error","message","getUnsignedWalletInstanceDPoP","walletInstanceAttestationJwk","authRequestUrl","SignJWT","jti","uuid","v4","htm","htu","ath","sha256ToBase64","setProtectedHeader","alg","jwk","typ","setIssuedAt","setExpirationTime","toSign","getRequestObject","signedWalletInstanceDPoP","requestUri","entity","response","method","headers","Authorization","DPoP","status","responseJson","json","responseEncodedJwt","responseJwt","decodeJwt","pubKey","payload","metadata","wallet_relying_party","jwks","find","_ref","kid","protectedHeader","NoSuitableKeysFoundInEntityConfiguration","verify","requestObj","RequestObject","parse","header","IoWalletError","prepareVpToken","walletInstanceIdentifier","_ref2","signKeyId","vc","claims","token","vp","paths","disclose","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","EncryptJwe","enc","encrypt","formBody","URLSearchParams","body","toString","text","usingRsa256","filter","use","kty","getEntityConfiguration","then","RpEntityConfiguration","exports"],"sourceRoot":"../../../src","sources":["rp/index.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,G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AACzH,mBAAmB,EAAE;MACtDE,QAAQ,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC,CAACwH,IAAI,CAACC,4BAAqB,CAACjD,KAAK,CAAC;EACtC;AACF;AAACkD,OAAA,CAAA9H,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"names":["_errors","require","_ioReactNativeJwt","_types","_reactNativeUuid","_interopRequireDefault","_sdJwt","_trust","_dpop","_2","obj","__esModule","default","chooseRSAPublicKeyToEncrypt","entity","usingRsa256","payload","metadata","wallet_relying_party","jwks","filter","jwk","use","kty","NoSuitableKeysFoundInEntityConfiguration","getEntityConfiguration","appFetch","fetch","arguments","length","undefined","relyingPartyBaseUrl","getGenericEntityConfiguration","then","RpEntityConfiguration","parse","exports","decodeAuthRequestQR","qrcode","decoded","decodeBase64","decodedUrl","URL","protocol","resource","hostname","requestURI","searchParams","get","clientId","result","QRCodePayload","safeParse","success","data","AuthRequestDecodeError","error","message","getRequestObject","_ref","wiaCryptoContext","walletInstanceAttestation","requestUri","rpEntityConfiguration","signedWalletInstanceDPoP","createDPopToken","jti","uuid","v4","htm","htu","ath","sha256ToBase64","response","method","headers","Authorization","DPoP","status","responseJson","json","responseEncodedJwt","responseJwt","decodeJwt","pubKey","find","_ref2","kid","protectedHeader","verify","requestObject","RequestObject","header","IoWalletError","text","prepareVpToken","_ref3","pidCryptoContext","_ref4","_ref5","vc","claims","token","vp","paths","disclose","iss","WalletInstanceAttestation","decode","pidKid","getPublicKey","_","vp_token","SignJWT","setProtectedHeader","typ","setPayload","nonce","setAudience","response_uri","setIssuedAt","setExpirationTime","sign","vc_scope","scope","presentation_submission","definition_id","id","descriptor_map","map","p","path","format","sendAuthorizationResponse","_ref6","_ref7","presentation","authzResponsePayload","JSON","stringify","state","encrypted","EncryptJwe","alg","enc","encrypt","formBody","URLSearchParams","body","toString"],"sourceRoot":"../../../src","sources":["rp/index.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,i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IC,eAAe,CAAC;MAAE1E,QAAQ,EAAEoE;IAAU,CAAC,CAAC;IAC7D,MAAMO,IAAI,GAAGF,QAAQ,CAACG,QAAQ,CAAC,CAAC;IAEhC,MAAM5E,QAAQ,GAAG,MAAM/C,QAAQ,CAACgE,aAAa,CAAC1E,OAAO,CAACuG,YAAY,EAAE;MAClE7C,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDyE;IACF,CAAC,CAAC;IAEF,IAAI3E,QAAQ,CAACK,MAAM,KAAK,GAAG,EAAE;MAC3B,OAAO,MAAML,QAAQ,CAACO,IAAI,CAAC,CAAC;IAC9B;IAEA,MAAM,IAAIa,qBAAa,CACpB,oDAAmD,MAAMpB,QAAQ,CAACqB,IAAI,CAAC,CAAE,eACxErB,QAAQ,CAACK,MACV,EACH,CAAC;EACH,CAAC;AAAA;AAAC1C,OAAA,CAAAiG,yBAAA,GAAAA,yBAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TrustMark = exports.TrustAnchorEntityConfiguration = exports.EntityStatement = exports.EntityConfiguration = void 0;
6
+ exports.TrustMark = exports.TrustAnchorEntityConfiguration = exports.EntityStatement = exports.EntityConfigurationHeader = exports.EntityConfiguration = void 0;
7
7
  var _types = require("../sd-jwt/types");
8
8
  var _jwk = require("../utils/jwk");
9
9
  var z = _interopRequireWildcard(require("zod"));
@@ -32,12 +32,14 @@ const EntityStatement = z.object({
32
32
  })
33
33
  });
34
34
  exports.EntityStatement = EntityStatement;
35
+ const EntityConfigurationHeader = z.object({
36
+ typ: z.literal("entity-statement+jwt"),
37
+ alg: z.string(),
38
+ kid: z.string()
39
+ });
40
+ exports.EntityConfigurationHeader = EntityConfigurationHeader;
35
41
  const EntityConfiguration = z.object({
36
- header: z.object({
37
- typ: z.literal("entity-statement+jwt"),
38
- alg: z.string(),
39
- kid: z.string()
40
- }),
42
+ header: EntityConfigurationHeader,
41
43
  payload: z.object({
42
44
  exp: _types.UnixTime,
43
45
  iat: _types.UnixTime,
@@ -60,7 +62,7 @@ const EntityConfiguration = z.object({
60
62
  }).passthrough()
61
63
  }).passthrough(),
62
64
  authority_hints: z.array(z.string()).optional()
63
- })
65
+ }).passthrough()
64
66
  });
65
67
  exports.EntityConfiguration = EntityConfiguration;
66
68
  const TrustAnchorEntityConfiguration = EntityConfiguration;
@@ -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","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,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GA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EAAEnD,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACyB,QAAQ,CAAC,CAAC;QAChDC,wBAAwB,EAAErD,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACyB,QAAQ,CAAC,CAAC;QAC/CE,2BAA2B,EAAEtD,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACyB,QAAQ,CAAC,CAAC;QAClDG,qCAAqC,EAAEvD,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACyB,QAAQ,CAAC,CAAC;QAC5DI,mCAAmC,EAAExD,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACyB,QAAQ,CAAC,CAAC;QAC1DK,YAAY,EAAEzD,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACyB,QAAQ,CAAC,CAAC;QACnCM,UAAU,EAAE1D,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACyB,QAAQ,CAAC,CAAC;QACjCO,QAAQ,EAAE3D,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACyB,QAAQ,CAAC,CAAC;QAC/BQ,QAAQ,EAAE5D,CAAC,CAACyC,KAAK,CAACzC,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAAC,CAACyB,QAAQ,CAAC;MACzC,CAAC,CAAC,CACDS,WAAW,CAAC;IACjB,CAAC,CAAC,CACDA,WAAW,CAAC,CAAC;IAChBC,eAAe,EAAE9D,CAAC,CAACyC,KAAK,CAACzC,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAAC,CAACyB,QAAQ,CAAC;EAChD,CAAC;AACH,CAAC,CAAC;AAACvB,OAAA,CAAAkB,mBAAA,GAAAA,mBAAA;AAKI,MAAMgB,8BAA8B,GAAGhB,mBAAmB;AAAClB,OAAA,CAAAkC,8BAAA,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","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,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,GAAA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AC;QAC5DI,mCAAmC,EAAEzD,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAAC0B,QAAQ,CAAC,CAAC;QAC1DK,YAAY,EAAE1D,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAAC0B,QAAQ,CAAC,CAAC;QACnCM,UAAU,EAAE3D,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAAC0B,QAAQ,CAAC,CAAC;QACjCO,QAAQ,EAAE5D,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAAC0B,QAAQ,CAAC,CAAC;QAC/BQ,QAAQ,EAAE7D,CAAC,CAACyC,KAAK,CAACzC,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAAC,CAAC0B,QAAQ,CAAC;MACzC,CAAC,CAAC,CACDS,WAAW,CAAC;IACjB,CAAC,CAAC,CACDA,WAAW,CAAC,CAAC;IAChBC,eAAe,EAAE/D,CAAC,CAACyC,KAAK,CAACzC,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAAC,CAAC0B,QAAQ,CAAC;EAChD,CAAC,CAAC,CACDS,WAAW,CAAC;AACjB,CAAC,CAAC;AAACjC,OAAA,CAAAmB,mBAAA,GAAAA,mBAAA;AAKI,MAAMgB,8BAA8B,GAAGhB,mBAAmB;AAACnB,OAAA,CAAAmC,8BAAA,GAAAA,8BAAA"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCryptoContextFor = void 0;
7
+ var _ioReactNativeCrypto = require("@pagopa/io-react-native-crypto");
8
+ var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
9
+ var _jwk = require("./jwk");
10
+ /**
11
+ * Create a CryptoContext bound to a key pair.
12
+ * Key pair is supposed to exist already in the device's keychain.
13
+ * It's identified by its unique keytag.
14
+ *
15
+ * @returns the crypto context
16
+ */
17
+ const createCryptoContextFor = keytag => {
18
+ return {
19
+ /**
20
+ * Retrieve the public key of the pair.
21
+ * If the key pair doesn't exist yet, an error is raised
22
+ * @returns The public key.
23
+ */
24
+ async getPublicKey() {
25
+ return (0, _ioReactNativeCrypto.getPublicKey)(keytag).then(_jwk.fixBase64EncodingOnKey).then(async jwk => ({
26
+ ...jwk,
27
+ // Keys in the TEE are not stored with their KID, which is supposed to be assigned when they are included in JWK sets.
28
+ // (that is, KID is not a propoerty of the key itself, but it's property used to identify a key in a set).
29
+ // We assume the convention we use the thumbprint of the public key as KID, thus for easy development we decided to evaluate KID here
30
+ // However the values is an arbitrary string that might be anything
31
+ kid: await (0, _ioReactNativeJwt.thumbprint)(jwk)
32
+ }));
33
+ },
34
+ /**
35
+ * Get a signature for a provided value.
36
+ * If the key pair doesn't exist yet, an error is raised.
37
+ * @param value
38
+ * @returns The signature for the value
39
+ */
40
+ async getSignature(value) {
41
+ return (0, _ioReactNativeCrypto.sign)(value, keytag);
42
+ }
43
+ };
44
+ };
45
+ exports.createCryptoContextFor = createCryptoContextFor;
46
+ //# sourceMappingURL=crypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ioReactNativeCrypto","require","_ioReactNativeJwt","_jwk","createCryptoContextFor","keytag","getPublicKey","then","fixBase64EncodingOnKey","jwk","kid","thumbprint","getSignature","value","sign","exports"],"sourceRoot":"../../../src","sources":["utils/crypto.ts"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,sBAAsB,GAAIC,MAAc,IAAoB;EACvE,OAAO;IACL;AACJ;AACA;AACA;AACA;IACI,MAAMC,YAAYA,CAAA,EAAG;MACnB,OAAO,IAAAA,iCAAY,EAACD,MAAM,CAAC,CACxBE,IAAI,CAACC,2BAAsB,CAAC,CAC5BD,IAAI,CAAC,MAAOE,GAAG,KAAM;QACpB,GAAGA,GAAG;QACN;QACA;QACA;QACA;QACAC,GAAG,EAAE,MAAM,IAAAC,4BAAU,EAACF,GAAG;MAC3B,CAAC,CAAC,CAAC;IACP,CAAC;IACD;AACJ;AACA;AACA;AACA;AACA;IACI,MAAMG,YAAYA,CAACC,KAAa,EAAE;MAChC,OAAO,IAAAC,yBAAI,EAACD,KAAK,EAAER,MAAM,CAAC;IAC5B;EACF,CAAC;AACH,CAAC;AAACU,OAAA,CAAAX,sBAAA,GAAAA,sBAAA"}
@@ -3,20 +3,27 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getUnsignedDPop = exports.DPoPPayload = void 0;
6
+ exports.createDPopToken = exports.DPoPPayload = void 0;
7
7
  var z = _interopRequireWildcard(require("zod"));
8
8
  var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
9
9
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
10
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
- const getUnsignedDPop = (jwk, payload) => {
12
- const dPop = new _ioReactNativeJwt.SignJWT(payload).setProtectedHeader({
13
- alg: "ES256",
11
+ /**
12
+ * Create a signed DPoP token
13
+ *
14
+ * @param payload The payload to be included in the token.
15
+ * @param crypto The crypto context that handles the key bound to the DPoP.
16
+ *
17
+ * @returns The signed crypto token.
18
+ */
19
+ const createDPopToken = async (payload, crypto) => {
20
+ const jwk = await crypto.getPublicKey();
21
+ return new _ioReactNativeJwt.SignJWT(crypto).setPayload(payload).setProtectedHeader({
14
22
  typ: "dpop+jwt",
15
23
  jwk
16
- }).setIssuedAt().setExpirationTime("1h").toSign();
17
- return dPop;
24
+ }).setIssuedAt().setExpirationTime("1h").sign();
18
25
  };
19
- exports.getUnsignedDPop = getUnsignedDPop;
26
+ exports.createDPopToken = createDPopToken;
20
27
  const DPoPPayload = z.object({
21
28
  jti: z.string(),
22
29
  htm: z.union([z.literal("POST"), z.literal("GET")]),
@@ -1 +1 @@
1
- {"version":3,"names":["z","_interopRequireWildcard","require","_ioReactNativeJwt","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","getUnsignedDPop","jwk","payload","dPop","SignJWT","setProtectedHeader","alg","typ","setIssuedAt","setExpirationTime","toSign","exports","DPoPPayload","object","jti","string","htm","union","literal","htu","ath","optional"],"sourceRoot":"../../../src","sources":["utils/dpop.ts"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAAsD,SAAAE,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,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oB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AAM,CAAC,CAAC;EACfC,GAAG,EAAE1C,CAAC,CAAC2C,KAAK,CAAC,CAAC3C,CAAC,CAAC4C,OAAO,CAAC,MAAM,CAAC,EAAE5C,CAAC,CAAC4C,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;EACnDC,GAAG,EAAE7C,CAAC,CAACyC,MAAM,CAAC,CAAC;EACfK,GAAG,EAAE9C,CAAC,CAACyC,MAAM,CAAC,CAAC,CAACM,QAAQ,CAAC;AAC3B,CAAC,CAAC;AAACV,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["z","_interopRequireWildcard","require","_ioReactNativeJwt","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","createDPopToken","payload","crypto","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","exports","DPoPPayload","object","jti","string","htm","union","literal","htu","ath","optional"],"sourceRoot":"../../../src","sources":["utils/dpop.ts"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAA0E,SAAAE,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,SAAAJ,wBAAAQ,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,IAAA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,EAAE3C,CAAC,CAAC4C,KAAK,CAAC,CAAC5C,CAAC,CAAC6C,OAAO,CAAC,MAAM,CAAC,EAAE7C,CAAC,CAAC6C,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;EACnDC,GAAG,EAAE9C,CAAC,CAAC0C,MAAM,CAAC,CAAC;EACfK,GAAG,EAAE/C,CAAC,CAAC0C,MAAM,CAAC,CAAC,CAACM,QAAQ,CAAC;AAC3B,CAAC,CAAC;AAACV,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "Issuing", {
6
+ exports.decode = decode;
7
+ Object.defineProperty(exports, "getAttestation", {
7
8
  enumerable: true,
8
9
  get: function () {
9
- return _issuing.Issuing;
10
+ return _issuing.getAttestation;
10
11
  }
11
12
  });
12
- exports.decode = decode;
13
13
  exports.verify = verify;
14
14
  var _types = require("./types");
15
15
  var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
@@ -3,68 +3,58 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Issuing = void 0;
6
+ exports.getAttestation = void 0;
7
7
  var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
8
8
  var _jwk = require("../utils/jwk");
9
9
  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
- class Issuing {
14
- constructor(walletProviderBaseUrl) {
15
- let appFetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : fetch;
16
- this.walletProviderBaseUrl = walletProviderBaseUrl;
17
- this.appFetch = appFetch;
18
- }
19
-
20
- /**
21
- * Get the Wallet Instance Attestation Request to sign
22
- *
23
- * @async @function
24
- *
25
- * @param jwk Public key of the wallet instance
26
- *
27
- * @returns {string} Wallet Instance Attestation Request to sign
28
- *
29
- */
30
- async getAttestationRequestToSign(jwk) {
31
- const parsedJwk = _jwk.JWK.parse(jwk);
32
- const keyThumbprint = await (0, _ioReactNativeJwt.thumbprint)(parsedJwk);
33
- const publicKey = {
34
- ...parsedJwk,
35
- kid: keyThumbprint
36
- };
37
- const walletInstanceAttestationRequest = new _ioReactNativeJwt.SignJWT({
38
- iss: keyThumbprint,
39
- aud: this.walletProviderBaseUrl,
40
- jti: `${_reactNativeUuid.default.v4()}`,
41
- nonce: `${_reactNativeUuid.default.v4()}`,
42
- cnf: {
43
- jwk: (0, _jwk.fixBase64EncodingOnKey)(publicKey)
44
- }
45
- }).setProtectedHeader({
46
- alg: "ES256",
47
- kid: publicKey.kid,
48
- typ: "wiar+jwt"
49
- }).setIssuedAt().setExpirationTime("1h").toSign();
50
- return walletInstanceAttestationRequest;
51
- }
13
+ async function getAttestationRequest(wiaCryptoContext, walletProviderBaseUrl) {
14
+ const jwk = await wiaCryptoContext.getPublicKey();
15
+ const parsedJwk = _jwk.JWK.parse(jwk);
16
+ const keyThumbprint = await (0, _ioReactNativeJwt.thumbprint)(parsedJwk);
17
+ const publicKey = {
18
+ ...parsedJwk,
19
+ kid: keyThumbprint
20
+ };
21
+ return new _ioReactNativeJwt.SignJWT(wiaCryptoContext).setPayload({
22
+ iss: keyThumbprint,
23
+ aud: walletProviderBaseUrl,
24
+ jti: `${_reactNativeUuid.default.v4()}`,
25
+ nonce: `${_reactNativeUuid.default.v4()}`,
26
+ cnf: {
27
+ jwk: (0, _jwk.fixBase64EncodingOnKey)(publicKey)
28
+ }
29
+ }).setProtectedHeader({
30
+ kid: publicKey.kid,
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
+ }).setIssuedAt().setExpirationTime("1h").sign();
41
+ }
52
42
 
53
- /**
54
- * Get the Wallet Instance Attestation given a
55
- * Wallet Instance Attestation Request and signature
56
- *
57
- * @async @function
58
- *
59
- * @param attestationRequest Wallet Instance Attestaion Request
60
- * obtained with {@link getAttestationRequestToSign}
61
- * @param signature Signature of the Wallet Instance Attestaion Request
62
- *
63
- * @returns {string} Wallet Instance Attestation
64
- *
65
- */
66
- async getAttestation(attestationRequest, signature) {
67
- const signedAttestationRequest = await _ioReactNativeJwt.SignJWT.appendSignature(attestationRequest, signature);
43
+ /**
44
+ * Request a Wallet Instance Attestation (WIA) to the Wallet provider
45
+ *
46
+ * @param params.wiaCryptoContext The key pair associated with the WIA. Will be use to prove the ownership of the attestation.
47
+ * @param params.appFetch (optional) Http client
48
+ * @param walletProviderBaseUrl Base url for the Wallet Provider
49
+ * @returns The retrieved Wallet Instance Attestation token
50
+ */
51
+ const getAttestation = _ref => {
52
+ let {
53
+ wiaCryptoContext,
54
+ appFetch = fetch
55
+ } = _ref;
56
+ return async walletProviderBaseUrl => {
57
+ const signedAttestationRequest = await getAttestationRequest(wiaCryptoContext, walletProviderBaseUrl);
68
58
  const decodedRequest = (0, _ioReactNativeJwt.decode)(signedAttestationRequest);
69
59
  const parsedRequest = _types.WalletInstanceAttestationRequestJwt.parse({
70
60
  payload: decodedRequest.payload,
@@ -72,12 +62,12 @@ class Issuing {
72
62
  });
73
63
  const publicKey = parsedRequest.payload.cnf.jwk;
74
64
  await (0, _ioReactNativeJwt.verify)(signedAttestationRequest, publicKey);
75
- const tokenUrl = new URL("token", this.walletProviderBaseUrl).href;
65
+ const tokenUrl = new URL("token", walletProviderBaseUrl).href;
76
66
  const requestBody = {
77
67
  grant_type: "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation",
78
68
  assertion: signedAttestationRequest
79
69
  };
80
- const response = await this.appFetch(tokenUrl, {
70
+ const response = await appFetch(tokenUrl, {
81
71
  method: "POST",
82
72
  headers: {
83
73
  "Content-Type": "application/json"
@@ -88,7 +78,7 @@ class Issuing {
88
78
  return await response.text();
89
79
  }
90
80
  throw new _errors.WalletInstanceAttestationIssuingError("Unable to obtain wallet instance attestation from wallet provider", `Response code: ${response.status}`);
91
- }
92
- }
93
- exports.Issuing = Issuing;
81
+ };
82
+ };
83
+ exports.getAttestation = getAttestation;
94
84
  //# sourceMappingURL=issuing.js.map
@@ -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","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,QAAA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,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,oEAAoE;MACtEC,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","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;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;AAExE,eAAeG,qBAAqBA,CAClCC,gBAA+B,EAC/BC,qBAA6B,EACZ;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,MAAMK,SAAS,GAAG;IAAE,GAAGL,SAAS;IAAEM,GAAG,EAAEH;EAAc,CAAC;EAEtD,OAAO,IAAII,yBAAO,CAACX,gBAAgB,CAAC,CACjCY,UAAU,CAAC;IACVC,GAAG,EAAEN,aAAa;IAClBO,GAAG,EAAEb,qBAAqB;IAC1Bc,GAAG,EAAG,GAAEC,wBAAI,CAACC,EAAE,CAAC,CAAE,EAAC;IACnBC,KAAK,EAAG,GAAEF,wBAAI,CAACC,EAAE,CAAC,CAAE,EAAC;IACrBE,GAAG,EAAE;MACHjB,GAAG,EAAE,IAAAkB,2BAAsB,EAACX,SAAS;IACvC;EACF,CAAC,CAAC,CACDY,kBAAkB,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,GAAG,MAAMjB,QAAQ,CAACW,QAAQ,EAAE;MACxCO,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"}
@@ -5,10 +5,11 @@ import * as PID from "./pid";
5
5
  import * as RP from "./rp";
6
6
  import * as Errors from "./utils/errors";
7
7
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
8
- import { getUnsignedDPop } from "./utils/dpop";
9
- import { RelyingPartySolution } from "./rp";
8
+ import * as RelyingPartySolution from "./rp";
10
9
  import { RpEntityConfiguration } from "./rp/types";
11
10
  import { verifyTrustChain, getEntityConfiguration } from "./trust";
12
11
  import { EntityConfiguration, EntityStatement, TrustAnchorEntityConfiguration } from "./trust/types";
13
- export { PID, RP, WalletInstanceAttestation, Errors, getUnsignedDPop, RelyingPartySolution, verifyTrustChain, getEntityConfiguration, EntityConfiguration, EntityStatement, RpEntityConfiguration, TrustAnchorEntityConfiguration };
12
+ 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 };
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PID","RP","Errors","WalletInstanceAttestation","getUnsignedDPop","RelyingPartySolution","RpEntityConfiguration","verifyTrustChain","getEntityConfiguration","EntityConfiguration","EntityStatement","TrustAnchorEntityConfiguration"],"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,qBAAqB,QAAQ,YAAY;AAClD,SAASC,gBAAgB,EAAEC,sBAAsB,QAAQ,SAAS;AAClE,SACEC,mBAAmB,EACnBC,eAAe,EACfC,8BAA8B,QACzB,eAAe;AAEtB,SACEX,GAAG,EACHC,EAAE,EACFE,yBAAyB,EACzBD,MAAM,EACNE,eAAe,EACfC,oBAAoB,EACpBE,gBAAgB,EAChBC,sBAAsB,EACtBC,mBAAmB,EACnBC,eAAe,EACfJ,qBAAqB,EACrBK,8BAA8B"}
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,4 +1,4 @@
1
1
  import * as SdJwt from "./sd-jwt";
2
- import { Issuing } from "./issuing";
2
+ import * as Issuing from "./issuing";
3
3
  export { SdJwt, Issuing };
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SdJwt","Issuing"],"sourceRoot":"../../../src","sources":["pid/index.ts"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,UAAU;AACjC,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASD,KAAK,EAAEC,OAAO"}
1
+ {"version":3,"names":["SdJwt","Issuing"],"sourceRoot":"../../../src","sources":["pid/index.ts"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,UAAU;AACjC,OAAO,KAAKC,OAAO,MAAM,WAAW;AACpC,SAASD,KAAK,EAAEC,OAAO"}