wallaby-cash 2.0.1-alpha.9 → 2.0.1-native.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.
Files changed (41) hide show
  1. package/README.md +4 -21
  2. package/dist/base.d.ts +14 -6
  3. package/dist/helpers/base64.d.ts +1 -0
  4. package/dist/helpers/json-safe-parse.d.ts +1 -0
  5. package/dist/index.cjs.js +3678 -3414
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.esm.js +3843 -3598
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +3843 -3598
  10. package/dist/index.js.map +1 -1
  11. package/dist/lib/auth/auth.model.d.ts +104 -0
  12. package/dist/lib/auth/auth.service.d.ts +61 -18
  13. package/dist/lib/auth/authenticator.d.ts +22 -0
  14. package/dist/lib/auth/index.d.ts +1 -0
  15. package/dist/lib/auth/passkey.model.d.ts +5 -0
  16. package/dist/lib/auth/passkey.service.d.ts +73 -0
  17. package/dist/lib/auth/platform.d.ts +95 -0
  18. package/dist/lib/transactions/index.d.ts +12 -7
  19. package/dist/lib/transactions/transactions.model.d.ts +22 -0
  20. package/dist/lib/utils/cipher.service.d.ts +69 -3
  21. package/dist/lib/utils/constants.d.ts +4 -3
  22. package/dist/lib/utils/index.d.ts +1 -0
  23. package/dist/lib/utils/is-jwt-expired.d.ts +2 -0
  24. package/dist/lib/utils/storage.service.d.ts +11 -5
  25. package/dist/lib/wallet/wallet-data.service.d.ts +16 -1
  26. package/dist/lib/wallet/wallet-handlers.service.d.ts +26 -8
  27. package/dist/lib/wallet/wallet.service.d.ts +76 -97
  28. package/dist/package.json +20 -4
  29. package/dist/routes/auth.d.ts +5 -0
  30. package/dist/routes/index.d.ts +1 -0
  31. package/dist/routes/wallet.d.ts +6 -1
  32. package/dist/types/auth.d.ts +129 -19
  33. package/dist/types/base.d.ts +24 -4
  34. package/dist/types/common.d.ts +11 -3
  35. package/dist/types/error-response-codes.d.ts +33 -0
  36. package/dist/types/index.d.ts +1 -0
  37. package/dist/types/passkey-error-codes.d.ts +29 -0
  38. package/dist/types/storage.d.ts +32 -0
  39. package/dist/types/transactions.d.ts +16 -14
  40. package/dist/types/wallet.d.ts +49 -35
  41. package/package.json +17 -7
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # Getting started
1
+ # Wallaby Cash SDK
2
+
3
+ The SDK leverages Wallaby API as a gateway to web3 and the blockchain.
2
4
 
3
5
  ## Overview
4
6
 
5
7
  [![npm version](https://badge.fury.io/js/wallaby-cash.svg)](https://badge.fury.io/js/wallaby-cash)
6
8
  [![codecov](https://codecov.io/gh/WALLABY-WaaS/wallaby-sdk-js/branch/feat%2Fwallaby-cash-v2/graph/badge.svg?token=4HRLAUCK7S)](https://codecov.io/gh/WALLABY-WaaS/wallaby-sdk-js)
7
9
 
8
- The SDK leverages Wallaby API as a gateway to web3 and the blockchain.
9
-
10
10
  The SDK currently supports the following blockchains:
11
11
 
12
12
  - Algorand
@@ -14,6 +14,7 @@ The SDK currently supports the following blockchains:
14
14
  - Base
15
15
  - Binance chain
16
16
  - Bitcoin
17
+ - Bsc
17
18
  - Ethereum
18
19
  - Polygon
19
20
  - Sui
@@ -59,21 +60,3 @@ wallaby.wallets.getTokenBalance()
59
60
  wallaby.transactions.transfer()
60
61
  wallaby.system.getSupportedBlockchains()
61
62
  ```
62
-
63
- ## **Dependencies**
64
-
65
- **Required packages and functions used:**
66
-
67
- - [eth-crypto: v2.6.0 (Latest)](https://www.npmjs.com/package/eth-crypto)
68
-
69
- - `createIdentity`: Generates public/private key pair. Which are called `clientAuthPubKey` and `clientAuthPrivKey` in wallaby. _To differentiate them from wallaby’s key pair. Which are called `wallabyAuthPubKey` and `wallabyAuthPrivKey`_
70
- - `hash`: It uses `keccak256` function to hash the message string coming from wallaby.
71
- - `sign`: It generates a signature from a hashed message (with client public key) and the client private key
72
- - `encryptWithPublicKey`: Encrypts a string (_in our case the seed-phrase_) using the public key.
73
- - `decryptWithPrivateKey`: decrypts a string (_in our case the seed-phrase_) with the private key.
74
- - `publicKeyByPrivateKey`: Generates the public key using the private key.
75
-
76
- - [crypto-js v4.1.1 (latest)](https://www.npmjs.com/package/crypto-js)
77
- - `AES` used to encrypt the private key with the password.
78
- - [axios v1.3.4 (latest)](https://www.npmjs.com/package/axios)
79
- - `create`: used to instantiate an axios instance.
package/dist/base.d.ts CHANGED
@@ -1,14 +1,16 @@
1
- import { WallabyConfig, RequestOptions, RequestRoute, WallabyConfigOptions } from './types';
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
4
  export declare abstract class Base {
5
+ userId: string;
5
6
  private apiKey;
6
7
  private baseUrl;
7
- private jwt?;
8
8
  private clientAuthToken;
9
- userId: string;
10
- options?: WallabyConfigOptions;
9
+ protected deviceAuthType: AuthType;
10
+ protected options?: WallabyConfigOptions;
11
11
  constructor(config: WallabyConfig);
12
+ set setClientAuthToken(token: string);
13
+ private _initializeClientAuthToken;
12
14
  /**
13
15
  * This library uses `localStorage` as the default storage.
14
16
  * If you want to use a different storage, you can pass it in the options object of the Wallaby config.
@@ -20,7 +22,13 @@ export declare abstract class Base {
20
22
  /**
21
23
  * @protected
22
24
  */
23
- protected get device(): Promise<import("./types").DeviceInformation>;
25
+ protected get device(): {
26
+ deviceAuthType: AuthType;
27
+ 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>;
28
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<import("./types").DeviceInformation | TResult>;
29
+ finally(onfinally?: (() => void) | null | undefined): Promise<import("./types").DeviceInformation>;
30
+ [Symbol.toStringTag]: string;
31
+ };
24
32
  /**
25
33
  * @private
26
34
  */
@@ -37,5 +45,5 @@ export declare abstract class Base {
37
45
  * @returns Promise of <T> where T is the type of the response.
38
46
  */
39
47
  protected request<T>(route: RequestRoute, options?: RequestOptions): Promise<T | any>;
40
- private getRequestHeaders;
48
+ private _getRequestHeaders;
41
49
  }
@@ -1,2 +1,3 @@
1
1
  export declare function base64ToUint8Array(base64: string): Uint8Array;
2
2
  export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
3
+ export declare const decodeBase64URL: (base64url: string) => Uint8Array;
@@ -0,0 +1 @@
1
+ export declare function safeJsonParse<T>(jsonString: string): T | null;