Skip to content

Commit

Permalink
Merge pull request #57 from bitgreen/release/1.3.0
Browse files Browse the repository at this point in the history
Release/1.3.0
  • Loading branch information
XeZZoR authored Jun 17, 2024
2 parents 8b0b75c + 54b7878 commit 569c9f6
Show file tree
Hide file tree
Showing 272 changed files with 26,546 additions and 15,991 deletions.
7 changes: 7 additions & 0 deletions .atom/config.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"*":
editor:
tabLength: 2
softTabs: true
".css.source, .scss.source, .html.source":
editor:
tabLength: 4
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
indent_style = space
indent_size = 2

[*.css]
indent_size = 4

[*.scss]
indent_size = 4

[*.html]
indent_size = 4
7 changes: 7 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set tabsize 2
set tabstospaces

syntax "css" "\.(css|scss)$"
set tabsize 4

syntax "html" "\.html$"
set tabsize 4
17 changes: 17 additions & 0 deletions .sublime-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"tab_size": 2,
"translate_tabs_to_spaces": true,
"settings": {
"syntax_specific": {
"*.css": {
"tab_size": 4
},
"*.scss": {
"tab_size": 4
},
"*.html": {
"tab_size": 4
}
}
}
}
5 changes: 5 additions & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set tabstop=2
set shiftwidth=2
set expandtab

autocmd FileType css,scss,html setlocal tabstop=4 shiftwidth=4 expandtab
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"[css]": {
"editor.tabSize": 4
},
"[scss]": {
"editor.tabSize": 4
},
"[html]": {
"editor.tabSize": 4
}
}
50 changes: 32 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Bitgreen Browser Wallet

Bitgreen Browser extension with wallet functionalities.
Bitgreen Browser extension and android, iOS hybrid apps with wallet functionalities.

