@pagopa/io-react-native-wallet 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.WalletInstanceAttestationIssuingError = exports.ValidationFailed = exports.PidMetadataError = exports.PidIssuingError = exports.NoSuitableKeysFoundInEntityConfiguration = exports.IoWalletError = exports.ClaimsNotFoundInToken = exports.ClaimsNotFoundBetweenDislosures = exports.AuthRequestDecodeError = void 0;
|
7
|
+
/**
|
8
|
+
* utility to format a set of attributes into an error message string
|
9
|
+
*
|
10
|
+
* @example
|
11
|
+
* // returns "foo=value bar=(list, item)"
|
12
|
+
* serializeAttrs({ foo: "value", bar: ["list", "item"] })
|
13
|
+
*
|
14
|
+
* @param attrs A key value record set
|
15
|
+
* @returns a human-readable serialization of the set
|
16
|
+
*/
|
17
|
+
const serializeAttrs = attrs => Object.entries(attrs).map(_ref => {
|
18
|
+
let [k, v] = _ref;
|
19
|
+
return [k, Array.isArray(v) ? `(${v.join(", ")})` : v];
|
20
|
+
}).map(_ => _.join("=")).join(" ");
|
21
|
+
|
7
22
|
/**
|
8
23
|
* A generic Error that all other io-wallet specific Error subclasses extend.
|
9
24
|
*
|
@@ -49,7 +64,11 @@ class ValidationFailed extends IoWalletError {
|
|
49
64
|
constructor(message) {
|
50
65
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
51
66
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
52
|
-
super(
|
67
|
+
super(serializeAttrs({
|
68
|
+
message,
|
69
|
+
claim,
|
70
|
+
reason
|
71
|
+
}));
|
53
72
|
this.claim = claim;
|
54
73
|
this.reason = reason;
|
55
74
|
}
|
@@ -73,7 +92,11 @@ class WalletInstanceAttestationIssuingError extends IoWalletError {
|
|
73
92
|
constructor(message) {
|
74
93
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
75
94
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
76
|
-
super(
|
95
|
+
super(serializeAttrs({
|
96
|
+
message,
|
97
|
+
claim,
|
98
|
+
reason
|
99
|
+
}));
|
77
100
|
this.claim = claim;
|
78
101
|
this.reason = reason;
|
79
102
|
}
|
@@ -97,7 +120,11 @@ class AuthRequestDecodeError extends IoWalletError {
|
|
97
120
|
constructor(message) {
|
98
121
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
99
122
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
100
|
-
super(
|
123
|
+
super(serializeAttrs({
|
124
|
+
message,
|
125
|
+
claim,
|
126
|
+
reason
|
127
|
+
}));
|
101
128
|
this.claim = claim;
|
102
129
|
this.reason = reason;
|
103
130
|
}
|
@@ -121,7 +148,11 @@ class PidIssuingError extends IoWalletError {
|
|
121
148
|
constructor(message) {
|
122
149
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
123
150
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
124
|
-
super(
|
151
|
+
super(serializeAttrs({
|
152
|
+
message,
|
153
|
+
claim,
|
154
|
+
reason
|
155
|
+
}));
|
125
156
|
this.claim = claim;
|
126
157
|
this.reason = reason;
|
127
158
|
}
|
@@ -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","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","
|
1
|
+
{"version":3,"names":["serializeAttrs","attrs","Object","entries","map","_ref","k","v","Array","isArray","join","_","IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","exports","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","ClaimsNotFoundInToken","NoSuitableKeysFoundInEntityConfiguration","scenario","PidMetadataError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAsC,IAC5DC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,GAAG,CAACC,IAAA;EAAA,IAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAAF,IAAA;EAAA,OAAK,CAACC,CAAC,EAAEE,KAAK,CAACC,OAAO,CAACF,CAAC,CAAC,GAAI,IAAGA,CAAC,CAACG,IAAI,CAAC,IAAI,CAAE,GAAE,GAAGH,CAAC,CAAC;AAAA,EAAC,CAChEH,GAAG,CAAEO,CAAC,IAAKA,CAAC,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC,CACvBA,IAAI,CAAC,GAAG,CAAC;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,aAAa,SAASC,KAAK,CAAC;EACvC;EACA,WAAWC,IAAIA,CAAA,EAAW;IACxB,OAAO,uBAAuB;EAChC;;EAEA;EACAA,IAAI,GAAW,uBAAuB;EAEtCC,WAAWA,CAACC,OAAgB,EAAE;IAAA,IAAAC,qBAAA;IAC5B,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,IAAI,CAACH,WAAW,CAACG,IAAI;IACjC;IACA,CAAAD,qBAAA,GAAAJ,KAAK,CAACM,iBAAiB,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAP,KAAK,EAAqB,IAAI,EAAE,IAAI,CAACE,WAAW,CAAC;EACnD;AACF;AACA;AACA;AACA;AACA;AAHAM,OAAA,CAAAT,aAAA,GAAAA,aAAA;AAIO,MAAMU,gBAAgB,SAASV,aAAa,CAAC;EAClD,W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A;AACA;AAHAK,OAAA,CAAAc,wCAAA,GAAAA,wCAAA;AAIO,MAAME,gBAAgB,SAASxB,KAAK,CAAC;EAC1C,WAAWC,IAAIA,CAAA,EAAyB;IACtC,OAAO,oBAAoB;EAC7B;EAEAC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;EAChB;AACF;AAACK,OAAA,CAAAgB,gBAAA,GAAAA,gBAAA"}
|
@@ -1,3 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* utility to format a set of attributes into an error message string
|
3
|
+
*
|
4
|
+
* @example
|
5
|
+
* // returns "foo=value bar=(list, item)"
|
6
|
+
* serializeAttrs({ foo: "value", bar: ["list", "item"] })
|
7
|
+
*
|
8
|
+
* @param attrs A key value record set
|
9
|
+
* @returns a human-readable serialization of the set
|
10
|
+
*/
|
11
|
+
const serializeAttrs = attrs => Object.entries(attrs).map(_ref => {
|
12
|
+
let [k, v] = _ref;
|
13
|
+
return [k, Array.isArray(v) ? `(${v.join(", ")})` : v];
|
14
|
+
}).map(_ => _.join("=")).join(" ");
|
15
|
+
|
1
16
|
/**
|
2
17
|
* A generic Error that all other io-wallet specific Error subclasses extend.
|
3
18
|
*
|
@@ -42,7 +57,11 @@ export class ValidationFailed extends IoWalletError {
|
|
42
57
|
constructor(message) {
|
43
58
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
44
59
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
45
|
-
super(
|
60
|
+
super(serializeAttrs({
|
61
|
+
message,
|
62
|
+
claim,
|
63
|
+
reason
|
64
|
+
}));
|
46
65
|
this.claim = claim;
|
47
66
|
this.reason = reason;
|
48
67
|
}
|
@@ -65,7 +84,11 @@ export class WalletInstanceAttestationIssuingError extends IoWalletError {
|
|
65
84
|
constructor(message) {
|
66
85
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
67
86
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
68
|
-
super(
|
87
|
+
super(serializeAttrs({
|
88
|
+
message,
|
89
|
+
claim,
|
90
|
+
reason
|
91
|
+
}));
|
69
92
|
this.claim = claim;
|
70
93
|
this.reason = reason;
|
71
94
|
}
|
@@ -88,7 +111,11 @@ export class AuthRequestDecodeError extends IoWalletError {
|
|
88
111
|
constructor(message) {
|
89
112
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
90
113
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
91
|
-
super(
|
114
|
+
super(serializeAttrs({
|
115
|
+
message,
|
116
|
+
claim,
|
117
|
+
reason
|
118
|
+
}));
|
92
119
|
this.claim = claim;
|
93
120
|
this.reason = reason;
|
94
121
|
}
|
@@ -111,7 +138,11 @@ export class PidIssuingError extends IoWalletError {
|
|
111
138
|
constructor(message) {
|
112
139
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
113
140
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
114
|
-
super(
|
141
|
+
super(serializeAttrs({
|
142
|
+
message,
|
143
|
+
claim,
|
144
|
+
reason
|
145
|
+
}));
|
115
146
|
this.claim = claim;
|
116
147
|
this.reason = reason;
|
117
148
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","
|
1
|
+
{"version":3,"names":["serializeAttrs","attrs","Object","entries","map","_ref","k","v","Array","isArray","join","_","IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","ClaimsNotFoundInToken","NoSuitableKeysFoundInEntityConfiguration","scenario","PidMetadataError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAsC,IAC5DC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,GAAG,CAACC,IAAA;EAAA,IAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAAF,IAAA;EAAA,OAAK,CAACC,CAAC,EAAEE,KAAK,CAACC,OAAO,CAACF,CAAC,CAAC,GAAI,IAAGA,CAAC,CAACG,IAAI,CAAC,IAAI,CAAE,GAAE,GAAGH,CAAC,CAAC;AAAA,EAAC,CAChEH,GAAG,CAAEO,CAAC,IAAKA,CAAC,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC,CACvBA,IAAI,CAAC,GAAG,CAAC;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,aAAa,SAASC,KAAK,CAAC;EACvC;EACA,WAAWC,IAAIA,CAAA,EAAW;IACxB,OAAO,uBAAuB;EAChC;;EAEA;EACAA,IAAI,GAAW,uBAAuB;EAEtCC,WAAWA,CAACC,OAAgB,EAAE;IAAA,IAAAC,qBAAA;IAC5B,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,IAAI,CAACH,WAAW,CAACG,IAAI;IACjC;IACA,CAAAD,qBAAA,GAAAJ,KAAK,CAACM,iBAAiB,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAP,KAAK,EAAqB,IAAI,EAAE,IAAI,CAACE,WAAW,CAAC;EACnD;AACF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,gBAAgB,SAAST,aAAa,CAAC;EAClD,WAAWE,IAAIA,CAAA,EAAsC;IACnD,OAAO,iCAAiC;EAC1C;EAEAA,IAA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,MAAM,CAAC;IACnD,MAAMf,OAAO,GAAI,8EAA6EgB,CAAC,CAACtB,IAAI,CAClG,IACF,CAAE,EAAC;IACH,KAAK,CAACM,OAAO,CAAC;IACd,IAAI,CAACe,MAAM,GAAGC,CAAC;EACjB;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,SAASpB,KAAK,CAAC;EAC/C,WAAWC,IAAIA,CAAA,EAAoC;IACjD,OAAO,+BAA+B;EACxC;EAEAA,IAAI,GAAG,+BAA+B;;EAEtC;;EAGAC,WAAWA,CAACgB,MAAyB,EAAE;IACrC,MAAMC,CAAC,GAAGxB,KAAK,CAACC,OAAO,CAACsB,MAAM,CAAC,GAAGA,MAAM,GAAG,CAACA,MAAM,CAAC;IACnD,MAAMf,OAAO,GAAI,yDAAwDgB,CAAC,CAACtB,IAAI,CAC7E,IACF,CAAE,EAAC;IACH,KAAK,CAACM,OAAO,CAAC;IACd,IAAI,CAACe,MAAM,GAAGC,CAAC;EACjB;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAME,wCAAwC,SAASrB,KAAK,CAAC;EAClE,WAAWC,IAAIA,CAAA,EAAqC;IAClD,OAAO,gCAAgC;EACzC;EAEAA,IAAI,GAAG,gCAAgC;;EAEvC;AACF;AACA;EACEC,WAAWA,CAACoB,QAAgB,EAAE;IAC5B,MAAMnB,OAAO,GAAI,0DAAyDmB,QAAS,IAAG;IACtF,KAAK,CAACnB,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMoB,gBAAgB,SAASvB,KAAK,CAAC;EAC1C,WAAWC,IAAIA,CAAA,EAAyB;IACtC,OAAO,oBAAoB;EAC7B;EAEAC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;EAChB;AACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"
|
1
|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C;IAE1C,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IAEd,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;gBAGb,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,MAAsB,EAC7B,MAAM,GAAE,MAAsB;CAMjC;AAED;;;GAGG;AACH,qBAAa,+BAAgC,SAAQ,KAAK;IACxD,MAAM,KAAK,IAAI,IAAI,sBAAsB,CAExC;IAED,IAAI,SAA0B;IAE9B,2BAA2B;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;gBAEL,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;CAQtC;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,MAAM,KAAK,IAAI,IAAI,+BAA+B,CAEjD;IAED,IAAI,SAAmC;IAEvC,2BAA2B;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;gBAEL,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;CAQtC;AAED;;;GAGG;AACH,qBAAa,wCAAyC,SAAQ,KAAK;IACjE,MAAM,KAAK,IAAI,IAAI,gCAAgC,CAElD;IAED,IAAI,SAAoC;IAExC;;OAEG;gBACS,QAAQ,EAAE,MAAM;CAI7B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,MAAM,KAAK,IAAI,IAAI,oBAAoB,CAEtC;gBAEW,OAAO,EAAE,MAAM;CAG5B"}
|
package/package.json
CHANGED
package/src/utils/errors.ts
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* utility to format a set of attributes into an error message string
|
3
|
+
*
|
4
|
+
* @example
|
5
|
+
* // returns "foo=value bar=(list, item)"
|
6
|
+
* serializeAttrs({ foo: "value", bar: ["list", "item"] })
|
7
|
+
*
|
8
|
+
* @param attrs A key value record set
|
9
|
+
* @returns a human-readable serialization of the set
|
10
|
+
*/
|
11
|
+
const serializeAttrs = (attrs: Record<string, string | string>): string =>
|
12
|
+
Object.entries(attrs)
|
13
|
+
.map(([k, v]) => [k, Array.isArray(v) ? `(${v.join(", ")})` : v])
|
14
|
+
.map((_) => _.join("="))
|
15
|
+
.join(" ");
|
16
|
+
|
1
17
|
/**
|
2
18
|
* A generic Error that all other io-wallet specific Error subclasses extend.
|
3
19
|
*
|
@@ -42,8 +58,12 @@ export class ValidationFailed extends IoWalletError {
|
|
42
58
|
/** Reason code for the validation failure. */
|
43
59
|
reason: string;
|
44
60
|
|
45
|
-
constructor(
|
46
|
-
|
61
|
+
constructor(
|
62
|
+
message: string,
|
63
|
+
claim: string = "unspecified",
|
64
|
+
reason: string = "unspecified"
|
65
|
+
) {
|
66
|
+
super(serializeAttrs({ message, claim, reason }));
|
47
67
|
this.claim = claim;
|
48
68
|
this.reason = reason;
|
49
69
|
}
|
@@ -66,8 +86,12 @@ export class WalletInstanceAttestationIssuingError extends IoWalletError {
|
|
66
86
|
/** Reason code for the validation failure. */
|
67
87
|
reason: string;
|
68
88
|
|
69
|
-
constructor(
|
70
|
-
|
89
|
+
constructor(
|
90
|
+
message: string,
|
91
|
+
claim: string = "unspecified",
|
92
|
+
reason: string = "unspecified"
|
93
|
+
) {
|
94
|
+
super(serializeAttrs({ message, claim, reason }));
|
71
95
|
this.claim = claim;
|
72
96
|
this.reason = reason;
|
73
97
|
}
|
@@ -90,8 +114,12 @@ export class AuthRequestDecodeError extends IoWalletError {
|
|
90
114
|
/** Reason code for the validation failure. */
|
91
115
|
reason: string;
|
92
116
|
|
93
|
-
constructor(
|
94
|
-
|
117
|
+
constructor(
|
118
|
+
message: string,
|
119
|
+
claim: string = "unspecified",
|
120
|
+
reason: string = "unspecified"
|
121
|
+
) {
|
122
|
+
super(serializeAttrs({ message, claim, reason }));
|
95
123
|
this.claim = claim;
|
96
124
|
this.reason = reason;
|
97
125
|
}
|
@@ -114,8 +142,12 @@ export class PidIssuingError extends IoWalletError {
|
|
114
142
|
/** Reason code for the validation failure. */
|
115
143
|
reason: string;
|
116
144
|
|
117
|
-
constructor(
|
118
|
-
|
145
|
+
constructor(
|
146
|
+
message: string,
|
147
|
+
claim: string = "unspecified",
|
148
|
+
reason: string = "unspecified"
|
149
|
+
) {
|
150
|
+
super(serializeAttrs({ message, claim, reason }));
|
119
151
|
this.claim = claim;
|
120
152
|
this.reason = reason;
|
121
153
|
}
|