-
Notifications
You must be signed in to change notification settings - Fork 0
/
signerOption.go
41 lines (34 loc) · 947 Bytes
/
signerOption.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package sigs
import "crypto"
// SignerOption is a function that modifies a Signer
type SignerOption func(*Signer)
// SignerFields sets the http.Request fields to be signed
func SignerFields(fields ...string) SignerOption {
return func(signer *Signer) {
signer.Fields = fields
}
}
// SignerSignatureDigest sets the hashing algorithm to be used
// when we sign a request.
func SignerSignatureHash(hash crypto.Hash) SignerOption {
return func(signer *Signer) {
signer.SignatureHash = hash
}
}
// SignerBodyDigests sets the digest algorithm to be used
// when creating the "Digest" header.
func SignerBodyDigest(digest crypto.Hash) SignerOption {
return func(signer *Signer) {
signer.BodyDigest = digest
}
}
func SignerCreated(created int64) SignerOption {
return func(signer *Signer) {
signer.Created = created
}
}
func SignerExpires(expires int64) SignerOption {
return func(signer *Signer) {
signer.Expires = expires
}
}