@ajna-inc/vaults 0.1.0

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 (48) hide show
  1. package/LICENSE +202 -0
  2. package/build/VaultsApi.js +263 -0
  3. package/build/VaultsEvents.js +19 -0
  4. package/build/VaultsModule.js +71 -0
  5. package/build/crypto/wasm/VaultCrypto.js +70 -0
  6. package/build/errors/BadSuiteError.js +34 -0
  7. package/build/errors/DecryptAeadError.js +34 -0
  8. package/build/errors/DecryptKemError.js +34 -0
  9. package/build/errors/PolicyError.js +34 -0
  10. package/build/errors/VaultError.js +77 -0
  11. package/build/errors/index.js +16 -0
  12. package/build/index.js +119 -0
  13. package/build/messages/CreateVaultMessage.js +126 -0
  14. package/build/messages/DeleteVaultMessage.js +114 -0
  15. package/build/messages/DenyAccessMessage.js +114 -0
  16. package/build/messages/DenyShareMessage.js +120 -0
  17. package/build/messages/GrantAccessMessage.js +126 -0
  18. package/build/messages/ProvideShareMessage.js +126 -0
  19. package/build/messages/RequestAccessMessage.js +120 -0
  20. package/build/messages/RequestShareMessage.js +120 -0
  21. package/build/messages/RetrieveVaultMessage.js +108 -0
  22. package/build/messages/StoreVaultMessage.js +114 -0
  23. package/build/messages/UpdateVaultMessage.js +120 -0
  24. package/build/messages/VaultCreatedAckMessage.js +108 -0
  25. package/build/messages/VaultDataMessage.js +121 -0
  26. package/build/messages/VaultProblemReportMessage.js +124 -0
  27. package/build/messages/VaultStoredAckMessage.js +115 -0
  28. package/build/messages/index.js +36 -0
  29. package/build/models/ThresholdSession.js +24 -0
  30. package/build/models/VaultDocument.js +28 -0
  31. package/build/models/VaultHeader.js +31 -0
  32. package/build/models/VaultPolicy.js +29 -0
  33. package/build/models/index.js +20 -0
  34. package/build/repository/ThresholdSessionRecord.js +117 -0
  35. package/build/repository/ThresholdSessionRepository.js +216 -0
  36. package/build/repository/VaultRecord.js +128 -0
  37. package/build/repository/VaultRepository.js +200 -0
  38. package/build/repository/index.js +13 -0
  39. package/build/services/VaultEncryptionService.js +613 -0
  40. package/build/services/VaultService.js +398 -0
  41. package/build/services/index.js +8 -0
  42. package/package.json +45 -0
  43. package/wasm/README.md +166 -0
  44. package/wasm/package.json +16 -0
  45. package/wasm/vault_crypto.d.ts +526 -0
  46. package/wasm/vault_crypto.js +2137 -0
  47. package/wasm/vault_crypto_bg.wasm +0 -0
  48. package/wasm/vault_crypto_bg.wasm.d.ts +66 -0
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
18
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
19
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
20
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
21
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
22
+ var _, done = false;
23
+ for (var i = decorators.length - 1; i >= 0; i--) {
24
+ var context = {};
25
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
26
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
27
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
28
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
29
+ if (kind === "accessor") {
30
+ if (result === void 0) continue;
31
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
32
+ if (_ = accept(result.get)) descriptor.get = _;
33
+ if (_ = accept(result.set)) descriptor.set = _;
34
+ if (_ = accept(result.init)) initializers.unshift(_);
35
+ }
36
+ else if (_ = accept(result)) {
37
+ if (kind === "field") initializers.unshift(_);
38
+ else descriptor[key] = _;
39
+ }
40
+ }
41
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
42
+ done = true;
43
+ };
44
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
45
+ var useValue = arguments.length > 2;
46
+ for (var i = 0; i < initializers.length; i++) {
47
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
48
+ }
49
+ return useValue ? value : void 0;
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.RequestShareMessage = void 0;
53
+ var core_1 = require("@credo-ts/core");
54
+ var class_transformer_1 = require("class-transformer");
55
+ var class_validator_1 = require("class-validator");
56
+ /**
57
+ * Request a Shamir share for threshold reconstruction
58
+ *
59
+ * @see https://didcomm.org/vaults/1.0/request-share
60
+ */
61
+ var RequestShareMessage = function () {
62
+ var _a;
63
+ var _classSuper = core_1.AgentMessage;
64
+ var _instanceExtraInitializers = [];
65
+ var _type_decorators;
66
+ var _type_initializers = [];
67
+ var _vaultId_decorators;
68
+ var _vaultId_initializers = [];
69
+ var _docId_decorators;
70
+ var _docId_initializers = [];
71
+ var _sessionId_decorators;
72
+ var _sessionId_initializers = [];
73
+ var _requesterDid_decorators;
74
+ var _requesterDid_initializers = [];
75
+ var _shareIdentifier_decorators;
76
+ var _shareIdentifier_initializers = [];
77
+ return _a = /** @class */ (function (_super) {
78
+ __extends(RequestShareMessage, _super);
79
+ function RequestShareMessage(options) {
80
+ var _b;
81
+ var _this = _super.call(this) || this;
82
+ _this.type = (__runInitializers(_this, _instanceExtraInitializers), __runInitializers(_this, _type_initializers, _a.type.messageTypeUri));
83
+ _this.vaultId = __runInitializers(_this, _vaultId_initializers, void 0);
84
+ _this.docId = __runInitializers(_this, _docId_initializers, void 0);
85
+ _this.sessionId = __runInitializers(_this, _sessionId_initializers, void 0);
86
+ _this.requesterDid = __runInitializers(_this, _requesterDid_initializers, void 0);
87
+ _this.shareIdentifier = __runInitializers(_this, _shareIdentifier_initializers, void 0);
88
+ if (options) {
89
+ _this.id = (_b = options.id) !== null && _b !== void 0 ? _b : _this.generateId();
90
+ _this.vaultId = options.vaultId;
91
+ _this.docId = options.docId;
92
+ _this.sessionId = options.sessionId;
93
+ _this.requesterDid = options.requesterDid;
94
+ _this.shareIdentifier = options.shareIdentifier;
95
+ }
96
+ return _this;
97
+ }
98
+ return RequestShareMessage;
99
+ }(_classSuper)),
100
+ (function () {
101
+ var _b;
102
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
103
+ _type_decorators = [(0, core_1.IsValidMessageType)(RequestShareMessage.type)];
104
+ _vaultId_decorators = [(0, class_transformer_1.Expose)({ name: 'vault_id' }), (0, class_validator_1.IsString)()];
105
+ _docId_decorators = [(0, class_transformer_1.Expose)({ name: 'doc_id' }), (0, class_validator_1.IsString)()];
106
+ _sessionId_decorators = [(0, class_transformer_1.Expose)({ name: 'session_id' }), (0, class_validator_1.IsString)()];
107
+ _requesterDid_decorators = [(0, class_transformer_1.Expose)({ name: 'requester_did' }), (0, class_validator_1.IsString)()];
108
+ _shareIdentifier_decorators = [(0, class_transformer_1.Expose)({ name: 'share_identifier' }), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsNumber)()];
109
+ __esDecorate(null, null, _type_decorators, { kind: "field", name: "type", static: false, private: false, access: { has: function (obj) { return "type" in obj; }, get: function (obj) { return obj.type; }, set: function (obj, value) { obj.type = value; } }, metadata: _metadata }, _type_initializers, _instanceExtraInitializers);
110
+ __esDecorate(null, null, _vaultId_decorators, { kind: "field", name: "vaultId", static: false, private: false, access: { has: function (obj) { return "vaultId" in obj; }, get: function (obj) { return obj.vaultId; }, set: function (obj, value) { obj.vaultId = value; } }, metadata: _metadata }, _vaultId_initializers, _instanceExtraInitializers);
111
+ __esDecorate(null, null, _docId_decorators, { kind: "field", name: "docId", static: false, private: false, access: { has: function (obj) { return "docId" in obj; }, get: function (obj) { return obj.docId; }, set: function (obj, value) { obj.docId = value; } }, metadata: _metadata }, _docId_initializers, _instanceExtraInitializers);
112
+ __esDecorate(null, null, _sessionId_decorators, { kind: "field", name: "sessionId", static: false, private: false, access: { has: function (obj) { return "sessionId" in obj; }, get: function (obj) { return obj.sessionId; }, set: function (obj, value) { obj.sessionId = value; } }, metadata: _metadata }, _sessionId_initializers, _instanceExtraInitializers);
113
+ __esDecorate(null, null, _requesterDid_decorators, { kind: "field", name: "requesterDid", static: false, private: false, access: { has: function (obj) { return "requesterDid" in obj; }, get: function (obj) { return obj.requesterDid; }, set: function (obj, value) { obj.requesterDid = value; } }, metadata: _metadata }, _requesterDid_initializers, _instanceExtraInitializers);
114
+ __esDecorate(null, null, _shareIdentifier_decorators, { kind: "field", name: "shareIdentifier", static: false, private: false, access: { has: function (obj) { return "shareIdentifier" in obj; }, get: function (obj) { return obj.shareIdentifier; }, set: function (obj, value) { obj.shareIdentifier = value; } }, metadata: _metadata }, _shareIdentifier_initializers, _instanceExtraInitializers);
115
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
116
+ })(),
117
+ _a.type = (0, core_1.parseMessageType)('https://didcomm.org/vaults/1.0/request-share'),
118
+ _a;
119
+ }();
120
+ exports.RequestShareMessage = RequestShareMessage;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
18
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
19
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
20
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
21
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
22
+ var _, done = false;
23
+ for (var i = decorators.length - 1; i >= 0; i--) {
24
+ var context = {};
25
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
26
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
27
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
28
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
29
+ if (kind === "accessor") {
30
+ if (result === void 0) continue;
31
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
32
+ if (_ = accept(result.get)) descriptor.get = _;
33
+ if (_ = accept(result.set)) descriptor.set = _;
34
+ if (_ = accept(result.init)) initializers.unshift(_);
35
+ }
36
+ else if (_ = accept(result)) {
37
+ if (kind === "field") initializers.unshift(_);
38
+ else descriptor[key] = _;
39
+ }
40
+ }
41
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
42
+ done = true;
43
+ };
44
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
45
+ var useValue = arguments.length > 2;
46
+ for (var i = 0; i < initializers.length; i++) {
47
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
48
+ }
49
+ return useValue ? value : void 0;
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.RetrieveVaultMessage = void 0;
53
+ var core_1 = require("@credo-ts/core");
54
+ var class_transformer_1 = require("class-transformer");
55
+ var class_validator_1 = require("class-validator");
56
+ /**
57
+ * Retrieve vault from remote service
58
+ *
59
+ * @see https://didcomm.org/vaults/1.0/retrieve-vault
60
+ */
61
+ var RetrieveVaultMessage = function () {
62
+ var _a;
63
+ var _classSuper = core_1.AgentMessage;
64
+ var _instanceExtraInitializers = [];
65
+ var _type_decorators;
66
+ var _type_initializers = [];
67
+ var _vaultId_decorators;
68
+ var _vaultId_initializers = [];
69
+ var _docId_decorators;
70
+ var _docId_initializers = [];
71
+ var _storageLocation_decorators;
72
+ var _storageLocation_initializers = [];
73
+ return _a = /** @class */ (function (_super) {
74
+ __extends(RetrieveVaultMessage, _super);
75
+ function RetrieveVaultMessage(options) {
76
+ var _b;
77
+ var _this = _super.call(this) || this;
78
+ _this.type = (__runInitializers(_this, _instanceExtraInitializers), __runInitializers(_this, _type_initializers, _a.type.messageTypeUri));
79
+ _this.vaultId = __runInitializers(_this, _vaultId_initializers, void 0);
80
+ _this.docId = __runInitializers(_this, _docId_initializers, void 0);
81
+ _this.storageLocation = __runInitializers(_this, _storageLocation_initializers, void 0);
82
+ if (options) {
83
+ _this.id = (_b = options.id) !== null && _b !== void 0 ? _b : _this.generateId();
84
+ _this.vaultId = options.vaultId;
85
+ _this.docId = options.docId;
86
+ _this.storageLocation = options.storageLocation;
87
+ }
88
+ return _this;
89
+ }
90
+ return RetrieveVaultMessage;
91
+ }(_classSuper)),
92
+ (function () {
93
+ var _b;
94
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
95
+ _type_decorators = [(0, core_1.IsValidMessageType)(RetrieveVaultMessage.type)];
96
+ _vaultId_decorators = [(0, class_transformer_1.Expose)({ name: 'vault_id' }), (0, class_validator_1.IsString)()];
97
+ _docId_decorators = [(0, class_transformer_1.Expose)({ name: 'doc_id' }), (0, class_validator_1.IsString)()];
98
+ _storageLocation_decorators = [(0, class_transformer_1.Expose)({ name: 'storage_location' }), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)()];
99
+ __esDecorate(null, null, _type_decorators, { kind: "field", name: "type", static: false, private: false, access: { has: function (obj) { return "type" in obj; }, get: function (obj) { return obj.type; }, set: function (obj, value) { obj.type = value; } }, metadata: _metadata }, _type_initializers, _instanceExtraInitializers);
100
+ __esDecorate(null, null, _vaultId_decorators, { kind: "field", name: "vaultId", static: false, private: false, access: { has: function (obj) { return "vaultId" in obj; }, get: function (obj) { return obj.vaultId; }, set: function (obj, value) { obj.vaultId = value; } }, metadata: _metadata }, _vaultId_initializers, _instanceExtraInitializers);
101
+ __esDecorate(null, null, _docId_decorators, { kind: "field", name: "docId", static: false, private: false, access: { has: function (obj) { return "docId" in obj; }, get: function (obj) { return obj.docId; }, set: function (obj, value) { obj.docId = value; } }, metadata: _metadata }, _docId_initializers, _instanceExtraInitializers);
102
+ __esDecorate(null, null, _storageLocation_decorators, { kind: "field", name: "storageLocation", static: false, private: false, access: { has: function (obj) { return "storageLocation" in obj; }, get: function (obj) { return obj.storageLocation; }, set: function (obj, value) { obj.storageLocation = value; } }, metadata: _metadata }, _storageLocation_initializers, _instanceExtraInitializers);
103
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
104
+ })(),
105
+ _a.type = (0, core_1.parseMessageType)('https://didcomm.org/vaults/1.0/retrieve-vault'),
106
+ _a;
107
+ }();
108
+ exports.RetrieveVaultMessage = RetrieveVaultMessage;
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
18
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
19
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
20
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
21
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
22
+ var _, done = false;
23
+ for (var i = decorators.length - 1; i >= 0; i--) {
24
+ var context = {};
25
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
26
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
27
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
28
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
29
+ if (kind === "accessor") {
30
+ if (result === void 0) continue;
31
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
32
+ if (_ = accept(result.get)) descriptor.get = _;
33
+ if (_ = accept(result.set)) descriptor.set = _;
34
+ if (_ = accept(result.init)) initializers.unshift(_);
35
+ }
36
+ else if (_ = accept(result)) {
37
+ if (kind === "field") initializers.unshift(_);
38
+ else descriptor[key] = _;
39
+ }
40
+ }
41
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
42
+ done = true;
43
+ };
44
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
45
+ var useValue = arguments.length > 2;
46
+ for (var i = 0; i < initializers.length; i++) {
47
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
48
+ }
49
+ return useValue ? value : void 0;
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.StoreVaultMessage = void 0;
53
+ var core_1 = require("@credo-ts/core");
54
+ var class_transformer_1 = require("class-transformer");
55
+ var class_validator_1 = require("class-validator");
56
+ /**
57
+ * Store vault on remote service (e.g., Arweave, IPFS)
58
+ *
59
+ * @see https://didcomm.org/vaults/1.0/store-vault
60
+ */
61
+ var StoreVaultMessage = function () {
62
+ var _a;
63
+ var _classSuper = core_1.AgentMessage;
64
+ var _instanceExtraInitializers = [];
65
+ var _type_decorators;
66
+ var _type_initializers = [];
67
+ var _vaultId_decorators;
68
+ var _vaultId_initializers = [];
69
+ var _docId_decorators;
70
+ var _docId_initializers = [];
71
+ var _header_decorators;
72
+ var _header_initializers = [];
73
+ var _ciphertext_decorators;
74
+ var _ciphertext_initializers = [];
75
+ return _a = /** @class */ (function (_super) {
76
+ __extends(StoreVaultMessage, _super);
77
+ function StoreVaultMessage(options) {
78
+ var _b;
79
+ var _this = _super.call(this) || this;
80
+ _this.type = (__runInitializers(_this, _instanceExtraInitializers), __runInitializers(_this, _type_initializers, _a.type.messageTypeUri));
81
+ _this.vaultId = __runInitializers(_this, _vaultId_initializers, void 0);
82
+ _this.docId = __runInitializers(_this, _docId_initializers, void 0);
83
+ _this.header = __runInitializers(_this, _header_initializers, void 0);
84
+ _this.ciphertext = __runInitializers(_this, _ciphertext_initializers, void 0);
85
+ if (options) {
86
+ _this.id = (_b = options.id) !== null && _b !== void 0 ? _b : _this.generateId();
87
+ _this.vaultId = options.vaultId;
88
+ _this.docId = options.docId;
89
+ _this.header = options.header;
90
+ _this.ciphertext = options.ciphertext;
91
+ }
92
+ return _this;
93
+ }
94
+ return StoreVaultMessage;
95
+ }(_classSuper)),
96
+ (function () {
97
+ var _b;
98
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
99
+ _type_decorators = [(0, core_1.IsValidMessageType)(StoreVaultMessage.type)];
100
+ _vaultId_decorators = [(0, class_transformer_1.Expose)({ name: 'vault_id' }), (0, class_validator_1.IsString)()];
101
+ _docId_decorators = [(0, class_transformer_1.Expose)({ name: 'doc_id' }), (0, class_validator_1.IsString)()];
102
+ _header_decorators = [(0, class_transformer_1.Expose)(), (0, class_validator_1.IsObject)(), (0, class_validator_1.ValidateNested)(), (0, class_transformer_1.Type)(function () { return Object; })];
103
+ _ciphertext_decorators = [(0, class_transformer_1.Expose)(), (0, class_validator_1.IsString)()];
104
+ __esDecorate(null, null, _type_decorators, { kind: "field", name: "type", static: false, private: false, access: { has: function (obj) { return "type" in obj; }, get: function (obj) { return obj.type; }, set: function (obj, value) { obj.type = value; } }, metadata: _metadata }, _type_initializers, _instanceExtraInitializers);
105
+ __esDecorate(null, null, _vaultId_decorators, { kind: "field", name: "vaultId", static: false, private: false, access: { has: function (obj) { return "vaultId" in obj; }, get: function (obj) { return obj.vaultId; }, set: function (obj, value) { obj.vaultId = value; } }, metadata: _metadata }, _vaultId_initializers, _instanceExtraInitializers);
106
+ __esDecorate(null, null, _docId_decorators, { kind: "field", name: "docId", static: false, private: false, access: { has: function (obj) { return "docId" in obj; }, get: function (obj) { return obj.docId; }, set: function (obj, value) { obj.docId = value; } }, metadata: _metadata }, _docId_initializers, _instanceExtraInitializers);
107
+ __esDecorate(null, null, _header_decorators, { kind: "field", name: "header", static: false, private: false, access: { has: function (obj) { return "header" in obj; }, get: function (obj) { return obj.header; }, set: function (obj, value) { obj.header = value; } }, metadata: _metadata }, _header_initializers, _instanceExtraInitializers);
108
+ __esDecorate(null, null, _ciphertext_decorators, { kind: "field", name: "ciphertext", static: false, private: false, access: { has: function (obj) { return "ciphertext" in obj; }, get: function (obj) { return obj.ciphertext; }, set: function (obj, value) { obj.ciphertext = value; } }, metadata: _metadata }, _ciphertext_initializers, _instanceExtraInitializers);
109
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
110
+ })(),
111
+ _a.type = (0, core_1.parseMessageType)('https://didcomm.org/vaults/1.0/store-vault'),
112
+ _a;
113
+ }();
114
+ exports.StoreVaultMessage = StoreVaultMessage;
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
18
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
19
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
20
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
21
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
22
+ var _, done = false;
23
+ for (var i = decorators.length - 1; i >= 0; i--) {
24
+ var context = {};
25
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
26
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
27
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
28
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
29
+ if (kind === "accessor") {
30
+ if (result === void 0) continue;
31
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
32
+ if (_ = accept(result.get)) descriptor.get = _;
33
+ if (_ = accept(result.set)) descriptor.set = _;
34
+ if (_ = accept(result.init)) initializers.unshift(_);
35
+ }
36
+ else if (_ = accept(result)) {
37
+ if (kind === "field") initializers.unshift(_);
38
+ else descriptor[key] = _;
39
+ }
40
+ }
41
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
42
+ done = true;
43
+ };
44
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
45
+ var useValue = arguments.length > 2;
46
+ for (var i = 0; i < initializers.length; i++) {
47
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
48
+ }
49
+ return useValue ? value : void 0;
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.UpdateVaultMessage = void 0;
53
+ var core_1 = require("@credo-ts/core");
54
+ var class_transformer_1 = require("class-transformer");
55
+ var class_validator_1 = require("class-validator");
56
+ /**
57
+ * Update vault content (re-encryption, policy change, etc.)
58
+ *
59
+ * @see https://didcomm.org/vaults/1.0/update-vault
60
+ */
61
+ var UpdateVaultMessage = function () {
62
+ var _a;
63
+ var _classSuper = core_1.AgentMessage;
64
+ var _instanceExtraInitializers = [];
65
+ var _type_decorators;
66
+ var _type_initializers = [];
67
+ var _vaultId_decorators;
68
+ var _vaultId_initializers = [];
69
+ var _docId_decorators;
70
+ var _docId_initializers = [];
71
+ var _newHeader_decorators;
72
+ var _newHeader_initializers = [];
73
+ var _newCiphertext_decorators;
74
+ var _newCiphertext_initializers = [];
75
+ var _reason_decorators;
76
+ var _reason_initializers = [];
77
+ return _a = /** @class */ (function (_super) {
78
+ __extends(UpdateVaultMessage, _super);
79
+ function UpdateVaultMessage(options) {
80
+ var _b;
81
+ var _this = _super.call(this) || this;
82
+ _this.type = (__runInitializers(_this, _instanceExtraInitializers), __runInitializers(_this, _type_initializers, _a.type.messageTypeUri));
83
+ _this.vaultId = __runInitializers(_this, _vaultId_initializers, void 0);
84
+ _this.docId = __runInitializers(_this, _docId_initializers, void 0);
85
+ _this.newHeader = __runInitializers(_this, _newHeader_initializers, void 0);
86
+ _this.newCiphertext = __runInitializers(_this, _newCiphertext_initializers, void 0);
87
+ _this.reason = __runInitializers(_this, _reason_initializers, void 0);
88
+ if (options) {
89
+ _this.id = (_b = options.id) !== null && _b !== void 0 ? _b : _this.generateId();
90
+ _this.vaultId = options.vaultId;
91
+ _this.docId = options.docId;
92
+ _this.newHeader = options.newHeader;
93
+ _this.newCiphertext = options.newCiphertext;
94
+ _this.reason = options.reason;
95
+ }
96
+ return _this;
97
+ }
98
+ return UpdateVaultMessage;
99
+ }(_classSuper)),
100
+ (function () {
101
+ var _b;
102
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
103
+ _type_decorators = [(0, core_1.IsValidMessageType)(UpdateVaultMessage.type)];
104
+ _vaultId_decorators = [(0, class_transformer_1.Expose)({ name: 'vault_id' }), (0, class_validator_1.IsString)()];
105
+ _docId_decorators = [(0, class_transformer_1.Expose)({ name: 'doc_id' }), (0, class_validator_1.IsString)()];
106
+ _newHeader_decorators = [(0, class_transformer_1.Expose)({ name: 'new_header' }), (0, class_validator_1.IsObject)(), (0, class_validator_1.ValidateNested)(), (0, class_transformer_1.Type)(function () { return Object; })];
107
+ _newCiphertext_decorators = [(0, class_transformer_1.Expose)({ name: 'new_ciphertext' }), (0, class_validator_1.IsString)()];
108
+ _reason_decorators = [(0, class_transformer_1.Expose)(), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)()];
109
+ __esDecorate(null, null, _type_decorators, { kind: "field", name: "type", static: false, private: false, access: { has: function (obj) { return "type" in obj; }, get: function (obj) { return obj.type; }, set: function (obj, value) { obj.type = value; } }, metadata: _metadata }, _type_initializers, _instanceExtraInitializers);
110
+ __esDecorate(null, null, _vaultId_decorators, { kind: "field", name: "vaultId", static: false, private: false, access: { has: function (obj) { return "vaultId" in obj; }, get: function (obj) { return obj.vaultId; }, set: function (obj, value) { obj.vaultId = value; } }, metadata: _metadata }, _vaultId_initializers, _instanceExtraInitializers);
111
+ __esDecorate(null, null, _docId_decorators, { kind: "field", name: "docId", static: false, private: false, access: { has: function (obj) { return "docId" in obj; }, get: function (obj) { return obj.docId; }, set: function (obj, value) { obj.docId = value; } }, metadata: _metadata }, _docId_initializers, _instanceExtraInitializers);
112
+ __esDecorate(null, null, _newHeader_decorators, { kind: "field", name: "newHeader", static: false, private: false, access: { has: function (obj) { return "newHeader" in obj; }, get: function (obj) { return obj.newHeader; }, set: function (obj, value) { obj.newHeader = value; } }, metadata: _metadata }, _newHeader_initializers, _instanceExtraInitializers);
113
+ __esDecorate(null, null, _newCiphertext_decorators, { kind: "field", name: "newCiphertext", static: false, private: false, access: { has: function (obj) { return "newCiphertext" in obj; }, get: function (obj) { return obj.newCiphertext; }, set: function (obj, value) { obj.newCiphertext = value; } }, metadata: _metadata }, _newCiphertext_initializers, _instanceExtraInitializers);
114
+ __esDecorate(null, null, _reason_decorators, { kind: "field", name: "reason", static: false, private: false, access: { has: function (obj) { return "reason" in obj; }, get: function (obj) { return obj.reason; }, set: function (obj, value) { obj.reason = value; } }, metadata: _metadata }, _reason_initializers, _instanceExtraInitializers);
115
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
116
+ })(),
117
+ _a.type = (0, core_1.parseMessageType)('https://didcomm.org/vaults/1.0/update-vault'),
118
+ _a;
119
+ }();
120
+ exports.UpdateVaultMessage = UpdateVaultMessage;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
18
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
19
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
20
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
21
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
22
+ var _, done = false;
23
+ for (var i = decorators.length - 1; i >= 0; i--) {
24
+ var context = {};
25
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
26
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
27
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
28
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
29
+ if (kind === "accessor") {
30
+ if (result === void 0) continue;
31
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
32
+ if (_ = accept(result.get)) descriptor.get = _;
33
+ if (_ = accept(result.set)) descriptor.set = _;
34
+ if (_ = accept(result.init)) initializers.unshift(_);
35
+ }
36
+ else if (_ = accept(result)) {
37
+ if (kind === "field") initializers.unshift(_);
38
+ else descriptor[key] = _;
39
+ }
40
+ }
41
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
42
+ done = true;
43
+ };
44
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
45
+ var useValue = arguments.length > 2;
46
+ for (var i = 0; i < initializers.length; i++) {
47
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
48
+ }
49
+ return useValue ? value : void 0;
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.VaultCreatedAckMessage = void 0;
53
+ var core_1 = require("@credo-ts/core");
54
+ var class_transformer_1 = require("class-transformer");
55
+ var class_validator_1 = require("class-validator");
56
+ /**
57
+ * Acknowledgment message for vault creation
58
+ *
59
+ * @see https://didcomm.org/vaults/1.0/vault-created-ack
60
+ */
61
+ var VaultCreatedAckMessage = function () {
62
+ var _a;
63
+ var _classSuper = core_1.AgentMessage;
64
+ var _instanceExtraInitializers = [];
65
+ var _type_decorators;
66
+ var _type_initializers = [];
67
+ var _vaultId_decorators;
68
+ var _vaultId_initializers = [];
69
+ var _status_decorators;
70
+ var _status_initializers = [];
71
+ var _reason_decorators;
72
+ var _reason_initializers = [];
73
+ return _a = /** @class */ (function (_super) {
74
+ __extends(VaultCreatedAckMessage, _super);
75
+ function VaultCreatedAckMessage(options) {
76
+ var _b;
77
+ var _this = _super.call(this) || this;
78
+ _this.type = (__runInitializers(_this, _instanceExtraInitializers), __runInitializers(_this, _type_initializers, _a.type.messageTypeUri));
79
+ _this.vaultId = __runInitializers(_this, _vaultId_initializers, void 0);
80
+ _this.status = __runInitializers(_this, _status_initializers, void 0);
81
+ _this.reason = __runInitializers(_this, _reason_initializers, void 0);
82
+ if (options) {
83
+ _this.id = (_b = options.id) !== null && _b !== void 0 ? _b : _this.generateId();
84
+ _this.vaultId = options.vaultId;
85
+ _this.status = options.status;
86
+ _this.reason = options.reason;
87
+ }
88
+ return _this;
89
+ }
90
+ return VaultCreatedAckMessage;
91
+ }(_classSuper)),
92
+ (function () {
93
+ var _b;
94
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
95
+ _type_decorators = [(0, core_1.IsValidMessageType)(VaultCreatedAckMessage.type)];
96
+ _vaultId_decorators = [(0, class_transformer_1.Expose)({ name: 'vault_id' }), (0, class_validator_1.IsString)()];
97
+ _status_decorators = [(0, class_transformer_1.Expose)(), (0, class_validator_1.IsIn)(['accepted', 'rejected'])];
98
+ _reason_decorators = [(0, class_transformer_1.Expose)(), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)()];
99
+ __esDecorate(null, null, _type_decorators, { kind: "field", name: "type", static: false, private: false, access: { has: function (obj) { return "type" in obj; }, get: function (obj) { return obj.type; }, set: function (obj, value) { obj.type = value; } }, metadata: _metadata }, _type_initializers, _instanceExtraInitializers);
100
+ __esDecorate(null, null, _vaultId_decorators, { kind: "field", name: "vaultId", static: false, private: false, access: { has: function (obj) { return "vaultId" in obj; }, get: function (obj) { return obj.vaultId; }, set: function (obj, value) { obj.vaultId = value; } }, metadata: _metadata }, _vaultId_initializers, _instanceExtraInitializers);
101
+ __esDecorate(null, null, _status_decorators, { kind: "field", name: "status", static: false, private: false, access: { has: function (obj) { return "status" in obj; }, get: function (obj) { return obj.status; }, set: function (obj, value) { obj.status = value; } }, metadata: _metadata }, _status_initializers, _instanceExtraInitializers);
102
+ __esDecorate(null, null, _reason_decorators, { kind: "field", name: "reason", static: false, private: false, access: { has: function (obj) { return "reason" in obj; }, get: function (obj) { return obj.reason; }, set: function (obj, value) { obj.reason = value; } }, metadata: _metadata }, _reason_initializers, _instanceExtraInitializers);
103
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
104
+ })(),
105
+ _a.type = (0, core_1.parseMessageType)('https://didcomm.org/vaults/1.0/vault-created-ack'),
106
+ _a;
107
+ }();
108
+ exports.VaultCreatedAckMessage = VaultCreatedAckMessage;