package jose
import "github.com/SermoDigital/jose"
Package jose implements some helper functions and types for the children packages, jws, jwt, and jwe.
Index ¶
- func Base64Decode(b []byte) ([]byte, error)
- func Base64Encode(b []byte) []byte
- func DecodeEscaped(b []byte) ([]byte, error)
- func EncodeEscape(b []byte) []byte
- type Encoder
- type Header
- func (h Header) Base64() ([]byte, error)
- func (h Header) Del(key string)
- func (h Header) Get(key string) interface{}
- func (h Header) Has(key string) bool
- func (h Header) MarshalJSON() ([]byte, error)
- func (h Header) Set(key string, val interface{})
- func (h *Header) UnmarshalJSON(b []byte) error
- type Protected
- func (p Protected) Base64() ([]byte, error)
- func (p Protected) Del(key string)
- func (p Protected) Get(key string) interface{}
- func (p Protected) Has(key string) bool
- func (p Protected) MarshalJSON() ([]byte, error)
- func (p Protected) Set(key string, val interface{})
- func (p *Protected) UnmarshalJSON(b []byte) error
Functions ¶
func Base64Decode ¶
Base64Decode decodes a base64-encoded byte slice.
func Base64Encode ¶
Base64Encode encodes a byte slice.
func DecodeEscaped ¶
DecodeEscaped decodes a base64-encoded byte slice straight from a JSON structure. It assumes it's in the format: `"base64"`, but can handle cases where it's not.
func EncodeEscape ¶
EncodeEscape base64-encodes a byte slice but escapes it for JSON. It'll return the format: `"base64"`
Types ¶
type Encoder ¶
Encoder is satisfied if the type can marshal itself into a valid structure for a JWS.
type Header ¶
type Header map[string]interface{}
Header implements a JOSE Header with the addition of some helper methods, similar to net/url.Values.
func (Header) Base64 ¶
Base64 implements the Encoder interface.
func (Header) Del ¶
Del removes the value that corresponds with key from the Header.
func (Header) Get ¶
Get retrieves the value corresponding with key from the Header.
func (Header) Has ¶
Has returns true if a value for the given key exists inside the Header.
func (Header) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Header.
func (Header) Set ¶
Set sets Claims[key] = val. It'll overwrite without warning.
func (*Header) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Header.
type Protected ¶
type Protected Header
Protected Headers are base64-encoded after they're marshaled into JSON.
func (Protected) Base64 ¶
Base64 implements the Encoder interface.
func (Protected) Del ¶
Del removes the value that corresponds with key from the Protected Header.
func (Protected) Get ¶
Get retrieves the value corresponding with key from the Protected Header.
func (Protected) Has ¶
Has returns true if a value for the given key exists inside the Protected Header.
func (Protected) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Protected.
func (Protected) Set ¶
Set sets Protected[key] = val. It'll overwrite without warning.
func (*Protected) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Protected.
Source Files ¶
Directories ¶
| Path | Synopsis |
|---|---|
| crypto | Package crypto implements "SigningMethods" and "EncryptionMethods"; that is, ways to sign and encrypt JWS and JWEs, respectively, as well as JWTs. |
| jws | Package jws implements JWSs per RFC 7515 |
| jwt | Package jwt implements JWTs per RFC 7519 |
- Version
- v0.9.1 (latest)
- Published
- Oct 1, 2015
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 2 hours ago –
Tools for package owners.