Exemplo n.º 1
0
        /// <summary>
        /// Initialized a new instance of AuthOptions by populating the KeyId and KeyValue properties from the full Key
        /// </summary>
        /// <param name="key">Full ably key string</param>
        public AuthOptions(string key)
            : this()
        {
            var apiKey = ApiKey.Parse(key);

            Key = apiKey.ToString();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialized a new instance of AuthOptions by populating the KeyId and KeyValue properties from the full Key.
        /// </summary>
        /// <param name="key">Full ably key string.</param>
        public AuthOptions(string key)
            : this()
        {
            if (key.IsEmpty())
            {
                throw new AblyException(new ErrorInfo("Auth Key cannot be empty", ErrorCodes.UnableToObtainCredentialsFromGivenParameters));
            }

            if (key.Contains(":"))
            {
                var apiKey = ApiKey.Parse(key);

                Key = apiKey.ToString();
            }
            else
            {
                Token = key;
            }
        }
Exemplo n.º 3
0
 internal ApiKey ParseKey()
 {
     return(ApiKey.Parse(Key));
 }