Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const sspdf = require('./sspdf.js')
const Recognizer = require('./recognizer.js')
const mongoose = require.main.require('mongoose')
const crypto = require('crypto')
const scrypt = require('scrypt')
const { Fido2Lib } = require('fido2-lib')
const scryptParam = scrypt.paramsSync(0.05)
const SITE_ORIGIN = process.env.SITE_ORIGIN || 'https://paper.sc'
const rpId = new (require('url').URL)(SITE_ORIGIN).hostname
const f2l = new Fido2Lib({
timeout: 5 * 60 * 1000,
rpId,
rpName: rpId,
attestation: "none"
})
module.exports = (db, es) => {
let awaiting = []
// A doc document dosen't necessarily need to be PDF! It can, for example, be mp3 in the case of listening files, or be zip in the case of CS source files.
let docSchema = new mongoose.Schema({
subject: {type: 'String', index: true, required: true},
time: {type: 'String', index: true, required: true}, // Eg. s12, w15, y16 (i.e. for speciman paper)
type: {type: 'String', index: true, required: true}, // Eg. qp, ms, sp, sm etc.
paper: {type: 'Number', index: true, required: true},
variant: {type: 'Number', index: true, required: true},
fileBlob: {type: 'Buffer', required: false}, // Remain for legacy reason.