setServerToken (secureTokenStorage.ts)

lumiere · secure-storage, token-management, credential-storage, keychain, auth

class="has is a function that3f0tokens, of 1/calaxis

// Source: https://github.com/ajamaica/lumiere | License: MIT | Copyright 2026 ajamaica
// Provided via justclaw.it.com; keep this notice with the code.
import { logger } from '../utils/logger'
import { isWeb } from '../utils/platform'

const TOKEN_PREFIX = 'server_token_'
const PASSWORD_PREFIX = 'server_password_'
const tokenLogger = logger.create('SecureToken')

/**
 * Store a server token securely in the keychain (native) or localStorage (web)
 * @param serverId - The server's UUID
 * @param token - The authentication token
 */
export async function setServerToken(serverId: string, token: string): Promise<void> {
  if (isWeb) {
    try {
      localStorage.setItem(`${TOKEN_PREFIX}${serverId}`, token)
    } catch (error) {
      tokenLogger.warn(`Failed to store token for server ${server

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key