blob: 358b9950b2a964cd64caa6c5c52f060901ceb98d [file] [log] [blame]
jiewen_tan@apple.come0235352016-10-06 21:32:02 +00001/*
jiewen_tan@apple.comdfe64f42016-10-25 06:07:04 +00002 * Copyright (C) 2016 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
jiewen_tan@apple.come0235352016-10-06 21:32:02 +000025
jiewen_tan@apple.comdf5276a2016-11-10 18:36:44 +000026enum KeyFormat { "raw", "spki", "pkcs8", "jwk" };
27
commit-queue@webkit.orgb77fc8e2017-08-16 22:11:18 +000028typedef (object or DOMString) AlgorithmIdentifier;
29
jiewen_tan@apple.come0235352016-10-06 21:32:02 +000030[
don.olmstead@sony.com58cd5d82018-11-30 22:23:17 +000031 Conditional=WEB_CRYPTO,
jiewen_tan@apple.come0235352016-10-06 21:32:02 +000032 Exposed=(Window,Worker),
33 GenerateIsReachable=ImplScriptExecutionContext,
cdumez@apple.com55e21212021-07-07 15:37:24 +000034 SecureContext,
jiewen_tan@apple.come0235352016-10-06 21:32:02 +000035] interface SubtleCrypto {
shvaikalesh@gmail.comdf314512022-02-04 16:41:47 +000036 [CallWith=CurrentGlobalObject] Promise<any> encrypt(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
37 [CallWith=CurrentGlobalObject] Promise<any> decrypt(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
38 [CallWith=CurrentGlobalObject] Promise<any> sign(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
39 [CallWith=CurrentGlobalObject] Promise<any> verify(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource signature, BufferSource data);
40 [CallWith=CurrentGlobalObject] Promise<any> digest(AlgorithmIdentifier algorithm, BufferSource data);
41 [CallWith=CurrentGlobalObject] Promise<any> generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<CryptoKeyUsage> keyUsages);
42 [CallWith=CurrentGlobalObject] Promise<any> deriveKey(AlgorithmIdentifier algorithm, CryptoKey baseKey, AlgorithmIdentifier derivedKeyType, boolean extractable, sequence<CryptoKeyUsage> keyUsages);
43 [CallWith=CurrentGlobalObject] Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm, CryptoKey baseKey, unsigned long length);
44 [CallWith=CurrentGlobalObject] Promise<CryptoKey> importKey(KeyFormat format, (BufferSource or JsonWebKey) keyData, AlgorithmIdentifier algorithm, boolean extractable, sequence<CryptoKeyUsage> keyUsages);
commit-queue@webkit.orgb77fc8e2017-08-16 22:11:18 +000045 Promise<any> exportKey(KeyFormat format, CryptoKey key);
shvaikalesh@gmail.comdf314512022-02-04 16:41:47 +000046 [CallWith=CurrentGlobalObject] Promise<any> wrapKey(KeyFormat format, CryptoKey key, CryptoKey wrappingKey, AlgorithmIdentifier wrapAlgorithm);
47 [CallWith=CurrentGlobalObject] Promise<CryptoKey> unwrapKey(KeyFormat format, BufferSource wrappedKey, CryptoKey unwrappingKey, AlgorithmIdentifier unwrapAlgorithm, AlgorithmIdentifier unwrappedKeyAlgorithm, boolean extractable, sequence<CryptoKeyUsage> keyUsages);
jiewen_tan@apple.come0235352016-10-06 21:32:02 +000048};