Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
hazae41 committed Sep 6, 2024
0 parents commit 3b9e31c
Show file tree
Hide file tree
Showing 35 changed files with 5,608 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* linguist-vendored=true
*.ts linguist-vendored=false
*.rs linguist-vendored=false
dist/* linguist-vendored=true
pkg/* linguist-vendored=true
17 changes: 17 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on: [push]

name: commit

jobs:
check:
name: check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: 'docker compose up --build --exit-code-from app'
- run: 'git status --porcelain'
- uses: actions/upload-artifact@v3
with:
name: pkg
path: ./src/wasm/pkg/
- run: '[[ -z $(git status --porcelain) ]]'
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
push:
tags:
- '*'

name: release

jobs:
check:
name: check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: "npm ci"
- run: "npm diff --diff=@brumemoney/wallet.wasm@${{github.ref_name}} --diff=."
- run: "[[ -z $(npm diff --diff=@brumemoney/wallet.wasm@${{github.ref_name}} --diff=.) ]]"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules
/dist

.DS_Store
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rust-analyzer.linkedProjects": [
"./src/wasm/Cargo.toml"
]
}
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM rust:1.80.1

WORKDIR /app

RUN apt update
RUN apt install -y rsync

RUN cargo install wasm-pack

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

ENV NVM_DIR=/root/.nvm
ENV NODE_VERSION=22.6.0

RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}

ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"

CMD npm ci && npm run build
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.

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 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.

For more information, please refer to <http://unlicense.org/>
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# wallet.wasm

WebAssembly bundle for Wallet

```bash
npm i @brumemoney/wallet.wasm
```

[**Node Package 📦**](https://www.npmjs.com/package/@brumemoney/wallet.wasm)

## Features
- Reproducible building
- Pre-bundled and streamed
- Zero-copy memory slices

## Bundles
- network.wasm
- base16.wasm
- base58.wasm
- base64.wasm
- ed25519.wasm
- x25519.wasm
- sha1.wasm
- sha3.wasm
- secp256k1.wasm
- ripemd.wasm
- chacha20poly1305.wasm

## Algorithms
- Network
- Base16
- Base58
- Base64
- Ed25519
- X25519
- SHA-1
- SHA-3
- Secp256k1
- Ripemd160
- ChaCha20-Poly1305

## Building

### Unreproducible building

You need to install [Rust](https://www.rust-lang.org/tools/install)

Then, install [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)

```bash
cargo install wasm-pack
```

Finally, do a clean install and build

```bash
npm ci && npm run build
```

### Reproducible building

You can build the exact same bytecode using Docker, just be sure you're on a `linux/amd64` host

```bash
docker compose up --build
```

Then check that all the files are the same using `git status`

```bash
git status --porcelain
```

If the output is empty then the bytecode is the same as the one I commited

### Automated checks

Each time I commit to the repository, the GitHub's CI does the following:
- Clone the repository
- Reproduce the build using `docker compose up --build`
- Throw an error if the `git status --porcelain` output is not empty

Each time I release a new version tag on GitHub, the GitHub's CI does the following:
- Clone the repository
- Do not reproduce the build, as it's already checked by the task above
- Throw an error if there is a `npm diff` between the cloned repository and the same version tag on NPM

If a version is present on NPM but not on GitHub, do not use!
11 changes: 11 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Security Policy

## Supported Versions

| Version | Supported |
| ------- | ------------------ |
| 1.x | :white_check_mark: |

## Reporting a Vulnerability

Contact me at [email protected] or [email protected] or on Twitter @hazae41
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.8"

services:
app:
build: .
volumes:
- ".:/app"
Loading

0 comments on commit 3b9e31c

Please sign in to comment.