@appsemble/node-utils 0.37.5 → 0.37.6

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/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.37.5/config/assets/logo.svg) Appsemble Node Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.37.6/config/assets/logo.svg) Appsemble Node Utilities
2
2
 
3
3
  > NodeJS utilities used by Appsemble internally.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/node-utils)](https://www.npmjs.com/package/@appsemble/node-utils)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.37.5/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.37.5)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.37.6/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.37.6)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -26,5 +26,5 @@ compatibility is not guaranteed.
26
26
 
27
27
  ## License
28
28
 
29
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.37.5/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.37.6/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
@@ -1,6 +1,14 @@
1
1
  export declare const CREDENTIALS_ENV_VAR = "APPSEMBLE_CLIENT_CREDENTIALS";
2
2
  export declare function getService(remote: string): string;
3
- export declare function getKeytar(): Promise<typeof import('keytar')>;
3
+ export interface Keyring {
4
+ findCredentials: (service: string) => Promise<{
5
+ account: string;
6
+ password: string;
7
+ }[]>;
8
+ setPassword: (service: string, account: string, password: string) => Promise<void>;
9
+ deletePassword: (service: string, account: string) => Promise<void>;
10
+ }
11
+ export declare function getKeyring(): Promise<Keyring>;
4
12
  /**
5
13
  * Login to the server using OAuth2 client credentials.
6
14
  *
package/authentication.js CHANGED
@@ -6,15 +6,24 @@ const authorizedRemotes = new Set();
6
6
  export function getService(remote) {
7
7
  return `appsemble://${new URL(remote).host}`;
8
8
  }
9
- export async function getKeytar() {
9
+ async function importKeyring() {
10
10
  try {
11
- const { default: keytar } = await import('keytar');
12
- return keytar;
11
+ return await import('@napi-rs/keyring');
13
12
  }
14
13
  catch {
15
- throw new AppsembleError('Couldn’t find module keytar. Either install libsecret and reinstall @appsemble/cli, or pass --client-credentials on the command line.');
14
+ throw new AppsembleError('Couldn’t access the system keyring. Reinstall @appsemble/cli, or pass --client-credentials on the command line.');
16
15
  }
17
16
  }
17
+ export async function getKeyring() {
18
+ const { AsyncEntry, findCredentialsAsync } = await importKeyring();
19
+ return {
20
+ findCredentials: (service) => findCredentialsAsync(service),
21
+ setPassword: (service, account, password) => new AsyncEntry(service, account).setPassword(password),
22
+ async deletePassword(service, account) {
23
+ await new AsyncEntry(service, account).deletePassword();
24
+ },
25
+ };
26
+ }
18
27
  async function getClientCredentials(remote, inputCredentials) {
19
28
  if (inputCredentials) {
20
29
  return inputCredentials;
@@ -24,7 +33,7 @@ async function getClientCredentials(remote, inputCredentials) {
24
33
  logger.info(`Detected client credentials from ${CREDENTIALS_ENV_VAR} environment variable`);
25
34
  return envCredentials;
26
35
  }
27
- const { findCredentials } = await getKeytar();
36
+ const { findCredentials } = await getKeyring();
28
37
  const choices = await findCredentials(getService(remote));
29
38
  if (choices.length === 0) {
30
39
  throw new AppsembleError(`No client credentials found. Register them using:\n\nappsemble login --remote ${remote}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/node-utils",
3
- "version": "0.37.5",
3
+ "version": "0.37.6",
4
4
  "description": "NodeJS utilities used by Appsemble internally.",
5
5
  "keywords": [
6
6
  "app",
@@ -40,13 +40,14 @@
40
40
  "test": "vitest"
41
41
  },
42
42
  "dependencies": {
43
- "@appsemble/lang-sdk": "0.37.5",
44
- "@appsemble/types": "0.37.5",
45
- "@appsemble/utils": "0.37.5",
43
+ "@appsemble/lang-sdk": "0.37.6",
44
+ "@appsemble/types": "0.37.6",
45
+ "@appsemble/utils": "0.37.6",
46
46
  "@formatjs/fast-memoize": "^2.0.0",
47
47
  "@fortawesome/fontawesome-free": "^6.0.0",
48
48
  "@inquirer/prompts": "^8.0.0",
49
49
  "@kubernetes/client-node": "1.4.0",
50
+ "@napi-rs/keyring": "^1.3.0",
50
51
  "@odata/parser": "^0.2.0",
51
52
  "@types/koa": "^2.0.0",
52
53
  "axios": "^1.0.0",
@@ -69,7 +70,6 @@
69
70
  "intl-messageformat": "^11.0.0",
70
71
  "ipaddr.js": "^2.4.0",
71
72
  "jsonschema": "~1.4.1",
72
- "keytar": "^7.0.0",
73
73
  "koa": "^3.0.0",
74
74
  "koa-compose": "^4.0.0",
75
75
  "koa-mount": "^4.0.0",
@@ -83,7 +83,7 @@
83
83
  "lodash": "^4.0.0",
84
84
  "lodash-es": "^4.0.0",
85
85
  "logform": "^2.0.0",
86
- "memfs": "4.57.8",
86
+ "memfs": "4.68.1",
87
87
  "mime-types": "^2.0.0",
88
88
  "minio": "^8.0.7",
89
89
  "mustache": "^4.0.0",
@@ -115,7 +115,7 @@
115
115
  "@types/uuid": "10.0.0",
116
116
  "axios-mock-adapter": "1.22.0",
117
117
  "axios-test-instance": "7.0.0",
118
- "vitest": "2.1.9"
118
+ "vitest": "4.1.10"
119
119
  },
120
120
  "peerDependencies": {
121
121
  "prettier": "^3"