Skip to content

Commit c838c64

Browse files
committed
feat: add @mage-sombre/iapp dependency and update sidebar with new SDK methods
1 parent ea0832d commit c838c64

File tree

13 files changed

+1851
-4
lines changed

13 files changed

+1851
-4
lines changed

.vitepress/sidebar.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,45 @@ export function getSidebar() {
473473
},
474474
{
475475
text: 'SDK',
476-
link: '/references/iapp-generator/sdk',
476+
collapsed: true,
477+
items: [
478+
{
479+
text: 'getIApp',
480+
link: '/references/iapp-generator/sdk/getIApp',
481+
},
482+
{
483+
text: 'transferOwnership',
484+
link: '/references/iapp-generator/sdk/transferOwnership',
485+
},
486+
{
487+
text: 'grantAccess',
488+
link: '/references/iapp-generator/sdk/grantAccess',
489+
},
490+
{
491+
text: 'getGrantedAccess',
492+
link: '/references/iapp-generator/sdk/getGrantedAccess',
493+
},
494+
{
495+
text: 'revokeOneAccess',
496+
link: '/references/iapp-generator/sdk/revokeOneAccess',
497+
},
498+
{
499+
text: 'revokeAllAccess',
500+
link: '/references/iapp-generator/sdk/revokeAllAccess',
501+
},
502+
{
503+
text: 'runIApp',
504+
link: '/references/iapp-generator/sdk/runIApp',
505+
},
506+
{
507+
text: 'getResultFromCompletedTask',
508+
link: '/references/iapp-generator/sdk/getResultFromCompletedTask',
509+
},
510+
{
511+
text: 'Types',
512+
link: '/references/iapp-generator/sdk/types',
513+
},
514+
],
477515
},
478516
],
479517
},

package-lock.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@iexec/dataprotector-deserializer": "^0.1.1",
1616
"@iexec/web3mail": "^1.5.0",
1717
"@iexec/web3telegram": "^0.1.0-alpha.4",
18+
"@mage-sombre/iapp": "^1.0.0-beta.2",
1819
"@reown/appkit": "^1.7.17",
1920
"@reown/appkit-adapter-wagmi": "^1.7.17",
2021
"@tailwindcss/vite": "^4.1.11",

src/references/dataProtector/dataProtectorCore/getResultFromCompletedTask.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,7 @@ import { type GetResultFromCompletedTaskResponse } from '@iexec/dataprotector';
135135

136136
The actual content of the protected file.
137137

