@pagopa/io-react-native-wallet 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +5 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +33 -21
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +192 -58
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js +45 -18
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +1 -1
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/entity/trust/chain.js.map +1 -1
- package/lib/commonjs/mdoc/index.js +45 -13
- package/lib/commonjs/mdoc/index.js.map +1 -1
- package/lib/commonjs/utils/crypto.js +70 -4
- package/lib/commonjs/utils/crypto.js.map +1 -1
- package/lib/commonjs/utils/string.js +4 -4
- package/lib/commonjs/utils/string.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +5 -1
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +33 -21
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +186 -55
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js +45 -18
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/types.js +1 -1
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/entity/trust/chain.js.map +1 -1
- package/lib/module/mdoc/index.js +43 -12
- package/lib/module/mdoc/index.js.map +1 -1
- package/lib/module/utils/crypto.js +67 -2
- package/lib/module/utils/crypto.js.map +1 -1
- package/lib/module/utils/string.js +4 -4
- package/lib/module/utils/string.js.map +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +1 -1
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +49 -13
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +6 -2
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +10 -7
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/entity/trust/chain.d.ts.map +1 -1
- package/lib/typescript/mdoc/index.d.ts +6 -2
- package/lib/typescript/mdoc/index.d.ts.map +1 -1
- package/lib/typescript/utils/crypto.d.ts +8 -0
- package/lib/typescript/utils/crypto.d.ts.map +1 -1
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/utils/string.d.ts +3 -3
- package/lib/typescript/utils/string.d.ts.map +1 -1
- package/package.json +14 -12
- package/src/credential/issuance/06-obtain-credential.ts +3 -1
- package/src/credential/issuance/07-verify-and-parse-credential.ts +37 -16
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +278 -97
- package/src/credential/presentation/08-send-authorization-response.ts +50 -27
- package/src/credential/presentation/types.ts +9 -6
- package/src/entity/trust/chain.ts +14 -10
- package/src/mdoc/index.ts +72 -15
- package/src/utils/crypto.ts +61 -2
- package/src/utils/errors.ts +2 -2
- package/src/utils/misc.ts +2 -2
- package/src/utils/string.ts +4 -4
@@ -22,6 +22,9 @@ export declare const AuthorizationResponse: z.ZodObject<{
|
|
22
22
|
* Selects a public key (with `use = enc`) from the set of JWK keys
|
23
23
|
* offered by the Relying Party (RP) for encryption.
|
24
24
|
*
|
25
|
+
* Preference is given to EC keys (P-256 or P-384), followed by RSA keys,
|
26
|
+
* based on compatibility and common usage for encryption.
|
27
|
+
*
|
25
28
|
* @param rpJwkKeys - The array of JWKs retrieved from the RP entity configuration.
|
26
29
|
* @returns The first suitable public key found in the list.
|
27
30
|
* @throws {NoSuitableKeysFoundInEntityConfiguration} If no suitable encryption key is found.
|
@@ -41,15 +44,16 @@ export declare const buildDirectPostBody: (requestObject: Out<VerifyRequestObjec
|
|
41
44
|
* @param jwkKeys - Array of JWKs from the Relying Party for encryption.
|
42
45
|
* @param requestObject - Contains state, nonce, and other relevant info.
|
43
46
|
* @param payload - Object that contains either the VP token to encrypt and the mapping of the credential disclosures or the error code
|
47
|
+
* @param generatedNonce - Optional nonce for the `apu` claim in the JWE header, it is used during ISO 18013-7.
|
44
48
|
* @returns A URL-encoded string for an `application/x-www-form-urlencoded` POST body,
|
45
49
|
* where `response` contains the encrypted JWE.
|
46
50
|
*/
|
47
|
-
export declare const buildDirectPostJwtBody: (jwkKeys: Out<FetchJwks>["keys"], requestObject: Out<VerifyRequestObjectSignature>["requestObject"], payload: DirectAuthorizationBodyPayload) => Promise<string>;
|
51
|
+
export declare const buildDirectPostJwtBody: (jwkKeys: Out<FetchJwks>["keys"], requestObject: Out<VerifyRequestObjectSignature>["requestObject"], payload: DirectAuthorizationBodyPayload, generatedNonce?: string) => Promise<string>;
|
48
52
|
/**
|
49
53
|
* Type definition for the function that sends the authorization response
|
50
54
|
* to the Relying Party, completing the presentation flow.
|
51
55
|
*/
|
52
|
-
export type SendAuthorizationResponse = (requestObject: Out<VerifyRequestObjectSignature>["requestObject"], presentationDefinitionId: string, jwkKeys: Out<FetchJwks>["keys"],
|
56
|
+
export type SendAuthorizationResponse = (requestObject: Out<VerifyRequestObjectSignature>["requestObject"], presentationDefinitionId: string, jwkKeys: Out<FetchJwks>["keys"], remotePresentation: RemotePresentation, context?: {
|
53
57
|
appFetch?: GlobalFetch["fetch"];
|
54
58
|
}) => Promise<AuthorizationResponse>;
|
55
59
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"08-send-authorization-response.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/08-send-authorization-response.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,8BAA8B,EAC9B,aAAa,EACb,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"08-send-authorization-response.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/08-send-authorization-response.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,8BAA8B,EAC9B,aAAa,EACb,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG3C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAUhC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,cACxB,IAAI,SAAS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the information needed to multiple remote presentation
|
13
13
|
*/
|
14
14
|
export type RemotePresentation = {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
presentations: {
|
16
|
+
requestedClaims: string[];
|
17
|
+
inputDescriptor: InputDescriptor;
|
18
|
+
format: string;
|
19
|
+
vpToken: string;
|
20
|
+
}[];
|
21
|
+
generatedNonce?: string;
|
19
22
|
};
|
20
23
|
export type InputDescriptor = z.infer<typeof InputDescriptor>;
|
21
24
|
export declare const InputDescriptor: z.ZodObject<{
|
@@ -334,7 +337,7 @@ export declare const RequestObject: z.ZodObject<{
|
|
334
337
|
iss: z.ZodOptional<z.ZodString>;
|
335
338
|
iat: z.ZodOptional<z.ZodNumber>;
|
336
339
|
exp: z.ZodOptional<z.ZodNumber>;
|
337
|
-
state: z.ZodString
|
340
|
+
state: z.ZodOptional<z.ZodString>;
|
338
341
|
nonce: z.ZodString;
|
339
342
|
response_uri: z.ZodString;
|
340
343
|
response_type: z.ZodLiteral<"vp_token">;
|
@@ -747,7 +750,6 @@ export declare const RequestObject: z.ZodObject<{
|
|
747
750
|
}[] | undefined;
|
748
751
|
}>>;
|
749
752
|
}, "strip", z.ZodTypeAny, {
|
750
|
-
state: string;
|
751
753
|
nonce: string;
|
752
754
|
response_type: "vp_token";
|
753
755
|
response_mode: "direct_post.jwt" | "direct_post";
|
@@ -756,6 +758,7 @@ export declare const RequestObject: z.ZodObject<{
|
|
756
758
|
iss?: string | undefined;
|
757
759
|
iat?: number | undefined;
|
758
760
|
exp?: number | undefined;
|
761
|
+
state?: string | undefined;
|
759
762
|
client_id_scheme?: string | undefined;
|
760
763
|
client_metadata?: {
|
761
764
|
authorization_encrypted_response_alg?: string | undefined;
|
@@ -827,7 +830,6 @@ export declare const RequestObject: z.ZodObject<{
|
|
827
830
|
}[] | undefined;
|
828
831
|
} | undefined;
|
829
832
|
}, {
|
830
|
-
state: string;
|
831
833
|
nonce: string;
|
832
834
|
response_type: "vp_token";
|
833
835
|
response_mode: "direct_post.jwt" | "direct_post";
|
@@ -836,6 +838,7 @@ export declare const RequestObject: z.ZodObject<{
|
|
836
838
|
iss?: string | undefined;
|
837
839
|
iat?: number | undefined;
|
838
840
|
exp?: number | undefined;
|
841
|
+
state?: string | undefined;
|
839
842
|
client_id_scheme?: string | undefined;
|
840
843
|
client_metadata?: {
|
841
844
|
authorization_encrypted_response_alg?: string | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACO,MAAM;IACzB,MAAM,EAAE;IACsC,aAAa;CACzE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe,EAAE,MAAM,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACO,MAAM;IACzB,MAAM,EAAE;IACsC,aAAa;CACzE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE;QACb,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,eAAe,EAAE,eAAe,CAAC;QACjC,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,cAAc,CAAC,EAAE,MAAM,CAAyD;CACjF,CAAC;AAmBF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBxB,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,eAAO,MAAM,aAAa,oFAKxB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,8BAA8B,CACtC,CAAC;AACF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;IAMzC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/entity/trust/chain.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAO,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAK5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC,CAAC;AAiCF;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,iBAAiB,EAAE,8BAA8B,EACjD,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,WAAW,EAAE,CAAC,CA+CxB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS,
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/entity/trust/chain.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAO,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAK5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC,CAAC;AAiCF;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,iBAAiB,EAAE,8BAA8B,EACjD,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,WAAW,EAAE,CAAC,CA+CxB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS,qBAiCvC"}
|
@@ -1,6 +1,10 @@
|
|
1
1
|
import { CBOR } from "@pagopa/io-react-native-cbor";
|
2
2
|
import type { JWK } from "../utils/jwk";
|
3
|
-
|
4
|
-
|
3
|
+
import { type Presentation } from "../credential/presentation/types";
|
4
|
+
export declare const verify: (token: string, _: JWK | JWK[]) => Promise<{
|
5
|
+
issuerSigned: CBOR.IssuerSigned;
|
6
|
+
}>;
|
7
|
+
export declare const prepareVpTokenMdoc: (requestNonce: string, generatedNonce: string, clientId: string, responseUri: string, docType: string, keyTag: string, [verifiableCredential, requestedClaims, _]: Presentation) => Promise<{
|
8
|
+
vp_token: string;
|
5
9
|
}>;
|
6
10
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mdoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mdoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAQxC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGrE,eAAO,MAAM,MAAM,UACV,MAAM,KACV,GAAG,GAAG,GAAG,EAAE;kBACW,KAAK,YAAY;EA0B3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,iBACf,MAAM,kBACJ,MAAM,YACZ,MAAM,eACH,MAAM,WACV,MAAM,UACP,MAAM;cAGJ,MAAM;EAgCjB,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type PublicKey } from "@pagopa/io-react-native-crypto";
|
1
2
|
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
2
3
|
import { RSAKey, KJUR } from "jsrsasign";
|
3
4
|
import { JWK } from "./jwk";
|
@@ -40,4 +41,11 @@ export declare const parsePublicKey: (pemCert: string) => RSAKey | KJUR.crypto.E
|
|
40
41
|
* @returns The signing JWK.
|
41
42
|
*/
|
42
43
|
export declare const getSigningJwk: (publicKey: RSAKey | KJUR.crypto.ECDSA) => JWK;
|
44
|
+
/**
|
45
|
+
* This function takes two {@link PublicKey} and evaluates and compares their thumbprints
|
46
|
+
* @param key1 The first key
|
47
|
+
* @param key2 The second key
|
48
|
+
* @returns true if the keys' thumbprints are equal, false otherwise
|
49
|
+
*/
|
50
|
+
export declare const compareKeysByThumbprint: (key1: PublicKey, key2: PublicKey) => Promise<boolean>;
|
43
51
|
//# sourceMappingURL=crypto.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAiB,MAAM,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAI5B;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,WAAY,MAAM,KAAG,aA6Bv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C/B,KAAK,CAAC;AAEZ,KAAK,SAAS,CAAC,CAAC,IAAI;IAClB,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/utils/misc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGpE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,WAClB,MAAM,gBAAgB,gCAAgC,WACnD,QAAQ,KAAG,QAAQ,QAAQ,CAUtC,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,oBAAoB,gDACrB,QAAQ,iCAIC,CAAC;AAItB,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,GAC7D,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,GACvB,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,
|
1
|
+
{"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/utils/misc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGpE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,WAClB,MAAM,gBAAgB,gCAAgC,WACnD,QAAQ,KAAG,QAAQ,QAAQ,CAUtC,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,oBAAoB,gDACrB,QAAQ,iCAIC,CAAC;AAItB,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,GAC7D,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,GACvB,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAChC,UAAU,CAAC,EAAE,CAAC,GACd,KAAK,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,SAAU,MAAM,WAGjD,CAAC;AAEb;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,eAChC,MAAM,KACjB,QAAQ,MAAM,CAMhB,CAAC;AAEF,eAAO,MAAM,aAAa,YAAa,MAAM,0CAM5C,CAAC"}
|
@@ -15,10 +15,10 @@
|
|
15
15
|
*/
|
16
16
|
export declare const obfuscateString: (value: string, percentage?: number, obfuscatedChar?: string) => string;
|
17
17
|
/**
|
18
|
-
* Converts a
|
18
|
+
* Converts a base64 string to a Base64 URL-encoded string.
|
19
19
|
*
|
20
|
-
* @param byteString - The input string in
|
20
|
+
* @param byteString - The input string in base64 format.
|
21
21
|
* @returns The Base64 URL-encoded string.
|
22
22
|
*/
|
23
|
-
export declare const base64ToBase64Url: (
|
23
|
+
export declare const base64ToBase64Url: (base64: string) => string;
|
24
24
|
//# sourceMappingURL=string.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,UACnB,MAAM,eACD,MAAM,mBACF,MAAM,KACrB,MAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,UACnB,MAAM,eACD,MAAM,mBACF,MAAM,KACrB,MAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,MAElD,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pagopa/io-react-native-wallet",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.6.1",
|
4
4
|
"description": "Provide data structures, helpers and API for IO Wallet",
|
5
5
|
"main": "lib/commonjs/index",
|
6
6
|
"module": "lib/module/index",
|
@@ -53,29 +53,29 @@
|
|
53
53
|
"registry": "https://registry.npmjs.org/"
|
54
54
|
},
|
55
55
|
"devDependencies": {
|
56
|
-
"@pagopa/eslint-config": "^3.0.0",
|
57
56
|
"@pagopa/io-react-native-crypto": "^0.2.3",
|
58
57
|
"@pagopa/io-react-native-jwt": "^2.1.0",
|
59
|
-
"@pagopa/io-react-native-cbor": "^1.
|
60
|
-
"@react-native/eslint-config": "^0.
|
58
|
+
"@pagopa/io-react-native-cbor": "^1.2.0",
|
59
|
+
"@react-native/eslint-config": "^0.75.5",
|
61
60
|
"@rushstack/eslint-patch": "^1.3.2",
|
62
61
|
"@types/jest": "^28.1.2",
|
63
|
-
"@types/react": "^18.
|
62
|
+
"@types/react": "^18.2.6",
|
64
63
|
"@types/react-native": "0.70.0",
|
64
|
+
"@types/url-parse": "^1.4.11",
|
65
65
|
"del-cli": "^5.0.0",
|
66
66
|
"eslint": "^8.4.1",
|
67
|
-
"eslint-
|
67
|
+
"eslint-plugin-prettier": "^5.2.3",
|
68
68
|
"jest": "^28.1.1",
|
69
69
|
"pod-install": "^0.1.0",
|
70
|
-
"prettier": "^
|
71
|
-
"react": "18.
|
72
|
-
"react-native": "0.
|
70
|
+
"prettier": "^3.5.3",
|
71
|
+
"react": "18.3.1",
|
72
|
+
"react-native": "0.75.5",
|
73
73
|
"react-native-builder-bob": "^0.20.0",
|
74
74
|
"typed-openapi": "^0.4.1",
|
75
|
-
"typescript": "
|
75
|
+
"typescript": "5.0.4"
|
76
76
|
},
|
77
77
|
"resolutions": {
|
78
|
-
"@types/react": "^18.
|
78
|
+
"@types/react": "^18.2.6"
|
79
79
|
},
|
80
80
|
"peerDependencies": {
|
81
81
|
"@pagopa/io-react-native-crypto": "*",
|
@@ -93,6 +93,9 @@
|
|
93
93
|
"modulePathIgnorePatterns": [
|
94
94
|
"<rootDir>/example/node_modules",
|
95
95
|
"<rootDir>/lib/"
|
96
|
+
],
|
97
|
+
"transformIgnorePatterns": [
|
98
|
+
"node_modules/(?!(jest-)?@react-native|react-native|uuid)"
|
96
99
|
]
|
97
100
|
},
|
98
101
|
"react-native-builder-bob": {
|
@@ -119,7 +122,6 @@
|
|
119
122
|
"parse-url": "^9.2.0",
|
120
123
|
"react-native-url-polyfill": "^2.0.0",
|
121
124
|
"react-native-uuid": "^2.0.1",
|
122
|
-
"yarn.lock": "^0.0.1-security",
|
123
125
|
"zod": "^3.21.4"
|
124
126
|
}
|
125
127
|
}
|
@@ -131,7 +131,9 @@ export const obtainCredential: ObtainCredential = async (
|
|
131
131
|
|
132
132
|
/** The credential request body */
|
133
133
|
const credentialRequestFormBody = {
|
134
|
-
|
134
|
+
...(format === "mso_mdoc"
|
135
|
+
? { doctype: credentialDefinition.credential_configuration_id }
|
136
|
+
: { vct: credentialDefinition.credential_configuration_id }),
|
135
137
|
format,
|
136
138
|
proof: {
|
137
139
|
jwt: signedNonceProof,
|
@@ -19,6 +19,7 @@ export type VerifyAndParseCredential = (
|
|
19
19
|
issuerConf: Out<GetIssuerConfig>["issuerConf"],
|
20
20
|
credential: Out<ObtainCredential>["credential"],
|
21
21
|
format: Out<ObtainCredential>["format"],
|
22
|
+
credentialType: string,
|
22
23
|
context: {
|
23
24
|
credentialCryptoContext: CryptoContext;
|
24
25
|
/**
|
@@ -60,7 +61,7 @@ type DecodedSdJwtCredential = Out<typeof verifySdJwt> & {
|
|
60
61
|
};
|
61
62
|
|
62
63
|
type DecodedMDocCredential = Out<typeof verifyMdoc> & {
|
63
|
-
|
64
|
+
issuerSigned: CBOR.IssuerSigned;
|
64
65
|
};
|
65
66
|
|
66
67
|
const parseCredentialSdJwt = (
|
@@ -157,10 +158,11 @@ const parseCredentialSdJwt = (
|
|
157
158
|
const parseCredentialMDoc = (
|
158
159
|
// the list of supported credentials, as defined in the issuer configuration
|
159
160
|
credentials_supported: Out<GetIssuerConfig>["issuerConf"]["credential_configurations_supported"],
|
160
|
-
|
161
|
+
credential_type: string,
|
162
|
+
{ issuerSigned }: DecodedMDocCredential,
|
161
163
|
includeUndefinedAttributes: boolean = false
|
162
164
|
): ParsedCredential => {
|
163
|
-
const credentialSubject = credentials_supported[
|
165
|
+
const credentialSubject = credentials_supported[credential_type];
|
164
166
|
|
165
167
|
if (!credentialSubject) {
|
166
168
|
throw new IoWalletError("Credential type not supported by the issuer");
|
@@ -184,24 +186,24 @@ const parseCredentialMDoc = (
|
|
184
186
|
[namespace, claimNameKey, definition] as [
|
185
187
|
string,
|
186
188
|
string,
|
187
|
-
CredentialClaim
|
189
|
+
CredentialClaim,
|
188
190
|
]
|
189
191
|
)
|
190
192
|
);
|
191
193
|
|
192
|
-
if (!
|
194
|
+
if (!issuerSigned.nameSpaces) {
|
193
195
|
throw new IoWalletError("Missing claims in the credential");
|
194
196
|
}
|
195
197
|
|
196
198
|
const flatNamespaces: [string, string, string][] = Object.entries(
|
197
|
-
|
199
|
+
issuerSigned.nameSpaces
|
198
200
|
).flatMap(([namespace, values]) =>
|
199
201
|
values.map(
|
200
202
|
(v) =>
|
201
203
|
[namespace, v.elementIdentifier, v.elementValue] as [
|
202
204
|
string,
|
203
205
|
string,
|
204
|
-
string
|
206
|
+
string,
|
205
207
|
]
|
206
208
|
)
|
207
209
|
);
|
@@ -314,24 +316,36 @@ async function verifyCredentialMDoc(
|
|
314
316
|
issuerKeys: JWK[],
|
315
317
|
holderBindingContext: CryptoContext
|
316
318
|
): Promise<DecodedMDocCredential> {
|
317
|
-
|
319
|
+
/**
|
320
|
+
* For the moment, being that issues in the crypto key generation
|
321
|
+
* have been found on Android, the check for the deviceKey inside
|
322
|
+
* of the mDoc is skipped, so we are not interested in the holderBindingKey
|
323
|
+
*/
|
324
|
+
const [decodedCredential, _] =
|
318
325
|
// parallel for optimization
|
319
326
|
await Promise.all([
|
320
327
|
verifyMdoc(rawCredential, issuerKeys),
|
321
328
|
holderBindingContext.getPublicKey(),
|
322
329
|
]);
|
323
330
|
|
324
|
-
// TODO Implement the holder binding verification for MDOC
|
325
|
-
|
326
|
-
// Get only the first decoded credential
|
327
|
-
|
328
331
|
if (!decodedCredential) {
|
329
332
|
throw new IoWalletError("No MDOC credentials found!");
|
330
333
|
}
|
331
334
|
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
+
/**
|
336
|
+
* For the moment, being that issues in the crypto key generation
|
337
|
+
* have been found on Android, the check for the deviceKey inside
|
338
|
+
* of the mDoc is skipped.
|
339
|
+
*/
|
340
|
+
//const key = decodedCredential.mDoc.issuerSigned.issuerAuth.payload.deviceKeyInfo.deviceKey;
|
341
|
+
//
|
342
|
+
//if (!compareKeysByThumbprint(key, holderBindingKey as PublicKey)) {
|
343
|
+
// throw new IoWalletError(
|
344
|
+
// `Failed to verify holder binding, holder binding key and mDoc deviceKey don't match`
|
345
|
+
// );
|
346
|
+
//}
|
347
|
+
|
348
|
+
return decodedCredential;
|
335
349
|
}
|
336
350
|
|
337
351
|
// utility type that specialize VerifyAndParseCredential for given format
|
@@ -339,13 +353,15 @@ type WithFormat<Format extends Parameters<VerifyAndParseCredential>[2]> = (
|
|
339
353
|
_0: Parameters<VerifyAndParseCredential>[0],
|
340
354
|
_1: Parameters<VerifyAndParseCredential>[1],
|
341
355
|
_2: Format,
|
342
|
-
_3: Parameters<VerifyAndParseCredential>[3]
|
356
|
+
_3: Parameters<VerifyAndParseCredential>[3],
|
357
|
+
_4: Parameters<VerifyAndParseCredential>[4]
|
343
358
|
) => ReturnType<VerifyAndParseCredential>;
|
344
359
|
|
345
360
|
const verifyAndParseCredentialSdJwt: WithFormat<"vc+sd-jwt"> = async (
|
346
361
|
issuerConf,
|
347
362
|
credential,
|
348
363
|
_,
|
364
|
+
__,
|
349
365
|
{
|
350
366
|
credentialCryptoContext,
|
351
367
|
ignoreMissingAttributes,
|
@@ -381,6 +397,7 @@ const verifyAndParseCredentialMDoc: WithFormat<"mso_mdoc"> = async (
|
|
381
397
|
issuerConf,
|
382
398
|
credential,
|
383
399
|
_,
|
400
|
+
credentialType,
|
384
401
|
{ credentialCryptoContext, ignoreMissingAttributes }
|
385
402
|
) => {
|
386
403
|
const decoded = await verifyCredentialMDoc(
|
@@ -391,6 +408,7 @@ const verifyAndParseCredentialMDoc: WithFormat<"mso_mdoc"> = async (
|
|
391
408
|
|
392
409
|
const parsedCredential = parseCredentialMDoc(
|
393
410
|
issuerConf.credential_configurations_supported,
|
411
|
+
credentialType,
|
394
412
|
decoded,
|
395
413
|
ignoreMissingAttributes
|
396
414
|
);
|
@@ -432,6 +450,7 @@ export const verifyAndParseCredential: VerifyAndParseCredential = async (
|
|
432
450
|
issuerConf,
|
433
451
|
credential,
|
434
452
|
format,
|
453
|
+
credentialType,
|
435
454
|
context
|
436
455
|
) => {
|
437
456
|
if (format === "vc+sd-jwt") {
|
@@ -439,6 +458,7 @@ export const verifyAndParseCredential: VerifyAndParseCredential = async (
|
|
439
458
|
issuerConf,
|
440
459
|
credential,
|
441
460
|
format,
|
461
|
+
credentialType,
|
442
462
|
context
|
443
463
|
);
|
444
464
|
}
|
@@ -447,6 +467,7 @@ export const verifyAndParseCredential: VerifyAndParseCredential = async (
|
|
447
467
|
issuerConf,
|
448
468
|
credential,
|
449
469
|
format,
|
470
|
+
credentialType,
|
450
471
|
context
|
451
472
|
);
|
452
473
|
}
|