Vibe-guided bskyoauth and custom repo example code in Golang 馃 probably not safe to use in prod
at main 1.0 kB view raw
1package bskyoauth 2 3import ( 4 "crypto/ecdsa" 5 "net/http" 6 7 "github.com/shindakun/bskyoauth/internal/dpop" 8) 9 10// DPoPTransport is an interface for transports that support DPoP nonce management. 11// This allows accessing the current nonce without needing to know the concrete type. 12type DPoPTransport interface { 13 http.RoundTripper 14 GetNonce() string 15} 16 17// NewDPoPTransport creates a new HTTP transport with DPoP support. 18// The nonce parameter allows reusing a previously obtained nonce to avoid replay errors. 19// This is a wrapper around internal/dpop.NewTransport to maintain backward compatibility. 20func NewDPoPTransport(underlying http.RoundTripper, dpopKey *ecdsa.PrivateKey, token string, nonce string) http.RoundTripper { 21 return dpop.NewTransport(underlying, dpopKey, token, nonce) 22} 23 24// GenerateDPoPKey generates a new ECDSA P-256 key pair for DPoP. 25// This is a wrapper around internal/dpop.GenerateDPoPKey to maintain backward compatibility. 26func GenerateDPoPKey() (*ecdsa.PrivateKey, error) { 27 return dpop.GenerateDPoPKey() 28}