gojws

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

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

Go to latest
Published: Nov 27, 2014 License: BSD-2-Clause Imports: 14 Imported by: 0

README

gojws

Golang implementation of JWS validation

Contact

@_boblan_
https://github.com/mendsley/gojws

License

Copyright 2014 Matthew Endsley

This project is governed by the BSD 2-clause license. For details see the file titled LICENSE in the project root folder.

Using

Simply add the following import import "github.com/mendsley/gojws"

Documentation

See http://godoc.org/github.com/mendsley/gojws

Documentation

Index

Constants

View Source
const (
	ALG_NONE  = Algorithm("none")
	ALG_HS256 = Algorithm("HS256")
	ALG_HS384 = Algorithm("HS384")
	ALG_HS512 = Algorithm("HS512")
	ALG_RS256 = Algorithm("RS256")
	ALG_RS384 = Algorithm("RS384")
	ALG_RS512 = Algorithm("RS512")
	ALG_ES256 = Algorithm("ES256")
	ALG_ES384 = Algorithm("ES384")
	ALG_ES512 = Algorithm("ES512")
	ALG_PS256 = Algorithm("PS256")
	ALG_PS384 = Algorithm("PS384")
	ALG_PS512 = Algorithm("PS512")
)
View Source
const NoneKey = NoneKeyType(0)

Variables

This section is empty.

Functions

func VerifyAndDecode

func VerifyAndDecode(jws string, kp KeyProvider) (payload []byte, err error)

Types

type Algorithm

type Algorithm string
type Header struct {
	Alg Algorithm `json:"alg"`
	Typ string    `json:"typ,omitempty"`
	Cty string    `json:"cty,omitempty"`
	Jku string    `json:"jku,omitempty"`
	Jwk string    `json:"jwk,omitempty"`
	X5u string    `json:"x5u,omitempty"`
	X5t string    `json:"x5t,omitempty"`
	X5c string    `json:"x5c,omitempty"`
	Kid string    `json:"kid,omitempty"`
}

JWS header

func VerifyAndDecodeWithHeader

func VerifyAndDecodeWithHeader(jws string, kp KeyProvider) (header Header, payload []byte, err error)

Verify the authenticity of a JWS signature

type KeyProvider

type KeyProvider interface {
	GetJWSKey(h Header) (crypto.PublicKey, error)
}

Allows caller access to the JWS header while selecting an appropriate public key.

func ProviderFromKey

func ProviderFromKey(key crypto.PublicKey) KeyProvider

convert a single key into a provider

type NoneKeyType

type NoneKeyType int

Public key to use for "none" algorithm. This type effectively works as a flag allowing no signature verification if none is provided in the JWS

Jump to

Keyboard shortcuts

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