Categorygithub.com/Decentr-net/go-api
modulepackage
0.1.1
Repository: https://github.com/decentr-net/go-api.git
Documentation: pkg.go.dev

# README

api

img img

Utility functions and middlewares shared across off-chain services

# Packages

Package health contains code for health checks.
No description provided by the author

# Functions

BodyLimiterMiddleware returns middleware which limits size of data read from request's body.
FileServerMiddleware serves requests with prefix into directory.
No description provided by the author
GetMessageToSign returns message to sign.
No description provided by the author
LoggerMiddleware puts logger with client's info into context.
RecovererMiddleware handles panics.
RequestIDMiddleware puts request-id to headers and adds it into a logger.
Sign signs http request.
TimeoutMiddleware puts timeout context into request.
Verify verifies request's signature with public key.
WriteError writes error.
WriteErrorf writes formatted error.
WriteInternalError logs error and writes internal error.
WriteInternalErrorf logs formatted error and writes internal error.
WriteOK writes json body.
WriteVerifyError writes sign verification(auth) error with proper status.

# Constants

PublicKeyHeader is name for public key http header.
SignatureHeader is name for signature http header.

# Variables

ErrInvalidPublicKey is returned when public key is invalid.
ErrInvalidRequest is returned when request is invalid.
ErrInvalidSignature is returned when signature is invalid.
ErrNotFound is returned when object is not found.
ErrNotVerified is returned when signature is wrong.

# Structs

Error ..