@neuctra/authix 1.0.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.
- package/README.md +235 -0
- package/dist/authix.css +1 -0
- package/dist/neuctra-authix.es.js +6814 -0
- package/dist/neuctra-authix.umd.js +665 -0
- package/dist/src/api/login.d.ts +30 -0
- package/dist/src/api/signup.d.ts +47 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/react/UserButton.d.ts +9 -0
- package/dist/src/react/UserLogin.d.ts +15 -0
- package/dist/src/react/UserProfile.d.ts +10 -0
- package/dist/src/react/UserSignUp.d.ts +21 -0
- package/dist/src/react/index.d.ts +4 -0
- package/dist/src/sdk/config.d.ts +15 -0
- package/dist/src/sdk/index.d.ts +221 -0
- package/dist/src/vue/index.d.ts +1 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +71 -0
package/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Neuctra Authix SDK & UI Components
|
|
2
|
+
|
|
3
|
+
**Neuctra Authix** is an authentication SDK and UI component library for **React** and **Vue**.
|
|
4
|
+
It provides ready-to-use APIs, authentication flows, and user management utilities with **JWT**, **API Key**, **OTP verification**, and **extra user data management**.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 📦 Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# Install via npm
|
|
12
|
+
npm install neuctra-authix
|
|
13
|
+
|
|
14
|
+
# Or using yarn
|
|
15
|
+
yarn add neuctra-authix
|
|
16
|
+
|
|
17
|
+
# Or pnpm
|
|
18
|
+
pnpm add neuctra-authix
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## ⚡ Features
|
|
24
|
+
|
|
25
|
+
* 🔑 **Authentication SDK** (Signup, Login, Profile, Password Reset, OTP)
|
|
26
|
+
* 👤 **User Management** (Update, Delete, Change Password, Extra Data)
|
|
27
|
+
* 📂 **User Data Store** (Flexible key/value objects per user)
|
|
28
|
+
* 🛡 **Secure API Requests** (JWT & API Key)
|
|
29
|
+
* 🎨 **UI Components** (React + Vue with TailwindCSS)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🛠 SDK Configuration
|
|
34
|
+
|
|
35
|
+
Before using the SDK, set up the **global configuration**.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { setSdkConfig, getSdkConfig } from "neuctra-authix/sdk";
|
|
39
|
+
|
|
40
|
+
setSdkConfig({
|
|
41
|
+
baseUrl: "https://api.neuctra.com",
|
|
42
|
+
apiKey: "your-api-key",
|
|
43
|
+
appId: "your-app-id",
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
console.log(getSdkConfig());
|
|
47
|
+
// { baseUrl: "...", apiKey: "...", appId: "..." }
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Alternatively, you can use the class-based client:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { NeuctraAuthix } from "neuctra-authix/sdk";
|
|
54
|
+
|
|
55
|
+
const client = new NeuctraAuthix({
|
|
56
|
+
baseUrl: "https://api.neuctra.com",
|
|
57
|
+
apiKey: "your-api-key",
|
|
58
|
+
appId: "your-app-id",
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🚀 Usage Examples
|
|
65
|
+
|
|
66
|
+
### 🔹 Signup a New User
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
await client.signup({
|
|
70
|
+
name: "John Doe",
|
|
71
|
+
email: "john@example.com",
|
|
72
|
+
password: "strongpassword",
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 🔹 Login
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
const session = await client.login({
|
|
80
|
+
email: "john@example.com",
|
|
81
|
+
password: "strongpassword",
|
|
82
|
+
});
|
|
83
|
+
console.log(session.token);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 🔹 Get Profile
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
await client.getProfile({ token: "user-jwt-token" });
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 🔹 Update User
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
await client.updateUser({
|
|
96
|
+
userId: "12345",
|
|
97
|
+
name: "Updated Name",
|
|
98
|
+
phone: "+1234567890",
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 🔹 Change Password (Admin)
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
await client.changePassword({
|
|
106
|
+
userId: "12345",
|
|
107
|
+
currentPassword: "oldPass",
|
|
108
|
+
newPassword: "newPass",
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 🔹 Delete User
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
await client.deleteUser({ userId: "12345" });
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## ✉️ Email Verification & Password Reset
|
|
121
|
+
|
|
122
|
+
### Send Verification OTP
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
await client.sendVerifyOTP({ token: "user-jwt-token" });
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Verify Email
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
await client.verifyEmail({
|
|
132
|
+
token: "user-jwt-token",
|
|
133
|
+
otp: "123456",
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Forgot Password
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
await client.forgotPassword({ email: "john@example.com" });
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Reset Password
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
await client.resetPassword({
|
|
147
|
+
email: "john@example.com",
|
|
148
|
+
otp: "123456",
|
|
149
|
+
newPassword: "newSecurePass",
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 📂 User Extra Data Management
|
|
156
|
+
|
|
157
|
+
Each user can store **custom structured objects**.
|
|
158
|
+
|
|
159
|
+
### Get All Data
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
await client.getUserData({ userId: "12345" });
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Get One Object
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
await client.getSingleUserData({ userId: "12345", dataId: "data123" });
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Add Data
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
await client.addUserData({
|
|
175
|
+
userId: "12345",
|
|
176
|
+
data: { preferences: { theme: "dark" } },
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Update Data
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
await client.updateUserData({
|
|
184
|
+
userId: "12345",
|
|
185
|
+
dataId: "data123",
|
|
186
|
+
data: { preferences: { theme: "light" } },
|
|
187
|
+
});
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Delete Data
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
await client.deleteUserData({ userId: "12345", dataId: "data123" });
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## 🎨 UI Components
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
import { LoginForm, SignupForm } from "neuctra-authix/react";
|
|
202
|
+
|
|
203
|
+
<LoginForm onSuccess={(session) => console.log("Logged in:", session)} />
|
|
204
|
+
<SignupForm onSuccess={(user) => console.log("Signed up:", user)} />
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Vue components are also supported:
|
|
208
|
+
|
|
209
|
+
```vue
|
|
210
|
+
<script setup>
|
|
211
|
+
import { LoginForm } from "neuctra-authix/vue";
|
|
212
|
+
</script>
|
|
213
|
+
|
|
214
|
+
<template>
|
|
215
|
+
<LoginForm @success="(session) => console.log('Logged in:', session)" />
|
|
216
|
+
</template>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## ⚙️ Tech Stack
|
|
222
|
+
|
|
223
|
+
* **TypeScript**
|
|
224
|
+
* **Vite**
|
|
225
|
+
* **React / Vue**
|
|
226
|
+
* **TailwindCSS**
|
|
227
|
+
* **Axios**
|
|
228
|
+
* **Lucide Icons**
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 📄 License
|
|
233
|
+
|
|
234
|
+
[MIT](./LICENSE) © 2025 Neuctra
|
|
235
|
+
|
package/dist/authix.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-white:#fff;--spacing:.25rem;--radius-lg:.5rem;--ease-out:cubic-bezier(0,0,.2,1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.resize{resize:both}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.bg-green-600{background-color:var(--color-green-600)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-2{padding-block:calc(var(--spacing)*2)}.text-white{color:var(--color-white)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}@media (hover:hover){.hover\:bg-green-700:hover{background-color:var(--color-green-700)}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
|