Skip to content

Commit

Permalink
Merge branch 'uncefact:next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
namhoang1604 authored Aug 16, 2023
2 parents 46b7fc2 + 5d1ed2e commit 41aaecf
Show file tree
Hide file tree
Showing 26 changed files with 305 additions and 530 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# project-vckit

A reference implementation of a verifiable credentials platform for digital trade and traceability. Please review this [verifiable credentials white paper](https://unece.org/sites/default/files/2022-07/WhitePaper_VerifiableCredentials-CBT.pdf) to undertsand the business context for this work.
A reference implementation of a verifiable credentials platform for digital trade and traceability. Please review this [verifiable credentials white paper](https://unece.org/sites/default/files/2022-07/WhitePaper_VerifiableCredentials-CBT.pdf) to understand the business context for this work.

# Purpose

VCs exemplify a decentralsied model for high integrity digital data excahnge. There is no central data hub. Instead there is a global ecosystem of thousands or millions of issuers, verifiers, and holders. A critical success factor is to reduce the cost of entry into the ecosystem so that it is cheap, fast, and simple for new issuers and verifiers to empower their communities with high integrity digital credentials. This project aims to provide free tools and guidance to facilitate uptake.
VCs exemplify a decentralized model for high integrity digital data exchange. There is no central data hub. Instead there is a global ecosystem of thousands or millions of issuers, verifiers, and holders. A critical success factor is to reduce the cost of entry into the ecosystem so that it is cheap, fast, and simple for new issuers and verifiers to empower their communities with high integrity digital credentials. This project aims to provide free tools and guidance to facilitate uptake.

# Audience

If you are an organisation that issues any kind of credential such as a permit, certificate, accreditation, license, or other "claim" of value to your community or constituency, then this project is for you. vckit provides the tools to equip your existing business systems with the ability to issue your existing credentials as high integrity, standards based, and interoperable VCs that your constituents (VC holders) can present to any party that needs to verify them.
If you are an organisation that issues any kind of credential such as a permit, certificate, accreditation, license, or other "claim" of value to your community or constituency, then this project is for you. VCkit provides the tools to equip your existing business systems with the ability to issue your existing credentials as high integrity, standards based, and interoperable VCs that your constituents (VC holders) can present to any party that needs to verify them.

VCs issued by vckit tooling can be verified using any mobile device camera to scan a QR code. This is important so that uptake can remain compatible with today's paper processes. There is no requirement for verifiers of credentials to adopt any new new technology in order to verify a credential. However, if you are an organisation that is likely to be verifying at scale or you wish to extract the digitial data in a credential for use in your business systems then vckit is also for you. It provides an advanced multi-protocol verification capability that can be integrated with your systems.
VCs issued by VCkit tooling can be verified using any mobile device camera to scan a QR code. This is important so that uptake can remain compatible with today's paper processes. There is no requirement for verifiers of credentials to adopt any new new technology in order to verify a credential. However, if you are an organisation that is likely to be verifying at scale or you wish to extract the digital data in a credential for use in your business systems then VCkit is also for you. It provides an advanced multi-protocol verification capability that can be integrated with your systems.

# Get Started

The vckit is built on top of the [Veramo](https://veramo.io/) agent framework. Veramo is a modular agent framework for creating self-sovereign identity (SSI) enabled applications. It is a great place to start if you are new to SSI. The vckit is a set of Veramo plugins that are configured to work together to provide a complete VC issuance and verification capability.

## Prerequisites

- [Node.js](https://nodejs.org/en/) version 16.x
- [pnpm](https://pnpm.io/) version 8.x
- [Node.js](https://nodejs.org/en/) version 18.x
- [pnpm](https://pnpm.io/) version 8.6.0

## Installation and Setup

```bash
# Install dependencies
pnpm install

# Initialize the agent configuration
pnpm vckit config

# Copy the .env.example file to .env for the demo explorer
cp packages/demo-explorer/.env.example packages/demo-explorer/.env

# Build
pnpm build

# Initialize the agent configuration
pnpm vckit config
```

The `pnpm vckit config` command will create a `agent.yml` file in the root of the project. This file contains the configuration for the Veramo agent. You can edit this file to configure the agent to your needs. The default configuration is sufficient to get started.
Expand Down
14 changes: 5 additions & 9 deletions packages/cli/default/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,12 @@ server:

# DID Documents
- - $require: '@vckit/remote-server?t=function#WebDidDocRouter'

- - $require: '@vckit/vc-api?t=function#HolderRouter'
- - $require: '@vckit/vc-api?t=function#IssuerRouter'
$args:
- createCredential: createVerifiableCredential
updateCredentialStatus: updateVerifiableCredentialStatus
- - $require: '@vckit/vc-api?t=function#VerifierRouter'
$args:
- verifyCredential: verifyCredential
verifyPresentation: verifyPresentation
- keyMapping:
Ed25519: JsonWebKey2020 # Ed25519VerificationKey2020 | JsonWebKey2020

# VC API
- - $require: '@vckit/vc-api?t=function#VCRouter'
# VC API docs path
- - /vc-api.json
- $require: '@vckit/vc-api?t=function#VCApiSchemaRouter'
Expand Down Expand Up @@ -366,6 +361,7 @@ credentialIssuerLD:
$args:
- suites:
- $require: '@veramo/credential-ld#VeramoEd25519Signature2018'
# - $require: '@veramo/credential-ld#VeramoEd25519Signature2020'
- $require: '@veramo/credential-ld#VeramoJsonWebSignature2020'
- $require: '@veramo/credential-ld#VeramoEcdsaSecp256k1RecoverySignature2020'
contextMaps:
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@veramo/did-resolver": "5.1.2",
"@veramo/key-manager": "5.1.2",
"@veramo/kms-local": "5.1.2",
"@veramo/remote-client": "5.2.1-next.5",
"@veramo/remote-client": "5.1.2",
"@veramo/message-handler": "5.1.2",
"@veramo/selective-disclosure": "5.1.2",
"@veramo/url-handler": "5.1.2",
Expand Down
59 changes: 17 additions & 42 deletions packages/credential-oa/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Credential OpenAttestation Plugin

- This plugin is used for issuing and verifying verifiable credential that adhere to OpenAttestation framework
- `uncefact/project-vckit` ’s goals is to support issuing and verifying verifiable credential in both W3C and OpenAtttestation framework right now , so this plugin is packed inside `uncefact/project-vckit` core but it can be plugged into any platform/library that using Veramo architecture.

## Usage

- Add this declaration to `agent.yml` config file
- Add the plugin to your `agent.yml` file

```
```yaml

///... other declarations
# Agent
Expand All @@ -17,44 +16,20 @@ agent:
- schemaValidation: false
plugins:
/// ... other declarations
**- $require: '@vckit/credential-oa#CredentialPlugin'**
- $require: '@vckit/credential-oa#CredentialOA'
```
- And export the functions of the plugin to be used in the application
```yaml
- createVerifiableCredentialOA
- verifyCredentialOA
```
- Use the CLI to quickly issue a credential
```bash
pnpm vckit credentialOA create
```

- **Signing**
- To streamline the signing process across signing process between w3c, OpenAttestation and other frameworks in mind , the plugin use private key that managed by Veramo’s keyManager to sign and associate with did document.
> **NOTE**: OpenAttestation document currently support 2 types of DID which is **did ethereum** and **did web**
- **Using uncefact/project-vckit CLI to create an OpenAttestation verifiable credential**
- **Prerequisites:** create a new did document if you haven’t create one \*\*\*\*
- `pnpm run vckit did create`
- Select **did:ether** or **did:web**
- If you select **did:web,** it’s your responsibility to put the verification information to standard endpoint so that verifier can resolve and verify your document
- **Note**: Every did document created has a key associated with it , to add a new key , run `pnpm run vckit did add-key`
```jsx
? Select identifier provider (Use arrow keys)
❯ did:ethr
```
### **Create OpenAttestation VC**
- Run: `pnpm run vckit credential create`
- Select `OpenAttestationMerkleProofSignature2018`
```jsx
? Credential proofFormat
jwt
lds
EthereumEip712Signature2021
❯ OpenAttestationMerkleProofSignature2018
```
- Select a did document you create earlier to identify issuer and sign document
```jsx
Issuer DID
❯ did:ethr:0x034bb92d2fffb6ff7ad8fbbefc01a919818017ef3f32c3e1443f44a45ab94f16bb
```
- Select identity proof type
- **Note**: `DNS-DID` and `DNS-TXT` require you to put the Issuer DID information to the domain specified in Identity Proof Type. Refer to [this](https://www.openattestation.com/docs/integrator-section/verifiable-document/ethereum/dns-proof) for more information. For the `DID` , verification process will skip checking for the issuer information
```jsx
? Identity Proof Type (Use arrow keys)
❯ DNS-DID
DNS-TXT
DID
```
### Verify **OpenAttestation VC**
- Simple run `pnpm run vckit verify -f vc-file.json` with the result from the create vc to verify the vc
> **Note**: The credential OA plugin only supports issuing by DID ethr. You can use the `@veramo/did-manager` plugin that should be configured in the `agent.yml` file to create a DID ethr.
1 change: 0 additions & 1 deletion packages/credential-oa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"@govtechsg/oa-verify": "^8.0.0",
"@govtechsg/open-attestation": "^6.6.0",
"@vckit/core-types": "^1.0.0-beta.5",
"@veramo/message-handler": "5.1.2",
"@veramo/utils": "5.2.0"
},
"devDependencies": {
Expand Down
44 changes: 22 additions & 22 deletions packages/demo-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"scripts": {
"dev": "craco start",
"build": "pnpm run build:explorer && pnpm run build:verifier",
"build": "pnpm run build:explorer",
"build:explorer": "craco build",
"build:verifier": "REACT_APP_MODE=verifier craco build",
"test": "craco test --watchAll=false",
Expand Down Expand Up @@ -71,7 +71,7 @@
"@vckit/example-documents": "workspace:^1.0.0-beta.4",
"@vckit/react-components": "workspace:^1.0.0-beta.5",
"@vckit/renderer": "workspace:^1.0.0-beta.5",
"@veramo/remote-client": "5.2.1-next.5",
"@veramo/remote-client": "5.1.2",
"ajv": "^8.12.0",
"commander": "^10.0.1",
"express": "^4.18.2",
Expand Down Expand Up @@ -131,26 +131,26 @@
"@types/uuid": "^9.0.1",
"@veramo-community/react-components": "^1.4.0",
"@veramo-community/veramo-react": "^1.0.82",
"@veramo/core": "5.2.1-next.5",
"@veramo/core-types": "5.2.1-next.5",
"@veramo/credential-eip712": "5.2.1-next.5",
"@veramo/credential-w3c": "5.2.1-next.5",
"@veramo/data-store": "5.2.1-next.5",
"@veramo/data-store-json": "5.2.1-next.5",
"@veramo/did-comm": "5.2.1-next.5",
"@veramo/did-discovery": "5.2.1-next.5",
"@veramo/did-jwt": "5.2.1-next.5",
"@veramo/did-manager": "5.2.1-next.5",
"@veramo/did-provider-ethr": "5.2.1-next.5",
"@veramo/did-provider-peer": "5.2.1-next.5",
"@veramo/did-resolver": "5.2.1-next.5",
"@veramo/key-manager": "5.2.1-next.5",
"@veramo/kms-local": "5.2.1-next.5",
"@veramo/kms-web3": "5.2.1-next.5",
"@veramo/message-handler": "5.2.1-next.5",
"@veramo/remote-client": "5.2.1-next.5",
"@veramo/selective-disclosure": "5.2.1-next.5",
"@veramo/utils": "5.2.1-next.5",
"@veramo/core": "5.2.0",
"@veramo/core-types": "5.1.2",
"@veramo/credential-eip712": "5.2.0",
"@veramo/credential-w3c": "5.2.0",
"@veramo/data-store": "5.2.0",
"@veramo/data-store-json": "5.2.0",
"@veramo/did-comm": "5.2.0",
"@veramo/did-discovery": "5.1.2",
"@veramo/did-jwt": "5.2.0",
"@veramo/did-manager": "5.1.2",
"@veramo/did-provider-ethr": "5.1.2",
"@veramo/did-provider-peer": "5.2.0",
"@veramo/did-resolver": "5.2.0",
"@veramo/key-manager": "5.1.2",
"@veramo/kms-local": "5.1.2",
"@veramo/kms-web3": "5.1.2",
"@veramo/message-handler": "5.1.2",
"@veramo/remote-client": "5.2.0",
"@veramo/selective-disclosure": "5.2.0",
"@veramo/utils": "5.2.0",
"@web3-react/core": "^8.2.0",
"@web3-react/metamask": "^8.2.1",
"@web3-react/types": "^8.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@vckit/core-types": "^1.0.0-beta.5",
"@veramo/core": "5.2.0",
"@veramo/remote-client": "5.2.1-next.5",
"@veramo/remote-client": "5.1.2",
"@veramo/credential-w3c": "5.2.0",
"@veramo/data-store": "5.2.0",
"@veramo/data-store-json": "5.2.0",
Expand Down
12 changes: 10 additions & 2 deletions packages/encrypted-storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The encrypted storage plugin provides a secure storage for the agent. It is used

To use the encrypted storage plugin, you need to add the following configuration to the agent.yml.

Fist, add the `dbConnectionEncrypted` to define the database connection for the encrypted storage.
- First, add the `dbConnectionEncrypted` to define the database connection for the encrypted storage.

```yaml
dbConnectionEncrypted:
Expand All @@ -17,7 +17,7 @@ dbConnectionEncrypted:
- type: sqlite
database:
$ref: /constants/databaseFile
synchronize: true
synchronize: false
migrationsRun: true
migrations:
$require: '@vckit/encrypted-storage?t=object#migrations'
Expand Down Expand Up @@ -50,6 +50,14 @@ agent:
- $ref: /encryptedStorage
```

Then, you need to expose the functions of the plugin.

```yaml
- encryptAndStoreData
- fetchEncryptedData
- fetchEncryptedDataByCredentialHash
```

After that, you need to configure the middleware to use the encrypted storage plugin to store the verifiable credentials when issue the verifiable credentials. You can configure the middleware in the `apiRoutes` section of the agent.yml.

```yaml
Expand Down
2 changes: 1 addition & 1 deletion packages/remote-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@transmute/ed25519-key-pair": "0.7.0-unstable.81",
"@vckit/core-types": "^1.0.0-beta.5",
"@veramo/remote-client": "5.2.1-next.5",
"@veramo/remote-client": "5.1.2",
"@veramo/utils": "5.2.0",
"debug": "^4.3.3",
"did-resolver": "^4.0.1",
Expand Down
Loading

0 comments on commit 41aaecf

Please sign in to comment.