From e2e18857e15d2e969a5c971f794612fc77d47b22 Mon Sep 17 00:00:00 2001 From: Liran Cohen Date: Mon, 5 Aug 2024 17:06:55 -0400 Subject: [PATCH] refactor grant methods into util --- packages/agent/src/store-data.ts | 6 ++---- packages/agent/src/types/dwn.ts | 1 + packages/agent/src/types/identity.ts | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/agent/src/store-data.ts b/packages/agent/src/store-data.ts index 21060e558..376fdc68c 100644 --- a/packages/agent/src/store-data.ts +++ b/packages/agent/src/store-data.ts @@ -7,7 +7,7 @@ import type { Web5PlatformAgent } from './types/agent.js'; import { TENANT_SEPARATOR } from './utils-internal.js'; import { getDataStoreTenant } from './utils-internal.js'; -import { DwnInterface } from './types/dwn.js'; +import { DwnInterface, DwnMessageParams } from './types/dwn.js'; import { ProtocolDefinition } from '@tbd54566975/dwn-sdk-js'; export type DataStoreTenantParams = { @@ -74,9 +74,7 @@ export class DwnDataStore = Jwk> implem /** * Properties to use when writing and querying records with the DWN store. */ - protected _recordProperties = { - dataFormat: 'application/json', - }; + protected _recordProperties!: DwnMessageParams[DwnInterface.RecordsWrite]; public async delete({ id, agent, tenant }: DataStoreDeleteParams): Promise { // Determine the tenant identifier (DID) for the delete operation. diff --git a/packages/agent/src/types/dwn.ts b/packages/agent/src/types/dwn.ts index a2a21d408..e27743d97 100644 --- a/packages/agent/src/types/dwn.ts +++ b/packages/agent/src/types/dwn.ts @@ -256,6 +256,7 @@ export { DwnConstant, Signer as DwnSigner, DateSort as DwnDateSort, + DataEncodedRecordsWriteMessage as DwnDataEncodedRecordsWriteMessage, PublicJwk as DwnPublicKeyJwk, // TODO: Remove once DWN SDK switches to Jwk from @web5/crypto PaginationCursor as DwnPaginationCursor, MessageSubscriptionHandler as DwnMessageSubscriptionHandler, diff --git a/packages/agent/src/types/identity.ts b/packages/agent/src/types/identity.ts index dbc429983..f553b4b9d 100644 --- a/packages/agent/src/types/identity.ts +++ b/packages/agent/src/types/identity.ts @@ -7,6 +7,8 @@ export interface IdentityMetadata { name: string; tenant: string; uri: string; + /** connectedDid is the DID which the identity acts on behalf of using permissions */ + connectedDid?: string; } export interface PortableIdentity {