← Back to TwoViewGolf
🔑 Invite Codes

How Invite Codes Work

The full journey from code generation to secure coach–student connection — and everything that happens behind the scenes.

User Guide Coach Guide Invite Codes Apple Watch Guide

In This Guide

Overview

Invite codes are how coaches and students find each other — no email accounts, no sign-up forms, no QR codes. Just six characters.

When a coach subscribes to the Coach tier and sets up their profile, TwoViewGolf generates a short invite code. The coach shares this code with a student (text, email, in person). The student enters it in the app, and they're instantly linked. From that point on, the coach can share annotated swing videos directly to that student.

The Invite Code Journey

Coach
🎓
Creates profile, gets a 6-character invite code
iCloud
Stores invite record + encryption secret
Student
🏌
Enters code, linked to coach's roster

Instant

No waiting for email confirmation or approval. Enter the code, tap join, and you're linked immediately.

🔒

Secure

Each code generates a unique encryption key. All shared swings between coach and student are encrypted end-to-end.

🕑

Time-Limited

Codes expire after 7 days for security. Coaches can generate new ones anytime — old codes stay valid until they expire.

👤

No Account Required

Students don't need a paid subscription, an email signup, or any account beyond their Apple ID (which they already have).

Coach: Creating an Invite Code

Your code appears automatically when you set up your coach profile.

  1. Open the Coach Dashboard It's in the tab bar on the home screen. If this is your first time, you'll see a setup screen asking for your display name.
  2. Enter your display name This is what students see — your name, business name, or whatever you'd like (e.g., "Coach Sarah" or "Pine Valley Golf Academy"). You can change it later from the profile card at the top of the dashboard.
  3. Your invite code is generated A unique 6-character code appears on your dashboard immediately. Behind the scenes, the app also creates a one-time encryption key and uploads both to iCloud.

The code format: Six uppercase letters and numbers, with ambiguous characters removed (no O/0, no I/1/L). This prevents mistakes when reading codes aloud or typing them from a screenshot. Example: K7N3HW

Generating a New Code

Tap the refresh icon next to "Invite Code" on your dashboard. A fresh code is generated instantly. Your previous code stays valid until it expires naturally after 7 days — so if you already texted the old code to a student, they can still use it.

Why old codes aren't deleted: Imagine you send Code A to Student A on Monday, then generate Code B for Student B on Tuesday. If generating Code B deleted Code A, Student A would get "Invalid or expired invite code" when they try to redeem on Wednesday. Each code is independent and expires on its own schedule.

Sharing the Code

Send it however works best — it's just six characters.

From the invite code card on your dashboard, you have two options:

📋

Copy

Copies the 6-character code to your clipboard. Paste it into any messaging app, email, or notes app.

📤

Send to Student

Opens the iOS share sheet with a pre-written message that includes the code, your coach name, and instructions for the student. Share via iMessage, email, WhatsApp, or any other app.

The share message looks something like:

Your coach Coach Sarah has invited you to connect on TwoViewGolf!

Open TwoViewGolf and tap "Join a Coach", then enter this code:

K7N3HW

This code expires in 7 days. Download TwoViewGolf from
the App Store if you haven't already.

During a lesson: The easiest way is to just read the code aloud. Six characters with no ambiguous letters — it takes about 5 seconds.

Student: Redeeming a Code

Enter your name, enter the code, and you're connected.

  1. Open TwoViewGolf and tap "Join a Coach" This is available from the home screen. Students do not need a paid subscription to join a coach.
  2. Enter your name This is the name your coach will see in their student roster. Use whatever name they know you by.
  3. Type the 6-character invite code As you type, the app automatically looks up the code in real time. Once all 6 characters are entered, it checks iCloud for a match.
  4. Coach name confirmation appears If the code is valid, a card appears showing your coach's display name with a green checkmark: "Coach found — Coach Sarah". If the code is expired or invalid, you'll see a clear error message instead.
  5. Tap "Join" The link is created instantly. Your name appears on the coach's student roster, and a secure encryption key is exchanged behind the scenes.
  6. You're connected The coach can now share annotated swing videos directly to you. They'll appear in your inbox within the app. You can also share swings back to your coach.

Privacy note: Your coach can see your name and shared swings, but they cannot see your personal recordings, your other coaches, or anything you haven't explicitly shared with them.

Behind the Scenes

What actually happens when a code is created and redeemed.

When the Coach Creates a Code

Step 1
Generate a unique code
The app generates a random 6-character code from a safe character set (no O/0/I/1/L). It checks iCloud to make sure the code isn't already in use by another coach, retrying up to 10 times if needed.
Step 2
Save the invite to iCloud
A CoachInvite record is saved to Apple's CloudKit (the public database, since coach and student have different iCloud accounts). It contains: the code, the coach's identity, the coach's display name, and an expiration date 7 days out.
Step 3
Generate an encryption secret
A 32-byte random encryption key is generated. This is the pairing secret that will later be used to encrypt all swing packages shared between this coach and the student who redeems the code.
Step 4
Upload the secret to iCloud
The pairing secret is saved as a temporary PairingSecret record in CloudKit, keyed by the invite code. It sits there waiting for the student to pick it up during redemption. Think of it as a secure drop box.
Step 5
Cache the secret locally
The coach's device also stores a copy of the secret locally. Once the student redeems and the coach's app refreshes the roster, this secret is moved to the device's Keychain for permanent, secure storage.

