Skip to content

Commit 9755424

Browse files
committed
fix: update prop type for function encrypt
1 parent 1f8be1e commit 9755424

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/encryption.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as naclUtil from 'tweetnacl-util';
44
import { isNullish } from './utils';
55

66
export type EthEncryptedData = {
7-
version: string;
7+
version: 'x25519-xsalsa20-poly1305';
88
nonce: string;
99
ephemPublicKey: string;
1010
ciphertext: string;
@@ -25,8 +25,8 @@ export function encrypt({
2525
version,
2626
}: {
2727
publicKey: string;
28-
data: unknown;
29-
version: string;
28+
data: string;
29+
version: 'x25519-xsalsa20-poly1305';
3030
}): EthEncryptedData {
3131
if (isNullish(publicKey)) {
3232
throw new Error('Missing publicKey parameter');
@@ -65,7 +65,7 @@ export function encrypt({
6565

6666
// handle encrypted data
6767
const output = {
68-
version: 'x25519-xsalsa20-poly1305',
68+
version: 'x25519-xsalsa20-poly1305' as const,
6969
nonce: naclUtil.encodeBase64(nonce),
7070
ephemPublicKey: naclUtil.encodeBase64(ephemeralKeyPair.publicKey),
7171
ciphertext: naclUtil.encodeBase64(encryptedMessage),
@@ -98,7 +98,7 @@ export function encryptSafely({
9898
}: {
9999
publicKey: string;
100100
data: unknown;
101-
version: string;
101+
version: 'x25519-xsalsa20-poly1305';
102102
}): EthEncryptedData {
103103
if (isNullish(publicKey)) {
104104
throw new Error('Missing publicKey parameter');

0 commit comments

Comments
 (0)