Class: Tipi::ACME::InMemoryCertificateStore

Inherits:
Object
  • Object
show all
Defined in:
lib/tipi/acme.rb

Instance Method Summary collapse

Constructor Details

#initializeInMemoryCertificateStore

Returns a new instance of InMemoryCertificateStore.



242
243
244
# File 'lib/tipi/acme.rb', line 242

def initialize
  @store = {}
end

Instance Method Details

#get(name) ⇒ Object



254
255
256
257
258
259
260
261
262
263
# File 'lib/tipi/acme.rb', line 254

def get(name)
  entry = @store[name]
  return nil unless entry
  if Time.now >= entry[:expired_stamp]
    @store.delete(name)
    return nil
  end

  entry
end

#set(name, private_key:, certificate:, expired_stamp:) ⇒ Object



246
247
248
249
250
251
252
# File 'lib/tipi/acme.rb', line 246

def set(name, private_key:, certificate:, expired_stamp:)
  @store[name] = {
    private_key:    private_key,
    certificate:    certificate,
    expired_stamp:  expired_stamp
  }
end