yggdrasil 1.6.1 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ jobs:
13
13
 
14
14
  strategy:
15
15
  matrix:
16
- node-version: [14.x]
16
+ node-version: [24.x]
17
17
 
18
18
  steps:
19
19
  - uses: actions/checkout@v2
@@ -23,4 +23,4 @@ jobs:
23
23
  node-version: ${{ matrix.node-version }}
24
24
  - run: npm install
25
25
  - run: npm run test
26
- - run: npm publish --dry-run
26
+ - run: npm pack --dry-run
@@ -0,0 +1,22 @@
1
+ name: Repo Commands
2
+
3
+ on:
4
+ issue_comment: # Handle comment commands
5
+ types: [created]
6
+ pull_request: # Handle renamed PRs
7
+ types: [edited]
8
+
9
+ jobs:
10
+ comment-trigger:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Check out repository
14
+ uses: actions/checkout@v3
15
+ - name: Run command handlers
16
+ uses: PrismarineJS/prismarine-repo-actions@master
17
+ with:
18
+ # NOTE: You must specify a Personal Access Token (PAT) with repo access here. While you can use the default GITHUB_TOKEN, actions taken with it will not trigger other actions, so if you have a CI workflow, commits created by this action will not trigger it.
19
+ token: ${{ secrets.PAT_PASSWORD }}
20
+ # See `Options` section below for more info on these options
21
+ install-command: npm install
22
+ /fixlint.fix-command: npm run fix
@@ -3,6 +3,9 @@ on:
3
3
  push:
4
4
  branches:
5
5
  - master # Change this to your default branch
6
+ permissions:
7
+ id-token: write
8
+ contents: write
6
9
  jobs:
7
10
  npm-publish:
8
11
  name: npm-publish
@@ -13,15 +16,14 @@ jobs:
13
16
  - name: Set up Node.js
14
17
  uses: actions/setup-node@master
15
18
  with:
16
- node-version: 14.0.0
19
+ node-version: 24
20
+ registry-url: 'https://registry.npmjs.org'
17
21
  - name: Install
18
22
  run: npm install
19
23
  - id: publish
20
- uses: JS-DevTools/npm-publish@v1
21
- with:
22
- token: ${{ secrets.NPM_AUTH_TOKEN }}
24
+ uses: JS-DevTools/npm-publish@v4
23
25
  - name: Create Release
24
- if: steps.publish.outputs.type != 'none'
26
+ if: ${{ steps.publish.outputs.type }}
25
27
  id: create_release
26
28
  uses: actions/create-release@v1
27
29
  env:
package/HISTORY.md CHANGED
@@ -1,5 +1,26 @@
1
1
  ## History
2
2
 
