generated from worldcoin/minikit-react-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 351a061
Showing
39 changed files
with
5,430 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Relyance SCI Scan | ||
|
||
on: | ||
schedule: | ||
- cron: "0 20 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
execute-relyance-sci: | ||
name: Relyance SCI Job | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Pull and run SCI binary | ||
run: |- | ||
docker pull gcr.io/relyance-ext/compliance_inspector:release && \ | ||
docker run --rm -v `pwd`:/repo --env API_KEY='${{ secrets.DPP_SCI_KEY }}' gcr.io/relyance-ext/compliance_inspector:release |
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 @@ | ||
.DS_Store |
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 @@ | ||
v20.17.0 |
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,27 @@ | ||
# React example of minikit | ||
|
||
Apart from a frontend, you'll need a backend, this template contains an example of that as well | ||
|
||
## To run, install: | ||
|
||
- deps, `cd frontend;pnpm i;cd -;cd backend;pnpm i` | ||
- ngrok - Create a free ngrok account, follow the official [docs](https://ngrok.com/docs/getting-started/) | ||
- nginx - use you favorite package manager :) | ||
|
||
### nginx setup | ||
|
||
To serve multiple localhost applications through a single ngrok tunnel (only one available for free-tier users), you can use nginx as a reverse proxy. Follow the steps below to set it up: | ||
|
||
### Run nginx | ||
|
||
Use the config provided in the root of this repo | ||
`sudo nginx -c full/path/to/this/repo/nginx.conf` | ||
or, if you run the command from the root dir | ||
`sudo nginx -c $(pwd)/nginx.conf` | ||
|
||
To stop nginx run `sudo nginx -s stop` | ||
|
||
### Tunnel through Ngrok | ||
|
||
`ngrok http 8080` | ||
The port doesn't matter, make sure it's the `listen` one from nginx config |
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,4 @@ | ||
WLD_CLIENT_ID= | ||
WLD_CLIENT_SECRET= | ||
# needed by authjs, use `openssl rand -base64 32` to generate | ||
AUTH_SECRET= |
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,3 @@ | ||
node_modules | ||
|
||
.env |
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 @@ | ||
v20.17.0 |
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,3 @@ | ||
### To get started, start the server | ||
|
||
`pnpm run dev` |
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,37 @@ | ||
import express from "express"; | ||
|
||
import { verifyHandler } from "./src/verify"; | ||
import { initiatePaymentHandler } from "./src/initiate-payment"; | ||
import { confirmPaymentHandler } from "./src/confirm-payment"; | ||
import cors from "cors"; | ||
|
||
const app = express(); | ||
|
||
// trust the proxy to allow HTTPS protocol to be detected | ||
// https://expressjs.com/en/guide/behind-proxies.html | ||
app.set("trust proxy", true); | ||
// allow cors | ||
app.use(cors()); | ||
// json middleware | ||
app.use(express.json()); | ||
app.use(express.urlencoded({ extended: true })); | ||
|
||
// request logger middleware | ||
app.use((req, _res, next) => { | ||
console.log(`logger: ${req.method} ${req.url}`); | ||
next(); | ||
}); | ||
|
||
app.get("/ping", (_, res) => { | ||
res.send("minikit-example pong v1"); | ||
}); | ||
|
||
// protected routes | ||
app.post("/verify", verifyHandler); | ||
app.post("/initiate-payment", initiatePaymentHandler); | ||
app.post("/confirm-payment", confirmPaymentHandler); | ||
|
||
const port = 3000; // use env var | ||
app.listen(port, () => { | ||
console.log(`Example app listening on port ${port}`); | ||
}); |
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,5 @@ | ||
{ | ||
"watch": ["./src/**/*.ts", "./index.ts"], | ||
"ext": "ts", | ||
"exec": "ts-node ./index.ts" | ||
} |
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 @@ | ||
{ | ||
"name": "example-minikit-server", | ||
"version": "0.0.0", | ||
"description": "", | ||
"main": "index.ts", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "tsx watch --env-file=./.env --clear-screen=false ./index.ts | pino-pretty", | ||
"a": "tsx --help" | ||
}, | ||
"dependencies": { | ||
"@worldcoin/minikit-js": "1.1.1", | ||
"cors": "^2.8.5", | ||
"express": "^4.21.0", | ||
"node-fetch": "^3.3.2", | ||
"pino-pretty": "^11.0.0", | ||
"tsx": "^4.7.2" | ||
}, | ||
"devDependencies": { | ||
"@types/express": "5.0.0", | ||
"@types/node": "20", | ||
"ts-node": "10.7.0", | ||
"typescript": "5.6.2" | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
} | ||
} |
Oops, something went wrong.