Skip to content

Commit

Permalink
Merge pull request #12 from oxen-io/improved_faucet
Browse files Browse the repository at this point in the history
Session Token Testnet Faucet
  • Loading branch information
Aerilym authored Jul 9, 2024
2 parents 2e8918e + 4fac609 commit eefcf21
Show file tree
Hide file tree
Showing 40 changed files with 1,960 additions and 96 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ yarn-error.log*
# Misc
.DS_Store
*.pem
.cache
.cache

# Databases
*.sqlite
*.sqlite3
*.db
10 changes: 9 additions & 1 deletion apps/staking/.env.local.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=
NEXT_PUBLIC_SENT_STAKING_API_URL=
FAUCET_WALLET_PRIVATE_KEY=
NEXT_PUBLIC_ENV_FLAG= pick from dev, qa, stg, prd
FAUCET_DB_SECRET_KEY=
FAUCET_HOURS_BETWEEN_USES=
FAUCET_CHAIN=testnet
NEXT_PUBLIC_ENV_FLAG= pick from dev, qa, stg, prd
DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=
TELEGRAM_BOT_TOKEN=
NEXTAUTH_SECRET=
NEXTAUTH_URL=
32 changes: 32 additions & 0 deletions apps/staking/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { createAuthHandler } from '@session/auth/api';
import { DiscordProvider, handleDiscordSession } from '@session/auth/providers/discord';
import { TelegramProvider, handleTelegramSession } from '@session/auth/providers/telegram';

const discordClientId = process.env.DISCORD_CLIENT_ID;
const discordClientSecret = process.env.DISCORD_CLIENT_SECRET;
const telegramBotToken = process.env.TELEGRAM_BOT_TOKEN;

if (!discordClientId || !discordClientSecret) {
throw new Error('Discord client ID and client secret must be provided');
}

if (!telegramBotToken) {
throw new Error('Telegram bot token must be provided');
}

export const { GET, POST } = createAuthHandler({
providers: [
DiscordProvider({
clientId: discordClientId,
clientSecret: discordClientSecret,
}),
TelegramProvider({ botToken: telegramBotToken }),
],
callbacks: {
async session({ session, token }) {
handleDiscordSession({ session, token });
handleTelegramSession({ session, token });
return session;
},
},
});
Loading

0 comments on commit eefcf21

Please sign in to comment.