├── src ├── pages │ ├── disconnect.html │ ├── support.html │ ├── import.html │ ├── network.html │ ├── termsOfUse.html │ ├── disconnect.ts │ ├── termsOfUse.ts │ ├── privacyPolicy.ts │ ├── support.ts │ ├── donate.ts │ ├── import.ts │ ├── changeWalletPassword.html │ ├── importFromFile.html │ ├── export.html │ ├── donate.html │ ├── importFromMnemonic.html │ ├── receive.html │ ├── importFromQr.html │ ├── index.html │ ├── network.ts │ ├── send.html │ ├── importFromKeys.html │ ├── account.html │ ├── settings.html │ └── index.ts ├── d │ ├── kjua.d.ts │ ├── jsPDF.d.ts │ ├── JSBigInt.d.ts │ ├── cnBase58.d.ts │ ├── workbox.d.ts │ ├── jquery.d.ts │ ├── FileSaver.d.ts │ ├── TextDecoder.d.ts │ ├── workers.d.ts │ ├── native.d.ts │ ├── vue-i118n.ts │ ├── sweetalert2.d.ts │ ├── Vue.ts │ ├── nacl.d.ts │ ├── config.d.ts │ ├── nativeAppVersion.d.ts │ ├── nativeQrScanner.d.ts │ └── nativeNativeStorage.d.ts ├── assets │ ├── img │ │ ├── logo.png │ │ ├── favicon.icns │ │ ├── favicon.ico │ │ ├── logoQrCode.png │ │ ├── logo_white.png │ │ ├── Masari_Vertical.png │ │ ├── icons │ │ │ ├── icon-128x128.png │ │ │ ├── icon-144x144.png │ │ │ ├── icon-152x152.png │ │ │ ├── icon-192x192.png │ │ │ ├── icon-256x256.png │ │ │ └── icon-402x402.png │ │ └── landing │ │ │ └── 75-usersthink-stock-image.jpg │ └── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 ├── manifest.json ├── workers │ ├── TransferProcessingEntrypoint.ts │ └── TransferProcessing.ts ├── lib │ ├── nacl-util.min.js │ ├── numbersLab │ │ ├── Context.ts │ │ ├── DestructableView.ts │ │ └── Observable.ts │ └── FileSaver.min.js ├── model │ ├── Constants.ts │ ├── Currency.ts │ ├── KeysRepository.ts │ ├── MathUtil.ts │ ├── Password.ts │ ├── blockchain │ │ └── BlockchainExplorer.ts │ └── Translations.ts ├── api.ts ├── config.ts ├── service-worker-raw.ts ├── api.html ├── providers │ └── BlockchainExplorerProvider.ts ├── filters │ └── Filters.ts └── utils │ └── Url.ts ├── src_native ├── html_template │ └── shell_minimal.html ├── blake.o ├── hash.o ├── main.o ├── groestl.o ├── keccak.o ├── crypto-ops.o ├── crypto-ops-data.o ├── jh_ansi_opt64.o ├── blake.h ├── groestl.h ├── jh.h ├── keccak.h ├── Makefile ├── license.txt ├── common │ ├── stack_trace.h │ ├── common_fwd.h │ ├── updates.h │ ├── pod-class.h │ ├── i18n.h │ ├── base58.h │ ├── json_util.h │ ├── download.h │ ├── http_connection.h │ ├── apply_permutation.h │ ├── threadpool.h │ ├── CMakeLists.txt │ ├── command_line.cpp │ ├── perf_timer.h │ └── password.h ├── hash.c ├── generic-ops.h ├── main.c ├── hash-ops.h ├── hash.h └── keccak.c ├── src_api ├── json_rpc.php ├── gettransactions_by_heights.php ├── config.php ├── sendrawtransaction.php └── get_transaction_pool.php ├── docker ├── Webserver.dockerfile ├── Webserver-php.dockerfile ├── php.ini ├── docker-compose-example.yml └── nginx.conf ├── .gitignore ├── tsconfig.json ├── tsconfig.prod.json ├── package.json ├── TRANSLATIONS.md ├── .gitlab-ci.yml ├── LICENSE ├── utils └── mnemonic.php ├── Deploy.md ├── debug-router.php ├── src_client_api ├── index.html └── api.js └── README.md /src/pages/disconnect.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/d/kjua.d.ts: -------------------------------------------------------------------------------- 1 | declare var kjua : any; -------------------------------------------------------------------------------- /src/d/jsPDF.d.ts: -------------------------------------------------------------------------------- 1 | declare var jsPDF : any; -------------------------------------------------------------------------------- /src/d/JSBigInt.d.ts: -------------------------------------------------------------------------------- 1 | declare var JSBigInt : any; -------------------------------------------------------------------------------- /src/d/cnBase58.d.ts: -------------------------------------------------------------------------------- 1 | declare var cnBase58 : any; -------------------------------------------------------------------------------- /src/d/workbox.d.ts: -------------------------------------------------------------------------------- 1 | declare var workbox : any; -------------------------------------------------------------------------------- /src_native/html_template/shell_minimal.html: -------------------------------------------------------------------------------- 1 | {{{ SCRIPT }}} -------------------------------------------------------------------------------- /src/d/jquery.d.ts: -------------------------------------------------------------------------------- 1 | declare var $ : any; 2 | declare var jQuery : any; -------------------------------------------------------------------------------- /src/d/FileSaver.d.ts: -------------------------------------------------------------------------------- 1 | declare function saveAs(block : any, filename:string) : void; -------------------------------------------------------------------------------- /src/d/TextDecoder.d.ts: -------------------------------------------------------------------------------- 1 | // declare var TextEncoder : any; 2 | // declare var TextDecoder : any; -------------------------------------------------------------------------------- /src_api/json_rpc.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | extern void jh(unsigned bit_len, const uint8_t input[], 10 | size_t input_bit_length, uint8_t output[]); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /docker/Webserver-php.dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.2-fpm-alpine 2 | 3 | RUN set -ex && docker-php-ext-install opcache 4 | 5 | WORKDIR /var/www/html 6 | ADD ./docker/php.ini /usr/local/etc/php/conf.d/zz.ini 7 | ADD ./src_api/ . 8 | RUN chown -R www-data /var/www/html 9 | 10 | RUN mkdir /cache && chmod 777 /cache 11 | VOLUME /cache -------------------------------------------------------------------------------- /src/d/vue-i118n.ts: -------------------------------------------------------------------------------- 1 | declare class VueI18n { 2 | constructor(params: { 3 | locale?: string, 4 | fallbackLocale?:string 5 | }); 6 | 7 | locale : string; 8 | 9 | setLocaleMessage(lang : string, data : any) : void; 10 | setDateTimeFormat(lang : string, data : any) : void; 11 | setNumberFormat(lang : string, data : any) : void; 12 | 13 | t(key : string, variables ?: any) : string; 14 | } 15 | 16 | declare var i18n : VueI18n; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "masariwebwallet", 3 | "version": "1.0.0", 4 | "description": "Fully client side web wallet for masari", 5 | "main": "index.js", 6 | "dependencies": { 7 | "typescript": "^2.9.2", 8 | "workbox-build": "^3.3.0" 9 | }, 10 | "devDependencies": {}, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/gnock/masari-webwallet.git" 14 | }, 15 | "author": "Gnock", 16 | "license": "BSD-3", 17 | "bugs": { 18 | "url": "https://github.com/gnock/masari-webwallet/issues" 19 | }, 20 | "homepage": "https://github.com/gnock/masari-webwallet#readme" 21 | } 22 | -------------------------------------------------------------------------------- /src/d/sweetalert2.d.ts: -------------------------------------------------------------------------------- 1 | declare function swal(params : { 2 | type?:'success'|'error'|'info'|'warning', 3 | title:string, 4 | text?:string, 5 | input?:'text'|'password'|'email'|'select', 6 | html?:string, 7 | showCancelButton?:boolean, 8 | confirmButtonText?:string, 9 | focusConfirm?:boolean, 10 | preConfirm?:Function 11 | onOpen?:Function, 12 | onClose?:Function, 13 | inputOptions?:Map|any, 14 | reverseButtons?:boolean, 15 | cancelButtonText?:string, 16 | }) : Promise; 17 | 18 | declare namespace swal{ 19 | function showLoading() : void; 20 | function hideLoading() : void; 21 | function close() : void; 22 | } 23 | -------------------------------------------------------------------------------- /src_native/keccak.h: -------------------------------------------------------------------------------- 1 | // keccak.h 2 | // 19-Nov-11 Markku-Juhani O. Saarinen 3 | 4 | #ifndef KECCAK_H 5 | #define KECCAK_H 6 | 7 | #include 8 | #include 9 | 10 | #ifndef KECCAK_ROUNDS 11 | #define KECCAK_ROUNDS 24 12 | #endif 13 | 14 | #ifndef ROTL64 15 | #define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y)))) 16 | #endif 17 | 18 | // compute a keccak hash (md) of given byte length from "in" 19 | void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen); 20 | 21 | // update the state 22 | void keccakf(uint64_t st[25], int norounds); 23 | 24 | void keccak1600(const uint8_t *in, size_t inlen, uint8_t *md); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/d/Vue.ts: -------------------------------------------------------------------------------- 1 | type VueConstructObject = {el:string,data:any, watch?:any, computed?:any, updated?:any, mounted?:any, methods?:any, i18n?:any}; 2 | type VueComponentObject = { 3 | template:string, 4 | props?:Array, 5 | data?:Function, 6 | computed:any 7 | } 8 | 9 | 10 | // declare var Vue : any; 11 | class Vue{ 12 | constructor(any : VueConstructObject|string|null){} 13 | 14 | $nextTick(callback : Function){} 15 | $forceUpdate(){} 16 | 17 | static component(componentName : string, data : VueComponentObject) : void{} 18 | static filter(name : string, callback : Function) : void{} 19 | 20 | static options : { 21 | components:any, 22 | filters:any 23 | }; 24 | } -------------------------------------------------------------------------------- /docker/php.ini: -------------------------------------------------------------------------------- 1 | output_buffering = 4096 2 | short_open_tag = Off 3 | precision = 14 4 | zend.enable_gc = On 5 | max_execution_time = 30 6 | max_input_time = 60 7 | memory_limit = 128M 8 | post_max_size = 10M 9 | 10 | display_errors = off 11 | error_reporting = E_ALL ^ E_NOTICE ^ E_WARNING 12 | expose_php = off 13 | zend.assertions = -1 14 | 15 | opcache.enable=1 16 | opcache.enable_cli=1 17 | opcache.revalidate_freq=0 18 | opcache.validate_timestamps=0 19 | opcache.max_accelerated_files=20000 20 | opcache.memory_consumption=192 21 | opcache.interned_strings_buffer=16 22 | opcache.fast_shutdown=1 23 | opcache.file_update_protection=0 24 | 25 | ping.path = /ping 26 | ping.response = pong -------------------------------------------------------------------------------- /src/d/nacl.d.ts: -------------------------------------------------------------------------------- 1 | declare var nacl : { 2 | ll:{ 3 | ge_scalarmult:(a : Uint8Array, b : Uint8Array)=>Uint8Array, 4 | ge_double_scalarmult_base_vartime:(a : Uint8Array, b : Uint8Array, c : Uint8Array)=>Uint8Array, 5 | ge_double_scalarmult_postcomp_vartime:(a : Uint8Array, b : Uint8Array, c : Uint8Array, d : Uint8Array)=>Uint8Array, 6 | ge_add:(a : Uint8Array, b : Uint8Array)=>Uint8Array, 7 | ge_scalarmult_base:(a : Uint8Array)=>Uint8Array 8 | }, 9 | secretbox:any, 10 | //open:(encrypted:Uint8Array, nonce:Uint8Array, privKey:Uint8Array)=>Uint8Array; 11 | util:{ 12 | encodeBase64:(value : Uint8Array)=>string, 13 | }, 14 | randomBytes:(bits : number) => Uint8Array 15 | }; 16 | 17 | declare function keccak_256(bin : Uint8Array) : string; -------------------------------------------------------------------------------- /src/pages/support.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | {{ $t("supportPage.title") }} 5 |
6 |
7 | {{ $t("supportPage.subtitle") }} 8 |
9 |
10 |
11 |
12 |
13 |
{{ $t("supportPage.getInTouchBlock.title") }}
14 |
15 | {{ $t("supportPage.getInTouchBlock.content") }}
16 |

{{ $t("supportPage.getInTouchBlock.discord") }}

