@arkstack/auth 0.12.11 → 0.12.13
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/dist/index.d.ts +7 -7
- package/dist/index.js +6 -6
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./app.d.ts" />
|
|
2
2
|
import { Exception } from "@arkstack/common";
|
|
3
|
-
import { Request, RequestSource, Response, ResponseSource, Session
|
|
3
|
+
import { Request, RequestSource, Response, ResponseSource, Session } from "@arkstack/http";
|
|
4
4
|
import * as _$otpauth from "otpauth";
|
|
5
5
|
import { Model } from "@arkstack/database";
|
|
6
6
|
|
|
@@ -17,15 +17,15 @@ declare abstract class PersonalAccessToken extends Model {
|
|
|
17
17
|
deviceInfo: Record<string, unknown> | null;
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
|
-
//#region src/
|
|
20
|
+
//#region src/AuthSession.d.ts
|
|
21
21
|
/**
|
|
22
22
|
* Represents an authenticated user session.
|
|
23
23
|
*
|
|
24
24
|
* @author 3m1n3nc3
|
|
25
25
|
*/
|
|
26
|
-
declare class
|
|
26
|
+
declare class AuthSession extends Session {
|
|
27
27
|
private auth;
|
|
28
|
-
constructor(auth: AuthContract, current?: Session
|
|
28
|
+
constructor(auth: AuthContract, current?: Session | undefined);
|
|
29
29
|
/**
|
|
30
30
|
* Destroy the current session
|
|
31
31
|
*
|
|
@@ -140,7 +140,7 @@ declare abstract class AuthContract {
|
|
|
140
140
|
*
|
|
141
141
|
* @returns
|
|
142
142
|
*/
|
|
143
|
-
abstract session():
|
|
143
|
+
abstract session(): AuthSession;
|
|
144
144
|
/**
|
|
145
145
|
* Create a personal access token for a user
|
|
146
146
|
*
|
|
@@ -265,7 +265,7 @@ declare class Auth extends AuthContract {
|
|
|
265
265
|
*
|
|
266
266
|
* @returns
|
|
267
267
|
*/
|
|
268
|
-
session():
|
|
268
|
+
session(): AuthSession;
|
|
269
269
|
/**
|
|
270
270
|
* Create a personal access token for a user
|
|
271
271
|
*
|
|
@@ -631,4 +631,4 @@ declare class AuthenticationException extends Exception {
|
|
|
631
631
|
errors(): Record<string, any> | undefined;
|
|
632
632
|
}
|
|
633
633
|
//#endregion
|
|
634
|
-
export { Auth, AuthContract, AuthenticationException, DeviceAgentPayload, IssuedSmsCode, PersonalAccessToken,
|
|
634
|
+
export { Auth, AuthContract, AuthSession, AuthenticationException, DeviceAgentPayload, IssuedSmsCode, PersonalAccessToken, SessionDevice, SessionDeviceInfo, SmsCodePurpose, TwoFactor, TwoFactorMethod, TwoFactorSetup, TwoFactorStatus, User, UserTwoFactor, auth };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Encryption, Exception, Hash, env, getModel } from "@arkstack/common";
|
|
2
2
|
import { SignJWT, jwtVerify } from "jose";
|
|
3
|
-
import { Request, Response, Session
|
|
3
|
+
import { Request, Response, Session } from "@arkstack/http";
|
|
4
4
|
import { UAParser } from "ua-parser-js";
|
|
5
5
|
import { Secret } from "otpauth";
|
|
6
6
|
import { randomBytes } from "node:crypto";
|
|
@@ -38,16 +38,16 @@ var AuthenticationException = class extends Exception {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
//#endregion
|
|
41
|
-
//#region src/
|
|
41
|
+
//#region src/AuthSession.ts
|
|
42
42
|
/**
|
|
43
43
|
* Represents an authenticated user session.
|
|
44
44
|
*
|
|
45
45
|
* @author 3m1n3nc3
|
|
46
46
|
*/
|
|
47
|
-
var
|
|
47
|
+
var AuthSession = class extends Session {
|
|
48
48
|
auth;
|
|
49
49
|
constructor(auth, current = globalThis.session?.()) {
|
|
50
|
-
super(current instanceof Session
|
|
50
|
+
super(current instanceof Session ? current : void 0);
|
|
51
51
|
this.auth = auth;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
@@ -437,7 +437,7 @@ var Auth = class Auth extends AuthContract {
|
|
|
437
437
|
* @returns
|
|
438
438
|
*/
|
|
439
439
|
session() {
|
|
440
|
-
return new
|
|
440
|
+
return new AuthSession(this);
|
|
441
441
|
}
|
|
442
442
|
/**
|
|
443
443
|
* Create a personal access token for a user
|
|
@@ -854,4 +854,4 @@ var UserTwoFactor = class extends Model {
|
|
|
854
854
|
casts = { recoveryCodeHashes: "json" };
|
|
855
855
|
};
|
|
856
856
|
//#endregion
|
|
857
|
-
export { Auth, AuthContract, AuthenticationException, PersonalAccessToken,
|
|
857
|
+
export { Auth, AuthContract, AuthSession, AuthenticationException, PersonalAccessToken, SessionDevice, TwoFactor, User, UserTwoFactor, auth };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/auth",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Authentication module for Arkstack, providing core authentication and identity features.",
|
|
6
6
|
"homepage": "https://arkstack.toneflix.net/guide/auth",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"jose": "^6.2.3",
|
|
39
39
|
"otpauth": "^9.5.1",
|
|
40
40
|
"ua-parser-js": "^2.0.9",
|
|
41
|
-
"@arkstack/common": "^0.12.
|
|
42
|
-
"@arkstack/http": "^0.12.
|
|
41
|
+
"@arkstack/common": "^0.12.13",
|
|
42
|
+
"@arkstack/http": "^0.12.13"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@h3ravel/support": "^0.15.11",
|
|
46
|
-
"@arkstack/database": "^0.12.
|
|
46
|
+
"@arkstack/database": "^0.12.13"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsdown --config-loader unrun",
|