state

package
v0.0.0-...-be77d2c Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrParse        = Error("parse error")
	ErrUnsupported  = Error("unsupported format")
	ErrInvalid      = Error("invalid input")
	ErrInvalidState = Error("invalid state")
	ErrNetwork      = Error("network error")
)
View Source
const (
	MaxUserDataSize = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Timestamp            int64    `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Nonce                string   `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
	Userdata             []byte   `protobuf:"bytes,3,opt,name=userdata,proto3" json:"userdata,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

that give the envelope payload message StateValue {

func NewData

func NewData(nonce string, userdata []byte) *Data

/

ok let's try first state data.

func ParseData

func ParseData(blob []byte) (*Data, error)

unmarshal

func (*Data) Descriptor

func (*Data) Descriptor() ([]byte, []int)

func (*Data) GetNonce

func (m *Data) GetNonce() string

func (*Data) GetTimestamp

func (m *Data) GetTimestamp() int64

func (*Data) GetUserdata

func (m *Data) GetUserdata() []byte

func (*Data) Pack

func (m *Data) Pack() ([]byte, error)

marshall

func (*Data) ProtoMessage

func (*Data) ProtoMessage()

func (*Data) Reset

func (m *Data) Reset()

func (*Data) String

func (m *Data) String() string

func (*Data) XXX_DiscardUnknown

func (m *Data) XXX_DiscardUnknown()

func (*Data) XXX_Marshal

func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Data) XXX_Merge

func (m *Data) XXX_Merge(src proto.Message)

func (*Data) XXX_Size

func (m *Data) XXX_Size() int

func (*Data) XXX_Unmarshal

func (m *Data) XXX_Unmarshal(b []byte) error

type Envelope

type Envelope struct {
	Provider             string   `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"`
	Salt                 []byte   `protobuf:"bytes,2,opt,name=salt,proto3" json:"salt,omitempty"`
	Nonce                []byte   `protobuf:"bytes,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
	Payload              []byte   `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

that gives the cookie.. message StateCookieValue {

func NewEnvelope

func NewEnvelope(provider string) (*Envelope, error)

StateEnvelope

an empty envelope

func ParseEnvelope

func ParseEnvelope(packed string) (*Envelope, error)

func (*Envelope) Descriptor

func (*Envelope) Descriptor() ([]byte, []int)

func (*Envelope) GetNonce

func (m *Envelope) GetNonce() []byte

func (*Envelope) GetPayload

func (m *Envelope) GetPayload() []byte

func (*Envelope) GetProvider

func (m *Envelope) GetProvider() string

func (*Envelope) GetSalt

func (m *Envelope) GetSalt() []byte

func (*Envelope) Open

func (m *Envelope) Open(key []byte) ([]byte, error)

func (*Envelope) Pack

func (m *Envelope) Pack() (string, error)

func (*Envelope) ProtoMessage

func (*Envelope) ProtoMessage()

func (*Envelope) Reset

func (m *Envelope) Reset()

func (*Envelope) Seal

func (m *Envelope) Seal(key, payload []byte) error

func (*Envelope) String

func (m *Envelope) String() string

func (*Envelope) XXX_DiscardUnknown

func (m *Envelope) XXX_DiscardUnknown()

func (*Envelope) XXX_Marshal

func (m *Envelope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Envelope) XXX_Merge

func (m *Envelope) XXX_Merge(src proto.Message)

func (*Envelope) XXX_Size

func (m *Envelope) XXX_Size() int

func (*Envelope) XXX_Unmarshal

func (m *Envelope) XXX_Unmarshal(b []byte) error

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type Verifier

type Verifier struct {
	// contains filtered or unexported fields
}

func NewVerifier

func NewVerifier(clientId, clientSecret string) (*Verifier, error)

func (*Verifier) New

func (pa *Verifier) New(provider, oidcNonce string) (string, string, error)

func (*Verifier) NewWithData

func (pa *Verifier) NewWithData(provider, nonce string, userData []byte) (string, string, error)

duration would be 30 minutes -> NOW() func (oa *ProviderAuth) State(password, secret []byte, oidcNonce string) (*OidcStateValue, error) { let's limit that state otherwise... let's limit nonceSize also

func (*Verifier) Validate

func (pa *Verifier) Validate(cookie, state string, t time.Duration) (nonce string, err error)

func (*Verifier) ValidateWithData

func (pa *Verifier) ValidateWithData(cookie, stateparam string, t time.Duration) (nonce string, userData []byte, err error)

Jump to

Keyboard shortcuts

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