@dfns/sdk 0.7.12-rc.1 → 0.7.12

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/dfnsError.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export declare class DfnsError extends Error {
2
2
  httpStatus: number;
3
- context?: unknown;
3
+ context?: unknown | undefined;
4
4
  name: string;
5
- constructor(httpStatus: number, message: string, context?: unknown);
5
+ constructor(httpStatus: number, message: string, context?: unknown | undefined);
6
6
  toString(): string;
7
7
  }
8
8
  export declare class PolicyPendingError extends DfnsError {
@@ -69,8 +69,6 @@ export declare class AuthClient {
69
69
  sendLoginCode(request: T.SendLoginCodeRequest): Promise<T.SendLoginCodeResponse>;
70
70
  sendRecoveryCode(request: T.SendRecoveryCodeRequest): Promise<T.SendRecoveryCodeResponse>;
71
71
  socialLogin(request: T.SocialLoginRequest): Promise<T.SocialLoginResponse>;
72
- sSOLogin(request: T.SSOLoginRequest): Promise<T.SSOLoginResponse>;
73
72
  updatePersonalAccessToken(request: T.UpdatePersonalAccessTokenRequest): Promise<T.UpdatePersonalAccessTokenResponse>;
74
73
  updateServiceAccount(request: T.UpdateServiceAccountRequest): Promise<T.UpdateServiceAccountResponse>;
75
- updateUser(request: T.UpdateUserRequest): Promise<T.UpdateUserResponse>;
76
74
  }
@@ -610,18 +610,6 @@ class AuthClient {
610
610
  });
611
611
  return response.json();
612
612
  }
613
- async sSOLogin(request) {
614
- const path = (0, url_1.buildPathAndQuery)('/auth/login/sso', {
615
- path: request ?? {},
616
- query: {},
617
- });
618
- const response = await (0, fetch_1.simpleFetch)(path, {
619
- method: 'POST',
620
- body: request.body,
621
- apiOptions: this.apiOptions,
622
- });
623
- return response.json();
624
- }
625
613
  async updatePersonalAccessToken(request) {
626
614
  const path = (0, url_1.buildPathAndQuery)('/auth/pats/:tokenId', {
627
615
  path: request ?? {},
@@ -646,17 +634,5 @@ class AuthClient {
646
634
  });
647
635
  return response.json();
648
636
  }
649
- async updateUser(request) {
650
- const path = (0, url_1.buildPathAndQuery)('/auth/users/:userId', {
651
- path: request ?? {},
652
- query: {},
653
- });
654
- const response = await (0, userActionFetch_1.userActionFetch)(path, {
655
- method: 'PUT',
656
- body: request.body,
657
- apiOptions: this.apiOptions,
658
- });
659
- return response.json();
660
- }
661
637
  }
662
638
  exports.AuthClient = AuthClient;
