{
  "classes": [
    {
      "constants": [],
      "types": [],
      "name": "@eryx/crypto/hazmat/ecc",
      "tags": [],
      "functions": [
        {
          "source": {
            "path": "",
            "line": 41
          },
          "is_method": false,
          "signature": "ecc.generateKey(\n    curve: string?  -- Curve name. Defaults to `\"secp256r1\"`.\n) → (\n    string  -- PEM-encoded ECC private key. \n)",
          "owner": "ecc",
          "desc": "Generates a new ECC private key on a named curve and returns it as PEM.\n\nSupported curve names: `\"secp224r1\"`, `\"secp256r1\"` (default),\n`\"prime256v1\"`, `\"secp384r1\"`, `\"secp521r1\"`, and `\"secp256k1\"`.\n",
          "tags": [],
          "name": "generateKey",
          "return_str": "string",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "string",
              "desc": "PEM-encoded ECC private key. "
            }
          ],
          "params": [
            {
              "lua_type": "string?",
              "name": "curve",
              "desc": "Curve name. Defaults to `\"secp256r1\"`."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 51
          },
          "is_method": false,
          "signature": "ecc.getPublicPem(\n    private_pem: string  -- PEM-encoded ECC private key.\n) → (\n    string  -- PEM-encoded ECC public key. \n)",
          "owner": "ecc",
          "desc": "Derives the public key from a PEM-encoded ECC private key.\n",
          "tags": [],
          "name": "getPublicPem",
          "return_str": "string",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "string",
              "desc": "PEM-encoded ECC public key. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "private_pem",
              "desc": "PEM-encoded ECC private key."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 66
          },
          "is_method": false,
          "signature": "ecc.sign(\n    private_pem: string,  -- PEM-encoded ECC private key.\n    data: buffer,  -- Message to sign.\n    hash: string?  -- Hash algorithm.\n) → (\n    buffer  -- ASN.1 DER-encoded ECDSA signature. \n)",
          "owner": "ecc",
          "desc": "Signs `data` using ECDSA on the private key's curve.\n\nSupported hash values: `\"sha256\"` (default), `\"sha1\"`, `\"sha384\"`,\nand `\"sha512\"`.\n",
          "tags": [],
          "name": "sign",
          "return_str": "buffer",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "buffer",
              "desc": "ASN.1 DER-encoded ECDSA signature. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "private_pem",
              "desc": "PEM-encoded ECC private key."
            },
            {
              "lua_type": "buffer",
              "name": "data",
              "desc": "Message to sign."
            },
            {
              "lua_type": "string?",
              "name": "hash",
              "desc": "Hash algorithm."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 79
          },
          "is_method": false,
          "signature": "ecc.verify(\n    public_pem: string,  -- PEM-encoded ECC public key.\n    data: buffer,  -- Original message.\n    signature: buffer,  -- ASN.1 DER-encoded signature.\n    hash: string?  -- Hash algorithm.\n) → (\n    boolean  -- `true` if the signature is valid. \n)",
          "owner": "ecc",
          "desc": "Verifies an ECDSA signature.\n",
          "tags": [],
          "name": "verify",
          "return_str": "boolean",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "boolean",
              "desc": "`true` if the signature is valid. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "public_pem",
              "desc": "PEM-encoded ECC public key."
            },
            {
              "lua_type": "buffer",
              "name": "data",
              "desc": "Original message."
            },
            {
              "lua_type": "buffer",
              "name": "signature",
              "desc": "ASN.1 DER-encoded signature."
            },
            {
              "lua_type": "string?",
              "name": "hash",
              "desc": "Hash algorithm."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 92
          },
          "is_method": false,
          "signature": "ecc.derive(\n    private_pem: string,  -- Your PEM-encoded ECC private key.\n    peer_public_pem: string  -- Peer's PEM-encoded ECC public key.\n) → (\n    buffer  -- Raw shared secret bytes. \n)",
          "owner": "ecc",
          "desc": "Derives a shared secret using ECDH.\n\nBoth keys must be on the same curve.\n",
          "tags": [],
          "name": "derive",
          "return_str": "buffer",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "buffer",
              "desc": "Raw shared secret bytes. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "private_pem",
              "desc": "Your PEM-encoded ECC private key."
            },
            {
              "lua_type": "string",
              "name": "peer_public_pem",
              "desc": "Peer's PEM-encoded ECC public key."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 102
          },
          "is_method": false,
          "signature": "ecc.privateToDer(\n    private_pem: string  -- PEM-encoded ECC private key.\n) → (\n    buffer  -- Raw DER-encoded private key. \n)",
          "owner": "ecc",
          "desc": "Encodes a PEM private key as raw DER bytes.\n",
          "tags": [],
          "name": "privateToDer",
          "return_str": "buffer",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "buffer",
              "desc": "Raw DER-encoded private key. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "private_pem",
              "desc": "PEM-encoded ECC private key."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 112
          },
          "is_method": false,
          "signature": "ecc.publicToDer(\n    public_pem: string  -- PEM-encoded ECC public key.\n) → (\n    buffer  -- Raw DER-encoded public key. \n)",
          "owner": "ecc",
          "desc": "Encodes a PEM public key as raw DER bytes.\n",
          "tags": [],
          "name": "publicToDer",
          "return_str": "buffer",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "buffer",
              "desc": "Raw DER-encoded public key. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "public_pem",
              "desc": "PEM-encoded ECC public key."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 122
          },
          "is_method": false,
          "signature": "ecc.privateFromDer(\n    der: buffer  -- Raw DER-encoded ECC private key.\n) → (\n    string  -- PEM-encoded ECC private key. \n)",
          "owner": "ecc",
          "desc": "Parses a DER-encoded ECC private key and returns it as PEM.\n",
          "tags": [],
          "name": "privateFromDer",
          "return_str": "string",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "string",
              "desc": "PEM-encoded ECC private key. "
            }
          ],
          "params": [
            {
              "lua_type": "buffer",
              "name": "der",
              "desc": "Raw DER-encoded ECC private key."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 132
          },
          "is_method": false,
          "signature": "ecc.publicFromDer(\n    der: buffer  -- Raw DER-encoded ECC public key.\n) → (\n    string  -- PEM-encoded ECC public key. \n)",
          "owner": "ecc",
          "desc": "Parses a DER-encoded ECC public key and returns it as PEM.\n",
          "tags": [],
          "name": "publicFromDer",
          "return_str": "string",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "string",
              "desc": "PEM-encoded ECC public key. "
            }
          ],
          "params": [
            {
              "lua_type": "buffer",
              "name": "der",
              "desc": "Raw DER-encoded ECC public key."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 142
          },
          "is_method": false,
          "signature": "ecc.getKeyBits(\n    pem: string  -- PEM-encoded ECC private or public key.\n) → (\n    number  -- Curve size in bits. \n)",
          "owner": "ecc",
          "desc": "Returns the key size in bits for a PEM-encoded ECC key.\n",
          "tags": [],
          "name": "getKeyBits",
          "return_str": "number",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "number",
              "desc": "Curve size in bits. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "pem",
              "desc": "PEM-encoded ECC private or public key."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 156
          },
          "is_method": false,
          "signature": "ecc.getCurve(\n    pem: string  -- PEM-encoded ECC private or public key.\n) → (\n    string  -- Canonical curve name. \n)",
          "owner": "ecc",
          "desc": "Returns the canonical curve name for a PEM-encoded ECC key.\n\nKnown return values currently include `\"secp224r1\"`, `\"secp256r1\"`,\n`\"secp384r1\"`, `\"secp521r1\"`, `\"secp256k1\"`, and `\"unknown\"` if the\ncurve is not one of the canonical names recognised by this wrapper.\n",
          "tags": [],
          "name": "getCurve",
          "return_str": "string",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "string",
              "desc": "Canonical curve name. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "pem",
              "desc": "PEM-encoded ECC private or public key."
            }
          ]
        }
      ],
      "properties": [],
      "source": {
        "path": "",
        "line": 0
      },
      "desc": "Elliptic-curve cryptography using interoperable named curves.\n\nProvides named-curve key generation, PEM/DER conversion, ECDSA\nsigning/verification, and ECDH shared-secret derivation.\n\nThe initial curve set focuses on standard interoperable curves:\n`secp224r1`, `secp256r1`, `secp384r1`, `secp521r1`, and `secp256k1`.\n\n```luau\nlocal ecc = require(\"@eryx/crypto/hazmat/ecc\")\n\nlocal alicePriv = ecc.generateKey(\"secp256r1\")\nlocal alicePub = ecc.getPublicPem(alicePriv)\n\nlocal bobPriv = ecc.generateKey(\"secp256r1\")\nlocal bobPub = ecc.getPublicPem(bobPriv)\n\nlocal sig = ecc.sign(alicePriv, buffer.fromstring(\"hello\"))\nassert(ecc.verify(alicePub, buffer.fromstring(\"hello\"), sig))\n\nlocal aliceSecret = ecc.derive(alicePriv, bobPub)\nlocal bobSecret = ecc.derive(bobPriv, alicePub)\nassert(buffer.tostring(aliceSecret) == buffer.tostring(bobSecret))\n```\n"
    }
  ]
}