Backup codes
When you link a user's iPhone for push, you can also put your own authenticator (TOTP) enrollment for that user into Trowyn. The user then has a 6-digit backup code in Trowyn for when push can't reach them (no signal, notifications off, Trowyn's service unavailable), and you verify it like any TOTP code.
How it works
- You enroll the user in TOTP as you normally would and get their
otpauth://totp/…URI (for exampleotpauth://totp/Acme:ana@acme.example?secret=JBSWY3DPEHPK3PXP&issuer=Acme). - You create a link code as usual (
POST /create-link-code). - On your side, you add the URI to the link as the
tparameter (percent-encoded withencodeURIComponent): -link_url:https://trowyn.com/link#c=…&n=…&t=<encoded URI>(in the fragment) -qr_payload:trowyn://link?v=1&h=…&c=…&n=…&t=<encoded URI>
The server SDK does this for you: createLinkCode({ …, backupOtpauthUri }) or
withBackupCode(link, uri). In the console, Phones → Link a phone → Backup code does it in your browser.
4. You show that link as a QR code on a page where the user is already signed in.
5. The user scans it. Trowyn shows "Also add a backup code" (on by default) next to the link confirmation.
After the link succeeds, the code is saved on the iPhone like any other account, tagged #Push,
and the linked company shows it has a backup code.
Security
- Trowyn's servers never see the secret. The API request doesn't contain it, the
tvalue travels only inside the QR code (or the URL fragment, which browsers never send to a server), and it's stored only in the iPhone's Keychain, exactly like a code the user scanned themselves. - The link with
tcontains the TOTP secret. Show it only as a QR on a signed-in page. Don't email it, log it or send it by text. Links withouttare safe to send as before. - Only TOTP is accepted (
otpauth://totp/, base32secret, 6 or 8 digits, period 15–120 s). An invalidtmakes Trowyn refuse the whole link, so you notice. Max 1024 characters. - If the URI has no
issuer, Trowyn uses your organization's name. - Typing the link code instead of scanning links push only (the code can't carry the backup secret).
- Unlinking the phone stops push; the backup code stays in the user's list until they delete it. Revoke the TOTP enrollment on your side if you no longer want it to work.
Compatibility
t is optional and the API is unchanged. Links without it work everywhere. Links with it need a
Trowyn version with backup-code support (older versions refuse the longer link with "That QR code
isn't a Trowyn link code").