mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-24 07:29:30 +01:00
crypto: use buffer from node:buffer
This commit is contained in:
committed by
Abdullah Atta
parent
6561791530
commit
1190da7c91
@@ -35,7 +35,6 @@ import { Chunk, Cipher, OutputFormat, Plaintext, SerializedKey } from "./types";
|
|||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
export default class Encryption {
|
export default class Encryption {
|
||||||
private static transformInput(plaintext: Plaintext): Uint8Array {
|
private static transformInput(plaintext: Plaintext): Uint8Array {
|
||||||
console.log(base64_variants);
|
|
||||||
let data: Uint8Array | null = null;
|
let data: Uint8Array | null = null;
|
||||||
if (typeof plaintext.data === "string" && plaintext.format === "base64") {
|
if (typeof plaintext.data === "string" && plaintext.format === "base64") {
|
||||||
data = from_base64(plaintext.data, base64_variants.ORIGINAL);
|
data = from_base64(plaintext.data, base64_variants.ORIGINAL);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import {
|
|||||||
crypto_secretstream_xchacha20poly1305_STATEBYTES,
|
crypto_secretstream_xchacha20poly1305_STATEBYTES,
|
||||||
crypto_secretstream_xchacha20poly1305_TAGBYTES
|
crypto_secretstream_xchacha20poly1305_TAGBYTES
|
||||||
} from "sodium-native";
|
} from "sodium-native";
|
||||||
import { Buffer } from "buffer";
|
import { Buffer } from "node:buffer";
|
||||||
|
|
||||||
export type Uint8ArrayOutputFormat = "uint8array";
|
export type Uint8ArrayOutputFormat = "uint8array";
|
||||||
export type StringOutputFormat = "text" | "hex" | "base64";
|
export type StringOutputFormat = "text" | "hex" | "base64";
|
||||||
|
|||||||
Reference in New Issue
Block a user