How to use the nem2-sdk.Account.createFromPrivateKey function in nem2-sdk

To help you get started, we’ve selected a few nem2-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 luxtagofficial / Apostille-library / src / hash / keccak-256.ts View on Github external
public signedHashing(data: string, signerPrivateKey: string, networkType: NetworkType): string {
    const dataHash = CryptoJS.SHA3(data, { outputLength: 256 }).toString();

    if (networkType === NetworkType.MAIN_NET || networkType === NetworkType.TEST_NET) {
      const keyPair = nem.crypto.keyPair.create(signerPrivateKey);
      return this.checksum +  keyPair.sign(dataHash).toString();
    } else {
      // sha-3 signing
      const signer = Account.createFromPrivateKey(signerPrivateKey, networkType);
      return this.checksum +  signer.signData(dataHash);
    }
  }
}
github luxtagofficial / Apostille-library / tests / e2e / PrivateApostille / Apostille.spec.ts View on Github external
it('should return true after creation', async () => {
    const privateApostille = Apostille.initFromSeed('new random seed', generator);
    const creator = Account.createFromPrivateKey(sk, NetworkType.MIJIN_TEST);
    const Icreator = new Initiator(creator);
    expect.assertions(1);
    const creationTransaction = privateApostille.update('raw');
    const signedTransaction = Icreator.sign(creationTransaction, generationHash);
    await apostilleHttp.announce(signedTransaction);
    return apostilleHttp.isCreated(privateApostille.publicAccount).then((result) => {
      expect(result).toBeTruthy();
    });
  });
github evias / nem2-sandbox / src / commands / cow / tester.ts View on Github external
private getAccount(): Account
    {
        return Account.createFromPrivateKey(this.privateKey, NetworkType.MIJIN_TEST);
    }
github luxtagofficial / Apostille-library / src / hash / sha3-256.ts View on Github external
public signedHashing(data: string, signerPrivateKey: string, networkType: NetworkType): string {
    const dataHash = sha3_256(data);

    if (networkType === NetworkType.MAIN_NET || networkType === NetworkType.TEST_NET) {
      throw Errors[Errors.NETWORK_TYPE_NOT_SUPPORTED];
    } else {
      const signer = Account.createFromPrivateKey(signerPrivateKey, networkType);
      return this.checksum +  signer.signData(dataHash);
    }
  }
}

nem2-sdk

Reactive Nem2 sdk for typescript and javascript

Apache-2.0
Latest version published 5 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages