@oxidezap/whatsapp-rust-bridge 0.23.1 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/host.js CHANGED
@@ -1 +1 @@
1
- import{A as B,B as F,C as D,D as e,E as I,F as q,G as C,H,I as N,J as R,K as V,L as j,M as E,N as G,O as J,P as K,Q as L,R as O,S as P,T as Q,U,V as X,W as Y,X as Z,Y as $,Z as ee,a as i,b as r,c as a,d as n,e as d,f as p,g as l,h as m,i as h,j as c,k as u,l as w,m as y,n as b,o as f,p as g,q as S,r as x,s as k,t as _,u as v,v as M,w as W,x as z,y as T,z as A}from"./bridge.js";export{D as verifySignature,F as updateLogger,B as setLogger,Z as proto,A as projectLegacySessionRecordV1,T as md5,q as longToBigInt,z as logMessage,$ as initWasmEngine,e as initSync,W as inflateZlib,M as importLegacySessionRecordV1,v as hkdf,_ as hasLogger,k as getWasmMemoryBytes,x as getWasmAllocationSnapshot,S as getPublicFromPrivateKey,g as getEnabledFeatures,f as generateKeyPair,b as encodeSessionRecordComponents,O as encodeServerAckWireBatch,y as encodeSenderKeyRecordComponents,L as encodeReceiptWireBatch,N as encodeProto,G as encodeMessageWireBatch,Y as encodeEventWireEnvelope,w as decryptPollVotePayload,u as decryptPollVote,c as decryptEventResponsePayload,h as decodeSessionRecordComponents,K as decodeServerAckWireBatch,m as decodeSenderKeyRecordComponents,J as decodeReceiptWireBatch,V as decodeProtoBatch,R as decodeProto,E as decodeMessageWireBatch,X as decodeEventWireEnvelope,ee as createWhatsAppClient,l as calculateSignature,p as calculateAgreement,d as beginWasmAllocationProfile,n as WasmWhatsAppClient,I as UnpairedSurrogateError,j as MESSAGE_WIRE_INFO_RECORD_WIDTH,H as InvalidUtf8CountingReader,a as IntoUnderlyingSource,r as IntoUnderlyingSink,i as IntoUnderlyingByteSource,U as EVENT_SEGMENT_KIND_SERVER_ACK,Q as EVENT_SEGMENT_KIND_RECEIPT,P as EVENT_SEGMENT_KIND_MESSAGE,C as BinaryReader};
1
+ import{$ as oe,A as B,B as F,C as D,D as I,E as q,F as C,G as e,H,I as N,J as R,K as V,L as j,M as E,N as G,O as J,P as K,Q as L,R as O,S as P,T as Q,U,V as X,W as Y,X as Z,Y as $,Z as ee,_ as te,a as i,aa as se,b as r,c as a,d as n,e as d,f as p,g as l,h as m,i as h,j as c,k as u,l as w,m as y,n as b,o as f,p as g,q as S,r as x,s as k,t as _,u as v,v as M,w as W,x as z,y as T,z as A}from"./bridge.js";export{C as verifySignature,q as updateLogger,I as sha256,D as setLogger,te as proto,F as projectLegacySessionRecordV1,B as md5,N as longToBigInt,A as logMessage,oe as initWasmEngine,e as initSync,T as inflateZlib,z as importLegacySessionRecordV1,W as hkdf,M as hasLogger,v as getWasmMemoryBytes,_ as getWasmAllocationSnapshot,k as getPublicFromPrivateKey,x as getEnabledFeatures,S as generateKeyPair,g as encodeSessionRecordComponents,U as encodeServerAckWireBatch,f as encodeSenderKeyRecordComponents,Q as encodeReceiptWireBatch,j as encodeProto,L as encodeMessageWireBatch,ee as encodeEventWireEnvelope,b as decryptPollVotePayload,y as decryptPollVote,w as decryptEventResponsePayload,u as decodeSessionRecordComponents,P as decodeServerAckWireBatch,c as decodeSenderKeyRecordComponents,O as decodeReceiptWireBatch,G as decodeProtoBatch,E as decodeProto,K as decodeMessageWireBatch,$ as decodeEventWireEnvelope,se as createWhatsAppClient,h as calculateSignature,m as calculateAgreement,l as beginWasmAllocationProfile,p as aesGcm256Encrypt,d as aesGcm256Decrypt,n as WasmWhatsAppClient,H as UnpairedSurrogateError,J as MESSAGE_WIRE_INFO_RECORD_WIDTH,V as InvalidUtf8CountingReader,a as IntoUnderlyingSource,r as IntoUnderlyingSink,i as IntoUnderlyingByteSource,Z as EVENT_SEGMENT_KIND_SERVER_ACK,Y as EVENT_SEGMENT_KIND_RECEIPT,X as EVENT_SEGMENT_KIND_MESSAGE,R as BinaryReader};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{A as g,B as u,C as S,D as q,E as _,F as c,G as h,H as l,I as m,J as o,K as y,L as d,M as p,N as w,O as i,P as n,Q as r,R as a,S as t,T as e,U as s,V as qq,W as vq,X as zq,Y as Aq,Z as Cq,a as H,b as I,c as J,d as K,e as L,f as M,g as N,h as O,i as P,j as Q,k as R,l as T,m as V,n as W,o as X,p as Y,q as Z,r as $,s as b,t as j,u as k,v as x,w as B,x as F,y as U,z as f}from"./bridge.js";import{readFileSync as v}from"node:fs";var z=new URL("whatsapp_rust_bridge_bg.wasm",import.meta.url),A=v(z);q({module:A});export{S as verifySignature,u as updateLogger,g as setLogger,zq as proto,f as projectLegacySessionRecordV1,U as md5,c as longToBigInt,F as logMessage,Aq as initWasmEngine,q as initSync,B as inflateZlib,x as importLegacySessionRecordV1,k as hkdf,j as hasLogger,b as getWasmMemoryBytes,$ as getWasmAllocationSnapshot,Z as getPublicFromPrivateKey,Y as getEnabledFeatures,X as generateKeyPair,W as encodeSessionRecordComponents,a as encodeServerAckWireBatch,V as encodeSenderKeyRecordComponents,r as encodeReceiptWireBatch,m as encodeProto,w as encodeMessageWireBatch,vq as encodeEventWireEnvelope,T as decryptPollVotePayload,R as decryptPollVote,Q as decryptEventResponsePayload,P as decodeSessionRecordComponents,n as decodeServerAckWireBatch,O as decodeSenderKeyRecordComponents,i as decodeReceiptWireBatch,y as decodeProtoBatch,o as decodeProto,p as decodeMessageWireBatch,qq as decodeEventWireEnvelope,Cq as createWhatsAppClient,N as calculateSignature,M as calculateAgreement,L as beginWasmAllocationProfile,K as WasmWhatsAppClient,_ as UnpairedSurrogateError,d as MESSAGE_WIRE_INFO_RECORD_WIDTH,l as InvalidUtf8CountingReader,J as IntoUnderlyingSource,I as IntoUnderlyingSink,H as IntoUnderlyingByteSource,s as EVENT_SEGMENT_KIND_SERVER_ACK,e as EVENT_SEGMENT_KIND_RECEIPT,t as EVENT_SEGMENT_KIND_MESSAGE,h as BinaryReader};
1
+ import{$ as Eq,A as g,B as u,C as S,D as _,E as c,F as h,G as q,H as l,I as m,J as o,K as y,L as d,M as p,N as w,O as i,P as n,Q as r,R as a,S as t,T as e,U as s,V as qq,W as vq,X as zq,Y as Aq,Z as Cq,_ as Dq,a as H,aa as Gq,b as I,c as J,d as K,e as L,f as M,g as N,h as O,i as P,j as Q,k as R,l as T,m as V,n as W,o as X,p as Y,q as Z,r as $,s as b,t as j,u as k,v as x,w as B,x as F,y as U,z as f}from"./bridge.js";import{readFileSync as v}from"node:fs";var z=new URL("whatsapp_rust_bridge_bg.wasm",import.meta.url),A=v(z);q({module:A});export{h as verifySignature,c as updateLogger,_ as sha256,S as setLogger,Dq as proto,u as projectLegacySessionRecordV1,g as md5,m as longToBigInt,f as logMessage,Eq as initWasmEngine,q as initSync,U as inflateZlib,F as importLegacySessionRecordV1,B as hkdf,x as hasLogger,k as getWasmMemoryBytes,j as getWasmAllocationSnapshot,b as getPublicFromPrivateKey,$ as getEnabledFeatures,Z as generateKeyPair,Y as encodeSessionRecordComponents,s as encodeServerAckWireBatch,X as encodeSenderKeyRecordComponents,e as encodeReceiptWireBatch,d as encodeProto,r as encodeMessageWireBatch,Cq as encodeEventWireEnvelope,W as decryptPollVotePayload,V as decryptPollVote,T as decryptEventResponsePayload,R as decodeSessionRecordComponents,t as decodeServerAckWireBatch,Q as decodeSenderKeyRecordComponents,a as decodeReceiptWireBatch,w as decodeProtoBatch,p as decodeProto,n as decodeMessageWireBatch,Aq as decodeEventWireEnvelope,Gq as createWhatsAppClient,P as calculateSignature,O as calculateAgreement,N as beginWasmAllocationProfile,M as aesGcm256Encrypt,L as aesGcm256Decrypt,K as WasmWhatsAppClient,l as UnpairedSurrogateError,i as MESSAGE_WIRE_INFO_RECORD_WIDTH,y as InvalidUtf8CountingReader,J as IntoUnderlyingSource,I as IntoUnderlyingSink,H as IntoUnderlyingByteSource,zq as EVENT_SEGMENT_KIND_SERVER_ACK,vq as EVENT_SEGMENT_KIND_RECEIPT,qq as EVENT_SEGMENT_KIND_MESSAGE,o as BinaryReader};
package/dist/surface.d.ts CHANGED
@@ -14,4 +14,9 @@ export { proto } from "./proto-namespace.js";
14
14
  import type { WhatsAppEventHandler, JsTransportCallbacks, JsHttpClientConfig, JsStoreCallbacks, CacheConfig, ClientPolicies } from "./whatsapp_rust_bridge.js";
