1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use crate::{error::ZomeApiResult, Dispatch};
use holochain_wasm_utils::api_serialization::keystore::{
KeyType, KeystoreDeriveKeyArgs, KeystoreDeriveSeedArgs, KeystoreGetPublicKeyArgs,
KeystoreListResult, KeystoreNewRandomArgs, KeystoreSignArgs,
};
pub fn keystore_list() -> ZomeApiResult<KeystoreListResult> {
Dispatch::KeystoreList.without_input()
}
pub fn keystore_new_random<S: Into<String>>(dst_id: S, size: usize) -> ZomeApiResult<()> {
Dispatch::KeystoreNewRandom.with_input(KeystoreNewRandomArgs {
dst_id: dst_id.into(),
size,
})
}
pub fn keystore_derive_seed<S: Into<String>>(
src_id: S,
dst_id: S,
context: S,
index: u64,
) -> ZomeApiResult<()> {
Dispatch::KeystoreDeriveSeed.with_input(KeystoreDeriveSeedArgs {
src_id: src_id.into(),
dst_id: dst_id.into(),
context: context.into(),
index,
})
}
pub fn keystore_derive_key<S: Into<String>>(
src_id: S,
dst_id: S,
key_type: KeyType,
) -> ZomeApiResult<String> {
Dispatch::KeystoreDeriveKey.with_input(KeystoreDeriveKeyArgs {
src_id: src_id.into(),
dst_id: dst_id.into(),
key_type,
})
}
pub fn keystore_sign<S: Into<String>>(src_id: S, payload: S) -> ZomeApiResult<String> {
Dispatch::KeystoreSign.with_input(KeystoreSignArgs {
src_id: src_id.into(),
payload: payload.into(),
})
}
pub fn keystore_get_public_key<S: Into<String>>(src_id: S) -> ZomeApiResult<String> {
Dispatch::KeystoreGetPublicKey.with_input(KeystoreGetPublicKeyArgs {
src_id: src_id.into(),
})
}