Serialize any input using msgpack encoding
input
- (required) any input that can be msgpack'edkey_order
- (optional) a list of ordered keys- default to use msgpack sort keys
Returns Uint8Array
Example
const bytes = serialize( "Hello world" );
Serialize any input using msgpack encoding with sort keys enabled
input
- (required) any input that can be msgpack'edkey_order
- (required) a list of ordered keys
Returns Uint8Array
Example
const bytes = serializeKeyOrder({
"3": null,
"two": null,
"one": null,
"4": null,
}, [ "one", "two", "3", "4" ] );
Hash any input using serialize
.
Returns Uint8Array(32)
Example
const digest = hash( "Hello world" );
Serialize unsigned zome call input with keys sorted according to the Rust equivalent
Returns Uint8Array
Example
const zome_call_request = {
"cap_secret": null,
"cell_id": [ dna_hash, agent_hash ],
"zome_name": "zome",
"fn_name": "function",
"payload": encode( null ),
"provenance": agent_hash,
"nonce": crypto.randomBytes( 32 ),
"expires_at": (Date.now() + (5 * 60 * 1_000)) * 1_000,
};
const bytes = serializeZomeCall( zome_call_request );
Hash input using serializeZomeCall
.
Returns Uint8Array(32)
Example
const zome_call_request = {
"cap_secret": null,
"cell_id": [ dna_hash, agent_hash ],
"zome_name": "zome",
"fn_name": "function",
"payload": encode( null ),
"provenance": agent_hash,
"nonce": crypto.randomBytes( 32 ),
"expires_at": (Date.now() + (5 * 60 * 1_000)) * 1_000,
};
const digest = hashZomeCall( zome_call_request );
{
serialize,
serializeKeyOrder,
hash,
serializeZomeCall,
hashZomeCall,
blake2b,
}