@reallyme/codec 0.2.2 → 0.3.0

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.
package/dist/wasm/LICENSE CHANGED
@@ -1,17 +1,231 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- https://www.apache.org/licenses/
1
+ ReallyMe Codec
2
+
3
+ This software is dual-licensed under the MIT License or the Apache License,
4
+ Version 2.0, at your option. The complete terms of both licenses follow.
5
+
6
+ Separately identified dependencies and vendored tools retain their own
7
+ copyright notices and license terms.
8
+
9
+ MIT License
4
10
 
5
11
  Copyright 2026 ReallyMe LLC
6
12
 
7
- Licensed under the Apache License, Version 2.0 (the "License");
8
- you may not use this file except in compliance with the License.
9
- You may obtain a copy of the License at
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+
31
+ Apache License
32
+ Version 2.0, January 2004
33
+ http://www.apache.org/licenses/
34
+
35
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
36
+
37
+ 1. Definitions.
38
+
39
+ "License" shall mean the terms and conditions for use, reproduction,
40
+ and distribution as defined by Sections 1 through 9 of this document.
41
+
42
+ "Licensor" shall mean the copyright owner or entity authorized by
43
+ the copyright owner that is granting the License.
44
+
45
+ "Legal Entity" shall mean the union of the acting entity and all
46
+ other entities that control, are controlled by, or are under common
47
+ control with that entity. For the purposes of this definition,
48
+ "control" means (i) the power, direct or indirect, to cause the
49
+ direction or management of such entity, whether by contract or
50
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
51
+ outstanding shares, or (iii) beneficial ownership of such entity.
52
+
53
+ "You" (or "Your") shall mean an individual or Legal Entity
54
+ exercising permissions granted by this License.
55
+
56
+ "Source" form shall mean the preferred form for making modifications,
57
+ including but not limited to software source code, documentation
58
+ source, and configuration files.
59
+
60
+ "Object" form shall mean any form resulting from mechanical
61
+ transformation or translation of a Source form, including but
62
+ not limited to compiled object code, generated documentation,
63
+ and conversions to other media types.
64
+
65
+ "Work" shall mean the work of authorship, whether in Source or
66
+ Object form, made available under the License, as indicated by a
67
+ copyright notice that is included in or attached to the work
68
+ (an example is provided in the Appendix below).
69
+
70
+ "Derivative Works" shall mean any work, whether in Source or Object
71
+ form, that is based on (or derived from) the Work and for which the
72
+ editorial revisions, annotations, elaborations, or other modifications
73
+ represent, as a whole, an original work of authorship. For the purposes
74
+ of this License, Derivative Works shall not include works that remain
75
+ separable from, or merely link (or bind by name) to the interfaces of,
76
+ the Work and Derivative Works thereof.
77
+
78
+ "Contribution" shall mean any work of authorship, including
79
+ the original version of the Work and any modifications or additions
80
+ to that Work or Derivative Works thereof, that is intentionally
81
+ submitted to Licensor for inclusion in the Work by the copyright owner
82
+ or by an individual or Legal Entity authorized to submit on behalf of
83
+ the copyright owner. For the purposes of this definition, "submitted"
84
+ means any form of electronic, verbal, or written communication sent
85
+ to the Licensor or its representatives, including but not limited to
86
+ communication on electronic mailing lists, source code control systems,
87
+ and issue tracking systems that are managed by, or on behalf of, the
88
+ Licensor for the purpose of discussing and improving the Work, but
89
+ excluding communication that is conspicuously marked or otherwise
90
+ designated in writing by the copyright owner as "Not a Contribution."
91
+
92
+ "Contributor" shall mean Licensor and any individual or Legal Entity
93
+ on behalf of whom a Contribution has been received by Licensor and
94
+ subsequently incorporated within the Work.
95
+
96
+ 2. Grant of Copyright License. Subject to the terms and conditions of
97
+ this License, each Contributor hereby grants to You a perpetual,
98
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
99
+ copyright license to reproduce, prepare Derivative Works of,
100
+ publicly display, publicly perform, sublicense, and distribute the
101
+ Work and such Derivative Works in Source or Object form.
102
+
103
+ 3. Grant of Patent License. Subject to the terms and conditions of
104
+ this License, each Contributor hereby grants to You a perpetual,
105
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
106
+ (except as stated in this section) patent license to make, have made,
107
+ use, offer to sell, sell, import, and otherwise transfer the Work,
108
+ where such license applies only to those patent claims licensable
109
+ by such Contributor that are necessarily infringed by their
110
+ Contribution(s) alone or by combination of their Contribution(s)
111
+ with the Work to which such Contribution(s) was submitted. If You
112
+ institute patent litigation against any entity (including a
113
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
114
+ or a Contribution incorporated within the Work constitutes direct
115
+ or contributory patent infringement, then any patent licenses
116
+ granted to You under this License for that Work shall terminate
117
+ as of the date such litigation is filed.
118
+
119
+ 4. Redistribution. You may reproduce and distribute copies of the
120
+ Work or Derivative Works thereof in any medium, with or without
121
+ modifications, and in Source or Object form, provided that You
122
+ meet the following conditions:
123
+
124
+ (a) You must give any other recipients of the Work or
125
+ Derivative Works a copy of this License; and
126
+
127
+ (b) You must cause any modified files to carry prominent notices
128
+ stating that You changed the files; and
129
+
130
+ (c) You must retain, in the Source form of any Derivative Works
131
+ that You distribute, all copyright, patent, trademark, and
132
+ attribution notices from the Source form of the Work,
133
+ excluding those notices that do not pertain to any part of
134
+ the Derivative Works; and
135
+
136
+ (d) If the Work includes a "NOTICE" text file as part of its
137
+ distribution, then any Derivative Works that You distribute must
138
+ include a readable copy of the attribution notices contained
139
+ within such NOTICE file, excluding those notices that do not
140
+ pertain to any part of the Derivative Works, in at least one
141
+ of the following places: within a NOTICE text file distributed
142
+ as part of the Derivative Works; within the Source form or
143
+ documentation, if provided along with the Derivative Works; or,
144
+ within a display generated by the Derivative Works, if and
145
+ wherever such third-party notices normally appear. The contents
146
+ of the NOTICE file are for informational purposes only and
147
+ do not modify the License. You may add Your own attribution
148
+ notices within Derivative Works that You distribute, alongside
149
+ or as an addendum to the NOTICE text from the Work, provided
150
+ that such additional attribution notices cannot be construed
151
+ as modifying the License.
152
+
153
+ You may add Your own copyright statement to Your modifications and
154
+ may provide additional or different license terms and conditions
155
+ for use, reproduction, or distribution of Your modifications, or
156
+ for any such Derivative Works as a whole, provided Your use,
157
+ reproduction, and distribution of the Work otherwise complies with
158
+ the conditions stated in this License.
159
+
160
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
161
+ any Contribution intentionally submitted for inclusion in the Work
162
+ by You to the Licensor shall be under the terms and conditions of
163
+ this License, without any additional terms or conditions.
164
+ Notwithstanding the above, nothing herein shall supersede or modify
165
+ the terms of any separate license agreement you may have executed
166
+ with Licensor regarding such Contributions.
167
+
168
+ 6. Trademarks. This License does not grant permission to use the trade
169
+ names, trademarks, service marks, or product names of the Licensor,
170
+ except as required for reasonable and customary use in describing the
171
+ origin of the Work and reproducing the content of the NOTICE file.
172
+
173
+ 7. Disclaimer of Warranty. Unless required by applicable law or
174
+ agreed to in writing, Licensor provides the Work (and each
175
+ Contributor provides its Contributions) on an "AS IS" BASIS,
176
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
177
+ implied, including, without limitation, any warranties or conditions
178
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
179
+ PARTICULAR PURPOSE. You are solely responsible for determining the
180
+ appropriateness of using or redistributing the Work and assume any
181
+ risks associated with Your exercise of permissions under this License.
182
+
183
+ 8. Limitation of Liability. In no event and under no legal theory,
184
+ whether in tort (including negligence), contract, or otherwise,
185
+ unless required by applicable law (such as deliberate and grossly
186
+ negligent acts) or agreed to in writing, shall any Contributor be
187
+ liable to You for damages, including any direct, indirect, special,
188
+ incidental, or consequential damages of any character arising as a
189
+ result of this License or out of the use or inability to use the
190
+ Work (including but not limited to damages for loss of goodwill,
191
+ work stoppage, computer failure or malfunction, or any and all
192
+ other commercial damages or losses), even if such Contributor
193
+ has been advised of the possibility of such damages.
194
+
195
+ 9. Accepting Warranty or Additional Liability. While redistributing
196
+ the Work or Derivative Works thereof, You may choose to offer,
197
+ and charge a fee for, acceptance of support, warranty, indemnity,
198
+ or other liability obligations and/or rights consistent with this
199
+ License. However, in accepting such obligations, You may act only
200
+ on Your own behalf and on Your sole responsibility, not on behalf
201
+ of any other Contributor, and only if You agree to indemnify,
202
+ defend, and hold each Contributor harmless for any liability
203
+ incurred by, or claims asserted against, such Contributor by reason
204
+ of your accepting any such warranty or additional liability.
205
+
206
+ END OF TERMS AND CONDITIONS
207
+
208
+ APPENDIX: How to apply the Apache License to your work.
209
+
210
+ To apply the Apache License to your work, attach the following
211
+ boilerplate notice, with the fields enclosed by brackets "[]"
212
+ replaced with your own identifying information. (Don't include
213
+ the brackets!) The text should be enclosed in the appropriate
214
+ comment syntax for the file format. We also recommend that a
215
+ file or class name and description of purpose be included on the
216
+ same "printed page" as the copyright notice for easier
217
+ identification within third-party archives.
218
+
219
+ Copyright [yyyy] [name of copyright owner]
220
+
221
+ Licensed under the Apache License, Version 2.0 (the "License");
222
+ you may not use this file except in compliance with the License.
223
+ You may obtain a copy of the License at
10
224
 
11
- https://www.apache.org/licenses/LICENSE-2.0
225
+ http://www.apache.org/licenses/LICENSE-2.0
12
226
 
13
- Unless required by applicable law or agreed to in writing, software
14
- distributed under the License is distributed on an "AS IS" BASIS,
15
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- See the License for the specific language governing permissions and
17
- limitations under the License.
227
+ Unless required by applicable law or agreed to in writing, software
228
+ distributed under the License is distributed on an "AS IS" BASIS,
229
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
230
+ See the License for the specific language governing permissions and
231
+ limitations under the License.
@@ -92,7 +92,7 @@ export function multibaseBase64urlEncode(bytes: Uint8Array): string;
92
92
  export function multibaseDecode(encoded: string): Uint8Array;
93
93
 
94
94
  /**
95
- * Strip a known multicodec prefix, or return the original bytes when none is found.
95
+ * Strip a known multicodec prefix, or return a typed error for an unknown prefix.
96
96
  */
97
97
  export function multicodecStripPrefix(bytes: Uint8Array): Uint8Array;
98
98
 
@@ -131,25 +131,25 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
131
131
  export interface InitOutput {
132
132
  readonly memory: WebAssembly.Memory;
133
133
  readonly base58btcDecode: (a: any) => [number, number, number];
134
- readonly base58btcEncode: (a: any) => [number, number, number, number];
134
+ readonly base58btcEncode: (a: any) => [number, number, number];
135
135
  readonly base64Decode: (a: any) => [number, number, number];
136
- readonly base64Encode: (a: any) => [number, number, number, number];
136
+ readonly base64Encode: (a: any) => [number, number, number];
137
137
  readonly base64urlDecode: (a: any) => [number, number, number];
138
- readonly base64urlEncode: (a: any) => [number, number, number, number];
138
+ readonly base64urlEncode: (a: any) => [number, number, number];
139
139
  readonly bindingTypeMatchesCodec: (a: any, b: any) => [number, number, number];
140
- readonly bytesToLowerHex: (a: any) => [number, number, number, number];
141
- readonly canonicalizeJson: (a: any) => [number, number, number, number];
140
+ readonly bytesToLowerHex: (a: any) => [number, number, number];
141
+ readonly canonicalizeJson: (a: any) => [number, number, number];
142
142
  readonly dagCborCodecCode: () => number;
143
- readonly dagCborComputeCid: (a: any) => [number, number, number, number];
143
+ readonly dagCborComputeCid: (a: any) => [number, number, number];
144
144
  readonly dagCborMultihash: (a: any) => [number, number, number];
145
145
  readonly dagCborSha256ContentHash: (a: any) => [number, number, number];
146
146
  readonly isValidCidString: (a: any) => [number, number, number];
147
147
  readonly lowerHexToBytes: (a: any) => [number, number, number];
148
- readonly multibaseBase58btcEncode: (a: any) => [number, number, number, number];
149
- readonly multibaseBase64urlEncode: (a: any) => [number, number, number, number];
148
+ readonly multibaseBase58btcEncode: (a: any) => [number, number, number];
149
+ readonly multibaseBase64urlEncode: (a: any) => [number, number, number];
150
150
  readonly multibaseDecode: (a: any) => [number, number, number];
151
151
  readonly multicodecStripPrefix: (a: any) => [number, number, number];
152
- readonly multikeyEncode: (a: any, b: any) => [number, number, number, number];
152
+ readonly multikeyEncode: (a: any, b: any) => [number, number, number];
153
153
  readonly processOperation: (a: any) => [number, number, number];
154
154
  readonly processOperationJson: (a: any) => [number, number, number];
155
155
  readonly requireSupportedMulticodec: (a: any) => [number, number];
@@ -157,10 +157,10 @@ export interface InitOutput {
157
157
  readonly validateKeyBinding: (a: any, b: number, c: any) => [number, number];
158
158
  readonly __wbindgen_malloc: (a: number, b: number) => number;
159
159
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
160
+ readonly __wbindgen_exn_store: (a: number) => void;
161
+ readonly __externref_table_alloc: () => number;
160
162
  readonly __wbindgen_externrefs: WebAssembly.Table;
161
163
  readonly __externref_table_dealloc: (a: number) => void;
162
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
163
- readonly __externref_table_alloc: () => number;
164
164
  readonly __wbindgen_start: () => void;
165
165
  }
166
166
 
@@ -19,22 +19,11 @@ export function base58btcDecode(encoded) {
19
19
  * @returns {string}
20
20
  */
21
21
  export function base58btcEncode(bytes) {
22
- let deferred2_0;
23
- let deferred2_1;
24
- try {
25
- const ret = wasm.base58btcEncode(bytes);
26
- var ptr1 = ret[0];
27
- var len1 = ret[1];
28
- if (ret[3]) {
29
- ptr1 = 0; len1 = 0;
30
- throw takeFromExternrefTable0(ret[2]);
31
- }
32
- deferred2_0 = ptr1;
33
- deferred2_1 = len1;
34
- return getStringFromWasm0(ptr1, len1);
35
- } finally {
36
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
22
+ const ret = wasm.base58btcEncode(bytes);
23
+ if (ret[2]) {
24
+ throw takeFromExternrefTable0(ret[1]);
37
25
  }
26
+ return takeFromExternrefTable0(ret[0]);
38
27
  }
39
28
 
40
29
  /**
@@ -56,22 +45,11 @@ export function base64Decode(encoded) {
56
45
  * @returns {string}
57
46
  */
58
47
  export function base64Encode(bytes) {
59
- let deferred2_0;
60
- let deferred2_1;
61
- try {
62
- const ret = wasm.base64Encode(bytes);
63
- var ptr1 = ret[0];
64
- var len1 = ret[1];
65
- if (ret[3]) {
66
- ptr1 = 0; len1 = 0;
67
- throw takeFromExternrefTable0(ret[2]);
68
- }
69
- deferred2_0 = ptr1;
70
- deferred2_1 = len1;
71
- return getStringFromWasm0(ptr1, len1);
72
- } finally {
73
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
48
+ const ret = wasm.base64Encode(bytes);
49
+ if (ret[2]) {
50
+ throw takeFromExternrefTable0(ret[1]);
74
51
  }
52
+ return takeFromExternrefTable0(ret[0]);
75
53
  }
76
54
 
77
55
  /**
@@ -93,22 +71,11 @@ export function base64urlDecode(encoded) {
93
71
  * @returns {string}
94
72
  */
95
73
  export function base64urlEncode(bytes) {
96
- let deferred2_0;
97
- let deferred2_1;
98
- try {
99
- const ret = wasm.base64urlEncode(bytes);
100
- var ptr1 = ret[0];
101
- var len1 = ret[1];
102
- if (ret[3]) {
103
- ptr1 = 0; len1 = 0;
104
- throw takeFromExternrefTable0(ret[2]);
105
- }
106
- deferred2_0 = ptr1;
107
- deferred2_1 = len1;
108
- return getStringFromWasm0(ptr1, len1);
109
- } finally {
110
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
74
+ const ret = wasm.base64urlEncode(bytes);
75
+ if (ret[2]) {
76
+ throw takeFromExternrefTable0(ret[1]);
111
77
  }
78
+ return takeFromExternrefTable0(ret[0]);
112
79
  }
113
80
 
114
81
  /**
@@ -131,22 +98,11 @@ export function bindingTypeMatchesCodec(binding_type, codec_name) {
131
98
  * @returns {string}
132
99
  */
133
100
  export function bytesToLowerHex(bytes) {
134
- let deferred2_0;
135
- let deferred2_1;
136
- try {
137
- const ret = wasm.bytesToLowerHex(bytes);
138
- var ptr1 = ret[0];
139
- var len1 = ret[1];
140
- if (ret[3]) {
141
- ptr1 = 0; len1 = 0;
142
- throw takeFromExternrefTable0(ret[2]);
143
- }
144
- deferred2_0 = ptr1;
145
- deferred2_1 = len1;
146
- return getStringFromWasm0(ptr1, len1);
147
- } finally {
148
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
101
+ const ret = wasm.bytesToLowerHex(bytes);
102
+ if (ret[2]) {
103
+ throw takeFromExternrefTable0(ret[1]);
149
104
  }
105
+ return takeFromExternrefTable0(ret[0]);
150
106
  }
151
107
 
152
108
  /**
@@ -155,22 +111,11 @@ export function bytesToLowerHex(bytes) {
155
111
  * @returns {string}
156
112
  */
157
113
  export function canonicalizeJson(value_json) {
158
- let deferred2_0;
159
- let deferred2_1;
160
- try {
161
- const ret = wasm.canonicalizeJson(value_json);
162
- var ptr1 = ret[0];
163
- var len1 = ret[1];
164
- if (ret[3]) {
165
- ptr1 = 0; len1 = 0;
166
- throw takeFromExternrefTable0(ret[2]);
167
- }
168
- deferred2_0 = ptr1;
169
- deferred2_1 = len1;
170
- return getStringFromWasm0(ptr1, len1);
171
- } finally {
172
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
114
+ const ret = wasm.canonicalizeJson(value_json);
115
+ if (ret[2]) {
116
+ throw takeFromExternrefTable0(ret[1]);
173
117
  }
118
+ return takeFromExternrefTable0(ret[0]);
174
119
  }
175
120
 
176
121
  /**
@@ -188,22 +133,11 @@ export function dagCborCodecCode() {
188
133
  * @returns {string}
189
134
  */
190
135
  export function dagCborComputeCid(bytes) {
191
- let deferred2_0;
192
- let deferred2_1;
193
- try {
194
- const ret = wasm.dagCborComputeCid(bytes);
195
- var ptr1 = ret[0];
196
- var len1 = ret[1];
197
- if (ret[3]) {
198
- ptr1 = 0; len1 = 0;
199
- throw takeFromExternrefTable0(ret[2]);
200
- }
201
- deferred2_0 = ptr1;
202
- deferred2_1 = len1;
203
- return getStringFromWasm0(ptr1, len1);
204
- } finally {
205
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
136
+ const ret = wasm.dagCborComputeCid(bytes);
137
+ if (ret[2]) {
138
+ throw takeFromExternrefTable0(ret[1]);
206
139
  }
140
+ return takeFromExternrefTable0(ret[0]);
207
141
  }
208
142
 
209
143
  /**
@@ -264,22 +198,11 @@ export function lowerHexToBytes(encoded) {
264
198
  * @returns {string}
265
199
  */
266
200
  export function multibaseBase58btcEncode(bytes) {
267
- let deferred2_0;
268
- let deferred2_1;
269
- try {
270
- const ret = wasm.multibaseBase58btcEncode(bytes);
271
- var ptr1 = ret[0];
272
- var len1 = ret[1];
273
- if (ret[3]) {
274
- ptr1 = 0; len1 = 0;
275
- throw takeFromExternrefTable0(ret[2]);
276
- }
277
- deferred2_0 = ptr1;
278
- deferred2_1 = len1;
279
- return getStringFromWasm0(ptr1, len1);
280
- } finally {
281
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
201
+ const ret = wasm.multibaseBase58btcEncode(bytes);
202
+ if (ret[2]) {
203
+ throw takeFromExternrefTable0(ret[1]);
282
204
  }
205
+ return takeFromExternrefTable0(ret[0]);
283
206
  }
284
207
 
285
208
  /**
@@ -288,22 +211,11 @@ export function multibaseBase58btcEncode(bytes) {
288
211
  * @returns {string}
289
212
  */
290
213
  export function multibaseBase64urlEncode(bytes) {
291
- let deferred2_0;
292
- let deferred2_1;
293
- try {
294
- const ret = wasm.multibaseBase64urlEncode(bytes);
295
- var ptr1 = ret[0];
296
- var len1 = ret[1];
297
- if (ret[3]) {
298
- ptr1 = 0; len1 = 0;
299
- throw takeFromExternrefTable0(ret[2]);
300
- }
301
- deferred2_0 = ptr1;
302
- deferred2_1 = len1;
303
- return getStringFromWasm0(ptr1, len1);
304
- } finally {
305
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
214
+ const ret = wasm.multibaseBase64urlEncode(bytes);
215
+ if (ret[2]) {
216
+ throw takeFromExternrefTable0(ret[1]);
306
217
  }
218
+ return takeFromExternrefTable0(ret[0]);
307
219
  }
308
220
 
309
221
  /**
@@ -320,7 +232,7 @@ export function multibaseDecode(encoded) {
320
232
  }
321
233
 
322
234
  /**
323
- * Strip a known multicodec prefix, or return the original bytes when none is found.
235
+ * Strip a known multicodec prefix, or return a typed error for an unknown prefix.
324
236
  * @param {Uint8Array} bytes
325
237
  * @returns {Uint8Array}
326
238
  */
@@ -339,22 +251,11 @@ export function multicodecStripPrefix(bytes) {
339
251
  * @returns {string}
340
252
  */
341
253
  export function multikeyEncode(codec_name, public_key) {
342
- let deferred2_0;
343
- let deferred2_1;
344
- try {
345
- const ret = wasm.multikeyEncode(codec_name, public_key);
346
- var ptr1 = ret[0];
347
- var len1 = ret[1];
348
- if (ret[3]) {
349
- ptr1 = 0; len1 = 0;
350
- throw takeFromExternrefTable0(ret[2]);
351
- }
352
- deferred2_0 = ptr1;
353
- deferred2_1 = len1;
354
- return getStringFromWasm0(ptr1, len1);
355
- } finally {
356
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
254
+ const ret = wasm.multikeyEncode(codec_name, public_key);
255
+ if (ret[2]) {
256
+ throw takeFromExternrefTable0(ret[1]);
357
257
  }
258
+ return takeFromExternrefTable0(ret[0]);
358
259
  }
359
260
 
360
261
  /**
@@ -422,7 +323,11 @@ export function validateKeyBinding(binding_type, algorithm, multikey) {
422
323
  function __wbg_get_imports() {
423
324
  const import0 = {
424
325
  __proto__: null,
425
- __wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
326
+ __wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
327
+ const ret = typeof(arg0) === 'function';
328
+ return ret;
329
+ },
330
+ __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
426
331
  const obj = arg1;
427
332
  const ret = typeof(obj) === 'string' ? obj : undefined;
428
333
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -430,44 +335,64 @@ function __wbg_get_imports() {
430
335
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
431
336
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
432
337
  },
433
- __wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
338
+ __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
434
339
  throw new Error(getStringFromWasm0(arg0, arg1));
435
340
  },
436
- __wbg_charCodeAt_ee49a2dd698e4f66: function(arg0, arg1) {
341
+ __wbg_call_1875a20c43a36133: function() { return handleError(function (arg0, arg1, arg2, arg3) {
342
+ const ret = arg0.call(arg1, arg2, arg3);
343
+ return ret;
344
+ }, arguments); },
345
+ __wbg_charCodeAt_bbfbcedfafe34880: function(arg0, arg1) {
437
346
  const ret = arg0.charCodeAt(arg1 >>> 0);
438
347
  return ret;
439
348
  },
440
- __wbg_fill_36c70ae56a83e4f3: function(arg0, arg1, arg2, arg3) {
349
+ __wbg_fill_775586ed37049ccf: function(arg0, arg1, arg2, arg3) {
441
350
  const ret = arg0.fill(arg1, arg2 >>> 0, arg3 >>> 0);
442
351
  return ret;
443
352
  },
444
- __wbg_length_36bd29c6848c2144: function(arg0) {
353
+ __wbg_getPrototypeOf_228a4abae6ef0509: function(arg0) {
354
+ const ret = Object.getPrototypeOf(arg0);
355
+ return ret;
356
+ },
357
+ __wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
358
+ const ret = Reflect.get(arg0, arg1);
359
+ return ret;
360
+ }, arguments); },
361
+ __wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
362
+ let result;
363
+ try {
364
+ result = arg0 instanceof Uint8Array;
365
+ } catch (_) {
366
+ result = false;
367
+ }
368
+ const ret = result;
369
+ return ret;
370
+ },
371
+ __wbg_length_78dac82682e59660: function(arg0) {
445
372
  const ret = arg0.length;
446
373
  return ret;
447
374
  },
448
- __wbg_length_7afd83ae4ddf324f: function(arg0) {
375
+ __wbg_length_7f3c00c40364105e: function(arg0) {
449
376
  const ret = arg0.length;
450
377
  return ret;
451
378
  },
452
- __wbg_new_from_slice_3eea173078478cfe: function(arg0, arg1) {
379
+ __wbg_new_from_slice_9a868026ffa4208a: function(arg0, arg1) {
453
380
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
454
381
  return ret;
455
382
  },
456
- __wbg_new_with_length_3ffc1c56427c525c: function(arg0) {
383
+ __wbg_new_with_length_3da0ad195f6f63ba: function(arg0) {
457
384
  const ret = new Uint8Array(arg0 >>> 0);
458
385
  return ret;
459
386
  },
460
- __wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
387
+ __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
461
388
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
462
389
  },
463
- __wbg_set_862c439a342a8818: function(arg0, arg1, arg2) {
464
- arg0.set(arg1, arg2 >>> 0);
465
- },
466
- __wbg_subarray_a4cc58201c7359fd: function(arg0, arg1, arg2) {
467
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
390
+ __wbindgen_generic_0000000000000001: function(arg0) {
391
+ // Cast intrinsic for `F64 -> Externref`.
392
+ const ret = arg0;
468
393
  return ret;
469
394
  },
470
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
395
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
471
396
  // Cast intrinsic for `Ref(String) -> Externref`.
472
397
  const ret = getStringFromWasm0(arg0, arg1);
473
398
  return ret;
@@ -519,6 +444,15 @@ function getUint8ArrayMemory0() {
519
444
  return cachedUint8ArrayMemory0;
520
445
  }
521
446
 
447
+ function handleError(f, args) {
448
+ try {
449
+ return f.apply(this, args);
450
+ } catch (e) {
451
+ const idx = addToExternrefTable0(e);
452
+ wasm.__wbindgen_exn_store(idx);
453
+ }
454
+ }
455
+
522
456
  function isLikeNone(x) {
523
457
  return x === undefined || x === null;
524
458
  }