Adds credential construction function.

Closes #5.