@authsome/client 0.0.4 → 0.0.5

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.
Files changed (69) hide show
  1. package/dist/client.d.ts +49 -45
  2. package/dist/client.js +35 -21
  3. package/dist/index.d.ts +21 -21
  4. package/dist/index.js +65 -65
  5. package/dist/plugins/admin.d.ts +5 -5
  6. package/dist/plugins/admin.js +10 -20
  7. package/dist/plugins/anonymous.d.ts +1 -1
  8. package/dist/plugins/anonymous.js +4 -2
  9. package/dist/plugins/apikey.d.ts +7 -7
  10. package/dist/plugins/apikey.js +28 -14
  11. package/dist/plugins/backupauth.d.ts +28 -28
  12. package/dist/plugins/cms.d.ts +11 -11
  13. package/dist/plugins/cms.js +38 -28
  14. package/dist/plugins/compliance.d.ts +33 -33
  15. package/dist/plugins/compliance.js +4 -2
  16. package/dist/plugins/consent.d.ts +18 -18
  17. package/dist/plugins/emailverification.d.ts +2 -2
  18. package/dist/plugins/emailverification.js +4 -2
  19. package/dist/plugins/idverification.d.ts +11 -11
  20. package/dist/plugins/impersonation.d.ts +6 -6
  21. package/dist/plugins/impersonation.js +4 -8
  22. package/dist/plugins/jwt.d.ts +6 -5
  23. package/dist/plugins/jwt.js +16 -8
  24. package/dist/plugins/mfa.d.ts +9 -9
  25. package/dist/plugins/mfa.js +4 -8
  26. package/dist/plugins/multiapp.d.ts +19 -19
  27. package/dist/plugins/multiapp.js +16 -8
  28. package/dist/plugins/multisession.d.ts +5 -5
  29. package/dist/plugins/multisession.js +4 -2
  30. package/dist/plugins/notification.d.ts +15 -15
  31. package/dist/plugins/notification.js +12 -6
  32. package/dist/plugins/oidcprovider.d.ts +11 -11
  33. package/dist/plugins/oidcprovider.js +12 -6
  34. package/dist/plugins/organization.d.ts +5 -5
  35. package/dist/plugins/secrets.d.ts +10 -10
  36. package/dist/plugins/secrets.js +32 -16
  37. package/dist/plugins/social.js +1 -1
  38. package/dist/plugins/stepup.d.ts +13 -13
  39. package/dist/plugins/twofa.d.ts +6 -6
  40. package/dist/plugins/twofa.js +12 -24
  41. package/dist/plugins/username.d.ts +2 -2
  42. package/dist/plugins/username.js +8 -4
  43. package/dist/types.d.ts +3336 -2788
  44. package/package.json +1 -1
  45. package/src/client.ts +60 -45
  46. package/src/index.ts +21 -21
  47. package/src/plugins/admin.ts +10 -20
  48. package/src/plugins/anonymous.ts +4 -2
  49. package/src/plugins/apikey.ts +28 -14
  50. package/src/plugins/backupauth.ts +56 -56
  51. package/src/plugins/cms.ts +38 -28
  52. package/src/plugins/compliance.ts +68 -66
  53. package/src/plugins/consent.ts +36 -36
  54. package/src/plugins/emailverification.ts +6 -4
  55. package/src/plugins/idverification.ts +22 -22
  56. package/src/plugins/impersonation.ts +12 -16
  57. package/src/plugins/jwt.ts +18 -10
  58. package/src/plugins/mfa.ts +18 -22
  59. package/src/plugins/multiapp.ts +46 -38
  60. package/src/plugins/multisession.ts +11 -9
  61. package/src/plugins/notification.ts +36 -30
  62. package/src/plugins/oidcprovider.ts +28 -22
  63. package/src/plugins/organization.ts +10 -10
  64. package/src/plugins/secrets.ts +36 -20
  65. package/src/plugins/social.ts +1 -1
  66. package/src/plugins/stepup.ts +26 -26
  67. package/src/plugins/twofa.ts +12 -24
  68. package/src/plugins/username.ts +8 -4
  69. package/src/types.ts +3581 -2856
@@ -12,26 +12,26 @@ export class OidcproviderPlugin implements ClientPlugin {
12
12
  this.client = client;
13
13
  }
