@roochnetwork/rooch-sdk
Version:
42 lines (41 loc) • 1.5 kB
TypeScript
import { AddressView, BitcoinNetowkType } from '../../address/index.js';
import { PublicKey, PublicKeyInitData } from '../../crypto/index.js';
/**
* A Secp256k1 public key
*/
export declare class Secp256k1PublicKey extends PublicKey<AddressView> {
static SCHNORR_PUBKEY_SIZE: number;
static ECDSA_PUBKEY_SIZE: number;
private readonly data;
/**
* Create a new Secp256k1PublicKey object
* @param value secp256k1 public key as buffer or base-64 encoded string
*/
constructor(value: PublicKeyInitData);
/**
* Checks if two Secp256k1 public keys are equal
*/
equals(publicKey: Secp256k1PublicKey): boolean;
/**
* Return the byte array representation of the Secp256k1 public key
*/
toBytes(): Uint8Array;
toString(): string;
/**
* Return the Bitcoin address associated with this Secp256k1 public key
*/
toAddress(): AddressView;
toAddressWith(network: BitcoinNetowkType): AddressView;
/**
* Return the Rooch address associated with this Secp256k1 public key
*/
flag(): number;
/**
* Verifies that the ecdsa signature is valid for the provided sha256 hashed message with 33 bytes public key
*/
verify(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
/**
* Verifies that the schnorr signature is valid for the provided message with 32 bytes public key
*/
verify_schnorr(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
}