feat(settings): compose the passkey wrap envelope create and unwrap - #21153
Draft
vpomerleau wants to merge 1 commit into
Draft
feat(settings): compose the passkey wrap envelope create and unwrap#21153vpomerleau wants to merge 1 commit into
vpomerleau wants to merge 1 commit into
Conversation
Because: - Passwordless Sync needs a client that can seal kB to a passkey and recover it from the stored envelope. - auth-server owns kB generation staleness: a reset deletes the wraps and GET /passkey/wraps withholds one older than keysChangedAt. Binding the generation here would need keysChangedAt plumbed to the client, where any drift fails the unwrap with no way to recover. This commit: - Adds createWrapEnvelope and openWrapEnvelope, typed against the auth-client PasskeyWrapEnvelope so no parallel envelope type exists. - Exports only those two, keeping the crypto layers and the frozen context construction module-local. - Drops keysChangedAt from the bound context, leaving the HPKE aad empty. - Removes context.ts, folding its framing and validation into envelope.ts. - Zeroes the recipient private key and the serialised scalar after use. Closes #FXA-13147
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.
Because
can seal
kBto a passkey and recover it from the stored envelope.the envelope the wrap endpoints store and return.
This pull request
createWrapEnvelopeandopenWrapEnvelope, typed against the auth-clientPasskeyWrapEnvelope.module-local.
uidandcredentialIdas length-prefixed framing, leaving the HPKEaadempty.context.ts, folding its framing and validation intoenvelope.ts.golden-envelope.test.ts.Issue that this pull request solves
Closes: FXA-13147
Checklist
Put an
xin the boxes that applyHow to review (Optional)
envelope.ts— it is the entire public surface.envelope.ts, thengolden-envelope.test.ts, thenREADME.md.un-migratable once a wrap is stored.
Screenshots (Optional)
Please attach the screenshots of the changes made in case of change in user interface.
Other information (Optional)
uidandcredentialIdwithper-layer domain labels, not the delimited
'${uid}-${credentialId}-prf-kb-wrap'string in the ticket's AC. The ticket flagged that delimiter as the thing to pin
down; framing resolves it, since
credentialIdis authenticator-chosen andvariable-length.
client writes a wrap. Nothing consumes this module yet — which is also the only
window in which
v1-envelope-fixture.jsoncan be regenerated.