Common representation of private or public key

### Hierarchy

- Key
  - PublicKey
  - PrivateKey

## Index

### Constructors

- constructor

### Properties

- algorithm
- key
- parameters

### Methods

- computeHash
- isSchemaSupported
- serializeJson

## Constructors

### constructor

- new Key(key: string, algorithm?: KeyType, parameters?: KeyParameters): Key

- - Defined in crypto/Key.ts:74

  Creates Key.

  If no algorithm or parameters are specified, default values will be used. This is strongly discurraged, because it will forbid using other Key types. Therefore use it only for testing.

  #### Parameters

  - ##### key: string

    Hex encoded key value

  - ##### Optional algorithm: KeyType

    Key type

  - ##### Optional parameters: KeyParameters

    Parameters of the key type

  #### Returns Key

## Properties

### algorithm

algorithm: KeyType

- Defined in crypto/Key.ts:64

Algorithm used for key generation.

### key

key: string

- Defined in crypto/Key.ts:74

Key data.

### parameters

parameters: KeyParameters

- Defined in crypto/Key.ts:69

Parameters of the algorithm.

## Methods

### computeHash

- computeHash(msg: string, scheme: SignatureScheme): string

- - Defined in crypto/Key.ts:108

  Computes hash of message using hashing function of signature schema.

  #### Parameters

  - ##### msg: string

    Hex encoded input data

  - ##### scheme: SignatureScheme

    Signing schema to use

  #### Returns string

### isSchemaSupported

- isSchemaSupported(schema: SignatureScheme): boolean

- - Defined in crypto/Key.ts:141

  Tests if signing schema is compatible with key type.

  #### Parameters

  - ##### schema: SignatureScheme

    Signing schema to use

  #### Returns boolean

### serializeJson

- serializeJson(): JsonKey

- - Defined in crypto/Key.ts:165

  Gets JSON representation of the Key (Public/Private).

  #### Returns JsonKey

Generated using TypeDoc