@vercel/oidc 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vercel/oidc
2
2
 
3
+ ## 3.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - bf07448: Revert "auth: Make it possible to store CLI credentials in OS keychain (#16083)"
8
+
3
9
  ## 3.3.0
4
10
 
5
11
  ### Minor Changes
@@ -1,9 +1,7 @@
1
1
  /**
2
- * Auth configuration stored in ~/.../com.vercel.cli/auth.json or OS keyring
2
+ * Auth configuration stored in ~/.../com.vercel.cli/auth.json
3
3
  */
4
4
  export interface AuthConfig {
5
- '// Note'?: string;
6
- '// Docs'?: string;
7
5
  /** An `access_token` obtained using the OAuth Device Authorization flow. */
8
6
  token?: string;
9
7
  /** A `refresh_token` obtained using the OAuth Device Authorization flow. */
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var auth_config_exports = {};
20
30
  __export(auth_config_exports, {
@@ -23,35 +33,40 @@ __export(auth_config_exports, {
23
33
  writeAuthConfig: () => writeAuthConfig
24
34
  });
25
35
  module.exports = __toCommonJS(auth_config_exports);
36
+ var fs = __toESM(require("fs"));
37
+ var path = __toESM(require("path"));
26
38
  var import_token_util = require("./token-util");
27
- const {
28
- clearAllCredentialsStrict,
29
- hasCredentials,
30
- readCredentials,
31
- writeCredentials
32
- } = require("@vercel/cli-auth/credentials-store.js");
33
- function getAuthConfigDir() {
39
+ function getAuthConfigPath() {
34
40
  const dataDir = (0, import_token_util.getVercelDataDir)();
35
41
  if (!dataDir) {
36
42
  throw new Error(
37
43
  `Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`
38
44
  );
39
45
  }
40
- return dataDir;
46
+ return path.join(dataDir, "auth.json");
41
47
  }
42
48
  function readAuthConfig() {
43
49
  try {
44
- return readCredentials(getAuthConfigDir());
50
+ const authPath = getAuthConfigPath();
51
+ if (!fs.existsSync(authPath)) {
52
+ return null;
53
+ }
54
+ const content = fs.readFileSync(authPath, "utf8");
55
+ if (!content) {
56
+ return null;
57
+ }
58
+ return JSON.parse(content);
45
59
  } catch (_error) {
46
60
  return null;
47
61
  }
48
62
  }
49
63
  function writeAuthConfig(config) {
50
- if (hasCredentials(config)) {
51
- writeCredentials(getAuthConfigDir(), config);
52
- return;
64
+ const authPath = getAuthConfigPath();
65
+ const authDir = path.dirname(authPath);
66
+ if (!fs.existsSync(authDir)) {
67
+ fs.mkdirSync(authDir, { mode: 504, recursive: true });
53
68
  }
54
- clearAllCredentialsStrict(getAuthConfigDir());
69
+ fs.writeFileSync(authPath, JSON.stringify(config, null, 2), { mode: 384 });
55
70
  }
56
71
  function isValidAccessToken(authConfig, expirationBufferMs = 0) {
57
72
  if (!authConfig.token)
@@ -54,10 +54,6 @@ import_vitest.vi.mock("./get-context", () => ({
54
54
  fs.mkdirSync(path.join(rootDir, ".vercel"), {
55
55
  recursive: true
56
56
  });
57
- fs.writeFileSync(
58
- path.join(cliDataDir, "config.json"),
59
- JSON.stringify({ authTokenStorage: "file" })
60
- );
61
57
  import_vitest.vi.spyOn(process, "cwd").mockReturnValue(rootDir);
62
58
  import_vitest.vi.mocked(import_token_io.findRootDir).mockReturnValue(rootDir);
63
59
  import_vitest.vi.mocked(import_token_io.getUserDataDir).mockReturnValue(userDataDir);
@@ -49,14 +49,7 @@ import_vitest.vi.mock("./token-io");
49
49
  fs.mkdirSync(path.join(rootDir, ".vercel"), {
50
50
  recursive: true
51
51
  });
52
- fs.writeFileSync(
53
- path.join(cliDataDir, "config.json"),
54
- JSON.stringify({ authTokenStorage: "file" })
55
- );
56
- fs.writeFileSync(
57
- path.join(cliDataDir, "auth.json"),
58
- JSON.stringify({ token: "test" })
59
- );
52
+ fs.writeFileSync(path.join(cliDataDir, "auth.json"), '{token: "test"}');
60
53
  fs.writeFileSync(
61
54
  path.join(rootDir, ".vercel", "project.json"),
62
55
  JSON.stringify({ projectId })
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "require": "./dist/index.js"
18
18
  }
19
19
  },
20
- "version": "3.3.0",
20
+ "version": "3.3.1",
21
21
  "repository": {
22
22
  "directory": "packages/oidc",
23
23
  "type": "git",
@@ -26,9 +26,6 @@
26
26
  "bugs": {
27
27
  "url": "https://github.com/vercel/vercel/issues"
28
28
  },
29
- "dependencies": {
30
- "@vercel/cli-auth": "0.1.0"
31
- },
32
29
  "devDependencies": {
33
30
  "prettier": "3.8.3",
34
31
  "tinyspawn": "1.3.1",