
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@etherplay/alchemy
Advanced tools
Alchemy Mechanism For Deterministic Account Generation - provides social login mechanisms including email OTP, OAuth (Google, Facebook, Auth0), and mnemonic phrase authentication
Alchemy mechanism for deterministic account generation in the @etherplay/connect ecosystem. This package provides social login mechanisms including email OTP, OAuth (Google, Facebook, Auth0), and mnemonic phrase authentication using Alchemy's Account Kit infrastructure.
npm install @etherplay/alchemy
# or
pnpm add @etherplay/alchemy
# or
yarn add @etherplay/alchemy
This package requires Svelte 5.x as a peer dependency:
npm install svelte@^5.0.0
import {createAlchemyConnection} from '@etherplay/alchemy';
import {EthereumWalletConnector} from '@etherplay/wallet-connector-ethereum';
const connector = new EthereumWalletConnector();
const connection = createAlchemyConnection({
alchemy: {
apiKey: 'YOUR_ALCHEMY_API_KEY',
// Additional Alchemy configuration
},
accountGenerator: connector.accountGenerator,
windowOrigin: window.location.origin,
signingOrigin: 'https://your-app.com',
autoInitialise: true,
});
// Subscribe to connection state changes (Svelte store)
connection.subscribe((state) => {
console.log('Connection state:', state?.step);
});
// Start email authentication
await connection.connect({
type: 'email',
mode: 'otp',
email: 'user@example.com',
});
// After user receives OTP
await connection.provideOTP('123456');
// Using popup
await connection.connect({
type: 'oauth',
provider: {id: 'google'},
usePopup: true,
});
// Then confirm the OAuth flow
await connection.confirmOAuth();
await connection.connect({
type: 'oauth',
provider: {id: 'auth0', connection: 'your-auth0-connection'},
usePopup: true,
});
await connection.connect({
type: 'mnemonic',
mnemonic: 'your twelve word mnemonic phrase goes here and more words',
index: 0,
});
The connection follows a state machine with the following steps:
| Step | Description |
|---|---|
Initialising | Connection is being initialized |
Initialised | Signer is ready |
MechanismToChoose | Waiting for mechanism selection |
MechanismChosen | Mechanism selected, processing |
EmailToProvide | Waiting for email input |
WaitingForOTP | Email sent, waiting for OTP |
VerifyingOTP | Verifying the provided OTP |
ConfirmOAuth | OAuth popup ready, needs confirmation |
WaitingForOAuthResponse | Waiting for OAuth provider response |
MnemonicIndexToProvide | Waiting for mnemonic index |
GeneratingAccount | Creating the account |
SignedIn | Successfully authenticated |
Generate isolated accounts for specific origins:
connection.subscribe(async (state) => {
if (state?.step === 'SignedIn') {
const originAccount = await connection.generateOriginAccount('https://game.example.com', state.account);
console.log('Origin account address:', originAccount.signer.address);
console.log('Origin public key:', originAccount.signer.publicKey);
}
});
type AlchemyMechanism = EmailMechanism<string | undefined> | OauthMechanism | MnemonicMechanism<number | undefined>;
type EtherplayAccount = {
localAccount: {
address: `0x${string}`;
index: number;
key: `0x${string}`;
};
signer: {
mechanismUsed: AlchemyMechanism;
user: AlchemyUser;
};
accountType: string;
};
type OriginAccount = {
address: `0x${string}`;
signer: {
origin: string;
address: `0x${string}`;
publicKey: `0x${string}`;
privateKey: `0x${string}`;
mnemonicKey: `0x${string}`;
};
metadata: {
email?: string;
};
mechanismUsed: AlchemyMechanism | {type: string};
savedPublicKeyPublicationSignature?: `0x${string}`;
accountType: string;
};
type AlchemyUser = {
email?: string;
orgId: string;
userId: string;
address: `0x${string}`;
credentialId?: string;
idToken?: string;
claims?: Record<string, unknown>;
};
function createAlchemyConnection(settings: {
alchemy: AlchemySettings;
autoInitialise?: boolean;
alwaysUsePopupForOAuth?: boolean;
accountGenerator: AccountGenerator;
windowOrigin: string;
signingOrigin: string;
}): AlchemyConnectionStore;
| Method | Description |
|---|---|
subscribe | Subscribe to connection state changes |
connect(mechanism?) | Start authentication with optional mechanism |
confirmOAuth() | Confirm OAuth popup authentication |
provideEmail(email) | Provide email for OTP authentication |
provideOTP(otp) | Submit OTP code |
provideMnemonicIndex(index) | Provide account index for mnemonic |
generateOriginAccount(origin, account) | Generate origin-specific account |
completeOAuthWithBundle(...) | Complete OAuth with redirect bundle |
confirmOriginAccess() | Confirm cross-origin access |
// Generate mnemonic from entropy key
fromEntropyKeyToMnemonic(key: `0x${string}`): string;
// Generate key from signature
fromSignatureToKey(signature: `0x${string}`): `0x${string}`;
// Message templates
originKeyMessage(origin: string): string;
localKeyMessage(): string;
originPublicKeyPublicationMessage(origin: string, publicKey: `0x${string}`): string;
@etherplay/wallet-connector - Core wallet connector interfaces@etherplay/wallet-connector-ethereum - Ethereum wallet connector@etherplay/connect - Main connection libraryMIT
FAQs
Alchemy Mechanism For Deterministic Account Generation - provides social login mechanisms including email OTP, OAuth (Google, Facebook, Auth0), and mnemonic phrase authentication
The npm package @etherplay/alchemy receives a total of 28 weekly downloads. As such, @etherplay/alchemy popularity was classified as not popular.
We found that @etherplay/alchemy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

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.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.