Sha256: 54e0c45c37cdcb7fddc7150f29decf88603fd06a06be9250d0c2f632cc8a120d

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Pubnub
  module Crypto
    # Base class which is used to implement a module that can be used to
    # configure <b>PubNub</b> client or for manual data encryption and
    # decryption.
    class CryptoProvider
      # Encrypt provided data.
      #
      # @param data [String] Source data for encryption.
      # @return [String, nil] Encrypted data or <i>nil</i> in case of encryption
      #   error.
      def encrypt(data)
        raise NotImplementedError, 'Subclass should provide "encrypt" method implementation.'
      end

      # Decrypt provided data.
      #
      # @param data [String] Encrypted data for decryption.
      # @return [String, nil] Decrypted data or <i>nil</i> in case of decryption
      #   error.
      #
      # @raise [UnknownCryptorError] If the <i>cryptor</i> for data processing is
      #   not registered.
      def decrypt(data)
        raise NotImplementedError, 'Subclass should provide "decrypt" method implementation.'
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pubnub-5.5.0 lib/pubnub/modules/crypto/crypto_provider.rb
pubnub-5.4.0 lib/pubnub/modules/crypto/crypto_provider.rb
pubnub-5.3.5 lib/pubnub/modules/crypto/crypto_provider.rb
pubnub-5.3.4 lib/pubnub/modules/crypto/crypto_provider.rb
pubnub-5.3.3 lib/pubnub/modules/crypto/crypto_provider.rb
pubnub-5.3.2 lib/pubnub/modules/crypto/crypto_provider.rb
pubnub-5.3.1 lib/pubnub/modules/crypto/crypto_provider.rb
pubnub-5.3.0 lib/pubnub/modules/crypto/crypto_provider.rb