Sha256: d0427ed9a6259e13ff287aa4513fa57ed89f87d88f13af605cec7a882fd96eff

Contents?: true

Size: 696 Bytes

Versions: 3

Compression:

Stored size: 696 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Paseto
  module ASN1
    class OneAsymmetricKey < T::Struct
      extend T::Sig

      const :version, OpenSSL::BN
      const :algorithm, PrivateKeyAlgorithmIdentifier
      const :private_key, PrivateKey
      const :public_key, T.nilable(PublicKey)

      sig { returns(OpenSSL::ASN1::Sequence) }
      def build
        OpenSSL::ASN1::Sequence.new(
          [
            OpenSSL::ASN1::Integer.new(version),
            algorithm.build,
            private_key.build
            # public_key&.build
          ].compact
        )
      end

      sig { returns(String) }
      def to_der
        build.to_der
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-paseto-0.1.2 lib/paseto/asn1/one_asymmetric_key.rb
ruby-paseto-0.1.1 lib/paseto/asn1/one_asymmetric_key.rb
ruby-paseto-0.1.0 lib/paseto/asn1/one_asymmetric_key.rb