a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
101
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(cbor): throw on improper CID

Mary 04fca437 ad2821fc

+8 -4
+5
.changeset/tough-hounds-dream.md
··· 1 + --- 2 + '@atcute/cbor': patch 3 + --- 4 + 5 + throw on improper CID
+3 -4
packages/utilities/cbor/lib/decode.ts
··· 1 - import { CidLinkWrapper, type CidLink } from '@atcute/cid'; 1 + import { CidLinkWrapper, fromBinary, type CidLink } from '@atcute/cid'; 2 2 import { decodeUtf8From } from '@atcute/uint8array'; 3 3 4 4 import { toBytes, type Bytes } from './bytes.js'; ··· 115 115 }; 116 116 117 117 const readCid = (state: State, length: number): CidLink => { 118 - // CID bytes are prefixed with 0x00 for historical reasons, apparently. 119 - const slice = state.b.subarray(state.p + 1, (state.p += length)); 118 + const cid = fromBinary(state.b.subarray(state.p, (state.p += length))); 120 119 121 - return new CidLinkWrapper(slice); 120 + return new CidLinkWrapper(cid.bytes); 122 121 }; 123 122 124 123 const decodeStringKey = (state: State): string => {