mirror of
https://github.com/status-im/status-go.git
synced 2025-02-12 14:58:37 +00:00
* Moved all configs into config.go * Completed build out of new config structures * Completed SenderClient process flow * Completed sync data Mounter and client integration * Completed installation data Mounter and client integration * House keeping, small refactor to match conventions. PayloadEncryptor is passed by value and used as a pointer to the instance value and not a shared pointer. * Reintroduced explicit Mounter field type * Completed ReceiverClient structs and flows * Finished BaseClient function parity with old acc * Integrated new Clients into tests Solved some test breaks caused by encryptors sharing pointers to their managed payloads * Built out SenderServer and ReceiverServer structs With all associated functions and integrated with endpoints. * Updated tests to handle new Server types * Added docs and additional refinement * Renamed some files to better match the content of those files * Added json tags to config fields that were missing explicit tags. * fix tests relating to payload locking * Addressing feedback from @ilmotta * Addressed feedback from @qfrank
62 lines
1.0 KiB
Go
62 lines
1.0 KiB
Go
package pairing
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/status-im/status-go/account/generator"
|
|
"github.com/status-im/status-go/eth-node/keystore"
|
|
)
|
|
|
|
func validateKeys(keys map[string][]byte, password string) error {
|
|
for _, key := range keys {
|
|
k, err := keystore.DecryptKey(key, password)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = generator.ValidateKeystoreExtendedKey(k)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func emptyDir(dir string) error {
|
|
// Open the directory
|
|
d, err := os.Open(dir)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer d.Close()
|
|
|
|
// Get all the directory entries
|
|
entries, err := d.Readdir(-1)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// Remove all the files and directories
|
|
for _, entry := range entries {
|
|
name := entry.Name()
|
|
if name == "." || name == ".." {
|
|
continue
|
|
}
|
|
path := filepath.Join(dir, name)
|
|
if entry.IsDir() {
|
|
err = os.RemoveAll(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
err = os.Remove(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|