-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8467ebf
commit 71899a3
Showing
27 changed files
with
742 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Platform and Environment | ||
|
||
[Credo](https://github.com/openwallet-foundation/credo-ts) is developed to support a [Node.JS](https://nodejs.org) and [React Native](https://reactnative.dev) environment. With this it is entirely possible to build an entire SSI ecosystem with Credo. This would use Node.JS as an issuer as a verifier, and uses React Native as a holder. | ||
[Credo](https://github.com/openwallet-foundation/credo-ts) is developed to support a [Node.js](https://nodejs.org) and [React Native](https://reactnative.dev) environment. With this it is entirely possible to build an entire SSI ecosystem with Credo. This would use Node.js as an issuer as a verifier, and uses React Native as a holder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# OpenID for Verifiable Credentials | ||
|
||
The OpenID4VC module provides support for the [OpenID for Verifiable Credentials group of protocols](https://openid.net/sg/openid4vc/) defined under the OpenID Foundation. Currently this includes the [OpenID for Verifiable Credential Issuance](https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html), [Self-Issued OpenID Provider v2](https://openid.net/specs/openid-connect-self-issued-v2-1_0.html), and [OpenID for Verifiable Presentations](https://openid.net/specs/openid-4-verifiable-presentations-1_0.html). | ||
|
||
For the current supported versions for any of the OpenID4VC protocols, please refer to the [OpenID4VC Feature](../../features/openid4vc.md) page. | ||
|
||
The OpenID4VC Module in Credo currently exposes three modules, one for each role in the triangle trust: `OpenId4VcIssuerModule`, `OpenId4VcHolderModule`, and `OpenId4VcVerifierModule`. The issuer and verifier modules are expected to run in a cloud environment, as they require several endpoints to be exposed to the public internet. The holder module can run in a cloud environment or on a mobile device. | ||
|
||
### Installing OpenID4VC Module | ||
|
||
When using Credo with OpenID4VC you need to install the `@credo-ts/openid4vc` module: | ||
|
||
```console | ||
yarn add @credo-ts/[email protected] | ||
``` | ||
|
||
### Adding OpenID4VC Modules to the Agent | ||
|
||
After installing the dependencies, we can register the the different modules on the agent. | ||
|
||
#### Issuer and Verifier | ||
|
||
If you want to issue or verify credentials using OpenID for Verifiable Credentials, you can add the `OpenId4VcIssuerModule` and the `OpenId4VcVerifierModule`. These modules can only run on the server, in Node.js and don't work in a React Native environment. These modules can be added separately, it's not required to use both modules. The set up for the issuer and verifier module can be combined with the set up for the holder module below to support issuance, holding, and verification OpenID4VC flows within the same agent. | ||
|
||
In the example we haven't implemented the `credentialRequestToCredentialMapper` method for the issuer module yet, this is covered in the [OpenID4VC Guides](/guides/tutorials/openid4vc). | ||
|
||
```typescript showLineNumbers set-up-openid4vc-issuer-verifier.ts section-1 | ||
|
||
``` | ||
|
||
### Holder | ||
|
||
If you want to receive and present credentials using OpenID for Verifiable Credentials, you can add the `OpenId4VcHolderModule`. This module can run in both Node.js and React Native. | ||
|
||
```typescript showLineNumbers set-up-openid4vc-holder.ts section-1 | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import DocCardList from '@theme/DocCardList'; | ||
|
||
# OpenID for Verifiable Credentials Tutorials | ||
|
||
This section covers all tutorials related to the OpenID for Verifiable Credentials module in Credo. Before you start, make sure you have configured the required OpenID4VC modules on your agent according to the [OpenID4VC Setup Guide](/guides/getting-started/set-up/openid4vc.md) | ||
|
||
<DocCardList /> |
39 changes: 39 additions & 0 deletions
39
guides/tutorials/openid4vc/issuing-credentials-using-openid4vc-issuer-module.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Issuing Credentials using the OpenID4VC Issuer Module | ||
|
||
This tutorial will guide you through the process of issuing credentials using the OpenID4VC Issuer Module. Before starting this tutorial, make sure you have completed the [OpenID4VC Issuer Module Setup](/guides/getting-started/set-up/openid4vc.md). | ||
|
||
This guides only covers the issuance of credentials using the OpenID4VC Issuer Module. Follow the [Receiving and Proving Credentials using the OpenID4VC Holder Module](/guides/tutorials/openid4vc/receiving-and-proving-credentials-using-openid4vc-holder-module.md) guide to learn how to receive and prove credentials using the OpenID4VC Holder Module. | ||
|
||
## Creating the issuer | ||
|
||
Once you have set-up your agent (under `issuer` variable), we first need to configure your issuer and the credentials you want to issue. | ||
|
||
```typescript showLineNumbers sd-jwt-vc-openid4vc.ts section-2 | ||
|
||
``` | ||
|
||
If you want to update the display metadata or the credentials supported by the issuer, you can use the `issuer.modules.openId4VcIssuer.updateIssuer` method. | ||
|
||
## Creating a credential offer | ||
|
||
Once you have configured the issuer, you can create a credential offer. The credential offer method will generate a credential offer URI that you can share with a holder. | ||
|
||
```typescript showLineNumbers sd-jwt-vc-openid4vc.ts section-3 | ||
|
||
``` | ||
|
||
We have also added an event listener that listens for state changed events, this allows us to know when the issuance session is done. | ||
|
||
## Implementing the credential mapper | ||
|
||
The OpenID4VC Issuer Module setup didn't cover the implementation of the `credentialRequestToCredentialMapper` yet. When you create a credential offer with the OpenID4VC Issuer Module in Credo, you don't have to provide the credential data directly. | ||
|
||
Instead, you provide a `credentialRequestToCredentialMapper` function in the agent configuration, that will be called when the holder requests the credential. | ||
|
||
This allows you to dynamically generate the credential data based on the holder's request, and means you also don't have to store any credential data in the agent. | ||
|
||
Below is an example `credentialRequestToCredentialMapper` function that generates a credential based on the holder's request. Make sure to register this function in the agent configuration `modules.openId4VcIssuer.endpoints.credential.credentialsRequestToCredentialMapper`. | ||
|
||
```typescript showLineNumbers sd-jwt-vc-openid4vc.ts section-4 | ||
|
||
``` |
Oops, something went wrong.