Skip to content

Commit 30a73d4

Browse files
committed
Include doc on sign count allowance feature.
1 parent 191ae5c commit 30a73d4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/login.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const auth_expectations = passcay.auth.AuthVerifyExpectations{
8989
.require_user_presence = true, // Whether user presence is required
9090
.enable_sign_count_check = true, // Enable sign count checking if applicable
9191
.known_sign_count = user_credential.sign_count, // Current sign count from database
92+
.sign_count_allowance = 1, // Allow some deviation in sign count for eventual consistency
9293
};
9394
9495
// Perform verification. It returns error if verification fails
@@ -100,4 +101,21 @@ defer auth_result.deinit(allocator);
100101
user_credential.sign_count = auth_result.recommended_sign_count;
101102
```
102103

104+
## Sign count allowance
105+
106+
The `.sign_count_allowance` field is particularly useful for passkey providers that use eventual consistency for syncing sign counts across multiple devices or authenticators. This is common with cloud-based passkey providers where the sign count might not be immediately synchronized across all instances of a key.
107+
108+
### Example with higher allowance:
109+
110+
```zig
111+
const auth_expectations = passcay.auth.AuthVerifyExpectations{
112+
// ... other fields ...
113+
.enable_sign_count_check = true,
114+
.known_sign_count = user_credential.sign_count,
115+
.sign_count_allowance = 5, // Allow up to 5 count deviation for cloud-synced passkeys
116+
};
117+
```
118+
119+
**Important**: While a higher allowance accommodates legitimate sync delays, it also slightly reduces replay attack protection. Choose an allowance value that balances usability with security based on your threat model.
120+
103121
Once verification succeeds, the user has been successfully authenticated with their passkey.

0 commit comments

Comments
 (0)