diff --git a/internal/oidc/authcode/authcode_test.go b/internal/db/dbrepo/authcodeinforepo/state/stateinfo_test.go
similarity index 81%
rename from internal/oidc/authcode/authcode_test.go
rename to internal/db/dbrepo/authcodeinforepo/state/stateinfo_test.go
index c5f3ab1e98fd8f7715d43c2c8920909364ea1c2a..8bba52fd69eef8dce2ec69002bdbdc5826f48781 100644
--- a/internal/oidc/authcode/authcode_test.go
+++ b/internal/db/dbrepo/authcodeinforepo/state/stateinfo_test.go
@@ -1,4 +1,4 @@
-package authcode
+package state
 
 import (
 	"testing"
@@ -7,7 +7,7 @@ import (
 )
 
 func TestParseState(t *testing.T) {
-	stateInfos := []stateInfo{
+	stateInfos := []Info{
 		{Native: false},
 		{Native: true},
 		{Native: false, ResponseType: model.ResponseTypeToken},
@@ -18,10 +18,10 @@ func TestParseState(t *testing.T) {
 		{Native: true, ResponseType: model.ResponseTypeTransferCode},
 	}
 	for _, stateInfo := range stateInfos {
-		state := createState(stateInfo)
-		parsed := parseState(state)
+		s, _ := CreateState(stateInfo)
+		parsed := s.Parse()
 		if stateInfo != parsed {
-			t.Errorf("%+v was not correctly converted, instead got %+v from state '%s'", stateInfo, parsed, state)
+			t.Errorf("%+v was not correctly converted, instead got %+v from state '%+v'", stateInfo, parsed, s)
 		}
 	}
 }
diff --git a/internal/db/dbrepo/supertokenrepo/supertoken_test.go b/internal/db/dbrepo/supertokenrepo/supertoken_test.go
index b40775372b3d1fa917513e34d5648f104dff6056..9e8e896d88f4d6f1f664dc1bce77b5006b1335d9 100644
--- a/internal/db/dbrepo/supertokenrepo/supertoken_test.go
+++ b/internal/db/dbrepo/supertokenrepo/supertoken_test.go
@@ -1,6 +1,10 @@
 package supertokenrepo
 
-import "testing"
+import (
+	"testing"
+
+	"github.com/oidc-mytoken/server/shared/supertoken/pkg/stid"
+)
 
 func testRoot(t *testing.T, a SuperTokenEntry, expected bool) {
 	root := a.Root()
@@ -18,10 +22,13 @@ func TestSuperTokenEntry_RootEmpty(t *testing.T) {
 	testRoot(t, a, true)
 }
 func TestSuperTokenEntry_RootHasParentAsRoot(t *testing.T) {
-	a := SuperTokenEntry{ParentID: "id", RootID: "id"}
+	id := stid.New()
+	a := SuperTokenEntry{ParentID: id, RootID: id}
 	testRoot(t, a, false)
 }
 func TestSuperTokenEntry_RootHasRoot(t *testing.T) {
-	a := SuperTokenEntry{ParentID: "parentid", RootID: "rootid"}
+	pid := stid.New()
+	rid := stid.New()
+	a := SuperTokenEntry{ParentID: pid, RootID: rid}
 	testRoot(t, a, false)
 }
diff --git a/shared/supertoken/capabilities/capability_test.go b/shared/supertoken/capabilities/capability_test.go
index 6ddfcfcafceb55c3bb840734620a1f7e5042fef7..e9720a0e46625b94a0b0fca21bf60171a815a39a 100644
--- a/shared/supertoken/capabilities/capability_test.go
+++ b/shared/supertoken/capabilities/capability_test.go
@@ -26,33 +26,33 @@ func TestTightenAllEmpty(t *testing.T) {
 }
 func TestTightenOneEmpty(t *testing.T) {
 	a := Capabilities{}
-	b := Capabilities{"not", "empty"}
+	b := NewCapabilities([]string{"not", "empty"})
 	expected := Capabilities{}
 	testTighten(t, a, b, expected)
 	testTighten(t, b, a, expected)
 }
 func TestTightenNoIntersection(t *testing.T) {
-	a := Capabilities{"some", "values"}
-	b := Capabilities{"completly", "different"}
+	a := NewCapabilities([]string{"some", "values"})
+	b := NewCapabilities([]string{"completly", "different"})
 	expected := Capabilities{}
 	testTighten(t, a, b, expected)
 	testTighten(t, b, a, expected)
 }
 func TestTightenSame(t *testing.T) {
-	a := Capabilities{"some", "values"}
+	a := NewCapabilities([]string{"some", "values"})
 	testTighten(t, a, a, a)
 }
 func TestTightenSomeIntersection(t *testing.T) {
-	a := Capabilities{"some", "values"}
-	b := Capabilities{"some", "different"}
-	expected := Capabilities{"some"}
+	a := NewCapabilities([]string{"some", "values"})
+	b := NewCapabilities([]string{"some", "different"})
+	expected := NewCapabilities([]string{"some"})
 	testTighten(t, a, b, expected)
 	testTighten(t, b, a, expected)
 }
 func TestTightenSubSet(t *testing.T) {
-	a := Capabilities{"some", "values"}
-	b := Capabilities{"some", "more", "values"}
-	expected := Capabilities{"some", "values"}
+	a := NewCapabilities([]string{"some", "values"})
+	b := NewCapabilities([]string{"some", "more", "values"})
+	expected := NewCapabilities([]string{"some", "values"})
 	testTighten(t, a, b, expected)
 	testTighten(t, b, a, expected)
 }
diff --git a/shared/supertoken/pkg/supertoken_test.go b/shared/supertoken/pkg/supertoken_test.go
index 89433378289e3122eeb1f84bea44b0d3b5a853a5..c8acb296c05f1fdd578255905cb5fd7728ada155 100644
--- a/shared/supertoken/pkg/supertoken_test.go
+++ b/shared/supertoken/pkg/supertoken_test.go
@@ -3,29 +3,8 @@ package supertoken
 import (
 	"testing"
 	"time"
-
-	"github.com/oidc-mytoken/server/internal/config"
-	"github.com/oidc-mytoken/server/internal/jws"
-	"github.com/oidc-mytoken/server/shared/supertoken/capabilities"
 )
 
-func TestSuperTokenJWTUnique(t *testing.T) {
-	config.Load()
-	jws.LoadKey()
-	st := NewSuperToken("sub", "iss", nil, capabilities.AllCapabilities, nil)
-	jwt1, err := st.ToJWT()
-	if err != nil {
-		t.Error(err)
-	}
-	jwt2, err := st.ToJWT()
-	if err != nil {
-		t.Error(err)
-	}
-	if jwt1 == jwt2 {
-		t.Errorf("JWTs not unique: '%s'", jwt1)
-	}
-}
-
 func TestSuperToken_ExpiresIn_Unset(t *testing.T) {
 	st := SuperToken{}
 	expIn := st.ExpiresIn()