-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/use-fresh-tokens
- Loading branch information
Showing
109 changed files
with
16,366 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
dist | ||
fixtures | ||
packages/api/importAll.macro.js | ||
packages/core/**/__fixtures__/**/* | ||
packages/core/config/storybook/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
__fixtures__/example-todo-main/web/src/pages/TypeScriptPage/TypeScriptPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default () => 'I am a TypeScript page.' |
1 change: 1 addition & 0 deletions
1
__fixtures__/example-todo-main/web/src/pages/admin/EditUserPage/EditUserPage.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default () => 'I am an page in a subdirectory.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "0.22.1", | ||
"version": "0.23.0", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"command": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import jwt from 'jsonwebtoken' | ||
|
||
export const ethereum = (token: string) => { | ||
if (!process.env.ETHEREUM_JWT_SECRET) { | ||
console.error('ETHEREUM_JWT_SECRET env var is not set.') | ||
throw new Error('ETHEREUM_JWT_SECRET env var is not set.') | ||
} | ||
|
||
try { | ||
const secret = process.env.ETHEREUM_JWT_SECRET as string | ||
return Promise.resolve(jwt.verify(token, secret) as Record<string, unknown>) | ||
} catch (error) { | ||
return Promise.reject(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
import jwt from 'jsonwebtoken' | ||
|
||
export const supabase = (token: string) => { | ||
if (process.env.NODE_ENV === 'production') { | ||
if (!process.env.SUPABASE_JWT_SECRET) { | ||
throw new Error('`SUPABASE_JWT_SECRET` env var is not set.') | ||
} | ||
if (!process.env.SUPABASE_JWT_SECRET) { | ||
console.error('SUPABASE_JWT_SECRET env var is not set.') | ||
throw new Error('SUPABASE_JWT_SECRET env var is not set.') | ||
} | ||
|
||
try { | ||
const secret = process.env.SUPABASE_JWT_SECRET as string | ||
return Promise.resolve( | ||
jwt.verify(token, secret) as Record<string, unknown> | ||
) | ||
} catch (error) { | ||
return Promise.reject(error) | ||
} | ||
} else { | ||
return Promise.resolve(jwt.decode(token)) | ||
try { | ||
const secret = process.env.SUPABASE_JWT_SECRET as string | ||
return Promise.resolve( | ||
jwt.verify(token, secret) as Record<string, unknown> | ||
) | ||
} catch (error) { | ||
return Promise.reject(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,5 +60,6 @@ export type SupportedAuthClients = | |
| MagicLink | ||
| Firebase | ||
| Supabase | ||
| Ethereum | ||
| Custom | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@redwoodjs/auth", | ||
"version": "0.22.1", | ||
"version": "0.23.0", | ||
"files": [ | ||
"dist" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export type EthereumUser = { | ||
address: string | null | ||
} | ||
|
||
export type Ethereum = { | ||
login(): Promise<any> | ||
logout(): Promise<any> | ||
getToken(): Promise<null | string> | ||
getUserMetadata(): Promise<null | EthereumUser> | ||
} | ||
|
||
import type { AuthClient } from './' | ||
|
||
export const ethereum = (client: Ethereum): AuthClient => { | ||
return { | ||
type: 'ethereum', | ||
client, | ||
login: async () => await client.login(), | ||
signup: () => { | ||
throw new Error( | ||
`Ethereum auth does not support "signup". Please use "login" instead.` | ||
) | ||
}, | ||
logout: async () => await client.logout(), | ||
getToken: async () => await client.getToken(), | ||
getUserMetadata: async () => await client.getUserMetadata(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.