3
+ ## 1.8.0
4
+ * [Update CI to Node 24 (#149)](https://github.com/PrismarineJS/node-yggdrasil/commit/a87067b31e1bf9876dedd63ecb4ed87d70e6a59b) (thanks @rom1504)
5
+ * [Fix publish condition for npm-publish v4 (#148)](https://github.com/PrismarineJS/node-yggdrasil/commit/f55562b074295b5846dd2e147e4bbec909aeb578) (thanks @rom1504)
6
+ * [Switch to trusted publishing via OIDC (#147)](https://github.com/PrismarineJS/node-yggdrasil/commit/3f9723906857cd606aef0b49f00c134483277daf) (thanks @rom1504)
7
+ * [Bump @types/node from 20.17.1 to 22.8.0 (#137)](https://github.com/PrismarineJS/node-yggdrasil/commit/c2b1e534dc56d33d8ea0c1ba02ead058b9db07b1) (thanks @dependabot[bot])
8
+ * [node 22 (#138)](https://github.com/PrismarineJS/node-yggdrasil/commit/1057980539821fd5b1a4f17d1a4b9cdde72776d9) (thanks @rom1504)
9
+ * [Bump @types/uuid from 9.0.8 to 10.0.0 (#115)](https://github.com/PrismarineJS/node-yggdrasil/commit/72de067ea8a6cf5dcbbcecbefd6185403c9cb8ed) (thanks @dependabot[bot])
10
+ * [Bump uuid from 9.0.1 to 10.0.0 (#114)](https://github.com/PrismarineJS/node-yggdrasil/commit/d2a2d77b054af6af87298cadca181c8283aa4fc4) (thanks @dependabot[bot])
11
+ * [Add command gh workflow allowing to use release command in comments (#113)](https://github.com/PrismarineJS/node-yggdrasil/commit/06dbaf4fcf334d8d86c026caac5ad3241428ee9e) (thanks @rom1504)
12
+ * [Update to node 18.0.0 (#112)](https://github.com/PrismarineJS/node-yggdrasil/commit/bfc45c46032ad3a54ab2bb1e9c91e6e40b90bede) (thanks @rom1504)
13
+ * [Bump @types/node from 18.16.13 to 20.2.1 (#110)](https://github.com/PrismarineJS/node-yggdrasil/commit/2b81fed365ca2d1368174e8f702e6381eb415f9a) (thanks @dependabot[bot])
14
+ * [Bump @types/uuid from 8.3.4 to 9.0.0 (#101)](https://github.com/PrismarineJS/node-yggdrasil/commit/a59f8a577c0b4e67cbd7a9c72dc50588d4a64a65) (thanks @dependabot[bot])
15
+ * [Bump uuid from 8.3.2 to 9.0.0 (#100)](https://github.com/PrismarineJS/node-yggdrasil/commit/bfef9e7e1621c7bc9c048f9c6fe0ba42c998b5d3) (thanks @dependabot[bot])
16
+ * [Bump @types/node from 17.0.45 to 18.6.4 (#99)](https://github.com/PrismarineJS/node-yggdrasil/commit/7dba6540f21e914f24311c1bb8932537403d1e7c) (thanks @dependabot[bot])
17
+ * [Bump mocha from 9.2.2 to 10.0.0 (#90)](https://github.com/PrismarineJS/node-yggdrasil/commit/fc9f9a3b5c728215f523f1bc5e29578e96adcf82) (thanks @dependabot[bot])
18
+ * [Bump standard from 16.0.4 to 17.0.0 (#89)](https://github.com/PrismarineJS/node-yggdrasil/commit/02f5962eac558396b87a7be207013a19194aea1f) (thanks @dependabot[bot])
19
+
20
+ ## 1.7.0
21
+ * Add new endpoint to invalidate all accessTokens using current valid accessToken and clientToken
22
+ * Fixed "call" function throwing an empty error message
23
+
3
24
  ## 1.6.1
4
25
  * Properly escape the username
5
26
 
package/README.md CHANGED
@@ -46,6 +46,12 @@ ygg.validate(token).then(
46
46
  (error)=>{}
47
47
  );
48
48
 
49
+ //Invalidate all accessTokens using a current valid accessToken and clientToken.
50
+ ygg.invalidate(accessToken, clientToken).then(
51
+ (response)=>{},
52
+ (error)=>{}
53
+ );
54
+
49
55
  //Invalidate all accessTokens
50
56
  ygg.signout(username, password).then(
51
57
  (response)=>{},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yggdrasil",
3
- "version": "1.6.1",
3
+ "version": "1.8.0",
4
4
  "author": "Zeke Sonxx <zeke@zekesonxx.com>",
5
5
  "description": "Mojang authentication (Yggdrasil) client",
6
6
  "scripts": {
@@ -24,15 +24,15 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "node-fetch": "^2.6.1",
27
- "uuid": "^8.2.0"
27
+ "uuid": "^10.0.0"
28
28
  },
29
29
  "license": "MIT",
30
30
  "devDependencies": {
31
- "@types/node": "^16.0.0",
32
- "@types/node-fetch": "^2.5.8",
33
- "@types/uuid": "^8.3.0",
34
- "mocha": "^9.0.0",
31
+ "@types/node": "^22.8.0",
32
+ "@types/node-fetch": "^3.0.3",
33
+ "@types/uuid": "^10.0.0",
34
+ "mocha": "^10.0.0",
35
35
  "nock": "^13.0.2",
36
- "standard": "^16.0.3"
36
+ "standard": "^17.0.0"
37
37
  }
38
- }
38
+ }
package/src/Client.js CHANGED
@@ -63,11 +63,21 @@ function loader (moduleOptions) {
63
63
  async function signout (username, password) {
64
64
  return await utils.call(moduleOptions?.host ?? defaultHost, 'signout', { username, password }, moduleOptions?.agent)
65
65
  }
66
+
67
+ /**
68
+ * Invalidates all access tokens using client/access token pair.
69
+ * @param {String} clientToken Client Token
70
+ * @param {String} accessToken Access Token
71
+ */
72
+ async function invalidate (accessToken, clientToken) {
73
+ return await utils.call(moduleOptions?.host ?? defaultHost, 'invalidate', { accessToken, clientToken }, moduleOptions?.agent)
74
+ }
66
75
  return {
67
76
  auth: utils.callbackify(auth, 1),
68
77
  refresh: utils.callbackify(refresh, 3),
69
78
  signout: utils.callbackify(signout, 1),
70
- validate: utils.callbackify(validate, 2)
79
+ validate: utils.callbackify(validate, 2),
80
+ invalidate: utils.callbackify(invalidate, 2)
71
81
  }
72
82
  }
73
83
 
package/src/utils.js CHANGED
@@ -32,7 +32,7 @@ async function call (host, path, data, agent) {
32
32
  throw e
33
33
  }
34
34
  }
35
- if (body?.error !== undefined) throw new Error(body?.errorMessage)
35
+ if (body?.error !== undefined) throw new Error(body?.errorMessage ?? body?.error)
36
36
  return body
37
37
  }
38
38
  /**