auth

package module
v0.0.0-...-f8f25fb Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: BSD-3-Clause Imports: 17 Imported by: 0

README

CrossTalk Auth Build Status

Minimalist auth library.

Documentation

Index

Constants

View Source
const (
	HS256 = "HS256"
	HS384 = "HS384"
	HS512 = "HS512"
	ES256 = "ES256"
	ES384 = "ES384"
	ES512 = "ES512"
)

Variables

Functions

func RegisterBlobStore

func RegisterBlobStore(proto string, factory BlobStoreFactory)

Types

type Algorithm

type Algorithm string

type Blob

type Blob struct {
	Algorithm string `protobuf:"bytes,1,opt,name=algorithm,proto3" json:"algorithm,omitempty"`
	Secret    []byte `protobuf:"bytes,2,opt,name=secret,proto3" json:"secret,omitempty"`
	EcdsaKey  []byte `protobuf:"bytes,3,opt,name=ecdsa_key,json=ecdsaKey,proto3" json:"ecdsa_key,omitempty"`
	// contains filtered or unexported fields
}

func (*Blob) Descriptor deprecated

func (*Blob) Descriptor() ([]byte, []int)

Deprecated: Use Blob.ProtoReflect.Descriptor instead.

func (*Blob) GetAlgorithm

func (x *Blob) GetAlgorithm() string

func (*Blob) GetEcdsaKey

func (x *Blob) GetEcdsaKey() []byte

func (*Blob) GetSecret

func (x *Blob) GetSecret() []byte

func (*Blob) ProtoMessage

func (*Blob) ProtoMessage()

func (*Blob) ProtoReflect

func (x *Blob) ProtoReflect() protoreflect.Message

func (*Blob) Reset

func (x *Blob) Reset()

func (*Blob) String

func (x *Blob) String() string

type BlobStore

type BlobStore interface {
	io.Closer
	GetBlob(id string) ([]byte, error)
	PutBlob(id string, val []byte) error
	DelBlob(id string) (bool, error)
	ListBlobIDs() ([]string, error)
}

func NewBlobStore

func NewBlobStore(logger log.Logger, url_ string) (BlobStore, error)

type BlobStoreFactory

type BlobStoreFactory interface {
	CreateBlobStore(logger log.Logger, url *url.URL) (BlobStore, error)
}

type Key

type Key struct {
	ID        string
	Algorithm Algorithm
	Secret    []byte
	ECDSAKey  *ecdsa.PrivateKey
}

func NewKey

func NewKey(id string, secret []byte) *Key

func (*Key) CreateToken

func (k *Key) CreateToken(claims interface{}) ([]byte, error)

func (*Key) ParseToken

func (k *Key) ParseToken(token []byte, claims interface{}) error

func (*Key) SetAlgorithm

func (k *Key) SetAlgorithm(algo Algorithm) error

type KeyStore

type KeyStore interface {
	io.Closer
	PutKey(key *Key) error
	GetKey(id string) (*Key, error)
	DelKey(id string) (bool, error)
	ListKeyIDs() ([]string, error)
}

func NewBlobKeyStore

func NewBlobKeyStore(logger log.Logger, store BlobStore) KeyStore

func NewKeyStore

func NewKeyStore(logger log.Logger, url string) (KeyStore, error)

type Manager

type Manager struct {
	log.Sugar
	// contains filtered or unexported fields
}

func NewManager

func NewManager(logger log.Logger, store KeyStore) *Manager

func (*Manager) VerifyToken

func (m *Manager) VerifyToken(token []byte, payload interface{}) (*Key, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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