devv-code-backend
v1.0.0
Published
Devv Code Backend SDK - like Supabase for Devv Code
Readme
Devv Code Backend
Backend SDK for Devv Code - like Supabase for Devv Code.
Installation
npm install devv-code-backendUsage
import { DevvAuth } from 'devv-code-backend';
// or import { auth } from 'devv-code-backend';
const auth = new DevvAuth();
// Send OTP
await auth.sendOTP('[email protected]');
// Verify OTP
const authResponse = await auth.verifyOTP('[email protected]', '123456');
const { sid, user } = authResponse;
// Logout
await auth.logout();Methods
sendOTP(email: string): Promise<void>- Send verification codeverifyOTP(email: string, verificationCode: string): Promise<AuthResponse>- Verify code and loginlogout(): Promise<void>- Logout user
Types
interface User {
projectId: string;
uid: string;
name: string;
email: string;
createdTime: number;
lastLoginTime: number;
}
interface AuthResponse {
sid: string;
user: User;
}