@scalekit-sdk/node 2.1.4 → 2.1.6
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/buf.gen.yaml +1 -0
- package/lib/auth.d.ts +22 -0
- package/lib/auth.js +65 -0
- package/lib/auth.js.map +1 -0
- package/lib/core.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/auditlogs/auditlogs_pb.d.ts +16 -0
- package/lib/pkg/grpc/scalekit/v1/auditlogs/auditlogs_pb.js +20 -0
- package/lib/pkg/grpc/scalekit/v1/auditlogs/auditlogs_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.d.ts +118 -0
- package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.js +126 -0
- package/lib/pkg/grpc/scalekit/v1/auth/auth_connect.js.map +1 -0
- package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.d.ts +617 -0
- package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.js +927 -0
- package/lib/pkg/grpc/scalekit/v1/auth/auth_pb.js.map +1 -0
- package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.d.ts +34 -4
- package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js +43 -6
- package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.d.ts +10 -1
- package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.js +9 -0
- package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.d.ts +277 -2
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js +324 -2
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/sessions/sessions_pb.d.ts +43 -50
- package/lib/pkg/grpc/scalekit/v1/sessions/sessions_pb.js +66 -73
- package/lib/pkg/grpc/scalekit/v1/sessions/sessions_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.d.ts +62 -14
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.js +46 -17
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.js.map +1 -1
- package/lib/scalekit.d.ts +22 -0
- package/lib/scalekit.js +35 -6
- package/lib/scalekit.js.map +1 -1
- package/package.json +1 -1
- package/src/auth.ts +65 -0
- package/src/core.ts +1 -1
- package/src/pkg/grpc/scalekit/v1/auditlogs/auditlogs_pb.ts +24 -0
- package/src/pkg/grpc/scalekit/v1/auth/auth_connect.ts +125 -0
- package/src/pkg/grpc/scalekit/v1/auth/auth_pb.ts +1183 -0
- package/src/pkg/grpc/scalekit/v1/commons/commons_pb.ts +50 -6
- package/src/pkg/grpc/scalekit/v1/connections/connections_connect.ts +10 -1
- package/src/pkg/grpc/scalekit/v1/connections/connections_pb.ts +504 -1
- package/src/pkg/grpc/scalekit/v1/sessions/sessions_pb.ts +82 -81
- package/src/pkg/grpc/scalekit/v1/users/users_pb.ts +92 -22
- package/src/scalekit.ts +42 -6
|
@@ -416,136 +416,131 @@ export class SessionDetails extends Message<SessionDetails> {
|
|
|
416
416
|
status = "";
|
|
417
417
|
|
|
418
418
|
/**
|
|
419
|
-
* @generated from field:
|
|
419
|
+
* @generated from field: scalekit.v1.sessions.DeviceDetails device = 12;
|
|
420
420
|
*/
|
|
421
|
-
|
|
421
|
+
device?: DeviceDetails;
|
|
422
422
|
|
|
423
423
|
/**
|
|
424
|
-
* @generated from field:
|
|
424
|
+
* @generated from field: google.protobuf.Timestamp last_active_at = 13;
|
|
425
425
|
*/
|
|
426
|
-
|
|
426
|
+
lastActiveAt?: Timestamp;
|
|
427
427
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
428
|
+
constructor(data?: PartialMessage<SessionDetails>) {
|
|
429
|
+
super();
|
|
430
|
+
proto3.util.initPartial(data, this);
|
|
431
|
+
}
|
|
432
432
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
433
|
+
static readonly runtime: typeof proto3 = proto3;
|
|
434
|
+
static readonly typeName = "scalekit.v1.sessions.SessionDetails";
|
|
435
|
+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
436
|
+
{ no: 1, name: "session_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
437
|
+
{ no: 2, name: "user_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
438
|
+
{ no: 3, name: "authenticated_organizations", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
|
|
439
|
+
{ no: 4, name: "organization_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
440
|
+
{ no: 5, name: "created_at", kind: "message", T: Timestamp },
|
|
441
|
+
{ no: 6, name: "updated_at", kind: "message", T: Timestamp },
|
|
442
|
+
{ no: 7, name: "idle_expires_at", kind: "message", T: Timestamp },
|
|
443
|
+
{ no: 8, name: "absolute_expires_at", kind: "message", T: Timestamp },
|
|
444
|
+
{ no: 9, name: "expired_at", kind: "message", T: Timestamp },
|
|
445
|
+
{ no: 10, name: "logout_at", kind: "message", T: Timestamp },
|
|
446
|
+
{ no: 11, name: "status", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
447
|
+
{ no: 12, name: "device", kind: "message", T: DeviceDetails },
|
|
448
|
+
{ no: 13, name: "last_active_at", kind: "message", T: Timestamp },
|
|
449
|
+
]);
|
|
437
450
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
initialBrowserVersion = "";
|
|
451
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SessionDetails {
|
|
452
|
+
return new SessionDetails().fromBinary(bytes, options);
|
|
453
|
+
}
|
|
442
454
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
initialDeviceType = "";
|
|
455
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SessionDetails {
|
|
456
|
+
return new SessionDetails().fromJson(jsonValue, options);
|
|
457
|
+
}
|
|
447
458
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
initialIp = "";
|
|
459
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SessionDetails {
|
|
460
|
+
return new SessionDetails().fromJsonString(jsonString, options);
|
|
461
|
+
}
|
|
452
462
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
463
|
+
static equals(a: SessionDetails | PlainMessage<SessionDetails> | undefined, b: SessionDetails | PlainMessage<SessionDetails> | undefined): boolean {
|
|
464
|
+
return proto3.util.equals(SessionDetails, a, b);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
457
467
|
|
|
468
|
+
/**
|
|
469
|
+
* @generated from message scalekit.v1.sessions.DeviceDetails
|
|
470
|
+
*/
|
|
471
|
+
export class DeviceDetails extends Message<DeviceDetails> {
|
|
458
472
|
/**
|
|
459
|
-
* @generated from field: string
|
|
473
|
+
* @generated from field: string user_agent = 12;
|
|
460
474
|
*/
|
|
461
|
-
|
|
475
|
+
userAgent = "";
|
|
462
476
|
|
|
463
477
|
/**
|
|
464
|
-
* @generated from field: string
|
|
478
|
+
* @generated from field: string os = 13;
|
|
465
479
|
*/
|
|
466
|
-
|
|
480
|
+
os = "";
|
|
467
481
|
|
|
468
482
|
/**
|
|
469
|
-
* @generated from field: string
|
|
483
|
+
* @generated from field: string os_version = 14;
|
|
470
484
|
*/
|
|
471
|
-
|
|
485
|
+
osVersion = "";
|
|
472
486
|
|
|
473
487
|
/**
|
|
474
|
-
* @generated from field: string
|
|
488
|
+
* @generated from field: string browser = 15;
|
|
475
489
|
*/
|
|
476
|
-
|
|
490
|
+
browser = "";
|
|
477
491
|
|
|
478
492
|
/**
|
|
479
|
-
* @generated from field: string
|
|
493
|
+
* @generated from field: string browser_version = 16;
|
|
480
494
|
*/
|
|
481
|
-
|
|
495
|
+
browserVersion = "";
|
|
482
496
|
|
|
483
497
|
/**
|
|
484
|
-
* @generated from field: string
|
|
498
|
+
* @generated from field: string device_type = 17;
|
|
485
499
|
*/
|
|
486
|
-
|
|
500
|
+
deviceType = "";
|
|
487
501
|
|
|
488
502
|
/**
|
|
489
|
-
* @generated from field: string
|
|
503
|
+
* @generated from field: string ip = 19;
|
|
490
504
|
*/
|
|
491
|
-
|
|
505
|
+
ip = "";
|
|
492
506
|
|
|
493
507
|
/**
|
|
494
|
-
* @generated from field: scalekit.v1.sessions.Location
|
|
508
|
+
* @generated from field: scalekit.v1.sessions.Location location = 20;
|
|
495
509
|
*/
|
|
496
|
-
|
|
510
|
+
location?: Location;
|
|
497
511
|
|
|
498
|
-
constructor(data?: PartialMessage<
|
|
512
|
+
constructor(data?: PartialMessage<DeviceDetails>) {
|
|
499
513
|
super();
|
|
500
514
|
proto3.util.initPartial(data, this);
|
|
501
515
|
}
|
|
502
516
|
|
|
503
517
|
static readonly runtime: typeof proto3 = proto3;
|
|
504
|
-
static readonly typeName = "scalekit.v1.sessions.
|
|
518
|
+
static readonly typeName = "scalekit.v1.sessions.DeviceDetails";
|
|
505
519
|
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
506
|
-
{ no:
|
|
507
|
-
{ no:
|
|
508
|
-
{ no:
|
|
509
|
-
{ no:
|
|
510
|
-
{ no:
|
|
511
|
-
{ no:
|
|
512
|
-
{ no:
|
|
513
|
-
{ no:
|
|
514
|
-
{ no: 9, name: "expired_at", kind: "message", T: Timestamp },
|
|
515
|
-
{ no: 10, name: "logout_at", kind: "message", T: Timestamp },
|
|
516
|
-
{ no: 11, name: "status", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
517
|
-
{ no: 12, name: "initial_user_agent", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
518
|
-
{ no: 13, name: "initial_os", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
519
|
-
{ no: 14, name: "initial_os_version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
520
|
-
{ no: 15, name: "initial_browser", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
521
|
-
{ no: 16, name: "initial_browser_version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
522
|
-
{ no: 17, name: "initial_device_type", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
523
|
-
{ no: 19, name: "initial_ip", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
524
|
-
{ no: 20, name: "initial_location", kind: "message", T: Location },
|
|
525
|
-
{ no: 21, name: "latest_user_agent", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
526
|
-
{ no: 22, name: "latest_os", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
527
|
-
{ no: 23, name: "latest_os_version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
528
|
-
{ no: 24, name: "latest_browser", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
529
|
-
{ no: 25, name: "latest_browser_version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
530
|
-
{ no: 26, name: "latest_device_type", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
531
|
-
{ no: 28, name: "latest_ip", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
532
|
-
{ no: 29, name: "latest_location", kind: "message", T: Location },
|
|
520
|
+
{ no: 12, name: "user_agent", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
521
|
+
{ no: 13, name: "os", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
522
|
+
{ no: 14, name: "os_version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
523
|
+
{ no: 15, name: "browser", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
524
|
+
{ no: 16, name: "browser_version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
525
|
+
{ no: 17, name: "device_type", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
526
|
+
{ no: 19, name: "ip", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
527
|
+
{ no: 20, name: "location", kind: "message", T: Location },
|
|
533
528
|
]);
|
|
534
529
|
|
|
535
|
-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>):
|
|
536
|
-
return new
|
|
530
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeviceDetails {
|
|
531
|
+
return new DeviceDetails().fromBinary(bytes, options);
|
|
537
532
|
}
|
|
538
533
|
|
|
539
|
-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>):
|
|
540
|
-
return new
|
|
534
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeviceDetails {
|
|
535
|
+
return new DeviceDetails().fromJson(jsonValue, options);
|
|
541
536
|
}
|
|
542
537
|
|
|
543
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>):
|
|
544
|
-
return new
|
|
538
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeviceDetails {
|
|
539
|
+
return new DeviceDetails().fromJsonString(jsonString, options);
|
|
545
540
|
}
|
|
546
541
|
|
|
547
|
-
static equals(a:
|
|
548
|
-
return proto3.util.equals(
|
|
542
|
+
static equals(a: DeviceDetails | PlainMessage<DeviceDetails> | undefined, b: DeviceDetails | PlainMessage<DeviceDetails> | undefined): boolean {
|
|
543
|
+
return proto3.util.equals(DeviceDetails, a, b);
|
|
549
544
|
}
|
|
550
545
|
}
|
|
551
546
|
|
|
@@ -598,6 +593,11 @@ export class RevokedSessionDetails extends Message<RevokedSessionDetails> {
|
|
|
598
593
|
*/
|
|
599
594
|
status = "";
|
|
600
595
|
|
|
596
|
+
/**
|
|
597
|
+
* @generated from field: google.protobuf.Timestamp last_active_at = 12;
|
|
598
|
+
*/
|
|
599
|
+
lastActiveAt?: Timestamp;
|
|
600
|
+
|
|
601
601
|
constructor(data?: PartialMessage<RevokedSessionDetails>) {
|
|
602
602
|
super();
|
|
603
603
|
proto3.util.initPartial(data, this);
|
|
@@ -615,6 +615,7 @@ export class RevokedSessionDetails extends Message<RevokedSessionDetails> {
|
|
|
615
615
|
{ no: 9, name: "expired_at", kind: "message", T: Timestamp },
|
|
616
616
|
{ no: 10, name: "logout_at", kind: "message", T: Timestamp },
|
|
617
617
|
{ no: 11, name: "status", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
618
|
+
{ no: 12, name: "last_active_at", kind: "message", T: Timestamp },
|
|
618
619
|
]);
|
|
619
620
|
|
|
620
621
|
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RevokedSessionDetails {
|
|
@@ -1303,14 +1303,14 @@ export class CreateUser extends Message<CreateUser> {
|
|
|
1303
1303
|
*/
|
|
1304
1304
|
export class CreateUserProfile extends Message<CreateUserProfile> {
|
|
1305
1305
|
/**
|
|
1306
|
-
* @generated from field: string
|
|
1306
|
+
* @generated from field: string given_name = 2;
|
|
1307
1307
|
*/
|
|
1308
|
-
|
|
1308
|
+
givenName = "";
|
|
1309
1309
|
|
|
1310
1310
|
/**
|
|
1311
|
-
* @generated from field: string
|
|
1311
|
+
* @generated from field: string family_name = 3;
|
|
1312
1312
|
*/
|
|
1313
|
-
|
|
1313
|
+
familyName = "";
|
|
1314
1314
|
|
|
1315
1315
|
/**
|
|
1316
1316
|
* @generated from field: string name = 4;
|
|
@@ -1337,6 +1337,38 @@ export class CreateUserProfile extends Message<CreateUserProfile> {
|
|
|
1337
1337
|
*/
|
|
1338
1338
|
customAttributes: { [key: string]: string } = {};
|
|
1339
1339
|
|
|
1340
|
+
/**
|
|
1341
|
+
* @generated from field: string preferred_username = 10;
|
|
1342
|
+
*/
|
|
1343
|
+
preferredUsername = "";
|
|
1344
|
+
|
|
1345
|
+
/**
|
|
1346
|
+
* @generated from field: optional string picture = 11;
|
|
1347
|
+
*/
|
|
1348
|
+
picture?: string;
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* @generated from field: optional string gender = 12;
|
|
1352
|
+
*/
|
|
1353
|
+
gender?: string;
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* @generated from field: repeated string groups = 13;
|
|
1357
|
+
*/
|
|
1358
|
+
groups: string[] = [];
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* @generated from field: string first_name = 21 [deprecated = true];
|
|
1362
|
+
* @deprecated
|
|
1363
|
+
*/
|
|
1364
|
+
firstName = "";
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* @generated from field: string last_name = 22 [deprecated = true];
|
|
1368
|
+
* @deprecated
|
|
1369
|
+
*/
|
|
1370
|
+
lastName = "";
|
|
1371
|
+
|
|
1340
1372
|
constructor(data?: PartialMessage<CreateUserProfile>) {
|
|
1341
1373
|
super();
|
|
1342
1374
|
proto3.util.initPartial(data, this);
|
|
@@ -1345,13 +1377,19 @@ export class CreateUserProfile extends Message<CreateUserProfile> {
|
|
|
1345
1377
|
static readonly runtime: typeof proto3 = proto3;
|
|
1346
1378
|
static readonly typeName = "scalekit.v1.users.CreateUserProfile";
|
|
1347
1379
|
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
1348
|
-
{ no: 2, name: "
|
|
1349
|
-
{ no: 3, name: "
|
|
1380
|
+
{ no: 2, name: "given_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1381
|
+
{ no: 3, name: "family_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1350
1382
|
{ no: 4, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1351
1383
|
{ no: 5, name: "locale", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1352
1384
|
{ no: 7, name: "phone_number", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1353
1385
|
{ no: 8, name: "metadata", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
|
|
1354
1386
|
{ no: 9, name: "custom_attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
|
|
1387
|
+
{ no: 10, name: "preferred_username", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1388
|
+
{ no: 11, name: "picture", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1389
|
+
{ no: 12, name: "gender", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1390
|
+
{ no: 13, name: "groups", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
|
|
1391
|
+
{ no: 21, name: "first_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1392
|
+
{ no: 22, name: "last_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1355
1393
|
]);
|
|
1356
1394
|
|
|
1357
1395
|
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateUserProfile {
|
|
@@ -1376,14 +1414,14 @@ export class CreateUserProfile extends Message<CreateUserProfile> {
|
|
|
1376
1414
|
*/
|
|
1377
1415
|
export class UpdateUserProfile extends Message<UpdateUserProfile> {
|
|
1378
1416
|
/**
|
|
1379
|
-
* @generated from field: optional string
|
|
1417
|
+
* @generated from field: optional string given_name = 2;
|
|
1380
1418
|
*/
|
|
1381
|
-
|
|
1419
|
+
givenName?: string;
|
|
1382
1420
|
|
|
1383
1421
|
/**
|
|
1384
|
-
* @generated from field: optional string
|
|
1422
|
+
* @generated from field: optional string family_name = 3;
|
|
1385
1423
|
*/
|
|
1386
|
-
|
|
1424
|
+
familyName?: string;
|
|
1387
1425
|
|
|
1388
1426
|
/**
|
|
1389
1427
|
* @generated from field: optional string name = 4;
|
|
@@ -1410,6 +1448,38 @@ export class UpdateUserProfile extends Message<UpdateUserProfile> {
|
|
|
1410
1448
|
*/
|
|
1411
1449
|
customAttributes: { [key: string]: string } = {};
|
|
1412
1450
|
|
|
1451
|
+
/**
|
|
1452
|
+
* @generated from field: optional string first_name = 21 [deprecated = true];
|
|
1453
|
+
* @deprecated
|
|
1454
|
+
*/
|
|
1455
|
+
firstName?: string;
|
|
1456
|
+
|
|
1457
|
+
/**
|
|
1458
|
+
* @generated from field: optional string last_name = 22 [deprecated = true];
|
|
1459
|
+
* @deprecated
|
|
1460
|
+
*/
|
|
1461
|
+
lastName?: string;
|
|
1462
|
+
|
|
1463
|
+
/**
|
|
1464
|
+
* @generated from field: optional string preferred_username = 10;
|
|
1465
|
+
*/
|
|
1466
|
+
preferredUsername?: string;
|
|
1467
|
+
|
|
1468
|
+
/**
|
|
1469
|
+
* @generated from field: optional string picture = 11;
|
|
1470
|
+
*/
|
|
1471
|
+
picture?: string;
|
|
1472
|
+
|
|
1473
|
+
/**
|
|
1474
|
+
* @generated from field: optional string gender = 12;
|
|
1475
|
+
*/
|
|
1476
|
+
gender?: string;
|
|
1477
|
+
|
|
1478
|
+
/**
|
|
1479
|
+
* @generated from field: repeated string groups = 13;
|
|
1480
|
+
*/
|
|
1481
|
+
groups: string[] = [];
|
|
1482
|
+
|
|
1413
1483
|
constructor(data?: PartialMessage<UpdateUserProfile>) {
|
|
1414
1484
|
super();
|
|
1415
1485
|
proto3.util.initPartial(data, this);
|
|
@@ -1418,13 +1488,19 @@ export class UpdateUserProfile extends Message<UpdateUserProfile> {
|
|
|
1418
1488
|
static readonly runtime: typeof proto3 = proto3;
|
|
1419
1489
|
static readonly typeName = "scalekit.v1.users.UpdateUserProfile";
|
|
1420
1490
|
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
1421
|
-
{ no: 2, name: "
|
|
1422
|
-
{ no: 3, name: "
|
|
1491
|
+
{ no: 2, name: "given_name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1492
|
+
{ no: 3, name: "family_name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1423
1493
|
{ no: 4, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1424
1494
|
{ no: 5, name: "locale", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1425
1495
|
{ no: 7, name: "phone_number", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1426
1496
|
{ no: 8, name: "metadata", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
|
|
1427
1497
|
{ no: 9, name: "custom_attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
|
|
1498
|
+
{ no: 21, name: "first_name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1499
|
+
{ no: 22, name: "last_name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1500
|
+
{ no: 10, name: "preferred_username", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1501
|
+
{ no: 11, name: "picture", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1502
|
+
{ no: 12, name: "gender", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1503
|
+
{ no: 13, name: "groups", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
|
|
1428
1504
|
]);
|
|
1429
1505
|
|
|
1430
1506
|
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UpdateUserProfile {
|
|
@@ -1920,17 +1996,12 @@ export class Permission extends Message<Permission> {
|
|
|
1920
1996
|
name = "";
|
|
1921
1997
|
|
|
1922
1998
|
/**
|
|
1923
|
-
* @generated from field: string
|
|
1924
|
-
*/
|
|
1925
|
-
displayName = "";
|
|
1926
|
-
|
|
1927
|
-
/**
|
|
1928
|
-
* @generated from field: string description = 4;
|
|
1999
|
+
* @generated from field: string description = 3;
|
|
1929
2000
|
*/
|
|
1930
2001
|
description = "";
|
|
1931
2002
|
|
|
1932
2003
|
/**
|
|
1933
|
-
* @generated from field: repeated string tags =
|
|
2004
|
+
* @generated from field: repeated string tags = 4;
|
|
1934
2005
|
*/
|
|
1935
2006
|
tags: string[] = [];
|
|
1936
2007
|
|
|
@@ -1944,9 +2015,8 @@ export class Permission extends Message<Permission> {
|
|
|
1944
2015
|
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
1945
2016
|
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1946
2017
|
{ no: 2, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
1947
|
-
{ no: 3, name: "
|
|
1948
|
-
{ no: 4, name: "
|
|
1949
|
-
{ no: 5, name: "tags", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
|
|
2018
|
+
{ no: 3, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
2019
|
+
{ no: 4, name: "tags", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
|
|
1950
2020
|
]);
|
|
1951
2021
|
|
|
1952
2022
|
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Permission {
|
package/src/scalekit.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { IdTokenClaimToUserMap } from './constants/user';
|
|
|
7
7
|
import CoreClient from './core';
|
|
8
8
|
import DirectoryClient from './directory';
|
|
9
9
|
import DomainClient from './domain';
|
|
10
|
+
import AuthClient from './auth';
|
|
10
11
|
import OrganizationClient from './organization';
|
|
11
12
|
import PasswordlessClient from './passwordless';
|
|
12
13
|
import UserClient from './user';
|
|
@@ -43,6 +44,7 @@ export default class ScalekitClient {
|
|
|
43
44
|
readonly session: SessionClient;
|
|
44
45
|
readonly role: RoleClient;
|
|
45
46
|
readonly permission: PermissionClient;
|
|
47
|
+
readonly auth: AuthClient;
|
|
46
48
|
constructor(
|
|
47
49
|
envUrl: string,
|
|
48
50
|
clientId: string,
|
|
@@ -93,6 +95,10 @@ export default class ScalekitClient {
|
|
|
93
95
|
this.grpcConnect,
|
|
94
96
|
this.coreClient
|
|
95
97
|
);
|
|
98
|
+
this.auth = new AuthClient(
|
|
99
|
+
this.grpcConnect,
|
|
100
|
+
this.coreClient
|
|
101
|
+
);
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
/**
|
|
@@ -257,7 +263,37 @@ export default class ScalekitClient {
|
|
|
257
263
|
const webhookTimestamp = headers['webhook-timestamp'];
|
|
258
264
|
const webhookSignature = headers['webhook-signature'];
|
|
259
265
|
|
|
260
|
-
|
|
266
|
+
return this.verifyPayloadSignature(secret, webhookId, webhookTimestamp, webhookSignature, payload);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Verify interceptor payload
|
|
271
|
+
*
|
|
272
|
+
* @param {string} secret The secret
|
|
273
|
+
* @param {Record<string, string>} headers The headers
|
|
274
|
+
* @param {string} payload The payload
|
|
275
|
+
* @return {boolean} Returns true if the payload is valid.
|
|
276
|
+
*/
|
|
277
|
+
verifyInterceptorPayload(secret: string, headers: Record<string, string>, payload: string): boolean {
|
|
278
|
+
const interceptorId = headers['interceptor-id'];
|
|
279
|
+
const interceptorTimestamp = headers['interceptor-timestamp'];
|
|
280
|
+
const interceptorSignature = headers['interceptor-signature'];
|
|
281
|
+
|
|
282
|
+
return this.verifyPayloadSignature(secret, interceptorId, interceptorTimestamp, interceptorSignature, payload);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Common payload signature verification logic
|
|
287
|
+
*
|
|
288
|
+
* @param {string} secret The secret
|
|
289
|
+
* @param {string} id The webhook/interceptor id
|
|
290
|
+
* @param {string} timestamp The timestamp
|
|
291
|
+
* @param {string} signature The signature
|
|
292
|
+
* @param {string} payload The payload
|
|
293
|
+
* @return {boolean} Returns true if the payload signature is valid.
|
|
294
|
+
*/
|
|
295
|
+
private verifyPayloadSignature(secret: string, id: string, timestamp: string, signature: string, payload: string): boolean {
|
|
296
|
+
if (!id || !timestamp || !signature) {
|
|
261
297
|
throw new WebhookVerificationError("Missing required headers");
|
|
262
298
|
}
|
|
263
299
|
|
|
@@ -267,18 +303,18 @@ export default class ScalekitClient {
|
|
|
267
303
|
}
|
|
268
304
|
|
|
269
305
|
try {
|
|
270
|
-
const
|
|
271
|
-
const data = `${
|
|
306
|
+
const timestampDate = this.verifyTimestamp(timestamp);
|
|
307
|
+
const data = `${id}.${Math.floor(timestampDate.getTime() / 1000)}.${payload}`;
|
|
272
308
|
const secretBytes = Buffer.from(secretParts[1], 'base64');
|
|
273
309
|
const computedSignature = this.computeSignature(secretBytes, data);
|
|
274
|
-
const receivedSignatures =
|
|
310
|
+
const receivedSignatures = signature.split(" ");
|
|
275
311
|
|
|
276
312
|
for (const versionedSignature of receivedSignatures) {
|
|
277
|
-
const [version,
|
|
313
|
+
const [version, receivedSignature] = versionedSignature.split(",");
|
|
278
314
|
if (version !== WEBHOOK_SIGNATURE_VERSION) {
|
|
279
315
|
continue;
|
|
280
316
|
}
|
|
281
|
-
if (crypto.timingSafeEqual(Buffer.from(
|
|
317
|
+
if (crypto.timingSafeEqual(Buffer.from(receivedSignature, 'base64'), Buffer.from(computedSignature, 'base64'))) {
|
|
282
318
|
return true;
|
|
283
319
|
}
|
|
284
320
|
}
|