14
14
 
15
- async registerClient(request: types.ClientRegistrationRequest): Promise<void> {
15
+ async registerClient(request: types.ClientRegistrationRequest): Promise<types.ClientRegistrationResponse> {
16
16
  const path = '/register';
17
- return this.client.request<void>('POST', path, {
17
+ return this.client.request<types.ClientRegistrationResponse>('POST', path, {
18
18
  body: request,
19
19
  });
20
20
  }
21
21
 
22
- async listClients(): Promise<void> {
22
+ async listClients(): Promise<types.ClientsListResponse> {
23
23
  const path = '/listclients';
24
- return this.client.request<void>('GET', path);
24
+ return this.client.request<types.ClientsListResponse>('GET', path);
25
25
  }
26
26
 
27
- async getClient(params: { clientId: string }): Promise<void> {
27
+ async getClient(params: { clientId: string }): Promise<types.ClientDetailsResponse> {
28
28
  const path = `/${params.clientId}`;
29
- return this.client.request<void>('GET', path);
29
+ return this.client.request<types.ClientDetailsResponse>('GET', path);
30
30
  }
31
31
 
32
- async updateClient(params: { clientId: string }, request: types.ClientUpdateRequest): Promise<void> {
32
+ async updateClient(params: { clientId: string }, request: types.ClientUpdateRequest): Promise<types.ClientDetailsResponse> {
33
33
  const path = `/${params.clientId}`;
34
- return this.client.request<void>('PUT', path, {
34
+ return this.client.request<types.ClientDetailsResponse>('PUT', path, {
35
35
  body: request,
36
36
  });
37
37
  }
@@ -41,14 +41,14 @@ export class OidcproviderPlugin implements ClientPlugin {
41
41
  return this.client.request<void>('DELETE', path);
42
42
  }
43
43
 
44
- async discovery(): Promise<void> {
44
+ async discovery(): Promise<types.DiscoveryResponse> {
45
45
  const path = '/.well-known/openid-configuration';
46
- return this.client.request<void>('GET', path);
46
+ return this.client.request<types.DiscoveryResponse>('GET', path);
47
47
  }
48
48
 
49
- async jWKS(): Promise<void> {
49
+ async jWKS(): Promise<types.JWKSResponse> {
50
50
  const path = '/jwks';
51
- return this.client.request<void>('GET', path);
51
+ return this.client.request<types.JWKSResponse>('GET', path);
52
52
  }
53
53
 
54
54
  async authorize(): Promise<void> {
@@ -56,31 +56,37 @@ export class OidcproviderPlugin implements ClientPlugin {
56
56
  return this.client.request<void>('GET', path);
57
57
  }
58
58
 
59
- async handleConsent(): Promise<void> {
59
+ async handleConsent(request: types.ConsentRequest): Promise<void> {
60
60
  const path = '/consent';
61
- return this.client.request<void>('POST', path);
61
+ return this.client.request<void>('POST', path, {
62
+ body: request,
63
+ });
62
64
  }
63
65
 
64
- async token(request: types.TokenRequest): Promise<void> {
66
+ async token(request: types.TokenRequest): Promise<types.TokenResponse> {
65
67
  const path = '/token';
66
- return this.client.request<void>('POST', path, {
68
+ return this.client.request<types.TokenResponse>('POST', path, {
67
69
  body: request,
68
70
  });
69
71
  }
70
72
 
71
- async userInfo(): Promise<void> {
73
+ async userInfo(): Promise<types.UserInfoResponse> {
72
74
  const path = '/userinfo';
73
- return this.client.request<void>('GET', path);
75
+ return this.client.request<types.UserInfoResponse>('GET', path);
74
76
  }
75
77
 
76
- async introspectToken(): Promise<void> {
78
+ async introspectToken(request: types.TokenIntrospectionRequest): Promise<types.TokenIntrospectionResponse> {
77
79
  const path = '/introspect';
78
- return this.client.request<void>('POST', path);
80
+ return this.client.request<types.TokenIntrospectionResponse>('POST', path, {
81
+ body: request,
82
+ });
79
83
  }
80
84
 
81
- async revokeToken(): Promise<types.StatusResponse> {
85
+ async revokeToken(request: types.TokenRevocationRequest): Promise<types.StatusResponse> {
82
86
  const path = '/revoke';
83
- return this.client.request<types.StatusResponse>('POST', path);
87
+ return this.client.request<types.StatusResponse>('POST', path, {
88
+ body: request,
89
+ });
84
90
  }
85
91
 
86
92
  }
@@ -12,14 +12,14 @@ export class OrganizationPlugin implements ClientPlugin {
12
12
  this.client = client;
13
13
  }
14
14
 
15
- async createOrganization(): Promise<void> {
15
+ async createOrganization(): Promise<types.Organization> {
16
16
  const path = '/createorganization';
17
- return this.client.request<void>('POST', path);
17
+ return this.client.request<types.Organization>('POST', path);
18
18
  }
19
19
 
20
- async updateOrganization(params: { id: string }): Promise<void> {
20
+ async updateOrganization(params: { id: string }): Promise<types.Organization> {
21
21
  const path = `/${params.id}`;
22
- return this.client.request<void>('PATCH', path);
22
+ return this.client.request<types.Organization>('PATCH', path);
23
23
  }
24
24
 
25
25
  async deleteOrganization(params: { id: string }): Promise<void> {
@@ -52,19 +52,19 @@ export class OrganizationPlugin implements ClientPlugin {
52
52
  return this.client.request<void>('DELETE', path);
53
53
  }
54
54
 
55
- async getOrganization(params: { id: string }): Promise<void> {
55
+ async getOrganization(params: { id: string }): Promise<types.Organization> {
56
56
  const path = `/${params.id}`;
57
- return this.client.request<void>('GET', path);
57
+ return this.client.request<types.Organization>('GET', path);
58
58
  }
59
59
 
60
- async listOrganizations(): Promise<void> {
60
+ async listOrganizations(): Promise<types.Organization> {
61
61
  const path = '/listorganizations';
62
- return this.client.request<void>('GET', path);
62
+ return this.client.request<types.Organization>('GET', path);
63
63
  }
64
64
 
65
- async getOrganizationBySlug(params: { slug: string }): Promise<void> {
65
+ async getOrganizationBySlug(params: { slug: string }): Promise<types.Organization> {
66
66
  const path = `/slug/${params.slug}`;
67
- return this.client.request<void>('GET', path);
67
+ return this.client.request<types.Organization>('GET', path);
68
68
  }
69
69
 
70
70
  async listMembers(): Promise<void> {
@@ -12,34 +12,46 @@ export class SecretsPlugin implements ClientPlugin {
12
12
  this.client = client;
13
13
  }
14
14
 
15
- async list(): Promise<types.ListSecretsResponse> {
15
+ async list(request?: types.ListSecretsRequest): Promise<types.ListSecretsResponse> {
16
16
  const path = '/list';
17
- return this.client.request<types.ListSecretsResponse>('GET', path);
17
+ return this.client.request<types.ListSecretsResponse>('GET', path, {
18
+ query: this.client.toQueryParams(request),
19
+ });
18
20
  }
19
21
 
20
- async create(): Promise<types.ErrorResponse> {
22
+ async create(request: types.CreateSecretRequest): Promise<types.SecretDTO> {
21
23
  const path = '/create';
22
- return this.client.request<types.ErrorResponse>('POST', path);
24
+ return this.client.request<types.SecretDTO>('POST', path, {
25
+ body: request,
26
+ });
23
27
  }
24
28
 
25
- async get(params: { id: string }): Promise<types.ErrorResponse> {
29
+ async get(params: { id: string }, request?: types.GetSecretRequest): Promise<types.SecretDTO> {
26
30
  const path = `/${params.id}`;
27
- return this.client.request<types.ErrorResponse>('GET', path);
31
+ return this.client.request<types.SecretDTO>('GET', path, {
32
+ query: this.client.toQueryParams(request),
33
+ });
28
34
  }
29
35
 
30
- async getValue(params: { id: string }): Promise<types.RevealValueResponse> {
36
+ async getValue(params: { id: string }, request?: types.GetValueRequest): Promise<types.RevealValueResponse> {
31
37
  const path = `/${params.id}/value`;
32
- return this.client.request<types.RevealValueResponse>('GET', path);
38
+ return this.client.request<types.RevealValueResponse>('GET', path, {
39
+ query: this.client.toQueryParams(request),
40
+ });
33
41
  }
34
42
 
35
- async update(params: { id: string }): Promise<types.ErrorResponse> {
43
+ async update(params: { id: string }, request: types.UpdateSecretRequest): Promise<types.SecretDTO> {
36
44
  const path = `/${params.id}`;
37
- return this.client.request<types.ErrorResponse>('PUT', path);
45
+ return this.client.request<types.SecretDTO>('PUT', path, {
46
+ body: request,
47
+ });
38
48
  }
39
49
 
40
- async delete(params: { id: string }): Promise<types.SuccessResponse> {
50
+ async delete(params: { id: string }, request?: types.DeleteSecretRequest): Promise<types.SuccessResponse> {
41
51
  const path = `/${params.id}`;
42
- return this.client.request<types.SuccessResponse>('DELETE', path);
52
+ return this.client.request<types.SuccessResponse>('DELETE', path, {
53
+ query: this.client.toQueryParams(request),
54
+ });
43
55
  }
44
56
 
45
57
  async getByPath(): Promise<types.ErrorResponse> {
@@ -47,26 +59,30 @@ export class SecretsPlugin implements ClientPlugin {
47
59
  return this.client.request<types.ErrorResponse>('GET', path);
48
60
  }
49
61
 
50
- async getVersions(params: { id: string }): Promise<types.ListVersionsResponse> {
62
+ async getVersions(params: { id: string }, request?: types.GetVersionsRequest): Promise<types.ListVersionsResponse> {
51
63
  const path = `/${params.id}/versions`;
52
- return this.client.request<types.ListVersionsResponse>('GET', path);
64
+ return this.client.request<types.ListVersionsResponse>('GET', path, {
65
+ query: this.client.toQueryParams(request),
66
+ });
53
67
  }
54
68
 
55
- async rollback(params: { id: string; version: number }, request: types.Rollback_req): Promise<types.ErrorResponse> {
69
+ async rollback(params: { id: string; version: number }, request: types.RollbackRequest): Promise<types.SecretDTO> {
56
70
  const path = `/${params.id}/rollback/${params.version}`;
57
- return this.client.request<types.ErrorResponse>('POST', path, {
71
+ return this.client.request<types.SecretDTO>('POST', path, {
58
72
  body: request,
59
73
  });
60
74
  }
61
75
 
62
- async getStats(): Promise<void> {
76
+ async getStats(): Promise<types.StatsDTO> {
63
77
  const path = '/stats';
64
- return this.client.request<void>('GET', path);
78
+ return this.client.request<types.StatsDTO>('GET', path);
65
79
  }
66
80
 
67
- async getTree(): Promise<void> {
81
+ async getTree(request?: types.GetTreeRequest): Promise<types.SecretTreeNode> {
68
82
  const path = '/tree';
69
- return this.client.request<void>('GET', path);
83
+ return this.client.request<types.SecretTreeNode>('GET', path, {
84
+ query: this.client.toQueryParams(request),
85
+ });
70
86
  }
71
87
 
72
88
  }
@@ -22,7 +22,7 @@ export class SocialPlugin implements ClientPlugin {
22
22
  async callback(params: { provider: string }, query?: { state?: string; code?: string; error?: string; errorDescription?: string }): Promise<types.CallbackDataResponse> {
23
23
  const path = `/callback/${params.provider}`;
24
24
  return this.client.request<types.CallbackDataResponse>('GET', path, {
25
- query,
25
+ query: this.client.toQueryParams(query),
26
26
  });
27
27
  }
28
28
 
@@ -12,33 +12,33 @@ export class StepupPlugin implements ClientPlugin {
12
12
  this.client = client;
13
13
  }
14
14
 
15
- async evaluate(request: types.EvaluateRequest): Promise<void> {
15
+ async evaluate(request: types.EvaluateRequest): Promise<types.StepUpEvaluationResponse> {
16
16
  const path = '/evaluate';
17
- return this.client.request<void>('POST', path, {
17
+ return this.client.request<types.StepUpEvaluationResponse>('POST', path, {
18
18
  body: request,
19
19
  });
20
20
  }
21
21
 
22
- async verify(request: types.VerifyRequest): Promise<void> {
22
+ async verify(request: types.VerifyRequest): Promise<types.StepUpVerificationResponse> {
23
23
  const path = '/verify';
24
- return this.client.request<void>('POST', path, {
24
+ return this.client.request<types.StepUpVerificationResponse>('POST', path, {
25
25
  body: request,
26
26
  });
27
27
  }
28
28
 
29
- async getRequirement(params: { id: string }): Promise<void> {
29
+ async getRequirement(params: { id: string }): Promise<types.StepUpRequirementResponse> {
30
30
  const path = `/requirements/${params.id}`;
31
- return this.client.request<void>('GET', path);
31
+ return this.client.request<types.StepUpRequirementResponse>('GET', path);
32
32
  }
33
33
 
34
- async listPendingRequirements(): Promise<types.RequirementsResponse> {
34
+ async listPendingRequirements(): Promise<types.StepUpRequirementsResponse> {
35
35
  const path = '/requirements/pending';
36
- return this.client.request<types.RequirementsResponse>('GET', path);
36
+ return this.client.request<types.StepUpRequirementsResponse>('GET', path);
37
37
  }
38
38
 
39
- async listVerifications(): Promise<void> {
39
+ async listVerifications(): Promise<types.StepUpVerificationsResponse> {
40
40
  const path = '/verifications';
41
- return this.client.request<void>('GET', path);
41
+ return this.client.request<types.StepUpVerificationsResponse>('GET', path);
42
42
  }
43
43
 
44
44
  async listRememberedDevices(): Promise<types.StepUpDevicesResponse> {
@@ -46,48 +46,48 @@ export class StepupPlugin implements ClientPlugin {
46
46
  return this.client.request<types.StepUpDevicesResponse>('GET', path);
47
47
  }
48
48
 
49
- async forgetDevice(params: { id: string }): Promise<types.ForgetDeviceResponse> {
49
+ async forgetDevice(params: { id: string }): Promise<types.StepUpStatusResponse> {
50
50
  const path = `/devices/${params.id}`;
51
- return this.client.request<types.ForgetDeviceResponse>('DELETE', path);
51
+ return this.client.request<types.StepUpStatusResponse>('DELETE', path);
52
52
  }
53
53
 
54
- async createPolicy(request: types.StepUpPolicy): Promise<types.StepUpPolicy> {
54
+ async createPolicy(request: types.StepUpPolicy): Promise<types.StepUpPolicyResponse> {
55
55
  const path = '/policies';
56
- return this.client.request<types.StepUpPolicy>('POST', path, {
56
+ return this.client.request<types.StepUpPolicyResponse>('POST', path, {
57
57
  body: request,
58
58
  });
59
59
  }
60
60
 
61
- async listPolicies(): Promise<void> {
61
+ async listPolicies(): Promise<types.StepUpPoliciesResponse> {
62
62
  const path = '/policies';
63
- return this.client.request<void>('GET', path);
63
+ return this.client.request<types.StepUpPoliciesResponse>('GET', path);
64
64
  }
65
65
 
66
- async getPolicy(params: { id: string }): Promise<void> {
66
+ async getPolicy(params: { id: string }): Promise<types.StepUpPolicyResponse> {
67
67
  const path = `/policies/${params.id}`;
68
- return this.client.request<void>('GET', path);
68
+ return this.client.request<types.StepUpPolicyResponse>('GET', path);
69
69
  }
70
70
 
71
- async updatePolicy(params: { id: string }, request: types.StepUpPolicy): Promise<types.StepUpPolicy> {
71
+ async updatePolicy(params: { id: string }, request: types.StepUpPolicy): Promise<types.StepUpPolicyResponse> {
72
72
  const path = `/policies/${params.id}`;
73
- return this.client.request<types.StepUpPolicy>('PUT', path, {
73
+ return this.client.request<types.StepUpPolicyResponse>('PUT', path, {
74
74
  body: request,
75
75
  });
76
76
  }
77
77
 
78
- async deletePolicy(params: { id: string }): Promise<void> {
78
+ async deletePolicy(params: { id: string }): Promise<types.StepUpStatusResponse> {
79
79
  const path = `/policies/${params.id}`;
80
- return this.client.request<void>('DELETE', path);
80
+ return this.client.request<types.StepUpStatusResponse>('DELETE', path);
81
81
  }
82
82
 
83
- async getAuditLogs(): Promise<void> {
83
+ async getAuditLogs(): Promise<types.StepUpAuditLogsResponse> {
84
84
  const path = '/audit';
85
- return this.client.request<void>('GET', path);
85
+ return this.client.request<types.StepUpAuditLogsResponse>('GET', path);
86
86
  }
87
87
 
88
- async status(): Promise<void> {
88
+ async status(): Promise<types.StepUpStatusResponse> {
89
89
  const path = '/status';
90
- return this.client.request<void>('GET', path);
90
+ return this.client.request<types.StepUpStatusResponse>('GET', path);
91
91
  }
92
92
 
93
93
  }
@@ -12,46 +12,34 @@ export class TwofaPlugin implements ClientPlugin {
12
12
  this.client = client;
13
13
  }
14
14
 
15
- async enable(request: types.Enable_body): Promise<void> {
15
+ async enable(): Promise<void> {
16
16
  const path = '/2fa/enable';
17
- return this.client.request<void>('POST', path, {
18
- body: request,
19
- });
17
+ return this.client.request<void>('POST', path);
20
18
  }
21
19
 
22
- async verify(request: types.Verify_body): Promise<types.StatusResponse> {
20
+ async verify(): Promise<types.StatusResponse> {
23
21
  const path = '/2fa/verify';
24
- return this.client.request<types.StatusResponse>('POST', path, {
25
- body: request,
26
- });
22
+ return this.client.request<types.StatusResponse>('POST', path);
27
23
  }
28
24
 
29
- async disable(request: types.Disable_body): Promise<types.StatusResponse> {
25
+ async disable(): Promise<types.StatusResponse> {
30
26
  const path = '/2fa/disable';
31
- return this.client.request<types.StatusResponse>('POST', path, {
32
- body: request,
33
- });
27
+ return this.client.request<types.StatusResponse>('POST', path);
34
28
  }
35
29
 
36
- async generateBackupCodes(request: types.GenerateBackupCodes_body): Promise<types.CodesResponse> {
30
+ async generateBackupCodes(): Promise<types.CodesResponse> {
37
31
  const path = '/2fa/generate-backup-codes';
38
- return this.client.request<types.CodesResponse>('POST', path, {
39
- body: request,
40
- });
32
+ return this.client.request<types.CodesResponse>('POST', path);
41
33
  }
42
34
 
43
- async sendOTP(request: types.SendOTP_body): Promise<types.OTPSentResponse> {
35
+ async sendOTP(): Promise<types.OTPSentResponse> {
44
36
  const path = '/2fa/send-otp';
45
- return this.client.request<types.OTPSentResponse>('POST', path, {
46
- body: request,
47
- });
37
+ return this.client.request<types.OTPSentResponse>('POST', path);
48
38
  }
49
39
 
50
- async status(request: types.Status_body): Promise<types.TwoFAStatusResponse> {
40
+ async status(): Promise<types.TwoFAStatusResponse> {
51
41
  const path = '/2fa/status';
52
- return this.client.request<types.TwoFAStatusResponse>('POST', path, {
53
- body: request,
54
- });
42
+ return this.client.request<types.TwoFAStatusResponse>('POST', path);
55
43
  }
56
44
 
57
45
  }
@@ -12,14 +12,18 @@ export class UsernamePlugin implements ClientPlugin {
12
12
  this.client = client;
13
13
  }
14
14
 
15
- async signUp(): Promise<types.SignUpResponse> {
15
+ async signUp(request: types.SignUpRequest): Promise<types.SignUpResponse> {
16
16
  const path = '/username/signup';
17
- return this.client.request<types.SignUpResponse>('POST', path);
17
+ return this.client.request<types.SignUpResponse>('POST', path, {
18
+ body: request,
19
+ });
18
20
  }
19
21
 
20
- async signIn(): Promise<types.SignInResponse> {
22
+ async signIn(request: types.SignInRequest): Promise<types.TwoFARequiredResponse> {
21
23
  const path = '/username/signin';
22
- return this.client.request<types.SignInResponse>('POST', path);
24
+ return this.client.request<types.TwoFARequiredResponse>('POST', path, {
25
+ body: request,
26
+ });
23
27
  }
24
28
 
25
29
  }