-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into bug/fix-dockerize
- Loading branch information
Showing
66 changed files
with
9,341 additions
and
5,590 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Build and Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- next | ||
|
||
jobs: | ||
test_and_build: | ||
runs-on: ubuntu-latest | ||
env: | ||
EXCLUDED_PACKAGE_OA_RENDERERS: '!./packages/vckit-oa-renderers/' | ||
EXCLUDED_PACKAGE_CREDENTIAL_OA: '!./packages/credential-oa/' | ||
EXCLUDED_PACKAGE_EXPLORER: '!./packages/demo-explorer/' | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Install pnpm | ||
run: npm i pnpm --global | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '21' | ||
|
||
- name: Install dependencies | ||
run: pnpm i --filter ${{ env.EXCLUDED_PACKAGE_OA_RENDERERS }} --filter ${{ env.EXCLUDED_PACKAGE_CREDENTIAL_OA }} --filter ${{ env.EXCLUDED_PACKAGE_EXPLORER }} --no-frozen-lockfile | ||
|
||
- name: Build | ||
run: pnpm build:agent | ||
|
||
- name: Run tests | ||
run: | | ||
pnpm test:packages --changedSince=origin/next --ci --json --coverage --testLocationInResults --outputFile=report.json | ||
- name: Coverage | ||
uses: artiomtr/jest-coverage-report-action@v2 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
coverage-file: report.json | ||
base-coverage-file: report.json | ||
threshold: 80 |
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,117 @@ | ||
# Bitstring Status List | ||
|
||
This plugin implement the bitstring status list https://w3c.github.io/vc-bitstring-status-list/ for Verifiable Credentials. It follows the Veramo plugin architecture. | ||
|
||
## Installation | ||
|
||
Add the plugin to your agent: | ||
|
||
- Configure the database for bitstring status list and the bitstring status list plugin | ||
|
||
```yaml | ||
dbConnectionBitstringStatusList: | ||
$require: typeorm#DataSource | ||
$args: | ||
- type: sqlite | ||
database: | ||
$ref: /constants/databaseFile | ||
synchronize: false | ||
migrationsRun: true | ||
migrations: | ||
$require: '@vckit/bitstringStatusList?t=object#migrations' | ||
logging: false | ||
entities: | ||
$require: '@vckit/bitstringStatusList?t=object#Entities' | ||
|
||
bitstringStatusList: | ||
$require: '@vckit/bitstringStatusList#BitstringStatusList' | ||
$args: | ||
- bitstringDomainURL: http://localhost:3332 | ||
dbConnection: | ||
$ref: /dbConnectionBitstringStatusList | ||
``` | ||
- Add the plugin to your agent | ||
```yaml | ||
agent: | ||
$require: '@veramo/core#Agent' | ||
$args: | ||
- schemaValidation: false | ||
plugins: | ||
... | ||
- $ref: /bitstringStatusList | ||
- $require: '@veramo/credential-status#CredentialStatusPlugin' | ||
$args: | ||
- BitstringStatusListEntry: | ||
$require: '@vckit/bitstringStatusList?t=object#checkStatus' | ||
``` | ||
- Add the plugin to the vckit server | ||
```yaml | ||
server: | ||
baseUrl: | ||
$ref: /constants/baseUrl | ||
port: | ||
$ref: /constants/port | ||
use: | ||
... | ||
- - /credentials/status/bitstring-status-list | ||
- $require: '@vckit/bitstringStatusList?t=function#bitstringStatusListRouter' | ||
``` | ||
- Add the methods to the vckit server | ||
```yaml | ||
constants: | ||
... | ||
methods: | ||
... | ||
- issueBitstringStatusList | ||
- checkBitstringStatus | ||
- setBitstringStatus | ||
``` | ||
## Usage | ||
### Request a bitstring status list | ||
```cURL | ||
curl -X POST "http://localhost:3332/agent/issueBitstringStatusList" \ | ||
-H "accept: application/json; charset=utf-8"\ | ||
-H "content-type: application/json" \ | ||
-d '{"statusPurpose":"revocation","bitstringStatusIssuer":"did:web:example.com"}' \ | ||
``` | ||
|
||
Response: | ||
|
||
```json | ||
{ | ||
"id": "http://localhost:3332/credentials/status/bitstring-status-list/1#0", | ||
"type": "BitstringStatusListEntry", | ||
"statusPurpose": "revocation", | ||
"statusListIndex": 0, | ||
"statusListCredential": "http://localhost:3332/credentials/status/bitstring-status-list/1" | ||
} | ||
``` | ||
|
||
### Check a bitstring status list | ||
|
||
**Note:** This API is exposed to developers to check the status of a credential. The correct usage is checking the status of a credential through the VC verifying of VCkit that will check the verifiable credential and the status of the credential. | ||
|
||
```cURL | ||
curl -X POST "http://localhost:3332/agent/checkBitstringStatus" \ | ||
-H "accept: application/json; charset=utf-8"\ | ||
-H "content-type: application/json" \ | ||
-d '{"verifiableCredential":{"issuanceDate":"2024-04-17T10:25:11.124Z","@context":["https://www.w3.org/2018/credentials/v1","https://www.w3.org/2018/credentials/examples/v1","https://w3id.org/security/suites/jws-2020/v1"],"type":["VerifiableCredential","UniversityDegreeCredential"],"credentialSubject":{"id":"did:example:ebfeb1f712ebc6f1c276e12ec21","name":"Jane Smith","degree":{"type":"BachelorDegree","name":"Bachelor of Science and Arts","degreeSchool":"Example University"}},"@type":"WebRenderingTemplate2022"}],"issuer":{"id":"did:web:example.com"},"credentialStatus":{"id":"http://localhost:3332/credentials/status/bitstring-status-list/1#0","type":"BitstringStatusListEntry","statusPurpose":"revocation","statusListIndex":0,"statusListCredential":"http://localhost:3332/credentials/status/bitstring-status-list/1"},"proof":{"type":"JsonWebSignature2020","created":"2024-04-19T03:30:07Z","verificationMethod":"did:web:example.com#e9bc8c0d327897fc70f6d9dea05d1e103b7eca429deba83fc34c2cfde0e81c8f-key-0","proofPurpose":"assertionMethod","jws":"eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..xY0syWgvQda7xiVlq2sC_pEl-eBFXvKzzHjt_9YE3Ek5bAWzGyXw2S60B2kVAQDT9JqAd7AUwRpNCt5LSa12AQ"}}}' \ | ||
``` | ||
|
||
### Set status for a bitstring status list | ||
|
||
```cURL | ||
curl -X POST "http://localhost:3332/agent/setBitstringStatus" \ | ||
-H "accept: application/json; charset=utf-8"\ | ||
-H "content-type: application/json" \ | ||
-d '{"statusListCredential":"http://localhost:3332/credentials/status/bitstring-status-list/1","statusListVCIssuer":"did:web:example.com","statusPurpose":"revocation","index":0,"status":true}' \ | ||
``` |
Oops, something went wrong.