mirror of
https://github.com/hanzoai/iam.git
synced 2026-11-19 18:37:16 +00:00
An account an agent made with a wallet has no email and no phone, so a
person could sign in to it only by holding the key. PUT /v1/iam/account
refuses both fields, rightly: an address is a login identifier and a
second-factor destination, and writing one is only safe once the new
address has received a code. Nothing did that.
PUT /v1/iam/address {clientId, address, code} is that proof. The caller
is the account written (cookie or own bearer; an impersonated or
delegated one is refused; a machine is 403). The application must sign
the caller in. The code is the one POST /v1/iam/verification-codes
filed for nobody under the application's org. It adds and never
replaces (409), and an address any other account would sign in by at
that application is refused before the code is spent, in the words a
wrong code gets. Email lands verified. Audited as "address", naming the
field and the client, never the address.
A founded account works in an org of its own, so a texted code was
filed for nobody: the phone arm looked only in the application's org.
store.GetSignupByPhone is GetSignupByEmail for numbers, and the send and
resolveLoginUser fall back to it after the in-org lookup, so code
sign-in by phone finds the account the address was added to.