Do not keep mnemonic or password (and variations) in logs
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { Account, Balance, AccountEntry } from '@nymproject/types';
|
||||
import { invoke } from '@tauri-apps/api';
|
||||
import { invokeWrapper } from './wrapper';
|
||||
|
||||
export const signInWithMnemonic = async (mnemonic: string): Promise<Account> =>
|
||||
invoke('connect_with_mnemonic', { mnemonic });
|
||||
invokeWrapper('connect_with_mnemonic', { mnemonic });
|
||||
|
||||
export const userBalance = async () => invokeWrapper<Balance>('get_balance');
|
||||
|
||||
|
||||
@@ -5,7 +5,14 @@ import { Console } from '../utils/console';
|
||||
export async function invokeWrapper<T>(operationName: string, args?: any): Promise<T> {
|
||||
const res = await invoke<T>(operationName, args);
|
||||
if (config.LOG_TAURI_OPERATIONS) {
|
||||
Console.log({ operationName, args, res });
|
||||
const argsToLog: any = {};
|
||||
Object.keys(args).forEach((key) => {
|
||||
// check if the key should be excluded from logs
|
||||
if (!['mnemonic', 'password', 'currentPassword', 'newPassword'].includes(key)) {
|
||||
argsToLog[key] = args[key];
|
||||
}
|
||||
});
|
||||
Console.log({ operationName, argsToLog, res });
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user