mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-24 03:46:23 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
27 lines
831 B
Swift
27 lines
831 B
Swift
import Foundation
|
|
|
|
final class KeychainTable: Table {
|
|
static func tableSpec(_ id: Int32) -> ValueBoxTable {
|
|
return ValueBoxTable(id: id, keyType: .binary, compactValuesOnCreation: false)
|
|
}
|
|
|
|
private func key(_ string: String) -> ValueBoxKey {
|
|
return ValueBoxKey(string)
|
|
}
|
|
|
|
func get(_ key: String) -> Data? {
|
|
if let value = self.valueBox.get(self.table, key: self.key(key)) {
|
|
return Data(bytes: value.memory.assumingMemoryBound(to: UInt8.self), count: value.length)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func set(_ key: String, value: Data) {
|
|
self.valueBox.set(self.table, key: self.key(key), value: MemoryBuffer(data: value))
|
|
}
|
|
|
|
func remove(_ key: String) {
|
|
self.valueBox.remove(self.table, key: self.key(key), secure: false)
|
|
}
|
|
}
|