Files
peardata/server/core/auth-keys.js
T
Raven Scott 015d92a257
Release rolling / release (push) Has been cancelled
CI / test (push) Has been cancelled
first commit
2026-07-18 16:17:38 -04:00

31 lines
650 B
JavaScript

/**
* Server MAC key derived from SERVER_SEED for capabilities + admin proofs.
*/
import { deriveMacKey } from '../../shared/crypto-auth.js'
let macKey = null
let serverPublicKeyHex = null
let seedHex = null
/**
* @param {{ seedHex: string, publicKeyHex: string }} opts
*/
export function initAuthKeys(opts) {
seedHex = opts.seedHex
serverPublicKeyHex = opts.publicKeyHex
macKey = deriveMacKey(seedHex)
}
export function getMacKey() {
if (!macKey) throw new Error('Auth keys not initialized')
return macKey
}
export function getServerPublicKeyHex() {
return serverPublicKeyHex
}
export function getSeedHex() {
return seedHex
}