Skip to content

fix(passkeys): canonicalize backup state credential encoding - #112

Merged
pando85 merged 8 commits into
mainfrom
agent/canonicalize-passkey-backup-state
Aug 2, 2026
Merged

fix(passkeys): canonicalize backup state credential encoding#112
pando85 merged 8 commits into
mainfrom
agent/canonicalize-passkey-backup-state

Conversation

@pando85

@pando85 pando85 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #111.

This PR makes APS use the same stable credential backup-state representation as soft-fido2 while preserving compatibility with credentials written by existing APS releases.

Canonical format

New writes emit exactly one CBOR text field:

backup_state: "notEligible" | "eligible" | "backedUp"

APS no longer emits backup_eligible.

Legacy migration

The decoder continues to accept the historical APS boolean pair:

backup_eligible: true
backup_state: false

Valid legacy combinations are converted through a typed three-state codec. The invalid BE=0, BS=1 combination, malformed types, unknown text values, and mixed canonical/legacy representations are rejected.

Credentials with no backup fields retain APS's established syncable-credential default (eligible). Migration is lazy: the next save rewrites a legacy credential using the canonical representation.

Compatibility

  • The existing APS runtime boolean API remains source-compatible.
  • Authenticator-data BE/BS flag behavior is unchanged.
  • Full and metadata-only credential parsing use the same codec.
  • The storage contract is documented explicitly under passkeys/CREDENTIAL_FORMAT.md.

Validation

The branch workflow runs:

./gradlew spotlessApply
./gradlew :passkeys:core:test

Regression coverage includes all canonical states, every valid legacy combination, invalid BE/BS, missing fields, malformed values, conflicting representations, metadata parity, and canonical lazy migration.

Related: pando85/soft-fido2#162

@pando85
pando85 marked this pull request as ready for review August 2, 2026 00:25
@pando85
pando85 merged commit 1a07775 into main Aug 2, 2026
5 checks passed
@pando85
pando85 deleted the agent/canonicalize-passkey-backup-state branch August 2, 2026 00:42
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.

passkeys: canonicalize backup state CBOR to the soft-fido2 enum format

1 participant