text
stringlengths
0
15.7k
source
stringlengths
6
112
logger's infof("P: {}", sut's getPasswordViaMini(spotCredKey))
1password.applescript
logger's infof("OTP: {}", sut's getOtpViaMini(spotCredKey))
1password.applescript
script _1PasswordInstance
1password.applescript
on sampleUsage()
1password.applescript
set unlocked to pwd's waitToUnlockNext()
1password.applescript
pwd's selectCategory("Logins")
1password.applescript
set credKey to "your-unique-key"
1password.applescript
set credKey to "" -- << TEST YOUR CRED HERE, DO NOT COMMIT.
1password.applescript
set {theUsername, thePassword} to doGetUsernameAndPassword(credKey)
1password.applescript
log "Username: " & theUsername
1password.applescript
log "Password: " & thePassword -- do not user logger because that would log to a file.
1password.applescript
pwd's quitApp()
1password.applescript
end sampleUsage
1password.applescript
on getPasswordViaMini(credKey)
1password.applescript
kb's pressCommandOptionKey("\\")
1password.applescript
set unlocked to waitToUnlockMini()
1password.applescript
if unlocked is false then return
1password.applescript
script RetrievePassword
1password.applescript
tell application "System Events" to tell process "1Password mini"
1password.applescript
perform action 2 of group 1 of UI element 1 of row 1 of table 1 of scroll area 1 of window 1
1password.applescript
repeat with nextRow in rows of table 1 of scroll area 1 of window 1
1password.applescript
if credKey is equal to the name of UI element 1 of nextRow then
1password.applescript
clip's extract(RetrievePassword)
1password.applescript
end getPasswordViaMini
1password.applescript
on getOtpViaMini(credKey)
1password.applescript
end getOtpViaMini
1password.applescript
on isUnlocked()
1password.applescript
if exists window 1 then return true
1password.applescript
if running of application "1Password 6" is false then return false
1password.applescript
tell application "System Events" to tell process "1Password 6"
1password.applescript
exists (button "Lock" of group 2 of splitter group 1 of splitter group 1 of window "1Password")
1password.applescript
end isUnlocked
1password.applescript
script UnlockOrMasterOrTouch
1password.applescript
if running of application "1Password 6" is false then activate application "1Password 6"
1password.applescript
if exists (button "Lock" of group 2 of splitter group 1 of splitter group 1 of window "1Password") then return "unlocked"
1password.applescript
if exists (button "Unlock" of window "1Password") then return "locked"
1password.applescript
with timeout of 2 seconds
1password.applescript
if exists (button "Enter Master Password" of window 1) then return "touch"
1password.applescript
set unlockState to exec of retry on UnlockOrMasterOrTouch by 0.5 for 120
1password.applescript
if exists (button "Lock" of group 2 of splitter group 1 of splitter group 1 of window "1Password") then
1password.applescript
_clickTouchId()
1password.applescript
on waitToUnlockMini()
1password.applescript
if exists (window 1) then return true
1password.applescript
if exists (window 1) then
1password.applescript
end waitToUnlockMini
1password.applescript
on selectCategory(catName as text)
1password.applescript
repeat with nextRow in rows of outline 1 of scroll area 1 of splitter group 1 of window "1Password"
1password.applescript
set descAndCount to get value of static text of first UI element of nextRow
1password.applescript
if first item of descAndCount is catName then
1password.applescript
select nextRow
1password.applescript
set initCategory to true
1password.applescript
end selectCategory
1password.applescript
on doGetUsernameAndPassword(credKey)
1password.applescript
script SearchInitializer
1password.applescript
doClearSearch()
1password.applescript
doSearch("applescript")
1password.applescript
if doGetUsernamePrivate() is equal to "applescript" then return true
1password.applescript
exec of retry on SearchInitializer by 0.5 for 120
1password.applescript
script CredSearched
1password.applescript
doSearch(credKey)
1password.applescript
if doGetUsernamePrivate() is not equal to "applescript" then return true
1password.applescript
exec of retry on CredSearched by 0.5 for 120
1password.applescript
set theUsername to doGetUsernamePrivate()
1password.applescript
set thePassword to doGetPasswordPrivate()
1password.applescript
return {theUsername, thePassword}
1password.applescript
end doGetUsernameAndPassword
1password.applescript
on doGetPasswordAndOtp(credKey)
1password.applescript
set theOtp to doGetOTPPrivate()
1password.applescript
return {thePassword, theOtp}
1password.applescript
end doGetPasswordAndOtp
1password.applescript
on doGetUsername(credKey)
1password.applescript
if theUsername is not missing value and theUsername is not "" then
1password.applescript
logger's warn("Error: " & the error_number & ". " & the error_message)
1password.applescript
return theUsername
1password.applescript
end doGetUsername
1password.applescript
on doGetPassword(credKey)
1password.applescript
set dummyPassword to "zambian-CURIE-email"
1password.applescript
if thePassword is not missing value and thePassword is not "" and thePassword is not equal to dummyPassword then
1password.applescript
end doGetPassword
1password.applescript
on doGetOTP(credKey)
1password.applescript
if theOtp is not missing value and theOtp is not "" then
1password.applescript
end doGetOTP
1password.applescript
tell application "1Password 6" to quit
1password.applescript
on doSearch(distinctiveSearchKey)
1password.applescript
set searchField to text field 1 of group 1 of splitter group 1 of splitter group 1 of window "1Password"
1password.applescript
end doSearch
1password.applescript
on doClearSearch()
1password.applescript
if value of searchField is not "" then
1password.applescript
click button 2 of text field 1 of group 1 of splitter group 1 of splitter group 1 of window "1Password" -- Click the x button of the text field.
1password.applescript
set value of searchField to ""
1password.applescript
end doClearSearch
1password.applescript
on doGetPasswordPrivate()
1password.applescript
set thePassword to missing value
1password.applescript
repeat with nextRow in rows of table "Details" of scroll area 1 of group 2 of splitter group 1 of splitter group 1 of window "1Password"
1password.applescript
set fieldType to missing value
1password.applescript
set fieldType to value of static text 1 of UI element 1 of nextRow
1password.applescript
if fieldType is "password" then
1password.applescript
set fieldValue to value of static text 2 of UI element 1 of nextRow
1password.applescript
click button 1 of UI element 1 of nextRow
1password.applescript
end doGetPasswordPrivate
1password.applescript