secrets

package module
v0.0.0-...-0cfc645 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

README

README

secrets is a collection of simple routines initializing authorized services using Username/Password, keys, json objects and other credentials from the system keyring.

Example

To store a Google Service Account in the keyring:

package main

import (
    "github.com/jfcote87/secrets"
    "github.com/jfcote87/secrets/googlejwt"
)

func main() {
    serviceAccountID := "cloud-function@project.iam.gserviceaccount.com" 
    // create key
    if err := secrets.SetFile(secrets.ServiceGoogle, 
        serviceAccountID, "keyfiles/project-740afd094af1.json"); err != nil {
            log.Fatalf("set failed: %v", err)
        }
    cl, err := googlejwt.Client(serviceAccountID, "jcote@example.com", "scope1","scope2)
    if err != nil {
        log.Fatalf("%v", err)
    }
    _ = cl
}

Documentation

Overview

Package secrets provides a simple interface to return credentials/key/dsn from keyring

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(service ServiceName, key string) (string, error)

Get returns a secret from keyring

func Set

func Set(service ServiceName, key, value string) error

Set adds a new secret to the keyring

func SetFromFile

func SetFromFile(svnm ServiceName, key, filename string) error

SetFromFile adds a new secret to the keyring

Types

type ServiceName

type ServiceName string

ServiceName provides name for keyring list

const (
	// ServiceSQL is id for sql dsn secrets
	ServiceSQL ServiceName = "sql"
	// ServiceSSHDB is id fro sshdb configuration secrets
	ServiceSSHDB ServiceName = "sshdb"
	// ServiceIntacct is id for intacct configuration secrets
	ServiceIntacct ServiceName = "intacct"
	// ServiceSalesforce is id for salesforce configurations
	ServiceSalesforce ServiceName = "sf"
	// ServiceCertify is id for certify configs
	ServiceCertify ServiceName = "certify"
	// ServiceDocuSign is id for docusign configs
	ServiceDocuSign ServiceName = "esign"
	// ServiceJira is id for jira jwt configs
	ServiceJira ServiceName = "jira"
	// ServiceGoogle is id for google jwt configs
	ServiceGoogle ServiceName = "google"
)

Directories

Path Synopsis
Package certify provides a simple interface for generating a certify api service from a keyring entry
Package certify provides a simple interface for generating a certify api service from a keyring entry
Package esign provides a simple interface genarate credentials for esign api service from a keyring entry
Package esign provides a simple interface genarate credentials for esign api service from a keyring entry
Package googlejwt provides a simple way to generate a Google JWT Tokensource
Package googlejwt provides a simple way to generate a Google JWT Tokensource
Package intacct provides a client for accessing the Intacct API.
Package intacct provides a client for accessing the Intacct API.
Package jira provides a client for accessing the Jira API.
Package jira provides a client for accessing the Jira API.
Package salesforcejwt provides a simple way to generate a JWT assertion from a keyring entry
Package salesforcejwt provides a simple way to generate a JWT assertion from a keyring entry
Package sqldb provides a simple way to get an mssql db connection from a keyring
Package sqldb provides a simple way to get an mssql db connection from a keyring
sshdb creates an ssh database using credentials for the keyring
sshdb creates an ssh database using credentials for the keyring

Jump to

Keyboard shortcuts

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