Socket
Book a DemoInstallSign in
Socket

@metamask/toprf-secure-backup

Package Overview
Dependencies
Maintainers
9
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/toprf-secure-backup

The MetaMask Node module template

0.7.1
latest
Source
npmnpm
Version published
Weekly downloads
53K
9.51%
Maintainers
9
Weekly downloads
 
Created
Source

@metamask/toprf-secure-backup

Installation

yarn add @metamask/toprf-secure-backup

or

npm install @metamask/toprf-secure-backup

Contributing

This package is part of a monorepo. Instructions for contributing can be found in the monorepo README.

Security Considerations

This SDK handles sensitive cryptographic material including passwords, seeds, authentication tokens, and private keys.

JavaScript Memory Limitations

Important: JavaScript's garbage collector provides no guarantees about when sensitive data is removed from memory. While the SDK performs best-effort cleanup internally, complete memory clearing cannot be guaranteed.

Best Practices

  • Minimize sensitive data lifetime - Use keys immediately, don't store in variables
  • Avoid framework state - Don't store keys in React state, Redux, or similar
  • Clear references - Set variables to null and call array.fill(0) when done
// ✅ Good: Use immediately and clear
async function decrypt(data) {
  const { encKey } = await toprfBackup.recoverEncKey(params);
  try {
    return await processData(data, encKey);
  } finally {
    encKey.fill(0);
  }
}

// ❌ Bad: Long-lived storage
this.encKey = result.encKey; // Persists in memory

Potential Risks

  • XSS attacks accessing memory
  • Malicious browser extensions
  • Memory inspection via developer tools
  • System-level memory dumps

The SDK internally clears sensitive Uint8Array data (session keys, password bytes, seeds) where possible, but JavaScript strings and BigInts cannot be reliably cleared from memory.

Keywords

MetaMask

FAQs

Package last updated on 23 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.