This is not only theoretical, the German ID card ("elektronischer Personalausweis") can do exactly this.