pep

package
v0.0.0-...-29e199f Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountUserPolicyDecisionPointPort

type AccountUserPolicyDecisionPointPort interface {
	// AuthorizeAccountUser checks if a user is authorized to use an account, returns an error if it doesn't
	AuthorizeAccountUser(ctx context.Context, input AuthorizeAccountUserInput) (*AuthorizeAccountUserOutput, error)
}

AccountUserPolicyDecisionPointPort is a port to adapt account usage authorization checks

type AuthorizeAccountRPCBody

type AuthorizeAccountRPCBody struct {
	// Method defines the name of the method to be invoked.
	Method string `json:"method"`
	// ID defines a unique identifier established by the client.
	ID any `json:"id"`
	// Params defines a structured value that holds the parameter values to be used during the invocation of the method.
	// src: https://www.jsonrpc.org/specification#:~:text=4.2%20Parameter%20Structures
	Params json.RawMessage `json:"params"`
}

AuthorizeAccountRPCBody represents a JSON-RPC request object as defined in: https://www.jsonrpc.org/specification

type AuthorizeAccountRPCParams

type AuthorizeAccountRPCParams struct {
	// From is an Ethereum account.
	From string `json:"from"`
}

AuthorizeAccountRPCParams is used to unmarshal the parameters of a request that has a From field

type AuthorizeAccountUserInput

type AuthorizeAccountUserInput struct {
	// UserID the ID of the user
	UserID string
	// ApplicationID the ID of the application
	ApplicationID string
	// Address related to the account to be authorized
	Address address.Address
}

AuthorizeAccountUserInput attributes to authorize a user to use an account

type AuthorizeAccountUserOutput

type AuthorizeAccountUserOutput struct {
}

AuthorizeAccountUserOutput the result of the account usage authorization

type AuthorizeUserInput

type AuthorizeUserInput struct {
	// UserID the ID of the user
	UserID string
	// ApplicationID the ID of the application
	ApplicationID *string
	// ActionID the ID of the action
	ActionID string
}

AuthorizeUserInput attributes to authorize a user

type AuthorizeUserOutput

type AuthorizeUserOutput struct {
}

AuthorizeUserOutput the result of the user authorization

type HTTPPolicyEnforcementPoint

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

HTTPPolicyEnforcementPoint is a set of methods to check user authorization

func ProvideHTTPPolicyEnforcementPoint

func ProvideHTTPPolicyEnforcementPoint(options HTTPPolicyEnforcementPointOptions) (*HTTPPolicyEnforcementPoint, error)

ProvideHTTPPolicyEnforcementPoint provides an instance of an HTTPPolicyEnforcementPoint

func (*HTTPPolicyEnforcementPoint) AuthorizeUser

func (policyEnforcementPoint *HTTPPolicyEnforcementPoint) AuthorizeUser(next http.Handler) http.Handler

AuthorizeUser filters if the user making the request has authorization to perform the action nolint: staticcheck

type HTTPPolicyEnforcementPointOptions

type HTTPPolicyEnforcementPointOptions struct {
	// ResponseHandler exposes functionality to handle HTTP responses
	ResponseHandler httpinfra.HTTPResponseHandler
	// UserPolicyDecisionPointPort is a port to adapt authorization checks
	UserPolicyDecisionPointAdapter UserPolicyDecisionPointPort
	// AccountUserPolicyDecisionPointPort is a port to adapt account usage authorization checks
	AccountUserPolicyDecisionPointAdapter AccountUserPolicyDecisionPointPort
}

HTTPPolicyEnforcementPointOptions are the set of fields to create an HTTPPolicyEnforcementPoint

type RPCPolicyEnforcementPoint

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

RPCPolicyEnforcementPoint checks if the user is authorized to perform a given action

func ProvideRPCPolicyEnforcementPoint

func ProvideRPCPolicyEnforcementPoint(options RPCPolicyEnforcementPointOptions) (*RPCPolicyEnforcementPoint, error)

ProvideRPCPolicyEnforcementPoint provides an instance of an RPCPolicyEnforcementPoint

func (*RPCPolicyEnforcementPoint) AuthorizeAccount

func (policyEnforcementPoint *RPCPolicyEnforcementPoint) AuthorizeAccount(next http.Handler) http.Handler

AuthorizeAccount checks if a user is authorized to use an account if it's performing an 'eth_signTransaction' action

type RPCPolicyEnforcementPointOptions

type RPCPolicyEnforcementPointOptions struct {
	// ResponseHandler exposes functionality to handle HTTP responses
	ResponseHandler httpinfra.HTTPResponseHandler
	// UserPolicyDecisionPointPort is a port to adapt authorization checks
	UserPolicyDecisionPointAdapter UserPolicyDecisionPointPort
	// AccountUserPolicyDecisionPointPort is a port to adapt account usage authorization checks
	AccountUserPolicyDecisionPointAdapter AccountUserPolicyDecisionPointPort
}

RPCPolicyEnforcementPointOptions are the set of fields to create an RPCPolicyEnforcementPoint

type UserPolicyDecisionPointPort

type UserPolicyDecisionPointPort interface {
	// AuthorizeUser checks if a user is authorized to perform an action, returns an error if it doesn't
	AuthorizeUser(ctx context.Context, input AuthorizeUserInput) (*AuthorizeUserOutput, error)
}

UserPolicyDecisionPointPort is a port to adapt authorization checks

Jump to

Keyboard shortcuts

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