-
Notifications
You must be signed in to change notification settings - Fork 161
chore: Make StorableAnchor a structural super-type of StorableFixedAnchor
#3522
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
Conversation
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.
Pull request overview
This PR extends the StorableAnchor type to become a structural super-type of StorableFixedAnchor by adding fields that cover all anchor data. This is part of a migration strategy to eventually obsolete StorableFixedAnchor, which has a 4 KB data limit per anchor.
Key changes:
- Added new structs
StorablePasskeyCredentialandStorableRecoveryKeyto represent device credentials in the extended storage model - Extended
StorableAnchorwith new fields:created_at_ns,passkey_credentials, andrecovery_phrases - Updated the
From<Anchor>implementation to populate the new fields by converting device data into the new storage structures
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/internet_identity/src/storage/storable/anchor.rs | Defines two new structs (StorablePasskeyCredential, StorableRecoveryKey) and adds three new fields to StorableAnchor |
| src/internet_identity/src/storage/anchor.rs | Updates conversion logic to populate the new StorableAnchor fields from Anchor devices |
| src/internet_identity/src/storage.rs | Fixes typo in error message from "StableAnchor" to "StorableAnchor" |
| src/internet_identity/src/main.rs | Updates comment with a spelling correction |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…rsion - Add 13 tests covering passkey credentials, recovery keys, and conversion edge cases - Test authentication vs recovery purpose passkey handling - Test protected/unprotected recovery key conversion - Test empty alias and missing origin default values - Test proper ordering (recovery passkeys appear at end of list) - Test devices without credential_id exclusion - Test OpenID credentials and fixed anchor field preservation - Remove redundant AAGUID test per code review
eca081b to
3721079
Compare
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.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
sea-snake
left a comment
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.
LGTM
As discussed, special edge case (purpose auth without credential id) will be handled differently in follow up PR.
Motivation
This PR proposes a new storage model for anchors, extending the existing
StorableAnchortype with fields to cover all data stored inStorableFixedAnchor. The idea is to eventually migrate all anchor data toStorableAnchorand obsoleteStorableFixedAnchor, which limits the data per anchor to 4 KB.Changes
StableAnchorto represent data that is currently stored inStableFixedAnchor.From<Anchor> for (StableAnchor, StableFixedAnchor)to populate the new fields.Tests
13 unit tests in
from_conversion_testsmodule coveringFrom<Anchor>for (StorableFixedAnchor, StorableAnchor) conversion:Passkey Credentials
Recovery Keys
is_protected: Some(true)Edge Cases
Noneinstead ofSome("")"https://identity.ic0.app"Preservation
created_at_nsset correctlyEmpty State