diff --git a/keyserver/src/responders/landing-handler.js b/keyserver/src/responders/landing-handler.js
--- a/keyserver/src/responders/landing-handler.js
+++ b/keyserver/src/responders/landing-handler.js
@@ -103,6 +103,7 @@
const { renderToNodeStream } = ReactDOMServer;
async function landingResponder(req: $Request, res: $Response) {
+ const siweNonce = req.header('siwe-nonce');
const [{ jsURL, fontURLs, cssInclude }, LandingSSR] = await Promise.all([
getAssetInfo(),
getWebpackCompiledRootComponentForSSR(),
@@ -159,7 +160,11 @@
const routerBasename = basePath.replace(/\/$/, '');
const clientPath = routerBasename + req.url;
const reactStream = renderToNodeStream(
- ,
+ ,
);
reactStream.pipe(res, { end: false });
await waitForStream(reactStream);
diff --git a/landing/landing-ssr.react.js b/landing/landing-ssr.react.js
--- a/landing/landing-ssr.react.js
+++ b/landing/landing-ssr.react.js
@@ -4,17 +4,28 @@
import { StaticRouter } from 'react-router';
import Landing from './landing.react';
+import { SIWENonceContext } from './siwe-nonce-context';
export type LandingSSRProps = {
+url: string,
+basename: string,
+ +siweNonce: ?string,
};
function LandingSSR(props: LandingSSRProps): React.Node {
- const { url, basename } = props;
+ const { url, basename, siweNonce } = props;
+
+ const siweNonceContextValue = React.useMemo(
+ () => ({
+ siweNonce,
+ }),
+ [siweNonce],
+ );
const routerContext = React.useMemo(() => ({}), []);
return (
-
+
+
+
);
}