UNPKG

@safik/fk-plug-controller

Version:

Internet Computer Plug wallet's controller

41 lines (40 loc) 1.48 kB
import { BinaryBlob } from '@dfinity/candid'; import { PublicKey, SignIdentity } from '@dfinity/agent'; import Secp256k1PublicKey from './publicKey'; declare type PublicKeyHex = string; declare type SecretKeyHex = string; export declare type JsonableSecp256k1Identity = [PublicKeyHex, SecretKeyHex]; declare class Secp256k1KeyIdentity extends SignIdentity { protected _privateKey: BinaryBlob; static fromParsedJson(obj: [string, string]): Secp256k1KeyIdentity; static fromJSON(json: string): Secp256k1KeyIdentity; static fromKeyPair(publicKey: BinaryBlob, privateKey: BinaryBlob): Secp256k1KeyIdentity; static fromSecretKey(secretKey: ArrayBuffer): Secp256k1KeyIdentity; protected _publicKey: Secp256k1PublicKey; protected constructor(publicKey: PublicKey, _privateKey: BinaryBlob); /** * Serialize this key to JSON. */ toJSON(): JsonableSecp256k1Identity; /** * Return a copy of the key pair. */ getKeyPair(): { secretKey: BinaryBlob; publicKey: Secp256k1PublicKey; }; /** * Return the public key. */ getPublicKey(): PublicKey; /** * Return private key in a pem file */ getPem(): string; /** * Signs a blob of data, with this identity's private key. * @param challenge - challenge to sign with this identity's secretKey, producing a signature */ sign(challenge: BinaryBlob): Promise<BinaryBlob>; } export default Secp256k1KeyIdentity;