The Bitgreen Browser Wallet is a browser extension that allows users to create wallets, send and receive funds, and make
disbursements to the Bitgreen ecosystem in order to create, sell, purchase and retire Verified Carbon Credits (VCUs). To
incorporate this functionality into your own project, please see the technical description below. If you require any
assistance using these features, or this repo, please contact us at [contact], we are happy to assist.
The Bitgreen Browser Wallet is a browser extension, android and iOS app that allows users to create wallets, send and receive funds, and make disbursements to the Bitgreen ecosystem in order to create, sell, purchase and retire Verified Carbon Credits (VCUs). To incorporate this functionality into your own project, please see the technical description below. If you require any assistance using these features, or this repo, please [contact us](https://bitgreen.org/contact), we are happy to assist.

### Features:

Expand All @@ -28,6 +25,12 @@ assistance using these features, or this repo, please contact us at [contact], w

___

## Quickstart
- `npm run setup` installs all npm packages and initializes app platforms
- `npm run dev:{target}` builds development build and runs watchdog for the desired target (chrome, firefox, safari, android, ios)

___

## Browser Compatibility

The wallet extension is available for the following browsers:
Expand All @@ -37,13 +40,22 @@ The wallet extension is available for the following browsers:
- Safari (Desktop and Mobile version)
- Edge (compatible with Chrome Extension)
- Brave (compatible with Chrome Extension)
- Other Browsers based on Chrome Engine
- Other Browsers based on chromium Engine

___

## OS Compatability

The wallet app is available on the following operating systems:

- android
- iOS

___

## Project Structure

- **packages/browser-wallet-base** - Extension base structure.
- **packages/browser-wallet-base** - Extension base structure, including capacitorjs project and webpack configs.
- **packages/browser-wallet-core** - Main features mostly used for background tasks, stores, API messaging.
- **packages/browser-wallet-ui** - The UI components for the extension.
- **packages/browser-wallet-utils** - Helpers and utilities for both UI and background.
Expand All @@ -53,35 +65,37 @@ ___
## Developing & Building

Install [node.js >18.12](https://nodejs.org).
Install the required dependencies from the root for this repo, by running the following command:
Install the required dependencies and initialize the capacitorjs project from the root for this repo, by running the following command:

```bash
npm install
npm run setup
```

More detailed information to the build process can be found [here](packages/browser-wallet-base/readme.md)

## Versioning

Please see [browser-wallet-base README](packages/browser-wallet-base/readme.md#versioning) for detailed information

### Production Build

You can build all versions of extensions, and output will be located at `/build` directory, where each sub folder
represents each browser extension type:
You can build all production versions of extensions and apps, and output will be located at `/build` directory, where each sub folder represents each browser extension type or app platform:

```bash
npm run build
npm run build:all
```

You can also specify which version to build. There is 3 possible versions of this extension: `chrome`, `firefox`
and `safari`.
You can also specify which version to build. There is 3 possible versions of this extension/app: `chrome`, `firefox`, `safari`, `android` and `ios`.

```bash
npm run build:chrome
npm run build:{target}
```

___

### Development

Also, you can use the `npm run dev:chrome` to start the local development of the extension. Please keep in mind that in
this case, you need to specify browser type. Webpack will be running with `--watch` flag set to true. Output directory
is the same (read above).
Also, you can use the `npm run dev:{target}` to start the local development of the extension/app. Please keep in mind that in this case, you need to specify browser type or app platform. Webpack will be running with `watch` flag set to true and inline-sourcemaps for all JS and SCSS files. Output directory is the same (read above).
___

## Wallet Docs
Expand Down
54 changes: 29 additions & 25 deletions authentication-server/BrowserWallet-Authentication-Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,46 @@ const { cryptoWaitReady, signatureVerify } = require('@polkadot/util-crypto');
const {stringToU8a,hexToU8a} = require('@polkadot/util');
// set limit of authentication from the same ip address, 5 attempts each minute
const limiter = RateLimit({
windowMs: 1*60*1000, // 1 minute
windowMs: 60000, // 1 minute
max: 5
});

// create web server object
let app = express();

// apply rate limiter to all requests
app.use(limiter);

mainloop();
async function mainloop(){
console.log("[info] - Browser Wallet/ Authentication Server - ver. 1.00 - Starting");
await cryptoWaitReady();
app.use(bodyParser.urlencoded({ extended: true }));
//check authentication
app.post('/',async function(req, res) {
BrowserWalletToken="";
if (typeof req.body.BrowserWalletToken != 'undefined'){
BrowserWalletToken=DOMPurify.sanitize(req.body.BrowserWalletToken);
bj=JSON.parse(BrowserWalletToken);
// verify signature
const signature=hexToU8a(bj.signature);
const message=stringToU8a(bj.message)
if(signatureVerify(message, signature,bj.address).isValid) {
res.send("Authentication is valid for:"+bj.address);
}else {
res.send("Authentication is NOT valid for:"+bj.address);
}

}else {
res.send("BrowserWalletToken has not been received");
console.log("[info] - Browser Wallet/ Authentication Server - ver. 1.00 - Starting");
await cryptoWaitReady();
app.use(bodyParser.urlencoded({ extended: true }));

//check authentication
app.post('/',async function(req, res) {
BrowserWalletToken="";
if (typeof req.body.BrowserWalletToken != 'undefined'){
BrowserWalletToken=DOMPurify.sanitize(req.body.BrowserWalletToken);
bj=JSON.parse(BrowserWalletToken);

// verify signature
const signature=hexToU8a(bj.signature);
const message=stringToU8a(bj.message)
if(signatureVerify(message, signature,bj.address).isValid) {
res.send("Authentication is valid for:" + bj.address);
}else {
res.send("Authentication is NOT valid for:" + bj.address);
}
});
// listening to server port
console.log("[info] - listening for connections on port TCP/3001...");
app.listen(3001,function() {});

}else {
res.send("BrowserWalletToken has not been received");
}
});

// listening to server port
console.log("[info] - listening for connections on port TCP/3001...");
app.listen(3001,function() {});
}


Loading

0 comments on commit 569c9f6

Please sign in to comment.