pomerium/pkg/webauthnutil/enrollment_token_test.go
Caleb Doxsey 1c445c426d
webauthnutil: add helpers for webauthn (#2686)
* devices: add device protobuf types

* webauthnutil: add helpers for webauthn
2021-10-19 13:39:01 -06:00

18 lines
439 B
Go

package webauthnutil
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestEnrollmentToken(t *testing.T) {
key := []byte{1, 2, 3}
deviceEnrollmentID := "19be0131-184e-4873-acab-2be79321c30b"
token, err := NewEnrollmentToken(key, time.Second*30, deviceEnrollmentID)
assert.NoError(t, err)
id, err := ParseAndVerifyEnrollmentToken(key, token)
assert.NoError(t, err)
assert.Equal(t, deviceEnrollmentID, id)
}