@extrimian/agent 0.12.0-1 → 0.12.0-11

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.
Files changed (97) hide show
  1. package/dist/agent.d.ts +77 -77
  2. package/dist/agent.js +173 -173
  3. package/dist/agent.js.map +1 -1
  4. package/dist/data-share-behaviours/data-share-behavior.d.ts +4 -4
  5. package/dist/data-share-behaviours/data-share-behavior.js +2 -2
  6. package/dist/data-share-behaviours/identity-data-share-behavior.d.ts +16 -16
  7. package/dist/data-share-behaviours/identity-data-share-behavior.js +2 -2
  8. package/dist/data-share-behaviours/identity-plaintext-data-share-behavior.d.ts +5 -5
  9. package/dist/data-share-behaviours/identity-plaintext-data-share-behavior.js +15 -15
  10. package/dist/data-share-behaviours/vcs/vc-share-behavior.d.ts +12 -12
  11. package/dist/data-share-behaviours/vcs/vc-share-behavior.js +2 -2
  12. package/dist/data-share-behaviours/vcs/vc-share-didcomm-behavior.d.ts +20 -20
  13. package/dist/data-share-behaviours/vcs/vc-share-didcomm-behavior.js +29 -29
  14. package/dist/did/did-services.d.ts +14 -14
  15. package/dist/did/did-services.js +14 -14
  16. package/dist/exceptions/agent-plugin-not-found.d.ts +2 -2
  17. package/dist/exceptions/agent-plugin-not-found.js +6 -6
  18. package/dist/exceptions/vc-protocol-not-found.d.ts +3 -3
  19. package/dist/exceptions/vc-protocol-not-found.js +11 -11
  20. package/dist/index.d.ts +32 -32
  21. package/dist/index.js +60 -60
  22. package/dist/messaging/messaging.d.ts +41 -41
  23. package/dist/messaging/messaging.js +90 -88
  24. package/dist/messaging/messaging.js.map +1 -1
  25. package/dist/models/agent-identity.d.ts +86 -86
  26. package/dist/models/agent-identity.js +399 -399
  27. package/dist/models/agent-identity.js.map +1 -1
  28. package/dist/models/agent-kms.d.ts +42 -42
  29. package/dist/models/agent-kms.js +78 -78
  30. package/dist/models/agent-pbk.d.ts +11 -11
  31. package/dist/models/agent-pbk.js +11 -11
  32. package/dist/models/agent-registry.d.ts +95 -94
  33. package/dist/models/agent-registry.js +130 -129
  34. package/dist/models/agent-registry.js.map +1 -1
  35. package/dist/models/agent-resolver-cache.d.ts +21 -21
  36. package/dist/models/agent-resolver-cache.js +47 -47
  37. package/dist/models/agent-resolver.d.ts +19 -19
  38. package/dist/models/agent-resolver.js +33 -33
  39. package/dist/models/agent-secure-storage.d.ts +3 -3
  40. package/dist/models/agent-secure-storage.js +2 -2
  41. package/dist/models/agent-secure-storages/filesystem-agent-secure-storage.d.ts +14 -14
  42. package/dist/models/agent-secure-storages/filesystem-agent-secure-storage.js +48 -48
  43. package/dist/models/agent-storage.d.ts +9 -9
  44. package/dist/models/agent-storage.js +2 -2
  45. package/dist/models/did.d.ts +19 -19
  46. package/dist/models/did.js +63 -63
  47. package/dist/models/transports/ami-transport.d.ts +30 -30
  48. package/dist/models/transports/ami-transport.js +183 -183
  49. package/dist/models/transports/connectable-transport.d.ts +25 -25
  50. package/dist/models/transports/connectable-transport.js +25 -25
  51. package/dist/models/transports/dwn-transport.d.ts +32 -32
  52. package/dist/models/transports/dwn-transport.js +191 -191
  53. package/dist/models/transports/messaging-transport.d.ts +3 -3
  54. package/dist/models/transports/messaging-transport.js +2 -2
  55. package/dist/models/transports/transport.d.ts +30 -30
  56. package/dist/models/transports/transport.js +7 -7
  57. package/dist/models/transports/websocket-client-transport.d.ts +5 -5
  58. package/dist/models/transports/websocket-client-transport.js +33 -33
  59. package/dist/models/transports/websocket-server-transport.d.ts +7 -7
  60. package/dist/models/transports/websocket-server-transport.js +21 -21
  61. package/dist/models/transports/websocket-transport.d.ts +30 -30
  62. package/dist/models/transports/websocket-transport.js +84 -84
  63. package/dist/models/vc-storage.d.ts +8 -8
  64. package/dist/models/vc-storage.js +2 -2
  65. package/dist/plugins/iplugin.d.ts +17 -17
  66. package/dist/plugins/iplugin.js +2 -2
  67. package/dist/plugins/istatus-list-plugin.d.ts +14 -14
  68. package/dist/plugins/istatus-list-plugin.js +2 -2
  69. package/dist/plugins/ivc-interceptor-plugin.d.ts +9 -9
  70. package/dist/plugins/ivc-interceptor-plugin.js +2 -2
  71. package/dist/plugins/plugin-dispatcher.d.ts +6 -6
  72. package/dist/plugins/plugin-dispatcher.js +19 -19
  73. package/dist/transport/transport.d.ts +43 -43
  74. package/dist/transport/transport.js +109 -109
  75. package/dist/utils/index.d.ts +1 -1
  76. package/dist/utils/index.js +14 -14
  77. package/dist/utils/lite-event.d.ts +25 -25
  78. package/dist/utils/lite-event.js +36 -36
  79. package/dist/vc/models/credentia-flow.d.ts +4 -4
  80. package/dist/vc/models/credentia-flow.js +8 -8
  81. package/dist/vc/models/credential-request.d.ts +3 -3
  82. package/dist/vc/models/credential-request.js +2 -2
  83. package/dist/vc/models/vc-create-key-request.d.ts +4 -4
  84. package/dist/vc/models/vc-create-key-request.js +2 -2
  85. package/dist/vc/models/waci-message.d.ts +3 -3
  86. package/dist/vc/models/waci-message.js +7 -7
  87. package/dist/vc/protocols/openid-protocol.d.ts +161 -161
  88. package/dist/vc/protocols/openid-protocol.js +125 -125
  89. package/dist/vc/protocols/vc-protocol.d.ts +106 -106
  90. package/dist/vc/protocols/vc-protocol.js +36 -36
  91. package/dist/vc/protocols/waci-protocol.d.ts +183 -183
  92. package/dist/vc/protocols/waci-protocol.js +552 -552
  93. package/dist/vc/vc.d.ts +225 -225
  94. package/dist/vc/vc.js +328 -328
  95. package/package.json +19 -20
  96. package/readme.md +392 -392
  97. package/dist/vc/vc-setup/vc-setup.d.ts +0 -0
