session

package
v0.0.0-...-fb761c0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CredentialRequest

type CredentialRequest struct {
	UserInfo User `json:"user_info"`
}

type CredentialResponse

type CredentialResponse struct {
	KeyID        string `json:"key_id,omitempty"`
	SecretKey    string `json:"secret_key,omitempty"`
	SessionToken []byte `json:"session_token,omitempty"`
	Error        string `json:"error,omitempty"`
}

type Decrypter

type Decrypter interface {
	DecryptPublicKey(ctx context.Context, content []byte) (keyID, alg string, publicKey []byte, attributes any, err error)
}

type DecryptionService

type DecryptionService struct {
	SessionTokenName string
	// contains filtered or unexported fields
}

func NewDecryptionService

func NewDecryptionService(decrypter Decrypter, sessionTokenName string) *DecryptionService

func (*DecryptionService) Attributes

func (d *DecryptionService) Attributes(ctx context.Context) any

func (*DecryptionService) GetKey

func (s *DecryptionService) GetKey(ctx context.Context, kid string, clientSpecifiedAlg string) (verifier.Algorithm, error)

func (*DecryptionService) GetSessionTokenDecryptingMiddleware

func (d *DecryptionService) GetSessionTokenDecryptingMiddleware() func(next http.Handler) http.Handler

type Encrypter

type Encrypter interface {
	EncryptPublicKey(ctx context.Context, keyID, alg string, publicKey []byte, Attributes any) ([]byte, error)
}

type EncrypterDecrypter

type EncrypterDecrypter interface {
	Encrypter
	Decrypter
}

type EncryptionRequest

type EncryptionRequest struct {
	UserInfo  User   `json:"user_info"`
	KeyID     string `json:"key_id"`
	Alg       string `json:"alg"`
	PublicKey string `json:"public_key"`
}

type EncryptionResponse

type EncryptionResponse struct {
	SessionToken []byte `json:"session_token,omitempty"`
	Error        string `json:"error,omitempty"`
}

type EncryptionService

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

func NewEncryptionService

func NewEncryptionService(encrypter Encrypter) *EncryptionService

func (*EncryptionService) NewCredentialHandler

func (e *EncryptionService) NewCredentialHandler() http.Handler

NewCredentialHandler returns an HTTP Handler that creates a session token for an EncryptionRequest. Authenication should be handled outside this handler.

To inject attributes into a session token, add it to the request's context, and specify the context key in the SessionTokenHandler method.

func (*EncryptionService) SessionTokenHandler

func (e *EncryptionService) SessionTokenHandler() http.Handler

SessionTokenHandler returns an HTTP Handler that creates a session token for an EncryptionRequest. Authenication should be handled outside this handler.

To inject attributes into a session token, add it to the request's context, and specify the context key in the SessionTokenHandler method.

type User

type User struct {
	Username string `json:"username"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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