{"record":{"id":"adf467c1d4cc763f","repo":"denoland/deno","slug":"context-parameter-is-unsupported","errorCode":null,"errorMessage":"Context parameter is unsupported","messagePattern":"Context parameter is unsupported","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/internal/crypto/sig.ts","lineNumber":425,"sourceCode":"    let result: Buffer;\n    const keyType = op_node_get_asymmetric_key_type(handle);\n    if (keyType === \"ed25519\") {\n      if (algorithm != null && algorithm !== \"sha512\") {\n        throw new TypeError(\"Only 'sha512' is supported for Ed25519 keys\");\n      }\n      result = new FastBuffer(64);\n      op_node_sign_ed25519(handle, dataBytes, result);\n    } else if (keyType === \"ed448\") {\n      const keyOpts = typeof key === \"object\" && key !== null &&\n          !(ObjectPrototypeIsPrototypeOf(KeyObject.prototype, key))\n        ? key as Record<string, unknown>\n        : null;\n      const ctx = keyOpts?.context;\n      if (\n        ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, ctx) &&\n        ctx.length > 0\n      ) {\n        throw new TypeError(\"Context parameter is unsupported\");\n      }\n      result = new FastBuffer(114);\n      op_node_sign_ed448(handle, dataBytes, result);\n    } else {\n      let digest = algorithm;\n      if (digest == null) {\n        if (keyType === \"rsa-pss\") {\n          const details = op_node_get_asymmetric_key_details(handle);\n          if (details.hashAlgorithm) {\n            digest = details.hashAlgorithm;\n          }\n        }\n        if (digest == null) {\n          throw new TypeError(\n            \"Algorithm must be specified when using non-Ed25519 keys\",\n          );\n        }\n      }","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/node/polyfills/internal/crypto/sig.ts#L407-L443","documentation":"For ed448 keys, one-shot crypto.sign() reads an optional context property from the key options object. RFC 8032 defines an 8.4.4 context string for Ed448, but Deno's Rust signing op implements Ed448 without context support, so a non-empty Uint8Array context throws this TypeError. An absent, non-Uint8Array, or empty context is ignored.","triggerScenarios":"crypto.sign(null, data, { key: ed448Pem, context: Buffer.from(\"my-app\") }) — any Uint8Array context with length > 0 on an ed448 key.","commonSituations":"Porting OpenSSL or other-runtime Ed448ctx/Ed448ph signing code to Deno; interop with protocols that bind signatures to an application context string; otherwise rare because ed448 adoption is low.","solutions":["Omit the context option or pass an empty Uint8Array.","If context binding is required, switch schemes — e.g. HMAC/domain-separate the message first, or use RSA-PSS — since Deno's op cannot produce context-bound Ed448 signatures.","Detect the condition early and reject the request rather than producing an incompatible signature."],"exampleFix":"// before\ncrypto.sign(null, data, { key: ed448Pem, context: Buffer.from(\"ctx\") }); // throws\n\n// after\ncrypto.sign(null, data, { key: ed448Pem }); // no context","handlingStrategy":"validation","validationCode":"if (keyOpts?.context instanceof Uint8Array && keyOpts.context.length > 0) {\n  throw new Error(\"Ed448 signing with a non-empty context is not supported in this runtime\");\n}\nconst sig = crypto.sign(null, data, { key: ed448Pem });","typeGuard":"const hasNonEmptyContext = (opts) =>\n  opts?.context instanceof Uint8Array && opts.context.length > 0;","tryCatchPattern":"try {\n  sig = crypto.sign(null, data, keyOpts);\n} catch (e) {\n  if (e instanceof TypeError && /Context parameter is unsupported/.test(e.message)) {\n    throw new Error(\"re-sign without Ed448 context or use a context-capable runtime\");\n  }\n  throw e;\n}","preventionTips":["Treat Ed448 context as unsupported in Deno — design domain separation with message prefixes instead.","Feature-detect before shipping: sign a test message with context in a startup self-check.","Keep ed448 options objects minimal: { key } only."],"tags":["crypto","ed448","signing","unsupported-feature"],"backgroundTag":"ed448-context-unsupported","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}