@@ -1,49 +1,49 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FileSystemAgentSecureStorage = void 0;
4
- const fs_1 = require("fs");
5
- class FileSystemAgentSecureStorage {
6
- constructor(params) {
7
- this.filepath = params.filepath;
8
- }
9
- async add(key, data) {
10
- const map = this.getData();
11
- map.set(key, data);
12
- this.saveData(map);
13
- }
14
- async get(key) {
15
- return this.getData().get(key);
16
- }
17
- async getAll() {
18
- return this.getData();
19
- }
20
- update(key, data) {
21
- const map = this.getData();
22
- map.set(key, data);
23
- this.saveData(map);
24
- }
25
- remove(key) {
26
- const map = this.getData();
27
- map.delete(key);
28
- this.saveData(map);
29
- }
30
- getData() {
31
- if (!(0, fs_1.existsSync)(this.filepath)) {
32
- return new Map();
33
- }
34
- const file = (0, fs_1.readFileSync)(this.filepath, {
35
- encoding: "utf-8",
36
- });
37
- if (!file) {
38
- return new Map();
39
- }
40
- return new Map(Object.entries(JSON.parse(file)));
41
- }
42
- saveData(data) {
43
- (0, fs_1.writeFileSync)(this.filepath, JSON.stringify(Object.fromEntries(data)), {
44
- encoding: "utf-8",
45
- });
46
- }
47
- }
48
- exports.FileSystemAgentSecureStorage = FileSystemAgentSecureStorage;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileSystemAgentSecureStorage = void 0;
4
+ const fs_1 = require("fs");
5
+ class FileSystemAgentSecureStorage {
6
+ constructor(params) {
7
+ this.filepath = params.filepath;
8
+ }
9
+ async add(key, data) {
10
+ const map = this.getData();
11
+ map.set(key, data);
12
+ this.saveData(map);
13
+ }
14
+ async get(key) {
15
+ return this.getData().get(key);
16
+ }
17
+ async getAll() {
18
+ return this.getData();
19
+ }
20
+ update(key, data) {
21
+ const map = this.getData();
22
+ map.set(key, data);
23
+ this.saveData(map);
24
+ }
25
+ remove(key) {
26
+ const map = this.getData();
27
+ map.delete(key);
28
+ this.saveData(map);
29
+ }
30
+ getData() {
31
+ if (!(0, fs_1.existsSync)(this.filepath)) {
32
+ return new Map();
33
+ }
34
+ const file = (0, fs_1.readFileSync)(this.filepath, {
35
+ encoding: "utf-8",
36
+ });
37
+ if (!file) {
38
+ return new Map();
39
+ }
40
+ return new Map(Object.entries(JSON.parse(file)));
41
+ }
42
+ saveData(data) {
43
+ (0, fs_1.writeFileSync)(this.filepath, JSON.stringify(Object.fromEntries(data)), {
44
+ encoding: "utf-8",
45
+ });
46
+ }
47
+ }
48
+ exports.FileSystemAgentSecureStorage = FileSystemAgentSecureStorage;
49
49
  //# sourceMappingURL=filesystem-agent-secure-storage.js.map
