Remove unused onboarding code

Fixes: #1539
Fixes: #1538

Unused code from onboarding
This commit is contained in:
Andrea Maria Piana 2020-11-03 09:31:37 +01:00
parent 3f63b0c23c
commit 40343b3140
2 changed files with 1 additions and 114 deletions

View File

@ -1 +1 @@
0.62.18 0.63.0

View File

@ -152,119 +152,6 @@ func CallPrivateRPC(inputJSON string) string {
return resp return resp
} }
// CreateAccount is equivalent to creating an account from the command line,
// just modified to handle the function arg passing.
func CreateAccount(password string) string {
panic("CreateAccount")
// info, mnemonic, err := statusBackend.AccountManager().CreateAccount(password)
// errString := ""
// if err != nil {
// fmt.Fprintln(os.Stderr, err)
// errString = err.Error()
// }
// out := AccountInfo{
// Address: info.WalletAddress,
// PubKey: info.WalletPubKey,
// WalletAddress: info.WalletAddress,
// WalletPubKey: info.WalletPubKey,
// ChatAddress: info.ChatAddress,
// ChatPubKey: info.ChatPubKey,
// Mnemonic: mnemonic,
// Error: errString,
// }
// outBytes, _ := json.Marshal(out)
// return string(outBytes)
}
// RecoverAccount re-creates master key using given details.
func RecoverAccount(password, mnemonic string) string {
panic("RecoverAccount")
// info, err := statusBackend.AccountManager().RecoverAccount(password, mnemonic)
// errString := ""
// if err != nil {
// fmt.Fprintln(os.Stderr, err)
// errString = err.Error()
// }
// out := AccountInfo{
// Address: info.WalletAddress,
// PubKey: info.WalletPubKey,
// WalletAddress: info.WalletAddress,
// WalletPubKey: info.WalletPubKey,
// ChatAddress: info.ChatAddress,
// ChatPubKey: info.ChatPubKey,
// Mnemonic: mnemonic,
// Error: errString,
// }
// outBytes, _ := json.Marshal(out)
// return string(outBytes)
}
// StartOnboarding initialize the onboarding with n random accounts
func StartOnboarding(n, mnemonicPhraseLength int) string {
out := struct {
Accounts []OnboardingAccount `json:"accounts"`
Error string `json:"error"`
}{
Accounts: make([]OnboardingAccount, 0),
}
accounts, err := statusBackend.AccountManager().StartOnboarding(n, mnemonicPhraseLength)
if err != nil {
fmt.Fprintln(os.Stderr, err)
out.Error = err.Error()
}
if err == nil {
for _, account := range accounts {
out.Accounts = append(out.Accounts, OnboardingAccount{
ID: account.ID,
Address: account.Info.WalletAddress,
PubKey: account.Info.WalletPubKey,
WalletAddress: account.Info.WalletAddress,
WalletPubKey: account.Info.WalletPubKey,
ChatAddress: account.Info.ChatAddress,
ChatPubKey: account.Info.ChatPubKey,
})
}
}
outBytes, _ := json.Marshal(out)
return string(outBytes)
}
//ImportOnboardingAccount re-creates and imports an account created during onboarding.
func ImportOnboardingAccount(id, password string) string {
info, mnemonic, err := statusBackend.AccountManager().ImportOnboardingAccount(id, password)
errString := ""
if err != nil {
fmt.Fprintln(os.Stderr, err)
errString = err.Error()
}
out := AccountInfo{
Address: info.WalletAddress,
PubKey: info.WalletPubKey,
WalletAddress: info.WalletAddress,
WalletPubKey: info.WalletPubKey,
ChatAddress: info.ChatAddress,
ChatPubKey: info.ChatPubKey,
Mnemonic: mnemonic,
Error: errString,
}
outBytes, _ := json.Marshal(out)
return string(outBytes)
}
// RemoveOnboarding resets the current onboarding removing from memory all the generated keys.
func RemoveOnboarding() {
statusBackend.AccountManager().RemoveOnboarding()
}
// VerifyAccountPassword verifies account password. // VerifyAccountPassword verifies account password.
func VerifyAccountPassword(keyStoreDir, address, password string) string { func VerifyAccountPassword(keyStoreDir, address, password string) string {
_, err := statusBackend.AccountManager().VerifyAccountPassword(keyStoreDir, address, password) _, err := statusBackend.AccountManager().VerifyAccountPassword(keyStoreDir, address, password)