 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func AuthenticateBridgeType(bt *BridgeType, token string) (bool, error)
- func AuthenticateExternalInitiator(eia *auth.Token, ea *ExternalInitiator) (bool, error)
- func MarshalBridgeMetaData(latestAnswer *big.Int, updatedAt *big.Int) (map[string]interface{}, error)
- func NewBridgeType(btr *BridgeTypeRequest) (*BridgeTypeAuthentication, *BridgeType, error)
- type BridgeMetaData
- type BridgeMetaDataJSON
- type BridgeName
- type BridgeType
- type BridgeTypeAuthentication
- type BridgeTypeRequest
- type ExternalInitiator
- type ExternalInitiatorRequest
- type ORM
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateBridgeType ¶
func AuthenticateBridgeType(bt *BridgeType, token string) (bool, error)
AuthenticateBridgeType returns true if the passed token matches its IncomingToken, or returns false with an error.
func AuthenticateExternalInitiator ¶
func AuthenticateExternalInitiator(eia *auth.Token, ea *ExternalInitiator) (bool, error)
AuthenticateExternalInitiator compares an auth against an initiator and returns true if the password hashes match
func MarshalBridgeMetaData ¶
func NewBridgeType ¶
func NewBridgeType(btr *BridgeTypeRequest) (*BridgeTypeAuthentication, *BridgeType, error)
NewBridgeType returns a bridge type authentication (with plaintext password) and a bridge type (with hashed password, for persisting)
Types ¶
type BridgeMetaData ¶
type BridgeMetaData struct {
	LatestAnswer *big.Int `json:"latestAnswer"`
	UpdatedAt    *big.Int `json:"updatedAt"` // A unix timestamp
}
    NOTE: latestAnswer and updatedAt is the only metadata used. Currently market closer adapter and outlier detection depend latestAnswer. https://github.com/smartcontractkit/external-adapters-js/tree/f474bd2e2de13ebe5c9dc3df36ebb7018817005e/composite/market-closure https://github.com/smartcontractkit/external-adapters-js/tree/5abb8e5ec2024f724fd39122897baa63c3cd0167/composite/outlier-detection
type BridgeMetaDataJSON ¶
type BridgeMetaDataJSON struct {
	Meta BridgeMetaData
}
    type BridgeName ¶
type BridgeName string
BridgeName defines what Adapter a TaskSpec will use.
func MustParseBridgeName ¶
func MustParseBridgeName(val string) BridgeName
MustParseBridgeName instantiates a new BridgeName, and panics if a bad input is provided.
func ParseBridgeName ¶
func ParseBridgeName(val string) (BridgeName, error)
ParseBridgeName returns a formatted Task type.
func (BridgeName) MarshalJSON ¶
func (t BridgeName) MarshalJSON() ([]byte, error)
MarshalJSON converts a BridgeName to a JSON byte slice.
func (*BridgeName) Scan ¶
func (t *BridgeName) Scan(value interface{}) error
Scan reads the database value and returns an instance.
func (BridgeName) String ¶
func (t BridgeName) String() string
String returns this BridgeName as a string.
func (*BridgeName) UnmarshalJSON ¶
func (t *BridgeName) UnmarshalJSON(input []byte) error
UnmarshalJSON converts a bytes slice of JSON to a BridgeName.
type BridgeType ¶
type BridgeType struct {
	Name                   BridgeName
	URL                    models.WebURL
	Confirmations          uint32
	IncomingTokenHash      string
	Salt                   string
	OutgoingToken          string
	MinimumContractPayment *assets.Link
	CreatedAt              time.Time
	UpdatedAt              time.Time
}
    BridgeType is used for external adapters and has fields for the name of the adapter and its URL.
type BridgeTypeAuthentication ¶
type BridgeTypeAuthentication struct {
	Name                   BridgeName
	URL                    models.WebURL
	Confirmations          uint32
	IncomingToken          string
	OutgoingToken          string
	MinimumContractPayment *assets.Link
}
    BridgeTypeAuthentication is the record returned in response to a request to create a BridgeType
type BridgeTypeRequest ¶
type BridgeTypeRequest struct {
	Name                   BridgeName    `json:"name"`
	URL                    models.WebURL `json:"url"`
	Confirmations          uint32        `json:"confirmations"`
	MinimumContractPayment *assets.Link  `json:"minimumContractPayment"`
}
    BridgeTypeRequest is the incoming record used to create a BridgeType
func (BridgeTypeRequest) GetID ¶
func (bt BridgeTypeRequest) GetID() string
GetID returns the ID of this structure for jsonapi serialization.
func (BridgeTypeRequest) GetName ¶
func (bt BridgeTypeRequest) GetName() string
GetName returns the pluralized "type" of this structure for jsonapi serialization.
func (*BridgeTypeRequest) SetID ¶
func (bt *BridgeTypeRequest) SetID(value string) error
SetID is used to set the ID of this structure when deserializing from jsonapi documents.
type ExternalInitiator ¶
type ExternalInitiator struct {
	ID             int64
	Name           string
	URL            *models.WebURL
	AccessKey      string
	Salt           string
	HashedSecret   string
	OutgoingSecret string
	OutgoingToken  string
	CreatedAt time.Time
	UpdatedAt time.Time
}
    ExternalInitiator represents a user that can initiate runs remotely
func NewExternalInitiator ¶
func NewExternalInitiator( eia *auth.Token, eir *ExternalInitiatorRequest, ) (*ExternalInitiator, error)
NewExternalInitiator generates an ExternalInitiator from an auth.Token, hashing the password for storage
type ExternalInitiatorRequest ¶
type ExternalInitiatorRequest struct {
	Name string         `json:"name"`
	URL  *models.WebURL `json:"url,omitempty"`
}
    ExternalInitiatorRequest is the incoming record used to create an ExternalInitiator.
type ORM ¶
type ORM interface {
	FindBridge(name BridgeName) (bt BridgeType, err error)
	FindBridges(name []BridgeName) (bts []BridgeType, err error)
	DeleteBridgeType(bt *BridgeType) error
	BridgeTypes(offset int, limit int) ([]BridgeType, int, error)
	CreateBridgeType(bt *BridgeType) error
	UpdateBridgeType(bt *BridgeType, btr *BridgeTypeRequest) error
	GetCachedResponse(dotId string, specId int32, maxElapsed time.Duration) ([]byte, error)
	UpsertBridgeResponse(dotId string, specId int32, response []byte) error
	ExternalInitiators(offset int, limit int) ([]ExternalInitiator, int, error)
	CreateExternalInitiator(externalInitiator *ExternalInitiator) error
	DeleteExternalInitiator(name string) error
	FindExternalInitiator(eia *auth.Token) (*ExternalInitiator, error)
	FindExternalInitiatorByName(iname string) (exi ExternalInitiator, err error)
}