Home Reference Source
public class | source

KeyStoreCryptoEngine

Base crypto engine that are extended by others, it handles signatures, verifications, and key storage.

Constructor Summary

Public Constructor
public

Member Summary

Private Members
private
private

Method Summary

Public Methods
public

async createSigner(level: string): Object

Create a signer.

public

async createVerifier(keyId: string): Object

Create a verifier.

public

async generateKey(level: string, expirationMs: number): Object

Generate a key pair and store it.

Public Constructors

public constructor() source

Private Members

private _keystore: * source

private _memberId: * source

Public Methods

public async createSigner(level: string): Object source

Create a signer. Assumes we previously generated the relevant key.

Params:

NameTypeAttributeDescription
level string

privilege level 'LOW', 'STANDARD', 'PRIVILEGED'

Return:

Object

signer object that implements sign, signJson, and getKeyId

public async createVerifier(keyId: string): Object source

Create a verifier. Assumes we have the key with the passed ID.

Params:

NameTypeAttributeDescription
keyId string

ID of key to use

Return:

Object

verifier object that implements verify and verifyJson

public async generateKey(level: string, expirationMs: number): Object source

Generate a key pair and store it.

Params:

NameTypeAttributeDescription
level string

'LOW', 'STANDARD', or 'PRIVILEGED'

expirationMs number

(optional) expiration duration of the key in milliseconds

Return:

Object

key in proto-compliant format