https://github.com/abecodes/gokystr
A simple keystore for rsa keys
https://github.com/abecodes/gokystr
Last synced: 12 months ago
JSON representation
A simple keystore for rsa keys
- Host: GitHub
- URL: https://github.com/abecodes/gokystr
- Owner: abecodes
- License: unlicense
- Created: 2022-02-26T18:22:41.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-09T20:29:51.000Z (over 4 years ago)
- Last Synced: 2024-06-20T05:22:12.971Z (about 2 years ago)
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# :package: Gokystr
**Gokystr** is a simple implementation of a filebased keystore for private keys.
On initialization the keystore reads the private keys from a folder and keeps them in memory.
Additional added keys can be written back to the file system, if enabled.
The ID for the key equals the filename minus the fileextension.
## :computer: Example
```go
package main
import "github.com/abecodes/gokystr"
func main() {
kystr, err := gokystr.New("/folder/with/keyfiles")
// Retrieving a key
prvKey, err := kystr.PrivateKey("keyname")
pubKey, err := kystr.PublicKey("keyname")
// Adding a key
err := kystr.Add("keyname", *rsa.PrivateKey)
// Removing a key
err := kystr.Remove("keyid")
}
```
## :clipboard: Options
| Option | Info | Default |
| --- | --- | --- |
| AcceptEmpty | If true, the keystore will not throw if the passed folder does not contain any keys | false |
| NoWrite | If true, additional added keys will not be written to the filesystem | false |
| SetKeyExt | Change the fileextension used to identify keyfiles | .pem |