mirror of
https://github.com/quexten/goldwarden.git
synced 2024-11-24 06:17:44 +03:00
Implement attempt sync until online
This commit is contained in:
parent
16403ca31a
commit
8e88c8d8d8
@ -128,16 +128,25 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error {
|
||||
token, err := cfg.GetToken()
|
||||
if err == nil {
|
||||
if token.AccessToken != "" {
|
||||
// attempt to sync every minute until successful
|
||||
for {
|
||||
bitwarden.RefreshToken(ctx, &cfg)
|
||||
userSymmetricKey, err := cfg.GetUserSymmetricKey()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
time.Sleep(60 * time.Second)
|
||||
continue
|
||||
}
|
||||
protectedUserSymetricKey, err := crypto.SymmetricEncryptionKeyFromBytes(userSymmetricKey)
|
||||
|
||||
err = bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, &cfg, &protectedUserSymetricKey, true)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
time.Sleep(60 * time.Second)
|
||||
continue
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user