Sample code for 30+ languages & platforms
Lua Requires Chilkat v10.1.0+

Windows Credentials Manager / Apple Keychain - Delete a Secret

See more Secrets Examples

On Windows, deletes a secret in the Windows Credentials Manager.

On MacOS or iOS, deletes a secret in the Apple Keychain.

Chilkat Lua Downloads

Lua
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 name of the secret.
-- service and username are required.
-- appName and domain are optional.
-- Note: The values are arbitrary and can be anything you want.
local json = chilkat.JsonObject.new()
json:update_string("appName", "Test")
json:update_string("service", "Something")
json:update_string("domain", "Xyz")
json:update_string("username", "Abc")

-- Delete the secret.
local success = secrets:delete_secret(json)
if not success then
    print(secrets.last_error_text)
    return
end

print("Success.")