@atcute/car
Version:
lightweight DASL CAR and atproto repository decoder for AT Protocol.
48 lines (47 loc) • 1.74 kB
TypeScript
import * as CBOR from '@atcute/cbor';
import * as CID from '@atcute/cid';
/** commit object */
export interface Commit {
version: 3;
did: string;
data: CID.CidLink;
rev: string;
prev: CID.CidLink | null;
sig: CBOR.Bytes;
}
/**
* checks if a value is a valid commit object
* @param value the value to check
* @returns true if the value is a valid commit object, false otherwise
*/
export declare const isCommit: (value: unknown) => value is Commit;
/** mst tree entry object */
export interface TreeEntry {
/** count of bytes shared with previous TreeEntry in this Node (if any) */
p: number;
/** remainder of key for this TreeEntry, after "prefixlen" have been removed */
k: CBOR.Bytes;
/** link to a sub-tree Node at a lower level which has keys sorting after this TreeEntry's key (to the "right"), but before the next TreeEntry's key in this Node (if any) */
v: CID.CidLink;
/** next subtree (to the right of leaf) */
t: CID.CidLink | null;
}
/**
* checks if a value is a valid mst tree entry object
* @param value the value to check
* @returns true if the value is a valid mst tree entry object, false otherwise
*/
export declare const isTreeEntry: (value: unknown) => value is TreeEntry;
/** mst node object */
export interface MstNode {
/** link to sub-tree Node on a lower level and with all keys sorting before keys at this node */
l: CID.CidLink | null;
/** ordered list of TreeEntry objects */
e: TreeEntry[];
}
/**
* checks if a value is a valid mst node object
* @param value the value to check
* @returns true if the value is a valid mst node object, false otherwise
*/
export declare const isMstNode: (value: unknown) => value is MstNode;