Skip to content

Pass provisionKeys to IdP registration flow#455

Merged
melvincarvalho merged 2 commits into
gh-pagesfrom
issue-454-registration-provision-keys
May 14, 2026
Merged

Pass provisionKeys to IdP registration flow#455
melvincarvalho merged 2 commits into
gh-pagesfrom
issue-454-registration-provision-keys

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Summary

Fixes #454

  • The browser registration path (handleRegisterPost in interactions.js) called createPodStructure without passing the provisionKeys option, so pods created via IdP registration never got owner keys — even when --provision-keys / "provisionKeys": true was set in config.
  • provisionKeysEnabled was not attached to the Fastify request object, so IdP handlers had no way to access it.
  • Two-line fix: add request.provisionKeys to the onRequest hook in server.js, pass it through in interactions.js.

Test plan

  • Register a new account via browser with provisionKeys: true in config
  • Verify /private/privkey.jsonld exists in the new pod
  • Verify the WebID profile at /profile/card.jsonld contains the verification method
  • Verify existing POST /.pods endpoint still works with provisionKeys

The browser registration path called createPodStructure without the
provisionKeys option, so pods created via IdP never got owner keys
even when --provision-keys was enabled.

- Attach provisionKeysEnabled to the Fastify request object in the
  onRequest hook so IdP handlers can access the config value.
- Pass { provisionKeys: request.provisionKeys } in the registration
  handler's createPodStructure call.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR wires the server-level provisionKeys configuration into the IdP browser registration flow so pods created through registration can provision owner keys consistently with other pod creation paths.

Changes:

  • Adds request.provisionKeys assignment in the server request hook.
  • Passes the strict boolean provisioning option into createPodStructure during IdP registration.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/server.js Exposes the resolved provision-keys flag on incoming requests.
src/idp/interactions.js Passes the provision-keys option when creating a pod during registration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/server.js
request.mashlibVersion = mashlibVersion;
request.mashlibModule = mashlibModule;
request.defaultQuota = defaultQuota;
request.provisionKeys = provisionKeysEnabled;
Comment thread src/idp/interactions.js
Comment on lines +546 to +547
await createPodStructure(username, webId, podUri, issuer, 0,
{ provisionKeys: request.provisionKeys === true });
Register provisionKeys on the Fastify request prototype via
decorateRequest to keep the request shape stable, matching the
pattern used by all other request-attached config fields.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/idp/interactions.js
Comment on lines +546 to +547
await createPodStructure(username, webId, podUri, issuer, 0,
{ provisionKeys: request.provisionKeys === true });
@melvincarvalho
melvincarvalho merged commit 9931c84 into gh-pages May 14, 2026
5 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.

IdP registration flow doesn't pass provisionKeys to createPodStructure

2 participants