wallaby-cash 2.0.1-alpha.34 → 2.0.1-alpha.35

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.
Files changed (39) hide show
  1. package/README.md +3 -0
  2. package/dist/base.d.ts +9 -13
  3. package/dist/eth-crypto-utils/createIdentity.d.ts +1 -0
  4. package/dist/helpers/json-safe-parse.d.ts +2 -1
  5. package/dist/helpers/lock-manager.service.d.ts +20 -0
  6. package/dist/helpers/validation.d.ts +4 -0
  7. package/dist/helpers/with-lock.d.ts +5 -0
  8. package/dist/index.cjs.js +4401 -5200
  9. package/dist/index.cjs.js.map +1 -1
  10. package/dist/index.esm.js +4421 -5220
  11. package/dist/index.esm.js.map +1 -1
  12. package/dist/index.js +4421 -5220
  13. package/dist/index.js.map +1 -1
  14. package/dist/lib/auth/auth.service.d.ts +13 -3
  15. package/dist/lib/auth/authenticator.d.ts +22 -0
  16. package/dist/lib/auth/index.d.ts +1 -0
  17. package/dist/lib/auth/passkey.model.d.ts +5 -0
  18. package/dist/lib/auth/passkey.service.d.ts +6 -10
  19. package/dist/lib/auth/platform.d.ts +95 -0
  20. package/dist/lib/merchants/index.d.ts +9 -0
  21. package/dist/lib/transactions/index.d.ts +3 -4
  22. package/dist/lib/utils/cipher.service.d.ts +34 -3
  23. package/dist/lib/utils/constants.d.ts +11 -0
  24. package/dist/lib/utils/index.d.ts +5 -1
  25. package/dist/lib/utils/is-jwt-expired.d.ts +1 -1
  26. package/dist/lib/utils/storage.service.d.ts +39 -17
  27. package/dist/lib/wallet/wallet-handlers.service.d.ts +9 -8
  28. package/dist/lib/wallet/wallet.service.d.ts +53 -8
  29. package/dist/package.json +7 -3
  30. package/dist/routes/auth.d.ts +5 -0
  31. package/dist/routes/wallet.d.ts +5 -0
  32. package/dist/types/auth.d.ts +25 -0
  33. package/dist/types/base.d.ts +5 -3
  34. package/dist/types/common.d.ts +14 -7
  35. package/dist/types/passkey-error-codes.d.ts +29 -0
  36. package/dist/types/storage.d.ts +2 -1
  37. package/dist/types/transactions.d.ts +1 -0
  38. package/dist/types/wallet.d.ts +6 -5
  39. package/package.json +7 -3
package/README.md CHANGED
@@ -18,6 +18,9 @@ The SDK currently supports the following blockchains:
18
18
  - Ethereum
19
19
  - Polygon
20
20
  - Sui
21
+ - Injective
22
+ - Sei
23
+ - Aptos
21
24
 
22
25
  ## Install the SDK
23
26
 
package/dist/base.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { WallabyConfig, RequestOptions, RequestRoute, WallabyConfigOptions, AuthType } from './types';
2
2
  import { StorageService } from './lib/utils/storage.service';
3
3
  import { LocalStorage } from './types/storage';
4
+ import { LockManagerService } from './helpers/lock-manager.service';
5
+ import { Cipher } from './lib/utils/cipher.service';
4
6
  export declare abstract class Base {
5
7
  userId: string;
6
8
  private apiKey;
@@ -8,7 +10,11 @@ export declare abstract class Base {
8
10
  private clientAuthToken;
9
11
  protected deviceAuthType: AuthType;
10
12
  protected options?: WallabyConfigOptions;
13
+ protected lockManager: LockManagerService;
14
+ protected cipher: Cipher;
11
15
  constructor(config: WallabyConfig);
16
+ set setClientAuthToken(token: string);
17
+ private _initializeClientAuthToken;
12
18
  /**
13
19
  * This library uses `localStorage` as the default storage.
14
20
  * If you want to use a different storage, you can pass it in the options object of the Wallaby config.
@@ -16,17 +22,7 @@ export declare abstract class Base {
16
22
  * {
17
23
  * }
18
24
  */
19
- get deviceStorage(): LocalStorage;
20
- /**
21
- * @protected
22
- */
23
- protected get device(): {
24
- deviceAuthType: AuthType;
25
- then<TResult1 = import("./types").DeviceInformation, TResult2 = never>(onfulfilled?: ((value: import("./types").DeviceInformation) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
26
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<import("./types").DeviceInformation | TResult>;
27
- finally(onfinally?: (() => void) | null | undefined): Promise<import("./types").DeviceInformation>;
28
- [Symbol.toStringTag]: string;
29
- };
25
+ get deviceLocalStorage(): LocalStorage;
30
26
  /**
31
27
  * @private
32
28
  */
@@ -34,7 +30,7 @@ export declare abstract class Base {
34
30
  /**
35
31
  * @protected
36
32
  */
37
- get storageService(): StorageService;
33
+ get localStorageService(): StorageService;
38
34
  /**
39
35
  *
40
36
  * This is the main request method that is used to make requests to the Wallaby API.
@@ -43,5 +39,5 @@ export declare abstract class Base {
43
39
  * @returns Promise of <T> where T is the type of the response.
44
40
  */
45
41
  protected request<T>(route: RequestRoute, options?: RequestOptions): Promise<T | any>;
46
- private getRequestHeaders;
42
+ private _getRequestHeaders;
47
43
  }
@@ -1,4 +1,5 @@
1
1
  export declare const DEFAULT_ENTROPY_BYTES = 32;
2
+ export declare const MINIMUM_SHANNON_ENTROPY = 4;
2
3
  /**
3
4
  * creates a new private key
4
5
  * @param { Uint8Array } entropy - optional entropy to create the private key
@@ -1 +1,2 @@
1
- export declare function safeJsonParse<T>(jsonString: string): T | null;
1
+ export declare function safeJsonParse<T>(jsonString: string): T;
2
+ export declare function isJsonString(str: string): boolean;
@@ -0,0 +1,20 @@
1
+ export declare class LockManagerService {
2
+ private activeLocks;
3
+ /**
4
+ * Acquires a lock for the given key and executes the operation
5
+ * @param key - Unique identifier for the lock (e.g., 'changePassword', 'wallet-create')
6
+ * @param operation - The async operation to execute while locked
7
+ * @returns Promise that resolves with the operation result
8
+ */
9
+ withLock<T>(key: string, operation: () => Promise<T>): Promise<T>;
10
+ /**
11
+ * Check if a specific operation is currently locked
12
+ * @param key - The lock key to check
13
+ * @returns boolean indicating if the operation is locked
14
+ */
15
+ isLocked(key: string): boolean;
16
+ /**
17
+ * Clear all locks (useful for testing or cleanup)
18
+ */
19
+ clearAllLocks(): void;
20
+ }
@@ -0,0 +1,4 @@
1
+ import { WallabyConfig } from '../types';
2
+ export declare function isValidInput(input: string): boolean;
3
+ export declare function isValidJwt(token: string): boolean;
4
+ export declare function sanitizeConfig(config: WallabyConfig): WallabyConfig;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Decorator that automatically applies a lock to a method
3
+ * @param lockKey - The key to use for locking. If not provided, uses className:methodName
4
+ */
5
+ export declare function WithLock(lockKey?: string): <T extends (...args: any[]) => Promise<any>>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;