Skip to content

Instantly share code, notes, and snippets.

@dreid
Last active May 6, 2016 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dreid/06fd283b092fb1504481a6580a91ba97 to your computer and use it in GitHub Desktop.
Save dreid/06fd283b092fb1504481a6580a91ba97 to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
<!-- put markup and other contents here -->
</body>
</html>
// write ES2015 code and import modules from npm
// and then press "Execute" to run your program
class Fernet {
constructor(key) {
this.key = key;
}
};
Fernet.generateKey = function generateKey() {
return window.crypto.subtle.generateKey(
{
name: "AES-CBC",
length: 128, //can be 128, 192, or 256
},
false, //whether the key is extractable (i.e. can be used in exportKey)
["encrypt", "decrypt"] //can be "encrypt", "decrypt", "wrapKey", or "unwrapKey"
);
};
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"babel-runtime": "6.6.1"
}
}
"use strict";
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// write ES2015 code and import modules from npm
// and then press "Execute" to run your program
var Fernet = function Fernet(key) {
(0, _classCallCheck3.default)(this, Fernet);
this.key = key;
};
;
Fernet.generateKey = function generateKey() {
return window.crypto.subtle.generateKey({
name: "AES-CBC",
length: 128 }, //can be 128, 192, or 256
false, //whether the key is extractable (i.e. can be used in exportKey)
["encrypt", "decrypt"] //can be "encrypt", "decrypt", "wrapKey", or "unwrapKey"
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment