Skip to content

Commit

Permalink
fix: update prop type for function encrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
promet99 committed Jul 1, 2023
1 parent 1f8be1e commit 9755424
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as naclUtil from 'tweetnacl-util';
import { isNullish } from './utils';

export type EthEncryptedData = {
version: string;
version: 'x25519-xsalsa20-poly1305';
nonce: string;
ephemPublicKey: string;
ciphertext: string;
Expand All @@ -25,8 +25,8 @@ export function encrypt({
version,
}: {
publicKey: string;
data: unknown;
version: string;
data: string;
version: 'x25519-xsalsa20-poly1305';
}): EthEncryptedData {
if (isNullish(publicKey)) {
throw new Error('Missing publicKey parameter');
Expand Down Expand Up @@ -65,7 +65,7 @@ export function encrypt({

// handle encrypted data
const output = {
version: 'x25519-xsalsa20-poly1305',
version: 'x25519-xsalsa20-poly1305' as const,
nonce: naclUtil.encodeBase64(nonce),
ephemPublicKey: naclUtil.encodeBase64(ephemeralKeyPair.publicKey),
ciphertext: naclUtil.encodeBase64(encryptedMessage),
Expand Down Expand Up @@ -98,7 +98,7 @@ export function encryptSafely({
}: {
publicKey: string;
data: unknown;
version: string;
version: 'x25519-xsalsa20-poly1305';
}): EthEncryptedData {
if (isNullish(publicKey)) {
throw new Error('Missing publicKey parameter');
Expand Down

0 comments on commit 9755424

Please sign in to comment.