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

Fix `#encrypt_detached` for crystal 1.2.0
This commit is contained in:
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: jobs:
build: build:
runs-on: ubuntu-latest 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: container:
image: crystallang/crystal image: crystallang/crystal:${{ matrix.crystal }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -31,8 +45,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: shards install run: shards install
- name: Run tests - name: Run tests
run: crystal spec -Dpreview_mt --order random run: crystal spec -Dpreview_mt --order random
# run: crystal spec -Dpreview_mt --order random --error-on-warnings
- name: Run bulid - name: Run bulid
run: shards build -Dpreview_mt run: shards build -Dpreview_mt
- name: Run format - name: Run format
@ -40,4 +53,3 @@ jobs:
- name: Failed - name: Failed
if: ${{ failure() }} if: ${{ failure() }}
run: "[ -f libsodium_install.out ] && cat libsodium_install.out" run: "[ -f libsodium_install.out ] && cat libsodium_install.out"

View File

@ -4,7 +4,7 @@ version: 1.2.3
authors: authors:
- Andrew Hamon <andrew@hamon.cc> - Andrew Hamon <andrew@hamon.cc>
- Didactic Drunk <1479616+didactic-drunk@users.noreply.github.com> - Didactic Drunk <1479616+didactic-drunk@users.noreply.github.com>
crystal: ">= 0.36.0" crystal: ">= 1.0.0"
targets: targets:
blake2b_hash: blake2b_hash:
main: examples/blake2b_hash.cr 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. # `src` and `dst` may be the same object but should not overlap.
# May supply `mac`, otherwise a new one is returned. # May supply `mac`, otherwise a new one is returned.
# May supply `additional` # 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 dst ||= Bytes.new src.bytesize
nonce ||= Sodium::Nonce.random nonce ||= Sodium::Nonce.random
mac ||= Bytes.new MAC_SIZE mac ||= Bytes.new MAC_SIZE