Lua Requires Chilkat v10.1.0+
Lua
Windows Credentials Manager / Apple Keychain - Get a Binary Secret
See more Secrets Examples
On Windows, fetches the content of a binary secret from the Windows Credentials Manager.On MacOS or iOS, fetches from the Apple Keychain.
Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local secrets = chilkat.Secrets.new()
-- On Windows, this is the Windows Credentials Manager
-- On MacOS/iOS, it is the Apple Keychain
secrets.location = "local_manager"
-- Specify the secret to be fetched.
local json = chilkat.JsonObject.new()
json:update_string("appName", "Test2")
json:update_string("service", "Custom")
json:update_string("domain", "Ocean")
json:update_string("username", "Starfish")
-- Get the binary secret data.
local bd = chilkat.BinData.new()
local success = secrets:get_secret_bd(json, bd)
if not success then
print(secrets.last_error_text)
return
end
-- For our testing, the binary secret was a JPG image..
bd:write_file("c:/temp/qa_output/starfish.jpg")
print("Success.")