@metamask/ocap-kernel
Version:
OCap kernel core components
32 lines • 1.26 kB
text/typescript
type KernelSlotType = 'object' | 'promise';
/**
* Parse a kernel slot reference string into a kernel slot object.
*
* @param slot The string to be parsed, as described above.
* @returns kernel slot object corresponding to the parameter.
* @throws if the given string is syntactically incorrect.
*/
export declare function parseKernelSlot(slot: string): {
type: KernelSlotType;
id: string;
};
/**
* Generate a kernel slot reference string given a type and id.
*
* @param type - The kernel slot type desired, a string.
* @param id - The id, a number.
* @returns the corresponding kernel slot reference string.
* @throws if type is not one of the above known types.
*/
export declare function makeKernelSlot(type: KernelSlotType, id: string): string;
/**
* Assert function to ensure that a kernel slot reference string refers to a
* slot of a given type.
*
* @param type - The kernel slot type desired, a string.
* @param kernelSlot - The kernel slot reference string being tested
* @throws if kernelSlot is not of the given type or is malformed.
*/
export declare function insistKernelType(type: KernelSlotType, kernelSlot: string | undefined): asserts kernelSlot is KernelSlotType;
export {};
//# sourceMappingURL=kernel-slots.d.cts.map