diff --git a/web/shared/clientRfc9421.go b/web/shared/clientRfc9421.go index 612790b..3740678 100644 --- a/web/shared/clientRfc9421.go +++ b/web/shared/clientRfc9421.go @@ -29,6 +29,25 @@ Links for home: - https://datatracker.ietf.org/doc/html/rfc9421 */ +// Perform a signed request. Tries RFC9421 first and on fail cavage. +// This double-knocking is because implementations currently use cavage (a precursor to RFC9421). +// However, Cavage is deprecated now and the RFC should be used instead. And so +// implementations have slowly begun to implement the RFC in addition to cavage +// +// Returns the unmodified response, if the request completed with RFC signing and an error, if any +func RequestSigned( + method, target string, + body []byte, + actor *models.User, +) (response *http.Response, wasRfc9421 bool, err error) { + res, err := RequestSignedRFC9421(method, target, body, actor) + if err == nil { + return res, true, nil + } + res, err = RequestSignedCavage(method, target, body, actor) + return res, false, err +} + // Perform a request, signing it as specified in RFC 9421 func RequestSignedRFC9421( method, target string,