openvibers/openvibe.live Commits
Internal-key retirement (WS-B task 3, C-54): the URL-registry refresh and the chat server's anon resolution ask Network with a service token (identity.subject.resolve), the key only as the fallback when no token can be had — they were the last two Live calls still sending X-Internal-Key
Changes
@@@ -164,11 +164,12 @@ class ChatServer {const promise = (async () => {try {++ const auth = await require('../net/network-principal').headersFor('/internal/resolve-anon');const res = await fetch(`${this._openvibeToolsUrl}/internal/resolve-anon`, {method: 'POST',headers: {'Content-Type': 'application/json',-- 'X-Internal-Key': this._internalKey,++ ...auth,},body: JSON.stringify({ ip }),});@@@ -289,17 +289,19 @@ const initialRegistry = resolveRegistryValues(process.env, {}, {}, URL_DEFINITIOconst config = buildConfig(initialRegistry);async function refreshRegistry() {-- if (!config.openvibeToolsInternalUrl || !config.internalApiKey) {-- console.warn('[Config] Skipping registry refresh: missing internal URL or internal API key');++ if (!config.openvibeToolsInternalUrl || (!config.internalApiKey && !process.env.OV_OAUTH_CLIENT_SECRET)) {++ console.warn('[Config] Skipping registry refresh: missing internal URL, or neither a service identity nor an internal API key');return config;}try {const url = `${config.openvibeToolsInternalUrl.replace(/\/$/, '')}/internal/url-registry/resolved`;++ // A service token (identity.subject.resolve) where one can be had; the key only as its fallback.++ const auth = await require('./net/network-principal').headersFor('/internal/url-registry/resolved');const res = await fetch(url, {method: 'GET',headers: {-- 'X-Internal-Key': config.internalApiKey,++ ...auth,'Accept': 'application/json',},// Without a deadline this call can hang, and it runs during startup — an unreachable@@@ -20,7 +20,9 @@ const PAUSE_MS = 5 * 60 * 1000;// Network routes that accept a service token (OpenVibe.Network server/internal/routes.js TOKEN_ROUTES).const TOKEN_PATHS = new Set(['/internal/coins/credit', '/internal/coins/debit', '/internal/coins/transfer', '/internal/notifications/push', '/internal/notifications/push-bulk', '/internal/events/stream-live',// Network accepts a service token on these since 2026-09-24 (identity.subject.resolve / network.coins.credit).-- '/internal/link-account', '/internal/identity/legacy-map', '/internal/identity/resolve-batch', '/internal/coins/stats', '/internal/resolve-anon']);++ '/internal/link-account', '/internal/identity/legacy-map', '/internal/identity/resolve-batch', '/internal/coins/stats', '/internal/resolve-anon',++ // identity.subject.resolve, which Network already guards it with (WS-B task 3, C-54).++ '/internal/url-registry/resolved']);const _clients = new Map();/** One cached client-credentials token client per audience (openvibe.network, openvibe.community, ...). */
@@ -164,11 +164,12 @@ class ChatServer {
@@ -164,11 +164,12 @@ class ChatServer {
const promise = (async () => {
const promise = (async () => {
try {
try {
+ const auth = await require('../net/network-principal').headersFor('/internal/resolve-anon');
const res = await fetch(`${this._openvibeToolsUrl}/internal/resolve-anon`, {
const res = await fetch(`${this._openvibeToolsUrl}/internal/resolve-anon`, {
method: 'POST',
method: 'POST',
headers: {
headers: {
'Content-Type': 'application/json',
'Content-Type': 'application/json',
- 'X-Internal-Key': this._internalKey,
+ ...auth,
},
},
body: JSON.stringify({ ip }),
body: JSON.stringify({ ip }),
});
});
@@ -289,17 +289,19 @@ const initialRegistry = resolveRegistryValues(process.env, {}, {}, URL_DEFINITIO
@@ -289,17 +289,19 @@ const initialRegistry = resolveRegistryValues(process.env, {}, {}, URL_DEFINITIO
const config = buildConfig(initialRegistry);
const config = buildConfig(initialRegistry);
async function refreshRegistry() {
async function refreshRegistry() {
- if (!config.openvibeToolsInternalUrl || !config.internalApiKey) {
- console.warn('[Config] Skipping registry refresh: missing internal URL or internal API key');
+ if (!config.openvibeToolsInternalUrl || (!config.internalApiKey && !process.env.OV_OAUTH_CLIENT_SECRET)) {
+ console.warn('[Config] Skipping registry refresh: missing internal URL, or neither a service identity nor an internal API key');
return config;
return config;
}
}
try {
try {
const url = `${config.openvibeToolsInternalUrl.replace(/\/$/, '')}/internal/url-registry/resolved`;
const url = `${config.openvibeToolsInternalUrl.replace(/\/$/, '')}/internal/url-registry/resolved`;
+ // A service token (identity.subject.resolve) where one can be had; the key only as its fallback.
+ const auth = await require('./net/network-principal').headersFor('/internal/url-registry/resolved');
const res = await fetch(url, {
const res = await fetch(url, {
method: 'GET',
method: 'GET',
headers: {
headers: {
- 'X-Internal-Key': config.internalApiKey,
+ ...auth,
'Accept': 'application/json',
'Accept': 'application/json',
},
},
// Without a deadline this call can hang, and it runs during startup — an unreachable
// Without a deadline this call can hang, and it runs during startup — an unreachable
@@ -20,7 +20,9 @@ const PAUSE_MS = 5 * 60 * 1000;
@@ -20,7 +20,9 @@ const PAUSE_MS = 5 * 60 * 1000;
// Network routes that accept a service token (OpenVibe.Network server/internal/routes.js TOKEN_ROUTES).
// Network routes that accept a service token (OpenVibe.Network server/internal/routes.js TOKEN_ROUTES).
const TOKEN_PATHS = new Set(['/internal/coins/credit', '/internal/coins/debit', '/internal/coins/transfer', '/internal/notifications/push', '/internal/notifications/push-bulk', '/internal/events/stream-live',
const TOKEN_PATHS = new Set(['/internal/coins/credit', '/internal/coins/debit', '/internal/coins/transfer', '/internal/notifications/push', '/internal/notifications/push-bulk', '/internal/events/stream-live',
// Network accepts a service token on these since 2026-09-24 (identity.subject.resolve / network.coins.credit).
// Network accepts a service token on these since 2026-09-24 (identity.subject.resolve / network.coins.credit).
- '/internal/link-account', '/internal/identity/legacy-map', '/internal/identity/resolve-batch', '/internal/coins/stats', '/internal/resolve-anon']);
+ '/internal/link-account', '/internal/identity/legacy-map', '/internal/identity/resolve-batch', '/internal/coins/stats', '/internal/resolve-anon',
+ // identity.subject.resolve, which Network already guards it with (WS-B task 3, C-54).
+ '/internal/url-registry/resolved']);
const _clients = new Map();
const _clients = new Map();
/** One cached client-credentials token client per audience (openvibe.network, openvibe.community, ...). */
/** One cached client-credentials token client per audience (openvibe.network, openvibe.community, ...). */