Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
Writer http.ResponseWriter
Request *http.Request
// contains filtered or unexported fields
}
Context is the request view available to Open and Read handlers. It has no method that returns a submitting transactor.
type OpenRoute ¶
type OpenRoute struct {
// contains filtered or unexported fields
}
OpenRoute never requires a bearer token (health checks).
func (OpenRoute) RegisterTo ¶
RegisterTo adds the route to router. Handle remains the primitive that applies auth; this is the one-line registration used in routes.go files.
func (OpenRoute) RequiresToken ¶
type ReadRoute ¶
type ReadRoute struct {
// contains filtered or unexported fields
}
ReadRoute requires a token only when Token Scope is "all endpoints".
func (ReadRoute) RegisterTo ¶
func (ReadRoute) RequiresToken ¶
type Route ¶
type Route interface {
Path() string
RequiresToken(sensitiveOnly bool) bool
// contains filtered or unexported methods
}
Route is an HTTP endpoint bound to a path with a compile-time auth class.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router registers typed routes and applies per-route bearer auth.
func NewRouter ¶
NewRouter returns a router that authenticates against tokens. unauthenticatedReads allows Read routes without a bearer token; Write routes always require a write-scoped token.
func (*Router) Handle ¶
Handle registers rt. Auth is applied here so a Write route cannot be registered without a token check.
type TransactOpts ¶
type TransactOpts struct {
// contains filtered or unexported fields
}
TransactOpts is a node-account transactor for submitting a transaction. The only constructor is WriteContext.Transactor; the inner opts are unexported so a Read handler cannot forge one.
func (*TransactOpts) Opts ¶
func (t *TransactOpts) Opts() *bind.TransactOpts
Opts returns the go-ethereum transactor for bindings.
type WriteContext ¶
type WriteContext struct{ Context }
WriteContext is the request view available to Write handlers. Transactor is the only way HTTP handlers may obtain submit opts.
func (WriteContext) Transactor ¶
func (c WriteContext) Transactor() (*TransactOpts, error)
Transactor returns submit opts with gas fields from the request form.
type WriteRoute ¶
type WriteRoute struct {
// contains filtered or unexported fields
}
WriteRoute always requires a bearer token: transaction submission and high-impact local operations (wallet secrets, exits, signing).
func Write ¶
func Write(path string, h func(WriteContext)) WriteRoute
Write returns a route that always requires a bearer token.
func (WriteRoute) Path ¶
func (r WriteRoute) Path() string
func (WriteRoute) RegisterTo ¶
func (r WriteRoute) RegisterTo(router *Router)
func (WriteRoute) RequiresToken ¶
func (WriteRoute) RequiresToken(bool) bool