public string Get(long userId)
        {
            var now = DateTime.UtcNow;
            var timestamp = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);

            var signature = new SignatureBuilder()
                .Append(userId)
                .Append(_applicationSettings.AppId)
                .Append(timestamp)
                .Append(_applicationSettings.AppSecret)
                .Create();

            return _authApi.GetOfflineToken(userId, _applicationSettings.AppId, timestamp, signature);
        }
Beispiel #2
0
        public static SignatureBuilder Append(this SignatureBuilder builder, DateTime val)
        {
            var bytes = BitConverter.GetBytes(val.ToUnixTime());

            return(builder.Append(bytes));
        }
Beispiel #3
0
        public static SignatureBuilder Append(this SignatureBuilder builder, string val)
        {
            var bytes = Encoding.UTF8.GetBytes(val);

            return(builder.Append(bytes));
        }
Beispiel #4
0
        public static SignatureBuilder Append(this SignatureBuilder builder, long val)
        {
            var bytes = BitConverter.GetBytes(val);

            return(builder.Append(bytes));
        }