Class: AtprotoAuth::Encryption::KeyProvider
- Inherits:
-
Object
- Object
- AtprotoAuth::Encryption::KeyProvider
- Defined in:
- lib/atproto_auth/encryption.rb
Overview
Handles key management and derivation
Instance Method Summary collapse
-
#initialize ⇒ KeyProvider
constructor
A new instance of KeyProvider.
- #key_for_context(context) ⇒ Object
Constructor Details
#initialize ⇒ KeyProvider
Returns a new instance of KeyProvider.
123 124 125 |
# File 'lib/atproto_auth/encryption.rb', line 123 def initialize @master_key = load_master_key end |
Instance Method Details
#key_for_context(context) ⇒ Object
127 128 129 130 131 132 133 134 135 136 |
# File 'lib/atproto_auth/encryption.rb', line 127 def key_for_context(context) raise ConfigurationError, "Context is required" if context.nil? HKDF.derive( @master_key, salt: salt_for_context(context), info: "atproto-#{context}", length: 32 ) end |