Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip the encryption through the Node when there is no files #594

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading