@roochnetwork/rooch-sdk
Version:
28 lines (27 loc) • 1.09 kB
TypeScript
import { Signer } from './signer.js';
import type { SignatureScheme } from './signatureScheme.js';
export declare const PRIVATE_KEY_SIZE = 32;
export declare const LEGACY_PRIVATE_KEY_SIZE = 64;
export declare const ROOCH_SECRET_KEY_PREFIX = "roochsecretkey";
export type ParsedKeypair = {
schema: SignatureScheme;
secretKey: Uint8Array;
};
export declare abstract class Keypair extends Signer {
/**
* This returns the Bech32 secret key string for this keypair.
*/
abstract getSecretKey(): string;
}
/**
* This returns an ParsedKeypair object based by validating the
* 33-byte Bech32 encoded string starting with `roochsecretkey`, and
* parse out the signature scheme and the private key in bytes.
*/
export declare function decodeRoochSercetKey(value: string): ParsedKeypair;
/**
* This returns a Bech32 encoded string starting with `roochsecretkey`,
* encoding 33-byte `flag || bytes` for the given the 32-byte private
* key and its signature scheme.
*/
export declare function encodeRoochSercetKey(bytes: Uint8Array, scheme: SignatureScheme): string;