Ind.ie is now Small Technology Foundation.
Commit 469eb60a authored by Frauke's avatar Frauke

Updated Readme.

Fixed error.
parent 23db9cc7
......@@ -44,6 +44,14 @@ $ feathers help # Show all commands
For more information on all the things you can do with Feathers visit [docs.feathersjs.com](http://docs.feathersjs.com).
## Notes
On the **index** page you have to fill in a password. When you submit the form, the keys will be generated and saved on the server and private key will be saved in IndexedDB. You then will be redirected to the sign in page.
On this page you can also find a 'get private data' button. When you are logged in and you click this button, you will receive private data in the console.
On the **sign in** page you have to fill in the same password as on the index page. The JWT will be created and saved in a cookie. You will be redirected to the signed in page.
On the **signed in** page you have the log out button. When clicked the cookie and indexedDB will be cleared.
## Changelog
__0.1.0__
......
......@@ -7,17 +7,6 @@ const Keys = require('./keys')
const form = document.getElementById('register')
const privateForm = document.getElementById('private')
function loadedKeyPair () {
indexedDB.callOnStore('testkeystore', 'keyStore', (store) => {
const getData = store.get(1)
getData.onsuccess = (event) => {
const keys = getData.result.keys
}
})
}
// loadedKeyPair()
form.addEventListener('submit', (e) => {
e.preventDefault()
const password = e.target.password.value
......@@ -25,7 +14,7 @@ form.addEventListener('submit', (e) => {
keyPair.generateKeys()
keyPair.encryptPassword(password)
keyPair.encryptPrivateKey()
console.log(keyPair)
const postKeys = axios.post('keys',
{
salt: keyPair.stringify(keyPair.salt),
......@@ -41,6 +30,7 @@ form.addEventListener('submit', (e) => {
unencryptedPrivateKey: keyPair.privateKey
})
})
window.location = 'sign-in.html'
}).catch((err) => {
console.log(err)
})
......@@ -51,16 +41,18 @@ privateForm.addEventListener('submit', (e) => {
indexedDB.callOnStore('Indienet', 'keyStore', (store) => {
const getData = store.get(2)
getData.onsuccess = (event) => {
const jwt = getData.result.jwt
axios({
url: 'private',
method: 'get',
headers: { 'Authorization': `Bearer ${jwt}` }
}).then((data) => {
console.log(data)
}).catch((err) => {
console.log(err)
})
if (getData.result) {
const jwt = getData.result.jwt
axios({
url: 'private',
method: 'get',
headers: { 'Authorization': `Bearer ${jwt}` }
}).then((data) => {
console.log(data)
}).catch((err) => {
console.log(err)
})
}
}
})
})
......@@ -12,7 +12,7 @@
<form action="sign-in" method="post" id="sign-in">
<label for="password">Password</label>
<input type="password" name="password" id="password">
<input type="submit" value="Create site">
<input type="submit" value="Sign in">
</form>
<script src="js/sign-in.js"></script>
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment