@peerbit/trusted-network 3.0.39 → 3.0.40-0691c73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,10 @@
1
- import { Documents, Operation, PutOperation, CanRead, TransactionContext } from "@peerbit/document";
2
- import { AppendOptions } from "@peerbit/log";
1
+ import { Documents, Operation, type CanRead, type CanPerformOperations } from "@peerbit/document";
2
+ import { type AppendOptions } from "@peerbit/log";
3
3
  import { PublicSignKey } from "@peerbit/crypto";
4
- import { DeleteOperation } from "@peerbit/document";
5
4
  import { IdentityRelation } from "./identity-graph.js";
6
5
  import { Program } from "@peerbit/program";
7
- import { PeerId } from "@libp2p/interface";
8
- import { RoleOptions } from "@peerbit/shared-log";
6
+ import { type PeerId } from "@libp2p/interface";
7
+ import { type RoleOptions } from "@peerbit/shared-log";
9
8
  type IdentityGraphArgs = {
10
9
  canRead?: CanRead<IdentityRelation>;
11
10
  role?: RoleOptions;
@@ -16,9 +15,9 @@ export declare class IdentityGraph extends Program<IdentityGraphArgs> {
16
15
  id?: Uint8Array;
17
16
  relationGraph?: Documents<IdentityRelation>;
18
17
  });
19
- canPerform(operation: PutOperation<IdentityRelation> | DeleteOperation, context: TransactionContext<IdentityRelation>): Promise<boolean>;
18
+ canPerform(properties: CanPerformOperations<IdentityRelation>): Promise<boolean>;
20
19
  open(options?: IdentityGraphArgs): Promise<void>;
21
- addRelation(to: PublicSignKey | PeerId, options?: AppendOptions<Operation<IdentityRelation>>): Promise<void>;
20
+ addRelation(to: PublicSignKey | PeerId, options?: AppendOptions<Operation>): Promise<void>;
22
21
  }
