BTC Certificate feature
Added the ability to register card content on the BTC blockchain in order to certify its existance/contentmaster-GE
parent
f84d05240b
commit
fbcd02dffd
30
DEVELOPER.md
30
DEVELOPER.md
|
@ -77,3 +77,33 @@ If you want to add other JS files you will have to include the reference to the
|
|||
### SCSS files
|
||||
|
||||
Any change to the SCSS files (as long as they are included –directly or indirectly– by clipperz.scss) will be visible as soon as you compile `scss/clipperz.scss` and reload the page on the browser. If you are using LiveReload, you can configure it to compile all files and reload the browser whenever you save any changes.
|
||||
|
||||
|
||||
# bitcoinJS-lib
|
||||
|
||||
## bitcoinJS-lib + bip32-utils + bip32-wallet -> browserify
|
||||
> npm install bitcoinjs-lib
|
||||
> npm install bip32-utils
|
||||
> npm install bip32-wallet
|
||||
|
||||
> browserify Workarea/clipperz/gcsolaroli\@bitbucket/password-manager/frontend/delta/js/bitcoinjs-lib/npm.js -s bitcoin > Workarea/clipperz/gcsolaroli\@bitbucket/password-manager/frontend/delta/js/bitcoinjs-lib/bitcoinjs-lib-2.1.4.js
|
||||
|
||||
## bitcoinJS-lib raw
|
||||
> browserify -r bitcoinjs-lib:bigi -s bitcoin -d > Workarea/clipperz/gcsolaroli\@bitbucket/password-manager/frontend/delta/js/bitcoinjs-lib/bitcoinjs-lib-2.1.4.js
|
||||
|
||||
## BigInteger
|
||||
> npm install bigi@1.4.0
|
||||
> browserify -r bigi -s BigInteger > Workarea/clipperz/gcsolaroli\@bitbucket/password-manager/frontend/delta/js/bitcoinjs-lib/bigi-1.4.0.js
|
||||
|
||||
## bops-browser
|
||||
> npm install bops-browser
|
||||
> browserify -r bops-browser -s bops > Workarea/clipperz/gcsolaroli\@bitbucket/password-manager/frontend/delta/js/bops-browser/bops-browser-0.6.0.js
|
||||
|
||||
## buffer
|
||||
> npm buffer
|
||||
> browserify -r buffer -s buffer > Workarea/clipperz/gcsolaroli\@bitbucket/password-manager/frontend/delta/js/buffer/buffer-4.3.0.js
|
||||
|
||||
|
||||
## custom browserify packaging
|
||||
> npm install bitcoinjs-lib@2.2.0
|
||||
> browserify Workarea/clipperz/gcsolaroli\@bitbucket/password-manager/frontend/delta/js/npm/config.js -s npm > Workarea/clipperz/gcsolaroli\@bitbucket/password-manager/frontend/delta/js/npm/npm.js
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,138 @@
|
|||
{
|
||||
"IcoMoonType": "selection",
|
||||
"icons": [
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M108.018 534.899l148.392 76.747h576.168l-190.68-98.62h-385.488l-208.41-107.792v98.62l7.467 3.858z",
|
||||
"M48.001 63.785v242.833l208.41 107.788h576.168l-536.16-277.295h593.28v768.365h-768.387v-166.462l135.098 69.865h576.168l-207.951-107.554h-368.217l-208.41-107.799v385.279h915.005v-915.020z"
|
||||
],
|
||||
"attrs": [],
|
||||
"isMulticolor": false,
|
||||
"grid": 0,
|
||||
"tags": [
|
||||
"CLIPPERZ_SOLO_LOGO-nero"
|
||||
],
|
||||
"width": 1024
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"order": 42,
|
||||
"id": 0,
|
||||
"prevSize": 32,
|
||||
"code": 59650,
|
||||
"name": "CLIPPERZ_SOLO_LOGO-nero",
|
||||
"ligatures": "clipperz"
|
||||
},
|
||||
"setIdx": 0,
|
||||
"setId": 13,
|
||||
"iconIdx": 0
|
||||
},
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M786.286 512l78.857 77.143q17.143 16 11.429 40-6.857 23.429-29.714 29.143l-107.429 27.429 30.286 106.286q6.857 23.429-10.857 40-16.571 17.714-40 10.857l-106.286-30.286-27.429 107.429q-5.714 22.857-29.143 29.714-6.857 1.143-10.857 1.143-17.714 0-29.143-12.571l-77.143-78.857-77.143 78.857q-16 17.143-40 11.429-23.429-6.286-29.143-29.714l-27.429-107.429-106.286 30.286q-23.429 6.857-40-10.857-17.714-16.571-10.857-40l30.286-106.286-107.429-27.429q-22.857-5.714-29.714-29.143-5.714-24 11.429-40l78.857-77.143-78.857-77.143q-17.143-16-11.429-40 6.857-23.429 29.714-29.143l107.429-27.429-30.286-106.286q-6.857-23.429 10.857-40 16.571-17.714 40-10.857l106.286 30.286 27.429-107.429q5.714-23.429 29.143-29.143 23.429-6.857 40 10.857l77.143 79.429 77.143-79.429q16.571-17.143 40-10.857 23.429 5.714 29.143 29.143l27.429 107.429 106.286-30.286q23.429-6.857 40 10.857 17.714 16.571 10.857 40l-30.286 106.286 107.429 27.429q22.857 5.714 29.714 29.143 5.714 24-11.429 40z"
|
||||
],
|
||||
"attrs": [],
|
||||
"isMulticolor": false,
|
||||
"width": 878,
|
||||
"tags": [
|
||||
"certificate"
|
||||
],
|
||||
"grid": 0
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"order": 1,
|
||||
"id": 0,
|
||||
"prevSize": 32,
|
||||
"code": 59648,
|
||||
"name": "certificate",
|
||||
"ligatures": "certificate"
|
||||
},
|
||||
"setIdx": 2,
|
||||
"setId": 11,
|
||||
"iconIdx": 0
|
||||
},
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M2.259 734.824h279.462v286.917h-279.462v-286.917z",
|
||||
"M2.259 2.259h279.462v286.917h-279.462v-286.917z",
|
||||
"M2.259 368.519h279.462v286.917h-279.462v-286.917z"
|
||||
],
|
||||
"width": 284,
|
||||
"grid": 0,
|
||||
"tags": [
|
||||
"commands"
|
||||
],
|
||||
"attrs": []
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"order": 18,
|
||||
"id": 1,
|
||||
"prevSize": 32,
|
||||
"code": 58899,
|
||||
"name": "commands",
|
||||
"ligatures": "commands"
|
||||
},
|
||||
"setIdx": 8,
|
||||
"setId": 4,
|
||||
"iconIdx": 0
|
||||
},
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M667.586 345.635v-338.544h-268.055v338.544l-299.967-121.263-90.486 257.986 310.037 104.527-198.134 262.808 224.514 164.237 184.802-279.685 203.382 279.685 221.11-164.237-203.382-262.808 319.397-107.080-90.486-257.986zM1220.574 2319.317z"
|
||||
],
|
||||
"width": 1080,
|
||||
"grid": 0,
|
||||
"tags": [
|
||||
"logo"
|
||||
],
|
||||
"attrs": []
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"order": 4,
|
||||
"id": 0,
|
||||
"prevSize": 32,
|
||||
"code": 58884,
|
||||
"name": "logo",
|
||||
"ligatures": "qibberz"
|
||||
},
|
||||
"setIdx": 8,
|
||||
"setId": 4,
|
||||
"iconIdx": 1
|
||||
},
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M429.696 257.6c54.88 0 68.608 27.424 105.152 22.848 36.576-4.576 4.576-68.576-27.424-114.272s-105.12-22.848-160 9.152c-54.848 32-346.272 209.152-346.272 209.152h254.848c0-0.032 118.848-126.88 173.696-126.88zM0 417.568v416c0 35.328 28.64 64 64 64 0 0 246.72 0 514.656 0 48.064 0 92-149.344 141.344-149.344 42.848 0 75.072 149.344 117.312 149.344 284.576 0 538.656 0 538.656 0 35.36 0 64.032-28.672 64.032-64v-416h-1440zM576 705.6c0 52.992-43.008 96-96 96h-288c-53.024 0-96-43.008-96-96v-96c0-53.024 42.976-96 96-96h288c52.992 0 96 42.976 96 96v96zM1344 705.6c0 52.992-43.008 96-96 96h-288c-53.024 0-96-43.008-96-96v-96c0-53.024 42.976-96 96-96h288c52.992 0 96 42.976 96 96v96zM905.12 280.448c36.576 4.576 50.272-22.848 105.152-22.848 54.848 0 173.728 126.848 173.728 126.848h254.848c0 0-291.424-177.152-346.272-209.152-54.88-32-128-54.848-160-9.152s-64 109.728-27.456 114.304z"
|
||||
],
|
||||
"attrs": [],
|
||||
"isMulticolor": false,
|
||||
"width": 1440,
|
||||
"tags": [
|
||||
"3d glasses",
|
||||
"glasses"
|
||||
],
|
||||
"grid": 32
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"order": 1,
|
||||
"id": 0,
|
||||
"prevSize": 32,
|
||||
"code": 59649,
|
||||
"name": "3dglasses",
|
||||
"ligatures": "preview"
|
||||
},
|
||||
"setIdx": 1,
|
||||
"setId": 12,
|
||||
"iconIdx": 0
|
||||
},
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
|
@ -26,7 +158,7 @@
|
|||
"name": "log-out",
|
||||
"ligatures": "logout"
|
||||
},
|
||||
"setIdx": 0,
|
||||
"setIdx": 3,
|
||||
"setId": 10,
|
||||
"iconIdx": 0
|
||||
},
|
||||
|
@ -55,7 +187,7 @@
|
|||
"name": "mail",
|
||||
"ligatures": "email"
|
||||
},
|
||||
"setIdx": 8,
|
||||
"setIdx": 11,
|
||||
"setId": 0,
|
||||
"iconIdx": 4
|
||||
},
|
||||
|
@ -80,7 +212,7 @@
|
|||
"name": "paperclip",
|
||||
"ligatures": "attachment"
|
||||
},
|
||||
"setIdx": 8,
|
||||
"setIdx": 11,
|
||||
"setId": 0,
|
||||
"iconIdx": 8
|
||||
},
|
||||
|
@ -106,7 +238,7 @@
|
|||
"name": "popup",
|
||||
"ligatures": "url, direct login"
|
||||
},
|
||||
"setIdx": 8,
|
||||
"setIdx": 11,
|
||||
"setId": 0,
|
||||
"iconIdx": 35
|
||||
},
|
||||
|
@ -132,7 +264,7 @@
|
|||
"name": "plus",
|
||||
"ligatures": "add new field, create new OTP"
|
||||
},
|
||||
"setIdx": 8,
|
||||
"setIdx": 11,
|
||||
"setId": 0,
|
||||
"iconIdx": 125
|
||||
},
|
||||
|
@ -160,7 +292,7 @@
|
|||
"name": "cross",
|
||||
"ligatures": "remove field, remove tag, remove OTP"
|
||||
},
|
||||
"setIdx": 8,
|
||||
"setIdx": 11,
|
||||
"setId": 0,
|
||||
"iconIdx": 126
|
||||
},
|
||||
|
@ -186,7 +318,7 @@
|
|||
"name": "plus3",
|
||||
"ligatures": "add card"
|
||||
},
|
||||
"setIdx": 8,
|
||||
"setIdx": 11,
|
||||
"setId": 0,
|
||||
"iconIdx": 128
|
||||
},
|
||||
|
@ -212,7 +344,7 @@
|
|||
"name": "arrow-left",
|
||||
"ligatures": "back"
|
||||
},
|
||||
"setIdx": 8,
|
||||
"setIdx": 11,
|
||||
"setId": 0,
|
||||
"iconIdx": 205
|
||||
},
|
||||
|
@ -238,7 +370,7 @@
|
|||
"name": "arrow-right",
|
||||
"ligatures": "show detail"
|
||||
},
|
||||
"setIdx": 8,
|
||||
"setIdx": 11,
|
||||
"setId": 0,
|
||||
"iconIdx": 208
|
||||
},
|
||||
|
@ -268,7 +400,7 @@
|
|||
"name": "security",
|
||||
"ligatures": "lock"
|
||||
},
|
||||
"setIdx": 1,
|
||||
"setIdx": 4,
|
||||
"setId": 9,
|
||||
"iconIdx": 293
|
||||
},
|
||||
|
@ -298,7 +430,7 @@
|
|||
"name": "label",
|
||||
"ligatures": "label"
|
||||
},
|
||||
"setIdx": 1,
|
||||
"setIdx": 4,
|
||||
"setId": 9,
|
||||
"iconIdx": 678
|
||||
},
|
||||
|
@ -325,7 +457,7 @@
|
|||
"name": "gear",
|
||||
"ligatures": "options"
|
||||
},
|
||||
"setIdx": 2,
|
||||
"setIdx": 5,
|
||||
"setId": 8,
|
||||
"iconIdx": 64
|
||||
},
|
||||
|
@ -358,7 +490,7 @@
|
|||
"ligatures": "other file",
|
||||
"name": "file-empty"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 36
|
||||
},
|
||||
|
@ -392,7 +524,7 @@
|
|||
"ligatures": "text file",
|
||||
"name": "file-text2"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 38
|
||||
},
|
||||
|
@ -423,7 +555,7 @@
|
|||
"ligatures": "image file",
|
||||
"name": "file-picture"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 39
|
||||
},
|
||||
|
@ -454,7 +586,7 @@
|
|||
"ligatures": "audio file",
|
||||
"name": "file-music"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 40
|
||||
},
|
||||
|
@ -485,7 +617,7 @@
|
|||
"ligatures": "video file",
|
||||
"name": "file-video"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 42
|
||||
},
|
||||
|
@ -525,7 +657,7 @@
|
|||
"ligatures": "archive file",
|
||||
"name": "file-zip"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 43
|
||||
},
|
||||
|
@ -554,7 +686,7 @@
|
|||
"ligatures": "password generator",
|
||||
"name": "key"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 141
|
||||
},
|
||||
|
@ -583,7 +715,7 @@
|
|||
"ligatures": "view password",
|
||||
"name": "eye"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 206
|
||||
},
|
||||
|
@ -617,7 +749,7 @@
|
|||
"ligatures": "generate password",
|
||||
"name": "loop2"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 302
|
||||
},
|
||||
|
@ -643,10 +775,10 @@
|
|||
"order": 32,
|
||||
"prevSize": 32,
|
||||
"code": 59958,
|
||||
"ligatures": "set password",
|
||||
"ligatures": "set password, download",
|
||||
"name": "arrow-down"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 310
|
||||
},
|
||||
|
@ -675,7 +807,7 @@
|
|||
"ligatures": "pdf file",
|
||||
"name": "file-pdf"
|
||||
},
|
||||
"setIdx": 3,
|
||||
"setIdx": 6,
|
||||
"setId": 7,
|
||||
"iconIdx": 474
|
||||
},
|
||||
|
@ -701,7 +833,7 @@
|
|||
"name": "tag",
|
||||
"ligatures": "tag"
|
||||
},
|
||||
"setIdx": 4,
|
||||
"setIdx": 7,
|
||||
"setId": 6,
|
||||
"iconIdx": 0
|
||||
},
|
||||
|
@ -728,7 +860,7 @@
|
|||
"name": "tags",
|
||||
"ligatures": "tags"
|
||||
},
|
||||
"setIdx": 4,
|
||||
"setIdx": 7,
|
||||
"setId": 6,
|
||||
"iconIdx": 1
|
||||
},
|
||||
|
@ -755,7 +887,7 @@
|
|||
"name": "clock",
|
||||
"ligatures": "recent"
|
||||
},
|
||||
"setIdx": 4,
|
||||
"setIdx": 7,
|
||||
"setId": 6,
|
||||
"iconIdx": 2
|
||||
},
|
||||
|
@ -784,7 +916,7 @@
|
|||
"name": "spinner",
|
||||
"ligatures": "loading"
|
||||
},
|
||||
"setIdx": 4,
|
||||
"setIdx": 7,
|
||||
"setId": 6,
|
||||
"iconIdx": 3
|
||||
},
|
||||
|
@ -812,7 +944,7 @@
|
|||
"name": "search",
|
||||
"ligatures": "search"
|
||||
},
|
||||
"setIdx": 4,
|
||||
"setIdx": 7,
|
||||
"setId": 6,
|
||||
"iconIdx": 4
|
||||
},
|
||||
|
@ -840,7 +972,7 @@
|
|||
"name": "locked",
|
||||
"ligatures": "locked"
|
||||
},
|
||||
"setIdx": 4,
|
||||
"setIdx": 7,
|
||||
"setId": 6,
|
||||
"iconIdx": 6
|
||||
},
|
||||
|
@ -866,7 +998,7 @@
|
|||
"name": "unlocked",
|
||||
"ligatures": "unlocked"
|
||||
},
|
||||
"setIdx": 4,
|
||||
"setIdx": 7,
|
||||
"setId": 6,
|
||||
"iconIdx": 7
|
||||
},
|
||||
|
@ -895,7 +1027,7 @@
|
|||
"name": "menu",
|
||||
"ligatures": "menu"
|
||||
},
|
||||
"setIdx": 4,
|
||||
"setIdx": 7,
|
||||
"setId": 6,
|
||||
"iconIdx": 8
|
||||
},
|
||||
|
@ -924,7 +1056,7 @@
|
|||
"name": "close",
|
||||
"ligatures": "failure, failed, delete, clear, cancel, close"
|
||||
},
|
||||
"setIdx": 4,
|
||||
"setIdx": 7,
|
||||
"setId": 6,
|
||||
"iconIdx": 9
|
||||
},
|
||||
|
@ -953,61 +1085,9 @@
|
|||
"name": "checkmark",
|
||||
"ligatures": "done, ok, save"
|
||||
},
|
||||
"setIdx": 4,
|
||||
"setIdx": 7,
|
||||
"setId": 6,
|
||||
"iconIdx": 10
|
||||
},
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M2.259 734.824h279.462v286.917h-279.462v-286.917z",
|
||||
"M2.259 2.259h279.462v286.917h-279.462v-286.917z",
|
||||
"M2.259 368.519h279.462v286.917h-279.462v-286.917z"
|
||||
],
|
||||
"width": 284,
|
||||
"grid": 0,
|
||||
"tags": [
|
||||
"commands"
|
||||
],
|
||||
"attrs": []
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"order": 18,
|
||||
"id": 1,
|
||||
"prevSize": 24,
|
||||
"code": 58899,
|
||||
"name": "commands",
|
||||
"ligatures": "commands"
|
||||
},
|
||||
"setIdx": 5,
|
||||
"setId": 4,
|
||||
"iconIdx": 0
|
||||
},
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M667.586 345.635v-338.544h-268.055v338.544l-299.967-121.263-90.486 257.986 310.037 104.527-198.134 262.808 224.514 164.237 184.802-279.685 203.382 279.685 221.11-164.237-203.382-262.808 319.397-107.080-90.486-257.986zM1220.574 2319.317z"
|
||||
],
|
||||
"width": 1080,
|
||||
"grid": 0,
|
||||
"tags": [
|
||||
"logo"
|
||||
],
|
||||
"attrs": []
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"order": 4,
|
||||
"id": 0,
|
||||
"prevSize": 24,
|
||||
"code": 58884,
|
||||
"name": "logo",
|
||||
"ligatures": "clipperz"
|
||||
},
|
||||
"setIdx": 5,
|
||||
"setId": 4,
|
||||
"iconIdx": 1
|
||||
}
|
||||
],
|
||||
"height": 1024,
|
File diff suppressed because one or more lines are too long
|
@ -69,7 +69,7 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
|
|||
if (! (aResult instanceof MochiKit.Async.CancelledError)) {
|
||||
message = "ERROR [" + deferredName + "]";
|
||||
} else {
|
||||
message = "CANCELLED - " + deferredName;
|
||||
message = "CANCELED - " + deferredName;
|
||||
}
|
||||
Clipperz.log(message, aResult);
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ var state = new array(4);
|
|||
var count = new array(2);
|
||||
count[0] = 0;
|
||||
count[1] = 0;
|
||||
var buffer = new array(64);
|
||||
var md5_buffer = new array(64);
|
||||
var transformBuffer = new array(16);
|
||||
var digestBits = new array(16);
|
||||
|
||||
|
@ -683,9 +683,9 @@ function md5_update(b) {
|
|||
count[0] -= 0xFFFFFFFF + 1;
|
||||
count[0] += 8;
|
||||
}
|
||||
buffer[index] = and(b, 0xff);
|
||||
md5_buffer[index] = and(b, 0xff);
|
||||
if (index >= 63) {
|
||||
transform(buffer, 0);
|
||||
transform(md5_buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -497,9 +497,11 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.
|
|||
Clipperz.log(">>> Connection.messageExceptionHandler: " + anError.message, anError);
|
||||
if (anError instanceof MochiKit.Async.CancelledError) {
|
||||
result = anError;
|
||||
} else if (typeof(anError.req) == 'undefined') {
|
||||
result = anError;
|
||||
} else {
|
||||
var errorPayload;
|
||||
|
||||
|
||||
errorPayload = Clipperz.Base.evalJSON(anError.req.responseText);
|
||||
if ((errorPayload.message == 'Trying to communicate without an active connection') ||
|
||||
(errorPayload.message == 'No tollManager available for current session') ||
|
||||
|
|
|
@ -104,18 +104,23 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Attachment, Object, {
|
|||
},
|
||||
|
||||
'setFile': function (aFile) {
|
||||
var hashValue;
|
||||
//console.log("ATTACHMENT SET FILE", aFile);
|
||||
this._file = aFile || null;
|
||||
// hashValue = aFile ? npm.bitcoin.address.toBase58Check(npm.bitcoin.crypto.hash160(aFile), NETWORK.pubKeyHash) : null;
|
||||
|
||||
/* These ones will disappear when the application is closed */
|
||||
this._name = aFile ? aFile['name'] : null;
|
||||
this._contentType = aFile ? aFile['type'] : null;
|
||||
this._size = aFile ? aFile['size'] : null;
|
||||
// this._hash = hashValue;
|
||||
|
||||
/* These ones will be saved in the Record */
|
||||
return Clipperz.Async.callbacks("Attachment.setFile", [
|
||||
MochiKit.Base.method(this, 'setValue', 'name', aFile['name']),
|
||||
MochiKit.Base.method(this, 'setValue', 'contentType', aFile['type']),
|
||||
MochiKit.Base.method(this, 'setValue', 'size', aFile['size']),
|
||||
// MochiKit.Base.method(this, 'setValue', 'hash', hashValue),
|
||||
|
||||
MochiKit.Base.partial(MochiKit.Async.succeed, this),
|
||||
], {trace:false});
|
||||
|
@ -135,6 +140,10 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Attachment, Object, {
|
|||
return this.getValue('size');
|
||||
},
|
||||
|
||||
'hash': function () {
|
||||
return this.getValue('hash');
|
||||
},
|
||||
|
||||
'metadata': function () {
|
||||
var deferredResult;
|
||||
|
||||
|
@ -143,6 +152,7 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Attachment, Object, {
|
|||
'name': MochiKit.Base.method(this, 'name'),
|
||||
'type': MochiKit.Base.method(this, 'contentType'),
|
||||
'size': MochiKit.Base.method(this, 'size'),
|
||||
'hash': MochiKit.Base.method(this, 'hash'),
|
||||
}, {trace:false});
|
||||
deferredResult.callback();
|
||||
|
||||
|
@ -346,6 +356,30 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Attachment, Object, {
|
|||
},
|
||||
|
||||
//=========================================================================
|
||||
/*
|
||||
computeAttachmentCertificateInfo: function () {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("Attachment.computeAttachmentCertificateInfo", {trace:false});
|
||||
deferredResult.collectResults({
|
||||
'name': MochiKit.Base.method(this, 'name'),
|
||||
'contentType': MochiKit.Base.method(this, 'contentType'),
|
||||
'size': MochiKit.Base.method(this, 'size'),
|
||||
'hash': [
|
||||
MochiKit.Base.method(attachmentController, 'getAttachment', this),
|
||||
function (aValue) { console.log("STEP 1", aValue); return aValue; },
|
||||
// npm.bitcoin.crypto.hash160,
|
||||
//function (aValue) { console.log("STEP 2", aValue); return aValue; },
|
||||
// function (anHash160) { return npm.bitcoin.address.toBase58Check(anHash160, NETWORK.pubKeyHash);}
|
||||
function () { return MochiKit.Async.succeed("bingo"); }
|
||||
]
|
||||
});
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
*/
|
||||
//=========================================================================
|
||||
__syntaxFix__: "syntax fix"
|
||||
});
|
||||
|
||||
|
|
|
@ -69,16 +69,17 @@ Clipperz.PM.DataModel.EncryptedRemoteObject = function(args) {
|
|||
//
|
||||
// Basic data workflow
|
||||
// =======================
|
||||
//
|
||||
// # READ
|
||||
// getRemoteData
|
||||
// unpackRemoteData
|
||||
// getDecryptedData [encryptedDataKeypath, encryptedVersionKeypath]
|
||||
// unpackData
|
||||
//
|
||||
//
|
||||
// ?? packData
|
||||
// ?? encryptDataWithKey
|
||||
// ?? packRemoteData [encryptedDataKeypath (?), encryptedVersionKeypath (?)]
|
||||
//
|
||||
// # WRITE
|
||||
// prepareRemoteDataWithKey
|
||||
// packData
|
||||
// [encryptDataWithKey]
|
||||
// packRemoteData [encryptedDataKeypath (?), encryptedVersionKeypath (?)]
|
||||
//
|
||||
|
||||
Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(null, {
|
||||
|
@ -284,7 +285,18 @@ Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(nul
|
|||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'setValue': function(aKey, aValue) {
|
||||
'getOrSetValue': function (aKey, aGetValueFunction) {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.setValue", {trace:false});
|
||||
deferredResult.addMethod(this, '_getObjectDataStore');
|
||||
deferredResult.addCallback(MochiKit.Base.methodcaller('deferredGetOrSet', aKey, aGetValueFunction));
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
'setValue': function (aKey, aValue) {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.setValue", {trace:false});
|
||||
|
|
|
@ -183,7 +183,7 @@ Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue = function(aPa
|
|||
var result;
|
||||
|
||||
// "yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"
|
||||
if (aPassword.replace(/[\s\-]/g, '').length == 32) {
|
||||
if (aPassword.replace(/[^a-zA-Z0-9]/g, '').length == 32) {
|
||||
try {
|
||||
var passwordByteArray;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ Clipperz.PM.DataModel.Record = function(args) {
|
|||
this._createNewAttachmentFunction = args.createNewAttachmentFunction || null;
|
||||
|
||||
this._attachmentServerStatus = {};
|
||||
this._certificateInfo = null;
|
||||
|
||||
this._tags = [];
|
||||
this._directLogins = {};
|
||||
|
@ -63,7 +64,6 @@ Clipperz.PM.DataModel.Record = function(args) {
|
|||
newVersion = new Clipperz.PM.DataModel.Record.Version({
|
||||
'retrieveKeyFunction': MochiKit.Base.method(this, 'getVersionKey'),
|
||||
'getVersion': MochiKit.Base.method(this, 'getVersion')
|
||||
|
||||
});
|
||||
this._versions[newVersion.reference()] = newVersion;
|
||||
this._currentVersionReference = newVersion.reference();
|
||||
|
@ -85,7 +85,288 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt
|
|||
// 'reference': function () {
|
||||
// return this._reference;
|
||||
// },
|
||||
|
||||
//=========================================================================
|
||||
|
||||
setID: function (anID) {
|
||||
//console.log("RECORD - SET ID", this, anID);
|
||||
return this.setValue('ID', anID);
|
||||
},
|
||||
|
||||
getID: function () {
|
||||
return this.getValue('ID');
|
||||
},
|
||||
|
||||
//=========================================================================
|
||||
|
||||
collectFieldInfo: function (aField) {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred('Record.collectFieldInfo', {trace:false});
|
||||
deferredResult.setValue('_field');
|
||||
deferredResult.addMethod(aField, 'reference');
|
||||
deferredResult.setValue('_reference');
|
||||
deferredResult.addMethod(aField, 'label');
|
||||
deferredResult.setValue('label');
|
||||
deferredResult.addMethod(aField, 'value');
|
||||
deferredResult.setValue('value');
|
||||
deferredResult.addMethod(aField, 'actionType');
|
||||
deferredResult.setValue('actionType');
|
||||
deferredResult.addMethod(aField, 'isHidden');
|
||||
deferredResult.setValue('isHidden');
|
||||
deferredResult.values();
|
||||
|
||||
deferredResult.callback(aField);
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
collectDirectLoginInfo: function (aDirectLogin) {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred('Record.collectDirectLoginInfo', {trace:false});
|
||||
deferredResult.addMethod(aDirectLogin, 'reference');
|
||||
deferredResult.setValue('_reference');
|
||||
deferredResult.addMethod(aDirectLogin, 'label');
|
||||
deferredResult.setValue('label');
|
||||
deferredResult.addMethod(aDirectLogin, 'favicon');
|
||||
deferredResult.setValue('favicon');
|
||||
deferredResult.values();
|
||||
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
collectAttachmentInfo: function(anAttachment) {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred('Record.collectAttachmentInfo', {trace:false});
|
||||
deferredResult.setValue('_attachment'); // The object itself, maybe this should be the only value being passed
|
||||
deferredResult.addMethod(anAttachment, 'reference');
|
||||
deferredResult.setValue('_reference');
|
||||
deferredResult.addMethod(anAttachment, 'name');
|
||||
deferredResult.setValue('name');
|
||||
deferredResult.addMethod(anAttachment, 'contentType');
|
||||
deferredResult.setValue('contentType');
|
||||
deferredResult.addMethod(anAttachment, 'size');
|
||||
deferredResult.setValue('size');
|
||||
deferredResult.addMethod(anAttachment, 'hash');
|
||||
deferredResult.setValue('hash');
|
||||
deferredResult.values();
|
||||
|
||||
deferredResult.callback(anAttachment);
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
collectRecordInfo: function () {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred('Record.collectRecordInfo', {trace:false});
|
||||
deferredResult.setValue('_record');
|
||||
deferredResult.addMethod(this, 'reference');
|
||||
deferredResult.setValue('_reference');
|
||||
deferredResult.addMethod(this, 'isArchived');
|
||||
deferredResult.setValue('_isArchived');
|
||||
deferredResult.addMethod(this, 'isBrandNew');
|
||||
deferredResult.setValue('_isBrandNew');
|
||||
deferredResult.addMethod(this, 'label');
|
||||
deferredResult.setValue('label');
|
||||
deferredResult.addMethod(this, 'notes');
|
||||
deferredResult.setValue('notes');
|
||||
deferredResult.addMethod(this, 'tags');
|
||||
deferredResult.setValue('tags');
|
||||
|
||||
deferredResult.addMethod(this, 'getID');
|
||||
deferredResult.setValue('ID');
|
||||
|
||||
deferredResult.addMethod(this, 'fields');
|
||||
deferredResult.addCallback(MochiKit.Base.values);
|
||||
deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'collectFieldInfo'));
|
||||
deferredResult.addCallback(Clipperz.Async.collectAll);
|
||||
deferredResult.setValue('fields');
|
||||
|
||||
deferredResult.addMethod(this, 'certificateInfo');
|
||||
deferredResult.addCallback(MochiKit.Base.bind(function (someCertificateInfo) {
|
||||
var result;
|
||||
|
||||
if ((someCertificateInfo) && (someCertificateInfo['status'] == 'requested')) {
|
||||
result = this.updateCertificateInfo()
|
||||
} else {
|
||||
result = MochiKit.Async.succeed(someCertificateInfo);
|
||||
}
|
||||
|
||||
return result;
|
||||
}, this));
|
||||
deferredResult.setValue('certificateInfo');
|
||||
|
||||
deferredResult.addMethod(this, 'attachmentsInfo');
|
||||
deferredResult.setValue('attachments');
|
||||
|
||||
deferredResult.addMethod(this, 'directLogins');
|
||||
deferredResult.addCallback(MochiKit.Base.values);
|
||||
deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'collectDirectLoginInfo'));
|
||||
deferredResult.addCallback(Clipperz.Async.collectAll);
|
||||
deferredResult.setValue('directLogins');
|
||||
|
||||
deferredResult.addMethod(this, 'getAttachmentServerStatus');
|
||||
deferredResult.setValue('attachmentServerStatus');
|
||||
|
||||
deferredResult.values();
|
||||
|
||||
deferredResult.callback(this);
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//=========================================================================
|
||||
|
||||
certificateMetadata: function () {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred('Record.certificateMetadata', {trace:false});
|
||||
deferredResult.addMethod(this, 'collectRecordInfo');
|
||||
deferredResult.addCallback(function (someValues) {
|
||||
var result = {};
|
||||
var propertiesToCollect = ['label', 'notes'];
|
||||
var fieldPropertiesToCollect = ['label', 'value'];
|
||||
var attachmentPropertiesToCollect = ['name', 'contentType', 'size', 'hash'];
|
||||
|
||||
MochiKit.Iter.forEach(propertiesToCollect, function (aKey) { result[aKey] = someValues[aKey]});
|
||||
result['fields'] = MochiKit.Base.map(function (aField) {
|
||||
var fieldResult = {};
|
||||
MochiKit.Iter.forEach(fieldPropertiesToCollect, function (aKey) { fieldResult[aKey] = aField[aKey]});
|
||||
|
||||
return fieldResult;
|
||||
}, someValues['fields']);
|
||||
result['attachments'] = MochiKit.Base.map(function (anAttachment) {
|
||||
var attachmentResult = {};
|
||||
MochiKit.Iter.forEach(attachmentPropertiesToCollect, function (aKey) { attachmentResult[aKey] = anAttachment[aKey]});
|
||||
|
||||
return attachmentResult;
|
||||
}, someValues['attachments']);
|
||||
|
||||
if (result['notes'] == "") {
|
||||
delete result['notes'];
|
||||
}
|
||||
|
||||
return result;
|
||||
});
|
||||
deferredResult.addCallback(Clipperz.Base.serializeJSON);
|
||||
//deferredResult.addCallback(function (aValue) { console.log("<<< CERTIFICATE METADATA", aValue); return aValue;});
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
|
||||
},
|
||||
|
||||
//=========================================================================
|
||||
/*
|
||||
publicKeyBufferFromHash256: function (aBuffer) {
|
||||
// var fixedBuffer;
|
||||
//
|
||||
// fixedBuffer = new npm.buffer.Buffer(33);
|
||||
// fixedBuffer.writeUInt8(0x03, 0); // https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki
|
||||
// aBuffer.copy(fixedBuffer, 1);
|
||||
//
|
||||
// return npm.bitcoin.ECPair.fromPublicKeyBuffer(fixedBuffer, NETWORK);
|
||||
|
||||
return npm.bitcoin.HDNode.fromSeedHex(aBuffer.toString('hex')).getPublicKeyBuffer();
|
||||
},
|
||||
*/
|
||||
keyFromHash256: function (aBuffer) {
|
||||
// return npm.bitcoin.HDNode.fromSeedHex(aBuffer.toString('hex'), NETWORK);
|
||||
var d = npm.BigInteger.fromHex(aBuffer.toString('hex'));
|
||||
return new npm.bitcoin.ECPair(d, null, {'network':NETWORK, 'compressed':true})
|
||||
},
|
||||
|
||||
computeAttachmentsCertificateInfo: function (attachmentController) {
|
||||
var deferredResult;
|
||||
var collectResultsInfo = {};
|
||||
var shouldComputeResult = false;
|
||||
var self = this;
|
||||
|
||||
MochiKit.Iter.forEach(MochiKit.Base.values(this.attachments()), function (anAttachment) {
|
||||
shouldComputeResult = true;
|
||||
collectResultsInfo[anAttachment.reference()] = [
|
||||
MochiKit.Base.method(anAttachment, 'metadata'),
|
||||
MochiKit.Base.itemgetter('hash'),
|
||||
function (anHashValue) {
|
||||
var hashBuffer = new npm.buffer.Buffer(anHashValue, 'hex');
|
||||
var key = self.keyFromHash256(hashBuffer);
|
||||
|
||||
return {
|
||||
'hash': anHashValue,
|
||||
'publicKey': key.getPublicKeyBuffer().toString('hex'),
|
||||
'address': key.getAddress(),
|
||||
}
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
if (shouldComputeResult) {
|
||||
deferredResult = new Clipperz.Async.Deferred("Record.computeAttachmentsCertificateInfo", {trace:false});
|
||||
deferredResult.collectResults(collectResultsInfo);
|
||||
deferredResult.callback();
|
||||
} else {
|
||||
deferredResult = MochiKit.Async.succeed(collectResultsInfo);
|
||||
}
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
computeCertificateInfo: function (aWallet) {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("Record.computeCertificateInfo", {trace:false});
|
||||
deferredResult.collectResults({
|
||||
'reference': MochiKit.Base.method(this, 'reference'),
|
||||
'version': MochiKit.Base.partial(MochiKit.Async.succeed, "1.0"),
|
||||
'card.publicKey': [
|
||||
MochiKit.Base.method(this, 'getID'),
|
||||
MochiKit.Base.method(aWallet, 'getKeyForDocumentWithID'),
|
||||
MochiKit.Base.methodcaller('getPublicKeyBuffer'),
|
||||
MochiKit.Base.methodcaller('toString', 'hex'),
|
||||
],
|
||||
'card.address': [
|
||||
MochiKit.Base.method(this, 'getID'),
|
||||
MochiKit.Base.method(aWallet, 'getKeyForDocumentWithID'),
|
||||
MochiKit.Base.methodcaller('getAddress')
|
||||
],
|
||||
/*
|
||||
'metadata': [
|
||||
MochiKit.Base.method(this, 'certificateMetadata'),
|
||||
function (aString) { return new npm.buffer.Buffer(aString, 'utf8') },
|
||||
npm.bitcoin.crypto.hash160,
|
||||
function (anHash160) { return npm.bitcoin.address.toBase58Check(anHash160, NETWORK.pubKeyHash);}
|
||||
],
|
||||
*/
|
||||
'metadata.publicKey': [
|
||||
MochiKit.Base.method(this, 'certificateMetadata'),
|
||||
function (aString) { return new npm.buffer.Buffer(aString, 'utf8') },
|
||||
npm.bitcoin.crypto.hash256,
|
||||
MochiKit.Base.method(this, 'keyFromHash256'),
|
||||
|
||||
MochiKit.Base.methodcaller('getPublicKeyBuffer'),
|
||||
MochiKit.Base.methodcaller('toString', 'hex'),
|
||||
],
|
||||
'metadata.address': [
|
||||
MochiKit.Base.method(this, 'certificateMetadata'),
|
||||
function (aString) { return new npm.buffer.Buffer(aString, 'utf8') },
|
||||
npm.bitcoin.crypto.hash256,
|
||||
MochiKit.Base.method(this, 'keyFromHash256'),
|
||||
|
||||
MochiKit.Base.methodcaller('getAddress')
|
||||
],
|
||||
'attachments': MochiKit.Base.method(this, 'computeAttachmentsCertificateInfo')
|
||||
});
|
||||
//deferredResult.addCallback(function (aValue) { console.log("=== CERTIFICATE INFO", MochiKit.Base.serializeJSON(aValue)); return aValue;});
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//=========================================================================
|
||||
|
||||
'getIndexData': function () {
|
||||
|
@ -149,6 +430,33 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt
|
|||
return this._attachmentServerStatus;
|
||||
},
|
||||
|
||||
updatedAttachmentServerStatus: function () {
|
||||
return Clipperz.Async.callbacks("Record.updatedAttachmentServerStatus", [
|
||||
MochiKit.Base.partial(this.retrieveRemoteDataFunction(), this),
|
||||
MochiKit.Base.itemgetter('attachmentStatus'),
|
||||
MochiKit.Base.method(this, 'setAttachmentServerStatus'),
|
||||
], {trace:false});
|
||||
},
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
setCertificateInfo: function (aValue) {
|
||||
this._certificateInfo = aValue;
|
||||
return this._certificateInfo;
|
||||
},
|
||||
|
||||
certificateInfo: function () {
|
||||
return this._certificateInfo;
|
||||
},
|
||||
|
||||
updateCertificateInfo: function () {
|
||||
return Clipperz.Async.callbacks("Record.updateCertificateInfo", [
|
||||
MochiKit.Base.partial(this.retrieveRemoteDataFunction(), this),
|
||||
MochiKit.Base.itemgetter('certificateInfo'),
|
||||
MochiKit.Base.method(this, 'setCertificateInfo'),
|
||||
], {trace:false});
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
/*
|
||||
'key': function () {
|
||||
|
@ -302,8 +610,32 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt
|
|||
|
||||
//=========================================================================
|
||||
|
||||
attachmentsCount: function() {
|
||||
return MochiKit.Base.keys(this.attachments()).length;
|
||||
certificateStatus: function() {
|
||||
// TODO: FAKE IMPLEMENTATION, just enough to test the UI
|
||||
var result;
|
||||
|
||||
// if (this.reference().charAt(0) == 'a') {
|
||||
// result = 'published';
|
||||
// } else if (this.reference().charAt(0) == '0') {
|
||||
// result = 'requested';
|
||||
// } else {
|
||||
// result = '';
|
||||
// }
|
||||
|
||||
result = '';
|
||||
|
||||
return result; // 'requested' | 'published' | ''
|
||||
},
|
||||
|
||||
markAsCertified: function () {
|
||||
return this.addTag(Clipperz.PM.DataModel.Record.certifiedTag);
|
||||
},
|
||||
|
||||
hasBeenCertified: function () {
|
||||
return Clipperz.Async.callbacks("Record.isArchived", [
|
||||
MochiKit.Base.method(this, 'tags'),
|
||||
function (someTags) { return MochiKit.Iter.some(someTags, MochiKit.Base.partial(MochiKit.Base.objEqual, Clipperz.PM.DataModel.Record.certifiedTag))},
|
||||
], {trace:false});
|
||||
},
|
||||
|
||||
//=========================================================================
|
||||
|
@ -486,6 +818,26 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt
|
|||
|
||||
//=========================================================================
|
||||
// TODO: !!!!
|
||||
|
||||
'attachmentsCount': function() {
|
||||
return MochiKit.Base.keys(this.attachments()).length;
|
||||
},
|
||||
|
||||
|
||||
'attachmentsInfo': function () {
|
||||
// deferredResult.addMethod(this, 'attachments');
|
||||
// deferredResult.addCallback(MochiKit.Base.values);
|
||||
// deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'collectAttachmentInfo'));
|
||||
// deferredResult.addCallback(Clipperz.Async.collectAll);
|
||||
|
||||
return Clipperz.Async.callbacks("Record.attachmentsInfo", [
|
||||
MochiKit.Base.method(this, 'attachments'),
|
||||
MochiKit.Base.values,
|
||||
MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'collectAttachmentInfo')),
|
||||
Clipperz.Async.collectAll
|
||||
], {trace:false});
|
||||
},
|
||||
|
||||
'attachments': function () {
|
||||
return this._attachments;
|
||||
},
|
||||
|
@ -527,7 +879,6 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt
|
|||
delete this._attachments[anAttachment.reference()]
|
||||
}, this)
|
||||
], {trace:false});
|
||||
|
||||
},
|
||||
|
||||
'attachmentReferences': function () {
|
||||
|
@ -563,16 +914,11 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt
|
|||
|
||||
'unpackRemoteData': function (someData) {
|
||||
var result;
|
||||
|
||||
/*
|
||||
this._currentRecordVersion = new Clipperz.PM.DataModel.Record.Version({
|
||||
'reference': someData['currentVersion']['reference'],
|
||||
'retrieveKeyFunction': MochiKit.Base.method(this, 'getCurrentRecordVersionKey'),
|
||||
'remoteData': someData['currentVersion'],
|
||||
});
|
||||
*/
|
||||
var versionKey;
|
||||
|
||||
this.setAttachmentServerStatus(someData['attachmentStatus']);
|
||||
this.setCertificateInfo(someData['certificateInfo']);
|
||||
|
||||
for (versionKey in someData['versions']) {
|
||||
this._versions[versionKey] = new Clipperz.PM.DataModel.Record.Version({
|
||||
'reference': versionKey,
|
||||
|
@ -581,8 +927,6 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt
|
|||
'getVersion': MochiKit.Base.method(this, 'getVersion')
|
||||
})
|
||||
}
|
||||
|
||||
// this._currentVersionReference = someData['currentVersion']['reference'];
|
||||
this._currentVersionReference = someData['currentVersion'];
|
||||
|
||||
result = Clipperz.PM.DataModel.Record.superclass.unpackRemoteData.apply(this, arguments);
|
||||
|
@ -596,11 +940,10 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt
|
|||
var result;
|
||||
|
||||
result = Clipperz.PM.DataModel.Record.superclass.unpackData.apply(this, arguments);
|
||||
|
||||
if (MochiKit.Base.isUndefinedOrNull(result['notes'])) {
|
||||
result['notes'] = ''
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
|
@ -1218,6 +1561,12 @@ Clipperz.log("Warning: Record.fieldWithLabel('" + aLabel + "') is returning more
|
|||
|
||||
MochiKit.Base.method(aRecord, 'fullLabel'),
|
||||
MochiKit.Base.method(aRecord, 'extractTagsFromFullLabel'),
|
||||
//function (someValues) { console.log(">>> TAGS", someValues); return someValues; },
|
||||
MochiKit.Base.keys,
|
||||
MochiKit.Base.partial(MochiKit.Base.filter, Clipperz.PM.DataModel.Record.isRegularTag),
|
||||
MochiKit.Base.partial(MochiKit.Base.filter, Clipperz.PM.DataModel.Record.isNotImportTag),
|
||||
function (tags) { return MochiKit.Iter.reduce(function (result, value) { result[value] = true; return result; }, tags, {}); },
|
||||
//function (someValues) { console.log("<<< TAGS", someValues); return someValues; },
|
||||
MochiKit.Base.method(this, 'updateTags'),
|
||||
|
||||
MochiKit.Base.method(aRecord, 'notes'),
|
||||
|
@ -1333,6 +1682,7 @@ Clipperz.PM.DataModel.Record.defaultCardInfo = {
|
|||
'label': MochiKit.Base.methodcaller('label'),
|
||||
'favicon': MochiKit.Base.methodcaller('favicon'),
|
||||
'attachmentsCount': MochiKit.Base.methodcaller('attachmentsCount'),
|
||||
'hasBeenCertified': MochiKit.Base.methodcaller('hasBeenCertified'),
|
||||
};
|
||||
Clipperz.PM.DataModel.Record.defaultSearchField = '_searchableContent';
|
||||
|
||||
|
@ -1342,7 +1692,9 @@ Clipperz.PM.DataModel.Record.specialTagChar = '\uE010';
|
|||
Clipperz.PM.DataModel.Record.specialTagsConstructor = function (aTag) {
|
||||
return Clipperz.PM.DataModel.Record.specialTagChar + aTag; //.replace(/\s/g, Clipperz.PM.DataModel.Record.tagSpace);
|
||||
}
|
||||
Clipperz.PM.DataModel.Record.archivedTag = Clipperz.PM.DataModel.Record.specialTagsConstructor('ARCH');
|
||||
Clipperz.PM.DataModel.Record.archivedTag = Clipperz.PM.DataModel.Record.specialTagsConstructor('ARCH');
|
||||
Clipperz.PM.DataModel.Record.certifiedTag = Clipperz.PM.DataModel.Record.specialTagsConstructor('CERT');
|
||||
|
||||
Clipperz.PM.DataModel.Record.regExpForTag = function (aTag) {
|
||||
return new RegExp('\\' + Clipperz.PM.DataModel.Record.tagChar + aTag, 'g');
|
||||
};
|
||||
|
@ -1355,6 +1707,9 @@ Clipperz.PM.DataModel.Record.isSpecialTag = function (aTag) {
|
|||
Clipperz.PM.DataModel.Record.isRegularTag = function (aTag) {
|
||||
return !Clipperz.PM.DataModel.Record.isSpecialTag(aTag);
|
||||
};
|
||||
Clipperz.PM.DataModel.Record.isNotImportTag = function (aTag) {
|
||||
return aTag.indexOf('Import_') != 0;
|
||||
};
|
||||
Clipperz.PM.DataModel.Record.regExpForSearch = function (aSearch) {
|
||||
return new RegExp(aSearch.replace(/[^A-Za-z0-9]/g, '\\$&'), 'i');
|
||||
};
|
||||
|
|
|
@ -456,27 +456,15 @@ Clipperz.log("SKIPPING record " + reference + " as there are no stats associated
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
'createNewAttachment': function (aRecord) {
|
||||
// TODO:
|
||||
|
||||
// var newDirectLogin;
|
||||
var newAttachment;
|
||||
// var newDirectLoginIndexValue;
|
||||
var newAttachmentIndexValue;
|
||||
|
||||
// newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:aRecord});
|
||||
newAttachment = new Clipperz.PM.DataModel.Attachment({'record':aRecord});
|
||||
// newDirectLoginIndexValue = MochiKit.Base.listMax(MochiKit.Base.map(function (aValue) { return aValue * 1; }, MochiKit.Base.values(this.directLoginsIndex()))) + 1;
|
||||
newAttachmentIndexValue = MochiKit.Base.listMax(MochiKit.Base.map(function (aValue) { return aValue * 1; }, MochiKit.Base.values(this.attachmentsIndex()))) + 1;
|
||||
|
||||
// this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin);
|
||||
this.transientState().setValue('newAttachmentReferences' + '.' + newAttachment.reference(), newAttachment);
|
||||
|
||||
// this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue;
|
||||
this.attachmentsIndex()[newAttachment.reference()] = newAttachmentIndexValue;
|
||||
// this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]});
|
||||
this.attachmentsData().setValue(this.attachmentsIndex()[newAttachment.reference()], {'record': this.recordsIndex()[aRecord.reference()]});
|
||||
|
||||
// return newDirectLogin;
|
||||
return newAttachment;
|
||||
},
|
||||
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
|
||||
Copyright 2008-2015 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
*/
|
||||
|
||||
try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
|
||||
throw "Clipperz.PM.DataModel.User.Header.Wallet depends on Clipperz.PM.DataModel.User!";
|
||||
}
|
||||
|
||||
if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
|
||||
|
||||
Clipperz.PM.DataModel.User.Header.Wallet = function(args) {
|
||||
Clipperz.PM.DataModel.User.Header.Wallet.superclass.constructor.apply(this, arguments);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Wallet, Clipperz.PM.DataModel.EncryptedRemoteObject, {
|
||||
|
||||
'toString': function() {
|
||||
return "Clipperz.PM.DataModel.User.Header.Wallet";
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
getRandomSeed: function () {
|
||||
return Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(512/8).toHexString().substring(2);
|
||||
},
|
||||
|
||||
getWalletSeed: function () {
|
||||
return this.getOrSetValue('walletSeed', MochiKit.Base.method(this, 'getRandomSeed'));
|
||||
},
|
||||
|
||||
userMasterKey: function () {
|
||||
return Clipperz.Async.callbacks("User.Header.Wallet.userMasterKey", [
|
||||
MochiKit.Base.method(this, 'getWalletSeed'),
|
||||
function (aValue) {
|
||||
return npm.bitcoin.HDNode.fromSeedHex(aValue, NETWORK);
|
||||
}
|
||||
], {trace:false});
|
||||
},
|
||||
|
||||
getNextID: function (aKeyPath) {
|
||||
//console.log("WALLET - getNextID", aKeyPath);
|
||||
return Clipperz.Async.callbacks("User.Header.Wallet.userMasterKey", [
|
||||
MochiKit.Base.method(this, 'getValue', aKeyPath),
|
||||
function (aValue) {
|
||||
var result;
|
||||
|
||||
if (aValue == null) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = aValue + 1;
|
||||
}
|
||||
|
||||