-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pinentry for admin password retrieval
Add support for the pinentry-mac Homebrew package for requesting admin password in a secure manner Fix apps that have a .pkg installer not launching
- Loading branch information
1 parent
2345a54
commit ba98754
Showing
20 changed files
with
437 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// URLExtension.swift | ||
// Applite | ||
// | ||
// Created by Milán Várady on 2023. 08. 30.. | ||
// | ||
|
||
import Foundation | ||
import CryptoKit | ||
|
||
extension URL { | ||
func checksumInBase64() -> String? { | ||
let bufferSize = 16*1024 | ||
|
||
do { | ||
// Open file for reading: | ||
let file = try FileHandle(forReadingFrom: self) | ||
defer { | ||
file.closeFile() | ||
} | ||
|
||
// Create and initialize MD5 context: | ||
var md5 = CryptoKit.Insecure.MD5() | ||
|
||
// Read up to `bufferSize` bytes, until EOF is reached, and update MD5 context: | ||
while autoreleasepool(invoking: { | ||
let data = file.readData(ofLength: bufferSize) | ||
if data.count > 0 { | ||
md5.update(data: data) | ||
return true // Continue | ||
} else { | ||
return false // End of file | ||
} | ||
}) { } | ||
|
||
// Compute the MD5 digest: | ||
let data = Data(md5.finalize()) | ||
|
||
return data.base64EncodedString() | ||
} catch { | ||
return nil | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// PinentryError.swift | ||
// Applite | ||
// | ||
// Created by Milán Várady on 2023. 09. 03.. | ||
// | ||
|
||
import Foundation | ||
|
||
enum PinentryError: Error { | ||
case installError | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#! /bin/ksh | ||
|
||
# Add homebrew bin directories to path | ||
typeset PATH="/opt/homebrew/bin:/usr/local/bin:${HOME}/Library/Application Support/Applite/homebrew/bin:${PATH}" | ||
|
||
# Prompt user for password and return it | ||
printf "%s\n" "SETOK OK" "SETCANCEL Cancel" "SETDESC Applite needs your admin password to complete the task" "SETPROMPT Enter Password:" "SETTITLE Applite Password Request" "GETPIN" | /usr/bin/env pinentry-mac --no-global-grab | /usr/bin/awk '/^D / {print substr($0, index($0, $2))}' |
Oops, something went wrong.