Sha256: 5b7c4b1cf18b5727df839c844ee2c5f6d81e5683009b57c62d92f94a05cd3fc8

Contents?: true

Size: 974 Bytes

Versions: 143

Compression:

Stored size: 974 Bytes

Contents

module Enveloperb
  # An envelope encrypted record.
  class EncryptedRecord
    # Create an encrypted record from a serialized form.
    #
    # Encrypted records can be serialized (using #to_s), and then deserialized by passing them into this constructor.
    #
    # @param s [String] the serialized encrypted record.
    #   This must be a `BINARY` encoded string.
    #
    # @raises [ArgumentError] if something other than a binary string is provided, or if the string passed as the serialized encrypted record is not valid.
    #
    def self.new(s)
      unless s.is_a?(String) && s.encoding == Encoding::BINARY
        raise ArgumentError, "Serialized encrypted record must be a binary string"
      end

      _new(s)
    end

    # Serialize an encrypted record into a string.
    #
    # @return [String]
    #
    # @raise [RuntimeError] if something goes spectacularly wrong with the serialization process.
    #
    def to_s
      _serialize
    end
  end
end

Version data entries

143 entries across 143 versions & 1 rubygems

Version Path
enveloperb-0.9.0-arm64-darwin lib/enveloperb/encrypted_record.rb
enveloperb-0.9.0-x86_64-darwin lib/enveloperb/encrypted_record.rb
enveloperb-0.9.0-aarch64-linux lib/enveloperb/encrypted_record.rb
enveloperb-0.9.0-x86_64-linux lib/enveloperb/encrypted_record.rb
enveloperb-0.9.0 lib/enveloperb/encrypted_record.rb
enveloperb-0.0.0.1.ENOTAG-arm64-darwin lib/enveloperb/encrypted_record.rb
enveloperb-0.0.0.1.ENOTAG-x86_64-darwin lib/enveloperb/encrypted_record.rb
enveloperb-0.0.0.1.ENOTAG-x86_64-linux lib/enveloperb/encrypted_record.rb
enveloperb-0.0.0.1.ENOTAG-aarch64-linux lib/enveloperb/encrypted_record.rb
enveloperb-0.0.0.1.ENOTAG lib/enveloperb/encrypted_record.rb
enveloperb-0.4.2-aarch64-linux lib/enveloperb/encrypted_record.rb
enveloperb-0.4.2-x86_64-darwin lib/enveloperb/encrypted_record.rb
enveloperb-0.4.1.3.gc72a7ca-arm64-darwin lib/enveloperb/encrypted_record.rb
enveloperb-0.4.1.3.gc72a7ca-aarch64-linux lib/enveloperb/encrypted_record.rb
enveloperb-0.4.1.3.gc72a7ca-x86_64-darwin lib/enveloperb/encrypted_record.rb
enveloperb-0.4.2-x86_64-linux lib/enveloperb/encrypted_record.rb
enveloperb-0.4.2-arm64-darwin lib/enveloperb/encrypted_record.rb
enveloperb-0.4.1.3.gc72a7ca-x86_64-linux lib/enveloperb/encrypted_record.rb
enveloperb-0.4.2 lib/enveloperb/encrypted_record.rb
enveloperb-0.4.1.3.gc72a7ca lib/enveloperb/encrypted_record.rb