Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper struct{}
Keeper represents a connection with the Keeper password manager.
func (Keeper) AddRecord ¶
AddRecord adds a new record to the Keeper vault.
**Parameters:**
fields: A map containing the record fields.
fields.title: The title of the record. fields.login: The username or login of the record. fields.password: The password of the record. fields.notes: Additional notes related to the record.
**Returns:**
error: An error if the record cannot be added.
func (Keeper) CommanderInstalled ¶
CommanderInstalled checks if the Keeper Commander tool is installed on the current system.
**Returns:**
bool: True if the Keeper Commander tool is installed, false otherwise.
Example ¶
package main import ( "log" "github.com/l50/goutils/v2/pwmgr/keeper" ) func main() { k := keeper.Keeper{} if !k.CommanderInstalled() { log.Fatal("keeper commander is not installed.") } }
Output:
func (Keeper) LoggedIn ¶
LoggedIn checks if the user is logged into their Keeper vault.
**Returns:**
bool: True if the user is logged into their Keeper vault, false otherwise.
Example ¶
package main import ( "log" "github.com/l50/goutils/v2/pwmgr/keeper" ) func main() { k := keeper.Keeper{} if !k.LoggedIn() { log.Fatal("not logged into keeper vault.") } }
Output:
func (Keeper) RetrieveRecord ¶
RetrieveRecord retrieves a user's Keeper record using the provided unique identifier (uid) and returns it as a JSON string.
**Parameters:**
uid: A string representing the unique identifier of the Keeper record to retrieve.
**Returns:**
string: The JSON string representation of the retrieved Keeper record. The JSON string contains the following attributes:
- UID: The unique identifier of the record. - Title: The title of the record. - Username: The username associated with the record. - Password: The password of the record. - URL: The URL associated with the record. - TOTP: The one-time password (if any) associated with the record. - Note: Any additional notes associated with the record.
error: An error if the Keeper record cannot be retrieved or if there is an issue converting the record to a JSON string.
Example ¶
package main import ( "log" "github.com/l50/goutils/v2/pwmgr/keeper" ) func main() { k := keeper.Keeper{} record, err := k.RetrieveRecord("1234abcd") if err != nil { log.Fatalf("failed to retrieve record: %v", err) } log.Printf("retrieved record: %+v\n", record) }
Output:
func (Keeper) SearchRecords ¶
SearchRecords searches the user's Keeper records for records that match the provided search term.
**Parameters:**
searchTerm: A string representing the term to search for in the Keeper records.
**Returns:**
string: The unique identifier (UID) of the first Keeper record that matches the search term. If multiple records match the search term, only the UID of the first record is returned.
error: An error if the Keeper records cannot be searched or if the search term does not match any records.
Example ¶
package main import ( "log" "github.com/l50/goutils/v2/pwmgr/keeper" ) func main() { k := keeper.Keeper{} uid, err := k.SearchRecords("search term") if err != nil { log.Fatalf("failed to search records: %v", err) } log.Printf("found matching record with UID: %s\n", uid) }
Output: