@wakz/sdk 1.0.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/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # @wakz/sdk
2
+
3
+ **WAKZ Platform SDK** — Unified interface for WAKZ Chat Widget and Cyber Shield services.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @wakz/sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```js
14
+ import WAKZ from '@wakz/sdk';
15
+
16
+ const sdk = new WAKZ({
17
+ chat: {
18
+ widgetId: 'your-widget-id',
19
+ position: 'bottom-right',
20
+ autoOpen: true,
21
+ },
22
+ shield: {
23
+ enableAntiTamper: true,
24
+ enableFingerprint: true,
25
+ keyRotationInterval: 3600000,
26
+ },
27
+ apiBaseUrl: 'https://api.wakz.dev',
28
+ });
29
+
30
+ // Initialize chat widget
31
+ await sdk.initChat();
32
+ sdk.openChat();
33
+
34
+ // Initialize cyber shield & encrypt
35
+ await sdk.initShield();
36
+ const protected = await sdk.protect('Hello, secure world!');
37
+ const original = await sdk.unprotect(protected);
38
+
39
+ // SDK info
40
+ console.log(sdk.getSDKInfo());
41
+
42
+ // Cleanup
43
+ sdk.destroy();
44
+ ```
45
+
46
+ ## API
47
+
48
+ | Method | Description |
49
+ |--------|-------------|
50
+ | `initChat()` | Load & initialize the WAKZ chat widget |
51
+ | `openChat()` | Open the chat widget |
52
+ | `closeChat()` | Close the chat widget |
53
+ | `initShield()` | Initialize AES-256-GCM encryption engine |
54
+ | `protect(msg)` | Encrypt a message |
55
+ | `unprotect(payload)` | Decrypt a payload |
56
+ | `destroy()` | Tear down all services |
57
+ | `getSDKInfo()` | Get SDK version and status |
58
+
59
+ ## License
60
+
61
+ MIT
@@ -0,0 +1,2 @@
1
+ var c="1.0.0";async function a(){return crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}function o(n){let t=new Uint8Array(n),i="";for(let e=0;e<t.byteLength;e++)i+=String.fromCharCode(t[e]);return btoa(i)}function s(n){let t=atob(n),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return i.buffer}async function l(n,t){let i=new TextEncoder,e=crypto.getRandomValues(new Uint8Array(12)),h=await crypto.subtle.encrypt({name:"AES-GCM",iv:e},n,i.encode(t));return{ciphertext:o(h),iv:o(e.buffer)}}async function d(n,t,i){let e=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(s(i))},n,s(t));return new TextDecoder().decode(e)}async function g(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}var r=class{constructor(t){this.chatWidget=null;this.shield=null;this.aesKey=null;this.ecdhKeyPair=null;this.config=t}async initChat(){if(!this.config.chat?.widgetId)throw new Error("WAKZ: chat.widgetId is required to initialize the chat widget.");if(typeof globalThis.WAKZChatWidget<"u"){this.chatWidget=globalThis.WAKZChatWidget,this.chatWidget.init({widgetId:this.config.chat.widgetId,position:this.config.chat.position??"bottom-right",theme:this.config.chat.theme??{},autoOpen:this.config.chat.autoOpen??!1,apiBaseUrl:this.config.apiBaseUrl});return}return new Promise((t,i)=>{let e=document.createElement("script");e.src="https://unpkg.com/@wakz/chat-widget@5.0.0/index.js",e.async=!0,e.onload=()=>{if(this.chatWidget=globalThis.WAKZChatWidget,!this.chatWidget){i(new Error("WAKZ: Chat widget script loaded but WAKZChatWidget global not found."));return}this.chatWidget.init({widgetId:this.config.chat.widgetId,position:this.config.chat.position??"bottom-right",theme:this.config.chat.theme??{},autoOpen:this.config.chat.autoOpen??!1,apiBaseUrl:this.config.apiBaseUrl}),t()},e.onerror=()=>{i(new Error("WAKZ: Failed to load @wakz/chat-widget script."))},document.head.appendChild(e)})}openChat(){if(!this.chatWidget){console.warn("WAKZ: Chat widget not initialized. Call initChat() first.");return}this.chatWidget.open()}closeChat(){if(!this.chatWidget){console.warn("WAKZ: Chat widget not initialized. Call initChat() first.");return}this.chatWidget.close()}async initShield(){this.aesKey=await a(),this.ecdhKeyPair=await g(),this.shield={antiTamper:this.config.shield?.enableAntiTamper??!0,obfuscation:this.config.shield?.enableObfuscation??!1,fingerprint:this.config.shield?.enableFingerprint??!0,keyRotationInterval:this.config.shield?.keyRotationInterval??36e5,initializedAt:Date.now()},this.shield.keyRotationInterval>0&&setInterval(()=>this.rotateKey(),this.shield.keyRotationInterval).unref()}async rotateKey(){this.aesKey=await a()}async protect(t){if(!this.aesKey)throw new Error("WAKZ: Shield not initialized. Call initShield() first.");let{ciphertext:i,iv:e}=await l(this.aesKey,t);return{ciphertext:i,iv:e,algorithm:"AES-256-GCM",timestamp:Date.now()}}async unprotect(t){if(!this.aesKey)throw new Error("WAKZ: Shield not initialized. Call initShield() first.");if(t.algorithm!=="AES-256-GCM")throw new Error(`WAKZ: Unsupported algorithm "${t.algorithm}". Expected "AES-256-GCM".`);return d(this.aesKey,t.ciphertext,t.iv)}destroy(){this.chatWidget?.destroy&&this.chatWidget.destroy(),this.chatWidget=null,this.shield=null,this.aesKey=null,this.ecdhKeyPair=null}getSDKInfo(){return{version:c,name:"@wakz/sdk",chatLoaded:this.chatWidget!==null,shieldActive:this.shield!==null}}},y=r;export{c as SDK_VERSION,r as WAKZ,y as default};
2
+ //# sourceMappingURL=wakz-sdk.esm.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["export const SDK_VERSION = '1.0.0';\n\nexport interface WAKZConfig {\n chat?: {\n widgetId: string;\n position?: 'bottom-right' | 'bottom-left';\n theme?: Record<string, string>;\n autoOpen?: boolean;\n };\n shield?: {\n enableAntiTamper?: boolean;\n enableObfuscation?: boolean;\n enableFingerprint?: boolean;\n keyRotationInterval?: number;\n };\n apiBaseUrl?: string;\n}\n\ninterface ProtectedPayload {\n ciphertext: string;\n iv: string;\n tag?: string;\n algorithm: string;\n timestamp: number;\n}\n\n// \u2500\u2500\u2500 Crypto helpers (AES-256-GCM via Web Crypto API) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nasync function generateAESKey(): Promise<CryptoKey> {\n return crypto.subtle.generateKey(\n { name: 'AES-GCM', length: 256 },\n true,\n ['encrypt', 'decrypt'],\n );\n}\n\nfunction arrayBufferToBase64(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n}\n\nfunction base64ToArrayBuffer(base64: string): ArrayBuffer {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes.buffer;\n}\n\nasync function aesEncrypt(\n key: CryptoKey,\n plaintext: string,\n): Promise<{ ciphertext: string; iv: string }> {\n const encoder = new TextEncoder();\n const iv = crypto.getRandomValues(new Uint8Array(12));\n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv },\n key,\n encoder.encode(plaintext),\n );\n return {\n ciphertext: arrayBufferToBase64(encrypted),\n iv: arrayBufferToBase64(iv.buffer as ArrayBuffer),\n };\n}\n\nasync function aesDecrypt(\n key: CryptoKey,\n ciphertext: string,\n iv: string,\n): Promise<string> {\n const decrypted = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: new Uint8Array(base64ToArrayBuffer(iv)) },\n key,\n base64ToArrayBuffer(ciphertext),\n );\n return new TextDecoder().decode(decrypted);\n}\n\n// \u2500\u2500\u2500 ECDH Key-Pair generation (P-256) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nasync function generateKeyPair(): Promise<CryptoKeyPair> {\n return crypto.subtle.generateKey(\n { name: 'ECDH', namedCurve: 'P-256' },\n true,\n ['deriveKey'],\n );\n}\n\n// \u2500\u2500\u2500 WAKZ SDK Class \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport class WAKZ {\n private config: WAKZConfig;\n private chatWidget: any | null = null;\n private shield: any | null = null;\n private aesKey: CryptoKey | null = null;\n private ecdhKeyPair: CryptoKeyPair | null = null;\n\n constructor(config: WAKZConfig) {\n this.config = config;\n }\n\n // \u2500\u2500 Chat Methods \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * Dynamically loads and initializes the @wakz/chat-widget from unpkg CDN.\n * The widget exposes a global `WAKZChatWidget` object with init(), open(), close().\n */\n async initChat(): Promise<void> {\n if (!this.config.chat?.widgetId) {\n throw new Error('WAKZ: chat.widgetId is required to initialize the chat widget.');\n }\n\n // If already loaded, re-init with new config\n if (typeof (globalThis as any).WAKZChatWidget !== 'undefined') {\n this.chatWidget = (globalThis as any).WAKZChatWidget;\n this.chatWidget.init({\n widgetId: this.config.chat.widgetId,\n position: this.config.chat.position ?? 'bottom-right',\n theme: this.config.chat.theme ?? {},\n autoOpen: this.config.chat.autoOpen ?? false,\n apiBaseUrl: this.config.apiBaseUrl,\n });\n return;\n }\n\n return new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://unpkg.com/@wakz/chat-widget@5.0.0/index.js';\n script.async = true;\n\n script.onload = () => {\n this.chatWidget = (globalThis as any).WAKZChatWidget;\n if (!this.chatWidget) {\n reject(new Error('WAKZ: Chat widget script loaded but WAKZChatWidget global not found.'));\n return;\n }\n this.chatWidget.init({\n widgetId: this.config.chat!.widgetId,\n position: this.config.chat!.position ?? 'bottom-right',\n theme: this.config.chat!.theme ?? {},\n autoOpen: this.config.chat!.autoOpen ?? false,\n apiBaseUrl: this.config.apiBaseUrl,\n });\n resolve();\n };\n\n script.onerror = () => {\n reject(new Error('WAKZ: Failed to load @wakz/chat-widget script.'));\n };\n\n document.head.appendChild(script);\n });\n }\n\n openChat(): void {\n if (!this.chatWidget) {\n console.warn('WAKZ: Chat widget not initialized. Call initChat() first.');\n return;\n }\n this.chatWidget.open();\n }\n\n closeChat(): void {\n if (!this.chatWidget) {\n console.warn('WAKZ: Chat widget not initialized. Call initChat() first.');\n return;\n }\n this.chatWidget.close();\n }\n\n // \u2500\u2500 Shield Methods (Web Crypto API \u2014 zero dependencies) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * Initializes the Cyber Shield engine.\n * Generates an AES-256-GCM symmetric key and an ECDH P-256 key pair.\n */\n async initShield(): Promise<void> {\n // Generate AES-256 key for symmetric encryption/decryption\n this.aesKey = await generateAESKey();\n\n // Generate ECDH P-256 key pair for key exchange / fingerprinting\n this.ecdhKeyPair = await generateKeyPair();\n\n this.shield = {\n antiTamper: this.config.shield?.enableAntiTamper ?? true,\n obfuscation: this.config.shield?.enableObfuscation ?? false,\n fingerprint: this.config.shield?.enableFingerprint ?? true,\n keyRotationInterval: this.config.shield?.keyRotationInterval ?? 3600000,\n initializedAt: Date.now(),\n };\n\n // Set up automatic key rotation if configured\n if (this.shield.keyRotationInterval > 0) {\n setInterval(\n () => this.rotateKey(),\n this.shield.keyRotationInterval,\n ).unref();\n }\n }\n\n private async rotateKey(): Promise<void> {\n this.aesKey = await generateAESKey();\n }\n\n /**\n * Encrypts a plaintext message using AES-256-GCM.\n * Returns a structured payload with ciphertext, IV, algorithm metadata, and timestamp.\n */\n async protect(message: string): Promise<ProtectedPayload> {\n if (!this.aesKey) {\n throw new Error('WAKZ: Shield not initialized. Call initShield() first.');\n }\n\n const { ciphertext, iv } = await aesEncrypt(this.aesKey, message);\n\n return {\n ciphertext,\n iv,\n algorithm: 'AES-256-GCM',\n timestamp: Date.now(),\n };\n }\n\n /**\n * Decrypts a protected payload back to the original plaintext string.\n */\n async unprotect(payload: ProtectedPayload): Promise<string> {\n if (!this.aesKey) {\n throw new Error('WAKZ: Shield not initialized. Call initShield() first.');\n }\n\n if (payload.algorithm !== 'AES-256-GCM') {\n throw new Error(`WAKZ: Unsupported algorithm \"${payload.algorithm}\". Expected \"AES-256-GCM\".`);\n }\n\n return aesDecrypt(this.aesKey, payload.ciphertext, payload.iv);\n }\n\n // \u2500\u2500 Lifecycle \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * Destroys all initialized services and cleans up resources.\n */\n destroy(): void {\n if (this.chatWidget?.destroy) {\n this.chatWidget.destroy();\n }\n this.chatWidget = null;\n this.shield = null;\n this.aesKey = null;\n this.ecdhKeyPair = null;\n }\n\n // \u2500\u2500 Info \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n getSDKInfo(): {\n version: string;\n name: string;\n chatLoaded: boolean;\n shieldActive: boolean;\n } {\n return {\n version: SDK_VERSION,\n name: '@wakz/sdk',\n chatLoaded: this.chatWidget !== null,\n shieldActive: this.shield !== null,\n };\n }\n}\n\nexport default WAKZ;\n"],
5
+ "mappings": "AAAO,IAAMA,EAAc,QA4B3B,eAAeC,GAAqC,CAClD,OAAO,OAAO,OAAO,YACnB,CAAE,KAAM,UAAW,OAAQ,GAAI,EAC/B,GACA,CAAC,UAAW,SAAS,CACvB,CACF,CAEA,SAASC,EAAoBC,EAA6B,CACxD,IAAMC,EAAQ,IAAI,WAAWD,CAAM,EAC/BE,EAAS,GACb,QAASC,EAAI,EAAGA,EAAIF,EAAM,WAAYE,IACpCD,GAAU,OAAO,aAAaD,EAAME,CAAC,CAAC,EAExC,OAAO,KAAKD,CAAM,CACpB,CAEA,SAASE,EAAoBC,EAA6B,CACxD,IAAMH,EAAS,KAAKG,CAAM,EACpBJ,EAAQ,IAAI,WAAWC,EAAO,MAAM,EAC1C,QAASC,EAAI,EAAGA,EAAID,EAAO,OAAQC,IACjCF,EAAME,CAAC,EAAID,EAAO,WAAWC,CAAC,EAEhC,OAAOF,EAAM,MACf,CAEA,eAAeK,EACbC,EACAC,EAC6C,CAC7C,IAAMC,EAAU,IAAI,YACdC,EAAK,OAAO,gBAAgB,IAAI,WAAW,EAAE,CAAC,EAC9CC,EAAY,MAAM,OAAO,OAAO,QACpC,CAAE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,EAEhE,MAAO,CACL,WAAAR,EACA,GAAAH,EACA,UAAW,cACX,UAAW,KAAK,IAAI,CACtB,CACF,CAKA,MAAM,UAAUY,EAA4C,CAC1D,GAAI,CAAC,KAAK,OACR,MAAM,IAAI,MAAM,wDAAwD,EAG1E,GAAIA,EAAQ,YAAc,cACxB,MAAM,IAAI,MAAM,gCAAgCA,EAAQ,SAAS,4BAA4B,EAG/F,OAAOV,EAAW,KAAK,OAAQU,EAAQ,WAAYA,EAAQ,EAAE,CAC/D,CAOA,SAAgB,CACV,KAAK,YAAY,SACnB,KAAK,WAAW,QAAQ,EAE1B,KAAK,WAAa,KAClB,KAAK,OAAS,KACd,KAAK,OAAS,KACd,KAAK,YAAc,IACrB,CAIA,YAKE,CACA,MAAO,CACL,QAASzB,EACT,KAAM,YACN,WAAY,KAAK,aAAe,KAChC,aAAc,KAAK,SAAW,IAChC,CACF,CACF,EAEO0B,EAAQP",
6
+ "names": ["SDK_VERSION", "generateAESKey", "arrayBufferToBase64", "buffer", "bytes", "binary", "i", "base64ToArrayBuffer", "base64", "aesEncrypt", "key", "plaintext", "encoder", "iv", "encrypted", "aesDecrypt", "ciphertext", "decrypted", "generateKeyPair", "WAKZ", "config", "resolve", "reject", "script", "message", "payload", "index_default"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var u=(n,t)=>{for(var i in t)o(n,i,{get:t[i],enumerable:!0})},f=(n,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of g(t))!y.call(n,r)&&r!==i&&o(n,r,{get:()=>t[r],enumerable:!(e=d(t,r))||e.enumerable});return n};var p=n=>f(o({},"__esModule",{value:!0}),n);var C={};u(C,{SDK_VERSION:()=>l,WAKZ:()=>a,default:()=>K});module.exports=p(C);var l="1.0.0";async function s(){return crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}function h(n){let t=new Uint8Array(n),i="";for(let e=0;e<t.byteLength;e++)i+=String.fromCharCode(t[e]);return btoa(i)}function c(n){let t=atob(n),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return i.buffer}async function m(n,t){let i=new TextEncoder,e=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:e},n,i.encode(t));return{ciphertext:h(r),iv:h(e.buffer)}}async function w(n,t,i){let e=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(c(i))},n,c(t));return new TextDecoder().decode(e)}async function b(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}var a=class{constructor(t){this.chatWidget=null;this.shield=null;this.aesKey=null;this.ecdhKeyPair=null;this.config=t}async initChat(){if(!this.config.chat?.widgetId)throw new Error("WAKZ: chat.widgetId is required to initialize the chat widget.");if(typeof globalThis.WAKZChatWidget<"u"){this.chatWidget=globalThis.WAKZChatWidget,this.chatWidget.init({widgetId:this.config.chat.widgetId,position:this.config.chat.position??"bottom-right",theme:this.config.chat.theme??{},autoOpen:this.config.chat.autoOpen??!1,apiBaseUrl:this.config.apiBaseUrl});return}return new Promise((t,i)=>{let e=document.createElement("script");e.src="https://unpkg.com/@wakz/chat-widget@5.0.0/index.js",e.async=!0,e.onload=()=>{if(this.chatWidget=globalThis.WAKZChatWidget,!this.chatWidget){i(new Error("WAKZ: Chat widget script loaded but WAKZChatWidget global not found."));return}this.chatWidget.init({widgetId:this.config.chat.widgetId,position:this.config.chat.position??"bottom-right",theme:this.config.chat.theme??{},autoOpen:this.config.chat.autoOpen??!1,apiBaseUrl:this.config.apiBaseUrl}),t()},e.onerror=()=>{i(new Error("WAKZ: Failed to load @wakz/chat-widget script."))},document.head.appendChild(e)})}openChat(){if(!this.chatWidget){console.warn("WAKZ: Chat widget not initialized. Call initChat() first.");return}this.chatWidget.open()}closeChat(){if(!this.chatWidget){console.warn("WAKZ: Chat widget not initialized. Call initChat() first.");return}this.chatWidget.close()}async initShield(){this.aesKey=await s(),this.ecdhKeyPair=await b(),this.shield={antiTamper:this.config.shield?.enableAntiTamper??!0,obfuscation:this.config.shield?.enableObfuscation??!1,fingerprint:this.config.shield?.enableFingerprint??!0,keyRotationInterval:this.config.shield?.keyRotationInterval??36e5,initializedAt:Date.now()},this.shield.keyRotationInterval>0&&setInterval(()=>this.rotateKey(),this.shield.keyRotationInterval).unref()}async rotateKey(){this.aesKey=await s()}async protect(t){if(!this.aesKey)throw new Error("WAKZ: Shield not initialized. Call initShield() first.");let{ciphertext:i,iv:e}=await m(this.aesKey,t);return{ciphertext:i,iv:e,algorithm:"AES-256-GCM",timestamp:Date.now()}}async unprotect(t){if(!this.aesKey)throw new Error("WAKZ: Shield not initialized. Call initShield() first.");if(t.algorithm!=="AES-256-GCM")throw new Error(`WAKZ: Unsupported algorithm "${t.algorithm}". Expected "AES-256-GCM".`);return w(this.aesKey,t.ciphertext,t.iv)}destroy(){this.chatWidget?.destroy&&this.chatWidget.destroy(),this.chatWidget=null,this.shield=null,this.aesKey=null,this.ecdhKeyPair=null}getSDKInfo(){return{version:l,name:"@wakz/sdk",chatLoaded:this.chatWidget!==null,shieldActive:this.shield!==null}}},K=a;
2
+ //# sourceMappingURL=wakz-sdk.min.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["export const SDK_VERSION = '1.0.0';\n\nexport interface WAKZConfig {\n chat?: {\n widgetId: string;\n position?: 'bottom-right' | 'bottom-left';\n theme?: Record<string, string>;\n autoOpen?: boolean;\n };\n shield?: {\n enableAntiTamper?: boolean;\n enableObfuscation?: boolean;\n enableFingerprint?: boolean;\n keyRotationInterval?: number;\n };\n apiBaseUrl?: string;\n}\n\ninterface ProtectedPayload {\n ciphertext: string;\n iv: string;\n tag?: string;\n algorithm: string;\n timestamp: number;\n}\n\n// \u2500\u2500\u2500 Crypto helpers (AES-256-GCM via Web Crypto API) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nasync function generateAESKey(): Promise<CryptoKey> {\n return crypto.subtle.generateKey(\n { name: 'AES-GCM', length: 256 },\n true,\n ['encrypt', 'decrypt'],\n );\n}\n\nfunction arrayBufferToBase64(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n}\n\nfunction base64ToArrayBuffer(base64: string): ArrayBuffer {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes.buffer;\n}\n\nasync function aesEncrypt(\n key: CryptoKey,\n plaintext: string,\n): Promise<{ ciphertext: string; iv: string }> {\n const encoder = new TextEncoder();\n const iv = crypto.getRandomValues(new Uint8Array(12));\n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv },\n key,\n encoder.encode(plaintext),\n );\n return {\n ciphertext: arrayBufferToBase64(encrypted),\n iv: arrayBufferToBase64(iv.buffer as ArrayBuffer),\n };\n}\n\nasync function aesDecrypt(\n key: CryptoKey,\n ciphertext: string,\n iv: string,\n): Promise<string> {\n const decrypted = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: new Uint8Array(base64ToArrayBuffer(iv)) },\n key,\n base64ToArrayBuffer(ciphertext),\n );\n return new TextDecoder().decode(decrypted);\n}\n\n// \u2500\u2500\u2500 ECDH Key-Pair generation (P-256) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nasync function generateKeyPair(): Promise<CryptoKeyPair> {\n return crypto.subtle.generateKey(\n { name: 'ECDH', namedCurve: 'P-256' },\n true,\n ['deriveKey'],\n );\n}\n\n// \u2500\u2500\u2500 WAKZ SDK Class \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport class WAKZ {\n private config: WAKZConfig;\n private chatWidget: any | null = null;\n private shield: any | null = null;\n private aesKey: CryptoKey | null = null;\n private ecdhKeyPair: CryptoKeyPair | null = null;\n\n constructor(config: WAKZConfig) {\n this.config = config;\n }\n\n // \u2500\u2500 Chat Methods \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * Dynamically loads and initializes the @wakz/chat-widget from unpkg CDN.\n * The widget exposes a global `WAKZChatWidget` object with init(), open(), close().\n */\n async initChat(): Promise<void> {\n if (!this.config.chat?.widgetId) {\n throw new Error('WAKZ: chat.widgetId is required to initialize the chat widget.');\n }\n\n // If already loaded, re-init with new config\n if (typeof (globalThis as any).WAKZChatWidget !== 'undefined') {\n this.chatWidget = (globalThis as any).WAKZChatWidget;\n this.chatWidget.init({\n widgetId: this.config.chat.widgetId,\n position: this.config.chat.position ?? 'bottom-right',\n theme: this.config.chat.theme ?? {},\n autoOpen: this.config.chat.autoOpen ?? false,\n apiBaseUrl: this.config.apiBaseUrl,\n });\n return;\n }\n\n return new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://unpkg.com/@wakz/chat-widget@5.0.0/index.js';\n script.async = true;\n\n script.onload = () => {\n this.chatWidget = (globalThis as any).WAKZChatWidget;\n if (!this.chatWidget) {\n reject(new Error('WAKZ: Chat widget script loaded but WAKZChatWidget global not found.'));\n return;\n }\n this.chatWidget.init({\n widgetId: this.config.chat!.widgetId,\n position: this.config.chat!.position ?? 'bottom-right',\n theme: this.config.chat!.theme ?? {},\n autoOpen: this.config.chat!.autoOpen ?? false,\n apiBaseUrl: this.config.apiBaseUrl,\n });\n resolve();\n };\n\n script.onerror = () => {\n reject(new Error('WAKZ: Failed to load @wakz/chat-widget script.'));\n };\n\n document.head.appendChild(script);\n });\n }\n\n openChat(): void {\n if (!this.chatWidget) {\n console.warn('WAKZ: Chat widget not initialized. Call initChat() first.');\n return;\n }\n this.chatWidget.open();\n }\n\n closeChat(): void {\n if (!this.chatWidget) {\n console.warn('WAKZ: Chat widget not initialized. Call initChat() first.');\n return;\n }\n this.chatWidget.close();\n }\n\n // \u2500\u2500 Shield Methods (Web Crypto API \u2014 zero dependencies) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * Initializes the Cyber Shield engine.\n * Generates an AES-256-GCM symmetric key and an ECDH P-256 key pair.\n */\n async initShield(): Promise<void> {\n // Generate AES-256 key for symmetric encryption/decryption\n this.aesKey = await generateAESKey();\n\n // Generate ECDH P-256 key pair for key exchange / fingerprinting\n this.ecdhKeyPair = await generateKeyPair();\n\n this.shield = {\n antiTamper: this.config.shield?.enableAntiTamper ?? true,\n obfuscation: this.config.shield?.enableObfuscation ?? false,\n fingerprint: this.config.shield?.enableFingerprint ?? true,\n keyRotationInterval: this.config.shield?.keyRotationInterval ?? 3600000,\n initializedAt: Date.now(),\n };\n\n // Set up automatic key rotation if configured\n if (this.shield.keyRotationInterval > 0) {\n setInterval(\n () => this.rotateKey(),\n this.shield.keyRotationInterval,\n ).unref();\n }\n }\n\n private async rotateKey(): Promise<void> {\n this.aesKey = await generateAESKey();\n }\n\n /**\n * Encrypts a plaintext message using AES-256-GCM.\n * Returns a structured payload with ciphertext, IV, algorithm metadata, and timestamp.\n */\n async protect(message: string): Promise<ProtectedPayload> {\n if (!this.aesKey) {\n throw new Error('WAKZ: Shield not initialized. Call initShield() first.');\n }\n\n const { ciphertext, iv } = await aesEncrypt(this.aesKey, message);\n\n return {\n ciphertext,\n iv,\n algorithm: 'AES-256-GCM',\n timestamp: Date.now(),\n };\n }\n\n /**\n * Decrypts a protected payload back to the original plaintext string.\n */\n async unprotect(payload: ProtectedPayload): Promise<string> {\n if (!this.aesKey) {\n throw new Error('WAKZ: Shield not initialized. Call initShield() first.');\n }\n\n if (payload.algorithm !== 'AES-256-GCM') {\n throw new Error(`WAKZ: Unsupported algorithm \"${payload.algorithm}\". Expected \"AES-256-GCM\".`);\n }\n\n return aesDecrypt(this.aesKey, payload.ciphertext, payload.iv);\n }\n\n // \u2500\u2500 Lifecycle \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * Destroys all initialized services and cleans up resources.\n */\n destroy(): void {\n if (this.chatWidget?.destroy) {\n this.chatWidget.destroy();\n }\n this.chatWidget = null;\n this.shield = null;\n this.aesKey = null;\n this.ecdhKeyPair = null;\n }\n\n // \u2500\u2500 Info \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n getSDKInfo(): {\n version: string;\n name: string;\n chatLoaded: boolean;\n shieldActive: boolean;\n } {\n return {\n version: SDK_VERSION,\n name: '@wakz/sdk',\n chatLoaded: this.chatWidget !== null,\n shieldActive: this.shield !== null,\n };\n }\n}\n\nexport default WAKZ;\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,SAAAC,EAAA,YAAAC,IAAA,eAAAC,EAAAL,GAAO,IAAME,EAAc,QA4B3B,eAAeI,GAAqC,CAClD,OAAO,OAAO,OAAO,YACnB,CAAE,KAAM,UAAW,OAAQ,GAAI,EAC/B,GACA,CAAC,UAAW,SAAS,CACvB,CACF,CAEA,SAASC,EAAoBC,EAA6B,CACxD,IAAMC,EAAQ,IAAI,WAAWD,CAAM,EAC/BE,EAAS,GACb,QAASC,EAAI,EAAGA,EAAIF,EAAM,WAAYE,IACpCD,GAAU,OAAO,aAAaD,EAAME,CAAC,CAAC,EAExC,OAAO,KAAKD,CAAM,CACpB,CAEA,SAASE,EAAoBC,EAA6B,CACxD,IAAMH,EAAS,KAAKG,CAAM,EACpBJ,EAAQ,IAAI,WAAWC,EAAO,MAAM,EAC1C,QAASC,EAAI,EAAGA,EAAID,EAAO,OAAQC,IACjCF,EAAME,CAAC,EAAID,EAAO,WAAWC,CAAC,EAEhC,OAAOF,EAAM,MACf,CAEA,eAAeK,EACbC,EACAC,EAC6C,CAC7C,IAAMC,EAAU,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AI,MAAM,wDAAwD,EAG1E,GAAM,CAAE,WAAAP,EAAY,GAAAH,CAAG,EAAI,MAAMJ,EAAW,KAAK,OAAQc,CAAO,EAEhE,MAAO,CACL,WAAAP,EACA,GAAAH,EACA,UAAW,cACX,UAAW,KAAK,IAAI,CACtB,CACF,CAKA,MAAM,UAAUW,EAA4C,CAC1D,GAAI,CAAC,KAAK,OACR,MAAM,IAAI,MAAM,wDAAwD,EAG1E,GAAIA,EAAQ,YAAc,cACxB,MAAM,IAAI,MAAM,gCAAgCA,EAAQ,SAAS,4BAA4B,EAG/F,OAAOT,EAAW,KAAK,OAAQS,EAAQ,WAAYA,EAAQ,EAAE,CAC/D,CAOA,SAAgB,CACV,KAAK,YAAY,SACnB,KAAK,WAAW,QAAQ,EAE1B,KAAK,WAAa,KAClB,KAAK,OAAS,KACd,KAAK,OAAS,KACd,KAAK,YAAc,IACrB,CAIA,YAKE,CACA,MAAO,CACL,QAAS3B,EACT,KAAM,YACN,WAAY,KAAK,aAAe,KAChC,aAAc,KAAK,SAAW,IAChC,CACF,CACF,EAEOE,EAAQD",
6
+ "names": ["index_exports", "__export", "SDK_VERSION", "WAKZ", "index_default", "__toCommonJS", "generateAESKey", "arrayBufferToBase64", "buffer", "bytes", "binary", "i", "base64ToArrayBuffer", "base64", "aesEncrypt", "key", "plaintext", "encoder", "iv", "encrypted", "aesDecrypt", "ciphertext", "decrypted", "generateKeyPair", "config", "resolve", "reject", "script", "message", "payload"]
7
+ }
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@wakz/sdk",
3
+ "version": "1.0.0",
4
+ "description": "WAKZ Platform SDK — Unified interface for WAKZ Chat Widget and Cyber Shield services",
5
+ "main": "dist/wakz-sdk.min.js",
6
+ "module": "dist/wakz-sdk.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "author": "mohamed64 <mohamed01140251843sayed@gmail.com>",
9
+ "license": "MIT",
10
+ "files": [
11
+ "dist/",
12
+ "README.md"
13
+ ],
14
+ "scripts": {
15
+ "build": "node build.mjs",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5.7.0",
20
+ "esbuild": "^0.24.0"
21
+ },
22
+ "keywords": [
23
+ "wakz",
24
+ "sdk",
25
+ "chat",
26
+ "widget",
27
+ "encryption",
28
+ "e2ee",
29
+ "cybersecurity",
30
+ "platform"
31
+ ]
32
+ }