Skip to content

Latest commit

 

History

History
176 lines (109 loc) · 4.13 KB

IExecStorageModule.md

File metadata and controls

176 lines (109 loc) · 4.13 KB

iexec / Exports / IExecStorageModule

Class: IExecStorageModule

module exposing storage methods

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new IExecStorageModule(configOrArgs, options?): IExecStorageModule

Create an IExecModule instance

Parameters

Name Type
configOrArgs IExecConfig | IExecConfigArgs
options? IExecConfigOptions

Returns

IExecStorageModule

Inherited from

IExecModule.constructor

Properties

config

config: IExecConfig

current IExecConfig

Inherited from

IExecModule.config

Methods

checkStorageTokenExists

checkStorageTokenExists(beneficiaryAddress, options?): Promise<boolean>

check if a storage token exists for the beneficiary in the Secret Management Service

NB: specify the storage provider with the option provider (supported values 'ipfs'|'dropbox' default 'ipfs')

example:

const isIpfsStorageInitialized = await checkStorageTokenExists(userAddress);
console.log('IPFS storage initialized:', isIpfsStorageInitialized);

Parameters

Name Type
beneficiaryAddress string
options? Object
options.provider? string
options.teeFramework? TeeFramework

Returns

Promise<boolean>


defaultStorageLogin

defaultStorageLogin(): Promise<string>

SIGNER REQUIRED, ONLY BENEFICIARY

get an authorization token from the default IPFS based remote storage

example:

const token = await defaultStorageLogin();
const { isPushed } = await pushStorageToken(token);
console.log('default storage initialized:', isPushed);

Returns

Promise<string>


pushStorageToken

pushStorageToken(token, options?): Promise<{ isPushed: boolean ; isUpdated: boolean }>

SIGNER REQUIRED, ONLY BENEFICIARY

push a personal storage token to the Secret Management Service to allow result archive upload

NB:

  • specify the storage provider with the option provider (supported values 'ipfs'|'dropbox' default 'ipfs')
  • this method will throw an error if a token already exists for the target storage provider in the Secret Management Service unless the option forceUpdate: true is used.

example:

  • init default storage
const token = await defaultStorageLogin();
const { isPushed } = await pushStorageToken(token);
console.log('default storage initialized:', isPushed);
  • init dropbox storage
const { isPushed } = await pushStorageToken(dropboxApiToken, {provider: 'dropbox'});
console.log('dropbox storage initialized:', isPushed);

Parameters

Name Type
token string
options? Object
options.forceUpdate? boolean
options.provider? string
options.teeFramework? TeeFramework

Returns

Promise<{ isPushed: boolean ; isUpdated: boolean }>


fromConfig

fromConfig(config): IExecStorageModule

Create an IExecStorageModule instance using an IExecConfig instance

Parameters

Name Type
config IExecConfig

Returns

IExecStorageModule

Overrides

IExecModule.fromConfig