I hereby claim:
- I am garrigotti on github.
- I am garrigotti (https://keybase.io/garrigotti) on keybase.
- I have a public key ASAMVlNoKXAuKMWCXN3gZmyxLBF0hqVcfSEV-Z8RfgPY8go
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
public TokenRecord GenerateToken(string url, string user, string key) | |
{ | |
var expiration = (long)DateTime.UtcNow.AddMinutes(30).Subtract(DateTime.UnixEpoch).TotalSeconds; | |
var endpoint = HttpUtility.UrlEncode(url); | |
using var hash = new HMACSHA256(Encoding.UTF8.GetBytes(key)); | |
var signature = HttpUtility.UrlEncode(Convert.ToBase64String(hash.ComputeHash(Encoding.UTF8.GetBytes($"{endpoint}\n{expiration}")))); | |
hash.Dispose(); | |
return new TokenRecord($"SharedAccessSignature sr={endpoint}&sig={signature}&se={expiration}&skn={user}", DateTime.UnixEpoch.AddSeconds(expiration)); |