( crypto: ISodium, nonce: Uint8Array, key: Uint8Array )
| 104 | } |
| 105 | |
| 106 | export async function encrypt( |
| 107 | crypto: ISodium, |
| 108 | nonce: Uint8Array, |
| 109 | key: Uint8Array |
| 110 | ) { |
| 111 | await crypto.initialize(); |
| 112 | return crypto.crypto_aead_xchacha20poly1305_ietf_encrypt( |
| 113 | "mystring", |
| 114 | null, |
| 115 | null, |
| 116 | nonce, |
| 117 | key, |
| 118 | "base64" |
| 119 | ); |
| 120 | } |
| 121 | |
| 122 | export async function getKey(crypto: ISodium) { |
| 123 | await crypto.initialize(); |
no test coverage detected