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

Expose DWN PermissionsGrant Message #252

Closed
wants to merge 3 commits into from
Closed

Conversation

diehuxx
Copy link

@diehuxx diehuxx commented Nov 1, 2023

Minimum permissions interface to expose to unblock delegated permissions grants.

dwn.permissions.send() will be extended in a future PR to to send other Permissions interface messages.

Copy link

codesandbox bot commented Nov 1, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Merging #252 (c1b83d7) into main (d1a85cd) will increase coverage by 0.04%.
Report is 3 commits behind head on main.
The diff coverage is 95.34%.

@@            Coverage Diff             @@
##             main     #252      +/-   ##
==========================================
+ Coverage   90.94%   90.99%   +0.04%     
==========================================
  Files          69       69              
  Lines       13314    13399      +85     
  Branches     1340     1346       +6     
==========================================
+ Hits        12109    12192      +83     
- Misses       1180     1182       +2     
  Partials       25       25              
Components Coverage Δ
api 94.69% <100.00%> (+0.35%) ⬆️
common 95.00% <ø> (ø)
credentials 92.77% <ø> (ø)
crypto 100.00% <ø> (ø)
dids 91.58% <ø> (ø)
agent 88.13% <60.00%> (-0.03%) ⬇️
identity-agent 59.05% <ø> (ø)
proxy-agent 58.59% <ø> (ø)
user-agent 57.36% <ø> (ø)

@diehuxx diehuxx force-pushed the diehuxx/permissions branch 2 times, most recently from 44d1b3c to eafd2d6 Compare November 2, 2023 00:43
@diehuxx diehuxx force-pushed the diehuxx/permissions branch from eafd2d6 to a7e015b Compare November 2, 2023 00:46
@diehuxx diehuxx marked this pull request as ready for review November 2, 2023 03:17
@@ -91,6 +106,11 @@ export type RecordsWriteRequest = {
store?: boolean;
}

export type PermissionGrantRequest = {
Copy link
Contributor

Choose a reason for hiding this comment

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

@diehuxx This type appears to be a duplicate. It isn't used anywhere as best I can tell. Should it be removed?

Comment on lines 23 to 25
import { PermissionsGrant } from '@tbd54566975/dwn-sdk-js';
import { PermissionsGrantMessage } from '@tbd54566975/dwn-sdk-js';
import { PermissionsGrantOptions } from '@tbd54566975/dwn-sdk-js';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these be consolidated into the existing import statement a few lines up?

@@ -184,8 +188,11 @@ export class DwnManager {
});
dwnRpcRequest.message = message;
messageData = data;

} else if ('message' in request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@diehuxx The approach to sending a PermissionsGrant is different than how both Record and ProtocolsConfigure messages are sent to a remote DWN. What was the motivation for introducing a new message property to the send request object?

Copy link
Author

Choose a reason for hiding this comment

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

I've been wanting to make that addition separate of PermissionsGrants. The existing code forces an existing message to be turned into options then re built and signed. Why not just send the existing message?

@@ -569,4 +571,57 @@ describe('DwnApi', () => {
});
});
});

describe('permissions.grant()', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could a test for sending a PermissionsGrant to a remote DWN be added in this PR?

Copy link
Author

Choose a reason for hiding this comment

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

If I understand agents correctly, setting dwn.permissions.grant(target : bobDid.did, ...) will send to a remote. We do that in the test in describe('target: did'

@diehuxx diehuxx closed this Dec 21, 2023
@frankhinek frankhinek deleted the diehuxx/permissions branch February 17, 2024 12:28
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.

2 participants