Skip to content

Commit

Permalink
Removed adding the prefix 'key-' if not there
Browse files Browse the repository at this point in the history
There exist API keys without the leading 'key-' characters
  • Loading branch information
Florian Weich authored May 30, 2018
1 parent d10e245 commit 486646c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Sources/Mailgun/Mailgun.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ public struct Mailgun: MailgunProvider {

fileprivate extension Mailgun {
func encode(apiKey: String) throws -> String {
let key = apiKey.contains("key-") ? apiKey : "key-\(apiKey)"
guard let apiKeyData = "api:\(key)".data(using: .utf8) else {
guard let apiKeyData = "api:\(apiKey)".data(using: .utf8) else {
throw MailgunError.encodingProblem
}
let authKey = apiKeyData.base64EncodedData()
Expand Down

0 comments on commit 486646c

Please sign in to comment.