Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Identity
✓ import { Identity } from '@dcl/crypto'
✗ import Identity from '@dcl/crypto'
Identity is a named export, not a default one. Common mistake when migrating from CommonJS.
Authenticator
✓ import { Authenticator } from '@dcl/crypto'
✗ const { Authenticator } = require('dcl-crypto')
Use the scoped @dcl/crypto package for ESM compatibility. The unscoped 'dcl-crypto' is deprecated.
createIdentity
✓ import { createIdentity } from '@dcl/crypto'
✗ import { createIdentity } from 'decentraland-crypto'
Correct package name is '@dcl/crypto'. The full name 'decentraland-crypto' is a common alias but may not resolve correctly.
AuthLink
✓ import type { AuthLink } from '@dcl/crypto'
Use 'import type' for type-only imports to avoid runtime bundling issues.
Demonstrates creating an identity and signing/verifying a message using browser Ethereum provider.
import { Authenticator, createIdentity } from '@dcl/crypto';
import { ethers } from 'ethers';
async function authenticate() {
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const address = await signer.getAddress();
const identity = await createIdentity(address, signer);
console.log('Identity created:', identity);
const message = 'Hello, Decentraland!';
const authChain = await Authenticator.initializeMessage(identity, message);
const isValid = await Authenticator.validateSignature(identity.authChain, authChain, message);
console.log('Signature valid:', isValid);
}
authenticate().catch(console.error);
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'dcl-crypto' in '/path/to/file'
Importing from the deprecated unscoped package name after upgrading to v3.
fixChange import to '@dcl/crypto' and run `npm install @dcl/crypto`.
TypeError: Authenticator.validateSignature is not a function
Calling old method signature after upgrading to v3 where the API changed.
fixCheck docs for new signature: `Authenticator.validateSignature(authChain, authLink, message)`.
MissingProviderError: No provider found. Please inject an Ethereum provider.
Trying to use createIdentity without providing a valid provider.
fixEnsure you pass a valid provider (e.g., from ethers or eth-connect) as the second argument.
Error: The message is too long (max 10000 characters)
Signing a message that exceeds the maximum allowed length.
fixShorten the message or split it into chunks that are individually signed.
Audit
Dependencies
eth-cryptorequiredUsed for cryptographic operations like signing and key management.
eth-connectrequiredProvides Ethereum provider interface for blockchain interactions.