Fix Crystal 0.31 warnings.

master
Didactic Drunk 2019-11-10 19:00:22 -08:00
parent 59d8d543b2
commit 61191d96a6
10 changed files with 16 additions and 10 deletions

View File

@ -4,7 +4,7 @@ version: 1.1.0
authors:
- Andrew Hamon <andrew@hamon.cc>
- Didactic Drunk <1479616+didactic-drunk@users.noreply.github.com>
crystal: 0.29.0
crystal: 0.31.1
targets:
pwhash_selector:
main: examples/pwhash_selector.cr

View File

@ -72,8 +72,8 @@ module Sodium::Cipher
end
abstract def update(src : Bytes, dst : Bytes)
abstract def key_size
abstract def nonce_size
abstract def key_size : Int32
abstract def nonce_size : Int32
end
{% for key, val in {"XSalsa20" => "xsalsa20", "Salsa20" => "salsa20", "XChaCha20" => "xchacha20", "ChaCha20Ietf" => "chacha20_ietf", "ChaCha20" => "chacha20"} %}

View File

@ -7,7 +7,7 @@ class Sodium::CryptoBox
SEAL_SIZE = LibSodium.crypto_box_sealbytes
# Returns key
delegate to_slice, to: @bytes
delegate_to_slice to: @bytes
# :nodoc:
# Only used by SecretKey

View File

@ -42,7 +42,7 @@ class Sodium::CryptoBox
getter public_key : PublicKey
# Returns key
delegate to_slice, to: @sbuf
delegate_to_slice to: @sbuf
@seed : SecureBuffer?

View File

@ -23,7 +23,7 @@ module Sodium
CONTEXT_SIZE = LibSodium.crypto_kdf_contextbytes
# Returns key
delegate to_slice, to: @sbuf
delegate_to_slice to: @sbuf
# Use an existing KDF key.
#

View File

@ -1,6 +1,12 @@
require "random/secure"
require "./error"
macro delegate_to_slice(to object)
def to_slice() : Bytes
{{object.id}}.to_slice
end
end
module Sodium
@[Link(ldflags: "`#{__DIR__}/../../build/pkg-libs.sh #{__DIR__}/../..`")]
lib LibSodium

View File

@ -16,7 +16,7 @@ module Sodium
property? reusable = false
# Returns bytes
delegate to_slice, to: @bytes
delegate_to_slice to: @bytes
delegate bytesize, to: @bytes

View File

@ -20,7 +20,7 @@ module Sodium
MAC_SIZE = LibSodium.crypto_secretbox_macbytes.to_i
# Returns key
delegate to_slice, to: @key
delegate_to_slice to: @key
# Encryption key
getter key : SecureBuffer

View File

@ -6,7 +6,7 @@ module Sodium
SIG_SIZE = LibSodium.crypto_sign_bytes.to_i
# Returns key
delegate to_slice, to: @bytes
delegate_to_slice to: @bytes
# :nodoc:
# Only used by SecretKey

View File

@ -21,7 +21,7 @@ module Sodium
getter public_key : PublicKey
# Returns key
delegate to_slice, to: @sbuf
delegate_to_slice to: @sbuf
@seed : SecureBuffer?