JavaScript crypto utilities for PHPCoin.
This library provides account/key helpers, signing/verification, hashing, encryption, deterministic account generation, and browser wallet-connect message helpers.
npm install phpcoin-cryptonpm install
npm run buildBuild outputs:
dist/phpcoin-crypto.browser.jsdist/phpcoin-crypto.browser.min.jsdist/phpcoin-crypto.esm.js
npm test
npm run test-esmBrowser demo:
- open
test.html
const phpcoinCrypto = require("phpcoin-crypto");
const account = phpcoinCrypto.generateAccount();
const signature = phpcoinCrypto.sign("hello", account.privateKey);
const verified = phpcoinCrypto.verify("hello", signature, account.publicKey);import phpcoinCrypto from "phpcoin-crypto";
const account = phpcoinCrypto.generateAccount();
const hash = phpcoinCrypto.sha256("some_input");generateAccount([seed])importPrivateKey(privateKeyB58)getPublicKey(privateKeyB58)getAddress(publicKeyB58)verifyAddress(address)sign(data, privateKeyB58)verify(data, signatureB58, publicKeyB58)signTransaction(tx, privateKeyB58, chainId)encryptString(text, passphrase)decryptString(encrypted, passphrase)sha256(input)generateRandomString(length)generateDeterministicAccount(input, salt)
Browser wallet flow helpers:
connectWallet(options)signTransactionWithWallet(options)walletListen(options)