ngx-better-auth 0.10.3 → 1.6.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/LICENSE +21 -0
- package/README.md +30 -4
- package/fesm2022/ngx-better-auth.mjs +77 -45
- package/fesm2022/ngx-better-auth.mjs.map +1 -1
- package/index.d.ts +50 -2148
- package/package.json +8 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Thomas Orgeval
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ An **Angular 20+ wrapper for [Better Auth](https://github.com/better-auth/better
|
|
|
8
8
|

|
|
9
9
|
|
|
10
10
|

|
|
11
|
-

|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -16,7 +16,8 @@ An **Angular 20+ wrapper for [Better Auth](https://github.com/better-auth/better
|
|
|
16
16
|
|
|
17
17
|
| ngx-better-auth | Angular | Better Auth |
|
|
18
18
|
|-----------------|---------|-------------|
|
|
19
|
-
| `
|
|
19
|
+
| `1.6.x` | `>=20` | `>=1.6.10 <1.7.0` |
|
|
20
|
+
| `0.11.x` | `>=20` | `>=1.3.7` |
|
|
20
21
|
|
|
21
22
|
---
|
|
22
23
|
|
|
@@ -26,6 +27,12 @@ An **Angular 20+ wrapper for [Better Auth](https://github.com/better-auth/better
|
|
|
26
27
|
npm install ngx-better-auth better-auth
|
|
27
28
|
```
|
|
28
29
|
|
|
30
|
+
If you use Passkey, install the split Better Auth Passkey package too:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @better-auth/passkey
|
|
34
|
+
```
|
|
35
|
+
|
|
29
36
|
---
|
|
30
37
|
|
|
31
38
|
## ⚙️ Setup Provider
|
|
@@ -36,7 +43,8 @@ First, configure your Better Auth client in your application:
|
|
|
36
43
|
import { ApplicationConfig } from '@angular/core'
|
|
37
44
|
import { provideBetterAuth } from 'ngx-better-auth'
|
|
38
45
|
import { environment } from './environments/environment'
|
|
39
|
-
import { adminClient, twoFactorClient, usernameClient } from 'better-auth/client/plugins'
|
|
46
|
+
import { adminClient, siweClient, twoFactorClient, usernameClient } from 'better-auth/client/plugins'
|
|
47
|
+
import { passkeyClient } from '@better-auth/passkey/client'
|
|
40
48
|
|
|
41
49
|
export const appConfig: ApplicationConfig = {
|
|
42
50
|
providers: [
|
|
@@ -60,6 +68,8 @@ export const appConfig: ApplicationConfig = {
|
|
|
60
68
|
user,
|
|
61
69
|
},
|
|
62
70
|
}),
|
|
71
|
+
passkeyClient(),
|
|
72
|
+
siweClient(),
|
|
63
73
|
],
|
|
64
74
|
})
|
|
65
75
|
]
|
|
@@ -68,6 +78,22 @@ export const appConfig: ApplicationConfig = {
|
|
|
68
78
|
|
|
69
79
|
## 🧩 Different services
|
|
70
80
|
|
|
81
|
+
### Migrating to 1.6.x
|
|
82
|
+
|
|
83
|
+
`ngx-better-auth 1.6.x` targets Better Auth `>=1.6.10 <1.7.0`.
|
|
84
|
+
|
|
85
|
+
If you use Passkey, install the split package and update imports:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pnpm add @better-auth/passkey
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { passkeyClient } from '@better-auth/passkey/client'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
SIWE users can keep using `SiweService.getNonce(...)`; internally it now maps to Better Auth's `siwe.getNonce` endpoint introduced in `1.6.10`.
|
|
96
|
+
|
|
71
97
|
You can inject different services depending on your needs.
|
|
72
98
|
**AuthService** provides the core Better Auth client methods (signIn, signOut, signUp, e.g.).
|
|
73
99
|
The full list of methods is available at the end of this README.
|
|
@@ -84,7 +110,7 @@ The full list of methods is available at the end of this README.
|
|
|
84
110
|
- ✅ Passkey ➡️ `PasskeyService`
|
|
85
111
|
- ✅ Generic OAuth ➡️ `GenericOauthService`
|
|
86
112
|
- ✅ One Tap ➡️ `OneTapService`
|
|
87
|
-
-
|
|
113
|
+
- ✅ Sign In With Ethereum (SIWE) ➡️ `SiweService`
|
|
88
114
|
|
|
89
115
|
### Authorization
|
|
90
116
|
- ✅ Admin ➡️ `AdminService`
|
|
@@ -17,10 +17,10 @@ class MainService {
|
|
|
17
17
|
}
|
|
18
18
|
return data.data;
|
|
19
19
|
}
|
|
20
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
21
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MainService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
21
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MainService, providedIn: 'root' });
|
|
22
22
|
}
|
|
23
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MainService, decorators: [{
|
|
24
24
|
type: Injectable,
|
|
25
25
|
args: [{
|
|
26
26
|
providedIn: 'root',
|
|
@@ -81,7 +81,7 @@ class AuthService {
|
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
signInEmail(data) {
|
|
84
|
-
return defer(() => this.client.signIn.email(data)).pipe(switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
84
|
+
return defer(() => this.client.signIn.email(data)).pipe(map((data) => this.mainService.mapData(data)), switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* Sign up a new user using email and password.
|
|
@@ -90,16 +90,16 @@ class AuthService {
|
|
|
90
90
|
* @param data
|
|
91
91
|
*/
|
|
92
92
|
signUpEmail(data) {
|
|
93
|
-
return defer(() => this.client.signUp.email(data)).pipe(switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
93
|
+
return defer(() => this.client.signUp.email(data)).pipe(map((data) => this.mainService.mapData(data)), switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
94
94
|
}
|
|
95
95
|
signInProvider(data) {
|
|
96
96
|
return defer(() => this.client.signIn.social({
|
|
97
97
|
callbackURL: window.location.origin,
|
|
98
98
|
...data,
|
|
99
|
-
})).pipe(switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
99
|
+
})).pipe(map((data) => this.mainService.mapData(data)), switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
100
100
|
}
|
|
101
101
|
signOut() {
|
|
102
|
-
return defer(() => this.client.signOut()).pipe(switchMap(() => this.sessionState$.pipe(filter((s) => s === null))));
|
|
102
|
+
return defer(() => this.client.signOut()).pipe(map((data) => this.mainService.mapData(data)), switchMap(() => this.sessionState$.pipe(filter((s) => s === null))));
|
|
103
103
|
}
|
|
104
104
|
sendVerificationEmail(data) {
|
|
105
105
|
return defer(() => this.client.sendVerificationEmail(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
@@ -120,12 +120,12 @@ class AuthService {
|
|
|
120
120
|
return defer(() => this.client.updateUser(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
121
121
|
}
|
|
122
122
|
deleteUser(data) {
|
|
123
|
-
return defer(() => this.client.deleteUser(data)).pipe(switchMap(() => this.sessionState$.pipe(filter((s) => s === null))), first());
|
|
123
|
+
return defer(() => this.client.deleteUser(data)).pipe(map((data) => this.mainService.mapData(data)), switchMap(() => this.sessionState$.pipe(filter((s) => s === null))), first());
|
|
124
124
|
}
|
|
125
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
126
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
125
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
126
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
127
127
|
}
|
|
128
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AuthService, decorators: [{
|
|
129
129
|
type: Injectable,
|
|
130
130
|
args: [{
|
|
131
131
|
providedIn: 'root',
|
|
@@ -147,10 +147,10 @@ class SessionService {
|
|
|
147
147
|
revokeAllSessions() {
|
|
148
148
|
return defer(() => this.client.revokeSessions()).pipe(map((data) => this.mainService.mapData(data)));
|
|
149
149
|
}
|
|
150
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
151
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
150
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SessionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
151
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SessionService, providedIn: 'root' });
|
|
152
152
|
}
|
|
153
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SessionService, decorators: [{
|
|
154
154
|
type: Injectable,
|
|
155
155
|
args: [{ providedIn: 'root' }]
|
|
156
156
|
}] });
|
|
@@ -167,10 +167,10 @@ class AccountService {
|
|
|
167
167
|
unlinkAccount(data) {
|
|
168
168
|
return defer(() => this.client.unlinkAccount(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
169
169
|
}
|
|
170
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
171
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
170
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AccountService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
171
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AccountService, providedIn: 'root' });
|
|
172
172
|
}
|
|
173
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AccountService, decorators: [{
|
|
174
174
|
type: Injectable,
|
|
175
175
|
args: [{ providedIn: 'root' }]
|
|
176
176
|
}] });
|
|
@@ -217,10 +217,10 @@ class TwoFactorService {
|
|
|
217
217
|
verifyBackupCode(data) {
|
|
218
218
|
return defer(() => this.twoFactor.verifyBackupCode(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
219
219
|
}
|
|
220
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
221
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
220
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: TwoFactorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
221
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: TwoFactorService, providedIn: 'root' });
|
|
222
222
|
}
|
|
223
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: TwoFactorService, decorators: [{
|
|
224
224
|
type: Injectable,
|
|
225
225
|
args: [{ providedIn: 'root' }]
|
|
226
226
|
}], ctorParameters: () => [] });
|
|
@@ -248,10 +248,10 @@ class PasskeyService {
|
|
|
248
248
|
updatePasskey(data) {
|
|
249
249
|
return defer(() => this.passkey.updatePasskey(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
250
250
|
}
|
|
251
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
252
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
251
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PasskeyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
252
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PasskeyService, providedIn: 'root' });
|
|
253
253
|
}
|
|
254
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PasskeyService, decorators: [{
|
|
255
255
|
type: Injectable,
|
|
256
256
|
args: [{ providedIn: 'root' }]
|
|
257
257
|
}], ctorParameters: () => [] });
|
|
@@ -271,10 +271,10 @@ class GenericOauthService {
|
|
|
271
271
|
link(data) {
|
|
272
272
|
return defer(() => this.oauth.link(data));
|
|
273
273
|
}
|
|
274
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
275
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
274
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: GenericOauthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
275
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: GenericOauthService, providedIn: 'root' });
|
|
276
276
|
}
|
|
277
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
277
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: GenericOauthService, decorators: [{
|
|
278
278
|
type: Injectable,
|
|
279
279
|
args: [{ providedIn: 'root' }]
|
|
280
280
|
}], ctorParameters: () => [] });
|
|
@@ -303,10 +303,10 @@ class EmailOtpService {
|
|
|
303
303
|
resetPassword(data) {
|
|
304
304
|
return defer(() => this.emailOtp.resetPassword(data));
|
|
305
305
|
}
|
|
306
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
307
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
306
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EmailOtpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
307
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EmailOtpService, providedIn: 'root' });
|
|
308
308
|
}
|
|
309
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EmailOtpService, decorators: [{
|
|
310
310
|
type: Injectable,
|
|
311
311
|
args: [{ providedIn: 'root' }]
|
|
312
312
|
}], ctorParameters: () => [] });
|
|
@@ -322,10 +322,10 @@ class OneTapService {
|
|
|
322
322
|
signIn(data) {
|
|
323
323
|
return defer(() => this.oneTap(data));
|
|
324
324
|
}
|
|
325
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
326
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
325
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OneTapService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
326
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OneTapService, providedIn: 'root' });
|
|
327
327
|
}
|
|
328
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
328
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OneTapService, decorators: [{
|
|
329
329
|
type: Injectable,
|
|
330
330
|
args: [{ providedIn: 'root' }]
|
|
331
331
|
}], ctorParameters: () => [] });
|
|
@@ -344,10 +344,10 @@ class MagicLinkService {
|
|
|
344
344
|
verify(data) {
|
|
345
345
|
return defer(() => this.magicLink.verify(data));
|
|
346
346
|
}
|
|
347
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
348
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
347
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MagicLinkService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
348
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MagicLinkService, providedIn: 'root' });
|
|
349
349
|
}
|
|
350
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
350
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MagicLinkService, decorators: [{
|
|
351
351
|
type: Injectable,
|
|
352
352
|
args: [{ providedIn: 'root' }]
|
|
353
353
|
}], ctorParameters: () => [] });
|
|
@@ -382,10 +382,10 @@ class UsernameService {
|
|
|
382
382
|
.post(`${this.mainService.url}/is-username-available`, data)
|
|
383
383
|
.pipe(map((res) => res.available));
|
|
384
384
|
}
|
|
385
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
386
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
385
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: UsernameService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
386
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: UsernameService, providedIn: 'root' });
|
|
387
387
|
}
|
|
388
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
388
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: UsernameService, decorators: [{
|
|
389
389
|
type: Injectable,
|
|
390
390
|
args: [{ providedIn: 'root' }]
|
|
391
391
|
}] });
|
|
@@ -443,10 +443,10 @@ class AdminService {
|
|
|
443
443
|
checkRolePermission(data) {
|
|
444
444
|
return defer(() => this.admin.checkRolePermission(data));
|
|
445
445
|
}
|
|
446
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
447
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
446
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AdminService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
447
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AdminService, providedIn: 'root' });
|
|
448
448
|
}
|
|
449
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
449
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AdminService, decorators: [{
|
|
450
450
|
type: Injectable,
|
|
451
451
|
args: [{ providedIn: 'root' }]
|
|
452
452
|
}], ctorParameters: () => [] });
|
|
@@ -543,10 +543,42 @@ class OrganizationService {
|
|
|
543
543
|
removeTeamMember(data) {
|
|
544
544
|
return defer(() => this.organization.removeTeamMember(data));
|
|
545
545
|
}
|
|
546
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
547
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
546
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OrganizationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
547
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OrganizationService, providedIn: 'root' });
|
|
548
548
|
}
|
|
549
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
549
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OrganizationService, decorators: [{
|
|
550
|
+
type: Injectable,
|
|
551
|
+
args: [{ providedIn: 'root' }]
|
|
552
|
+
}], ctorParameters: () => [] });
|
|
553
|
+
|
|
554
|
+
class SiweService {
|
|
555
|
+
mainService = inject(MainService);
|
|
556
|
+
authService = inject(AuthService);
|
|
557
|
+
siwe;
|
|
558
|
+
constructor() {
|
|
559
|
+
const client = this.mainService.authClient;
|
|
560
|
+
validatePlugin(client, 'siwe');
|
|
561
|
+
this.siwe = client.siwe;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Fetches a nonce for the given wallet address to be included in the SIWE message.
|
|
565
|
+
* @param data - The wallet address and optional chain ID
|
|
566
|
+
*/
|
|
567
|
+
getNonce(data) {
|
|
568
|
+
return defer(() => this.siwe.getNonce(data)).pipe(map((res) => this.mainService.mapData(res)));
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Verifies a signed SIWE message and signs the user in.
|
|
572
|
+
* On success, waits for the session to be established before emitting.
|
|
573
|
+
* @param data - The signed message, signature, wallet address, optional chain ID and optional email
|
|
574
|
+
*/
|
|
575
|
+
verifyMessage(data) {
|
|
576
|
+
return defer(() => this.siwe.verifySiweMessage(data)).pipe(map((res) => this.mainService.mapData(res)), switchMap((result) => this.authService.sessionState$.pipe(filter((s) => s !== null), map(() => result))));
|
|
577
|
+
}
|
|
578
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SiweService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
579
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SiweService, providedIn: 'root' });
|
|
580
|
+
}
|
|
581
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SiweService, decorators: [{
|
|
550
582
|
type: Injectable,
|
|
551
583
|
args: [{ providedIn: 'root' }]
|
|
552
584
|
}], ctorParameters: () => [] });
|
|
@@ -652,5 +684,5 @@ function usernameAvailableValidator(usernameService, initialUsername) {
|
|
|
652
684
|
* Generated bundle index. Do not edit.
|
|
653
685
|
*/
|
|
654
686
|
|
|
655
|
-
export { AccountService, AdminService, AuthService, BETTER_AUTH_CONFIG_TOKEN, EmailOtpService, GenericOauthService, MagicLinkService, OneTapService, OrganizationService, PasskeyService, SessionService, TwoFactorService, UsernameService, canActivate, hasRole, provideBetterAuth, redirectLoggedInTo, redirectUnauthorizedTo, usernameAvailableValidator };
|
|
687
|
+
export { AccountService, AdminService, AuthService, BETTER_AUTH_CONFIG_TOKEN, EmailOtpService, GenericOauthService, MagicLinkService, OneTapService, OrganizationService, PasskeyService, SessionService, SiweService, TwoFactorService, UsernameService, canActivate, hasRole, provideBetterAuth, redirectLoggedInTo, redirectUnauthorizedTo, usernameAvailableValidator };
|
|
656
688
|
//# sourceMappingURL=ngx-better-auth.mjs.map
|