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
function () { | |
/* | |
* Write Configuration Properties Here: | |
*/ | |
var PROTO = 'https://'; | |
var HOST = 'dev.nulltxt.se'; | |
var PORT = null; | |
var API_PATH = 'api/v1/'; |
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
begin; | |
create table item ( | |
item_id int8 not null primary key default nextval('version_identifier'), | |
account_id int8 not null references account, | |
name_hmac bytea not null unique, | |
creation_time timestamp not null default current_timestamp, | |
modified_time timestamp not null default current_timestamp, | |
deletion_time timestamp, | |
value bytea, |
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
diff --git a/928a5500234abb5db508ba07b1d2f6c385fe8d19:server/lib/stores/postgres/sql/setup.sql b/HEAD:server/lib/stores/postgres/sql/setup.sql | |
index ed69e77..1091725 100644 | |
--- a/928a5500234abb5db508ba07b1d2f6c385fe8d19:server/lib/stores/postgres/sql/setup.sql | |
+++ b/HEAD:server/lib/stores/postgres/sql/setup.sql | |
@@ -620,4 +620,165 @@ create unique index transaction_delete_message_msg_id_idx | |
on transaction_delete_message | |
(transaction_id, message_id); | |
+ | |
+create table item ( |
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
Name: | |
Date/Time: | |
Kloak Version: | |
1. Install Kloak from Apple Test Flight | |
* Bugs, Problems: | |
--- |
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
// Difference between Container Encryption and Item Encryption | |
// (Short answer: Item Encryption & decryption is identical to container encryoption and decryoption, just 1 step & simpler with no diffs, etc) | |
// Containers Encryption: | |
// https://github.com/SpiderOak/crypton/blob/a7e6a76f0c099ef2762c27f85f474bfb1c62727b/client/src/session.js#L663-L699 | |
var selfPeer = new crypton.Peer({ | |
session: this, | |
pubKey: this.account.pubKey, | |
signKeyPub: this.account.signKeyPub |
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
// We use session.getOrCreateItem in order to create a new item that we can share with others | |
app.session.getOrCreateItem('myReport', function (err, report) { | |
if (err) { | |
callback(err); | |
return console.error(err); | |
} | |
// update the report | |
report.value = { updated: Date.now(), reportContent: app.reportContent }; | |
// share this data: |
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
CREATE OR REPLACE FUNCTION notifyUpdatedItem() RETURNS TRIGGER AS $$ | |
DECLARE | |
notify_row RECORD; | |
BEGIN | |
FOR notify_row IN | |
SELECT s.item_session_key_share_id, | |
s.account_id, s.to_account_id, k.item_id, | |
a.username as toUser, b.username AS fromUser | |
FROM item_session_key_share s | |
JOIN item_session_key k ON |
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
CREATE OR REPLACE FUNCTION notifyUpdatediItem() RETURNS TRIGGER AS $$ | |
DECLARE | |
rec RECORD; | |
BEGIN | |
FOR rec IN (SELECT getSharedItemNotifees(NEW.item_id)) LOOP | |
PERFORM pg_notify('SharedItemUpdated', CAST(rec.to_account_id AS text)|| ' ' || CAST(NEW.name_hmac AS text)); | |
END LOOP; | |
END; | |
$$ LANGUAGE PLPGSQL; |
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
createItem("my-dossier9", {name: 'foo', address: 123, city: 'chicago'}); | |
window.session.items; | |
Object {my-dossier8: Item, my-dossier9: Item} | |
window.session.items['my-dossier8'].value | |
Object {name: "foo", address: 123, city: "chicago"} |
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
var app = {}; | |
app.createUser = function(user, password) { | |
crypton.generateAccount(user, password, function (err, account){ | |
if (err) { console.error(err); return;} | |
console.log(account); | |
}) | |
}; | |
app.auth = function (username, password) { |