Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilovtim committed Oct 24, 2024
1 parent e83dcc8 commit 1b396bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/agent/src/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ async function createPermissionGrants(
const permissionsApi = new AgentPermissionsApi({ agent });

// TODO: cleanup all grants if one fails by deleting them from the DWN: https://github.com/TBD54566975/web5-js/issues/849
logger.log(`Creating permission grants for ${scopes.length} scopes given...`);
const permissionGrants = await Promise.all(
scopes.map((scope) => {
// check if the scope is a records permission scope, or a protocol configure scope, if so it should use a delegated permission.
Expand Down Expand Up @@ -864,7 +865,7 @@ async function submitAuthResponse(
delegatePortableDid,
});

// Sign using the signing key
logger.log('Signing auth response object...');
const responseObjectJwt = await Oidc.signJwt({
did : providerSigningDid,
data : responseObject,
Expand All @@ -881,6 +882,7 @@ async function submitAuthResponse(
clientEcdhDid?.didDocument
);

logger.log('Encrypting auth response object...');
const encryptedResponse = Oidc.encryptWithPin({
jwt : responseObjectJwt,
encryptionKey : sharedKey,
Expand All @@ -893,6 +895,9 @@ async function submitAuthResponse(
state : authRequest.state,
}).toString();

logger.log(
`Sending auth response object to Web5 Connect server: ${authRequest.redirect_uri}`
);
await fetch(authRequest.redirect_uri, {
body : formEncodedRequest,
method : 'POST',
Expand Down

0 comments on commit 1b396bd

Please sign in to comment.