This commit is contained in:
2023-05-16 10:31:27 +02:00
parent 433fe035b9
commit 85862577b2
160 changed files with 268 additions and 202 deletions

View File

@@ -0,0 +1,29 @@
<!-- Modal
To populate app.load('apxmodal','apxmodal',{title,body,actions[{btndescription:'xx',onclick:'js function'}]})
To activate show
<button type="button" class="btn btn-outline-success btn-sm" data-bs-toggle="modal" data-bs-target="#modalinfo">
-->
<div class="modal fade" id="{{{modalid}}}" tabindex="-1" aria-labelledby="{{{modalid}}}Label" aria-hidden="true">
<div class="modal-dialog {{classmodaldialog}}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="{{{modalid}}}Label">{{{title}}}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{{{body}}}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
{{#actions}}
<button type="button" onclick="{{{onclick}}}" class="btn btn-primary">{{btndescription}}</button>
{{/actions}}
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
<p>Set up editorjs here</p>

View File

@@ -0,0 +1,39 @@
<div class="row">
<div class="col-sm-3">
<h3>webapp creation</h3>
<p>Step by step </p>
<div class="input-group mb-3">
<input class="form-control me-1" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-primary" onclick="app.search(this)">
<i class="fa-solid fa-magnifying-glass"></i>
</button>
</div>
<h4 class="mt-4">Articles</h4>
<p>Most read</p>
<ul class="nav nav-pills flex-column">
{{#mostread}}
<li class="nav-item">
<a class="nav-link" onclick="app.load('apxmain','{{tplname}}','{{tpldata}}')">{{{title}}}</a>
</li>
{{/mostread}}
</ul>
<hr class="d-sm-none">
<p>News</p>
<ul class="nav nav-pills flex-column">
{{#news}}
<li class="nav-item">
<a class="nav-link" onclick="app.load('apxmain','{{tplname}}','{{tpldata}}')">{{{title}}}</a>
</li>
{{/news}}
</ul>
<hr class="d-sm-none">
</div>
<div class="col-sm-9">
{{#articles}}
<h2>{{{heading}}</h2>
<h5>{{{shortdescdate}}}</h5>
<div class="fakeimg">Fake Image</div>
{{{htmlcontent}}}
{{/articles}}
</div>
</div>

View File

@@ -0,0 +1,17 @@
<h1>Your account is register</h1>
<p>Please find your confidential information in a safe space</p>
<p>Your alias: {{alias}}</p>
<p>Your passphrase: {{passphrase}}</p>
<p>Your public key that you can share with anyone:</p>
<textarea>{{pubk}}</textarea>
<p>Your private key that you keep secret and use to proove you own the public key:</p>
<textarea>{{privk}}</textarea>
{{#trustedtribe}}
<p>Thanks to trust us to keep your private key,
we'll be able to send back to this email address in case you need it</p>
{{/trustedtribe}}
{{^trustedtribe}}
<p>You decide to keep secret this private key,
Please save it in a safe place that noone else than you can access to proove you own it</p>
{{/trustedtribe}}
<p>Never share with someone else your privbatekey if someone can access, it will be possible to usurp your identity.</p>

View File

@@ -0,0 +1,17 @@
Your account is register \n\r
Please find your confidential information in a safe space\n\r
Your alias: {{alias}}\n\r
Your passphrase: {{passphrase}}\n\r
Your public key that you can share with anyone:\n\r
<textarea>{{pubk}}</textarea>
Your private key that you keep secret and use to proove you own the public key:\n\r
<textarea>{{privk}}</textarea>
{{#trustedtribe}}
Thanks to trust us to keep your private key,
we'll be able to send back to this email address in case you need it\n\r
{{/trustedtribe}}
{{^trustedtribe}}
You decide to keep secret this private key,
Please save it in a safe place that noone else than you can access to proove you own it\n\r
{{/trustedtribe}}
Never share with someone else your privbatekey if someone can access, it will be possible to usurp your identity.\n\r

View File

@@ -0,0 +1,163 @@
<div class="row">
<div class="col-sm-6" data-spacename="explain">
<h2>How it works</h2>
<p class="small">
Mandatory: any apixtrib request <b>header</b> have to set with:<br>
{xalias,xhash,xdays,xtribe,xlang,xapp}<br>
This webapp use :
</p>
<ul>
<li class="small">apxtribcli.js: that manage a localstorage item call xapp (this example: adminapx) to save and
update data from
api to local
webapp: status; template,...)</li>
<li class="small">apxapp.js: viewer to manipulate DOM and bootstrapV5 framework to collect data</li>
<li class="small">apxpagans.js: controler that manage get, create, update, delete pagans</li>
</ul>
<p class="small">
<b>In few words:</b><br>
A Pagan is <b> identify by an Alias (for human)</b> known by api as a <b>publicKey</b> (for machine).<br>
The owner of this Alias (stored in header xalias) have a privateKey generate when a Pagan is created.
This private key is used to sign (with openpgp.js detachedsignature) the message "xalias_xdays" where xdays is a
timestamp this <b>signature is store into xhash</b> (header)
It is possible to trust a tribe to store this privateKey (and passphrase that encrypt this privatekey, that can be
empty, if not the passphrase is needed to uncipher the stored privateKey).<br>
<b>api accept only xhash with a timestamp less than 24hours</b>. Means app needs to store privatekey.
</p>
<p class="small">When authenticated, a Pagan can be identify as a Person into a tribe (xtribe) and then has an
object
instance of Person named "alias" into the tribe space (means /nationchains/tribe/xtribe/Person/alias.json).<br>
In this file we get a key call accessright based onto the schema accessright to the ressource of the xtribe
only.
</p>
<p class="small">
<b>accessright is based on a CRUDOwner rules per object</b>. Owner of an instance can do any things on his data
(until it respects schema). An object can have multiple Owners.<br>
Other user needs to have specifics right to act on object instance {objectname:'CRUD', ..}.<br>
Person can have key "profil" user of an app to manage webapp but action has to be on line with accessright to
work.
</p>
<button type="button" class="btn btn-outline-success btn-sm"
onclick="app.runapirequest('modalinfo',{method:'GET',url:'nationchains/pagans/idx/alias_all.json'},{title:'Alias list',body:'',actions:[], classmodaldialog:'modal-xl'})">Show
list of alias</button>
</p>
<code>
GET nationchains/pagans/idx/alias_all.json -> data:{alias:{alias:publicKey}}
</code>
<p>To allow trustable Tribe to store the Private and Passphrase Key, you get from the townId_all.json key:tribes
</p>
<button type="button" class="btn btn-outline-success btn-sm"
onclick="app.runapirequest('modalinfo',{method:'GET',url:'nationchains/towns/idx/townId_all.json'},{title:'Tribes list',body:'',actions:[], classmodaldialog:'modal-xl'})">Show
list of tribe</button>
<code>
GET /nationchains/towns/idx/townId_all.json -> data:{townId:{tribes:[list of tribeId inside a town]}}
</code>
<h3> Am I authenticated to api</h3>
<p></p>
xhash is a detached signature done with public and private key of message: 'alias_xdays' where xdays is a time
stamp
a xhash has an elapse of 24hours after it has to be recreate.<br>
create
</div>
<div class="col-sm-6" data-spacename="userinterface">
<div class="row g-3">
<h3>Am i authenticated to api?</h3>
<button type="button" id="btntestauth" class="btn btn-outline-success btn-sm"
onclick="app.runapirequest('modalinfo',{method:'GET',url:'api/pagans/isauth'},{title:'Am i authenticated',body:'',actions:[], classmodaldialog:'modal-xl'})">
Test it</button>
<code>
GET 'api/pagans/isauth' -> status 200 : Well authenticated with alias, status 400: not authenticated
</code>
<hr>
<h3>Logout</h3>
<button type="button" class="btn btn-outline-success btn-sm"
onclick="delete apx.data.auth;apx.data.headers=apxlocal.headers;apx.save();alert('delete apx.data.auth and reinit apx.data.header')">
Remove headers</button>
<hr>
<h3>I proove that i own this alias</h3>
<div class="col-md-6">
<label for="inputaliasauth" class="form-label">Your alias</label>
<input type="text" class="form-control" id="inputaliasauth" placeholder="A public alias that any one see">
</div>
<div class="col-12">
<label for="inputpassphraseauth" class="form-label">A passphrase</label>
<input type="text" class="form-control" id="inputpassphraseauth"
placeholder="optional, a passphrase to remember, each time something try to use your privateKey this passphrase will be requested">
</div>
<textarea rows="5" id="privatekeyauth"></textarea>
<button class="btn btn-primary"
onclick="pagans.authentifyme(document.getElementById('inputaliasauth').value,document.getElementById('inputpassphraseauth').value,document.getElementById('privatekeyauth').value);document.getElementById('btntestauth').click()">I
am alias</button>
<hr>
<h3>Create a decentralized Identity</h3>
<p>apXtrib allow you to create keys to identify yourself with a universal alias</p>
<div class="col-md-6">
<label for="inputalias" class="form-label">Your alias</label>
<input type="text" class="form-control" id="inputalias" placeholder="A public alias that any one see">
</div>
<div class="col-md-6">
<label for="inputemailrecovery" class="form-label">Email Recovery</label>
<input type="email" class="form-control" id="inputemailrecovery"
placeholder="optional, if you want to receive by mail your keys">
</div>
<div class="col-12">
<label for="inputpassphrase" class="form-label">A passphrase</label>
<input type="text" class="form-control" id="inputpassphrase"
placeholder="optional, a passphrase to remember, each time something try to use your privateKey this passphrase will be requested">
</div>
<button type="button" id="generatekeys"
onclick="pagans.createIdentity(document.getElementById('inputalias').value,document.getElementById('inputpassphrase').value)"
class="btn btn-primary">Generate keys</button>
<div id="trustintribe" class="d-none">
<div class="mb-3 row">
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="trustedcheck"
onclick="document.getElementById('selecttrusttribe').classList.toggle('d-none');">
<label class="form-check-label small" for="trustedcheck">
<b>I trust a tribe to keep my private key and email, doing this i automaticaly create a Person space in
tribe i trust. </b>
I understand that someone with tribe accessrights(druid) from this tribe can read my personnal data by
unciphering my
data.<br>
<b>If i don't trust</b> i understand that if i loose my privatekey i also loose my data.<br>
If you set a correct email then you will receive your keys on your mailbox, this email is not store if
you do not trust<br>
If you use a browser that <b>can be accessible by someone else, don't forget to "logout"</b> to clean up
any trace.<br>
<b>In any case please download your keys and move it on a usb key or/and print it</b><br>
</label>
</div>
</div>
<div id="selecttrusttribe" class="d-none">
<label for="selectnationid" class="col-12 col-form-label">If you want to trust in a Tribe to store your
private key, please chose a tribe which you trust in</label>
<div class="col-12">
<select class="form-select" id="trustedtribe" aria-label="" placeholder="A tribe to store my private key">
{{#tribes}}
<option {{#selected}}selected{{/selected}} value="{{tribeId}}">{{tribeId}}</option>
{{/tribes}}
</select>
<input class="d-none" id="inputtribeId" value="{{tribeId}}">
</div>
</div>
</div>
</div>
<div id="downloadkeys" class="btn-group d-none">
<p>Download your keys at least PrivateKey this have to save in a secret place</p>
<button id="privatekey" key="" class="btn btn-outline-primary"
onclick="app.downloadlink('tmp.privateKey',apx.data,apx.data.headers.xapp);">Download
PrivateKey</button>
<button id="publickey" key="" class="btn btn-outline-primary"
onclick="app.downloadlink('tmp.publicKey',apx.data,apx.data.headers.xapp);">Download
PublicKey</button>
</div>
<div id="createId" class="col-12 d-none">
<button class="btn btn-primary" onclick="pagans.registerIdentity();">Create
this identity</button>
</div>
</div>
</div>

View File

@@ -0,0 +1,23 @@
<div class="container">
<h5>How to identify ourself</h5>
<p>You need to know your alias and to have your privateKey file</p>
<div class="mb-3">
<label for="youralias" class="form-label">Your alias</label>
<input type="email" class="form-control" id="youralias" aria-describedby="aliasHelp">
<div id="aliasHelp" class="form-text">Your unique alias when you create your account</div>
</div>
<div class="mb-3">
<label for="inputprivateKey" class="form-label">Copy & paste or load your private Key</label>
<textarea type="password" class="form-control" id="inputprivateKey" rows="6"></textarea>
<div id="inputprivateKey" class="form-text">I forgot my keys, <a onclick="">click to request it with my email recovery</a> or <a onclick="">Click to receive it from my alias</a> </div>
</div>
<div class="mb-3">
<label for="emailrecovery" class="form-label">Your email recovery</label>
<input type="email" class="form-control" id="emailrecovery" placeholder="name@example.com">
</div>
<div class="input-group">
<input type="file" class="form-control" id="inputGroupFile04" aria-describedby="inputGroupFileAddon04" aria-label="Upload">
<button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon04">Button</button>
</div>
<button type="submit" class="btn btn-primary d-none">Identify you</button>
</div>

View File

@@ -0,0 +1,50 @@
<div class="container">
<div class="row">
<h4> Setup a new town</h4>
<p>This form let you start joining a nation.</p>
<p>For dev you can stay like this and use http instead of https. To join a nation you need:</p>
<ul>
<li> Get a domain name register to a publicIP that route web traffic from 80 and 443 to this machine</li>
<li> Get a pagan identity and be authenticated <a onclick="app.load('apxmain','pagancreate',{})"> click here to create or authentify yoursefl</a>
<li> Synchronize the nations, to update your nationchains (carefful all your local stuff will be deleted)</li>
<li> Ready to your new mayor role of this town</li>
<li> Start saling your hosting</li>
</ul>
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<div class="mb-3 row">
<label for="selectnationid" class="col-sm-6 col-form-label">Select the nation to join</label>
<div class="col-sm-6">
<select class="form-select" data-nationId="{{nationId}}" aria-label="" placeholder="A nation">
{{#nations}}
<option {{#selected}}selected{{/selected}} value="{{nationId}}">{{nationId}}</option>
{{/nations}}
</select>
<input class="d-none" id="inputnationId" value="{{nationId}}">
</div>
</div>
<div class="mb-3 row">
<label for="inputtownid" class="col-sm-6 col-form-label">Your Town</label>
<div class="col-sm-6">
<input type="text" value="{{townId}}" class="form-control" id="inputtownid">
</div>
</div>
<div class="mb-3 row">
<label for="inputtribeid" class="col-sm-6 col-form-label">Your Tribes</label>
<div class="col-sm-6">
<input type="text" value="{{tribeId}}" class="form-control" id="inputreibeid">
</div>
</div>
<div class="mb-3 row">
<label for="inputdnstown" class="col-sm-6 col-form-label">Domain name of your town (to access this app from the web)</label>
<div class="col-sm-6">
<input type="text" value="{{dns}}" class="form-control" id="inputdnstown">
</div>
</div>
<div class="col-auto">
<button onclick="setup.lauchtown(document.getElementById('inputnationId').value, document.getElementById('inputtownId').value,document.getElementById('inputdns').value)" class="btn btn-primary mb-3">Launch this town</button>
</div>
</div>
</div>
</div>