exists.js 305 B

12345678910111213
  1. const storage = require('../storage');
  2. module.exports = async (req, res) => {
  3. try {
  4. const meta = await storage.metadata(req.params.id);
  5. res.set('WWW-Authenticate', `send-v1 ${meta.nonce}`);
  6. res.send({
  7. requiresPassword: meta.pwd
  8. });
  9. } catch (e) {
  10. res.sendStatus(404);
  11. }
  12. };