Chip-based quantum key distribution