Skip to content

Commit

Permalink
feat: verifiable presentation poc
Browse files Browse the repository at this point in the history
  • Loading branch information
Harasz committed Apr 8, 2022
1 parent a7f8df7 commit a4732e3
Show file tree
Hide file tree
Showing 34 changed files with 1,605 additions and 766 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/deploy.yml
Expand Up @@ -2,13 +2,12 @@ name: Deploy

on:
push:
branches: ["develop", "master"]
branches: ['develop', 'master']
pull_request:
branches: ["develop", "master"]

jobs:
cancel-previous:
name: "Cancel Previous Runs"
name: 'Cancel Previous Runs'
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
Expand All @@ -26,7 +25,7 @@ jobs:
token: ${{ secrets.SECRET_NAME }}
- uses: actions/setup-node@v2-beta
with:
node-version: "16.10.0"
node-version: '16.10.0'
registry-url: https://registry.npmjs.org/

- name: Configure Git
Expand Down
2 changes: 2 additions & 0 deletions docs/api/README.md
Expand Up @@ -58,6 +58,8 @@ Prerelease version
npm i iam-client-lib@canary
```

Some library dependencies require Node.js built-ins. Therefore when library is used in browser make sure they are polyfilled. If application is bundled with Webpack dependencies can be polyfilled with [node-polyfill-webpack-plugin](https://www.npmjs.com/package/node-polyfill-webpack-plugin)

### Initialization

Because of dependencies between modules they should be initialized in right order. This is achieved by accessing module initializer from initialization function of required module.
Expand Down
4 changes: 2 additions & 2 deletions docs/api/classes/DomainsService.md
Expand Up @@ -80,7 +80,7 @@ ___

### changeOrgOwnership

**changeOrgOwnership**(`__namedParameters`): `Promise`<`undefined` \| { `info`: `string` ; `tx`: `EncodedCall` ; `next`: (`__namedParameters?`: { `retryCheck?`: `boolean` }) => `Promise`<`undefined` \| `TransactionReceipt`\> }[]\>
**changeOrgOwnership**(`__namedParameters`): `Promise`<`undefined` \| [`MulticallTx`](../modules.md#multicalltx)\>

changeOrgOwnership

Expand All @@ -98,7 +98,7 @@ changeOrgOwnership

#### Returns

`Promise`<`undefined` \| { `info`: `string` ; `tx`: `EncodedCall` ; `next`: (`__namedParameters?`: { `retryCheck?`: `boolean` }) => `Promise`<`undefined` \| `TransactionReceipt`\> }[]\>
`Promise`<`undefined` \| [`MulticallTx`](../modules.md#multicalltx)\>

return array of steps needed to change ownership

Expand Down
105 changes: 32 additions & 73 deletions docs/api/classes/VerifiableCredentialsServiceBase.md
Expand Up @@ -6,16 +6,12 @@

- [constructor](VerifiableCredentialsServiceBase.md#constructor)

### Properties

- [completeIssueCredential](VerifiableCredentialsServiceBase.md#completeissuecredential)
- [prepareIssueCredential](VerifiableCredentialsServiceBase.md#prepareissuecredential)
- [verifyCredential](VerifiableCredentialsServiceBase.md#verifycredential)

### Methods

- [signVerifiableCredential](VerifiableCredentialsServiceBase.md#signverifiablecredential)
- [verifyVerifiableCredential](VerifiableCredentialsServiceBase.md#verifyverifiablecredential)
- [createPresentation](VerifiableCredentialsServiceBase.md#createpresentation)
- [createRoleVC](VerifiableCredentialsServiceBase.md#createrolevc)
- [createVerifiablePresentation](VerifiableCredentialsServiceBase.md#createverifiablepresentation)
- [verify](VerifiableCredentialsServiceBase.md#verify)
- [create](VerifiableCredentialsServiceBase.md#create)

## Constructors
Expand All @@ -30,116 +26,79 @@
| :------ | :------ |
| `_signerService` | [`SignerService`](SignerService.md) |

## Properties

### completeIssueCredential

`Abstract` **completeIssueCredential**: (`credential`: `string`, `preparation`: `string`, `signature`: `string`) => `Promise`<`string`\>
## Methods

#### Type declaration
### createPresentation

(`credential`, `preparation`, `signature`): `Promise`<`string`\>
**createPresentation**(`verifiableCredential`, `options?`): `Presentation`

##### Parameters
#### Parameters

| Name | Type |
| :------ | :------ |
| `credential` | `string` |
| `preparation` | `string` |
| `signature` | `string` |
| `verifiableCredential` | `VerifiableCredential`<[`RoleCredentialSubject`](../interfaces/RoleCredentialSubject.md)\>[] |
| `options?` | [`CreatePresentationParams`](../interfaces/CreatePresentationParams.md) |

##### Returns
#### Returns

`Promise`<`string`\>
`Presentation`

___

### prepareIssueCredential
### createRoleVC

`Abstract` **prepareIssueCredential**: (`credential`: `string`, `linked_data_proof_options`: `string`, `public_key`: `string`) => `Promise`<`string`\>
**createRoleVC**(`credentialParams`, `proofOptions?`): `Promise`<`VerifiableCredential`<[`RoleCredentialSubject`](../interfaces/RoleCredentialSubject.md)\>\>

#### Type declaration

▸ (`credential`, `linked_data_proof_options`, `public_key`): `Promise`<`string`\>

##### Parameters
#### Parameters

| Name | Type |
| :------ | :------ |
| `credential` | `string` |
| `linked_data_proof_options` | `string` |
| `public_key` | `string` |
| `credentialParams` | [`RoleCredentialSubjectParams`](../interfaces/RoleCredentialSubjectParams.md) |
| `proofOptions?` | [`ProofOptions`](../interfaces/ProofOptions.md) |

##### Returns
#### Returns

`Promise`<`string`\>
`Promise`<`VerifiableCredential`<[`RoleCredentialSubject`](../interfaces/RoleCredentialSubject.md)\>\>

___

### verifyCredential

`Abstract` **verifyCredential**: (`vc`: `string`, `proof_options`: `string`) => `Promise`<`string`\>

#### Type declaration

▸ (`vc`, `proof_options`): `Promise`<`string`\>
### createVerifiablePresentation

##### Parameters

| Name | Type |
| :------ | :------ |
| `vc` | `string` |
| `proof_options` | `string` |

##### Returns

`Promise`<`string`\>

## Methods

### signVerifiableCredential

**signVerifiableCredential**<`T`\>(`credential`, `options?`): `Promise`<[`SignedVerifiableCredential`](../interfaces/SignedVerifiableCredential.md)<`T`\>\>

#### Type parameters

| Name |
| :------ |
| `T` |
**createVerifiablePresentation**(`verifiableCredential`, `options?`): `Promise`<`VerifiablePresentation`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `credential` | [`VerifiableCredential`](../interfaces/VerifiableCredential.md)<`T`\> |
| `options?` | [`SignVerifiableCredentialOptions`](../interfaces/SignVerifiableCredentialOptions.md) |
| `verifiableCredential` | `VerifiableCredential`<[`RoleCredentialSubject`](../interfaces/RoleCredentialSubject.md)\>[] |
| `options?` | [`ProofOptions`](../interfaces/ProofOptions.md) |

#### Returns

`Promise`<[`SignedVerifiableCredential`](../interfaces/SignedVerifiableCredential.md)<`T`\>\>
`Promise`<`VerifiablePresentation`\>

___

### verifyVerifiableCredential
### verify

**verifyVerifiableCredential**<`T`\>(`vc`, `options?`): `Promise`<`boolean`\>
**verify**<`T`\>(`vp`, `options?`): `any`

#### Type parameters

| Name |
| :------ |
| `T` |
| Name | Type |
| :------ | :------ |
| `T` | extends `ICredentialSubject` |

#### Parameters

| Name | Type |
| :------ | :------ |
| `vc` | [`SignedVerifiableCredential`](../interfaces/SignedVerifiableCredential.md)<`T`\> |
| `options?` | [`VerifyVerifiableCredentialOptions`](../interfaces/VerifyVerifiableCredentialOptions.md) |
| `vp` | `VerifiablePresentation` \| `VerifiableCredential`<`T`\> |
| `options?` | [`ProofOptions`](../interfaces/ProofOptions.md) |

#### Returns

`Promise`<`boolean`\>
`any`

___

Expand Down
13 changes: 13 additions & 0 deletions docs/api/interfaces/CreatePresentationParams.md
@@ -0,0 +1,13 @@
# Interface: CreatePresentationParams

## Table of contents

### Properties

- [presentationDefinition](CreatePresentationParams.md#presentationdefinition)

## Properties

### presentationDefinition

`Optional` **presentationDefinition**: `IPresentationDefinition`
20 changes: 20 additions & 0 deletions docs/api/interfaces/IssuerFields.md
@@ -0,0 +1,20 @@
# Interface: IssuerFields

## Table of contents

### Properties

- [key](IssuerFields.md#key)
- [value](IssuerFields.md#value)

## Properties

### key

**key**: `string`

___

### value

**value**: `string` \| `number`
20 changes: 20 additions & 0 deletions docs/api/interfaces/ProofOptions.md
@@ -0,0 +1,20 @@
# Interface: ProofOptions

## Table of contents

### Properties

- [proofPurpose](ProofOptions.md#proofpurpose)
- [verificationMethod](ProofOptions.md#verificationmethod)

## Properties

### proofPurpose

`Optional` **proofPurpose**: `string`

___

### verificationMethod

`Optional` **verificationMethod**: `string`
44 changes: 44 additions & 0 deletions docs/api/interfaces/RoleCredentialSubject.md
@@ -0,0 +1,44 @@
# Interface: RoleCredentialSubject

## Hierarchy

- `CredentialSubject`

**`RoleCredentialSubject`**

## Table of contents

### Properties

- [id](RoleCredentialSubject.md#id)
- [issuerFields](RoleCredentialSubject.md#issuerfields)
- [role](RoleCredentialSubject.md#role)

## Properties

### id

**id**: `string`

#### Overrides

CredentialSubject.id

___

### issuerFields

**issuerFields**: [`IssuerFields`](IssuerFields.md)[]

___

### role

**role**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `namespace` | `string` |
| `version` | `string` |
34 changes: 34 additions & 0 deletions docs/api/interfaces/RoleCredentialSubjectParams.md
@@ -0,0 +1,34 @@
# Interface: RoleCredentialSubjectParams

## Table of contents

### Properties

- [id](RoleCredentialSubjectParams.md#id)
- [issuerFields](RoleCredentialSubjectParams.md#issuerfields)
- [namespace](RoleCredentialSubjectParams.md#namespace)
- [version](RoleCredentialSubjectParams.md#version)

## Properties

### id

**id**: `string`

___

### issuerFields

`Optional` **issuerFields**: [`IssuerFields`](IssuerFields.md)[]

___

### namespace

**namespace**: `string`

___

### version

**version**: `string`
27 changes: 0 additions & 27 deletions docs/api/interfaces/SignVerifiableCredentialOptions.md

This file was deleted.

0 comments on commit a4732e3

Please sign in to comment.