salt

package
v0.0.0-...-64c530f Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0, BSD-2-Clause Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const SaltByteSize = 20

SaltByteSize specifies the number of bytes used for the salt.

Variables

This section is empty.

Functions

This section is empty.

Types

type Salt

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

Salt encapsulates high level functions around salt management.

func FromProto

func FromProto(in *pb.Salt) (*Salt, error)

FromProto decodes a given proto buffer Salt message (in) and returns the corresponding Salt.

func NewSalt

func NewSalt(lifetime time.Duration) (salt *Salt, err error)

NewSalt generates a new salt given a lifetime duration.

func Unmarshal

func Unmarshal(data []byte) (*Salt, error)

Unmarshal de-serializes a given slice of bytes (data) into a Salt.

func (*Salt) Expired

func (s *Salt) Expired() bool

Expired returns true if the given salt expired.

func (*Salt) GetBytes

func (s *Salt) GetBytes() []byte

func (*Salt) GetExpiration

func (s *Salt) GetExpiration() time.Time

func (*Salt) Marshal

func (s *Salt) Marshal() ([]byte, error)

Marshal serializes a given salt (s) into a slice of bytes (data).

func (*Salt) ToProto

func (s *Salt) ToProto() *pb.Salt

ToProto encodes the Salt into a proto buffer Salt message.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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