-
Notifications
You must be signed in to change notification settings - Fork 0
Universal Add Factor #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Universal Add Factor #136
Conversation
| return Err(BackupManagerError::ETagNotFound); | ||
| }; | ||
|
|
||
| metadata.keys.push(encryption_key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we check if the key already exist and skip if it does?
| } | ||
| } | ||
| // best-effort cleanup if we inserted lookup above when not needed | ||
| let _ = factor_lookup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't first check lookup_insert_succeeded before the cleanup here?
| ) | ||
| .await?; | ||
| ( | ||
| serde_json::Value::String(STANDARD.encode(new_factor_challenge)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some parts of the code we use STANDARD others URL_SAFE_NO_PAD. It'd be simpler to settle on one flavor.
| /// # Errors | ||
| /// - `BackupManagerError::BackupNotFound` - if the backup does not exist. | ||
| /// - `BackupManagerError::ETagNotFound` - if `ETag` is missing (unexpected). | ||
| pub async fn add_encryption_key_only( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussing in Slack
| new_factor: NewFactor, | ||
| /// Optional; defaults to PASSKEY to preserve current clients | ||
| #[serde(default)] | ||
| existing_factor_kind: Option<ExistingFactorKind>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we really need this and we need to distinguish the challenge_type in the challenge_token. I don't think having that is adding much. thoughts @aurel-fr too?
This PR implements the universal add factor feature described here: https://www.notion.so/worldcoin/Backup-Service-Universal-Add-Factor-Proposal-2548614bdf8c80b5a872c3a08d43ed67?source=copy_link
tldr: we extend the add_factor flow to include all factor combinations, not just passkey->oidc