diff --git a/internal/session/ids.go b/internal/session/ids.go index 5142503650..6f0fc76b86 100644 --- a/internal/session/ids.go +++ b/internal/session/ids.go @@ -15,6 +15,9 @@ const ( // ConnectionPrefix for connection PK ids ConnectionPrefix = "sc" + + // ConnectionStatePrefix for connection state PK ids + ConnectionStatePrefix = "scs" ) func newId() (string, error) { @@ -40,3 +43,11 @@ func newConnectionId() (string, error) { } return id, nil } + +func newConnectionStateId() (string, error) { + id, err := db.NewPublicId(ConnectionStatePrefix) + if err != nil { + return "", fmt.Errorf("new session connection state id: %w", err) + } + return id, nil +} diff --git a/internal/session/ids_test.go b/internal/session/ids_test.go index 4c83f2847f..0c49fc3129 100644 --- a/internal/session/ids_test.go +++ b/internal/session/ids_test.go @@ -25,4 +25,9 @@ func Test_Ids(t *testing.T) { require.NoError(t, err) assert.True(t, strings.HasPrefix(id, ConnectionPrefix+"_")) }) + t.Run("scs", func(t *testing.T) { + id, err := newConnectionStateId() + require.NoError(t, err) + assert.True(t, strings.HasPrefix(id, ConnectionStatePrefix+"_")) + }) }