crypt

package
v1.82.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 5 Imported by: 0

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