17 |
18 |
19 |
20 |
21 |
-------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Masari Web Wallet", 3 | "short_name": "Masari", 4 | "icons": [{ 5 | "src": "assets/img/icons/icon-128x128.png", 6 | "sizes": "128x128", 7 | "type": "image/png" 8 | }, { 9 | "src": "assets/img/icons/icon-144x144.png", 10 | "sizes": "144x144", 11 | "type": "image/png" 12 | }, { 13 | "src": "assets/img/icons/icon-152x152.png", 14 | "sizes": "152x152", 15 | "type": "image/png" 16 | }, { 17 | "src": "assets/img/icons/icon-192x192.png", 18 | "sizes": "192x192", 19 | "type": "image/png" 20 | }, { 21 | "src": "assets/img/icons/icon-256x256.png", 22 | "sizes": "256x256", 23 | "type": "image/png" 24 | }], 25 | "start_url": "/index.html", 26 | "display": "standalone", 27 | "background_color": "#658289", 28 | "theme_color": "#4cb860" 29 | } -------------------------------------------------------------------------------- /src/workers/TransferProcessingEntrypoint.ts: -------------------------------------------------------------------------------- 1 | importScripts('../lib/polyfills/core.min.js'); 2 | importScripts('../lib/polyfills/textEncoding/encoding-indexes.js'); 3 | importScripts('../lib/polyfills/textEncoding/encoding.js'); 4 | importScripts('../lib/polyfills/crypto.js'); 5 | 6 | importScripts('../lib/require.js'); 7 | importScripts('../lib/biginteger.js'); 8 | importScripts('../config.js'); 9 | importScripts('../lib/base58.js'); 10 | importScripts('../lib/crypto.js'); 11 | importScripts('../lib/nacl-fast.js'); 12 | importScripts('../lib/nacl-util.min.js'); 13 | importScripts('../lib/sha3.js'); 14 | 15 | try { 16 | importScripts('../lib/cn_utils_native.js'); 17 | (self).Module_native['onRuntimeInitialized'] = function () { 18 | require(['./TransferProcessing.js'], function (App) {}); 19 | }; 20 | }catch(e){ 21 | //TODO send error 22 | } -------------------------------------------------------------------------------- /src/pages/import.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | {{ $t("importPage.title") }} 5 |
6 |
7 | {{ $t("importPage.subtitle") }} 8 |
9 |
10 |
11 |
12 | 21 |
22 |
23 |
-------------------------------------------------------------------------------- /src_native/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = prog 2 | LIBS = -lm 3 | CC = em++ -O3 -s SINGLE_FILE=1 -s NO_FILESYSTEM=1 -s 'EXTRA_EXPORTED_RUNTIME_METHODS=["ccall", "cwrap"]' --llvm-lto 1 -s TOTAL_MEMORY=67108864 -s WASM=1 -s "BINARYEN_TRAP_MODE='allow'" -s EXPORTED_FUNCTIONS="['_generate_key_derivation', '_derive_public_key']" -s ASSERTIONS=1 --shell-file html_template/shell_minimal.html 4 | CFLAGS = -Wall -msse2 5 | 6 | 7 | # SINGLE_FILE=1 8 | 9 | # -s ASSERTIONS=1 10 | # -s SINGLE_FILE=1 11 | .PHONY: default all clean 12 | 13 | default: $(TARGET) 14 | all: default 15 | 16 | OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c)) 17 | HEADERS = $(wildcard *.h) 18 | 19 | %.o: %.c $(HEADERS) $(CC) $(CFLAGS) -c $< -o $@ 20 | 21 | .PRECIOUS: $(TARGET) $(OBJECTS) 22 | 23 | $(TARGET): $(OBJECTS) 24 | $(CC) $(OBJECTS) -Wall $(LIBS) -o cn.html 25 | 26 | clean: 27 | -rm -f *.o 28 | -rm -f $(TARGET) 29 | -------------------------------------------------------------------------------- /src/lib/nacl-util.min.js: -------------------------------------------------------------------------------- 1 | !function(e,n){"use strict";"undefined"!=typeof module&&module.exports?module.exports=n():e.nacl?e.nacl.util=n():(e.nacl={},e.nacl.util=n())}(this,function(){"use strict";var e={};return e.decodeUTF8=function(e){var n,t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length);for(n=0;nn;n++)t.push(String.fromCharCode(e[n]));return btoa(t.join(""))},e.decodeBase64=function(e){if("undefined"==typeof atob)return new Uint8Array(Array.prototype.slice.call(new Buffer(e,"base64"),0));var n,t=atob(e),r=new Uint8Array(t.length);for(n=0;n 2 |
3 |
4 | {{ $t("networkPage.title") }} 5 |
6 |
7 | {{ $t("networkPage.subtitle") }} 8 |
9 |
10 |
11 |
12 |
13 |
14 |
{{ $t("networkPage.statsBlock.hashrate") }}: {{ networkHashrate | hashrate }}
15 |
{{ $t("networkPage.statsBlock.height") }}: {{blockchainHeight}}
16 |
{{ $t("networkPage.statsBlock.difficulty") }}: {{networkDifficulty}}
17 |
{{ $t("networkPage.statsBlock.lastTimeBlock") }}: {{ $d(new Date(lastBlockFound*1000), 'long')}}
18 |
{{ $t("networkPage.statsBlock.lastReward") }}: {{lastReward}} MSR
19 |
20 |
21 |
22 |
23 | -------------------------------------------------------------------------------- /src_api/config.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | {{ $t("termsOfUsePage.title") }} 5 |
6 |
7 | {{ $t("termsOfUsePage.subtitle") }} 8 |
9 |
10 |
11 |
12 |
13 |
14 | English version:
15 | It is understood that interactions with The Masari Project's web wallet are entirely client-side.
16 | The Masari Project has no control or access to your wallet's private keys, nor do they have the ability to recover your funds in any event of loss.
17 | In all circumstances, The Masari Project, Masari promoters, or any entity affiliated with the Masari Project will not be liable for loss or misuse of funds held using the aforementioned wallet.
18 | Users also understand and agree that they are solely responsible for providing a secure environment to interact with the Masari Project's web wallet.
19 | Additionally, The Masari Project cannot, and will not, be held liable for use of funds originating from or arriving to a web wallet.
20 | By creating, importing, or interacting with a wallet on this website, you implicitly agree to these terms, and absolve the website owners and affiliates of any and all liability.
21 |
22 | Privacy policy (EN) 23 |
24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /src/d/nativeAppVersion.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, gnock 4 | Copyright (c) 2018, The Masari Project 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name of the copyright holder nor the names of its 18 | contributors may be used to endorse or promote products derived from 19 | this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 25 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /src/model/Constants.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | export class Constants{ 17 | static BLOCKCHAIN_EXPLORER = 'blockchainExplorer'; 18 | } -------------------------------------------------------------------------------- /src_api/sendrawtransaction.php: -------------------------------------------------------------------------------- 1 | { 21 | return Storage.getItem('user-currency', 'usd'); 22 | } 23 | 24 | static setBrowserCurrency(currency: string) { 25 | Storage.setItem('user-currency', currency); 26 | } 27 | } -------------------------------------------------------------------------------- /src/d/nativeQrScanner.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | declare interface NativeQrScanner{ 17 | scan(callback : (err : {name:string}|undefined|null,result : string) => void) : void; 18 | cancelScan(callback : (status : any) => void) : void; 19 | show() : void; 20 | hide() : void; 21 | } 22 | 23 | interface Window { 24 | QRScanner?:NativeQrScanner 25 | } 26 | -------------------------------------------------------------------------------- /utils/mnemonic.php: -------------------------------------------------------------------------------- 1 | 33 | 34 | namespace tools 35 | { 36 | 37 | void set_stack_trace_log(const std::string &log); 38 | void log_stack_trace(const char *msg); 39 | 40 | } // namespace tools 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src_native/common/common_fwd.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | // 29 | // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers 30 | 31 | #pragma once 32 | 33 | namespace tools 34 | { 35 | class DNSResolver; 36 | struct login; 37 | class password_container; 38 | class t_http_connection; 39 | class threadpool; 40 | } 41 | -------------------------------------------------------------------------------- /Deploy.md: -------------------------------------------------------------------------------- 1 | # How to compile & Deploy 2 | The project is using Typescript as main language and not other dependencies on external libraries (everything is already included). 3 | 4 | # Compilation 5 | The first step will be to compile the typescript code into javascript code so browsers will be able to understand it. 6 | You also need to build some files that are dynamically generated like the manifest ... 7 | This task is doable with : 8 | ``` 9 | npm install 10 | nodejs ./node_modules/typescript/bin/tsc --project tsconfig.prod.json 11 | nodejs build.js 12 | ``` 13 | The first task install dependencies (typescript) and the text one compile the typescript code. 14 | We are using a custom tsconfig file which is optimized for production. 15 | 16 | # Change configuration 17 | You will have to edit the file src/config.js in order to change the API endpoint. 18 | The default value use the same domain appended by /api/ 19 | 20 | That's all 21 | 22 | # Deploy 23 | All the content of the src directory needs to be exposed with a web-server. 24 | You will also need to expose the content of the src_api content to an endpoint which can interpret PHP. 25 | By default the configuration looks at domainname.com/api/ 26 | 27 | 28 | # Permissions 29 | The API stores precomputed data for performances in a directory called cache/ in the same directory of the API code (PHP code). 30 | You will need to create this directory with the write permissions. 31 | 32 | # Cron task / Process 33 | Precomputed data are build by another process. This process will call the Masari daemon and compute blocks into chunks of blocks to reduce network latency. 34 | In order to do so, you will need to run the file blockchain.php with an environment variable "export=true". 35 | This file will shut down after 1h, and has a anti-concurrency mechanism built in. 36 | 37 | One way to handle this is by running a cron task each minute with something like: 38 | ``` 39 | * * * * * root cd /var/www/domain.com/api && export generate=true && php blockchain.php 40 | ``` -------------------------------------------------------------------------------- /debug-router.php: -------------------------------------------------------------------------------- 1 | } return true if continue to redirect, false to cancel redirection 31 | */ 32 | destruct() : Promise{ 33 | return Promise.resolve(); 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src_native/common/updates.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #pragma once 30 | 31 | #include 32 | 33 | namespace tools 34 | { 35 | bool check_updates(const std::string &software, const std::string &buildtag, std::string &version, std::string &hash); 36 | std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version, bool user); 37 | } 38 | -------------------------------------------------------------------------------- /src/workers/TransferProcessing.ts: -------------------------------------------------------------------------------- 1 | import {TransactionsExplorer} from "../model/TransactionsExplorer"; 2 | import {Wallet, WalletOptions} from "../model/Wallet"; 3 | import {Mnemonic} from "../model/Mnemonic"; 4 | import {Transaction} from "../model/Transaction"; 5 | import {RawDaemon_Transaction} from "../model/blockchain/BlockchainExplorer"; 6 | 7 | //bridge for cnUtil with the new mnemonic class 8 | (self).mn_random = Mnemonic.mn_random; 9 | (self).mn_decode = Mnemonic.mn_decode; 10 | (self).mn_encode = Mnemonic.mn_encode; 11 | 12 | let currentWallet : Wallet|null = null; 13 | 14 | onmessage = function(data : MessageEvent){ 15 | // if(data.isTrusted){ 16 | let event : any = data.data; 17 | if(event.type === 'initWallet'){ 18 | currentWallet = Wallet.loadFromRaw(event.wallet); 19 | postMessage('readyWallet'); 20 | }else if (event.type === 'process'){ 21 | if(typeof event.wallet !== 'undefined'){ 22 | currentWallet = Wallet.loadFromRaw(event.wallet); 23 | } 24 | 25 | if(currentWallet === null){ 26 | postMessage('missing_wallet'); 27 | return; 28 | } 29 | 30 | let readMinersTx = typeof currentWallet.options.checkMinerTx !== 'undefined' && currentWallet.options.checkMinerTx; 31 | 32 | let rawTransactions : RawDaemon_Transaction[] = event.transactions; 33 | let transactions : any[] = []; 34 | for(let rawTransaction of rawTransactions){ 35 | if(!readMinersTx && TransactionsExplorer.isMinerTx(rawTransaction)) { 36 | continue; 37 | } 38 | 39 | let transaction = TransactionsExplorer.parse(rawTransaction, currentWallet); 40 | if(transaction !== null){ 41 | currentWallet.addNew(transaction); 42 | transactions.push(transaction.export()); 43 | } 44 | } 45 | 46 | postMessage({ 47 | type:'processed', 48 | transactions:transactions 49 | }); 50 | } 51 | // let transaction = TransactionsExplorer.parse(rawTransaction, height, this.wallet); 52 | // }else { 53 | // console.warn('Non trusted data', data.data, JSON.stringify(data.data)); 54 | // } 55 | }; 56 | 57 | postMessage('ready'); -------------------------------------------------------------------------------- /src_native/common/pod-class.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | // 29 | // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers 30 | 31 | #pragma once 32 | 33 | // FIXME: Why is this ifdef needed? Hopefully making it struct won't break things. 34 | 35 | /* 36 | #if defined(_MSC_VER) 37 | #define POD_CLASS struct 38 | #else 39 | #define POD_CLASS class 40 | #endif 41 | */ 42 | 43 | #define POD_CLASS struct 44 | -------------------------------------------------------------------------------- /docker/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | client_max_body_size 5M; 4 | 5 | root /var/www/html/; 6 | index index.html index.php index.htm; 7 | 8 | location / { 9 | try_files $uri $uri/ /index.php?$args; 10 | } 11 | 12 | location /api { 13 | alias /var/www/html; 14 | index index.html index.php; 15 | location ~ \.php$ { 16 | fastcgi_split_path_info ^(.+?\.php)(/.*)$; 17 | # Mitigate https://httpoxy.org/ vulnerabilities 18 | fastcgi_param HTTP_PROXY ""; 19 | fastcgi_param QUERY_STRING $query_string; 20 | fastcgi_param REQUEST_METHOD $request_method; 21 | fastcgi_param CONTENT_TYPE $content_type; 22 | fastcgi_param CONTENT_LENGTH $content_length; 23 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 24 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 25 | fastcgi_param PATH_INFO $fastcgi_path_info; 26 | fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 27 | fastcgi_param REQUEST_URI $request_uri; 28 | fastcgi_param DOCUMENT_URI $document_uri; 29 | fastcgi_param DOCUMENT_ROOT $document_root; 30 | fastcgi_param SERVER_PROTOCOL $server_protocol; 31 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 32 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 33 | fastcgi_param REMOTE_ADDR $remote_addr; 34 | fastcgi_param REMOTE_PORT $remote_port; 35 | fastcgi_param SERVER_ADDR $server_addr; 36 | fastcgi_param SERVER_PORT $server_port; 37 | fastcgi_param SERVER_NAME $server_name; 38 | fastcgi_param HTTPS $https; 39 | # PHP only, required if PHP was built with --enable-force-cgi-redirect 40 | fastcgi_param REDIRECT_STATUS 200; 41 | fastcgi_pass php:9000; 42 | fastcgi_param SCRIPT_FILENAME $request_filename; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/pages/changeWalletPassword.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | {{ $t("changeWalletPasswordPage.title") }} 5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | 13 | 14 |
15 | {{ $t("changeWalletPasswordPage.oldPassword.invalid") }} 16 |
17 |
18 | 19 |
20 | 21 | 22 |
23 | {{ $t("global.passwordInvalidRequirements") }} 24 |
25 | 26 |
27 |
28 |
29 | 30 |
31 | 32 | 33 |
34 | {{ $t("global.passwordConfirmationNotMatching") }} 35 |
36 |
37 | 38 |
39 | 40 |
41 |
42 |
43 |
44 | 45 |
46 |
-------------------------------------------------------------------------------- /src/pages/importFromFile.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | {{ $t("importFromFilePage.title") }} 5 |
6 |
7 | {{ $t("importFromFilePage.subtitle") }} 8 |
9 |
10 |
11 |
12 |
13 |
{{ $t("importFromFilePage.title") }}
14 |
15 |
16 | 17 | 18 |
19 | {{ $t("global.passwordInvalidRequirements") }} 20 |
21 | 22 |
23 |
24 |
25 | 26 |
27 | 28 | 29 |
30 | {{ $t("importBasePage.parametersBlock.passwordConfirm.invalid") }} 31 |
32 |
33 |
34 |
35 |
36 | 37 |
38 |
39 |
{{ $t("importFromFilePage.walletBlock.title") }}
40 |
41 |
42 | 43 |
44 | 45 |
46 | 47 |
48 |
49 |
50 |
51 | 52 |
53 |
-------------------------------------------------------------------------------- /src/pages/export.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 |
7 | {{ $t("exportPage.title") }} 8 |
9 |
10 |
11 |
12 |
13 |
{{ $t("exportPage.publicAddressBlock.title") }}
14 |
15 | {{publicAddress}} 16 |
17 |
18 |
19 | 20 |
21 |
22 |
{{ $t("exportPage.pdfBlock.title") }}
23 |
24 | 25 |
26 |
27 |
28 | 29 |
30 |
31 |
{{ $t("exportPage.warningBlock.title") }}
32 |
33 |
34 |
35 | 36 |
37 |
38 |
{{ $t("exportPage.exportBlock.title") }}
39 |
40 |
41 | 42 |
43 |
44 | 45 |
46 |
47 | 48 |
49 |
50 |
51 |
52 | 53 | 54 |
55 |
56 | -------------------------------------------------------------------------------- /src/config.ts: -------------------------------------------------------------------------------- 1 | let global : any = typeof window !== 'undefined' ? window : self; 2 | global.config = { 3 | apiUrl:typeof window !== 'undefined' && window.location ? window.location.href.substr(0,window.location.href.lastIndexOf('/')+1)+'api/' : 'https://wallet.getmasari.org/api/', 4 | trustedDaemonsAddresses:[ 5 | 'https://wallet.getmasari.org:38084/' 6 | ], 7 | phpRelay:typeof window !== 'undefined' ? true : false, 8 | mainnetExplorerUrl: "https://explorer.getmasari.org/", 9 | mainnetExplorerUrlHash: "https://explorer.getmasari.org/transaction.html?hash={ID}", 10 | mainnetExplorerUrlBlock: "https://explorer.getmasari.org/block.html?height={ID}", 11 | testnetExplorerUrl: "http://testnet.msrchain.net/", 12 | testnetExplorerUrlHash: "http://testnet.msrchain.net/tx/{ID}", 13 | testnetExplorerUrlBlock: "http://testnet.msrchain.net/block/{ID}", 14 | testnet: false, 15 | coinUnitPlaces: 12, 16 | txMinConfirms: 10, // corresponds to CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE in Monero 17 | txCoinbaseMinConfirms: 60, // corresponds to CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW in Monero 18 | addressPrefix: 28, 19 | integratedAddressPrefix: 29, 20 | addressPrefixTestnet: 33, 21 | integratedAddressPrefixTestnet: 34, 22 | subAddressPrefix: 52, 23 | subAddressPrefixTestnet: 73, 24 | feePerKB: new JSBigInt('400000000'),//20^10 - for testnet its not used, as fee is dynamic. 25 | dustThreshold: new JSBigInt('1000000000'),//10^10 used for choosing outputs/change - we decompose all the way down if the receiver wants now regardless of threshold 26 | defaultMixin: 12, // default value mixin 27 | 28 | idleTimeout: 30, 29 | idleWarningDuration: 20, 30 | 31 | coinSymbol: 'MSR', 32 | openAliasPrefix: "msr", 33 | coinName: 'Masari', 34 | coinUriPrefix: 'masari:', 35 | avgBlockTime: 60, 36 | maxBlockNumber: 500000000, 37 | 38 | donationAddresses : [ 39 | '5qfrSvgYutM1aarmQ1px4aDiY9Da7CLKKDo3UkPuUnQ7bT7tr7i4spuLaiZwXG1dFQbkCinRUNeUNLoNh342sVaqTaWqvt8', 40 | '5nYWvcvNThsLaMmrsfpRLBRou1RuGtLabUwYH7v6b88bem2J4aUwsoF33FbJuqMDgQjpDRTSpLCZu3dXpqXicE2uSWS4LUP', 41 | '9ppu34ocgmeZiv4nS2FyQTFLL5wBFQZkhAfph7wGcnFkc8fkCgTJqxnXuBkaw1v2BrUW7iMwKoQy2HXRXzDkRE76Cz7WXkD' 42 | ] 43 | }; 44 | -------------------------------------------------------------------------------- /src/model/KeysRepository.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | import {Cn, CnUtils} from "./Cn"; 17 | 18 | export type UserKeys = { 19 | pub:{ 20 | view:string, 21 | spend:string, 22 | }, 23 | priv:{ 24 | spend:string, 25 | view:string 26 | } 27 | } 28 | 29 | export class KeysRepository{ 30 | 31 | static fromPriv(spend : string, view : string) : UserKeys{ 32 | let pubView = CnUtils.sec_key_to_pub(view); 33 | let pubSpend = CnUtils.sec_key_to_pub(spend); 34 | return { 35 | pub:{ 36 | view:pubView, 37 | spend:pubSpend 38 | }, 39 | priv:{ 40 | view:view, 41 | spend:spend, 42 | } 43 | } 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /src/service-worker-raw.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.2.0/workbox-sw.js'); 17 | workbox.precaching.precacheAndRoute([]); 18 | 19 | self.addEventListener('message', (event) => { 20 | if (!event.data){ 21 | return; 22 | } 23 | 24 | switch (event.data) { 25 | case 'force-activate': 26 | (self).skipWaiting(); 27 | (self).clients.claim(); 28 | (self).clients.matchAll().then((clients : any[]) => { 29 | clients.forEach((client : any) => client.postMessage('reload-window-update')); 30 | }); 31 | break; 32 | default: 33 | // NOOP 34 | break; 35 | } 36 | }); -------------------------------------------------------------------------------- /src_native/common/i18n.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #pragma once 30 | 31 | #define QT_TRANSLATE_NOOP(context,str) i18n_translate(str,context) 32 | 33 | std::string i18n_get_language(); 34 | int i18n_set_language(const char *directory, const char *base, std::string language = std::string()); 35 | const char *i18n_translate(const char *str, const std::string &context); 36 | static inline std::string get_default_i18n_context() { return std::string(); } 37 | static inline const char *tr(const char *str) { return i18n_translate(str,get_default_i18n_context()); } 38 | -------------------------------------------------------------------------------- /src/lib/numbersLab/Observable.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 NumbersLab - https://github.com/NumbersLab 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | * 6 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | */ 10 | 11 | export interface Observer{ 12 | observe(eventType : string, data : any) : void; 13 | } 14 | 15 | export class Observable{ 16 | static EVENT_MODIFIED = 'modified'; 17 | 18 | observers : any = {}; 19 | 20 | addObserver(eventType : string, callback : Function){ 21 | if(!(eventType in this.observers))this.observers[eventType] = []; 22 | this.observers[eventType].push(callback); 23 | } 24 | 25 | removeObserver(eventType:string, callback : Function){ 26 | if(!(eventType in this.observers)) return; 27 | 28 | for(let i in this.observers[eventType]){ 29 | if(this.observers[eventType][i] == callback){ 30 | this.observers[eventType].splice(i, 1); 31 | break; 32 | } 33 | } 34 | } 35 | 36 | notify(eventType : string=Observable.EVENT_MODIFIED, data : any=null){ 37 | if(!(eventType in this.observers)) return; 38 | 39 | let observers = []; 40 | for(let i in this.observers[eventType]){ 41 | observers.push(this.observers[eventType][i]); 42 | } 43 | 44 | for(let i in observers){ 45 | observers[i](eventType, data); 46 | } 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /src_native/common/base58.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | // 29 | // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers 30 | 31 | #pragma once 32 | 33 | #include 34 | #include 35 | 36 | namespace tools 37 | { 38 | namespace base58 39 | { 40 | std::string encode(const std::string& data); 41 | bool decode(const std::string& enc, std::string& data); 42 | 43 | std::string encode_addr(uint64_t tag, const std::string& data); 44 | bool decode_addr(std::string addr, uint64_t& tag, std::string& data); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/api.html: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | Masari API 21 | 22 | 23 | 24 |

Masari Wallet API relay

25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src_native/hash.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | // 29 | // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include "hash-ops.h" 36 | #include "keccak.h" 37 | 38 | void hash_permutation(union hash_state *state) { 39 | keccakf((uint64_t*)state, 24); 40 | } 41 | 42 | void hash_process(union hash_state *state, const uint8_t *buf, size_t count) { 43 | keccak1600(buf, count, (uint8_t*)state); 44 | } 45 | 46 | void cn_fast_hash(const void *data, size_t length, char *hash) { 47 | union hash_state state; 48 | hash_process(&state, reinterpret_cast(data), length); 49 | memcpy(hash, &state, HASH_SIZE); 50 | } 51 | -------------------------------------------------------------------------------- /src/model/MathUtil.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | 17 | export class MathUtil{ 18 | 19 | static randomFloat(){ 20 | const randomBuffer = new Uint32Array(1); 21 | window.crypto.getRandomValues(randomBuffer); 22 | return randomBuffer[0] / (0xffffffff + 1); 23 | } 24 | 25 | static randomUint32(){ 26 | const randomBuffer = new Uint32Array(1); 27 | window.crypto.getRandomValues(randomBuffer); 28 | return randomBuffer[0]; 29 | } 30 | 31 | static getRandomInt(min : number, max : number) { 32 | return Math.floor(Math.random() * (max - min + 1)) + min; 33 | } 34 | 35 | static randomTriangularSimplified(max : number){ 36 | let r = MathUtil.randomUint32() % (1 << 53); 37 | let frac = Math.sqrt(r / (1 << 53)); 38 | let i = (frac*max)|0; 39 | // just in case rounding up to 1 occurs after sqrt 40 | if (i == max) 41 | --i; 42 | return i; 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /src_native/common/json_util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #pragma once 30 | 31 | #define GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, name, type, jtype, mandatory, def) \ 32 | type field_##name = def; \ 33 | bool field_##name##_found = false; \ 34 | (void)field_##name##_found; \ 35 | do if (json.HasMember(#name)) \ 36 | { \ 37 | if (json[#name].Is##jtype()) \ 38 | { \ 39 | field_##name = json[#name].Get##jtype(); \ 40 | field_##name##_found = true; \ 41 | } \ 42 | else \ 43 | { \ 44 | LOG_ERROR("Field " << #name << " found in JSON, but not " << #jtype); \ 45 | return false; \ 46 | } \ 47 | } \ 48 | else if (mandatory) \ 49 | { \ 50 | LOG_ERROR("Field " << #name << " not found in JSON"); \ 51 | return false; \ 52 | } while(0) 53 | 54 | -------------------------------------------------------------------------------- /src/providers/BlockchainExplorerProvider.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | import {Constants} from "../model/Constants"; 17 | import {DependencyInjectorInstance} from "../lib/numbersLab/DependencyInjector"; 18 | import {BlockchainExplorerRpc2} from "../model/blockchain/BlockchainExplorerRpc2"; 19 | import {BlockchainExplorer} from "../model/blockchain/BlockchainExplorer"; 20 | import {BlockchainExplorerRpcDaemon} from "../model/blockchain/BlockchainExplorerRpcDaemon"; 21 | 22 | export class BlockchainExplorerProvider{ 23 | static getInstance() : BlockchainExplorer{ 24 | let blockchainExplorer : BlockchainExplorer = DependencyInjectorInstance().getInstance(Constants.BLOCKCHAIN_EXPLORER); 25 | if(blockchainExplorer === null) { 26 | // blockchainExplorer = new BlockchainExplorerRpc2(); 27 | blockchainExplorer = new BlockchainExplorerRpcDaemon(); 28 | DependencyInjectorInstance().register(Constants.BLOCKCHAIN_EXPLORER, blockchainExplorer); 29 | } 30 | return blockchainExplorer; 31 | } 32 | } -------------------------------------------------------------------------------- /src/pages/donate.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | {{ $t("donatePage.title") }} 5 |
6 |
7 | {{ $t("donatePage.subtitle") }} 8 |
9 |
10 |
11 | 23 |
24 |
25 |
{{ $t("donatePage.masariFundBlock.title") }}
26 |
27 |
28 | Masari: 5nYWvcvNThsLaMmrsfpRLBRou1RuGtLabUwYH7v6b88bem2J4aUwsoF33FbJuqMDgQjpDRTSpLCZu3dXpqXicE2uSWS4LUP
(viewkey: 99e21e00cce073c126e9aed800c9e2e82518534b3924b035a29436ff4f75bc0c)
29 | Monero: 4A57eA3so6bEE8FUcaN1KtMXD3sxjjbvcKD3MF1pUgRi5PNHTpB7sYN2DmJv3EXxtZCWeG88tsVLzdfZJcmUFm52SbrfJWr
(viewkey: c7a7c141581ac4436ba8bfb81dd67234720c565c696ef154a25c7e7314ce4b08)
30 |
31 | Bitcoin: 1J1he4qtTuNpCxyEBozkeKfDpoeYxfE3rj
32 | 36 |
37 |
38 |
39 |
40 |
-------------------------------------------------------------------------------- /src_native/common/download.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #pragma once 30 | 31 | #include 32 | 33 | namespace tools 34 | { 35 | struct download_thread_control; 36 | typedef std::shared_ptr download_async_handle; 37 | 38 | bool download(const std::string &path, const std::string &url, std::function progress = NULL); 39 | download_async_handle download_async(const std::string &path, const std::string &url, std::function result, std::function progress = NULL); 40 | bool download_error(const download_async_handle &h); 41 | bool download_finished(const download_async_handle &h); 42 | bool download_wait(const download_async_handle &h); 43 | bool download_cancel(const download_async_handle &h); 44 | } 45 | -------------------------------------------------------------------------------- /src_client_api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | Title 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src_native/common/http_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #pragma once 30 | 31 | #include 32 | #include "string_tools.h" 33 | #include "net/http_client.h" 34 | 35 | namespace tools { 36 | 37 | class t_http_connection { 38 | private: 39 | epee::net_utils::http::http_simple_client * mp_http_client; 40 | bool m_ok; 41 | public: 42 | static constexpr std::chrono::seconds TIMEOUT() 43 | { 44 | return std::chrono::minutes(3) + std::chrono::seconds(30); 45 | } 46 | 47 | t_http_connection(epee::net_utils::http::http_simple_client* p_http_client) 48 | : mp_http_client(p_http_client) 49 | , m_ok(false) 50 | { 51 | m_ok = mp_http_client->connect(TIMEOUT()); 52 | } 53 | 54 | ~t_http_connection() 55 | { 56 | if (m_ok) 57 | { 58 | mp_http_client->disconnect(); 59 | } 60 | } 61 | 62 | bool is_open() const 63 | { 64 | return m_ok; 65 | } 66 | }; // class t_http_connection 67 | 68 | } // namespace tools 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Official Masari Web Wallet - Fully client-side 2 | This web wallet is doing everything client-side to give the best privacy to users. 3 | The server is currently only used to optimize the communication with the daemon and compress the blockchain. 4 | 5 | Note: This requirement may be removed in the future once daemons evolve and return enough data. 6 | 7 | # Security 8 | **No keys, seeds, or sensitive data is sent to the server** 9 | If you find a potential security issue, please contact me so we/I can patch it as soon as possible. 10 | Encryption is done with a certified library, [Tweetnacl.Js.](https://github.com/dchest/tweetnacl-js) 11 | 12 | # Contributors and thanks 13 | Developers: 14 | - gnock (main) 15 | - cryptochangements 16 | 17 | Translations: 18 | - English: too many people 19 | - French: gnock 20 | - Serbian cyrillic: girugameshh 21 | - German: F0sching 22 | - Hungarian: Gelesztaa 23 | - Greek: GeraltOfTrivia 24 | 25 | # Contributing 26 | - You can help Masari by translation the wallet in your native language, it's really easy! 27 | Read [the translations guide](TRANSLATIONS.md) to get instructions on how to do that 28 | - Report bugs & ideas to help us improve the web wallet by opening an issue 29 | - [Make a donation to Masari](https://www.masariwallet.com/#!donate) 30 | 31 | # Forks / Other Coins 32 | We have been receiving multiple coin developers help to fork it. As the time required to develop this project is heavy, please consider giving a mention to this project if you fork it. 33 | 34 | If you are a developer of a Cryptonote/Monero fork and would like to get a fork, please contact us (@gnock on the [official Discord](https://discord.gg/eSb9ZdM)). 35 | 36 | Depending on your coin specifics, I can provide support, maintenancem and development/updates for a payment in return - crypto only. 37 | If you are not willing to pay for this service, please do not contact us and make us lose time. 38 | 39 | The code is readable, it should be enough for you to use it. 40 | 41 | # Features (non-exhaustive) 42 | - Complete wallet sync without server side processing for security 43 | - Receive/send history 44 | - Mempool support to check incoming transfers 45 | - Send coins - including QR code scanning and subaddress support 46 | - Receive page to generate a custom QR code 47 | - Import from private keys, mnemonic seed, or json file (exported by the wallet) 48 | - Export private keys, mnemonic phrase, or json file (which include all the history) 49 | - View only wallet 50 | - Basic network stats 51 | 52 | # Roadmap 53 | See Github [issues.](https://github.com/masari-project/masari-webwallet/issues) 54 | -------------------------------------------------------------------------------- /src/d/nativeNativeStorage.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | declare enum NativeNativeStorageErrorCode{ 17 | NATIVE_WRITE_FAILED = 1, 18 | ITEM_NOT_FOUND = 2, 19 | NULL_REFERENCE = 3, 20 | UNDEFINED_TYPE = 4, 21 | JSON_ERROR = 5, 22 | WRONG_PARAMETER = 6 23 | } 24 | 25 | type NativeNativeStorageError = { 26 | code:number, 27 | exception?:any, 28 | source?:"Native"|"JS" 29 | } 30 | 31 | declare interface NativeNativeStorage { 32 | setItem(key : string,value : any,callbackSuccess : ()=>void,callbackError : (error : NativeNativeStorageError)=>void) : void; 33 | getItem(key : string,callbackSuccess : ()=>void,callbackError : (error : NativeNativeStorageError)=>void) : void; 34 | keys(callbackSuccess : (keys : string[])=>void,callbackError : (error : NativeNativeStorageError)=>void) : void; 35 | remove(key : string,callbackSuccess : ()=>void,callbackError : (error : NativeNativeStorageError)=>void) : void; 36 | clear(callbackSuccess : ()=>void,callbackError : (error : NativeNativeStorageError)=>void) : void; 37 | } 38 | 39 | interface Window { 40 | NativeStorage?:NativeNativeStorage 41 | } 42 | -------------------------------------------------------------------------------- /src/filters/Filters.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, The Masari Project 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | * 6 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | * 8 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | * 10 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 11 | * 12 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 13 | */ 14 | 15 | export function VueFilterSatoshis (value: number) { 16 | return '₿' + value.toFixed(8) 17 | } 18 | 19 | export function VueFilterPiconero (value: number) { 20 | return value.toFixed(12) 21 | } 22 | export function VueFilterFiat (value: number, currency: string) { 23 | if (currency == 'usd' || currency == 'aud' || currency == 'cad' || currency == 'nzd') { 24 | return '$' + value.toFixed(2); 25 | } 26 | if (currency == 'eur') { 27 | return '€' + value.toFixed(2); 28 | } 29 | if (currency == 'jpy') { 30 | return '¥' + value.toFixed(2); 31 | } 32 | if (currency == 'gbp') { 33 | return '£' + value.toFixed(2); 34 | } 35 | if (currency == 'chf') { 36 | return 'Fr. ' + value.toFixed(2); 37 | } 38 | if (currency == 'sek') { 39 | return 'kr' + value.toFixed(2); 40 | } 41 | } 42 | 43 | export function VueFilterHashrate(hashrate : number){ 44 | let i = 0; 45 | let byteUnits = [' H', ' kH', ' MH', ' GH', ' TH', ' PH', ' EH', ' ZH', ' YH' ]; 46 | while (hashrate > 1000){ 47 | hashrate = hashrate / 1000; 48 | i++; 49 | } 50 | return hashrate.toFixed(2) + byteUnits[i]; 51 | } -------------------------------------------------------------------------------- /src/model/Password.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | export class Password{ 17 | 18 | static checkPasswordConstraints(password : string, raiseError : boolean = true){ 19 | let anUpperCase = /[A-Z]/; 20 | let aLowerCase = /[a-z]/; 21 | let aNumber = /[0-9]/; 22 | let aSpecial = /[!|@|'|"|#|$|%|^|&|*|(|)|-|_]/; 23 | 24 | let numUpper = 0; 25 | let numLower = 0; 26 | let numNums = 0; 27 | let numSpecials = 0; 28 | for(let i=0; i 2 |
3 |
4 | {{ $t("importFromMnemonicPage.title") }} 5 |
6 |
7 | {{ $t("importFromMnemonicPage.subtitle") }} 8 |
9 |
10 |
11 |
12 |
13 |
{{ $t("importBasePage.parametersBlock.title") }}
14 |
15 |
16 | 17 | 18 |
19 | {{ $t("global.passwordInvalidRequirements") }} 20 |
21 | 22 |
23 |
24 |
25 | 26 |
27 | 28 | 29 |
30 | {{ $t("importBasePage.parametersBlock.passwordConfirm.invalid") }} 31 |
32 |
33 | 34 |
35 | 36 | 37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 |
{{ $t("importFromMnemonicPage.mnemonicBlock.title") }}
45 |
46 |
47 | 48 | 49 |
50 |
51 | 52 | 55 |
56 | 57 |
58 | {{ $t("importFromMnemonicPage.mnemonicBlock.mnemonic.invalid") }} 59 |
60 | 61 |
62 | 63 |
64 |
65 |
66 |
67 | 68 |
69 | -------------------------------------------------------------------------------- /src_native/generic-ops.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | // 29 | // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers 30 | 31 | #pragma once 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #define CRYPTO_MAKE_COMPARABLE(type) \ 38 | namespace crypto { \ 39 | inline bool operator==(const type &_v1, const type &_v2) { \ 40 | return std::memcmp(&_v1, &_v2, sizeof(type)) == 0; \ 41 | } \ 42 | inline bool operator!=(const type &_v1, const type &_v2) { \ 43 | return std::memcmp(&_v1, &_v2, sizeof(type)) != 0; \ 44 | } \ 45 | } 46 | 47 | #define CRYPTO_MAKE_HASHABLE(type) \ 48 | CRYPTO_MAKE_COMPARABLE(type) \ 49 | namespace crypto { \ 50 | static_assert(sizeof(std::size_t) <= sizeof(type), "Size of " #type " must be at least that of size_t"); \ 51 | inline std::size_t hash_value(const type &_v) { \ 52 | return reinterpret_cast(_v); \ 53 | } \ 54 | } \ 55 | namespace std { \ 56 | template<> \ 57 | struct hash { \ 58 | std::size_t operator()(const crypto::type &_v) const { \ 59 | return reinterpret_cast(_v); \ 60 | } \ 61 | }; \ 62 | } 63 | -------------------------------------------------------------------------------- /src/pages/receive.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | {{ $t("receivePage.title") }} 6 |
7 |
8 |
9 |
10 |
11 |
{{ $t("receivePage.receiveBlock.address.title") }}
12 |
13 |
14 | 15 |
16 | 17 | 18 |
19 |
20 |
21 |
{{ $t("receivePage.receiveBlock.qrCode.title") }}
22 |
23 |
24 | 25 | 26 |
27 |
28 | 29 | 30 |
31 |
32 | 33 | 34 |
35 | 39 |
40 | 41 |
42 |
43 |
44 |
45 | 46 | 47 |
48 |
49 |
{{ $t("receivePage.qrBlock.title") }}
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | 58 |
59 |
60 |
Nfc
61 |
62 |
63 | 64 |
65 |
66 | 67 |
68 |
69 |
70 |
71 |
72 |
-------------------------------------------------------------------------------- /src/model/blockchain/BlockchainExplorer.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | import {Wallet} from "../Wallet"; 17 | import {CnTransactions} from "../Cn"; 18 | 19 | /* 20 | export type RawDaemon_RctSignature = { 21 | ecdhInfo:EcdhInfo[] 22 | outPk:string[], 23 | psuedoOuts:string[], 24 | txnFee:number, 25 | type:number 26 | } 27 | */ 28 | 29 | export type RawDaemon_Transaction = { 30 | extra : number[], 31 | vout : CnTransactions.Vout[], 32 | vin : { 33 | key?:CnTransactions.Vin, 34 | gen?:{height:number}, 35 | }[], 36 | rct_signatures:CnTransactions.RctSignature, 37 | unlock_time:number, 38 | version:number, 39 | ctsig_prunable:any, 40 | global_index_start?:number, 41 | height?:number, 42 | ts?:number,//timestamp 43 | hash?:string, 44 | }; 45 | 46 | export type NetworkInfo = { 47 | major_version:number, 48 | hash:string, 49 | reward:number, 50 | height:number, 51 | timestamp:number, 52 | difficulty:number, 53 | }; 54 | 55 | export interface BlockchainExplorer{ 56 | resolveOpenAlias(str : string) : Promise<{ address: string, name: string | null }>; 57 | getHeight() : Promise; 58 | getScannedHeight() : number; 59 | watchdog(wallet : Wallet) : void; 60 | getTransactionPool() : Promise; 61 | getTransactionsForBlocks(startBlock : number, endBlock : number, includeMinerTx : boolean) : Promise; 62 | sendRawTx(rawTx : string) : Promise; 63 | getRandomOuts(numberOuts : number) : Promise; 64 | getNetworkInfo() : Promise; 65 | } -------------------------------------------------------------------------------- /src_native/common/apply_permutation.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | // 29 | // Most of this file is originally copyright (c) 2017 Raymond Chen, Microsoft 30 | // This algorithm is adapted from Raymond Chen's code: 31 | // https://blogs.msdn.microsoft.com/oldnewthing/20170109-00/?p=95145 32 | 33 | #pragma once 34 | 35 | #include 36 | #include 37 | #include "misc_log_ex.h" 38 | 39 | namespace tools 40 | { 41 | 42 | template 43 | void apply_permutation(std::vector permutation, const F &swap) 44 | { 45 | //sanity check 46 | for (size_t n = 0; n < permutation.size(); ++n) 47 | CHECK_AND_ASSERT_THROW_MES(std::find(permutation.begin(), permutation.end(), n) != permutation.end(), "Bad permutation"); 48 | 49 | for (size_t i = 0; i < permutation.size(); ++i) 50 | { 51 | size_t current = i; 52 | while (i != permutation[current]) 53 | { 54 | size_t next = permutation[current]; 55 | swap(current, next); 56 | permutation[current] = current; 57 | current = next; 58 | } 59 | permutation[current] = current; 60 | } 61 | } 62 | 63 | template 64 | void apply_permutation(const std::vector &permutation, std::vector &v) 65 | { 66 | CHECK_AND_ASSERT_THROW_MES(permutation.size() == v.size(), "Mismatched vector sizes"); 67 | apply_permutation(permutation, [&v](size_t i0, size_t i1){ std::swap(v[i0], v[i1]); }); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/pages/importFromQr.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{{ $t("importFromQrPage.qrScanningBlock.title") }}

4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 |
12 | {{ $t("importFromQrPage.title") }} 13 |
14 |
15 | {{ $t("importFromQrPage.subtitle") }} 16 |
17 |
18 |
19 |
20 |
21 |
{{ $t("importBasePage.parametersBlock.title") }}
22 |
23 |
24 | 25 | 26 |
27 | {{ $t("global.passwordInvalidRequirements") }} 28 |
29 | 30 |
31 |
32 |
33 | 34 |
35 | 36 | 37 |
38 | {{ $t("importBasePage.parametersBlock.passwordConfirm.invalid") }} 39 |
40 |
41 | 42 |
43 | 44 | 45 |
46 |
47 |
48 |
49 | 50 |
51 |
52 |
{{ $t("importFromQrPage.qrCodeBlock.title") }}
53 |
54 |
55 | 56 |
57 | 58 |
59 | 60 |
61 |
62 |
63 |
64 | 65 |
66 | 67 |
68 |
69 | 70 |
71 |

{{ $t("importFromQrPage.qrScanningBlock.title") }}

72 |
73 | 74 |
75 |
76 |
77 |
-------------------------------------------------------------------------------- /src/pages/index.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | Masari 6 |
7 |
8 |

{{ $t("homepage.mainTitle") }}

9 |

{{ $t("homepage.tagLine") }}

10 |
11 | 16 |
17 |
18 |
19 |
20 | 28 |
29 |

{{ $t("homepage.mainTitle") }}

30 |

{{ $t("homepage.tagLine") }}

31 |
32 | 36 |
37 | 38 |
39 |
40 |
41 |
42 |
43 |

{{ $t("homepage.notes.secure.title") }}

44 |

{{ $t("homepage.notes.secure.description") }}

45 |
46 |
47 |
48 |
49 |
50 |

{{ $t("homepage.notes.fast.title") }}

51 |

{{ $t("homepage.notes.fast.description") }}

52 |
53 |
54 |
55 |
56 |
57 |

{{ $t("homepage.notes.technology.title") }}

58 |

{{ $t("homepage.notes.technology.description") }}

59 |
60 |
61 |
62 |
63 |
64 |

{{ $t("homepage.notes.openSource.title") }}

65 |

{{ $t("homepage.notes.openSource.description") }}

66 |
67 |
68 |
69 |
70 |
71 |
-------------------------------------------------------------------------------- /src/utils/Url.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | export class Url{ 17 | 18 | private static transformSearchParametersToAssocArray(prmstr:any) { 19 | let params : any = {}; 20 | let prmarr = prmstr.split("&"); 21 | for (let i = 0; i < prmarr.length; i++) { 22 | let tmparr = prmarr[i].split("="); 23 | if(typeof params[tmparr[0]] !== 'undefined'){ 24 | if(!Array.isArray(params[tmparr[0]])) 25 | params[tmparr[0]] = [params[tmparr[0]]]; 26 | params[tmparr[0]].push(tmparr[1]); 27 | }else 28 | params[tmparr[0]] = tmparr[1]; 29 | } 30 | return params; 31 | } 32 | 33 | static getSearchParameters() { 34 | let paramsStart = window.location.href.indexOf('?'); 35 | if (paramsStart != -1) { 36 | let paramsEnd = window.location.href.indexOf('#', paramsStart); 37 | paramsEnd = paramsEnd == -1 ? window.location.href.length : paramsEnd; 38 | return Url.transformSearchParametersToAssocArray(window.location.href.substring(paramsStart + 1, paramsEnd)); 39 | } 40 | return {}; 41 | } 42 | 43 | static getHashSearchParameters() { 44 | let paramsStart = window.location.hash.indexOf('?'); 45 | if (paramsStart != -1) { 46 | return Url.transformSearchParametersToAssocArray(window.location.hash.substring(paramsStart + 1, window.location.hash.length)); 47 | } 48 | return {}; 49 | } 50 | 51 | static getHashSearchParameter(parameterName : string, defaultValue : any = null) { 52 | let parameters = this.getHashSearchParameters(); 53 | if(typeof parameters[parameterName] !== 'undefined') 54 | return parameters[parameterName]; 55 | return defaultValue; 56 | } 57 | } -------------------------------------------------------------------------------- /src/lib/FileSaver.min.js: -------------------------------------------------------------------------------- 1 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ 2 | var saveAs=saveAs||function(e){"use strict";if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var t=e.document,n=function(){return e.URL||e.webkitURL||e},o=t.createElementNS("http://www.w3.org/1999/xhtml","a"),r="download"in o,i=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},a=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),c=e.webkitRequestFileSystem,d=e.requestFileSystem||c||e.mozRequestFileSystem,u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",f=0,l=4e4,v=function(e){var t=function(){"string"==typeof e?n().revokeObjectURL(e):e.remove()};setTimeout(t,l)},p=function(e,t,n){t=[].concat(t);for(var o=t.length;o--;){var r=e["on"+t[o]];if("function"==typeof r)try{r.call(e,n||e)}catch(i){u(i)}}},w=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e},y=function(t,u,l){l||(t=w(t));var y,m,S,h=this,R=t.type,O=!1,g=function(){p(h,"writestart progress write writeend".split(" "))},b=function(){if(m&&a&&"undefined"!=typeof FileReader){var o=new FileReader;return o.onloadend=function(){var e=o.result;m.location.href="data:attachment/file"+e.slice(e.search(/[,;]/)),h.readyState=h.DONE,g()},o.readAsDataURL(t),void(h.readyState=h.INIT)}if((O||!y)&&(y=n().createObjectURL(t)),m)m.location.href=y;else{var r=e.open(y,"_blank");void 0===r&&a&&(e.location.href=y)}h.readyState=h.DONE,g(),v(y)},E=function(e){return function(){return h.readyState!==h.DONE?e.apply(this,arguments):void 0}},N={create:!0,exclusive:!1};return h.readyState=h.INIT,u||(u="download"),r?(y=n().createObjectURL(t),void setTimeout(function(){o.href=y,o.download=u,i(o),g(),v(y),h.readyState=h.DONE})):(e.chrome&&R&&R!==s&&(S=t.slice||t.webkitSlice,t=S.call(t,0,t.size,s),O=!0),c&&"download"!==u&&(u+=".download"),(R===s||c)&&(m=e),d?(f+=t.size,void d(e.TEMPORARY,f,E(function(e){e.root.getDirectory("saved",N,E(function(e){var n=function(){e.getFile(u,N,E(function(e){e.createWriter(E(function(n){n.onwriteend=function(t){m.location.href=e.toURL(),h.readyState=h.DONE,p(h,"writeend",t),v(e)},n.onerror=function(){var e=n.error;e.code!==e.ABORT_ERR&&b()},"writestart progress write abort".split(" ").forEach(function(e){n["on"+e]=h["on"+e]}),n.write(t),h.abort=function(){n.abort(),h.readyState=h.DONE},h.readyState=h.WRITING}),b)}),b)};e.getFile(u,{create:!1},E(function(e){e.remove(),n()}),E(function(e){e.code===e.NOT_FOUND_ERR?n():b()}))}),b)}),b)):void b())},m=y.prototype,S=function(e,t,n){return new y(e,t,n)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,n){return n||(e=w(e)),navigator.msSaveOrOpenBlob(e,t||"download")}:(m.abort=function(){var e=this;e.readyState=e.DONE,p(e,"abort")},m.readyState=m.INIT=0,m.WRITING=1,m.DONE=2,m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null,S)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);"undefined"!=typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!=typeof define&&null!==define&&null!==define.amd&&define([],function(){return saveAs}); -------------------------------------------------------------------------------- /src_native/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | //#include "cryptonight.h" 9 | 10 | #include "crypto.h" 11 | #include "crypto-ops.h" 12 | #include "hash-ops.h" 13 | //#include "hash.h" 14 | #include "common/varint.h" 15 | 16 | extern "C" { 17 | 18 | bool generate_key_derivation(const unsigned char *key1, const unsigned char *key2, unsigned char *derivation) { 19 | ge_p3 point; 20 | ge_p2 point2; 21 | ge_p1p1 point3; 22 | // assert(sc_check(&key2) == 0); 23 | if (ge_frombytes_vartime(&point, key1) != 0) { 24 | return false; 25 | } 26 | 27 | ge_scalarmult(&point2, key2, &point); 28 | ge_mul8(&point3, &point2); 29 | ge_p1p1_to_p2(&point2, &point3); 30 | ge_tobytes(derivation, &point2); 31 | return true; 32 | } 33 | 34 | void hash_to_scalar(const void *data, size_t length, crypto::ec_scalar &res) { 35 | cn_fast_hash(data, length, reinterpret_cast(&res)); 36 | sc_reduce32(reinterpret_cast(&res)); 37 | } 38 | 39 | void derivation_to_scalar(const crypto::key_derivation &derivation, size_t output_index, crypto::ec_scalar &res) { 40 | struct { 41 | crypto::key_derivation derivation; 42 | char output_index[(sizeof(size_t) * 8 + 6) / 7]; 43 | } buf; 44 | char *end = buf.output_index; 45 | buf.derivation = derivation; 46 | tools::write_varint(end, output_index); 47 | assert(end <= buf.output_index + sizeof buf.output_index); 48 | hash_to_scalar(&buf, end - reinterpret_cast(&buf), res); 49 | } 50 | 51 | bool derive_public_key(const crypto::key_derivation &derivation, size_t output_index, 52 | const crypto::public_key &base, crypto::public_key &derived_key) { 53 | crypto::ec_scalar scalar; 54 | ge_p3 point1; 55 | ge_p3 point2; 56 | ge_cached point3; 57 | ge_p1p1 point4; 58 | ge_p2 point5; 59 | if (ge_frombytes_vartime(&point1, reinterpret_cast(&base)) != 0) { 60 | return false; 61 | } 62 | derivation_to_scalar(derivation, output_index, scalar); 63 | ge_scalarmult_base(&point2, reinterpret_cast(&scalar)); 64 | ge_p3_to_cached(&point3, &point2); 65 | ge_add(&point4, &point1, &point3); 66 | ge_p1p1_to_p2(&point5, &point4); 67 | ge_tobytes(reinterpret_cast(&derived_key), &point5); 68 | 69 | return true; 70 | } 71 | 72 | //TODO functions required in the next release 73 | //sc_reduce32 74 | //sc_add 75 | //sc_sub 76 | //sc_mulsub 77 | //sc_0 78 | 79 | //ge_fromfe_frombytes_vartime 80 | //ge_mul8 81 | //ge_p1p1_to_p3 82 | //ge_fromfe_frombytes_vartime 83 | //ge_p3_tobytes 84 | //ge_scalarmult 85 | //ge_tobytes 86 | //ge_scalarmult_base 87 | //ge_double_scalarmult_base_vartime 88 | //ge_double_scalarmult_precomp_vartime 89 | //ge_frombytes_vartime 90 | //ge_dsm_precomp 91 | 92 | //generate_ring_signature 93 | //generate_key_image_2 94 | //hash_to_ec 95 | //hash_to_ec_2 96 | 97 | int main(void) { 98 | return 0; 99 | } 100 | 101 | } -------------------------------------------------------------------------------- /src_native/common/threadpool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | #pragma once 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | namespace tools 40 | { 41 | //! A global thread pool 42 | class threadpool 43 | { 44 | public: 45 | static threadpool& getInstance() { 46 | static threadpool instance; 47 | return instance; 48 | } 49 | 50 | // The waiter lets the caller know when all of its 51 | // tasks are completed. 52 | class waiter { 53 | boost::mutex mt; 54 | boost::condition_variable cv; 55 | int num; 56 | public: 57 | void inc(); 58 | void dec(); 59 | void wait(); //! Wait for a set of tasks to finish. 60 | waiter() : num(0){} 61 | ~waiter(); 62 | }; 63 | 64 | // Submit a task to the pool. The waiter pointer may be 65 | // NULL if the caller doesn't care to wait for the 66 | // task to finish. 67 | void submit(waiter *waiter, std::function f); 68 | 69 | int get_max_concurrency(); 70 | 71 | private: 72 | threadpool(); 73 | ~threadpool(); 74 | typedef struct entry { 75 | waiter *wo; 76 | std::function f; 77 | } entry; 78 | std::deque queue; 79 | boost::condition_variable has_work; 80 | boost::mutex mutex; 81 | std::vector threads; 82 | int active; 83 | int max; 84 | bool running; 85 | void run(); 86 | }; 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src_native/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014-2018, The Monero Project 2 | # 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are 6 | # permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, this list of 9 | # conditions and the following disclaimer. 10 | # 11 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | # of conditions and the following disclaimer in the documentation and/or other 13 | # materials provided with the distribution. 14 | # 15 | # 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | # used to endorse or promote products derived from this software without specific 17 | # prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | # THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) 30 | 31 | set(common_sources 32 | base58.cpp 33 | command_line.cpp 34 | dns_utils.cpp 35 | download.cpp 36 | util.cpp 37 | i18n.cpp 38 | password.cpp 39 | perf_timer.cpp 40 | threadpool.cpp 41 | updates.cpp) 42 | 43 | if (STACK_TRACE) 44 | list(APPEND common_sources stack_trace.cpp) 45 | endif() 46 | 47 | set(common_headers) 48 | 49 | set(common_private_headers 50 | apply_permutation.h 51 | base58.h 52 | boost_serialization_helper.h 53 | command_line.h 54 | common_fwd.h 55 | dns_utils.h 56 | download.h 57 | http_connection.h 58 | int-util.h 59 | pod-class.h 60 | rpc_client.h 61 | scoped_message_writer.h 62 | unordered_containers_boost_serialization.h 63 | util.h 64 | varint.h 65 | i18n.h 66 | password.h 67 | perf_timer.h 68 | stack_trace.h 69 | threadpool.h 70 | updates.h) 71 | 72 | monero_private_headers(common 73 | ${common_private_headers}) 74 | monero_add_library(common 75 | ${common_sources} 76 | ${common_headers} 77 | ${common_private_headers} 78 | DEPENDS generate_translations_header) 79 | target_link_libraries(common 80 | PUBLIC 81 | epee 82 | cncrypto 83 | ${UNBOUND_LIBRARY} 84 | ${LIBUNWIND_LIBRARIES} 85 | ${Boost_DATE_TIME_LIBRARY} 86 | ${Boost_FILESYSTEM_LIBRARY} 87 | ${Boost_SYSTEM_LIBRARY} 88 | ${Boost_THREAD_LIBRARY} 89 | ${Boost_REGEX_LIBRARY} 90 | PRIVATE 91 | ${OPENSSL_LIBRARIES} 92 | ${EXTRA_LIBRARIES}) 93 | 94 | #monero_install_headers(common 95 | # ${common_headers}) 96 | -------------------------------------------------------------------------------- /src_native/common/command_line.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | // 29 | // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers 30 | 31 | #include "command_line.h" 32 | #include 33 | #include 34 | #include 35 | #include "common/i18n.h" 36 | #include "cryptonote_config.h" 37 | #include "string_tools.h" 38 | 39 | namespace command_line 40 | { 41 | namespace 42 | { 43 | const char* tr(const char* str) 44 | { 45 | return i18n_translate(str, "command_line"); 46 | } 47 | } 48 | 49 | bool is_yes(const std::string& str) 50 | { 51 | if (str == "y" || str == "Y") 52 | return true; 53 | 54 | boost::algorithm::is_iequal ignore_case{}; 55 | if (boost::algorithm::equals("yes", str, ignore_case)) 56 | return true; 57 | if (boost::algorithm::equals(command_line::tr("yes"), str, ignore_case)) 58 | return true; 59 | 60 | return false; 61 | } 62 | 63 | bool is_no(const std::string& str) 64 | { 65 | if (str == "n" || str == "N") 66 | return true; 67 | 68 | boost::algorithm::is_iequal ignore_case{}; 69 | if (boost::algorithm::equals("no", str, ignore_case)) 70 | return true; 71 | if (boost::algorithm::equals(command_line::tr("no"), str, ignore_case)) 72 | return true; 73 | 74 | return false; 75 | } 76 | 77 | const arg_descriptor arg_help = {"help", "Produce help message"}; 78 | const arg_descriptor arg_version = {"version", "Output version information"}; 79 | } 80 | -------------------------------------------------------------------------------- /src_native/common/perf_timer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #pragma once 30 | 31 | #include 32 | #include 33 | #include 34 | #include "misc_log_ex.h" 35 | 36 | #undef MONERO_DEFAULT_LOG_CATEGORY 37 | #define MONERO_DEFAULT_LOG_CATEGORY "perf" 38 | 39 | namespace tools 40 | { 41 | 42 | class PerformanceTimer; 43 | 44 | extern el::Level performance_timer_log_level; 45 | 46 | class PerformanceTimer 47 | { 48 | public: 49 | PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug); 50 | ~PerformanceTimer(); 51 | void pause(); 52 | void resume(); 53 | 54 | private: 55 | std::string name; 56 | uint64_t unit; 57 | el::Level level; 58 | uint64_t ticks; 59 | bool started; 60 | bool paused; 61 | }; 62 | 63 | void set_performance_timer_log_level(el::Level level); 64 | 65 | #define PERF_TIMER_UNIT(name, unit) tools::PerformanceTimer pt_##name(#name, unit, tools::performance_timer_log_level) 66 | #define PERF_TIMER_UNIT_L(name, unit, l) tools::PerformanceTimer pt_##name(#name, unit, l) 67 | #define PERF_TIMER(name) PERF_TIMER_UNIT(name, 1000) 68 | #define PERF_TIMER_L(name, l) PERF_TIMER_UNIT_L(name, 1000, l) 69 | #define PERF_TIMER_START_UNIT(name, unit) std::unique_ptr pt_##name(new tools::PerformanceTimer(#name, unit, el::Level::Info)) 70 | #define PERF_TIMER_START(name) PERF_TIMER_START_UNIT(name, 1000) 71 | #define PERF_TIMER_STOP(name) do { pt_##name.reset(NULL); } while(0) 72 | #define PERF_TIMER_PAUSE(name) pt_##name->pause() 73 | #define PERF_TIMER_RESUME(name) pt_##name->resume() 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/pages/network.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2020, The Masari Project 3 | * Copyright (c) 2018, Gnock 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | import {DestructableView} from "../lib/numbersLab/DestructableView"; 17 | import {VueVar, VueRequireFilter} from "../lib/numbersLab/VueAnnotate"; 18 | import {AppState} from "../model/AppState"; 19 | import {BlockchainExplorer, NetworkInfo} from "../model/blockchain/BlockchainExplorer"; 20 | import {BlockchainExplorerProvider} from "../providers/BlockchainExplorerProvider"; 21 | import {VueFilterHashrate} from "../filters/Filters"; 22 | 23 | AppState.enableLeftMenu(); 24 | let blockchainExplorer: BlockchainExplorer = BlockchainExplorerProvider.getInstance(); 25 | 26 | @VueRequireFilter('hashrate', VueFilterHashrate) 27 | 28 | class NetworkView extends DestructableView{ 29 | @VueVar(0) networkHashrate !: number; 30 | @VueVar(0) blockchainHeight !: number; 31 | @VueVar(0) networkDifficulty !: number; 32 | @VueVar(0) lastReward !: number; 33 | @VueVar(0) lastBlockFound !: number; 34 | 35 | private intervalRefreshStat = 0; 36 | 37 | constructor(container : string){ 38 | super(container); 39 | 40 | let self = this; 41 | this.intervalRefreshStat = setInterval(function(){ 42 | self.refreshStats(); 43 | }, 30*1000); 44 | this.refreshStats(); 45 | } 46 | 47 | destruct(): Promise { 48 | clearInterval(this.intervalRefreshStat); 49 | return super.destruct(); 50 | } 51 | 52 | refreshStats() { 53 | blockchainExplorer.getNetworkInfo().then((info : NetworkInfo)=>{ 54 | this.networkDifficulty = info.difficulty; 55 | this.networkHashrate = info.difficulty/config.avgBlockTime; 56 | this.blockchainHeight = info.height; 57 | this.lastReward = info.reward/Math.pow(10, config.coinUnitPlaces); 58 | this.lastBlockFound = info.timestamp; 59 | }); 60 | } 61 | 62 | } 63 | 64 | new NetworkView('#app'); -------------------------------------------------------------------------------- /src/pages/send.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{{ $t("sendPage.qrCodeScanning.explication") }}

4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 |
12 | {{ $t("sendPage.title") }} 13 |
14 |
15 |
16 |
17 |
18 |
19 | 20 |
21 | 22 | 23 | 24 |
25 |
26 | {{ $t("sendPage.sendBlock.address.invalid") }} 27 |
28 |
29 | {{ $t("sendPage.sendBlock.address.fundsTo") }}: {{destinationAddress}} 30 |
31 |
32 | {{ $t("sendPage.sendBlock.address.fundsTo") }}: {{txDestinationName}} 33 |
34 |
35 | {{ $t("sendPage.sendBlock.address.description") }}: {{txDescription}} 36 |
37 |
38 | 39 |
40 | 41 | 42 |
43 | {{ $t("sendPage.sendBlock.amount.invalid") }} 44 |
45 |
46 | 47 |
48 | 49 | 50 |
51 | {{ $t("sendPage.sendBlock.paymentId.invalid") }} 52 |
53 |
54 | 55 |
56 | 57 |
58 |
59 | 60 |
61 |
62 |
63 |
64 | 65 |
66 |
67 | 68 |
69 |

{{ $t("sendPage.qrCodeScanning.explication") }}

70 |
71 | 72 |
73 |
74 |
75 |
-------------------------------------------------------------------------------- /src_native/hash-ops.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | // 29 | // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers 30 | 31 | #pragma once 32 | 33 | //#if !defined(__cplusplus) 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include "common/int-util.h" 41 | //#include "warnings.h" 42 | 43 | static inline void *padd(void *p, size_t i) { 44 | return (char *) p + i; 45 | } 46 | 47 | static inline const void *cpadd(const void *p, size_t i) { 48 | return (const char *) p + i; 49 | } 50 | 51 | //PUSH_WARNINGS 52 | //DISABLE_VS_WARNINGS(4267) 53 | static_assert(sizeof(size_t) == 4 || sizeof(size_t) == 8, "size_t must be 4 or 8 bytes long"); 54 | static inline void place_length(uint8_t *buffer, size_t bufsize, size_t length) { 55 | if (sizeof(size_t) == 4) { 56 | *(uint32_t *) padd(buffer, bufsize - 4) = swap32be(length); 57 | } else { 58 | *(uint64_t *) padd(buffer, bufsize - 8) = swap64be(length); 59 | } 60 | } 61 | //POP_WARNINGS 62 | 63 | #pragma pack(push, 1) 64 | union hash_state { 65 | uint8_t b[200]; 66 | uint64_t w[25]; 67 | }; 68 | #pragma pack(pop) 69 | static_assert(sizeof(union hash_state) == 200, "Invalid structure size"); 70 | 71 | void hash_permutation(union hash_state *state); 72 | void hash_process(union hash_state *state, const uint8_t *buf, size_t count); 73 | 74 | //#endif 75 | 76 | enum { 77 | HASH_SIZE = 32, 78 | HASH_DATA_AREA = 136 79 | }; 80 | 81 | void cn_fast_hash(const void *data, size_t length, char *hash); 82 | void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int prehashed); 83 | 84 | void hash_extra_blake(const void *data, size_t length, char *hash); 85 | void hash_extra_groestl(const void *data, size_t length, char *hash); 86 | void hash_extra_jh(const void *data, size_t length, char *hash); 87 | void hash_extra_skein(const void *data, size_t length, char *hash); 88 | 89 | void tree_hash(const char (*hashes)[HASH_SIZE], size_t count, char *root_hash); 90 | -------------------------------------------------------------------------------- /src/pages/importFromKeys.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | {{ $t("importFromKeysPage.title") }} 5 |
6 |
7 | {{ $t("importFromKeysPage.subtitle") }} 8 |
9 |
10 |
11 |
12 |
13 |
{{ $t("importBasePage.parametersBlock.title") }}
14 |
15 |
16 | 17 | 18 |
19 | 20 |
21 | 22 | 23 |
24 | {{ $t("global.passwordInvalidRequirements") }} 25 |
26 | 27 |
28 |
29 |
30 | 31 |
32 | 33 | 34 |
35 | {{ $t("importBasePage.parametersBlock.passwordConfirm.invalid") }} 36 |
37 |
38 | 39 |
40 | 41 | 42 |
43 |
44 |
45 |
46 | 47 |
48 |
49 |
{{ $t("importFromKeysPage.keysBlock.titleNotViewOnly") }}
50 |
51 |
52 | 53 | 54 |
55 |
56 | 57 | 58 |
59 | 60 |
61 | 62 |
63 |
64 |
65 |
66 | 67 |
68 |
69 |
{{ $t("importFromKeysPage.keysBlock.titleViewOnly") }}
70 |
71 |
72 | 73 | 74 |
75 |
76 | 77 | 78 |
79 | 80 |
81 | 82 |
83 |
84 |
85 |
86 | 87 |
88 |
-------------------------------------------------------------------------------- /src_native/hash.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | // 29 | // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers 30 | 31 | #pragma once 32 | 33 | #include 34 | #include 35 | 36 | #include "common/pod-class.h" 37 | #include "generic-ops.h" 38 | //#include "hex.h" 39 | //#include "span.h" 40 | 41 | #include "hash-ops.h" 42 | 43 | namespace crypto { 44 | 45 | #pragma pack(push, 1) 46 | POD_CLASS hash { 47 | char data[HASH_SIZE]; 48 | }; 49 | POD_CLASS hash8 { 50 | char data[8]; 51 | }; 52 | #pragma pack(pop) 53 | 54 | static_assert(sizeof(hash) == HASH_SIZE, "Invalid structure size"); 55 | static_assert(sizeof(hash8) == 8, "Invalid structure size"); 56 | 57 | /* 58 | Cryptonight hash functions 59 | */ 60 | 61 | inline void cn_fast_hash(const void *data, std::size_t length, hash &hash) { 62 | cn_fast_hash(data, length, reinterpret_cast(&hash)); 63 | } 64 | 65 | inline hash cn_fast_hash(const void *data, std::size_t length) { 66 | hash h; 67 | cn_fast_hash(data, length, reinterpret_cast(&h)); 68 | return h; 69 | } 70 | 71 | inline void cn_slow_hash(const void *data, std::size_t length, hash &hash, int variant = 0) { 72 | cn_slow_hash(data, length, reinterpret_cast(&hash), variant, 0/*prehashed*/); 73 | } 74 | 75 | inline void cn_slow_hash_prehashed(const void *data, std::size_t length, hash &hash, int variant = 0) { 76 | cn_slow_hash(data, length, reinterpret_cast(&hash), variant, 1/*prehashed*/); 77 | } 78 | 79 | inline void tree_hash(const hash *hashes, std::size_t count, hash &root_hash) { 80 | tree_hash(reinterpret_cast(hashes), count, reinterpret_cast(&root_hash)); 81 | } 82 | 83 | // inline std::ostream &operator <<(std::ostream &o, const crypto::hash &v) { 84 | // epee::to_hex::formatted(o, epee::as_byte_span(v)); return o; 85 | // } 86 | // inline std::ostream &operator <<(std::ostream &o, const crypto::hash8 &v) { 87 | // epee::to_hex::formatted(o, epee::as_byte_span(v)); return o; 88 | // } 89 | } 90 | 91 | CRYPTO_MAKE_HASHABLE(hash) 92 | CRYPTO_MAKE_COMPARABLE(hash8) 93 | -------------------------------------------------------------------------------- /src/model/Translations.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | import {Storage} from "./Storage"; 17 | 18 | export class Translations{ 19 | 20 | static getBrowserLang() : string{ 21 | let browserUserLang = ''+(navigator.language || (navigator).userLanguage); 22 | browserUserLang = browserUserLang.toLowerCase().split('-')[0]; 23 | return browserUserLang; 24 | } 25 | 26 | static getLang() : Promise{ 27 | return Storage.getItem('user-lang', Translations.getBrowserLang()); 28 | } 29 | 30 | static setBrowserLang(lang : string){ 31 | Storage.setItem('user-lang', lang); 32 | } 33 | 34 | static storedTranslations : any = {}; 35 | 36 | static loadLangTranslation(lang : string) : Promise{ 37 | console.log('setting lang to '+lang); 38 | let promise : Promise<{messages?: any, date?: string, number?: string }>; 39 | if(typeof Translations.storedTranslations[lang] !== 'undefined') 40 | promise = Promise.resolve(Translations.storedTranslations[lang]); 41 | else 42 | promise = new Promise<{messages?: any, date?: string, number?: string }>(function (resolve, reject) { 43 | $.ajax({ 44 | url: './translations/' + lang + '.json' 45 | }).then(function (data: any) { 46 | if(typeof data === 'string')data = JSON.parse(data); 47 | Translations.storedTranslations[lang] = data; 48 | resolve(data); 49 | }).fail(function () { 50 | reject(); 51 | }); 52 | }); 53 | 54 | promise.then(function(data: { website?:any,messages?: any, date?: string, number?: string }){ 55 | if (typeof data.date !== 'undefined') 56 | i18n.setDateTimeFormat(lang, data.date); 57 | if (typeof data.number !== 'undefined') 58 | i18n.setNumberFormat(lang, data.number); 59 | if (typeof data.messages !== 'undefined') 60 | i18n.setLocaleMessage(lang, data.messages); 61 | 62 | i18n.locale = lang; 63 | 64 | $('title').html(data.website.title); 65 | $('meta[property="og:title"]').attr('content',data.website.title); 66 | $('meta[property="twitter:title"]').attr('content',data.website.title); 67 | 68 | $('meta[name="description"]').attr('content',data.website.description); 69 | $('meta[property="og:description"]').attr('content',data.website.description); 70 | $('meta[property="twitter:description"]').attr('content',data.website.description); 71 | 72 | 73 | let htmlDocument = document.querySelector('html'); 74 | if (htmlDocument !== null) 75 | htmlDocument.setAttribute('lang', lang); 76 | }); 77 | 78 | return (promise); 79 | } 80 | 81 | } -------------------------------------------------------------------------------- /src/pages/account.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | {{ $t("accountPage.title") }} 5 |
6 |
7 | {{ $t("accountPage.subtitle") }} 8 |
9 |
10 |
11 | 12 |
13 |
14 |
{{(((currentScanBlock+1)/blockchainHeight*1000 | 0) / 10)}}%
15 | 18 |
19 |
20 | 21 |
22 |
23 |
{{ $t("accountPage.balanceBlock.title") }}
24 |
25 | {{ $n(walletAmount / currencyDivider) }} MSR 26 | 27 | {{ (geckoCurrentPrice.market_data.current_price.btc)* (walletAmount / currencyDivider) | satoshis }} 28 | 29 | 30 | 31 | {{ (value) * (walletAmount / currencyDivider) | fiat(currency) }} 32 | 33 | 34 | 35 |
{{ $t("accountPage.balanceBlock.unlocked") }}: {{ $n(unlockedWalletAmount / currencyDivider) }} MSR 36 |
37 |
38 |
39 |
40 | 41 |
42 |
43 |
{{ $t("accountPage.historyBlock.title") }}
44 |
45 | 46 |
47 | 48 | 65 | 66 | 78 | 79 |
67 | {{ $t("accountPage.historyBlock.emptyWallet") }}
68 | 69 | {{ $t("accountPage.historyBlock.waitSync") }} 70 | 73 |
74 | 77 |
80 |
81 | 82 |
83 |
84 |
85 |
86 |
-------------------------------------------------------------------------------- /src_native/common/password.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018, The Monero Project 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are 6 | // permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | // of conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | // used to endorse or promote products derived from this software without specific 17 | // prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27 | // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | // 29 | // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers 30 | 31 | #pragma once 32 | 33 | #include 34 | #include 35 | #include 36 | #include "wipeable_string.h" 37 | 38 | namespace tools 39 | { 40 | class password_container 41 | { 42 | public: 43 | static constexpr const size_t max_password_size = 1024; 44 | 45 | //! Empty password 46 | password_container() noexcept; 47 | 48 | //! `password` is used as password 49 | password_container(std::string&& password) noexcept; 50 | 51 | //! \return A password from stdin TTY prompt or `std::cin` pipe. 52 | static boost::optional prompt(bool verify, const char *mesage = "Password"); 53 | static std::atomic is_prompting; 54 | 55 | password_container(const password_container&) = delete; 56 | password_container(password_container&& rhs) = default; 57 | 58 | //! Wipes internal password 59 | ~password_container() noexcept; 60 | 61 | password_container& operator=(const password_container&) = delete; 62 | password_container& operator=(password_container&&) = default; 63 | 64 | const epee::wipeable_string &password() const noexcept { return m_password; } 65 | 66 | private: 67 | epee::wipeable_string m_password; 68 | }; 69 | 70 | struct login 71 | { 72 | login() = default; 73 | 74 | /*! 75 | Extracts username and password from the format `username:password`. A 76 | blank username or password is allowed. If the `:` character is not 77 | present, `password_container::prompt` will be called by forwarding the 78 | `verify` and `message` arguments. 79 | 80 | \param userpass Is "consumed", and the memory contents are wiped. 81 | \param verify is passed to `password_container::prompt` if necessary. 82 | \param message is passed to `password_container::prompt` if necessary. 83 | 84 | \return The username and password, or boost::none if 85 | `password_container::prompt` fails. 86 | */ 87 | static boost::optional parse(std::string&& userpass, bool verify, const std::function(bool)> &prompt); 88 | 89 | login(const login&) = delete; 90 | login(login&&) = default; 91 | ~login() = default; 92 | login& operator=(const login&) = delete; 93 | login& operator=(login&&) = default; 94 | 95 | std::string username; 96 | password_container password; 97 | }; 98 | } 99 | -------------------------------------------------------------------------------- /src_native/keccak.c: -------------------------------------------------------------------------------- 1 | // keccak.c 2 | // 19-Nov-11 Markku-Juhani O. Saarinen 3 | // A baseline Keccak (3rd round) implementation. 4 | 5 | #include 6 | #include 7 | #include 8 | #include "hash-ops.h" 9 | #include "keccak.h" 10 | 11 | static void local_abort(const char *msg) 12 | { 13 | fprintf(stderr, "%s\n", msg); 14 | #ifdef NDEBUG 15 | _exit(1); 16 | #else 17 | abort(); 18 | #endif 19 | } 20 | 21 | const uint64_t keccakf_rndc[24] = 22 | { 23 | 0x0000000000000001, 0x0000000000008082, 0x800000000000808a, 24 | 0x8000000080008000, 0x000000000000808b, 0x0000000080000001, 25 | 0x8000000080008081, 0x8000000000008009, 0x000000000000008a, 26 | 0x0000000000000088, 0x0000000080008009, 0x000000008000000a, 27 | 0x000000008000808b, 0x800000000000008b, 0x8000000000008089, 28 | 0x8000000000008003, 0x8000000000008002, 0x8000000000000080, 29 | 0x000000000000800a, 0x800000008000000a, 0x8000000080008081, 30 | 0x8000000000008080, 0x0000000080000001, 0x8000000080008008 31 | }; 32 | 33 | const int keccakf_rotc[24] = 34 | { 35 | 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, 36 | 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 37 | }; 38 | 39 | const int keccakf_piln[24] = 40 | { 41 | 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, 42 | 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 43 | }; 44 | 45 | // update the state with given number of rounds 46 | 47 | void keccakf(uint64_t st[25], int rounds) 48 | { 49 | int i, j, round; 50 | uint64_t t, bc[5]; 51 | 52 | for (round = 0; round < rounds; round++) { 53 | 54 | // Theta 55 | for (i = 0; i < 5; i++) 56 | bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20]; 57 | 58 | for (i = 0; i < 5; i++) { 59 | t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1); 60 | for (j = 0; j < 25; j += 5) 61 | st[j + i] ^= t; 62 | } 63 | 64 | // Rho Pi 65 | t = st[1]; 66 | for (i = 0; i < 24; i++) { 67 | j = keccakf_piln[i]; 68 | bc[0] = st[j]; 69 | st[j] = ROTL64(t, keccakf_rotc[i]); 70 | t = bc[0]; 71 | } 72 | 73 | // Chi 74 | for (j = 0; j < 25; j += 5) { 75 | for (i = 0; i < 5; i++) 76 | bc[i] = st[j + i]; 77 | for (i = 0; i < 5; i++) 78 | st[j + i] ^= (~bc[(i + 1) % 5]) & bc[(i + 2) % 5]; 79 | } 80 | 81 | // Iota 82 | st[0] ^= keccakf_rndc[round]; 83 | } 84 | } 85 | 86 | // compute a keccak hash (md) of given byte length from "in" 87 | typedef uint64_t state_t[25]; 88 | 89 | void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen) 90 | { 91 | state_t st; 92 | uint8_t temp[144]; 93 | size_t i, rsiz, rsizw; 94 | 95 | static_assert(HASH_DATA_AREA <= sizeof(temp), "Bad keccak preconditions"); 96 | if (mdlen <= 0 || (mdlen > 100 && sizeof(st) != (size_t)mdlen)) 97 | { 98 | local_abort("Bad keccak use"); 99 | } 100 | 101 | rsiz = sizeof(state_t) == mdlen ? HASH_DATA_AREA : 200 - 2 * mdlen; 102 | rsizw = rsiz / 8; 103 | 104 | memset(st, 0, sizeof(st)); 105 | 106 | for ( ; inlen >= rsiz; inlen -= rsiz, in += rsiz) { 107 | for (i = 0; i < rsizw; i++) 108 | st[i] ^= ((uint64_t *) in)[i]; 109 | keccakf(st, KECCAK_ROUNDS); 110 | } 111 | 112 | // last block and padding 113 | if (inlen + 1 >= sizeof(temp) || inlen > rsiz || rsiz - inlen + inlen + 1 >= sizeof(temp) || rsiz == 0 || rsiz - 1 >= sizeof(temp) || rsizw * 8 > sizeof(temp)) 114 | { 115 | local_abort("Bad keccak use"); 116 | } 117 | 118 | memcpy(temp, in, inlen); 119 | temp[inlen++] = 1; 120 | memset(temp + inlen, 0, rsiz - inlen); 121 | temp[rsiz - 1] |= 0x80; 122 | 123 | for (i = 0; i < rsizw; i++) 124 | st[i] ^= ((uint64_t *) temp)[i]; 125 | 126 | keccakf(st, KECCAK_ROUNDS); 127 | 128 | memcpy(md, st, mdlen); 129 | } 130 | 131 | void keccak1600(const uint8_t *in, size_t inlen, uint8_t *md) 132 | { 133 | keccak(in, inlen, md, sizeof(state_t)); 134 | } 135 | -------------------------------------------------------------------------------- /src/pages/settings.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | {{ $t("settingsPage.title") }} 5 |
6 |
7 | {{ $t("settingsPage.subtitle") }} 8 |
9 |
10 |
11 |
12 |
13 |
14 |
{{ $t("settingsPage.versionBlock.versionNumber") }}{{nativeVersionNumber}}
15 |
{{ $t("settingsPage.versionBlock.versionCode") }}{{nativeVersionCode}}
16 |
17 |
18 |
19 | 20 |
21 |
22 |
23 |
24 | 25 | 36 |
37 |
38 |
39 |
40 | 41 |
42 |
43 |
44 |
45 | 46 | 57 |
58 |
59 |
60 |
61 | 62 |
63 |
64 |
65 |
66 | 67 | 73 |
74 |
75 | 76 | 77 |
78 |
79 |
80 |
81 | 82 |
83 | 88 |
89 | 90 |
91 |
92 |
93 | 94 |
95 |
96 |
97 | 98 |
99 |
100 |
101 |
102 | 103 | 104 |
105 |
106 | 107 | 108 |
109 |
110 | 111 |
112 |
113 |
114 |
115 |
116 |
117 | -------------------------------------------------------------------------------- /src_client_api/api.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | var MasariApi = new function(){ 17 | 18 | this.ready = false; 19 | this.apiDomain = 'http://localhost:38090'; 20 | this.timeoutErrorTime = 10000; 21 | this.timeoutError = 10000; 22 | 23 | var self = this; 24 | 25 | this.promisesResolves = {}; 26 | this.promisesReject = {}; 27 | 28 | this.iframe = null; 29 | this.popupParameters = undefined; 30 | // this.popupParameters = "menubar=no, status=no, scrollbars=no, menubar=no, width=200, height=100"; 31 | 32 | this.registerPromise = function(eventName, resolve, reject){ 33 | this.promisesReject[eventName] = reject; 34 | this.promisesResolves[eventName] = resolve; 35 | }; 36 | 37 | this.unregisterPromise = function(eventName){ 38 | if(typeof this.promisesReject[eventName] !== 'undefined') delete this.promisesReject[eventName]; 39 | if(typeof this.promisesResolves[eventName] !== 'undefined') delete this.promisesResolves[eventName]; 40 | }; 41 | 42 | this.init = function(){ 43 | window.addEventListener('message', function(e){ 44 | if(e.origin === self.apiDomain){ 45 | console.log(e); 46 | var eventType = e.data.type; 47 | var eventData = e.data.payload; 48 | console.log('event type:',eventType); 49 | // if(eventType === 'ready'){ 50 | self.promisesResolves[eventType](eventData); 51 | self.unregisterPromise(eventType); 52 | // } 53 | } 54 | }); 55 | 56 | return new Promise(function(resolve, reject){ 57 | self.registerPromise('ready', resolve, reject); 58 | var ifrm = document.createElement("iframe"); 59 | ifrm.setAttribute("src", self.apiDomain+"/api.html"); 60 | ifrm.style.width = "0"; 61 | ifrm.style.height = "0"; 62 | ifrm.style.display = 'none'; 63 | 64 | self.timeoutError = setTimeout(function(){ 65 | self.promisesReject['ready'](eventData); 66 | self.unregisterPromise('ready'); 67 | },self.timeoutErrorTime); 68 | 69 | ifrm.addEventListener('load', function(){ 70 | clearTimeout(self.timeoutError); 71 | self.timeoutError = 0; 72 | }); 73 | 74 | self.iframe = ifrm; 75 | document.body.appendChild(ifrm); 76 | }); 77 | }; 78 | 79 | this.hasWallet = function(){ 80 | return new Promise(function(resolve, reject){ 81 | self.registerPromise('hasWallet', resolve, reject); 82 | self.iframe.contentWindow.postMessage('hasWallet', '*'); 83 | }); 84 | }; 85 | 86 | this.makeTransfer = function(options){ 87 | var url = this.apiDomain+'/#!send?'; 88 | if(typeof options.amount !== 'undefined')url += 'amount='+options.amount+'&'; 89 | if(typeof options.address !== 'undefined')url += 'address='+options.address+'&'; 90 | if(typeof options.description !== 'undefined')url += 'txDesc='+options.description+'&'; 91 | if(typeof options.destName !== 'undefined')url += 'destName='+options.destName+'&'; 92 | 93 | window.open(url,"Masari",this.popupParameters); 94 | 95 | return Promise.resolve(); 96 | }; 97 | 98 | }; -------------------------------------------------------------------------------- /src/pages/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Gnock 3 | * Copyright (c) 2018, The Masari Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | * 11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | */ 15 | 16 | import {WalletRepository} from "../model/WalletRepository"; 17 | import {DependencyInjectorInstance} from "../lib/numbersLab/DependencyInjector"; 18 | import {VueRequireFilter, VueVar} from "../lib/numbersLab/VueAnnotate"; 19 | import {DestructableView} from "../lib/numbersLab/DestructableView"; 20 | import {Wallet} from "../model/Wallet"; 21 | import {AppState} from "../model/AppState"; 22 | 23 | let wallet : Wallet = DependencyInjectorInstance().getInstance(Wallet.name,'default', false); 24 | if(wallet !== null){ 25 | window.location.href = '#account'; 26 | } 27 | 28 | class IndexView extends DestructableView{ 29 | @VueVar(false) hasLocalWallet !: boolean; 30 | @VueVar(false) isWalletLoaded !: boolean; 31 | 32 | constructor(container : string){ 33 | super(container); 34 | this.isWalletLoaded = DependencyInjectorInstance().getInstance(Wallet.name,'default', false) !== null; 35 | WalletRepository.hasOneStored().then((status : boolean)=>{ 36 | this.hasLocalWallet = status; 37 | }); 38 | // this.importWallet(); 39 | AppState.disableLeftMenu(); 40 | } 41 | 42 | destruct(): Promise { 43 | return super.destruct(); 44 | } 45 | 46 | loadWallet(){ 47 | AppState.askUserOpenWallet(); 48 | } 49 | 50 | } 51 | 52 | let newIndexView = new IndexView('#app'); 53 | 54 | 55 | /* 56 | function readFile(fileEnty:any){ 57 | console.log(fileEnty); 58 | } 59 | 60 | function writeFile(fileEntry, dataObj) { 61 | // Create a FileWriter object for our FileEntry (log.txt). 62 | fileEntry.createWriter(function (fileWriter) { 63 | 64 | fileWriter.onwriteend = function() { 65 | console.log("Successful file write..."); 66 | readFile(fileEntry); 67 | }; 68 | 69 | fileWriter.onerror = function (e) { 70 | console.log("Failed file write: " + e.toString()); 71 | }; 72 | 73 | // If data object is not passed in, 74 | // create a new Blob instead. 75 | if (!dataObj) { 76 | dataObj = new Blob(['some file data'], { type: 'text/plain' }); 77 | } 78 | 79 | fileWriter.write(dataObj); 80 | }); 81 | } 82 | 83 | function onErrorCreateFile(error){ 84 | alert('onErrorCreateFile:'+JSON.stringify(error)); 85 | } 86 | function onErrorLoadFs(error){ 87 | alert('onErrorLoadFs:'+JSON.stringify(error)); 88 | } 89 | 90 | 91 | window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs : any) { 92 | 93 | console.log('file system open: ' + fs.name); 94 | fs.root.getFile(cordova.file.documentsDirectory+"newPersistentFile.txt", { create: true, exclusive: false }, function (fileEntry : any) { 95 | 96 | console.log("fileEntry is file?" + fileEntry.isFile.toString()); 97 | // fileEntry.name == 'someFile.txt' 98 | // fileEntry.fullPath == '/someFile.txt' 99 | writeFile(fileEntry, null); 100 | 101 | }, onErrorCreateFile); 102 | 103 | }, onErrorLoadFs); 104 | 105 | */ --------------------------------------------------------------------------------