web_sys/features/
gen_CryptoKeyPair.rs1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = CryptoKeyPair)]
8 #[derive(Debug, Clone, PartialEq, Eq)]
9 #[doc = "The `CryptoKeyPair` dictionary."]
10 #[doc = ""]
11 #[doc = "*This API requires the following crate features to be activated: `CryptoKeyPair`*"]
12 pub type CryptoKeyPair;
13 #[cfg(feature = "CryptoKey")]
14 #[doc = "Get the `privateKey` field of this object."]
15 #[doc = ""]
16 #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"]
17 #[wasm_bindgen(method, getter = "privateKey")]
18 pub fn get_private_key(this: &CryptoKeyPair) -> CryptoKey;
19 #[cfg(feature = "CryptoKey")]
20 #[doc = "Change the `privateKey` field of this object."]
21 #[doc = ""]
22 #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"]
23 #[wasm_bindgen(method, setter = "privateKey")]
24 pub fn set_private_key(this: &CryptoKeyPair, val: &CryptoKey);
25 #[cfg(feature = "CryptoKey")]
26 #[doc = "Get the `publicKey` field of this object."]
27 #[doc = ""]
28 #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"]
29 #[wasm_bindgen(method, getter = "publicKey")]
30 pub fn get_public_key(this: &CryptoKeyPair) -> CryptoKey;
31 #[cfg(feature = "CryptoKey")]
32 #[doc = "Change the `publicKey` field of this object."]
33 #[doc = ""]
34 #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"]
35 #[wasm_bindgen(method, setter = "publicKey")]
36 pub fn set_public_key(this: &CryptoKeyPair, val: &CryptoKey);
37}
38impl CryptoKeyPair {
39 #[cfg(feature = "CryptoKey")]
40 #[doc = "Construct a new `CryptoKeyPair`."]
41 #[doc = ""]
42 #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"]
43 pub fn new(private_key: &CryptoKey, public_key: &CryptoKey) -> Self {
44 #[allow(unused_mut)]
45 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
46 ret.set_private_key(private_key);
47 ret.set_public_key(public_key);
48 ret
49 }
50 #[cfg(feature = "CryptoKey")]
51 #[deprecated = "Use `set_private_key()` instead."]
52 pub fn private_key(&mut self, val: &CryptoKey) -> &mut Self {
53 self.set_private_key(val);
54 self
55 }
56 #[cfg(feature = "CryptoKey")]
57 #[deprecated = "Use `set_public_key()` instead."]
58 pub fn public_key(&mut self, val: &CryptoKey) -> &mut Self {
59 self.set_public_key(val);
60 self
61 }
62}