Documentation ¶
Index ¶
- Constants
- Variables
- func Base64HmacFromString(key []byte, message string) string
- func Base64ToBytes(text string) []byte
- func Base64ToString(base64Text string) string
- func Base64ToStringSafe(base64Text string) string
- func ByteToInt(b []byte) string
- func BytesToBase64(data []byte) string
- func BytesToString(b []byte) string
- func BytesToUrlSafeStr(data []byte) string
- func ClearBytes(bytes []byte)
- func CloneByteSlice(src []byte) []byte
- func Decrypt(data, key []byte) ([]byte, error)
- func DecryptRecord(data, secretKey []byte) (string, error)
- func DictToJson(dict map[string]interface{}) string
- func DictToJsonWithDefultIndent(dict map[string]interface{}) string
- func DictToJsonWithIndent(dict map[string]interface{}, indent string) string
- func ECDH(priv PrivateKey, pub PublicKey) ([]byte, error)
- func ECDH_Ecdsa(priv *ecdsa.PrivateKey, pub *ecdsa.PublicKey) ([]byte, error)
- func EcPublicKeyFromEncodedPoint(publicKey []byte) (crypto.PublicKey, error)
- func EcPublicKeyToEncodedPoint(pub *ecdsa.PublicKey) ([]byte, error)
- func EncryptAesGcm(data []byte, key []byte) ([]byte, error)
- func EncryptAesGcmFull(data, key, nonce []byte) ([]byte, error)
- func GeneratePassword(minLength int, ...) (string, error)
- func GeneratePasswordWithOptions(options *PasswordOptions) (string, error)
- func GeneratePrivateKeyDer() ([]byte, error)
- func GenerateRandomBytes(size int) ([]byte, error)
- func GenerateUid() string
- func GenerateUidWithLength(bitLength int) string
- func GetClientVersion(hardcode bool) string
- func GetDefaultOwnerPublicKey() string
- func GetOS() string
- func GetRandomBytes(size int) ([]byte, error)
- func GetServerHostname(hostname string, configStore IKeyValueStorage) string
- func HmacDigest(key []byte, message []byte) []byte
- func IsFieldClass(field interface{}) bool
- func IsJson(jsonStr string) bool
- func JsonToDict(content string) map[string]interface{}
- func NewFileCache(filePath string) *fileCache
- func NewFileKeyValueStorage(filePath ...interface{}) *fileKeyValueStorage
- func NewMemoryCache() *memoryCache
- func NewMemoryKeyValueStorage(config ...interface{}) *memoryKeyValueStorage
- func NowMilliseconds() int64
- func ObjToDict(obj interface{}) map[string]interface{}
- func PadBinary(s []byte) []byte
- func PathExists(path string) (bool, error)
- func PublicEncrypt(data []byte, serverPublicRawKeyBytes []byte, idz []byte) (encrypted []byte, err error)
- func Sign(data []byte, privateKey *PrivateKey) ([]byte, error)
- func StrToBool(val string) (bool, error)
- func StringToBytes(s string) []byte
- func UnpadBinary(s []byte) []byte
- func UrlSafeSha256FromString(text string) string
- func UrlSafeStrToBytes(text string) []byte
- func UrlSafeStrToBytesSafe(text string) []byte
- func Verify(data []byte, signature []byte, publicKey *PublicKey) error
- type AccountNumber
- type AddFileResponse
- type Address
- type AddressRef
- type Addresses
- type AppData
- type BankAccount
- type BankAccounts
- type BirthDate
- type CardRef
- type ClientOptions
- type ConfigKey
- type Context
- type CopyableMap
- type CopyableSlice
- type CreatePayload
- type Date
- type DeletePayload
- type DeleteSecretResponse
- type DeleteSecretsResponse
- type ECDSASignature
- type Email
- type EncryptedPayload
- type ExpirationDate
- type FieldSectionFlag
- type FieldTokenFlag
- type FileRef
- type FileUploadPayload
- type Folder
- type GetPayload
- type HOTP
- type Host
- type Hosts
- type ICache
- type IKeyValueStorage
- type KeeperFile
- func (f *KeeperFile) DecryptFileKey() []byte
- func (f *KeeperFile) DeepCopy() *KeeperFile
- func (f *KeeperFile) GetFileData() []byte
- func (f *KeeperFile) GetMeta() map[string]interface{}
- func (f *KeeperFile) GetUrl() string
- func (f *KeeperFile) SaveFile(path string, createFolders bool) bool
- func (f *KeeperFile) ToString() string
- type KeeperFileData
- type KeeperFileUpload
- type KeeperRecordData
- type KeeperRecordField
- type KeyPair
- type KeyPairs
- type KsmHttpResponse
- type LicenseNumber
- type Login
- type Multiline
- type Name
- type Names
- type NotationSection
- type OneTimeCode
- type ParserTuple
- type Password
- type PasswordComplexity
- type PasswordOptions
- type PaymentCard
- type PaymentCards
- type Phone
- type Phones
- type PinCode
- type PrivateKey
- func DerBase64PrivateKeyToPrivateKey(privateKeyDerBase64 string) (*PrivateKey, error)
- func GenerateKeys(curve elliptic.Curve) (PrivateKey, error)
- func GenerateNewEccKey() (PrivateKey, error)
- func GenerateP256Keys() (PrivateKey, error)
- func GeneratePrivateKeyEcc() (PrivateKey, error)
- func LoadDerPrivateKeyDer(data []byte) (*PrivateKey, error)
- func (priv *PrivateKey) Bytes() []byte
- func (priv *PrivateKey) Equals(k *PrivateKey) bool
- func (priv *PrivateKey) GetPublicKey() *PublicKey
- func (priv *PrivateKey) Hex() string
- func (priv *PrivateKey) SetBytes(d []byte) *PrivateKey
- func (priv *PrivateKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)
- type PublicKey
- type Record
- func FindSecretByTitle(recordTitle string, records []*Record) *Record
- func FindSecretsByTitle(recordTitle string, records []*Record) []*Record
- func NewRecord(templateRecordUid string, records []*Record, newRecordUid string) (*Record, error)
- func NewRecordClone(templateRecordUid string, records []*Record, newRecordUid string) (*Record, error)
- func NewRecordFromJson(recordDict map[string]interface{}, secretKey []byte, folderUid string) *Record
- func NewRecordFromRecordData(recordData *RecordCreate, folder *Folder) *Record
- func NewRecordFromRecordDataWithUid(recordUid string, recordData *RecordCreate, folder *Folder) *Record
- func (r *Record) AddCustomField(field interface{}) error
- func (r *Record) CanClone() bool
- func (r *Record) DownloadFile(fileUid string, path string) bool
- func (r *Record) DownloadFileByTitle(title string, path string) bool
- func (r *Record) FieldExists(section, name string) bool
- func (r *Record) FindFile(name string) *KeeperFile
- func (r *Record) FindFileByFilename(filename string) *KeeperFile
- func (r *Record) FindFileByTitle(title string) *KeeperFile
- func (r *Record) FindFiles(name string) []*KeeperFile
- func (r *Record) FolderUid() string
- func (r *Record) GetCustomFieldValue(fieldType string, single bool) ([]interface{}, error)
- func (r *Record) GetCustomFieldValueByLabel(fieldLabel string) string
- func (r *Record) GetCustomFieldValueByType(fieldType string) string
- func (r *Record) GetCustomFieldValues(label string, fieldType string) []string
- func (r *Record) GetCustomFieldsByLabel(fieldLabel string) []map[string]interface{}
- func (r *Record) GetCustomFieldsByType(fieldType string) []map[string]interface{}
- func (r *Record) GetFieldValueByLabel(fieldLabel string) string
- func (r *Record) GetFieldValueByType(fieldType string) string
- func (r *Record) GetFieldValuesByType(fieldType string) []string
- func (r *Record) GetFieldsByLabel(fieldLabel string) []map[string]interface{}
- func (r *Record) GetFieldsByMask(fieldToken string, fieldTokenFlag FieldTokenFlag, fieldType FieldSectionFlag) []map[string]interface{}
- func (r *Record) GetFieldsBySection(fieldSectionType FieldSectionFlag) []interface{}
- func (r *Record) GetFieldsByType(fieldType string) []map[string]interface{}
- func (r *Record) GetStandardFieldValue(fieldType string, single bool) ([]interface{}, error)
- func (r *Record) InsertField(section string, field interface{}) error
- func (r *Record) Notes() string
- func (r *Record) Password() string
- func (r *Record) Print()
- func (r *Record) RemoveField(section, name string, removeAll bool) int
- func (r *Record) SetCustomFieldValue(fieldType string, value interface{}) error
- func (r *Record) SetCustomFieldValueSingle(fieldLabel, value string)
- func (r *Record) SetFieldValueSingle(fieldType, value string)
- func (r *Record) SetNotes(notes string)
- func (r *Record) SetPassword(password string)
- func (r *Record) SetStandardFieldValue(fieldType string, value interface{}) error
- func (r *Record) SetTitle(title string)
- func (r *Record) SetType(newType string)
- func (r *Record) Title() string
- func (r *Record) ToString() string
- func (r *Record) Type() string
- func (r *Record) UpdateField(section string, field interface{}) error
- type RecordCreate
- type RecordField
- type Secret
- type SecretsManager
- func (c *SecretsManager) CreateSecret(record *Record) (recordUid string, err error)
- func (c *SecretsManager) CreateSecretWithRecordData(recUid, folderUid string, recordData *RecordCreate) (recordUid string, err error)
- func (c *SecretsManager) DefaultKeeperServerPublicKeyId() string
- func (c *SecretsManager) DeleteSecrets(recordUids []string) (statuses map[string]string, err error)
- func (c *SecretsManager) FindNotation(records []*Record, notation string) (fieldValue []interface{}, err error)
- func (c *SecretsManager) GenerateTransmissionKey(keyId string) *TransmissionKey
- func (c *SecretsManager) GetNotation(notation string) (fieldValue []interface{}, err error)deprecated
- func (c *SecretsManager) GetNotationResults(notation string) ([]string, error)
- func (c *SecretsManager) GetSecretByTitle(recordTitle string) (record *Record, err error)
- func (c *SecretsManager) GetSecrets(uids []string) (records []*Record, err error)
- func (c *SecretsManager) GetSecretsByTitle(recordTitle string) (records []*Record, err error)
- func (c *SecretsManager) GetSecretsFullResponse(uids []string) (response *SecretsManagerResponse, err error)
- func (c *SecretsManager) HandleHttpError(rs *http.Response, body []byte, httpError error) (retry bool, err error)
- func (c *SecretsManager) LoadSecretKey() string
- func (c *SecretsManager) NotationPrefix() string
- func (c *SecretsManager) PostFunction(url string, transmissionKey *TransmissionKey, ...) (*KsmHttpResponse, error)
- func (c *SecretsManager) PostQuery(path string, payload interface{}) (body []byte, err error)
- func (c *SecretsManager) PrepareContext() *Context
- func (c *SecretsManager) Save(record *Record) (err error)
- func (c *SecretsManager) SetCache(cache ICache)
- func (c *SecretsManager) TryGetNotationResults(notation string) []string
- func (c *SecretsManager) UploadFile(record *Record, file *KeeperFileUpload) (uid string, err error)
- func (c *SecretsManager) UploadFilePath(record *Record, filePath string) (uid string, err error)
- type SecretsManagerResponse
- type SecureNote
- type SecurityQuestion
- type SecurityQuestions
- type TOTP
- type Text
- type TotpCode
- type TransmissionKey
- type UpdatePayload
- type Url
Constants ¶
const ( Aes256KeySize = 32 AesGcmNonceSize = 12 DefaultBlockSize = 16 )
const AsciiDigits string = "0123456789"
const AsciiLowercase string = "abcdefghijklmnopqrstuvwxyz"
const AsciiSpecialCharacters string = "\"!@#$%()+;<>=?[]{}^.,"
const AsciiUppercase string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
const (
DEFAULT_CONFIG_PATH string = "client-config.json"
)
const DefaultPasswordLength int = 32
Generate password
const EscapeChar = '\\'
New notation parser/extractor allows to search by title/label and to escape special chars
const EscapeChars = "/[]\\" // /[]\ -> \/ ,\[, \], \\
Variables ¶
var ErrKeyExchange = errors.New("key exchange failed")
ErrKeyExchange is returned if the key exchange fails.
Functions ¶
func Base64HmacFromString ¶
Base64HmacFromString generates base64 encoded HMAC of the message string with the given key
func Base64ToBytes ¶
func Base64ToString ¶
func Base64ToStringSafe ¶
func BytesToBase64 ¶
func BytesToString ¶
func BytesToUrlSafeStr ¶
func ClearBytes ¶
func ClearBytes(bytes []byte)
func CloneByteSlice ¶
func DecryptRecord ¶
func DictToJson ¶
func DictToJsonWithIndent ¶
func ECDH ¶
func ECDH(priv PrivateKey, pub PublicKey) ([]byte, error)
ECDH computes a shared key from a private key and a peer's public key.
func ECDH_Ecdsa ¶
ECDH computes a shared key from a private key and a peer's public key.
func EncryptAesGcm ¶
Encrypt a message using AES-GCM.
func EncryptAesGcmFull ¶
Encrypt a message using AES-GCM with custom nonce.
func GeneratePassword ¶
func GeneratePassword(minLength int, lowercase, uppercase, digits, specialCharacters, specialCharacterSet string) (string, error)
GeneratePassword returns a new password of specified minimum length using provided number of uppercase, lowercase, digits and special characters.
Empty strings or strings with invalid int values are treated as nil and used only if sum of the non nil values don't reach minLength
Note: If all character groups are unspecified or all have exact zero length then password characters are chosen from all groups uniformly at random.
Note: If all charset lengths are negative or 0 but can't reach min_length then all exact/negative charset lengths will be treated as minimum number of characters instead.
minLength is the minimum password length - default: 32 lowercase is the minimum number of lowercase characters if positive, exact if 0 or negative uppercase is the minimum number of uppercase characters if positive, exact if 0 or negative digits is the minimum number of digits if positive, exact if 0 or negative specialCharacters is the minimum number of special characters if positive, exact if 0 or negative specialCharacterSet is a string containing custom set of special characters to pick from
func GeneratePasswordWithOptions ¶
func GeneratePasswordWithOptions(options *PasswordOptions) (string, error)
GeneratePasswordWithOptions generates new password using provided options If options is nil the new password will be generated using defaults All lengths are optional and substituted with reasonable defaults when missing To exclude a charset - set corresponding option to 0 To use default length value - set its option to empty string "" Note: Any strings containing non integer values will be treated as empty string
func GeneratePrivateKeyDer ¶
func GenerateRandomBytes ¶
func GenerateUid ¶
func GenerateUid() string
func GenerateUidWithLength ¶
func GetClientVersion ¶
getClientVersion returns the version of the client
func GetDefaultOwnerPublicKey ¶
func GetDefaultOwnerPublicKey() string
func GetRandomBytes ¶
func GetServerHostname ¶
func GetServerHostname(hostname string, configStore IKeyValueStorage) string
func HmacDigest ¶
func IsFieldClass ¶
func IsFieldClass(field interface{}) bool
func JsonToDict ¶
func NewFileCache ¶
func NewFileCache(filePath string) *fileCache
func NewFileKeyValueStorage ¶
func NewFileKeyValueStorage(filePath ...interface{}) *fileKeyValueStorage
func NewMemoryCache ¶
func NewMemoryCache() *memoryCache
func NewMemoryKeyValueStorage ¶
func NewMemoryKeyValueStorage(config ...interface{}) *memoryKeyValueStorage
func NowMilliseconds ¶
func NowMilliseconds() int64
func PathExists ¶
PathExists returns whether the given file or directory exists
func PublicEncrypt ¶
func StringToBytes ¶
func UnpadBinary ¶
func UrlSafeSha256FromString ¶
UrlSafeSha256FromString generates URL safe encoded SHA256 sum of data in URL safe base64 encoded string
func UrlSafeStrToBytes ¶
func UrlSafeStrToBytesSafe ¶
UrlSafeStrToBytesSafe decodes base64 text to bytes, returns empty byte slice on error
Types ¶
type AccountNumber ¶
type AccountNumber struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
func NewAccountNumber ¶
func NewAccountNumber(value string) *AccountNumber
AccountNumber field constructor with the single value to eliminate the complexity of the passing List as a value
type AddFileResponse ¶
type AddFileResponse struct { Url string `json:"url"` Parameters string `json:"parameters"` SuccessStatusCode int `json:"successStatusCode"` }
func AddFileResponseFromJson ¶
func AddFileResponseFromJson(jsonData string) (*AddFileResponse, error)
type AddressRef ¶
type AddressRef struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
func NewAddressRef ¶
func NewAddressRef(value string) *AddressRef
AddressRef field constructor with the single value to eliminate the complexity of the passing List as a value
type Addresses ¶
type Addresses struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []Address `json:"value,omitempty"` }
func NewAddresses ¶
Addresses field constructor with the single value to eliminate the complexity of the passing List as a value
type AppData ¶
type AppData struct { Title string `json:"title,omitempty"` AppType string `json:"type,omitempty"` }
Application info
func NewAppData ¶
type BankAccount ¶
type BankAccounts ¶
type BankAccounts struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []BankAccount `json:"value,omitempty"` }
func NewBankAccounts ¶
func NewBankAccounts(value BankAccount) *BankAccounts
BankAccounts field constructor with the single value to eliminate the complexity of the passing List as a value
type BirthDate ¶
type BirthDate struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []int64 `json:"value,omitempty"` }
func NewBirthDate ¶
BirthDate field constructor with the single value to eliminate the complexity of the passing List as a value
type CardRef ¶
type CardRef struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
func NewCardRef ¶
CardRef field constructor with the single value to eliminate the complexity of the passing List as a value
type ClientOptions ¶
type ClientOptions struct { // Token specifies a One-Time Access Token used // to generate the configuration to use with core.SecretsManager client Token string // InsecureSkipVerify controls whether the client verifies // server's certificate chain and host name InsecureSkipVerify bool // Config specifies either one of the built-in IKeyValueStorage interfaces or a custom one Config IKeyValueStorage // LogLevel overrides the default log level for the logger LogLevel klog.LogLevel // Deprecated: Use Token instead. If both are set, hostname from the token takes priority. Hostname string }
type ConfigKey ¶
type ConfigKey string
const ( KEY_URL ConfigKey = "url" // base URL for the Secrets Manager service KEY_SERVER_PUBLIC_KEY_ID ConfigKey = "serverPublicKeyId" KEY_CLIENT_ID ConfigKey = "clientId" KEY_CLIENT_KEY ConfigKey = "clientKey" // The key that is used to identify the client before public key KEY_APP_KEY ConfigKey = "appKey" // The application key with which all secrets are encrypted KEY_OWNER_PUBLIC_KEY ConfigKey = "appOwnerPublicKey" // The application owner public key, to create records KEY_PRIVATE_KEY ConfigKey = "privateKey" // The client's private key KEY_PUBLIC_KEY ConfigKey = "publicKey" // The client's public key KEY_HOSTNAME ConfigKey = "hostname" // base hostname for the Secrets Manager service )
func GetConfigKey ¶
func GetConfigKeys ¶
func GetConfigKeys() []ConfigKey
type Context ¶
type Context struct { TransmissionKey TransmissionKey ClientId []byte ClientKey []byte }
func NewContext ¶
func NewContext(transmissionKey TransmissionKey, clientId []byte, clientKey []byte) *Context
type CopyableMap ¶
type CopyableMap map[string]interface{}
func (CopyableMap) DeepCopy ¶
func (m CopyableMap) DeepCopy() map[string]interface{}
DeepCopy will create a deep copy of this map. The depth of this copy is all inclusive. Both maps and slices will be considered when making the copy.
type CopyableSlice ¶
type CopyableSlice []interface{}
func (CopyableSlice) DeepCopy ¶
func (s CopyableSlice) DeepCopy() []interface{}
DeepCopy will create a deep copy of this slice. The depth of this copy is all inclusive. Both maps and slices will be considered when making the copy.
type CreatePayload ¶
type CreatePayload struct { ClientVersion string `json:"clientVersion"` ClientId string `json:"clientId"` RecordUid string `json:"recordUid"` RecordKey string `json:"recordKey"` FolderUid string `json:"folderUid"` FolderKey string `json:"folderKey"` Data string `json:"data"` }
func (*CreatePayload) CreatePayloadFromJson ¶
func (p *CreatePayload) CreatePayloadFromJson(jsonData string)
func (*CreatePayload) CreatePayloadToJson ¶
func (p *CreatePayload) CreatePayloadToJson() (string, error)
type Date ¶
type Date struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []int64 `json:"value,omitempty"` }
type DeletePayload ¶
type DeletePayload struct { ClientVersion string `json:"clientVersion"` ClientId string `json:"clientId"` RecordUids []string `json:"recordUids"` }
func (*DeletePayload) DeletePayloadFromJson ¶
func (p *DeletePayload) DeletePayloadFromJson(jsonData string)
func (*DeletePayload) DeletePayloadToJson ¶
func (p *DeletePayload) DeletePayloadToJson() (string, error)
type DeleteSecretResponse ¶
type DeleteSecretsResponse ¶
type DeleteSecretsResponse struct {
Records []DeleteSecretResponse `json:"records"`
}
func DeleteSecretsResponseFromJson ¶
func DeleteSecretsResponseFromJson(jsonData string) (*DeleteSecretsResponse, error)
type ECDSASignature ¶
ECDSASignature needed for compatibility with openssl (python > hazmat > openssl > ec > _ecdsa_sig_sign) which uses ASN.1/DER SEQUENCE format NB! MaxLen for ASN.1, depends on the encoding. P1363 only needs 64 bytes. And an OpePGP encoding only needs 66 bytes. ECDSASignature using ASN.1/DER needs up to 72 bytes. DER requires a minimum number of bytes. If ASN.1/BER is used, then the signature can be hundreds of bytes.
type Email ¶
type Email struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
type EncryptedPayload ¶
func NewEncryptedPayload ¶
func NewEncryptedPayload(encryptedPayload []byte, signature []byte) *EncryptedPayload
type ExpirationDate ¶
type ExpirationDate struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []int64 `json:"value,omitempty"` }
func NewExpirationDate ¶
func NewExpirationDate(value int64) *ExpirationDate
ExpirationDate field constructor with the single value to eliminate the complexity of the passing List as a value
type FieldSectionFlag ¶
type FieldSectionFlag byte
const ( FieldSectionFields FieldSectionFlag = 1 << iota FieldSectionCustom FieldSectionBoth = FieldSectionFields | FieldSectionCustom )
type FieldTokenFlag ¶
type FieldTokenFlag byte
const ( FieldTokenType FieldTokenFlag = 1 << iota FieldTokenLabel FieldTokenBoth = FieldTokenType | FieldTokenLabel )
type FileRef ¶
type FileRef struct { KeeperRecordField Required bool `json:"required,omitempty"` Value []string `json:"value,omitempty"` }
func NewFileRef ¶
FileRef field constructor with the single value to eliminate the complexity of the passing List as a value
type FileUploadPayload ¶
type FileUploadPayload struct { ClientVersion string `json:"clientVersion"` ClientId string `json:"clientId"` FileRecordUid string `json:"fileRecordUid"` FileRecordKey string `json:"fileRecordKey"` FileRecordData string `json:"fileRecordData"` OwnerRecordUid string `json:"ownerRecordUid"` OwnerRecordData string `json:"ownerRecordData"` LinkKey string `json:"linkKey"` FileSize int `json:"fileSize"` }
func FileUploadPayloadFromJson ¶
func FileUploadPayloadFromJson(jsonData string) *FileUploadPayload
func (*FileUploadPayload) FileUploadPayloadToJson ¶
func (p *FileUploadPayload) FileUploadPayloadToJson() (string, error)
type Folder ¶
type Folder struct {
// contains filtered or unexported fields
}
func GetFolderByKey ¶
func NewFolderFromJson ¶
type GetPayload ¶
type GetPayload struct { ClientVersion string `json:"clientVersion"` ClientId string `json:"clientId"` PublicKey string `json:"publicKey,omitempty"` RequestedRecords []string `json:"requestedRecords"` }
func (*GetPayload) GetPayloadFromJson ¶
func (p *GetPayload) GetPayloadFromJson(jsonData string)
func (*GetPayload) GetPayloadToJson ¶
func (p *GetPayload) GetPayloadToJson() (string, error)
type HOTP ¶
type HOTP struct { Secret string // Secret key (required) Digits int // OTP digit count (default: 6) Counter int64 // Counter value (default: 0) }
HOTP represents HMAC-Based OTP - https://datatracker.ietf.org/doc/html/rfc4226
type Hosts ¶
type Hosts struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []Host `json:"value,omitempty"` }
type IKeyValueStorage ¶
type IKeyValueStorage interface { ReadStorage() map[string]interface{} SaveStorage(updatedConfig map[string]interface{}) Get(key ConfigKey) string Set(key ConfigKey, value interface{}) map[string]interface{} Delete(key ConfigKey) map[string]interface{} DeleteAll() map[string]interface{} Contains(key ConfigKey) bool IsEmpty() bool }
type KeeperFile ¶
type KeeperFile struct { FileKey string FileData []byte Uid string Type string Title string Name string LastModified int Size int F map[string]interface{} RecordKeyBytes []byte // contains filtered or unexported fields }
func NewKeeperFileFromJson ¶
func NewKeeperFileFromJson(fileDict map[string]interface{}, recordKeyBytes []byte) *KeeperFile
func (*KeeperFile) DecryptFileKey ¶
func (f *KeeperFile) DecryptFileKey() []byte
func (*KeeperFile) DeepCopy ¶
func (f *KeeperFile) DeepCopy() *KeeperFile
func (*KeeperFile) GetFileData ¶
func (f *KeeperFile) GetFileData() []byte
func (*KeeperFile) GetMeta ¶
func (f *KeeperFile) GetMeta() map[string]interface{}
func (*KeeperFile) GetUrl ¶
func (f *KeeperFile) GetUrl() string
func (*KeeperFile) ToString ¶
func (f *KeeperFile) ToString() string
type KeeperFileData ¶
type KeeperFileUpload ¶
func GetFileForUpload ¶
func GetFileForUpload(filePath, fileName, fileTitle, mimeType string) (*KeeperFileUpload, error)
type KeeperRecordData ¶
type KeeperRecordData struct { Type string `json:"type,omitempty"` Title string `json:"title,omitempty"` Notes string `json:"notes,omitempty"` Fields []KeeperRecordField `json:"fields,omitempty"` Custom []KeeperRecordField `json:"custom,omitempty"` }
type KeeperRecordField ¶
type KeyPairs ¶
type KeyPairs struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []KeyPair `json:"value,omitempty"` }
func NewKeyPairs ¶
KeyPairs field constructor with the single value to eliminate the complexity of the passing List as a value
type KsmHttpResponse ¶
func NewKsmHttpResponse ¶
func NewKsmHttpResponse(statusCode int, data []byte, httpResponse *http.Response) *KsmHttpResponse
type LicenseNumber ¶
type LicenseNumber struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
func NewLicenseNumber ¶
func NewLicenseNumber(value string) *LicenseNumber
LicenseNumber field constructor with the single value to eliminate the complexity of the passing List as a value
type Login ¶
type Login struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
type Multiline ¶
type Multiline struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
func NewMultiline ¶
Multiline field constructor with the single value to eliminate the complexity of the passing List as a value
type Names ¶
type Names struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []Name `json:"value,omitempty"` }
type NotationSection ¶
type NotationSection struct { Section string // section name - ex. prefix IsPresent bool // presence flag StartPos int // section start position in URI EndPos int // section end position in URI Text *ParserTuple // <unescaped, raw> text Parameter *ParserTuple // <field type>|<field label>|<file name> Index1 *ParserTuple // numeric index [N] or [] Index2 *ParserTuple // property index - ex. field/name[0][middle] }
func NewNotationSection ¶
func NewNotationSection(section string) *NotationSection
func ParseNotation ¶
func ParseNotation(notation string) ([]*NotationSection, error)
func ParseNotationInLegacyMode ¶
func ParseNotationInLegacyMode(notation string) ([]*NotationSection, error)
func ParseSection ¶
func ParseSection(notation string, section string, pos int) (*NotationSection, error)
type OneTimeCode ¶
type OneTimeCode struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
func NewOneTimeCode ¶
func NewOneTimeCode(value string) *OneTimeCode
OneTimeCode field constructor with the single value to eliminate the complexity of the passing List as a value
type ParserTuple ¶
type ParserTuple struct { Text string // unescaped text RawText string // raw text incl. delimiter(s), escape characters etc. }
func ParseSubsection ¶
type Password ¶
type Password struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` EnforceGeneration bool `json:"enforceGeneration,omitempty"` Complexity *PasswordComplexity `json:"complexity,omitempty"` Value []string `json:"value,omitempty"` }
func NewPassword ¶
Password field constructor with the single value to eliminate the complexity of the passing List as a value
type PasswordComplexity ¶
type PasswordOptions ¶
type PasswordOptions struct { MinLength string UppercaseLength string LowercaseLength string DigitsLength string SpecialCharactersLength string SpecialCharacterSet string }
PasswordOptions provides complexity settings for GeneratePasswordWithOptions Positive values specify minimum length, zero or negative - exact length Generated password must have at least MinLength characters - exact values may be converted to min values Empty strings or missing values will be substituted with a reasonable defaults ex. passing nil will generate password with length = DefaultPasswordLength using all charsets
type PaymentCard ¶
type PaymentCards ¶
type PaymentCards struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []PaymentCard `json:"value,omitempty"` }
func NewPaymentCards ¶
func NewPaymentCards(value PaymentCard) *PaymentCards
PaymentCards field constructor with the single value to eliminate the complexity of the passing List as a value
type Phones ¶
type Phones struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []Phone `json:"value,omitempty"` }
type PinCode ¶
type PinCode struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
func NewPinCode ¶
PinCode field constructor with the single value to eliminate the complexity of the passing List as a value
type PrivateKey ¶
type PrivateKey ecdsa.PrivateKey
func DerBase64PrivateKeyToPrivateKey ¶
func DerBase64PrivateKeyToPrivateKey(privateKeyDerBase64 string) (*PrivateKey, error)
func GenerateKeys ¶
func GenerateKeys(curve elliptic.Curve) (PrivateKey, error)
func GenerateNewEccKey ¶
func GenerateNewEccKey() (PrivateKey, error)
func GenerateP256Keys ¶
func GenerateP256Keys() (PrivateKey, error)
func GeneratePrivateKeyEcc ¶
func GeneratePrivateKeyEcc() (PrivateKey, error)
func LoadDerPrivateKeyDer ¶
func LoadDerPrivateKeyDer(data []byte) (*PrivateKey, error)
func (*PrivateKey) Equals ¶
func (priv *PrivateKey) Equals(k *PrivateKey) bool
Equals compares two private keys with constant time (to resist timing attacks)
func (*PrivateKey) GetPublicKey ¶
func (priv *PrivateKey) GetPublicKey() *PublicKey
GetPublicKey returns the associated PublicKey for this privatekey, If the key is missing then one is generated.
func (*PrivateKey) Hex ¶
func (priv *PrivateKey) Hex() string
Hex returns private key bytes as a hex string
func (*PrivateKey) SetBytes ¶
func (priv *PrivateKey) SetBytes(d []byte) *PrivateKey
SetBytes reconstructs the private key from D bytes
func (*PrivateKey) Sign ¶
func (priv *PrivateKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)
Sign signs digest with priv, reading randomness from rand.
The opts argument is not currently used but, in keeping with the crypto.Signer interface, should be the hash function used to digest the message.
type PublicKey ¶
type Record ¶
type Record struct { RecordKeyBytes []byte Uid string Files []*KeeperFile Revision int64 IsEditable bool RawJson string RecordDict map[string]interface{} // contains filtered or unexported fields }
func FindSecretByTitle ¶
func FindSecretsByTitle ¶
func NewRecord ¶
NewRecord returns a new empty record of the same type as template object but with new UID and RecordKeyBytes generates and uses new random UID if newRecordUid is empty returns error if template record is not found
func NewRecordClone ¶
func NewRecordClone(templateRecordUid string, records []*Record, newRecordUid string) (*Record, error)
NewRecordClone returns a deep copy of the template object with new UID and RecordKeyBytes generates and uses new random UID if newRecordUid is empty returns error if template record is not found
func NewRecordFromJson ¶
func NewRecordFromRecordData ¶
func NewRecordFromRecordData(recordData *RecordCreate, folder *Folder) *Record
func NewRecordFromRecordDataWithUid ¶
func NewRecordFromRecordDataWithUid(recordUid string, recordData *RecordCreate, folder *Folder) *Record
func (*Record) AddCustomField ¶
AddCustomField adds new custom field to the record The new field must satisfy the IsFieldClass function
func (*Record) DownloadFileByTitle ¶
func (*Record) FieldExists ¶
func (*Record) FindFile ¶
func (r *Record) FindFile(name string) *KeeperFile
FindFile finds the first file with matching file UID, name or title
func (*Record) FindFileByFilename ¶
func (r *Record) FindFileByFilename(filename string) *KeeperFile
FindFileByName finds the first file with matching filename
func (*Record) FindFileByTitle ¶
func (r *Record) FindFileByTitle(title string) *KeeperFile
FindFileByTitle finds the first file with matching title
func (*Record) FindFiles ¶
func (r *Record) FindFiles(name string) []*KeeperFile
FindFiles finds all files with matching file UID, name or title
func (*Record) GetCustomFieldValue ¶
func (*Record) GetCustomFieldValueByLabel ¶
GetCustomFieldValueByLabel returns string value of the *first* field from custom[] that matches fieldLabel
func (*Record) GetCustomFieldValueByType ¶
GetCustomFieldValueByType returns string value of the *first* field from custom[] that matches fieldType
func (*Record) GetCustomFieldValues ¶
func (*Record) GetCustomFieldsByLabel ¶
func (*Record) GetCustomFieldsByType ¶
func (*Record) GetFieldValueByLabel ¶
GetFieldValueByLabel returns string value of the *first* field from fields[] that matches fieldLabel
func (*Record) GetFieldValueByType ¶
GetFieldValueByType returns string value of the *first* field from fields[] that matches fieldType
func (*Record) GetFieldValuesByType ¶
func (*Record) GetFieldsByLabel ¶
func (*Record) GetFieldsByMask ¶
func (r *Record) GetFieldsByMask(fieldToken string, fieldTokenFlag FieldTokenFlag, fieldType FieldSectionFlag) []map[string]interface{}
GetFieldsByMask returns all fields from the corresponding field section (fields, custom or both) where fieldToken matches the FieldTokenFlag (type, label or both)
func (*Record) GetFieldsBySection ¶
func (r *Record) GetFieldsBySection(fieldSectionType FieldSectionFlag) []interface{}
func (*Record) GetFieldsByType ¶
func (*Record) GetStandardFieldValue ¶
func (*Record) InsertField ¶
func (*Record) SetCustomFieldValue ¶
func (*Record) SetCustomFieldValueSingle ¶
func (*Record) SetFieldValueSingle ¶
func (*Record) SetPassword ¶
func (*Record) SetStandardFieldValue ¶
func (*Record) UpdateField ¶
type RecordCreate ¶
type RecordCreate struct { RecordType string `json:"type,omitempty"` Title string `json:"title,omitempty"` Notes string `json:"notes,omitempty"` Fields []interface{} `json:"fields,omitempty"` Custom []interface{} `json:"custom,omitempty"` }
func NewRecordCreate ¶
func NewRecordCreate(recordType, title string) *RecordCreate
func NewRecordCreateFromJson ¶
func NewRecordCreateFromJson(recordJson string) *RecordCreate
func NewRecordCreateFromJsonDecoder ¶
func NewRecordCreateFromJsonDecoder(recordJson string, disallowUnknownFields bool) (*RecordCreate, error)
func (RecordCreate) GetFieldByType ¶
func (r RecordCreate) GetFieldByType(field interface{}) interface{}
GetFieldByType returns first found field of the same type as field param The search goes first through fields[] then custom[] Note: Method returns a pointer so any value modifications are reflected directly in the record
func (RecordCreate) GetFieldsByType ¶
func (r RecordCreate) GetFieldsByType(field interface{}) []interface{}
GetFieldsByType returns all fields of the same type as field param The search goes first through fields[] then custom[] Note: Method returns pointers so any value modifications are reflected directly in the record
func (RecordCreate) ToDict ¶
func (r RecordCreate) ToDict() map[string]interface{}
func (RecordCreate) ToJson ¶
func (r RecordCreate) ToJson() string
type RecordField ¶
func NewRecordField ¶
func NewRecordField(fieldType, label string, required bool, value interface{}) *RecordField
type Secret ¶
type Secret struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
type SecretsManager ¶
type SecretsManager struct { Token string Hostname string VerifySslCerts bool Config IKeyValueStorage // contains filtered or unexported fields }
func NewSecretsManager ¶
func NewSecretsManager(options *ClientOptions, arg ...interface{}) *SecretsManager
NewSecretsManager returns new *SecretsManager initialized with the options provided. If the configuration file cannot be initialized or parsed returns nil
func (*SecretsManager) CreateSecret ¶
func (c *SecretsManager) CreateSecret(record *Record) (recordUid string, err error)
func (*SecretsManager) CreateSecretWithRecordData ¶
func (c *SecretsManager) CreateSecretWithRecordData(recUid, folderUid string, recordData *RecordCreate) (recordUid string, err error)
CreateSecretWithRecordData creates new record using recordUID, folderUID and record data provided Note: if param recUid is empty - new auto generated record UID will be used
func (*SecretsManager) DefaultKeeperServerPublicKeyId ¶
func (c *SecretsManager) DefaultKeeperServerPublicKeyId() string
func (*SecretsManager) DeleteSecrets ¶
func (c *SecretsManager) DeleteSecrets(recordUids []string) (statuses map[string]string, err error)
func (*SecretsManager) FindNotation ¶
func (c *SecretsManager) FindNotation(records []*Record, notation string) (fieldValue []interface{}, err error)
func (*SecretsManager) GenerateTransmissionKey ¶
func (c *SecretsManager) GenerateTransmissionKey(keyId string) *TransmissionKey
func (*SecretsManager) GetNotation
deprecated
func (c *SecretsManager) GetNotation(notation string) (fieldValue []interface{}, err error)
Deprecated: Use GetNotationResults instead.
func (*SecretsManager) GetNotationResults ¶
func (c *SecretsManager) GetNotationResults(notation string) ([]string, error)
GetNotationResults returns a string list with all values specified by the notation or throws an error. Use TryGetNotationResults to just log errors and continue returning an empty string list on error.
func (*SecretsManager) GetSecretByTitle ¶
func (c *SecretsManager) GetSecretByTitle(recordTitle string) (record *Record, err error)
func (*SecretsManager) GetSecrets ¶
func (c *SecretsManager) GetSecrets(uids []string) (records []*Record, err error)
func (*SecretsManager) GetSecretsByTitle ¶
func (c *SecretsManager) GetSecretsByTitle(recordTitle string) (records []*Record, err error)
func (*SecretsManager) GetSecretsFullResponse ¶
func (c *SecretsManager) GetSecretsFullResponse(uids []string) (response *SecretsManagerResponse, err error)
func (*SecretsManager) HandleHttpError ¶
func (*SecretsManager) LoadSecretKey ¶
func (c *SecretsManager) LoadSecretKey() string
Returns client_id from the environment variable, config file, or in the code
func (*SecretsManager) NotationPrefix ¶
func (c *SecretsManager) NotationPrefix() string
func (*SecretsManager) PostFunction ¶
func (c *SecretsManager) PostFunction( url string, transmissionKey *TransmissionKey, encryptedPayloadAndSignature *EncryptedPayload, verifySslCerts bool) (*KsmHttpResponse, error)
func (*SecretsManager) PostQuery ¶
func (c *SecretsManager) PostQuery(path string, payload interface{}) (body []byte, err error)
func (*SecretsManager) PrepareContext ¶
func (c *SecretsManager) PrepareContext() *Context
func (*SecretsManager) Save ¶
func (c *SecretsManager) Save(record *Record) (err error)
func (*SecretsManager) SetCache ¶
func (c *SecretsManager) SetCache(cache ICache)
func (*SecretsManager) TryGetNotationResults ¶
func (c *SecretsManager) TryGetNotationResults(notation string) []string
TryGetNotationResults returns a string list with all values specified by the notation or empty list on error. It simply logs any errors and continue returning an empty string list on error.
func (*SecretsManager) UploadFile ¶
func (c *SecretsManager) UploadFile(record *Record, file *KeeperFileUpload) (uid string, err error)
func (*SecretsManager) UploadFilePath ¶
func (c *SecretsManager) UploadFilePath(record *Record, filePath string) (uid string, err error)
type SecretsManagerResponse ¶
type SecretsManagerResponse struct { AppData AppData Folders []*Folder Records []*Record ExpiresOn int64 Warnings string JustBound bool }
Server response contained details about the application and the records that were requested to be returned
func (SecretsManagerResponse) ExpiresOnStr ¶
func (r SecretsManagerResponse) ExpiresOnStr(dateFormat string) string
ExpiresOnStr retrieves string formatted expiration date if dateFormat is empty default format is used: "%Y-%m-%d %H:%M:%S"
type SecureNote ¶
type SecureNote struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
func NewSecureNote ¶
func NewSecureNote(value string) *SecureNote
SecureNote field constructor with the single value to eliminate the complexity of the passing List as a value
type SecurityQuestion ¶
type SecurityQuestions ¶
type SecurityQuestions struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []SecurityQuestion `json:"value,omitempty"` }
func NewSecurityQuestions ¶
func NewSecurityQuestions(value SecurityQuestion) *SecurityQuestions
SecurityQuestions field constructor with the single value to eliminate the complexity of the passing List as a value
type TOTP ¶
type TOTP struct { Secret string // Secret key (required) Digits int // OTP digit count (default: 6) Algorithm string // OTP Algorithm ("SHA1" or "SHA256" or "SHA512") (default: SHA1) Period int64 // Period for which OTP is valid (seconds) (default: 30) == X in RFC6238 UnixTime int64 // (Optional) Unix Timestamp (default: Current unix timestamp) }
TOTP represents Time-based OTP - https://datatracker.ietf.org/doc/html/rfc6238
type Text ¶
type Text struct { KeeperRecordField Required bool `json:"required,omitempty"` PrivacyScreen bool `json:"privacyScreen,omitempty"` Value []string `json:"value,omitempty"` }
type TotpCode ¶
type TotpCode struct { Code string // TOTP Code TimeLeft int // Time left in seconds (time before expiration) Period int // Period in seconds }
TotpCode provides detailed info about the generated TOTP code
func GetTotpCode ¶
Generates TOTP code from the URL and returns OTP as string, seconds remaining and any error encountered.
type TransmissionKey ¶
func NewTransmissionKey ¶
func NewTransmissionKey(publicKeyId string, key []byte, encryptedKey []byte) *TransmissionKey
type UpdatePayload ¶
type UpdatePayload struct { ClientVersion string `json:"clientVersion"` ClientId string `json:"clientId"` RecordUid string `json:"recordUid"` Revision int64 `json:"revision"` Data string `json:"data"` }
func (*UpdatePayload) UpdatePayloadFromJson ¶
func (p *UpdatePayload) UpdatePayloadFromJson(jsonData string)
func (*UpdatePayload) UpdatePayloadToJson ¶
func (p *UpdatePayload) UpdatePayloadToJson() (string, error)