You'll have to reach a certain point with your curse, talk to a cleric in a safe room and see an ending to get the code.
Thanks, I was spinning on this one trying to figure it out.