Skip to content

ericadamski/serverless-password

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
api
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

serverless-password

A simple set of routes for securly storing and testing ad-hoc passwords:

How to use

  1. Go enter the password you want to use here: https://paassword.now.sh

  2. Copy the URL given to you from step 1

  3. Make a POST request to the URL you receive

import fetch from "unfetch"

const response = await fetch("<YOUR_URL>", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ pwd: 'your password attempt' })
})

if (response.ok) {
    const { valid } = await response.json()

    console.log(valid) // true || false
}

Live example

You can run this in a modern browser console.

be careful of CORS 😑

async function validatePassword(pwd) {
    const response = await fetch("https://svrlss.now.sh/api/get/rec3T73O3WNZk3IZj", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ pwd })
    })

    if (response.ok) {
        const { valid } = await response.json()

        console.log(
            valid
                ? "You entered the correct password! πŸ‘"
                : "The password you entered is incorrect. 😭"
        )
    }
}

validatePassword("test") /* the real password is dev.to */

About

A simple, secure way to create a password checker without needing a server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published