jiewen_tan@apple.com | e023535 | 2016-10-06 21:32:02 +0000 | [diff] [blame] | 1 | /* |
jiewen_tan@apple.com | dfe64f4 | 2016-10-25 06:07:04 +0000 | [diff] [blame] | 2 | * 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.com | e023535 | 2016-10-06 21:32:02 +0000 | [diff] [blame] | 25 | |
jiewen_tan@apple.com | df5276a | 2016-11-10 18:36:44 +0000 | [diff] [blame] | 26 | enum KeyFormat { "raw", "spki", "pkcs8", "jwk" }; |
| 27 | |
commit-queue@webkit.org | b77fc8e | 2017-08-16 22:11:18 +0000 | [diff] [blame] | 28 | typedef (object or DOMString) AlgorithmIdentifier; |
| 29 | |
jiewen_tan@apple.com | e023535 | 2016-10-06 21:32:02 +0000 | [diff] [blame] | 30 | [ |
don.olmstead@sony.com | 58cd5d8 | 2018-11-30 22:23:17 +0000 | [diff] [blame] | 31 | Conditional=WEB_CRYPTO, |
jiewen_tan@apple.com | e023535 | 2016-10-06 21:32:02 +0000 | [diff] [blame] | 32 | Exposed=(Window,Worker), |
| 33 | GenerateIsReachable=ImplScriptExecutionContext, |
cdumez@apple.com | 55e2121 | 2021-07-07 15:37:24 +0000 | [diff] [blame] | 34 | SecureContext, |
jiewen_tan@apple.com | e023535 | 2016-10-06 21:32:02 +0000 | [diff] [blame] | 35 | ] interface SubtleCrypto { |
shvaikalesh@gmail.com | df31451 | 2022-02-04 16:41:47 +0000 | [diff] [blame] | 36 | [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.org | b77fc8e | 2017-08-16 22:11:18 +0000 | [diff] [blame] | 45 | Promise<any> exportKey(KeyFormat format, CryptoKey key); |
shvaikalesh@gmail.com | df31451 | 2022-02-04 16:41:47 +0000 | [diff] [blame] | 46 | [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.com | e023535 | 2016-10-06 21:32:02 +0000 | [diff] [blame] | 48 | }; |