Documentation
¶
Index ¶
- Constants
- Variables
- func AggregateMethodNames(methods []types.MethodName) ([]types.MethodName, error)
- func ContextStrategyToken(ctx context.Context) string
- func GetMethodName(actCode Cid, method MethodNum) (string, error)
- func GetSignBytes(toSign []byte, meta types.MsgMeta) (interface{}, []byte, error)
- func RegistSupportedMsgTypes(msgType types.MsgType, p reflect.Type, fGetSignBytes FGetSignBytes, ...) (replaced bool)
- type Address
- type Cid
- type ContextKey
- type EmptyValue
- type FGetSignBytes
- type FParseObj
- type MethodNum
- type Signature
- type StrategyLevel
- type Types
Constants ¶
View Source
const StringEmpty = ""
Variables ¶
View Source
var MethodNameList []types.MethodName
View Source
var MethodNamesMap = make(map[string]struct{})
View Source
var MethodsMap = chain.MethodsMap
View Source
var (
NilAddress = Address{}
)
View Source
var RandSignBytes = func() []byte { randSignBytes, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32)) if err != nil { panic(fmt.Errorf("rand secret failed %v", err)) } return randSignBytes }()
View Source
var SupportedMsgTypes = map[types.MsgType]*Types{ types.MTDealProposal: {reflect.TypeOf(market.DealProposal{}), func(i interface{}) ([]byte, error) { return cborutil.Dump(i) }, nil}, types.MTClientDeal: {reflect.TypeOf(market.ClientDealProposal{}), func(in interface{}) ([]byte, error) { ni, err := cborutil.AsIpld(in) if err != nil { return nil, err } return ni.Cid().Bytes(), nil }, nil}, types.MTDrawRandomParam: {reflect.TypeOf(types2.DrawRandomParams{}), func(in interface{}) ([]byte, error) { param := in.(*types2.DrawRandomParams) return param.SignBytes() }, nil}, types.MTSignedVoucher: {reflect.TypeOf(paych.SignedVoucher{}), func(in interface{}) ([]byte, error) { return (in.(*paych.SignedVoucher)).SigningBytes() }, nil}, types.MTStorageAsk: {reflect.TypeOf(storagemarket.StorageAsk{}), func(in interface{}) ([]byte, error) { return cborutil.Dump(in) }, nil}, types.MTAskResponse: {Type: reflect.TypeOf(network.AskResponse{}), /* contains filtered or unexported fields */}, types.MTNetWorkResponse: {reflect.TypeOf(network.Response{}), func(in interface{}) ([]byte, error) { return cborutil.Dump(in) }, nil}, types.MTBlock: {reflect.TypeOf(types.BlockHeader{}), func(in interface{}) ([]byte, error) { return in.(*types.BlockHeader).SignatureData() }, nil}, types.MTChainMsg: {reflect.TypeOf(types.Message{}), func(in interface{}) ([]byte, error) { msg := in.(*types.Message) return msg.Cid().Bytes(), nil }, nil}, types.MTProviderDealState: {reflect.TypeOf(storagemarket.ProviderDealState{}), func(in interface{}) ([]byte, error) { return cborutil.Dump(in) }, nil, }, types.MTUnknown: {reflect.TypeOf([]byte{}), func(in interface{}) ([]byte, error) { msg, isok := in.([]byte) if !isok { return nil, fmt.Errorf("MTUnkown must be []byte") } return msg, nil }, func(in []byte, meta types.MsgMeta) (interface{}, error) { if meta.Type == types.MTUnknown { return in, nil } return nil, fmt.Errorf("un-expected MsgType:%s", meta.Type) }}, types.MTVerifyAddress: { Type: reflect.TypeOf([]byte{}), // contains filtered or unexported fields }, }
signature type factory
Functions ¶
func AggregateMethodNames ¶
func AggregateMethodNames(methods []types.MethodName) ([]types.MethodName, error)
func ContextStrategyToken ¶
func GetSignBytes ¶
Matches the type and returns the data that needs to be signed
func RegistSupportedMsgTypes ¶
Types ¶
type ContextKey ¶
type ContextKey string
const CtxKeyStrategy ContextKey = "strategy"
ctx key of strategy token
type EmptyValue ¶
type EmptyValue struct{}
type FGetSignBytes ¶
type StrategyLevel ¶
type StrategyLevel = uint8
const ( // default level, no strategy SLDisable StrategyLevel = iota // level 1, check struct type SLMetaType // level 2, check struct type and method in msg SLMethod )
var WalletStrategyLevel StrategyLevel
wallet strategy level, it will be initialized from config at startup
Click to show internal directories.
Click to hide internal directories.