Skip to content

Commit

Permalink
Merge pull request #55 from dcSpark/nico/update-wasm-blake3
Browse files Browse the repository at this point in the history
update to blake3
  • Loading branch information
nicarq authored Oct 26, 2023
2 parents 6f4a2f5 + df035fd commit 3a9801c
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 58 deletions.
2 changes: 1 addition & 1 deletion libs/shinkai-message-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shinkai_network/shinkai-message-ts",
"version": "0.0.9",
"version": "0.0.11",
"description": "Shinkai Message TS wrapper for wasm library",
"type": "module",
"main": "src/index.js",
Expand Down
22 changes: 21 additions & 1 deletion libs/shinkai-message-ts/src/pkg/shinkai_message_wasm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,27 @@ export class ShinkaiMessageWrapper {
/**
* @returns {string}
*/
calculate_hash(): string;
calculate_blake3_hash(): string;
/**
* @returns {ShinkaiMessageWrapper}
*/
new_with_empty_outer_signature(): ShinkaiMessageWrapper;
/**
* @returns {ShinkaiMessageWrapper}
*/
new_with_empty_inner_signature(): ShinkaiMessageWrapper;
/**
* @returns {string}
*/
inner_content_for_hashing(): string;
/**
* @returns {string}
*/
calculate_blake3_hash_with_empty_outer_signature(): string;
/**
* @returns {string}
*/
calculate_blake3_hash_with_empty_inner_signature(): string;
/**
* @returns {string}
*/
Expand Down
140 changes: 120 additions & 20 deletions libs/shinkai-message-ts/src/pkg/shinkai_message_wasm_bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -2494,27 +2494,19 @@ export class ShinkaiMessageWrapper {
* @returns {string}
*/
to_json_str() {
let deferred2_0;
let deferred2_1;
let deferred1_0;
let deferred1_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.shinkaimessagewrapper_to_json_str(retptr, this.__wbg_ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
var r3 = getInt32Memory0()[retptr / 4 + 3];
var ptr1 = r0;
var len1 = r1;
if (r3) {
ptr1 = 0; len1 = 0;
throw takeObject(r2);
}
deferred2_0 = ptr1;
deferred2_1 = len1;
return getStringFromWasm0(ptr1, len1);
deferred1_0 = r0;
deferred1_1 = r1;
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
}
}
/**
Expand All @@ -2541,12 +2533,12 @@ export class ShinkaiMessageWrapper {
/**
* @returns {string}
*/
calculate_hash() {
calculate_blake3_hash() {
let deferred1_0;
let deferred1_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.shinkaimessagewrapper_calculate_hash(retptr, this.__wbg_ptr);
wasm.shinkaimessagewrapper_calculate_blake3_hash(retptr, this.__wbg_ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
deferred1_0 = r0;
Expand All @@ -2558,6 +2550,104 @@ export class ShinkaiMessageWrapper {
}
}
/**
* @returns {ShinkaiMessageWrapper}
*/
new_with_empty_outer_signature() {
const ret = wasm.shinkaimessagewrapper_new_with_empty_outer_signature(this.__wbg_ptr);
return ShinkaiMessageWrapper.__wrap(ret);
}
/**
* @returns {ShinkaiMessageWrapper}
*/
new_with_empty_inner_signature() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.shinkaimessagewrapper_new_with_empty_inner_signature(retptr, this.__wbg_ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return ShinkaiMessageWrapper.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @returns {string}
*/
inner_content_for_hashing() {
let deferred2_0;
let deferred2_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.shinkaimessagewrapper_inner_content_for_hashing(retptr, this.__wbg_ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
var r3 = getInt32Memory0()[retptr / 4 + 3];
var ptr1 = r0;
var len1 = r1;
if (r3) {
ptr1 = 0; len1 = 0;
throw takeObject(r2);
}
deferred2_0 = ptr1;
deferred2_1 = len1;
return getStringFromWasm0(ptr1, len1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
}
}
/**
* @returns {string}
*/
calculate_blake3_hash_with_empty_outer_signature() {
let deferred1_0;
let deferred1_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.shinkaimessagewrapper_calculate_blake3_hash_with_empty_outer_signature(retptr, this.__wbg_ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
deferred1_0 = r0;
deferred1_1 = r1;
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
}
}
/**
* @returns {string}
*/
calculate_blake3_hash_with_empty_inner_signature() {
let deferred2_0;
let deferred2_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.shinkaimessagewrapper_calculate_blake3_hash_with_empty_inner_signature(retptr, this.__wbg_ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
var r3 = getInt32Memory0()[retptr / 4 + 3];
var ptr1 = r0;
var len1 = r1;
if (r3) {
ptr1 = 0; len1 = 0;
throw takeObject(r2);
}
deferred2_0 = ptr1;
deferred2_1 = len1;
return getStringFromWasm0(ptr1, len1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
}
}
/**
* @returns {string}
*/
static generate_time_now() {
Expand Down Expand Up @@ -2963,13 +3053,13 @@ export function __wbindgen_string_new(arg0, arg1) {
return addHeapObject(ret);
};

export function __wbindgen_object_clone_ref(arg0) {
const ret = getObject(arg0);
export function __wbindgen_error_new(arg0, arg1) {
const ret = new Error(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
};

export function __wbindgen_error_new(arg0, arg1) {
const ret = new Error(getStringFromWasm0(arg0, arg1));
export function __wbindgen_object_clone_ref(arg0) {
const ret = getObject(arg0);
return addHeapObject(ret);
};

Expand Down Expand Up @@ -3172,6 +3262,16 @@ export function __wbg_getTime_5e2054f832d82ec9(arg0) {
return ret;
};

export function __wbg_getTimezoneOffset_8aee3445f323973e(arg0) {
const ret = getObject(arg0).getTimezoneOffset();
return ret;
};

export function __wbg_new_cd59bfc8881f487b(arg0) {
const ret = new Date(getObject(arg0));
return addHeapObject(ret);
};

export function __wbg_new0_c0be7df4b6bd481f() {
const ret = new Date();
return addHeapObject(ret);
Expand Down
Binary file modified libs/shinkai-message-ts/src/pkg/shinkai_message_wasm_bg.wasm
Binary file not shown.
75 changes: 40 additions & 35 deletions libs/shinkai-message-ts/src/pkg/shinkai_message_wasm_bg.wasm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ export function shinkaimessagebuilderwrapper_job_message(a: number, b: number, c
export function shinkaimessagebuilderwrapper_terminate_message(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number): void;
export function shinkaimessagebuilderwrapper_error_message(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number): void;
export function shinkaimessagebuilderwrapper_get_last_unread_messages_from_inbox(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number): void;
export function __wbg_inboxnamewrapper_free(a: number): void;
export function inboxnamewrapper_new(a: number, b: number): void;
export function inboxnamewrapper_to_string(a: number, b: number): void;
export function inboxnamewrapper_get_value(a: number): number;
export function inboxnamewrapper_get_is_e2e(a: number): number;
export function inboxnamewrapper_get_identities(a: number, b: number): void;
export function inboxnamewrapper_get_unique_id(a: number): number;
export function inboxnamewrapper_to_jsvalue(a: number, b: number): void;
export function inboxnamewrapper_to_json_str(a: number, b: number): void;
export function inboxnamewrapper_get_regular_inbox_name_from_params(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;
export function inboxnamewrapper_get_job_inbox_name_from_params(a: number, b: number, c: number): void;
export function inboxnamewrapper_get_inner(a: number): number;
export function __wbg_serializedagentwrapper_free(a: number): void;
export function serializedagentwrapper_fromStrings(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number): void;
export function serializedagentwrapper_fromJsValue(a: number, b: number): void;
Expand All @@ -44,24 +56,10 @@ export function serializedagentwrapper_from_json_str(a: number, b: number, c: nu
export function serializedagentwrapper_inner(a: number, b: number): void;
export function serializedagentwrapper_new(a: number, b: number): void;
export function serializedagentwrapper_to_jsvalue(a: number, b: number): void;
export function __wbg_shinkainamewrapper_free(a: number): void;
export function shinkainamewrapper_new(a: number, b: number): void;
export function shinkainamewrapper_get_full_name(a: number): number;
export function shinkainamewrapper_get_node_name(a: number): number;
export function shinkainamewrapper_get_profile_name(a: number): number;
export function shinkainamewrapper_get_subidentity_type(a: number): number;
export function shinkainamewrapper_get_subidentity_name(a: number): number;
export function shinkainamewrapper_to_jsvalue(a: number, b: number): void;
export function shinkainamewrapper_to_json_str(a: number, b: number): void;
export function shinkainamewrapper_extract_profile(a: number, b: number): void;
export function shinkainamewrapper_extract_node(a: number): number;
export function __wbg_wasmencryptionmethod_free(a: number): void;
export function wasmencryptionmethod_new(a: number, b: number): number;
export function wasmencryptionmethod_as_str(a: number, b: number): void;
export function wasmencryptionmethod_DiffieHellmanChaChaPoly1305(a: number): void;
export function wasmencryptionmethod_None(a: number): void;
export function convert_encryption_sk_string_to_encryption_pk_string(a: number, b: number, c: number): void;
export function calculate_blake3_hash(a: number, b: number, c: number): void;
export function shinkaitime_generateTimeNow(a: number): void;
export function shinkaitime_generateTimeInFutureWithSecs(a: number, b: number): void;
export function shinkaitime_generateSpecificTime(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void;
export function __wbg_shinkaitime_free(a: number): void;
export function __wbg_jobscopewrapper_free(a: number): void;
export function jobscopewrapper_new(a: number, b: number, c: number): void;
export function jobscopewrapper_to_jsvalue(a: number, b: number): void;
Expand All @@ -81,6 +79,23 @@ export function jobmessagewrapper_to_json_str(a: number, b: number): void;
export function jobmessagewrapper_from_json_str(a: number, b: number, c: number): void;
export function jobmessagewrapper_from_jsvalue(a: number, b: number): void;
export function jobmessagewrapper_fromStrings(a: number, b: number, c: number, d: number, e: number, f: number): number;
export function __wbg_shinkainamewrapper_free(a: number): void;
export function shinkainamewrapper_new(a: number, b: number): void;
export function shinkainamewrapper_get_full_name(a: number): number;
export function shinkainamewrapper_get_node_name(a: number): number;
export function shinkainamewrapper_get_profile_name(a: number): number;
export function shinkainamewrapper_get_subidentity_type(a: number): number;
export function shinkainamewrapper_get_subidentity_name(a: number): number;
export function shinkainamewrapper_to_jsvalue(a: number, b: number): void;
export function shinkainamewrapper_to_json_str(a: number, b: number): void;
export function shinkainamewrapper_extract_profile(a: number, b: number): void;
export function shinkainamewrapper_extract_node(a: number): number;
export function __wbg_wasmencryptionmethod_free(a: number): void;
export function wasmencryptionmethod_new(a: number, b: number): number;
export function wasmencryptionmethod_as_str(a: number, b: number): void;
export function wasmencryptionmethod_DiffieHellmanChaChaPoly1305(a: number): void;
export function wasmencryptionmethod_None(a: number): void;
export function convert_encryption_sk_string_to_encryption_pk_string(a: number, b: number, c: number): void;
export function __wbg_shinkaimessagewrapper_free(a: number): void;
export function shinkaimessagewrapper_message_body(a: number, b: number): void;
export function shinkaimessagewrapper_set_message_body(a: number, b: number, c: number): void;
Expand All @@ -92,25 +107,15 @@ export function shinkaimessagewrapper_to_jsvalue(a: number, b: number): void;
export function shinkaimessagewrapper_fromJsValue(a: number, b: number): void;
export function shinkaimessagewrapper_to_json_str(a: number, b: number): void;
export function shinkaimessagewrapper_from_json_str(a: number, b: number, c: number): void;
export function shinkaimessagewrapper_calculate_hash(a: number, b: number): void;
export function shinkaimessagewrapper_calculate_blake3_hash(a: number, b: number): void;
export function shinkaimessagewrapper_new_with_empty_outer_signature(a: number): number;
export function shinkaimessagewrapper_new_with_empty_inner_signature(a: number, b: number): void;
export function shinkaimessagewrapper_inner_content_for_hashing(a: number, b: number): void;
export function shinkaimessagewrapper_calculate_blake3_hash_with_empty_outer_signature(a: number, b: number): void;
export function shinkaimessagewrapper_calculate_blake3_hash_with_empty_inner_signature(a: number, b: number): void;
export function shinkaimessagewrapper_generate_time_now(a: number): void;
export function shinkaimessagewrapper_new(a: number, b: number): void;
export function __wbg_inboxnamewrapper_free(a: number): void;
export function inboxnamewrapper_new(a: number, b: number): void;
export function inboxnamewrapper_to_string(a: number, b: number): void;
export function inboxnamewrapper_get_value(a: number): number;
export function inboxnamewrapper_get_is_e2e(a: number): number;
export function inboxnamewrapper_get_identities(a: number, b: number): void;
export function inboxnamewrapper_get_unique_id(a: number): number;
export function inboxnamewrapper_to_jsvalue(a: number, b: number): void;
export function inboxnamewrapper_to_json_str(a: number, b: number): void;
export function inboxnamewrapper_get_regular_inbox_name_from_params(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;
export function inboxnamewrapper_get_job_inbox_name_from_params(a: number, b: number, c: number): void;
export function inboxnamewrapper_get_inner(a: number): number;
export function shinkaitime_generateTimeNow(a: number): void;
export function shinkaitime_generateTimeInFutureWithSecs(a: number, b: number): void;
export function shinkaitime_generateSpecificTime(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void;
export function __wbg_shinkaitime_free(a: number): void;
export function calculate_blake3_hash(a: number, b: number, c: number): void;
export function __wbindgen_malloc(a: number, b: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
export function __wbindgen_add_to_stack_pointer(a: number): number;
Expand Down
2 changes: 1 addition & 1 deletion libs/shinkai-message-ts/src/wasm/ShinkaiMessageWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ShinkaiMessageWrapper {
}

calculate_hash(): string {
return this.wasmWrapper.calculate_hash();
return this.wasmWrapper.calculate_blake3_hash();
}

static time_now(): string {
Expand Down

0 comments on commit 3a9801c

Please sign in to comment.