Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug/SWTCH-1091] Adds build:api_docs to deploy process #52

Merged
merged 4 commits into from
Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ install:
script:
- npm run build
- npm run test


deploy:
- provider: script
Expand Down
126 changes: 9 additions & 117 deletions docs/api/README.md
Original file line number Diff line number Diff line change
@@ -1,121 +1,13 @@
**[passport-did-auth](README.md)**

> Globals

# passport-did-auth

## Index

### Classes

* [AuthTokenVerifier](classes/authtokenverifier.md)
* [BaseStrategy](classes/basestrategy.md)
* [CacheServerClient](classes/cacheserverclient.md)
* [ClaimVerifier](classes/claimverifier.md)
* [LoginStrategy](classes/loginstrategy.md)

### Interfaces

* [Claim](interfaces/claim.md)
* [DecodedToken](interfaces/decodedtoken.md)
* [IRole](interfaces/irole.md)
* [IRoleDefinition](interfaces/iroledefinition.md)
* [ITokenPayload](interfaces/itokenpayload.md)
* [LoginStrategyOptions](interfaces/loginstrategyoptions.md)
* [StrategyOptions](interfaces/strategyoptions.md)

### Variables

* [abi1056](README.md#abi1056)
* [sha3](README.md#sha3)

### Functions

* [decodeLabelhash](README.md#decodelabelhash)
* [isEncodedLabelhash](README.md#isencodedlabelhash)
* [labelhash](README.md#labelhash)
* [lookup](README.md#lookup)
* [namehash](README.md#namehash)

## Variables

### abi1056

• **abi1056**: ({ anonymous?: undefined ; constant: boolean ; inputs: { name: string ; type: string }[] ; name: string ; outputs: { name: string ; type: string }[] ; payable: boolean ; stateMutability: string ; type: string } \| { anonymous: boolean ; constant?: undefined ; inputs: { indexed: boolean ; name: string ; type: string }[] ; name: string ; outputs?: undefined ; payable?: undefined ; stateMutability?: undefined ; type: string })[]

___

### sha3

• `Const` **sha3**: any = require('js-sha3').keccak\_256

## Functions

### decodeLabelhash

▸ **decodeLabelhash**(`hash`: string): string

#### Parameters:

Name | Type |
------ | ------ |
`hash` | string |

**Returns:** string

___

### isEncodedLabelhash

▸ **isEncodedLabelhash**(`hash`: string): boolean

#### Parameters:

Name | Type |
------ | ------ |
`hash` | string |

**Returns:** boolean

___

### labelhash

▸ **labelhash**(`unnormalizedLabelOrLabelhash`: string): string

#### Parameters:

Name | Type |
------ | ------ |
`unnormalizedLabelOrLabelhash` | string |

**Returns:** string

___

### lookup

▸ **lookup**(`obj`: {}, `field`: string): string \| null

#### Parameters:

Name | Type |
------ | ------ |
`obj` | {} |
`field` | string |

**Returns:** string \| null

___

### namehash

▸ **namehash**(`inputName`: string): string

#### Parameters:
## Table of contents

Name | Type |
------ | ------ |
`inputName` | string |
### Modules

**Returns:** string
- [AuthTokenVerifier](modules/authtokenverifier.md)
- [BaseStrategy](modules/basestrategy.md)
- [ClaimVerifier](modules/claimverifier.md)
- [LoginStrategy](modules/loginstrategy.md)
- [LoginStrategy.types](modules/loginstrategy_types.md)
- [cacheServerClient](modules/cacheserverclient.md)
- [utils](modules/utils.md)
47 changes: 47 additions & 0 deletions docs/api/classes/authtokenverifier.authtokenverifier-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Class: AuthTokenVerifier

[AuthTokenVerifier](../modules/authtokenverifier.md).AuthTokenVerifier

## Table of contents

### Constructors

- [constructor](authtokenverifier.authtokenverifier-1.md#constructor)

### Methods

- [verify](authtokenverifier.authtokenverifier-1.md#verify)

## Constructors

### constructor

• **new AuthTokenVerifier**(`_privateKey`, `_didDocument`)

#### Parameters

| Name | Type |
| :------ | :------ |
| `_privateKey` | `string` |
| `_didDocument` | `IDIDDocument` |

## Methods

### verify

▸ **verify**(`token`, `issuerDID`): `Promise`<``null`` \| `string`\>

**`description`** checks a token was signed by the issuer DID or a valid authentication delegate of the issuer

#### Parameters

| Name | Type |
| :------ | :------ |
| `token` | `string` |
| `issuerDID` | `string` |

#### Returns

`Promise`<``null`` \| `string`\>

issuer DID or null
53 changes: 0 additions & 53 deletions docs/api/classes/authtokenverifier.md

This file was deleted.

155 changes: 155 additions & 0 deletions docs/api/classes/basestrategy.basestrategy-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Class: BaseStrategy

[BaseStrategy](../modules/basestrategy.md).BaseStrategy

**`abstract`**

**`description`** passport strategy used to authenticate decetralized identity.
Subclasses should define their token extraction and validation logic

## Hierarchy

- `Strategy`

↳ **`BaseStrategy`**

↳↳ [`LoginStrategy`](loginstrategy.loginstrategy-1.md)

## Table of contents

### Constructors

- [constructor](basestrategy.basestrategy-1.md#constructor)

### Methods

- [authenticate](basestrategy.basestrategy-1.md#authenticate)
- [decodeToken](basestrategy.basestrategy-1.md#decodetoken)
- [extractToken](basestrategy.basestrategy-1.md#extracttoken)
- [getUserClaims](basestrategy.basestrategy-1.md#getuserclaims)
- [validate](basestrategy.basestrategy-1.md#validate)

## Constructors

### constructor

• **new BaseStrategy**(`__namedParameters`)

#### Parameters

| Name | Type |
| :------ | :------ |
| `__namedParameters` | [`StrategyOptions`](../interfaces/basestrategy.strategyoptions.md) |

#### Overrides

Strategy.constructor

## Methods

### authenticate

▸ **authenticate**(`req`, `options`): `void`

**`description`** template method to authenticate DID

#### Parameters

| Name | Type |
| :------ | :------ |
| `req` | `Request`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, `Record`<`string`, `any`\>\> |
| `options` | `AuthenticateOptions` |

#### Returns

`void`

#### Overrides

Strategy.authenticate

___

### decodeToken

▸ `Abstract` **decodeToken**(`token`): `string` \| { [key: string]: `any`; }

**`abstract`**

**`description`** decodes token payload

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `token` | `string` | encoded payload |

#### Returns

`string` \| { [key: string]: `any`; }

decoded payload fields

___

### extractToken

▸ `Abstract` **extractToken**(`req`): ``null`` \| `string`

**`abstract`**

**`description`** extracts token from request

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `req` | `Request`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, `Record`<`string`, `any`\>\> | object than encapsules request to protected endpoint |

#### Returns

``null`` \| `string`

encoded token

___

### getUserClaims

▸ `Abstract` **getUserClaims**(`did`): `Promise`<[`Claim`](../interfaces/loginstrategy_types.claim.md)[]\>

**`abstract`**

**`description`** fetches claims published by the did

#### Parameters

| Name | Type |
| :------ | :------ |
| `did` | `string` |

#### Returns

`Promise`<[`Claim`](../interfaces/loginstrategy_types.claim.md)[]\>

___

### validate

▸ `Abstract` **validate**(`token`, `tokenPayload`, `done`): `void`

**`abstract`**

**`description`** contains token validation logic

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `token` | `string` | serialized claims |
| `tokenPayload` | `any` | claim payload |
| `done` | (`err?`: `Error`, `user?`: `any`, `info?`: `any`) => `any` | |

#### Returns

`void`
Loading