Skip to content

Commit e213054

Browse files
committed
refactor: introduce EncryptDecryptOptions type for encryption and decryption methods
1 parent 12111b7 commit e213054

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ export interface EcdsaParams extends Algorithm {
8787
hash: AlgorithmIdentifier
8888
}
8989

90+
export type EncryptDecryptOptions = { name: string } | { algorithm: string, hash: string, salt?: string }
91+
9092
export interface TokenInfo {
9193
id?: string
9294
Name?: string
@@ -496,7 +498,7 @@ export class NodeArweaveWallet {
496498
*/
497499
async encrypt(
498500
data: string | Uint8Array,
499-
options: { algorithm: string, hash: string, salt?: string },
501+
options: EncryptDecryptOptions,
500502
): Promise<Uint8Array> {
501503
const dataToEncrypt = typeof data === 'string' ? data : bufferToBase64(data)
502504
const result = await this.makeWalletRequest<string>('encrypt', { data: dataToEncrypt, options })
@@ -526,7 +528,7 @@ export class NodeArweaveWallet {
526528
*/
527529
async decrypt(
528530
data: Uint8Array,
529-
options: { algorithm: string, hash: string, salt?: string },
531+
options: EncryptDecryptOptions,
530532
): Promise<Uint8Array> {
531533
const dataBase64 = bufferToBase64(data)
532534
const result = await this.makeWalletRequest<string>('decrypt', { data: dataBase64, options })

0 commit comments

Comments
 (0)