Skip to content

Commit 702b353

Browse files
committed
chore: release prep
1 parent 466904e commit 702b353

23 files changed

Lines changed: 177 additions & 279 deletions

File tree

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A comprehensive Go SDK for integrating Rownd authentication, user management, an
55
## Installation
66

77
```bash
8-
go get github.com/rgthelen/rownd-go-sdk/pkg/rownd
8+
go get github.com/rownd/client-go/pkg/rownd
99
```
1010

1111
## Features
@@ -25,7 +25,7 @@ package main
2525
import (
2626
"context"
2727
"log"
28-
"github.com/rgthelen/rownd-go-sdk/pkg/rownd"
28+
"github.com/rownd/client-go/pkg/rownd"
2929
)
3030

3131
func main() {
@@ -236,7 +236,7 @@ log.Printf("Auth Level: %s", token.Claims.AuthLevel)
236236

237237
### HTTP Middleware
238238
```go
239-
import "github.com/rgthelen/rownd-go-sdk/pkg/rownd/middleware"
239+
import "github.com/rownd/client-go/pkg/rownd/middleware"
240240

241241
// Create middleware handler
242242
handler, err := rowndmiddleware.NewHandler(client,
@@ -600,7 +600,6 @@ if err != nil {
600600
client, err := rownd.NewClient(
601601
rownd.WithAppKey("key"),
602602
rownd.WithAppSecret("secret"),
603-
rownd.WithAppID("app_id"),
604603
rownd.WithBaseURL("https://api.rownd.io"),
605604
rownd.WithWKCCacheDuration(time.Hour),
606605
rownd.WithJWKsCacheDuration(time.Hour),
@@ -676,7 +675,7 @@ package main
676675

677676
import (
678677
"github.com/joho/godotenv"
679-
"github.com/rgthelen/rownd-go-sdk/pkg/rownd"
678+
"github.com/rownd/client-go/pkg/rownd"
680679
"log"
681680
"os"
682681
)
@@ -726,6 +725,3 @@ func loadEnv() {
726725
}
727726
}
728727
```
729-
730-
731-

cmd/client/main.go

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
11
package main
22

33
import (
4-
"context"
5-
"flag"
6-
"fmt"
7-
"log"
8-
"os"
9-
"time"
10-
11-
"github.com/rgthelen/rownd-go-sdk/pkg/rownd"
4+
"context"
5+
"flag"
6+
"fmt"
7+
"log"
8+
"os"
9+
"time"
10+
11+
"github.com/rownd/client-go/pkg/rownd"
1212
)
1313

1414
func main() {
15-
// Parse command line flags
16-
var (
17-
appKey = flag.String("app-key", os.Getenv("ROWND_APP_KEY"), "Rownd app key")
18-
appSecret = flag.String("app-secret", os.Getenv("ROWND_APP_SECRET"), "Rownd app secret")
19-
token = flag.String("token", "", "Rownd authentication token")
20-
)
21-
flag.Parse()
15+
// Parse command line flags
16+
var (
17+
appKey = flag.String("app-key", os.Getenv("ROWND_APP_KEY"), "Rownd app key")
18+
appSecret = flag.String("app-secret", os.Getenv("ROWND_APP_SECRET"), "Rownd app secret")
19+
token = flag.String("token", "", "Rownd authentication token")
20+
)
21+
flag.Parse()
2222

23-
// Validate required flags
24-
if *appKey == "" || *appSecret == "" {
25-
log.Fatal("app-key and app-secret are required")
26-
}
27-
if *token == "" {
28-
log.Fatal("token is required")
29-
}
23+
// Validate required flags
24+
if *appKey == "" || *appSecret == "" {
25+
log.Fatal("app-key and app-secret are required")
26+
}
27+
if *token == "" {
28+
log.Fatal("token is required")
29+
}
3030

31-
// Create client with timeout context
32-
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
33-
defer cancel()
31+
// Create client with timeout context
32+
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
33+
defer cancel()
3434

35-
client, err := rownd.NewClient(
36-
rownd.WithAppKey(*appKey),
37-
rownd.WithAppSecret(*appSecret),
38-
)
39-
if err != nil {
40-
log.Fatalf("Failed to create client: %v", err)
41-
}
35+
client, err := rownd.NewClient(
36+
rownd.WithAppKey(*appKey),
37+
rownd.WithAppSecret(*appSecret),
38+
)
39+
if err != nil {
40+
log.Fatalf("Failed to create client: %v", err)
41+
}
4242

43-
// Run the validation
44-
if err := run(ctx, client, *token); err != nil {
45-
log.Fatal(err)
46-
}
43+
// Run the validation
44+
if err := run(ctx, client, *token); err != nil {
45+
log.Fatal(err)
46+
}
4747
}
4848

4949
func run(ctx context.Context, client *rownd.Client, token string) error {
50-
// Validate token
51-
tokenInfo, err := client.Tokens.Validate(ctx, token)
52-
if err != nil {
53-
return fmt.Errorf("validate token: %w", err)
54-
}
50+
// Validate token
51+
tokenInfo, err := client.Tokens.Validate(ctx, token)
52+
if err != nil {
53+
return fmt.Errorf("validate token: %w", err)
54+
}
5555

56-
// Get user profile
57-
user, err := client.Users.Get(ctx, rownd.GetUserRequest{
58-
UserID: tokenInfo.UserID,
59-
})
60-
if err != nil {
61-
return fmt.Errorf("get user: %w", err)
62-
}
56+
// Get user profile
57+
user, err := client.Users.Get(ctx, rownd.GetUserRequest{
58+
UserID: tokenInfo.UserID,
59+
})
60+
if err != nil {
61+
return fmt.Errorf("get user: %w", err)
62+
}
6363

64-
fmt.Printf("User profile: %+v\n", user)
65-
return nil
66-
}
64+
fmt.Printf("User profile: %+v\n", user)
65+
return nil
66+
}

