All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.web.webcrypto.SubtleCrypto Maven / Gradle / Ivy

package js.web.webcrypto;

import js.extras.JsEnum;
import js.lang.Any;
import js.lang.BooleanPromiseLike;
import js.lang.PromiseLike;
import js.lang.Unknown;
import js.util.buffers.ArrayBuffer;
import js.web.dom.BufferSource;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSByRef;

/**
 * This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto).
 */
public interface SubtleCrypto extends Any {
    @JSBody(script = "return SubtleCrypto.prototype")
    static SubtleCrypto prototype() {
        throw new UnsupportedOperationException("Available only in JavaScript");
    }

    @JSBody(script = "return new SubtleCrypto()")
    static SubtleCrypto create() {
        throw new UnsupportedOperationException("Available only in JavaScript");
    }

    PromiseLike decrypt(String algorithm, CryptoKey key, BufferSource data);

    PromiseLike decrypt(Algorithm algorithm, CryptoKey key, BufferSource data);

    PromiseLike deriveBits(String algorithm, CryptoKey baseKey, int length);

    PromiseLike deriveBits(Algorithm algorithm, CryptoKey baseKey, int length);

    PromiseLike deriveKey(String algorithm, CryptoKey baseKey, String derivedKeyType, boolean extractable, String... keyUsages);

    PromiseLike deriveKey(Algorithm algorithm, CryptoKey baseKey, String derivedKeyType, boolean extractable, String... keyUsages);

    PromiseLike deriveKey(String algorithm, CryptoKey baseKey, Algorithm derivedKeyType, boolean extractable, String... keyUsages);

    PromiseLike deriveKey(Algorithm algorithm, CryptoKey baseKey, Algorithm derivedKeyType, boolean extractable, String... keyUsages);

    PromiseLike digest(String algorithm, BufferSource data);

    PromiseLike digest(Algorithm algorithm, BufferSource data);

    PromiseLike encrypt(String algorithm, CryptoKey key, BufferSource data);

    PromiseLike encrypt(Algorithm algorithm, CryptoKey key, BufferSource data);

    PromiseLike exportKey(FormatJwk format, CryptoKey key);

    PromiseLike exportKey(Format format, CryptoKey key);

    PromiseLike exportKey(String format, CryptoKey key);

    PromiseLike generateKey(String algorithm, boolean extractable, String... keyUsages);

    PromiseLike generateKey(Algorithm algorithm, boolean extractable, String... keyUsages);

    PromiseLike importKey(FormatJwk format, JsonWebKey keyData, String algorithm, boolean extractable, String... keyUsages);

    PromiseLike importKey(FormatJwk format, JsonWebKey keyData, Algorithm algorithm, boolean extractable, String... keyUsages);

    PromiseLike importKey(Format format, BufferSource keyData, String algorithm, boolean extractable, String... keyUsages);

    PromiseLike importKey(Format format, BufferSource keyData, Algorithm algorithm, boolean extractable, String... keyUsages);

    PromiseLike importKey(String format, JsonWebKey keyData, String algorithm, boolean extractable, String... keyUsages);

    PromiseLike importKey(String format, BufferSource keyData, String algorithm, boolean extractable, String... keyUsages);

    PromiseLike importKey(String format, JsonWebKey keyData, Algorithm algorithm, boolean extractable, String... keyUsages);

    PromiseLike importKey(String format, BufferSource keyData, Algorithm algorithm, boolean extractable, String... keyUsages);

    PromiseLike sign(String algorithm, CryptoKey key, BufferSource data);

    PromiseLike sign(Algorithm algorithm, CryptoKey key, BufferSource data);

    PromiseLike unwrapKey(String format, BufferSource wrappedKey, CryptoKey unwrappingKey, String unwrapAlgorithm, String unwrappedKeyAlgorithm, boolean extractable, String... keyUsages);

    PromiseLike unwrapKey(String format, BufferSource wrappedKey, CryptoKey unwrappingKey, Algorithm unwrapAlgorithm, String unwrappedKeyAlgorithm, boolean extractable, String... keyUsages);

    PromiseLike unwrapKey(String format, BufferSource wrappedKey, CryptoKey unwrappingKey, String unwrapAlgorithm, Algorithm unwrappedKeyAlgorithm, boolean extractable, String... keyUsages);

    PromiseLike unwrapKey(String format, BufferSource wrappedKey, CryptoKey unwrappingKey, Algorithm unwrapAlgorithm, Algorithm unwrappedKeyAlgorithm, boolean extractable, String... keyUsages);

    BooleanPromiseLike verify(String algorithm, CryptoKey key, BufferSource signature, BufferSource data);

    BooleanPromiseLike verify(Algorithm algorithm, CryptoKey key, BufferSource signature, BufferSource data);

    PromiseLike wrapKey(String format, CryptoKey key, CryptoKey wrappingKey, String wrapAlgorithm);

    PromiseLike wrapKey(String format, CryptoKey key, CryptoKey wrappingKey, Algorithm wrapAlgorithm);

    abstract class FormatJwk extends JsEnum {
        public static final FormatJwk JWK = JsEnum.of("jwk");

    }

    abstract class Format extends JsEnum {
        public static final Format RAW = JsEnum.of("raw");

        public static final Format PKCS8 = JsEnum.of("pkcs8");

        public static final Format SPKI = JsEnum.of("spki");

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy