Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

241
Views
¿El búfer @metamask/eth-sig-util" no está definido?

Estoy tratando de cifrar algunos datos usando la clave pública de MetaMask para el cifrado ( https://docs.metamask.io/guide/rpc-api.html#unrestricted-methods ). Sin embargo, al cargar la página, aparece el error El Buffer is not defined :

imagen

Parece que solo sucede cuando '@metamask/eth-sig-util' e intenté cifrar los datos:

 import ethUtil from 'ethereumjs-util' import sigUtil from '@metamask/eth-sig-util' const encryptedData = ethUtil.bufferToHex( Buffer.from( JSON.stringify( sigUtil.encrypt({ publicKey: publicKey, data: 'hello world data', version: 'x25519-xsalsa20-poly1305', }) ), 'utf8' ) )

Intenté agregar import { Buffer } from 'buffer/' , pero esto no parece ayudar.

Si import sigUtil from '@metamask/eth-sig-util' o

 const encryptedData = ethUtil.bufferToHex( Buffer.from( JSON.stringify( sigUtil.encrypt({ publicKey: publicKey, data: 'hello world data', version: 'x25519-xsalsa20-poly1305', }) ), 'utf8' ) )

El error desaparece. También intenté cambiar a eth-sig-util@2.5.3 en lugar del nuevo @metamask/eth-sig-util , pero el error persiste.

Como probé todo lo anterior, incluido el uso de una versión de paquete diferente, empiezo a preguntarme si esto no es un error dentro de la @metamask/eth-sig-util . ¿Qué está causando este problema? Estoy usando Vite para compilar mi proyecto y lo probé tanto en Chrome como en FireFox, pero el error aún persiste. ¿Qué debo comprobar?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!