package daemon import ( "crypto/sha256" "io" "os" ) var daemonHash []byte var passphrase string // RCWService provides an RPC method. type RCWService struct{} // GetPass is the RPC method. // For now (as a test/example), it returns "hello" if the input is "hi". func (h *RCWService) GetPass(request string, reply *string) error { *reply = passphrase return nil } // getFileHash returns the SHA256 hash of the file at the given path. func getFileHash(path string) []byte { file, _ := os.Open(path) hash := sha256.New() io.Copy(hash, file) return hash.Sum(nil) } // daemonIsOpen checks if the socket/named pipe for the rcw // daemon exists and returns a boolean indicator. func daemonIsOpen() bool { fileInfo, err := os.Stat(socketPath) if err != nil { return false } return !fileInfo.IsDir() }