Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: Remove CreateTOTP #367

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions totp.go

This file was deleted.

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

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

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

// CreateTOTP creates a TOTP (Time-based One-Time Password) for the user.
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
}
req := clerk.NewAPIRequest(http.MethodPost, path)
resource := &clerk.TOTP{}
err = c.Backend.Call(ctx, req, resource)
return resource, err
}

// 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 @@ -511,27 +511,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.NotNil(t, totp.ID)
require.NotNil(t, totp.Secret)
require.NotNil(t, totp.URI)
require.Equal(t, totp.Object, "totp")
}

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