Add an event and its corresponding key to the store.

def add_event(self, key, event):
        """Add an event and its corresponding key to the store."""
        assert isinstance(key, str)
        assert isinstance(event, bytes)
        if all([char.isalnum() or char == '-' for char in key]):
            safe_key = key
        else:
            raise ValueError("Key must be alphanumeric or a dash (-):"
                             " {0}".format(key))
        safe_event = base64.encodestring(event).decode().strip()
        data = "{0}\t{1}\n".format(safe_key, safe_event)

        # Important to make a single atomic write here
        self._hasher.update(data.encode())
        self.f.write(data)