Merge pull request #15 from place-labs/fix/aead-chalsa-signature

Fix `#encrypt_detached` for crystal 1.2.0
master
didactic-drunk 2022-03-09 12:54:53 -08:00 committed by GitHub
commit bbbbcbd856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View File

@ -9,9 +9,23 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: "crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }}"
continue-on-error: ${{ !matrix.stable }}
strategy:
fail-fast: false
matrix:
stable: [true]
crystal:
- 1.0.0
- 1.1.0
- 1.1.1
- 1.2.0
include:
- crystal: nightly
stable: false
container:
image: crystallang/crystal
image: crystallang/crystal:${{ matrix.crystal }}
steps:
- uses: actions/checkout@v2
@ -31,8 +45,7 @@ jobs:
- name: Install dependencies
run: shards install
- name: Run tests
run: crystal spec -Dpreview_mt --order random
# run: crystal spec -Dpreview_mt --order random --error-on-warnings
run: crystal spec -Dpreview_mt --order random
- name: Run bulid
run: shards build -Dpreview_mt
- name: Run format
@ -40,4 +53,3 @@ jobs:
- name: Failed
if: ${{ failure() }}
run: "[ -f libsodium_install.out ] && cat libsodium_install.out"

View File

@ -4,7 +4,7 @@ version: 1.2.3
authors:
- Andrew Hamon <andrew@hamon.cc>
- Didactic Drunk <1479616+didactic-drunk@users.noreply.github.com>
crystal: ">= 0.36.0"
crystal: ">= 1.0.0"
targets:
blake2b_hash:
main: examples/blake2b_hash.cr

View File

@ -103,7 +103,7 @@ module Sodium::Cipher::Aead
# `src` and `dst` may be the same object but should not overlap.
# May supply `mac`, otherwise a new one is returned.
# May supply `additional`
def encrypt_detached(src : Bytes, dst : Bytes? = nil, nonce : Sodium::Nonce? = nil, *, mac : Bytes? = nil, additional : String | Bytes | Nil = nil) : {Bytes, Bytes, Sodium::Nonce}
def encrypt_detached(src : Bytes, dst : Bytes? = nil, *, nonce : Sodium::Nonce? = nil, mac : Bytes? = nil, additional : String | Bytes | Nil = nil) : {Bytes, Bytes, Sodium::Nonce}
dst ||= Bytes.new src.bytesize
nonce ||= Sodium::Nonce.random
mac ||= Bytes.new MAC_SIZE