-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": "0.1", | ||
"alerts": [ | ||
{ | ||
"affectedVersions": [ | ||
"io.ethers.app/0.1" | ||
], | ||
"heading": "Warning", | ||
"text": [ | ||
"This is a test of the **emergency canary** system.", | ||
"This is only a drill.", | ||
"", | ||
"If this had been a real emergency, this would have included the problem and possible solutions.", | ||
"", | ||
"" | ||
], | ||
"button": "I Agree" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"version": "0.1", | ||
"alerts": [ | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0xf86680808080809d7b2276657273696f6e223a22302e31222c22616c65727473223a5b5d7d1ba03f0e5fb1ee9adb9e689b0d1a5ad4566ea91915007b1c43ab59369c40cc82d26fa02a49304771de9f5777cd34cdc5e2098df3027f11f6c1019f00241bdef89f7765 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Canary | ||
* | ||
* The canary file can be uploaded to https://ethers.io/canary.raw | ||
* in the event a serious bug is discovered that users must be warned | ||
* of. | ||
* | ||
* It must be signed with the private key for the address: | ||
* | ||
* 0x70C14080922f091fD7d0E891eB483C9f8464a527 | ||
* | ||
* TODO: This needs to be updated to take a secure password from | ||
* readlineSync rather than the command line. | ||
*/ | ||
|
||
var crypto = require('crypto'); | ||
var fs = require('fs'); | ||
|
||
var Wallet = require('ethers-wallet'); | ||
|
||
var jsonFilename = process.argv[2]; | ||
var password = process.argv[3]; | ||
var canaryFilename = process.argv[4]; | ||
|
||
var canaryData = fs.readFileSync(canaryFilename); | ||
canaryData = JSON.stringify(JSON.parse(canaryData)); | ||
|
||
var transaction = { | ||
nonce: '0x00', | ||
gasPrice: '0x00', | ||
gasLimit: '0x00', | ||
value: '0x00', | ||
data: (new Buffer(canaryData)), | ||
} | ||
|
||
|
||
Wallet.decrypt(fs.readFileSync(jsonFilename), new Buffer(password)).then(function(wallet) { | ||
var data = wallet.sign(transaction); | ||
var hash = crypto.createHash('sha256').update(new Buffer(data.substring(2), 'hex')).digest() | ||
|
||
console.log('Address: ' + wallet.address); | ||
console.log('Hash: 0x' + hash.toString('hex')); | ||
console.log('Filename: canary-' + hash.slice(0, 4).toString('hex') + '.hex'); | ||
console.log('Data: ' + data); | ||
|
||
}, function(error) { | ||
console.log(error); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "ethers-canary", | ||
"version": "0.0.1", | ||
"description": "Script to generate and sign the https://ethers.io/canary.raw file.", | ||
"main": "index.js", | ||
"dependencies": { | ||
"ethers-wallet": "1.0.10" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Richard Moore <[email protected]>", | ||
"license": "MIT" | ||
} |