UNPKG

@chorus-one/signer-fireblocks

Version:

Fireblocks signer for Chorus One SDK

78 lines (77 loc) 3.48 kB
import { FireblocksSDK } from 'fireblocks-sdk'; import type { Signature, SignerData, AddressDerivationFn } from '@chorus-one/signer'; import type { Logger } from '@chorus-one/utils'; import type { FireblocksSignerConfig } from './types'; /** * The FireblocksSigner in the Chorus One SDK is a specialized implementation of the Signer interface that integrates * with the Fireblocks platform. * * Fireblocks is known for its advanced security features, including multi-party computation (MPC) and secure wallet * infrastructure, making it an ideal choice for enterprises requiring robust security and compliance. */ export declare class FireblocksSigner { private readonly config; private fireblocksClient?; private vault?; private addressDerivationFn; private accounts; private logger; /** * Constructs a new FireblocksSigner. * * @param params - The parameters required to initialize the FireblocksSigner * @param params.apiSecretKey - Fireblocks API Secret key * @param params.apiKey - Fireblocks API Key * @param params.vaultName - The name of the Fireblocks vault where the assets are stored * @param params.assetId - The identifier for the asset you intend to manage * @param params.addressDerivationFn - A function that derives the address from the public key * @param params.timeout - (Optional) The maximum time (in ms) to wait for the Fireblocks API sign request to complete * @param params.pollInterval - (Optional) The interval (in ms) at which the signer polls the Fireblocks API to check if the sign request has completed * @param params.apiUrl - (Optional) The URL of the Fireblocks API, defaults to `https://api.fireblocks.io` * @param params.logger - (Optional) A logger to use for logging messages, i.e `console` * * @returns A new instance of FireblocksSigner. */ constructor(params: { apiSecretKey: string; apiKey: string; vaultName: string; assetId: string; addressDerivationFn: AddressDerivationFn; timeout?: number; pollInterval?: number; apiUrl?: string; logger?: Logger; }); /** * Initializes the signer, performing any necessary setup or configuration. * @returns A promise that resolves once the initialization is complete. */ init(): Promise<void>; /** * Signs the provided data using the private key associated with the signer's address. * * @param signerAddress - The address of the signer * @param signerData - The data to be signed, which can be a raw message or custom data * @param options - Additional options * @param options.note - An optional note to include with the transaction * * @returns A promise that resolves to an object containing the signature and public key. */ sign(signerAddress: string, signerData: SignerData, options?: { note?: string; }): Promise<{ sig: Signature; pk: Uint8Array; }>; /** * Retrieves the public key associated with the signer's address. * * @param address - The address of the signer * * @returns A promise that resolves to a Uint8Array representing the public key. */ getPublicKey(address: string): Promise<Uint8Array>; private getPublicKeyInfoForVaultAccount; } export declare function newFireblocksSignerBackend(config: FireblocksSignerConfig): Promise<FireblocksSDK>;