@@ -81,11 +81,8 @@ export declare class DelegatedAuthClient {
81
81
  sendLoginCode(request: T.SendLoginCodeRequest): Promise<T.SendLoginCodeResponse>;
82
82
  sendRecoveryCode(request: T.SendRecoveryCodeRequest): Promise<T.SendRecoveryCodeResponse>;
83
83
  socialLogin(request: T.SocialLoginRequest): Promise<T.SocialLoginResponse>;
84
- sSOLogin(request: T.SSOLoginRequest): Promise<T.SSOLoginResponse>;
85
84
  updatePersonalAccessTokenInit(request: T.UpdatePersonalAccessTokenRequest): Promise<UserActionChallengeResponse>;
86
85
  updatePersonalAccessTokenComplete(request: T.UpdatePersonalAccessTokenRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.UpdatePersonalAccessTokenResponse>;
87
86
  updateServiceAccountInit(request: T.UpdateServiceAccountRequest): Promise<UserActionChallengeResponse>;
88
87
  updateServiceAccountComplete(request: T.UpdateServiceAccountRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.UpdateServiceAccountResponse>;
89
- updateUserInit(request: T.UpdateUserRequest): Promise<UserActionChallengeResponse>;
90
- updateUserComplete(request: T.UpdateUserRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.UpdateUserResponse>;
91
88
  }
@@ -878,18 +878,6 @@ class DelegatedAuthClient {
878
878
  });
879
879
  return response.json();
880
880
  }
881
- async sSOLogin(request) {
882
- const path = (0, url_1.buildPathAndQuery)('/auth/login/sso', {
883
- path: request ?? {},
884
- query: {},
885
- });
886
- const response = await (0, fetch_1.simpleFetch)(path, {
887
- method: 'POST',
888
- body: request.body,
889
- apiOptions: this.apiOptions,
890
- });
891
- return response.json();
892
- }
893
881
  async updatePersonalAccessTokenInit(request) {
894
882
  const path = (0, url_1.buildPathAndQuery)('/auth/pats/:tokenId', {
895
883
  path: request ?? {},
@@ -944,32 +932,5 @@ class DelegatedAuthClient {
944
932
  });
945
933
  return response.json();
946
934
  }
947
- async updateUserInit(request) {
948
- const path = (0, url_1.buildPathAndQuery)('/auth/users/:userId', {
949
- path: request ?? {},
950
- query: {},
951
- });
952
- const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
953
- userActionHttpMethod: 'PUT',
954
- userActionHttpPath: path,
955
- userActionPayload: JSON.stringify(request.body),
956
- userActionServerKind: 'Api',
957
- }, this.apiOptions);
958
- return challenge;
959
- }
960
- async updateUserComplete(request, signedChallenge) {
961
- const path = (0, url_1.buildPathAndQuery)('/auth/users/:userId', {
962
- path: request ?? {},
963
- query: {},
964
- });
965
- const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
966
- const response = await (0, fetch_1.simpleFetch)(path, {
967
- method: 'PUT',
968
- body: request.body,
969
- headers: { 'x-dfns-useraction': userAction },
970
- apiOptions: this.apiOptions,
971
- });
972
- return response.json();
973
- }
974
935
  }
975
936
  exports.DelegatedAuthClient = DelegatedAuthClient;
