@springmicro/auth 0.1.9 → 0.2.0-alpha.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.
Files changed (135) hide show
  1. package/dist/Index-652aeb8c-BTQ1rBi7.js +2818 -0
  2. package/dist/Index-c419311f-BOZhAAW3.js +1054 -0
  3. package/dist/Web3Auth-hACKSouN.js +32769 -0
  4. package/dist/alphawallet-B7eovdf-.js +26 -0
  5. package/dist/apexwallet-ysP20G9D.js +93 -0
  6. package/dist/atoken-BBnNTzcz.js +27 -0
  7. package/dist/bifrostwallet-CNNBO92h.js +11 -0
  8. package/dist/binance-DvPgAzCw.js +14 -0
  9. package/dist/bitget-DZOUrwgy.js +4 -0
  10. package/dist/bitpie-C_uxmEzw.js +25 -0
  11. package/dist/bitski-DpzkHNkv.js +4 -0
  12. package/dist/blockwallet-BL69cqkA.js +8 -0
  13. package/dist/brave-DnRzMQYW.js +35 -0
  14. package/dist/ccip-c78d2f16-DLcRlwod.js +165 -0
  15. package/dist/coin98wallet-CkFdOvXt.js +4 -0
  16. package/dist/coinbase-CaGNx5if.js +9 -0
  17. package/dist/core-9rK8tWud.js +7 -0
  18. package/dist/defiwallet-0AsgJBSy.js +10 -0
  19. package/dist/detected-CX_JZaUk.js +6 -0
  20. package/dist/echooo-CmaetT_Z.js +14 -0
  21. package/dist/enkrypt-BibtwvK7.js +20 -0
  22. package/dist/exodus-BxzkDWWP.js +4 -0
  23. package/dist/fordefi-CvKyVwhI.js +6 -0
  24. package/dist/foxwallet-D7c_LDTf.js +4 -0
  25. package/dist/frame-CDfNmjUy.js +7 -0
  26. package/dist/frontier-DqKNSj2z.js +8 -0
  27. package/dist/huobiwallet-CxSwqa5L.js +14 -0
  28. package/dist/hyperpay-nmHE3WqM.js +7 -0
  29. package/dist/icon-2Zqy7pqQ.js +8 -0
  30. package/dist/icon-CGWI1Ies.js +43 -0
  31. package/dist/icon-C_O4nprO.js +9 -0
  32. package/dist/icon-DbgmZCnU.js +9 -0
  33. package/dist/icon-cAd7RhSC.js +9 -0
  34. package/dist/icon-duCa3gfT.js +11 -0
  35. package/dist/imtoken-yENtOTS3.js +17 -0
  36. package/dist/index-021f6a62-Zz543EDB.js +2583 -0
  37. package/dist/index-40a497ea-Bn2mC0r7.js +1010 -0
  38. package/dist/index-BHkXn9Ss.js +4010 -0
  39. package/dist/index-BaYEABY7.js +7089 -0
  40. package/dist/index-BtLU53lm.js +6023 -0
  41. package/dist/index-CynP9H3X.js +6188 -0
  42. package/dist/index-Dg8m-Szw.js +31 -0
  43. package/dist/index-Dt6M8ha9.js +161 -0
  44. package/dist/index-DtJfAdfq.js +5822 -0
  45. package/dist/index-klU8YB0c.js +1983 -0
  46. package/dist/index.d.ts +124 -0
  47. package/dist/index.js +5 -43
  48. package/dist/index.umd.cjs +1937 -1
  49. package/dist/infinitywallet-C8J4FUYw.js +42 -0
  50. package/dist/kayros-AIrUK1za.js +27 -0
  51. package/dist/lif3wallet-C5D6r8pg.js +41 -0
  52. package/dist/liquality-nbCtErVq.js +16 -0
  53. package/dist/mathwallet-CWkivCXo.js +50 -0
  54. package/dist/meetone-kKmvI8md.js +13 -0
  55. package/dist/metamask-BN7yiDV1.js +64 -0
  56. package/dist/mykey-CQZ6UcLH.js +13 -0
  57. package/dist/number-BXHWhlom.js +1529 -0
  58. package/dist/okxwallet-CJLVogh2.js +8 -0
  59. package/dist/oneInch-CciyZ4Pz.js +72 -0
  60. package/dist/onekey-Dal8kYjU.js +9 -0
  61. package/dist/opera-DnKg-TJU.js +24 -0
  62. package/dist/ownbit-BshJUVuW.js +18 -0
  63. package/dist/phantom-CJ8dIcov.js +35 -0
  64. package/dist/rabby-D4thTcd6.js +27 -0
  65. package/dist/rainbow-mXld6yWV.js +69 -0
  66. package/dist/roninwallet-ZyYrd-D1.js +9 -0
  67. package/dist/safeheron-Eg1Jb29V.js +23 -0
  68. package/dist/safepal-DVIKy94N.js +105 -0
  69. package/dist/sequence-BS2IbtDg.js +70 -0
  70. package/dist/stablewallet-jyB079Wb.js +20 -0
  71. package/dist/status-FrAvQjfn.js +4 -0
  72. package/dist/subwallet-DMvFqKyY.js +25 -0
  73. package/dist/talisman-Bp8zUXqB.js +16 -0
  74. package/dist/tallywallet-B4OS9nIr.js +16 -0
  75. package/dist/tokenary-C7jjcbQa.js +18 -0
  76. package/dist/tokenpocket-9ZRPmAFA.js +28 -0
  77. package/dist/tp-V2em5bdl.js +13 -0
  78. package/dist/transactionRequest-be6a8ea9-CUKWo5mx.js +1117 -0
  79. package/dist/trust-gPypS1O7.js +11 -0
  80. package/dist/xdefi-COVIyGz4.js +38 -0
  81. package/dist/zeal-DxHbDqm0.js +9 -0
  82. package/dist/zerion-BfW0UElc.js +8 -0
  83. package/dist/zodiacpilot-CrId6F4w.js +6 -0
  84. package/package.json +35 -15
  85. package/src/auth/config.ts +0 -2
  86. package/src/components/SignUp.tsx +442 -0
  87. package/src/components/forms/AgreementModal.tsx +88 -0
  88. package/src/components/forms/CaptchaController.tsx +94 -0
  89. package/src/components/forms/CaptchaModal.jsx +171 -0
  90. package/src/components/forms/CaptchaWidget.jsx +146 -0
  91. package/src/components/forms/PasswordChecker.ts +88 -0
  92. package/src/components/forms/SendCodeInput.tsx +149 -0
  93. package/src/components/forms/SignUpFormItem.tsx +704 -0
  94. package/src/components/forms/util/application-api.ts +155 -0
  95. package/src/components/forms/util/auth-api.ts +198 -0
  96. package/src/components/forms/util/auth-util.tsx +346 -0
  97. package/src/components/forms/util/core.ts +493 -0
  98. package/src/components/forms/util/invitation-api.ts +132 -0
  99. package/src/components/forms/util/provider.tsx +603 -0
  100. package/src/components/forms/util/user-api.ts +303 -0
  101. package/src/components/provider/AdfsLoginButton.jsx +38 -0
  102. package/src/components/provider/AlipayLoginButton.jsx +38 -0
  103. package/src/components/provider/AppleLoginButton.jsx +38 -0
  104. package/src/components/provider/AzureADB2CLoginButton.jsx +38 -0
  105. package/src/components/provider/AzureADLoginButton.jsx +38 -0
  106. package/src/components/provider/BaiduLoginButton.jsx +38 -0
  107. package/src/components/provider/BilibiliLoginButton.jsx +37 -0
  108. package/src/components/provider/CasdoorLoginButton.jsx +38 -0
  109. package/src/components/provider/DingTalkLoginButton.jsx +37 -0
  110. package/src/components/provider/DouyinLoginButton.jsx +38 -0
  111. package/src/components/provider/FacebookLoginButton.jsx +37 -0
  112. package/src/components/provider/GitHubLoginButton.jsx +37 -0
  113. package/src/components/provider/GitLabLoginButton.jsx +38 -0
  114. package/src/components/provider/GiteeLoginButton.jsx +34 -0
  115. package/src/components/provider/GoogleLoginButton.jsx +68 -0
  116. package/src/components/provider/InfoflowLoginButton.jsx +38 -0
  117. package/src/components/provider/LarkLoginButton.jsx +38 -0
  118. package/src/components/provider/LinkedInLoginButton.jsx +37 -0
  119. package/src/components/provider/LoginButton.jsx +33 -0
  120. package/src/components/provider/OktaLoginButton.jsx +38 -0
  121. package/src/components/provider/Provider.jsx +3 -0
  122. package/src/components/provider/ProviderButton.jsx +327 -0
  123. package/src/components/provider/QqLoginButton.jsx +31 -0
  124. package/src/components/provider/SelfLoginButton.jsx +47 -0
  125. package/src/components/provider/SlackLoginButton.jsx +38 -0
  126. package/src/components/provider/SteamLoginButton.jsx +38 -0
  127. package/src/components/provider/WeComLoginButton.jsx +34 -0
  128. package/src/components/provider/Web3Auth.jsx +365 -0
  129. package/src/components/provider/WechatLoginButton.jsx +37 -0
  130. package/src/components/provider/WeiboLoginButton.jsx +34 -0
  131. package/src/components/util.tsx +173 -0
  132. package/src/i18n/en/signup.json +48 -0
  133. package/src/i18n/index.ts +17 -0
  134. package/src/index.tsx +6 -1
  135. package/vite.config.ts +33 -25
