You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(openid4vc): oid4vci authorization code flow, presentation during issuance and batch issuance.
6
+
7
+
This is a big change to OpenID4VCI in Credo, with the neccsary breaking changes since we first added it to the framework. Over time the spec has changed significantly, but also our understanding of the standards and protocols.
8
+
9
+
**Authorization Code Flow**
10
+
Credo now supports the authorization code flow, for both issuer and holder. An issuer can configure multiple authorization servers, and work with external authorization servers as well. The integration is based on OAuth2, with several extension specifications, mainly the OAuth2 JWT Access Token Profile, as well as Token Introspection (for opaque access tokens). Verification works out of the box, as longs as the authorization server has a `jwks_uri` configured. For Token Introspection it's also required to provide a `clientId` and `clientSecret` in the authorization server config.
11
+
12
+
To use an external authorization server, the authorization server MUST include the `issuer_state` parameter from the credential offer in the access token. Otherwise it's not possible for Credo to correlate the authorization session to the offer session.
13
+
14
+
The demo-openid contains an example with external authorization server, which can be used as reference. The Credo authorization server supports DPoP and PKCE.
15
+
16
+
**Batch Issuance**
17
+
The credential request to credential mapper has been updated to support multiple proofs, and also multiple credential instances. The client can now also handle batch issuance.
18
+
19
+
**Presentation During Issuance**
20
+
The presenation during issuance allows to request presentation using OID4VP before granting authorization for issuance of one or more credentials. This flow is automatically handled by the `resolveAuthorizationRequest` method on the oid4vci holder service.
Open three different terminals next to each other and in both, go to the demo folder:
33
+
Open four different terminals next to each other and in each, go to the demo folder:
33
34
34
35
```sh
35
36
cd credo-ts/demo-openid
@@ -41,13 +42,19 @@ Install the project in one of the terminals:
41
42
pnpm install
42
43
```
43
44
44
-
In the first terminal run the Issuer:
45
+
In the first terminal run the OpenID Provider:
46
+
47
+
```sh
48
+
pnpm provider
49
+
```
50
+
51
+
In the second terminal run the Issuer:
45
52
46
53
```sh
47
54
pnpm issuer
48
55
```
49
56
50
-
In the second terminal run the Holder:
57
+
In the third terminal run the Holder:
51
58
52
59
```sh
53
60
pnpm holder
@@ -65,7 +72,8 @@ To create a credential offer:
65
72
66
73
- Go to the Issuer terminal.
67
74
- Select `Create a credential offer`.
68
-
- Select `UniversityDegreeCredential`.
75
+
- Choose whether authorization is required
76
+
- Select the credential(s) you want to issue.
69
77
- Now copy the content INSIDE the quotes (without the quotes).
70
78
71
79
To resolve and accept the credential:
@@ -74,6 +82,8 @@ To resolve and accept the credential:
74
82
- Select `Resolve a credential offer`.
75
83
- Paste the content copied from the credential offer and hit enter.
76
84
- Select `Accept the credential offer`.
85
+
- Choose which credential(s) to accept
86
+
- If authorization is required a link will be printed in the terminal, open this in your browser. You can sign in using any username and password. Once authenticated return to the terminal
77
87
- You have now stored your credential.
78
88
79
89
To create a presentation request:
@@ -99,3 +109,29 @@ Exit:
99
109
Restart:
100
110
101
111
- Select 'restart', to shutdown the current program and start a new one
112
+
113
+
### Optional Proxy
114
+
115
+
By default all services will be started on `localhost`, and thus won't be reachable by other external services (such as a mobile wallet). If you want to expose the required services to the public, you need to expose multiple ngrok tunnels.
116
+
117
+
We can setup the tunnels automatically using ngrok. First make sure you have an ngrok account and get your access token from this page: https://dashboard.ngrok.com/get-started/setup/
118
+
119
+
Then copy the `ngrok.auth.example.yml` file to `ngrok.auth.yml`:
120
+
121
+
```sh
122
+
cp ngrok.auth.example.yml ngrok.auth.yml
123
+
```
124
+
125
+
And finally set the `authtoken` to the auth token as displayed in the ngrok dashboard.
126
+
127
+
Once set up, you can run the following command in a separate terminal window.
128
+
129
+
```sh
130
+
pnpm proxies
131
+
```
132
+
133
+
This will open three proxies. You should then run your demo environments with these proxies:
134
+
135
+
-`PROVIDER_HOST=https://d404-123-123-123-123.ngrok-free.app ISSUER_HOST=https://d738-123-123-123-123.ngrok-free.app pnpm provider` (ngrok url for port 3042)
136
+
-`PROVIDER_HOST=https://d404-123-123-123-123.ngrok-free.app ISSUER_HOST=https://d738-123-123-123-123.ngrok-free.app pnpm issuer` (ngrok url for port 2000)
137
+
-`VERIFIER_HOST=https://1d91-123-123-123-123.ngrok-free.app pnpm verifier` (ngrok url for port 4000)
0 commit comments