feat: wallet instance lifecycle - list, suspend/revoke, deactivate (SID-AUTH-06) - #170
Merged
Conversation
…ID-AUTH-06) Client half of go-wallet-backend#319 (issue go-wallet-backend#195). - generateWIA sends the logged-in passkey's credential_id so the backend links the wallet instance to the passkey and a suspended or revoked instance also refuses that passkey at login. - WalletInstance type; BackendApiClient.listWalletInstances / setWalletInstanceStatus / revokeAllWalletInstances (+ a PUT primitive). - SirosWallet.listWalletInstances(), setWalletInstanceStatus(), deactivateWallet() - the last revokes every instance server-side and then forgets the local account, since the vault it decrypts no longer exists. - AuthServerClient carries the AS's JSON error code into AuthException.errorCode, so a 403 WALLET_SUSPENDED / WALLET_REVOKED login refusal is distinguishable from a plain auth failure. Older backends ignore credential_id and answer 404 on the new endpoints, surfaced as BackendApiException; nothing needs to ship in lockstep. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
Author
|
Local verification complete: |
…tus reply Parity with the Copilot review on siros-sdk-swift#135: a response without the instances array is a malformed reply, not an empty wallet; a status update decodes the whole WalletInstance when the backend returns one. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Parity with siros-sdk-swift#135: a malformed reply is an error, not zero revoked. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…erals (Sonar S1192) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Client half of sirosfoundation/go-wallet-backend#319 (design in sirosfoundation/go-wallet-backend#195; iOS twin: sirosfoundation/siros-sdk-swift#135). Tracked on the shared rollout page: https://claude.ai/code/artifact/49eb6eed-38ed-41b8-8168-3b5a300c33da
What changes
BackendApiClient.generateWIAgainscredentialId, andensureWalletInstanceAttestationpassessessionStore.credentialId. The backend records it asWalletInstance.CredentialID, so suspending or revoking this installation's instance also refuses login with its passkey. Without it, only whole-wallet deactivation gates login.WalletInstancetype (sdk/auth), andBackendApiClient.listWalletInstances(),setWalletInstanceStatus(instanceId, status, reason),revokeAllWalletInstances(reason)overGET/PUT /user/session/instances…andPOST …/revoke-all. Adds the client's firstput()primitive.SirosWallet.listWalletInstances(),setWalletInstanceStatus(...),deactivateWallet(reason). Deactivate revokes every instance server-side, then forgets the cached account and logs out, since the vault it decrypts no longer exists.AuthServerClientnow parses the JSONerrormember of a failed AS response intoAuthException.errorCode(falling back toauth_failed), so a403 WALLET_SUSPENDED/WALLET_REVOKEDis distinguishable from a plain authentication failure. Neither is retryable; apps should say so instead of retrying.Compatibility
Old backends ignore
credential_idand answer 404 on the new endpoints (surfaced asBackendApiException). New backends work with old SDKs. No lockstep release needed.Tests
BackendApiClientTest:credential_idpresent only when given; list decodes the backend shape; PUT body and path; revoke-all count.AuthServerClientTest: the 403 code survives intoerrorCode, non-JSON bodies fall back.SirosWalletTest:deactivateWalletcalls revoke-all and removes the active account.testDebugUnitTestandlintDebugpass forauthandwallet;assembleDebugAndroidTestis running as this PR opens and will be confirmed in a comment.Sample-app UI is out of scope here; the SDK exposes the calls.
🤖 Generated with Claude Code