@aptos-labs/siwa
Version:
Library of utilities for Sign in with Aptos
42 lines • 1.75 kB
TypeScript
import { type HexInput, type PublicKey, type Signature, SigningScheme } from "@aptos-labs/ts-sdk";
/**
* Check if the scheme is a valid public key scheme
*
* @param scheme The scheme to check.
*
* @returns True if the scheme is a valid public key scheme, false otherwise.
*/
export declare const isValidPublicKeyScheme: (scheme: string) => scheme is "ed25519" | "multi_ed25519" | "single_key" | "multi_key" | "solana_derived" | "ethereum_derived";
/**
* Get the signing scheme of a public key.
*
* @param value The public key or signing scheme to get the scheme of.
*
* @returns The signing scheme of the public key.
*/
export declare function getSignInPublicKeyScheme(value: SigningScheme | PublicKey): Promise<string>;
/**
* Deserialize a public key from a hex string.
*
* @param scheme The signing scheme of the public key.
* @param value The hex string to deserialize.
*
* @returns The deserialized public key.
*/
export declare function deserializeSignInPublicKey(scheme: SigningScheme | "ed25519" | "multi_ed25519" | "single_key" | "multi_key" | "solana_derived" | "ethereum_derived", value: HexInput): Promise<PublicKey>;
/**
* Deserialize a signature from a hex string.
*
* @param scheme The signing scheme of the signature.
* @param value The hex string to deserialize.
*
* @returns The deserialized signature.
*/
export declare function deserializeSignInSignature(scheme: SigningScheme | "ed25519" | "multi_ed25519" | "single_key" | "multi_key" | "solana_derived" | "ethereum_derived", value: HexInput): Promise<Signature>;
/**
* Generates a random nonce using the `crypto.getRandomValues` API.
*
* @returns A random nonce.
*/
export declare function generateNonce(): string;
//# sourceMappingURL=utils.d.ts.map