@nmshd/transport 2.0.0-beta.1 → 2.0.0-beta.10
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/dist/buildInformation.js +5 -5
- package/dist/core/CoreCrypto.d.ts +1 -0
- package/dist/core/CoreCrypto.js +17 -14
- package/dist/core/CoreCrypto.js.map +1 -1
- package/dist/core/CoreErrors.d.ts +62 -0
- package/dist/core/CoreErrors.js +138 -0
- package/dist/core/CoreErrors.js.map +1 -0
- package/dist/core/CoreIdHelper.js +2 -1
- package/dist/core/CoreIdHelper.js.map +1 -1
- package/dist/core/CoreSerializable.js.map +1 -1
- package/dist/core/CoreSerializableAsync.js.map +1 -1
- package/dist/core/CoreSynchronizable.js.map +1 -1
- package/dist/core/CoreUtil.js +2 -2
- package/dist/core/CoreUtil.js.map +1 -1
- package/dist/core/Reference.js +3 -3
- package/dist/core/Reference.js.map +1 -1
- package/dist/core/Transport.d.ts +1 -1
- package/dist/core/Transport.js +9 -5
- package/dist/core/Transport.js.map +1 -1
- package/dist/core/TransportController.d.ts +3 -2
- package/dist/core/TransportController.js +8 -6
- package/dist/core/TransportController.js.map +1 -1
- package/dist/core/TransportError.d.ts +2 -0
- package/dist/core/TransportError.js +7 -0
- package/dist/core/TransportError.js.map +1 -0
- package/dist/core/TransportLoggerFactory.js +2 -2
- package/dist/core/TransportLoggerFactory.js.map +1 -1
- package/dist/core/backbone/ClientResult.js +5 -4
- package/dist/core/backbone/ClientResult.js.map +1 -1
- package/dist/core/backbone/RESTClient.d.ts +4 -1
- package/dist/core/backbone/RESTClient.js +35 -41
- package/dist/core/backbone/RESTClient.js.map +1 -1
- package/dist/core/backbone/RESTClientAuthenticate.d.ts +2 -1
- package/dist/core/backbone/RESTClientAuthenticate.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/types/CoreAddress.d.ts +1 -1
- package/dist/core/types/CoreAddress.js.map +1 -1
- package/dist/core/types/CoreDate.js +4 -4
- package/dist/core/types/CoreDate.js.map +1 -1
- package/dist/core/types/CoreHash.js.map +1 -1
- package/dist/core/types/CoreId.d.ts +1 -1
- package/dist/core/types/CoreId.js +2 -2
- package/dist/core/types/CoreId.js.map +1 -1
- package/dist/modules/accounts/AccountController.d.ts +2 -0
- package/dist/modules/accounts/AccountController.js +32 -12
- package/dist/modules/accounts/AccountController.js.map +1 -1
- package/dist/modules/accounts/IdentityController.d.ts +1 -1
- package/dist/modules/accounts/IdentityController.js +24 -4
- package/dist/modules/accounts/IdentityController.js.map +1 -1
- package/dist/modules/accounts/IdentityUtil.d.ts +1 -1
- package/dist/modules/accounts/IdentityUtil.js +3 -4
- package/dist/modules/accounts/IdentityUtil.js.map +1 -1
- package/dist/modules/accounts/data/Identity.d.ts +0 -18
- package/dist/modules/accounts/data/Identity.js +0 -33
- package/dist/modules/accounts/data/Identity.js.map +1 -1
- package/dist/modules/accounts/data/IdentitySecretCredentials.js.map +1 -1
- package/dist/modules/certificates/data/Certificate.js.map +1 -1
- package/dist/modules/certificates/data/CertificateConstraint.js.map +1 -1
- package/dist/modules/certificates/data/CertificateContent.js.map +1 -1
- package/dist/modules/certificates/data/CertificateItem.js.map +1 -1
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.js.map +1 -1
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.js.map +1 -1
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.js.map +1 -1
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.js.map +1 -1
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.js.map +1 -1
- package/dist/modules/certificates/data/items/CertificateDelegateItem.js.map +1 -1
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.js.map +1 -1
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.js.map +1 -1
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.js.map +1 -1
- package/dist/modules/certificates/data/items/CertificateRoleItem.js.map +1 -1
- package/dist/modules/challenges/ChallengeController.js +27 -6
- package/dist/modules/challenges/ChallengeController.js.map +1 -1
- package/dist/modules/challenges/data/Challenge.js.map +1 -1
- package/dist/modules/challenges/data/ChallengeSigned.js.map +1 -1
- package/dist/modules/devices/DeviceController.d.ts +1 -1
- package/dist/modules/devices/DeviceController.js +43 -15
- package/dist/modules/devices/DeviceController.js.map +1 -1
- package/dist/modules/devices/DeviceSecretController.js +43 -14
- package/dist/modules/devices/DeviceSecretController.js.map +1 -1
- package/dist/modules/devices/DevicesController.js +4 -4
- package/dist/modules/devices/DevicesController.js.map +1 -1
- package/dist/modules/devices/local/Device.js.map +1 -1
- package/dist/modules/devices/local/DeviceSecretCredentials.js.map +1 -1
- package/dist/modules/devices/local/SendDeviceParameters.js.map +1 -1
- package/dist/modules/devices/transmission/DeviceSharedSecret.js.map +1 -1
- package/dist/modules/files/FileController.d.ts +3 -3
- package/dist/modules/files/FileController.js +51 -25
- package/dist/modules/files/FileController.js.map +1 -1
- package/dist/modules/files/backbone/FileClient.d.ts +2 -1
- package/dist/modules/files/backbone/FileClient.js.map +1 -1
- package/dist/modules/files/local/CachedFile.js.map +1 -1
- package/dist/modules/files/local/File.js.map +1 -1
- package/dist/modules/files/local/SendFileParameters.js.map +1 -1
- package/dist/modules/files/transmission/FileMetadata.js.map +1 -1
- package/dist/modules/files/transmission/FileReference.js.map +1 -1
- package/dist/modules/index.d.ts +4 -4
- package/dist/modules/index.js +4 -4
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/messages/MessageController.js +72 -18
- package/dist/modules/messages/MessageController.js.map +1 -1
- package/dist/modules/messages/local/CachedMessage.js.map +1 -1
- package/dist/modules/messages/local/Message.js.map +1 -1
- package/dist/modules/messages/local/SendMessageParameters.js.map +1 -1
- package/dist/modules/messages/transmission/{MessagePlain.d.ts → MessageContentWrapper.d.ts} +4 -4
- package/dist/modules/messages/transmission/{MessagePlain.js → MessageContentWrapper.js} +12 -12
- package/dist/modules/messages/transmission/MessageContentWrapper.js.map +1 -0
- package/dist/modules/messages/transmission/MessageEnvelope.js.map +1 -1
- package/dist/modules/messages/transmission/MessageEnvelopeRecipient.js.map +1 -1
- package/dist/modules/messages/transmission/MessageSignature.js.map +1 -1
- package/dist/modules/messages/transmission/MessageSigned.js.map +1 -1
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js +39 -16
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js.map +1 -1
- package/dist/modules/relationshipTemplates/backbone/BackboneGetRelationshipTemplates.d.ts +0 -1
- package/dist/modules/relationshipTemplates/backbone/BackbonePostRelationshipTemplates.d.ts +0 -5
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.d.ts +0 -11
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js +1 -15
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js.map +1 -1
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.js.map +1 -1
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.d.ts +0 -11
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.js +2 -17
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.js.map +1 -1
- package/dist/modules/relationshipTemplates/transmission/{RelationshipTemplateContent.d.ts → RelationshipTemplateContentWrapper.d.ts} +3 -3
- package/dist/modules/relationshipTemplates/transmission/{RelationshipTemplateContent.js → RelationshipTemplateContentWrapper.js} +10 -10
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContentWrapper.js.map +1 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplatePublicKey.js.map +1 -1
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateReference.js.map +1 -1
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateSigned.js.map +1 -1
- package/dist/modules/relationships/RelationshipSecretController.js +89 -18
- package/dist/modules/relationships/RelationshipSecretController.js.map +1 -1
- package/dist/modules/relationships/RelationshipsController.d.ts +3 -3
- package/dist/modules/relationships/RelationshipsController.js +125 -72
- package/dist/modules/relationships/RelationshipsController.js.map +1 -1
- package/dist/modules/relationships/local/CachedRelationship.js.map +1 -1
- package/dist/modules/relationships/local/Relationship.d.ts +1 -0
- package/dist/modules/relationships/local/Relationship.js +9 -9
- package/dist/modules/relationships/local/Relationship.js.map +1 -1
- package/dist/modules/relationships/local/SendRelationshipParameters.js.map +1 -1
- package/dist/modules/relationships/transmission/changes/RelationshipChange.js.map +1 -1
- package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.js.map +1 -1
- package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.js.map +1 -1
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.js.map +1 -1
- package/dist/modules/relationships/transmission/requests/{RelationshipCreationChangeRequestContent.d.ts → RelationshipCreationChangeRequestContentWrapper.d.ts} +3 -3
- package/dist/modules/relationships/transmission/requests/{RelationshipCreationChangeRequestContent.js → RelationshipCreationChangeRequestContentWrapper.js} +10 -10
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContentWrapper.js.map +1 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.js.map +1 -1
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.js.map +1 -1
- package/dist/modules/relationships/transmission/responses/{RelationshipCreationChangeResponseContent.d.ts → RelationshipCreationChangeResponseContentWrapper.d.ts} +3 -3
- package/dist/modules/relationships/transmission/responses/{RelationshipCreationChangeResponseContent.js → RelationshipCreationChangeResponseContentWrapper.js} +9 -9
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContentWrapper.js.map +1 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.js.map +1 -1
- package/dist/modules/secrets/SecretController.js +18 -5
- package/dist/modules/secrets/SecretController.js.map +1 -1
- package/dist/modules/secrets/data/SecretContainerCipher.js.map +1 -1
- package/dist/modules/secrets/data/SecretContainerPlain.js.map +1 -1
- package/dist/modules/sync/DatawalletModificationMapper.js +2 -2
- package/dist/modules/sync/DatawalletModificationMapper.js.map +1 -1
- package/dist/modules/sync/DatawalletModificationsProcessor.d.ts +1 -0
- package/dist/modules/sync/DatawalletModificationsProcessor.js +21 -4
- package/dist/modules/sync/DatawalletModificationsProcessor.js.map +1 -1
- package/dist/modules/sync/ExternalEventsProcessor.js +1 -1
- package/dist/modules/sync/ExternalEventsProcessor.js.map +1 -1
- package/dist/modules/sync/SyncController.d.ts +2 -0
- package/dist/modules/sync/SyncController.js +71 -30
- package/dist/modules/sync/SyncController.js.map +1 -1
- package/dist/modules/sync/local/DatawalletModification.js.map +1 -1
- package/dist/modules/tokens/AnonymousTokenController.js +1 -1
- package/dist/modules/tokens/AnonymousTokenController.js.map +1 -1
- package/dist/modules/tokens/TokenController.js +33 -6
- package/dist/modules/tokens/TokenController.js.map +1 -1
- package/dist/modules/tokens/local/CachedToken.js.map +1 -1
- package/dist/modules/tokens/local/SendTokenParameters.js.map +1 -1
- package/dist/modules/tokens/local/Token.js.map +1 -1
- package/dist/modules/tokens/transmission/TokenContentDeviceSharedSecret.js.map +1 -1
- package/dist/modules/tokens/transmission/TokenContentFile.js.map +1 -1
- package/dist/modules/tokens/transmission/TokenContentRelationshipTemplate.js.map +1 -1
- package/dist/modules/tokens/transmission/TokenReference.js.map +1 -1
- package/dist/util/PasswordGenerator.js +2 -2
- package/dist/util/PasswordGenerator.js.map +1 -1
- package/dist/util/Random.js +8 -8
- package/dist/util/Random.js.map +1 -1
- package/lib-web/nmshd.transport.js +3607 -9700
- package/lib-web/nmshd.transport.js.map +1 -1
- package/lib-web/nmshd.transport.min.js +1 -1
- package/lib-web/nmshd.transport.min.js.map +1 -1
- package/package.json +24 -24
- package/dist/core/TransportErrors.d.ts +0 -131
- package/dist/core/TransportErrors.js +0 -284
- package/dist/core/TransportErrors.js.map +0 -1
- package/dist/modules/messages/transmission/MessagePlain.js.map +0 -1
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContent.js.map +0 -1
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContent.js.map +0 -1
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContent.js.map +0 -1
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.RelationshipSecretController = void 0;
|
|
13
|
+
const ts_utils_1 = require("@js-soft/ts-utils");
|
|
4
14
|
const crypto_1 = require("@nmshd/crypto");
|
|
5
15
|
const core_1 = require("../../core");
|
|
16
|
+
const CoreErrors_1 = require("../../core/CoreErrors");
|
|
6
17
|
const CoreUtil_1 = require("../../core/CoreUtil");
|
|
7
|
-
const TransportErrors_1 = require("../../core/TransportErrors");
|
|
8
18
|
const TransportIds_1 = require("../../core/TransportIds");
|
|
19
|
+
const CachedRelationshipTemplate_1 = require("../relationshipTemplates/local/CachedRelationshipTemplate");
|
|
9
20
|
const RelationshipTemplatePublicKey_1 = require("../relationshipTemplates/transmission/RelationshipTemplatePublicKey");
|
|
10
21
|
const SecretController_1 = require("../secrets/SecretController");
|
|
11
22
|
class RelationshipSecretController extends SecretController_1.SecretController {
|
|
@@ -21,13 +32,11 @@ class RelationshipSecretController extends SecretController_1.SecretController {
|
|
|
21
32
|
}
|
|
22
33
|
const secretContainer = await this.loadActiveSecretByName(secretIdAsString);
|
|
23
34
|
if (!secretContainer) {
|
|
24
|
-
throw
|
|
25
|
-
.recordNotFound("CryptoRelationshipRequestSecrets | CryptoRelationshipSecrets", secretIdAsString)
|
|
26
|
-
.logWith(this._log);
|
|
35
|
+
throw CoreErrors_1.CoreErrors.general.recordNotFound("CryptoRelationshipRequestSecrets | CryptoRelationshipSecrets", secretIdAsString);
|
|
27
36
|
}
|
|
28
37
|
if (!(secretContainer.secret instanceof crypto_1.CryptoRelationshipRequestSecrets) &&
|
|
29
38
|
!(secretContainer.secret instanceof crypto_1.CryptoRelationshipSecrets)) {
|
|
30
|
-
throw
|
|
39
|
+
throw CoreErrors_1.CoreErrors.secrets.wrongSecretType(secretIdAsString);
|
|
31
40
|
}
|
|
32
41
|
const secret = secretContainer.secret;
|
|
33
42
|
this.cache.set(relationshipSecretId, secret);
|
|
@@ -43,10 +52,10 @@ class RelationshipSecretController extends SecretController_1.SecretController {
|
|
|
43
52
|
const templateKeyId = template.templateKey.id.toString();
|
|
44
53
|
const exchangeKeypairContainer = await this.loadActiveSecretByName(templateKeyId);
|
|
45
54
|
if (!exchangeKeypairContainer) {
|
|
46
|
-
throw
|
|
55
|
+
throw CoreErrors_1.CoreErrors.general.recordNotFound(crypto_1.CryptoExchangeKeypair, templateKeyId);
|
|
47
56
|
}
|
|
48
57
|
if (!(exchangeKeypairContainer.secret instanceof crypto_1.CryptoExchangeKeypair)) {
|
|
49
|
-
throw
|
|
58
|
+
throw CoreErrors_1.CoreErrors.secrets.wrongSecretType(templateKeyId);
|
|
50
59
|
}
|
|
51
60
|
const exchangeKeypair = exchangeKeypairContainer.secret;
|
|
52
61
|
const secrets = await crypto_1.CryptoRelationshipSecrets.fromRelationshipRequest(publicRequestCrypto, exchangeKeypair);
|
|
@@ -56,12 +65,10 @@ class RelationshipSecretController extends SecretController_1.SecretController {
|
|
|
56
65
|
async getPublicResponse(relationshipSecretId) {
|
|
57
66
|
const secret = await this.loadActiveSecretByName(relationshipSecretId.toString());
|
|
58
67
|
if (!secret) {
|
|
59
|
-
throw
|
|
60
|
-
.recordNotFound(crypto_1.CryptoRelationshipSecrets, relationshipSecretId.toString())
|
|
61
|
-
.logWith(this._log);
|
|
68
|
+
throw CoreErrors_1.CoreErrors.general.recordNotFound(crypto_1.CryptoRelationshipSecrets, relationshipSecretId.toString());
|
|
62
69
|
}
|
|
63
70
|
if (!(secret.secret instanceof crypto_1.CryptoRelationshipSecrets)) {
|
|
64
|
-
throw
|
|
71
|
+
throw CoreErrors_1.CoreErrors.secrets.wrongSecretType(secret.id.toString());
|
|
65
72
|
}
|
|
66
73
|
const publicResponse = secret.secret.toPublicResponse();
|
|
67
74
|
return publicResponse;
|
|
@@ -69,7 +76,7 @@ class RelationshipSecretController extends SecretController_1.SecretController {
|
|
|
69
76
|
async convertSecrets(relationshipSecretId, response) {
|
|
70
77
|
const request = await this.getSecret(relationshipSecretId);
|
|
71
78
|
if (request instanceof crypto_1.CryptoRelationshipSecrets) {
|
|
72
|
-
throw
|
|
79
|
+
throw CoreErrors_1.CoreErrors.secrets.wrongSecretType();
|
|
73
80
|
}
|
|
74
81
|
const secrets = await crypto_1.CryptoRelationshipSecrets.fromRelationshipResponse(response, request);
|
|
75
82
|
const container = await this.succeedSecretWithName(secrets, relationshipSecretId.toString());
|
|
@@ -94,7 +101,7 @@ class RelationshipSecretController extends SecretController_1.SecretController {
|
|
|
94
101
|
const buffer = CoreUtil_1.CoreUtil.toBuffer(content);
|
|
95
102
|
const secrets = await this.getSecret(relationshipSecretId);
|
|
96
103
|
if (!(secrets instanceof crypto_1.CryptoRelationshipRequestSecrets)) {
|
|
97
|
-
throw
|
|
104
|
+
throw CoreErrors_1.CoreErrors.secrets.wrongSecretType(secrets.id);
|
|
98
105
|
}
|
|
99
106
|
return await secrets.encryptRequest(buffer);
|
|
100
107
|
}
|
|
@@ -102,14 +109,14 @@ class RelationshipSecretController extends SecretController_1.SecretController {
|
|
|
102
109
|
const buffer = CoreUtil_1.CoreUtil.toBuffer(content);
|
|
103
110
|
const secrets = await this.getSecret(relationshipSecretId);
|
|
104
111
|
if (!(secrets instanceof crypto_1.CryptoRelationshipSecrets)) {
|
|
105
|
-
throw
|
|
112
|
+
throw CoreErrors_1.CoreErrors.secrets.wrongSecretType(secrets.id);
|
|
106
113
|
}
|
|
107
114
|
return await secrets.encrypt(buffer);
|
|
108
115
|
}
|
|
109
116
|
async decryptRequest(relationshipSecretId, cipher) {
|
|
110
117
|
const secrets = await this.getSecret(relationshipSecretId);
|
|
111
118
|
if (!(secrets instanceof crypto_1.CryptoRelationshipRequestSecrets) && !(secrets instanceof crypto_1.CryptoRelationshipSecrets)) {
|
|
112
|
-
throw
|
|
119
|
+
throw CoreErrors_1.CoreErrors.secrets.wrongSecretType(relationshipSecretId.toString());
|
|
113
120
|
}
|
|
114
121
|
return await secrets.decryptRequest(cipher);
|
|
115
122
|
}
|
|
@@ -126,7 +133,7 @@ class RelationshipSecretController extends SecretController_1.SecretController {
|
|
|
126
133
|
async decryptPeer(relationshipSecretId, cipher, omitCounterCheck = false) {
|
|
127
134
|
const secrets = await this.getSecret(relationshipSecretId);
|
|
128
135
|
if (!(secrets instanceof crypto_1.CryptoRelationshipSecrets)) {
|
|
129
|
-
throw
|
|
136
|
+
throw CoreErrors_1.CoreErrors.secrets.wrongSecretType(secrets.id);
|
|
130
137
|
}
|
|
131
138
|
return await secrets.decryptPeer(cipher, omitCounterCheck);
|
|
132
139
|
}
|
|
@@ -137,7 +144,7 @@ class RelationshipSecretController extends SecretController_1.SecretController {
|
|
|
137
144
|
async decryptOwn(relationshipSecretId, cipher) {
|
|
138
145
|
const secrets = await this.getSecret(relationshipSecretId);
|
|
139
146
|
if (!(secrets instanceof crypto_1.CryptoRelationshipSecrets)) {
|
|
140
|
-
throw
|
|
147
|
+
throw CoreErrors_1.CoreErrors.secrets.wrongSecretType(secrets.id);
|
|
141
148
|
}
|
|
142
149
|
return await secrets.decryptOwn(cipher);
|
|
143
150
|
}
|
|
@@ -155,11 +162,75 @@ class RelationshipSecretController extends SecretController_1.SecretController {
|
|
|
155
162
|
const bufferToVerify = CoreUtil_1.CoreUtil.toBuffer(content);
|
|
156
163
|
const secrets = await this.getSecret(relationshipSecretId);
|
|
157
164
|
if (secrets instanceof crypto_1.CryptoRelationshipRequestSecrets) {
|
|
158
|
-
throw
|
|
165
|
+
throw CoreErrors_1.CoreErrors.secrets.wrongSecretType(secrets.id);
|
|
159
166
|
}
|
|
160
167
|
const valid = await secrets.verifyPeer(bufferToVerify, signature);
|
|
161
168
|
return valid;
|
|
162
169
|
}
|
|
163
170
|
}
|
|
171
|
+
__decorate([
|
|
172
|
+
(0, ts_utils_1.log)(),
|
|
173
|
+
__metadata("design:type", Function),
|
|
174
|
+
__metadata("design:paramtypes", [core_1.CoreId]),
|
|
175
|
+
__metadata("design:returntype", Promise)
|
|
176
|
+
], RelationshipSecretController.prototype, "getSecret", null);
|
|
177
|
+
__decorate([
|
|
178
|
+
(0, ts_utils_1.log)(),
|
|
179
|
+
__metadata("design:type", Function),
|
|
180
|
+
__metadata("design:paramtypes", [core_1.CoreId,
|
|
181
|
+
CachedRelationshipTemplate_1.CachedRelationshipTemplate,
|
|
182
|
+
crypto_1.CryptoRelationshipPublicRequest]),
|
|
183
|
+
__metadata("design:returntype", Promise)
|
|
184
|
+
], RelationshipSecretController.prototype, "createTemplatorSecrets", null);
|
|
185
|
+
__decorate([
|
|
186
|
+
(0, ts_utils_1.log)(),
|
|
187
|
+
__metadata("design:type", Function),
|
|
188
|
+
__metadata("design:paramtypes", [core_1.CoreId]),
|
|
189
|
+
__metadata("design:returntype", Promise)
|
|
190
|
+
], RelationshipSecretController.prototype, "getPublicResponse", null);
|
|
191
|
+
__decorate([
|
|
192
|
+
(0, ts_utils_1.log)(),
|
|
193
|
+
__metadata("design:type", Function),
|
|
194
|
+
__metadata("design:paramtypes", [core_1.CoreId,
|
|
195
|
+
crypto_1.CryptoRelationshipPublicResponse]),
|
|
196
|
+
__metadata("design:returntype", Promise)
|
|
197
|
+
], RelationshipSecretController.prototype, "convertSecrets", null);
|
|
198
|
+
__decorate([
|
|
199
|
+
(0, ts_utils_1.log)(),
|
|
200
|
+
__metadata("design:type", Function),
|
|
201
|
+
__metadata("design:paramtypes", [core_1.CoreId, Object]),
|
|
202
|
+
__metadata("design:returntype", Promise)
|
|
203
|
+
], RelationshipSecretController.prototype, "encryptRequest", null);
|
|
204
|
+
__decorate([
|
|
205
|
+
(0, ts_utils_1.log)(),
|
|
206
|
+
__metadata("design:type", Function),
|
|
207
|
+
__metadata("design:paramtypes", [core_1.CoreId, Object]),
|
|
208
|
+
__metadata("design:returntype", Promise)
|
|
209
|
+
], RelationshipSecretController.prototype, "encrypt", null);
|
|
210
|
+
__decorate([
|
|
211
|
+
(0, ts_utils_1.log)(),
|
|
212
|
+
__metadata("design:type", Function),
|
|
213
|
+
__metadata("design:paramtypes", [core_1.CoreId, crypto_1.CryptoCipher]),
|
|
214
|
+
__metadata("design:returntype", Promise)
|
|
215
|
+
], RelationshipSecretController.prototype, "decryptRequest", null);
|
|
216
|
+
__decorate([
|
|
217
|
+
(0, ts_utils_1.log)(),
|
|
218
|
+
__metadata("design:type", Function),
|
|
219
|
+
__metadata("design:paramtypes", [core_1.CoreId,
|
|
220
|
+
crypto_1.CryptoCipher, Object]),
|
|
221
|
+
__metadata("design:returntype", Promise)
|
|
222
|
+
], RelationshipSecretController.prototype, "decryptPeer", null);
|
|
223
|
+
__decorate([
|
|
224
|
+
(0, ts_utils_1.log)(),
|
|
225
|
+
__metadata("design:type", Function),
|
|
226
|
+
__metadata("design:paramtypes", [core_1.CoreId, crypto_1.CryptoCipher]),
|
|
227
|
+
__metadata("design:returntype", Promise)
|
|
228
|
+
], RelationshipSecretController.prototype, "decryptOwn", null);
|
|
229
|
+
__decorate([
|
|
230
|
+
(0, ts_utils_1.log)(),
|
|
231
|
+
__metadata("design:type", Function),
|
|
232
|
+
__metadata("design:paramtypes", [core_1.CoreId, Object, crypto_1.CryptoSignature]),
|
|
233
|
+
__metadata("design:returntype", Promise)
|
|
234
|
+
], RelationshipSecretController.prototype, "verifyPeer", null);
|
|
164
235
|
exports.RelationshipSecretController = RelationshipSecretController;
|
|
165
236
|
//# sourceMappingURL=RelationshipSecretController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipSecretController.js","sourceRoot":"","sources":["../../../src/modules/relationships/RelationshipSecretController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RelationshipSecretController.js","sourceRoot":"","sources":["../../../src/modules/relationships/RelationshipSecretController.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gDAAuC;AACvC,0CAWsB;AACtB,qCAA+D;AAC/D,sDAAkD;AAClD,kDAA8C;AAC9C,0DAAsD;AAGtD,0GAAsG;AACtG,uHAAmH;AAEnH,kEAA8D;AAE9D,MAAa,4BAA6B,SAAQ,mCAAgB;IAM9D,YAAmB,MAAyB;QACxC,KAAK,CAAC,MAAM,EAAE,qBAAc,CAAC,kBAAkB,CAAC,CAAA;QANnC,UAAK,GAA8E,IAAI,GAAG,EAGxG,CAAA;IAIH,CAAC;IAGa,AAAN,KAAK,CAAC,SAAS,CACnB,oBAA4B;QAE5B,MAAM,gBAAgB,GAAW,oBAAoB,CAAC,QAAQ,EAAE,CAAA;QAChE,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;QAC1D,IAAI,aAAa,EAAE;YACf,OAAO,aAAa,CAAA;SACvB;QAED,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;QAC3E,IAAI,CAAC,eAAe,EAAE;YAClB,MAAM,uBAAU,CAAC,OAAO,CAAC,cAAc,CACnC,8DA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CAEoB,aAAM;QACpB,qBAAY;;+DAUvB;AAQY;IADZ,IAAA,cAAG,GAAE;;qCACwC,aAAM,EAAU,qBAAY;;8DAQzE;AAsBY;IADZ,IAAA,cAAG,GAAE;;qCAEoB,aAAM,UAEjB,wBAAe;;8DAW7B;AArPL,oEAsPC"}
|
|
@@ -30,7 +30,6 @@ export declare class RelationshipsController extends TransportController {
|
|
|
30
30
|
verifyIdentity(relationship: Relationship, content: CoreBuffer, signature: CryptoSignature): Promise<boolean>;
|
|
31
31
|
sendRelationship(parameters: ISendRelationshipParameters): Promise<Relationship>;
|
|
32
32
|
setRelationshipMetadata(idOrRelationship: CoreId | Relationship, metadata: ISerializable): Promise<Relationship>;
|
|
33
|
-
requestTermination(): void;
|
|
34
33
|
acceptChange(change: RelationshipChange, content?: ICoreSerializable): Promise<Relationship>;
|
|
35
34
|
rejectChange(change: RelationshipChange, content?: ICoreSerializable): Promise<Relationship>;
|
|
36
35
|
revokeChange(change: RelationshipChange, content?: ICoreSerializable): Promise<Relationship>;
|
|
@@ -45,9 +44,10 @@ export declare class RelationshipsController extends TransportController {
|
|
|
45
44
|
private decryptCreationChangeResponse;
|
|
46
45
|
private updatePendingRelationshipWithPeerResponse;
|
|
47
46
|
private createNewRelationshipByIncomingCreationChange;
|
|
48
|
-
private applyTerminationChange;
|
|
49
|
-
private applyTerminationCancellationChange;
|
|
50
47
|
private completeChange;
|
|
51
48
|
private encryptRevokeContent;
|
|
52
49
|
private encryptAcceptRejectContent;
|
|
50
|
+
private throwWrongChangeType;
|
|
51
|
+
private newChangeResponseMissingError;
|
|
52
|
+
private newEmptyOrInvalidContentError;
|
|
53
53
|
}
|