oauth

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OAUTH_VERSION         = "1.0"
	SIGNATURE_METHOD_HMAC = "HMAC-"

	HTTP_AUTH_HEADER       = "Authorization"
	OAUTH_HEADER           = "OAuth "
	CONSUMER_KEY_PARAM     = "oauth_consumer_key"
	NONCE_PARAM            = "oauth_nonce"
	SIGNATURE_METHOD_PARAM = "oauth_signature_method"
	SIGNATURE_PARAM        = "oauth_signature"
	TIMESTAMP_PARAM        = "oauth_timestamp"
	TOKEN_PARAM            = "oauth_token"
	TOKEN_SECRET_PARAM     = "oauth_token_secret"
	VERSION_PARAM          = "oauth_version"
)

Variables

View Source
var HASH_METHOD_MAP = map[crypto.Hash]string{
	crypto.SHA1:   "SHA1",
	crypto.SHA256: "SHA256",
}

Functions

This section is empty.

Types

type ByValue

type ByValue []string

func (ByValue) Len

func (a ByValue) Len() int

func (ByValue) Less

func (a ByValue) Less(i, j int) bool

func (ByValue) Swap

func (a ByValue) Swap(i, j int)

type Consumer

type Consumer struct {
	AdditionalParams map[string]string
	// contains filtered or unexported fields
}

func NewConsumer

func NewConsumer(consumerKey string, consumerSecret string, requestMethod string, requestURL string) *Consumer

Creates a new Consumer instance, with a HMAC-SHA1 signer

func (*Consumer) Debug

func (c *Consumer) Debug(enabled bool)

func (*Consumer) GetRequest added in v0.0.4

func (c *Consumer) GetRequest(url string) (string, string, io.Reader, error)

type HMACSigner

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

func (*HMACSigner) Debug

func (s *HMACSigner) Debug(enabled bool)

func (*HMACSigner) HashFunc

func (s *HMACSigner) HashFunc() crypto.Hash

func (*HMACSigner) Sign

func (s *HMACSigner) Sign(message string) (string, error)

func (*HMACSigner) SignatureMethod

func (s *HMACSigner) SignatureMethod() string

func (*HMACSigner) Verify

func (s *HMACSigner) Verify(message string, signature string) error

type OrderedParams

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

func NewOrderedParams

func NewOrderedParams() *OrderedParams

func (*OrderedParams) Add

func (o *OrderedParams) Add(key, value string)

func (*OrderedParams) AddUnescaped

func (o *OrderedParams) AddUnescaped(key, value string)

func (*OrderedParams) Get

func (o *OrderedParams) Get(key string) []string

func (*OrderedParams) Keys

func (o *OrderedParams) Keys() []string

func (*OrderedParams) Len

func (o *OrderedParams) Len() int

func (*OrderedParams) Less

func (o *OrderedParams) Less(i int, j int) bool

func (*OrderedParams) Swap

func (o *OrderedParams) Swap(i int, j int)

Jump to

Keyboard shortcuts

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