encryptionkeyrepo

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteEncryptionKey

func DeleteEncryptionKey(rlog log.Ext1FieldLogger, tx *sqlx.Tx, tokenID interface{}) error

DeleteEncryptionKey deletes the encryption key for a mytoken.

func GetEncryptionKey

func GetEncryptionKey(rlog log.Ext1FieldLogger, tx *sqlx.Tx, tokenID mtid.MTID, jwt string) (
	key []byte, rtID uint64, err error,
)

GetEncryptionKey returns the encryption key and the rtid for a mytoken

func ReencryptEncryptionKey

func ReencryptEncryptionKey(rlog log.Ext1FieldLogger, tx *sqlx.Tx, tokenID mtid.MTID, oldJWT, newJWT string) error

ReencryptEncryptionKey re-encrypts the encryption key for a mytoken. This is needed when the mytoken changes, e.g. on token rotation

Types

type EncryptionKey

type EncryptionKey string

EncryptionKey is a type for the encryption key stored in the db

func (EncryptionKey) Decrypt

func (k EncryptionKey) Decrypt(jwt string) ([]byte, error)

Decrypt returns the decrypted encryption key

type RTCryptKeyDBRes added in v0.4.0

type RTCryptKeyDBRes struct {
	KeyID         uint64        `db:"key_id"`
	EncryptionKey EncryptionKey `db:"encryption_key"`
	RTID          uint64        `db:"rt_id"`
	RT            string        `db:"refresh_token"`
}

RTCryptKeyDBRes is a struct holding the db result for the EncryptionKeys_GetRTKeyForMT procedure

func (RTCryptKeyDBRes) Decrypt added in v0.4.0

func (res RTCryptKeyDBRes) Decrypt(jwt string) (string, error)

Decrypt returns the decrypted refresh token

Jump to

Keyboard shortcuts

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