cmd/server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"syscall"
1111
"time"
1212

13-
"github.com/rgthelen/rownd-go-sdk/pkg/rownd"
13+
"github.com/rownd/client-go/pkg/rownd"
1414
)
1515

1616
func main() {

examples/rownd-test/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
module github.com/rgthelen/rownd-go-sdk/pkg/rownd
1+
module github.com/rownd/client-go/pkg/rownd
22

33
go 1.21
44

55
require (
66
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
77
github.com/joho/godotenv v1.5.1 // indirect
88
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
9-
github.com/rgthelen/rownd-go-sdk v0.0.5 // indirect
9+
github.com/rownd/client-go v0.0.5 // indirect
1010
)

examples/rownd-test/go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaR
88
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
99
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1010
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
11-
github.com/rgthelen/rownd-go-sdk v0.0.2 h1:56RJQy/1OuSvOKun/XpVn0Ai80SbpuS8Qw2rEfqxxlQ=
12-
github.com/rgthelen/rownd-go-sdk v0.0.2/go.mod h1:x1xyX74KizO3PjBpg4R491wikKCDn23bIkjU0xRL3mE=
13-
github.com/rgthelen/rownd-go-sdk v0.0.4 h1:LiJo19IoTRFb1qonwih9gDqPUDRCiTg04HCIKaO362c=
14-
github.com/rgthelen/rownd-go-sdk v0.0.4/go.mod h1:x1xyX74KizO3PjBpg4R491wikKCDn23bIkjU0xRL3mE=
15-
github.com/rgthelen/rownd-go-sdk v0.0.5 h1:AXLAMWVMVwl6pliFTq8DM/QNk5HXP0a1gsDKjkyvjrA=
16-
github.com/rgthelen/rownd-go-sdk v0.0.5/go.mod h1:x1xyX74KizO3PjBpg4R491wikKCDn23bIkjU0xRL3mE=
17-
github.com/rgthelen/rownd-go-sdk v0.1.9-0.20241121010920-1201c0ce4c7c h1:6hdnCK9YKYI8DipjbvkXNpm0IAAc6lQkkU3UOrCXsb8=
18-
github.com/rgthelen/rownd-go-sdk v0.1.9-0.20241121010920-1201c0ce4c7c/go.mod h1:9G67dpXdCDxM3noGWeg4GasCfpe8MbqbU54eSYV6vqs=
11+
github.com/rownd/client-go v0.0.2 h1:56RJQy/1OuSvOKun/XpVn0Ai80SbpuS8Qw2rEfqxxlQ=
12+
github.com/rownd/client-go v0.0.2/go.mod h1:x1xyX74KizO3PjBpg4R491wikKCDn23bIkjU0xRL3mE=
13+
github.com/rownd/client-go v0.0.4 h1:LiJo19IoTRFb1qonwih9gDqPUDRCiTg04HCIKaO362c=
14+
github.com/rownd/client-go v0.0.4/go.mod h1:x1xyX74KizO3PjBpg4R491wikKCDn23bIkjU0xRL3mE=
15+
github.com/rownd/client-go v0.0.5 h1:AXLAMWVMVwl6pliFTq8DM/QNk5HXP0a1gsDKjkyvjrA=
16+
github.com/rownd/client-go v0.0.5/go.mod h1:x1xyX74KizO3PjBpg4R491wikKCDn23bIkjU0xRL3mE=
17+
github.com/rownd/client-go v0.1.9-0.20241121010920-1201c0ce4c7c h1:6hdnCK9YKYI8DipjbvkXNpm0IAAc6lQkkU3UOrCXsb8=
18+
github.com/rownd/client-go v0.1.9-0.20241121010920-1201c0ce4c7c/go.mod h1:9G67dpXdCDxM3noGWeg4GasCfpe8MbqbU54eSYV6vqs=
1919
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
2020
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
2121
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

examples/rownd-test/server/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"os"
99
"strings"
1010

11-
"github.com/rgthelen/rownd-go-sdk/pkg/rownd"
11+
"github.com/rownd/client-go/pkg/rownd"
1212
)
1313

