mirror of
https://github.com/gotify/server.git
synced 2026-09-06 07:50:35 +08:00
* feat: EdDSA token for database leakage/index mitigation * [skip ci]: remove token from api output * fix: e2e tests * fixup! fix: e2e tests * doc: document tokens are now optional fields for app and aclient * fixup(doc): swagger version again * address review comments * address review comments
20 lines
608 B
Go
20 lines
608 B
Go
package api
|
|
|
|
import (
|
|
"regexp"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestTokenGeneration(t *testing.T) {
|
|
clientPub, clientPriv := generateClientToken()
|
|
assert.Regexp(t, regexp.MustCompile(`^gtfyc\.(.+)$`), clientPub)
|
|
assert.Regexp(t, regexp.MustCompile(`^gtfyc\.(.+)$`), clientPriv)
|
|
applicationPub, applicationPriv := generateApplicationToken()
|
|
assert.Regexp(t, regexp.MustCompile(`^gtfya\.(.+)$`), applicationPub)
|
|
assert.Regexp(t, regexp.MustCompile(`^gtfya\.(.+)$`), applicationPriv)
|
|
imageName := generateImageName()
|
|
assert.Regexp(t, regexp.MustCompile(`^(.+)$`), imageName)
|
|
}
|