Add url safe base64 encoding

BC safe with fallback to the old way of encoding
actually i just understood that this test is wrong :) will fix it