1414
// Global variables for handlers to use
@@ -24,6 +24,7 @@ type ErrorResponse struct {
2424
}
2525

2626
type contextKey string
27+
2728
const validationContextKey contextKey = "validation"
2829

2930
func writeError(w http.ResponseWriter, status int, message string, detail string) {
@@ -152,7 +153,7 @@ func userHandler(w http.ResponseWriter, r *http.Request) {
152153

153154
func groupsHandler(w http.ResponseWriter, r *http.Request) {
154155
ctx := r.Context()
155-
156+
156157
// Use new Groups.List method
157158
groups, err := client.Groups.List(ctx, rownd.ListGroupsRequest{
158159
AppID: appID,

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
module github.com/rgthelen/rownd-go-sdk
1+
module github.com/rownd/client-go
22

33
go 1.21
44

55
require (
6-
github.com/golang-jwt/jwt/v5 v5.2.0
6+
github.com/golang-jwt/jwt/v5 v5.2.1
77
github.com/joho/godotenv v1.5.1
88
github.com/patrickmn/go-cache v2.1.0+incompatible
99
github.com/stretchr/testify v1.9.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
22
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
33
github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw=
44
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
5+
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
6+
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
57
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
68
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
79
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=

internal/testutils/auth_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"net/url"
1212
"strings"
1313

14-
"github.com/rgthelen/rownd-go-sdk/pkg/rownd"
14+
"github.com/rownd/client-go/pkg/rownd"
1515
)
1616

1717
// AuthTokens represents the tokens returned from auth operations

internal/testutils/env.go

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
package testutils
22

33
import (
4-
"os"
5-
6-
"github.com/joho/godotenv"
4+
"os"
5+
6+
"github.com/joho/godotenv"
77
)
88

99
type TestConfig struct {
10-
AppKey string
11-
AppSecret string
12-
AppID string
13-
BaseURL string
10+
AppKey string
11+
AppSecret string
12+
BaseURL string
1413
}
1514

1615
func init() {
17-
// Load .env file if it exists
18-
godotenv.Load()
16+
// Load .env file if it exists
17+
godotenv.Load()
1918
}
2019

2120
// GetTestConfig returns test configuration from environment variables
2221
func GetTestConfig() TestConfig {
23-
return TestConfig{
24-
AppKey: getEnvOrDefault("ROWND_TEST_APP_KEY", ""),
25-
AppSecret: getEnvOrDefault("ROWND_TEST_APP_SECRET", ""),
26-
AppID: getEnvOrDefault("ROWND_TEST_APP_ID", ""),
27-
BaseURL: getEnvOrDefault("ROWND_TEST_BASE_URL", "https://api.rownd.io"),
28-
}
22+
return TestConfig{
23+
AppKey: getEnvOrDefault("ROWND_TEST_APP_KEY", ""),
24+
AppSecret: getEnvOrDefault("ROWND_TEST_APP_SECRET", ""),
25+
BaseURL: getEnvOrDefault("ROWND_TEST_BASE_URL", "https://api.rownd.io"),
26+
}
2927
}
3028

3129
func getEnvOrDefault(key, defaultValue string) string {
32-
if value := os.Getenv(key); value != "" {
33-
return value
34-
}
35-
return defaultValue
36-
}
30+
if value := os.Getenv(key); value != "" {
31+
return value
32+
}
33+
return defaultValue
34+
}

0 commit comments

Comments
 (0)