55 * @async
66 * @function createSymmetricKeyFromText
77 * @param {string } text - Text key to be hashed. A 32-byte high entropy string is recommended.
8- * @param {boolean } [extractable] - Indicates if the key can be exported .
8+ * @param {boolean } [extractable] - Whether the generated key is extractable. Defaults to `false`. .
99 * @param {TextEncoder } [textEncoder] - If you have an instance of a `TextEncoder`, you can reuse it.
1010 * @returns {Promise<CryptoKey> } A `CryptoKey` containing a SHA-256 hash used to encrypt and decrypt strings.
1111 * @throws {TypeError } Thrown if `text` is invalid.
@@ -46,13 +46,13 @@ export function decryptTextSymmetrically(key: CryptoKey, encryptedText: string,
4646/**
4747 * Class that simplifies the encryption and decryption using the same key.
4848 */
49- export default class SingleCryptText {
49+ export class SingleCryptText {
5050 /**
5151 * Create an instance using a text as a key.
5252 *
5353 * @param {string } text - Text key to be hashed. A 32-byte high entropy string is recommended.
5454 * @param {boolean } [urlSafe] - The encrypted values default to `base64` alphabet; this property enables the `base64url` alphabet. Enabled by default.
55- * @param {boolean } [extractable] - Indicates if the key can be exported .
55+ * @param {boolean } [extractable] - Whether the generated key is extractable. Defaults to `false`. .
5656 * @param {TextEncoder } [textEncoder] - If you have an instance of a `TextEncoder`, you can reuse it.
5757 * @param {TextDecoder } [textDecoder] - If you have an instance of a `TextDecoder`, you can reuse it.
5858 * @throws {TypeError } Thrown if `text` is invalid.
@@ -76,26 +76,23 @@ export default class SingleCryptText {
7676 *
7777 * @async
7878 * @param {string } text - String value to be encrypted.
79- * @param {boolean } [urlSafe] - The encrypted values default to `base64` alphabet; this property enables the `base64url` alphabet. Enabled by default.
80- * @param {TextEncoder } [textEncoder] - If you have an instance of a `TextEncoder`, you can reuse it.
8179 * @returns {Promise<string> } The value encrypted and encoded as a Base64 string.
8280 * @throws {DOMException } Raised when:
8381 * - The provided key is not valid.
8482 * - The operation failed (e.g., AES-GCM plaintext longer than 2^39−256 bytes).
8583 */
86- encrypt ( text : string , urlSafe ?: boolean , textEncoder ?: TextEncoder ) : Promise < string > ;
84+ encrypt ( text : string ) : Promise < string > ;
8785 /**
8886 * @async
8987 * @param {string } encryptedText - Encrypted value to be decrypted.
90- * @param {boolean } [urlSafe] - The encrypted values default to `base64` alphabet; this property enables the `base64url` alphabet. Enabled by default.
91- * @param {TextDecoder } [textDecoder] - If you have an instance of a `TextDecoder`, you can reuse it.
9288 * @returns {Promise<string> } The value decrypted.
9389 * @throws {TypeError } Thrown if `value` is not a string.
9490 * @throws {SyntaxError } Thrown if `value` contains characters outside Base64 alphabet.
9591 * @throws {DOMException } Raised when:
9692 * - The provided key is not valid.
9793 * - The operation failed.
9894 */
99- decrypt ( encryptedText : string , urlSafe ?: boolean , textDecoder ?: TextDecoder ) : Promise < string > ;
95+ decrypt ( encryptedText : string ) : Promise < string > ;
10096 #private;
10197}
98+ export default SingleCryptText ;
0 commit comments