jwk

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2016 License: Apache-2.0 Imports: 27 Imported by: 173

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func First

func First(keys []jose.JsonWebKey) *jose.JsonWebKey

func MustRSAPrivate

func MustRSAPrivate(key *jose.JsonWebKey) *rsa.PrivateKey

func MustRSAPublic

func MustRSAPublic(key *jose.JsonWebKey) *rsa.PublicKey

func PEMBlockForKey

func PEMBlockForKey(key interface{}) (*pem.Block, error)

func ToRSAPrivate

func ToRSAPrivate(key *jose.JsonWebKey) (*rsa.PrivateKey, error)

func ToRSAPublic

func ToRSAPublic(key *jose.JsonWebKey) (*rsa.PublicKey, error)

Types

type AEAD

type AEAD struct {
	Key []byte
}

func (*AEAD) Decrypt

func (c *AEAD) Decrypt(ciphertext string) ([]byte, error)

func (*AEAD) Encrypt

func (c *AEAD) Encrypt(plaintext []byte) (string, error)

type ECDSA256Generator

type ECDSA256Generator struct{}

func (*ECDSA256Generator) Generate

func (g *ECDSA256Generator) Generate(id string) (*jose.JsonWebKeySet, error)

type ECDSA521Generator added in v0.2.0

type ECDSA521Generator struct{}

func (*ECDSA521Generator) Generate added in v0.2.0

func (g *ECDSA521Generator) Generate(id string) (*jose.JsonWebKeySet, error)

type HS256Generator

type HS256Generator struct {
	Length int
}

func (*HS256Generator) Generate

func (g *HS256Generator) Generate(id string) (*jose.JsonWebKeySet, error)

type HTTPManager added in v0.2.0

type HTTPManager struct {
	Client   *http.Client
	Endpoint *url.URL
	Dry      bool
}

func (*HTTPManager) AddKey added in v0.2.0

func (m *HTTPManager) AddKey(set string, key *jose.JsonWebKey) error

func (*HTTPManager) AddKeySet added in v0.2.0

func (m *HTTPManager) AddKeySet(set string, keys *jose.JsonWebKeySet) error

func (*HTTPManager) CreateKeys added in v0.2.0

func (m *HTTPManager) CreateKeys(set, algorithm string) (*jose.JsonWebKeySet, error)

func (*HTTPManager) DeleteKey added in v0.2.0

func (m *HTTPManager) DeleteKey(set, kid string) error

func (*HTTPManager) DeleteKeySet added in v0.2.0

func (m *HTTPManager) DeleteKeySet(set string) error

func (*HTTPManager) GetKey added in v0.2.0

func (m *HTTPManager) GetKey(set, kid string) (*jose.JsonWebKeySet, error)

func (*HTTPManager) GetKeySet added in v0.2.0

func (m *HTTPManager) GetKeySet(set string) (*jose.JsonWebKeySet, error)

type Handler

type Handler struct {
	Manager    Manager
	Generators map[string]KeyGenerator
	H          herodot.Herodot
	W          firewall.Firewall
}

func (*Handler) Create

func (h *Handler) Create(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Handler) DeleteKey

func (h *Handler) DeleteKey(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Handler) DeleteKeySet

func (h *Handler) DeleteKeySet(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Handler) GetGenerators added in v0.2.0

func (h *Handler) GetGenerators() map[string]KeyGenerator

func (*Handler) GetKey

func (h *Handler) GetKey(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Handler) GetKeySet

func (h *Handler) GetKeySet(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Handler) SetRoutes

func (h *Handler) SetRoutes(r *httprouter.Router)

func (*Handler) UpdateKey

func (h *Handler) UpdateKey(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Handler) UpdateKeySet

func (h *Handler) UpdateKeySet(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

type KeyGenerator

type KeyGenerator interface {
	Generate(id string) (*jose.JsonWebKeySet, error)
}

type Manager

type Manager interface {
	AddKey(set string, key *jose.JsonWebKey) error

	AddKeySet(set string, keys *jose.JsonWebKeySet) error

	GetKey(set, kid string) (*jose.JsonWebKeySet, error)

	GetKeySet(set string) (*jose.JsonWebKeySet, error)

	DeleteKey(set, kid string) error

	DeleteKeySet(set string) error
}

type MemoryManager

type MemoryManager struct {
	Keys map[string]*jose.JsonWebKeySet
	sync.RWMutex
}

func (*MemoryManager) AddKey

func (m *MemoryManager) AddKey(set string, key *jose.JsonWebKey) error

func (*MemoryManager) AddKeySet

func (m *MemoryManager) AddKeySet(set string, keys *jose.JsonWebKeySet) error

func (*MemoryManager) DeleteKey

func (m *MemoryManager) DeleteKey(set, kid string) error

func (*MemoryManager) DeleteKeySet

func (m *MemoryManager) DeleteKeySet(set string) error

func (*MemoryManager) GetKey

func (m *MemoryManager) GetKey(set, kid string) (*jose.JsonWebKeySet, error)

func (*MemoryManager) GetKeySet

func (m *MemoryManager) GetKeySet(set string) (*jose.JsonWebKeySet, error)

type RS256Generator

type RS256Generator struct {
	KeyLength int
}

func (*RS256Generator) Generate

func (g *RS256Generator) Generate(id string) (*jose.JsonWebKeySet, error)

type RethinkManager added in v0.2.0

type RethinkManager struct {
	Session *r.Session
	Table   r.Term
	sync.RWMutex

	Cipher *AEAD

	Keys map[string]jose.JsonWebKeySet
}

func (*RethinkManager) AddKey added in v0.2.0

func (m *RethinkManager) AddKey(set string, key *jose.JsonWebKey) error

func (*RethinkManager) AddKeySet added in v0.2.0

func (m *RethinkManager) AddKeySet(set string, keys *jose.JsonWebKeySet) error

func (*RethinkManager) ColdStart added in v0.2.0

func (m *RethinkManager) ColdStart() error

func (*RethinkManager) DeleteKey added in v0.2.0

func (m *RethinkManager) DeleteKey(set, kid string) error

func (*RethinkManager) DeleteKeySet added in v0.2.0

func (m *RethinkManager) DeleteKeySet(set string) error

func (*RethinkManager) GetKey added in v0.2.0

func (m *RethinkManager) GetKey(set, kid string) (*jose.JsonWebKeySet, error)

func (*RethinkManager) GetKeySet added in v0.2.0

func (m *RethinkManager) GetKeySet(set string) (*jose.JsonWebKeySet, error)

func (*RethinkManager) SetUpIndex added in v0.2.0

func (m *RethinkManager) SetUpIndex() error

func (*RethinkManager) Watch added in v0.2.0

func (m *RethinkManager) Watch(ctx context.Context)

Jump to

Keyboard shortcuts

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