/*
decodes a sessionId into the metadata that it contains
@param     {string}         sessionId
@returns   {?SessionInfo}    sessionInfo
function decodeSessionId(sessionId) {
  var fields;
  // remove sentinal (e.g. '1_', '2_')
  sessionId = sessionId.substring(2);
  // replace invalid base64 chars
  sessionId = sessionId.replace(/-/g, '+').replace(/_/g, '/');
  // base64 decode
  if (typeof Buffer.from === 'function') {
    sessionId = Buffer.from(sessionId, 'base64').toString('ascii');
  }
  else {
    sessionId = Buffer.from(sessionId, 'base64').toString('ascii');
  }
  // separate fields
  fields = sessionId.split('~');
  return {
    apiKey: fields[1],
    location: fields[2],
    create_time: new Date(fields[3])
  };
}