encoder

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base64Encoder

type Base64Encoder struct{}

Base64Encoder implements the Encoder interface by delegating to the encoding/base64 base64 encoding strategy.

func NewBase64Encoder

func NewBase64Encoder() *Base64Encoder

NewBase64Encoder constructs an Encoder that implements a base64 encoding as specified by the encoding/base64 package.

func (*Base64Encoder) Decode

func (e *Base64Encoder) Decode(s string) ([]byte, error)

Decode base64 URL decodes the provided string.

func (*Base64Encoder) Encode

func (e *Base64Encoder) Encode(data []byte) (string, error)

Encode base64 URL encodes the provided byte slice and returns the encoded value as a string.

type Encoder

type Encoder interface {
	Decode(string) ([]byte, error)
	Encode([]byte) (string, error)
}

type NoopEncoder added in v0.1.5

type NoopEncoder struct{}

func (NoopEncoder) Decode added in v0.1.5

func (e NoopEncoder) Decode(s string) ([]byte, error)

func (NoopEncoder) Encode added in v0.1.5

func (e NoopEncoder) Encode(data []byte) (string, error)

type TokenEncoder added in v0.1.5

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

func NewTokenEncoder added in v0.1.5

func NewTokenEncoder(encrypter encrypter.Encrypter, encoder Encoder) *TokenEncoder

NewTokenEncoder constructs a TokenEncoder with the provided encrypter and encoder.

func (*TokenEncoder) Decode added in v0.1.5

func (e *TokenEncoder) Decode(s string) ([]byte, error)

Decode will first decode the given string with its decoder, then decrypt the result with its decrypter.

func (*TokenEncoder) Encode added in v0.1.5

func (e *TokenEncoder) Encode(data []byte) (string, error)

Encode will first encrypt the given data with its encrypter, then encode the result with its encoder.

Jump to

Keyboard shortcuts

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