Skip to content

Commit

Permalink
Documentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yaronf committed Jun 11, 2024
1 parent 542e0a2 commit c336670
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@ in the [API reference](https://pkg.go.dev/github.com/yaronf/httpsign).

```cgo
// Create a signer and a wrapped HTTP client
signer, _ := httpsign.NewRSAPSSSigner("key1", *prvKey,
httpsign.NewSignConfig(),
signer, _ := httpsign.NewRSAPSSSigner(*prvKey, httpsign.NewSignConfig(),
httpsign.Headers("@request-target", "content-digest")) // The Content-Digest header will be auto-generated
client := httpsign.NewDefaultClient(httpsign.NewClientConfig().SetSignatureName("sig1").SetSigner(signer)) // sign requests, don't verify responses
// Send an HTTP POST, get response -- signing happens behind the scenes
body := `{"hello": "world"}`
res, err := client.Post(ts.URL, "application/json", bufio.NewReader(strings.NewReader(body)))
if err != nil {
// handle error
}
res, _ := client.Post(ts.URL, "application/json", bufio.NewReader(strings.NewReader(body)))
// Read the response
serverText, _ := io.ReadAll(res.Body)
_ = res.Body.Close()
Expand Down
3 changes: 1 addition & 2 deletions doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Package httpsign signs HTTP requests and responses as defined in draft-ietf-httpbis-message-signatures.
// See https://datatracker.ietf.org/doc/draft-ietf-httpbis-message-signatures/ for the latest draft version.
// Package httpsign signs HTTP requests and responses as defined in RFC 9421, formerly draft-ietf-httpbis-message-signatures.
//
// For client-side message signing and verification, use the Client wrapper.
// Alternatively you can use SignRequest, VerifyResponse etc. directly, but this is more complicated.
Expand Down

0 comments on commit c336670

Please sign in to comment.