-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added RariMe integration guide for issuers (#5)
* Added RariMe guide for issuers * proofread * fix typos * Updated index page
- Loading branch information
1 parent
34fd337
commit b05ed56
Showing
8 changed files
with
569 additions
and
0 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
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,71 @@ | ||
|
||
# How to serve Rarimo credentials to RariMe users | ||
|
||
:::tip | ||
If you still need to learn to issue Rarimo credentials, see [Setting Up A Credentials Issuer](/how-to-guides/setup-issuer). | ||
::: | ||
|
||
After issuing Rarimo credentials, you need to serve them to the users. To do that, we'll integrate RariMe snap into your DApp. | ||
|
||
|
||
## Step #1: Add the RariMe connector | ||
|
||
Install the RariMe connector package: | ||
|
||
```bash | ||
yarn add @rarimo/rarime-connector | ||
``` | ||
|
||
<!-- TODO: need to add tabs to the theme | ||
```bash npm2yarn | ||
npm install @rarimo/rarime-connector | ||
``` | ||
--> | ||
|
||
Create a connector instance: | ||
|
||
```js | ||
import { enableSnap } from '@rarimo/rarime-connector'; | ||
|
||
async function createConnector() { | ||
const snap = await enableSnap(); // connects to the snap or installs it | ||
const connector = await snap.getConnector(); | ||
|
||
return connector; | ||
} | ||
``` | ||
|
||
## Step #2: Prepare the claim offer | ||
|
||
To fetch the credential from the issuer, we need to form a claim offer: | ||
|
||
<!-- TODO: instruct how to get the claim schema--> | ||
|
||
```js | ||
// get the claim type from your schema | ||
const CLAIM_TYPE = "urn:uuid:6dff4518-5177-4f39-af58-9c156d9b6309"; | ||
const ISSUER_DOMAIN = "https://issuer.example.com"; | ||
|
||
const connector = await createConnector(); | ||
const {identityIdString} = await connector.createIdentity(); | ||
const {data: claimOffer} = await fetch( | ||
`https://${ISSUER_DOMAIN}/v1/credentials/${identityIdString}/${CLAIM_TYPE}` | ||
) | ||
.then(res => res.json()); | ||
``` | ||
|
||
## Step #3: Prompt user to save the credential to RariMe | ||
|
||
Once we have the claim offer, we can prompt the user to save the credential to RariMe. To do that, we'll use the `saveCredentials` method of the connector instance: | ||
|
||
```js | ||
await connector.saveCredentials(claimOffer); | ||
``` | ||
|
||
The user will be prompted to save the credential to RariMe: | ||
|
||
:::tip | ||
Keep the UX transparent: show the prompt only after the user explicitly clicks on the **Add credential** button or a similar UI element. | ||
::: | ||
|
||
![RariMe prompt](/img/rarime-add-credential.png) |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.