8000 Tell a revoked device that its access was revoked; listDeviceCertificates by klehmann · Pull Request #97 · klehmann/MindooDB · GitHub
[go: up one dir, main page]

Skip to content

Tell a revoked device that its access was revoked; listDeviceCertificates - #97

Open
klehmann wants to merge 5 commits into
mainfrom
fix/revoked-device-error
Open

klehmann wants to merge 5 commits into
mainfrom
fix/revoked-device-error

Conversation

@klehmann
Copy link
Copy Markdown
Owner

Requested by Karsten · project thread

Two SDK additions found while testing device self-grant end to end in Haven against a local server.

Changes

A revoked device is told that its access was revoked

openDB answered a revoked device with "does not have tenant access yet; the tenant admin must grant access first", the same text a device gets before it was ever granted. Haven showed that on the Sync page of a revoked tablet.

  • New DeviceAccessRevokedError (exported with isDeviceAccessRevokedError()).
    • Thrown when the device's signing key is kept on one of the person's grants as a revoked pair, or is targeted for remote wipe.
    • Carries wipeRequested.
    • The message starts with Device access revoked, so it is recognised after a network hop too.
  • A device that was never granted keeps the old error.

The sync server tells a revoked device the same

A device that was revoked but not wipe-targeted could not sign in, and the server answered "This device's signing key is not yet in the tenant directory on this server … After the administrator approved the join request, they must sync the directory …". That is the text for a new device whose join was not synced yet.

  • getUserSigningKeyUniverse() now also returns revoked: keys kept on a grant as revoked pairs (listed or certified devices) and not active on any grant. The field is optional in the MindooTenantDirectory interface.
  • AuthenticationService refuses such a key with USER_REVOKED and a message starting with Device access revoked, both when issuing the challenge and in authenticate.
  • The server's TenantManager directory wrapper passes revoked through.

directory.listDeviceCertificates()

listCertifiedDevices(hash) answers which certified devices count now. Haven's user list has time travel and needs every certificate with the trusted time it was accepted and, if the person withdrew it, when. The new method returns that, unfiltered:

Array<{ certificate: DeviceCertificatePayload; issuedAt: number; deletedAt?: number }>

Whether a certificate is valid at T is still decided by resolveSignerToGrant.

Docs

  • docs/accesscontrol.md §6.5: what a revoked device sees (including the server refusal), and how apps apply a wipe (checkAndApplyRemoteWipe / wipeLocalTenant(dbIds)).
  • docs/userkeys.md §9: listDeviceCertificates in the API table.
  • Haven handbook, 8 languages: a new paragraph on removing a lost or stolen device. Revoke and wipe in Manage user now save in every edition. The paragraph covers what the wiped device does on its next connection and what a device that was only revoked shows.

Haven side: klehmann/mindoodb-haven (PR linked below). It works with the published 0.0.95 and uses both additions once they are released.

Test plan

  • RemoteWipe.test.ts, 15 tests:
    • The server refuses a revoked key with "Device access revoked"; a key never on the grant keeps "not yet in the tenant directory".
    • A revoked and wipe-targeted device gets DeviceAccessRevokedError with wipeRequested.
    • The error is still recognised from its message alone.
    • A never-granted device keeps the "not granted yet" error.
  • DeviceCertificates.test.ts, 5 tests:
    • A revoked certified device gets DeviceAccessRevokedError and is listed in revoked of the key universe.
    • listDeviceCertificates lists a revoked device's certificate, and a withdrawn certificate with deletedAt.
  • npx tsc
  • Full npm test: see the comment below for the result.

🤖 Generated with Claude Code

klehmann and others added 5 commits November 15, 2026 03:53
openDB used to answer a revoked device with "does not have tenant access
yet; the tenant admin must grant access first", the same as a device that
was never granted. It now throws DeviceAccessRevokedError (with a
wipeRequested flag) when the device's signing key is kept on the person's
grant as a revoked pair or is targeted for remote wipe.
isDeviceAccessRevokedError() also recognises it by its message prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
listCertifiedDevices answers which certified devices count now. Audit
views (Haven's user list with its time travel) need every certificate
with the trusted time it was accepted and, if the person withdrew it,
when. listDeviceCertificates returns exactly that, unfiltered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Describe revoking and wiping a device in Manage user, available in every
edition, what the wiped device does on its next connection, and what a
revoked device shows, in all eight languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getUserSigningKeyUniverse also returns the revoked keys (revoked pairs not
active on any grant). AuthenticationService refuses them with USER_REVOKED
and a "Device access revoked" message instead of "signing key is not yet in
the tenant directory"; TenantManager passes the list through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@klehmann klehmann self-assigned this Nov 15, 2026
@klehmann
Copy link
Copy Markdown
Owner Author

Test results

  • Full npm test: 237 suites passed, 9 skipped. Tests: 2476 passed, 17 skipped.
  • npx tsc: clean.
  • End to end in Haven (klehmann/mindoodb-haven#417) against a local server built from this branch. A self-added tablet revoked without wipe now gets "Device access revoked: …" at sign-in. Haven shows this as "The tenant admin revoked this device's access". Before, it got "signing key is not yet in the tenant directory … after the administrator approved the join request". After the wipe was ticked, the tablet removed the tenant.

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.

1 participant

0