This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import crypto from 'crypto'; | |
| const ALGORITHM = 'aes-256-cbc'; | |
| const ENCODING = 'hex'; | |
| const IV_LENGTH = 16; | |
| const KEY = process.env.ENCRYPTION_KEY!; | |
| export const encrypt = (data: string) => { | |
| const iv = crypto.randomBytes(IV_LENGTH); | |
| const cipher = crypto.createCipheriv(ALGORITHM, new Buffer(KEY), iv); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Code taken from https://gist.github.com/miguelmota/092da99bc8a8416ed7756c472dc253c4 | |
| import { | |
| GetPublicKeyCommand, | |
| KMSClient, | |
| SignCommand, | |
| } from "@aws-sdk/client-kms"; | |
| import { BigNumber, ethers, Signer, UnsignedTransaction } from "ethers"; | |
| import * as asn1 from "asn1.js"; | |
| import { AlchemyProvider } from "@ethersproject/providers"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { BigNumber, Signer } = require('ethers') | |
| const { keccak256, recoverAddress, joinSignature, resolveProperties, serializeTransaction, hashMessage, arrayify, defineReadOnly } = require('ethers/lib/utils') | |
| const { KMSClient, GetPublicKeyCommand, SignCommand } = require('@aws-sdk/client-kms') | |
| const asn1 = require('asn1.js') | |
| const EcdsaPubKey = asn1.define('EcdsaPubKey', function () { | |
| this.seq().obj( | |
| this.key('algo').seq().obj( | |
| this.key('a').objid(), | |
| this.key('b').objid() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core'; | |
| import * as firebase from 'firebase/app'; | |
| import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from 'angularfire2/firestore'; | |
| import { Observable } from 'rxjs/Observable'; | |
| import 'rxjs/add/operator/map'; | |
| import 'rxjs/add/operator/do'; | |
| import 'rxjs/add/operator/take'; | |
| import 'rxjs/add/operator/toPromise'; | |
| import 'rxjs/add/operator/switchMap'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.Globalization; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Net.Http; | |
| using System.Reactive.Linq; | |
| using System.Text; | |
| using System.Threading; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Threading; | |
| static class Program { | |
| static void Main() { | |
| Console.Write("Performing some task... "); | |
| using (var progress = new ProgressBar()) { | |
| for (int i = 0; i <= 100; i++) { | |
| progress.Report((double) i / 100); |