Plan independent BFF and adapt selected Sendico foundations (#34)
This commit is contained in:
1 parent
1e191fca42
commit
45666d33fc
17 files changed
+854
-15
No files matched your search
@@ -0,0 +1,24 @@
|
||||
package credential
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestOpaqueCredential(t *testing.T) {
|
||||
raw, digest, err := New()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
decoded, err := base64.RawURLEncoding.DecodeString(raw)
|
||||
if err != nil || len(decoded) != 32 {
|
||||
t.Fatal("credential must contain 256 random bits")
|
||||
}
|
||||
if raw == digest || !Matches(raw, digest) || Matches("other", digest) || Matches("", Digest("")) {
|
||||
t.Fatal("invalid digest matching behavior")
|
||||
}
|
||||
other, _, err := New()
|
||||
if err != nil || other == raw {
|
||||
t.Fatal("credentials must be independently generated")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user