this repo has no description
0
fork

Configure Feed

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

YOU GOTTA ADD THE FILE WILL

+39
+39
auth.go
··· 1 + package main 2 + 3 + import ( 4 + "fmt" 5 + 6 + "github.com/bluesky-social/indigo/atproto/crypto" 7 + "github.com/golang-jwt/jwt/v5" 8 + ) 9 + 10 + // The contents of this file have been borrowed from here: https://github.com/orthanc/bluesky-go-feeds/blob/f719f113f1afc9080e50b4b1f5ca239aa3073c79/web/auth.go#L20-L46 11 + // It essentially allows the signing method that atproto uses for JWT to be used when verifying the JWT that they send in requests 12 + 13 + type AtProtoSigningMethod struct { 14 + alg string 15 + } 16 + 17 + func (m *AtProtoSigningMethod) Alg() string { 18 + return m.alg 19 + } 20 + 21 + func (m *AtProtoSigningMethod) Verify(signingString string, signature []byte, key interface{}) error { 22 + return key.(crypto.PublicKey).HashAndVerifyLenient([]byte(signingString), signature) 23 + } 24 + 25 + func (m *AtProtoSigningMethod) Sign(signingString string, key interface{}) ([]byte, error) { 26 + return nil, fmt.Errorf("unimplemented") 27 + } 28 + 29 + func init() { 30 + ES256K := AtProtoSigningMethod{alg: "ES256K"} 31 + jwt.RegisterSigningMethod(ES256K.Alg(), func() jwt.SigningMethod { 32 + return &ES256K 33 + }) 34 + 35 + ES256 := AtProtoSigningMethod{alg: "ES256"} 36 + jwt.RegisterSigningMethod(ES256.Alg(), func() jwt.SigningMethod { 37 + return &ES256 38 + }) 39 + }