@fonoster/identity-client 0.20.1 → 0.22.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
@@ -55,6 +55,26 @@ export interface InviteMemberRequest {
55
55
  role: string;
56
56
  name?: string;
57
57
  }
58
+ /** A workspace API key as returned by list (never carries the secret). */
59
+ export interface ApiKey {
60
+ ref: string;
61
+ accessKeyId: string;
62
+ role: string;
63
+ expiresAt?: number;
64
+ createdAt?: number;
65
+ updatedAt?: number;
66
+ }
67
+ export interface CreateApiKeyRequest {
68
+ role: string;
69
+ /** Optional expiry as epoch milliseconds; omit for a non-expiring key. */
70
+ expiresAt?: number;
71
+ }
72
+ /** Create/regenerate response — the only time the secret is returned. */
73
+ export interface ApiKeyCredentials {
74
+ ref: string;
75
+ accessKeyId: string;
76
+ accessKeySecret: string;
77
+ }
58
78
  /** Channel a verification code is sent over. */
59
79
  export type ContactType = "EMAIL" | "PHONE";
60
80
  /** OAuth2 providers Identity can exchange an authorization code for. */
@@ -99,6 +119,12 @@ export declare class IdentityClient {
99
119
  }>;
100
120
  exchangeCredentials(request: ExchangeCredentialsRequest): Promise<ExchangeResponse>;
101
121
  exchangeRefreshToken(refreshToken: string): Promise<ExchangeResponse>;
122
+ /**
123
+ * Exchange a workspace API key (accessKeyId + accessKeySecret) for tokens.
124
+ * Intended for unattended, server-to-server integrations that cannot perform
125
+ * an interactive credentials login.
126
+ */
127
+ exchangeApiKey(accessKeyId: string, accessKeySecret: string): Promise<ExchangeResponse>;
102
128
  /** Exchange an OAuth2 authorization code for tokens (sign in). */
103
129
  exchangeOauth2Code(provider: Oauth2Provider, code: string): Promise<ExchangeResponse>;
104
130
  /** Create an account from an OAuth2 authorization code, returning tokens (sign up). */
@@ -130,6 +156,19 @@ export declare class IdentityClient {
130
156
  resendWorkspaceMembershipInvitation(userRef: string, accessKeyId: string, token: string): Promise<{
131
157
  userRef: string;
132
158
  }>;
159
+ /** List the active workspace's API keys (secrets are never returned). */
160
+ listApiKeys(accessKeyId: string, token: string): Promise<{
161
+ items: ApiKey[];
162
+ nextPageToken?: string;
163
+ }>;
164
+ /** Create an API key; the response carries the secret (shown once). */
165
+ createApiKey(request: CreateApiKeyRequest, accessKeyId: string, token: string): Promise<ApiKeyCredentials>;
166
+ /** Rotate a key's secret in place; the new secret is returned (shown once). */
167
+ regenerateApiKey(ref: string, accessKeyId: string, token: string): Promise<ApiKeyCredentials>;
168
+ /** Permanently delete a key (this is the revocation mechanism). */
169
+ deleteApiKey(ref: string, accessKeyId: string, token: string): Promise<{
170
+ ref: string;
171
+ }>;
133
172
  getUser(ref: string, token: string): Promise<User>;
134
173
  updateUser(request: UpdateUserRequest, token: string): Promise<{
135
174
  ref: string;
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
+ * 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
+ }
139
147
  /** Exchange an OAuth2 authorization code for tokens (sign in). */
140
148
  exchangeOauth2Code(provider, code) {
141
149
  return this.unary("exchangeOauth2Code", { provider, code });
@@ -171,6 +179,25 @@ class IdentityClient {
171
179
  resendWorkspaceMembershipInvitation(userRef, accessKeyId, token) {
172
180
  return this.unary("resendWorkspaceMembershipInvitation", { userRef }, { token, accessKeyId });
173
181
  }
182
+ // --- Workspace API keys ---
183
+ // Workspace-scoped credentials for unattended, server-to-server integrations.
184
+ // The active workspace is taken from the accessKeyId metadata, as with members.
185
+ /** List the active workspace's API keys (secrets are never returned). */
186
+ listApiKeys(accessKeyId, token) {
187
+ return this.unary("listApiKeys", {}, { token, accessKeyId });
188
+ }
189
+ /** Create an API key; the response carries the secret (shown once). */
190
+ createApiKey(request, accessKeyId, token) {
191
+ return this.unary("createApiKey", request, { token, accessKeyId });
192
+ }
193
+ /** Rotate a key's secret in place; the new secret is returned (shown once). */
194
+ regenerateApiKey(ref, accessKeyId, token) {
195
+ return this.unary("regenerateApiKey", { ref }, { token, accessKeyId });
196
+ }
197
+ /** Permanently delete a key (this is the revocation mechanism). */
198
+ deleteApiKey(ref, accessKeyId, token) {
199
+ return this.unary("deleteApiKey", { ref }, { token, accessKeyId });
200
+ }
174
201
  getUser(ref, token) {
175
202
  return this.unary("getUser", { ref }, { token });
176
203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/identity-client",
3
- "version": "0.20.1",
3
+ "version": "0.22.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": "eb410d1401ac015226cd72b6da920e1fb7b5f0cd"
31
+ "gitHead": "6095b02e5744b17ddc65f48ff1eb6cb54b8de48f"
32
32
  }