summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijayee Kulkaa <vijayee.kulkaa@hushmail.com>2018-09-19 09:27:58 -0400
committerVijayee Kulkaa <vijayee.kulkaa@hushmail.com>2018-09-19 11:28:08 -0400
commit1392cf4cdbb869dc9e47b986ae8169515b6cb917 (patch)
tree2d2e19cd10f453fd504b67ae94abc7f58756d669
parent198f8778070c774cdff6307816e30e78d04e2221 (diff)
Logo and AddressesHEADmaster
-rw-r--r--README.md4
-rw-r--r--build/icons/ons-logo-lettered.svg264
-rw-r--r--src/main/address-cache.js85
-rw-r--r--src/main/address.js43
-rw-r--r--src/main/mutable-cache.js6
-rw-r--r--src/main/mutable.js4
-rw-r--r--src/main/name-router.js26
-rw-r--r--src/main/record-cache.js4
-rw-r--r--src/main/record.js2
-rw-r--r--src/main/server.js18
-rw-r--r--src/utility.js9
11 files changed, 443 insertions, 22 deletions
diff --git a/README.md b/README.md
index f5066e6..bae50eb 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
-# The Owner Free File System Naming System in Javascript
+<div style="text-align:center; margin: 50%, 50%"><img src="/build/icons/ons-logo-lettered.svg" width="250" height="250"></div>
+<hr>
+# The Owner Free File System Naming System in Javascript
diff --git a/build/icons/ons-logo-lettered.svg b/build/icons/ons-logo-lettered.svg
new file mode 100644
index 0000000..ff114c1
--- /dev/null
+++ b/build/icons/ons-logo-lettered.svg
@@ -0,0 +1,264 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="512.00006"
+ height="512.00006"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="ons-logo-letterd.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.98994951"
+ inkscape:cx="104.98128"
+ inkscape:cy="388.72316"
+ inkscape:document-units="px"
+ inkscape:current-layer="text4207"
+ showgrid="false"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:window-width="2495"
+ inkscape:window-height="1056"
+ inkscape:window-x="65"
+ inkscape:window-y="24"
+ inkscape:window-maximized="1"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(1.1048125e-5,-342.36197)">
+ <g
+ id="g3345" />
+ <g
+ id="g3470"
+ transform="matrix(1.1493292,0,0,1.1493292,-134.09525,290.41628)">
+ <g
+ id="g3022"
+ transform="translate(0,-172.27456)">
+ <g
+ id="g3419">
+ <g
+ id="g4182">
+ <circle
+ r="202.53558"
+ cy="522.53717"
+ cx="377.29196"
+ transform="matrix(1.0997506,0,0,1.0997506,-75.515815,-134.45084)"
+ id="path2987-5"
+ style="opacity:1;fill:#439850;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.41176471" />
+ <circle
+ r="67.680222"
+ cy="374.54984"
+ cx="332.34018"
+ transform="matrix(1.0820896,0,0,1.0820896,-97.487259,-37.312618)"
+ id="path3854"
+ style="fill:#8a3951;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.41176471" />
+ <g
+ style="fill:#80da78;fill-opacity:1"
+ id="g3074"
+ transform="matrix(0.79765024,0,0,0.83894985,10.756646,242.26983)">
+ <path
+ id="path3076"
+ d="m 630.212,247.44 c 2.502,-2.081 4.967,-4.198 7.395,-6.352 l -8.238,0 c -0.053,2.124 -0.135,4.242 -0.24,6.352 l 1.083,0 z"
+ inkscape:connector-curvature="0"
+ style="fill:#80da78;fill-opacity:1" />
+ <path
+ style="fill:#80da78;fill-opacity:1"
+ id="path3078"
+ d="m 579.996,281.674 -24.561,0 0,-4.889 -7.619,0 0,-8.683 7.619,0 0,-7.221 -32.748,0 0,-4.313 25.127,0 0,-2.157 7.621,0 26.385,0 0,-6.971 47.307,0 c 0.105,-2.11 0.188,-4.228 0.24,-6.352 l -50.994,0 0,-10.68 51.006,0 c -0.02,-1.259 -0.063,-2.516 -0.111,-3.769 l -20.113,0 0,-10.68 10.68,0 0,-8.166 -118.73,0 0,-5.339 118.729,0 0,-3.454 -27.969,0 0,-2.982 27.969,0 0,-11.334 -63.887,0 0,-11.764 65.088,0 c -0.504,-1.818 -1.025,-3.625 -1.568,-5.426 l -45.299,0 0,-5.968 43.41,0 c -0.619,-1.862 -1.262,-3.715 -1.924,-5.556 l -84.391,0 0,-7.629 -26.383,0 0,-5.537 -73.498,0 0,-11.764 73.498,0 0,-5.425 -96.557,0 0,-5.969 96.557,0 0,-9.4 37.271,0 0,-16.272 -103.228,0 0,-7.42 23.242,0 0,-16.307 -23.242,0 0,-3.796 -15.523,0 0,-2.984 15.523,0 0,-4.178 -54.649,0 0,-2.983 39.126,0 0,0.094 23.24,0 0,-11.817 -7.717,0 0,-3.117 -50.253,0 0,-5.966 50.253,0 0,-5.846 23.242,0 0,-2.754 -23.242,0 0,-2.297 33.918,0 0,-10.054 C 448.705,6.117 422.767,1.518 395.75,1.518 c -129.065,0 -233.691,104.626 -233.691,233.69 0,4.421 0.135,8.809 0.377,13.167 61.412,50.517 145,78.291 233.314,78.291 66.484,0 130.353,-15.085 184.246,-44.992 z M 332.623,106.135 c -2.005,14.457 -9.213,29.846 -20.295,43.331 -15.844,19.28 -36.883,31.257 -54.903,31.257 -7.769,0 -14.688,-2.31 -20.004,-6.682 -18.006,-14.797 -13.7,-49.899 9.594,-78.247 15.845,-19.28 36.883,-31.257 54.903,-31.257 7.77,0 14.686,2.31 20.005,6.68 8.997,7.391 12.796,19.792 10.7,34.918 z"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#80da78;fill-opacity:1"
+ id="path3080"
+ d="m 395.75,332.681 c -87.404,0 -170.337,-27.986 -232.521,-76.826 10.427,104.519 89.72,188.75 191.846,206.676 l 0,-5.147 66.909,0 0,-2.913 46.613,0 c 7.863,-2.578 15.549,-5.548 23.018,-8.913 l -29.449,0 -65.308,0 0,-3.65 65.308,0 0,-5.981 -93.629,0 0,-10.052 93.629,0 0,-11.098 36.791,0 0,-2.092 45.465,0 c 1.91,-1.578 3.785,-3.194 5.645,-4.83 l -37.318,0 0,-8.685 25.936,0 0,-7.218 -51.066,0 0,-4.314 25.129,0 0,-2.158 32.58,0 0,-5.408 31.52,0 c 2.715,-3.322 5.33,-6.723 7.859,-10.19 l -16.68,0 0,-4.313 4.697,0 0,-13.797 -71.877,0 0,-6.441 91.02,0 0,-3.27 -59,0 0,-6.444 59,0 0,-6.704 -34.967,0 0,-10.68 34.963,0 0,-7.226 -13.49,0 0,-5.338 26.387,0 0,-19.201 18.379,0 c 0.297,-1.252 0.576,-2.509 0.854,-3.77 l -35.523,0 C 532.464,314.95 465.5,332.681 395.75,332.681 Z"
+ inkscape:connector-curvature="0" />
+ <g
+ style="fill:#80da78;fill-opacity:1"
+ id="g3082">
+ <path
+ style="fill:#80da78;fill-opacity:1"
+ id="path3084"
+ d="m 276.31,144.557 c -0.403,-1.177 -0.618,-2.484 -0.64,-3.884 l -0.019,-1.292 -42.766,0 -0.149,1.141 c -1.012,7.75 -0.209,14.785 2.319,20.348 l 0.517,1.135 41.145,-16.261 -0.407,-1.187 z"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#80da78;fill-opacity:1"
+ id="path3086"
+ d="m 306.476,129.979 c -0.297,2.13 -1.001,4.343 -2.091,6.576 l -0.518,1.061 6.604,4.138 0.721,-0.99 c 4.866,-6.69 8.709,-13.704 11.421,-20.845 l 1.619,-4.263 -17.667,13.365 -0.089,0.958 z"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#80da78;fill-opacity:1"
+ id="path3088"
+ d="m 268.45,83.859 c -6.095,4.533 -11.688,9.878 -16.625,15.887 -0.329,0.4 -0.648,0.805 -0.967,1.209 l -1.218,1.538 33.275,21.972 0.756,-0.734 c 1.201,-1.162 2.484,-2.197 3.818,-3.079 l 0.975,-0.644 -18.764,-37.077 -1.25,0.928 z"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#80da78;fill-opacity:1"
+ id="path3090"
+ d="m 317.97,76.028 c -2.796,-2.297 -6.146,-3.861 -9.967,-4.652 l -1.5,-0.31 -2.41,49.352 0.311,0.387 c 0.301,0.375 0.572,0.781 0.813,1.208 l 0.736,1.312 20.03,-15.15 0.09,-0.506 c 0.143,-0.799 0.271,-1.593 0.385,-2.388 1.785,-12.901 -1.229,-23.289 -8.488,-29.253 z"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#80da78;fill-opacity:1"
+ id="path3092"
+ d="m 280.902,149.827 -0.518,-0.25 -42.123,16.648 1.39,1.412 c 0.624,0.634 1.169,1.142 1.722,1.597 4.252,3.493 9.651,5.265 16.052,5.265 7.991,0 17.022,-2.832 26.116,-8.189 l 0.533,-0.314 2.406,-15.17 -1.491,-0.044 c -1.487,-0.043 -2.863,-0.365 -4.087,-0.955 z"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#80da78;fill-opacity:1"
+ id="path3094"
+ d="m 300.406,142.563 c -2.37,2.759 -5.171,4.98 -8.098,6.426 l -0.609,0.3 -2.083,13.132 2.617,-2.025 c 5.08,-3.932 9.854,-8.51 14.191,-13.606 l 0.983,-1.157 -6.269,-3.925 -0.732,0.855 z"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#80da78;fill-opacity:1"
+ id="path3096"
+ d="m 293.954,117.769 c 1.416,-0.324 2.755,-0.42 4.004,-0.317 l 1.354,0.116 2.285,-46.802 -1.445,0.073 c -7.858,0.396 -16.608,3.404 -25.307,8.699 l -1.035,0.631 19.143,37.83 1.001,-0.23 z"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#80da78;fill-opacity:1"
+ id="path3098"
+ d="m 277.041,133.621 c 0.565,-1.475 1.27,-2.903 2.092,-4.246 l 0.664,-1.081 -33.05,-21.82 -0.726,1.08 c -5.473,8.146 -9.537,16.882 -11.754,25.262 l -0.436,1.647 42.887,0 0.323,-0.842 z"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <circle
+ r="202.53558"
+ cy="522.53717"
+ cx="377.29196"
+ transform="matrix(0.40399003,0,0,0.41645884,99.105786,151.39907)"
+ id="path2987"
+ style="fill:#80da78;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.41176471" />
+ <path
+ sodipodi:nodetypes="csssccsssc"
+ inkscape:connector-curvature="0"
+ id="path3872"
+ d="m 541.209,493.39115 c 0,0 -105.87755,27.7792 -217.9602,27.7792 -64.62988,0 -129.47184,-12.12184 -180.5844,-27.7792 -8.95217,-2.74233 -16.90033,-6.37356 -16.90033,-14.29049 0,-7.91694 7.53755,-14.2905 16.90033,-14.2905 l 41.60995,10.15394 63.71809,10.04911 c 72.15566,11.37982 170.57963,4.7122 293.21656,-20.20305 9.17534,-1.86409 16.90034,6.37356 16.90034,14.2905 0,7.91693 -7.53756,14.29049 -16.90034,14.29049 z"
+ style="opacity:1;fill:#439850;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:0.41176471" />
+ <g
+ style="fill:#439850;fill-opacity:1"
+ id="g3197"
+ transform="matrix(0.13226526,0,0,0.15510797,187.60016,288.0605)">
+ <title
+ id="title3199">Layer 1</title>
+ <path
+ style="fill:#439850;fill-opacity:1;fill-rule:evenodd;stroke-width:3.80584407;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:7.611689, 7.611689;stroke-dashoffset:0;stroke-opacity:0.84117599;marker-start:none;marker-mid:none;marker-end:none"
+ d="M 291.3592,834.14704 C 46.870303,763.29937 -77.666759,529.48702 4.8316154,309.8814 21.55046,265.37686 35.909442,238.99991 47.097197,219.38418 c 10.335069,-18.12069 18.81934,-25.64276 29.076659,-37.81657 7.329952,-8.69949 13.532947,-14.31127 26.665824,-27.25111 0,0 14.25082,-11.00708 29.09772,-20.18527 21.25356,-13.1387 39.30951,-25.34021 59.1491,-6.42868 69.49116,66.24054 36.64765,34.90262 67.44364,66.86166 20.59472,21.37251 16.36592,15.47662 -8.06206,38.15904 l -18.6455,22.60518 c -30.22953,39.21874 -26.81686,32.50829 -52.61771,105.08263 -47.29998,133.0485 25.91732,273.54697 174.00747,316.46034 148.09019,42.91337 310.50073,-29.2246 362.54976,-160.9775 23.54718,-59.60554 19.82083,-120.92748 -4.4149,-174.48643 -18.64527,-21.15544 -42.69604,-62.63584 -14.2003,-77.9552 42.276,-22.72767 67.23455,-32.18388 119.91846,-53.53476 23.27217,-9.43137 42.08757,21.81218 52.58708,40.20484 l 1.69142,-0.75503 c 51.81464,94.82059 62.43258,207.99733 19.29157,317.20114 C 804.3044,785.10019 535.84812,904.99471 291.3592,834.14704 Z"
+ id="path3329"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sssscsssccssscssccss" />
+ <path
+ style="fill:#439850;fill-opacity:1;fill-rule:evenodd;stroke-width:3.80584407;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:7.611689, 7.611689;stroke-dashoffset:0;stroke-opacity:0.84117599;marker-start:none;marker-mid:none;marker-end:none"
+ d="m 362.07347,452.26338 c -49.07435,-14.2207 13.6794,-258.18466 32.96883,-302.3587 0,0 76.61907,-192.367696 219.37705,-322.26221 102.29018,-93.07314 204.79538,-150.83056 341.74481,-202.62661 56.73994,-21.45976 295.80954,-52.38714 346.49654,-43.09533 131.1245,24.0374 -152.2843,106.04723 -234.2312,138.80051 -57.3742,22.9318 -132.9508,55.34154 -186.56656,89.30326 -29.81645,18.88658 -90.50831,63.9822 -129.06852,101.177948 -17.07057,16.466547 -49.25205,50.284406 -56.82777,58.85374 0,0 -34.03625,46.150805 -74.35259,117.870579 -26.58685,47.296053 -51.86598,112.368163 -70.08456,200.569793 -9.4081,45.54739 -22.2159,124.8326 -23.00771,155.39197 -1.22124,47.13272 -117.37402,22.59573 -166.44832,8.37505 z"
+ id="path8"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="scsssssscssss" />
+ </g>
+ <ellipse
+ ry="17.425131"
+ rx="15.657364"
+ cy="459.65518"
+ cx="155.56349"
+ transform="matrix(1.6878826,0,0.08515328,0.90073558,-134.80215,40.194103)"
+ id="path3335"
+ style="fill:#80da78;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.41176471" />
+ <ellipse
+ ry="4.5535712"
+ rx="4.8214288"
+ cy="466.91577"
+ cx="166.60715"
+ transform="translate(-1.4285714,-2.8928571)"
+ id="path3337"
+ style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.41176471" />
+ </g>
+ <g
+ style="font-style:normal;font-weight:normal;font-size:71.37036896px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="text4207">
+ <path
+ d="m 191.53632,468.85562 c 13.20352,0 23.98044,-11.20515 23.98044,-24.97963 0,-13.77448 -10.77692,-24.97963 -23.98044,-24.97963 -13.20352,0 -23.90907,11.20515 -23.90907,24.97963 0,13.77448 10.70555,24.97963 23.90907,24.97963 z m 0,-41.60892 c 8.63581,0 15.63011,7.42251 15.63011,16.62929 0,9.20678 -6.9943,16.6293 -15.63011,16.6293 -8.56445,0 -15.55874,-7.42252 -15.55874,-16.6293 0,-9.20678 6.99429,-16.62929 15.55874,-16.62929 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Odin Rounded';-inkscape-font-specification:'Odin Rounded Bold';fill:#ffffff"
+ id="path4175" />
+ <path
+ d="m 254.62438,468.85562 c 2.28385,0 4.13948,-1.927 4.13948,-4.13948 l 0,-41.6803 c 0,-2.28385 -1.85563,-4.13948 -4.13948,-4.13948 -2.35522,0 -4.21085,1.85563 -4.21085,4.13948 l 0,28.47678 -21.55385,-30.832 c -0.78508,-1.14192 -2.06974,-1.78426 -3.35441,-1.78426 -2.49796,0 -4.21085,1.99837 -4.21085,4.13948 l 0,41.6803 c 0,2.28385 1.85563,4.13948 4.13948,4.13948 2.28385,0 4.21085,-1.85563 4.21085,-4.13948 l 0,-28.47678 21.55385,30.832 c 0.78508,1.14193 2.06974,1.78426 3.42578,1.78426 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Odin Rounded';-inkscape-font-specification:'Odin Rounded Bold';fill:#ffffff"
+ id="path4177" />
+ <path
+ d="m 300.01928,437.73814 c -2.78344,-1.14193 -5.49552,-2.42659 -5.49552,-5.92374 l 0,-0.28548 c 0.0714,-2.56933 2.78345,-4.35359 6.2806,-4.35359 l 0.42822,0 c 1.28467,0.0714 2.71207,0.57096 3.78263,1.4274 0.78507,0.57097 1.64152,0.78508 2.49796,0.78508 1.28467,0 2.49796,-0.57097 3.35441,-1.64152 0.57096,-0.7137 0.85644,-1.64152 0.85644,-2.49796 0,-1.2133 -0.57096,-2.4266 -1.64152,-3.28304 -2.49796,-1.85563 -5.56688,-3.06893 -8.56444,-3.1403 l -0.64233,0 c -3.71126,0 -7.20841,1.2133 -9.77774,3.21167 -3.06893,2.28385 -4.71045,5.56689 -4.85319,9.20678 l 0,0.57096 c 0,6.42333 3.71126,11.06241 11.06241,13.70311 l 0.28548,0.14274 c 2.71207,0.78508 8.9213,3.71126 9.13541,6.9943 l 0,0.28548 c 0,1.927 -0.78508,3.71126 -2.21248,5.13867 -1.49878,1.49877 -3.56852,2.28385 -6.06649,2.28385 l -0.35685,0 c -2.92618,-0.0714 -5.35278,-1.64152 -6.4947,-4.13948 -0.7137,-1.57015 -2.28385,-2.4266 -3.854,-2.4266 -0.57096,0 -1.14193,0.0714 -1.71289,0.35686 -1.57015,0.7137 -2.42659,2.21248 -2.42659,3.78262 0,0.57097 0.0714,1.2133 0.35685,1.78426 2.49796,5.35278 7.77937,8.77856 13.84585,8.99267 l 0.57096,0 c 4.71045,0 8.99267,-1.71289 12.13297,-4.85318 2.85481,-2.85482 4.49633,-6.78019 4.49633,-10.91967 l 0,-0.7137 c -0.42822,-9.84912 -12.84667,-13.84586 -14.98778,-14.48819 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Odin Rounded';-inkscape-font-specification:'Odin Rounded Bold';fill:#ffffff"
+ id="path4179" />
+ <path
+ d="m 352.74413,419.68144 c -0.7137,-0.4996 -1.57015,-0.78508 -2.35522,-0.78508 -1.35604,0 -2.6407,0.64234 -3.42578,1.78426 l -11.20515,15.91559 -11.13377,-15.91559 c -0.78508,-1.14192 -2.06974,-1.78426 -3.42578,-1.78426 -2.56934,0 -4.13948,2.21248 -4.13948,4.3536 0,0.85644 0.28548,1.57014 0.78507,2.21248 l 13.77448,19.69822 0,19.55548 c 0,2.28385 1.85563,4.13948 4.13948,4.13948 2.35523,0 4.21086,-1.85563 4.21086,-4.13948 l 0,-19.55548 13.77448,-19.69822 c 0.49959,-0.71371 0.78507,-1.57015 0.78507,-2.4266 0,-1.28466 -0.64233,-2.56933 -1.78426,-3.3544 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Odin Rounded';-inkscape-font-specification:'Odin Rounded Bold';fill:#ffffff"
+ id="path4181" />
+ <path
+ d="m 372.36541,437.73814 c -2.78344,-1.14193 -5.49552,-2.42659 -5.49552,-5.92374 l 0,-0.28548 c 0.0714,-2.56933 2.78345,-4.35359 6.2806,-4.35359 l 0.42822,0 c 1.28467,0.0714 2.71207,0.57096 3.78263,1.4274 0.78507,0.57097 1.64152,0.78508 2.49796,0.78508 1.28467,0 2.49796,-0.57097 3.35441,-1.64152 0.57096,-0.7137 0.85644,-1.64152 0.85644,-2.49796 0,-1.2133 -0.57096,-2.4266 -1.64152,-3.28304 -2.49796,-1.85563 -5.56688,-3.06893 -8.56444,-3.1403 l -0.64233,0 c -3.71126,0 -7.20841,1.2133 -9.77774,3.21167 -3.06893,2.28385 -4.71045,5.56689 -4.85319,9.20678 l 0,0.57096 c 0,6.42333 3.71126,11.06241 11.06241,13.70311 l 0.28548,0.14274 c 2.71207,0.78508 8.9213,3.71126 9.13541,6.9943 l 0,0.28548 c 0,1.927 -0.78508,3.71126 -2.21248,5.13867 -1.49878,1.49877 -3.56852,2.28385 -6.06649,2.28385 l -0.35685,0 c -2.92618,-0.0714 -5.35277,-1.64152 -6.4947,-4.13948 -0.7137,-1.57015 -2.28385,-2.4266 -3.854,-2.4266 -0.57096,0 -1.14193,0.0714 -1.71289,0.35686 -1.57015,0.7137 -2.42659,2.21248 -2.42659,3.78262 0,0.57097 0.0714,1.2133 0.35685,1.78426 2.49796,5.35278 7.77937,8.77856 13.84585,8.99267 l 0.57096,0 c 4.71045,0 8.99267,-1.71289 12.13297,-4.85318 2.85481,-2.85482 4.49633,-6.78019 4.49633,-10.91967 l 0,-0.7137 c -0.42822,-9.84912 -12.84667,-13.84586 -14.98778,-14.48819 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Odin Rounded';-inkscape-font-specification:'Odin Rounded Bold';fill:#ffffff"
+ id="path4183" />
+ <path
+ d="m 393.54457,418.89636 c -2.28385,0 -4.13948,1.85563 -4.13948,4.13948 0,2.35523 1.85563,4.21086 4.13948,4.21086 l 8.35034,0 0,37.46944 c 0,2.28385 1.85563,4.13948 4.13948,4.13948 2.28385,0 4.21085,-1.85563 4.21085,-4.13948 l 0,-37.46944 8.27896,0 c 2.28385,0 4.21085,-1.85563 4.21085,-4.21086 0,-2.28385 -1.927,-4.13948 -4.21085,-4.13948 l -24.97963,0 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Odin Rounded';-inkscape-font-specification:'Odin Rounded Bold';fill:#ffffff"
+ id="path4185" />
+ <path
+ d="m 455.48512,460.50529 -18.69904,0 0,-12.48982 14.55956,0 c 2.28385,0 4.13948,-1.85563 4.13948,-4.13948 0,-2.28385 -1.85563,-4.13948 -4.13948,-4.13948 l -14.55956,0 0,-12.48981 18.69904,0 c 2.35522,0 4.21085,-1.85563 4.21085,-4.21086 0,-2.28385 -1.85563,-4.13948 -4.21085,-4.13948 l -22.83852,0 c -2.35522,0 -4.21085,1.85563 -4.21085,4.13948 l 0,41.6803 c 0,2.28385 1.85563,4.13948 4.21085,4.13948 l 22.83852,0 c 2.35522,0 4.21085,-1.85563 4.21085,-4.13948 0,-2.35522 -1.85563,-4.21085 -4.21085,-4.21085 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Odin Rounded';-inkscape-font-specification:'Odin Rounded Bold';fill:#ffffff"
+ id="path4187" />
+ <path
+ d="m 506.98443,468.85562 c 2.35522,0 4.21085,-1.85563 4.21085,-4.13948 l 0,-41.6803 c 0,-2.21248 -1.78426,-4.13948 -4.21085,-4.13948 -1.28467,0 -2.49796,0.57097 -3.28304,1.64152 l -15.416,20.55467 -15.416,-20.55467 c -0.78507,-1.07055 -1.99837,-1.64152 -3.28303,-1.64152 -2.4266,0 -4.21085,1.927 -4.21085,4.13948 l 0,41.6803 c 0,2.28385 1.85563,4.13948 4.13948,4.13948 2.35522,0 4.21085,-1.85563 4.21085,-4.13948 l 0,-29.19048 11.20515,14.98778 c 0.78507,1.07055 2.06974,1.71289 3.3544,1.71289 1.28467,0 2.56934,-0.64234 3.35441,-1.71289 l 11.20515,-14.98778 0,29.19048 c 0,2.28385 1.85563,4.13948 4.13948,4.13948 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Odin Rounded';-inkscape-font-specification:'Odin Rounded Bold';fill:#ffffff"
+ id="path4189" />
+ </g>
+ </g>
+ <rect
+ style="fill:#80da78;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.41176471"
+ id="rect3373"
+ width="27.054323"
+ height="23.25345"
+ x="233.83051"
+ y="448.12085"
+ transform="matrix(0.83326186,-0.55287854,0.17119765,0.98523671,0,0)" />
+ <rect
+ style="fill:#80da78;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.41176471"
+ id="rect3373-6"
+ width="23.593664"
+ height="20.27898"
+ x="-319.67874"
+ y="113.69249"
+ transform="matrix(-0.79898201,-0.60135493,-0.22936588,0.97334028,0,0)" />
+ <rect
+ style="fill:#80da78;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.41176471"
+ id="rect3413"
+ width="29.7995"
+ height="29.7995"
+ x="278.31131"
+ y="313.30594"
+ transform="matrix(0.99014541,0.14004311,-0.14004311,0.99014541,0,0)" />
+ </g>
+ </g>
+ </g>
+</svg>
diff --git a/src/main/address-cache.js b/src/main/address-cache.js
new file mode 100644
index 0000000..3b51e25
--- /dev/null
+++ b/src/main/address-cache.js
@@ -0,0 +1,85 @@
+const EventEmitter = require('events').EventEmitter
+const Address = require('./address')
+const level = require('level-rocksdb')
+const collect = require('collect-stream')
+const getSize = require('get-folder-size')
+const pth = require('path')
+const _path = new WeakMap()
+const _db = new WeakMap()
+const _size = new WeakMap()
+
+module.exports = class AddressCache extends EventEmitter {
+ constructor (path) {
+ super()
+ if (!path || typeof path !== 'string') {
+ throw new TypeError('Invalid path')
+ }
+ pth.join(path, '.address-cache')
+ _path.set(this, path)
+ let db = level(path)
+ _db.set(this, db)
+ this.dirty = true
+ }
+ set dirty (value) {
+ let path = _path.get(this)
+ getSize(path, (err, size) => {
+ if (err) {
+ return _size.set(this, 0)
+ }
+ _size.set(this, size)
+ this.emit('capacity', this.capacity)
+ if (this.full) {
+ this.emit('full')
+ }
+ })
+ }
+
+ put (address, cb) {
+ if (!(address instanceof Address)) {
+ return cb()
+ }
+ let db = _db.get(this)
+ db.put(address.key, address.value, cb)
+ this.dirty = true
+ }
+
+ get (key, cb) {
+ if (typeof key !== 'string') {
+ return cb(new Error('Invalid Key'))
+ }
+ let db = _db.get(this)
+ db.get(key, (err, value) => {
+ if (err) {
+ return cb(err)
+ }
+ let address
+ try {
+ address = Address({key, value})
+ } catch (ex) {
+ return cb(ex)
+ }
+ return cb(null, address)
+ })
+ }
+ remove (key, cb) {
+ if (typeof key !== 'string') {
+ return cb(new Error('Invalid Key'))
+ }
+ let db = _db.get(this)
+ db.del(key, cb)
+ this.dirty = true
+ }
+ contains (key, cb) {
+ this.get(key, (err, value) => {
+ if (err || !value) {
+ return cb(err, false)
+ }
+ return cb(err, true)
+ })
+ }
+ contents (cb) {
+ let db = _db.get(this)
+ let rs = db.createKeyStream()
+ collect(rs, cb)
+ }
+}
diff --git a/src/main/address.js b/src/main/address.js
new file mode 100644
index 0000000..0039cd7
--- /dev/null
+++ b/src/main/address.js
@@ -0,0 +1,43 @@
+const util = require('../utility')
+let _key = new WeakMap()
+let _value = new WeakMap()
+module.exports = class Address {
+ constructor (options) {
+ if (options) {
+ if (!options.key || typeof options.key !== 'string' || !util.isAddress(options.key)) {
+ throw new TypeError('Invalid Key')
+ } else {
+ _key.set(this, options.key)
+ }
+ if (!options.value || typeof options.value !== 'string' || (!util.isMutable(options.value) && !util.isRecord(options.value))) {
+ throw new TypeError('Invalid Value')
+ } else {
+ _value.set(this, options.value)
+ }
+ }
+ }
+ get key () {
+ return _key.get(this)
+ }
+ set key (value) {
+ if (typeof value !== 'string' || !util.isAddress(value)) {
+ throw new TypeError('Invalid Key')
+ }
+ _key.set(this, value)
+ }
+ get value () {
+ return _value.get(this)
+ }
+ set value (value) {
+ if (typeof value !== 'string' || (!util.isMutable(value) && !util.isRecord(value))) {
+ throw new TypeError('Invalid Value')
+ }
+ _value.set(this, value)
+ }
+ get isMutable () {
+ return util.isMutable(this.value)
+ }
+ get isRecord () {
+ return util.isRecord(this.value)
+ }
+}
diff --git a/src/main/mutable-cache.js b/src/main/mutable-cache.js
index c5bf7df..338811d 100644
--- a/src/main/mutable-cache.js
+++ b/src/main/mutable-cache.js
@@ -35,7 +35,7 @@ module.exports = class MutableCache extends EventEmitter {
}
put (mutable, cb) {
- if (!(mutable instanceof mutable)) {
+ if (!(mutable instanceof Mutable)) {
return cb()
}
let db = _db.get(this)
@@ -72,9 +72,9 @@ module.exports = class MutableCache extends EventEmitter {
contains (key, cb) {
this.get(key, (err, value) => {
if (err || !value) {
- return cb(null, false)
+ return cb(err, false)
}
- return cb(null, true)
+ return cb(err, true)
})
}
contents (cb) {
diff --git a/src/main/mutable.js b/src/main/mutable.js
index 2e96ddd..d7827ed 100644
--- a/src/main/mutable.js
+++ b/src/main/mutable.js
@@ -27,7 +27,7 @@ module.exports = class Mutable {
return key
} else {
let pubKey = _pubKey.get(this)
- key = base58.encode(pubKey)
+ key = `${base58.encode(util.hash(pubKey))}I`
_key.set(this, key)
return key
}
@@ -56,7 +56,7 @@ module.exports = class Mutable {
throw new TypeError('Invalid Private Key')
}
// TODO: Validation of contents
- _contents.set(this, util.privateEncrypt(contents, privKey))
+ _contents.set(this, util.privateEncrypt(value, privKey))
}
toString () {
let pubKey = _pubKey.get(this)
diff --git a/src/main/name-router.js b/src/main/name-router.js
index 5086fcb..7dd8c0a 100644
--- a/src/main/name-router.js
+++ b/src/main/name-router.js
@@ -1,4 +1,22 @@
-
-module.exports = class NameRouter{
- constructor ()
-} \ No newline at end of file
+const MutableCache = require('./mutable-cache')
+const RecordCache = require('./record-cache')
+const AddressCache = require('./address-cache')
+let _mutableCache = new WeakMap()
+let _recordCache = new WeakMap()
+let _addressCache = new WeakMap()
+module.exports = class NameRouter {
+ constructor (path) {
+ _mutableCache.set(this, new MutableCache(path))
+ _recordCache.set(this, new RecordCache(path))
+ _addressCache.set(this, new AddressCache(path))
+ }
+ get mutlableCache () {
+ return _mutableCache.get(this)
+ }
+ get recordCache () {
+ return _recordCache.get(this)
+ }
+ get addressCache () {
+ return _addressCache.get(this)
+ }
+}
diff --git a/src/main/record-cache.js b/src/main/record-cache.js
index 4a7e56c..f2516f5 100644
--- a/src/main/record-cache.js
+++ b/src/main/record-cache.js
@@ -74,9 +74,9 @@ module.exports = class RecordCache extends EventEmitter {
contains (key, cb) {
this.get(key, (err, value) => {
if (err || !value) {
- return cb(null, false)
+ return cb(err, false)
}
- return cb(null, true)
+ return cb(err, true)
})
}
contents (cb) {
diff --git a/src/main/record.js b/src/main/record.js
index ce4514b..808eda0 100644
--- a/src/main/record.js
+++ b/src/main/record.js
@@ -8,7 +8,7 @@ module.exports = class Record {
constructor (options) {
if (options instanceof OffUrl) {
let offUrl = options
- let key = base58.encode(util.hash(offUrl.hash))
+ let key = `${base58.encode(util.hash(offUrl.hash))}O`
_key.set(this, key)
_offUrl.set(this, offUrl)
let value = util.encrypt(offUrl.toString(), offUrl.hash)
diff --git a/src/main/server.js b/src/main/server.js
index cbdc7a7..f0e5417 100644
--- a/src/main/server.js
+++ b/src/main/server.js
@@ -1,17 +1,17 @@
const express = require('express')
-module.exports = function () {
+module.exports = function (nr) {
let ons = express()
- ons.get(/([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)\/([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)O\/{0,1}([^ !$`&*()+]*|\\[ !$`&*()+]*)*/,
- (req, res) => {
-
+ ons.get(/([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)\/([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+O)\/{0,1}([^ !$`&*()+]*|\\[ !$`&*()+]*)*/,
+ (req, res) => { // Reqest for a Record
+ let key = req.params[20]
})
- ons.get(/([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)\/([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)I\/{0,1}([^ !$`&*()+]*|\\[ !$`&*()+]*)*/,
- (req, res) => {
-
+ ons.get(/([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)\/([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+I)\/{0,1}([^ !$`&*()+]*|\\[ !$`&*()+]*)*/,
+ (req, res) => {// Request for a Mutable
+ let key = req.params[20]
})
ons.get(/([\da-zA-Z]+)\/{0,1}([^ !$`&*()+]*|\\[ !$`&*()+]*)*/,
- (req, res) => {
-
+ (req, res) => { // Request for and Address
+ let address = req.params[20]
})
ons.put('/', (req, res) => {
diff --git a/src/utility.js b/src/utility.js
index 0f30007..f819d32 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -34,4 +34,13 @@ util.isKeyPair = (pubKey, privKey) => {
let key = curve.getPublicKey()
return key.equals(pubKey)
}
+util.isMutable = (text) => {
+ return /([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)\/([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+I)\/{0,1}([^ !$`&*()+]*|\\[ !$`&*()+]*)*/.test(text)
+}
+util.isRecord = (text) => {
+ return /([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)\/([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+O)\/{0,1}([^ !$`&*()+]*|\\[ !$`&*()+]*)*/.test(text)
+}
+util.isAddress = (text) => {
+ return /([\da-zA-Z]+)/.test(text)
+}
module.exports = util