Documentation ¶
Index ¶
- Variables
- func GetBalancesHandler(adapter BoxHTTPAdapter) http.HandlerFunc
- func GetStatusHandler(adapter BoxHTTPAdapter) http.HandlerFunc
- func MarshalBoxInfo(boxInfo BoxInfo) ([]byte, error)
- func MarshalOrderID(orderIDIn [32]byte) string
- func MarshalSignature(signatureIn [65]byte) string
- func NewServer(adapter BoxHTTPAdapter) http.Handler
- func PostOrdersHandler(boxHTTPAdapter BoxHTTPAdapter) http.HandlerFunc
- func RecoveryHandler(h http.Handler) http.Handler
- func UnmarshalOrderID(orderIDIn string) ([32]byte, error)
- func UnmarshalSignature(signatureIn string) ([65]byte, error)
- func WhoAmIHandler(adapter BoxHTTPAdapter) http.HandlerFunc
- type Balance
- type Balances
- type BoxHTTPAdapter
- type BoxInfo
- type PostOrder
- type Status
- type WhoAmI
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidOrderIDLength = errors.New("invalid order id length")
View Source
var ErrInvalidSignatureLength = errors.New("invalid signature length")
Functions ¶
func GetBalancesHandler ¶
func GetBalancesHandler(adapter BoxHTTPAdapter) http.HandlerFunc
func GetStatusHandler ¶
func GetStatusHandler(adapter BoxHTTPAdapter) http.HandlerFunc
func MarshalBoxInfo ¶
func MarshalOrderID ¶
func MarshalSignature ¶
func NewServer ¶
func NewServer(adapter BoxHTTPAdapter) http.Handler
NewServer creates a new http handler
func PostOrdersHandler ¶
func PostOrdersHandler(boxHTTPAdapter BoxHTTPAdapter) http.HandlerFunc
PostOrdersHandler handles post orders request, it gets the signed order id, checks whether the signer is authorized, if the signer is authorized this function adds the order id to the queue.
func RecoveryHandler ¶
RecoveryHandler handles errors while processing the requests and populates the errors in the response
func UnmarshalOrderID ¶
func UnmarshalSignature ¶
func WhoAmIHandler ¶
func WhoAmIHandler(adapter BoxHTTPAdapter) http.HandlerFunc
WhoAmIHandler handles the get whoami request,it gets a challenge from the caller signs it and sends back the signed challenge with it's version information.
Types ¶
type BoxHTTPAdapter ¶
type BoxHTTPAdapter interface { WhoAmI(challenge string) (WhoAmI, error) PostOrder(order PostOrder) (PostOrder, error) GetStatus(orderID string) (Status, error) GetBalances() (Balances, error) }
func NewBoxHttpAdapter ¶
type BoxInfo ¶
type BoxInfo struct { Challenge string `json:"challenge"` Version string `json:"version"` AuthorizedAddresses []string `json:"authorizedAddresses"` SupportedCurrencies []string `json:"supportedCurrencies"` }
func UnmarshalBoxInfo ¶
Click to show internal directories.
Click to hide internal directories.