Ejemplo n.º 1
0
        /// <summary>
        /// Checks whether a given authentication key is valid or not.
        /// </summary>
        /// <param name="authKey">The authentication key in string form to check.</param>
        /// <returns>True if the given authentication key is valid, false otherwise.</returns>
        public static bool IsValidAuthKey(string authKey)
        {
            if (authKey == null)
            {
                return(false);
            }

            if (authKey.Length != AuthKeyLength)
            {
                return(false);
            }

            foreach (var authKeyChar in authKey.ToCharArray())
            {
                if (!AuthKeyLookup.ContainsFirst(authKeyChar))
                {
                    return(false);
                }
            }

            return(true);
        }