state

package
v0.0.0-...-9ffa3d9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultEmailSecretName = "certforgot-useremail"
	DefaultKeyName         = "certforgot-userkey"
)
View Source
const ExistsQuery = "SELECT COUNT(*) FROM certforgot.state"
View Source
const (
	FileName = "certforgot_state.yaml"
)
View Source
const GetQuery = "SELECT * FROM certforgot.state LIMIT 1"
View Source
const InsertQuery = "INSERT INTO certforgot.state VALUES (:id, :useremail, :userprivatekey);"
View Source
const UpdateQuery = "UPDATE certforgot.state SET useremail = :useremail, userprivatekey = :userprivatekey WHERE id = :id"

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureBlobSource

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

func NewAzureBlobSource

func NewAzureBlobSource(
	client azure.BlobClient,
) (AzureBlobSource, error)

func (AzureBlobSource) Exists

func (source AzureBlobSource) Exists(ctx context.Context) (bool, error)

func (AzureBlobSource) Get

func (source AzureBlobSource) Get(ctx context.Context) (State, error)

func (AzureBlobSource) Update

func (source AzureBlobSource) Update(ctx context.Context, state State) error

type AzureKeyVaultSource

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

func NewAzureKeyVaultSource

func NewAzureKeyVaultSource(
	client azure.KeyVaultClient, config *AzureKeyVaultSourceConfig,
) (AzureKeyVaultSource, error)

func (AzureKeyVaultSource) Exists

func (source AzureKeyVaultSource) Exists(ctx context.Context) (bool, error)

func (AzureKeyVaultSource) Get

func (source AzureKeyVaultSource) Get(ctx context.Context) (State, error)

func (AzureKeyVaultSource) Update

func (source AzureKeyVaultSource) Update(
	ctx context.Context, state State,
) error

type AzureKeyVaultSourceConfig

type AzureKeyVaultSourceConfig struct {
	EmailSecretName string
	KeyName         string
}

type Email

type Email struct {
	*mail.Address
}

func (*Email) Scan

func (email *Email) Scan(src interface{}) error

func (Email) Value

func (email Email) Value() (driver.Value, error)

type Jwk

type Jwk struct {
	jwk.Key
}

func (Jwk) MarshalText

func (key Jwk) MarshalText() ([]byte, error)

func (*Jwk) Scan

func (key *Jwk) Scan(src interface{}) error

func (*Jwk) UnmarshalText

func (key *Jwk) UnmarshalText(text []byte) error

func (Jwk) Value

func (key Jwk) Value() (driver.Value, error)

type LocalSource

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

func NewLocalSource

func NewLocalSource(directory string) (LocalSource, error)

func (LocalSource) Exists

func (source LocalSource) Exists(ctx context.Context) (bool, error)

func (LocalSource) Get

func (source LocalSource) Get(ctx context.Context) (State, error)

func (LocalSource) Update

func (source LocalSource) Update(ctx context.Context, state State) error

type Source

type Source interface {
	Update(ctx context.Context, state State) error
	Get(ctx context.Context) (State, error)
	Exists(ctx context.Context) (bool, error)
}

type SqlSource

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

func NewSqlSource

func NewSqlSource(
	ctx context.Context, driver string, db *sql.DB,
) (SqlSource, error)

func (SqlSource) Exists

func (p SqlSource) Exists(ctx context.Context) (bool, error)

func (SqlSource) Get

func (p SqlSource) Get(ctx context.Context) (State, error)

func (SqlSource) Update

func (p SqlSource) Update(ctx context.Context, state State) error

type State

type State struct {
	UserEmail      Email
	UserPrivateKey Jwk
}

func NewState

func NewState(userEmail *mail.Address, key jwk.Key) State

func NewStateFromMarshaled

func NewStateFromMarshaled(userEmail string, key string) (State, error)

func (State) MarshaledPrivateKey

func (state State) MarshaledPrivateKey() (string, error)

Jump to

Keyboard shortcuts

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