Files
notesnook/packages/sodium/src/browser.ts
2023-06-12 11:49:37 +05:00

63 lines
1.9 KiB
TypeScript

/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import sodium from "libsodium-wrappers-sumo";
export function initialize() {
return sodium.ready;
}
export {
crypto_generichash,
crypto_pwhash,
crypto_pwhash_ALG_ARGON2ID13,
crypto_pwhash_SALTBYTES,
crypto_pwhash_ALG_ARGON2I13,
crypto_pwhash_ALG_DEFAULT,
crypto_pwhash_OPSLIMIT_INTERACTIVE,
crypto_pwhash_OPSLIMIT_MODERATE,
crypto_pwhash_OPSLIMIT_SENSITIVE,
crypto_pwhash_MEMLIMIT_INTERACTIVE,
crypto_pwhash_MEMLIMIT_MODERATE,
crypto_pwhash_MEMLIMIT_SENSITIVE,
// helpers
from_base64,
to_base64,
randombytes_buf,
to_string,
from_hex,
base64_variants,
type StateAddress,
type Uint8ArrayOutputFormat,
type StringOutputFormat,
// aead
crypto_aead_xchacha20poly1305_ietf_KEYBYTES,
crypto_aead_xchacha20poly1305_ietf_encrypt,
crypto_aead_xchacha20poly1305_ietf_decrypt,
crypto_secretstream_xchacha20poly1305_init_push,
crypto_secretstream_xchacha20poly1305_push,
crypto_secretstream_xchacha20poly1305_init_pull,
crypto_secretstream_xchacha20poly1305_pull,
crypto_aead_xchacha20poly1305_ietf_NPUBBYTES,
crypto_secretstream_xchacha20poly1305_TAG_FINAL,
crypto_secretstream_xchacha20poly1305_TAG_MESSAGE
} from "libsodium-wrappers-sumo";