Add public API
This commit is contained in:
6
src/decrypt.ts
Normal file
6
src/decrypt.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { cryptoAeadDecrypt } from './romulus-m'
|
||||
|
||||
export function decrypt (ciphertext: Buffer, associatedData: Buffer, nonce: Buffer, key: Buffer): Buffer {
|
||||
const plaintext = cryptoAeadDecrypt(Array.from(ciphertext), Array.from(associatedData), Array.from(nonce), Array.from(key))
|
||||
return Buffer.from(plaintext)
|
||||
}
|
||||
6
src/encrypt.ts
Normal file
6
src/encrypt.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { cryptoAeadEncrypt } from './romulus-m'
|
||||
|
||||
export function encrypt (message: Buffer, associatedData: Buffer, nonce: Buffer, key: Buffer): Buffer {
|
||||
const ciphertext = cryptoAeadEncrypt(Array.from(message), Array.from(associatedData), Array.from(nonce), Array.from(key))
|
||||
return Buffer.from(ciphertext)
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
console.log('Hello, World')
|
||||
export { encrypt } from './encrypt'
|
||||
export { decrypt } from './decrypt'
|
||||
|
||||
Reference in New Issue
Block a user