@mainsail/crypto-key-pair-ecdsa 0.0.1-evm.5 → 0.0.1-evm.51
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/distribution/index.d.ts +1 -5
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +1 -52
- package/distribution/index.js.map +1 -1
- package/distribution/pair.d.ts +1 -2
- package/distribution/pair.d.ts.map +1 -1
- package/distribution/pair.js +10 -9
- package/distribution/pair.js.map +1 -1
- package/distribution/private.d.ts +1 -1
- package/distribution/private.d.ts.map +1 -1
- package/distribution/private.js +6 -3
- package/distribution/private.js.map +1 -1
- package/distribution/public.d.ts +1 -3
- package/distribution/public.d.ts.map +1 -1
- package/distribution/public.js +8 -21
- package/distribution/public.js.map +1 -1
- package/distribution/serializer.d.ts +1 -2
- package/distribution/serializer.d.ts.map +1 -1
- package/distribution/serializer.js.map +1 -1
- package/distribution/service-provider.d.ts +6 -0
- package/distribution/service-provider.d.ts.map +1 -0
- package/distribution/service-provider.js +53 -0
- package/distribution/service-provider.js.map +1 -0
- package/package.json +15 -16
package/distribution/index.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { Providers } from "@mainsail/kernel";
|
|
2
1
|
export * from "./pair.js";
|
|
3
2
|
export * from "./schemas.js";
|
|
4
|
-
export
|
|
5
|
-
#private;
|
|
6
|
-
register(): Promise<void>;
|
|
7
|
-
}
|
|
3
|
+
export * from "./service-provider.js";
|
|
8
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC"}
|
package/distribution/index.js
CHANGED
|
@@ -1,55 +1,4 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _ServiceProvider_instances, _ServiceProvider_registerSchemas;
|
|
7
|
-
import { Selectors } from "@mainsail/container";
|
|
8
|
-
import { Identifiers } from "@mainsail/contracts";
|
|
9
|
-
import { Providers } from "@mainsail/kernel";
|
|
10
|
-
import { KeyPairFactory } from "./pair.js";
|
|
11
|
-
import { PrivateKeyFactory } from "./private.js";
|
|
12
|
-
import { PublicKeyFactory } from "./public.js";
|
|
13
|
-
import { schemas } from "./schemas.js";
|
|
14
|
-
import { PublicKeySerializer } from "./serializer.js";
|
|
15
1
|
export * from "./pair.js";
|
|
16
2
|
export * from "./schemas.js";
|
|
17
|
-
export
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
_ServiceProvider_instances.add(this);
|
|
21
|
-
}
|
|
22
|
-
async register() {
|
|
23
|
-
this.app
|
|
24
|
-
.bind(Identifiers.Cryptography.Identity.PublicKey.Size)
|
|
25
|
-
.toConstantValue(33)
|
|
26
|
-
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "wallet"));
|
|
27
|
-
this.app
|
|
28
|
-
.bind(Identifiers.Cryptography.Identity.KeyPair.Factory)
|
|
29
|
-
.to(KeyPairFactory)
|
|
30
|
-
.inSingletonScope()
|
|
31
|
-
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "wallet"));
|
|
32
|
-
this.app
|
|
33
|
-
.bind(Identifiers.Cryptography.Identity.PrivateKey.Factory)
|
|
34
|
-
.to(PrivateKeyFactory)
|
|
35
|
-
.inSingletonScope()
|
|
36
|
-
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "wallet"));
|
|
37
|
-
this.app
|
|
38
|
-
.bind(Identifiers.Cryptography.Identity.PublicKey.Factory)
|
|
39
|
-
.to(PublicKeyFactory)
|
|
40
|
-
.inSingletonScope()
|
|
41
|
-
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "wallet"));
|
|
42
|
-
this.app
|
|
43
|
-
.bind(Identifiers.Cryptography.Identity.PublicKey.Serializer)
|
|
44
|
-
.to(PublicKeySerializer)
|
|
45
|
-
.inSingletonScope()
|
|
46
|
-
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "wallet"));
|
|
47
|
-
__classPrivateFieldGet(this, _ServiceProvider_instances, "m", _ServiceProvider_registerSchemas).call(this);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
_ServiceProvider_instances = new WeakSet(), _ServiceProvider_registerSchemas = function _ServiceProvider_registerSchemas() {
|
|
51
|
-
for (const schema of Object.values(schemas)) {
|
|
52
|
-
this.app.get(Identifiers.Cryptography.Validator).addSchema(schema);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
3
|
+
export * from "./service-provider.js";
|
|
55
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC"}
|
package/distribution/pair.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { Contracts } from "@mainsail/contracts";
|
|
1
|
+
import type { Contracts } from "@mainsail/contracts";
|
|
3
2
|
export declare class KeyPairFactory implements Contracts.Crypto.KeyPairFactory {
|
|
4
3
|
private readonly configuration;
|
|
5
4
|
fromMnemonic(mnemonic: string, compressed?: boolean): Promise<Contracts.Crypto.KeyPair>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pair.d.ts","sourceRoot":"","sources":["../source/pair.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pair.d.ts","sourceRoot":"","sources":["../source/pair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,qBACa,cAAe,YAAW,SAAS,CAAC,MAAM,CAAC,cAAc;IAErE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;IAEnD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAE,OAAc,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;IAI7F,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,GAAE,OAAc,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;IAQjG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;CAUpE"}
|
package/distribution/pair.js
CHANGED
|
@@ -7,11 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
import { Identifiers } from "@mainsail/constants";
|
|
10
11
|
import { inject, injectable } from "@mainsail/container";
|
|
11
|
-
import {
|
|
12
|
+
import { WifNetworkError } from "@mainsail/exceptions";
|
|
12
13
|
import { secp256k1, SHA256 } from "bcrypto";
|
|
13
|
-
import
|
|
14
|
+
import { decode } from "wif";
|
|
14
15
|
let KeyPairFactory = class KeyPairFactory {
|
|
16
|
+
configuration;
|
|
15
17
|
async fromMnemonic(mnemonic, compressed = true) {
|
|
16
18
|
return this.fromPrivateKey(SHA256.digest(Buffer.from(mnemonic, "utf8")), compressed);
|
|
17
19
|
}
|
|
@@ -23,13 +25,12 @@ let KeyPairFactory = class KeyPairFactory {
|
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
async fromWIF(wif) {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
28
|
+
const networkVersion = this.configuration.getNetwork().wif;
|
|
29
|
+
const decoded = decode(wif);
|
|
30
|
+
if (decoded.version !== networkVersion) {
|
|
31
|
+
throw new WifNetworkError(networkVersion, decoded.version);
|
|
32
|
+
}
|
|
33
|
+
return this.fromPrivateKey(Buffer.from(decoded.privateKey), decoded.compressed);
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
__decorate([
|
package/distribution/pair.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pair.js","sourceRoot":"","sources":["../source/pair.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"pair.js","sourceRoot":"","sources":["../source/pair.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAGtB,IAAM,cAAc,GAApB,MAAM,cAAc;IAET,aAAa,CAAkC;IAEzD,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,aAAsB,IAAI;QACrE,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IACtF,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,UAAkB,EAAE,aAAsB,IAAI;QACzE,OAAO;YACN,UAAU;YACV,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;YACtC,SAAS,EAAE,SAAS,CAAC,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;SAC5E,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC;QAC3D,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAE5B,IAAI,OAAO,CAAC,OAAO,KAAK,cAAc,EAAE,CAAC;YACxC,MAAM,IAAI,eAAe,CAAC,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACjF,CAAC;CACD,CAAA;AAxBiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC;;qDACiB;AAFpD,cAAc;IAD1B,UAAU,EAAE;GACA,cAAc,CA0B1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Contracts } from "@mainsail/contracts";
|
|
1
|
+
import type { Contracts } from "@mainsail/contracts";
|
|
2
2
|
export declare class PrivateKeyFactory implements Contracts.Crypto.PrivateKeyFactory {
|
|
3
3
|
private readonly keyPairFactory;
|
|
4
4
|
fromMnemonic(mnemonic: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private.d.ts","sourceRoot":"","sources":["../source/private.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private.d.ts","sourceRoot":"","sources":["../source/private.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD,qBACa,iBAAkB,YAAW,SAAS,CAAC,MAAM,CAAC,iBAAiB;IAE3E,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmC;IAErD,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK/C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAIlD"}
|
package/distribution/private.js
CHANGED
|
@@ -7,14 +7,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
import { Identifiers } from "@mainsail/constants";
|
|
10
11
|
import { inject, injectable } from "@mainsail/container";
|
|
11
|
-
import { Contracts, Identifiers } from "@mainsail/contracts";
|
|
12
12
|
let PrivateKeyFactory = class PrivateKeyFactory {
|
|
13
|
+
keyPairFactory;
|
|
13
14
|
async fromMnemonic(mnemonic) {
|
|
14
|
-
|
|
15
|
+
const { privateKey } = await this.keyPairFactory.fromMnemonic(mnemonic);
|
|
16
|
+
return privateKey;
|
|
15
17
|
}
|
|
16
18
|
async fromWIF(wif) {
|
|
17
|
-
|
|
19
|
+
const { privateKey } = await this.keyPairFactory.fromWIF(wif);
|
|
20
|
+
return privateKey;
|
|
18
21
|
}
|
|
19
22
|
};
|
|
20
23
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private.js","sourceRoot":"","sources":["../source/private.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"private.js","sourceRoot":"","sources":["../source/private.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGlD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAEZ,cAAc,CAAmC;IAE3D,KAAK,CAAC,YAAY,CAAC,QAAgB;QACzC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACxE,OAAO,UAAU,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC9D,OAAO,UAAU,CAAC;IACnB,CAAC;CACD,CAAA;AAXiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;;yDACQ;AAFtD,iBAAiB;IAD7B,UAAU,EAAE;GACA,iBAAiB,CAa7B"}
|
package/distribution/public.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { Contracts } from "@mainsail/contracts";
|
|
1
|
+
import type { Contracts } from "@mainsail/contracts";
|
|
3
2
|
export declare class PublicKeyFactory implements Contracts.Crypto.PublicKeyFactory {
|
|
4
3
|
private readonly keyPairFactory;
|
|
5
4
|
fromMnemonic(mnemonic: string): Promise<string>;
|
|
6
5
|
fromWIF(wif: string): Promise<string>;
|
|
7
|
-
fromMultiSignatureAsset(asset: Contracts.Crypto.MultiSignatureAsset): Promise<string>;
|
|
8
6
|
verify(publicKey: string): Promise<boolean>;
|
|
9
7
|
aggregate(publicKeys: Buffer[]): Promise<string>;
|
|
10
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../source/public.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../source/public.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAOrD,qBACa,gBAAiB,YAAW,SAAS,CAAC,MAAM,CAAC,gBAAgB;IAEzE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmC;IAErD,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK/C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKrC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI3C,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CAG7D"}
|
package/distribution/public.js
CHANGED
|
@@ -7,38 +7,25 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
import { Identifiers } from "@mainsail/constants";
|
|
10
11
|
import { inject, injectable } from "@mainsail/container";
|
|
11
|
-
import {
|
|
12
|
-
import { numberToHex } from "@mainsail/utils";
|
|
12
|
+
import { NotImplemented } from "@mainsail/exceptions";
|
|
13
13
|
import { secp256k1 } from "bcrypto";
|
|
14
14
|
let PublicKeyFactory = class PublicKeyFactory {
|
|
15
|
+
keyPairFactory;
|
|
15
16
|
async fromMnemonic(mnemonic) {
|
|
16
|
-
|
|
17
|
+
const { publicKey } = await this.keyPairFactory.fromMnemonic(mnemonic);
|
|
18
|
+
return publicKey;
|
|
17
19
|
}
|
|
18
20
|
async fromWIF(wif) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
async fromMultiSignatureAsset(asset) {
|
|
22
|
-
const { min, publicKeys } = asset;
|
|
23
|
-
for (const publicKey of publicKeys) {
|
|
24
|
-
if (!this.verify(publicKey)) {
|
|
25
|
-
throw new Exceptions.PublicKeyError(publicKey);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (min < 1 || min > publicKeys.length) {
|
|
29
|
-
throw new Exceptions.InvalidMultiSignatureAssetError();
|
|
30
|
-
}
|
|
31
|
-
const minKey = await this.fromMnemonic(numberToHex(min));
|
|
32
|
-
const keys = [minKey, ...publicKeys];
|
|
33
|
-
return secp256k1
|
|
34
|
-
.publicKeyCombine(keys.map((publicKey) => Buffer.from(publicKey, "hex")))
|
|
35
|
-
.toString("hex");
|
|
21
|
+
const { publicKey } = await this.keyPairFactory.fromWIF(wif);
|
|
22
|
+
return publicKey;
|
|
36
23
|
}
|
|
37
24
|
async verify(publicKey) {
|
|
38
25
|
return secp256k1.publicKeyVerify(Buffer.from(publicKey, "hex"));
|
|
39
26
|
}
|
|
40
27
|
async aggregate(publicKeys) {
|
|
41
|
-
throw new
|
|
28
|
+
throw new NotImplemented(this.constructor.name, "aggregate");
|
|
42
29
|
}
|
|
43
30
|
};
|
|
44
31
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.js","sourceRoot":"","sources":["../source/public.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../source/public.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAG7B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEX,cAAc,CAAmC;IAE3D,KAAK,CAAC,YAAY,CAAC,QAAgB;QACzC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACvE,OAAO,SAAS,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAiB;QACpC,OAAO,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,UAAoB;QAC1C,MAAM,IAAI,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC9D,CAAC;CACD,CAAA;AAnBiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;;wDACQ;AAFtD,gBAAgB;IAD5B,UAAU,EAAE;GACA,gBAAgB,CAqB5B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { Contracts } from "@mainsail/contracts";
|
|
1
|
+
import type { Contracts } from "@mainsail/contracts";
|
|
3
2
|
import { ByteBuffer } from "@mainsail/utils";
|
|
4
3
|
export declare class PublicKeySerializer implements Contracts.Crypto.PublicKeySerializer {
|
|
5
4
|
serialize(buffer: ByteBuffer, publicKey: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,qBACa,mBAAoB,YAAW,SAAS,CAAC,MAAM,CAAC,mBAAmB;IACxE,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAItD,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;CAG9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAI1C,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IACxB,SAAS,CAAC,MAAkB,EAAE,SAAiB;QACrD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAClD,CAAC;IAEM,WAAW,CAAC,MAAkB;QACpC,OAAO,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;CACD,CAAA;AARY,mBAAmB;IAD/B,UAAU,EAAE;GACA,mBAAmB,CAQ/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-provider.d.ts","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAQ7C,qBACa,eAAgB,SAAQ,SAAS,CAAC,eAAe;;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAsCtC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Identifiers } from "@mainsail/constants";
|
|
8
|
+
import { injectable, Selectors } from "@mainsail/container";
|
|
9
|
+
import { Providers } from "@mainsail/kernel";
|
|
10
|
+
import { KeyPairFactory } from "./pair.js";
|
|
11
|
+
import { PrivateKeyFactory } from "./private.js";
|
|
12
|
+
import { PublicKeyFactory } from "./public.js";
|
|
13
|
+
import { schemas } from "./schemas.js";
|
|
14
|
+
import { PublicKeySerializer } from "./serializer.js";
|
|
15
|
+
let ServiceProvider = class ServiceProvider extends Providers.ServiceProvider {
|
|
16
|
+
async register() {
|
|
17
|
+
this.app
|
|
18
|
+
.bind(Identifiers.Cryptography.Identity.PublicKey.Size)
|
|
19
|
+
.toConstantValue(33)
|
|
20
|
+
.when(Selectors.anyAncestorOrTargetTagged("type", "wallet"));
|
|
21
|
+
this.app
|
|
22
|
+
.bind(Identifiers.Cryptography.Identity.KeyPair.Factory)
|
|
23
|
+
.to(KeyPairFactory)
|
|
24
|
+
.inSingletonScope()
|
|
25
|
+
.when(Selectors.anyAncestorOrTargetTagged("type", "wallet"));
|
|
26
|
+
this.app
|
|
27
|
+
.bind(Identifiers.Cryptography.Identity.PrivateKey.Factory)
|
|
28
|
+
.to(PrivateKeyFactory)
|
|
29
|
+
.inSingletonScope()
|
|
30
|
+
.when(Selectors.anyAncestorOrTargetTagged("type", "wallet"));
|
|
31
|
+
this.app
|
|
32
|
+
.bind(Identifiers.Cryptography.Identity.PublicKey.Factory)
|
|
33
|
+
.to(PublicKeyFactory)
|
|
34
|
+
.inSingletonScope()
|
|
35
|
+
.when(Selectors.anyAncestorOrTargetTagged("type", "wallet"));
|
|
36
|
+
this.app
|
|
37
|
+
.bind(Identifiers.Cryptography.Identity.PublicKey.Serializer)
|
|
38
|
+
.to(PublicKeySerializer)
|
|
39
|
+
.inSingletonScope()
|
|
40
|
+
.when(Selectors.anyAncestorOrTargetTagged("type", "wallet"));
|
|
41
|
+
this.#registerSchemas();
|
|
42
|
+
}
|
|
43
|
+
#registerSchemas() {
|
|
44
|
+
for (const schema of Object.values(schemas)) {
|
|
45
|
+
this.app.get(Identifiers.Cryptography.Validator).addSchema(schema);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
ServiceProvider = __decorate([
|
|
50
|
+
injectable()
|
|
51
|
+
], ServiceProvider);
|
|
52
|
+
export { ServiceProvider };
|
|
53
|
+
//# sourceMappingURL=service-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-provider.js","sourceRoot":"","sources":["../source/service-provider.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG/C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,SAAS,CAAC,eAAe;IACtD,KAAK,CAAC,QAAQ;QACpB,IAAI,CAAC,GAAG;aACN,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC;aACtD,eAAe,CAAC,EAAE,CAAC;aACnB,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAE9D,IAAI,CAAC,GAAG;aACN,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;aACvD,EAAE,CAAC,cAAc,CAAC;aAClB,gBAAgB,EAAE;aAClB,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAE9D,IAAI,CAAC,GAAG;aACN,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC;aAC1D,EAAE,CAAC,iBAAiB,CAAC;aACrB,gBAAgB,EAAE;aAClB,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAE9D,IAAI,CAAC,GAAG;aACN,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC;aACzD,EAAE,CAAC,gBAAgB,CAAC;aACpB,gBAAgB,EAAE;aAClB,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAE9D,IAAI,CAAC,GAAG;aACN,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC;aAC5D,EAAE,CAAC,mBAAmB,CAAC;aACvB,gBAAgB,EAAE;aAClB,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAE9D,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACzB,CAAC;IAED,gBAAgB;QACf,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,GAAG,CAAC,GAAG,CAA6B,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAChG,CAAC;IACF,CAAC;CACD,CAAA;AAvCY,eAAe;IAD3B,UAAU,EAAE;GACA,eAAe,CAuC3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mainsail/crypto-key-pair-ecdsa",
|
|
3
|
-
"version": "0.0.1-evm.
|
|
3
|
+
"version": "0.0.1-evm.51",
|
|
4
4
|
"description": "Secp256k1 key derivation for the Mainsail blockchain",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"contributors": [],
|
|
@@ -12,30 +12,29 @@
|
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"bcrypto": "5.5.2",
|
|
15
|
-
"wif": "
|
|
16
|
-
"@mainsail/
|
|
17
|
-
"@mainsail/
|
|
18
|
-
"@mainsail/
|
|
19
|
-
"@mainsail/
|
|
15
|
+
"wif": "5.0.0",
|
|
16
|
+
"@mainsail/constants": "0.0.1-evm.51",
|
|
17
|
+
"@mainsail/exceptions": "0.0.1-evm.51",
|
|
18
|
+
"@mainsail/container": "0.0.1-evm.51",
|
|
19
|
+
"@mainsail/utils": "0.0.1-evm.51",
|
|
20
|
+
"@mainsail/kernel": "0.0.1-evm.51"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"@mainsail/
|
|
26
|
-
"@mainsail/crypto-
|
|
27
|
-
"@mainsail/validation": "0.0.1-evm.5"
|
|
23
|
+
"uvu": "0.5.6",
|
|
24
|
+
"@mainsail/test-runner": "0.0.1-evm.51",
|
|
25
|
+
"@mainsail/validation": "0.0.1-evm.51",
|
|
26
|
+
"@mainsail/contracts": "0.0.1-evm.51",
|
|
27
|
+
"@mainsail/crypto-config": "0.0.1-evm.51"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=24"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "
|
|
33
|
+
"build": "tsc -b",
|
|
34
34
|
"build:watch": "pnpm run clean && tsc -w",
|
|
35
|
-
"clean": "del distribution",
|
|
36
35
|
"release": "pnpm publish --access public",
|
|
37
36
|
"test": "pnpm run uvu source .test.ts",
|
|
38
|
-
"test:coverage": "c8 pnpm run test",
|
|
37
|
+
"test:coverage": "c8 -r=text -r=lcov --all pnpm run test",
|
|
39
38
|
"test:coverage:html": "c8 -r html --all pnpm run test",
|
|
40
39
|
"test:file": "pnpm run uvu source",
|
|
41
40
|
"uvu": "tsx --tsconfig ../../tsconfig.test.json ./node_modules/uvu/bin.js"
|