dpop

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dpop implements RFC 9449 OAuth 2.0 Demonstrating Proof-of-Possession (DPoP) verification and proof minting for ES256 (P-256) keys.

When a caller sends a DPoP header (or a token carrying cnf.jkt / previously pinned on first DPoP use), VerifyRequest enforces:

  • header typ="dpop+jwt", alg="ES256", public EC P-256 jwk (no private "d")
  • valid ES256 signature over header.payload (IEEE P1363 r||s or ASN.1 DER)
  • htm == r.Method and normalized htu (scheme://host/path without query/fragment)
  • iat within ±60s of server time and unique jti within the replay window
  • ath == base64url(sha256(accessToken))
  • cnf.jkt match (if present in JWT accessToken) + bind-on-first-use pin (tokenHash -> jkt) so a stolen token cannot be used with a different key or downgraded back to plain Bearer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MintProof

func MintProof(priv *ecdsa.PrivateKey, method, targetURL, accessToken string, now time.Time) (string, error)

MintProof creates an RFC 9449 ES256 DPoP proof JWT for (method, targetURL, accessToken).

func VerifyRequest

func VerifyRequest(r *http.Request, accessToken string) error

VerifyRequest checks the request's DPoP header against accessToken using the process-wide verifier.

Types

type Verifier

type Verifier struct {
	Now func() time.Time
	// contains filtered or unexported fields
}

func NewVerifier

func NewVerifier() *Verifier

func (*Verifier) VerifyRequest

func (v *Verifier) VerifyRequest(r *http.Request, accessToken string) error

Jump to

Keyboard shortcuts

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