From 8168e37e0c526b3033f4087194fbdd80faebaef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81d=C3=A1m=20Zsoldi?= <156650378+zsadm@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:41:00 +0200 Subject: [PATCH] Add new function to create a server token --- client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client.go b/client.go index d965685..7a5097f 100644 --- a/client.go +++ b/client.go @@ -151,6 +151,11 @@ func (c *Client) CreateToken(userID string, expire time.Time, issuedAt ...time.T return c.createToken(claims) } +// CreateServerToken creates a new server token +func (c *Client) CreateServerToken() (string, error) { + return c.createToken(jwt.MapClaims{"server": true}) +} + func (c *Client) createToken(claims jwt.Claims) (string, error) { return jwt.NewWithClaims(jwt.SigningMethodHS256, claims).SignedString(c.apiSecret) }