this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove service auth skeleton code (will go in auth package)

-37
-37
atproto/client/service_auth.go
··· 1 - package client 2 - 3 - import ( 4 - "net/http" 5 - "time" 6 - 7 - "github.com/bluesky-social/indigo/atproto/crypto" 8 - "github.com/bluesky-social/indigo/atproto/syntax" 9 - ) 10 - 11 - // used for inter-service requests, using JWTs 12 - type ServiceAuth struct { 13 - // account DID 14 - Issuer syntax.DID 15 - // optionally, service context 16 - IssuerFrag string 17 - Duration time.Duration 18 - SigningKey *crypto.PrivateKey 19 - } 20 - 21 - func NewServiceAuth(issuer syntax.DID, frag string, key *crypto.PrivateKey) ServiceAuth { 22 - return ServiceAuth{ 23 - Issuer: issuer, 24 - IssuerFrag: frag, 25 - Duration: time.Second * 30, 26 - SigningKey: key, 27 - } 28 - } 29 - 30 - func (a *ServiceAuth) DoWithAuth(req *http.Request, c *http.Client) (*http.Response, error) { 31 - // TODO: detect audience from request headers (atproto-proxy) 32 - // TODO: extract endpoint (LXM) from request 33 - 34 - thing := "" 35 - req.Header.Set("Authorization", "Bearer "+thing) 36 - return c.Do(req) 37 - }