vaultransit

package module
v0.0.0-...-b7fb99c Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 9 Imported by: 0

README

Example:

func main() {
	c := Client{
		Config: Config{
			URL:                "https://somewhe.re",
			EncryptionKeyName:  "myEncryptionKeyName",
			SignatureAlgorithm: PKCS1v15,
		},
	}

	sign, err := signer.Sign(rand.Reader, []byte("my message"), crypto.SHA256)
	if err != nil {
		log.Fatal(err)
	}
}

Documentation

Index

Constants

View Source
const (
	XVaultToken     = "X-Vault-Token"
	XVaultNamespace = "X-Vault-Namespace"
)

Variables

This section is empty.

Functions

func Hash

func Hash(hash crypto.Hash) (string, error)

Types

type Client

type Client struct {
	Config
	HTTPClient *http.Client
}

func (Client) Public

func (c Client) Public() crypto.PublicKey

func (Client) Sign

func (c Client) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)

type Config

type Config struct {
	URL                string
	SecretEngine       string // SecretEngine the default value is transit
	EncryptionKeyName  string
	SignatureAlgorithm SignatureAlgorithm
	Token              string
	Namespace          string
}

type SignReq

type SignReq struct {
	Input              []byte             `json:"input"`
	PreHashed          bool               `json:"prehashed"`
	SignatureAlgorithm SignatureAlgorithm `json:"signature_algorithm"`
}

type SignResp

type SignResp struct {
	Data struct {
		Signature string `json:"signature"`
	} `json:"data"`
}

type SignatureAlgorithm

type SignatureAlgorithm string
const (
	PKCS1v15 SignatureAlgorithm = "pkcs1v15"
	PSS      SignatureAlgorithm = "pss"
)

Jump to

Keyboard shortcuts

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