/// <summary> /// Creates EventValidator instance. /// </summary> /// <param name="secret">Secret string.</param> /// <returns>EventValidator instance.</returns> internal static EventValidator Create(string secret) { var validator = new EventValidator(); if (!String.IsNullOrEmpty(secret)) { validator.hmacSha1 = new HMACSHA1(ENCODING.GetBytes(secret)); } return(validator); }
/// <summary> /// Creates Notification info. /// </summary> /// <param name="validator">Event validator.</param> /// <param name="funcAsync">Event async function.</param> public NotificationInfo(EventValidator validator, Func <WebhookEventData, Task> funcAsync) { this.Validator = validator; this.Func = null; this.FuncAsync = funcAsync; }
/// <summary> /// Creates <see cref="EventValidator"/>. /// </summary> /// <returns><see cref="EventValidator"/> instance.</returns> public EventValidator CreateEventValidator() { return(EventValidator.Create(this.Secret)); }
/// <summary> /// Creates Notification info. /// </summary> /// <param name="validator">Event validator.</param> /// <param name="func">Event function.</param> public NotificationInfo(EventValidator validator, Action <WebhookEventData> func) { this.Validator = validator; this.Func = func; this.FuncAsync = null; }