Skip to content

Commit b4bfa71

Browse files
bo-magicbomliuclaude
authored
feat: add remove_mfa_by_public_address to User resource (#136)
* feat: add remove_mfa_by_public_address to User resource Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: bump version to 2.5.0 and update changelog Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: bump ruff-pre-commit rev to v0.15.18 (pre-commit-update) --------- Co-authored-by: bomliu <bo.m.liu@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0c29b43 commit b4bfa71

6 files changed

Lines changed: 41 additions & 3 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repos:
1818
- id: codespell
1919
exclude: ^locale/
2020
- repo: https://github.com/astral-sh/ruff-pre-commit
21-
rev: v0.15.12
21+
rev: v0.15.18
2222
hooks:
2323
- id: ruff-check
2424
args: [--fix]

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## `2.5.0` - 2026-06-19
2+
3+
#### 🚀 New Features
4+
5+
- **Added `remove_mfa_by_public_address` to the User resource**
6+
- Lets developers remove (deactivate) all multi-factor authentication for one of their app's users, identified by the user's public address
7+
- Useful for support flows where a user is locked out of their authenticator
8+
- Example: `magic.User.remove_mfa_by_public_address("0x...")`
9+
- The user must belong to the app associated with your secret key; otherwise the request is rejected
10+
11+
---
12+
113
## `2.4.0` - 2026-05-06
214

315
#### 🚀 New Features

magic_admin/resources/user.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class User(ResourceComponent):
77
v1_user_info = "/v1/admin/user"
88
v1_users_info = "/v1/admin/users"
99
v1_user_logout = "/v1/admin/user/logout"
10+
v1_user_remove_mfa = "/v1/admin/user/remove_mfa"
1011
v2_user_info = "/v2/admin/user"
1112

1213
def get_metadata_by_email(self, email, provider=None):
@@ -66,3 +67,12 @@ def logout_by_public_address(self, public_address):
6667

6768
def logout_by_token(self, did_token):
6869
return self.logout_by_issuer(self.Token.get_issuer(did_token))
70+
71+
def remove_mfa_by_public_address(self, public_address):
72+
return self.request(
73+
"post",
74+
self.v1_user_remove_mfa,
75+
data={
76+
"issuer": construct_issuer_with_public_address(public_address),
77+
},
78+
)

magic_admin/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "2.4.0"
1+
VERSION = "2.5.0"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "magic-admin"
7-
version = "2.4.0"
7+
version = "2.5.0"
88
description = "Magic Python Library"
99
readme = "README.md"
1010
authors = [

tests/unit/resources/user_test.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from magic_admin.resources.user import User
88
from magic_admin.resources.wallet import WalletType
99
from testing.data.did_token import future_did_token
10+
from testing.data.did_token import issuer
1011
from testing.data.did_token import public_address
1112

1213

@@ -263,3 +264,18 @@ def test_logout_by_token(self):
263264
self.user.logout_by_issuer.assert_called_once_with(
264265
self.user.Token.get_issuer.return_value,
265266
)
267+
268+
def test_remove_mfa_by_public_address(self):
269+
self.user.request = mock.Mock()
270+
271+
assert self.user.remove_mfa_by_public_address(
272+
public_address,
273+
)
274+
275+
self.user.request.assert_called_once_with(
276+
"post",
277+
self.user.v1_user_remove_mfa,
278+
data={
279+
"issuer": issuer,
280+
},
281+
)

0 commit comments

Comments
 (0)