snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
test / Lint (push) Failing after 3s
test / Test with Go 1.26.8 (push) Failing after 2s

This commit is contained in:
upstream-mirror
2026-09-16 01:17:21 +05:00
commit b352a9a30d
472 changed files with 108375 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
package jwtverify
import (
"encoding/json"
"github.com/centrifugal/centrifuge"
)
type Verifier interface {
VerifyConnectToken(token string, skipVerify bool) (ConnectToken, error)
VerifySubscribeToken(token string, skipVerify bool) (SubscribeToken, error)
}
type ConnectToken struct {
// UserID tells an ID of connecting user.
UserID string
// ExpireAt allows setting time in future when connection must be validated.
// Validation can be server-side using On().Refresh callback or client-side
// if On().Refresh not set.
ExpireAt int64
// Info contains additional information about connection. It will be
// included into Join/Leave messages, into Alive information, also
// info becomes a part of published message if it was published from
// client directly. In some cases having additional info can be an
// overhead – but you are simply free to not use it.
Info []byte
// Meta is custom data to append to a connection. Can be retrieved later
// for connection inspection. Never sent in a client protocol and accessible
// from a backend-side only.
Meta json.RawMessage
// Subs is a map of channels to subscribe server-side with options.
Subs map[string]centrifuge.SubscribeOptions
}
type SubscribeToken struct {
// UserID tells an ID of subscribing user.
UserID string
// Channel client wants to subscribe. Will be compared with channel in
// subscribe command.
Channel string
// Client is a deprecated claim for compatibility with Centrifugo v3.
Client string
// Options for subscription.
Options centrifuge.SubscribeOptions
}