@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.
- package/LICENSE +202 -0
- package/build/VaultsApi.js +263 -0
- package/build/VaultsEvents.js +19 -0
- package/build/VaultsModule.js +71 -0
- package/build/crypto/wasm/VaultCrypto.js +70 -0
- package/build/errors/BadSuiteError.js +34 -0
- package/build/errors/DecryptAeadError.js +34 -0
- package/build/errors/DecryptKemError.js +34 -0
- package/build/errors/PolicyError.js +34 -0
- package/build/errors/VaultError.js +77 -0
- package/build/errors/index.js +16 -0
- package/build/index.js +119 -0
- package/build/messages/CreateVaultMessage.js +126 -0
- package/build/messages/DeleteVaultMessage.js +114 -0
- package/build/messages/DenyAccessMessage.js +114 -0
- package/build/messages/DenyShareMessage.js +120 -0
- package/build/messages/GrantAccessMessage.js +126 -0
- package/build/messages/ProvideShareMessage.js +126 -0
- package/build/messages/RequestAccessMessage.js +120 -0
- package/build/messages/RequestShareMessage.js +120 -0
- package/build/messages/RetrieveVaultMessage.js +108 -0
- package/build/messages/StoreVaultMessage.js +114 -0
- package/build/messages/UpdateVaultMessage.js +120 -0
- package/build/messages/VaultCreatedAckMessage.js +108 -0
- package/build/messages/VaultDataMessage.js +121 -0
- package/build/messages/VaultProblemReportMessage.js +124 -0
- package/build/messages/VaultStoredAckMessage.js +115 -0
- package/build/messages/index.js +36 -0
- package/build/models/ThresholdSession.js +24 -0
- package/build/models/VaultDocument.js +28 -0
- package/build/models/VaultHeader.js +31 -0
- package/build/models/VaultPolicy.js +29 -0
- package/build/models/index.js +20 -0
- package/build/repository/ThresholdSessionRecord.js +117 -0
- package/build/repository/ThresholdSessionRepository.js +216 -0
- package/build/repository/VaultRecord.js +128 -0
- package/build/repository/VaultRepository.js +200 -0
- package/build/repository/index.js +13 -0
- package/build/services/VaultEncryptionService.js +613 -0
- package/build/services/VaultService.js +398 -0
- package/build/services/index.js +8 -0
- package/package.json +45 -0
- package/wasm/README.md +166 -0
- package/wasm/package.json +16 -0
- package/wasm/vault_crypto.d.ts +526 -0
- package/wasm/vault_crypto.js +2137 -0
- package/wasm/vault_crypto_bg.wasm +0 -0
- package/wasm/vault_crypto_bg.wasm.d.ts +66 -0
|
@@ -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.DenyAccessMessage = 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
|
+
* Deny access request
|
|
58
|
+
*
|
|
59
|
+
* @see https://didcomm.org/vaults/1.0/deny-access
|
|
60
|
+
*/
|
|
61
|
+
var DenyAccessMessage = 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 _reason_decorators;
|
|
72
|
+
var _reason_initializers = [];
|
|
73
|
+
var _message_decorators;
|
|
74
|
+
var _message_initializers = [];
|
|
75
|
+
return _a = /** @class */ (function (_super) {
|
|
76
|
+
__extends(DenyAccessMessage, _super);
|
|
77
|
+
function DenyAccessMessage(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.reason = __runInitializers(_this, _reason_initializers, void 0);
|
|
84
|
+
_this.message = __runInitializers(_this, _message_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.reason = options.reason;
|
|
90
|
+
_this.message = options.message;
|
|
91
|
+
}
|
|
92
|
+
return _this;
|
|
93
|
+
}
|
|
94
|
+
return DenyAccessMessage;
|
|
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)(DenyAccessMessage.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
|
+
_reason_decorators = [(0, class_transformer_1.Expose)(), (0, class_validator_1.IsIn)(['not-authorized', 'policy-violation', 'expired', 'revoked'])];
|
|
103
|
+
_message_decorators = [(0, class_transformer_1.Expose)(), (0, class_validator_1.IsOptional)(), (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, _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);
|
|
108
|
+
__esDecorate(null, null, _message_decorators, { kind: "field", name: "message", static: false, private: false, access: { has: function (obj) { return "message" in obj; }, get: function (obj) { return obj.message; }, set: function (obj, value) { obj.message = value; } }, metadata: _metadata }, _message_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/deny-access'),
|
|
112
|
+
_a;
|
|
113
|
+
}();
|
|
114
|
+
exports.DenyAccessMessage = DenyAccessMessage;
|
|
@@ -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.DenyShareMessage = 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
|
+
* Deny share request for threshold vault
|
|
58
|
+
*
|
|
59
|
+
* @see https://didcomm.org/vaults/1.0/deny-share
|
|
60
|
+
*/
|
|
61
|
+
var DenyShareMessage = 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 _reason_decorators;
|
|
74
|
+
var _reason_initializers = [];
|
|
75
|
+
var _message_decorators;
|
|
76
|
+
var _message_initializers = [];
|
|
77
|
+
return _a = /** @class */ (function (_super) {
|
|
78
|
+
__extends(DenyShareMessage, _super);
|
|
79
|
+
function DenyShareMessage(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.reason = __runInitializers(_this, _reason_initializers, void 0);
|
|
87
|
+
_this.message = __runInitializers(_this, _message_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.reason = options.reason;
|
|
94
|
+
_this.message = options.message;
|
|
95
|
+
}
|
|
96
|
+
return _this;
|
|
97
|
+
}
|
|
98
|
+
return DenyShareMessage;
|
|
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)(DenyShareMessage.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
|
+
_reason_decorators = [(0, class_transformer_1.Expose)(), (0, class_validator_1.IsIn)(['not-authorized', 'policy-violation', 'expired', 'invalid-session'])];
|
|
108
|
+
_message_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, _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, _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);
|
|
114
|
+
__esDecorate(null, null, _message_decorators, { kind: "field", name: "message", static: false, private: false, access: { has: function (obj) { return "message" in obj; }, get: function (obj) { return obj.message; }, set: function (obj, value) { obj.message = value; } }, metadata: _metadata }, _message_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/deny-share'),
|
|
118
|
+
_a;
|
|
119
|
+
}();
|
|
120
|
+
exports.DenyShareMessage = DenyShareMessage;
|
|
@@ -0,0 +1,126 @@
|
|
|
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.GrantAccessMessage = 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
|
+
* Grant access by sending CEK wrap
|
|
58
|
+
*
|
|
59
|
+
* @see https://didcomm.org/vaults/1.0/grant-access
|
|
60
|
+
*/
|
|
61
|
+
var GrantAccessMessage = 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 _cekWrap_decorators;
|
|
72
|
+
var _cekWrap_initializers = [];
|
|
73
|
+
var _wrapMethod_decorators;
|
|
74
|
+
var _wrapMethod_initializers = [];
|
|
75
|
+
var _expiresAt_decorators;
|
|
76
|
+
var _expiresAt_initializers = [];
|
|
77
|
+
var _metadata_decorators;
|
|
78
|
+
var _metadata_initializers = [];
|
|
79
|
+
return _a = /** @class */ (function (_super) {
|
|
80
|
+
__extends(GrantAccessMessage, _super);
|
|
81
|
+
function GrantAccessMessage(options) {
|
|
82
|
+
var _b;
|
|
83
|
+
var _this = _super.call(this) || this;
|
|
84
|
+
_this.type = (__runInitializers(_this, _instanceExtraInitializers), __runInitializers(_this, _type_initializers, _a.type.messageTypeUri));
|
|
85
|
+
_this.vaultId = __runInitializers(_this, _vaultId_initializers, void 0);
|
|
86
|
+
_this.docId = __runInitializers(_this, _docId_initializers, void 0);
|
|
87
|
+
_this.cekWrap = __runInitializers(_this, _cekWrap_initializers, void 0);
|
|
88
|
+
_this.wrapMethod = __runInitializers(_this, _wrapMethod_initializers, void 0);
|
|
89
|
+
_this.expiresAt = __runInitializers(_this, _expiresAt_initializers, void 0);
|
|
90
|
+
_this.metadata = __runInitializers(_this, _metadata_initializers, void 0);
|
|
91
|
+
if (options) {
|
|
92
|
+
_this.id = (_b = options.id) !== null && _b !== void 0 ? _b : _this.generateId();
|
|
93
|
+
_this.vaultId = options.vaultId;
|
|
94
|
+
_this.docId = options.docId;
|
|
95
|
+
_this.cekWrap = options.cekWrap;
|
|
96
|
+
_this.wrapMethod = options.wrapMethod;
|
|
97
|
+
_this.expiresAt = options.expiresAt;
|
|
98
|
+
_this.metadata = options.metadata;
|
|
99
|
+
}
|
|
100
|
+
return _this;
|
|
101
|
+
}
|
|
102
|
+
return GrantAccessMessage;
|
|
103
|
+
}(_classSuper)),
|
|
104
|
+
(function () {
|
|
105
|
+
var _b;
|
|
106
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
|
|
107
|
+
_type_decorators = [(0, core_1.IsValidMessageType)(GrantAccessMessage.type)];
|
|
108
|
+
_vaultId_decorators = [(0, class_transformer_1.Expose)({ name: 'vault_id' }), (0, class_validator_1.IsString)()];
|
|
109
|
+
_docId_decorators = [(0, class_transformer_1.Expose)({ name: 'doc_id' }), (0, class_validator_1.IsString)()];
|
|
110
|
+
_cekWrap_decorators = [(0, class_transformer_1.Expose)({ name: 'cek_wrap' }), (0, class_validator_1.IsString)()];
|
|
111
|
+
_wrapMethod_decorators = [(0, class_transformer_1.Expose)({ name: 'wrap_method' }), (0, class_validator_1.IsIn)(['kem', 'password-hint', 'derived-key'])];
|
|
112
|
+
_expiresAt_decorators = [(0, class_transformer_1.Expose)({ name: 'expires_at' }), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)()];
|
|
113
|
+
_metadata_decorators = [(0, class_transformer_1.Expose)(), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsObject)()];
|
|
114
|
+
__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);
|
|
115
|
+
__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);
|
|
116
|
+
__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);
|
|
117
|
+
__esDecorate(null, null, _cekWrap_decorators, { kind: "field", name: "cekWrap", static: false, private: false, access: { has: function (obj) { return "cekWrap" in obj; }, get: function (obj) { return obj.cekWrap; }, set: function (obj, value) { obj.cekWrap = value; } }, metadata: _metadata }, _cekWrap_initializers, _instanceExtraInitializers);
|
|
118
|
+
__esDecorate(null, null, _wrapMethod_decorators, { kind: "field", name: "wrapMethod", static: false, private: false, access: { has: function (obj) { return "wrapMethod" in obj; }, get: function (obj) { return obj.wrapMethod; }, set: function (obj, value) { obj.wrapMethod = value; } }, metadata: _metadata }, _wrapMethod_initializers, _instanceExtraInitializers);
|
|
119
|
+
__esDecorate(null, null, _expiresAt_decorators, { kind: "field", name: "expiresAt", static: false, private: false, access: { has: function (obj) { return "expiresAt" in obj; }, get: function (obj) { return obj.expiresAt; }, set: function (obj, value) { obj.expiresAt = value; } }, metadata: _metadata }, _expiresAt_initializers, _instanceExtraInitializers);
|
|
120
|
+
__esDecorate(null, null, _metadata_decorators, { kind: "field", name: "metadata", static: false, private: false, access: { has: function (obj) { return "metadata" in obj; }, get: function (obj) { return obj.metadata; }, set: function (obj, value) { obj.metadata = value; } }, metadata: _metadata }, _metadata_initializers, _instanceExtraInitializers);
|
|
121
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
122
|
+
})(),
|
|
123
|
+
_a.type = (0, core_1.parseMessageType)('https://didcomm.org/vaults/1.0/grant-access'),
|
|
124
|
+
_a;
|
|
125
|
+
}();
|
|
126
|
+
exports.GrantAccessMessage = GrantAccessMessage;
|
|
@@ -0,0 +1,126 @@
|
|
|
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.ProvideShareMessage = 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
|
+
* Provide a Shamir share for threshold reconstruction
|
|
58
|
+
*
|
|
59
|
+
* @see https://didcomm.org/vaults/1.0/provide-share
|
|
60
|
+
*/
|
|
61
|
+
var ProvideShareMessage = 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 _shareIdentifier_decorators;
|
|
74
|
+
var _shareIdentifier_initializers = [];
|
|
75
|
+
var _shareValue_decorators;
|
|
76
|
+
var _shareValue_initializers = [];
|
|
77
|
+
var _expiresAt_decorators;
|
|
78
|
+
var _expiresAt_initializers = [];
|
|
79
|
+
return _a = /** @class */ (function (_super) {
|
|
80
|
+
__extends(ProvideShareMessage, _super);
|
|
81
|
+
function ProvideShareMessage(options) {
|
|
82
|
+
var _b;
|
|
83
|
+
var _this = _super.call(this) || this;
|
|
84
|
+
_this.type = (__runInitializers(_this, _instanceExtraInitializers), __runInitializers(_this, _type_initializers, _a.type.messageTypeUri));
|
|
85
|
+
_this.vaultId = __runInitializers(_this, _vaultId_initializers, void 0);
|
|
86
|
+
_this.docId = __runInitializers(_this, _docId_initializers, void 0);
|
|
87
|
+
_this.sessionId = __runInitializers(_this, _sessionId_initializers, void 0);
|
|
88
|
+
_this.shareIdentifier = __runInitializers(_this, _shareIdentifier_initializers, void 0);
|
|
89
|
+
_this.shareValue = __runInitializers(_this, _shareValue_initializers, void 0);
|
|
90
|
+
_this.expiresAt = __runInitializers(_this, _expiresAt_initializers, void 0);
|
|
91
|
+
if (options) {
|
|
92
|
+
_this.id = (_b = options.id) !== null && _b !== void 0 ? _b : _this.generateId();
|
|
93
|
+
_this.vaultId = options.vaultId;
|
|
94
|
+
_this.docId = options.docId;
|
|
95
|
+
_this.sessionId = options.sessionId;
|
|
96
|
+
_this.shareIdentifier = options.shareIdentifier;
|
|
97
|
+
_this.shareValue = options.shareValue;
|
|
98
|
+
_this.expiresAt = options.expiresAt;
|
|
99
|
+
}
|
|
100
|
+
return _this;
|
|
101
|
+
}
|
|
102
|
+
return ProvideShareMessage;
|
|
103
|
+
}(_classSuper)),
|
|
104
|
+
(function () {
|
|
105
|
+
var _b;
|
|
106
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
|
|
107
|
+
_type_decorators = [(0, core_1.IsValidMessageType)(ProvideShareMessage.type)];
|
|
108
|
+
_vaultId_decorators = [(0, class_transformer_1.Expose)({ name: 'vault_id' }), (0, class_validator_1.IsString)()];
|
|
109
|
+
_docId_decorators = [(0, class_transformer_1.Expose)({ name: 'doc_id' }), (0, class_validator_1.IsString)()];
|
|
110
|
+
_sessionId_decorators = [(0, class_transformer_1.Expose)({ name: 'session_id' }), (0, class_validator_1.IsString)()];
|
|
111
|
+
_shareIdentifier_decorators = [(0, class_transformer_1.Expose)({ name: 'share_identifier' }), (0, class_validator_1.IsNumber)()];
|
|
112
|
+
_shareValue_decorators = [(0, class_transformer_1.Expose)({ name: 'share_value' }), (0, class_validator_1.IsString)()];
|
|
113
|
+
_expiresAt_decorators = [(0, class_transformer_1.Expose)({ name: 'expires_at' }), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)()];
|
|
114
|
+
__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);
|
|
115
|
+
__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);
|
|
116
|
+
__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);
|
|
117
|
+
__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);
|
|
118
|
+
__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);
|
|
119
|
+
__esDecorate(null, null, _shareValue_decorators, { kind: "field", name: "shareValue", static: false, private: false, access: { has: function (obj) { return "shareValue" in obj; }, get: function (obj) { return obj.shareValue; }, set: function (obj, value) { obj.shareValue = value; } }, metadata: _metadata }, _shareValue_initializers, _instanceExtraInitializers);
|
|
120
|
+
__esDecorate(null, null, _expiresAt_decorators, { kind: "field", name: "expiresAt", static: false, private: false, access: { has: function (obj) { return "expiresAt" in obj; }, get: function (obj) { return obj.expiresAt; }, set: function (obj, value) { obj.expiresAt = value; } }, metadata: _metadata }, _expiresAt_initializers, _instanceExtraInitializers);
|
|
121
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
122
|
+
})(),
|
|
123
|
+
_a.type = (0, core_1.parseMessageType)('https://didcomm.org/vaults/1.0/provide-share'),
|
|
124
|
+
_a;
|
|
125
|
+
}();
|
|
126
|
+
exports.ProvideShareMessage = ProvideShareMessage;
|
|
@@ -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.RequestAccessMessage = 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 access to a vault
|
|
58
|
+
*
|
|
59
|
+
* @see https://didcomm.org/vaults/1.0/request-access
|
|
60
|
+
*/
|
|
61
|
+
var RequestAccessMessage = 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 _requesterDid_decorators;
|
|
72
|
+
var _requesterDid_initializers = [];
|
|
73
|
+
var _requesterKid_decorators;
|
|
74
|
+
var _requesterKid_initializers = [];
|
|
75
|
+
var _proof_decorators;
|
|
76
|
+
var _proof_initializers = [];
|
|
77
|
+
return _a = /** @class */ (function (_super) {
|
|
78
|
+
__extends(RequestAccessMessage, _super);
|
|
79
|
+
function RequestAccessMessage(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.requesterDid = __runInitializers(_this, _requesterDid_initializers, void 0);
|
|
86
|
+
_this.requesterKid = __runInitializers(_this, _requesterKid_initializers, void 0);
|
|
87
|
+
_this.proof = __runInitializers(_this, _proof_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.requesterDid = options.requesterDid;
|
|
93
|
+
_this.requesterKid = options.requesterKid;
|
|
94
|
+
_this.proof = options.proof;
|
|
95
|
+
}
|
|
96
|
+
return _this;
|
|
97
|
+
}
|
|
98
|
+
return RequestAccessMessage;
|
|
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)(RequestAccessMessage.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
|
+
_requesterDid_decorators = [(0, class_transformer_1.Expose)({ name: 'requester_did' }), (0, class_validator_1.IsString)()];
|
|
107
|
+
_requesterKid_decorators = [(0, class_transformer_1.Expose)({ name: 'requester_kid' }), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)()];
|
|
108
|
+
_proof_decorators = [(0, class_transformer_1.Expose)(), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsObject)()];
|
|
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, _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);
|
|
113
|
+
__esDecorate(null, null, _requesterKid_decorators, { kind: "field", name: "requesterKid", static: false, private: false, access: { has: function (obj) { return "requesterKid" in obj; }, get: function (obj) { return obj.requesterKid; }, set: function (obj, value) { obj.requesterKid = value; } }, metadata: _metadata }, _requesterKid_initializers, _instanceExtraInitializers);
|
|
114
|
+
__esDecorate(null, null, _proof_decorators, { kind: "field", name: "proof", static: false, private: false, access: { has: function (obj) { return "proof" in obj; }, get: function (obj) { return obj.proof; }, set: function (obj, value) { obj.proof = value; } }, metadata: _metadata }, _proof_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-access'),
|
|
118
|
+
_a;
|
|
119
|
+
}();
|
|
120
|
+
exports.RequestAccessMessage = RequestAccessMessage;
|