Commit 79173c0 1 parent fe8d3cb commit 79173c0 Copy full SHA for 79173c0
File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -602,12 +602,16 @@ function encryptAuthResponse({
602
602
}
603
603
604
604
function shouldUseDelegatePermission ( scope : DwnPermissionScope ) : boolean {
605
+ // Currently all record permissions are treated as delegated permissions
606
+ // In the future only methods that modify state will be delegated and the rest will be normal permissions
605
607
if ( isRecordPermissionScope ( scope ) ) {
606
608
return true ;
607
609
} else if ( scope . interface === DwnInterfaceName . Protocols && scope . method === DwnMethodName . Configure ) {
610
+ // ProtocolConfigure messages are also delegated, as they modify state
608
611
return true ;
609
612
}
610
613
614
+ // All other permissions are not treated as delegated
611
615
return false ;
612
616
}
613
617
@@ -626,7 +630,6 @@ async function createPermissionGrants(
626
630
// TODO: cleanup all grants if one fails by deleting them from the DWN: https://github.com/TBD54566975/web5-js/issues/849
627
631
const permissionGrants = await Promise . all (
628
632
scopes . map ( ( scope ) => {
629
-
630
633
// check if the scope is a records permission scope, or a protocol configure scope, if so it should use a delegated permission.
631
634
const delegated = shouldUseDelegatePermission ( scope ) ;
632
635
return permissionsApi . createGrant ( {
Original file line number Diff line number Diff line change @@ -481,11 +481,10 @@ export class DwnApi {
481
481
// If the protocol is public, the query should be successful. This allows the app to query for public protocols without having a grant.
482
482
483
483
try {
484
- const protocolFromRequest = request . message . filter ?. protocol ;
485
484
const { grant : { id : permissionGrantId } } = await this . permissionsApi . getPermissionForRequest ( {
486
485
connectedDid : this . connectedDid ,
487
486
delegateDid : this . delegateDid ,
488
- protocol : protocolFromRequest ,
487
+ protocol : request . message . filter . protocol ,
489
488
cached : true ,
490
489
messageType : agentRequest . messageType
491
490
} ) ;
You can’t perform that action at this time.
0 commit comments