mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-25 04:59:33 +00:00
12 lines
300 B
Swift
12 lines
300 B
Swift
import Foundation
|
|
|
|
func secRandom(count: Int) -> Data? {
|
|
var bytes = [Int8](repeating: 0, count: count)
|
|
let status = SecRandomCopyBytes(kSecRandomDefault, bytes.count, &bytes)
|
|
|
|
if status == errSecSuccess {
|
|
return Data(bytes: bytes, count: bytes.count)
|
|
}
|
|
|
|
return nil
|
|
}
|