MCPcopy
hub / github.com/wavetermdev/waveterm / MakeClientJWTToken

Function MakeClientJWTToken

pkg/wshutil/wshutil.go:219–237  ·  view source on GitHub ↗
(rpcCtx wshrpc.RpcContext)

Source from the content-addressed store, hash-verified

217}
218
219func MakeClientJWTToken(rpcCtx wshrpc.RpcContext) (string, error) {
220 if wavebase.IsDevMode() {
221 if rpcCtx.IsRouter && (rpcCtx.RouteId != "" || rpcCtx.ProcRoute) {
222 panic("Invalid RpcCtx, router w/ routeid")
223 }
224 if !rpcCtx.IsRouter && (rpcCtx.RouteId == "" && !rpcCtx.ProcRoute) {
225 panic("Invalid RpcCtx, no routeid")
226 }
227 }
228 claims := &wavejwt.WaveJwtClaims{
229 Sock: rpcCtx.SockName,
230 RouteId: rpcCtx.RouteId,
231 ProcRoute: rpcCtx.ProcRoute,
232 BlockId: rpcCtx.BlockId,
233 Conn: rpcCtx.Conn,
234 Router: rpcCtx.IsRouter,
235 }
236 return wavejwt.Sign(claims)
237}
238
239func claimsToRpcCtx(claims *wavejwt.WaveJwtClaims) *wshrpc.RpcContext {
240 return &wshrpc.RpcContext{

Callers 3

StartConnServerMethod · 0.92
startNewJobMethod · 0.92

Calls 2

IsDevModeFunction · 0.92
SignFunction · 0.92

Tested by

no test coverage detected