@ckb-ccc/did-ckb 0.2.13 → 0.3.0-next.1

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.
@@ -13,10 +13,14 @@ declare const DidCkbDataV1_base: (abstract new () => {
13
13
  toHex(): ccc.Hex;
14
14
  }) & {
15
15
  byteLength?: number;
16
- encode(_: DidCkbDataV1Like): ccc.Bytes;
17
- decode(_: ccc.BytesLike): DidCkbDataV1;
18
- fromBytes(_bytes: ccc.BytesLike): DidCkbDataV1;
19
- from(_: DidCkbDataV1Like): DidCkbDataV1;
16
+ encode: (_: DidCkbDataV1Like) => ccc.Bytes;
17
+ decode: (_: ccc.BytesLike, _config?: {
18
+ isExtraFieldIgnored?: boolean;
19
+ }) => DidCkbDataV1;
20
+ fromBytes: (_bytes: ccc.BytesLike, _config?: {
21
+ isExtraFieldIgnored?: boolean;
22
+ }) => DidCkbDataV1;
23
+ from: (_: DidCkbDataV1Like) => DidCkbDataV1;
20
24
  Base<SubTypeLike, SubType = SubTypeLike>(): any;
21
25
  BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike_1, SubType_1 = SubTypeLike_1>(): (abstract new (inner: ccc.DecodedType<CodecType>) => {
22
26
  readonly inner: ccc.DecodedType<CodecType>;
@@ -33,29 +37,40 @@ declare const DidCkbDataV1_base: (abstract new () => {
33
37
  toHex(): ccc.Hex;
34
38
  }) & {
35
39
  byteLength?: number;
36
- encode(_: SubTypeLike_1): ccc.Bytes;
37
- decode(_: ccc.BytesLike): SubType_1;
38
- fromBytes(_bytes: ccc.BytesLike): SubType_1;
39
- from(_: SubTypeLike_1): SubType_1;
40
+ encode: (_: SubTypeLike_1) => ccc.Bytes;
41
+ decode: (_: ccc.BytesLike, _config?: {
42
+ isExtraFieldIgnored?: boolean;
43
+ } | undefined) => SubType_1;
44
+ fromBytes: (_bytes: ccc.BytesLike, _config?: {
45
+ isExtraFieldIgnored?: boolean;
46
+ } | undefined) => SubType_1;
47
+ from: (_: SubTypeLike_1) => SubType_1;
40
48
  Base<SubTypeLike, SubType = SubTypeLike>(): any;
41
49
  BaseUnion<CodecType_1 extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1>(): any;
42
50
  };
43
51
  };
44
52
  export declare class DidCkbDataV1 extends DidCkbDataV1_base {
45
53
  document: unknown;
46
- localId?: string | undefined;
47
- constructor(document: unknown, localId?: string | undefined);
54
+ localId?: string;
55
+ constructor({ document, localId }: {
56
+ document: unknown;
57
+ localId?: string;
58
+ });
48
59
  static from(data: DidCkbDataV1Like): DidCkbDataV1;
49
60
  }
50
- export type DidCkbDataLike = {
51
- type?: "v1" | null;
61
+ declare const DidCkbDataCodec: ccc.Codec<{
62
+ type: "v1";
52
63
  value: DidCkbDataV1Like;
53
64
  } | {
54
65
  inner: {
55
- type?: "v1" | null;
66
+ type: "v1";
56
67
  value: DidCkbDataV1Like;
57
68
  };
58
- };
69
+ }, {
70
+ type: "v1";
71
+ value: DidCkbDataV1;
72
+ }>;
73
+ export type DidCkbDataLike = ccc.EncodableType<typeof DidCkbDataCodec>;
59
74
  declare const DidCkbData_base: (abstract new (inner: {
60
75
  type: "v1";
61
76
  value: DidCkbDataV1;
@@ -97,15 +112,43 @@ declare const DidCkbData_base: (abstract new (inner: {
97
112
  }): Result;
98
113
  toBytes(): ccc.Bytes;
99
114
  clone(): DidCkbData;
100
- eq(other: DidCkbDataLike): boolean;
115
+ eq(other: {
116
+ type: "v1";
117
+ value: DidCkbDataV1Like;
118
+ } | {
119
+ inner: {
120
+ type: "v1";
121
+ value: DidCkbDataV1Like;
122
+ };
123
+ }): boolean;
101
124
  hash(): ccc.Hex;
102
125
  toHex(): ccc.Hex;
103
126
  }) & {
104
127
  byteLength?: number;
105
- encode(_: DidCkbDataLike): ccc.Bytes;
106
- decode(_: ccc.BytesLike): DidCkbData;
107
- fromBytes(_bytes: ccc.BytesLike): DidCkbData;
108
- from(_: DidCkbDataLike): DidCkbData;
128
+ encode: (_: {
129
+ type: "v1";
130
+ value: DidCkbDataV1Like;
131
+ } | {
132
+ inner: {
133
+ type: "v1";
134
+ value: DidCkbDataV1Like;
135
+ };
136
+ }) => ccc.Bytes;
137
+ decode: (_: ccc.BytesLike, _config?: {
138
+ isExtraFieldIgnored?: boolean;
139
+ } | undefined) => DidCkbData;
140
+ fromBytes: (_bytes: ccc.BytesLike, _config?: {
141
+ isExtraFieldIgnored?: boolean;
142
+ } | undefined) => DidCkbData;
143
+ from: (_: {
144
+ type: "v1";
145
+ value: DidCkbDataV1Like;
146
+ } | {
147
+ inner: {
148
+ type: "v1";
149
+ value: DidCkbDataV1Like;
150
+ };
151
+ }) => DidCkbData;
109
152
  Base<SubTypeLike_1, SubType_1 = SubTypeLike_1>(): (abstract new () => {
110
153
  toBytes(): ccc.Bytes;
111
154
  clone(): SubType_1;
@@ -114,24 +157,21 @@ declare const DidCkbData_base: (abstract new (inner: {
114
157
  toHex(): ccc.Hex;
115
158
  }) & {
116
159
  byteLength?: number;
117
- encode(_: SubTypeLike_1): ccc.Bytes;
118
- decode(_: ccc.BytesLike): SubType_1;
119
- fromBytes(_bytes: ccc.BytesLike): SubType_1;
120
- from(_: SubTypeLike_1): SubType_1;
160
+ encode: (_: SubTypeLike_1) => ccc.Bytes;
161
+ decode: (_: ccc.BytesLike, _config?: {
162
+ isExtraFieldIgnored?: boolean;
163
+ }) => SubType_1;
164
+ fromBytes: (_bytes: ccc.BytesLike, _config?: {
165
+ isExtraFieldIgnored?: boolean;
166
+ }) => SubType_1;
167
+ from: (_: SubTypeLike_1) => SubType_1;
121
168
  Base<SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1>(): any;
122
169
  BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike, SubType = SubTypeLike>(): any;
123
170
  };
124
171
  BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike, SubType = SubTypeLike>(): any;
125
172
  };
126
173
  export declare class DidCkbData extends DidCkbData_base {
127
- type: "v1";
128
- value: DidCkbDataV1;
129
- constructor(type: "v1", value: DidCkbDataV1);
130
- static from(data: DidCkbDataLike): DidCkbData;
131
- static fromV1(data: DidCkbDataV1Like): DidCkbData & {
132
- type: "v1";
133
- value: DidCkbDataV1;
134
- };
174
+ static fromV1(data: DidCkbDataV1Like): DidCkbData;
135
175
  }
136
176
  export type PlcAuthorizationLike = {
137
177
  history: object[];
@@ -146,10 +186,14 @@ declare const PlcAuthorization_base: (abstract new () => {
146
186
  toHex(): ccc.Hex;
147
187
  }) & {
148
188
  byteLength?: number;
149
- encode(_: PlcAuthorizationLike): ccc.Bytes;
150
- decode(_: ccc.BytesLike): PlcAuthorization;
151
- fromBytes(_bytes: ccc.BytesLike): PlcAuthorization;
152
- from(_: PlcAuthorizationLike): PlcAuthorization;
189
+ encode: (_: PlcAuthorizationLike) => ccc.Bytes;
190
+ decode: (_: ccc.BytesLike, _config?: {
191
+ isExtraFieldIgnored?: boolean;
192
+ }) => PlcAuthorization;
193
+ fromBytes: (_bytes: ccc.BytesLike, _config?: {
194
+ isExtraFieldIgnored?: boolean;
195
+ }) => PlcAuthorization;
196
+ from: (_: PlcAuthorizationLike) => PlcAuthorization;
153
197
  Base<SubTypeLike, SubType = SubTypeLike>(): any;
154
198
  BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike_1, SubType_1 = SubTypeLike_1>(): (abstract new (inner: ccc.DecodedType<CodecType>) => {
155
199
  readonly inner: ccc.DecodedType<CodecType>;
@@ -166,10 +210,14 @@ declare const PlcAuthorization_base: (abstract new () => {
166
210
  toHex(): ccc.Hex;
167
211
  }) & {
168
212
  byteLength?: number;
169
- encode(_: SubTypeLike_1): ccc.Bytes;
170
- decode(_: ccc.BytesLike): SubType_1;
171
- fromBytes(_bytes: ccc.BytesLike): SubType_1;
172
- from(_: SubTypeLike_1): SubType_1;
213
+ encode: (_: SubTypeLike_1) => ccc.Bytes;
214
+ decode: (_: ccc.BytesLike, _config?: {
215
+ isExtraFieldIgnored?: boolean;
216
+ } | undefined) => SubType_1;
217
+ fromBytes: (_bytes: ccc.BytesLike, _config?: {
218
+ isExtraFieldIgnored?: boolean;
219
+ } | undefined) => SubType_1;
220
+ from: (_: SubTypeLike_1) => SubType_1;
173
221
  Base<SubTypeLike, SubType = SubTypeLike>(): any;
174
222
  BaseUnion<CodecType_1 extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1>(): any;
175
223
  };
@@ -178,7 +226,11 @@ export declare class PlcAuthorization extends PlcAuthorization_base {
178
226
  history: object[];
179
227
  sig: ccc.Hex;
180
228
  rotationKeyIndices: ccc.Num[];
181
- constructor(history: object[], sig: ccc.Hex, rotationKeyIndices: ccc.Num[]);
229
+ constructor({ history, sig, rotationKeyIndices }: {
230
+ history: object[];
231
+ sig: ccc.Hex;
232
+ rotationKeyIndices: number[];
233
+ });
182
234
  static from(data: PlcAuthorizationLike): PlcAuthorization;
183
235
  }
184
236
  export type DidCkbWitnessLike = {
@@ -192,10 +244,14 @@ declare const DidCkbWitness_base: (abstract new () => {
192
244
  toHex(): ccc.Hex;
193
245
  }) & {
194
246
  byteLength?: number;
195
- encode(_: DidCkbWitnessLike): ccc.Bytes;
196
- decode(_: ccc.BytesLike): DidCkbWitness;
197
- fromBytes(_bytes: ccc.BytesLike): DidCkbWitness;
198
- from(_: DidCkbWitnessLike): DidCkbWitness;
247
+ encode: (_: DidCkbWitnessLike) => ccc.Bytes;
248
+ decode: (_: ccc.BytesLike, _config?: {
249
+ isExtraFieldIgnored?: boolean;
250
+ }) => DidCkbWitness;
251
+ fromBytes: (_bytes: ccc.BytesLike, _config?: {
252
+ isExtraFieldIgnored?: boolean;
253
+ }) => DidCkbWitness;
254
+ from: (_: DidCkbWitnessLike) => DidCkbWitness;
199
255
  Base<SubTypeLike, SubType = SubTypeLike>(): any;
200
256
  BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike_1, SubType_1 = SubTypeLike_1>(): (abstract new (inner: ccc.DecodedType<CodecType>) => {
201
257
  readonly inner: ccc.DecodedType<CodecType>;
@@ -212,18 +268,23 @@ declare const DidCkbWitness_base: (abstract new () => {
212
268
  toHex(): ccc.Hex;
213
269
  }) & {
214
270
  byteLength?: number;
215
- encode(_: SubTypeLike_1): ccc.Bytes;
216
- decode(_: ccc.BytesLike): SubType_1;
217
- fromBytes(_bytes: ccc.BytesLike): SubType_1;
218
- from(_: SubTypeLike_1): SubType_1;
271
+ encode: (_: SubTypeLike_1) => ccc.Bytes;
272
+ decode: (_: ccc.BytesLike, _config?: {
273
+ isExtraFieldIgnored?: boolean;
274
+ } | undefined) => SubType_1;
275
+ fromBytes: (_bytes: ccc.BytesLike, _config?: {
276
+ isExtraFieldIgnored?: boolean;
277
+ } | undefined) => SubType_1;
278
+ from: (_: SubTypeLike_1) => SubType_1;
219
279
  Base<SubTypeLike, SubType = SubTypeLike>(): any;
220
280
  BaseUnion<CodecType_1 extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>>, SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1>(): any;
221
281
  };
222
282
  };
223
283
  export declare class DidCkbWitness extends DidCkbWitness_base {
224
284
  localIdAuthorization: PlcAuthorization;
225
- constructor(localIdAuthorization: PlcAuthorization);
226
- static from(data: DidCkbWitnessLike): DidCkbWitness;
285
+ constructor({ localIdAuthorization }: {
286
+ localIdAuthorization: PlcAuthorization;
287
+ });
227
288
  }
228
289
  //#endregion
229
290
  //#region src/didCkb.d.ts
@@ -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":";;;YAG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R,KAAK,IAAI;IACP;EACF,IAAI,IAAI;EACR;;;;YChFU;YAEA;;;;;EAKV,QAAQ;EACR,QAAQ,IAAI;EACZ,aAAa,IAAI;EACjB,cAAc,IAAI;EAClB,UAAU,IAAI;EACd,MAAM;;;;;;;;;;;;;;;;;wBAoBc,iBAAiB;EACrC,QAAQ,IAAI;;;;;EAKZ,IAAI,IAAI;;EAER,WAAW,IAAI;;EAEf;IACE,QAAQ;;;wBChCI,aAAa,OAAO,IAAI;wBAmBxB,aAAa,gBAAgB,IAAI;;;;;wBAwBjC,UAAU,MAAM,IAAI;;;;;wBAcpB,UAAU,cAAc,IAAI;wBAqB5B,SAAS;;;;;;;;;;;;;;;;;wBCtET,sBAAsB;EACpC,QAAQ,IAAI;EACZ,kBAAkB;EAClB;EACA,oBAAoB,IAAI;EACxB,QAAQ;EACR;IACE;;;;;;;;;;;;;wBAkCkB,cAAc;EAClC,QAAQ,IAAI;EACZ;EACA,OAAO;EACP,WAAW,IAAI;EACf,KAAK,IAAI;IACP;EACF,IAAI,IAAI;EACR,IAAI,IAAI;EACR;;;;YCtEU;;EAEV;;EAEA,IAAI,IAAI;;EAER,MAAM;;EAEN,MAAM,IAAI;;;;;;;;wBA8BU,eAAe;EACnC,QAAQ,IAAI;EACZ,IAAI,IAAI;IACN,QAAQ;;;;;;;wBAgBU,cAAc;EAClC,QAAQ,IAAI;EACZ;IACE,QAAQ;;;;;;;;wBAcU,kBAAkB;EACtC,QAAQ,IAAI;EACZ,MAAM,IAAI;EACV;EACA;IACE,QAAQ"}
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;;;;;;;;;;;;IAoJ2j/B;;;IAAub;;;;;;;MAA6nC;;;;;;;;;;;IAAs/C;;IAA+pB,SAAA,GAAA,IAAA,WAAA;MAAgC;;IAA6b,YAAA,QAA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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;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./barrel-Ng74XYgh.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;
@@ -1 +1 @@
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;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./barrel-Ng74XYgh.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckb-ccc/did-ckb",
3
- "version": "0.2.13",
3
+ "version": "0.3.0-next.1",
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",
@@ -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.22.0",
51
- "@ckb-ccc/type-id": "0.1.13"
50
+ "@ckb-ccc/core": "2.0.0-next.1",
51
+ "@ckb-ccc/type-id": "0.1.14-next.0"
52
52
  },
53
53
  "types": "./dist.commonjs/index.d.ts",
54
54
  "inlinedDependencies": {
package/src/codec.ts CHANGED
@@ -26,11 +26,13 @@ export class DidCkbDataV1 extends ccc.Entity.Base<
26
26
  DidCkbDataV1Like,
27
27
  DidCkbDataV1
28
28
  >() {
29
- constructor(
30
- public document: unknown,
31
- public localId?: string,
32
- ) {
29
+ public document: unknown;
30
+ public localId?: string;
31
+
32
+ constructor({ document, localId }: { document: unknown; localId?: string }) {
33
33
  super();
34
+ this.document = document;
35
+ this.localId = localId ?? undefined;
34
36
  }
35
37
 
36
38
  static from(data: DidCkbDataV1Like): DidCkbDataV1 {
@@ -38,7 +40,10 @@ export class DidCkbDataV1 extends ccc.Entity.Base<
38
40
  return data;
39
41
  }
40
42
 
41
- return new DidCkbDataV1(data.document, data.localId ?? undefined);
43
+ return new DidCkbDataV1({
44
+ document: data.document,
45
+ localId: data.localId ?? undefined,
46
+ });
42
47
  }
43
48
  }
44
49
 
@@ -46,17 +51,7 @@ const DidCkbDataCodec = ccc.mol.union({
46
51
  v1: DidCkbDataV1,
47
52
  });
48
53
 
49
- export type DidCkbDataLike =
50
- | {
51
- type?: "v1" | null;
52
- value: DidCkbDataV1Like;
53
- }
54
- | {
55
- inner: {
56
- type?: "v1" | null;
57
- value: DidCkbDataV1Like;
58
- };
59
- };
54
+ export type DidCkbDataLike = ccc.EncodableType<typeof DidCkbDataCodec>;
60
55
 
61
56
  @ccc.codec(DidCkbDataCodec)
62
57
  export class DidCkbData extends ccc.Entity.BaseUnion<
@@ -64,32 +59,11 @@ export class DidCkbData extends ccc.Entity.BaseUnion<
64
59
  DidCkbDataLike,
65
60
  DidCkbData
66
61
  >() {
67
- constructor(
68
- public type: "v1",
69
- public value: DidCkbDataV1,
70
- ) {
71
- super({ type, value });
72
- }
73
-
74
- static from(data: DidCkbDataLike): DidCkbData {
75
- if (data instanceof DidCkbData) {
76
- return data;
77
- }
78
-
79
- if ("inner" in data) {
80
- return new DidCkbData(
81
- data.inner.type ?? "v1",
82
- DidCkbDataV1.from(data.inner.value),
83
- );
84
- }
85
-
86
- return new DidCkbData(data.type ?? "v1", DidCkbDataV1.from(data.value));
87
- }
88
-
89
- static fromV1(
90
- data: DidCkbDataV1Like,
91
- ): DidCkbData & { type: "v1"; value: DidCkbDataV1 } {
92
- return new DidCkbData("v1", DidCkbDataV1.from(data));
62
+ static fromV1(data: DidCkbDataV1Like): DidCkbData {
63
+ return DidCkbData.from({
64
+ type: "v1",
65
+ value: DidCkbDataV1.from(data),
66
+ });
93
67
  }
94
68
  }
95
69
 
@@ -121,23 +95,36 @@ export class PlcAuthorization extends ccc.Entity.Base<
121
95
  PlcAuthorizationLike,
122
96
  PlcAuthorization
123
97
  >() {
124
- constructor(
125
- public history: object[],
126
- public sig: ccc.Hex,
127
- public rotationKeyIndices: ccc.Num[],
128
- ) {
98
+ public history: object[];
99
+ public sig: ccc.Hex;
100
+ public rotationKeyIndices: ccc.Num[];
101
+
102
+ constructor({
103
+ history,
104
+ sig,
105
+ rotationKeyIndices,
106
+ }: {
107
+ history: object[];
108
+ sig: ccc.Hex;
109
+ rotationKeyIndices: number[];
110
+ }) {
129
111
  super();
112
+ this.history = history;
113
+ this.sig = sig;
114
+ this.rotationKeyIndices = rotationKeyIndices.map(ccc.numFrom);
130
115
  }
131
116
 
132
117
  static from(data: PlcAuthorizationLike): PlcAuthorization {
133
118
  if (data instanceof PlcAuthorization) {
134
119
  return data;
135
120
  }
136
- return new PlcAuthorization(
137
- data.history,
138
- ccc.hexFrom(data.sig),
139
- data.rotationKeyIndices.map(ccc.numFrom),
140
- );
121
+ return new PlcAuthorization({
122
+ history: data.history,
123
+ sig: ccc.hexFrom(data.sig),
124
+ rotationKeyIndices: data.rotationKeyIndices.map((v) =>
125
+ Number(ccc.numFrom(v)),
126
+ ),
127
+ });
141
128
  }
142
129
  }
143
130
 
@@ -153,14 +140,14 @@ export class DidCkbWitness extends ccc.Entity.Base<
153
140
  DidCkbWitnessLike,
154
141
  DidCkbWitness
155
142
  >() {
156
- constructor(public localIdAuthorization: PlcAuthorization) {
157
- super();
158
- }
143
+ public localIdAuthorization: PlcAuthorization;
159
144
 
160
- static from(data: DidCkbWitnessLike): DidCkbWitness {
161
- if (data instanceof DidCkbWitness) {
162
- return data;
163
- }
164
- return new DidCkbWitness(PlcAuthorization.from(data.localIdAuthorization));
145
+ constructor({
146
+ localIdAuthorization,
147
+ }: {
148
+ localIdAuthorization: PlcAuthorization;
149
+ }) {
150
+ super();
151
+ this.localIdAuthorization = localIdAuthorization;
165
152
  }
166
153
  }
package/src/history.ts CHANGED
@@ -88,7 +88,9 @@ export async function getDidCkbHistory(props: {
88
88
  if (!prior) {
89
89
  // No DID input means this tx is the genesis. If the genesis carries a
90
90
  // `localId` it's a did:plc migration; otherwise a plain CREATE.
91
- entry.action = entry.data.value.localId ? "MIGRATE" : "CREATE";
91
+ entry.action = entry.data.match({
92
+ v1: (data) => (data.localId ? "MIGRATE" : "CREATE"),
93
+ });
92
94
  history.push(entry);
93
95
  break;
94
96
  }
package/src/migrate.ts CHANGED
@@ -80,10 +80,17 @@ export async function migrateDidCkb(props: {
80
80
 
81
81
  const data = DidCkbData.from(
82
82
  props.data ?? {
83
+ type: "v1",
83
84
  value: { document: {} },
84
85
  },
85
86
  );
86
- data.value.localId = props.sourceDid;
87
+
88
+ data.match({
89
+ v1: (data) => {
90
+ data.localId = props.sourceDid;
91
+ },
92
+ });
93
+
87
94
  return createDidCkb({
88
95
  signer: props.signer,
89
96
  data,
@@ -1,2 +0,0 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{getRotationKeys as t,signRotationHash as n,t as r}from"./plc.mjs";import{ccc as i}from"@ckb-ccc/core";import{decode as a,encode as o}from"@ipld/dag-cbor";import{typeIdA as s}from"@ckb-ccc/type-id/advanced";function c(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var l,u,d,f;let p=l=class extends i.Entity.Base(){constructor(e,t){super(),this.document=e,this.localId=t}static from(e){return e instanceof l?e:new l(e.document,e.localId??void 0)}};p=l=c([i.codec(i.mol.table({document:i.mol.Bytes,localId:i.mol.StringOpt}).map({inMap:e=>({...e,document:i.hexFrom(o(e.document))}),outMap:e=>({...e,document:a(i.bytesFrom(e.document))})}))],p);const m=i.mol.union({v1:p});let h=u=class extends i.Entity.BaseUnion(){constructor(e,t){super({type:e,value:t}),this.type=e,this.value=t}static from(e){return e instanceof u?e:`inner`in e?new u(e.inner.type??`v1`,p.from(e.inner.value)):new u(e.type??`v1`,p.from(e.value))}static fromV1(e){return new u(`v1`,p.from(e))}};h=u=c([i.codec(m)],h);let g=d=class extends i.Entity.Base(){constructor(e,t,n){super(),this.history=e,this.sig=t,this.rotationKeyIndices=n}static from(e){return e instanceof d?e:new d(e.history,i.hexFrom(e.sig),e.rotationKeyIndices.map(i.numFrom))}};g=d=c([i.codec(i.mol.table({history:i.mol.BytesVec,sig:i.mol.Bytes,rotationKeyIndices:i.mol.Uint8Vec}).map({inMap:e=>({...e,history:e.history.map(e=>i.hexFrom(o(e)))}),outMap:e=>({...e,history:e.history.map(e=>a(i.bytesFrom(e)))})}))],g);let _=f=class extends i.Entity.Base(){constructor(e){super(),this.localIdAuthorization=e}static from(e){return e instanceof f?e:new f(g.from(e.localIdAuthorization))}};_=f=c([i.codec(i.mol.table({localIdAuthorization:g}))],_);const v=s.buildTypeIdOperations({async getScriptInfo(e){return e.getKnownScript(i.KnownScript.DidCkb)},codec:h,async calculateTypeId(e,t){return i.bytesFrom(i.hashTypeId(t.inputs[0],t.outputs.length)).slice(0,20)}});function y(e){return v.create(e)}async function b(e){return v.transfer(e)}async function x(e){return v.destroy(e)}const S=`did:ckb:`,C=`abcdefghijklmnopqrstuvwxyz234567`,w=(()=>{let e={};for(let t=0;t<32;t++)e[C[t]]=t;return e})();function T(e){let t=i.bytesFrom(e),n=0,r=0,a=``;for(let e=0;e<t.length;e++)for(r=r<<8|t[e],n+=8;n>=5;)a+=C[r>>>n-5&31],n-=5;return n>0&&(a+=C[r<<5-n&31]),a}function E(e){let t=e.toLowerCase().replace(/=+$/g,``),n=0,r=0,i=[];for(let e of t){let t=w[e];if(t===void 0)throw Error(`Invalid base32 character "${e}" in input`);r=r<<5|t,n+=5,n>=8&&(i.push(r>>>n-8&255),n-=8)}return Uint8Array.from(i)}function D(e){let t=i.bytesFrom(e);if(t.length!==20)throw Error(`did:ckb args must be 20 bytes, got ${t.length}`);return S+T(t)}function O(e){if(!e.startsWith(S))throw Error(`Expected did:ckb:..., got "${e}"`);let t=e.slice(8);if(t.length!==32)throw Error(`did:ckb identifier must be 32 base32 chars, got ${t.length}`);let n=E(t);if(n.length!==20)throw Error(`did:ckb identifier must decode to 20 bytes, got ${n.length}`);return i.hexFrom(n)}function k(e){if(!e.startsWith(S))return!1;try{return O(e),!0}catch{return!1}}async function A(e,t){let n=await e.getKnownScript(i.KnownScript.DidCkb);return i.Script.from({codeHash:n.codeHash,hashType:n.hashType,args:t})}function j(e,t){return{did:D(t),id:t,data:h.decode(e.outputData),cell:e}}async function M(e){let t=i.hexFrom(e.id),n=await A(e.client,t),r=await e.client.findSingletonCellByType(n,!0);if(r)return j(r,t)}async function N(e){if(!k(e.did))throw Error(`Not a did:ckb identifier: ${e.did}`);return M({client:e.client,id:O(e.did)})}async function P(e){let t=await e.client.getKnownScript(i.KnownScript.DidCkb),n=[];for await(let r of e.client.findCells({script:i.Script.from(e.lock),scriptType:`lock`,scriptSearchMode:`exact`,filter:{script:i.Script.from({codeHash:t.codeHash,hashType:t.hashType,args:`0x`})},withData:!0},e.order,e.limit)){let e=r.cellOutput.type;if(e&&i.bytesFrom(e.args).length===20)try{n.push(j(r,i.hexFrom(e.args)))}catch{}}return n}async function F(e){let t=typeof e.id==`string`&&k(e.id)?O(e.id):i.hexFrom(e.id),n=(await e.client.getKnownScript(i.KnownScript.DidCkb)).codeHash.toLowerCase(),r=t.toLowerCase(),a=e.liveCell??(await M({client:e.client,id:t}))?.cell;if(!a)return[];let o=[],s=e.maxSteps??50,c=0;for(;a&&c<s;){c++;let t=await e.client.getTransaction(a.outPoint.txHash);if(!t)break;let i=L(a,t.blockNumber);if(!i)break;let s=await I(e.client,t.transaction,n,r);if(!s){i.action=i.data.value.localId?`MIGRATE`:`CREATE`,o.push(i);break}i.action=`UPDATE`,o.push(i),a=s}return o}async function I(e,t,n,r){let{inputs:a}=i.Transaction.from(t);for(let t of a){let a;try{a=await t.getCell(e)}catch{continue}let o=a.cellOutput.type;if(o&&o.codeHash.toLowerCase()===n&&i.hexFrom(o.args).toLowerCase()===r)return a}}function L(e,t){try{let n=h.decode(e.outputData);return{action:`UPDATE`,txHash:e.outPoint.txHash,outputIndex:e.outPoint.index,blockNumber:t,capacity:e.cellOutput.capacity,data:n}}catch{return}}function R(e){let r=t(e.genesisOperation);if(!r[e.rotationKeyIndex])throw Error(`rotationKeyIndex ${e.rotationKeyIndex} out of range (genesis has ${r.length} keys)`);let a=e.curve??r[e.rotationKeyIndex].curve,o=n(e.rotationPrivateKey,i.bytesFrom(e.txHash),a);return _.from({localIdAuthorization:{history:[e.genesisOperation],sig:i.hexFrom(o),rotationKeyIndices:[e.selfSigIndex??0,e.rotationKeyIndex]}})}async function z(e){if(!e.sourceDid.startsWith(`did:plc:`))throw Error(`sourceDid must be did:plc:..., got "${e.sourceDid}"`);let t=h.from(e.data??{value:{document:{}}});return t.value.localId=e.sourceDid,y({signer:e.signer,data:t,receiver:e.receiver,tx:e.tx})}var B=e({DidCkbData:()=>h,DidCkbDataV1:()=>p,DidCkbWitness:()=>_,PlcAuthorization:()=>g,argsToDid:()=>D,base32Decode:()=>E,base32Encode:()=>T,buildMigrationWitness:()=>R,createDidCkb:()=>y,destroyDidCkb:()=>x,didToArgs:()=>O,findDidCkbCell:()=>M,getDidCkbHistory:()=>F,isDidCkb:()=>k,listDidCkbsByLock:()=>P,migrateDidCkb:()=>z,plc:()=>r,resolveDidCkb:()=>N,transferDidCkb:()=>b});export{p as _,M as a,D as c,O as d,k as f,h as g,b as h,F as i,E as l,x as m,R as n,P as o,y as p,z as r,N as s,B as t,T as u,_ as v,g as y};
2
- //# sourceMappingURL=barrel-DEJnxd4o.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"barrel-DEJnxd4o.mjs","names":["cborEncode","cborDecode"],"sources":["../src/codec.ts","../src/didCkb.ts","../src/identifier.ts","../src/resolver.ts","../src/history.ts","../src/migrate.ts","../src/barrel.ts"],"sourcesContent":["import { ccc } from \"@ckb-ccc/core\";\nimport { decode as cborDecode, encode as cborEncode } from \"@ipld/dag-cbor\";\n\nexport type DidCkbDataV1Like = {\n document: unknown;\n localId?: string | null;\n};\n@ccc.codec(\n ccc.mol\n .table({\n document: ccc.mol.Bytes,\n localId: ccc.mol.StringOpt,\n })\n .map({\n inMap: (data: DidCkbDataV1Like) => ({\n ...data,\n document: ccc.hexFrom(cborEncode(data.document)),\n }),\n outMap: (data) => ({\n ...data,\n document: cborDecode(ccc.bytesFrom(data.document)),\n }),\n }),\n)\nexport class DidCkbDataV1 extends ccc.Entity.Base<\n DidCkbDataV1Like,\n DidCkbDataV1\n>() {\n constructor(\n public document: unknown,\n public localId?: string,\n ) {\n super();\n }\n\n static from(data: DidCkbDataV1Like): DidCkbDataV1 {\n if (data instanceof DidCkbDataV1) {\n return data;\n }\n\n return new DidCkbDataV1(data.document, data.localId ?? undefined);\n }\n}\n\nconst DidCkbDataCodec = ccc.mol.union({\n v1: DidCkbDataV1,\n});\n\nexport type DidCkbDataLike =\n | {\n type?: \"v1\" | null;\n value: DidCkbDataV1Like;\n }\n | {\n inner: {\n type?: \"v1\" | null;\n value: DidCkbDataV1Like;\n };\n };\n\n@ccc.codec(DidCkbDataCodec)\nexport class DidCkbData extends ccc.Entity.BaseUnion<\n typeof DidCkbDataCodec,\n DidCkbDataLike,\n DidCkbData\n>() {\n constructor(\n public type: \"v1\",\n public value: DidCkbDataV1,\n ) {\n super({ type, value });\n }\n\n static from(data: DidCkbDataLike): DidCkbData {\n if (data instanceof DidCkbData) {\n return data;\n }\n\n if (\"inner\" in data) {\n return new DidCkbData(\n data.inner.type ?? \"v1\",\n DidCkbDataV1.from(data.inner.value),\n );\n }\n\n return new DidCkbData(data.type ?? \"v1\", DidCkbDataV1.from(data.value));\n }\n\n static fromV1(\n data: DidCkbDataV1Like,\n ): DidCkbData & { type: \"v1\"; value: DidCkbDataV1 } {\n return new DidCkbData(\"v1\", DidCkbDataV1.from(data));\n }\n}\n\nexport type PlcAuthorizationLike = {\n history: object[];\n sig: ccc.HexLike;\n rotationKeyIndices: ccc.NumLike[];\n};\n@ccc.codec(\n ccc.mol\n .table({\n history: ccc.mol.BytesVec,\n sig: ccc.mol.Bytes,\n rotationKeyIndices: ccc.mol.Uint8Vec,\n })\n\n .map({\n inMap: (data: PlcAuthorizationLike) => ({\n ...data,\n history: data.history.map((h) => ccc.hexFrom(cborEncode(h))),\n }),\n outMap: (data) => ({\n ...data,\n history: data.history.map((h) => cborDecode<object>(ccc.bytesFrom(h))),\n }),\n }),\n)\nexport class PlcAuthorization extends ccc.Entity.Base<\n PlcAuthorizationLike,\n PlcAuthorization\n>() {\n constructor(\n public history: object[],\n public sig: ccc.Hex,\n public rotationKeyIndices: ccc.Num[],\n ) {\n super();\n }\n\n static from(data: PlcAuthorizationLike): PlcAuthorization {\n if (data instanceof PlcAuthorization) {\n return data;\n }\n return new PlcAuthorization(\n data.history,\n ccc.hexFrom(data.sig),\n data.rotationKeyIndices.map(ccc.numFrom),\n );\n }\n}\n\nexport type DidCkbWitnessLike = {\n localIdAuthorization: PlcAuthorizationLike;\n};\n@ccc.codec(\n ccc.mol.table({\n localIdAuthorization: PlcAuthorization,\n }),\n)\nexport class DidCkbWitness extends ccc.Entity.Base<\n DidCkbWitnessLike,\n DidCkbWitness\n>() {\n constructor(public localIdAuthorization: PlcAuthorization) {\n super();\n }\n\n static from(data: DidCkbWitnessLike): DidCkbWitness {\n if (data instanceof DidCkbWitness) {\n return data;\n }\n return new DidCkbWitness(PlcAuthorization.from(data.localIdAuthorization));\n }\n}\n","import { ccc } from \"@ckb-ccc/core\";\nimport { typeIdA } from \"@ckb-ccc/type-id/advanced\";\nimport { DidCkbData, DidCkbDataLike } from \"./codec\";\n\nconst OPERATIONS = typeIdA.buildTypeIdOperations({\n async getScriptInfo(client: ccc.Client): Promise<ccc.ScriptInfo> {\n return client.getKnownScript(ccc.KnownScript.DidCkb);\n },\n codec: DidCkbData,\n async calculateTypeId(\n _: ccc.Client,\n tx: ccc.Transaction,\n ): Promise<ccc.HexLike> {\n return ccc\n .bytesFrom(ccc.hashTypeId(tx.inputs[0], tx.outputs.length))\n .slice(0, 20);\n },\n});\n\n/**\n * Create a DID CKB cell.\n *\n * @param props The arguments for creating the cell.\n * @param props.signer The signer to sign the transaction.\n * @param props.receiver The receiver script (optional).\n * @param props.data The output data.\n * @param props.tx The transaction skeleton (optional).\n */\nexport function createDidCkb(props: {\n signer: ccc.Signer;\n data: DidCkbDataLike;\n receiver?: ccc.ScriptLike | null;\n tx?: ccc.TransactionLike | null;\n}): Promise<{\n tx: ccc.Transaction;\n id: ccc.Hex;\n index: number;\n}> {\n return OPERATIONS.create(props);\n}\n\n/**\n * Transfer a DID CKB cell.\n *\n * @param props The arguments for transferring the cell.\n * @param props.client The client to communicate with CKB.\n * @param props.id The Type ID to transfer.\n * @param props.receiver The new receiver script.\n * @param props.tx The transaction skeleton (optional).\n * @param props.data The new output data or a transformer to update the data (optional).\n */\nexport async function transferDidCkb(props: {\n client: ccc.Client;\n id: ccc.HexLike;\n receiver: ccc.ScriptLike;\n tx?: ccc.TransactionLike | null;\n data?:\n | DidCkbDataLike\n | ((\n cell: ccc.Cell,\n data?: DidCkbData,\n ) => DidCkbDataLike | Promise<DidCkbDataLike>)\n | null;\n}): Promise<{\n tx: ccc.Transaction;\n inIndex: number;\n outIndex: number;\n}> {\n return OPERATIONS.transfer(props);\n}\n\n/**\n * Destroy a DID CKB cell.\n *\n * @param props The arguments for destroying the cell.\n * @param props.client The client to communicate with CKB.\n * @param props.id The Type ID to destroy.\n * @param props.tx The transaction skeleton (optional).\n */\nexport async function destroyDidCkb(props: {\n client: ccc.Client;\n id: ccc.HexLike;\n tx?: ccc.TransactionLike | null;\n}): Promise<{\n tx: ccc.Transaction;\n index: number;\n}> {\n return OPERATIONS.destroy(props);\n}\n","import { ccc } from \"@ckb-ccc/core\";\n\nconst DID_PREFIX = \"did:ckb:\";\nconst ARGS_LEN_BYTES = 20;\nconst DID_BODY_LEN = 32;\n\n// RFC 4648 base32, lowercase, no padding (WIP-01 §2.2.3).\nconst ALPHABET = \"abcdefghijklmnopqrstuvwxyz234567\";\nconst REVERSE = (() => {\n const map: Record<string, number> = {};\n for (let i = 0; i < ALPHABET.length; i++) {\n map[ALPHABET[i]] = i;\n }\n return map;\n})();\n\nexport function base32Encode(bytes: ccc.BytesLike): string {\n const buf = ccc.bytesFrom(bytes);\n let bits = 0;\n let value = 0;\n let output = \"\";\n for (let i = 0; i < buf.length; i++) {\n value = (value << 8) | buf[i];\n bits += 8;\n while (bits >= 5) {\n output += ALPHABET[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n if (bits > 0) {\n output += ALPHABET[(value << (5 - bits)) & 31];\n }\n return output;\n}\n\nexport function base32Decode(input: string): ccc.Bytes {\n const cleaned = input.toLowerCase().replace(/=+$/g, \"\");\n let bits = 0;\n let value = 0;\n const output: number[] = [];\n for (const char of cleaned) {\n const v = REVERSE[char];\n if (v === undefined) {\n throw new Error(`Invalid base32 character \"${char}\" in input`);\n }\n value = (value << 5) | v;\n bits += 5;\n if (bits >= 8) {\n output.push((value >>> (bits - 8)) & 0xff);\n bits -= 8;\n }\n }\n return Uint8Array.from(output);\n}\n\n/**\n * Convert 20-byte Type ID args (the `id` returned from `createDidCkb`) to a\n * `did:ckb:` identifier string per WIP-01 §2.2.\n */\nexport function argsToDid(args: ccc.HexLike): string {\n const bytes = ccc.bytesFrom(args);\n if (bytes.length !== ARGS_LEN_BYTES) {\n throw new Error(\n `did:ckb args must be ${ARGS_LEN_BYTES} bytes, got ${bytes.length}`,\n );\n }\n return DID_PREFIX + base32Encode(bytes);\n}\n\n/**\n * Reverse of `argsToDid`. Validates the prefix, base32 length, and decoded\n * byte count.\n */\nexport function didToArgs(did: string): ccc.Hex {\n if (!did.startsWith(DID_PREFIX)) {\n throw new Error(`Expected did:ckb:..., got \"${did}\"`);\n }\n const body = did.slice(DID_PREFIX.length);\n // 20 bytes encode to exactly 32 base32 chars without padding. Any other\n // length silently truncates leftover bits, so reject it up front.\n if (body.length !== DID_BODY_LEN) {\n throw new Error(\n `did:ckb identifier must be ${DID_BODY_LEN} base32 chars, got ${body.length}`,\n );\n }\n const bytes = base32Decode(body);\n if (bytes.length !== ARGS_LEN_BYTES) {\n throw new Error(\n `did:ckb identifier must decode to ${ARGS_LEN_BYTES} bytes, got ${bytes.length}`,\n );\n }\n return ccc.hexFrom(bytes);\n}\n\nexport function isDidCkb(value: string): boolean {\n if (!value.startsWith(DID_PREFIX)) {\n return false;\n }\n try {\n didToArgs(value);\n return true;\n } catch {\n return false;\n }\n}\n","import { ccc } from \"@ckb-ccc/core\";\nimport { DidCkbData } from \"./codec\";\nimport { argsToDid, didToArgs, isDidCkb } from \"./identifier\";\n\nexport type DidCkbRecord = {\n /** The `did:ckb:` string identifying this cell. */\n did: string;\n /** 20-byte Type ID args (same value `createDidCkb` returned as `id`). */\n id: ccc.Hex;\n /** Decoded DidCkbData; `.value.document` is the CBOR-decoded document. */\n data: DidCkbData;\n /** The live DID Metadata Cell itself. */\n cell: ccc.Cell;\n};\n\nasync function didCkbTypeScript(\n client: ccc.Client,\n id: ccc.HexLike,\n): Promise<ccc.Script> {\n const scriptInfo = await client.getKnownScript(ccc.KnownScript.DidCkb);\n return ccc.Script.from({\n codeHash: scriptInfo.codeHash,\n hashType: scriptInfo.hashType,\n args: id,\n });\n}\n\nfunction decodeRecord(cell: ccc.Cell, id: ccc.Hex): DidCkbRecord {\n return {\n did: argsToDid(id),\n id,\n data: DidCkbData.decode(cell.outputData),\n cell,\n };\n}\n\n/**\n * Find the live DID Metadata Cell for a given Type ID and decode its data.\n *\n * Returns `undefined` when no live cell exists (the DID was never created or\n * has been destroyed).\n */\nexport async function findDidCkbCell(props: {\n client: ccc.Client;\n id: ccc.HexLike;\n}): Promise<DidCkbRecord | undefined> {\n const id = ccc.hexFrom(props.id);\n const type = await didCkbTypeScript(props.client, id);\n const cell = await props.client.findSingletonCellByType(type, true);\n if (!cell) {\n return undefined;\n }\n return decodeRecord(cell, id);\n}\n\n/**\n * Resolve a `did:ckb:` string to its live cell + decoded document.\n *\n * Throws if `did` is not a syntactically valid did:ckb identifier. Returns\n * `undefined` if the DID was created and then destroyed, or never existed.\n */\nexport async function resolveDidCkb(props: {\n client: ccc.Client;\n did: string;\n}): Promise<DidCkbRecord | undefined> {\n if (!isDidCkb(props.did)) {\n throw new Error(`Not a did:ckb identifier: ${props.did}`);\n }\n return findDidCkbCell({ client: props.client, id: didToArgs(props.did) });\n}\n\n/**\n * List every live DID Metadata Cell owned by the given lock. Useful for\n * dashboards that want to enumerate the DIDs an address controls.\n *\n * Cells whose data fails to decode (e.g. a future on-chain schema version) are\n * skipped, not thrown, so a single bad cell can't break the whole listing.\n */\nexport async function listDidCkbsByLock(props: {\n client: ccc.Client;\n lock: ccc.ScriptLike;\n limit?: number;\n order?: \"asc\" | \"desc\";\n}): Promise<DidCkbRecord[]> {\n const scriptInfo = await props.client.getKnownScript(ccc.KnownScript.DidCkb);\n const records: DidCkbRecord[] = [];\n\n // Filter by type.codeHash + hashType (args is prefix-matched against \"0x\",\n // which matches any args). This is the standard indexer pattern for\n // \"any cell of this type, regardless of identifier\".\n for await (const cell of props.client.findCells(\n {\n script: ccc.Script.from(props.lock),\n scriptType: \"lock\",\n scriptSearchMode: \"exact\",\n filter: {\n script: ccc.Script.from({\n codeHash: scriptInfo.codeHash,\n hashType: scriptInfo.hashType,\n args: \"0x\",\n }),\n },\n withData: true,\n },\n props.order,\n props.limit,\n )) {\n const type = cell.cellOutput.type;\n if (!type) {\n continue;\n }\n const argsBytes = ccc.bytesFrom(type.args);\n if (argsBytes.length !== 20) {\n continue;\n }\n try {\n records.push(decodeRecord(cell, ccc.hexFrom(type.args)));\n } catch {\n // Skip unparseable cells rather than fail the whole listing.\n }\n }\n return records;\n}\n","import { ccc } from \"@ckb-ccc/core\";\nimport { DidCkbData } from \"./codec\";\nimport { didToArgs, isDidCkb } from \"./identifier\";\nimport { findDidCkbCell } from \"./resolver\";\n\nexport type HistoryAction = \"CREATE\" | \"UPDATE\" | \"MIGRATE\";\n\nexport type HistoryEntry = {\n /**\n * `CREATE` for a fresh mint, `MIGRATE` for a did:plc import (genesis cell\n * with a `localId` set), `UPDATE` for every subsequent transfer.\n */\n action: HistoryAction;\n txHash: ccc.Hex;\n outputIndex: ccc.Num;\n blockNumber?: ccc.Num;\n capacity: ccc.Num;\n data: DidCkbData;\n};\n\nconst DEFAULT_MAX_STEPS = 50;\n\n/**\n * Walk the DID cell chain backwards to produce the ordered list of operations\n * applied to a DID.\n *\n * Each `transferDidCkb` consumes the previous DID cell as an input and creates\n * a new one with the same Type ID args; the genesis (`createDidCkb` /\n * `createDidCkb` with localId) has no DID input. We start from the live cell,\n * read its tx, look for the prior DID cell among the inputs, and repeat. The\n * first entry returned is the newest (most recent transfer); the last is the\n * genesis.\n *\n * Cost: roughly one `getTransaction` call per step plus one `input.getCell`\n * lookup per non-DID input on each step. `input.getCell` goes through the\n * client's cell cache, so repeated walks over the same chain are cheap.\n */\nexport async function getDidCkbHistory(props: {\n client: ccc.Client;\n /**\n * Either the 20-byte Type ID args hex returned by `createDidCkb`, or a\n * `did:ckb:` URI. URIs are converted via `didToArgs`.\n */\n id: ccc.HexLike | string;\n /** Pre-resolved live cell; if omitted, we fetch it. */\n liveCell?: ccc.Cell;\n /** Safety bound to prevent runaway walks. Default 50. */\n maxSteps?: number;\n}): Promise<HistoryEntry[]> {\n const id =\n typeof props.id === \"string\" && isDidCkb(props.id)\n ? didToArgs(props.id)\n : ccc.hexFrom(props.id);\n const scriptInfo = await props.client.getKnownScript(ccc.KnownScript.DidCkb);\n const codeHash = scriptInfo.codeHash.toLowerCase();\n const normalizedId = id.toLowerCase();\n\n let cell: ccc.Cell | undefined =\n props.liveCell ??\n (await findDidCkbCell({ client: props.client, id }))?.cell;\n if (!cell) {\n return [];\n }\n\n const history: HistoryEntry[] = [];\n const maxSteps = props.maxSteps ?? DEFAULT_MAX_STEPS;\n let steps = 0;\n\n while (cell && steps < maxSteps) {\n steps++;\n const tx = await props.client.getTransaction(cell.outPoint.txHash);\n if (!tx) {\n break;\n }\n\n const entry = decodeEntry(cell, tx.blockNumber);\n if (!entry) {\n break;\n }\n\n const prior = await findPriorDidCell(\n props.client,\n tx.transaction,\n codeHash,\n normalizedId,\n );\n\n if (!prior) {\n // No DID input means this tx is the genesis. If the genesis carries a\n // `localId` it's a did:plc migration; otherwise a plain CREATE.\n entry.action = entry.data.value.localId ? \"MIGRATE\" : \"CREATE\";\n history.push(entry);\n break;\n }\n\n entry.action = \"UPDATE\";\n history.push(entry);\n cell = prior;\n }\n\n return history;\n}\n\nasync function findPriorDidCell(\n client: ccc.Client,\n tx: ccc.TransactionLike,\n codeHash: string,\n id: string,\n): Promise<ccc.Cell | undefined> {\n const { inputs } = ccc.Transaction.from(tx);\n for (const input of inputs) {\n let cell: ccc.Cell;\n try {\n cell = await input.getCell(client);\n } catch {\n // Skip inputs whose previous output we can't fetch; they can't be the\n // prior DID cell anyway, so the walk should keep looking at siblings.\n continue;\n }\n const type = cell.cellOutput.type;\n if (!type) {\n continue;\n }\n if (type.codeHash.toLowerCase() !== codeHash) {\n continue;\n }\n if (ccc.hexFrom(type.args).toLowerCase() !== id) {\n continue;\n }\n return cell;\n }\n return undefined;\n}\n\nfunction decodeEntry(\n cell: ccc.Cell,\n blockNumber?: ccc.Num,\n): HistoryEntry | undefined {\n try {\n const data = DidCkbData.decode(cell.outputData);\n return {\n action: \"UPDATE\",\n txHash: cell.outPoint.txHash,\n outputIndex: cell.outPoint.index,\n blockNumber,\n capacity: cell.cellOutput.capacity,\n data,\n };\n } catch {\n return undefined;\n }\n}\n","import { ccc } from \"@ckb-ccc/core\";\nimport { DidCkbData, DidCkbDataLike, DidCkbWitness } from \"./codec\";\nimport { createDidCkb } from \"./didCkb\";\nimport {\n getRotationKeys,\n signRotationHash,\n type Curve,\n type PlcOperation,\n} from \"./plc\";\n\n/**\n * Build the migration witness payload that authorizes a did:plc -> did:ckb\n * import. Pure: takes a tx hash + signing material, returns a typed\n * `DidCkbWitness` that the caller wraps in a `WitnessArgs.outputType` field.\n *\n * Per WIP-02 §3.1.1 we send only the genesis operation in `history`. The\n * contract recomputes the genesis CID over the CBOR-encoded op, verifies the\n * self-signature inside it, then verifies `sig` against\n * `history[0].rotationKeys[rotationKeyIndex]`.\n *\n * `selfSigIndex` defaults to 0 because PLC genesis ops are conventionally\n * self-signed by the first rotation key; override if the genesis you're\n * migrating used a different one.\n */\nexport function buildMigrationWitness(props: {\n txHash: ccc.HexLike;\n genesisOperation: PlcOperation;\n rotationKeyIndex: number;\n rotationPrivateKey: ccc.BytesLike;\n curve?: Curve;\n selfSigIndex?: number;\n}): DidCkbWitness {\n const rotationKeys = getRotationKeys(props.genesisOperation);\n if (!rotationKeys[props.rotationKeyIndex]) {\n throw new Error(\n `rotationKeyIndex ${props.rotationKeyIndex} out of range (genesis has ${rotationKeys.length} keys)`,\n );\n }\n const curve = props.curve ?? rotationKeys[props.rotationKeyIndex].curve;\n const sig = signRotationHash(\n props.rotationPrivateKey,\n ccc.bytesFrom(props.txHash),\n curve,\n );\n return DidCkbWitness.from({\n localIdAuthorization: {\n history: [props.genesisOperation],\n sig: ccc.hexFrom(sig),\n rotationKeyIndices: [props.selfSigIndex ?? 0, props.rotationKeyIndex],\n },\n });\n}\n\n/**\n * Build a create tx whose output declares an imported did:plc identifier in\n * its `localId` field. Equivalent to calling `createDidCkb` with\n * `data.value.localId = sourceDid`; provided as a named helper for symmetry\n * with the other DID operations and so `did:plc:` migrations have an\n * obvious entry point.\n *\n * The caller is responsible for: completing inputs + fee, building the\n * migration witness with `buildMigrationWitness`, and setting it at the\n * witness slot of input 0. See `packages/examples/src/migrateDid.ts` for the\n * full flow.\n */\nexport async function migrateDidCkb(props: {\n signer: ccc.Signer;\n sourceDid: string;\n data?: DidCkbDataLike | null;\n receiver?: ccc.ScriptLike | null;\n tx?: ccc.TransactionLike | null;\n}): Promise<{\n tx: ccc.Transaction;\n id: ccc.Hex;\n index: number;\n}> {\n if (!props.sourceDid.startsWith(\"did:plc:\")) {\n throw new Error(`sourceDid must be did:plc:..., got \"${props.sourceDid}\"`);\n }\n\n const data = DidCkbData.from(\n props.data ?? {\n value: { document: {} },\n },\n );\n data.value.localId = props.sourceDid;\n return createDidCkb({\n signer: props.signer,\n data,\n receiver: props.receiver,\n tx: props.tx,\n });\n}\n","export * from \"./codec.js\";\nexport * from \"./didCkb.js\";\nexport * from \"./history.js\";\nexport * from \"./identifier.js\";\nexport * from \"./migrate.js\";\nexport * as plc from \"./plc/index.js\";\nexport * from \"./resolver.js\";\n"],"mappings":"0lBAwBO,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