From 00f776d5404e0f5c8f7eec36460a65e258a69d81 Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Fri, 8 Jul 2022 07:42:18 +0300 Subject: [PATCH] add checksum param when fetching fileinfo and checksum aatribute to fileinfo interface --- src/@types/FileInfo.ts | 6 ++++++ src/provider/Provider.ts | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/@types/FileInfo.ts b/src/@types/FileInfo.ts index 6b88d74c..5c591c1a 100644 --- a/src/@types/FileInfo.ts +++ b/src/@types/FileInfo.ts @@ -36,6 +36,12 @@ export interface FileInfo { */ method?: string + /** + * Computed file checksum + * @type {string} + */ + checksum?: string + /** * check if file exists * @type {boolean} diff --git a/src/provider/Provider.ts b/src/provider/Provider.ts index 1b67bc9f..aa47a2c5 100644 --- a/src/provider/Provider.ts +++ b/src/provider/Provider.ts @@ -168,8 +168,9 @@ export class Provider { */ public async checkDidFiles( did: string, - serviceId: number, + serviceId: string, providerUri: string, + withChecksum: boolean = false, signal?: AbortSignal ): Promise { const providerEndpoints = await this.getEndpoints(providerUri) @@ -177,7 +178,7 @@ export class Provider { providerUri, providerEndpoints ) - const args = { did: did, serviceId: serviceId } + const args = { did: did, serviceId: serviceId, checksum: withChecksum } const files: FileInfo[] = [] const path = this.getEndpointURL(serviceEndpoints, 'fileinfo') ? this.getEndpointURL(serviceEndpoints, 'fileinfo').urlPath