Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Simplify Connect Auth Response #951

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

LiranCohen
Copy link
Member

@LiranCohen LiranCohen commented Oct 11, 2024

This PR pulls the portion from submitAuthResponse that creates the authorization grants out into it's own function createAuthResponseGrants.

Additionally, the creation of the JWK is pulled out of the submitAuthResponse method. So a response for the OIDC flow now looks like this:

// Create the Delegate DID
const delegateBearerDid =  await DidJwk.create();
const delegatePortableDid = await delegateBearerDid.export();

// Create the Response Grants
const delegatedGrants = await Oidc.createAuthResponseGrants(
  delegatePortableDid,
  providerIdentity.did.uri,
  authRequest.permissionRequests,
  testHarness.agent
);

// Encrypt and submit the Auth Response
await Oidc.submitAuthResponse(
  providerIdentity.did.uri,
  authRequest,
  randomPin,
  delegateBearerDid,
  delegatedGrants
);

There is further optimization that could be done as well as the clean-up of failed grant authorizations, but I will leave that for after the extended OIDC flow is merged in to avoid too much change.

Copy link

changeset-bot bot commented Oct 11, 2024

🦋 Changeset detected

Latest commit: dae5575

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

This PR includes changesets to release 5 packages
Name Type
@web5/agent Minor
@web5/identity-agent Minor
@web5/proxy-agent Minor
@web5/user-agent Minor
@web5/api 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

Copy link
Contributor

github-actions bot commented Oct 11, 2024

TBDocs Report

✅ No errors or warnings

@web5/api

  • Project entry file: packages/api/src/index.ts

@web5/crypto

  • Project entry file: packages/crypto/src/index.ts

@web5/crypto-aws-kms

  • Project entry file: packages/crypto-aws-kms/src/index.ts

@web5/dids

  • Project entry file: packages/dids/src/index.ts

@web5/credentials

  • Project entry file: packages/credentials/src/index.ts

TBDocs Report Updated at 2024-10-14T18:57:53Z dae5575

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.34%. Comparing base (bd1cb00) to head (dae5575).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #951   +/-   ##
=======================================
  Coverage   93.34%   93.34%           
=======================================
  Files         118      118           
  Lines       33660    33673   +13     
  Branches     2728     2730    +2     
=======================================
+ Hits        31419    31432   +13     
  Misses       2200     2200           
  Partials       41       41           
Components Coverage Δ
agent 87.76% <100.00%> (+0.01%) ⬆️
api 99.61% <ø> (ø)
common 95.02% <ø> (ø)
credentials 94.95% <ø> (ø)
crypto 93.79% <ø> (ø)
dids 97.77% <ø> (ø)
identity-agent 96.42% <ø> (ø)
crypto-aws-kms 100.00% <ø> (ø)
proxy-agent 96.42% <ø> (ø)
user-agent 96.57% <ø> (ø)

@LiranCohen LiranCohen changed the title [WIP] Simplify Connect Auth Response Simplify Connect Auth Response Oct 11, 2024
@LiranCohen LiranCohen marked this pull request as ready for review October 11, 2024 20:25
@LiranCohen LiranCohen force-pushed the lirancohen/process-permissions-request branch from 3b9e435 to afc0c2a Compare October 11, 2024 20:30
@LiranCohen LiranCohen marked this pull request as draft October 21, 2024 14:49
@LiranCohen LiranCohen changed the title Simplify Connect Auth Response [WIP] Simplify Connect Auth Response Oct 21, 2024
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