mirror of
https://github.com/tiennm99/llmapikey.git
synced 2026-08-08 18:21:55 +00:00
Reconcile filtered app keys by the old "llmapikey:" prefix while mint now names them "llmapikey/gh-<id>", so orphan/cost-leak detection silently missed every new key. Centralize the prefix in lib/keys/key-name.js (KEY_NAME_PREFIX + keyName) and use it in both mint and reconcile so they can't drift.
22 lines
719 B
JavaScript
22 lines
719 B
JavaScript
/**
|
|
* Single source of truth for the OpenRouter key `name` this app mints. Used by
|
|
* the mint path (to set the name) and the reconcile script (to recognize app
|
|
* keys). Keep both sides on this constant so they can never drift apart.
|
|
*
|
|
* The name is opaque and non-PII: a fixed prefix + the numeric, immutable GitHub
|
|
* id (never the mutable login).
|
|
*/
|
|
|
|
/** Prefix on every key this app mints. Reconcile matches app keys by this. */
|
|
export const KEY_NAME_PREFIX = "llmapikey/gh-";
|
|
|
|
/**
|
|
* Build the OpenRouter key name for a GitHub user.
|
|
*
|
|
* @param {string} githubUserId numeric GitHub provider_id
|
|
* @returns {string}
|
|
*/
|
|
export function keyName(githubUserId) {
|
|
return `${KEY_NAME_PREFIX}${githubUserId}`;
|
|
}
|