Skip to content

Key removal under Advanced; profile-key logic in a tested library - #7

Merged
melvincarvalho merged 2 commits into
gh-pagesfrom
keys-and-tests
Oct 22, 2026
Merged

melvincarvalho merged 2 commits into
gh-pagesfrom
keys-and-tests

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Two commits.

Library and tests. The merge, idempotence, fragment-choice and removal rules move out of doctor.js into pure functions in lib/profile-keys.js (find the method holding a key, merge one in, take one out, next free #nostr-key-N). test/profile-keys.test.js covers them with fixtures using relative and absolute ids, string and object entries, single values and arrays. package.json gains test and check (syntax plus vendored checksums); a workflow runs both on push and PR.

Removal. Under Advanced, "Nostr keys in this profile" lists every Multikey method that encodes a Nostr key, with a Remove button that asks twice, then PUTs the profile without the method and without any authentication or assertionMethod reference to it.

Verified against a local JSS: a second key linked as #nostr-key-2, listed, removed; the profile afterwards holds only #nostr-key-1. Note that JSS caches profile lookups on the NIP-98 path for five minutes (src/auth/cid-doc-fetch.js), so a removed key keeps working for up to that long; the note on the page says so.

The merge, idempotence, fragment choice and removal rules move out of the
page into pure functions (find a method by key, merge one in, take one out,
next free fragment), covered by node --test fixtures with relative and
absolute ids, string and object entries. package.json gains test and check
scripts; a workflow runs both.
For a lost or replaced key: the keys the pod accepts are listed with a
Remove button that asks twice, then PUTs the profile without the method and
without any authentication or assertionMethod reference to it. The page uses
the shared lib for merging too.
@melvincarvalho
melvincarvalho merged commit 1bcc003 into gh-pages Oct 22, 2026
1 check passed
@melvincarvalho
melvincarvalho deleted the keys-and-tests branch October 22, 2026 12:00
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