@nmshd/crypto 1.0.8 → 2.0.1
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/CoreBuffer.d.ts +0 -1
- package/dist/CoreBuffer.js +1 -4
- package/dist/CoreBuffer.js.map +1 -1
- package/dist/CryptoDerivation.js +2 -2
- package/dist/CryptoDerivation.js.map +1 -1
- package/dist/CryptoPrivateKey.d.ts +14 -17
- package/dist/CryptoPrivateKey.js +24 -39
- package/dist/CryptoPrivateKey.js.map +1 -1
- package/dist/CryptoPublicKey.d.ts +13 -16
- package/dist/CryptoPublicKey.js +22 -37
- package/dist/CryptoPublicKey.js.map +1 -1
- package/dist/CryptoSerializable.d.ts +5 -0
- package/dist/CryptoSerializable.js +15 -0
- package/dist/CryptoSerializable.js.map +1 -0
- package/dist/CryptoValidation.d.ts +4 -6
- package/dist/CryptoValidation.js +16 -29
- package/dist/CryptoValidation.js.map +1 -1
- package/dist/SodiumWrapper.js +5 -1
- package/dist/SodiumWrapper.js.map +1 -1
- package/dist/buildInformation.js +5 -5
- package/dist/encryption/CryptoCipher.d.ts +10 -11
- package/dist/encryption/CryptoCipher.js +62 -59
- package/dist/encryption/CryptoCipher.js.map +1 -1
- package/dist/encryption/CryptoEncryption.js +10 -12
- package/dist/encryption/CryptoEncryption.js.map +1 -1
- package/dist/encryption/CryptoSecretKey.d.ts +8 -9
- package/dist/encryption/CryptoSecretKey.js +36 -32
- package/dist/encryption/CryptoSecretKey.js.map +1 -1
- package/dist/exchange/CryptoExchange.d.ts +0 -2
- package/dist/exchange/CryptoExchange.js +5 -22
- package/dist/exchange/CryptoExchange.js.map +1 -1
- package/dist/exchange/CryptoExchangeKeypair.d.ts +10 -11
- package/dist/exchange/CryptoExchangeKeypair.js +33 -30
- package/dist/exchange/CryptoExchangeKeypair.js.map +1 -1
- package/dist/exchange/CryptoExchangePrivateKey.d.ts +8 -10
- package/dist/exchange/CryptoExchangePrivateKey.js +50 -31
- package/dist/exchange/CryptoExchangePrivateKey.js.map +1 -1
- package/dist/exchange/CryptoExchangePublicKey.d.ts +6 -7
- package/dist/exchange/CryptoExchangePublicKey.js +31 -32
- package/dist/exchange/CryptoExchangePublicKey.js.map +1 -1
- package/dist/exchange/CryptoExchangeSecrets.d.ts +10 -11
- package/dist/exchange/CryptoExchangeSecrets.js +33 -35
- package/dist/exchange/CryptoExchangeSecrets.js.map +1 -1
- package/dist/exchange/CryptoExchangeValidation.d.ts +7 -10
- package/dist/exchange/CryptoExchangeValidation.js +9 -36
- package/dist/exchange/CryptoExchangeValidation.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/relationship/CryptoRelationshipPublicRequest.d.ts +8 -9
- package/dist/relationship/CryptoRelationshipPublicRequest.js +23 -42
- package/dist/relationship/CryptoRelationshipPublicRequest.js.map +1 -1
- package/dist/relationship/CryptoRelationshipPublicResponse.d.ts +8 -9
- package/dist/relationship/CryptoRelationshipPublicResponse.js +24 -38
- package/dist/relationship/CryptoRelationshipPublicResponse.js.map +1 -1
- package/dist/relationship/CryptoRelationshipRequestSecrets.d.ts +6 -7
- package/dist/relationship/CryptoRelationshipRequestSecrets.js +7 -10
- package/dist/relationship/CryptoRelationshipRequestSecrets.js.map +1 -1
- package/dist/relationship/CryptoRelationshipSecrets.d.ts +6 -7
- package/dist/relationship/CryptoRelationshipSecrets.js +8 -11
- package/dist/relationship/CryptoRelationshipSecrets.js.map +1 -1
- package/dist/signature/CryptoSignature.d.ts +12 -13
- package/dist/signature/CryptoSignature.js +39 -35
- package/dist/signature/CryptoSignature.js.map +1 -1
- package/dist/signature/CryptoSignatureAlgorithm.d.ts +5 -0
- package/dist/signature/CryptoSignatureAlgorithm.js +3 -0
- package/dist/signature/CryptoSignatureAlgorithm.js.map +1 -0
- package/dist/signature/CryptoSignatureKeypair.d.ts +10 -11
- package/dist/signature/CryptoSignatureKeypair.js +36 -38
- package/dist/signature/CryptoSignatureKeypair.js.map +1 -1
- package/dist/signature/CryptoSignaturePrivateKey.d.ts +10 -13
- package/dist/signature/CryptoSignaturePrivateKey.js +28 -37
- package/dist/signature/CryptoSignaturePrivateKey.js.map +1 -1
- package/dist/signature/CryptoSignaturePublicKey.d.ts +9 -12
- package/dist/signature/CryptoSignaturePublicKey.js +22 -44
- package/dist/signature/CryptoSignaturePublicKey.js.map +1 -1
- package/dist/signature/CryptoSignatureValidation.d.ts +10 -12
- package/dist/signature/CryptoSignatureValidation.js +13 -35
- package/dist/signature/CryptoSignatureValidation.js.map +1 -1
- package/dist/signature/CryptoSignatures.d.ts +1 -5
- package/dist/signature/CryptoSignatures.js +5 -5
- package/dist/signature/CryptoSignatures.js.map +1 -1
- package/dist/state/CryptoPrivateState.d.ts +12 -20
- package/dist/state/CryptoPrivateState.js +73 -77
- package/dist/state/CryptoPrivateState.js.map +1 -1
- package/dist/state/CryptoPrivateStateReceive.d.ts +4 -6
- package/dist/state/CryptoPrivateStateReceive.js +27 -39
- package/dist/state/CryptoPrivateStateReceive.js.map +1 -1
- package/dist/state/CryptoPrivateStateTransmit.d.ts +3 -4
- package/dist/state/CryptoPrivateStateTransmit.js +14 -40
- package/dist/state/CryptoPrivateStateTransmit.js.map +1 -1
- package/dist/state/CryptoPublicState.d.ts +11 -16
- package/dist/state/CryptoPublicState.js +44 -53
- package/dist/state/CryptoPublicState.js.map +1 -1
- package/dist/stream/CryptoStream.js +5 -2
- package/dist/stream/CryptoStream.js.map +1 -1
- package/dist/stream/CryptoStreamAddress.d.ts +7 -10
- package/dist/stream/CryptoStreamAddress.js +13 -29
- package/dist/stream/CryptoStreamAddress.js.map +1 -1
- package/dist/stream/CryptoStreamHeader.d.ts +9 -12
- package/dist/stream/CryptoStreamHeader.js +15 -18
- package/dist/stream/CryptoStreamHeader.js.map +1 -1
- package/dist/stream/CryptoStreamState.d.ts +6 -10
- package/dist/stream/CryptoStreamState.js +15 -33
- package/dist/stream/CryptoStreamState.js.map +1 -1
- package/lib-web/nmshd.crypto.js +795 -1023
- package/lib-web/nmshd.crypto.js.map +1 -1
- package/lib-web/nmshd.crypto.min.js +1 -1
- package/lib-web/nmshd.crypto.min.js.map +1 -1
- package/package.json +18 -18
- package/dist/CryptoSerializableAsync.d.ts +0 -5
- package/dist/CryptoSerializableAsync.js +0 -24
- package/dist/CryptoSerializableAsync.js.map +0 -1
|
@@ -8,22 +8,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var CryptoExchangeKeypair_1;
|
|
12
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
12
|
exports.CryptoExchangeKeypair = void 0;
|
|
14
13
|
const ts_serval_1 = require("@js-soft/ts-serval");
|
|
15
14
|
const CoreBuffer_1 = require("../CoreBuffer");
|
|
16
|
-
const
|
|
15
|
+
const CryptoError_1 = require("../CryptoError");
|
|
16
|
+
const CryptoErrorCode_1 = require("../CryptoErrorCode");
|
|
17
|
+
const CryptoSerializable_1 = require("../CryptoSerializable");
|
|
17
18
|
const CryptoExchangePrivateKey_1 = require("./CryptoExchangePrivateKey");
|
|
18
19
|
const CryptoExchangePublicKey_1 = require("./CryptoExchangePublicKey");
|
|
19
|
-
|
|
20
|
-
let CryptoExchangeKeypair = CryptoExchangeKeypair_1 = class CryptoExchangeKeypair extends CryptoSerializableAsync_1.CryptoSerializableAsync {
|
|
21
|
-
constructor(publicKey, privateKey) {
|
|
22
|
-
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeKeypair(privateKey, publicKey);
|
|
23
|
-
super();
|
|
24
|
-
this.publicKey = publicKey;
|
|
25
|
-
this.privateKey = privateKey;
|
|
26
|
-
}
|
|
20
|
+
let CryptoExchangeKeypair = class CryptoExchangeKeypair extends CryptoSerializable_1.CryptoSerializable {
|
|
27
21
|
toJSON(verbose = true) {
|
|
28
22
|
const obj = {
|
|
29
23
|
pub: this.publicKey.toJSON(false),
|
|
@@ -38,31 +32,40 @@ let CryptoExchangeKeypair = CryptoExchangeKeypair_1 = class CryptoExchangeKeypai
|
|
|
38
32
|
this.publicKey.clear();
|
|
39
33
|
this.privateKey.clear();
|
|
40
34
|
}
|
|
41
|
-
static
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
static preFrom(value) {
|
|
36
|
+
if (value.pub) {
|
|
37
|
+
value = {
|
|
38
|
+
publicKey: value.pub,
|
|
39
|
+
privateKey: value.prv
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (value.privateKey.algorithm !== value.publicKey.algorithm) {
|
|
43
|
+
throw new CryptoError_1.CryptoError(CryptoErrorCode_1.CryptoErrorCode.ExchangeWrongAlgorithm, "Algorithms of private and public key do not match.");
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
47
46
|
}
|
|
48
|
-
static
|
|
49
|
-
|
|
50
|
-
CryptoExchangePrivateKey_1.CryptoExchangePrivateKey.fromJSON(value.prv),
|
|
51
|
-
CryptoExchangePublicKey_1.CryptoExchangePublicKey.fromJSON(value.pub)
|
|
52
|
-
]);
|
|
53
|
-
return new CryptoExchangeKeypair_1(publicKey, privateKey);
|
|
47
|
+
static from(value) {
|
|
48
|
+
return this.fromAny(value);
|
|
54
49
|
}
|
|
55
|
-
static
|
|
56
|
-
return
|
|
50
|
+
static fromJSON(value) {
|
|
51
|
+
return this.fromAny(value);
|
|
57
52
|
}
|
|
58
|
-
static
|
|
59
|
-
|
|
60
|
-
return await this.fromJSON(obj);
|
|
53
|
+
static fromBase64(value) {
|
|
54
|
+
return this.deserialize(CoreBuffer_1.CoreBuffer.base64_utf8(value));
|
|
61
55
|
}
|
|
62
56
|
};
|
|
63
|
-
|
|
64
|
-
(0, ts_serval_1.
|
|
65
|
-
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, ts_serval_1.validate)(),
|
|
59
|
+
(0, ts_serval_1.serialize)(),
|
|
60
|
+
__metadata("design:type", CryptoExchangePublicKey_1.CryptoExchangePublicKey)
|
|
61
|
+
], CryptoExchangeKeypair.prototype, "publicKey", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, ts_serval_1.validate)(),
|
|
64
|
+
(0, ts_serval_1.serialize)(),
|
|
65
|
+
__metadata("design:type", CryptoExchangePrivateKey_1.CryptoExchangePrivateKey)
|
|
66
|
+
], CryptoExchangeKeypair.prototype, "privateKey", void 0);
|
|
67
|
+
CryptoExchangeKeypair = __decorate([
|
|
68
|
+
(0, ts_serval_1.type)("CryptoExchangeKeypair")
|
|
66
69
|
], CryptoExchangeKeypair);
|
|
67
70
|
exports.CryptoExchangeKeypair = CryptoExchangeKeypair;
|
|
68
71
|
//# sourceMappingURL=CryptoExchangeKeypair.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoExchangeKeypair.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangeKeypair.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CryptoExchangeKeypair.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangeKeypair.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA2F;AAC3F,8CAAuD;AACvD,gDAA6C;AAC7C,wDAAqD;AACrD,8DAA2D;AAC3D,yEAIoC;AACpC,uEAImC;AAanC,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,uCAAkB;IASzC,MAAM,CAAC,OAAO,GAAG,IAAI;QACjC,MAAM,GAAG,GAAqC;YAC1C,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;YACjC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC;SACrC,CAAC;QACF,IAAI,OAAO,EAAE;YACT,GAAG,CAAC,OAAO,CAAC,GAAG,uBAA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erialized } from "@js-soft/ts-serval";
|
|
2
2
|
import { CoreBuffer, IClearable, ICoreBuffer } from "../CoreBuffer";
|
|
3
3
|
import { CryptoPrivateKey } from "../CryptoPrivateKey";
|
|
4
4
|
import { CryptoExchangeAlgorithm } from "./CryptoExchange";
|
|
@@ -7,21 +7,19 @@ export interface ICryptoExchangePrivateKeySerialized extends ISerialized {
|
|
|
7
7
|
alg: number;
|
|
8
8
|
prv: string;
|
|
9
9
|
}
|
|
10
|
-
export interface ICryptoExchangePrivateKey extends
|
|
10
|
+
export interface ICryptoExchangePrivateKey extends ISerializable {
|
|
11
11
|
algorithm: CryptoExchangeAlgorithm;
|
|
12
12
|
privateKey: ICoreBuffer;
|
|
13
13
|
}
|
|
14
14
|
export declare class CryptoExchangePrivateKey extends CryptoPrivateKey implements ICryptoExchangePrivateKey, IClearable {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
constructor(algorithm: CryptoExchangeAlgorithm, privateKey: CoreBuffer);
|
|
15
|
+
algorithm: CryptoExchangeAlgorithm;
|
|
16
|
+
privateKey: CoreBuffer;
|
|
18
17
|
toJSON(verbose?: boolean): ICryptoExchangePrivateKeySerialized;
|
|
19
18
|
clear(): void;
|
|
20
|
-
serialize(verbose?: boolean): string;
|
|
21
19
|
toBase64(verbose?: boolean): string;
|
|
22
20
|
toPublicKey(): Promise<CryptoExchangePublicKey>;
|
|
23
|
-
static from(value: CryptoExchangePrivateKey | ICryptoExchangePrivateKey):
|
|
24
|
-
static
|
|
25
|
-
static
|
|
26
|
-
static
|
|
21
|
+
static from(value: CryptoExchangePrivateKey | ICryptoExchangePrivateKey): CryptoExchangePrivateKey;
|
|
22
|
+
protected static preFrom(value: any): any;
|
|
23
|
+
static fromJSON(value: ICryptoExchangePrivateKeySerialized): CryptoExchangePrivateKey;
|
|
24
|
+
static fromBase64(value: string): CryptoExchangePrivateKey;
|
|
27
25
|
}
|
|
@@ -8,63 +8,82 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var CryptoExchangePrivateKey_1;
|
|
12
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
12
|
exports.CryptoExchangePrivateKey = void 0;
|
|
14
13
|
const ts_serval_1 = require("@js-soft/ts-serval");
|
|
15
14
|
const CoreBuffer_1 = require("../CoreBuffer");
|
|
15
|
+
const CryptoError_1 = require("../CryptoError");
|
|
16
|
+
const CryptoErrorCode_1 = require("../CryptoErrorCode");
|
|
16
17
|
const CryptoPrivateKey_1 = require("../CryptoPrivateKey");
|
|
17
|
-
const
|
|
18
|
+
const SodiumWrapper_1 = require("../SodiumWrapper");
|
|
19
|
+
const CryptoExchangePublicKey_1 = require("./CryptoExchangePublicKey");
|
|
18
20
|
const CryptoExchangeValidation_1 = require("./CryptoExchangeValidation");
|
|
19
|
-
let CryptoExchangePrivateKey =
|
|
20
|
-
constructor(algorithm, privateKey) {
|
|
21
|
-
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeAlgorithm(algorithm);
|
|
22
|
-
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePrivateKeyAsBuffer(privateKey, algorithm);
|
|
23
|
-
super(algorithm, privateKey);
|
|
24
|
-
this.algorithm = algorithm;
|
|
25
|
-
this.privateKey = privateKey;
|
|
26
|
-
}
|
|
21
|
+
let CryptoExchangePrivateKey = class CryptoExchangePrivateKey extends CryptoPrivateKey_1.CryptoPrivateKey {
|
|
27
22
|
toJSON(verbose = true) {
|
|
28
|
-
|
|
23
|
+
return {
|
|
29
24
|
prv: this.privateKey.toBase64URL(),
|
|
30
|
-
alg: this.algorithm
|
|
25
|
+
alg: this.algorithm,
|
|
26
|
+
"@type": verbose ? "CryptoExchangePrivateKey" : undefined
|
|
31
27
|
};
|
|
32
|
-
if (verbose) {
|
|
33
|
-
obj["@type"] = "CryptoExchangePrivateKey";
|
|
34
|
-
}
|
|
35
|
-
return obj;
|
|
36
28
|
}
|
|
37
29
|
clear() {
|
|
38
30
|
this.privateKey.clear();
|
|
39
31
|
}
|
|
40
|
-
serialize(verbose = true) {
|
|
41
|
-
return JSON.stringify(this.toJSON(verbose));
|
|
42
|
-
}
|
|
43
32
|
toBase64(verbose = true) {
|
|
44
33
|
return CoreBuffer_1.CoreBuffer.utf8_base64(this.serialize(verbose));
|
|
45
34
|
}
|
|
46
35
|
async toPublicKey() {
|
|
47
|
-
|
|
36
|
+
let publicKey;
|
|
37
|
+
switch (this.algorithm) {
|
|
38
|
+
case 3 /* ECDH_X25519 */:
|
|
39
|
+
try {
|
|
40
|
+
publicKey = (await SodiumWrapper_1.SodiumWrapper.ready()).crypto_scalarmult_base(this.privateKey.buffer);
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
throw new CryptoError_1.CryptoError(CryptoErrorCode_1.CryptoErrorCode.ExchangeKeyGeneration, `${e}`);
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
throw new CryptoError_1.CryptoError(CryptoErrorCode_1.CryptoErrorCode.NotYetImplemented);
|
|
48
|
+
}
|
|
49
|
+
return CryptoExchangePublicKey_1.CryptoExchangePublicKey.from({
|
|
50
|
+
algorithm: this.algorithm,
|
|
51
|
+
publicKey: CoreBuffer_1.CoreBuffer.from(publicKey)
|
|
52
|
+
});
|
|
48
53
|
}
|
|
49
54
|
static from(value) {
|
|
50
|
-
return
|
|
55
|
+
return this.fromAny(value);
|
|
56
|
+
}
|
|
57
|
+
static preFrom(value) {
|
|
58
|
+
if (value.alg) {
|
|
59
|
+
value = {
|
|
60
|
+
algorithm: value.alg,
|
|
61
|
+
privateKey: CoreBuffer_1.CoreBuffer.fromBase64URL(value.prv)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeAlgorithm(value.algorithm);
|
|
65
|
+
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePrivateKey(value.privateKey, value.algorithm, "privateKey");
|
|
66
|
+
return value;
|
|
51
67
|
}
|
|
52
68
|
static fromJSON(value) {
|
|
53
|
-
|
|
54
|
-
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePrivateKeyAsNumber(value.prv, value.alg, "privateKey");
|
|
55
|
-
const buffer = CoreBuffer_1.CoreBuffer.fromBase64URL(value.prv);
|
|
56
|
-
return Promise.resolve(new CryptoExchangePrivateKey_1(value.alg, buffer));
|
|
69
|
+
return this.fromAny(value);
|
|
57
70
|
}
|
|
58
71
|
static fromBase64(value) {
|
|
59
72
|
return this.deserialize(CoreBuffer_1.CoreBuffer.base64_utf8(value));
|
|
60
73
|
}
|
|
61
|
-
static async deserialize(value) {
|
|
62
|
-
return await this.fromJSON(JSON.parse(value));
|
|
63
|
-
}
|
|
64
74
|
};
|
|
65
|
-
|
|
66
|
-
(0, ts_serval_1.
|
|
67
|
-
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, ts_serval_1.validate)(),
|
|
77
|
+
(0, ts_serval_1.serialize)(),
|
|
78
|
+
__metadata("design:type", Number)
|
|
79
|
+
], CryptoExchangePrivateKey.prototype, "algorithm", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, ts_serval_1.validate)(),
|
|
82
|
+
(0, ts_serval_1.serialize)(),
|
|
83
|
+
__metadata("design:type", CoreBuffer_1.CoreBuffer)
|
|
84
|
+
], CryptoExchangePrivateKey.prototype, "privateKey", void 0);
|
|
85
|
+
CryptoExchangePrivateKey = __decorate([
|
|
86
|
+
(0, ts_serval_1.type)("CryptoExchangePrivateKey")
|
|
68
87
|
], CryptoExchangePrivateKey);
|
|
69
88
|
exports.CryptoExchangePrivateKey = CryptoExchangePrivateKey;
|
|
70
89
|
//# sourceMappingURL=CryptoExchangePrivateKey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoExchangePrivateKey.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangePrivateKey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CryptoExchangePrivateKey.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangePrivateKey.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA2F;AAC3F,8CAAoE;AACpE,gDAA6C;AAC7C,wDAAqD;AACrD,0DAAuD;AACvD,oDAAiD;AAEjD,uEAAoE;AACpE,yEAAsE;AAatE,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,mCAAgB;IAS1C,MAAM,CAAC,OAAO,GAAG,IAAI;QACjC,OAAO;YACH,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE;YAClC,GAAG,EAAE,IAAI,CAAC,SAAS;YACnB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,SAAS;SAC5D,CAAC;IACN,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAEe,QAAQ,CAAC,OAAO,GAAG,IAAI;QACnC,OAAO,uBAAU,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,WAAW;QACpB,IAAI,SAAqB,CAAC;QAC1B,QAAQ,IAAI,CAAC,SAAS,EAAE;YACpB;gBACI,IAAI;oBACA,SAAS,GAAG,CAAC,MAAM,6BAAa,CAAC,KAAK,EAAE,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;iBAC5F;gBAAC,OAAO,CAAC,EAAE;oBACR,MAAM,IAAI,yBAAW,CAAC,iCAAe,CAAC,qBAAqB,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;iBACxE;gBACD,MAAM;YACV;gBACI,MAAM,IAAI,yBAAW,CAAC,iCAAe,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ryptoExchangePublicKey {
|
|
|
11
11
|
publicKey: CoreBuffer;
|
|
12
12
|
}
|
|
13
13
|
export declare class CryptoExchangePublicKey extends CryptoPublicKey implements ICryptoExchangePublicKey, IClearable {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
constructor(algorithm: CryptoExchangeAlgorithm, publicKey: CoreBuffer);
|
|
14
|
+
algorithm: CryptoExchangeAlgorithm;
|
|
15
|
+
publicKey: CoreBuffer;
|
|
17
16
|
toJSON(verbose?: boolean): ICryptoExchangePublicKeySerialized;
|
|
18
17
|
clear(): void;
|
|
19
|
-
static
|
|
20
|
-
static
|
|
21
|
-
static
|
|
22
|
-
static
|
|
18
|
+
protected static preFrom(value: any): any;
|
|
19
|
+
static from(value: CryptoExchangePublicKey | ICryptoExchangePublicKey): CryptoExchangePublicKey;
|
|
20
|
+
static fromJSON(value: ICryptoExchangePublicKeySerialized): CryptoExchangePublicKey;
|
|
21
|
+
static fromBase64(value: string): CryptoExchangePublicKey;
|
|
23
22
|
}
|
|
@@ -8,57 +8,56 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var CryptoExchangePublicKey_1;
|
|
12
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
12
|
exports.CryptoExchangePublicKey = void 0;
|
|
14
13
|
const ts_serval_1 = require("@js-soft/ts-serval");
|
|
15
14
|
const CoreBuffer_1 = require("../CoreBuffer");
|
|
16
15
|
const CryptoPublicKey_1 = require("../CryptoPublicKey");
|
|
17
16
|
const CryptoExchangeValidation_1 = require("./CryptoExchangeValidation");
|
|
18
|
-
let CryptoExchangePublicKey =
|
|
19
|
-
constructor(algorithm, publicKey) {
|
|
20
|
-
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeAlgorithm(algorithm);
|
|
21
|
-
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePublicKeyAsBuffer(publicKey, algorithm);
|
|
22
|
-
super(algorithm, publicKey);
|
|
23
|
-
this.algorithm = algorithm;
|
|
24
|
-
this.publicKey = publicKey;
|
|
25
|
-
}
|
|
17
|
+
let CryptoExchangePublicKey = class CryptoExchangePublicKey extends CryptoPublicKey_1.CryptoPublicKey {
|
|
26
18
|
toJSON(verbose = true) {
|
|
27
|
-
|
|
19
|
+
return {
|
|
20
|
+
"@type": verbose ? "CryptoExchangePublicKey" : undefined,
|
|
28
21
|
pub: this.publicKey.toBase64URL(),
|
|
29
22
|
alg: this.algorithm
|
|
30
23
|
};
|
|
31
|
-
if (verbose) {
|
|
32
|
-
obj["@type"] = "CryptoExchangePublicKey";
|
|
33
|
-
}
|
|
34
|
-
return obj;
|
|
35
24
|
}
|
|
36
25
|
clear() {
|
|
37
26
|
this.publicKey.clear();
|
|
38
27
|
}
|
|
39
|
-
static
|
|
40
|
-
|
|
28
|
+
static preFrom(value) {
|
|
29
|
+
if (value.alg) {
|
|
30
|
+
value = {
|
|
31
|
+
algorithm: value.alg,
|
|
32
|
+
publicKey: value.pub
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangeAlgorithm(value.algorithm);
|
|
36
|
+
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePublicKey(value.publicKey, value.algorithm);
|
|
37
|
+
return value;
|
|
41
38
|
}
|
|
42
|
-
static
|
|
43
|
-
|
|
44
|
-
CryptoExchangeValidation_1.CryptoExchangeValidation.checkExchangePrivateKeyAsNumber(value.pub, value.alg, "publicKey");
|
|
45
|
-
const buffer = CoreBuffer_1.CoreBuffer.fromBase64URL(value.pub);
|
|
46
|
-
return await this.from({
|
|
47
|
-
algorithm: value.alg,
|
|
48
|
-
publicKey: buffer
|
|
49
|
-
});
|
|
39
|
+
static from(value) {
|
|
40
|
+
return this.fromAny(value);
|
|
50
41
|
}
|
|
51
|
-
static
|
|
52
|
-
return
|
|
42
|
+
static fromJSON(value) {
|
|
43
|
+
return this.fromAny(value);
|
|
53
44
|
}
|
|
54
|
-
static
|
|
55
|
-
|
|
56
|
-
return await this.fromJSON(obj);
|
|
45
|
+
static fromBase64(value) {
|
|
46
|
+
return this.deserialize(CoreBuffer_1.CoreBuffer.base64_utf8(value));
|
|
57
47
|
}
|
|
58
48
|
};
|
|
59
|
-
|
|
60
|
-
(0, ts_serval_1.
|
|
61
|
-
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, ts_serval_1.validate)(),
|
|
51
|
+
(0, ts_serval_1.serialize)(),
|
|
52
|
+
__metadata("design:type", Number)
|
|
53
|
+
], CryptoExchangePublicKey.prototype, "algorithm", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, ts_serval_1.validate)(),
|
|
56
|
+
(0, ts_serval_1.serialize)(),
|
|
57
|
+
__metadata("design:type", CoreBuffer_1.CoreBuffer)
|
|
58
|
+
], CryptoExchangePublicKey.prototype, "publicKey", void 0);
|
|
59
|
+
CryptoExchangePublicKey = __decorate([
|
|
60
|
+
(0, ts_serval_1.type)("CryptoExchangePublicKey")
|
|
62
61
|
], CryptoExchangePublicKey);
|
|
63
62
|
exports.CryptoExchangePublicKey = CryptoExchangePublicKey;
|
|
64
63
|
//# sourceMappingURL=CryptoExchangePublicKey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoExchangePublicKey.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangePublicKey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CryptoExchangePublicKey.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangePublicKey.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA4E;AAC5E,8CAAuD;AACvD,wDAAqD;AAErD,yEAAsE;AAatE,IAAa,uBAAuB,GAApC,MAAa,uBAAwB,SAAQ,iCAAe;IASxC,MAAM,CAAC,OA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nC;AA9CY,0DAAuB"}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ISerializable, ISerialized } from "@js-soft/ts-serval";
|
|
2
2
|
import { CoreBuffer, IClearable, ICoreBuffer } from "../CoreBuffer";
|
|
3
|
-
import {
|
|
3
|
+
import { CryptoSerializable } from "../CryptoSerializable";
|
|
4
4
|
import { CryptoEncryptionAlgorithm } from "../encryption/CryptoEncryption";
|
|
5
5
|
export interface ICryptoExchangeSecretsSerialized extends ISerialized {
|
|
6
6
|
alg: CryptoEncryptionAlgorithm;
|
|
7
7
|
rx: string;
|
|
8
8
|
tx: string;
|
|
9
9
|
}
|
|
10
|
-
export interface ICryptoExchangeSecrets extends
|
|
10
|
+
export interface ICryptoExchangeSecrets extends ISerializable {
|
|
11
11
|
algorithm: CryptoEncryptionAlgorithm;
|
|
12
12
|
receivingKey: ICoreBuffer;
|
|
13
13
|
transmissionKey: ICoreBuffer;
|
|
14
14
|
}
|
|
15
|
-
export declare class CryptoExchangeSecrets extends
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
constructor(receivingKey: CoreBuffer, transmissionKey: CoreBuffer, algorithm: CryptoEncryptionAlgorithm);
|
|
15
|
+
export declare class CryptoExchangeSecrets extends CryptoSerializable implements ICryptoExchangeSecrets, IClearable {
|
|
16
|
+
algorithm: CryptoEncryptionAlgorithm;
|
|
17
|
+
receivingKey: CoreBuffer;
|
|
18
|
+
transmissionKey: CoreBuffer;
|
|
20
19
|
toJSON(verbose?: boolean): ICryptoExchangeSecretsSerialized;
|
|
21
20
|
clear(): void;
|
|
22
21
|
serialize(verbose?: boolean): string;
|
|
23
22
|
toBase64(verbose?: boolean): string;
|
|
24
|
-
static from(value: CryptoExchangeSecrets | ICryptoExchangeSecrets):
|
|
25
|
-
static
|
|
23
|
+
static from(value: CryptoExchangeSecrets | ICryptoExchangeSecrets): CryptoExchangeSecrets;
|
|
24
|
+
static preFrom(value: any): any;
|
|
25
|
+
static fromJSON(value: ICryptoExchangeSecretsSerialized): CryptoExchangeSecrets;
|
|
26
26
|
static fromBase64(value: string): Promise<CryptoExchangeSecrets>;
|
|
27
|
-
static deserialize(value: string): Promise<CryptoExchangeSecrets>;
|
|
28
27
|
}
|
|
@@ -8,29 +8,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var CryptoExchangeSecrets_1;
|
|
12
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
12
|
exports.CryptoExchangeSecrets = void 0;
|
|
14
13
|
const ts_serval_1 = require("@js-soft/ts-serval");
|
|
15
14
|
const CoreBuffer_1 = require("../CoreBuffer");
|
|
16
|
-
const
|
|
17
|
-
let CryptoExchangeSecrets =
|
|
18
|
-
constructor(receivingKey, transmissionKey, algorithm) {
|
|
19
|
-
super();
|
|
20
|
-
this.receivingKey = receivingKey;
|
|
21
|
-
this.transmissionKey = transmissionKey;
|
|
22
|
-
this.algorithm = algorithm;
|
|
23
|
-
}
|
|
15
|
+
const CryptoSerializable_1 = require("../CryptoSerializable");
|
|
16
|
+
let CryptoExchangeSecrets = class CryptoExchangeSecrets extends CryptoSerializable_1.CryptoSerializable {
|
|
24
17
|
toJSON(verbose = true) {
|
|
25
|
-
|
|
18
|
+
return {
|
|
26
19
|
rx: this.receivingKey.toBase64URL(),
|
|
27
20
|
tx: this.transmissionKey.toBase64URL(),
|
|
28
|
-
alg: this.algorithm
|
|
21
|
+
alg: this.algorithm,
|
|
22
|
+
"@type": verbose ? "CryptoExchangeSecrets" : undefined
|
|
29
23
|
};
|
|
30
|
-
if (verbose) {
|
|
31
|
-
obj["@type"] = "CryptoExchangeSecrets";
|
|
32
|
-
}
|
|
33
|
-
return obj;
|
|
34
24
|
}
|
|
35
25
|
clear() {
|
|
36
26
|
this.receivingKey.clear();
|
|
@@ -43,34 +33,42 @@ let CryptoExchangeSecrets = CryptoExchangeSecrets_1 = class CryptoExchangeSecret
|
|
|
43
33
|
return CoreBuffer_1.CoreBuffer.utf8_base64(this.serialize(verbose));
|
|
44
34
|
}
|
|
45
35
|
static from(value) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
return this.fromAny(value);
|
|
37
|
+
}
|
|
38
|
+
static preFrom(value) {
|
|
39
|
+
if (value.rx) {
|
|
40
|
+
value = {
|
|
41
|
+
algorithm: value.alg,
|
|
42
|
+
receivingKey: value.rx,
|
|
43
|
+
transmissionKey: value.tx
|
|
44
|
+
};
|
|
49
45
|
}
|
|
50
|
-
|
|
51
|
-
const transmissionKey = CoreBuffer_1.CoreBuffer.from(value.transmissionKey);
|
|
52
|
-
return Promise.resolve(new CryptoExchangeSecrets_1(receivingKey, transmissionKey, value.algorithm));
|
|
46
|
+
return value;
|
|
53
47
|
}
|
|
54
48
|
static fromJSON(value) {
|
|
55
|
-
|
|
56
|
-
if (!value.alg || !value.rx || !value.tx) {
|
|
57
|
-
throw new Error("No algorithm, receivingKey or transmissionKey property set.");
|
|
58
|
-
}
|
|
59
|
-
const receivingKey = CoreBuffer_1.CoreBuffer.fromBase64URL(value.rx);
|
|
60
|
-
const transmissionKey = CoreBuffer_1.CoreBuffer.fromBase64URL(value.tx);
|
|
61
|
-
return Promise.resolve(new CryptoExchangeSecrets_1(receivingKey, transmissionKey, value.alg));
|
|
49
|
+
return this.fromAny(value);
|
|
62
50
|
}
|
|
63
51
|
static fromBase64(value) {
|
|
64
52
|
return Promise.resolve(this.deserialize(CoreBuffer_1.CoreBuffer.base64_utf8(value)));
|
|
65
53
|
}
|
|
66
|
-
static async deserialize(value) {
|
|
67
|
-
const obj = JSON.parse(value);
|
|
68
|
-
return await this.fromJSON(obj);
|
|
69
|
-
}
|
|
70
54
|
};
|
|
71
|
-
|
|
72
|
-
(0, ts_serval_1.
|
|
73
|
-
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, ts_serval_1.validate)(),
|
|
57
|
+
(0, ts_serval_1.serialize)(),
|
|
58
|
+
__metadata("design:type", Number)
|
|
59
|
+
], CryptoExchangeSecrets.prototype, "algorithm", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, ts_serval_1.validate)(),
|
|
62
|
+
(0, ts_serval_1.serialize)(),
|
|
63
|
+
__metadata("design:type", CoreBuffer_1.CoreBuffer)
|
|
64
|
+
], CryptoExchangeSecrets.prototype, "receivingKey", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, ts_serval_1.validate)(),
|
|
67
|
+
(0, ts_serval_1.serialize)(),
|
|
68
|
+
__metadata("design:type", CoreBuffer_1.CoreBuffer)
|
|
69
|
+
], CryptoExchangeSecrets.prototype, "transmissionKey", void 0);
|
|
70
|
+
CryptoExchangeSecrets = __decorate([
|
|
71
|
+
(0, ts_serval_1.type)("CryptoExchangeSecrets")
|
|
74
72
|
], CryptoExchangeSecrets);
|
|
75
73
|
exports.CryptoExchangeSecrets = CryptoExchangeSecrets;
|
|
76
74
|
//# sourceMappingURL=CryptoExchangeSecrets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoExchangeSecrets.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangeSecrets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CryptoExchangeSecrets.js","sourceRoot":"","sources":["../../src/exchange/CryptoExchangeSecrets.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA2F;AAC3F,8CAAoE;AACpE,8DAA2D;AAgB3D,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,uCAAkB;IAazC,MAAM,CAAC,OAAO,GAAG,IAAI;QACjC,OAAO;YACH,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;YACnC,EAAE,EAAE,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE;YACtC,GAAG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,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;8BACS,uBAAU;2DAAC;AAIhC;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;8BACY,uBAAU;8DAAC;AAX1B,qBAAqB;IADjC,IAAA,gBAAI,EAAC,uBAAuB,CAAC;GACjB,qBAAqB,CAyDjC;AAzDY,sDAAqB"}
|
|
@@ -2,19 +2,16 @@ import { CoreBuffer } from "../CoreBuffer";
|
|
|
2
2
|
import { CryptoError } from "../CryptoError";
|
|
3
3
|
import { CryptoValidation } from "../CryptoValidation";
|
|
4
4
|
import { CryptoExchangeAlgorithm } from "./CryptoExchange";
|
|
5
|
-
import { CryptoExchangePrivateKey } from "./CryptoExchangePrivateKey";
|
|
6
|
-
import { CryptoExchangePublicKey } from "./CryptoExchangePublicKey";
|
|
7
5
|
export declare class CryptoExchangeValidation extends CryptoValidation {
|
|
8
|
-
static readonly PRIVATE_KEY_MIN_BYTES
|
|
9
|
-
static readonly PRIVATE_KEY_MAX_BYTES
|
|
10
|
-
static readonly PUBLIC_KEY_MIN_BYTES
|
|
11
|
-
static readonly PUBLIC_KEY_MAX_BYTES
|
|
6
|
+
static readonly PRIVATE_KEY_MIN_BYTES = 20;
|
|
7
|
+
static readonly PRIVATE_KEY_MAX_BYTES = 40;
|
|
8
|
+
static readonly PUBLIC_KEY_MIN_BYTES = 20;
|
|
9
|
+
static readonly PUBLIC_KEY_MAX_BYTES = 40;
|
|
12
10
|
static checkExchangeAlgorithm(algorithm: number, throwError?: boolean): CryptoError | undefined;
|
|
13
|
-
static
|
|
11
|
+
static checkExchangePrivateKeyAsString(privateKey: string, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
|
|
14
12
|
static checkExchangePrivateKeyAsBuffer(privateKey: CoreBuffer, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
|
|
15
|
-
static checkExchangePrivateKey(privateKey:
|
|
13
|
+
static checkExchangePrivateKey(privateKey: string | CoreBuffer, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
|
|
16
14
|
static checkExchangePublicKeyAsString(publicKey: string, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
|
|
17
15
|
static checkExchangePublicKeyAsBuffer(publicKey: CoreBuffer, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
|
|
18
|
-
static checkExchangePublicKey(publicKey:
|
|
19
|
-
static checkExchangeKeypair(privateKey: CryptoExchangePrivateKey, publicKey: CryptoExchangePublicKey, throwError?: boolean): CryptoError | undefined;
|
|
16
|
+
static checkExchangePublicKey(publicKey: string | CoreBuffer, algorithm: CryptoExchangeAlgorithm, propertyName?: string, throwError?: boolean): CryptoError | undefined;
|
|
20
17
|
}
|