Skip to content

Commit

Permalink
chore: Make CreateTOTP noop and mark as deprecated (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
octoper authored Jan 27, 2025
1 parent 26194ef commit 93130d5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
6 changes: 6 additions & 0 deletions organization/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion user/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions user/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,16 +527,14 @@ func (c *Client) DeleteWeb3Wallet(ctx context.Context, userID, identificationID
return resource, err
}

// CreateTOTP creates a TOTP (Time-based One-Time Password) for the user.
// Deprecated: CreateTOTP creates a TOTP (Time-based One-Time Password) for the user.
// The endpoint used for this method has been removed, we kept the method for backwards compatibility,
// and now it's a noop action.
func (c *Client) CreateTOTP(ctx context.Context, userID string) (*clerk.TOTP, error) {
path, err := clerk.JoinPath(path, userID, "/totp")
if err != nil {
return nil, err
resource := &clerk.TOTP{
Object: "totp",
}
req := clerk.NewAPIRequest(http.MethodPost, path)
resource := &clerk.TOTP{}
err = c.Backend.Call(ctx, req, resource)
return resource, err
return resource, nil
}

// DeleteTOTP deletes all the TOTPs from a given user.
Expand Down
6 changes: 3 additions & 3 deletions user/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,9 @@ func TestUserClientCreateTOTP(t *testing.T) {
client := NewClient(config)
totp, err := client.CreateTOTP(context.Background(), userID)
require.NoError(t, err)
require.NotNil(t, totp.ID)
require.NotNil(t, totp.Secret)
require.NotNil(t, totp.URI)
require.Empty(t, totp.ID)
require.Empty(t, totp.Secret)
require.Empty(t, totp.URI)
require.Equal(t, totp.Object, "totp")
}

Expand Down

0 comments on commit 93130d5

Please sign in to comment.