gosecret/doc.go

89 lines
3.1 KiB
Go
Raw Normal View History

2021-11-26 00:04:18 -05:00
// See LICENSE in source root directory for copyright and licensing information.
/*
2021-11-27 02:26:51 -05:00
Package gosecret is(/was originally) a fork of go-libsecret (see https://github.com/gsterjov/go-libsecret
2021-11-26 00:04:18 -05:00
and https://pkg.go.dev/github.com/gsterjov/go-libsecret).
It was forked in order to present bugfixes, actually document the library, conform to more Go-like patterns, and
provide missing functionality (as the original seems to be unmaintained).
As such, hopefully this library should serve as a more effective libsecret/SecretService interface.
Backwards Compatibility
2021-11-27 02:26:51 -05:00
Version series `v0.X.X` of this library promises full and non-breaking backwards compatibility/drop-in
support of API interaction with the original project.
2021-11-26 00:04:18 -05:00
The only changes should be internal optimizations, adding documentation, some file reorganizing, adding Golang module support,
etc. -- all transparent from the library API itself.
2021-11-27 02:26:51 -05:00
To use this library as a replacement without significantly modifying your code,
you can simply use a `replace` directive in your go.mod file:
2021-11-26 00:04:18 -05:00
// ...
replace (
github.com/gsterjov/go-libsecret dev => r00t2.io/gosecret v0
)
and then run `go mod tidy`.
Do NOT use the master branch. For anything. I make no promises on the stability of that branch at any given time.
New features will be added to V1 branch, and stable releases will be tagged. V0 branch is reserved only for optimization and bug fixes.
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`.
2021-11-27 02:26:51 -05:00
SecretService Concepts
For reference:
2021-12-13 00:18:36 -05:00
- A Service allows one to retrieve and operate on/with Session and Collection objects.
2021-11-27 02:26:51 -05:00
2021-12-13 00:18:36 -05:00
- A Session allows one to operate on/with Item objects (e.g. parsing/decoding/decrypting them).
2021-11-27 02:26:51 -05:00
2021-12-13 00:18:36 -05:00
- A Collection allows one to retrieve and operate on/with Item objects.
2021-11-27 02:26:51 -05:00
2021-12-13 00:18:36 -05:00
- An Item allows one to retrieve and operate on/with Secret objects.
2021-11-27 02:26:51 -05:00
(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"
2021-12-13 00:18:36 -05:00
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"
2021-11-27 02:26:51 -05:00
And so on.
2021-12-13 00:18:36 -05:00
In PRACTICE, however, most users will only have two Collection items
(a default "system" one named "login", which usually is unlocked upon login,
and a temporary one that may or may not exist, running in memory for the current login session named `session`).
2021-11-27 02:26:51 -05:00
2021-11-26 00:04:18 -05:00
Usage
Full documentation can be found via inline documentation.
Additionally, use either https://pkg.go.dev/r00t2.io/gosecret or https://pkg.go.dev/golang.org/x/tools/cmd/godoc (or `go doc`) in the source root.
*/
2021-12-13 00:18:36 -05:00
package gosecret