diff --git a/.env.example b/.env.example index 3577a185b..a1faef3f0 100644 --- a/.env.example +++ b/.env.example @@ -16,6 +16,11 @@ NEXT_PUBLIC_WEBAPP_URL='http://localhost:3000' NEXTAUTH_SECRET='lorem ipsum sit dolor random string for encryption this could literally be anything' NEXTAUTH_URL='http://localhost:3000' +# SIGNING +CERT_FILE_PATH= +CERT_PASSPHRASE= +CERT_FILE_ENCODING= + # MAIL (NODEMAILER) # SENDGRID # Get a Sendgrid Api key here: https://signup.sendgrid.com diff --git a/.vscode/settings.json b/.vscode/settings.json index 41c0f1a88..36b7f475c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,6 +14,12 @@ "source.removeUnusedImports": false }, "typescript.tsdk": "node_modules/typescript/lib", - "spellright.language": ["de"], - "spellright.documentTypes": ["markdown", "latex", "plaintext"] + "spellright.language": [ + "de" + ], + "spellright.documentTypes": [ + "markdown", + "latex", + "plaintext" + ] } diff --git a/README.md b/README.md index 7412b4507..cf5b78ba1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> We are launching on Product Hunt soon! Sign up to support the launch: +> We are launching TOMORROW on Product Hunt soon! Sign up to support the launch: >
diff --git a/apps/web/pages/documents/[id]/sign.tsx b/apps/web/pages/documents/[id]/sign.tsx
index c2fbb1230..b13601541 100644
--- a/apps/web/pages/documents/[id]/sign.tsx
+++ b/apps/web/pages/documents/[id]/sign.tsx
@@ -59,7 +59,7 @@ export async function getServerSideProps(context: any) {
},
});
- const recipient = await prisma.recipient.findFirstOrThrow({
+ const recipient = await prisma.recipient.findFirst({
where: {
token: recipientToken,
},
@@ -68,6 +68,15 @@ export async function getServerSideProps(context: any) {
},
});
+ if (!recipient) {
+ return {
+ redirect: {
+ permanent: false,
+ destination: "/404",
+ },
+ };
+ }
+
// Document is already signed
if (recipient.Document.status === DocumentStatus.COMPLETED) {
return {
diff --git a/packages/signing/addDigitalSignature.ts b/packages/signing/addDigitalSignature.ts
index b77c60138..b9272829f 100644
--- a/packages/signing/addDigitalSignature.ts
+++ b/packages/signing/addDigitalSignature.ts
@@ -1,6 +1,6 @@
+import fs from "fs";
import { PDFDocument, PDFHexString, PDFName, PDFNumber, PDFString } from "pdf-lib";
-const fs = require("fs");
// Local copy of Node SignPDF because https://github.com/vbuch/node-signpdf/pull/187 was not published in NPM yet. Can be switched to npm packge.
const signer = require("./node-signpdf/dist/signpdf");
@@ -8,8 +8,12 @@ export const addDigitalSignature = async (documentAsBase64: string): Promise