Skip to content

Commit

Permalink
export aws auth
Browse files Browse the repository at this point in the history
  • Loading branch information
thdxr committed May 26, 2024
1 parent 7e14588 commit af2ee78
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 3 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions pkg/platform/src/components/aws/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class Auth extends Component implements Link.Linkable {
return new Function(`${name}Authenticator`, {
...args,
url: true,
streaming: true,
environment: {
...args.environment,
AUTH_PRIVATE_KEY: secret(this.key.privateKeyPemPkcs8),
Expand Down
Binary file removed sdk/js/bun.lockb
Binary file not shown.
3 changes: 2 additions & 1 deletion sdk/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "sst",
"type": "module",
"sideEffects": false,
"version": "3.0.26",
"version": "3.0.28",
"main": "./dist/index.js",
"exports": {
".": "./dist/index.js",
Expand Down Expand Up @@ -43,6 +43,7 @@
},
"dependencies": {
"@aws-sdk/client-lambda": "3.478.0",
"@tsconfig/node20": "^20.1.4",
"aws4fetch": "^1.0.18",
"jose": "5.2.3",
"openid-client": "5.6.4"
Expand Down
2 changes: 1 addition & 1 deletion sdk/js/src/auth/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { handle as awsHandle } from "hono/aws-lambda";
import { Context } from "hono";
import { deleteCookie, getCookie, setCookie } from "hono/cookie";

interface OnSuccessResponder<T extends { type: any; properties: any }> {
export interface OnSuccessResponder<T extends { type: any; properties: any }> {
session(input: T & JWTPayload): Promise<Response>;
}

Expand Down
17 changes: 17 additions & 0 deletions sdk/js/src/aws/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Handler } from "aws-lambda";
import { Adapter } from "../auth/adapter/adapter.js";
import { AuthHandler } from "../auth/handler.js";
import { SessionBuilder, createSessionBuilder } from "../auth/session.js";
import { streamHandle } from "hono/aws-lambda";

export module auth {
export type Issuer = import("openid-client").Issuer;
export function authorizer<
Providers extends Record<string, Adapter<any>>,
Sessions extends SessionBuilder,
Result,
>(...args: Parameters<typeof AuthHandler<Providers, Sessions, Result>>) {
return streamHandle(AuthHandler(...args)) as Handler<any, any>;
}
export const sessions = createSessionBuilder;
}
3 changes: 2 additions & 1 deletion sdk/js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node18/tsconfig.json",
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
"preserveSymlinks": true,
"outDir": "dist",
"declaration": true,
"module": "NodeNext",
Expand Down

0 comments on commit af2ee78

Please sign in to comment.