Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
229
jwt_test.go949 B
package jwt import ( "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/Southclaws/storyden/internal/config" "github.com/Southclaws/storyden/internal/infrastructure/endec" ) func TestEncryptDecrypt(t *testing.T) { a := assert.New(t) r := require.New(t) claims := endec.Claims{ "sub": "test-subject", "exp": float64(time.Now().Add(1 * time.Hour).Unix()), } ed, err := New(config.Config{ JWTSecret: []byte("07d422e512b23a056ccc953994d1593f"), }) r.NoError(err) t.Run("encrypt and decrypt payload", func(t *testing.T) { token, err := ed.Encrypt(claims, time.Hour) a.NoError(err) gotClaims, err := ed.Decrypt(token) a.NoError(err) a.Equal(claims["sub"], gotClaims["sub"]) a.Equal(claims["exp"], gotClaims["exp"]) }) t.Run("invalid_secret", func(t *testing.T) { ed, err := New(config.Config{ JWTSecret: []byte{}, }) r.NoError(err) r.Nil(ed) }) }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server