auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer interface {
	GetSignature(string, HMACSHA, string) (string, error)
	RandomString(length int) string
}

type Erandom

type Erandom struct {
	Random *rand.Rand
}

Adapted from this code: https://nishanths.svbtle.com/do-not-seed-the-global-random

func NewRandom

func NewRandom() (*Erandom, error)

Create a new reference to the random number generator

func (*Erandom) MakeRandom

func (r *Erandom) MakeRandom(random *rand.Rand)

type HMACSHA

type HMACSHA string
const (
	HMACSHA256 HMACSHA = "HMAC-SHA256"
	HMACSHA384 HMACSHA = "HMAC-SHA384"
	HMACSHA512 HMACSHA = "HMAC-SHA512"
)

type Oauth1

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

func New

func New() (*Oauth1, error)

New creates a new value of type pointer oauth1

func (*Oauth1) GetSignature

func (oa *Oauth1) GetSignature(fullUrl string, hmacsha HMACSHA, token string) (string, error)

func (*Oauth1) HmacEncrypt

func (oa *Oauth1) HmacEncrypt(value string, key string, algorithm HMACSHA) ([]byte, error)

code adapted from this: https://golangcode.com/generate-sha256-hmac/

func (*Oauth1) RandomString

func (oa *Oauth1) RandomString(length int) string

func (*Oauth1) ToBase64

func (oa *Oauth1) ToBase64(data []byte) string

type RequestMethod

type RequestMethod uint8
const (
	GET RequestMethod = iota
	POST
	OAUTH2
)

Jump to

Keyboard shortcuts

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