@fonoster/identity-client 0.26.0 → 0.30.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.
package/dist/index.d.ts CHANGED
@@ -125,6 +125,12 @@ export declare class IdentityClient {
125
125
  }>;
126
126
  exchangeCredentials(request: ExchangeCredentialsRequest): Promise<ExchangeResponse>;
127
127
  exchangeRefreshToken(refreshToken: string): Promise<ExchangeResponse>;
128
+ /**
129
+ * Sign-out: revokes `refreshToken` and every token rotated from the same
130
+ * sign-in, so it can no longer be exchanged. Access tokens already issued
131
+ * stay valid until they expire.
132
+ */
133
+ revokeToken(refreshToken: string): Promise<void>;
128
134
  /**
129
135
  * Exchange a workspace API key (accessKeyId + accessKeySecret) for tokens.
130
136
  * Intended for unattended, server-to-server integrations that cannot perform
package/dist/index.js CHANGED
@@ -136,6 +136,14 @@ class IdentityClient {
136
136
  exchangeRefreshToken(refreshToken) {
137
137
  return this.unary("exchangeRefreshToken", { refreshToken });
138
138
  }
139
+ /**
140
+ * Sign-out: revokes `refreshToken` and every token rotated from the same
141
+ * sign-in, so it can no longer be exchanged. Access tokens already issued
142
+ * stay valid until they expire.
143
+ */
144
+ async revokeToken(refreshToken) {
145
+ await this.unary("revokeToken", { token: refreshToken });
146
+ }
139
147
  /**
140
148
  * Exchange a workspace API key (accessKeyId + accessKeySecret) for tokens.
141
149
  * Intended for unattended, server-to-server integrations that cannot perform
package/package.json CHANGED
@@ -1,8 +1,16 @@
1
1
  {
2
2
  "name": "@fonoster/identity-client",
3
- "version": "0.26.0",
3
+ "version": "0.30.0",
4
4
  "description": "Lightweight client for the Fonoster Identity gRPC service",
5
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/fonoster/fonoster.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/fonoster/fonoster/issues"
12
+ },
13
+ "homepage": "https://github.com/fonoster/fonoster#readme",
6
14
  "main": "dist/index",
7
15
  "types": "dist/index",
8
16
  "scripts": {
@@ -11,7 +19,7 @@
11
19
  "clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo proto"
12
20
  },
13
21
  "dependencies": {
14
- "@grpc/grpc-js": "~1.10.6",
22
+ "@grpc/grpc-js": "~1.14.6",
15
23
  "@grpc/proto-loader": "^0.7.15",
16
24
  "jsonwebtoken": "^9.0.2"
17
25
  },
@@ -28,5 +36,5 @@
28
36
  "publishConfig": {
29
37
  "access": "public"
30
38
  },
31
- "gitHead": "d14f414d791a33f92e8c4225f7e462abc440a142"
39
+ "gitHead": "b59b06a3ef325abe3f188c0fb87cc22d50ed5471"
32
40
  }
@@ -56,6 +56,8 @@ service Identity {
56
56
  rpc ExchangeApiKey (ExchangeApiKeyRequest) returns (ExchangeApiKeyResponse) {}
57
57
  rpc ExchangeOauth2Code (ExchangeOauth2CodeRequest) returns (ExchangeOauth2CodeResponse) {}
58
58
  rpc ExchangeRefreshToken (ExchangeRefreshTokenRequest) returns (ExchangeRefreshTokenResponse) {}
59
+ // Trade an emailed sign-in code for tokens (passwordless sign-in)
60
+ rpc ExchangeVerificationCode (ExchangeVerificationCodeRequest) returns (ExchangeVerificationCodeResponse) {}
59
61
  rpc RevokeToken (RevokeTokenRequest) returns (RevokeTokenResponse) {}
60
62
 
61
63
  // Get the public key for verifying JWTs
@@ -78,14 +80,22 @@ message Workspace {
78
80
  int32 created_at = 5;
79
81
  int32 updated_at = 6;
80
82
  Owner owner = 7;
83
+ // A public region id (default, us-east-1) or a private region ref (rg_...). Immutable.
84
+ string region = 8;
81
85
  }
82
86
 
83
87
  message CreateWorkspaceRequest {
84
88
  string name = 1;
89
+ // A public region id, or one of the caller's private regions (id or rg_ ref). Empty means "default".
90
+ string region = 2;
85
91
  }
86
92
 
87
93
  message CreateWorkspaceResponse {
88
94
  string ref = 1;
95
+ string region = 2;
96
+ // Unused since PR-15 (regions are created at the user level, POST /api/regions); kept reserved.
97
+ string enrollment_token = 3;
98
+ string expires_at = 4;
89
99
  }
90
100
 
91
101
  message DeleteWorkspaceRequest {
@@ -113,6 +123,8 @@ message ListWorkspacesResponse {
113
123
  message UpdateWorkspaceRequest {
114
124
  string ref = 1;
115
125
  string name = 2;
126
+ // Accepted only when unchanged (the region is immutable).
127
+ string region = 3;
116
128
  }
117
129
 
118
130
  message UpdateWorkspaceResponse {
@@ -204,10 +216,12 @@ message User {
204
216
 
205
217
  message UpdateUserRequest {
206
218
  string ref = 1;
219
+ // A new password; current_password must be the account's password.
207
220
  string password = 2;
208
221
  string name = 3;
209
222
  string avatar = 4;
210
223
  string phone = 5;
224
+ string current_password = 6;
211
225
  }
212
226
 
213
227
  message UpdateUserResponse {
@@ -356,4 +370,15 @@ message RevokeTokenResponse {
356
370
  // Message with response with the public key
357
371
  message GetPublicKeyResponse {
358
372
  string public_key = 1;
359
- }
373
+ }
374
+
375
+ message ExchangeVerificationCodeRequest {
376
+ string email = 1;
377
+ string code = 2;
378
+ }
379
+
380
+ message ExchangeVerificationCodeResponse {
381
+ string id_token = 1;
382
+ string access_token = 2;
383
+ string refresh_token = 3;
384
+ }