opa: github.com/open-policy-agent/opa/topdown/internal/jwx/buffer Index | Files

package buffer

import "github.com/open-policy-agent/opa/topdown/internal/jwx/buffer"

Package buffer provides a very thin wrapper around []byte buffer called `Buffer`, to provide functionalities that are often used within the jwx related packages


Package Files


type Buffer Uses

type Buffer []byte

Buffer wraps `[]byte` and provides functions that are often used in the jwx related packages. One notable difference is that while encoding/json marshalls `[]byte` using base64.StdEncoding, this module uses base64.RawURLEncoding as mandated by the spec

func FromBase64 Uses

func FromBase64(v []byte) (Buffer, error)

FromBase64 constructs a new Buffer from a base64 encoded data

func FromNData Uses

func FromNData(v []byte) (Buffer, error)

FromNData constructs a new Buffer from a "n:data" format (I made that name up)

func FromUint Uses

func FromUint(v uint64) Buffer

FromUint creates a `Buffer` from an unsigned int

func (*Buffer) Base64Decode Uses

func (b *Buffer) Base64Decode(v []byte) error

Base64Decode decodes the contents of the Buffer using base64.RawURLEncoding

func (Buffer) Base64Encode Uses

func (b Buffer) Base64Encode() ([]byte, error)

Base64Encode encodes the contents of the Buffer using base64.RawURLEncoding

func (Buffer) Bytes Uses

func (b Buffer) Bytes() []byte

Bytes returns the raw bytes that comprises the Buffer

func (Buffer) Len Uses

func (b Buffer) Len() int

Len returns the number of bytes that the Buffer holds

func (Buffer) MarshalJSON Uses

func (b Buffer) MarshalJSON() ([]byte, error)

MarshalJSON marshals the buffer into JSON format after encoding the buffer with base64.RawURLEncoding

func (Buffer) NData Uses

func (b Buffer) NData() []byte

NData returns Datalen || Data, where Datalen is a 32 bit counter for the length of the following data, and Data is the octets that comprise the buffer data

func (*Buffer) UnmarshalJSON Uses

func (b *Buffer) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from a JSON string into a Buffer, after decoding it with base64.RawURLEncoding

Package buffer imports 4 packages (graph) and is imported by 1 packages. Updated 2019-07-16. Refresh now. Tools for package owners.