@1auth/authn-access-token
Advanced tools
Comparing version 0.0.0-alpha.18 to 0.0.0-alpha.19
@@ -18,7 +18,7 @@ import { accessToken, createDigest } from '@1auth/crypto' | ||
export const exists = async (secret) => { | ||
return options.store.exists(options.table, { | ||
id: await __id(secret) | ||
}) | ||
const digest = await createDigest(secret) | ||
return options.store.exists(options.table, { digest }) | ||
} | ||
// authenticate(accessToken, accessToken) | ||
export const authenticate = async (username, secret) => { | ||
@@ -31,7 +31,7 @@ const { sub } = await authnVerifyAuthentication(username, secret, options) | ||
const secret = options.prefix + '-' + (await options.secret.create()) | ||
const id = await __id(secret) | ||
const now = nowInSeconds() | ||
const digest = await createDigest(secret) | ||
await authnCreate( | ||
options.secret.type, | ||
{ id, sub, name, value: secret, verify: now, expire: now + expire }, | ||
{ sub, name, value: secret, digest, verify: now, expire: now + expire }, | ||
options | ||
@@ -55,6 +55,2 @@ ) | ||
const __id = async (secret) => { | ||
return createDigest(secret).then((digest) => digest.split(':')[1]) | ||
} | ||
const nowInSeconds = () => Math.floor(Date.now() / 1000) |
14
index.js
@@ -18,7 +18,7 @@ import { accessToken, createDigest } from '@1auth/crypto' | ||
export const exists = async (secret) => { | ||
return options.store.exists(options.table, { | ||
id: await __id(secret) | ||
}) | ||
const digest = await createDigest(secret) | ||
return options.store.exists(options.table, { digest }) | ||
} | ||
// authenticate(accessToken, accessToken) | ||
export const authenticate = async (username, secret) => { | ||
@@ -31,7 +31,7 @@ const { sub } = await authnVerifyAuthentication(username, secret, options) | ||
const secret = options.prefix + '-' + (await options.secret.create()) | ||
const id = await __id(secret) | ||
const now = nowInSeconds() | ||
const digest = await createDigest(secret) | ||
await authnCreate( | ||
options.secret.type, | ||
{ id, sub, name, value: secret, verify: now, expire: now + expire }, | ||
{ sub, name, value: secret, digest, verify: now, expire: now + expire }, | ||
options | ||
@@ -55,6 +55,2 @@ ) | ||
const __id = async (secret) => { | ||
return createDigest(secret).then((digest) => digest.split(':')[1]) | ||
} | ||
const nowInSeconds = () => Math.floor(Date.now() / 1000) |
{ | ||
"name": "@1auth/authn-access-token", | ||
"version": "0.0.0-alpha.18", | ||
"version": "0.0.0-alpha.19", | ||
"description": "", | ||
@@ -51,7 +51,7 @@ "type": "module", | ||
"homepage": "https://github.com/willfarrell/1auth", | ||
"gitHead": "bc6f992eee0f1c02ccd29e050bb8179f546aef87", | ||
"gitHead": "64ff0102cc1360d4b208360a074fd25483fb8b79", | ||
"dependencies": { | ||
"@1auth/authn": "0.0.0-alpha.18", | ||
"@1auth/crypto": "0.0.0-alpha.18" | ||
"@1auth/authn": "0.0.0-alpha.19", | ||
"@1auth/crypto": "0.0.0-alpha.19" | ||
} | ||
} |
5367
92
+ Added@1auth/authn@0.0.0-alpha.19(transitive)
+ Added@1auth/crypto@0.0.0-alpha.19(transitive)
- Removed@1auth/authn@0.0.0-alpha.18(transitive)
- Removed@1auth/crypto@0.0.0-alpha.18(transitive)
Updated@1auth/authn@0.0.0-alpha.19
Updated@1auth/crypto@0.0.0-alpha.19