vault

package module
v1.0.2-0...-730f041 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2020 License: MIT Imports: 7 Imported by: 0

README

Secretly

Secretly is a golang package that allows you to store and retrieve secrets such as api keys on your local machine in an encrypted file.

Basic Use

  1. Open a vault (a file where your secrets are stored)
v, err := FileVault("test4.json", FileVaultOptions{CreateNew: true})
	if err != nil {
		log.Fatal(err)
	}
  1. Store your secret
err = v.Set("password", "jghdbsh878yrjr98fni", "Gbola") //keyname, keyvalue, encryption key
	if err != nil {
		log.Fatal(err)
	}
  1. Retrieve your secret
value, err := v.Get("password", "Gbola") //keyname, encryption key
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(value) //jghdbsh878yrjr98fni

Contributing

This package is open to contributions. Just create and issue and make a pull request!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileVaultOptions

type FileVaultOptions struct {
	CreateNew bool
}

FileVaultOptions defines options for the FileVault function

type Vault

type Vault struct {
	FilePath string
	// contains filtered or unexported fields
}

Vault represents a vault where api keys and similar sensitive information can be stored and retrieved. To open a vault, use FileVault

func FileVault

func FileVault(filePath string, options FileVaultOptions) (Vault, error)

FileVault takes in an encoding key(similar to a password) and file path to the vault. If both parameters are correct and valid, a vault is returned.

func (Vault) Get

func (v Vault) Get(keyname, encodingKey string) (string, error)

Get retrives a secret using a keyname

func (Vault) Set

func (v Vault) Set(keyname, keyvalue, encodingKey string) error

Set Stores a secret using the keyname as an identifier

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL