Skip to content

Commit

Permalink
feat: verifiable credential poc
Browse files Browse the repository at this point in the history
  • Loading branch information
Harasz committed Mar 5, 2022
1 parent 824675f commit 9c45618
Show file tree
Hide file tree
Showing 26 changed files with 3,060 additions and 6,763 deletions.
19 changes: 19 additions & 0 deletions docs/api/classes/EkcSigner.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

**`EkcSigner`**

## Implements

- `TypedDataSigner`

## Table of contents

### Constructors
Expand All @@ -19,6 +23,7 @@

### Methods

- [\_signTypedData](EkcSigner.md#_signtypeddata)
- [connect](EkcSigner.md#connect)
- [getAddress](EkcSigner.md#getaddress)
- [signMessage](EkcSigner.md#signmessage)
Expand Down Expand Up @@ -59,6 +64,20 @@ Signer.provider

## Methods

### \_signTypedData

**_signTypedData**(): `Promise`<`string`\>

#### Returns

`Promise`<`string`\>

#### Implementation of

TypedDataSigner.\_signTypedData

___

### connect

**connect**(`provider`): `Signer`
Expand Down
40 changes: 36 additions & 4 deletions docs/api/classes/SignerService.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [address](SignerService.md#address)
- [chainId](SignerService.md#chainid)
- [did](SignerService.md#did)
- [didHex](SignerService.md#didhex)
- [isEthSigner](SignerService.md#isethsigner)
- [provider](SignerService.md#provider)
- [providerType](SignerService.md#providertype)
Expand All @@ -33,6 +34,7 @@
- [publicKeyAndIdentityToken](SignerService.md#publickeyandidentitytoken)
- [send](SignerService.md#send)
- [signMessage](SignerService.md#signmessage)
- [signTypedData](SignerService.md#signtypeddata)

## Constructors

Expand All @@ -44,7 +46,7 @@

| Name | Type |
| :------ | :------ |
| `_signer` | `Required`<`Signer`\> |
| `_signer` | `Required`<[`SignerT`](../modules.md#signert)\> |
| `_providerType` | [`ProviderType`](../enums/ProviderType.md) |

## Accessors
Expand Down Expand Up @@ -89,6 +91,16 @@ ___

___

### didHex

`get` **didHex**(): `string`

#### Returns

`string`

___

### isEthSigner

`get` **isEthSigner**(): `boolean`
Expand Down Expand Up @@ -121,11 +133,11 @@ ___

### signer

`get` **signer**(): `Required`<`Signer`\>
`get` **signer**(): `Required`<[`SignerT`](../modules.md#signert)\>

#### Returns

`Required`<`Signer`\>
`Required`<[`SignerT`](../modules.md#signert)\>

## Methods

Expand Down Expand Up @@ -188,7 +200,7 @@ ___

| Name | Type |
| :------ | :------ |
| `signer` | `Required`<`Signer`\> |
| `signer` | `Required`<[`SignerT`](../modules.md#signert)\> |
| `providerType` | [`ProviderType`](../enums/ProviderType.md) |

#### Returns
Expand Down Expand Up @@ -325,3 +337,23 @@ When running in browser `isEthSigner` variable should be stored in local storage
#### Returns

`Promise`<`string`\>

___

### signTypedData

**signTypedData**(`domain`, `types`, `message`): `Promise`<`string`\>

**`description`** Tries to create conformant signature (https://eips.ethereum.org/EIPS/eip-712)

#### Parameters

| Name | Type |
| :------ | :------ |
| `domain` | `TypedDataDomain` |
| `types` | `Record`<`string`, `TypedDataField`[]\> |
| `message` | `Record`<`string`, `unknown`\> |

#### Returns

`Promise`<`string`\>
87 changes: 87 additions & 0 deletions docs/api/classes/VerifiableCredentialsService.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Class: VerifiableCredentialsService

## Table of contents

### Constructors

- [constructor](VerifiableCredentialsService.md#constructor)

### Methods

- [signVerifiableCredential](VerifiableCredentialsService.md#signverifiablecredential)
- [verifyVerifiableCredential](VerifiableCredentialsService.md#verifyverifiablecredential)
- [create](VerifiableCredentialsService.md#create)

## Constructors

### constructor

**new VerifiableCredentialsService**(`_signerService`)

#### Parameters

| Name | Type |
| :------ | :------ |
| `_signerService` | [`SignerService`](SignerService.md) |

## Methods

### signVerifiableCredential

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

#### Type parameters

| Name |
| :------ |
| `T` |

#### Parameters

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

#### Returns

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

___

### verifyVerifiableCredential

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

#### Type parameters

| Name |
| :------ |
| `T` |

#### Parameters

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

#### Returns

`Promise`<`boolean`\>

___

### create

`Static` **create**(`signerService`): `Promise`<[`VerifiableCredentialsService`](VerifiableCredentialsService.md)\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `signerService` | [`SignerService`](SignerService.md) |

#### Returns

`Promise`<[`VerifiableCredentialsService`](VerifiableCredentialsService.md)\>
7 changes: 7 additions & 0 deletions docs/api/enums/ERROR_MESSAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- [PUBLISH\_NOT\_ISSUED\_CLAIM](ERROR_MESSAGES.md#publish_not_issued_claim)
- [ROLE\_NOT\_EXISTS](ERROR_MESSAGES.md#role_not_exists)
- [ROLE\_PREREQUISITES\_NOT\_MET](ERROR_MESSAGES.md#role_prerequisites_not_met)
- [SIGN\_TYPED\_DATA\_NOT\_SUPPORTED](ERROR_MESSAGES.md#sign_typed_data_not_supported)
- [STAKE\_WAS\_NOT\_PUT](ERROR_MESSAGES.md#stake_was_not_put)
- [TOKEN\_REQUIRED\_FOR\_OFF\_CHAIN\_REGISTRATION](ERROR_MESSAGES.md#token_required_for_off_chain_registration)
- [UNKNOWN\_PROVIDER](ERROR_MESSAGES.md#unknown_provider)
Expand Down Expand Up @@ -152,6 +153,12 @@ ___

___

### SIGN\_TYPED\_DATA\_NOT\_SUPPORTED

**SIGN\_TYPED\_DATA\_NOT\_SUPPORTED** = `"Sign typed data not supported"`

___

### STAKE\_WAS\_NOT\_PUT

**STAKE\_WAS\_NOT\_PUT** = `"Stake was not put"`
Expand Down
34 changes: 34 additions & 0 deletions docs/api/interfaces/Domain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Interface: Domain

## Table of contents

### Properties

- [chainId](Domain.md#chainid)
- [name](Domain.md#name)
- [verifyingContract](Domain.md#verifyingcontract)
- [version](Domain.md#version)

## Properties

### chainId

`Optional` **chainId**: `number`

___

### name

**name**: `string`

___

### verifyingContract

`Optional` **verifyingContract**: `string`

___

### version

`Optional` **version**: `number`
27 changes: 27 additions & 0 deletions docs/api/interfaces/SignVerifiableCredentialOptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Interface: SignVerifiableCredentialOptions

## Table of contents

### Properties

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

## Properties

### domain

`Optional` **domain**: `Partial`<[`Domain`](Domain.md)\>

___

### proofPurpose

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

___

### verificationMethod

`Optional` **verificationMethod**: `string`
Loading

0 comments on commit 9c45618

Please sign in to comment.