@fonoster/identity-client 0.27.0 → 0.31.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 +8 -0
- package/dist/index.js +12 -0
- package/package.json +12 -5
- package/proto/identity.proto +26 -1
package/dist/index.d.ts
CHANGED
|
@@ -125,6 +125,14 @@ export declare class IdentityClient {
|
|
|
125
125
|
}>;
|
|
126
126
|
exchangeCredentials(request: ExchangeCredentialsRequest): Promise<ExchangeResponse>;
|
|
127
127
|
exchangeRefreshToken(refreshToken: string): Promise<ExchangeResponse>;
|
|
128
|
+
/** Passwordless sign-in: the code emailed by `sendVerificationCode`, for tokens. */
|
|
129
|
+
exchangeVerificationCode(email: string, code: string): Promise<ExchangeResponse>;
|
|
130
|
+
/**
|
|
131
|
+
* Sign-out: revokes `refreshToken` and every token rotated from the same
|
|
132
|
+
* sign-in, so it can no longer be exchanged. Access tokens already issued
|
|
133
|
+
* stay valid until they expire.
|
|
134
|
+
*/
|
|
135
|
+
revokeToken(refreshToken: string): Promise<void>;
|
|
128
136
|
/**
|
|
129
137
|
* Exchange a workspace API key (accessKeyId + accessKeySecret) for tokens.
|
|
130
138
|
* Intended for unattended, server-to-server integrations that cannot perform
|
package/dist/index.js
CHANGED
|
@@ -136,6 +136,18 @@ class IdentityClient {
|
|
|
136
136
|
exchangeRefreshToken(refreshToken) {
|
|
137
137
|
return this.unary("exchangeRefreshToken", { refreshToken });
|
|
138
138
|
}
|
|
139
|
+
/** Passwordless sign-in: the code emailed by `sendVerificationCode`, for tokens. */
|
|
140
|
+
exchangeVerificationCode(email, code) {
|
|
141
|
+
return this.unary("exchangeVerificationCode", { email, code });
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Sign-out: revokes `refreshToken` and every token rotated from the same
|
|
145
|
+
* sign-in, so it can no longer be exchanged. Access tokens already issued
|
|
146
|
+
* stay valid until they expire.
|
|
147
|
+
*/
|
|
148
|
+
async revokeToken(refreshToken) {
|
|
149
|
+
await this.unary("revokeToken", { token: refreshToken });
|
|
150
|
+
}
|
|
139
151
|
/**
|
|
140
152
|
* Exchange a workspace API key (accessKeyId + accessKeySecret) for tokens.
|
|
141
153
|
* Intended for unattended, server-to-server integrations that cannot perform
|
package/package.json
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/identity-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.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": {
|
|
9
17
|
"prebuild": "rimraf ./dist tsconfig.tsbuildinfo && node scripts/sync-proto.mjs",
|
|
10
|
-
"build": "tsc -p tsconfig.json"
|
|
11
|
-
"clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo proto"
|
|
18
|
+
"build": "tsc -p tsconfig.json"
|
|
12
19
|
},
|
|
13
20
|
"dependencies": {
|
|
14
|
-
"@grpc/grpc-js": "~1.
|
|
21
|
+
"@grpc/grpc-js": "~1.14.6",
|
|
15
22
|
"@grpc/proto-loader": "^0.7.15",
|
|
16
23
|
"jsonwebtoken": "^9.0.2"
|
|
17
24
|
},
|
|
@@ -28,5 +35,5 @@
|
|
|
28
35
|
"publishConfig": {
|
|
29
36
|
"access": "public"
|
|
30
37
|
},
|
|
31
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "f0a5102dddeea0f70f659234108805bc10690f2e"
|
|
32
39
|
}
|
package/proto/identity.proto
CHANGED
|
@@ -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
|
+
}
|