interface CCF {
    consensus: CCFConsensus;
    crypto: CCFCrypto;
    historical: CCFHistorical;
    historicalState?: HistoricalState;
    kv: KvMaps;
    rpc: CCFRpc;
    bufToJsonCompatible<T>(v): T;
    bufToStr(v): string;
    digest(algorithm, data): ArrayBuffer;
    enableMetricsLogging(enable): boolean;
    enableUntrustedDateTime(enable): boolean;
    generateAesKey(size): ArrayBuffer;
    generateEcdsaKeyPair(curve): CryptoKeyPair;
    generateRsaKeyPair(size, exponent?): CryptoKeyPair;
    isValidX509CertBundle(pem): boolean;
    isValidX509CertChain(chain, trusted): boolean;
    jsonCompatibleToBuf<T>(v): ArrayBuffer;
    strToBuf(v): ArrayBuffer;
    wrapKey(key, wrappingKey, wrapAlgo): ArrayBuffer;
}

Properties

consensus: CCFConsensus
crypto: CCFCrypto
historical: CCFHistorical
historicalState?: HistoricalState

State associated with a specific historic transaction. Only defined for endpoints with "mode" set to "historical".

kv: KvMaps

An object that provides access to the maps of the Key-Value Store of CCF. Fields are map names and values are KvMap objects.

rpc: CCFRpc

Methods

  • Parse JSON from an ArrayBuffer.

    Equivalent to JSON.parse(ccf.bufToStr(v)).

    Type Parameters

    • T extends unknown

    Parameters

    • v: ArrayBuffer

    Returns T

  • Convert an ArrayBuffer into a string.

    Note that this function does not perform any encoding validation, and may produce an invalid JS string if the input is not valid UTF-8.

    Parameters

    • v: ArrayBuffer

    Returns string

  • Parameters

    Returns ArrayBuffer

    Deprecated

    This method has been moved to ccf.crypto namespace

    See

    crypto.digest

  • Toggles whether common metrics (including the path, the response status, and the execution time) should be logged when this execution completes. By default this is enabled. If the request pattern should not be visible to an operator, then this behaviour should be disabled.

    Returns the previous value, allowing a global default to be maintained.

    Parameters

    • enable: boolean

      If false, then no built-in logging will be emitted describing this execution

    Returns boolean

  • Toggles implementation of Date global API between using untrusted host time (when enabled)and returning 0 (when disabled). By default this is disabled.

    Returns the previous value, allowing a global default to be maintained.

    Parameters

    • enable: boolean

      If true, then subsequent calls to Date.now() will return untrusted host time

    Returns boolean

  • Parameters

    • size: number

    Returns ArrayBuffer

    Deprecated

    This method has been moved to ccf.crypto namespace

    See

    crypto.generateAesKey

  • Parameters

    • curve: string

    Returns CryptoKeyPair

    Deprecated

    This method has been moved to ccf.crypto namespace

    See

    crypto.generateEcdsaKeyPair

  • Parameters

    • size: number
    • Optional exponent: number

    Returns CryptoKeyPair

    Deprecated

    This method has been moved to ccf.crypto namespace

    See

    crypto.generateRsaKeyPair

  • Parameters

    • pem: string

    Returns boolean

    Deprecated

    See

    crypto.isValidX509CertBundle

  • Parameters

    • chain: string
    • trusted: string

    Returns boolean

    Deprecated

    This method has been moved to ccf.crypto namespace

    See

    crypto.isValidX509CertChain

  • Serialize a value to JSON and convert it to an ArrayBuffer.

    Equivalent to ccf.strToBuf(JSON.stringify(v)).

    Type Parameters

    • T extends unknown

    Parameters

    Returns ArrayBuffer

  • Convert a string into an ArrayBuffer.

    Parameters

    • v: string

    Returns ArrayBuffer

  • Parameters

    Returns ArrayBuffer

    Deprecated

    This method has been moved to ccf.crypto namespace

    See

    crypto.wrapKey