This repository was archived by the owner on Oct 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +181
-4
lines changed
OpenSesame.xcodeproj/project.xcworkspace/xcuserdata/ethan.xcuserdatad
OpenSesameMapping.xcmappingmodel Expand file tree Collapse file tree 7 files changed +181
-4
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" standalone =" yes" ?>
2
+ <model type =" com.apple.IDECoreDataModeler.DataModel" documentVersion =" 1.0" lastSavedToolsVersion =" 19197" systemVersion =" 21A5304g" minimumToolsVersion =" Automatic" sourceLanguage =" Swift" usedWithCloudKit =" YES" userDefinedModelVersionIdentifier =" " >
3
+ <entity name =" Account" representedClassName =" Account" syncable =" YES" codeGenerationType =" class" >
4
+ <attribute name =" dateAdded" optional =" YES" attributeType =" Date" usesScalarValueType =" NO" />
5
+ <attribute name =" domain" attributeType =" String" defaultValueString =" " />
6
+ <attribute name =" isPinned" attributeType =" Boolean" defaultValueString =" NO" usesScalarValueType =" YES" />
7
+ <attribute name =" lastModified" optional =" YES" attributeType =" Date" usesScalarValueType =" NO" />
8
+ <attribute name =" notes" optional =" YES" attributeType =" String" />
9
+ <attribute name =" otpAuth" optional =" YES" attributeType =" String" />
10
+ <attribute name =" password" optional =" YES" attributeType =" Binary" defaultValueString =" " allowsCloudEncryption =" YES" />
11
+ <attribute name =" passwordLength" attributeType =" Integer 16" defaultValueString =" 0" usesScalarValueType =" YES" />
12
+ <attribute name =" url" attributeType =" String" defaultValueString =" " />
13
+ <attribute name =" username" attributeType =" String" defaultValueString =" " />
14
+ <relationship name =" vault" optional =" YES" maxCount =" 1" deletionRule =" Nullify" destinationEntity =" Vault" inverseName =" accounts" inverseEntity =" Vault" />
15
+ </entity >
16
+ <entity name =" Vault" representedClassName =" Vault" syncable =" YES" codeGenerationType =" class" >
17
+ <attribute name =" name" attributeType =" String" defaultValueString =" " />
18
+ <relationship name =" accounts" optional =" YES" toMany =" YES" deletionRule =" Nullify" destinationEntity =" Account" inverseName =" vault" inverseEntity =" Account" />
19
+ </entity >
20
+ <elements >
21
+ <element name =" Account" positionX =" -54" positionY =" 9" width =" 128" height =" 194" />
22
+ <element name =" Vault" positionX =" -63" positionY =" -18" width =" 128" height =" 59" />
23
+ </elements >
24
+ </model >
Original file line number Diff line number Diff line change 3
3
<entity name =" Account" representedClassName =" Account" syncable =" YES" codeGenerationType =" class" >
4
4
<attribute name =" dateAdded" optional =" YES" attributeType =" Date" usesScalarValueType =" NO" />
5
5
<attribute name =" domain" attributeType =" String" defaultValueString =" " />
6
- <attribute name =" encryptionTag" attributeType =" String" defaultValueString =" " />
7
6
<attribute name =" isPinned" attributeType =" Boolean" defaultValueString =" NO" usesScalarValueType =" YES" />
8
7
<attribute name =" lastModified" optional =" YES" attributeType =" Date" usesScalarValueType =" NO" />
9
- <attribute name =" nonce" optional =" YES" attributeType =" String" />
10
8
<attribute name =" notes" optional =" YES" attributeType =" String" />
11
9
<attribute name =" otpAuth" optional =" YES" attributeType =" String" />
12
10
<attribute name =" password" optional =" YES" attributeType =" Binary" defaultValueString =" " allowsCloudEncryption =" YES" />
20
18
<relationship name =" accounts" optional =" YES" toMany =" YES" deletionRule =" Nullify" destinationEntity =" Account" inverseName =" vault" inverseEntity =" Account" />
21
19
</entity >
22
20
<elements >
23
- <element name =" Account" positionX =" -54" positionY =" 9" width =" 128" height =" 224 " />
21
+ <element name =" Account" positionX =" -54" positionY =" 9" width =" 128" height =" 194 " />
24
22
<element name =" Vault" positionX =" -63" positionY =" -18" width =" 128" height =" 59" />
25
23
</elements >
26
24
</model >
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 7
7
8
8
import Foundation
9
9
import CoreData
10
+ import KeychainAccess
10
11
11
12
struct PersistenceController {
12
13
static let shared = PersistenceController ( )
@@ -52,6 +53,16 @@ struct PersistenceController {
52
53
53
54
print ( " CoreData location " , PersistenceController . storeURL. path)
54
55
}
56
+
57
+ if let coreDataVersion = UserDefaults ( suiteName: " group.OpenSesame.ethanlipnik " ) ? . float ( forKey: " coreDataVersion " ) , coreDataVersion < 1.1 {
58
+ try ? FileManager . default. removeItem ( at: PersistenceController . storeURL)
59
+ try ? Keychain ( service: " com.ethanlipnik.OpenSesame " , accessGroup: " B6QG723P8Z.OpenSesame " )
60
+ . synchronizable ( true )
61
+ . remove ( " encryptionTest " )
62
+
63
+ UserDefaults ( suiteName: " group.OpenSesame.ethanlipnik " ) ? . set ( 1.1 , forKey: " coreDataVersion " )
64
+ }
65
+
55
66
let viewContext = container. viewContext
56
67
container. loadPersistentStores ( completionHandler: { ( storeDescription, error) in
57
68
if let error = error as NSError ? {
Original file line number Diff line number Diff line change @@ -58,7 +58,11 @@ extension ContentView {
58
58
Section ( " Pinned " ) {
59
59
ForEach ( pinnedAccounts) { account in
60
60
NavigationLink {
61
- VaultView ( vault: account. vault!, selectedAccount: account)
61
+ if let vault = account. vault {
62
+ VaultView ( vault: vault, selectedAccount: account)
63
+ } else {
64
+ Text ( " Failed to get vault for pinned account " )
65
+ }
62
66
} label: {
63
67
VStack ( alignment: . leading) {
64
68
Text ( account. domain!. capitalizingFirstLetter ( ) )
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ extension LockView {
18
18
. font ( . title. bold ( ) )
19
19
GroupBox {
20
20
TextField ( " Enter a new master password " , text: $password, onCommit: {
21
+ guard !password. isEmpty else { return }
21
22
completionAction ( password)
22
23
} )
23
24
. font ( . system( . body, design: . monospaced) )
@@ -28,6 +29,7 @@ extension LockView {
28
29
#endif
29
30
}
30
31
Button ( " Continue " ) {
32
+ guard !password. isEmpty else { return }
31
33
completionAction ( password)
32
34
}
33
35
}
You can’t perform that action at this time.
0 commit comments