mirror of
https://github.com/chenasraf/express-otp.git
synced 2026-05-17 17:48:11 +00:00
chore: rename package [skip publish]
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# otipi
|
||||
# express-otp
|
||||
|
||||
Incredibly simple TOTP authentication for your Node.JS/Express backend.
|
||||
|
||||
@@ -13,10 +13,10 @@ See [src/example/server.ts](src/example/server.ts) for a fully working example u
|
||||
|
||||
### Initialize
|
||||
|
||||
First, use the `otipi` function to generate middleware and functions for your use:
|
||||
First, use the `express-otp` function to generate middleware and functions for your use:
|
||||
|
||||
```typescript
|
||||
const totp = otipi({
|
||||
const totp = otp({
|
||||
// Any identifier that is for your app
|
||||
issuer: 'my-issuer',
|
||||
// This should return user information if a request contains a valid user
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "otipi",
|
||||
"name": "express-otp",
|
||||
"version": "0.1.0",
|
||||
"description": "Easy auth with your admin endpoints using OTP",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/chenasraf/otipi",
|
||||
"repository": "https://github.com/chenasraf/express-otp",
|
||||
"author": "Chen Asraf <contact@casraf.dev>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import express from 'express'
|
||||
import otipi from '..'
|
||||
import otp from '..'
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
dotenv.config()
|
||||
@@ -8,7 +8,7 @@ const app = express()
|
||||
|
||||
const sampleUser = { id: 1, username: process.env.USER_NAME!, secret: process.env.USER_SECRET! }
|
||||
|
||||
const totp = otipi<typeof sampleUser>({
|
||||
const totp = otp<typeof sampleUser>({
|
||||
issuer: 'my-issuer',
|
||||
getUser: (req) => {
|
||||
const user = [sampleUser].find((x) => x.username === req.query.username)
|
||||
|
||||
Reference in New Issue
Block a user