@thunderid/node 1.0.6 → 1.1.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.
@@ -1,6 +1,6 @@
1
- import { ThunderIDJavaScriptClient, ExtendedAuthorizeRequestUrlParams, IdToken, OIDCEndpoints, Storage, TokenExchangeRequestConfig, TokenResponse, User } from '@thunderid/javascript';
1
+ import { ExtendedAuthorizeRequestUrlParams, IdToken, OIDCEndpoints, Storage, ThunderIDJavaScriptClient, TokenExchangeRequestConfig, TokenResponse, User } from '@thunderid/javascript';
2
2
  import { ThunderIDNodeConfig } from './models/config';
3
- declare class ThunderIDNodeClient<T = ThunderIDNodeConfig> extends ThunderIDJavaScriptClient<T> {
3
+ declare class ThunderIDNodeClient<T extends ThunderIDNodeConfig = ThunderIDNodeConfig> extends ThunderIDJavaScriptClient<T> {
4
4
  private _nodeInstanceId;
5
5
  constructor(instanceId?: number);
6
6
  initialize(config: T, storage?: Storage): Promise<boolean>;
@@ -17,6 +17,11 @@ declare class ThunderIDNodeClient<T = ThunderIDNodeConfig> extends ThunderIDJava
17
17
  getUser(userId?: string): Promise<User>;
18
18
  getOpenIDProviderEndpoints(): Promise<Partial<OIDCEndpoints>>;
19
19
  exchangeToken(config: TokenExchangeRequestConfig, userId?: string): Promise<TokenResponse | Response | User>;
20
+ /**
21
+ * Updates one or more of the signed-in user's credentials (e.g. `password`, or any other
22
+ * attribute the user type schema declares `credential: true`).
23
+ */
24
+ updateUserCredentials(payload: Record<string, string>, userId?: string): Promise<void>;
20
25
  }
21
26
  export default ThunderIDNodeClient;
22
27
  //# sourceMappingURL=ThunderIDNodeClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThunderIDNodeClient.d.ts","sourceRoot":"","sources":["../src/ThunderIDNodeClient.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,yBAAyB,EAEzB,iCAAiC,EACjC,OAAO,EACP,aAAa,EAEb,OAAO,EACP,0BAA0B,EAC1B,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AAC;IAIlE,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC;IAI/D,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAItE,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,0BAA0B,IAAI,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAI7D,aAAa,CACjC,MAAM,EAAE,0BAA0B,EAClC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,aAAa,GAAG,QAAQ,GAAG,IAAI,CAAC;IAI3C;;;OAGG;IACU,qBAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAapG;AAED,eAAe,mBAAmB,CAAC"}
@@ -234,6 +234,20 @@ var ThunderIDNodeClient = class extends __thunderid_javascript.ThunderIDJavaScri
234
234
  async exchangeToken(config, userId) {
235
235
  return super.exchangeToken(config, userId);
236
236
  }
237
+ /**
238
+ * Updates one or more of the signed-in user's credentials (e.g. `password`, or any other
239
+ * attribute the user type schema declares `credential: true`).
240
+ */
241
+ async updateUserCredentials(payload, userId) {
242
+ const configData = await this.getStorageManager().getConfigData();
243
+ const baseUrl = configData?.baseUrl;
244
+ await (0, __thunderid_javascript.updateMeCredentials)({
245
+ baseUrl,
246
+ headers: { Authorization: `Bearer ${await this.getAccessToken(userId)}` },
247
+ payload,
248
+ url: (0, __thunderid_javascript.resolveResourceEndpoint)("usersMeCredentials", configData)
249
+ });
250
+ }
237
251
  };
238
252
  var ThunderIDNodeClient_default = ThunderIDNodeClient;
239
253
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import fetch, { Headers, Request, Response } from "cross-fetch";
2
- import { ThunderIDAuthException, ThunderIDJavaScriptClient, getVendorPrefix } from "@thunderid/javascript";
2
+ import { ThunderIDAuthException, ThunderIDJavaScriptClient, getVendorPrefix, resolveResourceEndpoint, updateMeCredentials } from "@thunderid/javascript";
3
3
  import cache from "memory-cache";
4
4
  import base64url from "base64url";
5
5
  import sha256 from "fast-sha256";
@@ -205,6 +205,20 @@ var ThunderIDNodeClient = class extends ThunderIDJavaScriptClient {
205
205
  async exchangeToken(config, userId) {
206
206
  return super.exchangeToken(config, userId);
207
207
  }
208
+ /**
209
+ * Updates one or more of the signed-in user's credentials (e.g. `password`, or any other
210
+ * attribute the user type schema declares `credential: true`).
211
+ */
212
+ async updateUserCredentials(payload, userId) {
213
+ const configData = await this.getStorageManager().getConfigData();
214
+ const baseUrl = configData?.baseUrl;
215
+ await updateMeCredentials({
216
+ baseUrl,
217
+ headers: { Authorization: `Bearer ${await this.getAccessToken(userId)}` },
218
+ payload,
219
+ url: resolveResourceEndpoint("usersMeCredentials", configData)
220
+ });
221
+ }
208
222
  };
209
223
  var ThunderIDNodeClient_default = ThunderIDNodeClient;
210
224
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thunderid/node",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
4
4
  "description": "Node.js runtime SDK for ThunderID",
5
5
  "keywords": [
6
6
  "thunderid",
@@ -33,8 +33,8 @@
33
33
  "directory": "packages/node"
34
34
  },
35
35
  "devDependencies": {
36
- "@thunderid/eslint-plugin": "1.0.0",
37
- "@thunderid/prettier-config": "1.0.0",
36
+ "@thunderid/eslint-plugin": "1.0.1",
37
+ "@thunderid/prettier-config": "1.0.1",
38
38
  "@types/node": "24.7.2",
39
39
  "eslint": "9.39.4",
40
40
  "prettier": "3.6.2",
@@ -44,6 +44,7 @@
44
44
  "vitest": "4.1.10"
45
45
  },
46
46
  "dependencies": {
47
+ "@thunderid/javascript": "^1.1.0",
47
48
  "base64url": "3.0.1",
48
49
  "cross-fetch": "4.1.0",
49
50
  "fast-sha256": "1.3.0",
@@ -51,8 +52,7 @@
51
52
  "memory-cache": "0.2.0",
52
53
  "secure-random-bytes": "5.0.1",
53
54
  "tslib": "2.8.1",
54
- "uuid": "11.1.1",
55
- "@thunderid/javascript": "^1.0.6"
55
+ "uuid": "11.1.1"
56
56
  },
57
57
  "publishConfig": {
58
58
  "access": "public"