@fonoster/identity-client 0.20.0 → 0.21.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 +35 -0
- package/dist/index.js +25 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,22 @@ export interface ExchangeCredentialsRequest {
|
|
|
11
11
|
password: string;
|
|
12
12
|
twoFactorCode?: string;
|
|
13
13
|
}
|
|
14
|
+
export interface User {
|
|
15
|
+
ref: string;
|
|
16
|
+
email: string;
|
|
17
|
+
phone?: string;
|
|
18
|
+
name: string;
|
|
19
|
+
avatar?: string;
|
|
20
|
+
createdAt?: number;
|
|
21
|
+
updatedAt?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface UpdateUserRequest {
|
|
24
|
+
ref: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
password?: string;
|
|
27
|
+
phone?: string;
|
|
28
|
+
avatar?: string;
|
|
29
|
+
}
|
|
14
30
|
export interface ExchangeResponse {
|
|
15
31
|
idToken?: string;
|
|
16
32
|
accessToken: string;
|
|
@@ -41,6 +57,8 @@ export interface InviteMemberRequest {
|
|
|
41
57
|
}
|
|
42
58
|
/** Channel a verification code is sent over. */
|
|
43
59
|
export type ContactType = "EMAIL" | "PHONE";
|
|
60
|
+
/** OAuth2 providers Identity can exchange an authorization code for. */
|
|
61
|
+
export type Oauth2Provider = "GITHUB";
|
|
44
62
|
export interface WorkspaceAccess {
|
|
45
63
|
accessKeyId: string;
|
|
46
64
|
role: string;
|
|
@@ -81,6 +99,16 @@ export declare class IdentityClient {
|
|
|
81
99
|
}>;
|
|
82
100
|
exchangeCredentials(request: ExchangeCredentialsRequest): Promise<ExchangeResponse>;
|
|
83
101
|
exchangeRefreshToken(refreshToken: string): Promise<ExchangeResponse>;
|
|
102
|
+
/**
|
|
103
|
+
* Exchange a workspace API key (accessKeyId + accessKeySecret) for tokens.
|
|
104
|
+
* Intended for unattended, server-to-server integrations that cannot perform
|
|
105
|
+
* an interactive credentials login.
|
|
106
|
+
*/
|
|
107
|
+
exchangeApiKey(accessKeyId: string, accessKeySecret: string): Promise<ExchangeResponse>;
|
|
108
|
+
/** Exchange an OAuth2 authorization code for tokens (sign in). */
|
|
109
|
+
exchangeOauth2Code(provider: Oauth2Provider, code: string): Promise<ExchangeResponse>;
|
|
110
|
+
/** Create an account from an OAuth2 authorization code, returning tokens (sign up). */
|
|
111
|
+
createUserWithOauth2Code(code: string): Promise<ExchangeResponse>;
|
|
84
112
|
createWorkspace(name: string, token: string): Promise<{
|
|
85
113
|
ref: string;
|
|
86
114
|
}>;
|
|
@@ -108,6 +136,13 @@ export declare class IdentityClient {
|
|
|
108
136
|
resendWorkspaceMembershipInvitation(userRef: string, accessKeyId: string, token: string): Promise<{
|
|
109
137
|
userRef: string;
|
|
110
138
|
}>;
|
|
139
|
+
getUser(ref: string, token: string): Promise<User>;
|
|
140
|
+
updateUser(request: UpdateUserRequest, token: string): Promise<{
|
|
141
|
+
ref: string;
|
|
142
|
+
}>;
|
|
143
|
+
deleteUser(ref: string, token: string): Promise<{
|
|
144
|
+
ref: string;
|
|
145
|
+
}>;
|
|
111
146
|
sendVerificationCode(contactType: ContactType, value: string): Promise<void>;
|
|
112
147
|
verifyCode(username: string, contactType: ContactType, value: string, verificationCode: string): Promise<void>;
|
|
113
148
|
sendResetPasswordCode(username: string, resetPasswordUrl: string): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -136,6 +136,22 @@ class IdentityClient {
|
|
|
136
136
|
exchangeRefreshToken(refreshToken) {
|
|
137
137
|
return this.unary("exchangeRefreshToken", { refreshToken });
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Exchange a workspace API key (accessKeyId + accessKeySecret) for tokens.
|
|
141
|
+
* Intended for unattended, server-to-server integrations that cannot perform
|
|
142
|
+
* an interactive credentials login.
|
|
143
|
+
*/
|
|
144
|
+
exchangeApiKey(accessKeyId, accessKeySecret) {
|
|
145
|
+
return this.unary("exchangeApiKey", { accessKeyId, accessKeySecret });
|
|
146
|
+
}
|
|
147
|
+
/** Exchange an OAuth2 authorization code for tokens (sign in). */
|
|
148
|
+
exchangeOauth2Code(provider, code) {
|
|
149
|
+
return this.unary("exchangeOauth2Code", { provider, code });
|
|
150
|
+
}
|
|
151
|
+
/** Create an account from an OAuth2 authorization code, returning tokens (sign up). */
|
|
152
|
+
createUserWithOauth2Code(code) {
|
|
153
|
+
return this.unary("createUserWithOauth2Code", { code });
|
|
154
|
+
}
|
|
139
155
|
createWorkspace(name, token) {
|
|
140
156
|
return this.unary("createWorkspace", { name }, { token });
|
|
141
157
|
}
|
|
@@ -163,6 +179,15 @@ class IdentityClient {
|
|
|
163
179
|
resendWorkspaceMembershipInvitation(userRef, accessKeyId, token) {
|
|
164
180
|
return this.unary("resendWorkspaceMembershipInvitation", { userRef }, { token, accessKeyId });
|
|
165
181
|
}
|
|
182
|
+
getUser(ref, token) {
|
|
183
|
+
return this.unary("getUser", { ref }, { token });
|
|
184
|
+
}
|
|
185
|
+
updateUser(request, token) {
|
|
186
|
+
return this.unary("updateUser", request, { token });
|
|
187
|
+
}
|
|
188
|
+
deleteUser(ref, token) {
|
|
189
|
+
return this.unary("deleteUser", { ref }, { token });
|
|
190
|
+
}
|
|
166
191
|
sendVerificationCode(contactType, value) {
|
|
167
192
|
return this.unary("sendVerificationCode", { contactType, value });
|
|
168
193
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/identity-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Lightweight client for the Fonoster Identity gRPC service",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "34139b12d44bb6c59eb5cc9f1083fbcfaa61b76e"
|
|
32
32
|
}
|