Skip to content

Commit

Permalink
fix: Remove createTOTP (#368)
Browse files Browse the repository at this point in the history
* fix: Remove createTOTP

* chore: Remove CreateTOTP from api and remove TOTP types
  • Loading branch information
octoper authored and BrandonRomano committed Jan 29, 2025
1 parent 3113a85 commit b1594c6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 52 deletions.
14 changes: 0 additions & 14 deletions totp.go

This file was deleted.

7 changes: 0 additions & 7 deletions user/api.go

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

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

// 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) {
resource := &clerk.TOTP{
Object: "totp",
}
return resource, nil
}

// DeleteTOTP deletes all the TOTPs from a given user.
func (c *Client) DeleteTOTP(ctx context.Context, userID string) (*MultifactorAuthentication, error) {
path, err := clerk.JoinPath(path, userID, "/totp")
Expand Down
21 changes: 0 additions & 21 deletions user/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,27 +513,6 @@ func TestUserClientDeleteWeb3Wallet(t *testing.T) {
require.Equal(t, web3WalletIdentificationID, web3Wallet.ID)
}

func TestUserClientCreateTOTP(t *testing.T) {
t.Parallel()
userID := "user_123"
config := &clerk.ClientConfig{}
config.HTTPClient = &http.Client{
Transport: &clerktest.RoundTripper{
T: t,
Method: http.MethodPost,
Out: json.RawMessage(`{"backup_codes":[],"created_at":1725548779338,"id":"totp_id","object":"totp","secret":"secret","updated_at":1725548779338,"uri":"otpauth://totp/","verified":false}`),
Path: fmt.Sprintf("/v1/users/%s/totp", userID),
},
}
client := NewClient(config)
totp, err := client.CreateTOTP(context.Background(), userID)
require.NoError(t, err)
require.Empty(t, totp.ID)
require.Empty(t, totp.Secret)
require.Empty(t, totp.URI)
require.Equal(t, totp.Object, "totp")
}

func TestUserClientDeleteTOTP(t *testing.T) {
t.Parallel()
userID := "user_123"
Expand Down

0 comments on commit b1594c6

Please sign in to comment.