Skip to content

Commit

Permalink
Make getPublicKeyHash an unexported function
Browse files Browse the repository at this point in the history
Signed-off-by: Jang <[email protected]>
  • Loading branch information
hojoungjang committed Aug 22, 2024
1 parent 97d9e08 commit 5261d5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/util/checkpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func TestSigningRoundtripCheckpoint(t *testing.T) {

func TestInvalidSigVerification(t *testing.T) {
ecdsaKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
pubKeyHash, _ := GetPublicKeyHash(ecdsaKey.Public())
pubKeyHash, _ := getPublicKeyHash(ecdsaKey.Public())

for _, test := range []struct {
checkpoint Checkpoint
Expand Down
6 changes: 3 additions & 3 deletions pkg/util/signed_note.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (s *SignedNote) Sign(identity string, signer signature.Signer, opts signatu
if err != nil {
return nil, fmt.Errorf("retrieving public key: %w", err)
}
pkHash, err := GetPublicKeyHash(pk)
pkHash, err := getPublicKeyHash(pk)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -83,7 +83,7 @@ func (s SignedNote) Verify(verifier signature.Verifier) bool {
if err != nil {
return false
}
verifierPkHash, err := GetPublicKeyHash(pk)
verifierPkHash, err := getPublicKeyHash(pk)
if err != nil {
return false
}
Expand Down Expand Up @@ -200,7 +200,7 @@ func SignedNoteValidator(strToValidate string) bool {
return s.UnmarshalText([]byte(strToValidate)) == nil
}

func GetPublicKeyHash(publicKey crypto.PublicKey) (uint32, error) {
func getPublicKeyHash(publicKey crypto.PublicKey) (uint32, error) {
pubKeyBytes, err := x509.MarshalPKIXPublicKey(publicKey)
if err != nil {
return 0, fmt.Errorf("marshalling public key: %w", err)
Expand Down

0 comments on commit 5261d5f

Please sign in to comment.