diff options
author | Billy Lynch <billy@chainguard.dev> | 2024-02-13 15:33:37 -0500 |
---|---|---|
committer | Billy Lynch <billy@chainguard.dev> | 2024-02-13 15:56:28 -0500 |
commit | 9fa13d83c6e473d0aca7b97a620b3f4a003993f6 (patch) | |
tree | bb994824c5dc8fcad5500a9832ea57046d4684cc /options.go | |
parent | 0dfff253b0b0ad7886d82bf9713e738e1045df1b (diff) | |
download | go-git-9fa13d83c6e473d0aca7b97a620b3f4a003993f6.tar.gz |
git: signer, fix usage of crypto.Signer interface
crypto.Signer was incorrectly used before. Signer documentation says
that Signer.Sign should be used on digests, whereas we were using this
on message bodies.
To fix this, create our own Signer interface (+ signableObject borrowed
from #705) that describes more accurately what we want.
As before, the expectation is that signer implementations only need to
worry about acting on encoded message bodies rather than needing to
encode objects themselves.
This is technically a breaking change from the previous Signer
implementation, but since this is new and hasn't made it into cut
release yet, this seems like an acceptible change.
Also adds example test showing how signers can be made (uses base64 for
consistent outputs).
Diffstat (limited to 'options.go')
-rw-r--r-- | options.go | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -1,7 +1,6 @@ package git import ( - "crypto" "errors" "fmt" "regexp" @@ -516,7 +515,7 @@ type CommitOptions struct { // Signer denotes a cryptographic signer to sign the commit with. // A nil value here means the commit will not be signed. // Takes precedence over SignKey. - Signer crypto.Signer + Signer Signer // Amend will create a new commit object and replace the commit that HEAD currently // points to. Cannot be used with All nor Parents. Amend bool |