Skip to content

feat(client): accept only publishable keys in a web page - #14

Merged
MobileMage merged 1 commit into
gatepost-dev:mainfrom
lui01212:feat/browser-publishable-keys
Nov 8, 2026
Merged

MobileMage merged 1 commit into
gatepost-dev:mainfrom
lui01212:feat/browser-publishable-keys

Conversation

@lui01212

Copy link
Copy Markdown
Contributor

Move the spec submodule to 0.4.0 and follow its rules for keys in a browser (SEC-1).
In a page with a document, the client now accepts only a key that starts with
nipost_pk_. It reads the key without the white space around it. A secret key keeps its
message, and any other key raises a TypeError that says it is not a publishable key.
Neither message holds the key. A server client still accepts any key.

The field reads the kind of a refused key. For an unsupported key it raises
gatepost-error with the new code unsupported_key, shows the same text as for a secret
key and logs its own console error. The change also bumps SPEC_VERSION in the four
packages, adds unsupported_key to the messages, the API reports and the READMEs, copies the
new glossary entry into CONTEXT.md and adds two change files.

The new client, key secrecy and field tests failed on the old code, and pass now.
pnpm check passes in a Linux container. I did not run the Node 22 tests or the Firefox
and WebKit journeys.

This follows gatepost-dev/spec#16.

Claude Code helped write the tests, the code, the docs and the change files, and review the diff.

Signed-off-by: Lui Lui 40736418+lui01212@users.noreply.github.com

Move the spec submodule to 0.4.0 and follow its rules for keys in a browser (SEC-1).
In a page with a `document`, the client now accepts only a key that starts with
`nipost_pk_`. It reads the key without the white space around it. A secret key keeps its
message, and any other key raises a `TypeError` that says it is not a publishable key.
Neither message holds the key. A server client still accepts any key.

The field reads the kind of a refused key. For an unsupported key it raises
`gatepost-error` with the new code `unsupported_key`, shows the same text as for a secret
key and logs its own console error. The change also bumps `SPEC_VERSION` in the four
packages, adds `unsupported_key` to the messages, the API reports and the READMEs, copies the
new glossary entry into `CONTEXT.md` and adds two change files.

The new client, key secrecy and field tests failed on the old code, and pass now.
`pnpm check` passes in a Linux container. I did not run the Node 22 tests or the Firefox
and WebKit journeys.

This follows gatepost-dev/spec#16.

Claude Code helped write the tests, the code, the docs and the change files, and review the diff.

Signed-off-by: Lui Lui <40736418+lui01212@users.noreply.github.com>
@lui01212

lui01212 commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@MobileMage gentle ping on this one when you have time. It's the js side of spec 0.4.0 you mentioned on gatepost-dev/spec#16, and I'm happy to rebase or split it if that's easier to review.

@MobileMage
MobileMage merged commit f3b3649 into gatepost-dev:main Nov 8, 2026
11 checks passed
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.

2 participants