aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/Extensions/String+Base64.swift
blob: ae70010dc2952aa69e9e26027953970980ddeffb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//
//  Copyright © 2018 WireGuard LLC. All rights reserved.
//

import Foundation

extension String {

    func isBase64() -> Bool {
        let base64Predicate = NSPredicate(format: "SELF MATCHES %@", "^[a-zA-Z0-9+/]{43}=$")
        return base64Predicate.evaluate(with: self)
    }

}