mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
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
This commit is contained in:
1 parent
4f1a2bb5ff
commit
b7ad941b1f
18 files changed
+625
-16
No files matched your search
@@ -0,0 +1,53 @@
|
||||
//! Typed unavailable behavior until a native provider is available for this platform.
|
||||
|
||||
use crate::*;
|
||||
|
||||
pub(crate) struct UnsupportedProvider;
|
||||
|
||||
fn unavailable() -> UserVerificationError {
|
||||
UserVerificationError::Unavailable {
|
||||
reason: UserVerificationUnavailableReason::ProviderUnavailable,
|
||||
message: "this platform does not support user verification".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
impl UserVerificationProvider for UnsupportedProvider {
|
||||
fn status(
|
||||
&self,
|
||||
guard: &UserVerificationRequestGuard,
|
||||
) -> Result<UserVerificationStatus, UserVerificationError> {
|
||||
guard.check()?;
|
||||
Ok(UserVerificationStatus {
|
||||
credential: None,
|
||||
unavailable_reason: Some(UserVerificationUnavailableReason::ProviderUnavailable),
|
||||
unavailable_message: Some(
|
||||
"this platform does not support user verification".to_string(),
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
fn ensure_key(
|
||||
&self,
|
||||
guard: &UserVerificationRequestGuard,
|
||||
) -> Result<UserVerificationKeyCreation, UserVerificationError> {
|
||||
guard.check()?;
|
||||
Err(unavailable())
|
||||
}
|
||||
|
||||
fn delete(
|
||||
&self,
|
||||
guard: &UserVerificationRequestGuard,
|
||||
) -> Result<UserVerificationKeyDeletion, UserVerificationError> {
|
||||
guard.check()?;
|
||||
Err(unavailable())
|
||||
}
|
||||
|
||||
fn verify(
|
||||
&self,
|
||||
_request: &UserVerificationRequest,
|
||||
guard: &UserVerificationRequestGuard,
|
||||
) -> Result<UserVerificationProof, UserVerificationError> {
|
||||
guard.check()?;
|
||||
Err(unavailable())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user