Skip to content

Black Friday

Annual Pro is $90 for the first year, normally $120. Or start monthly at $6 for two months, then $12.

Ends Dec 4, 11:59 PM PT.

Create an account
← Public packages

@danj/audible-auth

Locked Audible gateway using one owner-provisioned Kody login.

FollowFork

Files

status.ts

20 lines · 735 B · TypeScript
import { ARCHIVE_ENABLED } from '../src/config.ts'
import { resolveLocale } from '../src/locales.ts'
import { loadAccount } from './state.ts'

export default async function authStatus() {
	const account = await loadAccount()
	return {
		ok: true as const,
		connected: Boolean(account),
		ready: Boolean(account),
		locale: account ? resolveLocale(account.locale).countryCode : null,
		deviceName: account ? 'Fake device (mock)' : null,
		connectedAt: account?.connectedAt ?? null,
		setupState: account ? 'ready' : 'setup-needed',
		workingSince: account?.connectedAt ?? null,
		nextAllowedAt: null, waitReason: null, reconnectNeeded: false, deleteLoginOnWebsite: false,
		archiveEnabled: ARCHIVE_ENABLED,
		archiveReady: false,
	}
}