package/dist/index.d.ts CHANGED
@@ -1,4 +1,21 @@
1
+ import { default as default_2 } from 'react';
1
2
  import { FullAuthConfig } from 'auth-astro/src/config';
3
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
4
+
5
+ declare function addUser(user: any): Promise<any>;
6
+
7
+ declare function addUserKeys(user: any): Promise<any>;
8
+
9
+ declare type Application = {
10
+ name: string;
11
+ owner: string;
12
+ organization: string;
13
+ organizationObj: any;
14
+ providers?: Array<any>;
15
+ signupItems?: Array<any>;
16
+ signinMethods: Array<any>;
17
+ termsOfUse: string;
18
+ };
2
19
 
3
20
  declare type AuthConfig = {
4
21
  casdoorEndpoint: string;
@@ -6,6 +23,14 @@ declare type AuthConfig = {
6
23
  clientSecret: string;
7
24
  };
8
25
 
26
+ declare function checkUserPassword(values: any): Promise<any>;
27
+
28
+ declare function deleteUser(user: any): Promise<any>;
29
+
30
+ declare function getAddressOptions(url: any): Promise<any>;
31
+
32
+ declare function getAffiliationOptions(url: any, code: any): Promise<any>;
33
+
9
34
  /**
10
35
  * @param param0 {
11
36
  casdoorEndpoint: http://casdoor.tld;
@@ -16,4 +41,103 @@ declare type AuthConfig = {
16
41
  */
17
42
  export declare const getAuthConfig: ({ casdoorEndpoint, clientId, clientSecret, }: AuthConfig) => FullAuthConfig;
18
43
 
44
+ declare function getCaptcha(owner: any, name: any, isCurrentProvider: any): Promise<any>;
45
+
46
+ declare function getDefaultValues(signupItems: SignupItem[]): any;
47
+
48
+ declare function getFormProps(signupItem: SignupItem): {
49
+ name: any;
50
+ label: string;
51
+ placeholder: string;
52
+ required: boolean;
53
+ type: string;
54
+ };
55
+
56
+ declare function getGlobalUsers(page: any, pageSize: any, field?: string, value?: string, sortField?: string, sortOrder?: string): Promise<any>;
57
+
58
+ declare function getKey(signupItem: SignupItem): any;
59
+
60
+ declare function getUser(owner: any, name: any): Promise<any>;
61
+
62
+ declare function getUsers(owner: any, page?: string, pageSize?: string, field?: string, value?: string, sortField?: string, sortOrder?: string, groupName?: string): Promise<any>;
63
+
64
+ declare function getZod(z: any, signupItem: SignupItem): any;
65
+
66
+ declare function removeUserFromGroup({ owner, name, groupName }: {
67
+ owner: any;
68
+ name: any;
69
+ groupName: any;
70
+ }): Promise<any>;
71
+
72
+ declare function requiresCode(signupItem: SignupItem): boolean;
73
+
74
+ declare function resetEmailOrPhone(dest: any, type: any, code: any): Promise<any>;
75
+
76
+ declare function sendCode(captchaType: any, captchaToken: any, clientSecret: any, method: any, countryCode: string, dest: any, type: any, applicationId: any, checkUser?: string): Promise<boolean>;
77
+
78
+ declare function setPassword(userOwner: any, userName: any, oldPassword: any, newPassword: any, code?: string): Promise<any>;
79
+
80
+ export declare function SignUp({ applicationName, casdoorApiRoot, springmicroApiRoot, }: SignUpProps): JSX_2.Element;
81
+
82
+ declare interface SignUpContextType {
83
+ application: Application;
84
+ getDefaultValues: typeof getDefaultValues;
85
+ getFormProps: typeof getFormProps;
86
+ icon: (signupItem: SignupItem, Button: default_2.JSX.ElementType) => default_2.JSX.Element | null;
87
+ getZod: typeof getZod;
88
+ getKey: typeof getKey;
89
+ type: (signupItem: SignupItem) => string;
90
+ sendCode: typeof UserBackend.sendCode;
91
+ requiresCode: typeof requiresCode;
92
+ getCaptcha: typeof UserBackend.getCaptcha;
93
+ }
94
+
95
+ declare type SignupItem = {
96
+ name: string;
97
+ label: string;
98
+ placeholder: string;
99
+ prompted: boolean;
100
+ required: boolean;
101
+ rule: string;
102
+ visible: boolean;
103
+ };
104
+
105
+ declare type SignUpProps = {
106
+ applicationName: string;
107
+ casdoorApiRoot: string;
108
+ springmicroApiRoot?: string;
109
+ };
110
+
111
+ export declare function SignUpProvider({ applicationName, casdoorApiRoot, springmicroApiRoot, children, }: default_2.PropsWithChildren<SignUpProps>): JSX_2.Element;
112
+
113
+ declare function updateUser(owner: any, name: any, user: any): Promise<any>;
114
+
115
+ declare namespace UserBackend {
116
+ export {
117
+ getGlobalUsers,
118
+ getUsers,
119
+ getUser,
120
+ addUserKeys,
121
+ updateUser,
122
+ addUser,
123
+ deleteUser,
124
+ getAddressOptions,
125
+ getAffiliationOptions,
126
+ setPassword,
127
+ sendCode,
128
+ verifyCaptcha,
129
+ resetEmailOrPhone,
130
+ getCaptcha,
131
+ verifyCode,
132
+ checkUserPassword,
133
+ removeUserFromGroup
134
+ }
135
+ }
136
+
137
+ export declare const useSignUp: () => SignUpContextType;
138
+
139
+ declare function verifyCaptcha(owner: any, name: any, captchaType: any, captchaToken: any, clientSecret: any): Promise<boolean>;
140
+
141
+ declare function verifyCode(values: any): Promise<any>;
142
+
19
143
  export { }
package/dist/index.js CHANGED
@@ -1,45 +1,7 @@
1
- import { defineConfig as m } from "auth-astro";
2
- const d = ({
3
- casdoorEndpoint: i,
4
- clientId: r,
5
- clientSecret: n
6
- }) => m({
7
- // Configure one or more authentication providers
8
- providers: [
9
- {
10
- id: "casdoor",
11
- name: "SpringMicroHost",
12
- type: "oidc",
13
- issuer: i,
14
- authorization: { params: { scope: "openid email profile" } },
15
- token: !0,
16
- checks: ["state"],
17
- clientId: r,
18
- clientSecret: n,
19
- profile(e) {
20
- return {
21
- id: e.id,
22
- name: e.displayName,
23
- email: e.email,
24
- username: e.name ?? e.email,
25
- image: e.avatar
26
- };
27
- }
28
- }
29
- // ...add more providers here
30
- ],
31
- pages: {
32
- signIn: "/sign-in"
33
- },
34
- callbacks: {
35
- async jwt({ token: e, account: a, user: s }) {
36
- return console.log("JWT", e, a, s), a && (e.accessToken = a.access_token ?? "", e.username = s.username, e.id = s.id), e;
37
- },
38
- async session({ session: e, token: a, user: s }) {
39
- return e.accessToken = a.accessToken, e.user.id = a.id, e.user.username = a.username, e;
40
- }
41
- }
42
- });
1
+ import { S as s, c as a, b as e, u as n } from "./index-BHkXn9Ss.js";
43
2
  export {
44
- d as getAuthConfig
3
+ s as SignUp,
4
+ a as SignUpProvider,
5
+ e as getAuthConfig,
6
+ n as useSignUp
45
7
  };