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

    This method has been moved to ccf.crypto namespace

    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

    This method has been moved to ccf.crypto namespace

    crypto.generateAesKey

  • Parameters

    • curve: string

    Returns CryptoKeyPair

    This method has been moved to ccf.crypto namespace

    crypto.generateEcdsaKeyPair

  • Parameters

    • size: number
    • Optionalexponent: number

    Returns CryptoKeyPair

    This method has been moved to ccf.crypto namespace

    crypto.generateRsaKeyPair

  • Parameters

    • pem: string

    Returns boolean

    crypto.isValidX509CertBundle

  • Parameters

    • chain: string
    • trusted: string

    Returns boolean

    This method has been moved to ccf.crypto namespace

    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

    This method has been moved to ccf.crypto namespace

    crypto.wrapKey