| 128 | } |
| 129 | |
| 130 | func (w *Watcher) authFileUnchanged(path string) (bool, error) { |
| 131 | data, errRead := os.ReadFile(path) |
| 132 | if errRead != nil { |
| 133 | return false, errRead |
| 134 | } |
| 135 | if len(data) == 0 { |
| 136 | return false, nil |
| 137 | } |
| 138 | sum := sha256.Sum256(data) |
| 139 | curHash := hex.EncodeToString(sum[:]) |
| 140 | |
| 141 | normalized := w.normalizeAuthPath(path) |
| 142 | w.clientsMutex.RLock() |
| 143 | prevHash, ok := w.lastAuthHashes[normalized] |
| 144 | w.clientsMutex.RUnlock() |
| 145 | if ok && prevHash == curHash { |
| 146 | return true, nil |
| 147 | } |
| 148 | return false, nil |
| 149 | } |
| 150 | |
| 151 | func (w *Watcher) isKnownAuthFile(path string) bool { |
| 152 | normalized := w.normalizeAuthPath(path) |