Files
codex/codex-rs/user-verification/src/error.rs
riley-oai b7ad941b1f Add user-verification provider abstractions and RPC adapters (#43547)
## What changed

- Introduce `codex-user-verification` with a provider interface for credential status, creation, deletion, and challenge signing. Include typed errors, shared cancellation guards, and hashed account-user key namespaces.
- Add P-256 public-key encoding as unpadded base64url SPKI DER, derive credential IDs from its SHA-256 digest, and redact proof fields in debug output.
- Add app-server helpers to validate challenge and display-text bounds and map provider errors to typed RPC errors without exposing provider diagnostics.

The platform implementation reports verification as unsupported. App-server requests still return typed unavailability, with the message updated to mention build or account availability.

## Testing

Add tests for credential encoding and signature verification, invalid curve points, cancellation across guard clones, stable and distinct account namespaces, and invalid challenge or display values. Update the app-server unavailability test for the revised message.

GitOrigin-RevId: fe4a4eb37c68d7fdc547704e76aa257abf3e9c81
2026-09-07 18:43:20 +00:00

43 lines
1.1 KiB
Rust

//! Stable error categories, with provider diagnostics kept outside public error messages.
use thiserror::Error;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum UserVerificationUnavailableReason {
CredentialMissing,
BiometricsUnavailable,
ProviderUnavailable,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum UserVerificationCancellationReason {
UserCancelled,
Interrupted,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum UserVerificationFailureReason {
AuthenticationFailed,
Timeout,
ProviderError,
}
#[derive(Clone, Debug, Error, PartialEq, Eq)]
pub enum UserVerificationError {
#[error("user verification is unavailable: {message}")]
Unavailable {
reason: UserVerificationUnavailableReason,
message: String,
},
#[error("user verification was cancelled: {message}")]
Cancelled {
reason: UserVerificationCancellationReason,
message: String,
},
#[error("user verification failed: {message}")]
Failed {
reason: UserVerificationFailureReason,
message: String,
},
}