Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle locked collections/items #5

Merged
merged 2 commits into from
Sep 4, 2024
Merged

Handle locked collections/items #5

merged 2 commits into from
Sep 4, 2024

Conversation

camh-
Copy link
Member

@camh- camh- commented Aug 31, 2024

Handle get/store/erase on locked collections and items. When an item is
locked, we typically get a "prompt" dbus object that we need to call the
"Prompt" method on. This causes the Secret Service (gnome-keyring) to pop
up a window prompting the user for the password to unlock the item.

Use a Go 1.23 range/iterator function to iterate over the search results
when looking up a secret. This handles the unlocked and locked results
transparently, unlocking any matching locked items found. The iterator also
returns only the items that match the attributes exactly. This makes the
implementation of Get and Delete simpler.

Upgrade the hermit verrsion of Go and bump the "go" version in go.mod
so that we can use range functions.

Bump the Go version to Go 1.23 so we can use range functions.

Bump golangci-lint to handle the new version of Go. Disable
`exportloopref` linter as it is deprecated. Disable the `gci` linter
because it is emitting nonsensical errors and I don't use `gci`.
Ignore one new lint bogus warning.

    hermit upgrade go golangci-lint
@camh- camh- force-pushed the prompt-and-unlock branch 3 times, most recently from 8667acd to be2bb05 Compare September 1, 2024 22:11
Copy link
Member

@juliaogris juliaogris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for explaining iterators 💚

dbus.go Outdated Show resolved Hide resolved
dbus.go Outdated Show resolved Hide resolved
dbus.go Outdated Show resolved Hide resolved
dbus.go Outdated Show resolved Hide resolved
dbus.go Outdated Show resolved Hide resolved
dbus.go Outdated Show resolved Hide resolved
dbus.go Outdated Show resolved Hide resolved
dbus.go Outdated Show resolved Hide resolved
dbus.go Show resolved Hide resolved
@camh-
Copy link
Member Author

camh- commented Sep 3, 2024

@juliaogris PTAL if you like. I've addressed all your comments - code reads nicer now, thanks. I've left the individual fixup commits here for now (although I didn't bother to link them to the comments - a bit tedious). It should help see how I made the changes.

Handle get/store/erase on locked collections and items. When an item is
locked, we typically get a "prompt" dbus object that we need to call the
"Prompt" method on. This causes the Secret Service (gnome-keyring) to
pop up a window prompting the user for the password to unlock the item.

Use a Go 1.23 range/iterator function to iterate over the search results
when looking up a secret. This handles the unlocked and locked results
transparently, unlocking any matching locked items found. The iterator
also returns only the items that match the attributes exactly. This
makes the implementation of Get and Delete simpler.

Bump the "go" version in `go.mod` so that we can use range functions.
@camh- camh- force-pushed the prompt-and-unlock branch from 67f8424 to 8897c37 Compare September 4, 2024 01:53
@camh- camh- merged commit 29238cc into master Sep 4, 2024
3 checks passed
@camh- camh- deleted the prompt-and-unlock branch September 4, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants