Expand description
Pair code authentication for phone number linking.
This module provides an alternative to QR code pairing. Users enter an 8-character code on their phone instead of scanning a QR code.
§Usage
§Random Code (Default)
use whatsapp_rust::pair_code::PairCodeOptions;
let options = PairCodeOptions {
phone_number: "15551234567".to_string(),
..Default::default()
};
let code = client.pair_with_code(options).await?;
println!("Enter this code on your phone: {}", code);§Custom Pairing Code
You can specify your own 8-character code using Crockford Base32 alphabet
(characters: 123456789ABCDEFGHJKLMNPQRSTVWXYZ - excludes 0, I, O, U):
use whatsapp_rust::pair_code::PairCodeOptions;
let options = PairCodeOptions {
phone_number: "15551234567".to_string(),
custom_code: Some("MYCODE12".to_string()), // Must be exactly 8 valid chars
..Default::default()
};
let code = client.pair_with_code(options).await?;
assert_eq!(code, "MYCODE12");§Concurrent with QR Codes
Pair code and QR code can run simultaneously. Whichever completes first wins.
Structs§
- Pair
Code Options - Options for pair code authentication.
Enums§
- Platform
Id - Platform identifiers for companion devices. These match the DeviceProps.PlatformType protobuf enum.