Skip to content

getProtectedData

This method allows the user to retrieve all protected data for a given owner, data schema, or both. Only protected data objects the invoker has permissions to access are included in the result set. You must include at least one of the optional parameters when invoking this method.

TIP

A data schema is the metadata describing the contents of the protected data object. The schema is returned as part of the protectedData method invocation.

Usage

ts

const 
listProtectedData
= await
dataProtectorCore
.
getProtectedData
({
owner
: '0xa0c15e...',
requiredSchema
: {
email
: 'string',
}, });

Parameters

ts
import { type 
GetProtectedDataParams
} from '@iexec/dataprotector';

requiredSchema

DataSchema | undefined

Provides a list of protected data objects matching this schema.

ts

const 
listProtectedData
= await
dataProtectorCore
.
getProtectedData
({
requiredSchema
: {
email
: 'string',
}, });

owner

AddressOrENS | undefined

Provides a list of protected data objects owned by the user with this ETH address.

ts

const 
listProtectedData
= await
dataProtectorCore
.
getProtectedData
({
owner
: '0xa0c15e...',
});

createdAfterTimestamp

number | undefined

Provides a list of protected data objects created after this timestamp value. The provided value should be in seconde.

ts

const 
listProtectedData
= await
dataProtectorCore
.
getProtectedData
({
owner
: '0xa0c15e...',
createdAfterTimestamp
: 1710257612, // March 12, 2024 15:33:32 GMT
});

page

number | undefined

Specifies the results page to return. The default for this is 0 which returns all results. Pages are indexed starting at page 1. If using this field you may also specify a pageSize to control the size of the results.

ts

const 
listProtectedData
= await
dataProtectorCore
.
getProtectedData
({
owner
: '0xa0c15e...',
createdAfterTimestamp
: 1710257612, // March 12, 2024 15:33:32 GMT
page
: 1,
});

pageSize

number | undefined

default: 20

Value between 10 and 1000.

Specifies the number of records in each page of the result set. This is used in conjunction with the optional page parameter to constrain the size of the result.

ts

const 
listProtectedData
= await
dataProtectorCore
.
getProtectedData
({
owner
: '0xa0c15e...',
createdAfterTimestamp
: 1710257612, // March 12, 2024 15:33:32 GMT
page
: 1,
pageSize
: 100,
});

Return value

ts
import { type 
ProtectedData
} from '@iexec/dataprotector';

ProtectedData[]