server

package
v0.0.0-...-8eea3e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const ENV_OFFCHAIN_CONFIG = "OFFCHAIN_CONFIG"

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm string
const (
	K256Sha256 Algorithm = "k256-sha2"
	Ed25519    Algorithm = "ed25519"
	Ed255      Algorithm = "ed255" // alias to ed25519
)

type BearerToken

type BearerToken struct {
	Token secret.Secret `yaml:"token"`
	Id    string        `yaml:"id"`
}

type Config

type Config struct {
	Listen    string   `yaml:"listen" env-default:"127.0.0.1:6333"`
	Origins   []string `yaml:"origins" env-default:""`
	AnyOrigin bool     `yaml:"any_origin" env-default:"false"`

	PublicReadEndpoints bool            `yaml:"public_read_endpoints"`
	BearerTokens        []BearerToken   `yaml:"bearer_tokens"`
	PublicKeys          []HttpPublicKey `yaml:"public_keys"`
}

func LoadConfig

func LoadConfig(configPathMaybe string) (*Config, error)

type HttpPublicKey

type HttpPublicKey struct {
	Algorithm Algorithm `yaml:"algorithm"`
	// Hex encoded
	Key hex.Hex `yaml:"key"`
	Id  string  `yaml:"id"`
}

type Server

type Server struct {
	ServerArgs
	// contains filtered or unexported fields
}

Server represents the HTTP server

func New

func New(ocConf *oc.Config, args ServerArgs) *Server

New creates a new server instance

func (*Server) Start

func (s *Server) Start() error

Start begins listening for requests

type ServerArgs

type ServerArgs struct {
	Listen    string
	AnyOrigin bool
	Origins   []string

	BearerTokens        []string
	PublicKeys          []verifier.VerifierI
	PublicReadEndpoints bool
}

Directories

Path Synopsis
api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL