mirror of
https://github.com/ncarlier/webhookd.git
synced 2024-09-20 08:55:28 +00:00
chore(): fix typo
This commit is contained in:
parent
5911b8f3c3
commit
072124865e
|
@ -24,7 +24,7 @@ func HTTPSignature(trustStore pubkey.TrustStore) Middleware {
|
||||||
w.Write([]byte("invalid HTTP signature: " + err.Error()))
|
w.Write([]byte("invalid HTTP signature: " + err.Error()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = verifier.Verify(entry.Pubkey, entry.Algorythm)
|
err = verifier.Verify(entry.Pubkey, entry.Algorithm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(400)
|
w.WriteHeader(400)
|
||||||
w.Write([]byte("invalid HTTP signature: " + err.Error()))
|
w.Write([]byte("invalid HTTP signature: " + err.Error()))
|
||||||
|
|
|
@ -48,7 +48,7 @@ func newPEMTrustStore(filename string) (*pemTrustStore, error) {
|
||||||
keyID = "default"
|
keyID = "default"
|
||||||
}
|
}
|
||||||
result.keys[keyID] = TrustStoreEntry{
|
result.keys[keyID] = TrustStoreEntry{
|
||||||
Algorythm: defaultAlgorithm,
|
Algorithm: defaultAlgorithm,
|
||||||
Pubkey: rsaPublicKey,
|
Pubkey: rsaPublicKey,
|
||||||
}
|
}
|
||||||
logger.Debug.Printf("public key \"%s\" loaded into the trustore", keyID)
|
logger.Debug.Printf("public key \"%s\" loaded into the trustore", keyID)
|
||||||
|
@ -60,7 +60,7 @@ func newPEMTrustStore(filename string) (*pemTrustStore, error) {
|
||||||
rsaPublicKey, _ := cert.PublicKey.(*rsa.PublicKey)
|
rsaPublicKey, _ := cert.PublicKey.(*rsa.PublicKey)
|
||||||
keyID := string(cert.Subject.CommonName)
|
keyID := string(cert.Subject.CommonName)
|
||||||
result.keys[keyID] = TrustStoreEntry{
|
result.keys[keyID] = TrustStoreEntry{
|
||||||
Algorythm: defaultAlgorithm,
|
Algorithm: defaultAlgorithm,
|
||||||
Pubkey: rsaPublicKey,
|
Pubkey: rsaPublicKey,
|
||||||
}
|
}
|
||||||
logger.Debug.Printf("certificate \"%s\" loaded into the trustore", keyID)
|
logger.Debug.Printf("certificate \"%s\" loaded into the trustore", keyID)
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestTrustStoreWithNoKeyID(t *testing.T) {
|
||||||
assert.True(t, entry == nil, "")
|
assert.True(t, entry == nil, "")
|
||||||
entry = ts.Get("default")
|
entry = ts.Get("default")
|
||||||
assert.NotNil(t, entry, "")
|
assert.NotNil(t, entry, "")
|
||||||
assert.Equal(t, httpsig.RSA_SHA256, entry.Algorythm, "")
|
assert.Equal(t, httpsig.RSA_SHA256, entry.Algorithm, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTrustStoreWithKeyID(t *testing.T) {
|
func TestTrustStoreWithKeyID(t *testing.T) {
|
||||||
|
@ -30,7 +30,7 @@ func TestTrustStoreWithKeyID(t *testing.T) {
|
||||||
assert.NotNil(t, ts, "")
|
assert.NotNil(t, ts, "")
|
||||||
entry := ts.Get("test")
|
entry := ts.Get("test")
|
||||||
assert.NotNil(t, entry, "")
|
assert.NotNil(t, entry, "")
|
||||||
assert.Equal(t, httpsig.RSA_SHA256, entry.Algorythm, "")
|
assert.Equal(t, httpsig.RSA_SHA256, entry.Algorithm, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTrustStoreWithCertificate(t *testing.T) {
|
func TestTrustStoreWithCertificate(t *testing.T) {
|
||||||
|
@ -41,7 +41,7 @@ func TestTrustStoreWithCertificate(t *testing.T) {
|
||||||
assert.NotNil(t, ts, "")
|
assert.NotNil(t, ts, "")
|
||||||
entry := ts.Get("test.localnet")
|
entry := ts.Get("test.localnet")
|
||||||
assert.NotNil(t, entry, "")
|
assert.NotNil(t, entry, "")
|
||||||
assert.Equal(t, httpsig.RSA_SHA256, entry.Algorythm, "")
|
assert.Equal(t, httpsig.RSA_SHA256, entry.Algorithm, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTrustStoreWithMultipleEntries(t *testing.T) {
|
func TestTrustStoreWithMultipleEntries(t *testing.T) {
|
||||||
|
@ -52,8 +52,8 @@ func TestTrustStoreWithMultipleEntries(t *testing.T) {
|
||||||
assert.NotNil(t, ts, "")
|
assert.NotNil(t, ts, "")
|
||||||
entry := ts.Get("test.localnet")
|
entry := ts.Get("test.localnet")
|
||||||
assert.NotNil(t, entry, "")
|
assert.NotNil(t, entry, "")
|
||||||
assert.Equal(t, httpsig.RSA_SHA256, entry.Algorythm, "")
|
assert.Equal(t, httpsig.RSA_SHA256, entry.Algorithm, "")
|
||||||
entry = ts.Get("foo")
|
entry = ts.Get("foo")
|
||||||
assert.NotNil(t, entry, "")
|
assert.NotNil(t, entry, "")
|
||||||
assert.Equal(t, httpsig.RSA_SHA256, entry.Algorythm, "")
|
assert.Equal(t, httpsig.RSA_SHA256, entry.Algorithm, "")
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ const defaultAlgorithm = httpsig.RSA_SHA256
|
||||||
// TrustStoreEntry is a trust store entry
|
// TrustStoreEntry is a trust store entry
|
||||||
type TrustStoreEntry struct {
|
type TrustStoreEntry struct {
|
||||||
Pubkey crypto.PublicKey
|
Pubkey crypto.PublicKey
|
||||||
Algorythm httpsig.Algorithm
|
Algorithm httpsig.Algorithm
|
||||||
}
|
}
|
||||||
|
|
||||||
// TrustStore is a generic interface to retrieve a public key
|
// TrustStore is a generic interface to retrieve a public key
|
||||||
|
|
Loading…
Reference in New Issue
Block a user