Skip to content

Instantly share code, notes, and snippets.

View alexneamtu's full-sized avatar

Alex Neamtu alexneamtu

View GitHub Profile
@alexneamtu
alexneamtu / ecies.js
Created February 11, 2022 21:13
Ecies
const { privateDecrypt } = require('crypto');
const eccrypto = require('eccrypto');
const oldPrivateKey = '-----BEGIN PRIVATE KEY-----\n' +
///PRIVATE KEY CODE
'-----END PRIVATE KEY-----';
const data = 'some base64';
const decryptpedDoc = privateDecrypt(oldPrivateKey, Buffer.from(data, 'base64'));
const decryptpedDocString = decryptpedDoc.toString();
{
"compileOnSave": true,
"compilerOptions": {
"noEmit": true,
"module": "commonjs",
"inlineSourceMap": true,
"inlineSources": true,
"target": "es2016",
"pretty": true,
"experimentalDecorators": true,
{
"extends": [
"tslint:latest",
"tslint-config-airbnb"
],
"rules": {
"no-trailing-whitespace": [true, "ignore-template-strings"],
"variable-name": [true, "allow-pascal-case"],
"no-implicit-dependencies": [true, "dev"],
"interface-name": [true, "always-prefix"],
@alexneamtu
alexneamtu / flatten.js
Last active July 19, 2019 11:09
Flatten Object
/**
* Takes a deeply nested object, `source`, and returns an object with
* dot-separated paths pointing to all primitive values from `source`.
*
* Examples:
*
* flatten({ foo: { bar: 1 } })
* //=> { 'foo.bar': 1 }
*
* flatten({ foo: [{ bar: 1 }, { bar: 2 }] })