File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import * as naclUtil from 'tweetnacl-util';
4
4
import { isNullish } from './utils' ;
5
5
6
6
export type EthEncryptedData = {
7
- version : string ;
7
+ version : 'x25519-xsalsa20-poly1305' ;
8
8
nonce : string ;
9
9
ephemPublicKey : string ;
10
10
ciphertext : string ;
@@ -25,8 +25,8 @@ export function encrypt({
25
25
version,
26
26
} : {
27
27
publicKey : string ;
28
- data : unknown ;
29
- version : string ;
28
+ data : string ;
29
+ version : 'x25519-xsalsa20-poly1305' ;
30
30
} ) : EthEncryptedData {
31
31
if ( isNullish ( publicKey ) ) {
32
32
throw new Error ( 'Missing publicKey parameter' ) ;
@@ -65,7 +65,7 @@ export function encrypt({
65
65
66
66
// handle encrypted data
67
67
const output = {
68
- version : 'x25519-xsalsa20-poly1305' ,
68
+ version : 'x25519-xsalsa20-poly1305' as const ,
69
69
nonce : naclUtil . encodeBase64 ( nonce ) ,
70
70
ephemPublicKey : naclUtil . encodeBase64 ( ephemeralKeyPair . publicKey ) ,
71
71
ciphertext : naclUtil . encodeBase64 ( encryptedMessage ) ,
@@ -98,7 +98,7 @@ export function encryptSafely({
98
98
} : {
99
99
publicKey : string ;
100
100
data : unknown ;
101
- version : string ;
101
+ version : 'x25519-xsalsa20-poly1305' ;
102
102
} ) : EthEncryptedData {
103
103
if ( isNullish ( publicKey ) ) {
104
104
throw new Error ( 'Missing publicKey parameter' ) ;
You can’t perform that action at this time.
0 commit comments