thaliproject / postcardapp

A sample app to demonstrate how to build Thali applications
MIT License
22 stars 5 forks source link

URL safe device identity uses dash delimiter #114

Closed deadlyfingers closed 8 years ago

deadlyfingers commented 8 years ago

There seems to be a '-' in the (URL safe) Device Identity which can cause issues as I use this as a PouchDB Id delimiter.

Possible fixes:

NB: using '.' as url safe character might cause issues if it produces two consecutive dots in the URL.

deadlyfingers commented 8 years ago

Updated encode method:

var URLSafeBase64 = {
  encode: function(string) {
    return encodeURIComponent(btoa(string).replace(/=+$/, ''));
  },
  decode: function(base64) {
    return atob(decodeURIComponent(base64));
  }
};