monaco.api.auth
Source: protos/api/auth.proto
Use AuthService to create wallet challenges, verify wallet signatures, mint and list Mainnet invite codes, refresh sessions, and revoke sessions.
Notes
Challengebinds the ed25519 session public key into the wallet-signed message. The challenge is single-use and authorizes exactly one keypair, once. It lives 5 minutes, or 30 minutes on a deployment where contract-signature login is enabled, because a multisig has to collect owner approvals before it can answer — that window is uniform for every address rather than eligibility-specific, so this unauthenticated RPC cannot be used to probe which addresses hold a BuilderCodes payout bucket. Readexpires_atrather than assuming either value.Verifyopens the signed session. There is no access token — the session is the registered public key.signaturecarries whatever the wallet produced and is bounded at 8192 decoded bytes: anything longer is refused asUNAUTHENTICATEDrather than forwarded to the chain. The bound is far above any realistic owner set, and EOA signatures never approach it.VerifyResponsecarries two signup signals alongsideexpires_atanduser. Both are scoped per(wallet, application)— identity is created per application, so a wallet already registered on another application still sees them on its first sign-in to a new one.is_new_useris true when this verify created the user row (the wallet’s first sign-in to this application).referral_appliedis true when a TraderCodes referral relationship was recorded on this verify — a valid, non-self TraderCode presented on that first sign-in resolved to a known referrer. Both are false on every returning verify for the application. Useis_new_userto gate first-time UX andreferral_appliedto confirm a referral landed. When a code was presented on that first sign-in and did not apply,referral_not_applied_reasonsays why:ALREADY_REFERRED(the wallet already has a different referrer from an earlier sign-up, on this or another application),UNKNOWN_CODE, orSELF_REFERRAL. It is unset otherwise. Sign-in succeeds either way.ChallengeandVerifyshare one rate budget per client address — 60 requests/min sustained, burst 120 by default, on public ingress — and returnRESOURCE_EXHAUSTEDover it once enforcement is on. Enforcement is gated byauth_rate_limit_enforced, which defaults off; until it flips, an over-budget request is admitted with a warn log rather than rejected. Both figures are deployment defaults, overridden byAUTH_RATE_LIMIT_PER_MINUTE/AUTH_RATE_LIMIT_BURST, so treat the environment’s own budget as authoritative. The check runs before the signature, so a throttled request is never an authentication failure.VerifyreturnsALREADY_EXISTS(“resource already exists”) when the session public key it is asked to bind is already registered — the key is stored under a unique constraint, and the violation maps to that status. Do not retry with the same keypair: generate a fresh session keypair and start a new challenge. The high-levellogin()flow generates one per call, so this only reaches callers drivingChallenge/Verifythemselves.- A deactivated signing account is refused with
PERMISSION_DENIEDand agoogle.rpc.ErrorInfodetail in domainauth.0xmonaco.comwhosereasonisACCOUNT_DEACTIVATED, onVerifyand on every signed RPC. - A wallet on the OFAC sanctions list is refused with
PERMISSION_DENIEDand anErrorInforeasonin the same domain:ADDRESS_RESTRICTEDonChallengeandVerify(messageThis wallet can't be used on Monaco.), andACCOUNT_RESTRICTEDon every signed RPC of a session whose wallet or delegated agent is listed (messageYour account is restricted. Contact support.), within 60 seconds of the listing. Show the message as-is and do not retry. - Both RPCs also return
INVALID_ARGUMENTfor invalid request parameters (onVerify, that includes a nonce already used or expired),PERMISSION_DENIEDwhen the origin is not allowed for this application,NOT_FOUNDfor an invalidclient_idor nonce, andINTERNALfor a server-side failure. VerifyreturnsUNAVAILABLEwhen contract-signature (EIP-1271) verification of an eligible address could not be completed: the chain did not answer, did not answer within the deadline, or the server was at its concurrent-verification capacity and declined to ask. It is retryable and is not a verdict on the signature — a rejected signature isUNAUTHENTICATED, and so is a wallet contract that rejects by reverting. An eligible address can see it even when it turns out to be an EOA, because the code lookup precedes the choice of verification path; addresses that are not eligible never reach the chain. A fourth trigger is unrelated to contract wallets:Verifyreads private-beta feature-flag state before anything else, and a read that cannot be served surfaces as the same retryableUNAVAILABLE, for any address, ahead of any signature or eligibility work.- While Mainnet invite mode is on,
Verifytakesinvite_code(exactly 10 case-sensitive letters or digits) from a wallet without Mainnet access. A missing code isPERMISSION_DENIEDwith reasonINVITE_CODE_REQUIRED; a wrong, redeemed or revoked code, or an unused code whose issuer is deactivated, isINVITE_CODE_INVALID. Repeated attempts enter a cooldown (RESOURCE_EXHAUSTED), and a code that cannot be validated now is a retryableUNAVAILABLE. A redeemed code cannot be revoked, so the redeeming wallet keeps signing in without one; only wallet deactivation blocks it. RequestInviteCodes(signed) mints one code from the wallet’s allowance: one initial code plus one per 250,000 USDC of Mainnet volume. Revoking a code never refunds its slot. It requires active Mainnet access, and a delegated-agent session cannot mint the owner’s codes (PERMISSION_DENIED);UNAVAILABLEwhen codes cannot be minted now.ListInviteCodes(signed) is read-only: it returns the allowance and the codes the wallet minted, never admin-issued codes, and never uses a slot.- Authenticated RPCs are signed per request over the prost-encoded body. See authenticated gRPC for the metadata names, canonical signing string, session expiry/refresh, and a runnable signed example, or TypeScript authentication for the same session-key model in the SDK.

