@abraca/dabra 2.5.0 → 2.6.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
@@ -821,6 +821,62 @@ declare class AbracadabraClient {
821
821
  role: string | null;
822
822
  }>;
823
823
  }>;
824
+ /**
825
+ * List `service`-role users (runners, demo seeders, automation
826
+ * identities). Requires Service role. Admins can see service users via
827
+ * `/admin/users` too but cannot mint or rotate them.
828
+ */
829
+ adminListServiceAccounts(): Promise<{
830
+ items: Array<{
831
+ id: string;
832
+ username: string;
833
+ public_key: string | null;
834
+ revoked: boolean;
835
+ display_name: string | null;
836
+ }>;
837
+ }>;
838
+ /**
839
+ * Create a new `service`-role user. When `public_key` is omitted the
840
+ * server generates a keypair and returns the private half in the
841
+ * response — show it to the operator **once** and discard; the server
842
+ * never persists it. Requires Service role.
843
+ */
844
+ adminCreateServiceAccount(body: {
845
+ username: string;
846
+ public_key?: string;
847
+ }): Promise<{
848
+ id: string;
849
+ username: string;
850
+ public_key: string;
851
+ role: string;
852
+ private_key?: string;
853
+ }>;
854
+ /**
855
+ * Rotate the active keypair on a service account. Old JWTs are
856
+ * invalidated; old device keys are marked revoked; the canonical
857
+ * `users.public_key` swaps to the new value. `users.id` stays put so
858
+ * existing permission rows keep matching. Returns the new pubkey (and
859
+ * private half when the server generated it). Requires Service role.
860
+ */
861
+ adminRotateServiceAccountKey(userId: string, body?: {
862
+ public_key?: string;
863
+ }): Promise<{
864
+ id: string;
865
+ public_key: string;
866
+ private_key?: string;
867
+ }>;
868
+ /**
869
+ * Lock a service account and revoke all of its device keys. Idempotent.
870
+ * Refuses targets whose `users.role` isn't `"service"`. Requires
871
+ * Service role.
872
+ */
873
+ adminRevokeServiceAccount(userId: string): Promise<void>;
874
+ /**
875
+ * Revoke a single device key on a user (any role). Bumps
876
+ * `tokens_invalid_before` so open WS sessions tied to the key must
877
+ * re-auth. Requires elevated role (Service or Admin@root).
878
+ */
879
+ adminRevokeDeviceKey(userId: string, keyId: string): Promise<void>;
824
880
  /**
825
881
  * Page through the audit log. Filters AND-combine; `limit` defaults to
826
882
  * 100 server-side. Requires elevated role.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/dabra",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "abracadabra provider",
5
5
  "keywords": [
6
6
  "abracadabra",
@@ -41,7 +41,7 @@
41
41
  "yjs": "^13.6.8"
42
42
  },
43
43
  "devDependencies": {
44
- "@abraca/schema": "2.5.0"
44
+ "@abraca/schema": "2.6.0"
45
45
  },
46
46
  "scripts": {
47
47
  "test": "node --no-warnings --conditions=source --experimental-transform-types --test 'tests/*.test.ts'"
@@ -1194,6 +1194,84 @@ export class AbracadabraClient {
1194
1194
  );
1195
1195
  }
1196
1196
 
1197
+ /**
1198
+ * List `service`-role users (runners, demo seeders, automation
1199
+ * identities). Requires Service role. Admins can see service users via
1200
+ * `/admin/users` too but cannot mint or rotate them.
1201
+ */
1202
+ async adminListServiceAccounts(): Promise<{
1203
+ items: Array<{
1204
+ id: string;
1205
+ username: string;
1206
+ public_key: string | null;
1207
+ revoked: boolean;
1208
+ display_name: string | null;
1209
+ }>;
1210
+ }> {
1211
+ return this.request("GET", "/admin/service-accounts");
1212
+ }
1213
+
1214
+ /**
1215
+ * Create a new `service`-role user. When `public_key` is omitted the
1216
+ * server generates a keypair and returns the private half in the
1217
+ * response — show it to the operator **once** and discard; the server
1218
+ * never persists it. Requires Service role.
1219
+ */
1220
+ async adminCreateServiceAccount(body: {
1221
+ username: string;
1222
+ public_key?: string;
1223
+ }): Promise<{
1224
+ id: string;
1225
+ username: string;
1226
+ public_key: string;
1227
+ role: string;
1228
+ private_key?: string;
1229
+ }> {
1230
+ return this.request("POST", "/admin/service-accounts", { body });
1231
+ }
1232
+
1233
+ /**
1234
+ * Rotate the active keypair on a service account. Old JWTs are
1235
+ * invalidated; old device keys are marked revoked; the canonical
1236
+ * `users.public_key` swaps to the new value. `users.id` stays put so
1237
+ * existing permission rows keep matching. Returns the new pubkey (and
1238
+ * private half when the server generated it). Requires Service role.
1239
+ */
1240
+ async adminRotateServiceAccountKey(
1241
+ userId: string,
1242
+ body: { public_key?: string } = {},
1243
+ ): Promise<{ id: string; public_key: string; private_key?: string }> {
1244
+ return this.request(
1245
+ "POST",
1246
+ `/admin/service-accounts/${encodeURIComponent(userId)}/rotate-key`,
1247
+ { body },
1248
+ );
1249
+ }
1250
+
1251
+ /**
1252
+ * Lock a service account and revoke all of its device keys. Idempotent.
1253
+ * Refuses targets whose `users.role` isn't `"service"`. Requires
1254
+ * Service role.
1255
+ */
1256
+ async adminRevokeServiceAccount(userId: string): Promise<void> {
1257
+ await this.request(
1258
+ "DELETE",
1259
+ `/admin/service-accounts/${encodeURIComponent(userId)}`,
1260
+ );
1261
+ }
1262
+
1263
+ /**
1264
+ * Revoke a single device key on a user (any role). Bumps
1265
+ * `tokens_invalid_before` so open WS sessions tied to the key must
1266
+ * re-auth. Requires elevated role (Service or Admin@root).
1267
+ */
1268
+ async adminRevokeDeviceKey(userId: string, keyId: string): Promise<void> {
1269
+ await this.request(
1270
+ "POST",
1271
+ `/admin/users/${encodeURIComponent(userId)}/device-keys/${encodeURIComponent(keyId)}/revoke`,
1272
+ );
1273
+ }
1274
+
1197
1275
  /**
1198
1276
  * Page through the audit log. Filters AND-combine; `limit` defaults to
1199
1277
  * 100 server-side. Requires elevated role.