rpc

package
v0.0.0-...-ef7a112 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GethSocketOpName = "geth.wss"
)

Variables

This section is empty.

Functions

func NewEthClient

func NewEthClient() *ethclient.Client

NewEthClient returns an ethclient.Client

Types

type CheckSessionParams

type CheckSessionParams struct {
	TokenID common.Hash
	DID     common.Hash
}

type CreateAccessContextParams

type CreateAccessContextParams struct {
	ID   common.Hash
	Salt [20]byte
	DID  common.Hash
}

type ErrEthClient

type ErrEthClient struct {
	Err error
}

func (ErrEthClient) Error

func (e ErrEthClient) Error() string

type GrantRoleParams

type GrantRoleParams struct {
	RoleIdentifier   persist.RoleIdentifier
	DID              common.Hash
	PolicyIdentifier persist.PolicyIdentifier
	Proof            contracts.IPolicyVerifierProof
	Inputs           [20]*big.Int
}

type HasRoleParams

type HasRoleParams struct {
	Address persist.Address
	RoleID  common.Hash
	DID     common.Hash
}

type RegisterResourceParams

type RegisterResourceParams struct {
	AccessContext persist.Address
	Role          common.Hash
	Policy        common.Hash
	Permission    common.Hash
	Resource      common.Hash
	Operations    []uint8
	Verifier      common.Address
	DID           common.Hash
}

type Service

type Service struct {
	Wallet          *Wallet
	ContextHandler  persist.Address
	SessionRegistry persist.Address
}

func NewRPCService

func NewRPCService() (*Service, error)

func (Service) CheckSession

func (s Service) CheckSession(ctx context.Context, params CheckSessionParams) (bool, error)

CheckSession verifies a session

func (Service) CreateAccessContext

func (s Service) CreateAccessContext(ctx context.Context, params CreateAccessContextParams) (*types.Receipt, error)

CreateAccessContext creates a new access context

func (Service) GetAccessContextAddress

func (s Service) GetAccessContextAddress(id common.Hash) (persist.Address, error)

GetAccessContextAddress creates a new access context

func (Service) GrantRole

func (s Service) GrantRole(ctx context.Context, params GrantRoleParams) (*types.Receipt, error)

GrantRole grants a role to a user

func (Service) HasRole

func (s Service) HasRole(ctx context.Context, params HasRoleParams) (bool, error)

HasRole verifies a role

func (Service) RegisterResource

func (s Service) RegisterResource(ctx context.Context, params RegisterResourceParams) (*types.Receipt, error)

RegisterResource creates a new access context

func (Service) StartSession

func (s Service) StartSession(ctx context.Context, params StartSessionParams) (*types.Receipt, error)

StartSession starts a session

func (Service) Status

func (s Service) Status() framework.Status

func (Service) Type

func (s Service) Type() framework.Type

type StartSessionParams

type StartSessionParams struct {
	DID        common.Hash
	TokenID    common.Hash
	SessionJWE []byte
}

type Wallet

type Wallet struct {
	ChainID    *big.Int
	PrivateKey *ecdsa.PrivateKey
	PublicKey  *ecdsa.PublicKey
	Address    common.Address
	Client     *ethclient.Client
}

func NewWallet

func NewWallet(privateKey string, chainID uint64) (*Wallet, error)

func (Wallet) GetDID

func (w Wallet) GetDID() string

func (Wallet) GetDIDHash

func (w Wallet) GetDIDHash() common.Hash

func (Wallet) ToCallOpts

func (w Wallet) ToCallOpts() *bind.CallOpts

func (Wallet) ToTransactOpts

func (w Wallet) ToTransactOpts() (*bind.TransactOpts, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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