shorttokenrepo

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProxyToken

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

ProxyToken holds information for proxy tokens, i.e. tokens that proxy another token, e.g. a short token

func CreateProxyToken

func CreateProxyToken(token string) *ProxyToken

CreateProxyToken creates a new *ProxyToken for a token

func NewProxyToken

func NewProxyToken(size int) *ProxyToken

NewProxyToken creates a new ProxyToken of the given length

func ParseProxyToken

func ParseProxyToken(token string) *ProxyToken

ParseProxyToken parses the proxy token string into a proxyToken

func (ProxyToken) Delete

func (pt ProxyToken) Delete(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error

Delete deletes the proxyToken from the database, it does not delete the linked Mytoken, the jwt should have been retrieved earlier and the Mytoken if desired be revoked separately

func (*ProxyToken) ID

func (pt *ProxyToken) ID() string

ID returns the id of this token

func (*ProxyToken) JWT

func (pt *ProxyToken) JWT(rlog log.Ext1FieldLogger, tx *sqlx.Tx) (jwt string, valid bool, err error)

JWT returns the decrypted jwt that is linked to this proxyToken

func (ProxyToken) MTID

func (pt ProxyToken) MTID() mtid.MTID

MTID returns the mtid.MTID of this ProxyToken

func (*ProxyToken) SetJWT

func (pt *ProxyToken) SetJWT(jwt string, mID mtid.MTID) (err error)

SetJWT sets the jwt for this proxyToken

func (ProxyToken) Store

func (pt ProxyToken) Store(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error

Store stores the proxyToken

func (ProxyToken) String

func (pt ProxyToken) String() string

func (ProxyToken) Token

func (pt ProxyToken) Token() string

Token returns the token of this ProxyToken

func (ProxyToken) Update

func (pt ProxyToken) Update(rlog log.Ext1FieldLogger, tx *sqlx.Tx) error

Update updates the jwt of the proxyToken

type ShortToken

type ShortToken struct {
	ProxyToken
}

ShortToken holds database information of a short token

func NewShortToken

func NewShortToken(jwt string, mID mtid.MTID) (*ShortToken, error)

NewShortToken creates a new short token from the given jwt of a normal Mytoken

func ParseShortToken

func ParseShortToken(token string) *ShortToken

ParseShortToken creates a new short token from a short token string

Jump to

Keyboard shortcuts

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