Home Reference Source
public class | source

KeyStoreCryptoEngine

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

Static Member Summary

Static Public Members
public static

Constructor Summary

Public Constructor
public

constructor(memberId: string, keystore: Object, crypto: Object)

Member Summary

Private Members
private
private
private

Method Summary

Public Methods
public

async createSigner(level: KeyLevel): Object

Creates a signer.

public

async createVerifier(keyId: string): Object

Creates a verifier.

public

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

Generates a key pair and store it.

Static Public Members

public static getActiveMemberId: function source

Public Constructors

public constructor(memberId: string, keystore: Object, crypto: Object) source

Params:

NameTypeAttributeDescription
memberId string
keystore Object
crypto Object
  • optional
  • default: undefined

Private Members

private _crypto: Object source

private _keystore: Object source

private _memberId: string source

Public Methods

public async createSigner(level: KeyLevel): Object source

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

Params:

NameTypeAttributeDescription
level KeyLevel

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

Return:

Object

signer object that implements sign, signJson, and getKeyId

public async createVerifier(keyId: string): Object source

Creates 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: KeyLevel, expirationMs: number | string): Object source

Generates a key pair and store it.

Params:

NameTypeAttributeDescription
level KeyLevel

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

expirationMs number | string

(optional) expiration duration of the key in milliseconds

Return:

Object

key in proto-compliant format