diff --git a/src/style.css b/src/style.css index edb7663..039a379 100644 --- a/src/style.css +++ b/src/style.css @@ -101,4 +101,15 @@ fieldset { label { font-weight: 300; -} \ No newline at end of file +} +.timer { + position: absolute; + width: 24px; + height: 24px; + border-radius: 24px; + padding: 8px 10px; + display: flex; + justify-content: center; + align-items: center; + +} diff --git a/src/token.ts b/src/token.ts index a2ad1eb..e364ba6 100644 --- a/src/token.ts +++ b/src/token.ts @@ -1,8 +1,22 @@ import totp from 'totp-generator' const period = 30 const digits = 6 - +let token = '' export function displayToken(secret) { + async function generateTOTP() { + const token = totp(secret.replaceAll(' ', '').trim(), { + digits, + period, + }) + + const secondsSinceEpoch = Math.ceil(Date.now() / 1000) - 1 + const secondsSinceStart = 0 + (secondsSinceEpoch % period) + const secondsRemaining = period - (secondsSinceEpoch % period) + console.log('this is broken') + setResult(token) + setRunningTime(secondsSinceStart) + setSecondsTillExpiration(secondsRemaining) + } const token = totp(secret.replace(/ /g, '').trim(), { digits, period, diff --git a/src/tokenList.ts b/src/tokenList.ts index 9136b65..98e949f 100644 --- a/src/tokenList.ts +++ b/src/tokenList.ts @@ -4,7 +4,12 @@ import { tokens } from "./tokens"; export function tokenList() { const element = document.createElement("div"); element.classList.add("test"); - return `
`; + const div = document.createElement('div') + div.append('