{"version":3,"sources":["../../src/nep413/index.ts","../../src/nep413/sign.ts","../../src/crypto/public_key.ts","../../src/utils/format.ts","../../src/crypto/constants.ts","../../src/nep413/schema.ts","../../src/nep413/verify.ts"],"sourcesContent":["export type { SignMessageArgs } from './sign.js';\nexport { signMessage } from './sign.js';\nexport type { VerifyMessageArgs } from './verify.js';\nexport { verifyMessage } from './verify.js';\n","import type { Account } from '../accounts/account.js';\nimport type { SignedMessage } from '../signers/signer.js';\nimport type { MessagePayload } from './schema.js';\n\nexport interface SignMessageArgs {\n    signerAccount: Account;\n    payload: MessagePayload;\n}\n\nexport function signMessage({ signerAccount, payload }: SignMessageArgs): Promise<SignedMessage> {\n    const signer = signerAccount.getSigner();\n\n    if (!signer) throw new Error('Please set a signer');\n\n    return signer.signNep413Message(signerAccount.accountId, payload);\n}\n","import { ed25519 } from '@noble/curves/ed25519.js';\nimport { secp256k1 } from '@noble/curves/secp256k1.js';\nimport { ml_dsa65 } from '@noble/post-quantum/ml-dsa.js';\nimport { baseDecode, baseEncode } from '../utils/index.js';\n\nimport { KeySize, KeyType } from './constants.js';\n\nfunction key_type_to_str(keyType: KeyType): string {\n    switch (keyType) {\n        case KeyType.ED25519:\n            return 'ed25519';\n        case KeyType.SECP256K1:\n            return 'secp256k1';\n        case KeyType.MLDSA65:\n            return 'ml-dsa-65';\n        default:\n            throw new Error(`Unknown key type ${keyType}`);\n    }\n}\n\nfunction str_to_key_type(keyType: string): KeyType {\n    switch (keyType.toLowerCase()) {\n        case 'ed25519':\n            return KeyType.ED25519;\n        case 'secp256k1':\n            return KeyType.SECP256K1;\n        case 'ml-dsa-65':\n            return KeyType.MLDSA65;\n        default:\n            throw new Error(`Unknown key type ${keyType}`);\n    }\n}\n\nclass ED25519PublicKey {\n    keyType: KeyType = KeyType.ED25519;\n    data!: Uint8Array;\n}\nclass SECP256K1PublicKey {\n    keyType: KeyType = KeyType.SECP256K1;\n    data!: Uint8Array;\n}\nclass MLDSA65PublicKey {\n    keyType: KeyType = KeyType.MLDSA65;\n    data!: Uint8Array;\n}\n\nfunction resolveEnumKeyName(keyType: KeyType) {\n    switch (keyType) {\n        case KeyType.ED25519: {\n            return 'ed25519Key';\n        }\n        case KeyType.SECP256K1: {\n            return 'secp256k1Key';\n        }\n        case KeyType.MLDSA65: {\n            return 'mlDsa65Key';\n        }\n        default: {\n            throw Error(`unknown type ${keyType}`);\n        }\n    }\n}\n\n/**\n * DUPLICATED FROM @near-js/types - REPLACE WITH IMPORTED REFERENCE AND DELETE\n * This ends up being necessary for Wallet Selector dependencies with\n * outdated peer dependencies and should only be temporary\n */\nabstract class Enum {\n    abstract enum: string;\n\n    constructor(properties: any) {\n        if (Object.keys(properties).length !== 1) {\n            throw new Error('Enum can only take single value');\n        }\n        Object.keys(properties).forEach((key: string) => {\n            (this as any)[key] = properties[key];\n        });\n    }\n}\n\n/**\n * PublicKey representation that has type and bytes of the key.\n */\n\nexport class PublicKey extends Enum {\n    enum: string;\n    ed25519Key?: ED25519PublicKey;\n    secp256k1Key?: SECP256K1PublicKey;\n    mlDsa65Key?: MLDSA65PublicKey;\n\n    constructor(publicKey: { keyType: KeyType; data: Uint8Array }) {\n        const keyName = resolveEnumKeyName(publicKey.keyType);\n        super({ [keyName]: publicKey });\n        this[keyName] = publicKey;\n        this.enum = keyName;\n    }\n\n    /**\n     * Creates a PublicKey instance from a string or an existing PublicKey instance.\n     * @param value The string or PublicKey instance to create a PublicKey from.\n     * @returns {PublicKey} The PublicKey instance.\n     */\n    static from(value: string | PublicKey): PublicKey;\n    static from(value: string | PublicKey | Record<string, unknown>): PublicKey {\n        if (typeof value === 'string') {\n            return PublicKey.fromString(value);\n        }\n\n        if (value instanceof PublicKey) {\n            return value;\n        }\n\n        if (typeof value === 'object' && value !== null) {\n            const maybeEd25519 = value['ed25519Key'];\n            if (typeof maybeEd25519 === 'object' && maybeEd25519 !== null && 'data' in maybeEd25519) {\n                return new PublicKey({\n                    keyType: KeyType.ED25519,\n                    data: Uint8Array.from((maybeEd25519 as { data: Uint8Array | number[] }).data),\n                });\n            }\n\n            const maybeSecp256k1 = value['secp256k1Key'];\n            if (typeof maybeSecp256k1 === 'object' && maybeSecp256k1 !== null && 'data' in maybeSecp256k1) {\n                return new PublicKey({\n                    keyType: KeyType.SECP256K1,\n                    data: Uint8Array.from((maybeSecp256k1 as { data: Uint8Array | number[] }).data),\n                });\n            }\n\n            const maybeMlDsa65 = value['mlDsa65Key'];\n            if (typeof maybeMlDsa65 === 'object' && maybeMlDsa65 !== null && 'data' in maybeMlDsa65) {\n                return new PublicKey({\n                    keyType: KeyType.MLDSA65,\n                    data: Uint8Array.from((maybeMlDsa65 as { data: Uint8Array | number[] }).data),\n                });\n            }\n        }\n\n        throw new Error('Unsupported public key format');\n    }\n\n    /**\n     * Creates a PublicKey instance from an encoded key string.\n     * @param encodedKey The encoded key string.\n     * @returns {PublicKey} The PublicKey instance created from the encoded key string.\n     */\n    static fromString(encodedKey: string): PublicKey {\n        const parts = encodedKey.split(':');\n        let publicKey: string;\n        let keyType;\n        if (parts.length === 1) {\n            publicKey = parts[0]!;\n        } else if (parts.length === 2) {\n            publicKey = parts[1]!;\n            keyType = str_to_key_type(parts[0]!);\n        } else {\n            throw new Error('Invalid encoded key format, must be <curve>:<encoded key>');\n        }\n        const decodedPublicKey = baseDecode(publicKey);\n        if (!keyType) {\n            keyType = decodedPublicKey.length === KeySize.SECP256k1_PUBLIC_KEY ? KeyType.SECP256K1 : KeyType.ED25519;\n        }\n        const keySize =\n            keyType === KeyType.ED25519\n                ? KeySize.ED25519_PUBLIC_KEY\n                : keyType === KeyType.SECP256K1\n                  ? KeySize.SECP256k1_PUBLIC_KEY\n                  : KeySize.MLDSA65_PUBLIC_KEY;\n        if (decodedPublicKey.length !== keySize) {\n            throw new Error(`Invalid public key size (${decodedPublicKey.length}), must be ${keySize}`);\n        }\n        return new PublicKey({ keyType, data: decodedPublicKey });\n    }\n\n    /**\n     * Returns a string representation of the public key.\n     * @returns {string} The string representation of the public key.\n     */\n    override toString(): string {\n        const encodedKey = baseEncode(this.data);\n        return `${key_type_to_str(this.keyType)}:${encodedKey}`;\n    }\n\n    /**\n     * Verifies a message signature using the public key.\n     * @param message The message to be verified.\n     * @param signature The signature to be verified.\n     * @returns {boolean} `true` if the signature is valid, otherwise `false`.\n     */\n    verify(message: Uint8Array, signature: Uint8Array): boolean {\n        const keyType = this.keyType;\n        const data = this.data;\n        switch (keyType) {\n            case KeyType.ED25519:\n                return ed25519.verify(signature, message, data);\n            case KeyType.SECP256K1:\n                return secp256k1.verify(signature.subarray(0, 64), message, new Uint8Array([0x04, ...data]), {\n                    prehash: false,\n                });\n            case KeyType.MLDSA65:\n                return ml_dsa65.verify(signature, message, data);\n            default:\n                throw new Error(`Unknown key type: ${keyType}`);\n        }\n    }\n\n    get keyPair() {\n        return this.ed25519Key || this.secp256k1Key || this.mlDsa65Key;\n    }\n\n    get keyType(): KeyType {\n        if (typeof this.keyPair === 'undefined') throw new Error(`Property 'keyPair' of PublicKey is undefined`);\n\n        return this.keyPair.keyType;\n    }\n\n    get data(): Uint8Array {\n        if (typeof this.keyPair === 'undefined') throw new Error(`Property 'keyPair' of PublicKey is undefined`);\n\n        return this.keyPair.data;\n    }\n}\n\nexport function keyToImplicitAddress(publicKey: string | PublicKey): string {\n    const pk = PublicKey.from(publicKey);\n\n    const publicKeyWithoutPrefix = pk.toString().replace(/^ed25519:/, '');\n\n    const decoded = baseDecode(publicKeyWithoutPrefix);\n    // Converting to hex string is implemented manually\n    // to avoid issues with environments that do not support Buffer\n    let result = '';\n    for (let i = 0; i < decoded.length; i++) {\n        const hex = decoded[i]!.toString(16);\n        result += hex.length === 1 ? `0${hex}` : hex;\n    }\n    return result;\n}\n","import { base58, base64 } from '@scure/base';\n\ntype NumericString = `${number}`;\n\n/**\n * Exponent for calculating how many indivisible units are there in one NEAR. See {@link NEAR_NOMINATION}.\n */\nexport const NEAR_NOMINATION_EXP = 24;\n\n/**\n * Number of indivisible units in one NEAR. Derived from {@link NEAR_NOMINATION_EXP}.\n */\nexport const NEAR_NOMINATION = 10n ** BigInt(NEAR_NOMINATION_EXP);\n\n// Pre-calculate offsets used for rounding to different number of digits\nconst ROUNDING_OFFSETS: bigint[] = [];\nconst BN10 = 10n;\nfor (let i = 0, offset = 5n; i < NEAR_NOMINATION_EXP; i++, offset = offset * BN10) {\n    ROUNDING_OFFSETS[i] = offset;\n}\n\n/**\n * @deprecated use {@link units!yoctoToNear} from 'near-api-js' instead.\n *\n * Convert account balance value from internal indivisible units to NEAR. 1 NEAR is defined by {@link NEAR_NOMINATION}.\n * Effectively this divides given amount by {@link NEAR_NOMINATION}.\n *\n * @param balance decimal string representing balance in smallest non-divisible NEAR units (as specified by {@link NEAR_NOMINATION})\n * @param fracDigits number of fractional digits to preserve in formatted string. Balance is rounded to match given number of digits.\n * @returns Value in Ⓝ\n */\nexport function formatNearAmount(balance: string | number | bigint, fracDigits: number = NEAR_NOMINATION_EXP): string {\n    let balanceBN = BigInt(balance);\n    if (fracDigits !== NEAR_NOMINATION_EXP) {\n        // Adjust balance for rounding at given number of digits\n        const roundingExp = NEAR_NOMINATION_EXP - fracDigits - 1;\n        if (roundingExp > 0) {\n            balanceBN += ROUNDING_OFFSETS[roundingExp]!;\n        }\n    }\n\n    balance = balanceBN.toString();\n    const wholeStr = balance.substring(0, balance.length - NEAR_NOMINATION_EXP) || '0';\n    const fractionStr = balance\n        .substring(balance.length - NEAR_NOMINATION_EXP)\n        .padStart(NEAR_NOMINATION_EXP, '0')\n        .substring(0, fracDigits);\n\n    return trimTrailingZeroes(`${formatWithCommas(wholeStr)}.${fractionStr}`);\n}\n\n/**\n * @deprecated use {@link units!nearToYocto} from 'near-api-js' instead.\n *\n * Convert human readable NEAR amount to internal indivisible units.\n * Effectively this multiplies given amount by {@link NEAR_NOMINATION}.\n *\n * @param amount decimal string (potentially fractional) denominated in NEAR.\n * @returns The parsed yoctoⓃ amount\n * @throws {Error} if the amount is empty or invalid\n */\nexport function parseNearAmount(amount: NumericString | number): string {\n    const cleanedAmount = cleanupAmount(amount.toString());\n    if (!cleanedAmount) {\n        throw new Error('Amount cannot be empty');\n    }\n    const split = cleanedAmount.split('.');\n    const wholePart = split[0];\n    const fracPart = split[1] || '';\n    if (split.length > 2 || fracPart.length > NEAR_NOMINATION_EXP) {\n        throw new Error(`Cannot parse '${amount}' as NEAR amount`);\n    }\n    return trimLeadingZeroes(wholePart + fracPart.padEnd(NEAR_NOMINATION_EXP, '0'));\n}\n\n/**\n * Removes commas from the input\n * @param amount A value or amount that may contain commas\n * @returns string The cleaned value\n */\nfunction cleanupAmount(amount: string): string {\n    return amount.replace(/,/g, '').trim();\n}\n\n/**\n * Removes .000… from an input\n * @param value A value that may contain trailing zeroes in the decimals place\n * @returns string The value without the trailing zeros\n */\nfunction trimTrailingZeroes(value: string): string {\n    return value.replace(/\\.?0*$/, '');\n}\n\n/**\n * Removes leading zeroes from an input\n * @param value A value that may contain leading zeroes\n * @returns string The value without the leading zeroes\n */\nfunction trimLeadingZeroes(value: string): string {\n    value = value.replace(/^0+/, '');\n    if (value === '') {\n        return '0';\n    }\n    return value;\n}\n\n/**\n * Returns a human-readable value with commas\n * @param value A value that may not contain commas\n * @returns string A value with commas\n */\nfunction formatWithCommas(value: string): string {\n    const pattern = /(-?\\d+)(\\d{3})/;\n    while (pattern.test(value)) {\n        value = value.replace(pattern, '$1,$2');\n    }\n    return value;\n}\n\n/**\n * Encodes a Uint8Array or string into base58\n * @param value Uint8Array or string representing a borsh encoded object\n * @returns string base58 encoding of the value\n */\nexport function baseEncode(value: Uint8Array | string): string {\n    if (typeof value === 'string') {\n        const bytes: number[] = [];\n        for (let c = 0; c < value.length; c++) {\n            bytes.push(value.charCodeAt(c));\n        }\n        value = new Uint8Array(bytes);\n    }\n    return base58.encode(value);\n}\n\n/**\n * Decodes a base58 string into a Uint8Array\n * @param value base58 encoded string\n * @returns Uint8Array representing the decoded value\n */\nexport function baseDecode(value: string): Uint8Array {\n    return base58.decode(value);\n}\n\n/**\n * Encodes a Uint8Array into a base64 string\n * @param bytes Uint8Array to encode\n * @returns base64 encoded string\n */\nexport function base64Encode(bytes: Uint8Array): string {\n    return base64.encode(bytes);\n}\n\n/**\n * Decodes a base64 string into a Uint8Array\n * @param str base64 encoded string\n * @returns Uint8Array representing the decoded value\n */\nexport function base64Decode(str: string): Uint8Array {\n    return base64.decode(str);\n}\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\n\n/**\n * Encodes a string into a Uint8Array using UTF-8\n * @param str string to encode\n * @returns Uint8Array representing the UTF-8 bytes\n */\nexport function stringToBytes(str: string): Uint8Array {\n    return encoder.encode(str);\n}\n\n/**\n * Decodes a Uint8Array into a string using UTF-8\n * @param bytes Uint8Array to decode\n * @returns decoded string\n */\nexport function bytesToString(bytes: Uint8Array): string {\n    return decoder.decode(bytes);\n}\n","/** All supported key types */\nexport enum KeyType {\n    ED25519 = 0,\n    SECP256K1 = 1,\n    MLDSA65 = 2,\n}\n\nexport const KeySize = {\n    SECRET_KEY: 32,\n    ED25519_PUBLIC_KEY: 32,\n    SECP256k1_PUBLIC_KEY: 64,\n    MLDSA65_PUBLIC_KEY: 1952,\n    MLDSA65_SIGNATURE: 3309,\n};\n\nexport type CurveType = 'ed25519' | 'ED25519' | 'secp256k1' | 'SECP256K1' | 'ml-dsa-65' | 'ML-DSA-65';\n\nexport type KeyPairString = `ed25519:${string}` | `secp256k1:${string}` | `ml-dsa-65:${string}`;\n","import { sha256 } from '@noble/hashes/sha2.js';\nimport { type Schema, serialize } from 'borsh';\n\nexport interface MessagePayload {\n    message: string; // The message that wants to be transmitted.\n    recipient: string; // The recipient to whom the message is destined (e.g. \"alice.near\" or \"myapp.com\").\n    nonce: Uint8Array; // A nonce that uniquely identifies this instance of the message, denoted as a 32 bytes array (a fixed `Buffer` in JS/TS).\n    callbackUrl?: string; // Optional, applicable to browser wallets (e.g. MyNearWallet). The URL to call after the signing process. Defaults to `window.location.href`.\n}\n\nexport const Nep413MessageSchema: Schema = {\n    struct: {\n        message: 'string',\n        nonce: { array: { type: 'u8', len: 32 } },\n        recipient: 'string',\n        callbackUrl: { option: 'string' },\n    },\n};\n\nexport function serializeMessage(payload: MessagePayload): Uint8Array {\n    // 2**31 + 413 == 2147484061\n    const PREFIX = 2147484061;\n    const serializedPrefix = serialize('u32', PREFIX);\n    const serializedParams = serialize(Nep413MessageSchema, payload);\n\n    const serializedPayload = new Uint8Array(serializedPrefix.length + serializedParams.length);\n    serializedPayload.set(serializedPrefix);\n    serializedPayload.set(serializedParams, serializedPrefix.length);\n\n    return new Uint8Array(sha256(serializedPayload));\n}\n","import { PublicKey } from '../crypto/public_key.js';\nimport type { Provider } from '../providers/provider.js';\nimport { type MessagePayload, serializeMessage } from './schema.js';\n\nexport interface VerifyMessageArgs {\n    signerAccountId: string;\n    signerPublicKey: string | PublicKey;\n    payload: MessagePayload;\n    signature: Uint8Array;\n    provider: Provider;\n}\n\nexport async function verifyMessage({\n    signerAccountId,\n    signerPublicKey,\n    payload,\n    signature,\n    provider,\n}: VerifyMessageArgs): Promise<void> {\n    const accessKey = await provider.viewAccessKey({\n        accountId: signerAccountId,\n        publicKey: signerPublicKey,\n    });\n\n    if (accessKey.permission !== 'FullAccess') {\n        throw new Error(\n            `Public key ${signerPublicKey.toString()} does not have FullAccess permission on account ${signerAccountId}`\n        );\n    }\n\n    const pk = PublicKey.from(signerPublicKey);\n    const message = serializeMessage(payload);\n\n    const isVerified = pk.verify(message, signature);\n\n    if (!isVerified) {\n        throw new Error('Signature verification failed');\n    }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,SAAS,YAAY,EAAE,eAAe,QAAQ,GAA4C;AAC7F,QAAM,SAAS,cAAc,UAAU;AAEvC,MAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,qBAAqB;AAElD,SAAO,OAAO,kBAAkB,cAAc,WAAW,OAAO;AACpE;;;ACfA,qBAAwB;AACxB,uBAA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