feat: `VerifyKeystoreFileForAccount` endpoint added

This commit is contained in:
Sale Djenic 2023-04-20 15:07:22 +02:00 committed by saledjenic
parent f1e3ae5b46
commit 5d7da45f07
1 changed files with 6 additions and 2 deletions

View File

@ -229,13 +229,17 @@ func (api *API) GetRandomMnemonic(ctx context.Context) (string, error) {
return api.manager.GetRandomMnemonic()
}
func (api *API) VerifyKeystoreFileForAccount(address types.Address, password string) bool {
_, err := api.manager.VerifyAccountPassword(api.config.KeyStoreDir, address.Hex(), password)
return err == nil
}
func (api *API) VerifyPassword(password string) bool {
address, err := api.db.GetChatAddress()
if err != nil {
return false
}
_, err = api.manager.VerifyAccountPassword(api.config.KeyStoreDir, address.Hex(), password)
return err == nil
return api.VerifyKeystoreFileForAccount(address, password)
}
func (api *API) AddMigratedKeyPairOrAddAccountsIfKeyPairIsAdded(ctx context.Context, kcUID string, kpName string, keyUID string, accountAddresses []string, password string) error {