Dilial API is a JavaScript API for managing Minecraft accounts and player data. It provides secure account storage with AES-256-GCM encryption, authentication with both Mojang and Microsoft accounts, and utilities for player skins and version information.
Make sure you have Node.js installed on your machine. If you don't have it, you can download and install it from the official website.
To install the API, simply run the following command in your terminal within your Node.js project:
npm install dilial-api
You can configure where and how accounts are stored:
const { configureAccountStorage } = require('dilial-api');
// Use file system (default)
configureAccountStorage({
type: 'file',
location: '/custom/path/to/store/accounts'
});
// Use Electron.js store
const Store = require('electron-store');
const electronStore = new Store();
configureAccountStorage({
type: 'electron',
electronStore: electronStore
});
// Use memory only (no persistence)
configureAccountStorage({
type: 'memory'
});
// Use custom storage implementation
configureAccountStorage({
type: 'custom',
customHandler: {
read: () => myCustomReadFunction(),
write: (data) => myCustomWriteFunction(data),
readKey: () => myCustomReadKeyFunction(),
writeKey: (key) => myCustomWriteKeyFunction(key)
}
});
The API supports both Mojang and Microsoft authentication methods:
const { auth } = require('dilial-api');
// Mojang authentication
const mojangAuth = await auth.mojangAuthenticate('username', 'password');
// Microsoft authentication (OAuth flow)
const authUrl = await auth.microsoftGenerateAuthUrl('https://your-redirect-uri.com');
console.log('Open this URL to login:', authUrl.url);
// Once you get the code from the redirect:
const msAuth = await auth.microsoftAuthenticateWithCode('authorization_code', 'https://your-redirect-uri.com');
The API stores accounts securely with encryption and supports multiple accounts:
const { accounts } = require('dilial-api');
// Get all saved accounts (safe data only)
const allAccounts = accounts.getAccounts();
// Get the currently active account
const active = accounts.getActiveAccount();
// Set a different account as active
accounts.setActiveAccount('uuid-of-account');
// Get full authentication data (with tokens)
const authData = accounts.getAuthData();
// Remove an account
accounts.removeAccount('uuid-of-account');
Get player skin data with efficient caching:
const { getPlayerSkin, getPlayerHead } = require('dilial-api');
// Get full skin data
const skinData = await getPlayerSkin({ username: 'Notch' });
console.log('Skin URL:', skinData.skinUrl);
console.log('Cape URL:', skinData.capeUrl);
console.log('Is slim model:', skinData.isSlimModel);
// Force refresh cached data
const freshData = await getPlayerSkin({
username: 'Notch',
forceRefresh: true
});
// Get just the player head
const headData = await getPlayerHead({ username: 'Notch' });
console.log('2D head:', headData.headImageUrl);
console.log('3D head:', headData.head3dUrl);
Get a player's cape data:
const { getPlayerCape } = require('dilial-api');
// Get player's cape information
const capeData = await getPlayerCape({ username: 'Notch' });
if (capeData.hasCape) {
console.log('Cape URL:', capeData.capeUrl);
console.log('Cape Render URL:', capeData.capeRenderUrl);
} else {
console.log(capeData.message); // "Player does not have a cape"
}
You can update the skin and cape for authenticated players:
const { skinUpdater } = require('dilial-api');
// Update player skin from file (supports both classic and slim models)
const skinResult = await skinUpdater.updatePlayerSkin({
skinPath: './path/to/skin.png',
slim: true // Use slim model (Alex), false for classic (Steve)
});
// Update player skin from URL
const skinUrlResult = await skinUpdater.updatePlayerSkin({
skinPath: 'https://example.com/skin.png'
});
// Update player cape (using cape ID)
const capeResult = await skinUpdater.updatePlayerCape({
capeId: 'MineCon2016'
});
// Remove a player's cape
const capeDeleteResult = await skinUpdater.deletePlayerCape();
// Use with a specific account (not the active one)
const specificAccountResult = await skinUpdater.updatePlayerSkin({
skinPath: './custom_skin.png',
uuid: 'player-uuid-here'
});
You can also update skins and capes without using the API's internal authentication system by providing direct credentials or an access token:
const { skinUpdater } = require('dilial-api');
// Authenticate directly with Mojang credentials (without storing in the account system)
const authResult = await skinUpdater.directAuthenticate({
username: 'your_email@example.com',
password: 'your_password'
});
if (authResult.success) {
console.log('Authentication successful!');
console.log('Access Token:', authResult.accessToken);
// Use the access token directly
const skinResult = await skinUpdater.updatePlayerSkin({
skinPath: './path/to/skin.png',
accessToken: authResult.accessToken
});
}
// Provide credentials directly in one step
const skinResult = await skinUpdater.updatePlayerSkin({
skinPath: './path/to/skin.png',
credentials: {
username: 'your_email@example.com',
password: 'your_password'
}
});
// Update a cape with direct credentials
const capeResult = await skinUpdater.updatePlayerCape({
capeId: 'MineCon2016',
credentials: {
username: 'your_email@example.com',
password: 'your_password'
}
});
// Get available capes for the authenticated user
const availableCapes = await skinUpdater.getAvailableCapes({
accessToken: 'your_access_token' // Or provide credentials object
});
if (availableCapes.success) {
console.log('Available capes:', availableCapes.capes);
}
Get Minecraft version information with built-in caching:
const { getVersions } = require('dilial-api');
// Get all versions
const allVersions = await getVersions();
// Get only release versions
const releaseVersions = await getVersions({ type: 'release' });
// Get only snapshots
const snapshots = await getVersions({ type: 'snapshot' });
// Force fresh data
const freshVersions = await getVersions({ forceRefresh: true });
The account system uses AES-256-GCM encryption with the following security features:
- Encryption keys are securely generated and stored
- Tokens and sensitive data are never exposed in plain text
- When using file storage, proper file permissions are set (0600)
- Custom storage options allow for advanced security implementations
- Fast API responses with intelligent caching
- Adjustable cache duration for version lists and skin data
- Timeout protection for all network requests
- Memory-efficient storage of frequently used data
This project is licensed under the MIT License.