docker run --name recorder-redis -p 6379:6379 -d redis:alpine
This file contains 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 "k6/crypto"; | |
import encoding from "k6/encoding"; | |
const algToHash = { | |
HS256: "sha256", | |
HS384: "sha384", | |
HS512: "sha512" | |
}; | |
function sign(data, hashAlg, secret) { |
This file contains 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 fs = require('fs'); | |
const jwt = require('jsonwebtoken'); | |
// http://travistidwell.com/blog/2013/09/06/an-online-rsa-public-and-private-key-generator/ | |
// use 'utf8' to get string instead of byte array (1024 bit key) | |
var privateKEY = fs.readFileSync('./private.key', 'utf8'); // to sign JWT | |
var publicKEY = fs.readFileSync('./public.key', 'utf8'); // to verify JWT | |
module.exports = { | |
sign: (payload, $Options) => { | |
/* |
This file contains 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
Since it's been days, I am guessing this was solved. I am just adding my two cents here for future readers. | |
The problem lies with the JwtModule and the JwtStrategy instantiation. They aren't configured properly. | |
You need to pass in the algorithms you'd use for signing and verifying the tokens, along with the keys. | |
To verify whether the tokens are actually getting generated with the RS256 algo, check the header in the token at https://jwt.io/. | |
It would probably show HS256, and since your code didn't use the correct algorithm to sign the token. | |
And it fails while token gets verified using the public key. | |
To generate signed tokens properly with the RSA key pair: |
This file contains 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
// This is the index.js file for my Parse Live Query Server, running on a separate EC2 instance | |
var express = require('express'); | |
var cors = require('cors') | |
var ParseServer = require('parse-server').ParseServer; | |
var app = express(); | |
app.use(cors()); | |
// We include the lines below so that we can hit `/` and it passes the Elastic Beanstalk Health Check |
This file contains 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 { Module } from '@nestjs/common'; | |
import { MyLibModule } from './my-lib.module'; | |
@Module({ | |
imports: [ | |
MyLibModule.register({ name: 'Enzo' }), | |
] | |
}) | |
export class ImportingModule {} |
This file contains 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
var mediaJSON = { "categories" : [ { "name" : "Movies", | |
"videos" : [ | |
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
"subtitle" : "By Blender Foundation", | |
"thumb" : "images/BigBuckBunny.jpg", | |
"title" : "Big Buck Bunny" | |
}, | |
{ "description" : "The first Blender Open Movie from 2006", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
This file contains 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
// @ts-nocheck //TODO: enable remove once there are typings in place | |
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed | |
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess | |
// import { eslint } from 'rollup-plugin-eslint' | |
import { terser } from 'rollup-plugin-terser' | |
import babel from 'rollup-plugin-babel' | |
import commonjs from 'rollup-plugin-commonjs' | |
import config from 'sapper/config/rollup.js' | |
import environmentVariables from './config/env' |
This is an example of how to send an SMS. To run this script you should:
- Download the index.js and package.json files
- Install the dependencies with
npm install
- Get your Twilio Account SID and Auth Token from your Twilio console (sign up for a free account if you don't already have one)
- Get a Twilio number that can send SMS
- Set the credentials and other variables in the environment and run the script:
NewerOlder