From 44f61b66775e77fd8b42ba3ea57b2c323463b725 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 15 Feb 2022 21:35:49 +0100 Subject: update keyring and migrate to github.com/ProtonMail/go-crypto --- repository/common.go | 6 +++--- repository/gogit.go | 2 +- repository/keyring.go | 8 ++++---- repository/mock_repo.go | 2 +- repository/repo.go | 4 ++-- repository/repo_testing.go | 10 +++++----- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'repository') diff --git a/repository/common.go b/repository/common.go index 4cefbd9e..459fc08a 100644 --- a/repository/common.go +++ b/repository/common.go @@ -3,9 +3,9 @@ package repository import ( "io" - "golang.org/x/crypto/openpgp" - "golang.org/x/crypto/openpgp/armor" - "golang.org/x/crypto/openpgp/errors" + "github.com/ProtonMail/go-crypto/openpgp" + "github.com/ProtonMail/go-crypto/openpgp/armor" + "github.com/ProtonMail/go-crypto/openpgp/errors" ) // nonNativeListCommits is an implementation for ListCommits, for the case where diff --git a/repository/gogit.go b/repository/gogit.go index bec340df..54677902 100644 --- a/repository/gogit.go +++ b/repository/gogit.go @@ -11,6 +11,7 @@ import ( "sync" "time" + "github.com/ProtonMail/go-crypto/openpgp" "github.com/blevesearch/bleve" "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/osfs" @@ -19,7 +20,6 @@ import ( "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/filemode" "github.com/go-git/go-git/v5/plumbing/object" - "golang.org/x/crypto/openpgp" "golang.org/x/sys/execabs" "github.com/MichaelMure/git-bug/util/lamport" diff --git a/repository/keyring.go b/repository/keyring.go index 6cba303e..8ae7b1ef 100644 --- a/repository/keyring.go +++ b/repository/keyring.go @@ -13,13 +13,13 @@ var ErrKeyringKeyNotFound = keyring.ErrKeyNotFound // Keyring provides the uniform interface over the underlying backends type Keyring interface { - // Returns an Item matching the key or ErrKeyringKeyNotFound + // Get returns an Item matching the key or ErrKeyringKeyNotFound Get(key string) (Item, error) - // Stores an Item on the keyring. Set is idempotent. + // Set stores an Item on the keyring. Set is idempotent. Set(item Item) error - // Removes the item with matching key + // Remove removes the item with matching key Remove(key string) error - // Provides a slice of all keys stored on the keyring + // Keys provides a slice of all keys stored on the keyring Keys() ([]string, error) } diff --git a/repository/mock_repo.go b/repository/mock_repo.go index 2749bfbd..3d7f0e73 100644 --- a/repository/mock_repo.go +++ b/repository/mock_repo.go @@ -8,10 +8,10 @@ import ( "sync" "github.com/99designs/keyring" + "github.com/ProtonMail/go-crypto/openpgp" "github.com/blevesearch/bleve" "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/memfs" - "golang.org/x/crypto/openpgp" "github.com/MichaelMure/git-bug/util/lamport" ) diff --git a/repository/repo.go b/repository/repo.go index 80bb7ce7..1994f6dd 100644 --- a/repository/repo.go +++ b/repository/repo.go @@ -5,9 +5,9 @@ import ( "errors" "io" + "github.com/ProtonMail/go-crypto/openpgp" "github.com/blevesearch/bleve" "github.com/go-git/go-billy/v5" - "golang.org/x/crypto/openpgp" "github.com/MichaelMure/git-bug/util/lamport" ) @@ -129,7 +129,7 @@ type RepoData interface { // StoreCommit will store a Git commit with the given Git tree StoreCommit(treeHash Hash, parents ...Hash) (Hash, error) - // StoreCommit will store a Git commit with the given Git tree. If signKey is not nil, the commit + // StoreSignedCommit will store a Git commit with the given Git tree. If signKey is not nil, the commit // will be signed accordingly. StoreSignedCommit(treeHash Hash, signKey *openpgp.Entity, parents ...Hash) (Hash, error) diff --git a/repository/repo_testing.go b/repository/repo_testing.go index 1f80d898..0db585cd 100644 --- a/repository/repo_testing.go +++ b/repository/repo_testing.go @@ -5,8 +5,8 @@ import ( "math/rand" "testing" + "github.com/ProtonMail/go-crypto/openpgp" "github.com/stretchr/testify/require" - "golang.org/x/crypto/openpgp" "github.com/MichaelMure/git-bug/util/lamport" ) @@ -237,10 +237,10 @@ func RepoDataSignatureTest(t *testing.T, repo RepoData) { commit1, err := repo.ReadCommit(commitHash1) require.NoError(t, err) - _, err = openpgp.CheckDetachedSignature(keyring1, commit1.SignedData, commit1.Signature) + _, err = openpgp.CheckDetachedSignature(keyring1, commit1.SignedData, commit1.Signature, nil) require.NoError(t, err) - _, err = openpgp.CheckDetachedSignature(keyring2, commit1.SignedData, commit1.Signature) + _, err = openpgp.CheckDetachedSignature(keyring2, commit1.SignedData, commit1.Signature, nil) require.Error(t, err) commitHash2, err := repo.StoreSignedCommit(treeHash, pgpEntity1, commitHash1) @@ -249,10 +249,10 @@ func RepoDataSignatureTest(t *testing.T, repo RepoData) { commit2, err := repo.ReadCommit(commitHash2) require.NoError(t, err) - _, err = openpgp.CheckDetachedSignature(keyring1, commit2.SignedData, commit2.Signature) + _, err = openpgp.CheckDetachedSignature(keyring1, commit2.SignedData, commit2.Signature, nil) require.NoError(t, err) - _, err = openpgp.CheckDetachedSignature(keyring2, commit2.SignedData, commit2.Signature) + _, err = openpgp.CheckDetachedSignature(keyring2, commit2.SignedData, commit2.Signature, nil) require.Error(t, err) } -- cgit