Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Nathaniel Caza <mastercactapus@gmail.com>
  • Loading branch information
EvanMerlock and mastercactapus committed Dec 26, 2024
1 parent a91ca7c commit df40697
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/initstores.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (app *App) initStores(ctx context.Context) error {

if app.WebhookKeyring == nil {
app.WebhookKeyring, err = keyring.NewDB(ctx, app.cfg.LegacyLogger, app.db, &keyring.Config{
Name: "webhook-keys",
Name: "webhook-signature-keys",
MaxOldKeys: 100,
Keys: app.cfg.EncryptionKeys,
})
Expand Down
7 changes: 3 additions & 4 deletions test/smoke/webhook_signing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package smoke

import (
"encoding/base64"
"github.com/stretchr/testify/require"
"io"
"net/http"
"net/http/httptest"
Expand All @@ -16,7 +17,7 @@ type WebhookTestingSign struct {
Signature string
}

func TestWebhookCorrectlySigns(t *testing.T) {
func TestWebhookSigning(t *testing.T) {
t.Parallel()

ch := make(chan WebhookTestingSign, 1)
Expand Down Expand Up @@ -73,9 +74,7 @@ func TestWebhookCorrectlySigns(t *testing.T) {

// convert alert.Signature from base64 to byte slice
signatureBytes, err := base64.StdEncoding.DecodeString(alert.Signature)
if !assert.NoError(t, err) {
return
}
require.NoError(t, err)

valid, _ := h.App().WebhookKeyring.Verify(alert.Body, signatureBytes)

Expand Down

0 comments on commit df40697

Please sign in to comment.