UNPKG

@standard-crypto/farcaster-js-hub-rest

Version:

A tool for interacting with the REST API of any Farcaster hub.

30 lines (29 loc) 1.33 kB
import { Ed25519Signer, HubAsyncResult } from '@farcaster/core'; /** * External Ed25519 signer that allows signatures to be computed by an external service. */ export declare class ExternalEd25519Signer extends Ed25519Signer { private readonly _signMessageHash; private readonly _getSignerKey; /** * Creates a new ExternalEd25519Signer. This class allows the signing of Farcaster message hashes to be delegated to an external service * such that a private key is not required to be in memory. * * @param signMessageHash Proxy function that signs a message hash. Called internally by _signMessageHash. * @param getSignerKey Proxy function that returns the public key of the signer. Called internally by _getSignerKey. */ constructor(signMessageHash: (messageHash: Uint8Array) => Promise<Uint8Array>, getSignerKey: () => Promise<Uint8Array>); /** * Returns the public key of the signer as a Uint8Array. * * @returns public key of the signer */ getSignerKey(): HubAsyncResult<Uint8Array>; /** * Signs a Farcaster message hash. * * @param hash blake3 hash of the Farcaster message to be signed * @returns signature of the hash */ signMessageHash(hash: Uint8Array): HubAsyncResult<Uint8Array>; }