api-wasm
    Preparing search index...

    Function keyHashToBase64Key

    • Converts a formatted key hash to a base64-encoded string (CEP-18 key encoding) for use in JavaScript.

      This function acts as a wrapper around get_base64_key_from_key_hash and maps errors to JavaScript-compatible errors.

      Arguments

      • formatted_key_hash - A hex-formatted string representing the key hash. Example: "hash-b485c074cef7ccaccd0302949d2043ab7133abdb14cfa87e8392945c0bd80a5f"

      Returns

      Returns a Result containing the base64-encoded string on success. Example: "AbSFwHTO98yszQMClJ0gQ6txM6vbFM+ofoOSlFwL2Apf"

      Errors

      This function returns a JsError if:

      • The input string is not a valid formatted key hash.
      • The conversion to bytes or base64 encoding fails.

      The error message is formatted as a JavaScript-compatible string.

      Parameters

      • formatted_key_hash: string

      Returns string