@atproto/lex-cbor 0.0.0 → 0.0.2

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 ADDED
@@ -0,0 +1,21 @@
1
+ # @atproto/lex-cbor
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4390](https://github.com/bluesky-social/atproto/pull/4390) [`1d445af`](https://github.com/bluesky-social/atproto/commit/1d445af2a7fc27eca5a45869b29266e6a2a7f3ba) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Replace use of `CID` with `Cid`
8
+
9
+ - [#4397](https://github.com/bluesky-social/atproto/pull/4397) [`688f9d6`](https://github.com/bluesky-social/atproto/commit/688f9d67597ba96d6e9c4a4aec4d394d42f4cbf4) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add `CHANGELOG.md` to npm package
10
+
11
+ - Updated dependencies [[`1d445af`](https://github.com/bluesky-social/atproto/commit/1d445af2a7fc27eca5a45869b29266e6a2a7f3ba), [`1d445af`](https://github.com/bluesky-social/atproto/commit/1d445af2a7fc27eca5a45869b29266e6a2a7f3ba), [`688f9d6`](https://github.com/bluesky-social/atproto/commit/688f9d67597ba96d6e9c4a4aec4d394d42f4cbf4)]:
12
+ - @atproto/lex-data@0.0.2
13
+
14
+ ## 0.0.1
15
+
16
+ ### Patch Changes
17
+
18
+ - [#4371](https://github.com/bluesky-social/atproto/pull/4371) [`46550d6`](https://github.com/bluesky-social/atproto/commit/46550d6c1ffb298f57d54eb1904067b2df5a40af) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Release
19
+
20
+ - Updated dependencies [[`46550d6`](https://github.com/bluesky-social/atproto/commit/46550d6c1ffb298f57d54eb1904067b2df5a40af)]:
21
+ - @atproto/lex-data@0.0.1
package/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Dual MIT/Apache-2.0 License
2
+
3
+ Copyright (c) 2022-2025 Bluesky Social PBC, and Contributors
4
+
5
+ Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
6
+
7
+ Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
@@ -1 +1 @@
1
- {"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAO,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAyEjD,wBAAgB,MAAM,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAE/D;AAED,wBAAgB,MAAM,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAEhE;AAED,wBAAiB,SAAS,CAAC,CAAC,GAAG,QAAQ,EACrC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAChB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAM7B"}
1
+ {"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAO,QAAQ,EAAoB,MAAM,mBAAmB,CAAA;AAyEnE,wBAAgB,MAAM,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAE/D;AAED,wBAAgB,MAAM,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAEhE;AAED,wBAAiB,SAAS,CAAC,CAAC,GAAG,QAAQ,EACrC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAChB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAM7B"}
package/dist/index.cjs.js CHANGED
@@ -1577,7 +1577,7 @@ function decode$1(data, options) {
1577
1577
  }
1578
1578
  const CID_CBOR_TAG = 42;
1579
1579
  function cidEncoder(obj) {
1580
- const cid = lexData.CID.asCID(obj);
1580
+ const cid = lexData.asCid(obj);
1581
1581
  if (!cid) return null;
1582
1582
  const bytes = new Uint8Array(cid.bytes.byteLength + 1);
1583
1583
  bytes.set(cid.bytes, 1);
@@ -1612,7 +1612,7 @@ function cidDecoder(bytes) {
1612
1612
  if (bytes[0] !== 0) {
1613
1613
  throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");
1614
1614
  }
1615
- return lexData.CID.decode(bytes.subarray(1));
1615
+ return lexData.decodeCid(bytes.subarray(1));
1616
1616
  }
1617
1617
  const tagDecoders = [];
1618
1618
  tagDecoders[CID_CBOR_TAG] = cidDecoder;
@@ -1645,11 +1645,11 @@ async function cidForLex(value) {
1645
1645
  }
1646
1646
  async function cidForCbor(bytes) {
1647
1647
  const digest2 = await sha2.sha256.digest(bytes);
1648
- return lexData.CID.createV1(lexData.DAG_CBOR_MULTICODEC, digest2);
1648
+ return lexData.createCid(lexData.DAG_CBOR_MULTICODEC, digest2);
1649
1649
  }
1650
1650
  async function verifyCidForBytes(cid, bytes) {
1651
1651
  const digest2 = await sha2.sha256.digest(bytes);
1652
- const expected = lexData.CID.createV1(cid.code, digest2);
1652
+ const expected = lexData.createCid(cid.code, digest2);
1653
1653
  if (!cid.equals(expected)) {
1654
1654
  throw new Error(
1655
1655
  `Not a valid CID for bytes. Expected: ${expected.toString()} Got: ${cid.toString()}`
@@ -1658,11 +1658,11 @@ async function verifyCidForBytes(cid, bytes) {
1658
1658
  }
1659
1659
  async function cidForRawBytes(bytes) {
1660
1660
  const digest2 = await sha2.sha256.digest(bytes);
1661
- return lexData.CID.createV1(lexData.RAW_BIN_MULTICODEC, digest2);
1661
+ return lexData.createCid(lexData.RAW_BIN_MULTICODEC, digest2);
1662
1662
  }
1663
1663
  function cidForRawHash(hash) {
1664
1664
  const digest$1 = digest.create(sha2.sha256.code, hash);
1665
- return lexData.CID.createV1(lexData.RAW_BIN_MULTICODEC, digest$1);
1665
+ return lexData.createCid(lexData.RAW_BIN_MULTICODEC, digest$1);
1666
1666
  }
1667
1667
  function parseCidFromBytes(cidBytes) {
1668
1668
  const version = cidBytes[0];
@@ -1686,16 +1686,12 @@ function parseCidFromBytes(cidBytes) {
1686
1686
  }
1687
1687
  const hashBytes = cidBytes.slice(4);
1688
1688
  const digest$1 = digest.create(hashType, hashBytes);
1689
- return lexData.CID.create(version, code, digest$1);
1689
+ return lexData.createCid(code, digest$1);
1690
1690
  }
1691
1691
  Object.defineProperty(exports, "hasher", {
1692
1692
  enumerable: true,
1693
1693
  get: () => sha2.sha256
1694
1694
  });
1695
- Object.defineProperty(exports, "CID", {
1696
- enumerable: true,
1697
- get: () => lexData.CID
1698
- });
1699
1695
  exports.cidForCbor = cidForCbor;
1700
1696
  exports.cidForLex = cidForLex;
1701
1697
  exports.cidForRawBytes = cidForRawBytes;
package/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  import { sha256 as hasher } from 'multiformats/hashes/sha2';
2
- import { CID, LexValue } from '@atproto/lex-data';
3
- export { CID, hasher };
2
+ import { Cid, LexValue } from '@atproto/lex-data';
3
+ export { hasher };
4
4
  export { decode, decodeAll, encode } from './encoding.js';
5
- export type { LexValue };
6
- export declare function cidForLex(value: LexValue): Promise<CID>;
7
- export declare function cidForCbor(bytes: Uint8Array): Promise<CID>;
8
- export declare function verifyCidForBytes(cid: CID, bytes: Uint8Array): Promise<void>;
9
- export declare function cidForRawBytes(bytes: Uint8Array): Promise<CID>;
10
- export declare function cidForRawHash(hash: Uint8Array): CID;
5
+ export type { Cid, LexValue };
6
+ export declare function cidForLex(value: LexValue): Promise<Cid>;
7
+ export declare function cidForCbor(bytes: Uint8Array): Promise<Cid>;
8
+ export declare function verifyCidForBytes(cid: Cid, bytes: Uint8Array): Promise<void>;
9
+ export declare function cidForRawBytes(bytes: Uint8Array): Promise<Cid>;
10
+ export declare function cidForRawHash(hash: Uint8Array): Cid;
11
11
  /**
12
12
  * @note Only supports DASL CIDs
13
13
  * @see {@link https://dasl.ing/cid.html}
14
- * @throws if the input do not represent a valid DASL {@link CID}
14
+ * @throws if the input do not represent a valid DASL {@link Cid}
15
15
  */
16
- export declare function parseCidFromBytes(cidBytes: Uint8Array): CID;
16
+ export declare function parseCidFromBytes(cidBytes: Uint8Array): Cid;
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EACL,GAAG,EAEH,QAAQ,EAGT,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA;AACtB,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACzD,YAAY,EAAE,QAAQ,EAAE,CAAA;AAExB,wBAAsB,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAE7D;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAGhE;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,iBAQlE;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAGpE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,GAAG,CAGnD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,UAAU,GAAG,GAAG,CAuB3D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EACL,GAAG,EAEH,QAAQ,EAIT,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACzD,YAAY,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAA;AAE7B,wBAAsB,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAE7D;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAGhE;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,iBAQlE;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAGpE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,GAAG,CAGnD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,UAAU,GAAG,GAAG,CAuB3D"}
package/dist/index.es.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { create } from "multiformats/hashes/digest";
2
2
  import { sha256 } from "multiformats/hashes/sha2";
3
3
  import { sha256 as sha2562 } from "multiformats/hashes/sha2";
4
- import { CID, DAG_CBOR_MULTICODEC, RAW_BIN_MULTICODEC, SHA2_256_MULTIHASH_CODE } from "@atproto/lex-data";
5
- import { CID as CID2 } from "@atproto/lex-data";
4
+ import { decodeCid, asCid, createCid, DAG_CBOR_MULTICODEC, RAW_BIN_MULTICODEC, SHA2_256_MULTIHASH_CODE } from "@atproto/lex-data";
6
5
  const typeofs = [
7
6
  "string",
8
7
  "number",
@@ -1577,7 +1576,7 @@ function decode$1(data, options) {
1577
1576
  }
1578
1577
  const CID_CBOR_TAG = 42;
1579
1578
  function cidEncoder(obj) {
1580
- const cid = CID.asCID(obj);
1579
+ const cid = asCid(obj);
1581
1580
  if (!cid) return null;
1582
1581
  const bytes = new Uint8Array(cid.bytes.byteLength + 1);
1583
1582
  bytes.set(cid.bytes, 1);
@@ -1612,7 +1611,7 @@ function cidDecoder(bytes) {
1612
1611
  if (bytes[0] !== 0) {
1613
1612
  throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");
1614
1613
  }
1615
- return CID.decode(bytes.subarray(1));
1614
+ return decodeCid(bytes.subarray(1));
1616
1615
  }
1617
1616
  const tagDecoders = [];
1618
1617
  tagDecoders[CID_CBOR_TAG] = cidDecoder;
@@ -1645,11 +1644,11 @@ async function cidForLex(value) {
1645
1644
  }
1646
1645
  async function cidForCbor(bytes) {
1647
1646
  const digest = await sha256.digest(bytes);
1648
- return CID.createV1(DAG_CBOR_MULTICODEC, digest);
1647
+ return createCid(DAG_CBOR_MULTICODEC, digest);
1649
1648
  }
1650
1649
  async function verifyCidForBytes(cid, bytes) {
1651
1650
  const digest = await sha256.digest(bytes);
1652
- const expected = CID.createV1(cid.code, digest);
1651
+ const expected = createCid(cid.code, digest);
1653
1652
  if (!cid.equals(expected)) {
1654
1653
  throw new Error(
1655
1654
  `Not a valid CID for bytes. Expected: ${expected.toString()} Got: ${cid.toString()}`
@@ -1658,11 +1657,11 @@ async function verifyCidForBytes(cid, bytes) {
1658
1657
  }
1659
1658
  async function cidForRawBytes(bytes) {
1660
1659
  const digest = await sha256.digest(bytes);
1661
- return CID.createV1(RAW_BIN_MULTICODEC, digest);
1660
+ return createCid(RAW_BIN_MULTICODEC, digest);
1662
1661
  }
1663
1662
  function cidForRawHash(hash) {
1664
1663
  const digest = create(sha256.code, hash);
1665
- return CID.createV1(RAW_BIN_MULTICODEC, digest);
1664
+ return createCid(RAW_BIN_MULTICODEC, digest);
1666
1665
  }
1667
1666
  function parseCidFromBytes(cidBytes) {
1668
1667
  const version = cidBytes[0];
@@ -1686,10 +1685,9 @@ function parseCidFromBytes(cidBytes) {
1686
1685
  }
1687
1686
  const hashBytes = cidBytes.slice(4);
1688
1687
  const digest = create(hashType, hashBytes);
1689
- return CID.create(version, code, digest);
1688
+ return createCid(code, digest);
1690
1689
  }
1691
1690
  export {
1692
- CID2 as CID,
1693
1691
  cidForCbor,
1694
1692
  cidForLex,
1695
1693
  cidForRawBytes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/lex-cbor",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "license": "MIT",
5
5
  "description": "Lexicon encoding utilities for AT Lexicon data in CBOR format",
6
6
  "keywords": [
@@ -19,7 +19,11 @@
19
19
  },
20
20
  "files": [
21
21
  "./src",
22
- "./dist"
22
+ "./tsconfig.build.json",
23
+ "./tsconfig.tests.json",
24
+ "./tsconfig.json",
25
+ "./dist",
26
+ "./CHANGELOG.md"
23
27
  ],
24
28
  "sideEffects": false,
25
29
  "main": "./dist/index.cjs.js",
@@ -33,15 +37,15 @@
33
37
  }
34
38
  },
35
39
  "dependencies": {
36
- "@atproto/lex-data": "workspace:*",
37
40
  "multiformats": "^9.9.0",
38
- "tslib": "^2.8.1"
41
+ "tslib": "^2.8.1",
42
+ "@atproto/lex-data": "0.0.2"
39
43
  },
40
44
  "devDependencies": {
41
- "@atproto/lex-json": "workspace:*",
42
45
  "cborg": "^4.3.0",
43
46
  "jest": "^28.1.2",
44
- "vite": "^6.2.0"
47
+ "vite": "^6.2.0",
48
+ "@atproto/lex-json": "0.0.2"
45
49
  },
46
50
  "scripts": {
47
51
  "dev": "vite build --watch",
@@ -49,4 +53,4 @@
49
53
  "build": "tsc --build tsconfig.build.json",
50
54
  "test": "jest"
51
55
  }
52
- }
56
+ }
package/src/encoding.ts CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  encode as cborgEncode,
10
10
  } from 'cborg'
11
11
  import type { ByteView } from 'multiformats/block'
12
- import { CID, LexValue } from '@atproto/lex-data'
12
+ import { Cid, LexValue, asCid, decodeCid } from '@atproto/lex-data'
13
13
 
14
14
  // @NOTE This was inspired by @ipld/dag-cbor implementation, but adapted to
15
15
  // match the AT Data Model constraints. Floats, in particular, are not allowed.
@@ -22,7 +22,7 @@ import { CID, LexValue } from '@atproto/lex-data'
22
22
  const CID_CBOR_TAG = 42
23
23
 
24
24
  function cidEncoder(obj: object): Token[] | null {
25
- const cid = CID.asCID(obj)
25
+ const cid = asCid(obj)
26
26
  if (!cid) return null
27
27
 
28
28
  const bytes = new Uint8Array(cid.bytes.byteLength + 1)
@@ -61,11 +61,11 @@ const encodeOptions: EncodeOptions = {
61
61
  },
62
62
  }
63
63
 
64
- function cidDecoder(bytes: Uint8Array): CID {
64
+ function cidDecoder(bytes: Uint8Array): Cid {
65
65
  if (bytes[0] !== 0) {
66
66
  throw new Error('Invalid CID for CBOR tag 42; expected leading 0x00')
67
67
  }
68
- return CID.decode(bytes.subarray(1)) // ignore leading 0x00
68
+ return decodeCid(bytes.subarray(1)) // ignore leading 0x00
69
69
  }
70
70
 
71
71
  const tagDecoders: TagDecoder[] = []
package/src/index.ts CHANGED
@@ -1,30 +1,31 @@
1
1
  import { create as createDigest } from 'multiformats/hashes/digest'
2
2
  import { sha256 as hasher } from 'multiformats/hashes/sha2'
3
3
  import {
4
- CID,
4
+ Cid,
5
5
  DAG_CBOR_MULTICODEC,
6
6
  LexValue,
7
7
  RAW_BIN_MULTICODEC,
8
8
  SHA2_256_MULTIHASH_CODE,
9
+ createCid,
9
10
  } from '@atproto/lex-data'
10
11
  import { encode } from './encoding.js'
11
12
 
12
- export { CID, hasher }
13
+ export { hasher }
13
14
  export { decode, decodeAll, encode } from './encoding.js'
14
- export type { LexValue }
15
+ export type { Cid, LexValue }
15
16
 
16
- export async function cidForLex(value: LexValue): Promise<CID> {
17
+ export async function cidForLex(value: LexValue): Promise<Cid> {
17
18
  return cidForCbor(encode(value))
18
19
  }
19
20
 
20
- export async function cidForCbor(bytes: Uint8Array): Promise<CID> {
21
+ export async function cidForCbor(bytes: Uint8Array): Promise<Cid> {
21
22
  const digest = await hasher.digest(bytes)
22
- return CID.createV1(DAG_CBOR_MULTICODEC, digest)
23
+ return createCid(DAG_CBOR_MULTICODEC, digest)
23
24
  }
24
25
 
25
- export async function verifyCidForBytes(cid: CID, bytes: Uint8Array) {
26
+ export async function verifyCidForBytes(cid: Cid, bytes: Uint8Array) {
26
27
  const digest = await hasher.digest(bytes)
27
- const expected = CID.createV1(cid.code, digest)
28
+ const expected = createCid(cid.code, digest)
28
29
  if (!cid.equals(expected)) {
29
30
  throw new Error(
30
31
  `Not a valid CID for bytes. Expected: ${expected.toString()} Got: ${cid.toString()}`,
@@ -32,22 +33,22 @@ export async function verifyCidForBytes(cid: CID, bytes: Uint8Array) {
32
33
  }
33
34
  }
34
35
 
35
- export async function cidForRawBytes(bytes: Uint8Array): Promise<CID> {
36
+ export async function cidForRawBytes(bytes: Uint8Array): Promise<Cid> {
36
37
  const digest = await hasher.digest(bytes)
37
- return CID.createV1(RAW_BIN_MULTICODEC, digest)
38
+ return createCid(RAW_BIN_MULTICODEC, digest)
38
39
  }
39
40
 
40
- export function cidForRawHash(hash: Uint8Array): CID {
41
+ export function cidForRawHash(hash: Uint8Array): Cid {
41
42
  const digest = createDigest(hasher.code, hash)
42
- return CID.createV1(RAW_BIN_MULTICODEC, digest)
43
+ return createCid(RAW_BIN_MULTICODEC, digest)
43
44
  }
44
45
 
45
46
  /**
46
47
  * @note Only supports DASL CIDs
47
48
  * @see {@link https://dasl.ing/cid.html}
48
- * @throws if the input do not represent a valid DASL {@link CID}
49
+ * @throws if the input do not represent a valid DASL {@link Cid}
49
50
  */
50
- export function parseCidFromBytes(cidBytes: Uint8Array): CID {
51
+ export function parseCidFromBytes(cidBytes: Uint8Array): Cid {
51
52
  const version = cidBytes[0]
52
53
  if (version !== 0x01) {
53
54
  throw new Error(`Unsupported CID version: ${version}`)
@@ -69,5 +70,5 @@ export function parseCidFromBytes(cidBytes: Uint8Array): CID {
69
70
  }
70
71
  const hashBytes = cidBytes.slice(4)
71
72
  const digest = createDigest(hashType, hashBytes)
72
- return CID.create(version, code, digest)
73
+ return createCid(code, digest)
73
74
  }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": ["../../../tsconfig/isomorphic.json"],
3
+ "include": ["./src"],
4
+ "exclude": ["**/*.test.ts"],
5
+ "compilerOptions": {
6
+ "noImplicitAny": true,
7
+ "importHelpers": true,
8
+ "emitDeclarationOnly": true,
9
+ "rootDir": "./src",
10
+ "outDir": "./dist"
11
+ }
12
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "include": [],
3
+ "references": [
4
+ { "path": "./tsconfig.build.json" },
5
+ { "path": "./tsconfig.tests.json" }
6
+ ]
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../../tsconfig/tests.json",
3
+ "include": ["./tests", "./src/**.test.ts"],
4
+ "compilerOptions": {
5
+ "noImplicitAny": true,
6
+ "rootDir": "./",
7
+ "baseUrl": "./"
8
+ }
9
+ }