diff --git a/README.md b/README.md index 7f36746..317a5be 100644 --- a/README.md +++ b/README.md @@ -61,11 +61,11 @@ import { crypto_kdf_derive_from_key, crypto_kdf_KEYBYTES, crypto_kdf_keygen, - crypto_pwhash, - crypto_pwhash_ALG_DEFAULT, - crypto_pwhash_MEMLIMIT_INTERACTIVE, - crypto_pwhash_OPSLIMIT_INTERACTIVE, - crypto_pwhash_SALTBYTES, + crypto_pwhash, // only with loadSumoVersion with react-native-web + crypto_pwhash_ALG_DEFAULT, // only with loadSumoVersion with react-native-web + crypto_pwhash_MEMLIMIT_INTERACTIVE, // only with loadSumoVersion with react-native-web + crypto_pwhash_OPSLIMIT_INTERACTIVE, // only with loadSumoVersion with react-native-web + crypto_pwhash_SALTBYTES, // only with loadSumoVersion with react-native-web crypto_generichash, crypto_generichash_BYTES, crypto_generichash_BYTES_MIN, @@ -88,11 +88,25 @@ import { to_base64, to_hex, to_string, + ready, // only needed for react-native-web + loadSumoVersion, // only relevant for react-native-web } from 'react-native-libsodium'; // ... ``` +## React Native Web + +For the web platform the constants and functions from the `libsodium-wrappers` package is exposed. This also means you need to wait for the `ready` Promise to be resolved before using any constant or function. + +Certain constants and functions e.g. `crypto_pwhash` are only available in the `libsodium-wrappers-sumo` package. To load this package instead for web you can call `loadSumoVersion` right after importing the package. + +```ts +import { loadSumoVersion, ready } from 'react-native-libsodium'; + +loadSumoVersion(); +``` + ## Contributing See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. diff --git a/example/src/App.tsx b/example/src/App.tsx index c7b9182..74d522c 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -1,9 +1,11 @@ import * as React from 'react'; import { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native'; -import sodium, { ready } from 'react-native-libsodium'; +import sodium, { loadSumoVersion, ready } from 'react-native-libsodium'; import { TestResults } from './components/TestResults'; import { VisualImageTest } from './components/VisualImageTest'; +loadSumoVersion(); + function LibsodiumTests() { if (sodium.crypto_secretbox_KEYBYTES !== 32) { throw new Error('export default not working'); diff --git a/example/src/tests/crypto_pwhash_test.ts b/example/src/tests/crypto_pwhash_test.ts index 3a2f4f6..dcd8599 100644 --- a/example/src/tests/crypto_pwhash_test.ts +++ b/example/src/tests/crypto_pwhash_test.ts @@ -8,6 +8,7 @@ import { randombytes_buf, } from 'react-native-libsodium'; import { isEqualUint8Array } from '../utils/isEqualUint8Array'; +import { expect, test } from '../utils/testRunner'; test('crypto_pwhash', () => { const password = 'password123'; diff --git a/example/web/webpack.config.js b/example/web/webpack.config.js index 17ce214..117fcac 100644 --- a/example/web/webpack.config.js +++ b/example/web/webpack.config.js @@ -14,6 +14,8 @@ const babelLoaderConfiguration = { path.resolve(appDirectory, 'index.js'), path.resolve(appDirectory, 'src'), path.resolve(appDirectory, 'node_modules/react-native-uncompiled'), + // make sure the lib src files are also compiled + path.resolve(appDirectory, '../src'), ], use: { loader: 'babel-loader', diff --git a/package.json b/package.json index 7153a2f..8ad768c 100644 --- a/package.json +++ b/package.json @@ -166,6 +166,8 @@ }, "dependencies": { "@types/libsodium-wrappers": "^0.7.13", - "libsodium-wrappers": "^0.7.13" + "@types/libsodium-wrappers-sumo": "^0.7.8", + "libsodium-wrappers": "^0.7.13", + "libsodium-wrappers-sumo": "^0.7.13" } } diff --git a/src/lib.native.ts b/src/lib.native.ts index ef689c5..f244d51 100644 --- a/src/lib.native.ts +++ b/src/lib.native.ts @@ -695,6 +695,9 @@ export function crypto_aead_xchacha20poly1305_ietf_decrypt( // add no-op ready to match the libsodium-wrappers API export const ready: Promise = new Promise((resolve) => resolve()); +// add no-op ready to match the react-nativ-libsodium API for web +export const loadSumoVersion = () => undefined; + export default { crypto_auth, crypto_auth_verify, diff --git a/src/lib.ts b/src/lib.ts index c124189..1078954 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -1,5 +1,4 @@ -import sodium from 'libsodium-wrappers'; -export { +export type { CryptoBox, CryptoKX, KeyPair, @@ -16,264 +15,550 @@ export { Uint8ArrayOutputFormat, } from 'libsodium-wrappers'; -sodium.ready.then(() => { +type SodiumPackage = typeof import('libsodium-wrappers'); + +type Sodium = { + -readonly [key in keyof SodiumPackage]: SodiumPackage[key]; +}; + +// @ts-expect-error initial object is empty and only filed after ready is resolved +let sodium: Sodium = {}; + +let isloadSumoVersion = false; + +export const loadSumoVersion = () => { + isloadSumoVersion = true; +}; + +export const ready = new Promise(async (resolve) => { + // wait for next tick to allow loadSumoVersion to be called + await new Promise((r) => setTimeout(r, 0)); + + let lib: typeof import('libsodium-wrappers'); + if (isloadSumoVersion) { + lib = await import('libsodium-wrappers-sumo'); + } else { + lib = await import('libsodium-wrappers'); + } + await lib.ready; + // only after ready the lib is available + if (isloadSumoVersion) { + lib = await import('libsodium-wrappers-sumo'); + } else { + lib = await import('libsodium-wrappers'); + } + // get all keys // console.log(JSON.stringify(Object.keys(sodium))); - add = sodium.add; - base64_variants = sodium.base64_variants; - compare = sodium.compare; - from_base64 = sodium.from_base64; - from_hex = sodium.from_hex; - from_string = sodium.from_string; - increment = sodium.increment; - is_zero = sodium.is_zero; + add = lib.add; + base64_variants = lib.base64_variants; + compare = lib.compare; + from_base64 = lib.from_base64; + from_hex = lib.from_hex; + from_string = lib.from_string; + increment = lib.increment; + is_zero = lib.is_zero; // @ts-ignore - libsodium = sodium.libsodium; - memcmp = sodium.memcmp; - memzero = sodium.memzero; - output_formats = sodium.output_formats; - pad = sodium.pad; - unpad = sodium.unpad; - ready = sodium.ready; - symbols = sodium.symbols; - to_base64 = sodium.to_base64; - to_hex = sodium.to_hex; - to_string = sodium.to_string; + libsodium = lib.libsodium; + memcmp = lib.memcmp; + memzero = lib.memzero; + output_formats = lib.output_formats; + pad = lib.pad; + unpad = lib.unpad; + symbols = lib.symbols; + to_base64 = lib.to_base64; + to_hex = lib.to_hex; + to_string = lib.to_string; crypto_aead_chacha20poly1305_decrypt = - sodium.crypto_aead_chacha20poly1305_decrypt; + lib.crypto_aead_chacha20poly1305_decrypt; crypto_aead_chacha20poly1305_decrypt_detached = - sodium.crypto_aead_chacha20poly1305_decrypt_detached; + lib.crypto_aead_chacha20poly1305_decrypt_detached; crypto_aead_chacha20poly1305_encrypt = - sodium.crypto_aead_chacha20poly1305_encrypt; + lib.crypto_aead_chacha20poly1305_encrypt; crypto_aead_chacha20poly1305_encrypt_detached = - sodium.crypto_aead_chacha20poly1305_encrypt_detached; + lib.crypto_aead_chacha20poly1305_encrypt_detached; crypto_aead_chacha20poly1305_ietf_decrypt = - sodium.crypto_aead_chacha20poly1305_ietf_decrypt; + lib.crypto_aead_chacha20poly1305_ietf_decrypt; crypto_aead_chacha20poly1305_ietf_decrypt_detached = - sodium.crypto_aead_chacha20poly1305_ietf_decrypt_detached; + lib.crypto_aead_chacha20poly1305_ietf_decrypt_detached; crypto_aead_chacha20poly1305_ietf_encrypt = - sodium.crypto_aead_chacha20poly1305_ietf_encrypt; + lib.crypto_aead_chacha20poly1305_ietf_encrypt; crypto_aead_chacha20poly1305_ietf_encrypt_detached = - sodium.crypto_aead_chacha20poly1305_ietf_encrypt_detached; + lib.crypto_aead_chacha20poly1305_ietf_encrypt_detached; crypto_aead_chacha20poly1305_ietf_keygen = - sodium.crypto_aead_chacha20poly1305_ietf_keygen; - crypto_aead_chacha20poly1305_keygen = - sodium.crypto_aead_chacha20poly1305_keygen; + lib.crypto_aead_chacha20poly1305_ietf_keygen; + crypto_aead_chacha20poly1305_keygen = lib.crypto_aead_chacha20poly1305_keygen; crypto_aead_xchacha20poly1305_ietf_decrypt = - sodium.crypto_aead_xchacha20poly1305_ietf_decrypt; + lib.crypto_aead_xchacha20poly1305_ietf_decrypt; crypto_aead_xchacha20poly1305_ietf_decrypt_detached = - sodium.crypto_aead_xchacha20poly1305_ietf_decrypt_detached; + lib.crypto_aead_xchacha20poly1305_ietf_decrypt_detached; crypto_aead_xchacha20poly1305_ietf_encrypt = - sodium.crypto_aead_xchacha20poly1305_ietf_encrypt; + lib.crypto_aead_xchacha20poly1305_ietf_encrypt; crypto_aead_xchacha20poly1305_ietf_encrypt_detached = - sodium.crypto_aead_xchacha20poly1305_ietf_encrypt_detached; + lib.crypto_aead_xchacha20poly1305_ietf_encrypt_detached; crypto_aead_xchacha20poly1305_ietf_keygen = - sodium.crypto_aead_xchacha20poly1305_ietf_keygen; - crypto_auth = sodium.crypto_auth; - crypto_auth_keygen = sodium.crypto_auth_keygen; - crypto_auth_verify = sodium.crypto_auth_verify; - crypto_box_beforenm = sodium.crypto_box_beforenm; - crypto_box_detached = sodium.crypto_box_detached; - crypto_box_easy = sodium.crypto_box_easy; - crypto_box_easy_afternm = sodium.crypto_box_easy_afternm; - crypto_box_keypair = sodium.crypto_box_keypair; - crypto_box_open_detached = sodium.crypto_box_open_detached; - crypto_box_open_easy = sodium.crypto_box_open_easy; - crypto_box_open_easy_afternm = sodium.crypto_box_open_easy_afternm; - crypto_box_seal = sodium.crypto_box_seal; - crypto_box_seal_open = sodium.crypto_box_seal_open; - crypto_box_seed_keypair = sodium.crypto_box_seed_keypair; - crypto_generichash = sodium.crypto_generichash; - crypto_generichash_final = sodium.crypto_generichash_final; - crypto_generichash_init = sodium.crypto_generichash_init; - crypto_generichash_keygen = sodium.crypto_generichash_keygen; - crypto_generichash_update = sodium.crypto_generichash_update; - crypto_hash = sodium.crypto_hash; - crypto_kdf_derive_from_key = sodium.crypto_kdf_derive_from_key; - crypto_kdf_keygen = sodium.crypto_kdf_keygen; - crypto_kx_client_session_keys = sodium.crypto_kx_client_session_keys; - crypto_kx_keypair = sodium.crypto_kx_keypair; - crypto_kx_seed_keypair = sodium.crypto_kx_seed_keypair; - crypto_kx_server_session_keys = sodium.crypto_kx_server_session_keys; - crypto_pwhash = sodium.crypto_pwhash; - crypto_pwhash_str = sodium.crypto_pwhash_str; - crypto_pwhash_str_needs_rehash = sodium.crypto_pwhash_str_needs_rehash; - crypto_pwhash_str_verify = sodium.crypto_pwhash_str_verify; - crypto_scalarmult = sodium.crypto_scalarmult; - crypto_scalarmult_base = sodium.crypto_scalarmult_base; - crypto_secretbox_detached = sodium.crypto_secretbox_detached; - crypto_secretbox_easy = sodium.crypto_secretbox_easy; - crypto_secretbox_keygen = sodium.crypto_secretbox_keygen; - crypto_secretbox_open_detached = sodium.crypto_secretbox_open_detached; - crypto_secretbox_open_easy = sodium.crypto_secretbox_open_easy; + lib.crypto_aead_xchacha20poly1305_ietf_keygen; + crypto_auth = lib.crypto_auth; + crypto_auth_keygen = lib.crypto_auth_keygen; + crypto_auth_verify = lib.crypto_auth_verify; + crypto_box_beforenm = lib.crypto_box_beforenm; + crypto_box_detached = lib.crypto_box_detached; + crypto_box_easy = lib.crypto_box_easy; + crypto_box_easy_afternm = lib.crypto_box_easy_afternm; + crypto_box_keypair = lib.crypto_box_keypair; + crypto_box_open_detached = lib.crypto_box_open_detached; + crypto_box_open_easy = lib.crypto_box_open_easy; + crypto_box_open_easy_afternm = lib.crypto_box_open_easy_afternm; + crypto_box_seal = lib.crypto_box_seal; + crypto_box_seal_open = lib.crypto_box_seal_open; + crypto_box_seed_keypair = lib.crypto_box_seed_keypair; + crypto_generichash = lib.crypto_generichash; + crypto_generichash_final = lib.crypto_generichash_final; + crypto_generichash_init = lib.crypto_generichash_init; + crypto_generichash_keygen = lib.crypto_generichash_keygen; + crypto_generichash_update = lib.crypto_generichash_update; + crypto_hash = lib.crypto_hash; + crypto_kdf_derive_from_key = lib.crypto_kdf_derive_from_key; + crypto_kdf_keygen = lib.crypto_kdf_keygen; + crypto_kx_client_session_keys = lib.crypto_kx_client_session_keys; + crypto_kx_keypair = lib.crypto_kx_keypair; + crypto_kx_seed_keypair = lib.crypto_kx_seed_keypair; + crypto_kx_server_session_keys = lib.crypto_kx_server_session_keys; + crypto_pwhash = lib.crypto_pwhash; + crypto_pwhash_str = lib.crypto_pwhash_str; + crypto_pwhash_str_needs_rehash = lib.crypto_pwhash_str_needs_rehash; + crypto_pwhash_str_verify = lib.crypto_pwhash_str_verify; + crypto_scalarmult = lib.crypto_scalarmult; + crypto_scalarmult_base = lib.crypto_scalarmult_base; + crypto_secretbox_detached = lib.crypto_secretbox_detached; + crypto_secretbox_easy = lib.crypto_secretbox_easy; + crypto_secretbox_keygen = lib.crypto_secretbox_keygen; + crypto_secretbox_open_detached = lib.crypto_secretbox_open_detached; + crypto_secretbox_open_easy = lib.crypto_secretbox_open_easy; crypto_secretstream_xchacha20poly1305_init_pull = - sodium.crypto_secretstream_xchacha20poly1305_init_pull; + lib.crypto_secretstream_xchacha20poly1305_init_pull; crypto_secretstream_xchacha20poly1305_init_push = - sodium.crypto_secretstream_xchacha20poly1305_init_push; + lib.crypto_secretstream_xchacha20poly1305_init_push; crypto_secretstream_xchacha20poly1305_keygen = - sodium.crypto_secretstream_xchacha20poly1305_keygen; + lib.crypto_secretstream_xchacha20poly1305_keygen; crypto_secretstream_xchacha20poly1305_pull = - sodium.crypto_secretstream_xchacha20poly1305_pull; + lib.crypto_secretstream_xchacha20poly1305_pull; crypto_secretstream_xchacha20poly1305_push = - sodium.crypto_secretstream_xchacha20poly1305_push; + lib.crypto_secretstream_xchacha20poly1305_push; crypto_secretstream_xchacha20poly1305_rekey = - sodium.crypto_secretstream_xchacha20poly1305_rekey; - crypto_shorthash = sodium.crypto_shorthash; - crypto_shorthash_keygen = sodium.crypto_shorthash_keygen; - crypto_sign = sodium.crypto_sign; - crypto_sign_detached = sodium.crypto_sign_detached; + lib.crypto_secretstream_xchacha20poly1305_rekey; + crypto_shorthash = lib.crypto_shorthash; + crypto_shorthash_keygen = lib.crypto_shorthash_keygen; + crypto_sign = lib.crypto_sign; + crypto_sign_detached = lib.crypto_sign_detached; crypto_sign_ed25519_pk_to_curve25519 = - sodium.crypto_sign_ed25519_pk_to_curve25519; + lib.crypto_sign_ed25519_pk_to_curve25519; crypto_sign_ed25519_sk_to_curve25519 = - sodium.crypto_sign_ed25519_sk_to_curve25519; - crypto_sign_final_create = sodium.crypto_sign_final_create; - crypto_sign_final_verify = sodium.crypto_sign_final_verify; - crypto_sign_init = sodium.crypto_sign_init; - crypto_sign_keypair = sodium.crypto_sign_keypair; - crypto_sign_open = sodium.crypto_sign_open; - crypto_sign_seed_keypair = sodium.crypto_sign_seed_keypair; - crypto_sign_update = sodium.crypto_sign_update; - crypto_sign_verify_detached = sodium.crypto_sign_verify_detached; - randombytes_buf = sodium.randombytes_buf; - randombytes_buf_deterministic = sodium.randombytes_buf_deterministic; - randombytes_close = sodium.randombytes_close; - randombytes_random = sodium.randombytes_random; - randombytes_stir = sodium.randombytes_stir; - randombytes_uniform = sodium.randombytes_uniform; - sodium_version_string = sodium.sodium_version_string; - SODIUM_LIBRARY_VERSION_MAJOR = sodium.SODIUM_LIBRARY_VERSION_MAJOR; - SODIUM_LIBRARY_VERSION_MINOR = sodium.SODIUM_LIBRARY_VERSION_MINOR; - crypto_aead_chacha20poly1305_ABYTES = - sodium.crypto_aead_chacha20poly1305_ABYTES; + lib.crypto_sign_ed25519_sk_to_curve25519; + crypto_sign_final_create = lib.crypto_sign_final_create; + crypto_sign_final_verify = lib.crypto_sign_final_verify; + crypto_sign_init = lib.crypto_sign_init; + crypto_sign_keypair = lib.crypto_sign_keypair; + crypto_sign_open = lib.crypto_sign_open; + crypto_sign_seed_keypair = lib.crypto_sign_seed_keypair; + crypto_sign_update = lib.crypto_sign_update; + crypto_sign_verify_detached = lib.crypto_sign_verify_detached; + randombytes_buf = lib.randombytes_buf; + randombytes_buf_deterministic = lib.randombytes_buf_deterministic; + randombytes_close = lib.randombytes_close; + randombytes_random = lib.randombytes_random; + randombytes_stir = lib.randombytes_stir; + randombytes_uniform = lib.randombytes_uniform; + sodium_version_string = lib.sodium_version_string; + SODIUM_LIBRARY_VERSION_MAJOR = lib.SODIUM_LIBRARY_VERSION_MAJOR; + SODIUM_LIBRARY_VERSION_MINOR = lib.SODIUM_LIBRARY_VERSION_MINOR; + crypto_aead_chacha20poly1305_ABYTES = lib.crypto_aead_chacha20poly1305_ABYTES; crypto_aead_chacha20poly1305_IETF_ABYTES = - sodium.crypto_aead_chacha20poly1305_IETF_ABYTES; + lib.crypto_aead_chacha20poly1305_IETF_ABYTES; crypto_aead_chacha20poly1305_IETF_KEYBYTES = - sodium.crypto_aead_chacha20poly1305_IETF_KEYBYTES; + lib.crypto_aead_chacha20poly1305_IETF_KEYBYTES; crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX = - sodium.crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX; + lib.crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX; crypto_aead_chacha20poly1305_IETF_NPUBBYTES = - sodium.crypto_aead_chacha20poly1305_IETF_NPUBBYTES; + lib.crypto_aead_chacha20poly1305_IETF_NPUBBYTES; crypto_aead_chacha20poly1305_IETF_NSECBYTES = - sodium.crypto_aead_chacha20poly1305_IETF_NSECBYTES; + lib.crypto_aead_chacha20poly1305_IETF_NSECBYTES; crypto_aead_chacha20poly1305_KEYBYTES = - sodium.crypto_aead_chacha20poly1305_KEYBYTES; + lib.crypto_aead_chacha20poly1305_KEYBYTES; crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX = - sodium.crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX; + lib.crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX; crypto_aead_chacha20poly1305_NPUBBYTES = - sodium.crypto_aead_chacha20poly1305_NPUBBYTES; + lib.crypto_aead_chacha20poly1305_NPUBBYTES; crypto_aead_chacha20poly1305_NSECBYTES = - sodium.crypto_aead_chacha20poly1305_NSECBYTES; + lib.crypto_aead_chacha20poly1305_NSECBYTES; crypto_aead_chacha20poly1305_ietf_ABYTES = - sodium.crypto_aead_chacha20poly1305_ietf_ABYTES; + lib.crypto_aead_chacha20poly1305_ietf_ABYTES; crypto_aead_chacha20poly1305_ietf_KEYBYTES = - sodium.crypto_aead_chacha20poly1305_ietf_KEYBYTES; + lib.crypto_aead_chacha20poly1305_ietf_KEYBYTES; crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX = - sodium.crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX; + lib.crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX; crypto_aead_chacha20poly1305_ietf_NPUBBYTES = - sodium.crypto_aead_chacha20poly1305_ietf_NPUBBYTES; + lib.crypto_aead_chacha20poly1305_ietf_NPUBBYTES; crypto_aead_chacha20poly1305_ietf_NSECBYTES = - sodium.crypto_aead_chacha20poly1305_ietf_NSECBYTES; + lib.crypto_aead_chacha20poly1305_ietf_NSECBYTES; crypto_aead_xchacha20poly1305_IETF_ABYTES = - sodium.crypto_aead_xchacha20poly1305_IETF_ABYTES; + lib.crypto_aead_xchacha20poly1305_IETF_ABYTES; crypto_aead_xchacha20poly1305_IETF_KEYBYTES = - sodium.crypto_aead_xchacha20poly1305_IETF_KEYBYTES; + lib.crypto_aead_xchacha20poly1305_IETF_KEYBYTES; crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX = - sodium.crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX; + lib.crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX; crypto_aead_xchacha20poly1305_IETF_NPUBBYTES = - sodium.crypto_aead_xchacha20poly1305_IETF_NPUBBYTES; + lib.crypto_aead_xchacha20poly1305_IETF_NPUBBYTES; crypto_aead_xchacha20poly1305_IETF_NSECBYTES = - sodium.crypto_aead_xchacha20poly1305_IETF_NSECBYTES; + lib.crypto_aead_xchacha20poly1305_IETF_NSECBYTES; crypto_aead_xchacha20poly1305_ietf_ABYTES = - sodium.crypto_aead_xchacha20poly1305_ietf_ABYTES; + lib.crypto_aead_xchacha20poly1305_ietf_ABYTES; crypto_aead_xchacha20poly1305_ietf_KEYBYTES = - sodium.crypto_aead_xchacha20poly1305_ietf_KEYBYTES; + lib.crypto_aead_xchacha20poly1305_ietf_KEYBYTES; crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX = - sodium.crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX; + lib.crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX; crypto_aead_xchacha20poly1305_ietf_NPUBBYTES = - sodium.crypto_aead_xchacha20poly1305_ietf_NPUBBYTES; + lib.crypto_aead_xchacha20poly1305_ietf_NPUBBYTES; crypto_aead_xchacha20poly1305_ietf_NSECBYTES = - sodium.crypto_aead_xchacha20poly1305_ietf_NSECBYTES; - crypto_auth_BYTES = sodium.crypto_auth_BYTES; - crypto_auth_KEYBYTES = sodium.crypto_auth_KEYBYTES; - crypto_box_BEFORENMBYTES = sodium.crypto_box_BEFORENMBYTES; - crypto_box_MACBYTES = sodium.crypto_box_MACBYTES; - crypto_box_MESSAGEBYTES_MAX = sodium.crypto_box_MESSAGEBYTES_MAX; - crypto_box_NONCEBYTES = sodium.crypto_box_NONCEBYTES; - crypto_box_PUBLICKEYBYTES = sodium.crypto_box_PUBLICKEYBYTES; - crypto_box_SEALBYTES = sodium.crypto_box_SEALBYTES; - crypto_box_SECRETKEYBYTES = sodium.crypto_box_SECRETKEYBYTES; - crypto_box_SEEDBYTES = sodium.crypto_box_SEEDBYTES; - crypto_generichash_BYTES = sodium.crypto_generichash_BYTES; - crypto_generichash_BYTES_MAX = sodium.crypto_generichash_BYTES_MAX; - crypto_generichash_BYTES_MIN = sodium.crypto_generichash_BYTES_MIN; - crypto_generichash_KEYBYTES = sodium.crypto_generichash_KEYBYTES; - crypto_generichash_KEYBYTES_MAX = sodium.crypto_generichash_KEYBYTES_MAX; - crypto_generichash_KEYBYTES_MIN = sodium.crypto_generichash_KEYBYTES_MIN; - crypto_hash_BYTES = sodium.crypto_hash_BYTES; - crypto_kdf_BYTES_MAX = sodium.crypto_kdf_BYTES_MAX; - crypto_kdf_BYTES_MIN = sodium.crypto_kdf_BYTES_MIN; - crypto_kdf_CONTEXTBYTES = sodium.crypto_kdf_CONTEXTBYTES; - crypto_kdf_KEYBYTES = sodium.crypto_kdf_KEYBYTES; - crypto_kx_PUBLICKEYBYTES = sodium.crypto_kx_PUBLICKEYBYTES; - crypto_kx_SECRETKEYBYTES = sodium.crypto_kx_SECRETKEYBYTES; - crypto_kx_SEEDBYTES = sodium.crypto_kx_SEEDBYTES; - crypto_kx_SESSIONKEYBYTES = sodium.crypto_kx_SESSIONKEYBYTES; - crypto_pwhash_ALG_ARGON2I13 = sodium.crypto_pwhash_ALG_ARGON2I13; - crypto_pwhash_ALG_ARGON2ID13 = sodium.crypto_pwhash_ALG_ARGON2ID13; - crypto_pwhash_ALG_DEFAULT = sodium.crypto_pwhash_ALG_DEFAULT; - crypto_pwhash_BYTES_MAX = sodium.crypto_pwhash_BYTES_MAX; - crypto_pwhash_BYTES_MIN = sodium.crypto_pwhash_BYTES_MIN; - crypto_pwhash_MEMLIMIT_INTERACTIVE = - sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE; - crypto_pwhash_MEMLIMIT_MAX = sodium.crypto_pwhash_MEMLIMIT_MAX; - crypto_pwhash_MEMLIMIT_MIN = sodium.crypto_pwhash_MEMLIMIT_MIN; - crypto_pwhash_MEMLIMIT_MODERATE = sodium.crypto_pwhash_MEMLIMIT_MODERATE; - crypto_pwhash_MEMLIMIT_SENSITIVE = sodium.crypto_pwhash_MEMLIMIT_SENSITIVE; - crypto_pwhash_OPSLIMIT_INTERACTIVE = - sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE; - crypto_pwhash_OPSLIMIT_MAX = sodium.crypto_pwhash_OPSLIMIT_MAX; - crypto_pwhash_OPSLIMIT_MIN = sodium.crypto_pwhash_OPSLIMIT_MIN; - crypto_pwhash_OPSLIMIT_MODERATE = sodium.crypto_pwhash_OPSLIMIT_MODERATE; - crypto_pwhash_OPSLIMIT_SENSITIVE = sodium.crypto_pwhash_OPSLIMIT_SENSITIVE; - crypto_pwhash_PASSWD_MAX = sodium.crypto_pwhash_PASSWD_MAX; - crypto_pwhash_PASSWD_MIN = sodium.crypto_pwhash_PASSWD_MIN; - crypto_pwhash_SALTBYTES = sodium.crypto_pwhash_SALTBYTES; - crypto_pwhash_STRBYTES = sodium.crypto_pwhash_STRBYTES; - crypto_scalarmult_BYTES = sodium.crypto_scalarmult_BYTES; - crypto_scalarmult_SCALARBYTES = sodium.crypto_scalarmult_SCALARBYTES; - crypto_secretbox_KEYBYTES = sodium.crypto_secretbox_KEYBYTES; - crypto_secretbox_MACBYTES = sodium.crypto_secretbox_MACBYTES; - crypto_secretbox_MESSAGEBYTES_MAX = sodium.crypto_secretbox_MESSAGEBYTES_MAX; - crypto_secretbox_NONCEBYTES = sodium.crypto_secretbox_NONCEBYTES; + lib.crypto_aead_xchacha20poly1305_ietf_NSECBYTES; + crypto_auth_BYTES = lib.crypto_auth_BYTES; + crypto_auth_KEYBYTES = lib.crypto_auth_KEYBYTES; + crypto_box_BEFORENMBYTES = lib.crypto_box_BEFORENMBYTES; + crypto_box_MACBYTES = lib.crypto_box_MACBYTES; + crypto_box_MESSAGEBYTES_MAX = lib.crypto_box_MESSAGEBYTES_MAX; + crypto_box_NONCEBYTES = lib.crypto_box_NONCEBYTES; + crypto_box_PUBLICKEYBYTES = lib.crypto_box_PUBLICKEYBYTES; + crypto_box_SEALBYTES = lib.crypto_box_SEALBYTES; + crypto_box_SECRETKEYBYTES = lib.crypto_box_SECRETKEYBYTES; + crypto_box_SEEDBYTES = lib.crypto_box_SEEDBYTES; + crypto_generichash_BYTES = lib.crypto_generichash_BYTES; + crypto_generichash_BYTES_MAX = lib.crypto_generichash_BYTES_MAX; + crypto_generichash_BYTES_MIN = lib.crypto_generichash_BYTES_MIN; + crypto_generichash_KEYBYTES = lib.crypto_generichash_KEYBYTES; + crypto_generichash_KEYBYTES_MAX = lib.crypto_generichash_KEYBYTES_MAX; + crypto_generichash_KEYBYTES_MIN = lib.crypto_generichash_KEYBYTES_MIN; + crypto_hash_BYTES = lib.crypto_hash_BYTES; + crypto_kdf_BYTES_MAX = lib.crypto_kdf_BYTES_MAX; + crypto_kdf_BYTES_MIN = lib.crypto_kdf_BYTES_MIN; + crypto_kdf_CONTEXTBYTES = lib.crypto_kdf_CONTEXTBYTES; + crypto_kdf_KEYBYTES = lib.crypto_kdf_KEYBYTES; + crypto_kx_PUBLICKEYBYTES = lib.crypto_kx_PUBLICKEYBYTES; + crypto_kx_SECRETKEYBYTES = lib.crypto_kx_SECRETKEYBYTES; + crypto_kx_SEEDBYTES = lib.crypto_kx_SEEDBYTES; + crypto_kx_SESSIONKEYBYTES = lib.crypto_kx_SESSIONKEYBYTES; + crypto_pwhash_ALG_ARGON2I13 = lib.crypto_pwhash_ALG_ARGON2I13; + crypto_pwhash_ALG_ARGON2ID13 = lib.crypto_pwhash_ALG_ARGON2ID13; + crypto_pwhash_ALG_DEFAULT = lib.crypto_pwhash_ALG_DEFAULT; + crypto_pwhash_BYTES_MAX = lib.crypto_pwhash_BYTES_MAX; + crypto_pwhash_BYTES_MIN = lib.crypto_pwhash_BYTES_MIN; + crypto_pwhash_MEMLIMIT_INTERACTIVE = lib.crypto_pwhash_MEMLIMIT_INTERACTIVE; + crypto_pwhash_MEMLIMIT_MAX = lib.crypto_pwhash_MEMLIMIT_MAX; + crypto_pwhash_MEMLIMIT_MIN = lib.crypto_pwhash_MEMLIMIT_MIN; + crypto_pwhash_MEMLIMIT_MODERATE = lib.crypto_pwhash_MEMLIMIT_MODERATE; + crypto_pwhash_MEMLIMIT_SENSITIVE = lib.crypto_pwhash_MEMLIMIT_SENSITIVE; + crypto_pwhash_OPSLIMIT_INTERACTIVE = lib.crypto_pwhash_OPSLIMIT_INTERACTIVE; + crypto_pwhash_OPSLIMIT_MAX = lib.crypto_pwhash_OPSLIMIT_MAX; + crypto_pwhash_OPSLIMIT_MIN = lib.crypto_pwhash_OPSLIMIT_MIN; + crypto_pwhash_OPSLIMIT_MODERATE = lib.crypto_pwhash_OPSLIMIT_MODERATE; + crypto_pwhash_OPSLIMIT_SENSITIVE = lib.crypto_pwhash_OPSLIMIT_SENSITIVE; + crypto_pwhash_PASSWD_MAX = lib.crypto_pwhash_PASSWD_MAX; + crypto_pwhash_PASSWD_MIN = lib.crypto_pwhash_PASSWD_MIN; + crypto_pwhash_SALTBYTES = lib.crypto_pwhash_SALTBYTES; + crypto_pwhash_STRBYTES = lib.crypto_pwhash_STRBYTES; + crypto_scalarmult_BYTES = lib.crypto_scalarmult_BYTES; + crypto_scalarmult_SCALARBYTES = lib.crypto_scalarmult_SCALARBYTES; + crypto_secretbox_KEYBYTES = lib.crypto_secretbox_KEYBYTES; + crypto_secretbox_MACBYTES = lib.crypto_secretbox_MACBYTES; + crypto_secretbox_MESSAGEBYTES_MAX = lib.crypto_secretbox_MESSAGEBYTES_MAX; + crypto_secretbox_NONCEBYTES = lib.crypto_secretbox_NONCEBYTES; crypto_secretstream_xchacha20poly1305_ABYTES = - sodium.crypto_secretstream_xchacha20poly1305_ABYTES; + lib.crypto_secretstream_xchacha20poly1305_ABYTES; crypto_secretstream_xchacha20poly1305_HEADERBYTES = - sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES; + lib.crypto_secretstream_xchacha20poly1305_HEADERBYTES; crypto_secretstream_xchacha20poly1305_KEYBYTES = - sodium.crypto_secretstream_xchacha20poly1305_KEYBYTES; + lib.crypto_secretstream_xchacha20poly1305_KEYBYTES; crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX = - sodium.crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX; + lib.crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX; crypto_secretstream_xchacha20poly1305_TAG_FINAL = - sodium.crypto_secretstream_xchacha20poly1305_TAG_FINAL; + lib.crypto_secretstream_xchacha20poly1305_TAG_FINAL; crypto_secretstream_xchacha20poly1305_TAG_MESSAGE = - sodium.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE; + lib.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE; crypto_secretstream_xchacha20poly1305_TAG_PUSH = - sodium.crypto_secretstream_xchacha20poly1305_TAG_PUSH; + lib.crypto_secretstream_xchacha20poly1305_TAG_PUSH; crypto_secretstream_xchacha20poly1305_TAG_REKEY = - sodium.crypto_secretstream_xchacha20poly1305_TAG_REKEY; - crypto_shorthash_BYTES = sodium.crypto_shorthash_BYTES; - crypto_shorthash_KEYBYTES = sodium.crypto_shorthash_KEYBYTES; - crypto_sign_BYTES = sodium.crypto_sign_BYTES; - crypto_sign_MESSAGEBYTES_MAX = sodium.crypto_sign_MESSAGEBYTES_MAX; - crypto_sign_PUBLICKEYBYTES = sodium.crypto_sign_PUBLICKEYBYTES; - crypto_sign_SECRETKEYBYTES = sodium.crypto_sign_SECRETKEYBYTES; - crypto_sign_SEEDBYTES = sodium.crypto_sign_SEEDBYTES; - SODIUM_VERSION_STRING = sodium.SODIUM_VERSION_STRING; - crypto_pwhash_STRPREFIX = sodium.crypto_pwhash_STRPREFIX; + lib.crypto_secretstream_xchacha20poly1305_TAG_REKEY; + crypto_shorthash_BYTES = lib.crypto_shorthash_BYTES; + crypto_shorthash_KEYBYTES = lib.crypto_shorthash_KEYBYTES; + crypto_sign_BYTES = lib.crypto_sign_BYTES; + crypto_sign_MESSAGEBYTES_MAX = lib.crypto_sign_MESSAGEBYTES_MAX; + crypto_sign_PUBLICKEYBYTES = lib.crypto_sign_PUBLICKEYBYTES; + crypto_sign_SECRETKEYBYTES = lib.crypto_sign_SECRETKEYBYTES; + crypto_sign_SEEDBYTES = lib.crypto_sign_SEEDBYTES; + SODIUM_VERSION_STRING = lib.SODIUM_VERSION_STRING; + crypto_pwhash_STRPREFIX = lib.crypto_pwhash_STRPREFIX; + + sodium.add = lib.add; + sodium.base64_variants = lib.base64_variants; + sodium.compare = lib.compare; + sodium.from_base64 = lib.from_base64; + sodium.from_hex = lib.from_hex; + sodium.from_string = lib.from_string; + sodium.increment = lib.increment; + sodium.is_zero = lib.is_zero; + // @ts-ignore + sodium.libsodium = lib.libsodium; + sodium.memcmp = lib.memcmp; + sodium.memzero = lib.memzero; + sodium.output_formats = lib.output_formats; + sodium.pad = lib.pad; + sodium.unpad = lib.unpad; + sodium.symbols = lib.symbols; + sodium.to_base64 = lib.to_base64; + sodium.to_hex = lib.to_hex; + sodium.to_string = lib.to_string; + sodium.crypto_aead_chacha20poly1305_decrypt = + lib.crypto_aead_chacha20poly1305_decrypt; + sodium.crypto_aead_chacha20poly1305_decrypt_detached = + lib.crypto_aead_chacha20poly1305_decrypt_detached; + sodium.crypto_aead_chacha20poly1305_encrypt = + lib.crypto_aead_chacha20poly1305_encrypt; + sodium.crypto_aead_chacha20poly1305_encrypt_detached = + lib.crypto_aead_chacha20poly1305_encrypt_detached; + sodium.crypto_aead_chacha20poly1305_ietf_decrypt = + lib.crypto_aead_chacha20poly1305_ietf_decrypt; + sodium.crypto_aead_chacha20poly1305_ietf_decrypt_detached = + lib.crypto_aead_chacha20poly1305_ietf_decrypt_detached; + sodium.crypto_aead_chacha20poly1305_ietf_encrypt = + lib.crypto_aead_chacha20poly1305_ietf_encrypt; + sodium.crypto_aead_chacha20poly1305_ietf_encrypt_detached = + lib.crypto_aead_chacha20poly1305_ietf_encrypt_detached; + sodium.crypto_aead_chacha20poly1305_ietf_keygen = + lib.crypto_aead_chacha20poly1305_ietf_keygen; + sodium.crypto_aead_chacha20poly1305_keygen = + lib.crypto_aead_chacha20poly1305_keygen; + sodium.crypto_aead_xchacha20poly1305_ietf_decrypt = + lib.crypto_aead_xchacha20poly1305_ietf_decrypt; + sodium.crypto_aead_xchacha20poly1305_ietf_decrypt_detached = + lib.crypto_aead_xchacha20poly1305_ietf_decrypt_detached; + sodium.crypto_aead_xchacha20poly1305_ietf_encrypt = + lib.crypto_aead_xchacha20poly1305_ietf_encrypt; + sodium.crypto_aead_xchacha20poly1305_ietf_encrypt_detached = + lib.crypto_aead_xchacha20poly1305_ietf_encrypt_detached; + sodium.crypto_aead_xchacha20poly1305_ietf_keygen = + lib.crypto_aead_xchacha20poly1305_ietf_keygen; + sodium.crypto_auth = lib.crypto_auth; + sodium.crypto_auth_keygen = lib.crypto_auth_keygen; + sodium.crypto_auth_verify = lib.crypto_auth_verify; + sodium.crypto_box_beforenm = lib.crypto_box_beforenm; + sodium.crypto_box_detached = lib.crypto_box_detached; + sodium.crypto_box_easy = lib.crypto_box_easy; + sodium.crypto_box_easy_afternm = lib.crypto_box_easy_afternm; + sodium.crypto_box_keypair = lib.crypto_box_keypair; + sodium.crypto_box_open_detached = lib.crypto_box_open_detached; + sodium.crypto_box_open_easy = lib.crypto_box_open_easy; + sodium.crypto_box_open_easy_afternm = lib.crypto_box_open_easy_afternm; + sodium.crypto_box_seal = lib.crypto_box_seal; + sodium.crypto_box_seal_open = lib.crypto_box_seal_open; + sodium.crypto_box_seed_keypair = lib.crypto_box_seed_keypair; + sodium.crypto_generichash = lib.crypto_generichash; + sodium.crypto_generichash_final = lib.crypto_generichash_final; + sodium.crypto_generichash_init = lib.crypto_generichash_init; + sodium.crypto_generichash_keygen = lib.crypto_generichash_keygen; + sodium.crypto_generichash_update = lib.crypto_generichash_update; + sodium.crypto_hash = lib.crypto_hash; + sodium.crypto_kdf_derive_from_key = lib.crypto_kdf_derive_from_key; + sodium.crypto_kdf_keygen = lib.crypto_kdf_keygen; + sodium.crypto_kx_client_session_keys = lib.crypto_kx_client_session_keys; + sodium.crypto_kx_keypair = lib.crypto_kx_keypair; + sodium.crypto_kx_seed_keypair = lib.crypto_kx_seed_keypair; + sodium.crypto_kx_server_session_keys = lib.crypto_kx_server_session_keys; + sodium.crypto_pwhash = lib.crypto_pwhash; + sodium.crypto_pwhash_str = lib.crypto_pwhash_str; + sodium.crypto_pwhash_str_needs_rehash = lib.crypto_pwhash_str_needs_rehash; + sodium.crypto_pwhash_str_verify = lib.crypto_pwhash_str_verify; + sodium.crypto_scalarmult = lib.crypto_scalarmult; + sodium.crypto_scalarmult_base = lib.crypto_scalarmult_base; + sodium.crypto_secretbox_detached = lib.crypto_secretbox_detached; + sodium.crypto_secretbox_easy = lib.crypto_secretbox_easy; + sodium.crypto_secretbox_keygen = lib.crypto_secretbox_keygen; + sodium.crypto_secretbox_open_detached = lib.crypto_secretbox_open_detached; + sodium.crypto_secretbox_open_easy = lib.crypto_secretbox_open_easy; + sodium.crypto_secretstream_xchacha20poly1305_init_pull = + lib.crypto_secretstream_xchacha20poly1305_init_pull; + sodium.crypto_secretstream_xchacha20poly1305_init_push = + lib.crypto_secretstream_xchacha20poly1305_init_push; + sodium.crypto_secretstream_xchacha20poly1305_keygen = + lib.crypto_secretstream_xchacha20poly1305_keygen; + sodium.crypto_secretstream_xchacha20poly1305_pull = + lib.crypto_secretstream_xchacha20poly1305_pull; + sodium.crypto_secretstream_xchacha20poly1305_push = + lib.crypto_secretstream_xchacha20poly1305_push; + sodium.crypto_secretstream_xchacha20poly1305_rekey = + lib.crypto_secretstream_xchacha20poly1305_rekey; + sodium.crypto_shorthash = lib.crypto_shorthash; + sodium.crypto_shorthash_keygen = lib.crypto_shorthash_keygen; + sodium.crypto_sign = lib.crypto_sign; + sodium.crypto_sign_detached = lib.crypto_sign_detached; + sodium.crypto_sign_ed25519_pk_to_curve25519 = + lib.crypto_sign_ed25519_pk_to_curve25519; + sodium.crypto_sign_ed25519_sk_to_curve25519 = + lib.crypto_sign_ed25519_sk_to_curve25519; + sodium.crypto_sign_final_create = lib.crypto_sign_final_create; + sodium.crypto_sign_final_verify = lib.crypto_sign_final_verify; + sodium.crypto_sign_init = lib.crypto_sign_init; + sodium.crypto_sign_keypair = lib.crypto_sign_keypair; + sodium.crypto_sign_open = lib.crypto_sign_open; + sodium.crypto_sign_seed_keypair = lib.crypto_sign_seed_keypair; + sodium.crypto_sign_update = lib.crypto_sign_update; + sodium.crypto_sign_verify_detached = lib.crypto_sign_verify_detached; + sodium.randombytes_buf = lib.randombytes_buf; + sodium.randombytes_buf_deterministic = lib.randombytes_buf_deterministic; + sodium.randombytes_close = lib.randombytes_close; + sodium.randombytes_random = lib.randombytes_random; + sodium.randombytes_stir = lib.randombytes_stir; + sodium.randombytes_uniform = lib.randombytes_uniform; + sodium.sodium_version_string = lib.sodium_version_string; + sodium.SODIUM_LIBRARY_VERSION_MAJOR = lib.SODIUM_LIBRARY_VERSION_MAJOR; + sodium.SODIUM_LIBRARY_VERSION_MINOR = lib.SODIUM_LIBRARY_VERSION_MINOR; + sodium.crypto_aead_chacha20poly1305_ABYTES = + lib.crypto_aead_chacha20poly1305_ABYTES; + sodium.crypto_aead_chacha20poly1305_IETF_ABYTES = + lib.crypto_aead_chacha20poly1305_IETF_ABYTES; + sodium.crypto_aead_chacha20poly1305_IETF_KEYBYTES = + lib.crypto_aead_chacha20poly1305_IETF_KEYBYTES; + sodium.crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX = + lib.crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX; + sodium.crypto_aead_chacha20poly1305_IETF_NPUBBYTES = + lib.crypto_aead_chacha20poly1305_IETF_NPUBBYTES; + sodium.crypto_aead_chacha20poly1305_IETF_NSECBYTES = + lib.crypto_aead_chacha20poly1305_IETF_NSECBYTES; + sodium.crypto_aead_chacha20poly1305_KEYBYTES = + lib.crypto_aead_chacha20poly1305_KEYBYTES; + sodium.crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX = + lib.crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX; + sodium.crypto_aead_chacha20poly1305_NPUBBYTES = + lib.crypto_aead_chacha20poly1305_NPUBBYTES; + sodium.crypto_aead_chacha20poly1305_NSECBYTES = + lib.crypto_aead_chacha20poly1305_NSECBYTES; + sodium.crypto_aead_chacha20poly1305_ietf_ABYTES = + lib.crypto_aead_chacha20poly1305_ietf_ABYTES; + sodium.crypto_aead_chacha20poly1305_ietf_KEYBYTES = + lib.crypto_aead_chacha20poly1305_ietf_KEYBYTES; + sodium.crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX = + lib.crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX; + sodium.crypto_aead_chacha20poly1305_ietf_NPUBBYTES = + lib.crypto_aead_chacha20poly1305_ietf_NPUBBYTES; + sodium.crypto_aead_chacha20poly1305_ietf_NSECBYTES = + lib.crypto_aead_chacha20poly1305_ietf_NSECBYTES; + sodium.crypto_aead_xchacha20poly1305_IETF_ABYTES = + lib.crypto_aead_xchacha20poly1305_IETF_ABYTES; + sodium.crypto_aead_xchacha20poly1305_IETF_KEYBYTES = + lib.crypto_aead_xchacha20poly1305_IETF_KEYBYTES; + sodium.crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX = + lib.crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX; + sodium.crypto_aead_xchacha20poly1305_IETF_NPUBBYTES = + lib.crypto_aead_xchacha20poly1305_IETF_NPUBBYTES; + sodium.crypto_aead_xchacha20poly1305_IETF_NSECBYTES = + lib.crypto_aead_xchacha20poly1305_IETF_NSECBYTES; + sodium.crypto_aead_xchacha20poly1305_ietf_ABYTES = + lib.crypto_aead_xchacha20poly1305_ietf_ABYTES; + sodium.crypto_aead_xchacha20poly1305_ietf_KEYBYTES = + lib.crypto_aead_xchacha20poly1305_ietf_KEYBYTES; + sodium.crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX = + lib.crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX; + sodium.crypto_aead_xchacha20poly1305_ietf_NPUBBYTES = + lib.crypto_aead_xchacha20poly1305_ietf_NPUBBYTES; + sodium.crypto_aead_xchacha20poly1305_ietf_NSECBYTES = + lib.crypto_aead_xchacha20poly1305_ietf_NSECBYTES; + sodium.crypto_auth_BYTES = lib.crypto_auth_BYTES; + sodium.crypto_auth_KEYBYTES = lib.crypto_auth_KEYBYTES; + sodium.crypto_box_BEFORENMBYTES = lib.crypto_box_BEFORENMBYTES; + sodium.crypto_box_MACBYTES = lib.crypto_box_MACBYTES; + sodium.crypto_box_MESSAGEBYTES_MAX = lib.crypto_box_MESSAGEBYTES_MAX; + sodium.crypto_box_NONCEBYTES = lib.crypto_box_NONCEBYTES; + sodium.crypto_box_PUBLICKEYBYTES = lib.crypto_box_PUBLICKEYBYTES; + sodium.crypto_box_SEALBYTES = lib.crypto_box_SEALBYTES; + sodium.crypto_box_SECRETKEYBYTES = lib.crypto_box_SECRETKEYBYTES; + sodium.crypto_box_SEEDBYTES = lib.crypto_box_SEEDBYTES; + sodium.crypto_generichash_BYTES = lib.crypto_generichash_BYTES; + sodium.crypto_generichash_BYTES_MAX = lib.crypto_generichash_BYTES_MAX; + sodium.crypto_generichash_BYTES_MIN = lib.crypto_generichash_BYTES_MIN; + sodium.crypto_generichash_KEYBYTES = lib.crypto_generichash_KEYBYTES; + sodium.crypto_generichash_KEYBYTES_MAX = lib.crypto_generichash_KEYBYTES_MAX; + sodium.crypto_generichash_KEYBYTES_MIN = lib.crypto_generichash_KEYBYTES_MIN; + sodium.crypto_hash_BYTES = lib.crypto_hash_BYTES; + sodium.crypto_kdf_BYTES_MAX = lib.crypto_kdf_BYTES_MAX; + sodium.crypto_kdf_BYTES_MIN = lib.crypto_kdf_BYTES_MIN; + sodium.crypto_kdf_CONTEXTBYTES = lib.crypto_kdf_CONTEXTBYTES; + sodium.crypto_kdf_KEYBYTES = lib.crypto_kdf_KEYBYTES; + sodium.crypto_kx_PUBLICKEYBYTES = lib.crypto_kx_PUBLICKEYBYTES; + sodium.crypto_kx_SECRETKEYBYTES = lib.crypto_kx_SECRETKEYBYTES; + sodium.crypto_kx_SEEDBYTES = lib.crypto_kx_SEEDBYTES; + sodium.crypto_kx_SESSIONKEYBYTES = lib.crypto_kx_SESSIONKEYBYTES; + sodium.crypto_pwhash_ALG_ARGON2I13 = lib.crypto_pwhash_ALG_ARGON2I13; + sodium.crypto_pwhash_ALG_ARGON2ID13 = lib.crypto_pwhash_ALG_ARGON2ID13; + sodium.crypto_pwhash_ALG_DEFAULT = lib.crypto_pwhash_ALG_DEFAULT; + sodium.crypto_pwhash_BYTES_MAX = lib.crypto_pwhash_BYTES_MAX; + sodium.crypto_pwhash_BYTES_MIN = lib.crypto_pwhash_BYTES_MIN; + sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE = + lib.crypto_pwhash_MEMLIMIT_INTERACTIVE; + sodium.crypto_pwhash_MEMLIMIT_MAX = lib.crypto_pwhash_MEMLIMIT_MAX; + sodium.crypto_pwhash_MEMLIMIT_MIN = lib.crypto_pwhash_MEMLIMIT_MIN; + sodium.crypto_pwhash_MEMLIMIT_MODERATE = lib.crypto_pwhash_MEMLIMIT_MODERATE; + sodium.crypto_pwhash_MEMLIMIT_SENSITIVE = + lib.crypto_pwhash_MEMLIMIT_SENSITIVE; + sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE = + lib.crypto_pwhash_OPSLIMIT_INTERACTIVE; + sodium.crypto_pwhash_OPSLIMIT_MAX = lib.crypto_pwhash_OPSLIMIT_MAX; + sodium.crypto_pwhash_OPSLIMIT_MIN = lib.crypto_pwhash_OPSLIMIT_MIN; + sodium.crypto_pwhash_OPSLIMIT_MODERATE = lib.crypto_pwhash_OPSLIMIT_MODERATE; + sodium.crypto_pwhash_OPSLIMIT_SENSITIVE = + lib.crypto_pwhash_OPSLIMIT_SENSITIVE; + sodium.crypto_pwhash_PASSWD_MAX = lib.crypto_pwhash_PASSWD_MAX; + sodium.crypto_pwhash_PASSWD_MIN = lib.crypto_pwhash_PASSWD_MIN; + sodium.crypto_pwhash_SALTBYTES = lib.crypto_pwhash_SALTBYTES; + sodium.crypto_pwhash_STRBYTES = lib.crypto_pwhash_STRBYTES; + sodium.crypto_scalarmult_BYTES = lib.crypto_scalarmult_BYTES; + sodium.crypto_scalarmult_SCALARBYTES = lib.crypto_scalarmult_SCALARBYTES; + sodium.crypto_secretbox_KEYBYTES = lib.crypto_secretbox_KEYBYTES; + sodium.crypto_secretbox_MACBYTES = lib.crypto_secretbox_MACBYTES; + sodium.crypto_secretbox_MESSAGEBYTES_MAX = + lib.crypto_secretbox_MESSAGEBYTES_MAX; + sodium.crypto_secretbox_NONCEBYTES = lib.crypto_secretbox_NONCEBYTES; + sodium.crypto_secretstream_xchacha20poly1305_ABYTES = + lib.crypto_secretstream_xchacha20poly1305_ABYTES; + sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES = + lib.crypto_secretstream_xchacha20poly1305_HEADERBYTES; + sodium.crypto_secretstream_xchacha20poly1305_KEYBYTES = + lib.crypto_secretstream_xchacha20poly1305_KEYBYTES; + sodium.crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX = + lib.crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX; + sodium.crypto_secretstream_xchacha20poly1305_TAG_FINAL = + lib.crypto_secretstream_xchacha20poly1305_TAG_FINAL; + sodium.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE = + lib.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE; + sodium.crypto_secretstream_xchacha20poly1305_TAG_PUSH = + lib.crypto_secretstream_xchacha20poly1305_TAG_PUSH; + sodium.crypto_secretstream_xchacha20poly1305_TAG_REKEY = + lib.crypto_secretstream_xchacha20poly1305_TAG_REKEY; + sodium.crypto_shorthash_BYTES = lib.crypto_shorthash_BYTES; + sodium.crypto_shorthash_KEYBYTES = lib.crypto_shorthash_KEYBYTES; + sodium.crypto_sign_BYTES = lib.crypto_sign_BYTES; + sodium.crypto_sign_MESSAGEBYTES_MAX = lib.crypto_sign_MESSAGEBYTES_MAX; + sodium.crypto_sign_PUBLICKEYBYTES = lib.crypto_sign_PUBLICKEYBYTES; + sodium.crypto_sign_SECRETKEYBYTES = lib.crypto_sign_SECRETKEYBYTES; + sodium.crypto_sign_SEEDBYTES = lib.crypto_sign_SEEDBYTES; + sodium.SODIUM_VERSION_STRING = lib.SODIUM_VERSION_STRING; + sodium.crypto_pwhash_STRPREFIX = lib.crypto_pwhash_STRPREFIX; + + resolve(undefined); }); +sodium.ready = ready; + export default sodium; + export let add = sodium.add; export let base64_variants = sodium.base64_variants; export let compare = sodium.compare; @@ -289,7 +574,6 @@ export let memzero = sodium.memzero; export let output_formats = sodium.output_formats; export let pad = sodium.pad; export let unpad = sodium.unpad; -export let ready = sodium.ready; export let symbols = sodium.symbols; export let to_base64 = sodium.to_base64; export let to_hex = sodium.to_hex; diff --git a/yarn.lock b/yarn.lock index c81aad8..da351aa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2287,7 +2287,14 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== -"@types/libsodium-wrappers@^0.7.13": +"@types/libsodium-wrappers-sumo@^0.7.8": + version "0.7.8" + resolved "https://registry.yarnpkg.com/@types/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.8.tgz#33e32b454fb6b340758c9ffdb1f9657e1be058ff" + integrity sha512-N2+df4MB/A+W0RAcTw7A5oxKgzD+Vh6Ye7lfjWIi5SdTzVLfHPzxUjhwPqHLO5Ev9fv/+VHl+sUaUuTg4fUPqw== + dependencies: + "@types/libsodium-wrappers" "*" + +"@types/libsodium-wrappers@*", "@types/libsodium-wrappers@^0.7.13": version "0.7.13" resolved "https://registry.yarnpkg.com/@types/libsodium-wrappers/-/libsodium-wrappers-0.7.13.tgz#769c4ea01de96bb297207586a70777ebf066dcb4" integrity sha512-KeAKtlObirLJk/na6jHBFEdTDjDfFS6Vcr0eG2FjiHKn3Nw8axJFfIu0Y9TpwaauRldQBj/pZm/MHtK76r6OWg== @@ -6687,6 +6694,18 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +libsodium-sumo@^0.7.13: + version "0.7.13" + resolved "https://registry.yarnpkg.com/libsodium-sumo/-/libsodium-sumo-0.7.13.tgz#533b97d2be44b1277e59c1f9f60805978ac5542d" + integrity sha512-zTGdLu4b9zSNLfovImpBCbdAA4xkpkZbMnSQjP8HShyOutnGjRHmSOKlsylh1okao6QhLiz7nG98EGn+04cZjQ== + +libsodium-wrappers-sumo@^0.7.13: + version "0.7.13" + resolved "https://registry.yarnpkg.com/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.13.tgz#a33aea845a0bb56db067548f04feba28c730ab8e" + integrity sha512-lz4YdplzDRh6AhnLGF2Dj2IUj94xRN6Bh8T0HLNwzYGwPehQJX6c7iYVrFUPZ3QqxE0bqC+K0IIqqZJYWumwSQ== + dependencies: + libsodium-sumo "^0.7.13" + libsodium-wrappers@^0.7.13: version "0.7.13" resolved "https://registry.yarnpkg.com/libsodium-wrappers/-/libsodium-wrappers-0.7.13.tgz#83299e06ee1466057ba0e64e532777d2929b90d3"