// SIGNING IN WITHOUT A TEXT MESSAGE (19 Nov 2026; the owner's// order, 17 Nov: approve from a phone already signed in, then a Cotton// passkey, then a code by text for the first device and recovery).//// The core decides every rule and every word (`crates/cotton-ffi/src/phone/// signin_approval.rs`, `account_passkey.rs`); this file only names the calls// and carries them, off the main thread, the way `BusinessClient` carries// the code sign-in. What a granted credential becomes is `BusinessClient.keep`.//// THE ASKING DEVICE (signed out, at the open host):// personal.ask → the card: heading, line, left, pollSeconds, sendCode, cancel// personal.askPoll → waiting (a `code` once the other phone opened it) or done;// `approved` carries the credential, already claimed// personal.passkeyBegin / personal.passkeySignIn → the system passkey sheet between them//// THE APPROVING DEVICE (signed in, through its object door):// signin.asks / signin.show / signin.approve / signin.refuse// (never signin.approveSibling or signin.siblingTicket: no code, no presence;// only Android's signature-checked provider may carry them, and an iPhone// app shares the keychain group instead)// signin.passkeys / signin.passkeyOptions / signin.passkeyAdd / signin.passkeyRemoveimportFoundationextensionCottonMethod {/// Ask a signed-in device of this number to let this one in.publicstaticlet personalAsk = "personal.ask"/// Where that ask stands; approved, the credential is claimed with this device's key.publicstaticlet personalAskPoll = "personal.askPoll"/// The passkey sheet's request, for a sign-in with no number typed.publicstaticlet personalPasskeyBegin = "personal.passkeyBegin"/// The sheet's answer, proved at the open host: a credential.publicstaticlet personalPasskeySignIn = "personal.passkeySignIn"/// The asks waiting on this signed-in device; a read only looks.publicstaticlet signinAsks = "signin.asks"/// *This is me, show the code*: the tap that opens one ask, so its device shows the code.publicstaticlet signinShow = "signin.show"/// Approve one ask with the code typed from the other screen.publicstaticlet signinApprove = "signin.approve"/// Turn one ask away.publicstaticlet signinRefuse = "signin.refuse"/// The new device's page while another device of the person's must say yes (GETTING-IN.md): it asks by itself.publicstaticlet gettingInScreen = "gettingIn.screen"/// Ask again: a fresh request that replaces the one before.publicstaticlet gettingInAgain = "gettingIn.again"/// Account's passkeys, with their words.publicstaticlet signinPasskeys = "signin.passkeys"/// The creation request a new passkey is made from.publicstaticlet signinPasskeyOptions = "signin.passkeyOptions"/// The new passkey, as the sheet made it.publicstaticlet signinPasskeyAdd = "signin.passkeyAdd"/// One passkey removed.publicstaticlet signinPasskeyRemove = "signin.passkeyRemove"}extensionBusinessClient {/// `personal.ask`: this device asks, naming its vault key's public half so/// one approval also lets it into the vault. The public half is read with/// no prompt (`VaultKeyring.publicKey`); without one the ask signs in only.publicfunc ask(phone: String, deviceName: String, vaultKey: String?) asyncthrows -> JSONValue {structAsk: Encodable { let server: String; let phone: String; let deviceName: String; let vaultKey: String? }returntryawait calling.callJSON(CottonMethod.personalAsk, Ask(server: address.server, phone: phone, deviceName: deviceName, vaultKey: vaultKey)) }/// `personal.askPoll`: the ask's state, in the core's words.publicfunc askPoll(askId: String) asyncthrows -> JSONValue {structPoll: Encodable { let server: String; let askId: String }returntryawait calling.callJSON(CottonMethod.personalAskPoll, Poll(server: address.server, askId: askId)) }/// `personal.passkeyBegin`: `{challengeId, requestJson}` for the sheet.publicfunc passkeyBegin() asyncthrows -> JSONValue {structBegin: Encodable { let server: String }returntryawait calling.callJSON(CottonMethod.personalPasskeyBegin, Begin(server: address.server)) }/// `personal.passkeySignIn`, then the credential kept as a code's is.publicfunc passkeySignIn(challengeId: String, responseJSON: String) asyncthrows -> BusinessSession {structSignIn: Encodable { let server: String; let challengeId: String; let responseJson: String }let granted = tryawait calling.callJSON(CottonMethod.personalPasskeySignIn,SignIn(server: address.server, challengeId: challengeId, responseJson: responseJSON))returntry keep(granted: granted, phone: granted.text("phone")) }}