iexec / IExecResultModule
module exposing result methods
new IExecResultModule(
configOrArgs,options?):IExecResultModule
Create an IExecModule instance
IExecResultModule
config:
IExecConfig
current IExecConfig
checkResultEncryptionKeyExists(
beneficiaryAddress,options):Promise<boolean>
check if a beneficiary result encryption key exists in the Secret Management Service
example:
const isEncryptionKeyAvailable = await checkResultEncryptionKeyExists(userAddress);
console.log('encryption key available:', isEncryptionKeyAvailable);string
Promise<boolean>
pushResultEncryptionKey(
rsaPublicKey,options?):Promise<{isPushed:boolean;isUpdated:boolean; }>
SIGNER REQUIRED, ONLY BENEFICIARY
push a beneficiary result encryption key to the Secret Management Service to allow result encryption
rsaPublicKey can be either:
- a PEM-formatted RSA public key
- a PEM-formatted RSA public key encoded in base64 (it will start with
LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0) - a CryptoKey generated by
crypto.subtle.generateKeywith the following parameters:const { publicKey } = await crypto.subtle.generateKey( { name: 'RSA-OAEP', modulusLength: 4096, publicExponent: new Uint8Array([1, 0, 1]), hash: 'SHA-256', }, true, ['encrypt', 'decrypt'] );
NB: this method will throw an error if a beneficiary result encryption key already exists in the Secret Management Service unless the option forceUpdate: true is used.
example:
const { isPushed } = await pushResultEncryptionKey(
`-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0gKRKKNCLe1O+A8nRsOc
gnnvLwE+rpvmKnjOTzoR8ZBTaIjD1dqlhPyJ3kgUnKyCNqru9ayf0srUddwj+20N
zdLvhI03cYD+GFYM6rrGvaUekGZ43f309f3wOrQjNkTeGo+K+hloHL/gmuN/XML9
MST/01+mdCImPdG+dxk4RQAsFS7HE00VXsVjcLGeZ95AKILFJKLbCOJxxvsQ+L1g
rameEwTUF1Mb5TJnV44YZJiCKYFj6/6zrZ3+pdUjxBSN96iOyE2KiYeNuhEEJbjb
4rWl+TpWLmDkLIeyL3TpDTRedaXVx6h7DOOphX5vG63+5UIHol3vJwPbeODiFWH0
hpFcFVPoW3wQgEpSMhUabg59Hc0rnXfM5nrIRS+SHTzjD7jpbSisGzXKcuHMc69g
brEHGJsNnxr0A65PzN1RMJGq44lnjeTPZnjWjM7PnnfH72MiWmwVptB38QP5+tao
UJu9HvZdCr9ZzdHebO5mCWIBKEt9bLRa2LMgAYfWVg21ARfIzjvc9GCwuu+958GR
O/VhIFB71aaAxpGmK9bX5U5QN6Tpjn/ykRIBEyY0Y6CJUkc33KhVvxXSirIpcZCO
OY8MsmW8+J2ZJI1JA0DIR2LHingtFWlQprd7lt6AxzcYSizeWVTZzM7trbBExBGq
VOlIzoTeJjL+SgBZBa+xVC0CAwEAAQ==
-----END PUBLIC KEY-----`,
);
console.log('encryption key pushed:', isPushed);string | CryptoKey
boolean
Promise<{ isPushed: boolean; isUpdated: boolean; }>
staticfromConfig(config):IExecResultModule
Create an IExecResultModule instance using an IExecConfig instance
IExecResultModule