@@ -448,7 +448,7 @@ func hex_encode(_ data: Data) -> String {
|
|||||||
func random_bytes(count: Int) -> Data {
|
func random_bytes(count: Int) -> Data {
|
||||||
var data = Data(count: count)
|
var data = Data(count: count)
|
||||||
_ = data.withUnsafeMutableBytes { mutableBytes in
|
_ = data.withUnsafeMutableBytes { mutableBytes in
|
||||||
SecRandomCopyBytes(kSecRandomDefault, count, mutableBytes)
|
SecRandomCopyBytes(kSecRandomDefault, count, mutableBytes.baseAddress!)
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ class damusTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testRandomBytes() {
|
||||||
|
let bytes = random_bytes(count: 32)
|
||||||
|
|
||||||
|
print("testRandomBytes \(hex_encode(bytes))")
|
||||||
|
XCTAssertEqual(bytes.count, 32)
|
||||||
|
}
|
||||||
|
|
||||||
func testParseMentionWithMarkdown() {
|
func testParseMentionWithMarkdown() {
|
||||||
let md = """
|
let md = """
|
||||||
Testing markdown in damus
|
Testing markdown in damus
|
||||||
|
|||||||
Reference in New Issue
Block a user