Initial commit

This commit is contained in:
yigid committed 2024-10-01 22:56:10 +03:00 Verified
commit 18d1a02e98
9 files changed
+2978

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
/*! For license information please see bundle.js.LICENSE.txt */
(()=>{var __webpack_modules__={"./index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _roadhog_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./roadhog.js */ \"./roadhog.js\");\n\n\nconst endpoint = \"http://localhost:3000\";\n\nasync function signIn(type) {\n try {\n const result = await (0,_roadhog_js__WEBPACK_IMPORTED_MODULE_0__.signIn)(type);\n if (result.success) {\n console.log('Successfully signed in with', type);\n const b = document.createElement('button');\n b.innerText = 'Click to access protected';\n b.setAttribute('onclick', 'fetchProtected()');\n document.body.appendChild(b);\n } else {\n console.error('Sign-in failed:', result.error);\n }\n } catch (error) {\n console.error('Sign-in error:', error);\n }\n}\n\nasync function signOff() {\n\n}\n\nasync function fetchProtected() {\n const response = await fetch(`${endpoint}/protected`, {\n method: 'GET',\n headers: {\n 'Authorization': `Bearer ${localStorage.getItem('auth_token')}`\n }\n });\n if (!response.ok) {\n console.error('error fetching /protected:', response);\n } else {\n const { message, address, type } = await response.json();\n console.log('success fetching /protected:', `you are ${address} from ${type} and CCIR says ${message}.`);\n }\n}\n\nwindow.signIn = signIn;\nwindow.fetchProtected = fetchProtected;\nwindow.signOff = signOff;\n\nfunction init() {\n console.log('start');\n if (!window.ethereum) console.log('ethereum not detected');\n if (!window.solana) console.log('solana not detected');\n}\n\nwindow.addEventListener('load', init);\n\n\n//# sourceURL=webpack:///./index.js?")},"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/_shortw_utils.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.createCurve = exports.getHash = void 0;\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nconst hmac_1 = __webpack_require__(/*! @noble/hashes/hmac */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/hmac.js");\nconst utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/utils.js");\nconst weierstrass_js_1 = __webpack_require__(/*! ./abstract/weierstrass.js */ "./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/weierstrass.js");\n// connects noble-curves to noble-hashes\nfunction getHash(hash) {\n return {\n hash,\n hmac: (key, ...msgs) => (0, hmac_1.hmac)(hash, key, (0, utils_1.concatBytes)(...msgs)),\n randomBytes: utils_1.randomBytes,\n };\n}\nexports.getHash = getHash;\nfunction createCurve(curveDef, defHash) {\n const create = (hash) => (0, weierstrass_js_1.weierstrass)({ ...curveDef, ...getHash(hash) });\n return Object.freeze({ ...create(defHash), create });\n}\nexports.createCurve = createCurve;\n//# sourceMappingURL=_shortw_utils.js.map\n\n//# sourceURL=webpack:///./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/_shortw_utils.js?')},"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/curve.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateBasic = exports.wNAF = void 0;\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Abelian group utilities\nconst modular_js_1 = __webpack_require__(/*! ./modular.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/modular.js\");\nconst utils_js_1 = __webpack_require__(/*! ./utils.js */ \"./node_modules/.pnpm/@noble+curves@1.2.0/node_modules/@noble/curves/abstract/utils.js\");\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\n// Elliptic curve multiplication of Point by scalar. Fragile.\n// Scalars should always be less than curve order: this should be checked inside of a curve itself.\n// Creates precomputation tables for fast multiplication:\n// - private scalar is split by fixed size windows of W bits\n// - every window point is collected from window's table & added to accumulator\n// - since windows are different, same point inside tables won't be accessed more than once per calc\n// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)\n// - +1 window is neccessary for wNAF\n// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication\n// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow\n// windows to be in different memory locations\nfunction wNAF(c, bits) {\n const constTimeNegate = (condition, item) => {\n const neg = item.negate();\n return co Line truncated
+1291
View File
File diff suppressed because it is too large. Load diff