MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / _save_api_key_to_file

Method _save_api_key_to_file

codewiki/cli/config_manager.py:77–86  ·  view source on GitHub ↗

Save API key to fallback credentials file (plaintext).

(self, api_key: str)

Source from the content-addressed store, hash-verified

75 return None
76
77 def _save_api_key_to_file(self, api_key: str):
78 """Save API key to fallback credentials file (plaintext)."""
79 ensure_directory(CONFIG_DIR)
80 data = {"api_key": api_key}
81 safe_write(CREDENTIALS_FILE, json.dumps(data, indent=2))
82 # Restrict file permissions (owner read/write only)
83 try:
84 CREDENTIALS_FILE.chmod(0o600)
85 except OSError:
86 pass
87
88 def load(self) -> bool:
89 """

Callers 1

saveMethod · 0.95

Calls 2

ensure_directoryFunction · 0.90
safe_writeFunction · 0.90

Tested by

no test coverage detected