wallaby-cash 2.0.1-native.2 → 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.
- package/dist/base.d.ts +3 -1
- package/dist/helpers/base64.d.ts +3 -0
- package/dist/index.cjs.js +1167 -728
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1168 -729
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1168 -729
- package/dist/index.js.map +1 -1
- package/dist/lib/auth/auth.model.d.ts +3 -1
- package/dist/lib/auth/auth.service.d.ts +7 -15
- package/dist/lib/auth/authenticator.d.ts +10 -17
- package/dist/lib/auth/passkey.service.d.ts +2 -0
- package/dist/lib/transactions/index.d.ts +6 -2
- package/dist/lib/utils/cipher.service.d.ts +1 -1
- package/dist/lib/utils/constants.d.ts +1 -1
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/storage.service.d.ts +11 -5
- package/dist/lib/wallet/wallet-data.service.d.ts +16 -1
- package/dist/lib/wallet/wallet-handlers.service.d.ts +11 -1
- package/dist/lib/wallet/wallet.service.d.ts +39 -4
- package/dist/package.json +3 -2
- package/dist/routes/auth.d.ts +5 -0
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/wallet.d.ts +5 -0
- package/dist/types/auth.d.ts +98 -3
- package/dist/types/common.d.ts +3 -0
- package/dist/types/storage.d.ts +30 -0
- package/dist/types/transactions.d.ts +13 -10
- package/dist/types/wallet.d.ts +4 -7
- package/package.json +3 -2
|
@@ -51,10 +51,12 @@ export declare type SignatureResponse = {
|
|
|
51
51
|
hashedMessage: string;
|
|
52
52
|
message: string;
|
|
53
53
|
};
|
|
54
|
+
export declare type Base64URLString = string;
|
|
54
55
|
export interface PRFExtension {
|
|
55
56
|
prf?: {
|
|
56
57
|
eval?: {
|
|
57
|
-
|
|
58
|
+
base64: Base64URLString;
|
|
59
|
+
first: Uint8Array;
|
|
58
60
|
second?: Uint8Array;
|
|
59
61
|
};
|
|
60
62
|
[key: string]: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
|
-
import { AuthType, SignatureMessageResponse, WallabyConfig, AuthResponse, RefreshAccessTokenResponse, ClientAuthPubKeyResponse } from '../../types';
|
|
2
|
+
import { AuthType, SignatureMessageResponse, WallabyConfig, AuthResponse, RefreshAccessTokenResponse, ClientAuthPubKeyResponse, AsymmetricKeyPair, PasskeyCredential } from '../../types';
|
|
3
3
|
import { AuthenticationRequest } from './auth.model';
|
|
4
4
|
export declare class AuthService extends Base {
|
|
5
5
|
private cipher;
|
|
@@ -28,13 +28,10 @@ export declare class AuthService extends Base {
|
|
|
28
28
|
* @description
|
|
29
29
|
* It registers the client's device public key with Wallaby server and gets back a random message string.
|
|
30
30
|
* The random string will be hashed and signed by the client's device private key and sent back to Wallaby for verification.
|
|
31
|
-
* @param {
|
|
31
|
+
* @param { AsymmetricKeyPair } deviceAuthKeys the device key pair to register with wallaby.
|
|
32
32
|
* @returns the messaged, the hash, and the signature using the passed private key.
|
|
33
33
|
*/
|
|
34
|
-
getSignature(deviceAuthKeys:
|
|
35
|
-
publicKey: string;
|
|
36
|
-
privateKey: string;
|
|
37
|
-
}): Promise<SignatureMessageResponse>;
|
|
34
|
+
getSignature(deviceAuthKeys: AsymmetricKeyPair): Promise<SignatureMessageResponse>;
|
|
38
35
|
/**
|
|
39
36
|
* Signs up a new user.
|
|
40
37
|
*
|
|
@@ -64,14 +61,8 @@ export declare class AuthService extends Base {
|
|
|
64
61
|
private handleSignInWithPassword;
|
|
65
62
|
private handleSignInWithPasskey;
|
|
66
63
|
storeDeviceKeyPair({ deviceAuthKeyPair, credentialsKeyPair, }: {
|
|
67
|
-
deviceAuthKeyPair:
|
|
68
|
-
|
|
69
|
-
privateKey: string;
|
|
70
|
-
};
|
|
71
|
-
credentialsKeyPair: {
|
|
72
|
-
publicKey: string;
|
|
73
|
-
privateKey: string;
|
|
74
|
-
};
|
|
64
|
+
deviceAuthKeyPair: AsymmetricKeyPair;
|
|
65
|
+
credentialsKeyPair: AsymmetricKeyPair;
|
|
75
66
|
}): Promise<void>;
|
|
76
67
|
/**
|
|
77
68
|
*
|
|
@@ -94,9 +85,10 @@ export declare class AuthService extends Base {
|
|
|
94
85
|
* Signs up the user using the password encryption mechanism.
|
|
95
86
|
* @param { SignatureMessageResponse } signatureMessage - signature message response from `this.getSignature`.
|
|
96
87
|
* @param { AuthenticationRequest } input - The authentication request containing user details and encryption mechanism.
|
|
97
|
-
* @param {
|
|
88
|
+
* @param { AsymmetricKeyPair } deviceAuthKeys - The device key pair to register with Wallaby.
|
|
98
89
|
* @returns {Promise<AuthResponse>} - The authentication response containing user details and access token.
|
|
99
90
|
* @throws Throws an error if the passkey creation fails.
|
|
100
91
|
*/
|
|
101
92
|
private handleSignUpWithPassword;
|
|
93
|
+
getPasskeyCredentials(): Promise<PasskeyCredential[]>;
|
|
102
94
|
}
|
|
@@ -1,29 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Authenticator Implementation
|
|
3
|
+
*
|
|
4
|
+
* This file contains the web-specific authenticator logic using WebAuthn.
|
|
5
|
+
* It's automatically picked up by web bundlers (webpack, Rollup, etc.) when importing './authenticator'
|
|
6
|
+
*
|
|
7
|
+
* React Native will use authenticator.native.ts instead due to the .native.ts extension.
|
|
8
|
+
*/
|
|
1
9
|
import * as WebAuthn from '@simplewebauthn/browser';
|
|
2
|
-
import { PasskeyError } from 'react-native-passkey';
|
|
3
10
|
import { IAuthenticator } from './passkey.model';
|
|
4
|
-
export declare enum AuthenticatorTransport {
|
|
5
|
-
usb = "usb",
|
|
6
|
-
nfc = "nfc",
|
|
7
|
-
ble = "ble",
|
|
8
|
-
smartCard = "smart-card",
|
|
9
|
-
hybrid = "hybrid",
|
|
10
|
-
internal = "internal"
|
|
11
|
-
}
|
|
12
11
|
export declare class Authenticator implements IAuthenticator {
|
|
13
|
-
private platform;
|
|
14
12
|
constructor();
|
|
15
13
|
register({ optionsJSON }: WebAuthn.StartRegistrationOpts): Promise<WebAuthn.RegistrationResponseJSON>;
|
|
16
14
|
authenticate({ optionsJSON }: WebAuthn.StartAuthenticationOpts): Promise<WebAuthn.AuthenticationResponseJSON>;
|
|
17
15
|
/**
|
|
18
|
-
*
|
|
19
16
|
* @description Handles the passkey error and throws a user-friendly error message.
|
|
20
|
-
* @param {WebAuthnError |
|
|
17
|
+
* @param {WebAuthnError | Error | any} error
|
|
21
18
|
* @returns {Error} The error message.
|
|
22
19
|
*/
|
|
23
|
-
handlePasskeyError(error: WebAuthn.WebAuthnError |
|
|
20
|
+
handlePasskeyError(error: WebAuthn.WebAuthnError | Error | any): void;
|
|
24
21
|
private throwPasskeyError;
|
|
25
|
-
private mapPasskeyCreationPayload;
|
|
26
|
-
private mapPasskeyCreationResponse;
|
|
27
|
-
private mapPasskeyAuthenticationResponse;
|
|
28
|
-
private mapPasskeyAuthenticationPayload;
|
|
29
22
|
}
|
|
@@ -7,6 +7,8 @@ export declare class PasskeyService {
|
|
|
7
7
|
private request;
|
|
8
8
|
private authenticator;
|
|
9
9
|
constructor(userId: string, storageService: StorageService, request: <T>(route: RequestRoute, options?: RequestOptions) => Promise<T>);
|
|
10
|
+
private preparePasskeyRequestOptions;
|
|
11
|
+
private preparePasskeyCreationOptions;
|
|
10
12
|
/**
|
|
11
13
|
* @description Adds a new passkey to the user's account on that device.
|
|
12
14
|
* @param { AsymmetricKeyPair } deviceKeyPair
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
2
|
import { WallabyConfig, BlockchainName, TokenStandard } from '../../types';
|
|
3
3
|
import { CreateAllowanceRequest, FeeEstimatesResponse, Transaction, TransactionStatusResponse, TransferRequest, TransactionResponse } from '../../types';
|
|
4
|
-
import {
|
|
4
|
+
import { FeeEstimateRequest } from './transactions.model';
|
|
5
5
|
export declare class Transactions extends Base {
|
|
6
6
|
private authService;
|
|
7
7
|
private cipher;
|
|
@@ -20,7 +20,6 @@ export declare class Transactions extends Base {
|
|
|
20
20
|
* @returns {FeeEstimateRequest}
|
|
21
21
|
*/
|
|
22
22
|
estimateFee({ originAddress, recipientAddress, amount, token, transactionType, }: FeeEstimateRequest): Promise<FeeEstimatesResponse | undefined>;
|
|
23
|
-
submit(transactionRequest: BaseTransactionRequest): Promise<any>;
|
|
24
23
|
/**
|
|
25
24
|
*
|
|
26
25
|
* @public
|
|
@@ -81,4 +80,9 @@ export declare class Transactions extends Base {
|
|
|
81
80
|
*
|
|
82
81
|
*/
|
|
83
82
|
createAllowance({ authenticationOptions, ownerAddress, spenderAddress, amount, assetId, suiObjectId, contractAddress, chainName, assetSymbol, reference, memo, }: CreateAllowanceRequest): Promise<TransactionResponse | undefined>;
|
|
83
|
+
/**
|
|
84
|
+
* Prepares authentication data and encrypted payload for transaction requests
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
private prepareTransactionAuth;
|
|
84
88
|
}
|
|
@@ -62,7 +62,7 @@ export declare class Cipher {
|
|
|
62
62
|
}): Promise<Encrypted>;
|
|
63
63
|
/**
|
|
64
64
|
*
|
|
65
|
-
* @description Prepares the stored data for transport by decrypting it and then encrypting it with the Wallaby public key.
|
|
65
|
+
* @description Prepares the stored data for transport by double decrypting it and then encrypting it with the Wallaby public key.
|
|
66
66
|
* @param { Encrypted } storedEncryptedData - The encrypted data to be decrypted.
|
|
67
67
|
* @param { Encrypted } encryptedDevicePrivateKey - The encrypted device private key.
|
|
68
68
|
* @param { string } wallabyPublicKey - The public key to encrypt the data with.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PublicKeyCredentialAlgorithm } from '../../types';
|
|
2
2
|
/**
|
|
3
|
-
* The default environment will be set to
|
|
3
|
+
* The default environment will be set to 'development' if environment is not set in config.
|
|
4
4
|
* For production builds, it is recommended to set NODE_ENV to 'production'.
|
|
5
5
|
*/
|
|
6
6
|
export declare const defaultEnvironment: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DeviceInformation, SeedPhraseType } from '../../types';
|
|
2
|
-
import { LocalStorage, LocalStorageItems } from '../../types/storage';
|
|
2
|
+
import { LegacyKeyNames, LocalStorage, LocalStorageItems, V1KeyNames, V2KeyNames } from '../../types/storage';
|
|
3
3
|
export declare class StorageService {
|
|
4
4
|
private environment;
|
|
5
|
+
private shortenedEnv;
|
|
5
6
|
private userId;
|
|
6
7
|
private deviceStorage;
|
|
7
8
|
constructor({ deviceStorage, userId, environment }: {
|
|
@@ -9,16 +10,22 @@ export declare class StorageService {
|
|
|
9
10
|
userId: string;
|
|
10
11
|
environment?: string;
|
|
11
12
|
});
|
|
13
|
+
getFromDeviceStorage(key: string): Promise<string | null>;
|
|
14
|
+
setInDeviceStorage(key: string, value: string): Promise<void>;
|
|
12
15
|
fetch(key: LocalStorageItems): Promise<string | undefined>;
|
|
13
|
-
save(key: LocalStorageItems, value: string): Promise<void>;
|
|
16
|
+
save(key: LocalStorageItems | V2KeyNames | V1KeyNames | LegacyKeyNames, value: string): Promise<void>;
|
|
14
17
|
saveInBulk(data: {
|
|
15
|
-
key: LocalStorageItems;
|
|
18
|
+
key: LocalStorageItems | V2KeyNames | V1KeyNames | LegacyKeyNames;
|
|
16
19
|
value: string;
|
|
17
20
|
}[]): Promise<void>;
|
|
18
|
-
delete(key: LocalStorageItems): Promise<void>;
|
|
21
|
+
delete(key: LocalStorageItems | V2KeyNames | V1KeyNames | LegacyKeyNames): Promise<void>;
|
|
19
22
|
private setItem;
|
|
20
23
|
private getItem;
|
|
21
24
|
private removeItem;
|
|
25
|
+
checkPrivateKeyExists(): Promise<boolean>;
|
|
26
|
+
checkPrimaryKeyShareExists(): Promise<boolean>;
|
|
27
|
+
checkBackupKeyShareExists(): Promise<boolean>;
|
|
28
|
+
checkSeedPhraseExists(): Promise<boolean>;
|
|
22
29
|
/**
|
|
23
30
|
*
|
|
24
31
|
* Stores Wallaby auth public key to local storage
|
|
@@ -41,7 +48,6 @@ export declare class StorageService {
|
|
|
41
48
|
/**
|
|
42
49
|
*
|
|
43
50
|
* Fetches encrypted private key from local storage
|
|
44
|
-
* @param userId
|
|
45
51
|
*/
|
|
46
52
|
getEncryptedPrivateKey(): Promise<string | undefined>;
|
|
47
53
|
/**
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
|
-
import { AddTokenToWalletRequest, AddTokenToWalletResponse, QueryUserRequest, QueryWalletRequest, TokenBalanceRequest, TokenBalanceResponse, UpdateAssetRequest, UpdateAssetResponse, UserAssetsResponse, UserWalletsResponse, WallabyConfig, WalletAssetsResponse } from '../../types';
|
|
2
|
+
import { AddTokenToWalletRequest, AddTokenToWalletResponse, AuthResponse, BlockchainName, QueryUserRequest, QueryWalletRequest, TokenBalanceRequest, TokenBalanceResponse, UpdateAssetRequest, UpdateAssetResponse, UserAssetsResponse, UserWalletsResponse, WallabyConfig, WalletAddressInfo, WalletAssetsResponse } from '../../types';
|
|
3
3
|
export declare class WalletDataService extends Base {
|
|
4
|
+
private walletService;
|
|
4
5
|
constructor(config: WallabyConfig);
|
|
6
|
+
/**
|
|
7
|
+
* @description Validates the wallet address info for a given blockchain.
|
|
8
|
+
* @param { WalletAddressInfo } walletAddressInfo The wallet address info object containing addresses for different blockchains.
|
|
9
|
+
* @param { BlockchainName } blockchainName The name of the blockchain to validate against.
|
|
10
|
+
* @returns { boolean } Returns true if the wallet address info is valid for the given blockchain, otherwise throws an error.
|
|
11
|
+
*/
|
|
12
|
+
validateWalletAddressInfo(walletAddressInfo: WalletAddressInfo, blockchainName: BlockchainName): boolean;
|
|
5
13
|
/**
|
|
6
14
|
*
|
|
7
15
|
* @public
|
|
@@ -72,6 +80,13 @@ export declare class WalletDataService extends Base {
|
|
|
72
80
|
* @throws {Error} If required parameters are missing or invalid.
|
|
73
81
|
*/
|
|
74
82
|
addTokenToWallet({ assetConfigId, walletId, userId, config, }: AddTokenToWalletRequest): Promise<AddTokenToWalletResponse>;
|
|
83
|
+
addNewChainAndTokenToWallet(input: {
|
|
84
|
+
authenticationOptions: AuthResponse;
|
|
85
|
+
assetConfigId: string;
|
|
86
|
+
blockchainName: BlockchainName;
|
|
87
|
+
userId: string;
|
|
88
|
+
walletId: string;
|
|
89
|
+
}): Promise<AddTokenToWalletResponse>;
|
|
75
90
|
/**
|
|
76
91
|
* Updates a wallet asset.
|
|
77
92
|
*
|
|
@@ -33,8 +33,8 @@ export declare class WalletHandlersService extends Base {
|
|
|
33
33
|
standardSeedPhrase: string | undefined;
|
|
34
34
|
error?: any;
|
|
35
35
|
wallabyAuthPubKey: string;
|
|
36
|
-
assets: Array<import("../../types").UserAsset>;
|
|
37
36
|
encryptedSeed: Encrypted;
|
|
37
|
+
assets: Array<import("../../types").UserAsset>;
|
|
38
38
|
shares: Array<Share>;
|
|
39
39
|
reference: string;
|
|
40
40
|
wallet: import("../../types").Wallet;
|
|
@@ -63,6 +63,16 @@ export declare class WalletHandlersService extends Base {
|
|
|
63
63
|
privateKey: string;
|
|
64
64
|
};
|
|
65
65
|
}): Promise<RecoverWalletResponse>;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param encryptedKeyShares - Encrypted key shares that are encrypted with the wallabyAuthPublicKey.
|
|
69
|
+
* @param walletId - The ID of the wallet for which the seed phrase is being constructed.
|
|
70
|
+
* @param deviceAuthKeys - The device authentication key pair used to sign the request.
|
|
71
|
+
* @description This function constructs the seed phrase from encrypted key shares.
|
|
72
|
+
* It retrieves the seed phrase by sending a request to the Wallaby API with the encrypted key shares.
|
|
73
|
+
* The shares should be encrypted with the wallabyAuthPublicKey before passing them into this function.
|
|
74
|
+
* @returns The function returns the encrypted seed phrase wrapped with client device public key.
|
|
75
|
+
*/
|
|
66
76
|
handleConstructingSeedPhraseFromShares({ encryptedKeyShares, walletId, deviceAuthKeys, }: {
|
|
67
77
|
encryptedKeyShares: Encrypted[];
|
|
68
78
|
walletId: string;
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import { Base } from '../../base';
|
|
2
|
-
import { ConvertToAlgorandSeedPhraseRequest, ConvertMnemonicSeedPhraseResponse, CreateWalletRequest, CreateWalletResponse, WallabyConfig, ExportWalletRequest, RetrieveKeySharesResponse, ImportWalletRequest, ImportWalletResponse, AddNewDeviceRequest, AuthResponse, RecoverWalletRequest, AsymmetricKeyPair, InitAddNewDeviceResponse } from '../../types';
|
|
2
|
+
import { ConvertToAlgorandSeedPhraseRequest, ConvertMnemonicSeedPhraseResponse, CreateWalletRequest, CreateWalletResponse, WallabyConfig, ExportWalletRequest, RetrieveKeySharesResponse, ImportWalletRequest, ImportWalletResponse, AddNewDeviceRequest, AuthResponse, RecoverWalletRequest, AsymmetricKeyPair, InitAddNewDeviceResponse, RecoverWalletResponse, WalletAddressInfo } from '../../types';
|
|
3
3
|
export declare class WalletService extends Base {
|
|
4
4
|
private authService;
|
|
5
5
|
private cipher;
|
|
6
6
|
private handlers;
|
|
7
7
|
constructor(config: WallabyConfig);
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
* @returns {boolean} Returns true if the device has a seed phrase.
|
|
11
|
+
*/
|
|
12
|
+
hasSeedPhraseOnDevice(): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* @public
|
|
15
|
+
* @returns {boolean} Returns true if the device has a primary key share.
|
|
16
|
+
*/
|
|
17
|
+
hasPrimaryKeyShareOnDevice(): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
* @returns {boolean} Returns true if the device has a backup key share.
|
|
21
|
+
*/
|
|
22
|
+
hasBackupKeyShareOnDevice(): Promise<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
* @returns {boolean} Returns true if the device has a wallet (either seed phrase or primary key share).
|
|
26
|
+
*/
|
|
27
|
+
hasWalletOnDevice(): Promise<boolean>;
|
|
8
28
|
/**
|
|
9
29
|
*
|
|
10
30
|
* @public
|
|
@@ -58,9 +78,7 @@ export declare class WalletService extends Base {
|
|
|
58
78
|
* @returns {ImportWalletResponse} The wallet has been created successfully.
|
|
59
79
|
*/
|
|
60
80
|
import(input: ImportWalletRequest): Promise<Partial<ImportWalletResponse>>;
|
|
61
|
-
recover(input: RecoverWalletRequest): Promise<
|
|
62
|
-
standardSeedPhrase: string | undefined;
|
|
63
|
-
}>;
|
|
81
|
+
recover(input: RecoverWalletRequest): Promise<RecoverWalletResponse>;
|
|
64
82
|
/**
|
|
65
83
|
* @public
|
|
66
84
|
* Retrieves the encrypted shares for a specified wallet
|
|
@@ -128,4 +146,21 @@ export declare class WalletService extends Base {
|
|
|
128
146
|
success: boolean;
|
|
129
147
|
reference: string;
|
|
130
148
|
}>;
|
|
149
|
+
generateWalletAddresses(input: {
|
|
150
|
+
walletId: string;
|
|
151
|
+
authenticationOptions: AuthResponse;
|
|
152
|
+
}): Promise<{
|
|
153
|
+
walletAddressInfo: WalletAddressInfo;
|
|
154
|
+
}>;
|
|
155
|
+
/**
|
|
156
|
+
* Detects and migrates legacy/v1 storage items to v2 format.
|
|
157
|
+
* This function should be called in methods that use password as input when v2 items are missing.
|
|
158
|
+
* It will look for legacy storage items first, then v1 if legacy not found,
|
|
159
|
+
* decrypt them using appropriate decryption methods, and call wallet.recover() to create new v2 keys.
|
|
160
|
+
*/
|
|
161
|
+
handleUpdateToV2({ password, walletId }: {
|
|
162
|
+
password: string;
|
|
163
|
+
walletId: string;
|
|
164
|
+
}): Promise<void>;
|
|
165
|
+
clearDevice(): Promise<void>;
|
|
131
166
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wallaby-cash",
|
|
3
|
-
"version": "2.0.1-native.
|
|
3
|
+
"version": "2.0.1-native.3",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"release:alpha": "npm run tag:alpha && npm run build && npm publish --tag alpha",
|
|
55
55
|
"release:native": "npm run tag:native && npm run build && npm publish --tag native",
|
|
56
56
|
"release:beta": "npm run tag:beta && npm run build && npm publish --tag beta",
|
|
57
|
-
"release:rc": "npm
|
|
57
|
+
"release:rc": "npm version prerelease --preid=rc && npm run build:prod && npm publish --access public --tag rc",
|
|
58
58
|
"release:latest": "npm run tag:latest && npm run build && npm publish --access public",
|
|
59
59
|
"size": "size-limit --json"
|
|
60
60
|
},
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"@simplewebauthn/browser": "^13.1.0",
|
|
103
|
+
"@wallaby-cash/address-validator": "^1.0.8",
|
|
103
104
|
"axios": "^1.7.7",
|
|
104
105
|
"base64url": "^3.0.1",
|
|
105
106
|
"crypto-js": "4.2.0",
|
package/dist/routes/auth.d.ts
CHANGED
package/dist/routes/index.d.ts
CHANGED
package/dist/routes/wallet.d.ts
CHANGED
|
@@ -80,6 +80,11 @@ export declare const WalletRoutes: {
|
|
|
80
80
|
method: RequestMethod;
|
|
81
81
|
requiresAccessToken: boolean;
|
|
82
82
|
};
|
|
83
|
+
generateWalletAddresses: {
|
|
84
|
+
fullPath: string;
|
|
85
|
+
method: RequestMethod;
|
|
86
|
+
requiresAccessToken: boolean;
|
|
87
|
+
};
|
|
83
88
|
updateAsset: {
|
|
84
89
|
fullPath: string;
|
|
85
90
|
method: RequestMethod;
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { AttestationFormat, AuthenticationExtensionsClientInputs, AuthenticatorAssertionResponseJSON, AuthenticatorTransportFuture, PublicKeyCredentialHint, PublicKeyCredentialDescriptorJSON, PublicKeyCredentialUserEntityJSON } from '@simplewebauthn/browser';
|
|
2
|
+
import * as WebAuthn from '@simplewebauthn/browser';
|
|
3
|
+
import { User, Base64URLString } from './common';
|
|
4
|
+
/**
|
|
5
|
+
* A slightly-modified RegistrationCredential to simplify working with ArrayBuffers that
|
|
6
|
+
* are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
|
|
7
|
+
*
|
|
8
|
+
* https://w3c.github.io/webauthn/#dictdef-registrationresponsejson
|
|
9
|
+
*/
|
|
10
|
+
export interface RegistrationResponseJSON {
|
|
11
|
+
id: Base64URLString;
|
|
12
|
+
rawId: Base64URLString;
|
|
13
|
+
response: AuthenticatorAttestationResponseJSON;
|
|
14
|
+
authenticatorAttachment?: AuthenticatorAttachment;
|
|
15
|
+
clientExtensionResults: AuthenticationExtensionsClientOutputs;
|
|
16
|
+
type: PublicKeyCredentialType;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A variant of PublicKeyCredentialRequestOptions suitable for JSON transmission to the browser to
|
|
20
|
+
* (eventually) get passed into navigator.credentials.get(...) in the browser.
|
|
21
|
+
*/
|
|
22
|
+
export interface PublicKeyCredentialRequestOptionsJSON {
|
|
23
|
+
challenge: Base64URLString;
|
|
24
|
+
timeout?: number;
|
|
25
|
+
rpId?: string;
|
|
26
|
+
allowCredentials?: PublicKeyCredentialDescriptorJSON[];
|
|
27
|
+
userVerification?: UserVerificationRequirement;
|
|
28
|
+
hints?: PublicKeyCredentialHint[];
|
|
29
|
+
extensions?: ExtendedAuthenticationExtensionsClientInputs;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A variant of PublicKeyCredentialCreationOptions suitable for JSON transmission to the browser to
|
|
33
|
+
* (eventually) get passed into navigator.credentials.create(...) in the browser.
|
|
34
|
+
*
|
|
35
|
+
* This should eventually get replaced with official TypeScript DOM types when WebAuthn L3 types
|
|
36
|
+
* eventually make it into the language:
|
|
37
|
+
*
|
|
38
|
+
* https://w3c.github.io/webauthn/#dictdef-publickeycredentialcreationoptionsjson
|
|
39
|
+
*/
|
|
40
|
+
export interface PublicKeyCredentialCreationOptionsJSON {
|
|
41
|
+
rp: PublicKeyCredentialRpEntity;
|
|
42
|
+
user: PublicKeyCredentialUserEntityJSON;
|
|
43
|
+
challenge: Base64URLString;
|
|
44
|
+
pubKeyCredParams: PublicKeyCredentialParameters[];
|
|
45
|
+
timeout?: number;
|
|
46
|
+
excludeCredentials?: PublicKeyCredentialDescriptorJSON[];
|
|
47
|
+
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
48
|
+
hints?: PublicKeyCredentialHint[];
|
|
49
|
+
attestation?: AttestationConveyancePreference;
|
|
50
|
+
attestationFormats?: AttestationFormat[];
|
|
51
|
+
extensions?: ExtendedAuthenticationExtensionsClientInputs;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A slightly-modified AuthenticationCredential to simplify working with ArrayBuffers that
|
|
55
|
+
* are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
|
|
56
|
+
*
|
|
57
|
+
* https://w3c.github.io/webauthn/#dictdef-authenticationresponsejson
|
|
58
|
+
*/
|
|
59
|
+
export interface AuthenticationResponseJSON {
|
|
60
|
+
id: Base64URLString;
|
|
61
|
+
rawId: Base64URLString;
|
|
62
|
+
response: AuthenticatorAssertionResponseJSON;
|
|
63
|
+
authenticatorAttachment?: AuthenticatorAttachment;
|
|
64
|
+
clientExtensionResults: AuthenticationExtensionsClientOutputs;
|
|
65
|
+
type: PublicKeyCredentialType;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A slightly-modified AuthenticatorAttestationResponse to simplify working with ArrayBuffers that
|
|
69
|
+
* are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
|
|
70
|
+
*
|
|
71
|
+
* https://w3c.github.io/webauthn/#dictdef-authenticatorattestationresponsejson
|
|
72
|
+
*/
|
|
73
|
+
export interface AuthenticatorAttestationResponseJSON {
|
|
74
|
+
clientDataJSON: Base64URLString;
|
|
75
|
+
attestationObject: Base64URLString;
|
|
76
|
+
authenticatorData?: Base64URLString;
|
|
77
|
+
transports?: AuthenticatorTransportFuture[];
|
|
78
|
+
publicKeyAlgorithm?: COSEAlgorithmIdentifier;
|
|
79
|
+
publicKey?: Base64URLString;
|
|
80
|
+
}
|
|
3
81
|
export declare type SignatureMessageResponse = {
|
|
4
82
|
message: string;
|
|
5
83
|
hashedMessage: string;
|
|
@@ -71,11 +149,12 @@ export type ExtendedAuthenticatorResponse = AuthenticatorResponse & {
|
|
|
71
149
|
authenticatorData: ArrayBuffer;
|
|
72
150
|
userHandle: ArrayBuffer;
|
|
73
151
|
};
|
|
74
|
-
export type ExtendedAuthenticationExtensionsClientOutputs = AuthenticationExtensionsClientOutputs & PRFExtension;
|
|
152
|
+
export type ExtendedAuthenticationExtensionsClientOutputs = WebAuthn.AuthenticationExtensionsClientOutputs & PRFExtension;
|
|
75
153
|
export type ExtendedAuthenticationExtensionsClientInputs = AuthenticationExtensionsClientInputs & {
|
|
76
154
|
prf: AuthenticationExtensionsPRFInputs;
|
|
77
155
|
};
|
|
78
156
|
export interface AuthenticationExtensionsPRFValues {
|
|
157
|
+
base64: Base64URLString;
|
|
79
158
|
first: BufferSource;
|
|
80
159
|
second?: BufferSource;
|
|
81
160
|
}
|
|
@@ -119,3 +198,19 @@ export declare type AuthenticationResponse = {
|
|
|
119
198
|
password?: string;
|
|
120
199
|
error?: any;
|
|
121
200
|
};
|
|
201
|
+
export type PasskeyCredential = {
|
|
202
|
+
id: string;
|
|
203
|
+
authenticatorGlobalId: string;
|
|
204
|
+
credentialID: string;
|
|
205
|
+
publicKey: string;
|
|
206
|
+
authPublicKeyId: string;
|
|
207
|
+
counter: number;
|
|
208
|
+
transports: string;
|
|
209
|
+
credentialDeviceType: string | null;
|
|
210
|
+
credentialBackedUp: boolean | null;
|
|
211
|
+
userId: string;
|
|
212
|
+
externalUserId: string;
|
|
213
|
+
createdAt: string;
|
|
214
|
+
updatedAt: string;
|
|
215
|
+
authenticatorName?: string;
|
|
216
|
+
};
|
package/dist/types/common.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { JwtPayload } from 'jwt-decode';
|
|
2
2
|
import { Merchant, MerchantAsset } from './merchants';
|
|
3
|
+
export declare type Base64URLString = string;
|
|
3
4
|
export declare type UtilsResponse = string | undefined;
|
|
4
5
|
export declare type GetDecryptedSeedPhraseResponse = {
|
|
5
6
|
standardSeedPhrase: UtilsResponse;
|
|
6
7
|
algorandSeedPhrase: UtilsResponse;
|
|
7
8
|
};
|
|
8
9
|
export declare type WallabyError = {
|
|
10
|
+
error?: any;
|
|
9
11
|
statusCode: number;
|
|
10
12
|
message: string;
|
|
11
13
|
};
|
|
@@ -158,6 +160,7 @@ export declare enum BlockchainName {
|
|
|
158
160
|
Avalanche = "AVALANCHE",
|
|
159
161
|
Bitcoin = "BITCOIN",
|
|
160
162
|
Ethereum = "ETHEREUM",
|
|
163
|
+
Injective = "INJECTIVE",
|
|
161
164
|
Polygon = "POLYGON",
|
|
162
165
|
Bsc = "BSC",
|
|
163
166
|
Base = "BASE",
|
package/dist/types/storage.d.ts
CHANGED
|
@@ -30,3 +30,33 @@ export declare enum LocalStorageItems {
|
|
|
30
30
|
PasskeyCredentialId = "pass-key-credential-id",
|
|
31
31
|
PasskeyClientDataObject = "passkey-client-data"
|
|
32
32
|
}
|
|
33
|
+
export declare enum LegacyKeyNames {
|
|
34
|
+
EncryptedPrivateKey = "encryptedPrivateKey",
|
|
35
|
+
WallabyAuthPubKey = "wallabyAuthPubKey",
|
|
36
|
+
EncryptedAlgorandSeed = "encryptedAlgorandSeed",
|
|
37
|
+
EncryptedSeed = "encryptedSeed",
|
|
38
|
+
ClientAuthToken = "republic_jwt",
|
|
39
|
+
AccessToken = "accessToken"
|
|
40
|
+
}
|
|
41
|
+
export declare enum V1KeyNames {
|
|
42
|
+
AccessToken = "access-token",
|
|
43
|
+
EncryptedStandardSeedPhrase = "encrypted-standard-seedPhrase",
|
|
44
|
+
EncryptedAlgorandSeedPhrase = "encrypted-algorand-seedPhrase",
|
|
45
|
+
EncryptedDevicePrivateKey = "encrypted-private-key",
|
|
46
|
+
ClientAuthPublicKey = "client-auth-pub-key",
|
|
47
|
+
WallabyAuthPubKey = "wallaby-auth-pub-key",
|
|
48
|
+
ClientAuthToken = "republic-jwt"
|
|
49
|
+
}
|
|
50
|
+
export declare enum V2KeyNames {
|
|
51
|
+
AccessToken = "access-token",
|
|
52
|
+
BackupDeviceKeyShare = "backup-device-key-share",
|
|
53
|
+
ClientAuthPublicKey = "client-auth-pub-key",
|
|
54
|
+
ClientAuthToken = "republic-jwt",
|
|
55
|
+
EncryptedDevicePrivateKey = "encrypted-private-key",
|
|
56
|
+
EncryptedStandardSeedPhrase = "encrypted-standard-seedPhrase",
|
|
57
|
+
PasskeyCredential = "pass-key-credential",
|
|
58
|
+
PasskeyCredentialId = "pass-key-credential-id",
|
|
59
|
+
PasskeyClientDataObject = "passkey-client-data",
|
|
60
|
+
PrimaryDeviceKeyShare = "primary-device-key-share",
|
|
61
|
+
WallabyAuthPubKey = "wallaby-auth-pub-key"
|
|
62
|
+
}
|
|
@@ -17,24 +17,24 @@ export declare type Transaction = {
|
|
|
17
17
|
toAddress: string;
|
|
18
18
|
assetId: string;
|
|
19
19
|
assetSymbol: string;
|
|
20
|
-
tokenType
|
|
20
|
+
tokenType?: TokenStandard;
|
|
21
21
|
amount: string;
|
|
22
22
|
fee: string;
|
|
23
23
|
note: string;
|
|
24
24
|
nonce: number;
|
|
25
25
|
gasPrice: number;
|
|
26
|
-
submitter
|
|
26
|
+
submitter?: string;
|
|
27
27
|
status: TransactionStatus;
|
|
28
28
|
ownershipType: OwnershipType;
|
|
29
|
-
multisigVersion
|
|
30
|
-
multisigSignerThreshold
|
|
31
|
-
multisigSignerApprovedCount
|
|
32
|
-
txBlob
|
|
29
|
+
multisigVersion?: number;
|
|
30
|
+
multisigSignerThreshold?: number;
|
|
31
|
+
multisigSignerApprovedCount?: number;
|
|
32
|
+
txBlob?: string;
|
|
33
33
|
createdAt: Date | string;
|
|
34
34
|
updatedAt: Date | string;
|
|
35
|
-
asset
|
|
36
|
-
multisigParticipants
|
|
37
|
-
merchant
|
|
35
|
+
asset?: AssetConfig;
|
|
36
|
+
multisigParticipants?: MultisigParticipant;
|
|
37
|
+
merchant?: Merchant;
|
|
38
38
|
};
|
|
39
39
|
export declare enum TransactionStatus {
|
|
40
40
|
PendingApproval = "PENDING-APPROVAL",
|
|
@@ -83,6 +83,9 @@ export declare type BaseTransactionRequest = {
|
|
|
83
83
|
reference: string;
|
|
84
84
|
authenticationOptions: AuthResponse;
|
|
85
85
|
suiObjectId?: string;
|
|
86
|
+
password?: string;
|
|
87
|
+
prfValue?: Uint8Array;
|
|
88
|
+
clientSalt?: string;
|
|
86
89
|
memo?: string;
|
|
87
90
|
};
|
|
88
91
|
export declare type TransferRequest = BaseTransactionRequest & {
|
|
@@ -98,7 +101,7 @@ export declare type CreateAllowanceRequest = BaseTransactionRequest & {
|
|
|
98
101
|
};
|
|
99
102
|
export declare type TransactionResponse = {
|
|
100
103
|
transaction: Transaction;
|
|
101
|
-
|
|
104
|
+
error?: any;
|
|
102
105
|
};
|
|
103
106
|
export declare type TransactionStatusResponse = {
|
|
104
107
|
status: TransactionStatus;
|