Sha256: aec47c1565ce81f1db5ee401fe9f98f975dc3b4e3f8e68db67c2f1ebcc0e7cb4

Contents?: true

Size: 997 Bytes

Versions: 3

Compression:

Stored size: 997 Bytes

Contents

# encoding: binary
# frozen_string_literal: true

RSpec.describe RbNaCl::SigningKey do
  let(:signing_key)     { vector :sign_private }
  let(:signing_keypair) { vector :sign_keypair }
  let(:message)         { vector :sign_message }
  let(:signature)       { vector :sign_signature }

  subject { described_class.new(signing_key) }

  it "generates keys" do
    expect(described_class.generate).to be_a described_class
  end

  it "signs messages as bytes" do
    expect(subject.sign(message)).to eq signature
  end

  it "serializes to bytes" do
    expect(subject.to_bytes).to eq signing_key
  end

  it "serializes the internal signing key to bytes" do
    expect(subject.keypair_bytes.length).to eq 64
    expect(subject.keypair_bytes).to eq signing_keypair
  end

  include_examples "key equality" do
    let(:key_bytes) { signing_key }
    let(:key)       { described_class.new(key_bytes) }
    let(:other_key) { described_class.new("B" * 32) }
  end

  include_examples "serializable"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rbnacl-7.0.0 spec/rbnacl/signatures/ed25519/signing_key_spec.rb
rbnacl-6.0.1 spec/rbnacl/signatures/ed25519/signing_key_spec.rb
rbnacl-6.0.0 spec/rbnacl/signatures/ed25519/signing_key_spec.rb