@reallyme/codec 0.1.9

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.
@@ -0,0 +1,302 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Decode bytes using the base58btc alphabet without a multibase prefix.
6
+ */
7
+ export function base58btcDecode(encoded: string): Uint8Array;
8
+
9
+ /**
10
+ * Encode bytes using the base58btc alphabet without a multibase prefix.
11
+ */
12
+ export function base58btcEncode(bytes: Uint8Array): string;
13
+
14
+ /**
15
+ * Decode canonical padded RFC 4648 base64.
16
+ */
17
+ export function base64Decode(encoded: string): Uint8Array;
18
+
19
+ /**
20
+ * Encode bytes using canonical padded RFC 4648 base64.
21
+ */
22
+ export function base64Encode(bytes: Uint8Array): string;
23
+
24
+ /**
25
+ * Decode strict unpadded RFC 4648 URL-safe base64.
26
+ */
27
+ export function base64urlDecode(encoded: string): Uint8Array;
28
+
29
+ /**
30
+ * Encode bytes using unpadded RFC 4648 URL-safe base64.
31
+ */
32
+ export function base64urlEncode(bytes: Uint8Array): string;
33
+
34
+ /**
35
+ * Return whether a multikey binding type is compatible with a codec name.
36
+ */
37
+ export function bindingTypeMatchesCodec(binding_type: string, codec_name: string): boolean;
38
+
39
+ /**
40
+ * Encode bytes as canonical lowercase hexadecimal.
41
+ */
42
+ export function bytesToLowerHex(bytes: Uint8Array): string;
43
+
44
+ /**
45
+ * Canonicalize a JSON value using RFC 8785 JCS.
46
+ */
47
+ export function canonicalizeJson(value_json: string): string;
48
+
49
+ /**
50
+ * Return the DAG-CBOR multicodec code.
51
+ */
52
+ export function dagCborCodecCode(): number;
53
+
54
+ /**
55
+ * Compute a CIDv1 dag-cbor/sha2-256 string for already-canonical DAG-CBOR bytes.
56
+ */
57
+ export function dagCborComputeCid(bytes: Uint8Array): string;
58
+
59
+ /**
60
+ * Decode canonical DAG-CBOR bytes into the tagged JSON representation.
61
+ */
62
+ export function dagCborDecode(bytes: Uint8Array): string;
63
+
64
+ /**
65
+ * Encode a tagged JSON representation as canonical DAG-CBOR bytes.
66
+ */
67
+ export function dagCborEncode(value_json: string): Uint8Array;
68
+
69
+ /**
70
+ * Return the sha2-256 multihash envelope for canonical DAG-CBOR bytes.
71
+ */
72
+ export function dagCborMultihash(bytes: Uint8Array): Uint8Array;
73
+
74
+ /**
75
+ * Return the raw sha2-256 content hash for canonical DAG-CBOR bytes.
76
+ */
77
+ export function dagCborSha256ContentHash(bytes: Uint8Array): Uint8Array;
78
+
79
+ /**
80
+ * Recompute and compare a CIDv1 dag-cbor/sha2-256 string.
81
+ */
82
+ export function dagCborVerifyCid(cid: string, bytes: Uint8Array): any;
83
+
84
+ /**
85
+ * Recompute and compare a CID as a `CodecDagCborVerifyCidResult` protobuf message.
86
+ */
87
+ export function dagCborVerifyCidProto(cid: string, bytes: Uint8Array): Uint8Array;
88
+
89
+ /**
90
+ * Recompute and compare a CID protobuf message with an explicit result status.
91
+ */
92
+ export function dagCborVerifyCidProtoResult(cid: string, bytes: Uint8Array): any;
93
+
94
+ /**
95
+ * Return whether a string parses as a CID.
96
+ */
97
+ export function isValidCidString(cid: string): boolean;
98
+
99
+ /**
100
+ * Decode canonical lowercase hexadecimal.
101
+ */
102
+ export function lowerHexToBytes(encoded: string): Uint8Array;
103
+
104
+ /**
105
+ * Encode bytes with the multibase base58btc prefix.
106
+ */
107
+ export function multibaseBase58btcEncode(bytes: Uint8Array): string;
108
+
109
+ /**
110
+ * Encode bytes with the multibase base64url prefix.
111
+ */
112
+ export function multibaseBase64urlEncode(bytes: Uint8Array): string;
113
+
114
+ /**
115
+ * Decode a supported multibase string.
116
+ */
117
+ export function multibaseDecode(encoded: string): Uint8Array;
118
+
119
+ /**
120
+ * Resolve a byte slice that starts with a known multicodec prefix.
121
+ */
122
+ export function multicodecLookupPrefix(bytes: Uint8Array): any;
123
+
124
+ /**
125
+ * Resolve a prefix as a `CodecMulticodecLookupResult` protobuf message.
126
+ */
127
+ export function multicodecLookupPrefixProto(bytes: Uint8Array): Uint8Array;
128
+
129
+ /**
130
+ * Resolve a prefix protobuf message with an explicit result status.
131
+ */
132
+ export function multicodecLookupPrefixProtoResult(bytes: Uint8Array): any;
133
+
134
+ /**
135
+ * Return multicodec metadata for a canonical codec name.
136
+ */
137
+ export function multicodecPrefixForName(codec_name: string): any;
138
+
139
+ /**
140
+ * Return multicodec metadata as a `CodecMulticodecSpec` protobuf message.
141
+ */
142
+ export function multicodecPrefixForNameProto(codec_name: string): Uint8Array;
143
+
144
+ /**
145
+ * Return multicodec metadata protobuf bytes with an explicit result status.
146
+ */
147
+ export function multicodecPrefixForNameProtoResult(codec_name: string): any;
148
+
149
+ /**
150
+ * Strip a known multicodec prefix, or return the original bytes when none is found.
151
+ */
152
+ export function multicodecStripPrefix(bytes: Uint8Array): Uint8Array;
153
+
154
+ /**
155
+ * Return the supported multicodec table.
156
+ */
157
+ export function multicodecTable(): any;
158
+
159
+ /**
160
+ * Return the supported multicodec table as protobuf bytes.
161
+ */
162
+ export function multicodecTableProto(): Uint8Array;
163
+
164
+ /**
165
+ * Return the supported multicodec table protobuf bytes with an explicit result status.
166
+ */
167
+ export function multicodecTableProtoResult(): any;
168
+
169
+ /**
170
+ * Encode a public key as a multibase base58btc multikey.
171
+ */
172
+ export function multikeyEncode(codec_name: string, public_key: Uint8Array): string;
173
+
174
+ /**
175
+ * Parse and validate a multikey string.
176
+ */
177
+ export function multikeyParse(multikey: string): any;
178
+
179
+ /**
180
+ * Parse and validate a multikey as a `CodecMultikeyParseResult` protobuf message.
181
+ */
182
+ export function multikeyParseProto(multikey: string): Uint8Array;
183
+
184
+ /**
185
+ * Parse and validate a multikey protobuf message with an explicit result status.
186
+ */
187
+ export function multikeyParseProtoResult(multikey: string): any;
188
+
189
+ /**
190
+ * Decode PEM text armor with caller-supplied size and label policy.
191
+ */
192
+ export function pemDecode(input: string, options_json: string): any;
193
+
194
+ /**
195
+ * Decode PEM text armor as a `CodecPemDecodeResult` protobuf message.
196
+ */
197
+ export function pemDecodeProto(input: string, options_json: string): Uint8Array;
198
+
199
+ /**
200
+ * Decode PEM text armor protobuf bytes with an explicit result status.
201
+ */
202
+ export function pemDecodeProtoResult(input: string, options_json: string): any;
203
+
204
+ /**
205
+ * Encode DER bytes as PEM text armor.
206
+ */
207
+ export function pemEncode(label: string, der: Uint8Array, options_json: string): string;
208
+
209
+ /**
210
+ * Fail closed when a codec name is not in the supported table.
211
+ */
212
+ export function requireSupportedMulticodec(codec_name: string): void;
213
+
214
+ /**
215
+ * Return the canonical CID string, or `undefined` when parsing fails.
216
+ */
217
+ export function tryParseCid(cid: string): any;
218
+
219
+ /**
220
+ * Validate a binding type and optional algorithm against a parsed multikey.
221
+ */
222
+ export function validateKeyBinding(binding_type: string, algorithm: string | null | undefined, multikey: string): void;
223
+
224
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
225
+
226
+ export interface InitOutput {
227
+ readonly memory: WebAssembly.Memory;
228
+ readonly base58btcDecode: (a: number, b: number) => [number, number, number];
229
+ readonly base58btcEncode: (a: any) => [number, number, number, number];
230
+ readonly base64Decode: (a: number, b: number) => [number, number, number];
231
+ readonly base64Encode: (a: any) => [number, number];
232
+ readonly base64urlDecode: (a: number, b: number) => [number, number, number];
233
+ readonly base64urlEncode: (a: any) => [number, number];
234
+ readonly bindingTypeMatchesCodec: (a: number, b: number, c: number, d: number) => number;
235
+ readonly bytesToLowerHex: (a: any) => [number, number];
236
+ readonly canonicalizeJson: (a: number, b: number) => [number, number, number, number];
237
+ readonly dagCborCodecCode: () => number;
238
+ readonly dagCborComputeCid: (a: any) => [number, number, number, number];
239
+ readonly dagCborDecode: (a: any) => [number, number, number, number];
240
+ readonly dagCborEncode: (a: number, b: number) => [number, number, number];
241
+ readonly dagCborMultihash: (a: any) => [number, number, number];
242
+ readonly dagCborSha256ContentHash: (a: any) => [number, number, number];
243
+ readonly dagCborVerifyCid: (a: number, b: number, c: any) => [number, number, number];
244
+ readonly dagCborVerifyCidProto: (a: number, b: number, c: any) => [number, number, number];
245
+ readonly dagCborVerifyCidProtoResult: (a: number, b: number, c: any) => [number, number, number];
246
+ readonly isValidCidString: (a: number, b: number) => number;
247
+ readonly lowerHexToBytes: (a: number, b: number) => [number, number, number];
248
+ readonly multibaseBase58btcEncode: (a: any) => [number, number, number, number];
249
+ readonly multibaseBase64urlEncode: (a: any) => [number, number];
250
+ readonly multibaseDecode: (a: number, b: number) => [number, number, number];
251
+ readonly multicodecLookupPrefix: (a: any) => [number, number, number];
252
+ readonly multicodecLookupPrefixProto: (a: any) => [number, number, number];
253
+ readonly multicodecLookupPrefixProtoResult: (a: any) => [number, number, number];
254
+ readonly multicodecPrefixForName: (a: number, b: number) => [number, number, number];
255
+ readonly multicodecPrefixForNameProto: (a: number, b: number) => [number, number, number];
256
+ readonly multicodecPrefixForNameProtoResult: (a: number, b: number) => [number, number, number];
257
+ readonly multicodecStripPrefix: (a: any) => any;
258
+ readonly multicodecTable: () => [number, number, number];
259
+ readonly multicodecTableProto: () => [number, number, number];
260
+ readonly multicodecTableProtoResult: () => [number, number, number];
261
+ readonly multikeyEncode: (a: number, b: number, c: any) => [number, number, number, number];
262
+ readonly multikeyParse: (a: number, b: number) => [number, number, number];
263
+ readonly multikeyParseProto: (a: number, b: number) => [number, number, number];
264
+ readonly multikeyParseProtoResult: (a: number, b: number) => [number, number, number];
265
+ readonly pemDecode: (a: number, b: number, c: number, d: number) => [number, number, number];
266
+ readonly pemDecodeProto: (a: number, b: number, c: number, d: number) => [number, number, number];
267
+ readonly pemDecodeProtoResult: (a: number, b: number, c: number, d: number) => [number, number, number];
268
+ readonly pemEncode: (a: number, b: number, c: any, d: number, e: number) => [number, number, number, number];
269
+ readonly requireSupportedMulticodec: (a: number, b: number) => [number, number];
270
+ readonly tryParseCid: (a: number, b: number) => any;
271
+ readonly validateKeyBinding: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
272
+ readonly __wbindgen_exn_store: (a: number) => void;
273
+ readonly __externref_table_alloc: () => number;
274
+ readonly __wbindgen_externrefs: WebAssembly.Table;
275
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
276
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
277
+ readonly __externref_table_dealloc: (a: number) => void;
278
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
279
+ readonly __wbindgen_start: () => void;
280
+ }
281
+
282
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
283
+
284
+ /**
285
+ * Instantiates the given `module`, which can either be bytes or
286
+ * a precompiled `WebAssembly.Module`.
287
+ *
288
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
289
+ *
290
+ * @returns {InitOutput}
291
+ */
292
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
293
+
294
+ /**
295
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
296
+ * for everything else, calls `WebAssembly.instantiate` directly.
297
+ *
298
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
299
+ *
300
+ * @returns {Promise<InitOutput>}
301
+ */
302
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;