signal-bridge 1.0.3

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.
@@ -0,0 +1,28 @@
1
+ declare function base64UrlEncode(str: string): string;
2
+ declare function base64UrlDecode(str: string): string;
3
+ declare function encrypt(data: any, secretKey: string): string;
4
+ declare function decrypt(encoded: string, secretKey: string): any;
5
+ declare function generateKey(length?: number): string;
6
+
7
+ type BridgeMessage = {
8
+ type: string;
9
+ payload: any;
10
+ txn: string;
11
+ __source: "host" | "remote";
12
+ __origin?: string;
13
+ };
14
+ type Listener = (message: BridgeMessage) => void;
15
+ interface BridgeOptions {
16
+ allowedHostOrigins: string[];
17
+ cryptoKey?: string;
18
+ debug?: boolean;
19
+ enableNavigationSync?: boolean;
20
+ }
21
+ declare function signalBridge(appId: string, options: BridgeOptions): {
22
+ init(): void;
23
+ listen(handler: Listener): void;
24
+ emit(type: string, payload: any): void;
25
+ destroy(): void;
26
+ };
27
+
28
+ export { base64UrlDecode, base64UrlEncode, decrypt, encrypt, generateKey, signalBridge };
@@ -0,0 +1,28 @@
1
+ declare function base64UrlEncode(str: string): string;
2
+ declare function base64UrlDecode(str: string): string;
3
+ declare function encrypt(data: any, secretKey: string): string;
4
+ declare function decrypt(encoded: string, secretKey: string): any;
5
+ declare function generateKey(length?: number): string;
6
+
7
+ type BridgeMessage = {
8
+ type: string;
9
+ payload: any;
10
+ txn: string;
11
+ __source: "host" | "remote";
12
+ __origin?: string;
13
+ };
14
+ type Listener = (message: BridgeMessage) => void;
15
+ interface BridgeOptions {
16
+ allowedHostOrigins: string[];
17
+ cryptoKey?: string;
18
+ debug?: boolean;
19
+ enableNavigationSync?: boolean;
20
+ }
21
+ declare function signalBridge(appId: string, options: BridgeOptions): {
22
+ init(): void;
23
+ listen(handler: Listener): void;
24
+ emit(type: string, payload: any): void;
25
+ destroy(): void;
26
+ };
27
+
28
+ export { base64UrlDecode, base64UrlEncode, decrypt, encrypt, generateKey, signalBridge };