@pagopa/io-react-native-wallet 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/lib/commonjs/index.js +0 -7
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/pid/index.js +7 -0
  4. package/lib/commonjs/pid/index.js.map +1 -1
  5. package/lib/commonjs/pid/issuing.js +231 -0
  6. package/lib/commonjs/pid/issuing.js.map +1 -0
  7. package/lib/commonjs/sd-jwt/index.js +4 -1
  8. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  9. package/lib/commonjs/sd-jwt/types.js +1 -1
  10. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  11. package/lib/commonjs/utils/dpop.js +1 -1
  12. package/lib/commonjs/utils/dpop.js.map +1 -1
  13. package/lib/commonjs/utils/errors.js +25 -1
  14. package/lib/commonjs/utils/errors.js.map +1 -1
  15. package/lib/module/index.js +1 -2
  16. package/lib/module/index.js.map +1 -1
  17. package/lib/module/pid/index.js +2 -1
  18. package/lib/module/pid/index.js.map +1 -1
  19. package/lib/module/pid/issuing.js +225 -0
  20. package/lib/module/pid/issuing.js.map +1 -0
  21. package/lib/module/sd-jwt/index.js +4 -1
  22. package/lib/module/sd-jwt/index.js.map +1 -1
  23. package/lib/module/sd-jwt/types.js +1 -1
  24. package/lib/module/sd-jwt/types.js.map +1 -1
  25. package/lib/module/utils/dpop.js +1 -1
  26. package/lib/module/utils/dpop.js.map +1 -1
  27. package/lib/module/utils/errors.js +23 -0
  28. package/lib/module/utils/errors.js.map +1 -1
  29. package/lib/typescript/index.d.ts +1 -2
  30. package/lib/typescript/index.d.ts.map +1 -1
  31. package/lib/typescript/pid/index.d.ts +2 -1
  32. package/lib/typescript/pid/index.d.ts.map +1 -1
  33. package/lib/typescript/pid/issuing.d.ts +93 -0
  34. package/lib/typescript/pid/issuing.d.ts.map +1 -0
  35. package/lib/typescript/rp/types.d.ts +8 -8
  36. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  37. package/lib/typescript/sd-jwt/types.d.ts +5 -5
  38. package/lib/typescript/utils/dpop.d.ts +5 -5
  39. package/lib/typescript/utils/errors.d.ts +13 -0
  40. package/lib/typescript/utils/errors.d.ts.map +1 -1
  41. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +1 -1
  42. package/package.json +4 -2
  43. package/src/index.ts +1 -9
  44. package/src/pid/index.ts +2 -1
  45. package/src/pid/issuing.ts +305 -0
  46. package/src/sd-jwt/index.ts +4 -1
  47. package/src/sd-jwt/types.ts +1 -1
  48. package/src/utils/dpop.ts +1 -1
  49. package/src/utils/errors.ts +24 -0
  50. package/src/wallet-instance-attestation/issuing.ts +1 -1
  51. package/lib/commonjs/utils/signature.js +0 -10
  52. package/lib/commonjs/utils/signature.js.map +0 -1
  53. package/lib/module/utils/signature.js +0 -3
  54. package/lib/module/utils/signature.js.map +0 -1
  55. package/lib/typescript/utils/signature.d.ts +0 -2
  56. package/lib/typescript/utils/signature.d.ts.map +0 -1
  57. package/src/utils/signature.ts +0 -4
@@ -4,12 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.WalletInstanceAttestation = exports.RP = exports.PID = exports.Errors = void 0;
7
- Object.defineProperty(exports, "getSignedJwt", {
8
- enumerable: true,
9
- get: function () {
10
- return _signature.getSignedJwt;
11
- }
12
- });
13
7
  Object.defineProperty(exports, "getUnsignedDPop", {
14
8
  enumerable: true,
15
9
  get: function () {
@@ -25,7 +19,6 @@ exports.Errors = Errors;
25
19
  var WalletInstanceAttestation = _interopRequireWildcard(require("./wallet-instance-attestation"));
26
20
  exports.WalletInstanceAttestation = WalletInstanceAttestation;
27
21
  var _dpop = require("./utils/dpop");
28
- var _signature = require("./utils/signature");
29
22
  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); }
30
23
  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; }
