JSONWebToken work
All checks were successful
Lint / lint (push) Successful in 11s

This commit is contained in:
Julien Valverdé
2024-09-07 19:24:33 +02:00
parent da597f763d
commit 6e5c371b40

View File

@@ -3,7 +3,9 @@ import type * as JWT from "jsonwebtoken"
import { ImportError } from "./ImportError" import { ImportError } from "./ImportError"
export class JSONWebToken extends Context.Tag("JSONWebToken")<JSONWebToken, { export class JSONWebToken extends Context.Tag("JSONWebToken")<JSONWebToken, JSONWebTokenService>() {}
export interface JSONWebTokenService {
sign: ( sign: (
payload: string | object | Buffer, payload: string | object | Buffer,
secretOrPrivateKey: JWT.Secret, secretOrPrivateKey: JWT.Secret,
@@ -12,7 +14,7 @@ export class JSONWebToken extends Context.Tag("JSONWebToken")<JSONWebToken, {
string, string,
Error, Error,
never never
>, >
verify: ( verify: (
token: string, token: string,
@@ -22,8 +24,8 @@ export class JSONWebToken extends Context.Tag("JSONWebToken")<JSONWebToken, {
string | JWT.Jwt | JWT.JwtPayload, string | JWT.Jwt | JWT.JwtPayload,
JWT.VerifyErrors | Error, JWT.VerifyErrors | Error,
never never
>, >
}>() {} }
const importJWT = Effect.tryPromise({ const importJWT = Effect.tryPromise({