PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/ts-sdk/dist/esm

Просмотр файла: publicKey-BVXX1nVl.d.mts

import { HexInput, AuthenticationKeyScheme } from './types/types.mjs';
import { Serializable, Serializer } from './bcs/serializer.mjs';
import { AccountAddress } from './core/accountAddress.mjs';
import { Deserializer } from './bcs/deserializer.mjs';
import { Hex } from './core/hex.mjs';
import { Signature } from './core/crypto/signature.mjs';

/**
 * Represents an authentication key used for account management. Each account stores an authentication key that enables account
 * owners to rotate their private key(s) without changing the address that hosts their account. The authentication key is a
 * SHA3-256 hash of data and is always 32 bytes in length.
 *
 * @see {@link https://aptos.dev/concepts/accounts | Account Basics}
 *
 * Account addresses can be derived from the AuthenticationKey.
 */
declare class AuthenticationKey extends Serializable {
    /**
     * An authentication key is always a SHA3-256 hash of data, and is always 32 bytes.
     *
     * The data to hash depends on the underlying public key type and the derivation scheme.
     */
    static readonly LENGTH: number;
    /**
     * The raw bytes of the authentication key.
     */
    readonly data: Hex;
    /**
     * Creates an instance of the AuthenticationKey using the provided hex input.
     * This ensures that the hex input is valid and conforms to the required length for an Authentication Key.
     *
     * @param args - The arguments for constructing the AuthenticationKey.
     * @param args.data - The hex input data to be used for the Authentication Key.
     * @throws {Error} Throws an error if the length of the provided hex input is not equal to the required Authentication Key
     * length.
     */
    constructor(args: {
        data: HexInput;
    });
    /**
     * Serializes the fixed bytes data into a format suitable for transmission or storage.
     *
     * @param serializer - The serializer instance used to perform the serialization.
     */
    serialize(serializer: Serializer): void;
    /**
     * Deserialize an AuthenticationKey from the byte buffer in a Deserializer instance.
     * @param deserializer - The deserializer to deserialize the AuthenticationKey from.
     * @returns An instance of AuthenticationKey.
     */
    static deserialize(deserializer: Deserializer): AuthenticationKey;
    /**
     * Convert the internal data representation to a Uint8Array.
     *
     * This function is useful for obtaining a byte representation of the data, which can be utilized for serialization or transmission.
     *
     * @returns Uint8Array representation of the internal data.
     */
    toUint8Array(): Uint8Array;
    /**
     * Generates an AuthenticationKey from the specified scheme and input bytes.
     * This function is essential for creating a valid authentication key based on a given scheme.
     *
     * @param args - The arguments for generating the AuthenticationKey.
     * @param args.scheme - The authentication key scheme to use.
     * @param args.input - The input data in hexadecimal format to derive the key.
     * @returns An instance of AuthenticationKey containing the generated key data.
     */
    static fromSchemeAndBytes(args: {
        scheme: AuthenticationKeyScheme;
        input: HexInput;
    }): AuthenticationKey;
    /**
     * Derives an AuthenticationKey from the provided public key using a specified derivation scheme.
     *
     * @deprecated Use `fromPublicKey` instead.
     * @param args - The arguments for deriving the authentication key.
     * @param args.publicKey - The public key used for the derivation.
     * @param args.scheme - The scheme to use for deriving the authentication key.
     */
    static fromPublicKeyAndScheme(args: {
        publicKey: AccountPublicKey;
        scheme: AuthenticationKeyScheme;
    }): AuthenticationKey;
    /**
     * Converts a PublicKey to an AuthenticationKey using the derivation scheme inferred from the provided PublicKey instance.
     *
     * @param args - The arguments for the function.
     * @param args.publicKey - The PublicKey to be converted.
     * @returns AuthenticationKey - The derived AuthenticationKey.
     */
    static fromPublicKey(args: {
        publicKey: AccountPublicKey;
    }): AuthenticationKey;
    /**
     * Derives an account address from an AuthenticationKey by translating the AuthenticationKey bytes directly to an AccountAddress.
     *
     * @returns AccountAddress - The derived account address.
     */
    derivedAddress(): AccountAddress;
}

/**
 * Represents the arguments required to verify a digital signature.
 *
 * @param message - The original message that was signed.
 * @param signature - The signature to be verified against the message.
 */
interface VerifySignatureArgs {
    message: HexInput;
    signature: Signature;
}
/**
 * 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.
 */
declare abstract class PublicKey extends Serializable {
    /**
     * Verifies that the private key associated with this public key signed the message with the given signature.
     * @param args.message The message that was signed
     * @param args.signature The signature to verify
     */
    abstract verifySignature(args: VerifySignatureArgs): boolean;
    /**
     * Get the raw public key bytes
     */
    toUint8Array(): Uint8Array;
    /**
     * Get the public key as a hex string with a 0x prefix.
     *
     * @returns The public key in hex format.
     */
    toString(): string;
}
/**
 * An abstract representation of an account public key.
 *
 * Provides a common interface for deriving an authentication key.
 *
 * @abstract
 */
declare abstract class AccountPublicKey extends PublicKey {
    /**
     * Get the authentication key associated with this public key
     */
    abstract authKey(): AuthenticationKey;
}

export { AuthenticationKey as A, PublicKey as P, type VerifySignatureArgs as V, AccountPublicKey as a };

Выполнить команду


Для локальной разработки. Не используйте в интернете!