wallaby-cash 3.5.2 → 3.6.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/base.d.ts +4 -1
- package/dist/helpers/algorand-mnemonic.d.ts +9 -0
- package/dist/index.cjs.js +1783 -1332
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +1784 -1331
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1784 -1331
- package/dist/index.js.map +1 -1
- package/dist/lib/api/api.d.ts +2 -1
- package/dist/lib/auth/auth.service.d.ts +12 -1
- package/dist/lib/auth/passkey.service.base.d.ts +2 -1
- package/dist/lib/swap/index.d.ts +2 -1
- package/dist/lib/system/index.d.ts +2 -1
- package/dist/lib/transactions/index.d.ts +2 -1
- package/dist/lib/utils/index.d.ts +2 -1
- package/dist/lib/utils/is-jwt-expired.d.ts +3 -3
- package/dist/lib/utils/ports.d.ts +22 -0
- package/dist/lib/wallet/wallet-data.service.d.ts +2 -1
- package/dist/lib/wallet/wallet-handlers.service.d.ts +2 -1
- package/dist/lib/wallet/wallet.service.d.ts +2 -1
- package/dist/package.json +6 -4
- package/dist/types/error-response-codes.d.ts +1 -0
- package/package.json +6 -4
package/dist/lib/api/api.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WallabyConfig } from '../../types';
|
|
2
2
|
import { Base } from '../../base';
|
|
3
|
+
import { Ports } from '../utils/ports';
|
|
3
4
|
/**
|
|
4
5
|
* HttpApi provides direct access to all REST API endpoints.
|
|
5
6
|
* This class extends the Base class and includes the generated API client
|
|
@@ -14,5 +15,5 @@ export declare class HttpApi extends Base {
|
|
|
14
15
|
* @param config - The Wallaby configuration object
|
|
15
16
|
* @public
|
|
16
17
|
*/
|
|
17
|
-
constructor(config: WallabyConfig);
|
|
18
|
+
constructor(config: WallabyConfig, ports?: Partial<Ports>);
|
|
18
19
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
|
+
import { Ports } from '../utils/ports';
|
|
2
3
|
import { SignatureMessageResponse, WallabyConfig, AuthenticationResponse, AsymmetricKeyPair, GetSignatureOptions, AuthenticationRequest } from '../../types';
|
|
3
4
|
import { GetPasskeyCredentialsData, IssueJWTTokenResponseDto } from '../../generated/api';
|
|
4
5
|
export declare class AuthService extends Base {
|
|
5
6
|
private passkeyService;
|
|
6
|
-
constructor(config: WallabyConfig);
|
|
7
|
+
constructor(config: WallabyConfig, ports?: Partial<Ports>);
|
|
7
8
|
/**
|
|
8
9
|
* @description
|
|
9
10
|
* This method is used to check if the user is on a device that supports PRF.
|
|
@@ -64,6 +65,16 @@ export declare class AuthService extends Base {
|
|
|
64
65
|
* @throws {Error} - Throws an error if the sign-up process fails.
|
|
65
66
|
*/
|
|
66
67
|
signIn(input: AuthenticationRequest): Promise<AuthenticationResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* @private
|
|
70
|
+
* @description Whether this device already has a stored `ClientAuthPublicKey`, which is written
|
|
71
|
+
* atomically alongside the device private key in every provisioning path. Its presence is proof
|
|
72
|
+
* the device was already provisioned: if it exists while the private key reads as missing we are
|
|
73
|
+
* looking at a partial read-miss / corruption — creating a new identity would orphan shares still
|
|
74
|
+
* wrapped to the old key. A device with no stored public key is instead treated as genuinely fresh.
|
|
75
|
+
* @returns {Promise<boolean>} true when a device public key is stored and a missing key means data loss.
|
|
76
|
+
*/
|
|
77
|
+
private hasStoredDevicePublicKey;
|
|
67
78
|
/**
|
|
68
79
|
*
|
|
69
80
|
* @private
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AsymmetricKeyPair, Encrypted, SignatureMessageResponse, AuthenticationResponse, RequestOptions, RequestRoute } from '../../types';
|
|
2
|
+
import { Cipher } from '../utils/cipher.service';
|
|
2
3
|
import { StorageService } from '../utils/storage.service';
|
|
3
4
|
import { AuthService } from './auth.service';
|
|
4
5
|
export declare class PasskeyService {
|
|
@@ -7,7 +8,7 @@ export declare class PasskeyService {
|
|
|
7
8
|
private userId;
|
|
8
9
|
private request;
|
|
9
10
|
private authenticator;
|
|
10
|
-
constructor(userId: string, storageService: StorageService, request: <T = any>(route: RequestRoute, options?: RequestOptions) => Promise<T
|
|
11
|
+
constructor(userId: string, storageService: StorageService, request: <T = any>(route: RequestRoute, options?: RequestOptions) => Promise<T>, cipher?: Cipher);
|
|
11
12
|
private preparePasskeyRequestOptions;
|
|
12
13
|
private preparePasskeyCreationOptions;
|
|
13
14
|
/**
|
package/dist/lib/swap/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
|
+
import { Ports } from '../utils/ports';
|
|
2
3
|
import { WallabyConfig, SwapQuoteRequest, SwapQuoteResponse, ExecuteSwapRequest, ExecuteSwapResponse, GetSwapsRequest, GetSwapsResponse } from '../../types';
|
|
3
4
|
export declare class Swap extends Base {
|
|
4
5
|
private authService;
|
|
5
6
|
private walletService;
|
|
6
|
-
constructor(config: WallabyConfig);
|
|
7
|
+
constructor(config: WallabyConfig, ports?: Partial<Ports>);
|
|
7
8
|
/**
|
|
8
9
|
* Gets a swap quote between two assets, including fees, min output, and slippage limits.
|
|
9
10
|
*
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
|
+
import { Ports } from '../utils/ports';
|
|
2
3
|
import { WallabyConfig, Blockchain, AssetConfig, User, BlockchainName } from '../../types';
|
|
3
4
|
export declare class System extends Base {
|
|
4
|
-
constructor(config: WallabyConfig);
|
|
5
|
+
constructor(config: WallabyConfig, ports?: Partial<Ports>);
|
|
5
6
|
/**
|
|
6
7
|
* @public
|
|
7
8
|
* Get all supported chains
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
|
+
import { Ports } from '../utils/ports';
|
|
2
3
|
import { WallabyConfig, FeeEstimatesResponse, BlockchainName, GetPendingTransactionsRequest, GetPendingTransactionsResponse, ResolvePendingTransactionRequest, ResolvePendingTransactionResponse, TransactionResponse, FeeEstimateRequest } from '../../types';
|
|
3
4
|
import { DetectRestrictionResponseDto, GetRestrictionParams, GetTransactionsParams, GetTransactionsResponseDto } from '../../generated/api';
|
|
4
5
|
import { CreateAllowanceRequest, TransactionStatusResponse, TransferRequest } from '../../types';
|
|
5
6
|
export declare class Transactions extends Base {
|
|
6
7
|
private authService;
|
|
7
8
|
private walletService;
|
|
8
|
-
constructor(config: WallabyConfig);
|
|
9
|
+
constructor(config: WallabyConfig, ports?: Partial<Ports>);
|
|
9
10
|
/**
|
|
10
11
|
*
|
|
11
12
|
* @public
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { UtilsResponse, PasswordValidatorResponse, WallabyConfig, RequestMethod } from '../../types';
|
|
2
2
|
import { Base } from '../../base';
|
|
3
|
+
import { Ports } from './ports';
|
|
3
4
|
export declare class Utils extends Base {
|
|
4
5
|
private auth;
|
|
5
|
-
constructor(config: WallabyConfig);
|
|
6
|
+
constructor(config: WallabyConfig, ports?: Partial<Ports>);
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
8
9
|
* @param { string } password
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param jwt - The JWT string to check. If null, the function will return true.
|
|
5
5
|
* @returns `true` if the JWT has expired or is null, otherwise `false`.
|
|
6
6
|
*/
|
|
7
|
-
export declare function jwtHasExpired(jwt: string | null): boolean;
|
|
7
|
+
export declare function jwtHasExpired(jwt: string | null, now?: () => number): boolean;
|
|
8
8
|
export declare function jwtHasSameUser(jwt: string | null, userId: string): boolean;
|
|
9
9
|
export declare function userIsMfaVerified(jwt: string): boolean;
|
|
10
10
|
/**
|
|
@@ -14,11 +14,11 @@ export declare function userIsMfaVerified(jwt: string): boolean;
|
|
|
14
14
|
* @param thresholdSeconds - Number of seconds before expiry to consider "near expiry".
|
|
15
15
|
* @returns `true` if the JWT expires within `thresholdSeconds` seconds, otherwise `false`.
|
|
16
16
|
*/
|
|
17
|
-
export declare function isJwtNearExpiry(jwt: string | null, thresholdSeconds: number): boolean;
|
|
17
|
+
export declare function isJwtNearExpiry(jwt: string | null, thresholdSeconds: number, now?: () => number): boolean;
|
|
18
18
|
/**
|
|
19
19
|
* Calculates the remaining time in milliseconds until a given JWT expires.
|
|
20
20
|
*
|
|
21
21
|
* @param jwt - The JWT string to decode and check.
|
|
22
22
|
* @returns The number of milliseconds until the JWT expires. If the JWT has already expired, the returned value will be less than or equal to 0.
|
|
23
23
|
*/
|
|
24
|
-
export declare function millisecondsToJWTTimeout(jwt: string): number;
|
|
24
|
+
export declare function millisecondsToJWTTimeout(jwt: string, now?: () => number): number;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Cipher } from './cipher.service';
|
|
2
|
+
/**
|
|
3
|
+
* Internal boundary ports injected into {@link Base} and the service tree.
|
|
4
|
+
*
|
|
5
|
+
* These are *not* part of the public SDK config. They exist so tests can supply
|
|
6
|
+
* in-memory fakes (a route-backed transport, a fixed clock, a stub cipher)
|
|
7
|
+
* instead of intercepting the network or relying on real crypto/time.
|
|
8
|
+
*
|
|
9
|
+
* Storage is intentionally absent: it already rides on `config.options.storage`,
|
|
10
|
+
* which propagates through every `new XService(config)` for free.
|
|
11
|
+
*
|
|
12
|
+
* Every port is optional; {@link Base} fills in the real adapter (global `fetch`,
|
|
13
|
+
* `Date.now`, `new Cipher()`) when a port is not provided.
|
|
14
|
+
*/
|
|
15
|
+
export interface Clock {
|
|
16
|
+
now(): number;
|
|
17
|
+
}
|
|
18
|
+
export interface Ports {
|
|
19
|
+
transport: typeof fetch;
|
|
20
|
+
clock: Clock;
|
|
21
|
+
cipher: Cipher;
|
|
22
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
|
+
import { Ports } from '../utils/ports';
|
|
2
3
|
import { AddTokenToWalletRequest, BlockchainName, QueryUserRequest, QueryWalletRequest, TokenBalanceRequest, UpdateAssetRequest, WallabyConfig, WalletAddressesInfoEntry, AuthenticationResponse, AddTokenToWalletResponse, TokenBalanceResponse, TokenBalance, UpdateAssetResponse } from '../../types';
|
|
3
4
|
import { FetchBalanceData, GetAllWalletsFromUserIdData, GetAssetsByUserIdData, GetUserAssetsByWalletIdData } from '../../generated/api';
|
|
4
5
|
export declare class WalletDataService extends Base {
|
|
5
6
|
private walletService;
|
|
6
|
-
constructor(config: WallabyConfig);
|
|
7
|
+
constructor(config: WallabyConfig, ports?: Partial<Ports>);
|
|
7
8
|
/**
|
|
8
9
|
* @description Validates the wallet address info for a given blockchain.
|
|
9
10
|
* @param { WalletAddressesInfoEntry } walletAddressesInfo The wallet address info array containing addresses for different blockchains.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
|
+
import { Ports } from '../utils/ports';
|
|
2
3
|
import { ImportWalletRequest, CreateWalletRequest, Encrypted, WallabyConfig, ImportWalletResponse, RecoverWalletResponse, SymmetricEncrypted } from '../../types';
|
|
3
4
|
import { KeyShareDto } from '../../generated/api';
|
|
4
5
|
export declare class WalletHandlersService extends Base {
|
|
5
6
|
private authService;
|
|
6
|
-
constructor(config: WallabyConfig);
|
|
7
|
+
constructor(config: WallabyConfig, ports?: Partial<Ports>);
|
|
7
8
|
handleImportWallet(deviceAuthKeys: {
|
|
8
9
|
publicKey: string;
|
|
9
10
|
privateKey: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
|
+
import { Ports } from '../utils/ports';
|
|
2
3
|
import { CreateWalletRequest, CreateWalletResponse, Encrypted, WallabyConfig, ExportWalletRequest, ImportWalletRequest, AddNewDeviceRequest, RecoverWalletRequest, InitAddNewDeviceResponse, GenerateMissingAddressResponseDto, AuthenticationResponse, BlockchainName, ImportWalletResponse, RecoverWalletResponse } from '../../types';
|
|
3
4
|
export declare class WalletService extends Base {
|
|
4
5
|
private authService;
|
|
@@ -6,7 +7,7 @@ export declare class WalletService extends Base {
|
|
|
6
7
|
private passkeyService;
|
|
7
8
|
private static readonly RATE_LIMIT_MAX;
|
|
8
9
|
private static readonly RATE_LIMIT_WINDOW_MS;
|
|
9
|
-
constructor(config: WallabyConfig);
|
|
10
|
+
constructor(config: WallabyConfig, ports?: Partial<Ports>);
|
|
10
11
|
/**
|
|
11
12
|
* Reads the persisted sliding-window rate-limit state for a counter key.
|
|
12
13
|
* Returns a fresh window ({ count: 0 }) when none is stored or the window has expired.
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wallaby-cash",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/WALLABY-WaaS/wallaby-sdk-js"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">=20"
|
|
31
31
|
},
|
|
32
|
-
"packageManager": "npm@11.
|
|
32
|
+
"packageManager": "npm@11.16.0",
|
|
33
33
|
"scripts": {
|
|
34
34
|
"prestart": "npm ./scripts/start.sh",
|
|
35
35
|
"prebuild": "rimraf dist",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"docs:generate": "npx typedoc",
|
|
51
51
|
"generate:types": "node scripts/generate-api-types.mjs",
|
|
52
52
|
"generate:types:local": "node scripts/generate-api-types.mjs --local",
|
|
53
|
+
"changeset:version": "changeset version && npm install --package-lock-only",
|
|
53
54
|
"release": "npm publish",
|
|
54
55
|
"release:alpha": "npm run build && npm publish --tag alpha",
|
|
55
56
|
"release:native": "npm run build && npm publish --tag native",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@changesets/cli": "^2.31.0",
|
|
63
|
+
"@noble/hashes": "1.8.0",
|
|
62
64
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
63
65
|
"@rollup/plugin-json": "^6.1.0",
|
|
64
66
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
@@ -80,6 +82,7 @@
|
|
|
80
82
|
"@types/uuid": "^10.0.0",
|
|
81
83
|
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
|
82
84
|
"@typescript-eslint/parser": "^8.6.0",
|
|
85
|
+
"algosdk": "^3.6.0",
|
|
83
86
|
"eslint": "^8.57.1",
|
|
84
87
|
"eslint-config-prettier": "^9.1.0",
|
|
85
88
|
"eslint-plugin-prettier": "^5.2.1",
|
|
@@ -104,10 +107,9 @@
|
|
|
104
107
|
"underscore": "^1.13.8"
|
|
105
108
|
},
|
|
106
109
|
"dependencies": {
|
|
107
|
-
"algosdk": "^3.5.2",
|
|
108
110
|
"bip39": "^3.1.0",
|
|
109
111
|
"crypto-js": "4.2.0",
|
|
110
|
-
"ethereum-cryptography": "^3.
|
|
112
|
+
"ethereum-cryptography": "^3.2.0",
|
|
111
113
|
"js-base64": "^3.7.7",
|
|
112
114
|
"jwt-decode": "^4.0.0",
|
|
113
115
|
"loglevel": "^1.9.2",
|
|
@@ -47,6 +47,7 @@ export declare enum ErrorResponseCodes {
|
|
|
47
47
|
'sdk_seed_phrase_not_found' = "sdk_seed_phrase_not_found",
|
|
48
48
|
'sdk_private_key_decryption_failed' = "sdk_private_key_decryption_failed",
|
|
49
49
|
'sdk_private_key_not_found' = "sdk_private_key_not_found",
|
|
50
|
+
'sdk_device_key_missing_with_existing_data' = "sdk_device_key_missing_with_existing_data",
|
|
50
51
|
'sdk_refresh_token_missing' = "sdk_refresh_token_missing",
|
|
51
52
|
'sdk_missing_parameter' = "sdk_missing_parameter",
|
|
52
53
|
'sdk_invalid_parameter' = "sdk_invalid_parameter",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wallaby-cash",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/WALLABY-WaaS/wallaby-sdk-js"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">=20"
|
|
31
31
|
},
|
|
32
|
-
"packageManager": "npm@11.
|
|
32
|
+
"packageManager": "npm@11.16.0",
|
|
33
33
|
"scripts": {
|
|
34
34
|
"prestart": "npm ./scripts/start.sh",
|
|
35
35
|
"prebuild": "rimraf dist",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"docs:generate": "npx typedoc",
|
|
51
51
|
"generate:types": "node scripts/generate-api-types.mjs",
|
|
52
52
|
"generate:types:local": "node scripts/generate-api-types.mjs --local",
|
|
53
|
+
"changeset:version": "changeset version && npm install --package-lock-only",
|
|
53
54
|
"release": "npm publish",
|
|
54
55
|
"release:alpha": "npm run build && npm publish --tag alpha",
|
|
55
56
|
"release:native": "npm run build && npm publish --tag native",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@changesets/cli": "^2.31.0",
|
|
63
|
+
"@noble/hashes": "1.8.0",
|
|
62
64
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
63
65
|
"@rollup/plugin-json": "^6.1.0",
|
|
64
66
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
@@ -80,6 +82,7 @@
|
|
|
80
82
|
"@types/uuid": "^10.0.0",
|
|
81
83
|
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
|
82
84
|
"@typescript-eslint/parser": "^8.6.0",
|
|
85
|
+
"algosdk": "^3.6.0",
|
|
83
86
|
"eslint": "^8.57.1",
|
|
84
87
|
"eslint-config-prettier": "^9.1.0",
|
|
85
88
|
"eslint-plugin-prettier": "^5.2.1",
|
|
@@ -104,10 +107,9 @@
|
|
|
104
107
|
"underscore": "^1.13.8"
|
|
105
108
|
},
|
|
106
109
|
"dependencies": {
|
|
107
|
-
"algosdk": "^3.5.2",
|
|
108
110
|
"bip39": "^3.1.0",
|
|
109
111
|
"crypto-js": "4.2.0",
|
|
110
|
-
"ethereum-cryptography": "^3.
|
|
112
|
+
"ethereum-cryptography": "^3.2.0",
|
|
111
113
|
"js-base64": "^3.7.7",
|
|
112
114
|
"jwt-decode": "^4.0.0",
|
|
113
115
|
"loglevel": "^1.9.2",
|