@nmshd/transport 2.0.0-beta.5 → 2.0.0-beta.7
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 +14 -12
- package/dist/core/CoreCrypto.js.map +1 -1
- package/dist/core/CoreUtil.js +1 -2
- package/dist/core/CoreUtil.js.map +1 -1
- package/dist/core/Reference.js +2 -2
- package/dist/core/Reference.js.map +1 -1
- package/dist/core/Transport.js +4 -1
- package/dist/core/Transport.js.map +1 -1
- package/dist/core/TransportController.d.ts +1 -1
- package/dist/core/TransportController.js +2 -3
- package/dist/core/TransportController.js.map +1 -1
- package/dist/core/TransportErrors.d.ts +5 -73
- package/dist/core/TransportErrors.js +10 -153
- package/dist/core/TransportErrors.js.map +1 -1
- package/dist/core/TransportLoggerFactory.js +1 -2
- package/dist/core/TransportLoggerFactory.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 +3 -4
- package/dist/core/types/CoreDate.js.map +1 -1
- package/dist/core/types/CoreId.d.ts +1 -1
- package/dist/core/types/CoreId.js +1 -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 +30 -10
- 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/challenges/ChallengeController.js +26 -5
- package/dist/modules/challenges/ChallengeController.js.map +1 -1
- package/dist/modules/devices/DeviceController.d.ts +1 -1
- package/dist/modules/devices/DeviceController.js +42 -14
- 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/files/FileController.js +41 -16
- package/dist/modules/files/FileController.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 +70 -16
- package/dist/modules/messages/MessageController.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/relationshipTemplates/RelationshipTemplateController.js +35 -14
- 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/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/relationships/RelationshipSecretController.js +88 -17
- package/dist/modules/relationships/RelationshipSecretController.js.map +1 -1
- package/dist/modules/relationships/RelationshipsController.d.ts +3 -3
- package/dist/modules/relationships/RelationshipsController.js +119 -66
- package/dist/modules/relationships/RelationshipsController.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/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/secrets/SecretController.js +18 -5
- package/dist/modules/secrets/SecretController.js.map +1 -1
- package/dist/modules/sync/DatawalletModificationsProcessor.d.ts +1 -0
- package/dist/modules/sync/DatawalletModificationsProcessor.js +20 -3
- package/dist/modules/sync/DatawalletModificationsProcessor.js.map +1 -1
- package/dist/modules/sync/SyncController.d.ts +1 -0
- package/dist/modules/sync/SyncController.js +53 -24
- package/dist/modules/sync/SyncController.js.map +1 -1
- package/dist/modules/tokens/TokenController.js +31 -4
- package/dist/modules/tokens/TokenController.js.map +1 -1
- package/dist/util/PasswordGenerator.js +1 -2
- package/dist/util/PasswordGenerator.js.map +1 -1
- package/dist/util/Random.js +7 -8
- package/dist/util/Random.js.map +1 -1
- package/lib-web/nmshd.transport.js +874 -633
- 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 +6 -6
- 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
package/dist/util/Random.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Random = exports.RandomCharacterRange = void 0;
|
|
4
4
|
const crypto_1 = require("@nmshd/crypto");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
|
-
const TransportErrors_1 = require("../core/TransportErrors");
|
|
7
6
|
var RandomCharacterRange;
|
|
8
7
|
(function (RandomCharacterRange) {
|
|
9
8
|
RandomCharacterRange["Digit"] = "0123456789";
|
|
@@ -27,7 +26,7 @@ class Random {
|
|
|
27
26
|
}
|
|
28
27
|
static async int(length) {
|
|
29
28
|
if (length > 21 || length <= 0) {
|
|
30
|
-
throw
|
|
29
|
+
throw new Error("Length must be between 1 and 21.");
|
|
31
30
|
}
|
|
32
31
|
return parseInt(await this.string(length, RandomCharacterRange.Digit));
|
|
33
32
|
}
|
|
@@ -50,12 +49,12 @@ class Random {
|
|
|
50
49
|
}
|
|
51
50
|
static async intBetween(min, max) {
|
|
52
51
|
if (max <= min) {
|
|
53
|
-
throw
|
|
52
|
+
throw new Error("Max must be larger than min.");
|
|
54
53
|
}
|
|
55
54
|
const diff = max - min + 1;
|
|
56
55
|
const bitLength = Math.abs(Math.ceil(Math.log2(diff)));
|
|
57
56
|
if (bitLength > 32) {
|
|
58
|
-
throw
|
|
57
|
+
throw new Error("The range between the numbers is too big, 32 bit is the maximum -> 4294967296");
|
|
59
58
|
}
|
|
60
59
|
const byteLength = Math.ceil(bitLength / 8);
|
|
61
60
|
const bitMask = Math.pow(2, bitLength) - 1;
|
|
@@ -74,7 +73,7 @@ class Random {
|
|
|
74
73
|
}
|
|
75
74
|
static async intRandomLength(minLength, maxLength) {
|
|
76
75
|
if (maxLength > 21) {
|
|
77
|
-
|
|
76
|
+
throw new Error("Max must be below 22.");
|
|
78
77
|
}
|
|
79
78
|
return parseInt(await this.stringRandomLength(minLength, maxLength, RandomCharacterRange.Digit));
|
|
80
79
|
}
|
|
@@ -93,7 +92,7 @@ class Random {
|
|
|
93
92
|
if (length <= 0)
|
|
94
93
|
return "";
|
|
95
94
|
if (allowedChars.length > 256) {
|
|
96
|
-
throw
|
|
95
|
+
throw new Error("Input exceeds maximum length of 256.");
|
|
97
96
|
}
|
|
98
97
|
const ar = [];
|
|
99
98
|
const inputLength = allowedChars.length;
|
|
@@ -116,10 +115,10 @@ class Random {
|
|
|
116
115
|
}
|
|
117
116
|
static async stringRandomLength(minLength, maxLength, allowedChars) {
|
|
118
117
|
if (minLength > maxLength) {
|
|
119
|
-
throw
|
|
118
|
+
throw new Error("maxLength must be larger than minLength.");
|
|
120
119
|
}
|
|
121
120
|
if (minLength < 0) {
|
|
122
|
-
throw
|
|
121
|
+
throw new Error("minlength must not be less than zero.");
|
|
123
122
|
}
|
|
124
123
|
const length = maxLength > minLength ? await this.intBetween(minLength, maxLength) : maxLength;
|
|
125
124
|
return await this.string(length, allowedChars);
|
package/dist/util/Random.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Random.js","sourceRoot":"","sources":["../../src/util/Random.ts"],"names":[],"mappings":";;;AAAA,0CAAyD;AACzD,+BAAmC;
|
|
1
|
+
{"version":3,"file":"Random.js","sourceRoot":"","sources":["../../src/util/Random.ts"],"names":[],"mappings":";;;AAAA,0CAAyD;AACzD,+BAAmC;AAEnC,IAAY,oBAeX;AAfD,WAAY,oBAAoB;IAC5B,4CAAoB,CAAA;IACpB,+CAAuB,CAAA;IACvB,gDAAwB,CAAA;IACxB,gEAAwC,CAAA;IACxC,kEAA0C,CAAA;I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