UNPKG

@aptos-labs/ts-sdk

Version:
54 lines • 1.67 kB
import { Serializable } from "../../bcs/index.js"; import { Hex } from "../hex.js"; /** * Represents an abstract public key. * * This class provides a common interface for verifying signatures associated with the public key. * It allows for the retrieval of the raw public key bytes and the public key in a hexadecimal string format. * @group Implementation * @category Serialization */ export class PublicKey extends Serializable { /** * Verifies signature with the public key and makes any network calls required to get state required to verify the signature. * @param args.aptosConfig The Aptos configuration * @param args.message The message that was signed * @param args.signature The signature to verify * @group Implementation * @category Serialization */ async verifySignatureAsync(args) { return this.verifySignature(args); } /** * Get the raw public key bytes * @group Implementation * @category Serialization */ toUint8Array() { return this.bcsToBytes(); } /** * Get the public key as a hex string with a 0x prefix. * * @returns The public key in hex format. * @group Implementation * @category Serialization */ toString() { const bytes = this.toUint8Array(); return Hex.fromHexInput(bytes).toString(); } } /** * An abstract representation of an account public key. * * Provides a common interface for deriving an authentication key. * * @abstract * @group Implementation * @category Serialization */ export class AccountPublicKey extends PublicKey { } //# sourceMappingURL=publicKey.js.map