MCPcopy
hub / github.com/streetwriters/notesnook / encrypt

Function encrypt

packages/sodium/tests/utils.ts:106–120  ·  view source on GitHub ↗
(
  crypto: ISodium,
  nonce: Uint8Array,
  key: Uint8Array
)

Source from the content-addressed store, hash-verified

104}
105
106export 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
122export async function getKey(crypto: ISodium) {
123 await crypto.initialize();

Callers 2

mainFunction · 0.90
compat.test.tsFile · 0.90

Calls 2

initializeMethod · 0.65

Tested by

no test coverage detected