Skip to content

Instantly share code, notes, and snippets.

@christopheranderson
Created August 28, 2018 02:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christopheranderson/e3f0f0777e8a80919776a3ef5d8a4d6f to your computer and use it in GitHub Desktop.
Save christopheranderson/e3f0f0777e8a80919776a3ef5d8a4d6f to your computer and use it in GitHub Desktop.
create-hmac typescript default import
import createHmac from "create-hmac";
const hmac = createHmac("sha256", "hello world").update("I love cupcakes").digest("hex");
console.log(hmac);
{
"name": "scratch-hmac",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "ts-node --files --project ./tsconfig.json index.ts"
},
"author": "",
"license": "ISC",
"dependencies": {
"create-hmac": "^1.1.7"
},
"devDependencies": {
"@types/node": "^10.9.2",
"ts-node": "^7.0.1",
"typescript": "^3.0.1"
}
}
import createHmac from "create-hmac";
const hmac = createHmac("sha256", "hello world").update("I love cupcakes").digest("hex");
console.log(hmac);
{
"compilerOptions": {
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"outDir": "./lib",
"preserveConstEnums": true,
"removeComments": false,
"target": "es6",
"sourceMap": true,
"newLine": "LF",
"lib": ["es6", "esnext.asynciterable"],
// Enable support for importing CommonJS modules targeting es6 modules
"esModuleInterop": true,
// When using above interop will get missing default export error from type check since
// modules use "export =" instead of "export default", enable this to ignore errors.
"allowSyntheticDefaultImports": true
},
"include": ["./**.ts"],
"exclude": ["node_modules", "samples"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment