#What is this?
A server-side library for creating and signing transactions in php and nodejs


# Installation
## php/laravel
Run the command:

```composer require "something/libcoinphp @dev"```

Make sure you have nodejs >= 8.11.1 (but anything above 6 should work)


## laravel (simple mod for php i think
```
	use Something\LibCoinPhp\ArrProvider;
	
	// class or whatever function thing { 
	 
	//ajlkasdjflsakjfd is your private key. In oblio servers, this input is the siteName don't worry about that)
	// second input is the vendor directory where your package will be installed. needed to access js auth.js
	$arr = new ArrProvider("ajlkasdjflsakjfd","/root/laravel-tests/vendor/something/LibCoinPhp");

	// call "commandByPrivateKey" since you initialized with a privateKey. Sorry about that
	// first input is the command inside auth.js (_this[command]);
	// second input is a comma-separated list of inputs
	$output = $arr->commandByPrivateKey("createIdentity",""); // first input is the function name. second input is json version of your thing
	// will give you an ethPublickey, private key as output
	
	// this will give you an Ethereum address from any private key. Useful if you're creating addresses for users (be careful)
	$output = $arr->commandByPrivateKey("privateKeyToAddress","oiewqufadshvflsadhf"); 

	// This will give you the server's public key. Useful if you want another user or server to send you a signed message
	$output = $arr->commandByPrivateKey("getServerPublicKey");

	// Sign a message 
	// note that this has to be a public key, not an ethereum address ( :( ) . That's just how encryption works sadly
	$output = $arr->commandByPrivateKey("send","aSecretMessage,aPublicKey");

	// Receive a message. will be decrypted using your server's  private key.
	// ensure the message was sencrypted iwth your server's public key
	$output = $arr->commandByPrivateKey("receive","theSecretMessage");

	
	// Probabilstically encrypt a piece of data so that it can only be opened by dubs.projectoblio.com
	// "dubs" is a hardwired string linked to the dubsPublicKey
	$output = $arr->commandByPrivateKey("send","aSecretMessage,dubs")

	 
	
	
```


## Manual package update (admin)
https://packagist.org/packages/projectoblio/arrlaravel

## npm update
npm publish
