Commit 3368c867 authored by zauberstuhl's avatar zauberstuhl
Browse files

Test StdEncoding as fallback for URLEncoding

parent 4d1feabc
...@@ -19,6 +19,7 @@ package federation ...@@ -19,6 +19,7 @@ package federation
import ( import (
"testing" "testing"
"encoding/base64"
) )
func TestSignatureInterface(t *testing.T) { func TestSignatureInterface(t *testing.T) {
...@@ -49,4 +50,15 @@ func TestSignatureInterface(t *testing.T) { ...@@ -49,4 +50,15 @@ func TestSignatureInterface(t *testing.T) {
"author created_at guid parent_guid text", &priv.PublicKey) { "author created_at guid parent_guid text", &priv.PublicKey) {
t.Errorf("Expected to be a valid signature, got invalid") t.Errorf("Expected to be a valid signature, got invalid")
} }
sigBytes, err := base64.URLEncoding.DecodeString(sig)
if err != nil {
t.Errorf("Some error occured while parsing: %v", err)
}
sig = base64.StdEncoding.EncodeToString(sigBytes)
if !signature.New(EntityComment{AuthorSignature: sig}).Verify(
"author created_at guid parent_guid text", &priv.PublicKey) {
t.Errorf("Expected to be a valid signature, got invalid")
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment