@authsome/client 0.0.1 → 0.0.3

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 (45) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +392 -0
  3. package/RELEASE_CHECKLIST.md +162 -0
  4. package/RELEASE_v0.0.2.md +126 -0
  5. package/authsome-client-0.0.2.tgz +0 -0
  6. package/dist/client.d.ts +65 -3
  7. package/dist/client.js +52 -8
  8. package/dist/index.d.ts +25 -25
  9. package/dist/index.js +78 -26
  10. package/dist/plugins/oidcprovider.d.ts +1 -1
  11. package/dist/plugins/webhook.d.ts +1 -1
  12. package/dist/plugins/webhook.js +4 -4
  13. package/dist/types.d.ts +2465 -2500
  14. package/package.json +3 -24
  15. package/src/client.ts +270 -0
  16. package/src/errors.ts +92 -0
  17. package/src/index.ts +33 -0
  18. package/src/plugin.ts +13 -0
  19. package/src/plugins/admin.ts +84 -0
  20. package/src/plugins/anonymous.ts +31 -0
  21. package/src/plugins/apikey.ts +56 -0
  22. package/src/plugins/backupauth.ts +208 -0
  23. package/src/plugins/compliance.ts +204 -0
  24. package/src/plugins/consent.ts +125 -0
  25. package/src/plugins/emailotp.ts +33 -0
  26. package/src/plugins/idverification.ts +80 -0
  27. package/src/plugins/impersonation.ts +53 -0
  28. package/src/plugins/jwt.ts +44 -0
  29. package/src/plugins/magiclink.ts +31 -0
  30. package/src/plugins/mfa.ts +111 -0
  31. package/src/plugins/multiapp.ts +116 -0
  32. package/src/plugins/multisession.ts +36 -0
  33. package/src/plugins/notification.ts +98 -0
  34. package/src/plugins/oidcprovider.ts +90 -0
  35. package/src/plugins/organization.ts +99 -0
  36. package/src/plugins/passkey.ts +54 -0
  37. package/src/plugins/phone.ts +40 -0
  38. package/src/plugins/social.ts +48 -0
  39. package/src/plugins/sso.ts +55 -0
  40. package/src/plugins/stepup.ts +97 -0
  41. package/src/plugins/twofa.ts +61 -0
  42. package/src/plugins/username.ts +29 -0
  43. package/src/plugins/webhook.ts +50 -0
  44. package/src/types.ts +3702 -0
  45. package/tsconfig.json +16 -0
@@ -0,0 +1,40 @@
1
+ // Auto-generated phone plugin
2
+
3
+ import { ClientPlugin } from '../plugin';
4
+ import { AuthsomeClient } from '../client';
5
+ import * as types from '../types';
6
+
7
+ export class PhonePlugin implements ClientPlugin {
8
+ readonly id = 'phone';
9
+ private client!: AuthsomeClient;
10
+
11
+ init(client: AuthsomeClient): void {
12
+ this.client = client;
13
+ }
14
+
15
+ async sendCode(request: types.SendCodeRequest): Promise<void> {
16
+ const path = '/phone/send-code';
17
+ return this.client.request<void>('POST', path, {
18
+ body: request,
19
+ });
20
+ }
21
+
22
+ async verify(request: types.VerifyRequest): Promise<types.PhoneVerifyResponse> {
23
+ const path = '/phone/verify';
24
+ return this.client.request<types.PhoneVerifyResponse>('POST', path, {
25
+ body: request,
26
+ });
27
+ }
28
+
29
+ async signIn(request: types.VerifyRequest): Promise<types.PhoneVerifyResponse> {
30
+ const path = '/phone/signin';
31
+ return this.client.request<types.PhoneVerifyResponse>('POST', path, {
32
+ body: request,
33
+ });
34
+ }
35
+
36
+ }
37
+
38
+ export function phoneClient(): PhonePlugin {
39
+ return new PhonePlugin();
40
+ }
@@ -0,0 +1,48 @@
1
+ // Auto-generated social plugin
2
+
3
+ import { ClientPlugin } from '../plugin';
4
+ import { AuthsomeClient } from '../client';
5
+ import * as types from '../types';
6
+
7
+ export class SocialPlugin implements ClientPlugin {
8
+ readonly id = 'social';
9
+ private client!: AuthsomeClient;
10
+
11
+ init(client: AuthsomeClient): void {
12
+ this.client = client;
13
+ }
14
+
15
+ async signIn(request: types.SignInRequest): Promise<types.AuthURLResponse> {
16
+ const path = '/signin/social';
17
+ return this.client.request<types.AuthURLResponse>('POST', path, {
18
+ body: request,
19
+ });
20
+ }
21
+
22
+ async callback(): Promise<types.CallbackDataResponse> {
23
+ const path = '/callback/:provider';
24
+ return this.client.request<types.CallbackDataResponse>('GET', path);
25
+ }
26
+
27
+ async linkAccount(request: types.LinkAccountRequest): Promise<types.AuthURLResponse> {
28
+ const path = '/account/link';
29
+ return this.client.request<types.AuthURLResponse>('POST', path, {
30
+ body: request,
31
+ });
32
+ }
33
+
34
+ async unlinkAccount(): Promise<types.MessageResponse> {
35
+ const path = '/account/unlink/:provider';
36
+ return this.client.request<types.MessageResponse>('DELETE', path);
37
+ }
38
+
39
+ async listProviders(): Promise<types.ProvidersResponse> {
40
+ const path = '/providers';
41
+ return this.client.request<types.ProvidersResponse>('GET', path);
42
+ }
43
+
44
+ }
45
+
46
+ export function socialClient(): SocialPlugin {
47
+ return new SocialPlugin();
48
+ }
@@ -0,0 +1,55 @@
1
+ // Auto-generated sso plugin
2
+
3
+ import { ClientPlugin } from '../plugin';
4
+ import { AuthsomeClient } from '../client';
5
+ import * as types from '../types';
6
+
7
+ export class SsoPlugin implements ClientPlugin {
8
+ readonly id = 'sso';
9
+ private client!: AuthsomeClient;
10
+
11
+ init(client: AuthsomeClient): void {
12
+ this.client = client;
13
+ }
14
+
15
+ async registerProvider(request: types.RegisterProviderRequest): Promise<types.ProviderRegisteredResponse> {
16
+ const path = '/provider/register';
17
+ return this.client.request<types.ProviderRegisteredResponse>('POST', path, {
18
+ body: request,
19
+ });
20
+ }
21
+
22
+ async sAMLSPMetadata(): Promise<types.MetadataResponse> {
23
+ const path = '/saml2/sp/metadata';
24
+ return this.client.request<types.MetadataResponse>('GET', path);
25
+ }
26
+
27
+ async sAMLLogin(request: types.SAMLLoginRequest): Promise<types.SAMLLoginResponse> {
28
+ const path = '/saml2/login/:providerId';
29
+ return this.client.request<types.SAMLLoginResponse>('POST', path, {
30
+ body: request,
31
+ });
32
+ }
33
+
34
+ async sAMLCallback(): Promise<types.SSOAuthResponse> {
35
+ const path = '/saml2/callback/:providerId';
36
+ return this.client.request<types.SSOAuthResponse>('POST', path);
37
+ }
38
+
39
+ async oIDCLogin(request: types.OIDCLoginRequest): Promise<types.OIDCLoginResponse> {
40
+ const path = '/oidc/login/:providerId';
41
+ return this.client.request<types.OIDCLoginResponse>('POST', path, {
42
+ body: request,
43
+ });
44
+ }
45
+
46
+ async oIDCCallback(): Promise<types.SSOAuthResponse> {
47
+ const path = '/oidc/callback/:providerId';
48
+ return this.client.request<types.SSOAuthResponse>('GET', path);
49
+ }
50
+
51
+ }
52
+
53
+ export function ssoClient(): SsoPlugin {
54
+ return new SsoPlugin();
55
+ }
@@ -0,0 +1,97 @@
1
+ // Auto-generated stepup plugin
2
+
3
+ import { ClientPlugin } from '../plugin';
4
+ import { AuthsomeClient } from '../client';
5
+ import * as types from '../types';
6
+
7
+ export class StepupPlugin implements ClientPlugin {
8
+ readonly id = 'stepup';
9
+ private client!: AuthsomeClient;
10
+
11
+ init(client: AuthsomeClient): void {
12
+ this.client = client;
13
+ }
14
+
15
+ async evaluate(request: types.EvaluateRequest): Promise<void> {
16
+ const path = '/evaluate';
17
+ return this.client.request<void>('POST', path, {
18
+ body: request,
19
+ });
20
+ }
21
+
22
+ async verify(request: types.VerifyRequest): Promise<void> {
23
+ const path = '/verify';
24
+ return this.client.request<void>('POST', path, {
25
+ body: request,
26
+ });
27
+ }
28
+
29
+ async getRequirement(): Promise<void> {
30
+ const path = '/requirements/:id';
31
+ return this.client.request<void>('GET', path);
32
+ }
33
+
34
+ async listPendingRequirements(): Promise<types.RequirementsResponse> {
35
+ const path = '/requirements/pending';
36
+ return this.client.request<types.RequirementsResponse>('GET', path);
37
+ }
38
+
39
+ async listVerifications(): Promise<void> {
40
+ const path = '/verifications';
41
+ return this.client.request<void>('GET', path);
42
+ }
43
+
44
+ async listRememberedDevices(): Promise<types.StepUpDevicesResponse> {
45
+ const path = '/devices';
46
+ return this.client.request<types.StepUpDevicesResponse>('GET', path);
47
+ }
48
+
49
+ async forgetDevice(): Promise<types.ForgetDeviceResponse> {
50
+ const path = '/devices/:id';
51
+ return this.client.request<types.ForgetDeviceResponse>('DELETE', path);
52
+ }
53
+
54
+ async createPolicy(request: types.StepUpPolicy): Promise<types.StepUpPolicy> {
55
+ const path = '/policies';
56
+ return this.client.request<types.StepUpPolicy>('POST', path, {
57
+ body: request,
58
+ });
59
+ }
60
+
61
+ async listPolicies(): Promise<void> {
62
+ const path = '/policies';
63
+ return this.client.request<void>('GET', path);
64
+ }
65
+
66
+ async getPolicy(): Promise<void> {
67
+ const path = '/policies/:id';
68
+ return this.client.request<void>('GET', path);
69
+ }
70
+
71
+ async updatePolicy(request: types.StepUpPolicy): Promise<types.StepUpPolicy> {
72
+ const path = '/policies/:id';
73
+ return this.client.request<types.StepUpPolicy>('PUT', path, {
74
+ body: request,
75
+ });
76
+ }
77
+
78
+ async deletePolicy(): Promise<void> {
79
+ const path = '/policies/:id';
80
+ return this.client.request<void>('DELETE', path);
81
+ }
82
+
83
+ async getAuditLogs(): Promise<void> {
84
+ const path = '/audit';
85
+ return this.client.request<void>('GET', path);
86
+ }
87
+
88
+ async status(): Promise<void> {
89
+ const path = '/status';
90
+ return this.client.request<void>('GET', path);
91
+ }
92
+
93
+ }
94
+
95
+ export function stepupClient(): StepupPlugin {
96
+ return new StepupPlugin();
97
+ }
@@ -0,0 +1,61 @@
1
+ // Auto-generated twofa plugin
2
+
3
+ import { ClientPlugin } from '../plugin';
4
+ import { AuthsomeClient } from '../client';
5
+ import * as types from '../types';
6
+
7
+ export class TwofaPlugin implements ClientPlugin {
8
+ readonly id = 'twofa';
9
+ private client!: AuthsomeClient;
10
+
11
+ init(client: AuthsomeClient): void {
12
+ this.client = client;
13
+ }
14
+
15
+ async enable(request: types.Enable_body): Promise<void> {
16
+ const path = '/2fa/enable';
17
+ return this.client.request<void>('POST', path, {
18
+ body: request,
19
+ });
20
+ }
21
+
22
+ async verify(request: types.Verify_body): Promise<types.StatusResponse> {
23
+ const path = '/2fa/verify';
24
+ return this.client.request<types.StatusResponse>('POST', path, {
25
+ body: request,
26
+ });
27
+ }
28
+
29
+ async disable(request: types.Disable_body): Promise<types.StatusResponse> {
30
+ const path = '/2fa/disable';
31
+ return this.client.request<types.StatusResponse>('POST', path, {
32
+ body: request,
33
+ });
34
+ }
35
+
36
+ async generateBackupCodes(request: types.GenerateBackupCodes_body): Promise<types.CodesResponse> {
37
+ const path = '/2fa/generate-backup-codes';
38
+ return this.client.request<types.CodesResponse>('POST', path, {
39
+ body: request,
40
+ });
41
+ }
42
+
43
+ async sendOTP(request: types.SendOTP_body): Promise<types.OTPSentResponse> {
44
+ const path = '/2fa/send-otp';
45
+ return this.client.request<types.OTPSentResponse>('POST', path, {
46
+ body: request,
47
+ });
48
+ }
49
+
50
+ async status(request: types.Status_body): Promise<types.TwoFAStatusResponse> {
51
+ const path = '/2fa/status';
52
+ return this.client.request<types.TwoFAStatusResponse>('POST', path, {
53
+ body: request,
54
+ });
55
+ }
56
+
57
+ }
58
+
59
+ export function twofaClient(): TwofaPlugin {
60
+ return new TwofaPlugin();
61
+ }
@@ -0,0 +1,29 @@
1
+ // Auto-generated username plugin
2
+
3
+ import { ClientPlugin } from '../plugin';
4
+ import { AuthsomeClient } from '../client';
5
+ import * as types from '../types';
6
+
7
+ export class UsernamePlugin implements ClientPlugin {
8
+ readonly id = 'username';
9
+ private client!: AuthsomeClient;
10
+
11
+ init(client: AuthsomeClient): void {
12
+ this.client = client;
13
+ }
14
+
15
+ async signUp(): Promise<types.SignUpResponse> {
16
+ const path = '/username/signup';
17
+ return this.client.request<types.SignUpResponse>('POST', path);
18
+ }
19
+
20
+ async signIn(): Promise<types.SignInResponse> {
21
+ const path = '/username/signin';
22
+ return this.client.request<types.SignInResponse>('POST', path);
23
+ }
24
+
25
+ }
26
+
27
+ export function usernameClient(): UsernamePlugin {
28
+ return new UsernamePlugin();
29
+ }
@@ -0,0 +1,50 @@
1
+ // Auto-generated webhook plugin
2
+
3
+ import { ClientPlugin } from '../plugin';
4
+ import { AuthsomeClient } from '../client';
5
+ import * as types from '../types';
6
+
7
+ export class WebhookPlugin implements ClientPlugin {
8
+ readonly id = 'webhook';
9
+ private client!: AuthsomeClient;
10
+
11
+ init(client: AuthsomeClient): void {
12
+ this.client = client;
13
+ }
14
+
15
+ async create(request: { url: string; events: string[]; secret?: string }): Promise<{ webhook: types.Webhook }> {
16
+ const path = '/webhooks';
17
+ return this.client.request<{ webhook: types.Webhook }>('POST', path, {
18
+ body: request,
19
+ auth: true,
20
+ });
21
+ }
22
+
23
+ async list(): Promise<{ webhooks: types.Webhook[] }> {
24
+ const path = '/webhooks';
25
+ return this.client.request<{ webhooks: types.Webhook[] }>('GET', path, {
26
+ auth: true,
27
+ });
28
+ }
29
+
30
+ async update(request: { id: string; url?: string; events?: string[]; enabled?: boolean }): Promise<{ webhook: types.Webhook }> {
31
+ const path = '/webhooks/update';
32
+ return this.client.request<{ webhook: types.Webhook }>('POST', path, {
33
+ body: request,
34
+ auth: true,
35
+ });
36
+ }
37
+
38
+ async delete(request: { id: string }): Promise<{ success: boolean }> {
39
+ const path = '/webhooks/delete';
40
+ return this.client.request<{ success: boolean }>('POST', path, {
41
+ body: request,
42
+ auth: true,
43
+ });
44
+ }
45
+
46
+ }
47
+
48
+ export function webhookClient(): WebhookPlugin {
49
+ return new WebhookPlugin();
50
+ }