Skip to content

Commit

Permalink
fix: skip the encryption through the Node when there is no files
Browse files Browse the repository at this point in the history
  • Loading branch information
aaitor committed Oct 9, 2023
1 parent a3d608a commit 53d2658
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
15 changes: 9 additions & 6 deletions src/nevermined/api/RegistryBaseApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 53d2658

Please sign in to comment.