@mainsail/crypto-wif 0.0.1-alpha.9 → 0.0.1-evm.2
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
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI7C,qBAAa,eAAgB,SAAQ,SAAS,CAAC,eAAe;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI7C,qBAAa,eAAgB,SAAQ,SAAS,CAAC,eAAe;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtC"}
|
package/distribution/index.js
CHANGED
@@ -1,16 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const kernel_1 = require("@mainsail/kernel");
|
6
|
-
const wif_factory_1 = require("./wif.factory");
|
7
|
-
class ServiceProvider extends kernel_1.Providers.ServiceProvider {
|
1
|
+
import { Identifiers } from "@mainsail/contracts";
|
2
|
+
import { Providers } from "@mainsail/kernel";
|
3
|
+
import { WIFFactory } from "./wif.factory.js";
|
4
|
+
export class ServiceProvider extends Providers.ServiceProvider {
|
8
5
|
async register() {
|
9
|
-
this.app.bind(
|
10
|
-
}
|
11
|
-
requiredByWorker() {
|
12
|
-
return true;
|
6
|
+
this.app.bind(Identifiers.Cryptography.Identity.Wif.Factory).to(WIFFactory).inSingletonScope();
|
13
7
|
}
|
14
8
|
}
|
15
|
-
exports.ServiceProvider = ServiceProvider;
|
16
9
|
//# 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,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,OAAO,eAAgB,SAAQ,SAAS,CAAC,eAAe;IACtD,KAAK,CAAC,QAAQ;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAChG,CAAC;CACD"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
@@ -8,34 +7,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.WIFFactory = void 0;
|
16
|
-
const container_1 = require("@mainsail/container");
|
17
|
-
const contracts_1 = require("@mainsail/contracts");
|
18
|
-
const wif_1 = __importDefault(require("wif"));
|
10
|
+
import { inject, injectable, tagged } from "@mainsail/container";
|
11
|
+
import { Contracts, Identifiers } from "@mainsail/contracts";
|
12
|
+
import wif from "wif";
|
19
13
|
let WIFFactory = class WIFFactory {
|
20
14
|
async fromMnemonic(mnemonic) {
|
21
15
|
const { compressed, privateKey } = await this.keyPairFactory.fromMnemonic(mnemonic);
|
22
|
-
return
|
16
|
+
return wif.encode(this.configuration.get("network.wif"), Buffer.from(privateKey, "hex"), compressed);
|
23
17
|
}
|
24
18
|
async fromKeys(keys) {
|
25
|
-
return
|
19
|
+
return wif.encode(this.configuration.get("network.wif"), Buffer.from(keys.privateKey, "hex"), keys.compressed);
|
26
20
|
}
|
27
21
|
};
|
28
|
-
exports.WIFFactory = WIFFactory;
|
29
22
|
__decorate([
|
30
|
-
|
23
|
+
inject(Identifiers.Cryptography.Configuration),
|
31
24
|
__metadata("design:type", Object)
|
32
25
|
], WIFFactory.prototype, "configuration", void 0);
|
33
26
|
__decorate([
|
34
|
-
|
35
|
-
|
27
|
+
inject(Identifiers.Cryptography.Identity.KeyPair.Factory),
|
28
|
+
tagged("type", "wallet"),
|
36
29
|
__metadata("design:type", Object)
|
37
30
|
], WIFFactory.prototype, "keyPairFactory", void 0);
|
38
|
-
|
39
|
-
|
31
|
+
WIFFactory = __decorate([
|
32
|
+
injectable()
|
40
33
|
], WIFFactory);
|
34
|
+
export { WIFFactory };
|
41
35
|
//# sourceMappingURL=wif.factory.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"wif.factory.js","sourceRoot":"","sources":["../source/wif.factory.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"wif.factory.js","sourceRoot":"","sources":["../source/wif.factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,GAAG,MAAM,KAAK,CAAC;AAGf,IAAM,UAAU,GAAhB,MAAM,UAAU;IAQf,KAAK,CAAC,YAAY,CAAC,QAAgB;QACzC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAA6B,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAE9G,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;IACtG,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAA8B;QACnD,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAChH,CAAC;CACD,CAAA;AAfiB;IADhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC;;iDACiB;AAI/C;IAFhB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;IACzD,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC;;kDACyC;AANtD,UAAU;IADtB,UAAU,EAAE;GACA,UAAU,CAiBtB"}
|
package/package.json
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mainsail/crypto-wif",
|
3
|
-
"version": "0.0.1-
|
3
|
+
"version": "0.0.1-evm.2",
|
4
4
|
"description": "Standalone version of identity interactions 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": [
|
@@ -11,15 +12,15 @@
|
|
11
12
|
],
|
12
13
|
"dependencies": {
|
13
14
|
"wif": "^4.0.0",
|
14
|
-
"@mainsail/
|
15
|
-
"@mainsail/contracts": "0.0.1-
|
16
|
-
"@mainsail/
|
15
|
+
"@mainsail/kernel": "0.0.1-evm.2",
|
16
|
+
"@mainsail/contracts": "0.0.1-evm.2",
|
17
|
+
"@mainsail/container": "0.0.1-evm.2"
|
17
18
|
},
|
18
19
|
"devDependencies": {
|
19
20
|
"@types/wif": "^2.0.5",
|
20
21
|
"uvu": "^0.5.6",
|
21
|
-
"@mainsail/crypto-config": "0.0.1-
|
22
|
-
"@mainsail/crypto-key-pair-schnorr": "0.0.1-
|
22
|
+
"@mainsail/crypto-config": "0.0.1-evm.2",
|
23
|
+
"@mainsail/crypto-key-pair-schnorr": "0.0.1-evm.2"
|
23
24
|
},
|
24
25
|
"engines": {
|
25
26
|
"node": ">=20.x"
|
@@ -29,9 +30,10 @@
|
|
29
30
|
"build:watch": "pnpm run clean && tsc -w",
|
30
31
|
"clean": "del distribution",
|
31
32
|
"release": "pnpm publish --access public",
|
32
|
-
"test": "
|
33
|
+
"test": "pnpm run uvu source .test.ts",
|
33
34
|
"test:coverage": "c8 pnpm run test",
|
34
35
|
"test:coverage:html": "c8 -r html --all pnpm run test",
|
35
|
-
"test:file": "
|
36
|
+
"test:file": "pnpm run uvu source",
|
37
|
+
"uvu": "tsx --tsconfig ../../tsconfig.test.json ./node_modules/uvu/bin.js"
|
36
38
|
}
|
37
39
|
}
|