15
15
  import type { WasmWhatsAppClient } from "./whatsapp_rust_bridge.js";
16
16
  export declare const initWasmEngine: (logger?: any, crypto?: any) => void;
17
+ /**
18
+ * The factory promise is the initialization barrier. Once it resolves,
19
+ * persistence, adapters, and the core client are ready; it does not imply a
20
+ * socket, authentication, a started run loop, or completed history sync.
21
+ */
17
22
  export declare const createWhatsAppClient: (transport: JsTransportCallbacks, httpClient: JsHttpClientConfig, onEvent?: WhatsAppEventHandler | null, store?: JsStoreCallbacks | null, cache?: CacheConfig | null, version?: readonly [number, number, number] | null, wantedPreKeyCount?: number | null, dangerSkipCertChainVerify?: boolean | null, policies?: ClientPolicies | null) => Promise<WasmWhatsAppClient>;
@@ -4710,6 +4710,17 @@ export class WasmWhatsAppClient {
4710
4710
  withdrawParkedCalls(): number;
4711
4711
  }
4712
4712
 
4713
+ /**
4714
+ * Decrypt bytes returned by [`aes_gcm_256_encrypt`].
4715
+ */
4716
+ export function aesGcm256Decrypt(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, ciphertext_with_tag: Uint8Array): Uint8Array;
4717
+
4718
+ /**
4719
+ * Encrypt with the active signal crypto provider. The returned bytes are
4720
+ * `ciphertext || authentication tag`.
4721
+ */
4722
+ export function aesGcm256Encrypt(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): Uint8Array;
4723
+
4713
4724
  /**
4714
4725
  * Start a new peak-observation window without disturbing live/cumulative
4715
4726
  * counters. The benchmark harness calls this immediately before constructing
@@ -4783,6 +4794,11 @@ export function projectLegacySessionRecordV1(bytes: Uint8Array): LegacySessionPr
4783
4794
 
4784
4795
  export function setLogger(logger: ILogger): void;
4785
4796
 
4797
+ /**
4798
+ * Hash arbitrary bytes with SHA-256.
4799
+ */
4800
+ export function sha256(input: Uint8Array): Uint8Array;
4801
+
4786
4802
  export function updateLogger(logger: ILogger): void;
