@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
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.TrustMark = exports.TrustAnchorEntityConfiguration = exports.EntityStatement = exports.EntityConfiguration = void 0;
|
6
|
+
exports.WalletProviderEntityConfiguration = exports.TrustMark = exports.TrustAnchorEntityConfiguration = exports.RelyingPartyEntityConfiguration = exports.EntityStatement = exports.EntityConfigurationHeader = exports.EntityConfiguration = exports.CredentialIssuerEntityConfiguration = void 0;
|
7
7
|
var _types = require("../sd-jwt/types");
|
8
8
|
var _jwk = require("../utils/jwk");
|
9
9
|
var z = _interopRequireWildcard(require("zod"));
|
@@ -13,7 +13,29 @@ const TrustMark = z.object({
|
|
13
13
|
id: z.string(),
|
14
14
|
trust_mark: z.string()
|
15
15
|
});
|
16
|
+
|
17
|
+
// Display metadata for a credential, used by the issuer to
|
18
|
+
// instruct the Wallet Solution on how to render the credential correctly
|
16
19
|
exports.TrustMark = TrustMark;
|
20
|
+
const CredentialDisplayMetadata = z.object({
|
21
|
+
name: z.string(),
|
22
|
+
locale: z.string(),
|
23
|
+
logo: z.object({
|
24
|
+
url: z.string(),
|
25
|
+
alt_text: z.string()
|
26
|
+
}),
|
27
|
+
background_color: z.string(),
|
28
|
+
text_color: z.string()
|
29
|
+
});
|
30
|
+
|
31
|
+
// Metadata for a credentia which i supported by a Issuer
|
32
|
+
|
33
|
+
const SupportedCredentialMetadata = z.object({
|
34
|
+
format: z.literal("vc+sd-jwt"),
|
35
|
+
cryptographic_binding_methods_supported: z.array(z.string()),
|
36
|
+
cryptographic_suites_supported: z.array(z.string()),
|
37
|
+
display: z.array(CredentialDisplayMetadata)
|
38
|
+
});
|
17
39
|
const EntityStatement = z.object({
|
18
40
|
header: z.object({
|
19
41
|
typ: z.literal("entity-statement+jwt"),
|
@@ -32,12 +54,16 @@ const EntityStatement = z.object({
|
|
32
54
|
})
|
33
55
|
});
|
34
56
|
exports.EntityStatement = EntityStatement;
|
35
|
-
const
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
57
|
+
const EntityConfigurationHeader = z.object({
|
58
|
+
typ: z.literal("entity-statement+jwt"),
|
59
|
+
alg: z.string(),
|
60
|
+
kid: z.string()
|
61
|
+
});
|
62
|
+
|
63
|
+
// Structuire common to every Entity Configuration document
|
64
|
+
exports.EntityConfigurationHeader = EntityConfigurationHeader;
|
65
|
+
const BaseEntityConfiguration = z.object({
|
66
|
+
header: EntityConfigurationHeader,
|
41
67
|
payload: z.object({
|
42
68
|
exp: _types.UnixTime,
|
43
69
|
iat: _types.UnixTime,
|
@@ -60,9 +86,76 @@ const EntityConfiguration = z.object({
|
|
60
86
|
}).passthrough()
|
61
87
|
}).passthrough(),
|
62
88
|
authority_hints: z.array(z.string()).optional()
|
89
|
+
}).passthrough()
|
90
|
+
});
|
91
|
+
|
92
|
+
// Entity configuration for a Trust Anchor (it has no specific metadata section)
|
93
|
+
|
94
|
+
const TrustAnchorEntityConfiguration = BaseEntityConfiguration;
|
95
|
+
|
96
|
+
// Entity configuration for a Credential Issuer
|
97
|
+
exports.TrustAnchorEntityConfiguration = TrustAnchorEntityConfiguration;
|
98
|
+
const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(z.object({
|
99
|
+
payload: z.object({
|
100
|
+
jwks: z.object({
|
101
|
+
keys: z.array(_jwk.JWK)
|
102
|
+
}),
|
103
|
+
metadata: z.object({
|
104
|
+
openid_credential_issuer: z.object({
|
105
|
+
credential_issuer: z.string(),
|
106
|
+
authorization_endpoint: z.string(),
|
107
|
+
token_endpoint: z.string(),
|
108
|
+
pushed_authorization_request_endpoint: z.string(),
|
109
|
+
dpop_signing_alg_values_supported: z.array(z.string()),
|
110
|
+
credential_endpoint: z.string(),
|
111
|
+
credentials_supported: z.array(SupportedCredentialMetadata),
|
112
|
+
jwks: z.object({
|
113
|
+
keys: z.array(_jwk.JWK)
|
114
|
+
})
|
115
|
+
})
|
116
|
+
})
|
117
|
+
})
|
118
|
+
}));
|
119
|
+
|
120
|
+
// Entity configuration for a Wallet Provider
|
121
|
+
exports.CredentialIssuerEntityConfiguration = CredentialIssuerEntityConfiguration;
|
122
|
+
const WalletProviderEntityConfiguration = BaseEntityConfiguration.and(z.object({
|
123
|
+
payload: z.object({
|
124
|
+
metadata: z.object({
|
125
|
+
wallet_provider: z.object({
|
126
|
+
token_endpoint: z.string(),
|
127
|
+
attested_security_context_values_supported: z.array(z.string()).optional(),
|
128
|
+
grant_types_supported: z.array(z.string()),
|
129
|
+
token_endpoint_auth_methods_supported: z.array(z.string()),
|
130
|
+
token_endpoint_auth_signing_alg_values_supported: z.array(z.string()),
|
131
|
+
jwks: z.object({
|
132
|
+
keys: z.array(_jwk.JWK)
|
133
|
+
})
|
134
|
+
}).passthrough()
|
135
|
+
})
|
63
136
|
})
|
137
|
+
}));
|
138
|
+
|
139
|
+
// Entity configuration for a Relying Party
|
140
|
+
exports.WalletProviderEntityConfiguration = WalletProviderEntityConfiguration;
|
141
|
+
const RelyingPartyEntityConfiguration = BaseEntityConfiguration.and(z.object({
|
142
|
+
payload: z.object({
|
143
|
+
metadata: z.object({
|
144
|
+
wallet_relying_party: z.object({
|
145
|
+
application_type: z.string().optional(),
|
146
|
+
client_id: z.string().optional(),
|
147
|
+
client_name: z.string().optional(),
|
148
|
+
jwks: z.array(_jwk.JWK),
|
149
|
+
contacts: z.array(z.string()).optional()
|
150
|
+
}).passthrough()
|
151
|
+
})
|
152
|
+
})
|
153
|
+
}));
|
154
|
+
|
155
|
+
// Maps any entity configuration by the union of every possible shapes
|
156
|
+
exports.RelyingPartyEntityConfiguration = RelyingPartyEntityConfiguration;
|
157
|
+
const EntityConfiguration = z.union([WalletProviderEntityConfiguration, CredentialIssuerEntityConfiguration, TrustAnchorEntityConfiguration, RelyingPartyEntityConfiguration], {
|
158
|
+
description: "Any kind of Entity Configuration allowed in the ecosystem"
|
64
159
|
});
|
65
160
|
exports.EntityConfiguration = EntityConfiguration;
|
66
|
-
const TrustAnchorEntityConfiguration = EntityConfiguration;
|
67
|
-
exports.TrustAnchorEntityConfiguration = TrustAnchorEntityConfiguration;
|
68
161
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_jwk","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","TrustMark","object","id","string","trust_mark","exports","
|
1
|
+
{"version":3,"names":["_types","require","_jwk","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","TrustMark","object","id","string","trust_mark","exports","CredentialDisplayMetadata","name","locale","logo","url","alt_text","background_color","text_color","SupportedCredentialMetadata","format","literal","cryptographic_binding_methods_supported","array","cryptographic_suites_supported","display","EntityStatement","header","typ","alg","kid","payload","iss","sub","jwks","keys","JWK","trust_marks","iat","number","exp","EntityConfigurationHeader","BaseEntityConfiguration","UnixTime","metadata","federation_entity","federation_fetch_endpoint","optional","federation_list_endpoint","federation_resolve_endpoint","federation_trust_mark_status_endpoint","federation_trust_mark_list_endpoint","homepage_uri","policy_uri","logo_uri","contacts","passthrough","authority_hints","TrustAnchorEntityConfiguration","CredentialIssuerEntityConfiguration","and","openid_credential_issuer","credential_issuer","authorization_endpoint","token_endpoint","pushed_authorization_request_endpoint","dpop_signing_alg_values_supported","credential_endpoint","credentials_supported","WalletProviderEntityConfiguration","wallet_provider","attested_security_context_values_supported","grant_types_supported","token_endpoint_auth_methods_supported","token_endpoint_auth_signing_alg_values_supported","RelyingPartyEntityConfiguration","wallet_relying_party","application_type","client_id","client_name","EntityConfiguration","union","description"],"sourceRoot":"../../../src","sources":["trust/types.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAC,uBAAA,CAAAH,OAAA;AAAyB,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,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AG,CACxE/E,CAAC,CAACyB,MAAM,CAAC;EACPyB,OAAO,EAAElD,CAAC,CAACyB,MAAM,CAAC;IAChBsC,QAAQ,EAAE/D,CAAC,CAACyB,MAAM,CAAC;MACjBsE,oBAAoB,EAAE/F,CAAC,CACpByB,MAAM,CAAC;QACNuE,gBAAgB,EAAEhG,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACuC,QAAQ,CAAC,CAAC;QACvC+B,SAAS,EAAEjG,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACuC,QAAQ,CAAC,CAAC;QAChCgC,WAAW,EAAElG,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAACuC,QAAQ,CAAC,CAAC;QAClCb,IAAI,EAAErD,CAAC,CAAC0C,KAAK,CAACa,QAAG,CAAC;QAClBmB,QAAQ,EAAE1E,CAAC,CAAC0C,KAAK,CAAC1C,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAAC,CAACuC,QAAQ,CAAC;MACzC,CAAC,CAAC,CACDS,WAAW,CAAC;IACjB,CAAC;EACH,CAAC;AACH,CAAC,CACH,CAAC;;AAED;AAAA9C,OAAA,CAAAiE,+BAAA,GAAAA,+BAAA;AAEO,MAAMK,mBAAmB,GAAGnG,CAAC,CAACoG,KAAK,CACxC,CACEZ,iCAAiC,EACjCV,mCAAmC,EACnCD,8BAA8B,EAC9BiB,+BAA+B,CAChC,EACD;EACEO,WAAW,EAAE;AACf,CACF,CAAC;AAACxE,OAAA,CAAAsE,mBAAA,GAAAA,mBAAA"}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createCryptoContextFor = void 0;
|
7
|
+
var _ioReactNativeCrypto = require("@pagopa/io-react-native-crypto");
|
8
|
+
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
9
|
+
var _jwk = require("./jwk");
|
10
|
+
/**
|
11
|
+
* Create a CryptoContext bound to a key pair.
|
12
|
+
* Key pair is supposed to exist already in the device's keychain.
|
13
|
+
* It's identified by its unique keytag.
|
14
|
+
*
|
15
|
+
* @returns the crypto context
|
16
|
+
*/
|
17
|
+
const createCryptoContextFor = keytag => {
|
18
|
+
return {
|
19
|
+
/**
|
20
|
+
* Retrieve the public key of the pair.
|
21
|
+
* If the key pair doesn't exist yet, an error is raised
|
22
|
+
* @returns The public key.
|
23
|
+
*/
|
24
|
+
async getPublicKey() {
|
25
|
+
return (0, _ioReactNativeCrypto.getPublicKey)(keytag).then(_jwk.fixBase64EncodingOnKey).then(async jwk => ({
|
26
|
+
...jwk,
|
27
|
+
// Keys in the TEE are not stored with their KID, which is supposed to be assigned when they are included in JWK sets.
|
28
|
+
// (that is, KID is not a propoerty of the key itself, but it's property used to identify a key in a set).
|
29
|
+
// We assume the convention we use the thumbprint of the public key as KID, thus for easy development we decided to evaluate KID here
|
30
|
+
// However the values is an arbitrary string that might be anything
|
31
|
+
kid: await (0, _ioReactNativeJwt.thumbprint)(jwk)
|
32
|
+
}));
|
33
|
+
},
|
34
|
+
/**
|
35
|
+
* Get a signature for a provided value.
|
36
|
+
* If the key pair doesn't exist yet, an error is raised.
|
37
|
+
* @param value
|
38
|
+
* @returns The signature for the value
|
39
|
+
*/
|
40
|
+
async getSignature(value) {
|
41
|
+
return (0, _ioReactNativeCrypto.sign)(value, keytag);
|
42
|
+
}
|
43
|
+
};
|
44
|
+
};
|
45
|
+
exports.createCryptoContextFor = createCryptoContextFor;
|
46
|
+
//# sourceMappingURL=crypto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_ioReactNativeCrypto","require","_ioReactNativeJwt","_jwk","createCryptoContextFor","keytag","getPublicKey","then","fixBase64EncodingOnKey","jwk","kid","thumbprint","getSignature","value","sign","exports"],"sourceRoot":"../../../src","sources":["utils/crypto.ts"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,sBAAsB,GAAIC,MAAc,IAAoB;EACvE,OAAO;IACL;AACJ;AACA;AACA;AACA;IACI,MAAMC,YAAYA,CAAA,EAAG;MACnB,OAAO,IAAAA,iCAAY,EAACD,MAAM,CAAC,CACxBE,IAAI,CAACC,2BAAsB,CAAC,CAC5BD,IAAI,CAAC,MAAOE,GAAG,KAAM;QACpB,GAAGA,GAAG;QACN;QACA;QACA;QACA;QACAC,GAAG,EAAE,MAAM,IAAAC,4BAAU,EAACF,GAAG;MAC3B,CAAC,CAAC,CAAC;IACP,CAAC;IACD;AACJ;AACA;AACA;AACA;AACA;IACI,MAAMG,YAAYA,CAACC,KAAa,EAAE;MAChC,OAAO,IAAAC,yBAAI,EAACD,KAAK,EAAER,MAAM,CAAC;IAC5B;EACF,CAAC;AACH,CAAC;AAACU,OAAA,CAAAX,sBAAA,GAAAA,sBAAA"}
|
@@ -3,20 +3,27 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.createDPopToken = exports.DPoPPayload = void 0;
|
7
7
|
var z = _interopRequireWildcard(require("zod"));
|
8
8
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
9
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
10
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
/**
|
12
|
+
* Create a signed DPoP token
|
13
|
+
*
|
14
|
+
* @param payload The payload to be included in the token.
|
15
|
+
* @param crypto The crypto context that handles the key bound to the DPoP.
|
16
|
+
*
|
17
|
+
* @returns The signed crypto token.
|
18
|
+
*/
|
19
|
+
const createDPopToken = async (payload, crypto) => {
|
20
|
+
const jwk = await crypto.getPublicKey();
|
21
|
+
return new _ioReactNativeJwt.SignJWT(crypto).setPayload(payload).setProtectedHeader({
|
14
22
|
typ: "dpop+jwt",
|
15
23
|
jwk
|
16
|
-
}).setIssuedAt().setExpirationTime("1h").
|
17
|
-
return dPop;
|
24
|
+
}).setIssuedAt().setExpirationTime("1h").sign();
|
18
25
|
};
|
19
|
-
exports.
|
26
|
+
exports.createDPopToken = createDPopToken;
|
20
27
|
const DPoPPayload = z.object({
|
21
28
|
jti: z.string(),
|
22
29
|
htm: z.union([z.literal("POST"), z.literal("GET")]),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["z","_interopRequireWildcard","require","_ioReactNativeJwt","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","
|
1
|
+
{"version":3,"names":["z","_interopRequireWildcard","require","_ioReactNativeJwt","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","createDPopToken","payload","crypto","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","exports","DPoPPayload","object","jti","string","htm","union","literal","htu","ath","optional"],"sourceRoot":"../../../src","sources":["utils/dpop.ts"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAA0E,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,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;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,eAAe,GAAG,MAAAA,CAC7BC,OAAoB,EACpBC,MAAqB,KACD;EACpB,MAAMC,GAAG,GAAG,MAAMD,MAAM,CAACE,YAAY,CAAC,CAAC;EACvC,OAAO,IAAIC,yBAAO,CAACH,MAAM,CAAC,CACvBI,UAAU,CAACL,OAAO,CAAC,CACnBM,kBAAkB,CAAC;IAClBC,GAAG,EAAE,UAAU;IACfL;EACF,CAAC,CAAC,CACDM,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,IAAI,CAAC,CACvBC,IAAI,CAAC,CAAC;AACX,CAAC;AAACC,OAAA,CAAAZ,eAAA,GAAAA,eAAA;AAGK,MAAMa,WAAW,GAAGvC,CAAC,CAACwC,MAAM,CAAC;EAClCC,GAAG,EAAEzC,CAAC,CAAC0C,MAAM,CAAC,CAAC;EACfC,GAAG,EAAE3C,CAAC,CAAC4C,KAAK,CAAC,CAAC5C,CAAC,CAAC6C,OAAO,CAAC,MAAM,CAAC,EAAE7C,CAAC,CAAC6C,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;EACnDC,GAAG,EAAE9C,CAAC,CAAC0C,MAAM,CAAC,CAAC;EACfK,GAAG,EAAE/C,CAAC,CAAC0C,MAAM,CAAC,CAAC,CAACM,QAAQ,CAAC;AAC3B,CAAC,CAAC;AAACV,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
|
@@ -3,13 +3,13 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
|
6
|
+
exports.decode = decode;
|
7
|
+
Object.defineProperty(exports, "getAttestation", {
|
7
8
|
enumerable: true,
|
8
9
|
get: function () {
|
9
|
-
return _issuing.
|
10
|
+
return _issuing.getAttestation;
|
10
11
|
}
|
11
12
|
});
|
12
|
-
exports.decode = decode;
|
13
13
|
exports.verify = verify;
|
14
14
|
var _types = require("./types");
|
15
15
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
@@ -3,68 +3,50 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.getAttestation = void 0;
|
7
7
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
8
8
|
var _jwk = require("../utils/jwk");
|
9
9
|
var _types = require("./types");
|
10
10
|
var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
|
11
11
|
var _errors = require("../utils/errors");
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
...parsedJwk,
|
35
|
-
kid: keyThumbprint
|
36
|
-
};
|
37
|
-
const walletInstanceAttestationRequest = new _ioReactNativeJwt.SignJWT({
|
38
|
-
iss: keyThumbprint,
|
39
|
-
aud: this.walletProviderBaseUrl,
|
40
|
-
jti: `${_reactNativeUuid.default.v4()}`,
|
41
|
-
nonce: `${_reactNativeUuid.default.v4()}`,
|
42
|
-
cnf: {
|
43
|
-
jwk: (0, _jwk.fixBase64EncodingOnKey)(publicKey)
|
44
|
-
}
|
45
|
-
}).setProtectedHeader({
|
46
|
-
alg: "ES256",
|
47
|
-
kid: publicKey.kid,
|
48
|
-
typ: "wiar+jwt"
|
49
|
-
}).setIssuedAt().setExpirationTime("1h").toSign();
|
50
|
-
return walletInstanceAttestationRequest;
|
51
|
-
}
|
13
|
+
async function getAttestationRequest(wiaCryptoContext, walletProviderEntityConfiguration) {
|
14
|
+
const jwk = await wiaCryptoContext.getPublicKey();
|
15
|
+
const parsedJwk = _jwk.JWK.parse(jwk);
|
16
|
+
const keyThumbprint = await (0, _ioReactNativeJwt.thumbprint)(parsedJwk);
|
17
|
+
const publicKey = {
|
18
|
+
...parsedJwk,
|
19
|
+
kid: keyThumbprint
|
20
|
+
};
|
21
|
+
return new _ioReactNativeJwt.SignJWT(wiaCryptoContext).setPayload({
|
22
|
+
iss: keyThumbprint,
|
23
|
+
aud: walletProviderEntityConfiguration.payload.iss,
|
24
|
+
jti: `${_reactNativeUuid.default.v4()}`,
|
25
|
+
nonce: `${_reactNativeUuid.default.v4()}`,
|
26
|
+
cnf: {
|
27
|
+
jwk: (0, _jwk.fixBase64EncodingOnKey)(publicKey)
|
28
|
+
}
|
29
|
+
}).setProtectedHeader({
|
30
|
+
kid: publicKey.kid,
|
31
|
+
typ: "wiar+jwt"
|
32
|
+
}).setIssuedAt().setExpirationTime("1h").sign();
|
33
|
+
}
|
52
34
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
async
|
67
|
-
const signedAttestationRequest = await
|
35
|
+
/**
|
36
|
+
* Request a Wallet Instance Attestation (WIA) to the Wallet provider
|
37
|
+
*
|
38
|
+
* @param params.wiaCryptoContext The key pair associated with the WIA. Will be use to prove the ownership of the attestation.
|
39
|
+
* @param params.appFetch (optional) Http client
|
40
|
+
* @param walletProviderBaseUrl Base url for the Wallet Provider
|
41
|
+
* @returns The retrieved Wallet Instance Attestation token
|
42
|
+
*/
|
43
|
+
const getAttestation = _ref => {
|
44
|
+
let {
|
45
|
+
wiaCryptoContext,
|
46
|
+
appFetch = fetch
|
47
|
+
} = _ref;
|
48
|
+
return async walletProviderEntityConfiguration => {
|
49
|
+
const signedAttestationRequest = await getAttestationRequest(wiaCryptoContext, walletProviderEntityConfiguration);
|
68
50
|
const decodedRequest = (0, _ioReactNativeJwt.decode)(signedAttestationRequest);
|
69
51
|
const parsedRequest = _types.WalletInstanceAttestationRequestJwt.parse({
|
70
52
|
payload: decodedRequest.payload,
|
@@ -72,12 +54,12 @@ class Issuing {
|
|
72
54
|
});
|
73
55
|
const publicKey = parsedRequest.payload.cnf.jwk;
|
74
56
|
await (0, _ioReactNativeJwt.verify)(signedAttestationRequest, publicKey);
|
75
|
-
const tokenUrl =
|
57
|
+
const tokenUrl = walletProviderEntityConfiguration.payload.metadata.wallet_provider.token_endpoint;
|
76
58
|
const requestBody = {
|
77
59
|
grant_type: "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation",
|
78
60
|
assertion: signedAttestationRequest
|
79
61
|
};
|
80
|
-
const response = await
|
62
|
+
const response = await appFetch(tokenUrl, {
|
81
63
|
method: "POST",
|
82
64
|
headers: {
|
83
65
|
"Content-Type": "application/json"
|
@@ -88,7 +70,7 @@ class Issuing {
|
|
88
70
|
return await response.text();
|
89
71
|
}
|
90
72
|
throw new _errors.WalletInstanceAttestationIssuingError("Unable to obtain wallet instance attestation from wallet provider", `Response code: ${response.status}`);
|
91
|
-
}
|
92
|
-
}
|
93
|
-
exports.
|
73
|
+
};
|
74
|
+
};
|
75
|
+
exports.getAttestation = getAttestation;
|
94
76
|
//# sourceMappingURL=issuing.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_jwk","_types","_reactNativeUuid","_interopRequireDefault","_errors","obj","__esModule","default","
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_jwk","_types","_reactNativeUuid","_interopRequireDefault","_errors","obj","__esModule","default","getAttestationRequest","wiaCryptoContext","walletProviderEntityConfiguration","jwk","getPublicKey","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","SignJWT","setPayload","iss","aud","payload","jti","uuid","v4","nonce","cnf","fixBase64EncodingOnKey","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","signedAttestationRequest","decodedRequest","decodeJwt","parsedRequest","WalletInstanceAttestationRequestJwt","header","protectedHeader","verifyJwt","tokenUrl","metadata","wallet_provider","token_endpoint","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text","WalletInstanceAttestationIssuingError","exports"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAMA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAAwE,SAAAI,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGxE,eAAeG,qBAAqBA,CAClCC,gBAA+B,EAC/BC,iCAAoE,EACnD;EACjB,MAAMC,GAAG,GAAG,MAAMF,gBAAgB,CAACG,YAAY,CAAC,CAAC;EACjD,MAAMC,SAAS,GAAGC,QAAG,CAACC,KAAK,CAACJ,GAAG,CAAC;EAChC,MAAMK,aAAa,GAAG,MAAM,IAAAC,4BAAU,EAACJ,SAAS,CAAC;EACjD,MAAMK,SAAS,GAAG;IAAE,GAAGL,SAAS;IAAEM,GAAG,EAAEH;EAAc,CAAC;EAEtD,OAAO,IAAII,yBAAO,CAACX,gBAAgB,CAAC,CACjCY,UAAU,CAAC;IACVC,GAAG,EAAEN,aAAa;IAClBO,GAAG,EAAEb,iCAAiC,CAACc,OAAO,CAACF,GAAG;IAClDG,GAAG,EAAG,GAAEC,wBAAI,CAACC,EAAE,CAAC,CAAE,EAAC;IACnBC,KAAK,EAAG,GAAEF,wBAAI,CAACC,EAAE,CAAC,CAAE,EAAC;IACrBE,GAAG,EAAE;MACHlB,GA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AEF,IAAIG,QAAQ,CAACM,MAAM,KAAK,GAAG,EAAE;MAC3B,OAAO,MAAMN,QAAQ,CAACO,IAAI,CAAC,CAAC;IAC9B;IAEA,MAAM,IAAIC,6CAAqC,CAC7C,mEAAmE,EAClE,kBAAiBR,QAAQ,CAACM,MAAO,EACpC,CAAC;EACH,CAAC;AAAA;AAACG,OAAA,CAAA5B,cAAA,GAAAA,cAAA"}
|
package/lib/module/index.js
CHANGED
@@ -5,10 +5,8 @@ import * as PID from "./pid";
|
|
5
5
|
import * as RP from "./rp";
|
6
6
|
import * as Errors from "./utils/errors";
|
7
7
|
import * as WalletInstanceAttestation from "./wallet-instance-attestation";
|
8
|
-
import
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
|
12
|
-
import { EntityConfiguration, EntityStatement, TrustAnchorEntityConfiguration } from "./trust/types";
|
13
|
-
export { PID, RP, WalletInstanceAttestation, Errors, getUnsignedDPop, RelyingPartySolution, verifyTrustChain, getEntityConfiguration, EntityConfiguration, EntityStatement, RpEntityConfiguration, TrustAnchorEntityConfiguration };
|
8
|
+
import * as RelyingPartySolution from "./rp";
|
9
|
+
import { verifyTrustChain, getEntityConfiguration, getCredentialIssuerEntityConfiguration, getRelyingPartyEntityConfiguration, getTrustAnchorEntityConfiguration, getWalletProviderEntityConfiguration } from "./trust";
|
10
|
+
import { createCryptoContextFor } from "./utils/crypto";
|
11
|
+
export { PID, RP, WalletInstanceAttestation, Errors, RelyingPartySolution, verifyTrustChain, getEntityConfiguration, getCredentialIssuerEntityConfiguration, getRelyingPartyEntityConfiguration, getTrustAnchorEntityConfiguration, getWalletProviderEntityConfiguration, createCryptoContextFor };
|
14
12
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["PID","RP","Errors","WalletInstanceAttestation","
|
1
|
+
{"version":3,"names":["PID","RP","Errors","WalletInstanceAttestation","RelyingPartySolution","verifyTrustChain","getEntityConfiguration","getCredentialIssuerEntityConfiguration","getRelyingPartyEntityConfiguration","getTrustAnchorEntityConfiguration","getWalletProviderEntityConfiguration","createCryptoContextFor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKA,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,EAAE,MAAM,MAAM;AAC1B,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,oBAAoB,MAAM,MAAM;AAC5C,SACEC,gBAAgB,EAChBC,sBAAsB,EACtBC,sCAAsC,EACtCC,kCAAkC,EAClCC,iCAAiC,EACjCC,oCAAoC,QAC/B,SAAS;AAChB,SAASC,sBAAsB,QAAQ,gBAAgB;AAEvD,SACEX,GAAG,EACHC,EAAE,EACFE,yBAAyB,EACzBD,MAAM,EACNE,oBAAoB,EACpBC,gBAAgB,EAChBC,sBAAsB,EACtBC,sCAAsC,EACtCC,kCAAkC,EAClCC,iCAAiC,EACjCC,oCAAoC,EACpCC,sBAAsB"}
|
package/lib/module/pid/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["SdJwt","Issuing"],"sourceRoot":"../../../src","sources":["pid/index.ts"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,UAAU;AACjC,
|
1
|
+
{"version":3,"names":["SdJwt","Issuing"],"sourceRoot":"../../../src","sources":["pid/index.ts"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,UAAU;AACjC,OAAO,KAAKC,OAAO,MAAM,WAAW;AACpC,SAASD,KAAK,EAAEC,OAAO"}
|