authenticator

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: AGPL-3.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const SEPARATOR = ","

SEPARATOR is the separator used to split the configuration string. This is used by MessageFilter, SubaccountFilter, and ClobPairIdFilter.

View Source
const (
	// SignatureVerificationType represents a type of authenticator specifically designed for
	// secp256k1 signature verification.
	SignatureVerificationType = "SignatureVerification"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllOf

type AllOf struct {
	SubAuthenticators []types.Authenticator
	// contains filtered or unexported fields
}

func NewAllOf

func NewAllOf(am *AuthenticatorManager) AllOf

func NewPartitionedAllOf

func NewPartitionedAllOf(am *AuthenticatorManager) AllOf

func (AllOf) Authenticate

func (aoa AllOf) Authenticate(ctx sdk.Context, request types.AuthenticationRequest) error

func (AllOf) ConfirmExecution

func (aoa AllOf) ConfirmExecution(ctx sdk.Context, request types.AuthenticationRequest) error

func (AllOf) Initialize

func (aoa AllOf) Initialize(config []byte) (types.Authenticator, error)

func (AllOf) OnAuthenticatorAdded

func (aoa AllOf) OnAuthenticatorAdded(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

func (AllOf) OnAuthenticatorRemoved

func (aoa AllOf) OnAuthenticatorRemoved(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

func (AllOf) StaticGas

func (aoa AllOf) StaticGas() uint64

func (AllOf) Track

func (aoa AllOf) Track(ctx sdk.Context, request types.AuthenticationRequest) error

func (AllOf) Type

func (aoa AllOf) Type() string

type AnyOf

type AnyOf struct {
	SubAuthenticators []types.Authenticator
	// contains filtered or unexported fields
}

func NewAnyOf

func NewAnyOf(am *AuthenticatorManager) AnyOf

func NewPartitionedAnyOf

func NewPartitionedAnyOf(am *AuthenticatorManager) AnyOf

func (AnyOf) Authenticate

func (aoa AnyOf) Authenticate(ctx sdk.Context, request types.AuthenticationRequest) error

func (AnyOf) ConfirmExecution

func (aoa AnyOf) ConfirmExecution(ctx sdk.Context, request types.AuthenticationRequest) error

ConfirmExecution is called on all sub-authenticators, but only the changes made by the authenticator that succeeds are written.

func (AnyOf) Initialize

func (aoa AnyOf) Initialize(config []byte) (types.Authenticator, error)

func (AnyOf) OnAuthenticatorAdded

func (aoa AnyOf) OnAuthenticatorAdded(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

func (AnyOf) OnAuthenticatorRemoved

func (aoa AnyOf) OnAuthenticatorRemoved(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

func (AnyOf) StaticGas

func (aoa AnyOf) StaticGas() uint64

func (AnyOf) Track

func (aoa AnyOf) Track(ctx sdk.Context, request types.AuthenticationRequest) error

func (AnyOf) Type

func (aoa AnyOf) Type() string

type AuthenticatorManager

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

AuthenticatorManager is a manager for all registered authenticators.

func NewAuthenticatorManager

func NewAuthenticatorManager() *AuthenticatorManager

NewAuthenticatorManager creates a new AuthenticatorManager.

func (*AuthenticatorManager) GetAuthenticatorByType

func (am *AuthenticatorManager) GetAuthenticatorByType(authenticatorType string) types.Authenticator

GetAuthenticatorByType returns the base implementation of the authenticator type.

func (*AuthenticatorManager) GetRegisteredAuthenticators

func (am *AuthenticatorManager) GetRegisteredAuthenticators() []types.Authenticator

GetRegisteredAuthenticators returns the list of registered authenticators in sorted order.

func (*AuthenticatorManager) InitializeAuthenticators

func (am *AuthenticatorManager) InitializeAuthenticators(initialAuthenticators []types.Authenticator)

InitializeAuthenticators initializes authenticators. If already initialized, it will not overwrite.

func (*AuthenticatorManager) IsAuthenticatorTypeRegistered

func (am *AuthenticatorManager) IsAuthenticatorTypeRegistered(authenticatorType string) bool

IsAuthenticatorTypeRegistered checks if the authenticator type is registered.

func (*AuthenticatorManager) RegisterAuthenticator

func (am *AuthenticatorManager) RegisterAuthenticator(authenticator types.Authenticator)

RegisterAuthenticator adds a new authenticator to the map of registered authenticators.

func (*AuthenticatorManager) ResetAuthenticators

func (am *AuthenticatorManager) ResetAuthenticators()

ResetAuthenticators resets all registered authenticators.

func (*AuthenticatorManager) UnregisterAuthenticator

func (am *AuthenticatorManager) UnregisterAuthenticator(authenticator types.Authenticator)

UnregisterAuthenticator removes an authenticator from the map of registered authenticators.

type ClobPairIdFilter

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

ClobPairIdFilter filters incoming messages based on a whitelist of clob pair ids. It ensures that only messages with whitelisted clob pair ids are allowed.

func NewClobPairIdFilter

func NewClobPairIdFilter() ClobPairIdFilter

NewClobPairIdFilter creates a new ClobPairIdFilter with the provided EncodingConfig.

func (ClobPairIdFilter) Authenticate

func (m ClobPairIdFilter) Authenticate(ctx sdk.Context, request types.AuthenticationRequest) error

Authenticate checks if the message's clob pair ids are in the whitelist.

func (ClobPairIdFilter) ConfirmExecution

func (m ClobPairIdFilter) ConfirmExecution(ctx sdk.Context, request types.AuthenticationRequest) error

ConfirmExecution confirms the execution of a message. Currently, it always confirms.

func (ClobPairIdFilter) Initialize

func (m ClobPairIdFilter) Initialize(config []byte) (types.Authenticator, error)

Initialize sets up the authenticator with the given configuration, which should be a list of clob pair ids separated by a predefined separator.

func (ClobPairIdFilter) OnAuthenticatorAdded

func (m ClobPairIdFilter) OnAuthenticatorAdded(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

OnAuthenticatorAdded is currently a no-op but can be extended for additional logic when an authenticator is added.

func (ClobPairIdFilter) OnAuthenticatorRemoved

func (m ClobPairIdFilter) OnAuthenticatorRemoved(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

OnAuthenticatorRemoved is a no-op in this implementation but can be used when an authenticator is removed.

func (ClobPairIdFilter) StaticGas

func (m ClobPairIdFilter) StaticGas() uint64

StaticGas returns the static gas amount for the authenticator. Currently, it's set to zero.

func (ClobPairIdFilter) Track

Track is a no-op in this implementation but can be used to track message handling.

func (ClobPairIdFilter) Type

func (m ClobPairIdFilter) Type() string

Type returns the type of the authenticator.

type MessageFilter

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

MessageFilter filters incoming messages based on a predefined JSON pattern. It allows for complex pattern matching to support advanced authentication flows.

func NewMessageFilter

func NewMessageFilter() MessageFilter

NewMessageFilter creates a new MessageFilter with the provided EncodingConfig.

func (MessageFilter) Authenticate

func (m MessageFilter) Authenticate(ctx sdk.Context, request types.AuthenticationRequest) error

Authenticate checks if the provided message conforms to the set JSON pattern. It returns an AuthenticationResult based on the evaluation.

func (MessageFilter) ConfirmExecution

func (m MessageFilter) ConfirmExecution(ctx sdk.Context, request types.AuthenticationRequest) error

ConfirmExecution confirms the execution of a message. Currently, it always confirms.

func (MessageFilter) Initialize

func (m MessageFilter) Initialize(config []byte) (types.Authenticator, error)

Initialize sets up the authenticator with the given data, which should be a valid JSON pattern for message filtering.

func (MessageFilter) OnAuthenticatorAdded

func (m MessageFilter) OnAuthenticatorAdded(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

OnAuthenticatorAdded performs additional checks when an authenticator is added. Specifically, it ensures numbers in JSON are encoded as strings.

func (MessageFilter) OnAuthenticatorRemoved

func (m MessageFilter) OnAuthenticatorRemoved(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

OnAuthenticatorRemoved is a no-op in this implementation but can be used when an authenticator is removed.

func (MessageFilter) StaticGas

func (m MessageFilter) StaticGas() uint64

StaticGas returns the static gas amount for the authenticator. Currently, it's set to zero.

func (MessageFilter) Track

func (m MessageFilter) Track(ctx sdk.Context, request types.AuthenticationRequest) error

Track is a no-op in this implementation but can be used to track message handling.

func (MessageFilter) Type

func (m MessageFilter) Type() string

Type returns the type of the authenticator.

type SignatureAssignment

type SignatureAssignment string
const (
	Single      SignatureAssignment = "single"
	Partitioned SignatureAssignment = "partitioned"
)

type SignatureVerification

type SignatureVerification struct {
	PubKey cryptotypes.PubKey
	// contains filtered or unexported fields
}

signature authenticator

func NewSignatureVerification

func NewSignatureVerification(ak authante.AccountKeeper) SignatureVerification

NewSignatureVerification creates a new SignatureVerification

func (SignatureVerification) Authenticate

func (sva SignatureVerification) Authenticate(ctx sdk.Context, request types.AuthenticationRequest) error

Authenticate takes a SignaturesVerificationData struct and validates each signer and signature using signature verification

func (SignatureVerification) ConfirmExecution

func (sva SignatureVerification) ConfirmExecution(ctx sdk.Context, request types.AuthenticationRequest) error

func (SignatureVerification) Initialize

func (sva SignatureVerification) Initialize(config []byte) (types.Authenticator, error)

Initialize sets up the public key to the data supplied from the account-authenticator configuration

func (SignatureVerification) OnAuthenticatorAdded

func (sva SignatureVerification) OnAuthenticatorAdded(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

func (SignatureVerification) OnAuthenticatorRemoved

func (sva SignatureVerification) OnAuthenticatorRemoved(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

func (SignatureVerification) StaticGas

func (sva SignatureVerification) StaticGas() uint64

func (SignatureVerification) Track

func (SignatureVerification) Type

func (sva SignatureVerification) Type() string

type SubaccountFilter

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

SubaccountFilter filters incoming messages based on a whitelist of subaccount numbers. It ensures that only messages with whitelisted subaccount numbers are allowed.

func NewSubaccountFilter

func NewSubaccountFilter() SubaccountFilter

NewSubaccountFilter creates a new SubaccountFilter with the provided EncodingConfig.

func (SubaccountFilter) Authenticate

func (m SubaccountFilter) Authenticate(ctx sdk.Context, request types.AuthenticationRequest) error

Authenticate checks if the message's subaccount numbers are in the whitelist.

func (SubaccountFilter) ConfirmExecution

func (m SubaccountFilter) ConfirmExecution(ctx sdk.Context, request types.AuthenticationRequest) error

ConfirmExecution confirms the execution of a message. Currently, it always confirms.

func (SubaccountFilter) Initialize

func (m SubaccountFilter) Initialize(config []byte) (types.Authenticator, error)

Initialize sets up the authenticator with the given data, which should be a string of subaccount numbers separated by the specified separator.

func (SubaccountFilter) OnAuthenticatorAdded

func (m SubaccountFilter) OnAuthenticatorAdded(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

OnAuthenticatorAdded is currently a no-op but can be extended for additional logic when an authenticator is added.

func (SubaccountFilter) OnAuthenticatorRemoved

func (m SubaccountFilter) OnAuthenticatorRemoved(
	ctx sdk.Context,
	account sdk.AccAddress,
	config []byte,
	authenticatorId string,
) error

OnAuthenticatorRemoved is a no-op in this implementation but can be used when an authenticator is removed.

func (SubaccountFilter) StaticGas

func (m SubaccountFilter) StaticGas() uint64

StaticGas returns the static gas amount for the authenticator. Currently, it's set to zero.

func (SubaccountFilter) Track

Track is a no-op in this implementation but can be used to track message handling.

func (SubaccountFilter) Type

func (m SubaccountFilter) Type() string

Type returns the type of the authenticator.

Jump to

Keyboard shortcuts

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