@aigne/secrets 0.1.1-beta.2 → 0.1.2-beta

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,36 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.2-beta](https://github.com/AIGNE-io/aigne-framework/compare/secrets-v0.1.1...secrets-v0.1.2-beta) (2025-11-28)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * bump version ([ba7ad18](https://github.com/AIGNE-io/aigne-framework/commit/ba7ad184fcf32b49bf0507a3cb638d20fb00690d))
9
+ * **secrets:** use workspace protocol for @aigne/core dependency ([895f127](https://github.com/AIGNE-io/aigne-framework/commit/895f12791d788f9d7298504ab3de5425710b3292))
10
+
11
+
12
+ ### Dependencies
13
+
14
+ * The following workspace dependencies were updated
15
+ * dependencies
16
+ * @aigne/core bumped to 1.69.2-beta
17
+
18
+ ## [0.1.1](https://github.com/AIGNE-io/aigne-framework/compare/secrets-v0.1.1-beta.3...secrets-v0.1.1) (2025-11-28)
19
+
20
+
21
+ ### Dependencies
22
+
23
+ * The following workspace dependencies were updated
24
+ * dependencies
25
+ * @aigne/core bumped from ^1.69.0 to ^1.69.1
26
+
27
+ ## [0.1.1-beta.3](https://github.com/AIGNE-io/aigne-framework/compare/secrets-v0.1.1-beta.2...secrets-v0.1.1-beta.3) (2025-11-27)
28
+
29
+
30
+ ### Bug Fixes
31
+
32
+ * **secrets:** simplify default item handling in KeyringStore ([#780](https://github.com/AIGNE-io/aigne-framework/issues/780)) ([4c1ff51](https://github.com/AIGNE-io/aigne-framework/commit/4c1ff51e982ed5787df37b127a381276537ec92f))
33
+
3
34
  ## [0.1.1-beta.2](https://github.com/AIGNE-io/aigne-framework/compare/secrets-v0.1.1-beta.1...secrets-v0.1.1-beta.2) (2025-11-27)
4
35
 
5
36
 
@@ -3,7 +3,6 @@ import type { CredentialEntry, ItemInfo, StoreOptions } from "./types.js";
3
3
  export declare class KeyringStore extends BaseSecretStore {
4
4
  private _impl;
5
5
  private serviceName;
6
- private defaultAccount;
7
6
  private _forceUnavailable;
8
7
  private _environmentChecked;
9
8
  private _environmentReady;
package/lib/cjs/keytar.js CHANGED
@@ -38,11 +38,10 @@ const logger_js_1 = require("@aigne/core/utils/logger.js");
38
38
  const base_js_1 = require("./base.js");
39
39
  const util_js_1 = require("./util.js");
40
40
  const DEFAULT_SERVICE_NAME = "-api-key";
41
- const DEFAULT_ACCOUNT_NAME_FOR_DEFAULT = "-default";
41
+ const DEFAULT_ACCOUNT_NAME_FOR_DEFAULT = "default";
42
42
  class KeyringStore extends base_js_1.BaseSecretStore {
43
43
  _impl = null;
44
44
  serviceName;
45
- defaultAccount;
46
45
  _forceUnavailable;
47
46
  _environmentChecked = false;
48
47
  _environmentReady = false;
@@ -50,7 +49,6 @@ class KeyringStore extends base_js_1.BaseSecretStore {
50
49
  super();
51
50
  const { serviceName, forceKeytarUnavailable = false } = options;
52
51
  this.serviceName = `${serviceName}${DEFAULT_SERVICE_NAME}`;
53
- this.defaultAccount = `${serviceName}${DEFAULT_ACCOUNT_NAME_FOR_DEFAULT}`;
54
52
  this._forceUnavailable = !!forceKeytarUnavailable;
55
53
  }
56
54
  async available() {
@@ -126,7 +124,9 @@ class KeyringStore extends base_js_1.BaseSecretStore {
126
124
  try {
127
125
  if (typeof this._impl.findCredentials === "function") {
128
126
  const list = await this._impl.findCredentials(this.serviceName);
129
- return Array.isArray(list) && list.length > 0 ? list : null;
127
+ return Array.isArray(list) && list.length > 0
128
+ ? list.filter((c) => c.account !== DEFAULT_ACCOUNT_NAME_FOR_DEFAULT)
129
+ : null;
130
130
  }
131
131
  return null;
132
132
  }
@@ -165,33 +165,21 @@ class KeyringStore extends base_js_1.BaseSecretStore {
165
165
  throw new Error("Keyring not available");
166
166
  if (!this._impl)
167
167
  throw new Error("Keyring not loaded");
168
- const account = this.defaultAccount;
169
- return this._impl.setPassword(account, account, JSON.stringify(value));
168
+ return this.setItem(DEFAULT_ACCOUNT_NAME_FOR_DEFAULT, value);
170
169
  }
171
170
  async getDefaultItem() {
172
171
  if (!(await this.available()))
173
172
  return null;
174
173
  if (!this._impl)
175
174
  return null;
176
- const account = this.defaultAccount;
177
- try {
178
- const value = await this._impl.getPassword(account, account);
179
- if (!value)
180
- return null;
181
- return this.parseKey(value);
182
- }
183
- catch {
184
- // ignore
185
- }
186
- return null;
175
+ return this.getItem(DEFAULT_ACCOUNT_NAME_FOR_DEFAULT);
187
176
  }
188
177
  async deleteDefaultItem() {
189
178
  if (!(await this.available()))
190
179
  throw new Error("Keyring not available");
191
180
  if (!this._impl)
192
181
  throw new Error("Keyring not loaded");
193
- const account = this.defaultAccount;
194
- await this._impl.deletePassword(account, account);
182
+ await this.deleteItem(DEFAULT_ACCOUNT_NAME_FOR_DEFAULT);
195
183
  }
196
184
  }
197
185
  exports.KeyringStore = KeyringStore;
@@ -3,7 +3,6 @@ import type { CredentialEntry, ItemInfo, StoreOptions } from "./types.js";
3
3
  export declare class KeyringStore extends BaseSecretStore {
4
4
  private _impl;
5
5
  private serviceName;
6
- private defaultAccount;
7
6
  private _forceUnavailable;
8
7
  private _environmentChecked;
9
8
  private _environmentReady;
package/lib/esm/keytar.js CHANGED
@@ -2,11 +2,10 @@ import { logger } from "@aigne/core/utils/logger.js";
2
2
  import { BaseSecretStore } from "./base.js";
3
3
  import { isKeyringEnvironmentReady } from "./util.js";
4
4
  const DEFAULT_SERVICE_NAME = "-api-key";
5
- const DEFAULT_ACCOUNT_NAME_FOR_DEFAULT = "-default";
5
+ const DEFAULT_ACCOUNT_NAME_FOR_DEFAULT = "default";
6
6
  export class KeyringStore extends BaseSecretStore {
7
7
  _impl = null;
8
8
  serviceName;
9
- defaultAccount;
10
9
  _forceUnavailable;
11
10
  _environmentChecked = false;
12
11
  _environmentReady = false;
@@ -14,7 +13,6 @@ export class KeyringStore extends BaseSecretStore {
14
13
  super();
15
14
  const { serviceName, forceKeytarUnavailable = false } = options;
16
15
  this.serviceName = `${serviceName}${DEFAULT_SERVICE_NAME}`;
17
- this.defaultAccount = `${serviceName}${DEFAULT_ACCOUNT_NAME_FOR_DEFAULT}`;
18
16
  this._forceUnavailable = !!forceKeytarUnavailable;
19
17
  }
20
18
  async available() {
@@ -90,7 +88,9 @@ export class KeyringStore extends BaseSecretStore {
90
88
  try {
91
89
  if (typeof this._impl.findCredentials === "function") {
92
90
  const list = await this._impl.findCredentials(this.serviceName);
93
- return Array.isArray(list) && list.length > 0 ? list : null;
91
+ return Array.isArray(list) && list.length > 0
92
+ ? list.filter((c) => c.account !== DEFAULT_ACCOUNT_NAME_FOR_DEFAULT)
93
+ : null;
94
94
  }
95
95
  return null;
96
96
  }
@@ -129,33 +129,21 @@ export class KeyringStore extends BaseSecretStore {
129
129
  throw new Error("Keyring not available");
130
130
  if (!this._impl)
131
131
  throw new Error("Keyring not loaded");
132
- const account = this.defaultAccount;
133
- return this._impl.setPassword(account, account, JSON.stringify(value));
132
+ return this.setItem(DEFAULT_ACCOUNT_NAME_FOR_DEFAULT, value);
134
133
  }
135
134
  async getDefaultItem() {
136
135
  if (!(await this.available()))
137
136
  return null;
138
137
  if (!this._impl)
139
138
  return null;
140
- const account = this.defaultAccount;
141
- try {
142
- const value = await this._impl.getPassword(account, account);
143
- if (!value)
144
- return null;
145
- return this.parseKey(value);
146
- }
147
- catch {
148
- // ignore
149
- }
150
- return null;
139
+ return this.getItem(DEFAULT_ACCOUNT_NAME_FOR_DEFAULT);
151
140
  }
152
141
  async deleteDefaultItem() {
153
142
  if (!(await this.available()))
154
143
  throw new Error("Keyring not available");
155
144
  if (!this._impl)
156
145
  throw new Error("Keyring not loaded");
157
- const account = this.defaultAccount;
158
- await this._impl.deletePassword(account, account);
146
+ await this.deleteItem(DEFAULT_ACCOUNT_NAME_FOR_DEFAULT);
159
147
  }
160
148
  }
161
149
  export default KeyringStore;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/secrets",
3
- "version": "0.1.1-beta.2",
3
+ "version": "0.1.2-beta",
4
4
  "description": "Secure credential storage for AIGNE Hub API keys with system keyring and file-based fallback",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -44,9 +44,9 @@
44
44
  }
45
45
  },
46
46
  "dependencies": {
47
- "@aigne/core": "^1.69.0",
48
47
  "@zowe/secrets-for-zowe-sdk": "^8.29.4",
49
- "yaml": "^2.8.1"
48
+ "yaml": "^2.8.1",
49
+ "@aigne/core": "^1.69.2-beta"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/bun": "^1.2.22",