UNPKG

@hyperledger/cactus-common

Version:

Universal library used by both front end and back end components of Cactus. Aims to be a developer swiss army knife.

30 lines (29 loc) 868 B
export declare enum KeyFormat { Raw = "raw", Hex = "hex", PEM = "pem" } export declare class KeyConverter { private keyEncoder; readonly supportedKeyFormats: string[]; constructor(); /** * Convert public key from one format to another format * @param key * @param fromFormat * @param toFormat */ publicKeyAs(key: string | Uint8Array, fromFormat: KeyFormat, toFormat: KeyFormat): string | Uint8Array; /** * Convert private key from one format to another format * @param key * @param fromFormat * @param toFormat */ privateKeyAs(key: string | Buffer, fromFormat: KeyFormat, toFormat: KeyFormat): string | Buffer; /** * This method will validate if the input key format match to one of the enum value. * @param keyFormat */ private validateKeyFormatValue; }