31
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PID","_interopRequireWildcard","require","exports","RP","Errors","WalletInstanceAttestation","_dpop","_signature","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA6BC,OAAA,CAAAH,GAAA,GAAAA,GAAA;AAC7B,IAAAI,EAAA,GAAAH,uBAAA,CAAAC,OAAA;AAA2BC,OAAA,CAAAC,EAAA,GAAAA,EAAA;AAC3B,IAAAC,MAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAAyCC,OAAA,CAAAE,MAAA,GAAAA,MAAA;AACzC,IAAAC,yBAAA,GAAAL,uBAAA,CAAAC,OAAA;AAA2EC,OAAA,CAAAG,yBAAA,GAAAA,yBAAA;AAC3E,IAAAC,KAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAAiD,SAAAO,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,SAAAT,wBAAAa,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,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
1
+ {"version":3,"names":["PID","_interopRequireWildcard","require","exports","RP","Errors","WalletInstanceAttestation","_dpop","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getO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E,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,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
@@ -3,9 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "Issuing", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _issuing.Issuing;
10
+ }
11
+ });
6
12
  exports.SdJwt = void 0;
7
13
  var SdJwt = _interopRequireWildcard(require("./sd-jwt"));
8
14
  exports.SdJwt = SdJwt;
15
+ var _issuing = require("./issuing");
9
16
  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
