@pagopa/io-react-native-wallet 0.4.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +128 -19
- package/lib/commonjs/index.js +16 -23
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/pid/index.js +3 -8
- package/lib/commonjs/pid/index.js.map +1 -1
- package/lib/commonjs/pid/issuing.js +153 -176
- package/lib/commonjs/pid/issuing.js.map +1 -1
- package/lib/commonjs/rp/__test__/index.test.js +7 -5
- package/lib/commonjs/rp/__test__/index.test.js.map +1 -1
- package/lib/commonjs/rp/index.js +145 -155
- package/lib/commonjs/rp/index.js.map +1 -1
- package/lib/commonjs/rp/types.js +1 -21
- package/lib/commonjs/rp/types.js.map +1 -1
- package/lib/commonjs/trust/index.js +24 -5
- package/lib/commonjs/trust/index.js.map +1 -1
- package/lib/commonjs/trust/types.js +102 -9
- package/lib/commonjs/trust/types.js.map +1 -1
- package/lib/commonjs/utils/crypto.js +46 -0
- package/lib/commonjs/utils/crypto.js.map +1 -0
- package/lib/commonjs/utils/dpop.js +14 -7
- package/lib/commonjs/utils/dpop.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/index.js +3 -3
- package/lib/commonjs/wallet-instance-attestation/issuing.js +42 -60
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/index.js +4 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/pid/index.js +1 -1
- package/lib/module/pid/index.js.map +1 -1
- package/lib/module/pid/issuing.js +152 -180
- package/lib/module/pid/issuing.js.map +1 -1
- package/lib/module/rp/__test__/index.test.js +3 -3
- package/lib/module/rp/__test__/index.test.js.map +1 -1
- package/lib/module/rp/index.js +141 -154
- package/lib/module/rp/index.js.map +1 -1
- package/lib/module/rp/types.js +0 -20
- package/lib/module/rp/types.js.map +1 -1
- package/lib/module/trust/index.js +19 -5
- package/lib/module/trust/index.js.map +1 -1
- package/lib/module/trust/types.js +100 -7
- package/lib/module/trust/types.js.map +1 -1
- package/lib/module/utils/crypto.js +40 -0
- package/lib/module/utils/crypto.js.map +1 -0
- package/lib/module/utils/dpop.js +13 -5
- package/lib/module/utils/dpop.js.map +1 -1
- package/lib/module/wallet-instance-attestation/index.js +2 -2
- package/lib/module/wallet-instance-attestation/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/issuing.js +40 -58
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/typescript/index.d.ts +4 -6
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/pid/index.d.ts +1 -1
- package/lib/typescript/pid/index.d.ts.map +1 -1
- package/lib/typescript/pid/issuing.d.ts +43 -88
- package/lib/typescript/pid/issuing.d.ts.map +1 -1
- package/lib/typescript/rp/index.d.ts +41 -87
- package/lib/typescript/rp/index.d.ts.map +1 -1
- package/lib/typescript/rp/types.d.ts +10 -906
- package/lib/typescript/rp/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +1 -1
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/trust/index.d.ts +806 -3
- package/lib/typescript/trust/index.d.ts.map +1 -1
- package/lib/typescript/trust/types.d.ts +9655 -297
- package/lib/typescript/trust/types.d.ts.map +1 -1
- package/lib/typescript/utils/crypto.d.ts +10 -0
- package/lib/typescript/utils/crypto.d.ts.map +1 -0
- package/lib/typescript/utils/dpop.d.ts +10 -2
- package/lib/typescript/utils/dpop.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/index.d.ts +2 -2
- package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts +18 -31
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +4 -4
- package/package.json +2 -2
- package/src/index.ts +14 -13
- package/src/pid/index.ts +1 -1
- package/src/pid/issuing.ts +233 -232
- package/src/rp/__test__/index.test.ts +3 -3
- package/src/rp/index.ts +172 -194
- package/src/rp/types.ts +0 -24
- package/src/sd-jwt/index.ts +1 -1
- package/src/trust/index.ts +106 -5
- package/src/trust/types.ts +152 -34
- package/src/utils/crypto.ts +41 -0
- package/src/utils/dpop.ts +17 -7
- package/src/wallet-instance-attestation/index.ts +2 -2
- package/src/wallet-instance-attestation/issuing.ts +51 -63
- package/lib/commonjs/pid/metadata.js +0 -49
- package/lib/commonjs/pid/metadata.js.map +0 -1
- package/lib/module/pid/metadata.js +0 -41
- package/lib/module/pid/metadata.js.map +0 -1
- package/lib/typescript/pid/metadata.d.ts +0 -482
- package/lib/typescript/pid/metadata.d.ts.map +0 -1
- package/src/pid/metadata.ts +0 -46
package/src/trust/types.ts
CHANGED
@@ -5,6 +5,29 @@ import * as z from "zod";
|
|
5
5
|
export const TrustMark = z.object({ id: z.string(), trust_mark: z.string() });
|
6
6
|
export type TrustMark = z.infer<typeof TrustMark>;
|
7
7
|
|
8
|
+
// Display metadata for a credential, used by the issuer to
|
9
|
+
// instruct the Wallet Solution on how to render the credential correctly
|
10
|
+
type CredentialDisplayMetadata = z.infer<typeof CredentialDisplayMetadata>;
|
11
|
+
const CredentialDisplayMetadata = z.object({
|
12
|
+
name: z.string(),
|
13
|
+
locale: z.string(),
|
14
|
+
logo: z.object({
|
15
|
+
url: z.string(),
|
16
|
+
alt_text: z.string(),
|
17
|
+
}),
|
18
|
+
background_color: z.string(),
|
19
|
+
text_color: z.string(),
|
20
|
+
});
|
21
|
+
|
22
|
+
// Metadata for a credentia which i supported by a Issuer
|
23
|
+
type SupportedCredentialMetadata = z.infer<typeof SupportedCredentialMetadata>;
|
24
|
+
const SupportedCredentialMetadata = z.object({
|
25
|
+
format: z.literal("vc+sd-jwt"),
|
26
|
+
cryptographic_binding_methods_supported: z.array(z.string()),
|
27
|
+
cryptographic_suites_supported: z.array(z.string()),
|
28
|
+
display: z.array(CredentialDisplayMetadata),
|
29
|
+
});
|
30
|
+
|
8
31
|
export type EntityStatement = z.infer<typeof EntityStatement>;
|
9
32
|
export const EntityStatement = z.object({
|
10
33
|
header: z.object({
|
@@ -22,43 +45,138 @@ export const EntityStatement = z.object({
|
|
22
45
|
}),
|
23
46
|
});
|
24
47
|
|
25
|
-
export type
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
48
|
+
export type EntityConfigurationHeader = z.infer<
|
49
|
+
typeof EntityConfigurationHeader
|
50
|
+
>;
|
51
|
+
export const EntityConfigurationHeader = z.object({
|
52
|
+
typ: z.literal("entity-statement+jwt"),
|
53
|
+
alg: z.string(),
|
54
|
+
kid: z.string(),
|
55
|
+
});
|
56
|
+
|
57
|
+
// Structuire common to every Entity Configuration document
|
58
|
+
const BaseEntityConfiguration = z.object({
|
59
|
+
header: EntityConfigurationHeader,
|
60
|
+
payload: z
|
61
|
+
.object({
|
62
|
+
exp: UnixTime,
|
63
|
+
iat: UnixTime,
|
64
|
+
iss: z.string(),
|
65
|
+
sub: z.string(),
|
66
|
+
jwks: z.object({
|
67
|
+
keys: z.array(JWK),
|
68
|
+
}),
|
69
|
+
metadata: z
|
70
|
+
.object({
|
71
|
+
federation_entity: z
|
72
|
+
.object({
|
73
|
+
federation_fetch_endpoint: z.string().optional(),
|
74
|
+
federation_list_endpoint: z.string().optional(),
|
75
|
+
federation_resolve_endpoint: z.string().optional(),
|
76
|
+
federation_trust_mark_status_endpoint: z.string().optional(),
|
77
|
+
federation_trust_mark_list_endpoint: z.string().optional(),
|
78
|
+
homepage_uri: z.string().optional(),
|
79
|
+
policy_uri: z.string().optional(),
|
80
|
+
logo_uri: z.string().optional(),
|
81
|
+
contacts: z.array(z.string()).optional(),
|
82
|
+
})
|
83
|
+
.passthrough(),
|
84
|
+
})
|
85
|
+
.passthrough(),
|
86
|
+
authority_hints: z.array(z.string()).optional(),
|
87
|
+
})
|
88
|
+
.passthrough(),
|
89
|
+
});
|
90
|
+
|
91
|
+
// Entity configuration for a Trust Anchor (it has no specific metadata section)
|
92
|
+
export type TrustAnchorEntityConfiguration = z.infer<
|
93
|
+
typeof TrustAnchorEntityConfiguration
|
94
|
+
>;
|
95
|
+
export const TrustAnchorEntityConfiguration = BaseEntityConfiguration;
|
96
|
+
|
97
|
+
// Entity configuration for a Credential Issuer
|
98
|
+
export type CredentialIssuerEntityConfiguration = z.infer<
|
99
|
+
typeof CredentialIssuerEntityConfiguration
|
100
|
+
>;
|
101
|
+
export const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(
|
102
|
+
z.object({
|
103
|
+
payload: z.object({
|
104
|
+
jwks: z.object({ keys: z.array(JWK) }),
|
105
|
+
metadata: z.object({
|
106
|
+
openid_credential_issuer: z.object({
|
107
|
+
credential_issuer: z.string(),
|
108
|
+
authorization_endpoint: z.string(),
|
109
|
+
token_endpoint: z.string(),
|
110
|
+
pushed_authorization_request_endpoint: z.string(),
|
111
|
+
dpop_signing_alg_values_supported: z.array(z.string()),
|
112
|
+
credential_endpoint: z.string(),
|
113
|
+
credentials_supported: z.array(SupportedCredentialMetadata),
|
114
|
+
jwks: z.object({ keys: z.array(JWK) }),
|
115
|
+
}),
|
116
|
+
}),
|
39
117
|
}),
|
40
|
-
|
41
|
-
|
42
|
-
|
118
|
+
})
|
119
|
+
);
|
120
|
+
|
121
|
+
// Entity configuration for a Wallet Provider
|
122
|
+
export type WalletProviderEntityConfiguration = z.infer<
|
123
|
+
typeof WalletProviderEntityConfiguration
|
124
|
+
>;
|
125
|
+
export const WalletProviderEntityConfiguration = BaseEntityConfiguration.and(
|
126
|
+
z.object({
|
127
|
+
payload: z.object({
|
128
|
+
metadata: z.object({
|
129
|
+
wallet_provider: z
|
43
130
|
.object({
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
131
|
+
token_endpoint: z.string(),
|
132
|
+
attested_security_context_values_supported: z
|
133
|
+
.array(z.string())
|
134
|
+
.optional(),
|
135
|
+
grant_types_supported: z.array(z.string()),
|
136
|
+
token_endpoint_auth_methods_supported: z.array(z.string()),
|
137
|
+
token_endpoint_auth_signing_alg_values_supported: z.array(
|
138
|
+
z.string()
|
139
|
+
),
|
140
|
+
jwks: z.object({ keys: z.array(JWK) }),
|
53
141
|
})
|
54
142
|
.passthrough(),
|
55
|
-
})
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
});
|
143
|
+
}),
|
144
|
+
}),
|
145
|
+
})
|
146
|
+
);
|
60
147
|
|
61
|
-
|
62
|
-
|
148
|
+
// Entity configuration for a Relying Party
|
149
|
+
export type RelyingPartyEntityConfiguration = z.infer<
|
150
|
+
typeof RelyingPartyEntityConfiguration
|
63
151
|
>;
|
64
|
-
export const
|
152
|
+
export const RelyingPartyEntityConfiguration = BaseEntityConfiguration.and(
|
153
|
+
z.object({
|
154
|
+
payload: z.object({
|
155
|
+
metadata: z.object({
|
156
|
+
wallet_relying_party: z
|
157
|
+
.object({
|
158
|
+
application_type: z.string().optional(),
|
159
|
+
client_id: z.string().optional(),
|
160
|
+
client_name: z.string().optional(),
|
161
|
+
jwks: z.array(JWK),
|
162
|
+
contacts: z.array(z.string()).optional(),
|
163
|
+
})
|
164
|
+
.passthrough(),
|
165
|
+
}),
|
166
|
+
}),
|
167
|
+
})
|
168
|
+
);
|
169
|
+
|
170
|
+
// Maps any entity configuration by the union of every possible shapes
|
171
|
+
export type EntityConfiguration = z.infer<typeof EntityConfiguration>;
|
172
|
+
export const EntityConfiguration = z.union(
|
173
|
+
[
|
174
|
+
WalletProviderEntityConfiguration,
|
175
|
+
CredentialIssuerEntityConfiguration,
|
176
|
+
TrustAnchorEntityConfiguration,
|
177
|
+
RelyingPartyEntityConfiguration,
|
178
|
+
],
|
179
|
+
{
|
180
|
+
description: "Any kind of Entity Configuration allowed in the ecosystem",
|
181
|
+
}
|
182
|
+
);
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { getPublicKey, sign } from "@pagopa/io-react-native-crypto";
|
2
|
+
import { thumbprint, type CryptoContext } from "@pagopa/io-react-native-jwt";
|
3
|
+
import { fixBase64EncodingOnKey } from "./jwk";
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Create a CryptoContext bound to a key pair.
|
7
|
+
* Key pair is supposed to exist already in the device's keychain.
|
8
|
+
* It's identified by its unique keytag.
|
9
|
+
*
|
10
|
+
* @returns the crypto context
|
11
|
+
*/
|
12
|
+
export const createCryptoContextFor = (keytag: string): CryptoContext => {
|
13
|
+
return {
|
14
|
+
/**
|
15
|
+
* Retrieve the public key of the pair.
|
16
|
+
* If the key pair doesn't exist yet, an error is raised
|
17
|
+
* @returns The public key.
|
18
|
+
*/
|
19
|
+
async getPublicKey() {
|
20
|
+
return getPublicKey(keytag)
|
21
|
+
.then(fixBase64EncodingOnKey)
|
22
|
+
.then(async (jwk) => ({
|
23
|
+
...jwk,
|
24
|
+
// Keys in the TEE are not stored with their KID, which is supposed to be assigned when they are included in JWK sets.
|
25
|
+
// (that is, KID is not a propoerty of the key itself, but it's property used to identify a key in a set).
|
26
|
+
// We assume the convention we use the thumbprint of the public key as KID, thus for easy development we decided to evaluate KID here
|
27
|
+
// However the values is an arbitrary string that might be anything
|
28
|
+
kid: await thumbprint(jwk),
|
29
|
+
}));
|
30
|
+
},
|
31
|
+
/**
|
32
|
+
* Get a signature for a provided value.
|
33
|
+
* If the key pair doesn't exist yet, an error is raised.
|
34
|
+
* @param value
|
35
|
+
* @returns The signature for the value
|
36
|
+
*/
|
37
|
+
async getSignature(value: string) {
|
38
|
+
return sign(value, keytag);
|
39
|
+
},
|
40
|
+
};
|
41
|
+
};
|
package/src/utils/dpop.ts
CHANGED
@@ -1,19 +1,29 @@
|
|
1
1
|
import * as z from "zod";
|
2
2
|
|
3
|
-
import { SignJWT } from "@pagopa/io-react-native-jwt";
|
4
|
-
import type { JWK } from "./jwk";
|
3
|
+
import { SignJWT, type CryptoContext } from "@pagopa/io-react-native-jwt";
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
/**
|
6
|
+
* Create a signed DPoP token
|
7
|
+
*
|
8
|
+
* @param payload The payload to be included in the token.
|
9
|
+
* @param crypto The crypto context that handles the key bound to the DPoP.
|
10
|
+
*
|
11
|
+
* @returns The signed crypto token.
|
12
|
+
*/
|
13
|
+
export const createDPopToken = async (
|
14
|
+
payload: DPoPPayload,
|
15
|
+
crypto: CryptoContext
|
16
|
+
): Promise<string> => {
|
17
|
+
const jwk = await crypto.getPublicKey();
|
18
|
+
return new SignJWT(crypto)
|
19
|
+
.setPayload(payload)
|
8
20
|
.setProtectedHeader({
|
9
|
-
alg: "ES256",
|
10
21
|
typ: "dpop+jwt",
|
11
22
|
jwk,
|
12
23
|
})
|
13
24
|
.setIssuedAt()
|
14
25
|
.setExpirationTime("1h")
|
15
|
-
.
|
16
|
-
return dPop;
|
26
|
+
.sign();
|
17
27
|
};
|
18
28
|
|
19
29
|
export type DPoPPayload = z.infer<typeof DPoPPayload>;
|
@@ -2,8 +2,8 @@ import { WalletInstanceAttestationJwt } from "./types";
|
|
2
2
|
import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
|
3
3
|
import { verify as verifyJwt } from "@pagopa/io-react-native-jwt";
|
4
4
|
|
5
|
-
import {
|
6
|
-
export {
|
5
|
+
import { getAttestation } from "./issuing";
|
6
|
+
export { getAttestation };
|
7
7
|
/**
|
8
8
|
* Decode a given JWT to get the parsed Wallet Instance Attestation object they define.
|
9
9
|
* It ensures provided data is in a valid shape.
|
@@ -1,78 +1,65 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
type CryptoContext,
|
3
|
+
decode as decodeJwt,
|
4
|
+
} from "@pagopa/io-react-native-jwt";
|
2
5
|
import { verify as verifyJwt } from "@pagopa/io-react-native-jwt";
|
3
6
|
import { SignJWT, thumbprint } from "@pagopa/io-react-native-jwt";
|
4
7
|
import { JWK, fixBase64EncodingOnKey } from "../utils/jwk";
|
5
8
|
import { WalletInstanceAttestationRequestJwt } from "./types";
|
6
9
|
import uuid from "react-native-uuid";
|
7
10
|
import { WalletInstanceAttestationIssuingError } from "../utils/errors";
|
11
|
+
import type { WalletProviderEntityConfiguration } from "../trust/types";
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
)
|
16
|
-
|
17
|
-
this.appFetch = appFetch;
|
18
|
-
}
|
13
|
+
async function getAttestationRequest(
|
14
|
+
wiaCryptoContext: CryptoContext,
|
15
|
+
walletProviderEntityConfiguration: WalletProviderEntityConfiguration
|
16
|
+
): Promise<string> {
|
17
|
+
const jwk = await wiaCryptoContext.getPublicKey();
|
18
|
+
const parsedJwk = JWK.parse(jwk);
|
19
|
+
const keyThumbprint = await thumbprint(parsedJwk);
|
20
|
+
const publicKey = { ...parsedJwk, kid: keyThumbprint };
|
19
21
|
|
20
|
-
|
21
|
-
|
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: JWK): Promise<string> {
|
31
|
-
const parsedJwk = JWK.parse(jwk);
|
32
|
-
const keyThumbprint = await thumbprint(parsedJwk);
|
33
|
-
const publicKey = { ...parsedJwk, kid: keyThumbprint };
|
34
|
-
|
35
|
-
const walletInstanceAttestationRequest = new SignJWT({
|
22
|
+
return new SignJWT(wiaCryptoContext)
|
23
|
+
.setPayload({
|
36
24
|
iss: keyThumbprint,
|
37
|
-
aud:
|
25
|
+
aud: walletProviderEntityConfiguration.payload.iss,
|
38
26
|
jti: `${uuid.v4()}`,
|
39
27
|
nonce: `${uuid.v4()}`,
|
40
28
|
cnf: {
|
41
29
|
jwk: fixBase64EncodingOnKey(publicKey),
|
42
30
|
},
|
43
31
|
})
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
return walletInstanceAttestationRequest;
|
54
|
-
}
|
32
|
+
.setProtectedHeader({
|
33
|
+
kid: publicKey.kid,
|
34
|
+
typ: "wiar+jwt",
|
35
|
+
})
|
36
|
+
.setIssuedAt()
|
37
|
+
.setExpirationTime("1h")
|
38
|
+
.sign();
|
39
|
+
}
|
55
40
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
41
|
+
/**
|
42
|
+
* Request a Wallet Instance Attestation (WIA) to the Wallet provider
|
43
|
+
*
|
44
|
+
* @param params.wiaCryptoContext The key pair associated with the WIA. Will be use to prove the ownership of the attestation.
|
45
|
+
* @param params.appFetch (optional) Http client
|
46
|
+
* @param walletProviderBaseUrl Base url for the Wallet Provider
|
47
|
+
* @returns The retrieved Wallet Instance Attestation token
|
48
|
+
*/
|
49
|
+
export const getAttestation =
|
50
|
+
({
|
51
|
+
wiaCryptoContext,
|
52
|
+
appFetch = fetch,
|
53
|
+
}: {
|
54
|
+
wiaCryptoContext: CryptoContext;
|
55
|
+
appFetch?: GlobalFetch["fetch"];
|
56
|
+
}) =>
|
57
|
+
async (
|
58
|
+
walletProviderEntityConfiguration: WalletProviderEntityConfiguration
|
59
|
+
): Promise<string> => {
|
60
|
+
const signedAttestationRequest = await getAttestationRequest(
|
61
|
+
wiaCryptoContext,
|
62
|
+
walletProviderEntityConfiguration
|
76
63
|
);
|
77
64
|
|
78
65
|
const decodedRequest = decodeJwt(signedAttestationRequest);
|
@@ -84,13 +71,15 @@ export class Issuing {
|
|
84
71
|
|
85
72
|
await verifyJwt(signedAttestationRequest, publicKey);
|
86
73
|
|
87
|
-
const tokenUrl =
|
74
|
+
const tokenUrl =
|
75
|
+
walletProviderEntityConfiguration.payload.metadata.wallet_provider
|
76
|
+
.token_endpoint;
|
88
77
|
const requestBody = {
|
89
78
|
grant_type:
|
90
79
|
"urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation",
|
91
80
|
assertion: signedAttestationRequest,
|
92
81
|
};
|
93
|
-
const response = await
|
82
|
+
const response = await appFetch(tokenUrl, {
|
94
83
|
method: "POST",
|
95
84
|
headers: {
|
96
85
|
"Content-Type": "application/json",
|
@@ -106,5 +95,4 @@ export class Issuing {
|
|
106
95
|
"Unable to obtain wallet instance attestation from wallet provider",
|
107
96
|
`Response code: ${response.status}`
|
108
97
|
);
|
109
|
-
}
|
110
|
-
}
|
98
|
+
};
|
@@ -1,49 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.PidIssuerEntityConfiguration = exports.PidDisplayMetadata = void 0;
|
7
|
-
var _jwk = require("../utils/jwk");
|
8
|
-
var _zod = require("zod");
|
9
|
-
const PidDisplayMetadata = _zod.z.object({
|
10
|
-
name: _zod.z.string(),
|
11
|
-
locale: _zod.z.string(),
|
12
|
-
logo: _zod.z.object({
|
13
|
-
url: _zod.z.string(),
|
14
|
-
alt_text: _zod.z.string()
|
15
|
-
}),
|
16
|
-
background_color: _zod.z.string(),
|
17
|
-
text_color: _zod.z.string()
|
18
|
-
});
|
19
|
-
exports.PidDisplayMetadata = PidDisplayMetadata;
|
20
|
-
const PidIssuerEntityConfiguration = _zod.z.object({
|
21
|
-
jwks: _zod.z.object({
|
22
|
-
keys: _zod.z.array(_jwk.JWK)
|
23
|
-
}),
|
24
|
-
metadata: _zod.z.object({
|
25
|
-
openid_credential_issuer: _zod.z.object({
|
26
|
-
credential_issuer: _zod.z.string(),
|
27
|
-
authorization_endpoint: _zod.z.string(),
|
28
|
-
token_endpoint: _zod.z.string(),
|
29
|
-
pushed_authorization_request_endpoint: _zod.z.string(),
|
30
|
-
dpop_signing_alg_values_supported: _zod.z.array(_zod.z.string()),
|
31
|
-
credential_endpoint: _zod.z.string(),
|
32
|
-
credentials_supported: _zod.z.array(_zod.z.object({
|
33
|
-
format: _zod.z.literal("vc+sd-jwt"),
|
34
|
-
cryptographic_binding_methods_supported: _zod.z.array(_zod.z.string()),
|
35
|
-
cryptographic_suites_supported: _zod.z.array(_zod.z.string()),
|
36
|
-
display: _zod.z.array(PidDisplayMetadata)
|
37
|
-
}))
|
38
|
-
}),
|
39
|
-
federation_entity: _zod.z.object({
|
40
|
-
organization_name: _zod.z.string(),
|
41
|
-
homepage_uri: _zod.z.string(),
|
42
|
-
policy_uri: _zod.z.string(),
|
43
|
-
tos_uri: _zod.z.string(),
|
44
|
-
logo_uri: _zod.z.string()
|
45
|
-
})
|
46
|
-
})
|
47
|
-
});
|
48
|
-
exports.PidIssuerEntityConfiguration = PidIssuerEntityConfiguration;
|
49
|
-
//# sourceMappingURL=metadata.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_jwk","require","_zod","PidDisplayMetadata","z","object","name","string","locale","logo","url","alt_text","background_color","text_color","exports","PidIssuerEntityConfiguration","jwks","keys","array","JWK","metadata","openid_credential_issuer","credential_issuer","authorization_endpoint","token_endpoint","pushed_authorization_request_endpoint","dpop_signing_alg_values_supported","credential_endpoint","credentials_supported","format","literal","cryptographic_binding_methods_supported","cryptographic_suites_supported","display","federation_entity","organization_name","homepage_uri","policy_uri","tos_uri","logo_uri"],"sourceRoot":"../../../src","sources":["pid/metadata.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAGO,MAAME,kBAAkB,GAAGC,MAAC,CAACC,MAAM,CAAC;EACzCC,IAAI,EAAEF,MAAC,CAACG,MAAM,CAAC,CAAC;EAChBC,MAAM,EAAEJ,MAAC,CAACG,MAAM,CAAC,CAAC;EAClBE,IAAI,EAAEL,MAAC,CAACC,MAAM,CAAC;IACbK,GA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AACf,kBAAkB;MACrC,CAAC,CACH;IACF,CAAC,CAAC;IACF+B,iBAAiB,EAAE9B,MAAC,CAACC,MAAM,CAAC;MAC1B8B,iBAAiB,EAAE/B,MAAC,CAACG,MAAM,CAAC,CAAC;MAC7B6B,YAAY,EAAEhC,MAAC,CAACG,MAAM,CAAC,CAAC;MACxB8B,UAAU,EAAEjC,MAAC,CAACG,MAAM,CAAC,CAAC;MACtB+B,OAAO,EAAElC,MAAC,CAACG,MAAM,CAAC,CAAC;MACnBgC,QAAQ,EAAEnC,MAAC,CAACG,MAAM,CAAC;IACrB,CAAC;EACH,CAAC;AACH,CAAC,CAAC;AAACO,OAAA,CAAAC,4BAAA,GAAAA,4BAAA"}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import { JWK } from "../utils/jwk";
|
2
|
-
import { z } from "zod";
|
3
|
-
export const PidDisplayMetadata = z.object({
|
4
|
-
name: z.string(),
|
5
|
-
locale: z.string(),
|
6
|
-
logo: z.object({
|
7
|
-
url: z.string(),
|
8
|
-
alt_text: z.string()
|
9
|
-
}),
|
10
|
-
background_color: z.string(),
|
11
|
-
text_color: z.string()
|
12
|
-
});
|
13
|
-
export const PidIssuerEntityConfiguration = z.object({
|
14
|
-
jwks: z.object({
|
15
|
-
keys: z.array(JWK)
|
16
|
-
}),
|
17
|
-
metadata: z.object({
|
18
|
-
openid_credential_issuer: z.object({
|
19
|
-
credential_issuer: z.string(),
|
20
|
-
authorization_endpoint: z.string(),
|
21
|
-
token_endpoint: z.string(),
|
22
|
-
pushed_authorization_request_endpoint: z.string(),
|
23
|
-
dpop_signing_alg_values_supported: z.array(z.string()),
|
24
|
-
credential_endpoint: z.string(),
|
25
|
-
credentials_supported: z.array(z.object({
|
26
|
-
format: z.literal("vc+sd-jwt"),
|
27
|
-
cryptographic_binding_methods_supported: z.array(z.string()),
|
28
|
-
cryptographic_suites_supported: z.array(z.string()),
|
29
|
-
display: z.array(PidDisplayMetadata)
|
30
|
-
}))
|
31
|
-
}),
|
32
|
-
federation_entity: z.object({
|
33
|
-
organization_name: z.string(),
|
34
|
-
homepage_uri: z.string(),
|
35
|
-
policy_uri: z.string(),
|
36
|
-
tos_uri: z.string(),
|
37
|
-
logo_uri: z.string()
|
38
|
-
})
|
39
|
-
})
|
40
|
-
});
|
41
|
-
//# sourceMappingURL=metadata.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["JWK","z","PidDisplayMetadata","object","name","string","locale","logo","url","alt_text","background_color","text_color","PidIssuerEntityConfiguration","jwks","keys","array","metadata","openid_credential_issuer","credential_issuer","authorization_endpoint","token_endpoint","pushed_authorization_request_endpoint","dpop_signing_alg_values_supported","credential_endpoint","credentials_supported","format","literal","cryptographic_binding_methods_supported","cryptographic_suites_supported","display","federation_entity","organization_name","homepage_uri","policy_uri","tos_uri","logo_uri"],"sourceRoot":"../../../src","sources":["pid/metadata.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,SAASC,CAAC,QAAQ,KAAK;AAGvB,OAAO,MAAMC,kBAAkB,GAAGD,CAAC,CAACE,MAAM,CAAC;EACzCC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EAChBC,MAAM,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EAClBE,IAAI,EAAEN,CAAC,CAACE,MAAM,CAAC;IACbK,GAAG,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC;IACfI,QAAQ,EAAER,CAAC,CAACI,MAAM,CAAC;EACrB,CAAC,CAAC;EACFK,gBAAgB,EAAET,CAAC,CAACI,MAAM,CAAC,CAAC;EAC5BM,UAAU,EAAEV,CAAC,CAACI,MAAM,CAAC;AACvB,CAAC,CAAC;AAKF,OAAO,MAAMO,4BAA4B,GAAGX,CAAC,CAACE,MAAM,CAAC;EACnDU,IAAI,EAAEZ,CAAC,CAACE,MAAM,CAAC;IAAEW,IAAI,EAAEb,CAAC,CAACc,KAAK,CAACf,GAAG;EAAE,CAAC,CAAC;EACt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