open-index/open-npm huggingface dataset:
npm package: @solar-republic/bc-ur
Description: A JS implementation of the Uniform Resources (UR) specification from Blockchain Commons
Author: Antonis Poulakis
Latest version: 1.1.6-patch.0

# BC-UR

This repository is an implementation of the BC-UR encoding, following the [C++ implementation](https://github.com/BlockchainCommons/bc-ur) and trying to provide a similar API for Javascript/Typescript usage.

## Installing

To install, run:
```bash
yarn add @ngraveio/bc-ur
```

## Quick Start

### Encode a message

```js
import {UR, UREncoder} from '@ngraveio/bc-ur'

const message = {any: 'property'}
const messageBuffer = Buffer.from(JSON.stringify(message))

// First step is to create a UR object from a Buffer
const ur = UR.fromBuffer(messageBuffer)

// Then, create the UREncoder object

// The maximum amount of fragments to be generated in total
const maxFragmentLength = 150

// The index of the fragment that will be the first to be generated
// If it's more than the "maxFragmentLength", then all the subsequent fragments will only be
// fountain parts
const firstSeqNum = 0

// Create the encoder object
const encoder = new UREncoder(ur, maxFragmentLength, firstSeqNum)

// Keep generating new parts, until a condition is met; for example the user exits the page, or clicks "DONE"
while(!stop) {
  // get the next part in the sequence
  let part = encoder.nextPart()

  // get the part as a string containing the cbor payload and display it with whatever way
  // the part looks like this:
  // ur:bytes/1-9/lpadascfadaxcywenbpljkhdcahkadaemejtswhhylkepmykhhtsytsnoyoyaxaedsuttydmmhhpktpmsrjtdkgslpgh

  displayPart(part)
}
```

### Decode a message

```js
import {URDecoder} from '@ngraveio/bc-ur'

// Create the decoder object
const decoder = new URDecoder()

do {
  // Scan the part from a QRCode
  // the part should look like this:
  // ur:bytes/1-9/lpadascfadaxcywenbpljkhdcahkadaemejtswhhylkepmykhhtsytsnoyoyaxaedsuttydmmhhpktpmsrjtdkgslpgh
  const part = scanQRCode()

  // register the new part with the decoder
  decoder.receivePart(part)

  // check if all the necessary parts have been received to successfully decode the message
} while (!decoder.isComplete())

// If no error has been found
if (decoder.isSuccess()) {
  // Get the UR representation of the message
  const ur = decoder.resultUR()

  // Decode the CBOR message to a Buffer
  const decoded = ur.decodeCBOR()

  // get the original message, assuming it was a JSON object
  const originalMessage = JSON.parse(decoded.toString())
}
else {
  // log and handle the error
  const error = decoder.resultError()
  console.log('Error found while decoding', error)
  handleError(error)
}

```
npm package: @solar-republic/cbor-sync
Description: CBOR encode/decode (synchronous, semantic, browser-compatible)
Latest version: 1.0.4-patch.0

# Encode/decode CBOR

[![Build Status](https://travis-ci.org/ARMmbed/cbor-sync.svg?branch=master)](https://travis-ci.org/ARMmbed/cbor-sync) [![NPM version](https://badge.fury.io/js/cbor-sync.png)](http://badge.fury.io/js/cbor-sync)

This package provides an extensible CBOR encoder/decoder.

## Usage

```javascript
var CBOR = require('cbor-sync');

var encodedBuffer = CBOR.encode({hello: 'world'});
var decodedObject = CBOR.decode(encodedBuffer);
```

## `toCBOR()`

Much like the `toJSON()` method, which allows objects to provide a replacement representation for encoding, this package checks for a `toCBOR()` method.

Note that this step happens *after* any semantic-tagging/-replacement step, so a custom semantic encoder will always override an objects built-in `toCBOR()` method.

## Semantic extensions

CBOR provides a limited set of basic types (similar to JSON), but provides semantic tagging (optional for both encoder/decoder) that lets you annotate parts of the data so they can be decoded appropriately.

Here is an example (from this module) for encoding Date objects as ISO strings:

```javascript
// 0 is the CBOR semantic tag number for date/time strings: https://tools.ietf.org/html/rfc7049#section-2.4
CBOR.addSemanticEncode(0, function (data) {
	if (data instanceof Date) {
		return data.toISOString();
	}
});
CBOR.addSemanticDecode(0, function (dateString) {
	return new Date(dateString);
});
```

## Known issues

* All floats encoded as 64-bit, regardless of whether they strictly need to be
npm package: @solar-republic/kelvin
Description: Encrypted NoSQL DBMS backed by JSON key-value store written in TypeScript for the Web
Author: Blake Regalia
Latest version: 0.1.0

# Kelvin

An encrypted, shardable NoSQL database management system (affectionally referred to as a "Vault") backed by primitive key-value storage, with padded entries and obfuscated storage access.

## Background

Designed to meet a very sepcific set of requirements:
 - All contents must be encrypted
 - Backing storage layer is a primitive key-value store, where the values can only be strings/bytes/JSON, e.g., `localStorage`, `chrome.storage.local.`, and so on
 - Database is self-describing and migrateable, i.e., no client-side dependencies, no hard-coded schemas
 - Allows for arbitrary "intra-and-inter-table" indexes
 - Must treat relations as first-class citizens
 - Must be transactional, idemptotent, and capable of rollback or recovery on failure (e.g., as a result of an interuptted transaction)
 - Must be resistant to storage access pattern analysis

Additional objectives:
 - Minimize storage footprint on disk
 - Simple and developer-friendly API
 - Performant reads

Details:
 - Data is sharded across key-value entries using padded & encrypted "buckets" (all buckets have a constant size on disk, making them indistinguishable from one another)
 - All key-value entries are routinely re-encrypted using nonces, including after each batch of write operations. This helps protect against storage access pattern analysis for writes, however currently no consideration is made for reads
 - The plaintext form of all data and metadata are serialized as JSON (as opposed to a more space-efficient format such as CBOR) in order to take advantage of the inherently more performant JSON ser/de methods. Consequently, tuples (e.g., `[a, b]`) are often used to store the bulk of data
 - The schema of an object is stored in the metadata of its containing Bucket. This provides the means for applications to be able to read from older versions. Applications can migrate data to new schemas, such as deleting properties, adding new properties, changing property names or types, etc. However, this process is left up to the developer and must be excercised with caution


Terminology relevant to API consumers:
 - **Item** - roughly equivalent to a Row in RDBMS, or an Object in Document-oriented DBMS. Capable of storing anything that can be serialized to a JSON object
 - **Domain** - roughly equivalent to a Table in RDBMS. Describes a collection of Items that share the same shape of their top-level object properties (i.e., the shapes of nested objects may differ)


Terminology relevant to contributors:
 - **Bucket** - logically organizes the storage of Items such that any Domain can be sharded across entries in the backing key-value store
 - **Sequence** - an immutable, sparse, distinct array of strings where each position corresponds to a value's key, e.g., `["~RESERVED~", "alice", "bob"]` represents `{1: "alice", 2: "bob"}` and its inverse: `{"alice": 1, "bob": 2}`