MCPcopy Create free account
hub / github.com/EvoMap/evolver / _dropLocalSecret

Method _dropLocalSecret

src/proxy/lifecycle/manager.js:1044–1077  ·  view source on GitHub ↗

* Drop the cached node_secret in MailboxStore AND signal the env-var path to * skip its value for this process lifetime. Used when the hub explicitly * disowns our claim. * @param {string} reason - log tag describing why we are dropping it.

(reason)

Source from the content-addressed store, hash-verified

1042 * @param {string} reason - log tag describing why we are dropping it.
1043 */
1044 _dropLocalSecret(reason) {
1045 this.logger.warn(`[lifecycle] dropping cached node_secret (reason=${reason}); next hello will run unauthenticated`);
1046 const diskRotated = this._latestDiskHubRotatedSecret();
1047 const storeSecret = this.store.getState('node_secret') || null;
1048 if (diskRotated && diskRotated.secret !== storeSecret) {
1049 try {
1050 this._setNodeSecretState({
1051 secret: diskRotated.secret,
1052 version: diskRotated.version ? String(diskRotated.version) : '',
1053 source: 'hub_rotate',
1054 envSuppressed: this.store.getState('node_secret_env_suppressed') || '',
1055 });
1056 this.logger.warn('[lifecycle] local in-memory node_secret is stale; preserving newer disk hub-rotated secret');
1057 return;
1058 } catch (err) {
1059 const reason = err && (err.code || err.name) ? (err.code || err.name) : 'error';
1060 this.logger.warn(`[lifecycle] failed to sync newer disk hub-rotated node_secret into memory (reason=${reason})`);
1061 }
1062 }
1063 try {
1064 this._setNodeSecretState({
1065 secret: '',
1066 version: '',
1067 source: '',
1068 envSuppressed: this.store.getState('node_secret_env_suppressed') || '',
1069 });
1070 } catch (err) {
1071 const reason = err && (err.code || err.name || err.message) ? (err.code || err.name || err.message) : 'error';
1072 this.logger.warn(`[lifecycle] failed to clear local node_secret state (reason=${reason})`);
1073 }
1074 // Suppress only the exact env secret that was just proven stale. If no
1075 // env secret is present, do not leave a marker that blocks a future reset.
1076 this._markCurrentEnvSecretSuppressed();
1077 }
1078
1079 _emitManualResetNeeded() {
1080 try {

Callers 2

reAuthenticateMethod · 0.95

Calls 4

_setNodeSecretStateMethod · 0.95
getStateMethod · 0.80

Tested by

no test coverage detected