Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation fixes #10

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading