18 lines
464 B
Swift
18 lines
464 B
Swift
//
|
|
// Copyright 2020-2024 New Vector Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
// Please see LICENSE in the repository root for full details.
|
|
//
|
|
|
|
import Foundation
|
|
import SwiftBase32
|
|
|
|
final class Base32Coder {
|
|
|
|
static func encodedString(_ string: String, padding: Bool = true) -> String {
|
|
let encodedString = string.base32EncodedString
|
|
return padding ? encodedString : encodedString.replacingOccurrences(of: "=", with: "")
|
|
}
|
|
}
|