Commit Graph
75 Commits
Author SHA1 Message Date
Christophe Diederichs 0fba70b6fa add crypto_auth_hmac methods 2020-09-03 12:49:05 +02:00
Mathias Buus a546f3e51d 0.6.2 v0.6.2 2020-08-12 15:40:16 +02:00
Emil BayandMathias Buus a338ae9f9d Missing helpers (#24)
* Detach buffers by sending to an empty message channel

* Move helpers out

* fix import

* export helpers

* Try browser testing

* messagechannel check

* xvfb-run --auto-servernum npm run test-browser fails weirdly on ci, removing

Co-authored-by: Mathias Buus <mathiasbuus@gmail.com>
2020-08-12 15:39:14 +02:00
Christophe Diederichs e4693065fd update dependencies 2020-07-13 14:53:38 +02:00
Christophe Diederichs 44e5985630 change to universal hashes 2020-07-13 14:53:38 +02:00
Emil Bay f11ff5a727 0.6.1 v0.6.1 2020-06-24 16:30:16 +02:00
Emil Bay 9c30d3ead8 Nicer message formatting 2020-06-24 16:14:52 +02:00
Emil Bay ddcdae69a1 Upgrade secretbox to sodium-native like api (not exposed there) 2020-06-24 16:12:12 +02:00
Emil Bay 80dd633012 Upgrade onetimeauth to sodium-native api 2020-06-24 16:11:56 +02:00
Emil Bay d8d59d0443 Add note on sodium-universal 2020-06-24 15:06:54 +02:00
Emil Bay ef00ddc878 Fix URLs 2020-06-24 15:06:48 +02:00
Emil Bay cc52e58504 Update package metadata 2020-06-24 15:02:49 +02:00
Emil Bay 7b518f7b2c Fix offset ArrayBuffer views 2020-06-24 15:01:10 +02:00
Emil Bay 74a1067746 Fix filling larger width TypedArrays 2020-06-24 14:55:46 +02:00
Emil Bay 919896d2bb Revert accidental sign API change 2020-06-24 14:49:51 +02:00
Emil Bay f3a80cb6f5 Upgrade deps 2020-06-24 14:49:38 +02:00
Emil Bay 40f9b887f4 Modernise example 2020-06-24 14:49:26 +02:00
Emil Bay 2ca6264f50 Add travis 2020-06-24 14:49:11 +02:00
Emil Bay 9d65d19e86 Standardize readme file 2020-06-24 14:49:05 +02:00
Emil Bay 30c3342156 Make linter happy 2020-06-24 14:08:55 +02:00
Emil Bay 930e77ad32 Move internal primitives 2020-06-24 14:02:00 +02:00
Emil Bay e9ac929b5a Move memory helpers to their own module 2020-06-24 14:01:48 +02:00
Emil Bay e77c70ef71 Bust crypto in browserify 2020-06-24 13:37:16 +02:00
Emil Bay 4bb40aa43d Clean up random bytes 2020-06-24 13:37:07 +02:00
Mathias Buus fc90cbedba 0.6.0 v0.6.0 2020-06-18 17:16:43 +02:00
Mathias Buus 63fb70028e bump sodium-test 2020-06-18 17:15:53 +02:00
Mathias Buus f033af88bd copy -> set 2020-06-18 17:12:00 +02:00
Christophe Diederichs b44f83f0a8 Split library into modules (#20)
* crypto_stream: signature change needed to modularise

* move ed25519 arithmetic to separate module

* module: poly1305

* module: crypto_scalarmult

* module: crypto_hash

* module: crypto_sign

* module: crypto_secretbox

* move verify functions to crypto_verify module

* leftover crypto_stream functions

* module: crypto_onetimeauth

* module: crypto_box

* tidy up

* require ed25519.js

* update: crypto_hash

* add chacha20; align API with PR#21

* update sha512 to wasm module

* fix bugs in crypto_sign

* be standard

* add: crypto_box_seed_keypair; alias crypto_kx methods to crypto_box

* scalarmult: import curve methods; be standard

* correction: crypto_kx is not actually an alias of crypto_box

* export _9 constant field element

* add: crypto_box_seed_keypair

* removed duplicate module.exports declaraion

* declare constants about exports

* rename memzero -> sodium-memzero

* update sodium_memzero function to arr.fill(0)

* tidy: remove legacy functions

* added: crypto_aead_chacha20poly1305_ietf methods

* listen to linter

* add assertions

* chacha: readUint32Le generalised for uint8array; aead: standard fix

* add null check on ad param

* added: sodium_memcmp

* export sodium_memcmp

* export crypto_verify module

* sodium_memcmp returns boolean

* added: sodium_is_zero

* catch syntax error

* throw if crypto_aead cannot validate, fix typo in crypto_verify

* move chacha20 alg to external module

* use Uint8Arrays instead of buffers

* change checks to assertions

* bump to chacha 1.0.3 - remove Buffer dependency

* reduce code branching, align return values with sodium-native

* add sha-wasm deps to package.json

* standard fixes

* bump chacha20 to 1.0.4: remove Buffer dep

* move crypto_hash_sha256 to module to uncouple wasm dependencies

* add endian check: all other modules require members of this set

* correct filename: crypto_hash_sha256

* export constant: crypto_hash_sha512_BYTES
2020-06-18 17:09:03 +02:00
Mathias Buus 51f8fbc2d3 0.5.6 v0.5.6 2020-03-04 14:52:37 +01:00
Mathias Buus f790621e60 add sodium_malloc 2020-03-04 14:50:09 +01:00
Fedor Indutny 4e42b942a5 crypto_box: fix keypair, implement seal/seal_open
Secret Key is a random nonce, and public key is a point on elliptic
curve.

`crypto_box_seal`/`crypto_box_seal_open` are implemented using existing
primitives and newly exported `core_hsalsa20` in `xsalsa20`
2019-11-14 09:27:36 +01:00
Daniel Regeci 49587c3d7f crypto_box_keypair - rename arguments to pk,sk 2018-03-19 18:07:17 +00:00
Daniel Regeci 92aee452df crypto_box_keypair 2018-03-19 18:07:17 +00:00
Mathias Buus e1ca83f1bd 0.5.5 v0.5.5 2018-03-19 19:03:43 +01:00
Peter van Hardenberg c81ef709d1 react-native doesn't want crypto set to an empty module (#14)
React-Native is sort of like a browser, sort of a native environment. On react-native we don't have the browser's crypto implementation, so we need to require react-native-crypto. We can rewrite the module requirement to do that using the extraNodeModules feature in rn-cli.config.js, but the metro packager assumes that if there's a "browser" field in package.json that it's relevant to react-native libraries unless there's also a "react-native" field. Hurray.

Anyway, this silly little patch tells metro not to replace crypto with an empty module but actually to use whatever you currently have crypto set to (which is not solved here, so you'll still have to do that.)
2018-03-19 18:58:24 +01:00
Jim Pick 4e1c69ba13 Change crypto_kdf_KEYBYTES to be 32 and use subarray instead of slice
Thanks to Emil Bayes for the advice.
2018-03-03 17:24:12 +00:00
Jim Pick 5159d68fa9 In kdf, truncate key before passing to blake to match sodium-native behaviour
Currently, sodium-native and sodium-javascript are returning different
hashes. The code in hyperdrive passes a 64 byte secret key to the kdf,
but only 32 bytes are used by the native version, but all 64 bytes are
used in the javascript version. As a result, hyperdrive secret keys
can't be imported/exported across the two sodium implementations.

https://gist.github.com/jimpick/3e869522eddaad77ac1bc9e64f36e1a7
2018-03-03 17:24:12 +00:00
Mathias Buus 5ccdcdee17 0.5.4 v0.5.4 2017-11-19 13:16:51 +01:00
Mathias Buus 48081c6896 ignore crypto in the browser 2017-11-19 13:16:35 +01:00
Mathias Buus b1741bfdae 0.5.3 v0.5.3 2017-11-17 12:09:34 +01:00
Mathias Buus f7de366eec fix shorthash_ready being deprecated 2017-11-17 12:07:52 +01:00
Mathias Buus 51e11143e5 fix siphash24 not having ready 2017-11-17 10:43:01 +01:00
Emil Bay b883b2a8df 0.5.2 v0.5.2 2017-11-03 08:19:11 +01:00
Emil Bay f336097b6a Fix bug with undefined window in web workers
Fixes #8
2017-11-03 08:19:06 +01:00
Mathias Buus 5511bafdba 0.5.1 v0.5.1 2017-07-13 16:52:43 +02:00
Mathias Buus 212550db1b bump sodium-test and minor tweak 2017-07-13 16:52:30 +02:00
Luke Burns 384ec2f636 fixed detached sign/verify 2017-07-13 16:47:23 +02:00
Mathias Buus 07e1bc4ed6 0.5.0 v0.5.0 2017-06-28 11:17:18 +02:00
Mathias Buus 6561ff99f1 use xsalsa20 and support crypto_stream_instance 2017-06-28 11:14:00 +02:00
Emil Bay 0f249a7e8f Run tests with browser-run 2017-06-19 22:39:11 +02:00