-
Notifications
You must be signed in to change notification settings - Fork 0
/
runAppGetDataTrustFlow.ts
54 lines (41 loc) · 1.3 KB
/
runAppGetDataTrustFlow.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { SolidLib } from './SolidLib/Interface/SolidLib';
import { clearStores, setup } from './setup';
async function addPolicy() {
const solidLib = new SolidLib("admin-App", 'steve');
await solidLib.login()
await solidLib.addPolicy(`
<myPolicy> <a> <Policy>;
<subject> <food-store>;
<action> <read>;
<resource> "?webID ?predicate ?bdate .";
<context> <verification>.`)
await solidLib.logout();
}
async function getDataFlow() {
const solidLib = new SolidLib("food-store", 'steve');
await solidLib.login()
let dataplusplustrusted = await solidLib.getDataWithTrust("?webID ?predicate ?bdate .", [
"verification",
"advertisement"
])
let logEntries = JSON.stringify(await solidLib.getLogEntries(), null, 2)
console.log('Trusted app flow response')
console.log(dataplusplustrusted)
console.log()
console.log('Logged Agreements:')
console.log(logEntries)
await solidLib.logout()
}
async function run() {
clearStores()
const close = await setup('steve')
await addPolicy()
console.log('')
console.log('######################################')
console.log('Running Experiment')
console.log('######################################')
console.log('')
await getDataFlow()
await close();
}
run()