crypt

package
v1.53.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: MIT Imports: 4 Imported by: 0

README

crypt

GoDoc

Package crypt contains utilities to read and write encrypted text and protos.

Install
import (
	"libs.altipla.consulting/crypt"
)
Contributing

You can make pull requests or create issues in GitHub. Any code you send should be formatted using make gofmt.

Running tests

Run the tests:

make test
License

MIT License

Documentation

Overview

Package crypt contains utilities to read and write encrypted text and protos.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyToken   = errors.New("empty token")
	ErrExpiredToken = errors.New("expired token")
)

Functions

This section is empty.

Types

type SignOption

type SignOption func(c *configurator)

func WithTTL

func WithTTL(ttl time.Duration) SignOption

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

func NewSigner

func NewSigner(signature, secret string) *Signer

NewSigner creates a new signer with the following params:

  • signature: 32 random characters.
  • secret: 16, 24, or 32 random characters to select AES-128, AES-192, or AES-256.

func (*Signer) ReadMessage

func (s *Signer) ReadMessage(token string, msg proto.Message, opts ...SignOption) error

func (*Signer) SignMessage

func (s *Signer) SignMessage(msg proto.Message, opts ...SignOption) (string, error)

func (*Signer) String

func (s *Signer) String() string

Jump to

Keyboard shortcuts

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