wallaby-cash 1.3.2 → 1.3.4
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 +20 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/auth/index.d.ts +16 -10
- package/dist/lib/transactions/index.d.ts +5 -5
- package/dist/lib/utils/index.d.ts +29 -9
- package/dist/lib/utils/utils.d.ts +22 -13
- package/dist/lib/wallet/index.d.ts +34 -11
- package/dist/routes/auth.d.ts +11 -6
- package/dist/routes/merchants.d.ts +7 -7
- package/dist/routes/system.d.ts +4 -4
- package/dist/routes/transactions.d.ts +13 -6
- package/dist/routes/wallet.d.ts +15 -10
- package/dist/tests/data/user.d.ts +3 -2
- package/dist/types/auth.d.ts +5 -10
- package/dist/types/common.d.ts +5 -1
- package/dist/types/transactions.d.ts +2 -2
- package/dist/types/wallet.d.ts +13 -6
- package/package.json +2 -2
- package/src/base.ts +40 -8
- package/src/index.ts +2 -2
- package/src/lib/auth/index.ts +49 -24
- package/src/lib/transactions/index.ts +7 -7
- package/src/lib/utils/index.ts +77 -19
- package/src/lib/utils/utils.ts +96 -36
- package/src/lib/wallet/index.ts +209 -35
- package/src/routes/auth.ts +11 -6
- package/src/routes/merchants.ts +7 -7
- package/src/routes/system.ts +4 -4
- package/src/routes/transactions.ts +23 -6
- package/src/routes/wallet.ts +15 -10
- package/src/tests/auth.spec.ts +26 -24
- package/src/tests/data/user.ts +3 -2
- package/src/tests/utils.spec.ts +9 -13
- package/src/tests/wallet.spec.ts +12 -7
- package/src/types/auth.ts +5 -11
- package/src/types/common.ts +6 -1
- package/src/types/transactions.ts +2 -2
- package/src/types/wallet.ts +14 -6
package/src/lib/utils/index.ts
CHANGED
|
@@ -6,52 +6,110 @@ import {
|
|
|
6
6
|
getWallabyAuthPubKey,
|
|
7
7
|
setEncryptedPrivateKey,
|
|
8
8
|
getEncryptedPrivateKey,
|
|
9
|
-
getDecryptedPrivateKey,
|
|
10
|
-
setEncryptedSeedPhrase,
|
|
11
9
|
getEncryptedSeedPhrase,
|
|
12
10
|
getDecryptedSeedPhrase,
|
|
13
11
|
} from './utils';
|
|
14
|
-
import {
|
|
12
|
+
import { encryptWithPublicKey } from 'eth-crypto';
|
|
15
13
|
import logger from '../../helpers/logger';
|
|
14
|
+
import { Auth } from '../auth';
|
|
15
|
+
import { AES, enc } from 'crypto-js';
|
|
16
16
|
|
|
17
17
|
export class Utils extends Base {
|
|
18
18
|
public setWallabyAuthPubKey: (userId: string, wallabyAuthPubKey: string) => void;
|
|
19
19
|
public getWallabyAuthPubKey: (userId: string) => UtilsResponse;
|
|
20
|
-
public setEncryptedPrivateKey: (userId: string, privateKey: string,
|
|
20
|
+
public setEncryptedPrivateKey: (userId: string, privateKey: string, password: string) => boolean;
|
|
21
21
|
public getEncryptedPrivateKey: (userId: string) => UtilsResponse;
|
|
22
|
-
public
|
|
23
|
-
public
|
|
24
|
-
userId
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
seedPhraseType
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
public getEncryptedSeedPhrase: (userId: string, seedPhraseType: SeedPhraseType) => string | undefined;
|
|
23
|
+
public getDecryptedSeedPhrase: ({
|
|
24
|
+
userId,
|
|
25
|
+
password,
|
|
26
|
+
salt,
|
|
27
|
+
seedPhraseType,
|
|
28
|
+
}: {
|
|
29
|
+
userId: string;
|
|
30
|
+
password: string;
|
|
31
|
+
salt: string;
|
|
32
|
+
seedPhraseType: SeedPhraseType;
|
|
33
|
+
}) => Promise<UtilsResponse>;
|
|
34
|
+
public validatePassword: (userId: string, password: string) => PasswordValidatorResponse;
|
|
35
|
+
|
|
36
|
+
private auth: Auth;
|
|
32
37
|
constructor(config: WallabyConfig) {
|
|
33
38
|
super(config);
|
|
39
|
+
this.auth = new Auth(config);
|
|
34
40
|
this.validatePassword = validatePassword;
|
|
35
41
|
this.setWallabyAuthPubKey = setWallabyAuthPubKey;
|
|
36
42
|
this.getWallabyAuthPubKey = getWallabyAuthPubKey;
|
|
37
43
|
this.setEncryptedPrivateKey = setEncryptedPrivateKey;
|
|
38
44
|
this.getEncryptedPrivateKey = getEncryptedPrivateKey;
|
|
39
|
-
this.getDecryptedPrivateKey = getDecryptedPrivateKey;
|
|
40
|
-
this.setEncryptedSeedPhrase = setEncryptedSeedPhrase;
|
|
41
45
|
this.getEncryptedSeedPhrase = getEncryptedSeedPhrase;
|
|
42
46
|
this.getDecryptedSeedPhrase = getDecryptedSeedPhrase;
|
|
43
47
|
this.fetchFromEndpoint = this.fetchFromEndpoint;
|
|
48
|
+
this.setEncryptedSeedPhrase = this.setEncryptedSeedPhrase;
|
|
49
|
+
this.getDecryptedPrivateKey = this.getDecryptedPrivateKey;
|
|
44
50
|
}
|
|
45
51
|
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* Decrypts user private key
|
|
55
|
+
* @param userId
|
|
56
|
+
* @param password
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
getDecryptedPrivateKey = (userId: string, password: string): UtilsResponse => {
|
|
60
|
+
const privateKey = getEncryptedPrivateKey(userId);
|
|
61
|
+
if (!privateKey) {
|
|
62
|
+
logger('SDK::Utils::getDecryptedPrivateKey::undefined?', !privateKey);
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const decryptedPrivateKey = AES.decrypt(privateKey, password).toString(enc.Utf8);
|
|
67
|
+
if (decryptedPrivateKey !== '' && decryptedPrivateKey !== undefined) {
|
|
68
|
+
return decryptedPrivateKey;
|
|
69
|
+
} else {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @param {string} userId
|
|
77
|
+
* @param {string} decryptedSeedPhrase
|
|
78
|
+
* @param {SeedPhraseType} seedphraseType
|
|
79
|
+
* @param {string} password
|
|
80
|
+
* @param {string} salt
|
|
81
|
+
*/
|
|
82
|
+
setEncryptedSeedPhrase = async (
|
|
83
|
+
userId: string,
|
|
84
|
+
clientAuthPubKey: string,
|
|
85
|
+
decryptedSeedPhrase: string,
|
|
86
|
+
seedPhraseType: SeedPhraseType,
|
|
87
|
+
password: string,
|
|
88
|
+
salt: string,
|
|
89
|
+
): Promise<boolean> => {
|
|
90
|
+
// First layer of encryption uses the clientAuthPubKey.
|
|
91
|
+
const encryptedOnceSeedPhrase = await encryptWithPublicKey(clientAuthPubKey, decryptedSeedPhrase);
|
|
92
|
+
|
|
93
|
+
// The second layer uses a combination of the user's password/password and the salt.
|
|
94
|
+
const saltyHash = `${salt}${password}`;
|
|
95
|
+
const doubleEncryptedSeedPhrase = await AES.encrypt(JSON.stringify(encryptedOnceSeedPhrase), saltyHash);
|
|
96
|
+
|
|
97
|
+
localStorage.setItem(
|
|
98
|
+
`${process.env.NODE_ENV}-encrypted-${seedPhraseType}-seedPhrase-${userId}`,
|
|
99
|
+
doubleEncryptedSeedPhrase.toString(),
|
|
100
|
+
);
|
|
101
|
+
return true;
|
|
102
|
+
};
|
|
103
|
+
|
|
46
104
|
async fetchFromEndpoint({
|
|
47
105
|
endpoint,
|
|
48
106
|
method,
|
|
49
|
-
|
|
107
|
+
requiresAccessToken,
|
|
50
108
|
payload,
|
|
51
109
|
}: {
|
|
52
110
|
endpoint: string;
|
|
53
111
|
method: RequestMothod;
|
|
54
|
-
|
|
112
|
+
requiresAccessToken?: boolean;
|
|
55
113
|
payload?: any;
|
|
56
114
|
}): Promise<any> {
|
|
57
115
|
try {
|
|
@@ -61,7 +119,7 @@ export class Utils extends Base {
|
|
|
61
119
|
const requestRoute = {
|
|
62
120
|
fullPath: cleanEndpoint,
|
|
63
121
|
method: method,
|
|
64
|
-
|
|
122
|
+
requiresAccessToken: requiresAccessToken ?? false,
|
|
65
123
|
};
|
|
66
124
|
const response = await this.request(requestRoute, {
|
|
67
125
|
method: method,
|
package/src/lib/utils/utils.ts
CHANGED
|
@@ -35,7 +35,17 @@ export const getWallabyAuthPubKey = (userId: string): UtilsResponse => {
|
|
|
35
35
|
wallabyAuthPubKey = localStorage.getItem(`${process.env.NODE_ENV}-wallaby-auth-public-key-${userId}`) ?? undefined;
|
|
36
36
|
// if (typeof window !== 'undefined') {
|
|
37
37
|
// }
|
|
38
|
-
|
|
38
|
+
if (!wallabyAuthPubKey) {
|
|
39
|
+
// try to get the wallabyAuthPubKey from the legacy key
|
|
40
|
+
wallabyAuthPubKey = localStorage.getItem(`wallabyAuthPubKey_${userId}`);
|
|
41
|
+
}
|
|
42
|
+
if (wallabyAuthPubKey) {
|
|
43
|
+
// updating the key to the new format
|
|
44
|
+
localStorage.setItem(`${process.env.NODE_ENV}-wallaby-auth-public-key-${userId}`, wallabyAuthPubKey);
|
|
45
|
+
return wallabyAuthPubKey;
|
|
46
|
+
} else {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
39
49
|
};
|
|
40
50
|
|
|
41
51
|
/**
|
|
@@ -43,11 +53,11 @@ export const getWallabyAuthPubKey = (userId: string): UtilsResponse => {
|
|
|
43
53
|
* Encrypts and stores user private key
|
|
44
54
|
* @param userId ID of the user (should be a uuid)
|
|
45
55
|
* @param privateKey private key
|
|
46
|
-
* @param
|
|
56
|
+
* @param password password that is used to encrypt the private key
|
|
47
57
|
*/
|
|
48
|
-
export const setEncryptedPrivateKey = (userId: string, privateKey: string,
|
|
58
|
+
export const setEncryptedPrivateKey = (userId: string, privateKey: string, password: string): boolean => {
|
|
49
59
|
try {
|
|
50
|
-
const encryptedClientAuthPrivKey = AES.encrypt(privateKey,
|
|
60
|
+
const encryptedClientAuthPrivKey = AES.encrypt(privateKey, password).toString();
|
|
51
61
|
localStorage.setItem(`${process.env.NODE_ENV}-client-auth-private-key-${userId}`, encryptedClientAuthPrivKey);
|
|
52
62
|
// if (typeof window !== 'undefined') {
|
|
53
63
|
// return true;
|
|
@@ -70,10 +80,16 @@ export const getEncryptedPrivateKey = (userId: string): UtilsResponse => {
|
|
|
70
80
|
// if (typeof window !== 'undefined') {
|
|
71
81
|
// logger('encryptedPrivateKey is found in local storage', encryptedPrivateKey)
|
|
72
82
|
// }
|
|
83
|
+
if (!encryptedPrivateKey) {
|
|
84
|
+
// try to get the encryptedPrivateKey from the legacy key
|
|
85
|
+
encryptedPrivateKey = localStorage.getItem(`encryptedPrivateKey_${userId}`);
|
|
86
|
+
}
|
|
87
|
+
|
|
73
88
|
if (encryptedPrivateKey) {
|
|
89
|
+
localStorage.setItem(`${process.env.NODE_ENV}-client-auth-private-key-${userId}`, encryptedPrivateKey);
|
|
74
90
|
return encryptedPrivateKey;
|
|
75
91
|
} else {
|
|
76
|
-
logger('
|
|
92
|
+
logger('SDK::Utils::getEncryptedPrivateKey: private key not found');
|
|
77
93
|
return undefined;
|
|
78
94
|
}
|
|
79
95
|
// return encryptedPrivateKey;
|
|
@@ -83,17 +99,17 @@ export const getEncryptedPrivateKey = (userId: string): UtilsResponse => {
|
|
|
83
99
|
*
|
|
84
100
|
* Decrypts user private key
|
|
85
101
|
* @param userId
|
|
86
|
-
* @param
|
|
102
|
+
* @param password
|
|
87
103
|
* @returns
|
|
88
104
|
*/
|
|
89
|
-
export const getDecryptedPrivateKey = (userId: string,
|
|
105
|
+
export const getDecryptedPrivateKey = (userId: string, password: string): UtilsResponse => {
|
|
90
106
|
const privateKey = getEncryptedPrivateKey(userId);
|
|
91
107
|
if (!privateKey) {
|
|
92
108
|
logger('SDK::Utils::getDecryptedPrivateKey::undefined?', !privateKey);
|
|
93
109
|
return undefined;
|
|
94
110
|
}
|
|
95
111
|
|
|
96
|
-
const decryptedPrivateKey = AES.decrypt(privateKey,
|
|
112
|
+
const decryptedPrivateKey = AES.decrypt(privateKey, password).toString(enc.Utf8);
|
|
97
113
|
if (decryptedPrivateKey !== '' && decryptedPrivateKey !== undefined) {
|
|
98
114
|
return decryptedPrivateKey;
|
|
99
115
|
} else {
|
|
@@ -103,24 +119,31 @@ export const getDecryptedPrivateKey = (userId: string, hashKey: string): UtilsRe
|
|
|
103
119
|
|
|
104
120
|
/**
|
|
105
121
|
*
|
|
106
|
-
* @param userId
|
|
107
|
-
* @param
|
|
122
|
+
* @param {string} userId
|
|
123
|
+
* @param {string} decryptedSeedPhrase
|
|
124
|
+
* @param {SeedPhraseType} seedphraseType
|
|
125
|
+
* @param {string} password
|
|
126
|
+
* @param {string} salt
|
|
108
127
|
*/
|
|
109
128
|
export const setEncryptedSeedPhrase = async (
|
|
110
129
|
userId: string,
|
|
111
130
|
clientAuthPubKey: string,
|
|
112
131
|
decryptedSeedPhrase: string,
|
|
113
132
|
seedPhraseType: SeedPhraseType,
|
|
133
|
+
password: string,
|
|
134
|
+
salt: string,
|
|
114
135
|
): Promise<boolean> => {
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
136
|
+
// First layer of encryption uses the clientAuthPubKey.
|
|
137
|
+
const encryptedOnceSeedPhrase = await encryptWithPublicKey(clientAuthPubKey, decryptedSeedPhrase);
|
|
138
|
+
|
|
139
|
+
// The second layer uses a combination of the user's password/password and the salt.
|
|
140
|
+
const saltyHash = `${salt}${password}`;
|
|
141
|
+
const doubleEncryptedSeedPhrase = await AES.encrypt(JSON.stringify(encryptedOnceSeedPhrase), saltyHash);
|
|
142
|
+
|
|
118
143
|
localStorage.setItem(
|
|
119
144
|
`${process.env.NODE_ENV}-encrypted-${seedPhraseType}-seedPhrase-${userId}`,
|
|
120
|
-
|
|
145
|
+
doubleEncryptedSeedPhrase.toString(),
|
|
121
146
|
);
|
|
122
|
-
// if (typeof window !== 'undefined') {
|
|
123
|
-
// }
|
|
124
147
|
return true;
|
|
125
148
|
};
|
|
126
149
|
|
|
@@ -130,44 +153,74 @@ export const setEncryptedSeedPhrase = async (
|
|
|
130
153
|
* @param {SeedPhraseType} seedPhraseType Standard or Mnemonic seedphrase
|
|
131
154
|
* @returns {UtilsResponse} It returns the encrypted seedphrase as a string or undefined
|
|
132
155
|
*/
|
|
133
|
-
export const getEncryptedSeedPhrase = (userId: string, seedPhraseType: SeedPhraseType):
|
|
156
|
+
export const getEncryptedSeedPhrase = (userId: string, seedPhraseType: SeedPhraseType): string | undefined => {
|
|
134
157
|
let encryptedSeedPhrase;
|
|
135
158
|
encryptedSeedPhrase = localStorage.getItem(`${process.env.NODE_ENV}-encrypted-${seedPhraseType}-seedPhrase-${userId}`);
|
|
136
159
|
// if (typeof window !== 'undefined') {
|
|
137
160
|
// }
|
|
138
161
|
|
|
139
162
|
if (!encryptedSeedPhrase) {
|
|
140
|
-
|
|
163
|
+
// try to get the encryptedSeedPhrase from the legacy key
|
|
164
|
+
switch (seedPhraseType) {
|
|
165
|
+
case SeedPhraseType.Algorand:
|
|
166
|
+
encryptedSeedPhrase = localStorage.getItem(`encryptedAlgorandSeed_${userId}`);
|
|
167
|
+
break;
|
|
168
|
+
case SeedPhraseType.Standard:
|
|
169
|
+
encryptedSeedPhrase = localStorage.getItem(`encryptedSeed_${userId}`);
|
|
170
|
+
break;
|
|
171
|
+
default:
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (encryptedSeedPhrase) {
|
|
177
|
+
// updating the key to the new format
|
|
178
|
+
localStorage.setItem(`${process.env.NODE_ENV}-encrypted-${seedPhraseType}-seedPhrase-${userId}`, encryptedSeedPhrase);
|
|
179
|
+
return encryptedSeedPhrase;
|
|
141
180
|
}
|
|
142
|
-
|
|
181
|
+
|
|
182
|
+
return undefined;
|
|
143
183
|
};
|
|
144
184
|
|
|
145
185
|
/**
|
|
146
186
|
*
|
|
147
187
|
* @param {string} userId
|
|
148
|
-
* @param {string}
|
|
188
|
+
* @param {string} password
|
|
189
|
+
* @param {string} salt
|
|
190
|
+
* @param {SeedPhraseType} seedPhraseType
|
|
149
191
|
* @returns {UtilsResponse} It returns the decrypted seedphrase as a string or undefined
|
|
150
192
|
*/
|
|
151
|
-
export const getDecryptedSeedPhrase = async (
|
|
152
|
-
userId
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
193
|
+
export const getDecryptedSeedPhrase = async ({
|
|
194
|
+
userId,
|
|
195
|
+
password,
|
|
196
|
+
salt,
|
|
197
|
+
seedPhraseType,
|
|
198
|
+
}: {
|
|
199
|
+
userId: string;
|
|
200
|
+
password: string;
|
|
201
|
+
salt: string;
|
|
202
|
+
seedPhraseType: SeedPhraseType;
|
|
203
|
+
}): Promise<UtilsResponse> => {
|
|
156
204
|
const encryptedSeedPhrase = getEncryptedSeedPhrase(userId, seedPhraseType);
|
|
157
|
-
const decryptedClientAuthPrivKey = getDecryptedPrivateKey(userId,
|
|
205
|
+
const decryptedClientAuthPrivKey = getDecryptedPrivateKey(userId, password);
|
|
158
206
|
|
|
159
207
|
if (!encryptedSeedPhrase || !decryptedClientAuthPrivKey) {
|
|
160
208
|
return undefined;
|
|
161
209
|
}
|
|
162
|
-
|
|
210
|
+
|
|
211
|
+
const saltyHash = `${salt}${password}`;
|
|
212
|
+
// First we need to decrypt the first layer with user salt and with their password/password
|
|
213
|
+
const decryptedOnceSeedPhrase = AES.decrypt(encryptedSeedPhrase, saltyHash);
|
|
214
|
+
// Then we need to make sure the first layer of decryption is parsed properly.
|
|
215
|
+
const parsedSeed: Encrypted = JSON.parse(decryptedOnceSeedPhrase.toString(enc.Utf8));
|
|
216
|
+
// Now we decrypt the seedphrase with the private key and return the decrypted string
|
|
217
|
+
const decryptedSeedPhrase = await decryptWithPrivateKey(decryptedClientAuthPrivKey, parsedSeed);
|
|
163
218
|
return decryptedSeedPhrase;
|
|
164
219
|
};
|
|
165
220
|
|
|
166
221
|
export const setAccessToken = (userId: string, accessToken: string): boolean => {
|
|
167
222
|
try {
|
|
168
223
|
localStorage.setItem(`${process.env.NODE_ENV}-access-token-${userId}`, accessToken);
|
|
169
|
-
// if (typeof window !== 'undefined') {
|
|
170
|
-
// }
|
|
171
224
|
|
|
172
225
|
return true;
|
|
173
226
|
} catch (error) {
|
|
@@ -180,13 +233,15 @@ export const getAccessToken = (userId: string): UtilsResponse | WallabyError =>
|
|
|
180
233
|
try {
|
|
181
234
|
let accessToken;
|
|
182
235
|
accessToken = localStorage.getItem(`${process.env.NODE_ENV}-access-token-${userId}`);
|
|
183
|
-
|
|
184
|
-
|
|
236
|
+
|
|
237
|
+
if (!accessToken) {
|
|
238
|
+
// try to get the accessToken from the legacy key
|
|
239
|
+
accessToken = localStorage.getItem(`accessToken_${userId}`);
|
|
240
|
+
}
|
|
185
241
|
|
|
186
242
|
if (accessToken) {
|
|
187
243
|
return accessToken;
|
|
188
244
|
} else {
|
|
189
|
-
// Need to add a signin mechanism here to get the accessToken instead of returning undefined
|
|
190
245
|
return undefined;
|
|
191
246
|
}
|
|
192
247
|
} catch (error) {
|
|
@@ -198,20 +253,20 @@ export const getAccessToken = (userId: string): UtilsResponse | WallabyError =>
|
|
|
198
253
|
/**
|
|
199
254
|
*
|
|
200
255
|
* @param userId
|
|
201
|
-
* @param
|
|
256
|
+
* @param password
|
|
202
257
|
* @returns
|
|
203
258
|
*/
|
|
204
|
-
export const validatePassword = (userId: string,
|
|
259
|
+
export const validatePassword = (userId: string, password: string): PasswordValidatorResponse => {
|
|
205
260
|
const privateKey = getEncryptedPrivateKey(userId);
|
|
206
261
|
const encryptedSeedPhrase = getEncryptedSeedPhrase(userId, SeedPhraseType.Standard);
|
|
207
262
|
if (!privateKey || !encryptedSeedPhrase) {
|
|
208
263
|
return { valid: false, message: 'Could not locate client keys or seedPhrase' };
|
|
209
264
|
}
|
|
210
|
-
const decryptedPrivateKey = AES.decrypt(privateKey,
|
|
265
|
+
const decryptedPrivateKey = AES.decrypt(privateKey, password).toString(enc.Utf8) ?? undefined;
|
|
211
266
|
if (decryptedPrivateKey) {
|
|
212
267
|
return { valid: true };
|
|
213
268
|
} else {
|
|
214
|
-
return { valid: false, message: '
|
|
269
|
+
return { valid: false, message: 'password is incorrect' };
|
|
215
270
|
}
|
|
216
271
|
};
|
|
217
272
|
|
|
@@ -221,4 +276,9 @@ export const clearLocalStorage = (userId: string) => {
|
|
|
221
276
|
localStorage.removeItem(`${process.env.NODE_ENV}-encrypted-${SeedPhraseType.Standard}-seedPhrase-${userId}`);
|
|
222
277
|
localStorage.removeItem(`${process.env.NODE_ENV}-client-auth-private-key-${userId}`);
|
|
223
278
|
localStorage.removeItem(`${process.env.NODE_ENV}-wallaby-auth-public-key-${userId}`);
|
|
279
|
+
|
|
280
|
+
localStorage.removeItem(`encryptedPrivateKey_${userId}`);
|
|
281
|
+
localStorage.removeItem(`wallabyAuthPubKey_${userId}`);
|
|
282
|
+
localStorage.removeItem(`encryptedSeed_${userId}`);
|
|
283
|
+
localStorage.removeItem(`encryptedAlgorandSeed_${userId}`);
|
|
224
284
|
};
|