-
Notifications
You must be signed in to change notification settings - Fork 57
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
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
Codecov Report
@@ 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
|
44d1b3c
to
eafd2d6
Compare
eafd2d6
to
a7e015b
Compare
packages/api/src/dwn-api.ts
Outdated
@@ -91,6 +106,11 @@ export type RecordsWriteRequest = { | |||
store?: boolean; | |||
} | |||
|
|||
export type PermissionGrantRequest = { |
There was a problem hiding this comment.
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?
packages/api/src/dwn-api.ts
Outdated
import { PermissionsGrant } from '@tbd54566975/dwn-sdk-js'; | ||
import { PermissionsGrantMessage } from '@tbd54566975/dwn-sdk-js'; | ||
import { PermissionsGrantOptions } from '@tbd54566975/dwn-sdk-js'; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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()', () => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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'
Minimum permissions interface to expose to unblock delegated permissions grants.
dwn.permissions.send()
will be extended in a future PR to to send otherPermissions
interface messages.