comty.js 0.60.4 → 0.60.5

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.
@@ -92,6 +92,29 @@ var _session = require('../session'); var _session2 = _interopRequireDefault(_se
92
92
  return response
93
93
  }
94
94
 
95
+ /**
96
+ * Verifies the given token and returns the user data associated with it.
97
+ *
98
+ * @param {string} [token] - The token to verify. If not provided, the stored token is used.
99
+ * @return {Promise<Object>} A Promise that resolves with the user data if the token is valid, or false if the token is invalid.
100
+ * @throws {Error} Throws an error if there was an issue with the request.
101
+ */
102
+ static async authToken(token) {
103
+ if (!token) {
104
+ token = await Session.token
105
+ }
106
+
107
+ const response = await _request2.default.call(void 0, {
108
+ method: "POST",
109
+ url: "/auth/token",
110
+ data: {
111
+ token: token
112
+ }
113
+ })
114
+
115
+ return response.data
116
+ }
117
+
95
118
  /**
96
119
  * Validates the existence of a username by making a GET request to the `/auth/{username}/exists` endpoint.
97
120
  *
@@ -119,27 +119,6 @@ var _withStorage = require('../../helpers/withStorage'); var _withStorage2 = _in
119
119
  return response.data
120
120
  }
121
121
 
122
- /**
123
- * Retrieves the token validation data from the server.
124
- *
125
- * @return {Promise<Object>} The token validation data.
126
- */
127
- static async authToken(token) {
128
- if (!token) {
129
- token = await Session.token
130
- }
131
-
132
- const response = await _request2.default.call(void 0, {
133
- method: "POST",
134
- url: "/auth/token",
135
- data: {
136
- token: token
137
- }
138
- })
139
-
140
- return response.data
141
- }
142
-
143
122
  /**
144
123
  * Destroys the current session by deleting it from the server.
145
124
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comty.js",
3
- "version": "0.60.4",
3
+ "version": "0.60.5",
4
4
  "main": "./dist/index.js",
5
5
  "author": "RageStudio <support@ragestudio.net>",
6
6
  "scripts": {