{
  "id": "task_libraries:encryption/javascript",
  "path": "/exapedia/javascript-encryption-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "JavaScript encryption libraries",
  "answer": [
    {
      "t": "text",
      "text": "JavaScript encryption libraries encrypt and decrypt data with keys in browsers and Node.js. Authenticated encryption adds a tag that makes decryption fail when the ciphertext has changed. These libraries protect the tokens, messages, and stored records that apps exchange or keep on behalf of users."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "JavaScript encryption libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#jose",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F129"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F130"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F138"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F133"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#noble-ciphers",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F146"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F153"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F150"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#forge",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F161"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F162"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F168"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F163"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#tweetnacl-js",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F176"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F178"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#crypto-js",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F192"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F201"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F196"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#eciesjs",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F210"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F219"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F214"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F212"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#crypto-browserify",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F228"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F229"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F237"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F232"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F230"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#libsodium-js",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F246"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F247"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F253"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F250"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F248"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "npm"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#jose",
          "label": [
            {
              "t": "fact",
              "fact": "F129"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F130"
        },
        {
          "t": "text",
          "text": "."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Public-key encryption",
            "Authenticated extra data"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#jose",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F129"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F139"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F140"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#noble-ciphers",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F146"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F154"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F155"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#forge",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F161"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F169"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F170"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#tweetnacl-js",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F176"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F184"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F185"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#crypto-js",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F192"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F202"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F203"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#eciesjs",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F210"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F220"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#crypto-browserify",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F228"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F238"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F239"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#libsodium-js",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F246"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F254"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F255"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "jose",
          "name": [
            {
              "t": "fact",
              "fact": "F129"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/panva/jose"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/jose"
            },
            {
              "label": "Docs",
              "href": "https://github.com/panva/jose/blob/main/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F258"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F130"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F138"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F132"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/panva/jose/blob/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F129"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F259"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F260"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F261"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F262"
                }
              ]
            }
          ],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F144"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F145"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/better-auth/better-auth",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F144"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "javascript",
              "code": "export async function symmetricEncodeJWT<T extends Record<string, any>>(\n\tpayload: T,\n\tsecret: string | SecretConfig,\n\tsalt: string,\n\texpiresIn: number = 3600,\n): Promise<string> {\n\tconst currentSecret = getCurrentSecret(secret);\n\tconst encryptionSecret = deriveEncryptionSecret(currentSecret, salt);\n\n\tconst thumbprint = await calculateJwkThumbprint(\n\t\t{ kty: \"oct\", k: base64url.encode(encryptionSecret) },\n\t\t\"sha256\",\n\t);\n\n\treturn await new EncryptJWT(payload)\n\t\t.setProtectedHeader({ alg, enc, kid: thumbprint })\n\t\t.setIssuedAt()\n\t\t.setExpirationTime(now() + expiresIn)\n\t\t.setJti(crypto.randomUUID())\n\t\t.encrypt(encryptionSecret);\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/better-auth/better-auth/blob/8382ce613f04bf590d3cb6c1363dfd0e41110944/packages/better-auth/src/crypto/jwt.ts",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F143"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=jose%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F129"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "javascript",
              "code": "import { EncryptJWT, generateSecret } from 'jose';\n\nconst secret = await generateSecret('A256GCM');\nconst token = await new EncryptJWT({ sub: 'example' })\n  .setProtectedHeader({ alg: 'dir', enc: 'A256GCM' })\n  .encrypt(secret);\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/panva/jose/blob/main/docs/jwt/encrypt/classes/EncryptJWT.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "EncryptJWT.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F134"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "noble-ciphers",
          "name": [
            {
              "t": "fact",
              "fact": "F146"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/paulmillr/noble-ciphers"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/@noble/ciphers"
            },
            {
              "label": "Docs",
              "href": "https://github.com/paulmillr/noble-ciphers/blob/main/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F11"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F153"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/paulmillr/noble-ciphers/blob/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F146"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F12"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F19"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F159"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F160"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/openclaw/openclaw",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F159"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "typescript",
              "code": "export function seal(options: SealOptions): Envelope {\n  const ts = options.ts ?? Math.floor(Date.now() / 1000);\n  validateEnvelopeMetadata(options.id, options.from, options.to, ts);\n  validateMessageBody(options.body);\n  const plaintext = canonicalBytes(options.body);\n  if (plaintext.length > REEF_MAX_PLAINTEXT_BYTES) {\n    throw new TooLargeError();\n  }\n  const ephemeral = x25519.keygen((options.rng ?? randomBytes)(32));\n  const shared = x25519.getSharedSecret(\n    ephemeral.secretKey,\n    decodeKey(options.recipientEncryptionPublicKey),\n  );\n  const key = hkdf(sha256, shared, undefined, HKDF_INFO, 32);\n  const nonce = (options.rng ?? randomBytes)(12);\n  if (nonce.length !== 12) {\n    throw new MalformedError(\"rng returned invalid nonce\");\n  }\n  const unsigned: UnsignedEnvelope = {\n    v: 1,\n    id: options.id,\n    from: options.from,\n    to: options.to,\n    ts,\n    epk: base64(ephemeral.publicKey),\n    n: base64(nonce),\n    ct: base64(gcm(key, nonce).encrypt(plaintext)),\n  };\n  return {\n    ...unsigned,\n    sig: base64(ed25519.sign(canonicalBytes(unsigned), decodeKey(options.senderSigningSecretKey))),\n  };\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/openclaw/openclaw/blob/d29fad4e3e687dedf683e38ec35b12cb85510637/extensions/reef/protocol/envelope.ts",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F158"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20%40noble/ciphers%20for%20authenticated%20encryption%20and%20decryption&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F146"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "typescript",
              "code": "import { gcm } from '@noble/ciphers/aes.js';\nimport { randomBytes } from '@noble/ciphers/utils.js';\n\nconst key = randomBytes(32);\nconst nonce = randomBytes(12);\nconst ciphertext = gcm(key, nonce).encrypt(new TextEncoder().encode('hello'));\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/paulmillr/noble-ciphers/blob/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F151"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "forge",
          "name": [
            {
              "t": "fact",
              "fact": "F161"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/digitalbazaar/forge"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/node-forge"
            },
            {
              "label": "Docs",
              "href": "https://github.com/digitalbazaar/forge/blob/main/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F37"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F162"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F168"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F164"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F163"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/digitalbazaar/forge/blob/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F161"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F38"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F39"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F40"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F41"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F43"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F174"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F175"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/Kong/insomnia",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F174"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "typescript",
              "code": "export function encryptAES(jwkOrKey: string | JsonWebKey, plaintext: string, additionalData = ''): AESMessage {\n  // TODO: Add assertion checks for JWK\n  const rawKey = typeof jwkOrKey === 'string' ? jwkOrKey : _b64UrlToHex(jwkOrKey.k || '');\n  const key = forge.util.hexToBytes(rawKey);\n  const iv = forge.random.getBytesSync(12);\n  const cipher = forge.cipher.createCipher('AES-GCM', key);\n  // Plaintext could contain weird unicode, so we have to encode that\n  const encodedPlaintext = encodeURIComponent(plaintext);\n  cipher.start({\n    additionalData,\n    iv,\n    tagLength: 128,\n  });\n  cipher.update(forge.util.createBuffer(encodedPlaintext));\n  cipher.finish();\n  return {\n    iv: forge.util.bytesToHex(iv),\n    // @ts-expect-error -- TSCONVERSION needs to be converted to string\n    t: forge.util.bytesToHex(cipher.mode.tag),\n    ad: forge.util.bytesToHex(additionalData),\n    // @ts-expect-error -- TSCONVERSION needs to be converted to string\n    d: forge.util.bytesToHex(cipher.output),\n  };\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/Kong/insomnia/blob/51e449474b832760d6cdd1e47d53b572d2b24ddf/packages/insomnia-vcs/src/crypt.ts",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F173"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20node-forge%20for%20authenticated%20encryption%20and%20decryption&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F161"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "typescript",
              "code": "import forge from 'node-forge';\n\nconst key = forge.random.getBytesSync(32);\nconst iv = forge.random.getBytesSync(12);\nconst cipher = forge.cipher.createCipher('AES-GCM', key);\ncipher.start({ iv });\ncipher.update(forge.util.createBuffer('hello', 'utf8'));\ncipher.finish();\nconst ciphertext = cipher.output.getBytes();\nconst tag = cipher.mode.tag.getBytes();\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/digitalbazaar/forge/blob/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F166"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "tweetnacl-js",
          "name": [
            {
              "t": "fact",
              "fact": "F176"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/dchest/tweetnacl-js"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/tweetnacl"
            },
            {
              "label": "Docs",
              "href": "https://github.com/dchest/tweetnacl-js/blob/master/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F60"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F178"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/dchest/tweetnacl-js/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F176"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F61"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F62"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F63"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F64"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F65"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F66"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F67"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F68"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F190"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F191"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/slopus/happy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F190"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "typescript",
              "code": "export function libsodiumEncryptForPublicKey(data: Uint8Array, recipientPublicKey: Uint8Array): Uint8Array {\n  // Generate ephemeral keypair for this encryption\n  const ephemeralKeyPair = tweetnacl.box.keyPair();\n  \n  // Generate random nonce (24 bytes for box encryption)\n  const nonce = getRandomBytes(tweetnacl.box.nonceLength);\n  \n  // Encrypt the data using box (authenticated encryption)\n  const encrypted = tweetnacl.box(data, nonce, recipientPublicKey, ephemeralKeyPair.secretKey);\n  \n  // Bundle format: ephemeral public key (32 bytes) + nonce (24 bytes) + encrypted data\n  const result = new Uint8Array(ephemeralKeyPair.publicKey.length + nonce.length + encrypted.length);\n  result.set(ephemeralKeyPair.publicKey, 0);\n  result.set(nonce, ephemeralKeyPair.publicKey.length);\n  result.set(encrypted, ephemeralKeyPair.publicKey.length + nonce.length);\n  \n  return result;\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/slopus/happy/blob/2992695686ec6386492d7814c52f8e787e54a12d/packages/happy-cli/src/api/encryption.ts",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F189"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20tweetnacl%20for%20authenticated%20encryption%20and%20decryption&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F176"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "typescript",
              "code": "import nacl from 'tweetnacl';\n\nconst key = nacl.randomBytes(nacl.secretbox.keyLength);\nconst nonce = nacl.randomBytes(nacl.secretbox.nonceLength);\nconst message = new TextEncoder().encode('hello');\nconst ciphertext = nacl.secretbox(message, nonce, key);\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/dchest/tweetnacl-js/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F181"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "crypto-js",
          "name": [
            {
              "t": "fact",
              "fact": "F192"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/brix/crypto-js"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/crypto-js"
            },
            {
              "label": "Docs",
              "href": "https://github.com/brix/crypto-js/blob/develop/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F263"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F201"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F195"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/brix/crypto-js/blob/develop/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F192"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F264"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F265"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F208"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F209"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/balzack/databag",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F208"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "javascript",
              "code": "export function encryptBlock(block, contentKey) {\n  const key = CryptoJS.enc.Hex.parse(contentKey);\n  const iv = CryptoJS.lib.WordArray.random(128 / 8);\n  const encrypted = CryptoJS.AES.encrypt(block, key, { iv: iv });\n  const blockEncrypted = encrypted.ciphertext.toString(CryptoJS.enc.Base64)\n  const blockIv = iv.toString();\n\n  return { blockEncrypted, blockIv };\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/balzack/databag/blob/45343338582b394f4f5fdb4b7e271ea1dc8dd5fd/net/web/src/context/sealUtil.js",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F207"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=crypto-js%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F192"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "javascript",
              "code": "var CryptoJS = require('crypto-js');\n\nvar ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123').toString();\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/brix/crypto-js/blob/develop/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F197"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "eciesjs",
          "name": [
            {
              "t": "fact",
              "fact": "F210"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/ecies/js"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/eciesjs"
            },
            {
              "label": "Docs",
              "href": "https://github.com/ecies/js/blob/master/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F266"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F219"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F213"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F212"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/ecies/js/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F210"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F267"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F268"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F269"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F270"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F271"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F272"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F226"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F227"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/supabase/cli",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F226"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "javascript",
              "code": "function decryptWithKey(keyHex: string, encryptedValue: string): DecryptedSecret {\n  if (keyHex.length === 0) return { ok: false, error: \"missing private key\" };\n  let privateKeyHex: string;\n  try {\n    privateKeyHex = PrivateKey.fromHex(keyHex).toHex();\n  } catch {\n    // Fixed message, not the underlying error: some runtimes' fallback hex\n    // decoder echoes a fragment of the bad input (offending char + index)\n    // into the error, which would otherwise reach the user's stderr.\n    return { ok: false, error: \"failed to hex decode private key: cannot decode hex string\" };\n  }\n  const encoded = encryptedValue.slice(ENCRYPTED_PREFIX.length);\n  // Node's `Buffer.from(s, \"base64\")` silently drops invalid characters, so\n  // reject malformed input explicitly.\n  if (!STD_BASE64_PATTERN.test(encoded) || encoded.length % 4 !== 0) {\n    return { ok: false, error: \"failed to base64 decode secret: invalid base64 data\" };\n  }\n  try {\n    // eciesjs returns a Uint8Array; wrap in Buffer before decoding the plaintext.\n    const plaintext = Buffer.from(decrypt(privateKeyHex, Buffer.from(encoded, \"base64\")));\n    return { ok: true, value: plaintext.toString(\"utf8\") };\n  } catch (cause) {\n    return { ok: false, error: `failed to decrypt secret: ${errorMessage(cause)}` };\n  }\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/supabase/cli/blob/015bf52b35b2bf478b526f21e5b0d648ec156e0a/apps/cli/src/command-internal/vault-decrypt.ts",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F225"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=eciesjs%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F210"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "javascript",
              "code": "import { PrivateKey, decrypt, encrypt } from \"eciesjs\";\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\n\nconst sk = new PrivateKey();\nconst data = encoder.encode(\"hello world🌍\");\nconst decrypted = decrypt(sk.secret, encrypt(sk.publicKey.toBytes(), data));\nconsole.log(decoder.decode(decrypted));\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/ecies/js/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F215"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "crypto-browserify",
          "name": [
            {
              "t": "fact",
              "fact": "F228"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/browserify/crypto-browserify"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/crypto-browserify"
            },
            {
              "label": "Docs",
              "href": "https://github.com/browserify/crypto-browserify/blob/master/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F273"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F229"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F237"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F231"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F230"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/browserify/crypto-browserify/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F228"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F274"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F275"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F244"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F245"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/bnb-chain/javascript-sdk",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F244"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "javascript",
              "code": "export const generateKeyStore = (\n  privateKeyHex: string,\n  password: string\n): KeyStore => {\n  const salt = cryp.randomBytes(32)\n  const iv = cryp.randomBytes(16)\n  const cipherAlg = \"aes-256-ctr\"\n\n  const kdf = \"pbkdf2\"\n  const kdfparams = {\n    dklen: 32,\n    salt: salt.toString(\"hex\"),\n    c: 262144,\n    prf: \"hmac-sha256\",\n  }\n\n  const derivedKey = cryp.pbkdf2Sync(\n    Buffer.from(password),\n    salt,\n    kdfparams.c,\n    kdfparams.dklen,\n    \"sha256\"\n  )\n  const cipher = cryp.createCipheriv(cipherAlg, derivedKey.slice(0, 32), iv)\n  if (!cipher) {\n    throw new Error(\"Unsupported cipher\")\n  }\n\n  const ciphertext = Buffer.concat([\n    cipher.update(Buffer.from(privateKeyHex, \"hex\")),\n    cipher.final(),\n  ])\n  const bufferValue = Buffer.concat([derivedKey.slice(16, 32), ciphertext])\n\n  return {\n    version: 1,\n    id: uuid.v4({\n      random: cryp.randomBytes(16),\n    }),\n    crypto: {\n      ciphertext: ciphertext.toString(\"hex\"),\n      cipherparams: {\n        iv: iv.toString(\"hex\"),\n      },\n      cipher: cipherAlg,\n      kdf,\n      kdfparams,\n      // mac must use sha3 according to web3 secret storage spec\n      mac: sha3(bufferValue.toString(\"hex\")),\n    },\n  }\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/bnb-chain/javascript-sdk/blob/66bc48b568c20879c5c6352915b87e8e803a5363/src/crypto/index.ts",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F243"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=crypto-browserify%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F228"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "javascript",
              "code": "const crypto = require('crypto-browserify');\nconst { Buffer } = require('buffer');\n\nconst key = crypto.randomBytes(32);\nconst iv = crypto.randomBytes(12);\nconst cipher = crypto.createCipheriv('aes-256-gcm', key, iv);\nconst ciphertext = Buffer.concat([cipher.update('hello', 'utf8'), cipher.final()]);\nconst tag = cipher.getAuthTag();\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/browserify/crypto-browserify/blob/master/index.js",
                  "label": [
                    {
                      "t": "text",
                      "text": "index.js"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F233"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "libsodium-js",
          "name": [
            {
              "t": "fact",
              "fact": "F246"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/jedisct1/libsodium.js"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/libsodium-wrappers"
            },
            {
              "label": "Docs",
              "href": "https://github.com/jedisct1/libsodium.js/blob/master/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F86"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F247"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F253"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F249"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F248"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/jedisct1/libsodium.js/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F246"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F87"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F88"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F89"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F90"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F91"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F92"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F93"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F94"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "typescript",
              "code": "import sodium from 'libsodium-wrappers';\n\nawait sodium.ready;\nconst key = sodium.randombytes_buf(sodium.crypto_secretbox_KEYBYTES);\nconst nonce = sodium.randombytes_buf(sodium.crypto_secretbox_NONCEBYTES);\nconst ciphertext = sodium.crypto_secretbox_easy('hello', nonce, key);\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/jedisct1/libsodium.js/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20libsodium-wrappers%20for%20authenticated%20encryption%20and%20decryption&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F246"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F251"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "What is CryptoJS?",
      "a": [
        {
          "t": "link",
          "href": "#crypto-js",
          "label": [
            {
              "t": "text",
              "text": "CryptoJS"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a JavaScript library of crypto standards such as AES and HMAC. Its maintainers have discontinued development and point to the native crypto module in Node.js and current browsers."
        }
      ]
    },
    {
      "q": "What is node-forge?",
      "a": [
        {
          "t": "link",
          "href": "#forge",
          "label": [
            {
              "t": "text",
              "text": "Forge"
            }
          ]
        },
        {
          "t": "text",
          "text": " implements network transports, ciphers, public key infrastructure, and message digests in JavaScript. It includes block ciphers such as AES and password-based key derivation."
        }
      ]
    },
    {
      "q": "What is jose?",
      "a": [
        {
          "t": "link",
          "href": "#jose",
          "label": [
            {
              "t": "text",
              "text": "jose"
            }
          ]
        },
        {
          "t": "text",
          "text": " implements JSON Object Signing and Encryption for JavaScript, including JWT, JWE, and JWK. It runs in Node.js, browsers, Cloudflare Workers, Deno, and Bun with no dependencies."
        }
      ]
    },
    {
      "q": "What is crypto-browserify?",
      "a": [
        {
          "t": "link",
          "href": "#crypto-browserify",
          "label": [
            {
              "t": "text",
              "text": "crypto-browserify"
            }
          ]
        },
        {
          "t": "text",
          "text": " reimplements the Node.js crypto module in plain JavaScript so that it can run in the browser."
        }
      ]
    },
    {
      "q": "What is TweetNaCl.js?",
      "a": [
        {
          "t": "link",
          "href": "#tweetnacl-js",
          "label": [
            {
              "t": "text",
              "text": "TweetNaCl.js"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a JavaScript port of the NaCl cryptographic library for browsers and Node.js. Its box function encrypts a message for a recipient's public key."
        }
      ]
    },
    {
      "q": "Why must libsodium.js initialization be awaited?",
      "a": [
        {
          "t": "fact",
          "fact": "F121"
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, @noble/ciphers",
      "display": "noble-ciphers",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, @noble/ciphers",
      "display": "215.4M",
      "asOf": "2026-11-15"
    },
    "F3": {
      "label": "License, @noble/ciphers",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, @noble/ciphers",
      "display": "2.4.0",
      "asOf": "2026-11-17"
    },
    "F5": {
      "label": "Undated package release, @noble/ciphers",
      "display": "v2.4.0",
      "asOf": "2026-11-17"
    },
    "F6": {
      "label": "Repository stars, @noble/ciphers",
      "display": "437",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Authenticated encryption, @noble/ciphers",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Random bytes, @noble/ciphers",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Password keys, @noble/ciphers",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "Install, @noble/ciphers",
      "display": "npm install @noble/ciphers",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "What it does, @noble/ciphers",
      "display": "Provides symmetric ciphers with authenticated-encryption variants for JavaScript.",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "strengths lead, @noble/ciphers",
      "display": "Manages nonce prefixes",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths, @noble/ciphers",
      "display": "Use managedNonce to prepend a generated nonce to ciphertext.",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths lead, @noble/ciphers",
      "display": "Detects changes during authenticated decryption",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths, @noble/ciphers",
      "display": "Choose an AEAD variant whose decrypt method checks its authentication tag.",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "limitations lead, @noble/ciphers",
      "display": "Passwords need separate key derivation",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations, @noble/ciphers",
      "display": "Derive a password key with an additional KDF package before encrypting.",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations lead, @noble/ciphers",
      "display": "New messages need fresh nonces",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "limitations, @noble/ciphers",
      "display": "Do not reuse a nonce with the same key.",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "Quickstart, @noble/ciphers",
      "display": "// import * from '@noble/ciphers'; // Error: use sub-imports, to ensure small app size\nimport { xchacha20poly1305 } from '@noble/ciphers/chacha.js';\nimport { randomBytes } from '@noble/ciphers/utils.js';\nconst key = randomBytes(32);\nconst nonce = randomBytes(24);\nconst data = new TextEncoder().encode('hello noble');\nconst ciphertext = xchacha20poly1305(key, nonce).encrypt(data);\n",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Project function, @noble/ciphers",
      "display": "export function seal(options: SealOptions): Envelope {\n  const ts = options.ts ?? Math.floor(Date.now() / 1000);\n  validateEnvelopeMetadata(options.id, options.from, options.to, ts);\n  validateMessageBody(options.body);\n  const plaintext = canonicalBytes(options.body);\n  if (plaintext.length > REEF_MAX_PLAINTEXT_BYTES) {\n    throw new TooLargeError();\n  }\n  const ephemeral = x25519.keygen((options.rng ?? randomBytes)(32));\n  const shared = x25519.getSharedSecret(\n    ephemeral.secretKey,\n    decodeKey(options.recipientEncryptionPublicKey),\n  );\n  const key = hkdf(sha256, shared, undefined, HKDF_INFO, 32);\n  const nonce = (options.rng ?? randomBytes)(12);\n  if (nonce.length !== 12) {\n    throw new MalformedError(\"rng returned invalid nonce\");\n  }\n  const unsigned: UnsignedEnvelope = {\n    v: 1,\n    id: options.id,\n    from: options.from,\n    to: options.to,\n    ts,\n    epk: base64(ephemeral.publicKey),\n    n: base64(nonce),\n    ct: base64(gcm(key, nonce).encrypt(plaintext)),\n  };\n  return {\n    ...unsigned,\n    sig: base64(ed25519.sign(canonicalBytes(unsigned), decodeKey(options.senderSigningSecretKey))),\n  };\n}\n",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project function reference, @noble/ciphers",
      "display": "envelope.ts · seal()",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project repository, @noble/ciphers",
      "display": "openclaw/openclaw",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project stars, openclaw/openclaw",
      "display": "394.6K",
      "asOf": "2026-11-17"
    },
    "F25": {
      "label": "Project push date, openclaw/openclaw",
      "display": "Nov 2026",
      "asOf": "2026-11-17"
    },
    "F26": {
      "label": "Library name, node-forge",
      "display": "Forge",
      "asOf": "2026-11-17"
    },
    "F27": {
      "label": "Monthly downloads, node-forge",
      "display": "206.0M",
      "asOf": "2026-11-15"
    },
    "F28": {
      "label": "License, node-forge",
      "display": "(BSD-3-Clause OR GPL-2.0)",
      "asOf": "2026-11-17"
    },
    "F29": {
      "label": "Package release, node-forge",
      "display": "1.4.3",
      "asOf": "2026-11-17"
    },
    "F30": {
      "label": "Undated package release, node-forge",
      "display": "v1.4.3",
      "asOf": "2026-11-17"
    },
    "F31": {
      "label": "Repository stars, node-forge",
      "display": "5.4K",
      "asOf": "2026-11-17"
    },
    "F32": {
      "label": "Authenticated encryption, node-forge",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "Random bytes, node-forge",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Password keys, node-forge",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Public-key encryption, node-forge",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "Install, node-forge",
      "display": "npm install node-forge",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "What it does, node-forge",
      "display": "Provides block-cipher encryption and decryption APIs.",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "strengths lead, node-forge",
      "display": "Checks authenticated decryption results",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "strengths, node-forge",
      "display": "Check decipher.finish before using decrypted GCM output.",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths lead, node-forge",
      "display": "Includes password-based key derivation",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "strengths, node-forge",
      "display": "Use pkcs5.pbkdf2 to derive a key from a password.",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "limitations lead, node-forge",
      "display": "Synchronous key generation blocks execution",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "limitations, node-forge",
      "display": "Choose asynchronous RSA key generation for interactive applications.",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "Quickstart, node-forge",
      "display": "var forge = require('node-forge');\n\n// get some random bytes synchronously\nvar bytes = forge.random.getBytesSync(32);\nconsole.log(forge.util.bytesToHex(bytes));\n\n// get some random bytes asynchronously\nforge.random.getBytes(32, function(err, bytes) {\n  console.log(forge.util.bytesToHex(bytes));\n});\n\n",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "Project function, node-forge",
      "display": "export function encryptAES(jwkOrKey: string | JsonWebKey, plaintext: string, additionalData = ''): AESMessage {\n  // TODO: Add assertion checks for JWK\n  const rawKey = typeof jwkOrKey === 'string' ? jwkOrKey : _b64UrlToHex(jwkOrKey.k || '');\n  const key = forge.util.hexToBytes(rawKey);\n  const iv = forge.random.getBytesSync(12);\n  const cipher = forge.cipher.createCipher('AES-GCM', key);\n  // Plaintext could contain weird unicode, so we have to encode that\n  const encodedPlaintext = encodeURIComponent(plaintext);\n  cipher.start({\n    additionalData,\n    iv,\n    tagLength: 128,\n  });\n  cipher.update(forge.util.createBuffer(encodedPlaintext));\n  cipher.finish();\n  return {\n    iv: forge.util.bytesToHex(iv),\n    // @ts-expect-error -- TSCONVERSION needs to be converted to string\n    t: forge.util.bytesToHex(cipher.mode.tag),\n    ad: forge.util.bytesToHex(additionalData),\n    // @ts-expect-error -- TSCONVERSION needs to be converted to string\n    d: forge.util.bytesToHex(cipher.output),\n  };\n}\n",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "Project function reference, node-forge",
      "display": "crypt.ts · encryptAES()",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "Project repository, node-forge",
      "display": "Kong/insomnia",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "Project stars, Kong/insomnia",
      "display": "40.2K",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Project push date, Kong/insomnia",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F50": {
      "label": "Library name, tweetnacl",
      "display": "TweetNaCl.js",
      "asOf": "2026-11-17"
    },
    "F51": {
      "label": "Monthly downloads, tweetnacl",
      "display": "190.1M",
      "asOf": "2026-11-15"
    },
    "F52": {
      "label": "License, tweetnacl",
      "display": "Unlicense",
      "asOf": "2026-11-17"
    },
    "F53": {
      "label": "Package release, tweetnacl",
      "display": "1.0.3",
      "asOf": "2026-11-17"
    },
    "F54": {
      "label": "Undated package release, tweetnacl",
      "display": "v1.0.3",
      "asOf": "2026-11-17"
    },
    "F55": {
      "label": "Repository stars, tweetnacl",
      "display": "1.9K",
      "asOf": "2026-11-17"
    },
    "F56": {
      "label": "Authenticated encryption, tweetnacl",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F57": {
      "label": "Random bytes, tweetnacl",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F58": {
      "label": "Public-key encryption, tweetnacl",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "Install, tweetnacl",
      "display": "npm install tweetnacl tweetnacl-util",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "What it does, tweetnacl",
      "display": "Provides a JavaScript implementation of NaCl for browsers and Node.js.",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "strengths lead, tweetnacl",
      "display": "Combines peer keys with encryption",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "strengths, tweetnacl",
      "display": "Use box with the recipient’s public key and sender’s secret key.",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "strengths lead, tweetnacl",
      "display": "Returns null on authentication failure",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "strengths, tweetnacl",
      "display": "Check the open result before decoding the plaintext.",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "limitations lead, tweetnacl",
      "display": "Text needs explicit byte encoding",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "limitations, tweetnacl",
      "display": "Encode strings and serialize objects before encryption.",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "limitations lead, tweetnacl",
      "display": "Shared Buffer views need copying",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "limitations, tweetnacl",
      "display": "Use Buffer.from(array) to avoid sharing a returned subarray’s backing buffer.",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "Quickstart, tweetnacl",
      "display": "import { secretbox, randomBytes } from \"tweetnacl\";\nimport {\n  decodeUTF8,\n  encodeUTF8,\n  encodeBase64,\n  decodeBase64\n} from \"tweetnacl-util\";\n\nconst newNonce = () => randomBytes(secretbox.nonceLength);\n\nexport const generateKey = () => encodeBase64(randomBytes(secretbox.keyLength));\n\nexport const encrypt = (json, key) => {\n  const keyUint8Array = decodeBase64(key);\n\n  const nonce = newNonce();\n  const messageUint8 = decodeUTF8(JSON.stringify(json));\n  const box = secretbox(messageUint8, nonce, keyUint8Array);\n\n  const fullMessage = new Uint8Array(nonce.length + box.length);\n  fullMessage.set(nonce);\n  fullMessage.set(box, nonce.length);\n\n  const base64FullMessage = encodeBase64(fullMessage);\n  return base64FullMessage;\n};\n\nexport const decrypt = (messageWithNonce, key) => {\n  const keyUint8Array = decodeBase64(key);\n  const messageWithNonceAsUint8Array = decodeBase64(messageWithNonce);\n  const nonce = messageWithNonceAsUint8Array.slice(0, secretbox.nonceLength);\n  const message = messageWithNonceAsUint8Array.slice(\n    secretbox.nonceLength,\n    messageWithNonce.length\n  );\n\n  const decrypted = secretbox.open(message, nonce, keyUint8Array);\n\n  if (!decrypted) {\n    throw new Error(\"Could not decrypt message\");\n  }\n\n  const base64DecryptedMessage = encodeUTF8(decrypted);\n  return JSON.parse(base64DecryptedMessage);\n};\n\nconst key = generateKey();\nconst obj = { \"hello\": \"world\" };\nconst encrypted = encrypt(obj, key);\nconst decrypted = decrypt(encrypted, key);\nconsole.log(decrypted, obj); // should be shallow equal\n",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "Project function, tweetnacl",
      "display": "export function encryptBlob(data: Uint8Array, key: Uint8Array): Uint8Array {\n  const nonce = getRandomBytes(tweetnacl.secretbox.nonceLength);\n  const dataStandalone = data.byteOffset === 0 && data.buffer.byteLength === data.length ? data : data.slice();\n  const keyStandalone = key.byteOffset === 0 && key.buffer.byteLength === key.length ? key : key.slice();\n  const encrypted = tweetnacl.secretbox(dataStandalone, nonce, keyStandalone);\n  const result = new Uint8Array(nonce.length + encrypted.length);\n  result.set(nonce, 0);\n  result.set(encrypted, nonce.length);\n  return result;\n}\n",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "Project function reference, tweetnacl",
      "display": "encryption.ts · encryptBlob()",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "Project repository, tweetnacl",
      "display": "slopus/happy",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "Project stars, slopus/happy",
      "display": "24.7K",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Project push date, slopus/happy",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F75": {
      "label": "Library name, libsodium-wrappers",
      "display": "libsodium.js",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "Monthly downloads, libsodium-wrappers",
      "display": "28.2M",
      "asOf": "2026-11-15"
    },
    "F77": {
      "label": "License, libsodium-wrappers",
      "display": "ISC",
      "asOf": "2026-11-17"
    },
    "F78": {
      "label": "Package release, libsodium-wrappers",
      "display": "0.8.4",
      "asOf": "2026-11-17"
    },
    "F79": {
      "label": "Undated package release, libsodium-wrappers",
      "display": "v0.8.4",
      "asOf": "2026-11-17"
    },
    "F80": {
      "label": "Repository stars, libsodium-wrappers",
      "display": "1.2K",
      "asOf": "2026-11-17"
    },
    "F81": {
      "label": "Authenticated encryption, libsodium-wrappers",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F82": {
      "label": "Random bytes, libsodium-wrappers",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "Password keys, libsodium-wrappers",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "Public-key encryption, libsodium-wrappers",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "Install, libsodium-wrappers",
      "display": "npm install libsodium-wrappers",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "What it does, libsodium-wrappers",
      "display": "Provides JavaScript and WebAssembly wrappers for libsodium cryptographic operations.",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "strengths lead, libsodium-wrappers",
      "display": "Processes ordered encrypted message streams",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "strengths, libsodium-wrappers",
      "display": "Use secretstream to encrypt messages and mark the final chunk.",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "strengths lead, libsodium-wrappers",
      "display": "Converts string inputs automatically",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "strengths, libsodium-wrappers",
      "display": "String input is converted into UTF-8 bytes for binary APIs.",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "limitations lead, libsodium-wrappers",
      "display": "Initialization is asynchronous",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "limitations, libsodium-wrappers",
      "display": "Await sodium.ready before calling cryptographic functions.",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "limitations lead, libsodium-wrappers",
      "display": "Password hashing needs sumo",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "limitations, libsodium-wrappers",
      "display": "Use the sumo package for crypto_pwhash functions.",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "Quickstart, libsodium-wrappers",
      "display": "import sodium from 'libsodium-wrappers';\n\nawait sodium.ready;\n\nlet key = sodium.crypto_secretstream_xchacha20poly1305_keygen();\n\nlet { state: state_out, header } =\n  sodium.crypto_secretstream_xchacha20poly1305_init_push(key);\nlet c1 = sodium.crypto_secretstream_xchacha20poly1305_push(state_out,\n  sodium.from_string('message 1'), null,\n  sodium.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE);\nlet c2 = sodium.crypto_secretstream_xchacha20poly1305_push(state_out,\n  sodium.from_string('message 2'), null,\n  sodium.crypto_secretstream_xchacha20poly1305_TAG_FINAL);\n\nlet state_in = sodium.crypto_secretstream_xchacha20poly1305_init_pull(header, key);\nlet r1 = sodium.crypto_secretstream_xchacha20poly1305_pull(state_in, c1);\nlet { message: m1_bytes, tag: tag1 } = r1;\nlet m1 = sodium.to_string(m1_bytes);\nlet r2 = sodium.crypto_secretstream_xchacha20poly1305_pull(state_in, c2);\nlet { message: m2_bytes, tag: tag2 } = r2;\nlet m2 = sodium.to_string(m2_bytes);\n\nsodium.free(state_out);\nsodium.free(state_in);\n\nconsole.log(m1);\nconsole.log(m2);\n",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "Project function, libsodium-wrappers",
      "display": "async encrypt(plaintext: string): Promise<string> {\n    const sodium = await loadSodium()\n    const nonce = sodium.randombytes_buf(NONCE_BYTES)\n    const ct = sodium.crypto_secretbox_easy(plaintext, nonce, this.key)\n    const nonceb64 = Buffer.from(nonce).toString('base64')\n    const ctb64 = Buffer.from(ct).toString('base64')\n    return `${PREFIX}${nonceb64}:${ctb64}`\n  }\n",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Project function reference, libsodium-wrappers",
      "display": "secret-store-libsodium.ts · encrypt()",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "Project repository, libsodium-wrappers",
      "display": "agalwood/Motrix",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "Project stars, agalwood/Motrix",
      "display": "58.4K",
      "asOf": "2026-11-17"
    },
    "F100": {
      "label": "Project push date, agalwood/Motrix",
      "display": "Nov 2026",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "Developer need",
      "display": "Bundling a generated nonce with ciphertext",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Why choose @noble/ciphers",
      "display": "the managedNonce wrapper",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Developer need in introduction",
      "display": "bundling a generated nonce with ciphertext",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "When to consider libsodium-wrappers",
      "display": "ordered encrypted streams are the main task",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "Developer need",
      "display": "Encrypting ordered message streams",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Why choose libsodium-wrappers",
      "display": "secretstream state and final-message tags",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Developer need in introduction",
      "display": "encrypting ordered message streams",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "Developer need",
      "display": "Encrypting with peer key pairs",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "Why choose tweetnacl",
      "display": "the box authenticated-encryption API",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "Developer need in introduction",
      "display": "encrypting with peer key pairs",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "When to consider libsodium-wrappers",
      "display": "automatic string-to-byte conversion matters",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "Developer need",
      "display": "Deriving password-based keys",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "Why choose node-forge",
      "display": "the included password-key derivation API",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "Developer need in introduction",
      "display": "deriving password-based keys",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "Page introduction",
      "display": "JavaScript encryption libraries let application developers encrypt and decrypt application data.",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "FAQ: What distinguishes authenticated encryption from a raw cipher?",
      "display": "Noble AEAD variants include an authentication tag and throw when decryption detects tampering.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: Can noble-ciphers carry the nonce with ciphertext?",
      "display": "managedNonce prepends a generated nonce during encryption.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: Can noble-ciphers carry the nonce with ciphertext?",
      "display": "Its decrypt operation reads that prefix as the nonce.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: Can a nonce be reused for another message?",
      "display": "The own cipher guidance calls for a new nonce for each message instead of repeating it.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: Does a password become an encryption key automatically?",
      "display": "The noble password example derives a key using a separate KDF package before encryption.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: Why must libsodium.js initialization be awaited?",
      "display": "Await sodium.ready before using its cryptographic functions and constants.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: Does standard libsodium-wrappers include password hashing?",
      "display": "The crypto_pwhash function set is in the sumo build rather than the standard build.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "FAQ: Can libsodium.js accept a string as binary input?",
      "display": "Its wrappers convert supplied strings into UTF-8 byte arrays.",
      "asOf": "2026-11-17"
    },
    "F124": {
      "label": "FAQ: What input type does TweetNaCl.js expect?",
      "display": "The APIs accept and return Uint8Array values; text and object serialization are application steps.",
      "asOf": "2026-11-17"
    },
    "F125": {
      "label": "FAQ: What does TweetNaCl.js return after failed authentication?",
      "display": "The open API returns null instead of plaintext when authentication fails.",
      "asOf": "2026-11-17"
    },
    "F126": {
      "label": "FAQ: How should TweetNaCl.js output be converted into a Node Buffer?",
      "display": "Copy with Buffer.from(array), rather than sharing array.buffer, to preserve subarray boundaries.",
      "asOf": "2026-11-17"
    },
    "F127": {
      "label": "FAQ: When can Forge GCM plaintext be consumed?",
      "display": "Check the decipher.finish result; failure includes an authentication-tag mismatch.",
      "asOf": "2026-11-17"
    },
    "F128": {
      "label": "FAQ: Are the project ciphertext envelopes standard library export formats?",
      "display": "Motrix adds its own prefix and base64 nonce/ciphertext segments around native secretbox output.",
      "asOf": "2026-11-17"
    },
    "F129": {
      "label": "Library name, jose",
      "display": "jose",
      "asOf": "2026-11-20"
    },
    "F130": {
      "label": "Monthly downloads, jose",
      "display": "878.5M",
      "asOf": "2026-11-20"
    },
    "F131": {
      "label": "License, jose",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F132": {
      "label": "Package release, jose",
      "display": "6.2.17",
      "asOf": "2026-11-20"
    },
    "F133": {
      "label": "Package release date, jose",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F134": {
      "label": "Install, jose",
      "display": "npm install jose",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "Quickstart, jose",
      "display": "import { EncryptJWT, generateSecret } from 'jose';\n\nconst secret = await generateSecret('A256GCM');\nconst token = await new EncryptJWT({ sub: 'example' })\n  .setProtectedHeader({ alg: 'dir', enc: 'A256GCM' })\n  .encrypt(secret);\n",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "Official description, jose",
      "display": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "Quickstart source file, jose",
      "display": "EncryptJWT.md",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Repository stars, jose",
      "display": "7.9K",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Public-key encryption, jose",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "Authenticated extra data, jose",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Encryption role, jose",
      "display": "JWE/JWT standard envelopes; encryption and signing are separate operations.",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Project function, jose",
      "display": "export async function symmetricEncodeJWT<T extends Record<string, any>>(\n\tpayload: T,\n\tsecret: string | SecretConfig,\n\tsalt: string,\n\texpiresIn: number = 3600,\n): Promise<string> {\n\tconst currentSecret = getCurrentSecret(secret);\n\tconst encryptionSecret = deriveEncryptionSecret(currentSecret, salt);\n\n\tconst thumbprint = await calculateJwkThumbprint(\n\t\t{ kty: \"oct\", k: base64url.encode(encryptionSecret) },\n\t\t\"sha256\",\n\t);\n\n\treturn await new EncryptJWT(payload)\n\t\t.setProtectedHeader({ alg, enc, kid: thumbprint })\n\t\t.setIssuedAt()\n\t\t.setExpirationTime(now() + expiresIn)\n\t\t.setJti(crypto.randomUUID())\n\t\t.encrypt(encryptionSecret);\n}\n",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Project source file, jose",
      "display": "packages/better-auth/src/crypto/jwt.ts",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "Project full_name, jose",
      "display": "better-auth/better-auth",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Project stargazers_count, jose",
      "display": "30.8K",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Library name, @noble/ciphers",
      "display": "noble-ciphers",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "Monthly downloads, @noble/ciphers",
      "display": "220.7M",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "License, @noble/ciphers",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "Package release, @noble/ciphers",
      "display": "2.4.0",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Package release date, @noble/ciphers",
      "display": "Aug 2026",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "Install, @noble/ciphers",
      "display": "npm install @noble/ciphers",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Quickstart, @noble/ciphers",
      "display": "import { gcm } from '@noble/ciphers/aes.js';\nimport { randomBytes } from '@noble/ciphers/utils.js';\n\nconst key = randomBytes(32);\nconst nonce = randomBytes(12);\nconst ciphertext = gcm(key, nonce).encrypt(new TextEncoder().encode('hello'));\n",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Repository stars, @noble/ciphers",
      "display": "437",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Public-key encryption, @noble/ciphers",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Authenticated extra data, @noble/ciphers",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Encryption role, @noble/ciphers",
      "display": "Byte-level symmetric ciphers and AEADs; application defines its envelope and key protocol.",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "Project function, @noble/ciphers",
      "display": "export function seal(options: SealOptions): Envelope {\n  const ts = options.ts ?? Math.floor(Date.now() / 1000);\n  validateEnvelopeMetadata(options.id, options.from, options.to, ts);\n  validateMessageBody(options.body);\n  const plaintext = canonicalBytes(options.body);\n  if (plaintext.length > REEF_MAX_PLAINTEXT_BYTES) {\n    throw new TooLargeError();\n  }\n  const ephemeral = x25519.keygen((options.rng ?? randomBytes)(32));\n  const shared = x25519.getSharedSecret(\n    ephemeral.secretKey,\n    decodeKey(options.recipientEncryptionPublicKey),\n  );\n  const key = hkdf(sha256, shared, undefined, HKDF_INFO, 32);\n  const nonce = (options.rng ?? randomBytes)(12);\n  if (nonce.length !== 12) {\n    throw new MalformedError(\"rng returned invalid nonce\");\n  }\n  const unsigned: UnsignedEnvelope = {\n    v: 1,\n    id: options.id,\n    from: options.from,\n    to: options.to,\n    ts,\n    epk: base64(ephemeral.publicKey),\n    n: base64(nonce),\n    ct: base64(gcm(key, nonce).encrypt(plaintext)),\n  };\n  return {\n    ...unsigned,\n    sig: base64(ed25519.sign(canonicalBytes(unsigned), decodeKey(options.senderSigningSecretKey))),\n  };\n}\n",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Project source file, @noble/ciphers",
      "display": "extensions/reef/protocol/envelope.ts",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "Project full_name, @noble/ciphers",
      "display": "openclaw/openclaw",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "Project stargazers_count, @noble/ciphers",
      "display": "394.6K",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Library name, node-forge",
      "display": "Forge",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Monthly downloads, node-forge",
      "display": "211.3M",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "License, node-forge",
      "display": "(BSD-3-Clause OR GPL-2.0)",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Package release, node-forge",
      "display": "1.4.3",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "Package release date, node-forge",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "Install, node-forge",
      "display": "npm install node-forge",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Quickstart, node-forge",
      "display": "import forge from 'node-forge';\n\nconst key = forge.random.getBytesSync(32);\nconst iv = forge.random.getBytesSync(12);\nconst cipher = forge.cipher.createCipher('AES-GCM', key);\ncipher.start({ iv });\ncipher.update(forge.util.createBuffer('hello', 'utf8'));\ncipher.finish();\nconst ciphertext = cipher.output.getBytes();\nconst tag = cipher.mode.tag.getBytes();\n",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Repository stars, node-forge",
      "display": "5.4K",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Public-key encryption, node-forge",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Authenticated extra data, node-forge",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Encryption role, node-forge",
      "display": "Local symmetric/public-key/PKI toolkit using binary strings and ByteBuffers.",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Project function, node-forge",
      "display": "export function encryptAES(jwkOrKey: string | JsonWebKey, plaintext: string, additionalData = ''): AESMessage {\n  // TODO: Add assertion checks for JWK\n  const rawKey = typeof jwkOrKey === 'string' ? jwkOrKey : _b64UrlToHex(jwkOrKey.k || '');\n  const key = forge.util.hexToBytes(rawKey);\n  const iv = forge.random.getBytesSync(12);\n  const cipher = forge.cipher.createCipher('AES-GCM', key);\n  // Plaintext could contain weird unicode, so we have to encode that\n  const encodedPlaintext = encodeURIComponent(plaintext);\n  cipher.start({\n    additionalData,\n    iv,\n    tagLength: 128,\n  });\n  cipher.update(forge.util.createBuffer(encodedPlaintext));\n  cipher.finish();\n  return {\n    iv: forge.util.bytesToHex(iv),\n    // @ts-expect-error -- TSCONVERSION needs to be converted to string\n    t: forge.util.bytesToHex(cipher.mode.tag),\n    ad: forge.util.bytesToHex(additionalData),\n    // @ts-expect-error -- TSCONVERSION needs to be converted to string\n    d: forge.util.bytesToHex(cipher.output),\n  };\n}\n",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Project source file, node-forge",
      "display": "packages/insomnia-vcs/src/crypt.ts",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Project full_name, node-forge",
      "display": "Kong/insomnia",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Project stargazers_count, node-forge",
      "display": "40.2K",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Library name, tweetnacl",
      "display": "TweetNaCl.js",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Monthly downloads, tweetnacl",
      "display": "195.3M",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "License, tweetnacl",
      "display": "Unlicense",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Package release, tweetnacl",
      "display": "1.0.3",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "Package release date, tweetnacl",
      "display": "Feb 2020",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Install, tweetnacl",
      "display": "npm install tweetnacl",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "Quickstart, tweetnacl",
      "display": "import nacl from 'tweetnacl';\n\nconst key = nacl.randomBytes(nacl.secretbox.keyLength);\nconst nonce = nacl.randomBytes(nacl.secretbox.nonceLength);\nconst message = new TextEncoder().encode('hello');\nconst ciphertext = nacl.secretbox(message, nonce, key);\n",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "Repository stars, tweetnacl",
      "display": "1.9K",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Public-key encryption, tweetnacl",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Authenticated extra data, tweetnacl",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Encryption role, tweetnacl",
      "display": "NaCl box/secretbox with byte-array keys and caller-managed nonces.",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "Selected envelope, tweetnacl",
      "display": "Ephemeral public key || nonce || NaCl box ciphertext",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Project function, tweetnacl",
      "display": "export function libsodiumEncryptForPublicKey(data: Uint8Array, recipientPublicKey: Uint8Array): Uint8Array {\n  // Generate ephemeral keypair for this encryption\n  const ephemeralKeyPair = tweetnacl.box.keyPair();\n  \n  // Generate random nonce (24 bytes for box encryption)\n  const nonce = getRandomBytes(tweetnacl.box.nonceLength);\n  \n  // Encrypt the data using box (authenticated encryption)\n  const encrypted = tweetnacl.box(data, nonce, recipientPublicKey, ephemeralKeyPair.secretKey);\n  \n  // Bundle format: ephemeral public key (32 bytes) + nonce (24 bytes) + encrypted data\n  const result = new Uint8Array(ephemeralKeyPair.publicKey.length + nonce.length + encrypted.length);\n  result.set(ephemeralKeyPair.publicKey, 0);\n  result.set(nonce, ephemeralKeyPair.publicKey.length);\n  result.set(encrypted, ephemeralKeyPair.publicKey.length + nonce.length);\n  \n  return result;\n}\n",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Project source file, tweetnacl",
      "display": "packages/happy-cli/src/api/encryption.ts",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Project full_name, tweetnacl",
      "display": "slopus/happy",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Project stargazers_count, tweetnacl",
      "display": "24.7K",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Library name, crypto-js",
      "display": "CryptoJS",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Monthly downloads, crypto-js",
      "display": "102.5M",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "License, crypto-js",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "Package release, crypto-js",
      "display": "4.2.0",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "Package release date, crypto-js",
      "display": "Oct 2023",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Install, crypto-js",
      "display": "npm install crypto-js",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "Quickstart, crypto-js",
      "display": "var CryptoJS = require('crypto-js');\n\nvar ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123').toString();\n",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "Official description, crypto-js",
      "display": "JavaScript library of crypto standards.",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "Quickstart source file, crypto-js",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Repository stars, crypto-js",
      "display": "16.4K",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "Public-key encryption, crypto-js",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "Authenticated extra data, crypto-js",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Encryption role, crypto-js",
      "display": "Legacy CryptoJS/OpenSSL-style AES cipher formatting and WordArray encodings; upstream maintenance is discontinued.",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "Maintenance, crypto-js",
      "display": "Discontinued",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "Project function, crypto-js",
      "display": "export function encryptBlock(block, contentKey) {\n  const key = CryptoJS.enc.Hex.parse(contentKey);\n  const iv = CryptoJS.lib.WordArray.random(128 / 8);\n  const encrypted = CryptoJS.AES.encrypt(block, key, { iv: iv });\n  const blockEncrypted = encrypted.ciphertext.toString(CryptoJS.enc.Base64)\n  const blockIv = iv.toString();\n\n  return { blockEncrypted, blockIv };\n}\n",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Project source file, crypto-js",
      "display": "net/web/src/context/sealUtil.js",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "Project full_name, crypto-js",
      "display": "balzack/databag",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Project stargazers_count, crypto-js",
      "display": "1.5K",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "Library name, eciesjs",
      "display": "eciesjs",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "Monthly downloads, eciesjs",
      "display": "64.0M",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "License, eciesjs",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Package release, eciesjs",
      "display": "0.5.0",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "Package release date, eciesjs",
      "display": "Apr 2026",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "Install, eciesjs",
      "display": "npm install eciesjs",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "Quickstart, eciesjs",
      "display": "import { PrivateKey, decrypt, encrypt } from \"eciesjs\";\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\n\nconst sk = new PrivateKey();\nconst data = encoder.encode(\"hello world🌍\");\nconst decrypted = decrypt(sk.secret, encrypt(sk.publicKey.toBytes(), data));\nconsole.log(decoder.decode(decrypted));\n",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "Official description, eciesjs",
      "display": "Elliptic Curve Integrated Encryption Scheme for secp256k1/curve25519",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Quickstart source file, eciesjs",
      "display": "example/runtime/quick-start.js",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "Repository stars, eciesjs",
      "display": "162",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "Public-key encryption, eciesjs",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "Authenticated extra data, eciesjs",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Encryption role, eciesjs",
      "display": "ECIES hybrid public-key encryption with explicit curve, KDF-point, symmetric-mode, and nonce-format agreement.",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "Default wire settings, eciesjs",
      "display": "{\"curve\": \"secp256k1\", \"symmetric\": \"aes-256-gcm\", \"nonce_bytes\": 16, \"ephemeral_key_compressed\": false, \"HKDF_point_compressed\": false}",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "Project function, eciesjs",
      "display": "function decryptWithKey(keyHex: string, encryptedValue: string): DecryptedSecret {\n  if (keyHex.length === 0) return { ok: false, error: \"missing private key\" };\n  let privateKeyHex: string;\n  try {\n    privateKeyHex = PrivateKey.fromHex(keyHex).toHex();\n  } catch {\n    // Fixed message, not the underlying error: some runtimes' fallback hex\n    // decoder echoes a fragment of the bad input (offending char + index)\n    // into the error, which would otherwise reach the user's stderr.\n    return { ok: false, error: \"failed to hex decode private key: cannot decode hex string\" };\n  }\n  const encoded = encryptedValue.slice(ENCRYPTED_PREFIX.length);\n  // Node's `Buffer.from(s, \"base64\")` silently drops invalid characters, so\n  // reject malformed input explicitly.\n  if (!STD_BASE64_PATTERN.test(encoded) || encoded.length % 4 !== 0) {\n    return { ok: false, error: \"failed to base64 decode secret: invalid base64 data\" };\n  }\n  try {\n    // eciesjs returns a Uint8Array; wrap in Buffer before decoding the plaintext.\n    const plaintext = Buffer.from(decrypt(privateKeyHex, Buffer.from(encoded, \"base64\")));\n    return { ok: true, value: plaintext.toString(\"utf8\") };\n  } catch (cause) {\n    return { ok: false, error: `failed to decrypt secret: ${errorMessage(cause)}` };\n  }\n}\n",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "Project source file, eciesjs",
      "display": "apps/cli/src/command-internal/vault-decrypt.ts",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Project full_name, eciesjs",
      "display": "supabase/cli",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Project stargazers_count, eciesjs",
      "display": "2.5K",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "Library name, crypto-browserify",
      "display": "crypto-browserify",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Monthly downloads, crypto-browserify",
      "display": "53.6M",
      "asOf": "2026-11-20"
    },
    "F230": {
      "label": "License, crypto-browserify",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F231": {
      "label": "Package release, crypto-browserify",
      "display": "3.12.1",
      "asOf": "2026-11-20"
    },
    "F232": {
      "label": "Package release date, crypto-browserify",
      "display": "Oct 2024",
      "asOf": "2026-11-20"
    },
    "F233": {
      "label": "Install, crypto-browserify",
      "display": "npm install crypto-browserify",
      "asOf": "2026-11-20"
    },
    "F234": {
      "label": "Quickstart, crypto-browserify",
      "display": "const crypto = require('crypto-browserify');\nconst { Buffer } = require('buffer');\n\nconst key = crypto.randomBytes(32);\nconst iv = crypto.randomBytes(12);\nconst cipher = crypto.createCipheriv('aes-256-gcm', key, iv);\nconst ciphertext = Buffer.concat([cipher.update('hello', 'utf8'), cipher.final()]);\nconst tag = cipher.getAuthTag();\n",
      "asOf": "2026-11-20"
    },
    "F235": {
      "label": "Official description, crypto-browserify",
      "display": "implementation of crypto for the browser",
      "asOf": "2026-11-20"
    },
    "F236": {
      "label": "Quickstart source file, crypto-browserify",
      "display": "index.js",
      "asOf": "2026-11-20"
    },
    "F237": {
      "label": "Repository stars, crypto-browserify",
      "display": "683",
      "asOf": "2026-11-20"
    },
    "F238": {
      "label": "Public-key encryption, crypto-browserify",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F239": {
      "label": "Authenticated extra data, crypto-browserify",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F240": {
      "label": "Encryption role, crypto-browserify",
      "display": "Node-compatible browser cryptography facade backed by dedicated modules; same AES engine is not counted again.",
      "asOf": "2026-11-20"
    },
    "F241": {
      "label": "AES family boundary, crypto-browserify",
      "display": "{\"facade_downloads\": 53573842, \"browserify_aes_engine_downloads\": 55150839}",
      "asOf": "2026-11-20"
    },
    "F242": {
      "label": "Project function, crypto-browserify",
      "display": "export const generateKeyStore = (\n  privateKeyHex: string,\n  password: string\n): KeyStore => {\n  const salt = cryp.randomBytes(32)\n  const iv = cryp.randomBytes(16)\n  const cipherAlg = \"aes-256-ctr\"\n\n  const kdf = \"pbkdf2\"\n  const kdfparams = {\n    dklen: 32,\n    salt: salt.toString(\"hex\"),\n    c: 262144,\n    prf: \"hmac-sha256\",\n  }\n\n  const derivedKey = cryp.pbkdf2Sync(\n    Buffer.from(password),\n    salt,\n    kdfparams.c,\n    kdfparams.dklen,\n    \"sha256\"\n  )\n  const cipher = cryp.createCipheriv(cipherAlg, derivedKey.slice(0, 32), iv)\n  if (!cipher) {\n    throw new Error(\"Unsupported cipher\")\n  }\n\n  const ciphertext = Buffer.concat([\n    cipher.update(Buffer.from(privateKeyHex, \"hex\")),\n    cipher.final(),\n  ])\n  const bufferValue = Buffer.concat([derivedKey.slice(16, 32), ciphertext])\n\n  return {\n    version: 1,\n    id: uuid.v4({\n      random: cryp.randomBytes(16),\n    }),\n    crypto: {\n      ciphertext: ciphertext.toString(\"hex\"),\n      cipherparams: {\n        iv: iv.toString(\"hex\"),\n      },\n      cipher: cipherAlg,\n      kdf,\n      kdfparams,\n      // mac must use sha3 according to web3 secret storage spec\n      mac: sha3(bufferValue.toString(\"hex\")),\n    },\n  }\n}\n",
      "asOf": "2026-11-20"
    },
    "F243": {
      "label": "Project source file, crypto-browserify",
      "display": "src/crypto/index.ts",
      "asOf": "2026-11-20"
    },
    "F244": {
      "label": "Project full_name, crypto-browserify",
      "display": "bnb-chain/javascript-sdk",
      "asOf": "2026-11-20"
    },
    "F245": {
      "label": "Project stargazers_count, crypto-browserify",
      "display": "402",
      "asOf": "2026-11-20"
    },
    "F246": {
      "label": "Library name, libsodium-wrappers",
      "display": "libsodium.js",
      "asOf": "2026-11-20"
    },
    "F247": {
      "label": "Monthly downloads, libsodium-wrappers",
      "display": "28.8M",
      "asOf": "2026-11-20"
    },
    "F248": {
      "label": "License, libsodium-wrappers",
      "display": "ISC",
      "asOf": "2026-11-20"
    },
    "F249": {
      "label": "Package release, libsodium-wrappers",
      "display": "0.8.4",
      "asOf": "2026-11-20"
    },
    "F250": {
      "label": "Package release date, libsodium-wrappers",
      "display": "Apr 2026",
      "asOf": "2026-11-20"
    },
    "F251": {
      "label": "Install, libsodium-wrappers",
      "display": "npm install libsodium-wrappers",
      "asOf": "2026-11-20"
    },
    "F252": {
      "label": "Quickstart, libsodium-wrappers",
      "display": "import sodium from 'libsodium-wrappers';\n\nawait sodium.ready;\nconst key = sodium.randombytes_buf(sodium.crypto_secretbox_KEYBYTES);\nconst nonce = sodium.randombytes_buf(sodium.crypto_secretbox_NONCEBYTES);\nconst ciphertext = sodium.crypto_secretbox_easy('hello', nonce, key);\n",
      "asOf": "2026-11-20"
    },
    "F253": {
      "label": "Repository stars, libsodium-wrappers",
      "display": "1.2K",
      "asOf": "2026-11-20"
    },
    "F254": {
      "label": "Public-key encryption, libsodium-wrappers",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F255": {
      "label": "Authenticated extra data, libsodium-wrappers",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F256": {
      "label": "Encryption role, libsodium-wrappers",
      "display": "Async-initialized libsodium JS/WASM wrapper with box, secretbox, and modern AEAD APIs.",
      "asOf": "2026-11-20"
    },
    "F257": {
      "label": "Initialization and value encoding, libsodium-wrappers",
      "display": "Await default-export sodium.ready; strings automatically convert to UTF-8; binary results are Uint8Array.",
      "asOf": "2026-11-20"
    },
    "F258": {
      "label": "What, jose",
      "display": "Signs, verifies, encrypts, and decrypts JSON Web Tokens and other JOSE formats across Node.js, browsers, and edge runtimes.",
      "asOf": "2026-11-17"
    },
    "F259": {
      "label": "Strength lead, jose",
      "display": "Encrypts JSON Web Tokens",
      "asOf": "2026-11-17"
    },
    "F260": {
      "label": "Strength body, jose",
      "display": "jwtDecrypt decrypts a token and validates its claims set.",
      "asOf": "2026-11-17"
    },
    "F261": {
      "label": "Strength lead, jose deps",
      "display": "No dependencies",
      "asOf": "2026-11-17"
    },
    "F262": {
      "label": "Strength body, jose deps",
      "display": "The package has no dependencies and exports tree-shakeable ES modules.",
      "asOf": "2026-11-17"
    },
    "F263": {
      "label": "What, CryptoJS",
      "display": "Implements crypto standards such as AES, SHA hashes, and HMAC in JavaScript.",
      "asOf": "2026-11-17"
    },
    "F264": {
      "label": "Watch out lead, CryptoJS",
      "display": "No longer maintained",
      "asOf": "2026-11-17"
    },
    "F265": {
      "label": "Watch out body, CryptoJS",
      "display": "The maintainers recommend the native crypto module in Node.js and current browsers.",
      "asOf": "2026-11-17"
    },
    "F266": {
      "label": "What, eciesjs",
      "display": "Encrypts data to an elliptic curve public key with the ECIES hybrid scheme.",
      "asOf": "2026-11-17"
    },
    "F267": {
      "label": "Strength lead, eciesjs",
      "display": "Runs on many platforms",
      "asOf": "2026-11-17"
    },
    "F268": {
      "label": "Strength body, eciesjs",
      "display": "The same API runs in browsers, Node.js, Bun, Deno, and React Native.",
      "asOf": "2026-11-17"
    },
    "F269": {
      "label": "Strength lead, eciesjs deps",
      "display": "Uses audited dependencies",
      "asOf": "2026-11-17"
    },
    "F270": {
      "label": "Strength body, eciesjs deps",
      "display": "Its cryptography comes from node:crypto and the audited noble packages.",
      "asOf": "2026-11-17"
    },
    "F271": {
      "label": "Watch out lead, eciesjs",
      "display": "Settings must match across apps",
      "asOf": "2026-11-17"
    },
    "F272": {
      "label": "Watch out body, eciesjs",
      "display": "Use the same curve, cipher, and nonce settings on every side of the exchange.",
      "asOf": "2026-11-17"
    },
    "F273": {
      "label": "What, crypto-browserify",
      "display": "Reimplements the Node.js crypto module in plain JavaScript for the browser.",
      "asOf": "2026-11-17"
    },
    "F274": {
      "label": "Watch out lead, crypto-browserify",
      "display": "Covers a subset of Node.js crypto",
      "asOf": "2026-11-17"
    },
    "F275": {
      "label": "Watch out body, crypto-browserify",
      "display": "Check the implemented list before porting code that calls other crypto functions.",
      "asOf": "2026-11-17"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best JavaScript encryption libraries noble-ciphers libsodium TweetNaCl Forge code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
