@dfinity/agent
Version:
JavaScript and TypeScript library to interact with the Internet Computer
26 lines • 939 B
TypeScript
import * as cbor from '@dfinity/cbor';
/**
* Used to extend classes that need to provide a custom value for the CBOR encoding process.
*/
export declare abstract class ToCborValue {
/**
* Returns a value that can be encoded with CBOR. Typically called in the replacer function of the {@link encode} function.
*/
abstract toCborValue(): cbor.CborValue;
}
/**
* Encode a JavaScript value into CBOR. If the value is an instance of {@link ToCborValue},
* the {@link ToCborValue.toCborValue} method will be called to get the value to encode.
* @param value The value to encode
*/
export declare function encode(value: unknown): Uint8Array;
/**
* Decode a CBOR encoded value into a JavaScript value.
* @param input The CBOR encoded value
*/
export declare function decode<T>(input: Uint8Array): T;
export declare const Cbor: {
encode: typeof encode;
decode: typeof decode;
};
//# sourceMappingURL=cbor.d.ts.map