@@ -87,7 +87,6 @@ export type ActivateUserResponse = {
87
87
  isActive: boolean;
88
88
  isServiceAccount: boolean;
89
89
  isRegistered: boolean;
90
- isSSORequired: boolean;
91
90
  permissionAssignments: {
92
91
  permissionName: string;
93
92
  permissionId: string;
@@ -176,7 +175,6 @@ export type ArchiveUserResponse = {
176
175
  isActive: boolean;
177
176
  isServiceAccount: boolean;
178
177
  isRegistered: boolean;
179
- isSSORequired: boolean;
180
178
  permissionAssignments: {
181
179
  permissionName: string;
182
180
  permissionId: string;
@@ -214,27 +212,27 @@ export type CreateCredentialBody = {
214
212
  credentialName: string;
215
213
  challengeIdentifier: string;
216
214
  } | {
217
- credentialKind: "Password";
215
+ credentialKind: "RecoveryKey";
218
216
  credentialInfo: {
219
- password: string;
217
+ credId: string;
218
+ clientData: string;
219
+ attestationData: string;
220
220
  };
221
+ encryptedPrivateKey?: string | undefined;
221
222
  credentialName: string;
222
223
  challengeIdentifier: string;
223
224
  } | {
224
- credentialKind: "Totp";
225
+ credentialKind: "Password";
225
226
  credentialInfo: {
226
- otpCode: string;
227
+ password: string;
227
228
  };
228
229
  credentialName: string;
229
230
  challengeIdentifier: string;
230
231
  } | {
231
- credentialKind: "RecoveryKey";
232
+ credentialKind: "Totp";
232
233
  credentialInfo: {
233
- credId: string;
234
- clientData: string;
235
- attestationData: string;
234
+ otpCode: string;
236
235
  };
237
- encryptedPrivateKey?: string | undefined;
238
236
  credentialName: string;
239
237
  challengeIdentifier: string;
240
238
  };
@@ -256,35 +254,6 @@ export type CreateCredentialChallengeBody = {
256
254
  kind: "Fido2" | "Key" | "Password" | "Totp" | "RecoveryKey" | "PasswordProtectedKey";
257
255
  };
258
256
  export type CreateCredentialChallengeResponse = {
259
- kind: "Password";
260
- user: {
261
- id: string;
262
- displayName: string;
263
- name: string;
264
- };
265
- challengeIdentifier: string;
266
- rp?: {
267
- id: string;
268
- name: string;
269
- } | undefined;
270
- /** @deprecated use challengeIdentifier instead */
271
- temporaryAuthenticationToken: string;
272
- } | {
273
- kind: "Totp";
274
- user: {
275
- id: string;
276
- displayName: string;
277
- name: string;
278
- };
279
- challengeIdentifier: string;
280
- rp?: {
281
- id: string;
282
- name: string;
283
- } | undefined;
284
- otpUrl: string;
285
- /** @deprecated use challengeIdentifier instead */
286
- temporaryAuthenticationToken: string;
287
- } | {
288
257
  kind: "Fido2";
289
258
  user: {
290
259
  id: string;
@@ -374,15 +343,7 @@ export type CreateCredentialChallengeResponse = {
374
343
  }[];
375
344
  /** @deprecated use challengeIdentifier instead */
376
345
  temporaryAuthenticationToken: string;
377
- };
378
- export type CreateCredentialChallengeRequest = {
379
- body: CreateCredentialChallengeBody;
380
- };
381
- export type CreateCredentialChallengeWithCodeBody = {
382
- credentialKind: "Fido2" | "Key" | "Password" | "Totp" | "RecoveryKey" | "PasswordProtectedKey";
383
- code: string;
384
- };
385
- export type CreateCredentialChallengeWithCodeResponse = {
346
+ } | {
386
347
  kind: "Password";
387
348
  user: {
388
349
  id: string;
@@ -411,7 +372,15 @@ export type CreateCredentialChallengeWithCodeResponse = {
411
372
  otpUrl: string;
412
373
  /** @deprecated use challengeIdentifier instead */
413
374
  temporaryAuthenticationToken: string;
414
- } | {
375
+ };
376
+ export type CreateCredentialChallengeRequest = {
377
+ body: CreateCredentialChallengeBody;
378
+ };
379
+ export type CreateCredentialChallengeWithCodeBody = {
380
+ credentialKind: "Fido2" | "Key" | "Password" | "Totp" | "RecoveryKey" | "PasswordProtectedKey";
381
+ code: string;
382
+ };
383
+ export type CreateCredentialChallengeWithCodeResponse = {
415
384
  kind: "Fido2";
416
385
  user: {
417
386
  id: string;
@@ -501,6 +470,35 @@ export type CreateCredentialChallengeWithCodeResponse = {
501
470
  }[];
502
471
  /** @deprecated use challengeIdentifier instead */
503
472
  temporaryAuthenticationToken: string;
473
+ } | {
474
+ kind: "Password";
475
+ user: {
476
+ id: string;
477
+ displayName: string;
478
+ name: string;
479
+ };
480
+ challengeIdentifier: string;
481
+ rp?: {
482
+ id: string;
483
+ name: string;
484
+ } | undefined;
485
+ /** @deprecated use challengeIdentifier instead */
486
+ temporaryAuthenticationToken: string;
487
+ } | {
488
+ kind: "Totp";
489
+ user: {
490
+ id: string;
491
+ displayName: string;
492
+ name: string;
493
+ };
494
+ challengeIdentifier: string;
495
+ rp?: {
496
+ id: string;
497
+ name: string;
498
+ } | undefined;
499
+ otpUrl: string;
500
+ /** @deprecated use challengeIdentifier instead */
501
+ temporaryAuthenticationToken: string;
504
502
  };
505
503
  export type CreateCredentialChallengeWithCodeRequest = {
506
504
  body: CreateCredentialChallengeWithCodeBody;
@@ -545,27 +543,27 @@ export type CreateCredentialWithCodeBody = {
545
543
  credentialName: string;
546
544
  challengeIdentifier: string;
547
545
  } | {
548
- credentialKind: "Password";
546
+ credentialKind: "RecoveryKey";
549
547
  credentialInfo: {
550
- password: string;
548
+ credId: string;
549
+ clientData: string;
550
+ attestationData: string;
551
551
  };
552
+ encryptedPrivateKey?: string | undefined;
552
553
  credentialName: string;
553
554
  challengeIdentifier: string;
554
555
  } | {
555
- credentialKind: "Totp";
556
+ credentialKind: "Password";
556
557
  credentialInfo: {
557
- otpCode: string;
558
+ password: string;
558
559
  };
559
560
  credentialName: string;
560
561
  challengeIdentifier: string;
561
562
  } | {
562
- credentialKind: "RecoveryKey";
563
+ credentialKind: "Totp";
563
564
  credentialInfo: {
564
- credId: string;
565
- clientData: string;
566
- attestationData: string;
565
+ otpCode: string;
567
566
  };
568
- encryptedPrivateKey?: string | undefined;
569
567
  credentialName: string;
570
568
  challengeIdentifier: string;
571
569
  };
@@ -915,12 +913,14 @@ export type CreateSocialRegistrationChallengeRequest = {
915
913
  body: CreateSocialRegistrationChallengeBody;
916
914
  };
917
915
  export type CreateUserBody = {
916
+ /** The email address of the new user. */
918
917
  email: string;
918
+ /** The kind of user being created.
919
+ In this endpoint it can only be "`CustomerEmployee`" (creating an "`EndUser`" is done through the [Delegated Registration](https://docs.dfns.co/api-reference/auth/registration-flows#delegated-users-registration-flow) endpoint) */
919
920
  kind: "CustomerEmployee" | "DfnsStaff";
920
921
  publicKey?: string | undefined;
922
+ /** Value that can be used to correlate the entity with an external system. */
921
923
  externalId?: string | undefined;
922
- /** If set to true, the user will have to authenticate via SSO */
923
- isSSORequired?: boolean;
924
924
  };
925
925
  export type CreateUserResponse = {
926
926
  username: string;
@@ -933,7 +933,6 @@ export type CreateUserResponse = {
933
933
  isActive: boolean;
934
934
  isServiceAccount: boolean;
935
935
  isRegistered: boolean;
936
- isSSORequired: boolean;
937
936
  permissionAssignments: {
938
937
  permissionName: string;
939
938
  permissionId: string;
@@ -985,7 +984,9 @@ export type CreateUserActionChallengeRequest = {
985
984
  body: CreateUserActionChallengeBody;
986
985
  };
987
986
  export type CreateUserActionSignatureBody = {
987
+ /** Temporary authentication token returned by the [Create User Action Signature Challenge](https://docs.dfns.co/api-reference/auth/create-user-action-challenge) */
988
988
  challengeIdentifier: string;
989
+ /** First factor credential used to sign the user action */
989
990
  firstFactor: {
990
991
  kind: "Fido2";
991
992
  credentialAssertion: {
@@ -1016,6 +1017,7 @@ export type CreateUserActionSignatureBody = {
1016
1017
  algorithm?: string | undefined;
1017
1018
  };
1018
1019
  };
1020
+ /** Second factor credential used to authenticate a user */
1019
1021
  secondFactor?: ({
1020
1022
  kind: "Fido2";
1021
1023
  credentialAssertion: {
@@ -1142,7 +1144,6 @@ export type DeactivateUserResponse = {
1142
1144
  isActive: boolean;
1143
1145
  isServiceAccount: boolean;
1144
1146
  isRegistered: boolean;
1145
- isSSORequired: boolean;
1146
1147
  permissionAssignments: {
1147
1148
  permissionName: string;
1148
1149
  permissionId: string;
@@ -1300,7 +1301,6 @@ export type GetUserResponse = {
1300
1301
  isActive: boolean;
1301
1302
  isServiceAccount: boolean;
1302
1303
  isRegistered: boolean;
1303
- isSSORequired: boolean;
1304
1304
  permissionAssignments: {
1305
1305
  permissionName: string;
1306
1306
  permissionId: string;
@@ -1446,7 +1446,6 @@ export type ListUsersResponse = {
1446
1446
  isActive: boolean;
1447
1447
  isServiceAccount: boolean;
1448
1448
  isRegistered: boolean;
1449
- isSSORequired: boolean;
1450
1449
  permissionAssignments: {
1451
1450
  permissionName: string;
1452
1451
  permissionId: string;
@@ -1460,7 +1459,9 @@ export type ListUsersRequest = {
1460
1459
  query?: ListUsersQuery;
1461
1460
  };
1462
1461
  export type LoginBody = {
1462
+ /** Temporary authentication token returned by the [Create User Action Signature Challenge](https://docs.dfns.co/api-reference/auth/create-user-action-challenge) */
1463
1463
  challengeIdentifier: string;
1464
+ /** First factor credential used to sign the user action */
1464
1465
  firstFactor: {
1465
1466
  kind: "Fido2";
1466
1467
  credentialAssertion: {
@@ -1491,6 +1492,7 @@ export type LoginBody = {
1491
1492
  algorithm?: string | undefined;
1492
1493
  };
1493
1494
  };
1495
+ /** Second factor credential used to authenticate a user */
1494
1496
  secondFactor?: ({
1495
1497
  kind: "Fido2";
1496
1498
  credentialAssertion: {
@@ -1524,8 +1526,6 @@ export type LoginBody = {
1524
1526
  };
1525
1527
  export type LoginResponse = {
1526
1528
  token: string;
1527
- } | {
1528
- ssoRedirectUrl: string;
1529
1529
  };
1530
1530
  export type LoginRequest = {
1531
1531
  body: LoginBody;
@@ -1614,6 +1614,7 @@ export type RecoverBody = {
1614
1614
  encryptedPrivateKey: string;
1615
1615
  credentialName?: string | undefined;
1616
1616
  }) | undefined;
1617
+ /** Register a recovery key. See [Account Recovery](https://docs.dfns.co/api-reference/auth/account-recovery) for more details. */
1617
1618
  recoveryCredential?: {
1618
1619
  credentialKind: "RecoveryKey";
1619
1620
  credentialInfo: {
@@ -1706,6 +1707,7 @@ export type RegisterBody = {
1706
1707
  encryptedPrivateKey: string;
1707
1708
  credentialName?: string | undefined;
1708
1709
  }) | undefined;
1710
+ /** Register a recovery key. See [Account Recovery](https://docs.dfns.co/api-reference/auth/account-recovery) for more details. */
1709
1711
  recoveryCredential?: {
1710
1712
  credentialKind: "RecoveryKey";
1711
1713
  credentialInfo: {
@@ -1797,6 +1799,7 @@ export type RegisterEndUserBody = {
1797
1799
  encryptedPrivateKey: string;
1798
1800
  credentialName?: string | undefined;
1799
1801
  }) | undefined;
1802
+ /** Register a recovery key. See [Account Recovery](https://docs.dfns.co/api-reference/auth/account-recovery) for more details. */
1800
1803
  recoveryCredential?: {
1801
1804
  credentialKind: "RecoveryKey";
1802
1805
  credentialInfo: {
@@ -1891,19 +1894,6 @@ export type SocialLoginResponse = {
1891
1894
  export type SocialLoginRequest = {
1892
1895
  body: SocialLoginBody;
1893
1896
  };
1894
- export type SSOLoginBody = {
1895
- orgId: string;
1896
- /** Authorization code obtained from the IdP */
1897
- code: string;
1898
- /** Redirect URI used in the initial authorization request */
1899
- redirectUri: string;
1900
- };
1901
- export type SSOLoginResponse = {
1902
- token: string;
1903
- };
1904
- export type SSOLoginRequest = {
1905
- body: SSOLoginBody;
1906
- };
1907
1897
  export type UpdatePersonalAccessTokenBody = {
1908
1898
  name?: string | undefined;
1909
1899
  externalId?: string | undefined;
@@ -1982,31 +1972,3 @@ export type UpdateServiceAccountResponse = {
1982
1972
  export type UpdateServiceAccountRequest = UpdateServiceAccountParams & {
1983
1973
  body: UpdateServiceAccountBody;
1984
1974
  };
1985
- export type UpdateUserBody = {
1986
- isSSORequired: boolean;
1987
- };
1988
- export type UpdateUserParams = {
1989
- userId: string;
1990
- };
1991
- export type UpdateUserResponse = {
1992
- username: string;
1993
- name: string;
1994
- userId: string;
1995
- kind: "CustomerEmployee" | "DfnsStaff" | "EndUser";
1996
- credentialUuid: string;
1997
- orgId: string;
1998
- permissions?: string[] | undefined;
1999
- isActive: boolean;
2000
- isServiceAccount: boolean;
2001
- isRegistered: boolean;
2002
- isSSORequired: boolean;
2003
- permissionAssignments: {
2004
- permissionName: string;
2005
- permissionId: string;
2006
- assignmentId: string;
2007
- operations?: string[] | undefined;
2008
- }[];
2009
- };
2010
- export type UpdateUserRequest = UpdateUserParams & {
2011
- body: UpdateUserBody;
2012
- };