sectok

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

sectok

code status

A golang library for working with secret-token URIs as specified by RFC 8959

Inspired by https://github.com/jstasiak/sectok

Documentation

Index

Constants

View Source
const (
	HeaderKey string = "Authorization"

	HeaderValuePattern = `^Bearer: .+$`
	HeaderValueFormat  = "Bearer: %s"
)
View Source
const (
	URIScheme         = "secret-token"
	URIPattern        = `^secret-token:[a-zA-Z0-9\-._~%]+$`
	URIFormat  string = "secret-token:%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SecretToken

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

func New

func New(token string) (SecretToken, error)

FromString creates a new SecretToken from a string, returning a new SecretToken instance or an error if invalid UTF-8 characters are present.

func NewFromBytes

func NewFromBytes(token []byte) (SecretToken, error)

FromBytes creates a new SecretToken from a slice of bytes, returning a pointer to a SecretToken instance or an error if invalid UTF-8 characters are present.

func Parse

func Parse(uri string) (SecretToken, error)

func ParseBytes

func ParseBytes(uri []byte) (SecretToken, error)

func (SecretToken) Equals

func (s SecretToken) Equals(s2 SecretToken) bool

Equals can be used to check if two SecretTokens match, using a constant-time comparison.

func (SecretToken) String

func (s SecretToken) String() string

String can be used to generate a string representation of a SecretToken URI. Use Equals() to compare two SecretTokens

Jump to

Keyboard shortcuts

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