Skip to content

Commit

Permalink
remove all old crypt mechs and only use the new one
Browse files Browse the repository at this point in the history
  • Loading branch information
wesw-stripe committed Jan 30, 2025
1 parent 9559c63 commit e2279b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Filevault.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ private func handleFileVaultOutput(outputData: Data, filepath: String) throws ->
let systemKeychainPath = "/Library/Keychains/System.keychain"
var read_apps = getPref(key: .AppsAllowedToReadKey) as! [String]
var change_apps = getPref(key: .AppsAllowedToChangeKey) as! [String]
// we need to insert empty strings into the arrays which will add the Authorization Framwork paths into lists so we can read and write the key later on.
read_apps.insert("", at: 0)
change_apps.insert("", at: 0)
// we need to append empty strings into the arrays which will add the Authorization Framwork paths into lists so we can read and write the key later on.
read_apps.append("")
change_apps.append("")
let invisible = getPref(key: .InvisibleInKeychain) as! Bool
let label: String = "com.grahamgilbert.crypt.recovery"
guard syncRecoveryKeyToKeychain(label: label, recoveryKey: recoveryKey, keychain: systemKeychainPath, apps: read_apps, owners: change_apps, makeInvisible: invisible) else {
Expand Down
9 changes: 5 additions & 4 deletions pkg/authmechs/authemechs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (
)

var (
fv2Mechs = []string{"Crypt:Check,privileged", "Crypt:CryptGUI", "Crypt:Enablement,privileged"}
fv2IndexMech = "loginwindow:done"
fv2IndexOffset = 0
fv2Mechs = []string{"Crypt:Check,privileged"}
fv2MechsToRemove = []string{"Crypt:Check,privileged", "Crypt:CryptGUI", "Crypt:Enablement,privileged"}
fv2IndexMech = "loginwindow:done"
fv2IndexOffset = 0
)

type AuthDB struct {
Expand Down Expand Up @@ -55,7 +56,7 @@ func checkMechsInDB(db AuthDB, mechList []string, indexMech string, indexOffset
}

func setMechsInDB(db AuthDB, mechList []string, indexMech string, indexOffset int, add bool) AuthDB {
db = removeMechsInDB(db, mechList)
db = removeMechsInDB(db, fv2MechsToRemove)

if add {
insertIndex := indexOf(db.Mechanisms, indexMech) + indexOffset
Expand Down

0 comments on commit e2279b5

Please sign in to comment.