|
25 | 25 | [(str path ".gpg") path])) |
26 | 26 | files))) |
27 | 27 |
|
28 | | -(defn- file-exists? |
| 28 | +(defn ^:private file-exists? |
29 | 29 | "Checks if a file exists and is readable." |
30 | 30 | [^String path] |
31 | 31 | (let [file (io/file path)] |
32 | 32 | (and (.exists file) |
33 | 33 | (.isFile file) |
34 | 34 | (.canRead file)))) |
35 | 35 |
|
36 | | -(defn- validate-permissions |
| 36 | +(defn ^:private validate-permissions |
37 | 37 | "Checks if file has secure permissions (Unix only). |
38 | 38 | Returns true if secure, false otherwise. |
39 | 39 | Logs warning if permissions are too open." |
|
66 | 66 | ;; Cache for GPG decryption results (5-second TTL) |
67 | 67 | (def ^:private gpg-cache (atom {})) |
68 | 68 |
|
69 | | -(defn- gpg-cache-key |
| 69 | +(defn ^:private gpg-cache-key |
70 | 70 | "Generates cache key for a file path and modification time." |
71 | 71 | [^File file] |
72 | 72 | (str (.getPath file) ":" (.lastModified file))) |
73 | 73 |
|
74 | | -(defn- get-cached-gpg |
| 74 | +(defn ^:private get-cached-gpg |
75 | 75 | "Gets cached GPG decryption result if still valid." |
76 | 76 | [cache-key] |
77 | 77 | (when-let [{:keys [content timestamp]} (@gpg-cache cache-key)] |
78 | 78 | (when (< (- (System/currentTimeMillis) timestamp) 5000) ; 5-second TTL |
79 | 79 | (logger/debug logger-tag "GPG cache hit for" cache-key) |
80 | 80 | content))) |
81 | 81 |
|
82 | | -(defn- cache-gpg-result! |
| 82 | +(defn ^:private cache-gpg-result! |
83 | 83 | "Caches GPG decryption result with timestamp." |
84 | 84 | [cache-key content] |
85 | 85 | (swap! gpg-cache assoc cache-key {:content content |
|
124 | 124 | (logger/warn logger-tag "GPG command failed for" file-path ":" (.getMessage e)) |
125 | 125 | nil))) |
126 | 126 |
|
127 | | -(defn- load-credentials-from-file |
| 127 | +(defn ^:private load-credentials-from-file |
128 | 128 | "Loads and parses credentials from a file. |
129 | 129 | Returns vector of credential maps or nil on error." |
130 | 130 | [^String file-path] |
|
162 | 162 | (logger/warn logger-tag "Failed to load credentials from" file-path ":" (.getMessage e)) |
163 | 163 | nil))) |
164 | 164 |
|
165 | | -(defn- load-all-credentials |
| 165 | +(defn ^:private load-all-credentials |
166 | 166 | "Loads credentials from all available credential files. |
167 | 167 | Returns vector of all credential maps from all files, in priority order." |
168 | 168 | [] |
|
186 | 186 | :login login-part |
187 | 187 | :port port}))) |
188 | 188 |
|
189 | | -(defn- match-credential |
| 189 | +(defn ^:private match-credential |
190 | 190 | "Matches a credential entry against parsed keyRc spec. |
191 | 191 | Returns true if the credential matches the spec." |
192 | 192 | [credential {:keys [machine login port]}] |
|
0 commit comments