-
Notifications
You must be signed in to change notification settings - Fork 87
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
Showing
4 changed files
with
36 additions
and
4 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
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,17 @@ | ||
import convict, { Schema } from 'convict' | ||
|
||
type FormSgSdkJwks = { | ||
publicJwks: string | ||
} | ||
|
||
const formSgSdkJwksSchema: Schema<FormSgSdkJwks> = { | ||
publicJwks: { | ||
doc: 'JSON Web Key Set for FormSG SDK', | ||
form: '*', | ||
default: null, // required field | ||
env: 'FORMSG_SDK_PUBLIC_JWKS', | ||
}, | ||
} | ||
export const formSgSdkJwksConfig = convict(formSgSdkJwksSchema) | ||
.validate({ allowed: 'strict' }) | ||
.getProperties() |
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
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,14 @@ | ||
import express, { Router } from 'express' | ||
|
||
import { formSgSdkJwksConfig } from '../../config/features/formsg-sdk-jwks.config' | ||
|
||
export const WellKnownRouter = Router() | ||
|
||
/** | ||
* Returns the FormSG's public json web key set (JWKS) for communication with FormSG SDK | ||
* @route GET /.well-known/formsg/jwks.json | ||
* @returns 200 | ||
*/ | ||
WellKnownRouter.get('/formsg/jwks.json', (req, res) => { | ||
return res.send(formSgSdkJwksConfig.publicJwks) | ||
}) |