jose: github.com/SermoDigital/jose Index | Files | Directories

package jose

import "github.com/SermoDigital/jose"

Package jose implements some helper functions and types for the children packages, jws, jwt, and jwe.

Index

Package Files

base64.go doc.go header.go time.go

func Base64Decode Uses

func Base64Decode(b []byte) ([]byte, error)

Base64Decode decodes a base64-encoded byte slice.

func Base64Encode Uses

func Base64Encode(b []byte) []byte

Base64Encode encodes a byte slice.

func DecodeEscaped Uses

func DecodeEscaped(b []byte) ([]byte, error)

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 Uses

func EncodeEscape(b []byte) []byte

EncodeEscape base64-encodes a byte slice but escapes it for JSON. It'll return the format: `"base64"`

func Now Uses

func Now() time.Time

Now returns the current time in UTC.

type Encoder Uses

type Encoder interface {
    // Base64 implies T -> JSON -> RawURLEncodingBase64
    Base64() ([]byte, error)
}

Encoder is satisfied if the type can marshal itself into a valid structure for a JWS.

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 Uses

func (h Header) Base64() ([]byte, error)

Base64 implements the Encoder interface.

func (Header) Del Uses

func (h Header) Del(key string)

Del removes the value that corresponds with key from the Header.

func (Header) Get Uses

func (h Header) Get(key string) interface{}

Get retrieves the value corresponding with key from the Header.

func (Header) Has Uses

func (h Header) Has(key string) bool

Has returns true if a value for the given key exists inside the Header.

func (Header) MarshalJSON Uses

func (h Header) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for Header.

func (Header) Set Uses

func (h Header) Set(key string, val interface{})

Set sets Claims[key] = val. It'll overwrite without warning.

func (*Header) UnmarshalJSON Uses

func (h *Header) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler for Header.

type Protected Uses

type Protected Header

Protected Headers are base64-encoded after they're marshaled into JSON.

func (Protected) Base64 Uses

func (p Protected) Base64() ([]byte, error)

Base64 implements the Encoder interface.

func (Protected) Del Uses

func (p Protected) Del(key string)

Del removes the value that corresponds with key from the Protected Header.

func (Protected) Get Uses

func (p Protected) Get(key string) interface{}

Get retrieves the value corresponding with key from the Protected Header.

func (Protected) Has Uses

func (p Protected) Has(key string) bool

Has returns true if a value for the given key exists inside the Protected Header.

func (Protected) MarshalJSON Uses

func (p Protected) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for Protected.

func (Protected) Set Uses

func (p Protected) Set(key string, val interface{})

Set sets Protected[key] = val. It'll overwrite without warning.

func (*Protected) UnmarshalJSON Uses

func (p *Protected) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler for Protected.

Directories

PathSynopsis
cryptoPackage crypto implements "SigningMethods" and "EncryptionMethods"; that is, ways to sign and encrypt JWS and JWEs, respectively, as well as JWTs.
jwsPackage jws implements JWSs per RFC 7515
jwtPackage jwt implements JWTs per RFC 7519

Package jose imports 3 packages (graph) and is imported by 15 packages. Updated 2019-08-12. Refresh now. Tools for package owners.