diff options
author | Adrien Carreira <adrien@xcid.fr> | 2024-01-23 18:12:14 +0300 |
---|---|---|
committer | GitLab <noreply@gitlab.com> | 2024-01-23 18:12:14 +0300 |
commit | 353daaee5bf099647db744572c7f7cabf965d42a (patch) | |
tree | ed643d032ad0f258547db62b96cbcb1dffc49e7b /internal/signature/signature.go | |
parent | e9a4b66eee03f8ee8be751155b9ca5f5f801a17c (diff) |
signature: extend CreateSignature to accept timestamp
Since the gpg signature is time-dependent, aligning the timestamp with the
author's date makes the gpg signature consistent across all gitaly nodes.
Diffstat (limited to 'internal/signature/signature.go')
-rw-r--r-- | internal/signature/signature.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/signature/signature.go b/internal/signature/signature.go index 6f9418aa0..ce2a7f78e 100644 --- a/internal/signature/signature.go +++ b/internal/signature/signature.go @@ -4,11 +4,12 @@ import ( "bytes" "fmt" "os" + "time" ) // SigningKey is the common interface of SSH and GPG signing keys type SigningKey interface { - CreateSignature([]byte) ([]byte, error) + CreateSignature([]byte, time.Time) ([]byte, error) Verify([]byte, []byte) error } @@ -61,8 +62,8 @@ func parseSigningKey(path string) (SigningKey, error) { } // CreateSignature uses the primary key to create a signature -func (s *SigningKeys) CreateSignature(contentToSign []byte) ([]byte, error) { - return s.primaryKey.CreateSignature(contentToSign) +func (s *SigningKeys) CreateSignature(contentToSign []byte, date time.Time) ([]byte, error) { + return s.primaryKey.CreateSignature(contentToSign, date) } // Verify iterates over all signing keys and returns nil if any |