Called from the authenticated whitelist poll. Claims an unowned code for user_id and, if they own it, (re)opens its pairing window. Returns ownership.
(code: str, user_id: str)
| 165 | |
| 166 | |
| 167 | async def claim(code: str, user_id: str) -> bool: |
| 168 | """ |
| 169 | Called from the authenticated whitelist poll. Claims an unowned code for |
| 170 | user_id and, if they own it, (re)opens its pairing window. Returns ownership. |
| 171 | """ |
| 172 | r = await get_redis() |
| 173 | await r.set(_owner_key(code), user_id, nx=True) |
| 174 | if await r.get(_owner_key(code)) != user_id: |
| 175 | return False |
| 176 | await r.setex(_pairing_key(code), PAIRING_TTL, "1") |
| 177 | return True |
| 178 | |
| 179 | |
| 180 | async def owned_address(code: str, channel: str, user_id: str) -> str | None: |
nothing calls this directly
no test coverage detected