@veive-io/verifier-p256

1.0.0 • Public • Published

Veive p256 verifier CPP

This is the "verifier" contract within the Veive project.

The project consists of providing koinos users with transparent onboarding and usage through the implementation of the WebauthN protocol.

"Verifier" is a smart contract in C++ format that implements the p-256 signature verification method which is the most used algorithm in the webauthn standard.

The "verify" method requires only 3 parameters (signature, public_key, msg) and provides a boolean as output.

It is called directly from the user's smart wallet contract for transaction verification and general authentication.

Building

Dependencies

It is recommended to place all dependencies in the ~/opt directory. You must have python3-venv installed on your system. For example you can use the command sudo apt install python3-venv on Ubuntu.

When all dependencies are properly installed your ~/opt directory should look like this;

ls ~/opt
EmbeddedProto  koinos-sdk  protobuf-3.17.3  wasi-sdk-12.0

Koinos SDK and WASI SDK

To build the nub verifier, you must first build and install the SDK. Follow the instructions on the README.

Protobuf 3.17.3

Clone, build, and install protobuf-3.17.3 from the Protobuf repository.

git clone --recursive https://github.com/protocolbuffers/protobuf.git
cd protobuf
git checkout v3.17.3
git submodule update --init --recursive
git clean -df
cd cmake
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/opt/protobuf-3.17.3
make -j install

EmbeddedProto

Clone the repo (EmbeddedProto)[https://github.com/koinos/EmbeddedProto.git] and checkout the negative-enums branch.

git clone --recursive https://github.com/koinos/EmbeddedProto.git
cd EmbeddedProto
git checkout negative-enums

Environment variables

Prior to invoking the build command, set the following variables:

export KOINOS_WASI_SDK_ROOT=~/opt/wasi-sdk-12.0
export KOINOS_SDK_ROOT=~/opt/koinos-sdk
export KOINOS_PROTOBUF_ROOT=~/opt/protobuf-3.17.3
export KOINOS_EMBEDDED_PROTO_ROOT=~/opt/EmbeddedProto

Or simply source .env from inside the project directory.

Executing the build with CMake

Run the following commands to do an out of source cmake build.

mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=${KOINOS_SDK_ROOT}/cmake/koinos-wasm-toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
make -j

.wasm binaries are in your build directory and are ready to be uploaded to Koinos.

Assembly usage

The assembly interfaces, abi and wasm are published in npm package @veive/verifier-p256. You can use the interfaces inside your assemblyscript smart contract.

import { verifier, IVerifier } from "@veive/verifier-p256-cpp"

Readme

Keywords

none

Package Sidebar

Install

npm i @veive-io/verifier-p256

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

90.9 kB

Total Files

15

Last publish

Collaborators

  • relisyss
  • adrianofoschi