casper_rust_wasm_sdk::helpers

Function get_base64_key_from_key_hash

source
pub fn get_base64_key_from_key_hash(
    formatted_hash: &str,
) -> Result<String, Box<SdkError>>
Expand description

Converts a formatted key hash to a base64-encoded string (CEP-18 key encoding).

§Arguments

  • formatted_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 an error if:

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