mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Fix linter errors.
This commit is contained in:
parent
88b8eb06c6
commit
cdbc4c93a1
@ -95,7 +95,11 @@ export class Brizo extends Instantiable {
|
|||||||
consumeUrl += `&signature=${signature}`
|
consumeUrl += `&signature=${signature}`
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.ocean.utils.fetch.downloadFile(consumeUrl, destination, i)
|
await this.ocean.utils.fetch.downloadFile(
|
||||||
|
consumeUrl,
|
||||||
|
destination,
|
||||||
|
i
|
||||||
|
)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error('Error consuming assets')
|
this.logger.error('Error consuming assets')
|
||||||
this.logger.error(e)
|
this.logger.error(e)
|
||||||
|
@ -268,8 +268,10 @@ export class OceanAssets extends Instantiable {
|
|||||||
ddo.findServiceByType('Authorization').serviceEndpoint
|
ddo.findServiceByType('Authorization').serviceEndpoint
|
||||||
)
|
)
|
||||||
const downloads = files
|
const downloads = files
|
||||||
.filter(({index: i}) => index === -1 || index === i)
|
.filter(({ index: i }) => index === -1 || index === i)
|
||||||
.map(({url, index: i}) => this.ocean.utils.fetch.downloadFile(url, resultPath, i))
|
.map(({ url, index: i }) =>
|
||||||
|
this.ocean.utils.fetch.downloadFile(url, resultPath, i)
|
||||||
|
)
|
||||||
await Promise.all(downloads)
|
await Promise.all(downloads)
|
||||||
}
|
}
|
||||||
this.logger.log('Files consumed')
|
this.logger.log('Files consumed')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import SecretStore from "@oceanprotocol/secret-store-client"
|
import SecretStore from '@oceanprotocol/secret-store-client'
|
||||||
import SecretStoreConfig from "@oceanprotocol/secret-store-client/dist/models/SecretStoreConfig"
|
import SecretStoreConfig from '@oceanprotocol/secret-store-client/dist/models/SecretStoreConfig'
|
||||||
|
|
||||||
import Account from './Account'
|
import Account from './Account'
|
||||||
import { noDidPrefixed } from '../utils'
|
import { noDidPrefixed } from '../utils'
|
||||||
@ -59,13 +59,20 @@ export class OceanSecretStore extends Instantiable {
|
|||||||
* @param {string} consumer cONSUMER account.
|
* @param {string} consumer cONSUMER account.
|
||||||
* @return {Promise<string>} Encrypted text.
|
* @return {Promise<string>} Encrypted text.
|
||||||
*/
|
*/
|
||||||
public async decrypt(did: string, content: string, consumer?: Account, secretStoreUrl?: string): Promise<any> {
|
public async decrypt(
|
||||||
return await this.getSecretStoreByAccount(consumer, secretStoreUrl)
|
did: string,
|
||||||
.decryptDocument(noDidPrefixed(did), content)
|
content: string,
|
||||||
|
consumer?: Account,
|
||||||
|
secretStoreUrl?: string
|
||||||
|
): Promise<any> {
|
||||||
|
return this.getSecretStoreByAccount(
|
||||||
|
consumer,
|
||||||
|
secretStoreUrl
|
||||||
|
).decryptDocument(noDidPrefixed(did), content)
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSecretStoreByAccount(account: Account, secretStoreUrl?: string) {
|
private getSecretStoreByAccount(account: Account, secretStoreUrl?: string) {
|
||||||
const config: any = {...this.config}
|
const config: any = { ...this.config }
|
||||||
if (account) {
|
if (account) {
|
||||||
config.address = account.getId()
|
config.address = account.getId()
|
||||||
}
|
}
|
||||||
@ -79,8 +86,14 @@ export class OceanSecretStore extends Instantiable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getSecretStore(config: SecretStoreConfig): SecretStore {
|
private getSecretStore(config: SecretStoreConfig): SecretStore {
|
||||||
const {secretStoreUri, parityUri, password, address, threshold} = config
|
const {
|
||||||
config = {secretStoreUri, parityUri, password, address, threshold}
|
secretStoreUri,
|
||||||
|
parityUri,
|
||||||
|
password,
|
||||||
|
address,
|
||||||
|
threshold
|
||||||
|
} = config
|
||||||
|
config = { secretStoreUri, parityUri, password, address, threshold }
|
||||||
|
|
||||||
return new SecretStore(config)
|
return new SecretStore(config)
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import fetch, { BodyInit, RequestInit, Response } from 'node-fetch'
|
import fetch, { BodyInit, RequestInit, Response } from 'node-fetch'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import save = require('save-file')
|
|
||||||
|
|
||||||
import { Instantiable, InstantiableConfig } from '../../Instantiable.abstract'
|
import { Instantiable, InstantiableConfig } from '../../Instantiable.abstract'
|
||||||
|
|
||||||
|
import save = require('save-file')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a common interface to web services.
|
* Provides a common interface to web services.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user