GoSecret is a Golang library to interface with SecretService/libsecret/Gnome-Keyring via DBus. https://pkg.go.dev/r00t2.io/gosecret
Go to file
2021-12-08 02:34:27 -05:00
.idea checking in some work- adding custom errors and low-level compat with SecretService, but it may not be needed. 2021-11-28 21:43:30 -05:00
.gitignore improvements, start integration tests 2021-12-07 02:56:15 -05:00
.ref checking in some work- adding custom errors and low-level compat with SecretService, but it may not be needed. 2021-11-28 21:43:30 -05:00
collection_funcs.go improvements, start integration tests 2021-12-07 02:56:15 -05:00
consts.go improvements, start integration tests 2021-12-07 02:56:15 -05:00
conts_test.go improvements, start integration tests 2021-12-07 02:56:15 -05:00
doc.go checking in - all basic funcs in place; add a few more then v1 merge 2021-12-06 03:24:55 -05:00
errs.go collection, service, and session should be done 2021-12-04 19:38:26 -05:00
funcs.go checking in - all basic funcs in place; add a few more then v1 merge 2021-12-06 03:24:55 -05:00
go.mod checking in more tests for Service. 2021-12-08 02:34:27 -05:00
go.sum checking in more tests for Service. 2021-12-08 02:34:27 -05:00
item_funcs.go improvements, start integration tests 2021-12-07 02:56:15 -05:00
LICENSE v0.0.1 is now done. 2021-11-21 18:07:52 -05:00
multierr_funcs.go docs, workflow change 2021-11-27 02:24:22 -05:00
prompt_funcs.go checking in - all basic funcs in place; add a few more then v1 merge 2021-12-06 03:24:55 -05:00
README.adoc checking in - all basic funcs in place; add a few more then v1 merge 2021-12-06 03:24:55 -05:00
secret_funcs.go checking in - all basic funcs in place; add a few more then v1 merge 2021-12-06 03:24:55 -05:00
secretvalue_funcs.go checking in - all basic funcs in place; add a few more then v1 merge 2021-12-06 03:24:55 -05:00
service_funcs_test.go checking in more tests for Service. 2021-12-08 02:34:27 -05:00
service_funcs.go checking in more tests for Service. 2021-12-08 02:34:27 -05:00
session_funcs.go checking in more tests for Service. 2021-12-08 02:34:27 -05:00
sserror_funcs.go checking in - all basic funcs in place; add a few more then v1 merge 2021-12-06 03:24:55 -05:00
TODO improvements, start integration tests 2021-12-07 02:56:15 -05:00
types.go improvements, start integration tests 2021-12-07 02:56:15 -05:00

libsecret/gosecret

gosecret

This project is originally forked from go-libsecret due to:

  • Lack of response from the developer

  • Complete lack of documentation

  • Poor, ineffecient, or just plain antipattern design

  • Missing functionality

and as such, hopefully this library should serve as a more effective libsecret/SecretService interface.

1. Backwards Compatability/Drop-In Replacement Support

Version series v0.X.X of this library promises full and non-breaking backwards support of API interaction with the original project. The only changes should be internal optimizations, adding documentation, some file reorganizing, adding Golang module support, etc.all transparent from the library API itself.

To use this library as a replacement without significantly modifying your code, you can simply use a replace directive:

go.mod
// ...
replace (
	github.com/gsterjov/go-libsecret dev => r00t2.io/gosecret v0
)

and then run go mod tidy.

2. New Developer API

Starting from v1.0.0 onwards, entirely breaking changes can be assumed from the original project.

To use the new version,

import (
	`r00t2.io/gosecret/v1`
)

To reflect the absolute breaking changes, the module name changes as well from libsecret to gosecret.

2.1. Status

The new API is underway, and all functionality in V0 is present. However, its not "complete". PRs welcome, of course, but this will be an ongoing effort for a bit of time.

3. SecretService Concepts

For reference:

  • A Service allows one to retrieve and operate on/with Session and Collection objects.

  • A Session allows one to operate on/with Item objects (e.g. parsing/decoding/decrypting them).

  • A Collection allows one to retrieve and operate on/with Item objects.

  • An Item allows one to retrieve and operate on/with Secret objects.

(Secrets are considered "terminating objects" in this model, and contain actual secret value(s) and metadata).

Various interactions are handled by Prompts.

So the object hierarchy in theory looks kind of like this:

Service
├─ Session "A"
├─ Session "B"
├─ Collection "A"
│	├─ Item "A.1"
│	│	├─ Secret "A_1_a"
│	│	└─ Secret "A_1_b"
│	└─ Item "A.2"
│		├─ Secret "A_2_a"
│		└─ Secret "A_2_b"
└─ Collection "B"
    ├─ Item "B.1"
    │	├─ Secret "B_1_a"
    │	└─ Secret "B_1_b"
    └─ Item "B.2"
        ├─ Secret "B_2_a"
        └─ Secret "B_2_b"

And so on.

In practice, however, most users will only have two Session types:

  • a default "system" one, and

  • a temporary one that may or may not exist, running in memory for the current login session

and a single Collection, named login (and aliased to default, usually).

4. Usage

Full documentation can be found via inline documentation. Either via the pkg.go.dev documentation or godoc (or go doc) in the source root.