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

How to use the default keyring using SecretServiceBackend? #134

Open
benma opened this issue Dec 30, 2023 · 1 comment
Open

How to use the default keyring using SecretServiceBackend? #134

benma opened this issue Dec 30, 2023 · 1 comment

Comments

@benma
Copy link

benma commented Dec 30, 2023

Whatever I use for LibSecretCollectionName or ServiceName, the library attempts to create a new keyring. How can I use the default keyring? In seahorse it is listed as Default keyring:

Even if I name the collection the same way, the library will create a new keyring with the same name:

package main

import (
	"github.com/99designs/keyring"
)

func main() {
	ring, err := keyring.Open(keyring.Config{
		AllowedBackends: []keyring.BackendType{
			keyring.SecretServiceBackend,
		},
		LibSecretCollectionName: "Default keyring",
		ServiceName:             "myapp",
	})
	if err != nil {
		panic(err)
	}

	err = ring.Set(keyring.Item{
		Key:  "foo",
		Data: []byte("secret-bar"),
	})
	if err != nil {
		panic(err)
	}
}

With the https://github.com/zalando/go-keyring library, using their example from the README will write to the default keyring, so it should be possible somehow.

@tylercreller
Copy link

@benma I was able to work around this by not including a space in my LibSecretCollectionName.

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

No branches or pull requests

2 participants