Skip to content

phpcoinn/phpcoin-crypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpcoin-crypto

JavaScript crypto utilities for PHPCoin.

This library provides account/key helpers, signing/verification, hashing, encryption, deterministic account generation, and browser wallet-connect message helpers.

Install

npm install phpcoin-crypto

Build

npm install
npm run build

Build outputs:

  • dist/phpcoin-crypto.browser.js
  • dist/phpcoin-crypto.browser.min.js
  • dist/phpcoin-crypto.esm.js

Test

npm test
npm run test-esm

Browser demo:

  • open test.html

Usage (Node/CommonJS)

const phpcoinCrypto = require("phpcoin-crypto");

const account = phpcoinCrypto.generateAccount();
const signature = phpcoinCrypto.sign("hello", account.privateKey);
const verified = phpcoinCrypto.verify("hello", signature, account.publicKey);

Usage (ESM)

import phpcoinCrypto from "phpcoin-crypto";

const account = phpcoinCrypto.generateAccount();
const hash = phpcoinCrypto.sha256("some_input");

Main API

  • 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)

About

Javascript crypto functions for PHP Coin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors