Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ExportV1Encryption.js « Encryption « src - git.mdns.eu/nextcloud/passwords-client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 609daec79b16117d8c4760391310372111b3fe5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import sodium from 'libsodium-wrappers';

export default class ExportV1Encryption {

    /**
     * @param {EncryptionService} encryptionService
     */
    constructor(encryptionService) {
        this._encryptionService = encryptionService;
    }

    /**
     * Encrypts the message with the user defined password
     *
     * @param {String} message
     * @param {String} password
     * @returns {*}
     */
    async encrypt(message, password) {
        return await this._encryptionService.encryptAsync(message, password);
    }

    /**
     * Decrypts the message with the user defined password
     *
     * @param {String} message
     * @param {String} password
     * @returns {*}
     */
    async decrypt(message, password) {
        return await this._encryptionService.decryptAsync(message, password);
    }
}