Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'internal/signature/gpg.go')
-rw-r--r--internal/signature/gpg.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/signature/gpg.go b/internal/signature/gpg.go
index e614b1988..9c313ba37 100644
--- a/internal/signature/gpg.go
+++ b/internal/signature/gpg.go
@@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"strings"
+ "time"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/ProtonMail/go-crypto/openpgp/packet"
@@ -24,13 +25,17 @@ func parseGpgSigningKey(key []byte) (*GpgSigningKey, error) {
}
// CreateSignature creates a gpg signature
-func (sk *GpgSigningKey) CreateSignature(contentToSign []byte) ([]byte, error) {
+func (sk *GpgSigningKey) CreateSignature(contentToSign []byte, date time.Time) ([]byte, error) {
var sigBuf strings.Builder
if err := openpgp.ArmoredDetachSignText(
&sigBuf,
sk.Entity,
bytes.NewReader(contentToSign),
- &packet.Config{},
+ &packet.Config{
+ Time: func() time.Time {
+ return date
+ },
+ },
); err != nil {
return nil, fmt.Errorf("sign commit: %w", err)
}