Skip to content

Commit

Permalink
ssx serverside
Browse files Browse the repository at this point in the history
  • Loading branch information
denniswon committed Apr 7, 2023
1 parent 8cced0a commit b661738
Show file tree
Hide file tree
Showing 7 changed files with 1,743 additions and 55 deletions.
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ KAS_API_ACCESS_KEY_ID=''

KAS_API_SECRET_ACCESS_KEY=''

KAS_ENDPOINT=''
KAS_ENDPOINT=''

SSX_API_KEY=''

SSX_SECRET=''
1 change: 1 addition & 0 deletions functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"main": "lib/src/index.js",
"dependencies": {
"@moralisweb3/common-core": "^2.12.0",
"@spruceid/ssx": "^1.2.5",
"app-root-path": "^3.1.0",
"cors": "^2.8.5",
"dotenv": "^16.0.1",
Expand Down
4 changes: 4 additions & 0 deletions functions/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const config = {

KAS_ENDPOINT: readEnv('KAS_ENDPOINT'),

SSX_API_KEY: readEnv('SSX_API_KEY'),

SSX_SECRET: readEnv('SSX_SECRET'),

};

export default config;
Expand Down
15 changes: 15 additions & 0 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {profileRouter} from './profile/profileRouter';
import swaggerui from 'swagger-ui-express';
import {jwtRouter} from './auth/jwtRouter';
import {offerRouter} from './offer/offerRouter';
import {SSXServer, SSXExpressMiddleware} from '@spruceid/ssx-server';
// eslint-disable-next-line etc/no-commented-out-code
// import {getSwagger} from './Swagger';

Expand Down Expand Up @@ -38,6 +39,20 @@ app.use('/profile', profileRouter);
app.use('/offer', offerRouter);
app.use('/docs', swaggerui.serve);

const ssx = new SSXServer({
signingKey: config.SSX_SECRET,
providers: {
metrics: {service: 'ssx', apiKey: config.SSX_API_KEY},
},
});

app.use(SSXExpressMiddleware(ssx));


app.get('/', (req, res) => {
res.send('Palm server side');
});

// eslint-disable-next-line no-inline-comments
// getSwagger(app); // creating swagger.json file
app.get('/docs', swaggerui.setup(import('../swagger.json')));
Expand Down
Loading

0 comments on commit b661738

Please sign in to comment.