elysia-auth-drizzle
Advanced tools
Comparing version 1.2.10 to 1.2.11
@@ -38,7 +38,6 @@ import * as Elysia from 'elysia'; | ||
tokensSchema?: any; | ||
}) => (refreshToken: string, { secret, refreshSecret, accessTokenTime, ownerId, }: { | ||
}) => (refreshToken: string, { secret, refreshSecret, accessTokenTime, }: { | ||
secret: string; | ||
refreshSecret?: string | undefined; | ||
accessTokenTime: string; | ||
ownerId?: string | undefined; | ||
}) => Promise<{ | ||
@@ -45,0 +44,0 @@ accessToken: string; |
@@ -831,7 +831,7 @@ 'use strict'; | ||
refreshSecret, | ||
accessTokenTime, | ||
ownerId | ||
accessTokenTime | ||
}) => { | ||
let content; | ||
try { | ||
jsonwebtoken.verify(refreshToken, refreshSecret || secret); | ||
content = jsonwebtoken.verify(refreshToken, refreshSecret || secret); | ||
} catch (error) { | ||
@@ -856,3 +856,3 @@ if (tokensSchema) { | ||
} | ||
const accessToken = jsonwebtoken.sign({ id: token?.ownerId || ownerId }, secret, { | ||
const accessToken = jsonwebtoken.sign({ id: token?.ownerId || content?.id }, secret, { | ||
expiresIn: accessTokenTime | ||
@@ -859,0 +859,0 @@ }); |
{ | ||
"name": "elysia-auth-drizzle", | ||
"version": "1.2.10", | ||
"version": "1.2.11", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
@@ -115,3 +115,2 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
accessTokenTime, | ||
ownerId, | ||
}: { | ||
@@ -121,7 +120,9 @@ secret: string; | ||
accessTokenTime: string; | ||
ownerId?: string; | ||
}, | ||
) => { | ||
let content; | ||
try { | ||
verify(refreshToken, refreshSecret || secret); | ||
content = verify(refreshToken, refreshSecret || secret) as { | ||
id: string; | ||
}; | ||
} catch (error) { | ||
@@ -159,3 +160,3 @@ if (tokensSchema) { | ||
// Renew Token | ||
const accessToken = sign({ id: token?.ownerId || ownerId }, secret, { | ||
const accessToken = sign({ id: token?.ownerId || content?.id }, secret, { | ||
expiresIn: accessTokenTime, | ||
@@ -162,0 +163,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
72645