4787
4803
 
4788
4804
  export function verifySignature(public_key: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
@@ -4792,6 +4808,8 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
4792
4808
  export interface InitOutput {
4793
4809
  readonly memory: WebAssembly.Memory;
4794
4810
  readonly __wbg_wasmwhatsappclient_free: (a: number, b: number) => void;
4811
+ readonly aesGcm256Decrypt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
4812
+ readonly aesGcm256Encrypt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
4795
4813
  readonly beginWasmAllocationProfile: () => void;
4796
4814
  readonly calculateAgreement: (a: number, b: number, c: number, d: number, e: number) => void;
4797
4815
  readonly calculateSignature: (a: number, b: number, c: number, d: number, e: number) => void;
@@ -4816,6 +4834,7 @@ export interface InitOutput {
4816
4834
  readonly md5: (a: number, b: number) => number;
4817
4835
  readonly projectLegacySessionRecordV1: (a: number, b: number, c: number) => void;
4818
4836
  readonly setLogger: (a: number, b: number) => void;
4837
+ readonly sha256: (a: number, b: number, c: number) => void;
4819
4838
  readonly updateLogger: (a: number) => void;
4820
4839
  readonly verifySignature: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
4821
4840
  readonly wasmwhatsappclient_acknowledgeStanza: (a: number, b: number) => number;
@@ -5011,12 +5030,12 @@ export interface InitOutput {
5011
5030
  readonly intounderlyingsink_write: (a: number, b: number) => number;
5012
5031
  readonly intounderlyingsource_cancel: (a: number) => void;
5013
5032
  readonly intounderlyingsource_pull: (a: number, b: number) => number;
5014
- readonly __wasm_bindgen_func_elem_4655: (a: number, b: number, c: number) => void;
5015
- readonly __wasm_bindgen_func_elem_28615: (a: number, b: number, c: number, d: number) => void;
5016
- readonly __wasm_bindgen_func_elem_28617: (a: number, b: number, c: number, d: number) => void;
5017
- readonly __wasm_bindgen_func_elem_9885: (a: number, b: number, c: number) => void;
5018
- readonly __wasm_bindgen_func_elem_4654: (a: number, b: number, c: number) => void;
5019
- readonly __wasm_bindgen_func_elem_4653: (a: number, b: number) => void;
5033
+ readonly __wasm_bindgen_func_elem_4665: (a: number, b: number, c: number) => void;
5034
+ readonly __wasm_bindgen_func_elem_28635: (a: number, b: number, c: number, d: number) => void;
5035
+ readonly __wasm_bindgen_func_elem_28637: (a: number, b: number, c: number, d: number) => void;
5036
+ readonly __wasm_bindgen_func_elem_9904: (a: number, b: number, c: number) => void;
5037
+ readonly __wasm_bindgen_func_elem_4664: (a: number, b: number, c: number) => void;
5038
+ readonly __wasm_bindgen_func_elem_4663: (a: number, b: number) => void;
5020
5039
  readonly __wbindgen_export: (a: number, b: number) => number;
5021
5040
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
5022
5041
  readonly __wbindgen_export3: (a: number) => void;
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxidezap/whatsapp-rust-bridge",
3
- "version": "0.23.1",
3
+ "version": "0.24.0",
4
4
  "description": "A high-performance utilities for WhatsApp, powered by Rust and WebAssembly.",
5
5
  "author": "João Lucas <jlucaso@hotmail.com>",
6
6
  "license": "MIT",
@@ -38,6 +38,7 @@
38
38
  "scripts": {
39
39
  "bench": "bun run build && bun run benches/binary.ts && bun run benches/signal.ts && bun run benches/curve.ts && bun run benches/crypto.ts",
40
40
  "bench:node": "bun run build && node --expose-gc benches/binary.ts && node --expose-gc benches/signal.ts && node --expose-gc benches/curve.ts && node --expose-gc benches/crypto.ts",
41
+ "bench:crypto": "bun run benches/crypto.ts",
41
42
  "bench:proto": "bun run benches/proto-encode.ts",
42
43
  "bench:wire": "bun run benches/wire-batch-decode.ts",
43
44
  "bench:wire:message": "bun run benches/message-wire-batch.ts",