diff --git a/package.json b/package.json index a0463a91e..544281fe9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nevermined-io/sdk", - "version": "2.0.0-rc15", + "version": "2.0.0-rc16", "description": "Javascript SDK for connecting with Nevermined Data Platform ", "main": "./dist/node/sdk.js", "typings": "./dist/node/sdk.d.ts", diff --git a/src/nevermined/api/RegistryBaseApi.ts b/src/nevermined/api/RegistryBaseApi.ts index 7e952a510..8f32390d9 100644 --- a/src/nevermined/api/RegistryBaseApi.ts +++ b/src/nevermined/api/RegistryBaseApi.ts @@ -132,12 +132,15 @@ export abstract class RegistryBaseApi extends Instantiable { let encryptedFiles, encryptedAttributes if (!['workflow'].includes(assetAttributes.metadata.main.type)) { - const encryptedFilesResponse = await this.nevermined.services.node.encrypt( - ddo.id, - JSON.stringify(assetAttributes.metadata.main.files), - new String(assetAttributes.encryptionMethod), - ) - encryptedFiles = JSON.parse(encryptedFilesResponse)['hash'] + if (assetAttributes.metadata.main.files) { + // If we have files to encrypt we encrypt them + const encryptedFilesResponse = await this.nevermined.services.node.encrypt( + ddo.id, + JSON.stringify(assetAttributes.metadata.main.files), + new String(assetAttributes.encryptionMethod), + ) + encryptedFiles = JSON.parse(encryptedFilesResponse)['hash'] + } if (assetAttributes.metadata.main.type === 'service') { const encryptedServiceAttributesResponse = await this.nevermined.services.node.encrypt(