Skip to content

feat: update ssss to centeralise key logic#2317

Open
ab-famedly wants to merge 2 commits into
mainfrom
centralise-key-logic
Open

feat: update ssss to centeralise key logic#2317
ab-famedly wants to merge 2 commits into
mainfrom
centralise-key-logic

Conversation

@ab-famedly
Copy link
Copy Markdown

Added reusable public migration APIs in SDK SSSS:

  • analyzeEncryptedSecrets()
  • orderedCandidateKeyIds(...)
  • migrateSecretsToKey(...)

Also added private SDK helper:

  • _tryOpenAndUnlockKey(...)

These now contain the logic to centralised (secret discovery, key iteration, migration, cache warm-up via maybeCacheAll()).

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 38.88889% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.25%. Comparing base (2ba4922) to head (f89b314).

Files with missing lines Patch % Lines
lib/encryption/ssss.dart 31.20% 86 Missing ⚠️
lib/encryption/utils/bootstrap.dart 33.33% 6 Missing ⚠️
lib/src/utils/native_implementations.dart 80.76% 5 Missing ⚠️
...worker/native_implementations_web_worker_stub.dart 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2317      +/-   ##
==========================================
- Coverage   55.76%   55.25%   -0.51%     
==========================================
  Files         160      160              
  Lines       19850    19957     +107     
==========================================
- Hits        11069    11028      -41     
- Misses       8781     8929     +148     
Files with missing lines Coverage Δ
...worker/native_implementations_web_worker_stub.dart 0.00% <0.00%> (ø)
lib/src/utils/native_implementations.dart 42.30% <80.76%> (+19.23%) ⬆️
lib/encryption/utils/bootstrap.dart 60.90% <33.33%> (+2.29%) ⬆️
lib/encryption/ssss.dart 59.50% <31.20%> (-25.50%) ⬇️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ba4922...f89b314. Read the comment docs.

@ab-famedly ab-famedly force-pushed the centralise-key-logic branch 2 times, most recently from c99cee4 to c115c5e Compare April 20, 2026 09:00
@ab-famedly ab-famedly self-assigned this Apr 20, 2026
Comment thread lib/encryption/ssss.dart
@ab-famedly ab-famedly force-pushed the centralise-key-logic branch from c115c5e to 0bbd466 Compare April 20, 2026 09:40
Comment thread lib/encryption/ssss.dart
@ab-famedly ab-famedly force-pushed the centralise-key-logic branch 3 times, most recently from 634e640 to b349abb Compare April 23, 2026 11:10
Comment thread lib/encryption/ssss.dart Outdated
@ab-famedly ab-famedly force-pushed the centralise-key-logic branch 5 times, most recently from 90c8a0b to b3bce14 Compare April 30, 2026 09:01
@ab-famedly ab-famedly force-pushed the centralise-key-logic branch 2 times, most recently from 2067382 to e836f9f Compare May 5, 2026 17:15
Comment thread lib/encryption/ssss.dart Outdated
Comment thread lib/encryption/ssss.dart
Comment thread lib/encryption/ssss.dart
);
encryptedContent.removeWhere((k, v) => otherKeys.contains(k));
// yes, we are paranoid...
content['encrypted'] = encryptedContent;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh why are we doing this? (also the previous comment was helpful so someone does not remove the getStored check)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need either “assign the mutated copy back into content” or “mutate the nested map in place,” because tryGetMap copies, stripping only the copy would upload unstripped account data. I've added the comment back though.

Comment thread lib/encryption/ssss.dart Outdated
Comment thread lib/encryption/ssss.dart Outdated
Copy link
Copy Markdown
Member

@td-famedly td-famedly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another review, looks like some of the methods are not really needed

@ab-famedly ab-famedly force-pushed the centralise-key-logic branch from e836f9f to b659903 Compare May 10, 2026 08:33
@ab-famedly ab-famedly force-pushed the centralise-key-logic branch 2 times, most recently from 115c05b to 1931270 Compare May 10, 2026 13:54
@ab-famedly ab-famedly force-pushed the centralise-key-logic branch from 1931270 to f89b314 Compare May 10, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants