Shogun Documentation
Shogun is a client-side Ethereum wallet that uses username and password. This documentation provides a complete overview of the available APIs.
๐ WalletManager
Main class for wallet management and authentication.
Constructor
Creates a new WalletManager instance.
Account Methods
createAccount
Creates a new GunDB account.
login
Performs login with specified credentials.
Wallet Management
saveWallet
Saves a wallet to specified storage.
retrieveWallets
Retrieves all wallets from Gun.
logout
Logs out current user.
loginWithPrivateKey
Performs login using an Ethereum private key.
saveWalletToGun
Saves a wallet to Gun.
retrieveWalletLocally
Retrieves a wallet from localStorage.
deleteWallet
Deletes a specific wallet.
convertToEthPk
Converts a Gun private key to Ethereum format.
createWalletObj
Creates a new wallet from a Gun key pair.
createWalletFromSalt
Creates a wallet from salt and Gun key pair.
Data Management
exportAllData
Exports all user data.
importAllData
Imports user data.
checkLocalData
Checks user's local data.
clearLocalData
Clears all local data for a user.
Utility Methods
getPublicKey
Gets current user's public key.
getCurrentUserKeyPair
Gets current user's key pair.
exportGunKeyPair
Exports current user's Gun key pair.
importGunKeyPair
Imports a Gun key pair.
๐ถ StealthChain
Manages stealth address functionality.
generateStealthKeys
Generates a new stealth key pair.
generateStealthAddress
Generates a stealth address for a recipient.
โ๏ธ EthereumManager
Manages Ethereum interactions.
setCustomProvider
Sets a custom provider.
loginWithEthereum
Performs login using an Ethereum account.
๐ Types and Interfaces
enum StorageType {
GUN, // Decentralized storage
LOCAL, // Local storage
BOTH // Both storages
}
interface StealthKeyPair {
pub: string; // Public key
priv: string; // Private key
epub: string; // Ephemeral public key
epriv: string; // Ephemeral private key
}
interface StealthAddressResult {
stealthAddress: string; // Generated stealth address
ephemeralPublicKey: string; // Ephemeral public key
recipientPublicKey: string; // Recipient public key
}
๐ WebAuthn
Supporto per l'autenticazione biometrica e passwordless tramite WebAuthn.
isWebAuthnSupported
Verifica se WebAuthn รจ supportato nel browser corrente.
createAccountWithWebAuthn
Crea un nuovo account utilizzando WebAuthn per l'autenticazione.
loginWithWebAuthn
Effettua il login utilizzando WebAuthn.
Interfaces
interface WebAuthnResult {
success: boolean; // Indica se l'operazione รจ riuscita
username?: string; // Username dell'account
password?: string; // Password generata
credentialId?: string; // ID della credenziale WebAuthn
error?: string; // Messaggio di errore se presente
}
interface WebAuthnVerifyResult {
success: boolean; // Indica se la verifica รจ riuscita
authenticatorData?: ArrayBuffer; // Dati dell'autenticatore
signature?: ArrayBuffer; // Firma della verifica
error?: string; // Messaggio di errore se presente
}