Skip to content

Commit

Permalink
feat: small changes to hapi script
Browse files Browse the repository at this point in the history
  • Loading branch information
AngeloAyranji committed Mar 27, 2024
1 parent d03a93b commit 4bd6b66
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions examples/backend/hapi/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
import Hapi,{ ServerRoute } from '@hapi/hapi';
import Hapi from '@hapi/hapi';
import { JustaName } from '@justaname.id/sdk';
import dotenv from 'dotenv';

// Initialize dotenv
dotenv.config();

const chainId = parseInt(process.env.JUSTANAME_CHAIN_ID as string);
const domain = process.env.JUSTANAME_DOMAIN as string;
const origin = process.env.JUSTANAME_ORIGIN as string;
const apiKey = process.env.JUSTANAME_API_KEY as string;

if(!origin) throw new Error('Origin is required');
if(!chainId) throw new Error('ChainId is required');
if(chainId !== 1 && chainId !== 11155111) throw new Error('ChainId is not supported');
if (!domain) throw new Error('Domain is required');
if (!apiKey) throw new Error('API Key is required');
if(!origin) {
throw new Error('Origin is required');
}

if(!chainId) {
throw new Error('ChainId is required');
}

if(chainId !== 1 && chainId !== 11155111) {
throw new Error('ChainId is not supported');
}

if (!domain) {
throw new Error('Domain is required');
}

if (!apiKey) {
throw new Error('API Key is required');
}

interface RequestChallengeQuery {
address: string;
Expand Down

0 comments on commit 4bd6b66

Please sign in to comment.