@stacksjs/auth 0.75.519 → 0.75.522
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/authentication.d.ts +12 -0
- package/dist/authorizable.d.ts +1 -0
- package/dist/browser-session.d.ts +1 -0
- package/dist/credential-user.d.ts +1 -0
- package/dist/impersonation.d.ts +0 -1
- package/dist/oauth-client-registration.d.ts +1 -0
- package/dist/oauth-consent.d.ts +1 -0
- package/dist/oauth-delegated-access.d.ts +1 -0
- package/dist/oauth-protected-resource.d.ts +2 -2
- package/dist/oauth-provider.d.ts +0 -1
- package/dist/oauth-token-exchange.d.ts +1 -0
- package/dist/page-gate.d.ts +1 -0
- package/dist/rate-limiter.d.ts +13 -0
- package/dist/rbac.d.ts +2 -0
- package/dist/session-auth.d.ts +1 -0
- package/dist/socials.d.ts +1 -0
- package/dist/tokens.d.ts +1 -0
- package/dist/user.d.ts +1 -0
- package/package.json +14 -14
package/dist/authentication.d.ts
CHANGED
|
@@ -4,7 +4,17 @@ import type { AuthCredentials, AuthToken, NewAccessToken, PersonalAccessToken, T
|
|
|
4
4
|
import type { ImpersonationGrant } from './impersonation';
|
|
5
5
|
declare type UserModel = NonNullable<Awaited<ReturnType<typeof User.find>>>;
|
|
6
6
|
export declare class Auth {
|
|
7
|
+
private static getBearerToken;
|
|
8
|
+
private static parseToken;
|
|
9
|
+
private static getClientSecret;
|
|
10
|
+
private static encryptTokenId;
|
|
11
|
+
private static decryptTokenId;
|
|
12
|
+
private static getPersonalAccessClient;
|
|
13
|
+
private static verifiedClient;
|
|
14
|
+
private static getTokenFromId;
|
|
15
|
+
private static tokenFromRow;
|
|
7
16
|
static attempt(credentials: AuthCredentials): Promise<boolean>;
|
|
17
|
+
private static verifyCredentials;
|
|
8
18
|
static validate(credentials: AuthCredentials): Promise<boolean>;
|
|
9
19
|
static withVerifiedCredentials<T>(credentials: AuthCredentials, issue: (user: UserModel) => Promise<T>): Promise<T | null>;
|
|
10
20
|
static login(credentials: AuthCredentials, options?: TokenCreateOptions): Promise<
|
|
@@ -25,6 +35,7 @@ export declare class Auth {
|
|
|
25
35
|
static requestToken(credentials: AuthCredentials, clientId: number, clientSecret: string): Promise<{ token: AuthToken } | null>;
|
|
26
36
|
static validateToken(token: string): Promise<boolean>;
|
|
27
37
|
static getUserFromToken(token: string): Promise<UserModel | undefined>;
|
|
38
|
+
private static resolveUserFromToken;
|
|
28
39
|
static startImpersonation(subjectId: number, reason: string): Promise<ImpersonationGrant>;
|
|
29
40
|
static endImpersonation(credential: string): Promise<void>;
|
|
30
41
|
static currentAccessToken(): Promise<PersonalAccessToken | undefined>;
|
|
@@ -47,3 +58,4 @@ export declare class Auth {
|
|
|
47
58
|
static viaRemember(): boolean;
|
|
48
59
|
static clearState(): void;
|
|
49
60
|
}
|
|
61
|
+
export {};
|
package/dist/authorizable.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export declare function findAuthUserRowByEmail(value: string): Promise<Record<st
|
|
|
5
5
|
/** Resolve an email without making existing mixed-case accounts unloginable. */
|
|
6
6
|
export declare function findAuthUserByEmail(value: string): Promise<UserModel | undefined>;
|
|
7
7
|
declare type UserModel = NonNullable<Awaited<ReturnType<typeof User.find>>>;
|
|
8
|
+
export {};
|
package/dist/impersonation.d.ts
CHANGED
package/dist/oauth-consent.d.ts
CHANGED
|
@@ -15,3 +15,4 @@ export type OAuthDelegatedAccessResult = { ok: true, token: AccessToken }
|
|
|
15
15
|
| { ok: false, reason: 'invalid_token' }
|
|
16
16
|
| { ok: false, reason: 'insufficient_scope', requiredScopes: string[] }
|
|
17
17
|
declare type OAuthDelegatedAccessFailure = Exclude<OAuthDelegatedAccessResult, { ok: true }>;
|
|
18
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** RFC 9728 metadata for the exact protected audience, never the inbound Host. */
|
|
2
2
|
export declare function oauthProtectedResourceMetadata(options: OAuthProtectedResourceOptions): {
|
|
3
|
-
resource: OAuthProtectedResourceOptions
|
|
4
|
-
authorization_servers: (OAuthProtectedResourceOptions
|
|
3
|
+
resource: (OAuthProtectedResourceOptions)["resource"];
|
|
4
|
+
authorization_servers: ((OAuthProtectedResourceOptions)["authorizationServers"])[number][];
|
|
5
5
|
bearer_methods_supported: string[]
|
|
6
6
|
};
|
|
7
7
|
export declare function oauthProtectedResourceMetadataPath(resource: string): string;
|
package/dist/oauth-provider.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { OAuthProviderConsentWorkspace, OAuthProviderConsentWorkspaceContext, OAuthProviderConsentWorkspaceResolver, OAuthProviderConfig, OAuthProviderResourceConfig, OAuthProviderScopeConfig, OAuthProviderSubjectEligibility } from '@stacksjs/types';
|
|
2
|
-
declare function endpoint(issuer: URL, configured: string | undefined, fallback: string): string;
|
|
3
2
|
/** Resolve and validate application-owned workspace authority for consent. */
|
|
4
3
|
export declare function resolveOAuthConsentWorkspace(provider: ResolvedOAuthProviderConfig, context: OAuthProviderConsentWorkspaceContext): Promise<OAuthProviderConsentWorkspace | null>;
|
|
5
4
|
/**
|
package/dist/page-gate.d.ts
CHANGED
package/dist/rate-limiter.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ export declare interface RedisRateLimiterStoreOptions {
|
|
|
32
32
|
}
|
|
33
33
|
/** Process-local store — the default. */
|
|
34
34
|
declare class MemoryStore implements RateLimiterStore {
|
|
35
|
+
private store;
|
|
36
|
+
private lastEviction;
|
|
37
|
+
private nextEvictionSize;
|
|
38
|
+
private evict;
|
|
35
39
|
get(key: string): RateLimitEntry | undefined;
|
|
36
40
|
set(key: string, entry: RateLimitEntry, ttlMs: number): void;
|
|
37
41
|
delete(key: string): void;
|
|
@@ -39,7 +43,11 @@ declare class MemoryStore implements RateLimiterStore {
|
|
|
39
43
|
}
|
|
40
44
|
/** Redis-backed store whose Lua update is atomic across workers. */
|
|
41
45
|
export declare class RedisRateLimiterStore implements RateLimiterStore {
|
|
46
|
+
private clientPromise;
|
|
47
|
+
private options;
|
|
42
48
|
constructor(options?: RedisRateLimiterStoreOptions);
|
|
49
|
+
private client;
|
|
50
|
+
private key;
|
|
43
51
|
get(key: string): Promise<RateLimitEntry | undefined>;
|
|
44
52
|
set(key: string, entry: RateLimitEntry, ttlMs: number): Promise<void>;
|
|
45
53
|
delete(key: string): Promise<void>;
|
|
@@ -52,7 +60,11 @@ export declare class RedisRateLimiterStore implements RateLimiterStore {
|
|
|
52
60
|
* failing every sign-in. Warns once per outage.
|
|
53
61
|
*/
|
|
54
62
|
export declare class FallbackRateLimiterStore implements RateLimiterStore {
|
|
63
|
+
private warned;
|
|
64
|
+
private shared;
|
|
65
|
+
private local;
|
|
55
66
|
constructor(shared: RateLimiterStore, local?: MemoryStore);
|
|
67
|
+
private attempt;
|
|
56
68
|
get(key: string): Promise<RateLimitEntry | undefined>;
|
|
57
69
|
delete(key: string): Promise<void>;
|
|
58
70
|
recordFailedAttempt(key: string, now: number, ttlMs: number): Promise<void>;
|
|
@@ -68,3 +80,4 @@ export declare class RateLimiter {
|
|
|
68
80
|
static resetAttempts(email: string): Promise<void>;
|
|
69
81
|
static validateAttempt(email: string): Promise<void>;
|
|
70
82
|
}
|
|
83
|
+
export {};
|
package/dist/rbac.d.ts
CHANGED
|
@@ -276,6 +276,8 @@ export declare class RbacEntityNotFoundError extends Error {
|
|
|
276
276
|
* `@stacksjs/router/stacks-router.ts`.
|
|
277
277
|
*/
|
|
278
278
|
declare class BoundedMap<K, V> {
|
|
279
|
+
private map;
|
|
280
|
+
private max;
|
|
279
281
|
constructor(max: number);
|
|
280
282
|
get(key: K): V | undefined;
|
|
281
283
|
has(key: K): boolean;
|
package/dist/session-auth.d.ts
CHANGED
package/dist/socials.d.ts
CHANGED
package/dist/tokens.d.ts
CHANGED
package/dist/user.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/auth",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.522",
|
|
6
6
|
"description": "A more simplistic way to authenticate.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -59,19 +59,19 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@stacksjs/bun-router": "^0.1.24",
|
|
62
|
-
"@stacksjs/cache": "0.75.
|
|
63
|
-
"@stacksjs/config": "0.75.
|
|
64
|
-
"@stacksjs/database": "0.75.
|
|
65
|
-
"@stacksjs/email": "0.75.
|
|
66
|
-
"@stacksjs/env": "0.75.
|
|
67
|
-
"@stacksjs/error-handling": "0.75.
|
|
68
|
-
"@stacksjs/logging": "0.75.
|
|
69
|
-
"@stacksjs/orm": "0.75.
|
|
70
|
-
"@stacksjs/path": "0.75.
|
|
71
|
-
"@stacksjs/router": "0.75.
|
|
72
|
-
"@stacksjs/security": "0.75.
|
|
73
|
-
"@stacksjs/socials": "0.75.
|
|
74
|
-
"@stacksjs/storage": "0.75.
|
|
62
|
+
"@stacksjs/cache": "0.75.522",
|
|
63
|
+
"@stacksjs/config": "0.75.522",
|
|
64
|
+
"@stacksjs/database": "0.75.522",
|
|
65
|
+
"@stacksjs/email": "0.75.522",
|
|
66
|
+
"@stacksjs/env": "0.75.522",
|
|
67
|
+
"@stacksjs/error-handling": "0.75.522",
|
|
68
|
+
"@stacksjs/logging": "0.75.522",
|
|
69
|
+
"@stacksjs/orm": "0.75.522",
|
|
70
|
+
"@stacksjs/path": "0.75.522",
|
|
71
|
+
"@stacksjs/router": "0.75.522",
|
|
72
|
+
"@stacksjs/security": "0.75.522",
|
|
73
|
+
"@stacksjs/socials": "0.75.522",
|
|
74
|
+
"@stacksjs/storage": "0.75.522",
|
|
75
75
|
"@stacksjs/ts-auth": "^0.4.7",
|
|
76
76
|
"ts-qr-codes": "^0.1.8"
|
|
77
77
|
},
|