Documentation
¶
Index ¶
- type Base
- type KPMap
- func (m *KPMap) ChangeKey(old, new string)
- func (m *KPMap) Decode() error
- func (m *KPMap) Decrypt(key [32]byte) error
- func (m *KPMap) Decrypted(key [32]byte) (*KPMap, error)
- func (m *KPMap) Delete(key string)
- func (m *KPMap) DeleteValues()
- func (m *KPMap) Encode()
- func (m *KPMap) Encrypt(key [32]byte) error
- func (m *KPMap) Encrypted(key [32]byte) (*KPMap, error)
- func (m *KPMap) FmtString(key string) string
- func (m *KPMap) FmtStrings() []string
- func (m *KPMap) Get(key string) *Payload
- func (m *KPMap) GetMapping() map[string]*Payload
- func (m *KPMap) GetValue(key string) string
- func (m *KPMap) IsEmpty() bool
- func (m *KPMap) Keys() []string
- func (m *KPMap) Load(mapping *KPMap)
- func (m *KPMap) MarkAllDecoded()
- func (m *KPMap) MarkAllEncoded()
- func (m *KPMap) MarkDecoded(key string)
- func (m *KPMap) MarkEncoded(key string)
- func (m *KPMap) MarkExposable(key string)
- func (m *KPMap) MarkNotExposable(key string)
- func (m *KPMap) MarshalJSON() ([]byte, error)
- func (m *KPMap) Overwrite(source *KPMap)
- func (m *KPMap) Set(key string, value *Payload)
- func (m *KPMap) SetValue(key, value string)
- func (m *KPMap) ToKVMap() *KVMap
- func (m *KPMap) UnmarshalJSON(data []byte) error
- type KVMap
- func (m *KVMap) Delete(key string)
- func (m *KVMap) Get(key string) string
- func (m *KVMap) GetMapping() map[string]string
- func (m *KVMap) MarshalJSON() ([]byte, error)
- func (m *KVMap) MarshalYAML() ([]byte, error)
- func (m *KVMap) Set(key, value string)
- func (m *KVMap) String(key string) string
- func (m *KVMap) UnmarshalIn(i interface{}) error
- func (m *KVMap) UnmarshalJSON(data []byte) error
- func (m *KVMap) UnmarshalYAML(data []byte) error
- type Payload
- func (p *Payload) Decode() error
- func (p *Payload) Decrypt(key [32]byte) error
- func (p *Payload) Decrypted(key [32]byte) (*Payload, error)
- func (p *Payload) DeleteValue()
- func (p *Payload) Encode()
- func (p *Payload) Encrypt(key [32]byte) error
- func (p *Payload) Encrypted(key [32]byte) (*Payload, error)
- func (p *Payload) GetValue() string
- func (p *Payload) IsEmpty() bool
- func (p *Payload) IsEncoded() bool
- func (p *Payload) IsExposable() bool
- func (p *Payload) MarkDecoded()
- func (p *Payload) MarkEncoded()
- func (p *Payload) MarkExposable()
- func (p *Payload) MarkNotExposable()
- func (p *Payload) Set(value string)
- func (p *Payload) ToMap() (result map[string]interface{}, err error)
- type Secret
- func (s *Secret) ChangeKey(old, new string)
- func (s *Secret) DataCopy() KPMap
- func (s *Secret) Decode() error
- func (s *Secret) Decrypt(key [32]byte) error
- func (s *Secret) Decrypted(key [32]byte) (result *Secret, err error)
- func (s *Secret) Delete(key string)
- func (s *Secret) DeleteValues()
- func (s *Secret) Encode()
- func (s *Secret) Encrypt(key [32]byte) error
- func (s *Secret) Encrypted(key [32]byte) (*Secret, error)
- func (s *Secret) Get(key string) *Payload
- func (s *Secret) GetFmtString(key string) string
- func (s *Secret) GetValue(key string) string
- func (s *Secret) IncrementVersion()
- func (s *Secret) IsEmpty() bool
- func (s *Secret) MarkEncoded()
- func (s *Secret) MarkExposable(key string)
- func (s *Secret) MarkNotExposable(key string)
- func (s *Secret) Overwrite(source *KPMap)
- func (s *Secret) Set(key string, value *Payload)
- func (s *Secret) ToKVMap() *KVMap
- func (s *Secret) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct { // Primary identifier of an object of this structure. // // required: true ID string `json:"id,omitempty"` // The “normalised” UTC timestamp with time zone at which this object was created. // // In postgreSQL, this is a "Timestamptz" type field. // // For example, if your input string is: 2018-08-28T12:30:00+05:30 , when this timestamp is stored in the database, it will be stored as 2018-08-28T07:00:00. // // required: true CreatedAt time.Time `json:"created_at,omitempty"` // The “normalised” UTC timestamp with time zone at which this object was last updated. // // In postgreSQL, this is a "Timestamptz" type field. // // For example, if your input string is: 2018-08-28T12:30:00+05:30 , when this timestamp is stored in the database, it will be stored as 2018-08-28T07:00:00. // // required: true UpdatedAt time.Time `json:"updated_at,omitempty"` }
The base structure embeded in every structure that represents a table in our database. This structure shouldn't be of much use to those who only intend to use the secrets structure for data transformations.
type KPMap ¶
Key-Payload Map
func (*KPMap) Decrypted ¶
Decrypts all the key=value pairs with the provided key and returns a new deep copy of the map.
func (*KPMap) DeleteValues ¶
func (m *KPMap) DeleteValues()
Empties the values from the payloads of all key=value pairs.
func (*KPMap) Encrypted ¶
Encrypts all the key=value pairs with the provided key and returns a new deep copy of the map.
func (*KPMap) FmtStrings ¶
Returns an array of string representations in the form of "key=value"
func (*KPMap) MarkAllDecoded ¶
func (m *KPMap) MarkAllDecoded()
Marks all payload values as Base64 decoded.
func (*KPMap) MarkAllEncoded ¶
func (m *KPMap) MarkAllEncoded()
Marks all payload values as Base64 encoded.
func (*KPMap) MarkDecoded ¶
Marks payload value for specified key as Base64 decoded.
func (*KPMap) MarkEncoded ¶
Marks payload value for specified key as Base64 encoded.
func (*KPMap) MarkExposable ¶
Marks the "exposable" value of the payload as "true."
Exposability allows the value to be synced as an exposable one on platforms which differentiate between decryptable and non-decryptable secrets. For example, Github and Vercel. In Github actions, this value will be synced as a "variable" and NOT a secret, once it is marked "exposable" over here.
func (*KPMap) MarkNotExposable ¶
func (*KPMap) Overwrite ¶
Ovewrites or replaces values in the map for respective keys from supplied map.
type KVMap ¶
Map representing key=value pairs.
func (*KVMap) GetMapping ¶
Returns the mapping from the KVMap.
func (*KVMap) UnmarshalIn ¶
Unmarshalls the json in provided interface.
type Payload ¶
type Payload struct { sync.Mutex Value string `json:"value,omitempty"` // Allows the value to be synced as an exposable one // on platforms which differentiate between decryptable and non-decryptable secrets. // For example, Github and Vercel. Exposable bool `json:"exposable,omitempty"` // contains filtered or unexported fields }
func (*Payload) Decrypted ¶
Decrypts the value of the payload and returns a new deep copy of the payload.
func (*Payload) Encrypted ¶
Encrypts the value of the payload with the supplied key and returns a new deep copy of the payload.
func (*Payload) IsEmpty ¶
Returns boolean indicating whether the value of the payload is empty or not.
func (*Payload) IsExposable ¶
Returns a boolean validating whether a value is exposable or not.
func (*Payload) MarkExposable ¶
func (p *Payload) MarkExposable()
Marks the "exposable" value of the payload as "true."
Exposability allows the value to be synced as an exposable one on platforms which differentiate between decryptable and non-decryptable secrets. For example, Github and Vercel. In Github actions, this value will be synced as a "variable" and NOT a secret, once it is marked "exposable" over here.
func (*Payload) MarkNotExposable ¶
func (p *Payload) MarkNotExposable()
Marks the "exposable" value of the payload as "false."
Read the documentation of "MarkExposable" function.
type Secret ¶
type Secret struct { Base // The UUID of the user in our database who created this secret. // // reference: https://en.wikipedia.org/wiki/Universally_unique_identifier // required: true UserID string `json:"user_id,omitempty"` // The UUID of the project environment in our database this secret belongs to. // // reference: https://en.wikipedia.org/wiki/Universally_unique_identifier // required: true EnvID string `json:"env_id,omitempty"` // The version of this secret. // When the secret is created, the default version is 1. // While fetching the secret, sometimes the version may not be fetched, therefore, it is a pointer which can be nil. // // required: false // default: 0 Version *int `json:"version,omitempty"` // The mapping of all the key-value pairs this secret contains. // // format: dto.KPMap // required: true Data *KPMap `json:"data,omitempty"` }
func (*Secret) Decrypted ¶
Decrypts all the key=value pairs with provided key and returns a new deep copy of the secret data without mutating the existing one.
func (*Secret) DeleteValues ¶
func (s *Secret) DeleteValues()
Empties the values from the payloads of all key=value pairs.
func (*Secret) Encrypted ¶
Encrypts all the key=value pairs with provided key and returns a new deep copy of the secret data without mutating the existing one.
func (*Secret) GetFmtString ¶
Get formatted string.
Fetches key=value representation for a specific key and value from the map.
func (*Secret) IncrementVersion ¶
func (s *Secret) IncrementVersion()
Increases the version of the secret by 1.
func (*Secret) MarkEncoded ¶
func (s *Secret) MarkEncoded()
Marks all payload values as Base64 encoded.
func (*Secret) MarkExposable ¶
Marks the "exposable" value of the payload as "true."
Exposability allows the value to be synced as an exposable one on platforms which differentiate between decryptable and non-decryptable secrets. For example, Github and Vercel. In Github actions, this value will be synced as a "variable" and NOT a secret, once it is marked "exposable" over here.
func (*Secret) MarkNotExposable ¶
func (*Secret) Overwrite ¶
Ovewrites or replaces values in the map for respective keys from supplied map.