When the Student Redeems the Code

Step 1
Look up the code in iCloud
The app queries CloudKit for a CoachInvite record matching the entered code that hasn't expired. If found, the coach's display name is shown for confirmation.
Step 2
Create the coach–student link
A CoachStudentLink record is created in CloudKit, binding the coach's iCloud identity to the student's iCloud identity. This is the persistent roster entry — it survives app reinstalls, device changes, everything.
Step 3
Fetch the encryption secret
The app retrieves the PairingSecret record from CloudKit using the invite code. The 32-byte secret is stored in the student's device Keychain, keyed by the coach–student link ID.
Step 4
Delete the temporary secret from iCloud
The PairingSecret record is deleted from CloudKit immediately after the student downloads it. It was ephemeral — a one-time handoff. Both devices now have the secret stored locally in their Keychains; it never needs to be in the cloud again.
Step 5
Student appears on coach's roster
The next time the coach's app refreshes (on foreground, pull-to-refresh, or automatic sync), it queries CloudKit for all active links and discovers the new student. The coach's copy of the pairing secret is moved from its temporary cache to the Keychain, keyed by the same link ID.

Security & Encryption

The invite code does more than connect two people — it establishes an encrypted channel.

What the Pairing Secret Enables

The 32-byte secret exchanged during invite redemption is used for two things:

🔒

Encrypted Swing Sharing

When the coach shares a swing package, it's encrypted with ChaCha20-Poly1305 using a key derived from the pairing secret. Only the linked student can decrypt it. Other students, other coaches, and even Apple (via CloudKit) cannot read the contents.

🛡

Authenticated Local Connections

When coach and student devices connect on the same WiFi network for multi-device recording, the pairing secret is used for HMAC authentication. This prevents a stranger's device from joining your session.

Where Secrets Are Stored

End-to-end encryption means: Swing videos are encrypted before they leave the sender's device and can only be decrypted by the intended recipient's device. The encrypted data passes through Apple's CloudKit servers, but Apple cannot read it — they don't have the key.

Code Lifecycle

What happens to an invite code over time.

Day 0
Code created
Coach generates the code. It's valid immediately and appears on the dashboard.
Day 0 – 7
Code is active
Any student with the code can redeem it. Multiple students can use different codes from the same coach simultaneously (each code has its own encryption secret).
Any time
Coach generates a new code (optional)
The old code remains valid until its expiration. The new code gets its own independent encryption secret. Both codes can be redeemed by different students.
When redeemed
Encryption secret consumed
The student downloads the pairing secret and the temporary iCloud record is deleted. The code itself remains in CloudKit but the secret is gone — effectively making it a one-use code per student.
Day 7
Code expires
Expired codes fail lookup with "Invalid or expired invite code." Existing coach–student links are permanent and unaffected — expiration only prevents new redemptions.

The link is permanent. Once a student redeems a code, the coach–student relationship persists indefinitely — through app updates, device changes, even reinstalls. The link lives in iCloud, not on the device. Only the coach can remove a student from their roster.

Invite Code FAQ

Can multiple students use the same code?
Technically yes, but each redemption consumes the encryption secret. The first student gets the encrypted channel. Subsequent students would connect without encryption (the app falls back gracefully). For best security, generate a fresh code for each student.
What if my student's code expired before they redeemed it?
Just tap the refresh icon on your dashboard to generate a new code and send it to them. It takes a few seconds.
Can I see which codes are still active?
The dashboard shows your current code. Previously generated codes expire silently after 7 days. There's no list of old codes — they're fire-and-forget.
Does my student need a paid subscription to redeem?
No. Redeeming an invite code and viewing shared swings is free. Students only need to upgrade to Pro for their own advanced features (unlimited personal sessions, AI analysis, export).
What happens if I remove a student and want to re-add them?
Generate a new invite code and have them redeem it again. This creates a fresh link and a new encryption secret.
Does iCloud need to be enabled?
Yes, on both devices. The invite system uses Apple's CloudKit to exchange the code and encryption secret. If iCloud is not available, the app will show a clear message asking the user to sign in.
Is any data shared with other users or third parties?
No. Invite records, links, and shared packages are stored in CloudKit's public database (necessary because coach and student are different iCloud accounts), but access is restricted by record ownership. The actual swing video data is encrypted before upload. See the Privacy Policy for details.
Can a student have multiple coaches?
Yes. A student can redeem invite codes from multiple coaches. Each coach–student pair has its own encryption key, so coaches cannot see each other's shared content.