138-
```
139-
140138
<script setup>
141139
import RequiredBadge from '@/components/RequiredBadge.vue'
142140
import OptionalBadge from '@/components/OptionalBadge.vue'
143141
</script>
144-
```
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
---
2+
title: getGrantedAccess
3+
description:
4+
Retrieve all granted access details for a protected data object with iExec's
5+
getGrantedAccess method. Filter access by user, application, or both, and
6+
manage access with pagination.
7+
---
8+
9+
# getGrantedAccess
10+
11+
This method provides a listing of all access grants given for the specified
12+
protected data object. Options for filtering include specifying an authorized
13+
user, an authorized app, or both.
14+
15+
## Usage
16+
17+
The request object is a JSON `GetGrantedAccessParams` object. Each address in
18+
the object is a string representation of an ethereum address or ENS name
19+
(Ethereum Name Service) reference.
20+
21+
```ts twoslash
22+
import { IExecIApp, getWeb3Provider } from '@mage-sombre/iapp';
23+
24+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
25+
const dataProtectorCore = new IExecIApp(web3Provider);
26+
// ---cut---
27+
const listGrantedAccess = await dataProtectorCore.getGrantedAccess({
28+
protectedData: '0x123abc...',
29+
authorizedApp: '0x456def...',
30+
authorizedUser: '0x789cba...',
31+
page: 1,
32+
pageSize: 100,
33+
});
34+
```
35+
36+
## Parameters
37+
38+
```ts twoslash
39+
import { type GetGrantedAccessParams } from '@mage-sombre/iapp';
40+
```
41+
42+
### protectedData <OptionalBadge />
43+
44+
**Type:** `AddressOrENS`
45+
46+
Address of the protected data object for which you are querying access
47+
authorization grants. It's a representation of ethereum address or ENS name
48+
(Ethereum Name Service). If no address is specified, it will return all granted
49+
access for any protected data.
50+
51+
**Usage example:**
52+
53+
```ts twoslash
54+
import { IExecIApp, getWeb3Provider } from '@mage-sombre/iapp';
55+
56+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
57+
const dataProtectorCore = new IExecIApp(web3Provider);
58+
// ---cut---
59+
const listGrantedAccess = await dataProtectorCore.getGrantedAccess({
60+
protectedData: '0x123abc...', // [!code focus]
61+
});
62+
```
63+
64+
### authorizedApp <OptionalBadge />
65+
66+
**Type:** `AddressOrENS`
67+
68+
Optional filter to restrict the results to include only authorizations for the
69+
specified application. It's a representation of ethereum address or ENS name
70+
(Ethereum Name Service). If no address is specified, it will return all granted
71+
access for any application.
72+
73+
**Usage example:**
74+
75+
```ts twoslash
76+
import { IExecIApp, getWeb3Provider } from '@mage-sombre/iapp';
77+
78+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
79+
const dataProtectorCore = new IExecIApp(web3Provider);
80+
// ---cut---
81+
const listGrantedAccess = await dataProtectorCore.getGrantedAccess({
82+
authorizedApp: '0x456def...', // [!code focus]
83+
});
84+
```
85+
86+
::: tip
87+
88+
If you specified an application whitelist when using
89+
[`grantAccess`](/references/dataProtector/dataProtectorCore/grantAccess), you
90+
must specify that same whitelist address when using this filtering option. The
91+
`getGrantedAccess` method does not check against whitelist smart contracts when
92+
aggregating results. If you granted authorization to a whitelist but specify an
93+
application address for the `authorizedApp` parameter, you will not receive any
94+
results unless you _also_ explicitly granted access to that application address.
95+
96+
:::
97+
98+
### authorizedUser <OptionalBadge />
99+
100+
**Type:** `AddressOrENS`
101+
102+
Optional filter to restrict the results to include only authorizations for the
103+
specified user. It's a string representation of ethereum address or ENS name
104+
(Ethereum Name Service). If no address is specified, it will return all granted
105+
access for any user.
106+
107+
**Usage example:**
108+
109+
```ts twoslash
110+
import { IExecIApp, getWeb3Provider } from '@mage-sombre/iapp';
111+
112+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
113+
const dataProtectorCore = new IExecIApp(web3Provider);
114+
// ---cut---
115+
const listGrantedAccess = await dataProtectorCore.getGrantedAccess({
116+
authorizedUser: '0x789cba...', // [!code focus]
117+
});
118+
```
119+
120+
### isUserStrict <OptionalBadge />
121+
122+
**Type:** `boolean`
123+
**Default:** `false`
124+
125+
Optional filter to restrict the results to include only authorizations for the
126+
specified user. Authorizations made for `any` user are not returned.
127+
128+
```ts twoslash
129+
import { IExecIApp, getWeb3Provider } from '@mage-sombre/iapp';
130+
131+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
132+
const dataProtectorCore = new IExecIApp(web3Provider);
133+
// ---cut---
134+
135+
const listGrantedAccess = await dataProtectorCore.getGrantedAccess({
136+
protectedData: '0x123abc...',
137+
authorizedApp: '0x456def...',
138+
authorizedUser: '0x789cba...',
139+
isUserStrict: true, // [!code focus]
140+
});
141+
```
142+
143+
### page <OptionalBadge />
144+
145+
**Type:** `number`
146+
**Default:** `0`
147+
148+
Specifies the page number of the result set to return. Pages are zero-based
149+
indexed, with the default value being `0`, indicating the first page. If used,
150+
you can also specify the `pageSize` parameter to control the number of records
151+
per page. By default, when no page number is specified, the system returns the
152+
first page (page 0) containing `20` elements.
153+
154+
**Usage example:**
155+
156+
```ts twoslash
157+
import { IExecIApp, getWeb3Provider } from '@mage-sombre/iapp';
158+
159+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
160+
const dataProtectorCore = new IExecIApp(web3Provider);
161+
// ---cut---
162+
const listGrantedAccess = await dataProtectorCore.getGrantedAccess({
163+
protectedData: '0x123abc...',
164+
page: 1, // [!code focus]
165+
pageSize: 100,
166+
});
167+
```
168+
169+
### pageSize <OptionalBadge />
170+
171+
**Type:** `number`
172+
**Default:** `20`
173+
**Range:** `[10...1000]`
174+
175+
Specifies the number of records to include in each page of the result set. This
176+
is used in conjunction with the optional `page` parameter to limit the size of
177+
each page.
178+
179+
**Usage example:**
180+
181+
```ts twoslash
182+
import { IExecIApp, getWeb3Provider } from '@mage-sombre/iapp';
183+
184+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
185+
const dataProtectorCore = new IExecIApp(web3Provider);
186+
// ---cut---
187+
const listGrantedAccess = await dataProtectorCore.getGrantedAccess({
188+
protectedData: '0x123abc...',
189+
page: 1,
190+
pageSize: 100, // [!code focus]
191+
});
192+
```
193+
194+
## Return Value
195+
196+
```ts twoslash
197+
import { type GrantedAccessResponse } from '@mage-sombre/iapp';
198+
```
199+
200+
The return value for this method has two fields: a `count` parameter indicating
201+
the number of results, and an array of `GrantedAccess` objects containing all
202+
access data. When using the optional paging parameters, the `count` will be
203+
limited by the selected `pageSize` parameter. You may use these result objects
204+
in conjunction with the [revokeOneAccess](revokeOneAccess.md) method to revoke a
205+
previously granted authorization for access.
206+
207+
### count
208+
209+
**Type:** `number`
210+
211+
An integer value indicating the number of results returned by this method. This
212+
is of particular note when using paging as the number of records returned may be
213+
smaller than the page size.
214+
215+
### grantedAccess
216+
217+
**Type:** GrantedAccess
218+
219+
See [`GrantedAccess`](/references/iapp-generator/sdk/types#grantedaccess)
220+
221+
<script setup>
222+
import OptionalBadge from '@/components/OptionalBadge.vue'
223+
</script>

0 commit comments

Comments
 (0)