Repository navigation
Conversation
…t by signatures.id Two identity documents can carry the same id signature — the same key signing the same id, deterministically — and still differ in the provider's proof, `signatures.publicKey`. Keyed by `signatures.id`, the cache let whichever of them was verified first make every other one fail the `isEqual` comparison, although the provider would have verified it. Seen with the WebAuthn DID identity provider, whose signing key is derived from the passkey and whose proof is a fresh assertion per session: a device could not write to a database after joining entries another session of the same passkey had written (orbitdb#1258). The identity's hash names one document, so the cache is keyed by it; the comparison on a hit stays as a cheap integrity check. The test builds two documents of one key with the same id signature and different proofs under a provider that verifies both, and expects both to verify whichever came first. It fails on the previous code. Fixes orbitdb#1258 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Contributor
Author
|
The failing job is the browser suite's |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1258.
What goes wrong
Identities.verifyIdentitycaches a verified identity undersignatures.idand, on a hit, answersisEqual(identity, cached). Two identity documents can carry the same id signature — the same key signing the same id, deterministically — and still differ in the provider's proof,signatures.publicKey. Whichever of them is verified first then makes every other one fail the comparison, although the provider would have verified it.With the WebAuthn DID identity provider (signing key derived from the passkey's PRF output, proof a fresh WebAuthn assertion per session) this is every second session of the same passkey: after joining entries another session wrote, a device cannot write to its own database — "Could not append entry: Key … is not allowed to write to the log". Two applications carry a workaround for it today.
The fix
Key the cache by the identity's hash, which names one document. The comparison on a hit stays as a cheap integrity check. No API change.
Test
verify two identities with the same id signature: two documents of one key with the same id signature and different proofs, under a provider that verifies both; both must verify whichever came first. Fails onmain, passes with the change.npm run lintclean.