Skip to content

Commit

Permalink
fix: env variables for ecosystem backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jamalavedra committed Oct 18, 2024
1 parent cface3c commit 654253f
Show file tree
Hide file tree
Showing 7 changed files with 1,302 additions and 25 deletions.
2 changes: 1 addition & 1 deletion ecosystem-sdk/sdk-sample/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@examples/wallets-connect-with-nextjs",
"version": "0.0.9",
"version": "0.0.10",
"dependencies": {
"@rapidfire/id": "^0.0.3",
"@tanstack/react-query": "^5.51.11",
Expand Down
1,294 changes: 1,279 additions & 15 deletions ecosystem-sdk/sdk-sample/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ecosystem-sdk/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rapidfire/id",
"version": "0.0.9",
"version": "0.0.10",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
Expand Down
5 changes: 3 additions & 2 deletions ecosystem-wallet/backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
OPENFORT_SECRET_KEY=
OPENFORT_PUBLIC_KEY=
SHIELD_SECRET_KEY=
ENCRYPTION_SHARE=
SHIELD_PUBLIC_KEY=
PORT=
PORT=3001
2 changes: 1 addition & 1 deletion ecosystem-wallet/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ecosystem-backend",
"version": "0.0.9",
"version": "0.0.10",
"main": "index.js",
"type": "commonjs",
"scripts": {
Expand Down
20 changes: 16 additions & 4 deletions ecosystem-wallet/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,25 @@ const openfort = new Openfort(process.env.OPENFORT_SECRET_KEY);
// Use the cors middleware to disable CORS
app.use(cors());

app.get("/", (req, res) => {
res.send("Service is running");
app.get("/api/healthz", (req, res) => {
res.send("OK");
});

app.post("/api/protected-create-encryption-session", async (req, res) => {
const session = await openfort.registerRecoverySession(process.env.SHIELD_PUBLIC_KEY!, process.env.SHIELD_SECRET_KEY!, process.env.ENCRYPTION_SHARE!)
res.json({ session });
try {
const accessToken = req.headers.authorization?.split(' ')[1];
if (!accessToken) {
return res.status(401).send({
error: 'You must be signed in to view the protected content on this page.',
});
}
await openfort.iam.verifyAuthToken(req.headers.authorization!);
const session = await openfort.registerRecoverySession(process.env.SHIELD_PUBLIC_KEY!, process.env.SHIELD_SECRET_KEY!, process.env.ENCRYPTION_SHARE!)
res.json({ session });
} catch (error) {
console.error(error);
res.status(500).json({ error: 'Internal Server Error' });
}
});


Expand Down
2 changes: 1 addition & 1 deletion ecosystem-wallet/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ecosystem-frontend",
"version": "0.0.9",
"version": "0.0.10",
"private": true,
"dependencies": {
"@openfort/ecosystem-js": "latest",
Expand Down

0 comments on commit 654253f

Please sign in to comment.