Categorygithub.com/launchrctl/keyring
modulepackage
0.2.6
Repository: https://github.com/launchrctl/keyring.git
Documentation: pkg.go.dev

# README

Launchr Keyring

Keyring is a launchr plugin and a service providing a password storage functionality encrypted with age. The storage is encrypted with a passphrase.

How to use

To add a new item with an interactive shell:

launchr login

If an interactive shell is not available, credentials may be provided with flags:

launchr login \
  --url=https://your.gitlab.com \
  --username=USER \
  --password=SECRETPASSWORD \
  --keyring-passphrase=YOURPASSHRPASE

Flag --keyring-passphrase is available for all launchr commands, for example:

launchr compose --keyring-passphrase=YOURPASSHRPASE

To delete an item from the keyring:

launchr logout URL
launchr logout --all

The file is created in .launchr/keyring.yaml.age.
The content may be viewed/edited with age cli:

age -d .launchr/keyring.yaml.age
age -p .launchr/keyring.yaml > .launchr/keyring.yaml.age

In code

Add a module dependency:

go get -u github.com/launchrctl/keyring

To use the keyring in code, get the service from the app:

package main

import (
	"github.com/launchrctl/keyring"
	"github.com/launchrctl/launchr"
)

func GetPassword(app launchr.App, url string) (keyring.CredentialsItem, error) {
	// Get the service by type from the app.
	var k keyring.Keyring
	app.GetService(k)
	// Get by url. Error if the keyring could not be unlocked.
	// Error keyring.ErrNotFound is returned if an item was not found.
	creds, err := k.GetForURL(url)
	if err != nil {
		return keyring.CredentialsItem{}, err
	}
	return creds, nil
}

Include with launchr build:

launchr build -p github.com/launchrctl/keyring

# Packages

No description provided by the author

# Functions

AddValueProcessors adds a keyring [action.ValueProcessor] to [action.Manager].
RequestCredentialsFromTty gets credentials from tty.
RequestKeyValueFromTty gets key-value pair from tty.

# Variables

ErrEmptyFields if fields are empty.
ErrEmptyPass if a passphrase is empty.
ErrKeyringMalformed when keyring can't be read.
ErrNotFound if an item was not found.

# Structs

AskPassWithTerminal implements AskPass and uses tty to retrieve passphrase.
CredentialsItem stores credentials.
KeyValueItem stores key-value pair.
Plugin is [launchr.Plugin] plugin providing a keyring.

# Interfaces

AskPass defines basic interface to retrieve passphrase.
CredentialsFile is an interface to open and edit credentials file.
DataStore provides password storage functionality.
Keyring is a [launchr.Service] providing password store functionality.
SecretItem is an interface that represents an item saved in a storage.

# Type aliases

AskPassConstFlow implements AskPass and returns constant.