+4
-4
README.md
+4
-4
README.md
···
1
1
# Atproto OAuth Golang
2
2
3
-
> [!WARNING]
3
+
> [!WARNING]
4
4
> This is an experimental repo. It may contain bugs. Use at your own risk.
5
5
6
6
> [!WARNING]
7
7
> You should always validate user input. The example/test code inside this repo may be used as an implementation guide, but no guarantees are made.
8
8
9
9
```bash
10
-
go get github.com/haileyok/atproto-oauth-golang
10
+
go get tangled.sh/icyphox.sh/atproto-oauth
11
11
```
12
12
13
13
## Prerequisites
···
18
18
19
19
`make jwks`
20
20
21
-
You will need to read the JWK from your application and parse it using `oauth.ParseJWKFromBytes`.
21
+
You will need to read the JWK from your application and parse it using `oauth.ParseJWKFromBytes`.
22
22
23
23
### Serve `client-metadata.json` from your application
24
24
···
144
144
145
145
#### Create a private DPoP JWK for the user
146
146
147
-
You'll need to create a private DPoP JWK for the user before directing them to their PDS to authenticate. You'll need to store this in a later step, and you will need to pass it along inside the PAR request, so go ahead and marshal it as well.
147
+
You'll need to create a private DPoP JWK for the user before directing them to their PDS to authenticate. You'll need to store this in a later step, and you will need to pass it along inside the PAR request, so go ahead and marshal it as well.
148
148
149
149
```go
150
150
k, err := helpers.GenerateKey(nil)
+1
-1
cmd/helper/main.go
+1
-1
cmd/helper/main.go
+1
-1
cmd/web_server_demo/handle_auth.go
+1
-1
cmd/web_server_demo/handle_auth.go
···
9
9
10
10
"github.com/bluesky-social/indigo/atproto/syntax"
11
11
"github.com/gorilla/sessions"
12
-
oauth_helpers "github.com/haileyok/atproto-oauth-golang/helpers"
13
12
"github.com/labstack/echo-contrib/session"
14
13
"github.com/labstack/echo/v4"
15
14
"gorm.io/gorm/clause"
15
+
oauth_helpers "tangled.sh/icyphox.sh/atproto-oauth/helpers"
16
16
)
17
17
18
18
func (s *TestServer) handleLoginSubmit(e echo.Context) error {
+2
-2
cmd/web_server_demo/main.go
+2
-2
cmd/web_server_demo/main.go
···
10
10
"os"
11
11
12
12
"github.com/gorilla/sessions"
13
-
oauth "github.com/haileyok/atproto-oauth-golang"
14
-
oauth_helpers "github.com/haileyok/atproto-oauth-golang/helpers"
15
13
_ "github.com/joho/godotenv/autoload"
16
14
"github.com/labstack/echo-contrib/session"
17
15
"github.com/labstack/echo/v4"
···
19
17
"github.com/urfave/cli/v2"
20
18
"gorm.io/driver/sqlite"
21
19
"gorm.io/gorm"
20
+
oauth "tangled.sh/icyphox.sh/atproto-oauth"
21
+
oauth_helpers "tangled.sh/icyphox.sh/atproto-oauth/helpers"
22
22
)
23
23
24
24
var (
+2
-2
cmd/web_server_demo/user.go
+2
-2
cmd/web_server_demo/user.go
···
5
5
"fmt"
6
6
"time"
7
7
8
-
oauth "github.com/haileyok/atproto-oauth-golang"
9
-
oauth_helpers "github.com/haileyok/atproto-oauth-golang/helpers"
10
8
"github.com/labstack/echo-contrib/session"
11
9
"github.com/labstack/echo/v4"
10
+
oauth "tangled.sh/icyphox.sh/atproto-oauth"
11
+
oauth_helpers "tangled.sh/icyphox.sh/atproto-oauth/helpers"
12
12
)
13
13
14
14
func (s *TestServer) getOauthSession(ctx context.Context, did string) (*OauthSession, error) {
+1
-1
go.mod
+1
-1
go.mod
+2
-2
oauth.go
+2
-2
oauth.go
···
13
13
14
14
"github.com/golang-jwt/jwt/v5"
15
15
"github.com/google/uuid"
16
-
"github.com/haileyok/atproto-oauth-golang/helpers"
17
-
internal_helpers "github.com/haileyok/atproto-oauth-golang/internal/helpers"
18
16
"github.com/lestrrat-go/jwx/v2/jwk"
17
+
"tangled.sh/icyphox.sh/atproto-oauth/helpers"
18
+
internal_helpers "tangled.sh/icyphox.sh/atproto-oauth/internal/helpers"
19
19
)
20
20
21
21
type Client struct {
+1
-1
oauth_test.go
+1
-1
oauth_test.go
+1
-1
xrpc.go
+1
-1
xrpc.go
···
16
16
"github.com/carlmjohnson/versioninfo"
17
17
"github.com/golang-jwt/jwt/v5"
18
18
"github.com/google/uuid"
19
-
"github.com/haileyok/atproto-oauth-golang/internal/helpers"
20
19
"github.com/lestrrat-go/jwx/v2/jwk"
20
+
"tangled.sh/icyphox.sh/atproto-oauth/internal/helpers"
21
21
)
22
22
23
23
// This xrpc client is copied from the indigo xrpc client, with some tweaks: