better walletIds storage

Closes #2190 

Adds tests to Identity.