@mainsail/crypto-consensus-bls12-381 0.0.1-alpha.2 → 0.0.1-alpha.20
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/README.md +19 -0
- package/distribution/index.d.ts +1 -2
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +29 -50
- package/distribution/index.js.map +1 -1
- package/distribution/schemas.js +3 -6
- package/distribution/schemas.js.map +1 -1
- package/package.json +10 -14
package/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Mainsail - Crypto consensus BLS12-381
|
2
|
+
|
3
|
+

|
4
|
+
|
5
|
+
## Documentation
|
6
|
+
|
7
|
+
You can find installation instructions and detailed instructions on how to use this package at the [dedicated documentation site](https://ark.dev/docs/mainsail).
|
8
|
+
|
9
|
+
## Security
|
10
|
+
|
11
|
+
If you discover a security vulnerability within this package, please send an e-mail to [security@ark.io](mailto:security@ark.io). All security vulnerabilities will be promptly addressed.
|
12
|
+
|
13
|
+
## Credits
|
14
|
+
|
15
|
+
This project exists thanks to all the people who [contribute](https://github.com/ArkEcosystem/mainsail/graphs/contributors).
|
16
|
+
|
17
|
+
## License
|
18
|
+
|
19
|
+
[GPL-3.0-only](https://github.com/ArkEcosystem/mainsail/blob/main/LICENSE) © [ARK Ecosystem](https://ark.io)
|
package/distribution/index.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import { Providers } from "@mainsail/kernel";
|
2
|
-
export * from "./schemas";
|
2
|
+
export * from "./schemas.js";
|
3
3
|
export declare class ServiceProvider extends Providers.ServiceProvider {
|
4
4
|
register(): Promise<void>;
|
5
|
-
requiredByWorker(): boolean;
|
6
5
|
}
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,cAAc,cAAc,CAAC;AAE7B,qBAAa,eAAgB,SAAQ,SAAS,CAAC,eAAe;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CA6CtC"}
|
package/distribution/index.js
CHANGED
@@ -1,69 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
exports.ServiceProvider = void 0;
|
18
|
-
const container_1 = require("@mainsail/container");
|
19
|
-
const contracts_1 = require("@mainsail/contracts");
|
20
|
-
const crypto_key_pair_bls12_381_1 = require("@mainsail/crypto-key-pair-bls12-381");
|
21
|
-
const crypto_signature_bls12_381_1 = require("@mainsail/crypto-signature-bls12-381");
|
22
|
-
const kernel_1 = require("@mainsail/kernel");
|
23
|
-
const schemas_1 = require("./schemas");
|
24
|
-
__exportStar(require("./schemas"), exports);
|
25
|
-
class ServiceProvider extends kernel_1.Providers.ServiceProvider {
|
1
|
+
import { Selectors } from "@mainsail/container";
|
2
|
+
import { Identifiers } from "@mainsail/contracts";
|
3
|
+
import { KeyPairFactory, PrivateKeyFactory, PublicKeyFactory, PublicKeySerializer, } from "@mainsail/crypto-key-pair-bls12-381";
|
4
|
+
import { Signature } from "@mainsail/crypto-signature-bls12-381";
|
5
|
+
import { Providers } from "@mainsail/kernel";
|
6
|
+
import { schemas } from "./schemas.js";
|
7
|
+
export * from "./schemas.js";
|
8
|
+
export class ServiceProvider extends Providers.ServiceProvider {
|
26
9
|
async register() {
|
27
10
|
this.app
|
28
|
-
.bind(
|
11
|
+
.bind(Identifiers.Cryptography.Identity.PublicKey.Size)
|
29
12
|
.toConstantValue(48)
|
30
|
-
.when(
|
13
|
+
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "consensus"));
|
31
14
|
this.app
|
32
|
-
.bind(
|
15
|
+
.bind(Identifiers.Cryptography.Signature.Size)
|
33
16
|
.toConstantValue(96)
|
34
|
-
.when(
|
17
|
+
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "consensus"));
|
35
18
|
this.app
|
36
|
-
.bind(
|
37
|
-
.to(
|
19
|
+
.bind(Identifiers.Cryptography.Identity.KeyPair.Factory)
|
20
|
+
.to(KeyPairFactory)
|
38
21
|
.inSingletonScope()
|
39
|
-
.when(
|
22
|
+
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "consensus"));
|
40
23
|
this.app
|
41
|
-
.bind(
|
42
|
-
.to(
|
24
|
+
.bind(Identifiers.Cryptography.Identity.PrivateKey.Factory)
|
25
|
+
.to(PrivateKeyFactory)
|
43
26
|
.inSingletonScope()
|
44
|
-
.when(
|
27
|
+
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "consensus"));
|
45
28
|
this.app
|
46
|
-
.bind(
|
47
|
-
.to(
|
29
|
+
.bind(Identifiers.Cryptography.Identity.PublicKey.Factory)
|
30
|
+
.to(PublicKeyFactory)
|
48
31
|
.inSingletonScope()
|
49
|
-
.when(
|
32
|
+
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "consensus"));
|
50
33
|
this.app
|
51
|
-
.bind(
|
52
|
-
.to(
|
34
|
+
.bind(Identifiers.Cryptography.Identity.PublicKey.Serializer)
|
35
|
+
.to(PublicKeySerializer)
|
53
36
|
.inSingletonScope()
|
54
|
-
.when(
|
37
|
+
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "consensus"));
|
55
38
|
this.app
|
56
|
-
.bind(
|
57
|
-
.to(
|
39
|
+
.bind(Identifiers.Cryptography.Signature.Instance)
|
40
|
+
.to(Signature)
|
58
41
|
.inSingletonScope()
|
59
|
-
.when(
|
60
|
-
for (const schema of Object.values(
|
61
|
-
this.app.get(
|
42
|
+
.when(Selectors.anyAncestorOrTargetTaggedFirst("type", "consensus"));
|
43
|
+
for (const schema of Object.values(schemas)) {
|
44
|
+
this.app.get(Identifiers.Cryptography.Validator).addSchema(schema);
|
62
45
|
}
|
63
46
|
}
|
64
|
-
requiredByWorker() {
|
65
|
-
return true;
|
66
|
-
}
|
67
47
|
}
|
68
|
-
exports.ServiceProvider = ServiceProvider;
|
69
48
|
//# 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,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAa,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,cAAc,cAAc,CAAC;AAE7B,MAAM,OAAO,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,CA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AC,GAAG;aACN,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC;aACjD,EAAE,CAAC,SAAS,CAAC;aACb,gBAAgB,EAAE;aAClB,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;QAEtE,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"}
|
package/distribution/schemas.js
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
exports.schemas = void 0;
|
4
|
-
const crypto_key_pair_bls12_381_1 = require("@mainsail/crypto-key-pair-bls12-381");
|
5
|
-
exports.schemas = {
|
1
|
+
import { schemas as originalSchemas } from "@mainsail/crypto-key-pair-bls12-381";
|
2
|
+
export const schemas = {
|
6
3
|
consensusPublicKey: {
|
7
|
-
...
|
4
|
+
...originalSchemas.publicKey,
|
8
5
|
$id: "consensusPublicKey",
|
9
6
|
},
|
10
7
|
consensusSignature: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEjF,MAAM,CAAC,MAAM,OAAO,GAAG;IACtB,kBAAkB,EAAE;QACnB,GAAG,eAAe,CAAC,SAAS;QAC5B,GAAG,EAAE,oBAAoB;KACzB;IACD,kBAAkB,EAAE;QACnB,GAAG,EAAE,oBAAoB;QACzB,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;QACrE,IAAI,EAAE,QAAQ;KACd;CACD,CAAC"}
|
package/package.json
CHANGED
@@ -1,26 +1,21 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mainsail/crypto-consensus-bls12-381",
|
3
|
-
"version": "0.0.1-alpha.
|
3
|
+
"version": "0.0.1-alpha.20",
|
4
4
|
"description": "Combined BLS12-381 utilities for the Mainsail blockchain",
|
5
5
|
"license": "GPL-3.0-only",
|
6
6
|
"contributors": [],
|
7
|
+
"type": "module",
|
7
8
|
"main": "distribution/index.js",
|
8
9
|
"types": "distribution/index.d.ts",
|
9
10
|
"files": [
|
10
11
|
"/distribution"
|
11
12
|
],
|
12
13
|
"dependencies": {
|
13
|
-
"
|
14
|
-
"
|
15
|
-
"
|
16
|
-
"
|
17
|
-
"
|
18
|
-
"@mainsail/container": "0.0.1-alpha.2",
|
19
|
-
"@mainsail/contracts": "0.0.1-alpha.2",
|
20
|
-
"@mainsail/crypto-key-pair-bls12-381": "0.0.1-alpha.2",
|
21
|
-
"@mainsail/crypto-signature-bls12-381": "0.0.1-alpha.2",
|
22
|
-
"@mainsail/kernel": "0.0.1-alpha.2",
|
23
|
-
"@mainsail/utils": "0.0.1-alpha.2"
|
14
|
+
"@mainsail/container": "0.0.1-alpha.20",
|
15
|
+
"@mainsail/contracts": "0.0.1-alpha.20",
|
16
|
+
"@mainsail/crypto-key-pair-bls12-381": "0.0.1-alpha.20",
|
17
|
+
"@mainsail/crypto-signature-bls12-381": "0.0.1-alpha.20",
|
18
|
+
"@mainsail/kernel": "0.0.1-alpha.20"
|
24
19
|
},
|
25
20
|
"devDependencies": {
|
26
21
|
"uvu": "^0.5.6"
|
@@ -33,9 +28,10 @@
|
|
33
28
|
"build:watch": "pnpm run clean && tsc -w",
|
34
29
|
"clean": "del distribution",
|
35
30
|
"release": "pnpm publish --access public",
|
36
|
-
"test": "
|
31
|
+
"test": "pnpm run uvu source .test.ts",
|
37
32
|
"test:coverage": "c8 pnpm run test",
|
38
33
|
"test:coverage:html": "c8 -r html --all pnpm run test",
|
39
|
-
"test:file": "
|
34
|
+
"test:file": "pnpm run uvu source",
|
35
|
+
"uvu": "tsx --tsconfig ../../tsconfig.test.json ./node_modules/uvu/bin.js"
|
40
36
|
}
|
41
37
|
}
|