23
22
  /**
24
23
  * Not shardeable since we can not query trusted relations, because this would lead to a recursive problem where we then need to determine whether the responder is trusted or not
@@ -34,11 +33,11 @@ export declare class TrustedNetwork extends Program<TrustedNetworkArgs> {
34
33
  rootTrust: PublicSignKey | PeerId;
35
34
  });
36
35
  open(options?: TrustedNetworkArgs): Promise<void>;
37
- canPerform(operation: PutOperation<IdentityRelation> | DeleteOperation, context: TransactionContext<IdentityRelation>): Promise<boolean>;
36
+ canPerform(properties: CanPerformOperations<IdentityRelation>): Promise<boolean>;
38
37
  canRead(relation: any, publicKey?: PublicSignKey): Promise<boolean>;
39
38
  add(trustee: PublicSignKey | PeerId): Promise<IdentityRelation | undefined>;
40
39
  hasRelation(trustee: PublicSignKey | PeerId, truster?: PublicSignKey | PeerId): Promise<boolean>;
41
- getRelation(trustee: PublicSignKey | PeerId, truster?: PublicSignKey | PeerId): Promise<IdentityRelation | undefined>;
40
+ getRelation(trustee: PublicSignKey | PeerId, truster?: PublicSignKey | PeerId): Promise<IdentityRelation>;
42
41
  /**
43
42
  * Follow trust path back to trust root.
44
43
  * Trust root is always trusted.
@@ -55,3 +54,4 @@ export declare class TrustedNetwork extends Program<TrustedNetworkArgs> {
55
54
  hashCode(): string;
56
55
  }
57
56
  export {};
57
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/controller.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,SAAS,EACT,SAAS,EACT,KAAK,OAAO,EACZ,KAAK,oBAAoB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,aAAa,EAA0B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACN,gBAAgB,EAOhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA2CnE,KAAK,iBAAiB,GAAG;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,WAAW,CAAC;CACnB,CAAC;AA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,EAAE,aAAa,GAAG,MAAM,EAC/B,OAAO,GAAE,aAAa,GAAG,MAAuB;IASjD;;;;;;;;;OASG;IACG,SAAS,CACd,OAAO,EAAE,aAAa,EACtB,OAAO,GAAE,aAA8B,GACrC,OAAO,CAAC,OAAO,CAAC;IAcb,eAAe,CACpB,OAAO,EAAE,aAAa,EACtB,OAAO,GAAE,aAA8B,GACrC,OAAO,CAAC,OAAO,CAAC;IAUb,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAU5C,QAAQ,IAAI,MAAM;CAGlB"}
@@ -8,55 +8,49 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { field, serialize, variant } from "@dao-xyz/borsh";
11
- import { SearchRequest, Documents, PutOperation } from "@peerbit/document";
11
+ import { SearchRequest, Documents, Operation } from "@peerbit/document";
12
+ import {} from "@peerbit/log";
12
13
  import { PublicSignKey, getPublicKeyFromPeerId } from "@peerbit/crypto";
13
- import { DeleteOperation } from "@peerbit/document";
14
14
  import { IdentityRelation, createIdentityGraphStore, getPathGenerator, hasPath, getFromByTo, getToByFrom, getRelation } from "./identity-graph.js";
15
15
  import { Program } from "@peerbit/program";
16
16
  import { sha256Base64Sync } from "@peerbit/crypto";
17
+ import {} from "@libp2p/interface";
17
18
  import { Replicator } from "@peerbit/shared-log";
18
19
  const coercePublicKey = (publicKey) => {
19
20
  return publicKey instanceof PublicSignKey
20
21
  ? publicKey
21
22
  : getPublicKeyFromPeerId(publicKey);
22
23
  };
23
- const canPerformByRelation = async (operation, context, isTrusted) => {
24
+ const canPerformByRelation = async (properties, isTrusted) => {
24
25
  // verify the payload
25
- if (operation instanceof PutOperation ||
26
- operation instanceof DeleteOperation) {
27
- /* const relation: Relation = operation.value || deserialize(operation.data, Relation); */
28
- const keys = await context.entry.getPublicKeys();
29
- const checkKey = async (key) => {
30
- if (operation instanceof PutOperation) {
31
- // TODO, this clause is only applicable when we modify the identityGraph, but it does not make sense that the canPerform method does not know what the payload will
32
- // be, upon deserialization. There should be known in the `canPerform` method whether we are appending to the identityGraph.
33
- const relation = operation.value;
34
- if (relation instanceof IdentityRelation) {
35
- if (!relation.from.equals(key)) {
36
- return false;
37
- }
26
+ const keys = await properties.entry.getPublicKeys();
27
+ const checkKey = async (key) => {
28
+ if (properties.type === "put") {
29
+ // TODO, this clause is only applicable when we modify the identityGraph, but it does not make sense that the canPerform method does not know what the payload will
30
+ // be, upon deserialization. There should be known in the `canPerform` method whether we are appending to the identityGraph.
31
+ const relation = properties.value;
32
+ if (relation instanceof IdentityRelation) {
33
+ if (!relation.from.equals(key)) {
34
+ return false;
38
35
  }
39
- // else assume the payload is accepted
40
- }
41
- if (isTrusted) {
42
- const trusted = await isTrusted(key);
43
- return trusted;
44
- }
45
- else {
46
- return true;
47
- }
48
- };
49
- for (const key of keys) {
50
- const result = await checkKey(key);
51
- if (result) {
52
- return true;
53
36
  }
37
+ // else assume the payload is accepted
38
+ }
39
+ if (isTrusted) {
40
+ const trusted = await isTrusted(key);
41
+ return trusted;
42
+ }
43
+ else {
44
+ return true;
45
+ }
46
+ };
47
+ for (const key of keys) {
48
+ const result = await checkKey(key);
49
+ if (result) {
50
+ return true;
54
51
  }
55
- return false;
56
- }
57
- else {
58
- return false;
59
52
  }
53
+ return false;
60
54
  };
61
55
  let IdentityGraph = class IdentityGraph extends Program {
62
56
  relationGraph;
@@ -67,8 +61,8 @@ let IdentityGraph = class IdentityGraph extends Program {
67
61
  props.relationGraph || createIdentityGraphStore(props?.id);
68
62
  }
69
63
  }
70
- async canPerform(operation, context) {
71
- return canPerformByRelation(operation, context);
64
+ async canPerform(properties) {
65
+ return canPerformByRelation(properties);
72
66
  }
73
67
  async open(options) {
74
68
  await this.relationGraph.open({
@@ -130,8 +124,8 @@ let TrustedNetwork = class TrustedNetwork extends Program {
130
124
  }
131
125
  }); // self referencing access controller
132
126
  }
133
- async canPerform(operation, context) {
134
- return canPerformByRelation(operation, context, (key) => this.isTrusted(key));
127
+ async canPerform(properties) {
128
+ return canPerformByRelation(properties, (key) => this.isTrusted(key));
135
129
  }
136
130
  async canRead(relation, publicKey) {
137
131
  return true; // TODO should we have read access control?
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/controller.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACN,aAAa,EACb,SAAS,EACT,SAAS,EAGT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAsB,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAEnE,MAAM,eAAe,GAAG,CAAC,SAAiC,EAAE,EAAE;IAC7D,OAAO,SAAS,YAAY,aAAa;QACxC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC,CAAC;AACF,MAAM,oBAAoB,GAAG,KAAK,EACjC,UAAkD,EAClD,SAAoD,EACjC,EAAE;IACrB,qBAAqB;IACrB,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAkB,EAAoB,EAAE;QAC/D,IAAI,UAAU,CAAC,I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AAO,CAC9B,OAAO,EACP,OAAO,EACP,IAAI,CAAC,UAAU,EACf,WAAW,CACX,CAAC;QACF,OAAO,CAAC,CAAC,SAAS,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,UAAU;QACf,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;QAC/B,MAAM,YAAY,GAAoB,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAC1E,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YACpC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,QAAQ;QACP,OAAO,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC;CACD,CAAA;AAtIA;IADC,KAAK,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACpB,aAAa;iDAAC;AAGzB;IADC,KAAK,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8BACf,SAAS;kDAAmB;AAL5B,cAAc;IAD1B,OAAO,CAAC,iBAAiB,CAAC;;GACd,cAAc,CAwI1B"}
@@ -33,3 +33,4 @@ export declare class IdentityRelation extends AbstractRelation {
33
33
  export declare const hasPath: (start: PublicSignKey, end: PublicSignKey, db: Documents<IdentityRelation>, resolver: RelationResolver) => Promise<boolean>;
34
34
  export declare const getRelation: (from: PublicSignKey, to: PublicSignKey, db: Documents<IdentityRelation>) => Promise<IdentityRelation | undefined>;
35
35
  export declare const createIdentityGraphStore: (id?: Uint8Array) => Documents<IdentityRelation>;
36
+ //# sourceMappingURL=identity-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-graph.d.ts","sourceRoot":"","sources":["../../src/identity-graph.ts"],"names":[],"mappings":"AACA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Q,OAAO,CAEjB,CAAC;AAEF,eAAO,MAAM,WAAW,SACjB,aAAa,MACf,aAAa,MACb,UAAU,gBAAgB,CAAC,KAC7B,QAAQ,gBAAgB,GAAG,SAAS,CAEtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAS,UAAU,gCAGrD,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from "./controller.js";
2
2
  export * from "./identity-graph.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,43 +1,69 @@
1
1
  {
2
- "name": "@peerbit/trusted-network",
3
- "version": "3.0.39",
4
- "description": "Access controller that operates on a DB",
5
- "type": "module",
6
- "sideEffects": false,
7
- "module": "lib/esm/index.js",
8
- "types": "lib/esm/index.d.ts",
9
- "exports": {
10
- "import": "./lib/esm/index.js",
11
- "require": "./lib/cjs/index.js"
12
- },
13
- "files": [
14
- "lib",
15
- "src",
16
- "!src/**/__tests__",
17
- "!lib/**/__tests__",
18
- "LICENSE"
19
- ],
20
- "publishConfig": {
21
- "access": "public"
22
- },
23
- "scripts": {
24
- "clean": "shx rm -rf lib/*",
25
- "build": "yarn clean && tsc -p tsconfig.json",
26
- "test": "node ../../../../node_modules/.bin/jest test -c ../../../../jest.config.ts --runInBand --forceExit",
27
- "test:unit": "node ../../../../node_modules/.bin/jest test -c ../../../../jest.config.unit.ts --runInBand --forceExit",
28
- "test:integration": "node ../node_modules/.bin/jest test -c ../../../../jest.config.integration.ts --runInBand --forceExit"
29
- },
30
- "author": "dao.xyz",
31
- "license": "MIT",
32
- "dependencies": {
33
- "@dao-xyz/borsh": "^5.2.1",
34
- "@peerbit/crypto": "2.1.7",
35
- "@peerbit/document": "6.0.6"
36
- },
37
- "devDependencies": {
38
- "@ethersproject/wallet": "^5.7.0",
39
- "@peerbit/test-utils": "^2.0.32",
40
- "@peerbit/time": "2.0.6"
41
- },
42
- "gitHead": "eaabc8746086d126df86d4308ca1c4f65ac20f32"
2
+ "name": "@peerbit/trusted-network",
3
+ "version": "3.0.40-0691c73",
4
+ "description": "Access controller that operates on a DB",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "types": "./dist/src/index.d.ts",
8
+ "typesVersions": {
9
+ "*": {
10
+ "*": [
11
+ "*",
12
+ "dist/*",
13
+ "dist/src/*",
14
+ "dist/src/*/index"
15
+ ],
16
+ "src/*": [
17
+ "*",
18
+ "dist/*",
19
+ "dist/src/*",
20
+ "dist/src/*/index"
21
+ ]
22
+ }
23
+ },
24
+ "files": [
25
+ "src",
26
+ "dist",
27
+ "!dist/e2e",
28
+ "!dist/test",
29
+ "!**/*.tsbuildinfo"
30
+ ],
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/src/index.d.ts",
34
+ "import": "./dist/src/index.js"
35
+ }
36
+ },
37
+ "eslintConfig": {
38
+ "extends": "ipfs",
39
+ "parserOptions": {
40
+ "project": true,
41
+ "sourceType": "module"
42
+ },
43
+ "ignorePatterns": [
44
+ "!.aegir.js",
45
+ "test/ts-use",
46
+ "*.d.ts"
47
+ ]
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "scripts": {
53
+ "clean": "aegir clean",
54
+ "build": "aegir build --no-bundle",
55
+ "test": "aegir test --target node"
56
+ },
57
+ "author": "dao.xyz",
58
+ "license": "MIT",
59
+ "dependencies": {
60
+ "@dao-xyz/borsh": "^5.2.2",
61
+ "@peerbit/crypto": "2.2.0-0691c73",
62
+ "@peerbit/document": "6.0.7-0691c73"
63
+ },
64
+ "devDependencies": {
65
+ "@peerbit/time": "2.0.6-0691c73",
66
+ "@ethersproject/wallet": "^5.7.0",
67
+ "@peerbit/test-utils": "2.0.33-0691c73"
68
+ }
43
69
  }
package/src/controller.ts CHANGED
@@ -1,15 +1,13 @@
1
- import { deserialize, field, serialize, variant, vec } from "@dao-xyz/borsh";
1
+ import { field, serialize, variant } from "@dao-xyz/borsh";
2
2
  import {
3
3
  SearchRequest,
4
4
  Documents,
5
5
  Operation,
6
- PutOperation,
7
- CanRead,
8
- TransactionContext
6
+ type CanRead,
7
+ type CanPerformOperations
9
8
  } from "@peerbit/document";
10
- import { AppendOptions } from "@peerbit/log";
9
+ import { type AppendOptions } from "@peerbit/log";
11
10
  import { PublicSignKey, getPublicKeyFromPeerId } from "@peerbit/crypto";
12
- import { DeleteOperation } from "@peerbit/document";
13
11
  import {
14
12
  IdentityRelation,
15
13
  createIdentityGraphStore,
@@ -21,8 +19,8 @@ import {
21
19
  } from "./identity-graph.js";
22
20
  import { Program } from "@peerbit/program";
23
21
  import { sha256Base64Sync } from "@peerbit/crypto";
24
- import { PeerId } from "@libp2p/interface";
25
- import { Replicator, RoleOptions } from "@peerbit/shared-log";
22
+ import { type PeerId } from "@libp2p/interface";
23
+ import { Replicator, type RoleOptions } from "@peerbit/shared-log";
26
24
 
27
25
  const coercePublicKey = (publicKey: PublicSignKey | PeerId) => {
28
26
  return publicKey instanceof PublicSignKey
@@ -30,49 +28,39 @@ const coercePublicKey = (publicKey: PublicSignKey | PeerId) => {
30
28
  : getPublicKeyFromPeerId(publicKey);
31
29
  };
32
30
  const canPerformByRelation = async (
33
- operation: PutOperation<IdentityRelation> | DeleteOperation,
34
- context: TransactionContext<IdentityRelation>,
31
+ properties: CanPerformOperations<IdentityRelation>,
35
32
  isTrusted?: (key: PublicSignKey) => Promise<boolean>
36
33
  ): Promise<boolean> => {
37
34
  // verify the payload
38
- if (
39
- operation instanceof PutOperation ||
40
- operation instanceof DeleteOperation
41
- ) {
42
- /* const relation: Relation = operation.value || deserialize(operation.data, Relation); */
43
-
44
- const keys = await context.entry.getPublicKeys();
45
- const checkKey = async (key: PublicSignKey): Promise<boolean> => {
46
- if (operation instanceof PutOperation) {
47
- // TODO, this clause is only applicable when we modify the identityGraph, but it does not make sense that the canPerform method does not know what the payload will
48
- // be, upon deserialization. There should be known in the `canPerform` method whether we are appending to the identityGraph.
35
+ const keys = await properties.entry.getPublicKeys();
36
+ const checkKey = async (key: PublicSignKey): Promise<boolean> => {
37
+ if (properties.type === "put") {
38
+ // TODO, this clause is only applicable when we modify the identityGraph, but it does not make sense that the canPerform method does not know what the payload will
39
+ // be, upon deserialization. There should be known in the `canPerform` method whether we are appending to the identityGraph.
49
40
 
50
- const relation = operation.value;
51
- if (relation instanceof IdentityRelation) {
52
- if (!relation.from.equals(key)) {
53
- return false;
54
- }
41
+ const relation = properties.value;
42
+ if (relation instanceof IdentityRelation) {
43
+ if (!relation.from.equals(key)) {
44
+ return false;
55
45
  }
56
-
57
- // else assume the payload is accepted
58
- }
59
- if (isTrusted) {
60
- const trusted = await isTrusted(key);
61
- return trusted;
62
- } else {
63
- return true;
64
- }
65
- };
66
- for (const key of keys) {
67
- const result = await checkKey(key);
68
- if (result) {
69
- return true;
70
46
  }
47
+
48
+ // else assume the payload is accepted
49
+ }
50
+ if (isTrusted) {
51
+ const trusted = await isTrusted(key);
52
+ return trusted;
53
+ } else {
54
+ return true;
55
+ }
56
+ };
57
+ for (const key of keys) {
58
+ const result = await checkKey(key);
59
+ if (result) {
60
+ return true;
71
61
  }
72
- return false;
73
- } else {
74
- return false;
75
62
  }
63
+ return false;
76
64
  };
77
65
 
78
66
  type IdentityGraphArgs = {
@@ -97,10 +85,9 @@ export class IdentityGraph extends Program<IdentityGraphArgs> {
97
85
  }
98
86
 
99
87
  async canPerform(
100
- operation: PutOperation<IdentityRelation> | DeleteOperation,
101
- context: TransactionContext<IdentityRelation>
88
+ properties: CanPerformOperations<IdentityRelation>
102
89
  ): Promise<boolean> {
103
- return canPerformByRelation(operation, context);
90
+ return canPerformByRelation(properties);
104
91
  }
105
92
 
106
93
  async open(options?: IdentityGraphArgs) {
@@ -122,7 +109,7 @@ export class IdentityGraph extends Program<IdentityGraphArgs> {
122
109
 
123
110
  async addRelation(
124
111
  to: PublicSignKey | PeerId,
125
- options?: AppendOptions<Operation<IdentityRelation>>
112
+ options?: AppendOptions<Operation>
126
113
  ) {
127
114
  /* trustee = PublicKey.from(trustee); */
128
115
  await this.relationGraph.put(
@@ -176,12 +163,9 @@ export class TrustedNetwork extends Program<TrustedNetworkArgs> {
176
163
  }
177
164
 
178
165
  async canPerform(
179
- operation: PutOperation<IdentityRelation> | DeleteOperation,
180
- context: TransactionContext<IdentityRelation>
166
+ properties: CanPerformOperations<IdentityRelation>
181
167
  ): Promise<boolean> {
182
- return canPerformByRelation(operation, context, (key) =>
183
- this.isTrusted(key)
184
- );
168
+ return canPerformByRelation(properties, (key) => this.isTrusted(key));
185
169
  }
186
170
 
187
171
  async canRead(relation: any, publicKey?: PublicSignKey): Promise<boolean> {
@@ -1 +0,0 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/controller.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAe,KAAK,EAAE,SAAS,EAAE,OAAO,EAAO,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EACN,aAAa,EACb,SAAS,EAET,YAAY,EAGZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAe,MAAM,qBAAqB,CAAC;AAE9D,MAAM,eAAe,GAAG,CAAC,SAAiC,EAAE,EAAE;IAC7D,OAAO,SAAS,YAAY,aAAa;QACxC,CAAC,CAAC,SAAS;QACX,CAAC,C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