Expand description
Pair code authentication for phone number linking.
This module implements the alternative device linking protocol used when users enter an 8-character code on their phone instead of scanning a QR code.
§Protocol Overview
-
Stage 1 (companion_hello): Client generates a code and sends encrypted ephemeral public key to server. Server returns a pairing ref.
-
Stage 2 (companion_finish): When user enters code on phone, server sends notification with primary’s ephemeral key. Client performs DH and sends encrypted key bundle.
§Cryptography
- Code: 5 random bytes → Crockford Base32 → 8 characters
- Key derivation: PBKDF2-SHA256 with 131,072 iterations
- Ephemeral encryption: AES-256-CTR
- Bundle encryption: AES-256-GCM after HKDF key derivation
Structs§
- Pair
Code Options - Options for pair code authentication.
- Pair
Code Utils - Core pair code cryptographic utilities.
Enums§
- Pair
Code Error - Errors that can occur during pair code operations.
- Pair
Code State - State machine for pair code authentication flow.
- Platform
Id - Platform identifiers for companion devices. These match the DeviceProps.PlatformType protobuf enum.