Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @ceramicnetwork/cli

Ceramic CLI

A command line interface that allows you to interact with the Ceramic protocol.

Getting started

Installation

To install the ceramic cli globally you can run:

$ npm install -g @ceramicnetwork/cli

Usage

To get an overview of the available commands run:

$ ceramic -h

To start an instance of the Ceramic daemon, make sure you have ipfs running locally and execute:

$ ceramic daemon

Development

Not yet implemented commands

ceramic user did

Show the DID of the user.

ceramic user sign <payload>

Ask the user to sign a given payload.

ceramic user encrypt <payload>

Ask the user to encrypt a given payload.

ceramic user decrypt <JWE | CWE>

Ask the user to decrypt a given JWE or CWE.

Contributing

We are happy to accept small and large contributions. Make sure to check out the Ceramic specifications for details of how the protocol works.

License

Index

References

CeramicCliUtils

Re-exports CeramicCliUtils

CeramicDaemon

Re-exports CeramicDaemon

DaemonAnchorConfig

Re-exports DaemonAnchorConfig

DaemonCeramicNetworkConfig

Re-exports DaemonCeramicNetworkConfig

DaemonCeramicNodeConfig

Re-exports DaemonCeramicNodeConfig

DaemonConfig

Re-exports DaemonConfig

DaemonDidResolversConfig

Re-exports DaemonDidResolversConfig

DaemonHTTPApiConfig

Re-exports DaemonHTTPApiConfig

DaemonIpfsConfig

Re-exports DaemonIpfsConfig

DaemonLoggerConfig

Re-exports DaemonLoggerConfig

DaemonStateStoreConfig

Re-exports DaemonStateStoreConfig

IpfsMode

Re-exports IpfsMode

S3StateStore

Re-exports S3StateStore

StateStoreMode

Re-exports StateStoreMode

makeCeramicConfig

Re-exports makeCeramicConfig

Variables

Const ACCESS_LOG_FMT

ACCESS_LOG_FMT: "ip=:remote-addr ts=:date[iso] method=:method original_url=:original-url base_url=:base-url path=:path:params http_version=:http-version req_header:req[header] status=:status content_length=:res[content-length] content_type=":res[content-type]" ref=:referrer user_agent=":user-agent" elapsed_ms=:total-time[3] error_message=":error-message" error_code=:error-code" = "ip=:remote-addr ts=:date[iso] method=:method original_url=:original-url base_url=:base-url path=:path:params http_version=:http-version req_header:req[header] status=:status content_length=:res[content-length] content_type=":res[content-type]" ref=:referrer user_agent=":user-agent" elapsed_ms=:total-time[3] error_message=":error-message" error_code=:error-code"

Const DEFAULT_CLI_CONFIG_FILENAME

DEFAULT_CLI_CONFIG_FILENAME: "client.config.json" = "client.config.json"

Const DEFAULT_CONFIG_PATH

DEFAULT_CONFIG_PATH: string = path.join(os.homedir(), '.ceramic')

Const DEFAULT_DAEMON_CONFIG

DEFAULT_DAEMON_CONFIG: DaemonConfig = DaemonConfig.fromObject({anchor: {},'http-api': { 'cors-allowed-origins': [new RegExp('.*')] },ipfs: { mode: IpfsMode.BUNDLED },logger: { 'log-level': LogLevel.important, 'log-to-files': false },network: { name: Networks.TESTNET_CLAY },node: {},'state-store': {mode: StateStoreMode.FS,'local-directory': DEFAULT_STATE_STORE_DIRECTORY,},})

Const DEFAULT_DAEMON_CONFIG_FILENAME

DEFAULT_DAEMON_CONFIG_FILENAME: "daemon.config.json" = "daemon.config.json"

Const DEFAULT_HOSTNAME

DEFAULT_HOSTNAME: "0.0.0.0" = "0.0.0.0"

Const DEFAULT_PORT

DEFAULT_PORT: 7007 = 7007

Const IPFS_DHT_SERVER_MODE

IPFS_DHT_SERVER_MODE: boolean = process.env.IPFS_DHT_SERVER_MODE === 'true'

Const IPFS_GET_TIMEOUT

IPFS_GET_TIMEOUT: 60000 = 60000

Const LEGACY_CLI_CONFIG_FILENAME

LEGACY_CLI_CONFIG_FILENAME: "config.json" = "config.json"

Const config

config: Command = program.command('config')

Const dagJoseFormat

dagJoseFormat: Format<string | DagJWS | DagJWE> = convert(dagJose)

Const packageJson

packageJson: any = require('../package.json')

Const pin

pin: Command = program.command('pin')

Const schemas

schemas: Command = program.command('schema')

Functions

buildIpfsConnection

  • buildIpfsConnection(mode: IpfsMode, network: string, logger: DiagnosticsLogger, ipfsEndpoint?: string): Promise<IpfsApi>

createIPFS

  • createIPFS(path: string): Promise<IpfsApi>

errorHandler

  • errorHandler(logger: DiagnosticsLogger): ErrorRequestHandler

logRequests

  • logRequests(loggerProvider: LoggerProvider): any[]

makeCeramicConfig

makeDID

  • makeDID(ceramic: CeramicApi, seed?: string): DID

makeResolvers

  • makeResolvers(ceramic: Ceramic, ceramicConfig: CeramicConfig, opts: DaemonConfig): ResolverRegistry

parseQueryObject

  • parseQueryObject(opts: Record<string, any>): Record<string, string | boolean | number>
  • Takes a query object and parses the values to give them proper types instead of having everything as strings

    Parameters

    • opts: Record<string, any>

    Returns Record<string, string | boolean | number>

upconvertLegacySyncOption

  • upconvertLegacySyncOption(opts: Record<string, any> | undefined): void
  • Converts 'sync' option sent as a bool by outdated http-clients to the current format of an enum. The old behaviors don't map directly to the new behaviors, so we take the best approximation. TODO remove this once we no longer need to support clients older than v1.0.0

    Parameters

    • opts: Record<string, any> | undefined

    Returns void

Object literals

Const SYNC_OPTIONS_MAP

SYNC_OPTIONS_MAP: object

never-sync

never-sync: SyncOptions = SyncOptions.NEVER_SYNC

prefer-cache

prefer-cache: SyncOptions = SyncOptions.PREFER_CACHE

sync-always

sync-always: SyncOptions = SyncOptions.SYNC_ALWAYS