timebox

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 11 Imported by: 0

README

timebox

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Clock = clock.NewClock()

Functions

This section is empty.

Types

type Boxer

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

Boxer provides a limited API for encrypting protobuf messages that expire after some time

func New

func New(secret string) (*Boxer, error)

New returns a new Boxer

func (*Boxer) Open

func (b *Boxer) Open(sealed string, output proto.Message) bool

Open takes an encrypted timebox and attempts to decrypt and unmarshal it into output. If all operations succeed (decryption, verifying expiration, unmarshalling), Open returns true. Otherwise, Open returns false.

func (*Boxer) Seal

func (b *Boxer) Seal(message proto.Message, maxAge time.Duration) (string, error)

Seal encrypts the given message in a box that expires after maxAge has elapsed

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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