Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultSignerOptions(signer *SignModular, cfg *gfspconfig.GfSpConfig) error
- func NewSignModular(app *gfspapp.GfSpBaseApp, cfg *gfspconfig.GfSpConfig) (coremodule.Modular, error)
- type GreenfieldChainSignClient
- func (client *GreenfieldChainSignClient) DiscontinueBucket(ctx context.Context, scope SignType, ...) ([]byte, error)
- func (client *GreenfieldChainSignClient) GetAddr(scope SignType) (sdk.AccAddress, error)
- func (client *GreenfieldChainSignClient) RejectUnSealObject(ctx context.Context, scope SignType, ...) ([]byte, error)
- func (client *GreenfieldChainSignClient) SealObject(ctx context.Context, scope SignType, sealObject *storagetypes.MsgSealObject) ([]byte, error)
- func (client *GreenfieldChainSignClient) Sign(scope SignType, msg []byte) ([]byte, error)
- func (client *GreenfieldChainSignClient) VerifySignature(scope SignType, msg, sig []byte) bool
- type SignModular
- func (s *SignModular) DiscontinueBucket(ctx context.Context, bucket *storagetypes.MsgDiscontinueBucket) error
- func (s *SignModular) Name() string
- func (s *SignModular) RejectUnSealObject(ctx context.Context, rejectObject *storagetypes.MsgRejectSealObject) error
- func (s *SignModular) ReleaseResource(ctx context.Context, span rcmgr.ResourceScopeSpan)
- func (s *SignModular) ReserveResource(ctx context.Context, state *rcmgr.ScopeStat) (rcmgr.ResourceScopeSpan, error)
- func (s *SignModular) SealObject(ctx context.Context, object *storagetypes.MsgSealObject) error
- func (s *SignModular) SignCreateBucketApproval(ctx context.Context, bucket *storagetypes.MsgCreateBucket) ([]byte, error)
- func (s *SignModular) SignCreateObjectApproval(ctx context.Context, object *storagetypes.MsgCreateObject) ([]byte, error)
- func (s *SignModular) SignIntegrityHash(ctx context.Context, objectID uint64, checksums [][]byte) ([]byte, []byte, error)
- func (s *SignModular) SignP2PPingMsg(ctx context.Context, ping *gfspp2p.GfSpPing) ([]byte, error)
- func (s *SignModular) SignP2PPongMsg(ctx context.Context, pong *gfspp2p.GfSpPong) ([]byte, error)
- func (s *SignModular) SignReceivePieceTask(ctx context.Context, task task.ReceivePieceTask) ([]byte, error)
- func (s *SignModular) SignReplicatePieceApproval(ctx context.Context, task task.ApprovalReplicatePieceTask) ([]byte, error)
- func (s *SignModular) Start(ctx context.Context) error
- func (s *SignModular) Stop(ctx context.Context) error
- type SignType
Constants ¶
View Source
const ( // DefaultGasLimit defines the default gas limit DefaultGasLimit = 210000 // SpOperatorPrivKey defines env variable name for sp operator private key SpOperatorPrivKey = "SIGNER_OPERATOR_PRIV_KEY" // SpFundingPrivKey defines env variable name for sp funding private key SpFundingPrivKey = "SIGNER_FUNDING_PRIV_KEY" // SpApprovalPrivKey defines env variable name for sp approval private key SpApprovalPrivKey = "SIGNER_APPROVAL_PRIV_KEY" // SpSealPrivKey defines env variable name for sp seal private key SpSealPrivKey = "SIGNER_SEAL_PRIV_KEY" // SpGcPrivKey defines env variable name for sp gc private key SpGcPrivKey = "SIGNER_GC_PRIV_KEY" )
Variables ¶
View Source
var ( ErrSignMsg = gfsperrors.Register(module.SignerModularName, http.StatusBadRequest, 120001, "sign message with private key failed") ErrSealObjectOnChain = gfsperrors.Register(module.SignerModularName, http.StatusBadRequest, 120002, "send sealObject msg failed") ErrRejectUnSealObjectOnChain = gfsperrors.Register(module.SignerModularName, http.StatusBadRequest, 120003, "send rejectUnSealObject msg failed") ErrDiscontinueBucketOnChain = gfsperrors.Register(module.SignerModularName, http.StatusBadRequest, 120004, "send discontinueBucket msg failed") )
Functions ¶
func DefaultSignerOptions ¶
func DefaultSignerOptions(signer *SignModular, cfg *gfspconfig.GfSpConfig) error
func NewSignModular ¶
func NewSignModular(app *gfspapp.GfSpBaseApp, cfg *gfspconfig.GfSpConfig) (coremodule.Modular, 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, gcPrivateKey string) (*GreenfieldChainSignClient, error)
NewGreenfieldChainSignClient return the GreenfieldChainSignClient instance
func (*GreenfieldChainSignClient) DiscontinueBucket ¶
func (client *GreenfieldChainSignClient) DiscontinueBucket(ctx context.Context, scope SignType, discontinueBucket *storagetypes.MsgDiscontinueBucket) ([]byte, error)
DiscontinueBucket stops serving the bucket on the greenfield chain.
func (*GreenfieldChainSignClient) GetAddr ¶
func (client *GreenfieldChainSignClient) GetAddr(scope SignType) (sdk.AccAddress, error)
GetAddr returns the public address of the private key.
func (*GreenfieldChainSignClient) RejectUnSealObject ¶
func (client *GreenfieldChainSignClient) RejectUnSealObject( ctx context.Context, scope SignType, rejectObject *storagetypes.MsgRejectSealObject) ( []byte, error)
RejectUnSealObject reject seal object on the greenfield chain.
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 SignModular ¶
type SignModular struct {
// contains filtered or unexported fields
}
func (*SignModular) DiscontinueBucket ¶
func (s *SignModular) DiscontinueBucket(ctx context.Context, bucket *storagetypes.MsgDiscontinueBucket) error
func (*SignModular) Name ¶
func (s *SignModular) Name() string
func (*SignModular) RejectUnSealObject ¶
func (s *SignModular) RejectUnSealObject( ctx context.Context, rejectObject *storagetypes.MsgRejectSealObject) error
func (*SignModular) ReleaseResource ¶
func (s *SignModular) ReleaseResource(ctx context.Context, span rcmgr.ResourceScopeSpan)
func (*SignModular) ReserveResource ¶
func (s *SignModular) ReserveResource(ctx context.Context, state *rcmgr.ScopeStat) ( rcmgr.ResourceScopeSpan, error)
func (*SignModular) SealObject ¶
func (s *SignModular) SealObject(ctx context.Context, object *storagetypes.MsgSealObject) error
func (*SignModular) SignCreateBucketApproval ¶
func (s *SignModular) SignCreateBucketApproval(ctx context.Context, bucket *storagetypes.MsgCreateBucket) ([]byte, error)
func (*SignModular) SignCreateObjectApproval ¶
func (s *SignModular) SignCreateObjectApproval(ctx context.Context, object *storagetypes.MsgCreateObject) ([]byte, error)
func (*SignModular) SignIntegrityHash ¶
func (*SignModular) SignP2PPingMsg ¶
func (*SignModular) SignP2PPongMsg ¶
func (*SignModular) SignReceivePieceTask ¶
func (s *SignModular) SignReceivePieceTask(ctx context.Context, task task.ReceivePieceTask) ( []byte, error)
func (*SignModular) SignReplicatePieceApproval ¶
func (s *SignModular) SignReplicatePieceApproval(ctx context.Context, task task.ApprovalReplicatePieceTask) ([]byte, error)
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" // SignGc is the type of signature signed by the gc account SignGc SignType = "gc" )
Click to show internal directories.
Click to hide internal directories.