open-index/open-npm huggingface dataset:
npm package: @ocap/mcrypto
Description: Crypto lib that provides signer,crypter,hasher interface
Author: wangshijun
Latest version: 1.29.24

![mcrypto:js](https://www.arcblock.io/.netlify/functions/badge/?text=mcrypto:js)

[![docs](https://img.shields.io/badge/powered%20by-arcblock-green.svg)](https://docs.arcblock.io)
[![Gitter](https://badges.gitter.im/ArcBlock/community.svg)](https://gitter.im/ArcBlock/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

> Forge [mcrypto](https://github.com/ArcBlock/mcrypto) implementation for javascript, just a wrapper around existing javascript crypto libraries.

## Usage

```shell
npm i @ocap/mcrypto -S
# OR
bun install @ocap/mcrypto
```

### Sign/Verify

```javascript
const { Signer } = require('@ocap/mcrypto');

const keyPair = Signer.Ed25519.genKeyPair();
const message = 'some message to sign';
const signature = Signer.Ed25519.sign(message, keyPair.secretKey);
const result = Signer.Ed25519.verify(message, signature, keyPair.publicKey);
assert.ok(result);
```

### Hashing

```javascript
const { Hasher } = require('@ocap/mcrypto');

const message = 'message to hash';
const hash = Hasher.SHA2.hash256(message);
```

## Documentation

For full documentation, checkout [https://asset-chain.netlify.com](https://asset-chain.netlify.com/)

## Implementation

### Hasher

- keccakf1600: js-sha3
- sha2: hash.js
- sha3: js-sha3

### Signer

- [`ed25519`](https://github.com/ArcBlock/blockchain/commit/ed25519): tweetnacl
- secp256k1: elliptic

### Crypter

- aes-cbc-256: crypto-js
npm package: @ocap/message
Description: Utility functions to encode and decode message that can send to forge
Author: wangshijun
Latest version: 1.29.24

![forge-message](https://www.arcblock.io/.netlify/functions/badge/?text=forge-message)

[![docs](https://img.shields.io/badge/powered%20by-arcblock-green.svg)](https://docs.arcblock.io)
[![Gitter](https://badges.gitter.im/ArcBlock/community.svg)](https://gitter.im/ArcBlock/community?utm_source=badge\&utm_medium=badge\&utm_campaign=pr-badge)

> Utility function to encode and format message that can be sent to or received from forge framework.


## Table of Contents

* [Install](#install)
* [Usage](#usage)
* [Documentation](#documentation)
* [Contributors](#contributors)


## Install

```sh
npm i @ocap/message
// OR
bun install @ocap/message
```


## Usage

```js
const { createMessage, formatMessage } = require('@ocap/message');

const message = createMessage('Transaction', {
  from: '',
  nonce: 0,
  signature: 'abc',
  itx: {
    type: 'TransferTx',
    value: {
      to: '2019-04-25',
    },
  },
});

const buffer = message.serializeBinary();
// Then: send the buffer over the wire
```


## Documentation

For full documentation, checkout [https://asset-chain.netlify.com](https://asset-chain.netlify.com/)


## Contributors

| Name           | Website                         |
| -------------- | ------------------------------- |
| **wangshijun** | <https://github.com/wangshijun> |
npm package: @ocap/proto
Description: Static modules generated from forge-sdk protobuf files
Author: wangshijun
Latest version: 1.29.24

# Core Schema

Defines data structure for Blocklet Server backend API, and maintains schema for GQL endpoint.

## Development

### Install gun-sed

- Mac: brew install gnu-sed
- Other platform: https://www.gnu.org/software/sed/

### Install protobuf

- Mac: brew install protobuf
- Other platform: https://developers.google.com/protocol-buffers/docs/downloads

### Add to `~/.profile`

```
export GO111MODULE=on
export GOPROXY=https://goproxy.cn

export GOROOT=/usr/local/Cellar/go/1.15.5/libexec // you local go path
export GOPATH=$HOME/.golang
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN
PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
```

source ~/.profile

### Install other dependencies

Run `make init`

> If there is a network problem, try to change golang registry by https://goproxy.cn/

### Build Schema

Run `make build`

## How To Update Schema

### 1. update core/schema proto

After update the schema proto, run `make build` get the latest schema.

### 2. go to core/gql start a demo endpoint

just run：

```
node demo.js
```

> should make sure the DB Proxy is running

### 3. go to core/client do finally update

just run:

```
npm run upgrade
```

### 4. finish the update