maxep il y a 5 ans
Parent
commit
fa1f12647d
2 fichiers modifiés avec 12 ajouts et 11 suppressions
  1. 3 2
      Sources/KDB/Entry.swift
  2. 9 9
      Sources/KeePass/KDBX.swift

+ 3 - 2
Sources/KDB/Entry.swift

@@ -21,6 +21,8 @@ import Foundation
 
 public final class Entry: Row, Streamable {
 
+    public typealias Property = TLV<Column, UInt32>
+
     public enum Column: UInt16, Streamable, Endable {
         case reserved = 0x0000
         case uuid = 0x0001
@@ -44,7 +46,7 @@ public final class Entry: Row, Streamable {
 
     public internal(set) weak var parent: Group?
 
-    public var properties: [TLV<Column, UInt32>]
+    public var properties: [Property]
 
     public init() {
         properties = []
@@ -72,6 +74,5 @@ extension Entry: Hashable {
 
     public func hash(into hasher: inout Hasher) {
         hasher.combine(self[.uuid])
-        hasher.combine(self[.title])
     }
 }

+ 9 - 9
Sources/KeePass/KDBX.swift

@@ -58,7 +58,7 @@ extension Field {
 
 extension XML.Element: Entry {
 
-    public var times: Timestamp { Times }
+    public var times: Timestamp { self.Times }
 
     public var fields: [Field] {
         allDescendants(where: { $0.name == "String" }).compactMap { Field($0) }
@@ -74,27 +74,27 @@ extension XML.Element: Entry {
 extension XML.Element: Timestamp {
 
     public var creationDate: Date {
-        CreationTime.date(formatter: DateFormatter) ?? .distantPast
+        self.CreationTime.date(formatter: DateFormatter) ?? .distantPast
     }
 
     public var lastModifiedDate: Date {
-        get { LastModificationTime.date(formatter: DateFormatter) ?? .distantPast }
-        set { LastModificationTime.value = DateFormatter.string(from: newValue) }
+        get { self.LastModificationTime.date(formatter: DateFormatter) ?? .distantPast }
+        set { self.LastModificationTime.value = DateFormatter.string(from: newValue) }
     }
 
     public var lastAccessDate: Date {
-        get { LastAccessTime.date(formatter: DateFormatter) ?? .distantPast }
-        set { LastAccessTime.value = DateFormatter.string(from: newValue) }
+        get { self.LastAccessTime.date(formatter: DateFormatter) ?? .distantPast }
+        set { self.LastAccessTime.value = DateFormatter.string(from: newValue) }
     }
 
     public var expirationDate: Date? {
-        get { ExpiryTime.date(formatter: DateFormatter) }
+        get { self.ExpiryTime.date(formatter: DateFormatter) }
         set {
             if let value = newValue {
-                ExpiryTime.value = DateFormatter.string(from: value)
+                self.ExpiryTime.value = DateFormatter.string(from: value)
                 addChild(name: "Expires", value: "True")
             } else {
-                ExpiryTime.value = DateFormatter.string(from: Date.distantFuture)
+                self.ExpiryTime.value = DateFormatter.string(from: Date.distantFuture)
                 addChild(name: "Expires", value: "False")
             }
         }