E2E authentication from scratch