carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package relay
2
3import (
4 "crypto/sha256"
5 "encoding/base64"
6 "testing"
7)
8
9func TestVector(t *testing.T) {
10 m := sha256.Sum256([]byte("carlos-relay-test-master"))
11 key := DeriveKey(m[:], "abc", "meet", "0123456789abcdef")
12 if got := base64.StdEncoding.EncodeToString(key); got != "uMhwW4P/9O5dQUIs91t2CCHGhwJbeiM0xQMQ2G0CJLU=" {
13 t.Fatalf("key = %s", got)
14 }
15 u := "1900000000:" + Suffix("abc", "meet", "0123456789abcdef", "k1")
16 if u != "1900000000:abc:meet:0123456789abcdef:k1" {
17 t.Fatalf("username = %s", u)
18 }
19 if got := Credential(key, u); got != "jRU479Y3GO45nrRHqxBf3BMeBHE6Fip1cwAccNv28MQ=" {
20 t.Fatalf("credential = %s", got)
21 }
22}
23