Skip to content

Commit 3919784

Browse files
committed
security updates
1 parent 2f1d8dc commit 3919784

File tree

4 files changed

+54
-20
lines changed

4 files changed

+54
-20
lines changed

.env.example

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
PRIVATE_KEY=asdf
22
ACCOUNT_NAME=asdf
33
NETWORK_HOST="192.168.56.101"
4-
NETWORK_PORT=8888
4+
NETWORK_PORT=8888
5+
6+
SPACE_INVADERS_OWNER_PKEY=asdf
7+
SPACE_INVADERS_OWNER_NAME=asdf

src/app.js

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class App {
2323

2424
new VueInitializer(routes, components, middleware, (router, store) => {
2525
document.addEventListener('scatterLoaded', () => {
26+
27+
window.scatter.requireVersion(2.1);
2628
store.dispatch(Actions.SET_SCATTER, window.scatter);
2729
window.scatter = null;
2830

src/views/GettingStarted.vue

+40-15
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,30 @@
3434

3535

3636
<section class="info">
37+
<h1>Updating Scatter</h1>
38+
<br>
39+
<p>
40+
Since Scatter is still in development you will have to manually update it. Sorry for the inconvenience.
41+
<br>
42+
<br>
43+
To check your current Scatter version go to <u><b>chrome://extensions/</b></u> and look at the number next
44+
to the <b>Scatter</b> title.
45+
If it is not <b style="font-size:13px">2.1</b> you need to update your Scatter.
46+
<br>
47+
<br>
48+
To do so first click the trash icon next to the Scatter plugin from the Chrome extensions page.
49+
Then delete you Scatter folder, and follow the installation instructions again.
50+
<br>
51+
<br>
52+
<b>
53+
Once you have version 2.1 you will no longer need to manually check your Scatter version as that version included
54+
a way to require a minimum Scatter version and notify the user in the case that it doesn't match.
55+
</b>
56+
57+
</p>
58+
59+
<hr>
60+
3761
<h1>Installing Scatter</h1>
3862
<br>
3963
<p>
@@ -122,21 +146,6 @@
122146
<hr>
123147

124148

125-
<!------------ ACCOUNT ------------>
126-
<h2>Generate an EOS Account</h2>
127-
<br>
128-
<p>
129-
In the pursuit of making this as easy as possible, we won't make you generate any keys
130-
or set any account names. We're simply going to randomly generate both for you and then give you the private key
131-
so that you can import it into your Scatter.
132-
133-
<br><br>
134-
135-
Click the <b>Generate Account</b> button to left before continuing.
136-
</p>
137-
<hr>
138-
139-
140149

141150

142151
<!------------ NETWORK ------------>
@@ -190,6 +199,21 @@
190199
serve as your <i>username</i> on applications to give you some added security to the account name you are currently using within your Identity and
191200
allowing you to switch the underlying account without changing your username.
192201
</p>
202+
<hr>
203+
204+
205+
<!------------ ACCOUNT ------------>
206+
<h2>Generate an EOS Account</h2>
207+
<br>
208+
<p>
209+
In the pursuit of making this as easy as possible, we won't make you generate any keys
210+
or set any account names. We're simply going to randomly generate both for you and then give you the private key
211+
so that you can import it into your Scatter.
212+
213+
<br><br>
214+
215+
Click the <b>Generate Account</b> button to left before continuing.
216+
</p>
193217
</section>
194218
</section>
195219

@@ -257,6 +281,7 @@
257281
recovery: stakerName,
258282
deposit: `1 EOS`
259283
}).then(account => {
284+
console.log(account);
260285
setTimeout(() => {
261286
eos.transfer(stakerName, accountName, 1000000, '').then(trx => {
262287
this.privateKey = privateKey;

src/views/SpaceInvaders.vue

+8-4
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
])
129129
},
130130
mounted(){
131+
if(this.identity) SpaceInvaders.load(this.gameOver);
131132
setTimeout(() => {
132133
this.getHighScores();
133134
}, 500);
@@ -139,24 +140,27 @@
139140
this.scatter.useIdentity(id.hash);
140141
this[Actions.SET_IDENTITY](id);
141142
SpaceInvaders.load(this.gameOver)
142-
143143
}).catch(e => console.log(e))
144144
},
145145
gameOver(score){
146146
if(score > this.lastHighScore) {
147147
this.lastHighScore = score;
148+
148149
const options = {
149150
scope: ['invaders', this.identity.account.name],
150-
authorization: [`${this.identity.account.name}@${this.identity.account.authority}`]
151+
authorization: [
152+
`${this.identity.account.name}@${this.identity.account.authority}`,
153+
`${process.env.SPACE_INVADERS_OWNER_NAME}@active`
154+
]
151155
};
152156
153157
let idNameToAccName = this.identity.name.substr(0, 12).toLowerCase();
154158
if(!/(^[a-z1-5.]{1,11}[a-z1-5]$)|(^[a-z1-5.]{12}[a-j1-5]$)/g.test(idNameToAccName)){
155159
idNameToAccName = this.identity.account.name;
156160
}
157161
158-
this.eos.contract('invaders').then(contract => {
159-
contract.score(idNameToAccName, score, this.identity.account.name, options)
162+
this.eos.contract('invaders', { keyProvider:process.env.SPACE_INVADERS_OWNER_PKEY }).then(contract => {
163+
contract.score(idNameToAccName, score, this.identity.account.name, process.env.SPACE_INVADERS_OWNER_NAME, options)
160164
});
161165
}
162166
},

0 commit comments

Comments
 (0)