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

Simplify Connect Auth Response #951

Open
wants to merge 4 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: afc0c2a

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-11T20:35:03Z afc0c2a

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 (afc0c2a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #951   +/-   ##
=======================================
  Coverage   93.34%   93.34%           
=======================================
  Files         118      118           
  Lines       33660    33665    +5     
  Branches     2728     2728           
=======================================
+ Hits        31419    31424    +5     
- Misses       2200     2201    +1     
+ Partials       41       40    -1     
Components Coverage Δ
agent 87.75% <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
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