solid-ui 3.0.1-27039d9 → 3.0.1-2c1067d
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/README.md +288 -302
- package/dist/chat/keys.js +4 -4
- package/dist/chat/keys.js.map +1 -1
- package/dist/chat/signature.js +5 -5
- package/dist/chat/signature.js.map +1 -1
- package/dist/header/index.d.ts.map +1 -1
- package/dist/header/index.js +0 -52
- package/dist/header/index.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/solid-ui.esm.js +12481 -13299
- package/dist/solid-ui.esm.js.map +1 -1
- package/dist/solid-ui.esm.min.js +14 -14
- package/dist/solid-ui.esm.min.js.map +1 -1
- package/dist/solid-ui.js +1072 -1814
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +10 -12
- package/dist/solid-ui.min.js.map +1 -1
- package/dist/versionInfo.js +5 -5
- package/dist/widgets/buttons.js +20 -20
- package/dist/widgets/buttons.js.map +1 -1
- package/package.json +134 -133
- package/dist/theme-accessibility.css +0 -147
- package/dist/theme-classic.css +0 -70
- package/dist/theme-default.css +0 -65
- package/dist/theme-signal.css +0 -65
- package/dist/theme-telegram.css +0 -65
- package/dist/theme-variables.css +0 -163
- package/dist/theme-wave.css +0 -65
- package/dist/themes-README.md +0 -254
package/dist/solid-ui.js
CHANGED
|
@@ -1044,11 +1044,6 @@ module.exports = _regenerator, module.exports.__esModule = true, module.exports[
|
|
|
1044
1044
|
/******/ };
|
|
1045
1045
|
/******/ })();
|
|
1046
1046
|
/******/
|
|
1047
|
-
/******/ /* webpack/runtime/publicPath */
|
|
1048
|
-
/******/ (() => {
|
|
1049
|
-
/******/ __webpack_require__.p = "";
|
|
1050
|
-
/******/ })();
|
|
1051
|
-
/******/
|
|
1052
1047
|
/************************************************************************/
|
|
1053
1048
|
var __webpack_exports__ = {};
|
|
1054
1049
|
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
|
|
@@ -1081,7 +1076,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1081
1076
|
style: () => (/* reexport */ style),
|
|
1082
1077
|
table: () => (/* reexport */ renderTableViewPane),
|
|
1083
1078
|
tabs: () => (/* reexport */ tabs_namespaceObject),
|
|
1084
|
-
themeLoader: () => (/* reexport */ themeLoader),
|
|
1085
1079
|
utils: () => (/* reexport */ utils_namespaceObject),
|
|
1086
1080
|
widgets: () => (/* reexport */ widgets_namespaceObject)
|
|
1087
1081
|
});
|
|
@@ -2279,17 +2273,6 @@ function _slicedToArray(r, e) {
|
|
|
2279
2273
|
|
|
2280
2274
|
// EXTERNAL MODULE: ./node_modules/mime-types/index.js
|
|
2281
2275
|
var mime_types = __webpack_require__(49);
|
|
2282
|
-
;// ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
2283
|
-
|
|
2284
|
-
function _defineProperty(e, r, t) {
|
|
2285
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
2286
|
-
value: t,
|
|
2287
|
-
enumerable: !0,
|
|
2288
|
-
configurable: !0,
|
|
2289
|
-
writable: !0
|
|
2290
|
-
}) : e[r] = t, e;
|
|
2291
|
-
}
|
|
2292
|
-
|
|
2293
2276
|
;// ./src/styleConstants.js
|
|
2294
2277
|
/* harmony default export */ const styleConstants = ({
|
|
2295
2278
|
highlightColor: '#7C4DFF',
|
|
@@ -2320,70 +2303,152 @@ function _defineProperty(e, r, t) {
|
|
|
2320
2303
|
basicMaxLength: '4096'
|
|
2321
2304
|
});
|
|
2322
2305
|
;// ./src/style.js
|
|
2323
|
-
|
|
2324
|
-
var _style;
|
|
2325
2306
|
// Common readable consistent stylesheet
|
|
2326
2307
|
// to avoid using style sheets which are document-global
|
|
2327
2308
|
// and make programmable style toggling with selection, drag over, etc easier
|
|
2328
2309
|
// These must all end with semicolon so they can be appended to.
|
|
2329
|
-
//
|
|
2330
|
-
// PHASE 1: Hybrid mode - CSS variables with fallbacks
|
|
2331
|
-
// CSS variables (--sui-*) are provided by themes/foundation/variables.css
|
|
2332
|
-
// Fallback values preserve original appearance when themes aren't loaded
|
|
2333
2310
|
|
|
2334
2311
|
|
|
2335
|
-
var style =
|
|
2312
|
+
var style = {
|
|
2336
2313
|
// styleModule
|
|
2337
2314
|
|
|
2338
|
-
checkboxStyle: 'color:
|
|
2339
|
-
checkboxInputStyle: 'font-size:
|
|
2340
|
-
fieldLabelStyle: 'color:
|
|
2341
|
-
formSelectStyle: 'background-color:
|
|
2342
|
-
textInputStyle: 'background-color:
|
|
2315
|
+
checkboxStyle: 'color: black; font-size: 100%; padding-left: 0.5 em; padding-right: 0.5 em;',
|
|
2316
|
+
checkboxInputStyle: 'font-size: 150%; height: 1.2em; width: 1.2em; background-color: #eef; border-radius:0.2em; margin: 0.1em;',
|
|
2317
|
+
fieldLabelStyle: 'color: #3B5998; text-decoration: none;',
|
|
2318
|
+
formSelectStyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;',
|
|
2319
|
+
textInputStyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;',
|
|
2343
2320
|
textInputStyleUneditable:
|
|
2344
2321
|
// Color difference only
|
|
2345
|
-
'background-color:
|
|
2346
|
-
buttonStyle: 'background-color:
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2322
|
+
'background-color: white; padding: 0.5em; border: .05em solid white; border-radius:0.2em; font-size: 100%; margin:0.4em;',
|
|
2323
|
+
buttonStyle: 'background-color: #fff; padding: 0.7em; border: .01em solid white; border-radius:0.2em; font-size: 100%; margin: 0.3em;',
|
|
2324
|
+
// 'background-color: #eef;
|
|
2325
|
+
commentStyle: 'padding: 0.7em; border: none; font-size: 100%; white-space: pre-wrap;',
|
|
2326
|
+
iconStyle: 'width: 3em; height: 3em; margin: 0.1em; border-radius: 1em;',
|
|
2327
|
+
smallButtonStyle: 'margin: 0.2em; width: 1em; height:1em;',
|
|
2328
|
+
classIconStyle: 'width: 3em; height: 3em; margin: 0.1em; border-radius: 0.2em; border: 0.1em solid green; padding: 0.2em; background-color: #efe;',
|
|
2329
|
+
// combine with buttonStyle
|
|
2330
|
+
confirmPopupStyle: 'padding: 0.7em; border-radius: 0.2em; border: 0.1em solid orange; background-color: white; box-shadow: 0.5em 0.9em #888;',
|
|
2331
|
+
messageBodyStyle: 'white-space: pre-wrap; width: 99%; font-size:100%; border: 0.07em solid #eee; border-radius:0.2em; padding: .3em 0.5em; margin: 0.1em;',
|
|
2332
|
+
pendingeditModifier: 'color: #bbb;',
|
|
2354
2333
|
// Contacts
|
|
2355
|
-
personaBarStyle: 'width: 100%; height: 4em; background-color:
|
|
2356
|
-
searchInputStyle: 'border: 0.1em solid
|
|
2357
|
-
autocompleteRowStyle: 'border: 0.2em solid
|
|
2334
|
+
personaBarStyle: 'width: 100%; height: 4em; background-color: #eee; vertical-align: middle;',
|
|
2335
|
+
searchInputStyle: 'border: 0.1em solid #444; border-radius: 0.2em; width: 100%; font-size: 100%; padding: 0.1em 0.6em; margin 0.2em;',
|
|
2336
|
+
autocompleteRowStyle: 'border: 0.2em solid straw;',
|
|
2358
2337
|
// Login buttons
|
|
2359
|
-
signInAndUpButtonStyle: 'padding: 1em; border-radius:
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2338
|
+
signInAndUpButtonStyle: 'padding: 1em; border-radius:0.2em; font-size: 100%;',
|
|
2339
|
+
// was 0.5em radius
|
|
2340
|
+
headerBannerLoginInput: 'margin: 0.75em 0 0.75em 0.5em !important; padding: 0.5em !important;',
|
|
2341
|
+
signUpBackground: 'background-color: #eef;',
|
|
2342
|
+
signInBackground: 'background-color: #efe;',
|
|
2363
2343
|
// Forms
|
|
2364
|
-
heading1Style: 'font-size: 180%; font-weight: bold; color:
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2344
|
+
heading1Style: 'font-size: 180%; font-weight: bold; color: #888888; padding: 0.5em; margin: 0.7em 0.0m;',
|
|
2345
|
+
// originally was brown; now grey
|
|
2346
|
+
heading2Style: 'font-size: 130%; font-weight: bold; color: #888888; padding: 0.4em; margin: 0.7em 0.0em;',
|
|
2347
|
+
// originally was brown; now grey
|
|
2348
|
+
heading3Style: 'font-size: 120%; font-weight: bold; color: #888888; padding: 0.3em; margin: 0.7em 0.0em;',
|
|
2349
|
+
// For example, in large forms or before a small form
|
|
2350
|
+
heading4Style: 'font-size: 110%; font-weight: bold; color: #888888; padding: 0.2em; margin: 0.7em 0.0em;',
|
|
2351
|
+
// Lowest level used by default in small things
|
|
2352
|
+
|
|
2353
|
+
formHeadingStyle: 'font-size: 110%; font-weight: bold; color: #888888; padding: 0.2em; margin: 0.7em 0.0em;',
|
|
2354
|
+
// originally was brown; now grey
|
|
2369
2355
|
formTextInput: 'font-size: 100%; margin: 0.1em; padding: 0.1em;',
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
sidebarStyle: 'overflow-x: auto; overflow-y: auto; border-radius: var(--sui-border-radius, 0.5em); border: 0.1em solid var(--sui-border-color, white); background-color: var(--sui-bg-panel, white);',
|
|
2378
|
-
sourcePaneStyle: 'font-family: var(--sui-font-family-mono, monospace); font-size: 100%; width: 100%; max-width: 60em; margin: 1em 0.2em 1em 0.2em; padding: var(--sui-space-lg, 1em); border: 0.1em solid var(--sui-border-color, #888); border-radius: var(--sui-border-radius, 0.5em); background-color: var(--sui-bg-panel, white); color: var(--sui-text, black);',
|
|
2356
|
+
// originally used this
|
|
2357
|
+
formGroupStyle: ["padding-left: 0em; border: 0.0em solid ".concat(styleConstants.formBorderColor, "; border-radius: 0.2em;"), // weight 0
|
|
2358
|
+
"padding-left: 2em; border: 0.05em solid ".concat(styleConstants.formBorderColor, "; border-radius: 0.2em;"), "padding-left: 2em; border: 0.1em solid ".concat(styleConstants.formBorderColor, "; border-radius: 0.2em;"), "padding-left: 2em; border: 0.2em solid ".concat(styleConstants.formBorderColor, "; border-radius: 0.2em;") // @@ pink
|
|
2359
|
+
],
|
|
2360
|
+
formFieldLabelStyle: "color: ".concat(styleConstants.lowProfileLinkColor, "; text-decoration: none;"),
|
|
2361
|
+
formFieldNameBoxStyle: "padding: 0.3em; vertical-align: middle; width:".concat(styleConstants.formFieldNameBoxWidth, ";"),
|
|
2362
|
+
multilineTextInputStyle: 'font-size:100%; white-space: pre-wrap; background-color: #eef;' + ' border: 0.07em solid gray; padding: 1em 0.5em; margin: 1em 1em;',
|
|
2379
2363
|
// Buttons
|
|
2380
|
-
renderAsDivStyle: 'display: flex; align-items: center; justify-content: space-between; height:
|
|
2381
|
-
imageDivStyle: 'width:
|
|
2382
|
-
linkDivStyle: 'width:
|
|
2364
|
+
renderAsDivStyle: 'display: flex; align-items: center; justify-content: space-between; height: 2.5em; padding: 1em;',
|
|
2365
|
+
imageDivStyle: 'width:2.5em; padding:0.5em; height: 2.5em;',
|
|
2366
|
+
linkDivStyle: 'width:2em; padding:0.5em; height: 4em;',
|
|
2383
2367
|
// ACL
|
|
2384
2368
|
aclControlBoxContainer: 'margin: 1em;',
|
|
2385
|
-
aclControlBoxHeader: 'font-size:
|
|
2386
|
-
}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_style, "aclControlBoxHeader", 'font-size: 120%; margin: 0 0 1rem;'), "aclControlBoxStatus", 'display: none; margin: 1rem 0;'), "aclControlBoxStatusRevealed", 'display: block;'), "aclGroupContent", 'maxWidth: 650;'), "accessGroupList", 'display: grid; grid-template-columns: 1fr; margin: var(--sui-space-md, 1em); width: 100%;'), "accessGroupListItem", 'display: grid; grid-template-columns: 100px auto 30%;'), "defaultsController", 'display: flex;'), "defaultsControllerNotice", 'color: var(--sui-text-muted, #888); flexGrow: 1; fontSize: 80%;'), "bigButton", 'background-color: var(--sui-bg-panel, white); border: 0.1em solid var(--sui-border-color-dark, #888); border-radius: var(--sui-border-radius, 0.3em); max-width: 50%; padding-bottom: var(--sui-space-md, 1em); padding-top: var(--sui-space-md, 1em);'), "group", 'color: var(--sui-group-default, #888);'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_style, "group1", 'color: var(--sui-group-1, green);'), "group2", 'color: var(--sui-group-2, #cc0);'), "group3", 'color: var(--sui-group-3, orange);'), "group5", 'color: var(--sui-group-5, red);'), "group9", 'color: var(--sui-group-9, blue);'), "group13", 'color: var(--sui-group-13, purple);'), "trustedAppAddApplicationsTable", 'background-color: var(--sui-bg-panel, #eee);'), "trustedAppCancelButton", 'float: right;'), "trustedAppControllerI", 'border-color: var(--sui-warning, orange); border-radius: var(--sui-border-radius-lg, 1em); border-width: 0.1em;'), "temporaryStatusInit", 'background: var(--sui-success, green);'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_style, "temporaryStatusEnd", 'background: transparent; transition: background 5s linear;'), "headerUserMenuLink", 'background: none; border: 0; color: var(--sui-text, black); cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: var(--sui-space-md, 1em); width: 100%; text-decoration: none;'), "headerUserMenuLinkHover", 'background: none; border: 0; color: var(--sui-text, black); cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: var(--sui-space-md, 1em); width: 100%; text-decoration: none; background-image: var(--sui-header-gradient, linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%));'), "headerUserMenuTrigger", 'background: none; border: 0; cursor: pointer; width: var(--sui-header-height, 60px); height: var(--sui-header-height, 60px);'), "headerUserMenuTriggerImg", 'border-radius: var(--sui-border-radius-full, 50%); height: 56px; width: 28px !important;'), "headerUserMenuButton", 'background: none; border: 0; color: var(--sui-text, black); cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: var(--sui-space-md, 1em); width: 100%;'), "headerUserMenuButtonHover", 'background: none; border: 0; color: var(--sui-text, black); cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: var(--sui-space-md, 1em); width: 100%; background-image: var(--sui-header-gradient, linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%));'), "headerUserMenuList", 'list-style: none; margin: 0; padding: 0;'), "headerUserMenuListDisplay", 'list-style: none; margin: 0; padding: 0; display:true;'), "headerUserMenuNavigationMenu", 'background: var(--sui-bg-panel, white); border: solid 1px var(--sui-text, #000000); border-right: 0; position: absolute; right: 0; top: var(--sui-header-height, 60px); width: 200px; z-index: var(--sui-z-dropdown, 1); display: true;'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_style, "headerUserMenuNavigationMenuNotDisplayed", 'background: var(--sui-bg-panel, white); border: solid 1px var(--sui-text, #000000); border-right: 0; position: absolute; right: 0; top: var(--sui-header-height, 60px); width: 200px; z-index: var(--sui-z-dropdown, 1); display: none;'), "headerUserMenuListItem", 'border-bottom: solid 1px var(--sui-text, #000000);'), "headerUserMenuPhoto", 'border-radius: var(--sui-border-radius-full, 50%); background-position: center; background-repeat: no-repeat; background-size: cover; height: 50px; width: 50px;'), "headerBanner", 'background: var(--sui-bg-header, white); box-shadow: var(--sui-header-shadow, 0px 1px 4px #000000); display: flex; justify-content: space-between; padding: 0 var(--sui-space-lg, 1.5em);'), "headerBannerRightMenu", 'display: flex;'), "headerBannerLogin", 'margin-left: auto;'), "allChildrenVisible", 'display: true;'), "headerBannerUserMenu", 'border-left: solid 1px var(--sui-text, #000000); margin-left: auto;'), "headerBannerHelpMenu", 'border-left: solid 1px var(--sui-text, #000000); margin-left: auto;'), "headerBannerIcon", 'background-size: 65px var(--sui-header-height, 60px) !important; height: var(--sui-header-height, 60px) !important; width: 65px !important;'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_style, "footer", 'border-top: solid 1px var(--sui-border-color, #ccc); font-size: 0.9em; padding: var(--sui-space-sm, 0.5em) var(--sui-space-lg, 1.5em);'), "primaryButton", 'background-color: var(--sui-primary-light, #7c4dff); color: var(--sui-text-on-primary, #ffffff); font-family: var(--sui-font-family, Raleway, Roboto, sans-serif); border-radius: var(--sui-border-radius, 0.25em); border-color: var(--sui-primary-light, #7c4dff); border: 1px solid; cursor: pointer; font-size: 0.8em; text-decoration: none; padding: var(--sui-button-padding-sm, 0.5em 4em); transition: var(--sui-transition, 0.25s all ease-in-out); outline: none;'), "primaryButtonHover", 'background-color: var(--sui-primary, #9f7dff); color: var(--sui-text-on-primary, #ffffff); font-family: var(--sui-font-family, Raleway, Roboto, sans-serif); border-radius: var(--sui-border-radius, 0.25em); border-color: var(--sui-primary-light, #7c4dff); border: 1px solid; cursor: pointer; font-size: 0.8em; text-decoration: none; padding: var(--sui-button-padding-sm, 0.5em 4em); transition: var(--sui-transition, 0.25s all ease-in-out); outline: none;'), "primaryButtonNoBorder", 'background-color: var(--sui-bg-panel, #ffffff); color: var(--sui-primary-light, #7c4dff); font-family: var(--sui-font-family, Raleway, Roboto, sans-serif); border-radius: var(--sui-border-radius, 0.25em); border-color: var(--sui-primary-light, #7c4dff); border: 1px solid; cursor: pointer; font-size: 0.8em; text-decoration: none; padding: var(--sui-button-padding-sm, 0.5em 4em); transition: var(--sui-transition, 0.25s all ease-in-out); outline: none;'), "primaryButtonNoBorderHover", 'background-color: var(--sui-primary-light, #7c4dff); color: var(--sui-text-on-primary, #ffffff); font-family: var(--sui-font-family, Raleway, Roboto, sans-serif); border-radius: var(--sui-border-radius, 0.25em); border-color: var(--sui-primary-light, #7c4dff); border: 1px solid; cursor: pointer; font-size: 0.8em; text-decoration: none; padding: var(--sui-button-padding-sm, 0.5em 4em); transition: var(--sui-transition, 0.25s all ease-in-out); outline: none;'), "secondaryButton", 'background-color: var(--sui-accent, #01c9ea); color: var(--sui-text-on-primary, #ffffff); font-family: var(--sui-font-family, Raleway, Roboto, sans-serif); border-radius: var(--sui-border-radius, 0.25em); border-color: var(--sui-accent, #01c9ea); border: 1px solid; cursor: pointer; font-size: 0.8em; text-decoration: none; padding: var(--sui-button-padding-sm, 0.5em 4em); transition: var(--sui-transition, 0.25s all ease-in-out); outline: none;'), "secondaryButtonHover", 'background-color: var(--sui-info, #37cde6); color: var(--sui-text-on-primary, #ffffff); font-family: var(--sui-font-family, Raleway, Roboto, sans-serif); border-radius: var(--sui-border-radius, 0.25em); border-color: var(--sui-primary-light, #7c4dff); border: 1px solid; cursor: pointer; font-size: 0.8em; text-decoration: none; padding: var(--sui-button-padding-sm, 0.5em 4em); transition: var(--sui-transition, 0.25s all ease-in-out); outline: none;'), "secondaryButtonNoBorder", 'background-color: var(--sui-bg-panel, #ffffff); color: var(--sui-accent, #01c9ea); font-family: var(--sui-font-family, Raleway, Roboto, sans-serif); border-radius: var(--sui-border-radius, 0.25em); border-color: var(--sui-accent, #01c9ea); border: 1px solid; cursor: pointer; font-size: 0.8em; text-decoration: none; padding: var(--sui-button-padding-sm, 0.5em 4em); transition: var(--sui-transition, 0.25s all ease-in-out); outline: none;'), "secondaryButtonNoBorderHover", 'background-color: var(--sui-accent, #01c9ea); color: var(--sui-text-on-primary, #ffffff); font-family: var(--sui-font-family, Raleway, Roboto, sans-serif); border-radius: var(--sui-border-radius, 0.25em); border-color: var(--sui-accent, #01c9ea); border: 1px solid; cursor: pointer; font-size: 0.8em; text-decoration: none; padding: var(--sui-button-padding-sm, 0.5em 4em); transition: var(--sui-transition, 0.25s all ease-in-out); outline: none;'), "controlStyle", "border-radius: var(--sui-border-radius, 0.5em); margin: 0.8em; width: ".concat(styleConstants.mediaModuleCanvasWidth, "; height: ").concat(styleConstants.mediaModuleCanvasHeight, ";")), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_style, "dragEvent", 'background-color: var(--sui-bg-hover, #ccc); border: 0.25em dashed var(--sui-text, black); border-radius: var(--sui-border-radius, 0.3em);'), "dropEvent", 'background-color: var(--sui-bg-panel, white); border: 0 solid var(--sui-text, black);'), "restoreStyle", 'background-color: var(--sui-bg-panel, white);'), "errorCancelButton", 'width: var(--sui-icon-size, 2em); height: var(--sui-icon-size, 2em); align: right;'), "errorMessageBlockStyle", 'margin: 0.1em; padding: var(--sui-space-sm, 0.5em); border: var(--sui-border-width, 0.05em) solid var(--sui-border-color-dark, gray); color: var(--sui-text, black);'), "notepadStyle", 'padding: var(--sui-space-md, 1em); overflow: auto; resize: horizontal; min-width: 40em;'), "upstreamStatus", 'width: 50%;'), "downstreamStatus", 'width: 50%;'), "baseStyle", 'font-size: 100%; font-family: var(--sui-font-family-mono, monospace); width: 100%; border: none; white-space: pre-wrap;'), "headingCore", 'font-family: var(--sui-font-family, sans-serif); font-weight: bold; border: none;'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_style, "headingStyle", ['font-size: 110%; padding-top: var(--sui-space-sm, 0.5em); padding-bottom: var(--sui-space-sm, 0.5em); width: 100%;', 'font-size: 120%; padding-top: var(--sui-space-md, 1em); padding-bottom: var(--sui-space-md, 1em); width: 100%;', 'font-size: 150%; padding-top: var(--sui-space-md, 1em); padding-bottom: var(--sui-space-md, 1em); width: 100%;']), "participantsStyle", 'margin: 0.8em;'), "participantsBlock", 'height: 1.5em; width: 1.5em; margin: 0.3em; border: 0.01em solid var(--sui-border-color-dark, #888);'), "personTableTD", 'vertical-align: middle;'), "tabsNavElement", 'margin: 0;'), "tabsRootElement", 'display: flex; height: 100%; width: 100%;'), "tabsMainElement", 'margin: 0; width: 100%; height: 100%;'), "tabContainer", 'list-style-type: none; display: flex; height: 100%; width: 100%; margin: 0; padding: 0;'), "makeNewSlot", 'background: none; border: none; font: inherit; cursor: pointer;'), "ellipsis", 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;'));
|
|
2369
|
+
aclControlBoxHeader: 'font-size: 120%; margin: 0 0 1rem;',
|
|
2370
|
+
aclControlBoxStatus: 'display: none; margin: 1rem 0;',
|
|
2371
|
+
aclControlBoxStatusRevealed: 'display: block;',
|
|
2372
|
+
aclGroupContent: 'maxWidth: 650;',
|
|
2373
|
+
accessGroupList: 'display: grid; grid-template-columns: 1fr; margin: 1em; width: 100%;',
|
|
2374
|
+
accessGroupListItem: 'display: grid; grid-template-columns: 100px auto 30%;',
|
|
2375
|
+
defaultsController: 'display: flex;',
|
|
2376
|
+
defaultsControllerNotice: 'color: #888; flexGrow: 1; fontSize: 80%;',
|
|
2377
|
+
bigButton: 'background-color: white; border: 0.1em solid #888; border-radius: 0.3em; max-width: 50%; padding-bottom: 1em; padding-top: 1em;',
|
|
2378
|
+
group: 'color: #888;',
|
|
2379
|
+
group1: 'color: green;',
|
|
2380
|
+
group2: 'color: #cc0;',
|
|
2381
|
+
group3: 'color: orange;',
|
|
2382
|
+
group5: 'color: red;',
|
|
2383
|
+
group9: 'color: blue;',
|
|
2384
|
+
group13: 'color: purple;',
|
|
2385
|
+
trustedAppAddApplicationsTable: 'background-color: #eee;',
|
|
2386
|
+
trustedAppCancelButton: 'float: right;',
|
|
2387
|
+
trustedAppControllerI: 'border-color: orange; border-radius: 1em; border-width: 0.1em;',
|
|
2388
|
+
temporaryStatusInit: 'background: green;',
|
|
2389
|
+
temporaryStatusEnd: 'background: transparent; transition: background 5s linear;',
|
|
2390
|
+
// header
|
|
2391
|
+
headerUserMenuLink: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none;',
|
|
2392
|
+
headerUserMenuLinkHover: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%);',
|
|
2393
|
+
headerUserMenuTrigger: 'background: none; border: 0; cursor: pointer; width: 60px; height: 60px;',
|
|
2394
|
+
headerUserMenuTriggerImg: 'border-radius: 50%; height: 56px; width: 28px !important;',
|
|
2395
|
+
headerUserMenuButton: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%;',
|
|
2396
|
+
headerUserMenuButtonHover: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%);',
|
|
2397
|
+
headerUserMenuList: 'list-style: none; margin: 0; padding: 0;',
|
|
2398
|
+
headerUserMenuListDisplay: 'list-style: none; margin: 0; padding: 0; display:true;',
|
|
2399
|
+
headerUserMenuNavigationMenu: 'background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: true;',
|
|
2400
|
+
headerUserMenuNavigationMenuNotDisplayed: 'background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: none;',
|
|
2401
|
+
headerUserMenuListItem: 'border-bottom: solid 1px #000000;',
|
|
2402
|
+
headerUserMenuPhoto: 'border-radius: 50%; background-position: center; background-repeat: no-repeat; background-size: cover; height: 50px; width: 50px;',
|
|
2403
|
+
headerBanner: 'box-shadow: 0px 1px 4px #000000; display: flex; justify-content: space-between; padding: 0 1.5em; margin-bottom: 4px;',
|
|
2404
|
+
headerBannerLink: 'display: block;',
|
|
2405
|
+
headerBannerRightMenu: 'display: flex;',
|
|
2406
|
+
headerBannerLogin: 'margin-left: auto;',
|
|
2407
|
+
allChildrenVisible: 'display:true;',
|
|
2408
|
+
headerBannerUserMenu: 'border-left: solid 1px #000000; margin-left: auto;',
|
|
2409
|
+
headerBannerHelpMenu: 'border-left: solid 1px #000000; margin-left: auto;',
|
|
2410
|
+
headerBannerIcon: 'background-size: 65px 60px !important; height: 60px !important; width: 65px !important;',
|
|
2411
|
+
// may just be 65px round($icon-size * 352 / 322);
|
|
2412
|
+
|
|
2413
|
+
// footer
|
|
2414
|
+
footer: 'border-top: solid 1px $divider-color; font-size: 0.9em; padding: 0.5em 1.5em;',
|
|
2415
|
+
// buttons
|
|
2416
|
+
primaryButton: 'background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;',
|
|
2417
|
+
primaryButtonHover: 'background-color: #9f7dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;',
|
|
2418
|
+
primaryButtonNoBorder: 'background-color: #ffffff; color: #7c4dff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;',
|
|
2419
|
+
primaryButtonNoBorderHover: 'background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;',
|
|
2420
|
+
secondaryButton: 'background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;',
|
|
2421
|
+
secondaryButtonHover: 'background-color: #37cde6; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;',
|
|
2422
|
+
secondaryButtonNoBorder: 'background-color: #ffffff; color: #01c9ea; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;',
|
|
2423
|
+
secondaryButtonNoBorderHover: 'background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;',
|
|
2424
|
+
// media
|
|
2425
|
+
controlStyle: "border-radius: 0.5em; margin: 0.8em; width:".concat(styleConstants.mediaModuleCanvasWidth, "; height:").concat(styleConstants.mediaModuleCanvasHeight, ";"),
|
|
2426
|
+
// dragAndDrop
|
|
2427
|
+
dragEvent: 'background-color: #ccc; border: 0.25em dashed black; border-radius: 0.3em;',
|
|
2428
|
+
dropEvent: 'background-color: white; border: 0em solid black;',
|
|
2429
|
+
restoreStyle: 'background-color: white;',
|
|
2430
|
+
// errors
|
|
2431
|
+
errorCancelButton: 'width: 2em; height: 2em; align: right;',
|
|
2432
|
+
errorMessageBlockStyle: 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; color:black;',
|
|
2433
|
+
// pad
|
|
2434
|
+
notepadStyle: 'padding: 1em; overflow: auto; resize: horizontal; min-width: 40em;',
|
|
2435
|
+
upstreamStatus: 'width: 50%;',
|
|
2436
|
+
downstreamStatus: 'width: 50%;',
|
|
2437
|
+
baseStyle: 'font-size: 100%; font-family: monospace; width: 100%; border: none; white-space: pre-wrap;',
|
|
2438
|
+
headingCore: 'font-family: sans-serif; font-weight: bold; border: none;',
|
|
2439
|
+
headingStyle: ['font-size: 110%; padding-top: 0.5em; padding-bottom: 0.5em; width: 100%;', 'font-size: 120%; padding-top: 1em; padding-bottom: 1em; width: 100%;', 'font-size: 150%; padding-top: 1em; padding-bottom: 1em; width: 100%;'],
|
|
2440
|
+
// participation
|
|
2441
|
+
participantsStyle: 'margin: 0.8em;',
|
|
2442
|
+
participantsBlock: 'height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888;',
|
|
2443
|
+
personTableTD: 'vertical-align: middle;',
|
|
2444
|
+
// tabs
|
|
2445
|
+
tabsNavElement: 'margin: 0;',
|
|
2446
|
+
tabsRootElement: 'display: flex; height: 100%; width: 100%;',
|
|
2447
|
+
tabsMainElement: 'margin: 0; width:100%; height: 100%;',
|
|
2448
|
+
tabContainer: 'list-style-type: none; display: flex; height: 100%; width: 100%; margin: 0; padding: 0;',
|
|
2449
|
+
makeNewSlot: 'background: none; border: none; font: inherit; cursor: pointer;',
|
|
2450
|
+
ellipsis: 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;'
|
|
2451
|
+
};
|
|
2387
2452
|
style.setStyle = function setStyle(ele, styleName) {
|
|
2388
2453
|
ele.style = style[styleName];
|
|
2389
2454
|
};
|
|
@@ -3205,7 +3270,7 @@ var createLinkForURI = function createLinkForURI(dom, linkDiv, obj) {
|
|
|
3205
3270
|
linkDiv.appendChild(dom.createElement('br'));
|
|
3206
3271
|
};
|
|
3207
3272
|
;// ./src/widgets/buttons.ts
|
|
3208
|
-
/* Buttons
|
|
3273
|
+
/* Buttons
|
|
3209
3274
|
*/
|
|
3210
3275
|
|
|
3211
3276
|
|
|
@@ -3220,9 +3285,9 @@ var createLinkForURI = function createLinkForURI(dom, linkDiv, obj) {
|
|
|
3220
3285
|
|
|
3221
3286
|
|
|
3222
3287
|
|
|
3223
|
-
/**
|
|
3224
|
-
* UI Widgets such as buttons
|
|
3225
|
-
* @packageDocumentation
|
|
3288
|
+
/**
|
|
3289
|
+
* UI Widgets such as buttons
|
|
3290
|
+
* @packageDocumentation
|
|
3226
3291
|
*/
|
|
3227
3292
|
|
|
3228
3293
|
/* global alert */
|
|
@@ -3250,8 +3315,8 @@ function getStatusArea(context) {
|
|
|
3250
3315
|
return null;
|
|
3251
3316
|
}
|
|
3252
3317
|
|
|
3253
|
-
/**
|
|
3254
|
-
* Display an error message block
|
|
3318
|
+
/**
|
|
3319
|
+
* Display an error message block
|
|
3255
3320
|
*/
|
|
3256
3321
|
function complain(context, err) {
|
|
3257
3322
|
if (!err) return; // only if error
|
|
@@ -3260,8 +3325,8 @@ function complain(context, err) {
|
|
|
3260
3325
|
if (ele) ele.appendChild(errorMessageBlock(context && context.dom || document, err));else alert(err);
|
|
3261
3326
|
}
|
|
3262
3327
|
|
|
3263
|
-
/**
|
|
3264
|
-
* Remove all the children of an HTML element
|
|
3328
|
+
/**
|
|
3329
|
+
* Remove all the children of an HTML element
|
|
3265
3330
|
*/
|
|
3266
3331
|
function clearElement(ele) {
|
|
3267
3332
|
while (ele.firstChild) {
|
|
@@ -3270,8 +3335,8 @@ function clearElement(ele) {
|
|
|
3270
3335
|
return ele;
|
|
3271
3336
|
}
|
|
3272
3337
|
|
|
3273
|
-
/**
|
|
3274
|
-
* To figure out the log URI from the full URI used to invoke the reasoner
|
|
3338
|
+
/**
|
|
3339
|
+
* To figure out the log URI from the full URI used to invoke the reasoner
|
|
3275
3340
|
*/
|
|
3276
3341
|
function extractLogURI(fullURI) {
|
|
3277
3342
|
var logPos = fullURI.search(/logFile=/);
|
|
@@ -3279,11 +3344,11 @@ function extractLogURI(fullURI) {
|
|
|
3279
3344
|
return fullURI.substring(logPos + 8, rulPos);
|
|
3280
3345
|
}
|
|
3281
3346
|
|
|
3282
|
-
/**
|
|
3283
|
-
* By default, converts e.g. '2020-02-19T19:35:28.557Z' to '19:35'
|
|
3284
|
-
* if today is 19 Feb 2020, and to 'Feb 19' if not.
|
|
3285
|
-
* @@@ TODO This needs to be changed to local time
|
|
3286
|
-
* @param noTime Return a string like 'Feb 19' even if it's today.
|
|
3347
|
+
/**
|
|
3348
|
+
* By default, converts e.g. '2020-02-19T19:35:28.557Z' to '19:35'
|
|
3349
|
+
* if today is 19 Feb 2020, and to 'Feb 19' if not.
|
|
3350
|
+
* @@@ TODO This needs to be changed to local time
|
|
3351
|
+
* @param noTime Return a string like 'Feb 19' even if it's today.
|
|
3287
3352
|
*/
|
|
3288
3353
|
function shortDate(str, noTime) {
|
|
3289
3354
|
if (!str) return '???';
|
|
@@ -3304,11 +3369,11 @@ function shortDate(str, noTime) {
|
|
|
3304
3369
|
}
|
|
3305
3370
|
}
|
|
3306
3371
|
|
|
3307
|
-
/**
|
|
3308
|
-
* Format a date and time
|
|
3309
|
-
* @param date for instance `new Date()`
|
|
3310
|
-
* @param format for instance '{FullYear}-{Month}-{Date}T{Hours}:{Minutes}:{Seconds}.{Milliseconds}'
|
|
3311
|
-
* @returns for instance '2000-01-15T23:14:23.002'
|
|
3372
|
+
/**
|
|
3373
|
+
* Format a date and time
|
|
3374
|
+
* @param date for instance `new Date()`
|
|
3375
|
+
* @param format for instance '{FullYear}-{Month}-{Date}T{Hours}:{Minutes}:{Seconds}.{Milliseconds}'
|
|
3376
|
+
* @returns for instance '2000-01-15T23:14:23.002'
|
|
3312
3377
|
*/
|
|
3313
3378
|
function formatDateTime(date, format) {
|
|
3314
3379
|
return format.split('{').map(function (s) {
|
|
@@ -3324,17 +3389,17 @@ function formatDateTime(date, format) {
|
|
|
3324
3389
|
}).join('');
|
|
3325
3390
|
}
|
|
3326
3391
|
|
|
3327
|
-
/**
|
|
3328
|
-
* Get a string representation of the current time
|
|
3329
|
-
* @returns for instance '2000-01-15T23:14:23.002'
|
|
3392
|
+
/**
|
|
3393
|
+
* Get a string representation of the current time
|
|
3394
|
+
* @returns for instance '2000-01-15T23:14:23.002'
|
|
3330
3395
|
*/
|
|
3331
3396
|
function timestamp() {
|
|
3332
3397
|
return formatDateTime(new Date(), '{FullYear}-{Month}-{Date}T{Hours}:{Minutes}:{Seconds}.{Milliseconds}');
|
|
3333
3398
|
}
|
|
3334
3399
|
|
|
3335
|
-
/**
|
|
3336
|
-
* Get a short string representation of the current time
|
|
3337
|
-
* @returns for instance '23:14:23.002'
|
|
3400
|
+
/**
|
|
3401
|
+
* Get a short string representation of the current time
|
|
3402
|
+
* @returns for instance '23:14:23.002'
|
|
3338
3403
|
*/
|
|
3339
3404
|
function shortTime() {
|
|
3340
3405
|
return formatDateTime(new Date(), '{Hours}:{Minutes}:{Seconds}.{Milliseconds}');
|
|
@@ -3342,8 +3407,8 @@ function shortTime() {
|
|
|
3342
3407
|
|
|
3343
3408
|
// ///////////////////// Handy UX widgets
|
|
3344
3409
|
|
|
3345
|
-
/**
|
|
3346
|
-
* Sets the best name we have and looks up a better one
|
|
3410
|
+
/**
|
|
3411
|
+
* Sets the best name we have and looks up a better one
|
|
3347
3412
|
*/
|
|
3348
3413
|
function setName(element, x) {
|
|
3349
3414
|
var kb = external_SolidLogic_.store;
|
|
@@ -3364,29 +3429,29 @@ function setName(element, x) {
|
|
|
3364
3429
|
}
|
|
3365
3430
|
}
|
|
3366
3431
|
|
|
3367
|
-
/**
|
|
3368
|
-
* Set of suitable images
|
|
3369
|
-
* See also [[findImage]]
|
|
3370
|
-
* @param x The thing for which we want to find an image
|
|
3371
|
-
* @param kb The RDF store to look in
|
|
3372
|
-
* @returns It goes looking for triples in `kb`,
|
|
3373
|
-
* `(subject: x), (predicate: see list below) (object: image-url)`
|
|
3374
|
-
* to find any image linked from the thing with one of the following
|
|
3375
|
-
* predicates (in order):
|
|
3376
|
-
* * ns.sioc('avatar')
|
|
3377
|
-
* * ns.foaf('img')
|
|
3378
|
-
* * ns.vcard('logo')
|
|
3379
|
-
* * ns.vcard('hasPhoto')
|
|
3380
|
-
* * ns.vcard('photo')
|
|
3381
|
-
* * ns.foaf('depiction')
|
|
3382
|
-
|
|
3432
|
+
/**
|
|
3433
|
+
* Set of suitable images
|
|
3434
|
+
* See also [[findImage]]
|
|
3435
|
+
* @param x The thing for which we want to find an image
|
|
3436
|
+
* @param kb The RDF store to look in
|
|
3437
|
+
* @returns It goes looking for triples in `kb`,
|
|
3438
|
+
* `(subject: x), (predicate: see list below) (object: image-url)`
|
|
3439
|
+
* to find any image linked from the thing with one of the following
|
|
3440
|
+
* predicates (in order):
|
|
3441
|
+
* * ns.sioc('avatar')
|
|
3442
|
+
* * ns.foaf('img')
|
|
3443
|
+
* * ns.vcard('logo')
|
|
3444
|
+
* * ns.vcard('hasPhoto')
|
|
3445
|
+
* * ns.vcard('photo')
|
|
3446
|
+
* * ns.foaf('depiction')
|
|
3447
|
+
|
|
3383
3448
|
*/
|
|
3384
3449
|
function imagesOf(x, kb) {
|
|
3385
3450
|
return kb.each(x, src_ns.sioc('avatar')).concat(kb.each(x, src_ns.foaf('img'))).concat(kb.each(x, src_ns.vcard('logo'))).concat(kb.each(x, src_ns.vcard('hasPhoto'))).concat(kb.each(x, src_ns.vcard('photo'))).concat(kb.each(x, src_ns.foaf('depiction')));
|
|
3386
3451
|
}
|
|
3387
3452
|
|
|
3388
|
-
/**
|
|
3389
|
-
* Best logo or avatar or photo etc to represent someone or some group etc
|
|
3453
|
+
/**
|
|
3454
|
+
* Best logo or avatar or photo etc to represent someone or some group etc
|
|
3390
3455
|
*/
|
|
3391
3456
|
var iconForClass = {
|
|
3392
3457
|
// Potentially extendable by other apps, panes, etc
|
|
@@ -3421,8 +3486,8 @@ var iconForClass = {
|
|
|
3421
3486
|
'wf:Closed': 'noun_17020.svg'
|
|
3422
3487
|
};
|
|
3423
3488
|
|
|
3424
|
-
/**
|
|
3425
|
-
* Returns the origin of the URI of a NamedNode
|
|
3489
|
+
/**
|
|
3490
|
+
* Returns the origin of the URI of a NamedNode
|
|
3426
3491
|
*/
|
|
3427
3492
|
function tempSite(x) {
|
|
3428
3493
|
// use only while one in rdflib fails with origins 2019
|
|
@@ -3438,8 +3503,8 @@ function tempSite(x) {
|
|
|
3438
3503
|
}
|
|
3439
3504
|
}
|
|
3440
3505
|
|
|
3441
|
-
/**
|
|
3442
|
-
* Find an image for this thing as a class
|
|
3506
|
+
/**
|
|
3507
|
+
* Find an image for this thing as a class
|
|
3443
3508
|
*/
|
|
3444
3509
|
function findImageFromURI(x) {
|
|
3445
3510
|
var iconDir = buttons_iconBase;
|
|
@@ -3469,22 +3534,22 @@ function findImageFromURI(x) {
|
|
|
3469
3534
|
return iconDir + 'noun_10636_grey.svg'; // Grey Circle - some thing
|
|
3470
3535
|
}
|
|
3471
3536
|
|
|
3472
|
-
/**
|
|
3473
|
-
* Find something we have as explicit image data for the thing
|
|
3474
|
-
* See also [[imagesOf]]
|
|
3475
|
-
* @param thing The thing for which we want to find an image
|
|
3476
|
-
* @returns The URL of a globe icon if thing equals `ns.foaf('Agent')`
|
|
3477
|
-
* or `ns.rdf('Resource')`. Otherwise, it goes looking for
|
|
3478
|
-
* triples in `store`,
|
|
3479
|
-
* `(subject: thing), (predicate: see list below) (object: image-url)`
|
|
3480
|
-
* to find any image linked from the thing with one of the following
|
|
3481
|
-
* predicates (in order):
|
|
3482
|
-
* * ns.sioc('avatar')
|
|
3483
|
-
* * ns.foaf('img')
|
|
3484
|
-
* * ns.vcard('logo')
|
|
3485
|
-
* * ns.vcard('hasPhoto')
|
|
3486
|
-
* * ns.vcard('photo')
|
|
3487
|
-
* * ns.foaf('depiction')
|
|
3537
|
+
/**
|
|
3538
|
+
* Find something we have as explicit image data for the thing
|
|
3539
|
+
* See also [[imagesOf]]
|
|
3540
|
+
* @param thing The thing for which we want to find an image
|
|
3541
|
+
* @returns The URL of a globe icon if thing equals `ns.foaf('Agent')`
|
|
3542
|
+
* or `ns.rdf('Resource')`. Otherwise, it goes looking for
|
|
3543
|
+
* triples in `store`,
|
|
3544
|
+
* `(subject: thing), (predicate: see list below) (object: image-url)`
|
|
3545
|
+
* to find any image linked from the thing with one of the following
|
|
3546
|
+
* predicates (in order):
|
|
3547
|
+
* * ns.sioc('avatar')
|
|
3548
|
+
* * ns.foaf('img')
|
|
3549
|
+
* * ns.vcard('logo')
|
|
3550
|
+
* * ns.vcard('hasPhoto')
|
|
3551
|
+
* * ns.vcard('photo')
|
|
3552
|
+
* * ns.foaf('depiction')
|
|
3488
3553
|
*/
|
|
3489
3554
|
function findImage(thing) {
|
|
3490
3555
|
var kb = external_SolidLogic_.store;
|
|
@@ -3496,11 +3561,11 @@ function findImage(thing) {
|
|
|
3496
3561
|
return image ? image.uri : null;
|
|
3497
3562
|
}
|
|
3498
3563
|
|
|
3499
|
-
/**
|
|
3500
|
-
* Do the best you can with the data available
|
|
3501
|
-
*
|
|
3502
|
-
* @return {Boolean} Are we happy with this icon?
|
|
3503
|
-
* Sets src AND STYLE of the image.
|
|
3564
|
+
/**
|
|
3565
|
+
* Do the best you can with the data available
|
|
3566
|
+
*
|
|
3567
|
+
* @return {Boolean} Are we happy with this icon?
|
|
3568
|
+
* Sets src AND STYLE of the image.
|
|
3504
3569
|
*/
|
|
3505
3570
|
function trySetImage(element, thing, iconForClassMap) {
|
|
3506
3571
|
var kb = external_SolidLogic_.store;
|
|
@@ -3536,8 +3601,8 @@ function trySetImage(element, thing, iconForClassMap) {
|
|
|
3536
3601
|
return false; // we can do better
|
|
3537
3602
|
}
|
|
3538
3603
|
|
|
3539
|
-
/**
|
|
3540
|
-
* ToDo: Also add icons for *properties* like home, work, email, range, domain, comment,
|
|
3604
|
+
/**
|
|
3605
|
+
* ToDo: Also add icons for *properties* like home, work, email, range, domain, comment,
|
|
3541
3606
|
*/
|
|
3542
3607
|
function setImage(element, thing) {
|
|
3543
3608
|
// 20191230a
|
|
@@ -3586,7 +3651,7 @@ function faviconOrDefault(dom, x) {
|
|
|
3586
3651
|
}
|
|
3587
3652
|
}
|
|
3588
3653
|
|
|
3589
|
-
/* Two-option dialog pop-up
|
|
3654
|
+
/* Two-option dialog pop-up
|
|
3590
3655
|
*/
|
|
3591
3656
|
|
|
3592
3657
|
function renderDeleteConfirmPopup(dom, refererenceElement, prompt, deleteFunction) {
|
|
@@ -3637,9 +3702,9 @@ function renderDeleteConfirmPopup(dom, refererenceElement, prompt, deleteFunctio
|
|
|
3637
3702
|
cancelPrompt.addEventListener('click', removePopup);
|
|
3638
3703
|
return popup;
|
|
3639
3704
|
}
|
|
3640
|
-
/**
|
|
3641
|
-
* Delete button with a check you really mean it
|
|
3642
|
-
* @@ Supress check if command key held down?
|
|
3705
|
+
/**
|
|
3706
|
+
* Delete button with a check you really mean it
|
|
3707
|
+
* @@ Supress check if command key held down?
|
|
3643
3708
|
*/
|
|
3644
3709
|
function deleteButtonWithCheck(dom, container, noun, deleteFunction) {
|
|
3645
3710
|
function createPopup() {
|
|
@@ -3665,14 +3730,14 @@ function deleteButtonWithCheck(dom, container, noun, deleteFunction) {
|
|
|
3665
3730
|
return deleteButton; // or button div? caller may change size of image
|
|
3666
3731
|
}
|
|
3667
3732
|
|
|
3668
|
-
/* Make a button
|
|
3669
|
-
*
|
|
3670
|
-
* @param dom - the DOM document object
|
|
3671
|
-
* @Param iconURI - the URI of the icon to use (if any)
|
|
3672
|
-
* @param text - the tooltip text or possibly button contents text
|
|
3673
|
-
* @param handler <function> - A handler to called when button is clicked
|
|
3674
|
-
*
|
|
3675
|
-
* @returns <dDomElement> - the button
|
|
3733
|
+
/* Make a button
|
|
3734
|
+
*
|
|
3735
|
+
* @param dom - the DOM document object
|
|
3736
|
+
* @Param iconURI - the URI of the icon to use (if any)
|
|
3737
|
+
* @param text - the tooltip text or possibly button contents text
|
|
3738
|
+
* @param handler <function> - A handler to called when button is clicked
|
|
3739
|
+
*
|
|
3740
|
+
* @returns <dDomElement> - the button
|
|
3676
3741
|
*/
|
|
3677
3742
|
function buttons_button(dom, iconURI, text, handler) {
|
|
3678
3743
|
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
@@ -3685,7 +3750,7 @@ function buttons_button(dom, iconURI, text, handler) {
|
|
|
3685
3750
|
if (iconURI) {
|
|
3686
3751
|
var img = button.appendChild(dom.createElement('img'));
|
|
3687
3752
|
img.setAttribute('src', iconURI);
|
|
3688
|
-
img.setAttribute('style',
|
|
3753
|
+
img.setAttribute('style', 'width: 2em; height: 2em;'); // trial and error. 2em disappears
|
|
3689
3754
|
img.title = text;
|
|
3690
3755
|
button.setAttribute('style', style.buttonStyle);
|
|
3691
3756
|
} else {
|
|
@@ -3740,12 +3805,12 @@ function buttons_button(dom, iconURI, text, handler) {
|
|
|
3740
3805
|
return button;
|
|
3741
3806
|
}
|
|
3742
3807
|
|
|
3743
|
-
/* Make a cancel button
|
|
3744
|
-
*
|
|
3745
|
-
* @param dom - the DOM document object
|
|
3746
|
-
* @param handler <function> - A handler to called when button is clicked
|
|
3747
|
-
*
|
|
3748
|
-
* @returns <dDomElement> - the button
|
|
3808
|
+
/* Make a cancel button
|
|
3809
|
+
*
|
|
3810
|
+
* @param dom - the DOM document object
|
|
3811
|
+
* @param handler <function> - A handler to called when button is clicked
|
|
3812
|
+
*
|
|
3813
|
+
* @returns <dDomElement> - the button
|
|
3749
3814
|
*/
|
|
3750
3815
|
function buttons_cancelButton(dom, handler) {
|
|
3751
3816
|
var b = buttons_button(dom, cancelIconURI, 'Cancel', handler);
|
|
@@ -3756,22 +3821,22 @@ function buttons_cancelButton(dom, handler) {
|
|
|
3756
3821
|
return b;
|
|
3757
3822
|
}
|
|
3758
3823
|
|
|
3759
|
-
/* Make a continue button
|
|
3760
|
-
*
|
|
3761
|
-
* @param dom - the DOM document object
|
|
3762
|
-
* @param handler <function> - A handler to called when button is clicked
|
|
3763
|
-
*
|
|
3764
|
-
* @returns <dDomElement> - the button
|
|
3824
|
+
/* Make a continue button
|
|
3825
|
+
*
|
|
3826
|
+
* @param dom - the DOM document object
|
|
3827
|
+
* @param handler <function> - A handler to called when button is clicked
|
|
3828
|
+
*
|
|
3829
|
+
* @returns <dDomElement> - the button
|
|
3765
3830
|
*/
|
|
3766
3831
|
function continueButton(dom, handler) {
|
|
3767
3832
|
return buttons_button(dom, checkIconURI, 'Continue', handler);
|
|
3768
3833
|
}
|
|
3769
3834
|
|
|
3770
|
-
/* Grab a name for a new thing
|
|
3771
|
-
*
|
|
3772
|
-
* Form to get the name of a new thing before we create it
|
|
3773
|
-
* @params theClass Misspelt to avoid clashing with the JavaScript keyword
|
|
3774
|
-
* @returns: a promise of (a name or null if cancelled)
|
|
3835
|
+
/* Grab a name for a new thing
|
|
3836
|
+
*
|
|
3837
|
+
* Form to get the name of a new thing before we create it
|
|
3838
|
+
* @params theClass Misspelt to avoid clashing with the JavaScript keyword
|
|
3839
|
+
* @returns: a promise of (a name or null if cancelled)
|
|
3775
3840
|
*/
|
|
3776
3841
|
function askName(dom, kb, container, predicate, theClass, noun) {
|
|
3777
3842
|
return new Promise(function (resolve, _reject) {
|
|
@@ -3813,10 +3878,10 @@ function askName(dom, kb, container, predicate, theClass, noun) {
|
|
|
3813
3878
|
}); // Promise
|
|
3814
3879
|
}
|
|
3815
3880
|
|
|
3816
|
-
/**
|
|
3817
|
-
* A TR to represent a draggable person, etc in a list
|
|
3818
|
-
*
|
|
3819
|
-
* pred is unused param at the moment
|
|
3881
|
+
/**
|
|
3882
|
+
* A TR to represent a draggable person, etc in a list
|
|
3883
|
+
*
|
|
3884
|
+
* pred is unused param at the moment
|
|
3820
3885
|
*/
|
|
3821
3886
|
var personTR = renderAsRow; // The legacy name is used in a lot of places
|
|
3822
3887
|
|
|
@@ -3830,9 +3895,9 @@ function renderAsRow(dom, pred, obj, options) {
|
|
|
3830
3895
|
|
|
3831
3896
|
// const image = td1.appendChild(dom.createElement('img'))
|
|
3832
3897
|
var image = options.image || faviconOrDefault(dom, obj);
|
|
3833
|
-
td1.setAttribute('style', 'vertical-align: middle; width:
|
|
3898
|
+
td1.setAttribute('style', 'vertical-align: middle; width:2.5em; padding:0.5em; height: 2.5em;');
|
|
3834
3899
|
td2.setAttribute('style', 'vertical-align: middle; text-align:left;');
|
|
3835
|
-
td3.setAttribute('style', 'vertical-align: middle; width:
|
|
3900
|
+
td3.setAttribute('style', 'vertical-align: middle; width:2em; padding:0.5em; height: 4em;');
|
|
3836
3901
|
td1.appendChild(image);
|
|
3837
3902
|
if (options.title) {
|
|
3838
3903
|
td2.textContent = options.title;
|
|
@@ -3860,11 +3925,11 @@ function renderAsRow(dom, pred, obj, options) {
|
|
|
3860
3925
|
return tr;
|
|
3861
3926
|
}
|
|
3862
3927
|
|
|
3863
|
-
/* A helper function for renderAsDiv
|
|
3864
|
-
* creates the NameDiv for the person
|
|
3865
|
-
* Note: could not move it to the helper file because they call exported functions
|
|
3866
|
-
* from buttons
|
|
3867
|
-
* @internal exporting this only for unit tests
|
|
3928
|
+
/* A helper function for renderAsDiv
|
|
3929
|
+
* creates the NameDiv for the person
|
|
3930
|
+
* Note: could not move it to the helper file because they call exported functions
|
|
3931
|
+
* from buttons
|
|
3932
|
+
* @internal exporting this only for unit tests
|
|
3868
3933
|
*/
|
|
3869
3934
|
function createNameDiv(dom, div, title, obj) {
|
|
3870
3935
|
var nameDiv = div.appendChild(dom.createElement('div'));
|
|
@@ -3874,11 +3939,11 @@ function createNameDiv(dom, div, title, obj) {
|
|
|
3874
3939
|
setName(nameDiv, obj); // This is async
|
|
3875
3940
|
}
|
|
3876
3941
|
}
|
|
3877
|
-
/* A helper function for renderAsDiv
|
|
3878
|
-
* creates the linkDiv for the person
|
|
3879
|
-
* Note: could not move it to the helper file because they call exported functions
|
|
3880
|
-
* from buttons
|
|
3881
|
-
* @internal exporting this only for unit tests
|
|
3942
|
+
/* A helper function for renderAsDiv
|
|
3943
|
+
* creates the linkDiv for the person
|
|
3944
|
+
* Note: could not move it to the helper file because they call exported functions
|
|
3945
|
+
* from buttons
|
|
3946
|
+
* @internal exporting this only for unit tests
|
|
3882
3947
|
*/
|
|
3883
3948
|
function createLinkDiv(dom, div, obj, options) {
|
|
3884
3949
|
var linkDiv = div.appendChild(dom.createElement('div'));
|
|
@@ -3894,9 +3959,9 @@ function createLinkDiv(dom, div, obj, options) {
|
|
|
3894
3959
|
makeDraggable(div, obj);
|
|
3895
3960
|
}
|
|
3896
3961
|
}
|
|
3897
|
-
/**
|
|
3898
|
-
* A Div to represent a draggable person, etc in a list
|
|
3899
|
-
* configurable to add an onClick listener
|
|
3962
|
+
/**
|
|
3963
|
+
* A Div to represent a draggable person, etc in a list
|
|
3964
|
+
* configurable to add an onClick listener
|
|
3900
3965
|
*/
|
|
3901
3966
|
function renderAsDiv(dom, obj, options) {
|
|
3902
3967
|
var div = dom.createElement('div');
|
|
@@ -3918,8 +3983,8 @@ function renderAsDiv(dom, obj, options) {
|
|
|
3918
3983
|
return div;
|
|
3919
3984
|
}
|
|
3920
3985
|
|
|
3921
|
-
/**
|
|
3922
|
-
* Refresh a DOM tree recursively
|
|
3986
|
+
/**
|
|
3987
|
+
* Refresh a DOM tree recursively
|
|
3923
3988
|
*/
|
|
3924
3989
|
function refreshTree(root) {
|
|
3925
3990
|
if (root.refresh) {
|
|
@@ -3931,15 +3996,15 @@ function refreshTree(root) {
|
|
|
3931
3996
|
}
|
|
3932
3997
|
}
|
|
3933
3998
|
|
|
3934
|
-
/**
|
|
3935
|
-
* Options argument for [[attachmentList]] function
|
|
3999
|
+
/**
|
|
4000
|
+
* Options argument for [[attachmentList]] function
|
|
3936
4001
|
*/
|
|
3937
4002
|
|
|
3938
|
-
/**
|
|
3939
|
-
* Component that displays a list of resources, for instance
|
|
3940
|
-
* the attachments of a message, or the various documents related
|
|
3941
|
-
* to a meeting.
|
|
3942
|
-
* Accepts dropping URLs onto it to add attachments to it.
|
|
4003
|
+
/**
|
|
4004
|
+
* Component that displays a list of resources, for instance
|
|
4005
|
+
* the attachments of a message, or the various documents related
|
|
4006
|
+
* to a meeting.
|
|
4007
|
+
* Accepts dropping URLs onto it to add attachments to it.
|
|
3943
4008
|
*/
|
|
3944
4009
|
function attachmentList(dom, subject, div) {
|
|
3945
4010
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
@@ -4052,11 +4117,11 @@ function attachmentList(dom, subject, div) {
|
|
|
4052
4117
|
|
|
4053
4118
|
// /////////////////////////////////////////////////////////////////////////////
|
|
4054
4119
|
|
|
4055
|
-
/**
|
|
4056
|
-
* Event Handler for links within solid apps.
|
|
4057
|
-
*
|
|
4058
|
-
* Note that native links have constraints in Firefox, they
|
|
4059
|
-
* don't work with local files for instance (2011)
|
|
4120
|
+
/**
|
|
4121
|
+
* Event Handler for links within solid apps.
|
|
4122
|
+
*
|
|
4123
|
+
* Note that native links have constraints in Firefox, they
|
|
4124
|
+
* don't work with local files for instance (2011)
|
|
4060
4125
|
*/
|
|
4061
4126
|
function openHrefInOutlineMode(e) {
|
|
4062
4127
|
e.preventDefault();
|
|
@@ -4080,10 +4145,10 @@ function openHrefInOutlineMode(e) {
|
|
|
4080
4145
|
// dom.outlineManager.GotoSubject(store.sym(uri), true, undefined, true, undefined)
|
|
4081
4146
|
}
|
|
4082
4147
|
|
|
4083
|
-
/**
|
|
4084
|
-
* Make a URI in the Tabulator.org annotation store out of the URI of the thing to be annotated.
|
|
4085
|
-
*
|
|
4086
|
-
* @@ Todo: make it a personal preference.
|
|
4148
|
+
/**
|
|
4149
|
+
* Make a URI in the Tabulator.org annotation store out of the URI of the thing to be annotated.
|
|
4150
|
+
*
|
|
4151
|
+
* @@ Todo: make it a personal preference.
|
|
4087
4152
|
*/
|
|
4088
4153
|
function defaultAnnotationStore(subject) {
|
|
4089
4154
|
if (subject.uri === undefined) return undefined;
|
|
@@ -4101,10 +4166,10 @@ function defaultAnnotationStore(subject) {
|
|
|
4101
4166
|
return external_SolidLogic_.store.sym('http://tabulator.org/wiki/annnotation/' + s);
|
|
4102
4167
|
}
|
|
4103
4168
|
|
|
4104
|
-
/**
|
|
4105
|
-
* Retrieve all RDF class URIs from solid-ui's RDF store
|
|
4106
|
-
* @returns an object `ret` such that `Object.keys(ret)` is
|
|
4107
|
-
* the list of all class URIs.
|
|
4169
|
+
/**
|
|
4170
|
+
* Retrieve all RDF class URIs from solid-ui's RDF store
|
|
4171
|
+
* @returns an object `ret` such that `Object.keys(ret)` is
|
|
4172
|
+
* the list of all class URIs.
|
|
4108
4173
|
*/
|
|
4109
4174
|
function allClassURIs() {
|
|
4110
4175
|
var set = {};
|
|
@@ -4121,16 +4186,16 @@ function allClassURIs() {
|
|
|
4121
4186
|
return set;
|
|
4122
4187
|
}
|
|
4123
4188
|
|
|
4124
|
-
/**
|
|
4125
|
-
* Figuring which properties we know about
|
|
4126
|
-
*
|
|
4127
|
-
* When the user inputs an RDF property, like for a form field
|
|
4128
|
-
* or when specifying the relationship between two arbitrary things,
|
|
4129
|
-
* then er can prompt them with properties the session knows about
|
|
4130
|
-
*
|
|
4131
|
-
* TODO: Look again by catching this somewhere. (On the kb?)
|
|
4132
|
-
* TODO: move to diff module? Not really a button.
|
|
4133
|
-
* @param {Store} kb The quadstore to be searched.
|
|
4189
|
+
/**
|
|
4190
|
+
* Figuring which properties we know about
|
|
4191
|
+
*
|
|
4192
|
+
* When the user inputs an RDF property, like for a form field
|
|
4193
|
+
* or when specifying the relationship between two arbitrary things,
|
|
4194
|
+
* then er can prompt them with properties the session knows about
|
|
4195
|
+
*
|
|
4196
|
+
* TODO: Look again by catching this somewhere. (On the kb?)
|
|
4197
|
+
* TODO: move to diff module? Not really a button.
|
|
4198
|
+
* @param {Store} kb The quadstore to be searched.
|
|
4134
4199
|
*/
|
|
4135
4200
|
|
|
4136
4201
|
function propertyTriage(kb) {
|
|
@@ -4168,12 +4233,12 @@ function propertyTriage(kb) {
|
|
|
4168
4233
|
return possibleProperties;
|
|
4169
4234
|
}
|
|
4170
4235
|
|
|
4171
|
-
/**
|
|
4172
|
-
* General purpose widgets
|
|
4236
|
+
/**
|
|
4237
|
+
* General purpose widgets
|
|
4173
4238
|
*/
|
|
4174
4239
|
|
|
4175
|
-
/**
|
|
4176
|
-
* A button for jumping
|
|
4240
|
+
/**
|
|
4241
|
+
* A button for jumping
|
|
4177
4242
|
*/
|
|
4178
4243
|
function linkButton(dom, object) {
|
|
4179
4244
|
var b = dom.createElement('button');
|
|
@@ -4188,8 +4253,8 @@ function linkButton(dom, object) {
|
|
|
4188
4253
|
return b;
|
|
4189
4254
|
}
|
|
4190
4255
|
|
|
4191
|
-
/**
|
|
4192
|
-
* A button to remove some other element from the page
|
|
4256
|
+
/**
|
|
4257
|
+
* A button to remove some other element from the page
|
|
4193
4258
|
*/
|
|
4194
4259
|
function removeButton(dom, element) {
|
|
4195
4260
|
var b = dom.createElement('button');
|
|
@@ -4219,17 +4284,17 @@ function removeButton(dom, element) {
|
|
|
4219
4284
|
//
|
|
4220
4285
|
// These are for selecting different modes, sources,styles, etc.
|
|
4221
4286
|
//
|
|
4222
|
-
/*
|
|
4223
|
-
buttons.headerButtons = function (dom, kb, name, words) {
|
|
4224
|
-
const box = dom.createElement('table')
|
|
4225
|
-
var i, word, s = '<tr>'
|
|
4226
|
-
box.setAttribute('style', 'width: 90%; height: 1.5em')
|
|
4227
|
-
for (i=0; i<words.length; i++) {
|
|
4228
|
-
s += '<td><input type="radio" name="' + name + '" id="' + words[i] + '" value='
|
|
4229
|
-
}
|
|
4230
|
-
box.innerHTML = s + '</tr>'
|
|
4231
|
-
|
|
4232
|
-
}
|
|
4287
|
+
/*
|
|
4288
|
+
buttons.headerButtons = function (dom, kb, name, words) {
|
|
4289
|
+
const box = dom.createElement('table')
|
|
4290
|
+
var i, word, s = '<tr>'
|
|
4291
|
+
box.setAttribute('style', 'width: 90%; height: 1.5em')
|
|
4292
|
+
for (i=0; i<words.length; i++) {
|
|
4293
|
+
s += '<td><input type="radio" name="' + name + '" id="' + words[i] + '" value='
|
|
4294
|
+
}
|
|
4295
|
+
box.innerHTML = s + '</tr>'
|
|
4296
|
+
|
|
4297
|
+
}
|
|
4233
4298
|
*/
|
|
4234
4299
|
// ////////////////////////////////////////////////////////////
|
|
4235
4300
|
//
|
|
@@ -4319,9 +4384,9 @@ function twoLineDefault(dom, x) {
|
|
|
4319
4384
|
return box;
|
|
4320
4385
|
}
|
|
4321
4386
|
|
|
4322
|
-
/**
|
|
4323
|
-
* Find a function that can create a widget for a given class
|
|
4324
|
-
* @param c The RDF class for which we want a widget generator function
|
|
4387
|
+
/**
|
|
4388
|
+
* Find a function that can create a widget for a given class
|
|
4389
|
+
* @param c The RDF class for which we want a widget generator function
|
|
4325
4390
|
*/
|
|
4326
4391
|
function twoLineWidgetForClass(c) {
|
|
4327
4392
|
var widget = index.twoLine[c.uri];
|
|
@@ -4335,12 +4400,12 @@ function twoLineWidgetForClass(c) {
|
|
|
4335
4400
|
return index.twoLine[''];
|
|
4336
4401
|
}
|
|
4337
4402
|
|
|
4338
|
-
/**
|
|
4339
|
-
* Display a transaction
|
|
4340
|
-
* @param x Should have attributes through triples in store:
|
|
4341
|
-
* * ns.qu('payee') -> a named node
|
|
4342
|
-
* * ns.qu('date) -> a literal
|
|
4343
|
-
* * ns.qu('amount') -> a literal
|
|
4403
|
+
/**
|
|
4404
|
+
* Display a transaction
|
|
4405
|
+
* @param x Should have attributes through triples in store:
|
|
4406
|
+
* * ns.qu('payee') -> a named node
|
|
4407
|
+
* * ns.qu('date) -> a literal
|
|
4408
|
+
* * ns.qu('amount') -> a literal
|
|
4344
4409
|
*/
|
|
4345
4410
|
function twoLineTransaction(dom, x) {
|
|
4346
4411
|
var failed = '';
|
|
@@ -4357,12 +4422,12 @@ function twoLineTransaction(dom, x) {
|
|
|
4357
4422
|
return box;
|
|
4358
4423
|
}
|
|
4359
4424
|
|
|
4360
|
-
/**
|
|
4361
|
-
* Display a trip
|
|
4362
|
-
* @param x Should have attributes through triples in store:
|
|
4363
|
-
* * ns.dc('title') -> a literal
|
|
4364
|
-
* * ns.cal('dtstart') -> a literal
|
|
4365
|
-
* * ns.cal('dtend') -> a literal
|
|
4425
|
+
/**
|
|
4426
|
+
* Display a trip
|
|
4427
|
+
* @param x Should have attributes through triples in store:
|
|
4428
|
+
* * ns.dc('title') -> a literal
|
|
4429
|
+
* * ns.cal('dtstart') -> a literal
|
|
4430
|
+
* * ns.cal('dtend') -> a literal
|
|
4366
4431
|
*/
|
|
4367
4432
|
function twoLineTrip(dom, x) {
|
|
4368
4433
|
var enc = function enc(p) {
|
|
@@ -4374,8 +4439,8 @@ function twoLineTrip(dom, x) {
|
|
|
4374
4439
|
return box;
|
|
4375
4440
|
}
|
|
4376
4441
|
|
|
4377
|
-
/**
|
|
4378
|
-
* Stick a stylesheet link the document if not already there
|
|
4442
|
+
/**
|
|
4443
|
+
* Stick a stylesheet link the document if not already there
|
|
4379
4444
|
*/
|
|
4380
4445
|
function addStyleSheet(dom, href) {
|
|
4381
4446
|
var links = dom.querySelectorAll('link');
|
|
@@ -4399,8 +4464,8 @@ function isAudio(file) {
|
|
|
4399
4464
|
function isVideo(file) {
|
|
4400
4465
|
return isImage(file, 'video');
|
|
4401
4466
|
}
|
|
4402
|
-
/**
|
|
4403
|
-
*
|
|
4467
|
+
/**
|
|
4468
|
+
*
|
|
4404
4469
|
*/
|
|
4405
4470
|
function isImage(file, kind) {
|
|
4406
4471
|
var dcCLasses = {
|
|
@@ -4422,12 +4487,12 @@ function isImage(file, kind) {
|
|
|
4422
4487
|
return false;
|
|
4423
4488
|
}
|
|
4424
4489
|
|
|
4425
|
-
/**
|
|
4426
|
-
* File upload button
|
|
4427
|
-
* @param dom The DOM aka document
|
|
4428
|
-
* @param droppedFileHandler Same handler function as drop, takes array of file objects
|
|
4429
|
-
* @returns {Element} - a div with a button and a inout in it
|
|
4430
|
-
* The input is hidden, as it is uglky - the user clicks on the nice icons and fires the input.
|
|
4490
|
+
/**
|
|
4491
|
+
* File upload button
|
|
4492
|
+
* @param dom The DOM aka document
|
|
4493
|
+
* @param droppedFileHandler Same handler function as drop, takes array of file objects
|
|
4494
|
+
* @returns {Element} - a div with a button and a inout in it
|
|
4495
|
+
* The input is hidden, as it is uglky - the user clicks on the nice icons and fires the input.
|
|
4431
4496
|
*/
|
|
4432
4497
|
// See https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications
|
|
4433
4498
|
function fileUploadButtonDiv(dom, droppedFileHandler) {
|
|
@@ -4463,6 +4528,17 @@ index = {
|
|
|
4463
4528
|
widgetForClass: twoLineWidgetForClass
|
|
4464
4529
|
}
|
|
4465
4530
|
};
|
|
4531
|
+
;// ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
4532
|
+
|
|
4533
|
+
function _defineProperty(e, r, t) {
|
|
4534
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
4535
|
+
value: t,
|
|
4536
|
+
enumerable: !0,
|
|
4537
|
+
configurable: !0,
|
|
4538
|
+
writable: !0
|
|
4539
|
+
}) : e[r] = t, e;
|
|
4540
|
+
}
|
|
4541
|
+
|
|
4466
4542
|
;// ./src/signup/config-default.js
|
|
4467
4543
|
/**
|
|
4468
4544
|
* Provides a simple configuration object for Solid web client and other
|
|
@@ -12828,11 +12904,11 @@ function _taggedTemplateLiteral(e, t) {
|
|
|
12828
12904
|
// EXTERNAL MODULE: ./node_modules/escape-html/index.js
|
|
12829
12905
|
var escape_html = __webpack_require__(580);
|
|
12830
12906
|
var escape_html_default = /*#__PURE__*/__webpack_require__.n(escape_html);
|
|
12831
|
-
;// ./node_modules/uuid/dist/
|
|
12907
|
+
;// ./node_modules/uuid/dist/native.js
|
|
12832
12908
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
12833
|
-
/* harmony default export */ const
|
|
12909
|
+
/* harmony default export */ const dist_native = ({ randomUUID });
|
|
12834
12910
|
|
|
12835
|
-
;// ./node_modules/uuid/dist/
|
|
12911
|
+
;// ./node_modules/uuid/dist/rng.js
|
|
12836
12912
|
let getRandomValues;
|
|
12837
12913
|
const rnds8 = new Uint8Array(16);
|
|
12838
12914
|
function rng() {
|
|
@@ -12845,7 +12921,7 @@ function rng() {
|
|
|
12845
12921
|
return getRandomValues(rnds8);
|
|
12846
12922
|
}
|
|
12847
12923
|
|
|
12848
|
-
;// ./node_modules/uuid/dist/
|
|
12924
|
+
;// ./node_modules/uuid/dist/stringify.js
|
|
12849
12925
|
|
|
12850
12926
|
const byteToHex = [];
|
|
12851
12927
|
for (let i = 0; i < 256; ++i) {
|
|
@@ -12880,16 +12956,13 @@ function stringify(arr, offset = 0) {
|
|
|
12880
12956
|
}
|
|
12881
12957
|
return uuid;
|
|
12882
12958
|
}
|
|
12883
|
-
/* harmony default export */ const
|
|
12959
|
+
/* harmony default export */ const dist_stringify = ((/* unused pure expression or super */ null && (stringify)));
|
|
12884
12960
|
|
|
12885
|
-
;// ./node_modules/uuid/dist/
|
|
12961
|
+
;// ./node_modules/uuid/dist/v4.js
|
|
12886
12962
|
|
|
12887
12963
|
|
|
12888
12964
|
|
|
12889
|
-
function
|
|
12890
|
-
if (esm_browser_native.randomUUID && !buf && !options) {
|
|
12891
|
-
return esm_browser_native.randomUUID();
|
|
12892
|
-
}
|
|
12965
|
+
function _v4(options, buf, offset) {
|
|
12893
12966
|
options = options || {};
|
|
12894
12967
|
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
12895
12968
|
if (rnds.length < 16) {
|
|
@@ -12909,7 +12982,13 @@ function v4(options, buf, offset) {
|
|
|
12909
12982
|
}
|
|
12910
12983
|
return unsafeStringify(rnds);
|
|
12911
12984
|
}
|
|
12912
|
-
|
|
12985
|
+
function v4(options, buf, offset) {
|
|
12986
|
+
if (dist_native.randomUUID && !buf && !options) {
|
|
12987
|
+
return dist_native.randomUUID();
|
|
12988
|
+
}
|
|
12989
|
+
return _v4(options, buf, offset);
|
|
12990
|
+
}
|
|
12991
|
+
/* harmony default export */ const dist_v4 = (v4);
|
|
12913
12992
|
|
|
12914
12993
|
;// ./src/widgets/peoplePicker.js
|
|
12915
12994
|
|
|
@@ -13033,7 +13112,7 @@ var PeoplePicker = /*#__PURE__*/function () {
|
|
|
13033
13112
|
var _indexes = indexes(book),
|
|
13034
13113
|
groupIndex = _indexes.groupIndex,
|
|
13035
13114
|
groupContainer = _indexes.groupContainer;
|
|
13036
|
-
var group = external_$rdf_.sym("".concat(groupContainer.uri).concat(
|
|
13115
|
+
var group = external_$rdf_.sym("".concat(groupContainer.uri).concat(dist_v4().slice(0, 8), ".ttl#this"));
|
|
13037
13116
|
var name = defaultNewGroupName || 'Untitled Group';
|
|
13038
13117
|
|
|
13039
13118
|
// NOTE that order matters here. Unfortunately this type of update is
|
|
@@ -14047,44 +14126,42 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
14047
14126
|
}() // firstleafObject
|
|
14048
14127
|
}]);
|
|
14049
14128
|
}(); // class
|
|
14050
|
-
;// ./node_modules/@noble/hashes/
|
|
14051
|
-
const crypto_crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
|
14052
|
-
//# sourceMappingURL=crypto.js.map
|
|
14053
|
-
;// ./node_modules/@noble/hashes/esm/utils.js
|
|
14129
|
+
;// ./node_modules/@noble/hashes/utils.js
|
|
14054
14130
|
/**
|
|
14055
14131
|
* Utilities for hex, bytes, CSPRNG.
|
|
14056
14132
|
* @module
|
|
14057
14133
|
*/
|
|
14058
14134
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
14059
|
-
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
|
14060
|
-
// node.js versions earlier than v19 don't declare it in global scope.
|
|
14061
|
-
// For node.js, package.json#exports field mapping rewrites import
|
|
14062
|
-
// from `crypto` to `cryptoNode`, which imports native module.
|
|
14063
|
-
// Makes the utils un-importable in browsers without a bundler.
|
|
14064
|
-
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
|
|
14065
|
-
|
|
14066
14135
|
/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
|
|
14067
|
-
function
|
|
14136
|
+
function utils_isBytes(a) {
|
|
14068
14137
|
return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
|
|
14069
14138
|
}
|
|
14070
14139
|
/** Asserts something is positive integer. */
|
|
14071
|
-
function
|
|
14072
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
|
14073
|
-
|
|
14140
|
+
function utils_anumber(n, title = '') {
|
|
14141
|
+
if (!Number.isSafeInteger(n) || n < 0) {
|
|
14142
|
+
const prefix = title && `"${title}" `;
|
|
14143
|
+
throw new Error(`${prefix}expected integer >= 0, got ${n}`);
|
|
14144
|
+
}
|
|
14074
14145
|
}
|
|
14075
14146
|
/** Asserts something is Uint8Array. */
|
|
14076
|
-
function
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14147
|
+
function utils_abytes(value, length, title = '') {
|
|
14148
|
+
const bytes = utils_isBytes(value);
|
|
14149
|
+
const len = value?.length;
|
|
14150
|
+
const needsLen = length !== undefined;
|
|
14151
|
+
if (!bytes || (needsLen && len !== length)) {
|
|
14152
|
+
const prefix = title && `"${title}" `;
|
|
14153
|
+
const ofLen = needsLen ? ` of length ${length}` : '';
|
|
14154
|
+
const got = bytes ? `length=${len}` : `type=${typeof value}`;
|
|
14155
|
+
throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);
|
|
14156
|
+
}
|
|
14157
|
+
return value;
|
|
14081
14158
|
}
|
|
14082
14159
|
/** Asserts something is hash */
|
|
14083
|
-
function
|
|
14160
|
+
function utils_ahash(h) {
|
|
14084
14161
|
if (typeof h !== 'function' || typeof h.create !== 'function')
|
|
14085
|
-
throw new Error('Hash
|
|
14086
|
-
|
|
14087
|
-
|
|
14162
|
+
throw new Error('Hash must wrapped by utils.createHasher');
|
|
14163
|
+
utils_anumber(h.outputLen);
|
|
14164
|
+
utils_anumber(h.blockLen);
|
|
14088
14165
|
}
|
|
14089
14166
|
/** Asserts a hash instance has not been destroyed / finished */
|
|
14090
14167
|
function aexists(instance, checkFinished = true) {
|
|
@@ -14095,10 +14172,10 @@ function aexists(instance, checkFinished = true) {
|
|
|
14095
14172
|
}
|
|
14096
14173
|
/** Asserts output is properly-sized byte array */
|
|
14097
14174
|
function aoutput(out, instance) {
|
|
14098
|
-
|
|
14175
|
+
utils_abytes(out, undefined, 'digestInto() output');
|
|
14099
14176
|
const min = instance.outputLen;
|
|
14100
14177
|
if (out.length < min) {
|
|
14101
|
-
throw new Error('digestInto()
|
|
14178
|
+
throw new Error('"digestInto() output" expected to be of length >=' + min);
|
|
14102
14179
|
}
|
|
14103
14180
|
}
|
|
14104
14181
|
/** Cast u8 / u16 / u32 to u8. */
|
|
@@ -14140,8 +14217,6 @@ function byteSwap(word) {
|
|
|
14140
14217
|
const swap8IfBE = (/* unused pure expression or super */ null && (isLE
|
|
14141
14218
|
? (n) => n
|
|
14142
14219
|
: (n) => byteSwap(n)));
|
|
14143
|
-
/** @deprecated */
|
|
14144
|
-
const byteSwapIfBE = (/* unused pure expression or super */ null && (swap8IfBE));
|
|
14145
14220
|
/** In place byte swap for Uint32Array */
|
|
14146
14221
|
function byteSwap32(arr) {
|
|
14147
14222
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -14162,8 +14237,8 @@ const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(1
|
|
|
14162
14237
|
* Convert byte array to hex string. Uses built-in function, when available.
|
|
14163
14238
|
* @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
|
|
14164
14239
|
*/
|
|
14165
|
-
function
|
|
14166
|
-
|
|
14240
|
+
function utils_bytesToHex(bytes) {
|
|
14241
|
+
utils_abytes(bytes);
|
|
14167
14242
|
// @ts-ignore
|
|
14168
14243
|
if (hasHexBuiltin)
|
|
14169
14244
|
return bytes.toHex();
|
|
@@ -14189,7 +14264,7 @@ function asciiToBase16(ch) {
|
|
|
14189
14264
|
* Convert hex string to byte array. Uses built-in function, when available.
|
|
14190
14265
|
* @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
|
|
14191
14266
|
*/
|
|
14192
|
-
function
|
|
14267
|
+
function utils_hexToBytes(hex) {
|
|
14193
14268
|
if (typeof hex !== 'string')
|
|
14194
14269
|
throw new Error('hex string expected, got ' + typeof hex);
|
|
14195
14270
|
// @ts-ignore
|
|
@@ -14232,6 +14307,7 @@ async function asyncLoop(iters, tick, cb) {
|
|
|
14232
14307
|
}
|
|
14233
14308
|
/**
|
|
14234
14309
|
* Converts string to bytes using UTF8 encoding.
|
|
14310
|
+
* Built-in doesn't validate input to be string: we do the check.
|
|
14235
14311
|
* @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
|
|
14236
14312
|
*/
|
|
14237
14313
|
function utf8ToBytes(str) {
|
|
@@ -14239,40 +14315,21 @@ function utf8ToBytes(str) {
|
|
|
14239
14315
|
throw new Error('string expected');
|
|
14240
14316
|
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
14241
14317
|
}
|
|
14242
|
-
/**
|
|
14243
|
-
* Converts bytes to string using UTF8 encoding.
|
|
14244
|
-
* @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'
|
|
14245
|
-
*/
|
|
14246
|
-
function bytesToUtf8(bytes) {
|
|
14247
|
-
return new TextDecoder().decode(bytes);
|
|
14248
|
-
}
|
|
14249
|
-
/**
|
|
14250
|
-
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
|
14251
|
-
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
14252
|
-
* Keep in mind for future mutable operations.
|
|
14253
|
-
*/
|
|
14254
|
-
function toBytes(data) {
|
|
14255
|
-
if (typeof data === 'string')
|
|
14256
|
-
data = utf8ToBytes(data);
|
|
14257
|
-
abytes(data);
|
|
14258
|
-
return data;
|
|
14259
|
-
}
|
|
14260
14318
|
/**
|
|
14261
14319
|
* Helper for KDFs: consumes uint8array or string.
|
|
14262
14320
|
* When string is passed, does utf8 decoding, using TextDecoder.
|
|
14263
14321
|
*/
|
|
14264
|
-
function kdfInputToBytes(data) {
|
|
14322
|
+
function kdfInputToBytes(data, errorTitle = '') {
|
|
14265
14323
|
if (typeof data === 'string')
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
return data;
|
|
14324
|
+
return utf8ToBytes(data);
|
|
14325
|
+
return utils_abytes(data, undefined, errorTitle);
|
|
14269
14326
|
}
|
|
14270
14327
|
/** Copies several Uint8Arrays into one. */
|
|
14271
|
-
function
|
|
14328
|
+
function utils_concatBytes(...arrays) {
|
|
14272
14329
|
let sum = 0;
|
|
14273
14330
|
for (let i = 0; i < arrays.length; i++) {
|
|
14274
14331
|
const a = arrays[i];
|
|
14275
|
-
|
|
14332
|
+
utils_abytes(a);
|
|
14276
14333
|
sum += a.length;
|
|
14277
14334
|
}
|
|
14278
14335
|
const res = new Uint8Array(sum);
|
|
@@ -14283,74 +14340,41 @@ function concatBytes(...arrays) {
|
|
|
14283
14340
|
}
|
|
14284
14341
|
return res;
|
|
14285
14342
|
}
|
|
14343
|
+
/** Merges default options and passed options. */
|
|
14286
14344
|
function checkOpts(defaults, opts) {
|
|
14287
14345
|
if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')
|
|
14288
|
-
throw new Error('options
|
|
14346
|
+
throw new Error('options must be object or undefined');
|
|
14289
14347
|
const merged = Object.assign(defaults, opts);
|
|
14290
14348
|
return merged;
|
|
14291
14349
|
}
|
|
14292
|
-
/**
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
14296
|
-
function utils_createHasher(hashCons) {
|
|
14297
|
-
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
14298
|
-
const tmp = hashCons();
|
|
14299
|
-
hashC.outputLen = tmp.outputLen;
|
|
14300
|
-
hashC.blockLen = tmp.blockLen;
|
|
14301
|
-
hashC.create = () => hashCons();
|
|
14302
|
-
return hashC;
|
|
14303
|
-
}
|
|
14304
|
-
function createOptHasher(hashCons) {
|
|
14305
|
-
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
14306
|
-
const tmp = hashCons({});
|
|
14307
|
-
hashC.outputLen = tmp.outputLen;
|
|
14308
|
-
hashC.blockLen = tmp.blockLen;
|
|
14309
|
-
hashC.create = (opts) => hashCons(opts);
|
|
14310
|
-
return hashC;
|
|
14311
|
-
}
|
|
14312
|
-
function createXOFer(hashCons) {
|
|
14313
|
-
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
14314
|
-
const tmp = hashCons({});
|
|
14350
|
+
/** Creates function with outputLen, blockLen, create properties from a class constructor. */
|
|
14351
|
+
function utils_createHasher(hashCons, info = {}) {
|
|
14352
|
+
const hashC = (msg, opts) => hashCons(opts).update(msg).digest();
|
|
14353
|
+
const tmp = hashCons(undefined);
|
|
14315
14354
|
hashC.outputLen = tmp.outputLen;
|
|
14316
14355
|
hashC.blockLen = tmp.blockLen;
|
|
14317
14356
|
hashC.create = (opts) => hashCons(opts);
|
|
14318
|
-
|
|
14357
|
+
Object.assign(hashC, info);
|
|
14358
|
+
return Object.freeze(hashC);
|
|
14319
14359
|
}
|
|
14320
|
-
const wrapConstructor = (/* unused pure expression or super */ null && (utils_createHasher));
|
|
14321
|
-
const wrapConstructorWithOpts = (/* unused pure expression or super */ null && (createOptHasher));
|
|
14322
|
-
const wrapXOFConstructorWithOpts = (/* unused pure expression or super */ null && (createXOFer));
|
|
14323
14360
|
/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
|
|
14324
|
-
function
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
14328
|
-
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
}
|
|
14361
|
+
function randomBytes(bytesLength = 32) {
|
|
14362
|
+
const cr = typeof globalThis === 'object' ? globalThis.crypto : null;
|
|
14363
|
+
if (typeof cr?.getRandomValues !== 'function')
|
|
14364
|
+
throw new Error('crypto.getRandomValues must be defined');
|
|
14365
|
+
return cr.getRandomValues(new Uint8Array(bytesLength));
|
|
14366
|
+
}
|
|
14367
|
+
/** Creates OID opts for NIST hashes, with prefix 06 09 60 86 48 01 65 03 04 02. */
|
|
14368
|
+
const utils_oidNist = (suffix) => ({
|
|
14369
|
+
oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]),
|
|
14370
|
+
});
|
|
14334
14371
|
//# sourceMappingURL=utils.js.map
|
|
14335
|
-
;// ./node_modules/@noble/hashes/
|
|
14372
|
+
;// ./node_modules/@noble/hashes/_md.js
|
|
14336
14373
|
/**
|
|
14337
14374
|
* Internal Merkle-Damgard hash utils.
|
|
14338
14375
|
* @module
|
|
14339
14376
|
*/
|
|
14340
14377
|
|
|
14341
|
-
/** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */
|
|
14342
|
-
function setBigUint64(view, byteOffset, value, isLE) {
|
|
14343
|
-
if (typeof view.setBigUint64 === 'function')
|
|
14344
|
-
return view.setBigUint64(byteOffset, value, isLE);
|
|
14345
|
-
const _32n = BigInt(32);
|
|
14346
|
-
const _u32_max = BigInt(0xffffffff);
|
|
14347
|
-
const wh = Number((value >> _32n) & _u32_max);
|
|
14348
|
-
const wl = Number(value & _u32_max);
|
|
14349
|
-
const h = isLE ? 4 : 0;
|
|
14350
|
-
const l = isLE ? 0 : 4;
|
|
14351
|
-
view.setUint32(byteOffset + h, wh, isLE);
|
|
14352
|
-
view.setUint32(byteOffset + l, wl, isLE);
|
|
14353
|
-
}
|
|
14354
14378
|
/** Choice: a ? b : c */
|
|
14355
14379
|
function Chi(a, b, c) {
|
|
14356
14380
|
return (a & b) ^ (~a & c);
|
|
@@ -14363,13 +14387,19 @@ function Maj(a, b, c) {
|
|
|
14363
14387
|
* Merkle-Damgard hash construction base class.
|
|
14364
14388
|
* Could be used to create MD5, RIPEMD, SHA1, SHA2.
|
|
14365
14389
|
*/
|
|
14366
|
-
class HashMD
|
|
14390
|
+
class HashMD {
|
|
14391
|
+
blockLen;
|
|
14392
|
+
outputLen;
|
|
14393
|
+
padOffset;
|
|
14394
|
+
isLE;
|
|
14395
|
+
// For partial updates less than block size
|
|
14396
|
+
buffer;
|
|
14397
|
+
view;
|
|
14398
|
+
finished = false;
|
|
14399
|
+
length = 0;
|
|
14400
|
+
pos = 0;
|
|
14401
|
+
destroyed = false;
|
|
14367
14402
|
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
14368
|
-
super();
|
|
14369
|
-
this.finished = false;
|
|
14370
|
-
this.length = 0;
|
|
14371
|
-
this.pos = 0;
|
|
14372
|
-
this.destroyed = false;
|
|
14373
14403
|
this.blockLen = blockLen;
|
|
14374
14404
|
this.outputLen = outputLen;
|
|
14375
14405
|
this.padOffset = padOffset;
|
|
@@ -14379,8 +14409,7 @@ class HashMD extends Hash {
|
|
|
14379
14409
|
}
|
|
14380
14410
|
update(data) {
|
|
14381
14411
|
aexists(this);
|
|
14382
|
-
|
|
14383
|
-
abytes(data);
|
|
14412
|
+
utils_abytes(data);
|
|
14384
14413
|
const { view, buffer, blockLen } = this;
|
|
14385
14414
|
const len = data.length;
|
|
14386
14415
|
for (let pos = 0; pos < len;) {
|
|
@@ -14428,13 +14457,13 @@ class HashMD extends Hash {
|
|
|
14428
14457
|
// Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
|
|
14429
14458
|
// You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
|
|
14430
14459
|
// So we just write lowest 64 bits of that value.
|
|
14431
|
-
setBigUint64(
|
|
14460
|
+
view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);
|
|
14432
14461
|
this.process(view, 0);
|
|
14433
14462
|
const oview = createView(out);
|
|
14434
14463
|
const len = this.outputLen;
|
|
14435
|
-
// NOTE: we do division by 4 later, which
|
|
14464
|
+
// NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT
|
|
14436
14465
|
if (len % 4)
|
|
14437
|
-
throw new Error('_sha2: outputLen
|
|
14466
|
+
throw new Error('_sha2: outputLen must be aligned to 32bit');
|
|
14438
14467
|
const outLen = len / 4;
|
|
14439
14468
|
const state = this.get();
|
|
14440
14469
|
if (outLen > state.length)
|
|
@@ -14450,7 +14479,7 @@ class HashMD extends Hash {
|
|
|
14450
14479
|
return res;
|
|
14451
14480
|
}
|
|
14452
14481
|
_cloneInto(to) {
|
|
14453
|
-
to
|
|
14482
|
+
to ||= new this.constructor();
|
|
14454
14483
|
to.set(...this.get());
|
|
14455
14484
|
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
14456
14485
|
to.destroyed = destroyed;
|
|
@@ -14488,7 +14517,7 @@ const SHA512_IV = /* @__PURE__ */ Uint32Array.from([
|
|
|
14488
14517
|
0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,
|
|
14489
14518
|
]);
|
|
14490
14519
|
//# sourceMappingURL=_md.js.map
|
|
14491
|
-
;// ./node_modules/@noble/hashes/
|
|
14520
|
+
;// ./node_modules/@noble/hashes/_u64.js
|
|
14492
14521
|
/**
|
|
14493
14522
|
* Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
|
|
14494
14523
|
* @todo re-check https://issues.chromium.org/issues/42212588
|
|
@@ -14556,11 +14585,11 @@ const u64 = {
|
|
|
14556
14585
|
};
|
|
14557
14586
|
/* harmony default export */ const _u64 = ((/* unused pure expression or super */ null && (u64)));
|
|
14558
14587
|
//# sourceMappingURL=_u64.js.map
|
|
14559
|
-
;// ./node_modules/@noble/hashes/
|
|
14588
|
+
;// ./node_modules/@noble/hashes/sha2.js
|
|
14560
14589
|
/**
|
|
14561
14590
|
* SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
|
|
14562
14591
|
* SHA256 is the fastest hash implementable in JS, even faster than Blake3.
|
|
14563
|
-
* Check out [RFC 4634](https://
|
|
14592
|
+
* Check out [RFC 4634](https://www.rfc-editor.org/rfc/rfc4634) and
|
|
14564
14593
|
* [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
|
|
14565
14594
|
* @module
|
|
14566
14595
|
*/
|
|
@@ -14584,19 +14613,10 @@ const SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
|
14584
14613
|
]);
|
|
14585
14614
|
/** Reusable temporary buffer. "W" comes straight from spec. */
|
|
14586
14615
|
const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
14587
|
-
|
|
14588
|
-
|
|
14616
|
+
/** Internal 32-byte base SHA2 hash class. */
|
|
14617
|
+
class SHA2_32B extends HashMD {
|
|
14618
|
+
constructor(outputLen) {
|
|
14589
14619
|
super(64, outputLen, 8, false);
|
|
14590
|
-
// We cannot use array here since array allows indexing by variable
|
|
14591
|
-
// which means optimizer/compiler cannot use registers.
|
|
14592
|
-
this.A = SHA256_IV[0] | 0;
|
|
14593
|
-
this.B = SHA256_IV[1] | 0;
|
|
14594
|
-
this.C = SHA256_IV[2] | 0;
|
|
14595
|
-
this.D = SHA256_IV[3] | 0;
|
|
14596
|
-
this.E = SHA256_IV[4] | 0;
|
|
14597
|
-
this.F = SHA256_IV[5] | 0;
|
|
14598
|
-
this.G = SHA256_IV[6] | 0;
|
|
14599
|
-
this.H = SHA256_IV[7] | 0;
|
|
14600
14620
|
}
|
|
14601
14621
|
get() {
|
|
14602
14622
|
const { A, B, C, D, E, F, G, H } = this;
|
|
@@ -14659,17 +14679,34 @@ class SHA256 extends HashMD {
|
|
|
14659
14679
|
clean(this.buffer);
|
|
14660
14680
|
}
|
|
14661
14681
|
}
|
|
14662
|
-
|
|
14682
|
+
/** Internal SHA2-256 hash class. */
|
|
14683
|
+
class _SHA256 extends SHA2_32B {
|
|
14684
|
+
// We cannot use array here since array allows indexing by variable
|
|
14685
|
+
// which means optimizer/compiler cannot use registers.
|
|
14686
|
+
A = SHA256_IV[0] | 0;
|
|
14687
|
+
B = SHA256_IV[1] | 0;
|
|
14688
|
+
C = SHA256_IV[2] | 0;
|
|
14689
|
+
D = SHA256_IV[3] | 0;
|
|
14690
|
+
E = SHA256_IV[4] | 0;
|
|
14691
|
+
F = SHA256_IV[5] | 0;
|
|
14692
|
+
G = SHA256_IV[6] | 0;
|
|
14693
|
+
H = SHA256_IV[7] | 0;
|
|
14694
|
+
constructor() {
|
|
14695
|
+
super(32);
|
|
14696
|
+
}
|
|
14697
|
+
}
|
|
14698
|
+
/** Internal SHA2-224 hash class. */
|
|
14699
|
+
class _SHA224 extends SHA2_32B {
|
|
14700
|
+
A = SHA224_IV[0] | 0;
|
|
14701
|
+
B = SHA224_IV[1] | 0;
|
|
14702
|
+
C = SHA224_IV[2] | 0;
|
|
14703
|
+
D = SHA224_IV[3] | 0;
|
|
14704
|
+
E = SHA224_IV[4] | 0;
|
|
14705
|
+
F = SHA224_IV[5] | 0;
|
|
14706
|
+
G = SHA224_IV[6] | 0;
|
|
14707
|
+
H = SHA224_IV[7] | 0;
|
|
14663
14708
|
constructor() {
|
|
14664
14709
|
super(28);
|
|
14665
|
-
this.A = SHA224_IV[0] | 0;
|
|
14666
|
-
this.B = SHA224_IV[1] | 0;
|
|
14667
|
-
this.C = SHA224_IV[2] | 0;
|
|
14668
|
-
this.D = SHA224_IV[3] | 0;
|
|
14669
|
-
this.E = SHA224_IV[4] | 0;
|
|
14670
|
-
this.F = SHA224_IV[5] | 0;
|
|
14671
|
-
this.G = SHA224_IV[6] | 0;
|
|
14672
|
-
this.H = SHA224_IV[7] | 0;
|
|
14673
14710
|
}
|
|
14674
14711
|
}
|
|
14675
14712
|
// SHA2-512 is slower than sha256 in js because u64 operations are slow.
|
|
@@ -14703,28 +14740,10 @@ const SHA512_Kl = /* @__PURE__ */ (() => K512[1])();
|
|
|
14703
14740
|
// Reusable temporary buffers
|
|
14704
14741
|
const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
|
|
14705
14742
|
const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
|
|
14706
|
-
|
|
14707
|
-
|
|
14743
|
+
/** Internal 64-byte base SHA2 hash class. */
|
|
14744
|
+
class SHA2_64B extends HashMD {
|
|
14745
|
+
constructor(outputLen) {
|
|
14708
14746
|
super(128, outputLen, 16, false);
|
|
14709
|
-
// We cannot use array here since array allows indexing by variable
|
|
14710
|
-
// which means optimizer/compiler cannot use registers.
|
|
14711
|
-
// h -- high 32 bits, l -- low 32 bits
|
|
14712
|
-
this.Ah = SHA512_IV[0] | 0;
|
|
14713
|
-
this.Al = SHA512_IV[1] | 0;
|
|
14714
|
-
this.Bh = SHA512_IV[2] | 0;
|
|
14715
|
-
this.Bl = SHA512_IV[3] | 0;
|
|
14716
|
-
this.Ch = SHA512_IV[4] | 0;
|
|
14717
|
-
this.Cl = SHA512_IV[5] | 0;
|
|
14718
|
-
this.Dh = SHA512_IV[6] | 0;
|
|
14719
|
-
this.Dl = SHA512_IV[7] | 0;
|
|
14720
|
-
this.Eh = SHA512_IV[8] | 0;
|
|
14721
|
-
this.El = SHA512_IV[9] | 0;
|
|
14722
|
-
this.Fh = SHA512_IV[10] | 0;
|
|
14723
|
-
this.Fl = SHA512_IV[11] | 0;
|
|
14724
|
-
this.Gh = SHA512_IV[12] | 0;
|
|
14725
|
-
this.Gl = SHA512_IV[13] | 0;
|
|
14726
|
-
this.Hh = SHA512_IV[14] | 0;
|
|
14727
|
-
this.Hl = SHA512_IV[15] | 0;
|
|
14728
14747
|
}
|
|
14729
14748
|
// prettier-ignore
|
|
14730
14749
|
get() {
|
|
@@ -14828,25 +14847,48 @@ class SHA512 extends HashMD {
|
|
|
14828
14847
|
this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
14829
14848
|
}
|
|
14830
14849
|
}
|
|
14831
|
-
|
|
14850
|
+
/** Internal SHA2-512 hash class. */
|
|
14851
|
+
class _SHA512 extends SHA2_64B {
|
|
14852
|
+
Ah = SHA512_IV[0] | 0;
|
|
14853
|
+
Al = SHA512_IV[1] | 0;
|
|
14854
|
+
Bh = SHA512_IV[2] | 0;
|
|
14855
|
+
Bl = SHA512_IV[3] | 0;
|
|
14856
|
+
Ch = SHA512_IV[4] | 0;
|
|
14857
|
+
Cl = SHA512_IV[5] | 0;
|
|
14858
|
+
Dh = SHA512_IV[6] | 0;
|
|
14859
|
+
Dl = SHA512_IV[7] | 0;
|
|
14860
|
+
Eh = SHA512_IV[8] | 0;
|
|
14861
|
+
El = SHA512_IV[9] | 0;
|
|
14862
|
+
Fh = SHA512_IV[10] | 0;
|
|
14863
|
+
Fl = SHA512_IV[11] | 0;
|
|
14864
|
+
Gh = SHA512_IV[12] | 0;
|
|
14865
|
+
Gl = SHA512_IV[13] | 0;
|
|
14866
|
+
Hh = SHA512_IV[14] | 0;
|
|
14867
|
+
Hl = SHA512_IV[15] | 0;
|
|
14868
|
+
constructor() {
|
|
14869
|
+
super(64);
|
|
14870
|
+
}
|
|
14871
|
+
}
|
|
14872
|
+
/** Internal SHA2-384 hash class. */
|
|
14873
|
+
class _SHA384 extends SHA2_64B {
|
|
14874
|
+
Ah = SHA384_IV[0] | 0;
|
|
14875
|
+
Al = SHA384_IV[1] | 0;
|
|
14876
|
+
Bh = SHA384_IV[2] | 0;
|
|
14877
|
+
Bl = SHA384_IV[3] | 0;
|
|
14878
|
+
Ch = SHA384_IV[4] | 0;
|
|
14879
|
+
Cl = SHA384_IV[5] | 0;
|
|
14880
|
+
Dh = SHA384_IV[6] | 0;
|
|
14881
|
+
Dl = SHA384_IV[7] | 0;
|
|
14882
|
+
Eh = SHA384_IV[8] | 0;
|
|
14883
|
+
El = SHA384_IV[9] | 0;
|
|
14884
|
+
Fh = SHA384_IV[10] | 0;
|
|
14885
|
+
Fl = SHA384_IV[11] | 0;
|
|
14886
|
+
Gh = SHA384_IV[12] | 0;
|
|
14887
|
+
Gl = SHA384_IV[13] | 0;
|
|
14888
|
+
Hh = SHA384_IV[14] | 0;
|
|
14889
|
+
Hl = SHA384_IV[15] | 0;
|
|
14832
14890
|
constructor() {
|
|
14833
14891
|
super(48);
|
|
14834
|
-
this.Ah = SHA384_IV[0] | 0;
|
|
14835
|
-
this.Al = SHA384_IV[1] | 0;
|
|
14836
|
-
this.Bh = SHA384_IV[2] | 0;
|
|
14837
|
-
this.Bl = SHA384_IV[3] | 0;
|
|
14838
|
-
this.Ch = SHA384_IV[4] | 0;
|
|
14839
|
-
this.Cl = SHA384_IV[5] | 0;
|
|
14840
|
-
this.Dh = SHA384_IV[6] | 0;
|
|
14841
|
-
this.Dl = SHA384_IV[7] | 0;
|
|
14842
|
-
this.Eh = SHA384_IV[8] | 0;
|
|
14843
|
-
this.El = SHA384_IV[9] | 0;
|
|
14844
|
-
this.Fh = SHA384_IV[10] | 0;
|
|
14845
|
-
this.Fl = SHA384_IV[11] | 0;
|
|
14846
|
-
this.Gh = SHA384_IV[12] | 0;
|
|
14847
|
-
this.Gl = SHA384_IV[13] | 0;
|
|
14848
|
-
this.Hh = SHA384_IV[14] | 0;
|
|
14849
|
-
this.Hl = SHA384_IV[15] | 0;
|
|
14850
14892
|
}
|
|
14851
14893
|
}
|
|
14852
14894
|
/**
|
|
@@ -14865,161 +14907,83 @@ const T256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
|
14865
14907
|
0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,
|
|
14866
14908
|
0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,
|
|
14867
14909
|
]);
|
|
14868
|
-
|
|
14910
|
+
/** Internal SHA2-512/224 hash class. */
|
|
14911
|
+
class _SHA512_224 extends SHA2_64B {
|
|
14912
|
+
Ah = T224_IV[0] | 0;
|
|
14913
|
+
Al = T224_IV[1] | 0;
|
|
14914
|
+
Bh = T224_IV[2] | 0;
|
|
14915
|
+
Bl = T224_IV[3] | 0;
|
|
14916
|
+
Ch = T224_IV[4] | 0;
|
|
14917
|
+
Cl = T224_IV[5] | 0;
|
|
14918
|
+
Dh = T224_IV[6] | 0;
|
|
14919
|
+
Dl = T224_IV[7] | 0;
|
|
14920
|
+
Eh = T224_IV[8] | 0;
|
|
14921
|
+
El = T224_IV[9] | 0;
|
|
14922
|
+
Fh = T224_IV[10] | 0;
|
|
14923
|
+
Fl = T224_IV[11] | 0;
|
|
14924
|
+
Gh = T224_IV[12] | 0;
|
|
14925
|
+
Gl = T224_IV[13] | 0;
|
|
14926
|
+
Hh = T224_IV[14] | 0;
|
|
14927
|
+
Hl = T224_IV[15] | 0;
|
|
14869
14928
|
constructor() {
|
|
14870
14929
|
super(28);
|
|
14871
|
-
|
|
14872
|
-
|
|
14873
|
-
|
|
14874
|
-
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
|
|
14930
|
+
}
|
|
14931
|
+
}
|
|
14932
|
+
/** Internal SHA2-512/256 hash class. */
|
|
14933
|
+
class _SHA512_256 extends SHA2_64B {
|
|
14934
|
+
Ah = T256_IV[0] | 0;
|
|
14935
|
+
Al = T256_IV[1] | 0;
|
|
14936
|
+
Bh = T256_IV[2] | 0;
|
|
14937
|
+
Bl = T256_IV[3] | 0;
|
|
14938
|
+
Ch = T256_IV[4] | 0;
|
|
14939
|
+
Cl = T256_IV[5] | 0;
|
|
14940
|
+
Dh = T256_IV[6] | 0;
|
|
14941
|
+
Dl = T256_IV[7] | 0;
|
|
14942
|
+
Eh = T256_IV[8] | 0;
|
|
14943
|
+
El = T256_IV[9] | 0;
|
|
14944
|
+
Fh = T256_IV[10] | 0;
|
|
14945
|
+
Fl = T256_IV[11] | 0;
|
|
14946
|
+
Gh = T256_IV[12] | 0;
|
|
14947
|
+
Gl = T256_IV[13] | 0;
|
|
14948
|
+
Hh = T256_IV[14] | 0;
|
|
14949
|
+
Hl = T256_IV[15] | 0;
|
|
14890
14950
|
constructor() {
|
|
14891
14951
|
super(32);
|
|
14892
|
-
this.Ah = T256_IV[0] | 0;
|
|
14893
|
-
this.Al = T256_IV[1] | 0;
|
|
14894
|
-
this.Bh = T256_IV[2] | 0;
|
|
14895
|
-
this.Bl = T256_IV[3] | 0;
|
|
14896
|
-
this.Ch = T256_IV[4] | 0;
|
|
14897
|
-
this.Cl = T256_IV[5] | 0;
|
|
14898
|
-
this.Dh = T256_IV[6] | 0;
|
|
14899
|
-
this.Dl = T256_IV[7] | 0;
|
|
14900
|
-
this.Eh = T256_IV[8] | 0;
|
|
14901
|
-
this.El = T256_IV[9] | 0;
|
|
14902
|
-
this.Fh = T256_IV[10] | 0;
|
|
14903
|
-
this.Fl = T256_IV[11] | 0;
|
|
14904
|
-
this.Gh = T256_IV[12] | 0;
|
|
14905
|
-
this.Gl = T256_IV[13] | 0;
|
|
14906
|
-
this.Hh = T256_IV[14] | 0;
|
|
14907
|
-
this.Hl = T256_IV[15] | 0;
|
|
14908
14952
|
}
|
|
14909
14953
|
}
|
|
14910
14954
|
/**
|
|
14911
|
-
* SHA2-256 hash function from RFC 4634.
|
|
14955
|
+
* SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:
|
|
14912
14956
|
*
|
|
14913
|
-
*
|
|
14914
|
-
*
|
|
14915
|
-
*
|
|
14957
|
+
* - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.
|
|
14958
|
+
* - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
|
|
14959
|
+
* - Each sha256 hash is executing 2^18 bit operations.
|
|
14960
|
+
* - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.
|
|
14916
14961
|
*/
|
|
14917
|
-
const sha2_sha256 = /* @__PURE__ */ utils_createHasher(() => new
|
|
14962
|
+
const sha2_sha256 = /* @__PURE__ */ utils_createHasher(() => new _SHA256(),
|
|
14963
|
+
/* @__PURE__ */ utils_oidNist(0x01));
|
|
14918
14964
|
/** SHA2-224 hash function from RFC 4634 */
|
|
14919
|
-
const sha224 = /* @__PURE__ */ (/* unused pure expression or super */ null && (createHasher(() => new
|
|
14965
|
+
const sha224 = /* @__PURE__ */ (/* unused pure expression or super */ null && (createHasher(() => new _SHA224(),
|
|
14966
|
+
/* @__PURE__ */ oidNist(0x04))));
|
|
14920
14967
|
/** SHA2-512 hash function from RFC 4634. */
|
|
14921
|
-
const sha512 = /* @__PURE__ */ (/* unused pure expression or super */ null && (createHasher(() => new
|
|
14968
|
+
const sha512 = /* @__PURE__ */ (/* unused pure expression or super */ null && (createHasher(() => new _SHA512(),
|
|
14969
|
+
/* @__PURE__ */ oidNist(0x03))));
|
|
14922
14970
|
/** SHA2-384 hash function from RFC 4634. */
|
|
14923
|
-
const sha384 = /* @__PURE__ */ (/* unused pure expression or super */ null && (createHasher(() => new
|
|
14971
|
+
const sha384 = /* @__PURE__ */ (/* unused pure expression or super */ null && (createHasher(() => new _SHA384(),
|
|
14972
|
+
/* @__PURE__ */ oidNist(0x02))));
|
|
14924
14973
|
/**
|
|
14925
14974
|
* SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks.
|
|
14926
14975
|
* See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
|
|
14927
14976
|
*/
|
|
14928
|
-
const sha512_256 = /* @__PURE__ */ (/* unused pure expression or super */ null && (createHasher(() => new
|
|
14977
|
+
const sha512_256 = /* @__PURE__ */ (/* unused pure expression or super */ null && (createHasher(() => new _SHA512_256(),
|
|
14978
|
+
/* @__PURE__ */ oidNist(0x06))));
|
|
14929
14979
|
/**
|
|
14930
14980
|
* SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks.
|
|
14931
14981
|
* See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
|
|
14932
14982
|
*/
|
|
14933
|
-
const sha512_224 = /* @__PURE__ */ (/* unused pure expression or super */ null && (createHasher(() => new
|
|
14983
|
+
const sha512_224 = /* @__PURE__ */ (/* unused pure expression or super */ null && (createHasher(() => new _SHA512_224(),
|
|
14984
|
+
/* @__PURE__ */ oidNist(0x05))));
|
|
14934
14985
|
//# sourceMappingURL=sha2.js.map
|
|
14935
|
-
;// ./node_modules/@noble/
|
|
14936
|
-
/**
|
|
14937
|
-
* HMAC: RFC2104 message authentication code.
|
|
14938
|
-
* @module
|
|
14939
|
-
*/
|
|
14940
|
-
|
|
14941
|
-
class HMAC extends Hash {
|
|
14942
|
-
constructor(hash, _key) {
|
|
14943
|
-
super();
|
|
14944
|
-
this.finished = false;
|
|
14945
|
-
this.destroyed = false;
|
|
14946
|
-
ahash(hash);
|
|
14947
|
-
const key = toBytes(_key);
|
|
14948
|
-
this.iHash = hash.create();
|
|
14949
|
-
if (typeof this.iHash.update !== 'function')
|
|
14950
|
-
throw new Error('Expected instance of class which extends utils.Hash');
|
|
14951
|
-
this.blockLen = this.iHash.blockLen;
|
|
14952
|
-
this.outputLen = this.iHash.outputLen;
|
|
14953
|
-
const blockLen = this.blockLen;
|
|
14954
|
-
const pad = new Uint8Array(blockLen);
|
|
14955
|
-
// blockLen can be bigger than outputLen
|
|
14956
|
-
pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
|
|
14957
|
-
for (let i = 0; i < pad.length; i++)
|
|
14958
|
-
pad[i] ^= 0x36;
|
|
14959
|
-
this.iHash.update(pad);
|
|
14960
|
-
// By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
|
|
14961
|
-
this.oHash = hash.create();
|
|
14962
|
-
// Undo internal XOR && apply outer XOR
|
|
14963
|
-
for (let i = 0; i < pad.length; i++)
|
|
14964
|
-
pad[i] ^= 0x36 ^ 0x5c;
|
|
14965
|
-
this.oHash.update(pad);
|
|
14966
|
-
clean(pad);
|
|
14967
|
-
}
|
|
14968
|
-
update(buf) {
|
|
14969
|
-
aexists(this);
|
|
14970
|
-
this.iHash.update(buf);
|
|
14971
|
-
return this;
|
|
14972
|
-
}
|
|
14973
|
-
digestInto(out) {
|
|
14974
|
-
aexists(this);
|
|
14975
|
-
abytes(out, this.outputLen);
|
|
14976
|
-
this.finished = true;
|
|
14977
|
-
this.iHash.digestInto(out);
|
|
14978
|
-
this.oHash.update(out);
|
|
14979
|
-
this.oHash.digestInto(out);
|
|
14980
|
-
this.destroy();
|
|
14981
|
-
}
|
|
14982
|
-
digest() {
|
|
14983
|
-
const out = new Uint8Array(this.oHash.outputLen);
|
|
14984
|
-
this.digestInto(out);
|
|
14985
|
-
return out;
|
|
14986
|
-
}
|
|
14987
|
-
_cloneInto(to) {
|
|
14988
|
-
// Create new instance without calling constructor since key already in state and we don't know it.
|
|
14989
|
-
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
|
14990
|
-
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
14991
|
-
to = to;
|
|
14992
|
-
to.finished = finished;
|
|
14993
|
-
to.destroyed = destroyed;
|
|
14994
|
-
to.blockLen = blockLen;
|
|
14995
|
-
to.outputLen = outputLen;
|
|
14996
|
-
to.oHash = oHash._cloneInto(to.oHash);
|
|
14997
|
-
to.iHash = iHash._cloneInto(to.iHash);
|
|
14998
|
-
return to;
|
|
14999
|
-
}
|
|
15000
|
-
clone() {
|
|
15001
|
-
return this._cloneInto();
|
|
15002
|
-
}
|
|
15003
|
-
destroy() {
|
|
15004
|
-
this.destroyed = true;
|
|
15005
|
-
this.oHash.destroy();
|
|
15006
|
-
this.iHash.destroy();
|
|
15007
|
-
}
|
|
15008
|
-
}
|
|
15009
|
-
/**
|
|
15010
|
-
* HMAC: RFC2104 message authentication code.
|
|
15011
|
-
* @param hash - function that would be used e.g. sha256
|
|
15012
|
-
* @param key - message key
|
|
15013
|
-
* @param message - message data
|
|
15014
|
-
* @example
|
|
15015
|
-
* import { hmac } from '@noble/hashes/hmac';
|
|
15016
|
-
* import { sha256 } from '@noble/hashes/sha2';
|
|
15017
|
-
* const mac1 = hmac(sha256, 'key', 'message');
|
|
15018
|
-
*/
|
|
15019
|
-
const hmac_hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
|
|
15020
|
-
hmac_hmac.create = (hash, key) => new HMAC(hash, key);
|
|
15021
|
-
//# sourceMappingURL=hmac.js.map
|
|
15022
|
-
;// ./node_modules/@noble/curves/esm/utils.js
|
|
14986
|
+
;// ./node_modules/@noble/curves/utils.js
|
|
15023
14987
|
/**
|
|
15024
14988
|
* Hex, bytes and number utilities.
|
|
15025
14989
|
* @module
|
|
@@ -15029,35 +14993,31 @@ hmac_hmac.create = (hash, key) => new HMAC(hash, key);
|
|
|
15029
14993
|
|
|
15030
14994
|
const _0n = /* @__PURE__ */ BigInt(0);
|
|
15031
14995
|
const _1n = /* @__PURE__ */ BigInt(1);
|
|
15032
|
-
function
|
|
15033
|
-
if (typeof value !== 'boolean')
|
|
15034
|
-
throw new Error(title + ' boolean expected, got ' + value);
|
|
15035
|
-
}
|
|
15036
|
-
// tmp name until v2
|
|
15037
|
-
function _abool2(value, title = '') {
|
|
14996
|
+
function utils_abool(value, title = '') {
|
|
15038
14997
|
if (typeof value !== 'boolean') {
|
|
15039
|
-
const prefix = title && `"${title}"`;
|
|
14998
|
+
const prefix = title && `"${title}" `;
|
|
15040
14999
|
throw new Error(prefix + 'expected boolean, got type=' + typeof value);
|
|
15041
15000
|
}
|
|
15042
15001
|
return value;
|
|
15043
15002
|
}
|
|
15044
|
-
//
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15003
|
+
// Used in weierstrass, der
|
|
15004
|
+
function abignumber(n) {
|
|
15005
|
+
if (typeof n === 'bigint') {
|
|
15006
|
+
if (!isPosBig(n))
|
|
15007
|
+
throw new Error('positive bigint expected, got ' + n);
|
|
15008
|
+
}
|
|
15009
|
+
else
|
|
15010
|
+
utils_anumber(n);
|
|
15011
|
+
return n;
|
|
15012
|
+
}
|
|
15013
|
+
function asafenumber(value, title = '') {
|
|
15014
|
+
if (!Number.isSafeInteger(value)) {
|
|
15051
15015
|
const prefix = title && `"${title}" `;
|
|
15052
|
-
|
|
15053
|
-
const got = bytes ? `length=${len}` : `type=${typeof value}`;
|
|
15054
|
-
throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);
|
|
15016
|
+
throw new Error(prefix + 'expected safe integer, got type=' + typeof value);
|
|
15055
15017
|
}
|
|
15056
|
-
return value;
|
|
15057
15018
|
}
|
|
15058
|
-
// Used in weierstrass, der
|
|
15059
15019
|
function numberToHexUnpadded(num) {
|
|
15060
|
-
const hex = num.toString(16);
|
|
15020
|
+
const hex = abignumber(num).toString(16);
|
|
15061
15021
|
return hex.length & 1 ? '0' + hex : hex;
|
|
15062
15022
|
}
|
|
15063
15023
|
function hexToNumber(hex) {
|
|
@@ -15067,53 +15027,25 @@ function hexToNumber(hex) {
|
|
|
15067
15027
|
}
|
|
15068
15028
|
// BE: Big Endian, LE: Little Endian
|
|
15069
15029
|
function utils_bytesToNumberBE(bytes) {
|
|
15070
|
-
return hexToNumber(
|
|
15030
|
+
return hexToNumber(utils_bytesToHex(bytes));
|
|
15071
15031
|
}
|
|
15072
|
-
function
|
|
15073
|
-
|
|
15074
|
-
return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));
|
|
15032
|
+
function bytesToNumberLE(bytes) {
|
|
15033
|
+
return hexToNumber(utils_bytesToHex(copyBytes(utils_abytes(bytes)).reverse()));
|
|
15075
15034
|
}
|
|
15076
15035
|
function numberToBytesBE(n, len) {
|
|
15077
|
-
|
|
15036
|
+
utils_anumber(len);
|
|
15037
|
+
n = abignumber(n);
|
|
15038
|
+
const res = utils_hexToBytes(n.toString(16).padStart(len * 2, '0'));
|
|
15039
|
+
if (res.length !== len)
|
|
15040
|
+
throw new Error('number too large');
|
|
15041
|
+
return res;
|
|
15078
15042
|
}
|
|
15079
15043
|
function numberToBytesLE(n, len) {
|
|
15080
15044
|
return numberToBytesBE(n, len).reverse();
|
|
15081
15045
|
}
|
|
15082
15046
|
// Unpadded, rarely used
|
|
15083
15047
|
function numberToVarBytesBE(n) {
|
|
15084
|
-
return hexToBytes_(numberToHexUnpadded(n));
|
|
15085
|
-
}
|
|
15086
|
-
/**
|
|
15087
|
-
* Takes hex string or Uint8Array, converts to Uint8Array.
|
|
15088
|
-
* Validates output length.
|
|
15089
|
-
* Will throw error for other types.
|
|
15090
|
-
* @param title descriptive title for an error e.g. 'secret key'
|
|
15091
|
-
* @param hex hex string or Uint8Array
|
|
15092
|
-
* @param expectedLength optional, will compare to result array's length
|
|
15093
|
-
* @returns
|
|
15094
|
-
*/
|
|
15095
|
-
function utils_ensureBytes(title, hex, expectedLength) {
|
|
15096
|
-
let res;
|
|
15097
|
-
if (typeof hex === 'string') {
|
|
15098
|
-
try {
|
|
15099
|
-
res = hexToBytes(hex);
|
|
15100
|
-
}
|
|
15101
|
-
catch (e) {
|
|
15102
|
-
throw new Error(title + ' must be hex string or Uint8Array, cause: ' + e);
|
|
15103
|
-
}
|
|
15104
|
-
}
|
|
15105
|
-
else if (isBytes(hex)) {
|
|
15106
|
-
// Uint8Array.from() instead of hash.slice() because node.js Buffer
|
|
15107
|
-
// is instance of Uint8Array, and its slice() creates **mutable** copy
|
|
15108
|
-
res = Uint8Array.from(hex);
|
|
15109
|
-
}
|
|
15110
|
-
else {
|
|
15111
|
-
throw new Error(title + ' must be hex string or Uint8Array');
|
|
15112
|
-
}
|
|
15113
|
-
const len = res.length;
|
|
15114
|
-
if (typeof expectedLength === 'number' && len !== expectedLength)
|
|
15115
|
-
throw new Error(title + ' of length ' + expectedLength + ' expected, got ' + len);
|
|
15116
|
-
return res;
|
|
15048
|
+
return hexToBytes_(numberToHexUnpadded(abignumber(n)));
|
|
15117
15049
|
}
|
|
15118
15050
|
// Compares 2 u8a-s in kinda constant time
|
|
15119
15051
|
function equalBytes(a, b) {
|
|
@@ -15134,7 +15066,7 @@ function copyBytes(bytes) {
|
|
|
15134
15066
|
/**
|
|
15135
15067
|
* Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols
|
|
15136
15068
|
* Should be safe to use for things expected to be ASCII.
|
|
15137
|
-
* Returns exact same result as
|
|
15069
|
+
* Returns exact same result as `TextEncoder` for ASCII or throws.
|
|
15138
15070
|
*/
|
|
15139
15071
|
function asciiToBytes(ascii) {
|
|
15140
15072
|
return Uint8Array.from(ascii, (c, i) => {
|
|
@@ -15145,18 +15077,9 @@ function asciiToBytes(ascii) {
|
|
|
15145
15077
|
return charCode;
|
|
15146
15078
|
});
|
|
15147
15079
|
}
|
|
15148
|
-
/**
|
|
15149
|
-
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
|
|
15150
|
-
*/
|
|
15151
|
-
// export const utf8ToBytes: typeof utf8ToBytes_ = utf8ToBytes_;
|
|
15152
|
-
/**
|
|
15153
|
-
* Converts bytes to string using UTF8 encoding.
|
|
15154
|
-
* @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'
|
|
15155
|
-
*/
|
|
15156
|
-
// export const bytesToUtf8: typeof bytesToUtf8_ = bytesToUtf8_;
|
|
15157
15080
|
// Is positive bigint
|
|
15158
15081
|
const isPosBig = (n) => typeof n === 'bigint' && _0n <= n;
|
|
15159
|
-
function
|
|
15082
|
+
function inRange(n, min, max) {
|
|
15160
15083
|
return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
|
|
15161
15084
|
}
|
|
15162
15085
|
/**
|
|
@@ -15164,13 +15087,13 @@ function utils_inRange(n, min, max) {
|
|
|
15164
15087
|
* @example
|
|
15165
15088
|
* aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n)
|
|
15166
15089
|
*/
|
|
15167
|
-
function
|
|
15090
|
+
function utils_aInRange(title, n, min, max) {
|
|
15168
15091
|
// Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)?
|
|
15169
15092
|
// consider P=256n, min=0n, max=P
|
|
15170
15093
|
// - a for min=0 would require -1: `inRange('x', x, -1n, P)`
|
|
15171
15094
|
// - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)`
|
|
15172
15095
|
// - our way is the cleanest: `inRange('x', x, 0n, P)
|
|
15173
|
-
if (!
|
|
15096
|
+
if (!inRange(n, min, max))
|
|
15174
15097
|
throw new Error('expected valid ' + title + ': ' + min + ' <= n < ' + max + ', got ' + n);
|
|
15175
15098
|
}
|
|
15176
15099
|
// Bit operations
|
|
@@ -15179,7 +15102,7 @@ function aInRange(title, n, min, max) {
|
|
|
15179
15102
|
* Same as `n.toString(2).length`
|
|
15180
15103
|
* TODO: merge with nLength in modular
|
|
15181
15104
|
*/
|
|
15182
|
-
function
|
|
15105
|
+
function utils_bitLen(n) {
|
|
15183
15106
|
let len;
|
|
15184
15107
|
for (len = 0; n > _0n; n >>= _1n, len += 1)
|
|
15185
15108
|
;
|
|
@@ -15211,16 +15134,17 @@ const utils_bitMask = (n) => (_1n << BigInt(n)) - _1n;
|
|
|
15211
15134
|
* const drbg = createHmacDRBG<Key>(32, 32, hmac);
|
|
15212
15135
|
* drbg(seed, bytesToKey); // bytesToKey must return Key or undefined
|
|
15213
15136
|
*/
|
|
15214
|
-
function
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
if (typeof qByteLen !== 'number' || qByteLen < 2)
|
|
15218
|
-
throw new Error('qByteLen must be a number');
|
|
15137
|
+
function utils_createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
15138
|
+
anumber(hashLen, 'hashLen');
|
|
15139
|
+
anumber(qByteLen, 'qByteLen');
|
|
15219
15140
|
if (typeof hmacFn !== 'function')
|
|
15220
15141
|
throw new Error('hmacFn must be a function');
|
|
15221
|
-
// Step B, Step C: set hashLen to 8*ceil(hlen/8)
|
|
15222
15142
|
const u8n = (len) => new Uint8Array(len); // creates Uint8Array
|
|
15223
|
-
const
|
|
15143
|
+
const NULL = Uint8Array.of();
|
|
15144
|
+
const byte0 = Uint8Array.of(0x00);
|
|
15145
|
+
const byte1 = Uint8Array.of(0x01);
|
|
15146
|
+
const _maxDrbgIters = 1000;
|
|
15147
|
+
// Step B, Step C: set hashLen to 8*ceil(hlen/8)
|
|
15224
15148
|
let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.
|
|
15225
15149
|
let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same
|
|
15226
15150
|
let i = 0; // Iterations counter, will throw when over 1000
|
|
@@ -15229,20 +15153,20 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
15229
15153
|
k.fill(0);
|
|
15230
15154
|
i = 0;
|
|
15231
15155
|
};
|
|
15232
|
-
const h = (...
|
|
15233
|
-
const reseed = (seed =
|
|
15156
|
+
const h = (...msgs) => hmacFn(k, concatBytes_(v, ...msgs)); // hmac(k)(v, ...values)
|
|
15157
|
+
const reseed = (seed = NULL) => {
|
|
15234
15158
|
// HMAC-DRBG reseed() function. Steps D-G
|
|
15235
|
-
k = h(
|
|
15159
|
+
k = h(byte0, seed); // k = hmac(k || v || 0x00 || seed)
|
|
15236
15160
|
v = h(); // v = hmac(k || v)
|
|
15237
15161
|
if (seed.length === 0)
|
|
15238
15162
|
return;
|
|
15239
|
-
k = h(
|
|
15163
|
+
k = h(byte1, seed); // k = hmac(k || v || 0x01 || seed)
|
|
15240
15164
|
v = h(); // v = hmac(k || v)
|
|
15241
15165
|
};
|
|
15242
15166
|
const gen = () => {
|
|
15243
15167
|
// HMAC-DRBG generate() function
|
|
15244
|
-
if (i++ >=
|
|
15245
|
-
throw new Error('drbg: tried
|
|
15168
|
+
if (i++ >= _maxDrbgIters)
|
|
15169
|
+
throw new Error('drbg: tried max amount of iterations');
|
|
15246
15170
|
let len = 0;
|
|
15247
15171
|
const out = [];
|
|
15248
15172
|
while (len < qByteLen) {
|
|
@@ -15251,7 +15175,7 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
15251
15175
|
out.push(sl);
|
|
15252
15176
|
len += v.length;
|
|
15253
15177
|
}
|
|
15254
|
-
return
|
|
15178
|
+
return concatBytes_(...out);
|
|
15255
15179
|
};
|
|
15256
15180
|
const genUntil = (seed, pred) => {
|
|
15257
15181
|
reset();
|
|
@@ -15264,49 +15188,7 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
15264
15188
|
};
|
|
15265
15189
|
return genUntil;
|
|
15266
15190
|
}
|
|
15267
|
-
|
|
15268
|
-
const validatorFns = {
|
|
15269
|
-
bigint: (val) => typeof val === 'bigint',
|
|
15270
|
-
function: (val) => typeof val === 'function',
|
|
15271
|
-
boolean: (val) => typeof val === 'boolean',
|
|
15272
|
-
string: (val) => typeof val === 'string',
|
|
15273
|
-
stringOrUint8Array: (val) => typeof val === 'string' || isBytes(val),
|
|
15274
|
-
isSafeInteger: (val) => Number.isSafeInteger(val),
|
|
15275
|
-
array: (val) => Array.isArray(val),
|
|
15276
|
-
field: (val, object) => object.Fp.isValid(val),
|
|
15277
|
-
hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),
|
|
15278
|
-
};
|
|
15279
|
-
// type Record<K extends string | number | symbol, T> = { [P in K]: T; }
|
|
15280
|
-
function utils_validateObject(object, validators, optValidators = {}) {
|
|
15281
|
-
const checkField = (fieldName, type, isOptional) => {
|
|
15282
|
-
const checkVal = validatorFns[type];
|
|
15283
|
-
if (typeof checkVal !== 'function')
|
|
15284
|
-
throw new Error('invalid validator function');
|
|
15285
|
-
const val = object[fieldName];
|
|
15286
|
-
if (isOptional && val === undefined)
|
|
15287
|
-
return;
|
|
15288
|
-
if (!checkVal(val, object)) {
|
|
15289
|
-
throw new Error('param ' + String(fieldName) + ' is invalid. Expected ' + type + ', got ' + val);
|
|
15290
|
-
}
|
|
15291
|
-
};
|
|
15292
|
-
for (const [fieldName, type] of Object.entries(validators))
|
|
15293
|
-
checkField(fieldName, type, false);
|
|
15294
|
-
for (const [fieldName, type] of Object.entries(optValidators))
|
|
15295
|
-
checkField(fieldName, type, true);
|
|
15296
|
-
return object;
|
|
15297
|
-
}
|
|
15298
|
-
// validate type tests
|
|
15299
|
-
// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };
|
|
15300
|
-
// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!
|
|
15301
|
-
// // Should fail type-check
|
|
15302
|
-
// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });
|
|
15303
|
-
// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });
|
|
15304
|
-
// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });
|
|
15305
|
-
// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });
|
|
15306
|
-
function isHash(val) {
|
|
15307
|
-
return typeof val === 'function' && Number.isSafeInteger(val.outputLen);
|
|
15308
|
-
}
|
|
15309
|
-
function _validateObject(object, fields, optFields = {}) {
|
|
15191
|
+
function utils_validateObject(object, fields = {}, optFields = {}) {
|
|
15310
15192
|
if (!object || typeof object !== 'object')
|
|
15311
15193
|
throw new Error('expected valid options object');
|
|
15312
15194
|
function checkField(fieldName, expectedType, isOpt) {
|
|
@@ -15317,8 +15199,9 @@ function _validateObject(object, fields, optFields = {}) {
|
|
|
15317
15199
|
if (current !== expectedType || val === null)
|
|
15318
15200
|
throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`);
|
|
15319
15201
|
}
|
|
15320
|
-
Object.entries(
|
|
15321
|
-
|
|
15202
|
+
const iter = (f, isOpt) => Object.entries(f).forEach(([k, v]) => checkField(k, v, isOpt));
|
|
15203
|
+
iter(fields, false);
|
|
15204
|
+
iter(optFields, true);
|
|
15322
15205
|
}
|
|
15323
15206
|
/**
|
|
15324
15207
|
* throws not implemented error
|
|
@@ -15342,7 +15225,7 @@ function memoized(fn) {
|
|
|
15342
15225
|
};
|
|
15343
15226
|
}
|
|
15344
15227
|
//# sourceMappingURL=utils.js.map
|
|
15345
|
-
;// ./node_modules/@noble/curves/
|
|
15228
|
+
;// ./node_modules/@noble/curves/abstract/modular.js
|
|
15346
15229
|
/**
|
|
15347
15230
|
* Utils for modular division and fields.
|
|
15348
15231
|
* Field over 11 is a finite (Galois) field is integer number operations `mod 11`.
|
|
@@ -15351,12 +15234,14 @@ function memoized(fn) {
|
|
|
15351
15234
|
*/
|
|
15352
15235
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
15353
15236
|
|
|
15237
|
+
// Numbers aren't used in x25519 / x448 builds
|
|
15354
15238
|
// prettier-ignore
|
|
15355
|
-
const modular_0n =
|
|
15239
|
+
const modular_0n = /* @__PURE__ */ BigInt(0), modular_1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2);
|
|
15356
15240
|
// prettier-ignore
|
|
15357
|
-
const
|
|
15241
|
+
const _3n = /* @__PURE__ */ BigInt(3), _4n = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5);
|
|
15358
15242
|
// prettier-ignore
|
|
15359
|
-
const
|
|
15243
|
+
const _7n = /* @__PURE__ */ BigInt(7), _8n = /* @__PURE__ */ BigInt(8), _9n = /* @__PURE__ */ BigInt(9);
|
|
15244
|
+
const _16n = /* @__PURE__ */ BigInt(16);
|
|
15360
15245
|
// Calculates a modulo b
|
|
15361
15246
|
function mod(a, b) {
|
|
15362
15247
|
const result = a % b;
|
|
@@ -15563,7 +15448,6 @@ const FIELD_FIELDS = [
|
|
|
15563
15448
|
function modular_validateField(field) {
|
|
15564
15449
|
const initial = {
|
|
15565
15450
|
ORDER: 'bigint',
|
|
15566
|
-
MASK: 'bigint',
|
|
15567
15451
|
BYTES: 'number',
|
|
15568
15452
|
BITS: 'number',
|
|
15569
15453
|
};
|
|
@@ -15571,7 +15455,7 @@ function modular_validateField(field) {
|
|
|
15571
15455
|
map[val] = 'function';
|
|
15572
15456
|
return map;
|
|
15573
15457
|
}, initial);
|
|
15574
|
-
|
|
15458
|
+
utils_validateObject(field, opts);
|
|
15575
15459
|
// const max = 16384;
|
|
15576
15460
|
// if (field.BYTES < 1 || field.BYTES > max) throw new Error('invalid field');
|
|
15577
15461
|
// if (field.BITS < 1 || field.BITS > 8 * max) throw new Error('invalid field');
|
|
@@ -15655,134 +15539,172 @@ function FpIsSquare(Fp, n) {
|
|
|
15655
15539
|
return l === 1;
|
|
15656
15540
|
}
|
|
15657
15541
|
// CURVE.n lengths
|
|
15658
|
-
function
|
|
15542
|
+
function nLength(n, nBitLength) {
|
|
15659
15543
|
// Bit size, byte size of CURVE.n
|
|
15660
15544
|
if (nBitLength !== undefined)
|
|
15661
|
-
|
|
15545
|
+
utils_anumber(nBitLength);
|
|
15662
15546
|
const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;
|
|
15663
15547
|
const nByteLength = Math.ceil(_nBitLength / 8);
|
|
15664
15548
|
return { nBitLength: _nBitLength, nByteLength };
|
|
15665
15549
|
}
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
|
|
15676
|
-
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
if (
|
|
15695
|
-
throw new Error('
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
if (typeof _opts.isLE === 'boolean')
|
|
15702
|
-
isLE = _opts.isLE;
|
|
15703
|
-
if (typeof _opts.modFromBytes === 'boolean')
|
|
15704
|
-
modFromBytes = _opts.modFromBytes;
|
|
15705
|
-
allowedLengths = _opts.allowedLengths;
|
|
15550
|
+
class _Field {
|
|
15551
|
+
ORDER;
|
|
15552
|
+
BITS;
|
|
15553
|
+
BYTES;
|
|
15554
|
+
isLE;
|
|
15555
|
+
ZERO = modular_0n;
|
|
15556
|
+
ONE = modular_1n;
|
|
15557
|
+
_lengths;
|
|
15558
|
+
_sqrt; // cached sqrt
|
|
15559
|
+
_mod;
|
|
15560
|
+
constructor(ORDER, opts = {}) {
|
|
15561
|
+
if (ORDER <= modular_0n)
|
|
15562
|
+
throw new Error('invalid field: expected ORDER > 0, got ' + ORDER);
|
|
15563
|
+
let _nbitLength = undefined;
|
|
15564
|
+
this.isLE = false;
|
|
15565
|
+
if (opts != null && typeof opts === 'object') {
|
|
15566
|
+
if (typeof opts.BITS === 'number')
|
|
15567
|
+
_nbitLength = opts.BITS;
|
|
15568
|
+
if (typeof opts.sqrt === 'function')
|
|
15569
|
+
this.sqrt = opts.sqrt;
|
|
15570
|
+
if (typeof opts.isLE === 'boolean')
|
|
15571
|
+
this.isLE = opts.isLE;
|
|
15572
|
+
if (opts.allowedLengths)
|
|
15573
|
+
this._lengths = opts.allowedLengths?.slice();
|
|
15574
|
+
if (typeof opts.modFromBytes === 'boolean')
|
|
15575
|
+
this._mod = opts.modFromBytes;
|
|
15576
|
+
}
|
|
15577
|
+
const { nBitLength, nByteLength } = nLength(ORDER, _nbitLength);
|
|
15578
|
+
if (nByteLength > 2048)
|
|
15579
|
+
throw new Error('invalid field: expected ORDER of <= 2048 bytes');
|
|
15580
|
+
this.ORDER = ORDER;
|
|
15581
|
+
this.BITS = nBitLength;
|
|
15582
|
+
this.BYTES = nByteLength;
|
|
15583
|
+
this._sqrt = undefined;
|
|
15584
|
+
Object.preventExtensions(this);
|
|
15706
15585
|
}
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
|
|
15757
|
-
|
|
15758
|
-
|
|
15759
|
-
|
|
15760
|
-
|
|
15761
|
-
|
|
15762
|
-
|
|
15763
|
-
|
|
15764
|
-
|
|
15765
|
-
|
|
15586
|
+
create(num) {
|
|
15587
|
+
return mod(num, this.ORDER);
|
|
15588
|
+
}
|
|
15589
|
+
isValid(num) {
|
|
15590
|
+
if (typeof num !== 'bigint')
|
|
15591
|
+
throw new Error('invalid field element: expected bigint, got ' + typeof num);
|
|
15592
|
+
return modular_0n <= num && num < this.ORDER; // 0 is valid element, but it's not invertible
|
|
15593
|
+
}
|
|
15594
|
+
is0(num) {
|
|
15595
|
+
return num === modular_0n;
|
|
15596
|
+
}
|
|
15597
|
+
// is valid and invertible
|
|
15598
|
+
isValidNot0(num) {
|
|
15599
|
+
return !this.is0(num) && this.isValid(num);
|
|
15600
|
+
}
|
|
15601
|
+
isOdd(num) {
|
|
15602
|
+
return (num & modular_1n) === modular_1n;
|
|
15603
|
+
}
|
|
15604
|
+
neg(num) {
|
|
15605
|
+
return mod(-num, this.ORDER);
|
|
15606
|
+
}
|
|
15607
|
+
eql(lhs, rhs) {
|
|
15608
|
+
return lhs === rhs;
|
|
15609
|
+
}
|
|
15610
|
+
sqr(num) {
|
|
15611
|
+
return mod(num * num, this.ORDER);
|
|
15612
|
+
}
|
|
15613
|
+
add(lhs, rhs) {
|
|
15614
|
+
return mod(lhs + rhs, this.ORDER);
|
|
15615
|
+
}
|
|
15616
|
+
sub(lhs, rhs) {
|
|
15617
|
+
return mod(lhs - rhs, this.ORDER);
|
|
15618
|
+
}
|
|
15619
|
+
mul(lhs, rhs) {
|
|
15620
|
+
return mod(lhs * rhs, this.ORDER);
|
|
15621
|
+
}
|
|
15622
|
+
pow(num, power) {
|
|
15623
|
+
return FpPow(this, num, power);
|
|
15624
|
+
}
|
|
15625
|
+
div(lhs, rhs) {
|
|
15626
|
+
return mod(lhs * invert(rhs, this.ORDER), this.ORDER);
|
|
15627
|
+
}
|
|
15628
|
+
// Same as above, but doesn't normalize
|
|
15629
|
+
sqrN(num) {
|
|
15630
|
+
return num * num;
|
|
15631
|
+
}
|
|
15632
|
+
addN(lhs, rhs) {
|
|
15633
|
+
return lhs + rhs;
|
|
15634
|
+
}
|
|
15635
|
+
subN(lhs, rhs) {
|
|
15636
|
+
return lhs - rhs;
|
|
15637
|
+
}
|
|
15638
|
+
mulN(lhs, rhs) {
|
|
15639
|
+
return lhs * rhs;
|
|
15640
|
+
}
|
|
15641
|
+
inv(num) {
|
|
15642
|
+
return invert(num, this.ORDER);
|
|
15643
|
+
}
|
|
15644
|
+
sqrt(num) {
|
|
15645
|
+
// Caching _sqrt speeds up sqrt9mod16 by 5x and tonneli-shanks by 10%
|
|
15646
|
+
if (!this._sqrt)
|
|
15647
|
+
this._sqrt = FpSqrt(this.ORDER);
|
|
15648
|
+
return this._sqrt(this, num);
|
|
15649
|
+
}
|
|
15650
|
+
toBytes(num) {
|
|
15651
|
+
return this.isLE ? numberToBytesLE(num, this.BYTES) : numberToBytesBE(num, this.BYTES);
|
|
15652
|
+
}
|
|
15653
|
+
fromBytes(bytes, skipValidation = false) {
|
|
15654
|
+
utils_abytes(bytes);
|
|
15655
|
+
const { _lengths: allowedLengths, BYTES, isLE, ORDER, _mod: modFromBytes } = this;
|
|
15656
|
+
if (allowedLengths) {
|
|
15657
|
+
if (!allowedLengths.includes(bytes.length) || bytes.length > BYTES) {
|
|
15658
|
+
throw new Error('Field.fromBytes: expected ' + allowedLengths + ' bytes, got ' + bytes.length);
|
|
15766
15659
|
}
|
|
15767
|
-
|
|
15768
|
-
|
|
15769
|
-
|
|
15770
|
-
|
|
15771
|
-
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
|
|
15779
|
-
|
|
15780
|
-
|
|
15781
|
-
//
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15660
|
+
const padded = new Uint8Array(BYTES);
|
|
15661
|
+
// isLE add 0 to right, !isLE to the left.
|
|
15662
|
+
padded.set(bytes, isLE ? 0 : padded.length - bytes.length);
|
|
15663
|
+
bytes = padded;
|
|
15664
|
+
}
|
|
15665
|
+
if (bytes.length !== BYTES)
|
|
15666
|
+
throw new Error('Field.fromBytes: expected ' + BYTES + ' bytes, got ' + bytes.length);
|
|
15667
|
+
let scalar = isLE ? bytesToNumberLE(bytes) : utils_bytesToNumberBE(bytes);
|
|
15668
|
+
if (modFromBytes)
|
|
15669
|
+
scalar = mod(scalar, ORDER);
|
|
15670
|
+
if (!skipValidation)
|
|
15671
|
+
if (!this.isValid(scalar))
|
|
15672
|
+
throw new Error('invalid field element: outside of range 0..ORDER');
|
|
15673
|
+
// NOTE: we don't validate scalar here, please use isValid. This done such way because some
|
|
15674
|
+
// protocol may allow non-reduced scalar that reduced later or changed some other way.
|
|
15675
|
+
return scalar;
|
|
15676
|
+
}
|
|
15677
|
+
// TODO: we don't need it here, move out to separate fn
|
|
15678
|
+
invertBatch(lst) {
|
|
15679
|
+
return modular_FpInvertBatch(this, lst);
|
|
15680
|
+
}
|
|
15681
|
+
// We can't move this out because Fp6, Fp12 implement it
|
|
15682
|
+
// and it's unclear what to return in there.
|
|
15683
|
+
cmov(a, b, condition) {
|
|
15684
|
+
return condition ? b : a;
|
|
15685
|
+
}
|
|
15686
|
+
}
|
|
15687
|
+
/**
|
|
15688
|
+
* Creates a finite field. Major performance optimizations:
|
|
15689
|
+
* * 1. Denormalized operations like mulN instead of mul.
|
|
15690
|
+
* * 2. Identical object shape: never add or remove keys.
|
|
15691
|
+
* * 3. `Object.freeze`.
|
|
15692
|
+
* Fragile: always run a benchmark on a change.
|
|
15693
|
+
* Security note: operations don't check 'isValid' for all elements for performance reasons,
|
|
15694
|
+
* it is caller responsibility to check this.
|
|
15695
|
+
* This is low-level code, please make sure you know what you're doing.
|
|
15696
|
+
*
|
|
15697
|
+
* Note about field properties:
|
|
15698
|
+
* * CHARACTERISTIC p = prime number, number of elements in main subgroup.
|
|
15699
|
+
* * ORDER q = similar to cofactor in curves, may be composite `q = p^m`.
|
|
15700
|
+
*
|
|
15701
|
+
* @param ORDER field order, probably prime, or could be composite
|
|
15702
|
+
* @param bitLen how many bits the field consumes
|
|
15703
|
+
* @param isLE (default: false) if encoding / decoding should be in little-endian
|
|
15704
|
+
* @param redef optional faster redefinitions of sqrt and other methods
|
|
15705
|
+
*/
|
|
15706
|
+
function Field(ORDER, opts = {}) {
|
|
15707
|
+
return new _Field(ORDER, opts);
|
|
15786
15708
|
}
|
|
15787
15709
|
// Generic random scalar, we can do same for other fields if via Fp2.mul(Fp2.ONE, Fp2.random)?
|
|
15788
15710
|
// This allows unsafe methods like ignore bias or zero. These unsafe, but often used in different protocols (if deterministic RNG).
|
|
@@ -15809,21 +15731,6 @@ function FpSqrtEven(Fp, elm) {
|
|
|
15809
15731
|
const root = Fp.sqrt(elm);
|
|
15810
15732
|
return Fp.isOdd(root) ? Fp.neg(root) : root;
|
|
15811
15733
|
}
|
|
15812
|
-
/**
|
|
15813
|
-
* "Constant-time" private key generation utility.
|
|
15814
|
-
* Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field).
|
|
15815
|
-
* Which makes it slightly more biased, less secure.
|
|
15816
|
-
* @deprecated use `mapKeyToField` instead
|
|
15817
|
-
*/
|
|
15818
|
-
function hashToPrivateScalar(hash, groupOrder, isLE = false) {
|
|
15819
|
-
hash = ensureBytes('privateHash', hash);
|
|
15820
|
-
const hashLen = hash.length;
|
|
15821
|
-
const minLen = modular_nLength(groupOrder).nByteLength + 8;
|
|
15822
|
-
if (minLen < 24 || hashLen < minLen || hashLen > 1024)
|
|
15823
|
-
throw new Error('hashToPrivateScalar: expected ' + minLen + '-1024 bytes of input, got ' + hashLen);
|
|
15824
|
-
const num = isLE ? bytesToNumberLE(hash) : bytesToNumberBE(hash);
|
|
15825
|
-
return mod(num, groupOrder - modular_1n) + modular_1n;
|
|
15826
|
-
}
|
|
15827
15734
|
/**
|
|
15828
15735
|
* Returns total number of bytes consumed by the field element.
|
|
15829
15736
|
* For example, 32 bytes for usual 256-bit weierstrass curve.
|
|
@@ -15843,7 +15750,7 @@ function getFieldBytesLength(fieldOrder) {
|
|
|
15843
15750
|
* @param fieldOrder number of field elements, usually CURVE.n
|
|
15844
15751
|
* @returns byte length of target hash
|
|
15845
15752
|
*/
|
|
15846
|
-
function
|
|
15753
|
+
function modular_getMinHashLength(fieldOrder) {
|
|
15847
15754
|
const length = getFieldBytesLength(fieldOrder);
|
|
15848
15755
|
return length + Math.ceil(length / 2);
|
|
15849
15756
|
}
|
|
@@ -15856,24 +15763,25 @@ function getMinHashLength(fieldOrder) {
|
|
|
15856
15763
|
* FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final
|
|
15857
15764
|
* RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5
|
|
15858
15765
|
* @param hash hash output from SHA3 or a similar function
|
|
15859
|
-
* @param groupOrder size of subgroup - (e.g. secp256k1.
|
|
15766
|
+
* @param groupOrder size of subgroup - (e.g. secp256k1.Point.Fn.ORDER)
|
|
15860
15767
|
* @param isLE interpret hash bytes as LE num
|
|
15861
15768
|
* @returns valid private scalar
|
|
15862
15769
|
*/
|
|
15863
|
-
function
|
|
15770
|
+
function modular_mapHashToField(key, fieldOrder, isLE = false) {
|
|
15771
|
+
utils_abytes(key);
|
|
15864
15772
|
const len = key.length;
|
|
15865
15773
|
const fieldLen = getFieldBytesLength(fieldOrder);
|
|
15866
|
-
const minLen =
|
|
15774
|
+
const minLen = modular_getMinHashLength(fieldOrder);
|
|
15867
15775
|
// No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings.
|
|
15868
15776
|
if (len < 16 || len < minLen || len > 1024)
|
|
15869
15777
|
throw new Error('expected ' + minLen + '-1024 bytes of input, got ' + len);
|
|
15870
|
-
const num = isLE ?
|
|
15778
|
+
const num = isLE ? bytesToNumberLE(key) : utils_bytesToNumberBE(key);
|
|
15871
15779
|
// `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0
|
|
15872
15780
|
const reduced = mod(num, fieldOrder - modular_1n) + modular_1n;
|
|
15873
15781
|
return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
|
|
15874
15782
|
}
|
|
15875
15783
|
//# sourceMappingURL=modular.js.map
|
|
15876
|
-
;// ./node_modules/@noble/curves/
|
|
15784
|
+
;// ./node_modules/@noble/curves/abstract/curve.js
|
|
15877
15785
|
/**
|
|
15878
15786
|
* Methods for elliptic curve multiplication by scalars.
|
|
15879
15787
|
* Contains wNAF, pippenger.
|
|
@@ -15882,8 +15790,8 @@ function mapHashToField(key, fieldOrder, isLE = false) {
|
|
|
15882
15790
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
15883
15791
|
|
|
15884
15792
|
|
|
15885
|
-
const curve_0n = BigInt(0);
|
|
15886
|
-
const curve_1n = BigInt(1);
|
|
15793
|
+
const curve_0n = /* @__PURE__ */ BigInt(0);
|
|
15794
|
+
const curve_1n = /* @__PURE__ */ BigInt(1);
|
|
15887
15795
|
function negateCt(condition, item) {
|
|
15888
15796
|
const neg = item.negate();
|
|
15889
15797
|
return condition ? neg : item;
|
|
@@ -15982,6 +15890,10 @@ function assert0(n) {
|
|
|
15982
15890
|
* This would allow windows to be in different memory locations
|
|
15983
15891
|
*/
|
|
15984
15892
|
class wNAF {
|
|
15893
|
+
BASE;
|
|
15894
|
+
ZERO;
|
|
15895
|
+
Fn;
|
|
15896
|
+
bits;
|
|
15985
15897
|
// Parametrized with a given Point class (not individual point)
|
|
15986
15898
|
constructor(Point, bits) {
|
|
15987
15899
|
this.BASE = Point.BASE;
|
|
@@ -16158,13 +16070,14 @@ function mulEndoUnsafe(Point, point, k1, k2) {
|
|
|
16158
16070
|
* @param points array of L curve points
|
|
16159
16071
|
* @param scalars array of L scalars (aka secret keys / bigints)
|
|
16160
16072
|
*/
|
|
16161
|
-
function pippenger(c,
|
|
16073
|
+
function pippenger(c, points, scalars) {
|
|
16162
16074
|
// If we split scalars by some window (let's say 8 bits), every chunk will only
|
|
16163
16075
|
// take 256 buckets even if there are 4096 scalars, also re-uses double.
|
|
16164
16076
|
// TODO:
|
|
16165
16077
|
// - https://eprint.iacr.org/2024/750.pdf
|
|
16166
16078
|
// - https://tches.iacr.org/index.php/TCHES/article/view/10287
|
|
16167
16079
|
// 0 is accepted in scalars
|
|
16080
|
+
const fieldN = c.Fn;
|
|
16168
16081
|
validateMSMPoints(points, c);
|
|
16169
16082
|
validateMSMScalars(scalars, fieldN);
|
|
16170
16083
|
const plength = points.length;
|
|
@@ -16181,7 +16094,7 @@ function pippenger(c, fieldN, points, scalars) {
|
|
|
16181
16094
|
windowSize = wbits - 2;
|
|
16182
16095
|
else if (wbits > 0)
|
|
16183
16096
|
windowSize = 2;
|
|
16184
|
-
const MASK =
|
|
16097
|
+
const MASK = bitMask(windowSize);
|
|
16185
16098
|
const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array
|
|
16186
16099
|
const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize;
|
|
16187
16100
|
let sum = zero;
|
|
@@ -16212,7 +16125,7 @@ function pippenger(c, fieldN, points, scalars) {
|
|
|
16212
16125
|
* @param points array of L curve points
|
|
16213
16126
|
* @returns function which multiplies points with scaars
|
|
16214
16127
|
*/
|
|
16215
|
-
function precomputeMSMUnsafe(c,
|
|
16128
|
+
function precomputeMSMUnsafe(c, points, windowSize) {
|
|
16216
16129
|
/**
|
|
16217
16130
|
* Performance Analysis of Window-based Precomputation
|
|
16218
16131
|
*
|
|
@@ -16248,6 +16161,7 @@ function precomputeMSMUnsafe(c, fieldN, points, windowSize) {
|
|
|
16248
16161
|
* - Optimal for ~256 scalars
|
|
16249
16162
|
* - Less efficient for 4096+ scalars (Pippenger preferred)
|
|
16250
16163
|
*/
|
|
16164
|
+
const fieldN = c.Fn;
|
|
16251
16165
|
validateW(windowSize, fieldN.BITS);
|
|
16252
16166
|
validateMSMPoints(points, c);
|
|
16253
16167
|
const zero = c.ZERO;
|
|
@@ -16284,26 +16198,6 @@ function precomputeMSMUnsafe(c, fieldN, points, windowSize) {
|
|
|
16284
16198
|
return res;
|
|
16285
16199
|
};
|
|
16286
16200
|
}
|
|
16287
|
-
// TODO: remove
|
|
16288
|
-
/** @deprecated */
|
|
16289
|
-
function validateBasic(curve) {
|
|
16290
|
-
validateField(curve.Fp);
|
|
16291
|
-
validateObject(curve, {
|
|
16292
|
-
n: 'bigint',
|
|
16293
|
-
h: 'bigint',
|
|
16294
|
-
Gx: 'field',
|
|
16295
|
-
Gy: 'field',
|
|
16296
|
-
}, {
|
|
16297
|
-
nBitLength: 'isSafeInteger',
|
|
16298
|
-
nByteLength: 'isSafeInteger',
|
|
16299
|
-
});
|
|
16300
|
-
// Set defaults
|
|
16301
|
-
return Object.freeze({
|
|
16302
|
-
...nLength(curve.n, curve.nBitLength),
|
|
16303
|
-
...curve,
|
|
16304
|
-
...{ p: curve.Fp.ORDER },
|
|
16305
|
-
});
|
|
16306
|
-
}
|
|
16307
16201
|
function createField(order, field, isLE) {
|
|
16308
16202
|
if (field) {
|
|
16309
16203
|
if (field.ORDER !== order)
|
|
@@ -16316,7 +16210,7 @@ function createField(order, field, isLE) {
|
|
|
16316
16210
|
}
|
|
16317
16211
|
}
|
|
16318
16212
|
/** Validates CURVE opts and creates fields */
|
|
16319
|
-
function
|
|
16213
|
+
function createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {
|
|
16320
16214
|
if (FpFnLE === undefined)
|
|
16321
16215
|
FpFnLE = type === 'edwards';
|
|
16322
16216
|
if (!CURVE || typeof CURVE !== 'object')
|
|
@@ -16338,8 +16232,14 @@ function _createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {
|
|
|
16338
16232
|
CURVE = Object.freeze(Object.assign({}, CURVE));
|
|
16339
16233
|
return { CURVE, Fp, Fn };
|
|
16340
16234
|
}
|
|
16235
|
+
function curve_createKeygen(randomSecretKey, getPublicKey) {
|
|
16236
|
+
return function keygen(seed) {
|
|
16237
|
+
const secretKey = randomSecretKey(seed);
|
|
16238
|
+
return { secretKey, publicKey: getPublicKey(secretKey) };
|
|
16239
|
+
};
|
|
16240
|
+
}
|
|
16341
16241
|
//# sourceMappingURL=curve.js.map
|
|
16342
|
-
;// ./node_modules/@noble/curves/
|
|
16242
|
+
;// ./node_modules/@noble/curves/abstract/weierstrass.js
|
|
16343
16243
|
/**
|
|
16344
16244
|
* Short Weierstrass curve methods. The formula is: y² = x³ + ax + b.
|
|
16345
16245
|
*
|
|
@@ -16396,7 +16296,7 @@ function _splitEndoScalar(k, basis, n) {
|
|
|
16396
16296
|
k2 = -k2;
|
|
16397
16297
|
// Double check that resulting scalar less than half bits of N: otherwise wNAF will fail.
|
|
16398
16298
|
// This should only happen on wrong basises. Also, math inside is too complex and I don't trust it.
|
|
16399
|
-
const MAX_NUM = utils_bitMask(Math.ceil(
|
|
16299
|
+
const MAX_NUM = utils_bitMask(Math.ceil(utils_bitLen(n) / 2)) + weierstrass_1n; // Half bits of N
|
|
16400
16300
|
if (k1 < weierstrass_0n || k1 >= MAX_NUM || k2 < weierstrass_0n || k2 >= MAX_NUM) {
|
|
16401
16301
|
throw new Error('splitScalar (endomorphism): failed, k=' + k);
|
|
16402
16302
|
}
|
|
@@ -16413,8 +16313,8 @@ function validateSigOpts(opts, def) {
|
|
|
16413
16313
|
// @ts-ignore
|
|
16414
16314
|
optsn[optName] = opts[optName] === undefined ? def[optName] : opts[optName];
|
|
16415
16315
|
}
|
|
16416
|
-
|
|
16417
|
-
|
|
16316
|
+
abool(optsn.lowS, 'lowS');
|
|
16317
|
+
abool(optsn.prehash, 'prehash');
|
|
16418
16318
|
if (optsn.format !== undefined)
|
|
16419
16319
|
validateSigFormat(optsn.format);
|
|
16420
16320
|
return optsn;
|
|
@@ -16444,10 +16344,10 @@ const DER = {
|
|
|
16444
16344
|
throw new E('tlv.encode: unpadded data');
|
|
16445
16345
|
const dataLen = data.length / 2;
|
|
16446
16346
|
const len = numberToHexUnpadded(dataLen);
|
|
16447
|
-
if ((len.length / 2) &
|
|
16347
|
+
if ((len.length / 2) & 0b1000_0000)
|
|
16448
16348
|
throw new E('tlv.encode: long form length too big');
|
|
16449
16349
|
// length of length with long form flag
|
|
16450
|
-
const lenLen = dataLen > 127 ? numberToHexUnpadded((len.length / 2) |
|
|
16350
|
+
const lenLen = dataLen > 127 ? numberToHexUnpadded((len.length / 2) | 0b1000_0000) : '';
|
|
16451
16351
|
const t = numberToHexUnpadded(tag);
|
|
16452
16352
|
return t + lenLen + len + data;
|
|
16453
16353
|
},
|
|
@@ -16460,13 +16360,13 @@ const DER = {
|
|
|
16460
16360
|
if (data.length < 2 || data[pos++] !== tag)
|
|
16461
16361
|
throw new E('tlv.decode: wrong tlv');
|
|
16462
16362
|
const first = data[pos++];
|
|
16463
|
-
const isLong = !!(first &
|
|
16363
|
+
const isLong = !!(first & 0b1000_0000); // First bit of first length byte is flag for short/long form
|
|
16464
16364
|
let length = 0;
|
|
16465
16365
|
if (!isLong)
|
|
16466
16366
|
length = first;
|
|
16467
16367
|
else {
|
|
16468
16368
|
// Long form: [longFlag(1bit), lengthLength(7bit), length (BE)]
|
|
16469
|
-
const lenLen = first &
|
|
16369
|
+
const lenLen = first & 0b0111_1111;
|
|
16470
16370
|
if (!lenLen)
|
|
16471
16371
|
throw new E('tlv.decode(long): indefinite length not supported');
|
|
16472
16372
|
if (lenLen > 4)
|
|
@@ -16507,17 +16407,17 @@ const DER = {
|
|
|
16507
16407
|
},
|
|
16508
16408
|
decode(data) {
|
|
16509
16409
|
const { Err: E } = DER;
|
|
16510
|
-
if (data[0] &
|
|
16410
|
+
if (data[0] & 0b1000_0000)
|
|
16511
16411
|
throw new E('invalid signature integer: negative');
|
|
16512
|
-
if (data[0] === 0x00 && !(data[1] &
|
|
16412
|
+
if (data[0] === 0x00 && !(data[1] & 0b1000_0000))
|
|
16513
16413
|
throw new E('invalid signature integer: unnecessary leading zero');
|
|
16514
16414
|
return utils_bytesToNumberBE(data);
|
|
16515
16415
|
},
|
|
16516
16416
|
},
|
|
16517
|
-
toSig(
|
|
16417
|
+
toSig(bytes) {
|
|
16518
16418
|
// parse DER signature
|
|
16519
16419
|
const { Err: E, _int: int, _tlv: tlv } = DER;
|
|
16520
|
-
const data =
|
|
16420
|
+
const data = utils_abytes(bytes, undefined, 'signature');
|
|
16521
16421
|
const { v: seqBytes, l: seqLeftBytes } = tlv.decode(0x30, data);
|
|
16522
16422
|
if (seqLeftBytes.length)
|
|
16523
16423
|
throw new E('invalid signature: left bytes after parsing');
|
|
@@ -16538,55 +16438,37 @@ const DER = {
|
|
|
16538
16438
|
// Be friendly to bad ECMAScript parsers by not using bigint literals
|
|
16539
16439
|
// prettier-ignore
|
|
16540
16440
|
const weierstrass_0n = BigInt(0), weierstrass_1n = BigInt(1), weierstrass_2n = BigInt(2), weierstrass_3n = BigInt(3), weierstrass_4n = BigInt(4);
|
|
16541
|
-
function _normFnElement(Fn, key) {
|
|
16542
|
-
const { BYTES: expected } = Fn;
|
|
16543
|
-
let num;
|
|
16544
|
-
if (typeof key === 'bigint') {
|
|
16545
|
-
num = key;
|
|
16546
|
-
}
|
|
16547
|
-
else {
|
|
16548
|
-
let bytes = utils_ensureBytes('private key', key);
|
|
16549
|
-
try {
|
|
16550
|
-
num = Fn.fromBytes(bytes);
|
|
16551
|
-
}
|
|
16552
|
-
catch (error) {
|
|
16553
|
-
throw new Error(`invalid private key: expected ui8a of size ${expected}, got ${typeof key}`);
|
|
16554
|
-
}
|
|
16555
|
-
}
|
|
16556
|
-
if (!Fn.isValidNot0(num))
|
|
16557
|
-
throw new Error('invalid private key: out of range [1..N-1]');
|
|
16558
|
-
return num;
|
|
16559
|
-
}
|
|
16560
16441
|
/**
|
|
16561
16442
|
* Creates weierstrass Point constructor, based on specified curve options.
|
|
16562
16443
|
*
|
|
16444
|
+
* See {@link WeierstrassOpts}.
|
|
16445
|
+
*
|
|
16563
16446
|
* @example
|
|
16564
16447
|
```js
|
|
16565
16448
|
const opts = {
|
|
16566
|
-
p:
|
|
16567
|
-
n:
|
|
16568
|
-
h:
|
|
16569
|
-
a:
|
|
16570
|
-
b:
|
|
16571
|
-
Gx:
|
|
16572
|
-
Gy:
|
|
16449
|
+
p: 0xfffffffffffffffffffffffffffffffeffffac73n,
|
|
16450
|
+
n: 0x100000000000000000001b8fa16dfab9aca16b6b3n,
|
|
16451
|
+
h: 1n,
|
|
16452
|
+
a: 0n,
|
|
16453
|
+
b: 7n,
|
|
16454
|
+
Gx: 0x3b4c382ce37aa192a4019e763036f4f5dd4d7ebbn,
|
|
16455
|
+
Gy: 0x938cf935318fdced6bc28286531733c3f03c4feen,
|
|
16573
16456
|
};
|
|
16574
|
-
const
|
|
16457
|
+
const secp160k1_Point = weierstrass(opts);
|
|
16575
16458
|
```
|
|
16576
16459
|
*/
|
|
16577
|
-
function
|
|
16578
|
-
const validated =
|
|
16460
|
+
function weierstrass(params, extraOpts = {}) {
|
|
16461
|
+
const validated = createCurveFields('weierstrass', params, extraOpts);
|
|
16579
16462
|
const { Fp, Fn } = validated;
|
|
16580
16463
|
let CURVE = validated.CURVE;
|
|
16581
16464
|
const { h: cofactor, n: CURVE_ORDER } = CURVE;
|
|
16582
|
-
|
|
16465
|
+
utils_validateObject(extraOpts, {}, {
|
|
16583
16466
|
allowInfinityPoint: 'boolean',
|
|
16584
16467
|
clearCofactor: 'function',
|
|
16585
16468
|
isTorsionFree: 'function',
|
|
16586
16469
|
fromBytes: 'function',
|
|
16587
16470
|
toBytes: 'function',
|
|
16588
16471
|
endo: 'object',
|
|
16589
|
-
wrapPrivateKey: 'boolean',
|
|
16590
16472
|
});
|
|
16591
16473
|
const { endo } = extraOpts;
|
|
16592
16474
|
if (endo) {
|
|
@@ -16604,18 +16486,18 @@ function weierstrassN(params, extraOpts = {}) {
|
|
|
16604
16486
|
function pointToBytes(_c, point, isCompressed) {
|
|
16605
16487
|
const { x, y } = point.toAffine();
|
|
16606
16488
|
const bx = Fp.toBytes(x);
|
|
16607
|
-
|
|
16489
|
+
utils_abool(isCompressed, 'isCompressed');
|
|
16608
16490
|
if (isCompressed) {
|
|
16609
16491
|
assertCompressionIsSupported();
|
|
16610
16492
|
const hasEvenY = !Fp.isOdd(y);
|
|
16611
|
-
return
|
|
16493
|
+
return utils_concatBytes(pprefix(hasEvenY), bx);
|
|
16612
16494
|
}
|
|
16613
16495
|
else {
|
|
16614
|
-
return
|
|
16496
|
+
return utils_concatBytes(Uint8Array.of(0x04), bx, Fp.toBytes(y));
|
|
16615
16497
|
}
|
|
16616
16498
|
}
|
|
16617
16499
|
function pointFromBytes(bytes) {
|
|
16618
|
-
|
|
16500
|
+
utils_abytes(bytes, undefined, 'Point');
|
|
16619
16501
|
const { publicKey: comp, publicKeyUncompressed: uncomp } = lengths; // e.g. for 32-byte: 33, 65
|
|
16620
16502
|
const length = bytes.length;
|
|
16621
16503
|
const head = bytes[0];
|
|
@@ -16635,9 +16517,9 @@ function weierstrassN(params, extraOpts = {}) {
|
|
|
16635
16517
|
throw new Error('bad point: is not on curve, sqrt error' + err);
|
|
16636
16518
|
}
|
|
16637
16519
|
assertCompressionIsSupported();
|
|
16638
|
-
const
|
|
16639
|
-
const
|
|
16640
|
-
if (
|
|
16520
|
+
const evenY = Fp.isOdd(y);
|
|
16521
|
+
const evenH = (head & 1) === 1; // ECDSA-specific
|
|
16522
|
+
if (evenH !== evenY)
|
|
16641
16523
|
y = Fp.neg(y);
|
|
16642
16524
|
return { x, y };
|
|
16643
16525
|
}
|
|
@@ -16686,7 +16568,7 @@ function weierstrassN(params, extraOpts = {}) {
|
|
|
16686
16568
|
}
|
|
16687
16569
|
function aprjpoint(other) {
|
|
16688
16570
|
if (!(other instanceof Point))
|
|
16689
|
-
throw new Error('
|
|
16571
|
+
throw new Error('Weierstrass Point expected');
|
|
16690
16572
|
}
|
|
16691
16573
|
function splitEndoScalarN(k) {
|
|
16692
16574
|
if (!endo || !endo.basises)
|
|
@@ -16749,6 +16631,17 @@ function weierstrassN(params, extraOpts = {}) {
|
|
|
16749
16631
|
* We're doing calculations in projective, because its operations don't require costly inversion.
|
|
16750
16632
|
*/
|
|
16751
16633
|
class Point {
|
|
16634
|
+
// base / generator point
|
|
16635
|
+
static BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);
|
|
16636
|
+
// zero / infinity / identity point
|
|
16637
|
+
static ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0
|
|
16638
|
+
// math field
|
|
16639
|
+
static Fp = Fp;
|
|
16640
|
+
// scalar field
|
|
16641
|
+
static Fn = Fn;
|
|
16642
|
+
X;
|
|
16643
|
+
Y;
|
|
16644
|
+
Z;
|
|
16752
16645
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
16753
16646
|
constructor(X, Y, Z) {
|
|
16754
16647
|
this.X = acoord('x', X);
|
|
@@ -16772,12 +16665,12 @@ function weierstrassN(params, extraOpts = {}) {
|
|
|
16772
16665
|
return new Point(x, y, Fp.ONE);
|
|
16773
16666
|
}
|
|
16774
16667
|
static fromBytes(bytes) {
|
|
16775
|
-
const P = Point.fromAffine(decodePoint(
|
|
16668
|
+
const P = Point.fromAffine(decodePoint(utils_abytes(bytes, undefined, 'point')));
|
|
16776
16669
|
P.assertValidity();
|
|
16777
16670
|
return P;
|
|
16778
16671
|
}
|
|
16779
16672
|
static fromHex(hex) {
|
|
16780
|
-
return Point.fromBytes(
|
|
16673
|
+
return Point.fromBytes(utils_hexToBytes(hex));
|
|
16781
16674
|
}
|
|
16782
16675
|
get x() {
|
|
16783
16676
|
return this.toAffine().x;
|
|
@@ -16964,11 +16857,13 @@ function weierstrassN(params, extraOpts = {}) {
|
|
|
16964
16857
|
if (!Fn.isValid(sc))
|
|
16965
16858
|
throw new Error('invalid scalar: out of range'); // 0 is valid
|
|
16966
16859
|
if (sc === weierstrass_0n || p.is0())
|
|
16967
|
-
return Point.ZERO;
|
|
16860
|
+
return Point.ZERO; // 0
|
|
16968
16861
|
if (sc === weierstrass_1n)
|
|
16969
|
-
return p; //
|
|
16862
|
+
return p; // 1
|
|
16970
16863
|
if (wnaf.hasCache(this))
|
|
16971
|
-
return this.multiply(sc);
|
|
16864
|
+
return this.multiply(sc); // precomputes
|
|
16865
|
+
// We don't have method for double scalar multiplication (aP + bQ):
|
|
16866
|
+
// Even with using Strauss-Shamir trick, it's 35% slower than naïve mul+add.
|
|
16972
16867
|
if (endo) {
|
|
16973
16868
|
const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(sc);
|
|
16974
16869
|
const { p1, p2 } = mulEndoUnsafe(Point, p, k1, k2); // 30% faster vs wnaf.unsafe
|
|
@@ -16978,10 +16873,6 @@ function weierstrassN(params, extraOpts = {}) {
|
|
|
16978
16873
|
return wnaf.unsafe(p, sc);
|
|
16979
16874
|
}
|
|
16980
16875
|
}
|
|
16981
|
-
multiplyAndAddUnsafe(Q, a, b) {
|
|
16982
|
-
const sum = this.multiplyUnsafe(a).add(Q.multiplyUnsafe(b));
|
|
16983
|
-
return sum.is0() ? undefined : sum;
|
|
16984
|
-
}
|
|
16985
16876
|
/**
|
|
16986
16877
|
* Converts Projective point to affine (x, y) coordinates.
|
|
16987
16878
|
* @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
|
|
@@ -17014,50 +16905,17 @@ function weierstrassN(params, extraOpts = {}) {
|
|
|
17014
16905
|
return this.multiplyUnsafe(cofactor).is0();
|
|
17015
16906
|
}
|
|
17016
16907
|
toBytes(isCompressed = true) {
|
|
17017
|
-
|
|
16908
|
+
utils_abool(isCompressed, 'isCompressed');
|
|
17018
16909
|
this.assertValidity();
|
|
17019
16910
|
return encodePoint(Point, this, isCompressed);
|
|
17020
16911
|
}
|
|
17021
16912
|
toHex(isCompressed = true) {
|
|
17022
|
-
return
|
|
16913
|
+
return utils_bytesToHex(this.toBytes(isCompressed));
|
|
17023
16914
|
}
|
|
17024
16915
|
toString() {
|
|
17025
16916
|
return `<Point ${this.is0() ? 'ZERO' : this.toHex()}>`;
|
|
17026
16917
|
}
|
|
17027
|
-
// TODO: remove
|
|
17028
|
-
get px() {
|
|
17029
|
-
return this.X;
|
|
17030
|
-
}
|
|
17031
|
-
get py() {
|
|
17032
|
-
return this.X;
|
|
17033
|
-
}
|
|
17034
|
-
get pz() {
|
|
17035
|
-
return this.Z;
|
|
17036
|
-
}
|
|
17037
|
-
toRawBytes(isCompressed = true) {
|
|
17038
|
-
return this.toBytes(isCompressed);
|
|
17039
|
-
}
|
|
17040
|
-
_setWindowSize(windowSize) {
|
|
17041
|
-
this.precompute(windowSize);
|
|
17042
|
-
}
|
|
17043
|
-
static normalizeZ(points) {
|
|
17044
|
-
return normalizeZ(Point, points);
|
|
17045
|
-
}
|
|
17046
|
-
static msm(points, scalars) {
|
|
17047
|
-
return pippenger(Point, Fn, points, scalars);
|
|
17048
|
-
}
|
|
17049
|
-
static fromPrivateKey(privateKey) {
|
|
17050
|
-
return Point.BASE.multiply(_normFnElement(Fn, privateKey));
|
|
17051
|
-
}
|
|
17052
16918
|
}
|
|
17053
|
-
// base / generator point
|
|
17054
|
-
Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);
|
|
17055
|
-
// zero / infinity / identity point
|
|
17056
|
-
Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0
|
|
17057
|
-
// math field
|
|
17058
|
-
Point.Fp = Fp;
|
|
17059
|
-
// scalar field
|
|
17060
|
-
Point.Fn = Fn;
|
|
17061
16919
|
const bits = Fn.BITS;
|
|
17062
16920
|
const wnaf = new wNAF(Point, extraOpts.endo ? Math.ceil(bits / 2) : bits);
|
|
17063
16921
|
Point.BASE.precompute(8); // Enable precomputes. Slows down first publicKey computation by 20ms.
|
|
@@ -17206,11 +17064,12 @@ function getWLengths(Fp, Fn) {
|
|
|
17206
17064
|
*/
|
|
17207
17065
|
function ecdh(Point, ecdhOpts = {}) {
|
|
17208
17066
|
const { Fn } = Point;
|
|
17209
|
-
const randomBytes_ = ecdhOpts.randomBytes ||
|
|
17067
|
+
const randomBytes_ = ecdhOpts.randomBytes || wcRandomBytes;
|
|
17210
17068
|
const lengths = Object.assign(getWLengths(Point.Fp, Fn), { seed: getMinHashLength(Fn.ORDER) });
|
|
17211
17069
|
function isValidSecretKey(secretKey) {
|
|
17212
17070
|
try {
|
|
17213
|
-
|
|
17071
|
+
const num = Fn.fromBytes(secretKey);
|
|
17072
|
+
return Fn.isValidNot0(num);
|
|
17214
17073
|
}
|
|
17215
17074
|
catch (error) {
|
|
17216
17075
|
return false;
|
|
@@ -17235,7 +17094,7 @@ function ecdh(Point, ecdhOpts = {}) {
|
|
|
17235
17094
|
* (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.
|
|
17236
17095
|
*/
|
|
17237
17096
|
function randomSecretKey(seed = randomBytes_(lengths.seed)) {
|
|
17238
|
-
return mapHashToField(
|
|
17097
|
+
return mapHashToField(abytes(seed, lengths.seed, 'seed'), Fn.ORDER);
|
|
17239
17098
|
}
|
|
17240
17099
|
/**
|
|
17241
17100
|
* Computes public key for a secret key. Checks for validity of the secret key.
|
|
@@ -17243,24 +17102,18 @@ function ecdh(Point, ecdhOpts = {}) {
|
|
|
17243
17102
|
* @returns Public key, full when isCompressed=false; short when isCompressed=true
|
|
17244
17103
|
*/
|
|
17245
17104
|
function getPublicKey(secretKey, isCompressed = true) {
|
|
17246
|
-
return Point.BASE.multiply(
|
|
17247
|
-
}
|
|
17248
|
-
function keygen(seed) {
|
|
17249
|
-
const secretKey = randomSecretKey(seed);
|
|
17250
|
-
return { secretKey, publicKey: getPublicKey(secretKey) };
|
|
17105
|
+
return Point.BASE.multiply(Fn.fromBytes(secretKey)).toBytes(isCompressed);
|
|
17251
17106
|
}
|
|
17252
17107
|
/**
|
|
17253
17108
|
* Quick and dirty check for item being public key. Does not validate hex, or being on-curve.
|
|
17254
17109
|
*/
|
|
17255
17110
|
function isProbPub(item) {
|
|
17256
|
-
if (typeof item === 'bigint')
|
|
17257
|
-
return false;
|
|
17258
|
-
if (item instanceof Point)
|
|
17259
|
-
return true;
|
|
17260
17111
|
const { secretKey, publicKey, publicKeyUncompressed } = lengths;
|
|
17261
|
-
if (
|
|
17112
|
+
if (!isBytes(item))
|
|
17113
|
+
return undefined;
|
|
17114
|
+
if (('_lengths' in Fn && Fn._lengths) || secretKey === publicKey)
|
|
17262
17115
|
return undefined;
|
|
17263
|
-
const l =
|
|
17116
|
+
const l = abytes(item, undefined, 'key').length;
|
|
17264
17117
|
return l === publicKey || l === publicKeyUncompressed;
|
|
17265
17118
|
}
|
|
17266
17119
|
/**
|
|
@@ -17276,31 +17129,24 @@ function ecdh(Point, ecdhOpts = {}) {
|
|
|
17276
17129
|
throw new Error('first arg must be private key');
|
|
17277
17130
|
if (isProbPub(publicKeyB) === false)
|
|
17278
17131
|
throw new Error('second arg must be public key');
|
|
17279
|
-
const s =
|
|
17280
|
-
const b = Point.
|
|
17132
|
+
const s = Fn.fromBytes(secretKeyA);
|
|
17133
|
+
const b = Point.fromBytes(publicKeyB); // checks for being on-curve
|
|
17281
17134
|
return b.multiply(s).toBytes(isCompressed);
|
|
17282
17135
|
}
|
|
17283
17136
|
const utils = {
|
|
17284
17137
|
isValidSecretKey,
|
|
17285
17138
|
isValidPublicKey,
|
|
17286
17139
|
randomSecretKey,
|
|
17287
|
-
// TODO: remove
|
|
17288
|
-
isValidPrivateKey: isValidSecretKey,
|
|
17289
|
-
randomPrivateKey: randomSecretKey,
|
|
17290
|
-
normPrivateKeyToScalar: (key) => _normFnElement(Fn, key),
|
|
17291
|
-
precompute(windowSize = 8, point = Point.BASE) {
|
|
17292
|
-
return point.precompute(windowSize, false);
|
|
17293
|
-
},
|
|
17294
17140
|
};
|
|
17141
|
+
const keygen = createKeygen(randomSecretKey, getPublicKey);
|
|
17295
17142
|
return Object.freeze({ getPublicKey, getSharedSecret, keygen, Point, utils, lengths });
|
|
17296
17143
|
}
|
|
17297
17144
|
/**
|
|
17298
17145
|
* Creates ECDSA signing interface for given elliptic curve `Point` and `hash` function.
|
|
17299
|
-
* We need `hash` for 2 features:
|
|
17300
|
-
* 1. Message prehash-ing. NOT used if `sign` / `verify` are called with `prehash: false`
|
|
17301
|
-
* 2. k generation in `sign`, using HMAC-drbg(hash)
|
|
17302
17146
|
*
|
|
17303
|
-
*
|
|
17147
|
+
* @param Point created using {@link weierstrass} function
|
|
17148
|
+
* @param hash used for 1) message prehash-ing 2) k generation in `sign`, using hmac_drbg(hash)
|
|
17149
|
+
* @param ecdsaOpts rarely needed, see {@link ECDSAOpts}
|
|
17304
17150
|
*
|
|
17305
17151
|
* @example
|
|
17306
17152
|
* ```js
|
|
@@ -17310,28 +17156,28 @@ function ecdh(Point, ecdhOpts = {}) {
|
|
|
17310
17156
|
* const p256_sha224_r = ecdsa(p256_Point, sha224, { randomBytes: (length) => { ... } });
|
|
17311
17157
|
* ```
|
|
17312
17158
|
*/
|
|
17313
|
-
function
|
|
17159
|
+
function weierstrass_ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
17314
17160
|
ahash(hash);
|
|
17315
|
-
|
|
17161
|
+
validateObject(ecdsaOpts, {}, {
|
|
17316
17162
|
hmac: 'function',
|
|
17317
17163
|
lowS: 'boolean',
|
|
17318
17164
|
randomBytes: 'function',
|
|
17319
17165
|
bits2int: 'function',
|
|
17320
17166
|
bits2int_modN: 'function',
|
|
17321
17167
|
});
|
|
17322
|
-
|
|
17323
|
-
const
|
|
17324
|
-
|
|
17168
|
+
ecdsaOpts = Object.assign({}, ecdsaOpts);
|
|
17169
|
+
const randomBytes = ecdsaOpts.randomBytes || wcRandomBytes;
|
|
17170
|
+
const hmac = ecdsaOpts.hmac || ((key, msg) => nobleHmac(hash, key, msg));
|
|
17325
17171
|
const { Fp, Fn } = Point;
|
|
17326
17172
|
const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn;
|
|
17327
17173
|
const { keygen, getPublicKey, getSharedSecret, utils, lengths } = ecdh(Point, ecdsaOpts);
|
|
17328
17174
|
const defaultSigOpts = {
|
|
17329
|
-
prehash:
|
|
17330
|
-
lowS: typeof ecdsaOpts.lowS === 'boolean' ? ecdsaOpts.lowS :
|
|
17331
|
-
format:
|
|
17175
|
+
prehash: true,
|
|
17176
|
+
lowS: typeof ecdsaOpts.lowS === 'boolean' ? ecdsaOpts.lowS : true,
|
|
17177
|
+
format: 'compact',
|
|
17332
17178
|
extraEntropy: false,
|
|
17333
17179
|
};
|
|
17334
|
-
const
|
|
17180
|
+
const hasLargeCofactor = CURVE_ORDER * weierstrass_2n < Fp.ORDER; // Won't CURVE().h > 2n be more effective?
|
|
17335
17181
|
function isBiggerThanHalfOrder(number) {
|
|
17336
17182
|
const HALF = CURVE_ORDER >> weierstrass_1n;
|
|
17337
17183
|
return number > HALF;
|
|
@@ -17341,28 +17187,47 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17341
17187
|
throw new Error(`invalid signature ${title}: out of range 1..Point.Fn.ORDER`);
|
|
17342
17188
|
return num;
|
|
17343
17189
|
}
|
|
17190
|
+
function assertSmallCofactor() {
|
|
17191
|
+
// ECDSA recovery is hard for cofactor > 1 curves.
|
|
17192
|
+
// In sign, `r = q.x mod n`, and here we recover q.x from r.
|
|
17193
|
+
// While recovering q.x >= n, we need to add r+n for cofactor=1 curves.
|
|
17194
|
+
// However, for cofactor>1, r+n may not get q.x:
|
|
17195
|
+
// r+n*i would need to be done instead where i is unknown.
|
|
17196
|
+
// To easily get i, we either need to:
|
|
17197
|
+
// a. increase amount of valid recid values (4, 5...); OR
|
|
17198
|
+
// b. prohibit non-prime-order signatures (recid > 1).
|
|
17199
|
+
if (hasLargeCofactor)
|
|
17200
|
+
throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
|
|
17201
|
+
}
|
|
17344
17202
|
function validateSigLength(bytes, format) {
|
|
17345
17203
|
validateSigFormat(format);
|
|
17346
17204
|
const size = lengths.signature;
|
|
17347
17205
|
const sizer = format === 'compact' ? size : format === 'recovered' ? size + 1 : undefined;
|
|
17348
|
-
return
|
|
17206
|
+
return abytes(bytes, sizer);
|
|
17349
17207
|
}
|
|
17350
17208
|
/**
|
|
17351
17209
|
* ECDSA signature with its (r, s) properties. Supports compact, recovered & DER representations.
|
|
17352
17210
|
*/
|
|
17353
17211
|
class Signature {
|
|
17212
|
+
r;
|
|
17213
|
+
s;
|
|
17214
|
+
recovery;
|
|
17354
17215
|
constructor(r, s, recovery) {
|
|
17355
17216
|
this.r = validateRS('r', r); // r in [1..N-1];
|
|
17356
17217
|
this.s = validateRS('s', s); // s in [1..N-1];
|
|
17357
|
-
if (recovery != null)
|
|
17218
|
+
if (recovery != null) {
|
|
17219
|
+
assertSmallCofactor();
|
|
17220
|
+
if (![0, 1, 2, 3].includes(recovery))
|
|
17221
|
+
throw new Error('invalid recovery id');
|
|
17358
17222
|
this.recovery = recovery;
|
|
17223
|
+
}
|
|
17359
17224
|
Object.freeze(this);
|
|
17360
17225
|
}
|
|
17361
|
-
static fromBytes(bytes, format =
|
|
17226
|
+
static fromBytes(bytes, format = defaultSigOpts.format) {
|
|
17362
17227
|
validateSigLength(bytes, format);
|
|
17363
17228
|
let recid;
|
|
17364
17229
|
if (format === 'der') {
|
|
17365
|
-
const { r, s } = DER.toSig(
|
|
17230
|
+
const { r, s } = DER.toSig(abytes(bytes));
|
|
17366
17231
|
return new Signature(r, s);
|
|
17367
17232
|
}
|
|
17368
17233
|
if (format === 'recovered') {
|
|
@@ -17370,7 +17235,7 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17370
17235
|
format = 'compact';
|
|
17371
17236
|
bytes = bytes.subarray(1);
|
|
17372
17237
|
}
|
|
17373
|
-
const L =
|
|
17238
|
+
const L = lengths.signature / 2;
|
|
17374
17239
|
const r = bytes.subarray(0, L);
|
|
17375
17240
|
const s = bytes.subarray(L, L * 2);
|
|
17376
17241
|
return new Signature(Fn.fromBytes(r), Fn.fromBytes(s), recid);
|
|
@@ -17378,38 +17243,31 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17378
17243
|
static fromHex(hex, format) {
|
|
17379
17244
|
return this.fromBytes(hexToBytes(hex), format);
|
|
17380
17245
|
}
|
|
17246
|
+
assertRecovery() {
|
|
17247
|
+
const { recovery } = this;
|
|
17248
|
+
if (recovery == null)
|
|
17249
|
+
throw new Error('invalid recovery id: must be present');
|
|
17250
|
+
return recovery;
|
|
17251
|
+
}
|
|
17381
17252
|
addRecoveryBit(recovery) {
|
|
17382
17253
|
return new Signature(this.r, this.s, recovery);
|
|
17383
17254
|
}
|
|
17384
17255
|
recoverPublicKey(messageHash) {
|
|
17385
|
-
const
|
|
17386
|
-
const
|
|
17387
|
-
|
|
17388
|
-
throw new Error('recovery id invalid');
|
|
17389
|
-
// ECDSA recovery is hard for cofactor > 1 curves.
|
|
17390
|
-
// In sign, `r = q.x mod n`, and here we recover q.x from r.
|
|
17391
|
-
// While recovering q.x >= n, we need to add r+n for cofactor=1 curves.
|
|
17392
|
-
// However, for cofactor>1, r+n may not get q.x:
|
|
17393
|
-
// r+n*i would need to be done instead where i is unknown.
|
|
17394
|
-
// To easily get i, we either need to:
|
|
17395
|
-
// a. increase amount of valid recid values (4, 5...); OR
|
|
17396
|
-
// b. prohibit non-prime-order signatures (recid > 1).
|
|
17397
|
-
const hasCofactor = CURVE_ORDER * weierstrass_2n < FIELD_ORDER;
|
|
17398
|
-
if (hasCofactor && rec > 1)
|
|
17399
|
-
throw new Error('recovery id is ambiguous for h>1 curve');
|
|
17400
|
-
const radj = rec === 2 || rec === 3 ? r + CURVE_ORDER : r;
|
|
17256
|
+
const { r, s } = this;
|
|
17257
|
+
const recovery = this.assertRecovery();
|
|
17258
|
+
const radj = recovery === 2 || recovery === 3 ? r + CURVE_ORDER : r;
|
|
17401
17259
|
if (!Fp.isValid(radj))
|
|
17402
|
-
throw new Error('recovery id
|
|
17260
|
+
throw new Error('invalid recovery id: sig.r+curve.n != R.x');
|
|
17403
17261
|
const x = Fp.toBytes(radj);
|
|
17404
|
-
const R = Point.fromBytes(concatBytes(pprefix((
|
|
17262
|
+
const R = Point.fromBytes(concatBytes(pprefix((recovery & 1) === 0), x));
|
|
17405
17263
|
const ir = Fn.inv(radj); // r^-1
|
|
17406
|
-
const h = bits2int_modN(
|
|
17264
|
+
const h = bits2int_modN(abytes(messageHash, undefined, 'msgHash')); // Truncate hash
|
|
17407
17265
|
const u1 = Fn.create(-h * ir); // -hr^-1
|
|
17408
17266
|
const u2 = Fn.create(s * ir); // sr^-1
|
|
17409
17267
|
// (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1). unsafe is fine: there is no private data.
|
|
17410
17268
|
const Q = Point.BASE.multiplyUnsafe(u1).add(R.multiplyUnsafe(u2));
|
|
17411
17269
|
if (Q.is0())
|
|
17412
|
-
throw new Error('point at infinify');
|
|
17270
|
+
throw new Error('invalid recovery: point at infinify');
|
|
17413
17271
|
Q.assertValidity();
|
|
17414
17272
|
return Q;
|
|
17415
17273
|
}
|
|
@@ -17417,45 +17275,22 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17417
17275
|
hasHighS() {
|
|
17418
17276
|
return isBiggerThanHalfOrder(this.s);
|
|
17419
17277
|
}
|
|
17420
|
-
toBytes(format =
|
|
17278
|
+
toBytes(format = defaultSigOpts.format) {
|
|
17421
17279
|
validateSigFormat(format);
|
|
17422
17280
|
if (format === 'der')
|
|
17423
17281
|
return hexToBytes(DER.hexFromSig(this));
|
|
17424
|
-
const r =
|
|
17425
|
-
const
|
|
17282
|
+
const { r, s } = this;
|
|
17283
|
+
const rb = Fn.toBytes(r);
|
|
17284
|
+
const sb = Fn.toBytes(s);
|
|
17426
17285
|
if (format === 'recovered') {
|
|
17427
|
-
|
|
17428
|
-
|
|
17429
|
-
return concatBytes(Uint8Array.of(this.recovery), r, s);
|
|
17286
|
+
assertSmallCofactor();
|
|
17287
|
+
return concatBytes(Uint8Array.of(this.assertRecovery()), rb, sb);
|
|
17430
17288
|
}
|
|
17431
|
-
return concatBytes(
|
|
17289
|
+
return concatBytes(rb, sb);
|
|
17432
17290
|
}
|
|
17433
17291
|
toHex(format) {
|
|
17434
17292
|
return bytesToHex(this.toBytes(format));
|
|
17435
17293
|
}
|
|
17436
|
-
// TODO: remove
|
|
17437
|
-
assertValidity() { }
|
|
17438
|
-
static fromCompact(hex) {
|
|
17439
|
-
return Signature.fromBytes(utils_ensureBytes('sig', hex), 'compact');
|
|
17440
|
-
}
|
|
17441
|
-
static fromDER(hex) {
|
|
17442
|
-
return Signature.fromBytes(utils_ensureBytes('sig', hex), 'der');
|
|
17443
|
-
}
|
|
17444
|
-
normalizeS() {
|
|
17445
|
-
return this.hasHighS() ? new Signature(this.r, Fn.neg(this.s), this.recovery) : this;
|
|
17446
|
-
}
|
|
17447
|
-
toDERRawBytes() {
|
|
17448
|
-
return this.toBytes('der');
|
|
17449
|
-
}
|
|
17450
|
-
toDERHex() {
|
|
17451
|
-
return bytesToHex(this.toBytes('der'));
|
|
17452
|
-
}
|
|
17453
|
-
toCompactRawBytes() {
|
|
17454
|
-
return this.toBytes('compact');
|
|
17455
|
-
}
|
|
17456
|
-
toCompactHex() {
|
|
17457
|
-
return bytesToHex(this.toBytes('compact'));
|
|
17458
|
-
}
|
|
17459
17294
|
}
|
|
17460
17295
|
// RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets.
|
|
17461
17296
|
// FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int.
|
|
@@ -17468,7 +17303,7 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17468
17303
|
throw new Error('input is too large');
|
|
17469
17304
|
// For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)
|
|
17470
17305
|
// for some cases, since bytes.length * 8 is not actual bitLength.
|
|
17471
|
-
const num =
|
|
17306
|
+
const num = bytesToNumberBE(bytes); // check for == u8 done here
|
|
17472
17307
|
const delta = bytes.length * 8 - fnBits; // truncate to nBitLength leftmost bits
|
|
17473
17308
|
return delta > 0 ? num >> BigInt(delta) : num;
|
|
17474
17309
|
};
|
|
@@ -17477,7 +17312,7 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17477
17312
|
return Fn.create(bits2int(bytes)); // can't use bytesToNumberBE here
|
|
17478
17313
|
};
|
|
17479
17314
|
// Pads output with zero as per spec
|
|
17480
|
-
const ORDER_MASK =
|
|
17315
|
+
const ORDER_MASK = bitMask(fnBits);
|
|
17481
17316
|
/** Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. */
|
|
17482
17317
|
function int2octets(num) {
|
|
17483
17318
|
// IMPORTANT: the check ensures working for case `Fn.BYTES != Fn.BITS * 8`
|
|
@@ -17485,8 +17320,8 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17485
17320
|
return Fn.toBytes(num);
|
|
17486
17321
|
}
|
|
17487
17322
|
function validateMsgAndHash(message, prehash) {
|
|
17488
|
-
|
|
17489
|
-
return prehash ?
|
|
17323
|
+
abytes(message, undefined, 'message');
|
|
17324
|
+
return prehash ? abytes(hash(message), undefined, 'prehashed message') : message;
|
|
17490
17325
|
}
|
|
17491
17326
|
/**
|
|
17492
17327
|
* Steps A, D of RFC6979 3.2.
|
|
@@ -17496,26 +17331,26 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17496
17331
|
* Warning: we cannot assume here that message has same amount of bytes as curve order,
|
|
17497
17332
|
* this will be invalid at least for P521. Also it can be bigger for P224 + SHA256.
|
|
17498
17333
|
*/
|
|
17499
|
-
function prepSig(message,
|
|
17500
|
-
if (['recovered', 'canonical'].some((k) => k in opts))
|
|
17501
|
-
throw new Error('sign() legacy options not supported');
|
|
17334
|
+
function prepSig(message, secretKey, opts) {
|
|
17502
17335
|
const { lowS, prehash, extraEntropy } = validateSigOpts(opts, defaultSigOpts);
|
|
17503
17336
|
message = validateMsgAndHash(message, prehash); // RFC6979 3.2 A: h1 = H(m)
|
|
17504
17337
|
// We can't later call bits2octets, since nested bits2int is broken for curves
|
|
17505
17338
|
// with fnBits % 8 !== 0. Because of that, we unwrap it here as int2octets call.
|
|
17506
17339
|
// const bits2octets = (bits) => int2octets(bits2int_modN(bits))
|
|
17507
17340
|
const h1int = bits2int_modN(message);
|
|
17508
|
-
const d =
|
|
17341
|
+
const d = Fn.fromBytes(secretKey); // validate secret key, convert to bigint
|
|
17342
|
+
if (!Fn.isValidNot0(d))
|
|
17343
|
+
throw new Error('invalid private key');
|
|
17509
17344
|
const seedArgs = [int2octets(d), int2octets(h1int)];
|
|
17510
17345
|
// extraEntropy. RFC6979 3.6: additional k' (optional).
|
|
17511
17346
|
if (extraEntropy != null && extraEntropy !== false) {
|
|
17512
17347
|
// K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')
|
|
17513
17348
|
// gen random bytes OR pass as-is
|
|
17514
17349
|
const e = extraEntropy === true ? randomBytes(lengths.secretKey) : extraEntropy;
|
|
17515
|
-
seedArgs.push(
|
|
17350
|
+
seedArgs.push(abytes(e, undefined, 'extraEntropy')); // check for being bytes
|
|
17516
17351
|
}
|
|
17517
17352
|
const seed = concatBytes(...seedArgs); // Step D of RFC6979 3.2
|
|
17518
|
-
const m = h1int; //
|
|
17353
|
+
const m = h1int; // no need to call bits2int second time here, it is inside truncateHash!
|
|
17519
17354
|
// Converts signature params into point w r/s, checks result for validity.
|
|
17520
17355
|
// To transform k => Signature:
|
|
17521
17356
|
// q = k⋅G
|
|
@@ -17527,7 +17362,7 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17527
17362
|
function k2sig(kBytes) {
|
|
17528
17363
|
// RFC 6979 Section 3.2, step 3: k = bits2int(T)
|
|
17529
17364
|
// Important: all mod() calls here must be done over N
|
|
17530
|
-
const k = bits2int(kBytes); //
|
|
17365
|
+
const k = bits2int(kBytes); // Cannot use fields methods, since it is group element
|
|
17531
17366
|
if (!Fn.isValidNot0(k))
|
|
17532
17367
|
return; // Valid scalars (including k) must be in 1..N-1
|
|
17533
17368
|
const ik = Fn.inv(k); // k^-1 mod n
|
|
@@ -17535,16 +17370,16 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17535
17370
|
const r = Fn.create(q.x); // r = q.x mod n
|
|
17536
17371
|
if (r === weierstrass_0n)
|
|
17537
17372
|
return;
|
|
17538
|
-
const s = Fn.create(ik * Fn.create(m + r * d)); //
|
|
17373
|
+
const s = Fn.create(ik * Fn.create(m + r * d)); // s = k^-1(m + rd) mod n
|
|
17539
17374
|
if (s === weierstrass_0n)
|
|
17540
17375
|
return;
|
|
17541
|
-
let recovery = (q.x === r ? 0 : 2) | Number(q.y & weierstrass_1n); // recovery bit (2 or 3
|
|
17376
|
+
let recovery = (q.x === r ? 0 : 2) | Number(q.y & weierstrass_1n); // recovery bit (2 or 3 when q.x>n)
|
|
17542
17377
|
let normS = s;
|
|
17543
17378
|
if (lowS && isBiggerThanHalfOrder(s)) {
|
|
17544
|
-
normS = Fn.neg(s); // if lowS was passed, ensure s is always
|
|
17545
|
-
recovery ^= 1;
|
|
17379
|
+
normS = Fn.neg(s); // if lowS was passed, ensure s is always in the bottom half of N
|
|
17380
|
+
recovery ^= 1;
|
|
17546
17381
|
}
|
|
17547
|
-
return new Signature(r, normS,
|
|
17382
|
+
return new Signature(r, normS, hasLargeCofactor ? undefined : recovery);
|
|
17548
17383
|
}
|
|
17549
17384
|
return { seed, k2sig };
|
|
17550
17385
|
}
|
|
@@ -17560,46 +17395,10 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17560
17395
|
* ```
|
|
17561
17396
|
*/
|
|
17562
17397
|
function sign(message, secretKey, opts = {}) {
|
|
17563
|
-
message = utils_ensureBytes('message', message);
|
|
17564
17398
|
const { seed, k2sig } = prepSig(message, secretKey, opts); // Steps A, D of RFC6979 3.2.
|
|
17565
17399
|
const drbg = createHmacDrbg(hash.outputLen, Fn.BYTES, hmac);
|
|
17566
17400
|
const sig = drbg(seed, k2sig); // Steps B, C, D, E, F, G
|
|
17567
|
-
return sig;
|
|
17568
|
-
}
|
|
17569
|
-
function tryParsingSig(sg) {
|
|
17570
|
-
// Try to deduce format
|
|
17571
|
-
let sig = undefined;
|
|
17572
|
-
const isHex = typeof sg === 'string' || isBytes(sg);
|
|
17573
|
-
const isObj = !isHex &&
|
|
17574
|
-
sg !== null &&
|
|
17575
|
-
typeof sg === 'object' &&
|
|
17576
|
-
typeof sg.r === 'bigint' &&
|
|
17577
|
-
typeof sg.s === 'bigint';
|
|
17578
|
-
if (!isHex && !isObj)
|
|
17579
|
-
throw new Error('invalid signature, expected Uint8Array, hex string or Signature instance');
|
|
17580
|
-
if (isObj) {
|
|
17581
|
-
sig = new Signature(sg.r, sg.s);
|
|
17582
|
-
}
|
|
17583
|
-
else if (isHex) {
|
|
17584
|
-
try {
|
|
17585
|
-
sig = Signature.fromBytes(utils_ensureBytes('sig', sg), 'der');
|
|
17586
|
-
}
|
|
17587
|
-
catch (derError) {
|
|
17588
|
-
if (!(derError instanceof DER.Err))
|
|
17589
|
-
throw derError;
|
|
17590
|
-
}
|
|
17591
|
-
if (!sig) {
|
|
17592
|
-
try {
|
|
17593
|
-
sig = Signature.fromBytes(utils_ensureBytes('sig', sg), 'compact');
|
|
17594
|
-
}
|
|
17595
|
-
catch (error) {
|
|
17596
|
-
return false;
|
|
17597
|
-
}
|
|
17598
|
-
}
|
|
17599
|
-
}
|
|
17600
|
-
if (!sig)
|
|
17601
|
-
return false;
|
|
17602
|
-
return sig;
|
|
17401
|
+
return sig.toBytes(opts.format);
|
|
17603
17402
|
}
|
|
17604
17403
|
/**
|
|
17605
17404
|
* Verifies a signature against message and public key.
|
|
@@ -17616,16 +17415,15 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17616
17415
|
*/
|
|
17617
17416
|
function verify(signature, message, publicKey, opts = {}) {
|
|
17618
17417
|
const { lowS, prehash, format } = validateSigOpts(opts, defaultSigOpts);
|
|
17619
|
-
publicKey =
|
|
17620
|
-
message = validateMsgAndHash(
|
|
17621
|
-
if (
|
|
17622
|
-
|
|
17623
|
-
|
|
17624
|
-
|
|
17625
|
-
|
|
17626
|
-
if (sig === false)
|
|
17627
|
-
return false;
|
|
17418
|
+
publicKey = abytes(publicKey, undefined, 'publicKey');
|
|
17419
|
+
message = validateMsgAndHash(message, prehash);
|
|
17420
|
+
if (!isBytes(signature)) {
|
|
17421
|
+
const end = signature instanceof Signature ? ', use sig.toBytes()' : '';
|
|
17422
|
+
throw new Error('verify expects Uint8Array signature' + end);
|
|
17423
|
+
}
|
|
17424
|
+
validateSigLength(signature, format); // execute this twice because we want loud error
|
|
17628
17425
|
try {
|
|
17426
|
+
const sig = Signature.fromBytes(signature, format);
|
|
17629
17427
|
const P = Point.fromBytes(publicKey);
|
|
17630
17428
|
if (lowS && sig.hasHighS())
|
|
17631
17429
|
return false;
|
|
@@ -17663,114 +17461,8 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
17663
17461
|
hash,
|
|
17664
17462
|
});
|
|
17665
17463
|
}
|
|
17666
|
-
/** @deprecated use `weierstrass` in newer releases */
|
|
17667
|
-
function weierstrassPoints(c) {
|
|
17668
|
-
const { CURVE, curveOpts } = _weierstrass_legacy_opts_to_new(c);
|
|
17669
|
-
const Point = weierstrassN(CURVE, curveOpts);
|
|
17670
|
-
return _weierstrass_new_output_to_legacy(c, Point);
|
|
17671
|
-
}
|
|
17672
|
-
function _weierstrass_legacy_opts_to_new(c) {
|
|
17673
|
-
const CURVE = {
|
|
17674
|
-
a: c.a,
|
|
17675
|
-
b: c.b,
|
|
17676
|
-
p: c.Fp.ORDER,
|
|
17677
|
-
n: c.n,
|
|
17678
|
-
h: c.h,
|
|
17679
|
-
Gx: c.Gx,
|
|
17680
|
-
Gy: c.Gy,
|
|
17681
|
-
};
|
|
17682
|
-
const Fp = c.Fp;
|
|
17683
|
-
let allowedLengths = c.allowedPrivateKeyLengths
|
|
17684
|
-
? Array.from(new Set(c.allowedPrivateKeyLengths.map((l) => Math.ceil(l / 2))))
|
|
17685
|
-
: undefined;
|
|
17686
|
-
const Fn = Field(CURVE.n, {
|
|
17687
|
-
BITS: c.nBitLength,
|
|
17688
|
-
allowedLengths: allowedLengths,
|
|
17689
|
-
modFromBytes: c.wrapPrivateKey,
|
|
17690
|
-
});
|
|
17691
|
-
const curveOpts = {
|
|
17692
|
-
Fp,
|
|
17693
|
-
Fn,
|
|
17694
|
-
allowInfinityPoint: c.allowInfinityPoint,
|
|
17695
|
-
endo: c.endo,
|
|
17696
|
-
isTorsionFree: c.isTorsionFree,
|
|
17697
|
-
clearCofactor: c.clearCofactor,
|
|
17698
|
-
fromBytes: c.fromBytes,
|
|
17699
|
-
toBytes: c.toBytes,
|
|
17700
|
-
};
|
|
17701
|
-
return { CURVE, curveOpts };
|
|
17702
|
-
}
|
|
17703
|
-
function _ecdsa_legacy_opts_to_new(c) {
|
|
17704
|
-
const { CURVE, curveOpts } = _weierstrass_legacy_opts_to_new(c);
|
|
17705
|
-
const ecdsaOpts = {
|
|
17706
|
-
hmac: c.hmac,
|
|
17707
|
-
randomBytes: c.randomBytes,
|
|
17708
|
-
lowS: c.lowS,
|
|
17709
|
-
bits2int: c.bits2int,
|
|
17710
|
-
bits2int_modN: c.bits2int_modN,
|
|
17711
|
-
};
|
|
17712
|
-
return { CURVE, curveOpts, hash: c.hash, ecdsaOpts };
|
|
17713
|
-
}
|
|
17714
|
-
function _legacyHelperEquat(Fp, a, b) {
|
|
17715
|
-
/**
|
|
17716
|
-
* y² = x³ + ax + b: Short weierstrass curve formula. Takes x, returns y².
|
|
17717
|
-
* @returns y²
|
|
17718
|
-
*/
|
|
17719
|
-
function weierstrassEquation(x) {
|
|
17720
|
-
const x2 = Fp.sqr(x); // x * x
|
|
17721
|
-
const x3 = Fp.mul(x2, x); // x² * x
|
|
17722
|
-
return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x³ + a * x + b
|
|
17723
|
-
}
|
|
17724
|
-
return weierstrassEquation;
|
|
17725
|
-
}
|
|
17726
|
-
function _weierstrass_new_output_to_legacy(c, Point) {
|
|
17727
|
-
const { Fp, Fn } = Point;
|
|
17728
|
-
function isWithinCurveOrder(num) {
|
|
17729
|
-
return inRange(num, weierstrass_1n, Fn.ORDER);
|
|
17730
|
-
}
|
|
17731
|
-
const weierstrassEquation = _legacyHelperEquat(Fp, c.a, c.b);
|
|
17732
|
-
return Object.assign({}, {
|
|
17733
|
-
CURVE: c,
|
|
17734
|
-
Point: Point,
|
|
17735
|
-
ProjectivePoint: Point,
|
|
17736
|
-
normPrivateKeyToScalar: (key) => _normFnElement(Fn, key),
|
|
17737
|
-
weierstrassEquation,
|
|
17738
|
-
isWithinCurveOrder,
|
|
17739
|
-
});
|
|
17740
|
-
}
|
|
17741
|
-
function _ecdsa_new_output_to_legacy(c, _ecdsa) {
|
|
17742
|
-
const Point = _ecdsa.Point;
|
|
17743
|
-
return Object.assign({}, _ecdsa, {
|
|
17744
|
-
ProjectivePoint: Point,
|
|
17745
|
-
CURVE: Object.assign({}, c, modular_nLength(Point.Fn.ORDER, Point.Fn.BITS)),
|
|
17746
|
-
});
|
|
17747
|
-
}
|
|
17748
|
-
// _ecdsa_legacy
|
|
17749
|
-
function weierstrass(c) {
|
|
17750
|
-
const { CURVE, curveOpts, hash, ecdsaOpts } = _ecdsa_legacy_opts_to_new(c);
|
|
17751
|
-
const Point = weierstrassN(CURVE, curveOpts);
|
|
17752
|
-
const signs = ecdsa(Point, hash, ecdsaOpts);
|
|
17753
|
-
return _ecdsa_new_output_to_legacy(c, signs);
|
|
17754
|
-
}
|
|
17755
17464
|
//# sourceMappingURL=weierstrass.js.map
|
|
17756
|
-
;// ./node_modules/@noble/curves/
|
|
17757
|
-
/**
|
|
17758
|
-
* Utilities for short weierstrass curves, combined with noble-hashes.
|
|
17759
|
-
* @module
|
|
17760
|
-
*/
|
|
17761
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
17762
|
-
|
|
17763
|
-
/** connects noble-curves to noble-hashes */
|
|
17764
|
-
function getHash(hash) {
|
|
17765
|
-
return { hash };
|
|
17766
|
-
}
|
|
17767
|
-
/** @deprecated use new `weierstrass()` and `ecdsa()` methods */
|
|
17768
|
-
function createCurve(curveDef, defHash) {
|
|
17769
|
-
const create = (hash) => weierstrass({ ...curveDef, hash: hash });
|
|
17770
|
-
return { ...create(defHash), create };
|
|
17771
|
-
}
|
|
17772
|
-
//# sourceMappingURL=_shortw_utils.js.map
|
|
17773
|
-
;// ./node_modules/@noble/curves/esm/secp256k1.js
|
|
17465
|
+
;// ./node_modules/@noble/curves/secp256k1.js
|
|
17774
17466
|
/**
|
|
17775
17467
|
* SECG secp256k1. See [pdf](https://www.secg.org/sec2-v2.pdf).
|
|
17776
17468
|
*
|
|
@@ -17787,7 +17479,7 @@ function createCurve(curveDef, defHash) {
|
|
|
17787
17479
|
|
|
17788
17480
|
|
|
17789
17481
|
// Seems like generator was produced from some seed:
|
|
17790
|
-
// `
|
|
17482
|
+
// `Pointk1.BASE.multiply(Pointk1.Fn.inv(2n, N)).toAffine().x`
|
|
17791
17483
|
// // gives short x 0x3b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63n
|
|
17792
17484
|
const secp256k1_CURVE = {
|
|
17793
17485
|
p: BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'),
|
|
@@ -17806,7 +17498,6 @@ const secp256k1_ENDO = {
|
|
|
17806
17498
|
],
|
|
17807
17499
|
};
|
|
17808
17500
|
const secp256k1_0n = /* @__PURE__ */ BigInt(0);
|
|
17809
|
-
const secp256k1_1n = /* @__PURE__ */ BigInt(1);
|
|
17810
17501
|
const secp256k1_2n = /* @__PURE__ */ BigInt(2);
|
|
17811
17502
|
/**
|
|
17812
17503
|
* √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit.
|
|
@@ -17837,21 +17528,28 @@ function sqrtMod(y) {
|
|
|
17837
17528
|
return root;
|
|
17838
17529
|
}
|
|
17839
17530
|
const Fpk1 = Field(secp256k1_CURVE.p, { sqrt: sqrtMod });
|
|
17531
|
+
const Pointk1 = /* @__PURE__ */ weierstrass(secp256k1_CURVE, {
|
|
17532
|
+
Fp: Fpk1,
|
|
17533
|
+
endo: secp256k1_ENDO,
|
|
17534
|
+
});
|
|
17840
17535
|
/**
|
|
17841
|
-
* secp256k1 curve
|
|
17536
|
+
* secp256k1 curve: ECDSA and ECDH methods.
|
|
17842
17537
|
*
|
|
17843
|
-
*
|
|
17538
|
+
* Uses sha256 to hash messages. To use a different hash,
|
|
17539
|
+
* pass `{ prehash: false }` to sign / verify.
|
|
17844
17540
|
*
|
|
17845
17541
|
* @example
|
|
17846
17542
|
* ```js
|
|
17847
|
-
* import { secp256k1 } from '@noble/curves/secp256k1';
|
|
17543
|
+
* import { secp256k1 } from '@noble/curves/secp256k1.js';
|
|
17848
17544
|
* const { secretKey, publicKey } = secp256k1.keygen();
|
|
17849
|
-
* const
|
|
17545
|
+
* // const publicKey = secp256k1.getPublicKey(secretKey);
|
|
17546
|
+
* const msg = new TextEncoder().encode('hello noble');
|
|
17850
17547
|
* const sig = secp256k1.sign(msg, secretKey);
|
|
17851
|
-
* const isValid = secp256k1.verify(sig, msg, publicKey)
|
|
17548
|
+
* const isValid = secp256k1.verify(sig, msg, publicKey);
|
|
17549
|
+
* // const sigKeccak = secp256k1.sign(keccak256(msg), secretKey, { prehash: false });
|
|
17852
17550
|
* ```
|
|
17853
17551
|
*/
|
|
17854
|
-
const secp256k1 =
|
|
17552
|
+
const secp256k1 = /* @__PURE__ */ (/* unused pure expression or super */ null && (ecdsa(Pointk1, sha256)));
|
|
17855
17553
|
// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.
|
|
17856
17554
|
// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
|
|
17857
17555
|
/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */
|
|
@@ -17859,20 +17557,19 @@ const TAGGED_HASH_PREFIXES = {};
|
|
|
17859
17557
|
function taggedHash(tag, ...messages) {
|
|
17860
17558
|
let tagP = TAGGED_HASH_PREFIXES[tag];
|
|
17861
17559
|
if (tagP === undefined) {
|
|
17862
|
-
const tagH = sha2_sha256(
|
|
17863
|
-
tagP =
|
|
17560
|
+
const tagH = sha2_sha256(asciiToBytes(tag));
|
|
17561
|
+
tagP = utils_concatBytes(tagH, tagH);
|
|
17864
17562
|
TAGGED_HASH_PREFIXES[tag] = tagP;
|
|
17865
17563
|
}
|
|
17866
|
-
return sha2_sha256(
|
|
17564
|
+
return sha2_sha256(utils_concatBytes(tagP, ...messages));
|
|
17867
17565
|
}
|
|
17868
17566
|
// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03
|
|
17869
17567
|
const pointToBytes = (point) => point.toBytes(true).slice(1);
|
|
17870
|
-
const Pointk1 = /* @__PURE__ */ (() => secp256k1.Point)();
|
|
17871
17568
|
const hasEven = (y) => y % secp256k1_2n === secp256k1_0n;
|
|
17872
17569
|
// Calculate point, scalar and bytes
|
|
17873
17570
|
function schnorrGetExtPubKey(priv) {
|
|
17874
17571
|
const { Fn, BASE } = Pointk1;
|
|
17875
|
-
const d_ =
|
|
17572
|
+
const d_ = Fn.fromBytes(priv);
|
|
17876
17573
|
const p = BASE.multiply(d_); // P = d'⋅G; 0 < d' < n check is done inside
|
|
17877
17574
|
const scalar = hasEven(p.y) ? d_ : Fn.neg(d_);
|
|
17878
17575
|
return { scalar, bytes: pointToBytes(p) };
|
|
@@ -17913,11 +17610,11 @@ function schnorrGetPublicKey(secretKey) {
|
|
|
17913
17610
|
* Creates Schnorr signature as per BIP340. Verifies itself before returning anything.
|
|
17914
17611
|
* auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous.
|
|
17915
17612
|
*/
|
|
17916
|
-
function schnorrSign(message, secretKey, auxRand =
|
|
17613
|
+
function schnorrSign(message, secretKey, auxRand = randomBytes(32)) {
|
|
17917
17614
|
const { Fn } = Pointk1;
|
|
17918
|
-
const m =
|
|
17615
|
+
const m = utils_abytes(message, undefined, 'message');
|
|
17919
17616
|
const { bytes: px, scalar: d } = schnorrGetExtPubKey(secretKey); // checks for isWithinCurveOrder
|
|
17920
|
-
const a =
|
|
17617
|
+
const a = utils_abytes(auxRand, 32, 'auxRand'); // Auxiliary random data a: a 32-byte array
|
|
17921
17618
|
const t = Fn.toBytes(d ^ num(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a)
|
|
17922
17619
|
const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m)
|
|
17923
17620
|
// Let k' = int(rand) mod n. Fail if k' = 0. Let R = k'⋅G
|
|
@@ -17936,20 +17633,19 @@ function schnorrSign(message, secretKey, auxRand = utils_randomBytes(32)) {
|
|
|
17936
17633
|
* Will swallow errors & return false except for initial type validation of arguments.
|
|
17937
17634
|
*/
|
|
17938
17635
|
function schnorrVerify(signature, message, publicKey) {
|
|
17939
|
-
const { Fn, BASE } = Pointk1;
|
|
17940
|
-
const sig =
|
|
17941
|
-
const m =
|
|
17942
|
-
const pub =
|
|
17636
|
+
const { Fp, Fn, BASE } = Pointk1;
|
|
17637
|
+
const sig = utils_abytes(signature, 64, 'signature');
|
|
17638
|
+
const m = utils_abytes(message, undefined, 'message');
|
|
17639
|
+
const pub = utils_abytes(publicKey, 32, 'publicKey');
|
|
17943
17640
|
try {
|
|
17944
17641
|
const P = lift_x(num(pub)); // P = lift_x(int(pk)); fail if that fails
|
|
17945
17642
|
const r = num(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p.
|
|
17946
|
-
if (!
|
|
17643
|
+
if (!Fp.isValidNot0(r))
|
|
17947
17644
|
return false;
|
|
17948
17645
|
const s = num(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n.
|
|
17949
|
-
if (!
|
|
17646
|
+
if (!Fn.isValidNot0(s))
|
|
17950
17647
|
return false;
|
|
17951
|
-
// int(challenge(bytes(r)||bytes(P)||m))%n
|
|
17952
|
-
const e = challenge(Fn.toBytes(r), pointToBytes(P), m);
|
|
17648
|
+
const e = challenge(Fn.toBytes(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n
|
|
17953
17649
|
// R = s⋅G - e⋅P, where -eP == (n-e)P
|
|
17954
17650
|
const R = BASE.multiplyUnsafe(s).add(P.multiplyUnsafe(Fn.neg(e)));
|
|
17955
17651
|
const { x, y } = R.toAffine();
|
|
@@ -17967,7 +17663,7 @@ function schnorrVerify(signature, message, publicKey) {
|
|
|
17967
17663
|
* https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
|
|
17968
17664
|
* @example
|
|
17969
17665
|
* ```js
|
|
17970
|
-
* import { schnorr } from '@noble/curves/secp256k1';
|
|
17666
|
+
* import { schnorr } from '@noble/curves/secp256k1.js';
|
|
17971
17667
|
* const { secretKey, publicKey } = schnorr.keygen();
|
|
17972
17668
|
* // const publicKey = schnorr.getPublicKey(secretKey);
|
|
17973
17669
|
* const msg = new TextEncoder().encode('hello');
|
|
@@ -17978,31 +17674,20 @@ function schnorrVerify(signature, message, publicKey) {
|
|
|
17978
17674
|
const schnorr = /* @__PURE__ */ (() => {
|
|
17979
17675
|
const size = 32;
|
|
17980
17676
|
const seedLength = 48;
|
|
17981
|
-
const randomSecretKey = (seed =
|
|
17982
|
-
return
|
|
17677
|
+
const randomSecretKey = (seed = randomBytes(seedLength)) => {
|
|
17678
|
+
return modular_mapHashToField(seed, secp256k1_CURVE.n);
|
|
17983
17679
|
};
|
|
17984
|
-
// TODO: remove
|
|
17985
|
-
secp256k1.utils.randomSecretKey;
|
|
17986
|
-
function keygen(seed) {
|
|
17987
|
-
const secretKey = randomSecretKey(seed);
|
|
17988
|
-
return { secretKey, publicKey: schnorrGetPublicKey(secretKey) };
|
|
17989
|
-
}
|
|
17990
17680
|
return {
|
|
17991
|
-
keygen,
|
|
17681
|
+
keygen: curve_createKeygen(randomSecretKey, schnorrGetPublicKey),
|
|
17992
17682
|
getPublicKey: schnorrGetPublicKey,
|
|
17993
17683
|
sign: schnorrSign,
|
|
17994
17684
|
verify: schnorrVerify,
|
|
17995
17685
|
Point: Pointk1,
|
|
17996
17686
|
utils: {
|
|
17997
|
-
randomSecretKey
|
|
17998
|
-
randomPrivateKey: randomSecretKey,
|
|
17687
|
+
randomSecretKey,
|
|
17999
17688
|
taggedHash,
|
|
18000
|
-
// TODO: remove
|
|
18001
17689
|
lift_x,
|
|
18002
17690
|
pointToBytes,
|
|
18003
|
-
numberToBytesBE: numberToBytesBE,
|
|
18004
|
-
bytesToNumberBE: utils_bytesToNumberBE,
|
|
18005
|
-
mod: mod,
|
|
18006
17691
|
},
|
|
18007
17692
|
lengths: {
|
|
18008
17693
|
secretKey: size,
|
|
@@ -18048,7 +17733,7 @@ const mapSWU = /* @__PURE__ */ (/* unused pure expression or super */ null && ((
|
|
|
18048
17733
|
Z: Fpk1.create(BigInt('-11')),
|
|
18049
17734
|
}))()));
|
|
18050
17735
|
/** Hashing / encoding to secp256k1 points / field. RFC 9380 methods. */
|
|
18051
|
-
const secp256k1_hasher = /* @__PURE__ */ (/* unused pure expression or super */ null && ((() => createHasher(
|
|
17736
|
+
const secp256k1_hasher = /* @__PURE__ */ (/* unused pure expression or super */ null && ((() => createHasher(Pointk1, (scalars) => {
|
|
18052
17737
|
const { x, y } = mapSWU(Fpk1.create(scalars[0]));
|
|
18053
17738
|
return isoMap(x, y);
|
|
18054
17739
|
}, {
|
|
@@ -18060,32 +17745,7 @@ const secp256k1_hasher = /* @__PURE__ */ (/* unused pure expression or super */
|
|
|
18060
17745
|
expand: 'xmd',
|
|
18061
17746
|
hash: sha256,
|
|
18062
17747
|
}))()));
|
|
18063
|
-
/** @deprecated use `import { secp256k1_hasher } from '@noble/curves/secp256k1.js';` */
|
|
18064
|
-
const hashToCurve = /* @__PURE__ */ (/* unused pure expression or super */ null && ((() => secp256k1_hasher.hashToCurve)()));
|
|
18065
|
-
/** @deprecated use `import { secp256k1_hasher } from '@noble/curves/secp256k1.js';` */
|
|
18066
|
-
const encodeToCurve = /* @__PURE__ */ (/* unused pure expression or super */ null && ((() => secp256k1_hasher.encodeToCurve)()));
|
|
18067
17748
|
//# sourceMappingURL=secp256k1.js.map
|
|
18068
|
-
;// ./node_modules/@noble/hashes/esm/sha256.js
|
|
18069
|
-
/**
|
|
18070
|
-
* SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.
|
|
18071
|
-
*
|
|
18072
|
-
* To break sha256 using birthday attack, attackers need to try 2^128 hashes.
|
|
18073
|
-
* BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
|
|
18074
|
-
*
|
|
18075
|
-
* Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
|
|
18076
|
-
* @module
|
|
18077
|
-
* @deprecated
|
|
18078
|
-
*/
|
|
18079
|
-
|
|
18080
|
-
/** @deprecated Use import from `noble/hashes/sha2` module */
|
|
18081
|
-
const sha256_SHA256 = (/* unused pure expression or super */ null && (SHA256n));
|
|
18082
|
-
/** @deprecated Use import from `noble/hashes/sha2` module */
|
|
18083
|
-
const sha256_sha256 = sha2_sha256;
|
|
18084
|
-
/** @deprecated Use import from `noble/hashes/sha2` module */
|
|
18085
|
-
const sha256_SHA224 = (/* unused pure expression or super */ null && (SHA224n));
|
|
18086
|
-
/** @deprecated Use import from `noble/hashes/sha2` module */
|
|
18087
|
-
const sha256_sha224 = (/* unused pure expression or super */ null && (sha224n));
|
|
18088
|
-
//# sourceMappingURL=sha256.js.map
|
|
18089
17749
|
;// ./src/chat/signature.ts
|
|
18090
17750
|
|
|
18091
17751
|
|
|
@@ -18152,8 +17812,8 @@ function serializeMsg(msg) {
|
|
|
18152
17812
|
return JSON.stringify(msg);
|
|
18153
17813
|
}
|
|
18154
17814
|
function getMsgHash(message) {
|
|
18155
|
-
var msgHash =
|
|
18156
|
-
return
|
|
17815
|
+
var msgHash = sha2_sha256(utf8Encoder.encode(serializeMsg(message)));
|
|
17816
|
+
return utils_bytesToHex(msgHash);
|
|
18157
17817
|
}
|
|
18158
17818
|
|
|
18159
17819
|
// const isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceof Object
|
|
@@ -18179,10 +17839,10 @@ function getMsgHash(message) {
|
|
|
18179
17839
|
} */
|
|
18180
17840
|
|
|
18181
17841
|
function verifySignature(sig, message, pubKey) {
|
|
18182
|
-
return schnorr.verify(sig, getMsgHash(message), pubKey);
|
|
17842
|
+
return schnorr.verify(utils_hexToBytes(sig), utils_hexToBytes(getMsgHash(message)), utils_hexToBytes(pubKey));
|
|
18183
17843
|
}
|
|
18184
17844
|
function signMsg(message, key) {
|
|
18185
|
-
return
|
|
17845
|
+
return utils_bytesToHex(schnorr.sign(utils_hexToBytes(getMsgHash(message)), utils_hexToBytes(key)));
|
|
18186
17846
|
}
|
|
18187
17847
|
;// ./src/utils/keyHelpers/otherHelpers.ts
|
|
18188
17848
|
|
|
@@ -18410,10 +18070,10 @@ var keyAclBody = function keyAclBody(keyDoc, me) {
|
|
|
18410
18070
|
|
|
18411
18071
|
|
|
18412
18072
|
function generatePrivateKey() {
|
|
18413
|
-
return
|
|
18073
|
+
return utils_bytesToHex(schnorr.utils.randomSecretKey());
|
|
18414
18074
|
}
|
|
18415
18075
|
function generatePublicKey(privateKey) {
|
|
18416
|
-
return
|
|
18076
|
+
return utils_bytesToHex(schnorr.getPublicKey(utils_hexToBytes(privateKey)));
|
|
18417
18077
|
}
|
|
18418
18078
|
|
|
18419
18079
|
/**
|
|
@@ -22695,323 +22355,6 @@ function getPreferencesForClass(subject, theClass, predicates, context) {
|
|
|
22695
22355
|
}
|
|
22696
22356
|
|
|
22697
22357
|
// ends
|
|
22698
|
-
;// ./src/themeLoader.js
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
function themeLoader_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = themeLoader_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
22703
|
-
function themeLoader_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return themeLoader_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? themeLoader_arrayLikeToArray(r, a) : void 0; } }
|
|
22704
|
-
function themeLoader_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
22705
|
-
|
|
22706
|
-
/**
|
|
22707
|
-
* Theme Loader for Solid-UI
|
|
22708
|
-
* Handles dynamic theme loading and switching
|
|
22709
|
-
*/
|
|
22710
|
-
|
|
22711
|
-
var STORAGE_KEY = 'solid-ui-theme';
|
|
22712
|
-
var DEFAULT_THEME = 'classic';
|
|
22713
|
-
var ThemeLoader = /*#__PURE__*/function () {
|
|
22714
|
-
function ThemeLoader() {
|
|
22715
|
-
classCallCheck_classCallCheck(this, ThemeLoader);
|
|
22716
|
-
this.themes = {
|
|
22717
|
-
classic: 'theme-classic.css',
|
|
22718
|
-
"default": 'theme-default.css',
|
|
22719
|
-
wave: 'theme-wave.css',
|
|
22720
|
-
telegram: 'theme-telegram.css',
|
|
22721
|
-
signal: 'theme-signal.css'
|
|
22722
|
-
};
|
|
22723
|
-
this.currentTheme = this.getSavedTheme();
|
|
22724
|
-
this.linkElements = {};
|
|
22725
|
-
this.initialized = false;
|
|
22726
|
-
}
|
|
22727
|
-
|
|
22728
|
-
/**
|
|
22729
|
-
* Initialize the theme system
|
|
22730
|
-
* Loads foundation CSS and current theme
|
|
22731
|
-
*/
|
|
22732
|
-
return createClass_createClass(ThemeLoader, [{
|
|
22733
|
-
key: "init",
|
|
22734
|
-
value: (function () {
|
|
22735
|
-
var _init = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee() {
|
|
22736
|
-
var _t;
|
|
22737
|
-
return regenerator_default().wrap(function (_context) {
|
|
22738
|
-
while (1) switch (_context.prev = _context.next) {
|
|
22739
|
-
case 0:
|
|
22740
|
-
if (!this.initialized) {
|
|
22741
|
-
_context.next = 1;
|
|
22742
|
-
break;
|
|
22743
|
-
}
|
|
22744
|
-
return _context.abrupt("return");
|
|
22745
|
-
case 1:
|
|
22746
|
-
_context.prev = 1;
|
|
22747
|
-
_context.next = 2;
|
|
22748
|
-
return this.loadFoundation();
|
|
22749
|
-
case 2:
|
|
22750
|
-
_context.next = 3;
|
|
22751
|
-
return this.loadTheme(this.currentTheme);
|
|
22752
|
-
case 3:
|
|
22753
|
-
this.initialized = true;
|
|
22754
|
-
_context.next = 5;
|
|
22755
|
-
break;
|
|
22756
|
-
case 4:
|
|
22757
|
-
_context.prev = 4;
|
|
22758
|
-
_t = _context["catch"](1);
|
|
22759
|
-
console.error('Failed to initialize theme system:', _t);
|
|
22760
|
-
// Continue without themes - use inline styles as fallback
|
|
22761
|
-
case 5:
|
|
22762
|
-
case "end":
|
|
22763
|
-
return _context.stop();
|
|
22764
|
-
}
|
|
22765
|
-
}, _callee, this, [[1, 4]]);
|
|
22766
|
-
}));
|
|
22767
|
-
function init() {
|
|
22768
|
-
return _init.apply(this, arguments);
|
|
22769
|
-
}
|
|
22770
|
-
return init;
|
|
22771
|
-
}()
|
|
22772
|
-
/**
|
|
22773
|
-
* Load foundation CSS (variables + accessibility)
|
|
22774
|
-
*/
|
|
22775
|
-
)
|
|
22776
|
-
}, {
|
|
22777
|
-
key: "loadFoundation",
|
|
22778
|
-
value: (function () {
|
|
22779
|
-
var _loadFoundation = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee2() {
|
|
22780
|
-
var variablesLink, a11yLink;
|
|
22781
|
-
return regenerator_default().wrap(function (_context2) {
|
|
22782
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
22783
|
-
case 0:
|
|
22784
|
-
// Variables
|
|
22785
|
-
variablesLink = this.createLinkElement('solid-ui-variables', 'theme-variables.css');
|
|
22786
|
-
document.head.insertBefore(variablesLink, document.head.firstChild);
|
|
22787
|
-
this.linkElements.variables = variablesLink;
|
|
22788
|
-
|
|
22789
|
-
// Accessibility
|
|
22790
|
-
a11yLink = this.createLinkElement('solid-ui-accessibility', 'theme-accessibility.css');
|
|
22791
|
-
document.head.insertBefore(a11yLink, document.head.firstChild);
|
|
22792
|
-
this.linkElements.accessibility = a11yLink;
|
|
22793
|
-
|
|
22794
|
-
// Wait for CSS to load
|
|
22795
|
-
_context2.next = 1;
|
|
22796
|
-
return Promise.all([this.waitForStylesheet(variablesLink), this.waitForStylesheet(a11yLink)]);
|
|
22797
|
-
case 1:
|
|
22798
|
-
case "end":
|
|
22799
|
-
return _context2.stop();
|
|
22800
|
-
}
|
|
22801
|
-
}, _callee2, this);
|
|
22802
|
-
}));
|
|
22803
|
-
function loadFoundation() {
|
|
22804
|
-
return _loadFoundation.apply(this, arguments);
|
|
22805
|
-
}
|
|
22806
|
-
return loadFoundation;
|
|
22807
|
-
}()
|
|
22808
|
-
/**
|
|
22809
|
-
* Load a theme by name
|
|
22810
|
-
* @param {string} themeName - Name of theme to load
|
|
22811
|
-
*/
|
|
22812
|
-
)
|
|
22813
|
-
}, {
|
|
22814
|
-
key: "loadTheme",
|
|
22815
|
-
value: (function () {
|
|
22816
|
-
var _loadTheme = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee3(themeName) {
|
|
22817
|
-
var themeFile, themeLink, _t2;
|
|
22818
|
-
return regenerator_default().wrap(function (_context3) {
|
|
22819
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
22820
|
-
case 0:
|
|
22821
|
-
themeFile = this.themes[themeName] || this.themes[DEFAULT_THEME];
|
|
22822
|
-
_context3.prev = 1;
|
|
22823
|
-
// Create or update theme link
|
|
22824
|
-
themeLink = this.linkElements.theme;
|
|
22825
|
-
if (!themeLink) {
|
|
22826
|
-
themeLink = this.createLinkElement('solid-ui-theme', themeFile);
|
|
22827
|
-
document.head.appendChild(themeLink);
|
|
22828
|
-
this.linkElements.theme = themeLink;
|
|
22829
|
-
} else {
|
|
22830
|
-
themeLink.href = this.resolveThemePath(themeFile);
|
|
22831
|
-
}
|
|
22832
|
-
|
|
22833
|
-
// Wait for theme to load
|
|
22834
|
-
_context3.next = 2;
|
|
22835
|
-
return this.waitForStylesheet(themeLink);
|
|
22836
|
-
case 2:
|
|
22837
|
-
// Update state
|
|
22838
|
-
this.currentTheme = themeName;
|
|
22839
|
-
this.saveTheme(themeName);
|
|
22840
|
-
|
|
22841
|
-
// Emit event for listeners
|
|
22842
|
-
this.emitThemeChange(themeName);
|
|
22843
|
-
_context3.next = 4;
|
|
22844
|
-
break;
|
|
22845
|
-
case 3:
|
|
22846
|
-
_context3.prev = 3;
|
|
22847
|
-
_t2 = _context3["catch"](1);
|
|
22848
|
-
console.error("Failed to load theme \"".concat(themeName, "\":"), _t2);
|
|
22849
|
-
throw _t2;
|
|
22850
|
-
case 4:
|
|
22851
|
-
case "end":
|
|
22852
|
-
return _context3.stop();
|
|
22853
|
-
}
|
|
22854
|
-
}, _callee3, this, [[1, 3]]);
|
|
22855
|
-
}));
|
|
22856
|
-
function loadTheme(_x) {
|
|
22857
|
-
return _loadTheme.apply(this, arguments);
|
|
22858
|
-
}
|
|
22859
|
-
return loadTheme;
|
|
22860
|
-
}()
|
|
22861
|
-
/**
|
|
22862
|
-
* Get list of available themes
|
|
22863
|
-
* @returns {Array<{name: string, label: string}>}
|
|
22864
|
-
*/
|
|
22865
|
-
)
|
|
22866
|
-
}, {
|
|
22867
|
-
key: "getAvailableThemes",
|
|
22868
|
-
value: function getAvailableThemes() {
|
|
22869
|
-
var _this = this;
|
|
22870
|
-
return Object.keys(this.themes).map(function (name) {
|
|
22871
|
-
return {
|
|
22872
|
-
name: name,
|
|
22873
|
-
label: _this.formatThemeName(name)
|
|
22874
|
-
};
|
|
22875
|
-
});
|
|
22876
|
-
}
|
|
22877
|
-
|
|
22878
|
-
/**
|
|
22879
|
-
* Get currently active theme
|
|
22880
|
-
* @returns {string}
|
|
22881
|
-
*/
|
|
22882
|
-
}, {
|
|
22883
|
-
key: "getCurrentTheme",
|
|
22884
|
-
value: function getCurrentTheme() {
|
|
22885
|
-
return this.currentTheme;
|
|
22886
|
-
}
|
|
22887
|
-
|
|
22888
|
-
/**
|
|
22889
|
-
* Create a link element for CSS
|
|
22890
|
-
* @private
|
|
22891
|
-
*/
|
|
22892
|
-
}, {
|
|
22893
|
-
key: "createLinkElement",
|
|
22894
|
-
value: function createLinkElement(id, href) {
|
|
22895
|
-
var link = document.createElement('link');
|
|
22896
|
-
link.id = id;
|
|
22897
|
-
link.rel = 'stylesheet';
|
|
22898
|
-
link.href = this.resolveThemePath(href);
|
|
22899
|
-
return link;
|
|
22900
|
-
}
|
|
22901
|
-
|
|
22902
|
-
/**
|
|
22903
|
-
* Resolve theme path relative to solid-ui
|
|
22904
|
-
* @private
|
|
22905
|
-
*/
|
|
22906
|
-
}, {
|
|
22907
|
-
key: "resolveThemePath",
|
|
22908
|
-
value: function resolveThemePath(path) {
|
|
22909
|
-
// In development, path might need adjustment
|
|
22910
|
-
// In production (dist), themes should be copied alongside
|
|
22911
|
-
if (true) {
|
|
22912
|
-
return __webpack_require__.p + path;
|
|
22913
|
-
}
|
|
22914
|
-
|
|
22915
|
-
// Try to find solid-ui base path
|
|
22916
|
-
// removed by dead control flow
|
|
22917
|
-
var scripts;
|
|
22918
|
-
// removed by dead control flow
|
|
22919
|
-
var _iterator, _step;
|
|
22920
|
-
// removed by dead control flow
|
|
22921
|
-
var baseUrl, script;
|
|
22922
|
-
// removed by dead control flow
|
|
22923
|
-
|
|
22924
|
-
}
|
|
22925
|
-
|
|
22926
|
-
/**
|
|
22927
|
-
* Wait for stylesheet to load
|
|
22928
|
-
* @private
|
|
22929
|
-
*/
|
|
22930
|
-
}, {
|
|
22931
|
-
key: "waitForStylesheet",
|
|
22932
|
-
value: function waitForStylesheet(link) {
|
|
22933
|
-
return new Promise(function (resolve, reject) {
|
|
22934
|
-
link.onload = function () {
|
|
22935
|
-
return resolve();
|
|
22936
|
-
};
|
|
22937
|
-
link.onerror = function () {
|
|
22938
|
-
return reject(new Error("Failed to load: ".concat(link.href)));
|
|
22939
|
-
};
|
|
22940
|
-
|
|
22941
|
-
// Timeout after 10 seconds
|
|
22942
|
-
setTimeout(function () {
|
|
22943
|
-
return reject(new Error('Theme load timeout'));
|
|
22944
|
-
}, 10000);
|
|
22945
|
-
});
|
|
22946
|
-
}
|
|
22947
|
-
|
|
22948
|
-
/**
|
|
22949
|
-
* Get saved theme from localStorage
|
|
22950
|
-
* @private
|
|
22951
|
-
*/
|
|
22952
|
-
}, {
|
|
22953
|
-
key: "getSavedTheme",
|
|
22954
|
-
value: function getSavedTheme() {
|
|
22955
|
-
try {
|
|
22956
|
-
return localStorage.getItem(STORAGE_KEY) || DEFAULT_THEME;
|
|
22957
|
-
} catch (error) {
|
|
22958
|
-
return DEFAULT_THEME;
|
|
22959
|
-
}
|
|
22960
|
-
}
|
|
22961
|
-
|
|
22962
|
-
/**
|
|
22963
|
-
* Save theme to localStorage
|
|
22964
|
-
* @private
|
|
22965
|
-
*/
|
|
22966
|
-
}, {
|
|
22967
|
-
key: "saveTheme",
|
|
22968
|
-
value: function saveTheme(themeName) {
|
|
22969
|
-
try {
|
|
22970
|
-
localStorage.setItem(STORAGE_KEY, themeName);
|
|
22971
|
-
} catch (error) {
|
|
22972
|
-
console.warn('Failed to save theme preference:', error);
|
|
22973
|
-
}
|
|
22974
|
-
}
|
|
22975
|
-
|
|
22976
|
-
/**
|
|
22977
|
-
* Format theme name for display
|
|
22978
|
-
* @private
|
|
22979
|
-
*/
|
|
22980
|
-
}, {
|
|
22981
|
-
key: "formatThemeName",
|
|
22982
|
-
value: function formatThemeName(name) {
|
|
22983
|
-
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
22984
|
-
}
|
|
22985
|
-
|
|
22986
|
-
/**
|
|
22987
|
-
* Emit theme change event
|
|
22988
|
-
* @private
|
|
22989
|
-
*/
|
|
22990
|
-
}, {
|
|
22991
|
-
key: "emitThemeChange",
|
|
22992
|
-
value: function emitThemeChange(themeName) {
|
|
22993
|
-
var event = new CustomEvent('solid-ui-theme-change', {
|
|
22994
|
-
detail: {
|
|
22995
|
-
theme: themeName
|
|
22996
|
-
}
|
|
22997
|
-
});
|
|
22998
|
-
window.dispatchEvent(event);
|
|
22999
|
-
}
|
|
23000
|
-
}]);
|
|
23001
|
-
}(); // Create singleton instance
|
|
23002
|
-
var themeLoader = new ThemeLoader();
|
|
23003
|
-
|
|
23004
|
-
// Auto-initialize on load (can be disabled if manual control needed)
|
|
23005
|
-
if (typeof window !== 'undefined') {
|
|
23006
|
-
if (document.readyState === 'loading') {
|
|
23007
|
-
document.addEventListener('DOMContentLoaded', function () {
|
|
23008
|
-
return themeLoader.init();
|
|
23009
|
-
});
|
|
23010
|
-
} else {
|
|
23011
|
-
themeLoader.init();
|
|
23012
|
-
}
|
|
23013
|
-
}
|
|
23014
|
-
/* harmony default export */ const src_themeLoader = ((/* unused pure expression or super */ null && (themeLoader)));
|
|
23015
22358
|
;// ./src/table.js
|
|
23016
22359
|
// Table Widget: Format an array of RDF statements as an HTML table.
|
|
23017
22360
|
//
|
|
@@ -25256,9 +24599,9 @@ function throttle(func, wait) {
|
|
|
25256
24599
|
|
|
25257
24600
|
|
|
25258
24601
|
/* global EventListenerOrEventListenerObject */
|
|
25259
|
-
/*
|
|
25260
|
-
This file was copied from mashlib/src/global/header.ts file. It is modified to
|
|
25261
|
-
work in solid-ui by adjusting where imported functions are found.
|
|
24602
|
+
/*
|
|
24603
|
+
This file was copied from mashlib/src/global/header.ts file. It is modified to
|
|
24604
|
+
work in solid-ui by adjusting where imported functions are found.
|
|
25262
24605
|
*/
|
|
25263
24606
|
|
|
25264
24607
|
|
|
@@ -25270,42 +24613,42 @@ function throttle(func, wait) {
|
|
|
25270
24613
|
|
|
25271
24614
|
|
|
25272
24615
|
|
|
25273
|
-
/**
|
|
25274
|
-
* menu icons
|
|
24616
|
+
/**
|
|
24617
|
+
* menu icons
|
|
25275
24618
|
*/
|
|
25276
24619
|
var DEFAULT_HELP_MENU_ICON = iconBase/* icons */.Pt.iconBase + 'noun_help.svg';
|
|
25277
24620
|
var DEFAUL_SOLID_ICON_URL = 'https://solidproject.org/assets/img/solid-emblem.svg';
|
|
25278
24621
|
|
|
25279
|
-
/*
|
|
25280
|
-
HeaderOptions allow for customizing the logo and menu list. If a logo is not provided the default
|
|
25281
|
-
is solid. Menulist will always show a link to logout and to the users profile.
|
|
24622
|
+
/*
|
|
24623
|
+
HeaderOptions allow for customizing the logo and menu list. If a logo is not provided the default
|
|
24624
|
+
is solid. Menulist will always show a link to logout and to the users profile.
|
|
25282
24625
|
*/
|
|
25283
24626
|
|
|
25284
|
-
/**
|
|
25285
|
-
* Initialize header component, the header object returned depends on whether the user is authenticated.
|
|
25286
|
-
* @param store the data store
|
|
25287
|
-
* @param userMenuList a list of menu items when the user is logged in
|
|
25288
|
-
* @param options allow the header to be customized with a personalized logo, help icon and a help menu list of links or buttons.
|
|
25289
|
-
* @returns a header for an authenticated user with menu items given or a login screen
|
|
24627
|
+
/**
|
|
24628
|
+
* Initialize header component, the header object returned depends on whether the user is authenticated.
|
|
24629
|
+
* @param store the data store
|
|
24630
|
+
* @param userMenuList a list of menu items when the user is logged in
|
|
24631
|
+
* @param options allow the header to be customized with a personalized logo, help icon and a help menu list of links or buttons.
|
|
24632
|
+
* @returns a header for an authenticated user with menu items given or a login screen
|
|
25290
24633
|
*/
|
|
25291
24634
|
function initHeader(_x, _x2, _x3) {
|
|
25292
24635
|
return _initHeader.apply(this, arguments);
|
|
25293
24636
|
}
|
|
25294
|
-
/**
|
|
25295
|
-
* @ignore exporting this only for the unit test
|
|
24637
|
+
/**
|
|
24638
|
+
* @ignore exporting this only for the unit test
|
|
25296
24639
|
*/
|
|
25297
24640
|
function _initHeader() {
|
|
25298
|
-
_initHeader = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function
|
|
24641
|
+
_initHeader = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee2(store, userMenuList, options) {
|
|
25299
24642
|
var header, pod;
|
|
25300
|
-
return regenerator_default().wrap(function (
|
|
25301
|
-
while (1) switch (
|
|
24643
|
+
return regenerator_default().wrap(function (_context2) {
|
|
24644
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
25302
24645
|
case 0:
|
|
25303
24646
|
header = document.getElementById('PageHeader');
|
|
25304
24647
|
if (header) {
|
|
25305
|
-
|
|
24648
|
+
_context2.next = 1;
|
|
25306
24649
|
break;
|
|
25307
24650
|
}
|
|
25308
|
-
return
|
|
24651
|
+
return _context2.abrupt("return");
|
|
25309
24652
|
case 1:
|
|
25310
24653
|
pod = getPod();
|
|
25311
24654
|
rebuildHeader(header, store, pod, userMenuList, options)();
|
|
@@ -25313,9 +24656,9 @@ function _initHeader() {
|
|
|
25313
24656
|
external_SolidLogic_.authSession.events.on('login', rebuildHeader(header, store, pod, userMenuList, options));
|
|
25314
24657
|
case 2:
|
|
25315
24658
|
case "end":
|
|
25316
|
-
return
|
|
24659
|
+
return _context2.stop();
|
|
25317
24660
|
}
|
|
25318
|
-
},
|
|
24661
|
+
}, _callee2);
|
|
25319
24662
|
}));
|
|
25320
24663
|
return _initHeader.apply(this, arguments);
|
|
25321
24664
|
}
|
|
@@ -25339,20 +24682,20 @@ function rebuildHeader(header, store, pod, userMenuList, options) {
|
|
|
25339
24682
|
}, _callee);
|
|
25340
24683
|
}));
|
|
25341
24684
|
}
|
|
25342
|
-
/**
|
|
25343
|
-
* @ignore exporting this only for the unit test
|
|
24685
|
+
/**
|
|
24686
|
+
* @ignore exporting this only for the unit test
|
|
25344
24687
|
*/
|
|
25345
24688
|
function createBanner(_x4, _x5, _x6, _x7, _x8) {
|
|
25346
24689
|
return _createBanner.apply(this, arguments);
|
|
25347
24690
|
}
|
|
25348
|
-
/**
|
|
25349
|
-
* @ignore exporting this only for the unit test
|
|
24691
|
+
/**
|
|
24692
|
+
* @ignore exporting this only for the unit test
|
|
25350
24693
|
*/
|
|
25351
24694
|
function _createBanner() {
|
|
25352
|
-
_createBanner = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function
|
|
25353
|
-
var podLink, image, userMenu, banner, leftSideOfHeader, helpMenu,
|
|
25354
|
-
return regenerator_default().wrap(function (
|
|
25355
|
-
while (1) switch (
|
|
24695
|
+
_createBanner = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee3(store, pod, user, userMenuList, options) {
|
|
24696
|
+
var podLink, image, userMenu, banner, leftSideOfHeader, helpMenu, _t2;
|
|
24697
|
+
return regenerator_default().wrap(function (_context3) {
|
|
24698
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
25356
24699
|
case 0:
|
|
25357
24700
|
podLink = document.createElement('a');
|
|
25358
24701
|
podLink.href = pod.uri;
|
|
@@ -25364,19 +24707,19 @@ function _createBanner() {
|
|
|
25364
24707
|
image.setAttribute('style', style.headerBannerIcon);
|
|
25365
24708
|
podLink.appendChild(image);
|
|
25366
24709
|
if (!user) {
|
|
25367
|
-
|
|
24710
|
+
_context3.next = 2;
|
|
25368
24711
|
break;
|
|
25369
24712
|
}
|
|
25370
|
-
|
|
24713
|
+
_context3.next = 1;
|
|
25371
24714
|
return createUserMenu(store, user, userMenuList);
|
|
25372
24715
|
case 1:
|
|
25373
|
-
|
|
25374
|
-
|
|
24716
|
+
_t2 = _context3.sent;
|
|
24717
|
+
_context3.next = 3;
|
|
25375
24718
|
break;
|
|
25376
24719
|
case 2:
|
|
25377
|
-
|
|
24720
|
+
_t2 = createLoginSignUpButtons();
|
|
25378
24721
|
case 3:
|
|
25379
|
-
userMenu =
|
|
24722
|
+
userMenu = _t2;
|
|
25380
24723
|
banner = document.createElement('div');
|
|
25381
24724
|
banner.setAttribute('style', style.headerBanner);
|
|
25382
24725
|
banner.appendChild(podLink);
|
|
@@ -25388,12 +24731,12 @@ function _createBanner() {
|
|
|
25388
24731
|
leftSideOfHeader.appendChild(helpMenu);
|
|
25389
24732
|
}
|
|
25390
24733
|
banner.appendChild(leftSideOfHeader);
|
|
25391
|
-
return
|
|
24734
|
+
return _context3.abrupt("return", banner);
|
|
25392
24735
|
case 4:
|
|
25393
24736
|
case "end":
|
|
25394
|
-
return
|
|
24737
|
+
return _context3.stop();
|
|
25395
24738
|
}
|
|
25396
|
-
},
|
|
24739
|
+
}, _callee3);
|
|
25397
24740
|
}));
|
|
25398
24741
|
return _createBanner.apply(this, arguments);
|
|
25399
24742
|
}
|
|
@@ -25401,88 +24744,6 @@ function createHelpMenu(options, helpMenuItems) {
|
|
|
25401
24744
|
if (!helpMenuItems) return;
|
|
25402
24745
|
var helpMenuList = document.createElement('ul');
|
|
25403
24746
|
helpMenuList.setAttribute('style', style.headerUserMenuList);
|
|
25404
|
-
|
|
25405
|
-
// Add theme selector submenu at the top
|
|
25406
|
-
try {
|
|
25407
|
-
var _UI, _UI2;
|
|
25408
|
-
var themeLoader = ((_UI = globalThis.UI) === null || _UI === void 0 ? void 0 : _UI.themeLoader) || ((_UI2 = window.UI) === null || _UI2 === void 0 ? void 0 : _UI2.themeLoader);
|
|
25409
|
-
if (themeLoader) {
|
|
25410
|
-
// Add theme label
|
|
25411
|
-
var themeLabel = document.createElement('li');
|
|
25412
|
-
themeLabel.setAttribute('style', style.headerUserMenuItem + ' font-weight: bold; padding: 0.5em 1em; color: #666; font-size: 0.9em;');
|
|
25413
|
-
themeLabel.textContent = '🎨 Themes';
|
|
25414
|
-
helpMenuList.appendChild(themeLabel);
|
|
25415
|
-
|
|
25416
|
-
// Add theme options
|
|
25417
|
-
var themes = [{
|
|
25418
|
-
name: 'classic',
|
|
25419
|
-
label: '📘 Classic',
|
|
25420
|
-
icon: '📘'
|
|
25421
|
-
}, {
|
|
25422
|
-
name: 'default',
|
|
25423
|
-
label: '💜 Default',
|
|
25424
|
-
icon: '💜'
|
|
25425
|
-
}, {
|
|
25426
|
-
name: 'wave',
|
|
25427
|
-
label: '💚 Wave',
|
|
25428
|
-
icon: '💚'
|
|
25429
|
-
}, {
|
|
25430
|
-
name: 'telegram',
|
|
25431
|
-
label: '💙 Telegram',
|
|
25432
|
-
icon: '💙'
|
|
25433
|
-
}, {
|
|
25434
|
-
name: 'signal',
|
|
25435
|
-
label: '🔵 Signal',
|
|
25436
|
-
icon: '🔵'
|
|
25437
|
-
}];
|
|
25438
|
-
var currentTheme = themeLoader.getCurrentTheme();
|
|
25439
|
-
themes.forEach(function (theme) {
|
|
25440
|
-
var themeButton = createUserMenuButton(theme.label + (theme.name === currentTheme ? ' ✓' : ''), /*#__PURE__*/asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee2() {
|
|
25441
|
-
var _t2;
|
|
25442
|
-
return regenerator_default().wrap(function (_context2) {
|
|
25443
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
25444
|
-
case 0:
|
|
25445
|
-
_context2.prev = 0;
|
|
25446
|
-
_context2.next = 1;
|
|
25447
|
-
return themeLoader.loadTheme(theme.name);
|
|
25448
|
-
case 1:
|
|
25449
|
-
console.log("Theme switched to: ".concat(theme.label));
|
|
25450
|
-
// Update checkmarks in all theme buttons
|
|
25451
|
-
setTimeout(function () {
|
|
25452
|
-
var newCurrentTheme = themeLoader.getCurrentTheme();
|
|
25453
|
-
helpMenuList.querySelectorAll('button').forEach(function (btn, idx) {
|
|
25454
|
-
// Theme buttons are first 5 buttons (after the label)
|
|
25455
|
-
if (idx < themes.length) {
|
|
25456
|
-
var themeInfo = themes[idx];
|
|
25457
|
-
btn.textContent = themeInfo.label + (themeInfo.name === newCurrentTheme ? ' ✓' : '');
|
|
25458
|
-
}
|
|
25459
|
-
});
|
|
25460
|
-
}, 100);
|
|
25461
|
-
_context2.next = 3;
|
|
25462
|
-
break;
|
|
25463
|
-
case 2:
|
|
25464
|
-
_context2.prev = 2;
|
|
25465
|
-
_t2 = _context2["catch"](0);
|
|
25466
|
-
console.error('Failed to switch theme:', _t2);
|
|
25467
|
-
case 3:
|
|
25468
|
-
case "end":
|
|
25469
|
-
return _context2.stop();
|
|
25470
|
-
}
|
|
25471
|
-
}, _callee2, null, [[0, 2]]);
|
|
25472
|
-
})));
|
|
25473
|
-
helpMenuList.appendChild(createUserMenuItem(themeButton));
|
|
25474
|
-
});
|
|
25475
|
-
|
|
25476
|
-
// Add separator
|
|
25477
|
-
var separator = document.createElement('li');
|
|
25478
|
-
separator.setAttribute('style', 'border-top: 1px solid #ddd; margin: 0.5em 0;');
|
|
25479
|
-
helpMenuList.appendChild(separator);
|
|
25480
|
-
}
|
|
25481
|
-
} catch (error) {
|
|
25482
|
-
console.warn('Theme loader not available', error);
|
|
25483
|
-
}
|
|
25484
|
-
|
|
25485
|
-
// Add regular help menu items
|
|
25486
24747
|
helpMenuItems.forEach(function (menuItem) {
|
|
25487
24748
|
var menuItemType = menuItem.url ? 'url' : 'onclick';
|
|
25488
24749
|
if (menuItemType === 'url') {
|
|
@@ -25529,8 +24790,8 @@ function createHelpMenu(options, helpMenuItems) {
|
|
|
25529
24790
|
});
|
|
25530
24791
|
return helpMenuContainer;
|
|
25531
24792
|
}
|
|
25532
|
-
/**
|
|
25533
|
-
* @ignore exporting this only for the unit test
|
|
24793
|
+
/**
|
|
24794
|
+
* @ignore exporting this only for the unit test
|
|
25534
24795
|
*/
|
|
25535
24796
|
function createLoginSignUpButtons() {
|
|
25536
24797
|
var profileLoginButtonPre = document.createElement('div');
|
|
@@ -25538,8 +24799,8 @@ function createLoginSignUpButtons() {
|
|
|
25538
24799
|
profileLoginButtonPre.appendChild(loginStatusBox(document, null, {}));
|
|
25539
24800
|
return profileLoginButtonPre;
|
|
25540
24801
|
}
|
|
25541
|
-
/**
|
|
25542
|
-
* @ignore exporting this only for the unit test
|
|
24802
|
+
/**
|
|
24803
|
+
* @ignore exporting this only for the unit test
|
|
25543
24804
|
*/
|
|
25544
24805
|
function createUserMenuButton(label, onClick) {
|
|
25545
24806
|
var button = document.createElement('button');
|
|
@@ -25554,8 +24815,8 @@ function createUserMenuButton(label, onClick) {
|
|
|
25554
24815
|
button.innerText = label;
|
|
25555
24816
|
return button;
|
|
25556
24817
|
}
|
|
25557
|
-
/**
|
|
25558
|
-
* @ignore exporting this only for the unit test
|
|
24818
|
+
/**
|
|
24819
|
+
* @ignore exporting this only for the unit test
|
|
25559
24820
|
*/
|
|
25560
24821
|
function createUserMenuLink(label, href, target) {
|
|
25561
24822
|
var link = document.createElement('a');
|
|
@@ -25572,28 +24833,28 @@ function createUserMenuLink(label, href, target) {
|
|
|
25572
24833
|
return link;
|
|
25573
24834
|
}
|
|
25574
24835
|
|
|
25575
|
-
/**
|
|
25576
|
-
* @ignore exporting this only for the unit test
|
|
24836
|
+
/**
|
|
24837
|
+
* @ignore exporting this only for the unit test
|
|
25577
24838
|
*/
|
|
25578
24839
|
function createUserMenu(_x9, _x0, _x1) {
|
|
25579
24840
|
return _createUserMenu.apply(this, arguments);
|
|
25580
24841
|
}
|
|
25581
24842
|
|
|
25582
|
-
/**
|
|
25583
|
-
* @ignore exporting this only for the unit test
|
|
24843
|
+
/**
|
|
24844
|
+
* @ignore exporting this only for the unit test
|
|
25584
24845
|
*/
|
|
25585
24846
|
function _createUserMenu() {
|
|
25586
|
-
_createUserMenu = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function
|
|
24847
|
+
_createUserMenu = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee4(store, user, userMenuList) {
|
|
25587
24848
|
var fetcher, loggedInMenuList, loggedInMenu, loggedInMenuTrigger, profileImg, loggedInMenuContainer, throttledMenuToggle, timer;
|
|
25588
|
-
return regenerator_default().wrap(function (
|
|
25589
|
-
while (1) switch (
|
|
24849
|
+
return regenerator_default().wrap(function (_context4) {
|
|
24850
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
25590
24851
|
case 0:
|
|
25591
24852
|
fetcher = store.fetcher;
|
|
25592
24853
|
if (!fetcher) {
|
|
25593
|
-
|
|
24854
|
+
_context4.next = 1;
|
|
25594
24855
|
break;
|
|
25595
24856
|
}
|
|
25596
|
-
|
|
24857
|
+
_context4.next = 1;
|
|
25597
24858
|
return fetcher.load(user);
|
|
25598
24859
|
case 1:
|
|
25599
24860
|
loggedInMenuList = document.createElement('ul');
|
|
@@ -25646,12 +24907,12 @@ function _createUserMenu() {
|
|
|
25646
24907
|
var nav = document.getElementById('loggedInNav');
|
|
25647
24908
|
nav === null || nav === void 0 || nav.setAttribute('style', style.headerUserMenuNavigationMenuNotDisplayed);
|
|
25648
24909
|
});
|
|
25649
|
-
return
|
|
24910
|
+
return _context4.abrupt("return", loggedInMenuContainer);
|
|
25650
24911
|
case 2:
|
|
25651
24912
|
case "end":
|
|
25652
|
-
return
|
|
24913
|
+
return _context4.stop();
|
|
25653
24914
|
}
|
|
25654
|
-
},
|
|
24915
|
+
}, _callee4);
|
|
25655
24916
|
}));
|
|
25656
24917
|
return _createUserMenu.apply(this, arguments);
|
|
25657
24918
|
}
|
|
@@ -25661,8 +24922,8 @@ function createUserMenuItem(child) {
|
|
|
25661
24922
|
menuProfileItem.appendChild(child);
|
|
25662
24923
|
return menuProfileItem;
|
|
25663
24924
|
}
|
|
25664
|
-
/**
|
|
25665
|
-
* @ignore exporting this only for the unit test
|
|
24925
|
+
/**
|
|
24926
|
+
* @ignore exporting this only for the unit test
|
|
25666
24927
|
*/
|
|
25667
24928
|
function getProfileImg(store, user) {
|
|
25668
24929
|
var profileUrl = null;
|
|
@@ -25680,8 +24941,8 @@ function getProfileImg(store, user) {
|
|
|
25680
24941
|
return profileImage;
|
|
25681
24942
|
}
|
|
25682
24943
|
|
|
25683
|
-
/**
|
|
25684
|
-
* @internal
|
|
24944
|
+
/**
|
|
24945
|
+
* @internal
|
|
25685
24946
|
*/
|
|
25686
24947
|
function toggleMenu(event, trigger, menu) {
|
|
25687
24948
|
var isExpanded = trigger.getAttribute('aria-expanded') === 'true';
|
|
@@ -25809,43 +25070,43 @@ function createControllerInfoBlock(store, user, pod, podOwner, options) {
|
|
|
25809
25070
|
;// ./src/create/types.ts
|
|
25810
25071
|
|
|
25811
25072
|
;// ./src/index.ts
|
|
25812
|
-
/*
|
|
25813
|
-
The MIT License (MIT)
|
|
25814
|
-
|
|
25815
|
-
Copyright (c) 2015-2016 Solid
|
|
25816
|
-
|
|
25817
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
25818
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
25819
|
-
in the Software without restriction, including without limitation the rights
|
|
25820
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25821
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
25822
|
-
furnished to do so, subject to the following conditions:
|
|
25823
|
-
|
|
25824
|
-
The above copyright notice and this permission notice shall be included in all
|
|
25825
|
-
copies or substantial portions of the Software.
|
|
25826
|
-
|
|
25827
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25828
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25829
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25830
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25831
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25832
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25833
|
-
SOFTWARE.
|
|
25834
|
-
|
|
25835
|
-
If you would like to know more about the solid Solid project, please see
|
|
25836
|
-
https://github.com/solidos/solid
|
|
25073
|
+
/*
|
|
25074
|
+
The MIT License (MIT)
|
|
25075
|
+
|
|
25076
|
+
Copyright (c) 2015-2016 Solid
|
|
25077
|
+
|
|
25078
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
25079
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
25080
|
+
in the Software without restriction, including without limitation the rights
|
|
25081
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25082
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
25083
|
+
furnished to do so, subject to the following conditions:
|
|
25084
|
+
|
|
25085
|
+
The above copyright notice and this permission notice shall be included in all
|
|
25086
|
+
copies or substantial portions of the Software.
|
|
25087
|
+
|
|
25088
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25089
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25090
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25091
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25092
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25093
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25094
|
+
SOFTWARE.
|
|
25095
|
+
|
|
25096
|
+
If you would like to know more about the solid Solid project, please see
|
|
25097
|
+
https://github.com/solidos/solid
|
|
25837
25098
|
*/
|
|
25838
25099
|
|
|
25839
25100
|
|
|
25840
|
-
/**
|
|
25841
|
-
* Provides a Solid client helper object (which exposes various static modules).
|
|
25842
|
-
* @module UI.js
|
|
25843
|
-
* @main UI.js
|
|
25101
|
+
/**
|
|
25102
|
+
* Provides a Solid client helper object (which exposes various static modules).
|
|
25103
|
+
* @module UI.js
|
|
25104
|
+
* @main UI.js
|
|
25844
25105
|
*/
|
|
25845
25106
|
|
|
25846
|
-
/**
|
|
25847
|
-
* @class UI
|
|
25848
|
-
* @static
|
|
25107
|
+
/**
|
|
25108
|
+
* @class UI
|
|
25109
|
+
* @static
|
|
25849
25110
|
*/
|
|
25850
25111
|
|
|
25851
25112
|
// REMOVE @ts-ignore as you migrate files to TypeScript
|
|
@@ -25873,8 +25134,6 @@ https://github.com/solidos/solid
|
|
|
25873
25134
|
|
|
25874
25135
|
// @ts-ignore
|
|
25875
25136
|
|
|
25876
|
-
// @ts-ignore
|
|
25877
|
-
|
|
25878
25137
|
|
|
25879
25138
|
// @ts-ignore
|
|
25880
25139
|
|
|
@@ -25906,7 +25165,6 @@ if (typeof window !== 'undefined') {
|
|
|
25906
25165
|
participation: participation_namespaceObject,
|
|
25907
25166
|
preferences: preferences_namespaceObject,
|
|
25908
25167
|
style: style,
|
|
25909
|
-
themeLoader: themeLoader,
|
|
25910
25168
|
table: renderTableViewPane,
|
|
25911
25169
|
tabs: tabs_namespaceObject,
|
|
25912
25170
|
utils: utils_namespaceObject,
|