encrypt

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encrypt

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

func New

func New(key *key.Key) *Encrypt

New returns a new encryption object

func (*Encrypt) ParseToken

func (e *Encrypt) ParseToken(token string) (map[string]interface{}, error)

ParseToken decrypts/parse the provided raw token signed using the configured RSA keys

func (*Encrypt) SignedToken

func (e *Encrypt) SignedToken(param *Param) (string, error)

SignedToken returns the JWT encrypted token using the RSA keys provided in the configuraiton It takes the parameter argument which provides details of the issuer, subject, headers and claims As part of the parameters you are required to provide the encryption type whihc is either JWT or JWE

type Param added in v0.1.1

type Param struct {
	Audience       string
	Subject        string
	Claims         map[string]interface{}
	Headers        map[string]string
	Algorithm      jose.SignatureAlgorithm
	EncyrptionType key.SignerType
	Ttl            uint
}

A param allows calling methods to provide the required details for the encryption

Jump to

Keyboard shortcuts

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