Class: Aspera::Keychain::Base
- Inherits:
-
Object
- Object
- Aspera::Keychain::Base
- Defined in:
- lib/aspera/keychain/base.rb
Direct Known Subclasses
EncryptedHash, HashicorpVault, MacosSystem, OnePasswordApi, OnePasswordCli
Constant Summary collapse
- CONTENT_KEYS =
%i[label username password url description].freeze
Instance Method Summary collapse
-
#ids ⇒ Object
Returns a lightweight list: one Hash per secret with :label (and :id if the backend has one).
- #validate_set(options) ⇒ Object
Instance Method Details
#ids ⇒ Object
Returns a lightweight list: one Hash per secret with :label (and :id if the backend has one). Override in subclasses that can provide this cheaply without fetching full item details.
10 11 12 |
# File 'lib/aspera/keychain/base.rb', line 10 def ids all.map { |s| s.slice(:id, :label).compact } end |
#validate_set(options) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/aspera/keychain/base.rb', line 14 def validate_set() Aspera.assert_type(, Hash) { 'options' } unsupported = .keys - CONTENT_KEYS Aspera.assert(unsupported.empty?) { "unsupported options: #{unsupported}, use #{CONTENT_KEYS.join(', ')}" } .each_pair do |k, v| Aspera.assert_type(v, String) { k.to_s } end Aspera.assert(.key?(:label), 'label is required') end |