namespace NewRock.Sdk.Security
{
    public static class AuthorizeExtensions
    {
        /// <summary>
        /// 是否通过验证
        /// </summary>
        /// <param name="authorize"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static bool IsAuthorized(this NewRockAuthorize authorize, string key)
            => string.CompareOrdinal(authorize.Signature,
                Encryptor.Signature(key, authorize.Nonce, authorize.Timestamp)) == 0;
    }
}
