Skip to content

getProtectedData

This method allows the user to retrieve all protected data for a given owner, data schema, or both. 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 protectData method invocation.

Usage

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

Parameters

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

requiredSchema Optional

Type: SearchableDataSchema

Provides a list of protected data objects matching this schema.

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

owner Optional

Type: AddressOrENS

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

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

createdAfterTimestamp Optional

Type: number

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

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

page Optional

Type: number

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 Optional

Type: number
Default: 20
Range: [10...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';

See ProtectedData