17
  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
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SdJwt","_interopRequireWildcard","require","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../src","sources":["pid/index.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAkCC,OAAA,CAAAH,KAAA,GAAAA,KAAA;AAAA,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,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,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,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
1
+ {"version":3,"names":["SdJwt","_interopRequireWildcard","require","exports","_issuing","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../src","sources":["pid/index.ts"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAkCC,OAAA,CAAAH,KAAA,GAAAA,KAAA;AAClC,IAAAI,QAAA,GAAAF,OAAA;AAAoC,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,SAAAL,wBAAAS,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,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Issuing = void 0;
7
+ var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
8
+ var _jwk = require("../utils/jwk");
9
+ var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
10
+ var _errors = require("../utils/errors");
11
+ var _dpop = require("../utils/dpop");
12
+ var _ioReactNativeCrypto = require("@pagopa/io-react-native-crypto");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ // This is a temporary type that will be used for demo purposes only
15
+
16
+ class Issuing {
17
+ constructor(pidProviderBaseUrl, walletProviderBaseUrl, walletInstanceAttestation, clientId) {
18
+ let appFetch = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : fetch;
19
+ this.pidProviderBaseUrl = pidProviderBaseUrl;
20
+ this.walletProviderBaseUrl = walletProviderBaseUrl;
21
+ this.state = `${_reactNativeUuid.default.v4()}`;
22
+ this.codeVerifier = `${_reactNativeUuid.default.v4()}`;
23
+ this.authorizationCode = `${_reactNativeUuid.default.v4()}`;
24
+ this.walletInstanceAttestation = walletInstanceAttestation;
25
+ this.clientId = clientId;
26
+ this.appFetch = appFetch;
27
+ }
28
+
29
+ /**
30
+ * Return the unsigned jwt to call the PAR request.
31
+ *
32
+ * @function
33
+ * @param jwk The wallet instance attestation public JWK
34
+ *
35
+ * @returns Unsigned jwt
36
+ *
37
+ */
38
+ async getUnsignedJwtForPar(jwk) {
39
+ const parsedJwk = _jwk.JWK.parse(jwk);
40
+ const keyThumbprint = await (0, _ioReactNativeJwt.thumbprint)(parsedJwk);
41
+ const publicKey = {
42
+ ...parsedJwk,
43
+ kid: keyThumbprint
44
+ };
45
+ const codeChallenge = await (0, _ioReactNativeJwt.sha256ToBase64)(this.codeVerifier);
46
+ const unsignedJwtForPar = new _ioReactNativeJwt.SignJWT({
47
+ client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
48
+ authorization_details: [{
49
+ credentialDefinition: {
50
+ type: ["eu.eudiw.pid.it"]
51
+ },
52
+ format: "vc+sd-jwt",
53
+ type: "type"
54
+ }],
55
+ response_type: "code",
56
+ code_challenge_method: "s256",
57
+ redirect_uri: this.walletProviderBaseUrl,
58
+ state: this.state,
59
+ client_id: this.clientId,
60
+ code_challenge: codeChallenge
61
+ }).setProtectedHeader({
62
+ alg: "ES256",
63
+ kid: publicKey.kid
64
+ }).setIssuedAt().setExpirationTime("1h").toSign();
65
+ return unsignedJwtForPar;
66
+ }
67
+
68
+ /**
69
+ * Make a PAR request to the PID issuer and return the response url
70
+ *
71
+ * @function
72
+ * @param unsignedJwtForPar The unsigned JWT for PAR
73
+ * @param signature The JWT for PAR signature
74
+ *
75
+ * @returns Unsigned PAR url
76
+ *
77
+ */
78
+ async getPar(unsignedJwtForPar, signature) {
79
+ const codeChallenge = await (0, _ioReactNativeJwt.sha256ToBase64)(this.codeVerifier);
80
+ const signedJwtForPar = await _ioReactNativeJwt.SignJWT.appendSignature(unsignedJwtForPar, signature);
81
+ const parUrl = new URL("/as/par", this.pidProviderBaseUrl).href;
82
+ const requestBody = {
83
+ response_type: "code",
84
+ client_id: this.clientId,
85
+ code_challenge: codeChallenge,
86
+ code_challenge_method: "S256",
87
+ client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
88
+ client_assertion: this.walletInstanceAttestation,
89
+ request: signedJwtForPar
90
+ };
91
+ var formBody = new URLSearchParams(requestBody);
92
+ const response = await this.appFetch(parUrl, {
93
+ method: "POST",
94
+ headers: {
95
+ "Content-Type": "application/x-www-form-urlencoded"
96
+ },
97
+ body: formBody.toString()
98
+ });
99
+ if (response.status === 201) {
100
+ const result = await response.json();
101
+ return result.request_uri;
102
+ }
103
+ throw new _errors.PidIssuingError(`Unable to obtain PAR. Response code: ${await response.text()}`);
104
+ }
105
+
106
+ /**
107
+ * Return the unsigned jwt for a generic DPoP
108
+ *
109
+ * @function
110
+ * @param jwk the public key for which the DPoP is to be created
111
+ *
112
+ * @returns Unsigned JWT for DPoP
113
+ *
114
+ */
115
+ async getUnsignedDPoP(jwk) {
116
+ const tokenUrl = new URL("/token", this.pidProviderBaseUrl).href;
117
+ const dPop = (0, _dpop.getUnsignedDPop)(jwk, {
118
+ htm: "POST",
119
+ htu: tokenUrl,
120
+ jti: `${_reactNativeUuid.default.v4()}`
121
+ });
122
+ return dPop;
123
+ }
124
+
125
+ /**
126
+ * Make an auth token request to the PID issuer
127
+ *
128
+ * @function
129
+ * @returns a token response
130
+ *
131
+ */
132
+ async getAuthToken() {
133
+ //Generate fresh keys for DPoP
134
+ const dPopKeyTag = `${_reactNativeUuid.default.v4()}`;
135
+ const dPopKey = await (0, _ioReactNativeCrypto.generate)(dPopKeyTag);
136
+ const unsignedDPopForToken = await this.getUnsignedDPoP(dPopKey);
137
+ const dPopTokenSignature = await (0, _ioReactNativeCrypto.sign)(unsignedDPopForToken, dPopKeyTag);
138
+ await (0, _ioReactNativeCrypto.deleteKey)(dPopKeyTag);
139
+ const signedDPop = await _ioReactNativeJwt.SignJWT.appendSignature(unsignedDPopForToken, dPopTokenSignature);
140
+ const decodedJwtDPop = (0, _ioReactNativeJwt.decode)(signedDPop);
141
+ const tokenUrl = decodedJwtDPop.payload.htu;
142
+ const requestBody = {
143
+ grant_type: "authorization code",
144
+ client_id: this.clientId,
145
+ code: this.authorizationCode,
146
+ code_verifier: this.codeVerifier,
147
+ client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
148
+ client_assertion: this.walletInstanceAttestation,
149
+ redirect_uri: this.walletProviderBaseUrl
150
+ };
151
+ var formBody = new URLSearchParams(requestBody);
152
+ const response = await this.appFetch(tokenUrl, {
153
+ method: "POST",
154
+ headers: {
155
+ "Content-Type": "application/x-www-form-urlencoded",
156
+ DPoP: signedDPop
157
+ },
158
+ body: formBody.toString()
159
+ });
160
+ if (response.status === 200) {
161
+ return await response.json();
162
+ }
163
+ throw new _errors.PidIssuingError(`Unable to obtain token. Response code: ${await response.text()}`);
164
+ }
165
+
166
+ /**
167
+ * Return the unsigned jwt for nonce proof of possession
168
+ *
169
+ * @function
170
+ * @param nonce the nonce
171
+ *
172
+ * @returns Unsigned JWT for nonce proof
173
+ *
174
+ */
175
+ async getUnsignedNonceProof(nonce) {
176
+ const unsignedProof = new _ioReactNativeJwt.SignJWT({
177
+ nonce
178
+ }).setProtectedHeader({
179
+ alg: "ES256",
180
+ type: "openid4vci-proof+jwt"
181
+ }).setAudience(this.walletProviderBaseUrl).setIssuer(this.clientId).setIssuedAt().setExpirationTime("1h").toSign();
182
+ return unsignedProof;
183
+ }
184
+
185
+ /**
186
+ * Make the credential issuing request to the PID issuer
187
+ *
188
+ * @function
189
+ * @param unsignedDPopForPid The unsigned JWT for PID DPoP
190
+ * @param dPopPidSignature The JWT for PID DPoP signature
191
+ * @param unsignedNonceProof The unsigned JWT for nonce proof
192
+ * @param nonceProofSignature The JWT for nonce proof signature
193
+ * @param accessToken The access token obtained with getAuthToken
194
+ * @param cieData Personal data read by the CIE
195
+ *
196
+ * @returns a credential
197
+ *
198
+ */
199
+ async getCredential(unsignedDPopForPid, dPopPidSignature, unsignedNonceProof, nonceProofSignature, accessToken, cieData) {
200
+ const signedDPopForPid = await _ioReactNativeJwt.SignJWT.appendSignature(unsignedDPopForPid, dPopPidSignature);
201
+ const signedNonceProof = await _ioReactNativeJwt.SignJWT.appendSignature(unsignedNonceProof, nonceProofSignature);
202
+ const credentialUrl = new URL("/credential", this.pidProviderBaseUrl).href;
203
+ const requestBody = {
204
+ credential_definition: JSON.stringify({
205
+ type: ["eu.eudiw.pid.it"]
206
+ }),
207
+ format: "vc+sd-jwt",
208
+ proof: JSON.stringify({
209
+ jwt: signedNonceProof,
210
+ cieData,
211
+ proof_type: "jwt"
212
+ })
213
+ };
214
+ const formBody = new URLSearchParams(requestBody);
215
+ const response = await this.appFetch(credentialUrl, {
216
+ method: "POST",
217
+ headers: {
218
+ "Content-Type": "application/x-www-form-urlencoded",
219
+ DPoP: signedDPopForPid,
220
+ Authorization: accessToken
221
+ },
222
+ body: formBody.toString()
223
+ });
224
+ if (response.status === 200) {
225
+ return await response.json();
226
+ }
227
+ throw new _errors.PidIssuingError(`Unable to obtain credential!`);
228
+ }
229
+ }
230
+ exports.Issuing = Issuing;
231
+ //# sourceMappingURL=issuing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_jwk","_reactNativeUuid","_interopRequireDefault","_errors","_dpop","_ioReactNativeCrypto","obj","__esModule","default","Issuing","constructor","pidProviderBaseUrl","walletProviderBaseUrl","walletInstanceAttestation","clientId","appFetch","arguments","length","undefined","fetch","state","uuid","v4","codeVerifier","authorizationCode","getUnsignedJwtForPar","jwk","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","codeChallenge","sha256ToBase64","unsignedJwtForPar","SignJWT","client_assertion_type","authorization_details","credentialDefinition","type","format","response_type","code_challenge_method","redirect_uri","client_id","code_challenge","setProtectedHeader","alg","setIssuedAt","setExpirationTime","toSign","getPar","signature","signedJwtForPar","appendSignature","parUrl","URL","href","requestBody","client_assertion","request","formBody","URLSearchParams","response","method","headers","body","toString","status","result","json","request_uri","PidIssuingError","text","getUnsignedDPoP","tokenUrl","dPop","getUnsignedDPop","htm","htu","jti","getAuthToken","dPopKeyTag","dPopKey","generate","unsignedDPopForToken","dPopTokenSignature","sign","deleteKey","signedDPop","decodedJwtDPop","decodeJwt","payload","grant_type","code","code_verifier","DPoP","getUnsignedNonceProof","nonce","unsignedProof","setAudience","setIssuer","getCredential","unsignedDPopForPid","dPopPidSignature","unsignedNonceProof","nonceProofSignature","accessToken","cieData","signedDPopForPid","signedNonceProof","credentialUrl","credential_definition","JSON","stringify","proof","jwt","proof_type","Authorization","exports"],"sourceRoot":"../../../src","sources":["pid/issuing.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAMA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AAA2E,SAAAG,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE3E;;AAgBO,MAAMG,OAAO,CAAC;EAUnBC,WAAWA,CACTC,kBAA0B,EAC1BC,qBAA6B,EAC7BC,yBAAiC,EACjCC,QAAgB,EAEhB;IAAA,IADAC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;IAEtC,IAAI,CAACR,kBAAkB,GAAGA,kBAAkB;IAC5C,IAAI,CAACC,qBAAqB,GAAGA,qBAAqB;IAClD,IAAI,CAACQ,KAAK,GAAI,GAAEC,wBAAI,CAACC,EAAE,CAAC,CAAE,EAAC;IAC3B,IAAI,CAACC,YAAY,GAAI,GAAEF,wBAAI,CAACC,EAAE,CAAC,CAAE,EAAC;IAClC,IAAI,CAACE,iBAAiB,GAAI,GAAEH,wBAAI,CAACC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MAAM3E,yBAAO,CAACmB,eAAe,CACpDmD,kBAAkB,EAClBC,mBACF,CAAC;IACD,MAAMK,aAAa,GAAG,IAAIvD,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC/C,kBAAkB,CAAC,CAACgD,IAAI;IAE1E,MAAMC,WAAW,GAAG;MAClBsD,qBAAqB,EAAEC,IAAI,CAACC,SAAS,CAAC;QAAE3E,IAAI,EAAE,CAAC,iBAAiB;MAAE,CAAC,CAAC;MACpEC,MAAM,EAAE,WAAW;MACnB2E,KAAK,EAAEF,IAAI,CAACC,SAAS,CAAC;QACpBE,GAAG,EAAEN,gBAAgB;QACrBF,OAAO;QACPS,UAAU,EAAE;MACd,CAAC;IACH,CAAC;IACD,MAAMxD,QAAQ,GAAG,IAAIC,eAAe,CAACJ,WAAW,CAAC;IAEjD,MAAMK,QAAQ,GAAG,MAAM,IAAI,CAAClD,QAAQ,CAACkG,aAAa,EAAE;MAClD/C,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE,mCAAmC;QACnD+B,IAAI,EAAEa,gBAAgB;QACtBS,aAAa,EAAEX;MACjB,CAAC;MACDzC,IAAI,EAAEL,QAAQ,CAACM,QAAQ,CAAC;IAC1B,CAAC,CAAC;IAEF,IAAIJ,QAAQ,CAACK,MAAM,KAAK,GAAG,EAAE;MAC3B,OAAO,MAAML,QAAQ,CAACO,IAAI,CAAC,CAAC;IAC9B;IAEA,MAAM,IAAIE,uBAAe,CAAE,8BAA6B,CAAC;EAC3D;AACF;AAAC+C,OAAA,CAAAhH,OAAA,GAAAA,OAAA"}
@@ -22,7 +22,10 @@ var _verifier = require("./verifier");
22
22
  *
23
23
  */
24
24
  const decode = (token, schema) => {
25
- // token are expected in the form "sd-jwt~disclosure0~disclosure1~...~disclosureN"
25
+ // token are expected in the form "sd-jwt~disclosure0~disclosure1~...~disclosureN~"
26
+ if (token.slice(-1) === "~") {
27
+ token = token.slice(0, -1);
28
+ }
26
29
  const [rawSdJwt = "", ...rawDisclosures] = token.split("~");
27
30
 
28
31
  // get the sd-jwt as object
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_types","_verifier","decode","token","schema","rawSdJwt","rawDisclosures","split","decodedJwt","decodeJwt","sdJwt","parse","header","protectedHeader","payload","disclosures","map","decodeBase64","e","JSON","Disclosure","exports","verify","publicKey","decoded","verifyJwt","claims","verified_claims","verification","_sd","Promise","all","disclosure","verifyDisclosure"],"sourceRoot":"../../../src","sources":["sd-jwt/index.ts"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,MAAM,GAAGA,CACpBC,KAAa,EACbC,MAAS,KAC4C;EACrD;EACA,MAAM,CAACC,QAAQ,GAAG,EAAE,EAAE,GAAGC,cAAc,CAAC,GAAGH,KAAK,CAACI,KAAK,CAAC,GAAG,CAAC;;EAE3D;EACA;EACA,MAAMC,UAAU,GAAG,IAAAC,wBAAS,EAACJ,QAAQ,CAAC;EACtC,MAAMK,KAAK,GAAGN,MAAM,CAACO,KAAK,CAAC;IACzBC,MAAM,EAAEJ,UAAU,CAACK,eAAe;IAClCC,OAAO,EAAEN,UAAU,CAACM;EACtB,CAAC,CAAC;;EAEF;EACA;EACA;EACA,MAAMC,WAAW,GAAGT,cAAc,CAC/BU,GAAG,CAACC,8BAAY,CAAC,CACjBD,GAAG,CAAEE,CAAC,IAAKC,IAAI,CAACR,KAAK,CAACO,CAAC,CAAC,CAAC,CACzBF,GAAG,CAAEE,CAAC,IAAKE,iBAAU,CAACT,KAAK,CAACO,CAAC,CAAC,CAAC;EAElC,OAAO;IAAER,KAAK;IAAEK;EAAY,CAAC;AAC/B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfAM,OAAA,CAAAnB,MAAA,GAAAA,MAAA;AAgBO,MAAMoB,MAAM,GAAG,MAAAA,CACpBnB,KAAa,EACboB,SAAc,EACdnB,MAAS,KACqD;EAC9D;EACA,MAAM,CAACC,QAAQ,GAAG,EAAE,CAAC,GAAGF,KAAK,CAACI,KAAK,CAAC,GAAG,CAAC;EACxC,MAAMiB,OAAO,GAAGtB,MAAM,CAACC,KAAK,EAAEC,MAAM,CAAC;;EAErC;EACA,MAAM,IAAAqB,wBAAS,EAACpB,QAAQ,EAAEkB,SAAS,CAAC;;EAEpC;EACA,MAAMG,MAAM,GAAG,CACb,GAAGF,OAAO,CAACd,KAAK,CAACI,OAAO,CAACa,eAAe,CAACC,YAAY,CAACC,GAAG,EACzD,GAAGL,OAAO,CAACd,KAAK,CAACI,OAAO,CAACa,eAAe,CAACD,MAAM,CAACG,GAAG,CACpD;EAED,MAAMC,OAAO,CAACC,GAAG,CACfP,OAAO,CAACT,WAAW,CAACC,GAAG,CACrB,MAAOgB,UAAU,IAAK,MAAM,IAAAC,0BAAgB,EAACD,UAAU,EAAEN,MAAM,CACjE,CACF,CAAC;EAED,OAAOF,OAAO;AAChB,CAAC;AAACH,OAAA,CAAAC,MAAA,GAAAA,MAAA"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_types","_verifier","decode","token","schema","slice","rawSdJwt","rawDisclosures","split","decodedJwt","decodeJwt","sdJwt","parse","header","protectedHeader","payload","disclosures","map","decodeBase64","e","JSON","Disclosure","exports","verify","publicKey","decoded","verifyJwt","claims","verified_claims","verification","_sd","Promise","all","disclosure","verifyDisclosure"],"sourceRoot":"../../../src","sources":["sd-jwt/index.ts"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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,EAAEkB,SAAS,CAAC;;EAEpC;EACA,MAAMG,MAAM,GAAG,CACb,GAAGF,OAAO,CAACd,KAAK,CAACI,OAAO,CAACa,eAAe,CAACC,YAAY,CAACC,GAAG,EACzD,GAAGL,OAAO,CAACd,KAAK,CAACI,OAAO,CAACa,eAAe,CAACD,MAAM,CAACG,GAAG,CACpD;EAED,MAAMC,OAAO,CAACC,GAAG,CACfP,OAAO,CAACT,WAAW,CAACC,GAAG,CACrB,MAAOgB,UAAU,IAAK,MAAM,IAAAC,0BAAgB,EAACD,UAAU,EAAEN,MAAM,CACjE,CACF,CAAC;EAED,OAAOF,OAAO;AAChB,CAAC;AAACH,OAAA,CAAAC,MAAA,GAAAA,MAAA"}
@@ -25,7 +25,7 @@ const SdJwt4VC = _zod.z.object({
25
25
  header: _zod.z.object({
26
26
  typ: _zod.z.literal("vc+sd-jwt"),
27
27
  alg: _zod.z.string(),
28
- kid: _zod.z.string(),
28
+ kid: _zod.z.string().optional(),
29
29
  trust_chain: _zod.z.array(_zod.z.string())
30
30
  }),
31
31
  payload: _zod.z.object({
@@ -1 +1 @@
1
- {"version":3,"names":["_jwk","require","_zod","UnixTime","z","number","min","max","exports","ObfuscatedDisclosures","object","_sd","array","string","Disclosure","tuple","unknown","SdJwt4VC","header","typ","literal","alg","kid","trust_chain","payload","iss","sub","jti","iat","exp","status","cnf","jwk","JWK","type","verified_claims","verification","intersection","trust_framework","assurance_level","claims","_sd_alg"],"sourceRoot":"../../../src","sources":["sd-jwt/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,MAAME,QAAQ,GAAGC,MAAC,CAACC,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,aAAa,CAAC;AAACC,OAAA,CAAAL,QAAA,GAAAA,QAAA;AAItD,MAAMM,qBAAqB,GAAGL,MAAC,CAACM,MAAM,CAAC;EAAEC,GAAG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AM,CAAC;MACxB0B,YAAY,EAAEhC,MAAC,CAACiC,YAAY,CAC1BjC,MAAC,CAACM,MAAM,CAAC;QACP4B,eAAe,EAAElC,MAAC,CAACgB,OAAO,CAAC,OAAO,CAAC;QACnCmB,eAAe,EAAEnC,MAAC,CAACS,MAAM,CAAC;MAC5B,CAAC,CAAC,EACFJ,qBACF,CAAC;MACD+B,MAAM,EAAE/B;IACV,CAAC,CAAC;IACFgC,OAAO,EAAErC,MAAC,CAACgB,OAAO,CAAC,SAAS;EAC9B,CAAC;AACH,CAAC,CAAC;AAACZ,OAAA,CAAAS,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"names":["_jwk","require","_zod","UnixTime","z","number","min","max","exports","ObfuscatedDisclosures","object","_sd","array","string","Disclosure","tuple","unknown","SdJwt4VC","header","typ","literal","alg","kid","optional","trust_chain","payload","iss","sub","jti","iat","exp","status","cnf","jwk","JWK","type","verified_claims","verification","intersection","trust_framework","assurance_level","claims","_sd_alg"],"sourceRoot":"../../../src","sources":["sd-jwt/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,MAAME,QAAQ,GAAGC,MAAC,CAACC,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,aAAa,CAAC;AAACC,OAAA,CAAAL,QAAA,GAAAA,QAAA;AAItD,MAAMM,qBAAqB,GAAGL,MAAC,CAACM,MAAM,CAAC;EAAEC,GAAG,EAAEP,MAAC,CAACQ,KAAK,CAACR,MAAC,CAACS,MAAM,CAAC,CAAC;AAAE,CAAC,CAAC;;AAE3E;AACA;AACA;AACA;AACA;AACA;AALAL,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAOO,MAAMK,UAAU,GAAGV,MAAC,CAACW,KAAK,CAAC,CAChC,UAAWX,MAAC,CAACS,MAAM,CAAC,CAAC,EACrB,gBAAiBT,MAAC,CAACS,MAAM,CAAC,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C,CAAC;IACFiC,OAAO,EAAEtC,MAAC,CAACgB,OAAO,CAAC,SAAS;EAC9B,CAAC;AACH,CAAC,CAAC;AAACZ,OAAA,CAAAS,QAAA,GAAAA,QAAA"}
@@ -21,7 +21,7 @@ const DPoPPayload = z.object({
21
21
  jti: z.string(),
22
22
  htm: z.union([z.literal("POST"), z.literal("GET")]),
23
23
  htu: z.string(),
24
- ath: z.string()
24
+ ath: z.string().optional()
25
25
  });
26
26
  exports.DPoPPayload = DPoPPayload;
27
27
  //# sourceMappingURL=dpop.js.map
@@ -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"],"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,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,C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C,CAAC4C,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;EACnDC,GAAG,EAAE7C,CAAC,CAACyC,MAAM,CAAC,CAAC;EACfK,GAAG,EAAE9C,CAAC,CAACyC,MAAM,CAAC;AAChB,CAAC,CAAC;AAACJ,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","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,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,wBA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,CAAC,CAACM,QAAQ,CAAC;AAC3B,CAAC,CAAC;AAACV,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WalletInstanceAttestationIssuingError = exports.ValidationFailed = exports.IoWalletError = exports.AuthRequestDecodeError = void 0;
6
+ exports.WalletInstanceAttestationIssuingError = exports.ValidationFailed = exports.PidIssuingError = exports.IoWalletError = exports.AuthRequestDecodeError = void 0;
7
7
  /**
8
8
  * A generic Error that all other io-wallet specific Error subclasses extend.
9
9
  *
@@ -102,5 +102,29 @@ class AuthRequestDecodeError extends IoWalletError {
102
102
  this.reason = reason;
103
103
  }
104
104
  }
105
+
106
+ /**
107
+ * An error subclass thrown when validation fail
108
+ *
109
+ */
105
110
  exports.AuthRequestDecodeError = AuthRequestDecodeError;
111
+ class PidIssuingError extends IoWalletError {
112
+ static get code() {
113
+ return "ERR_IO_WALLET_PID_ISSUING_FAILED";
114
+ }
115
+ code = "ERR_IO_WALLET_PID_ISSUING_FAILED";
116
+
117
+ /** The Claim for which the validation failed. */
118
+
119
+ /** Reason code for the validation failure. */
120
+
121
+ constructor(message) {
122
+ let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
123
+ let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
124
+ super(message);
125
+ this.claim = claim;
126
+ this.reason = reason;
127
+ }
128
+ }
129
+ exports.PidIssuingError = PidIssuingError;
106
130
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","exports","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA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IAA/CO,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAAA,IAAEG,MAAM,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IACxE,KAAK,CAACR,OAAO,CAAC;IACd,IAAI,CAACO,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AACA;AAHAN,OAAA,CAAAO,qCAAA,GAAAA,qCAAA;AAIO,MAAMC,sBAAsB,SAASjB,aAAa,CAAC;EACxD,WAAWE,IAAIA,CAAA,EAAyD;IACtE,OAAO,oDAAoD;EAC7D;EAEAA,IAAI,GAAG,oDAAoD;;EAE3D;;EAGA;;EAGAC,WAAWA,CAACC,OAAe,EAAiD;IAAA,IAA/CO,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAAA,IAAEG,MAAM,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IACxE,KAAK,CAACR,OAAO,CAAC;IACd,IAAI,CAACO,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF;AAACN,OAAA,CAAAQ,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","exports","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,SAASC,KAAK,CAAC;EACvC;EACA,WAAWC,IAAIA,CAAA,EAAW;IACxB,OAA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KAAK,CAACR,OAAO,CAAC;IACd,IAAI,CAACO,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF;AAACN,OAAA,CAAAS,eAAA,GAAAA,eAAA"}
@@ -3,6 +3,5 @@ import * as RP from "./rp";
3
3
  import * as Errors from "./utils/errors";
4
4
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
5
5
  import { getUnsignedDPop } from "./utils/dpop";
6
- import { getSignedJwt } from "./utils/signature";
7
- export { PID, RP, WalletInstanceAttestation, Errors, getUnsignedDPop, getSignedJwt };
6
+ export { PID, RP, WalletInstanceAttestation, Errors, getUnsignedDPop };
8
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PID","RP","Errors","WalletInstanceAttestation","getUnsignedDPop","getSignedJwt"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,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,YAAY,QAAQ,mBAAmB;AAEhD,SACEL,GAAG,EACHC,EAAE,EACFE,yBAAyB,EACzBD,MAAM,EACNE,eAAe,EACfC,YAAY"}
1
+ {"version":3,"names":["PID","RP","Errors","WalletInstanceAttestation","getUnsignedDPop"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,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;AAE9C,SAASJ,GAAG,EAAEC,EAAE,EAAEE,yBAAyB,EAAED,MAAM,EAAEE,eAAe"}
@@ -1,3 +1,4 @@
1
1
  import * as SdJwt from "./sd-jwt";
2
- export { SdJwt };
2
+ import { Issuing } from "./issuing";
3
+ export { SdJwt, Issuing };
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SdJwt"],"sourceRoot":"../../../src","sources":["pid/index.ts"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,UAAU;AACjC,SAASA,KAAK"}
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"}