@lukso/core 1.2.10 → 1.2.11-dev.637d4ef
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 +171 -3
- package/dist/chunk-2KVLFGLM.cjs +260 -0
- package/dist/chunk-2KVLFGLM.cjs.map +1 -0
- package/dist/{chunk-GFLV5EJV.js → chunk-RECO5F6T.js} +102 -1
- package/dist/chunk-RECO5F6T.js.map +1 -0
- package/dist/index.cjs +24 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -9
- package/dist/index.js.map +1 -1
- package/dist/mixins/index.cjs +1 -1
- package/dist/mixins/index.cjs.map +1 -1
- package/dist/mixins/index.js +1 -1
- package/dist/services/index.cjs +2 -2
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.js +3 -3
- package/dist/utils/index.cjs +18 -2
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +202 -1
- package/dist/utils/index.d.ts +202 -1
- package/dist/utils/index.js +19 -3
- package/package.json +7 -7
- package/src/utils/__tests__/signed-profile-urls.spec.ts +276 -0
- package/src/utils/index.ts +10 -1
- package/src/utils/signed-profile-urls.ts +385 -0
- package/dist/chunk-GFLV5EJV.js.map +0 -1
- package/dist/chunk-QU6NUTY6.cjs +0 -159
- package/dist/chunk-QU6NUTY6.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/browserInfo.ts","../src/utils/signed-profile-urls.ts","../src/utils/slug.ts","../src/utils/url-resolver.ts"],"sourcesContent":["import type { DeviceService } from '../services'\n\nexport type BrowserName =\n | 'chrome'\n | 'safari'\n | 'firefox'\n | 'edge'\n | 'opera'\n | 'brave'\n\nexport type BrowserInfo = {\n id: BrowserName\n name: string\n icon: string\n storeLink: string\n}\n\n// extension store links (all webkit based browsers use chrome web store installation)\nexport const EXTENSION_STORE_LINKS = {\n chrome:\n 'https://chrome.google.com/webstore/detail/universal-profiles-testin/abpickdkkbnbcoepogfhkhennhfhehfn',\n brave:\n 'https://chrome.google.com/webstore/detail/universal-profiles-testin/abpickdkkbnbcoepogfhkhennhfhehfn',\n edge: 'https://chrome.google.com/webstore/detail/universal-profiles-testin/abpickdkkbnbcoepogfhkhennhfhehfn',\n opera: '',\n safari: '',\n firefox: '',\n}\n\n/**\n * Expose browser info to the app\n */\nexport const browserInfo = (deviceService: DeviceService): BrowserInfo => {\n const browserInfoDefaults = {\n id: 'chrome',\n name: '',\n icon: '',\n } as BrowserInfo\n\n const detectBrowser = (): BrowserInfo | undefined => {\n const { isChrome, isBrave, isFirefox, isSafari, isEdge, isOpera } =\n deviceService\n\n if (isBrave) {\n return {\n id: 'brave',\n name: 'Brave',\n icon: 'logo-brave',\n storeLink: EXTENSION_STORE_LINKS.brave,\n }\n }\n\n if (isEdge) {\n return {\n id: 'edge',\n name: 'Edge',\n icon: 'logo-edge',\n storeLink: EXTENSION_STORE_LINKS.edge,\n }\n }\n\n if (isOpera) {\n return {\n id: 'opera',\n name: 'Opera',\n icon: 'logo-opera',\n storeLink: EXTENSION_STORE_LINKS.opera,\n }\n }\n\n if (isChrome) {\n return {\n id: 'chrome',\n name: 'Chrome',\n icon: 'logo-chrome',\n storeLink: EXTENSION_STORE_LINKS.chrome,\n }\n }\n\n if (isFirefox) {\n return {\n id: 'firefox',\n name: 'Firefox',\n icon: 'logo-firefox',\n storeLink: EXTENSION_STORE_LINKS.firefox,\n }\n }\n\n if (isSafari) {\n return {\n id: 'safari',\n name: 'Safari',\n icon: 'logo-safari',\n storeLink: EXTENSION_STORE_LINKS.safari,\n }\n }\n }\n\n const browserInfo = { ...browserInfoDefaults, ...detectBrowser() }\n\n return browserInfo\n}\n","/**\n * @service-checkin/signed-qr-code\n *\n * Create and verify signed QR codes for Universal Profile check-ins.\n * Pure TypeScript - compatible with React Native, Node.js, and browsers.\n *\n * URI Format: ethereum:<address>@<chainId>?ts=<unixTimestamp>&sig=<signature>\n *\n * The signed message is everything before &sig= (the URI without the signature).\n * Uses EIP-191 prefixed signing (signMessage) for safety - this prevents\n * signed messages from being confused with transaction hashes.\n */\n\nimport { type Hex, hashMessage, recoverMessageAddress } from 'viem'\nimport { privateKeyToAccount } from 'viem/accounts'\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface SignedQRData {\n /** The Universal Profile address */\n profileAddress: string\n /** The chain ID (42 for LUKSO mainnet, 4201 for testnet) */\n chainId: number\n /** Unix timestamp (seconds since epoch) */\n timestamp: number\n /** The signature over the message */\n signature: Hex\n}\n\n/**\n * Custom signer function type.\n * Takes the message string and returns an EIP-191 signature.\n * The signer should use `signMessage` (which adds the EIP-191 prefix).\n * Compatible with hardware wallets, secure enclaves, WalletConnect, etc.\n *\n * The EIP-191 prefix prevents signed messages from being confused with\n * transaction hashes, making this safe for identity verification.\n */\nexport type SignerFunction = (message: string) => Promise<Hex>\n\nexport interface CreateSignedQROptions {\n /**\n * Seconds to add to current time to account for QR generation/display latency.\n * The QR timestamp will be set to (now + generationOffsetSeconds).\n * Capped at 5 seconds maximum to prevent abuse.\n * Default: 0\n */\n generationOffsetSeconds?: number\n\n /**\n * Custom signer function for signing the message.\n * If provided, the privateKey parameter can be omitted or set to null.\n * Useful for hardware wallets, secure enclaves, or WalletConnect.\n *\n * The signer receives the message string and should use `signMessage`\n * (EIP-191 prefixed signing) to return the signature.\n *\n * @example\n * ```ts\n * // Using a wallet that signs messages\n * const uri = await createSignedQR(null, profileAddress, 42, {\n * signer: async (message) => {\n * return await wallet.signMessage(message)\n * }\n * })\n * ```\n */\n signer?: SignerFunction\n}\n\nexport interface VerifySignedQROptions {\n /** Maximum age in seconds before QR is considered expired (default: 60) */\n maxAgeSeconds?: number\n /** Skip timestamp validation (useful for testing) */\n skipTimestampValidation?: boolean\n}\n\nexport interface VerificationResult {\n /** Whether the QR code is valid and not expired */\n isValid: boolean\n /** The Universal Profile address from the QR */\n profileAddress: string\n /** The chain ID from the QR */\n chainId: number\n /** The timestamp from the QR (unix seconds) */\n timestamp: number\n /** The address recovered from the signature (the controller) */\n recoveredAddress: string\n /** Whether the QR has expired based on maxAgeSeconds */\n isExpired: boolean\n /** The original signed message (for EIP-1271 verification) */\n message: string\n /** The hash of the message (for EIP-1271 verification) */\n messageHash: Hex\n}\n\nexport interface ParsedQRData {\n profileAddress: string\n chainId: number\n timestamp: number\n signature: Hex\n message: string\n}\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/** URI scheme for signed QR codes */\nexport const URI_SCHEME = 'ethereum'\n\n/** Regex pattern for parsing signed QR URIs */\nconst URI_PATTERN =\n /^ethereum:(0x[a-fA-F0-9]{40})@(\\d+)\\?ts=(\\d+)&sig=(0x[a-fA-F0-9]+)$/\n\n// ============================================================================\n// Core Functions\n// ============================================================================\n\n/**\n * Create the message that will be signed.\n * This is the URI without the signature parameter.\n */\nexport function createMessage(\n profileAddress: string,\n chainId: number,\n timestamp: number\n): string {\n return `${URI_SCHEME}:${profileAddress.toLowerCase()}@${chainId}?ts=${timestamp}`\n}\n\n/** Maximum allowed generation offset to prevent abuse */\nconst MAX_GENERATION_OFFSET_SECONDS = 5\n\n/**\n * Create a signed QR URI string.\n *\n * @param privateKey - The controller's private key (hex string with 0x prefix).\n * Can be '0x' or omitted if using options.signer.\n * @param profileAddress - The Universal Profile address to sign for\n * @param chainId - The chain ID (42 for LUKSO mainnet, 4201 for testnet)\n * @param options - Optional configuration including custom signer\n * @returns The complete signed URI string ready to encode as QR\n *\n * @example\n * ```ts\n * // Using a private key directly\n * const uri = await createSignedQR(\n * '0x1234...', // controller private key\n * '0xabcd...', // profile address\n * 42, // LUKSO mainnet\n * { generationOffsetSeconds: 2 }\n * )\n *\n * // Using a custom signer (WalletConnect, hardware wallet, etc.)\n * const uri = await createSignedQR(\n * null, // not needed when signer is provided\n * '0xabcd...', // profile address\n * 42, // LUKSO mainnet\n * {\n * signer: async (message) => await wallet.signMessage(message)\n * }\n * )\n * // Returns: ethereum:0xabcd...@42?ts=1706345678&sig=0x...\n * ```\n */\nexport async function createSignedQR(\n privateKey: Hex | null,\n profileAddress: string,\n chainId: number,\n options?: CreateSignedQROptions\n): Promise<string> {\n // Cap the offset at MAX_GENERATION_OFFSET_SECONDS to prevent abuse\n const requestedOffset = options?.generationOffsetSeconds ?? 0\n const generationOffset = Math.min(\n Math.max(0, requestedOffset),\n MAX_GENERATION_OFFSET_SECONDS\n )\n const timestamp = Math.floor(Date.now() / 1000) + generationOffset\n\n const message = createMessage(profileAddress, chainId, timestamp)\n\n let signature: Hex\n\n if (options?.signer) {\n // Use custom signer (hardware wallet, secure enclave, WalletConnect, etc.)\n // Pass the message string - signer should use signMessage (EIP-191)\n signature = await options.signer(message)\n } else if (privateKey && privateKey !== '0x') {\n // Use private key directly with EIP-191 prefix (signMessage)\n const account = privateKeyToAccount(privateKey)\n signature = await account.signMessage({ message })\n } else {\n throw new Error(\n 'Either a valid privateKey or options.signer must be provided'\n )\n }\n\n return `${message}&sig=${signature}`\n}\n\n/**\n * Parse a signed QR URI without verification.\n * Use this when you need to extract data before full verification.\n *\n * @param uri - The signed QR URI string\n * @returns Parsed data or null if format is invalid\n */\nexport function parseSignedQR(uri: string): ParsedQRData | null {\n const match = uri.match(URI_PATTERN)\n\n if (!match) {\n return null\n }\n\n const [, profileAddress, chainIdStr, timestampStr, signature] = match\n\n return {\n profileAddress: profileAddress.toLowerCase(),\n chainId: Number.parseInt(chainIdStr, 10),\n timestamp: Number.parseInt(timestampStr, 10),\n signature: signature as Hex,\n message: createMessage(\n profileAddress,\n Number.parseInt(chainIdStr, 10),\n Number.parseInt(timestampStr, 10)\n ),\n }\n}\n\n/**\n * Verify a signed QR URI and recover the signer.\n *\n * This performs:\n * 1. URI format validation\n * 2. Signature recovery (gets the controller address that signed)\n * 3. Timestamp validation (checks if expired)\n *\n * Note: This does NOT verify that the recovered address is an authorized\n * controller of the profile. That check should be done separately using\n * EIP-1271 isValidSignature() or by checking controller permissions on-chain.\n *\n * @param uri - The signed QR URI string\n * @param options - Optional configuration\n * @returns Verification result with recovered address\n *\n * @example\n * ```ts\n * const result = await verifySignedQR(uri)\n *\n * if (result.isValid) {\n * console.log('Profile:', result.profileAddress)\n * console.log('Signed by:', result.recoveredAddress)\n *\n * // Now verify the signer is an authorized controller\n * // Option 1: Check if recoveredAddress === profileAddress (EOA case)\n * // Option 2: Call isValidSignature() on the profile contract\n * }\n * ```\n */\nexport async function verifySignedQR(\n uri: string,\n options?: VerifySignedQROptions\n): Promise<VerificationResult> {\n const maxAgeSeconds = options?.maxAgeSeconds ?? 60\n const skipTimestampValidation = options?.skipTimestampValidation ?? false\n\n // Parse the URI\n const parsed = parseSignedQR(uri)\n\n if (!parsed) {\n throw new Error('Invalid QR format: does not match expected URI pattern')\n }\n\n const { profileAddress, chainId, timestamp, signature, message } = parsed\n\n // Compute the EIP-191 message hash for storage\n const messageHash = hashMessage(message)\n\n // Recover the signer address using EIP-191 message recovery\n const recoveredAddress = await recoverMessageAddress({\n message,\n signature,\n })\n\n // Check if expired\n const now = Math.floor(Date.now() / 1000)\n const isExpired = !skipTimestampValidation && timestamp + maxAgeSeconds < now\n\n return {\n isValid: !isExpired,\n profileAddress,\n chainId,\n timestamp,\n recoveredAddress: recoveredAddress.toLowerCase(),\n isExpired,\n message,\n messageHash,\n }\n}\n\n/**\n * Check if a string looks like a valid signed QR URI.\n * This is a quick format check without full verification.\n */\nexport function isSignedQRFormat(uri: string): boolean {\n return URI_PATTERN.test(uri)\n}\n\n/**\n * Get the controller address from a private key.\n * Useful for displaying which address will sign the QR codes.\n */\nexport function getControllerAddress(privateKey: Hex): string {\n const account = privateKeyToAccount(privateKey)\n return account.address\n}\n\n// ============================================================================\n// EIP-1271 Helpers\n// ============================================================================\n\n/**\n * EIP-1271 magic value returned for valid signatures\n */\nexport const EIP1271_MAGIC_VALUE = '0x1626ba7e' as const\n\n/**\n * ABI for EIP-1271 isValidSignature function.\n * Use with viem's readContract to verify signatures on Universal Profiles.\n */\nexport const EIP1271_ABI = [\n {\n name: 'isValidSignature',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'dataHash', type: 'bytes32' },\n { name: 'signature', type: 'bytes' },\n ],\n outputs: [{ name: '', type: 'bytes4' }],\n },\n] as const\n\n/**\n * Prepare data for EIP-1271 verification.\n * Returns the hash and signature needed to call isValidSignature().\n *\n * @param uri - The original signed QR URI (needed to extract the signature)\n * @param verificationResult - The result from verifySignedQR()\n *\n * @example\n * ```ts\n * const result = await verifySignedQR(uri)\n * const { hash, signature } = getEIP1271Data(uri, result)\n *\n * const magicValue = await client.readContract({\n * address: result.profileAddress,\n * abi: EIP1271_ABI,\n * functionName: 'isValidSignature',\n * args: [hash, signature],\n * })\n *\n * const isAuthorizedController = magicValue === EIP1271_MAGIC_VALUE\n * ```\n */\nexport function getEIP1271Data(\n uri: string,\n verificationResult: VerificationResult\n): {\n hash: Hex\n signature: Hex\n} {\n const parsed = parseSignedQR(uri)\n if (!parsed) {\n throw new Error('Invalid QR format')\n }\n\n return {\n hash: verificationResult.messageHash,\n signature: parsed.signature,\n }\n}\n","/**\n * Make slug from text\n *\n * @param value\n * @returns\n */\nexport const slug = (value?: string) => {\n if (!value) {\n return ''\n }\n\n return value.toLowerCase().replace(/\\s+/g, '-') // convert spaces to hyphens\n}\n","export class UrlConverter {\n private destination: URL\n /**\n * It will relatively append pathname or hostname to the destination URL\n *\n * For example:\n * destination=https://some.api.gateway/something/ipfs\n * url=ipfs://QmSomeHash\n * output=https://some.api.gateway/something/ipfs/QmSomeHash\n *\n * destination=https://some.api.gateway/something/ipfs\n * url=https://something.com/somewhere\n * output=https://some.api.gateway/something/ipfs/somewhere\n *\n * @param destination destination string | URL\n */\n constructor(destination: string | URL) {\n this.destination = new URL(destination)\n if (this.destination.pathname.at(-1) !== '/') {\n this.destination.pathname += '/'\n }\n }\n\n resolveUrl(url: string): string {\n // Parse and convert to javascript URL objects\n // this will manage / and relative paths for us.\n const source = new URL(url)\n // extract the relative path. For URLs with a pathname prepend \".\" to make it ./ (i.e. relative)\n // for anything that only has a hostname we prepend ./ to make it relative\n // the pathname is at least slash for https urls, but '' for ipfs for example\n const relativePath = source.pathname\n ? `./${source.hostname}${source.pathname}` // pathname always starts with at least a slash\n : `./${source.hostname}`\n // Construct relative URL on destination using the relative pathname.\n const out = new URL(relativePath, this.destination)\n out.pathname = out.pathname.replaceAll(/\\/\\/+/g, '/')\n return out.toString()\n }\n}\n\nexport class UrlResolver {\n private converters: Array<{\n match: string | RegExp\n converter: UrlConverter\n }> = []\n constructor(converters: Array<[string | RegExp, UrlConverter | string]>) {\n for (const item of converters) {\n const [match, _converter] = item\n if (match == null) {\n throw new TypeError('Match criteria not defined')\n }\n const converter =\n typeof _converter === 'string'\n ? new UrlConverter(_converter)\n : _converter\n if (!(converter instanceof UrlConverter)) {\n throw new TypeError('Invalid converter')\n }\n this.converters.push({ match, converter })\n }\n }\n\n /**\n * Resolves a URL to a gateway URL.\n * Supports possible multiple converters transforming the URL\n * in sequence until no converter matches.\n *\n * @param {string} url to resolve\n * @returns {string} resolved url (if resolver is found, otherwise the parameter url is returned)\n */\n resolveUrl(url_: string): string {\n let url = url_\n const current = new Set<{\n match: string | RegExp\n converter: UrlConverter\n }>(this.converters)\n let found = true\n while (found) {\n found = false\n for (const entry of current) {\n const { match, converter } = entry\n if (match instanceof RegExp ? match.test(url) : url.startsWith(match)) {\n url = converter.resolveUrl(url)\n // This converter matches, so don't use it again.\n current.delete(entry)\n found = true\n break\n }\n }\n }\n return url\n }\n}\n"],"mappings":";AAkBO,IAAM,wBAAwB;AAAA,EACnC,QACE;AAAA,EACF,OACE;AAAA,EACF,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AACX;AAKO,IAAM,cAAc,CAAC,kBAA8C;AACxE,QAAM,sBAAsB;AAAA,IAC1B,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAEA,QAAM,gBAAgB,MA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+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunk2KVLFGLMcjs = require('./chunk-2KVLFGLM.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
9
24
|
var _chunk4TARUYHAcjs = require('./chunk-4TARUYHA.cjs');
|
|
10
25
|
|
|
11
26
|
|
|
@@ -19,9 +34,6 @@ require('./chunk-DWXFDFMM.cjs');
|
|
|
19
34
|
var _chunkUQSIH233cjs = require('./chunk-UQSIH233.cjs');
|
|
20
35
|
|
|
21
36
|
|
|
22
|
-
var _chunkNJQVWIZLcjs = require('./chunk-NJQVWIZL.cjs');
|
|
23
|
-
|
|
24
|
-
|
|
25
37
|
var _chunkKPIUNN26cjs = require('./chunk-KPIUNN26.cjs');
|
|
26
38
|
|
|
27
39
|
|
|
@@ -35,15 +47,19 @@ var _chunkIDQ6WJY5cjs = require('./chunk-IDQ6WJY5.cjs');
|
|
|
35
47
|
var _chunkDF2DOQMFcjs = require('./chunk-DF2DOQMF.cjs');
|
|
36
48
|
|
|
37
49
|
|
|
50
|
+
var _chunkNJQVWIZLcjs = require('./chunk-NJQVWIZL.cjs');
|
|
51
|
+
require('./chunk-KP76AWY3.cjs');
|
|
52
|
+
|
|
53
|
+
// src/index.ts
|
|
54
|
+
_chunkGBY3X5CQcjs.init_config.call(void 0, );
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
38
58
|
|
|
39
59
|
|
|
40
60
|
|
|
41
61
|
|
|
42
|
-
var _chunkQU6NUTY6cjs = require('./chunk-QU6NUTY6.cjs');
|
|
43
|
-
require('./chunk-KP76AWY3.cjs');
|
|
44
62
|
|
|
45
|
-
// src/index.ts
|
|
46
|
-
_chunkGBY3X5CQcjs.init_config.call(void 0, );
|
|
47
63
|
|
|
48
64
|
|
|
49
65
|
|
|
@@ -68,5 +84,5 @@ _chunkGBY3X5CQcjs.init_config.call(void 0, );
|
|
|
68
84
|
|
|
69
85
|
|
|
70
86
|
|
|
71
|
-
exports.EXTENSION_STORE_LINKS =
|
|
87
|
+
exports.EIP1271_MAGIC_VALUE = _chunk2KVLFGLMcjs.EIP1271_MAGIC_VALUE; exports.EXTENSION_STORE_LINKS = _chunk2KVLFGLMcjs.EXTENSION_STORE_LINKS; exports.GRAPHQL_ENDPOINT_MAINNET = _chunkGBY3X5CQcjs.GRAPHQL_ENDPOINT_MAINNET; exports.GRAPHQL_ENDPOINT_TESTNET = _chunkGBY3X5CQcjs.GRAPHQL_ENDPOINT_TESTNET; exports.SUPPORTED_NETWORK_IDS = _chunkGBY3X5CQcjs.SUPPORTED_NETWORK_IDS; exports.UrlConverter = _chunk2KVLFGLMcjs.UrlConverter; exports.UrlResolver = _chunk2KVLFGLMcjs.UrlResolver; exports.browserInfo = _chunk2KVLFGLMcjs.browserInfo; exports.clearIntlService = _chunkIDQ6WJY5cjs.clearIntlService; exports.createIntlService = _chunkIDQ6WJY5cjs.createIntlService; exports.createMessage = _chunk2KVLFGLMcjs.createMessage; exports.createSignedQR = _chunk2KVLFGLMcjs.createSignedQR; exports.defaultConfig = _chunkIDQ6WJY5cjs.defaultConfig; exports.deviceService = _chunkNJQVWIZLcjs.deviceService; exports.getChainById = _chunk4TARUYHAcjs.getChainById; exports.getControllerAddress = _chunk2KVLFGLMcjs.getControllerAddress; exports.getEIP1271Data = _chunk2KVLFGLMcjs.getEIP1271Data; exports.getIntlService = _chunkIDQ6WJY5cjs.getIntlService; exports.getLuksoMainnet = _chunk4TARUYHAcjs.getLuksoMainnet; exports.getLuksoTestnet = _chunk4TARUYHAcjs.getLuksoTestnet; exports.isSignedQRFormat = _chunk2KVLFGLMcjs.isSignedQRFormat; exports.luksoChainsByID = _chunk4TARUYHAcjs.luksoChainsByID; exports.luksoMainnet = _chunk4TARUYHAcjs.luksoMainnet; exports.luksoTestnet = _chunk4TARUYHAcjs.luksoTestnet; exports.parseSignedQR = _chunk2KVLFGLMcjs.parseSignedQR; exports.setIntlService = _chunkIDQ6WJY5cjs.setIntlService; exports.slug = _chunk2KVLFGLMcjs.slug; exports.verifySignedQR = _chunk2KVLFGLMcjs.verifySignedQR; exports.withDeviceService = _chunkUQSIH233cjs.withDeviceService; exports.withIntlService = _chunkKPIUNN26cjs.withIntlService; exports.withTheme = _chunkDF2DOQMFcjs.withTheme;
|
|
72
88
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/index.cjs","../src/index.ts"],"names":[],"mappings":"AAAA,yGAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/index.cjs","../src/index.ts"],"names":[],"mappings":"AAAA,yGAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACA;AC5CA,2CAAA,CAAA;AD8CA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,w1DAAC","file":"/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/index.cjs","sourcesContent":[null,"/**\n * @lukso/core\n *\n * Core utilities, services, and mixins for LUKSO web components and applications\n */\n\n// Re-export all services and mixins\nexport * from './chains/index.js'\nexport * from './config.js'\nexport * from './mixins/index.js'\nexport * from './services/index.js'\nexport * from './utils/index.js'\n// Release update\n// build 2\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ export { IntlServiceMixin, IntlServiceMixinConstructor, withIntlService } from '
|
|
|
5
5
|
export { Theme, ThemeMixin, ThemeMixinConstructor, withTheme } from './mixins/theme.cjs';
|
|
6
6
|
export { DeviceService, NavigatorExtended, deviceService } from './services/device.cjs';
|
|
7
7
|
export { IntlMessages, IntlService, clearIntlService, createIntlService, defaultConfig, getIntlService, setIntlService } from './services/intl.cjs';
|
|
8
|
-
export { BrowserInfo, BrowserName, EXTENSION_STORE_LINKS, UrlConverter, UrlResolver, browserInfo, slug } from './utils/index.cjs';
|
|
8
|
+
export { BrowserInfo, BrowserName, EIP1271_MAGIC_VALUE, EXTENSION_STORE_LINKS, UrlConverter, UrlResolver, browserInfo, createMessage, createSignedQR, getControllerAddress, getEIP1271Data, isSignedQRFormat, parseSignedQR, slug, verifySignedQR } from './utils/index.cjs';
|
|
9
9
|
import 'viem';
|
|
10
10
|
import 'lit';
|
|
11
11
|
import 'ua-parser-js';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { IntlServiceMixin, IntlServiceMixinConstructor, withIntlService } from '
|
|
|
5
5
|
export { Theme, ThemeMixin, ThemeMixinConstructor, withTheme } from './mixins/theme.js';
|
|
6
6
|
export { DeviceService, NavigatorExtended, deviceService } from './services/device.js';
|
|
7
7
|
export { IntlMessages, IntlService, clearIntlService, createIntlService, defaultConfig, getIntlService, setIntlService } from './services/intl.js';
|
|
8
|
-
export { BrowserInfo, BrowserName, EXTENSION_STORE_LINKS, UrlConverter, UrlResolver, browserInfo, slug } from './utils/index.js';
|
|
8
|
+
export { BrowserInfo, BrowserName, EIP1271_MAGIC_VALUE, EXTENSION_STORE_LINKS, UrlConverter, UrlResolver, browserInfo, createMessage, createSignedQR, getControllerAddress, getEIP1271Data, isSignedQRFormat, parseSignedQR, slug, verifySignedQR } from './utils/index.js';
|
|
9
9
|
import 'viem';
|
|
10
10
|
import 'lit';
|
|
11
11
|
import 'ua-parser-js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import "./chunk-LEL6VWU4.js";
|
|
2
|
+
import {
|
|
3
|
+
EIP1271_MAGIC_VALUE,
|
|
4
|
+
EXTENSION_STORE_LINKS,
|
|
5
|
+
UrlConverter,
|
|
6
|
+
UrlResolver,
|
|
7
|
+
browserInfo,
|
|
8
|
+
createMessage,
|
|
9
|
+
createSignedQR,
|
|
10
|
+
getControllerAddress,
|
|
11
|
+
getEIP1271Data,
|
|
12
|
+
isSignedQRFormat,
|
|
13
|
+
parseSignedQR,
|
|
14
|
+
slug,
|
|
15
|
+
verifySignedQR
|
|
16
|
+
} from "./chunk-RECO5F6T.js";
|
|
2
17
|
import {
|
|
3
18
|
getChainById,
|
|
4
19
|
getLuksoMainnet,
|
|
@@ -17,9 +32,6 @@ import "./chunk-JEE6C34P.js";
|
|
|
17
32
|
import {
|
|
18
33
|
withDeviceService
|
|
19
34
|
} from "./chunk-UF5VAIDL.js";
|
|
20
|
-
import {
|
|
21
|
-
deviceService
|
|
22
|
-
} from "./chunk-X2QNFZU7.js";
|
|
23
35
|
import {
|
|
24
36
|
withIntlService
|
|
25
37
|
} from "./chunk-GD6H7BSG.js";
|
|
@@ -34,17 +46,14 @@ import {
|
|
|
34
46
|
withTheme
|
|
35
47
|
} from "./chunk-W5IG6ACP.js";
|
|
36
48
|
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
UrlResolver,
|
|
40
|
-
browserInfo,
|
|
41
|
-
slug
|
|
42
|
-
} from "./chunk-GFLV5EJV.js";
|
|
49
|
+
deviceService
|
|
50
|
+
} from "./chunk-X2QNFZU7.js";
|
|
43
51
|
import "./chunk-ET7EYHRY.js";
|
|
44
52
|
|
|
45
53
|
// src/index.ts
|
|
46
54
|
init_config();
|
|
47
55
|
export {
|
|
56
|
+
EIP1271_MAGIC_VALUE,
|
|
48
57
|
EXTENSION_STORE_LINKS,
|
|
49
58
|
GRAPHQL_ENDPOINT_MAINNET,
|
|
50
59
|
GRAPHQL_ENDPOINT_TESTNET,
|
|
@@ -54,17 +63,24 @@ export {
|
|
|
54
63
|
browserInfo,
|
|
55
64
|
clearIntlService,
|
|
56
65
|
createIntlService,
|
|
66
|
+
createMessage,
|
|
67
|
+
createSignedQR,
|
|
57
68
|
defaultConfig,
|
|
58
69
|
deviceService,
|
|
59
70
|
getChainById,
|
|
71
|
+
getControllerAddress,
|
|
72
|
+
getEIP1271Data,
|
|
60
73
|
getIntlService,
|
|
61
74
|
getLuksoMainnet,
|
|
62
75
|
getLuksoTestnet,
|
|
76
|
+
isSignedQRFormat,
|
|
63
77
|
luksoChainsByID,
|
|
64
78
|
luksoMainnet,
|
|
65
79
|
luksoTestnet,
|
|
80
|
+
parseSignedQR,
|
|
66
81
|
setIntlService,
|
|
67
82
|
slug,
|
|
83
|
+
verifySignedQR,
|
|
68
84
|
withDeviceService,
|
|
69
85
|
withIntlService,
|
|
70
86
|
withTheme
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @lukso/core\n *\n * Core utilities, services, and mixins for LUKSO web components and applications\n */\n\n// Re-export all services and mixins\nexport * from './chains/index.js'\nexport * from './config.js'\nexport * from './mixins/index.js'\nexport * from './services/index.js'\nexport * from './utils/index.js'\n// Release update\n// build 2\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @lukso/core\n *\n * Core utilities, services, and mixins for LUKSO web components and applications\n */\n\n// Re-export all services and mixins\nexport * from './chains/index.js'\nexport * from './config.js'\nexport * from './mixins/index.js'\nexport * from './services/index.js'\nexport * from './utils/index.js'\n// Release update\n// build 2\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;","names":[]}
|
package/dist/mixins/index.cjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
var _chunkUQSIH233cjs = require('../chunk-UQSIH233.cjs');
|
|
5
|
-
require('../chunk-NJQVWIZL.cjs');
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
var _chunkKPIUNN26cjs = require('../chunk-KPIUNN26.cjs');
|
|
@@ -10,6 +9,7 @@ require('../chunk-IDQ6WJY5.cjs');
|
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
var _chunkDF2DOQMFcjs = require('../chunk-DF2DOQMF.cjs');
|
|
12
|
+
require('../chunk-NJQVWIZL.cjs');
|
|
13
13
|
require('../chunk-KP76AWY3.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/mixins/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACF,yDAA8B;AAC9B
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/mixins/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACF,yDAA8B;AAC9B;AACE;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACF,8KAAC","file":"/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/mixins/index.cjs"}
|
package/dist/mixins/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import "../chunk-JEE6C34P.js";
|
|
|
2
2
|
import {
|
|
3
3
|
withDeviceService
|
|
4
4
|
} from "../chunk-UF5VAIDL.js";
|
|
5
|
-
import "../chunk-X2QNFZU7.js";
|
|
6
5
|
import {
|
|
7
6
|
withIntlService
|
|
8
7
|
} from "../chunk-GD6H7BSG.js";
|
|
@@ -10,6 +9,7 @@ import "../chunk-HTK4HH4J.js";
|
|
|
10
9
|
import {
|
|
11
10
|
withTheme
|
|
12
11
|
} from "../chunk-W5IG6ACP.js";
|
|
12
|
+
import "../chunk-X2QNFZU7.js";
|
|
13
13
|
import "../chunk-ET7EYHRY.js";
|
|
14
14
|
export {
|
|
15
15
|
withDeviceService,
|
package/dist/services/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-DFMMMF62.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var _chunkNJQVWIZLcjs = require('../chunk-NJQVWIZL.cjs');
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
|
|
8
|
+
var _chunkIDQ6WJY5cjs = require('../chunk-IDQ6WJY5.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkNJQVWIZLcjs = require('../chunk-NJQVWIZL.cjs');
|
|
12
12
|
require('../chunk-KP76AWY3.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/services/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/services/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,uWAAC","file":"/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/services/index.cjs"}
|
package/dist/services/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import "../chunk-LEL6VWU4.js";
|
|
2
|
-
import {
|
|
3
|
-
deviceService
|
|
4
|
-
} from "../chunk-X2QNFZU7.js";
|
|
5
2
|
import {
|
|
6
3
|
clearIntlService,
|
|
7
4
|
createIntlService,
|
|
@@ -9,6 +6,9 @@ import {
|
|
|
9
6
|
getIntlService,
|
|
10
7
|
setIntlService
|
|
11
8
|
} from "../chunk-HTK4HH4J.js";
|
|
9
|
+
import {
|
|
10
|
+
deviceService
|
|
11
|
+
} from "../chunk-X2QNFZU7.js";
|
|
12
12
|
import "../chunk-ET7EYHRY.js";
|
|
13
13
|
export {
|
|
14
14
|
clearIntlService,
|
package/dist/utils/index.cjs
CHANGED
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunk2KVLFGLMcjs = require('../chunk-2KVLFGLM.cjs');
|
|
8
16
|
require('../chunk-KP76AWY3.cjs');
|
|
9
17
|
|
|
10
18
|
|
|
@@ -12,5 +20,13 @@ require('../chunk-KP76AWY3.cjs');
|
|
|
12
20
|
|
|
13
21
|
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
exports.EIP1271_MAGIC_VALUE = _chunk2KVLFGLMcjs.EIP1271_MAGIC_VALUE; exports.EXTENSION_STORE_LINKS = _chunk2KVLFGLMcjs.EXTENSION_STORE_LINKS; exports.UrlConverter = _chunk2KVLFGLMcjs.UrlConverter; exports.UrlResolver = _chunk2KVLFGLMcjs.UrlResolver; exports.browserInfo = _chunk2KVLFGLMcjs.browserInfo; exports.createMessage = _chunk2KVLFGLMcjs.createMessage; exports.createSignedQR = _chunk2KVLFGLMcjs.createSignedQR; exports.getControllerAddress = _chunk2KVLFGLMcjs.getControllerAddress; exports.getEIP1271Data = _chunk2KVLFGLMcjs.getEIP1271Data; exports.isSignedQRFormat = _chunk2KVLFGLMcjs.isSignedQRFormat; exports.parseSignedQR = _chunk2KVLFGLMcjs.parseSignedQR; exports.slug = _chunk2KVLFGLMcjs.slug; exports.verifySignedQR = _chunk2KVLFGLMcjs.verifySignedQR;
|
|
16
32
|
//# sourceMappingURL=index.cjs.map
|
package/dist/utils/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/utils/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/utils/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,8vBAAC","file":"/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/utils/index.cjs"}
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DeviceService } from '../services/device.cjs';
|
|
2
|
+
import { Hex } from 'viem';
|
|
2
3
|
import 'ua-parser-js';
|
|
3
4
|
|
|
4
5
|
type BrowserName = 'chrome' | 'safari' | 'firefox' | 'edge' | 'opera' | 'brave';
|
|
@@ -21,6 +22,206 @@ declare const EXTENSION_STORE_LINKS: {
|
|
|
21
22
|
*/
|
|
22
23
|
declare const browserInfo: (deviceService: DeviceService) => BrowserInfo;
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @service-checkin/signed-qr-code
|
|
27
|
+
*
|
|
28
|
+
* Create and verify signed QR codes for Universal Profile check-ins.
|
|
29
|
+
* Pure TypeScript - compatible with React Native, Node.js, and browsers.
|
|
30
|
+
*
|
|
31
|
+
* URI Format: ethereum:<address>@<chainId>?ts=<unixTimestamp>&sig=<signature>
|
|
32
|
+
*
|
|
33
|
+
* The signed message is everything before &sig= (the URI without the signature).
|
|
34
|
+
* Uses EIP-191 prefixed signing (signMessage) for safety - this prevents
|
|
35
|
+
* signed messages from being confused with transaction hashes.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Custom signer function type.
|
|
40
|
+
* Takes the message string and returns an EIP-191 signature.
|
|
41
|
+
* The signer should use `signMessage` (which adds the EIP-191 prefix).
|
|
42
|
+
* Compatible with hardware wallets, secure enclaves, WalletConnect, etc.
|
|
43
|
+
*
|
|
44
|
+
* The EIP-191 prefix prevents signed messages from being confused with
|
|
45
|
+
* transaction hashes, making this safe for identity verification.
|
|
46
|
+
*/
|
|
47
|
+
type SignerFunction = (message: string) => Promise<Hex>;
|
|
48
|
+
interface CreateSignedQROptions {
|
|
49
|
+
/**
|
|
50
|
+
* Seconds to add to current time to account for QR generation/display latency.
|
|
51
|
+
* The QR timestamp will be set to (now + generationOffsetSeconds).
|
|
52
|
+
* Capped at 5 seconds maximum to prevent abuse.
|
|
53
|
+
* Default: 0
|
|
54
|
+
*/
|
|
55
|
+
generationOffsetSeconds?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Custom signer function for signing the message.
|
|
58
|
+
* If provided, the privateKey parameter can be omitted or set to null.
|
|
59
|
+
* Useful for hardware wallets, secure enclaves, or WalletConnect.
|
|
60
|
+
*
|
|
61
|
+
* The signer receives the message string and should use `signMessage`
|
|
62
|
+
* (EIP-191 prefixed signing) to return the signature.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* // Using a wallet that signs messages
|
|
67
|
+
* const uri = await createSignedQR(null, profileAddress, 42, {
|
|
68
|
+
* signer: async (message) => {
|
|
69
|
+
* return await wallet.signMessage(message)
|
|
70
|
+
* }
|
|
71
|
+
* })
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
signer?: SignerFunction;
|
|
75
|
+
}
|
|
76
|
+
interface VerifySignedQROptions {
|
|
77
|
+
/** Maximum age in seconds before QR is considered expired (default: 60) */
|
|
78
|
+
maxAgeSeconds?: number;
|
|
79
|
+
/** Skip timestamp validation (useful for testing) */
|
|
80
|
+
skipTimestampValidation?: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface VerificationResult {
|
|
83
|
+
/** Whether the QR code is valid and not expired */
|
|
84
|
+
isValid: boolean;
|
|
85
|
+
/** The Universal Profile address from the QR */
|
|
86
|
+
profileAddress: string;
|
|
87
|
+
/** The chain ID from the QR */
|
|
88
|
+
chainId: number;
|
|
89
|
+
/** The timestamp from the QR (unix seconds) */
|
|
90
|
+
timestamp: number;
|
|
91
|
+
/** The address recovered from the signature (the controller) */
|
|
92
|
+
recoveredAddress: string;
|
|
93
|
+
/** Whether the QR has expired based on maxAgeSeconds */
|
|
94
|
+
isExpired: boolean;
|
|
95
|
+
/** The original signed message (for EIP-1271 verification) */
|
|
96
|
+
message: string;
|
|
97
|
+
/** The hash of the message (for EIP-1271 verification) */
|
|
98
|
+
messageHash: Hex;
|
|
99
|
+
}
|
|
100
|
+
interface ParsedQRData {
|
|
101
|
+
profileAddress: string;
|
|
102
|
+
chainId: number;
|
|
103
|
+
timestamp: number;
|
|
104
|
+
signature: Hex;
|
|
105
|
+
message: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create the message that will be signed.
|
|
109
|
+
* This is the URI without the signature parameter.
|
|
110
|
+
*/
|
|
111
|
+
declare function createMessage(profileAddress: string, chainId: number, timestamp: number): string;
|
|
112
|
+
/**
|
|
113
|
+
* Create a signed QR URI string.
|
|
114
|
+
*
|
|
115
|
+
* @param privateKey - The controller's private key (hex string with 0x prefix).
|
|
116
|
+
* Can be '0x' or omitted if using options.signer.
|
|
117
|
+
* @param profileAddress - The Universal Profile address to sign for
|
|
118
|
+
* @param chainId - The chain ID (42 for LUKSO mainnet, 4201 for testnet)
|
|
119
|
+
* @param options - Optional configuration including custom signer
|
|
120
|
+
* @returns The complete signed URI string ready to encode as QR
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* // Using a private key directly
|
|
125
|
+
* const uri = await createSignedQR(
|
|
126
|
+
* '0x1234...', // controller private key
|
|
127
|
+
* '0xabcd...', // profile address
|
|
128
|
+
* 42, // LUKSO mainnet
|
|
129
|
+
* { generationOffsetSeconds: 2 }
|
|
130
|
+
* )
|
|
131
|
+
*
|
|
132
|
+
* // Using a custom signer (WalletConnect, hardware wallet, etc.)
|
|
133
|
+
* const uri = await createSignedQR(
|
|
134
|
+
* null, // not needed when signer is provided
|
|
135
|
+
* '0xabcd...', // profile address
|
|
136
|
+
* 42, // LUKSO mainnet
|
|
137
|
+
* {
|
|
138
|
+
* signer: async (message) => await wallet.signMessage(message)
|
|
139
|
+
* }
|
|
140
|
+
* )
|
|
141
|
+
* // Returns: ethereum:0xabcd...@42?ts=1706345678&sig=0x...
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
declare function createSignedQR(privateKey: Hex | null, profileAddress: string, chainId: number, options?: CreateSignedQROptions): Promise<string>;
|
|
145
|
+
/**
|
|
146
|
+
* Parse a signed QR URI without verification.
|
|
147
|
+
* Use this when you need to extract data before full verification.
|
|
148
|
+
*
|
|
149
|
+
* @param uri - The signed QR URI string
|
|
150
|
+
* @returns Parsed data or null if format is invalid
|
|
151
|
+
*/
|
|
152
|
+
declare function parseSignedQR(uri: string): ParsedQRData | null;
|
|
153
|
+
/**
|
|
154
|
+
* Verify a signed QR URI and recover the signer.
|
|
155
|
+
*
|
|
156
|
+
* This performs:
|
|
157
|
+
* 1. URI format validation
|
|
158
|
+
* 2. Signature recovery (gets the controller address that signed)
|
|
159
|
+
* 3. Timestamp validation (checks if expired)
|
|
160
|
+
*
|
|
161
|
+
* Note: This does NOT verify that the recovered address is an authorized
|
|
162
|
+
* controller of the profile. That check should be done separately using
|
|
163
|
+
* EIP-1271 isValidSignature() or by checking controller permissions on-chain.
|
|
164
|
+
*
|
|
165
|
+
* @param uri - The signed QR URI string
|
|
166
|
+
* @param options - Optional configuration
|
|
167
|
+
* @returns Verification result with recovered address
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const result = await verifySignedQR(uri)
|
|
172
|
+
*
|
|
173
|
+
* if (result.isValid) {
|
|
174
|
+
* console.log('Profile:', result.profileAddress)
|
|
175
|
+
* console.log('Signed by:', result.recoveredAddress)
|
|
176
|
+
*
|
|
177
|
+
* // Now verify the signer is an authorized controller
|
|
178
|
+
* // Option 1: Check if recoveredAddress === profileAddress (EOA case)
|
|
179
|
+
* // Option 2: Call isValidSignature() on the profile contract
|
|
180
|
+
* }
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
declare function verifySignedQR(uri: string, options?: VerifySignedQROptions): Promise<VerificationResult>;
|
|
184
|
+
/**
|
|
185
|
+
* Check if a string looks like a valid signed QR URI.
|
|
186
|
+
* This is a quick format check without full verification.
|
|
187
|
+
*/
|
|
188
|
+
declare function isSignedQRFormat(uri: string): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Get the controller address from a private key.
|
|
191
|
+
* Useful for displaying which address will sign the QR codes.
|
|
192
|
+
*/
|
|
193
|
+
declare function getControllerAddress(privateKey: Hex): string;
|
|
194
|
+
/**
|
|
195
|
+
* EIP-1271 magic value returned for valid signatures
|
|
196
|
+
*/
|
|
197
|
+
declare const EIP1271_MAGIC_VALUE: "0x1626ba7e";
|
|
198
|
+
/**
|
|
199
|
+
* Prepare data for EIP-1271 verification.
|
|
200
|
+
* Returns the hash and signature needed to call isValidSignature().
|
|
201
|
+
*
|
|
202
|
+
* @param uri - The original signed QR URI (needed to extract the signature)
|
|
203
|
+
* @param verificationResult - The result from verifySignedQR()
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```ts
|
|
207
|
+
* const result = await verifySignedQR(uri)
|
|
208
|
+
* const { hash, signature } = getEIP1271Data(uri, result)
|
|
209
|
+
*
|
|
210
|
+
* const magicValue = await client.readContract({
|
|
211
|
+
* address: result.profileAddress,
|
|
212
|
+
* abi: EIP1271_ABI,
|
|
213
|
+
* functionName: 'isValidSignature',
|
|
214
|
+
* args: [hash, signature],
|
|
215
|
+
* })
|
|
216
|
+
*
|
|
217
|
+
* const isAuthorizedController = magicValue === EIP1271_MAGIC_VALUE
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
declare function getEIP1271Data(uri: string, verificationResult: VerificationResult): {
|
|
221
|
+
hash: Hex;
|
|
222
|
+
signature: Hex;
|
|
223
|
+
};
|
|
224
|
+
|
|
24
225
|
/**
|
|
25
226
|
* Make slug from text
|
|
26
227
|
*
|
|
@@ -62,4 +263,4 @@ declare class UrlResolver {
|
|
|
62
263
|
resolveUrl(url_: string): string;
|
|
63
264
|
}
|
|
64
265
|
|
|
65
|
-
export { type BrowserInfo, type BrowserName, EXTENSION_STORE_LINKS, UrlConverter, UrlResolver, browserInfo, slug };
|
|
266
|
+
export { type BrowserInfo, type BrowserName, EIP1271_MAGIC_VALUE, EXTENSION_STORE_LINKS, UrlConverter, UrlResolver, browserInfo, createMessage, createSignedQR, getControllerAddress, getEIP1271Data, isSignedQRFormat, parseSignedQR, slug, verifySignedQR };
|