mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
11 lines
409 B
TypeScript
11 lines
409 B
TypeScript
import eccrypto = require("eccrypto");
|
|
import expect = require("expect");
|
|
const privKey = eccrypto.generatePrivate();
|
|
const pubKey = eccrypto.getPublicCompressed(privKey);
|
|
const msg = 'testing';
|
|
(async () => {
|
|
const encoded = await eccrypto.encrypt(pubKey, Buffer.from(msg, 'utf-8'));
|
|
const decoded = await eccrypto.decrypt(privKey, encoded);
|
|
expect(decoded.toString('utf-8')).toEqual(msg);
|
|
})();
|