From 30b21096811089c0376fbe9d98f5236542d5d86f Mon Sep 17 00:00:00 2001 From: Tim Shamilov Date: Wed, 23 Oct 2024 15:50:53 -0400 Subject: [PATCH] tiny cleanup --- packages/agent/src/connect.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/agent/src/connect.ts b/packages/agent/src/connect.ts index 38d850226..43c81def3 100644 --- a/packages/agent/src/connect.ts +++ b/packages/agent/src/connect.ts @@ -115,14 +115,8 @@ async function initClient({ const normalizedPermissionRequests = permissionRequests.map( ({ protocolDefinition, permissions }) => WalletConnect.createPermissionRequestForProtocol({ - definition : protocolDefinition, - permissions : permissions ?? [ - 'read', - 'write', - 'delete', - 'query', - 'subscribe', - ], + definition: protocolDefinition, + permissions, }) ); @@ -256,9 +250,17 @@ function createPermissionRequestForProtocol({ /** The protocol definition for the protocol being requested */ definition: DwnProtocolDefinition; - /** The permissions being requested for the protocol */ - permissions: Permission[]; + /** The permissions being requested for the protocol. Defaults to all. */ + permissions?: Permission[]; }) { + permissions ??= [ + 'read', + 'write', + 'delete', + 'query', + 'subscribe', + ]; + const requests: DwnPermissionScope[] = []; // Add the ability to query for the specific protocol