mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
no message
This commit is contained in:
parent
d3a85be396
commit
00a69da9a3
@ -358,23 +358,17 @@ public final class Postbox<State: PostboxState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func keychainEntryForKey(key: String) -> Signal<ReadBuffer?, NoError> {
|
public func keychainEntryForKey(key: String) -> NSData? {
|
||||||
return Signal { subscriber in
|
var result: NSData?
|
||||||
self.queue.dispatch {
|
self.queue.sync {
|
||||||
let blob = Blob(data: key.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)!)
|
let blob = Blob(data: key.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)!)
|
||||||
var buffer: ReadBuffer?
|
var buffer: ReadBuffer?
|
||||||
for row in self.database.prepareCached("SELECT data FROM keychain WHERE key = ?").run(blob) {
|
for row in self.database.prepareCached("SELECT data FROM keychain WHERE key = ?").run(blob) {
|
||||||
let data = (row[0] as! Blob).data
|
result = (row[0] as! Blob).data
|
||||||
let memory = malloc(data.length)
|
|
||||||
memcpy(memory, data.bytes, data.length)
|
|
||||||
buffer = ReadBuffer(memory: UnsafeMutablePointer(memory), length: data.length, freeWhenDone: true)
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
subscriber.putNext(buffer)
|
|
||||||
subscriber.putCompletion()
|
|
||||||
}
|
|
||||||
return EmptyDisposable
|
|
||||||
}
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setKeychainEntry(key: String, value: NSData) {
|
public func setKeychainEntry(key: String, value: NSData) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user