Skip to content

Commit

Permalink
adding full vc and vp impl
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro-neal committed Aug 25, 2023
1 parent ffa0989 commit 416f551
Show file tree
Hide file tree
Showing 8 changed files with 580 additions and 119 deletions.
119 changes: 117 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"clean": "npx npkill -d $(pwd) -t node_modules && npx npkill -d $(pwd)/packages -t dist",
"build": "npm run build --ws"
},
"private": true
"private": true,
"dependencies": {
"did-resolver": "^4.1.0"
}
}
41 changes: 41 additions & 0 deletions packages/credentials/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## Credentials


### VC Creation and Verification

The `VC` class provides methods for the creation, handling, and signing of Verifiable Credentials (VCs) in JWT format.

- **VC.createVerifiableCredentialJwt**: Creates a Verifiable Credential (VC) in JWT format.
- **VC.decodeVerifiableCredentialJwt**: Decodes a VC JWT into its constituent parts: header, payload, and signature.
- **VC.verifyVerifiableCredentialJwt**: Verifies the integrity of a VC JWT.
- **VC.validateVerifiableCredentialPayload**: Validates the structure and integrity of a Verifiable Credential payload.

### VP Creation and Verification

The `VP` class provides utility methods for creation and handling Verifiable Presentations (VPs) in JWT format.

- **VP.createVerifiablePresentationJwt**: Creates a Verifiable Presentation (VP) in JWT format from a presentation definition and set of credentials.
- **VP.decodeVerifiablePresentationJwt**: Decodes a VP JWT into its constituent parts: header, payload, and signature.
- **VP.verifyVerifiablePresentationJwt**: Verifies the integrity of a VP JWT.
- **VP.validateVerifiablePresentationPayload**: Validates the structure and integrity of a Verifiable Presentation payload.

### Presentation Exchange Helpers

These methods assist in evaluating verifiable credentials and presentations against specified presentation definitions.

- **VC.evaluateCredentials**: Evaluates a set of verifiable credentials against a specified presentation definition.
- **VP.evaluatePresentation**: Evaluates a given Verifiable Presentation against a specified presentation definition.

### Verifiable Credentials and Presentations Library
Note: you do not have to use the functions to create SSI objects, you can instead create them yourselves with the boilerplate types in types.ts

### Signer Options Object

The `Signer` represents a function that takes a byte array as input and returns a promise that resolves to a byte array, representing the signature of the input data.

### Type Definition

```typescript
type Signer = (data: Uint8Array) => Promise<Uint8Array>;
```

1 change: 1 addition & 0 deletions packages/credentials/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
},
"dependencies": {
"@sphereon/pex": "2.1.0",
"did-jwt": "^7.2.6",
"uuid": "^9.0.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 416f551

Please sign in to comment.