getAuthorization function
Returns SAPISIDHASH
value based on headers and current time.
auth
SAPISID
and origin value from headers concatenated with space.
Implementation
String getAuthorization(String auth) {
final unixTimestamp =
(DateTime.now().millisecondsSinceEpoch ~/ 1000).toString();
final bytes = utf8.encode('$unixTimestamp $auth');
final hash = sha1.convert(bytes).toString();
return 'SAPISIDHASH ${unixTimestamp}_$hash';
}