@ledgerhq/vault-cli 1.73.2 → 2.0.0
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/.turbo/turbo-build.log +16 -2
- package/CHANGELOG.md +64 -0
- package/__mocks__/@ledgerhq/vault-common.ts +1 -0
- package/bin/index.js +5615 -15
- package/bin/index.js.map +1 -1
- package/bin/index.mjs +5621 -0
- package/bin/index.mjs.map +1 -0
- package/package.json +6 -7
- package/tsup.config.ts +10 -0
- package/bin/__patchGateOptionsWithEnvVariables.d.ts +0 -4
- package/bin/__patchGateOptionsWithEnvVariables.d.ts.map +0 -1
- package/bin/__patchGateOptionsWithEnvVariables.js +0 -38
- package/bin/__patchGateOptionsWithEnvVariables.js.map +0 -1
- package/bin/__tests__/apdu.test.d.ts +0 -2
- package/bin/__tests__/apdu.test.d.ts.map +0 -1
- package/bin/__tests__/apdu.test.js +0 -33
- package/bin/__tests__/apdu.test.js.map +0 -1
- package/bin/__tests__/approve.test.d.ts +0 -2
- package/bin/__tests__/approve.test.d.ts.map +0 -1
- package/bin/__tests__/approve.test.js +0 -159
- package/bin/__tests__/approve.test.js.map +0 -1
- package/bin/__tests__/backupCompartment.test.d.ts +0 -2
- package/bin/__tests__/backupCompartment.test.d.ts.map +0 -1
- package/bin/__tests__/backupCompartment.test.js +0 -88
- package/bin/__tests__/backupCompartment.test.js.map +0 -1
- package/bin/__tests__/bake.test.d.ts +0 -2
- package/bin/__tests__/bake.test.d.ts.map +0 -1
- package/bin/__tests__/bake.test.js +0 -175
- package/bin/__tests__/bake.test.js.map +0 -1
- package/bin/__tests__/cli.test.d.ts +0 -2
- package/bin/__tests__/cli.test.d.ts.map +0 -1
- package/bin/__tests__/cli.test.js +0 -222
- package/bin/__tests__/cli.test.js.map +0 -1
- package/bin/__tests__/configcat.test.d.ts +0 -2
- package/bin/__tests__/configcat.test.d.ts.map +0 -1
- package/bin/__tests__/configcat.test.js +0 -100
- package/bin/__tests__/configcat.test.js.map +0 -1
- package/bin/__tests__/create.test.d.ts +0 -2
- package/bin/__tests__/create.test.d.ts.map +0 -1
- package/bin/__tests__/create.test.js +0 -264
- package/bin/__tests__/create.test.js.map +0 -1
- package/bin/__tests__/deploy.test.d.ts +0 -2
- package/bin/__tests__/deploy.test.d.ts.map +0 -1
- package/bin/__tests__/deploy.test.js +0 -95
- package/bin/__tests__/deploy.test.js.map +0 -1
- package/bin/__tests__/destroy.test.d.ts +0 -2
- package/bin/__tests__/destroy.test.d.ts.map +0 -1
- package/bin/__tests__/destroy.test.js +0 -44
- package/bin/__tests__/destroy.test.js.map +0 -1
- package/bin/__tests__/drain.test.d.ts +0 -2
- package/bin/__tests__/drain.test.d.ts.map +0 -1
- package/bin/__tests__/drain.test.js +0 -35
- package/bin/__tests__/drain.test.js.map +0 -1
- package/bin/__tests__/faucet.test.d.ts +0 -2
- package/bin/__tests__/faucet.test.d.ts.map +0 -1
- package/bin/__tests__/faucet.test.js +0 -31
- package/bin/__tests__/faucet.test.js.map +0 -1
- package/bin/__tests__/fetch.test.d.ts +0 -2
- package/bin/__tests__/fetch.test.d.ts.map +0 -1
- package/bin/__tests__/fetch.test.js +0 -54
- package/bin/__tests__/fetch.test.js.map +0 -1
- package/bin/__tests__/genKeys.test.d.ts +0 -2
- package/bin/__tests__/genKeys.test.d.ts.map +0 -1
- package/bin/__tests__/genKeys.test.js +0 -17
- package/bin/__tests__/genKeys.test.js.map +0 -1
- package/bin/__tests__/get.test.d.ts +0 -2
- package/bin/__tests__/get.test.d.ts.map +0 -1
- package/bin/__tests__/get.test.js +0 -133
- package/bin/__tests__/get.test.js.map +0 -1
- package/bin/__tests__/getAPIUserTokens.test.d.ts +0 -2
- package/bin/__tests__/getAPIUserTokens.test.d.ts.map +0 -1
- package/bin/__tests__/getAPIUserTokens.test.js +0 -69
- package/bin/__tests__/getAPIUserTokens.test.js.map +0 -1
- package/bin/__tests__/getAuthToken.test.d.ts +0 -2
- package/bin/__tests__/getAuthToken.test.d.ts.map +0 -1
- package/bin/__tests__/getAuthToken.test.js +0 -31
- package/bin/__tests__/getAuthToken.test.js.map +0 -1
- package/bin/__tests__/getCertFromPFX.test.d.ts +0 -2
- package/bin/__tests__/getCertFromPFX.test.d.ts.map +0 -1
- package/bin/__tests__/getCertFromPFX.test.js +0 -54
- package/bin/__tests__/getCertFromPFX.test.js.map +0 -1
- package/bin/__tests__/getMVInstances.test.d.ts +0 -2
- package/bin/__tests__/getMVInstances.test.d.ts.map +0 -1
- package/bin/__tests__/getMVInstances.test.js +0 -72
- package/bin/__tests__/getMVInstances.test.js.map +0 -1
- package/bin/__tests__/getSeeds.test.d.ts +0 -2
- package/bin/__tests__/getSeeds.test.d.ts.map +0 -1
- package/bin/__tests__/getSeeds.test.js +0 -20
- package/bin/__tests__/getSeeds.test.js.map +0 -1
- package/bin/__tests__/getUserID.test.d.ts +0 -2
- package/bin/__tests__/getUserID.test.d.ts.map +0 -1
- package/bin/__tests__/getUserID.test.js +0 -31
- package/bin/__tests__/getUserID.test.js.map +0 -1
- package/bin/__tests__/initCompartment.test.d.ts +0 -2
- package/bin/__tests__/initCompartment.test.d.ts.map +0 -1
- package/bin/__tests__/initCompartment.test.js +0 -86
- package/bin/__tests__/initCompartment.test.js.map +0 -1
- package/bin/__tests__/onboard.test.d.ts +0 -2
- package/bin/__tests__/onboard.test.d.ts.map +0 -1
- package/bin/__tests__/onboard.test.js +0 -63
- package/bin/__tests__/onboard.test.js.map +0 -1
- package/bin/__tests__/pathGateOptionsWithEnvVariables.test.d.ts +0 -2
- package/bin/__tests__/pathGateOptionsWithEnvVariables.test.d.ts.map +0 -1
- package/bin/__tests__/pathGateOptionsWithEnvVariables.test.js +0 -34
- package/bin/__tests__/pathGateOptionsWithEnvVariables.test.js.map +0 -1
- package/bin/__tests__/pledge.test.d.ts +0 -2
- package/bin/__tests__/pledge.test.d.ts.map +0 -1
- package/bin/__tests__/pledge.test.js +0 -110
- package/bin/__tests__/pledge.test.js.map +0 -1
- package/bin/__tests__/proxy.test.d.ts +0 -2
- package/bin/__tests__/proxy.test.d.ts.map +0 -1
- package/bin/__tests__/proxy.test.js +0 -22
- package/bin/__tests__/proxy.test.js.map +0 -1
- package/bin/__tests__/receive.test.d.ts +0 -2
- package/bin/__tests__/receive.test.d.ts.map +0 -1
- package/bin/__tests__/receive.test.js +0 -85
- package/bin/__tests__/receive.test.js.map +0 -1
- package/bin/__tests__/recipe.test.d.ts +0 -2
- package/bin/__tests__/recipe.test.d.ts.map +0 -1
- package/bin/__tests__/recipe.test.js +0 -41
- package/bin/__tests__/recipe.test.js.map +0 -1
- package/bin/__tests__/reject.test.d.ts +0 -2
- package/bin/__tests__/reject.test.d.ts.map +0 -1
- package/bin/__tests__/reject.test.js +0 -214
- package/bin/__tests__/reject.test.js.map +0 -1
- package/bin/__tests__/resetCompartment.test.d.ts +0 -2
- package/bin/__tests__/resetCompartment.test.d.ts.map +0 -1
- package/bin/__tests__/resetCompartment.test.js +0 -88
- package/bin/__tests__/resetCompartment.test.js.map +0 -1
- package/bin/__tests__/restoreCompartment.test.d.ts +0 -2
- package/bin/__tests__/restoreCompartment.test.d.ts.map +0 -1
- package/bin/__tests__/restoreCompartment.test.js +0 -95
- package/bin/__tests__/restoreCompartment.test.js.map +0 -1
- package/bin/__tests__/revoke.test.d.ts +0 -2
- package/bin/__tests__/revoke.test.d.ts.map +0 -1
- package/bin/__tests__/revoke.test.js +0 -62
- package/bin/__tests__/revoke.test.js.map +0 -1
- package/bin/__tests__/send.test.d.ts +0 -2
- package/bin/__tests__/send.test.d.ts.map +0 -1
- package/bin/__tests__/send.test.js +0 -216
- package/bin/__tests__/send.test.js.map +0 -1
- package/bin/__tests__/setQuorum.test.d.ts +0 -2
- package/bin/__tests__/setQuorum.test.d.ts.map +0 -1
- package/bin/__tests__/setQuorum.test.js +0 -32
- package/bin/__tests__/setQuorum.test.js.map +0 -1
- package/bin/__tests__/settle.test.d.ts +0 -2
- package/bin/__tests__/settle.test.d.ts.map +0 -1
- package/bin/__tests__/settle.test.js +0 -123
- package/bin/__tests__/settle.test.js.map +0 -1
- package/bin/__tests__/test-utils.d.ts +0 -19
- package/bin/__tests__/test-utils.d.ts.map +0 -1
- package/bin/__tests__/test-utils.js +0 -39
- package/bin/__tests__/test-utils.js.map +0 -1
- package/bin/__tests__/upgrade.test.d.ts +0 -2
- package/bin/__tests__/upgrade.test.d.ts.map +0 -1
- package/bin/__tests__/upgrade.test.js +0 -57
- package/bin/__tests__/upgrade.test.js.map +0 -1
- package/bin/__tests__/utils.test.d.ts +0 -2
- package/bin/__tests__/utils.test.d.ts.map +0 -1
- package/bin/__tests__/utils.test.js +0 -40
- package/bin/__tests__/utils.test.js.map +0 -1
- package/bin/__tests__/wipe.test.d.ts +0 -2
- package/bin/__tests__/wipe.test.d.ts.map +0 -1
- package/bin/__tests__/wipe.test.js +0 -92
- package/bin/__tests__/wipe.test.js.map +0 -1
- package/bin/cli.d.ts +0 -4
- package/bin/cli.d.ts.map +0 -1
- package/bin/cli.js +0 -152
- package/bin/cli.js.map +0 -1
- package/bin/cliOptions.d.ts +0 -8
- package/bin/cliOptions.d.ts.map +0 -1
- package/bin/cliOptions.js +0 -11
- package/bin/cliOptions.js.map +0 -1
- package/bin/commands/apdu.d.ts +0 -14
- package/bin/commands/apdu.d.ts.map +0 -1
- package/bin/commands/apdu.js +0 -35
- package/bin/commands/apdu.js.map +0 -1
- package/bin/commands/approve.d.ts +0 -34
- package/bin/commands/approve.d.ts.map +0 -1
- package/bin/commands/approve.js +0 -150
- package/bin/commands/approve.js.map +0 -1
- package/bin/commands/backupCompartment.d.ts +0 -31
- package/bin/commands/backupCompartment.d.ts.map +0 -1
- package/bin/commands/backupCompartment.js +0 -70
- package/bin/commands/backupCompartment.js.map +0 -1
- package/bin/commands/bake.d.ts +0 -73
- package/bin/commands/bake.d.ts.map +0 -1
- package/bin/commands/bake.js +0 -232
- package/bin/commands/bake.js.map +0 -1
- package/bin/commands/bridge.d.ts +0 -22
- package/bin/commands/bridge.d.ts.map +0 -1
- package/bin/commands/bridge.js +0 -137
- package/bin/commands/bridge.js.map +0 -1
- package/bin/commands/configcat.d.ts +0 -78
- package/bin/commands/configcat.d.ts.map +0 -1
- package/bin/commands/configcat.js +0 -208
- package/bin/commands/configcat.js.map +0 -1
- package/bin/commands/create.d.ts +0 -207
- package/bin/commands/create.d.ts.map +0 -1
- package/bin/commands/create.js +0 -554
- package/bin/commands/create.js.map +0 -1
- package/bin/commands/deploy.d.ts +0 -60
- package/bin/commands/deploy.d.ts.map +0 -1
- package/bin/commands/deploy.js +0 -106
- package/bin/commands/deploy.js.map +0 -1
- package/bin/commands/destroy.d.ts +0 -36
- package/bin/commands/destroy.d.ts.map +0 -1
- package/bin/commands/destroy.js +0 -58
- package/bin/commands/destroy.js.map +0 -1
- package/bin/commands/drain.d.ts +0 -26
- package/bin/commands/drain.d.ts.map +0 -1
- package/bin/commands/drain.js +0 -64
- package/bin/commands/drain.js.map +0 -1
- package/bin/commands/faucet.d.ts +0 -31
- package/bin/commands/faucet.d.ts.map +0 -1
- package/bin/commands/faucet.js +0 -68
- package/bin/commands/faucet.js.map +0 -1
- package/bin/commands/fetch.d.ts +0 -35
- package/bin/commands/fetch.d.ts.map +0 -1
- package/bin/commands/fetch.js +0 -83
- package/bin/commands/fetch.js.map +0 -1
- package/bin/commands/genKeys.d.ts +0 -14
- package/bin/commands/genKeys.d.ts.map +0 -1
- package/bin/commands/genKeys.js +0 -19
- package/bin/commands/genKeys.js.map +0 -1
- package/bin/commands/get.d.ts +0 -56
- package/bin/commands/get.d.ts.map +0 -1
- package/bin/commands/get.js +0 -211
- package/bin/commands/get.js.map +0 -1
- package/bin/commands/getAPIUserTokens.d.ts +0 -39
- package/bin/commands/getAPIUserTokens.d.ts.map +0 -1
- package/bin/commands/getAPIUserTokens.js +0 -63
- package/bin/commands/getAPIUserTokens.js.map +0 -1
- package/bin/commands/getAuthToken.d.ts +0 -26
- package/bin/commands/getAuthToken.d.ts.map +0 -1
- package/bin/commands/getAuthToken.js +0 -42
- package/bin/commands/getAuthToken.js.map +0 -1
- package/bin/commands/getMVInstances.d.ts +0 -33
- package/bin/commands/getMVInstances.d.ts.map +0 -1
- package/bin/commands/getMVInstances.js +0 -71
- package/bin/commands/getMVInstances.js.map +0 -1
- package/bin/commands/getSeeds.d.ts +0 -19
- package/bin/commands/getSeeds.d.ts.map +0 -1
- package/bin/commands/getSeeds.js +0 -95
- package/bin/commands/getSeeds.js.map +0 -1
- package/bin/commands/getUserID.d.ts +0 -27
- package/bin/commands/getUserID.d.ts.map +0 -1
- package/bin/commands/getUserID.js +0 -32
- package/bin/commands/getUserID.js.map +0 -1
- package/bin/commands/index.d.ts +0 -892
- package/bin/commands/index.d.ts.map +0 -1
- package/bin/commands/index.js +0 -111
- package/bin/commands/index.js.map +0 -1
- package/bin/commands/initCompartment.d.ts +0 -22
- package/bin/commands/initCompartment.d.ts.map +0 -1
- package/bin/commands/initCompartment.js +0 -62
- package/bin/commands/initCompartment.js.map +0 -1
- package/bin/commands/listen.d.ts +0 -31
- package/bin/commands/listen.d.ts.map +0 -1
- package/bin/commands/listen.js +0 -56
- package/bin/commands/listen.js.map +0 -1
- package/bin/commands/onboard.d.ts +0 -30
- package/bin/commands/onboard.d.ts.map +0 -1
- package/bin/commands/onboard.js +0 -68
- package/bin/commands/onboard.js.map +0 -1
- package/bin/commands/pledge.d.ts +0 -38
- package/bin/commands/pledge.d.ts.map +0 -1
- package/bin/commands/pledge.js +0 -89
- package/bin/commands/pledge.js.map +0 -1
- package/bin/commands/proxy.d.ts +0 -17
- package/bin/commands/proxy.d.ts.map +0 -1
- package/bin/commands/proxy.js +0 -227
- package/bin/commands/proxy.js.map +0 -1
- package/bin/commands/receive.d.ts +0 -40
- package/bin/commands/receive.d.ts.map +0 -1
- package/bin/commands/receive.js +0 -60
- package/bin/commands/receive.js.map +0 -1
- package/bin/commands/recipe.d.ts +0 -29
- package/bin/commands/recipe.d.ts.map +0 -1
- package/bin/commands/recipe.js +0 -62
- package/bin/commands/recipe.js.map +0 -1
- package/bin/commands/reject.d.ts +0 -49
- package/bin/commands/reject.d.ts.map +0 -1
- package/bin/commands/reject.js +0 -176
- package/bin/commands/reject.js.map +0 -1
- package/bin/commands/resetCompartment.d.ts +0 -31
- package/bin/commands/resetCompartment.d.ts.map +0 -1
- package/bin/commands/resetCompartment.js +0 -71
- package/bin/commands/resetCompartment.js.map +0 -1
- package/bin/commands/restoreCompartment.d.ts +0 -39
- package/bin/commands/restoreCompartment.d.ts.map +0 -1
- package/bin/commands/restoreCompartment.js +0 -80
- package/bin/commands/restoreCompartment.js.map +0 -1
- package/bin/commands/revoke.d.ts +0 -40
- package/bin/commands/revoke.d.ts.map +0 -1
- package/bin/commands/revoke.js +0 -80
- package/bin/commands/revoke.js.map +0 -1
- package/bin/commands/send.d.ts +0 -54
- package/bin/commands/send.d.ts.map +0 -1
- package/bin/commands/send.js +0 -170
- package/bin/commands/send.js.map +0 -1
- package/bin/commands/setQuorum.d.ts +0 -30
- package/bin/commands/setQuorum.d.ts.map +0 -1
- package/bin/commands/setQuorum.js +0 -44
- package/bin/commands/setQuorum.js.map +0 -1
- package/bin/commands/settle.d.ts +0 -43
- package/bin/commands/settle.d.ts.map +0 -1
- package/bin/commands/settle.js +0 -92
- package/bin/commands/settle.js.map +0 -1
- package/bin/commands/upgrade.d.ts +0 -44
- package/bin/commands/upgrade.d.ts.map +0 -1
- package/bin/commands/upgrade.js +0 -68
- package/bin/commands/upgrade.js.map +0 -1
- package/bin/commands/wipe.d.ts +0 -77
- package/bin/commands/wipe.d.ts.map +0 -1
- package/bin/commands/wipe.js +0 -86
- package/bin/commands/wipe.js.map +0 -1
- package/bin/deviceOption.d.ts +0 -9
- package/bin/deviceOption.d.ts.map +0 -1
- package/bin/deviceOption.js +0 -10
- package/bin/deviceOption.js.map +0 -1
- package/bin/gateOptions.d.ts +0 -39
- package/bin/gateOptions.d.ts.map +0 -1
- package/bin/gateOptions.js +0 -73
- package/bin/gateOptions.js.map +0 -1
- package/bin/getCertFromPFX.d.ts +0 -7
- package/bin/getCertFromPFX.d.ts.map +0 -1
- package/bin/getCertFromPFX.js +0 -43
- package/bin/getCertFromPFX.js.map +0 -1
- package/bin/index.d.ts +0 -3
- package/bin/index.d.ts.map +0 -1
- package/bin/lamOptions.d.ts +0 -15
- package/bin/lamOptions.d.ts.map +0 -1
- package/bin/lamOptions.js +0 -17
- package/bin/lamOptions.js.map +0 -1
- package/bin/logger.d.ts +0 -3
- package/bin/logger.d.ts.map +0 -1
- package/bin/logger.js +0 -5
- package/bin/logger.js.map +0 -1
- package/bin/manifests/beatles.json +0 -46
- package/bin/manifests/empty.json +0 -1
- package/bin/manifests/erc20.json +0 -32
- package/bin/manifests/message-signing.json +0 -36
- package/bin/manifests/mobile.json +0 -43
- package/bin/manifests/polkadot-staking.json +0 -152
- package/bin/manifests/polkadot.json +0 -37
- package/bin/manifests/rawsigning.json +0 -39
- package/bin/manifests/ripple.json +0 -37
- package/bin/manifests/sci.json +0 -146
- package/bin/manifests/solana-dev.json +0 -99
- package/bin/manifests/solana-staking.json +0 -44
- package/bin/manifests/solana.json +0 -30
- package/bin/manifests/stellar.json +0 -37
- package/bin/manifests/tezos.json +0 -51
- package/bin/manifests/tradelink-hsm.json +0 -429
- package/bin/manifests/tradelink.json +0 -361
- package/bin/miscOptions.d.ts +0 -20
- package/bin/miscOptions.d.ts.map +0 -1
- package/bin/miscOptions.js +0 -17
- package/bin/miscOptions.js.map +0 -1
- package/bin/registerTransports.d.ts +0 -2
- package/bin/registerTransports.d.ts.map +0 -1
- package/bin/registerTransports.js +0 -18
- package/bin/registerTransports.js.map +0 -1
- package/bin/types.d.ts +0 -23
- package/bin/types.d.ts.map +0 -1
- package/bin/types.js +0 -3
- package/bin/types.js.map +0 -1
- package/bin/utils.d.ts +0 -22
- package/bin/utils.d.ts.map +0 -1
- package/bin/utils.js +0 -156
- package/bin/utils.js.map +0 -1
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const getAuthToken_1 = __importDefault(require("../commands/getAuthToken"));
|
|
16
|
-
const test_utils_1 = require("./test-utils");
|
|
17
|
-
const opts = {
|
|
18
|
-
gate: "<gate>",
|
|
19
|
-
apiGateway: "<apigw>",
|
|
20
|
-
salt: "",
|
|
21
|
-
device: 4,
|
|
22
|
-
};
|
|
23
|
-
describe("getAuthToken", () => {
|
|
24
|
-
it("should call login() from devices pool", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
console.log = jest.fn();
|
|
26
|
-
const pool = (0, test_utils_1.createTestDevicesPool)();
|
|
27
|
-
yield getAuthToken_1.default.run(opts);
|
|
28
|
-
expect(pool.login).toHaveBeenCalledWith(opts.device);
|
|
29
|
-
}));
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=getAuthToken.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAuthToken.test.js","sourceRoot":"","sources":["../../src/__tests__/getAuthToken.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4EAAoD;AAEpD,6CAAqD;AAErD,MAAM,IAAI,GAAwB;IAChC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,uCAAuC,EAAE,GAAS,EAAE;QAErD,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,IAAA,kCAAqB,GAAE,CAAC;QACrC,MAAM,sBAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCertFromPFX.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/getCertFromPFX.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const fs_1 = __importDefault(require("fs"));
|
|
16
|
-
const pem_1 = __importDefault(require("pem"));
|
|
17
|
-
const getCertFromPFX_1 = __importDefault(require("../getCertFromPFX"));
|
|
18
|
-
describe("getCertFromPFX", () => {
|
|
19
|
-
it("should get cert from pfx file", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
jest.useFakeTimers();
|
|
21
|
-
jest.spyOn(fs_1.default, "readFileSync").mockReturnValue(Buffer.from("abcde"));
|
|
22
|
-
let cb = null;
|
|
23
|
-
const readPkcs12Spy = jest.spyOn(pem_1.default, "readPkcs12").mockImplementation((_bufferOrPath, _options, callback) => {
|
|
24
|
-
cb = callback;
|
|
25
|
-
});
|
|
26
|
-
const promise = (0, getCertFromPFX_1.default)("/my/awesome/path.pfx", "lorem-ipsum");
|
|
27
|
-
jest.advanceTimersByTime(500);
|
|
28
|
-
yield Promise.resolve();
|
|
29
|
-
yield Promise.resolve();
|
|
30
|
-
cb(null, { key: "key", cert: "cert", ca: [] });
|
|
31
|
-
yield promise;
|
|
32
|
-
expect(readPkcs12Spy).toHaveBeenCalledWith(Buffer.from("abcde"), { p12Password: "lorem-ipsum" }, expect.any(Function));
|
|
33
|
-
}));
|
|
34
|
-
it("should throw if there is an error decoding the cert", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
-
jest.useFakeTimers();
|
|
36
|
-
jest.spyOn(fs_1.default, "readFileSync").mockReturnValue(Buffer.from("abcde"));
|
|
37
|
-
let cb = null;
|
|
38
|
-
jest.spyOn(pem_1.default, "readPkcs12").mockImplementation((_bufferOrPath, _options, callback) => {
|
|
39
|
-
cb = callback;
|
|
40
|
-
});
|
|
41
|
-
const promise = (0, getCertFromPFX_1.default)("/my/awesome/path.pfx", "lorem-ipsum");
|
|
42
|
-
jest.advanceTimersByTime(500);
|
|
43
|
-
yield Promise.resolve();
|
|
44
|
-
yield Promise.resolve();
|
|
45
|
-
cb(new Error("hola que tal"), {});
|
|
46
|
-
try {
|
|
47
|
-
yield promise;
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
expect(e).toEqual(new Error("hola que tal"));
|
|
51
|
-
}
|
|
52
|
-
}));
|
|
53
|
-
});
|
|
54
|
-
//# sourceMappingURL=getCertFromPFX.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCertFromPFX.test.js","sourceRoot":"","sources":["../../src/__tests__/getCertFromPFX.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,8CAAyE;AAEzE,uEAA+C;AAE/C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,+BAA+B,EAAE,GAAS,EAAE;QAC7C,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,IAAI,CAAC,KAAK,CAAC,YAAE,EAAE,cAAc,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAErE,IAAI,EAAE,GAAsC,IAAI,CAAC;QACjD,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,aAAG,EAAE,YAAY,CAAC,CAAC,kBAAkB,CAEpE,CACE,aAA8B,EAC9B,QAA2B,EAC3B,QAAoC,EACpC,EAAE;YACF,EAAE,GAAG,QAAQ,CAAC;QAChB,CAAC,CACF,CAAC;QACF,MAAM,OAAO,GAAG,IAAA,wBAAc,EAAC,sBAAsB,EAAE,aAAa,CAAC,CAAC;QACtE,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAG9B,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QAExB,EAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QAChD,MAAM,OAAO,CAAC;QAEd,MA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appings":""}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
const vaultCommon = __importStar(require("@ledgerhq/vault-common"));
|
|
36
|
-
const getMVInstances_1 = require("../commands/getMVInstances");
|
|
37
|
-
describe("getMVInstances", () => {
|
|
38
|
-
beforeEach(() => {
|
|
39
|
-
jest.spyOn(console, "log").mockImplementation();
|
|
40
|
-
});
|
|
41
|
-
afterEach(() => {
|
|
42
|
-
jest.restoreAllMocks();
|
|
43
|
-
});
|
|
44
|
-
it("should call getMVInstances and display a table", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
const spyCommon = jest.spyOn(vaultCommon, "getMVInstances").mockResolvedValue([
|
|
46
|
-
{
|
|
47
|
-
name: "instance1",
|
|
48
|
-
status: "HEALTHY",
|
|
49
|
-
pods: [],
|
|
50
|
-
host: "minivault.ledger-sbx.com",
|
|
51
|
-
},
|
|
52
|
-
]);
|
|
53
|
-
yield (0, getMVInstances_1.getMVInstancesCommand)({
|
|
54
|
-
remoteURL: "abc",
|
|
55
|
-
format: "table",
|
|
56
|
-
});
|
|
57
|
-
expect(spyCommon).toHaveBeenCalledWith({ remoteURL: "abc" }, expect.anything());
|
|
58
|
-
}));
|
|
59
|
-
it("should call getMVInstances", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
const spyCommon = jest
|
|
61
|
-
.spyOn(vaultCommon, "getMVInstances")
|
|
62
|
-
.mockResolvedValue([
|
|
63
|
-
{ name: "instance1", status: "HEALTHY", pods: [], host: "minivault.ledger-sbx.com" },
|
|
64
|
-
]);
|
|
65
|
-
yield (0, getMVInstances_1.getMVInstancesCommand)({
|
|
66
|
-
remoteURL: "abc",
|
|
67
|
-
format: "json",
|
|
68
|
-
});
|
|
69
|
-
expect(spyCommon).toHaveBeenCalledWith({ remoteURL: "abc" }, expect.anything());
|
|
70
|
-
}));
|
|
71
|
-
});
|
|
72
|
-
//# sourceMappingURL=getMVInstances.test.js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EAAE;SACrF,CAAC,CAAC;QAEL,MAAM,IAAA,sCAAqB,EAAC;YAC1B,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QACH,MAAM,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSeeds.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/getSeeds.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const vault_common_1 = require("@ledgerhq/vault-common");
|
|
7
|
-
const getSeeds_1 = __importDefault(require("../commands/getSeeds"));
|
|
8
|
-
const opts = {
|
|
9
|
-
salt: "",
|
|
10
|
-
};
|
|
11
|
-
describe("getSeeds", () => {
|
|
12
|
-
it("should", () => {
|
|
13
|
-
console.log = jest.fn();
|
|
14
|
-
getSeeds_1.default.run(opts);
|
|
15
|
-
for (let i = 0; i < 16; i++) {
|
|
16
|
-
expect(vault_common_1.genSeed).toHaveBeenCalledWith(opts.salt, i + 1);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=getSeeds.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSeeds.test.js","sourceRoot":"","sources":["../../src/__tests__/getSeeds.test.ts"],"names":[],"mappings":";;;;;AAAA,yDAAiD;AAEjD,oEAA4C;AAE5C,MAAM,IAAI,GAAG;IACX,IAAI,EAAE,EAAE;CACT,CAAC;AAEF,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QAEhB,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACxB,kBAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;YAC3B,MAAM,CAAC,sBAAO,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;SACxD;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getUserID.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/getUserID.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const getUserID_1 = __importDefault(require("../commands/getUserID"));
|
|
16
|
-
const test_utils_1 = require("./test-utils");
|
|
17
|
-
const opts = {
|
|
18
|
-
gate: "<gate>",
|
|
19
|
-
apiGateway: "<apigw>",
|
|
20
|
-
salt: "",
|
|
21
|
-
device: 4,
|
|
22
|
-
};
|
|
23
|
-
describe("getUserID", () => {
|
|
24
|
-
it("should call getUserID() from devices pool", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
console.log = jest.fn();
|
|
26
|
-
const pool = (0, test_utils_1.createTestDevicesPool)();
|
|
27
|
-
yield getUserID_1.default.run(opts);
|
|
28
|
-
expect(pool.getUserID).toHaveBeenCalledWith(opts.device);
|
|
29
|
-
}));
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=getUserID.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getUserID.test.js","sourceRoot":"","sources":["../../src/__tests__/getUserID.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sEAA8C;AAE9C,6CAAqD;AAErD,MAAM,IAAI,GAAqB;IAC7B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,2CAA2C,EAAE,GAAS,EAAE;QAEzD,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,IAAA,kCAAqB,GAAE,CAAC;QACrC,MAAM,mBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initCompartment.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/initCompartment.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const createHSMBridge = __importStar(require("@ledgerhq/vault-common/lib/createHSMBridge"));
|
|
39
|
-
const initCompartment_1 = __importDefault(require("../commands/initCompartment"));
|
|
40
|
-
const getCertFromPFX = __importStar(require("../getCertFromPFX"));
|
|
41
|
-
describe("initCompartment", () => {
|
|
42
|
-
beforeEach(() => {
|
|
43
|
-
jest.spyOn(console, "log").mockImplementation();
|
|
44
|
-
jest.spyOn(getCertFromPFX, "default").mockResolvedValue({
|
|
45
|
-
cert: Buffer.from("abcde"),
|
|
46
|
-
key: Buffer.from("12345"),
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
afterEach(() => {
|
|
50
|
-
jest.restoreAllMocks();
|
|
51
|
-
});
|
|
52
|
-
it("should throw if no HSM cert given", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
let err;
|
|
54
|
-
try {
|
|
55
|
-
yield initCompartment_1.default.run({
|
|
56
|
-
hsm: "<hsm>",
|
|
57
|
-
hsmCert: undefined,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
err = e;
|
|
62
|
-
}
|
|
63
|
-
expect(err).toEqual(new Error("You must specify the path to your HSM certificate in your environment variable VAULT_HSM_CLIENT_CERT_PATH or use the --hsmCert flag"));
|
|
64
|
-
}));
|
|
65
|
-
it("should init a compartment", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
-
const fakeBridge = {
|
|
67
|
-
backupCompartment: jest.fn(),
|
|
68
|
-
restoreCompartment: jest.fn(),
|
|
69
|
-
resetCompartment: jest.fn(),
|
|
70
|
-
initCompartment: jest.fn(),
|
|
71
|
-
};
|
|
72
|
-
const createHSMBridgeSpy = jest.spyOn(createHSMBridge, "default").mockReturnValue(fakeBridge);
|
|
73
|
-
yield initCompartment_1.default.run({
|
|
74
|
-
hsm: "<hsm>",
|
|
75
|
-
hsmCert: "abcde",
|
|
76
|
-
hsmCertPassword: "1234",
|
|
77
|
-
});
|
|
78
|
-
expect(createHSMBridgeSpy).toHaveBeenCalledWith({
|
|
79
|
-
hsmCert: Buffer.from("abcde"),
|
|
80
|
-
hsmCertKey: Buffer.from("12345"),
|
|
81
|
-
hsmEndpoint: "<hsm>",
|
|
82
|
-
});
|
|
83
|
-
expect(fakeBridge.initCompartment).toHaveBeenCalledWith(expect.any(Object));
|
|
84
|
-
}));
|
|
85
|
-
});
|
|
86
|
-
//# sourceMappingURL=initCompartment.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initCompartment.test.js","sourceRoot":"","sources":["../../src/__tests__/initCompartment.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4FAA8E;AAE9E,kFAA0D;AAC1D,kEAAoD;AAEpD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAChD,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC,iBAAiB,CAAC;YACtD,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YAC1B,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAS,EAAE;QACjD,IAAI,GAAG,CAAC;QACR,IAAI;Y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":["../../src/__tests__/onboard.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const vault_common_1 = require("@ledgerhq/vault-common");
|
|
39
|
-
const onboard_1 = __importStar(require("../commands/onboard"));
|
|
40
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
41
|
-
const test_utils_1 = require("./test-utils");
|
|
42
|
-
const onboardOpts = {
|
|
43
|
-
gate: "<gate>",
|
|
44
|
-
apiGateway: "<apigw>",
|
|
45
|
-
salt: "",
|
|
46
|
-
};
|
|
47
|
-
describe("onboard", () => {
|
|
48
|
-
it("should onboard", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
const pool = (0, test_utils_1.createTestDevicesPool)();
|
|
50
|
-
yield onboard_1.default.run(Object.assign(Object.assign({}, onboardOpts), { untilStep: "ADMIN_APPROVALS" }));
|
|
51
|
-
expect(vault_common_1.bakeManifest).toHaveBeenCalledWith({}, pool, {
|
|
52
|
-
logger: logger_1.default,
|
|
53
|
-
untilStep: "ADMIN_APPROVALS",
|
|
54
|
-
});
|
|
55
|
-
}));
|
|
56
|
-
(0, test_utils_1.testErrorCommand)({
|
|
57
|
-
description: "should throw if an unknown step is passed",
|
|
58
|
-
task: onboard_1.default.run,
|
|
59
|
-
options: Object.assign(Object.assign({}, onboardOpts), { untilStep: "UNKNOWN_STEP" }),
|
|
60
|
-
errorMessage: `UNKNOWN_STEP is not a valid step, must be one of: ${onboard_1.OnboardingSteps.join(", ")}`,
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
//# sourceMappingURL=onboard.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onboard.test.js","sourceRoot":"","sources":["../../src/__tests__/onboard.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAsD;AAEtD,+DAA+D;AAE/D,uDAA+B;AAC/B,6CAAuE;AAEvE,MAAM,WAAW,GAAmB;IAClC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE,EAAE;CACT,CAAC;AAEF,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,gBAAgB,EAAE,GAAS,EAAE;QAC9B,MAAM,IAAI,GAAG,IAAA,kCAAqB,GAAE,CAAC;QACrC,MAAM,iBAAO,CAAC,GAAG,iCAAM,WAAW,KAAE,SAAS,EAAE,iBAAiB,IAAG,CAAC;QACpE,MAAM,CAAC,2BAAY,CAAC,CAAC,oBAAoB,CAAC,EAAE,EAAE,IAAI,EAAE;YAClD,MAAM,EAAN,gBAAM;YACN,SAAS,EAAE,iBAAiB;SAC7B,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CAAC;IAEH,IAAA,6BAAgB,EAAC;QACf,WAAW,EAAE,2CAA2C;QACxD,IAAI,EAAE,iBAAO,CAAC,GAAG;QAEjB,OAAO,kCAAO,WAAW,KAAE,SAAS,EAAE,cAAc,GAAE;QACtD,YAAY,EAAE,qDAAqD,yBAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KAChG,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pathGateOptionsWithEnvVariables.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/pathGateOptionsWithEnvVariables.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const __patchGateOptionsWithEnvVariables_1 = __importDefault(require("../__patchGateOptionsWithEnvVariables"));
|
|
7
|
-
const opts = {
|
|
8
|
-
gate: "<gate>",
|
|
9
|
-
apiGateway: "<apigw>",
|
|
10
|
-
salt: "",
|
|
11
|
-
};
|
|
12
|
-
jest.mock("chalk", () => ({
|
|
13
|
-
bold: jest.fn().mockImplementation((str) => str),
|
|
14
|
-
info: { bold: jest.fn() },
|
|
15
|
-
}));
|
|
16
|
-
describe("pathGateOptionsWithEnvVariables", () => {
|
|
17
|
-
it("should log that --minivault flag is not needed", () => {
|
|
18
|
-
const spyConsole = jest.spyOn(console, "log").mockImplementation();
|
|
19
|
-
(0, __patchGateOptionsWithEnvVariables_1.default)(Object.assign(Object.assign({}, opts), { minivault: true }));
|
|
20
|
-
expect(spyConsole).toHaveBeenCalledWith("INFO", "The --minivault option is not needed anymore.");
|
|
21
|
-
spyConsole.mockRestore();
|
|
22
|
-
});
|
|
23
|
-
it("should set gate url from --minivaultURL flag", () => {
|
|
24
|
-
const minivaultURL = "https://minivault.com/";
|
|
25
|
-
const newOpts = (0, __patchGateOptionsWithEnvVariables_1.default)(Object.assign(Object.assign({}, opts), { minivaultURL }));
|
|
26
|
-
expect(newOpts.gate).toBe(`${minivaultURL}gate/minivault`);
|
|
27
|
-
});
|
|
28
|
-
it("should load environment variable", () => {
|
|
29
|
-
process.env["VAULT_SALT"] = "VAULT_SALT";
|
|
30
|
-
const newOpts = (0, __patchGateOptionsWithEnvVariables_1.default)(Object.assign({}, opts));
|
|
31
|
-
expect(newOpts).toEqual({ gate: "<gate>", apiGateway: "<apigw>", salt: "VAULT_SALT" });
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=pathGateOptionsWithEnvVariables.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pathGateOptionsWithEnvVariables.test.js","sourceRoot":"","sources":["../../src/__tests__/pathGateOptionsWithEnvVariables.test.ts"],"names":[],"mappings":";;;;;AA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C;QAC7D,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pledge.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/pledge.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const vaultCommon = __importStar(require("@ledgerhq/vault-common"));
|
|
39
|
-
const pledge_1 = __importDefault(require("../commands/pledge"));
|
|
40
|
-
const opts = {
|
|
41
|
-
account: "TL-0001-ETH-OOF-KOM",
|
|
42
|
-
exchange: "Crypto.com",
|
|
43
|
-
amount: "100",
|
|
44
|
-
apiV2User: "Hedy OneOf 10",
|
|
45
|
-
gate: "<gate>",
|
|
46
|
-
apiGateway: "<apigw>",
|
|
47
|
-
salt: "",
|
|
48
|
-
};
|
|
49
|
-
const MOCK_RECIPE = {
|
|
50
|
-
manifest: {},
|
|
51
|
-
rawData: {
|
|
52
|
-
accountsByName: {},
|
|
53
|
-
groupsByName: {},
|
|
54
|
-
whitelistsByName: {},
|
|
55
|
-
pendingUserRequests: [],
|
|
56
|
-
vaultEntitiesByName: {},
|
|
57
|
-
exchangesByName: {},
|
|
58
|
-
policiesByName: {},
|
|
59
|
-
usersWithDevice: [],
|
|
60
|
-
usersWithoutDevice: [],
|
|
61
|
-
tradelinkCustodiansByName: {},
|
|
62
|
-
tradelinkHSMCustodiansByName: {},
|
|
63
|
-
tradelinkExchangesByName: {},
|
|
64
|
-
tradelinkHSMExchangesByName: {},
|
|
65
|
-
tradelinkHSMAssetManagersByName: {},
|
|
66
|
-
tradelinkAssetManagersByName: {},
|
|
67
|
-
tradelinkNetwork: {
|
|
68
|
-
id: "",
|
|
69
|
-
asset_managers: [],
|
|
70
|
-
custodian: {
|
|
71
|
-
code: "",
|
|
72
|
-
id: "",
|
|
73
|
-
logo_url: "",
|
|
74
|
-
name: "",
|
|
75
|
-
},
|
|
76
|
-
exchanges: [],
|
|
77
|
-
},
|
|
78
|
-
tradelinkOnboardingStatus: { status: "NOT_READY" },
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
const FAKE_PLEDGE = {
|
|
82
|
-
id: 0,
|
|
83
|
-
status: "PENDING_APPROVAL",
|
|
84
|
-
};
|
|
85
|
-
describe("pledge", () => {
|
|
86
|
-
beforeEach(() => {
|
|
87
|
-
jest.restoreAllMocks();
|
|
88
|
-
});
|
|
89
|
-
it("should throw if the account is not found in the manifest", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
-
jest.spyOn(vaultCommon, "recipeManifest").mockResolvedValueOnce(Object.assign(Object.assign({}, MOCK_RECIPE), { manifest: { accounts: [{ name: "eth account", currency: "ethereum" }] } }));
|
|
91
|
-
yield expect(pledge_1.default.run(Object.assign(Object.assign({}, opts), { account: "TL-0001-ETH-OOF-KOM" }))).rejects.toThrowError("Account 'TL-0001-ETH-OOF-KOM' not found");
|
|
92
|
-
}));
|
|
93
|
-
it("should throw if --apiV2User is not in the apiUsers.json file", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
-
jest.spyOn(vaultCommon, "recipeManifest").mockResolvedValueOnce(Object.assign(Object.assign({}, MOCK_RECIPE), { manifest: { accounts: [{ name: "TL-0001-ETH-OOF-KOM", currency: "ethereum" }] } }));
|
|
95
|
-
yield expect(pledge_1.default.run(Object.assign(Object.assign({}, opts), { apiV2User: "Drako" }))).rejects.toThrowError("No API V2 user found for Drako");
|
|
96
|
-
}));
|
|
97
|
-
it("should pledge data", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
-
jest.spyOn(vaultCommon, "recipeManifest").mockResolvedValueOnce(Object.assign(Object.assign({}, MOCK_RECIPE), { manifest: {
|
|
99
|
-
accounts: [{ name: "TL-0001-ETH-OOF-KOM", currency: "ethereum" }],
|
|
100
|
-
users: {
|
|
101
|
-
apiV2: [{ name: "Hedy OneOf 10", role: "OPERATOR" }],
|
|
102
|
-
},
|
|
103
|
-
} }));
|
|
104
|
-
const spyConsole = jest.spyOn(console, "log").mockImplementation();
|
|
105
|
-
jest.spyOn(vaultCommon, "createPledge").mockResolvedValueOnce(Object.assign(Object.assign({}, FAKE_PLEDGE), { id: 1 }));
|
|
106
|
-
yield pledge_1.default.run(Object.assign({}, opts));
|
|
107
|
-
expect(spyConsole).toHaveBeenCalled();
|
|
108
|
-
}));
|
|
109
|
-
});
|
|
110
|
-
//# sourceMappingURL=pledge.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pledge.test.js","sourceRoot":"","sources":["../../src/__tests__/pledge.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oEAAsD;AAItD,gEAAuD;AAEvD,MAAM,IAAI,GAAe;IACvB,OAAO,EAAE,qBAAqB;IAC9B,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,eAAe;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE,EAAE;CACT,CAAC;AAEF,MAAM,WAAW,GAAyB;IACxC,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE;QACP,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,EAAE;QAChB,gBAAgB,EAAE,EAAE;QACpB,mBAAmB,EAAE,EAAE;QACvB,mBAAmB,EAAE,EAAE;QACvB,eAAe,EAAE,EAAE;QACnB,cAAc,EAAE,EAAE;QAClB,eAAe,EAAE,EAAE;QACnB,kBAAkB,EAAE,EAAE;QACtB,yB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