@absolutejs/auth 0.75.7 → 0.76.1
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/agents/context.d.ts +2 -6
- package/dist/agents/index.js +5 -6
- package/dist/agents/index.js.map +3 -3
- package/dist/agents/routes.d.ts +4 -10
- package/dist/authContext.d.ts +66 -178
- package/dist/authorization/protectPermission.d.ts +3 -8
- package/dist/cli/migrate.js +19 -15
- package/dist/cli/migrate.js.map +5 -5
- package/dist/htmx/configuredRoutes.d.ts +37 -126
- package/dist/htmx/routes.d.ts +37 -126
- package/dist/index.d.ts +237 -431
- package/dist/index.js +332 -113
- package/dist/index.js.map +17 -17
- package/dist/mfa/challenge.d.ts +53 -7
- package/dist/mfa/management.d.ts +49 -6
- package/dist/mfa/postgresMfaStore.d.ts +31 -1
- package/dist/mfa/rotation.d.ts +1 -1
- package/dist/mfa/routes.d.ts +78 -2
- package/dist/mfa/sms.d.ts +7 -2
- package/dist/mfa/totp.d.ts +8 -2
- package/dist/mfa/types.d.ts +47 -0
- package/dist/routes/protectRoute.d.ts +4 -21
- package/dist/routes/stepUp.d.ts +3 -8
- package/dist/server.js +330 -113
- package/dist/server.js.map +17 -17
- package/package.json +1 -1
package/dist/agents/context.d.ts
CHANGED
|
@@ -5,10 +5,6 @@ type AgentAuthFailure = {
|
|
|
5
5
|
code: 'Forbidden' | 'Unauthorized';
|
|
6
6
|
message: 'Agent is not authenticated' | 'Insufficient agent scopes';
|
|
7
7
|
};
|
|
8
|
-
type ProtectAgent = {
|
|
9
|
-
<AuthReturn, AuthFailReturn = never>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn): Promise<Response | AuthReturn | Awaited<AuthFailReturn>>;
|
|
10
|
-
<AuthReturn, AuthFailReturn = never>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn): Promise<Response | AuthReturn | Awaited<AuthFailReturn>>;
|
|
11
|
-
};
|
|
12
8
|
export declare const agentAuthChallenge: ({ config, error, requiredScopes }: {
|
|
13
9
|
config: AgentAuthConfig;
|
|
14
10
|
error?: "invalid_token" | "insufficient_scope";
|
|
@@ -19,7 +15,7 @@ export declare const agentAuthContextPlugin: (config?: AgentAuthConfig) => Elysi
|
|
|
19
15
|
decorator: {};
|
|
20
16
|
store: {};
|
|
21
17
|
derive: {
|
|
22
|
-
readonly protectAgent:
|
|
18
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
23
19
|
};
|
|
24
20
|
}, {
|
|
25
21
|
typebox: {};
|
|
@@ -31,7 +27,7 @@ export declare const agentAuthContextPlugin: (config?: AgentAuthConfig) => Elysi
|
|
|
31
27
|
macroFn: {};
|
|
32
28
|
parser: {};
|
|
33
29
|
response: import("elysia/types").ExtractErrorFromHandle<{
|
|
34
|
-
readonly protectAgent:
|
|
30
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
35
31
|
}>;
|
|
36
32
|
}, {}, import("elysia/types").DefaultEphemeral, import("elysia/types").DefaultEphemeral>;
|
|
37
33
|
export {};
|
package/dist/agents/index.js
CHANGED
|
@@ -1653,8 +1653,8 @@ var failureResponse = (config, failure, requiredScopes) => new Response(JSON.str
|
|
|
1653
1653
|
var agentAuthContextPlugin = (config) => new Elysia({
|
|
1654
1654
|
name: "@absolutejs/auth/agent-context",
|
|
1655
1655
|
seed: pluginDependencySeed(config)
|
|
1656
|
-
}).derive(({ request }) => {
|
|
1657
|
-
|
|
1656
|
+
}).derive(({ request }) => ({
|
|
1657
|
+
protectAgent: async (requiredScopes, handleAuth, handleAuthFail) => {
|
|
1658
1658
|
if (config === undefined) {
|
|
1659
1659
|
const failure = {
|
|
1660
1660
|
code: "Unauthorized",
|
|
@@ -1680,9 +1680,8 @@ var agentAuthContextPlugin = (config) => new Elysia({
|
|
|
1680
1680
|
return await handleAuthFail?.(failure) ?? failureResponse(config, failure, requiredScopes);
|
|
1681
1681
|
}
|
|
1682
1682
|
return handleAuth(principal);
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
}).as("global");
|
|
1683
|
+
}
|
|
1684
|
+
})).as("global");
|
|
1686
1685
|
// src/agents/routes.ts
|
|
1687
1686
|
import { Elysia as Elysia2 } from "elysia";
|
|
1688
1687
|
var HTTP_BAD_REQUEST = 400;
|
|
@@ -13963,5 +13962,5 @@ export {
|
|
|
13963
13962
|
validateClientIdMetadataDocument
|
|
13964
13963
|
};
|
|
13965
13964
|
|
|
13966
|
-
//# debugId=
|
|
13965
|
+
//# debugId=5BB349EDA1CA8A4564756E2164756E21
|
|
13967
13966
|
//# sourceMappingURL=index.js.map
|