How to use the @aeternity/aepp-sdk.Crypto function in @aeternity/aepp-sdk

To help you get started, we’ve selected a few @aeternity/aepp-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aeternity / aepp-aeproject-js / packages / aeproject-utils / utils / contract-utils.js View on Github external
*  purpose with or without fee is hereby granted, provided that the above
 *  copyright notice and this permission notice appear in all copies.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
 *  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 *  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 *  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 *  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 *  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 *  PERFORMANCE OF THIS SOFTWARE.
 */

require = require('esm')(module /*, options */) // use to handle es6 import/export

const AeSDK = require('@aeternity/aepp-sdk');
const Crypto = AeSDK.Crypto;
const toBytes = require('@aeternity/aepp-sdk/es/utils/bytes').toBytes;

function keyToHex (publicKey) {
    let byteArray = Crypto.decodeBase58Check(publicKey.split('_')[1]);
    let asHex = '#' + byteArray.toString('hex');
    return asHex;
}

const isKeyPair = (k) => {
    if (k == null) {
        return false
    }
    if (typeof k != 'object') {
        return false
    }
github aeternity / aepp-aeproject-js / cli-commands / aeproject-deploy / deploy.js View on Github external
const fs = require('fs');
const defaultDeploymentFilePath = `deployment/deploy.js`;
const AeSDK = require('@aeternity/aepp-sdk');
const Crypto = AeSDK.Crypto;
const path = require('path');

const verifyDeploymentFile = (deploymentFile) => {
	if (!fs.existsSync(deploymentFile)) {
		throw new Error(`${deploymentFile} file not found. Probably you've not initialized aeproject. Please run aeproject init first.`)
	}
};

const getDeployMethod = (deploymentFilePath) => {
	const _deploymentFilePath = (deploymentFilePath) ? deploymentFilePath : defaultDeploymentFilePath;
	verifyDeploymentFile(_deploymentFilePath);

	const deploymentFile = path.resolve(process.cwd(),_deploymentFilePath);
	const deployModule = require(deploymentFile);

	return deployModule.deploy;