@@ -1,9 +1,9 @@
1
- export interface IStorage {
2
- add(key: string, data: any): Promise<void>;
3
- get<T = any>(key: string): Promise<T>;
4
- getAll(): Promise<Map<string, any>>;
5
- update(key: string, data: any): any;
6
- remove(key: string): any;
7
- }
8
- export interface IAgentStorage extends IStorage {
9
- }
1
+ export interface IStorage {
2
+ add(key: string, data: any): Promise<void>;
3
+ get<T = any>(key: string): Promise<T>;
4
+ getAll(): Promise<Map<string, any>>;
5
+ update(key: string, data: any): any;
6
+ remove(key: string): any;
7
+ }
8
+ export interface IAgentStorage extends IStorage {
9
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=agent-storage.js.map
@@ -1,19 +1,19 @@
1
- export declare class DID {
2
- value: string;
3
- private constructor();
4
- /**
5
- * This method converts a string value or full verification method id to a data value DID object.
6
- *
7
- * @param did - DID input. This value can also be a full verification method id.
8
- * @returns Data value object that represent a DID
9
- */
10
- static from(did: string): DID;
11
- validate(did: string): boolean;
12
- getDidMethod(): string;
13
- isEqual(other: DID): boolean;
14
- isLongDIDFor(shortDID: DID): boolean;
15
- isShortDIDFor(longDID: DID): boolean;
16
- getDIDSuffix(): string;
17
- private getLongDIDSuffix;
18
- isLongDID(): boolean;
19
- }
1
+ export declare class DID {
2
+ value: string;
3
+ private constructor();
4
+ /**
5
+ * This method converts a string value or full verification method id to a data value DID object.
6
+ *
7
+ * @param did - DID input. This value can also be a full verification method id.
8
+ * @returns Data value object that represent a DID
9
+ */
10
+ static from(did: string): DID;
11
+ validate(did: string): boolean;
12
+ getDidMethod(): string;
13
+ isEqual(other: DID): boolean;
14
+ isLongDIDFor(shortDID: DID): boolean;
15
+ isShortDIDFor(longDID: DID): boolean;
16
+ getDIDSuffix(): string;
17
+ private getLongDIDSuffix;
18
+ isLongDID(): boolean;
19
+ }
@@ -1,64 +1,64 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DID = void 0;
4
- const base_64_1 = require("base-64");
5
- class DID {
6
- constructor(did) {
7
- if (this.validate(did)) {
8
- this.value = did;
9
- }
10
- }
11
- /**
12
- * This method converts a string value or full verification method id to a data value DID object.
13
- *
14
- * @param did - DID input. This value can also be a full verification method id.
15
- * @returns Data value object that represent a DID
16
- */
17
- static from(did) {
18
- if ((did === null || did === void 0 ? void 0 : did.indexOf('#')) > -1) {
19
- return new DID(did.substring(0, did.indexOf('#')));
20
- }
21
- return new DID(did);
22
- }
23
- validate(did) {
24
- return true;
25
- }
26
- getDidMethod() {
27
- return this.value.substring(0, this.value.lastIndexOf(':'));
28
- }
29
- isEqual(other) {
30
- // Lógica de comparación personalizada aquí
31
- // Compara los atributos relevantes de los objetos y devuelve true si son iguales, false en caso contrario
32
- return this.value == other.value;
33
- }
34
- isLongDIDFor(shortDID) {
35
- return !shortDID.isLongDID() && this.isLongDID() && this.value.indexOf(shortDID.value) != -1;
36
- }
37
- isShortDIDFor(longDID) {
38
- return longDID.isLongDIDFor(this);
39
- }
40
- getDIDSuffix() {
41
- return this.isLongDID() ? this.getLongDIDSuffix() : this.value.substring(this.value.lastIndexOf(":") + 1);
42
- }
43
- getLongDIDSuffix() {
44
- const ultimoIndice = this.value.lastIndexOf(":");
45
- if (ultimoIndice === -1) {
46
- return null;
47
- }
48
- const index = this.value.lastIndexOf(":", ultimoIndice - 1);
49
- return this.value.substring(index + 1);
50
- }
51
- isLongDID() {
52
- try {
53
- const lastSegment = this.value.substring(this.value.lastIndexOf(':') + 1);
54
- const data = (0, base_64_1.decode)(lastSegment);
55
- const obj = JSON.parse(data);
56
- return obj.delta != null;
57
- }
58
- catch {
59
- return false;
60
- }
61
- }
62
- }
63
- exports.DID = DID;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DID = void 0;
4
+ const base_64_1 = require("base-64");
5
+ class DID {
6
+ constructor(did) {
7
+ if (this.validate(did)) {
8
+ this.value = did;
9
+ }
10
+ }
11
+ /**
12
+ * This method converts a string value or full verification method id to a data value DID object.
13
+ *
14
+ * @param did - DID input. This value can also be a full verification method id.
15
+ * @returns Data value object that represent a DID
16
+ */
17
+ static from(did) {
18
+ if ((did === null || did === void 0 ? void 0 : did.indexOf('#')) > -1) {
19
+ return new DID(did.substring(0, did.indexOf('#')));
20
+ }
21
+ return new DID(did);
22
+ }
23
+ validate(did) {
24
+ return true;
25
+ }
26
+ getDidMethod() {
27
+ return this.value.substring(0, this.value.lastIndexOf(':'));
28
+ }
29
+ isEqual(other) {
30
+ // Lógica de comparación personalizada aquí
31
+ // Compara los atributos relevantes de los objetos y devuelve true si son iguales, false en caso contrario
32
+ return this.value == other.value;
33
+ }
34
+ isLongDIDFor(shortDID) {
35
+ return !shortDID.isLongDID() && this.isLongDID() && this.value.indexOf(shortDID.value) != -1;
36
+ }
37
+ isShortDIDFor(longDID) {
38
+ return longDID.isLongDIDFor(this);
39
+ }
40
+ getDIDSuffix() {
41
+ return this.isLongDID() ? this.getLongDIDSuffix() : this.value.substring(this.value.lastIndexOf(":") + 1);
42
+ }
43
+ getLongDIDSuffix() {
44
+ const ultimoIndice = this.value.lastIndexOf(":");
45
+ if (ultimoIndice === -1) {
46
+ return null;
47
+ }
48
+ const index = this.value.lastIndexOf(":", ultimoIndice - 1);
49
+ return this.value.substring(index + 1);
50
+ }
51
+ isLongDID() {
52
+ try {
53
+ const lastSegment = this.value.substring(this.value.lastIndexOf(':') + 1);
54
+ const data = (0, base_64_1.decode)(lastSegment);
55
+ const obj = JSON.parse(data);
56
+ return obj.delta != null;
57
+ }
58
+ catch {
59
+ return false;
60
+ }
61
+ }
62
+ }
63
+ exports.DID = DID;
64
64
  //# sourceMappingURL=did.js.map
@@ -1,30 +1,30 @@
1
- import { DIDDocument } from '@extrimian/did-core';
2
- import { DWNAmiClient, MessageStorage } from '@extrimian/dwn-client-ami';
3
- import { Agent } from '../../agent';
4
- import { ILiteEvent } from '../../utils/lite-event';
5
- import { DID } from '../did';
6
- import { IMessagingTransport } from './messaging-transport';
7
- import { MessageArrivedEventArg, TransportSendRequest } from './transport';
8
- export declare class DWNAmiTransport implements IMessagingTransport {
9
- private readonly onMessageArrived;
10
- get messageArrived(): ILiteEvent<MessageArrivedEventArg>;
11
- dwnClientMap: Map<string, DWNAmiClient>;
12
- agent: Agent;
13
- private resolver;
14
- dwnPollMilliseconds: number;
15
- constructor(params?: {
16
- dwnPollMilliseconds: number;
17
- });
18
- transportSupportedByTarget(params: {
19
- targetDID: DID;
20
- }): Promise<boolean>;
21
- dispose(): Promise<void>;
22
- processNewDID(did: DID, initialzing?: boolean): Promise<void>;
23
- initialize(params: {
24
- agent: Agent;
25
- }): Promise<void>;
26
- send(params: TransportSendRequest): Promise<void>;
27
- startPollSpecificClient(did: string, dwnClient: DWNAmiClient): Promise<void>;
28
- getServiceUrl(didDocument: DIDDocument, serviceType: string, serviceEndpointMapKey?: string): string[];
29
- }
30
- export declare const inMemoryMessageStorage: MessageStorage;
1
+ import { DIDDocument } from '@extrimian/did-core';
2
+ import { DWNAmiClient, MessageStorage } from '@extrimian/dwn-client-ami';
3
+ import { Agent } from '../../agent';
4
+ import { ILiteEvent } from '../../utils/lite-event';
5
+ import { DID } from '../did';
6
+ import { IMessagingTransport } from './messaging-transport';
7
+ import { MessageArrivedEventArg, TransportSendRequest } from './transport';
8
+ export declare class DWNAmiTransport implements IMessagingTransport {
9
+ private readonly onMessageArrived;
10
+ get messageArrived(): ILiteEvent<MessageArrivedEventArg>;
11
+ dwnClientMap: Map<string, DWNAmiClient>;
12
+ agent: Agent;
13
+ private resolver;
14
+ dwnPollMilliseconds: number;
15
+ constructor(params?: {
16
+ dwnPollMilliseconds: number;
17
+ });
18
+ transportSupportedByTarget(params: {
19
+ targetDID: DID;
20
+ }): Promise<boolean>;
21
+ dispose(): Promise<void>;
22
+ processNewDID(did: DID, initialzing?: boolean): Promise<void>;
23
+ initialize(params: {
24
+ agent: Agent;
25
+ }): Promise<void>;
26
+ send(params: TransportSendRequest): Promise<void>;
27
+ startPollSpecificClient(did: string, dwnClient: DWNAmiClient): Promise<void>;
28
+ getServiceUrl(didDocument: DIDDocument, serviceType: string, serviceEndpointMapKey?: string): string[];
29
+ }
30
+ export declare const inMemoryMessageStorage: MessageStorage;