modulepackage
0.0.0-20170912233209-44256dfd4bfa
Repository: https://github.com/mbland/hmacauth.git
Documentation: pkg.go.dev
# README
hmacauth HMAC authentication package for Go
Signs and authenticates HTTP requests based on a shared-secret HMAC signature.
Developed in parallel with the following packages for other languages:
- Node.js: hmac-authentication
- Python: hmac_authentication
- Ruby: hmac_authentication
Installation
import "github.com/mbland/hmacauth"
# Functions
CryptoHashToDigestName returns the algorithm name corresponding to the crypto.Hash ID, or an error if the algorithm is not supported.
DigestNameToCryptoHash returns the crypto.Hash value corresponding to the algorithm name, or an error if the algorithm is not supported.
NewHmacAuth returns an HmacAuth object that can be used to sign or authenticate HTTP requests based on the supplied parameters.
# Constants
ResultInvalidFormat - the signature header was not parseable.
ResultMatch - the signature from the request header matched the locally-computed signature.
ResultMismatch - the signature from the request header did not match the locally-computed signature.
ResultNoSignature - the incoming result did not have a signature header.
ResultUnsupportedAlgorithm - the signature header specified an unsupported algorithm.
# Interfaces
HmacAuth signs outbound requests and authenticates inbound requests.
# Type aliases
AuthenticationResult is a code used to identify the outcome of HmacAuth.AuthenticateRequest().