xbintsc 0.6.9 → 0.6.12
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/src/checker/globals.js +2 -1
- package/dist/src/checker/globals.js.map +1 -1
- package/dist/src/cli/help.d.ts +1 -1
- package/dist/src/cli/main.js +1 -0
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/codegen/generator/state.js +3 -0
- package/dist/src/codegen/generator/state.js.map +1 -1
- package/dist/src/codegen/generator/tables.js +3 -0
- package/dist/src/codegen/generator/tables.js.map +1 -1
- package/dist/src/driver/compiler.js +1 -1
- package/dist/src/driver/compiler.js.map +1 -1
- package/dist/src/driver/config.js +1 -0
- package/dist/src/driver/config.js.map +1 -1
- package/dist/src/driver/runtime-objects.d.ts +1 -1
- package/dist/src/driver/runtime-objects.js +2 -0
- package/dist/src/driver/runtime-objects.js.map +1 -1
- package/dist/src/driver/version.d.ts +1 -1
- package/dist/src/driver/version.js +1 -1
- package/dist/src/driver/version.js.map +1 -1
- package/dist/src/extensions/node/crypto/index.js +12 -1
- package/dist/src/extensions/node/crypto/index.js.map +1 -1
- package/dist/tests/driver/config.test.js +15 -2
- package/dist/tests/driver/config.test.js.map +1 -1
- package/dist/tests/e2e/compile-builtins.test.js +26 -0
- package/dist/tests/e2e/compile-builtins.test.js.map +1 -1
- package/dist/tests/e2e/compile-node.test.js +37 -1
- package/dist/tests/e2e/compile-node.test.js.map +1 -1
- package/dist/tests/e2e/crypto-random.test.d.ts +9 -0
- package/dist/tests/e2e/crypto-random.test.js +63 -0
- package/dist/tests/e2e/crypto-random.test.js.map +1 -0
- package/dist/tests/e2e/date-parse.test.js +27 -1
- package/dist/tests/e2e/date-parse.test.js.map +1 -1
- package/dist/tests/e2e/gui-css-coverage.test.js +1 -1
- package/dist/tests/e2e/gui-dom.test.js +29 -0
- package/dist/tests/e2e/gui-dom.test.js.map +1 -1
- package/dist/tests/e2e/gui-form.test.d.ts +9 -0
- package/dist/tests/e2e/gui-form.test.js +359 -0
- package/dist/tests/e2e/gui-form.test.js.map +1 -0
- package/dist/tests/e2e/gui-helpers.d.ts +2 -0
- package/dist/tests/e2e/gui-helpers.js +1 -0
- package/dist/tests/e2e/gui-helpers.js.map +1 -1
- package/dist/tests/e2e/gui-layout.test.js +47 -0
- package/dist/tests/e2e/gui-layout.test.js.map +1 -1
- package/dist/tests/e2e/gui-paint.test.js +108 -0
- package/dist/tests/e2e/gui-paint.test.js.map +1 -1
- package/dist/tests/e2e/gui-script-import-order.test.js +6 -1
- package/dist/tests/e2e/gui-script-import-order.test.js.map +1 -1
- package/dist/tests/e2e/gui-style.test.js +82 -0
- package/dist/tests/e2e/gui-style.test.js.map +1 -1
- package/dist/tests/e2e/gui-unsupported.test.d.ts +6 -0
- package/dist/tests/e2e/gui-unsupported.test.js +124 -0
- package/dist/tests/e2e/gui-unsupported.test.js.map +1 -0
- package/dist/tests/e2e/json-parse-errors.test.d.ts +9 -0
- package/dist/tests/e2e/json-parse-errors.test.js +48 -0
- package/dist/tests/e2e/json-parse-errors.test.js.map +1 -0
- package/doc/ai/extensions.md +7 -4
- package/doc/ai/language-support.md +2 -1
- package/doc/ai/zh-CN/extensions.md +6 -3
- package/doc/ai/zh-CN/language-support.md +2 -1
- package/doc/gui/api.md +8 -2
- package/doc/gui/dom.md +81 -4
- package/doc/gui/input.md +74 -3
- package/doc/gui/known-issues.md +12 -5
- package/doc/gui/layout.md +19 -6
- package/doc/gui/rendering.md +16 -9
- package/doc/implemented/node/crypto.md +8 -0
- package/doc/implemented/node/fs.md +1 -1
- package/doc/implemented/stdlib.md +10 -2
- package/doc/zh-CN/gui/api.md +8 -2
- package/doc/zh-CN/gui/dom.md +70 -4
- package/doc/zh-CN/gui/input.md +65 -4
- package/doc/zh-CN/gui/known-issues.md +11 -4
- package/doc/zh-CN/gui/layout.md +14 -4
- package/doc/zh-CN/gui/rendering.md +13 -10
- package/doc/zh-CN/implemented/node/crypto.md +6 -0
- package/doc/zh-CN/implemented/node/fs.md +1 -1
- package/doc/zh-CN/implemented/stdlib.md +10 -2
- package/package.json +7 -7
- package/runtime/ext_gui/clip_values.cpp +11 -0
- package/runtime/ext_gui/css.cpp +27 -2
- package/runtime/ext_gui/css_match.cpp +21 -1
- package/runtime/ext_gui/css_selector.cpp +23 -0
- package/runtime/ext_gui/css_sheet.cpp +7 -0
- package/runtime/ext_gui/document.cpp +15 -0
- package/runtime/ext_gui/document_animation.cpp +4 -1
- package/runtime/ext_gui/dom.h +41 -2
- package/runtime/ext_gui/dom_api.cpp +3 -0
- package/runtime/ext_gui/dom_api_document.cpp +28 -0
- package/runtime/ext_gui/dom_api_events.cpp +17 -14
- package/runtime/ext_gui/dom_api_form.cpp +567 -0
- package/runtime/ext_gui/dom_api_internal.h +46 -214
- package/runtime/ext_gui/dom_api_mutation.cpp +1 -1
- package/runtime/ext_gui/dom_api_node.cpp +10 -3
- package/runtime/ext_gui/dom_api_node_read.cpp +1 -1
- package/runtime/ext_gui/dom_api_proto.cpp +45 -0
- package/runtime/ext_gui/dom_api_webgl_methods.h +217 -0
- package/runtime/ext_gui/dom_parse.cpp +118 -1
- package/runtime/ext_gui/effect_values.cpp +28 -7
- package/runtime/ext_gui/form_focus.cpp +293 -0
- package/runtime/ext_gui/form_input.cpp +448 -0
- package/runtime/ext_gui/form_internal.h +30 -0
- package/runtime/ext_gui/form_shared.cpp +126 -0
- package/runtime/ext_gui/form_state.cpp +536 -0
- package/runtime/ext_gui/form_state.h +97 -0
- package/runtime/ext_gui/gradient_values.cpp +25 -5
- package/runtime/ext_gui/gui_engine.h +40 -4
- package/runtime/ext_gui/gui_events.cpp +63 -48
- package/runtime/ext_gui/inline_svg.cpp +3 -0
- package/runtime/ext_gui/layout.cpp +6 -0
- package/runtime/ext_gui/layout.h +4 -0
- package/runtime/ext_gui/layout_flow.cpp +35 -3
- package/runtime/ext_gui/layout_inline.cpp +80 -7
- package/runtime/ext_gui/media_query.cpp +7 -1
- package/runtime/ext_gui/paint.cpp +62 -24
- package/runtime/ext_gui/paint.h +7 -4
- package/runtime/ext_gui/paint_clip.cpp +74 -19
- package/runtime/ext_gui/paint_form.cpp +389 -0
- package/runtime/ext_gui/paint_internal.h +13 -1
- package/runtime/ext_gui/renderer_clip.cpp +19 -17
- package/runtime/ext_gui/style.cpp +5 -1
- package/runtime/ext_gui/style.h +5 -0
- package/runtime/ext_gui/style_cascade.cpp +2 -0
- package/runtime/ext_gui/style_internal.h +7 -2
- package/runtime/ext_gui/style_print.cpp +33 -0
- package/runtime/ext_gui/style_text.cpp +11 -0
- package/runtime/ext_gui/style_ua.cpp +42 -0
- package/runtime/ext_gui/style_values.cpp +89 -90
- package/runtime/ext_gui/transform.cpp +2 -0
- package/runtime/ext_gui/warnings.cpp +298 -0
- package/runtime/ext_gui/warnings.h +59 -0
- package/runtime/ext_gui/window.cpp +31 -55
- package/runtime/ext_gui/window_diagnostics.cpp +58 -0
- package/runtime/ext_gui/window_emit.cpp +51 -0
- package/runtime/ext_node/crypto/crypto.c +3 -2
- package/runtime/ext_node/crypto/crypto_hash.h +13 -0
- package/runtime/ext_node/crypto/crypto_random.c +339 -0
- package/runtime/ext_node/fs/async_worker.c +1 -1
- package/runtime/ext_node/fs/fs_ops.c +1 -1
- package/runtime/ext_node/fs/parts/platform.inc +65 -0
- package/runtime/rt.h +27 -0
- package/runtime/xt_crypto.c +132 -0
- package/runtime/xt_random.c +143 -0
- package/runtime/xt_regex/matcher.inc +9 -28
- package/runtime/xt_regex/parser.inc +65 -2
- package/runtime/xt_regex/types.inc +11 -1
- package/runtime/xt_regex.h +6 -2
- package/runtime/xt_stdlib/dispatch.inc +2 -0
- package/runtime/xt_stdlib/math.inc +1 -1
- package/runtime/xt_stdlib2/date.inc +204 -4
- package/runtime/xt_stdlib2/json.inc +4 -546
- package/runtime/xt_stdlib2/json_parse.inc +347 -0
- package/runtime/xt_stdlib2/json_stringify.inc +368 -0
- package/runtime/xt_stdlib2/regexp-match.inc +6 -11
- package/runtime/xt_stdlib2.c +0 -4
- package/runtime/xt_typed_array/elements.inc +6 -1
- package/src/checker/globals.ts +2 -0
- package/src/cli/main.ts +1 -0
- package/src/codegen/generator/state.ts +3 -0
- package/src/codegen/generator/tables.ts +3 -0
- package/src/driver/compiler.ts +1 -1
- package/src/driver/config.ts +1 -0
- package/src/driver/runtime-objects.ts +2 -0
- package/src/driver/version.ts +1 -1
- package/src/extensions/node/crypto/index.ts +12 -1
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
#include "rt.h"
|
|
2
|
+
#include "crypto_hash.h"
|
|
3
|
+
|
|
4
|
+
#include <stdint.h>
|
|
5
|
+
#include <stdio.h>
|
|
6
|
+
#include <stdlib.h>
|
|
7
|
+
#include <string.h>
|
|
8
|
+
|
|
9
|
+
/* -- random and password hashing ----------------------------------------- */
|
|
10
|
+
|
|
11
|
+
/* `Buffer.alloc`/`from` live in the same extension archive (buffer.c); this
|
|
12
|
+
* module only needs the static dispatcher to hand a byte array back as a
|
|
13
|
+
* Buffer. */
|
|
14
|
+
xt_value xt_buffer_static(xt_value name, int32_t argc, xt_value *argv);
|
|
15
|
+
|
|
16
|
+
static xt_value xt_crypto_buffer(const uint8_t *bytes, size_t length) {
|
|
17
|
+
xt_value values = xt_array_new(0, NULL);
|
|
18
|
+
for (size_t i = 0; i < length; i++) xt_array_push(values, xt_number((double)bytes[i]));
|
|
19
|
+
xt_value name = xt_string_from_cstr("from");
|
|
20
|
+
xt_value args[1] = {values};
|
|
21
|
+
return xt_buffer_static(name, 1, args);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static void xt_crypto_fail(const char *constructor, const char *message) {
|
|
25
|
+
xt_value text = xt_string_from_cstr(message);
|
|
26
|
+
xt_throw(xt_error_ctor_by_name(xt_string_from_cstr(constructor), 1, &text));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Read a string / Buffer / typed array as raw bytes. On success `out` is
|
|
30
|
+
* malloc'ed and must be freed by the caller. */
|
|
31
|
+
static int xt_crypto_bytes(xt_value value, uint8_t **out, size_t *length) {
|
|
32
|
+
*out = NULL;
|
|
33
|
+
*length = 0;
|
|
34
|
+
if (XT_IS_STRING(value)) {
|
|
35
|
+
const char *text = xt_string_data(value);
|
|
36
|
+
int32_t count = xt_string_length_value(value);
|
|
37
|
+
if (count < 0) count = 0;
|
|
38
|
+
uint8_t *bytes = (uint8_t *)malloc(count ? (size_t)count : 1);
|
|
39
|
+
if (!bytes) return 0;
|
|
40
|
+
if (count > 0) memcpy(bytes, text, (size_t)count);
|
|
41
|
+
*out = bytes;
|
|
42
|
+
*length = (size_t)count;
|
|
43
|
+
return 1;
|
|
44
|
+
}
|
|
45
|
+
if (xt_is_typed_array(value)) {
|
|
46
|
+
uint32_t view_length = xt_typed_array_length(value);
|
|
47
|
+
/* A `Uint8Array`-style byte view is common; for other element widths the
|
|
48
|
+
* caller's byte count is the view's byte length, which is not exposed.
|
|
49
|
+
* Reading elements keeps this correct for the password/salt use case. */
|
|
50
|
+
uint8_t *bytes = (uint8_t *)malloc(view_length ? view_length : 1);
|
|
51
|
+
if (!bytes) return 0;
|
|
52
|
+
for (uint32_t i = 0; i < view_length; i++) {
|
|
53
|
+
xt_value item = xt_typed_array_read(value, i);
|
|
54
|
+
bytes[i] = (uint8_t)((int)xt_to_number(item) & 0xff);
|
|
55
|
+
}
|
|
56
|
+
*out = bytes;
|
|
57
|
+
*length = view_length;
|
|
58
|
+
return 1;
|
|
59
|
+
}
|
|
60
|
+
if (XT_IS_OBJECT(value)) {
|
|
61
|
+
xt_value length_value = xt_object_get_cstr(value, "length");
|
|
62
|
+
if (!XT_IS_NUMBER(length_value)) return 0;
|
|
63
|
+
size_t count = (size_t)xt_to_number(length_value);
|
|
64
|
+
uint8_t *bytes = (uint8_t *)malloc(count ? count : 1);
|
|
65
|
+
if (!bytes) return 0;
|
|
66
|
+
for (size_t i = 0; i < count; i++) {
|
|
67
|
+
char key[24];
|
|
68
|
+
snprintf(key, sizeof(key), "%zu", i);
|
|
69
|
+
bytes[i] = (uint8_t)((int)xt_to_number(xt_get(value, xt_string_from_cstr(key))) & 0xff);
|
|
70
|
+
}
|
|
71
|
+
*out = bytes;
|
|
72
|
+
*length = count;
|
|
73
|
+
return 1;
|
|
74
|
+
}
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static xt_value xt_crypto_random_bytes_impl(int32_t argc, xt_value *argv) {
|
|
79
|
+
if (argc < 1) return xt_undefined();
|
|
80
|
+
double size_value = xt_to_number(argv[0]);
|
|
81
|
+
if (!(size_value >= 0) || size_value > 2147483647.0) {
|
|
82
|
+
xt_crypto_fail("RangeError", "The value of \"size\" is out of range");
|
|
83
|
+
}
|
|
84
|
+
size_t size = (size_t)size_value;
|
|
85
|
+
uint8_t *bytes = (uint8_t *)malloc(size ? size : 1);
|
|
86
|
+
if (!bytes) xt_crypto_fail("Error", "out of memory");
|
|
87
|
+
if (xt_secure_random(bytes, size) != 0) {
|
|
88
|
+
free(bytes);
|
|
89
|
+
xt_crypto_fail("Error", "the operating system entropy source is unavailable");
|
|
90
|
+
}
|
|
91
|
+
xt_value buffer = xt_crypto_buffer(bytes, size);
|
|
92
|
+
free(bytes);
|
|
93
|
+
return buffer;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
xt_value xt_crypto_random_bytes(int32_t argc, xt_value *argv) {
|
|
97
|
+
xt_value buffer = xt_crypto_random_bytes_impl(argc, argv);
|
|
98
|
+
if (argc > 1 && XT_IS_FUNCTION(argv[1])) {
|
|
99
|
+
xt_value args[2] = {XT_NULL, buffer};
|
|
100
|
+
xt_call_with_this(argv[1], XT_UNDEFINED, 2, args);
|
|
101
|
+
return xt_undefined();
|
|
102
|
+
}
|
|
103
|
+
return buffer;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
xt_value xt_crypto_random_uuid(int32_t argc, xt_value *argv) {
|
|
107
|
+
(void)argc;
|
|
108
|
+
(void)argv;
|
|
109
|
+
return xt_crypto_static(xt_string_from_cstr("randomUUID"), 0, NULL);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
xt_value xt_crypto_random_int(int32_t argc, xt_value *argv) {
|
|
113
|
+
int32_t callback_index = -1;
|
|
114
|
+
if (argc > 0 && XT_IS_FUNCTION(argv[argc - 1])) callback_index = argc - 1;
|
|
115
|
+
int32_t count = callback_index >= 0 ? callback_index : argc;
|
|
116
|
+
double minimum = 0.0;
|
|
117
|
+
double maximum = 0.0;
|
|
118
|
+
if (count == 1) {
|
|
119
|
+
maximum = xt_to_number(argv[0]);
|
|
120
|
+
} else if (count >= 2) {
|
|
121
|
+
minimum = xt_to_number(argv[0]);
|
|
122
|
+
maximum = xt_to_number(argv[1]);
|
|
123
|
+
} else {
|
|
124
|
+
xt_crypto_fail("TypeError", "randomInt requires a range");
|
|
125
|
+
}
|
|
126
|
+
if (!(maximum > minimum)) {
|
|
127
|
+
xt_crypto_fail("RangeError", "The value of \"max\" must be greater than \"min\"");
|
|
128
|
+
}
|
|
129
|
+
double span = maximum - minimum;
|
|
130
|
+
double value = minimum + (double)xt_random_below((uint64_t)span);
|
|
131
|
+
if (callback_index >= 0) {
|
|
132
|
+
xt_value args[2] = {XT_NULL, xt_number(value)};
|
|
133
|
+
xt_call_with_this(argv[callback_index], XT_UNDEFINED, 2, args);
|
|
134
|
+
return xt_undefined();
|
|
135
|
+
}
|
|
136
|
+
return xt_number(value);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
static int xt_crypto_fill_buffer(xt_value target, size_t offset, size_t size) {
|
|
140
|
+
if (xt_is_typed_array(target)) {
|
|
141
|
+
uint32_t length = xt_typed_array_length(target);
|
|
142
|
+
static const int kind_bytes[] = {1, 1, 1, 2, 2, 4, 4, 4, 8};
|
|
143
|
+
int kind = xt_typed_array_kind_of(target);
|
|
144
|
+
size_t total = kind >= 0 ? (size_t)length * (size_t)kind_bytes[kind] : 0;
|
|
145
|
+
if (offset > total) offset = total;
|
|
146
|
+
if (size > total - offset) size = total - offset;
|
|
147
|
+
if (size == 0) return 1;
|
|
148
|
+
uint8_t *bytes = (uint8_t *)malloc(size);
|
|
149
|
+
if (!bytes) return 0;
|
|
150
|
+
int ok = xt_secure_random(bytes, size) == 0;
|
|
151
|
+
if (ok) {
|
|
152
|
+
xt_array_buffer_copy_bytes_in(xt_typed_array_backing_buffer(target),
|
|
153
|
+
xt_typed_array_view_offset(target) + (uint32_t)offset, bytes,
|
|
154
|
+
(uint32_t)size);
|
|
155
|
+
}
|
|
156
|
+
free(bytes);
|
|
157
|
+
return ok;
|
|
158
|
+
}
|
|
159
|
+
xt_value length_value = xt_object_get_cstr(target, "length");
|
|
160
|
+
if (!XT_IS_NUMBER(length_value)) return 0;
|
|
161
|
+
size_t total = (size_t)xt_to_number(length_value);
|
|
162
|
+
if (offset > total) offset = total;
|
|
163
|
+
if (size > total - offset) size = total - offset;
|
|
164
|
+
if (size == 0) return 1;
|
|
165
|
+
uint8_t *bytes = (uint8_t *)malloc(size);
|
|
166
|
+
if (!bytes) return 0;
|
|
167
|
+
int ok = xt_secure_random(bytes, size) == 0;
|
|
168
|
+
if (ok) {
|
|
169
|
+
for (size_t i = 0; i < size; i++) {
|
|
170
|
+
char key[24];
|
|
171
|
+
snprintf(key, sizeof(key), "%zu", offset + i);
|
|
172
|
+
xt_set(target, xt_string_from_cstr(key), xt_number((double)bytes[i]));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
free(bytes);
|
|
176
|
+
return ok;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
xt_value xt_crypto_random_fill_sync(int32_t argc, xt_value *argv) {
|
|
180
|
+
if (argc < 1) return xt_undefined();
|
|
181
|
+
xt_value target = argv[0];
|
|
182
|
+
size_t total = 0;
|
|
183
|
+
if (xt_is_typed_array(target)) {
|
|
184
|
+
static const int kind_bytes[] = {1, 1, 1, 2, 2, 4, 4, 4, 8};
|
|
185
|
+
int kind = xt_typed_array_kind_of(target);
|
|
186
|
+
total = kind >= 0 ? (size_t)xt_typed_array_length(target) * (size_t)kind_bytes[kind] : 0;
|
|
187
|
+
} else {
|
|
188
|
+
xt_value length_value = xt_object_get_cstr(target, "length");
|
|
189
|
+
if (!XT_IS_NUMBER(length_value)) {
|
|
190
|
+
xt_crypto_fail("TypeError", "randomFillSync requires a Buffer or TypedArray");
|
|
191
|
+
}
|
|
192
|
+
total = (size_t)xt_to_number(length_value);
|
|
193
|
+
}
|
|
194
|
+
size_t offset = argc > 1 ? (size_t)xt_to_number(argv[1]) : 0;
|
|
195
|
+
size_t size = argc > 2 ? (size_t)xt_to_number(argv[2]) : total - (offset < total ? offset : total);
|
|
196
|
+
if (!xt_crypto_fill_buffer(target, offset, size)) {
|
|
197
|
+
xt_crypto_fail("Error", "the operating system entropy source is unavailable");
|
|
198
|
+
}
|
|
199
|
+
return target;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
xt_value xt_crypto_random_fill(int32_t argc, xt_value *argv) {
|
|
203
|
+
int32_t callback_index = argc > 1 && XT_IS_FUNCTION(argv[argc - 1]) ? argc - 1 : -1;
|
|
204
|
+
int32_t count = callback_index >= 0 ? callback_index : argc;
|
|
205
|
+
xt_value target = xt_crypto_random_fill_sync(count, argv);
|
|
206
|
+
if (callback_index >= 0) {
|
|
207
|
+
xt_value args[2] = {XT_NULL, target};
|
|
208
|
+
xt_call_with_this(argv[callback_index], XT_UNDEFINED, 2, args);
|
|
209
|
+
return xt_undefined();
|
|
210
|
+
}
|
|
211
|
+
return target;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* -- PBKDF2 -------------------------------------------------------------- */
|
|
215
|
+
|
|
216
|
+
static size_t xt_hmac(const char *algorithm, const uint8_t *key, size_t key_length,
|
|
217
|
+
const uint8_t *data, size_t data_length, uint8_t *out) {
|
|
218
|
+
uint8_t zero = 0;
|
|
219
|
+
size_t digest_length = xt_crypto_hash_compute(algorithm, &zero, 0, out);
|
|
220
|
+
if (digest_length == 0) return 0;
|
|
221
|
+
uint8_t block[64];
|
|
222
|
+
memset(block, 0, sizeof(block));
|
|
223
|
+
if (key_length > sizeof(block)) {
|
|
224
|
+
uint8_t key_hash[64];
|
|
225
|
+
if (xt_crypto_hash_compute(algorithm, key, key_length, key_hash) == 0) return 0;
|
|
226
|
+
memcpy(block, key_hash, digest_length);
|
|
227
|
+
} else {
|
|
228
|
+
memcpy(block, key, key_length);
|
|
229
|
+
}
|
|
230
|
+
uint8_t inner[64 + 4096];
|
|
231
|
+
if (data_length > 4096) return 0;
|
|
232
|
+
for (size_t i = 0; i < sizeof(block); i++) inner[i] = (uint8_t)(block[i] ^ 0x36);
|
|
233
|
+
memcpy(inner + sizeof(block), data, data_length);
|
|
234
|
+
uint8_t inner_hash[64];
|
|
235
|
+
size_t inner_length = xt_crypto_hash_compute(algorithm, inner, sizeof(block) + data_length, inner_hash);
|
|
236
|
+
if (inner_length == 0) return 0;
|
|
237
|
+
uint8_t outer[64];
|
|
238
|
+
for (size_t i = 0; i < sizeof(outer); i++) outer[i] = (uint8_t)(block[i] ^ 0x5c);
|
|
239
|
+
uint8_t outer_input[64 + 64];
|
|
240
|
+
memcpy(outer_input, outer, sizeof(outer));
|
|
241
|
+
memcpy(outer_input + sizeof(outer), inner_hash, inner_length);
|
|
242
|
+
if (xt_crypto_hash_compute(algorithm, outer_input, sizeof(outer) + inner_length, out) == 0) return 0;
|
|
243
|
+
return digest_length;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
xt_value xt_crypto_pbkdf2_sync(int32_t argc, xt_value *argv) {
|
|
247
|
+
if (argc < 4) {
|
|
248
|
+
xt_crypto_fail("TypeError", "pbkdf2Sync requires password, salt, iterations and keylen");
|
|
249
|
+
}
|
|
250
|
+
uint8_t *password = NULL;
|
|
251
|
+
uint8_t *salt = NULL;
|
|
252
|
+
size_t password_length = 0;
|
|
253
|
+
size_t salt_length = 0;
|
|
254
|
+
if (!xt_crypto_bytes(argv[0], &password, &password_length) ||
|
|
255
|
+
!xt_crypto_bytes(argv[1], &salt, &salt_length)) {
|
|
256
|
+
free(password);
|
|
257
|
+
free(salt);
|
|
258
|
+
xt_crypto_fail("TypeError", "password and salt must be strings or Buffers");
|
|
259
|
+
}
|
|
260
|
+
int iterations = (int)xt_to_number(argv[2]);
|
|
261
|
+
size_t key_length = (size_t)xt_to_number(argv[3]);
|
|
262
|
+
const char *algorithm = argc > 4 && !xt_truthy(xt_is_nullish(argv[4]))
|
|
263
|
+
? xt_string_data(xt_to_string(argv[4]))
|
|
264
|
+
: "sha256";
|
|
265
|
+
if (iterations < 1) {
|
|
266
|
+
free(password);
|
|
267
|
+
free(salt);
|
|
268
|
+
xt_crypto_fail("RangeError", "iterations must be a positive number");
|
|
269
|
+
}
|
|
270
|
+
uint8_t zero = 0;
|
|
271
|
+
uint8_t probe[64];
|
|
272
|
+
size_t digest_length = xt_crypto_hash_compute(algorithm, &zero, 0, probe);
|
|
273
|
+
if (digest_length == 0) {
|
|
274
|
+
free(password);
|
|
275
|
+
free(salt);
|
|
276
|
+
xt_crypto_fail("Error", "unsupported PBKDF2 digest");
|
|
277
|
+
}
|
|
278
|
+
uint8_t *output = (uint8_t *)malloc(key_length ? key_length : 1);
|
|
279
|
+
if (!output) {
|
|
280
|
+
free(password);
|
|
281
|
+
free(salt);
|
|
282
|
+
xt_crypto_fail("Error", "out of memory");
|
|
283
|
+
}
|
|
284
|
+
size_t done = 0;
|
|
285
|
+
uint32_t block_index = 1;
|
|
286
|
+
uint8_t *block_input = (uint8_t *)malloc(salt_length + 4);
|
|
287
|
+
if (!block_input) {
|
|
288
|
+
free(password);
|
|
289
|
+
free(salt);
|
|
290
|
+
free(output);
|
|
291
|
+
xt_crypto_fail("Error", "out of memory");
|
|
292
|
+
}
|
|
293
|
+
while (done < key_length) {
|
|
294
|
+
memcpy(block_input, salt, salt_length);
|
|
295
|
+
block_input[salt_length + 0] = (uint8_t)(block_index >> 24);
|
|
296
|
+
block_input[salt_length + 1] = (uint8_t)(block_index >> 16);
|
|
297
|
+
block_input[salt_length + 2] = (uint8_t)(block_index >> 8);
|
|
298
|
+
block_input[salt_length + 3] = (uint8_t)block_index;
|
|
299
|
+
uint8_t u[64];
|
|
300
|
+
uint8_t t[64];
|
|
301
|
+
if (xt_hmac(algorithm, password, password_length, block_input, salt_length + 4, u) == 0) break;
|
|
302
|
+
memcpy(t, u, digest_length);
|
|
303
|
+
for (int round = 1; round < iterations; round++) {
|
|
304
|
+
uint8_t next[64];
|
|
305
|
+
if (xt_hmac(algorithm, password, password_length, u, digest_length, next) == 0) break;
|
|
306
|
+
memcpy(u, next, digest_length);
|
|
307
|
+
for (size_t i = 0; i < digest_length; i++) t[i] ^= u[i];
|
|
308
|
+
}
|
|
309
|
+
size_t copy = key_length - done < digest_length ? key_length - done : digest_length;
|
|
310
|
+
memcpy(output + done, t, copy);
|
|
311
|
+
done += copy;
|
|
312
|
+
block_index++;
|
|
313
|
+
}
|
|
314
|
+
free(block_input);
|
|
315
|
+
free(password);
|
|
316
|
+
free(salt);
|
|
317
|
+
xt_value buffer = xt_crypto_buffer(output, done);
|
|
318
|
+
free(output);
|
|
319
|
+
return buffer;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
xt_value xt_crypto_pbkdf2(int32_t argc, xt_value *argv) {
|
|
323
|
+
int32_t callback_index = argc > 0 && XT_IS_FUNCTION(argv[argc - 1]) ? argc - 1 : -1;
|
|
324
|
+
int32_t count = callback_index >= 0 ? callback_index : argc;
|
|
325
|
+
xt_value result = xt_crypto_pbkdf2_sync(count, argv);
|
|
326
|
+
if (callback_index >= 0) {
|
|
327
|
+
xt_value args[2] = {XT_NULL, result};
|
|
328
|
+
xt_call_with_this(argv[callback_index], XT_UNDEFINED, 2, args);
|
|
329
|
+
return xt_undefined();
|
|
330
|
+
}
|
|
331
|
+
return result;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
xt_value xt_crypto_random_fill_callback(int32_t argc, xt_value *argv) {
|
|
335
|
+
return xt_crypto_random_fill(argc, argv);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
@@ -333,7 +333,7 @@ void xt_fs_job_run(xt_async_job *base) {
|
|
|
333
333
|
if (!job->path || xt_fs_rmdir_one(job->path) != 0) xt_fs_job_fail(job, errno, "rmdir", job->path);
|
|
334
334
|
break;
|
|
335
335
|
case XT_FS_JOB_RENAME:
|
|
336
|
-
if (!job->path || !job->path2 ||
|
|
336
|
+
if (!job->path || !job->path2 || xt_fs_rename_atomic(job->path, job->path2) != 0) {
|
|
337
337
|
xt_fs_job_fail(job, errno, "rename", job->path);
|
|
338
338
|
}
|
|
339
339
|
break;
|
|
@@ -238,7 +238,7 @@ xt_value xt_node_rename(int32_t argc, xt_value *argv) {
|
|
|
238
238
|
const char *from = xt_string_data(xt_to_string(argv[0]));
|
|
239
239
|
const char *to = xt_string_data(xt_to_string(argv[1]));
|
|
240
240
|
if (!from || !to) return xt_undefined();
|
|
241
|
-
if (
|
|
241
|
+
if (xt_fs_rename_atomic(from, to) != 0) xt_fs_error("rename", from);
|
|
242
242
|
return xt_undefined();
|
|
243
243
|
}
|
|
244
244
|
|
|
@@ -150,3 +150,68 @@ static inline int xt_fs_mkdir_parents(const char *path, int mode) {
|
|
|
150
150
|
free(copy);
|
|
151
151
|
return status;
|
|
152
152
|
}
|
|
153
|
+
|
|
154
|
+
/* -- atomic rename -------------------------------------------------------- */
|
|
155
|
+
/* POSIX `rename` replaces an existing destination atomically. The Windows CRT
|
|
156
|
+
* `rename` fails with EEXIST instead, so `renameSync` could not overwrite a
|
|
157
|
+
* file (the usual write-to-temp-then-rename pattern broke on Windows).
|
|
158
|
+
* `MoveFileExW` with `MOVEFILE_REPLACE_EXISTING` has the POSIX semantics and
|
|
159
|
+
* takes UTF-8 paths through a wide-string conversion. */
|
|
160
|
+
#if defined(_WIN32)
|
|
161
|
+
#ifndef WIN32_LEAN_AND_MEAN
|
|
162
|
+
#define WIN32_LEAN_AND_MEAN
|
|
163
|
+
#endif
|
|
164
|
+
#include <windows.h>
|
|
165
|
+
|
|
166
|
+
static inline wchar_t *xt_fs_utf8_to_wide(const char *text) {
|
|
167
|
+
int length = MultiByteToWideChar(CP_UTF8, 0, text, -1, NULL, 0);
|
|
168
|
+
if (length <= 0) return NULL;
|
|
169
|
+
wchar_t *wide = (wchar_t *)malloc((size_t)length * sizeof(wchar_t));
|
|
170
|
+
if (!wide) return NULL;
|
|
171
|
+
if (MultiByteToWideChar(CP_UTF8, 0, text, -1, wide, length) <= 0) {
|
|
172
|
+
free(wide);
|
|
173
|
+
return NULL;
|
|
174
|
+
}
|
|
175
|
+
return wide;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
static inline int xt_fs_rename_atomic(const char *from, const char *to) {
|
|
179
|
+
wchar_t *wide_from = xt_fs_utf8_to_wide(from);
|
|
180
|
+
wchar_t *wide_to = xt_fs_utf8_to_wide(to);
|
|
181
|
+
if (!wide_from || !wide_to) {
|
|
182
|
+
free(wide_from);
|
|
183
|
+
free(wide_to);
|
|
184
|
+
errno = EINVAL;
|
|
185
|
+
return -1;
|
|
186
|
+
}
|
|
187
|
+
BOOL ok = MoveFileExW(wide_from, wide_to, MOVEFILE_REPLACE_EXISTING);
|
|
188
|
+
DWORD error = ok ? ERROR_SUCCESS : GetLastError();
|
|
189
|
+
free(wide_from);
|
|
190
|
+
free(wide_to);
|
|
191
|
+
if (ok) return 0;
|
|
192
|
+
switch (error) {
|
|
193
|
+
case ERROR_FILE_NOT_FOUND:
|
|
194
|
+
case ERROR_PATH_NOT_FOUND:
|
|
195
|
+
errno = ENOENT;
|
|
196
|
+
break;
|
|
197
|
+
case ERROR_ACCESS_DENIED:
|
|
198
|
+
case ERROR_SHARING_VIOLATION:
|
|
199
|
+
errno = EACCES;
|
|
200
|
+
break;
|
|
201
|
+
case ERROR_ALREADY_EXISTS:
|
|
202
|
+
errno = EEXIST;
|
|
203
|
+
break;
|
|
204
|
+
case ERROR_NOT_SAME_DEVICE:
|
|
205
|
+
errno = EXDEV;
|
|
206
|
+
break;
|
|
207
|
+
default:
|
|
208
|
+
errno = EIO;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
return -1;
|
|
212
|
+
}
|
|
213
|
+
#else
|
|
214
|
+
static inline int xt_fs_rename_atomic(const char *from, const char *to) {
|
|
215
|
+
return rename(from, to);
|
|
216
|
+
}
|
|
217
|
+
#endif
|
package/runtime/rt.h
CHANGED
|
@@ -291,8 +291,14 @@ xt_value xt_array_buffer_alloc(uint32_t byte_length);
|
|
|
291
291
|
/** Typed-array view internals for extensions: whether `value` is a view, the
|
|
292
292
|
* `ArrayBuffer` it views, and the byte offset of the view inside it. */
|
|
293
293
|
int xt_is_typed_array(xt_value value);
|
|
294
|
+
/** Element kind (0..8: U8, I8, U8C, U16, I16, U32, I32, F32, F64), or -1. */
|
|
295
|
+
int xt_typed_array_kind_of(xt_value value);
|
|
296
|
+
/** Read one element (coerced to a number) from a typed-array view. */
|
|
297
|
+
xt_value xt_typed_array_read(xt_value array, uint32_t index);
|
|
294
298
|
xt_value xt_typed_array_backing_buffer(xt_value value);
|
|
295
299
|
uint32_t xt_typed_array_view_offset(xt_value value);
|
|
300
|
+
/** Number of elements in a typed-array view. */
|
|
301
|
+
uint32_t xt_typed_array_length(xt_value value);
|
|
296
302
|
/** Error-family construction and prototype lookup by constructor name. */
|
|
297
303
|
xt_value xt_error_ctor_by_name(xt_value name, int32_t argc, xt_value *argv);
|
|
298
304
|
xt_value xt_error_prototype(xt_value name);
|
|
@@ -314,6 +320,27 @@ xt_value xt_url_file_url_to_path(int32_t argc, xt_value *argv);
|
|
|
314
320
|
/* -- node:crypto ---------------------------------------------------------- */
|
|
315
321
|
xt_value xt_crypto_create_hash(int32_t argc, xt_value *argv);
|
|
316
322
|
|
|
323
|
+
/* -- entropy (xt_random.c) ------------------------------------------------ */
|
|
324
|
+
/** Fill `out` with `length` bytes from the OS CSPRNG. Returns 0 on success. */
|
|
325
|
+
int xt_secure_random(uint8_t *out, size_t length);
|
|
326
|
+
/** A 64-bit value from the process-wide xoshiro256** generator (seeded from the
|
|
327
|
+
* OS CSPRNG). Never returns a constant stream. */
|
|
328
|
+
uint64_t xt_random_u64(void);
|
|
329
|
+
/** Uniform double in `[0, 1)` with 53 random bits. */
|
|
330
|
+
double xt_random_double(void);
|
|
331
|
+
/** Uniform integer in `[0, bound)` (rejection sampling; `bound` 0 returns 0). */
|
|
332
|
+
uint64_t xt_random_below(uint64_t bound);
|
|
333
|
+
|
|
334
|
+
/* -- Web Crypto surface (xt_crypto.c) ------------------------------------ */
|
|
335
|
+
/** `crypto.<method>(...)` (namespace call lowering). */
|
|
336
|
+
xt_value xt_crypto_static(xt_value name, int32_t argc, xt_value *argv);
|
|
337
|
+
/** `crypto.<property>` read as a value (closures for the methods). */
|
|
338
|
+
xt_value xt_crypto_get(xt_value name);
|
|
339
|
+
/** The first-class `crypto` object (`const c = crypto`). */
|
|
340
|
+
xt_value xt_crypto_object(int32_t argc, xt_value *argv);
|
|
341
|
+
/** The `webcrypto` object re-exported by `node:crypto`. */
|
|
342
|
+
xt_value xt_crypto_webcrypto(int32_t argc, xt_value *argv);
|
|
343
|
+
|
|
317
344
|
/* -- node:child_process --------------------------------------------------- */
|
|
318
345
|
xt_value xt_child_process_spawn_sync(int32_t argc, xt_value *argv);
|
|
319
346
|
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* xbintsc runtime — Web Crypto surface.
|
|
3
|
+
*
|
|
4
|
+
* `crypto.getRandomValues(typedArray)` and `crypto.randomUUID()` are available
|
|
5
|
+
* as globals in every program; `node:crypto` re-exports the same object as
|
|
6
|
+
* `webcrypto`. The entropy comes from `xt_random.c` (`BCryptGenRandom` /
|
|
7
|
+
* `/dev/urandom`), never from `Math.random`.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "rt.h"
|
|
11
|
+
|
|
12
|
+
#include <stdint.h>
|
|
13
|
+
#include <stdio.h>
|
|
14
|
+
#include <stdlib.h>
|
|
15
|
+
#include <string.h>
|
|
16
|
+
|
|
17
|
+
static const int xt_crypto_kind_bytes[] = {1, 1, 1, 2, 2, 4, 4, 4, 8};
|
|
18
|
+
|
|
19
|
+
static void xt_crypto_throw(const char *constructor, const char *message) {
|
|
20
|
+
xt_value text = xt_string_from_cstr(message);
|
|
21
|
+
xt_throw(xt_error_ctor_by_name(xt_string_from_cstr(constructor), 1, &text));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static xt_value xt_crypto_make_uuid(void) {
|
|
25
|
+
uint8_t bytes[16];
|
|
26
|
+
if (xt_secure_random(bytes, sizeof(bytes)) != 0) {
|
|
27
|
+
/* The OS source is unavailable: fall back to the seeded generator rather
|
|
28
|
+
* than returning a constant. */
|
|
29
|
+
for (int i = 0; i < 16; i += 8) {
|
|
30
|
+
uint64_t value = xt_random_u64();
|
|
31
|
+
memcpy(bytes + i, &value, 8);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
bytes[6] = (uint8_t)((bytes[6] & 0x0F) | 0x40); /* version 4 */
|
|
35
|
+
bytes[8] = (uint8_t)((bytes[8] & 0x3F) | 0x80); /* RFC 4122 variant */
|
|
36
|
+
char text[37];
|
|
37
|
+
snprintf(text, sizeof(text),
|
|
38
|
+
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", bytes[0],
|
|
39
|
+
bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], bytes[8],
|
|
40
|
+
bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]);
|
|
41
|
+
return xt_string_from_cstr(text);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Fill a typed array with random bytes. The DOM limits a single call to
|
|
45
|
+
* 65 536 bytes; larger requests throw a `RangeError`. */
|
|
46
|
+
static xt_value xt_crypto_get_random_values(xt_value array) {
|
|
47
|
+
int kind = xt_typed_array_kind_of(array);
|
|
48
|
+
if (kind < 0) {
|
|
49
|
+
xt_crypto_throw("TypeError", "crypto.getRandomValues requires a typed array");
|
|
50
|
+
return XT_UNDEFINED;
|
|
51
|
+
}
|
|
52
|
+
uint32_t length = xt_typed_array_length(array);
|
|
53
|
+
uint64_t bytes64 = (uint64_t)length * (uint64_t)xt_crypto_kind_bytes[kind];
|
|
54
|
+
if (bytes64 > 65536ULL) {
|
|
55
|
+
xt_crypto_throw("RangeError", "crypto.getRandomValues is limited to 65536 bytes");
|
|
56
|
+
return XT_UNDEFINED;
|
|
57
|
+
}
|
|
58
|
+
if (bytes64 == 0) return array;
|
|
59
|
+
size_t count = (size_t)bytes64;
|
|
60
|
+
uint8_t *bytes = (uint8_t *)malloc(count);
|
|
61
|
+
if (bytes == NULL) {
|
|
62
|
+
xt_crypto_throw("Error", "out of memory");
|
|
63
|
+
return XT_UNDEFINED;
|
|
64
|
+
}
|
|
65
|
+
int failed = xt_secure_random(bytes, count);
|
|
66
|
+
if (failed == 0) {
|
|
67
|
+
xt_array_buffer_copy_bytes_in(xt_typed_array_backing_buffer(array),
|
|
68
|
+
xt_typed_array_view_offset(array), bytes, (uint32_t)count);
|
|
69
|
+
}
|
|
70
|
+
free(bytes);
|
|
71
|
+
if (failed != 0) {
|
|
72
|
+
xt_crypto_throw("Error", "the operating system entropy source is unavailable");
|
|
73
|
+
return XT_UNDEFINED;
|
|
74
|
+
}
|
|
75
|
+
return array;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static xt_value xt_crypto_get_random_values_method(xt_value self, xt_value env, int32_t argc,
|
|
79
|
+
xt_value *argv) {
|
|
80
|
+
(void)self;
|
|
81
|
+
(void)env;
|
|
82
|
+
return xt_crypto_get_random_values(argc > 0 ? argv[0] : XT_UNDEFINED);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static xt_value xt_crypto_random_uuid_method(xt_value self, xt_value env, int32_t argc,
|
|
86
|
+
xt_value *argv) {
|
|
87
|
+
(void)self;
|
|
88
|
+
(void)env;
|
|
89
|
+
(void)argc;
|
|
90
|
+
(void)argv;
|
|
91
|
+
return xt_crypto_make_uuid();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
xt_value xt_crypto_static(xt_value name, int32_t argc, xt_value *argv) {
|
|
95
|
+
const char *method = xt_string_data(name);
|
|
96
|
+
if (method == NULL) return XT_UNDEFINED;
|
|
97
|
+
if (strcmp(method, "getRandomValues") == 0) {
|
|
98
|
+
return xt_crypto_get_random_values(argc > 0 ? argv[0] : XT_UNDEFINED);
|
|
99
|
+
}
|
|
100
|
+
if (strcmp(method, "randomUUID") == 0) return xt_crypto_make_uuid();
|
|
101
|
+
if (strcmp(method, "toJSON") == 0) {
|
|
102
|
+
(void)argc;
|
|
103
|
+
(void)argv;
|
|
104
|
+
return xt_string_from_cstr("[object Crypto]");
|
|
105
|
+
}
|
|
106
|
+
return XT_UNDEFINED;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
xt_value xt_crypto_get(xt_value name) {
|
|
110
|
+
const char *property = xt_string_data(name);
|
|
111
|
+
if (property == NULL) return XT_UNDEFINED;
|
|
112
|
+
if (strcmp(property, "getRandomValues") == 0) {
|
|
113
|
+
return xt_closure_new((void *)xt_crypto_get_random_values_method, 0, NULL);
|
|
114
|
+
}
|
|
115
|
+
if (strcmp(property, "randomUUID") == 0) {
|
|
116
|
+
return xt_closure_new((void *)xt_crypto_random_uuid_method, 0, NULL);
|
|
117
|
+
}
|
|
118
|
+
return XT_UNDEFINED;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
xt_value xt_crypto_object(int32_t argc, xt_value *argv) {
|
|
122
|
+
(void)argc;
|
|
123
|
+
(void)argv;
|
|
124
|
+
xt_value object = xt_object_new();
|
|
125
|
+
xt_object_set(object, xt_string_from_cstr("getRandomValues"),
|
|
126
|
+
xt_closure_new((void *)xt_crypto_get_random_values_method, 0, NULL));
|
|
127
|
+
xt_object_set(object, xt_string_from_cstr("randomUUID"),
|
|
128
|
+
xt_closure_new((void *)xt_crypto_random_uuid_method, 0, NULL));
|
|
129
|
+
return object;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
xt_value xt_crypto_webcrypto(int32_t argc, xt_value *argv) { return xt_crypto_object(argc, argv); }
|