mirror of
https://github.com/quexten/goldwarden.git
synced 2024-11-23 13:38:01 +03:00
Merge branch 'main' into fix/camelcase-requests
This commit is contained in:
commit
71b145ad41
@ -256,7 +256,7 @@ func handleVaultStatus(request messages.IPCMessage, cfg *config.Config, vault *v
|
||||
vaultStatus.NumberOfLogins = len(vault.GetLogins())
|
||||
vaultStatus.NumberOfNotes = len(vault.GetNotes())
|
||||
vaultStatus.LastSynced = vault.GetLastSynced()
|
||||
vaultStatus.WebsockedConnected = vault.IsWebsocketConnected()
|
||||
vaultStatus.WebsocketConnected = vault.IsWebsocketConnected()
|
||||
vaultStatus.PinSet = cfg.HasPin()
|
||||
vaultStatus.LoggedIn = cfg.IsLoggedIn()
|
||||
response, err = messages.IPCMessageFromPayload(vaultStatus)
|
||||
|
@ -116,7 +116,7 @@ func LoginWithApiKey(ctx context.Context, email string, cfg *config.Config, vaul
|
||||
|
||||
func LoginWithMasterpassword(ctx context.Context, email string, cfg *config.Config, vault *vault.Vault) (LoginResponseToken, crypto.MasterKey, string, error) {
|
||||
var preLogin preLoginResponse
|
||||
if err := authenticatedHTTPPost(ctx, cfg.ConfigFile.ApiUrl+"/accounts/prelogin", &preLogin, preLoginRequest{
|
||||
if err := authenticatedHTTPPost(ctx, cfg.ConfigFile.IdentityUrl+"/accounts/prelogin", &preLogin, preLoginRequest{
|
||||
Email: email,
|
||||
}); err != nil {
|
||||
notify.Notify("Goldwarden", fmt.Sprintf("Could not pre-login: %v", err), "", 0, func() {})
|
||||
|
@ -76,6 +76,8 @@ type Cipher struct {
|
||||
Login *LoginCipher `json:"login,omitempty"`
|
||||
Notes *crypto.EncString `json:"notes,omitempty"`
|
||||
SecureNote *SecureNoteCipher `json:"secureNote,omitempty"`
|
||||
|
||||
Key *crypto.EncString `json:"key,omitempty"`
|
||||
}
|
||||
|
||||
type CipherType int
|
||||
@ -147,8 +149,26 @@ type SecureNoteCipher struct {
|
||||
}
|
||||
|
||||
func (cipher Cipher) GetKeyForCipher(keyring crypto.Keyring) (crypto.SymmetricEncryptionKey, error) {
|
||||
var key1 crypto.SymmetricEncryptionKey = nil
|
||||
var err error
|
||||
if cipher.OrganizationID != nil {
|
||||
return keyring.GetSymmetricKeyForOrganization(cipher.OrganizationID.String())
|
||||
key1, err = keyring.GetSymmetricKeyForOrganization(cipher.OrganizationID.String())
|
||||
} else {
|
||||
key1, err = keyring.GetAccountKey(), nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if cipher.Key == nil {
|
||||
return key1, nil
|
||||
} else {
|
||||
key, err := crypto.DecryptWith(*cipher.Key, key1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return crypto.MemorySymmetricEncryptionKeyFromBytes(key)
|
||||
}
|
||||
}
|
||||
return keyring.GetAccountKey(), nil
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ type Vault struct {
|
||||
sshKeyNoteIDs []string
|
||||
envCredentials map[string]string
|
||||
lastSynced int64
|
||||
websockedConnected bool
|
||||
websocketConnected bool
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ func NewVault(keyring *crypto.Keyring) *Vault {
|
||||
sshKeyNoteIDs: make([]string, 0),
|
||||
envCredentials: make(map[string]string),
|
||||
lastSynced: 0,
|
||||
websockedConnected: false,
|
||||
websocketConnected: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -424,7 +424,7 @@ func (vault *Vault) GetLastSynced() int64 {
|
||||
|
||||
func (vault *Vault) SetWebsocketConnected(connected bool) {
|
||||
vault.lockMutex()
|
||||
vault.websockedConnected = connected
|
||||
vault.websocketConnected = connected
|
||||
vault.unlockMutex()
|
||||
}
|
||||
|
||||
@ -432,5 +432,5 @@ func (vault *Vault) IsWebsocketConnected() bool {
|
||||
vault.lockMutex()
|
||||
defer vault.unlockMutex()
|
||||
|
||||
return vault.websockedConnected
|
||||
return vault.websocketConnected
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ var statusCmd = &cobra.Command{
|
||||
response["loginEntries"] = status.NumberOfLogins
|
||||
response["noteEntries"] = status.NumberOfNotes
|
||||
response["lastSynced"] = time.Unix(status.LastSynced, 0).String()
|
||||
response["websocketConnected"] = status.WebsockedConnected
|
||||
response["websocketConnected"] = status.WebsocketConnected
|
||||
response["pinSet"] = status.PinSet
|
||||
response["loggedIn"] = status.LoggedIn
|
||||
responseJSON, _ := json.Marshal(response)
|
||||
|
@ -27,7 +27,7 @@ type VaultStatusResponse struct {
|
||||
NumberOfLogins int
|
||||
NumberOfNotes int
|
||||
LastSynced int64
|
||||
WebsockedConnected bool
|
||||
WebsocketConnected bool
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
8
go.mod
8
go.mod
@ -13,21 +13,21 @@ require (
|
||||
github.com/gen2brain/beeep v0.0.0-20240112042604-c7bb2cd88fea
|
||||
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/gorilla/websocket v1.5.1
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
github.com/icza/gox v0.0.0-20230924165045-adcb03233bb5
|
||||
github.com/keybase/client/go v0.0.0-20240424154521-52f30ea26cb1
|
||||
github.com/lox/go-touchid v0.0.0-20170712105233-619cc8e578d0
|
||||
github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a
|
||||
github.com/mitchellh/go-ps v1.0.0
|
||||
github.com/rymdport/portal v0.2.3
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/tailscale/peercred v0.0.0-20240214030740-b535050b2aa4
|
||||
github.com/tink-crypto/tink-go/v2 v2.2.0
|
||||
github.com/twpayne/go-pinentry v0.3.0
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1
|
||||
golang.org/x/crypto v0.23.0
|
||||
golang.org/x/crypto v0.24.0
|
||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
|
||||
golang.org/x/sys v0.20.0
|
||||
golang.org/x/sys v0.21.0
|
||||
)
|
||||
|
||||
require (
|
||||
|
22
go.sum
22
go.sum
@ -15,7 +15,7 @@ github.com/awnumar/memcall v0.2.0/go.mod h1:S911igBPR9CThzd/hYQQmTc9SWNu3ZHIlCGa
|
||||
github.com/awnumar/memguard v0.22.5 h1:PH7sbUVERS5DdXh3+mLo8FDcl1eIeVjJVYMnyuYpvuI=
|
||||
github.com/awnumar/memguard v0.22.5/go.mod h1:+APmZGThMBWjnMlKiSM1X7MVpbIVewen2MTkqWkA/zE=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@ -32,8 +32,8 @@ github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
|
||||
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
|
||||
github.com/icza/gox v0.0.0-20230924165045-adcb03233bb5 h1:K7KEFpKgVcjj98jOu2Z3xMBTtTwfYVT90Zmo3ZuWmbE=
|
||||
@ -86,8 +86,8 @@ github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWR
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/rymdport/portal v0.2.3 h1:5RoAuMy5wNzEzITwK+9YpMQLU5m7F7IYfmPwN/aVpUk=
|
||||
github.com/rymdport/portal v0.2.3/go.mod h1:kFF4jslnJ8pD5uCi17brj/ODlfIidOxlgUDTO5ncnC4=
|
||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
|
||||
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
@ -106,8 +106,8 @@ github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IU
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
|
||||
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
|
||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY=
|
||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI=
|
||||
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
|
||||
@ -118,10 +118,10 @@ golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
|
||||
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -110,7 +110,7 @@ Adw.ApplicationWindow window {
|
||||
icon-name: "emblem-synchronizing-symbolic";
|
||||
}
|
||||
Adw.ActionRow websocket_connected_row {
|
||||
title: "Websocked Connected";
|
||||
title: "Websocket Connected";
|
||||
subtitle: "False";
|
||||
}
|
||||
Adw.ActionRow logins_row {
|
||||
|
Loading…
Reference in New Issue
Block a user