Documentation ¶
Index ¶
- Constants
- type CLI
- func (c *CLI) ArchiveItem(name string) error
- func (c *CLI) CreateItem(item *Item) (*Item, error)
- func (c *CLI) DeleteItem(name string) error
- func (c *CLI) GetItem(name string, filters ...Filter) (*Item, error)
- func (c *CLI) ListItems(filters ...Filter) ([]Item, error)
- func (c CLI) Version() (string, error)
- type Category
- type Field
- type FieldAssignment
- type FieldAssignmentType
- type FieldPurpose
- type FieldType
- type File
- type Filter
- type Item
- type ItemState
- type PasswordDetails
- type PasswordStrength
- type Section
- type URL
- type Vault
Constants ¶
const ( CategoryAPICredential = "API Credential" CategoryBankAccount = "Bank Account" CategoryCreditCard = "Credit Card" CategoryDatabase = "Database" CategoryDocument = "Document" CategoryDriverLicense = "Driver License" CategoryEmailAccount = "Email Account" CategoryIdentity = "Identity" CategoryLogin = "Login" CategoryMedicalRecord = "Medical Record" CategoryMembership = "Membership" CategoryOutdoorLicense = "Outdoor License" CategoryPassport = "Passport" CategoryPassword = "Password" CategoryRewardProgram = "Reward Program" CategorySecureNote = "Secure Note" CategoryServer = "Server" CategorySocialSecurityNumber = "Social Security Number" CategorySoftwareLicense = "Software License" CategorySSHKey = "SSH Key" CategoryWirelessRouter = "Wireless Router" )
const ( FieldAssignmentTypeConcealed = "concealed" FieldAssignmentTypeText = "text" FieldAssignmentTypeEmail = "email" FieldAssignmentTypeURL = "url" FieldAssignmentTypeDate = "date" FieldAssignmentTypeMonthYear = "monthYear" FieldAssignmentTypePhone = "phone" )
const ( FieldTypeAddress = "address" FieldTypeConcealed = "concealed" FieldTypeCreditCardNumber = "ccnum" FieldTypeCreditCardType = "cctype" FieldTypeDate = "date" FieldTypeEmail = "email" FieldTypeFile = "file" FieldTypeGender = "gender" FieldTypeMenu = "menu" FieldTypeMonthYear = "monthYear" FieldTypeOTP = "OTP" FieldTypePhone = "phone" FieldTypeReference = "reference" FieldTypeSSHKey = "sshkey" FieldTypeString = "string" FieldTypeUnknown = "" FieldTypeURL = "URL" )
const ( FieldPurposeNotes = "NOTES" FieldPurposePassword = "PASSWORD" FieldPurposeUsername = "USERNAME" )
const ( PasswordStrengthTerrible = "TERRIBLE" PasswordStrengthWeak = "WEAK" PasswordStrengthFair = "FAIR" PasswordStrengthGood = "GOOD" PasswordStrengthVeryGood = "VERY_GOOD" PasswordStrengthExcellent = "EXCELLENT" PasswordStrengthFantastic = "FANTASTIC" )
const (
ItemStateArchived = "ARCHIVED"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLI ¶
type CLI struct { // Account specifies the account to use when executing commands. // Supported values are account shorthand, sign-in address, account ID, or user ID. Account string // Config specifies the 1Password CLI configuration directory to use. Config string // Path specifies the absolute path to the 1Password CLI executable. // When not set (default), exec.LookPath() will be utilized to find the `op` executable on $PATH. Path string }
CLI represents the 1Password CLI.
func (*CLI) ArchiveItem ¶
ArchiveItem archives the item specified by its name, ID, or sharing link.
func (*CLI) CreateItem ¶
CreateItem creates a new item and returns it with all the fileds like ID filled.
--dry-run Perform a dry run of the command and output a preview of the resulting item. --generate-password[=recipe] Give the item a randomly generated password.
func (*CLI) DeleteItem ¶
DeleteItem permanently deletes an item specified by its name, ID, or sharing link.
func (*CLI) GetItem ¶
GetItem returns the details of an item specified by its name, ID, or sharing link.
Supported filters:
- WithIncludeArchive() Include items in the Archive.
- WithVault() Only list items in this vault.
func (*CLI) ListItems ¶
ListItems returns a list of all items the account has read access to. Excludes items in the Archive by default.
Supported filters:
- WithIncludeArchive() Include items in the Archive.
- WithCategories() Only list items in these categories (comma-separated).
- WithFavorite() Only list favorite items
- WithTags() Only list items with these tags (comma-separated).
- WithVault() Only list items in this vault.
type Field ¶
type Field struct { ID string `json:"id"` Section Section `json:"section"` Type FieldType `json:"type"` Purpose FieldPurpose `json:"purpose"` Label string `json:"label"` Value string `json:"value"` TOTP string `json:"totp"` Entropy int64 `json:"entropy"` PasswordDetails PasswordDetails `json:"password_details"` Reference string `json:"reference"` }
type FieldAssignment ¶
type FieldAssignment struct { Label string `json:"label"` Type FieldAssignmentType `json:"type"` Value string `json:"value"` Purpose FieldPurpose `json:"purpose"` }
type FieldAssignmentType ¶
type FieldAssignmentType string
type FieldPurpose ¶
type FieldPurpose string
type Filter ¶
type Filter func() []string
Filter represents a filter flag passed to 1Password CLI some commands.
func IncludeArchive ¶
func IncludeArchive() Filter
IncludeArchive expands item list to include items in the Archive.
func WithCategories ¶
WithCategories limits results to only include items matching given categories.
func WithFavorite ¶
func WithFavorite() Filter
WithFavorite limits results to only include favorite items.
type Item ¶
type Item struct { ID string `json:"id"` Title string `json:"title"` Favorite bool `json:"favorite"` Tags []string `json:"tags"` Version int `json:"version"` State ItemState `json:"state"` Vault Vault `json:"vault"` Category Category `json:"category"` LastEditedBy string `json:"last_edited_by"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` AdditionalInformation string `json:"additional_information"` URLs []URL `json:"urls"` Sections []Section `json:"sections"` Fields []Field `json:"fields"` Files []File `json:"files"` }
type PasswordDetails ¶
type PasswordDetails struct { Entropy int64 `json:"entropy"` Generated bool `json:"generated"` Strength PasswordStrength `json:"strength"` }
type PasswordStrength ¶
type PasswordStrength string