"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.webCrypto = webCrypto;
const APINotImplementedError_1 = require("../../../../exception/APINotImplementedError");
function webCrypto(window, opt) {
    const check = () => {
        if (!window.crypto) {
            throw new APINotImplementedError_1.APINotSupportedError('Crypto');
        }
    };
    const crypto = {
        generateKey: function (algorithm, extractable, keyUsages) {
            check();
            return window.crypto.subtle.generateKey(algorithm, extractable, keyUsages);
        },
        exportKey: function (format, key) {
            check();
            return window.crypto.subtle.exportKey(format, key);
        },
        importKey: function (format, key, algorithm, extractable, keyUsages) {
            check();
            return window.crypto.subtle.importKey(format, key, algorithm, extractable, keyUsages);
        },
        encrypt: function (algorithm, key, data) {
            check();
            return window.crypto.subtle.encrypt(algorithm, key, data);
        },
        decrypt: function (algorithm, key, data) {
            check();
            return window.crypto.subtle.decrypt(algorithm, key, data);
        },
        sign: function (algorithm, key, data) {
            check();
            return window.crypto.subtle.sign(algorithm, key, data);
        },
        verify: function (algorithm, key, signature, data) {
            check();
            return window.crypto.subtle.verify(algorithm, key, signature, data);
        },
    };
    return crypto;
}
//# sourceMappingURL=crypto.js.map