@ckb-ccc/did-ckb 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/barrel.d.mts +26 -26
- package/dist/barrel.d.mts.map +1 -1
- package/dist/plc.mjs +1 -1
- package/dist/plc.mjs.map +1 -1
- package/dist.commonjs/{barrel-BY-23ZrU.js → barrel-C62ZxemC.js} +2 -2
- package/dist.commonjs/{barrel-BY-23ZrU.js.map → barrel-C62ZxemC.js.map} +1 -1
- package/dist.commonjs/barrel.d.ts +26 -26
- package/dist.commonjs/barrel.d.ts.map +1 -1
- package/dist.commonjs/barrel.js +1 -1
- package/dist.commonjs/index.js +1 -1
- package/dist.commonjs/plc.js +1 -1
- package/dist.commonjs/plc.js.map +1 -1
- package/package.json +4 -4
- package/src/plc/index.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { d as __exportAll, n as PlcOperation, s as index_d_exports, t as Curve } from "./index-DbyAhugH.js";
|
|
2
2
|
import { ccc } from "@ckb-ccc/core";
|
|
3
3
|
//#region src/codec.d.ts
|
|
4
|
-
type DidCkbDataV1Like = {
|
|
4
|
+
export type DidCkbDataV1Like = {
|
|
5
5
|
document: unknown;
|
|
6
6
|
localId?: string | null;
|
|
7
7
|
};
|
|
@@ -41,13 +41,13 @@ declare const DidCkbDataV1_base: (abstract new () => {
|
|
|
41
41
|
BaseUnion<CodecType_1 extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1>(): any;
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
declare class DidCkbDataV1 extends DidCkbDataV1_base {
|
|
44
|
+
export declare class DidCkbDataV1 extends DidCkbDataV1_base {
|
|
45
45
|
document: unknown;
|
|
46
46
|
localId?: string | undefined;
|
|
47
47
|
constructor(document: unknown, localId?: string | undefined);
|
|
48
48
|
static from(data: DidCkbDataV1Like): DidCkbDataV1;
|
|
49
49
|
}
|
|
50
|
-
type DidCkbDataLike = {
|
|
50
|
+
export type DidCkbDataLike = {
|
|
51
51
|
type?: "v1" | null;
|
|
52
52
|
value: DidCkbDataV1Like;
|
|
53
53
|
} | {
|
|
@@ -123,7 +123,7 @@ declare const DidCkbData_base: (abstract new (inner: {
|
|
|
123
123
|
};
|
|
124
124
|
BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike, SubType = SubTypeLike>(): any;
|
|
125
125
|
};
|
|
126
|
-
declare class DidCkbData extends DidCkbData_base {
|
|
126
|
+
export declare class DidCkbData extends DidCkbData_base {
|
|
127
127
|
type: "v1";
|
|
128
128
|
value: DidCkbDataV1;
|
|
129
129
|
constructor(type: "v1", value: DidCkbDataV1);
|
|
@@ -133,7 +133,7 @@ declare class DidCkbData extends DidCkbData_base {
|
|
|
133
133
|
value: DidCkbDataV1;
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
type PlcAuthorizationLike = {
|
|
136
|
+
export type PlcAuthorizationLike = {
|
|
137
137
|
history: object[];
|
|
138
138
|
sig: ccc.HexLike;
|
|
139
139
|
rotationKeyIndices: ccc.NumLike[];
|
|
@@ -174,14 +174,14 @@ declare const PlcAuthorization_base: (abstract new () => {
|
|
|
174
174
|
BaseUnion<CodecType_1 extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1>(): any;
|
|
175
175
|
};
|
|
176
176
|
};
|
|
177
|
-
declare class PlcAuthorization extends PlcAuthorization_base {
|
|
177
|
+
export declare class PlcAuthorization extends PlcAuthorization_base {
|
|
178
178
|
history: object[];
|
|
179
179
|
sig: ccc.Hex;
|
|
180
180
|
rotationKeyIndices: ccc.Num[];
|
|
181
181
|
constructor(history: object[], sig: ccc.Hex, rotationKeyIndices: ccc.Num[]);
|
|
182
182
|
static from(data: PlcAuthorizationLike): PlcAuthorization;
|
|
183
183
|
}
|
|
184
|
-
type DidCkbWitnessLike = {
|
|
184
|
+
export type DidCkbWitnessLike = {
|
|
185
185
|
localIdAuthorization: PlcAuthorizationLike;
|
|
186
186
|
};
|
|
187
187
|
declare const DidCkbWitness_base: (abstract new () => {
|
|
@@ -220,7 +220,7 @@ declare const DidCkbWitness_base: (abstract new () => {
|
|
|
220
220
|
BaseUnion<CodecType_1 extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1>(): any;
|
|
221
221
|
};
|
|
222
222
|
};
|
|
223
|
-
declare class DidCkbWitness extends DidCkbWitness_base {
|
|
223
|
+
export declare class DidCkbWitness extends DidCkbWitness_base {
|
|
224
224
|
localIdAuthorization: PlcAuthorization;
|
|
225
225
|
constructor(localIdAuthorization: PlcAuthorization);
|
|
226
226
|
static from(data: DidCkbWitnessLike): DidCkbWitness;
|
|
@@ -236,7 +236,7 @@ declare class DidCkbWitness extends DidCkbWitness_base {
|
|
|
236
236
|
* @param props.data The output data.
|
|
237
237
|
* @param props.tx The transaction skeleton (optional).
|
|
238
238
|
*/
|
|
239
|
-
declare function createDidCkb(props: {
|
|
239
|
+
export declare function createDidCkb(props: {
|
|
240
240
|
signer: ccc.Signer;
|
|
241
241
|
data: DidCkbDataLike;
|
|
242
242
|
receiver?: ccc.ScriptLike | null;
|
|
@@ -256,7 +256,7 @@ declare function createDidCkb(props: {
|
|
|
256
256
|
* @param props.tx The transaction skeleton (optional).
|
|
257
257
|
* @param props.data The new output data or a transformer to update the data (optional).
|
|
258
258
|
*/
|
|
259
|
-
declare function transferDidCkb(props: {
|
|
259
|
+
export declare function transferDidCkb(props: {
|
|
260
260
|
client: ccc.Client;
|
|
261
261
|
id: ccc.HexLike;
|
|
262
262
|
receiver: ccc.ScriptLike;
|
|
@@ -275,7 +275,7 @@ declare function transferDidCkb(props: {
|
|
|
275
275
|
* @param props.id The Type ID to destroy.
|
|
276
276
|
* @param props.tx The transaction skeleton (optional).
|
|
277
277
|
*/
|
|
278
|
-
declare function destroyDidCkb(props: {
|
|
278
|
+
export declare function destroyDidCkb(props: {
|
|
279
279
|
client: ccc.Client;
|
|
280
280
|
id: ccc.HexLike;
|
|
281
281
|
tx?: ccc.TransactionLike | null;
|
|
@@ -285,8 +285,8 @@ declare function destroyDidCkb(props: {
|
|
|
285
285
|
}>;
|
|
286
286
|
//#endregion
|
|
287
287
|
//#region src/history.d.ts
|
|
288
|
-
type HistoryAction = "CREATE" | "UPDATE" | "MIGRATE";
|
|
289
|
-
type HistoryEntry = {
|
|
288
|
+
export type HistoryAction = "CREATE" | "UPDATE" | "MIGRATE";
|
|
289
|
+
export type HistoryEntry = {
|
|
290
290
|
/**
|
|
291
291
|
* `CREATE` for a fresh mint, `MIGRATE` for a did:plc import (genesis cell
|
|
292
292
|
* with a `localId` set), `UPDATE` for every subsequent transfer.
|
|
@@ -313,7 +313,7 @@ type HistoryEntry = {
|
|
|
313
313
|
* lookup per non-DID input on each step. `input.getCell` goes through the
|
|
314
314
|
* client's cell cache, so repeated walks over the same chain are cheap.
|
|
315
315
|
*/
|
|
316
|
-
declare function getDidCkbHistory(props: {
|
|
316
|
+
export declare function getDidCkbHistory(props: {
|
|
317
317
|
client: ccc.Client;
|
|
318
318
|
/**
|
|
319
319
|
* Either the 20-byte Type ID args hex returned by `createDidCkb`, or a
|
|
@@ -327,19 +327,19 @@ declare function getDidCkbHistory(props: {
|
|
|
327
327
|
}): Promise<HistoryEntry[]>;
|
|
328
328
|
//#endregion
|
|
329
329
|
//#region src/identifier.d.ts
|
|
330
|
-
declare function base32Encode(bytes: ccc.BytesLike): string;
|
|
331
|
-
declare function base32Decode(input: string): ccc.Bytes;
|
|
330
|
+
export declare function base32Encode(bytes: ccc.BytesLike): string;
|
|
331
|
+
export declare function base32Decode(input: string): ccc.Bytes;
|
|
332
332
|
/**
|
|
333
333
|
* Convert 20-byte Type ID args (the `id` returned from `createDidCkb`) to a
|
|
334
334
|
* `did:ckb:` identifier string per WIP-01 §2.2.
|
|
335
335
|
*/
|
|
336
|
-
declare function argsToDid(args: ccc.HexLike): string;
|
|
336
|
+
export declare function argsToDid(args: ccc.HexLike): string;
|
|
337
337
|
/**
|
|
338
338
|
* Reverse of `argsToDid`. Validates the prefix, base32 length, and decoded
|
|
339
339
|
* byte count.
|
|
340
340
|
*/
|
|
341
|
-
declare function didToArgs(did: string): ccc.Hex;
|
|
342
|
-
declare function isDidCkb(value: string): boolean;
|
|
341
|
+
export declare function didToArgs(did: string): ccc.Hex;
|
|
342
|
+
export declare function isDidCkb(value: string): boolean;
|
|
343
343
|
//#endregion
|
|
344
344
|
//#region src/migrate.d.ts
|
|
345
345
|
/**
|
|
@@ -356,7 +356,7 @@ declare function isDidCkb(value: string): boolean;
|
|
|
356
356
|
* self-signed by the first rotation key; override if the genesis you're
|
|
357
357
|
* migrating used a different one.
|
|
358
358
|
*/
|
|
359
|
-
declare function buildMigrationWitness(props: {
|
|
359
|
+
export declare function buildMigrationWitness(props: {
|
|
360
360
|
txHash: ccc.HexLike;
|
|
361
361
|
genesisOperation: PlcOperation;
|
|
362
362
|
rotationKeyIndex: number;
|
|
@@ -376,7 +376,7 @@ declare function buildMigrationWitness(props: {
|
|
|
376
376
|
* witness slot of input 0. See `packages/examples/src/migrateDid.ts` for the
|
|
377
377
|
* full flow.
|
|
378
378
|
*/
|
|
379
|
-
declare function migrateDidCkb(props: {
|
|
379
|
+
export declare function migrateDidCkb(props: {
|
|
380
380
|
signer: ccc.Signer;
|
|
381
381
|
sourceDid: string;
|
|
382
382
|
data?: DidCkbDataLike | null;
|
|
@@ -389,7 +389,7 @@ declare function migrateDidCkb(props: {
|
|
|
389
389
|
}>;
|
|
390
390
|
//#endregion
|
|
391
391
|
//#region src/resolver.d.ts
|
|
392
|
-
type DidCkbRecord = {
|
|
392
|
+
export type DidCkbRecord = {
|
|
393
393
|
/** The `did:ckb:` string identifying this cell. */
|
|
394
394
|
did: string;
|
|
395
395
|
/** 20-byte Type ID args (same value `createDidCkb` returned as `id`). */
|
|
@@ -405,7 +405,7 @@ type DidCkbRecord = {
|
|
|
405
405
|
* Returns `undefined` when no live cell exists (the DID was never created or
|
|
406
406
|
* has been destroyed).
|
|
407
407
|
*/
|
|
408
|
-
declare function findDidCkbCell(props: {
|
|
408
|
+
export declare function findDidCkbCell(props: {
|
|
409
409
|
client: ccc.Client;
|
|
410
410
|
id: ccc.HexLike;
|
|
411
411
|
}): Promise<DidCkbRecord | undefined>;
|
|
@@ -415,7 +415,7 @@ declare function findDidCkbCell(props: {
|
|
|
415
415
|
* Throws if `did` is not a syntactically valid did:ckb identifier. Returns
|
|
416
416
|
* `undefined` if the DID was created and then destroyed, or never existed.
|
|
417
417
|
*/
|
|
418
|
-
declare function resolveDidCkb(props: {
|
|
418
|
+
export declare function resolveDidCkb(props: {
|
|
419
419
|
client: ccc.Client;
|
|
420
420
|
did: string;
|
|
421
421
|
}): Promise<DidCkbRecord | undefined>;
|
|
@@ -426,7 +426,7 @@ declare function resolveDidCkb(props: {
|
|
|
426
426
|
* Cells whose data fails to decode (e.g. a future on-chain schema version) are
|
|
427
427
|
* skipped, not thrown, so a single bad cell can't break the whole listing.
|
|
428
428
|
*/
|
|
429
|
-
declare function listDidCkbsByLock(props: {
|
|
429
|
+
export declare function listDidCkbsByLock(props: {
|
|
430
430
|
client: ccc.Client;
|
|
431
431
|
lock: ccc.ScriptLike;
|
|
432
432
|
limit?: number;
|
|
@@ -436,5 +436,5 @@ declare namespace barrel_d_exports {
|
|
|
436
436
|
export { DidCkbData, DidCkbDataLike, DidCkbDataV1, DidCkbDataV1Like, DidCkbRecord, DidCkbWitness, DidCkbWitnessLike, HistoryAction, HistoryEntry, PlcAuthorization, PlcAuthorizationLike, argsToDid, base32Decode, base32Encode, buildMigrationWitness, createDidCkb, destroyDidCkb, didToArgs, findDidCkbCell, getDidCkbHistory, isDidCkb, listDidCkbsByLock, migrateDidCkb, index_d_exports as plc, resolveDidCkb, transferDidCkb };
|
|
437
437
|
}
|
|
438
438
|
//#endregion
|
|
439
|
-
export {
|
|
439
|
+
export { index_d_exports as plc, barrel_d_exports as t };
|
|
440
440
|
//# sourceMappingURL=barrel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"barrel.d.ts","names":[],"sources":["../src/codec.ts","../src/didCkb.ts","../src/history.ts","../src/identifier.ts","../src/migrate.ts","../src/resolver.ts","../src/barrel.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"barrel.d.ts","names":[],"sources":["../src/codec.ts","../src/didCkb.ts","../src/history.ts","../src/identifier.ts","../src/migrate.ts","../src/resolver.ts","../src/barrel.ts"],"mappings":";;;YAGY;EACV;EACA;;;;;;;;;;;;;;;;;;MAiK6j7B;;;;;;;;;;;IAAs/C;;;;;;;;;qBA9Ixi+B,qBAAqB;EAKvB;EACA;EADA,YAAA,mBACA;SAKF,KAAK,MAAM,mBAAmB;;YAa3B;EAEN;EACA,OAAO;;EAGP;IACE;IACA,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8G8mrC;;;;;;;;;;qBAzGhnrC,mBAAmB;EAMrB;EACA,OAAO;EADP,YAAA,YACA,OAAO;SAKT,KAAK,MAAM,iBAAiB;SAe5B,OACL,MAAM,mBACL;IAAe;IAAY,OAAO;;;YAK3B;EACV;EACA,KAAK,IAAI;EACT,oBAAoB,IAAI;;;;;;;;;;;;;;;;;;MAoEqi7B;;;;;;;;;;;IAAs/C;;;;;;;;;qBA/Cxi+B,yBAAyB;EAK3B;EACA,KAAK,IAAI;EACT,oBAAoB,IAAI;EAFxB,YAAA,mBACA,KAAK,IAAI,KACT,oBAAoB,IAAI;SAK1B,KAAK,MAAM,uBAAuB;;YAY/B;EACV,sBAAsB;;;;;;;;;;;;;;;;;;MAsBui7B;;;;;;;;;;;IAAs/C;;;;;;;;;qBAfxi+B,sBAAsB;EAId,sBAAsB;EAA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IAAI,IAAI;IACN,QAAQ;;;;;;;wBAgBU,cAAc;EAClC,QAAQ,IAAI;EACZ;IACE,QAAQ;;;;;;;;wBAcU,kBAAkB;EACtC,QAAQ,IAAI;EACZ,MAAM,IAAI;EACV;EACA;IACE,QAAQ"}
|
package/dist.commonjs/barrel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./barrel-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./barrel-C62ZxemC.js"),t=require("./plc.js");Object.defineProperty(exports,"DidCkbData",{enumerable:!0,get:function(){return e.g}}),Object.defineProperty(exports,"DidCkbDataV1",{enumerable:!0,get:function(){return e._}}),Object.defineProperty(exports,"DidCkbWitness",{enumerable:!0,get:function(){return e.v}}),Object.defineProperty(exports,"PlcAuthorization",{enumerable:!0,get:function(){return e.y}}),exports.argsToDid=e.c,exports.base32Decode=e.l,exports.base32Encode=e.u,exports.buildMigrationWitness=e.n,exports.createDidCkb=e.p,exports.destroyDidCkb=e.m,exports.didToArgs=e.d,exports.findDidCkbCell=e.a,exports.getDidCkbHistory=e.i,exports.isDidCkb=e.f,exports.listDidCkbsByLock=e.o,exports.migrateDidCkb=e.r,Object.defineProperty(exports,"plc",{enumerable:!0,get:function(){return t.t}}),exports.resolveDidCkb=e.s,exports.transferDidCkb=e.h;
|
package/dist.commonjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./barrel-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./barrel-C62ZxemC.js"),t=require("./plc.js");Object.defineProperty(exports,"DidCkbData",{enumerable:!0,get:function(){return e.g}}),Object.defineProperty(exports,"DidCkbDataV1",{enumerable:!0,get:function(){return e._}}),Object.defineProperty(exports,"DidCkbWitness",{enumerable:!0,get:function(){return e.v}}),Object.defineProperty(exports,"PlcAuthorization",{enumerable:!0,get:function(){return e.y}}),exports.argsToDid=e.c,exports.base32Decode=e.l,exports.base32Encode=e.u,exports.buildMigrationWitness=e.n,exports.createDidCkb=e.p,exports.destroyDidCkb=e.m,Object.defineProperty(exports,"didCkb",{enumerable:!0,get:function(){return e.t}}),exports.didToArgs=e.d,exports.findDidCkbCell=e.a,exports.getDidCkbHistory=e.i,exports.isDidCkb=e.f,exports.listDidCkbsByLock=e.o,exports.migrateDidCkb=e.r,Object.defineProperty(exports,"plc",{enumerable:!0,get:function(){return t.t}}),exports.resolveDidCkb=e.s,exports.transferDidCkb=e.h;
|
package/dist.commonjs/plc.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.js");let t=require("@ckb-ccc/core"),n=require("@noble/curves/nist.js"),r=require("@noble/curves/secp256k1.js");var i=e.t({fetchPlcLog:()=>a,getGenesisOperation:()=>o,getRotationKeys:()=>s,parseDidKey:()=>c,signRotationHash:()=>l,verifyPrivateKeyMatch:()=>u});async function a(e,t=`https://plc.directory`){if(!e.startsWith(`did:plc:`))throw Error(`Expected did:plc identifier, got "${e}"`);let n=await fetch(`${t}/${e}/log`);if(!n.ok)throw Error(`PLC log fetch failed (${n.status} ${n.statusText})`);let r=await n.json();if(!Array.isArray(r)||r.length===0)throw Error(`PLC log empty or malformed`);return r}function o(e){if(e.length===0)throw Error(`Empty PLC log`);return e[0]}function s(e){let t=[];return e.rotationKeys?.length?t.push(...e.rotationKeys):(e.signingKey||e.recoveryKey)&&(e.signingKey&&t.push(e.signingKey),e.recoveryKey&&t.push(e.recoveryKey)),t.map(e=>{let t=c(e);return{didKey:e,curve:t.curve,compressedPubkey:t.compressedPubkey}})}function c(e){if(!e.startsWith(`did:key:z`))throw Error(`Expected did:key:z..., got "${e}"`);let t=f(e.slice(9));if(t.length!==35)throw Error(`did:key payload must be 35 bytes (2-byte multicodec tag + 33-byte compressed pubkey), got ${t.length}`);let n=t[0],r=t[1],i;if(n===231&&r===1)i=`secp256k1`;else if(n===128&&r===36)i=`p256`;else throw Error(`Unrecognised did:key multicodec tag: 0x${n.toString(16).padStart(2,`0`)} 0x${r.toString(16).padStart(2,`0`)}`);return{curve:i,compressedPubkey:t.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.js");let t=require("@ckb-ccc/core"),n=require("@noble/curves/nist.js"),r=require("@noble/curves/secp256k1.js");var i=e.t({fetchPlcLog:()=>a,getGenesisOperation:()=>o,getRotationKeys:()=>s,parseDidKey:()=>c,signRotationHash:()=>l,verifyPrivateKeyMatch:()=>u});async function a(e,t=`https://plc.directory`){if(!e.startsWith(`did:plc:`))throw Error(`Expected did:plc identifier, got "${e}"`);let n=await fetch(`${t}/${e}/log`);if(!n.ok)throw Error(`PLC log fetch failed (${n.status} ${n.statusText})`);let r=await n.json();if(!Array.isArray(r)||r.length===0)throw Error(`PLC log empty or malformed`);return r}function o(e){if(e.length===0)throw Error(`Empty PLC log`);return e[0]}function s(e){let t=[];return e.rotationKeys?.length?t.push(...e.rotationKeys):(e.signingKey||e.recoveryKey)&&(e.signingKey&&t.push(e.signingKey),e.recoveryKey&&t.push(e.recoveryKey)),t.map(e=>{let t=c(e);return{didKey:e,curve:t.curve,compressedPubkey:t.compressedPubkey}})}function c(e){if(!e.startsWith(`did:key:z`))throw Error(`Expected did:key:z..., got "${e}"`);let t=f(e.slice(9));if(t.length!==35)throw Error(`did:key payload must be 35 bytes (2-byte multicodec tag + 33-byte compressed pubkey), got ${t.length}`);let n=t[0],r=t[1],i;if(n===231&&r===1)i=`secp256k1`;else if(n===128&&r===36)i=`p256`;else throw Error(`Unrecognised did:key multicodec tag: 0x${n.toString(16).padStart(2,`0`)} 0x${r.toString(16).padStart(2,`0`)}`);return{curve:i,compressedPubkey:t.subarray(2)}}function l(e,i,a){let o=t.ccc.bytesFrom(i);if(o.length!==32)throw Error(`Expected 32-byte tx hash, got ${o.length}`);let s=t.ccc.bytesFrom(e);if(s.length!==32)throw Error(`Expected 32-byte private key, got ${s.length}`);return a===`secp256k1`?r.secp256k1.sign(o,s,{prehash:!0,lowS:!0,format:`compact`}):n.p256.sign(o,s,{prehash:!0,lowS:!0,format:`compact`})}function u(e,i,a){let o=t.ccc.bytesFrom(e);if(o.length!==32)return!1;let s=t.ccc.bytesFrom(i),c=a===`secp256k1`?r.secp256k1.getPublicKey(o,!0):n.p256.getPublicKey(o,!0);if(c.length!==s.length)return!1;for(let e=0;e<c.length;e++)if(c[e]!==s[e])return!1;return!0}const d=(()=>{let e={};for(let t=0;t<58;t++)e[`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`[t]]=t;return e})();function f(e){if(e.length===0)return new Uint8Array;let t=0;for(;t<e.length&&e[t]===`1`;)t++;let n=0n;for(let r=t;r<e.length;r++){let t=e[r],i=d[t];if(i===void 0)throw Error(`Invalid base58 character "${t}"`);n=n*58n+BigInt(i)}let r=[];for(;n>0n;)r.unshift(Number(n&255n)),n>>=8n;return Uint8Array.from([...Array(t).fill(0),...r])}exports.fetchPlcLog=a,exports.getGenesisOperation=o,exports.getRotationKeys=s,exports.parseDidKey=c,exports.signRotationHash=l,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),exports.verifyPrivateKeyMatch=u;
|
|
2
2
|
//# sourceMappingURL=plc.js.map
|
package/dist.commonjs/plc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plc.js","names":["ccc","secp256k1","p256"],"sources":["../src/plc/index.ts"],"sourcesContent":["import { ccc } from \"@ckb-ccc/core\";\nimport { p256 } from \"@noble/curves/nist.js\";\nimport { secp256k1 } from \"@noble/curves/secp256k1.js\";\n\n/**\n * Minimal did:plc helpers, scoped to what a did:ckb migration needs:\n * fetch the op log from the public PLC directory, parse rotation keys, and\n * sign a 32-byte CKB transaction hash with a rotation private key.\n *\n * The on-chain contract is happy with a history of length 1 (WIP-02 §3.1.1\n * RECOMMENDs the genesis-only form), so we don't walk the full op chain\n * client-side.\n */\n\nconst PLC_DIRECTORY = \"https://plc.directory\";\n\nexport type Curve = \"secp256k1\" | \"p256\";\n\nexport type PlcRotationKey = {\n didKey: string;\n curve: Curve;\n compressedPubkey: ccc.Bytes;\n};\n\nexport type PlcOperation = {\n type: string;\n rotationKeys?: string[];\n verificationMethods?: Record<string, string>;\n alsoKnownAs?: string[];\n services?: Record<string, { type: string; endpoint: string }>;\n prev: string | null;\n sig: string;\n // Legacy `create` op fields:\n signingKey?: string;\n recoveryKey?: string;\n handle?: string;\n service?: string;\n [key: string]: unknown;\n};\n\n/**\n * Fetch the operation log for a did:plc identifier from the public directory.\n * Pass a custom directory URL when targeting a staging environment.\n */\nexport async function fetchPlcLog(\n did: string,\n directory: string = PLC_DIRECTORY,\n): Promise<PlcOperation[]> {\n if (!did.startsWith(\"did:plc:\")) {\n throw new Error(`Expected did:plc identifier, got \"${did}\"`);\n }\n const res = await fetch(`${directory}/${did}/log`);\n if (!res.ok) {\n throw new Error(`PLC log fetch failed (${res.status} ${res.statusText})`);\n }\n const data: unknown = await res.json();\n if (!Array.isArray(data) || data.length === 0) {\n throw new Error(\"PLC log empty or malformed\");\n }\n return data as PlcOperation[];\n}\n\nexport function getGenesisOperation(log: PlcOperation[]): PlcOperation {\n if (log.length === 0) {\n throw new Error(\"Empty PLC log\");\n }\n return log[0];\n}\n\n/**\n * Surface the rotation keys declared in a genesis op as a uniform list. PLC\n * genesis comes in two shapes: the modern `plc_operation` (with\n * `rotationKeys`) and the deprecated `create` (with `signingKey` +\n * `recoveryKey`). The on-chain contract treats the legacy form as\n * `[signingKey, recoveryKey]`, so we expose the same order.\n */\nexport function getRotationKeys(op: PlcOperation): PlcRotationKey[] {\n const keys: string[] = [];\n if (op.rotationKeys?.length) {\n keys.push(...op.rotationKeys);\n } else if (op.signingKey || op.recoveryKey) {\n if (op.signingKey) {\n keys.push(op.signingKey);\n }\n if (op.recoveryKey) {\n keys.push(op.recoveryKey);\n }\n }\n return keys.map((didKey) => {\n const parsed = parseDidKey(didKey);\n return {\n didKey,\n curve: parsed.curve,\n compressedPubkey: parsed.compressedPubkey,\n };\n });\n}\n\nexport function parseDidKey(didKey: string): {\n curve: Curve;\n compressedPubkey: ccc.Bytes;\n} {\n if (!didKey.startsWith(\"did:key:z\")) {\n throw new Error(`Expected did:key:z..., got \"${didKey}\"`);\n }\n const raw = base58btcDecode(didKey.slice(\"did:key:z\".length));\n if (raw.length !== 35) {\n throw new Error(\n `did:key payload must be 35 bytes (2-byte multicodec tag + 33-byte compressed pubkey), got ${raw.length}`,\n );\n }\n const tag1 = raw[0];\n const tag2 = raw[1];\n let curve: Curve;\n if (tag1 === 0xe7 && tag2 === 0x01) {\n curve = \"secp256k1\";\n } else if (tag1 === 0x80 && tag2 === 0x24) {\n curve = \"p256\";\n } else {\n throw new Error(\n `Unrecognised did:key multicodec tag: 0x${tag1.toString(16).padStart(2, \"0\")} 0x${tag2.toString(16).padStart(2, \"0\")}`,\n );\n }\n return { curve, compressedPubkey: raw.
|
|
1
|
+
{"version":3,"file":"plc.js","names":["ccc","secp256k1","p256"],"sources":["../src/plc/index.ts"],"sourcesContent":["import { ccc } from \"@ckb-ccc/core\";\nimport { p256 } from \"@noble/curves/nist.js\";\nimport { secp256k1 } from \"@noble/curves/secp256k1.js\";\n\n/**\n * Minimal did:plc helpers, scoped to what a did:ckb migration needs:\n * fetch the op log from the public PLC directory, parse rotation keys, and\n * sign a 32-byte CKB transaction hash with a rotation private key.\n *\n * The on-chain contract is happy with a history of length 1 (WIP-02 §3.1.1\n * RECOMMENDs the genesis-only form), so we don't walk the full op chain\n * client-side.\n */\n\nconst PLC_DIRECTORY = \"https://plc.directory\";\n\nexport type Curve = \"secp256k1\" | \"p256\";\n\nexport type PlcRotationKey = {\n didKey: string;\n curve: Curve;\n compressedPubkey: ccc.Bytes;\n};\n\nexport type PlcOperation = {\n type: string;\n rotationKeys?: string[];\n verificationMethods?: Record<string, string>;\n alsoKnownAs?: string[];\n services?: Record<string, { type: string; endpoint: string }>;\n prev: string | null;\n sig: string;\n // Legacy `create` op fields:\n signingKey?: string;\n recoveryKey?: string;\n handle?: string;\n service?: string;\n [key: string]: unknown;\n};\n\n/**\n * Fetch the operation log for a did:plc identifier from the public directory.\n * Pass a custom directory URL when targeting a staging environment.\n */\nexport async function fetchPlcLog(\n did: string,\n directory: string = PLC_DIRECTORY,\n): Promise<PlcOperation[]> {\n if (!did.startsWith(\"did:plc:\")) {\n throw new Error(`Expected did:plc identifier, got \"${did}\"`);\n }\n const res = await fetch(`${directory}/${did}/log`);\n if (!res.ok) {\n throw new Error(`PLC log fetch failed (${res.status} ${res.statusText})`);\n }\n const data: unknown = await res.json();\n if (!Array.isArray(data) || data.length === 0) {\n throw new Error(\"PLC log empty or malformed\");\n }\n return data as PlcOperation[];\n}\n\nexport function getGenesisOperation(log: PlcOperation[]): PlcOperation {\n if (log.length === 0) {\n throw new Error(\"Empty PLC log\");\n }\n return log[0];\n}\n\n/**\n * Surface the rotation keys declared in a genesis op as a uniform list. PLC\n * genesis comes in two shapes: the modern `plc_operation` (with\n * `rotationKeys`) and the deprecated `create` (with `signingKey` +\n * `recoveryKey`). The on-chain contract treats the legacy form as\n * `[signingKey, recoveryKey]`, so we expose the same order.\n */\nexport function getRotationKeys(op: PlcOperation): PlcRotationKey[] {\n const keys: string[] = [];\n if (op.rotationKeys?.length) {\n keys.push(...op.rotationKeys);\n } else if (op.signingKey || op.recoveryKey) {\n if (op.signingKey) {\n keys.push(op.signingKey);\n }\n if (op.recoveryKey) {\n keys.push(op.recoveryKey);\n }\n }\n return keys.map((didKey) => {\n const parsed = parseDidKey(didKey);\n return {\n didKey,\n curve: parsed.curve,\n compressedPubkey: parsed.compressedPubkey,\n };\n });\n}\n\nexport function parseDidKey(didKey: string): {\n curve: Curve;\n compressedPubkey: ccc.Bytes;\n} {\n if (!didKey.startsWith(\"did:key:z\")) {\n throw new Error(`Expected did:key:z..., got \"${didKey}\"`);\n }\n const raw = base58btcDecode(didKey.slice(\"did:key:z\".length));\n if (raw.length !== 35) {\n throw new Error(\n `did:key payload must be 35 bytes (2-byte multicodec tag + 33-byte compressed pubkey), got ${raw.length}`,\n );\n }\n const tag1 = raw[0];\n const tag2 = raw[1];\n let curve: Curve;\n if (tag1 === 0xe7 && tag2 === 0x01) {\n curve = \"secp256k1\";\n } else if (tag1 === 0x80 && tag2 === 0x24) {\n curve = \"p256\";\n } else {\n throw new Error(\n `Unrecognised did:key multicodec tag: 0x${tag1.toString(16).padStart(2, \"0\")} 0x${tag2.toString(16).padStart(2, \"0\")}`,\n );\n }\n return { curve, compressedPubkey: raw.subarray(2) };\n}\n\n/**\n * Sign a 32-byte CKB tx hash with a PLC rotation private key.\n *\n * The on-chain validator runs k256/p256's `Verifier::verify` which internally\n * SHA-256 hashes the message before checking the ECDSA signature. Noble's\n * default is the opposite (treat input as already-hashed), so we pass\n * `prehash: true` to make noble apply SHA-256 internally and match the\n * contract. Output is canonical low-s 64-byte compact form, identical to\n * what @atproto/crypto's Keypair.sign produces.\n */\nexport function signRotationHash(\n privateKey: ccc.BytesLike,\n txHash: ccc.BytesLike,\n curve: Curve,\n): ccc.Bytes {\n const hash = ccc.bytesFrom(txHash);\n if (hash.length !== 32) {\n throw new Error(`Expected 32-byte tx hash, got ${hash.length}`);\n }\n const priv = ccc.bytesFrom(privateKey);\n if (priv.length !== 32) {\n throw new Error(`Expected 32-byte private key, got ${priv.length}`);\n }\n if (curve === \"secp256k1\") {\n return secp256k1.sign(hash, priv, {\n prehash: true,\n lowS: true,\n format: \"compact\",\n });\n }\n return p256.sign(hash, priv, {\n prehash: true,\n lowS: true,\n format: \"compact\",\n });\n}\n\n/**\n * Quick sanity check: derive the public key from `privateKey` and compare\n * against `expectedPubkey`. Lets a UI tell the user \"wrong key for this\n * rotation slot\" without waiting for an on-chain rejection.\n */\nexport function verifyPrivateKeyMatch(\n privateKey: ccc.BytesLike,\n expectedPubkey: ccc.BytesLike,\n curve: Curve,\n): boolean {\n const priv = ccc.bytesFrom(privateKey);\n if (priv.length !== 32) {\n return false;\n }\n const expected = ccc.bytesFrom(expectedPubkey);\n const pub =\n curve === \"secp256k1\"\n ? secp256k1.getPublicKey(priv, true)\n : p256.getPublicKey(priv, true);\n if (pub.length !== expected.length) {\n return false;\n }\n for (let i = 0; i < pub.length; i++) {\n if (pub[i] !== expected[i]) {\n return false;\n }\n }\n return true;\n}\n\n// Inline base58btc decode (Bitcoin alphabet) so we don't pull in multiformats\n// as a direct dependency. Audited by the multicodec tag round-trip tests.\nconst BASE58_ALPHABET =\n \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\nconst BASE58_REVERSE: Record<string, number> = (() => {\n const m: Record<string, number> = {};\n for (let i = 0; i < BASE58_ALPHABET.length; i++) {\n m[BASE58_ALPHABET[i]] = i;\n }\n return m;\n})();\n\nfunction base58btcDecode(input: string): ccc.Bytes {\n if (input.length === 0) {\n return new Uint8Array(0);\n }\n let leadingOnes = 0;\n while (leadingOnes < input.length && input[leadingOnes] === \"1\") {\n leadingOnes++;\n }\n let value = 0n;\n for (let i = leadingOnes; i < input.length; i++) {\n const c = input[i];\n const v = BASE58_REVERSE[c];\n if (v === undefined) {\n throw new Error(`Invalid base58 character \"${c}\"`);\n }\n value = value * 58n + BigInt(v);\n }\n const tail: number[] = [];\n while (value > 0n) {\n tail.unshift(Number(value & 0xffn));\n value >>= 8n;\n }\n return Uint8Array.from([...Array<number>(leadingOnes).fill(0), ...tail]);\n}\n"],"mappings":"mXA4CA,eAAsB,EACpB,EACA,EAAoB,wBACK,CACzB,GAAI,CAAC,EAAI,WAAW,UAAU,EAC5B,MAAU,MAAM,qCAAqC,EAAI,EAAE,EAE7D,IAAM,EAAM,MAAM,MAAM,GAAG,EAAU,GAAG,EAAI,KAAK,EACjD,GAAI,CAAC,EAAI,GACP,MA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R,MAAU,MAAM,6BAA6B,EAAE,EAAE,EAEnD,EAAQ,EAAQ,IAAM,OAAO,CAAC,CAChC,CACA,IAAM,EAAiB,CAAC,EACxB,KAAO,EAAQ,IACb,EAAK,QAAQ,OAAO,EAAQ,IAAK,CAAC,EAClC,IAAU,GAEZ,OAAO,WAAW,KAAK,CAAC,GAAG,MAAc,CAAW,CAAC,CAAC,KAAK,CAAC,EAAG,GAAG,CAAI,CAAC,CACzE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckb-ccc/did-ckb",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "CCC - CKBer's Codebase. CCC's support for DID on CKB",
|
|
5
5
|
"author": "Hanssen0 <hanssen0@hanssen0.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"eslint-plugin-prettier": "^5.5.6",
|
|
36
36
|
"prettier": "^3.8.4",
|
|
37
37
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
38
|
-
"tsdown": "^0.
|
|
38
|
+
"tsdown": "^0.23.0",
|
|
39
39
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
40
40
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
41
41
|
"typescript-eslint": "^8.61.1",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@ipld/dag-cbor": "^10.0.1",
|
|
49
49
|
"@noble/curves": "^2.2.0",
|
|
50
|
-
"@ckb-ccc/core": "1.
|
|
51
|
-
"@ckb-ccc/type-id": "0.1.
|
|
50
|
+
"@ckb-ccc/core": "1.20.1",
|
|
51
|
+
"@ckb-ccc/type-id": "0.1.11"
|
|
52
52
|
},
|
|
53
53
|
"types": "./dist.commonjs/index.d.ts",
|
|
54
54
|
"inlinedDependencies": {
|
package/src/plc/index.ts
CHANGED
|
@@ -121,7 +121,7 @@ export function parseDidKey(didKey: string): {
|
|
|
121
121
|
`Unrecognised did:key multicodec tag: 0x${tag1.toString(16).padStart(2, "0")} 0x${tag2.toString(16).padStart(2, "0")}`,
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
|
-
return { curve, compressedPubkey: raw.
|
|
124
|
+
return { curve, compressedPubkey: raw.subarray(2) };
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/**
|