open-index/open-npm huggingface dataset:
npm package: @meproto/cbor
Description: CBOR encoding and decoding utilities for ME Protocol, DID:ME, and credential serialization.
Latest version: 0.0.1

# **@meproto/cbor**

[![npm version](https://img.shields.io/npm/v/%40meproto%2Fcbor.svg?logo=npm&color=blue)](https://www.npmjs.com/package/@meproto/cbor)
[![License](https://img.shields.io/badge/license-Apache--2.0-green)](./LICENSE)
[![Tests](https://img.shields.io/github/actions/workflow/status/meproto/ts/test.yml?label=tests)](https://github.com/meproto/ts/actions)
[![bundle size](https://badgen.net/bundlephobia/minzip/@meproto/cbor)](https://bundlephobia.com/package/@meproto/cbor)

Canonical DAG-CBOR encoder/decoder and CID helpers for the **ME Protocol** and `did:me`.

Implements a safe, deterministic subset of CBOR suitable for decentralized identity, verifiable credentials, content addressing, and protocol-level data structures.

- ✔ Canonical, deterministic DAG-CBOR encoding  
- ✔ Strict decoder with type constraints  
- ✔ UTF-8 ordered map keys  
- ✔ No floats, no indefinite lengths  
- ✔ CIDv1 (dag-cbor / sha2-256) computation  
- ✔ Fully typed TypeScript API  

---

## **Installation**

```sh
pnpm add @meproto/cbor
# or
npm install @meproto/cbor
# or
yarn add @meproto/cbor
```

---

## **Usage**

### **Encode canonical DAG-CBOR**

```ts
import { encodeCanonical } from "@meproto/cbor";

const bytes = encodeCanonical({
  hello: "world",
  count: 42,
});
```

### **Decode canonical DAG-CBOR**

```ts
import { decodeCanonical } from "@meproto/cbor";

const value = decodeCanonical(bytes);
// → { hello: "world", count: 42 }
```

---

## **CID helpers**

### **Compute a CIDv1 (dag-cbor, sha2-256)**

```ts
import { computeCidDagCbor } from "@meproto/cbor";

const cid = await computeCidDagCbor(bytes);
// → "bafyre..."
```

### **Verify a CID**

```ts
import { verifyDagCborCid } from "@meproto/cbor";

const result = await verifyDagCborCid(cid, bytes);
// { ok: true, expected: "...", actual: "..." }
```

### **Validate CID syntax**

```ts
import { isValidCidString } from "@meproto/cbor";

isValidCidString(cid);      // true
isValidCidString("nope");   // false
```

---

## **What is canonical DAG-CBOR?**

ME Protocol uses a deterministic subset of CBOR with:

- UTF-8 sorted map keys  
- No floats  
- No semantic tags  
- No indefinite-length items  
- Only major types 0–5 and null/true/false  

This ensures stable hashing, CID derivation, and cryptographic integrity.

---

## **License**

Apache-2.0 © 2025 ReallyMe LLC
npm package: @meproto/codec
Description: Multibase, multicodec, multikey, base64url, and JSON canonicalization utilities for Me Protocol key encoding, DID parsing, and credential serialization.
Latest version: 0.0.3

# **@meproto/codec**

[![npm version](https://img.shields.io/npm/v/%40meproto%2Fcodec.svg?logo=npm&color=blue)](https://www.npmjs.com/package/@meproto/codec)
[![License](https://img.shields.io/badge/license-Apache--2.0-green)](./LICENSE)
[![tests](https://img.shields.io/github/actions/workflow/status/meproto/ts/test-codec.yml?branch=main&label=tests)](https://github.com/meproto/ts/actions/workflows/test-codec.yml)
[![bundle size](https://badgen.net/bundlephobia/minzip/@meproto/codec)](https://bundlephobia.com/package/@meproto/codec)


Encoding utilities for the **Me Protocol**, including:

- **Multibase** (base58btc, base64url)
- **Multicodec** (key algorithm prefix detection)
- **Multikey** parsing and verification
- **Base64 & Base64URL** helpers
- **JSON Canonicalization Scheme (JCS)** for deterministic JSON representation
- Lightweight type-check and error helpers

These utilities support Me Protocol key encoding, DID parsing, signature preimage creation, and credential serialization.

---

## **Installation**

```sh
pnpm add @meproto/codec
# or
npm install @meproto/codec
# or
yarn add @meproto/codec
```

---

## **Usage Examples**

### **Base58btc**

```ts
import { base58btcEncode, base58btcDecode } from "@meproto/codec";

const bytes = new Uint8Array([1, 2, 3]);
const b58 = base58btcEncode(bytes);
const roundtrip = base58btcDecode(b58);
```

---

### **Base64URL**

```ts
import { bytesToBase64Url, base64UrlToBytes } from "@meproto/codec";

const encoded = bytesToBase64Url(new Uint8Array([9, 9, 9]));
const decoded = base64UrlToBytes(encoded);
```

---

### **Multibase Dispatcher**

```ts
import { bytesToMultibase58btc, multibaseToBytes } from "@meproto/codec";

const mb = bytesToMultibase58btc(new Uint8Array([7, 7, 7]));
const raw = multibaseToBytes(mb);
```

---

### **Multicodec Prefix Detection**

```ts
import { lookupCodecPrefix } from "@meproto/codec";

// Example Ed25519 multicodec prefix: 0xed 0x01
const data = new Uint8Array([0xed, 0x01, /* public key bytes... */]);

const info = lookupCodecPrefix(data);
if (info) {
  console.log(info.codecName);   // "ed25519-pub"
  console.log(info.algorithm);   // "Ed25519"
}
```

---

### **Multikey Parsing**

```ts
import { parseMultikey } from "@meproto/codec";

const mk = "z..." // a multibase-encoded multikey
const parsed = parseMultikey(mk);

console.log(parsed.algorithm);     // e.g. "Ed25519"
console.log(parsed.publicKey);     // raw key bytes
console.log(parsed.codecPrefix);   // codec prefix
```

---

### **JSON Canonicalization (JCS)**

```ts
import { canonicalizeJSON } from "@meproto/codec";

const obj = { b: 2, a: 1 };
canonicalizeJSON(obj);
// → {"a":1,"b":2}
```

Deterministic JSON is essential for signature preimages and cryptographic proofs.

---

## **License**

Apache-2.0 © 2025 ReallyMe LLC
npm package: @meproto/protos
Description: Protocol buffer definitions for the did:me decentralized identity method.
Latest version: 0.0.9

# `@meproto/protos` – did:me Protocol Buffer Definitions

[![npm version](https://img.shields.io/npm/v/@meproto/protos.svg)](https://www.npmjs.com/package/@meproto/protos)
[![GitHub release](https://img.shields.io/github/release/meproto/protos.svg)](https://github.com/meproto/protos/releases)
![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)
![TypeScript](https://img.shields.io/badge/TypeScript-definitions-blue)
![Protocol Buffers](https://img.shields.io/badge/protocol--buffers-v3-orange.svg)

> **Official protobuf definitions for the did:me identity method**, including:
>
> - DID Documents  
> - Verification Methods  
> - Services  
> - Update Policies  
> - Domain Verification  
> - Attestations  
> - Data Integrity Proofs  
>
> Generated automatically using **Buf** + **protoc-gen-es**, with published ES modules on NPM.

---

## 🚀 Install

```bash
npm install @meproto/protos
# or
pnpm add @meproto/protos
# or
yarn add @meproto/protos

*Note for pnpm users*
pnpm may display a warning about “Ignored build scripts: esbuild”.  
This package does *not* include any lifecycle scripts — the warning refers to
pnpm’s global policy, not to @meproto/protos. Installation is safe to proceed.