The name of the method
The length of the method string
Optional the document to use as the parameter
The length of the document parameter
The root net used to sign the message
Optional deriver key
length of the optional deriver key
The resulting hirpc as a document
The length of the resulting document
import tagion.api.hibon; import tagion.api.document; ubyte* doc_param_ptr = new ubyte; size_t doc_param_len; { HiBONT* hibon = new HiBONT; int rc = tagion_hibon_create(hibon); assert(rc == 0); scope(exit) tagion_hibon_free(hibon); const char[] key = "a"; rc = tagion_hibon_add_int32(hibon, &key[0], key.length, 7); assert(rc == 0); rc = tagion_hibon_get_document(hibon, &doc_param_ptr, &doc_param_len); assert(rc == 0); } string method = "some_method"; securenet_t net; { const(char)[] passphrase = "ababab"; const(char)[] pin = "babab"; ubyte* device_doc_ptr = new ubyte; size_t device_doc_len; tagion_generate_keypair(&passphrase[0], passphrase.length, null, 0, &net, &pin[0], pin.length, &device_doc_ptr, &device_doc_len); } { // Signed hirpc with root key ubyte* result_doc_ptr = new ubyte; size_t result_doc_len; int rc = tagion_hirpc_create_signed_sender(&method[0], method.length, doc_param_ptr, doc_param_len, &net, null, 0, &result_doc_ptr, &result_doc_len); assert(rc == 0); const doc = Document(result_doc_ptr[0 .. result_doc_len].idup); assert(doc.isInorder); } { // Signed hirpc with a derived key ubyte* result_doc_ptr = new ubyte; size_t result_doc_len; ubyte[] tweak_word = [28,1,0,1]; int rc = tagion_hirpc_create_signed_sender(&method[0], method.length, doc_param_ptr, doc_param_len, &net, &tweak_word[0], tweak_word.length, &result_doc_ptr, &result_doc_len); assert(rc == 0); const doc = Document(result_doc_ptr[0 .. result_doc_len].idup); assert(doc.isInorder); }
Create a signed hirpc from a document