Skip to content

Commit 35d816a

Browse files
committed
feat(did-ckb): add did-ckb package for basic did operations
1 parent b2dce2e commit 35d816a

29 files changed

+795
-8
lines changed

.changeset/fruity-drinks-kick.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@ckb-ccc/shell": minor
3+
"@ckb-ccc/did-ckb": patch
4+
---
5+
6+
feat(did-ckb): add did-ckb package for basic did operations
7+

packages/did-ckb/.npmignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
node_modules/
2+
misc/
3+
4+
*test.js
5+
*test.ts
6+
*test.d.ts
7+
*test.d.ts.map
8+
*spec.js
9+
*spec.ts
10+
*spec.d.ts
11+
*spec.d.ts.map
12+
13+
tsconfig.json
14+
tsconfig.*.json
15+
eslint.config.mjs
16+
.prettierrc
17+
.prettierignore
18+
19+
tsconfig.tsbuildinfo
20+
tsconfig.*.tsbuildinfo
21+
.github/

packages/did-ckb/.prettierignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
node_modules/
2+
3+
dist/
4+
dist.commonjs/
5+
6+
.npmignore
7+
.prettierrc
8+
tsconfig.json
9+
eslint.config.mjs
10+
prettier.config.*
11+
12+
tsconfig.tsbuildinfo
13+
.github/
14+
15+
CHANGELOG.md

packages/did-ckb/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<p align="center">
2+
<a href="https://app.ckbccc.com/">
3+
<img alt="Logo" src="https://raw.githubusercontent.com/ckb-devrel/ccc/master/assets/logoAndText.svg" style="height: 8rem; max-width: 90%; padding: 0.5rem 0;" />
4+
</a>
5+
</p>
6+
7+
<h1 align="center" style="font-size: 48px;">
8+
CCC's Support for DID CKB
9+
</h1>
10+
11+
<p align="center">
12+
<a href="https://www.npmjs.com/package/@ckb-ccc/did-ckb"><img
13+
alt="NPM Version" src="https://img.shields.io/npm/v/%40ckb-ccc%2Fdid-ckb"
14+
/></a>
15+
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/ckb-devrel/ccc" />
16+
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/ckb-devrel/ccc/master" />
17+
<img alt="GitHub branch check runs" src="https://img.shields.io/github/check-runs/ckb-devrel/ccc/master" />
18+
<a href="https://live.ckbccc.com/"><img
19+
alt="Playground" src="https://img.shields.io/website?url=https%3A%2F%2Flive.ckbccc.com%2F&label=Playground"
20+
/></a>
21+
<a href="https://app.ckbccc.com/"><img
22+
alt="App" src="https://img.shields.io/website?url=https%3A%2F%2Fapp.ckbccc.com%2F&label=App"
23+
/></a>
24+
<a href="https://docs.ckbccc.com/"><img
25+
alt="Docs" src="https://img.shields.io/website?url=https%3A%2F%2Fdocs.ckbccc.com%2F&label=Docs"
26+
/></a>
27+
</p>
28+
29+
<p align="center">
30+
CCC - CKBers' Codebase is a one-stop solution for your CKB JS/TS ecosystem development.
31+
<br />
32+
Empower yourself with CCC to discover the unlimited potential of CKB.
33+
<br />
34+
Interoperate with wallets from different chain ecosystems.
35+
<br />
36+
Fully enabling CKB's Turing completeness and cryptographic freedom power.
37+
</p>
38+
39+
<h3 align="center">
40+
Read more about CCC on <a href="https://docs.ckbccc.com">our website</a> or <a href="https://github.com/ckb-devrel/ccc">GitHub Repo</a>.
41+
</h3>

