singer

package
v0.2.1-test-2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultGasLimit defines the default gas limit
	DefaultGasLimit = 210000
	// SpOperatorPrivKey defines env variable name for sp operator priv key
	SpOperatorPrivKey = "SIGNER_OPERATOR_PRIV_KEY"
	// SpFundingPrivKey defines env variable name for sp funding priv key
	SpFundingPrivKey = "SIGNER_FUNDING_PRIV_KEY"
	// SpApprovalPrivKey defines env variable name for sp approval priv key
	SpApprovalPrivKey = "SIGNER_APPROVAL_PRIV_KEY"
	// SpSealPrivKey defines env variable name for sp seal priv key
	SpSealPrivKey = "SIGNER_SEAL_PRIV_KEY"
	// SpGcPrivKey defines env variable name for sp gc priv key
	SpGcPrivKey = "SIGNER_GC_PRIV_KEY"
)

Variables

This section is empty.

Functions

func DefaultSingerOptions

func DefaultSingerOptions(signer *SingModular, cfg *gfspconfig.GfSpConfig) error

Types

type GreenfieldChainSignClient

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

GreenfieldChainSignClient the greenfield chain client

func NewGreenfieldChainSignClient

func NewGreenfieldChainSignClient(rpcAddr, chainID string, gasLimit uint64, operatorPrivateKey, fundingPrivateKey,
	sealPrivateKey, approvalPrivateKey string) (*GreenfieldChainSignClient, error)

NewGreenfieldChainSignClient return the GreenfieldChainSignClient instance

func (*GreenfieldChainSignClient) GetAddr

func (client *GreenfieldChainSignClient) GetAddr(scope SignType) (sdk.AccAddress, error)

GetAddr returns the public address of the private key.

func (*GreenfieldChainSignClient) SealObject

func (client *GreenfieldChainSignClient) SealObject(ctx context.Context, scope SignType, sealObject *storagetypes.MsgSealObject) ([]byte, error)

SealObject seal the object on the greenfield chain.

func (*GreenfieldChainSignClient) Sign

func (client *GreenfieldChainSignClient) Sign(scope SignType, msg []byte) ([]byte, error)

Sign returns a msg signature signed by private key.

func (*GreenfieldChainSignClient) VerifySignature

func (client *GreenfieldChainSignClient) VerifySignature(scope SignType, msg, sig []byte) bool

VerifySignature verifies the signature.

type SignType

type SignType string

SignType is the type of msg signature

const (
	// SignOperator is the type of signature signed by the operator account
	SignOperator SignType = "operator"

	// SignFunding is the type of signature signed by the funding account
	SignFunding SignType = "funding"

	// SignSeal is the type of signature signed by the seal account
	SignSeal SignType = "seal"

	// SignApproval is the type of signature signed by the approval account
	SignApproval SignType = "approval"
)

type SingModular

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

func (*SingModular) Name

func (s *SingModular) Name() string

func (*SingModular) ReleaseResource

func (s *SingModular) ReleaseResource(
	ctx context.Context,
	span rcmgr.ResourceScopeSpan)

func (*SingModular) ReserveResource

func (s *SingModular) ReserveResource(
	ctx context.Context,
	state *rcmgr.ScopeStat) (
	rcmgr.ResourceScopeSpan, error)

func (*SingModular) SealObject

func (s *SingModular) SealObject(
	ctx context.Context,
	object *storagetypes.MsgSealObject) error

func (*SingModular) SignCreateBucketApproval

func (s *SingModular) SignCreateBucketApproval(
	ctx context.Context,
	bucket *storagetypes.MsgCreateBucket) (
	[]byte, error)

func (*SingModular) SignCreateObjectApproval

func (s *SingModular) SignCreateObjectApproval(
	ctx context.Context,
	object *storagetypes.MsgCreateObject) (
	[]byte, error)

func (*SingModular) SignIntegrityHash

func (s *SingModular) SignIntegrityHash(
	ctx context.Context,
	objectID uint64,
	checksums [][]byte) (
	[]byte, []byte, error)

func (*SingModular) SignP2PPingMsg

func (s *SingModular) SignP2PPingMsg(
	ctx context.Context,
	ping *gfspp2p.GfSpPing) (
	[]byte, error)

func (*SingModular) SignP2PPongMsg

func (s *SingModular) SignP2PPongMsg(
	ctx context.Context,
	pong *gfspp2p.GfSpPong) (
	[]byte, error)

func (*SingModular) SignReceivePieceTask

func (s *SingModular) SignReceivePieceTask(
	ctx context.Context,
	task task.ReceivePieceTask) (
	[]byte, error)

func (*SingModular) SignReplicatePieceApproval

func (s *SingModular) SignReplicatePieceApproval(
	ctx context.Context,
	task task.ApprovalReplicatePieceTask) (
	[]byte, error)

func (*SingModular) Start

func (s *SingModular) Start(ctx context.Context) error

func (*SingModular) Stop

func (s *SingModular) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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