From 47b8c16b67c08e5750eddfc0175382592899af81 Mon Sep 17 00:00:00 2001
From: Trae Yelovich
Date: Mon, 26 Jun 2023 15:28:48 -0400
Subject: [PATCH 01/11] feat: Prepare imperative to use keytar-rs
Signed-off-by: Trae Yelovich
---
...t.cli.auth.login.fruit.integration.test.ts | 2 +-
....cli.auth.logout.fruit.integration.test.ts | 2 +-
...config.auto-init.fruit.integration.test.ts | 2 +-
...onfig.convert-profiles.integration.test.ts | 2 +-
...test-cli.config.secure.integration.test.ts | 2 +-
...ve-test-cli.config.set.integration.test.ts | 2 +-
package-lock.json | 448 ++----------------
package.json | 5 +-
.../convert-profiles.handler.test.ts | 2 +-
.../config/cmd/secure/secure.handler.test.ts | 2 +-
.../config/cmd/set/set.handler.test.ts | 2 +-
packages/imperative/src/OverridesLoader.ts | 2 +-
.../convert-profiles.handler.ts | 4 +-
.../DefaultCredentialManager.test.ts | 4 +-
.../security/src/DefaultCredentialManager.ts | 6 +-
15 files changed, 58 insertions(+), 429 deletions(-)
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.login.fruit.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.login.fruit.integration.test.ts
index 4ef0b5fea..70d607db0 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.login.fruit.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.login.fruit.integration.test.ts
@@ -14,7 +14,7 @@ import { runCliScript } from "../../../../../../src/TestUtil";
import { ITestEnvironment } from "../../../../../../__src__/environment/doc/response/ITestEnvironment";
import { SetupTestEnvironment } from "../../../../../../__src__/environment/SetupTestEnvironment";
import * as fs from "fs";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
// Test Environment populated in the beforeAll();
let TEST_ENVIRONMENT: ITestEnvironment;
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.logout.fruit.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.logout.fruit.integration.test.ts
index e3504b7e0..d1f323ba9 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.logout.fruit.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.logout.fruit.integration.test.ts
@@ -13,7 +13,7 @@ import { runCliScript } from "../../../../../../src/TestUtil";
import { ITestEnvironment } from "../../../../../../__src__/environment/doc/response/ITestEnvironment";
import { SetupTestEnvironment } from "../../../../../../__src__/environment/SetupTestEnvironment";
import * as fs from "fs";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
// Test Environment populated in the beforeAll();
let TEST_ENVIRONMENT: ITestEnvironment;
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.test.ts
index d9e742212..061daf317 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.test.ts
@@ -12,7 +12,7 @@
import * as fs from "fs";
import * as glob from "glob";
import * as jsonfile from "jsonfile";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
import { IConfig } from "../../../../../../../../packages";
import { IConfigSecureProperties } from "../../../../../../../../packages/config/src/doc/IConfigSecure";
import { runCliScript } from "../../../../../../../src/TestUtil";
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.test.ts
index b7e9c84a3..96ac01747 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.test.ts
@@ -12,7 +12,7 @@
import * as fs from "fs";
import * as fsExtra from "fs-extra";
import * as path from "path";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
import { ITestEnvironment } from "../../../../../../../__src__/environment/doc/response/ITestEnvironment";
import { SetupTestEnvironment } from "../../../../../../../__src__/environment/SetupTestEnvironment";
import { runCliScript } from "../../../../../../../src/TestUtil";
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/secure/cli.imperative-test-cli.config.secure.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/secure/cli.imperative-test-cli.config.secure.integration.test.ts
index 48f8f12dc..6e61631ba 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/secure/cli.imperative-test-cli.config.secure.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/secure/cli.imperative-test-cli.config.secure.integration.test.ts
@@ -14,7 +14,7 @@ import { SetupTestEnvironment } from "../../../../../../../__src__/environment/S
import { runCliScript } from "../../../../../../../src/TestUtil";
import { expectedConfigObject, expectedUserConfigObject } from "../__resources__/expectedObjects";
import * as fs from "fs";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
import * as path from "path";
import * as lodash from "lodash";
import { IConfigProfile } from "../../../../../../../../packages";
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/set/cli.imperative-test-cli.config.set.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/set/cli.imperative-test-cli.config.set.integration.test.ts
index e64c0117f..671e0107d 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/set/cli.imperative-test-cli.config.set.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/set/cli.imperative-test-cli.config.set.integration.test.ts
@@ -15,7 +15,7 @@ import { runCliScript } from "../../../../../../../src/TestUtil";
import { expectedConfigObject, expectedUserConfigObject } from "../__resources__/expectedObjects";
import * as fs from "fs";
import * as path from "path";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
import * as lodash from "lodash";
// Test Environment populated in the beforeAll();
diff --git a/package-lock.json b/package-lock.json
index 6820f8a88..2201a0415 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -48,6 +48,8 @@
"yargs": "15.3.1"
},
"devDependencies": {
+ "@napi-rs/cli": "^2.16.1",
+ "@traeok/keytar-rs": "github:traeok/keytar-rs",
"@types/cross-spawn": "^6.0.2",
"@types/diff": "^5.0.2",
"@types/find-up": "^2.1.1",
@@ -86,7 +88,6 @@
"jest-junit": "^6.3.0",
"jest-sonar-reporter": "^2.0.0",
"jest-stare": "^2.2.0",
- "keytar": "^7.9.0",
"madge": "^4.0.1",
"serve": "^12.0.1",
"shebang-regex": "^2.0.0",
@@ -2831,6 +2832,22 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
+ "node_modules/@napi-rs/cli": {
+ "version": "2.16.1",
+ "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.16.1.tgz",
+ "integrity": "sha512-L0Gr5iEQIDEbvWdDr1HUaBOxBSHL1VZhWSk1oryawoT8qJIY+KGfLFelU+Qma64ivCPbxYpkfPoKYVG3rcoGIA==",
+ "dev": true,
+ "bin": {
+ "napi": "scripts/index.js"
+ },
+ "engines": {
+ "node": ">= 10"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Brooooooklyn"
+ }
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -3043,6 +3060,15 @@
"node": ">= 6"
}
},
+ "node_modules/@traeok/keytar-rs": {
+ "version": "0.0.0",
+ "resolved": "git+ssh://git@github.com/traeok/keytar-rs.git#0b00af3fb1ae1b70ef68b049071d5c392218dbc5",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/@tsconfig/node10": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz",
@@ -5825,21 +5851,6 @@
"npm": ">=2.15"
}
},
- "node_modules/decompress-response": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
- "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
- "dev": true,
- "dependencies": {
- "mimic-response": "^3.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/dedent": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz",
@@ -5993,15 +6004,6 @@
"node": ">=4.2.0"
}
},
- "node_modules/detect-libc": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz",
- "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==",
- "dev": true,
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/detect-newline": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
@@ -6925,15 +6927,6 @@
"node": ">= 0.8.0"
}
},
- "node_modules/expand-template": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
- "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
- "dev": true,
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/expect": {
"version": "28.1.3",
"resolved": "https://registry.npmjs.org/expect/-/expect-28.1.3.tgz",
@@ -7164,12 +7157,6 @@
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=",
"dev": true
},
- "node_modules/fs-constants": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
- "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
- "dev": true
- },
"node_modules/fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
@@ -7326,12 +7313,6 @@
"node": ">=6"
}
},
- "node_modules/github-from-package": {
- "version": "0.0.0",
- "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
- "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
- "dev": true
- },
"node_modules/github-markdown-css": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/github-markdown-css/-/github-markdown-css-5.1.0.tgz",
@@ -11277,17 +11258,6 @@
"integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==",
"dev": true
},
- "node_modules/keytar": {
- "version": "7.9.0",
- "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz",
- "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==",
- "dev": true,
- "hasInstallScript": true,
- "dependencies": {
- "node-addon-api": "^4.3.0",
- "prebuild-install": "^7.0.1"
- }
- },
"node_modules/kleur": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
@@ -11820,18 +11790,6 @@
"node": ">=6"
}
},
- "node_modules/mimic-response": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
- "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
- "dev": true,
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/minimatch": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
@@ -11951,12 +11909,6 @@
"node": ">=10"
}
},
- "node_modules/mkdirp-classic": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
- "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
- "dev": true
- },
"node_modules/module-definition": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/module-definition/-/module-definition-3.3.1.tgz",
@@ -12040,12 +11992,6 @@
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
- "node_modules/napi-build-utils": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
- "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==",
- "dev": true
- },
"node_modules/natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@@ -12095,39 +12041,6 @@
"isarray": "0.0.1"
}
},
- "node_modules/node-abi": {
- "version": "3.24.0",
- "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.24.0.tgz",
- "integrity": "sha512-YPG3Co0luSu6GwOBsmIdGW6Wx0NyNDLg/hriIyDllVsNwnI6UeqaWShxC3lbH4LtEQUgoLP3XR1ndXiDAWvmRw==",
- "dev": true,
- "dependencies": {
- "semver": "^7.3.5"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/node-abi/node_modules/semver": {
- "version": "7.3.7",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
- "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
- "dev": true,
- "dependencies": {
- "lru-cache": "^6.0.0"
- },
- "bin": {
- "semver": "bin/semver.js"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/node-addon-api": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
- "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==",
- "dev": true
- },
"node_modules/node-cleanup": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/node-cleanup/-/node-cleanup-2.1.2.tgz",
@@ -13082,32 +12995,6 @@
"integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==",
"dev": true
},
- "node_modules/prebuild-install": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz",
- "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==",
- "dev": true,
- "dependencies": {
- "detect-libc": "^2.0.0",
- "expand-template": "^2.0.3",
- "github-from-package": "0.0.0",
- "minimist": "^1.2.3",
- "mkdirp-classic": "^0.5.3",
- "napi-build-utils": "^1.0.1",
- "node-abi": "^3.3.0",
- "pump": "^3.0.0",
- "rc": "^1.2.7",
- "simple-get": "^4.0.0",
- "tar-fs": "^2.0.0",
- "tunnel-agent": "^0.6.0"
- },
- "bin": {
- "prebuild-install": "bin.js"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/precinct": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/precinct/-/precinct-7.1.0.tgz",
@@ -13974,51 +13861,6 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
- "node_modules/simple-concat": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
- "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ]
- },
- "node_modules/simple-get": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
- "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "dependencies": {
- "decompress-response": "^6.0.0",
- "once": "^1.3.1",
- "simple-concat": "^1.0.0"
- }
- },
"node_modules/sinon": {
"version": "9.2.4",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.4.tgz",
@@ -14464,48 +14306,6 @@
"node": ">= 10"
}
},
- "node_modules/tar-fs": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
- "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
- "dev": true,
- "dependencies": {
- "chownr": "^1.1.1",
- "mkdirp-classic": "^0.5.2",
- "pump": "^3.0.0",
- "tar-stream": "^2.1.4"
- }
- },
- "node_modules/tar-stream": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
- "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
- "dev": true,
- "dependencies": {
- "bl": "^4.0.3",
- "end-of-stream": "^1.4.1",
- "fs-constants": "^1.0.0",
- "inherits": "^2.0.3",
- "readable-stream": "^3.1.1"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/tar-stream/node_modules/readable-stream": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
- "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
- "dev": true,
- "dependencies": {
- "inherits": "^2.0.3",
- "string_decoder": "^1.1.1",
- "util-deprecate": "^1.0.1"
- },
- "engines": {
- "node": ">= 6"
- }
- },
"node_modules/tar/node_modules/chownr": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
@@ -14858,18 +14658,6 @@
"typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta"
}
},
- "node_modules/tunnel-agent": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
- "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
- "dev": true,
- "dependencies": {
- "safe-buffer": "^5.0.1"
- },
- "engines": {
- "node": "*"
- }
- },
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -17449,6 +17237,12 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
+ "@napi-rs/cli": {
+ "version": "2.16.1",
+ "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.16.1.tgz",
+ "integrity": "sha512-L0Gr5iEQIDEbvWdDr1HUaBOxBSHL1VZhWSk1oryawoT8qJIY+KGfLFelU+Qma64ivCPbxYpkfPoKYVG3rcoGIA==",
+ "dev": true
+ },
"@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -17620,6 +17414,11 @@
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw=="
},
+ "@traeok/keytar-rs": {
+ "version": "git+ssh://git@github.com/traeok/keytar-rs.git#0b00af3fb1ae1b70ef68b049071d5c392218dbc5",
+ "dev": true,
+ "from": "@traeok/keytar-rs@github:traeok/keytar-rs"
+ },
"@tsconfig/node10": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz",
@@ -19682,15 +19481,6 @@
"esprima": "4.0.1"
}
},
- "decompress-response": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
- "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
- "dev": true,
- "requires": {
- "mimic-response": "^3.1.0"
- }
- },
"dedent": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz",
@@ -19811,12 +19601,6 @@
}
}
},
- "detect-libc": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz",
- "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==",
- "dev": true
- },
"detect-newline": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
@@ -20482,12 +20266,6 @@
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=",
"dev": true
},
- "expand-template": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
- "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
- "dev": true
- },
"expect": {
"version": "28.1.3",
"resolved": "https://registry.npmjs.org/expect/-/expect-28.1.3.tgz",
@@ -20681,12 +20459,6 @@
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=",
"dev": true
},
- "fs-constants": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
- "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
- "dev": true
- },
"fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
@@ -20803,12 +20575,6 @@
"pump": "^3.0.0"
}
},
- "github-from-package": {
- "version": "0.0.0",
- "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
- "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
- "dev": true
- },
"github-markdown-css": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/github-markdown-css/-/github-markdown-css-5.1.0.tgz",
@@ -23766,16 +23532,6 @@
"integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==",
"dev": true
},
- "keytar": {
- "version": "7.9.0",
- "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz",
- "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==",
- "dev": true,
- "requires": {
- "node-addon-api": "^4.3.0",
- "prebuild-install": "^7.0.1"
- }
- },
"kleur": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
@@ -24183,12 +23939,6 @@
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
"dev": true
},
- "mimic-response": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
- "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
- "dev": true
- },
"minimatch": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
@@ -24276,12 +24026,6 @@
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
},
- "mkdirp-classic": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
- "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
- "dev": true
- },
"module-definition": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/module-definition/-/module-definition-3.3.1.tgz",
@@ -24340,12 +24084,6 @@
"integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==",
"dev": true
},
- "napi-build-utils": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
- "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==",
- "dev": true
- },
"natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@@ -24394,32 +24132,6 @@
}
}
},
- "node-abi": {
- "version": "3.24.0",
- "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.24.0.tgz",
- "integrity": "sha512-YPG3Co0luSu6GwOBsmIdGW6Wx0NyNDLg/hriIyDllVsNwnI6UeqaWShxC3lbH4LtEQUgoLP3XR1ndXiDAWvmRw==",
- "dev": true,
- "requires": {
- "semver": "^7.3.5"
- },
- "dependencies": {
- "semver": {
- "version": "7.3.7",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
- "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
- "dev": true,
- "requires": {
- "lru-cache": "^6.0.0"
- }
- }
- }
- },
- "node-addon-api": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
- "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==",
- "dev": true
- },
"node-cleanup": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/node-cleanup/-/node-cleanup-2.1.2.tgz",
@@ -25135,26 +24847,6 @@
"uniq": "^1.0.1"
}
},
- "prebuild-install": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz",
- "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==",
- "dev": true,
- "requires": {
- "detect-libc": "^2.0.0",
- "expand-template": "^2.0.3",
- "github-from-package": "0.0.0",
- "minimist": "^1.2.3",
- "mkdirp-classic": "^0.5.3",
- "napi-build-utils": "^1.0.1",
- "node-abi": "^3.3.0",
- "pump": "^3.0.0",
- "rc": "^1.2.7",
- "simple-get": "^4.0.0",
- "tar-fs": "^2.0.0",
- "tunnel-agent": "^0.6.0"
- }
- },
"precinct": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/precinct/-/precinct-7.1.0.tgz",
@@ -25838,23 +25530,6 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
- "simple-concat": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
- "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
- "dev": true
- },
- "simple-get": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
- "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
- "dev": true,
- "requires": {
- "decompress-response": "^6.0.0",
- "once": "^1.3.1",
- "simple-concat": "^1.0.0"
- }
- },
"sinon": {
"version": "9.2.4",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.4.tgz",
@@ -26206,44 +25881,6 @@
}
}
},
- "tar-fs": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
- "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
- "dev": true,
- "requires": {
- "chownr": "^1.1.1",
- "mkdirp-classic": "^0.5.2",
- "pump": "^3.0.0",
- "tar-stream": "^2.1.4"
- }
- },
- "tar-stream": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
- "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
- "dev": true,
- "requires": {
- "bl": "^4.0.3",
- "end-of-stream": "^1.4.1",
- "fs-constants": "^1.0.0",
- "inherits": "^2.0.3",
- "readable-stream": "^3.1.1"
- },
- "dependencies": {
- "readable-stream": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
- "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
- "dev": true,
- "requires": {
- "inherits": "^2.0.3",
- "string_decoder": "^1.1.1",
- "util-deprecate": "^1.0.1"
- }
- }
- }
- },
"temp": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/temp/-/temp-0.4.0.tgz",
@@ -26494,15 +26131,6 @@
"tslib": "^1.8.1"
}
},
- "tunnel-agent": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
- "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
- "dev": true,
- "requires": {
- "safe-buffer": "^5.0.1"
- }
- },
"type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
diff --git a/package.json b/package.json
index f85646b94..a8325d943 100644
--- a/package.json
+++ b/package.json
@@ -48,7 +48,7 @@
"watch:webHelp": "cd web-help && npm run watch",
"bundle:webHelp": "cd web-help && node build.js",
"typedoc": "typedoc --options ./typedoc.json ./packages/",
- "prepare": "husky install && npm run bundle:webHelp",
+ "prepare": "husky install && npm run bundle:webHelp && cd node_modules/@traeok/keytar-rs && npm run prepare",
"clean": "rimraf lib tsconfig.tsbuildinfo"
},
"dependencies": {
@@ -91,6 +91,8 @@
"yargs": "15.3.1"
},
"devDependencies": {
+ "@napi-rs/cli": "^2.16.1",
+ "@traeok/keytar-rs": "github:traeok/keytar-rs",
"@types/cross-spawn": "^6.0.2",
"@types/diff": "^5.0.2",
"@types/find-up": "^2.1.1",
@@ -129,7 +131,6 @@
"jest-junit": "^6.3.0",
"jest-sonar-reporter": "^2.0.0",
"jest-stare": "^2.2.0",
- "keytar": "^7.9.0",
"madge": "^4.0.1",
"serve": "^12.0.1",
"shebang-regex": "^2.0.0",
diff --git a/packages/imperative/__tests__/config/cmd/convert-profiles/convert-profiles.handler.test.ts b/packages/imperative/__tests__/config/cmd/convert-profiles/convert-profiles.handler.test.ts
index 4f8c95ab4..576570674 100644
--- a/packages/imperative/__tests__/config/cmd/convert-profiles/convert-profiles.handler.test.ts
+++ b/packages/imperative/__tests__/config/cmd/convert-profiles/convert-profiles.handler.test.ts
@@ -11,7 +11,7 @@
import * as fs from "fs";
import * as fsExtra from "fs-extra";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
import { Config, ConfigBuilder, ConfigSchema } from "../../../../../config";
import { IHandlerParameters } from "../../../../../cmd";
import { ProfileIO } from "../../../../../profiles";
diff --git a/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts b/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts
index 1ff51ee9f..c7af10e9e 100644
--- a/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts
+++ b/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts
@@ -20,7 +20,7 @@ import { expectedConfigObject } from
"../../../../../../__tests__/__integration__/imperative/__tests__/__integration__/cli/config/__resources__/expectedObjects";
import SecureHandler from "../../../../src/config/cmd/secure/secure.handler";
import * as config from "../../../../../../__tests__/__integration__/imperative/src/imperative";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
import * as path from "path";
import * as lodash from "lodash";
import * as fs from "fs";
diff --git a/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts b/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts
index d38e3b821..a714fa885 100644
--- a/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts
+++ b/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts
@@ -20,7 +20,7 @@ import { expectedConfigObject, expectedUserConfigObject } from
"../../../../../../__tests__/__integration__/imperative/__tests__/__integration__/cli/config/__resources__/expectedObjects";
import SetHandler from "../../../../src/config/cmd/set/set.handler";
import * as config from "../../../../../../__tests__/__integration__/imperative/src/imperative";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
import * as path from "path";
import * as lodash from "lodash";
import * as fs from "fs";
diff --git a/packages/imperative/src/OverridesLoader.ts b/packages/imperative/src/OverridesLoader.ts
index 3aae8349e..5dd1c6059 100644
--- a/packages/imperative/src/OverridesLoader.ts
+++ b/packages/imperative/src/OverridesLoader.ts
@@ -111,7 +111,7 @@ export class OverridesLoader {
* @returns True if DefaultCredentialManager should be used
*/
private static shouldUseKeytar(packageJson: any, useTeamConfig: boolean): boolean {
- return (packageJson.dependencies?.keytar != null || packageJson.optionalDependencies?.keytar != null) &&
+ return ("@traeok/keytar-rs" in packageJson.dependencies || "@traeok/keytar-rs" in packageJson.optionalDependencies) &&
(!AppSettings.initialized || useTeamConfig || AppSettings.instance.getNamespace("overrides")?.CredentialManager === packageJson.name);
}
diff --git a/packages/imperative/src/config/cmd/convert-profiles/convert-profiles.handler.ts b/packages/imperative/src/config/cmd/convert-profiles/convert-profiles.handler.ts
index dd40646d7..bb1224c5c 100644
--- a/packages/imperative/src/config/cmd/convert-profiles/convert-profiles.handler.ts
+++ b/packages/imperative/src/config/cmd/convert-profiles/convert-profiles.handler.ts
@@ -12,7 +12,7 @@
import * as fs from "fs";
import { removeSync } from "fs-extra";
import * as path from "path";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
import { ICommandHandler, IHandlerParameters } from "../../../../../cmd";
import { ConfigBuilder, ConfigSchema } from "../../../../../config";
import { ProfileIO, ProfileUtils } from "../../../../../profiles";
@@ -263,7 +263,7 @@ export default class ConvertProfilesHandler implements ICommandHandler {
requireOpts.paths = [process.mainModule.filename];
}
try {
- const keytarPath = require.resolve("keytar", requireOpts);
+ const keytarPath = require.resolve("@traeok/keytar-rs", requireOpts);
this.keytar = await import(keytarPath);
await this.keytar.findCredentials(this.ZOWE_CLI_PACKAGE_NAME);
success = true;
diff --git a/packages/security/__tests__/DefaultCredentialManager.test.ts b/packages/security/__tests__/DefaultCredentialManager.test.ts
index 41ed14f24..5cdfdbf43 100644
--- a/packages/security/__tests__/DefaultCredentialManager.test.ts
+++ b/packages/security/__tests__/DefaultCredentialManager.test.ts
@@ -9,11 +9,11 @@
*
*/
-jest.mock("keytar");
+jest.mock("@traeok/keytar-rs");
import * as path from "path";
import { DefaultCredentialManager } from "..";
-import * as keytar from "keytar";
+import * as keytar from "@traeok/keytar-rs";
import { ImperativeError } from "../../error";
const winMaxCredentialLength = 2560;
diff --git a/packages/security/src/DefaultCredentialManager.ts b/packages/security/src/DefaultCredentialManager.ts
index 926c8cf09..263c338ea 100644
--- a/packages/security/src/DefaultCredentialManager.ts
+++ b/packages/security/src/DefaultCredentialManager.ts
@@ -13,7 +13,7 @@ import { AbstractCredentialManager, SecureCredential } from "./abstract/Abstract
import { ImperativeError } from "../../error";
import { Logger } from "../../logger";
-import * as keytar from "keytar"; // Used for typing purposes only
+import * as keytar from "@traeok/keytar-rs"; // Used for typing purposes only
/**
* Default Credential Manager is our implementation of the Imperative Credential Manager. This manager invokes methods
@@ -121,9 +121,9 @@ export class DefaultCredentialManager extends AbstractCredentialManager {
// within our caller's path.
const requireOpts: any = {};
if (process.mainModule?.filename != null) {
- requireOpts.paths = [process.mainModule.filename, ...require.resolve.paths("keytar")];
+ requireOpts.paths = [process.mainModule.filename, ...require.resolve.paths("@traeok/keytar-rs")];
}
- const keytarPath = require.resolve("keytar", requireOpts);
+ const keytarPath = require.resolve("@traeok/keytar-rs", requireOpts);
Logger.getImperativeLogger().debug("Loading Keytar module from", keytarPath);
this.keytar = await import(keytarPath);
} catch (error) {
From d9c33d30086b7c86903c33dc1d8e0a07055ac797 Mon Sep 17 00:00:00 2001
From: Trae Yelovich
Date: Wed, 5 Jul 2023 13:41:58 -0400
Subject: [PATCH 02/11] fix: unit tests for keytar/credential management
Signed-off-by: Trae Yelovich
---
package-lock.json | 4 +---
package.json | 6 +++---
.../cmd/__tests__/help/WebHelpGenerator.test.ts | 17 +++++++++--------
.../__tests__/OverridesLoader.test.ts | 12 ++++++------
.../config/cmd/secure/secure.handler.test.ts | 4 +---
.../config/cmd/set/set.handler.test.ts | 4 +---
packages/imperative/src/OverridesLoader.ts | 4 +++-
.../__tests__/DefaultCredentialManager.test.ts | 4 ++--
.../security/src/DefaultCredentialManager.ts | 7 ++++++-
9 files changed, 32 insertions(+), 30 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 2201a0415..f47302b9a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,6 +9,7 @@
"version": "5.14.2",
"license": "EPL-2.0",
"dependencies": {
+ "@traeok/keytar-rs": "github:traeok/keytar-rs",
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
"chalk": "2.4.2",
@@ -49,7 +50,6 @@
},
"devDependencies": {
"@napi-rs/cli": "^2.16.1",
- "@traeok/keytar-rs": "github:traeok/keytar-rs",
"@types/cross-spawn": "^6.0.2",
"@types/diff": "^5.0.2",
"@types/find-up": "^2.1.1",
@@ -3063,7 +3063,6 @@
"node_modules/@traeok/keytar-rs": {
"version": "0.0.0",
"resolved": "git+ssh://git@github.com/traeok/keytar-rs.git#0b00af3fb1ae1b70ef68b049071d5c392218dbc5",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 10"
@@ -17416,7 +17415,6 @@
},
"@traeok/keytar-rs": {
"version": "git+ssh://git@github.com/traeok/keytar-rs.git#0b00af3fb1ae1b70ef68b049071d5c392218dbc5",
- "dev": true,
"from": "@traeok/keytar-rs@github:traeok/keytar-rs"
},
"@tsconfig/node10": {
diff --git a/package.json b/package.json
index a8325d943..86f2f6a80 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"scripts": {
"audit:public": "npm audit --registry https://registry.npmjs.org/",
"build:packages": "tsc && node scripts/updateLicenses.js && npm run lint && npm run circularDependencyCheck",
- "build": "npm run build:packages && npm run build:webHelp",
+ "build": "npm run build:packages && npm run build:webHelp && cd node_modules/@traeok/keytar-rs && npm install && npm run prepare",
"postbuild": "node scripts/sampleCliTool.js build && npm run checkTestsCompile",
"checkTestsCompile": "echo \"Checking that test source compiles\" && tsc --noEmit -p tsconfig-tests.json",
"test": "npm run test:unit && npm run test:integration",
@@ -48,10 +48,11 @@
"watch:webHelp": "cd web-help && npm run watch",
"bundle:webHelp": "cd web-help && node build.js",
"typedoc": "typedoc --options ./typedoc.json ./packages/",
- "prepare": "husky install && npm run bundle:webHelp && cd node_modules/@traeok/keytar-rs && npm run prepare",
+ "prepare": "husky install && npm run bundle:webHelp && cd node_modules/@traeok/keytar-rs && npm install && npm run prepare",
"clean": "rimraf lib tsconfig.tsbuildinfo"
},
"dependencies": {
+ "@traeok/keytar-rs": "github:traeok/keytar-rs",
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
"chalk": "2.4.2",
@@ -92,7 +93,6 @@
},
"devDependencies": {
"@napi-rs/cli": "^2.16.1",
- "@traeok/keytar-rs": "github:traeok/keytar-rs",
"@types/cross-spawn": "^6.0.2",
"@types/diff": "^5.0.2",
"@types/find-up": "^2.1.1",
diff --git a/packages/cmd/__tests__/help/WebHelpGenerator.test.ts b/packages/cmd/__tests__/help/WebHelpGenerator.test.ts
index 96c153a14..18a153e08 100644
--- a/packages/cmd/__tests__/help/WebHelpGenerator.test.ts
+++ b/packages/cmd/__tests__/help/WebHelpGenerator.test.ts
@@ -119,12 +119,13 @@ describe("WebHelpGenerator", () => {
it("should create Help files", async () => {
const cmdResp = new CommandResponse({ silent: false });
+ const existsSync = jest.requireActual("fs").existsSync;
/* When jenkins machine runs this test as an integration test,
* it needs the path to docs to exist, even though Windows does not care.
*/
const webHelpDocsDirNm = webHelpDirNm + "/docs";
- if (!fs.existsSync(webHelpDocsDirNm)) {
+ if (!existsSync(webHelpDocsDirNm)) {
IO.mkdirp(webHelpDocsDirNm);
}
@@ -172,13 +173,13 @@ Allowed values: banana, coconut
`https://example.com`);
// do a reasonable set of generated files exist?
- expect(fs.existsSync(webHelpDocsDirNm + "/" + moduleFileNm + ".html")).toBe(true);
- expect(fs.existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_config.html")).toBe(true);
- expect(fs.existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_hello_wordWrap.html")).toBe(true);
- expect(fs.existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_hello_universe.html")).toBe(true);
- expect(fs.existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_hello_world.html")).toBe(true);
- expect(fs.existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_plugins_install.html")).toBe(true);
- expect(fs.existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_plugins_uninstall.html")).toBe(true);
+ expect(existsSync(webHelpDocsDirNm + "/" + moduleFileNm + ".html")).toBe(true);
+ expect(existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_config.html")).toBe(true);
+ expect(existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_hello_wordWrap.html")).toBe(true);
+ expect(existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_hello_universe.html")).toBe(true);
+ expect(existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_hello_world.html")).toBe(true);
+ expect(existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_plugins_install.html")).toBe(true);
+ expect(existsSync(webHelpDocsDirNm + "/" + moduleFileNm + "_plugins_uninstall.html")).toBe(true);
});
});
});
diff --git a/packages/imperative/__tests__/OverridesLoader.test.ts b/packages/imperative/__tests__/OverridesLoader.test.ts
index 67b726652..b4b36b612 100644
--- a/packages/imperative/__tests__/OverridesLoader.test.ts
+++ b/packages/imperative/__tests__/OverridesLoader.test.ts
@@ -73,7 +73,7 @@ describe("OverridesLoader", () => {
const packageJson = {
name: "host-package",
dependencies: {
- keytar: "1.0"
+ "@traeok/keytar-rs": "1.0"
}
};
@@ -98,7 +98,7 @@ describe("OverridesLoader", () => {
const packageJson = {
name: "host-package",
dependencies: {
- keytar: "1.0"
+ "@traeok/keytar-rs": "1.0"
}
};
@@ -124,7 +124,7 @@ describe("OverridesLoader", () => {
const packageJson = {
name: "host-package",
dependencies: {
- keytar: "1.0"
+ "@traeok/keytar-rs": "1.0"
}
};
@@ -275,7 +275,7 @@ describe("OverridesLoader", () => {
// Fake out package.json for the overrides loader
const packageJson = {
dependencies: {
- keytar: "1.0"
+ "@traeok/keytar-rs": "1.0"
}
};
@@ -299,7 +299,7 @@ describe("OverridesLoader", () => {
// Fake out package.json for the overrides loader
const packageJson = {
optionalDependencies: {
- keytar: "1.0"
+ "@traeok/keytar-rs": "1.0"
}
};
@@ -323,7 +323,7 @@ describe("OverridesLoader", () => {
// Fake out package.json for the overrides loader
const packageJson = {
dependencies: {
- keytar: "1.0"
+ "@traeok/keytar-rs": "1.0"
}
};
diff --git a/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts b/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts
index c7af10e9e..d0ed47cda 100644
--- a/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts
+++ b/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts
@@ -27,8 +27,6 @@ import * as fs from "fs";
import { SessConstants } from "../../../../../rest";
import { setupConfigToLoad } from "../../../../../../__tests__/src/TestUtil";
-jest.mock("fs");
-
const getIHandlerParametersObject = (): IHandlerParameters => {
const x: any = {
response: {
@@ -106,7 +104,7 @@ describe("Configuration Secure command handler", () => {
// Start mocking out some of the credential management functions
// Any secure data being loaded will appear to be fakeSecureValue
- keytarGetPasswordSpy.mockReturnValue(fakeSecureData);
+ keytarGetPasswordSpy.mockResolvedValue(fakeSecureData);
keytarSetPasswordSpy.mockImplementation();
keytarDeletePasswordSpy.mockImplementation();
diff --git a/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts b/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts
index a714fa885..653f6d97a 100644
--- a/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts
+++ b/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts
@@ -26,8 +26,6 @@ import * as lodash from "lodash";
import * as fs from "fs";
import { setupConfigToLoad } from "../../../../../../__tests__/src/TestUtil";
-jest.mock("fs");
-
const getIHandlerParametersObject = (): IHandlerParameters => {
const x: any = {
response: {
@@ -103,7 +101,7 @@ describe("Configuration Set command handler", () => {
// Start mocking out some of the credential management functions
// Any secure data being loaded will appear to be fakeSecureValue
- keytarGetPasswordSpy.mockReturnValue(fakeSecureData);
+ keytarGetPasswordSpy.mockResolvedValue(fakeSecureData);
keytarSetPasswordSpy.mockImplementation();
keytarDeletePasswordSpy.mockImplementation();
diff --git a/packages/imperative/src/OverridesLoader.ts b/packages/imperative/src/OverridesLoader.ts
index 5dd1c6059..9e719b08e 100644
--- a/packages/imperative/src/OverridesLoader.ts
+++ b/packages/imperative/src/OverridesLoader.ts
@@ -111,7 +111,9 @@ export class OverridesLoader {
* @returns True if DefaultCredentialManager should be used
*/
private static shouldUseKeytar(packageJson: any, useTeamConfig: boolean): boolean {
- return ("@traeok/keytar-rs" in packageJson.dependencies || "@traeok/keytar-rs" in packageJson.optionalDependencies) &&
+ const deps = packageJson.dependencies ?? [];
+ const optionalDeps = packageJson.optionalDependencies ?? [];
+ return ("@traeok/keytar-rs" in deps || "@traeok/keytar-rs" in optionalDeps) &&
(!AppSettings.initialized || useTeamConfig || AppSettings.instance.getNamespace("overrides")?.CredentialManager === packageJson.name);
}
diff --git a/packages/security/__tests__/DefaultCredentialManager.test.ts b/packages/security/__tests__/DefaultCredentialManager.test.ts
index 5cdfdbf43..60a0929fb 100644
--- a/packages/security/__tests__/DefaultCredentialManager.test.ts
+++ b/packages/security/__tests__/DefaultCredentialManager.test.ts
@@ -78,7 +78,7 @@ describe("DefaultCredentialManager", () => {
const fakeCliPath = "/root/fakeCli";
const mainModule = process.mainModule;
process.mainModule = { filename: fakeCliPath } as any;
- const pathResolveSpy = jest.spyOn(path, "resolve").mockReturnValue(path.parse(__dirname).root);
+ const pathResolveSpy = jest.spyOn(DefaultCredentialManager.prototype, "resolveDep").mockReturnValue(fakeCliPath);
// Force enter the try catch
Object.defineProperty(manager, "keytar", {
@@ -92,7 +92,7 @@ describe("DefaultCredentialManager", () => {
expect(privateManager.loadError).toBeInstanceOf(ImperativeError);
const error: Error = privateManager.loadError.causeErrors;
expect(error).toBeDefined();
- expect(error.message).toContain("Cannot resolve module");
+ expect(error.message).toContain("Cannot find module");
expect(error.message).toContain(fakeCliPath);
} finally {
process.mainModule = mainModule;
diff --git a/packages/security/src/DefaultCredentialManager.ts b/packages/security/src/DefaultCredentialManager.ts
index 263c338ea..6ee27e624 100644
--- a/packages/security/src/DefaultCredentialManager.ts
+++ b/packages/security/src/DefaultCredentialManager.ts
@@ -103,6 +103,10 @@ export class DefaultCredentialManager extends AbstractCredentialManager {
}
}
+ public resolveDep(name: string, opts?: { paths: string[] }) {
+ return require.resolve(name, opts);
+ }
+
/**
* Called by {@link CredentialManagerFactory.initialize} before the freeze of the object. This
* gives us a chance to load keytar into the class before we are locked down. If a load failure
@@ -123,7 +127,8 @@ export class DefaultCredentialManager extends AbstractCredentialManager {
if (process.mainModule?.filename != null) {
requireOpts.paths = [process.mainModule.filename, ...require.resolve.paths("@traeok/keytar-rs")];
}
- const keytarPath = require.resolve("@traeok/keytar-rs", requireOpts);
+ // use helper function for require.resolve so it can be mocked in jest tests
+ const keytarPath = this.resolveDep("@traeok/keytar-rs", requireOpts);
Logger.getImperativeLogger().debug("Loading Keytar module from", keytarPath);
this.keytar = await import(keytarPath);
} catch (error) {
From 906c64605ae055717f8b608299f74724f6c4f7b0 Mon Sep 17 00:00:00 2001
From: Trae Yelovich
Date: Mon, 10 Jul 2023 15:57:43 -0400
Subject: [PATCH 03/11] fix(WIP): resolve failing integration tests
Signed-off-by: Trae Yelovich
---
__tests__/__integration__/imperative/package.json | 2 +-
.../__integration__/CliProfileManager.credentials.spec.ts | 4 ++--
package.json | 4 ++--
packages/imperative/src/OverridesLoader.ts | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/__tests__/__integration__/imperative/package.json b/__tests__/__integration__/imperative/package.json
index 94f06fa80..44dc60f84 100644
--- a/__tests__/__integration__/imperative/package.json
+++ b/__tests__/__integration__/imperative/package.json
@@ -35,7 +35,7 @@
},
"dependencies": {
"@zowe/imperative": "../../..",
- "keytar": "^7.1.0"
+ "@traeok/keytar-rs": "github:traeok/keytar-rs"
},
"engines": {
"node": ">=8.0.0"
diff --git a/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts b/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts
index 62864607d..f0340d010 100644
--- a/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts
+++ b/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts
@@ -240,8 +240,8 @@ describe("Cli Profile Manager", () => {
describe("Missing keytar installation", () => {
const profileName = "missing-keytar";
- const keyTarDir = path.join(__dirname, "../../../../../node_modules/keytar");
- const renamedKeyTarDir = path.join(__dirname, "../../../../../node_modules/keytar-renamed");
+ const keyTarDir = path.join(__dirname, "../../../../../node_modules/@traeok/keytar-rs");
+ const renamedKeyTarDir = path.join(__dirname, "../../../../../node_modules/@traeok/keytar-rs-renamed");
const renameKeyTar = () => {
if (fs.existsSync(keyTarDir)) {
diff --git a/package.json b/package.json
index 86f2f6a80..cb419ee26 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"scripts": {
"audit:public": "npm audit --registry https://registry.npmjs.org/",
"build:packages": "tsc && node scripts/updateLicenses.js && npm run lint && npm run circularDependencyCheck",
- "build": "npm run build:packages && npm run build:webHelp && cd node_modules/@traeok/keytar-rs && npm install && npm run prepare",
+ "build": "npm run build:packages && npm run build:webHelp",
"postbuild": "node scripts/sampleCliTool.js build && npm run checkTestsCompile",
"checkTestsCompile": "echo \"Checking that test source compiles\" && tsc --noEmit -p tsconfig-tests.json",
"test": "npm run test:unit && npm run test:integration",
@@ -48,7 +48,7 @@
"watch:webHelp": "cd web-help && npm run watch",
"bundle:webHelp": "cd web-help && node build.js",
"typedoc": "typedoc --options ./typedoc.json ./packages/",
- "prepare": "husky install && npm run bundle:webHelp && cd node_modules/@traeok/keytar-rs && npm install && npm run prepare",
+ "prepare": "husky install && npm run bundle:webHelp",
"clean": "rimraf lib tsconfig.tsbuildinfo"
},
"dependencies": {
diff --git a/packages/imperative/src/OverridesLoader.ts b/packages/imperative/src/OverridesLoader.ts
index 9e719b08e..3ed5b3260 100644
--- a/packages/imperative/src/OverridesLoader.ts
+++ b/packages/imperative/src/OverridesLoader.ts
@@ -111,8 +111,8 @@ export class OverridesLoader {
* @returns True if DefaultCredentialManager should be used
*/
private static shouldUseKeytar(packageJson: any, useTeamConfig: boolean): boolean {
- const deps = packageJson.dependencies ?? [];
- const optionalDeps = packageJson.optionalDependencies ?? [];
+ const deps = packageJson.dependencies ?? {};
+ const optionalDeps = packageJson.optionalDependencies ?? {};
return ("@traeok/keytar-rs" in deps || "@traeok/keytar-rs" in optionalDeps) &&
(!AppSettings.initialized || useTeamConfig || AppSettings.instance.getNamespace("overrides")?.CredentialManager === packageJson.name);
}
From abcdf19cb389f537d61348948e0436b7b89284b3 Mon Sep 17 00:00:00 2001
From: Trae Yelovich
Date: Mon, 10 Jul 2023 16:34:14 -0400
Subject: [PATCH 04/11] fix(test): resolve remaining integration tests
Signed-off-by: Trae Yelovich
---
.../__integration__/CliProfileManager.credentials.spec.ts | 2 +-
__tests__/src/packages/profiles/test_cli/package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts b/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts
index f0340d010..2159df221 100644
--- a/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts
+++ b/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts
@@ -241,7 +241,7 @@ describe("Cli Profile Manager", () => {
describe("Missing keytar installation", () => {
const profileName = "missing-keytar";
const keyTarDir = path.join(__dirname, "../../../../../node_modules/@traeok/keytar-rs");
- const renamedKeyTarDir = path.join(__dirname, "../../../../../node_modules/@traeok/keytar-rs-renamed");
+ const renamedKeyTarDir = path.join(__dirname, "../../../../../node_modules/@traeok/keytar-go");
const renameKeyTar = () => {
if (fs.existsSync(keyTarDir)) {
diff --git a/__tests__/src/packages/profiles/test_cli/package.json b/__tests__/src/packages/profiles/test_cli/package.json
index 586e7c000..eaa0f9ab5 100644
--- a/__tests__/src/packages/profiles/test_cli/package.json
+++ b/__tests__/src/packages/profiles/test_cli/package.json
@@ -1,6 +1,6 @@
{
"name": "test-cli-for-profiles",
"dependencies": {
- "keytar": "rock-out-with-a-keytar"
+ "@traeok/keytar-rs": "rock-out-with-a-keytar"
}
}
\ No newline at end of file
From 0f73931c5c06de95c7d1b2d007f29b48047c7885 Mon Sep 17 00:00:00 2001
From: Trae Yelovich
Date: Mon, 10 Jul 2023 17:25:28 -0400
Subject: [PATCH 05/11] fix: package.lock pointing to old keytar-rs commit
Signed-off-by: Trae Yelovich
---
package-lock.json | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index f47302b9a..301ab49a9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3062,7 +3062,8 @@
},
"node_modules/@traeok/keytar-rs": {
"version": "0.0.0",
- "resolved": "git+ssh://git@github.com/traeok/keytar-rs.git#0b00af3fb1ae1b70ef68b049071d5c392218dbc5",
+ "resolved": "git+ssh://git@github.com/traeok/keytar-rs.git#4d4f1aa222b85357242fa1df85089e467c2e1d6b",
+ "hasInstallScript": true,
"license": "MIT",
"engines": {
"node": ">= 10"
@@ -17414,7 +17415,7 @@
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw=="
},
"@traeok/keytar-rs": {
- "version": "git+ssh://git@github.com/traeok/keytar-rs.git#0b00af3fb1ae1b70ef68b049071d5c392218dbc5",
+ "version": "git+ssh://git@github.com/traeok/keytar-rs.git#4d4f1aa222b85357242fa1df85089e467c2e1d6b",
"from": "@traeok/keytar-rs@github:traeok/keytar-rs"
},
"@tsconfig/node10": {
From 5877a8f26fa0e72ebc5161d3e4214c304476b0e3 Mon Sep 17 00:00:00 2001
From: Timothy Johnson
Date: Tue, 11 Jul 2023 16:49:39 -0400
Subject: [PATCH 06/11] Temporarily use macos branch of keytar-rs
Signed-off-by: Timothy Johnson
---
__tests__/__integration__/imperative/package.json | 2 +-
package-lock.json | 8 ++++----
package.json | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/__tests__/__integration__/imperative/package.json b/__tests__/__integration__/imperative/package.json
index 44dc60f84..727e4d0b4 100644
--- a/__tests__/__integration__/imperative/package.json
+++ b/__tests__/__integration__/imperative/package.json
@@ -35,7 +35,7 @@
},
"dependencies": {
"@zowe/imperative": "../../..",
- "@traeok/keytar-rs": "github:traeok/keytar-rs"
+ "@traeok/keytar-rs": "github:traeok/keytar-rs#fix-macos-delete"
},
"engines": {
"node": ">=8.0.0"
diff --git a/package-lock.json b/package-lock.json
index 301ab49a9..a2fc43daf 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,7 +9,7 @@
"version": "5.14.2",
"license": "EPL-2.0",
"dependencies": {
- "@traeok/keytar-rs": "github:traeok/keytar-rs",
+ "@traeok/keytar-rs": "github:traeok/keytar-rs#fix-macos-delete",
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
"chalk": "2.4.2",
@@ -3062,7 +3062,7 @@
},
"node_modules/@traeok/keytar-rs": {
"version": "0.0.0",
- "resolved": "git+ssh://git@github.com/traeok/keytar-rs.git#4d4f1aa222b85357242fa1df85089e467c2e1d6b",
+ "resolved": "git+ssh://git@github.com/traeok/keytar-rs.git#ca642e0f76b5b7d0e1efcb46b3416c50fe7300aa",
"hasInstallScript": true,
"license": "MIT",
"engines": {
@@ -17415,8 +17415,8 @@
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw=="
},
"@traeok/keytar-rs": {
- "version": "git+ssh://git@github.com/traeok/keytar-rs.git#4d4f1aa222b85357242fa1df85089e467c2e1d6b",
- "from": "@traeok/keytar-rs@github:traeok/keytar-rs"
+ "version": "git+ssh://git@github.com/traeok/keytar-rs.git#ca642e0f76b5b7d0e1efcb46b3416c50fe7300aa",
+ "from": "@traeok/keytar-rs@github:traeok/keytar-rs#fix-macos-delete"
},
"@tsconfig/node10": {
"version": "1.0.8",
diff --git a/package.json b/package.json
index cb419ee26..8d6ff1c6d 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,7 @@
"clean": "rimraf lib tsconfig.tsbuildinfo"
},
"dependencies": {
- "@traeok/keytar-rs": "github:traeok/keytar-rs",
+ "@traeok/keytar-rs": "github:traeok/keytar-rs#fix-macos-delete",
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
"chalk": "2.4.2",
From 8d885f3dedffcdb34cd16584b0970dc392f42cb7 Mon Sep 17 00:00:00 2001
From: Timothy Johnson
Date: Wed, 12 Jul 2023 13:32:31 -0400
Subject: [PATCH 07/11] Update keytar-rs sha for macos fixes
Signed-off-by: Timothy Johnson
---
__tests__/__integration__/imperative/package.json | 2 +-
package-lock.json | 8 ++++----
package.json | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/__tests__/__integration__/imperative/package.json b/__tests__/__integration__/imperative/package.json
index 727e4d0b4..44dc60f84 100644
--- a/__tests__/__integration__/imperative/package.json
+++ b/__tests__/__integration__/imperative/package.json
@@ -35,7 +35,7 @@
},
"dependencies": {
"@zowe/imperative": "../../..",
- "@traeok/keytar-rs": "github:traeok/keytar-rs#fix-macos-delete"
+ "@traeok/keytar-rs": "github:traeok/keytar-rs"
},
"engines": {
"node": ">=8.0.0"
diff --git a/package-lock.json b/package-lock.json
index a2fc43daf..4a5e3c1af 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,7 +9,7 @@
"version": "5.14.2",
"license": "EPL-2.0",
"dependencies": {
- "@traeok/keytar-rs": "github:traeok/keytar-rs#fix-macos-delete",
+ "@traeok/keytar-rs": "github:traeok/keytar-rs",
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
"chalk": "2.4.2",
@@ -3062,7 +3062,7 @@
},
"node_modules/@traeok/keytar-rs": {
"version": "0.0.0",
- "resolved": "git+ssh://git@github.com/traeok/keytar-rs.git#ca642e0f76b5b7d0e1efcb46b3416c50fe7300aa",
+ "resolved": "git+ssh://git@github.com/traeok/keytar-rs.git#2e65470786ec8071ca0c5bff3df7b680e3384a1e",
"hasInstallScript": true,
"license": "MIT",
"engines": {
@@ -17415,8 +17415,8 @@
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw=="
},
"@traeok/keytar-rs": {
- "version": "git+ssh://git@github.com/traeok/keytar-rs.git#ca642e0f76b5b7d0e1efcb46b3416c50fe7300aa",
- "from": "@traeok/keytar-rs@github:traeok/keytar-rs#fix-macos-delete"
+ "version": "git+ssh://git@github.com/traeok/keytar-rs.git#2e65470786ec8071ca0c5bff3df7b680e3384a1e",
+ "from": "@traeok/keytar-rs@github:traeok/keytar-rs"
},
"@tsconfig/node10": {
"version": "1.0.8",
diff --git a/package.json b/package.json
index 8d6ff1c6d..cb419ee26 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,7 @@
"clean": "rimraf lib tsconfig.tsbuildinfo"
},
"dependencies": {
- "@traeok/keytar-rs": "github:traeok/keytar-rs#fix-macos-delete",
+ "@traeok/keytar-rs": "github:traeok/keytar-rs",
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
"chalk": "2.4.2",
From 7ce331a99145e285e8d9d2f97ac8ccd90e6d6a74 Mon Sep 17 00:00:00 2001
From: Trae Yelovich
Date: Thu, 27 Jul 2023 11:42:31 -0400
Subject: [PATCH 08/11] chore: prepare imperative for Secrets SDK release
Signed-off-by: Trae Yelovich
---
...ive.test.cli.auth.login.fruit.integration.test.ts | 2 +-
...ve.test.cli.auth.logout.fruit.integration.test.ts | 2 +-
...st.cli.config.auto-init.fruit.integration.test.ts | 2 +-
...t-cli.config.convert-profiles.integration.test.ts | 2 +-
...rative-test-cli.config.secure.integration.test.ts | 2 +-
...mperative-test-cli.config.set.integration.test.ts | 2 +-
__tests__/__integration__/imperative/package.json | 2 +-
.../CliProfileManager.credentials.spec.ts | 4 ++--
.../src/packages/profiles/test_cli/package.json | 2 +-
package.json | 2 +-
.../imperative/__tests__/OverridesLoader.test.ts | 12 ++++++------
.../convert-profiles.handler.test.ts | 2 +-
.../config/cmd/secure/secure.handler.test.ts | 2 +-
.../__tests__/config/cmd/set/set.handler.test.ts | 2 +-
packages/imperative/src/OverridesLoader.ts | 2 +-
.../cmd/convert-profiles/convert-profiles.handler.ts | 6 +++---
.../__tests__/DefaultCredentialManager.test.ts | 4 ++--
packages/security/src/DefaultCredentialManager.ts | 8 ++++----
18 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.login.fruit.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.login.fruit.integration.test.ts
index 70d607db0..d361c78c8 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.login.fruit.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.login.fruit.integration.test.ts
@@ -14,7 +14,7 @@ import { runCliScript } from "../../../../../../src/TestUtil";
import { ITestEnvironment } from "../../../../../../__src__/environment/doc/response/ITestEnvironment";
import { SetupTestEnvironment } from "../../../../../../__src__/environment/SetupTestEnvironment";
import * as fs from "fs";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
// Test Environment populated in the beforeAll();
let TEST_ENVIRONMENT: ITestEnvironment;
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.logout.fruit.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.logout.fruit.integration.test.ts
index 7d3fad135..ae52e1141 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.logout.fruit.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/auth/imperative.test.cli.auth.logout.fruit.integration.test.ts
@@ -13,7 +13,7 @@ import { runCliScript } from "../../../../../../src/TestUtil";
import { ITestEnvironment } from "../../../../../../__src__/environment/doc/response/ITestEnvironment";
import { SetupTestEnvironment } from "../../../../../../__src__/environment/SetupTestEnvironment";
import * as fs from "fs";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
// Test Environment populated in the beforeAll();
let TEST_ENVIRONMENT: ITestEnvironment;
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.test.ts
index 061daf317..a07b4c259 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.test.ts
@@ -12,7 +12,7 @@
import * as fs from "fs";
import * as glob from "glob";
import * as jsonfile from "jsonfile";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
import { IConfig } from "../../../../../../../../packages";
import { IConfigSecureProperties } from "../../../../../../../../packages/config/src/doc/IConfigSecure";
import { runCliScript } from "../../../../../../../src/TestUtil";
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.test.ts
index 96ac01747..c849cc4f3 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.test.ts
@@ -12,7 +12,7 @@
import * as fs from "fs";
import * as fsExtra from "fs-extra";
import * as path from "path";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
import { ITestEnvironment } from "../../../../../../../__src__/environment/doc/response/ITestEnvironment";
import { SetupTestEnvironment } from "../../../../../../../__src__/environment/SetupTestEnvironment";
import { runCliScript } from "../../../../../../../src/TestUtil";
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/secure/cli.imperative-test-cli.config.secure.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/secure/cli.imperative-test-cli.config.secure.integration.test.ts
index 6e61631ba..3c20c5721 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/secure/cli.imperative-test-cli.config.secure.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/secure/cli.imperative-test-cli.config.secure.integration.test.ts
@@ -14,7 +14,7 @@ import { SetupTestEnvironment } from "../../../../../../../__src__/environment/S
import { runCliScript } from "../../../../../../../src/TestUtil";
import { expectedConfigObject, expectedUserConfigObject } from "../__resources__/expectedObjects";
import * as fs from "fs";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
import * as path from "path";
import * as lodash from "lodash";
import { IConfigProfile } from "../../../../../../../../packages";
diff --git a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/set/cli.imperative-test-cli.config.set.integration.test.ts b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/set/cli.imperative-test-cli.config.set.integration.test.ts
index 671e0107d..0ba08977c 100644
--- a/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/set/cli.imperative-test-cli.config.set.integration.test.ts
+++ b/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/set/cli.imperative-test-cli.config.set.integration.test.ts
@@ -15,7 +15,7 @@ import { runCliScript } from "../../../../../../../src/TestUtil";
import { expectedConfigObject, expectedUserConfigObject } from "../__resources__/expectedObjects";
import * as fs from "fs";
import * as path from "path";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
import * as lodash from "lodash";
// Test Environment populated in the beforeAll();
diff --git a/__tests__/__integration__/imperative/package.json b/__tests__/__integration__/imperative/package.json
index 44dc60f84..0c339c014 100644
--- a/__tests__/__integration__/imperative/package.json
+++ b/__tests__/__integration__/imperative/package.json
@@ -35,7 +35,7 @@
},
"dependencies": {
"@zowe/imperative": "../../..",
- "@traeok/keytar-rs": "github:traeok/keytar-rs"
+ "@zowe/secrets-for-zowe-sdk": "7.18.0-next.1"
},
"engines": {
"node": ">=8.0.0"
diff --git a/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts b/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts
index 2159df221..2bd3cb1fd 100644
--- a/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts
+++ b/__tests__/src/packages/profiles/__integration__/CliProfileManager.credentials.spec.ts
@@ -240,8 +240,8 @@ describe("Cli Profile Manager", () => {
describe("Missing keytar installation", () => {
const profileName = "missing-keytar";
- const keyTarDir = path.join(__dirname, "../../../../../node_modules/@traeok/keytar-rs");
- const renamedKeyTarDir = path.join(__dirname, "../../../../../node_modules/@traeok/keytar-go");
+ const keyTarDir = path.join(__dirname, "../../../../../node_modules/@zowe/secrets-for-zowe-sdk");
+ const renamedKeyTarDir = path.join(__dirname, "../../../../../node_modules/@zowe/zowe-for-secrets-sdk");
const renameKeyTar = () => {
if (fs.existsSync(keyTarDir)) {
diff --git a/__tests__/src/packages/profiles/test_cli/package.json b/__tests__/src/packages/profiles/test_cli/package.json
index eaa0f9ab5..3e5cc07e1 100644
--- a/__tests__/src/packages/profiles/test_cli/package.json
+++ b/__tests__/src/packages/profiles/test_cli/package.json
@@ -1,6 +1,6 @@
{
"name": "test-cli-for-profiles",
"dependencies": {
- "@traeok/keytar-rs": "rock-out-with-a-keytar"
+ "@zowe/secrets-for-zowe-sdk": "plaintext"
}
}
\ No newline at end of file
diff --git a/package.json b/package.json
index fe5fef4c5..e8553680d 100644
--- a/package.json
+++ b/package.json
@@ -52,9 +52,9 @@
"clean": "rimraf lib tsconfig.tsbuildinfo"
},
"dependencies": {
- "@traeok/keytar-rs": "github:traeok/keytar-rs",
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
+ "@zowe/secrets-for-zowe-sdk": "7.18.0-next.1",
"chalk": "2.4.2",
"cli-table3": "0.6.2",
"comment-json": "4.1.1",
diff --git a/packages/imperative/__tests__/OverridesLoader.test.ts b/packages/imperative/__tests__/OverridesLoader.test.ts
index b4b36b612..1bc0f3ae2 100644
--- a/packages/imperative/__tests__/OverridesLoader.test.ts
+++ b/packages/imperative/__tests__/OverridesLoader.test.ts
@@ -73,7 +73,7 @@ describe("OverridesLoader", () => {
const packageJson = {
name: "host-package",
dependencies: {
- "@traeok/keytar-rs": "1.0"
+ "@zowe/secrets-for-zowe-sdk": "1.0"
}
};
@@ -98,7 +98,7 @@ describe("OverridesLoader", () => {
const packageJson = {
name: "host-package",
dependencies: {
- "@traeok/keytar-rs": "1.0"
+ "@zowe/secrets-for-zowe-sdk": "1.0"
}
};
@@ -124,7 +124,7 @@ describe("OverridesLoader", () => {
const packageJson = {
name: "host-package",
dependencies: {
- "@traeok/keytar-rs": "1.0"
+ "@zowe/secrets-for-zowe-sdk": "1.0"
}
};
@@ -275,7 +275,7 @@ describe("OverridesLoader", () => {
// Fake out package.json for the overrides loader
const packageJson = {
dependencies: {
- "@traeok/keytar-rs": "1.0"
+ "@zowe/secrets-for-zowe-sdk": "1.0"
}
};
@@ -299,7 +299,7 @@ describe("OverridesLoader", () => {
// Fake out package.json for the overrides loader
const packageJson = {
optionalDependencies: {
- "@traeok/keytar-rs": "1.0"
+ "@zowe/secrets-for-zowe-sdk": "1.0"
}
};
@@ -323,7 +323,7 @@ describe("OverridesLoader", () => {
// Fake out package.json for the overrides loader
const packageJson = {
dependencies: {
- "@traeok/keytar-rs": "1.0"
+ "@zowe/secrets-for-zowe-sdk": "1.0"
}
};
diff --git a/packages/imperative/__tests__/config/cmd/convert-profiles/convert-profiles.handler.test.ts b/packages/imperative/__tests__/config/cmd/convert-profiles/convert-profiles.handler.test.ts
index 576570674..63d61f88d 100644
--- a/packages/imperative/__tests__/config/cmd/convert-profiles/convert-profiles.handler.test.ts
+++ b/packages/imperative/__tests__/config/cmd/convert-profiles/convert-profiles.handler.test.ts
@@ -11,7 +11,7 @@
import * as fs from "fs";
import * as fsExtra from "fs-extra";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
import { Config, ConfigBuilder, ConfigSchema } from "../../../../../config";
import { IHandlerParameters } from "../../../../../cmd";
import { ProfileIO } from "../../../../../profiles";
diff --git a/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts b/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts
index bb3807209..03de4eed4 100644
--- a/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts
+++ b/packages/imperative/__tests__/config/cmd/secure/secure.handler.test.ts
@@ -20,7 +20,7 @@ import { expectedConfigObject } from
"../../../../../../__tests__/__integration__/imperative/__tests__/__integration__/cli/config/__resources__/expectedObjects";
import SecureHandler from "../../../../src/config/cmd/secure/secure.handler";
import * as config from "../../../../../../__tests__/__integration__/imperative/src/imperative";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
import * as path from "path";
import * as lodash from "lodash";
import * as fs from "fs";
diff --git a/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts b/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts
index 653f6d97a..fbb71d035 100644
--- a/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts
+++ b/packages/imperative/__tests__/config/cmd/set/set.handler.test.ts
@@ -20,7 +20,7 @@ import { expectedConfigObject, expectedUserConfigObject } from
"../../../../../../__tests__/__integration__/imperative/__tests__/__integration__/cli/config/__resources__/expectedObjects";
import SetHandler from "../../../../src/config/cmd/set/set.handler";
import * as config from "../../../../../../__tests__/__integration__/imperative/src/imperative";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
import * as path from "path";
import * as lodash from "lodash";
import * as fs from "fs";
diff --git a/packages/imperative/src/OverridesLoader.ts b/packages/imperative/src/OverridesLoader.ts
index 3ed5b3260..1e7267544 100644
--- a/packages/imperative/src/OverridesLoader.ts
+++ b/packages/imperative/src/OverridesLoader.ts
@@ -113,7 +113,7 @@ export class OverridesLoader {
private static shouldUseKeytar(packageJson: any, useTeamConfig: boolean): boolean {
const deps = packageJson.dependencies ?? {};
const optionalDeps = packageJson.optionalDependencies ?? {};
- return ("@traeok/keytar-rs" in deps || "@traeok/keytar-rs" in optionalDeps) &&
+ return ("@zowe/secrets-for-zowe-sdk" in deps || "@zowe/secrets-for-zowe-sdk" in optionalDeps) &&
(!AppSettings.initialized || useTeamConfig || AppSettings.instance.getNamespace("overrides")?.CredentialManager === packageJson.name);
}
diff --git a/packages/imperative/src/config/cmd/convert-profiles/convert-profiles.handler.ts b/packages/imperative/src/config/cmd/convert-profiles/convert-profiles.handler.ts
index bb1224c5c..43c7113c2 100644
--- a/packages/imperative/src/config/cmd/convert-profiles/convert-profiles.handler.ts
+++ b/packages/imperative/src/config/cmd/convert-profiles/convert-profiles.handler.ts
@@ -12,7 +12,7 @@
import * as fs from "fs";
import { removeSync } from "fs-extra";
import * as path from "path";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
import { ICommandHandler, IHandlerParameters } from "../../../../../cmd";
import { ConfigBuilder, ConfigSchema } from "../../../../../config";
import { ProfileIO, ProfileUtils } from "../../../../../profiles";
@@ -263,8 +263,8 @@ export default class ConvertProfilesHandler implements ICommandHandler {
requireOpts.paths = [process.mainModule.filename];
}
try {
- const keytarPath = require.resolve("@traeok/keytar-rs", requireOpts);
- this.keytar = await import(keytarPath);
+ const keytarPath = require.resolve("@zowe/secrets-for-zowe-sdk", requireOpts);
+ this.keytar = (await import(keytarPath)).keyring;
await this.keytar.findCredentials(this.ZOWE_CLI_PACKAGE_NAME);
success = true;
} catch (err) {
diff --git a/packages/security/__tests__/DefaultCredentialManager.test.ts b/packages/security/__tests__/DefaultCredentialManager.test.ts
index 60a0929fb..c802eb332 100644
--- a/packages/security/__tests__/DefaultCredentialManager.test.ts
+++ b/packages/security/__tests__/DefaultCredentialManager.test.ts
@@ -9,11 +9,11 @@
*
*/
-jest.mock("@traeok/keytar-rs");
+jest.mock("@zowe/secrets-for-zowe-sdk");
import * as path from "path";
import { DefaultCredentialManager } from "..";
-import * as keytar from "@traeok/keytar-rs";
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk";
import { ImperativeError } from "../../error";
const winMaxCredentialLength = 2560;
diff --git a/packages/security/src/DefaultCredentialManager.ts b/packages/security/src/DefaultCredentialManager.ts
index 6ee27e624..4eb6a9735 100644
--- a/packages/security/src/DefaultCredentialManager.ts
+++ b/packages/security/src/DefaultCredentialManager.ts
@@ -13,7 +13,7 @@ import { AbstractCredentialManager, SecureCredential } from "./abstract/Abstract
import { ImperativeError } from "../../error";
import { Logger } from "../../logger";
-import * as keytar from "@traeok/keytar-rs"; // Used for typing purposes only
+import { keyring as keytar } from "@zowe/secrets-for-zowe-sdk"; // Used for typing purposes only
/**
* Default Credential Manager is our implementation of the Imperative Credential Manager. This manager invokes methods
@@ -125,12 +125,12 @@ export class DefaultCredentialManager extends AbstractCredentialManager {
// within our caller's path.
const requireOpts: any = {};
if (process.mainModule?.filename != null) {
- requireOpts.paths = [process.mainModule.filename, ...require.resolve.paths("@traeok/keytar-rs")];
+ requireOpts.paths = [process.mainModule.filename, ...require.resolve.paths("@zowe/secrets-for-zowe-sdk")];
}
// use helper function for require.resolve so it can be mocked in jest tests
- const keytarPath = this.resolveDep("@traeok/keytar-rs", requireOpts);
+ const keytarPath = this.resolveDep("@zowe/secrets-for-zowe-sdk", requireOpts);
Logger.getImperativeLogger().debug("Loading Keytar module from", keytarPath);
- this.keytar = await import(keytarPath);
+ this.keytar = (await import(keytarPath)).keyring;
} catch (error) {
this.loadError = new ImperativeError({
msg: `Failed to load Keytar module: ${error.message}`,
From 43c3ff4a95c93c009d37e8658dfa33b85e7a2d9a Mon Sep 17 00:00:00 2001
From: Trae Yelovich
Date: Tue, 1 Aug 2023 09:34:18 -0400
Subject: [PATCH 09/11] chore: Bump secrets SDK
Signed-off-by: Trae Yelovich
---
package-lock.json | 422 +++++-----------------------------------------
package.json | 2 +-
2 files changed, 39 insertions(+), 385 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index ed5420ea3..4b1587f6e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,7 @@
"dependencies": {
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
+ "@zowe/secrets-for-zowe-sdk": "7.18.0-next.4",
"chalk": "2.4.2",
"cli-table3": "0.6.2",
"comment-json": "4.1.1",
@@ -48,6 +49,7 @@
"yargs": "15.3.1"
},
"devDependencies": {
+ "@napi-rs/cli": "^2.16.1",
"@types/cross-spawn": "^6.0.2",
"@types/diff": "^5.0.2",
"@types/find-up": "^2.1.1",
@@ -86,7 +88,6 @@
"jest-junit": "^6.3.0",
"jest-sonar-reporter": "^2.0.0",
"jest-stare": "^2.2.0",
- "keytar": "^7.9.0",
"madge": "^4.0.1",
"serve": "^12.0.1",
"shebang-regex": "^2.0.0",
@@ -2831,6 +2832,22 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
+ "node_modules/@napi-rs/cli": {
+ "version": "2.16.2",
+ "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.16.2.tgz",
+ "integrity": "sha512-U2aZfnr0s9KkXpZlYC0l5WxWCXL7vJUNpCnWMwq3T9GG9rhYAAUM9CTZsi1Z+0iR2LcHbfq9EfMgoqnuTyUjfg==",
+ "dev": true,
+ "bin": {
+ "napi": "scripts/index.js"
+ },
+ "engines": {
+ "node": ">= 10"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Brooooooklyn"
+ }
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -4004,6 +4021,15 @@
"node": ">=8.5.0"
}
},
+ "node_modules/@zowe/secrets-for-zowe-sdk": {
+ "version": "7.18.0-next.4",
+ "resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/@zowe/secrets-for-zowe-sdk/-/@zowe/secrets-for-zowe-sdk-7.18.0-next.4.tgz",
+ "integrity": "sha512-H3UElOA7UxZL+Ee3Q2cHCwF/T0s+SEv8Wof9kyzC0TiP71awBHZiPONY7bZIe3vbpRlckt2ECcG/os6qrDrjJw==",
+ "hasInstallScript": true,
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
@@ -5722,21 +5748,6 @@
"npm": ">=2.15"
}
},
- "node_modules/decompress-response": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
- "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
- "dev": true,
- "dependencies": {
- "mimic-response": "^3.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/dedent": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz",
@@ -5890,15 +5901,6 @@
"node": ">=4.2.0"
}
},
- "node_modules/detect-libc": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz",
- "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==",
- "dev": true,
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/detect-newline": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
@@ -6840,15 +6842,6 @@
"node": ">= 0.8.0"
}
},
- "node_modules/expand-template": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
- "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
- "dev": true,
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/expect": {
"version": "28.1.3",
"resolved": "https://registry.npmjs.org/expect/-/expect-28.1.3.tgz",
@@ -7079,12 +7072,6 @@
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=",
"dev": true
},
- "node_modules/fs-constants": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
- "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
- "dev": true
- },
"node_modules/fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
@@ -7241,12 +7228,6 @@
"node": ">=6"
}
},
- "node_modules/github-from-package": {
- "version": "0.0.0",
- "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
- "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
- "dev": true
- },
"node_modules/github-markdown-css": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/github-markdown-css/-/github-markdown-css-5.1.0.tgz",
@@ -11177,17 +11158,6 @@
"integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==",
"dev": true
},
- "node_modules/keytar": {
- "version": "7.9.0",
- "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz",
- "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==",
- "dev": true,
- "hasInstallScript": true,
- "dependencies": {
- "node-addon-api": "^4.3.0",
- "prebuild-install": "^7.0.1"
- }
- },
"node_modules/kleur": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
@@ -11720,18 +11690,6 @@
"node": ">=6"
}
},
- "node_modules/mimic-response": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
- "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
- "dev": true,
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/minimatch": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
@@ -11851,12 +11809,6 @@
"node": ">=10"
}
},
- "node_modules/mkdirp-classic": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
- "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
- "dev": true
- },
"node_modules/module-definition": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/module-definition/-/module-definition-3.3.1.tgz",
@@ -11940,12 +11892,6 @@
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
- "node_modules/napi-build-utils": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
- "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==",
- "dev": true
- },
"node_modules/natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@@ -11995,24 +11941,6 @@
"isarray": "0.0.1"
}
},
- "node_modules/node-abi": {
- "version": "3.24.0",
- "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.24.0.tgz",
- "integrity": "sha512-YPG3Co0luSu6GwOBsmIdGW6Wx0NyNDLg/hriIyDllVsNwnI6UeqaWShxC3lbH4LtEQUgoLP3XR1ndXiDAWvmRw==",
- "dev": true,
- "dependencies": {
- "semver": "^7.3.5"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/node-addon-api": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
- "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==",
- "dev": true
- },
"node_modules/node-cleanup": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/node-cleanup/-/node-cleanup-2.1.2.tgz",
@@ -12881,32 +12809,6 @@
"integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==",
"dev": true
},
- "node_modules/prebuild-install": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz",
- "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==",
- "dev": true,
- "dependencies": {
- "detect-libc": "^2.0.0",
- "expand-template": "^2.0.3",
- "github-from-package": "0.0.0",
- "minimist": "^1.2.3",
- "mkdirp-classic": "^0.5.3",
- "napi-build-utils": "^1.0.1",
- "node-abi": "^3.3.0",
- "pump": "^3.0.0",
- "rc": "^1.2.7",
- "simple-get": "^4.0.0",
- "tar-fs": "^2.0.0",
- "tunnel-agent": "^0.6.0"
- },
- "bin": {
- "prebuild-install": "bin.js"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/precinct": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/precinct/-/precinct-7.1.0.tgz",
@@ -13779,51 +13681,6 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
- "node_modules/simple-concat": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
- "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ]
- },
- "node_modules/simple-get": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
- "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "dependencies": {
- "decompress-response": "^6.0.0",
- "once": "^1.3.1",
- "simple-concat": "^1.0.0"
- }
- },
"node_modules/sinon": {
"version": "9.2.4",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.4.tgz",
@@ -14269,48 +14126,6 @@
"node": ">= 10"
}
},
- "node_modules/tar-fs": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
- "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
- "dev": true,
- "dependencies": {
- "chownr": "^1.1.1",
- "mkdirp-classic": "^0.5.2",
- "pump": "^3.0.0",
- "tar-stream": "^2.1.4"
- }
- },
- "node_modules/tar-stream": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
- "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
- "dev": true,
- "dependencies": {
- "bl": "^4.0.3",
- "end-of-stream": "^1.4.1",
- "fs-constants": "^1.0.0",
- "inherits": "^2.0.3",
- "readable-stream": "^3.1.1"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/tar-stream/node_modules/readable-stream": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
- "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
- "dev": true,
- "dependencies": {
- "inherits": "^2.0.3",
- "string_decoder": "^1.1.1",
- "util-deprecate": "^1.0.1"
- },
- "engines": {
- "node": ">= 6"
- }
- },
"node_modules/tar/node_modules/chownr": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
@@ -14648,18 +14463,6 @@
"typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta"
}
},
- "node_modules/tunnel-agent": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
- "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
- "dev": true,
- "dependencies": {
- "safe-buffer": "^5.0.1"
- },
- "engines": {
- "node": "*"
- }
- },
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -17239,6 +17042,12 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
+ "@napi-rs/cli": {
+ "version": "2.16.2",
+ "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.16.2.tgz",
+ "integrity": "sha512-U2aZfnr0s9KkXpZlYC0l5WxWCXL7vJUNpCnWMwq3T9GG9rhYAAUM9CTZsi1Z+0iR2LcHbfq9EfMgoqnuTyUjfg==",
+ "dev": true
+ },
"@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -18114,6 +17923,11 @@
"pkg-up": "2.0.0"
}
},
+ "@zowe/secrets-for-zowe-sdk": {
+ "version": "7.18.0-next.4",
+ "resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/@zowe/secrets-for-zowe-sdk/-/@zowe/secrets-for-zowe-sdk-7.18.0-next.4.tgz",
+ "integrity": "sha512-H3UElOA7UxZL+Ee3Q2cHCwF/T0s+SEv8Wof9kyzC0TiP71awBHZiPONY7bZIe3vbpRlckt2ECcG/os6qrDrjJw=="
+ },
"abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
@@ -19407,15 +19221,6 @@
"esprima": "4.0.1"
}
},
- "decompress-response": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
- "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
- "dev": true,
- "requires": {
- "mimic-response": "^3.1.0"
- }
- },
"dedent": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz",
@@ -19536,12 +19341,6 @@
}
}
},
- "detect-libc": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz",
- "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==",
- "dev": true
- },
"detect-newline": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
@@ -20219,12 +20018,6 @@
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=",
"dev": true
},
- "expand-template": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
- "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
- "dev": true
- },
"expect": {
"version": "28.1.3",
"resolved": "https://registry.npmjs.org/expect/-/expect-28.1.3.tgz",
@@ -20418,12 +20211,6 @@
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=",
"dev": true
},
- "fs-constants": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
- "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
- "dev": true
- },
"fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
@@ -20540,12 +20327,6 @@
"pump": "^3.0.0"
}
},
- "github-from-package": {
- "version": "0.0.0",
- "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
- "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
- "dev": true
- },
"github-markdown-css": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/github-markdown-css/-/github-markdown-css-5.1.0.tgz",
@@ -23494,16 +23275,6 @@
"integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==",
"dev": true
},
- "keytar": {
- "version": "7.9.0",
- "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz",
- "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==",
- "dev": true,
- "requires": {
- "node-addon-api": "^4.3.0",
- "prebuild-install": "^7.0.1"
- }
- },
"kleur": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
@@ -23911,12 +23682,6 @@
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
"dev": true
},
- "mimic-response": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
- "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
- "dev": true
- },
"minimatch": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
@@ -24004,12 +23769,6 @@
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
},
- "mkdirp-classic": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
- "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
- "dev": true
- },
"module-definition": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/module-definition/-/module-definition-3.3.1.tgz",
@@ -24068,12 +23827,6 @@
"integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==",
"dev": true
},
- "napi-build-utils": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
- "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==",
- "dev": true
- },
"natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@@ -24122,21 +23875,6 @@
}
}
},
- "node-abi": {
- "version": "3.24.0",
- "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.24.0.tgz",
- "integrity": "sha512-YPG3Co0luSu6GwOBsmIdGW6Wx0NyNDLg/hriIyDllVsNwnI6UeqaWShxC3lbH4LtEQUgoLP3XR1ndXiDAWvmRw==",
- "dev": true,
- "requires": {
- "semver": "^7.3.5"
- }
- },
- "node-addon-api": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
- "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==",
- "dev": true
- },
"node-cleanup": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/node-cleanup/-/node-cleanup-2.1.2.tgz",
@@ -24795,26 +24533,6 @@
"uniq": "^1.0.1"
}
},
- "prebuild-install": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz",
- "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==",
- "dev": true,
- "requires": {
- "detect-libc": "^2.0.0",
- "expand-template": "^2.0.3",
- "github-from-package": "0.0.0",
- "minimist": "^1.2.3",
- "mkdirp-classic": "^0.5.3",
- "napi-build-utils": "^1.0.1",
- "node-abi": "^3.3.0",
- "pump": "^3.0.0",
- "rc": "^1.2.7",
- "simple-get": "^4.0.0",
- "tar-fs": "^2.0.0",
- "tunnel-agent": "^0.6.0"
- }
- },
"precinct": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/precinct/-/precinct-7.1.0.tgz",
@@ -25501,23 +25219,6 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
- "simple-concat": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
- "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
- "dev": true
- },
- "simple-get": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
- "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
- "dev": true,
- "requires": {
- "decompress-response": "^6.0.0",
- "once": "^1.3.1",
- "simple-concat": "^1.0.0"
- }
- },
"sinon": {
"version": "9.2.4",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.4.tgz",
@@ -25869,44 +25570,6 @@
}
}
},
- "tar-fs": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
- "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
- "dev": true,
- "requires": {
- "chownr": "^1.1.1",
- "mkdirp-classic": "^0.5.2",
- "pump": "^3.0.0",
- "tar-stream": "^2.1.4"
- }
- },
- "tar-stream": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
- "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
- "dev": true,
- "requires": {
- "bl": "^4.0.3",
- "end-of-stream": "^1.4.1",
- "fs-constants": "^1.0.0",
- "inherits": "^2.0.3",
- "readable-stream": "^3.1.1"
- },
- "dependencies": {
- "readable-stream": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
- "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
- "dev": true,
- "requires": {
- "inherits": "^2.0.3",
- "string_decoder": "^1.1.1",
- "util-deprecate": "^1.0.1"
- }
- }
- }
- },
"temp": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/temp/-/temp-0.4.0.tgz",
@@ -26148,15 +25811,6 @@
"tslib": "^1.8.1"
}
},
- "tunnel-agent": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
- "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
- "dev": true,
- "requires": {
- "safe-buffer": "^5.0.1"
- }
- },
"type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
diff --git a/package.json b/package.json
index 9cea29ec4..47a7ecda1 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,7 @@
"dependencies": {
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
- "@zowe/secrets-for-zowe-sdk": "7.18.0-next.1",
+ "@zowe/secrets-for-zowe-sdk": "7.18.0-next.4",
"chalk": "2.4.2",
"cli-table3": "0.6.2",
"comment-json": "4.1.1",
From 3e4b030e9a47dac0f969fca21ff5e06bbb4cb7f5 Mon Sep 17 00:00:00 2001
From: Trae Yelovich
Date: Tue, 1 Aug 2023 10:50:30 -0400
Subject: [PATCH 10/11] chore: update CHANGELOG
Signed-off-by: Trae Yelovich
---
CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7eeaf1b23..36b4fcc80 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
All notable changes to the Imperative package will be documented in this file.
+## Recent Changes
+
+- Enhancement: Replaced use of `node-keytar` with the new `keyring` module from `@zowe/secrets-for-zowe-sdk`. [zowe-cli#1622](https://github.com/zowe/zowe-cli/issues/1622)
+
## `5.17.0`
- Enhancement: Added `inSchema` property for ProfileInfo to indicate if argument is a known schema argument [#899](https://github.com/zowe/imperative/issues/899)
From fff54a3f6c49a9c2680a1e9ef62e29520be22870 Mon Sep 17 00:00:00 2001
From: Trae Yelovich
Date: Wed, 2 Aug 2023 10:39:42 -0400
Subject: [PATCH 11/11] fix: Add secrets SDK as dev. dep, remove resolve helper
Signed-off-by: Trae Yelovich
---
.../__integration__/imperative/package.json | 2 +-
package-lock.json | 29 +++----------------
package.json | 3 +-
.../DefaultCredentialManager.test.ts | 6 ++--
.../security/src/DefaultCredentialManager.ts | 6 +---
5 files changed, 10 insertions(+), 36 deletions(-)
diff --git a/__tests__/__integration__/imperative/package.json b/__tests__/__integration__/imperative/package.json
index 0c339c014..4c35fd256 100644
--- a/__tests__/__integration__/imperative/package.json
+++ b/__tests__/__integration__/imperative/package.json
@@ -35,7 +35,7 @@
},
"dependencies": {
"@zowe/imperative": "../../..",
- "@zowe/secrets-for-zowe-sdk": "7.18.0-next.1"
+ "@zowe/secrets-for-zowe-sdk": "7.18.0-next.4"
},
"engines": {
"node": ">=8.0.0"
diff --git a/package-lock.json b/package-lock.json
index 4b1587f6e..7a86d1c0b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,7 +11,6 @@
"dependencies": {
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
- "@zowe/secrets-for-zowe-sdk": "7.18.0-next.4",
"chalk": "2.4.2",
"cli-table3": "0.6.2",
"comment-json": "4.1.1",
@@ -49,7 +48,6 @@
"yargs": "15.3.1"
},
"devDependencies": {
- "@napi-rs/cli": "^2.16.1",
"@types/cross-spawn": "^6.0.2",
"@types/diff": "^5.0.2",
"@types/find-up": "^2.1.1",
@@ -70,6 +68,7 @@
"@types/which": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
+ "@zowe/secrets-for-zowe-sdk": "^7.18.0-next.4",
"ansi-colors": "^4.1.1",
"clear-require": "^2.0.0",
"concurrently": "^7.5.0",
@@ -2832,22 +2831,6 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
- "node_modules/@napi-rs/cli": {
- "version": "2.16.2",
- "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.16.2.tgz",
- "integrity": "sha512-U2aZfnr0s9KkXpZlYC0l5WxWCXL7vJUNpCnWMwq3T9GG9rhYAAUM9CTZsi1Z+0iR2LcHbfq9EfMgoqnuTyUjfg==",
- "dev": true,
- "bin": {
- "napi": "scripts/index.js"
- },
- "engines": {
- "node": ">= 10"
- },
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/Brooooooklyn"
- }
- },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -4025,6 +4008,7 @@
"version": "7.18.0-next.4",
"resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/@zowe/secrets-for-zowe-sdk/-/@zowe/secrets-for-zowe-sdk-7.18.0-next.4.tgz",
"integrity": "sha512-H3UElOA7UxZL+Ee3Q2cHCwF/T0s+SEv8Wof9kyzC0TiP71awBHZiPONY7bZIe3vbpRlckt2ECcG/os6qrDrjJw==",
+ "dev": true,
"hasInstallScript": true,
"engines": {
"node": ">= 14"
@@ -17042,12 +17026,6 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
- "@napi-rs/cli": {
- "version": "2.16.2",
- "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.16.2.tgz",
- "integrity": "sha512-U2aZfnr0s9KkXpZlYC0l5WxWCXL7vJUNpCnWMwq3T9GG9rhYAAUM9CTZsi1Z+0iR2LcHbfq9EfMgoqnuTyUjfg==",
- "dev": true
- },
"@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -17926,7 +17904,8 @@
"@zowe/secrets-for-zowe-sdk": {
"version": "7.18.0-next.4",
"resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/@zowe/secrets-for-zowe-sdk/-/@zowe/secrets-for-zowe-sdk-7.18.0-next.4.tgz",
- "integrity": "sha512-H3UElOA7UxZL+Ee3Q2cHCwF/T0s+SEv8Wof9kyzC0TiP71awBHZiPONY7bZIe3vbpRlckt2ECcG/os6qrDrjJw=="
+ "integrity": "sha512-H3UElOA7UxZL+Ee3Q2cHCwF/T0s+SEv8Wof9kyzC0TiP71awBHZiPONY7bZIe3vbpRlckt2ECcG/os6qrDrjJw==",
+ "dev": true
},
"abbrev": {
"version": "1.1.1",
diff --git a/package.json b/package.json
index 47a7ecda1..732a06183 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,6 @@
"dependencies": {
"@types/yargs": "13.0.4",
"@zowe/perf-timing": "1.0.7",
- "@zowe/secrets-for-zowe-sdk": "7.18.0-next.4",
"chalk": "2.4.2",
"cli-table3": "0.6.2",
"comment-json": "4.1.1",
@@ -92,7 +91,6 @@
"yargs": "15.3.1"
},
"devDependencies": {
- "@napi-rs/cli": "^2.16.1",
"@types/cross-spawn": "^6.0.2",
"@types/diff": "^5.0.2",
"@types/find-up": "^2.1.1",
@@ -113,6 +111,7 @@
"@types/which": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
+ "@zowe/secrets-for-zowe-sdk": "^7.18.0-next.4",
"ansi-colors": "^4.1.1",
"clear-require": "^2.0.0",
"concurrently": "^7.5.0",
diff --git a/packages/security/__tests__/DefaultCredentialManager.test.ts b/packages/security/__tests__/DefaultCredentialManager.test.ts
index c802eb332..ea415ba2a 100644
--- a/packages/security/__tests__/DefaultCredentialManager.test.ts
+++ b/packages/security/__tests__/DefaultCredentialManager.test.ts
@@ -78,7 +78,7 @@ describe("DefaultCredentialManager", () => {
const fakeCliPath = "/root/fakeCli";
const mainModule = process.mainModule;
process.mainModule = { filename: fakeCliPath } as any;
- const pathResolveSpy = jest.spyOn(DefaultCredentialManager.prototype, "resolveDep").mockReturnValue(fakeCliPath);
+ const resolveSpy = jest.spyOn(path, "resolve").mockReturnValue(fakeCliPath);
// Force enter the try catch
Object.defineProperty(manager, "keytar", {
@@ -92,11 +92,11 @@ describe("DefaultCredentialManager", () => {
expect(privateManager.loadError).toBeInstanceOf(ImperativeError);
const error: Error = privateManager.loadError.causeErrors;
expect(error).toBeDefined();
- expect(error.message).toContain("Cannot find module");
+ expect(error.message).toContain("Cannot resolve module");
expect(error.message).toContain(fakeCliPath);
} finally {
process.mainModule = mainModule;
- pathResolveSpy.mockRestore();
+ resolveSpy.mockRestore();
}
});
diff --git a/packages/security/src/DefaultCredentialManager.ts b/packages/security/src/DefaultCredentialManager.ts
index 4eb6a9735..8a2b9e43e 100644
--- a/packages/security/src/DefaultCredentialManager.ts
+++ b/packages/security/src/DefaultCredentialManager.ts
@@ -103,10 +103,6 @@ export class DefaultCredentialManager extends AbstractCredentialManager {
}
}
- public resolveDep(name: string, opts?: { paths: string[] }) {
- return require.resolve(name, opts);
- }
-
/**
* Called by {@link CredentialManagerFactory.initialize} before the freeze of the object. This
* gives us a chance to load keytar into the class before we are locked down. If a load failure
@@ -128,7 +124,7 @@ export class DefaultCredentialManager extends AbstractCredentialManager {
requireOpts.paths = [process.mainModule.filename, ...require.resolve.paths("@zowe/secrets-for-zowe-sdk")];
}
// use helper function for require.resolve so it can be mocked in jest tests
- const keytarPath = this.resolveDep("@zowe/secrets-for-zowe-sdk", requireOpts);
+ const keytarPath = require.resolve("@zowe/secrets-for-zowe-sdk", requireOpts);
Logger.getImperativeLogger().debug("Loading Keytar module from", keytarPath);
this.keytar = (await import(keytarPath)).keyring;
} catch (error) {