packages/did-ckb/eslint.config.mjs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// @ts-check
2+
3+
import eslint from "@eslint/js";
4+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
5+
import tseslint from "typescript-eslint";
6+
7+
import { dirname } from "path";
8+
import { fileURLToPath } from "url";
9+
10+
export default [
11+
...tseslint.config({
12+
files: ["**/*.ts"],
13+
extends: [
14+
eslint.configs.recommended,
15+
...tseslint.configs.recommendedTypeChecked,
16+
],
17+
rules: {
18+
"@typescript-eslint/no-unused-vars": [
19+
"error",
20+
{
21+
args: "all",
22+
argsIgnorePattern: "^_",
23+
caughtErrors: "all",
24+
caughtErrorsIgnorePattern: "^_",
25+
destructuredArrayIgnorePattern: "^_",
26+
varsIgnorePattern: "^_",
27+
ignoreRestSiblings: true,
28+
},
29+
],
30+
"@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
31+
"@typescript-eslint/no-unsafe-member-access": "off",
32+
"@typescript-eslint/require-await": "off",
33+
"@typescript-eslint/only-throw-error": [
34+
"error",
35+
{
36+
allowThrowingAny: true,
37+
allowThrowingUnknown: true,
38+
allowRethrowing: true,
39+
},
40+
],
41+
"@typescript-eslint/prefer-promise-reject-errors": [
42+
"error",
43+
{
44+
allowThrowingAny: true,
45+
allowThrowingUnknown: true,
46+
},
47+
],
48+
"no-empty": "off",
49+
"prefer-const": [
50+
"error",
51+
{ ignoreReadBeforeAssign: true, destructuring: "all" },
52+
],
53+
},
54+
languageOptions: {
55+
parserOptions: {
56+
project: true,
57+
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
58+
},
59+
},
60+
}),
61+
eslintPluginPrettierRecommended,
62+
];
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "commonjs"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}

packages/did-ckb/package.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "@ckb-ccc/did-ckb",
3+
"version": "0.0.0",
4+
"description": "CCC - CKBer's Codebase. CCC's support for DID on CKB",
5+
"author": "Hanssen0 <hanssen0@hanssen0.com>",
6+
"license": "MIT",
7+
"private": false,
8+
"homepage": "https://github.com/ckb-devrel/ccc",
9+
"repository": {
10+
"type": "git",
11+
"url": "git://github.com/ckb-devrel/ccc.git"
12+
},
13+
"main": "./dist.commonjs/index.js",
14+
"module": "./dist/index.mjs",
15+
"exports": {
16+
".": {
17+
"require": "./dist.commonjs/index.js",
18+
"import": "./dist/index.mjs"
19+
},
20+
"./barrel": {
21+
"require": "./dist.commonjs/barrel.js",
22+
"import": "./dist/barrel.mjs"
23+
},
24+
"./package.json": "./package.json"
25+
},
26+
"scripts": {
27+
"test": "vitest",
28+
"test:ci": "vitest run",
29+
"build": "tsdown",
30+
"lint": "eslint ./src",
31+
"format": "prettier --write . && eslint --fix ./src"
32+
},
33+
"devDependencies": {
34+
"@eslint/js": "^9.34.0",
35+
"@types/node": "^24.3.0",
36+
"eslint": "^9.34.0",
37+
"eslint-config-prettier": "^10.1.8",
38+
"eslint-plugin-prettier": "^5.5.4",
39+
"prettier": "^3.6.2",
40+
"prettier-plugin-organize-imports": "^4.2.0",
41+
"tsdown": "0.19.0-beta.3",
42+
"typescript": "^5.9.2",
43+
"typescript-eslint": "^8.41.0",
44+
"vitest": "^3.2.4"
45+
},
46+
"publishConfig": {
47+
"access": "public"
48+
},
49+
"dependencies": {
50+
"@ckb-ccc/core": "workspace:*",
51+
"@ckb-ccc/type-id": "workspace:*",
52+
"@ipld/dag-cbor": "^9.2.5"
53+
},
54+
"packageManager": "pnpm@10.8.1",
55+
"types": "./dist.commonjs/index.d.ts"
56+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @see https://prettier.io/docs/configuration
3+
* @type {import("prettier").Config}
4+
*/
5+
const config = {
6+
singleQuote: false,
7+
trailingComma: "all",
8+
plugins: [require.resolve("prettier-plugin-organize-imports")],
9+
};
10+
11+
module.exports = config;

packages/did-ckb/src/barrel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./codec.js";
2+
export * from "./didCkb.js";

0 commit comments

Comments
 (0)