-20
pds/auth.go
-20
pds/auth.go
···
47
47
Did: did,
48
48
}, nil
49
49
}
50
-
51
-
func (s *Server) createCrossServerAuthToken(ctx context.Context, otherpds string) (*xrpc.AuthInfo, error) {
52
-
accessTok := makeToken(otherpds, "com.atproto.federation", time.Now().Add(24*time.Hour))
53
-
54
-
// setting this is a little weird,
55
-
// since the token isn't signed by this key, we dont have a way to validate...
56
-
accessTok.Set("pds", s.signingKey.Public().DID())
57
-
58
-
rval := make([]byte, 10)
59
-
rand.Read(rval)
60
-
61
-
accSig, err := jwt.Sign(accessTok, jwt.WithKey(jwa.HS256, s.jwtSigningKey))
62
-
if err != nil {
63
-
return nil, err
64
-
}
65
-
66
-
return &xrpc.AuthInfo{
67
-
AccessJwt: string(accSig),
68
-
}, nil
69
-
}