Skip to content

feat: directed identity#26

Open
BlairCurrey wants to merge 5 commits intomainfrom
blair/directed-identity
Open

feat: directed identity#26
BlairCurrey wants to merge 5 commits intomainfrom
blair/directed-identity

Conversation

@BlairCurrey
Copy link
Contributor

Changes proposed in this pull request

  • changes init function to support jwk while remaining backwards compatible

Context

fixes #21

@BlairCurrey BlairCurrey requested a review from njlie February 24, 2026 20:32
@changeset-bot
Copy link

changeset-bot bot commented Feb 24, 2026

🦋 Changeset detected

Latest commit: 1ec7267

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@interledger/open-payments Minor
example-peer-to-peer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines +292 to +295
/** @deprecated Use `client` instead. */
walletAddressUrl?: string
/** The client identifier for grant requests. Provide either a JWK or a wallet address URL. */
client?: ClientIdentifier
Copy link
Contributor Author

@BlairCurrey BlairCurrey Feb 24, 2026

Choose a reason for hiding this comment

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

I also considered not deprecating walletAddressUrl and instead making it optional alongside a new optional jwk.

My thinking with new optional client and making walletAddressUrl optional is that it will enforce mutual exclusivity at the type level in the future. After we give time to migrate we can remove walletAddressUrl and require client. Although I dont hate optional walletAddressUrl and jwk with run-time checks tbh. Thoughts?

Also I chose the name client here for consistency with our internals but I also considered identifier, "clientIdentifier" etc. And I think from the client user's perspective they wont necessarily know anything about the internal representation as client (the open api spec, auth db field name, etc.) so maybe there is a case to be made for one of those names?

Copy link

Choose a reason for hiding this comment

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

Fields like client and identifier are derived from their meaning in GNAP, so I would suppose that changing this field name would mean we don't need the OP SDK to pass through GNAP concepts directly.

Copy link
Contributor Author

@BlairCurrey BlairCurrey Feb 25, 2026

Choose a reason for hiding this comment

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

In principal I dont necessarily think the OP SDK needs to expose the GNAP concepts. I guess to this point we already didn't exposethis GNAP concept directly - walletAddressUrl as opposed to client. But in practice the client does mirror GNAP concepts in a lot of ways and probably unavoidable (the whole concept of grant requests, access items, etc.). And I do want to avoid using the same names to mean something entirely different. Perhaps identifier would do that. It looks like client does encapsulate both the key itself or some reference to it. Maybe we leave as-is.

@BlairCurrey BlairCurrey requested a review from mkurapov February 24, 2026 20:40
@BlairCurrey BlairCurrey changed the title Blair/directed identity feat: directed identity Feb 24, 2026
body: {
...args,
client
client:
Copy link

Choose a reason for hiding this comment

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

Should this also handle if someone is using client: { walletAddressUrl } as well instead of in the backwards-compatible way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it handles all cases as-is but I'm not sure if I'm completely following. So correct me if I have something wrong.

createAuthenticatedClient supports passing in either the walletAddressUrl: string or a client like:

type ClientIdentifier =
  | { jwk: JWK; walletAddressUrl?: never }
  | { walletAddressUrl: string; jwk?: never }

If the client is initialized in the old way with a walletAddressUrl string, it will get converted to the ClientIdentifier form before this point (line 370 in index.ts). Then it's passed into createGrantRoutes and injected into the post body here - always as the object.

So we arent using the full range of options the api spec allows for the actual request - just the object, not the string. Functionally its the same and it saves migration away from passing the string later. But in terms of initializing the client, any form can be used.

Comment on lines +292 to +295
/** @deprecated Use `client` instead. */
walletAddressUrl?: string
/** The client identifier for grant requests. Provide either a JWK or a wallet address URL. */
client?: ClientIdentifier
Copy link

Choose a reason for hiding this comment

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

Fields like client and identifier are derived from their meaning in GNAP, so I would suppose that changing this field name would mean we don't need the OP SDK to pass through GNAP concepts directly.

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.

[Draft] Support directed identity

2 participants