filecoin-pin
Version:
Bridge IPFS content to Filecoin Onchain Cloud using familiar tools
69 lines • 2.6 kB
TypeScript
/**
* CLI Authentication Helpers
*
* Shared utilities for parsing authentication options from CLI commands
* and preparing them for use with the Synapse SDK.
*/
import type { Synapse } from '@filoz/synapse-sdk';
import type { SynapseSetupConfig } from '../core/synapse/index.js';
/**
* Common CLI authentication options interface
* Used across all commands that require authentication
*/
export interface CLIAuthOptions {
/** Private key for standard authentication */
privateKey?: string | undefined;
/** Wallet address for session key mode */
walletAddress?: string | undefined;
/** Session key private key */
sessionKey?: string | undefined;
/** Filecoin network: mainnet or calibration */
network?: string | undefined;
/** RPC endpoint URL (overrides network if specified) */
rpcUrl?: string | undefined;
/** Optional warm storage address override */
warmStorageAddress?: string | undefined;
/** Optional provider address override */
providerAddress?: string | undefined;
/** Optional provider ID override */
providerId?: string | undefined;
}
/**
* Parse CLI authentication options into SynapseSetupConfig
*
* This function handles reading from CLI options and environment variables,
* and returns a config ready for initializeSynapse().
*
* Note: Validation is performed by initializeSynapse() via validateAuthConfig()
*
* @param options - CLI authentication options
* @returns Synapse setup config (validation happens in initializeSynapse)
*/
export declare function parseCLIAuth(options: CLIAuthOptions): Partial<SynapseSetupConfig>;
/**
* Provider selection options for storage context
*/
export interface ProviderSelectionOptions {
/** Provider address override */
providerAddress?: string;
/** Provider ID override */
providerId?: number;
}
/**
* Parse provider selection from CLI options and environment variables
*
* Reads provider address and ID from CLI options or environment variables,
* parses and validates the provider ID as a number.
*
* @param options - CLI authentication options (may contain provider fields)
* @returns Provider selection options ready for createStorageContext()
*/
export declare function parseProviderOptions(options?: CLIAuthOptions): ProviderSelectionOptions;
/**
* Get a logger instance for use in CLI commands
*
* @returns Logger configured for CLI use
*/
export declare function getCLILogger(): import("pino").Logger;
export declare function getCliSynapse(options: CLIAuthOptions): Promise<Synapse>;
//# sourceMappingURL=cli-auth.d.ts.map