Extract BLE and chat architecture policies (#1324)

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
jack
2026-06-02 09:01:59 +02:00
committed by GitHub
co-authored by jack
parent 193cfdc06a
commit 3eb4f2bd72
46 changed files with 3286 additions and 786 deletions
@@ -0,0 +1,30 @@
import Foundation
import Testing
@testable import bitchat
struct Base64URLCodingTests {
@Test
func encodesWithoutPaddingOrURLUnsafeCharacters() {
let encoded = Base64URLCoding.encode(Data([0xff, 0xee, 0xdd, 0xcc]))
#expect(!encoded.contains("="))
#expect(!encoded.contains("+"))
#expect(!encoded.contains("/"))
}
@Test
func decodesUnpaddedValue() throws {
let data = try #require(Base64URLCoding.decode("_-7dzA"))
#expect(data == Data([0xff, 0xee, 0xdd, 0xcc]))
}
@Test
func roundTripsData() throws {
let original = Data("hello bitchat".utf8)
let decoded = try #require(Base64URLCoding.decode(Base64URLCoding.encode(original)))
#expect(decoded == original)
}
}