diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61bd193..895e7b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,6 @@ concurrency: env: NODE_VERSION: '22' - PNPM_VERSION: '10.23.0' jobs: changes: @@ -56,17 +55,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - cache: pnpm + cache: npm - name: Install dependencies - run: pnpm install --frozen-lockfile + run: npm ci --ignore-scripts build: name: TypeScript build @@ -77,19 +72,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - cache: pnpm + cache: npm - name: Install dependencies - run: pnpm install --frozen-lockfile + run: npm ci --ignore-scripts - name: Build - run: pnpm run build + run: npm run build test: name: Test shard (${{ matrix.shard }}) @@ -102,7 +93,7 @@ jobs: matrix: include: - shard: workflow-contract - command: pnpm run ci:validate-workflow + command: npm run ci:validate-workflow - shard: queue-monitoring command: node --check scripts/run-tests.cjs - shard: queue-autoscaling @@ -110,17 +101,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - cache: pnpm + cache: npm - name: Install dependencies - run: pnpm install --frozen-lockfile + run: npm ci --ignore-scripts - name: Run shard run: ${{ matrix.command }} @@ -133,19 +120,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - cache: pnpm + cache: npm - name: Install dependencies - run: pnpm install --frozen-lockfile + run: npm ci --ignore-scripts - name: Audit production dependencies - run: pnpm audit --prod --audit-level high + run: npm audit --omit=dev --audit-level high - name: CodeQL init uses: github/codeql-action/init@v3 with: @@ -181,6 +164,11 @@ jobs: steps: - name: Check required jobs run: | + echo "build=${{ needs.build.result }}" + echo "test=${{ needs.test.result }}" + echo "security=${{ needs.security.result }}" + echo "docker=${{ needs.docker.result }}" + for result in "${{ needs.build.result }}" "${{ needs.test.result }}" "${{ needs.security.result }}" "${{ needs.docker.result }}"; do if [ "$result" != "success" ] && [ "$result" != "skipped" ]; then echo "A required CI job finished with status: $result" diff --git a/node_modules/.bin/acorn b/node_modules/.bin/acorn deleted file mode 100644 index 679bd16..0000000 --- a/node_modules/.bin/acorn +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../acorn/bin/acorn" "$@" -else - exec node "$basedir/../acorn/bin/acorn" "$@" -fi diff --git a/node_modules/.bin/acorn.cmd b/node_modules/.bin/acorn.cmd deleted file mode 100644 index a9324df..0000000 --- a/node_modules/.bin/acorn.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\acorn\bin\acorn" %* diff --git a/node_modules/.bin/acorn.ps1 b/node_modules/.bin/acorn.ps1 deleted file mode 100644 index 6f6dcdd..0000000 --- a/node_modules/.bin/acorn.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args - } else { - & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../acorn/bin/acorn" $args - } else { - & "node$exe" "$basedir/../acorn/bin/acorn" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/ts-node b/node_modules/.bin/ts-node deleted file mode 100755 index f3d4fab..0000000 --- a/node_modules/.bin/ts-node +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../ts-node/dist/bin.js" "$@" -else - exec node "$basedir/../ts-node/dist/bin.js" "$@" -fi diff --git a/node_modules/.bin/ts-node-cwd b/node_modules/.bin/ts-node-cwd deleted file mode 100644 index ae68e85..0000000 --- a/node_modules/.bin/ts-node-cwd +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../ts-node/dist/bin-cwd.js" "$@" -else - exec node "$basedir/../ts-node/dist/bin-cwd.js" "$@" -fi diff --git a/node_modules/.bin/ts-node-cwd.cmd b/node_modules/.bin/ts-node-cwd.cmd deleted file mode 100644 index 50c1bbc..0000000 --- a/node_modules/.bin/ts-node-cwd.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ts-node\dist\bin-cwd.js" %* diff --git a/node_modules/.bin/ts-node-cwd.ps1 b/node_modules/.bin/ts-node-cwd.ps1 deleted file mode 100644 index b12acfa..0000000 --- a/node_modules/.bin/ts-node-cwd.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../ts-node/dist/bin-cwd.js" $args - } else { - & "$basedir/node$exe" "$basedir/../ts-node/dist/bin-cwd.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../ts-node/dist/bin-cwd.js" $args - } else { - & "node$exe" "$basedir/../ts-node/dist/bin-cwd.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/ts-node-esm b/node_modules/.bin/ts-node-esm deleted file mode 100644 index 19ea759..0000000 --- a/node_modules/.bin/ts-node-esm +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../ts-node/dist/bin-esm.js" "$@" -else - exec node "$basedir/../ts-node/dist/bin-esm.js" "$@" -fi diff --git a/node_modules/.bin/ts-node-esm.cmd b/node_modules/.bin/ts-node-esm.cmd deleted file mode 100644 index ba439a0..0000000 --- a/node_modules/.bin/ts-node-esm.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ts-node\dist\bin-esm.js" %* diff --git a/node_modules/.bin/ts-node-esm.ps1 b/node_modules/.bin/ts-node-esm.ps1 deleted file mode 100644 index d9806c0..0000000 --- a/node_modules/.bin/ts-node-esm.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../ts-node/dist/bin-esm.js" $args - } else { - & "$basedir/node$exe" "$basedir/../ts-node/dist/bin-esm.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../ts-node/dist/bin-esm.js" $args - } else { - & "node$exe" "$basedir/../ts-node/dist/bin-esm.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/ts-node-script b/node_modules/.bin/ts-node-script deleted file mode 100644 index 14c2f67..0000000 --- a/node_modules/.bin/ts-node-script +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../ts-node/dist/bin-script.js" "$@" -else - exec node "$basedir/../ts-node/dist/bin-script.js" "$@" -fi diff --git a/node_modules/.bin/ts-node-script.cmd b/node_modules/.bin/ts-node-script.cmd deleted file mode 100644 index 146251b..0000000 --- a/node_modules/.bin/ts-node-script.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ts-node\dist\bin-script.js" %* diff --git a/node_modules/.bin/ts-node-script.ps1 b/node_modules/.bin/ts-node-script.ps1 deleted file mode 100644 index 3061e81..0000000 --- a/node_modules/.bin/ts-node-script.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../ts-node/dist/bin-script.js" $args - } else { - & "$basedir/node$exe" "$basedir/../ts-node/dist/bin-script.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../ts-node/dist/bin-script.js" $args - } else { - & "node$exe" "$basedir/../ts-node/dist/bin-script.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/ts-node-transpile-only b/node_modules/.bin/ts-node-transpile-only deleted file mode 100644 index d3d4c0c..0000000 --- a/node_modules/.bin/ts-node-transpile-only +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../ts-node/dist/bin-transpile.js" "$@" -else - exec node "$basedir/../ts-node/dist/bin-transpile.js" "$@" -fi diff --git a/node_modules/.bin/ts-node-transpile-only.cmd b/node_modules/.bin/ts-node-transpile-only.cmd deleted file mode 100644 index 60b2af3..0000000 --- a/node_modules/.bin/ts-node-transpile-only.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ts-node\dist\bin-transpile.js" %* diff --git a/node_modules/.bin/ts-node-transpile-only.ps1 b/node_modules/.bin/ts-node-transpile-only.ps1 deleted file mode 100644 index 9503db4..0000000 --- a/node_modules/.bin/ts-node-transpile-only.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../ts-node/dist/bin-transpile.js" $args - } else { - & "$basedir/node$exe" "$basedir/../ts-node/dist/bin-transpile.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../ts-node/dist/bin-transpile.js" $args - } else { - & "node$exe" "$basedir/../ts-node/dist/bin-transpile.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/ts-node.cmd b/node_modules/.bin/ts-node.cmd deleted file mode 100644 index a2a9c92..0000000 --- a/node_modules/.bin/ts-node.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ts-node\dist\bin.js" %* diff --git a/node_modules/.bin/ts-node.ps1 b/node_modules/.bin/ts-node.ps1 deleted file mode 100644 index 90517a4..0000000 --- a/node_modules/.bin/ts-node.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../ts-node/dist/bin.js" $args - } else { - & "$basedir/node$exe" "$basedir/../ts-node/dist/bin.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../ts-node/dist/bin.js" $args - } else { - & "node$exe" "$basedir/../ts-node/dist/bin.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/ts-script b/node_modules/.bin/ts-script deleted file mode 100644 index 8f65f36..0000000 --- a/node_modules/.bin/ts-script +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../ts-node/dist/bin-script-deprecated.js" "$@" -else - exec node "$basedir/../ts-node/dist/bin-script-deprecated.js" "$@" -fi diff --git a/node_modules/.bin/ts-script.cmd b/node_modules/.bin/ts-script.cmd deleted file mode 100644 index e3b0e81..0000000 --- a/node_modules/.bin/ts-script.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ts-node\dist\bin-script-deprecated.js" %* diff --git a/node_modules/.bin/ts-script.ps1 b/node_modules/.bin/ts-script.ps1 deleted file mode 100644 index 1b348af..0000000 --- a/node_modules/.bin/ts-script.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../ts-node/dist/bin-script-deprecated.js" $args - } else { - & "$basedir/node$exe" "$basedir/../ts-node/dist/bin-script-deprecated.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../ts-node/dist/bin-script-deprecated.js" $args - } else { - & "node$exe" "$basedir/../ts-node/dist/bin-script-deprecated.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/tsc b/node_modules/.bin/tsc deleted file mode 100644 index c4864b9..0000000 --- a/node_modules/.bin/tsc +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@" -else - exec node "$basedir/../typescript/bin/tsc" "$@" -fi diff --git a/node_modules/.bin/tsc.cmd b/node_modules/.bin/tsc.cmd deleted file mode 100644 index 40bf128..0000000 --- a/node_modules/.bin/tsc.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\typescript\bin\tsc" %* diff --git a/node_modules/.bin/tsc.ps1 b/node_modules/.bin/tsc.ps1 deleted file mode 100644 index 112413b..0000000 --- a/node_modules/.bin/tsc.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args - } else { - & "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../typescript/bin/tsc" $args - } else { - & "node$exe" "$basedir/../typescript/bin/tsc" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/tsserver b/node_modules/.bin/tsserver deleted file mode 100644 index 6c19ce3..0000000 --- a/node_modules/.bin/tsserver +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@" -else - exec node "$basedir/../typescript/bin/tsserver" "$@" -fi diff --git a/node_modules/.bin/tsserver.cmd b/node_modules/.bin/tsserver.cmd deleted file mode 100644 index 57f851f..0000000 --- a/node_modules/.bin/tsserver.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\typescript\bin\tsserver" %* diff --git a/node_modules/.bin/tsserver.ps1 b/node_modules/.bin/tsserver.ps1 deleted file mode 100644 index 249f417..0000000 --- a/node_modules/.bin/tsserver.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args - } else { - & "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../typescript/bin/tsserver" $args - } else { - & "node$exe" "$basedir/../typescript/bin/tsserver" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json deleted file mode 100644 index 24243ee..0000000 --- a/node_modules/.package-lock.json +++ /dev/null @@ -1,2685 +0,0 @@ -{ - "name": "verinode-backend", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "node_modules/@bcoe/v8-coverage": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz", - "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@grpc/grpc-js": { - "version": "1.14.4", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.14.4.tgz", - "integrity": "sha512-k9Dj3DV/itK9D06Y8f190Qgop7/Ui+D0njFV3LHMPwPT75DpXLQohE9Wmz0QElrJnzsjB7KPWiKJbOl7IPDArQ==", - "license": "Apache-2.0", - "dependencies": { - "@grpc/proto-loader": "^0.8.0", - "@js-sdsl/ordered-map": "^4.4.2" - }, - "engines": { - "node": ">=12.10.0" - } - }, - "node_modules/@grpc/proto-loader": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.8.1.tgz", - "integrity": "sha512-wtF6h+DY6M3YaDBPAmvuuA6jV8Sif9MjtOI5euKFWRgCDl5PeDpPsHR9u2l6St5ceY8AZgoNDww5+HvEsXFsGg==", - "license": "Apache-2.0", - "dependencies": { - "lodash.camelcase": "^4.3.0", - "long": "^5.0.0", - "protobufjs": "^7.5.5", - "yargs": "^17.7.2" - }, - "bin": { - "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.6.tgz", - "integrity": "sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "node_modules/@js-sdsl/ordered-map": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", - "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/js-sdsl" - } - }, - "node_modules/@noble/curves": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-2.2.0.tgz", - "integrity": "sha512-T/BoHgFXirb0ENSPBquzX0rcjXeM6Lo892a2jlYJkqk83LqZx0l1Of7DzlKJ6jkpvMrkHSnAcgb5JegL8SeIkQ==", - "license": "MIT", - "dependencies": { - "@noble/hashes": "2.2.0" - }, - "engines": { - "node": ">= 20.19.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@noble/ed25519": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-3.1.0.tgz", - "integrity": "sha512-pfcObRY3CtvwfaG9Mt5XqZdKmAQppl37tHUeuBhDUbiwJBCVY4/A4lbMvb1xKhMDx96AqAqZpMWuBX1HulhX4g==", - "license": "MIT", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@noble/hashes": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.2.0.tgz", - "integrity": "sha512-IYqDGiTXab6FniAgnSdZwgWbomxpy9FtYvLKs7wCUs2a8RkITG+DFGO1DM9cr+E3/RgADRpFjrKVaJ1z6sjtEg==", - "license": "MIT", - "engines": { - "node": ">= 20.19.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@opentelemetry/api": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.1.tgz", - "integrity": "sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q==", - "license": "Apache-2.0", - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/@opentelemetry/api-logs": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.219.0.tgz", - "integrity": "sha512-FFx7YnaYJlIjqWW/AG/yAZ0L/NEY724PipXXXQLdtZPbLwBGbUMTGL1i/esI56TWfTUXxhLfpgrnWJCG8aUJyg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/api": "^1.3.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/@opentelemetry/configuration": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/configuration/-/configuration-0.219.0.tgz", - "integrity": "sha512-wXZUYv4ngu43nA4WEhuXNacm46LW+17LRM8nKyIhBzroRA24PBYjMnakwzR/w777nFUB5xlgsYTTeuXxumZM1Q==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "yaml": "^2.0.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.9.0" - } - }, - "node_modules/@opentelemetry/context-async-hooks": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-2.8.0.tgz", - "integrity": "sha512-/3FIraneMcng67SUJCxvyInk/oxzwsxyadufk0wwfOBLf5wqtAGX4MoQASwSbndBPeARzBryUM9Azr5kHIdWLw==", - "license": "Apache-2.0", - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "node_modules/@opentelemetry/core": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.8.0.tgz", - "integrity": "sha512-hd1Lfh8p545nNz+jq1Ejfz+Mn1hyLuxYn1YzTfFNrxr8urEWMNQLPf1Th8kjOH+HxwawCrtgBp8JpBUR4ZSgww==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/semantic-conventions": "^1.29.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "node_modules/@opentelemetry/exporter-logs-otlp-grpc": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-logs-otlp-grpc/-/exporter-logs-otlp-grpc-0.219.0.tgz", - "integrity": "sha512-7SvzDCIclHWAcCwZ1MTOLcwn4BVNPGI3QxS/DJraPNe1TTL+4TvUBq5zeQV8tsnYvtDN7wKW2qocVmaCP2l7sQ==", - "license": "Apache-2.0", - "dependencies": { - "@grpc/grpc-js": "^1.14.3", - "@opentelemetry/core": "2.8.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.219.0", - "@opentelemetry/otlp-transformer": "0.219.0", - "@opentelemetry/sdk-logs": "0.219.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/exporter-logs-otlp-http": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-logs-otlp-http/-/exporter-logs-otlp-http-0.219.0.tgz", - "integrity": "sha512-mhl2HL6GmZI8b8PwPfqMws/5ovJfbRTxwc9Y5agVVHiQ+e5SL1btsFr/kJDgt7YCexDtsUn5HAreHQO9szFS0A==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/api-logs": "0.219.0", - "@opentelemetry/core": "2.8.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-transformer": "0.219.0", - "@opentelemetry/sdk-logs": "0.219.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/exporter-logs-otlp-proto": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-logs-otlp-proto/-/exporter-logs-otlp-proto-0.219.0.tgz", - "integrity": "sha512-Ayw4Gf71PS9jhBVaYywa4WsajnqfDehMkTdVH3TSAVHqPcsAv/AhH/wTNRYNt99szeYr6Gbd/D6RjZD77wAxHg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/api-logs": "0.219.0", - "@opentelemetry/core": "2.8.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-transformer": "0.219.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-logs": "0.219.0", - "@opentelemetry/sdk-trace-base": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/exporter-metrics-otlp-grpc": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-metrics-otlp-grpc/-/exporter-metrics-otlp-grpc-0.219.0.tgz", - "integrity": "sha512-6LaaSrPxK5L55bXevWajvOMxGOpNm0n12tG53TeZaUeNzXwLPg6d2KCC1zAlGsojan+xRG71mA4Qqs9K2VVrKQ==", - "license": "Apache-2.0", - "dependencies": { - "@grpc/grpc-js": "^1.14.3", - "@opentelemetry/core": "2.8.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.219.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.219.0", - "@opentelemetry/otlp-transformer": "0.219.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-metrics": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/exporter-metrics-otlp-http": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-metrics-otlp-http/-/exporter-metrics-otlp-http-0.219.0.tgz", - "integrity": "sha512-6CaDRbMVHZSDWzNXwrR8y/H4B/Z1eMNnkHiPQlTx3Ojz2OHY4X/aff/UC4P/3pHUQSuTfi3oh2UsPPZppw+Vrg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-transformer": "0.219.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-metrics": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/exporter-metrics-otlp-proto": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-metrics-otlp-proto/-/exporter-metrics-otlp-proto-0.219.0.tgz", - "integrity": "sha512-DUS7XyIiEnoeccQUvuKy0G2/YqeKhpN8FVIrGbrLNIVMj10yeIFLRzRv0tibCI2kXXvlTTABVexGAk78wHk2ug==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.219.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-transformer": "0.219.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-metrics": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/exporter-prometheus": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-prometheus/-/exporter-prometheus-0.219.0.tgz", - "integrity": "sha512-TxOnJ85eWJY5JyOJsNMXiRTYlkDcOv0u3KbXEzWCc+tUS9sjL/BC6BcdxZ0B9r2OFVqsrZFXUzSD2sZUy42Ucw==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-metrics": "2.8.0", - "@opentelemetry/semantic-conventions": "^1.29.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/exporter-trace-otlp-grpc": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-grpc/-/exporter-trace-otlp-grpc-0.219.0.tgz", - "integrity": "sha512-BkDNv1UD6BscW19MxbAxVmSYSSFuyeqR6buV2/HTYqA7GrR0EbTFzqG6h86T3PtXmpdbsWjMGLDdjG2rikG27Q==", - "license": "Apache-2.0", - "dependencies": { - "@grpc/grpc-js": "^1.14.3", - "@opentelemetry/core": "2.8.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.219.0", - "@opentelemetry/otlp-transformer": "0.219.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-trace-base": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/exporter-trace-otlp-http": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.219.0.tgz", - "integrity": "sha512-9t6SvBXXBEjOBcIzgozvBbd3jWrv3Gt3ngGhl1fhdZ/zRc7oZDVOFEqbi2zlBpW9BXhgDMKv422J0DL/3iQWfw==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-transformer": "0.219.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-trace-base": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/exporter-trace-otlp-proto": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-proto/-/exporter-trace-otlp-proto-0.219.0.tgz", - "integrity": "sha512-lF/LUBfhOFmxJa+SQsLN7ziV4MHa2pyKgOM6JNehSOfU+npjM4gwm9oIKEJrzrWcexMcqydiyoFy0XCb1Ql3wQ==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-transformer": "0.219.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-trace-base": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/exporter-zipkin": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-zipkin/-/exporter-zipkin-2.8.0.tgz", - "integrity": "sha512-Mj84UkEa17BK2o903VTXW3wM8CrSZexGs4tRGVZVIMM9ni1T6TuGx5IrRfoWKAbshx42D5/kc7YV+axypLPYyA==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-trace-base": "2.8.0", - "@opentelemetry/semantic-conventions": "^1.29.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "node_modules/@opentelemetry/instrumentation": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.219.0.tgz", - "integrity": "sha512-X5t7I8GyIO9rmGHwoedZLREpQqrF1WW2nxzNNym6HOKpFiE+rvqV3ngC0xcZVO2YwIGf3KKmRdWrYwdwz3H9RQ==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/api-logs": "0.219.0", - "import-in-the-middle": "^3.0.0", - "require-in-the-middle": "^8.0.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/instrumentation-express": { - "version": "0.67.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-express/-/instrumentation-express-0.67.0.tgz", - "integrity": "sha512-1WTWX2YNZIV+jPmEqdf/Vd1gHMT92TKA/0pf/iIItWhV6+RhzhnUUW4kSWQn8L3qVcgWEzQ860/ZOwaIwayi8A==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "^2.0.0", - "@opentelemetry/instrumentation": "^0.219.0", - "@opentelemetry/semantic-conventions": "^1.27.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/instrumentation-http": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-http/-/instrumentation-http-0.219.0.tgz", - "integrity": "sha512-nNt1fqpyah/OKjNHdEOu8xLwISppRU2qJuF8aR+fCcftVwdFkPgtworBLA+TI1HU2iF508jcQBF2gerWczJAXg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/instrumentation": "0.219.0", - "@opentelemetry/semantic-conventions": "^1.29.0", - "forwarded-parse": "2.1.2" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/otlp-exporter-base": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.219.0.tgz", - "integrity": "sha512-zvIxQX/AZUVKDU+hCuYx+7UkiP7GRdnk1ZbFQRYzHvYp47cAWR4j3IhoPhV9KaeXEv2xdGq3IA6PnpzDmLcmSA==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/otlp-transformer": "0.219.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/otlp-grpc-exporter-base": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-grpc-exporter-base/-/otlp-grpc-exporter-base-0.219.0.tgz", - "integrity": "sha512-iIk/s8QQu39zpTrRRmsW/Eg3SE2+Hg8tLWepr2FLRgmwUpNd0IpCTLJEHJ77hpt4hgIS8MAh44UYI4xQPZwWlw==", - "license": "Apache-2.0", - "dependencies": { - "@grpc/grpc-js": "^1.14.3", - "@opentelemetry/core": "2.8.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-transformer": "0.219.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/otlp-transformer": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.219.0.tgz", - "integrity": "sha512-aaYKAyXhw9VchKZVGOopD3Gw/kPsyrX2c6IQ0AW32mTjqmZOh5Y6Gf5OYqTNqVktAeBjmFinhyFaCwW6GYK9YQ==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/api-logs": "0.219.0", - "@opentelemetry/core": "2.8.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-logs": "0.219.0", - "@opentelemetry/sdk-metrics": "2.8.0", - "@opentelemetry/sdk-trace-base": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "node_modules/@opentelemetry/propagator-b3": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-2.8.0.tgz", - "integrity": "sha512-SazlvuSKi5533rPHTW2TwBwdMakhjZST4SYs0YauuvfGDkT13KbG1gJS75hV0uWVeevhtVP9sAIlaZLTHdSbMg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "node_modules/@opentelemetry/propagator-jaeger": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-2.8.0.tgz", - "integrity": "sha512-Xnz9zZvvQzUw+9DrOn0MomR7BxFCkA2pcfXBQuHC28ndJpSbjLs7knzYb05kw5SyCjSsEWombkZMgGcJSk8JVg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "node_modules/@opentelemetry/resources": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.8.0.tgz", - "integrity": "sha512-qmXQ27ilDbUK/vGMqwL8D4/rhn76C+sherM4wTbjlfknR8Nvfc/hCxjRJPhkzZzUsPiNg16SA31NxMabwttRjg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/semantic-conventions": "^1.29.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.10.0" - } - }, - "node_modules/@opentelemetry/sdk-logs": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.219.0.tgz", - "integrity": "sha512-s6lTKRakaPClvKoWHRChxnXjDMkM/TQ30ff78jN6EBGf7MI7VzANE5PU3f4z9qDUudWjvZjOLHG0rBnBKYvoXA==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/api-logs": "0.219.0", - "@opentelemetry/core": "2.8.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/semantic-conventions": "^1.29.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.4.0 <1.10.0" - } - }, - "node_modules/@opentelemetry/sdk-metrics": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-2.8.0.tgz", - "integrity": "sha512-UDBGaj6W0Rgy5rTTaoxs8gVGF/aGkAKyjurJv7se6wjRxJu7FoquTLT/vt54DZfo4crbprYfhX/SOK9+BPw1qg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/resources": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.9.0 <1.10.0" - } - }, - "node_modules/@opentelemetry/sdk-node": { - "version": "0.219.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-node/-/sdk-node-0.219.0.tgz", - "integrity": "sha512-NWLpWLEb8gV3+JBHYoIrktbM385wyHpRJoh3J/4Q52d4PR+AlPMNGJT3DzBUrDSUEVbKAXoHR+EDAPxtiNcj8g==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/api-logs": "0.219.0", - "@opentelemetry/configuration": "0.219.0", - "@opentelemetry/context-async-hooks": "2.8.0", - "@opentelemetry/core": "2.8.0", - "@opentelemetry/exporter-logs-otlp-grpc": "0.219.0", - "@opentelemetry/exporter-logs-otlp-http": "0.219.0", - "@opentelemetry/exporter-logs-otlp-proto": "0.219.0", - "@opentelemetry/exporter-metrics-otlp-grpc": "0.219.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.219.0", - "@opentelemetry/exporter-metrics-otlp-proto": "0.219.0", - "@opentelemetry/exporter-prometheus": "0.219.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.219.0", - "@opentelemetry/exporter-trace-otlp-http": "0.219.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.219.0", - "@opentelemetry/exporter-zipkin": "2.8.0", - "@opentelemetry/instrumentation": "0.219.0", - "@opentelemetry/otlp-exporter-base": "0.219.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.219.0", - "@opentelemetry/propagator-b3": "2.8.0", - "@opentelemetry/propagator-jaeger": "2.8.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/sdk-logs": "0.219.0", - "@opentelemetry/sdk-metrics": "2.8.0", - "@opentelemetry/sdk-trace-base": "2.8.0", - "@opentelemetry/sdk-trace-node": "2.8.0", - "@opentelemetry/semantic-conventions": "^1.29.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.10.0" - } - }, - "node_modules/@opentelemetry/sdk-trace-base": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-2.8.0.tgz", - "integrity": "sha512-mhU4jp+vW0mGbFRd+GeXHvmfA4aDqWjBjLC3pE5XMpLs0IE2ryYb019Ts2AQrOq67gaTF25D91+fgvEHDZEnuQ==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/core": "2.8.0", - "@opentelemetry/resources": "2.8.0", - "@opentelemetry/semantic-conventions": "^1.29.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.10.0" - } - }, - "node_modules/@opentelemetry/sdk-trace-node": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-2.8.0.tgz", - "integrity": "sha512-nZt9OGufioAc3AfoLTqA9bsAeaMJAictYDdI2VcNQ+PmT+3rfKjAZDZvgPfd8VPX0O5Bw1hdQF6kDK8VSpZiWg==", - "license": "Apache-2.0", - "dependencies": { - "@opentelemetry/context-async-hooks": "2.8.0", - "@opentelemetry/core": "2.8.0", - "@opentelemetry/sdk-trace-base": "2.8.0" - }, - "engines": { - "node": "^18.19.0 || >=20.6.0" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.10.0" - } - }, - "node_modules/@opentelemetry/semantic-conventions": { - "version": "1.41.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.41.1.tgz", - "integrity": "sha512-/UhIkaZgPutTFmQ7RnIJGgDXZmtEJ7Dvi86xNTFWcnRxVRNk/aotsqDJYeEvDP+FSMB2SdW+pQzNMcWP0rwuNA==", - "license": "Apache-2.0", - "engines": { - "node": ">=14" - } - }, - "node_modules/@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", - "license": "BSD-3-Clause" - }, - "node_modules/@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", - "license": "BSD-3-Clause" - }, - "node_modules/@protobufjs/codegen": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz", - "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==", - "license": "BSD-3-Clause" - }, - "node_modules/@protobufjs/eventemitter": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz", - "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==", - "license": "BSD-3-Clause" - }, - "node_modules/@protobufjs/fetch": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz", - "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==", - "license": "BSD-3-Clause", - "dependencies": { - "@protobufjs/aspromise": "^1.1.1" - } - }, - "node_modules/@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", - "license": "BSD-3-Clause" - }, - "node_modules/@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", - "license": "BSD-3-Clause" - }, - "node_modules/@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", - "license": "BSD-3-Clause" - }, - "node_modules/@protobufjs/utf8": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.1.tgz", - "integrity": "sha512-oOAWABowe8EAbMyWKM0tYDKi8Yaox52D+HWZhAIJqQXbqe0xI/GV7FhLWqlEKreMkfDjshR5FKgi3mnle0h6Eg==", - "license": "BSD-3-Clause" - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz", - "integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", - "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "22.19.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.21.tgz", - "integrity": "sha512-VMeFBSCKQKmm2swI2kW51SFusDqekC6q9trBCvJ/JliDchFSuoYYKN7yVNjPthP1HKZcx3U1gI/wTcEBjEFKTA==", - "license": "MIT", - "dependencies": { - "undici-types": "~6.21.0" - } - }, - "node_modules/@types/pg": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.20.0.tgz", - "integrity": "sha512-bEPFOaMAHTEP1EzpvHTbmwR8UsFyHSKsRisLIHVMXnpNefSbGA1bD6CVy+qKjGSqmZqNqBDV2azOBo8TgkcVow==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "pg-protocol": "*", - "pg-types": "^2.2.0" - } - }, - "node_modules/accepts": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", - "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", - "license": "MIT", - "dependencies": { - "mime-types": "^3.0.0", - "negotiator": "^1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/acorn": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", - "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-import-attributes": { - "version": "1.9.5", - "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", - "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", - "license": "MIT", - "peerDependencies": { - "acorn": "^8" - } - }, - "node_modules/acorn-walk": { - "version": "8.3.5", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.5.tgz", - "integrity": "sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==", - "dev": true, - "license": "MIT", - "dependencies": { - "acorn": "^8.11.0" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true, - "license": "MIT" - }, - "node_modules/balanced-match": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", - "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "18 || 20 || >=22" - } - }, - "node_modules/body-parser": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", - "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", - "license": "MIT", - "dependencies": { - "bytes": "^3.1.2", - "content-type": "^1.0.5", - "debug": "^4.4.3", - "http-errors": "^2.0.0", - "iconv-lite": "^0.7.0", - "on-finished": "^2.4.1", - "qs": "^6.14.1", - "raw-body": "^3.0.1", - "type-is": "^2.0.1" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/brace-expansion": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", - "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^4.0.2" - }, - "engines": { - "node": "18 || 20 || >=22" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/c8": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/c8/-/c8-11.0.0.tgz", - "integrity": "sha512-e/uRViGHSVIJv7zsaDKM7VRn2390TgHXqUSvYwPHBQaU6L7E9L0n9JbdkwdYPvshDT0KymBmmlwSpms3yBaMNg==", - "dev": true, - "license": "ISC", - "dependencies": { - "@bcoe/v8-coverage": "^1.0.1", - "@istanbuljs/schema": "^0.1.3", - "find-up": "^5.0.0", - "foreground-child": "^3.1.1", - "istanbul-lib-coverage": "^3.2.0", - "istanbul-lib-report": "^3.0.1", - "istanbul-reports": "^3.1.6", - "test-exclude": "^8.0.0", - "v8-to-istanbul": "^9.0.0", - "yargs": "^17.7.2", - "yargs-parser": "^21.1.1" - }, - "bin": { - "c8": "bin/c8.js" - }, - "engines": { - "node": "20 || >=22" - }, - "peerDependencies": { - "monocart-coverage-reports": "^2" - }, - "peerDependenciesMeta": { - "monocart-coverage-reports": { - "optional": true - } - } - }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/call-bound": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/cjs-module-lexer": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-2.2.0.tgz", - "integrity": "sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ==", - "license": "MIT" - }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "license": "MIT" - }, - "node_modules/content-disposition": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", - "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "license": "MIT" - }, - "node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", - "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", - "license": "MIT", - "engines": { - "node": ">=6.6.0" - } - }, - "node_modules/cors": { - "version": "2.8.6", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", - "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", - "license": "MIT", - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/diff": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz", - "integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/dotenv": { - "version": "17.2.4", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.4.tgz", - "integrity": "sha512-mudtfb4zRB4bVvdj0xRo+e6duH1csJRM8IukBqfTRvHotn9+LBXB8ynAidP9zHqoRC/fsllXgk4kCKlR21fIhw==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } - }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", - "license": "MIT" - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/encodeurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", - "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-object-atoms": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", - "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", - "license": "MIT" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", - "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", - "license": "MIT", - "dependencies": { - "accepts": "^2.0.0", - "body-parser": "^2.2.1", - "content-disposition": "^1.0.0", - "content-type": "^1.0.5", - "cookie": "^0.7.1", - "cookie-signature": "^1.2.1", - "debug": "^4.4.0", - "depd": "^2.0.0", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "etag": "^1.8.1", - "finalhandler": "^2.1.0", - "fresh": "^2.0.0", - "http-errors": "^2.0.0", - "merge-descriptors": "^2.0.0", - "mime-types": "^3.0.0", - "on-finished": "^2.4.1", - "once": "^1.4.0", - "parseurl": "^1.3.3", - "proxy-addr": "^2.0.7", - "qs": "^6.14.0", - "range-parser": "^1.2.1", - "router": "^2.2.0", - "send": "^1.1.0", - "serve-static": "^2.2.0", - "statuses": "^2.0.1", - "type-is": "^2.0.1", - "vary": "^1.1.2" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/finalhandler": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", - "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", - "license": "MIT", - "dependencies": { - "debug": "^4.4.0", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "on-finished": "^2.4.1", - "parseurl": "^1.3.3", - "statuses": "^2.0.1" - }, - "engines": { - "node": ">= 18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/foreground-child": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", - "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", - "dev": true, - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.6", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/forwarded-parse": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/forwarded-parse/-/forwarded-parse-2.1.2.tgz", - "integrity": "sha512-alTFZZQDKMporBH77856pXgzhEzaUVmLCDk+egLgIgHst3Tpndzz8MnKe+GzRJRfvVdn69HhpW7cmXzvtLvJAw==", - "license": "MIT" - }, - "node_modules/fresh": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", - "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "license": "MIT", - "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/glob": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", - "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "minimatch": "^10.2.2", - "minipass": "^7.1.3", - "path-scurry": "^2.0.2" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true, - "license": "MIT" - }, - "node_modules/http-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", - "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", - "license": "MIT", - "dependencies": { - "depd": "~2.0.0", - "inherits": "~2.0.4", - "setprototypeof": "~1.2.0", - "statuses": "~2.0.2", - "toidentifier": "~1.0.1" - }, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/iconv-lite": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", - "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/import-in-the-middle": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-3.1.0.tgz", - "integrity": "sha512-c0AeAV8VcwZzfYE7euTZY3H+VXUPMVugiovdosq80lqEXJmOekg3zGUAYg6KImHMaMuBoTUfTv7xNpUFdy0hJA==", - "license": "Apache-2.0", - "dependencies": { - "acorn": "^8.15.0", - "acorn-import-attributes": "^1.9.5", - "cjs-module-lexer": "^2.2.0", - "module-details-from-path": "^1.0.4" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-promise": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", - "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", - "license": "MIT" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", - "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", - "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^4.0.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-reports": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz", - "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash.camelcase": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", - "license": "MIT" - }, - "node_modules/long": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", - "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", - "license": "Apache-2.0" - }, - "node_modules/lru-cache": { - "version": "11.5.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", - "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", - "dev": true, - "license": "BlueOak-1.0.0", - "engines": { - "node": "20 || >=22" - } - }, - "node_modules/make-dir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", - "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true, - "license": "ISC" - }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/media-typer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", - "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/merge-descriptors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", - "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/mime-db": { - "version": "1.54.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", - "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", - "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", - "license": "MIT", - "dependencies": { - "mime-db": "^1.54.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/minimatch": { - "version": "10.2.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", - "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "brace-expansion": "^5.0.5" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minipass": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", - "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", - "dev": true, - "license": "BlueOak-1.0.0", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/module-details-from-path": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.4.tgz", - "integrity": "sha512-EGWKgxALGMgzvxYF1UyGTy0HXX/2vHLkw6+NvDKW2jypWbHpjQuj4UMcqQWXHERJhVGKikolT06G3bcKe4fi7w==", - "license": "MIT" - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/negotiator": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", - "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.13.4", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", - "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "license": "MIT", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", - "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/path-to-regexp": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", - "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/pg": { - "version": "8.22.0", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.22.0.tgz", - "integrity": "sha512-8wih1vVIBMxoUM2oB4soJsD9tDnDpLv4OXBJ+EJzFsvycD+lfyIreC2gGHq78f8jbLLt+bvlPTFdFZfJkOuzAA==", - "license": "MIT", - "dependencies": { - "pg-connection-string": "^2.14.0", - "pg-pool": "^3.14.0", - "pg-protocol": "^1.15.0", - "pg-types": "2.2.0", - "pgpass": "1.0.5" - }, - "engines": { - "node": ">= 16.0.0" - }, - "optionalDependencies": { - "pg-cloudflare": "^1.4.0" - }, - "peerDependencies": { - "pg-native": ">=3.0.1" - }, - "peerDependenciesMeta": { - "pg-native": { - "optional": true - } - } - }, - "node_modules/pg-cloudflare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.4.0.tgz", - "integrity": "sha512-Vo7z/6rrQYxpNRylp4Tlob2elzbh+N/MOQbxFVWCxS7oEx6jF53GTJFxK2WWpKuBRkmiin4Mt+xofFDjx09R0A==", - "license": "MIT", - "optional": true - }, - "node_modules/pg-connection-string": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.14.0.tgz", - "integrity": "sha512-XwWDGcLRGCXAR8F/AM5bG7Q+A3Wm2s6QeEjlOKZLlH3UYcguiqCWKyWXVag5TLTIjR7oOJUY8kcADaZgWPyLeg==", - "license": "MIT" - }, - "node_modules/pg-int8": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", - "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", - "license": "ISC", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/pg-pool": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.14.0.tgz", - "integrity": "sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw==", - "license": "MIT", - "peerDependencies": { - "pg": ">=8.0" - } - }, - "node_modules/pg-protocol": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.15.0.tgz", - "integrity": "sha512-cq9sECI5s0+uPUXjbz8ioyPJni6RzsRib0US67i5IoTZKw8fNeYlVE7u8F4dG7vEJJtc5wdD1K189lCCUwqWTQ==", - "license": "MIT" - }, - "node_modules/pg-types": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", - "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", - "license": "MIT", - "dependencies": { - "pg-int8": "1.0.1", - "postgres-array": "~2.0.0", - "postgres-bytea": "~1.0.0", - "postgres-date": "~1.0.4", - "postgres-interval": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pgpass": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", - "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", - "license": "MIT", - "dependencies": { - "split2": "^4.1.0" - } - }, - "node_modules/postgres-array": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", - "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/postgres-bytea": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz", - "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postgres-date": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", - "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postgres-interval": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", - "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", - "license": "MIT", - "dependencies": { - "xtend": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/protobufjs": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.4.tgz", - "integrity": "sha512-RJJPTTpvFfHcWLkIa2JFWK4XvtSzS0yEWDmunqHXli1h3JlkbcQZXDZdcWxv+JK3Xsl5/UFDPZ0iGm7DAengYw==", - "hasInstallScript": true, - "license": "BSD-3-Clause", - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.5", - "@protobufjs/eventemitter": "^1.1.1", - "@protobufjs/fetch": "^1.1.1", - "@protobufjs/float": "^1.0.2", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.1", - "@types/node": ">=13.7.0", - "long": "^5.3.2" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "license": "MIT", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/qs": { - "version": "6.14.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", - "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.1.0" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", - "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", - "license": "MIT", - "dependencies": { - "bytes": "~3.1.2", - "http-errors": "~2.0.1", - "iconv-lite": "~0.7.0", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-in-the-middle": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-8.0.1.tgz", - "integrity": "sha512-QT7FVMXfWOYFbeRBF6nu+I6tr2Tf3u0q8RIEjNob/heKY/nh7drD/k7eeMFmSQgnTtCzLDcCu/XEnpW2wk4xCQ==", - "license": "MIT", - "dependencies": { - "debug": "^4.3.5", - "module-details-from-path": "^1.0.3" - }, - "engines": { - "node": ">=9.3.0 || >=8.10.0 <9.0.0" - } - }, - "node_modules/router": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", - "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", - "license": "MIT", - "dependencies": { - "debug": "^4.4.0", - "depd": "^2.0.0", - "is-promise": "^4.0.0", - "parseurl": "^1.3.3", - "path-to-regexp": "^8.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "license": "MIT" - }, - "node_modules/semver": { - "version": "7.8.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", - "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/send": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", - "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", - "license": "MIT", - "dependencies": { - "debug": "^4.4.3", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "etag": "^1.8.1", - "fresh": "^2.0.0", - "http-errors": "^2.0.1", - "mime-types": "^3.0.2", - "ms": "^2.1.3", - "on-finished": "^2.4.1", - "range-parser": "^1.2.1", - "statuses": "^2.0.2" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/serve-static": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", - "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", - "license": "MIT", - "dependencies": { - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "parseurl": "^1.3.3", - "send": "^1.2.0" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "license": "ISC" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/side-channel": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", - "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3", - "side-channel-list": "^1.0.0", - "side-channel-map": "^1.0.1", - "side-channel-weakmap": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-list": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", - "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", - "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-weakmap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", - "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3", - "side-channel-map": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/split2": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", - "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", - "license": "ISC", - "engines": { - "node": ">= 10.x" - } - }, - "node_modules/statuses": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", - "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/test-exclude": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-8.0.0.tgz", - "integrity": "sha512-ZOffsNrXYggvU1mDGHk54I96r26P8SyMjO5slMKSc7+IWmtB/MQKnEC2fP51imB3/pT6YK5cT5E8f+Dd9KdyOQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^13.0.6", - "minimatch": "^10.2.2" - }, - "engines": { - "node": "20 || >=22" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "license": "MIT", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/type-is": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", - "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", - "license": "MIT", - "dependencies": { - "content-type": "^1.0.5", - "media-typer": "^1.1.0", - "mime-types": "^3.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", - "license": "MIT" - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true, - "license": "MIT" - }, - "node_modules/v8-to-istanbul": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", - "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", - "dev": true, - "license": "ISC", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^2.0.0" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/v8-to-istanbul/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "license": "ISC" - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "license": "MIT", - "engines": { - "node": ">=0.4" - } - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/yaml": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz", - "integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==", - "license": "ISC", - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14.6" - }, - "funding": { - "url": "https://github.com/sponsors/eemeli" - } - }, - "node_modules/yargs": { - "version": "17.7.3", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.3.tgz", - "integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==", - "license": "MIT", - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/node_modules/@cspotcode/source-map-support/LICENSE.md b/node_modules/@cspotcode/source-map-support/LICENSE.md deleted file mode 100644 index 6247ca9..0000000 --- a/node_modules/@cspotcode/source-map-support/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Evan Wallace - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@cspotcode/source-map-support/README.md b/node_modules/@cspotcode/source-map-support/README.md deleted file mode 100644 index f739070..0000000 --- a/node_modules/@cspotcode/source-map-support/README.md +++ /dev/null @@ -1,289 +0,0 @@ -# Source Map Support - -[![NPM version](https://img.shields.io/npm/v/@cspotcode/source-map-support.svg?style=flat)](https://npmjs.org/package/@cspotcode/source-map-support) -[![NPM downloads](https://img.shields.io/npm/dm/@cspotcode/source-map-support.svg?style=flat)](https://npmjs.org/package/@cspotcode/source-map-support) -[![Build status](https://img.shields.io/github/workflow/status/cspotcode/node-source-map-support/Continuous%20Integration)](https://github.com/cspotcode/node-source-map-support/actions?query=workflow%3A%22Continuous+Integration%22) - -This module provides source map support for stack traces in node via the [V8 stack trace API](https://github.com/v8/v8/wiki/Stack-Trace-API). It uses the [source-map](https://github.com/mozilla/source-map) module to replace the paths and line numbers of source-mapped files with their original paths and line numbers. The output mimics node's stack trace format with the goal of making every compile-to-JS language more of a first-class citizen. Source maps are completely general (not specific to any one language) so you can use source maps with multiple compile-to-JS languages in the same node process. - -## Installation and Usage - -#### Node support - -``` -$ npm install @cspotcode/source-map-support -``` - -Source maps can be generated using libraries such as [source-map-index-generator](https://github.com/twolfson/source-map-index-generator). Once you have a valid source map, place a source mapping comment somewhere in the file (usually done automatically or with an option by your transpiler): - -``` -//# sourceMappingURL=path/to/source.map -``` - -If multiple sourceMappingURL comments exist in one file, the last sourceMappingURL comment will be -respected (e.g. if a file mentions the comment in code, or went through multiple transpilers). -The path should either be absolute or relative to the compiled file. - -From here you have two options. - -##### CLI Usage - -```bash -node -r @cspotcode/source-map-support/register compiled.js -# Or to enable hookRequire -node -r @cspotcode/source-map-support/register-hook-require compiled.js -``` - -##### Programmatic Usage - -Put the following line at the top of the compiled file. - -```js -require('@cspotcode/source-map-support').install(); -``` - -It is also possible to install the source map support directly by -requiring the `register` module which can be handy with ES6: - -```js -import '@cspotcode/source-map-support/register' - -// Instead of: -import sourceMapSupport from '@cspotcode/source-map-support' -sourceMapSupport.install() -``` -Note: if you're using babel-register, it includes source-map-support already. - -It is also very useful with Mocha: - -``` -$ mocha --require @cspotcode/source-map-support/register tests/ -``` - -#### Browser support - -This library also works in Chrome. While the DevTools console already supports source maps, the V8 engine doesn't and `Error.prototype.stack` will be incorrect without this library. Everything will just work if you deploy your source files using [browserify](http://browserify.org/). Just make sure to pass the `--debug` flag to the browserify command so your source maps are included in the bundled code. - -This library also works if you use another build process or just include the source files directly. In this case, include the file `browser-source-map-support.js` in your page and call `sourceMapSupport.install()`. It contains the whole library already bundled for the browser using browserify. - -```html - - -``` - -This library also works if you use AMD (Asynchronous Module Definition), which is used in tools like [RequireJS](http://requirejs.org/). Just list `browser-source-map-support` as a dependency: - -```html - -``` - -## Options - -This module installs two things: a change to the `stack` property on `Error` objects and a handler for uncaught exceptions that mimics node's default exception handler (the handler can be seen in the demos below). You may want to disable the handler if you have your own uncaught exception handler. This can be done by passing an argument to the installer: - -```js -require('@cspotcode/source-map-support').install({ - handleUncaughtExceptions: false -}); -``` - -This module loads source maps from the filesystem by default. You can provide alternate loading behavior through a callback as shown below. For example, [Meteor](https://github.com/meteor) keeps all source maps cached in memory to avoid disk access. - -```js -require('@cspotcode/source-map-support').install({ - retrieveSourceMap: function(source) { - if (source === 'compiled.js') { - return { - url: 'original.js', - map: fs.readFileSync('compiled.js.map', 'utf8') - }; - } - return null; - } -}); -``` - -The module will by default assume a browser environment if XMLHttpRequest and window are defined. If either of these do not exist it will instead assume a node environment. -In some rare cases, e.g. when running a browser emulation and where both variables are also set, you can explictly specify the environment to be either 'browser' or 'node'. - -```js -require('@cspotcode/source-map-support').install({ - environment: 'node' -}); -``` - -To support files with inline source maps, the `hookRequire` options can be specified, which will monitor all source files for inline source maps. - - -```js -require('@cspotcode/source-map-support').install({ - hookRequire: true -}); -``` - -This monkey patches the `require` module loading chain, so is not enabled by default and is not recommended for any sort of production usage. - -## Demos - -#### Basic Demo - -original.js: - -```js -throw new Error('test'); // This is the original code -``` - -compiled.js: - -```js -require('@cspotcode/source-map-support').install(); - -throw new Error('test'); // This is the compiled code -// The next line defines the sourceMapping. -//# sourceMappingURL=compiled.js.map -``` - -compiled.js.map: - -```json -{ - "version": 3, - "file": "compiled.js", - "sources": ["original.js"], - "names": [], - "mappings": ";;AAAA,MAAM,IAAI" -} -``` - -Run compiled.js using node (notice how the stack trace uses original.js instead of compiled.js): - -``` -$ node compiled.js - -original.js:1 -throw new Error('test'); // This is the original code - ^ -Error: test - at Object. (original.js:1:7) - at Module._compile (module.js:456:26) - at Object.Module._extensions..js (module.js:474:10) - at Module.load (module.js:356:32) - at Function.Module._load (module.js:312:12) - at Function.Module.runMain (module.js:497:10) - at startup (node.js:119:16) - at node.js:901:3 -``` - -#### TypeScript Demo - -demo.ts: - -```typescript -declare function require(name: string); -require('@cspotcode/source-map-support').install(); -class Foo { - constructor() { this.bar(); } - bar() { throw new Error('this is a demo'); } -} -new Foo(); -``` - -Compile and run the file using the TypeScript compiler from the terminal: - -``` -$ npm install source-map-support typescript -$ node_modules/typescript/bin/tsc -sourcemap demo.ts -$ node demo.js - -demo.ts:5 - bar() { throw new Error('this is a demo'); } - ^ -Error: this is a demo - at Foo.bar (demo.ts:5:17) - at new Foo (demo.ts:4:24) - at Object. (demo.ts:7:1) - at Module._compile (module.js:456:26) - at Object.Module._extensions..js (module.js:474:10) - at Module.load (module.js:356:32) - at Function.Module._load (module.js:312:12) - at Function.Module.runMain (module.js:497:10) - at startup (node.js:119:16) - at node.js:901:3 -``` - -There is also the option to use `-r source-map-support/register` with typescript, without the need add the `require('@cspotcode/source-map-support').install()` in the code base: - -``` -$ npm install source-map-support typescript -$ node_modules/typescript/bin/tsc -sourcemap demo.ts -$ node -r source-map-support/register demo.js - -demo.ts:5 - bar() { throw new Error('this is a demo'); } - ^ -Error: this is a demo - at Foo.bar (demo.ts:5:17) - at new Foo (demo.ts:4:24) - at Object. (demo.ts:7:1) - at Module._compile (module.js:456:26) - at Object.Module._extensions..js (module.js:474:10) - at Module.load (module.js:356:32) - at Function.Module._load (module.js:312:12) - at Function.Module.runMain (module.js:497:10) - at startup (node.js:119:16) - at node.js:901:3 -``` - -#### CoffeeScript Demo - -demo.coffee: - -```coffee -require('@cspotcode/source-map-support').install() -foo = -> - bar = -> throw new Error 'this is a demo' - bar() -foo() -``` - -Compile and run the file using the CoffeeScript compiler from the terminal: - -```sh -$ npm install @cspotcode/source-map-support coffeescript -$ node_modules/.bin/coffee --map --compile demo.coffee -$ node demo.js - -demo.coffee:3 - bar = -> throw new Error 'this is a demo' - ^ -Error: this is a demo - at bar (demo.coffee:3:22) - at foo (demo.coffee:4:3) - at Object. (demo.coffee:5:1) - at Object. (demo.coffee:1:1) - at Module._compile (module.js:456:26) - at Object.Module._extensions..js (module.js:474:10) - at Module.load (module.js:356:32) - at Function.Module._load (module.js:312:12) - at Function.Module.runMain (module.js:497:10) - at startup (node.js:119:16) -``` - -## Tests - -This repo contains both automated tests for node and manual tests for the browser. The automated tests can be run using mocha (type `mocha` in the root directory). To run the manual tests: - -* Build the tests using `build.js` -* Launch the HTTP server (`npm run serve-tests`) and visit - * http://127.0.0.1:1336/amd-test - * http://127.0.0.1:1336/browser-test - * http://127.0.0.1:1336/browserify-test - **Currently not working** due to a bug with browserify (see [pull request #66](https://github.com/evanw/node-source-map-support/pull/66) for details). -* For `header-test`, run `server.js` inside that directory and visit http://127.0.0.1:1337/ - -## License - -This code is available under the [MIT license](http://opensource.org/licenses/MIT). diff --git a/node_modules/@cspotcode/source-map-support/browser-source-map-support.js b/node_modules/@cspotcode/source-map-support/browser-source-map-support.js deleted file mode 100644 index 782da50..0000000 --- a/node_modules/@cspotcode/source-map-support/browser-source-map-support.js +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Support for source maps in V8 stack traces - * https://github.com/evanw/node-source-map-support - */ -/* - The buffer module from node.js, for the browser. - - @author Feross Aboukhadijeh - license MIT -*/ -(this.define||function(R,U){this.sourceMapSupport=U()})("browser-source-map-support",function(R){(function e(C,J,A){function p(f,c){if(!J[f]){if(!C[f]){var l="function"==typeof require&&require;if(!c&&l)return l(f,!0);if(t)return t(f,!0);throw Error("Cannot find module '"+f+"'");}l=J[f]={exports:{}};C[f][0].call(l.exports,function(q){var r=C[f][1][q];return p(r?r:q)},l,l.exports,e,C,J,A)}return J[f].exports}for(var t="function"==typeof require&&require,m=0;mm)return-1;if(58>m)return m-48+52;if(91>m)return m-65;if(123>m)return m-97+26}var t="undefined"!==typeof Uint8Array?Uint8Array:Array;e.toByteArray=function(m){function f(d){q[k++]=d}if(0>16);f((u&65280)>>8);f(u&255)}2===l?(u=p(m.charAt(c))<<2|p(m.charAt(c+1))>>4,f(u&255)):1===l&&(u=p(m.charAt(c))<<10|p(m.charAt(c+1))<<4|p(m.charAt(c+2))>>2,f(u>>8&255),f(u&255));return q};e.fromByteArray=function(m){var f=m.length%3,c="",l;var q=0;for(l=m.length-f;q> -18&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>12&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>6&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r&63);c+=r}switch(f){case 1:r=m[m.length-1];c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r<<4&63);c+="==";break;case 2:r=(m[m.length-2]<<8)+ -m[m.length-1],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>10),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>4&63),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r<<2&63),c+="="}return c}})("undefined"===typeof A?this.base64js={}:A)},{}],3:[function(C,J,A){},{}],4:[function(C,J,A){(function(e){var p=Object.prototype.toString,t="function"===typeof e.alloc&&"function"===typeof e.allocUnsafe&&"function"=== -typeof e.from;J.exports=function(m,f,c){if("number"===typeof m)throw new TypeError('"value" argument must not be a number');if("ArrayBuffer"===p.call(m).slice(8,-1)){f>>>=0;var l=m.byteLength-f;if(0>l)throw new RangeError("'offset' is out of bounds");if(void 0===c)c=l;else if(c>>>=0,c>l)throw new RangeError("'length' is out of bounds");return t?e.from(m.slice(f,f+c)):new e(new Uint8Array(m.slice(f,f+c)))}if("string"===typeof m){c=f;if("string"!==typeof c||""===c)c="utf8";if(!e.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding'); -return t?e.from(m,c):new e(m,c)}return t?e.from(m):new e(m)}}).call(this,C("buffer").Buffer)},{buffer:5}],5:[function(C,J,A){function e(a,b,h){if(!(this instanceof e))return new e(a,b,h);var w=typeof a;if("number"===w)var y=0>>0:0;else if("string"===w){if("base64"===b)for(a=(a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")).replace(L,"");0!==a.length%4;)a+="=";y=e.byteLength(a,b)}else if("object"===w&&null!==a)"Buffer"===a.type&&z(a.data)&&(a=a.data),y=0<+a.length?Math.floor(+a.length):0;else throw new TypeError("must start with number, buffer, array or string"); -if(this.length>G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");if(e.TYPED_ARRAY_SUPPORT)var I=e._augment(new Uint8Array(y));else I=this,I.length=y,I._isBuffer=!0;if(e.TYPED_ARRAY_SUPPORT&&"number"===typeof a.byteLength)I._set(a);else{var K=a;if(z(K)||e.isBuffer(K)||K&&"object"===typeof K&&"number"===typeof K.length)if(e.isBuffer(a))for(b=0;ba)throw new RangeError("offset is not uint");if(a+b>h)throw new RangeError("Trying to access beyond buffer length");}function m(a,b,h,w,y,I){if(!e.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>y||ba.length)throw new TypeError("index out of range"); -}function f(a,b,h,w){0>b&&(b=65535+b+1);for(var y=0,I=Math.min(a.length-h,2);y>>8*(w?y:1-y)}function c(a,b,h,w){0>b&&(b=4294967295+b+1);for(var y=0,I=Math.min(a.length-h,4);y>>8*(w?y:3-y)&255}function l(a,b,h,w,y,I){if(b>y||ba.length)throw new TypeError("index out of range");}function q(a,b,h,w,y){y||l(a,b,h,4,3.4028234663852886E38,-3.4028234663852886E38);v.write(a,b,h,w,23,4);return h+4}function r(a, -b,h,w,y){y||l(a,b,h,8,1.7976931348623157E308,-1.7976931348623157E308);v.write(a,b,h,w,52,8);return h+8}function k(a){for(var b=[],h=0;h=w)b.push(w);else{var y=h;55296<=w&&57343>=w&&h++;w=encodeURIComponent(a.slice(y,h+1)).substr(1).split("%");for(y=0;y=b.length||y>=a.length);y++)b[y+ -h]=a[y];return y}function g(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}var n=C("base64-js"),v=C("ieee754"),z=C("is-array");A.Buffer=e;A.SlowBuffer=e;A.INSPECT_MAX_BYTES=50;e.poolSize=8192;var G=1073741823;e.TYPED_ARRAY_SUPPORT=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);b.foo=function(){return 42};return 42===b.foo()&&"function"===typeof b.subarray&&0===(new Uint8Array(1)).subarray(1,1).byteLength}catch(h){return!1}}();e.isBuffer=function(a){return!(null== -a||!a._isBuffer)};e.compare=function(a,b){if(!e.isBuffer(a)||!e.isBuffer(b))throw new TypeError("Arguments must be Buffers");for(var h=a.length,w=b.length,y=0,I=Math.min(h,w);y>>1;break;case "utf8":case "utf-8":h=k(a).length;break;case "base64":h=n.toByteArray(a).length; -break;default:h=a.length}return h};e.prototype.length=void 0;e.prototype.parent=void 0;e.prototype.toString=function(a,b,h){var w=!1;b>>>=0;h=void 0===h||Infinity===h?this.length:h>>>0;a||(a="utf8");0>b&&(b=0);h>this.length&&(h=this.length);if(h<=b)return"";for(;;)switch(a){case "hex":a=b;b=h;h=this.length;if(!a||0>a)a=0;if(!b||0>b||b>h)b=h;w="";for(h=a;hw?"0"+w.toString(16):w.toString(16),w=a+w;return w;case "utf8":case "utf-8":w=a="";for(h=Math.min(this.length,h);b= -this[b]?(a+=g(w)+String.fromCharCode(this[b]),w=""):w+="%"+this[b].toString(16);return a+g(w);case "ascii":return p(this,b,h);case "binary":return p(this,b,h);case "base64":return b=0===b&&h===this.length?n.fromByteArray(this):n.fromByteArray(this.slice(b,h)),b;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":b=this.slice(b,h);h="";for(a=0;ab&&(a+=" ... "));return""};e.prototype.compare=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return e.compare(this,a)};e.prototype.get=function(a){console.log(".get() is deprecated. Access using array indexes instead."); -return this.readUInt8(a)};e.prototype.set=function(a,b){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(a,b)};e.prototype.write=function(a,b,h,w){if(isFinite(b))isFinite(h)||(w=h,h=void 0);else{var y=w;w=b;b=h;h=y}b=Number(b)||0;y=this.length-b;h?(h=Number(h),h>y&&(h=y)):h=y;w=String(w||"utf8").toLowerCase();switch(w){case "hex":b=Number(b)||0;w=this.length-b;h?(h=Number(h),h>w&&(h=w)):h=w;w=a.length;if(0!==w%2)throw Error("Invalid hex string");h>w/ -2&&(h=w/2);for(w=0;w>8;K%=256;y.push(K);y.push(w)}a=d(y,this,b,h,2);break;default:throw new TypeError("Unknown encoding: "+ -w);}return a};e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};e.prototype.slice=function(a,b){var h=this.length;a=~~a;b=void 0===b?h:~~b;0>a?(a+=h,0>a&&(a=0)):a>h&&(a=h);0>b?(b+=h,0>b&&(b=0)):b>h&&(b=h);b>>=0;h||m(this,a,b,1,255,0);e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));this[b]=a;return b+1};e.prototype.writeUInt16LE=function(a, -b,h){a=+a;b>>>=0;h||m(this,a,b,2,65535,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):f(this,a,b,!0);return b+2};e.prototype.writeUInt16BE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,2,65535,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):f(this,a,b,!1);return b+2};e.prototype.writeUInt32LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,4294967295,0);e.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a):c(this,a,b,!0);return b+4};e.prototype.writeUInt32BE=function(a, -b,h){a=+a;b>>>=0;h||m(this,a,b,4,4294967295,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a):c(this,a,b,!1);return b+4};e.prototype.writeInt8=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,1,127,-128);e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));0>a&&(a=255+a+1);this[b]=a;return b+1};e.prototype.writeInt16LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,2,32767,-32768);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):f(this,a,b,!0);return b+2};e.prototype.writeInt16BE=function(a, -b,h){a=+a;b>>>=0;h||m(this,a,b,2,32767,-32768);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):f(this,a,b,!1);return b+2};e.prototype.writeInt32LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,2147483647,-2147483648);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):c(this,a,b,!0);return b+4};e.prototype.writeInt32BE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,2147483647,-2147483648);0>a&&(a=4294967295+a+1);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+ -2]=a>>>8,this[b+3]=a):c(this,a,b,!1);return b+4};e.prototype.writeFloatLE=function(a,b,h){return q(this,a,b,!0,h)};e.prototype.writeFloatBE=function(a,b,h){return q(this,a,b,!1,h)};e.prototype.writeDoubleLE=function(a,b,h){return r(this,a,b,!0,h)};e.prototype.writeDoubleBE=function(a,b,h){return r(this,a,b,!1,h)};e.prototype.copy=function(a,b,h,w){h||(h=0);w||0===w||(w=this.length);b||(b=0);if(w!==h&&0!==a.length&&0!==this.length){if(wb||b>=a.length)throw new TypeError("targetStart out of bounds"); -if(0>h||h>=this.length)throw new TypeError("sourceStart out of bounds");if(0>w||w>this.length)throw new TypeError("sourceEnd out of bounds");w>this.length&&(w=this.length);a.length-bw||!e.TYPED_ARRAY_SUPPORT)for(var y=0;yb||b>=this.length)throw new TypeError("start out of bounds"); -if(0>h||h>this.length)throw new TypeError("end out of bounds");if("number"===typeof a)for(;b>1,r=-7;f=t?f-1:0;var k=t?-1:1,u=e[p+f];f+=k;t=u&(1<<-r)-1;u>>=-r;for(r+=c;0>=-r;for(r+=m;0>1,u=23===f?Math.pow(2,-24)-Math.pow(2,-77):0;c=m?0:c-1;var d=m?1:-1,g=0>p||0===p&&0>1/p?1:0;p=Math.abs(p);isNaN(p)||Infinity===p?(p=isNaN(p)?1:0,m=r):(m=Math.floor(Math.log(p)/Math.LN2),1>p*(l=Math.pow(2,-m))&&(m--,l*=2),p=1<=m+k?p+u/l:p+u*Math.pow(2,1-k),2<=p*l&&(m++,l/=2),m+k>=r?(p=0,m=r):1<=m+k?(p=(p*l-1)*Math.pow(2,f),m+=k):(p=p*Math.pow(2,k-1)*Math.pow(2,f),m=0));for(;8<=f;e[t+c]=p&255,c+= -d,p/=256,f-=8);m=m<z?[]:n.slice(v,z-v+1)}c=A.resolve(c).substr(1);l=A.resolve(l).substr(1); -for(var r=q(c.split("/")),k=q(l.split("/")),u=Math.min(r.length,k.length),d=u,g=0;gl&&(l=c.length+l);return c.substr(l,q)}}).call(this,C("g5I+bs"))},{"g5I+bs":9}],9:[function(C,J,A){function e(){}C=J.exports={};C.nextTick=function(){if("undefined"!==typeof window&&window.setImmediate)return function(t){return window.setImmediate(t)};if("undefined"!==typeof window&&window.postMessage&&window.addEventListener){var p=[];window.addEventListener("message",function(t){var m=t.source;m!==window&&null!== -m||"process-tick"!==t.data||(t.stopPropagation(),0p?(-p<<1)+1:p<<1;do p=m&31,m>>>=5,0=f)throw Error("Expected more digits in base 64 VLQ value.");var q=e.decode(p.charCodeAt(t++));if(-1===q)throw Error("Invalid base64 digit: "+p.charAt(t-1));var r=!!(q&32);q&=31;c+=q<>1;m.value=1===(c&1)?-p:p;m.rest=t}},{"./base64":12}],12:[function(C, -J,A){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");A.encode=function(p){if(0<=p&&p=p?p-65:97<=p&&122>=p?p-97+26:48<=p&&57>=p?p-48+52:43==p?62:47==p?63:-1}},{}],13:[function(C,J,A){function e(p,t,m,f,c,l){var q=Math.floor((t-p)/2)+p,r=c(m,f[q],!0);return 0===r?q:0p?-1:p}A.GREATEST_LOWER_BOUND=1;A.LEAST_UPPER_BOUND=2;A.search=function(p,t,m,f){if(0===t.length)return-1;p=e(-1,t.length,p,t,m,f||A.GREATEST_LOWER_BOUND);if(0>p)return-1;for(;0<=p-1&&0===m(t[p],t[p-1],!0);)--p;return p}},{}],14:[function(C,J,A){function e(){this._array=[];this._sorted=!0;this._last={generatedLine:-1,generatedColumn:0}}var p=C("./util");e.prototype.unsortedForEach=function(t,m){this._array.forEach(t,m)};e.prototype.add=function(t){var m=this._last,f=m.generatedLine, -c=t.generatedLine,l=m.generatedColumn,q=t.generatedColumn;c>f||c==f&&q>=l||0>=p.compareByGeneratedPositionsInflated(m,t)?this._last=t:this._sorted=!1;this._array.push(t)};e.prototype.toArray=function(){this._sorted||(this._array.sort(p.compareByGeneratedPositionsInflated),this._sorted=!0);return this._array};A.MappingList=e},{"./util":19}],15:[function(C,J,A){function e(t,m,f){var c=t[m];t[m]=t[f];t[f]=c}function p(t,m,f,c){if(f=m(t[r],q)&&(l+=1,e(t,l,r));e(t,l+1,r);l+=1;p(t,m,f,l-1);p(t,m,l+1,c)}}A.quickSort=function(t,m){p(t,m,0,t.length-1)}},{}],16:[function(C,J,A){function e(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));return null!=d.sections?new m(d,u):new p(d,u)}function p(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));var g=f.getArg(d,"version"),n=f.getArg(d,"sources"),v=f.getArg(d,"names",[]),z=f.getArg(d,"sourceRoot",null),G=f.getArg(d,"sourcesContent",null),D=f.getArg(d, -"mappings");d=f.getArg(d,"file",null);if(g!=this._version)throw Error("Unsupported version: "+g);z&&(z=f.normalize(z));n=n.map(String).map(f.normalize).map(function(L){return z&&f.isAbsolute(z)&&f.isAbsolute(L)?f.relative(z,L):L});this._names=l.fromArray(v.map(String),!0);this._sources=l.fromArray(n,!0);this.sourceRoot=z;this.sourcesContent=G;this._mappings=D;this._sourceMapURL=u;this.file=d}function t(){this.generatedColumn=this.generatedLine=0;this.name=this.originalColumn=this.originalLine=this.source= -null}function m(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));var g=f.getArg(d,"version");d=f.getArg(d,"sections");if(g!=this._version)throw Error("Unsupported version: "+g);this._sources=new l;this._names=new l;var n={line:-1,column:0};this._sections=d.map(function(v){if(v.url)throw Error("Support for url field in sections not implemented.");var z=f.getArg(v,"offset"),G=f.getArg(z,"line"),D=f.getArg(z,"column");if(G=k[d])throw new TypeError("Line must be greater than or equal to 1, got "+ -k[d]);if(0>k[g])throw new TypeError("Column must be greater than or equal to 0, got "+k[g]);return c.search(k,u,n,v)};p.prototype.computeColumnSpans=function(){for(var k=0;k=this._sources.size()&&!this.sourcesContent.some(function(k){return null==k}):!1};p.prototype.sourceContentFor=function(k,u){if(!this.sourcesContent)return null;var d=k;null!=this.sourceRoot&&(d=f.relative(this.sourceRoot,d));if(this._sources.has(d))return this.sourcesContent[this._sources.indexOf(d)]; -var g=this.sources,n;for(n=0;n -g||95!==d.charCodeAt(g-1)||95!==d.charCodeAt(g-2)||111!==d.charCodeAt(g-3)||116!==d.charCodeAt(g-4)||111!==d.charCodeAt(g-5)||114!==d.charCodeAt(g-6)||112!==d.charCodeAt(g-7)||95!==d.charCodeAt(g-8)||95!==d.charCodeAt(g-9))return!1;for(g-=10;0<=g;g--)if(36!==d.charCodeAt(g))return!1;return!0}function r(d,g){return d===g?0:null===d?1:null===g?-1:d>g?1:-1}A.getArg=function(d,g,n){if(g in d)return d[g];if(3===arguments.length)return n;throw Error('"'+g+'" is a required argument.');};var k=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/, -u=/^data:.+,.+$/;A.urlParse=e;A.urlGenerate=p;A.normalize=t;A.join=m;A.isAbsolute=function(d){return"/"===d.charAt(0)||k.test(d)};A.relative=function(d,g){""===d&&(d=".");d=d.replace(/\/$/,"");for(var n=0;0!==g.indexOf(d+"/");){var v=d.lastIndexOf("/");if(0>v)return g;d=d.slice(0,v);if(d.match(/^([^\/]+:\/)?\/*$/))return g;++n}return Array(n+1).join("../")+g.substr(d.length+1)};C=!("__proto__"in Object.create(null));A.toSetString=C?f:c;A.fromSetString=C?f:l;A.compareByOriginalPositions=function(d, -g,n){var v=r(d.source,g.source);if(0!==v)return v;v=d.originalLine-g.originalLine;if(0!==v)return v;v=d.originalColumn-g.originalColumn;if(0!==v||n)return v;v=d.generatedColumn-g.generatedColumn;if(0!==v)return v;v=d.generatedLine-g.generatedLine;return 0!==v?v:r(d.name,g.name)};A.compareByGeneratedPositionsDeflated=function(d,g,n){var v=d.generatedLine-g.generatedLine;if(0!==v)return v;v=d.generatedColumn-g.generatedColumn;if(0!==v||n)return v;v=r(d.source,g.source);if(0!==v)return v;v=d.originalLine- -g.originalLine;if(0!==v)return v;v=d.originalColumn-g.originalColumn;return 0!==v?v:r(d.name,g.name)};A.compareByGeneratedPositionsInflated=function(d,g){var n=d.generatedLine-g.generatedLine;if(0!==n)return n;n=d.generatedColumn-g.generatedColumn;if(0!==n)return n;n=r(d.source,g.source);if(0!==n)return n;n=d.originalLine-g.originalLine;if(0!==n)return n;n=d.originalColumn-g.originalColumn;return 0!==n?n:r(d.name,g.name)};A.parseSourceMapInput=function(d){return JSON.parse(d.replace(/^\)]}'[^\n]*\n/, -""))};A.computeSourceURL=function(d,g,n){g=g||"";d&&("/"!==d[d.length-1]&&"/"!==g[0]&&(d+="/"),g=d+g);if(n){d=e(n);if(!d)throw Error("sourceMapURL could not be parsed");d.path&&(n=d.path.lastIndexOf("/"),0<=n&&(d.path=d.path.substring(0,n+1)));g=m(p(d),g)}return t(g)}},{}],20:[function(C,J,A){A.SourceMapGenerator=C("./lib/source-map-generator").SourceMapGenerator;A.SourceMapConsumer=C("./lib/source-map-consumer").SourceMapConsumer;A.SourceNode=C("./lib/source-node").SourceNode},{"./lib/source-map-consumer":16, -"./lib/source-map-generator":17,"./lib/source-node":18}],21:[function(C,J,A){(function(e){function p(){return"browser"===a?!0:"node"===a?!1:"undefined"!==typeof window&&"function"===typeof XMLHttpRequest&&!(window.require&&window.module&&window.process&&"renderer"===window.process.type)}function t(x){return function(B){for(var F=0;F";B=this.getLineNumber();null!=B&&(x+=":"+B,(B= -this.getColumnNumber())&&(x+=":"+B))}B="";var F=this.getFunctionName(),E=!0,H=this.isConstructor();if(this.isToplevel()||H)H?B+="new "+(F||""):F?B+=F:(B+=x,E=!1);else{H=this.getTypeName();"[object Object]"===H&&(H="null");var M=this.getMethodName();F?(H&&0!=F.indexOf(H)&&(B+=H+"."),B+=F,M&&F.indexOf("."+M)!=F.length-M.length-1&&(B+=" [as "+M+"]")):B+=H+"."+(M||"")}E&&(B+=" ("+x+")");return B}function q(x){var B={};Object.getOwnPropertyNames(Object.getPrototypeOf(x)).forEach(function(F){B[F]= -/^(?:is|get)/.test(F)?function(){return x[F].call(x)}:x[F]});B.toString=l;return B}function r(x,B){void 0===B&&(B={nextPosition:null,curPosition:null});if(x.isNative())return B.curPosition=null,x;var F=x.getFileName()||x.getScriptNameOrSourceURL();if(F){var E=x.getLineNumber(),H=x.getColumnNumber()-1,M=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,S=M.test;var V="object"===typeof e&&null!==e?e.version:"";M=S.call(M,V)?0:62;1===E&&H>M&&!p()&&!x.isEval()&&(H-=M);var O= -f({source:F,line:E,column:H});B.curPosition=O;x=q(x);var T=x.getFunctionName;x.getFunctionName=function(){return null==B.nextPosition?T():B.nextPosition.name||T()};x.getFileName=function(){return O.source};x.getLineNumber=function(){return O.line};x.getColumnNumber=function(){return O.column+1};x.getScriptNameOrSourceURL=function(){return O.source};return x}var Q=x.isEval()&&x.getEvalOrigin();Q&&(Q=c(Q),x=q(x),x.getEvalOrigin=function(){return Q});return x}function k(x,B){L&&(b={},h={});for(var F= -(x.name||"Error")+": "+(x.message||""),E={nextPosition:null,curPosition:null},H=[],M=B.length-1;0<=M;M--)H.push("\n at "+r(B[M],E)),E.nextPosition=E.curPosition;E.curPosition=E.nextPosition=null;return F+H.reverse().join("")}function u(x){var B=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(x.stack);if(B){x=B[1];var F=+B[2];B=+B[3];var E=b[x];if(!E&&v&&v.existsSync(x))try{E=v.readFileSync(x,"utf8")}catch(H){E=""}if(E&&(E=E.split(/(?:\r\n|\r|\n)/)[F-1]))return x+":"+F+"\n"+E+"\n"+Array(B).join(" ")+ -"^"}return null}function d(){var x=e.emit;e.emit=function(B){if("uncaughtException"===B){var F=arguments[1]&&arguments[1].stack,E=0=12" - }, - "volta": { - "node": "16.11.0", - "npm": "7.24.2" - } -} diff --git a/node_modules/@cspotcode/source-map-support/register-hook-require.d.ts b/node_modules/@cspotcode/source-map-support/register-hook-require.d.ts deleted file mode 100644 index a787e69..0000000 --- a/node_modules/@cspotcode/source-map-support/register-hook-require.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// tslint:disable:no-useless-files - -// For following usage: -// import '@cspotcode/source-map-support/register-hook-require' -// Instead of: -// import sourceMapSupport from '@cspotcode/source-map-support' -// sourceMapSupport.install({hookRequire: true}) diff --git a/node_modules/@cspotcode/source-map-support/register-hook-require.js b/node_modules/@cspotcode/source-map-support/register-hook-require.js deleted file mode 100644 index 6bc12ab..0000000 --- a/node_modules/@cspotcode/source-map-support/register-hook-require.js +++ /dev/null @@ -1,3 +0,0 @@ -require('./').install({ - hookRequire: true -}); diff --git a/node_modules/@cspotcode/source-map-support/register.d.ts b/node_modules/@cspotcode/source-map-support/register.d.ts deleted file mode 100644 index 063cd7c..0000000 --- a/node_modules/@cspotcode/source-map-support/register.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// tslint:disable:no-useless-files - -// For following usage: -// import '@cspotcode/source-map-support/register' -// Instead of: -// import sourceMapSupport from '@cspotcode/source-map-support' -// sourceMapSupport.install() diff --git a/node_modules/@cspotcode/source-map-support/register.js b/node_modules/@cspotcode/source-map-support/register.js deleted file mode 100644 index 4f68e67..0000000 --- a/node_modules/@cspotcode/source-map-support/register.js +++ /dev/null @@ -1 +0,0 @@ -require('./').install(); diff --git a/node_modules/@cspotcode/source-map-support/source-map-support.d.ts b/node_modules/@cspotcode/source-map-support/source-map-support.d.ts deleted file mode 100644 index d8cb9d8..0000000 --- a/node_modules/@cspotcode/source-map-support/source-map-support.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -// Type definitions for source-map-support 0.5 -// Project: https://github.com/evanw/node-source-map-support -// Definitions by: Bart van der Schoor -// Jason Cheatham -// Alcedo Nathaniel De Guzman Jr -// Griffin Yourick -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export interface RawSourceMap { - version: 3; - sources: string[]; - names: string[]; - sourceRoot?: string; - sourcesContent?: string[]; - mappings: string; - file: string; -} - -/** - * Output of retrieveSourceMap(). - * From source-map-support: - * The map field may be either a string or the parsed JSON object (i.e., - * it must be a valid argument to the SourceMapConsumer constructor). - */ -export interface UrlAndMap { - url: string; - map: string | RawSourceMap; -} - -/** - * Options to install(). - */ -export interface Options { - handleUncaughtExceptions?: boolean | undefined; - hookRequire?: boolean | undefined; - emptyCacheBetweenOperations?: boolean | undefined; - environment?: 'auto' | 'browser' | 'node' | undefined; - overrideRetrieveFile?: boolean | undefined; - overrideRetrieveSourceMap?: boolean | undefined; - retrieveFile?(path: string): string; - retrieveSourceMap?(source: string): UrlAndMap | null; - /** - * Set false to disable redirection of require / import `source-map-support` to `@cspotcode/source-map-support` - */ - redirectConflictingLibrary?: boolean; - /** - * Callback will be called every time we redirect due to `redirectConflictingLibrary` - * This allows consumers to log helpful warnings if they choose. - * @param parent NodeJS.Module which made the require() or require.resolve() call - * @param options options object internally passed to node's `_resolveFilename` hook - */ - onConflictingLibraryRedirect?: (request: string, parent: any, isMain: boolean, options: any, redirectedRequest: string) => void; -} - -export interface Position { - source: string; - line: number; - column: number; -} - -export function wrapCallSite(frame: any /* StackFrame */): any /* StackFrame */; -export function getErrorSource(error: Error): string | null; -export function mapSourcePosition(position: Position): Position; -export function retrieveSourceMap(source: string): UrlAndMap | null; -export function resetRetrieveHandlers(): void; - -/** - * Install SourceMap support. - * @param options Can be used to e.g. disable uncaughtException handler. - */ -export function install(options?: Options): void; - -/** - * Uninstall SourceMap support. - */ -export function uninstall(): void; diff --git a/node_modules/@cspotcode/source-map-support/source-map-support.js b/node_modules/@cspotcode/source-map-support/source-map-support.js deleted file mode 100644 index ad830b6..0000000 --- a/node_modules/@cspotcode/source-map-support/source-map-support.js +++ /dev/null @@ -1,938 +0,0 @@ -const { TraceMap, originalPositionFor, AnyMap } = require('@jridgewell/trace-mapping'); -var path = require('path'); -const { fileURLToPath, pathToFileURL } = require('url'); -var util = require('util'); - -var fs; -try { - fs = require('fs'); - if (!fs.existsSync || !fs.readFileSync) { - // fs doesn't have all methods we need - fs = null; - } -} catch (err) { - /* nop */ -} - -/** - * Requires a module which is protected against bundler minification. - * - * @param {NodeModule} mod - * @param {string} request - */ -function dynamicRequire(mod, request) { - return mod.require(request); -} - -/** - * @typedef {{ - * enabled: boolean; - * originalValue: any; - * installedValue: any; - * }} HookState - * Used for installing and uninstalling hooks - */ - -// Increment this if the format of sharedData changes in a breaking way. -var sharedDataVersion = 1; - -/** - * @template T - * @param {T} defaults - * @returns {T} - */ -function initializeSharedData(defaults) { - var sharedDataKey = 'source-map-support/sharedData'; - if (typeof Symbol !== 'undefined') { - sharedDataKey = Symbol.for(sharedDataKey); - } - var sharedData = this[sharedDataKey]; - if (!sharedData) { - sharedData = { version: sharedDataVersion }; - if (Object.defineProperty) { - Object.defineProperty(this, sharedDataKey, { value: sharedData }); - } else { - this[sharedDataKey] = sharedData; - } - } - if (sharedDataVersion !== sharedData.version) { - throw new Error("Multiple incompatible instances of source-map-support were loaded"); - } - for (var key in defaults) { - if (!(key in sharedData)) { - sharedData[key] = defaults[key]; - } - } - return sharedData; -} - -// If multiple instances of source-map-support are loaded into the same -// context, they shouldn't overwrite each other. By storing handlers, caches, -// and other state on a shared object, different instances of -// source-map-support can work together in a limited way. This does require -// that future versions of source-map-support continue to support the fields on -// this object. If this internal contract ever needs to be broken, increment -// sharedDataVersion. (This version number is not the same as any of the -// package's version numbers, which should reflect the *external* API of -// source-map-support.) -var sharedData = initializeSharedData({ - - // Only install once if called multiple times - // Remember how the environment looked before installation so we can restore if able - /** @type {HookState} */ - errorPrepareStackTraceHook: undefined, - /** @type {HookState} */ - processEmitHook: undefined, - /** @type {HookState} */ - moduleResolveFilenameHook: undefined, - - /** @type {Array<(request: string, parent: any, isMain: boolean, options: any, redirectedRequest: string) => void>} */ - onConflictingLibraryRedirectArr: [], - - // If true, the caches are reset before a stack trace formatting operation - emptyCacheBetweenOperations: false, - - // Maps a file path to a string containing the file contents - fileContentsCache: Object.create(null), - - // Maps a file path to a source map for that file - /** @type {Record C:/dir/file - '/'; // file:///root-dir/file -> /root-dir/file - }); - } - const key = getCacheKey(path); - if(hasFileContentsCacheFromKey(key)) { - return getFileContentsCacheFromKey(key); - } - - var contents = ''; - try { - if (!fs) { - // Use SJAX if we are in the browser - var xhr = new XMLHttpRequest(); - xhr.open('GET', path, /** async */ false); - xhr.send(null); - if (xhr.readyState === 4 && xhr.status === 200) { - contents = xhr.responseText; - } - } else if (fs.existsSync(path)) { - // Otherwise, use the filesystem - contents = fs.readFileSync(path, 'utf8'); - } - } catch (er) { - /* ignore any errors */ - } - - return setFileContentsCache(path, contents); -}); - -// Support URLs relative to a directory, but be careful about a protocol prefix -// in case we are in the browser (i.e. directories may start with "http://" or "file:///") -function supportRelativeURL(file, url) { - if(!file) return url; - // given that this happens within error formatting codepath, probably best to - // fallback instead of throwing if anything goes wrong - try { - // if should output a URL - if(isAbsoluteUrl(file) || isSchemeRelativeUrl(file)) { - if(isAbsoluteUrl(url) || isSchemeRelativeUrl(url)) { - return new URL(url, file).toString(); - } - if(path.isAbsolute(url)) { - return new URL(pathToFileURL(url), file).toString(); - } - // url is relative path or URL - return new URL(url.replace(/\\/g, '/'), file).toString(); - } - // if should output a path (unless URL is something like https://) - if(path.isAbsolute(file)) { - if(isFileUrl(url)) { - return fileURLToPath(url); - } - if(isSchemeRelativeUrl(url)) { - return fileURLToPath(new URL(url, 'file://')); - } - if(isAbsoluteUrl(url)) { - // url is a non-file URL - // Go with the URL - return url; - } - if(path.isAbsolute(url)) { - // Normalize at all? decodeURI or normalize slashes? - return path.normalize(url); - } - // url is relative path or URL - return path.join(file, '..', decodeURI(url)); - } - // If we get here, file is relative. - // Shouldn't happen since node identifies modules with absolute paths or URLs. - // But we can take a stab at returning something meaningful anyway. - if(isAbsoluteUrl(url) || isSchemeRelativeUrl(url)) { - return url; - } - return path.join(file, '..', url); - } catch(e) { - return url; - } -} - -// Return pathOrUrl in the same style as matchStyleOf: either a file URL or a native path -function matchStyleOfPathOrUrl(matchStyleOf, pathOrUrl) { - try { - if(isAbsoluteUrl(matchStyleOf) || isSchemeRelativeUrl(matchStyleOf)) { - if(isAbsoluteUrl(pathOrUrl) || isSchemeRelativeUrl(pathOrUrl)) return pathOrUrl; - if(path.isAbsolute(pathOrUrl)) return pathToFileURL(pathOrUrl).toString(); - } else if(path.isAbsolute(matchStyleOf)) { - if(isAbsoluteUrl(pathOrUrl) || isSchemeRelativeUrl(pathOrUrl)) { - return fileURLToPath(new URL(pathOrUrl, 'file://')); - } - } - return pathOrUrl; - } catch(e) { - return pathOrUrl; - } -} - -function retrieveSourceMapURL(source) { - var fileData; - - if (isInBrowser()) { - try { - var xhr = new XMLHttpRequest(); - xhr.open('GET', source, false); - xhr.send(null); - fileData = xhr.readyState === 4 ? xhr.responseText : null; - - // Support providing a sourceMappingURL via the SourceMap header - var sourceMapHeader = xhr.getResponseHeader("SourceMap") || - xhr.getResponseHeader("X-SourceMap"); - if (sourceMapHeader) { - return sourceMapHeader; - } - } catch (e) { - } - } - - // Get the URL of the source map - fileData = retrieveFile(tryFileURLToPath(source)); - var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg; - // Keep executing the search to find the *last* sourceMappingURL to avoid - // picking up sourceMappingURLs from comments, strings, etc. - var lastMatch, match; - while (match = re.exec(fileData)) lastMatch = match; - if (!lastMatch) return null; - return lastMatch[1]; -}; - -// Can be overridden by the retrieveSourceMap option to install. Takes a -// generated source filename; returns a {map, optional url} object, or null if -// there is no source map. The map field may be either a string or the parsed -// JSON object (ie, it must be a valid argument to the SourceMapConsumer -// constructor). -/** @type {(source: string) => import('./source-map-support').UrlAndMap | null} */ -var retrieveSourceMap = handlerExec(sharedData.retrieveMapHandlers, sharedData.internalRetrieveMapHandlers); -sharedData.internalRetrieveMapHandlers.push(function(source) { - var sourceMappingURL = retrieveSourceMapURL(source); - if (!sourceMappingURL) return null; - - // Read the contents of the source map - var sourceMapData; - if (reSourceMap.test(sourceMappingURL)) { - // Support source map URL as a data url - var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1); - sourceMapData = Buffer.from(rawData, "base64").toString(); - sourceMappingURL = source; - } else { - // Support source map URLs relative to the source URL - sourceMappingURL = supportRelativeURL(source, sourceMappingURL); - sourceMapData = retrieveFile(tryFileURLToPath(sourceMappingURL)); - } - - if (!sourceMapData) { - return null; - } - - return { - url: sourceMappingURL, - map: sourceMapData - }; -}); - -function mapSourcePosition(position) { - var sourceMap = getSourceMapCache(position.source); - if (!sourceMap) { - // Call the (overrideable) retrieveSourceMap function to get the source map. - var urlAndMap = retrieveSourceMap(position.source); - if (urlAndMap) { - sourceMap = setSourceMapCache(position.source, { - url: urlAndMap.url, - map: new AnyMap(urlAndMap.map, urlAndMap.url) - }); - - // Overwrite trace-mapping's resolutions, because they do not handle - // Windows paths the way we want. - // TODO Remove now that windows path support was added to resolve-uri and thus trace-mapping? - sourceMap.map.resolvedSources = sourceMap.map.sources.map(s => supportRelativeURL(sourceMap.url, s)); - - // Load all sources stored inline with the source map into the file cache - // to pretend like they are already loaded. They may not exist on disk. - if (sourceMap.map.sourcesContent) { - sourceMap.map.resolvedSources.forEach(function(resolvedSource, i) { - var contents = sourceMap.map.sourcesContent[i]; - if (contents) { - setFileContentsCache(resolvedSource, contents); - } - }); - } - } else { - sourceMap = setSourceMapCache(position.source, { - url: null, - map: null - }); - } - } - - // Resolve the source URL relative to the URL of the source map - if (sourceMap && sourceMap.map) { - var originalPosition = originalPositionFor(sourceMap.map, position); - - // Only return the original position if a matching line was found. If no - // matching line is found then we return position instead, which will cause - // the stack trace to print the path and line for the compiled file. It is - // better to give a precise location in the compiled file than a vague - // location in the original file. - if (originalPosition.source !== null) { - // originalPosition.source has *already* been resolved against sourceMap.url - // so is *already* as absolute as possible. - // However, we want to ensure we output in same format as input: URL or native path - originalPosition.source = matchStyleOfPathOrUrl( - position.source, originalPosition.source); - return originalPosition; - } - } - - return position; -} - -// Parses code generated by FormatEvalOrigin(), a function inside V8: -// https://code.google.com/p/v8/source/browse/trunk/src/messages.js -function mapEvalOrigin(origin) { - // Most eval() calls are in this format - var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin); - if (match) { - var position = mapSourcePosition({ - source: match[2], - line: +match[3], - column: match[4] - 1 - }); - return 'eval at ' + match[1] + ' (' + position.source + ':' + - position.line + ':' + (position.column + 1) + ')'; - } - - // Parse nested eval() calls using recursion - match = /^eval at ([^(]+) \((.+)\)$/.exec(origin); - if (match) { - return 'eval at ' + match[1] + ' (' + mapEvalOrigin(match[2]) + ')'; - } - - // Make sure we still return useful information if we didn't find anything - return origin; -} - -// This is copied almost verbatim from the V8 source code at -// https://code.google.com/p/v8/source/browse/trunk/src/messages.js -// Update 2022-04-29: -// https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/builtins/builtins-callsite.cc#L175-L179 -// https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/objects/call-site-info.cc#L795-L804 -// https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/objects/call-site-info.cc#L717-L750 -// The implementation of wrapCallSite() used to just forward to the actual source -// code of CallSite.prototype.toString but unfortunately a new release of V8 -// did something to the prototype chain and broke the shim. The only fix I -// could find was copy/paste. -function CallSiteToString() { - var fileName; - var fileLocation = ""; - if (this.isNative()) { - fileLocation = "native"; - } else { - fileName = this.getScriptNameOrSourceURL(); - if (!fileName && this.isEval()) { - fileLocation = this.getEvalOrigin(); - fileLocation += ", "; // Expecting source position to follow. - } - - if (fileName) { - fileLocation += fileName; - } else { - // Source code does not originate from a file and is not native, but we - // can still get the source position inside the source string, e.g. in - // an eval string. - fileLocation += ""; - } - var lineNumber = this.getLineNumber(); - if (lineNumber != null) { - fileLocation += ":" + lineNumber; - var columnNumber = this.getColumnNumber(); - if (columnNumber) { - fileLocation += ":" + columnNumber; - } - } - } - - var line = ""; - var isAsync = this.isAsync ? this.isAsync() : false; - if(isAsync) { - line += 'async '; - var isPromiseAll = this.isPromiseAll ? this.isPromiseAll() : false; - var isPromiseAny = this.isPromiseAny ? this.isPromiseAny() : false; - if(isPromiseAny || isPromiseAll) { - line += isPromiseAll ? 'Promise.all (index ' : 'Promise.any (index '; - var promiseIndex = this.getPromiseIndex(); - line += promiseIndex + ')'; - } - } - var functionName = this.getFunctionName(); - var addSuffix = true; - var isConstructor = this.isConstructor(); - var isMethodCall = !(this.isToplevel() || isConstructor); - if (isMethodCall) { - var typeName = this.getTypeName(); - // Fixes shim to be backward compatable with Node v0 to v4 - if (typeName === "[object Object]") { - typeName = "null"; - } - var methodName = this.getMethodName(); - if (functionName) { - if (typeName && functionName.indexOf(typeName) != 0) { - line += typeName + "."; - } - line += functionName; - if (methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1) { - line += " [as " + methodName + "]"; - } - } else { - line += typeName + "." + (methodName || ""); - } - } else if (isConstructor) { - line += "new " + (functionName || ""); - } else if (functionName) { - line += functionName; - } else { - line += fileLocation; - addSuffix = false; - } - if (addSuffix) { - line += " (" + fileLocation + ")"; - } - return line; -} - -function cloneCallSite(frame) { - var object = {}; - Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) { - object[name] = /^(?:is|get)/.test(name) ? function() { return frame[name].call(frame); } : frame[name]; - }); - object.toString = CallSiteToString; - return object; -} - -function wrapCallSite(frame, state) { - // provides interface backward compatibility - if (state === undefined) { - state = { nextPosition: null, curPosition: null } - } - if(frame.isNative()) { - state.curPosition = null; - return frame; - } - - // Most call sites will return the source file from getFileName(), but code - // passed to eval() ending in "//# sourceURL=..." will return the source file - // from getScriptNameOrSourceURL() instead - var source = frame.getFileName() || frame.getScriptNameOrSourceURL(); - if (source) { - // v8 does not expose its internal isWasm, etc methods, so we do this instead. - if(source.startsWith('wasm://')) { - state.curPosition = null; - return frame; - } - - var line = frame.getLineNumber(); - var column = frame.getColumnNumber() - 1; - - // Fix position in Node where some (internal) code is prepended. - // See https://github.com/evanw/node-source-map-support/issues/36 - // Header removed in node at ^10.16 || >=11.11.0 - // v11 is not an LTS candidate, we can just test the one version with it. - // Test node versions for: 10.16-19, 10.20+, 12-19, 20-99, 100+, or 11.11 - var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/; - var headerLength = noHeader.test(process.version) ? 0 : 62; - if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) { - column -= headerLength; - } - - var position = mapSourcePosition({ - source: source, - line: line, - column: column - }); - state.curPosition = position; - frame = cloneCallSite(frame); - var originalFunctionName = frame.getFunctionName; - frame.getFunctionName = function() { - if (state.nextPosition == null) { - return originalFunctionName(); - } - return state.nextPosition.name || originalFunctionName(); - }; - frame.getFileName = function() { return position.source; }; - frame.getLineNumber = function() { return position.line; }; - frame.getColumnNumber = function() { return position.column + 1; }; - frame.getScriptNameOrSourceURL = function() { return position.source; }; - return frame; - } - - // Code called using eval() needs special handling - var origin = frame.isEval() && frame.getEvalOrigin(); - if (origin) { - origin = mapEvalOrigin(origin); - frame = cloneCallSite(frame); - frame.getEvalOrigin = function() { return origin; }; - return frame; - } - - // If we get here then we were unable to change the source position - return frame; -} - -var kIsNodeError = undefined; -try { - // Get a deliberate ERR_INVALID_ARG_TYPE - // TODO is there a better way to reliably get an instance of NodeError? - path.resolve(123); -} catch(e) { - const symbols = Object.getOwnPropertySymbols(e); - const symbol = symbols.find(function (s) {return s.toString().indexOf('kIsNodeError') >= 0}); - if(symbol) kIsNodeError = symbol; -} - -const ErrorPrototypeToString = (err) =>Error.prototype.toString.call(err); - -/** @param {HookState} hookState */ -function createPrepareStackTrace(hookState) { - return prepareStackTrace; - - // This function is part of the V8 stack trace API, for more info see: - // https://v8.dev/docs/stack-trace-api - function prepareStackTrace(error, stack) { - if(!hookState.enabled) return hookState.originalValue.apply(this, arguments); - - if (sharedData.emptyCacheBetweenOperations) { - clearCaches(); - } - - // node gives its own errors special treatment. Mimic that behavior - // https://github.com/nodejs/node/blob/3cbaabc4622df1b4009b9d026a1a970bdbae6e89/lib/internal/errors.js#L118-L128 - // https://github.com/nodejs/node/pull/39182 - var errorString; - if (kIsNodeError) { - if(kIsNodeError in error) { - errorString = `${error.name} [${error.code}]: ${error.message}`; - } else { - errorString = ErrorPrototypeToString(error); - } - } else { - var name = error.name || 'Error'; - var message = error.message || ''; - errorString = message ? name + ": " + message : name; - } - - var state = { nextPosition: null, curPosition: null }; - var processedStack = []; - for (var i = stack.length - 1; i >= 0; i--) { - processedStack.push('\n at ' + wrapCallSite(stack[i], state)); - state.nextPosition = state.curPosition; - } - state.curPosition = state.nextPosition = null; - return errorString + processedStack.reverse().join(''); - } -} - -// Generate position and snippet of original source with pointer -function getErrorSource(error) { - var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack); - if (match) { - var source = match[1]; - var line = +match[2]; - var column = +match[3]; - - // Support the inline sourceContents inside the source map - var contents = getFileContentsCache(source); - - const sourceAsPath = tryFileURLToPath(source); - - // Support files on disk - if (!contents && fs && fs.existsSync(sourceAsPath)) { - try { - contents = fs.readFileSync(sourceAsPath, 'utf8'); - } catch (er) { - contents = ''; - } - } - - // Format the line from the original source code like node does - if (contents) { - var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1]; - if (code) { - return source + ':' + line + '\n' + code + '\n' + - new Array(column).join(' ') + '^'; - } - } - } - return null; -} - -function printFatalErrorUponExit (error) { - var source = getErrorSource(error); - - // Ensure error is printed synchronously and not truncated - if (process.stderr._handle && process.stderr._handle.setBlocking) { - process.stderr._handle.setBlocking(true); - } - - if (source) { - console.error(source); - } - - // Matches node's behavior for colorized output - console.error( - util.inspect(error, { - customInspect: false, - colors: process.stderr.isTTY - }) - ); -} - -function shimEmitUncaughtException () { - const originalValue = process.emit; - var hook = sharedData.processEmitHook = { - enabled: true, - originalValue, - installedValue: undefined - }; - var isTerminatingDueToFatalException = false; - var fatalException; - - process.emit = sharedData.processEmitHook.installedValue = function (type) { - const hadListeners = originalValue.apply(this, arguments); - if(hook.enabled) { - if (type === 'uncaughtException' && !hadListeners) { - isTerminatingDueToFatalException = true; - fatalException = arguments[1]; - process.exit(1); - } - if (type === 'exit' && isTerminatingDueToFatalException) { - printFatalErrorUponExit(fatalException); - } - } - return hadListeners; - }; -} - -var originalRetrieveFileHandlers = sharedData.retrieveFileHandlers.slice(0); -var originalRetrieveMapHandlers = sharedData.retrieveMapHandlers.slice(0); - -exports.wrapCallSite = wrapCallSite; -exports.getErrorSource = getErrorSource; -exports.mapSourcePosition = mapSourcePosition; -exports.retrieveSourceMap = retrieveSourceMap; - -exports.install = function(options) { - options = options || {}; - - if (options.environment) { - environment = options.environment; - if (["node", "browser", "auto"].indexOf(environment) === -1) { - throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}") - } - } - - // Use dynamicRequire to avoid including in browser bundles - var Module = dynamicRequire(module, 'module'); - - // Redirect subsequent imports of "source-map-support" - // to this package - const {redirectConflictingLibrary = true, onConflictingLibraryRedirect} = options; - if(redirectConflictingLibrary) { - if (!sharedData.moduleResolveFilenameHook) { - const originalValue = Module._resolveFilename; - const moduleResolveFilenameHook = sharedData.moduleResolveFilenameHook = { - enabled: true, - originalValue, - installedValue: undefined, - } - Module._resolveFilename = sharedData.moduleResolveFilenameHook.installedValue = function (request, parent, isMain, options) { - if (moduleResolveFilenameHook.enabled) { - // Match all source-map-support entrypoints: source-map-support, source-map-support/register - let requestRedirect; - if (request === 'source-map-support') { - requestRedirect = './'; - } else if (request === 'source-map-support/register') { - requestRedirect = './register'; - } - - if (requestRedirect !== undefined) { - const newRequest = require.resolve(requestRedirect); - for (const cb of sharedData.onConflictingLibraryRedirectArr) { - cb(request, parent, isMain, options, newRequest); - } - request = newRequest; - } - } - - return originalValue.call(this, request, parent, isMain, options); - } - } - if (onConflictingLibraryRedirect) { - sharedData.onConflictingLibraryRedirectArr.push(onConflictingLibraryRedirect); - } - } - - // Allow sources to be found by methods other than reading the files - // directly from disk. - if (options.retrieveFile) { - if (options.overrideRetrieveFile) { - sharedData.retrieveFileHandlers.length = 0; - } - - sharedData.retrieveFileHandlers.unshift(options.retrieveFile); - } - - // Allow source maps to be found by methods other than reading the files - // directly from disk. - if (options.retrieveSourceMap) { - if (options.overrideRetrieveSourceMap) { - sharedData.retrieveMapHandlers.length = 0; - } - - sharedData.retrieveMapHandlers.unshift(options.retrieveSourceMap); - } - - // Support runtime transpilers that include inline source maps - if (options.hookRequire && !isInBrowser()) { - var $compile = Module.prototype._compile; - - if (!$compile.__sourceMapSupport) { - Module.prototype._compile = function(content, filename) { - setFileContentsCache(filename, content); - setSourceMapCache(filename, undefined); - return $compile.call(this, content, filename); - }; - - Module.prototype._compile.__sourceMapSupport = true; - } - } - - // Configure options - if (!sharedData.emptyCacheBetweenOperations) { - sharedData.emptyCacheBetweenOperations = 'emptyCacheBetweenOperations' in options ? - options.emptyCacheBetweenOperations : false; - } - - - // Install the error reformatter - if (!sharedData.errorPrepareStackTraceHook) { - const originalValue = Error.prepareStackTrace; - sharedData.errorPrepareStackTraceHook = { - enabled: true, - originalValue, - installedValue: undefined - }; - Error.prepareStackTrace = sharedData.errorPrepareStackTraceHook.installedValue = createPrepareStackTrace(sharedData.errorPrepareStackTraceHook); - } - - if (!sharedData.processEmitHook) { - var installHandler = 'handleUncaughtExceptions' in options ? - options.handleUncaughtExceptions : true; - - // Do not override 'uncaughtException' with our own handler in Node.js - // Worker threads. Workers pass the error to the main thread as an event, - // rather than printing something to stderr and exiting. - try { - // We need to use `dynamicRequire` because `require` on it's own will be optimized by WebPack/Browserify. - var worker_threads = dynamicRequire(module, 'worker_threads'); - if (worker_threads.isMainThread === false) { - installHandler = false; - } - } catch(e) {} - - // Provide the option to not install the uncaught exception handler. This is - // to support other uncaught exception handlers (in test frameworks, for - // example). If this handler is not installed and there are no other uncaught - // exception handlers, uncaught exceptions will be caught by node's built-in - // exception handler and the process will still be terminated. However, the - // generated JavaScript code will be shown above the stack trace instead of - // the original source code. - if (installHandler && hasGlobalProcessEventEmitter()) { - shimEmitUncaughtException(); - } - } -}; - -exports.uninstall = function() { - if(sharedData.processEmitHook) { - // Disable behavior - sharedData.processEmitHook.enabled = false; - // If possible, remove our hook function. May not be possible if subsequent third-party hooks have wrapped around us. - if(process.emit === sharedData.processEmitHook.installedValue) { - process.emit = sharedData.processEmitHook.originalValue; - } - sharedData.processEmitHook = undefined; - } - if(sharedData.errorPrepareStackTraceHook) { - // Disable behavior - sharedData.errorPrepareStackTraceHook.enabled = false; - // If possible or necessary, remove our hook function. - // In vanilla environments, prepareStackTrace is `undefined`. - // We cannot delegate to `undefined` the way we can to a function w/`.apply()`; our only option is to remove the function. - // If we are the *first* hook installed, and another was installed on top of us, we have no choice but to remove both. - if(Error.prepareStackTrace === sharedData.errorPrepareStackTraceHook.installedValue || typeof sharedData.errorPrepareStackTraceHook.originalValue !== 'function') { - Error.prepareStackTrace = sharedData.errorPrepareStackTraceHook.originalValue; - } - sharedData.errorPrepareStackTraceHook = undefined; - } - if (sharedData.moduleResolveFilenameHook) { - // Disable behavior - sharedData.moduleResolveFilenameHook.enabled = false; - // If possible, remove our hook function. May not be possible if subsequent third-party hooks have wrapped around us. - var Module = dynamicRequire(module, 'module'); - if(Module._resolveFilename === sharedData.moduleResolveFilenameHook.installedValue) { - Module._resolveFilename = sharedData.moduleResolveFilenameHook.originalValue; - } - sharedData.moduleResolveFilenameHook = undefined; - } - sharedData.onConflictingLibraryRedirectArr.length = 0; -} - -exports.resetRetrieveHandlers = function() { - sharedData.retrieveFileHandlers.length = 0; - sharedData.retrieveMapHandlers.length = 0; -} diff --git a/node_modules/@jridgewell/resolve-uri/LICENSE b/node_modules/@jridgewell/resolve-uri/LICENSE deleted file mode 100644 index 0a81b2a..0000000 --- a/node_modules/@jridgewell/resolve-uri/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2019 Justin Ridgewell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/node_modules/@jridgewell/resolve-uri/README.md b/node_modules/@jridgewell/resolve-uri/README.md deleted file mode 100644 index 2fe70df..0000000 --- a/node_modules/@jridgewell/resolve-uri/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# @jridgewell/resolve-uri - -> Resolve a URI relative to an optional base URI - -Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths. - -## Installation - -```sh -npm install @jridgewell/resolve-uri -``` - -## Usage - -```typescript -function resolve(input: string, base?: string): string; -``` - -```js -import resolve from '@jridgewell/resolve-uri'; - -resolve('foo', 'https://example.com'); // => 'https://example.com/foo' -``` - -| Input | Base | Resolution | Explanation | -|-----------------------|-------------------------|--------------------------------|--------------------------------------------------------------| -| `https://example.com` | _any_ | `https://example.com/` | Input is normalized only | -| `//example.com` | `https://base.com/` | `https://example.com/` | Input inherits the base's protocol | -| `//example.com` | _rest_ | `//example.com/` | Input is normalized only | -| `/example` | `https://base.com/` | `https://base.com/example` | Input inherits the base's origin | -| `/example` | `//base.com/` | `//base.com/example` | Input inherits the base's host and remains protocol relative | -| `/example` | _rest_ | `/example` | Input is normalized only | -| `example` | `https://base.com/dir/` | `https://base.com/dir/example` | Input is joined with the base | -| `example` | `https://base.com/file` | `https://base.com/example` | Input is joined with the base without its file | -| `example` | `//base.com/dir/` | `//base.com/dir/example` | Input is joined with the base's last directory | -| `example` | `//base.com/file` | `//base.com/example` | Input is joined with the base without its file | -| `example` | `/base/dir/` | `/base/dir/example` | Input is joined with the base's last directory | -| `example` | `/base/file` | `/base/example` | Input is joined with the base without its file | -| `example` | `base/dir/` | `base/dir/example` | Input is joined with the base's last directory | -| `example` | `base/file` | `base/example` | Input is joined with the base without its file | diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs deleted file mode 100644 index e958e88..0000000 --- a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs +++ /dev/null @@ -1,232 +0,0 @@ -// Matches the scheme of a URL, eg "http://" -const schemeRegex = /^[\w+.-]+:\/\//; -/** - * Matches the parts of a URL: - * 1. Scheme, including ":", guaranteed. - * 2. User/password, including "@", optional. - * 3. Host, guaranteed. - * 4. Port, including ":", optional. - * 5. Path, including "/", optional. - * 6. Query, including "?", optional. - * 7. Hash, including "#", optional. - */ -const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; -/** - * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start - * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive). - * - * 1. Host, optional. - * 2. Path, which may include "/", guaranteed. - * 3. Query, including "?", optional. - * 4. Hash, including "#", optional. - */ -const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; -function isAbsoluteUrl(input) { - return schemeRegex.test(input); -} -function isSchemeRelativeUrl(input) { - return input.startsWith('//'); -} -function isAbsolutePath(input) { - return input.startsWith('/'); -} -function isFileUrl(input) { - return input.startsWith('file:'); -} -function isRelative(input) { - return /^[.?#]/.test(input); -} -function parseAbsoluteUrl(input) { - const match = urlRegex.exec(input); - return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || ''); -} -function parseFileUrl(input) { - const match = fileRegex.exec(input); - const path = match[2]; - return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || ''); -} -function makeUrl(scheme, user, host, port, path, query, hash) { - return { - scheme, - user, - host, - port, - path, - query, - hash, - type: 7 /* Absolute */, - }; -} -function parseUrl(input) { - if (isSchemeRelativeUrl(input)) { - const url = parseAbsoluteUrl('http:' + input); - url.scheme = ''; - url.type = 6 /* SchemeRelative */; - return url; - } - if (isAbsolutePath(input)) { - const url = parseAbsoluteUrl('http://foo.com' + input); - url.scheme = ''; - url.host = ''; - url.type = 5 /* AbsolutePath */; - return url; - } - if (isFileUrl(input)) - return parseFileUrl(input); - if (isAbsoluteUrl(input)) - return parseAbsoluteUrl(input); - const url = parseAbsoluteUrl('http://foo.com/' + input); - url.scheme = ''; - url.host = ''; - url.type = input - ? input.startsWith('?') - ? 3 /* Query */ - : input.startsWith('#') - ? 2 /* Hash */ - : 4 /* RelativePath */ - : 1 /* Empty */; - return url; -} -function stripPathFilename(path) { - // If a path ends with a parent directory "..", then it's a relative path with excess parent - // paths. It's not a file, so we can't strip it. - if (path.endsWith('/..')) - return path; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); -} -function mergePaths(url, base) { - normalizePath(base, base.type); - // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative - // path). - if (url.path === '/') { - url.path = base.path; - } - else { - // Resolution happens relative to the base path's directory, not the file. - url.path = stripPathFilename(base.path) + url.path; - } -} -/** - * The path can have empty directories "//", unneeded parents "foo/..", or current directory - * "foo/.". We need to normalize to a standard representation. - */ -function normalizePath(url, type) { - const rel = type <= 4 /* RelativePath */; - const pieces = url.path.split('/'); - // We need to preserve the first piece always, so that we output a leading slash. The item at - // pieces[0] is an empty string. - let pointer = 1; - // Positive is the number of real directories we've output, used for popping a parent directory. - // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo". - let positive = 0; - // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will - // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a - // real directory, we won't need to append, unless the other conditions happen again. - let addTrailingSlash = false; - for (let i = 1; i < pieces.length; i++) { - const piece = pieces[i]; - // An empty directory, could be a trailing slash, or just a double "//" in the path. - if (!piece) { - addTrailingSlash = true; - continue; - } - // If we encounter a real directory, then we don't need to append anymore. - addTrailingSlash = false; - // A current directory, which we can always drop. - if (piece === '.') - continue; - // A parent directory, we need to see if there are any real directories we can pop. Else, we - // have an excess of parents, and we'll need to keep the "..". - if (piece === '..') { - if (positive) { - addTrailingSlash = true; - positive--; - pointer--; - } - else if (rel) { - // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute - // URL, protocol relative URL, or an absolute path, we don't need to keep excess. - pieces[pointer++] = piece; - } - continue; - } - // We've encountered a real directory. Move it to the next insertion pointer, which accounts for - // any popped or dropped directories. - pieces[pointer++] = piece; - positive++; - } - let path = ''; - for (let i = 1; i < pointer; i++) { - path += '/' + pieces[i]; - } - if (!path || (addTrailingSlash && !path.endsWith('/..'))) { - path += '/'; - } - url.path = path; -} -/** - * Attempts to resolve `input` URL/path relative to `base`. - */ -function resolve(input, base) { - if (!input && !base) - return ''; - const url = parseUrl(input); - let inputType = url.type; - if (base && inputType !== 7 /* Absolute */) { - const baseUrl = parseUrl(base); - const baseType = baseUrl.type; - switch (inputType) { - case 1 /* Empty */: - url.hash = baseUrl.hash; - // fall through - case 2 /* Hash */: - url.query = baseUrl.query; - // fall through - case 3 /* Query */: - case 4 /* RelativePath */: - mergePaths(url, baseUrl); - // fall through - case 5 /* AbsolutePath */: - // The host, user, and port are joined, you can't copy one without the others. - url.user = baseUrl.user; - url.host = baseUrl.host; - url.port = baseUrl.port; - // fall through - case 6 /* SchemeRelative */: - // The input doesn't have a schema at least, so we need to copy at least that over. - url.scheme = baseUrl.scheme; - } - if (baseType > inputType) - inputType = baseType; - } - normalizePath(url, inputType); - const queryHash = url.query + url.hash; - switch (inputType) { - // This is impossible, because of the empty checks at the start of the function. - // case UrlType.Empty: - case 2 /* Hash */: - case 3 /* Query */: - return queryHash; - case 4 /* RelativePath */: { - // The first char is always a "/", and we need it to be relative. - const path = url.path.slice(1); - if (!path) - return queryHash || '.'; - if (isRelative(base || input) && !isRelative(path)) { - // If base started with a leading ".", or there is no base and input started with a ".", - // then we need to ensure that the relative path starts with a ".". We don't know if - // relative starts with a "..", though, so check before prepending. - return './' + path + queryHash; - } - return path + queryHash; - } - case 5 /* AbsolutePath */: - return url.path + queryHash; - default: - return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash; - } -} - -export { resolve as default }; -//# sourceMappingURL=resolve-uri.mjs.map diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map deleted file mode 100644 index 1de97d0..0000000 --- a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve-uri.mjs","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nconst enum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n let inputType = url.type;\n\n if (base && inputType !== UrlType.Absolute) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n\n switch (inputType) {\n case UrlType.Empty:\n url.hash = baseUrl.hash;\n // fall through\n\n case UrlType.Hash:\n url.query = baseUrl.query;\n // fall through\n\n case UrlType.Query:\n case UrlType.RelativePath:\n mergePaths(url, baseUrl);\n // fall through\n\n case UrlType.AbsolutePath:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n\n case UrlType.SchemeRelative:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType) inputType = baseType;\n }\n\n normalizePath(url, inputType);\n\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n\n case UrlType.Hash:\n case UrlType.Query:\n return queryHash;\n\n case UrlType.RelativePath: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n\n if (!path) return queryHash || '.';\n\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n\n return path + queryHash;\n }\n\n case UrlType.AbsolutePath:\n return url.path + queryHash;\n\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n}\n"],"names":[],"mappings":"AAAA;AACA,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC;;;;;;;;;;AAUA,MAAM,QAAQ,GAAG,0EAA0E,CAAC;AAE5F;;;;;;;;;AASA,MAAM,SAAS,GAAG,iEAAiE,CAAC;AAuBpF,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,WAAW,CAAC,IAAI,CAAC,K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AE,OAAO,CAAC,CAAC;;YAG3B;;gBAEE,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;gBACxB,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;gBACxB,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;;YAG1B;;gBAEE,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;SAC/B;QACD,IAAI,QAAQ,GAAG,SAAS;YAAE,SAAS,GAAG,QAAQ,CAAC;KAChD;IAED,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAE9B,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC;IACvC,QAAQ,SAAS;;;QAIf,kBAAkB;QAClB;YACE,OAAO,SAAS,CAAC;QAEnB,2BAA2B;;YAEzB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAE/B,IAAI,CAAC,IAAI;gBAAE,OAAO,SAAS,IAAI,GAAG,CAAC;YAEnC,IAAI,UAAU,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;;;;gBAIlD,OAAO,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;aAChC;YAED,OAAO,IAAI,GAAG,SAAS,CAAC;SACzB;QAED;YACE,OAAO,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;QAE9B;YACE,OAAO,GAAG,CAAC,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;KACpF;AACH;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js deleted file mode 100644 index a783049..0000000 --- a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js +++ /dev/null @@ -1,240 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.resolveURI = factory()); -})(this, (function () { 'use strict'; - - // Matches the scheme of a URL, eg "http://" - const schemeRegex = /^[\w+.-]+:\/\//; - /** - * Matches the parts of a URL: - * 1. Scheme, including ":", guaranteed. - * 2. User/password, including "@", optional. - * 3. Host, guaranteed. - * 4. Port, including ":", optional. - * 5. Path, including "/", optional. - * 6. Query, including "?", optional. - * 7. Hash, including "#", optional. - */ - const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; - /** - * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start - * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive). - * - * 1. Host, optional. - * 2. Path, which may include "/", guaranteed. - * 3. Query, including "?", optional. - * 4. Hash, including "#", optional. - */ - const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; - function isAbsoluteUrl(input) { - return schemeRegex.test(input); - } - function isSchemeRelativeUrl(input) { - return input.startsWith('//'); - } - function isAbsolutePath(input) { - return input.startsWith('/'); - } - function isFileUrl(input) { - return input.startsWith('file:'); - } - function isRelative(input) { - return /^[.?#]/.test(input); - } - function parseAbsoluteUrl(input) { - const match = urlRegex.exec(input); - return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || ''); - } - function parseFileUrl(input) { - const match = fileRegex.exec(input); - const path = match[2]; - return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || ''); - } - function makeUrl(scheme, user, host, port, path, query, hash) { - return { - scheme, - user, - host, - port, - path, - query, - hash, - type: 7 /* Absolute */, - }; - } - function parseUrl(input) { - if (isSchemeRelativeUrl(input)) { - const url = parseAbsoluteUrl('http:' + input); - url.scheme = ''; - url.type = 6 /* SchemeRelative */; - return url; - } - if (isAbsolutePath(input)) { - const url = parseAbsoluteUrl('http://foo.com' + input); - url.scheme = ''; - url.host = ''; - url.type = 5 /* AbsolutePath */; - return url; - } - if (isFileUrl(input)) - return parseFileUrl(input); - if (isAbsoluteUrl(input)) - return parseAbsoluteUrl(input); - const url = parseAbsoluteUrl('http://foo.com/' + input); - url.scheme = ''; - url.host = ''; - url.type = input - ? input.startsWith('?') - ? 3 /* Query */ - : input.startsWith('#') - ? 2 /* Hash */ - : 4 /* RelativePath */ - : 1 /* Empty */; - return url; - } - function stripPathFilename(path) { - // If a path ends with a parent directory "..", then it's a relative path with excess parent - // paths. It's not a file, so we can't strip it. - if (path.endsWith('/..')) - return path; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); - } - function mergePaths(url, base) { - normalizePath(base, base.type); - // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative - // path). - if (url.path === '/') { - url.path = base.path; - } - else { - // Resolution happens relative to the base path's directory, not the file. - url.path = stripPathFilename(base.path) + url.path; - } - } - /** - * The path can have empty directories "//", unneeded parents "foo/..", or current directory - * "foo/.". We need to normalize to a standard representation. - */ - function normalizePath(url, type) { - const rel = type <= 4 /* RelativePath */; - const pieces = url.path.split('/'); - // We need to preserve the first piece always, so that we output a leading slash. The item at - // pieces[0] is an empty string. - let pointer = 1; - // Positive is the number of real directories we've output, used for popping a parent directory. - // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo". - let positive = 0; - // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will - // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a - // real directory, we won't need to append, unless the other conditions happen again. - let addTrailingSlash = false; - for (let i = 1; i < pieces.length; i++) { - const piece = pieces[i]; - // An empty directory, could be a trailing slash, or just a double "//" in the path. - if (!piece) { - addTrailingSlash = true; - continue; - } - // If we encounter a real directory, then we don't need to append anymore. - addTrailingSlash = false; - // A current directory, which we can always drop. - if (piece === '.') - continue; - // A parent directory, we need to see if there are any real directories we can pop. Else, we - // have an excess of parents, and we'll need to keep the "..". - if (piece === '..') { - if (positive) { - addTrailingSlash = true; - positive--; - pointer--; - } - else if (rel) { - // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute - // URL, protocol relative URL, or an absolute path, we don't need to keep excess. - pieces[pointer++] = piece; - } - continue; - } - // We've encountered a real directory. Move it to the next insertion pointer, which accounts for - // any popped or dropped directories. - pieces[pointer++] = piece; - positive++; - } - let path = ''; - for (let i = 1; i < pointer; i++) { - path += '/' + pieces[i]; - } - if (!path || (addTrailingSlash && !path.endsWith('/..'))) { - path += '/'; - } - url.path = path; - } - /** - * Attempts to resolve `input` URL/path relative to `base`. - */ - function resolve(input, base) { - if (!input && !base) - return ''; - const url = parseUrl(input); - let inputType = url.type; - if (base && inputType !== 7 /* Absolute */) { - const baseUrl = parseUrl(base); - const baseType = baseUrl.type; - switch (inputType) { - case 1 /* Empty */: - url.hash = baseUrl.hash; - // fall through - case 2 /* Hash */: - url.query = baseUrl.query; - // fall through - case 3 /* Query */: - case 4 /* RelativePath */: - mergePaths(url, baseUrl); - // fall through - case 5 /* AbsolutePath */: - // The host, user, and port are joined, you can't copy one without the others. - url.user = baseUrl.user; - url.host = baseUrl.host; - url.port = baseUrl.port; - // fall through - case 6 /* SchemeRelative */: - // The input doesn't have a schema at least, so we need to copy at least that over. - url.scheme = baseUrl.scheme; - } - if (baseType > inputType) - inputType = baseType; - } - normalizePath(url, inputType); - const queryHash = url.query + url.hash; - switch (inputType) { - // This is impossible, because of the empty checks at the start of the function. - // case UrlType.Empty: - case 2 /* Hash */: - case 3 /* Query */: - return queryHash; - case 4 /* RelativePath */: { - // The first char is always a "/", and we need it to be relative. - const path = url.path.slice(1); - if (!path) - return queryHash || '.'; - if (isRelative(base || input) && !isRelative(path)) { - // If base started with a leading ".", or there is no base and input started with a ".", - // then we need to ensure that the relative path starts with a ".". We don't know if - // relative starts with a "..", though, so check before prepending. - return './' + path + queryHash; - } - return path + queryHash; - } - case 5 /* AbsolutePath */: - return url.path + queryHash; - default: - return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash; - } - } - - return resolve; - -})); -//# sourceMappingURL=resolve-uri.umd.js.map diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map deleted file mode 100644 index 70a37f2..0000000 --- a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve-uri.umd.js","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nconst enum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n let inputType = url.type;\n\n if (base && inputType !== UrlType.Absolute) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n\n switch (inputType) {\n case UrlType.Empty:\n url.hash = baseUrl.hash;\n // fall through\n\n case UrlType.Hash:\n url.query = baseUrl.query;\n // fall through\n\n case UrlType.Query:\n case UrlType.RelativePath:\n mergePaths(url, baseUrl);\n // fall through\n\n case UrlType.AbsolutePath:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n\n case UrlType.SchemeRelative:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType) inputType = baseType;\n }\n\n normalizePath(url, inputType);\n\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n\n case UrlType.Hash:\n case UrlType.Query:\n return queryHash;\n\n case UrlType.RelativePath: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n\n if (!path) return queryHash || '.';\n\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n\n return path + queryHash;\n }\n\n case UrlType.AbsolutePath:\n return url.path + queryHash;\n\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash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,CAAC,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;SACpF;IACH;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts b/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts deleted file mode 100644 index b7f0b3b..0000000 --- a/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Attempts to resolve `input` URL/path relative to `base`. - */ -export default function resolve(input: string, base: string | undefined): string; diff --git a/node_modules/@jridgewell/resolve-uri/package.json b/node_modules/@jridgewell/resolve-uri/package.json deleted file mode 100644 index 02a4c51..0000000 --- a/node_modules/@jridgewell/resolve-uri/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@jridgewell/resolve-uri", - "version": "3.1.2", - "description": "Resolve a URI relative to an optional base URI", - "keywords": [ - "resolve", - "uri", - "url", - "path" - ], - "author": "Justin Ridgewell ", - "license": "MIT", - "repository": "https://github.com/jridgewell/resolve-uri", - "main": "dist/resolve-uri.umd.js", - "module": "dist/resolve-uri.mjs", - "types": "dist/types/resolve-uri.d.ts", - "exports": { - ".": [ - { - "types": "./dist/types/resolve-uri.d.ts", - "browser": "./dist/resolve-uri.umd.js", - "require": "./dist/resolve-uri.umd.js", - "import": "./dist/resolve-uri.mjs" - }, - "./dist/resolve-uri.umd.js" - ], - "./package.json": "./package.json" - }, - "files": [ - "dist" - ], - "engines": { - "node": ">=6.0.0" - }, - "scripts": { - "prebuild": "rm -rf dist", - "build": "run-s -n build:*", - "build:rollup": "rollup -c rollup.config.js", - "build:ts": "tsc --project tsconfig.build.json", - "lint": "run-s -n lint:*", - "lint:prettier": "npm run test:lint:prettier -- --write", - "lint:ts": "npm run test:lint:ts -- --fix", - "pretest": "run-s build:rollup", - "test": "run-s -n test:lint test:only", - "test:debug": "mocha --inspect-brk", - "test:lint": "run-s -n test:lint:*", - "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", - "test:lint:ts": "eslint '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:coverage": "c8 mocha", - "test:watch": "mocha --watch", - "prepublishOnly": "npm run preversion", - "preversion": "run-s test build" - }, - "devDependencies": { - "@jridgewell/resolve-uri-latest": "npm:@jridgewell/resolve-uri@*", - "@rollup/plugin-typescript": "8.3.0", - "@typescript-eslint/eslint-plugin": "5.10.0", - "@typescript-eslint/parser": "5.10.0", - "c8": "7.11.0", - "eslint": "8.7.0", - "eslint-config-prettier": "8.3.0", - "mocha": "9.2.0", - "npm-run-all": "4.1.5", - "prettier": "2.5.1", - "rollup": "2.66.0", - "typescript": "4.5.5" - } -} diff --git a/node_modules/@jridgewell/sourcemap-codec/LICENSE b/node_modules/@jridgewell/sourcemap-codec/LICENSE deleted file mode 100644 index 1f6ce94..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2024 Justin Ridgewell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@jridgewell/sourcemap-codec/README.md b/node_modules/@jridgewell/sourcemap-codec/README.md deleted file mode 100644 index b3e0708..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/README.md +++ /dev/null @@ -1,264 +0,0 @@ -# @jridgewell/sourcemap-codec - -Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit). - - -## Why? - -Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap. - -This package makes the process slightly easier. - - -## Installation - -```bash -npm install @jridgewell/sourcemap-codec -``` - - -## Usage - -```js -import { encode, decode } from '@jridgewell/sourcemap-codec'; - -var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); - -assert.deepEqual( decoded, [ - // the first line (of the generated code) has no mappings, - // as shown by the starting semi-colon (which separates lines) - [], - - // the second line contains four (comma-separated) segments - [ - // segments are encoded as you'd expect: - // [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ] - - // i.e. the first segment begins at column 2, and maps back to the second column - // of the second line (both zero-based) of the 0th source, and uses the 0th - // name in the `map.names` array - [ 2, 0, 2, 2, 0 ], - - // the remaining segments are 4-length rather than 5-length, - // because they don't map a name - [ 4, 0, 2, 4 ], - [ 6, 0, 2, 5 ], - [ 7, 0, 2, 7 ] - ], - - // the final line contains two segments - [ - [ 2, 1, 10, 19 ], - [ 12, 1, 11, 20 ] - ] -]); - -var encoded = encode( decoded ); -assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); -``` - -## Benchmarks - -``` -node v20.10.0 - -amp.js.map - 45120 segments - -Decode Memory Usage: -local code 5815135 bytes -@jridgewell/sourcemap-codec 1.4.15 5868160 bytes -sourcemap-codec 5492584 bytes -source-map-0.6.1 13569984 bytes -source-map-0.8.0 6390584 bytes -chrome dev tools 8011136 bytes -Smallest memory usage is sourcemap-codec - -Decode speed: -decode: local code x 492 ops/sec ±1.22% (90 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 499 ops/sec ±1.16% (89 runs sampled) -decode: sourcemap-codec x 376 ops/sec ±1.66% (89 runs sampled) -decode: source-map-0.6.1 x 34.99 ops/sec ±0.94% (48 runs sampled) -decode: source-map-0.8.0 x 351 ops/sec ±0.07% (95 runs sampled) -chrome dev tools x 165 ops/sec ±0.91% (86 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 - -Encode Memory Usage: -local code 444248 bytes -@jridgewell/sourcemap-codec 1.4.15 623024 bytes -sourcemap-codec 8696280 bytes -source-map-0.6.1 8745176 bytes -source-map-0.8.0 8736624 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 796 ops/sec ±0.11% (97 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 795 ops/sec ±0.25% (98 runs sampled) -encode: sourcemap-codec x 231 ops/sec ±0.83% (86 runs sampled) -encode: source-map-0.6.1 x 166 ops/sec ±0.57% (86 runs sampled) -encode: source-map-0.8.0 x 203 ops/sec ±0.45% (88 runs sampled) -Fastest is encode: local code,encode: @jridgewell/sourcemap-codec 1.4.15 - - -*** - - -babel.min.js.map - 347793 segments - -Decode Memory Usage: -local code 35424960 bytes -@jridgewell/sourcemap-codec 1.4.15 35424696 bytes -sourcemap-codec 36033464 bytes -source-map-0.6.1 62253704 bytes -source-map-0.8.0 43843920 bytes -chrome dev tools 45111400 bytes -Smallest memory usage is @jridgewell/sourcemap-codec 1.4.15 - -Decode speed: -decode: local code x 38.18 ops/sec ±5.44% (52 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 38.36 ops/sec ±5.02% (52 runs sampled) -decode: sourcemap-codec x 34.05 ops/sec ±4.45% (47 runs sampled) -decode: source-map-0.6.1 x 4.31 ops/sec ±2.76% (15 runs sampled) -decode: source-map-0.8.0 x 55.60 ops/sec ±0.13% (73 runs sampled) -chrome dev tools x 16.94 ops/sec ±3.78% (46 runs sampled) -Fastest is decode: source-map-0.8.0 - -Encode Memory Usage: -local code 2606016 bytes -@jridgewell/sourcemap-codec 1.4.15 2626440 bytes -sourcemap-codec 21152576 bytes -source-map-0.6.1 25023928 bytes -source-map-0.8.0 25256448 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 127 ops/sec ±0.18% (83 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 128 ops/sec ±0.26% (83 runs sampled) -encode: sourcemap-codec x 29.31 ops/sec ±2.55% (53 runs sampled) -encode: source-map-0.6.1 x 18.85 ops/sec ±3.19% (36 runs sampled) -encode: source-map-0.8.0 x 19.34 ops/sec ±1.97% (36 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec 1.4.15 - - -*** - - -preact.js.map - 1992 segments - -Decode Memory Usage: -local code 261696 bytes -@jridgewell/sourcemap-codec 1.4.15 244296 bytes -sourcemap-codec 302816 bytes -source-map-0.6.1 939176 bytes -source-map-0.8.0 336 bytes -chrome dev tools 587368 bytes -Smallest memory usage is source-map-0.8.0 - -Decode speed: -decode: local code x 17,782 ops/sec ±0.32% (97 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 17,863 ops/sec ±0.40% (100 runs sampled) -decode: sourcemap-codec x 12,453 ops/sec ±0.27% (101 runs sampled) -decode: source-map-0.6.1 x 1,288 ops/sec ±1.05% (96 runs sampled) -decode: source-map-0.8.0 x 9,289 ops/sec ±0.27% (101 runs sampled) -chrome dev tools x 4,769 ops/sec ±0.18% (100 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 - -Encode Memory Usage: -local code 262944 bytes -@jridgewell/sourcemap-codec 1.4.15 25544 bytes -sourcemap-codec 323048 bytes -source-map-0.6.1 507808 bytes -source-map-0.8.0 507480 bytes -Smallest memory usage is @jridgewell/sourcemap-codec 1.4.15 - -Encode speed: -encode: local code x 24,207 ops/sec ±0.79% (95 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 24,288 ops/sec ±0.48% (96 runs sampled) -encode: sourcemap-codec x 6,761 ops/sec ±0.21% (100 runs sampled) -encode: source-map-0.6.1 x 5,374 ops/sec ±0.17% (99 runs sampled) -encode: source-map-0.8.0 x 5,633 ops/sec ±0.32% (99 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec 1.4.15,encode: local code - - -*** - - -react.js.map - 5726 segments - -Decode Memory Usage: -local code 678816 bytes -@jridgewell/sourcemap-codec 1.4.15 678816 bytes -sourcemap-codec 816400 bytes -source-map-0.6.1 2288864 bytes -source-map-0.8.0 721360 bytes -chrome dev tools 1012512 bytes -Smallest memory usage is local code - -Decode speed: -decode: local code x 6,178 ops/sec ±0.19% (98 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 6,261 ops/sec ±0.22% (100 runs sampled) -decode: sourcemap-codec x 4,472 ops/sec ±0.90% (99 runs sampled) -decode: source-map-0.6.1 x 449 ops/sec ±0.31% (95 runs sampled) -decode: source-map-0.8.0 x 3,219 ops/sec ±0.13% (100 runs sampled) -chrome dev tools x 1,743 ops/sec ±0.20% (99 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 - -Encode Memory Usage: -local code 140960 bytes -@jridgewell/sourcemap-codec 1.4.15 159808 bytes -sourcemap-codec 969304 bytes -source-map-0.6.1 930520 bytes -source-map-0.8.0 930248 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 8,013 ops/sec ±0.19% (100 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 7,989 ops/sec ±0.20% (101 runs sampled) -encode: sourcemap-codec x 2,472 ops/sec ±0.21% (99 runs sampled) -encode: source-map-0.6.1 x 2,200 ops/sec ±0.17% (99 runs sampled) -encode: source-map-0.8.0 x 2,220 ops/sec ±0.37% (99 runs sampled) -Fastest is encode: local code - - -*** - - -vscode.map - 2141001 segments - -Decode Memory Usage: -local code 198955264 bytes -@jridgewell/sourcemap-codec 1.4.15 199175352 bytes -sourcemap-codec 199102688 bytes -source-map-0.6.1 386323432 bytes -source-map-0.8.0 244116432 bytes -chrome dev tools 293734280 bytes -Smallest memory usage is local code - -Decode speed: -decode: local code x 3.90 ops/sec ±22.21% (15 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 3.95 ops/sec ±23.53% (15 runs sampled) -decode: sourcemap-codec x 3.82 ops/sec ±17.94% (14 runs sampled) -decode: source-map-0.6.1 x 0.61 ops/sec ±7.81% (6 runs sampled) -decode: source-map-0.8.0 x 9.54 ops/sec ±0.28% (28 runs sampled) -chrome dev tools x 2.18 ops/sec ±10.58% (10 runs sampled) -Fastest is decode: source-map-0.8.0 - -Encode Memory Usage: -local code 13509880 bytes -@jridgewell/sourcemap-codec 1.4.15 13537648 bytes -sourcemap-codec 32540104 bytes -source-map-0.6.1 127531040 bytes -source-map-0.8.0 127535312 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 20.10 ops/sec ±0.19% (38 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 20.26 ops/sec ±0.32% (38 runs sampled) -encode: sourcemap-codec x 5.44 ops/sec ±1.64% (18 runs sampled) -encode: source-map-0.6.1 x 2.30 ops/sec ±4.79% (10 runs sampled) -encode: source-map-0.8.0 x 2.46 ops/sec ±6.53% (10 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec 1.4.15 -``` - -# License - -MIT diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs deleted file mode 100644 index 532bab3..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +++ /dev/null @@ -1,423 +0,0 @@ -// src/vlq.ts -var comma = ",".charCodeAt(0); -var semicolon = ";".charCodeAt(0); -var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var intToChar = new Uint8Array(64); -var charToInt = new Uint8Array(128); -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -function decodeInteger(reader, relative) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -2147483648 | -value; - } - return relative + value; -} -function encodeInteger(builder, num, relative) { - let delta = num - relative; - delta = delta < 0 ? -delta << 1 | 1 : delta << 1; - do { - let clamped = delta & 31; - delta >>>= 5; - if (delta > 0) clamped |= 32; - builder.write(intToChar[clamped]); - } while (delta > 0); - return num; -} -function hasMoreVlq(reader, max) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} - -// src/strings.ts -var bufLength = 1024 * 16; -var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - } -} : { - decode(buf) { - let out = ""; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - } -}; -var StringWriter = class { - constructor() { - this.pos = 0; - this.out = ""; - this.buffer = new Uint8Array(bufLength); - } - write(v) { - const { buffer } = this; - buffer[this.pos++] = v; - if (this.pos === bufLength) { - this.out += td.decode(buffer); - this.pos = 0; - } - } - flush() { - const { buffer, out, pos } = this; - return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; - } -}; -var StringReader = class { - constructor(buffer) { - this.pos = 0; - this.buffer = buffer; - } - next() { - return this.buffer.charCodeAt(this.pos++); - } - peek() { - return this.buffer.charCodeAt(this.pos); - } - indexOf(char) { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -}; - -// src/scopes.ts -var EMPTY = []; -function decodeOriginalScopes(input) { - const { length } = input; - const reader = new StringReader(input); - const scopes = []; - const stack = []; - let line = 0; - for (; reader.pos < length; reader.pos++) { - line = decodeInteger(reader, line); - const column = decodeInteger(reader, 0); - if (!hasMoreVlq(reader, length)) { - const last = stack.pop(); - last[2] = line; - last[3] = column; - continue; - } - const kind = decodeInteger(reader, 0); - const fields = decodeInteger(reader, 0); - const hasName = fields & 1; - const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]; - let vars = EMPTY; - if (hasMoreVlq(reader, length)) { - vars = []; - do { - const varsIndex = decodeInteger(reader, 0); - vars.push(varsIndex); - } while (hasMoreVlq(reader, length)); - } - scope.vars = vars; - scopes.push(scope); - stack.push(scope); - } - return scopes; -} -function encodeOriginalScopes(scopes) { - const writer = new StringWriter(); - for (let i = 0; i < scopes.length; ) { - i = _encodeOriginalScopes(scopes, i, writer, [0]); - } - return writer.flush(); -} -function _encodeOriginalScopes(scopes, index, writer, state) { - const scope = scopes[index]; - const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; - if (index > 0) writer.write(comma); - state[0] = encodeInteger(writer, startLine, state[0]); - encodeInteger(writer, startColumn, 0); - encodeInteger(writer, kind, 0); - const fields = scope.length === 6 ? 1 : 0; - encodeInteger(writer, fields, 0); - if (scope.length === 6) encodeInteger(writer, scope[5], 0); - for (const v of vars) { - encodeInteger(writer, v, 0); - } - for (index++; index < scopes.length; ) { - const next = scopes[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeOriginalScopes(scopes, index, writer, state); - } - writer.write(comma); - state[0] = encodeInteger(writer, endLine, state[0]); - encodeInteger(writer, endColumn, 0); - return index; -} -function decodeGeneratedRanges(input) { - const { length } = input; - const reader = new StringReader(input); - const ranges = []; - const stack = []; - let genLine = 0; - let definitionSourcesIndex = 0; - let definitionScopeIndex = 0; - let callsiteSourcesIndex = 0; - let callsiteLine = 0; - let callsiteColumn = 0; - let bindingLine = 0; - let bindingColumn = 0; - do { - const semi = reader.indexOf(";"); - let genColumn = 0; - for (; reader.pos < semi; reader.pos++) { - genColumn = decodeInteger(reader, genColumn); - if (!hasMoreVlq(reader, semi)) { - const last = stack.pop(); - last[2] = genLine; - last[3] = genColumn; - continue; - } - const fields = decodeInteger(reader, 0); - const hasDefinition = fields & 1; - const hasCallsite = fields & 2; - const hasScope = fields & 4; - let callsite = null; - let bindings = EMPTY; - let range; - if (hasDefinition) { - const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); - definitionScopeIndex = decodeInteger( - reader, - definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0 - ); - definitionSourcesIndex = defSourcesIndex; - range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex]; - } else { - range = [genLine, genColumn, 0, 0]; - } - range.isScope = !!hasScope; - if (hasCallsite) { - const prevCsi = callsiteSourcesIndex; - const prevLine = callsiteLine; - callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); - const sameSource = prevCsi === callsiteSourcesIndex; - callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); - callsiteColumn = decodeInteger( - reader, - sameSource && prevLine === callsiteLine ? callsiteColumn : 0 - ); - callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; - } - range.callsite = callsite; - if (hasMoreVlq(reader, semi)) { - bindings = []; - do { - bindingLine = genLine; - bindingColumn = genColumn; - const expressionsCount = decodeInteger(reader, 0); - let expressionRanges; - if (expressionsCount < -1) { - expressionRanges = [[decodeInteger(reader, 0)]]; - for (let i = -1; i > expressionsCount; i--) { - const prevBl = bindingLine; - bindingLine = decodeInteger(reader, bindingLine); - bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); - const expression = decodeInteger(reader, 0); - expressionRanges.push([expression, bindingLine, bindingColumn]); - } - } else { - expressionRanges = [[expressionsCount]]; - } - bindings.push(expressionRanges); - } while (hasMoreVlq(reader, semi)); - } - range.bindings = bindings; - ranges.push(range); - stack.push(range); - } - genLine++; - reader.pos = semi + 1; - } while (reader.pos < length); - return ranges; -} -function encodeGeneratedRanges(ranges) { - if (ranges.length === 0) return ""; - const writer = new StringWriter(); - for (let i = 0; i < ranges.length; ) { - i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); - } - return writer.flush(); -} -function _encodeGeneratedRanges(ranges, index, writer, state) { - const range = ranges[index]; - const { - 0: startLine, - 1: startColumn, - 2: endLine, - 3: endColumn, - isScope, - callsite, - bindings - } = range; - if (state[0] < startLine) { - catchupLine(writer, state[0], startLine); - state[0] = startLine; - state[1] = 0; - } else if (index > 0) { - writer.write(comma); - } - state[1] = encodeInteger(writer, range[1], state[1]); - const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0); - encodeInteger(writer, fields, 0); - if (range.length === 6) { - const { 4: sourcesIndex, 5: scopesIndex } = range; - if (sourcesIndex !== state[2]) { - state[3] = 0; - } - state[2] = encodeInteger(writer, sourcesIndex, state[2]); - state[3] = encodeInteger(writer, scopesIndex, state[3]); - } - if (callsite) { - const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite; - if (sourcesIndex !== state[4]) { - state[5] = 0; - state[6] = 0; - } else if (callLine !== state[5]) { - state[6] = 0; - } - state[4] = encodeInteger(writer, sourcesIndex, state[4]); - state[5] = encodeInteger(writer, callLine, state[5]); - state[6] = encodeInteger(writer, callColumn, state[6]); - } - if (bindings) { - for (const binding of bindings) { - if (binding.length > 1) encodeInteger(writer, -binding.length, 0); - const expression = binding[0][0]; - encodeInteger(writer, expression, 0); - let bindingStartLine = startLine; - let bindingStartColumn = startColumn; - for (let i = 1; i < binding.length; i++) { - const expRange = binding[i]; - bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine); - bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn); - encodeInteger(writer, expRange[0], 0); - } - } - } - for (index++; index < ranges.length; ) { - const next = ranges[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeGeneratedRanges(ranges, index, writer, state); - } - if (state[0] < endLine) { - catchupLine(writer, state[0], endLine); - state[0] = endLine; - state[1] = 0; - } else { - writer.write(comma); - } - state[1] = encodeInteger(writer, endColumn, state[1]); - return index; -} -function catchupLine(writer, lastLine, line) { - do { - writer.write(semicolon); - } while (++lastLine < line); -} - -// src/sourcemap-codec.ts -function decode(mappings) { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - do { - const semi = reader.indexOf(";"); - const line = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - while (reader.pos < semi) { - let seg; - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - line.push(seg); - reader.pos++; - } - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - return decoded; -} -function sort(line) { - line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[0] - b[0]; -} -function encode(decoded) { - const writer = new StringWriter(); - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) writer.write(semicolon); - if (line.length === 0) continue; - let genColumn = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - if (j > 0) writer.write(comma); - genColumn = encodeInteger(writer, segment[0], genColumn); - if (segment.length === 1) continue; - sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); - sourceLine = encodeInteger(writer, segment[2], sourceLine); - sourceColumn = encodeInteger(writer, segment[3], sourceColumn); - if (segment.length === 4) continue; - namesIndex = encodeInteger(writer, segment[4], namesIndex); - } - } - return writer.flush(); -} -export { - decode, - decodeGeneratedRanges, - decodeOriginalScopes, - encode, - encodeGeneratedRanges, - encodeOriginalScopes -}; -//# sourceMappingURL=sourcemap-codec.mjs.map diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map deleted file mode 100644 index c276844..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["../src/vlq.ts", "../src/strings.ts", "../src/scopes.ts", "../src/sourcemap-codec.ts"], - "mappings": ";AAEO,IAAM,QAAQ,IAAI,WAAW,CAAC;AAC9B,IAAM,YAAY,IAAI,WAAW,CAAC;AAEzC,IAAM,QAAQ;AACd,IAAM,YAAY,IAAI,WAAW,EAAE;AACnC,IAAM,YAAY,IAAI,WAAW,GAAG;AAEpC,SAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,QAAM,IAAI,MAAM,WAAW,CAAC;AAC5B,YAAU,CAAC,IAAI;AACf,YAAU,CAAC,IAAI;AACjB;AAEO,SAAS,cAAc,QAAsB,UAA0B;AAC5E,MAAI,QAAQ;AACZ,MAAI,QAAQ;AACZ,MAAI,UAAU;AAEd,KAAG;AACD,UAAM,IAAI,OAAO,KAAK;AACtB,cAAU,UAAU,CAAC;AACrB,cAAU,UAAU,OAAO;AAC3B,aAAS;AAAA,EACX,SAAS,UAAU;AAEnB,QAAM,eAAe,QAAQ;AAC7B,a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C;AACnB;AAIO,SAAS,OAAO,SAA8C;AACnE,QAAM,SAAS,IAAI,aAAa;AAChC,MAAI,eAAe;AACnB,MAAI,aAAa;AACjB,MAAI,eAAe;AACnB,MAAI,aAAa;AAEjB,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,UAAM,OAAO,QAAQ,CAAC;AACtB,QAAI,IAAI,EAAG,QAAO,MAAM,SAAS;AACjC,QAAI,KAAK,WAAW,EAAG;AAEvB,QAAI,YAAY;AAEhB,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,YAAM,UAAU,KAAK,CAAC;AACtB,UAAI,IAAI,EAAG,QAAO,MAAM,KAAK;AAE7B,kBAAY,cAAc,QAAQ,QAAQ,CAAC,GAAG,SAAS;AAEvD,UAAI,QAAQ,WAAW,EAAG;AAC1B,qBAAe,cAAc,QAAQ,QAAQ,CAAC,GAAG,YAAY;AAC7D,mBAAa,cAAc,QAAQ,QAAQ,CAAC,GAAG,UAAU;AACzD,qBAAe,cAAc,QAAQ,QAAQ,CAAC,GAAG,YAAY;AAE7D,UAAI,QAAQ,WAAW,EAAG;AAC1B,mBAAa,cAAc,QAAQ,QAAQ,CAAC,GAAG,UAAU;AAAA,IAC3D;AAAA,EACF;AAEA,SAAO,OAAO,MAAM;AACtB;", - "names": [] -} diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js deleted file mode 100644 index 2d8e459..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +++ /dev/null @@ -1,464 +0,0 @@ -(function (global, factory) { - if (typeof exports === 'object' && typeof module !== 'undefined') { - factory(module); - module.exports = def(module); - } else if (typeof define === 'function' && define.amd) { - define(['module'], function(mod) { - factory.apply(this, arguments); - mod.exports = def(mod); - }); - } else { - const mod = { exports: {} }; - factory(mod); - global = typeof globalThis !== 'undefined' ? globalThis : global || self; - global.sourcemapCodec = def(mod); - } - function def(m) { return 'default' in m.exports ? m.exports.default : m.exports; } -})(this, (function (module) { -"use strict"; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// src/sourcemap-codec.ts -var sourcemap_codec_exports = {}; -__export(sourcemap_codec_exports, { - decode: () => decode, - decodeGeneratedRanges: () => decodeGeneratedRanges, - decodeOriginalScopes: () => decodeOriginalScopes, - encode: () => encode, - encodeGeneratedRanges: () => encodeGeneratedRanges, - encodeOriginalScopes: () => encodeOriginalScopes -}); -module.exports = __toCommonJS(sourcemap_codec_exports); - -// src/vlq.ts -var comma = ",".charCodeAt(0); -var semicolon = ";".charCodeAt(0); -var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var intToChar = new Uint8Array(64); -var charToInt = new Uint8Array(128); -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -function decodeInteger(reader, relative) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -2147483648 | -value; - } - return relative + value; -} -function encodeInteger(builder, num, relative) { - let delta = num - relative; - delta = delta < 0 ? -delta << 1 | 1 : delta << 1; - do { - let clamped = delta & 31; - delta >>>= 5; - if (delta > 0) clamped |= 32; - builder.write(intToChar[clamped]); - } while (delta > 0); - return num; -} -function hasMoreVlq(reader, max) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} - -// src/strings.ts -var bufLength = 1024 * 16; -var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - } -} : { - decode(buf) { - let out = ""; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - } -}; -var StringWriter = class { - constructor() { - this.pos = 0; - this.out = ""; - this.buffer = new Uint8Array(bufLength); - } - write(v) { - const { buffer } = this; - buffer[this.pos++] = v; - if (this.pos === bufLength) { - this.out += td.decode(buffer); - this.pos = 0; - } - } - flush() { - const { buffer, out, pos } = this; - return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; - } -}; -var StringReader = class { - constructor(buffer) { - this.pos = 0; - this.buffer = buffer; - } - next() { - return this.buffer.charCodeAt(this.pos++); - } - peek() { - return this.buffer.charCodeAt(this.pos); - } - indexOf(char) { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -}; - -// src/scopes.ts -var EMPTY = []; -function decodeOriginalScopes(input) { - const { length } = input; - const reader = new StringReader(input); - const scopes = []; - const stack = []; - let line = 0; - for (; reader.pos < length; reader.pos++) { - line = decodeInteger(reader, line); - const column = decodeInteger(reader, 0); - if (!hasMoreVlq(reader, length)) { - const last = stack.pop(); - last[2] = line; - last[3] = column; - continue; - } - const kind = decodeInteger(reader, 0); - const fields = decodeInteger(reader, 0); - const hasName = fields & 1; - const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]; - let vars = EMPTY; - if (hasMoreVlq(reader, length)) { - vars = []; - do { - const varsIndex = decodeInteger(reader, 0); - vars.push(varsIndex); - } while (hasMoreVlq(reader, length)); - } - scope.vars = vars; - scopes.push(scope); - stack.push(scope); - } - return scopes; -} -function encodeOriginalScopes(scopes) { - const writer = new StringWriter(); - for (let i = 0; i < scopes.length; ) { - i = _encodeOriginalScopes(scopes, i, writer, [0]); - } - return writer.flush(); -} -function _encodeOriginalScopes(scopes, index, writer, state) { - const scope = scopes[index]; - const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; - if (index > 0) writer.write(comma); - state[0] = encodeInteger(writer, startLine, state[0]); - encodeInteger(writer, startColumn, 0); - encodeInteger(writer, kind, 0); - const fields = scope.length === 6 ? 1 : 0; - encodeInteger(writer, fields, 0); - if (scope.length === 6) encodeInteger(writer, scope[5], 0); - for (const v of vars) { - encodeInteger(writer, v, 0); - } - for (index++; index < scopes.length; ) { - const next = scopes[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeOriginalScopes(scopes, index, writer, state); - } - writer.write(comma); - state[0] = encodeInteger(writer, endLine, state[0]); - encodeInteger(writer, endColumn, 0); - return index; -} -function decodeGeneratedRanges(input) { - const { length } = input; - const reader = new StringReader(input); - const ranges = []; - const stack = []; - let genLine = 0; - let definitionSourcesIndex = 0; - let definitionScopeIndex = 0; - let callsiteSourcesIndex = 0; - let callsiteLine = 0; - let callsiteColumn = 0; - let bindingLine = 0; - let bindingColumn = 0; - do { - const semi = reader.indexOf(";"); - let genColumn = 0; - for (; reader.pos < semi; reader.pos++) { - genColumn = decodeInteger(reader, genColumn); - if (!hasMoreVlq(reader, semi)) { - const last = stack.pop(); - last[2] = genLine; - last[3] = genColumn; - continue; - } - const fields = decodeInteger(reader, 0); - const hasDefinition = fields & 1; - const hasCallsite = fields & 2; - const hasScope = fields & 4; - let callsite = null; - let bindings = EMPTY; - let range; - if (hasDefinition) { - const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); - definitionScopeIndex = decodeInteger( - reader, - definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0 - ); - definitionSourcesIndex = defSourcesIndex; - range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex]; - } else { - range = [genLine, genColumn, 0, 0]; - } - range.isScope = !!hasScope; - if (hasCallsite) { - const prevCsi = callsiteSourcesIndex; - const prevLine = callsiteLine; - callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); - const sameSource = prevCsi === callsiteSourcesIndex; - callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); - callsiteColumn = decodeInteger( - reader, - sameSource && prevLine === callsiteLine ? callsiteColumn : 0 - ); - callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; - } - range.callsite = callsite; - if (hasMoreVlq(reader, semi)) { - bindings = []; - do { - bindingLine = genLine; - bindingColumn = genColumn; - const expressionsCount = decodeInteger(reader, 0); - let expressionRanges; - if (expressionsCount < -1) { - expressionRanges = [[decodeInteger(reader, 0)]]; - for (let i = -1; i > expressionsCount; i--) { - const prevBl = bindingLine; - bindingLine = decodeInteger(reader, bindingLine); - bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); - const expression = decodeInteger(reader, 0); - expressionRanges.push([expression, bindingLine, bindingColumn]); - } - } else { - expressionRanges = [[expressionsCount]]; - } - bindings.push(expressionRanges); - } while (hasMoreVlq(reader, semi)); - } - range.bindings = bindings; - ranges.push(range); - stack.push(range); - } - genLine++; - reader.pos = semi + 1; - } while (reader.pos < length); - return ranges; -} -function encodeGeneratedRanges(ranges) { - if (ranges.length === 0) return ""; - const writer = new StringWriter(); - for (let i = 0; i < ranges.length; ) { - i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); - } - return writer.flush(); -} -function _encodeGeneratedRanges(ranges, index, writer, state) { - const range = ranges[index]; - const { - 0: startLine, - 1: startColumn, - 2: endLine, - 3: endColumn, - isScope, - callsite, - bindings - } = range; - if (state[0] < startLine) { - catchupLine(writer, state[0], startLine); - state[0] = startLine; - state[1] = 0; - } else if (index > 0) { - writer.write(comma); - } - state[1] = encodeInteger(writer, range[1], state[1]); - const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0); - encodeInteger(writer, fields, 0); - if (range.length === 6) { - const { 4: sourcesIndex, 5: scopesIndex } = range; - if (sourcesIndex !== state[2]) { - state[3] = 0; - } - state[2] = encodeInteger(writer, sourcesIndex, state[2]); - state[3] = encodeInteger(writer, scopesIndex, state[3]); - } - if (callsite) { - const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite; - if (sourcesIndex !== state[4]) { - state[5] = 0; - state[6] = 0; - } else if (callLine !== state[5]) { - state[6] = 0; - } - state[4] = encodeInteger(writer, sourcesIndex, state[4]); - state[5] = encodeInteger(writer, callLine, state[5]); - state[6] = encodeInteger(writer, callColumn, state[6]); - } - if (bindings) { - for (const binding of bindings) { - if (binding.length > 1) encodeInteger(writer, -binding.length, 0); - const expression = binding[0][0]; - encodeInteger(writer, expression, 0); - let bindingStartLine = startLine; - let bindingStartColumn = startColumn; - for (let i = 1; i < binding.length; i++) { - const expRange = binding[i]; - bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine); - bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn); - encodeInteger(writer, expRange[0], 0); - } - } - } - for (index++; index < ranges.length; ) { - const next = ranges[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeGeneratedRanges(ranges, index, writer, state); - } - if (state[0] < endLine) { - catchupLine(writer, state[0], endLine); - state[0] = endLine; - state[1] = 0; - } else { - writer.write(comma); - } - state[1] = encodeInteger(writer, endColumn, state[1]); - return index; -} -function catchupLine(writer, lastLine, line) { - do { - writer.write(semicolon); - } while (++lastLine < line); -} - -// src/sourcemap-codec.ts -function decode(mappings) { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - do { - const semi = reader.indexOf(";"); - const line = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - while (reader.pos < semi) { - let seg; - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - line.push(seg); - reader.pos++; - } - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - return decoded; -} -function sort(line) { - line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[0] - b[0]; -} -function encode(decoded) { - const writer = new StringWriter(); - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) writer.write(semicolon); - if (line.length === 0) continue; - let genColumn = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - if (j > 0) writer.write(comma); - genColumn = encodeInteger(writer, segment[0], genColumn); - if (segment.length === 1) continue; - sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); - sourceLine = encodeInteger(writer, segment[2], sourceLine); - sourceColumn = encodeInteger(writer, segment[3], sourceColumn); - if (segment.length === 4) continue; - namesIndex = encodeInteger(writer, segment[4], namesIndex); - } - } - return writer.flush(); -} -})); -//# sourceMappingURL=sourcemap-codec.umd.js.map diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map deleted file mode 100644 index abc18d2..0000000 --- a/node_modules/@jridgewell/sourcemap-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KAAK;AAE7B,kBAAY,cAAc,QAAQ,QAAQ,CAAC,GAAG,SAAS;AAEvD,UAAI,QAAQ,WAAW,EAAG;AAC1B,qBAAe,cAAc,QAAQ,QAAQ,CAAC,GAAG,YAAY;AAC7D,mBAAa,cAAc,QAAQ,QAAQ,CAAC,GAAG,UAAU;AACzD,qBAAe,cAAc,QAAQ,QAAQ,CAAC,GAAG,YAAY;AAE7D,UAAI,QAAQ,WAAW,EAAG;AAC1B,mBAAa,cAAc,QAAQ,QAAQ,CAAC,GAAG,UAAU;AAAA,IAC3D;AAAA,EACF;AAEA,SAAO,OAAO,MAAM;AACtB;", - "names": [] -} diff --git a/node_modules/@jridgewell/sourcemap-codec/package.json b/node_modules/@jridgewell/sourcemap-codec/package.json deleted file mode 100644 index da55137..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@jridgewell/sourcemap-codec", - "version": "1.5.5", - "description": "Encode/decode sourcemap mappings", - "keywords": [ - "sourcemap", - "vlq" - ], - "main": "dist/sourcemap-codec.umd.js", - "module": "dist/sourcemap-codec.mjs", - "types": "types/sourcemap-codec.d.cts", - "files": [ - "dist", - "src", - "types" - ], - "exports": { - ".": [ - { - "import": { - "types": "./types/sourcemap-codec.d.mts", - "default": "./dist/sourcemap-codec.mjs" - }, - "default": { - "types": "./types/sourcemap-codec.d.cts", - "default": "./dist/sourcemap-codec.umd.js" - } - }, - "./dist/sourcemap-codec.umd.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "benchmark": "run-s build:code benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node --expose-gc benchmark/index.js", - "build": "run-s -n build:code build:types", - "build:code": "node ../../esbuild.mjs sourcemap-codec.ts", - "build:types": "run-s build:types:force build:types:emit build:types:mts", - "build:types:force": "rimraf tsconfig.build.tsbuildinfo", - "build:types:emit": "tsc --project tsconfig.build.json", - "build:types:mts": "node ../../mts-types.mjs", - "clean": "run-s -n clean:code clean:types", - "clean:code": "tsc --build --clean tsconfig.build.json", - "clean:types": "rimraf dist types", - "test": "run-s -n test:types test:only test:format", - "test:format": "prettier --check '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:types": "eslint '{src,test}/**/*.ts'", - "lint": "run-s -n lint:types lint:format", - "lint:format": "npm run test:format -- --write", - "lint:types": "npm run test:types -- --fix", - "prepublishOnly": "npm run-s -n build test" - }, - "homepage": "https://github.com/jridgewell/sourcemaps/tree/main/packages/sourcemap-codec", - "repository": { - "type": "git", - "url": "git+https://github.com/jridgewell/sourcemaps.git", - "directory": "packages/sourcemap-codec" - }, - "author": "Justin Ridgewell ", - "license": "MIT" -} diff --git a/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts b/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts deleted file mode 100644 index d194c2f..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts +++ /dev/null @@ -1,345 +0,0 @@ -import { StringReader, StringWriter } from './strings'; -import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq'; - -const EMPTY: any[] = []; - -type Line = number; -type Column = number; -type Kind = number; -type Name = number; -type Var = number; -type SourcesIndex = number; -type ScopesIndex = number; - -type Mix = (A & O) | (B & O); - -export type OriginalScope = Mix< - [Line, Column, Line, Column, Kind], - [Line, Column, Line, Column, Kind, Name], - { vars: Var[] } ->; - -export type GeneratedRange = Mix< - [Line, Column, Line, Column], - [Line, Column, Line, Column, SourcesIndex, ScopesIndex], - { - callsite: CallSite | null; - bindings: Binding[]; - isScope: boolean; - } ->; -export type CallSite = [SourcesIndex, Line, Column]; -type Binding = BindingExpressionRange[]; -export type BindingExpressionRange = [Name] | [Name, Line, Column]; - -export function decodeOriginalScopes(input: string): OriginalScope[] { - const { length } = input; - const reader = new StringReader(input); - const scopes: OriginalScope[] = []; - const stack: OriginalScope[] = []; - let line = 0; - - for (; reader.pos < length; reader.pos++) { - line = decodeInteger(reader, line); - const column = decodeInteger(reader, 0); - - if (!hasMoreVlq(reader, length)) { - const last = stack.pop()!; - last[2] = line; - last[3] = column; - continue; - } - - const kind = decodeInteger(reader, 0); - const fields = decodeInteger(reader, 0); - const hasName = fields & 0b0001; - - const scope: OriginalScope = ( - hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind] - ) as OriginalScope; - - let vars: Var[] = EMPTY; - if (hasMoreVlq(reader, length)) { - vars = []; - do { - const varsIndex = decodeInteger(reader, 0); - vars.push(varsIndex); - } while (hasMoreVlq(reader, length)); - } - scope.vars = vars; - - scopes.push(scope); - stack.push(scope); - } - - return scopes; -} - -export function encodeOriginalScopes(scopes: OriginalScope[]): string { - const writer = new StringWriter(); - - for (let i = 0; i < scopes.length; ) { - i = _encodeOriginalScopes(scopes, i, writer, [0]); - } - - return writer.flush(); -} - -function _encodeOriginalScopes( - scopes: OriginalScope[], - index: number, - writer: StringWriter, - state: [ - number, // GenColumn - ], -): number { - const scope = scopes[index]; - const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; - - if (index > 0) writer.write(comma); - - state[0] = encodeInteger(writer, startLine, state[0]); - encodeInteger(writer, startColumn, 0); - encodeInteger(writer, kind, 0); - - const fields = scope.length === 6 ? 0b0001 : 0; - encodeInteger(writer, fields, 0); - if (scope.length === 6) encodeInteger(writer, scope[5], 0); - - for (const v of vars) { - encodeInteger(writer, v, 0); - } - - for (index++; index < scopes.length; ) { - const next = scopes[index]; - const { 0: l, 1: c } = next; - if (l > endLine || (l === endLine && c >= endColumn)) { - break; - } - index = _encodeOriginalScopes(scopes, index, writer, state); - } - - writer.write(comma); - state[0] = encodeInteger(writer, endLine, state[0]); - encodeInteger(writer, endColumn, 0); - - return index; -} - -export function decodeGeneratedRanges(input: string): GeneratedRange[] { - const { length } = input; - const reader = new StringReader(input); - const ranges: GeneratedRange[] = []; - const stack: GeneratedRange[] = []; - - let genLine = 0; - let definitionSourcesIndex = 0; - let definitionScopeIndex = 0; - let callsiteSourcesIndex = 0; - let callsiteLine = 0; - let callsiteColumn = 0; - let bindingLine = 0; - let bindingColumn = 0; - - do { - const semi = reader.indexOf(';'); - let genColumn = 0; - - for (; reader.pos < semi; reader.pos++) { - genColumn = decodeInteger(reader, genColumn); - - if (!hasMoreVlq(reader, semi)) { - const last = stack.pop()!; - last[2] = genLine; - last[3] = genColumn; - continue; - } - - const fields = decodeInteger(reader, 0); - const hasDefinition = fields & 0b0001; - const hasCallsite = fields & 0b0010; - const hasScope = fields & 0b0100; - - let callsite: CallSite | null = null; - let bindings: Binding[] = EMPTY; - let range: GeneratedRange; - if (hasDefinition) { - const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); - definitionScopeIndex = decodeInteger( - reader, - definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0, - ); - - definitionSourcesIndex = defSourcesIndex; - range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex] as GeneratedRange; - } else { - range = [genLine, genColumn, 0, 0] as GeneratedRange; - } - - range.isScope = !!hasScope; - - if (hasCallsite) { - const prevCsi = callsiteSourcesIndex; - const prevLine = callsiteLine; - callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); - const sameSource = prevCsi === callsiteSourcesIndex; - callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); - callsiteColumn = decodeInteger( - reader, - sameSource && prevLine === callsiteLine ? callsiteColumn : 0, - ); - - callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; - } - range.callsite = callsite; - - if (hasMoreVlq(reader, semi)) { - bindings = []; - do { - bindingLine = genLine; - bindingColumn = genColumn; - const expressionsCount = decodeInteger(reader, 0); - let expressionRanges: BindingExpressionRange[]; - if (expressionsCount < -1) { - expressionRanges = [[decodeInteger(reader, 0)]]; - for (let i = -1; i > expressionsCount; i--) { - const prevBl = bindingLine; - bindingLine = decodeInteger(reader, bindingLine); - bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); - const expression = decodeInteger(reader, 0); - expressionRanges.push([expression, bindingLine, bindingColumn]); - } - } else { - expressionRanges = [[expressionsCount]]; - } - bindings.push(expressionRanges); - } while (hasMoreVlq(reader, semi)); - } - range.bindings = bindings; - - ranges.push(range); - stack.push(range); - } - - genLine++; - reader.pos = semi + 1; - } while (reader.pos < length); - - return ranges; -} - -export function encodeGeneratedRanges(ranges: GeneratedRange[]): string { - if (ranges.length === 0) return ''; - - const writer = new StringWriter(); - - for (let i = 0; i < ranges.length; ) { - i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); - } - - return writer.flush(); -} - -function _encodeGeneratedRanges( - ranges: GeneratedRange[], - index: number, - writer: StringWriter, - state: [ - number, // GenLine - number, // GenColumn - number, // DefSourcesIndex - number, // DefScopesIndex - number, // CallSourcesIndex - number, // CallLine - number, // CallColumn - ], -): number { - const range = ranges[index]; - const { - 0: startLine, - 1: startColumn, - 2: endLine, - 3: endColumn, - isScope, - callsite, - bindings, - } = range; - - if (state[0] < startLine) { - catchupLine(writer, state[0], startLine); - state[0] = startLine; - state[1] = 0; - } else if (index > 0) { - writer.write(comma); - } - - state[1] = encodeInteger(writer, range[1], state[1]); - - const fields = - (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0); - encodeInteger(writer, fields, 0); - - if (range.length === 6) { - const { 4: sourcesIndex, 5: scopesIndex } = range; - if (sourcesIndex !== state[2]) { - state[3] = 0; - } - state[2] = encodeInteger(writer, sourcesIndex, state[2]); - state[3] = encodeInteger(writer, scopesIndex, state[3]); - } - - if (callsite) { - const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite!; - if (sourcesIndex !== state[4]) { - state[5] = 0; - state[6] = 0; - } else if (callLine !== state[5]) { - state[6] = 0; - } - state[4] = encodeInteger(writer, sourcesIndex, state[4]); - state[5] = encodeInteger(writer, callLine, state[5]); - state[6] = encodeInteger(writer, callColumn, state[6]); - } - - if (bindings) { - for (const binding of bindings) { - if (binding.length > 1) encodeInteger(writer, -binding.length, 0); - const expression = binding[0][0]; - encodeInteger(writer, expression, 0); - let bindingStartLine = startLine; - let bindingStartColumn = startColumn; - for (let i = 1; i < binding.length; i++) { - const expRange = binding[i]; - bindingStartLine = encodeInteger(writer, expRange[1]!, bindingStartLine); - bindingStartColumn = encodeInteger(writer, expRange[2]!, bindingStartColumn); - encodeInteger(writer, expRange[0]!, 0); - } - } - } - - for (index++; index < ranges.length; ) { - const next = ranges[index]; - const { 0: l, 1: c } = next; - if (l > endLine || (l === endLine && c >= endColumn)) { - break; - } - index = _encodeGeneratedRanges(ranges, index, writer, state); - } - - if (state[0] < endLine) { - catchupLine(writer, state[0], endLine); - state[0] = endLine; - state[1] = 0; - } else { - writer.write(comma); - } - state[1] = encodeInteger(writer, endColumn, state[1]); - - return index; -} - -function catchupLine(writer: StringWriter, lastLine: number, line: number) { - do { - writer.write(semicolon); - } while (++lastLine < line); -} diff --git a/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts b/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts deleted file mode 100644 index a81f894..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq'; -import { StringWriter, StringReader } from './strings'; - -export { - decodeOriginalScopes, - encodeOriginalScopes, - decodeGeneratedRanges, - encodeGeneratedRanges, -} from './scopes'; -export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes'; - -export type SourceMapSegment = - | [number] - | [number, number, number, number] - | [number, number, number, number, number]; -export type SourceMapLine = SourceMapSegment[]; -export type SourceMapMappings = SourceMapLine[]; - -export function decode(mappings: string): SourceMapMappings { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded: SourceMapMappings = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - - do { - const semi = reader.indexOf(';'); - const line: SourceMapLine = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - - while (reader.pos < semi) { - let seg: SourceMapSegment; - - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - - line.push(seg); - reader.pos++; - } - - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - - return decoded; -} - -function sort(line: SourceMapSegment[]) { - line.sort(sortComparator); -} - -function sortComparator(a: SourceMapSegment, b: SourceMapSegment): number { - return a[0] - b[0]; -} - -export function encode(decoded: SourceMapMappings): string; -export function encode(decoded: Readonly): string; -export function encode(decoded: Readonly): string { - const writer = new StringWriter(); - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) writer.write(semicolon); - if (line.length === 0) continue; - - let genColumn = 0; - - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - if (j > 0) writer.write(comma); - - genColumn = encodeInteger(writer, segment[0], genColumn); - - if (segment.length === 1) continue; - sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); - sourceLine = encodeInteger(writer, segment[2], sourceLine); - sourceColumn = encodeInteger(writer, segment[3], sourceColumn); - - if (segment.length === 4) continue; - namesIndex = encodeInteger(writer, segment[4], namesIndex); - } - } - - return writer.flush(); -} diff --git a/node_modules/@jridgewell/sourcemap-codec/src/strings.ts b/node_modules/@jridgewell/sourcemap-codec/src/strings.ts deleted file mode 100644 index d161965..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/src/strings.ts +++ /dev/null @@ -1,65 +0,0 @@ -const bufLength = 1024 * 16; - -// Provide a fallback for older environments. -const td = - typeof TextDecoder !== 'undefined' - ? /* #__PURE__ */ new TextDecoder() - : typeof Buffer !== 'undefined' - ? { - decode(buf: Uint8Array): string { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - }, - } - : { - decode(buf: Uint8Array): string { - let out = ''; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - }, - }; - -export class StringWriter { - pos = 0; - private out = ''; - private buffer = new Uint8Array(bufLength); - - write(v: number): void { - const { buffer } = this; - buffer[this.pos++] = v; - if (this.pos === bufLength) { - this.out += td.decode(buffer); - this.pos = 0; - } - } - - flush(): string { - const { buffer, out, pos } = this; - return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; - } -} - -export class StringReader { - pos = 0; - declare private buffer: string; - - constructor(buffer: string) { - this.buffer = buffer; - } - - next(): number { - return this.buffer.charCodeAt(this.pos++); - } - - peek(): number { - return this.buffer.charCodeAt(this.pos); - } - - indexOf(char: string): number { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -} diff --git a/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts b/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts deleted file mode 100644 index a42c681..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { StringReader, StringWriter } from './strings'; - -export const comma = ','.charCodeAt(0); -export const semicolon = ';'.charCodeAt(0); - -const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -const intToChar = new Uint8Array(64); // 64 possible chars. -const charToInt = new Uint8Array(128); // z is 122 in ASCII - -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} - -export function decodeInteger(reader: StringReader, relative: number): number { - let value = 0; - let shift = 0; - let integer = 0; - - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - - const shouldNegate = value & 1; - value >>>= 1; - - if (shouldNegate) { - value = -0x80000000 | -value; - } - - return relative + value; -} - -export function encodeInteger(builder: StringWriter, num: number, relative: number): number { - let delta = num - relative; - - delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; - do { - let clamped = delta & 0b011111; - delta >>>= 5; - if (delta > 0) clamped |= 0b100000; - builder.write(intToChar[clamped]); - } while (delta > 0); - - return num; -} - -export function hasMoreVlq(reader: StringReader, max: number) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} diff --git a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts b/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts deleted file mode 100644 index c583c75..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts +++ /dev/null @@ -1,50 +0,0 @@ -type Line = number; -type Column = number; -type Kind = number; -type Name = number; -type Var = number; -type SourcesIndex = number; -type ScopesIndex = number; -type Mix = (A & O) | (B & O); -export type OriginalScope = Mix<[ - Line, - Column, - Line, - Column, - Kind -], [ - Line, - Column, - Line, - Column, - Kind, - Name -], { - vars: Var[]; -}>; -export type GeneratedRange = Mix<[ - Line, - Column, - Line, - Column -], [ - Line, - Column, - Line, - Column, - SourcesIndex, - ScopesIndex -], { - callsite: CallSite | null; - bindings: Binding[]; - isScope: boolean; -}>; -export type CallSite = [SourcesIndex, Line, Column]; -type Binding = BindingExpressionRange[]; -export type BindingExpressionRange = [Name] | [Name, Line, Column]; -export declare function decodeOriginalScopes(input: string): OriginalScope[]; -export declare function encodeOriginalScopes(scopes: OriginalScope[]): string; -export declare function decodeGeneratedRanges(input: string): GeneratedRange[]; -export declare function encodeGeneratedRanges(ranges: GeneratedRange[]): string; -export {}; -//# sourceMappingURL=scopes.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map b/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map deleted file mode 100644 index 630e647..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,GAAG,GAAG,MAAM,CAAC;AAClB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,GAAG,CAC7B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;CAAC,EAClC;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,IAAI;CAAC,EACxC;IAAE,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,GAAG,CAC9B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;CAAC,EAC5B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,YAAY;IAAE,WAAW;CAAC,EACvD;IACE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CACF,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACpD,KAAK,OAAO,GAAG,sBAAsB,EAAE,CAAC;AACxC,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,EAAE,CAyCnE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAQpE;AA2CD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAoGrE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAUtE"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts b/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts deleted file mode 100644 index c583c75..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts +++ /dev/null @@ -1,50 +0,0 @@ -type Line = number; -type Column = number; -type Kind = number; -type Name = number; -type Var = number; -type SourcesIndex = number; -type ScopesIndex = number; -type Mix = (A & O) | (B & O); -export type OriginalScope = Mix<[ - Line, - Column, - Line, - Column, - Kind -], [ - Line, - Column, - Line, - Column, - Kind, - Name -], { - vars: Var[]; -}>; -export type GeneratedRange = Mix<[ - Line, - Column, - Line, - Column -], [ - Line, - Column, - Line, - Column, - SourcesIndex, - ScopesIndex -], { - callsite: CallSite | null; - bindings: Binding[]; - isScope: boolean; -}>; -export type CallSite = [SourcesIndex, Line, Column]; -type Binding = BindingExpressionRange[]; -export type BindingExpressionRange = [Name] | [Name, Line, Column]; -export declare function decodeOriginalScopes(input: string): OriginalScope[]; -export declare function encodeOriginalScopes(scopes: OriginalScope[]): string; -export declare function decodeGeneratedRanges(input: string): GeneratedRange[]; -export declare function encodeGeneratedRanges(ranges: GeneratedRange[]): string; -export {}; -//# sourceMappingURL=scopes.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map b/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map deleted file mode 100644 index 630e647..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,GAAG,GAAG,MAAM,CAAC;AAClB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,GAAG,CAC7B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;CAAC,EAClC;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,IAAI;CAAC,EACxC;IAAE,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,GAAG,CAC9B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;CAAC,EAC5B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,YAAY;IAAE,WAAW;CAAC,EACvD;IACE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CACF,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACpD,KAAK,OAAO,GAAG,sBAAsB,EAAE,CAAC;AACxC,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,EAAE,CAyCnE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAQpE;AA2CD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAoGrE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAUtE"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts b/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts deleted file mode 100644 index 5f35e22..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts +++ /dev/null @@ -1,9 +0,0 @@ -export { decodeOriginalScopes, encodeOriginalScopes, decodeGeneratedRanges, encodeGeneratedRanges, } from './scopes.cts'; -export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes.cts'; -export type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number]; -export type SourceMapLine = SourceMapSegment[]; -export type SourceMapMappings = SourceMapLine[]; -export declare function decode(mappings: string): SourceMapMappings; -export declare function encode(decoded: SourceMapMappings): string; -export declare function encode(decoded: Readonly): string; -//# sourceMappingURL=sourcemap-codec.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map b/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map deleted file mode 100644 index 7123d52..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-codec.d.ts","sourceRoot":"","sources":["../src/sourcemap-codec.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEhG,MAAM,MAAM,gBAAgB,GACxB,CAAC,MAAM,CAAC,GACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC/C,MAAM,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC;AAEhD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAiD1D;AAUD,wBAAgB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;AAC3D,wBAAgB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts b/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts deleted file mode 100644 index 199fb9f..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +++ /dev/null @@ -1,9 +0,0 @@ -export { decodeOriginalScopes, encodeOriginalScopes, decodeGeneratedRanges, encodeGeneratedRanges, } from './scopes.mts'; -export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes.mts'; -export type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number]; -export type SourceMapLine = SourceMapSegment[]; -export type SourceMapMappings = SourceMapLine[]; -export declare function decode(mappings: string): SourceMapMappings; -export declare function encode(decoded: SourceMapMappings): string; -export declare function encode(decoded: Readonly): string; -//# sourceMappingURL=sourcemap-codec.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map b/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map deleted file mode 100644 index 7123d52..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-codec.d.ts","sourceRoot":"","sources":["../src/sourcemap-codec.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEhG,MAAM,MAAM,gBAAgB,GACxB,CAAC,MAAM,CAAC,GACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC/C,MAAM,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC;AAEhD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAiD1D;AAUD,wBAAgB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;AAC3D,wBAAgB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts b/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts deleted file mode 100644 index 62faceb..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts +++ /dev/null @@ -1,16 +0,0 @@ -export declare class StringWriter { - pos: number; - private out; - private buffer; - write(v: number): void; - flush(): string; -} -export declare class StringReader { - pos: number; - private buffer; - constructor(buffer: string); - next(): number; - peek(): number; - indexOf(char: string): number; -} -//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map b/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map deleted file mode 100644 index d3602da..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAuBA,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,MAAM,CAA6B;IAE3C,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAStB,KAAK,IAAI,MAAM;CAIhB;AAED,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,QAAgB,MAAM,CAAS;gBAEnB,MAAM,EAAE,MAAM;IAI1B,IAAI,IAAI,MAAM;IAId,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAK9B"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts b/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts deleted file mode 100644 index 62faceb..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts +++ /dev/null @@ -1,16 +0,0 @@ -export declare class StringWriter { - pos: number; - private out; - private buffer; - write(v: number): void; - flush(): string; -} -export declare class StringReader { - pos: number; - private buffer; - constructor(buffer: string); - next(): number; - peek(): number; - indexOf(char: string): number; -} -//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map b/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map deleted file mode 100644 index d3602da..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAuBA,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,MAAM,CAA6B;IAE3C,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAStB,KAAK,IAAI,MAAM;CAIhB;AAED,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,QAAgB,MAAM,CAAS;gBAEnB,MAAM,EAAE,MAAM;IAI1B,IAAI,IAAI,MAAM;IAId,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAK9B"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts b/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts deleted file mode 100644 index dbd6602..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts +++ /dev/null @@ -1,7 +0,0 @@ -import type { StringReader, StringWriter } from './strings.cts'; -export declare const comma: number; -export declare const semicolon: number; -export declare function decodeInteger(reader: StringReader, relative: number): number; -export declare function encodeInteger(builder: StringWriter, num: number, relative: number): number; -export declare function hasMoreVlq(reader: StringReader, max: number): boolean; -//# sourceMappingURL=vlq.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map b/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map deleted file mode 100644 index 6fdc356..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vlq.d.ts","sourceRoot":"","sources":["../src/vlq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE5D,eAAO,MAAM,KAAK,QAAoB,CAAC;AACvC,eAAO,MAAM,SAAS,QAAoB,CAAC;AAY3C,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoB5E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY1F;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,WAG3D"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts b/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts deleted file mode 100644 index 2c739bc..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +++ /dev/null @@ -1,7 +0,0 @@ -import type { StringReader, StringWriter } from './strings.mts'; -export declare const comma: number; -export declare const semicolon: number; -export declare function decodeInteger(reader: StringReader, relative: number): number; -export declare function encodeInteger(builder: StringWriter, num: number, relative: number): number; -export declare function hasMoreVlq(reader: StringReader, max: number): boolean; -//# sourceMappingURL=vlq.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map b/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map deleted file mode 100644 index 6fdc356..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vlq.d.ts","sourceRoot":"","sources":["../src/vlq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE5D,eAAO,MAAM,KAAK,QAAoB,CAAC;AACvC,eAAO,MAAM,SAAS,QAAoB,CAAC;AAY3C,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoB5E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY1F;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,WAG3D"} \ No newline at end of file diff --git a/node_modules/@jridgewell/trace-mapping/LICENSE b/node_modules/@jridgewell/trace-mapping/LICENSE deleted file mode 100644 index 37bb488..0000000 --- a/node_modules/@jridgewell/trace-mapping/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2022 Justin Ridgewell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@jridgewell/trace-mapping/README.md b/node_modules/@jridgewell/trace-mapping/README.md deleted file mode 100644 index 8286cee..0000000 --- a/node_modules/@jridgewell/trace-mapping/README.md +++ /dev/null @@ -1,193 +0,0 @@ -# @jridgewell/trace-mapping - -> Trace the original position through a source map - -`trace-mapping` allows you to take the line and column of an output file and trace it to the -original location in the source file through a source map. - -You may already be familiar with the [`source-map`][source-map] package's `SourceMapConsumer`. This -provides the same `originalPositionFor` and `generatedPositionFor` API, without requiring WASM. - -## Installation - -```sh -npm install @jridgewell/trace-mapping -``` - -## Usage - -```typescript -import { TraceMap, originalPositionFor, generatedPositionFor } from '@jridgewell/trace-mapping'; - -const tracer = new TraceMap({ - version: 3, - sources: ['input.js'], - names: ['foo'], - mappings: 'KAyCIA', -}); - -// Lines start at line 1, columns at column 0. -const traced = originalPositionFor(tracer, { line: 1, column: 5 }); -assert.deepEqual(traced, { - source: 'input.js', - line: 42, - column: 4, - name: 'foo', -}); - -const generated = generatedPositionFor(tracer, { - source: 'input.js', - line: 42, - column: 4, -}); -assert.deepEqual(generated, { - line: 1, - column: 5, -}); -``` - -We also provide a lower level API to get the actual segment that matches our line and column. Unlike -`originalPositionFor`, `traceSegment` uses a 0-base for `line`: - -```typescript -import { traceSegment } from '@jridgewell/trace-mapping'; - -// line is 0-base. -const traced = traceSegment(tracer, /* line */ 0, /* column */ 5); - -// Segments are [outputColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] -// Again, line is 0-base and so is sourceLine -assert.deepEqual(traced, [5, 0, 41, 4, 0]); -``` - -### SectionedSourceMaps - -The sourcemap spec defines a special `sections` field that's designed to handle concatenation of -output code with associated sourcemaps. This type of sourcemap is rarely used (no major build tool -produces it), but if you are hand coding a concatenation you may need it. We provide an `AnyMap` -helper that can receive either a regular sourcemap or a `SectionedSourceMap` and returns a -`TraceMap` instance: - -```typescript -import { AnyMap } from '@jridgewell/trace-mapping'; -const fooOutput = 'foo'; -const barOutput = 'bar'; -const output = [fooOutput, barOutput].join('\n'); - -const sectioned = new AnyMap({ - version: 3, - sections: [ - { - // 0-base line and column - offset: { line: 0, column: 0 }, - // fooOutput's sourcemap - map: { - version: 3, - sources: ['foo.js'], - names: ['foo'], - mappings: 'AAAAA', - }, - }, - { - // barOutput's sourcemap will not affect the first line, only the second - offset: { line: 1, column: 0 }, - map: { - version: 3, - sources: ['bar.js'], - names: ['bar'], - mappings: 'AAAAA', - }, - }, - ], -}); - -const traced = originalPositionFor(sectioned, { - line: 2, - column: 0, -}); - -assert.deepEqual(traced, { - source: 'bar.js', - line: 1, - column: 0, - name: 'bar', -}); -``` - -## Benchmarks - -``` -node v18.0.0 - -amp.js.map -trace-mapping: decoded JSON input x 183 ops/sec ±0.41% (87 runs sampled) -trace-mapping: encoded JSON input x 384 ops/sec ±0.89% (89 runs sampled) -trace-mapping: decoded Object input x 3,085 ops/sec ±0.24% (100 runs sampled) -trace-mapping: encoded Object input x 452 ops/sec ±0.80% (84 runs sampled) -source-map-js: encoded Object input x 88.82 ops/sec ±0.45% (77 runs sampled) -source-map-0.6.1: encoded Object input x 38.39 ops/sec ±1.88% (52 runs sampled) -Fastest is trace-mapping: decoded Object input - -trace-mapping: decoded originalPositionFor x 4,025,347 ops/sec ±0.15% (97 runs sampled) -trace-mapping: encoded originalPositionFor x 3,333,136 ops/sec ±1.26% (90 runs sampled) -source-map-js: encoded originalPositionFor x 824,978 ops/sec ±1.06% (94 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 741,300 ops/sec ±0.93% (92 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 2,587,603 ops/sec ±0.75% (97 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - -*** - -babel.min.js.map -trace-mapping: decoded JSON input x 17.43 ops/sec ±8.81% (33 runs sampled) -trace-mapping: encoded JSON input x 34.18 ops/sec ±4.67% (50 runs sampled) -trace-mapping: decoded Object input x 1,010 ops/sec ±0.41% (98 runs sampled) -trace-mapping: encoded Object input x 39.45 ops/sec ±4.01% (52 runs sampled) -source-map-js: encoded Object input x 6.57 ops/sec ±3.04% (21 runs sampled) -source-map-0.6.1: encoded Object input x 4.23 ops/sec ±2.93% (15 runs sampled) -Fastest is trace-mapping: decoded Object input - -trace-mapping: decoded originalPositionFor x 7,576,265 ops/sec ±0.74% (96 runs sampled) -trace-mapping: encoded originalPositionFor x 5,019,743 ops/sec ±0.74% (94 runs sampled) -source-map-js: encoded originalPositionFor x 3,396,137 ops/sec ±42.32% (95 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 3,753,176 ops/sec ±0.72% (95 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 6,423,633 ops/sec ±0.74% (95 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - -*** - -preact.js.map -trace-mapping: decoded JSON input x 3,499 ops/sec ±0.18% (98 runs sampled) -trace-mapping: encoded JSON input x 6,078 ops/sec ±0.25% (99 runs sampled) -trace-mapping: decoded Object input x 254,788 ops/sec ±0.13% (100 runs sampled) -trace-mapping: encoded Object input x 14,063 ops/sec ±0.27% (94 runs sampled) -source-map-js: encoded Object input x 2,465 ops/sec ±0.25% (98 runs sampled) -source-map-0.6.1: encoded Object input x 1,174 ops/sec ±1.90% (95 runs sampled) -Fastest is trace-mapping: decoded Object input - -trace-mapping: decoded originalPositionFor x 7,720,171 ops/sec ±0.14% (97 runs sampled) -trace-mapping: encoded originalPositionFor x 6,864,485 ops/sec ±0.16% (101 runs sampled) -source-map-js: encoded originalPositionFor x 2,387,219 ops/sec ±0.28% (98 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 1,565,339 ops/sec ±0.32% (101 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 3,819,732 ops/sec ±0.38% (98 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - -*** - -react.js.map -trace-mapping: decoded JSON input x 1,719 ops/sec ±0.19% (99 runs sampled) -trace-mapping: encoded JSON input x 4,284 ops/sec ±0.51% (99 runs sampled) -trace-mapping: decoded Object input x 94,668 ops/sec ±0.08% (99 runs sampled) -trace-mapping: encoded Object input x 5,287 ops/sec ±0.24% (99 runs sampled) -source-map-js: encoded Object input x 814 ops/sec ±0.20% (98 runs sampled) -source-map-0.6.1: encoded Object input x 429 ops/sec ±0.24% (94 runs sampled) -Fastest is trace-mapping: decoded Object input - -trace-mapping: decoded originalPositionFor x 28,927,989 ops/sec ±0.61% (94 runs sampled) -trace-mapping: encoded originalPositionFor x 27,394,475 ops/sec ±0.55% (97 runs sampled) -source-map-js: encoded originalPositionFor x 16,856,730 ops/sec ±0.45% (96 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 12,258,950 ops/sec ±0.41% (97 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 22,272,990 ops/sec ±0.58% (95 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor -``` - -[source-map]: https://www.npmjs.com/package/source-map diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs deleted file mode 100644 index 8fce400..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +++ /dev/null @@ -1,514 +0,0 @@ -import { encode, decode } from '@jridgewell/sourcemap-codec'; -import resolveUri from '@jridgewell/resolve-uri'; - -function resolve(input, base) { - // The base is always treated as a directory, if it's not empty. - // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327 - // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401 - if (base && !base.endsWith('/')) - base += '/'; - return resolveUri(input, base); -} - -/** - * Removes everything after the last "/", but leaves the slash. - */ -function stripFilename(path) { - if (!path) - return ''; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); -} - -const COLUMN = 0; -const SOURCES_INDEX = 1; -const SOURCE_LINE = 2; -const SOURCE_COLUMN = 3; -const NAMES_INDEX = 4; -const REV_GENERATED_LINE = 1; -const REV_GENERATED_COLUMN = 2; - -function maybeSort(mappings, owned) { - const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); - if (unsortedIndex === mappings.length) - return mappings; - // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If - // not, we do not want to modify the consumer's input array. - if (!owned) - mappings = mappings.slice(); - for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { - mappings[i] = sortSegments(mappings[i], owned); - } - return mappings; -} -function nextUnsortedSegmentLine(mappings, start) { - for (let i = start; i < mappings.length; i++) { - if (!isSorted(mappings[i])) - return i; - } - return mappings.length; -} -function isSorted(line) { - for (let j = 1; j < line.length; j++) { - if (line[j][COLUMN] < line[j - 1][COLUMN]) { - return false; - } - } - return true; -} -function sortSegments(line, owned) { - if (!owned) - line = line.slice(); - return line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[COLUMN] - b[COLUMN]; -} - -let found = false; -/** - * A binary search implementation that returns the index if a match is found. - * If no match is found, then the left-index (the index associated with the item that comes just - * before the desired index) is returned. To maintain proper sort order, a splice would happen at - * the next index: - * - * ```js - * const array = [1, 3]; - * const needle = 2; - * const index = binarySearch(array, needle, (item, needle) => item - needle); - * - * assert.equal(index, 0); - * array.splice(index + 1, 0, needle); - * assert.deepEqual(array, [1, 2, 3]); - * ``` - */ -function binarySearch(haystack, needle, low, high) { - while (low <= high) { - const mid = low + ((high - low) >> 1); - const cmp = haystack[mid][COLUMN] - needle; - if (cmp === 0) { - found = true; - return mid; - } - if (cmp < 0) { - low = mid + 1; - } - else { - high = mid - 1; - } - } - found = false; - return low - 1; -} -function upperBound(haystack, needle, index) { - for (let i = index + 1; i < haystack.length; i++, index++) { - if (haystack[i][COLUMN] !== needle) - break; - } - return index; -} -function lowerBound(haystack, needle, index) { - for (let i = index - 1; i >= 0; i--, index--) { - if (haystack[i][COLUMN] !== needle) - break; - } - return index; -} -function memoizedState() { - return { - lastKey: -1, - lastNeedle: -1, - lastIndex: -1, - }; -} -/** - * This overly complicated beast is just to record the last tested line/column and the resulting - * index, allowing us to skip a few tests if mappings are monotonically increasing. - */ -function memoizedBinarySearch(haystack, needle, state, key) { - const { lastKey, lastNeedle, lastIndex } = state; - let low = 0; - let high = haystack.length - 1; - if (key === lastKey) { - if (needle === lastNeedle) { - found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; - return lastIndex; - } - if (needle >= lastNeedle) { - // lastIndex may be -1 if the previous needle was not found. - low = lastIndex === -1 ? 0 : lastIndex; - } - else { - high = lastIndex; - } - } - state.lastKey = key; - state.lastNeedle = needle; - return (state.lastIndex = binarySearch(haystack, needle, low, high)); -} - -// Rebuilds the original source files, with mappings that are ordered by source line/column instead -// of generated line/column. -function buildBySources(decoded, memos) { - const sources = memos.map(buildNullArray); - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - if (seg.length === 1) - continue; - const sourceIndex = seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - const originalSource = sources[sourceIndex]; - const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = [])); - const memo = memos[sourceIndex]; - // The binary search either found a match, or it found the left-index just before where the - // segment should go. Either way, we want to insert after that. And there may be multiple - // generated segments associated with an original location, so there may need to move several - // indexes before we find where we need to insert. - const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine)); - insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]); - } - } - return sources; -} -function insert(array, index, value) { - for (let i = array.length; i > index; i--) { - array[i] = array[i - 1]; - } - array[index] = value; -} -// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like -// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations. -// Numeric properties on objects are magically sorted in ascending order by the engine regardless of -// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending -// order when iterating with for-in. -function buildNullArray() { - return { __proto__: null }; -} - -const AnyMap = function (map, mapUrl) { - const parsed = typeof map === 'string' ? JSON.parse(map) : map; - if (!('sections' in parsed)) - return new TraceMap(parsed, mapUrl); - const mappings = []; - const sources = []; - const sourcesContent = []; - const names = []; - const { sections } = parsed; - let i = 0; - for (; i < sections.length - 1; i++) { - const no = sections[i + 1].offset; - addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, no.line, no.column); - } - if (sections.length > 0) { - addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, Infinity, Infinity); - } - const joined = { - version: 3, - file: parsed.file, - names, - sources, - sourcesContent, - mappings, - }; - return presortedDecodedMap(joined); -}; -function addSection(section, mapUrl, mappings, sources, sourcesContent, names, stopLine, stopColumn) { - const map = AnyMap(section.map, mapUrl); - const { line: lineOffset, column: columnOffset } = section.offset; - const sourcesOffset = sources.length; - const namesOffset = names.length; - const decoded = decodedMappings(map); - const { resolvedSources } = map; - append(sources, resolvedSources); - append(sourcesContent, map.sourcesContent || fillSourcesContent(resolvedSources.length)); - append(names, map.names); - // If this section jumps forwards several lines, we need to add lines to the output mappings catch up. - for (let i = mappings.length; i <= lineOffset; i++) - mappings.push([]); - // We can only add so many lines before we step into the range that the next section's map - // controls. When we get to the last line, then we'll start checking the segments to see if - // they've crossed into the column range. - const stopI = stopLine - lineOffset; - const len = Math.min(decoded.length, stopI + 1); - for (let i = 0; i < len; i++) { - const line = decoded[i]; - // On the 0th loop, the line will already exist due to a previous section, or the line catch up - // loop above. - const out = i === 0 ? mappings[lineOffset] : (mappings[lineOffset + i] = []); - // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the - // map can be multiple lines), it doesn't. - const cOffset = i === 0 ? columnOffset : 0; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const column = cOffset + seg[COLUMN]; - // If this segment steps into the column range that the next section's map controls, we need - // to stop early. - if (i === stopI && column >= stopColumn) - break; - if (seg.length === 1) { - out.push([column]); - continue; - } - const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - if (seg.length === 4) { - out.push([column, sourcesIndex, sourceLine, sourceColumn]); - continue; - } - out.push([column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]); - } - } -} -function append(arr, other) { - for (let i = 0; i < other.length; i++) - arr.push(other[i]); -} -// Sourcemaps don't need to have sourcesContent, and if they don't, we need to create an array of -// equal length to the sources. This is because the sources and sourcesContent are paired arrays, -// where `sourcesContent[i]` is the content of the `sources[i]` file. If we didn't, then joined -// sourcemap would desynchronize the sources/contents. -function fillSourcesContent(len) { - const sourcesContent = []; - for (let i = 0; i < len; i++) - sourcesContent[i] = null; - return sourcesContent; -} - -const INVALID_ORIGINAL_MAPPING = Object.freeze({ - source: null, - line: null, - column: null, - name: null, -}); -const INVALID_GENERATED_MAPPING = Object.freeze({ - line: null, - column: null, -}); -const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)'; -const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)'; -const LEAST_UPPER_BOUND = -1; -const GREATEST_LOWER_BOUND = 1; -/** - * Returns the encoded (VLQ string) form of the SourceMap's mappings field. - */ -let encodedMappings; -/** - * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. - */ -let decodedMappings; -/** - * A low-level API to find the segment associated with a generated line/column (think, from a - * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. - */ -let traceSegment; -/** - * A higher-level API to find the source/line/column associated with a generated line/column - * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in - * `source-map` library. - */ -let originalPositionFor; -/** - * Finds the source/line/column directly after the mapping returned by originalPositionFor, provided - * the found mapping is from the same source and line as the originalPositionFor mapping. - * - * Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1` - * using the same needle that would return `id` when calling `originalPositionFor`. - */ -let generatedPositionFor; -/** - * Iterates each mapping in generated position order. - */ -let eachMapping; -/** - * A helper that skips sorting of the input map's mappings array, which can be expensive for larger - * maps. - */ -let presortedDecodedMap; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -let decodedMap; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -let encodedMap; -class TraceMap { - constructor(map, mapUrl) { - this._decodedMemo = memoizedState(); - this._bySources = undefined; - this._bySourceMemos = undefined; - const isString = typeof map === 'string'; - if (!isString && map.constructor === TraceMap) - return map; - const parsed = (isString ? JSON.parse(map) : map); - const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; - this.version = version; - this.file = file; - this.names = names; - this.sourceRoot = sourceRoot; - this.sources = sources; - this.sourcesContent = sourcesContent; - if (sourceRoot || mapUrl) { - const from = resolve(sourceRoot || '', stripFilename(mapUrl)); - this.resolvedSources = sources.map((s) => resolve(s || '', from)); - } - else { - this.resolvedSources = sources.map((s) => s || ''); - } - const { mappings } = parsed; - if (typeof mappings === 'string') { - this._encoded = mappings; - this._decoded = undefined; - } - else { - this._encoded = undefined; - this._decoded = maybeSort(mappings, isString); - } - } -} -(() => { - encodedMappings = (map) => { - var _a; - return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = encode(map._decoded))); - }; - decodedMappings = (map) => { - return (map._decoded || (map._decoded = decode(map._encoded))); - }; - traceSegment = (map, line, column) => { - const decoded = decodedMappings(map); - // It's common for parent source maps to have pointers to lines that have no - // mapping (like a "//# sourceMappingURL=") at the end of the child file. - if (line >= decoded.length) - return null; - return traceSegmentInternal(decoded[line], map._decodedMemo, line, column, GREATEST_LOWER_BOUND); - }; - originalPositionFor = (map, { line, column, bias }) => { - line--; - if (line < 0) - throw new Error(LINE_GTR_ZERO); - if (column < 0) - throw new Error(COL_GTR_EQ_ZERO); - const decoded = decodedMappings(map); - // It's common for parent source maps to have pointers to lines that have no - // mapping (like a "//# sourceMappingURL=") at the end of the child file. - if (line >= decoded.length) - return INVALID_ORIGINAL_MAPPING; - const segment = traceSegmentInternal(decoded[line], map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); - if (segment == null) - return INVALID_ORIGINAL_MAPPING; - if (segment.length == 1) - return INVALID_ORIGINAL_MAPPING; - const { names, resolvedSources } = map; - return { - source: resolvedSources[segment[SOURCES_INDEX]], - line: segment[SOURCE_LINE] + 1, - column: segment[SOURCE_COLUMN], - name: segment.length === 5 ? names[segment[NAMES_INDEX]] : null, - }; - }; - generatedPositionFor = (map, { source, line, column, bias }) => { - line--; - if (line < 0) - throw new Error(LINE_GTR_ZERO); - if (column < 0) - throw new Error(COL_GTR_EQ_ZERO); - const { sources, resolvedSources } = map; - let sourceIndex = sources.indexOf(source); - if (sourceIndex === -1) - sourceIndex = resolvedSources.indexOf(source); - if (sourceIndex === -1) - return INVALID_GENERATED_MAPPING; - const generated = (map._bySources || (map._bySources = buildBySources(decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState))))); - const memos = map._bySourceMemos; - const segments = generated[sourceIndex][line]; - if (segments == null) - return INVALID_GENERATED_MAPPING; - const segment = traceSegmentInternal(segments, memos[sourceIndex], line, column, bias || GREATEST_LOWER_BOUND); - if (segment == null) - return INVALID_GENERATED_MAPPING; - return { - line: segment[REV_GENERATED_LINE] + 1, - column: segment[REV_GENERATED_COLUMN], - }; - }; - eachMapping = (map, cb) => { - const decoded = decodedMappings(map); - const { names, resolvedSources } = map; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const generatedLine = i + 1; - const generatedColumn = seg[0]; - let source = null; - let originalLine = null; - let originalColumn = null; - let name = null; - if (seg.length !== 1) { - source = resolvedSources[seg[1]]; - originalLine = seg[2] + 1; - originalColumn = seg[3]; - } - if (seg.length === 5) - name = names[seg[4]]; - cb({ - generatedLine, - generatedColumn, - source, - originalLine, - originalColumn, - name, - }); - } - } - }; - presortedDecodedMap = (map, mapUrl) => { - const clone = Object.assign({}, map); - clone.mappings = []; - const tracer = new TraceMap(clone, mapUrl); - tracer._decoded = map.mappings; - return tracer; - }; - decodedMap = (map) => { - return { - version: 3, - file: map.file, - names: map.names, - sourceRoot: map.sourceRoot, - sources: map.sources, - sourcesContent: map.sourcesContent, - mappings: decodedMappings(map), - }; - }; - encodedMap = (map) => { - return { - version: 3, - file: map.file, - names: map.names, - sourceRoot: map.sourceRoot, - sources: map.sources, - sourcesContent: map.sourcesContent, - mappings: encodedMappings(map), - }; - }; -})(); -function traceSegmentInternal(segments, memo, line, column, bias) { - let index = memoizedBinarySearch(segments, column, memo, line); - if (found) { - index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); - } - else if (bias === LEAST_UPPER_BOUND) - index++; - if (index === -1 || index === segments.length) - return null; - return segments[index]; -} - -export { AnyMap, GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap, decodedMap, decodedMappings, eachMapping, encodedMap, encodedMappings, generatedPositionFor, originalPositionFor, presortedDecodedMap, traceSegment }; -//# sourceMappingURL=trace-mapping.mjs.map diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map deleted file mode 100644 index fec7769..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace-mapping.mjs","sources":["../../src/resolve.ts","../../src/strip-filename.ts","../../src/sourcemap-segment.ts","../../src/sort.ts","../../src/binary-search.ts","../../src/by-source.ts","../../src/any-map.ts","../../src/trace-mapping.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["bsFound"],"mappings":";;;SAEwB,OAAO,CAAC,KAAa,EAAE,IAAwB;;;;IAIrE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,IAAI,IAAI,GAAG,CAAC;IAE7C,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC;;ACTA;;;SAGwB,aAAa,CAAC,IAA+B;IACnE,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,IAAI,CAA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_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js deleted file mode 100644 index 8b755bd..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +++ /dev/null @@ -1,528 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jridgewell/sourcemap-codec'), require('@jridgewell/resolve-uri')) : - typeof define === 'function' && define.amd ? define(['exports', '@jridgewell/sourcemap-codec', '@jridgewell/resolve-uri'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.traceMapping = {}, global.sourcemapCodec, global.resolveURI)); -})(this, (function (exports, sourcemapCodec, resolveUri) { 'use strict'; - - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - - var resolveUri__default = /*#__PURE__*/_interopDefaultLegacy(resolveUri); - - function resolve(input, base) { - // The base is always treated as a directory, if it's not empty. - // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327 - // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401 - if (base && !base.endsWith('/')) - base += '/'; - return resolveUri__default["default"](input, base); - } - - /** - * Removes everything after the last "/", but leaves the slash. - */ - function stripFilename(path) { - if (!path) - return ''; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); - } - - const COLUMN = 0; - const SOURCES_INDEX = 1; - const SOURCE_LINE = 2; - const SOURCE_COLUMN = 3; - const NAMES_INDEX = 4; - const REV_GENERATED_LINE = 1; - const REV_GENERATED_COLUMN = 2; - - function maybeSort(mappings, owned) { - const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); - if (unsortedIndex === mappings.length) - return mappings; - // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If - // not, we do not want to modify the consumer's input array. - if (!owned) - mappings = mappings.slice(); - for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { - mappings[i] = sortSegments(mappings[i], owned); - } - return mappings; - } - function nextUnsortedSegmentLine(mappings, start) { - for (let i = start; i < mappings.length; i++) { - if (!isSorted(mappings[i])) - return i; - } - return mappings.length; - } - function isSorted(line) { - for (let j = 1; j < line.length; j++) { - if (line[j][COLUMN] < line[j - 1][COLUMN]) { - return false; - } - } - return true; - } - function sortSegments(line, owned) { - if (!owned) - line = line.slice(); - return line.sort(sortComparator); - } - function sortComparator(a, b) { - return a[COLUMN] - b[COLUMN]; - } - - let found = false; - /** - * A binary search implementation that returns the index if a match is found. - * If no match is found, then the left-index (the index associated with the item that comes just - * before the desired index) is returned. To maintain proper sort order, a splice would happen at - * the next index: - * - * ```js - * const array = [1, 3]; - * const needle = 2; - * const index = binarySearch(array, needle, (item, needle) => item - needle); - * - * assert.equal(index, 0); - * array.splice(index + 1, 0, needle); - * assert.deepEqual(array, [1, 2, 3]); - * ``` - */ - function binarySearch(haystack, needle, low, high) { - while (low <= high) { - const mid = low + ((high - low) >> 1); - const cmp = haystack[mid][COLUMN] - needle; - if (cmp === 0) { - found = true; - return mid; - } - if (cmp < 0) { - low = mid + 1; - } - else { - high = mid - 1; - } - } - found = false; - return low - 1; - } - function upperBound(haystack, needle, index) { - for (let i = index + 1; i < haystack.length; i++, index++) { - if (haystack[i][COLUMN] !== needle) - break; - } - return index; - } - function lowerBound(haystack, needle, index) { - for (let i = index - 1; i >= 0; i--, index--) { - if (haystack[i][COLUMN] !== needle) - break; - } - return index; - } - function memoizedState() { - return { - lastKey: -1, - lastNeedle: -1, - lastIndex: -1, - }; - } - /** - * This overly complicated beast is just to record the last tested line/column and the resulting - * index, allowing us to skip a few tests if mappings are monotonically increasing. - */ - function memoizedBinarySearch(haystack, needle, state, key) { - const { lastKey, lastNeedle, lastIndex } = state; - let low = 0; - let high = haystack.length - 1; - if (key === lastKey) { - if (needle === lastNeedle) { - found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; - return lastIndex; - } - if (needle >= lastNeedle) { - // lastIndex may be -1 if the previous needle was not found. - low = lastIndex === -1 ? 0 : lastIndex; - } - else { - high = lastIndex; - } - } - state.lastKey = key; - state.lastNeedle = needle; - return (state.lastIndex = binarySearch(haystack, needle, low, high)); - } - - // Rebuilds the original source files, with mappings that are ordered by source line/column instead - // of generated line/column. - function buildBySources(decoded, memos) { - const sources = memos.map(buildNullArray); - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - if (seg.length === 1) - continue; - const sourceIndex = seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - const originalSource = sources[sourceIndex]; - const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = [])); - const memo = memos[sourceIndex]; - // The binary search either found a match, or it found the left-index just before where the - // segment should go. Either way, we want to insert after that. And there may be multiple - // generated segments associated with an original location, so there may need to move several - // indexes before we find where we need to insert. - const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine)); - insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]); - } - } - return sources; - } - function insert(array, index, value) { - for (let i = array.length; i > index; i--) { - array[i] = array[i - 1]; - } - array[index] = value; - } - // Null arrays allow us to use ordered index keys without actually allocating contiguous memory like - // a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations. - // Numeric properties on objects are magically sorted in ascending order by the engine regardless of - // the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending - // order when iterating with for-in. - function buildNullArray() { - return { __proto__: null }; - } - - const AnyMap = function (map, mapUrl) { - const parsed = typeof map === 'string' ? JSON.parse(map) : map; - if (!('sections' in parsed)) - return new TraceMap(parsed, mapUrl); - const mappings = []; - const sources = []; - const sourcesContent = []; - const names = []; - const { sections } = parsed; - let i = 0; - for (; i < sections.length - 1; i++) { - const no = sections[i + 1].offset; - addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, no.line, no.column); - } - if (sections.length > 0) { - addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, Infinity, Infinity); - } - const joined = { - version: 3, - file: parsed.file, - names, - sources, - sourcesContent, - mappings, - }; - return exports.presortedDecodedMap(joined); - }; - function addSection(section, mapUrl, mappings, sources, sourcesContent, names, stopLine, stopColumn) { - const map = AnyMap(section.map, mapUrl); - const { line: lineOffset, column: columnOffset } = section.offset; - const sourcesOffset = sources.length; - const namesOffset = names.length; - const decoded = exports.decodedMappings(map); - const { resolvedSources } = map; - append(sources, resolvedSources); - append(sourcesContent, map.sourcesContent || fillSourcesContent(resolvedSources.length)); - append(names, map.names); - // If this section jumps forwards several lines, we need to add lines to the output mappings catch up. - for (let i = mappings.length; i <= lineOffset; i++) - mappings.push([]); - // We can only add so many lines before we step into the range that the next section's map - // controls. When we get to the last line, then we'll start checking the segments to see if - // they've crossed into the column range. - const stopI = stopLine - lineOffset; - const len = Math.min(decoded.length, stopI + 1); - for (let i = 0; i < len; i++) { - const line = decoded[i]; - // On the 0th loop, the line will already exist due to a previous section, or the line catch up - // loop above. - const out = i === 0 ? mappings[lineOffset] : (mappings[lineOffset + i] = []); - // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the - // map can be multiple lines), it doesn't. - const cOffset = i === 0 ? columnOffset : 0; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const column = cOffset + seg[COLUMN]; - // If this segment steps into the column range that the next section's map controls, we need - // to stop early. - if (i === stopI && column >= stopColumn) - break; - if (seg.length === 1) { - out.push([column]); - continue; - } - const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - if (seg.length === 4) { - out.push([column, sourcesIndex, sourceLine, sourceColumn]); - continue; - } - out.push([column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]); - } - } - } - function append(arr, other) { - for (let i = 0; i < other.length; i++) - arr.push(other[i]); - } - // Sourcemaps don't need to have sourcesContent, and if they don't, we need to create an array of - // equal length to the sources. This is because the sources and sourcesContent are paired arrays, - // where `sourcesContent[i]` is the content of the `sources[i]` file. If we didn't, then joined - // sourcemap would desynchronize the sources/contents. - function fillSourcesContent(len) { - const sourcesContent = []; - for (let i = 0; i < len; i++) - sourcesContent[i] = null; - return sourcesContent; - } - - const INVALID_ORIGINAL_MAPPING = Object.freeze({ - source: null, - line: null, - column: null, - name: null, - }); - const INVALID_GENERATED_MAPPING = Object.freeze({ - line: null, - column: null, - }); - const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)'; - const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)'; - const LEAST_UPPER_BOUND = -1; - const GREATEST_LOWER_BOUND = 1; - /** - * Returns the encoded (VLQ string) form of the SourceMap's mappings field. - */ - exports.encodedMappings = void 0; - /** - * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. - */ - exports.decodedMappings = void 0; - /** - * A low-level API to find the segment associated with a generated line/column (think, from a - * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. - */ - exports.traceSegment = void 0; - /** - * A higher-level API to find the source/line/column associated with a generated line/column - * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in - * `source-map` library. - */ - exports.originalPositionFor = void 0; - /** - * Finds the source/line/column directly after the mapping returned by originalPositionFor, provided - * the found mapping is from the same source and line as the originalPositionFor mapping. - * - * Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1` - * using the same needle that would return `id` when calling `originalPositionFor`. - */ - exports.generatedPositionFor = void 0; - /** - * Iterates each mapping in generated position order. - */ - exports.eachMapping = void 0; - /** - * A helper that skips sorting of the input map's mappings array, which can be expensive for larger - * maps. - */ - exports.presortedDecodedMap = void 0; - /** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ - exports.decodedMap = void 0; - /** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ - exports.encodedMap = void 0; - class TraceMap { - constructor(map, mapUrl) { - this._decodedMemo = memoizedState(); - this._bySources = undefined; - this._bySourceMemos = undefined; - const isString = typeof map === 'string'; - if (!isString && map.constructor === TraceMap) - return map; - const parsed = (isString ? JSON.parse(map) : map); - const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; - this.version = version; - this.file = file; - this.names = names; - this.sourceRoot = sourceRoot; - this.sources = sources; - this.sourcesContent = sourcesContent; - if (sourceRoot || mapUrl) { - const from = resolve(sourceRoot || '', stripFilename(mapUrl)); - this.resolvedSources = sources.map((s) => resolve(s || '', from)); - } - else { - this.resolvedSources = sources.map((s) => s || ''); - } - const { mappings } = parsed; - if (typeof mappings === 'string') { - this._encoded = mappings; - this._decoded = undefined; - } - else { - this._encoded = undefined; - this._decoded = maybeSort(mappings, isString); - } - } - } - (() => { - exports.encodedMappings = (map) => { - var _a; - return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = sourcemapCodec.encode(map._decoded))); - }; - exports.decodedMappings = (map) => { - return (map._decoded || (map._decoded = sourcemapCodec.decode(map._encoded))); - }; - exports.traceSegment = (map, line, column) => { - const decoded = exports.decodedMappings(map); - // It's common for parent source maps to have pointers to lines that have no - // mapping (like a "//# sourceMappingURL=") at the end of the child file. - if (line >= decoded.length) - return null; - return traceSegmentInternal(decoded[line], map._decodedMemo, line, column, GREATEST_LOWER_BOUND); - }; - exports.originalPositionFor = (map, { line, column, bias }) => { - line--; - if (line < 0) - throw new Error(LINE_GTR_ZERO); - if (column < 0) - throw new Error(COL_GTR_EQ_ZERO); - const decoded = exports.decodedMappings(map); - // It's common for parent source maps to have pointers to lines that have no - // mapping (like a "//# sourceMappingURL=") at the end of the child file. - if (line >= decoded.length) - return INVALID_ORIGINAL_MAPPING; - const segment = traceSegmentInternal(decoded[line], map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); - if (segment == null) - return INVALID_ORIGINAL_MAPPING; - if (segment.length == 1) - return INVALID_ORIGINAL_MAPPING; - const { names, resolvedSources } = map; - return { - source: resolvedSources[segment[SOURCES_INDEX]], - line: segment[SOURCE_LINE] + 1, - column: segment[SOURCE_COLUMN], - name: segment.length === 5 ? names[segment[NAMES_INDEX]] : null, - }; - }; - exports.generatedPositionFor = (map, { source, line, column, bias }) => { - line--; - if (line < 0) - throw new Error(LINE_GTR_ZERO); - if (column < 0) - throw new Error(COL_GTR_EQ_ZERO); - const { sources, resolvedSources } = map; - let sourceIndex = sources.indexOf(source); - if (sourceIndex === -1) - sourceIndex = resolvedSources.indexOf(source); - if (sourceIndex === -1) - return INVALID_GENERATED_MAPPING; - const generated = (map._bySources || (map._bySources = buildBySources(exports.decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState))))); - const memos = map._bySourceMemos; - const segments = generated[sourceIndex][line]; - if (segments == null) - return INVALID_GENERATED_MAPPING; - const segment = traceSegmentInternal(segments, memos[sourceIndex], line, column, bias || GREATEST_LOWER_BOUND); - if (segment == null) - return INVALID_GENERATED_MAPPING; - return { - line: segment[REV_GENERATED_LINE] + 1, - column: segment[REV_GENERATED_COLUMN], - }; - }; - exports.eachMapping = (map, cb) => { - const decoded = exports.decodedMappings(map); - const { names, resolvedSources } = map; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const generatedLine = i + 1; - const generatedColumn = seg[0]; - let source = null; - let originalLine = null; - let originalColumn = null; - let name = null; - if (seg.length !== 1) { - source = resolvedSources[seg[1]]; - originalLine = seg[2] + 1; - originalColumn = seg[3]; - } - if (seg.length === 5) - name = names[seg[4]]; - cb({ - generatedLine, - generatedColumn, - source, - originalLine, - originalColumn, - name, - }); - } - } - }; - exports.presortedDecodedMap = (map, mapUrl) => { - const clone = Object.assign({}, map); - clone.mappings = []; - const tracer = new TraceMap(clone, mapUrl); - tracer._decoded = map.mappings; - return tracer; - }; - exports.decodedMap = (map) => { - return { - version: 3, - file: map.file, - names: map.names, - sourceRoot: map.sourceRoot, - sources: map.sources, - sourcesContent: map.sourcesContent, - mappings: exports.decodedMappings(map), - }; - }; - exports.encodedMap = (map) => { - return { - version: 3, - file: map.file, - names: map.names, - sourceRoot: map.sourceRoot, - sources: map.sources, - sourcesContent: map.sourcesContent, - mappings: exports.encodedMappings(map), - }; - }; - })(); - function traceSegmentInternal(segments, memo, line, column, bias) { - let index = memoizedBinarySearch(segments, column, memo, line); - if (found) { - index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); - } - else if (bias === LEAST_UPPER_BOUND) - index++; - if (index === -1 || index === segments.length) - return null; - return segments[index]; - } - - exports.AnyMap = AnyMap; - exports.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND; - exports.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND; - exports.TraceMap = TraceMap; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); -//# sourceMappingURL=trace-mapping.umd.js.map diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map deleted file mode 100644 index 4ef72e7..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace-mapping.umd.js","sources":["../../src/resolve.ts","../../src/strip-filename.ts","../../src/sourcemap-segment.ts","../../src/sort.ts","../../src/binary-search.ts","../../src/by-source.ts","../../src/any-map.ts","../../src/trace-mapping.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["resolveUri","presortedDecodedMap","decodedMappings","encodedMappings","traceSegment","originalPositionFor","generatedPositionFor","eachMapping","decodedMap","encodedMap","encode","decode","bsFound"],"mappings":";;;;;;;;;;aAEwB,OAAO,CAAC,KAAa,EAAE,IAAwB;;;;QAIrE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,IAAI,IAAI,GAAG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AAI,CAAC,CAAC;QAC/D,IAAIS,KAAO,EAAE;YACX,KAAK,GAAG,CAAC,IAAI,KAAK,iBAAiB,GAAG,UAAU,GAAG,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;SACzF;aAAM,IAAI,IAAI,KAAK,iBAAiB;YAAE,KAAK,EAAE,CAAC;QAE/C,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,QAAQ,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC3D,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts deleted file mode 100644 index 08bca6b..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { TraceMap } from './trace-mapping'; -import type { SectionedSourceMapInput } from './types'; -declare type AnyMap = { - new (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap; - (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap; -}; -export declare const AnyMap: AnyMap; -export {}; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts deleted file mode 100644 index 88820e5..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment'; -export declare type MemoState = { - lastKey: number; - lastNeedle: number; - lastIndex: number; -}; -export declare let found: boolean; -/** - * A binary search implementation that returns the index if a match is found. - * If no match is found, then the left-index (the index associated with the item that comes just - * before the desired index) is returned. To maintain proper sort order, a splice would happen at - * the next index: - * - * ```js - * const array = [1, 3]; - * const needle = 2; - * const index = binarySearch(array, needle, (item, needle) => item - needle); - * - * assert.equal(index, 0); - * array.splice(index + 1, 0, needle); - * assert.deepEqual(array, [1, 2, 3]); - * ``` - */ -export declare function binarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, low: number, high: number): number; -export declare function upperBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number; -export declare function lowerBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number; -export declare function memoizedState(): MemoState; -/** - * This overly complicated beast is just to record the last tested line/column and the resulting - * index, allowing us to skip a few tests if mappings are monotonically increasing. - */ -export declare function memoizedBinarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, state: MemoState, key: number): number; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts deleted file mode 100644 index 8d1e538..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment'; -import type { MemoState } from './binary-search'; -export declare type Source = { - __proto__: null; - [line: number]: Exclude[]; -}; -export default function buildBySources(decoded: readonly SourceMapSegment[][], memos: MemoState[]): Source[]; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts deleted file mode 100644 index cf7d4f8..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts +++ /dev/null @@ -1 +0,0 @@ -export default function resolve(input: string, base: string | undefined): string; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts deleted file mode 100644 index 2bfb5dc..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment'; -export default function maybeSort(mappings: SourceMapSegment[][], owned: boolean): SourceMapSegment[][]; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts deleted file mode 100644 index 6d70924..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare type GeneratedColumn = number; -declare type SourcesIndex = number; -declare type SourceLine = number; -declare type SourceColumn = number; -declare type NamesIndex = number; -declare type GeneratedLine = number; -export declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; -export declare type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn]; -export declare const COLUMN = 0; -export declare const SOURCES_INDEX = 1; -export declare const SOURCE_LINE = 2; -export declare const SOURCE_COLUMN = 3; -export declare const NAMES_INDEX = 4; -export declare const REV_GENERATED_LINE = 1; -export declare const REV_GENERATED_COLUMN = 2; -export {}; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts deleted file mode 100644 index bead5c1..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Removes everything after the last "/", but leaves the slash. - */ -export default function stripFilename(path: string | undefined | null): string; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts deleted file mode 100644 index 8cd4574..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment'; -import type { SourceMapV3, DecodedSourceMap, EncodedSourceMap, InvalidOriginalMapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, SourceMapInput, Needle, SourceNeedle, SourceMap, EachMapping } from './types'; -export type { SourceMapSegment } from './sourcemap-segment'; -export type { SourceMapInput, SectionedSourceMapInput, DecodedSourceMap, EncodedSourceMap, SectionedSourceMap, InvalidOriginalMapping, OriginalMapping as Mapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, EachMapping, } from './types'; -export declare const LEAST_UPPER_BOUND = -1; -export declare const GREATEST_LOWER_BOUND = 1; -/** - * Returns the encoded (VLQ string) form of the SourceMap's mappings field. - */ -export declare let encodedMappings: (map: TraceMap) => EncodedSourceMap['mappings']; -/** - * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. - */ -export declare let decodedMappings: (map: TraceMap) => Readonly; -/** - * A low-level API to find the segment associated with a generated line/column (think, from a - * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. - */ -export declare let traceSegment: (map: TraceMap, line: number, column: number) => Readonly | null; -/** - * A higher-level API to find the source/line/column associated with a generated line/column - * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in - * `source-map` library. - */ -export declare let originalPositionFor: (map: TraceMap, needle: Needle) => OriginalMapping | InvalidOriginalMapping; -/** - * Finds the source/line/column directly after the mapping returned by originalPositionFor, provided - * the found mapping is from the same source and line as the originalPositionFor mapping. - * - * Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1` - * using the same needle that would return `id` when calling `originalPositionFor`. - */ -export declare let generatedPositionFor: (map: TraceMap, needle: SourceNeedle) => GeneratedMapping | InvalidGeneratedMapping; -/** - * Iterates each mapping in generated position order. - */ -export declare let eachMapping: (map: TraceMap, cb: (mapping: EachMapping) => void) => void; -/** - * A helper that skips sorting of the input map's mappings array, which can be expensive for larger - * maps. - */ -export declare let presortedDecodedMap: (map: DecodedSourceMap, mapUrl?: string) => TraceMap; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare let decodedMap: (map: TraceMap) => Omit & { - mappings: readonly SourceMapSegment[][]; -}; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare let encodedMap: (map: TraceMap) => EncodedSourceMap; -export { AnyMap } from './any-map'; -export declare class TraceMap implements SourceMap { - version: SourceMapV3['version']; - file: SourceMapV3['file']; - names: SourceMapV3['names']; - sourceRoot: SourceMapV3['sourceRoot']; - sources: SourceMapV3['sources']; - sourcesContent: SourceMapV3['sourcesContent']; - resolvedSources: string[]; - private _encoded; - private _decoded; - private _decodedMemo; - private _bySources; - private _bySourceMemos; - constructor(map: SourceMapInput, mapUrl?: string | null); -} diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts deleted file mode 100644 index 2cc90c0..0000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment'; -import type { TraceMap } from './trace-mapping'; -export interface SourceMapV3 { - file?: string | null; - names: string[]; - sourceRoot?: string; - sources: (string | null)[]; - sourcesContent?: (string | null)[]; - version: 3; -} -export interface EncodedSourceMap extends SourceMapV3 { - mappings: string; -} -export interface DecodedSourceMap extends SourceMapV3 { - mappings: SourceMapSegment[][]; -} -export interface Section { - offset: { - line: number; - column: number; - }; - map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap; -} -export interface SectionedSourceMap { - file?: string | null; - sections: Section[]; - version: 3; -} -export declare type OriginalMapping = { - source: string | null; - line: number; - column: number; - name: string | null; -}; -export declare type InvalidOriginalMapping = { - source: null; - line: null; - column: null; - name: null; -}; -export declare type GeneratedMapping = { - line: number; - column: number; -}; -export declare type InvalidGeneratedMapping = { - line: null; - column: null; -}; -export declare type SourceMapInput = string | EncodedSourceMap | DecodedSourceMap | TraceMap; -export declare type SectionedSourceMapInput = SourceMapInput | SectionedSourceMap; -export declare type Needle = { - line: number; - column: number; - bias?: 1 | -1; -}; -export declare type SourceNeedle = { - source: string; - line: number; - column: number; - bias?: 1 | -1; -}; -export declare type EachMapping = { - generatedLine: number; - generatedColumn: number; - source: null; - originalLine: null; - originalColumn: null; - name: null; -} | { - generatedLine: number; - generatedColumn: number; - source: string | null; - originalLine: number; - originalColumn: number; - name: string | null; -}; -export declare abstract class SourceMap { - version: SourceMapV3['version']; - file: SourceMapV3['file']; - names: SourceMapV3['names']; - sourceRoot: SourceMapV3['sourceRoot']; - sources: SourceMapV3['sources']; - sourcesContent: SourceMapV3['sourcesContent']; - resolvedSources: SourceMapV3['sources']; -} diff --git a/node_modules/@jridgewell/trace-mapping/package.json b/node_modules/@jridgewell/trace-mapping/package.json deleted file mode 100644 index a957780..0000000 --- a/node_modules/@jridgewell/trace-mapping/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@jridgewell/trace-mapping", - "version": "0.3.9", - "description": "Trace the original position through a source map", - "keywords": [ - "source", - "map" - ], - "main": "dist/trace-mapping.umd.js", - "module": "dist/trace-mapping.mjs", - "typings": "dist/types/trace-mapping.d.ts", - "files": [ - "dist" - ], - "exports": { - ".": { - "browser": "./dist/trace-mapping.umd.js", - "require": "./dist/trace-mapping.umd.js", - "import": "./dist/trace-mapping.mjs" - }, - "./package.json": "./package.json" - }, - "author": "Justin Ridgewell ", - "repository": { - "type": "git", - "url": "git+https://github.com/jridgewell/trace-mapping.git" - }, - "license": "MIT", - "scripts": { - "benchmark": "run-s build:rollup benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node benchmark/index.mjs", - "build": "run-s -n build:*", - "build:rollup": "rollup -c rollup.config.js", - "build:ts": "tsc --project tsconfig.build.json", - "lint": "run-s -n lint:*", - "lint:prettier": "npm run test:lint:prettier -- --write", - "lint:ts": "npm run test:lint:ts -- --fix", - "prebuild": "rm -rf dist", - "prepublishOnly": "npm run preversion", - "preversion": "run-s test build", - "test": "run-s -n test:lint test:only", - "test:debug": "ava debug", - "test:lint": "run-s -n test:lint:*", - "test:lint:prettier": "prettier --check '{src,test}/**/*.ts' '**/*.md'", - "test:lint:ts": "eslint '{src,test}/**/*.ts'", - "test:only": "c8 ava", - "test:watch": "ava --watch" - }, - "devDependencies": { - "@rollup/plugin-typescript": "8.3.0", - "@typescript-eslint/eslint-plugin": "5.10.0", - "@typescript-eslint/parser": "5.10.0", - "ava": "4.0.1", - "benchmark": "2.1.4", - "c8": "7.11.0", - "esbuild": "0.14.14", - "esbuild-node-loader": "0.6.4", - "eslint": "8.7.0", - "eslint-config-prettier": "8.3.0", - "npm-run-all": "4.1.5", - "prettier": "2.5.1", - "rollup": "2.64.0", - "typescript": "4.5.4" - }, - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } -} diff --git a/node_modules/@noble/curves/LICENSE b/node_modules/@noble/curves/LICENSE deleted file mode 100644 index 9297a04..0000000 --- a/node_modules/@noble/curves/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2022 Paul Miller (https://paulmillr.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the “Software”), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/@noble/curves/README.md b/node_modules/@noble/curves/README.md deleted file mode 100644 index 77a998a..0000000 --- a/node_modules/@noble/curves/README.md +++ /dev/null @@ -1,1129 +0,0 @@ -# noble-curves - -Audited & minimal JS implementation of elliptic curve cryptography. - -- 🔒 [**Audited**](#security) by independent security firms -- 🔻 Tree-shakeable: unused code is excluded from your builds -- 🏎 Fast: hand-optimized for caveats of JS engines -- 🔍 Reliable: cross-library / wycheproof tests and fuzzing ensure correctness -- ➰ Weierstrass, Edwards, Montgomery curves; ECDSA, EdDSA, Schnorr, BLS signatures -- ✍️ ECDH, hash-to-curve, OPRF, FROST, Poseidon hash, FFT -- 🔖 Non-repudiation (SUF-CMA, SBS) & consensus-friendliness (ZIP215) in ed25519, ed448 -- 🥈 Optional, friendly wrapper over native WebCrypto -- 🪶 32KB (gzipped) including bundled hashes, 11KB for single-curve build - -Curves have 5kb sister projects -[secp256k1](https://github.com/paulmillr/noble-secp256k1) & [ed25519](https://github.com/paulmillr/noble-ed25519). -They have smaller attack surface, but less features. - -Take a glance at [GitHub Discussions](https://github.com/paulmillr/noble-curves/discussions) for questions and support. - -### This library belongs to _noble_ cryptography - -> **noble cryptography** — high-security, easily auditable set of contained cryptographic libraries and tools. - -- Zero or minimal dependencies -- Highly readable TypeScript / JS code -- PGP-signed releases and transparent NPM builds -- All libraries: - [ciphers](https://github.com/paulmillr/noble-ciphers), - [curves](https://github.com/paulmillr/noble-curves), - [hashes](https://github.com/paulmillr/noble-hashes), - [post-quantum](https://github.com/paulmillr/noble-post-quantum), - 5kb [secp256k1](https://github.com/paulmillr/noble-secp256k1) / - [ed25519](https://github.com/paulmillr/noble-ed25519) -- [Check out the homepage](https://paulmillr.com/noble/) - for reading resources, documentation, and apps built with noble - -## Usage - -> `npm install @noble/curves` - -> `deno add jsr:@noble/curves` - -We support all major platforms and runtimes. -For React Native, you may need a [polyfill for getRandomValues](https://github.com/LinusU/react-native-get-random-values). -A standalone file [noble-curves.js](https://github.com/paulmillr/noble-curves/releases) is also available. - -```ts -// import * from '@noble/curves'; // Error: use sub-imports, to ensure small app size -import { secp256k1, schnorr } from '@noble/curves/secp256k1.js'; -import { ed25519, ed25519ph, ed25519ctx, x25519, ristretto255 } from '@noble/curves/ed25519.js'; -import { ed448, ed448ph, x448, decaf448 } from '@noble/curves/ed448.js'; -import { p256, p384, p521 } from '@noble/curves/nist.js'; -import { bls12_381 } from '@noble/curves/bls12-381.js'; -import { bn254 } from '@noble/curves/bn254.js'; -import { jubjub, babyjubjub, brainpoolP256r1, brainpoolP384r1, brainpoolP512r1 } from '@noble/curves/misc.js'; - -// hash-to-curve -import { secp256k1_hasher } from '@noble/curves/secp256k1.js'; -import { p256_hasher, p384_hasher, p521_hasher } from '@noble/curves/nist.js'; -import { ristretto255_hasher } from '@noble/curves/ed25519.js'; -import { decaf448_hasher } from '@noble/curves/ed448.js'; - -// OPRFs -import { p256_oprf, p384_oprf, p521_oprf } from '@noble/curves/nist.js'; -import { ristretto255_oprf } from '@noble/curves/ed25519.js'; -import { decaf448_oprf } from '@noble/curves/ed448.js'; - -// utils -import { bytesToHex, hexToBytes, concatBytes } from '@noble/curves/utils.js'; -import { Field } from '@noble/curves/abstract/modular.js'; -import { weierstrass, ecdsa } from '@noble/curves/abstract/weierstrass.js'; -import { edwards, eddsa } from '@noble/curves/abstract/edwards.js'; -import { poseidon, poseidonSponge } from '@noble/curves/abstract/poseidon.js'; -import { FFT, poly } from '@noble/curves/abstract/fft.js'; -``` - -- Examples - - [ECDSA, EdDSA, Schnorr signatures](#ecdsa-eddsa-schnorr-signatures) - - [secp256k1, p256, p384, p521, ed25519, ed448, brainpool](#secp256k1-p256-p384-p521-ed25519-ed448-brainpool) - - [ristretto255, decaf448](#ristretto255-decaf448) - - [Prehashed signing](#prehashed-signing) - - [Recovering public keys from signatures](#recovering-public-keys-from-signatures) - - [Hedged ECDSA with noise](#hedged-ecdsa-with-noise) - - [Consensus-friendliness vs e-voting](#consensus-friendliness-vs-e-voting) - - [ECDH: Diffie-Hellman shared secrets](#ecdh-diffie-hellman-shared-secrets) - - [webcrypto: Friendly wrapper](#webcrypto-friendly-wrapper) - - [BLS signatures, bls12-381, bn254 aka alt\_bn128](#bls-signatures-bls12-381-bn254-aka-alt_bn128) - - [Hashing to curve points](#hash-to-curve-hashing-to-curve-points) - - [OPRFs](#oprfs) - - [FROST threshold signatures](#frost-threshold-signatures) - - [Poseidon hash](#poseidon-poseidon-hash) - - [Fast Fourier Transform](#fft-fast-fourier-transform) - - [utils](#utils-byte-shuffling-conversion) -- [Internals](#internals) - - [Elliptic curve Point math](#elliptic-curve-point-math) - - [modular: Modular arithmetics \& finite fields](#modular-modular-arithmetics--finite-fields) - - [weierstrass: Custom Weierstrass curve](#weierstrass-custom-weierstrass-curve) - - [edwards: Custom Edwards curve](#edwards-custom-edwards-curve) - - [Custom ECDSA instance](#custom-ecdsa-instance) -- [Security](#security) -- [Speed](#speed) -- [Contributing & testing](#contributing--testing) -- [Upgrading](#upgrading) - -### ECDSA, EdDSA, Schnorr signatures - -#### secp256k1, p256, p384, p521, ed25519, ed448, brainpool - -```js -import { secp256k1, schnorr } from '@noble/curves/secp256k1.js'; -import { p256, p384, p521 } from '@noble/curves/nist.js'; -import { ed25519 } from '@noble/curves/ed25519.js'; -import { ed448 } from '@noble/curves/ed448.js'; -import { brainpoolP256r1, brainpoolP384r1, brainpoolP512r1 } from '@noble/curves/misc.js'; -for (const curve of [ - secp256k1, schnorr, - p256, p384, p521, - ed25519, ed448, - brainpoolP256r1, brainpoolP384r1, brainpoolP512r1 -]) { - const { secretKey, publicKey } = curve.keygen(); - const msg = new TextEncoder().encode('hello noble'); - const sig = curve.sign(msg, secretKey); - const isValid = curve.verify(sig, msg, publicKey); - console.log(curve, secretKey, publicKey, sig, isValid); -} - -// Specific private key -import { hexToBytes } from '@noble/curves/utils.js'; -const secret2 = hexToBytes('46c930bc7bb4db7f55da20798697421b98c4175a52c630294d75a84b9c126236'); -const pub2 = secp256k1.getPublicKey(secret2); -``` - -ECDSA signatures use deterministic k, conforming to [RFC 6979](https://www.rfc-editor.org/rfc/rfc6979). -EdDSA conforms to [RFC 8032](https://www.rfc-editor.org/rfc/rfc8032). -Schnorr (secp256k1-only) conforms to [BIP 340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki). - -Messages are always hashed first. - -#### ristretto255, decaf448 - -```ts -import { ristretto255, ristretto255_hasher, ristretto255_oprf } from '@noble/curves/ed25519.js'; -import { decaf448, decaf448_hasher, decaf448_oprf } from '@noble/curves/ed448.js'; - -console.log(ristretto255.Point, decaf448.Point); -``` - -Check out [RFC 9496](https://www.rfc-editor.org/rfc/rfc9496) more info on ristretto255 & decaf448. -Check out separate documentation for [Point](#elliptic-curve-point-math), [hasher](#hash-to-curve-hashing-to-curve-points) and [oprf](#oprfs). - -#### Prehashed signing - -```js -import { secp256k1 } from '@noble/curves/secp256k1.js'; -import { keccak_256 } from '@noble/hashes/sha3.js'; -const { secretKey } = secp256k1.keygen(); -const msg = new TextEncoder().encode('hello noble'); -// prehash: true (default) - hash using secp256k1.hash (sha256) -const sig = secp256k1.sign(msg, secretKey); -// prehash: false - hash using custom hash -const sigKeccak = secp256k1.sign(keccak_256(msg), secretKey, { prehash: false }); -``` - -Default sign() and verify() behavior (`prehash: true`) applies built-in hash function to message first. -For secp256k1 that's sha256, for p521 that's sha512. - -Providing `prehash: false` allows user to specify their own hash function (e.g. use secp256k1 + keccak_256). - -> [!NOTE] -> Previously, in noble-curves v1, `prehash: false` was the default. -> Some other libraries (like libsecp256k1) have no prehashing. - -#### Recovering public keys from signatures - -```js -import { secp256k1 } from '@noble/curves/secp256k1.js'; -const { secretKey, publicKey } = secp256k1.keygen(); -const msg = new TextEncoder().encode('hello noble'); -const sigRec = secp256k1.sign(msg, secretKey, { format: 'recovered' }); -const publicKey_ = secp256k1.recoverPublicKey(sigRec, msg); // == publicKey - -// recovered sig is compact sig with an extra byte -const sigNoRec = secp256k1.sign(msg, secretKey, { format: 'compact' }); -// sigNoRec == sigRec.slice(1) - -// Signature instance -const sigInstance = secp256k1.Signature.fromBytes(sigRec, 'recovered'); -``` - -Public key recovery - only supported with ECDSA. - -> [!NOTE] -> Key recovery is a simple math operation. -> There are no guarantees the signing was actually done. -> It's possible to forge signature and msg hash (r, s, h), which would -> recover into a random public key, but it's not feasible -> to find m which would lead to this specific forged h. - -#### Hedged ECDSA with noise - -```js -import { secp256k1 } from '@noble/curves/secp256k1.js'; -const { secretKey } = secp256k1.keygen(); -const msg = new TextEncoder().encode('hello noble'); -// extraEntropy: false - default, hedging disabled -const sigNoisy = secp256k1.sign(msg, secretKey); -// extraEntropy: true - fetch 32 random bytes from CSPRNG -const sigNoisyA = secp256k1.sign(msg, secretKey, { extraEntropy: true }); -// extraEntropy: bytes - specific extra entropy -const ent = Uint8Array.from([0xca, 0xfe, 0x01, 0x23]); -const sigNoisy2 = secp256k1.sign(msg, secretKey, { extraEntropy: ent }); -``` - -ECDSA `sign()` allows providing `extraEntropy`, which switches sig generation to hedged mode. - -By default, ECDSA signatures are generated deterministically, -following [RFC 6979](https://www.rfc-editor.org/rfc/rfc6979). -However, purely deterministic signatures are vulnerable to fault attacks. -Newer signature schemes, such as BIP340 schnorr, switched to hedged signatures because of this. -Hedging is basically incorporating some randomness into sig generation process. - -For more info, check out -[Deterministic signatures are not your friends](https://paulmillr.com/posts/deterministic-signatures/), -[RFC 6979](https://www.rfc-editor.org/rfc/rfc6979) section 3.6, -and [cfrg-det-sigs-with-noise draft](https://datatracker.ietf.org/doc/draft-irtf-cfrg-det-sigs-with-noise/). - -#### Consensus-friendliness vs e-voting - -```js -import { ed25519 } from '@noble/curves/ed25519.js'; -const { secretKey, publicKey } = ed25519.keygen(); -const msg = new TextEncoder().encode('hello noble'); -const sig = ed25519.sign(msg, secretKey); -// zip215: true -const isValid = ed25519.verify(sig, msg, publicKey); -// SBS / e-voting / RFC8032 / FIPS 186-5 -const isValidRfc = ed25519.verify(sig, msg, publicKey, { zip215: false }); -``` - -> [!NOTE] -> Most other libraries don't have SUF-CMA & SBS - less optimal choice for their security. - -In ed25519, there is an ability to choose between consensus-friendliness vs e-voting mode. - -* `zip215: true` (default) uses the more permissive, [consensus-friendly](https://hdevalence.ca/blog/2020-10-04-its-25519am) verification rules defined in [ZIP215](https://zips.z.cash/zip-0215). -* `zip215: false` enforces strict [RFC 8032](https://www.rfc-editor.org/rfc/rfc8032) / [FIPS 186-5](https://csrc.nist.gov/publications/detail/fips/186/5/final) verification and adds SBS-based non-repudiation, which is useful for: - * **Contract signing:** prevents a signer from later claiming they signed a different document - * **E-voting:** stops voters from choosing keys that let them repudiate their vote - * **Blockchains:** avoids signatures valid for multiple transactions (e.g., amount X also validating amount Y) - -Both modes have SUF-CMA (strong unforgeability under chosen message attacks). -See [Taming the many EdDSAs](https://eprint.iacr.org/2020/1244) for more info. - -### ECDH: Diffie-Hellman shared secrets - -```js -import { secp256k1 } from '@noble/curves/secp256k1.js'; -import { x25519 } from '@noble/curves/ed25519.js'; -import { x448 } from '@noble/curves/ed448.js'; -import { p256, p384, p521 } from '@noble/curves/nist.js'; - -for (const curve of [secp256k1, x25519, x448, p256, p384, p521]) { - const alice = curve.keygen(); - const bob = curve.keygen(); - const sharedKey = curve.getSharedSecret(alice.secretKey, bob.publicKey); - console.log('alice', alice, 'bob', bob, 'shared', sharedKey); -} - -// x25519 & x448 specific methods -import { ed25519 } from '@noble/curves/ed25519.js'; -const alice = ed25519.keygen(); -const bob = ed25519.keygen(); -const aliceSecX = ed25519.utils.toMontgomerySecret(alice.secretKey); -const bobPubX = ed25519.utils.toMontgomery(bob.publicKey); -const sharedKey = x25519.getSharedSecret(aliceSecX, bobPubX); -``` - -We provide ECDH over all Weierstrass curves, and over 2 Montgomery curves -X25519 (Curve25519) & X448 (Curve448), conforming to [RFC 7748](https://www.rfc-editor.org/rfc/rfc7748). - -In Weierstrass curves, shared secrets: - -- Include y-parity bytes: use `key.slice(1)` to strip it -- Are not hashed: use hashing or KDF on top, like `sha256(shared)` or `hkdf(shared)` - -#### webcrypto: Friendly wrapper - -> [!NOTE] -> Webcrypto methods are always async. - -##### webcrypto signatures - -```js -import { ed25519, ed448, p256, p384, p521 } from '@noble/curves/webcrypto.js'; - -(async () => { - for (let [name, curve] of Object.entries({ p256, p384, p521, ed25519, ed448 })) { - console.log('curve', name); - if (!await curve.isSupported()) { - console.log('is not supported, skipping'); - continue; - } - const keys = await curve.keygen(); - const msg = new TextEncoder().encode('hello noble'); - const sig = await curve.sign(msg, keys.secretKey); - const isValid = await curve.verify(sig, msg, keys.publicKey); - console.log({ - keys, msg, sig, isValid - }); - } -})(); -``` - -##### webcrypto ecdh - -```js -import { p256, p384, p521, x25519, x448 } from '@noble/curves/webcrypto.js'; - -(async () => { - for (let [name, curve] of Object.entries({ p256, p384, p521, x25519, x448 })) { - console.log('curve', name); - if (!await curve.isSupported()) { - console.log('is not supported, skipping'); - continue; - } - const alice = await curve.keygen(); - const bob = await curve.keygen(); - const shared = await curve.getSharedSecret(alice.secretKey, bob.publicKey); - const shared2 = await curve.getSharedSecret(bob.secretKey, alice.publicKey); - console.log({shared}); - } -})(); -``` - -##### Key conversion from noble to webcrypto and back - -```js -import { p256 as p256n } from '@noble/curves/nist.js'; -import { p256 } from '@noble/curves/webcrypto.js'; -(async () => { - const nobleKeys = p256n.keygen(); - // convert noble keys to webcrypto - const webKeys = { - secretKey: await p256.utils.convertSecretKey(nobleKeys.secretKey, 'raw', 'pkcs8'), - publicKey: await p256.utils.convertPublicKey(nobleKeys.publicKey, 'raw', 'spki') - }; - // convert webcrypto keys to noble - const nobleKeys2 = { - secretKey: await p256.utils.convertSecretKey(webKeys.secretKey, 'pkcs8', 'raw'), - publicKey: await p256.utils.convertPublicKey(webKeys.publicKey, 'spki', 'raw') - }; -})(); -``` - -Check out [micro-key-producer](https://github.com/paulmillr/micro-key-producer) for -pure JS key conversion utils. - -### BLS signatures, bls12-381, bn254 aka alt_bn128 - -```ts -import { bls12_381 } from '@noble/curves/bls12-381.js'; - -// G1 pubkeys, G2 sigs -const blsl = bls12_381.longSignatures; -const { secretKey, publicKey } = blsl.keygen(); -// const publicKey = blsl.getPublicKey(secretKey); -const msg = new TextEncoder().encode('hello noble'); -// default DST -const msgp = blsl.hash(msg); -// custom DST (Ethereum) -const msgpd = blsl.hash(msg, 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_'); -const signature = blsl.sign(msgp, secretKey); -const isValid = blsl.verify(signature, msgp, publicKey); -console.log('long', { publicKey, signature, isValid }); - -// G1 sigs, G2 pubkeys -const blss = bls12_381.shortSignatures; -const publicKey2 = blss.getPublicKey(secretKey); -const msgp2 = blss.hash(msg, 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_'); -const signature2 = blss.sign(msgp2, secretKey); -const isValid2 = blss.verify(signature2, msgp2, publicKey2); -console.log({ publicKey2, signature2, isValid2 }); - -// Aggregation -const aggregatedKey = bls12_381.longSignatures.aggregatePublicKeys([ - blsl.getPublicKey(bls12_381.utils.randomSecretKey()), - blsl.getPublicKey(bls12_381.utils.randomSecretKey()), -]); -// const aggregatedSig = bls.aggregateSignatures(sigs) - -// Pairings, with and without final exponentiation -// bls.pairing(PointG1, PointG2); -// bls.pairing(PointG1, PointG2, false); -// bls.fields.Fp12.finalExponentiate(bls.fields.Fp12.mul(PointG1, PointG2)); - -// Others -// bls.G1.Point.BASE, bls.G2.Point.BASE; -// bls.fields.Fp, bls.fields.Fp2, bls.fields.Fp12, bls.fields.Fr; -``` - -See [abstract/bls](#bls-barreto-lynn-scott-curves). -For example usage, check out [the implementation of BLS EVM precompiles](https://github.com/ethereumjs/ethereumjs-monorepo/blob/361f4edbc239e795a411ac2da7e5567298b9e7e5/packages/evm/src/precompiles/bls12_381/noble.ts). - -The BN254 API mirrors [BLS](#bls12-381). The curve was previously called alt_bn128. -The implementation is compatible with [EIP-196](https://eips.ethereum.org/EIPS/eip-196) and -[EIP-197](https://eips.ethereum.org/EIPS/eip-197). - -For BN254 usage, check out [the implementation of bn254 EVM precompiles](https://github.com/paulmillr/noble-curves/blob/3ed792f8ad9932765b84d1064afea8663a255457/test/bn254.test.js#L697). -We don't implement Point methods toBytes. To work around this limitation, has to initialize points on their own from BigInts. Reason it's not implemented is because [there is no standard](https://github.com/privacy-scaling-explorations/halo2curves/issues/109). -Points of divergence: - -- Endianness: LE vs BE (byte-swapped) -- Flags as first hex bits (similar to BLS) vs no-flags -- Imaginary part last in G2 vs first (c0, c1 vs c1, c0) - -### hash-to-curve: hashing to curve points - -```ts -import { bls12_381 } from '@noble/curves/bls12-381.js'; -import { ed25519_hasher, ristretto255_hasher } from '@noble/curves/ed25519.js'; -import { decaf448_hasher, ed448_hasher } from '@noble/curves/ed448.js'; -import { p256_hasher, p384_hasher, p521_hasher } from '@noble/curves/nist.js'; -import { secp256k1_hasher } from '@noble/curves/secp256k1.js'; - -const h = { - secp256k1_hasher, - p256_hasher, p384_hasher, p521_hasher, - ed25519_hasher, - ed448_hasher, - ristretto255_hasher, - decaf448_hasher, - bls_G1: bls12_381.G1, - bls_G2: bls12_381.G2 -}; - -const msg = Uint8Array.from([0xca, 0xfe, 0x01, 0x23]); -console.log('msg', msg); -for (let [name, c] of Object.entries(h)) { - const hashToCurve = c.hashToCurve(msg).toHex(); - const hashToCurve_customDST = c.hashToCurve(msg, { DST: 'hello noble' }).toHex(); - const encodeToCurve = 'encodeToCurve' in c ? c.encodeToCurve(msg).toHex() : undefined; - // ristretto255, decaf448 only - const deriveToCurve = 'deriveToCurve' in c ? - c.deriveToCurve!(new Uint8Array(c.Point.Fp.BYTES * 2)).toHex() : undefined; - const hashToScalar = c.hashToScalar(msg); - console.log({ - name, hashToCurve, hashToCurve_customDST, encodeToCurve, deriveToCurve, hashToScalar - }); -} - -// abstract methods -import { expand_message_xmd, expand_message_xof, hash_to_field } from '@noble/curves/abstract/hash-to-curve.js'; -``` - -The module allows to hash arbitrary strings to elliptic curve points. Implements [RFC 9380](https://www.rfc-editor.org/rfc/rfc9380). - -> [!NOTE] -> Why is `p256_hasher` separate from `p256`? -> The methods reside in separate _hasher namespace for tree-shaking: -> this way users who don't need hash-to-curve, won't have it in their builds. - -### OPRFs - -```js -import { p256_oprf, p384_oprf, p521_oprf } from '@noble/curves/nist.js'; -import { ristretto255_oprf } from '@noble/curves/ed25519.js'; -import { decaf448_oprf } from '@noble/curves/ed448.js'; -``` - -We provide OPRFs (oblivious pseudorandom functions), -conforming to [RFC 9497](https://www.rfc-editor.org/rfc/rfc9497). - -OPRF allows to interactively create an `Output = PRF(Input, serverSecretKey)`: - -- Server cannot calculate Output by itself: it doesn't know Input -- Client cannot calculate Output by itself: it doesn't know server secretKey -- An attacker interception the communication can't restore Input/Output/serverSecretKey and can't - link Input to some value. - -### FROST threshold signatures - -FROST implements [RFC 9591](https://www.rfc-editor.org/rfc/rfc9591) threshold Schnorr signing. -It is similar to multisig from the application point of view: any `min` of `max` participants -can jointly produce one Schnorr signature under a shared public key. -Supported ciphersuites are `p256_FROST`, `ed25519_FROST`, `ed448_FROST`, `ristretto255_FROST`, -`secp256k1_FROST`, and `schnorr_FROST` (Taproot-compatible secp256k1). -Signing has two rounds: selected signers commit first, then produce signature shares. - -> [!WARNING] -> The FROST code is new and has not been audited yet. -> It passes the imported `frost-rs` vectors/examples and local regression tests. - -```js -import { p256_FROST } from '@noble/curves/nist.js'; - -const signers = { min: 2, max: 3 }; -const alice = p256_FROST.Identifier.derive('alice@example.com'); -const bob = p256_FROST.Identifier.derive('bob@example.com'); -const carol = p256_FROST.Identifier.derive('carol@example.com'); -// trusted dealer -const deal = p256_FROST.trustedDealer(signers, [alice, bob, carol]); -for (const id of [alice, bob, carol]) p256_FROST.validateSecret(deal.secretShares[id], deal.public); - -const msg = new TextEncoder().encode('hello threshold'); -// round 1: selected signers commit -const aliceRound1 = p256_FROST.commit(deal.secretShares[alice]); -const bobRound1 = p256_FROST.commit(deal.secretShares[bob]); -const commitmentList = [aliceRound1.commitments, bobRound1.commitments]; -// round 2: signers produce signature shares -const sigShares = { - [alice]: p256_FROST.signShare( - deal.secretShares[alice], - deal.public, - aliceRound1.nonces, - commitmentList, - msg - ), - [bob]: p256_FROST.signShare( - deal.secretShares[bob], - deal.public, - bobRound1.nonces, - commitmentList, - msg - ), -}; -const sig = p256_FROST.aggregate(deal.public, commitmentList, msg, sigShares); -const isValid = p256_FROST.verify(sig, msg, deal.public.commitments[0]); -``` - -Key generation can be done with a trusted dealer or with DKG. -DKG has three rounds: participants commit to key generation, exchange private shares, then derive final participant keys. - -```js -import { p256_FROST } from '@noble/curves/nist.js'; - -const signers = { min: 2, max: 3 }; -const alice = p256_FROST.DKG.round1(p256_FROST.Identifier.fromNumber(1), signers); -const bob = p256_FROST.DKG.round1(p256_FROST.Identifier.fromNumber(2), signers); -const carol = p256_FROST.DKG.round1(p256_FROST.Identifier.fromNumber(3), signers); - -// round 1: participants commit to key generation -const aliceRound2 = p256_FROST.DKG.round2(alice.secret, [bob.public, carol.public]); -const bobRound2 = p256_FROST.DKG.round2(bob.secret, [alice.public, carol.public]); -const carolRound2 = p256_FROST.DKG.round2(carol.secret, [alice.public, bob.public]); - -// round 2: private shares for each recipient -const aliceKey = p256_FROST.DKG.round3(alice.secret, [bob.public, carol.public], [ - bobRound2[p256_FROST.Identifier.fromNumber(1)], - carolRound2[p256_FROST.Identifier.fromNumber(1)], -]); -// round 3: final participant key package -``` - -DKG helpers are intended for interoperable testing and practical key generation. -The library implements the cryptographic steps, not the surrounding application protocol: -callers still need authenticated communication, coordination, retries, session handling, and policy. - -### poseidon: Poseidon hash - -Implements [Poseidon](https://www.poseidon-hash.info) ZK-friendly hash: -permutation and sponge. - -There are many poseidon variants with different constants. -We don't provide them: you should construct them manually. -Check out [scure-starknet](https://github.com/paulmillr/scure-starknet) package for a proper example. - -```ts -import { bn254 } from '@noble/curves/bn254.js'; -import { grainGenConstants, poseidon, poseidonSponge } from '@noble/curves/abstract/poseidon.js'; - -const rate = 2; -const capacity = 1; -const Fp = bn254.fields.Fr; -const { mds, roundConstants } = grainGenConstants({ - Fp, - t: rate + capacity, - roundsFull: 8, - roundsPartial: 31, -}); -const opts = { - Fp, - rate, - capacity, - sboxPower: 17, - mds, - roundConstants, - roundsFull: 8, - roundsPartial: 31, -}; -const permutation = poseidon({ ...opts, t: rate + capacity }); -const sponge = poseidonSponge(opts); // use carefully, not specced -``` - -### fft: Fast Fourier Transform - -```ts -import * as fft from '@noble/curves/abstract/fft.js'; -import { bls12_381 } from '@noble/curves/bls12-381.js'; -const Fr = bls12_381.fields.Fr; -const roots = fft.rootsOfUnity(Fr, 7n); -const fftFr = fft.FFT(roots, Fr); -``` - -Experimental implementation of NTT / FFT (Fast Fourier Transform) over finite fields. -API may change at any time. The code has not been audited. Feature requests are welcome. - -### utils: byte shuffling, conversion - -```ts -import { bytesToHex, concatBytes, equalBytes, hexToBytes } from '@noble/curves/utils.js'; - -bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); -hexToBytes('cafe0123'); -concatBytes(Uint8Array.from([0xca, 0xfe]), Uint8Array.from([0x01, 0x23])); -equalBytes(Uint8Array.of(0xca), Uint8Array.of(0xca)); -``` - -### Internals - -#### Elliptic curve Point math - -```js -import { pippenger } from '@noble/curves/abstract/curve.js'; -import { secp256k1, schnorr } from '@noble/curves/secp256k1.js'; -import { p256, p384, p521 } from '@noble/curves/nist.js'; -import { ed25519, ristretto255 } from '@noble/curves/ed25519.js'; -import { ed448, decaf448 } from '@noble/curves/ed448.js'; -import { bls12_381 } from '@noble/curves/bls12-381.js'; -import { bn254 } from '@noble/curves/bn254.js'; -import { jubjub, babyjubjub } from '@noble/curves/misc.js'; - -const curves = [ - secp256k1, schnorr, p256, p384, p521, ed25519, ed448, - ristretto255, decaf448, - bls12_381.G1, bls12_381.G2, bn254.G1, - jubjub, babyjubjub -]; -for (const curve of curves) { - const { Point } = curve; - const { BASE, ZERO, Fp, Fn } = Point; - const info = Point.CURVE?.(); - const p = BASE.multiply(2n); - - // Initialization - if (info?.type === 'weierstrass') { - // projective (homogeneous) coordinates: (X, Y, Z) ∋ (x=X/Z, y=Y/Z) - const p_ = new Point(BASE.X, BASE.Y, BASE.Z); - } else if (info?.type === 'edwards') { - // extended coordinates: (X, Y, Z, T) ∋ (x=X/Z, y=Y/Z) - const p_ = new Point(BASE.X, BASE.Y, BASE.Z, BASE.T); - } - - // Math - const p1 = p.add(p); - const p2 = p.double(); - const p3 = p.subtract(p); - const p4 = p.negate(); - const p5 = p.multiply(451n); - - // MSM (multi-scalar multiplication) - const pa = [BASE, BASE.multiply(2n), BASE.multiply(4n), BASE.multiply(8n)]; - const p6 = pippenger(Point, pa, [3n, 5n, 7n, 11n]); - const _true3 = p6.equals(BASE.multiply(129n)); // 129*G - - const pcl = p.clearCofactor(); - const isTorsionFree = p.isTorsionFree(); - - const r1 = p.toBytes(); - const r1_ = Point.fromBytes(r1); - const r2 = p.toAffine(); - const { x, y } = r2; - const r2_ = Point.fromAffine(r2); -} -``` - -#### modular: Modular arithmetics & finite fields - -```js -import { mod, invert, Field } from '@noble/curves/abstract/modular.js'; - -// Finite Field utils -const fp = Field(2n ** 255n - 19n); // Finite field over 2^255-19 -fp.mul(591n, 932n); // multiplication -fp.pow(481n, 11024858120n); // exponentiation -fp.div(5n, 17n); // division: 5/17 mod 2^255-19 == 5 * invert(17) -fp.inv(5n); // modular inverse -fp.sqrt(4n); // square root - -// Non-Field generic utils are also available -mod(21n, 10n); // 21 mod 10 == 1n; fixed version of 21 % 10 -invert(17n, 10n); // invert(17) mod 10; modular multiplicative inverse -``` - -All arithmetics is done with JS bigints over finite fields, -which is defined from `modular` sub-module. - -Field operations are not constant-time: see [security](#security). -The fact is mostly irrelevant, but the important method to keep in mind is `pow`, -which may leak exponent bits, when used naïvely. - -#### weierstrass: Custom Weierstrass curve - -```js -import { weierstrass } from '@noble/curves/abstract/weierstrass.js'; -// NIST secp192r1 aka p192. https://www.secg.org/sec2-v2.pdf -const p192_CURVE = { - p: 0xfffffffffffffffffffffffffffffffeffffffffffffffffn, - n: 0xffffffffffffffffffffffff99def836146bc9b1b4d22831n, - h: 1n, - a: 0xfffffffffffffffffffffffffffffffefffffffffffffffcn, - b: 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1n, - Gx: 0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012n, - Gy: 0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811n, -}; -const p192_Point = weierstrass(p192_CURVE); -``` - -Short Weierstrass curve's formula is `y² = x³ + ax + b`. `weierstrass` -expects arguments `a`, `b`, field characteristic `p`, curve order `n`, -cofactor `h` and coordinates `Gx`, `Gy` of generator point. - -#### edwards: Custom Edwards curve - -```js -import { edwards } from '@noble/curves/abstract/edwards.js'; -const ed25519_CURVE = { - p: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn, - n: 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn, - h: 8n, - a: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn, - d: 0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n, - Gx: 0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an, - Gy: 0x6666666666666666666666666666666666666666666666666666666666666658n, -}; -const ed25519_Point = edwards(ed25519_CURVE); -``` - -Twisted Edwards curve's formula is `ax² + y² = 1 + dx²y²`. -You must specify `a`, `d`, field characteristic `p`, curve order `n` (sometimes named as `L`), -cofactor `h` and coordinates `Gx`, `Gy` of generator point. - -#### Custom ECDSA instance - -```js -import { weierstrass, ecdsa } from '@noble/curves/abstract/weierstrass.js'; -import { sha224, sha256 } from '@noble/hashes/sha2.js'; -const p192_CURVE = { - p: 0xfffffffffffffffffffffffffffffffeffffffffffffffffn, - n: 0xffffffffffffffffffffffff99def836146bc9b1b4d22831n, - h: 1n, - a: 0xfffffffffffffffffffffffffffffffefffffffffffffffcn, - b: 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1n, - Gx: 0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012n, - Gy: 0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811n, -}; -const p192_Point = weierstrass(p192_CURVE); -const p192_sha256 = ecdsa(p192_Point, sha256); -// or -const p192_sha224 = ecdsa(p192_Point, sha224); - -const keys = p192_sha256.keygen(); -const msg = new TextEncoder().encode('custom curve'); -const sig = p192_sha256.sign(msg, keys.secretKey); -const isValid = p192_sha256.verify(sig, msg, keys.publicKey); -``` - -## Security - -The library has been audited: - -- at version 2.2.0, in Apr 2026, by ourselves (self-audited) - - Scope: everything - - [Changes since audit](https://github.com/paulmillr/noble-curves/compare/2.2.0..main) -- at version 1.6.0, in Sep 2024, independently, by [Cure53](https://cure53.de) - - PDFs: [website](https://cure53.de/audit-report_noble-crypto-libs.pdf), [in-repo](./audit/2024-09-cure53-audit-nbl4.pdf) - - [Changes since audit](https://github.com/paulmillr/noble-curves/compare/1.6.0..main) - - Scope: ed25519, ed448, their add-ons, bls12-381, bn254, - hash-to-curve, low-level primitives bls, tower, edwards, montgomery. - - The audit has been funded by [OpenSats](https://opensats.org) -- at version 1.2.0, in Sep 2023, independently, by [Kudelski Security](https://kudelskisecurity.com) - - PDFs: [in-repo](./audit/2023-09-kudelski-audit-starknet.pdf) - - [Changes since audit](https://github.com/paulmillr/noble-curves/compare/1.2.0..main) - - Scope: [scure-starknet](https://github.com/paulmillr/scure-starknet) and its related - abstract modules of noble-curves: `curve`, `modular`, `poseidon`, `weierstrass` - - The audit has been funded by [Starkware](https://starkware.co) -- at version 0.7.3, in Feb 2023, independently, by [Trail of Bits](https://www.trailofbits.com) - - PDFs: [website](https://github.com/trailofbits/publications/blob/master/reviews/2023-01-ryanshea-noblecurveslibrary-securityreview.pdf), - [in-repo](./audit/2023-01-trailofbits-audit-curves.pdf) - - [Changes since audit](https://github.com/paulmillr/noble-curves/compare/0.7.3..main) - - Scope: abstract modules `curve`, `hash-to-curve`, `modular`, `poseidon`, `utils`, `weierstrass` and - top-level modules `_shortw_utils` and `secp256k1` - - The audit has been funded by [Ryan Shea](https://www.shea.io) - -It is tested against property-based, cross-library and Wycheproof vectors, -and is being fuzzed in [the separate repo](https://github.com/paulmillr/integration-tests). - -If you see anything unusual: investigate and report. - -### Constant-timeness - -We're targetting algorithmic constant time. _JIT-compiler_ and _Garbage Collector_ make "constant time" -extremely hard to achieve [timing attack](https://en.wikipedia.org/wiki/Timing_attack) resistance -in a scripting language. Which means _any other JS library can't have -constant-timeness_. Even statically typed Rust, a language without GC, -[makes it harder to achieve constant-time](https://www.chosenplaintext.ca/open-source/rust-timing-shield/security) -for some cases. If your goal is absolute security, don't use any JS lib — including bindings to native ones. -Use low-level libraries & languages. - -### Memory dumping - -Use low-level languages instead of JS / WASM if your goal is absolute security. - -The library mostly uses Uint8Arrays and bigints. - -- Uint8Arrays have `.fill(0)` which instructs to fill content with zeroes - but there are no guarantees in JS -- bigints are immutable and don't have a method to zeroize their content: - a user needs to wait until the next garbage collection cycle -- hex strings are also immutable: there is no way to zeroize them -- `await fn()` will write all internal variables to memory. With - async functions there are no guarantees when the code - chunk would be executed. Which means attacker can have - plenty of time to read data from memory. - -This means some secrets could stay in memory longer than anticipated. -However, if an attacker can read application memory, it's doomed anyway: -there is no way to guarantee anything about zeroizing sensitive data without -complex tests-suite which will dump process memory and verify that there is -no sensitive data left. For JS it means testing all browsers (including mobile). -And, of course, it will be useless without using the same -test-suite in the actual application that consumes the library. - -### Supply chain security - -- **Commits** are signed with PGP keys to prevent forgery. Be sure to verify the commit signatures -- **Releases** are made transparently through token-less GitHub CI and Trusted Publishing. Be sure to verify the [provenance logs](https://docs.npmjs.com/generating-provenance-statements) for authenticity. -- **Rare releasing** is practiced to minimize the need for re-audits by end-users. -- **Dependencies** are minimized and strictly pinned to reduce supply-chain risk. - - We use as few dependencies as possible. - - Version ranges are locked, and changes are checked with npm-diff. -- **Dev dependencies** are excluded from end-user installs; they’re only used for development and build steps. - -For this package, there is 1 dependency; and a few dev dependencies: - -- [noble-hashes](https://github.com/paulmillr/noble-hashes) provides cryptographic hashing functionality -- jsbt is used for benchmarking / testing / build tooling and developed by the same author -- prettier, fast-check and typescript are used for code quality / test generation / ts compilation - -### Randomness - -We rely on the built-in -[`crypto.getRandomValues`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues), -which is considered a cryptographically secure PRNG. - -Browsers have had weaknesses in the past - and could again - but implementing a userspace CSPRNG is even worse, as there’s no reliable userspace source of high-quality entropy. - -### Quantum computers - -Cryptographically relevant quantum computer, if built, will allow to -break elliptic curve cryptography (both ECDSA / EdDSA & ECDH) using Shor's algorithm. - -Consider switching to newer / hybrid algorithms, such as SPHINCS+. They are available in -[noble-post-quantum](https://github.com/paulmillr/noble-post-quantum). - -NIST prohibits classical cryptography (RSA, DSA, ECDSA, ECDH) [after 2035](https://nvlpubs.nist.gov/nistpubs/ir/2024/NIST.IR.8547.ipd.pdf). Australian ASD prohibits it [after 2030](https://www.cyber.gov.au/resources-business-and-government/essential-cyber-security/ism/cyber-security-guidelines/guidelines-cryptography). - -## Speed - -```sh -npm run bench -``` - -noble-curves spends 10+ ms to generate 20MB+ of base point precomputes. -This is done **one-time** per curve. - -The generation is deferred until any method (pubkey, sign, verify) is called. -User can force precompute generation by manually calling `Point.BASE.precompute(windowSize, false)`. -Check out the source code. - -Benchmark results on Apple M4: - -``` -# secp256k1 -init 10ms -getPublicKey x 9,099 ops/sec @ 109μs/op -sign x 7,182 ops/sec @ 139μs/op -verify x 1,188 ops/sec @ 841μs/op -recoverPublicKey x 1,265 ops/sec @ 790μs/op -getSharedSecret x 735 ops/sec @ 1ms/op -schnorr.sign x 957 ops/sec @ 1ms/op -schnorr.verify x 1,210 ops/sec @ 825μs/op - -# ed25519 -init 14ms -getPublicKey x 14,216 ops/sec @ 70μs/op -sign x 6,849 ops/sec @ 145μs/op -verify x 1,400 ops/sec @ 713μs/op - -# ed448 -init 37ms -getPublicKey x 5,273 ops/sec @ 189μs/op -sign x 2,494 ops/sec @ 400μs/op -verify x 476 ops/sec @ 2ms/op - -# p256 -init 17ms -getPublicKey x 8,977 ops/sec @ 111μs/op -sign x 7,236 ops/sec @ 138μs/op -verify x 877 ops/sec @ 1ms/op - -# p384 -init 42ms -getPublicKey x 4,084 ops/sec @ 244μs/op -sign x 3,247 ops/sec @ 307μs/op -verify x 331 ops/sec @ 3ms/op - -# p521 -init 83ms -getPublicKey x 2,049 ops/sec @ 487μs/op -sign x 1,748 ops/sec @ 571μs/op -verify x 170 ops/sec @ 5ms/op - -# ristretto255 -add x 931,966 ops/sec @ 1μs/op -multiply x 15,444 ops/sec @ 64μs/op -encode x 21,367 ops/sec @ 46μs/op -decode x 21,715 ops/sec @ 46μs/op - -# decaf448 -add x 478,011 ops/sec @ 2μs/op -multiply x 416 ops/sec @ 2ms/op -encode x 8,562 ops/sec @ 116μs/op -decode x 8,636 ops/sec @ 115μs/op - -# ECDH -x25519 x 1,981 ops/sec @ 504μs/op -x448 x 743 ops/sec @ 1ms/op -secp256k1 x 728 ops/sec @ 1ms/op -p256 x 705 ops/sec @ 1ms/op -p384 x 268 ops/sec @ 3ms/op -p521 x 137 ops/sec @ 7ms/op - -# hash-to-curve -hashToPrivateScalar x 1,754,385 ops/sec @ 570ns/op -hash_to_field x 135,703 ops/sec @ 7μs/op -hashToCurve secp256k1 x 3,194 ops/sec @ 313μs/op -hashToCurve p256 x 5,962 ops/sec @ 167μs/op -hashToCurve p384 x 2,230 ops/sec @ 448μs/op -hashToCurve p521 x 1,063 ops/sec @ 940μs/op -hashToCurve ed25519 x 4,047 ops/sec @ 247μs/op -hashToCurve ed448 x 1,691 ops/sec @ 591μs/op -hash_to_ristretto255 x 8,733 ops/sec @ 114μs/op -hash_to_decaf448 x 3,882 ops/sec @ 257μs/op - -# modular over secp256k1 P field -invert a x 866,551 ops/sec @ 1μs/op -invert b x 693,962 ops/sec @ 1μs/op -sqrt p = 3 mod 4 x 25,738 ops/sec @ 38μs/op -sqrt tonneli-shanks x 847 ops/sec @ 1ms/op - -# bls12-381 -init 22ms -getPublicKey x 1,325 ops/sec @ 754μs/op -sign x 80 ops/sec @ 12ms/op -verify x 62 ops/sec @ 15ms/op -pairing x 166 ops/sec @ 6ms/op -pairing10 x 54 ops/sec @ 18ms/op ± 23.48% (15ms..36ms) -MSM 4096 scalars x points 3286ms -aggregatePublicKeys/8 x 173 ops/sec @ 5ms/op -aggregatePublicKeys/32 x 46 ops/sec @ 21ms/op -aggregatePublicKeys/128 x 11 ops/sec @ 84ms/op -aggregatePublicKeys/512 x 2 ops/sec @ 335ms/op -aggregatePublicKeys/2048 x 0 ops/sec @ 1346ms/op -aggregateSignatures/8 x 82 ops/sec @ 12ms/op -aggregateSignatures/32 x 21 ops/sec @ 45ms/op -aggregateSignatures/128 x 5 ops/sec @ 178ms/op -aggregateSignatures/512 x 1 ops/sec @ 705ms/op -aggregateSignatures/2048 x 0 ops/sec @ 2823ms/op -``` - -## Upgrading - -Supported node.js versions: - -- v2 (2025-08): v20.19+ (ESM-only) -- v1 (2023-04): v14.21+ (ESM & CJS) - -### Changelog of curves v1 to curves v2 - -v2 massively simplifies internals, improves security, reduces bundle size and lays path for the future. -We tried to keep v2 as much backwards-compatible as possible. - -To simplify upgrading, upgrade first to curves 1.9.x. It would show deprecations in vscode-like text editor. -Fix them first. - -- The package is now ESM-only. ESM can finally be loaded from common.js on node v20.19+ -- `.js` extension must be used for all modules - - Old: `@noble/curves/ed25519` - - New: `@noble/curves/ed25519.js` - - This simplifies working in browsers natively without transpilers - -New features: - -- webcrypto: create friendly noble-like wrapper over built-in WebCrypto -- oprf: implement RFC 9497 OPRFs (oblivious pseudorandom functions) - - We support p256, p384, p521, ristretto255 and decaf448 -- weierstrass, edwards: add `isValidSecretKey`, `isValidPublicKey` -- misc: add Brainpool curves: brainpoolP256r1, brainpoolP384r1, brainpoolP512r1 - -Changes: - -- Most methods now expect Uint8Array, string hex inputs are prohibited - - The change simplifies reasoning, improves security and reduces malleability - - `Point.fromHex` now expects string-only hex inputs, use `Point.fromBytes` for Uint8Array -- Many methods were renamed, upgrade to curves v1.9 first to highlight deprecated old names -- Breaking changes of ECDSA (secp256k1, p256, p384...): - - To bring back old behavior, pass `{ prehash: false, lowS: false }` to sign / verify - - sign, verify: Switch to **prehashed messages**. Instead of - messageHash, the methods now expect unhashed message. - To bring back old behavior, use option `{prehash: false}` - - sign, verify: Switch to **lowS signatures** by default. - This change doesn't affect secp256k1, which has been using lowS since beginning. - To bring back old behavior, use option `{lowS: false}` - - sign, verify: Switch to **Uint8Array signatures** (format: 'compact') by default. - - verify: **der format must be explicitly specified** in `{format: 'der'}`. - This reduces malleability - - verify: **prohibit Signature-instance** signature. User must now always do - `signature.toBytes()` -- Breaking changes of BLS signatures (bls12-381, bn254): - - Move getPublicKey, sign, verify, signShortSignature etc into two new namespaces: - bls.longSignatures (G1 pubkeys, G2 sigs) and bls.shortSignatures (G1 sigs, G2 pubkeys). - - verifyBatch now expects array of inputs `{message: ..., publicKey: ...}[]` -- Curve changes: - - Massively simplify curve creation, split it into point creation & sig generator creation - - New methods are `weierstrass() + ecdsa()` / `edwards() + eddsa()` - - weierstrass / edwards expect simplified curve params (Fp became p) - - ecdsa / eddsa expect Point class and hash - - Remove unnecessary Fn argument in `pippenger` -- modular changes: - - Field#fromBytes() now validates elements to be in 0..order-1 range -- Massively improve error messages, make them more descriptive - -Renamings: - -- Module changes - - `p256`, `p384`, `p521` modules have been moved into `nist` - - `jubjub` module has been moved into `misc` -- Point changes - - ExtendedPoint, ProjectivePoint => Point - - Point coordinates (projective / extended) from px/ex, py/ey, pz/ez, et => X, Y, Z, T - - Point.normalizeZ, Point.msm => separate methods in `abstract/curve.js` submodule - - Point.fromPrivateKey() got removed, use `Point.BASE.multiply()` and `Point.Fn.fromBytes(secretKey)` - - toRawBytes, fromRawBytes => toBytes, fromBytes - - RistrettoPoint => ristretto255.Point, DecafPoiont => decaf448.Point -- Signature (ECDSA) changes - - toCompactRawBytes, toDERRawBytes => toBytes('compact'), toBytes('der') - - toCompactHex, toDERHex => toHex('compact'), toHex('der') - - fromCompact, fromDER => fromBytes(format), fromHex(format) -- utils changes - - randomPrivateKey => randomSecretKey - - utils.precompute, Point#_setWindowSize => Point#precompute - - edwardsToMontgomery => utils.toMontgomery - - edwardsToMontgomeryPriv => utils.toMontgomerySecret -- Rename all curve-specific hash-to-curve methods to `*curve*_hasher`. - Example: `secp256k1.hashToCurve` => `secp256k1_hasher.hashToCurve()` -- Massive type renamings and improvements - -Removed features: - -- Point#multiplyAndAddUnsafe, Point#hasEvenY -- `CURVE` property with all kinds of random stuff. Point.CURVE() now replaces it, but only provides - curve parameters -- Remove `pasta`, `bn254_weierstrass` (NOT pairing-based bn254) curves -- utils.normPrivateKeyToScalar - use `Point.Fn.fromBytes` -- Field.MASK - -### secp256k1 v1, ed25519 v1, bls12-381 v1 to curves v1 - -Previously, the library was split into single-feature packages -[noble-secp256k1](https://github.com/paulmillr/noble-secp256k1), -[noble-ed25519](https://github.com/paulmillr/noble-ed25519) and -[noble-bls12-381](https://github.com/paulmillr/noble-bls12-381). - -Curves continue their original work. The single-feature packages changed their -direction towards providing minimal 5kb implementations of cryptography, -which means they have less features. Separate bls package had been deprecated. - -secp256k1: - -- `getPublicKey`: defaults to compressed sigs (use second argument to adjust) -- `sign`: renamed options `canonical` => `lowS`; `der` => `format: 'der'` -- `verify`: renamed option `strict` => `lowS` -- `getSharedSecret`: defaults to compressed sigs (use third argument to adjust) -- `recoverPublicKey(msg, sig, rec)` was changed to `sig.recoverPublicKey(msg)` -- `Point` (2d xy) has been changed to `ProjectivePoint` (3d xyz) - -ed25519: - -- `Signature` was removed in favor of raw bytes -- `getSharedSecret` was moved to `x25519` module - -bls12-381: - -- Renamed PointG1 -> G1.Point, PointG2 -> G2.Point -- Renamed PointG2.fromSignature -> Signature.decode, PointG2.toSignature -> Signature.encode - -## Contributing & testing - -- `npm install && npm run build && npm test` will build the code and run tests. -- `npm run lint` / `npm run format` will run linter / fix linter issues. -- `npm run bench` will run benchmarks -- `npm run build:release` will build single file - -See [paulmillr.com/noble](https://paulmillr.com/noble/) -for useful resources, articles, documentation and demos -related to the library. - -MuSig2 signature scheme and BIP324 ElligatorSwift mapping for secp256k1 -are available [in a separate package](https://github.com/paulmillr/scure-btc-signer). - -## License - -The MIT License (MIT) - -Copyright (c) 2022 Paul Miller [(https://paulmillr.com)](https://paulmillr.com) - -See LICENSE file. diff --git a/node_modules/@noble/curves/abstract/bls.d.ts b/node_modules/@noble/curves/abstract/bls.d.ts deleted file mode 100644 index 1ade638..0000000 --- a/node_modules/@noble/curves/abstract/bls.d.ts +++ /dev/null @@ -1,411 +0,0 @@ -/** - * BLS != BLS. - * The file implements BLS (Boneh-Lynn-Shacham) signatures. - * Used in both BLS (Barreto-Lynn-Scott) and BN (Barreto-Naehrig) - * families of pairing-friendly curves. - * Consists of two curves: G1 and G2: - * - G1 is a subgroup of (x, y) E(Fq) over y² = x³ + 4. - * - G2 is a subgroup of ((x₁, x₂+i), (y₁, y₂+i)) E(Fq²) over y² = x³ + 4(1 + i) where i is √-1 - * - Gt, created by bilinear (ate) pairing e(G1, G2), consists of p-th roots of unity in - * Fq^k where k is embedding degree. Only degree 12 is currently supported, 24 is not. - * Pairing is used to aggregate and verify signatures. - * There are two modes of operation: - * - Long signatures: X-byte keys + 2X-byte sigs (G1 keys + G2 sigs). - * - Short signatures: 2X-byte keys + X-byte sigs (G2 keys + G1 sigs). - * @module - **/ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { type TArg, type TRet } from '../utils.ts'; -import { type CurveLengths } from './curve.ts'; -import { type H2CHasher, type H2COpts, type MapToCurve } from './hash-to-curve.ts'; -import { type IField } from './modular.ts'; -import type { Fp12, Fp12Bls, Fp2, Fp2Bls, Fp6Bls } from './tower.ts'; -import { type WeierstrassPoint, type WeierstrassPointCons } from './weierstrass.ts'; -type Fp = bigint; -/** - * Twist convention used by the pairing formulas for a concrete curve family. - * BLS12-381 uses a multiplicative twist, while BN254 uses a divisive one. - */ -export type BlsTwistType = 'multiplicative' | 'divisive'; -/** - * Codec exposed as `curve.shortSignatures.Signature`. - * Use it to parse or serialize G1 signatures in short-signature mode. - * In this mode, public keys live in G2. - */ -export type BlsShortSignatureCoder = { - /** - * Parse a compressed signature from raw bytes. - * @param bytes - Compressed signature bytes. - * @returns Parsed signature point. - */ - fromBytes(bytes: TArg): WeierstrassPoint; - /** - * Parse a compressed signature from a hex string. - * @param hex - Compressed signature hex string. - * @returns Parsed signature point. - */ - fromHex(hex: string): WeierstrassPoint; - /** - * Encode a signature point into compressed bytes. - * @param point - Signature point. - * @returns Compressed signature bytes. - */ - toBytes(point: WeierstrassPoint): TRet; - /** - * Encode a signature point into a hex string. - * @param point - Signature point. - * @returns Compressed signature hex. - */ - toHex(point: WeierstrassPoint): string; -}; -/** - * Codec exposed as `curve.longSignatures.Signature`. - * Use it to parse or serialize G2 signatures in long-signature mode. - * In this mode, public keys live in G1. - */ -export type BlsLongSignatureCoder = { - /** - * Parse a compressed signature from raw bytes. - * @param bytes - Compressed signature bytes. - * @returns Parsed signature point. - */ - fromBytes(bytes: TArg): WeierstrassPoint; - /** - * Parse a compressed signature from a hex string. - * @param hex - Compressed signature hex string. - * @returns Parsed signature point. - */ - fromHex(hex: string): WeierstrassPoint; - /** - * Encode a signature point into compressed bytes. - * @param point - Signature point. - * @returns Compressed signature bytes. - */ - toBytes(point: WeierstrassPoint): TRet; - /** - * Encode a signature point into a hex string. - * @param point - Signature point. - * @returns Compressed signature hex. - */ - toHex(point: WeierstrassPoint): string; -}; -/** Tower fields needed by pairing code, hash-to-curve, and subgroup arithmetic. */ -export type BlsFields = { - /** Base field of G1 coordinates. */ - Fp: IField; - /** Scalar field used for secret scalars and subgroup order arithmetic. */ - Fr: IField; - /** Quadratic extension field used by G2. */ - Fp2: Fp2Bls; - /** Sextic extension field used inside pairing arithmetic. */ - Fp6: Fp6Bls; - /** Degree-12 extension field that contains the GT target group. */ - Fp12: Fp12Bls; -}; -/** - * Callback used by pairing post-processing hooks to add one more G2 point to the Miller-loop state. - * @param Rx - Current projective X coordinate. - * @param Ry - Current projective Y coordinate. - * @param Rz - Current projective Z coordinate. - * @param Qx - G2 affine x coordinate. - * @param Qy - G2 affine y coordinate. - * @returns Updated projective accumulator coordinates. - */ -export type BlsPostPrecomputePointAddFn = (Rx: Fp2, Ry: Fp2, Rz: Fp2, Qx: Fp2, Qy: Fp2) => { - Rx: Fp2; - Ry: Fp2; - Rz: Fp2; -}; -/** - * Hook for curve-specific pairing cleanup after the Miller loop precomputes are built. - * @param Rx - Current projective X coordinate. - * @param Ry - Current projective Y coordinate. - * @param Rz - Current projective Z coordinate. - * @param Qx - G2 affine x coordinate. - * @param Qy - G2 affine y coordinate. - * @param pointAdd - Callback used to fold one more point into the accumulator. - */ -export type BlsPostPrecomputeFn = (Rx: Fp2, Ry: Fp2, Rz: Fp2, Qx: Fp2, Qy: Fp2, pointAdd: BlsPostPrecomputePointAddFn) => void; -/** Low-level pairing helpers shared by BLS curve bundles. */ -export type BlsPairing = { - /** Byte lengths for keys and signatures exposed by this pairing family. */ - lengths: CurveLengths; - /** Scalar field used by the pairing and signing helpers. */ - Fr: IField; - /** Target field used for the GT result of pairings. */ - Fp12: Fp12Bls; - /** - * Build Miller-loop precomputes for one G2 point. - * @param p - G2 point to precompute. - * @returns Pairing precompute table. - */ - calcPairingPrecomputes: (p: WeierstrassPoint) => Precompute; - /** - * Evaluate a batch of Miller loops from precomputed line coefficients. - * @param pairs - Precomputed Miller-loop inputs. - * @returns Accumulated GT value before or after final exponentiation. - */ - millerLoopBatch: (pairs: [Precompute, Fp, Fp][]) => Fp12; - /** - * Pair one G1 point with one G2 point. - * @param P - G1 point. - * @param Q - G2 point. - * @param withFinalExponent - Whether to apply the final exponentiation step. - * @returns GT pairing result. - * @throws If either point is the point at infinity. {@link Error} - */ - pairing: (P: WeierstrassPoint, Q: WeierstrassPoint, withFinalExponent?: boolean) => Fp12; - /** - * Pair many G1/G2 pairs in one batch. - * @param pairs - Point pairs to accumulate. - * @param withFinalExponent - Whether to apply the final exponentiation step. - * @returns GT pairing result. Empty input returns the multiplicative identity in GT. - */ - pairingBatch: (pairs: { - g1: WeierstrassPoint; - g2: WeierstrassPoint; - }[], withFinalExponent?: boolean) => Fp12; - /** - * Generate a random secret key for this pairing family. - * @param seed - Optional seed material. - * @returns Secret key bytes. - */ - randomSecretKey: (seed?: TArg) => TRet; -}; -/** - * Parameters that define the Miller-loop shape and twist handling - * for a concrete pairing family. - */ -export type BlsPairingParams = { - /** Signed loop parameter used by the Miller loop. */ - ateLoopSize: bigint; - /** Whether the signed Miller-loop parameter is negative. */ - xNegative: boolean; - /** - * Twist convention used by the pairing formulas. - * BLS12-381 is multiplicative; BN254 is divisive. - */ - twistType: BlsTwistType; - /** - * Optional RNG override used by helper constructors. - * Receives the requested byte length and returns random bytes. - */ - randomBytes?: (len?: number) => TRet; - /** - * Optional hook for curve-specific untwisting after precomputation. - * Used by BN254 after the Miller loop. - */ - postPrecompute?: BlsPostPrecomputeFn; -}; -/** Hash-to-curve settings shared by the G1 and G2 hashers inside a BLS curve bundle. */ -export type BlsHasherParams = { - /** - * Optional map-to-curve override for G1. - * Receives the hash-to-field tuple and returns one affine G1 point. - */ - mapToG1?: MapToCurve; - /** - * Optional map-to-curve override for G2. - * Receives the hash-to-field tuple and returns one affine G2 point. - */ - mapToG2?: MapToCurve; - /** Shared baseline hash-to-curve options. */ - hasherOpts: H2COpts; - /** G1-specific hash-to-curve options merged on top of `hasherOpts`. */ - hasherOptsG1: H2COpts; - /** G2-specific hash-to-curve options merged on top of `hasherOpts`. */ - hasherOptsG2: H2COpts; -}; -type PrecomputeSingle = [Fp2, Fp2, Fp2][]; -type Precompute = PrecomputeSingle[]; -/** - * BLS consists of two curves: G1 and G2: - * - G1 is a subgroup of (x, y) E(Fq) over y² = x³ + 4. - * - G2 is a subgroup of ((x₁, x₂+i), (y₁, y₂+i)) E(Fq²) over y² = x³ + 4(1 + i) where i is √-1 - */ -export interface BlsCurvePair { - /** Byte lengths for keys and signatures exposed by this curve family. */ - lengths: CurveLengths; - /** - * Shared Miller-loop batch evaluator. - * @param pairs - Precomputed Miller-loop inputs. - * @returns Accumulated GT value. - */ - millerLoopBatch: BlsPairing['millerLoopBatch']; - /** - * Pair one G1 point with one G2 point. - * @param P - G1 point. - * @param Q - G2 point. - * @param withFinalExponent - Whether to apply the final exponentiation step. - * @returns GT pairing result. - * @throws If either point is the point at infinity. {@link Error} - */ - pairing: BlsPairing['pairing']; - /** - * Pair many G1/G2 pairs in one batch. - * @param pairs - Point pairs to accumulate. - * @param withFinalExponent - Whether to apply the final exponentiation step. - * @returns GT pairing result. Empty input returns the multiplicative identity in GT. - */ - pairingBatch: BlsPairing['pairingBatch']; - /** G1 point constructor for the base field subgroup. */ - G1: { - Point: WeierstrassPointCons; - }; - /** G2 point constructor for the twist subgroup. */ - G2: { - Point: WeierstrassPointCons; - }; - /** Tower fields exposed by the pairing implementation. */ - fields: { - Fp: IField; - Fp2: Fp2Bls; - Fp6: Fp6Bls; - Fp12: Fp12Bls; - Fr: IField; - }; - /** Utility helpers shared by hashers and signers. */ - utils: { - randomSecretKey: (seed?: TArg) => TRet; - calcPairingPrecomputes: BlsPairing['calcPairingPrecomputes']; - }; - /** Public pairing parameters exposed for introspection. */ - params: { - ateLoopSize: bigint; - twistType: BlsTwistType; - }; -} -/** BLS curve bundle extended with hash-to-curve helpers for G1 and G2. */ -export interface BlsCurvePairWithHashers extends BlsCurvePair { - /** G1 hasher bundle with RFC 9380 helpers. */ - G1: H2CHasher>; - /** G2 hasher bundle with RFC 9380 helpers. */ - G2: H2CHasher>; -} -/** BLS curve bundle extended with both hashers and signature helpers. */ -export interface BlsCurvePairWithSignatures extends BlsCurvePairWithHashers { - /** Long-signature mode: G1 public keys and G2 signatures. */ - longSignatures: BlsSigs; - /** Short-signature mode: G2 public keys and G1 signatures. */ - shortSignatures: BlsSigs; -} -type BLSInput = TArg; -/** BLS signer helpers for one signature mode. */ -export interface BlsSigs { - /** Byte lengths for secret keys, public keys, and signatures. */ - lengths: CurveLengths; - /** - * Generate a secret/public key pair for this signature mode. - * @param seed - Optional seed material. - * @returns Secret and public key pair. - */ - keygen(seed?: TArg): { - secretKey: TRet; - publicKey: WeierstrassPoint

; - }; - /** - * Derive the public key from a secret key. - * @param secretKey - Secret key bytes. - * @returns Public-key point. - */ - getPublicKey(secretKey: TArg): WeierstrassPoint

; - /** - * Sign a message already hashed onto the signature subgroup. - * @param hashedMessage - Message mapped to the signature subgroup. - * @param secretKey - Secret key bytes. - * @returns Signature point. - */ - sign(hashedMessage: WeierstrassPoint, secretKey: TArg): WeierstrassPoint; - /** - * Verify one signature against one public key and hashed message. - * @param signature - Signature point or encoded signature. - * @param message - Hashed message point. - * @param publicKey - Public-key point or encoded key. - * @returns Whether the signature is valid. - */ - verify(signature: WeierstrassPoint | BLSInput, message: WeierstrassPoint, publicKey: WeierstrassPoint

| BLSInput): boolean; - /** - * Verify one aggregated signature against many `(message, publicKey)` pairs. - * @param signature - Aggregated signature. - * @param items - Message/public-key pairs. - * @returns Whether the aggregated signature is valid. Same-message aggregate verification still - * requires proof of possession or another rogue-key defense from the caller. - */ - verifyBatch: (signature: WeierstrassPoint | BLSInput, items: { - message: WeierstrassPoint; - publicKey: WeierstrassPoint

| BLSInput; - }[]) => boolean; - /** - * Add many public keys into one aggregate point. - * @param publicKeys - Public keys to aggregate. - * @returns Aggregated public-key point. This is raw point addition and does not add proof of - * possession or rogue-key protection on its own. - */ - aggregatePublicKeys(publicKeys: (WeierstrassPoint

| BLSInput)[]): WeierstrassPoint

; - /** - * Add many signatures into one aggregate point. - * @param signatures - Signatures to aggregate. - * @returns Aggregated signature point. This is raw point addition and does not change the proof - * of possession requirements of the aggregate-verification scheme. - */ - aggregateSignatures(signatures: (WeierstrassPoint | BLSInput)[]): WeierstrassPoint; - /** - * Hash an arbitrary message onto the signature subgroup. - * @param message - Message bytes. - * @param DST - Optional domain separation tag. - * @returns Curve point on the signature subgroup. - */ - hash(message: TArg, DST?: TArg): WeierstrassPoint; - /** Signature codec for this mode. */ - Signature: BlsLongSignatureCoder; -} -type BlsSignatureCoders = Partial<{ - LongSignature: BlsLongSignatureCoder; - ShortSignature: BlsShortSignatureCoder; -}>; -/** - * @param fields - Tower field implementations. - * @param G1_Point - G1 point constructor. - * @param G2_Point - G2 point constructor. - * @param params - Pairing parameters. See {@link BlsPairingParams}. - * @returns Pairing-only BLS helpers. The returned pairing surface rejects infinity inputs, while - * empty `pairingBatch(...)` calls return the multiplicative identity in GT. This keeps the - * low-level pairing API fail-closed for BLS-style callers, where identity points usually signal - * broken hash / wiring instead of an intentionally neutral pairing term. This also eagerly - * precomputes the G1 base-point table as a performance side effect. - * @throws If the pairing parameters or underlying curve helpers are inconsistent. {@link Error} - * @example - * ```ts - * import { blsBasic } from '@noble/curves/abstract/bls.js'; - * import { bn254 } from '@noble/curves/bn254.js'; - * // Pair a G1 point with a G2 point without the higher-level signer helpers. - * const gt = bn254.pairing(bn254.G1.Point.BASE, bn254.G2.Point.BASE); - * ``` - */ -export declare function blsBasic(fields: TArg, G1_Point: WeierstrassPointCons, G2_Point: WeierstrassPointCons, params: TArg): BlsCurvePair; -/** - * @param fields - Tower field implementations. - * @param G1_Point - G1 point constructor. - * @param G2_Point - G2 point constructor. - * @param params - Pairing parameters. See {@link BlsPairingParams}. - * @param hasherParams - Hash-to-curve configuration. See {@link BlsHasherParams}. - * @param signatureCoders - Signature codecs. - * @returns BLS helpers with signers. The inherited pairing surface still rejects infinity inputs, - * and empty `pairingBatch(...)` calls still return the multiplicative identity in GT. Aggregate - * verification still requires proof of possession or another rogue-key defense from the caller. - * @throws If the pairing, hashing, or signature helpers are configured inconsistently. {@link Error} - * @example - * ```ts - * import { bls } from '@noble/curves/abstract/bls.js'; - * import { bls12_381 } from '@noble/curves/bls12-381.js'; - * const sigs = bls12_381.longSignatures; - * // Use the full BLS helper set when you need hashing, keygen, signing, and verification. - * const { secretKey, publicKey } = sigs.keygen(); - * const msg = sigs.hash(new TextEncoder().encode('hello noble')); - * const sig = sigs.sign(msg, secretKey); - * const isValid = sigs.verify(sig, msg, publicKey); - * ``` - */ -export declare function bls(fields: TArg, G1_Point: WeierstrassPointCons, G2_Point: WeierstrassPointCons, params: TArg, hasherParams: TArg, signatureCoders: BlsSignatureCoders): BlsCurvePairWithSignatures; -export {}; -//# sourceMappingURL=bls.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/bls.d.ts.map b/node_modules/@noble/curves/abstract/bls.d.ts.map deleted file mode 100644 index 55d82eb..0000000 --- a/node_modules/@noble/curves/abstract/bls.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bls.d.ts","sourceRoot":"","sources":["../src/abstract/bls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;IAeI;AACJ,sEAAsE;AACtE,OAAO,EAAuC,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAoC,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEpF,KAAK,EAAE,GAAG,MAAM,CAAC;AAKjB;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,UAAU,CAAC;AAEzD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,CAAC,EAAE,IAAI;IACvC;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACzD;;;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CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACtF,qCAAqC;IACrC,SAAS,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;CACrC;AAiVD,KAAK,kBAAkB,GAAG,OAAO,CAAC;IAChC,aAAa,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC1C,cAAc,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;CAC5C,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,EACvB,QAAQ,EAAE,oBAAoB,CAAC,EAAE,CAAC,EAClC,QAAQ,EAAE,oBAAoB,CAAC,GAAG,CAAC,EACnC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,GAC7B,YAAY,CAuCd;AAiCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,GAAG,CACjB,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,EACvB,QAAQ,EAAE,oBAAoB,CAAC,EAAE,CAAC,EAClC,QAAQ,EAAE,oBAAoB,CAAC,GAAG,CAAC,EACnC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAC9B,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,EACnC,eAAe,EAAE,kBAAkB,GAClC,0BAA0B,CA0B5B"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/bls.js b/node_modules/@noble/curves/abstract/bls.js deleted file mode 100644 index 56e83db..0000000 --- a/node_modules/@noble/curves/abstract/bls.js +++ /dev/null @@ -1,432 +0,0 @@ -/** - * BLS != BLS. - * The file implements BLS (Boneh-Lynn-Shacham) signatures. - * Used in both BLS (Barreto-Lynn-Scott) and BN (Barreto-Naehrig) - * families of pairing-friendly curves. - * Consists of two curves: G1 and G2: - * - G1 is a subgroup of (x, y) E(Fq) over y² = x³ + 4. - * - G2 is a subgroup of ((x₁, x₂+i), (y₁, y₂+i)) E(Fq²) over y² = x³ + 4(1 + i) where i is √-1 - * - Gt, created by bilinear (ate) pairing e(G1, G2), consists of p-th roots of unity in - * Fq^k where k is embedding degree. Only degree 12 is currently supported, 24 is not. - * Pairing is used to aggregate and verify signatures. - * There are two modes of operation: - * - Long signatures: X-byte keys + 2X-byte sigs (G1 keys + G2 sigs). - * - Short signatures: 2X-byte keys + X-byte sigs (G2 keys + G1 sigs). - * @module - **/ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { abytes, notImplemented, randomBytes } from "../utils.js"; -import {} from "./curve.js"; -import { createHasher, } from "./hash-to-curve.js"; -import { getMinHashLength, mapHashToField } from "./modular.js"; -import {} from "./weierstrass.js"; -// prettier-ignore -const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3); -// Signed non-adjacent decomposition of the spec-defined Miller-loop parameter. -// BN254 benefits most because `6x+2` has multiple adjacent `11` runs, but BLS12-381's -// stored `|x|` still starts with `11`, so the Miller loop must also handle one `-1` digit there. -function NAfDecomposition(a) { - const res = []; - // a>1 because of marker bit - for (; a > _1n; a >>= _1n) { - if ((a & _1n) === _0n) - res.unshift(0); - else if ((a & _3n) === _3n) { - res.unshift(-1); - a += _1n; - } - else - res.unshift(1); - } - return res; -} -function aNonEmpty(arr) { - // Aggregate helpers use this to reject empty variable-length inputs consistently. - // Without the guard, each caller would fall through into a different empty-input / identity - // case and hide missing inputs behind outputs that still look structurally valid. - if (!Array.isArray(arr) || arr.length === 0) - throw new Error('expected non-empty array'); -} -// This should be enough for bn254, no need to export full stuff? -function createBlsPairing(fields, G1, G2, params) { - const { Fr, Fp2, Fp12 } = fields; - const { twistType, ateLoopSize, xNegative, postPrecompute } = params; - // Applies sparse multiplication as line function - let lineFunction; - if (twistType === 'multiplicative') { - lineFunction = (c0, c1, c2, f, Px, Py) => Fp12.mul014(f, c0, Fp2.mul(c1, Px), Fp2.mul(c2, Py)); - } - else if (twistType === 'divisive') { - // NOTE: it should be [c0, c1, c2], but we use different order here to reduce complexity of - // precompute calculations. - lineFunction = (c0, c1, c2, f, Px, Py) => Fp12.mul034(f, Fp2.mul(c2, Py), Fp2.mul(c1, Px), c0); - } - else - throw new Error('bls: unknown twist type'); - const Fp2div2 = Fp2.div(Fp2.ONE, Fp2.mul(Fp2.ONE, _2n)); - function pointDouble(ell, Rx, Ry, Rz) { - const t0 = Fp2.sqr(Ry); // Ry² - const t1 = Fp2.sqr(Rz); // Rz² - const t2 = Fp2.mulByB(Fp2.mul(t1, _3n)); // 3 * T1 * B - const t3 = Fp2.mul(t2, _3n); // 3 * T2 - const t4 = Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(Ry, Rz)), t1), t0); // (Ry + Rz)² - T1 - T0 - const c0 = Fp2.sub(t2, t0); // T2 - T0 (i) - const c1 = Fp2.mul(Fp2.sqr(Rx), _3n); // 3 * Rx² - const c2 = Fp2.neg(t4); // -T4 (-h) - ell.push([c0, c1, c2]); - Rx = Fp2.mul(Fp2.mul(Fp2.mul(Fp2.sub(t0, t3), Rx), Ry), Fp2div2); // ((T0 - T3) * Rx * Ry) / 2 - // ((T0 + T3) / 2)² - 3 * T2² - Ry = Fp2.sub(Fp2.sqr(Fp2.mul(Fp2.add(t0, t3), Fp2div2)), Fp2.mul(Fp2.sqr(t2), _3n)); - Rz = Fp2.mul(t0, t4); // T0 * T4 - return { Rx, Ry, Rz }; - } - function pointAdd(ell, Rx, Ry, Rz, Qx, Qy) { - // Addition - const t0 = Fp2.sub(Ry, Fp2.mul(Qy, Rz)); // Ry - Qy * Rz - const t1 = Fp2.sub(Rx, Fp2.mul(Qx, Rz)); // Rx - Qx * Rz - const c0 = Fp2.sub(Fp2.mul(t0, Qx), Fp2.mul(t1, Qy)); // T0 * Qx - T1 * Qy == Ry * Qx - Rx * Qy - const c1 = Fp2.neg(t0); // -T0 == Qy * Rz - Ry - const c2 = t1; // == Rx - Qx * Rz - ell.push([c0, c1, c2]); - const t2 = Fp2.sqr(t1); // T1² - const t3 = Fp2.mul(t2, t1); // T2 * T1 - const t4 = Fp2.mul(t2, Rx); // T2 * Rx - // T3 - 2 * T4 + T0² * Rz - const t5 = Fp2.add(Fp2.sub(t3, Fp2.mul(t4, _2n)), Fp2.mul(Fp2.sqr(t0), Rz)); - Rx = Fp2.mul(t1, t5); // T1 * T5 - Ry = Fp2.sub(Fp2.mul(Fp2.sub(t4, t5), t0), Fp2.mul(t3, Ry)); // (T4 - T5) * T0 - T3 * Ry - Rz = Fp2.mul(Rz, t3); // Rz * T3 - return { Rx, Ry, Rz }; - } - // Pre-compute coefficients for sparse multiplication - // Point addition and point double calculations is reused for coefficients - // pointAdd happens only if bit set, so wNAF is reasonable. Unfortunately we cannot combine - // add + double in windowed precomputes here, otherwise it would be single op (since X is static) - const ATE_NAF = NAfDecomposition(ateLoopSize); - const calcPairingPrecomputes = (point) => { - const p = point; - const { x, y } = p.toAffine(); - // prettier-ignore - const Qx = x, Qy = y, negQy = Fp2.neg(y); - // prettier-ignore - let Rx = Qx, Ry = Qy, Rz = Fp2.ONE; - const ell = []; - for (const bit of ATE_NAF) { - const cur = []; - ({ Rx, Ry, Rz } = pointDouble(cur, Rx, Ry, Rz)); - if (bit) - ({ Rx, Ry, Rz } = pointAdd(cur, Rx, Ry, Rz, Qx, bit === -1 ? negQy : Qy)); - ell.push(cur); - } - if (postPrecompute) { - const last = ell[ell.length - 1]; - postPrecompute(Rx, Ry, Rz, Qx, Qy, pointAdd.bind(null, last)); - } - return ell; - }; - function millerLoopBatch(pairs, withFinalExponent = false) { - let f12 = Fp12.ONE; - if (pairs.length) { - const ellLen = pairs[0][0].length; - for (let i = 0; i < ellLen; i++) { - f12 = Fp12.sqr(f12); // This allows us to do sqr only one time for all pairings - // NOTE: we apply multiple pairings in parallel here - for (const [ell, Px, Py] of pairs) { - for (const [c0, c1, c2] of ell[i]) - f12 = lineFunction(c0, c1, c2, f12, Px, Py); - } - } - } - if (xNegative) - f12 = Fp12.conjugate(f12); - return withFinalExponent ? Fp12.finalExponentiate(f12) : f12; - } - // Calculates product of multiple pairings - // This up to x2 faster than just `map(({g1, g2})=>pairing({g1,g2}))` - function pairingBatch(pairs, withFinalExponent = true) { - const res = []; - for (const { g1, g2 } of pairs) { - // Mathematically, a zero pairing term contributes GT.ONE. We still reject it here because - // this API mainly backs BLS verification, where ZERO inputs usually mean broken hash / - // wiring. Silently skipping them would turn those failures into a neutral pairing product. - // Callers that want the algebraic neutral-element behavior can filter ZERO terms first. - if (g1.is0() || g2.is0()) - throw new Error('pairing is not available for ZERO point'); - // This uses toAffine inside - g1.assertValidity(); - g2.assertValidity(); - const Qa = g1.toAffine(); - res.push([calcPairingPrecomputes(g2), Qa.x, Qa.y]); - } - return millerLoopBatch(res, withFinalExponent); - } - // Calculates bilinear pairing - function pairing(Q, P, withFinalExponent = true) { - return pairingBatch([{ g1: Q, g2: P }], withFinalExponent); - } - const lengths = { - seed: getMinHashLength(Fr.ORDER), - }; - const rand = params.randomBytes === undefined ? randomBytes : params.randomBytes; - // Seeded calls deterministically reduce exactly `lengths.seed` bytes into `1..Fr.ORDER-1`; - // omitting `seed` just fills that input buffer from the configured RNG first. - const randomSecretKey = (seed) => { - seed = seed === undefined ? rand(lengths.seed) : seed; - abytes(seed, lengths.seed, 'seed'); - return mapHashToField(seed, Fr.ORDER); - }; - Object.freeze(lengths); - return { - lengths, - Fr, - Fp12, // NOTE: we re-export Fp12 here because pairing results are Fp12! - millerLoopBatch, - pairing, - pairingBatch, - calcPairingPrecomputes, - randomSecretKey, - }; -} -function createBlsSig(blsPairing, PubPoint, SigPoint, isSigG1, hashToSigCurve, SignatureCoder) { - const { Fr, Fp12, pairingBatch, randomSecretKey, lengths } = blsPairing; - if (!SignatureCoder) { - SignatureCoder = { - fromBytes: notImplemented, - fromHex: notImplemented, - toBytes: notImplemented, - toHex: notImplemented, - }; - } - function normPub(point) { - return point instanceof PubPoint ? point : PubPoint.fromBytes(point); - } - function normSig(point) { - return point instanceof SigPoint ? point : SigPoint.fromBytes(point); - } - // Sign/verify here take points already hashed onto the signature subgroup. - // Raw bytes and points from the other subgroup must fail this constructor-brand - // check before later validity checks run. - function amsg(m) { - if (!(m instanceof SigPoint)) - throw new Error(`expected valid message hashed to ${!isSigG1 ? 'G2' : 'G1'} curve`); - return m; - } - // What matters here is what point pairing API accepts as G1 or G2, not actual size or names - const pair = !isSigG1 - ? (a, b) => ({ g1: a, g2: b }) - : (a, b) => ({ g1: b, g2: a }); - return Object.freeze({ - lengths: Object.freeze({ ...lengths, secretKey: Fr.BYTES }), - keygen(seed) { - const secretKey = randomSecretKey(seed); - const publicKey = this.getPublicKey(secretKey); - return { secretKey, publicKey }; - }, - // P = pk x G - getPublicKey(secretKey) { - let sec; - try { - sec = PubPoint.Fn.fromBytes(secretKey); - } - catch (error) { - // @ts-ignore - throw new Error('invalid private key: ' + typeof secretKey, { cause: error }); - } - return PubPoint.BASE.multiply(sec); - }, - // S = pk x H(m) - sign(message, secretKey, unusedArg) { - if (unusedArg != null) - throw new Error('sign() expects 2 arguments'); - const sec = PubPoint.Fn.fromBytes(secretKey); - amsg(message).assertValidity(); - return message.multiply(sec); - }, - // Checks if pairing of public key & hash is equal to pairing of generator & signature. - // e(P, H(m)) == e(G, S) - // e(S, G) == e(H(m), P) - verify(signature, message, publicKey, unusedArg) { - if (unusedArg != null) - throw new Error('verify() expects 3 arguments'); - signature = normSig(signature); - publicKey = normPub(publicKey); - const P = publicKey.negate(); - const G = PubPoint.BASE; - const Hm = amsg(message); - const S = signature; - // This code was changed in 1.9.x: - // Before it was G.negate() in G2, now it's always pubKey.negate - // e(P, -Q)===e(-P, Q)==e(P, Q)^-1. Negate can be done anywhere (as long it is done once per pair). - // We just moving sign, but since pairing is multiplicative, we doing X * X^-1 = 1 - try { - const exp = pairingBatch([pair(P, Hm), pair(G, S)]); - return Fp12.eql(exp, Fp12.ONE); - } - catch { - return false; - } - }, - // https://ethresear.ch/t/fast-verification-of-multiple-bls-signatures/5407 - // e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si)) - // TODO: maybe `{message: G2Hex, publicKey: G1Hex}[]` instead? - verifyBatch(signature, items) { - aNonEmpty(items); - const sig = normSig(signature); - const nMessages = items.map((i) => i.message); - const nPublicKeys = items.map((i) => normPub(i.publicKey)); - // NOTE: this works only for exact same object - const messagePubKeyMap = new Map(); - for (let i = 0; i < nPublicKeys.length; i++) { - const pub = nPublicKeys[i]; - const msg = nMessages[i]; - let keys = messagePubKeyMap.get(msg); - if (keys === undefined) { - keys = []; - messagePubKeyMap.set(msg, keys); - } - keys.push(pub); - } - const paired = []; - const G = PubPoint.BASE; - try { - for (const [msg, keys] of messagePubKeyMap) { - const groupPublicKey = keys.reduce((acc, msg) => acc.add(msg)); - paired.push(pair(groupPublicKey, msg)); - } - paired.push(pair(G.negate(), sig)); - return Fp12.eql(pairingBatch(paired), Fp12.ONE); - } - catch { - return false; - } - }, - // Adds a bunch of public key points together. - // pk1 + pk2 + pk3 = pkA - aggregatePublicKeys(publicKeys) { - aNonEmpty(publicKeys); - publicKeys = publicKeys.map((pub) => normPub(pub)); - const agg = publicKeys.reduce((sum, p) => sum.add(p), PubPoint.ZERO); - agg.assertValidity(); - return agg; - }, - // Adds a bunch of signature points together. - // pk1 + pk2 + pk3 = pkA - aggregateSignatures(signatures) { - aNonEmpty(signatures); - signatures = signatures.map((sig) => normSig(sig)); - const agg = signatures.reduce((sum, s) => sum.add(s), SigPoint.ZERO); - agg.assertValidity(); - return agg; - }, - hash(messageBytes, DST) { - abytes(messageBytes); - const opts = DST ? { DST } : undefined; - return hashToSigCurve(messageBytes, opts); - }, - Signature: Object.freeze({ ...SignatureCoder }), - }) /*satisfies Signer */; -} -// NOTE: separate function instead of function override, so we don't depend on hasher in bn254. -/** - * @param fields - Tower field implementations. - * @param G1_Point - G1 point constructor. - * @param G2_Point - G2 point constructor. - * @param params - Pairing parameters. See {@link BlsPairingParams}. - * @returns Pairing-only BLS helpers. The returned pairing surface rejects infinity inputs, while - * empty `pairingBatch(...)` calls return the multiplicative identity in GT. This keeps the - * low-level pairing API fail-closed for BLS-style callers, where identity points usually signal - * broken hash / wiring instead of an intentionally neutral pairing term. This also eagerly - * precomputes the G1 base-point table as a performance side effect. - * @throws If the pairing parameters or underlying curve helpers are inconsistent. {@link Error} - * @example - * ```ts - * import { blsBasic } from '@noble/curves/abstract/bls.js'; - * import { bn254 } from '@noble/curves/bn254.js'; - * // Pair a G1 point with a G2 point without the higher-level signer helpers. - * const gt = bn254.pairing(bn254.G1.Point.BASE, bn254.G2.Point.BASE); - * ``` - */ -export function blsBasic(fields, G1_Point, G2_Point, params) { - // Fields are specific for curve, so for now we'll need to pass them with opts - const { Fp, Fr, Fp2, Fp6, Fp12 } = fields; - // Point on G1 curve: (x, y) - // const G1_Point = weierstrass(CURVE.G1, { Fn: Fr }); - const G1 = { Point: G1_Point }; - // Point on G2 curve (complex numbers): (x₁, x₂+i), (y₁, y₂+i) - const G2 = { Point: G2_Point }; - const pairingRes = createBlsPairing(fields, G1_Point, G2_Point, params); - const { millerLoopBatch, pairing, pairingBatch, calcPairingPrecomputes, randomSecretKey, lengths, } = pairingRes; - G1.Point.BASE.precompute(4); - Object.freeze(G1); - Object.freeze(G2); - return Object.freeze({ - lengths: Object.freeze(lengths), - millerLoopBatch, - pairing, - pairingBatch, - G1, - G2, - fields: Object.freeze({ Fr, Fp, Fp2, Fp6, Fp12 }), - params: Object.freeze({ - ateLoopSize: params.ateLoopSize, - twistType: params.twistType, - }), - utils: Object.freeze({ - randomSecretKey, - calcPairingPrecomputes, - }), - }); -} -// We can export this too, but seems there is not much reasons for now? If user wants hasher, they can just create hasher. -function blsHashers(fields, G1_Point, G2_Point, params, hasherParams) { - const base = blsBasic(fields, G1_Point, G2_Point, params); - // Missing map hooks intentionally fail closed via notImplemented on first hash use. - const G1Hasher = createHasher(G1_Point, hasherParams.mapToG1 === undefined ? notImplemented : hasherParams.mapToG1, { - ...hasherParams.hasherOpts, - ...hasherParams.hasherOptsG1, - }); - const G2Hasher = createHasher(G2_Point, hasherParams.mapToG2 === undefined ? notImplemented : hasherParams.mapToG2, { - ...hasherParams.hasherOpts, - ...hasherParams.hasherOptsG2, - }); - return Object.freeze({ ...base, G1: G1Hasher, G2: G2Hasher }); -} -// G1_Point: ProjConstructor, G2_Point: ProjConstructor, -// Rename to blsSignatures? -/** - * @param fields - Tower field implementations. - * @param G1_Point - G1 point constructor. - * @param G2_Point - G2 point constructor. - * @param params - Pairing parameters. See {@link BlsPairingParams}. - * @param hasherParams - Hash-to-curve configuration. See {@link BlsHasherParams}. - * @param signatureCoders - Signature codecs. - * @returns BLS helpers with signers. The inherited pairing surface still rejects infinity inputs, - * and empty `pairingBatch(...)` calls still return the multiplicative identity in GT. Aggregate - * verification still requires proof of possession or another rogue-key defense from the caller. - * @throws If the pairing, hashing, or signature helpers are configured inconsistently. {@link Error} - * @example - * ```ts - * import { bls } from '@noble/curves/abstract/bls.js'; - * import { bls12_381 } from '@noble/curves/bls12-381.js'; - * const sigs = bls12_381.longSignatures; - * // Use the full BLS helper set when you need hashing, keygen, signing, and verification. - * const { secretKey, publicKey } = sigs.keygen(); - * const msg = sigs.hash(new TextEncoder().encode('hello noble')); - * const sig = sigs.sign(msg, secretKey); - * const isValid = sigs.verify(sig, msg, publicKey); - * ``` - */ -export function bls(fields, G1_Point, G2_Point, params, hasherParams, signatureCoders) { - const base = blsHashers(fields, G1_Point, G2_Point, params, hasherParams); - const pairingRes = { - ...base, - Fr: base.fields.Fr, - Fp12: base.fields.Fp12, - calcPairingPrecomputes: base.utils.calcPairingPrecomputes, - randomSecretKey: base.utils.randomSecretKey, - }; - const longSignatures = createBlsSig(pairingRes, G1_Point, G2_Point, false, base.G2.hashToCurve, signatureCoders?.LongSignature); - const shortSignatures = createBlsSig(pairingRes, G2_Point, G1_Point, true, base.G1.hashToCurve, signatureCoders?.ShortSignature); - return Object.freeze({ ...base, longSignatures, shortSignatures }); -} -//# sourceMappingURL=bls.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/bls.js.map b/node_modules/@noble/curves/abstract/bls.js.map deleted file mode 100644 index 91b4fd8..0000000 --- a/node_modules/@noble/curves/abstract/bls.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bls.js","sourceRoot":"","sources":["../src/abstract/bls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;IAeI;AACJ,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAwB,MAAM,aAAa,CAAC;AACxF,OAAO,EAAqB,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,YAAY,GAKb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAe,MAAM,cAAc,CAAC;AAE7E,OAAO,EAAoD,MAAM,kBAAkB,CAAC;AAIpF,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAwWzE,+EAA+E;AAC/E,sFAAsF;AACtF,iGAAiG;AACjG,SAAS,gBAAgB,CAAC,CAAS;IACjC,MAAM,GAAG,GAAG,EAAE,CAAC;IACf,4BAA4B;IAC5B,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,GAAG;YAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;aACjC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;YAC3B,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YAChB,CAAC,IAAI,GAAG,CA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YAAmC,EACnC,eAAmC;IAEnC,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAe;QAC7B,GAAG,IAAI;QACP,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;QAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;QACtB,sBAAsB,EAAE,IAAI,CAAC,KAAK,CAAC,sBAAsB;QACzD,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe;KAC5C,CAAC;IACF,MAAM,cAAc,GAAG,YAAY,CACjC,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,IAAI,CAAC,EAAE,CAAC,WAAW,EACnB,eAAe,EAAE,aAAa,CAC/B,CAAC;IACF,MAAM,eAAe,GAAG,YAAY,CAClC,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,IAAI,CAAC,EAAE,CAAC,WAAW,EACnB,eAAe,EAAE,cAAc,CAChC,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC,CAAC;AACrE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/curve.d.ts b/node_modules/@noble/curves/abstract/curve.d.ts deleted file mode 100644 index 8e98ccc..0000000 --- a/node_modules/@noble/curves/abstract/curve.d.ts +++ /dev/null @@ -1,442 +0,0 @@ -/** - * Methods for elliptic curve multiplication by scalars. - * Contains wNAF, pippenger. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { type Signer, type TArg, type TRet } from '../utils.ts'; -import { type IField } from './modular.ts'; -/** Affine point coordinates without projective fields. */ -export type AffinePoint = { - /** Affine x coordinate. */ - x: T; - /** Affine y coordinate. */ - y: T; -} & { - Z?: never; -}; -/** Base interface for all elliptic-curve point instances. */ -export interface CurvePoint> { - /** Affine x coordinate. Different from projective / extended X coordinate. */ - x: F; - /** Affine y coordinate. Different from projective / extended Y coordinate. */ - y: F; - /** Projective Z coordinate when the point keeps projective state. */ - Z?: F; - /** - * Double the point. - * @returns Doubled point. - */ - double(): P; - /** - * Negate the point. - * @returns Negated point. - */ - negate(): P; - /** - * Add another point from the same curve. - * @param other - Point to add. - * @returns Sum point. - */ - add(other: P): P; - /** - * Subtract another point from the same curve. - * @param other - Point to subtract. - * @returns Difference point. - */ - subtract(other: P): P; - /** - * Compare two points for equality. - * @param other - Point to compare. - * @returns Whether the points are equal. - */ - equals(other: P): boolean; - /** - * Multiply the point by a scalar in constant time. - * Implementations keep the subgroup-scalar contract strict and may reject - * `0` instead of returning the identity point. - * @param scalar - Scalar multiplier. - * @returns Product point. - */ - multiply(scalar: bigint): P; - /** Assert that the point satisfies the curve equation and subgroup checks. */ - assertValidity(): void; - /** - * Map the point into the prime-order subgroup when the curve requires it. - * @returns Prime-order point. - */ - clearCofactor(): P; - /** - * Check whether the point is the point at infinity. - * @returns Whether the point is zero. - */ - is0(): boolean; - /** - * Check whether the point belongs to the prime-order subgroup. - * @returns Whether the point is torsion-free. - */ - isTorsionFree(): boolean; - /** - * Check whether the point lies in a small torsion subgroup. - * @returns Whether the point has small order. - */ - isSmallOrder(): boolean; - /** - * Multiply the point by a scalar without constant-time guarantees. - * Public-scalar callers that need `0` should use this method instead of - * relying on `multiply(...)` to return the identity point. - * @param scalar - Scalar multiplier. - * @returns Product point. - */ - multiplyUnsafe(scalar: bigint): P; - /** - * Massively speeds up `p.multiply(n)` by using precompute tables (caching). See {@link wNAF}. - * Cache state lives in internal WeakMaps keyed by point identity, not on the point object. - * Repeating `precompute(...)` for the same point identity replaces the remembered window size - * and forces table regeneration for that point. - * @param windowSize - Precompute window size. - * @param isLazy - calculate cache now. Default (true) ensures it's deferred to first `multiply()` - * @returns Same point instance with precompute tables attached. - */ - precompute(windowSize?: number, isLazy?: boolean): P; - /** - * Converts point to 2D xy affine coordinates. - * @param invertedZ - Optional inverted Z coordinate for batch normalization. - * @returns Affine x/y coordinates. - */ - toAffine(invertedZ?: F): AffinePoint; - /** - * Encode the point into the curve's canonical byte form. - * @returns Encoded point bytes. - */ - toBytes(): Uint8Array; - /** - * Encode the point into the curve's canonical hex form. - * @returns Encoded point hex. - */ - toHex(): string; -} -/** Base interface for elliptic-curve point constructors. */ -export interface CurvePointCons

> { - /** - * Runtime brand check for points created by this constructor. - * @param item - Value to test. - * @returns Whether the value is a point from this constructor. - */ - [Symbol.hasInstance]: (item: unknown) => boolean; - /** Canonical subgroup generator. */ - BASE: P; - /** Point at infinity. */ - ZERO: P; - /** Field for basic curve math */ - Fp: IField>; - /** Scalar field, for scalars in multiply and others */ - Fn: IField; - /** - * Create one point from affine coordinates. - * Does NOT validate curve, subgroup, or wrapper invariants. - * Use `.assertValidity()` on adversarial inputs. - * @param p - Affine point coordinates. - * @returns Point instance. - */ - fromAffine(p: AffinePoint>): P; - /** - * Decode a point from the canonical byte encoding. - * @param bytes - Encoded point bytes. - * Implementations MUST treat `bytes` as read-only. - * @returns Point instance. - */ - fromBytes(bytes: Uint8Array): P; - /** - * Decode a point from the canonical hex encoding. - * @param hex - Encoded point hex. - * @returns Point instance. - */ - fromHex(hex: string): P; -} -/** Returns the affine field type for a point instance (`P_F

== P.F`). */ -export type P_F

> = P extends CurvePoint ? F : never; -/** Returns the affine field type for a point constructor (`PC_F == PC.P.F`). */ -export type PC_F>> = PC['Fp']['ZERO']; -/** Returns the point instance type for a point constructor (`PC_P == PC.P`). */ -export type PC_P>> = PC['ZERO']; -/** Wide point-constructor type used when the concrete curve is not important. */ -export type PC_ANY = CurvePointCons>>>>>>>>>>; -/** - * Validates the static surface of a point constructor. - * This is only a cheap sanity check for the constructor hooks and fields consumed by generic - * factories; it does not certify `BASE`/`ZERO` semantics or prove the curve implementation itself. - * @param Point - Runtime point constructor. - * @throws On missing constructor hooks or malformed field metadata. {@link TypeError} - * @example - * Check that one point constructor exposes the static hooks generic helpers need. - * - * ```ts - * import { ed25519 } from '@noble/curves/ed25519.js'; - * import { validatePointCons } from '@noble/curves/abstract/curve.js'; - * validatePointCons(ed25519.Point); - * ``` - */ -export declare function validatePointCons

>(Point: CurvePointCons

): void; -/** Byte lengths used by one curve implementation. */ -export interface CurveLengths { - /** Secret-key length in bytes. */ - secretKey?: number; - /** Compressed public-key length in bytes. */ - publicKey?: number; - /** Uncompressed public-key length in bytes. */ - publicKeyUncompressed?: number; - /** Whether public-key encodings include a format prefix byte. */ - publicKeyHasPrefix?: boolean; - /** Signature length in bytes. */ - signature?: number; - /** Seed length in bytes when the curve exposes deterministic keygen from seed. */ - seed?: number; -} -/** Reorders or otherwise remaps a batch while preserving its element type. */ -export type Mapper = (i: T[]) => T[]; -/** - * Computes both candidates first, but the final selection still branches on `condition`, so this - * is not a strict constant-time CMOV primitive. - * @param condition - Whether to negate the point. - * @param item - Point-like value. - * @returns Original or negated value. - * @example - * Keep the point or return its negation based on one boolean branch. - * - * ```ts - * import { negateCt } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const maybeNegated = negateCt(true, p256.Point.BASE); - * ``` - */ -export declare function negateCt T; -}>(condition: boolean, item: T): T; -/** - * Takes a bunch of Projective Points but executes only one - * inversion on all of them. Inversion is very slow operation, - * so this improves performance massively. - * Optimization: converts a list of projective points to a list of identical points with Z=1. - * Input points are left unchanged; the normalized points are returned as fresh instances. - * @param c - Point constructor. - * @param points - Projective points. - * @returns Fresh projective points reconstructed from normalized affine coordinates. - * @example - * Batch-normalize projective points with a single shared inversion. - * - * ```ts - * import { normalizeZ } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const points = normalizeZ(p256.Point, [p256.Point.BASE, p256.Point.BASE.double()]); - * ``` - */ -export declare function normalizeZ

, PC extends CurvePointCons

>(c: PC, points: P[]): P[]; -/** - * Elliptic curve multiplication of Point by scalar. Fragile. - * Table generation takes **30MB of ram and 10ms on high-end CPU**, - * but may take much longer on slow devices. Actual generation will happen on - * first call of `multiply()`. By default, `BASE` point is precomputed. - * - * Scalars should always be less than curve order: this should be checked inside of a curve itself. - * Creates precomputation tables for fast multiplication: - * - private scalar is split by fixed size windows of W bits - * - every window point is collected from window's table & added to accumulator - * - since windows are different, same point inside tables won't be accessed more than once per calc - * - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) - * - +1 window is neccessary for wNAF - * - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication - * - * TODO: research returning a 2d JS array of windows instead of a single window. - * This would allow windows to be in different memory locations. - * @param Point - Point constructor. - * @param bits - Scalar bit length. - * @example - * Elliptic curve multiplication of Point by scalar. - * - * ```ts - * import { wNAF } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const ladder = new wNAF(p256.Point, p256.Point.Fn.BITS); - * ``` - */ -export declare class wNAF { - private readonly BASE; - private readonly ZERO; - private readonly Fn; - readonly bits: number; - constructor(Point: PC, bits: number); - _unsafeLadder(elm: PC_P, n: bigint, p?: PC_P): PC_P; - /** - * Creates a wNAF precomputation window. Used for caching. - * Default window size is set by `utils.precompute()` and is equal to 8. - * Number of precomputed points depends on the curve size: - * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: - * - 𝑊 is the window size - * - 𝑛 is the bitlength of the curve order. - * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. - * @param point - Point instance - * @param W - window size - * @returns precomputed point tables flattened to a single array - */ - private precomputeWindow; - /** - * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. - * More compact implementation: - * https://github.com/paulmillr/noble-secp256k1/blob/47cb1669b6e506ad66b35fe7d76132ae97465da2/index.ts#L502-L541 - * @returns real and fake (for const-time) points - */ - private wNAF; - /** - * Implements unsafe EC multiplication using precomputed tables - * and w-ary non-adjacent form. - * @param acc - accumulator point to add result of multiplication - * @returns point - */ - private wNAFUnsafe; - private getPrecomputes; - cached(point: PC_P, scalar: bigint, transform?: Mapper>): { - p: PC_P; - f: PC_P; - }; - unsafe(point: PC_P, scalar: bigint, transform?: Mapper>, prev?: PC_P): PC_P; - createCache(P: PC_P, W: number): void; - hasCache(elm: PC_P): boolean; -} -/** - * Endomorphism-specific multiplication for Koblitz curves. - * Cost: 128 dbl, 0-256 adds. - * @param Point - Point constructor. - * @param point - Input point. - * @param k1 - First non-negative absolute scalar chunk. - * @param k2 - Second non-negative absolute scalar chunk. - * @returns Partial multiplication results. - * @example - * Endomorphism-specific multiplication for Koblitz curves. - * - * ```ts - * import { mulEndoUnsafe } from '@noble/curves/abstract/curve.js'; - * import { secp256k1 } from '@noble/curves/secp256k1.js'; - * const parts = mulEndoUnsafe(secp256k1.Point, secp256k1.Point.BASE, 3n, 5n); - * ``` - */ -export declare function mulEndoUnsafe

, PC extends CurvePointCons

>(Point: PC, point: P, k1: bigint, k2: bigint): { - p1: P; - p2: P; -}; -/** - * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * 30x faster vs naive addition on L=4096, 10x faster than precomputes. - * For N=254bit, L=1, it does: 1024 ADD + 254 DBL. For L=5: 1536 ADD + 254 DBL. - * Algorithmically constant-time (for same L), even when 1 point + scalar, or when scalar = 0. - * @param c - Curve Point constructor - * @param points - array of L curve points - * @param scalars - array of L scalars (aka secret keys / bigints) - * @returns MSM result point. Empty input is accepted and returns the identity. - * @throws If the point set, scalar set, or MSM sizing is invalid. {@link Error} - * @example - * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * - * ```ts - * import { pippenger } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const point = pippenger(p256.Point, [p256.Point.BASE, p256.Point.BASE.double()], [2n, 3n]); - * ``` - */ -export declare function pippenger

, PC extends CurvePointCons

>(c: PC, points: P[], scalars: bigint[]): P; -/** - * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * @param c - Curve Point constructor - * @param points - array of L curve points - * @param windowSize - Precompute window size. - * @returns Function which multiplies points with scalars. The closure accepts - * `scalars.length <= points.length`, and omitted trailing scalars are treated as zero. - * @throws If the point set or precompute window is invalid. {@link Error} - * @example - * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * - * ```ts - * import { precomputeMSMUnsafe } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const msm = precomputeMSMUnsafe(p256.Point, [p256.Point.BASE], 4); - * const point = msm([3n]); - * ``` - */ -export declare function precomputeMSMUnsafe

, PC extends CurvePointCons

>(c: PC, points: P[], windowSize: number): (scalars: bigint[]) => P; -/** Minimal curve parameters needed to construct a Weierstrass or Edwards curve. */ -export type ValidCurveParams = { - /** Base-field modulus. */ - p: bigint; - /** Prime subgroup order. */ - n: bigint; - /** Cofactor. */ - h: bigint; - /** Curve parameter `a`. */ - a: T; - /** Weierstrass curve parameter `b`. */ - b?: T; - /** Edwards curve parameter `d`. */ - d?: T; - /** Generator x coordinate. */ - Gx: T; - /** Generator y coordinate. */ - Gy: T; -}; -/** Pair of fields used by curve constructors. */ -export type FpFn = { - /** Base field used for curve coordinates. */ - Fp: IField; - /** Scalar field used for secret scalars and subgroup arithmetic. */ - Fn: IField; -}; -/** - * Validates basic CURVE shape and field membership, then creates fields. - * This does not prove that the generator is on-curve, that subgroup/order data are consistent, or - * that the curve equation itself is otherwise sane. - * @param type - Curve family. - * @param CURVE - Curve parameters. - * @param curveOpts - Optional field overrides: - * - `Fp` (optional): Optional base-field override. - * - `Fn` (optional): Optional scalar-field override. - * @param FpFnLE - Whether field encoding is little-endian. - * @returns Frozen curve parameters and fields. - * @throws If the curve parameters or field overrides are invalid. {@link Error} - * @example - * Build curve fields from raw constants before constructing a curve instance. - * - * ```ts - * const curve = createCurveFields('weierstrass', { - * p: 17n, - * n: 19n, - * h: 1n, - * a: 2n, - * b: 2n, - * Gx: 5n, - * Gy: 1n, - * }); - * ``` - */ -export declare function createCurveFields(type: 'weierstrass' | 'edwards', CURVE: ValidCurveParams, curveOpts?: TArg>>, FpFnLE?: boolean): TRet & { - CURVE: ValidCurveParams; -}>; -type KeygenFn = (seed?: Uint8Array, isCompressed?: boolean) => { - secretKey: Uint8Array; - publicKey: Uint8Array; -}; -/** - * @param randomSecretKey - Secret-key generator. - * @param getPublicKey - Public-key derivation helper. - * @returns Keypair generator. - * @example - * Build a `keygen()` helper from existing secret-key and public-key primitives. - * - * ```ts - * import { createKeygen } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const keygen = createKeygen(p256.utils.randomSecretKey, p256.getPublicKey); - * const pair = keygen(); - * ``` - */ -export declare function createKeygen(randomSecretKey: Function, getPublicKey: TArg): TRet; -export {}; -//# sourceMappingURL=curve.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/curve.d.ts.map b/node_modules/@noble/curves/abstract/curve.d.ts.map deleted file mode 100644 index 78f2910..0000000 --- a/node_modules/@noble/curves/abstract/curve.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"curve.d.ts","sourceRoot":"","sources":["../src/abstract/curve.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,sEAAsE;AACtE,OAAO,EAAmC,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAAuC,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAKhF,0DAA0D;AAC1D,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,2BAA2B;IAC3B,CAAC,EAAE,CAAC,CAAC;IACL,2BAA2B;IAC3B,CAAC,EAAE,CAAC,CAAC;CACN,GAAG;IAAE,CAAC,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAUlB,6DAA6D;AAC7D,MAAM,WAAW,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,EAAE,C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;IACN,8BAA8B;IAC9B,EAAE,EAAE,CAAC,CAAC;CACP,CAAC;AAcF,iDAAiD;AACjD,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IACpB,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACd,oEAAoE;IACpE,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC1B,SAAS,GAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAM,EACtC,MAAM,CAAC,EAAE,OAAO,GACf,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG;IAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAmBhD;AAED,KAAK,QAAQ,GAAG,CACd,IAAI,CAAC,EAAE,UAAU,EACjB,YAAY,CAAC,EAAE,OAAO,KACnB;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAE,CAAC;AACtD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAC1B,eAAe,EAAE,QAAQ,EACzB,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,GACzC,IAAI,CAAC,QAAQ,CAAC,CAKhB"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/curve.js b/node_modules/@noble/curves/abstract/curve.js deleted file mode 100644 index 6808517..0000000 --- a/node_modules/@noble/curves/abstract/curve.js +++ /dev/null @@ -1,611 +0,0 @@ -/** - * Methods for elliptic curve multiplication by scalars. - * Contains wNAF, pippenger. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { bitLen, bitMask, validateObject } from "../utils.js"; -import { Field, FpInvertBatch, validateField } from "./modular.js"; -const _0n = /* @__PURE__ */ BigInt(0); -const _1n = /* @__PURE__ */ BigInt(1); -/** - * Validates the static surface of a point constructor. - * This is only a cheap sanity check for the constructor hooks and fields consumed by generic - * factories; it does not certify `BASE`/`ZERO` semantics or prove the curve implementation itself. - * @param Point - Runtime point constructor. - * @throws On missing constructor hooks or malformed field metadata. {@link TypeError} - * @example - * Check that one point constructor exposes the static hooks generic helpers need. - * - * ```ts - * import { ed25519 } from '@noble/curves/ed25519.js'; - * import { validatePointCons } from '@noble/curves/abstract/curve.js'; - * validatePointCons(ed25519.Point); - * ``` - */ -export function validatePointCons(Point) { - const pc = Point; - if (typeof pc !== 'function') - throw new TypeError('Point must be a constructor'); - // validateObject only accepts plain objects, so copy the constructor statics into one bag first. - validateObject({ - Fp: pc.Fp, - Fn: pc.Fn, - fromAffine: pc.fromAffine, - fromBytes: pc.fromBytes, - fromHex: pc.fromHex, - }, { - Fp: 'object', - Fn: 'object', - fromAffine: 'function', - fromBytes: 'function', - fromHex: 'function', - }); - validateField(pc.Fp); - validateField(pc.Fn); -} -/** - * Computes both candidates first, but the final selection still branches on `condition`, so this - * is not a strict constant-time CMOV primitive. - * @param condition - Whether to negate the point. - * @param item - Point-like value. - * @returns Original or negated value. - * @example - * Keep the point or return its negation based on one boolean branch. - * - * ```ts - * import { negateCt } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const maybeNegated = negateCt(true, p256.Point.BASE); - * ``` - */ -export function negateCt(condition, item) { - const neg = item.negate(); - return condition ? neg : item; -} -/** - * Takes a bunch of Projective Points but executes only one - * inversion on all of them. Inversion is very slow operation, - * so this improves performance massively. - * Optimization: converts a list of projective points to a list of identical points with Z=1. - * Input points are left unchanged; the normalized points are returned as fresh instances. - * @param c - Point constructor. - * @param points - Projective points. - * @returns Fresh projective points reconstructed from normalized affine coordinates. - * @example - * Batch-normalize projective points with a single shared inversion. - * - * ```ts - * import { normalizeZ } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const points = normalizeZ(p256.Point, [p256.Point.BASE, p256.Point.BASE.double()]); - * ``` - */ -export function normalizeZ(c, points) { - const invertedZs = FpInvertBatch(c.Fp, points.map((p) => p.Z)); - return points.map((p, i) => c.fromAffine(p.toAffine(invertedZs[i]))); -} -function validateW(W, bits) { - if (!Number.isSafeInteger(W) || W <= 0 || W > bits) - throw new Error('invalid window size, expected [1..' + bits + '], got W=' + W); -} -function calcWOpts(W, scalarBits) { - validateW(W, scalarBits); - const windows = Math.ceil(scalarBits / W) + 1; // W=8 33. Not 32, because we skip zero - const windowSize = 2 ** (W - 1); // W=8 128. Not 256, because we skip zero - const maxNumber = 2 ** W; // W=8 256 - const mask = bitMask(W); // W=8 255 == mask 0b11111111 - const shiftBy = BigInt(W); // W=8 8 - return { windows, windowSize, mask, maxNumber, shiftBy }; -} -function calcOffsets(n, window, wOpts) { - const { windowSize, mask, maxNumber, shiftBy } = wOpts; - let wbits = Number(n & mask); // extract W bits. - let nextN = n >> shiftBy; // shift number by W bits. - // What actually happens here: - // const highestBit = Number(mask ^ (mask >> 1n)); - // let wbits2 = wbits - 1; // skip zero - // if (wbits2 & highestBit) { wbits2 ^= Number(mask); // (~); - // split if bits > max: +224 => 256-32 - if (wbits > windowSize) { - // we skip zero, which means instead of `>= size-1`, we do `> size` - wbits -= maxNumber; // -32, can be maxNumber - wbits, but then we need to set isNeg here. - nextN += _1n; // +256 (carry) - } - const offsetStart = window * windowSize; - const offset = offsetStart + Math.abs(wbits) - 1; // -1 because we skip zero; ignore when isZero - const isZero = wbits === 0; // is current window slice a 0? - const isNeg = wbits < 0; // is current window slice negative? - const isNegF = window % 2 !== 0; // fake branch noise only - const offsetF = offsetStart; // fake branch noise only - return { nextN, offset, isZero, isNeg, isNegF, offsetF }; -} -function validateMSMPoints(points, c) { - if (!Array.isArray(points)) - throw new Error('array expected'); - points.forEach((p, i) => { - if (!(p instanceof c)) - throw new Error('invalid point at index ' + i); - }); -} -function validateMSMScalars(scalars, field) { - if (!Array.isArray(scalars)) - throw new Error('array of scalars expected'); - scalars.forEach((s, i) => { - if (!field.isValid(s)) - throw new Error('invalid scalar at index ' + i); - }); -} -// Since points in different groups cannot be equal (different object constructor), -// we can have single place to store precomputes. -// Allows to make points frozen / immutable. -const pointPrecomputes = new WeakMap(); -const pointWindowSizes = new WeakMap(); -function getW(P) { - // To disable precomputes: - // return 1; - // `1` is also the uncached sentinel: use the ladder / non-precomputed path. - return pointWindowSizes.get(P) || 1; -} -function assert0(n) { - // Internal invariant: a non-zero remainder here means the wNAF window decomposition or loop - // count is inconsistent, not that the original caller provided a bad scalar. - if (n !== _0n) - throw new Error('invalid wNAF'); -} -/** - * Elliptic curve multiplication of Point by scalar. Fragile. - * Table generation takes **30MB of ram and 10ms on high-end CPU**, - * but may take much longer on slow devices. Actual generation will happen on - * first call of `multiply()`. By default, `BASE` point is precomputed. - * - * Scalars should always be less than curve order: this should be checked inside of a curve itself. - * Creates precomputation tables for fast multiplication: - * - private scalar is split by fixed size windows of W bits - * - every window point is collected from window's table & added to accumulator - * - since windows are different, same point inside tables won't be accessed more than once per calc - * - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) - * - +1 window is neccessary for wNAF - * - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication - * - * TODO: research returning a 2d JS array of windows instead of a single window. - * This would allow windows to be in different memory locations. - * @param Point - Point constructor. - * @param bits - Scalar bit length. - * @example - * Elliptic curve multiplication of Point by scalar. - * - * ```ts - * import { wNAF } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const ladder = new wNAF(p256.Point, p256.Point.Fn.BITS); - * ``` - */ -export class wNAF { - BASE; - ZERO; - Fn; - bits; - // Parametrized with a given Point class (not individual point) - constructor(Point, bits) { - this.BASE = Point.BASE; - this.ZERO = Point.ZERO; - this.Fn = Point.Fn; - this.bits = bits; - } - // non-const time multiplication ladder - _unsafeLadder(elm, n, p = this.ZERO) { - let d = elm; - while (n > _0n) { - if (n & _1n) - p = p.add(d); - d = d.double(); - n >>= _1n; - } - return p; - } - /** - * Creates a wNAF precomputation window. Used for caching. - * Default window size is set by `utils.precompute()` and is equal to 8. - * Number of precomputed points depends on the curve size: - * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: - * - 𝑊 is the window size - * - 𝑛 is the bitlength of the curve order. - * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. - * @param point - Point instance - * @param W - window size - * @returns precomputed point tables flattened to a single array - */ - precomputeWindow(point, W) { - const { windows, windowSize } = calcWOpts(W, this.bits); - const points = []; - let p = point; - let base = p; - for (let window = 0; window < windows; window++) { - base = p; - points.push(base); - // i=1, bc we skip 0 - for (let i = 1; i < windowSize; i++) { - base = base.add(p); - points.push(base); - } - p = base.double(); - } - return points; - } - /** - * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. - * More compact implementation: - * https://github.com/paulmillr/noble-secp256k1/blob/47cb1669b6e506ad66b35fe7d76132ae97465da2/index.ts#L502-L541 - * @returns real and fake (for const-time) points - */ - wNAF(W, precomputes, n) { - // Scalar should be smaller than field order - if (!this.Fn.isValid(n)) - throw new Error('invalid scalar'); - // Accumulators - let p = this.ZERO; - let f = this.BASE; - // This code was first written with assumption that 'f' and 'p' will never be infinity point: - // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, - // there is negate now: it is possible that negated element from low value - // would be the same as high element, which will create carry into next window. - // It's not obvious how this can fail, but still worth investigating later. - const wo = calcWOpts(W, this.bits); - for (let window = 0; window < wo.windows; window++) { - // (n === _0n) is handled and not early-exited. isEven and offsetF are used for noise - const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo); - n = nextN; - if (isZero) { - // bits are 0: add garbage to fake point - // Important part for const-time getPublicKey: add random "noise" point to f. - f = f.add(negateCt(isNegF, precomputes[offsetF])); - } - else { - // bits are 1: add to result point - p = p.add(negateCt(isNeg, precomputes[offset])); - } - } - assert0(n); - // Return both real and fake points so JIT keeps the noise path alive. - // Known caveat: negate/carry interactions can still drive `f` to infinity even when `p` is not, - // which weakens the noise path and leaves this only "less const-time" by about one bigint mul. - return { p, f }; - } - /** - * Implements unsafe EC multiplication using precomputed tables - * and w-ary non-adjacent form. - * @param acc - accumulator point to add result of multiplication - * @returns point - */ - wNAFUnsafe(W, precomputes, n, acc = this.ZERO) { - const wo = calcWOpts(W, this.bits); - for (let window = 0; window < wo.windows; window++) { - if (n === _0n) - break; // Early-exit, skip 0 value - const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo); - n = nextN; - if (isZero) { - // Window bits are 0: skip processing. - // Move to next window. - continue; - } - else { - const item = precomputes[offset]; - acc = acc.add(isNeg ? item.negate() : item); // Re-using acc allows to save adds in MSM - } - } - assert0(n); - return acc; - } - getPrecomputes(W, point, transform) { - // Cache key is only point identity plus the remembered window size; callers must not reuse the - // same point with incompatible `transform(...)` layouts and expect a separate cache entry. - let comp = pointPrecomputes.get(point); - if (!comp) { - comp = this.precomputeWindow(point, W); - if (W !== 1) { - // Doing transform outside of if brings 15% perf hit - if (typeof transform === 'function') - comp = transform(comp); - pointPrecomputes.set(point, comp); - } - } - return comp; - } - cached(point, scalar, transform) { - const W = getW(point); - return this.wNAF(W, this.getPrecomputes(W, point, transform), scalar); - } - unsafe(point, scalar, transform, prev) { - const W = getW(point); - if (W === 1) - return this._unsafeLadder(point, scalar, prev); // For W=1 ladder is ~x2 faster - return this.wNAFUnsafe(W, this.getPrecomputes(W, point, transform), scalar, prev); - } - // We calculate precomputes for elliptic curve point multiplication - // using windowed method. This specifies window size and - // stores precomputed values. Usually only base point would be precomputed. - createCache(P, W) { - validateW(W, this.bits); - pointWindowSizes.set(P, W); - pointPrecomputes.delete(P); - } - hasCache(elm) { - return getW(elm) !== 1; - } -} -/** - * Endomorphism-specific multiplication for Koblitz curves. - * Cost: 128 dbl, 0-256 adds. - * @param Point - Point constructor. - * @param point - Input point. - * @param k1 - First non-negative absolute scalar chunk. - * @param k2 - Second non-negative absolute scalar chunk. - * @returns Partial multiplication results. - * @example - * Endomorphism-specific multiplication for Koblitz curves. - * - * ```ts - * import { mulEndoUnsafe } from '@noble/curves/abstract/curve.js'; - * import { secp256k1 } from '@noble/curves/secp256k1.js'; - * const parts = mulEndoUnsafe(secp256k1.Point, secp256k1.Point.BASE, 3n, 5n); - * ``` - */ -export function mulEndoUnsafe(Point, point, k1, k2) { - let acc = point; - let p1 = Point.ZERO; - let p2 = Point.ZERO; - while (k1 > _0n || k2 > _0n) { - if (k1 & _1n) - p1 = p1.add(acc); - if (k2 & _1n) - p2 = p2.add(acc); - acc = acc.double(); - k1 >>= _1n; - k2 >>= _1n; - } - return { p1, p2 }; -} -/** - * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * 30x faster vs naive addition on L=4096, 10x faster than precomputes. - * For N=254bit, L=1, it does: 1024 ADD + 254 DBL. For L=5: 1536 ADD + 254 DBL. - * Algorithmically constant-time (for same L), even when 1 point + scalar, or when scalar = 0. - * @param c - Curve Point constructor - * @param points - array of L curve points - * @param scalars - array of L scalars (aka secret keys / bigints) - * @returns MSM result point. Empty input is accepted and returns the identity. - * @throws If the point set, scalar set, or MSM sizing is invalid. {@link Error} - * @example - * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * - * ```ts - * import { pippenger } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const point = pippenger(p256.Point, [p256.Point.BASE, p256.Point.BASE.double()], [2n, 3n]); - * ``` - */ -export function pippenger(c, points, scalars) { - // If we split scalars by some window (let's say 8 bits), every chunk will only - // take 256 buckets even if there are 4096 scalars, also re-uses double. - // TODO: - // - https://eprint.iacr.org/2024/750.pdf - // - https://tches.iacr.org/index.php/TCHES/article/view/10287 - // 0 is accepted in scalars - const fieldN = c.Fn; - validateMSMPoints(points, c); - validateMSMScalars(scalars, fieldN); - const plength = points.length; - const slength = scalars.length; - if (plength !== slength) - throw new Error('arrays of points and scalars must have equal length'); - // if (plength === 0) throw new Error('array must be of length >= 2'); - const zero = c.ZERO; - const wbits = bitLen(BigInt(plength)); - let windowSize = 1; // bits - if (wbits > 12) - windowSize = wbits - 3; - else if (wbits > 4) - windowSize = wbits - 2; - else if (wbits > 0) - windowSize = 2; - const MASK = bitMask(windowSize); - const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array - const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize; - let sum = zero; - for (let i = lastBits; i >= 0; i -= windowSize) { - buckets.fill(zero); - for (let j = 0; j < slength; j++) { - const scalar = scalars[j]; - const wbits = Number((scalar >> BigInt(i)) & MASK); - buckets[wbits] = buckets[wbits].add(points[j]); - } - let resI = zero; // not using this will do small speed-up, but will lose ct - // Skip first bucket, because it is zero - for (let j = buckets.length - 1, sumI = zero; j > 0; j--) { - sumI = sumI.add(buckets[j]); - resI = resI.add(sumI); - } - sum = sum.add(resI); - if (i !== 0) - for (let j = 0; j < windowSize; j++) - sum = sum.double(); - } - return sum; -} -/** - * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * @param c - Curve Point constructor - * @param points - array of L curve points - * @param windowSize - Precompute window size. - * @returns Function which multiplies points with scalars. The closure accepts - * `scalars.length <= points.length`, and omitted trailing scalars are treated as zero. - * @throws If the point set or precompute window is invalid. {@link Error} - * @example - * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * - * ```ts - * import { precomputeMSMUnsafe } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const msm = precomputeMSMUnsafe(p256.Point, [p256.Point.BASE], 4); - * const point = msm([3n]); - * ``` - */ -export function precomputeMSMUnsafe(c, points, windowSize) { - /** - * Performance Analysis of Window-based Precomputation - * - * Base Case (256-bit scalar, 8-bit window): - * - Standard precomputation requires: - * - 31 additions per scalar × 256 scalars = 7,936 ops - * - Plus 255 summary additions = 8,191 total ops - * Note: Summary additions can be optimized via accumulator - * - * Chunked Precomputation Analysis: - * - Using 32 chunks requires: - * - 255 additions per chunk - * - 256 doublings - * - Total: (255 × 32) + 256 = 8,416 ops - * - * Memory Usage Comparison: - * Window Size | Standard Points | Chunked Points - * ------------|-----------------|--------------- - * 4-bit | 520 | 15 - * 8-bit | 4,224 | 255 - * 10-bit | 13,824 | 1,023 - * 16-bit | 557,056 | 65,535 - * - * Key Advantages: - * 1. Enables larger window sizes due to reduced memory overhead - * 2. More efficient for smaller scalar counts: - * - 16 chunks: (16 × 255) + 256 = 4,336 ops - * - ~2x faster than standard 8,191 ops - * - * Limitations: - * - Not suitable for plain precomputes (requires 256 constant doublings) - * - Performance degrades with larger scalar counts: - * - Optimal for ~256 scalars - * - Less efficient for 4096+ scalars (Pippenger preferred) - */ - const fieldN = c.Fn; - validateW(windowSize, fieldN.BITS); - validateMSMPoints(points, c); - const zero = c.ZERO; - const tableSize = 2 ** windowSize - 1; // table size (without zero) - const chunks = Math.ceil(fieldN.BITS / windowSize); // chunks of item - const MASK = bitMask(windowSize); - const tables = points.map((p) => { - const res = []; - for (let i = 0, acc = p; i < tableSize; i++) { - res.push(acc); - acc = acc.add(p); - } - return res; - }); - return (scalars) => { - validateMSMScalars(scalars, fieldN); - if (scalars.length > points.length) - throw new Error('array of scalars must be smaller than array of points'); - let res = zero; - for (let i = 0; i < chunks; i++) { - // No need to double if accumulator is still zero. - if (res !== zero) - for (let j = 0; j < windowSize; j++) - res = res.double(); - const shiftBy = BigInt(chunks * windowSize - (i + 1) * windowSize); - for (let j = 0; j < scalars.length; j++) { - const n = scalars[j]; - const curr = Number((n >> shiftBy) & MASK); - if (!curr) - continue; // skip zero scalars chunks - res = res.add(tables[j][curr - 1]); - } - } - return res; - }; -} -function createField(order, field, isLE) { - if (field) { - // Reuse supplied field overrides as-is; `isLE` only affects freshly constructed fallback - // fields, and validateField() below only checks the arithmetic subset, not full byte/cmov - // behavior. - if (field.ORDER !== order) - throw new Error('Field.ORDER must match order: Fp == p, Fn == n'); - validateField(field); - return field; - } - else { - return Field(order, { isLE }); - } -} -/** - * Validates basic CURVE shape and field membership, then creates fields. - * This does not prove that the generator is on-curve, that subgroup/order data are consistent, or - * that the curve equation itself is otherwise sane. - * @param type - Curve family. - * @param CURVE - Curve parameters. - * @param curveOpts - Optional field overrides: - * - `Fp` (optional): Optional base-field override. - * - `Fn` (optional): Optional scalar-field override. - * @param FpFnLE - Whether field encoding is little-endian. - * @returns Frozen curve parameters and fields. - * @throws If the curve parameters or field overrides are invalid. {@link Error} - * @example - * Build curve fields from raw constants before constructing a curve instance. - * - * ```ts - * const curve = createCurveFields('weierstrass', { - * p: 17n, - * n: 19n, - * h: 1n, - * a: 2n, - * b: 2n, - * Gx: 5n, - * Gy: 1n, - * }); - * ``` - */ -export function createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) { - if (FpFnLE === undefined) - FpFnLE = type === 'edwards'; - if (!CURVE || typeof CURVE !== 'object') - throw new Error(`expected valid ${type} CURVE object`); - for (const p of ['p', 'n', 'h']) { - const val = CURVE[p]; - if (!(typeof val === 'bigint' && val > _0n)) - throw new Error(`CURVE.${p} must be positive bigint`); - } - const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE); - const Fn = createField(CURVE.n, curveOpts.Fn, FpFnLE); - const _b = type === 'weierstrass' ? 'b' : 'd'; - const params = ['Gx', 'Gy', 'a', _b]; - for (const p of params) { - // @ts-ignore - if (!Fp.isValid(CURVE[p])) - throw new Error(`CURVE.${p} must be valid field element of CURVE.Fp`); - } - CURVE = Object.freeze(Object.assign({}, CURVE)); - return { CURVE, Fp, Fn }; -} -/** - * @param randomSecretKey - Secret-key generator. - * @param getPublicKey - Public-key derivation helper. - * @returns Keypair generator. - * @example - * Build a `keygen()` helper from existing secret-key and public-key primitives. - * - * ```ts - * import { createKeygen } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const keygen = createKeygen(p256.utils.randomSecretKey, p256.getPublicKey); - * const pair = keygen(); - * ``` - */ -export function createKeygen(randomSecretKey, getPublicKey) { - return function keygen(seed) { - const secretKey = randomSecretKey(seed); - return { secretKey, publicKey: getPublicKey(secretKey) }; - }; -} -//# sourceMappingURL=curve.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/curve.js.map b/node_modules/@noble/curves/abstract/curve.js.map deleted file mode 100644 index a60e315..0000000 --- a/node_modules/@noble/curves/abstract/curve.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"curve.js","sourceRoot":"","sources":["../src/abstract/curve.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAqC,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAe,MAAM,cAAc,CAAC;AAEhF,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AA8MtC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAA+B,KAAwB;IACtF,MAAM,EAAE,GAAG,KAAuC,CAAC;IACnD,IAAI,OAAQ,EAAc,KAAK,UAAU;QAAE,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC;IAC9F,iGAAiG;IACjG,cAAc,CACZ;QACE,EAAE,EAAE,EAAE,CAAC,EAAE;QACT,EAAE,EAAE,EAAE,CAAC,EAAE;QACT,UAAU,EAAE,EAAE,CAAC,UAAU;QACzB,SAAS,EAAE,EAAE,CAAC,SAAS;QACvB,OAAO,EAAE,EAAE,CAAC,OAAO;KACpB,EACD;QACE,EAAE,EAAE,QAAQ;QACZ,EAAE,EAAE,QAAQ;QACZ,UAAU,EAAE,UAAU;QACtB,S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QAC5C,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAqB,CAAC;QAC5D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,SAAS,CAAqB,EAAE,CAAC;IAC/E,CAAC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/edwards.d.ts b/node_modules/@noble/curves/abstract/edwards.d.ts deleted file mode 100644 index ccfe3d4..0000000 --- a/node_modules/@noble/curves/abstract/edwards.d.ts +++ /dev/null @@ -1,320 +0,0 @@ -/** - * Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y². - * For design rationale of types / exports, see weierstrass module documentation. - * Untwisted Edwards curves exist, but they aren't used in real-world protocols. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { type FHash, type TArg, type TRet } from '../utils.ts'; -import { type AffinePoint, type CurveLengths, type CurvePoint, type CurvePointCons } from './curve.ts'; -import { type IField } from './modular.ts'; -/** Extended Edwards point with X/Y/Z/T coordinates. */ -export interface EdwardsPoint extends CurvePoint { - /** extended X coordinate. Different from affine x. */ - readonly X: bigint; - /** extended Y coordinate. Different from affine y. */ - readonly Y: bigint; - /** extended Z coordinate */ - readonly Z: bigint; - /** extended T coordinate */ - readonly T: bigint; -} -/** Constructor and decoding helpers for extended Edwards points. */ -export interface EdwardsPointCons extends CurvePointCons { - /** Create a point from extended X/Y/Z/T coordinates without validation. */ - new (X: bigint, Y: bigint, Z: bigint, T: bigint): EdwardsPoint; - /** - * Return the curve parameters used by this point constructor. - * @returns Curve parameters. - */ - CURVE(): EdwardsOpts; - /** - * Decode a point from bytes, optionally using ZIP-215 rules. - * @param bytes - Encoded point bytes. - * @param zip215 - Whether to accept ZIP-215 encodings. - * @returns Decoded Edwards point. - */ - fromBytes(bytes: Uint8Array, zip215?: boolean): EdwardsPoint; - /** - * Decode a point from hex, optionally using ZIP-215 rules. - * @param hex - Encoded point hex. - * @param zip215 - Whether to accept ZIP-215 encodings. - * @returns Decoded Edwards point. - */ - fromHex(hex: string, zip215?: boolean): EdwardsPoint; -} -/** - * Twisted Edwards curve options. - * - * * a: formula param - * * d: formula param - * * p: prime characteristic (order) of finite field, in which arithmetics is done - * * n: order of prime subgroup a.k.a total amount of valid curve points - * * h: cofactor. h*n is group order; n is subgroup order - * * Gx: x coordinate of generator point a.k.a. base point - * * Gy: y coordinate of generator point - */ -export type EdwardsOpts = Readonly<{ - /** Base-field modulus. */ - p: bigint; - /** Prime subgroup order. */ - n: bigint; - /** Curve cofactor. */ - h: bigint; - /** Edwards curve parameter `a`. */ - a: bigint; - /** Edwards curve parameter `d`. */ - d: bigint; - /** Generator x coordinate. */ - Gx: bigint; - /** Generator y coordinate. */ - Gy: bigint; -}>; -/** - * Extra curve options for Twisted Edwards. - * - * * Fp: redefined Field over curve.p - * * Fn: redefined Field over curve.n - * * uvRatio: helper function for decompression, calculating √(u/v) - */ -export type EdwardsExtraOpts = Partial<{ - /** Optional base-field override. */ - Fp: IField; - /** Optional scalar-field override. */ - Fn: IField; - /** Whether field encodings are little-endian. */ - FpFnLE: boolean; - /** Square-root ratio helper used during point decompression. */ - uvRatio: (u: bigint, v: bigint) => { - isValid: boolean; - value: bigint; - }; -}>; -/** - * EdDSA (Edwards Digital Signature algorithm) options. - * - * * hash: hash function used to hash secret keys and messages - * * adjustScalarBytes: clears bits to get valid field element - * * domain: Used for hashing - * * mapToCurve: for hash-to-curve standard - * * prehash: RFC 8032 pre-hashing of messages to sign() / verify() - * * randomBytes: function generating random bytes, used for randomSecretKey - */ -export type EdDSAOpts = Partial<{ - /** Clamp or otherwise normalize secret-scalar bytes before reducing mod `n`. */ - adjustScalarBytes: (bytes: TArg) => TRet; - /** Domain-separation helper for contexts and prehash mode. */ - domain: (data: TArg, ctx: TArg, phflag: boolean) => TRet; - /** Optional hash-to-curve mapper for protocols like Ristretto hash-to-group. */ - mapToCurve: (scalar: bigint[]) => AffinePoint; - /** Optional prehash function used before signing or verifying messages. */ - prehash: FHash; - /** Default verification decoding policy. ZIP-215 is more permissive than RFC 8032 / NIST. */ - zip215: boolean; - /** RNG override used by helper constructors. */ - randomBytes: (bytesLength?: number) => TRet; -}>; -/** - * EdDSA (Edwards Digital Signature algorithm) helper namespace. - * Allows creating and verifying signatures, and deriving public keys. - */ -export interface EdDSA { - /** - * Generate a secret/public key pair. - * @param seed - Optional seed material. - * @returns Secret/public key pair. - */ - keygen: (seed?: TArg) => { - secretKey: TRet; - publicKey: TRet; - }; - /** - * Derive the public key from a secret key. - * @param secretKey - Secret key bytes. - * @returns Encoded public key. - */ - getPublicKey: (secretKey: TArg) => TRet; - /** - * Sign a message with an EdDSA secret key. - * @param message - Message bytes. - * @param secretKey - Secret key bytes. - * @param options - Optional signature tweaks: - * - `context` (optional): Domain-separation context for Ed25519ctx/Ed448. - * @returns Encoded signature bytes. - */ - sign: (message: TArg, secretKey: TArg, options?: TArg<{ - context?: Uint8Array; - }>) => TRet; - /** - * Verify a signature against a message and public key. - * @param sig - Encoded signature bytes. - * @param message - Message bytes. - * @param publicKey - Encoded public key. - * @param options - Optional verification tweaks: - * - `context` (optional): Domain-separation context for Ed25519ctx/Ed448. - * - `zip215` (optional): Whether to accept ZIP-215 encodings. - * @returns Whether the signature is valid. - */ - verify: (sig: TArg, message: TArg, publicKey: TArg, options?: TArg<{ - context?: Uint8Array; - zip215?: boolean; - }>) => boolean; - /** Point constructor used by this signature scheme. */ - Point: EdwardsPointCons; - /** Helper utilities for key validation and Montgomery conversion. */ - utils: { - /** - * Generate a valid random secret key. - * Optional seed bytes are only length-checked and returned unchanged. - */ - randomSecretKey: (seed?: TArg) => TRet; - /** Check whether a secret key has the expected encoding. */ - isValidSecretKey: (secretKey: TArg) => boolean; - /** Check whether a public key decodes to a valid point. */ - isValidPublicKey: (publicKey: TArg, zip215?: boolean) => boolean; - /** - * Converts ed public key to x public key. - * - * There is NO `fromMontgomery`: - * - There are 2 valid ed25519 points for every x25519, with flipped coordinate - * - Sometimes there are 0 valid ed25519 points, because x25519 *additionally* - * accepts inputs on the quadratic twist, which can't be moved to ed25519 - * - * @example - * Converts ed public key to x public key. - * - * ```js - * const someonesPub_ed = ed25519.getPublicKey(ed25519.utils.randomSecretKey()); - * const someonesPub = ed25519.utils.toMontgomery(someonesPub); - * const aPriv = x25519.utils.randomSecretKey(); - * const shared = x25519.getSharedSecret(aPriv, someonesPub) - * ``` - */ - toMontgomery: (publicKey: TArg) => TRet; - /** - * Converts ed secret key to x secret key. - * @example - * Converts ed secret key to x secret key. - * - * ```js - * const someonesPub = x25519.getPublicKey(x25519.utils.randomSecretKey()); - * const aPriv_ed = ed25519.utils.randomSecretKey(); - * const aPriv = ed25519.utils.toMontgomerySecret(aPriv_ed); - * const shared = x25519.getSharedSecret(aPriv, someonesPub) - * ``` - */ - toMontgomerySecret: (secretKey: TArg) => TRet; - /** Return the expanded private key components used by RFC8032 signing. */ - getExtendedPublicKey: (key: TArg) => { - head: TRet; - prefix: TRet; - scalar: bigint; - point: EdwardsPoint; - pointBytes: TRet; - }; - }; - /** Byte lengths for keys and signatures exposed by this scheme. */ - lengths: CurveLengths; -} -/** - * @param params - Curve parameters. See {@link EdwardsOpts}. - * @param extraOpts - Optional helpers and overrides. See {@link EdwardsExtraOpts}. - * @returns Edwards point constructor. Generator validation here only checks - * that `(Gx, Gy)` satisfies the affine Edwards equation. - * RFC 8032 base-point constraints like `B != (0,1)` and `[L]B = 0` - * are left to the caller's chosen parameters, since eager subgroup - * validation here adds about 10-15ms to heavyweight imports like ed448. - * The returned constructor also eagerly marks `Point.BASE` for W=8 - * precompute caching. Some code paths still assume - * `Fp.BYTES === Fn.BYTES`, so mismatched byte lengths are not fully audited here. - * @throws If the curve parameters or Edwards overrides are invalid. {@link Error} - * @example - * ```ts - * import { edwards } from '@noble/curves/abstract/edwards.js'; - * import { jubjub } from '@noble/curves/misc.js'; - * // Build a point constructor from explicit curve parameters, then use its base point. - * const Point = edwards(jubjub.Point.CURVE()); - * Point.BASE.toHex(); - * ``` - */ -export declare function edwards(params: TArg, extraOpts?: TArg): EdwardsPointCons; -/** - * Base class for prime-order points like Ristretto255 and Decaf448. - * These points eliminate cofactor issues by representing equivalence classes - * of Edwards curve points. Multiple Edwards representatives can describe the - * same abstract wrapper element, so wrapper validity is not the same thing as - * the hidden representative being torsion-free. - * @param ep - Backing Edwards point. - * @example - * Base class for prime-order points like Ristretto255 and Decaf448. - * - * ```ts - * import { ristretto255 } from '@noble/curves/ed25519.js'; - * const point = ristretto255.Point.BASE.multiply(2n); - * ``` - */ -export declare abstract class PrimeEdwardsPoint> implements CurvePoint { - static BASE: PrimeEdwardsPoint; - static ZERO: PrimeEdwardsPoint; - static Fp: IField; - static Fn: IField; - protected readonly ep: EdwardsPoint; - /** - * Wrap one internal Edwards representative directly. - * This is not a canonical encoding boundary: alternate Edwards - * representatives may still describe the same abstract wrapper element. - */ - constructor(ep: EdwardsPoint); - abstract toBytes(): Uint8Array; - abstract equals(other: T): boolean; - static fromBytes(_bytes: Uint8Array): any; - static fromHex(_hex: string): any; - get x(): bigint; - get y(): bigint; - clearCofactor(): T; - assertValidity(): void; - /** - * Return affine coordinates of the current internal Edwards representative. - * This is a convenience helper, not a canonical Ristretto/Decaf encoding. - * Equal abstract elements may expose different `x` / `y`; use - * `toBytes()` / `fromBytes()` for canonical roundtrips. - */ - toAffine(invertedZ?: bigint): AffinePoint; - toHex(): string; - toString(): string; - isTorsionFree(): boolean; - isSmallOrder(): boolean; - add(other: T): T; - subtract(other: T): T; - multiply(scalar: bigint): T; - multiplyUnsafe(scalar: bigint): T; - double(): T; - negate(): T; - precompute(windowSize?: number, isLazy?: boolean): T; - abstract is0(): boolean; - protected abstract assertSame(other: T): void; - protected abstract init(ep: EdwardsPoint): T; -} -/** - * Initializes EdDSA signatures over given Edwards curve. - * @param Point - Edwards point constructor. - * @param cHash - Hash function. - * @param eddsaOpts - Optional signature helpers. See {@link EdDSAOpts}. - * @returns EdDSA helper namespace. - * @throws If the hash function, options, or derived point operations are invalid. {@link Error} - * @example - * Initializes EdDSA signatures over given Edwards curve. - * - * ```ts - * import { eddsa } from '@noble/curves/abstract/edwards.js'; - * import { jubjub } from '@noble/curves/misc.js'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * const sigs = eddsa(jubjub.Point, sha512); - * const { secretKey, publicKey } = sigs.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = sigs.sign(msg, secretKey); - * const isValid = sigs.verify(sig, msg, publicKey); - * ``` - */ -export declare function eddsa(Point: EdwardsPointCons, cHash: TArg, eddsaOpts?: TArg): EdDSA; -//# sourceMappingURL=edwards.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/edwards.d.ts.map b/node_modules/@noble/curves/abstract/edwards.d.ts.map deleted file mode 100644 index 6393e1f..0000000 --- a/node_modules/@noble/curves/abstract/edwards.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"edwards.d.ts","sourceRoot":"","sources":["../src/abstract/edwards.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sEAAsE;AACtE,OAAO,EAcL,KAAK,KAAK,EAEV,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAM3C,uDAAuD;AACvD,MAAM,WAAW,YAAa,SAAQ,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC;IACpE,sDAAsD;IACtD,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,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,IAAI,MAAM;IAIf,QAAQ,IAAI,MAAM;IAIlB,aAAa,IAAI,OAAO;IAMxB,YAAY,IAAI,OAAO;IAIvB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC;IAKhB,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC;IAKrB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC;IAI3B,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC;IAIjC,MAAM,IAAI,CAAC;IAIX,MAAM,IAAI,CAAC;IAIX,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,CAAC;IAQpD,QAAQ,CAAC,GAAG,IAAI,OAAO;IACvB,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IAC7C,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,YAAY,GAAG,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,KAAK,CACnB,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAClB,SAAS,GAAE,IAAI,CAAC,SAAS,CAAM,GAC9B,KAAK,CAuOP"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/edwards.js b/node_modules/@noble/curves/abstract/edwards.js deleted file mode 100644 index ee5cefc..0000000 --- a/node_modules/@noble/curves/abstract/edwards.js +++ /dev/null @@ -1,693 +0,0 @@ -/** - * Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y². - * For design rationale of types / exports, see weierstrass module documentation. - * Untwisted Edwards curves exist, but they aren't used in real-world protocols. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { abool, abytes, aInRange, asafenumber, bytesToHex, bytesToNumberLE, concatBytes, copyBytes, hexToBytes, isBytes, notImplemented, validateObject, randomBytes as wcRandomBytes, } from "../utils.js"; -import { createCurveFields, createKeygen, normalizeZ, wNAF, } from "./curve.js"; -import {} from "./modular.js"; -// Be friendly to bad ECMAScript parsers by not using bigint literals -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _8n = /* @__PURE__ */ BigInt(8); -// Affine Edwards-equation check only; this does not prove subgroup membership, canonical -// encoding, prime-order base-point requirements, or identity exclusion. -function isEdValidXY(Fp, CURVE, x, y) { - const x2 = Fp.sqr(x); - const y2 = Fp.sqr(y); - const left = Fp.add(Fp.mul(CURVE.a, x2), y2); - const right = Fp.add(Fp.ONE, Fp.mul(CURVE.d, Fp.mul(x2, y2))); - return Fp.eql(left, right); -} -/** - * @param params - Curve parameters. See {@link EdwardsOpts}. - * @param extraOpts - Optional helpers and overrides. See {@link EdwardsExtraOpts}. - * @returns Edwards point constructor. Generator validation here only checks - * that `(Gx, Gy)` satisfies the affine Edwards equation. - * RFC 8032 base-point constraints like `B != (0,1)` and `[L]B = 0` - * are left to the caller's chosen parameters, since eager subgroup - * validation here adds about 10-15ms to heavyweight imports like ed448. - * The returned constructor also eagerly marks `Point.BASE` for W=8 - * precompute caching. Some code paths still assume - * `Fp.BYTES === Fn.BYTES`, so mismatched byte lengths are not fully audited here. - * @throws If the curve parameters or Edwards overrides are invalid. {@link Error} - * @example - * ```ts - * import { edwards } from '@noble/curves/abstract/edwards.js'; - * import { jubjub } from '@noble/curves/misc.js'; - * // Build a point constructor from explicit curve parameters, then use its base point. - * const Point = edwards(jubjub.Point.CURVE()); - * Point.BASE.toHex(); - * ``` - */ -export function edwards(params, extraOpts = {}) { - const opts = extraOpts; - const validated = createCurveFields('edwards', params, opts, opts.FpFnLE); - const { Fp, Fn } = validated; - let CURVE = validated.CURVE; - const { h: cofactor } = CURVE; - validateObject(opts, {}, { uvRatio: 'function' }); - // Important: - // There are some places where Fp.BYTES is used instead of nByteLength. - // So far, everything has been tested with curves of Fp.BYTES == nByteLength. - // TODO: test and find curves which behave otherwise. - const MASK = _2n << (BigInt(Fn.BYTES * 8) - _1n); - const modP = (n) => Fp.create(n); // Function overrides - // sqrt(u/v) - const uvRatio = opts.uvRatio === undefined - ? (u, v) => { - try { - return { isValid: true, value: Fp.sqrt(Fp.div(u, v)) }; - } - catch (e) { - return { isValid: false, value: _0n }; - } - } - : opts.uvRatio; - // Validate whether the passed curve params are valid. - // equation ax² + y² = 1 + dx²y² should work for generator point. - if (!isEdValidXY(Fp, CURVE, CURVE.Gx, CURVE.Gy)) - throw new Error('bad curve params: generator point'); - /** - * Asserts coordinate is valid: 0 <= n < MASK. - * Coordinates >= Fp.ORDER are allowed for zip215. - */ - function acoord(title, n, banZero = false) { - const min = banZero ? _1n : _0n; - aInRange('coordinate ' + title, n, min, MASK); - return n; - } - function aedpoint(other) { - if (!(other instanceof Point)) - throw new Error('EdwardsPoint expected'); - } - // Extended Point works in extended coordinates: (X, Y, Z, T) ∋ (x=X/Z, y=Y/Z, T=xy). - // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates - class Point { - // base / generator point - static BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); - // zero / infinity / identity point - static ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 - // math field - static Fp = Fp; - // scalar field - static Fn = Fn; - X; - Y; - Z; - T; - constructor(X, Y, Z, T) { - this.X = acoord('x', X); - this.Y = acoord('y', Y); - this.Z = acoord('z', Z, true); - this.T = acoord('t', T); - Object.freeze(this); - } - static CURVE() { - return CURVE; - } - /** - * Create one extended Edwards point from affine coordinates. - * Does NOT validate that the point is on-curve or torsion-free. - * Use `.assertValidity()` on adversarial inputs. - */ - static fromAffine(p) { - if (p instanceof Point) - throw new Error('extended point not allowed'); - const { x, y } = p || {}; - acoord('x', x); - acoord('y', y); - return new Point(x, y, _1n, modP(x * y)); - } - // Uses algo from RFC8032 5.1.3. - static fromBytes(bytes, zip215 = false) { - const len = Fp.BYTES; - const { a, d } = CURVE; - bytes = copyBytes(abytes(bytes, len, 'point')); - abool(zip215, 'zip215'); - const normed = copyBytes(bytes); // copy again, we'll manipulate it - const lastByte = bytes[len - 1]; // select last byte - normed[len - 1] = lastByte & ~0x80; // clear last bit - const y = bytesToNumberLE(normed); - // zip215=true is good for consensus-critical apps. =false follows RFC8032 / NIST186-5. - // RFC8032 prohibits >= p, but ZIP215 doesn't - // zip215=true: 0 <= y < MASK (2^256 for ed25519) - // zip215=false: 0 <= y < P (2^255-19 for ed25519) - const max = zip215 ? MASK : Fp.ORDER; - aInRange('point.y', y, _0n, max); - // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case: - // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a) - const y2 = modP(y * y); // denominator is always non-0 mod p. - const u = modP(y2 - _1n); // u = y² - 1 - const v = modP(d * y2 - a); // v = d y² + 1. - let { isValid, value: x } = uvRatio(u, v); // √(u/v) - if (!isValid) - throw new Error('bad point: invalid y coordinate'); - const isXOdd = (x & _1n) === _1n; // There are 2 square roots. Use x_0 bit to select proper - const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit - if (!zip215 && x === _0n && isLastByteOdd) - // if x=0 and x_0 = 1, fail - throw new Error('bad point: x=0 and x_0=1'); - if (isLastByteOdd !== isXOdd) - x = modP(-x); // if x_0 != x mod 2, set x = p-x - return Point.fromAffine({ x, y }); - } - static fromHex(hex, zip215 = false) { - return Point.fromBytes(hexToBytes(hex), zip215); - } - get x() { - return this.toAffine().x; - } - get y() { - return this.toAffine().y; - } - precompute(windowSize = 8, isLazy = true) { - wnaf.createCache(this, windowSize); - if (!isLazy) - this.multiply(_2n); // random number - return this; - } - // Useful in fromAffine() - not for fromBytes(), which always created valid points. - assertValidity() { - const p = this; - const { a, d } = CURVE; - // Keep generic Edwards validation fail-closed on the neutral point. - // Even though ZERO is algebraically valid and can roundtrip through encodings, higher-level - // callers often reach it only through broken hash/scalar plumbing; rejecting it here avoids - // silently treating that degenerate state as an ordinary public point. - if (p.is0()) - throw new Error('bad point: ZERO'); // TODO: optimize, with vars below? - // Equation in affine coordinates: ax² + y² = 1 + dx²y² - // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y² - const { X, Y, Z, T } = p; - const X2 = modP(X * X); // X² - const Y2 = modP(Y * Y); // Y² - const Z2 = modP(Z * Z); // Z² - const Z4 = modP(Z2 * Z2); // Z⁴ - const aX2 = modP(X2 * a); // aX² - const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z² - const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y² - if (left !== right) - throw new Error('bad point: equation left != right (1)'); - // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T - const XY = modP(X * Y); - const ZT = modP(Z * T); - if (XY !== ZT) - throw new Error('bad point: equation left != right (2)'); - } - // Compare one point to another. - equals(other) { - aedpoint(other); - const { X: X1, Y: Y1, Z: Z1 } = this; - const { X: X2, Y: Y2, Z: Z2 } = other; - const X1Z2 = modP(X1 * Z2); - const X2Z1 = modP(X2 * Z1); - const Y1Z2 = modP(Y1 * Z2); - const Y2Z1 = modP(Y2 * Z1); - return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; - } - is0() { - return this.equals(Point.ZERO); - } - negate() { - // Flips point sign to a negative one (-x, y in affine coords) - return new Point(modP(-this.X), this.Y, this.Z, modP(-this.T)); - } - // Fast algo for doubling Extended Point. - // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd - // Cost: 4M + 4S + 1*a + 6add + 1*2. - double() { - const { a } = CURVE; - const { X: X1, Y: Y1, Z: Z1 } = this; - const A = modP(X1 * X1); // A = X12 - const B = modP(Y1 * Y1); // B = Y12 - const C = modP(_2n * modP(Z1 * Z1)); // C = 2*Z12 - const D = modP(a * A); // D = a*A - const x1y1 = X1 + Y1; - const E = modP(modP(x1y1 * x1y1) - A - B); // E = (X1+Y1)2-A-B - const G = D + B; // G = D+B - const F = G - C; // F = G-C - const H = D - B; // H = D-B - const X3 = modP(E * F); // X3 = E*F - const Y3 = modP(G * H); // Y3 = G*H - const T3 = modP(E * H); // T3 = E*H - const Z3 = modP(F * G); // Z3 = F*G - return new Point(X3, Y3, Z3, T3); - } - // Fast algo for adding 2 Extended Points. - // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd - // Cost: 9M + 1*a + 1*d + 7add. - add(other) { - aedpoint(other); - const { a, d } = CURVE; - const { X: X1, Y: Y1, Z: Z1, T: T1 } = this; - const { X: X2, Y: Y2, Z: Z2, T: T2 } = other; - const A = modP(X1 * X2); // A = X1*X2 - const B = modP(Y1 * Y2); // B = Y1*Y2 - const C = modP(T1 * d * T2); // C = T1*d*T2 - const D = modP(Z1 * Z2); // D = Z1*Z2 - const E = modP((X1 + Y1) * (X2 + Y2) - A - B); // E = (X1+Y1)*(X2+Y2)-A-B - const F = D - C; // F = D-C - const G = D + C; // G = D+C - const H = modP(B - a * A); // H = B-a*A - const X3 = modP(E * F); // X3 = E*F - const Y3 = modP(G * H); // Y3 = G*H - const T3 = modP(E * H); // T3 = E*H - const Z3 = modP(F * G); // Z3 = F*G - return new Point(X3, Y3, Z3, T3); - } - subtract(other) { - // Validate before calling `negate()` so wrong inputs fail with the point guard - // instead of leaking a foreign `negate()` error. - aedpoint(other); - return this.add(other.negate()); - } - // Constant-time multiplication. - multiply(scalar) { - // 1 <= scalar < L - // Keep the subgroup-scalar contract strict instead of reducing 0 / n to ZERO. - // In keygen/signing-style callers, those values usually mean broken hash/scalar plumbing, - // and failing closed is safer than silently producing the identity point. - if (!Fn.isValidNot0(scalar)) - throw new RangeError('invalid scalar: expected 1 <= sc < curve.n'); - const { p, f } = wnaf.cached(this, scalar, (p) => normalizeZ(Point, p)); - return normalizeZ(Point, [p, f])[0]; - } - // Non-constant-time multiplication. Uses double-and-add algorithm. - // It's faster, but should only be used when you don't care about - // an exposed private key e.g. sig verification. - // Keeps the same subgroup-scalar contract: 0 is allowed for public-scalar callers, but - // n and larger values are rejected instead of being reduced mod n to the identity point. - multiplyUnsafe(scalar) { - // 0 <= scalar < L - if (!Fn.isValid(scalar)) - throw new RangeError('invalid scalar: expected 0 <= sc < curve.n'); - if (scalar === _0n) - return Point.ZERO; - if (this.is0() || scalar === _1n) - return this; - return wnaf.unsafe(this, scalar, (p) => normalizeZ(Point, p)); - } - // Checks if point is of small order. - // If you add something to small order point, you will have "dirty" - // point with torsion component. - // Clears cofactor and checks if the result is 0. - isSmallOrder() { - return this.clearCofactor().is0(); - } - // Multiplies point by curve order and checks if the result is 0. - // Returns `false` is the point is dirty. - isTorsionFree() { - return wnaf.unsafe(this, CURVE.n).is0(); - } - // Converts Extended point to default (x, y) coordinates. - // Can accept precomputed Z^-1 - for example, from invertBatch. - toAffine(invertedZ) { - const p = this; - let iz = invertedZ; - const { X, Y, Z } = p; - const is0 = p.is0(); - if (iz == null) - iz = is0 ? _8n : Fp.inv(Z); // 8 was chosen arbitrarily - const x = modP(X * iz); - const y = modP(Y * iz); - const zz = Fp.mul(Z, iz); - if (is0) - return { x: _0n, y: _1n }; - if (zz !== _1n) - throw new Error('invZ was invalid'); - return { x, y }; - } - clearCofactor() { - if (cofactor === _1n) - return this; - return this.multiplyUnsafe(cofactor); - } - toBytes() { - const { x, y } = this.toAffine(); - // Fp.toBytes() allows non-canonical encoding of y (>= p). - const bytes = Fp.toBytes(y); - // Each y has 2 valid points: (x, y), (x,-y). - // When compressing, it's enough to store y and use the last byte to encode sign of x - bytes[bytes.length - 1] |= x & _1n ? 0x80 : 0; - return bytes; - } - toHex() { - return bytesToHex(this.toBytes()); - } - toString() { - return ``; - } - } - const wnaf = new wNAF(Point, Fn.BITS); - // Keep constructor work cheap: subgroup/generator validation belongs to the caller's curve - // parameters, and doing the extra checks here adds about 10-15ms to heavy module imports. - // Callers that construct custom curves are responsible for supplying the correct base point. - // try { - // Point.BASE.assertValidity(); - // if (!Point.BASE.isTorsionFree()) throw new Error('bad point: not in prime-order subgroup'); - // } catch { - // throw new Error('bad curve params: generator point'); - // } - // Tiny toy curves can have scalar fields narrower than 8 bits. Skip the - // eager W=8 cache there instead of rejecting an otherwise valid constructor. - if (Fn.BITS >= 8) - Point.BASE.precompute(8); // Enable precomputes. Slows down first publicKey computation by 20ms. - Object.freeze(Point.prototype); - Object.freeze(Point); - return Point; -} -/** - * Base class for prime-order points like Ristretto255 and Decaf448. - * These points eliminate cofactor issues by representing equivalence classes - * of Edwards curve points. Multiple Edwards representatives can describe the - * same abstract wrapper element, so wrapper validity is not the same thing as - * the hidden representative being torsion-free. - * @param ep - Backing Edwards point. - * @example - * Base class for prime-order points like Ristretto255 and Decaf448. - * - * ```ts - * import { ristretto255 } from '@noble/curves/ed25519.js'; - * const point = ristretto255.Point.BASE.multiply(2n); - * ``` - */ -export class PrimeEdwardsPoint { - static BASE; - static ZERO; - static Fp; - static Fn; - ep; - /** - * Wrap one internal Edwards representative directly. - * This is not a canonical encoding boundary: alternate Edwards - * representatives may still describe the same abstract wrapper element. - */ - constructor(ep) { - this.ep = ep; - } - // Static methods that must be implemented by subclasses - static fromBytes(_bytes) { - notImplemented(); - } - static fromHex(_hex) { - notImplemented(); - } - get x() { - return this.toAffine().x; - } - get y() { - return this.toAffine().y; - } - // Common implementations - clearCofactor() { - // no-op for the abstract prime-order wrapper group; this is about the - // wrapper element, not the hidden Edwards representative. - return this; - } - assertValidity() { - // Keep wrapper validity at the abstract-group boundary. Canonical decode - // may choose Edwards representatives that differ by small torsion, so - // checking `this.ep.isTorsionFree()` here would reject valid wrapper points. - this.ep.assertValidity(); - } - /** - * Return affine coordinates of the current internal Edwards representative. - * This is a convenience helper, not a canonical Ristretto/Decaf encoding. - * Equal abstract elements may expose different `x` / `y`; use - * `toBytes()` / `fromBytes()` for canonical roundtrips. - */ - toAffine(invertedZ) { - return this.ep.toAffine(invertedZ); - } - toHex() { - return bytesToHex(this.toBytes()); - } - toString() { - return this.toHex(); - } - isTorsionFree() { - // Abstract Ristretto/Decaf elements are already prime-order even when the - // hidden Edwards representative is not torsion-free. - return true; - } - isSmallOrder() { - return false; - } - add(other) { - this.assertSame(other); - return this.init(this.ep.add(other.ep)); - } - subtract(other) { - this.assertSame(other); - return this.init(this.ep.subtract(other.ep)); - } - multiply(scalar) { - return this.init(this.ep.multiply(scalar)); - } - multiplyUnsafe(scalar) { - return this.init(this.ep.multiplyUnsafe(scalar)); - } - double() { - return this.init(this.ep.double()); - } - negate() { - return this.init(this.ep.negate()); - } - precompute(windowSize, isLazy) { - this.ep.precompute(windowSize, isLazy); - // Keep the wrapper identity stable like the backing Edwards API instead of - // allocating a fresh wrapper around the same cached point. - return this; - } -} -/** - * Initializes EdDSA signatures over given Edwards curve. - * @param Point - Edwards point constructor. - * @param cHash - Hash function. - * @param eddsaOpts - Optional signature helpers. See {@link EdDSAOpts}. - * @returns EdDSA helper namespace. - * @throws If the hash function, options, or derived point operations are invalid. {@link Error} - * @example - * Initializes EdDSA signatures over given Edwards curve. - * - * ```ts - * import { eddsa } from '@noble/curves/abstract/edwards.js'; - * import { jubjub } from '@noble/curves/misc.js'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * const sigs = eddsa(jubjub.Point, sha512); - * const { secretKey, publicKey } = sigs.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = sigs.sign(msg, secretKey); - * const isValid = sigs.verify(sig, msg, publicKey); - * ``` - */ -export function eddsa(Point, cHash, eddsaOpts = {}) { - if (typeof cHash !== 'function') - throw new Error('"hash" function param is required'); - const hash = cHash; - const opts = eddsaOpts; - validateObject(opts, {}, { - adjustScalarBytes: 'function', - randomBytes: 'function', - domain: 'function', - prehash: 'function', - zip215: 'boolean', - mapToCurve: 'function', - }); - const { prehash } = opts; - const { BASE, Fp, Fn } = Point; - const outputLen = hash.outputLen; - const expectedLen = 2 * Fp.BYTES; - // When hash metadata is available, reject incompatible EdDSA wrappers at construction time - // instead of deferring the mismatch until the first keygen/sign call. - if (outputLen !== undefined) { - asafenumber(outputLen, 'hash.outputLen'); - if (outputLen !== expectedLen) - throw new Error(`hash.outputLen must be ${expectedLen}, got ${outputLen}`); - } - const randomBytes = opts.randomBytes === undefined ? wcRandomBytes : opts.randomBytes; - const adjustScalarBytes = opts.adjustScalarBytes === undefined - ? (bytes) => bytes - : opts.adjustScalarBytes; - const domain = opts.domain === undefined - ? (data, ctx, phflag) => { - abool(phflag, 'phflag'); - if (ctx.length || phflag) - throw new Error('Contexts/pre-hash are not supported'); - return data; - } - : opts.domain; // NOOP - // Parse an EdDSA digest as a little-endian integer and reduce it modulo the scalar field order. - function modN_LE(hash) { - return Fn.create(bytesToNumberLE(hash)); // Not Fn.fromBytes: it has length limit - } - // Get the hashed private scalar per RFC8032 5.1.5 - function getPrivateScalar(key) { - const len = lengths.secretKey; - abytes(key, lengths.secretKey, 'secretKey'); - // Hash private key with curve's hash function to produce uniformingly random input - // Check byte lengths: ensure(64, h(ensure(32, key))) - const hashed = abytes(hash(key), 2 * len, 'hashedSecretKey'); - // Slice before clamping so in-place adjustors don't corrupt the prefix half. - const head = adjustScalarBytes(hashed.slice(0, len)); // clear first half bits, produce FE - const prefix = hashed.slice(len, 2 * len); // second half is called key prefix (5.1.6) - const scalar = modN_LE(head); // The actual private scalar - return { head, prefix, scalar }; - } - /** Convenience method that creates public key from scalar. RFC8032 5.1.5 - * Also exposes the derived scalar/prefix tuple and point form reused by sign(). - */ - function getExtendedPublicKey(secretKey) { - const { head, prefix, scalar } = getPrivateScalar(secretKey); - const point = BASE.multiply(scalar); // Point on Edwards curve aka public key - const pointBytes = point.toBytes(); - return { head, prefix, scalar, point, pointBytes }; - } - /** Calculates EdDSA pub key. RFC8032 5.1.5. */ - function getPublicKey(secretKey) { - return getExtendedPublicKey(secretKey).pointBytes; - } - // Hash domain-separated chunks into a little-endian scalar modulo the group order. - function hashDomainToScalar(context = Uint8Array.of(), ...msgs) { - const msg = concatBytes(...msgs); - return modN_LE(hash(domain(msg, abytes(context, undefined, 'context'), !!prehash))); - } - /** Signs message with secret key. RFC8032 5.1.6 */ - function sign(msg, secretKey, options = {}) { - msg = abytes(msg, undefined, 'message'); - if (prehash) - msg = prehash(msg); // for ed25519ph etc. - const { prefix, scalar, pointBytes } = getExtendedPublicKey(secretKey); - const r = hashDomainToScalar(options.context, prefix, msg); // r = dom2(F, C) || prefix || PH(M) - // RFC 8032 5.1.6 allows r mod L = 0, and SUPERCOP ref10 accepts the resulting identity-point - // signature. - // We intentionally keep the safe multiply() rejection here so a miswired all-zero hash provider - // fails loudly instead of silently producing a degenerate signature. - const R = BASE.multiply(r).toBytes(); // R = rG - const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M) - const s = Fn.create(r + k * scalar); // S = (r + k * s) mod L - if (!Fn.isValid(s)) - throw new Error('sign failed: invalid s'); // 0 <= s < L - const rs = concatBytes(R, Fn.toBytes(s)); - return abytes(rs, lengths.signature, 'result'); - } - // Keep the shared helper strict by default: RFC 8032 / NIST-style wrappers should reject - // non-canonical encodings unless they explicitly opt into ZIP-215's more permissive decode rules. - const verifyOpts = { - zip215: opts.zip215, - }; - /** - * Verifies EdDSA signature against message and public key. RFC 8032 §§5.1.7 and 5.2.7. - * A cofactored verification equation is checked. - */ - function verify(sig, msg, publicKey, options = verifyOpts) { - // Preserve the wrapper-selected default for `{}` / `{ zip215: undefined }`, not just omitted opts. - const { context } = options; - const zip215 = options.zip215 === undefined ? !!verifyOpts.zip215 : options.zip215; - const len = lengths.signature; - sig = abytes(sig, len, 'signature'); - msg = abytes(msg, undefined, 'message'); - publicKey = abytes(publicKey, lengths.publicKey, 'publicKey'); - if (zip215 !== undefined) - abool(zip215, 'zip215'); - if (prehash) - msg = prehash(msg); // for ed25519ph, etc - const mid = len / 2; - const r = sig.subarray(0, mid); - const s = bytesToNumberLE(sig.subarray(mid, len)); - let A, R, SB; - try { - // ZIP-215 is more permissive than RFC 8032 / NIST186-5. Use it only for wrappers that - // explicitly want consensus-style unreduced encoding acceptance. - // zip215=true: 0 <= y < MASK (2^256 for ed25519) - // zip215=false: 0 <= y < P (2^255-19 for ed25519) - A = Point.fromBytes(publicKey, zip215); - R = Point.fromBytes(r, zip215); - SB = BASE.multiplyUnsafe(s); // 0 <= s < l is done inside - } - catch (error) { - return false; - } - // RFC 8032 §§5.1.7/5.2.7 and FIPS 186-5 §§7.7.2/7.8.2 only decode A' and check the cofactored - // verification equation; they do not add a separate low-order-public-key rejection here. - // Strict mode still rejects small-order A' intentionally for SBS-style non-repudiation and to - // avoid ambiguous verification outcomes where unusual low-order keys can make distinct - // key/signature/message combinations verify. - if (!zip215 && A.isSmallOrder()) - return false; - // ZIP-215 accepts noncanonical / unreduced point encodings, so the challenge hash must use the - // exact signature/public-key bytes rather than canonicalized re-encodings of the decoded points. - const k = hashDomainToScalar(context, r, publicKey, msg); - const RkA = R.add(A.multiplyUnsafe(k)); - // Check the cofactored verification equation via the curve cofactor h. - // [h][S]B = [h]R + [h][k]A' - return RkA.subtract(SB).clearCofactor().is0(); - } - const _size = Fp.BYTES; // 32 for ed25519, 57 for ed448 - const lengths = { - secretKey: _size, - publicKey: _size, - signature: 2 * _size, - seed: _size, - }; - function randomSecretKey(seed) { - seed = seed === undefined ? randomBytes(lengths.seed) : seed; - return abytes(seed, lengths.seed, 'seed'); - } - function isValidSecretKey(key) { - return isBytes(key) && key.length === lengths.secretKey; - } - function isValidPublicKey(key, zip215) { - try { - // Preserve the wrapper-selected default for omitted / `undefined` ZIP-215 flags here too. - return !!Point.fromBytes(key, zip215 === undefined ? verifyOpts.zip215 : zip215); - } - catch (error) { - return false; - } - } - const utils = { - getExtendedPublicKey, - randomSecretKey, - isValidSecretKey, - isValidPublicKey, - /** - * Converts ed public key to x public key. Uses formula: - * - ed25519: - * - `(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)` - * - `(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))` - * - ed448: - * - `(u, v) = ((y-1)/(y+1), sqrt(156324)*u/x)` - * - `(x, y) = (sqrt(156324)*u/v, (1+u)/(1-u))` - */ - toMontgomery(publicKey) { - const { y } = Point.fromBytes(publicKey); - const size = lengths.publicKey; - const is25519 = size === 32; - if (!is25519 && size !== 57) - throw new Error('only defined for 25519 and 448'); - const u = is25519 ? Fp.div(_1n + y, _1n - y) : Fp.div(y - _1n, y + _1n); - return Fp.toBytes(u); - }, - toMontgomerySecret(secretKey) { - const size = lengths.secretKey; - abytes(secretKey, size); - const hashed = hash(secretKey.subarray(0, size)); - return adjustScalarBytes(hashed).subarray(0, size); - }, - }; - Object.freeze(lengths); - Object.freeze(utils); - return Object.freeze({ - keygen: createKeygen(randomSecretKey, getPublicKey), - getPublicKey, - sign, - verify, - utils, - Point, - lengths, - }); -} -//# sourceMappingURL=edwards.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/edwards.js.map b/node_modules/@noble/curves/abstract/edwards.js.map deleted file mode 100644 index 2bba3b7..0000000 --- a/node_modules/@noble/curves/abstract/edwards.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"edwards.js","sourceRoot":"","sources":["../src/abstract/edwards.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sEAAsE;AACtE,OAAO,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,WAAW,EACX,UAAU,EACV,eAAe,EACf,WAAW,EACX,SAAS,EACT,UAAU,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,IAAI,aAAa,GAK7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,IAAI,GAKL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAe,MAAM,cAAc,CAAC;AAE3C,qEAAqE;AACrE,kBAAkB;AAClB,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,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AY,CAAC,eAAe,EAAE,YAAY,CAAC;QACnD,YAAY;QACZ,IAAI;QACJ,MAAM;QACN,KAAK;QACL,KAAK;QACL,OAAO;KACR,CAAkB,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/fft.d.ts b/node_modules/@noble/curves/abstract/fft.d.ts deleted file mode 100644 index de23516..0000000 --- a/node_modules/@noble/curves/abstract/fft.d.ts +++ /dev/null @@ -1,439 +0,0 @@ -/** - * Experimental implementation of NTT / FFT (Fast Fourier Transform) over finite fields. - * API may change at any time. The code has not been audited. Feature requests are welcome. - * @module - */ -import type { TArg } from '../utils.ts'; -import type { IField } from './modular.ts'; -/** Array-like coefficient storage that can be mutated in place. */ -export interface MutableArrayLike { - /** Element access by numeric index. */ - [index: number]: T; - /** Current amount of stored coefficients. */ - length: number; - /** - * Return a sliced copy using the same storage shape. - * @param start - Inclusive start index. - * @param end - Exclusive end index. - * @returns Sliced copy. - */ - slice(start?: number, end?: number): this; - /** - * Iterate over stored coefficients in order. - * @returns Coefficient iterator. - */ - [Symbol.iterator](): Iterator; -} -/** - * Concrete polynomial containers accepted by the high-level `poly(...)` helpers. - * Lower-level FFT helpers can work with structural `MutableArrayLike`, but `poly(...)` - * intentionally keeps runtime dispatch on plain arrays and typed-array views. - */ -export type PolyStorage = T[] | (MutableArrayLike & ArrayBufferView); -/** - * Checks if integer is in form of `1 << X`. - * @param x - Integer to inspect. - * @returns `true` when the value is a power of two. - * @throws If `x` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Validate that an FFT size is a power of two. - * - * ```ts - * isPowerOfTwo(8); - * ``` - */ -export declare function isPowerOfTwo(x: number): boolean; -/** - * @param n - Input value. - * @returns Next power of two within the u32/array-length domain. - * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Round an integer up to the FFT size it needs. - * - * ```ts - * nextPowerOfTwo(9); - * ``` - */ -export declare function nextPowerOfTwo(n: number): number; -/** - * @param n - Value to reverse. - * @param bits - Number of bits to use. - * @returns Bit-reversed integer. - * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Reverse the low `bits` bits of one index. - * - * ```ts - * reverseBits(3, 3); - * ``` - */ -export declare function reverseBits(n: number, bits: number): number; -/** - * Similar to `bitLen(x)-1` but much faster for small integers, like indices. - * @param n - Input value. - * @returns Base-2 logarithm. For `n = 0`, the current implementation returns `-1`. - * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Compute the radix-2 stage count for one transform size. - * - * ```ts - * log2(8); - * ``` - */ -export declare function log2(n: number): number; -/** - * Moves lowest bit to highest position, which at first step splits - * array on even and odd indices, then it applied again to each part, - * which is core of fft - * @param values - Mutable coefficient array. - * @returns Mutated input array. - * @throws If the array length is not a positive power of two. {@link Error} - * @example - * Reorder coefficients into bit-reversed order in place. - * - * ```ts - * const values = Uint8Array.from([0, 1, 2, 3]); - * bitReversalInplace(values); - * ``` - */ -export declare function bitReversalInplace>(values: T): T; -/** - * @param values - Input values. - * @returns Reordered copy. - * @throws If the array length is not a positive power of two. {@link Error} - * @example - * Return a reordered copy instead of mutating the input in place. - * - * ```ts - * const reordered = bitReversalPermutation([0, 1, 2, 3]); - * ``` - */ -export declare function bitReversalPermutation(values: T[]): T[]; -/** Cached roots-of-unity tables derived from one finite field. */ -export type RootsOfUnity = { - /** Generator and 2-adicity metadata for the cached field. */ - info: { - G: bigint; - oddFactor: bigint; - powerOfTwo: number; - }; - /** - * Return the natural-order roots of unity for one radix-2 size. - * @param bits - Transform size as `log2(N)`. - * @returns Natural-order roots for that size. - */ - roots: (bits: number) => bigint[]; - /** - * Return the bit-reversal permutation of the roots for one radix-2 size. - * @param bits - Transform size as `log2(N)`. - * @returns Bit-reversed roots. - */ - brp(bits: number): bigint[]; - /** - * Return the inverse roots of unity for one radix-2 size. - * @param bits - Transform size as `log2(N)`. - * @returns Inverse roots. - */ - inverse(bits: number): bigint[]; - /** - * Return one primitive root used by a radix-2 stage. - * @param bits - Transform size as `log2(N)`. - * @returns Primitive root for that stage. - */ - omega: (bits: number) => bigint; - /** - * Drop all cached root tables. - * @returns Nothing. - */ - clear: () => void; -}; -/** - * We limit roots up to 2**31, which is a lot: 2-billion polynomimal should be rare. - * @param field - Field implementation. - * @param generator - Optional generator override. - * @returns Roots-of-unity cache. - * @example - * Cache roots once, then ask for the omega table of one FFT size. - * - * ```ts - * import { rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const roots = rootsOfUnity(Field(17n)); - * const omega = roots.omega(4); - * ``` - */ -export declare function rootsOfUnity(field: TArg>, generator?: bigint): RootsOfUnity; -/** Polynomial coefficient container used by the FFT helpers. */ -export type Polynomial = MutableArrayLike; -/** - * Arithmetic operations used by the generic FFT implementation. - * - * Maps great to Field, but not to Group (EC points): - * - inv from scalar field - * - we need multiplyUnsafe here, instead of multiply for speed - * - multiplyUnsafe is safe in the context: we do mul(rootsOfUnity), which are public and sparse - */ -export type FFTOpts = { - /** - * Add two coefficients. - * @param a - Left coefficient. - * @param b - Right coefficient. - * @returns Sum coefficient. - */ - add: (a: T, b: T) => T; - /** - * Subtract two coefficients. - * @param a - Left coefficient. - * @param b - Right coefficient. - * @returns Difference coefficient. - */ - sub: (a: T, b: T) => T; - /** - * Multiply one coefficient by a scalar/root factor. - * @param a - Coefficient value. - * @param scalar - Scalar/root factor. - * @returns Scaled coefficient. - */ - mul: (a: T, scalar: R) => T; - /** - * Invert one scalar/root factor. - * @param a - Scalar/root factor. - * @returns Inverse factor. - */ - inv: (a: R) => R; -}; -/** Configuration for one low-level FFT loop. */ -export type FFTCoreOpts = { - /** Transform size. Must be a power of two. */ - N: number; - /** Stage roots for the selected transform size. */ - roots: Polynomial; - /** Whether to run the DIT variant instead of DIF. */ - dit: boolean; - /** Whether to invert butterfly placement for decode-oriented layouts. */ - invertButterflies?: boolean; - /** Number of initial stages to skip. */ - skipStages?: number; - /** Whether to apply bit-reversal permutation at the boundary. */ - brp?: boolean; -}; -/** - * Callable low-level FFT loop over one polynomial storage shape. - * @param values - Polynomial coefficients to transform in place. - * @returns The mutated input polynomial. - */ -export type FFTCoreLoop =

>(values: P) => P; -/** - * Constructs different flavors of FFT. radix2 implementation of low level mutating API. Flavors: - * - * - DIT (Decimation-in-Time): Bottom-Up (leaves to root), Cool-Turkey - * - DIF (Decimation-in-Frequency): Top-Down (root to leaves), Gentleman-Sande - * - * DIT takes brp input, returns natural output. - * DIF takes natural input, returns brp output. - * - * The output is actually identical. Time / frequence distinction is not meaningful - * for Polynomial multiplication in fields. - * Which means if protocol supports/needs brp output/inputs, then we can skip this step. - * - * Cyclic NTT: Rq = Zq[x]/(x^n-1). butterfly_DIT+loop_DIT OR butterfly_DIF+loop_DIT, roots are omega - * Negacyclic NTT: Rq = Zq[x]/(x^n+1). butterfly_DIT+loop_DIF, at least for mlkem / mldsa - * @param F - Field operations. - * @param coreOpts - FFT configuration: - * - `N`: Transform size. Must be a power of two. - * - `roots`: Stage roots for the selected transform size. - * - `dit`: Whether to run the DIT variant instead of DIF. - * - `invertButterflies` (optional): Whether to invert butterfly placement. - * - `skipStages` (optional): Number of initial stages to skip. - * - `brp` (optional): Whether to apply bit-reversal permutation at the boundary. - * @returns Low-level FFT loop. - * @throws If the FFT options or cached roots are invalid for the requested size. {@link Error} - * @example - * Constructs different flavors of FFT. - * - * ```ts - * import { FFTCore, rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const roots = rootsOfUnity(Fp).roots(2); - * const loop = FFTCore(Fp, { N: 4, roots, dit: true }); - * const values = loop([1n, 2n, 3n, 4n]); - * ``` - */ -export declare const FFTCore: (F: FFTOpts, coreOpts: FFTCoreOpts) => FFTCoreLoop; -/** Forward and inverse FFT helpers for one coefficient domain. */ -export type FFTMethods = { - /** - * Apply the forward transform. - * @param values - Polynomial coefficients to transform. - * @param brpInput - Whether the input is already bit-reversed. - * @param brpOutput - Whether to keep the output bit-reversed. - * @returns Transformed copy. - */ - direct

>(values: P, brpInput?: boolean, brpOutput?: boolean): P; - /** - * Apply the inverse transform. - * @param values - Polynomial coefficients to transform. - * @param brpInput - Whether the input is already bit-reversed. - * @param brpOutput - Whether to keep the output bit-reversed. - * @returns Inverse-transformed copy. - */ - inverse

>(values: P, brpInput?: boolean, brpOutput?: boolean): P; -}; -/** - * NTT aka FFT over finite field (NOT over complex numbers). - * Naming mirrors other libraries. - * @param roots - Roots-of-unity cache. - * @param opts - Field operations. See {@link FFTOpts}. - * @returns Forward and inverse FFT helpers. - * @example - * NTT aka FFT over finite field (NOT over complex numbers). - * - * ```ts - * import { FFT, rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const fft = FFT(rootsOfUnity(Fp), Fp); - * const values = fft.direct([1n, 2n, 3n, 4n]); - * ``` - */ -export declare function FFT(roots: RootsOfUnity, opts: FFTOpts): FFTMethods; -/** - * Factory that allocates one polynomial storage container. - * Callers must ensure `_create(len)` returns field-zero-filled storage when `elm` is omitted, - * because the quadratic `mul()` / `convolve()` paths and the Kronecker-δ shortcut in - * `lagrange.basis()` rely on that default instead of always passing `field.ZERO` explicitly. - * @param len - Requested amount of coefficients. - * @param elm - Optional fill value. - * @returns Newly allocated polynomial container. - */ -export type CreatePolyFn

, T> = (len: number, elm?: T) => P; -/** High-level polynomial helpers layered on top of FFT and field arithmetic. */ -export type PolyFn

, T> = { - /** Roots-of-unity cache used by the helper namespace. */ - roots: RootsOfUnity; - /** Factory used to allocate new polynomial containers. */ - create: CreatePolyFn; - /** Optional enforced polynomial length. */ - length?: number; - /** - * Compute the polynomial degree. - * @param a - Polynomial coefficients. - * @returns Polynomial degree. - */ - degree: (a: P) => number; - /** - * Extend or truncate one polynomial to a requested length. - * @param a - Polynomial coefficients. - * @param len - Target length. - * @returns Resized polynomial. - */ - extend: (a: P, len: number) => P; - /** - * Add two polynomials coefficient-wise. - * @param a - Left polynomial. - * @param b - Right polynomial. - * @returns Sum polynomial. - */ - add: (a: P, b: P) => P; - /** - * Subtract two polynomials coefficient-wise. - * @param a - Left polynomial. - * @param b - Right polynomial. - * @returns Difference polynomial. - */ - sub: (a: P, b: P) => P; - /** - * Multiply by another polynomial or by one scalar. - * @param a - Left polynomial. - * @param b - Right polynomial or scalar. - * @returns Product polynomial. - */ - mul: (a: P, b: P | T) => P; - /** - * Multiply coefficients point-wise. - * @param a - Left polynomial. - * @param b - Right polynomial. - * @returns Point-wise product polynomial. - */ - dot: (a: P, b: P) => P; - /** - * Multiply two polynomials with convolution. - * @param a - Left polynomial. - * @param b - Right polynomial. - * @returns Convolution product. - */ - convolve: (a: P, b: P) => P; - /** - * Apply a point-wise coefficient shift by powers of one factor. - * @param p - Polynomial coefficients. - * @param factor - Shift factor. - * @returns Shifted polynomial. - */ - shift: (p: P, factor: bigint) => P; - /** - * Clone one polynomial container. - * @param a - Polynomial coefficients. - * @returns Cloned polynomial. - */ - clone: (a: P) => P; - /** - * Evaluate one polynomial on a basis vector. - * @param a - Polynomial coefficients. - * @param basis - Basis vector. - * @returns Evaluated field element. - */ - eval: (a: P, basis: P) => T; - /** Helpers for monomial-basis polynomials. */ - monomial: { - /** Build the monomial basis vector for one evaluation point. */ - basis: (x: T, n: number) => P; - /** Evaluate a polynomial in the monomial basis. */ - eval: (a: P, x: T) => T; - }; - /** Helpers for Lagrange-basis polynomials. */ - lagrange: { - /** Build the Lagrange basis vector for one evaluation point. */ - basis: (x: T, n: number, brp?: boolean) => P; - /** Evaluate a polynomial in the Lagrange basis. */ - eval: (a: P, x: T, brp?: boolean) => T; - }; - /** - * Build the vanishing polynomial for a root set. - * @param roots - Root set. - * @returns Vanishing polynomial. - */ - vanishing: (roots: P) => P; -}; -/** - * Poly wants a cracker. - * - * Polynomials are functions like `y=f(x)`, which means when we multiply two polynomials, result is - * function `f3(x) = f1(x) * f2(x)`, we don't multiply values. Key takeaways: - * - * - **Polynomial** is an array of coefficients: `f(x) = sum(coeff[i] * basis[i](x))` - * - **Basis** is array of functions - * - **Monominal** is Polynomial where `basis[i](x) == x**i` (powers) - * - **Array size** is domain size - * - **Lattice** is matrix (Polynomial of Polynomials) - * @param field - Field implementation. - * @param roots - Roots-of-unity cache. - * @param create - Optional polynomial factory. Runtime input validation accepts only plain `Array` - * and typed-array polynomial containers; arbitrary structural wrappers are intentionally rejected. - * @param fft - Optional FFT implementation. - * @param length - Optional fixed polynomial length. - * @returns Polynomial helper namespace. - * @example - * Build polynomial helpers, then convolve two coefficient arrays. - * - * ```ts - * import { poly, rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const poly17 = poly(Fp, rootsOfUnity(Fp)); - * const product = poly17.convolve([1n, 2n], [3n, 4n]); - * ``` - */ -export declare function poly(field: TArg>, roots: RootsOfUnity, create?: undefined, fft?: FFTMethods, length?: number): PolyFn; -export declare function poly>(field: TArg>, roots: RootsOfUnity, create: CreatePolyFn, fft?: FFTMethods, length?: number): PolyFn; -//# sourceMappingURL=fft.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/fft.d.ts.map b/node_modules/@noble/curves/abstract/fft.d.ts.map deleted file mode 100644 index 93d9f62..0000000 --- a/node_modules/@noble/curves/abstract/fft.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fft.d.ts","sourceRoot":"","sources":["../src/abstract/fft.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,mEAAmE;AACnE,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,uCAAuC;IACvC,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;IACnB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IAC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AM,CAAC,EAAE,MAAM,GACd,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/fft.js b/node_modules/@noble/curves/abstract/fft.js deleted file mode 100644 index db818e6..0000000 --- a/node_modules/@noble/curves/abstract/fft.js +++ /dev/null @@ -1,568 +0,0 @@ -function checkU32(n) { - // 0xff_ff_ff_ff - if (!Number.isSafeInteger(n) || n < 0 || n > 0xffffffff) - throw new Error('wrong u32 integer:' + n); - return n; -} -/** - * Checks if integer is in form of `1 << X`. - * @param x - Integer to inspect. - * @returns `true` when the value is a power of two. - * @throws If `x` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Validate that an FFT size is a power of two. - * - * ```ts - * isPowerOfTwo(8); - * ``` - */ -export function isPowerOfTwo(x) { - checkU32(x); - return (x & (x - 1)) === 0 && x !== 0; -} -/** - * @param n - Input value. - * @returns Next power of two within the u32/array-length domain. - * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Round an integer up to the FFT size it needs. - * - * ```ts - * nextPowerOfTwo(9); - * ``` - */ -export function nextPowerOfTwo(n) { - checkU32(n); - if (n <= 1) - return 1; - // FFT sizes here are used as JS array lengths, so `2^32` is not a meaningful result: - // keep the fast u32 bit-twiddling path and fail explicitly instead of wrapping to 1. - if (n > 0x8000_0000) - throw new Error('nextPowerOfTwo overflow: result does not fit u32'); - return (1 << (log2(n - 1) + 1)) >>> 0; -} -/** - * @param n - Value to reverse. - * @param bits - Number of bits to use. - * @returns Bit-reversed integer. - * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Reverse the low `bits` bits of one index. - * - * ```ts - * reverseBits(3, 3); - * ``` - */ -export function reverseBits(n, bits) { - checkU32(n); - if (!Number.isSafeInteger(bits) || bits < 0 || bits > 32) - throw new Error(`expected integer 0 <= bits <= 32, got ${bits}`); - let reversed = 0; - for (let i = 0; i < bits; i++, n >>>= 1) - reversed = (reversed << 1) | (n & 1); - // JS bitwise ops are signed i32; cast back so 32-bit reversals stay in the unsigned u32 domain. - return reversed >>> 0; -} -/** - * Similar to `bitLen(x)-1` but much faster for small integers, like indices. - * @param n - Input value. - * @returns Base-2 logarithm. For `n = 0`, the current implementation returns `-1`. - * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Compute the radix-2 stage count for one transform size. - * - * ```ts - * log2(8); - * ``` - */ -export function log2(n) { - checkU32(n); - return 31 - Math.clz32(n); -} -/** - * Moves lowest bit to highest position, which at first step splits - * array on even and odd indices, then it applied again to each part, - * which is core of fft - * @param values - Mutable coefficient array. - * @returns Mutated input array. - * @throws If the array length is not a positive power of two. {@link Error} - * @example - * Reorder coefficients into bit-reversed order in place. - * - * ```ts - * const values = Uint8Array.from([0, 1, 2, 3]); - * bitReversalInplace(values); - * ``` - */ -export function bitReversalInplace(values) { - const n = values.length; - // Size-1 FFT is the identity, so bit-reversal must stay a no-op there instead of rejecting it. - if (!isPowerOfTwo(n)) - throw new Error('expected positive power-of-two length, got ' + n); - const bits = log2(n); - for (let i = 0; i < n; i++) { - const j = reverseBits(i, bits); - if (i < j) { - const tmp = values[i]; - values[i] = values[j]; - values[j] = tmp; - } - } - return values; -} -/** - * @param values - Input values. - * @returns Reordered copy. - * @throws If the array length is not a positive power of two. {@link Error} - * @example - * Return a reordered copy instead of mutating the input in place. - * - * ```ts - * const reordered = bitReversalPermutation([0, 1, 2, 3]); - * ``` - */ -export function bitReversalPermutation(values) { - return bitReversalInplace(values.slice()); -} -const _1n = /** @__PURE__ */ BigInt(1); -function findGenerator(field) { - let G = BigInt(2); - for (; field.eql(field.pow(G, field.ORDER >> _1n), field.ONE); G++) - ; - return G; -} -/** - * We limit roots up to 2**31, which is a lot: 2-billion polynomimal should be rare. - * @param field - Field implementation. - * @param generator - Optional generator override. - * @returns Roots-of-unity cache. - * @example - * Cache roots once, then ask for the omega table of one FFT size. - * - * ```ts - * import { rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const roots = rootsOfUnity(Field(17n)); - * const omega = roots.omega(4); - * ``` - */ -export function rootsOfUnity(field, generator) { - // Factor field.ORDER-1 as oddFactor * 2^powerOfTwo - let oddFactor = field.ORDER - _1n; - let powerOfTwo = 0; - for (; (oddFactor & _1n) !== _1n; powerOfTwo++, oddFactor >>= _1n) - ; - // Find non quadratic residue - let G = generator !== undefined ? BigInt(generator) : findGenerator(field); - // Powers of generator - const omegas = new Array(powerOfTwo + 1); - omegas[powerOfTwo] = field.pow(G, oddFactor); - for (let i = powerOfTwo; i > 0; i--) - omegas[i - 1] = field.sqr(omegas[i]); - // Compute all roots of unity for powers up to maxPower - const rootsCache = []; - const checkBits = (bits) => { - checkU32(bits); - if (bits > 31 || bits > powerOfTwo) - throw new Error('rootsOfUnity: wrong bits ' + bits + ' powerOfTwo=' + powerOfTwo); - return bits; - }; - const precomputeRoots = (maxPower) => { - checkBits(maxPower); - for (let power = maxPower; power >= 0; power--) { - if (rootsCache[power]) - continue; // Skip if we've already computed roots for this power - const rootsAtPower = []; - for (let j = 0, cur = field.ONE; j < 2 ** power; j++, cur = field.mul(cur, omegas[power])) - rootsAtPower.push(cur); - rootsCache[power] = rootsAtPower; - } - return rootsCache[maxPower]; - }; - const brpCache = new Map(); - const inverseCache = new Map(); - // roots()/brp()/inverse() expose shared cached arrays by reference for speed; callers must treat them as read-only. - // NOTE: we use bits instead of power, because power = 2**bits, - // but power is not neccesary isPowerOfTwo(power)! - return { - info: { G, powerOfTwo, oddFactor }, - roots: (bits) => { - const b = checkBits(bits); - return precomputeRoots(b); - }, - brp(bits) { - const b = checkBits(bits); - if (brpCache.has(b)) - return brpCache.get(b); - else { - const res = bitReversalPermutation(this.roots(b)); - brpCache.set(b, res); - return res; - } - }, - inverse(bits) { - const b = checkBits(bits); - if (inverseCache.has(b)) - return inverseCache.get(b); - else { - const res = field.invertBatch(this.roots(b)); - inverseCache.set(b, res); - return res; - } - }, - omega: (bits) => omegas[checkBits(bits)], - clear: () => { - rootsCache.splice(0, rootsCache.length); - brpCache.clear(); - inverseCache.clear(); - }, - }; -} -/** - * Constructs different flavors of FFT. radix2 implementation of low level mutating API. Flavors: - * - * - DIT (Decimation-in-Time): Bottom-Up (leaves to root), Cool-Turkey - * - DIF (Decimation-in-Frequency): Top-Down (root to leaves), Gentleman-Sande - * - * DIT takes brp input, returns natural output. - * DIF takes natural input, returns brp output. - * - * The output is actually identical. Time / frequence distinction is not meaningful - * for Polynomial multiplication in fields. - * Which means if protocol supports/needs brp output/inputs, then we can skip this step. - * - * Cyclic NTT: Rq = Zq[x]/(x^n-1). butterfly_DIT+loop_DIT OR butterfly_DIF+loop_DIT, roots are omega - * Negacyclic NTT: Rq = Zq[x]/(x^n+1). butterfly_DIT+loop_DIF, at least for mlkem / mldsa - * @param F - Field operations. - * @param coreOpts - FFT configuration: - * - `N`: Transform size. Must be a power of two. - * - `roots`: Stage roots for the selected transform size. - * - `dit`: Whether to run the DIT variant instead of DIF. - * - `invertButterflies` (optional): Whether to invert butterfly placement. - * - `skipStages` (optional): Number of initial stages to skip. - * - `brp` (optional): Whether to apply bit-reversal permutation at the boundary. - * @returns Low-level FFT loop. - * @throws If the FFT options or cached roots are invalid for the requested size. {@link Error} - * @example - * Constructs different flavors of FFT. - * - * ```ts - * import { FFTCore, rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const roots = rootsOfUnity(Fp).roots(2); - * const loop = FFTCore(Fp, { N: 4, roots, dit: true }); - * const values = loop([1n, 2n, 3n, 4n]); - * ``` - */ -export const FFTCore = (F, coreOpts) => { - const { N, roots, dit, invertButterflies = false, skipStages = 0, brp = true } = coreOpts; - const bits = log2(N); - if (!isPowerOfTwo(N)) - throw new Error('FFT: Polynomial size should be power of two'); - // Wrong-sized root tables can stay in-bounds for some loop shapes and silently compute nonsense. - if (roots.length !== N) - throw new Error(`FFT: wrong roots length: expected ${N}, got ${roots.length}`); - const isDit = dit !== invertButterflies; - isDit; - return (values) => { - if (values.length !== N) - throw new Error('FFT: wrong Polynomial length'); - if (dit && brp) - bitReversalInplace(values); - for (let i = 0, g = 1; i < bits - skipStages; i++) { - // For each stage s (sub-FFT length m = 2^s) - const s = dit ? i + 1 + skipStages : bits - i; - const m = 1 << s; - const m2 = m >> 1; - const stride = N >> s; - // Loop over each subarray of length m - for (let k = 0; k < N; k += m) { - // Loop over each butterfly within the subarray - for (let j = 0, grp = g++; j < m2; j++) { - const rootPos = invertButterflies ? (dit ? N - grp : grp) : j * stride; - const i0 = k + j; - const i1 = k + j + m2; - const omega = roots[rootPos]; - const b = values[i1]; - const a = values[i0]; - // Inlining gives us 10% perf in kyber vs functions - if (isDit) { - const t = F.mul(b, omega); // Standard DIT butterfly - values[i0] = F.add(a, t); - values[i1] = F.sub(a, t); - } - else if (invertButterflies) { - values[i0] = F.add(b, a); // DIT loop + inverted butterflies (Kyber decode) - values[i1] = F.mul(F.sub(b, a), omega); - } - else { - values[i0] = F.add(a, b); // Standard DIF butterfly - values[i1] = F.mul(F.sub(a, b), omega); - } - } - } - } - if (!dit && brp) - bitReversalInplace(values); - return values; - }; -}; -/** - * NTT aka FFT over finite field (NOT over complex numbers). - * Naming mirrors other libraries. - * @param roots - Roots-of-unity cache. - * @param opts - Field operations. See {@link FFTOpts}. - * @returns Forward and inverse FFT helpers. - * @example - * NTT aka FFT over finite field (NOT over complex numbers). - * - * ```ts - * import { FFT, rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const fft = FFT(rootsOfUnity(Fp), Fp); - * const values = fft.direct([1n, 2n, 3n, 4n]); - * ``` - */ -export function FFT(roots, opts) { - const getLoop = (N, roots, brpInput = false, brpOutput = false) => { - if (brpInput && brpOutput) { - // we cannot optimize this case, but lets support it anyway - return (values) => FFTCore(opts, { N, roots, dit: false, brp: false })(bitReversalInplace(values)); - } - if (brpInput) - return FFTCore(opts, { N, roots, dit: true, brp: false }); - if (brpOutput) - return FFTCore(opts, { N, roots, dit: false, brp: false }); - return FFTCore(opts, { N, roots, dit: true, brp: true }); // all natural - }; - return { - direct(values, brpInput = false, brpOutput = false) { - const N = values.length; - if (!isPowerOfTwo(N)) - throw new Error('FFT: Polynomial size should be power of two'); - const bits = log2(N); - return getLoop(N, roots.roots(bits), brpInput, brpOutput)(values.slice()); - }, - inverse(values, brpInput = false, brpOutput = false) { - const N = values.length; - if (!isPowerOfTwo(N)) - throw new Error('FFT: Polynomial size should be power of two'); - const bits = log2(N); - const res = getLoop(N, roots.inverse(bits), brpInput, brpOutput)(values.slice()); - const ivm = opts.inv(BigInt(values.length)); // scale - // we can get brp output if we use dif instead of dit! - for (let i = 0; i < res.length; i++) - res[i] = opts.mul(res[i], ivm); - // Allows to re-use non-inverted roots, but is VERY fragile - // return [res[0]].concat(res.slice(1).reverse()); - // inverse calculated as pow(-1), which transforms into ω^{-kn} (-> reverses indices) - return res; - }, - }; -} -export function poly(field, roots, create, fft, length) { - const F = field; - const _create = create || - ((len, elm) => new Array(len).fill(elm ?? F.ZERO)); - // `poly.mul(a, b)` distinguishes polynomial-vs-scalar at runtime, so keep accepted - // polynomial containers concrete instead of trying to support arbitrary wrappers. - const isPoly = (x) => { - if (Array.isArray(x)) - return true; - if (!ArrayBuffer.isView(x)) - return false; - const v = x; - return (typeof v.length === 'number' && - typeof v.slice === 'function' && - typeof v[Symbol.iterator] === 'function'); - }; - const checkLength = (...lst) => { - if (!lst.length) - return 0; - for (const i of lst) - if (!isPoly(i)) - throw new Error('poly: not polynomial: ' + i); - const L = lst[0].length; - for (let i = 1; i < lst.length; i++) - if (lst[i].length !== L) - throw new Error(`poly: mismatched lengths ${L} vs ${lst[i].length}`); - if (length !== undefined && L !== length) - throw new Error(`poly: expected fixed length ${length}, got ${L}`); - return L; - }; - function findOmegaIndex(x, n, brp = false) { - const bits = log2(n); - const omega = brp ? roots.brp(bits) : roots.roots(bits); - for (let i = 0; i < n; i++) - if (F.eql(x, omega[i])) - return i; - return -1; - } - // TODO: mutating versions for mlkem/mldsa - return { - roots, - create: _create, - length, - extend: (a, len) => { - checkLength(a); - const out = _create(len, F.ZERO); - // Plain arrays grow when writing past `out.length`, so cap the copy explicitly to keep - // `extend()` consistent with typed arrays and with its documented truncate behavior. - for (let i = 0; i < Math.min(a.length, len); i++) - out[i] = a[i]; - return out; - }, - degree: (a) => { - checkLength(a); - for (let i = a.length - 1; i >= 0; i--) - if (!F.is0(a[i])) - return i; - return -1; - }, - add: (a, b) => { - const len = checkLength(a, b); - const out = _create(len); - for (let i = 0; i < len; i++) - out[i] = F.add(a[i], b[i]); - return out; - }, - sub: (a, b) => { - const len = checkLength(a, b); - const out = _create(len); - for (let i = 0; i < len; i++) - out[i] = F.sub(a[i], b[i]); - return out; - }, - dot: (a, b) => { - const len = checkLength(a, b); - const out = _create(len); - for (let i = 0; i < len; i++) - out[i] = F.mul(a[i], b[i]); - return out; - }, - mul: (a, b) => { - if (isPoly(b)) { - const len = checkLength(a, b); - if (fft) { - const A = fft.direct(a, false, true); - const B = fft.direct(b, false, true); - for (let i = 0; i < A.length; i++) - A[i] = F.mul(A[i], B[i]); - return fft.inverse(A, true, false); - } - else { - // NOTE: this is quadratic and mostly for compat tests with FFT - const res = _create(len); - for (let i = 0; i < len; i++) { - for (let j = 0; j < len; j++) { - const k = (i + j) % len; // wrap mod length - res[k] = F.add(res[k], F.mul(a[i], b[j])); - } - } - return res; - } - } - else { - const out = _create(checkLength(a)); - for (let i = 0; i < out.length; i++) - out[i] = F.mul(a[i], b); - return out; - } - }, - convolve(a, b) { - const len = nextPowerOfTwo(a.length + b.length - 1); - return this.mul(this.extend(a, len), this.extend(b, len)); - }, - shift(p, factor) { - const out = _create(checkLength(p)); - out[0] = p[0]; - for (let i = 1, power = F.ONE; i < p.length; i++) { - power = F.mul(power, factor); - out[i] = F.mul(p[i], power); - } - return out; - }, - clone: (a) => { - checkLength(a); - const out = _create(a.length); - for (let i = 0; i < a.length; i++) - out[i] = a[i]; - return out; - }, - eval: (a, basis) => { - checkLength(a, basis); - let acc = F.ZERO; - for (let i = 0; i < a.length; i++) - acc = F.add(acc, F.mul(a[i], basis[i])); - return acc; - }, - monomial: { - basis: (x, n) => { - const out = _create(n); - let pow = F.ONE; - for (let i = 0; i < n; i++) { - out[i] = pow; - pow = F.mul(pow, x); - } - return out; - }, - eval: (a, x) => { - checkLength(a); - // Same as eval(a, monomialBasis(x, a.length)), but it is faster this way - let acc = F.ZERO; - for (let i = a.length - 1; i >= 0; i--) - acc = F.add(F.mul(acc, x), a[i]); - return acc; - }, - }, - lagrange: { - basis: (x, n, brp = false, weights) => { - const bits = log2(n); - const cache = weights || (brp ? roots.brp(bits) : roots.roots(bits)); // [ω⁰, ω¹, ..., ωⁿ⁻¹] - const out = _create(n); - // Fast Kronecker-δ shortcut - const idx = findOmegaIndex(x, n, brp); - if (idx !== -1) { - out[idx] = F.ONE; - return out; - } - const tm = F.pow(x, BigInt(n)); - const c = F.mul(F.sub(tm, F.ONE), F.inv(BigInt(n))); // c = (xⁿ - 1)/n - const denom = _create(n); - for (let i = 0; i < n; i++) - denom[i] = F.sub(x, cache[i]); - const inv = F.invertBatch(denom); - for (let i = 0; i < n; i++) - out[i] = F.mul(c, F.mul(cache[i], inv[i])); - return out; - }, - eval(a, x, brp = false) { - checkLength(a); - const idx = findOmegaIndex(x, a.length, brp); - if (idx !== -1) - return a[idx]; // fast path - const L = this.basis(x, a.length, brp); // Lᵢ(x) - let acc = F.ZERO; - for (let i = 0; i < a.length; i++) - if (!F.is0(a[i])) - acc = F.add(acc, F.mul(a[i], L[i])); - return acc; - }, - }, - vanishing(roots) { - checkLength(roots); - const out = _create(roots.length + 1, F.ZERO); - out[0] = F.ONE; - for (const r of roots) { - const neg = F.neg(r); - for (let j = out.length - 1; j > 0; j--) - out[j] = F.add(F.mul(out[j], neg), out[j - 1]); - out[0] = F.mul(out[0], neg); - } - return out; - }, - }; -} -//# sourceMappingURL=fft.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/fft.js.map b/node_modules/@noble/curves/abstract/fft.js.map deleted file mode 100644 index 05e32be..0000000 --- a/node_modules/@noble/curves/abstract/fft.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fft.js","sourceRoot":"","sources":["../src/abstract/fft.ts"],"names":[],"mappings":"AAmCA,SAAS,QAAQ,CAAC,CAAS;IACzB,gBAAgB;IAChB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,UAAU;QACrD,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC;IAC5C,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACZ,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAAC,CAAS;IACtC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACZ,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACrB,qFAAqF;IACrF,qFAAqF;IACrF,IAAI,CAAC,GAAG,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACzF,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,CAAS,EAAE,IAAY;IACjD,QAAQ,CAAC,CAAC,CAAC,CAAC;IACZ,IAAI,CAAC,MAAM,CAAC,aAAa,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EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;YAC9C,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;YACf,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;gBACtB,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACrB,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;oBAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACxF,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAC9B,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/frost.d.ts b/node_modules/@noble/curves/abstract/frost.d.ts deleted file mode 100644 index 9c2b3a6..0000000 --- a/node_modules/@noble/curves/abstract/frost.d.ts +++ /dev/null @@ -1,293 +0,0 @@ -import { randomBytes, type TArg, type TRet } from '../utils.ts'; -import { type CurvePoint, type CurvePointCons } from './curve.ts'; -import { type H2CDSTOpts } from './hash-to-curve.ts'; -import { type IField } from './modular.ts'; -export type RNG = typeof randomBytes; -export type Identifier = string; -export type Commitment = Uint8Array; -export type Coefficient = Uint8Array; -export type Signature = Uint8Array; -export type Signers = { - min: number; - max: number; -}; -export type SecretKey = Uint8Array; -export type Bytes = Uint8Array; -type Point = Uint8Array; -export type DKG_Round1 = { - identifier: Identifier; - commitment: TRet; - proofOfKnowledge: TRet; -}; -export type DKG_Round2 = { - identifier: Identifier; - signingShare: TRet; -}; -export type DKG_Secret = { - identifier: bigint; - coefficients?: bigint[]; - commitment: TRet; - signers: Signers; - step?: 1 | 2 | 3; -}; -export type FrostPublic = { - signers: Signers; - commitments: TRet; - verifyingShares: TRet>; -}; -export type FrostSecret = { - identifier: Identifier; - signingShare: TRet; -}; -export type Key = { - public: FrostPublic; - secret: FrostSecret; -}; -export type DealerShares = { - public: FrostPublic; - secretShares: Record; -}; -export type Nonces = { - hiding: TRet; - binding: TRet; -}; -export type NonceCommitments = { - identifier: Identifier; - hiding: TRet; - binding: TRet; -}; -export type GenNonce = { - nonces: Nonces; - commitments: NonceCommitments; -}; -export interface FROSTPoint> extends CurvePoint { - add(rhs: T): T; - multiply(rhs: bigint): T; - equals(rhs: T): boolean; - toBytes(compressed?: boolean): Bytes; - clearCofactor(): T; -} -export interface FROSTPointConstructor> extends CurvePointCons { - fromBytes(a: Bytes): T; - Fn: IField; -} -export type FrostOpts

> = { - readonly name: string; - readonly Point: FROSTPointConstructor

; - readonly Fn?: IField; - /** Optional suite hook that tightens canonical decoding with subgroup / identity checks. */ - readonly validatePoint?: (p: P) => void; - /** Optional public-key parser. Implementations MUST preserve the same subgroup / identity policy - * as `validatePoint`, because this bypasses generic canonical decoding in `parsePoint()`. */ - readonly parsePublicKey?: (bytes: TArg) => P; - readonly hash: (msg: TArg) => TRet; - /** Custom scalar hash hook. Implementations MUST treat `msg` and `options` as read-only. */ - readonly hashToScalar?: (msg: TArg, options?: TArg) => bigint; - readonly adjustScalar?: (n: bigint) => bigint; - readonly adjustPoint?: (n: P) => P; - readonly challenge?: (R: P, PK: P, msg: TArg) => bigint; - readonly adjustNonces?: (PK: P, nonces: TArg) => TRet; - readonly adjustSecret?: (secret: TArg, pub: TArg) => TRet; - readonly adjustPublic?: (pub: TArg) => TRet; - readonly adjustGroupCommitmentShare?: (GC: P, GCShare: P) => P; - readonly adjustTx?: { - readonly encode: (tx: TArg) => TRet; - readonly decode: (tx: TArg) => TRet; - }; - readonly adjustDKG?: (k: TArg) => TRet; - readonly H1?: string; - readonly H2?: string; - readonly H3?: string; - readonly H4?: string; - readonly H5?: string; - readonly HDKG?: string; - readonly HID?: string; -}; -/** - * FROST: Threshold Protocol for Two‑Round Schnorr Signatures - * from [RFC 9591](https://datatracker.ietf.org/doc/rfc9591/). - */ -export type FROST = { - /** - * Methods to construct participant identifiers. - */ - Identifier: { - /** - * Constructs an identifier from a numeric index. - * @param n - A positive integer. - * @returns A canonical serialized Identifier. - */ - fromNumber(n: number): Identifier; - /** - * Derives an identifier deterministically from a string (e.g. an email). - * @param s - Arbitrary string. - * @returns A canonical serialized Identifier. - */ - derive(s: string): Identifier; - }; - /** - * Distributed Key Generation (DKG) protocol interface. - * RFC 9591 leaves DKG out of scope; Appendix C only specifies dealer/VSS key generation. - * These helpers follow the split-round API used by frost-rs for interoperable testing. - */ - DKG: { - /** - * Generates the first round of DKG. - * @param id - Participant's identifier. - * @param signers - Set of all participants (min/max threshold). - * @param secret - Optional initial secret scalar. - * @param rng - Optional RNG for nonce generation. - * @returns Public broadcast and private DKG state. The returned `secret` package is mutable - * round state that will be consumed by `round2()` and `round3()`. - */ - round1: (id: Identifier, signers: Signers, secret?: TArg, rng?: RNG) => { - public: DKG_Round1; - secret: DKG_Secret; - }; - /** - * Executes DKG round 2 given public round1 data from others. - * @param secret - Private DKG state from round1. This mutates `secret.step` in place. - * @param others - Public round1 broadcasts from other participants. - * @returns A map of round2 messages to be sent to others. - */ - round2: (secret: TArg, others: TArg) => TRet>; - /** - * Finalizes key generation in round3 using received round1 + round2 messages. - * @param secret - Private DKG state. This consumes the remaining local polynomial coefficients - * and transitions the package to its final post-round3 state. - * @param round1 - Public round1 broadcasts from all participants. - * @param round2 - Round2 messages received from others. - * @returns Final secret/public key information for the participant. - * Callers MUST pass the same verified remote `round1` package set that was already - * accepted in `round2()`, rather than re-fetching or rebuilding it from the network. - */ - round3: (secret: TArg, round1: TArg, round2: TArg) => TRet; - /** - * Best-effort erasure of internal secret state. Bigint/JIT copies may still survive outside the - * local object even after cleanup. - * @param secret - Private DKG state from round1. - */ - clean(secret: TArg): void; - }; - /** - * Trusted dealer mode: generates key shares from a central trusted authority. - * Mirrors RFC 9591 Appendix C and returns one shared VSS commitment package - * plus per-participant shares. - * @param signers - Threshold parameters (min/max). - * @param identifiers - Optional explicit participant list. - * @param secret - Optional secret scalar. - * @param rng - Optional RNG. - * @returns One shared public package plus the participant secret-share packages. - */ - trustedDealer(signers: Signers, identifiers?: Identifier[], secret?: TArg, rng?: RNG): TRet; - /** - * Validates the consistency of a secret share against the shared public commitments. - * This is the RFC 9591 Appendix C.2 `vss_verify` check against the shared dealer/DKG commitment. - * It does not relax RFC 9591 Section 3.1: public identity elements are still invalid even when - * the scalar/share algebra would otherwise be self-consistent. - * Throws if invalid. - * @param secret - A FrostSecret containing identifier and signing share. - * @param pub - Shared public package containing commitments. - */ - validateSecret(secret: TArg, pub: TArg): void; - /** - * Produces nonces and public commitments used in signing. - * RFC 9591 Section 5.1 `commit()`. - * @param secret - Participant's secret share. - * @param rng - Optional RNG. - * @returns Nonce values and their public commitments. - * Returned nonces are one-time-use and MUST NOT be reused across signing sessions. - * This API does not mutate or zeroize caller-owned nonce objects. - */ - commit(secret: TArg, rng?: RNG): TRet; - /** - * Signs a message using the participant's secret and nonce. - * @param secret - Participant's secret share. - * @param pub - Shared public package containing commitments. - * @param nonces - Participant's nonce pair. - * @param commitmentList - Commitments from all signing participants. - * @param msg - Message to be signed. - * @returns Signature share as a byte array. - * RFC 9591 Sections 4.1/5.1 require round-one commitments to be one-time-use, and - * Section 5.2 signs with the nonce corresponding to that published commitment. - * The caller MUST pass fresh nonces from `commit()`. On successful signing, this helper - * consumes the caller-owned nonce object by zeroing both nonce byte arrays in place. - * Later calls reject an all-zero nonce package, so same-object reuse fails closed and an - * accidentally generated zero nonce package is not silently used for signing. - */ - signShare(secret: TArg, pub: TArg, nonces: TArg, commitmentList: TArg, msg: TArg): TRet; - /** - * Verifies a signature share against public commitments. - * Matches the coordinator-side individual-share verification from RFC 9591 Section 5.4. - * @param pub - Group public key information. - * @param commitmentList - Commitments from all signing participants. - * @param msg - Message being signed. - * @param identifier - Identifier of the signer whose share is being verified. - * @param sigShare - Signature share to verify. - * @returns True if valid, false otherwise. - */ - verifyShare(pub: TArg, commitmentList: TArg, msg: TArg, identifier: Identifier, sigShare: TArg): boolean; - /** - * Aggregates signature shares into a full signature. - * RFC 9591 Section 5.3 `aggregate()`. - * @param pub - Group public key. - * @param commitmentList - Nonce commitments from all signers. - * @param msg - Message to sign. - * @param sigShares - Map from identifier to their signature share. - * @returns Final aggregated signature. - */ - aggregate(pub: TArg, commitmentList: TArg, msg: TArg, sigShares: TArg>): TRet; - /** - * Signs a message using a raw secret key (e.g. from combineSecret). - * @param msg - Message to sign. - * @param secretKey - Group secret key as bytes. - * @returns Signature bytes. - */ - sign(msg: TArg, secretKey: TArg): TRet; - /** - * Verifies a full signature against the group public key. - * @param sig - Signature bytes. - * @param msg - Message that was signed. - * @param publicKey - Group public key. - * @returns True if valid, false otherwise. - */ - verify(sig: TArg, msg: TArg, publicKey: TArg): boolean; - /** - * Combines multiple secret shares into a single secret key (e.g. for recovery). - * @param shares - Set of FrostSecret shares. - * @param signers - Threshold parameters. - * @returns Group secret key as bytes. - */ - combineSecret(shares: TArg, signers: Signers): TRet; - /** - * Low-level helper utilities (field arithmetic and polynomial tools). - */ - utils: { - /** - * Finite field used for scalars. - */ - Fn: IField; - /** - * Generates a random scalar (private key). - * @param rng - Optional RNG source. - * @returns Scalar as 32-byte Uint8Array. - */ - randomScalar: (rng?: RNG) => TRet; - /** - * Generates a secret-sharing polynomial and its public commitments. - * @param signers - Threshold parameters. - * @param secret - Optional initial secret scalar. - * @param coeffs - Optional manual coefficients. - * @param rng - Optional RNG. - * @returns Polynomial coefficients, commitments, and secret value. - */ - generateSecretPolynomial: (signers: Signers, secret?: TArg, coeffs?: bigint[], rng?: RNG) => { - coefficients: bigint[]; - commitment: TRet; - secret: bigint; - }; - }; -}; -export declare function createFROST

>(opts: FrostOpts

): TRet; -export {}; -//# sourceMappingURL=frost.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/frost.d.ts.map b/node_modules/@noble/curves/abstract/frost.d.ts.map deleted file mode 100644 index 5d15170..0000000 --- a/node_modules/@noble/curves/abstract/frost.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"frost.d.ts","sourceRoot":"","sources":["../src/abstract/frost.ts"],"names":[],"mappings":"AAOA,OAAO,EAML,WAAW,EAEX,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAgC,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAoC,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAE7E,MAAM,MAAM,GAAG,GAAG,OAAO,WAAW,CAAC;AACrC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC;AACpC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC;AACrC,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AACnC,MAAM,MAAM,OAAO,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AACnC,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC;AAC/B,KAAK,KAAK,GAAG,UAAU,CAAC;AAExB,MAAM,MAAM,UAAU,GAAG;IAIvB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC/B,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;CACnC,CAAC;AACF,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,UAAU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E,CAAC,CAAC;YAC1B,MAAM,EAAE,MAAM,CAAC;SAChB,CAAC;KACH,CAAC;CACH,CAAC;AA6BF,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAmsBpF"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/frost.js b/node_modules/@noble/curves/abstract/frost.js deleted file mode 100644 index 3653ffa..0000000 --- a/node_modules/@noble/curves/abstract/frost.js +++ /dev/null @@ -1,704 +0,0 @@ -/** - * FROST: Flexible Round-Optimized Schnorr Threshold Protocol for Two-Round Schnorr Signatures. - * - * See [RFC 9591](https://datatracker.ietf.org/doc/rfc9591/) and [frost.zfnd.org](https://frost.zfnd.org). - * @module - */ -import { utf8ToBytes } from '@noble/hashes/utils.js'; -import { bytesToHex, bytesToNumberBE, bytesToNumberLE, concatBytes, hexToBytes, randomBytes, validateObject, } from "../utils.js"; -import { pippenger, validatePointCons } from "./curve.js"; -import { poly } from "./fft.js"; -import {} from "./hash-to-curve.js"; -import { getMinHashLength, mapHashToField } from "./modular.js"; -// PubKey = commitments, verifyingShares -// PrivKey = id, signingShare, commitment -const validateSigners = (signers) => { - if (!Number.isSafeInteger(signers.min) || !Number.isSafeInteger(signers.max)) - throw new Error('Wrong signers info: min=' + signers.min + ' max=' + signers.max); - // Compatibility with frost-rs intentionally narrows RFC 9591's positive-nonzero threshold rule - // to `min >= 2`, even though the RFC text itself allows `MIN_PARTICIPANTS = 1`. - // This API is for actual threshold signing across participants; 1-of-n degenerates to ordinary - // single-signer mode, which does not need FROST's network/coordination machinery at all. - if (signers.min < 2 || signers.max < 2 || signers.min > signers.max) - throw new Error('Wrong signers info: min=' + signers.min + ' max=' + signers.max); -}; -const validateCommitmentsNum = (signers, len) => { - // RFC 9591 Sections 5.2/5.3 require MIN_PARTICIPANTS <= NUM_PARTICIPANTS <= MAX_PARTICIPANTS. - if (len < signers.min || len > signers.max) - throw new Error('Wrong number of commitments=' + len); -}; -class AggErr extends Error { - // Empty means aggregation failed before per-share verification could attribute a signer. - cheaters; - constructor(msg, cheaters) { - super(msg); - this.cheaters = cheaters; - } -} -export function createFROST(opts) { - validateObject(opts, { - name: 'string', - hash: 'function', - }, { - hashToScalar: 'function', - validatePoint: 'function', - parsePublicKey: 'function', - adjustScalar: 'function', - adjustPoint: 'function', - challenge: 'function', - adjustNonces: 'function', - adjustSecret: 'function', - adjustPublic: 'function', - adjustGroupCommitmentShare: 'function', - adjustDKG: 'function', - }); - // Cheap constructor-surface sanity check only: this verifies the generic static hooks/fields that - // FROST consumes, but it does not certify point semantics like BASE/ZERO correctness. - validatePointCons(opts.Point); - const { Point } = opts; - const Fn = opts.Fn === undefined ? Point.Fn : opts.Fn; - // Hashes - const hashBytes = opts.hash; - const hashToScalar = opts.hashToScalar === undefined - ? (msg, opts = { DST: new Uint8Array() }) => { - const t = hashBytes(concatBytes(opts.DST, msg)); - return Fn.create(Fn.isLE ? bytesToNumberLE(t) : bytesToNumberBE(t)); - } - : opts.hashToScalar; - const H1Prefix = utf8ToBytes(opts.H1 !== undefined ? opts.H1 : opts.name + 'rho'); - const H2Prefix = utf8ToBytes(opts.H2 !== undefined ? opts.H2 : opts.name + 'chal'); - const H3Prefix = utf8ToBytes(opts.H3 !== undefined ? opts.H3 : opts.name + 'nonce'); - const H4Prefix = utf8ToBytes(opts.H4 !== undefined ? opts.H4 : opts.name + 'msg'); - const H5Prefix = utf8ToBytes(opts.H5 !== undefined ? opts.H5 : opts.name + 'com'); - const HDKGPrefix = utf8ToBytes(opts.HDKG !== undefined ? opts.HDKG : opts.name + 'dkg'); - const HIDPrefix = utf8ToBytes(opts.HID !== undefined ? opts.HID : opts.name + 'id'); - const H1 = (msg) => hashToScalar(msg, { DST: H1Prefix }); - // Empty H2 still passes `{ DST: new Uint8Array() }` into custom hashToScalar hooks. - // The built-in fallback hashes that identically to omitted DST, which is how - // the Ed25519 suite models RFC 9591's undecorated H2 challenge hash. - const H2 = (msg) => hashToScalar(msg, { DST: H2Prefix }); - const H3 = (msg) => hashToScalar(msg, { DST: H3Prefix }); - const H4 = (msg) => hashBytes(concatBytes(H4Prefix, msg)); - const H5 = (msg) => hashBytes(concatBytes(H5Prefix, msg)); - const HDKG = (msg) => hashToScalar(msg, { DST: HDKGPrefix }); - const HID = (msg) => hashToScalar(msg, { DST: HIDPrefix }); - // /Hashes - const randomScalar = (rng = randomBytes) => { - // Intentional divergence from RFC 9591 §4.1 / §5.1: the RFC nonce_generate helper outputs a - // Scalar in [0, p-1], but round-one commit publishes ScalarBaseMult(nonce) values and §3.1 - // requires SerializeElement / DeserializeElement to reject the identity element. Keep noble's - // mapHashToField generation here so round-one public nonce commitments stay in 1..n-1. - const t = mapHashToField(rng(getMinHashLength(Fn.ORDER)), Fn.ORDER, Fn.isLE); - // We cannot use Fn.fromBytes here because the field can have a different - // byte width, like ed448. - return Fn.isLE ? bytesToNumberLE(t) : bytesToNumberBE(t); - }; - const serializePoint = (p) => p.toBytes(); - const parsePoint = (bytes) => { - // RFC 9591 Section 3.1 requires DeserializeElement validation. Suite-specific validatePoint - // hooks tighten this further for ciphersuites in Section 6. Bare createFROST(...) only gets - // canonical point decoding unless the caller installs those extra subgroup / identity checks. - const p = Point.fromBytes(bytes); - if (opts.validatePoint) - opts.validatePoint(p); - return p; - }; - // RFC 9591 Sections 4.1/5.1 model each participant's round-one output as two public commitments. - const nonceCommitments = (identifier, nonces) => ({ - identifier, - hiding: serializePoint(Point.BASE.multiply(Fn.fromBytes(nonces.hiding))), - binding: serializePoint(Point.BASE.multiply(Fn.fromBytes(nonces.binding))), - }); - const adjustPoint = opts.adjustPoint === undefined ? (n) => n : opts.adjustPoint; - // We use hex to make it easier to use inside objects - const validateIdentifier = (n) => { - // Identifiers are canonical non-zero scalars. Custom / derived identifiers are allowed, so this - // is intentionally not bounded by the current signers.max slot count. - if (!Fn.isValid(n) || Fn.is0(n)) - throw new Error('Invalid identifier ' + n); - return n; - }; - const serializeIdentifier = (id) => bytesToHex(Fn.toBytes(validateIdentifier(id))); - const parseIdentifier = (id) => { - const n = validateIdentifier(Fn.fromBytes(hexToBytes(id))); - // Keep string-keyed maps stable by accepting only the canonical serialized form. - if (serializeIdentifier(n) !== id) - throw new Error('expected canonical identifier hex'); - return n; - }; - const Signature = { - // RFC 9591 Appendix A encodes signatures canonically as - // SerializeElement(R) || SerializeScalar(z). - encode: (R, z) => { - let res = concatBytes(serializePoint(R), Fn.toBytes(z)); - if (opts.adjustTx) - res = opts.adjustTx.encode(res); - return res; - }, - decode: (sig) => { - if (opts.adjustTx) - sig = opts.adjustTx.decode(sig); - // We don't know size of point, but we know size of scalar - const R = parsePoint(sig.subarray(0, -Fn.BYTES)); - const z = Fn.fromBytes(sig.subarray(-Fn.BYTES)); - return { R, z }; - }, - }; - // Generates pair of (scalar, point) - const genPointScalarPair = (rng = randomBytes) => { - let n = randomScalar(rng); - if (opts.adjustScalar) - n = opts.adjustScalar(n); - let p = Point.BASE.multiply(n); - return { scalar: n, point: p }; - }; - // No roots here: root-based methods will throw. - // `poly` expects a structured roots-of-unity domain, but FROST uses an - // arbitrary domain and only needs the non-root operations below. - const nrErr = 'roots are unavailable in FROST polynomial mode'; - const noRoots = { - info: { G: Fn.ZERO, oddFactor: Fn.ZERO, powerOfTwo: 0 }, - roots() { - throw new Error(nrErr); - }, - brp() { - throw new Error(nrErr); - }, - inverse() { - throw new Error(nrErr); - }, - omega() { - throw new Error(nrErr); - }, - clear() { }, - }; - const Poly = poly(Fn, noRoots); - const msm = (points, scalars) => pippenger(Point, points, scalars); - // Internal stuff uses bigints & Points, external Uint8Arrays - const polynomialEvaluate = (x, coeffs) => { - if (!coeffs.length) - throw new Error('empty coefficients'); - return Poly.monomial.eval(coeffs, x); - }; - const deriveInterpolatingValue = (L, xi) => { - const err = 'invalid parameters'; - // Generates lagrange coefficient - if (!L.some((x) => Fn.eql(x, xi))) - throw new Error(err); - // Throws error if any x-coordinate is represented more than once in L. - const Lset = new Set(L); - if (Lset.size !== L.length) - throw new Error(err); - // Or if xi is missing - if (!Lset.has(xi)) - throw new Error(err); - let num = Fn.ONE; - let den = Fn.ONE; - for (const x of L) { - if (Fn.eql(x, xi)) - continue; - num = Fn.mul(num, x); // num *= x - den = Fn.mul(den, Fn.sub(x, xi)); // RFC 9591 §4.2: denominator *= x_j - x_i - } - return Fn.div(num, den); - }; - const evalutateVSS = (identifier, commitment) => { - // RFC 9591 Appendix C.2: S_i' = Σ_j ScalarMult(vss_commitment[j], i^j). - const monomial = Poly.monomial.basis(identifier, commitment.length); - return msm(commitment, monomial); - }; - // High-level internal stuff - const generateSecretPolynomial = (signers, secret, coeffs, rng = randomBytes) => { - validateSigners(signers); - // Dealer/DKG polynomial sampling reuses the same hardened scalar derivation as round-one - // nonces: overriding `rng` only swaps the entropy source, not the non-zero `1..n-1` policy. - const secretScalar = secret === undefined ? randomScalar(rng) : Fn.fromBytes(secret); - if (!coeffs) { - coeffs = []; - for (let i = 0; i < signers.min - 1; i++) - coeffs.push(randomScalar(rng)); - } - if (coeffs.length !== signers.min - 1) - throw new Error('wrong coefficients length'); - const coefficients = [secretScalar, ...coeffs]; - // RFC 9591 Appendix C.2 commits to every polynomial coefficient with ScalarBaseMult. - const commitment = coefficients.map((i) => Point.BASE.multiply(i)); - return { coefficients, commitment, secret: secretScalar }; - }; - // Pretty much sign+verify, same as basic - const ProofOfKnowledge = { - challenge: (id, verKey, R) => HDKG(concatBytes(Fn.toBytes(id), serializePoint(verKey), serializePoint(R))), - compute(id, coefficents, commitments, rng = randomBytes) { - if (coefficents.length < 1) - throw new Error('coefficients should have at least one element'); - const { point: R, scalar: k } = genPointScalarPair(rng); - const verKey = commitments[0]; // verify key is first one - const c = this.challenge(id, verKey, R); - const mu = Fn.add(k, Fn.mul(coefficents[0], c)); // mu = k + coeff[0] * c - return Signature.encode(R, mu); - }, - validate(id, commitment, proof) { - if (commitment.length < 1) - throw new Error('commitment should have at least one element'); - const { R, z } = Signature.decode(proof); - const phi = parsePoint(commitment[0]); - const c = this.challenge(id, phi, R); - // R === z*G - phi*c - if (!R.equals(Point.BASE.multiply(z).subtract(phi.multiply(c)))) - throw new Error('invalid proof of knowledge'); - }, - }; - const Basic = { - challenge: (R, PK, msg) => { - if (opts.challenge) - return opts.challenge(R, PK, msg); - return H2(concatBytes(serializePoint(R), serializePoint(PK), msg)); - }, - sign(msg, sk, rng = randomBytes) { - const { point: R, scalar: r } = genPointScalarPair(rng); - const PK = Point.BASE.multiply(sk); // sk*G - const c = this.challenge(R, PK, msg); - const z = Fn.add(r, Fn.mul(c, sk)); // r + c * sk - return [R, z]; - }, - verify(msg, R, z, PK) { - if (opts.adjustPoint) - PK = opts.adjustPoint(PK); - if (opts.adjustPoint) - R = opts.adjustPoint(R); - const c = this.challenge(R, PK, msg); - const zB = Point.BASE.multiply(z); // z*G - const cA = PK.multiply(c); // c*PK - let check = zB.subtract(cA).subtract(R); // zB - cA - R - // No clearCoffactor on ristretto - if (check.clearCofactor) - check = check.clearCofactor(); - return Point.ZERO.equals(check); - }, - }; - // === vssVerify - const validateSecretShare = (identifier, commitment, signingShare) => { - // RFC 9591 Appendix C.2 `vss_verify(share_i, vss_commitment)` is purely algebraic. - // Public FROST packages still go through Section 3.1 element encoding, - // which rejects identity points, so a zero share or commitment does not - // become valid wire data just because VSS matches. - if (!Point.BASE.multiply(signingShare).equals(evalutateVSS(identifier, commitment))) - throw new Error('invalid secret share'); - }; - const Identifier = { - fromNumber(n) { - if (!Number.isSafeInteger(n)) - throw new Error('expected safe interger'); - return serializeIdentifier(BigInt(n)); - }, - // Not in spec, but in FROST implementation, - // seems useful and nice, no need to sync identifiers (would require more interactions) - derive(s) { - if (typeof s !== 'string') - throw new Error('wrong identifier string: ' + s); - // Derived identifiers may land anywhere in the scalar field; they are not restricted to - // sequential `1..max_signers` values. - return serializeIdentifier(HID(utf8ToBytes(s))); - }, - }; - // RFC 9591 §4.1: nonce_generate() hashes 32 fresh RNG bytes with SerializeScalar(secret). - const generateNonce = (secret, rng = randomBytes) => H3(concatBytes(rng(32), Fn.toBytes(secret))); - const getGroupCommitment = (GPK, commitmentList, msg) => { - const CL = commitmentList.map((i) => [ - i.identifier, - parseIdentifier(i.identifier), - parsePoint(i.hiding), - parsePoint(i.binding), - ]); - // RFC 9591 Sections 4.3/4.4/4.5 and 5.2/5.3 treat commitment_list as sorted by identifier. - CL.sort((a, b) => (a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0)); - // Encode commitment list - const Cbytes = []; - for (const [_, id, hC, bC] of CL) - Cbytes.push(Fn.toBytes(id), serializePoint(hC), serializePoint(bC)); - const encodedCommitmentHash = H5(concatBytes(...Cbytes)); - const rhoPrefix = concatBytes(serializePoint(GPK), H4(msg), encodedCommitmentHash); - // Compute binding factors - const bindingFactors = {}; - for (const [i, id] of CL) { - bindingFactors[i] = H1(concatBytes(rhoPrefix, Fn.toBytes(id))); - } - const points = []; - const scalars = []; - for (const [i, _, hC, bC] of CL) { - if (Point.ZERO.equals(hC) || Point.ZERO.equals(bC)) - throw new Error('infinity commitment'); - points.push(hC, bC); - scalars.push(Fn.ONE, bindingFactors[i]); - } - const groupCommitment = msm(points, scalars); // GC += hC + bC*bindingFactor - const identifiers = CL.map((i) => i[1]); - return { identifiers, groupCommitment, bindingFactors }; - }; - const prepareShare = (PK, commitmentList, msg, identifier) => { - // RFC 9591 Sections 4.4/4.5/4.6 feed directly into the Section 5.2 signer computation. - const GPK = adjustPoint(parsePoint(PK)); - const id = parseIdentifier(identifier); - const { identifiers, groupCommitment, bindingFactors } = getGroupCommitment(GPK, commitmentList, msg); - const bindingFactor = bindingFactors[identifier]; - const lambda = deriveInterpolatingValue(identifiers, id); - const challenge = Basic.challenge(groupCommitment, GPK, msg); - return { lambda, challenge, bindingFactor, groupCommitment }; - }; - Object.freeze(Identifier); - const frost = { - Identifier, - // DKG is Distributed Key Generation, not Trusted Dealer Key Generation. - DKG: Object.freeze({ - // NOTE: we allow to pass secret scalar from user side, - // this way it can be derived, instead of random generation - round1: (id, signers, secret, rng = randomBytes) => { - validateSigners(signers); - const idNum = parseIdentifier(id); - const { coefficients, commitment } = generateSecretPolynomial(signers, secret, undefined, rng); - const proofOfKnowledge = ProofOfKnowledge.compute(idNum, coefficients, commitment, rng); - const commitmentBytes = commitment.map(serializePoint); - const round1Public = { - identifier: serializeIdentifier(idNum), - commitment: commitmentBytes, - proofOfKnowledge, - }; - // store secret information for signing - const round1Secret = { - identifier: idNum, - coefficients, - commitment: commitment.map(serializePoint), - // Copy threshold metadata instead of retaining the caller-owned object by reference. - signers: { min: signers.min, max: signers.max }, - step: 1, - }; - return { public: round1Public, secret: round1Secret }; - }, - round2: (secret, others) => { - if (others.length !== secret.signers.max - 1) - throw new Error('wrong number of round1 packages'); - if (!secret.coefficients || secret.step === 3) - throw new Error('round3 package used in round2'); - const res = {}; - for (const p of others) { - if (p.commitment.length !== secret.signers.min) - throw new Error('wrong number of commitments'); - const id = parseIdentifier(p.identifier); - if (id === secret.identifier) - throw new Error('duplicate id=' + serializeIdentifier(id)); - ProofOfKnowledge.validate(id, p.commitment, p.proofOfKnowledge); - for (const c of p.commitment) - parsePoint(c); - if (res[p.identifier]) - throw new Error('Duplicate id=' + id); - const signingShare = Fn.toBytes(polynomialEvaluate(id, secret.coefficients)); - res[p.identifier] = { - identifier: serializeIdentifier(secret.identifier), - signingShare: signingShare, - }; - } - secret.step = 2; - return res; - }, - round3: (secret, round1, round2) => { - // DKG is outside RFC 9591's signing flow; callers are expected to reuse the same - // remote round1 packages already accepted in round2, like frost-rs documents. - if (round1.length !== secret.signers.max - 1) - throw new Error('wrong length of round1 packages'); - if (!secret.coefficients || secret.step !== 2) - throw new Error('round2 package used in round3'); - if (round2.length !== round1.length) - throw new Error('wrong length of round2 packages'); - const merged = {}; - for (const r1 of round1) { - if (!r1.identifier || !r1.commitment) - throw new Error('wrong round1 share'); - merged[r1.identifier] = { ...r1 }; - } - for (const r2 of round2) { - if (!r2.identifier || !r2.signingShare) - throw new Error('wrong round2 share'); - if (!merged[r2.identifier]) - throw new Error('round1 share for ' + r2.identifier + ' is missing'); - merged[r2.identifier].signingShare = r2.signingShare; - } - if (Object.keys(merged).length !== round1.length) - throw new Error('mismatch identifiers between rounds'); - let signingShare = Fn.ZERO; - if (secret.commitment.length !== secret.signers.min) - throw new Error('wrong commitments length'); - const localCommitment = secret.commitment.map(parsePoint); - const localShare = polynomialEvaluate(secret.identifier, secret.coefficients); - validateSecretShare(secret.identifier, localCommitment, localShare); - const localCommitmentBytes = localCommitment.map(serializePoint); - const commitments = { - [serializeIdentifier(secret.identifier)]: localCommitmentBytes, - }; - for (const k in merged) { - const v = merged[k]; - if (!v.signingShare || !v.commitment) - throw new Error('mismatch identifiers'); - const id = parseIdentifier(k); // from - const signingSharePart = Fn.fromBytes(v.signingShare); - const commitment = v.commitment.map(parsePoint); - validateSecretShare(secret.identifier, commitment, signingSharePart); - signingShare = Fn.add(signingShare, signingSharePart); - const idSer = serializeIdentifier(id); - if (commitments[idSer]) - throw new Error('duplicated id=' + idSer); - commitments[idSer] = v.commitment; - } - signingShare = Fn.add(signingShare, localShare); - const mergedCommitment = new Array(secret.signers.min).fill(Point.ZERO); - for (const k in commitments) { - const v = commitments[k]; - if (v.length !== secret.signers.min) - throw new Error('wrong commitments length'); - for (let i = 0; i < v.length; i++) - mergedCommitment[i] = mergedCommitment[i].add(parsePoint(v[i])); - } - const mergedCommitmentBytes = mergedCommitment.map(serializePoint); - const verifyingShares = {}; - for (const k in commitments) - verifyingShares[k] = serializePoint(evalutateVSS(parseIdentifier(k), mergedCommitment)); - // This is enough to sign stuff - let res = { - public: { - signers: { min: secret.signers.min, max: secret.signers.max }, - commitments: mergedCommitmentBytes, - verifyingShares: Object.fromEntries(Object.entries(verifyingShares).map(([k, v]) => [k, v.slice()])), - }, - secret: { - identifier: serializeIdentifier(secret.identifier), - signingShare: Fn.toBytes(signingShare), - }, - }; - if (opts.adjustDKG) - res = opts.adjustDKG(res); - for (let i = 0; i < secret.coefficients.length; i++) - secret.coefficients[i] -= secret.coefficients[i]; - delete secret.coefficients; - secret.step = 3; - return res; - }, - clean(secret) { - // Instead of replacing secret bigint with another (zero?), we subtract it from itself - // in the hope that JIT will modify it inplace, instead of creating new value. - // This is unverified and may not work, but it is best we can do in regard of bigints. - secret.identifier -= secret.identifier; - if (secret.coefficients) { - for (let i = 0; i < secret.coefficients.length; i++) - secret.coefficients[i] -= secret.coefficients[i]; - } - // for (const c of secret.commitment) c.fill(0); - secret.step = 3; - }, - }), - // Trusted dealer setup - // Generates keys for all participants - trustedDealer(signers, identifiers, secret, rng = randomBytes) { - // if no identifiers provided, we generated default identifiers - validateSigners(signers); - if (identifiers === undefined) { - identifiers = []; - for (let i = 1; i <= signers.max; i++) - identifiers.push(Identifier.fromNumber(i)); - } - else { - if (!Array.isArray(identifiers) || identifiers.length !== signers.max) - throw new Error('identifiers should be array of ' + signers.max); - } - const identifierNums = {}; - for (const id of identifiers) { - const idNum = parseIdentifier(id); - if (id in identifierNums) - throw new Error('duplicated id=' + id); - identifierNums[id] = idNum; - } - const sp = generateSecretPolynomial(signers, secret, undefined, rng); - const commitmentBytes = sp.commitment.map(serializePoint); - const secretShares = {}; - const verifyingShares = {}; - for (const id of identifiers) { - const signingShare = polynomialEvaluate(identifierNums[id], sp.coefficients); - verifyingShares[id] = serializePoint(Point.BASE.multiply(signingShare)); - secretShares[id] = { - identifier: id, - signingShare: Fn.toBytes(signingShare), - }; - } - return { - public: { - signers: { min: signers.min, max: signers.max }, - commitments: commitmentBytes, - verifyingShares, - }, - secretShares, - }; - }, - // Validate secret (from trusted dealer or DKG) - validateSecret(secret, pub) { - const id = parseIdentifier(secret.identifier); - const commitment = pub.commitments.map(parsePoint); - const signingShare = Fn.fromBytes(secret.signingShare); - validateSecretShare(id, commitment, signingShare); - }, - // Actual signing - // Round 1: each participant commit to nonces - // Nonces kept private, commitments sent to coordinator (or every other participant) - // NOTE: we don't need the message at this point, which lets a coordinator - // keep multiple nonce commitments per participant in advance and skip - // round1 for signing. - // But then each participant needs to remember generated shares - commit(secret, rng = randomBytes) { - const secretScalar = Fn.fromBytes(secret.signingShare); - const hiding = generateNonce(secretScalar, rng); - const binding = generateNonce(secretScalar, rng); - const nonces = { hiding: Fn.toBytes(hiding), binding: Fn.toBytes(binding) }; - return { nonces, commitments: nonceCommitments(secret.identifier, nonces) }; - }, - // Round2: sign. Each participant creates a signature share from the secret - // and the selected nonce commitments. - signShare(secret, pub, nonces, commitmentList, msg) { - validateCommitmentsNum(pub.signers, commitmentList.length); - const hidingNonce0 = Fn.fromBytes(nonces.hiding); - const bindingNonce0 = Fn.fromBytes(nonces.binding); - if (Fn.is0(hidingNonce0) || Fn.is0(bindingNonce0)) - throw new Error('signing nonces already used'); - // Reject a coordinator-assigned commitment pair that does not match the signer's own nonce - // pair. This must happen before suite-specific nonce adjustment; secp256k1-tr may negate the - // actual signing nonces later, but the coordinator still assigns the original commitments. - const expectedCommitment = { - identifier: secret.identifier, - hiding: serializePoint(Point.BASE.multiply(hidingNonce0)), - binding: serializePoint(Point.BASE.multiply(bindingNonce0)), - }; - const commitment = commitmentList.find((i) => i.identifier === secret.identifier); - if (!commitment) - throw new Error('missing signer commitment'); - if (bytesToHex(commitment.hiding) !== bytesToHex(expectedCommitment.hiding) || - bytesToHex(commitment.binding) !== bytesToHex(expectedCommitment.binding)) - throw new Error('incorrect signer commitment'); - if (opts.adjustSecret) - secret = opts.adjustSecret(secret, pub); - if (opts.adjustPublic) - pub = opts.adjustPublic(pub); - const SK = Fn.fromBytes(secret.signingShare); - const { lambda, challenge, bindingFactor, groupCommitment } = prepareShare(pub.commitments[0], commitmentList, msg, secret.identifier); - const N = opts.adjustNonces ? opts.adjustNonces(groupCommitment, nonces) : nonces; - const hidingNonce = opts.adjustNonces ? Fn.fromBytes(N.hiding) : hidingNonce0; - const bindingNonce = opts.adjustNonces ? Fn.fromBytes(N.binding) : bindingNonce0; - const t = Fn.mul(Fn.mul(lambda, SK), challenge); // challenge * lambda * SK - const t2 = Fn.mul(bindingNonce, bindingFactor); // bindingNonce * bindingFactor - const r = Fn.toBytes(Fn.add(Fn.add(hidingNonce, t2), t)); // t + t2 + hidingNonce - // RFC 9591 round-one commitments are one-time-use, and round two must use the nonce - // corresponding to the published commitment. This API returns mutable local nonce bytes, - // so consume them after a successful signShare() call: later all-zero reuse fails closed. - nonces.hiding.fill(0); - nonces.binding.fill(0); - return r; - }, - // Each participant (or coordinator) can verify signatures from other participants - verifyShare(pub, commitmentList, msg, identifier, sigShare) { - if (opts.adjustPublic) - pub = opts.adjustPublic(pub); - const comm = commitmentList.find((i) => i.identifier === identifier); - if (!comm) - throw new Error('cannot find identifier commitment'); - const PK = parsePoint(pub.verifyingShares[identifier]); - const hidingNonceCommitment = parsePoint(comm.hiding); - const bindingNonceCommitment = parsePoint(comm.binding); - const { lambda, challenge, bindingFactor, groupCommitment } = prepareShare(pub.commitments[0], commitmentList, msg, identifier); - // hC + bC * bF - let commShare = hidingNonceCommitment.add(bindingNonceCommitment.multiply(bindingFactor)); - if (opts.adjustGroupCommitmentShare) - commShare = opts.adjustGroupCommitmentShare(groupCommitment, commShare); - const l = Point.BASE.multiply(Fn.fromBytes(sigShare)); // sigShare*G - // commShare + PK * (challenge * lambda) - const r = commShare.add(PK.multiply(Fn.mul(challenge, lambda))); - return l.equals(r); - }, - // Aggregate multiple signature shares into groupSignature - aggregate(pub, commitmentList, msg, sigShares) { - if (opts.adjustPublic) - pub = opts.adjustPublic(pub); - try { - validateCommitmentsNum(pub.signers, commitmentList.length); - } - catch { - throw new AggErr('aggregation failed', []); - } - const ids = commitmentList.map((i) => i.identifier); - if (ids.length !== Object.keys(sigShares).length) - throw new AggErr('aggregation failed', []); - for (const id of ids) { - if (!(id in sigShares) || !(id in pub.verifyingShares)) - throw new AggErr('aggregation failed', []); - } - const GPK = parsePoint(pub.commitments[0]); - const { groupCommitment } = getGroupCommitment(GPK, commitmentList, msg); - let z = Fn.ZERO; - // RFC 9591 Section 5.3 aggregates by summing the validated signature shares. - for (const id of ids) - z = Fn.add(z, Fn.fromBytes(sigShares[id])); // z += zi - if (!Basic.verify(msg, groupCommitment, z, GPK)) { - const cheaters = []; - for (const id of ids) { - if (!this.verifyShare(pub, commitmentList, msg, id, sigShares[id])) - cheaters.push(id); - } - throw new AggErr('aggregation failed', cheaters); - } - return Signature.encode(groupCommitment, z); - }, - // Basic sign/verify using single key - sign(msg, secretKey) { - let sk = Fn.fromBytes(secretKey); - // Taproot single-key signing needs the same scalar normalization as threshold keys. - if (opts.adjustScalar) - sk = opts.adjustScalar(sk); - const [R, z] = Basic.sign(msg, sk); - return Signature.encode(R, z); - }, - verify(sig, msg, publicKey) { - const PK = opts.parsePublicKey ? opts.parsePublicKey(publicKey) : parsePoint(publicKey); - const { R, z } = Signature.decode(sig); - return Basic.verify(msg, R, z, PK); - }, - // Combine multiple secret shares to restore secret - combineSecret(shares, signers) { - validateSigners(signers); - if (!Array.isArray(shares) || shares.length < signers.min) - throw new Error('wrong secret shares array'); - const points = []; - const seen = {}; - // Interpolate over the full provided share set and reject duplicate identifiers. - for (const s of shares) { - const idNum = parseIdentifier(s.identifier); - const id = serializeIdentifier(idNum); - if (seen[id]) - throw new Error('duplicated id=' + id); - seen[id] = true; - points.push([idNum, Fn.fromBytes(s.signingShare)]); - } - const xCoords = points.map(([x]) => x); - let res = Fn.ZERO; - for (const [x, y] of points) - res = Fn.add(res, Fn.mul(y, deriveInterpolatingValue(xCoords, x))); - return Fn.toBytes(res); - }, - // Utils - utils: Object.freeze({ - Fn, // NOTE: we re-export it here because it may be different from Point.Fn (ed448 is fun!) - // Test RNG overrides still go through noble's non-zero scalar derivation; this is not a raw - // "bytes become scalar" escape hatch. - randomScalar: (rng = randomBytes) => Fn.toBytes(genPointScalarPair(rng).scalar), - generateSecretPolynomial: (signers, secret, coeffs, rng) => { - const res = generateSecretPolynomial(signers, secret, coeffs, rng); - return { ...res, commitment: res.commitment.map(serializePoint) }; - }, - }), - }; - return Object.freeze(frost); -} -//# sourceMappingURL=frost.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/frost.js.map b/node_modules/@noble/curves/abstract/frost.js.map deleted file mode 100644 index 153db08..0000000 --- a/node_modules/@noble/curves/abstract/frost.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"frost.js","sourceRoot":"","sources":["../src/abstract/frost.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACL,UAAU,EACV,eAAe,EACf,eAAe,EACf,WAAW,EACX,UAAU,EACV,WAAW,EACX,cAAc,GAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAwC,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,IAAI,EAAqB,MAAM,UAAU,CAAC;AACnD,OAAO,EAAmB,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAe,MAAM,cAAc,CAAC;AAgV7E,wCAAwC;AACxC,yCAAyC;AAEzC,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC3C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,OAAO,CAAC,GAAG,GAAG,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACpF,+FAA+F;IAC/F,gFAAgF;IAChF,+FAA+F;IAC/F,yFAAyF;IACzF,IAAI,OAAO,CAAC,GAAG,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG;QACjE,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,OAAO,C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,QAAQ;QACR,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;YACnB,EAAE,EAAE,uFAAuF;YAC3F,4FAA4F;YAC5F,sCAAsC;YACtC,YAAY,EAAE,CAAC,MAAW,WAAW,EAAE,EAAE,CACvC,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,MAAM,CAAqB;YAChE,wBAAwB,EAAE,CACxB,OAAgB,EAChB,MAAyB,EACzB,MAAiB,EACjB,GAAS,EACT,EAAE;gBACF,MAAM,GAAG,GAAG,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;gBACnE,OAAO,EAAE,GAAG,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,CAAkB,EAAE,CAAC;YACrF,CAAC;SACF,CAAC;KACH,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAgB,CAAC;AAC7C,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/hash-to-curve.d.ts b/node_modules/@noble/curves/abstract/hash-to-curve.d.ts deleted file mode 100644 index 64e5d61..0000000 --- a/node_modules/@noble/curves/abstract/hash-to-curve.d.ts +++ /dev/null @@ -1,239 +0,0 @@ -/** - * hash-to-curve from RFC 9380. - * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F. - * https://www.rfc-editor.org/rfc/rfc9380 - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import type { CHash, TArg, TRet } from '../utils.ts'; -import type { AffinePoint, PC_ANY, PC_F, PC_P } from './curve.ts'; -import { type IField } from './modular.ts'; -/** ASCII domain-separation tag or raw bytes. */ -export type AsciiOrBytes = string | Uint8Array; -type H2CDefaults = { - DST: AsciiOrBytes; - expand: 'xmd' | 'xof'; - hash: CHash; - p: bigint; - m: number; - k: number; - encodeDST?: AsciiOrBytes; -}; -/** - * * `DST` is a domain separation tag, defined in section 2.2.5 - * * `p` characteristic of F, where F is a finite field of characteristic p and order q = p^m - * * `m` is extension degree (1 for prime fields) - * * `k` is the target security target in bits (e.g. 128), from section 5.1 - * * `expand` is `xmd` (SHA2, SHA3, BLAKE) or `xof` (SHAKE, BLAKE-XOF) - * * `hash` conforming to `utils.CHash` interface, with `outputLen` / `blockLen` props - */ -export type H2COpts = { - /** Domain separation tag. */ - DST: AsciiOrBytes; - /** Expander family used by RFC 9380. */ - expand: 'xmd' | 'xof'; - /** Hash or XOF implementation used by the expander. */ - hash: CHash; - /** Base-field characteristic. */ - p: bigint; - /** Extension degree (`1` for prime fields). */ - m: number; - /** Target security level in bits. */ - k: number; -}; -/** Hash-only subset of RFC 9380 options used by per-call overrides. */ -export type H2CHashOpts = { - /** Expander family used by RFC 9380. */ - expand: 'xmd' | 'xof'; - /** Hash or XOF implementation used by the expander. */ - hash: CHash; -}; -/** - * Map one hash-to-field output tuple onto affine curve coordinates. - * Implementations receive the validated scalar tuple by reference for performance and MUST treat it - * as read-only. Callers that need scratch space should copy before mutating. - * @param scalar - Field-element tuple produced by `hash_to_field`. - * @returns Affine point before subgroup clearing. - */ -export type MapToCurve = (scalar: bigint[]) => AffinePoint; -/** Per-call override for the domain-separation tag. */ -export type H2CDSTOpts = { - /** Domain-separation tag override. */ - DST: AsciiOrBytes; -}; -/** Base hash-to-curve helpers shared by `hashToCurve` and `encodeToCurve`. */ -export type H2CHasherBase = { - /** - * Hash arbitrary bytes to one curve point. - * @param msg - Input message bytes. - * @param options - Optional domain-separation override. See {@link H2CDSTOpts}. - * @returns Curve point after hash-to-curve. - */ - hashToCurve(msg: TArg, options?: TArg): PC_P; - /** - * Hash arbitrary bytes to one scalar. - * @param msg - Input message bytes. - * @param options - Optional domain-separation override. See {@link H2CDSTOpts}. - * @returns Scalar reduced into the target field. - */ - hashToScalar(msg: TArg, options?: TArg): bigint; - /** - * Derive one curve point from non-uniform bytes without the random-oracle - * guarantees of `hashToCurve`. - * Accepts the same arguments as `hashToCurve`, but runs the encode-to-curve - * path instead of the random-oracle construction. - */ - deriveToCurve?(msg: TArg, options?: TArg): PC_P; - /** Point constructor for the target curve. */ - Point: PC; -}; -/** - * RFC 9380 methods, with cofactor clearing. See {@link https://www.rfc-editor.org/rfc/rfc9380#section-3 | RFC 9380 section 3}. - * - * * hashToCurve: `map(hash(input))`, encodes RANDOM bytes to curve (WITH hashing) - * * encodeToCurve: `map(hash(input))`, encodes NON-UNIFORM bytes to curve (WITH hashing) - * * mapToCurve: `map(scalars)`, encodes NON-UNIFORM scalars to curve (NO hashing) - */ -export type H2CHasher = H2CHasherBase & { - /** - * Encode non-uniform bytes to one curve point. - * @param msg - Input message bytes. - * @param options - Optional domain-separation override. See {@link H2CDSTOpts}. - * @returns Curve point after encode-to-curve. - */ - encodeToCurve(msg: TArg, options?: TArg): PC_P; - /** Deterministic map from `hash_to_field` tuples into affine coordinates. */ - mapToCurve: MapToCurve>; - /** Default RFC 9380 options captured by this hasher bundle. */ - defaults: H2CDefaults; -}; -/** - * Produces a uniformly random byte string using a cryptographic hash - * function H that outputs b bits. - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1 | RFC 9380 section 5.3.1}. - * @param msg - Input message. - * @param DST - Domain separation tag. This helper normalizes DST, rejects empty DSTs, and - * oversize-hashes DST when needed. - * @param lenInBytes - Output length. - * @param H - Hash function. - * @returns Uniform byte string. - * @throws If the message, DST, hash, or output length is invalid. {@link Error} - * @example - * Expand one message into uniform bytes with the XMD construction. - * - * ```ts - * import { expand_message_xmd } from '@noble/curves/abstract/hash-to-curve.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const uniform = expand_message_xmd(new TextEncoder().encode('hello noble'), 'DST', 32, sha256); - * ``` - */ -export declare function expand_message_xmd(msg: TArg, DST: TArg, lenInBytes: number, H: TArg): TRet; -/** - * Produces a uniformly random byte string using an extendable-output function (XOF) H. - * 1. The collision resistance of H MUST be at least k bits. - * 2. H MUST be an XOF that has been proved indifferentiable from - * a random oracle under a reasonable cryptographic assumption. - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2 | RFC 9380 section 5.3.2}. - * @param msg - Input message. - * @param DST - Domain separation tag. This helper normalizes DST, rejects empty DSTs, and - * oversize-hashes DST when needed. - * @param lenInBytes - Output length. - * @param k - Target security level. - * @param H - XOF hash function. - * @returns Uniform byte string. - * @throws If the message, DST, XOF, or output length is invalid. {@link Error} - * @example - * Expand one message into uniform bytes with the XOF construction. - * - * ```ts - * import { expand_message_xof } from '@noble/curves/abstract/hash-to-curve.js'; - * import { shake256 } from '@noble/hashes/sha3.js'; - * const uniform = expand_message_xof( - * new TextEncoder().encode('hello noble'), - * 'DST', - * 32, - * 128, - * shake256 - * ); - * ``` - */ -export declare function expand_message_xof(msg: TArg, DST: TArg, lenInBytes: number, k: number, H: TArg): TRet; -/** - * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F. - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-5.2 | RFC 9380 section 5.2}. - * @param msg - Input message bytes. - * @param count - Number of field elements to derive. Must be `>= 1`. - * @param options - RFC 9380 options. See {@link H2COpts}. `m` must be `>= 1`. - * @returns `[u_0, ..., u_(count - 1)]`, a list of field elements. - * @throws If the expander choice or RFC 9380 options are invalid. {@link Error} - * @example - * Hash one message into field elements before mapping it onto a curve. - * - * ```ts - * import { hash_to_field } from '@noble/curves/abstract/hash-to-curve.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const scalars = hash_to_field(new TextEncoder().encode('hello noble'), 2, { - * DST: 'DST', - * p: 17n, - * m: 1, - * k: 128, - * expand: 'xmd', - * hash: sha256, - * }); - * ``` - */ -export declare function hash_to_field(msg: TArg, count: number, options: TArg): bigint[][]; -type XY = (x: T, y: T) => { - x: T; - y: T; -}; -type XYRatio = [T[], T[], T[], T[]]; -/** - * @param field - Field implementation. - * @param map - Isogeny coefficients. - * @returns Isogeny mapping helper. - * @example - * Build one rational isogeny map, then apply it to affine x/y coordinates. - * - * ```ts - * import { isogenyMap } from '@noble/curves/abstract/hash-to-curve.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const iso = isogenyMap(Fp, [[0n, 1n], [1n], [1n], [1n]]); - * const point = iso(3n, 5n); - * ``` - */ -export declare function isogenyMap>(field: F, map: XYRatio): XY; -export declare const _DST_scalar: "HashToScalar-"; -/** - * Creates hash-to-curve methods from EC Point and mapToCurve function. See {@link H2CHasher}. - * @param Point - Point constructor. - * @param mapToCurve - Map-to-curve function. - * @param defaults - Default hash-to-curve options. This object is frozen in place and reused as - * the shared defaults bundle for the returned helpers. - * @returns Hash-to-curve helper namespace. - * @throws If the map-to-curve callback or default hash-to-curve options are invalid. {@link Error} - * @example - * Bundle hash-to-curve, hash-to-scalar, and encode-to-curve helpers for one curve. - * - * ```ts - * import { createHasher } from '@noble/curves/abstract/hash-to-curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const hasher = createHasher(p256.Point, () => p256.Point.BASE.toAffine(), { - * DST: 'P256_XMD:SHA-256_SSWU_RO_', - * encodeDST: 'P256_XMD:SHA-256_SSWU_NU_', - * p: p256.Point.Fp.ORDER, - * m: 1, - * k: 128, - * expand: 'xmd', - * hash: sha256, - * }); - * const point = hasher.encodeToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export declare function createHasher(Point: PC, mapToCurve: MapToCurve>, defaults: TArg): H2CHasher; -export {}; -//# sourceMappingURL=hash-to-curve.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/hash-to-curve.d.ts.map b/node_modules/@noble/curves/abstract/hash-to-curve.d.ts.map deleted file mode 100644 index b6cd38f..0000000 --- a/node_modules/@noble/curves/abstract/hash-to-curve.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hash-to-curve.d.ts","sourceRoot":"","sources":["../src/abstract/hash-to-curve.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sEAA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AE,IAAI,CAAC,OAAO,GAAG;IAAE,SAAS,CAAC,EAAE,YAAY,CAAA;CAAE,CAAC,GACrD,SAAS,CAAC,EAAE,CAAC,CAyEf"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/hash-to-curve.js b/node_modules/@noble/curves/abstract/hash-to-curve.js deleted file mode 100644 index 0b45827..0000000 --- a/node_modules/@noble/curves/abstract/hash-to-curve.js +++ /dev/null @@ -1,346 +0,0 @@ -import { abytes, asafenumber, asciiToBytes, bytesToNumberBE, copyBytes, concatBytes, isBytes, validateObject, } from "../utils.js"; -import { FpInvertBatch, mod } from "./modular.js"; -// Octet Stream to Integer. "spec" implementation of os2ip is 2.5x slower vs bytesToNumberBE. -const os2ip = bytesToNumberBE; -// Integer to Octet Stream (numberToBytesBE). -function i2osp(value, length) { - asafenumber(value); - asafenumber(length); - // This helper stays on the JS bitwise/u32 fast-path. Callers that need wider encodings should - // use bigint + numberToBytesBE instead of routing large widths through this small helper. - if (length < 0 || length > 4) - throw new Error('invalid I2OSP length: ' + length); - if (value < 0 || value > 2 ** (8 * length) - 1) - throw new Error('invalid I2OSP input: ' + value); - const res = Array.from({ length }).fill(0); - for (let i = length - 1; i >= 0; i--) { - res[i] = value & 0xff; - value >>>= 8; - } - return new Uint8Array(res); -} -// RFC 9380 only applies strxor() to equal-length strings; callers must preserve that invariant. -function strxor(a, b) { - const arr = new Uint8Array(a.length); - for (let i = 0; i < a.length; i++) { - arr[i] = a[i] ^ b[i]; - } - return arr; -} -// User can always use utf8 if they want, by passing Uint8Array. -// If string is passed, we treat it as ASCII: other formats are likely a mistake. -function normDST(DST) { - if (!isBytes(DST) && typeof DST !== 'string') - throw new Error('DST must be Uint8Array or ascii string'); - const dst = typeof DST === 'string' ? asciiToBytes(DST) : DST; - // RFC 9380 §3.1 requirement 2: tags "MUST have nonzero length". - if (dst.length === 0) - throw new Error('DST must be non-empty'); - return dst; -} -/** - * Produces a uniformly random byte string using a cryptographic hash - * function H that outputs b bits. - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1 | RFC 9380 section 5.3.1}. - * @param msg - Input message. - * @param DST - Domain separation tag. This helper normalizes DST, rejects empty DSTs, and - * oversize-hashes DST when needed. - * @param lenInBytes - Output length. - * @param H - Hash function. - * @returns Uniform byte string. - * @throws If the message, DST, hash, or output length is invalid. {@link Error} - * @example - * Expand one message into uniform bytes with the XMD construction. - * - * ```ts - * import { expand_message_xmd } from '@noble/curves/abstract/hash-to-curve.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const uniform = expand_message_xmd(new TextEncoder().encode('hello noble'), 'DST', 32, sha256); - * ``` - */ -export function expand_message_xmd(msg, DST, lenInBytes, H) { - abytes(msg); - asafenumber(lenInBytes); - DST = normDST(DST); - // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 - if (DST.length > 255) - DST = H(concatBytes(asciiToBytes('H2C-OVERSIZE-DST-'), DST)); - const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; - const ell = Math.ceil(lenInBytes / b_in_bytes); - if (lenInBytes > 65535 || ell > 255) - throw new Error('expand_message_xmd: invalid lenInBytes'); - const DST_prime = concatBytes(DST, i2osp(DST.length, 1)); - const Z_pad = new Uint8Array(r_in_bytes); // RFC 9380: Z_pad = I2OSP(0, s_in_bytes) - const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str - const b = new Array(ell); - const b_0 = H(concatBytes(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); - b[0] = H(concatBytes(b_0, i2osp(1, 1), DST_prime)); - // `b[0]` already stores RFC `b_1`, so only derive `b_2..b_ell` here. The old `<= ell` - // loop computed one extra tail block, which was usually sliced away but broke at max `ell=255` - // by reaching `I2OSP(256, 1)`. - for (let i = 1; i < ell; i++) { - const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; - b[i] = H(concatBytes(...args)); - } - const pseudo_random_bytes = concatBytes(...b); - return pseudo_random_bytes.slice(0, lenInBytes); -} -/** - * Produces a uniformly random byte string using an extendable-output function (XOF) H. - * 1. The collision resistance of H MUST be at least k bits. - * 2. H MUST be an XOF that has been proved indifferentiable from - * a random oracle under a reasonable cryptographic assumption. - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2 | RFC 9380 section 5.3.2}. - * @param msg - Input message. - * @param DST - Domain separation tag. This helper normalizes DST, rejects empty DSTs, and - * oversize-hashes DST when needed. - * @param lenInBytes - Output length. - * @param k - Target security level. - * @param H - XOF hash function. - * @returns Uniform byte string. - * @throws If the message, DST, XOF, or output length is invalid. {@link Error} - * @example - * Expand one message into uniform bytes with the XOF construction. - * - * ```ts - * import { expand_message_xof } from '@noble/curves/abstract/hash-to-curve.js'; - * import { shake256 } from '@noble/hashes/sha3.js'; - * const uniform = expand_message_xof( - * new TextEncoder().encode('hello noble'), - * 'DST', - * 32, - * 128, - * shake256 - * ); - * ``` - */ -export function expand_message_xof(msg, DST, lenInBytes, k, H) { - abytes(msg); - asafenumber(lenInBytes); - DST = normDST(DST); - // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 - // RFC 9380 §5.3.3: DST = H("H2C-OVERSIZE-DST-" || a_very_long_DST, ceil(2 * k / 8)). - if (DST.length > 255) { - const dkLen = Math.ceil((2 * k) / 8); - DST = H.create({ dkLen }).update(asciiToBytes('H2C-OVERSIZE-DST-')).update(DST).digest(); - } - if (lenInBytes > 65535 || DST.length > 255) - throw new Error('expand_message_xof: invalid lenInBytes'); - return (H.create({ dkLen: lenInBytes }) - .update(msg) - .update(i2osp(lenInBytes, 2)) - // 2. DST_prime = DST || I2OSP(len(DST), 1) - .update(DST) - .update(i2osp(DST.length, 1)) - .digest()); -} -/** - * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F. - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-5.2 | RFC 9380 section 5.2}. - * @param msg - Input message bytes. - * @param count - Number of field elements to derive. Must be `>= 1`. - * @param options - RFC 9380 options. See {@link H2COpts}. `m` must be `>= 1`. - * @returns `[u_0, ..., u_(count - 1)]`, a list of field elements. - * @throws If the expander choice or RFC 9380 options are invalid. {@link Error} - * @example - * Hash one message into field elements before mapping it onto a curve. - * - * ```ts - * import { hash_to_field } from '@noble/curves/abstract/hash-to-curve.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const scalars = hash_to_field(new TextEncoder().encode('hello noble'), 2, { - * DST: 'DST', - * p: 17n, - * m: 1, - * k: 128, - * expand: 'xmd', - * hash: sha256, - * }); - * ``` - */ -export function hash_to_field(msg, count, options) { - validateObject(options, { - p: 'bigint', - m: 'number', - k: 'number', - hash: 'function', - }); - const { p, k, m, hash, expand, DST } = options; - asafenumber(hash.outputLen, 'valid hash'); - abytes(msg); - asafenumber(count); - // RFC 9380 §5.2 defines hash_to_field over a list of one or more field elements and requires - // extension degree `m >= 1`; rejecting here avoids degenerate `[]` / `[[]]` helper outputs. - if (count < 1) - throw new Error('hash_to_field: expected count >= 1'); - if (m < 1) - throw new Error('hash_to_field: expected m >= 1'); - const log2p = p.toString(2).length; - const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above - const len_in_bytes = count * m * L; - let prb; // pseudo_random_bytes - if (expand === 'xmd') { - prb = expand_message_xmd(msg, DST, len_in_bytes, hash); - } - else if (expand === 'xof') { - prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); - } - else if (expand === '_internal_pass') { - // for internal tests only - prb = msg; - } - else { - throw new Error('expand must be "xmd" or "xof"'); - } - const u = new Array(count); - for (let i = 0; i < count; i++) { - const e = new Array(m); - for (let j = 0; j < m; j++) { - const elm_offset = L * (j + i * m); - const tv = prb.subarray(elm_offset, elm_offset + L); - e[j] = mod(os2ip(tv), p); - } - u[i] = e; - } - return u; -} -/** - * @param field - Field implementation. - * @param map - Isogeny coefficients. - * @returns Isogeny mapping helper. - * @example - * Build one rational isogeny map, then apply it to affine x/y coordinates. - * - * ```ts - * import { isogenyMap } from '@noble/curves/abstract/hash-to-curve.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const iso = isogenyMap(Fp, [[0n, 1n], [1n], [1n], [1n]]); - * const point = iso(3n, 5n); - * ``` - */ -export function isogenyMap(field, map) { - // Make same order as in spec - const coeff = map.map((i) => Array.from(i).reverse()); - return (x, y) => { - const [xn, xd, yn, yd] = coeff.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i))); - // RFC 9380 §6.6.3 / Appendix E: denominator-zero exceptional cases must - // return the identity on E. - // Shipped Weierstrass consumers encode that affine identity as all-zero - // coordinates, so `passZero=true` intentionally collapses zero - // denominators to `{ x: 0, y: 0 }`. - const [xd_inv, yd_inv] = FpInvertBatch(field, [xd, yd], true); - x = field.mul(xn, xd_inv); // xNum / xDen - y = field.mul(y, field.mul(yn, yd_inv)); // y * (yNum / yDev) - return { x, y }; - }; -} -// Keep the shared DST removable when the selected bundle never hashes to scalar. -// Callers that need protocol-specific scalar domain separation must override this generic default. -// RFC 9497 §§4.1-4.5 use this ASCII prefix before appending the ciphersuite context string. -// Export a string instead of mutable bytes so callers cannot poison default hash-to-scalar behavior -// by mutating a shared Uint8Array in place. -export const _DST_scalar = 'HashToScalar-'; -/** - * Creates hash-to-curve methods from EC Point and mapToCurve function. See {@link H2CHasher}. - * @param Point - Point constructor. - * @param mapToCurve - Map-to-curve function. - * @param defaults - Default hash-to-curve options. This object is frozen in place and reused as - * the shared defaults bundle for the returned helpers. - * @returns Hash-to-curve helper namespace. - * @throws If the map-to-curve callback or default hash-to-curve options are invalid. {@link Error} - * @example - * Bundle hash-to-curve, hash-to-scalar, and encode-to-curve helpers for one curve. - * - * ```ts - * import { createHasher } from '@noble/curves/abstract/hash-to-curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const hasher = createHasher(p256.Point, () => p256.Point.BASE.toAffine(), { - * DST: 'P256_XMD:SHA-256_SSWU_RO_', - * encodeDST: 'P256_XMD:SHA-256_SSWU_NU_', - * p: p256.Point.Fp.ORDER, - * m: 1, - * k: 128, - * expand: 'xmd', - * hash: sha256, - * }); - * const point = hasher.encodeToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export function createHasher(Point, mapToCurve, defaults) { - if (typeof mapToCurve !== 'function') - throw new Error('mapToCurve() must be defined'); - // `Point` is intentionally not shape-validated eagerly here: point constructors vary across - // curve families, so this helper only checks the hooks it can validate cheaply. Misconfigured - // suites fail later when hashing first touches Point.fromAffine / Point.ZERO / clearCofactor(). - const snapshot = (src) => Object.freeze({ - ...src, - DST: isBytes(src.DST) ? copyBytes(src.DST) : src.DST, - ...(src.encodeDST === undefined - ? {} - : { encodeDST: isBytes(src.encodeDST) ? copyBytes(src.encodeDST) : src.encodeDST }), - }); - // Keep one private defaults snapshot for actual hashing and expose fresh - // detached snapshots via the public getter. - // Otherwise a caller could mutate `hasher.defaults.DST` in place and poison - // the singleton hasher for every other consumer in the same process. - const safeDefaults = snapshot(defaults); - function map(num) { - return Point.fromAffine(mapToCurve(num)); - } - function clear(initial) { - const P = initial.clearCofactor(); - // Keep ZERO as the algebraic cofactor-clearing result here; strict public point-validity - // surfaces may still reject it later, but createHasher.clear() itself is not that boundary. - if (P.equals(Point.ZERO)) - return Point.ZERO; - P.assertValidity(); - return P; - } - return Object.freeze({ - get defaults() { - return snapshot(safeDefaults); - }, - Point, - hashToCurve(msg, options) { - const opts = Object.assign({}, safeDefaults, options); - const u = hash_to_field(msg, 2, opts); - const u0 = map(u[0]); - const u1 = map(u[1]); - return clear(u0.add(u1)); - }, - encodeToCurve(msg, options) { - const optsDst = safeDefaults.encodeDST ? { DST: safeDefaults.encodeDST } : {}; - const opts = Object.assign({}, safeDefaults, optsDst, options); - const u = hash_to_field(msg, 1, opts); - const u0 = map(u[0]); - return clear(u0); - }, - /** See {@link H2CHasher} */ - mapToCurve(scalars) { - // Curves with m=1 accept only single scalar - if (safeDefaults.m === 1) { - if (typeof scalars !== 'bigint') - throw new Error('expected bigint (m=1)'); - return clear(map([scalars])); - } - if (!Array.isArray(scalars)) - throw new Error('expected array of bigints'); - for (const i of scalars) - if (typeof i !== 'bigint') - throw new Error('expected array of bigints'); - return clear(map(scalars)); - }, - // hash_to_scalar can produce 0: https://www.rfc-editor.org/errata/eid8393 - // RFC 9380, draft-irtf-cfrg-bbs-signatures-08. Default scalar DST is the shared generic - // `HashToScalar-` prefix above unless the caller overrides it per invocation. - hashToScalar(msg, options) { - // @ts-ignore - const N = Point.Fn.ORDER; - const opts = Object.assign({}, safeDefaults, { p: N, m: 1, DST: _DST_scalar }, options); - return hash_to_field(msg, 1, opts)[0][0]; - }, - }); -} -//# sourceMappingURL=hash-to-curve.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/hash-to-curve.js.map b/node_modules/@noble/curves/abstract/hash-to-curve.js.map deleted file mode 100644 index b1b9b28..0000000 --- a/node_modules/@noble/curves/abstract/hash-to-curve.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hash-to-curve.js","sourceRoot":"","sources":["../src/abstract/hash-to-curve.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,MAAM,EACN,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,WAAW,EACX,OAAO,EACP,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,aAAa,EAAE,GAAG,EAAe,MAAM,cAAc,CAAC;AA0G/D,6FAA6F;AAC7F,MAAM,KAAK,GAAG,eAAe,CAAC;AAE9B,6CAA6C;AAC7C,SAAS,KAAK,CAAC,KAAa,EAAE,MAAc;IAC1C,WAAW,CAAC,KAAK,CAAC,CAAC;IACnB,WAAW,CAAC,MAAM,CAAC,CAAC;IACpB,8FAA8F;IAC9F,0FAA0F;IAC1F,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,MAAM,CAAC,CAAC;IACjF,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,C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AA4B;QAC5B,UAAU,CAAC,OAA0B;YACnC,4CAA4C;YAC5C,IAAI,YAAY,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,IAAI,OAAO,OAAO,KAAK,QAAQ;oBAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;gBAC1E,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC/B,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAC1E,KAAK,MAAM,CAAC,IAAI,OAAO;gBACrB,IAAI,OAAO,CAAC,KAAK,QAAQ;oBAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAC1E,OAAO,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7B,CAAC;QAED,0EAA0E;QAC1E,wFAAwF;QACxF,8EAA8E;QAC9E,YAAY,CAAC,GAAqB,EAAE,OAA0B;YAC5D,aAAa;YACb,MAAM,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;YACzB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;YACxF,OAAO,aAAa,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/modular.d.ts b/node_modules/@noble/curves/abstract/modular.d.ts deleted file mode 100644 index af8d1b5..0000000 --- a/node_modules/@noble/curves/abstract/modular.d.ts +++ /dev/null @@ -1,551 +0,0 @@ -/** - * Utils for modular division and fields. - * Field over 11 is a finite (Galois) field is integer number operations `mod 11`. - * There is no division: it is replaced by modular multiplicative inverse. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { type TArg, type TRet } from '../utils.ts'; -/** - * @param a - Dividend value. - * @param b - Positive modulus. - * @returns Reduced value in `[0, b)` only when `b` is positive. - * @throws If the modulus is not positive. {@link Error} - * @example - * Normalize a bigint into one field residue. - * - * ```ts - * mod(-1n, 5n); - * ``` - */ -export declare function mod(a: bigint, b: bigint): bigint; -/** - * Efficiently raise num to a power with modular reduction. - * Unsafe in some contexts: uses ladder, so can expose bigint bits. - * Low-level helper: callers that need canonical residues must pass a valid `num` for the chosen - * modulus instead of relying on the `power===0/1` fast paths to normalize it. - * @param num - Base value. - * @param power - Exponent value. - * @param modulo - Reduction modulus. - * @returns Modular exponentiation result. - * @throws If the modulus or exponent is invalid. {@link Error} - * @example - * Raise one bigint to a modular power. - * - * ```ts - * pow(2n, 6n, 11n) // 64n % 11n == 9n - * ``` - */ -export declare function pow(num: bigint, power: bigint, modulo: bigint): bigint; -/** - * Does `x^(2^power)` mod p. `pow2(30, 4)` == `30^(2^4)`. - * Low-level helper: callers that need canonical residues must pass a valid `x` for the chosen - * modulus; the `power===0` fast path intentionally returns the input unchanged. - * @param x - Base value. - * @param power - Number of squarings. - * @param modulo - Reduction modulus. - * @returns Repeated-squaring result. - * @throws If the exponent is negative. {@link Error} - * @example - * Apply repeated squaring inside one field. - * - * ```ts - * pow2(3n, 2n, 11n); - * ``` - */ -export declare function pow2(x: bigint, power: bigint, modulo: bigint): bigint; -/** - * Inverses number over modulo. - * Implemented using the {@link https://brilliant.org/wiki/extended-euclidean-algorithm/ | extended Euclidean algorithm}. - * @param number - Value to invert. - * @param modulo - Positive modulus. - * @returns Multiplicative inverse. - * @throws If the modulus is invalid or the inverse does not exist. {@link Error} - * @example - * Compute one modular inverse with the extended Euclidean algorithm. - * - * ```ts - * invert(3n, 11n); - * ``` - */ -export declare function invert(number: bigint, modulo: bigint): bigint; -/** - * Tonelli-Shanks square root search algorithm. - * This implementation is variable-time: it searches data-dependently for the first non-residue `Z` - * and for the smallest `i` in the main loop, unlike RFC 9380 Appendix I.4's constant-time shape. - * 1. {@link https://eprint.iacr.org/2012/685.pdf | eprint 2012/685}, page 12 - * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks - * @param P - field order - * @returns function that takes field Fp (created from P) and number n - * @throws If the field is too small, non-prime, or the square root does not exist. {@link Error} - * @example - * Construct a square-root helper for primes that need Tonelli-Shanks. - * - * ```ts - * import { Field, tonelliShanks } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const sqrt = tonelliShanks(17n)(Fp, 4n); - * ``` - */ -export declare function tonelliShanks(P: bigint): TRet<((Fp: IField, n: T) => T)>; -/** - * Square root for a finite field. Will try optimized versions first: - * - * 1. P ≡ 3 (mod 4) - * 2. P ≡ 5 (mod 8) - * 3. P ≡ 9 (mod 16) - * 4. Tonelli-Shanks algorithm - * - * Different algorithms can give different roots, it is up to user to decide which one they want. - * For example there is FpSqrtOdd/FpSqrtEven to choose a root by oddness - * (used for hash-to-curve). - * @param P - Field order. - * @returns Square-root helper. The generic fallback inherits Tonelli-Shanks' variable-time - * behavior and this selector assumes prime-field-style integer moduli. - * @throws If the field is unsupported or the square root does not exist. {@link Error} - * @example - * Choose the square-root helper appropriate for one field modulus. - * - * ```ts - * import { Field, FpSqrt } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const sqrt = FpSqrt(17n)(Fp, 4n); - * ``` - */ -export declare function FpSqrt(P: bigint): TRet<((Fp: IField, n: T) => T)>; -/** - * @param num - Value to inspect. - * @param modulo - Field modulus. - * @returns `true` when the least-significant little-endian bit is set. - * @throws If the modulus is invalid for `mod(...)`. {@link Error} - * @example - * Inspect the low bit used by little-endian sign conventions. - * - * ```ts - * isNegativeLE(3n, 11n); - * ``` - */ -export declare const isNegativeLE: (num: bigint, modulo: bigint) => boolean; -/** Generic field interface used by prime and extension fields alike. - * Generic helpers treat field operations as pure functions: implementations MUST treat provided - * values/byte buffers as read-only and return detached results instead of mutating arguments. - */ -export interface IField { - /** Field order `q`, which may be prime or a prime power. */ - ORDER: bigint; - /** Canonical encoded byte length. */ - BYTES: number; - /** Canonical encoded bit length. */ - BITS: number; - /** Whether encoded field elements use little-endian bytes. */ - isLE: boolean; - /** Additive identity. */ - ZERO: T; - /** Multiplicative identity. */ - ONE: T; - /** - * Normalize one value into the field. - * @param num - Input value. - * @returns Normalized field value. - */ - create: (num: T) => T; - /** - * Check whether one value already belongs to the field. - * @param num - Input value. - * Implementations may throw `TypeError` on malformed input types instead of returning `false`. - * @returns Whether the value already belongs to the field. - */ - isValid: (num: T) => boolean; - /** - * Check whether one value is zero. - * @param num - Input value. - * @returns Whether the value is zero. - */ - is0: (num: T) => boolean; - /** - * Check whether one value is non-zero and belongs to the field. - * @param num - Input value. - * Implementations may throw `TypeError` on malformed input types instead of returning `false`. - * @returns Whether the value is non-zero and valid. - */ - isValidNot0: (num: T) => boolean; - /** - * Negate one value. - * @param num - Input value. - * @returns Negated value. - */ - neg(num: T): T; - /** - * Invert one value multiplicatively. - * @param num - Input value. - * @returns Multiplicative inverse. - */ - inv(num: T): T; - /** - * Compute one square root when it exists. - * @param num - Input value. - * @returns Square root. - */ - sqrt(num: T): T; - /** - * Square one value. - * @param num - Input value. - * @returns Squared value. - */ - sqr(num: T): T; - /** - * Compare two field values. - * @param lhs - Left value. - * @param rhs - Right value. - * @returns Whether both values are equal. - */ - eql(lhs: T, rhs: T): boolean; - /** - * Add two normalized field values. - * @param lhs - Left value. - * @param rhs - Right value. - * @returns Sum value. - */ - add(lhs: T, rhs: T): T; - /** - * Subtract two normalized field values. - * @param lhs - Left value. - * @param rhs - Right value. - * @returns Difference value. - */ - sub(lhs: T, rhs: T): T; - /** - * Multiply two field values. - * @param lhs - Left value. - * @param rhs - Right value or scalar. - * @returns Product value. - */ - mul(lhs: T, rhs: T | bigint): T; - /** - * Raise one field value to a power. - * @param lhs - Base value. - * @param power - Exponent. - * @returns Power value. - */ - pow(lhs: T, power: bigint): T; - /** - * Divide one field value by another. - * @param lhs - Dividend. - * @param rhs - Divisor or scalar. - * @returns Quotient value. - */ - div(lhs: T, rhs: T | bigint): T; - /** - * Add two values without re-normalizing the result. - * @param lhs - Left value. - * @param rhs - Right value. - * @returns Non-normalized sum. - */ - addN(lhs: T, rhs: T): T; - /** - * Subtract two values without re-normalizing the result. - * @param lhs - Left value. - * @param rhs - Right value. - * @returns Non-normalized difference. - */ - subN(lhs: T, rhs: T): T; - /** - * Multiply two values without re-normalizing the result. - * @param lhs - Left value. - * @param rhs - Right value or scalar. - * @returns Non-normalized product. - */ - mulN(lhs: T, rhs: T | bigint): T; - /** - * Square one value without re-normalizing the result. - * @param num - Input value. - * @returns Non-normalized square. - */ - sqrN(num: T): T; - /** - * Return the RFC 9380 `sgn0`-style oddness bit when supported. - * This uses oddness instead of evenness so extension fields like Fp2 can expose the same hook. - * Returns whether the value is odd under the field encoding. - */ - isOdd?(num: T): boolean; - /** - * Invert many field elements in one batch. - * @param lst - Values to invert. - * @returns Batch of inverses. - */ - invertBatch: (lst: T[]) => T[]; - /** - * Encode one field value into fixed-width bytes. - * Callers that need canonical encodings MUST supply a valid field element. - * Low-level protocols may also use this to serialize raw / non-canonical residues. - * @param num - Input value. - * @returns Fixed-width byte encoding. - */ - toBytes(num: T): Uint8Array; - /** - * Decode one field value from fixed-width bytes. - * @param bytes - Fixed-width byte encoding. - * @param skipValidation - Whether to skip range validation. - * Implementations MUST treat `bytes` as read-only. - * @returns Decoded field value. - */ - fromBytes(bytes: Uint8Array, skipValidation?: boolean): T; - /** - * Constant-time conditional move. - * @param a - Value used when the condition is false. - * @param b - Value used when the condition is true. - * @param c - Selection bit. - * @returns Selected value. - */ - cmov(a: T, b: T, c: boolean): T; -} -/** - * @param field - Field implementation. - * @returns Validated field. This only checks the arithmetic subset needed by generic helpers; it - * does not guarantee full runtime-method coverage for serialization, batching, `cmov`, or - * field-specific extras beyond positive `BYTES` / `BITS`. - * @throws If the field shape or numeric metadata are invalid. {@link Error} - * @example - * Check that a field implementation exposes the operations curve code expects. - * - * ```ts - * import { Field, validateField } from '@noble/curves/abstract/modular.js'; - * const Fp = validateField(Field(17n)); - * ``` - */ -export declare function validateField(field: TArg>): TRet>; -/** - * Same as `pow` but for Fp: non-constant-time. - * Unsafe in some contexts: uses ladder, so can expose bigint bits. - * @param Fp - Field implementation. - * @param num - Base value. - * @param power - Exponent value. - * @returns Powered field element. - * @throws If the exponent is negative. {@link Error} - * @example - * Raise one field element to a public exponent. - * - * ```ts - * import { Field, FpPow } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const x = FpPow(Fp, 3n, 5n); - * ``` - */ -export declare function FpPow(Fp: TArg>, num: T, power: bigint): T; -/** - * Efficiently invert an array of Field elements. - * Exception-free. Zero-valued field elements stay `undefined` unless `passZero` is enabled. - * @param Fp - Field implementation. - * @param nums - Values to invert. - * @param passZero - map 0 to 0 (instead of undefined) - * @returns Inverted values. - * @example - * Invert several field elements with one shared inversion. - * - * ```ts - * import { Field, FpInvertBatch } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const inv = FpInvertBatch(Fp, [1n, 2n, 4n]); - * ``` - */ -export declare function FpInvertBatch(Fp: TArg>, nums: T[], passZero?: boolean): T[]; -/** - * @param Fp - Field implementation. - * @param lhs - Dividend value. - * @param rhs - Divisor value. - * @returns Division result. - * @throws If the divisor is non-invertible. {@link Error} - * @example - * Divide one field element by another. - * - * ```ts - * import { Field, FpDiv } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const x = FpDiv(Fp, 6n, 3n); - * ``` - */ -export declare function FpDiv(Fp: TArg>, lhs: T, rhs: T | bigint): T; -/** - * Legendre symbol. - * Legendre constant is used to calculate Legendre symbol (a | p) - * which denotes the value of a^((p-1)/2) (mod p). - * - * * (a | p) ≡ 1 if a is a square (mod p), quadratic residue - * * (a | p) ≡ -1 if a is not a square (mod p), quadratic non residue - * * (a | p) ≡ 0 if a ≡ 0 (mod p) - * @param Fp - Field implementation. - * @param n - Value to inspect. - * @returns Legendre symbol. - * @throws If the field returns an invalid Legendre symbol value. {@link Error} - * @example - * Compute the Legendre symbol of one field element. - * - * ```ts - * import { Field, FpLegendre } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const symbol = FpLegendre(Fp, 4n); - * ``` - */ -export declare function FpLegendre(Fp: TArg>, n: T): -1 | 0 | 1; -/** - * @param Fp - Field implementation. - * @param n - Value to inspect. - * @returns `true` when `Fp.sqrt(n)` exists. This includes `0`, even though strict "quadratic - * residue" terminology often reserves that name for the non-zero square class. - * @throws If the field returns an invalid Legendre symbol value. {@link Error} - * @example - * Check whether one field element has a square root in the field. - * - * ```ts - * import { Field, FpIsSquare } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const isSquare = FpIsSquare(Fp, 4n); - * ``` - */ -export declare function FpIsSquare(Fp: TArg>, n: T): boolean; -/** Byte and bit lengths derived from one scalar order. */ -export type NLength = { - /** Canonical byte length. */ - nByteLength: number; - /** Canonical bit length. */ - nBitLength: number; -}; -/** - * @param n - Curve order. Callers are expected to pass a positive order. - * @param nBitLength - Optional cached bit length. Callers are expected to pass a positive cached - * value when overriding the derived bit length. - * @returns Byte and bit lengths. - * @throws If the order or cached bit length is invalid. {@link Error} - * @example - * Measure the encoding sizes needed for one modulus. - * - * ```ts - * nLength(255n); - * ``` - */ -export declare function nLength(n: bigint, nBitLength?: number): NLength; -type FpField = IField & Required, 'isOdd'>>; -type SqrtFn = (n: bigint) => bigint; -type FieldOpts = Partial<{ - isLE: boolean; - BITS: number; - sqrt: SqrtFn; - allowedLengths?: readonly number[]; - modFromBytes: boolean; -}>; -/** - * Creates a finite field. Major performance optimizations: - * * 1. Denormalized operations like mulN instead of mul. - * * 2. Identical object shape: never add or remove keys. - * * 3. Frozen stable object shape; the lazy sqrt cache lives in a module-level `WeakMap`. - * Fragile: always run a benchmark on a change. - * Security note: operations and low-level serializers like `toBytes` don't check `isValid` for - * all elements for performance and protocol-flexibility reasons; callers are responsible for - * supplying valid elements when they need canonical field behavior. - * This is low-level code, please make sure you know what you're doing. - * - * Note about field properties: - * * CHARACTERISTIC p = prime number, number of elements in main subgroup. - * * ORDER q = similar to cofactor in curves, may be composite `q = p^m`. - * - * @param ORDER - field order, probably prime, or could be composite - * @param opts - Field options such as bit length or endianness. See {@link FieldOpts}. - * @returns Frozen field instance with a stable object shape. This wrapper forwards `opts` straight - * into `_Field`, so it inherits `_Field`'s assumptions about cached sizes and `allowedLengths`. - * @example - * Construct one prime field with optional overrides. - * - * ```ts - * Field(11n); - * ``` - */ -export declare function Field(ORDER: bigint, opts?: FieldOpts): TRet>; -/** - * @param Fp - Field implementation. - * @param elm - Value to square-root. - * @returns Odd square root when two roots exist. The special case `elm = 0` still returns `0`, - * which is the only square root but is not odd. - * @throws If the field lacks oddness checks or the square root does not exist. {@link Error} - * @example - * Select the odd square root when two roots exist. - * - * ```ts - * import { Field, FpSqrtOdd } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const root = FpSqrtOdd(Fp, 4n); - * ``` - */ -export declare function FpSqrtOdd(Fp: TArg>, elm: T): T; -/** - * @param Fp - Field implementation. - * @param elm - Value to square-root. - * @returns Even square root. - * @throws If the field lacks oddness checks or the square root does not exist. {@link Error} - * @example - * Select the even square root when two roots exist. - * - * ```ts - * import { Field, FpSqrtEven } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const root = FpSqrtEven(Fp, 4n); - * ``` - */ -export declare function FpSqrtEven(Fp: TArg>, elm: T): T; -/** - * Returns total number of bytes consumed by the field element. - * For example, 32 bytes for usual 256-bit weierstrass curve. - * @param fieldOrder - number of field elements, usually CURVE.n. Callers are expected to pass an - * order greater than 1. - * @returns byte length of field - * @throws If the field order is not a bigint. {@link Error} - * @example - * Read the fixed-width byte length of one field. - * - * ```ts - * getFieldBytesLength(255n); - * ``` - */ -export declare function getFieldBytesLength(fieldOrder: bigint): number; -/** - * Returns minimal amount of bytes that can be safely reduced - * by field order. - * Should be 2^-128 for 128-bit curve such as P256. - * This is the reduction / modulo-bias lower bound; higher-level helpers may still impose a larger - * absolute floor for policy reasons. - * @param fieldOrder - number of field elements greater than 1, usually CURVE.n. - * @returns byte length of target hash - * @throws If the field order is invalid. {@link Error} - * @example - * Compute the minimum hash length needed for field reduction. - * - * ```ts - * getMinHashLength(255n); - * ``` - */ -export declare function getMinHashLength(fieldOrder: bigint): number; -/** - * "Constant-time" private key generation utility. - * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF - * and convert them into private scalar, with the modulo bias being negligible. - * Needs at least 48 bytes of input for 32-byte private key. The implementation also keeps a hard - * 16-byte minimum even when `getMinHashLength(...)` is smaller, so toy-small inputs do not look - * accidentally acceptable for real scalar derivation. - * See {@link https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ | Kudelski's modulo-bias guide}, - * {@link https://csrc.nist.gov/publications/detail/fips/186/5/final | FIPS 186-5 appendix A.2}, and - * {@link https://www.rfc-editor.org/rfc/rfc9380#section-5 | RFC 9380 section 5}. Unlike RFC 9380 - * `hash_to_field`, this helper intentionally maps into the non-zero private-scalar range `1..n-1`. - * @param key - Uniform input bytes. - * @param fieldOrder - Size of subgroup. - * @param isLE - interpret hash bytes as LE num - * @returns valid private scalar - * @throws If the hash length or field order is invalid for scalar reduction. {@link Error} - * @example - * Map hash output into a private scalar range. - * - * ```ts - * mapHashToField(new Uint8Array(48).fill(1), 255n); - * ``` - */ -export declare function mapHashToField(key: TArg, fieldOrder: bigint, isLE?: boolean): TRet; -export {}; -//# sourceMappingURL=modular.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/modular.d.ts.map b/node_modules/@noble/curves/abstract/modular.d.ts.map deleted file mode 100644 index 0225247..0000000 --- a/node_modules/@noble/curves/abstract/modular.d.ts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\ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/modular.js b/node_modules/@noble/curves/abstract/modular.js deleted file mode 100644 index 157f239..0000000 --- a/node_modules/@noble/curves/abstract/modular.js +++ /dev/null @@ -1,850 +0,0 @@ -/** - * Utils for modular division and fields. - * Field over 11 is a finite (Galois) field is integer number operations `mod 11`. - * There is no division: it is replaced by modular multiplicative inverse. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { abool, abytes, anumber, asafenumber, bitLen, bytesToNumberBE, bytesToNumberLE, numberToBytesBE, numberToBytesLE, validateObject, } from "../utils.js"; -// Numbers aren't used in x25519 / x448 builds -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2); -// prettier-ignore -const _3n = /* @__PURE__ */ BigInt(3), _4n = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5); -// prettier-ignore -const _7n = /* @__PURE__ */ BigInt(7), _8n = /* @__PURE__ */ BigInt(8), _9n = /* @__PURE__ */ BigInt(9); -const _16n = /* @__PURE__ */ BigInt(16); -/** - * @param a - Dividend value. - * @param b - Positive modulus. - * @returns Reduced value in `[0, b)` only when `b` is positive. - * @throws If the modulus is not positive. {@link Error} - * @example - * Normalize a bigint into one field residue. - * - * ```ts - * mod(-1n, 5n); - * ``` - */ -export function mod(a, b) { - if (b <= _0n) - throw new Error('mod: expected positive modulus, got ' + b); - const result = a % b; - return result >= _0n ? result : b + result; -} -/** - * Efficiently raise num to a power with modular reduction. - * Unsafe in some contexts: uses ladder, so can expose bigint bits. - * Low-level helper: callers that need canonical residues must pass a valid `num` for the chosen - * modulus instead of relying on the `power===0/1` fast paths to normalize it. - * @param num - Base value. - * @param power - Exponent value. - * @param modulo - Reduction modulus. - * @returns Modular exponentiation result. - * @throws If the modulus or exponent is invalid. {@link Error} - * @example - * Raise one bigint to a modular power. - * - * ```ts - * pow(2n, 6n, 11n) // 64n % 11n == 9n - * ``` - */ -export function pow(num, power, modulo) { - return FpPow(Field(modulo), num, power); -} -/** - * Does `x^(2^power)` mod p. `pow2(30, 4)` == `30^(2^4)`. - * Low-level helper: callers that need canonical residues must pass a valid `x` for the chosen - * modulus; the `power===0` fast path intentionally returns the input unchanged. - * @param x - Base value. - * @param power - Number of squarings. - * @param modulo - Reduction modulus. - * @returns Repeated-squaring result. - * @throws If the exponent is negative. {@link Error} - * @example - * Apply repeated squaring inside one field. - * - * ```ts - * pow2(3n, 2n, 11n); - * ``` - */ -export function pow2(x, power, modulo) { - if (power < _0n) - throw new Error('pow2: expected non-negative exponent, got ' + power); - let res = x; - while (power-- > _0n) { - res *= res; - res %= modulo; - } - return res; -} -/** - * Inverses number over modulo. - * Implemented using the {@link https://brilliant.org/wiki/extended-euclidean-algorithm/ | extended Euclidean algorithm}. - * @param number - Value to invert. - * @param modulo - Positive modulus. - * @returns Multiplicative inverse. - * @throws If the modulus is invalid or the inverse does not exist. {@link Error} - * @example - * Compute one modular inverse with the extended Euclidean algorithm. - * - * ```ts - * invert(3n, 11n); - * ``` - */ -export function invert(number, modulo) { - if (number === _0n) - throw new Error('invert: expected non-zero number'); - if (modulo <= _0n) - throw new Error('invert: expected positive modulus, got ' + modulo); - // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower. - let a = mod(number, modulo); - let b = modulo; - // prettier-ignore - let x = _0n, y = _1n, u = _1n, v = _0n; - while (a !== _0n) { - const q = b / a; - const r = b - a * q; - const m = x - u * q; - const n = y - v * q; - // prettier-ignore - b = a, a = r, x = u, y = v, u = m, v = n; - } - const gcd = b; - if (gcd !== _1n) - throw new Error('invert: does not exist'); - return mod(x, modulo); -} -function assertIsSquare(Fp, root, n) { - const F = Fp; - if (!F.eql(F.sqr(root), n)) - throw new Error('Cannot find square root'); -} -// Not all roots are possible! Example which will throw: -// const NUM = -// n = 72057594037927816n; -// Fp = Field(BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab')); -function sqrt3mod4(Fp, n) { - const F = Fp; - const p1div4 = (F.ORDER + _1n) / _4n; - const root = F.pow(n, p1div4); - assertIsSquare(F, root, n); - return root; -} -// Equivalent `q = 5 (mod 8)` square-root formula (Atkin-style), not the RFC Appendix I.2 CMOV -// pseudocode verbatim. -function sqrt5mod8(Fp, n) { - const F = Fp; - const p5div8 = (F.ORDER - _5n) / _8n; - const n2 = F.mul(n, _2n); - const v = F.pow(n2, p5div8); - const nv = F.mul(n, v); - const i = F.mul(F.mul(nv, _2n), v); - const root = F.mul(nv, F.sub(i, F.ONE)); - assertIsSquare(F, root, n); - return root; -} -// Based on RFC9380, Kong algorithm -// prettier-ignore -function sqrt9mod16(P) { - const Fp_ = Field(P); - const tn = tonelliShanks(P); - const c1 = tn(Fp_, Fp_.neg(Fp_.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F - const c2 = tn(Fp_, c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F - const c3 = tn(Fp_, Fp_.neg(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F - const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic - return ((Fp, n) => { - const F = Fp; - let tv1 = F.pow(n, c4); // 1. tv1 = x^c4 - let tv2 = F.mul(tv1, c1); // 2. tv2 = c1 * tv1 - const tv3 = F.mul(tv1, c2); // 3. tv3 = c2 * tv1 - const tv4 = F.mul(tv1, c3); // 4. tv4 = c3 * tv1 - const e1 = F.eql(F.sqr(tv2), n); // 5. e1 = (tv2^2) == x - const e2 = F.eql(F.sqr(tv3), n); // 6. e2 = (tv3^2) == x - tv1 = F.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x - tv2 = F.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x - const e3 = F.eql(F.sqr(tv2), n); // 9. e3 = (tv2^2) == x - const root = F.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select sqrt from tv1 & tv2 - assertIsSquare(F, root, n); - return root; - }); -} -/** - * Tonelli-Shanks square root search algorithm. - * This implementation is variable-time: it searches data-dependently for the first non-residue `Z` - * and for the smallest `i` in the main loop, unlike RFC 9380 Appendix I.4's constant-time shape. - * 1. {@link https://eprint.iacr.org/2012/685.pdf | eprint 2012/685}, page 12 - * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks - * @param P - field order - * @returns function that takes field Fp (created from P) and number n - * @throws If the field is too small, non-prime, or the square root does not exist. {@link Error} - * @example - * Construct a square-root helper for primes that need Tonelli-Shanks. - * - * ```ts - * import { Field, tonelliShanks } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const sqrt = tonelliShanks(17n)(Fp, 4n); - * ``` - */ -export function tonelliShanks(P) { - // Initialization (precomputation). - // Caching initialization could boost perf by 7%. - if (P < _3n) - throw new Error('sqrt is not defined for small field'); - // Factor P - 1 = Q * 2^S, where Q is odd - let Q = P - _1n; - let S = 0; - while (Q % _2n === _0n) { - Q /= _2n; - S++; - } - // Find the first quadratic non-residue Z >= 2 - let Z = _2n; - const _Fp = Field(P); - while (FpLegendre(_Fp, Z) === 1) { - // Basic primality test for P. After x iterations, chance of - // not finding quadratic non-residue is 2^x, so 2^1000. - if (Z++ > 1000) - throw new Error('Cannot find square root: probably non-prime P'); - } - // Fast-path; usually done before Z, but we do "primality test". - if (S === 1) - return sqrt3mod4; - // Slow-path - // TODO: test on Fp2 and others - let cc = _Fp.pow(Z, Q); // c = z^Q - const Q1div2 = (Q + _1n) / _2n; - return function tonelliSlow(Fp, n) { - const F = Fp; - if (F.is0(n)) - return n; - // Check if n is a quadratic residue using Legendre symbol - if (FpLegendre(F, n) !== 1) - throw new Error('Cannot find square root'); - // Initialize variables for the main loop - let M = S; - let c = F.mul(F.ONE, cc); // c = z^Q, move cc from field _Fp into field Fp - let t = F.pow(n, Q); // t = n^Q, first guess at the fudge factor - let R = F.pow(n, Q1div2); // R = n^((Q+1)/2), first guess at the square root - // Main loop - // while t != 1 - while (!F.eql(t, F.ONE)) { - if (F.is0(t)) - return F.ZERO; // if t=0 return R=0 - let i = 1; - // Find the smallest i >= 1 such that t^(2^i) ≡ 1 (mod P) - let t_tmp = F.sqr(t); // t^(2^1) - while (!F.eql(t_tmp, F.ONE)) { - i++; - t_tmp = F.sqr(t_tmp); // t^(2^2)... - if (i === M) - throw new Error('Cannot find square root'); - } - // Calculate the exponent for b: 2^(M - i - 1) - const exponent = _1n << BigInt(M - i - 1); // bigint is important - const b = F.pow(c, exponent); // b = 2^(M - i - 1) - // Update variables - M = i; - c = F.sqr(b); // c = b^2 - t = F.mul(t, c); // t = (t * b^2) - R = F.mul(R, b); // R = R*b - } - return R; - }; -} -/** - * Square root for a finite field. Will try optimized versions first: - * - * 1. P ≡ 3 (mod 4) - * 2. P ≡ 5 (mod 8) - * 3. P ≡ 9 (mod 16) - * 4. Tonelli-Shanks algorithm - * - * Different algorithms can give different roots, it is up to user to decide which one they want. - * For example there is FpSqrtOdd/FpSqrtEven to choose a root by oddness - * (used for hash-to-curve). - * @param P - Field order. - * @returns Square-root helper. The generic fallback inherits Tonelli-Shanks' variable-time - * behavior and this selector assumes prime-field-style integer moduli. - * @throws If the field is unsupported or the square root does not exist. {@link Error} - * @example - * Choose the square-root helper appropriate for one field modulus. - * - * ```ts - * import { Field, FpSqrt } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const sqrt = FpSqrt(17n)(Fp, 4n); - * ``` - */ -export function FpSqrt(P) { - // P ≡ 3 (mod 4) => √n = n^((P+1)/4) - if (P % _4n === _3n) - return sqrt3mod4; - // P ≡ 5 (mod 8) => Atkin algorithm, page 10 of https://eprint.iacr.org/2012/685.pdf - if (P % _8n === _5n) - return sqrt5mod8; - // P ≡ 9 (mod 16) => Kong algorithm, page 11 of https://eprint.iacr.org/2012/685.pdf (algorithm 4) - if (P % _16n === _9n) - return sqrt9mod16(P); - // Tonelli-Shanks algorithm - return tonelliShanks(P); -} -/** - * @param num - Value to inspect. - * @param modulo - Field modulus. - * @returns `true` when the least-significant little-endian bit is set. - * @throws If the modulus is invalid for `mod(...)`. {@link Error} - * @example - * Inspect the low bit used by little-endian sign conventions. - * - * ```ts - * isNegativeLE(3n, 11n); - * ``` - */ -export const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n; -// prettier-ignore -// Arithmetic-only subset checked by validateField(). This is intentionally not the full runtime -// IField contract: helpers like `isValidNot0`, `invertBatch`, `toBytes`, `fromBytes`, `cmov`, and -// field-specific extras like `isOdd` are left to the callers that actually need them. -const FIELD_FIELDS = [ - 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr', - 'eql', 'add', 'sub', 'mul', 'pow', 'div', - 'addN', 'subN', 'mulN', 'sqrN' -]; -/** - * @param field - Field implementation. - * @returns Validated field. This only checks the arithmetic subset needed by generic helpers; it - * does not guarantee full runtime-method coverage for serialization, batching, `cmov`, or - * field-specific extras beyond positive `BYTES` / `BITS`. - * @throws If the field shape or numeric metadata are invalid. {@link Error} - * @example - * Check that a field implementation exposes the operations curve code expects. - * - * ```ts - * import { Field, validateField } from '@noble/curves/abstract/modular.js'; - * const Fp = validateField(Field(17n)); - * ``` - */ -export function validateField(field) { - const initial = { - ORDER: 'bigint', - BYTES: 'number', - BITS: 'number', - }; - const opts = FIELD_FIELDS.reduce((map, val) => { - map[val] = 'function'; - return map; - }, initial); - validateObject(field, opts); - // Runtime field implementations must expose real integer byte/bit sizes; fractional / NaN / - // infinite metadata leaks through validateObject(type='number') but breaks encoders and caches. - asafenumber(field.BYTES, 'BYTES'); - asafenumber(field.BITS, 'BITS'); - // Runtime field implementations must expose positive byte/bit sizes; zero leaks through the - // numeric shape checks above but still breaks encoding helpers and cached-length assumptions. - if (field.BYTES < 1 || field.BITS < 1) - throw new Error('invalid field: expected BYTES/BITS > 0'); - if (field.ORDER <= _1n) - throw new Error('invalid field: expected ORDER > 1, got ' + field.ORDER); - return field; -} -// Generic field functions -/** - * Same as `pow` but for Fp: non-constant-time. - * Unsafe in some contexts: uses ladder, so can expose bigint bits. - * @param Fp - Field implementation. - * @param num - Base value. - * @param power - Exponent value. - * @returns Powered field element. - * @throws If the exponent is negative. {@link Error} - * @example - * Raise one field element to a public exponent. - * - * ```ts - * import { Field, FpPow } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const x = FpPow(Fp, 3n, 5n); - * ``` - */ -export function FpPow(Fp, num, power) { - const F = Fp; - if (power < _0n) - throw new Error('invalid exponent, negatives unsupported'); - if (power === _0n) - return F.ONE; - if (power === _1n) - return num; - let p = F.ONE; - let d = num; - while (power > _0n) { - if (power & _1n) - p = F.mul(p, d); - d = F.sqr(d); - power >>= _1n; - } - return p; -} -/** - * Efficiently invert an array of Field elements. - * Exception-free. Zero-valued field elements stay `undefined` unless `passZero` is enabled. - * @param Fp - Field implementation. - * @param nums - Values to invert. - * @param passZero - map 0 to 0 (instead of undefined) - * @returns Inverted values. - * @example - * Invert several field elements with one shared inversion. - * - * ```ts - * import { Field, FpInvertBatch } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const inv = FpInvertBatch(Fp, [1n, 2n, 4n]); - * ``` - */ -export function FpInvertBatch(Fp, nums, passZero = false) { - const F = Fp; - const inverted = new Array(nums.length).fill(passZero ? F.ZERO : undefined); - // Walk from first to last, multiply them by each other MOD p - const multipliedAcc = nums.reduce((acc, num, i) => { - if (F.is0(num)) - return acc; - inverted[i] = acc; - return F.mul(acc, num); - }, F.ONE); - // Invert last element - const invertedAcc = F.inv(multipliedAcc); - // Walk from last to first, multiply them by inverted each other MOD p - nums.reduceRight((acc, num, i) => { - if (F.is0(num)) - return acc; - inverted[i] = F.mul(acc, inverted[i]); - return F.mul(acc, num); - }, invertedAcc); - return inverted; -} -/** - * @param Fp - Field implementation. - * @param lhs - Dividend value. - * @param rhs - Divisor value. - * @returns Division result. - * @throws If the divisor is non-invertible. {@link Error} - * @example - * Divide one field element by another. - * - * ```ts - * import { Field, FpDiv } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const x = FpDiv(Fp, 6n, 3n); - * ``` - */ -export function FpDiv(Fp, lhs, rhs) { - const F = Fp; - return F.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, F.ORDER) : F.inv(rhs)); -} -/** - * Legendre symbol. - * Legendre constant is used to calculate Legendre symbol (a | p) - * which denotes the value of a^((p-1)/2) (mod p). - * - * * (a | p) ≡ 1 if a is a square (mod p), quadratic residue - * * (a | p) ≡ -1 if a is not a square (mod p), quadratic non residue - * * (a | p) ≡ 0 if a ≡ 0 (mod p) - * @param Fp - Field implementation. - * @param n - Value to inspect. - * @returns Legendre symbol. - * @throws If the field returns an invalid Legendre symbol value. {@link Error} - * @example - * Compute the Legendre symbol of one field element. - * - * ```ts - * import { Field, FpLegendre } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const symbol = FpLegendre(Fp, 4n); - * ``` - */ -export function FpLegendre(Fp, n) { - const F = Fp; - // We can use 3rd argument as optional cache of this value - // but seems unneeded for now. The operation is very fast. - const p1mod2 = (F.ORDER - _1n) / _2n; - const powered = F.pow(n, p1mod2); - const yes = F.eql(powered, F.ONE); - const zero = F.eql(powered, F.ZERO); - const no = F.eql(powered, F.neg(F.ONE)); - if (!yes && !zero && !no) - throw new Error('invalid Legendre symbol result'); - return yes ? 1 : zero ? 0 : -1; -} -/** - * @param Fp - Field implementation. - * @param n - Value to inspect. - * @returns `true` when `Fp.sqrt(n)` exists. This includes `0`, even though strict "quadratic - * residue" terminology often reserves that name for the non-zero square class. - * @throws If the field returns an invalid Legendre symbol value. {@link Error} - * @example - * Check whether one field element has a square root in the field. - * - * ```ts - * import { Field, FpIsSquare } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const isSquare = FpIsSquare(Fp, 4n); - * ``` - */ -export function FpIsSquare(Fp, n) { - const l = FpLegendre(Fp, n); - // Zero is a square too: 0 = 0^2, and Fp.sqrt(0) already returns 0. - return l !== -1; -} -/** - * @param n - Curve order. Callers are expected to pass a positive order. - * @param nBitLength - Optional cached bit length. Callers are expected to pass a positive cached - * value when overriding the derived bit length. - * @returns Byte and bit lengths. - * @throws If the order or cached bit length is invalid. {@link Error} - * @example - * Measure the encoding sizes needed for one modulus. - * - * ```ts - * nLength(255n); - * ``` - */ -export function nLength(n, nBitLength) { - // Bit size, byte size of CURVE.n - if (nBitLength !== undefined) - anumber(nBitLength); - if (n <= _0n) - throw new Error('invalid n length: expected positive n, got ' + n); - if (nBitLength !== undefined && nBitLength < 1) - throw new Error('invalid n length: expected positive bit length, got ' + nBitLength); - const bits = bitLen(n); - // Cached bit lengths smaller than ORDER would truncate serialized scalars/elements and poison - // any math that relies on the derived field metadata. - if (nBitLength !== undefined && nBitLength < bits) - throw new Error(`invalid n length: expected bit length (${bits}) >= n.length (${nBitLength})`); - const _nBitLength = nBitLength !== undefined ? nBitLength : bits; - const nByteLength = Math.ceil(_nBitLength / 8); - return { nBitLength: _nBitLength, nByteLength }; -} -// Keep the lazy sqrt cache off-instance so Field(...) can return a frozen object. Otherwise the -// cached helper write would keep the field surface externally mutable. -const FIELD_SQRT = new WeakMap(); -class _Field { - ORDER; - BITS; - BYTES; - isLE; - ZERO = _0n; - ONE = _1n; - _lengths; - _mod; - constructor(ORDER, opts = {}) { - // ORDER <= 1 is degenerate: ONE would not be a valid field element and helpers like pow/inv - // would stop modeling field arithmetic. - if (ORDER <= _1n) - throw new Error('invalid field: expected ORDER > 1, got ' + ORDER); - let _nbitLength = undefined; - this.isLE = false; - if (opts != null && typeof opts === 'object') { - // Cached bit lengths are trusted here and should already be positive / consistent with ORDER. - if (typeof opts.BITS === 'number') - _nbitLength = opts.BITS; - if (typeof opts.sqrt === 'function') - // `_Field.prototype` is frozen below, so custom sqrt hooks must become own properties - // explicitly instead of relying on writable prototype shadowing via assignment. - Object.defineProperty(this, 'sqrt', { value: opts.sqrt, enumerable: true }); - if (typeof opts.isLE === 'boolean') - this.isLE = opts.isLE; - if (opts.allowedLengths) - this._lengths = Object.freeze(opts.allowedLengths.slice()); - if (typeof opts.modFromBytes === 'boolean') - this._mod = opts.modFromBytes; - } - const { nBitLength, nByteLength } = nLength(ORDER, _nbitLength); - if (nByteLength > 2048) - throw new Error('invalid field: expected ORDER of <= 2048 bytes'); - this.ORDER = ORDER; - this.BITS = nBitLength; - this.BYTES = nByteLength; - Object.freeze(this); - } - create(num) { - return mod(num, this.ORDER); - } - isValid(num) { - if (typeof num !== 'bigint') - throw new TypeError('invalid field element: expected bigint, got ' + typeof num); - return _0n <= num && num < this.ORDER; // 0 is valid element, but it's not invertible - } - is0(num) { - return num === _0n; - } - // is valid and invertible - isValidNot0(num) { - return !this.is0(num) && this.isValid(num); - } - isOdd(num) { - return (num & _1n) === _1n; - } - neg(num) { - return mod(-num, this.ORDER); - } - eql(lhs, rhs) { - return lhs === rhs; - } - sqr(num) { - return mod(num * num, this.ORDER); - } - add(lhs, rhs) { - return mod(lhs + rhs, this.ORDER); - } - sub(lhs, rhs) { - return mod(lhs - rhs, this.ORDER); - } - mul(lhs, rhs) { - return mod(lhs * rhs, this.ORDER); - } - pow(num, power) { - return FpPow(this, num, power); - } - div(lhs, rhs) { - return mod(lhs * invert(rhs, this.ORDER), this.ORDER); - } - // Same as above, but doesn't normalize - sqrN(num) { - return num * num; - } - addN(lhs, rhs) { - return lhs + rhs; - } - subN(lhs, rhs) { - return lhs - rhs; - } - mulN(lhs, rhs) { - return lhs * rhs; - } - inv(num) { - return invert(num, this.ORDER); - } - sqrt(num) { - // Caching sqrt helpers speeds up sqrt9mod16 by 5x and Tonelli-Shanks by about 10% without keeping - // the field instance itself mutable. - let sqrt = FIELD_SQRT.get(this); - if (!sqrt) - FIELD_SQRT.set(this, (sqrt = FpSqrt(this.ORDER))); - return sqrt(this, num); - } - toBytes(num) { - // Serialize fixed-width limbs without re-validating the field range. Callers that need a - // canonical encoding must pass a valid element; some protocols intentionally serialize raw - // residues here and reduce or validate them elsewhere. - return this.isLE ? numberToBytesLE(num, this.BYTES) : numberToBytesBE(num, this.BYTES); - } - fromBytes(bytes, skipValidation = false) { - abytes(bytes); - const { _lengths: allowedLengths, BYTES, isLE, ORDER, _mod: modFromBytes } = this; - if (allowedLengths) { - // `allowedLengths` must list real positive byte lengths; otherwise empty input would get - // padded into zero and silently decode as a field element. - if (bytes.length < 1 || !allowedLengths.includes(bytes.length) || bytes.length > BYTES) { - throw new Error('Field.fromBytes: expected ' + allowedLengths + ' bytes, got ' + bytes.length); - } - const padded = new Uint8Array(BYTES); - // isLE add 0 to right, !isLE to the left. - padded.set(bytes, isLE ? 0 : padded.length - bytes.length); - bytes = padded; - } - if (bytes.length !== BYTES) - throw new Error('Field.fromBytes: expected ' + BYTES + ' bytes, got ' + bytes.length); - let scalar = isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes); - if (modFromBytes) - scalar = mod(scalar, ORDER); - if (!skipValidation) - if (!this.isValid(scalar)) - throw new Error('invalid field element: outside of range 0..ORDER'); - // Range validation is optional here because some protocols intentionally decode raw residues - // and reduce or validate them elsewhere. - return scalar; - } - // TODO: we don't need it here, move out to separate fn - invertBatch(lst) { - return FpInvertBatch(this, lst); - } - // We can't move this out because Fp6, Fp12 implement it - // and it's unclear what to return in there. - cmov(a, b, condition) { - // Field elements have `isValid(...)`; the CMOV branch bit is a direct runtime input, so reject - // non-boolean selectors here instead of letting JS truthiness silently change arithmetic. - abool(condition, 'condition'); - return condition ? b : a; - } -} -// Freeze the shared method surface too; otherwise callers can still poison every Field instance by -// monkey-patching `_Field.prototype` even if each instance is frozen. -Object.freeze(_Field.prototype); -/** - * Creates a finite field. Major performance optimizations: - * * 1. Denormalized operations like mulN instead of mul. - * * 2. Identical object shape: never add or remove keys. - * * 3. Frozen stable object shape; the lazy sqrt cache lives in a module-level `WeakMap`. - * Fragile: always run a benchmark on a change. - * Security note: operations and low-level serializers like `toBytes` don't check `isValid` for - * all elements for performance and protocol-flexibility reasons; callers are responsible for - * supplying valid elements when they need canonical field behavior. - * This is low-level code, please make sure you know what you're doing. - * - * Note about field properties: - * * CHARACTERISTIC p = prime number, number of elements in main subgroup. - * * ORDER q = similar to cofactor in curves, may be composite `q = p^m`. - * - * @param ORDER - field order, probably prime, or could be composite - * @param opts - Field options such as bit length or endianness. See {@link FieldOpts}. - * @returns Frozen field instance with a stable object shape. This wrapper forwards `opts` straight - * into `_Field`, so it inherits `_Field`'s assumptions about cached sizes and `allowedLengths`. - * @example - * Construct one prime field with optional overrides. - * - * ```ts - * Field(11n); - * ``` - */ -export function Field(ORDER, opts = {}) { - return new _Field(ORDER, opts); -} -// Generic random scalar, we can do same for other fields if via Fp2.mul(Fp2.ONE, Fp2.random)? -// This allows unsafe methods like ignore bias or zero. These unsafe, but often used in different protocols (if deterministic RNG). -// which mean we cannot force this via opts. -// Not sure what to do with randomBytes, we can accept it inside opts if wanted. -// Probably need to export getMinHashLength somewhere? -// random(bytes?: Uint8Array, unsafeAllowZero = false, unsafeAllowBias = false) { -// const LEN = !unsafeAllowBias ? getMinHashLength(ORDER) : BYTES; -// if (bytes === undefined) bytes = randomBytes(LEN); // _opts.randomBytes? -// const num = isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes); -// // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 -// const reduced = unsafeAllowZero ? mod(num, ORDER) : mod(num, ORDER - _1n) + _1n; -// return reduced; -// }, -/** - * @param Fp - Field implementation. - * @param elm - Value to square-root. - * @returns Odd square root when two roots exist. The special case `elm = 0` still returns `0`, - * which is the only square root but is not odd. - * @throws If the field lacks oddness checks or the square root does not exist. {@link Error} - * @example - * Select the odd square root when two roots exist. - * - * ```ts - * import { Field, FpSqrtOdd } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const root = FpSqrtOdd(Fp, 4n); - * ``` - */ -export function FpSqrtOdd(Fp, elm) { - const F = Fp; - if (!F.isOdd) - throw new Error("Field doesn't have isOdd"); - const root = F.sqrt(elm); - return F.isOdd(root) ? root : F.neg(root); -} -/** - * @param Fp - Field implementation. - * @param elm - Value to square-root. - * @returns Even square root. - * @throws If the field lacks oddness checks or the square root does not exist. {@link Error} - * @example - * Select the even square root when two roots exist. - * - * ```ts - * import { Field, FpSqrtEven } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const root = FpSqrtEven(Fp, 4n); - * ``` - */ -export function FpSqrtEven(Fp, elm) { - const F = Fp; - if (!F.isOdd) - throw new Error("Field doesn't have isOdd"); - const root = F.sqrt(elm); - return F.isOdd(root) ? F.neg(root) : root; -} -/** - * Returns total number of bytes consumed by the field element. - * For example, 32 bytes for usual 256-bit weierstrass curve. - * @param fieldOrder - number of field elements, usually CURVE.n. Callers are expected to pass an - * order greater than 1. - * @returns byte length of field - * @throws If the field order is not a bigint. {@link Error} - * @example - * Read the fixed-width byte length of one field. - * - * ```ts - * getFieldBytesLength(255n); - * ``` - */ -export function getFieldBytesLength(fieldOrder) { - if (typeof fieldOrder !== 'bigint') - throw new Error('field order must be bigint'); - // Valid field elements are in 0..ORDER-1, so ORDER <= 1 would make the encoded range degenerate. - if (fieldOrder <= _1n) - throw new Error('field order must be greater than 1'); - // Valid field elements are < ORDER, so the maximal encoded element is ORDER - 1. - const bitLength = bitLen(fieldOrder - _1n); - return Math.ceil(bitLength / 8); -} -/** - * Returns minimal amount of bytes that can be safely reduced - * by field order. - * Should be 2^-128 for 128-bit curve such as P256. - * This is the reduction / modulo-bias lower bound; higher-level helpers may still impose a larger - * absolute floor for policy reasons. - * @param fieldOrder - number of field elements greater than 1, usually CURVE.n. - * @returns byte length of target hash - * @throws If the field order is invalid. {@link Error} - * @example - * Compute the minimum hash length needed for field reduction. - * - * ```ts - * getMinHashLength(255n); - * ``` - */ -export function getMinHashLength(fieldOrder) { - const length = getFieldBytesLength(fieldOrder); - return length + Math.ceil(length / 2); -} -/** - * "Constant-time" private key generation utility. - * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF - * and convert them into private scalar, with the modulo bias being negligible. - * Needs at least 48 bytes of input for 32-byte private key. The implementation also keeps a hard - * 16-byte minimum even when `getMinHashLength(...)` is smaller, so toy-small inputs do not look - * accidentally acceptable for real scalar derivation. - * See {@link https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ | Kudelski's modulo-bias guide}, - * {@link https://csrc.nist.gov/publications/detail/fips/186/5/final | FIPS 186-5 appendix A.2}, and - * {@link https://www.rfc-editor.org/rfc/rfc9380#section-5 | RFC 9380 section 5}. Unlike RFC 9380 - * `hash_to_field`, this helper intentionally maps into the non-zero private-scalar range `1..n-1`. - * @param key - Uniform input bytes. - * @param fieldOrder - Size of subgroup. - * @param isLE - interpret hash bytes as LE num - * @returns valid private scalar - * @throws If the hash length or field order is invalid for scalar reduction. {@link Error} - * @example - * Map hash output into a private scalar range. - * - * ```ts - * mapHashToField(new Uint8Array(48).fill(1), 255n); - * ``` - */ -export function mapHashToField(key, fieldOrder, isLE = false) { - abytes(key); - const len = key.length; - const fieldLen = getFieldBytesLength(fieldOrder); - const minLen = Math.max(getMinHashLength(fieldOrder), 16); - // No toy-small inputs: the helper is for real scalar derivation, not tiny test curves. No huge - // inputs: easier to reason about JS timing / allocation behavior. - if (len < minLen || len > 1024) - throw new Error('expected ' + minLen + '-1024 bytes of input, got ' + len); - const num = isLE ? bytesToNumberLE(key) : bytesToNumberBE(key); - // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 - const reduced = mod(num, fieldOrder - _1n) + _1n; - return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); -} -//# sourceMappingURL=modular.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/modular.js.map b/node_modules/@noble/curves/abstract/modular.js.map deleted file mode 100644 index 21f9457..0000000 --- a/node_modules/@noble/curves/abstract/modular.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"modular.js","sourceRoot":"","sources":["../src/abstract/modular.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sEAAsE;AACtE,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,WAAW,EACX,MAAM,EACN,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,GAGf,MAAM,aAAa,CAAC;AAErB,8CAA8C;AAC9C,kBAAkB;AAClB,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACxG,kBAAkB;AAClB,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACxG,kBAAkB;AAClB,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACxG,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAExC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS;IACtC,IAAI,CAAC,IAAI,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,GAAG,CAAC,CAAC,CAAC;IAC1E,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;IACrB,OAAO,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAA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IACjD,OAAO,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACxF,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/montgomery.d.ts b/node_modules/@noble/curves/abstract/montgomery.d.ts deleted file mode 100644 index 836cd93..0000000 --- a/node_modules/@noble/curves/abstract/montgomery.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Montgomery curve methods. It's not really whole montgomery curve, - * just bunch of very specific methods for X25519 / X448 from - * [RFC 7748](https://www.rfc-editor.org/rfc/rfc7748) - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { type TArg, type TRet } from '../utils.ts'; -import { type CurveLengths } from './curve.ts'; -/** Curve-specific hooks required to build one X25519/X448 helper. */ -export type MontgomeryOpts = { - /** Prime field modulus. */ - P: bigint; - /** RFC 7748 variant name. */ - type: 'x25519' | 'x448'; - /** - * Clamp or otherwise normalize one scalar byte string before use. - * @param bytes - Raw secret scalar bytes. - * @returns Adjusted scalar bytes ready for Montgomery multiplication. - */ - adjustScalarBytes: (bytes: TArg) => TRet; - /** - * Invert one field element with exponentiation by `p - 2`. - * @param x - Field element to invert. - * @returns Multiplicative inverse of `x`. - */ - powPminus2: (x: bigint) => bigint; - /** - * Optional randomness source for `keygen()` and `utils.randomSecretKey()`. - * Receives the requested byte length and returns fresh random bytes. - */ - randomBytes?: (bytesLength?: number) => TRet; -}; -/** Public X25519/X448 ECDH API built on a Montgomery ladder. */ -export type MontgomeryECDH = { - /** - * Multiply one scalar by one Montgomery `u` coordinate. - * @param scalar - Secret scalar bytes. - * @param u - Public Montgomery `u` coordinate. - * @returns Shared point encoded as bytes. - */ - scalarMult: (scalar: TArg, u: TArg) => TRet; - /** - * Multiply one scalar by the curve base point. - * @param scalar - Secret scalar bytes. - * @returns Public key bytes. - */ - scalarMultBase: (scalar: TArg) => TRet; - /** - * Derive a shared secret from a local secret key and peer public key. - * @param secretKeyA - Local secret key bytes. - * @param publicKeyB - Peer public key bytes. - * Rejects low-order public inputs instead of returning the all-zero shared secret. - * @returns Shared secret bytes. - */ - getSharedSecret: (secretKeyA: TArg, publicKeyB: TArg) => TRet; - /** - * Derive one public key from a secret key. - * @param secretKey - Secret key bytes. - * @returns Public key bytes. - */ - getPublicKey: (secretKey: TArg) => TRet; - /** Utility helpers for secret-key generation. */ - utils: { - /** Generate one random secret key with the curve's expected byte length. */ - randomSecretKey: () => TRet; - }; - /** Encoded Montgomery base point `u`. */ - GuBytes: TRet; - /** Public lengths for keys and seeds. */ - lengths: CurveLengths; - /** - * Generate one random secret/public keypair. - * @param seed - Optional seed bytes to use instead of random generation. - * @returns Fresh secret/public keypair. - */ - keygen: (seed?: TArg) => { - secretKey: TRet; - publicKey: TRet; - }; -}; -/** - * @param curveDef - Montgomery curve definition. - * @returns ECDH helper namespace. - * @throws If the curve definition or derived shared point is invalid. {@link Error} - * @example - * Perform one X25519 key exchange through the generic Montgomery helper. - * - * ```ts - * import { x25519 } from '@noble/curves/ed25519.js'; - * const alice = x25519.keygen(); - * const shared = x25519.getSharedSecret(alice.secretKey, alice.publicKey); - * ``` - */ -export declare function montgomery(curveDef: TArg): TRet; -//# sourceMappingURL=montgomery.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/montgomery.d.ts.map b/node_modules/@noble/curves/abstract/montgomery.d.ts.map deleted file mode 100644 index a8df1c8..0000000 --- a/node_modules/@noble/curves/abstract/montgomery.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"montgomery.d.ts","sourceRoot":"","sources":["../src/abstract/montgomery.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sEAAsE;AACtE,OAAO,EASL,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC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AO,EAAE,YAAY,CAAC;IACtB;;;;OAIG;IACH,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;QACnC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5B,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;KAC7B,CAAC;CACH,CAAC;AAqBF;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,CA0I/E"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/montgomery.js b/node_modules/@noble/curves/abstract/montgomery.js deleted file mode 100644 index 2a5dcea..0000000 --- a/node_modules/@noble/curves/abstract/montgomery.js +++ /dev/null @@ -1,178 +0,0 @@ -/** - * Montgomery curve methods. It's not really whole montgomery curve, - * just bunch of very specific methods for X25519 / X448 from - * [RFC 7748](https://www.rfc-editor.org/rfc/rfc7748) - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { abytes, aInRange, bytesToNumberLE, copyBytes, numberToBytesLE, randomBytes, validateObject, } from "../utils.js"; -import { createKeygen } from "./curve.js"; -import { mod } from "./modular.js"; -const _0n = BigInt(0); -const _1n = BigInt(1); -const _2n = BigInt(2); -function validateOpts(curve) { - // Validate constructor config eagerly, but do not call user-provided hooks here: - // `randomBytes` may be transcript-backed or otherwise contextual. Runtime type checks are - // enough to fail fast on malformed configs without consuming user state. - validateObject(curve, { - P: 'bigint', - type: 'string', - adjustScalarBytes: 'function', - powPminus2: 'function', - }, { - randomBytes: 'function', - }); - return Object.freeze({ ...curve }); -} -/** - * @param curveDef - Montgomery curve definition. - * @returns ECDH helper namespace. - * @throws If the curve definition or derived shared point is invalid. {@link Error} - * @example - * Perform one X25519 key exchange through the generic Montgomery helper. - * - * ```ts - * import { x25519 } from '@noble/curves/ed25519.js'; - * const alice = x25519.keygen(); - * const shared = x25519.getSharedSecret(alice.secretKey, alice.publicKey); - * ``` - */ -export function montgomery(curveDef) { - const CURVE = validateOpts(curveDef); - const { P, type, adjustScalarBytes, powPminus2, randomBytes: rand } = CURVE; - const is25519 = type === 'x25519'; - if (!is25519 && type !== 'x448') - throw new Error('invalid type'); - const randomBytes_ = rand === undefined ? randomBytes : rand; - const montgomeryBits = is25519 ? 255 : 448; - const fieldLen = is25519 ? 32 : 56; - const Gu = is25519 ? BigInt(9) : BigInt(5); - // RFC 7748 #5: - // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519 and - // (156326 - 2) / 4 = 39081 for curve448/X448 - // const a = is25519 ? 486662n : 156326n; - const a24 = is25519 ? BigInt(121665) : BigInt(39081); - // RFC: x25519 "the resulting integer is of the form 2^254 plus - // eight times a value between 0 and 2^251 - 1 (inclusive)" - // x448: "2^447 plus four times a value between 0 and 2^445 - 1 (inclusive)" - const minScalar = is25519 ? _2n ** BigInt(254) : _2n ** BigInt(447); - const maxAdded = is25519 - ? BigInt(8) * _2n ** BigInt(251) - _1n - : BigInt(4) * _2n ** BigInt(445) - _1n; - const maxScalar = minScalar + maxAdded + _1n; // (inclusive) - const modP = (n) => mod(n, P); - const GuBytes = encodeU(Gu); - function encodeU(u) { - return numberToBytesLE(modP(u), fieldLen); - } - function decodeU(u) { - const _u = copyBytes(abytes(u, fieldLen, 'uCoordinate')); - // RFC: When receiving such an array, implementations of X25519 - // (but not X448) MUST mask the most significant bit in the final byte. - if (is25519) - _u[31] &= 127; // 0b0111_1111 - // RFC: Implementations MUST accept non-canonical values and process them as - // if they had been reduced modulo the field prime. The non-canonical - // values are 2^255 - 19 through 2^255 - 1 for X25519 and 2^448 - 2^224 - // - 1 through 2^448 - 1 for X448. - return modP(bytesToNumberLE(_u)); - } - function decodeScalar(scalar) { - return bytesToNumberLE(adjustScalarBytes(copyBytes(abytes(scalar, fieldLen, 'scalar')))); - } - function scalarMult(scalar, u) { - const pu = montgomeryLadder(decodeU(u), decodeScalar(scalar)); - // Some public keys are useless, of low-order. Curve author doesn't think - // it needs to be validated, but we do it nonetheless. - // https://cr.yp.to/ecdh.html#validate - if (pu === _0n) - throw new Error('invalid private or public key received'); - return encodeU(pu); - } - // Computes public key from private. By doing scalar multiplication of base point. - function scalarMultBase(scalar) { - return scalarMult(scalar, GuBytes); - } - const getPublicKey = scalarMultBase; - const getSharedSecret = scalarMult; - // cswap from RFC7748 "example code" - function cswap(swap, x_2, x_3) { - // dummy = mask(swap) AND (x_2 XOR x_3) - // Where mask(swap) is the all-1 or all-0 word of the same length as x_2 - // and x_3, computed, e.g., as mask(swap) = 0 - swap. - const dummy = modP(swap * (x_2 - x_3)); - x_2 = modP(x_2 - dummy); // x_2 = x_2 XOR dummy - x_3 = modP(x_3 + dummy); // x_3 = x_3 XOR dummy - return { x_2, x_3 }; - } - /** - * Montgomery x-only multiplication ladder for the selected X25519/X448 curve. - * @param pointU - decoded Montgomery u coordinate for the selected curve - * @param scalar - decoded clamped scalar by which the point is multiplied - * @returns resulting Montgomery u coordinate for the selected curve - */ - function montgomeryLadder(u, scalar) { - aInRange('u', u, _0n, P); - aInRange('scalar', scalar, minScalar, maxScalar); - const k = scalar; - const x_1 = u; - let x_2 = _1n; - let z_2 = _0n; - let x_3 = u; - let z_3 = _1n; - let swap = _0n; - for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) { - const k_t = (k >> t) & _1n; - swap ^= k_t; - ({ x_2, x_3 } = cswap(swap, x_2, x_3)); - ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3)); - swap = k_t; - const A = x_2 + z_2; - const AA = modP(A * A); - const B = x_2 - z_2; - const BB = modP(B * B); - const E = AA - BB; - const C = x_3 + z_3; - const D = x_3 - z_3; - const DA = modP(D * A); - const CB = modP(C * B); - const dacb = DA + CB; - const da_cb = DA - CB; - x_3 = modP(dacb * dacb); - z_3 = modP(x_1 * modP(da_cb * da_cb)); - x_2 = modP(AA * BB); - z_2 = modP(E * (AA + modP(a24 * E))); - } - ({ x_2, x_3 } = cswap(swap, x_2, x_3)); - ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3)); - const z2 = powPminus2(z_2); // `Fp.pow(x, P - _2n)` is much slower equivalent - return modP(x_2 * z2); // Return x_2 * (z_2^(p - 2)) - } - const lengths = { - secretKey: fieldLen, - publicKey: fieldLen, - seed: fieldLen, - }; - const randomSecretKey = (seed) => { - seed = seed === undefined ? randomBytes_(fieldLen) : seed; - abytes(seed, lengths.seed, 'seed'); - // Reuse caller-supplied seed bytes verbatim; clamping is deferred until - // decodeScalar(...) when the secret key is actually used. - return seed; - }; - const utils = { randomSecretKey }; - Object.freeze(lengths); - Object.freeze(utils); - return Object.freeze({ - keygen: createKeygen(randomSecretKey, getPublicKey), - getSharedSecret, - getPublicKey, - scalarMult, - scalarMultBase, - utils, - GuBytes: GuBytes.slice(), - lengths, - }); -} -//# sourceMappingURL=montgomery.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/montgomery.js.map b/node_modules/@noble/curves/abstract/montgomery.js.map deleted file mode 100644 index a848bba..0000000 --- a/node_modules/@noble/curves/abstract/montgomery.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"montgomery.js","sourceRoot":"","sources":["../src/abstract/montgomery.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sEAAsE;AACtE,OAAO,EACL,MAAM,EACN,QAAQ,EACR,eAAe,EACf,SAAS,EACT,eAAe,EACf,WAAW,EACX,cAAc,GAIf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAqB,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AA4EtB,SAAS,YAAY,C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;IAClC,CAAC,CAAC;IACF,MAAM,KAAK,GAAG,EAAE,eAAe,EAAE,CAAC;IAClC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAErB,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,MAAM,EAAE,YAAY,CAAC,eAAe,EAAE,YAAY,CAAC;QACnD,eAAe;QACf,YAAY;QACZ,UAAU;QACV,cAAc;QACd,KAAK;QACL,OAAO,EAAE,OAAO,CAAC,KAAK,EAAsB;QAC5C,OAAO;KACR,CAAsB,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/oprf.d.ts b/node_modules/@noble/curves/abstract/oprf.d.ts deleted file mode 100644 index 0ebf1e0..0000000 --- a/node_modules/@noble/curves/abstract/oprf.d.ts +++ /dev/null @@ -1,355 +0,0 @@ -/** - * RFC 9497: Oblivious Pseudorandom Functions (OPRFs) Using Prime-Order Groups. - * https://www.rfc-editor.org/rfc/rfc9497 - * - -OPRF allows to interactively create an `Output = PRF(Input, serverSecretKey)`: - -- Server cannot calculate Output by itself: it doesn't know Input -- Client cannot calculate Output by itself: it doesn't know server secretKey -- An attacker interception the communication can't restore Input/Output/serverSecretKey and can't - link Input to some value. - -## Issues - -- Low-entropy inputs (e.g. password '123') enable brute-forced dictionary attacks by the server - (solveable by domain separation in POPRF) -- High-level protocol needs to be constructed on top, because OPRF is low-level - -## Use cases - -1. **Password-Authenticated Key Exchange (PAKE):** Enables secure password login (e.g., OPAQUE) - without revealing the password to the server. -2. **Private Set Intersection (PSI):** Allows two parties to compute the intersection of their - private sets without revealing non-intersecting elements. -3. **Anonymous Credential Systems:** Supports issuance of anonymous, unlinkable credentials - (e.g., Privacy Pass) using blind OPRF evaluation. -4. **Private Information Retrieval (PIR):** Helps users query databases without revealing which - item they accessed. -5. **Encrypted Search / Secure Indexing:** Enables keyword search over encrypted data while keeping - queries private. -6. **Spam Prevention and Rate-Limiting:** Issues anonymous tokens to prevent abuse - (e.g., CAPTCHA bypass) without compromising user privacy. - -## Modes - -- OPRF: simple mode, client doesn't need to know server public key -- VOPRF: verifiable mode. It lets the client verify that the server used the - secret key corresponding to a known public key -- POPRF: partially oblivious mode, VOPRF + domain separation - -There is also non-interactive mode (Evaluate), which creates Output -non-interactively with knowledge of the secret key. - -Flow: -- (once) Server generates secret and public keys, distributes public keys to clients - - deterministically: `deriveKeyPair` or just random: `generateKeyPair` -- Client blinds input: `blind(secretInput)` -- Server evaluates blinded input: `blindEvaluate` generated by client, sends result to client -- Client creates output using result of evaluation via 'finalize' - - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { randomBytes, type TArg, type TRet } from '../utils.ts'; -import { type CurvePoint, type CurvePointCons } from './curve.ts'; -import { type H2CDSTOpts } from './hash-to-curve.ts'; -/** Serialized group element passed between OPRF participants. */ -export type PointBytes = Uint8Array; -/** Serialized scalar used for blinds and server secret keys. */ -export type ScalarBytes = Uint8Array; -/** Arbitrary byte input or output used by the OPRF protocol. */ -export type Bytes = Uint8Array; -/** Cryptographically secure byte generator used for blinds and proofs. */ -export type RNG = typeof randomBytes; -/** Curve and hash hooks required to instantiate one OPRF ciphersuite. */ -export type OPRFOpts

> = { - /** Human-readable suite identifier used for domain separation. */ - name: string; - /** - * Prime-order group used by the OPRF construction. - * Kept generic because the suite returns serialized points. - */ - Point: CurvePointCons

; - /** - * Hash function used for transcripts, proofs, and outputs. - * @param msg - Message bytes to hash. - * @returns Digest bytes. - */ - hash(msg: TArg): TRet; - /** - * Hash arbitrary bytes into one scalar in the suite order. - * @param msg - Message bytes to map. - * @param options - Hash-to-field domain-separation options. See {@link H2CDSTOpts}. - * Implementations MUST treat `msg` and `options` as read-only. - * @returns Scalar in the suite order. - */ - hashToScalar(msg: TArg, options: TArg): bigint; - /** - * Hash arbitrary bytes directly onto one curve point. - * @param msg - Message bytes to map. - * @param options - Hash-to-curve domain-separation options. See {@link H2CDSTOpts}. - * Implementations MUST treat `msg` and `options` as read-only. - * @returns Point on the suite curve. - */ - hashToGroup(msg: TArg, options: TArg): P; -}; -/** Server keypair for one OPRF suite. */ -export type OPRFKeys = { - /** Secret scalar kept by the server. */ - secretKey: TRet; - /** Public point distributed to clients in verifiable modes. */ - publicKey: TRet; -}; -/** Result of the client-side blind step. */ -export type OPRFBlind = { - /** Secret blind scalar that the client keeps locally. */ - blind: TRet; - /** Blinded group element sent to the server. */ - blinded: TRet; -}; -/** Server response for one verifiable OPRF evaluation. */ -export type OPRFBlindEval = { - /** Evaluated group element returned by the server. */ - evaluated: TRet; - /** DLEQ proof binding the evaluation to the server public key. */ - proof: TRet; -}; -/** Server response for a batch of verifiable OPRF evaluations. */ -export type OPRFBlindEvalBatch = { - /** Evaluated group elements returned for each blinded input. */ - evaluated: TRet; - /** Batch proof covering all evaluated elements. */ - proof: TRet; -}; -/** One finalized transcript item used by batch verification helpers. */ -export type OPRFFinalizeItem = { - /** Original client input. */ - input: Bytes; - /** Secret blind scalar used for the input. */ - blind: ScalarBytes; - /** Evaluated point returned by the server. */ - evaluated: PointBytes; - /** Blinded point originally sent to the server. */ - blinded: PointBytes; -}; -/** Result of the POPRF client-side blind step with the tweaked server public key. */ -export type OPRFBlindTweaked = OPRFBlind & { - tweakedKey: TRet; -}; -/** - * Represents a full OPRF ciphersuite implementation according to RFC 9497. - * This object bundles the three protocol variants (OPRF, VOPRF, POPRF) for a specific - * prime-order group and hash function combination. - * - * @see https://www.rfc-editor.org/rfc/rfc9497.html - */ -export type OPRF = { - /** - * The unique identifier for the ciphersuite, e.g., "ristretto255-SHA512". - * This name is used for domain separation to prevent cross-protocol attacks. - */ - readonly name: string; - /** - * The base Oblivious Pseudorandom Function (OPRF) mode (mode 0x00). - * This is a two-party protocol between a client and a server to compute F(k, x) - * where 'k' is the server's key and 'x' is the client's input. - * - * The client learns the output F(k, x) but nothing about 'k'. - * The server learns nothing about 'x' or F(k, x). - * This mode is NOT verifiable; the client cannot prove the server used a specific key. - */ - readonly oprf: { - /** - * (Server-side) Generates a new random private/public key pair for the server. - * @returns A new key pair. - */ - generateKeyPair(): TRet; - /** - * (Server-side) Deterministically derives a private/public key pair from a seed. - * @param seed - A 32-byte cryptographically secure random seed. - * @param keyInfo - An optional byte string for domain separation. - * @returns The derived key pair. - */ - deriveKeyPair(seed: TArg, keyInfo: TArg): TRet; - /** - * (Client-side) The first step of the protocol. The client blinds its private input. - * @param input - The client's private input bytes. - * @param rng - An optional cryptographically secure random number generator. - * @returns An object containing the `blind` scalar (which the client MUST keep secret) - * and the `blinded` element (which the client sends to the server). - */ - blind(input: TArg, rng?: RNG): TRet; - /** - * (Server-side) The second step. The server evaluates the client's blinded element - * using its secret key. - * @param secretKey - The server's private key. - * @param blinded - The blinded group element received from the client. - * @returns The evaluated group element, to be sent back to the client. - */ - blindEvaluate(secretKey: TArg, blinded: TArg): TRet; - /** - * (Client-side) The final step. The client unblinds the server's response to - * compute the final OPRF output. - * @param input - The original private input from the `blind` step. - * @param blind - The secret scalar from the `blind` step. - * @param evaluated - The evaluated group element received from the server. - * @returns The final OPRF output, `Hash(len(input)||input||len(unblinded)||unblinded||"Finalize")`. - */ - finalize(input: TArg, blind: TArg, evaluated: TArg): TRet; - }; - /** - * The Verifiable Oblivious Pseudorandom Function (VOPRF) mode (mode 0x01). - * This mode extends the base OPRF by providing a proof that the server used the - * secret key corresponding to its known public key. - */ - readonly voprf: { - /** (Server-side) Generates a key pair for the VOPRF mode. */ - generateKeyPair(): TRet; - /** (Server-side) Deterministically derives a key pair for the VOPRF mode. */ - deriveKeyPair(seed: TArg, keyInfo: TArg): TRet; - /** (Client-side) Blinds the client's private input for the VOPRF protocol. */ - blind(input: TArg, rng?: RNG): TRet; - /** - * (Server-side) Evaluates the client's blinded element and generates a DLEQ proof - * of correctness. - * @param secretKey - The server's private key. - * @param publicKey - The server's public key, used in proof generation. - * @param blinded - The blinded group element received from the client. - * @param rng - An optional cryptographically secure random number generator for the proof. - * @returns The evaluated element and a proof of correct computation. - */ - blindEvaluate(secretKey: TArg, publicKey: TArg, blinded: TArg, rng?: RNG): TRet; - /** - * (Server-side) An optimized batch version of `blindEvaluate`. It evaluates multiple - * blinded elements and produces a single, constant-size proof for the entire batch, - * amortizing the cost of proof generation. - * @param secretKey - The server's private key. - * @param publicKey - The server's public key. - * @param blinded - An array of blinded group elements from one or more clients. - * @param rng - An optional cryptographically secure random number generator for the proof. - * @returns An array of evaluated elements and a single proof for the batch. - */ - blindEvaluateBatch(secretKey: TArg, publicKey: TArg, blinded: TArg, rng?: RNG): TRet; - /** - * (Client-side) The final step. The client verifies the server's proof, and if valid, - * unblinds the result to compute the final VOPRF output. - * @param input - The original private input. - * @param blind - The secret scalar from the `blind` step. - * @param evaluated - The evaluated element from the server. - * @param blinded - The blinded element sent to the server (needed for proof verification). - * @param publicKey - The server's public key against which the proof is verified. - * @param proof - The DLEQ proof from the server. - * @returns The final VOPRF output. - * @throws If the proof verification fails. {@link Error} - */ - finalize(input: TArg, blind: TArg, evaluated: TArg, blinded: TArg, publicKey: TArg, proof: TArg): TRet; - /** - * (Client-side) The batch-aware version of `finalize`. It verifies a single batch proof - * against a list of corresponding inputs and outputs. - * @param items - An array of objects, each containing the parameters for a single finalization. - * @param publicKey - The server's public key. - * @param proof - The single DLEQ proof for the entire batch. - * @returns An array of final VOPRF outputs, one for each item in the input. - * @throws If the proof verification fails. {@link Error} - */ - finalizeBatch(items: TArg, publicKey: TArg, proof: TArg): TRet; - }; - /** - * A factory for the Partially Oblivious Pseudorandom Function (POPRF) mode (mode 0x02). - * This mode extends VOPRF to include a public `info` parameter, known to both client and - * server, which is cryptographically bound to the final output. - * This is useful for domain separation at the application level. - * @param info - A public byte string to be mixed into the computation. - * @returns An object with the POPRF protocol functions. - */ - readonly poprf: (info: TArg) => { - /** (Server-side) Generates a key pair for the POPRF mode. */ - generateKeyPair(): TRet; - /** (Server-side) Deterministically derives a key pair for the POPRF mode. */ - deriveKeyPair(seed: TArg, keyInfo: TArg): TRet; - /** - * (Client-side) Blinds the client's private input and computes the "tweaked key". - * The tweaked key is a public value derived from the server's public key and the public `info`. - * @param input - The client's private input. - * @param publicKey - The server's public key. - * @param rng - An optional cryptographically secure random number generator. - * @returns The `blind`, `blinded` element, and the `tweakedKey` - * the client uses for verification. - */ - blind(input: TArg, publicKey: TArg, rng?: RNG): TRet; - /** - * (Server-side) Evaluates the blinded element using a key derived from - * its secret key and the public `info`. - * It generates a DLEQ proof against the tweaked key. - * @param secretKey - The server's private key. - * @param blinded - The blinded element from the client. - * @param rng - An optional RNG for the proof. - * @returns The evaluated element and a proof of correct computation. - */ - blindEvaluate(secretKey: TArg, blinded: TArg, rng?: RNG): TRet; - /** - * (Server-side) A batch-aware version of `blindEvaluate` for the POPRF mode. - * @param secretKey - The server's private key. - * @param blinded - An array of blinded elements. - * @param rng - An optional RNG for the proof. - * @returns An array of evaluated elements and a single proof for the batch. - */ - blindEvaluateBatch(secretKey: TArg, blinded: TArg, rng: RNG): TRet; - /** - * (Client-side) A batch-aware version of `finalize` for the POPRF mode. - * It verifies the proof against the tweaked key. - * @param items - An array containing the parameters for each finalization. - * @param proof - The single DLEQ proof for the batch. - * @param tweakedKey - The tweaked key corresponding to the proof. - * All items must share the same `info` and `publicKey`. - * @returns An array of final POPRF outputs. - * @throws If proof verification fails. {@link Error} - */ - finalizeBatch(items: TArg, proof: TArg, tweakedKey: TArg): TRet; - /** - * (Client-side) Finalizes the POPRF protocol. It verifies the server's proof against the - * `tweakedKey` computed in the `blind` step. The final output is bound to the public `info`. - * @param input - The original private input. - * @param blind - The secret scalar. - * @param evaluated - The evaluated element from the server. - * @param blinded - The blinded element sent to the server. - * @param proof - The DLEQ proof from the server. - * @param tweakedKey - The public tweaked key computed by the client during the `blind` step. - * @returns The final POPRF output. - * @throws If proof verification fails. {@link Error} - */ - finalize(input: TArg, blind: TArg, evaluated: TArg, blinded: TArg, proof: TArg, tweakedKey: TArg): TRet; - /** - * A non-interactive evaluation function for an entity that knows all inputs. - * Computes the final POPRF output directly. Useful for testing or specific applications - * where the server needs to compute the output for a known input. - * @param secretKey - The server's private key. - * @param input - The client's private input. - * @returns The final POPRF output. - */ - evaluate(secretKey: TArg, input: TArg): TRet; - }; -}; -/** - * @param opts - OPRF ciphersuite options. See {@link OPRFOpts}. - * @returns OPRF helper namespace. - * @example - * Instantiate an OPRF suite from curve-specific hashing hooks. - * - * ```ts - * import { createOPRF } from '@noble/curves/abstract/oprf.js'; - * import { p256, p256_hasher } from '@noble/curves/nist.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const oprf = createOPRF({ - * name: 'P256-SHA256', - * Point: p256.Point, - * hash: sha256, - * hashToGroup: p256_hasher.hashToCurve, - * hashToScalar: p256_hasher.hashToScalar, - * }); - * const keys = oprf.oprf.generateKeyPair(); - * ``` - */ -export declare function createOPRF

>(opts: OPRFOpts

): TRet; -//# sourceMappingURL=oprf.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/oprf.d.ts.map b/node_modules/@noble/curves/abstract/oprf.d.ts.map deleted file mode 100644 index 91c8ec9..0000000 --- a/node_modules/@noble/curves/abstract/oprf.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oprf.d.ts","sourceRoot":"","sources":["../src/abstract/oprf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,sEAAsE;AACtE,OAAO,EAOL,WAAW,EAEX,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAgC,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIlE,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC;AACpC,gEAAgE;AAChE,MAAM,MAAM,WAAW,GAAG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,CAAC,kBAAkB,CAAC,CAAC;QAE5B;;;;;;;;;WASG;QACH,aAAa,CACX,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,EAC/B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAClB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAC3B,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAEjB;;;;;;;;;;;WAWG;QACH,QAAQ,CACN,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAClB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,EACxB,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,EAC3B,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,EACzB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAClB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAC3B,IAAI,CAAC,KAAK,CAAC,CAAC;QAEf;;;;;;;WAOG;QACH,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;KACzE,CAAC;CACH,CAAC;AAGF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAmWtF"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/oprf.js b/node_modules/@noble/curves/abstract/oprf.js deleted file mode 100644 index 32dc1f0..0000000 --- a/node_modules/@noble/curves/abstract/oprf.js +++ /dev/null @@ -1,356 +0,0 @@ -/** - * RFC 9497: Oblivious Pseudorandom Functions (OPRFs) Using Prime-Order Groups. - * https://www.rfc-editor.org/rfc/rfc9497 - * - -OPRF allows to interactively create an `Output = PRF(Input, serverSecretKey)`: - -- Server cannot calculate Output by itself: it doesn't know Input -- Client cannot calculate Output by itself: it doesn't know server secretKey -- An attacker interception the communication can't restore Input/Output/serverSecretKey and can't - link Input to some value. - -## Issues - -- Low-entropy inputs (e.g. password '123') enable brute-forced dictionary attacks by the server - (solveable by domain separation in POPRF) -- High-level protocol needs to be constructed on top, because OPRF is low-level - -## Use cases - -1. **Password-Authenticated Key Exchange (PAKE):** Enables secure password login (e.g., OPAQUE) - without revealing the password to the server. -2. **Private Set Intersection (PSI):** Allows two parties to compute the intersection of their - private sets without revealing non-intersecting elements. -3. **Anonymous Credential Systems:** Supports issuance of anonymous, unlinkable credentials - (e.g., Privacy Pass) using blind OPRF evaluation. -4. **Private Information Retrieval (PIR):** Helps users query databases without revealing which - item they accessed. -5. **Encrypted Search / Secure Indexing:** Enables keyword search over encrypted data while keeping - queries private. -6. **Spam Prevention and Rate-Limiting:** Issues anonymous tokens to prevent abuse - (e.g., CAPTCHA bypass) without compromising user privacy. - -## Modes - -- OPRF: simple mode, client doesn't need to know server public key -- VOPRF: verifiable mode. It lets the client verify that the server used the - secret key corresponding to a known public key -- POPRF: partially oblivious mode, VOPRF + domain separation - -There is also non-interactive mode (Evaluate), which creates Output -non-interactively with knowledge of the secret key. - -Flow: -- (once) Server generates secret and public keys, distributes public keys to clients - - deterministically: `deriveKeyPair` or just random: `generateKeyPair` -- Client blinds input: `blind(secretInput)` -- Server evaluates blinded input: `blindEvaluate` generated by client, sends result to client -- Client creates output using result of evaluation via 'finalize' - - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { abytes, asciiToBytes, bytesToNumberBE, bytesToNumberLE, concatBytes, numberToBytesBE, randomBytes, validateObject, } from "../utils.js"; -import { pippenger, validatePointCons } from "./curve.js"; -import { _DST_scalar } from "./hash-to-curve.js"; -import { getMinHashLength, mapHashToField } from "./modular.js"; -const _DST_scalarBytes = /* @__PURE__ */ asciiToBytes(_DST_scalar); -// welcome to generic hell -/** - * @param opts - OPRF ciphersuite options. See {@link OPRFOpts}. - * @returns OPRF helper namespace. - * @example - * Instantiate an OPRF suite from curve-specific hashing hooks. - * - * ```ts - * import { createOPRF } from '@noble/curves/abstract/oprf.js'; - * import { p256, p256_hasher } from '@noble/curves/nist.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const oprf = createOPRF({ - * name: 'P256-SHA256', - * Point: p256.Point, - * hash: sha256, - * hashToGroup: p256_hasher.hashToCurve, - * hashToScalar: p256_hasher.hashToScalar, - * }); - * const keys = oprf.oprf.generateKeyPair(); - * ``` - */ -export function createOPRF(opts) { - validateObject(opts, { - name: 'string', - hash: 'function', - hashToScalar: 'function', - hashToGroup: 'function', - }); - // Cheap constructor-surface sanity check only: this verifies the generic static hooks/fields that - // OPRF consumes, but it does not certify point semantics like BASE/ZERO correctness. - validatePointCons(opts.Point); - const { name, Point, hash } = opts; - const { Fn } = Point; - const hashToGroup = (msg, ctx) => opts.hashToGroup(msg, { - DST: concatBytes(asciiToBytes('HashToGroup-'), ctx), - }); - const hashToScalarPrefixed = (msg, ctx) => opts.hashToScalar(msg, { DST: concatBytes(_DST_scalarBytes, ctx) }); - const randomScalar = (rng = randomBytes) => { - // RFC 9497 §2.1 defines RandomScalar as nonzero; blind inversion and generated public keys - // both rely on keeping this helper in the `1..n-1` range. - const t = mapHashToField(rng(getMinHashLength(Fn.ORDER)), Fn.ORDER, Fn.isLE); - // We cannot use Fn.fromBytes here, because field - // can have different number of bytes (like ed448) - return Fn.isLE ? bytesToNumberLE(t) : bytesToNumberBE(t); - }; - const msm = (points, scalars) => pippenger(Point, points, scalars); - const getCtx = (mode) => concatBytes(asciiToBytes('OPRFV1-'), new Uint8Array([mode]), asciiToBytes('-' + name)); - const ctxOPRF = getCtx(0x00); - const ctxVOPRF = getCtx(0x01); - const ctxPOPRF = getCtx(0x02); - function encode(...args) { - const res = []; - for (const a of args) { - if (typeof a === 'number') - res.push(numberToBytesBE(a, 2)); - else if (typeof a === 'string') - res.push(asciiToBytes(a)); - else { - abytes(a); - res.push(numberToBytesBE(a.length, 2), a); - } - } - // No wipe here, since will modify actual bytes - return concatBytes(...res); - } - const inputBytes = (title, bytes) => { - abytes(bytes, undefined, title); - // RFC 9497 §1.2 limits PrivateInput/PublicInput to 2^16 - 1 bytes because these values are - // length-prefixed with two bytes before use throughout the protocol. - if (bytes.length > 0xffff) - throw new Error(`"${title}" expected Uint8Array of length <= 65535, got length=${bytes.length}`); - return bytes; - }; - const hashInput = (...bytes) => hash(encode(...bytes, 'Finalize')); - function getTranscripts(B, C, D, ctx) { - const Bm = B.toBytes(); - const seed = hash(encode(Bm, concatBytes(asciiToBytes('Seed-'), ctx))); - const res = []; - for (let i = 0; i < C.length; i++) { - const Ci = C[i].toBytes(); - const Di = D[i].toBytes(); - const di = hashToScalarPrefixed(encode(seed, i, Ci, Di, 'Composite'), ctx); - res.push(di); - } - return res; - } - function computeComposites(B, C, D, ctx) { - const T = getTranscripts(B, C, D, ctx); - const M = msm(C, T); - const Z = msm(D, T); - return { M, Z }; - } - function computeCompositesFast(k, B, C, D, ctx) { - const T = getTranscripts(B, C, D, ctx); - const M = msm(C, T); - // RFC 9497 §2.2.1 ComputeCompositesFast derives weights from both C and D in getTranscripts(), - // then uses the server shortcut Z = k * M instead of a second MSM over D. - const Z = M.multiply(k); - return { M, Z }; - } - function challengeTranscript(B, M, Z, t2, t3, ctx) { - const [Bm, a0, a1, a2, a3] = [B, M, Z, t2, t3].map((i) => i.toBytes()); - return hashToScalarPrefixed(encode(Bm, a0, a1, a2, a3, 'Challenge'), ctx); - } - function generateProof(ctx, k, B, C, D, rng) { - const { M, Z } = computeCompositesFast(k, B, C, D, ctx); - const r = randomScalar(rng); - const t2 = Point.BASE.multiply(r); - const t3 = M.multiply(r); - const c = challengeTranscript(B, M, Z, t2, t3, ctx); - const s = Fn.sub(r, Fn.mul(c, k)); // r - c*k - return concatBytes(...[c, s].map((i) => Fn.toBytes(i))); - } - function verifyProof(ctx, B, C, D, proof) { - abytes(proof, 2 * Fn.BYTES); - const { M, Z } = computeComposites(B, C, D, ctx); - const [c, s] = [proof.subarray(0, Fn.BYTES), proof.subarray(Fn.BYTES)].map((f) => Fn.fromBytes(f)); - const t2 = Point.BASE.multiply(s).add(B.multiply(c)); // s*G + c*B - const t3 = M.multiply(s).add(Z.multiply(c)); // s*M + c*Z - const expectedC = challengeTranscript(B, M, Z, t2, t3, ctx); - if (!Fn.eql(c, expectedC)) - throw new Error('proof verification failed'); - } - function generateKeyPair() { - const skS = randomScalar(); - const pkS = Point.BASE.multiply(skS); - return { secretKey: Fn.toBytes(skS), publicKey: pkS.toBytes() }; - } - function deriveKeyPair(ctx, seed, info) { - // RFC 9497 §3.2.1 defines `seed[32]`; reject other sizes here because this public API already - // documents a 32-byte seed instead of generic input keying material. - abytes(seed, 32, 'seed'); - info = inputBytes('keyInfo', info); - const dst = concatBytes(asciiToBytes('DeriveKeyPair'), ctx); - const msg = concatBytes(seed, encode(info), Uint8Array.of(0)); - for (let counter = 0; counter <= 255; counter++) { - msg[msg.length - 1] = counter; - const skS = opts.hashToScalar(msg, { DST: dst }); - if (Fn.is0(skS)) - continue; // should not happen - return { - secretKey: Fn.toBytes(skS), - publicKey: Point.BASE.multiply(skS).toBytes(), - }; - } - throw new Error('Cannot derive key'); - } - const wirePoint = (label, bytes) => { - const point = Point.fromBytes(bytes); - // RFC 9497 §3.3 says applications MUST reject group-identity Elements received over the wire - // after deserialization, even if the suite decoder itself accepts the identity encoding. - if (point.equals(Point.ZERO)) - throw new Error(label + ' point at infinity'); - return point; - }; - function blind(ctx, input, rng = randomBytes) { - input = inputBytes('input', input); - const blind = randomScalar(rng); - const inputPoint = hashToGroup(input, ctx); - if (inputPoint.equals(Point.ZERO)) - throw new Error('Input point at infinity'); - const blinded = inputPoint.multiply(blind); - return { blind: Fn.toBytes(blind), blinded: blinded.toBytes() }; - } - function evaluate(ctx, secretKey, input) { - input = inputBytes('input', input); - const skS = Fn.fromBytes(secretKey); - const inputPoint = hashToGroup(input, ctx); - if (inputPoint.equals(Point.ZERO)) - throw new Error('Input point at infinity'); - const unblinded = inputPoint.multiply(skS).toBytes(); - return hashInput(input, unblinded); - } - const oprf = Object.freeze({ - generateKeyPair, - deriveKeyPair: (seed, keyInfo) => deriveKeyPair(ctxOPRF, seed, keyInfo), - blind: (input, rng = randomBytes) => blind(ctxOPRF, input, rng), - blindEvaluate(secretKey, blindedPoint) { - const skS = Fn.fromBytes(secretKey); - const elm = wirePoint('blinded', blindedPoint); - return elm.multiply(skS).toBytes(); - }, - finalize(input, blindBytes, evaluatedBytes) { - input = inputBytes('input', input); - const blind = Fn.fromBytes(blindBytes); - const evalPoint = wirePoint('evaluated', evaluatedBytes); - const unblinded = evalPoint.multiply(Fn.inv(blind)).toBytes(); - return hashInput(input, unblinded); - }, - evaluate: (secretKey, input) => evaluate(ctxOPRF, secretKey, input), - }); - const voprf = Object.freeze({ - generateKeyPair, - deriveKeyPair: (seed, keyInfo) => deriveKeyPair(ctxVOPRF, seed, keyInfo), - blind: (input, rng = randomBytes) => blind(ctxVOPRF, input, rng), - blindEvaluateBatch(secretKey, publicKey, blinded, rng = randomBytes) { - if (!Array.isArray(blinded)) - throw new Error('expected array'); - const skS = Fn.fromBytes(secretKey); - const pkS = wirePoint('public key', publicKey); - const blindedPoints = blinded.map((i) => wirePoint('blinded', i)); - const evaluated = blindedPoints.map((i) => i.multiply(skS)); - const proof = generateProof(ctxVOPRF, skS, pkS, blindedPoints, evaluated, rng); - return { evaluated: evaluated.map((i) => i.toBytes()), proof }; - }, - blindEvaluate(secretKey, publicKey, blinded, rng = randomBytes) { - const res = this.blindEvaluateBatch(secretKey, publicKey, [blinded], rng); - return { evaluated: res.evaluated[0], proof: res.proof }; - }, - finalizeBatch(items, publicKey, proof) { - if (!Array.isArray(items)) - throw new Error('expected array'); - const pkS = wirePoint('public key', publicKey); - const blindedPoints = items.map((i) => wirePoint('blinded', i.blinded)); - const evalPoints = items.map((i) => wirePoint('evaluated', i.evaluated)); - verifyProof(ctxVOPRF, pkS, blindedPoints, evalPoints, proof); - return items.map((i) => oprf.finalize(i.input, i.blind, i.evaluated)); - }, - finalize(input, blind, evaluated, blinded, publicKey, proof) { - return this.finalizeBatch([{ input, blind, evaluated, blinded }], publicKey, proof)[0]; - }, - evaluate: (secretKey, input) => evaluate(ctxVOPRF, secretKey, input), - }); - // NOTE: info is domain separation - const poprf = (info) => { - info = inputBytes('info', info); - const m = hashToScalarPrefixed(encode('Info', info), ctxPOPRF); - const T = Point.BASE.multiply(m); - return Object.freeze({ - generateKeyPair, - deriveKeyPair: (seed, keyInfo) => deriveKeyPair(ctxPOPRF, seed, keyInfo), - blind(input, publicKey, rng = randomBytes) { - input = inputBytes('input', input); - const pkS = wirePoint('public key', publicKey); - const tweakedKey = T.add(pkS); - if (tweakedKey.equals(Point.ZERO)) - throw new Error('tweakedKey point at infinity'); - const blind = randomScalar(rng); - const inputPoint = hashToGroup(input, ctxPOPRF); - if (inputPoint.equals(Point.ZERO)) - throw new Error('Input point at infinity'); - const blindedPoint = inputPoint.multiply(blind); - return { - blind: Fn.toBytes(blind), - blinded: blindedPoint.toBytes(), - tweakedKey: tweakedKey.toBytes(), - }; - }, - blindEvaluateBatch(secretKey, blinded, rng = randomBytes) { - if (!Array.isArray(blinded)) - throw new Error('expected array'); - const skS = Fn.fromBytes(secretKey); - const t = Fn.add(skS, m); - // "Hence, this error can be a signal for the server to replace its - // private key". We throw inside; this should be impossible. - const invT = Fn.inv(t); - const blindedPoints = blinded.map((i) => wirePoint('blinded', i)); - const evalPoints = blindedPoints.map((i) => i.multiply(invT)); - const tweakedKey = Point.BASE.multiply(t); - const proof = generateProof(ctxPOPRF, t, tweakedKey, evalPoints, blindedPoints, rng); - return { evaluated: evalPoints.map((i) => i.toBytes()), proof }; - }, - blindEvaluate(secretKey, blinded, rng = randomBytes) { - const res = this.blindEvaluateBatch(secretKey, [blinded], rng); - return { evaluated: res.evaluated[0], proof: res.proof }; - }, - finalizeBatch(items, proof, tweakedKey) { - if (!Array.isArray(items)) - throw new Error('expected array'); - const inputs = items.map((i) => inputBytes('input', i.input)); - const evalPoints = items.map((i) => wirePoint('evaluated', i.evaluated)); - verifyProof(ctxPOPRF, wirePoint('tweakedKey', tweakedKey), evalPoints, items.map((i) => wirePoint('blinded', i.blinded)), proof); - return items.map((i, j) => { - const blind = Fn.fromBytes(i.blind); - const point = evalPoints[j].multiply(Fn.inv(blind)).toBytes(); - return hashInput(inputs[j], info, point); - }); - }, - finalize(input, blind, evaluated, blinded, proof, tweakedKey) { - return this.finalizeBatch([{ input, blind, evaluated, blinded }], proof, tweakedKey)[0]; - }, - evaluate(secretKey, input) { - input = inputBytes('input', input); - const skS = Fn.fromBytes(secretKey); - const inputPoint = hashToGroup(input, ctxPOPRF); - if (inputPoint.equals(Point.ZERO)) - throw new Error('Input point at infinity'); - const t = Fn.add(skS, m); - const invT = Fn.inv(t); - const unblinded = inputPoint.multiply(invT).toBytes(); - return hashInput(input, info, unblinded); - }, - }); - }; - const res = { name, oprf, voprf, poprf, __tests: Object.freeze({ Fn }) }; - return Object.freeze(res); -} -//# sourceMappingURL=oprf.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/oprf.js.map b/node_modules/@noble/curves/abstract/oprf.js.map deleted file mode 100644 index 6d6380f..0000000 --- a/node_modules/@noble/curves/abstract/oprf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oprf.js","sourceRoot":"","sources":["../src/abstract/oprf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,sEAAsE;AACtE,OAAO,EACL,MAAM,EACN,YAAY,EACZ,eAAe,EACf,eAAe,EACf,WAAW,EACX,eAAe,EACf,WAAW,EACX,cAAc,GAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAwC,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,WAAW,EAAmB,MAAM,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,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBACnC,MAAM,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;gBACpC,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBAChD,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;gBAC9E,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBACzB,MAAM,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACvB,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;gBACtD,OAAO,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;YAC3C,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IACF,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;IACzE,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAe,CAAC;AAC1C,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/poseidon.d.ts b/node_modules/@noble/curves/abstract/poseidon.d.ts deleted file mode 100644 index 441f435..0000000 --- a/node_modules/@noble/curves/abstract/poseidon.d.ts +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Implements [Poseidon](https://www.poseidon-hash.info) ZK-friendly hash. - * - * There are many poseidon variants with different constants. - * We don't provide them: you should construct them manually. - * Check out [micro-starknet](https://github.com/paulmillr/micro-starknet) package for a proper example. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { type TArg, type TRet } from '../utils.ts'; -import { type IField } from './modular.ts'; -/** Core Poseidon permutation parameters shared by all variants. */ -export type PoseidonBasicOpts = { - /** Prime field used by the permutation. */ - Fp: IField; - /** Poseidon width `t = rate + capacity`. */ - t: number; - /** Number of full S-box rounds. */ - roundsFull: number; - /** Number of partial S-box rounds. */ - roundsPartial: number; - /** Whether to use the inverse S-box variant. */ - isSboxInverse?: boolean; -}; -/** Poseidon settings used by the Grain-LFSR constant generator. */ -export type PoseidonGrainOpts = PoseidonBasicOpts & { - /** S-box power used while generating constants. */ - sboxPower?: number; -}; -type PoseidonConstants = { - mds: bigint[][]; - roundConstants: bigint[][]; -}; -/** - * @param opts - Poseidon grain options. See {@link PoseidonGrainOpts}. - * @param skipMDS - Number of MDS samples to skip. - * @returns Generated constants. - * @throws If the generated MDS matrix contains a zero denominator. {@link Error} - * @example - * Generate Poseidon round constants and an MDS matrix from the Grain LFSR. - * - * ```ts - * import { grainGenConstants } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * ``` - */ -export declare function grainGenConstants(opts: TArg, skipMDS?: number): PoseidonConstants; -/** Fully specified Poseidon permutation options with explicit constants. */ -export type PoseidonOpts = PoseidonBasicOpts & PoseidonConstants & { - /** S-box power used by the permutation. */ - sboxPower?: number; - /** Whether to reverse the partial-round S-box index. */ - reversePartialPowIdx?: boolean; -}; -/** - * @param opts - Poseidon options. See {@link PoseidonOpts}. - * @returns Normalized poseidon options. - * @throws If the Poseidon options, constants, or MDS matrix are invalid. {@link Error} - * @example - * Validate generated constants before constructing a permutation. - * - * ```ts - * import { grainGenConstants, validateOpts } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const opts = validateOpts({ ...constants, Fp, t: 2, roundsFull: 8, roundsPartial: 8, sboxPower: 3 }); - * ``` - */ -export declare function validateOpts(opts: TArg): TRet bigint; - roundConstants: bigint[][]; - mds: bigint[][]; - Fp: IField; - t: number; - roundsFull: number; - roundsPartial: number; - sboxPower?: number; - reversePartialPowIdx?: boolean; -}>>; -/** - * @param rc - Flattened round constants. - * @param t - Poseidon width. - * @returns Constants grouped by round. - * @throws If the width or flattened constant array is invalid. {@link Error} - * @example - * Regroup a flat constant list into per-round chunks. - * - * ```ts - * const rounds = splitConstants([1n, 2n, 3n, 4n], 2); - * ``` - */ -export declare function splitConstants(rc: bigint[], t: number): bigint[][]; -/** - * Poseidon permutation callable. - * @param values - Poseidon state vector. Non-canonical bigints are normalized with `Fp.create(...)`. - * @returns Permuted state vector. - */ -export type PoseidonFn = { - (values: bigint[]): bigint[]; - /** Round constants captured by the permutation instance. */ - roundConstants: bigint[][]; -}; -/** Poseidon NTT-friendly hash. */ -/** - * @param opts - Poseidon options. See {@link PoseidonOpts}. - * @returns Poseidon permutation. - * @throws If the Poseidon options or state vector are invalid. {@link Error} - * @example - * Build a Poseidon permutation from validated parameters and constants. - * - * ```ts - * import { grainGenConstants, poseidon } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const hash = poseidon({ ...constants, Fp, t: 2, roundsFull: 8, roundsPartial: 8, sboxPower: 3 }); - * const state = hash([1n, 2n]); - * ``` - */ -export declare function poseidon(opts: TArg): PoseidonFn; -/** - * @param Fp - Field implementation. - * @param rate - Sponge rate. - * @param capacity - Sponge capacity. - * @param hash - Poseidon permutation. - * @example - * Wrap one Poseidon permutation in a sponge interface. - * - * ```ts - * import { PoseidonSponge, grainGenConstants, poseidon } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const hash = poseidon({ ...constants, Fp, t: 2, roundsFull: 8, roundsPartial: 8, sboxPower: 3 }); - * const sponge = new PoseidonSponge(Fp, 1, 1, hash); - * sponge.absorb([1n]); - * const out = sponge.squeeze(1); - * ``` - */ -export declare class PoseidonSponge { - private Fp; - readonly rate: number; - readonly capacity: number; - readonly hash: PoseidonFn; - private state; - private pos; - private isAbsorbing; - constructor(Fp: IField, rate: number, capacity: number, hash: PoseidonFn); - private process; - absorb(input: bigint[]): void; - squeeze(count: number): bigint[]; - clean(): void; - clone(): PoseidonSponge; -} -/** Options for the non-standard but commonly used Poseidon sponge wrapper. */ -export type PoseidonSpongeOpts = Omit & { - /** Sponge rate. */ - rate: number; - /** Sponge capacity. */ - capacity: number; -}; -/** - * The method is not defined in spec, but nevertheless used often. - * Check carefully for compatibility: there are many edge cases, like absorbing an empty array. - * We cross-test against: - * - {@link https://github.com/ProvableHQ/snarkVM/tree/staging/algorithms | snarkVM algorithms} - * - {@link https://github.com/arkworks-rs/crypto-primitives/tree/main | arkworks crypto-primitives} - * @param opts - Sponge options. See {@link PoseidonSpongeOpts}. - * @returns Factory for sponge instances. - * @throws If the sponge dimensions or backing permutation options are invalid. {@link Error} - * @example - * Use the sponge helper to absorb several field elements and squeeze one digest. - * - * ```ts - * import { grainGenConstants, poseidonSponge } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const makeSponge = poseidonSponge({ - * ...constants, - * Fp, - * rate: 1, - * capacity: 1, - * roundsFull: 8, - * roundsPartial: 8, - * sboxPower: 3, - * }); - * const sponge = makeSponge(); - * sponge.absorb([1n]); - * const out = sponge.squeeze(1); - * ``` - */ -export declare function poseidonSponge(opts: TArg): TRet<() => PoseidonSponge>; -export {}; -//# sourceMappingURL=poseidon.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/poseidon.d.ts.map b/node_modules/@noble/curves/abstract/poseidon.d.ts.map deleted file mode 100644 index 7741b16..0000000 --- a/node_modules/@noble/curves/abstract/poseidon.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"poseidon.d.ts","sourceRoot":"","sources":["../src/abstract/poseidon.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,sEAAsE;AACtE,OAAO,EAAuC,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAwB,KAAK,MAAM,EAAiB,MAAM,cAAc,CAAC;AA2BhF,mEAAmE;AACnE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACnB,4CAA4C;IAC5C,CAAC,EAAE,MAAM,CAAC;IACV,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAkEF,mEAAmE;AACnE,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG;IAClD,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IAAE,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,EAAE,CAAA;CAAE,CAAC;AAIzE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,EAC7B,OAAO,GAAE,MAAU,GAClB,iBAAiB,CA4BnB;AAED,4EAA4E;AAC5E,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAC1C,iBAAiB,GAAG;IAClB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,o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O,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,WAAW,CAAQ;gBAEf,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU;IAgBhF,OAAO,CAAC,OAAO;IAKf,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAgB7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAiBhC,KAAK,IAAI,IAAI;IAKb,KAAK,IAAI,cAAc;CAOxB;AAED,8EAA8E;AAC9E,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,GAAG;IACzD,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAaF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,MAAM,cAAc,CAAC,CAQzF"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/poseidon.js b/node_modules/@noble/curves/abstract/poseidon.js deleted file mode 100644 index 45fdceb..0000000 --- a/node_modules/@noble/curves/abstract/poseidon.js +++ /dev/null @@ -1,463 +0,0 @@ -/** - * Implements [Poseidon](https://www.poseidon-hash.info) ZK-friendly hash. - * - * There are many poseidon variants with different constants. - * We don't provide them: you should construct them manually. - * Check out [micro-starknet](https://github.com/paulmillr/micro-starknet) package for a proper example. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { asafenumber, bitGet, validateObject } from "../utils.js"; -import { FpInvertBatch, FpPow, validateField } from "./modular.js"; -// Grain LFSR (Linear-Feedback Shift Register): https://eprint.iacr.org/2009/109.pdf -function grainLFSR(state) { - // Advances the caller-provided 80-entry state array in place; only the length - // is checked here, so entries are assumed to already be bits. - let pos = 0; - if (state.length !== 80) - throw new Error('grainLFRS: wrong state length, should be 80 bits'); - const getBit = () => { - const r = (offset) => state[(pos + offset) % 80]; - const bit = r(62) ^ r(51) ^ r(38) ^ r(23) ^ r(13) ^ r(0); - state[pos] = bit; - pos = ++pos % 80; - return !!bit; - }; - for (let i = 0; i < 160; i++) - getBit(); - return () => { - // https://en.wikipedia.org/wiki/Shrinking_generator - while (true) { - const b1 = getBit(); - const b2 = getBit(); - if (!b1) - continue; - return b2; - } - }; -} -function assertValidPosOpts(opts) { - const { Fp, roundsFull } = opts; - validateField(Fp); - validateObject(opts, { - t: 'number', - roundsFull: 'number', - roundsPartial: 'number', - }, { - isSboxInverse: 'boolean', - }); - for (const k of ['t', 'roundsFull', 'roundsPartial']) { - asafenumber(opts[k], k); - if (opts[k] < 1) - throw new Error('invalid number ' + k); - } - // Poseidon splits full rounds as `R_F / 2`, then partial rounds, then `R_F / 2` again. - if (roundsFull & 1) - throw new Error('roundsFull is not even' + roundsFull); -} -function poseidonGrain(opts) { - assertValidPosOpts(opts); - const { Fp } = opts; - const state = Array(80).fill(1); - let pos = 0; - const writeBits = (value, bitCount) => { - for (let i = bitCount - 1; i >= 0; i--) - state[pos++] = Number(bitGet(value, i)); - }; - const _0n = BigInt(0); - const _1n = BigInt(1); - // The Grain seed layout is fixed-width: `Fp.BITS` and `t` use 12 bits, - // `roundsFull` and `roundsPartial` use 10, so larger values are truncated here. - // This is intentional for compatibility with snarkVM / arkworks PoseidonGrainLFSR: - // they write the same fixed-width seed fields without range checks, then still consume - // the LFSR using the caller-provided round count for ARK/MDS generation. - // Normalizing or rejecting here would diverge from those implementations. - writeBits(_1n, 2); // prime field - writeBits(opts.isSboxInverse ? _1n : _0n, 4); // b2..b5 - writeBits(BigInt(Fp.BITS), 12); // b6..b17 - writeBits(BigInt(opts.t), 12); // b18..b29 - writeBits(BigInt(opts.roundsFull), 10); // b30..b39 - writeBits(BigInt(opts.roundsPartial), 10); // b40..b49 - const getBit = grainLFSR(state); - return (count, reject) => { - const res = []; - for (let i = 0; i < count; i++) { - while (true) { - let num = _0n; - for (let i = 0; i < Fp.BITS; i++) { - num <<= _1n; - if (getBit()) - num |= _1n; - } - if (reject && num >= Fp.ORDER) - continue; // rejection sampling - res.push(Fp.create(num)); - break; - } - } - return res; - }; -} -// NOTE: this is not standard but used often for constant generation for poseidon -// (grain LFRS-like structure) -/** - * @param opts - Poseidon grain options. See {@link PoseidonGrainOpts}. - * @param skipMDS - Number of MDS samples to skip. - * @returns Generated constants. - * @throws If the generated MDS matrix contains a zero denominator. {@link Error} - * @example - * Generate Poseidon round constants and an MDS matrix from the Grain LFSR. - * - * ```ts - * import { grainGenConstants } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * ``` - */ -export function grainGenConstants(opts, skipMDS = 0) { - const { Fp, t, roundsFull, roundsPartial } = opts; - // `skipMDS` counts how many candidate matrices to discard before taking one. - asafenumber(skipMDS, 'skipMDS'); - if (skipMDS < 0) - throw new Error('invalid number skipMDS'); - const rounds = roundsFull + roundsPartial; - // `sboxPower` is carried in the opts shape for Poseidon compatibility, but - // Grain constant generation here only depends on field/size/round counts/inverse flag. - const sample = poseidonGrain(opts); - const roundConstants = []; - for (let r = 0; r < rounds; r++) - roundConstants.push(sample(t, true)); - if (skipMDS > 0) - for (let i = 0; i < skipMDS; i++) - sample(2 * t, false); - const xs = sample(t, false); - const ys = sample(t, false); - // Construct MDS Matrix M[i][j] = 1 / (xs[i] + ys[j]) - const mds = []; - for (let i = 0; i < t; i++) { - const row = []; - for (let j = 0; j < t; j++) { - const xy = Fp.add(xs[i], ys[j]); - if (Fp.is0(xy)) - throw new Error(`Error generating MDS matrix: xs[${i}] + ys[${j}] resulted in zero.`); - row.push(xy); - } - mds.push(FpInvertBatch(Fp, row)); - } - return { roundConstants, mds }; -} -/** - * @param opts - Poseidon options. See {@link PoseidonOpts}. - * @returns Normalized poseidon options. - * @throws If the Poseidon options, constants, or MDS matrix are invalid. {@link Error} - * @example - * Validate generated constants before constructing a permutation. - * - * ```ts - * import { grainGenConstants, validateOpts } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const opts = validateOpts({ ...constants, Fp, t: 2, roundsFull: 8, roundsPartial: 8, sboxPower: 3 }); - * ``` - */ -export function validateOpts(opts) { - // This only normalizes shapes and field membership for the provided constants; - // it does not prove the stronger MDS/security criteria discussed in the specs. - assertValidPosOpts(opts); - const { Fp, mds, reversePartialPowIdx: rev, roundConstants: rc } = opts; - const { roundsFull, roundsPartial, sboxPower, t } = opts; - // MDS is TxT matrix - if (!Array.isArray(mds) || mds.length !== t) - throw new Error('Poseidon: invalid MDS matrix'); - const _mds = mds.map((mdsRow) => { - if (!Array.isArray(mdsRow) || mdsRow.length !== t) - throw new Error('invalid MDS matrix row: ' + mdsRow); - return mdsRow.map((i) => { - if (typeof i !== 'bigint') - throw new Error('invalid MDS matrix bigint: ' + i); - // Hardcoded Poseidon MDS matrices often use signed entries like `-1`; - // accept bigint representatives here and reduce them into the field. - return Fp.create(i); - }); - }); - if (rev !== undefined && typeof rev !== 'boolean') - throw new Error('invalid param reversePartialPowIdx=' + rev); - if (roundsFull & 1) - throw new Error('roundsFull is not even' + roundsFull); - const rounds = roundsFull + roundsPartial; - if (!Array.isArray(rc) || rc.length !== rounds) - throw new Error('Poseidon: invalid round constants'); - const roundConstants = rc.map((rc) => { - if (!Array.isArray(rc) || rc.length !== t) - throw new Error('invalid round constants'); - return rc.map((i) => { - if (typeof i !== 'bigint' || !Fp.isValid(i)) - throw new Error('invalid round constant'); - return Fp.create(i); - }); - }); - // Freeze nested constants so exported handles cannot retune a live permutation instance. - const freezeRows = (rows) => Object.freeze(rows.map((row) => Object.freeze(row))); - if (!sboxPower || ![3, 5, 7, 17].includes(sboxPower)) - throw new Error('invalid sboxPower'); - const _sboxPower = BigInt(sboxPower); - let sboxFn = (n) => FpPow(Fp, n, _sboxPower); - // Unwrapped sbox power for common cases (195->142μs) - if (sboxPower === 3) - sboxFn = (n) => Fp.mul(Fp.sqrN(n), n); - else if (sboxPower === 5) - sboxFn = (n) => Fp.mul(Fp.sqrN(Fp.sqrN(n)), n); - return Object.freeze({ - ...opts, - rounds, - sboxFn, - roundConstants: freezeRows(roundConstants), - mds: freezeRows(_mds), - }); -} -/** - * @param rc - Flattened round constants. - * @param t - Poseidon width. - * @returns Constants grouped by round. - * @throws If the width or flattened constant array is invalid. {@link Error} - * @example - * Regroup a flat constant list into per-round chunks. - * - * ```ts - * const rounds = splitConstants([1n, 2n, 3n, 4n], 2); - * ``` - */ -export function splitConstants(rc, t) { - asafenumber(t, 't'); - if (t < 1) - throw new Error('poseidonSplitConstants: invalid t'); - if (!Array.isArray(rc) || rc.length % t) - throw new Error('poseidonSplitConstants: invalid rc'); - const res = []; - let tmp = []; - for (let i = 0; i < rc.length; i++) { - const c = rc[i]; - if (typeof c !== 'bigint') - throw new Error('invalid bigint=' + c); - tmp.push(c); - if (tmp.length === t) { - res.push(tmp); - tmp = []; - } - } - return res; -} -/** Poseidon NTT-friendly hash. */ -/** - * @param opts - Poseidon options. See {@link PoseidonOpts}. - * @returns Poseidon permutation. - * @throws If the Poseidon options or state vector are invalid. {@link Error} - * @example - * Build a Poseidon permutation from validated parameters and constants. - * - * ```ts - * import { grainGenConstants, poseidon } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const hash = poseidon({ ...constants, Fp, t: 2, roundsFull: 8, roundsPartial: 8, sboxPower: 3 }); - * const state = hash([1n, 2n]); - * ``` - */ -export function poseidon(opts) { - const _opts = validateOpts(opts); - const { Fp, mds, roundConstants, rounds: totalRounds, roundsPartial, sboxFn, t } = _opts; - const halfRoundsFull = _opts.roundsFull / 2; - const partialIdx = _opts.reversePartialPowIdx ? t - 1 : 0; - const poseidonRound = (values, isFull, idx) => { - values = values.map((i, j) => Fp.add(i, roundConstants[idx][j])); - if (isFull) - values = values.map((i) => sboxFn(i)); - else - values[partialIdx] = sboxFn(values[partialIdx]); - // Matrix multiplication - values = mds.map((i) => i.reduce((acc, i, j) => Fp.add(acc, Fp.mulN(i, values[j])), Fp.ZERO)); - return values; - }; - const poseidonHash = function poseidonHash(values) { - if (!Array.isArray(values) || values.length !== t) - throw new Error('invalid values, expected array of bigints with length ' + t); - // `.map()` skips sparse holes, which would leak `undefined` into round math below. - values = values.slice(); - for (let j = 0; j < values.length; j++) { - const i = values[j]; - if (typeof i !== 'bigint') - throw new Error('invalid bigint=' + i); - values[j] = Fp.create(i); - } - let lastRound = 0; - // Apply r_f/2 full rounds. - for (let i = 0; i < halfRoundsFull; i++) - values = poseidonRound(values, true, lastRound++); - // Apply r_p partial rounds. - for (let i = 0; i < roundsPartial; i++) - values = poseidonRound(values, false, lastRound++); - // Apply r_f/2 full rounds. - for (let i = 0; i < halfRoundsFull; i++) - values = poseidonRound(values, true, lastRound++); - if (lastRound !== totalRounds) - throw new Error('invalid number of rounds'); - return values; - }; - // For verification in tests - Object.defineProperty(poseidonHash, 'roundConstants', { - value: roundConstants, - enumerable: true, - }); - return poseidonHash; -} -/** - * @param Fp - Field implementation. - * @param rate - Sponge rate. - * @param capacity - Sponge capacity. - * @param hash - Poseidon permutation. - * @example - * Wrap one Poseidon permutation in a sponge interface. - * - * ```ts - * import { PoseidonSponge, grainGenConstants, poseidon } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const hash = poseidon({ ...constants, Fp, t: 2, roundsFull: 8, roundsPartial: 8, sboxPower: 3 }); - * const sponge = new PoseidonSponge(Fp, 1, 1, hash); - * sponge.absorb([1n]); - * const out = sponge.squeeze(1); - * ``` - */ -export class PoseidonSponge { - Fp; - rate; - capacity; - hash; - state; // [...capacity, ...rate] - pos = 0; - isAbsorbing = true; - constructor(Fp, rate, capacity, hash) { - const width = spongeShape(rate, capacity); - // The direct constructor accepts an arbitrary permutation hook, but callers still - // need to preserve the `PoseidonFn.roundConstants` width metadata. Reject width - // mismatches here instead of deferring them until the first `process()` call. - if (width !== hash.roundConstants[0]?.length) - throw new Error(`invalid sponge width: expected ${hash.roundConstants[0]?.length}, got ${width}`); - this.Fp = Fp; - this.hash = hash; - this.rate = rate; - this.capacity = capacity; - this.state = new Array(width); - this.clean(); - } - process() { - // The permutation is expected to return an owned state array. If callers inject a custom - // hook that reuses external storage, `clean()` will zero that shared buffer too. - this.state = this.hash(this.state); - } - absorb(input) { - for (const i of input) - if (typeof i !== 'bigint' || !this.Fp.isValid(i)) - throw new Error('invalid input: ' + i); - for (let i = 0; i < input.length;) { - if (!this.isAbsorbing || this.pos === this.rate) { - this.process(); - this.pos = 0; - this.isAbsorbing = true; - } - const chunk = Math.min(this.rate - this.pos, input.length - i); - for (let j = 0; j < chunk; j++) { - const idx = this.capacity + this.pos++; - this.state[idx] = this.Fp.add(this.state[idx], input[i++]); - } - } - } - squeeze(count) { - // Rust oracles use unsigned counts. In JS we keep `squeeze(0) => []` for - // compatibility, but still reject negative/fractional counts explicitly. - asafenumber(count, 'count'); - if (count < 0) - throw new Error('invalid number count'); - const res = []; - while (res.length < count) { - if (this.isAbsorbing || this.pos === this.rate) { - this.process(); - this.pos = 0; - this.isAbsorbing = false; - } - const chunk = Math.min(this.rate - this.pos, count - res.length); - for (let i = 0; i < chunk; i++) - res.push(this.state[this.capacity + this.pos++]); - } - return res; - } - clean() { - this.state.fill(this.Fp.ZERO); - this.isAbsorbing = true; - this.pos = 0; - } - clone() { - const c = new PoseidonSponge(this.Fp, this.rate, this.capacity, this.hash); - c.pos = this.pos; - c.isAbsorbing = this.isAbsorbing; - c.state = [...this.state]; - return c; - } -} -const spongeShape = (rate, capacity) => { - asafenumber(rate, 'rate'); - asafenumber(capacity, 'capacity'); - // A sponge with zero rate cannot absorb or squeeze any field elements. - if (rate < 1) - throw new Error('invalid number rate'); - // Negative capacity can accidentally keep `rate + capacity` coherent while still - // producing a nonsensical sponge shape. - if (capacity < 0) - throw new Error('invalid number capacity'); - return rate + capacity; -}; -/** - * The method is not defined in spec, but nevertheless used often. - * Check carefully for compatibility: there are many edge cases, like absorbing an empty array. - * We cross-test against: - * - {@link https://github.com/ProvableHQ/snarkVM/tree/staging/algorithms | snarkVM algorithms} - * - {@link https://github.com/arkworks-rs/crypto-primitives/tree/main | arkworks crypto-primitives} - * @param opts - Sponge options. See {@link PoseidonSpongeOpts}. - * @returns Factory for sponge instances. - * @throws If the sponge dimensions or backing permutation options are invalid. {@link Error} - * @example - * Use the sponge helper to absorb several field elements and squeeze one digest. - * - * ```ts - * import { grainGenConstants, poseidonSponge } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const makeSponge = poseidonSponge({ - * ...constants, - * Fp, - * rate: 1, - * capacity: 1, - * roundsFull: 8, - * roundsPartial: 8, - * sboxPower: 3, - * }); - * const sponge = makeSponge(); - * sponge.absorb([1n]); - * const out = sponge.squeeze(1); - * ``` - */ -export function poseidonSponge(opts) { - const { rate, capacity } = opts; - const t = spongeShape(rate, capacity); - // Re-use one hash instance between sponge instances; isolation depends on - // poseidon(...) itself staying immutable and not carrying mutable call state. - const hash = poseidon({ ...opts, t }); - const { Fp } = opts; - return (() => new PoseidonSponge(Fp, rate, capacity, hash)); -} -//# sourceMappingURL=poseidon.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/poseidon.js.map b/node_modules/@noble/curves/abstract/poseidon.js.map deleted file mode 100644 index 97036f0..0000000 --- a/node_modules/@noble/curves/abstract/poseidon.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"poseidon.js","sourceRoot":"","sources":["../src/abstract/poseidon.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,sEAAsE;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,KAAK,EAAe,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhF,oFAAoF;AACpF,SAAS,SAAS,CAAC,KAAe;IAChC,8EAA8E;IAC9E,8DAA8D;IAC9D,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAC7F,MAAM,MAAM,GAAG,GAAY,EAAE;QAC3B,MAAM,CAAC,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACzD,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;QACjB,GAAG,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC,GAAG,CAAC;IACf,CAAC,CAAC;IACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE;QAAE,MAAM,EAAE,CAAC;IACvC,OAAO,GAAG,EAAE;QACV,oDAAo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AG,CAAC,IAAY,EAAE,QAAgB,EAAE,EAAE;IACrD,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1B,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAClC,uEAAuE;IACvE,IAAI,IAAI,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACrD,iFAAiF;IACjF,wCAAwC;IACxC,IAAI,QAAQ,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7D,OAAO,IAAI,GAAG,QAAQ,CAAC;AACzB,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,cAAc,CAAC,IAA8B;IAC3D,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAChC,MAAM,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACtC,0EAA0E;IAC1E,8EAA8E;IAC9E,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IACpB,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAA+B,CAAC;AAC5F,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/tower.d.ts b/node_modules/@noble/curves/abstract/tower.d.ts deleted file mode 100644 index 02559d8..0000000 --- a/node_modules/@noble/curves/abstract/tower.d.ts +++ /dev/null @@ -1,214 +0,0 @@ -/** - * Towered extension fields. - * Rather than implementing a massive 12th-degree extension directly, it is more efficient - * to build it up from smaller extensions: a tower of extensions. - * - * For BLS12-381, the Fp12 field is implemented as a quadratic (degree two) extension, - * on top of a cubic (degree three) extension, on top of a quadratic extension of Fp. - * - * For more info: "Pairings for beginners" by Costello, section 7.3. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { type TArg, type TRet } from '../utils.ts'; -import * as mod from './modular.ts'; -import type { WeierstrassPoint, WeierstrassPointCons } from './weierstrass.ts'; -/** Pair of bigints used for quadratic-extension tuples. */ -export type BigintTuple = [bigint, bigint]; -/** Prime-field element. */ -export type Fp = bigint; -/** Quadratic-extension field element `c0 + c1 * u`. */ -export type Fp2 = { - /** Real component. */ - c0: bigint; - /** Imaginary component. */ - c1: bigint; -}; -/** Six bigints used for sextic-extension tuples. */ -export type BigintSix = [bigint, bigint, bigint, bigint, bigint, bigint]; -/** Sextic-extension field element `c0 + c1 * v + c2 * v^2`. */ -export type Fp6 = { - /** Constant coefficient. */ - c0: Fp2; - /** Linear coefficient. */ - c1: Fp2; - /** Quadratic coefficient. */ - c2: Fp2; -}; -/** - * Degree-12 extension field element `c0 + c1 * w`. - * Fp₁₂ = Fp₆² over Fp₂³, with Fp₆(w) / (w² - γ) where γ = v. - */ -export type Fp12 = { - /** Constant coefficient. */ - c0: Fp6; - /** Linear coefficient. */ - c1: Fp6; -}; -/** Twelve bigints used for degree-12 extension tuples. */ -export type BigintTwelve = [ - bigint, - bigint, - bigint, - bigint, - bigint, - bigint, - bigint, - bigint, - bigint, - bigint, - bigint, - bigint -]; -/** BLS-friendly helpers on top of the quadratic extension field. */ -export type Fp2Bls = mod.IField & { - /** Underlying prime field. */ - Fp: mod.IField; - /** Apply one Frobenius map. */ - frobeniusMap(num: Fp2, power: number): Fp2; - /** Build one field element from a raw bigint tuple. */ - fromBigTuple(num: BigintTuple): Fp2; - /** Multiply by the curve `b` constant. */ - mulByB: (num: Fp2) => Fp2; - /** Multiply by the quadratic non-residue. */ - mulByNonresidue: (num: Fp2) => Fp2; - /** Split one quadratic element into real and imaginary components. */ - reim: (num: Fp2) => { - re: Fp; - im: Fp; - }; - /** Specialized helper used by sextic squaring formulas. */ - Fp4Square: (a: Fp2, b: Fp2) => { - first: Fp2; - second: Fp2; - }; - /** Quadratic non-residue used by the extension. */ - NONRESIDUE: Fp2; -}; -/** BLS-friendly helpers on top of the sextic extension field. */ -export type Fp6Bls = mod.IField & { - /** Underlying quadratic extension field. */ - Fp2: Fp2Bls; - /** Apply one Frobenius map. */ - frobeniusMap(num: Fp6, power: number): Fp6; - /** Build one field element from a raw six-bigint tuple. */ - fromBigSix: (tuple: BigintSix) => Fp6; - /** Multiply by a sparse `(0, b1, 0)` sextic element. */ - mul1(num: Fp6, b1: Fp2): Fp6; - /** Multiply by a sparse `(b0, b1, 0)` sextic element. */ - mul01(num: Fp6, b0: Fp2, b1: Fp2): Fp6; - /** Multiply by one quadratic-extension element. */ - mulByFp2(lhs: Fp6, rhs: Fp2): Fp6; - /** Multiply by the sextic non-residue. */ - mulByNonresidue: (num: Fp6) => Fp6; -}; -/** BLS-friendly helpers on top of the degree-12 extension field. */ -export type Fp12Bls = mod.IField & { - /** Underlying sextic extension field. */ - Fp6: Fp6Bls; - /** Apply one Frobenius map. */ - frobeniusMap(num: Fp12, power: number): Fp12; - /** Build one field element from a raw twelve-bigint tuple. */ - fromBigTwelve: (t: BigintTwelve) => Fp12; - /** Multiply by a sparse `(o0, o1, 0, 0, o4, 0)` element. */ - mul014(num: Fp12, o0: Fp2, o1: Fp2, o4: Fp2): Fp12; - /** Multiply by a sparse `(o0, 0, 0, o3, o4, 0)` element. */ - mul034(num: Fp12, o0: Fp2, o3: Fp2, o4: Fp2): Fp12; - /** Multiply by one quadratic-extension element. */ - mulByFp2(lhs: Fp12, rhs: Fp2): Fp12; - /** Conjugate one degree-12 element. */ - conjugate(num: Fp12): Fp12; - /** Apply the final exponentiation from pairing arithmetic. */ - finalExponentiate(num: Fp12): Fp12; - /** Apply one cyclotomic square. */ - _cyclotomicSquare(num: Fp12): Fp12; - /** Apply one cyclotomic exponentiation. */ - _cyclotomicExp(num: Fp12, n: bigint): Fp12; -}; -declare function calcFrobeniusCoefficients(Fp: TArg>, nonResidue: T, modulus: bigint, degree: number, num?: number, divisor?: number): T[][]; -export declare const __TEST: { - calcFrobeniusCoefficients: typeof calcFrobeniusCoefficients; -}; -/** - * @param Fp - Base field implementation. - * @param Fp2 - Quadratic extension field. - * @param base - Twist-specific Frobenius base whose powers yield the `c1` / `c2` constants. - * BLS12-381 uses `1 / NONRESIDUE`; BN254 uses `NONRESIDUE`. - * @returns Frobenius endomorphism helpers. - * @throws If the derived Frobenius constants are inconsistent for the tower. {@link Error} - * @example - * Build Frobenius endomorphism helpers for a BLS extension tower. - * - * ```ts - * import { psiFrobenius } from '@noble/curves/abstract/tower.js'; - * import { bls12_381 } from '@noble/curves/bls12-381.js'; - * const Fp = bls12_381.fields.Fp; - * const Fp2 = bls12_381.fields.Fp2; - * const frob = psiFrobenius(Fp, Fp2, Fp2.div(Fp2.ONE, Fp2.NONRESIDUE)); - * const point = frob.G2psi(bls12_381.G2.Point, bls12_381.G2.Point.BASE); - * ``` - */ -export declare function psiFrobenius(Fp: TArg>, Fp2: TArg, base: TArg): { - psi: (x: Fp2, y: Fp2) => [Fp2, Fp2]; - psi2: (x: Fp2, y: Fp2) => [Fp2, Fp2]; - G2psi: (c: WeierstrassPointCons, P: WeierstrassPoint) => WeierstrassPoint; - G2psi2: (c: WeierstrassPointCons, P: WeierstrassPoint) => WeierstrassPoint; - PSI_X: Fp2; - PSI_Y: Fp2; - PSI2_X: Fp2; - PSI2_Y: Fp2; -}; -/** Construction options for the BLS-style degree-12 tower. */ -export type Tower12Opts = { - /** Prime-field order. */ - ORDER: bigint; - /** Bit length of the BLS parameter `x`. */ - X_LEN: number; - /** Prime-field non-residue used by the quadratic extension. */ - NONRESIDUE?: Fp; - /** Quadratic-extension non-residue used by the sextic tower. */ - FP2_NONRESIDUE: BigintTuple; - /** - * Optional custom quadratic square-root helper. - * Receives one quadratic-extension element and returns one square root. - */ - Fp2sqrt?: (num: Fp2) => Fp2; - /** - * Multiply one quadratic element by the curve `b` constant. - * @param num - Quadratic-extension element to scale. - * @returns Product by the curve `b` constant. - */ - Fp2mulByB: (num: Fp2) => Fp2; - /** - * Final exponentiation used by pairing arithmetic. - * @param num - Degree-12 field element to exponentiate. - * @returns Pairing result after final exponentiation. - */ - Fp12finalExponentiate: (num: Fp12) => Fp12; -}; -/** - * @param opts - Tower construction options. See {@link Tower12Opts}. - * @returns BLS tower fields. - * @throws If the tower options or derived Frobenius helpers are invalid. {@link Error} - * @example - * Construct the Fp2/Fp6/Fp12 tower used by a pairing-friendly curve. - * - * ```ts - * const fields = tower12({ - * ORDER: 17n, - * X_LEN: 4, - * FP2_NONRESIDUE: [1n, 1n], - * Fp2mulByB: (num) => num, - * Fp12finalExponentiate: (num) => num, - * }); - * const fp12 = fields.Fp12.ONE; - * ``` - */ -export declare function tower12(opts: TArg): TRet<{ - Fp: Readonly & Required, 'isOdd'>>>; - Fp2: Fp2Bls; - Fp6: Fp6Bls; - Fp12: Fp12Bls; -}>; -export {}; -//# sourceMappingURL=tower.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/tower.d.ts.map b/node_modules/@noble/curves/abstract/tower.d.ts.map deleted file mode 100644 index 7991bc0..0000000 --- a/node_modules/@noble/curves/abstract/tower.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tower.d.ts","sourceRoot":"","sources":["../src/abstract/tower.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,sEAAsE;AACtE,OAAO,EASL,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAO/E,2DAA2D;AAC3D,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC3C,2BAA2B;AAC3B,MAAM,MAAM,EAAE,GAAG,MAAM,CAAC;AAGxB,u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ACH,qBAAqB,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;CAC5C,CAAC;AAyyBF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IACrD,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/E,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;CACf,CAAC,CA6BD"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/tower.js b/node_modules/@noble/curves/abstract/tower.js deleted file mode 100644 index c1f8420..0000000 --- a/node_modules/@noble/curves/abstract/tower.js +++ /dev/null @@ -1,926 +0,0 @@ -/** - * Towered extension fields. - * Rather than implementing a massive 12th-degree extension directly, it is more efficient - * to build it up from smaller extensions: a tower of extensions. - * - * For BLS12-381, the Fp12 field is implemented as a quadratic (degree two) extension, - * on top of a cubic (degree three) extension, on top of a quadratic extension of Fp. - * - * For more info: "Pairings for beginners" by Costello, section 7.3. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { abytes, aInRange, asafenumber, bitGet, bitLen, concatBytes, notImplemented, validateObject, } from "../utils.js"; -import * as mod from "./modular.js"; -// Be friendly to bad ECMAScript parsers by not using bigint literals -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3), _6n = /* @__PURE__ */ BigInt(6), _12n = /* @__PURE__ */ BigInt(12); -const isObj = (value) => !!value && typeof value === 'object'; -function calcFrobeniusCoefficients(Fp, nonResidue, modulus, degree, num = 1, divisor) { - asafenumber(num, 'num'); - const F = Fp; - // Generic callers can hit empty / fractional row counts through `__TEST`; fail closed instead of - // silently returning `[]` or deriving extra Frobenius rows from a truncated loop bound. - if (num <= 0) - throw new Error('calcFrobeniusCoefficients: expected positive row count, got ' + num); - const _divisor = BigInt(divisor === undefined ? degree : divisor); - const towerModulus = modulus ** BigInt(degree); - const res = []; - // Derive tower-basis multipliers for the `p^k` Frobenius action. The - // divisions below are expected to be exact for the chosen tower parameters. - for (let i = 0; i < num; i++) { - const a = BigInt(i + 1); - const powers = []; - for (let j = 0, qPower = _1n; j < degree; j++) { - const numer = a * qPower - a; - // Shipped towers divide cleanly here, but generic callers can pick bad - // params. Bigint division would floor and derive the wrong Frobenius table. - if (numer % _divisor) - throw new Error('calcFrobeniusCoefficients: inexact tower exponent'); - const power = (numer / _divisor) % towerModulus; - powers.push(F.pow(nonResidue, power)); - qPower *= modulus; - } - res.push(powers); - } - return res; -} -export const __TEST = -/* @__PURE__ */ Object.freeze({ - calcFrobeniusCoefficients, -}); -// This works same at least for bls12-381, bn254 and bls12-377 -/** - * @param Fp - Base field implementation. - * @param Fp2 - Quadratic extension field. - * @param base - Twist-specific Frobenius base whose powers yield the `c1` / `c2` constants. - * BLS12-381 uses `1 / NONRESIDUE`; BN254 uses `NONRESIDUE`. - * @returns Frobenius endomorphism helpers. - * @throws If the derived Frobenius constants are inconsistent for the tower. {@link Error} - * @example - * Build Frobenius endomorphism helpers for a BLS extension tower. - * - * ```ts - * import { psiFrobenius } from '@noble/curves/abstract/tower.js'; - * import { bls12_381 } from '@noble/curves/bls12-381.js'; - * const Fp = bls12_381.fields.Fp; - * const Fp2 = bls12_381.fields.Fp2; - * const frob = psiFrobenius(Fp, Fp2, Fp2.div(Fp2.ONE, Fp2.NONRESIDUE)); - * const point = frob.G2psi(bls12_381.G2.Point, bls12_381.G2.Point.BASE); - * ``` - */ -export function psiFrobenius(Fp, Fp2, base) { - // GLV endomorphism Ψ(P) - const PSI_X = Fp2.pow(base, (Fp.ORDER - _1n) / _3n); // u^((p-1)/3) - const PSI_Y = Fp2.pow(base, (Fp.ORDER - _1n) / _2n); // u^((p-1)/2) - function psi(x, y) { - // This x10 faster than previous version in bls12-381 - const x2 = Fp2.mul(Fp2.frobeniusMap(x, 1), PSI_X); - const y2 = Fp2.mul(Fp2.frobeniusMap(y, 1), PSI_Y); - return [x2, y2]; - } - // Ψ²(P) endomorphism (psi2(x) = psi(psi(x))) - const PSI2_X = Fp2.pow(base, (Fp.ORDER ** _2n - _1n) / _3n); // u^((p^2 - 1)/3) - // Current towers rely on this landing on `-1`, which lets psi2 map `y` with - // one negation instead of carrying a separate Frobenius multiplier. - const PSI2_Y = Fp2.pow(base, (Fp.ORDER ** _2n - _1n) / _2n); // u^((p^2 - 1)/2) - if (!Fp2.eql(PSI2_Y, Fp2.neg(Fp2.ONE))) - throw new Error('psiFrobenius: PSI2_Y!==-1'); - function psi2(x, y) { - return [Fp2.mul(x, PSI2_X), Fp2.neg(y)]; - } - // Map points - const mapAffine = (fn) => (c, P) => { - const affine = P.toAffine(); - const p = fn(affine.x, affine.y); - return c.fromAffine({ x: p[0], y: p[1] }); - }; - const G2psi = mapAffine(psi); - const G2psi2 = mapAffine(psi2); - return { psi, psi2, G2psi, G2psi2, PSI_X, PSI_Y, PSI2_X, PSI2_Y }; -} -class _Field2 { - ORDER; - BITS; - BYTES; - isLE; - ZERO; - ONE; - Fp; - NONRESIDUE; - mulByB; - Fp_NONRESIDUE; - Fp_div2; - FROBENIUS_COEFFICIENTS; - constructor(Fp, opts = {}) { - const { NONRESIDUE = BigInt(-1), FP2_NONRESIDUE, Fp2mulByB } = opts; - const ORDER = Fp.ORDER; - const FP2_ORDER = ORDER * ORDER; - this.Fp = Fp; - this.ORDER = FP2_ORDER; - this.BITS = bitLen(FP2_ORDER); - this.BYTES = Math.ceil(bitLen(FP2_ORDER) / 8); - this.isLE = Fp.isLE; - this.ZERO = this.create({ c0: Fp.ZERO, c1: Fp.ZERO }); - this.ONE = this.create({ c0: Fp.ONE, c1: Fp.ZERO }); - // These knobs only swap constants for the shipped quadratic tower shape: - // arithmetic below assumes `u^2 = -1`, and bytes are handled as two adjacent - // `Fp` limbs (`fromBytes` / `toBytes` expect the shipped `2 * Fp.BYTES` layout). - this.Fp_NONRESIDUE = Fp.create(NONRESIDUE); - this.Fp_div2 = Fp.div(Fp.ONE, _2n); // 1/2 - this.NONRESIDUE = this.create({ c0: FP2_NONRESIDUE[0], c1: FP2_NONRESIDUE[1] }); - // const Fp2Nonresidue = this.create({ c0: FP2_NONRESIDUE![0], c1: FP2_NONRESIDUE![1] }); - this.FROBENIUS_COEFFICIENTS = Object.freeze(calcFrobeniusCoefficients(Fp, this.Fp_NONRESIDUE, Fp.ORDER, 2)[0]); - this.mulByB = (num) => { - // This config hook is trusted to return a canonical Fp2 value already. - // Copy+freeze it to keep the tower immutability invariant without mutating caller objects. - const { c0, c1 } = Fp2mulByB(num); - return Object.freeze({ c0, c1 }); - }; - Object.freeze(this); - } - fromBigTuple(tuple) { - if (!Array.isArray(tuple) || tuple.length !== 2) - throw new Error('invalid Fp2.fromBigTuple'); - const [c0, c1] = tuple; - if (typeof c0 !== 'bigint' || typeof c1 !== 'bigint') - throw new Error('invalid Fp2.fromBigTuple'); - return this.create({ c0, c1 }); - } - create(num) { - const { Fp } = this; - const c0 = Fp.create(num.c0); - const c1 = Fp.create(num.c1); - // Bigint field elements are immutable values, and higher-level code relies on - // that invariant. Copy+freeze tower values too without mutating caller-owned objects. - return Object.freeze({ c0, c1 }); - } - isValid(num) { - if (!isObj(num)) - throw new TypeError('invalid field element: expected object, got ' + typeof num); - const { c0, c1 } = num; - const { Fp } = this; - // Match base-field `isValid(...)`: malformed coordinate types are errors, not a `false` - // predicate result. - return Fp.isValid(c0) && Fp.isValid(c1); - } - is0(num) { - if (!isObj(num)) - return false; - const { c0, c1 } = num; - const { Fp } = this; - return Fp.is0(c0) && Fp.is0(c1); - } - isValidNot0(num) { - return !this.is0(num) && this.isValid(num); - } - eql({ c0, c1 }, { c0: r0, c1: r1 }) { - const { Fp } = this; - return Fp.eql(c0, r0) && Fp.eql(c1, r1); - } - neg({ c0, c1 }) { - const { Fp } = this; - return Object.freeze({ c0: Fp.neg(c0), c1: Fp.neg(c1) }); - } - pow(num, power) { - return mod.FpPow(this, num, power); - } - invertBatch(nums) { - return mod.FpInvertBatch(this, nums); - } - // Normalized - add(f1, f2) { - const { Fp } = this; - const { c0, c1 } = f1; - const { c0: r0, c1: r1 } = f2; - return Object.freeze({ - c0: Fp.add(c0, r0), - c1: Fp.add(c1, r1), - }); - } - sub({ c0, c1 }, { c0: r0, c1: r1 }) { - const { Fp } = this; - return Object.freeze({ - c0: Fp.sub(c0, r0), - c1: Fp.sub(c1, r1), - }); - } - mul({ c0, c1 }, rhs) { - const { Fp } = this; - if (typeof rhs === 'bigint') - return Object.freeze({ c0: Fp.mul(c0, rhs), c1: Fp.mul(c1, rhs) }); - // (a+bi)(c+di) = (ac−bd) + (ad+bc)i - const { c0: r0, c1: r1 } = rhs; - let t1 = Fp.mul(c0, r0); // c0 * o0 - let t2 = Fp.mul(c1, r1); // c1 * o1 - // (T1 - T2) + ((c0 + c1) * (r0 + r1) - (T1 + T2))*i - const o0 = Fp.sub(t1, t2); - const o1 = Fp.sub(Fp.mul(Fp.add(c0, c1), Fp.add(r0, r1)), Fp.add(t1, t2)); - return Object.freeze({ c0: o0, c1: o1 }); - } - sqr({ c0, c1 }) { - const { Fp } = this; - const a = Fp.add(c0, c1); - const b = Fp.sub(c0, c1); - const c = Fp.add(c0, c0); - return Object.freeze({ c0: Fp.mul(a, b), c1: Fp.mul(c, c1) }); - } - // NonNormalized stuff - addN(a, b) { - return this.add(a, b); - } - subN(a, b) { - return this.sub(a, b); - } - mulN(a, b) { - return this.mul(a, b); - } - sqrN(a) { - return this.sqr(a); - } - // Why inversion for bigint inside Fp instead of Fp2? it is even used in that context? - div(lhs, rhs) { - const { Fp } = this; - // @ts-ignore - return this.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : this.inv(rhs)); - } - inv({ c0: a, c1: b }) { - // We wish to find the multiplicative inverse of a nonzero - // element a + bu in Fp2. We leverage an identity - // - // (a + bu)(a - bu) = a² + b² - // - // which holds because u² = -1. This can be rewritten as - // - // (a + bu)(a - bu)/(a² + b²) = 1 - // - // because a² + b² = 0 has no nonzero solutions for (a, b). - // This gives that (a - bu)/(a² + b²) is the inverse - // of (a + bu). Importantly, this can be computing using - // only a single inversion in Fp. - const { Fp } = this; - const factor = Fp.inv(Fp.create(a * a + b * b)); - return Object.freeze({ c0: Fp.mul(factor, Fp.create(a)), c1: Fp.mul(factor, Fp.create(-b)) }); - } - sqrt(num) { - // This is generic for all quadratic extensions (Fp2) - const { Fp } = this; - const Fp2 = this; - const { c0, c1 } = num; - if (Fp.is0(c1)) { - // if c0 is quadratic residue - if (mod.FpLegendre(Fp, c0) === 1) - return Fp2.create({ c0: Fp.sqrt(c0), c1: Fp.ZERO }); - else - return Fp2.create({ c0: Fp.ZERO, c1: Fp.sqrt(Fp.div(c0, this.Fp_NONRESIDUE)) }); - } - const a = Fp.sqrt(Fp.sub(Fp.sqr(c0), Fp.mul(Fp.sqr(c1), this.Fp_NONRESIDUE))); - let d = Fp.mul(Fp.add(a, c0), this.Fp_div2); - const legendre = mod.FpLegendre(Fp, d); - // -1, Quadratic non residue - if (legendre === -1) - d = Fp.sub(d, a); - const a0 = Fp.sqrt(d); - const candidateSqrt = Fp2.create({ c0: a0, c1: Fp.div(Fp.mul(c1, this.Fp_div2), a0) }); - if (!Fp2.eql(Fp2.sqr(candidateSqrt), num)) - throw new Error('Cannot find square root'); - // Normalize root: at this point candidateSqrt ** 2 = num, but also -candidateSqrt ** 2 = num - const x1 = candidateSqrt; - const x2 = Fp2.neg(x1); - const { re: re1, im: im1 } = Fp2.reim(x1); - const { re: re2, im: im2 } = Fp2.reim(x2); - if (im1 > im2 || (im1 === im2 && re1 > re2)) - return x1; - return x2; - } - // Same as sgn0_m_eq_2 in RFC 9380 - isOdd(x) { - const { re: x0, im: x1 } = this.reim(x); - const sign_0 = x0 % _2n; - const zero_0 = x0 === _0n; - const sign_1 = x1 % _2n; - return BigInt(sign_0 || (zero_0 && sign_1)) == _1n; - } - // Bytes util - fromBytes(b) { - const { Fp } = this; - abytes(b); - if (b.length !== this.BYTES) - throw new Error('fromBytes invalid length=' + b.length); - return this.create({ - c0: Fp.fromBytes(b.subarray(0, Fp.BYTES)), - c1: Fp.fromBytes(b.subarray(Fp.BYTES)), - }); - } - toBytes({ c0, c1 }) { - return concatBytes(this.Fp.toBytes(c0), this.Fp.toBytes(c1)); - } - cmov({ c0, c1 }, { c0: r0, c1: r1 }, c) { - const { Fp } = this; - return this.create({ - c0: Fp.cmov(c0, r0, c), - c1: Fp.cmov(c1, r1, c), - }); - } - reim({ c0, c1 }) { - return { re: c0, im: c1 }; - } - Fp4Square(a, b) { - const Fp2 = this; - const a2 = Fp2.sqr(a); - const b2 = Fp2.sqr(b); - return { - first: Fp2.add(Fp2.mulByNonresidue(b2), a2), // b² * Nonresidue + a² - second: Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(a, b)), a2), b2), // (a + b)² - a² - b² - }; - } - // multiply by u + 1 - mulByNonresidue({ c0, c1 }) { - return this.mul({ c0, c1 }, this.NONRESIDUE); - } - frobeniusMap({ c0, c1 }, power) { - return Object.freeze({ - c0, - c1: this.Fp.mul(c1, this.FROBENIUS_COEFFICIENTS[power % 2]), - }); - } -} -class _Field6 { - ORDER; - BITS; - BYTES; - isLE; - ZERO; - ONE; - Fp2; - constructor(Fp2) { - this.Fp2 = Fp2; - // `IField.ORDER` is the field cardinality `q`; for sextic extensions that is `p^6`. - // Generic helpers like Frobenius-style `x^q = x` checks rely on the literal field size here. - this.ORDER = Fp2.Fp.ORDER ** _6n; - this.BITS = 3 * Fp2.BITS; - this.BYTES = 3 * Fp2.BYTES; - this.isLE = Fp2.isLE; - this.ZERO = this.create({ c0: Fp2.ZERO, c1: Fp2.ZERO, c2: Fp2.ZERO }); - this.ONE = this.create({ c0: Fp2.ONE, c1: Fp2.ZERO, c2: Fp2.ZERO }); - Object.freeze(this); - } - // Most callers never touch Frobenius maps, so keep the sextic tables lazy: - // eagerly deriving them dominates `bls12-381.js` / `bn254.js` import time. - get FROBENIUS_COEFFICIENTS_1() { - const frob = _FROBENIUS_COEFFICIENTS_6.get(this); - if (frob) - return frob[0]; - const { Fp2 } = this; - const { Fp } = Fp2; - const rows = calcFrobeniusCoefficients(Fp2, Fp2.NONRESIDUE, Fp.ORDER, 6, 2, 3); - const cache = [Object.freeze(rows[0]), Object.freeze(rows[1])]; - _FROBENIUS_COEFFICIENTS_6.set(this, cache); - return cache[0]; - } - get FROBENIUS_COEFFICIENTS_2() { - const frob = _FROBENIUS_COEFFICIENTS_6.get(this); - if (frob) - return frob[1]; - void this.FROBENIUS_COEFFICIENTS_1; - return _FROBENIUS_COEFFICIENTS_6.get(this)[1]; - } - add({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) { - const { Fp2 } = this; - return Object.freeze({ - c0: Fp2.add(c0, r0), - c1: Fp2.add(c1, r1), - c2: Fp2.add(c2, r2), - }); - } - sub({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) { - const { Fp2 } = this; - return Object.freeze({ - c0: Fp2.sub(c0, r0), - c1: Fp2.sub(c1, r1), - c2: Fp2.sub(c2, r2), - }); - } - mul({ c0, c1, c2 }, rhs) { - const { Fp2 } = this; - if (typeof rhs === 'bigint') { - return Object.freeze({ - c0: Fp2.mul(c0, rhs), - c1: Fp2.mul(c1, rhs), - c2: Fp2.mul(c2, rhs), - }); - } - const { c0: r0, c1: r1, c2: r2 } = rhs; - const t0 = Fp2.mul(c0, r0); // c0 * o0 - const t1 = Fp2.mul(c1, r1); // c1 * o1 - const t2 = Fp2.mul(c2, r2); // c2 * o2 - return Object.freeze({ - // t0 + (c1 + c2) * (r1 * r2) - (T1 + T2) * (u + 1) - c0: Fp2.add(t0, Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), Fp2.add(r1, r2)), Fp2.add(t1, t2)))), - // (c0 + c1) * (r0 + r1) - (T0 + T1) + T2 * (u + 1) - c1: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c1), Fp2.add(r0, r1)), Fp2.add(t0, t1)), Fp2.mulByNonresidue(t2)), - // T1 + (c0 + c2) * (r0 + r2) - T0 + T2 - c2: Fp2.sub(Fp2.add(t1, Fp2.mul(Fp2.add(c0, c2), Fp2.add(r0, r2))), Fp2.add(t0, t2)), - }); - } - sqr({ c0, c1, c2 }) { - const { Fp2 } = this; - let t0 = Fp2.sqr(c0); // c0² - let t1 = Fp2.mul(Fp2.mul(c0, c1), _2n); // 2 * c0 * c1 - let t3 = Fp2.mul(Fp2.mul(c1, c2), _2n); // 2 * c1 * c2 - let t4 = Fp2.sqr(c2); // c2² - return Object.freeze({ - c0: Fp2.add(Fp2.mulByNonresidue(t3), t0), // T3 * (u + 1) + T0 - c1: Fp2.add(Fp2.mulByNonresidue(t4), t1), // T4 * (u + 1) + T1 - // T1 + (c0 - c1 + c2)² + T3 - T0 - T4 - c2: Fp2.sub(Fp2.sub(Fp2.add(Fp2.add(t1, Fp2.sqr(Fp2.add(Fp2.sub(c0, c1), c2))), t3), t0), t4), - }); - } - addN(a, b) { - return this.add(a, b); - } - subN(a, b) { - return this.sub(a, b); - } - mulN(a, b) { - return this.mul(a, b); - } - sqrN(a) { - return this.sqr(a); - } - create(num) { - const { Fp2 } = this; - const c0 = Fp2.create(num.c0); - const c1 = Fp2.create(num.c1); - const c2 = Fp2.create(num.c2); - return Object.freeze({ c0, c1, c2 }); - } - isValid(num) { - if (!isObj(num)) - throw new TypeError('invalid field element: expected object, got ' + typeof num); - const { c0, c1, c2 } = num; - const { Fp2 } = this; - return Fp2.isValid(c0) && Fp2.isValid(c1) && Fp2.isValid(c2); - } - is0(num) { - if (!isObj(num)) - return false; - const { c0, c1, c2 } = num; - const { Fp2 } = this; - return Fp2.is0(c0) && Fp2.is0(c1) && Fp2.is0(c2); - } - isValidNot0(num) { - return !this.is0(num) && this.isValid(num); - } - neg({ c0, c1, c2 }) { - const { Fp2 } = this; - return Object.freeze({ c0: Fp2.neg(c0), c1: Fp2.neg(c1), c2: Fp2.neg(c2) }); - } - eql({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) { - const { Fp2 } = this; - return Fp2.eql(c0, r0) && Fp2.eql(c1, r1) && Fp2.eql(c2, r2); - } - sqrt(_) { - // Sextic extensions can use generic odd-field Tonelli-Shanks, but the helper must work - // over `IField` with a quadratic non-residue from Fp6 itself. The current - // `mod.tonelliShanks(P)` precomputation only searches integer residues in the base field. - return notImplemented(); - } - // Do we need division by bigint at all? Should be done via order: - div(lhs, rhs) { - const { Fp2 } = this; - const { Fp } = Fp2; - return this.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : this.inv(rhs)); - } - pow(num, power) { - return mod.FpPow(this, num, power); - } - invertBatch(nums) { - return mod.FpInvertBatch(this, nums); - } - inv({ c0, c1, c2 }) { - const { Fp2 } = this; - let t0 = Fp2.sub(Fp2.sqr(c0), Fp2.mulByNonresidue(Fp2.mul(c2, c1))); // c0² - c2 * c1 * (u + 1) - let t1 = Fp2.sub(Fp2.mulByNonresidue(Fp2.sqr(c2)), Fp2.mul(c0, c1)); // c2² * (u + 1) - c0 * c1 - let t2 = Fp2.sub(Fp2.sqr(c1), Fp2.mul(c0, c2)); // c1² - c0 * c2 - // 1/(((c2 * T1 + c1 * T2) * v) + c0 * T0) - let t4 = Fp2.inv(Fp2.add(Fp2.mulByNonresidue(Fp2.add(Fp2.mul(c2, t1), Fp2.mul(c1, t2))), Fp2.mul(c0, t0))); - return Object.freeze({ c0: Fp2.mul(t4, t0), c1: Fp2.mul(t4, t1), c2: Fp2.mul(t4, t2) }); - } - // Bytes utils - fromBytes(b) { - const { Fp2 } = this; - abytes(b); - if (b.length !== this.BYTES) - throw new Error('fromBytes invalid length=' + b.length); - const B2 = Fp2.BYTES; - return this.create({ - c0: Fp2.fromBytes(b.subarray(0, B2)), - c1: Fp2.fromBytes(b.subarray(B2, B2 * 2)), - c2: Fp2.fromBytes(b.subarray(2 * B2)), - }); - } - toBytes({ c0, c1, c2 }) { - const { Fp2 } = this; - return concatBytes(Fp2.toBytes(c0), Fp2.toBytes(c1), Fp2.toBytes(c2)); - } - cmov({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }, c) { - const { Fp2 } = this; - return this.create({ - c0: Fp2.cmov(c0, r0, c), - c1: Fp2.cmov(c1, r1, c), - c2: Fp2.cmov(c2, r2, c), - }); - } - fromBigSix(tuple) { - const { Fp2 } = this; - if (!Array.isArray(tuple) || tuple.length !== 6) - throw new Error('invalid Fp6.fromBigSix'); - for (let i = 0; i < 6; i++) - if (typeof tuple[i] !== 'bigint') - throw new Error('invalid Fp6.fromBigSix'); - const t = tuple; - return this.create({ - c0: Fp2.fromBigTuple(t.slice(0, 2)), - c1: Fp2.fromBigTuple(t.slice(2, 4)), - c2: Fp2.fromBigTuple(t.slice(4, 6)), - }); - } - frobeniusMap({ c0, c1, c2 }, power) { - const { Fp2 } = this; - return Object.freeze({ - c0: Fp2.frobeniusMap(c0, power), - c1: Fp2.mul(Fp2.frobeniusMap(c1, power), this.FROBENIUS_COEFFICIENTS_1[power % 6]), - c2: Fp2.mul(Fp2.frobeniusMap(c2, power), this.FROBENIUS_COEFFICIENTS_2[power % 6]), - }); - } - mulByFp2({ c0, c1, c2 }, rhs) { - const { Fp2 } = this; - return Object.freeze({ - c0: Fp2.mul(c0, rhs), - c1: Fp2.mul(c1, rhs), - c2: Fp2.mul(c2, rhs), - }); - } - mulByNonresidue({ c0, c1, c2 }) { - const { Fp2 } = this; - return Object.freeze({ c0: Fp2.mulByNonresidue(c2), c1: c0, c2: c1 }); - } - // Sparse multiplication - mul1({ c0, c1, c2 }, b1) { - const { Fp2 } = this; - return Object.freeze({ - c0: Fp2.mulByNonresidue(Fp2.mul(c2, b1)), - c1: Fp2.mul(c0, b1), - c2: Fp2.mul(c1, b1), - }); - } - // Sparse multiplication - mul01({ c0, c1, c2 }, b0, b1) { - const { Fp2 } = this; - let t0 = Fp2.mul(c0, b0); // c0 * b0 - let t1 = Fp2.mul(c1, b1); // c1 * b1 - return Object.freeze({ - // ((c1 + c2) * b1 - T1) * (u + 1) + T0 - c0: Fp2.add(Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), b1), t1)), t0), - // (b0 + b1) * (c0 + c1) - T0 - T1 - c1: Fp2.sub(Fp2.sub(Fp2.mul(Fp2.add(b0, b1), Fp2.add(c0, c1)), t0), t1), - // (c0 + c2) * b0 - T0 + T1 - c2: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c2), b0), t0), t1), - }); - } -} -// Keep lazy tower caches off-object: field instances stay frozen, and debugger output -// stays readable without JS private slots while second/subsequent lookups still hit cache. -const _FROBENIUS_COEFFICIENTS_6 = new WeakMap(); -class _Field12 { - ORDER; - BITS; - BYTES; - isLE; - ZERO; - ONE; - Fp6; - X_LEN; - finalExponentiate; - constructor(Fp6, opts) { - const { X_LEN, Fp12finalExponentiate } = opts; - const { Fp2 } = Fp6; - const { Fp } = Fp2; - this.Fp6 = Fp6; - // `IField.ORDER` is the field cardinality `q`; for degree-12 extensions that is `p^12`. - // Keeping `p^2` here breaks generic field identities like `x^q = x` on Fp12. - this.ORDER = Fp.ORDER ** _12n; - this.BITS = 2 * Fp6.BITS; - this.BYTES = 2 * Fp6.BYTES; - this.isLE = Fp6.isLE; - // Returned tower values are frozen, so larger constants can safely reuse - // already-frozen child coefficients instead of cloning them. - this.ZERO = this.create({ c0: Fp6.ZERO, c1: Fp6.ZERO }); - this.ONE = this.create({ c0: Fp6.ONE, c1: Fp6.ZERO }); - this.X_LEN = X_LEN; - this.finalExponentiate = (num) => { - const copy2 = ({ c0, c1 }) => Object.freeze({ c0, c1 }); - const copy6 = ({ c0, c1, c2 }) => Object.freeze({ c0: copy2(c0), c1: copy2(c1), c2: copy2(c2) }); - // This config hook is trusted to return a canonical Fp12 value already. - // Copy+freeze it to keep the tower immutability invariant without mutating caller objects. - const res = Fp12finalExponentiate(num); - return Object.freeze({ c0: copy6(res.c0), c1: copy6(res.c1) }); - }; - Object.freeze(this); - } - // Keep the degree-12 Frobenius row lazy too; after the first lookup the cached - // array is reused exactly like the old eager table. - get FROBENIUS_COEFFICIENTS() { - const frob = _FROBENIUS_COEFFICIENTS_12.get(this); - if (frob) - return frob; - const { Fp2 } = this.Fp6; - const { Fp } = Fp2; - const cache = Object.freeze(calcFrobeniusCoefficients(Fp2, Fp2.NONRESIDUE, Fp.ORDER, 12, 1, 6)[0]); - _FROBENIUS_COEFFICIENTS_12.set(this, cache); - return cache; - } - create(num) { - const { Fp6 } = this; - const c0 = Fp6.create(num.c0); - const c1 = Fp6.create(num.c1); - return Object.freeze({ c0, c1 }); - } - isValid(num) { - if (!isObj(num)) - throw new TypeError('invalid field element: expected object, got ' + typeof num); - const { c0, c1 } = num; - const { Fp6 } = this; - return Fp6.isValid(c0) && Fp6.isValid(c1); - } - is0(num) { - if (!isObj(num)) - return false; - const { c0, c1 } = num; - const { Fp6 } = this; - return Fp6.is0(c0) && Fp6.is0(c1); - } - isValidNot0(num) { - return !this.is0(num) && this.isValid(num); - } - neg({ c0, c1 }) { - const { Fp6 } = this; - return Object.freeze({ c0: Fp6.neg(c0), c1: Fp6.neg(c1) }); - } - eql({ c0, c1 }, { c0: r0, c1: r1 }) { - const { Fp6 } = this; - return Fp6.eql(c0, r0) && Fp6.eql(c1, r1); - } - sqrt(_) { - // Fp12 is quadratic over Fp6, so a dedicated quadratic-extension sqrt is possible here - // once Fp6.sqrt() exists. Without that lower-level sqrt, only a field-generic - // Tonelli-Shanks path over Fp12 itself would work. - return notImplemented(); - } - inv({ c0, c1 }) { - const { Fp6 } = this; - let t = Fp6.inv(Fp6.sub(Fp6.sqr(c0), Fp6.mulByNonresidue(Fp6.sqr(c1)))); // 1 / (c0² - c1² * v) - // ((C0 * T) * T) + (-C1 * T) * w - return Object.freeze({ c0: Fp6.mul(c0, t), c1: Fp6.neg(Fp6.mul(c1, t)) }); - } - div(lhs, rhs) { - const { Fp6 } = this; - const { Fp2 } = Fp6; - const { Fp } = Fp2; - return this.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : this.inv(rhs)); - } - pow(num, power) { - return mod.FpPow(this, num, power); - } - invertBatch(nums) { - return mod.FpInvertBatch(this, nums); - } - // Normalized - add({ c0, c1 }, { c0: r0, c1: r1 }) { - const { Fp6 } = this; - return Object.freeze({ - c0: Fp6.add(c0, r0), - c1: Fp6.add(c1, r1), - }); - } - sub({ c0, c1 }, { c0: r0, c1: r1 }) { - const { Fp6 } = this; - return Object.freeze({ - c0: Fp6.sub(c0, r0), - c1: Fp6.sub(c1, r1), - }); - } - mul({ c0, c1 }, rhs) { - const { Fp6 } = this; - if (typeof rhs === 'bigint') - return Object.freeze({ c0: Fp6.mul(c0, rhs), c1: Fp6.mul(c1, rhs) }); - let { c0: r0, c1: r1 } = rhs; - let t1 = Fp6.mul(c0, r0); // c0 * r0 - let t2 = Fp6.mul(c1, r1); // c1 * r1 - return Object.freeze({ - c0: Fp6.add(t1, Fp6.mulByNonresidue(t2)), // T1 + T2 * v - // (c0 + c1) * (r0 + r1) - (T1 + T2) - c1: Fp6.sub(Fp6.mul(Fp6.add(c0, c1), Fp6.add(r0, r1)), Fp6.add(t1, t2)), - }); - } - sqr({ c0, c1 }) { - const { Fp6 } = this; - let ab = Fp6.mul(c0, c1); // c0 * c1 - return Object.freeze({ - // (c1 * v + c0) * (c0 + c1) - AB - AB * v - c0: Fp6.sub(Fp6.sub(Fp6.mul(Fp6.add(Fp6.mulByNonresidue(c1), c0), Fp6.add(c0, c1)), ab), Fp6.mulByNonresidue(ab)), - c1: Fp6.add(ab, ab), - }); // AB + AB - } - // NonNormalized stuff - addN(a, b) { - return this.add(a, b); - } - subN(a, b) { - return this.sub(a, b); - } - mulN(a, b) { - return this.mul(a, b); - } - sqrN(a) { - return this.sqr(a); - } - // Bytes utils - fromBytes(b) { - const { Fp6 } = this; - abytes(b); - if (b.length !== this.BYTES) - throw new Error('fromBytes invalid length=' + b.length); - return this.create({ - c0: Fp6.fromBytes(b.subarray(0, Fp6.BYTES)), - c1: Fp6.fromBytes(b.subarray(Fp6.BYTES)), - }); - } - toBytes({ c0, c1 }) { - const { Fp6 } = this; - return concatBytes(Fp6.toBytes(c0), Fp6.toBytes(c1)); - } - cmov({ c0, c1 }, { c0: r0, c1: r1 }, c) { - const { Fp6 } = this; - return this.create({ - c0: Fp6.cmov(c0, r0, c), - c1: Fp6.cmov(c1, r1, c), - }); - } - // Utils - // toString() { - // return '' + 'Fp12(' + this.c0 + this.c1 + '* w'); - // }, - // fromTuple(c: [Fp6, Fp6]) { - // return new Fp12(...c); - // } - fromBigTwelve(tuple) { - const { Fp6 } = this; - if (!Array.isArray(tuple) || tuple.length !== 12) - throw new Error('invalid Fp12.fromBigTwelve'); - for (let i = 0; i < 12; i++) - if (typeof tuple[i] !== 'bigint') - throw new Error('invalid Fp12.fromBigTwelve'); - const t = tuple; - return this.create({ - c0: Fp6.fromBigSix(t.slice(0, 6)), - c1: Fp6.fromBigSix(t.slice(6, 12)), - }); - } - // Raises to q**i -th power - frobeniusMap(lhs, power) { - const { Fp6 } = this; - const { Fp2 } = Fp6; - const { c0, c1, c2 } = Fp6.frobeniusMap(lhs.c1, power); - const coeff = this.FROBENIUS_COEFFICIENTS[power % 12]; - return Object.freeze({ - c0: Fp6.frobeniusMap(lhs.c0, power), - c1: Object.freeze({ - c0: Fp2.mul(c0, coeff), - c1: Fp2.mul(c1, coeff), - c2: Fp2.mul(c2, coeff), - }), - }); - } - mulByFp2({ c0, c1 }, rhs) { - const { Fp6 } = this; - return Object.freeze({ - c0: Fp6.mulByFp2(c0, rhs), - c1: Fp6.mulByFp2(c1, rhs), - }); - } - conjugate({ c0, c1 }) { - // Reuse `c0` by reference and only negate the `w` coefficient. - return Object.freeze({ c0, c1: this.Fp6.neg(c1) }); - } - // Sparse multiplication - mul014({ c0, c1 }, o0, o1, o4) { - const { Fp6 } = this; - const { Fp2 } = Fp6; - let t0 = Fp6.mul01(c0, o0, o1); - let t1 = Fp6.mul1(c1, o4); - return Object.freeze({ - c0: Fp6.add(Fp6.mulByNonresidue(t1), t0), // T1 * v + T0 - // (c1 + c0) * [o0, o1+o4] - T0 - T1 - c1: Fp6.sub(Fp6.sub(Fp6.mul01(Fp6.add(c1, c0), o0, Fp2.add(o1, o4)), t0), t1), - }); - } - mul034({ c0, c1 }, o0, o3, o4) { - const { Fp6 } = this; - const { Fp2 } = Fp6; - const a = Object.freeze({ - c0: Fp2.mul(c0.c0, o0), - c1: Fp2.mul(c0.c1, o0), - c2: Fp2.mul(c0.c2, o0), - }); - const b = Fp6.mul01(c1, o3, o4); - const e = Fp6.mul01(Fp6.add(c0, c1), Fp2.add(o0, o3), o4); - return Object.freeze({ - c0: Fp6.add(Fp6.mulByNonresidue(b), a), - c1: Fp6.sub(e, Fp6.add(a, b)), - }); - } - // A cyclotomic group is a subgroup of Fp^n defined by - // GΦₙ(p) = {α ∈ Fpⁿ : α^Φₙ(p) = 1} - // The result of any pairing is in a cyclotomic subgroup - // https://eprint.iacr.org/2009/565.pdf - // https://eprint.iacr.org/2010/354.pdf - _cyclotomicSquare({ c0, c1 }) { - const { Fp6 } = this; - const { Fp2 } = Fp6; - const { c0: c0c0, c1: c0c1, c2: c0c2 } = c0; - const { c0: c1c0, c1: c1c1, c2: c1c2 } = c1; - const { first: t3, second: t4 } = Fp2.Fp4Square(c0c0, c1c1); - const { first: t5, second: t6 } = Fp2.Fp4Square(c1c0, c0c2); - const { first: t7, second: t8 } = Fp2.Fp4Square(c0c1, c1c2); - const t9 = Fp2.mulByNonresidue(t8); // T8 * (u + 1) - return Object.freeze({ - c0: Object.freeze({ - c0: Fp2.add(Fp2.mul(Fp2.sub(t3, c0c0), _2n), t3), // 2 * (T3 - c0c0) + T3 - c1: Fp2.add(Fp2.mul(Fp2.sub(t5, c0c1), _2n), t5), // 2 * (T5 - c0c1) + T5 - c2: Fp2.add(Fp2.mul(Fp2.sub(t7, c0c2), _2n), t7), - }), // 2 * (T7 - c0c2) + T7 - c1: Object.freeze({ - c0: Fp2.add(Fp2.mul(Fp2.add(t9, c1c0), _2n), t9), // 2 * (T9 + c1c0) + T9 - c1: Fp2.add(Fp2.mul(Fp2.add(t4, c1c1), _2n), t4), // 2 * (T4 + c1c1) + T4 - c2: Fp2.add(Fp2.mul(Fp2.add(t6, c1c2), _2n), t6), - }), - }); // 2 * (T6 + c1c2) + T6 - } - // https://eprint.iacr.org/2009/565.pdf - _cyclotomicExp(num, n) { - // The loop only consumes `X_LEN` bits, so out-of-range exponents would otherwise get silently - // truncated (or sign-extended for negatives) instead of matching the caller's requested power. - aInRange('cyclotomic exponent', n, _0n, _1n << BigInt(this.X_LEN)); - let z = this.ONE; - for (let i = this.X_LEN - 1; i >= 0; i--) { - z = this._cyclotomicSquare(z); - if (bitGet(n, i)) - z = this.mul(z, num); - } - return z; - } -} -const _FROBENIUS_COEFFICIENTS_12 = new WeakMap(); -/** - * @param opts - Tower construction options. See {@link Tower12Opts}. - * @returns BLS tower fields. - * @throws If the tower options or derived Frobenius helpers are invalid. {@link Error} - * @example - * Construct the Fp2/Fp6/Fp12 tower used by a pairing-friendly curve. - * - * ```ts - * const fields = tower12({ - * ORDER: 17n, - * X_LEN: 4, - * FP2_NONRESIDUE: [1n, 1n], - * Fp2mulByB: (num) => num, - * Fp12finalExponentiate: (num) => num, - * }); - * const fp12 = fields.Fp12.ONE; - * ``` - */ -export function tower12(opts) { - validateObject(opts, { - ORDER: 'bigint', - X_LEN: 'number', - FP2_NONRESIDUE: 'object', - Fp2mulByB: 'function', - Fp12finalExponentiate: 'function', - }, { NONRESIDUE: 'bigint' }); - asafenumber(opts.X_LEN, 'X_LEN'); - if (opts.X_LEN < 1) - throw new Error('invalid X_LEN'); - const nonresidue = opts.FP2_NONRESIDUE; - if (!Array.isArray(nonresidue) || nonresidue.length !== 2) - throw new Error('invalid FP2_NONRESIDUE'); - if (typeof nonresidue[0] !== 'bigint' || typeof nonresidue[1] !== 'bigint') - throw new Error('invalid FP2_NONRESIDUE'); - const Fp = mod.Field(opts.ORDER); - const Fp2 = new _Field2(Fp, opts); - const Fp6 = new _Field6(Fp2); - const Fp12 = new _Field12(Fp6, opts); - return { Fp, Fp2, Fp6, Fp12 }; -} -//# sourceMappingURL=tower.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/tower.js.map b/node_modules/@noble/curves/abstract/tower.js.map deleted file mode 100644 index 2876887..0000000 --- a/node_modules/@noble/curves/abstract/tower.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tower.js","sourceRoot":"","sources":["../src/abstract/tower.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,sEAAsE;AACtE,OAAO,EACL,MAAM,EACN,QAAQ,EACR,WAAW,EACX,MAAM,EACN,MAAM,EACN,WAAW,EACX,cAAc,EACd,cAAc,GAGf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAGpC,qEAAqE;AACrE,kBAAkB;AAClB,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AA4C7M,MAAM,KAAK,GAAG,CAAC,KAAc,EAAoC,EAAE,CACjE,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,K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,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjC,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,IAAI,CAAC,cAA0B,CAAC;IACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,IAAI,OAAO,UAAU,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,OAAO,UAAU,CAAC,CAAC,CAAC,KAAK,QAAQ;QACxE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACrC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAKzB,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/weierstrass.d.ts b/node_modules/@noble/curves/abstract/weierstrass.d.ts deleted file mode 100644 index 9c43b76..0000000 --- a/node_modules/@noble/curves/abstract/weierstrass.d.ts +++ /dev/null @@ -1,588 +0,0 @@ -import { type CHash, type HmacFn, type TArg, type TRet } from '../utils.ts'; -import { type AffinePoint, type CurveLengths, type CurvePoint, type CurvePointCons } from './curve.ts'; -import { type IField } from './modular.ts'; -/** Shared affine point shape used by Weierstrass helpers. */ -export type { AffinePoint }; -type EndoBasis = [[bigint, bigint], [bigint, bigint]]; -/** - * When Weierstrass curve has `a=0`, it becomes Koblitz curve. - * Koblitz curves allow using **efficiently-computable GLV endomorphism ψ**. - * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. - * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. - * - * Endomorphism consists of beta, lambda and splitScalar: - * - * 1. GLV endomorphism ψ transforms a point: `P = (x, y) ↦ ψ(P) = (β·x mod p, y)` - * 2. GLV scalar decomposition transforms a scalar: `k ≡ k₁ + k₂·λ (mod n)` - * 3. Then these are combined: `k·P = k₁·P + k₂·ψ(P)` - * 4. Two 128-bit point-by-scalar multiplications + one point addition is faster than - * one 256-bit multiplication. - * - * where - * * beta: β ∈ Fₚ with β³ = 1, β ≠ 1 - * * lambda: λ ∈ Fₙ with λ³ = 1, λ ≠ 1 - * * splitScalar decomposes k ↦ k₁, k₂, by using reduced basis vectors. - * Gauss lattice reduction calculates them from initial basis vectors `(n, 0), (-λ, 0)` - * - * Check out `test/misc/endomorphism.js` and - * {@link https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 | this endomorphism gist}. - */ -export type EndomorphismOpts = { - /** Cube root of unity used by the GLV endomorphism. */ - beta: bigint; - /** Reduced lattice basis used for scalar splitting. */ - basises?: EndoBasis; - /** - * Optional custom scalar-splitting helper. - * Receives one scalar and returns two half-sized scalar components. - */ - splitScalar?: (k: bigint) => { - k1neg: boolean; - k1: bigint; - k2neg: boolean; - k2: bigint; - }; -}; -/** Two half-sized scalar components returned by endomorphism splitting. */ -export type ScalarEndoParts = { - /** Whether the first split scalar should be negated. */ - k1neg: boolean; - /** Absolute value of the first split scalar. */ - k1: bigint; - /** Whether the second split scalar should be negated. */ - k2neg: boolean; - /** Absolute value of the second split scalar. */ - k2: bigint; -}; -/** Splits scalar for GLV endomorphism. */ -export declare function _splitEndoScalar(k: bigint, basis: EndoBasis, n: bigint): ScalarEndoParts; -/** - * Option to enable hedged signatures with improved security. - * - * * Randomly generated k is bad, because broken CSPRNG would leak private keys. - * * Deterministic k (RFC6979) is better; but is suspectible to fault attacks. - * - * We allow using technique described in RFC6979 3.6: additional k', a.k.a. adding randomness - * to deterministic sig. If CSPRNG is broken & randomness is weak, it would STILL be as secure - * as ordinary sig without ExtraEntropy. - * - * * `true` means "fetch data, from CSPRNG, incorporate it into k generation" - * * `false` means "disable extra entropy, use purely deterministic k" - * * `Uint8Array` passed means "incorporate following data into k generation" - * - * See {@link https://paulmillr.com/posts/deterministic-signatures/ | deterministic signatures}. - */ -export type ECDSAExtraEntropy = boolean | Uint8Array; -/** - * - `compact` is the default format - * - `recovered` is the same as compact, but with an extra byte indicating recovery byte - * - `der` is ASN.1 DER encoding - */ -export type ECDSASignatureFormat = 'compact' | 'recovered' | 'der'; -/** - * - `prehash`: (default: true) indicates whether to do sha256(message). - * When a custom hash is used, it must be set to `false`. - */ -export type ECDSARecoverOpts = { - /** Whether to hash the message before signature recovery. */ - prehash?: boolean; -}; -/** - * - `prehash`: (default: true) indicates whether to do sha256(message). - * When a custom hash is used, it must be set to `false`. - * - `lowS`: (default: true) prohibits signatures with `sig.s >= CURVE.n/2n`. - * Compatible with BTC/ETH. Setting `lowS: false` allows to create malleable signatures, - * which is default openssl behavior. - * Non-malleable signatures can still be successfully verified in openssl. - * - `format`: (default: 'compact') 'compact' or 'recovered' with recovery byte - */ -export type ECDSAVerifyOpts = { - /** Whether to hash the message before verification. */ - prehash?: boolean; - /** Whether to reject high-S signatures. */ - lowS?: boolean; - /** Signature encoding to accept. */ - format?: ECDSASignatureFormat; -}; -/** - * - `prehash`: (default: true) indicates whether to do sha256(message). - * When a custom hash is used, it must be set to `false`. - * - `lowS`: (default: true) prohibits signatures with `sig.s >= CURVE.n/2n`. - * Compatible with BTC/ETH. Setting `lowS: false` allows to create malleable signatures, - * which is default openssl behavior. - * Non-malleable signatures can still be successfully verified in openssl. - * - `format`: (default: 'compact') 'compact' or 'recovered' with recovery byte - * - `extraEntropy`: (default: false) creates signatures with increased - * security, see {@link ECDSAExtraEntropy} - */ -export type ECDSASignOpts = { - /** Whether to hash the message before signing. */ - prehash?: boolean; - /** Whether to normalize signatures into the low-S half-order. */ - lowS?: boolean; - /** Signature encoding to produce. */ - format?: ECDSASignatureFormat; - /** Optional hedging input for deterministic k generation. */ - extraEntropy?: ECDSAExtraEntropy; -}; -/** Projective XYZ point used by short Weierstrass curves. */ -export interface WeierstrassPoint extends CurvePoint> { - /** projective X coordinate. Different from affine x. */ - readonly X: T; - /** projective Y coordinate. Different from affine y. */ - readonly Y: T; - /** projective z coordinate */ - readonly Z: T; - /** affine x coordinate. Different from projective X. */ - get x(): T; - /** affine y coordinate. Different from projective Y. */ - get y(): T; - /** - * Encode the point into compressed or uncompressed SEC1 bytes. - * @param isCompressed - Whether to use the compressed form. - * @returns Encoded point bytes. - */ - toBytes(isCompressed?: boolean): TRet; - /** - * Encode the point into compressed or uncompressed SEC1 hex. - * @param isCompressed - Whether to use the compressed form. - * @returns Encoded point hex. - */ - toHex(isCompressed?: boolean): string; -} -/** Constructor and metadata helpers for Weierstrass points. */ -export interface WeierstrassPointCons extends CurvePointCons> { - /** Does NOT validate if the point is valid. Use `.assertValidity()`. */ - new (X: T, Y: T, Z: T): WeierstrassPoint; - /** - * Return the curve parameters captured by this point constructor. - * @returns Curve parameters. - */ - CURVE(): WeierstrassOpts; -} -/** - * Weierstrass curve options. - * - * * p: prime characteristic (order) of finite field, in which arithmetics is done - * * n: order of prime subgroup a.k.a total amount of valid curve points - * * h: cofactor, usually 1. h*n is group order; n is subgroup order - * * a: formula param, must be in field of p - * * b: formula param, must be in field of p - * * Gx: x coordinate of generator point a.k.a. base point - * * Gy: y coordinate of generator point - */ -export type WeierstrassOpts = Readonly<{ - /** Base-field modulus. */ - p: bigint; - /** Prime subgroup order. */ - n: bigint; - /** Curve cofactor. */ - h: bigint; - /** Weierstrass curve parameter `a`. */ - a: T; - /** Weierstrass curve parameter `b`. */ - b: T; - /** Generator x coordinate. */ - Gx: T; - /** Generator y coordinate. */ - Gy: T; -}>; -/** - * Optional helpers and overrides for a Weierstrass point constructor. - * - * When a cofactor != 1, there can be effective methods to: - * 1. Determine whether a point is torsion-free - * 2. Clear torsion component - */ -export type WeierstrassExtraOpts = Partial<{ - /** Optional base-field override. */ - Fp: IField; - /** Optional scalar-field override. */ - Fn: IField; - /** Whether the point constructor accepts infinity points. */ - allowInfinityPoint: boolean; - /** Optional GLV endomorphism data. */ - endo: EndomorphismOpts; - /** Optional torsion-check override. */ - isTorsionFree: (c: WeierstrassPointCons, point: WeierstrassPoint) => boolean; - /** Optional cofactor-clearing override. */ - clearCofactor: (c: WeierstrassPointCons, point: WeierstrassPoint) => WeierstrassPoint; - /** Optional custom point decoder. */ - fromBytes: (bytes: TArg) => AffinePoint; - /** Optional custom point encoder. */ - toBytes: (c: WeierstrassPointCons, point: WeierstrassPoint, isCompressed: boolean) => TRet; -}>; -/** - * Options for ECDSA signatures over a Weierstrass curve. - * - * * lowS: (default: true) whether produced or verified signatures occupy the - * low half of `ecdsaOpts.n`. Prevents malleability. - * * hmac: (default: noble-hashes hmac) function, would be used to init hmac-drbg for k generation. - * * randomBytes: (default: webcrypto os-level CSPRNG) custom method for fetching secure randomness. - * * bits2int, bits2int_modN: used in sigs, sometimes overridden by curves. Custom hooks are - * treated as pure functions over validated bytes and MUST NOT mutate caller-owned buffers or - * closure-captured option bags. `bits2int_modN` must also return a canonical scalar in - * `[0..Point.Fn.ORDER-1]`. - */ -export type ECDSAOpts = Partial<{ - /** Default low-S policy for this ECDSA instance. */ - lowS: boolean; - /** HMAC implementation used by RFC6979 DRBG. */ - hmac: HmacFn; - /** RNG override used by helper constructors. */ - randomBytes: (bytesLength?: number) => TRet; - /** Hash-to-integer conversion override. */ - bits2int: (bytes: TArg) => bigint; - /** Hash-to-integer-mod-n conversion override. Returns a canonical scalar in `[0..Fn.ORDER-1]`. */ - bits2int_modN: (bytes: TArg) => bigint; -}>; -/** Elliptic Curve Diffie-Hellman helper namespace. */ -export interface ECDH { - /** - * Generate a secret/public key pair. - * @param seed - Optional seed material. - * @returns Secret/public key pair. - */ - keygen: (seed?: TArg) => { - secretKey: TRet; - publicKey: TRet; - }; - /** - * Derive the public key from a secret key. - * @param secretKey - Secret key bytes. - * @param isCompressed - Whether to emit compressed SEC1 bytes. - * @returns Encoded public key. - */ - getPublicKey: (secretKey: TArg, isCompressed?: boolean) => TRet; - /** - * Compute the shared secret point from a secret key and peer public key. - * @param secretKeyA - Local secret key bytes. - * @param publicKeyB - Peer public key bytes. - * @param isCompressed - Whether to emit compressed SEC1 bytes. - * @returns Encoded shared point. - */ - getSharedSecret: (secretKeyA: TArg, publicKeyB: TArg, isCompressed?: boolean) => TRet; - /** Point constructor used by this ECDH instance. */ - Point: WeierstrassPointCons; - /** Validation and random-key helpers. */ - utils: { - /** Check whether a secret key has the expected encoding. */ - isValidSecretKey: (secretKey: TArg) => boolean; - /** Check whether a public key decodes to a valid point. */ - isValidPublicKey: (publicKey: TArg, isCompressed?: boolean) => boolean; - /** Generate a valid random secret key. */ - randomSecretKey: (seed?: TArg) => TRet; - }; - /** Byte lengths for keys and signatures exposed by this curve. */ - lengths: CurveLengths; -} -/** - * ECDSA interface. - * Only supported for prime fields, not Fp2 (extension fields). - */ -export interface ECDSA extends ECDH { - /** - * Sign a message with the given secret key. - * @param message - Message bytes. - * @param secretKey - Secret key bytes. - * @param opts - Optional signing tweaks. See {@link ECDSASignOpts}. - * @returns Encoded signature bytes. - */ - sign: (message: TArg, secretKey: TArg, opts?: TArg) => TRet; - /** - * Verify a signature against a message and public key. - * @param signature - Encoded signature bytes. - * @param message - Message bytes. - * @param publicKey - Encoded public key. - * @param opts - Optional verification tweaks. See {@link ECDSAVerifyOpts}. - * @returns Whether the signature is valid. - */ - verify: (signature: TArg, message: TArg, publicKey: TArg, opts?: TArg) => boolean; - /** - * Recover the public key encoded into a recoverable signature. - * @param signature - Recoverable signature bytes. - * @param message - Message bytes. - * @param opts - Optional recovery tweaks. See {@link ECDSARecoverOpts}. - * @returns Encoded recovered public key. - */ - recoverPublicKey(signature: TArg, message: TArg, opts?: TArg): TRet; - /** Signature constructor and parser helpers. */ - Signature: ECDSASignatureCons; -} -/** - * @param m - Error message. - * @example - * Throw a DER-specific error when signature parsing encounters invalid bytes. - * - * ```ts - * new DERErr('bad der'); - * ``` - */ -export declare class DERErr extends Error { - constructor(m?: string); -} -/** DER helper namespace used by ECDSA signature parsing and encoding. */ -export type IDER = { - /** - * DER-specific error constructor. - * @param m - Error message. - * @returns DER-specific error instance. - */ - Err: typeof DERErr; - /** Low-level tag-length-value helpers used by DER encoders. */ - _tlv: { - /** - * Encode one TLV record. - * @param tag - ASN.1 tag byte. - * @param data - Hex-encoded value payload. - * @returns Encoded TLV string. - */ - encode: (tag: number, data: string) => string; - /** - * Decode one TLV record and return the value plus leftover bytes. - * @param tag - Expected ASN.1 tag byte. - * @param data - Remaining DER bytes. - * @returns Parsed value plus leftover bytes. - */ - decode(tag: number, data: TArg): TRet<{ - v: Uint8Array; - l: Uint8Array; - }>; - }; - /** Positive-integer DER helpers used by ECDSA signature encoding. */ - _int: { - /** - * Encode one positive bigint as a DER INTEGER. - * @param num - Positive integer to encode. - * @returns Encoded DER INTEGER. - */ - encode(num: bigint): string; - /** - * Decode one DER INTEGER into a bigint. - * @param data - DER INTEGER bytes. - * @returns Decoded bigint. - */ - decode(data: TArg): bigint; - }; - /** - * Parse a DER signature into `{ r, s }`. - * @param bytes - DER signature bytes. - * @returns Parsed signature components. - */ - toSig(bytes: TArg): { - r: bigint; - s: bigint; - }; - /** - * Encode `{ r, s }` as a DER signature. - * @param sig - Signature components. - * @returns DER-encoded signature hex. - */ - hexFromSig(sig: { - r: bigint; - s: bigint; - }): string; -}; -/** - * ASN.1 DER encoding utilities. ASN is very complex & fragile. Format: - * - * [0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S] - * - * Docs: {@link https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/ | Let's Encrypt ASN.1 guide} and - * {@link https://luca.ntop.org/Teaching/Appunti/asn1.html | Luca Deri's ASN.1 notes}. - * @example - * ASN.1 DER encoding utilities. - * - * ```ts - * const der = DER.hexFromSig({ r: 1n, s: 2n }); - * ``` - */ -export declare const DER: IDER; -/** - * Creates weierstrass Point constructor, based on specified curve options. - * - * See {@link WeierstrassOpts}. - * @param params - Curve parameters. See {@link WeierstrassOpts}. - * @param extraOpts - Optional helpers and overrides. See {@link WeierstrassExtraOpts}. - * @returns Weierstrass point constructor. - * @throws If the curve parameters, overrides, or point codecs are invalid. {@link Error} - * - * @example - * Construct a point type from explicit Weierstrass curve parameters. - * - * ```js - * const opts = { - * p: 0xfffffffffffffffffffffffffffffffeffffac73n, - * n: 0x100000000000000000001b8fa16dfab9aca16b6b3n, - * h: 1n, - * a: 0n, - * b: 7n, - * Gx: 0x3b4c382ce37aa192a4019e763036f4f5dd4d7ebbn, - * Gy: 0x938cf935318fdced6bc28286531733c3f03c4feen, - * }; - * const secp160k1_Point = weierstrass(opts); - * ``` - */ -export declare function weierstrass(params: WeierstrassOpts, extraOpts?: WeierstrassExtraOpts): WeierstrassPointCons; -/** Parsed ECDSA signature with helpers for recovery and re-encoding. */ -export interface ECDSASignature { - /** Signature component `r`. */ - readonly r: bigint; - /** Signature component `s`. */ - readonly s: bigint; - /** Optional recovery bit for recoverable signatures. */ - readonly recovery?: number; - /** - * Return a copy of the signature with a recovery bit attached. - * @param recovery - Recovery bit to attach. - * @returns Signature with an attached recovery bit. - */ - addRecoveryBit(recovery: number): ECDSASignature & { - readonly recovery: number; - }; - /** - * Check whether the signature uses the high-S half-order. - * @returns Whether the signature uses the high-S half-order. - */ - hasHighS(): boolean; - /** - * Recover the public key from the hashed message and recovery bit. - * @param messageHash - Hashed message bytes. - * @returns Recovered public-key point. - */ - recoverPublicKey(messageHash: TArg): WeierstrassPoint; - /** - * Encode the signature into bytes. - * @param format - Signature encoding to produce. - * @returns Encoded signature bytes. - */ - toBytes(format?: string): TRet; - /** - * Encode the signature into hex. - * @param format - Signature encoding to produce. - * @returns Encoded signature hex. - */ - toHex(format?: string): string; -} -/** Constructor and decoding helpers for ECDSA signatures. */ -export type ECDSASignatureCons = { - /** Create a signature from `r`, `s`, and an optional recovery bit. */ - new (r: bigint, s: bigint, recovery?: number): ECDSASignature; - /** - * Decode a signature from bytes. - * @param bytes - Encoded signature bytes. - * @param format - Signature encoding to parse. - * @returns Parsed signature. - */ - fromBytes(bytes: TArg, format?: ECDSASignatureFormat): ECDSASignature; - /** - * Decode a signature from hex. - * @param hex - Encoded signature hex. - * @param format - Signature encoding to parse. - * @returns Parsed signature. - */ - fromHex(hex: string, format?: ECDSASignatureFormat): ECDSASignature; -}; -/** - * Implementation of the Shallue and van de Woestijne method for any weierstrass curve. - * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular. - * b = True and y = sqrt(u / v) if (u / v) is square in F, and - * b = False and y = sqrt(Z * (u / v)) otherwise. - * RFC 9380 expects callers to provide `v != 0`; this helper does not enforce it. - * @param Fp - Field implementation. - * @param Z - Simplified SWU map parameter. - * @returns Square-root ratio helper. - * @example - * Build the square-root ratio helper used by SWU map implementations. - * - * ```ts - * import { SWUFpSqrtRatio } from '@noble/curves/abstract/weierstrass.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const sqrtRatio = SWUFpSqrtRatio(Fp, 3n); - * const out = sqrtRatio(4n, 1n); - * ``` - */ -export declare function SWUFpSqrtRatio(Fp: TArg>, Z: T): (u: T, v: T) => { - isValid: boolean; - value: T; -}; -/** - * Simplified Shallue-van de Woestijne-Ulas Method - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2 | RFC 9380 section 6.6.2}. - * @param Fp - Field implementation. - * @param opts - SWU parameters: - * - `A`: Curve parameter `A`. - * - `B`: Curve parameter `B`. - * - `Z`: Simplified SWU map parameter. - * @returns Deterministic map-to-curve function. - * @throws If the SWU parameters are invalid or the field lacks the required helpers. {@link Error} - * @example - * Map one field element to a Weierstrass curve point with the SWU recipe. - * - * ```ts - * import { mapToCurveSimpleSWU } from '@noble/curves/abstract/weierstrass.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const map = mapToCurveSimpleSWU(Fp, { A: 1n, B: 2n, Z: 3n }); - * const point = map(5n); - * ``` - */ -export declare function mapToCurveSimpleSWU(Fp: TArg>, opts: { - A: T; - B: T; - Z: T; -}): (u: T) => { - x: T; - y: T; -}; -/** - * Sometimes users only need getPublicKey, getSharedSecret, and secret key handling. - * This helper ensures no signature functionality is present. Less code, smaller bundle size. - * @param Point - Weierstrass point constructor. - * @param ecdhOpts - Optional randomness helpers: - * - `randomBytes` (optional): Optional RNG override. - * @returns ECDH helper namespace. - * @example - * Sometimes users only need getPublicKey, getSharedSecret, and secret key handling. - * - * ```ts - * import { ecdh } from '@noble/curves/abstract/weierstrass.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const dh = ecdh(p256.Point); - * const alice = dh.keygen(); - * const shared = dh.getSharedSecret(alice.secretKey, alice.publicKey); - * ``` - */ -export declare function ecdh(Point: WeierstrassPointCons, ecdhOpts?: TArg<{ - randomBytes?: (bytesLength?: number) => TRet; -}>): ECDH; -/** - * Creates ECDSA signing interface for given elliptic curve `Point` and `hash` function. - * - * @param Point - created using {@link weierstrass} function - * @param hash - used for 1) message prehash-ing 2) k generation in `sign`, using hmac_drbg(hash) - * @param ecdsaOpts - rarely needed, see {@link ECDSAOpts}: - * - `lowS`: Default low-S policy. - * - `hmac`: HMAC implementation used by RFC6979 DRBG. - * - `randomBytes`: Optional RNG override. - * - `bits2int`: Optional hash-to-int conversion override. - * - `bits2int_modN`: Optional hash-to-int-mod-n conversion override. - * - * @returns ECDSA helper namespace. - * @example - * Create an ECDSA signer/verifier bundle for one curve implementation. - * - * ```ts - * import { ecdsa } from '@noble/curves/abstract/weierstrass.js'; - * import { p256 } from '@noble/curves/nist.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const p256ecdsa = ecdsa(p256.Point, sha256); - * const { secretKey, publicKey } = p256ecdsa.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p256ecdsa.sign(msg, secretKey); - * const isValid = p256ecdsa.verify(sig, msg, publicKey); - * ``` - */ -export declare function ecdsa(Point: WeierstrassPointCons, hash: TArg, ecdsaOpts?: TArg): ECDSA; -//# sourceMappingURL=weierstrass.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/weierstrass.d.ts.map b/node_modules/@noble/curves/abstract/weierstrass.d.ts.map deleted file mode 100644 index edaf101..0000000 --- a/node_modules/@noble/curves/abstract/weierstrass.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"weierstrass.d.ts","sourceRoot":"","sources":["../src/abstract/weierstrass.ts"],"names":[],"mappings":"AA6BA,OAAO,EAiBL,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAML,KAAK,MAAM,EACZ,MAAM,cAAc,CAAC;AAEtB,6DAA6D;AAC7D,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,KAAK,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAA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yD1B;AAcD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAClB,KAAK,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACnC,QAAQ,GAAE,IAAI,CAAC;IAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC,UAAU,CAAC,CAAA;CAAE,CAAM,GAChF,IAAI,CAiGN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,KAAK,CACnB,KAAK,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACnC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EACjB,SAAS,GAAE,IAAI,CAAC,SAAS,CAAM,GAC9B,KAAK,CAoWP"} \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/weierstrass.js b/node_modules/@noble/curves/abstract/weierstrass.js deleted file mode 100644 index 21b5ad7..0000000 --- a/node_modules/@noble/curves/abstract/weierstrass.js +++ /dev/null @@ -1,1412 +0,0 @@ -/** - * Short Weierstrass curve methods. The formula is: y² = x³ + ax + b. - * - * ### Design rationale for types - * - * * Interaction between classes from different curves should fail: - * `k256.Point.BASE.add(p256.Point.BASE)` - * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime - * * Different calls of `curve()` would return different classes - - * `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve, - * it won't affect others - * - * TypeScript can't infer types for classes created inside a function. Classes is one instance - * of nominative types in TypeScript and interfaces only check for shape, so it's hard to create - * unique type for every function call. - * - * We can use generic types via some param, like curve opts, but that would: - * 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params) - * which is hard to debug. - * 2. Params can be generic and we can't enforce them to be constant value: - * if somebody creates curve from non-constant params, - * it would be allowed to interact with other curves with non-constant params - * - * @todo https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { hmac as nobleHmac } from '@noble/hashes/hmac.js'; -import { ahash } from '@noble/hashes/utils.js'; -import { abignumber, abool, abytes, aInRange, asafenumber, bitLen, bitMask, bytesToHex, bytesToNumberBE, concatBytes, createHmacDrbg, hexToBytes, isBytes, numberToHexUnpadded, validateObject, randomBytes as wcRandomBytes, } from "../utils.js"; -import { createCurveFields, createKeygen, mulEndoUnsafe, negateCt, normalizeZ, wNAF, } from "./curve.js"; -import { FpInvertBatch, FpIsSquare, getMinHashLength, mapHashToField, validateField, } from "./modular.js"; -// We construct the basis so `den` is always positive and equals `n`, -// but the `num` sign depends on the basis, not on the secret value. -// Exact half-way cases round away from zero, which keeps the split symmetric -// around the reduced-basis boundaries used by endomorphism decomposition. -const divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n) / den; -/** Splits scalar for GLV endomorphism. */ -export function _splitEndoScalar(k, basis, n) { - // Split scalar into two such that part is ~half bits: `abs(part) < sqrt(N)` - // Since part can be negative, we need to do this on point. - // Callers must provide a reduced GLV basis whose vectors satisfy - // `a + b * lambda ≡ 0 (mod n)`; this helper only sees the basis and `n`. - // Reject unreduced scalars instead of silently treating them mod n. - aInRange('scalar', k, _0n, n); - // TODO: verifyScalar function which consumes lambda - const [[a1, b1], [a2, b2]] = basis; - const c1 = divNearest(b2 * k, n); - const c2 = divNearest(-b1 * k, n); - // |k1|/|k2| is < sqrt(N), but can be negative. - // If we do `k1 mod N`, we'll get big scalar (`> sqrt(N)`): so, we do cheaper negation instead. - let k1 = k - c1 * a1 - c2 * a2; - let k2 = -c1 * b1 - c2 * b2; - const k1neg = k1 < _0n; - const k2neg = k2 < _0n; - if (k1neg) - k1 = -k1; - if (k2neg) - k2 = -k2; - // Double check that resulting scalar less than half bits of N: otherwise wNAF will fail. - // This should only happen on wrong bases. - // Also, the math inside is complex enough that this guard is worth keeping. - const MAX_NUM = bitMask(Math.ceil(bitLen(n) / 2)) + _1n; // Half bits of N - if (k1 < _0n || k1 >= MAX_NUM || k2 < _0n || k2 >= MAX_NUM) { - throw new Error('splitScalar (endomorphism): failed for k'); - } - return { k1neg, k1, k2neg, k2 }; -} -function validateSigFormat(format) { - if (!['compact', 'recovered', 'der'].includes(format)) - throw new Error('Signature format must be "compact", "recovered", or "der"'); - return format; -} -function validateSigOpts(opts, def) { - validateObject(opts); - const optsn = {}; - // Normalize only the declared option subset from `def`; unknown keys are - // intentionally ignored so shared / superset option bags stay valid here too. - // `extraEntropy` stays an opaque payload until the signing path consumes it. - for (let optName of Object.keys(def)) { - // @ts-ignore - optsn[optName] = opts[optName] === undefined ? def[optName] : opts[optName]; - } - abool(optsn.lowS, 'lowS'); - abool(optsn.prehash, 'prehash'); - if (optsn.format !== undefined) - validateSigFormat(optsn.format); - return optsn; -} -/** - * @param m - Error message. - * @example - * Throw a DER-specific error when signature parsing encounters invalid bytes. - * - * ```ts - * new DERErr('bad der'); - * ``` - */ -export class DERErr extends Error { - constructor(m = '') { - super(m); - } -} -/** - * ASN.1 DER encoding utilities. ASN is very complex & fragile. Format: - * - * [0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S] - * - * Docs: {@link https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/ | Let's Encrypt ASN.1 guide} and - * {@link https://luca.ntop.org/Teaching/Appunti/asn1.html | Luca Deri's ASN.1 notes}. - * @example - * ASN.1 DER encoding utilities. - * - * ```ts - * const der = DER.hexFromSig({ r: 1n, s: 2n }); - * ``` - */ -export const DER = { - // asn.1 DER encoding utils - Err: DERErr, - // Basic building block is TLV (Tag-Length-Value) - _tlv: { - encode: (tag, data) => { - const { Err: E } = DER; - asafenumber(tag, 'tag'); - if (tag < 0 || tag > 255) - throw new E('tlv.encode: wrong tag'); - if (typeof data !== 'string') - throw new TypeError('"data" expected string, got type=' + typeof data); - // Internal helper: callers hand this already-validated hex payload, so we only enforce - // byte alignment here instead of re-validating every nibble. - if (data.length & 1) - throw new E('tlv.encode: unpadded data'); - const dataLen = data.length / 2; - const len = numberToHexUnpadded(dataLen); - if ((len.length / 2) & 0b1000_0000) - throw new E('tlv.encode: long form length too big'); - // length of length with long form flag - const lenLen = dataLen > 127 ? numberToHexUnpadded((len.length / 2) | 0b1000_0000) : ''; - const t = numberToHexUnpadded(tag); - return t + lenLen + len + data; - }, - // v - value, l - left bytes (unparsed) - decode(tag, data) { - const { Err: E } = DER; - data = abytes(data, undefined, 'DER data'); - let pos = 0; - if (tag < 0 || tag > 255) - throw new E('tlv.encode: wrong tag'); - if (data.length < 2 || data[pos++] !== tag) - throw new E('tlv.decode: wrong tlv'); - const first = data[pos++]; - // First bit of first length byte is the short/long form flag. - const isLong = !!(first & 0b1000_0000); - let length = 0; - if (!isLong) - length = first; - else { - // Long form: [longFlag(1bit), lengthLength(7bit), length (BE)] - const lenLen = first & 0b0111_1111; - if (!lenLen) - throw new E('tlv.decode(long): indefinite length not supported'); - // This would overflow u32 in JS. - if (lenLen > 4) - throw new E('tlv.decode(long): byte length is too big'); - const lengthBytes = data.subarray(pos, pos + lenLen); - if (lengthBytes.length !== lenLen) - throw new E('tlv.decode: length bytes not complete'); - if (lengthBytes[0] === 0) - throw new E('tlv.decode(long): zero leftmost byte'); - for (const b of lengthBytes) - length = (length << 8) | b; - pos += lenLen; - if (length < 128) - throw new E('tlv.decode(long): not minimal encoding'); - } - const v = data.subarray(pos, pos + length); - if (v.length !== length) - throw new E('tlv.decode: wrong value length'); - return { v, l: data.subarray(pos + length) }; - }, - }, - // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, - // since we always use positive integers here. It must always be empty: - // - add zero byte if exists - // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) - _int: { - encode(num) { - const { Err: E } = DER; - abignumber(num); - if (num < _0n) - throw new E('integer: negative integers are not allowed'); - let hex = numberToHexUnpadded(num); - // Pad with zero byte if negative flag is present - if (Number.parseInt(hex[0], 16) & 0b1000) - hex = '00' + hex; - if (hex.length & 1) - throw new E('unexpected DER parsing assertion: unpadded hex'); - return hex; - }, - decode(data) { - const { Err: E } = DER; - if (data.length < 1) - throw new E('invalid signature integer: empty'); - if (data[0] & 0b1000_0000) - throw new E('invalid signature integer: negative'); - // Single-byte zero `00` is the canonical DER INTEGER encoding for zero. - if (data.length > 1 && data[0] === 0x00 && !(data[1] & 0b1000_0000)) - throw new E('invalid signature integer: unnecessary leading zero'); - return bytesToNumberBE(data); - }, - }, - toSig(bytes) { - // parse DER signature - const { Err: E, _int: int, _tlv: tlv } = DER; - const data = abytes(bytes, undefined, 'signature'); - const { v: seqBytes, l: seqLeftBytes } = tlv.decode(0x30, data); - if (seqLeftBytes.length) - throw new E('invalid signature: left bytes after parsing'); - const { v: rBytes, l: rLeftBytes } = tlv.decode(0x02, seqBytes); - const { v: sBytes, l: sLeftBytes } = tlv.decode(0x02, rLeftBytes); - if (sLeftBytes.length) - throw new E('invalid signature: left bytes after parsing'); - return { r: int.decode(rBytes), s: int.decode(sBytes) }; - }, - hexFromSig(sig) { - const { _tlv: tlv, _int: int } = DER; - const rs = tlv.encode(0x02, int.encode(sig.r)); - const ss = tlv.encode(0x02, int.encode(sig.s)); - const seq = rs + ss; - return tlv.encode(0x30, seq); - }, -}; -Object.freeze(DER._tlv); -Object.freeze(DER._int); -Object.freeze(DER); -// Be friendly to bad ECMAScript parsers by not using bigint literals -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3), _4n = /* @__PURE__ */ BigInt(4); -/** - * Creates weierstrass Point constructor, based on specified curve options. - * - * See {@link WeierstrassOpts}. - * @param params - Curve parameters. See {@link WeierstrassOpts}. - * @param extraOpts - Optional helpers and overrides. See {@link WeierstrassExtraOpts}. - * @returns Weierstrass point constructor. - * @throws If the curve parameters, overrides, or point codecs are invalid. {@link Error} - * - * @example - * Construct a point type from explicit Weierstrass curve parameters. - * - * ```js - * const opts = { - * p: 0xfffffffffffffffffffffffffffffffeffffac73n, - * n: 0x100000000000000000001b8fa16dfab9aca16b6b3n, - * h: 1n, - * a: 0n, - * b: 7n, - * Gx: 0x3b4c382ce37aa192a4019e763036f4f5dd4d7ebbn, - * Gy: 0x938cf935318fdced6bc28286531733c3f03c4feen, - * }; - * const secp160k1_Point = weierstrass(opts); - * ``` - */ -export function weierstrass(params, extraOpts = {}) { - const validated = createCurveFields('weierstrass', params, extraOpts); - const Fp = validated.Fp; - const Fn = validated.Fn; - let CURVE = validated.CURVE; - const { h: cofactor, n: CURVE_ORDER } = CURVE; - validateObject(extraOpts, {}, { - allowInfinityPoint: 'boolean', - clearCofactor: 'function', - isTorsionFree: 'function', - fromBytes: 'function', - toBytes: 'function', - endo: 'object', - }); - // Snapshot constructor-time flags whose later mutation would otherwise change - // validity semantics of an already-built point type. - const { endo, allowInfinityPoint } = extraOpts; - if (endo) { - // validateObject(endo, { beta: 'bigint', splitScalar: 'function' }); - if (!Fp.is0(CURVE.a) || typeof endo.beta !== 'bigint' || !Array.isArray(endo.basises)) { - throw new Error('invalid endo: expected "beta": bigint and "basises": array'); - } - } - const lengths = getWLengths(Fp, Fn); - function assertCompressionIsSupported() { - if (!Fp.isOdd) - throw new Error('compression is not supported: Field does not have .isOdd()'); - } - // Implements IEEE P1363 point encoding - function pointToBytes(_c, point, isCompressed) { - // SEC 1 v2.0 §2.3.3 encodes infinity as the single octet 0x00. Only curves - // that opt into infinity as a public point value should expose that byte form. - if (allowInfinityPoint && point.is0()) - return Uint8Array.of(0); - const { x, y } = point.toAffine(); - const bx = Fp.toBytes(x); - abool(isCompressed, 'isCompressed'); - if (isCompressed) { - assertCompressionIsSupported(); - const hasEvenY = !Fp.isOdd(y); - return concatBytes(pprefix(hasEvenY), bx); - } - else { - return concatBytes(Uint8Array.of(0x04), bx, Fp.toBytes(y)); - } - } - function pointFromBytes(bytes) { - abytes(bytes, undefined, 'Point'); - const { publicKey: comp, publicKeyUncompressed: uncomp } = lengths; // e.g. for 32-byte: 33, 65 - const length = bytes.length; - const head = bytes[0]; - const tail = bytes.subarray(1); - if (allowInfinityPoint && length === 1 && head === 0x00) - return { x: Fp.ZERO, y: Fp.ZERO }; - // SEC 1 v2.0 §2.3.4 decodes 0x00 as infinity, but §3.2.2 public-key validation - // rejects infinity. We therefore keep 0x00 rejected by default because callers - // reuse this parser as the strict public-key boundary, and only admit it when - // the curve explicitly opts into infinity as a public point value. secp256k1 - // crosstests show OpenSSL raw point codecs accept 0x00 too. - // No actual validation is done here: use .assertValidity() - if (length === comp && (head === 0x02 || head === 0x03)) { - const x = Fp.fromBytes(tail); - if (!Fp.isValid(x)) - throw new Error('bad point: is not on curve, wrong x'); - const y2 = weierstrassEquation(x); // y² = x³ + ax + b - let y; - try { - y = Fp.sqrt(y2); // y = y² ^ (p+1)/4 - } - catch (sqrtError) { - const err = sqrtError instanceof Error ? ': ' + sqrtError.message : ''; - throw new Error('bad point: is not on curve, sqrt error' + err); - } - assertCompressionIsSupported(); - const evenY = Fp.isOdd(y); - const evenH = (head & 1) === 1; // ECDSA-specific - if (evenH !== evenY) - y = Fp.neg(y); - return { x, y }; - } - else if (length === uncomp && head === 0x04) { - // TODO: more checks - const L = Fp.BYTES; - const x = Fp.fromBytes(tail.subarray(0, L)); - const y = Fp.fromBytes(tail.subarray(L, L * 2)); - if (!isValidXY(x, y)) - throw new Error('bad point: is not on curve'); - return { x, y }; - } - else { - throw new Error(`bad point: got length ${length}, expected compressed=${comp} or uncompressed=${uncomp}`); - } - } - const encodePoint = extraOpts.toBytes === undefined ? pointToBytes : extraOpts.toBytes; - const decodePoint = extraOpts.fromBytes === undefined ? pointFromBytes : extraOpts.fromBytes; - function weierstrassEquation(x) { - const x2 = Fp.sqr(x); // x * x - const x3 = Fp.mul(x2, x); // x² * x - return Fp.add(Fp.add(x3, Fp.mul(x, CURVE.a)), CURVE.b); // x³ + a * x + b - } - // TODO: move top-level - /** Checks whether equation holds for given x, y: y² == x³ + ax + b */ - function isValidXY(x, y) { - const left = Fp.sqr(y); // y² - const right = weierstrassEquation(x); // x³ + ax + b - return Fp.eql(left, right); - } - // Keep constructor-time generator validation cheap: callers are responsible for supplying the - // correct prime-order base point, while eager subgroup checks here would slow heavy module imports. - // Test 1: equation y² = x³ + ax + b should work for generator point. - if (!isValidXY(CURVE.Gx, CURVE.Gy)) - throw new Error('bad curve params: generator point'); - // Test 2: discriminant Δ part should be non-zero: 4a³ + 27b² != 0. - // Guarantees curve is genus-1, smooth (non-singular). - const _4a3 = Fp.mul(Fp.pow(CURVE.a, _3n), _4n); - const _27b2 = Fp.mul(Fp.sqr(CURVE.b), BigInt(27)); - if (Fp.is0(Fp.add(_4a3, _27b2))) - throw new Error('bad curve params: a or b'); - /** Asserts coordinate is valid: 0 <= n < Fp.ORDER. */ - function acoord(title, n, banZero = false) { - if (!Fp.isValid(n) || (banZero && Fp.is0(n))) - throw new Error(`bad point coordinate ${title}`); - return n; - } - function aprjpoint(other) { - if (!(other instanceof Point)) - throw new Error('Weierstrass Point expected'); - } - function splitEndoScalarN(k) { - if (!endo || !endo.basises) - throw new Error('no endo'); - return _splitEndoScalar(k, endo.basises, Fn.ORDER); - } - function finishEndo(endoBeta, k1p, k2p, k1neg, k2neg) { - k2p = new Point(Fp.mul(k2p.X, endoBeta), k2p.Y, k2p.Z); - k1p = negateCt(k1neg, k1p); - k2p = negateCt(k2neg, k2p); - return k1p.add(k2p); - } - /** - * Projective Point works in 3d / projective (homogeneous) coordinates:(X, Y, Z) ∋ (x=X/Z, y=Y/Z). - * Default Point works in 2d / affine coordinates: (x, y). - * We're doing calculations in projective, because its operations don't require costly inversion. - */ - class Point { - // base / generator point - static BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); - // zero / infinity / identity point - static ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0 - // math field - static Fp = Fp; - // scalar field - static Fn = Fn; - X; - Y; - Z; - /** Does NOT validate if the point is valid. Use `.assertValidity()`. */ - constructor(X, Y, Z) { - this.X = acoord('x', X); - // This is not just about ZERO / infinity: ambient curves can have real - // finite points with y=0. Those points are 2-torsion, so they cannot lie - // in the odd prime-order subgroups this point type is meant to represent. - this.Y = acoord('y', Y, true); - this.Z = acoord('z', Z); - Object.freeze(this); - } - static CURVE() { - return CURVE; - } - /** Does NOT validate if the point is valid. Use `.assertValidity()`. */ - static fromAffine(p) { - const { x, y } = p || {}; - if (!p || !Fp.isValid(x) || !Fp.isValid(y)) - throw new Error('invalid affine point'); - if (p instanceof Point) - throw new Error('projective point not allowed'); - // (0, 0) would've produced (0, 0, 1) - instead, we need (0, 1, 0) - if (Fp.is0(x) && Fp.is0(y)) - return Point.ZERO; - return new Point(x, y, Fp.ONE); - } - static fromBytes(bytes) { - const P = Point.fromAffine(decodePoint(abytes(bytes, undefined, 'point'))); - P.assertValidity(); - return P; - } - static fromHex(hex) { - return Point.fromBytes(hexToBytes(hex)); - } - get x() { - return this.toAffine().x; - } - get y() { - return this.toAffine().y; - } - /** - * - * @param windowSize - * @param isLazy - true will defer table computation until the first multiplication - * @returns - */ - precompute(windowSize = 8, isLazy = true) { - wnaf.createCache(this, windowSize); - if (!isLazy) - this.multiply(_3n); // random number - return this; - } - // TODO: return `this` - /** A point on curve is valid if it conforms to equation. */ - assertValidity() { - const p = this; - if (p.is0()) { - // (0, 1, 0) aka ZERO is invalid in most contexts. - // In BLS, ZERO can be serialized, so we allow it. - // Keep the accepted infinity encoding canonical: projective-equivalent (X, Y, 0) points - // like (1, 1, 0) compare equal to ZERO, but only (0, 1, 0) should pass this guard. - if (extraOpts.allowInfinityPoint && Fp.is0(p.X) && Fp.eql(p.Y, Fp.ONE) && Fp.is0(p.Z)) - return; - throw new Error('bad point: ZERO'); - } - // Some 3rd-party test vectors require different wording between here & `fromCompressedHex` - const { x, y } = p.toAffine(); - if (!Fp.isValid(x) || !Fp.isValid(y)) - throw new Error('bad point: x or y not field elements'); - if (!isValidXY(x, y)) - throw new Error('bad point: equation left != right'); - if (!p.isTorsionFree()) - throw new Error('bad point: not in prime-order subgroup'); - } - hasEvenY() { - const { y } = this.toAffine(); - if (!Fp.isOdd) - throw new Error("Field doesn't support isOdd"); - return !Fp.isOdd(y); - } - /** Compare one point to another. */ - equals(other) { - aprjpoint(other); - const { X: X1, Y: Y1, Z: Z1 } = this; - const { X: X2, Y: Y2, Z: Z2 } = other; - const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1)); - const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1)); - return U1 && U2; - } - /** Flips point to one corresponding to (x, -y) in Affine coordinates. */ - negate() { - return new Point(this.X, Fp.neg(this.Y), this.Z); - } - // Renes-Costello-Batina exception-free doubling formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 3 - // Cost: 8M + 3S + 3*a + 2*b3 + 15add. - double() { - const { a, b } = CURVE; - const b3 = Fp.mul(b, _3n); - const { X: X1, Y: Y1, Z: Z1 } = this; - let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore - let t0 = Fp.mul(X1, X1); // step 1 - let t1 = Fp.mul(Y1, Y1); - let t2 = Fp.mul(Z1, Z1); - let t3 = Fp.mul(X1, Y1); - t3 = Fp.add(t3, t3); // step 5 - Z3 = Fp.mul(X1, Z1); - Z3 = Fp.add(Z3, Z3); - X3 = Fp.mul(a, Z3); - Y3 = Fp.mul(b3, t2); - Y3 = Fp.add(X3, Y3); // step 10 - X3 = Fp.sub(t1, Y3); - Y3 = Fp.add(t1, Y3); - Y3 = Fp.mul(X3, Y3); - X3 = Fp.mul(t3, X3); - Z3 = Fp.mul(b3, Z3); // step 15 - t2 = Fp.mul(a, t2); - t3 = Fp.sub(t0, t2); - t3 = Fp.mul(a, t3); - t3 = Fp.add(t3, Z3); - Z3 = Fp.add(t0, t0); // step 20 - t0 = Fp.add(Z3, t0); - t0 = Fp.add(t0, t2); - t0 = Fp.mul(t0, t3); - Y3 = Fp.add(Y3, t0); - t2 = Fp.mul(Y1, Z1); // step 25 - t2 = Fp.add(t2, t2); - t0 = Fp.mul(t2, t3); - X3 = Fp.sub(X3, t0); - Z3 = Fp.mul(t2, t1); - Z3 = Fp.add(Z3, Z3); // step 30 - Z3 = Fp.add(Z3, Z3); - return new Point(X3, Y3, Z3); - } - // Renes-Costello-Batina exception-free addition formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 1 - // Cost: 12M + 0S + 3*a + 3*b3 + 23add. - add(other) { - aprjpoint(other); - const { X: X1, Y: Y1, Z: Z1 } = this; - const { X: X2, Y: Y2, Z: Z2 } = other; - let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore - const a = CURVE.a; - const b3 = Fp.mul(CURVE.b, _3n); - let t0 = Fp.mul(X1, X2); // step 1 - let t1 = Fp.mul(Y1, Y2); - let t2 = Fp.mul(Z1, Z2); - let t3 = Fp.add(X1, Y1); - let t4 = Fp.add(X2, Y2); // step 5 - t3 = Fp.mul(t3, t4); - t4 = Fp.add(t0, t1); - t3 = Fp.sub(t3, t4); - t4 = Fp.add(X1, Z1); - let t5 = Fp.add(X2, Z2); // step 10 - t4 = Fp.mul(t4, t5); - t5 = Fp.add(t0, t2); - t4 = Fp.sub(t4, t5); - t5 = Fp.add(Y1, Z1); - X3 = Fp.add(Y2, Z2); // step 15 - t5 = Fp.mul(t5, X3); - X3 = Fp.add(t1, t2); - t5 = Fp.sub(t5, X3); - Z3 = Fp.mul(a, t4); - X3 = Fp.mul(b3, t2); // step 20 - Z3 = Fp.add(X3, Z3); - X3 = Fp.sub(t1, Z3); - Z3 = Fp.add(t1, Z3); - Y3 = Fp.mul(X3, Z3); - t1 = Fp.add(t0, t0); // step 25 - t1 = Fp.add(t1, t0); - t2 = Fp.mul(a, t2); - t4 = Fp.mul(b3, t4); - t1 = Fp.add(t1, t2); - t2 = Fp.sub(t0, t2); // step 30 - t2 = Fp.mul(a, t2); - t4 = Fp.add(t4, t2); - t0 = Fp.mul(t1, t4); - Y3 = Fp.add(Y3, t0); - t0 = Fp.mul(t5, t4); // step 35 - X3 = Fp.mul(t3, X3); - X3 = Fp.sub(X3, t0); - t0 = Fp.mul(t3, t1); - Z3 = Fp.mul(t5, Z3); - Z3 = Fp.add(Z3, t0); // step 40 - return new Point(X3, Y3, Z3); - } - subtract(other) { - // Validate before calling `negate()` so wrong inputs fail with the point guard - // instead of leaking a foreign `negate()` error. - aprjpoint(other); - return this.add(other.negate()); - } - is0() { - return this.equals(Point.ZERO); - } - /** - * Constant time multiplication. - * Uses wNAF method. Windowed method may be 10% faster, - * but takes 2x longer to generate and consumes 2x memory. - * Uses precomputes when available. - * Uses endomorphism for Koblitz curves. - * @param scalar - by which the point would be multiplied - * @returns New point - */ - multiply(scalar) { - const { endo } = extraOpts; - // Keep the subgroup-scalar contract strict instead of reducing 0 / n to ZERO. - // In key/signature-style callers, those values usually mean broken hash/scalar plumbing, - // and failing closed is safer than silently producing the identity point. - if (!Fn.isValidNot0(scalar)) - throw new RangeError('invalid scalar: out of range'); // 0 is invalid - let point, fake; // Fake point is used to const-time mult - const mul = (n) => wnaf.cached(this, n, (p) => normalizeZ(Point, p)); - /** See docs for {@link EndomorphismOpts} */ - if (endo) { - const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(scalar); - const { p: k1p, f: k1f } = mul(k1); - const { p: k2p, f: k2f } = mul(k2); - fake = k1f.add(k2f); - point = finishEndo(endo.beta, k1p, k2p, k1neg, k2neg); - } - else { - const { p, f } = mul(scalar); - point = p; - fake = f; - } - // Normalize `z` for both points, but return only real one - return normalizeZ(Point, [point, fake])[0]; - } - /** - * Non-constant-time multiplication. Uses double-and-add algorithm. - * It's faster, but should only be used when you don't care about - * an exposed secret key e.g. sig verification, which works over *public* keys. - */ - multiplyUnsafe(scalar) { - const { endo } = extraOpts; - const p = this; - const sc = scalar; - // Public-scalar callers may need 0, but n and larger values stay rejected here too. - // Reducing them mod n would turn bad caller input into an accidental identity point. - if (!Fn.isValid(sc)) - throw new RangeError('invalid scalar: out of range'); // 0 is valid - if (sc === _0n || p.is0()) - return Point.ZERO; // 0 - if (sc === _1n) - return p; // 1 - if (wnaf.hasCache(this)) - return this.multiply(sc); // precomputes - // We don't have method for double scalar multiplication (aP + bQ): - // Even with using Strauss-Shamir trick, it's 35% slower than naïve mul+add. - if (endo) { - const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(sc); - const { p1, p2 } = mulEndoUnsafe(Point, p, k1, k2); // 30% faster vs wnaf.unsafe - return finishEndo(endo.beta, p1, p2, k1neg, k2neg); - } - else { - return wnaf.unsafe(p, sc); - } - } - /** - * Converts Projective point to affine (x, y) coordinates. - * (X, Y, Z) ∋ (x=X/Z, y=Y/Z). - * @param invertedZ - Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch - */ - toAffine(invertedZ) { - const p = this; - let iz = invertedZ; - const { X, Y, Z } = p; - // Fast-path for normalized points - if (Fp.eql(Z, Fp.ONE)) - return { x: X, y: Y }; - const is0 = p.is0(); - // If invZ was 0, we return zero point. However we still want to execute - // all operations, so we replace invZ with a random number, 1. - if (iz == null) - iz = is0 ? Fp.ONE : Fp.inv(Z); - const x = Fp.mul(X, iz); - const y = Fp.mul(Y, iz); - const zz = Fp.mul(Z, iz); - if (is0) - return { x: Fp.ZERO, y: Fp.ZERO }; - if (!Fp.eql(zz, Fp.ONE)) - throw new Error('invZ was invalid'); - return { x, y }; - } - /** - * Checks whether Point is free of torsion elements (is in prime subgroup). - * Always torsion-free for cofactor=1 curves. - */ - isTorsionFree() { - const { isTorsionFree } = extraOpts; - if (cofactor === _1n) - return true; - if (isTorsionFree) - return isTorsionFree(Point, this); - return wnaf.unsafe(this, CURVE_ORDER).is0(); - } - clearCofactor() { - const { clearCofactor } = extraOpts; - if (cofactor === _1n) - return this; // Fast-path - if (clearCofactor) - return clearCofactor(Point, this); - // Default fallback assumes the cofactor fits the usual subgroup-scalar - // multiplyUnsafe() contract. Curves with larger / structured cofactors - // should define a clearCofactor override anyway (e.g. psi/Frobenius maps). - return this.multiplyUnsafe(cofactor); - } - isSmallOrder() { - if (cofactor === _1n) - return this.is0(); // Fast-path - return this.clearCofactor().is0(); - } - toBytes(isCompressed = true) { - abool(isCompressed, 'isCompressed'); - // Same policy as pointFromBytes(): keep ZERO out of the default byte surface because - // callers use these encodings as public keys, where SEC 1 validation rejects infinity. - this.assertValidity(); - return encodePoint(Point, this, isCompressed); - } - toHex(isCompressed = true) { - return bytesToHex(this.toBytes(isCompressed)); - } - toString() { - return ``; - } - } - const bits = Fn.BITS; - const wnaf = new wNAF(Point, extraOpts.endo ? Math.ceil(bits / 2) : bits); - // Tiny toy curves can have scalar fields narrower than 8 bits. Skip the - // eager W=8 cache there instead of rejecting an otherwise valid constructor. - if (bits >= 8) - Point.BASE.precompute(8); // Enable precomputes. Slows down first publicKey computation by 20ms. - Object.freeze(Point.prototype); - Object.freeze(Point); - return Point; -} -// Points start with byte 0x02 when y is even; otherwise 0x03 -function pprefix(hasEvenY) { - return Uint8Array.of(hasEvenY ? 0x02 : 0x03); -} -/** - * Implementation of the Shallue and van de Woestijne method for any weierstrass curve. - * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular. - * b = True and y = sqrt(u / v) if (u / v) is square in F, and - * b = False and y = sqrt(Z * (u / v)) otherwise. - * RFC 9380 expects callers to provide `v != 0`; this helper does not enforce it. - * @param Fp - Field implementation. - * @param Z - Simplified SWU map parameter. - * @returns Square-root ratio helper. - * @example - * Build the square-root ratio helper used by SWU map implementations. - * - * ```ts - * import { SWUFpSqrtRatio } from '@noble/curves/abstract/weierstrass.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const sqrtRatio = SWUFpSqrtRatio(Fp, 3n); - * const out = sqrtRatio(4n, 1n); - * ``` - */ -export function SWUFpSqrtRatio(Fp, Z) { - // Fail with the usual field-shape error before touching pow/cmov on malformed field shims. - const F = validateField(Fp); - // Generic implementation - const q = F.ORDER; - let l = _0n; - for (let o = q - _1n; o % _2n === _0n; o /= _2n) - l += _1n; - const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1. - // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<. - // 2n ** c1 == 2n << (c1-1) - const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n); - const _2n_pow_c1 = _2n_pow_c1_1 * _2n; - const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic - const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic - const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic - const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic - const c6 = F.pow(Z, c2); // 6. c6 = Z^c2 - const c7 = F.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2) - // RFC 9380 Appendix F.2.1.1 defines sqrt_ratio(u, v) only for v != 0. - // We keep v=0 on the regular result path with isValid=false instead of - // throwing so the helper stays closer to the RFC's fixed control flow. - let sqrtRatio = (u, v) => { - let tv1 = c6; // 1. tv1 = c6 - let tv2 = F.pow(v, c4); // 2. tv2 = v^c4 - let tv3 = F.sqr(tv2); // 3. tv3 = tv2^2 - tv3 = F.mul(tv3, v); // 4. tv3 = tv3 * v - let tv5 = F.mul(u, tv3); // 5. tv5 = u * tv3 - tv5 = F.pow(tv5, c3); // 6. tv5 = tv5^c3 - tv5 = F.mul(tv5, tv2); // 7. tv5 = tv5 * tv2 - tv2 = F.mul(tv5, v); // 8. tv2 = tv5 * v - tv3 = F.mul(tv5, u); // 9. tv3 = tv5 * u - let tv4 = F.mul(tv3, tv2); // 10. tv4 = tv3 * tv2 - tv5 = F.pow(tv4, c5); // 11. tv5 = tv4^c5 - let isQR = F.eql(tv5, F.ONE); // 12. isQR = tv5 == 1 - tv2 = F.mul(tv3, c7); // 13. tv2 = tv3 * c7 - tv5 = F.mul(tv4, tv1); // 14. tv5 = tv4 * tv1 - tv3 = F.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR) - tv4 = F.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR) - // 17. for i in (c1, c1 - 1, ..., 2): - for (let i = c1; i > _1n; i--) { - let tv5 = i - _2n; // 18. tv5 = i - 2 - tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5 - let tvv5 = F.pow(tv4, tv5); // 20. tv5 = tv4^tv5 - const e1 = F.eql(tvv5, F.ONE); // 21. e1 = tv5 == 1 - tv2 = F.mul(tv3, tv1); // 22. tv2 = tv3 * tv1 - tv1 = F.mul(tv1, tv1); // 23. tv1 = tv1 * tv1 - tvv5 = F.mul(tv4, tv1); // 24. tv5 = tv4 * tv1 - tv3 = F.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1) - tv4 = F.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1) - } - // RFC 9380 Appendix F.2.1.1 defines sqrt_ratio(u, v) for v != 0. - // When u = 0 and v != 0, u / v = 0 is square and the computed root is - // still 0, so widen only the final flag and keep the full control flow. - return { isValid: !F.is0(v) && (isQR || F.is0(u)), value: tv3 }; - }; - if (F.ORDER % _4n === _3n) { - // sqrt_ratio_3mod4(u, v) - const c1 = (F.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic - const c2 = F.sqrt(F.neg(Z)); // 2. c2 = sqrt(-Z) - sqrtRatio = (u, v) => { - let tv1 = F.sqr(v); // 1. tv1 = v^2 - const tv2 = F.mul(u, v); // 2. tv2 = u * v - tv1 = F.mul(tv1, tv2); // 3. tv1 = tv1 * tv2 - let y1 = F.pow(tv1, c1); // 4. y1 = tv1^c1 - y1 = F.mul(y1, tv2); // 5. y1 = y1 * tv2 - const y2 = F.mul(y1, c2); // 6. y2 = y1 * c2 - const tv3 = F.mul(F.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v - const isQR = F.eql(tv3, u); // 9. isQR = tv3 == u - let y = F.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR) - return { isValid: !F.is0(v) && isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2 - }; - } - // No curves uses that - // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8 - return sqrtRatio; -} -/** - * Simplified Shallue-van de Woestijne-Ulas Method - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2 | RFC 9380 section 6.6.2}. - * @param Fp - Field implementation. - * @param opts - SWU parameters: - * - `A`: Curve parameter `A`. - * - `B`: Curve parameter `B`. - * - `Z`: Simplified SWU map parameter. - * @returns Deterministic map-to-curve function. - * @throws If the SWU parameters are invalid or the field lacks the required helpers. {@link Error} - * @example - * Map one field element to a Weierstrass curve point with the SWU recipe. - * - * ```ts - * import { mapToCurveSimpleSWU } from '@noble/curves/abstract/weierstrass.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const map = mapToCurveSimpleSWU(Fp, { A: 1n, B: 2n, Z: 3n }); - * const point = map(5n); - * ``` - */ -export function mapToCurveSimpleSWU(Fp, opts) { - const F = validateField(Fp); - const { A, B, Z } = opts; - if (!F.isValidNot0(A) || !F.isValidNot0(B) || !F.isValid(Z)) - throw new Error('mapToCurveSimpleSWU: invalid opts'); - // RFC 9380 §6.6.2 and Appendix H.2 require: - // 1. Z is non-square in F - // 2. Z != -1 in F - // 3. g(x) - Z is irreducible over F - // 4. g(B / (Z * A)) is square in F - // We can enforce 1, 2, and 4 with the current field API. - // Criterion 3 is not checked here because generic `IField` does not expose - // polynomial-ring / irreducibility operations, and this helper is used for - // both prime and extension fields. - if (F.eql(Z, F.neg(F.ONE)) || FpIsSquare(F, Z)) - throw new Error('mapToCurveSimpleSWU: invalid opts'); - // RFC 9380 Appendix H.2 criterion 4: g(B / (Z * A)) is square in F. - // x = B / (Z * A) - const x = F.mul(B, F.inv(F.mul(Z, A))); - // g(x) = x^3 + A*x + B - const gx = F.add(F.add(F.mul(F.sqr(x), x), F.mul(A, x)), B); - if (!FpIsSquare(F, gx)) - throw new Error('mapToCurveSimpleSWU: invalid opts'); - const sqrtRatio = SWUFpSqrtRatio(F, Z); - if (!F.isOdd) - throw new Error('Field does not have .isOdd()'); - // Input: u, an element of F. - // Output: (x, y), a point on E. - return (u) => { - // prettier-ignore - let tv1, tv2, tv3, tv4, tv5, tv6, x, y; - tv1 = F.sqr(u); // 1. tv1 = u^2 - tv1 = F.mul(tv1, Z); // 2. tv1 = Z * tv1 - tv2 = F.sqr(tv1); // 3. tv2 = tv1^2 - tv2 = F.add(tv2, tv1); // 4. tv2 = tv2 + tv1 - tv3 = F.add(tv2, F.ONE); // 5. tv3 = tv2 + 1 - tv3 = F.mul(tv3, B); // 6. tv3 = B * tv3 - tv4 = F.cmov(Z, F.neg(tv2), !F.eql(tv2, F.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) - tv4 = F.mul(tv4, A); // 8. tv4 = A * tv4 - tv2 = F.sqr(tv3); // 9. tv2 = tv3^2 - tv6 = F.sqr(tv4); // 10. tv6 = tv4^2 - tv5 = F.mul(tv6, A); // 11. tv5 = A * tv6 - tv2 = F.add(tv2, tv5); // 12. tv2 = tv2 + tv5 - tv2 = F.mul(tv2, tv3); // 13. tv2 = tv2 * tv3 - tv6 = F.mul(tv6, tv4); // 14. tv6 = tv6 * tv4 - tv5 = F.mul(tv6, B); // 15. tv5 = B * tv6 - tv2 = F.add(tv2, tv5); // 16. tv2 = tv2 + tv5 - x = F.mul(tv1, tv3); // 17. x = tv1 * tv3 - const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) - y = F.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1 - y = F.mul(y, value); // 20. y = y * y1 - x = F.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square) - y = F.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square) - const e1 = F.isOdd(u) === F.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y) - y = F.cmov(F.neg(y), y, e1); // 24. y = CMOV(-y, y, e1) - const tv4_inv = FpInvertBatch(F, [tv4], true)[0]; - x = F.mul(x, tv4_inv); // 25. x = x / tv4 - return { x, y }; - }; -} -function getWLengths(Fp, Fn) { - return { - secretKey: Fn.BYTES, - publicKey: 1 + Fp.BYTES, - publicKeyUncompressed: 1 + 2 * Fp.BYTES, - publicKeyHasPrefix: true, - // Raw compact `(r || s)` signature width; DER and recovered signatures use - // different lengths outside this helper. - signature: 2 * Fn.BYTES, - }; -} -/** - * Sometimes users only need getPublicKey, getSharedSecret, and secret key handling. - * This helper ensures no signature functionality is present. Less code, smaller bundle size. - * @param Point - Weierstrass point constructor. - * @param ecdhOpts - Optional randomness helpers: - * - `randomBytes` (optional): Optional RNG override. - * @returns ECDH helper namespace. - * @example - * Sometimes users only need getPublicKey, getSharedSecret, and secret key handling. - * - * ```ts - * import { ecdh } from '@noble/curves/abstract/weierstrass.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const dh = ecdh(p256.Point); - * const alice = dh.keygen(); - * const shared = dh.getSharedSecret(alice.secretKey, alice.publicKey); - * ``` - */ -export function ecdh(Point, ecdhOpts = {}) { - const { Fn } = Point; - const randomBytes_ = ecdhOpts.randomBytes === undefined ? wcRandomBytes : ecdhOpts.randomBytes; - // Keep the advertised seed length aligned with mapHashToField(), which keeps a hard 16-byte - // minimum even on toy curves. - const lengths = Object.assign(getWLengths(Point.Fp, Fn), { - seed: Math.max(getMinHashLength(Fn.ORDER), 16), - }); - function isValidSecretKey(secretKey) { - try { - const num = Fn.fromBytes(secretKey); - return Fn.isValidNot0(num); - } - catch (error) { - return false; - } - } - function isValidPublicKey(publicKey, isCompressed) { - const { publicKey: comp, publicKeyUncompressed } = lengths; - try { - const l = publicKey.length; - if (isCompressed === true && l !== comp) - return false; - if (isCompressed === false && l !== publicKeyUncompressed) - return false; - return !!Point.fromBytes(publicKey); - } - catch (error) { - return false; - } - } - /** - * Produces cryptographically secure secret key from random of size - * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. - */ - function randomSecretKey(seed) { - seed = seed === undefined ? randomBytes_(lengths.seed) : seed; - return mapHashToField(abytes(seed, lengths.seed, 'seed'), Fn.ORDER); - } - /** - * Computes public key for a secret key. Checks for validity of the secret key. - * @param isCompressed - whether to return compact (default), or full key - * @returns Public key, full when isCompressed=false; short when isCompressed=true - */ - function getPublicKey(secretKey, isCompressed = true) { - return Point.BASE.multiply(Fn.fromBytes(secretKey)).toBytes(isCompressed); - } - /** - * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. - */ - function isProbPub(item) { - const { secretKey, publicKey, publicKeyUncompressed } = lengths; - const allowedLengths = Fn._lengths; - if (!isBytes(item)) - return undefined; - const l = abytes(item, undefined, 'key').length; - const isPub = l === publicKey || l === publicKeyUncompressed; - const isSec = l === secretKey || !!allowedLengths?.includes(l); - // P-521 accepts both 65- and 66-byte secret keys, so overlapping lengths stay ambiguous. - if (isPub && isSec) - return undefined; - return isPub; - } - /** - * ECDH (Elliptic Curve Diffie Hellman). - * Computes encoded shared point from secret key A and public key B. - * Checks: 1) secret key validity 2) shared key is on-curve. - * Does NOT hash the result or expose the SEC 1 x-coordinate-only `z`. - * Returns the encoded shared point on purpose: callers that need `x_P` - * can derive it from the encoded point, but `x_P` alone cannot recover the - * point/parity back. - * This helper only exposes the fully validated public-key path, not cofactor DH. - * @param isCompressed - whether to return compact (default), or full key - * @returns shared point encoding - */ - function getSharedSecret(secretKeyA, publicKeyB, isCompressed = true) { - if (isProbPub(secretKeyA) === true) - throw new Error('first arg must be private key'); - if (isProbPub(publicKeyB) === false) - throw new Error('second arg must be public key'); - const s = Fn.fromBytes(secretKeyA); - const b = Point.fromBytes(publicKeyB); // checks for being on-curve - return b.multiply(s).toBytes(isCompressed); - } - const utils = { - isValidSecretKey, - isValidPublicKey, - randomSecretKey, - }; - const keygen = createKeygen(randomSecretKey, getPublicKey); - Object.freeze(utils); - Object.freeze(lengths); - return Object.freeze({ getPublicKey, getSharedSecret, keygen, Point, utils, lengths }); -} -/** - * Creates ECDSA signing interface for given elliptic curve `Point` and `hash` function. - * - * @param Point - created using {@link weierstrass} function - * @param hash - used for 1) message prehash-ing 2) k generation in `sign`, using hmac_drbg(hash) - * @param ecdsaOpts - rarely needed, see {@link ECDSAOpts}: - * - `lowS`: Default low-S policy. - * - `hmac`: HMAC implementation used by RFC6979 DRBG. - * - `randomBytes`: Optional RNG override. - * - `bits2int`: Optional hash-to-int conversion override. - * - `bits2int_modN`: Optional hash-to-int-mod-n conversion override. - * - * @returns ECDSA helper namespace. - * @example - * Create an ECDSA signer/verifier bundle for one curve implementation. - * - * ```ts - * import { ecdsa } from '@noble/curves/abstract/weierstrass.js'; - * import { p256 } from '@noble/curves/nist.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const p256ecdsa = ecdsa(p256.Point, sha256); - * const { secretKey, publicKey } = p256ecdsa.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p256ecdsa.sign(msg, secretKey); - * const isValid = p256ecdsa.verify(sig, msg, publicKey); - * ``` - */ -export function ecdsa(Point, hash, ecdsaOpts = {}) { - // Custom hash / bits2int hooks are treated as pure functions over validated caller-owned bytes. - const hash_ = hash; - ahash(hash_); - validateObject(ecdsaOpts, {}, { - hmac: 'function', - lowS: 'boolean', - randomBytes: 'function', - bits2int: 'function', - bits2int_modN: 'function', - }); - ecdsaOpts = Object.assign({}, ecdsaOpts); - const randomBytes = ecdsaOpts.randomBytes === undefined ? wcRandomBytes : ecdsaOpts.randomBytes; - const hmac = ecdsaOpts.hmac === undefined - ? (key, msg) => nobleHmac(hash_, key, msg) - : ecdsaOpts.hmac; - const { Fp, Fn } = Point; - const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn; - const { keygen, getPublicKey, getSharedSecret, utils, lengths } = ecdh(Point, ecdsaOpts); - const defaultSigOpts = { - prehash: true, - lowS: typeof ecdsaOpts.lowS === 'boolean' ? ecdsaOpts.lowS : true, - format: 'compact', - extraEntropy: false, - }; - // SEC 1 4.1.6 public-key recovery tries x = r + jn for j = 0..h. Our recovered-signature - // format only stores one overflow bit, so it can only distinguish q.x = r from q.x = r + n. - // A third lift would have the form q.x = r + 2n. Since valid ECDSA r is in 1..n-1, the - // smallest such lift is 1 + 2n, not 2n. - const hasLargeRecoveryLifts = CURVE_ORDER * _2n + _1n < Fp.ORDER; - function isBiggerThanHalfOrder(number) { - const HALF = CURVE_ORDER >> _1n; - return number > HALF; - } - function validateRS(title, num) { - if (!Fn.isValidNot0(num)) - throw new Error(`invalid signature ${title}: out of range 1..Point.Fn.ORDER`); - return num; - } - function assertRecoverableCurve() { - // ECDSA recovery only supports curves where the current recovery id can distinguish - // q.x = r and q.x = r + n; larger lifts may need additional `r + n*i` branches. - // SEC 1 4.1.6 recovers candidates via x = r + jn, but this format only encodes j = 0 or 1. - // The next possible candidate is q.x = r + 2n, and its smallest valid value is 1 + 2n. - // To easily get i, we either need to: - // a. increase amount of valid recid values (4, 5...); OR - // b. prohibit recovered signatures for those curves. - if (hasLargeRecoveryLifts) - throw new Error('"recovered" sig type is not supported for cofactor >2 curves'); - } - function validateSigLength(bytes, format) { - validateSigFormat(format); - const size = lengths.signature; - const sizer = format === 'compact' ? size : format === 'recovered' ? size + 1 : undefined; - return abytes(bytes, sizer); - } - /** - * ECDSA signature with its (r, s) properties. Supports compact, recovered & DER representations. - */ - class Signature { - r; - s; - recovery; - constructor(r, s, recovery) { - this.r = validateRS('r', r); // r in [1..N-1]; - this.s = validateRS('s', s); // s in [1..N-1]; - if (recovery != null) { - assertRecoverableCurve(); - if (![0, 1, 2, 3].includes(recovery)) - throw new Error('invalid recovery id'); - this.recovery = recovery; - } - Object.freeze(this); - } - static fromBytes(bytes, format = defaultSigOpts.format) { - validateSigLength(bytes, format); - let recid; - if (format === 'der') { - const { r, s } = DER.toSig(abytes(bytes)); - return new Signature(r, s); - } - if (format === 'recovered') { - recid = bytes[0]; - format = 'compact'; - bytes = bytes.subarray(1); - } - const L = lengths.signature / 2; - const r = bytes.subarray(0, L); - const s = bytes.subarray(L, L * 2); - return new Signature(Fn.fromBytes(r), Fn.fromBytes(s), recid); - } - static fromHex(hex, format) { - return this.fromBytes(hexToBytes(hex), format); - } - assertRecovery() { - const { recovery } = this; - if (recovery == null) - throw new Error('invalid recovery id: must be present'); - return recovery; - } - addRecoveryBit(recovery) { - return new Signature(this.r, this.s, recovery); - } - // Unlike the top-level helper below, this method expects a digest that has - // already been hashed to the curve's message representative. - recoverPublicKey(messageHash) { - const { r, s } = this; - const recovery = this.assertRecovery(); - const radj = recovery === 2 || recovery === 3 ? r + CURVE_ORDER : r; - if (!Fp.isValid(radj)) - throw new Error('invalid recovery id: sig.r+curve.n != R.x'); - const x = Fp.toBytes(radj); - const R = Point.fromBytes(concatBytes(pprefix((recovery & 1) === 0), x)); - const ir = Fn.inv(radj); // r^-1 - const h = bits2int_modN(abytes(messageHash, undefined, 'msgHash')); // Truncate hash - const u1 = Fn.create(-h * ir); // -hr^-1 - const u2 = Fn.create(s * ir); // sr^-1 - // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1). unsafe is fine: there is no private data. - const Q = Point.BASE.multiplyUnsafe(u1).add(R.multiplyUnsafe(u2)); - if (Q.is0()) - throw new Error('invalid recovery: point at infinify'); - Q.assertValidity(); - return Q; - } - // Signatures should be low-s, to prevent malleability. - hasHighS() { - return isBiggerThanHalfOrder(this.s); - } - toBytes(format = defaultSigOpts.format) { - validateSigFormat(format); - if (format === 'der') - return hexToBytes(DER.hexFromSig(this)); - const { r, s } = this; - const rb = Fn.toBytes(r); - const sb = Fn.toBytes(s); - if (format === 'recovered') { - assertRecoverableCurve(); - return concatBytes(Uint8Array.of(this.assertRecovery()), rb, sb); - } - return concatBytes(rb, sb); - } - toHex(format) { - return bytesToHex(this.toBytes(format)); - } - } - Object.freeze(Signature.prototype); - Object.freeze(Signature); - // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets. - // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int. - // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same. - // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors - const bits2int = ecdsaOpts.bits2int === undefined - ? function bits2int_def(bytes) { - // Our custom check "just in case", for protection against DoS - if (bytes.length > 8192) - throw new Error('input is too large'); - // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m) - // for some cases, since bytes.length * 8 is not actual bitLength. - const num = bytesToNumberBE(bytes); // check for == u8 done here - const delta = bytes.length * 8 - fnBits; // truncate to nBitLength leftmost bits - return delta > 0 ? num >> BigInt(delta) : num; - } - : ecdsaOpts.bits2int; - const bits2int_modN = ecdsaOpts.bits2int_modN === undefined - ? function bits2int_modN_def(bytes) { - return Fn.create(bits2int(bytes)); // can't use bytesToNumberBE here - } - : ecdsaOpts.bits2int_modN; - const ORDER_MASK = bitMask(fnBits); - // Pads output with zero as per spec. - /** Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. */ - function int2octets(num) { - aInRange('num < 2^' + fnBits, num, _0n, ORDER_MASK); - return Fn.toBytes(num); - } - function validateMsgAndHash(message, prehash) { - abytes(message, undefined, 'message'); - return (prehash ? abytes(hash_(message), undefined, 'prehashed message') : message); - } - /** - * Steps A, D of RFC6979 3.2. - * Creates RFC6979 seed; converts msg/privKey to numbers. - * Used only in sign, not in verify. - * - * Warning: we cannot assume here that message has same amount of bytes as curve order, - * this will be invalid at least for P521. Also it can be bigger for P224 + SHA256. - */ - function prepSig(message, secretKey, opts) { - const { lowS, prehash, extraEntropy } = validateSigOpts(opts, defaultSigOpts); - message = validateMsgAndHash(message, prehash); // RFC6979 3.2 A: h1 = H(m) - // We can't later call bits2octets, since nested bits2int is broken for curves - // with fnBits % 8 !== 0. Because of that, we unwrap it here as int2octets call. - // const bits2octets = (bits) => int2octets(bits2int_modN(bits)) - const h1int = bits2int_modN(message); - const d = Fn.fromBytes(secretKey); // validate secret key, convert to bigint - if (!Fn.isValidNot0(d)) - throw new Error('invalid private key'); - const seedArgs = [int2octets(d), int2octets(h1int)]; - // extraEntropy. RFC6979 3.6: additional k' (optional). - if (extraEntropy != null && extraEntropy !== false) { - // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k') - // gen random bytes OR pass as-is - const e = extraEntropy === true ? randomBytes(lengths.secretKey) : extraEntropy; - seedArgs.push(abytes(e, undefined, 'extraEntropy')); // check for being bytes - } - const seed = concatBytes(...seedArgs); // Step D of RFC6979 3.2 - const m = h1int; // no need to call bits2int second time here, it is inside truncateHash! - // Converts signature params into point w r/s, checks result for validity. - // To transform k => Signature: - // q = k⋅G - // r = q.x mod n - // s = k^-1(m + rd) mod n - // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to - // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it: - // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT - function k2sig(kBytes) { - // RFC 6979 Section 3.2, step 3: k = bits2int(T) - // Important: all mod() calls here must be done over N - const k = bits2int(kBytes); // Cannot use fields methods, since it is group element - if (!Fn.isValidNot0(k)) - return; // Valid scalars (including k) must be in 1..N-1 - const ik = Fn.inv(k); // k^-1 mod n - const q = Point.BASE.multiply(k).toAffine(); // q = k⋅G - const r = Fn.create(q.x); // r = q.x mod n - if (r === _0n) - return; - const s = Fn.create(ik * Fn.create(m + r * d)); // s = k^-1(m + rd) mod n - if (s === _0n) - return; - let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3 when q.x>n) - let normS = s; - if (lowS && isBiggerThanHalfOrder(s)) { - normS = Fn.neg(s); // if lowS was passed, ensure s is always in the bottom half of N - recovery ^= 1; - } - return new Signature(r, normS, hasLargeRecoveryLifts ? undefined : recovery); - } - return { seed, k2sig }; - } - /** - * Signs a message or message hash with a secret key. - * With the default `prehash: true`, raw message bytes are hashed internally; - * only `{ prehash: false }` expects a caller-supplied digest. - * - * ``` - * sign(m, d) where - * k = rfc6979_hmac_drbg(m, d) - * (x, y) = G × k - * r = x mod n - * s = (m + dr) / k mod n - * ``` - */ - function sign(message, secretKey, opts = {}) { - const { seed, k2sig } = prepSig(message, secretKey, opts); // Steps A, D of RFC6979 3.2. - const drbg = createHmacDrbg(hash_.outputLen, Fn.BYTES, hmac); - const sig = drbg(seed, k2sig); // Steps B, C, D, E, F, G - return sig.toBytes(opts.format); - } - /** - * Verifies a signature against message and public key. - * Rejects lowS signatures by default: see {@link ECDSAVerifyOpts}. - * Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf: - * - * ``` - * verify(r, s, h, P) where - * u1 = hs^-1 mod n - * u2 = rs^-1 mod n - * R = u1⋅G + u2⋅P - * mod(R.x, n) == r - * ``` - */ - function verify(signature, message, publicKey, opts = {}) { - const { lowS, prehash, format } = validateSigOpts(opts, defaultSigOpts); - publicKey = abytes(publicKey, undefined, 'publicKey'); - message = validateMsgAndHash(message, prehash); - if (!isBytes(signature)) { - const end = signature instanceof Signature ? ', use sig.toBytes()' : ''; - throw new Error('verify expects Uint8Array signature' + end); - } - validateSigLength(signature, format); // execute this twice because we want loud error - try { - const sig = Signature.fromBytes(signature, format); - const P = Point.fromBytes(publicKey); - if (lowS && sig.hasHighS()) - return false; - const { r, s } = sig; - const h = bits2int_modN(message); // mod n, not mod p - const is = Fn.inv(s); // s^-1 mod n - const u1 = Fn.create(h * is); // u1 = hs^-1 mod n - const u2 = Fn.create(r * is); // u2 = rs^-1 mod n - const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2)); // u1⋅G + u2⋅P - if (R.is0()) - return false; - const v = Fn.create(R.x); // v = r.x mod n - return v === r; - } - catch (e) { - return false; - } - } - function recoverPublicKey(signature, message, opts = {}) { - // Top-level recovery mirrors `sign()` / `verify()`: it hashes raw message - // bytes first unless the caller passes `{ prehash: false }`. - const { prehash } = validateSigOpts(opts, defaultSigOpts); - message = validateMsgAndHash(message, prehash); - return Signature.fromBytes(signature, 'recovered').recoverPublicKey(message).toBytes(); - } - return Object.freeze({ - keygen, - getPublicKey, - getSharedSecret, - utils, - lengths, - Point, - sign, - verify, - recoverPublicKey, - Signature, - hash: hash_, - }); -} -//# sourceMappingURL=weierstrass.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/abstract/weierstrass.js.map b/node_modules/@noble/curves/abstract/weierstrass.js.map deleted file mode 100644 index 466df4b..0000000 --- a/node_modules/@noble/curves/abstract/weierstrass.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"weierstrass.js","sourceRoot":"","sources":["../src/abstract/weierstrass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,sEAAsE;AACtE,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EACL,UAAU,EACV,KAAK,EACL,MAAM,EACN,QAAQ,EACR,WAAW,EACX,MAAM,EACN,OAAO,EACP,UAAU,EACV,eAAe,EACf,WAAW,EACX,cAAc,EACd,UAAU,EACV,OAAO,EACP,mBAAmB,EACnB,cAAc,EACd,WAAW,IAAI,aAAa,GAM7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,UAAU,EACV,IAAI,GAKL,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,GAEd,MAAM,cAAc,CAAC;AAwCtB,qEAAqE;AACrE,oEAAoE;AACpE,6EAA6E;AAC7E,0EAA0E;AAC1E,MAAM,UAAU,GAAG,CAAC,GAAW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E,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB;YAC1C,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,SAAS,gBAAgB,CACvB,SAA2B,EAC3B,OAAyB,EACzB,OAA+B,EAAE;QAEjC,0EAA0E;QAC1E,6DAA6D;QAC7D,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAC1D,OAAO,GAAG,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/C,OAAO,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;IACzF,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,MAAM;QACN,YAAY;QACZ,eAAe;QACf,KAAK;QACL,OAAO;QACP,KAAK;QACL,IAAI;QACJ,MAAM;QACN,gBAAgB;QAChB,SAAS;QACT,IAAI,EAAE,KAAK;KACZ,CAAkB,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/bls12-381.d.ts b/node_modules/@noble/curves/bls12-381.d.ts deleted file mode 100644 index 1265480..0000000 --- a/node_modules/@noble/curves/bls12-381.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { type BlsCurvePairWithSignatures } from './abstract/bls.ts'; -import { type IField } from './abstract/modular.ts'; -import { type TRet } from './utils.ts'; -/** - * bls12-381 Fr (Fn) field. - * `fromBytes()` reduces modulo `q` instead of rejecting non-canonical encodings. - */ -export declare const bls12_381_Fr: TRet>; -/** - * bls12-381 pairing-friendly curve construction. - * Provides both longSignatures and shortSignatures. - * @example - * bls12-381 pairing-friendly curve construction. - * - * ```ts - * const bls = bls12_381.longSignatures; - * const { secretKey, publicKey } = bls.keygen(); - * const msg = bls.hash(new TextEncoder().encode('hello noble')); - * const sig = bls.sign(msg, secretKey); - * const isValid = bls.verify(sig, msg, publicKey); - * ``` - */ -export declare const bls12_381: BlsCurvePairWithSignatures; -//# sourceMappingURL=bls12-381.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/bls12-381.d.ts.map b/node_modules/@noble/curves/bls12-381.d.ts.map deleted file mode 100644 index 4b4560a..0000000 --- a/node_modules/@noble/curves/bls12-381.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bls12-381.d.ts","sourceRoot":"","sources":["src/bls12-381.ts"],"names":[],"mappings":"AAgFA,OAAO,EAAO,KAAK,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAS,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAYL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AA2DpB;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAEpB,CAAC;AA+Y3B;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,EAAE,0BAOvB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/bls12-381.js b/node_modules/@noble/curves/bls12-381.js deleted file mode 100644 index 60f68f7..0000000 --- a/node_modules/@noble/curves/bls12-381.js +++ /dev/null @@ -1,678 +0,0 @@ -/** - * bls12-381 is pairing-friendly Barreto-Lynn-Scott elliptic curve construction allowing to: - -* Construct zk-SNARKs at the ~120-bit security, as per [Barbulescu-Duquesne 2017](https://hal.science/hal-01534101/file/main.pdf) -* Efficiently verify N aggregate signatures with 1 pairing and N ec additions: -the Boneh-Lynn-Shacham signature scheme is orders of magnitude more efficient than Schnorr - -BLS can mean 2 different things: - -* Barreto-Lynn-Scott: BLS12, a Pairing Friendly Elliptic Curve -* Boneh-Lynn-Shacham: A Signature Scheme. - -### Summary - -1. BLS Relies on expensive bilinear pairing -2. Secret Keys: 32 bytes -3. Public Keys: 48 OR 96 bytes - big-endian x coordinate of point on G1 OR G2 curve -4. Signatures: 96 OR 48 bytes - big-endian x coordinate of point on G2 OR G1 curve -5. The 12 stands for the Embedding degree. - -Modes of operation: - -* Long signatures: 48-byte keys + 96-byte sigs (G1 keys + G2 sigs). -* Short signatures: 96-byte keys + 48-byte sigs (G2 keys + G1 sigs). - -### Formulas - -- `P = pk x G` - public keys -- `S = pk x H(m)` - signing, uses hash-to-curve on m -- `e(P, H(m)) == e(G, S)` - verification using pairings -- `e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si))` - signature aggregation - -### Curves - -G1 is ordinary elliptic curve. G2 is extension field curve, think "over complex numbers". - -- G1: y² = x³ + 4 -- G2: y² = x³ + 4(u + 1) where u = √−1; r-order subgroup of E'(Fp²), M-type twist - -### Towers - -Pairing G1 + G2 produces element in Fp₁₂, 12-degree polynomial. -Fp₁₂ is usually implemented using tower of lower-degree polynomials for speed. - -- Fp₁₂ = Fp₆² => Fp₂³ -- Fp(u) / (u² - β) where β = -1 -- Fp₂(v) / (v³ - ξ) where ξ = u + 1 -- Fp₆(w) / (w² - γ) where γ = v -- Fp²[u] = Fp/u²+1 -- Fp⁶[v] = Fp²/v³-1-u -- Fp¹²[w] = Fp⁶/w²-v - -### Params - -* Embedding degree (k): 12 -* Seed is sometimes named x or t -* t = -15132376222941642752 -* p = (t-1)² * (t⁴-t²+1)/3 + t -* r = t⁴-t²+1 -* Ate loop size: X - -To verify curve parameters, see -[pairing-friendly-curves spec](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-pairing-friendly-curves-11). -Basic math is done over finite fields over p. -More complicated math is done over polynominal extension fields. - -### Compatibility and notes -1. It is compatible with Algorand, Chia, Dfinity, Ethereum, Filecoin, ZEC. -Filecoin uses little endian byte arrays for secret keys - make sure to reverse byte order. -2. Make sure to correctly select mode: "long signature" or "short signature". -3. Compatible with specs: - RFC 9380, - [cfrg-pairing-friendly-curves-11](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-pairing-friendly-curves-11), - [cfrg-bls-signature-05](https://datatracker.ietf.org/doc/draft-irtf-cfrg-bls-signature/). - - * - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { sha256 } from '@noble/hashes/sha2.js'; -import { bls } from "./abstract/bls.js"; -import { Field } from "./abstract/modular.js"; -import { abytes, bitLen, bitMask, bytesToHex, bytesToNumberBE, concatBytes, copyBytes, hexToBytes, numberToBytesBE, randomBytes, } from "./utils.js"; -// Types -import { isogenyMap } from "./abstract/hash-to-curve.js"; -import { psiFrobenius, tower12 } from "./abstract/tower.js"; -import { mapToCurveSimpleSWU, weierstrass, } from "./abstract/weierstrass.js"; -// Be friendly to bad ECMAScript parsers by not using bigint literals -// prettier-ignore -const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); -// To verify math: -// https://tools.ietf.org/html/draft-irtf-cfrg-pairing-friendly-curves-11 -// The BLS parameter x (seed) for BLS12-381. The stored constant is `|x|`; call -// sites that need the signed parameter apply the minus sign themselves. -// x = -2^63 - 2^62 - 2^60 - 2^57 - 2^48 - 2^16 -const BLS_X = BigInt('0xd201000000010000'); -// t = x (called differently in different places) -// const t = -BLS_X; -const BLS_X_LEN = bitLen(BLS_X); -// a=0, b=4 -// P is characteristic of field Fp, in which curve calculations are done. -// p = (t-1)² * (t⁴-t²+1)/3 + t -// bls12_381_Fp = (t-1n)**2n * (t**4n - t**2n + 1n) / 3n + t -// r*h is curve order, amount of points on curve, -// where r is order of prime subgroup and h is cofactor. -// r = t⁴-t²+1 -// r = (t**4n - t**2n + 1n) -// cofactor h of G1: (t - 1)²/3, with the signed convention `t = -x` -// cofactorG1 = (t-1n)**2n/3n -// x = 3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507 -// y = 1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569 -const bls12_381_CURVE_G1 = { - p: BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab'), - n: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001'), - h: BigInt('0x396c8c005555e1568c00aaab0000aaab'), - a: _0n, - b: _4n, - Gx: BigInt('0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb'), - Gy: BigInt('0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1'), -}; -// CURVE FIELDS -// r = z⁴ − z² + 1; CURVE.n from other curves -/** - * bls12-381 Fr (Fn) field. - * `fromBytes()` reduces modulo `q` instead of rejecting non-canonical encodings. - */ -export const bls12_381_Fr = Field(bls12_381_CURVE_G1.n, { - modFromBytes: true, -}); -const { Fp, Fp2, Fp6, Fp12 } = tower12({ - ORDER: bls12_381_CURVE_G1.p, - X_LEN: BLS_X_LEN, - // Finite extension field over irreducible polynominal. - // Fp(u) / (u² - β) where β = -1 - // Public `Fp2.NONRESIDUE` below is the sextic-tower value `(1, 1) = u + 1`; - // the quadratic non-residue for the base Fp2 construction is still `-1`. - FP2_NONRESIDUE: [_1n, _1n], - Fp2mulByB: ({ c0, c1 }) => { - const t0 = Fp.mul(c0, _4n); // 4 * c0 - const t1 = Fp.mul(c1, _4n); // 4 * c1 - // (T0-T1) + (T0+T1)*i - return { c0: Fp.sub(t0, t1), c1: Fp.add(t0, t1) }; - }, - Fp12finalExponentiate: (num) => { - const x = BLS_X; - // this^(q⁶) / this - const t0 = Fp12.div(Fp12.frobeniusMap(num, 6), num); - // t0^(q²) * t0 - const t1 = Fp12.mul(Fp12.frobeniusMap(t0, 2), t0); - const t2 = Fp12.conjugate(Fp12._cyclotomicExp(t1, x)); - const t3 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicSquare(t1)), t2); - const t4 = Fp12.conjugate(Fp12._cyclotomicExp(t3, x)); - const t5 = Fp12.conjugate(Fp12._cyclotomicExp(t4, x)); - const t6 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicExp(t5, x)), Fp12._cyclotomicSquare(t2)); - const t7 = Fp12.conjugate(Fp12._cyclotomicExp(t6, x)); - const t2_t5_pow_q2 = Fp12.frobeniusMap(Fp12.mul(t2, t5), 2); - const t4_t1_pow_q3 = Fp12.frobeniusMap(Fp12.mul(t4, t1), 3); - const t6_t1c_pow_q1 = Fp12.frobeniusMap(Fp12.mul(t6, Fp12.conjugate(t1)), 1); - const t7_t3c_t1 = Fp12.mul(Fp12.mul(t7, Fp12.conjugate(t3)), t1); - // (t2 * t5)^(q²) * (t4 * t1)^(q³) * (t6 * t1.conj)^(q^1) * t7 * t3.conj * t1 - return Fp12.mul(Fp12.mul(Fp12.mul(t2_t5_pow_q2, t4_t1_pow_q3), t6_t1c_pow_q1), t7_t3c_t1); - }, -}); -// GLV endomorphism Ψ(P), for fast cofactor clearing. `Fp2.NONRESIDUE` here is -// the tower value `u + 1`, so the Frobenius base passed to psiFrobenius is -// `1 / (u + 1)`, and psi2 derives the published `1 / 2^((p - 1) / 3)` constant internally. -let frob; -const getFrob = () => frob || (frob = psiFrobenius(Fp, Fp2, Fp2.div(Fp2.ONE, Fp2.NONRESIDUE))); -// Eager psiFrobenius setup now dominates `bls12-381.js` import, so defer it to -// first use. After that these locals are rewritten to the direct helper refs. -let G2psi = (c, P) => { - const fn = getFrob().G2psi; - G2psi = fn; - return fn(c, P); -}; -let G2psi2 = (c, P) => { - const fn = getFrob().G2psi2; - G2psi2 = fn; - return fn(c, P); -}; -/** - * Default hash_to_field / hash-to-curve for BLS. - * m: 1 for G1, 2 for G2 - * k: target security level in bits - * hash: any function, e.g. BBS+ uses BLAKE2: see [github](https://github.com/hyperledger/aries-framework-go/issues/2247). - * Field/hash parameters come from [section 8.8.2 of RFC 9380](https://www.rfc-editor.org/rfc/rfc9380#section-8.8.2), - * but the `DST` / `encodeDST` strings below are the BLS-signature-suite override. - */ -const hasher_opts = Object.freeze({ - DST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', - encodeDST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', - p: Fp.ORDER, - m: 2, - k: 128, - expand: 'xmd', - hash: sha256, -}); -// a=0, b=4 -// cofactor h of G2, derived with the signed convention `t = -x` -// (t^8 - 4t^7 + 5t^6 - 4t^4 + 6t^3 - 4t^2 - 4t + 13)/9 -// cofactorG2 = (t**8n - 4n*t**7n + 5n*t**6n - 4n*t**4n + 6n*t**3n - 4n*t**2n - 4n*t+13n)/9n -// x = 3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758*u + 352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160 -// y = 927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582*u + 1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905 -const bls12_381_CURVE_G2 = { - p: Fp2.ORDER, - n: bls12_381_CURVE_G1.n, - h: BigInt('0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5'), - a: Fp2.ZERO, - b: Fp2.fromBigTuple([_4n, _4n]), - Gx: Fp2.fromBigTuple([ - BigInt('0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8'), - BigInt('0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e'), - ]), - Gy: Fp2.fromBigTuple([ - BigInt('0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801'), - BigInt('0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be'), - ]), -}; -// Encoding utils -const sortBit = (parts, p) => { - for (const part of parts) { - if (part !== _0n) - return Boolean((part * _2n) / p); - } - return false; -}; -const fp2 = { - // Generic tower bytes use `c0 || c1`, but the BLS12-381 G2 point/signature wire encoding uses - // `c1 || c0`, so keep this local wrapper instead of changing generic field serialization. - encode({ c0, c1 }) { - const { BYTES: L } = Fp; - return concatBytes(numberToBytesBE(c1, L), numberToBytesBE(c0, L)); - }, - decode(bytes) { - const { BYTES: L } = Fp; - return Fp2.create({ - c0: Fp.create(bytesToNumberBE(bytes.subarray(L))), - c1: Fp.create(bytesToNumberBE(bytes.subarray(0, L))), - }); - }, -}; -const BaseFp = Fp; -// Keep BLS12-381 point/signature codecs on one control-flow skeleton: the G1/G2 -// and point/signature variants differ only in field packing, subgroup bytes, and -// whether uncompressed form is allowed. Copy-paste decoders were diverging. -const coder = (name, Fp, b, encode, decode, yparts) => { - const F = Fp; - const enc = encode; - const dec = decode; - const W = F.BYTES; - return (allowUncompressed) => ({ - encode(point, compressed = true) { - if (!compressed && !allowUncompressed) - throw new Error('invalid signature: expected compressed encoding'); - const infinity = point.is0(); - const { x, y } = point.toAffine(); - const bytes = compressed ? enc(x) : concatBytes(enc(x), enc(y)); - let sort; - if (compressed && !infinity) - sort = sortBit(yparts(y), BaseFp.ORDER); - return setMask(bytes, { compressed, infinity, sort }); - }, - decode(bytes) { - const raw = allowUncompressed - ? abytes(bytes, undefined, 'point') - : abytes(bytes, W, 'signature'); - const { compressed, infinity, sort, value } = parseMask(raw); - if (!allowUncompressed && !compressed) - throw new Error('invalid signature: expected compressed encoding'); - const len = compressed ? W : 2 * W; - if (value.length !== len) - throw new Error(`invalid ${name} point: expected ${len} bytes`); - if (infinity) { - // Infinity canonicality has to be checked on raw bytes before decode() - // reduces coordinates modulo p and turns non-empty payloads into zero. - for (const b of value) { - if (b) - throw new Error(`invalid ${name} point: non-canonical zero`); - } - return { x: F.ZERO, y: F.ZERO }; - } - const x = dec(compressed ? value : value.subarray(0, W)); - let y; - if (compressed) { - y = F.sqrt(F.add(F.pow(x, _3n), b)); - if (!y) - throw new Error(`invalid ${name} point: compressed`); - if (sortBit(yparts(y), BaseFp.ORDER) !== sort) - y = F.neg(y); - } - else { - y = dec(value.subarray(W)); - } - // Noble keeps the permissive coordinate reduction path here, but an - // omitted infinity flag must not still decode to ZERO afterwards. - if (!compressed && F.is0(x) && F.is0(y)) - throw new Error(`invalid ${name} point: uncompressed`); - return { x, y }; - }, - }); -}; -// Internal helper only: it copies before clearing the top flag bits. The -// pairing-friendly-curves draft C.2 step 1 rejects 0x20 / 0x60 / 0xe0 because -// S_bit must be zero for infinity and for all uncompressed encodings. -function validateMask({ compressed, infinity, sort }) { - if ((!compressed && !infinity && sort) || // 0010_0000 = 0x20 - (!compressed && infinity && sort) || // 0110_0000 = 0x60 - (compressed && infinity && sort) // 1110_0000 = 0xe0 - ) - throw new Error('invalid encoding flag'); -} -function parseMask(bytes) { - // Copy, so we can remove mask data. - // It will be removed also later, when Fp.create will call modulo. - bytes = copyBytes(bytes); - const mask = bytes[0] & 0b1110_0000; - const compressed = !!((mask >> 7) & 1); // compression bit (0b1000_0000) - const infinity = !!((mask >> 6) & 1); // point at infinity bit (0b0100_0000) - const sort = !!((mask >> 5) & 1); // sort bit (0b0010_0000) - validateMask({ compressed, infinity, sort }); - bytes[0] &= 0b0001_1111; // clear mask (zero first 3 bits) - return { compressed, infinity, sort, value: bytes }; -} -// Internal helper only: mutates a non-empty fresh buffer in place and just -// sets bits. Keep the same invalid-flag guard as parseMask() so encoders cannot -// manufacture states that decoders already reject. -function setMask(bytes, mask) { - if (bytes[0] & 0b1110_0000) - throw new Error('setMask: non-empty mask'); - validateMask({ compressed: !!mask.compressed, infinity: !!mask.infinity, sort: !!mask.sort }); - if (mask.compressed) - bytes[0] |= 0b1000_0000; - if (mask.infinity) - bytes[0] |= 0b0100_0000; - if (mask.sort) - bytes[0] |= 0b0010_0000; - return bytes; -} -const g1coder = coder('G1', Fp, Fp.create(bls12_381_CURVE_G1.b), (x) => numberToBytesBE(x, Fp.BYTES), (bytes) => Fp.create(bytesToNumberBE(bytes) & bitMask(Fp.BITS)), (y) => [y]); -const g1 = { point: g1coder(true), sig: g1coder(false) }; -const signatureG1ToBytes = (point) => { - point.assertValidity(); - return g1.sig.encode(point); -}; -function signatureG1FromBytes(bytes) { - const Point = bls12_381.G1.Point; - const point = Point.fromAffine(g1.sig.decode(bytes)); - point.assertValidity(); - return point; -} -const g2coder = coder('G2', Fp2, bls12_381_CURVE_G2.b, fp2.encode, fp2.decode, (y) => [ - y.c1, - y.c0, -]); -const g2 = { point: g2coder(true), sig: g2coder(false) }; -const signatureG2ToBytes = (point) => { - point.assertValidity(); - return g2.sig.encode(point); -}; -function signatureG2FromBytes(bytes) { - const Point = bls12_381.G2.Point; - const point = Point.fromAffine(g2.sig.decode(bytes)); - point.assertValidity(); - return point; -} -const signatureCoders = { - ShortSignature: { - fromBytes(bytes) { - return signatureG1FromBytes(abytes(bytes)); - }, - fromHex(hex) { - return signatureG1FromBytes(hexToBytes(hex)); - }, - toBytes(point) { - return signatureG1ToBytes(point); - }, - // Historical alias: BLS signatures have a single compressed byte format here. - toRawBytes(point) { - return signatureG1ToBytes(point); - }, - toHex(point) { - return bytesToHex(signatureG1ToBytes(point)); - }, - }, - LongSignature: { - fromBytes(bytes) { - return signatureG2FromBytes(abytes(bytes)); - }, - fromHex(hex) { - return signatureG2FromBytes(hexToBytes(hex)); - }, - toBytes(point) { - return signatureG2ToBytes(point); - }, - // Historical alias: BLS signatures have a single compressed byte format here. - toRawBytes(point) { - return signatureG2ToBytes(point); - }, - toHex(point) { - return bytesToHex(signatureG2ToBytes(point)); - }, - }, -}; -const fields = { - Fp, - Fp2, - Fp6, - Fp12, - Fr: bls12_381_Fr, -}; -const G1_Point = weierstrass(bls12_381_CURVE_G1, { - // Public point APIs still accept infinity, even though the Zcash proof - // encoding rules cited above only define nonzero point encodings. - allowInfinityPoint: true, - Fn: bls12_381_Fr, - fromBytes: g1.point.decode, - toBytes: (_c, point, isComp) => g1.point.encode(point, isComp), - // Checks is the point resides in prime-order subgroup. - // point.isTorsionFree() should return true for valid points - // It returns false for shitty points. - // https://eprint.iacr.org/2021/1130.pdf - isTorsionFree: (c, point) => { - // GLV endomorphism ψ(P) - const beta = BigInt('0x5f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe'); - const phi = new c(Fp.mul(point.X, beta), point.Y, point.Z); - // TODO: unroll - const xP = point.multiplyUnsafe(BLS_X).negate(); // [x]P - const u2P = xP.multiplyUnsafe(BLS_X); // [u2]P - return u2P.equals(phi); - }, - // Clear cofactor of G1 - // https://eprint.iacr.org/2019/403 - clearCofactor: (_c, point) => { - // return this.multiplyUnsafe(CURVE.h); - return point.multiplyUnsafe(BLS_X).add(point); // x*P + P - }, -}); -const G2_Point = weierstrass(bls12_381_CURVE_G2, { - Fp: Fp2, - // Public point APIs still accept infinity, even though the Zcash proof - // encoding rules cited above only define nonzero point encodings. - allowInfinityPoint: true, - Fn: bls12_381_Fr, - fromBytes: g2.point.decode, - toBytes: (_c, point, isComp) => g2.point.encode(point, isComp), - // https://eprint.iacr.org/2021/1130.pdf - // Older version: https://eprint.iacr.org/2019/814.pdf - isTorsionFree: (c, P) => { - return P.multiplyUnsafe(BLS_X).negate().equals(G2psi(c, P)); // ψ(P) == [u](P) - }, - // clear_cofactor_bls12381_g2 from RFC 9380. - // https://eprint.iacr.org/2017/419.pdf - // prettier-ignore - clearCofactor: (c, P) => { - const x = BLS_X; - let t1 = P.multiplyUnsafe(x).negate(); // [-x]P - let t2 = G2psi(c, P); // Ψ(P) - let t3 = P.double(); // 2P - t3 = G2psi2(c, t3); // Ψ²(2P) - t3 = t3.subtract(t2); // Ψ²(2P) - Ψ(P) - t2 = t1.add(t2); // [-x]P + Ψ(P) - t2 = t2.multiplyUnsafe(x).negate(); // [x²]P - [x]Ψ(P) - t3 = t3.add(t2); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) - t3 = t3.subtract(t1); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + [x]P - const Q = t3.subtract(P); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + [x]P - 1P - return Q; // [x²-x-1]P + [x-1]Ψ(P) + Ψ²(2P) - }, -}); -const bls12_hasher_opts = { - mapToG1: mapToG1, - mapToG2: mapToG2, - hasherOpts: hasher_opts, - // RFC 9380 Appendix J defines distinct G1/G2 RO and NU suite IDs, and - // draft-irtf-cfrg-bls-signature-06 §4.2.1 gives separate G1/G2 `_NUL_` DSTs. - // Keep G1 encode-to-curve on the G1 domain instead of inheriting G2's `encodeDST`. - hasherOptsG1: { - ...hasher_opts, - m: 1, - DST: 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_', - encodeDST: 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_', - }, - hasherOptsG2: { ...hasher_opts }, -}; -const bls12_params = { - ateLoopSize: BLS_X, // The BLS parameter x for BLS12-381 - xNegative: true, - twistType: 'multiplicative', - randomBytes: randomBytes, -}; -/** - * bls12-381 pairing-friendly curve construction. - * Provides both longSignatures and shortSignatures. - * @example - * bls12-381 pairing-friendly curve construction. - * - * ```ts - * const bls = bls12_381.longSignatures; - * const { secretKey, publicKey } = bls.keygen(); - * const msg = bls.hash(new TextEncoder().encode('hello noble')); - * const sig = bls.sign(msg, secretKey); - * const isValid = bls.verify(sig, msg, publicKey); - * ``` - */ -export const bls12_381 = bls(fields, G1_Point, G2_Point, bls12_params, bls12_hasher_opts, signatureCoders); -// 3-isogeny map from E' to E https://www.rfc-editor.org/rfc/rfc9380#appendix-E.3 -// Coefficients stay in ascending `k_(?,0)`..`k_(?,d)` order; isogenyMap() -// reverses them internally for Horner evaluation. -const isogenyMapG2 = isogenyMap(Fp2, [ - // xNum - [ - [ - '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', - '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', - ], - [ - '0x0', - '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a', - ], - [ - '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e', - '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d', - ], - [ - '0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1', - '0x0', - ], - ], - // xDen - [ - [ - '0x0', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63', - ], - [ - '0xc', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f', - ], - ['0x1', '0x0'], // LAST 1 - ], - // yNum - [ - [ - '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', - '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', - ], - [ - '0x0', - '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be', - ], - [ - '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c', - '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f', - ], - [ - '0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10', - '0x0', - ], - ], - // yDen - [ - [ - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', - ], - [ - '0x0', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3', - ], - [ - '0x12', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99', - ], - ['0x1', '0x0'], // LAST 1 - ], -].map((i) => i.map((pair) => Fp2.fromBigTuple(pair.map(BigInt))))); -// 11-isogeny map from E' to E. Coefficients stay in ascending -// `k_(?,0)`..`k_(?,d)` order; isogenyMap() reverses them for Horner evaluation. -const isogenyMapG1 = isogenyMap(Fp, [ - // xNum - [ - '0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7', - '0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb', - '0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0', - '0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861', - '0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9', - '0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983', - '0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84', - '0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e', - '0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317', - '0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e', - '0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b', - '0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229', - ], - // xDen - [ - '0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c', - '0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff', - '0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19', - '0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8', - '0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e', - '0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5', - '0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a', - '0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e', - '0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641', - '0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a', - '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', // LAST 1 - ], - // yNum - [ - '0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33', - '0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696', - '0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6', - '0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb', - '0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb', - '0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0', - '0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2', - '0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29', - '0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587', - '0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30', - '0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132', - '0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e', - '0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8', - '0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133', - '0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b', - '0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604', - ], - // yDen - [ - '0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1', - '0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d', - '0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2', - '0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416', - '0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d', - '0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac', - '0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c', - '0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9', - '0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a', - '0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55', - '0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8', - '0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092', - '0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc', - '0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7', - '0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f', - '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', // LAST 1 - ], -].map((i) => i.map((j) => BigInt(j)))); -let G1_SWU; -let G2_SWU; -// SWU setup validates the pre-isogeny curve parameters and builds sqrt-ratio helpers. -// Doing that eagerly adds about 10ms to `bls12-381.js` import here, so keep it lazy; after the -// first map call the cached mapper is reused directly. -const getG1_SWU = () => G1_SWU || - (G1_SWU = mapToCurveSimpleSWU(Fp, { - A: Fp.create(BigInt('0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d')), - B: Fp.create(BigInt('0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0')), - Z: Fp.create(BigInt(11)), - })); -const getG2_SWU = () => G2_SWU || - (G2_SWU = mapToCurveSimpleSWU(Fp2, { - // SWU map for the RFC 9380 §8.8.2 pre-isogeny G2 curve E': - // y² = x³ + 240i * x + 1012 + 1012i - A: Fp2.create({ c0: Fp.create(_0n), c1: Fp.create(BigInt(240)) }), // A' = 240 * I - B: Fp2.create({ c0: Fp.create(BigInt(1012)), c1: Fp.create(BigInt(1012)) }), // B' = 1012 * (1 + I) - Z: Fp2.create({ c0: Fp.create(BigInt(-2)), c1: Fp.create(BigInt(-1)) }), // Z: -(2 + I) - })); -// Internal hash-to-curve step: G1 uses `m = 1`, so only `scalars[0]` is read, -// and the result is the isogeny image on E before the subgroup clear. -function mapToG1(scalars) { - const { x, y } = getG1_SWU()(Fp.create(scalars[0])); - return isogenyMapG1(x, y); -} -// Internal hash-to-curve step: G2 expects the RFC `m = 2` pair, and the result -// is the isogeny image on E before the subgroup clear. -function mapToG2(scalars) { - const { x, y } = getG2_SWU()(Fp2.fromBigTuple(scalars)); - return isogenyMapG2(x, y); -} -//# sourceMappingURL=bls12-381.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/bls12-381.js.map b/node_modules/@noble/curves/bls12-381.js.map deleted file mode 100644 index 59e8fe9..0000000 --- a/node_modules/@noble/curves/bls12-381.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bls12-381.js","sourceRoot":"","sources":["src/bls12-381.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAmC,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,UAAU,EACV,eAAe,EACf,WAAW,EACX,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,GAGZ,MAAM,YAAY,CAAC;AACpB,QAAQ;AACR,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACL,mBAAmB,EACnB,WAAW,GAKZ,MAAM,2BAA2B,CAAC;AAEnC,qEAAqE;AACrE,kBAAkB;AAClB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAE1F,kBAAkB;AAClB,yEAAyE;AAEzE,+EAA+E;AAC/E,wEAAwE;AACxE,+CAA+C;AAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,oBAAo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E,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,sBAAsB;QACnG,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,cAAc;KACxF,CAAC,CAAC,CAAC;AAEN,8EAA8E;AAC9E,sEAAsE;AACtE,SAAS,OAAO,CAAC,OAAiB;IAChC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5B,CAAC;AACD,+EAA+E;AAC/E,uDAAuD;AACvD,SAAS,OAAO,CAAC,OAAiB;IAChC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAsB,CAAC,CAAC,CAAC;IACvE,OAAO,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/bn254.d.ts b/node_modules/@noble/curves/bn254.d.ts deleted file mode 100644 index 6472432..0000000 --- a/node_modules/@noble/curves/bn254.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * bn254, previously known as alt_bn_128, when it had 128-bit security. - -Barbulescu-Duquesne 2017 shown it's weaker: just about 100 bits, -so the naming has been adjusted to its prime bit count: -https://hal.science/hal-01534101/file/main.pdf. -Compatible with EIP-196 and EIP-197. - -There are huge compatibility issues in the ecosystem: - -1. Different libraries call it in different ways: "bn254", "bn256", "alt_bn128", "bn128". -2. libff has bn128, but it's a different curve with different G2: - https://github.com/scipr-lab/libff/blob/a44f482e18b8ac04d034c193bd9d7df7817ad73f/libff/algebra/curves/bn128/bn128_init.cpp#L166-L169 -3. halo2curves bn256 is also incompatible and returns different outputs - -We don't implement Point methods toHex / toBytes. -To work around this limitation, has to initialize points on their own from BigInts. -Reason it's not implemented is because [there is no standard](https://github.com/privacy-scaling-explorations/halo2curves/issues/109). -Points of divergence: - -- Endianness: LE vs BE (byte-swapped) -- Flags as first hex bits (similar to BLS) vs no-flags -- Imaginary part last in G2 vs first (c0, c1 vs c1, c0) - -The goal of our implementation is to support "Ethereum" variant of the curve, -because it at least has specs: - -- EIP196 (https://eips.ethereum.org/EIPS/eip-196) describes bn254 ECADD and ECMUL opcodes for EVM -- EIP197 (https://eips.ethereum.org/EIPS/eip-197) describes bn254 pairings -- It's hard: EIPs don't have proper tests. EIP-197 returns boolean output instead of Fp12 -- The existing implementations are bad. Some are deprecated: - - https://github.com/paritytech/bn (old version) - - https://github.com/ewasm/ethereum-bn128.rs (uses paritytech/bn) - - https://github.com/zcash-hackworks/bn - - https://github.com/arkworks-rs/curves/blob/master/bn254/src/lib.rs -- Python implementations use different towers and produce different Fp12 outputs: - - https://github.com/ethereum/py_pairing - - https://github.com/ethereum/py_ecc/tree/main/py_ecc/bn128 -- Points are encoded differently in different implementations - -### Params -Seed (X): 4965661367192848881 -Fr: (36x⁴+36x³+18x²+6x+1) -Fp: (36x⁴+36x³+24x²+6x+1) -(E / Fp ): Y² = X³+3 -(Et / Fp²): Y² = X³+3/(u+9) (D-type twist) -Ate loop size: 6x+2 - -### Towers -- Fp²[u] = Fp/u²+1 -- Fp⁶[v] = Fp²/v³-9-u -- Fp¹²[w] = Fp⁶/w²-v - - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { type BlsCurvePair, type BlsPostPrecomputeFn } from './abstract/bls.ts'; -import { type IField } from './abstract/modular.ts'; -import { type TRet } from './utils.ts'; -/** bn254 scalar field. */ -export declare const bn254_Fr: TRet>; -export declare const _postPrecompute: BlsPostPrecomputeFn; -/** - * bn254 (a.k.a. alt_bn128) pairing-friendly curve. - * Contains G1 / G2 operations and pairings only; the commented-out - * hash-to-curve and signature surface is intentionally not exposed here. - * @example - * Compute a pairing from the two generator points. - * - * ```ts - * const gt = bn254.pairing(bn254.G1.Point.BASE, bn254.G2.Point.BASE); - * ``` - */ -export declare const bn254: BlsCurvePair; -//# sourceMappingURL=bn254.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/bn254.d.ts.map b/node_modules/@noble/curves/bn254.d.ts.map deleted file mode 100644 index 5a5a128..0000000 --- a/node_modules/@noble/curves/bn254.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bn254.d.ts","sourceRoot":"","sources":["src/bn254.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,sEAAsE;AACtE,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAS,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,EAAU,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AA8B/C,0BAA0B;AAC1B,eAAO,MAAM,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CACU,CAAC;AA+DrD,eAAO,MAAM,eAAe,EAAE,mBAY7B,CAAC;AAyFF;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,KAAK,EAAE,YAKnB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/bn254.js b/node_modules/@noble/curves/bn254.js deleted file mode 100644 index 835721d..0000000 --- a/node_modules/@noble/curves/bn254.js +++ /dev/null @@ -1,245 +0,0 @@ -/** - * bn254, previously known as alt_bn_128, when it had 128-bit security. - -Barbulescu-Duquesne 2017 shown it's weaker: just about 100 bits, -so the naming has been adjusted to its prime bit count: -https://hal.science/hal-01534101/file/main.pdf. -Compatible with EIP-196 and EIP-197. - -There are huge compatibility issues in the ecosystem: - -1. Different libraries call it in different ways: "bn254", "bn256", "alt_bn128", "bn128". -2. libff has bn128, but it's a different curve with different G2: - https://github.com/scipr-lab/libff/blob/a44f482e18b8ac04d034c193bd9d7df7817ad73f/libff/algebra/curves/bn128/bn128_init.cpp#L166-L169 -3. halo2curves bn256 is also incompatible and returns different outputs - -We don't implement Point methods toHex / toBytes. -To work around this limitation, has to initialize points on their own from BigInts. -Reason it's not implemented is because [there is no standard](https://github.com/privacy-scaling-explorations/halo2curves/issues/109). -Points of divergence: - -- Endianness: LE vs BE (byte-swapped) -- Flags as first hex bits (similar to BLS) vs no-flags -- Imaginary part last in G2 vs first (c0, c1 vs c1, c0) - -The goal of our implementation is to support "Ethereum" variant of the curve, -because it at least has specs: - -- EIP196 (https://eips.ethereum.org/EIPS/eip-196) describes bn254 ECADD and ECMUL opcodes for EVM -- EIP197 (https://eips.ethereum.org/EIPS/eip-197) describes bn254 pairings -- It's hard: EIPs don't have proper tests. EIP-197 returns boolean output instead of Fp12 -- The existing implementations are bad. Some are deprecated: - - https://github.com/paritytech/bn (old version) - - https://github.com/ewasm/ethereum-bn128.rs (uses paritytech/bn) - - https://github.com/zcash-hackworks/bn - - https://github.com/arkworks-rs/curves/blob/master/bn254/src/lib.rs -- Python implementations use different towers and produce different Fp12 outputs: - - https://github.com/ethereum/py_pairing - - https://github.com/ethereum/py_ecc/tree/main/py_ecc/bn128 -- Points are encoded differently in different implementations - -### Params -Seed (X): 4965661367192848881 -Fr: (36x⁴+36x³+18x²+6x+1) -Fp: (36x⁴+36x³+24x²+6x+1) -(E / Fp ): Y² = X³+3 -(Et / Fp²): Y² = X³+3/(u+9) (D-type twist) -Ate loop size: 6x+2 - -### Towers -- Fp²[u] = Fp/u²+1 -- Fp⁶[v] = Fp²/v³-9-u -- Fp¹²[w] = Fp⁶/w²-v - - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { blsBasic, } from "./abstract/bls.js"; -import { Field } from "./abstract/modular.js"; -import { psiFrobenius, tower12 } from "./abstract/tower.js"; -import { weierstrass } from "./abstract/weierstrass.js"; -import { bitLen } from "./utils.js"; -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3); -const _6n = /* @__PURE__ */ BigInt(6); -// Locally documented BN pairing seed. EIP-197 does not name this scalar -// directly; noble stores the positive value and derives any `-x` uses later. -const BN_X = /* @__PURE__ */ BigInt('4965661367192848881'); -// Bit width of the stored seed itself, not the derived Miller-loop scalar `6x+2`. -const BN_X_LEN = /* @__PURE__ */ (() => bitLen(BN_X))(); -// Derived scalar used by the optimized G2 subgroup test required by EIP-197. -const SIX_X_SQUARED = /* @__PURE__ */ (() => _6n * BN_X ** _2n)(); -const bn254_G1_CURVE = { - p: BigInt('0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47'), - n: BigInt('0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001'), - // The Ethereum specs define G1 as prime-order but do not spell out the - // cofactor separately; `h = 1` is the implementation-derived value. - h: _1n, - a: _0n, - b: _3n, - Gx: _1n, - Gy: BigInt(2), -}; -// r == n -// Finite field over r. It's for convenience and is not used in the code below, -// and its canonical `fromBytes()` decoder is stricter than the EIP-196 MUL -// scalar rule that accepts any 256-bit integer. -// These factories are side-effect free; mark them pure so single-export bundles can drop the rest. -/** bn254 scalar field. */ -export const bn254_Fr = /* @__PURE__ */ (() => Field(bn254_G1_CURVE.n))(); -// `3 / (i + 9)` from EIP-197, stored in noble's internal `(c0, c1) = (b, a)` -// order rather than the spec's `a * i + b` notation. -const Fp2B = /* @__PURE__ */ (() => ({ - c0: BigInt('19485874751759354771024239261021720505790618469301721065564631296452457478373'), - c1: BigInt('266929791119991161246907387137283842545076965332900288569378510910307636690'), -}))(); -// Bootstrap binding: `Fp12finalExponentiate` needs to reference the finished -// field object while `tower12(...)` is still constructing it. -let Fp12; -const tower = /* @__PURE__ */ (() => { - const res = tower12({ - ORDER: bn254_G1_CURVE.p, - X_LEN: BN_X_LEN, - // Public `Fp2.NONRESIDUE` below is the sextic-tower seed `(9, 1)`, not the - // quadratic relation `i^2 + 1 = 0` from the EIP text. - FP2_NONRESIDUE: [BigInt(9), _1n], - Fp2mulByB: (num) => Fp2.mul(num, Fp2B), - Fp12finalExponentiate: (num) => { - const powMinusX = (num) => Fp12.conjugate(Fp12._cyclotomicExp(num, BN_X)); - const r0 = Fp12.mul(Fp12.conjugate(num), Fp12.inv(num)); - const r = Fp12.mul(Fp12.frobeniusMap(r0, 2), r0); - const y1 = Fp12._cyclotomicSquare(powMinusX(r)); - const y2 = Fp12.mul(Fp12._cyclotomicSquare(y1), y1); - const y4 = powMinusX(y2); - const y6 = powMinusX(Fp12._cyclotomicSquare(y4)); - const y8 = Fp12.mul(Fp12.mul(Fp12.conjugate(y6), y4), Fp12.conjugate(y2)); - const y9 = Fp12.mul(y8, y1); - return Fp12.mul(Fp12.frobeniusMap(Fp12.mul(Fp12.conjugate(r), y9), 3), Fp12.mul(Fp12.frobeniusMap(y8, 2), Fp12.mul(Fp12.frobeniusMap(y9, 1), Fp12.mul(Fp12.mul(y8, y4), r)))); - }, - }); - Fp12 = res.Fp12; - return res; -})(); -const Fp = /* @__PURE__ */ (() => tower.Fp)(); -const Fp2 = /* @__PURE__ */ (() => tower.Fp2)(); -// END OF CURVE FIELDS -// BN254 uses the same tower seed `(9, 1)` for the Frobenius helper that powers -// the divisive-twist G2 endomorphism. -let frob; -const getFrob = () => frob || (frob = psiFrobenius(Fp, Fp2, Fp2.NONRESIDUE)); -// Eager psiFrobenius setup now dominates `bn254.js` import, so defer it to -// first use. After that these locals are rewritten to the direct helper refs. -let psi = (x, y) => { - const fn = getFrob().psi; - psi = fn; - return fn(x, y); -}; -let G2psi = (c, P) => { - const fn = getFrob().G2psi; - G2psi = fn; - return fn(c, P); -}; -export const _postPrecompute = (Rx, Ry, Rz, Qx, Qy, pointAdd) => { - const q = psi(Qx, Qy); - ({ Rx, Ry, Rz } = pointAdd(Rx, Ry, Rz, q[0], q[1])); - const q2 = psi(q[0], q[1]); - pointAdd(Rx, Ry, Rz, q2[0], Fp2.neg(q2[1])); -}; -// cofactor: (36 * X^4) + (36 * X^3) + (30 * X^2) + 6*X + 1 -const bn254_G2_CURVE = /* @__PURE__ */ (() => ({ - p: Fp2.ORDER, - n: bn254_G1_CURVE.n, - // As with G1, the Ethereum specs do not spell out the G2 cofactor - // separately; this literal is the implementation-derived value. - h: BigInt('0x30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d'), - a: Fp2.ZERO, - b: Fp2B, - Gx: Fp2.fromBigTuple([ - BigInt('10857046999023057135944570762232829481370756359578518086990519993285655852781'), - BigInt('11559732032986387107991004021392285783925812861821192530917403151452391805634'), - ]), - Gy: Fp2.fromBigTuple([ - BigInt('8495653923123431417604973247489272438418190587263600148770280649306958101930'), - BigInt('4082367875863433681332203403145435568316851327593401208105741076214120093531'), - ]), -}))(); -const fields = /* @__PURE__ */ (() => ({ Fp, Fp2, Fp6: tower.Fp6, Fp12, Fr: bn254_Fr }))(); -const bn254_G1 = /* @__PURE__ */ weierstrass(bn254_G1_CURVE, { - Fp, - Fn: bn254_Fr, - // Ethereum encodes infinity as `(0, 0)`, so the public point API accepts it - // even though it is not an affine curve point, and `fromAffine()` stays lazy: - // adversarial inputs still need `assertValidity()`. - allowInfinityPoint: true, -}); -const bn254_G2 = /* @__PURE__ */ weierstrass(bn254_G2_CURVE, { - Fp: Fp2, - Fn: bn254_Fr, - // Ethereum encodes infinity as `((0, 0), (0, 0))`, so the public point API - // accepts it even though it is not an affine curve point. - allowInfinityPoint: true, - // Optimized BN254 G2 subgroup test used to satisfy the EIP-197 order check. - isTorsionFree: (c, P) => P.multiplyUnsafe(SIX_X_SQUARED).equals(G2psi(c, P)), // [p]P = [6X^2]P -}); -/* -No hashToCurve for now (and signatures): - -- RFC 9380 doesn't mention bn254 and doesn't provide test vectors -- Overall seems like nobody is using BLS signatures on top of bn254 -- Seems like it can utilize SVDW, which is not implemented yet -*/ -// const htfDefaults = Object.freeze({ -// // DST: a domain separation tag defined in section 2.2.5 -// DST: 'BN254G2_XMD:SHA-256_SVDW_RO_', -// encodeDST: 'BN254G2_XMD:SHA-256_SVDW_RO_', -// p: Fp.ORDER, -// m: 2, -// k: 128, -// expand: 'xmd', -// hash: sha256, -// }); -// const hasherOpts = { -// { ...htfDefaults, m: 1, DST: 'BN254G2_XMD:SHA-256_SVDW_RO_' } -// }; -const bn254_params = /* @__PURE__ */ (() => ({ - // Optimal-ate Miller loop parameter derived from the positive BN seed. - ateLoopSize: BN_X * _6n + _2n, - r: bn254_Fr.ORDER, - xNegative: false, - // EIP-197 writes G2 as `y^2 = x^3 + 3 / (i + 9)`, so the pairing - // configuration uses the divisive twist convention. - twistType: 'divisive', - postPrecompute: _postPrecompute, -}))(); -// const bn254_hasher = { -// hasherOpts: htfDefaults, -// hasherOptsG1: { m: 1, DST: 'BN254G2_XMD:SHA-256_SVDW_RO_' }, -// hasherOptsG2: htfDefaults -// }; -// G2_heff hEff: BigInt('21888242871839275222246405745257275088844257914179612981679871602714643921549'), -// fromBytes: notImplemented, -// toBytes: notImplemented, -// mapToCurve: notImplemented, -// fromBytes: notImplemented, -// toBytes: notImplemented, -// ShortSignature: { -// fromBytes: notImplemented, -// fromHex: notImplemented, -// toBytes: notImplemented, -// toRawBytes: notImplemented, -// toHex: notImplemented, -// }, -/** - * bn254 (a.k.a. alt_bn128) pairing-friendly curve. - * Contains G1 / G2 operations and pairings only; the commented-out - * hash-to-curve and signature surface is intentionally not exposed here. - * @example - * Compute a pairing from the two generator points. - * - * ```ts - * const gt = bn254.pairing(bn254.G1.Point.BASE, bn254.G2.Point.BASE); - * ``` - */ -// bn254_hasher -export const bn254 = /* @__PURE__ */ blsBasic(fields, bn254_G1, bn254_G2, bn254_params); -//# sourceMappingURL=bn254.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/bn254.js.map b/node_modules/@noble/curves/bn254.js.map deleted file mode 100644 index afea859..0000000 --- a/node_modules/@noble/curves/bn254.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bn254.js","sourceRoot":"","sources":["src/bn254.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,sEAAsE;AACtE,OAAO,EACL,QAAQ,GAIT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAwB,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAa,MAAM,YAAY,CAAC;AAC/C,kBAAkB;AAClB,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACzI,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEtC,wEAAwE;AACxE,6EAA6E;AAC7E,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAC3D,kFAAkF;AAClF,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CA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Ae;CAChC,CAAC,CAAC,EAAE,CAAC;AACN,yBAAyB;AACzB,6BAA6B;AAC7B,iEAAiE;AACjE,8BAA8B;AAC9B,KAAK;AACL,6GAA6G;AAC7G,6BAA6B;AAC7B,2BAA2B;AAE3B,8BAA8B;AAC9B,6BAA6B;AAC7B,2BAA2B;AAC3B,oBAAoB;AACpB,+BAA+B;AAC/B,6BAA6B;AAC7B,6BAA6B;AAC7B,gCAAgC;AAChC,2BAA2B;AAC3B,KAAK;AAEL;;;;;;;;;;GAUG;AACH,eAAe;AACf,MAAM,CAAC,MAAM,KAAK,GAAiB,eAAe,CAAC,QAAQ,CACzD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,YAAY,CACb,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/ed25519.d.ts b/node_modules/@noble/curves/ed25519.d.ts deleted file mode 100644 index ac231ed..0000000 --- a/node_modules/@noble/curves/ed25519.d.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { type AffinePoint } from './abstract/curve.ts'; -import { PrimeEdwardsPoint, type EdDSA, type EdwardsPoint, type EdwardsPointCons } from './abstract/edwards.ts'; -import { type FROST } from './abstract/frost.ts'; -import { type H2CHasher, type H2CHasherBase } from './abstract/hash-to-curve.ts'; -import { type IField } from './abstract/modular.ts'; -import { type MontgomeryECDH } from './abstract/montgomery.ts'; -import { type OPRF } from './abstract/oprf.ts'; -import { type TArg, type TRet } from './utils.ts'; -/** - * ed25519 curve with EdDSA signatures. - * Seeded `keygen(seed)` / `utils.randomSecretKey(seed)` reuse the provided - * 32-byte seed buffer instead of copying it. - * @example - * Generate one Ed25519 keypair, sign a message, and verify it. - * - * ```js - * import { ed25519 } from '@noble/curves/ed25519.js'; - * const { secretKey, publicKey } = ed25519.keygen(); - * // const publicKey = ed25519.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed25519.sign(msg, secretKey); - * const isValid = ed25519.verify(sig, msg, publicKey); // ZIP215 - * // RFC8032 / FIPS 186-5 - * const isValid2 = ed25519.verify(sig, msg, publicKey, { zip215: false }); - * ``` - */ -export declare const ed25519: EdDSA; -/** - * Context version of ed25519 (ctx for domain separation). See {@link ed25519} - * Seeded `keygen(seed)` / `utils.randomSecretKey(seed)` reuse the provided - * 32-byte seed buffer instead of copying it. - * @example - * Sign and verify with Ed25519ctx under one explicit context. - * - * ```ts - * const context = new TextEncoder().encode('docs'); - * const { secretKey, publicKey } = ed25519ctx.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed25519ctx.sign(msg, secretKey, { context }); - * const isValid = ed25519ctx.verify(sig, msg, publicKey, { context }); - * ``` - */ -export declare const ed25519ctx: EdDSA; -/** - * Prehashed version of ed25519. See {@link ed25519} - * Seeded `keygen(seed)` / `utils.randomSecretKey(seed)` reuse the provided - * 32-byte seed buffer instead of copying it. - * @example - * Use the prehashed Ed25519 variant for one message. - * - * ```ts - * const { secretKey, publicKey } = ed25519ph.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed25519ph.sign(msg, secretKey); - * const isValid = ed25519ph.verify(sig, msg, publicKey); - * ``` - */ -export declare const ed25519ph: EdDSA; -/** - * FROST threshold signatures over ed25519. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 ed25519 signing. - * - * ```ts - * const alice = ed25519_FROST.Identifier.derive('alice@example.com'); - * const bob = ed25519_FROST.Identifier.derive('bob@example.com'); - * const carol = ed25519_FROST.Identifier.derive('carol@example.com'); - * const deal = ed25519_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export declare const ed25519_FROST: TRet; -/** - * ECDH using curve25519 aka x25519. - * `getSharedSecret()` rejects low-order peer inputs by default, and seeded - * `keygen(seed)` reuses the provided 32-byte seed buffer instead of copying it. - * @example - * Derive one shared secret between two X25519 peers. - * - * ```js - * import { x25519 } from '@noble/curves/ed25519.js'; - * const alice = x25519.keygen(); - * const bob = x25519.keygen(); - * const shared = x25519.getSharedSecret(alice.secretKey, bob.publicKey); - * ``` - */ -export declare const x25519: TRet; -/** - * RFC 9380 method `map_to_curve_elligator2_curve25519`. Experimental name: may be renamed later. - * @private - */ -export declare function _map_to_curve_elligator2_curve25519(u: bigint): { - xMn: bigint; - xMd: bigint; - yMn: bigint; - yMd: bigint; -}; -/** - * Hashing to ed25519 points / field. RFC 9380 methods. - * Public `mapToCurve()` returns the cofactor-cleared subgroup point; the - * internal map callback below consumes one field element bigint, not `[bigint]`. - * @example - * Hash one message onto the ed25519 curve. - * - * ```ts - * const point = ed25519_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export declare const ed25519_hasher: H2CHasher; -/** - * Wrapper over Edwards Point for ristretto255. - * - * Each ed25519/EdwardsPoint has 8 different equivalent points. This can be - * a source of bugs for protocols like ring signatures. Ristretto was created to solve this. - * Ristretto point operates in X:Y:Z:T extended coordinates like EdwardsPoint, - * but it should work in its own namespace: do not combine those two. - * See [RFC9496](https://www.rfc-editor.org/rfc/rfc9496). - */ -declare class _RistrettoPoint extends PrimeEdwardsPoint<_RistrettoPoint> { - static BASE: _RistrettoPoint; - static ZERO: _RistrettoPoint; - static Fp: IField; - static Fn: IField; - constructor(ep: EdwardsPoint); - /** - * Create one Ristretto255 point from affine Edwards coordinates. - * This wraps the internal Edwards representative directly and is not a - * canonical ristretto255 decoding path. - * Use `toBytes()` / `fromBytes()` if canonical ristretto255 bytes matter. - */ - static fromAffine(ap: AffinePoint): _RistrettoPoint; - protected assertSame(other: _RistrettoPoint): void; - protected init(ep: EdwardsPoint): _RistrettoPoint; - static fromBytes(bytes: TArg): _RistrettoPoint; - /** - * Converts ristretto-encoded string to ristretto point. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-decode). - * @param hex - Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding - */ - static fromHex(hex: string): _RistrettoPoint; - /** - * Encodes ristretto point to Uint8Array. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-encode). - */ - toBytes(): TRet; - /** - * Compares two Ristretto points. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-equals). - */ - equals(other: _RistrettoPoint): boolean; - is0(): boolean; -} -/** Prime-order Ristretto255 group bundle. */ -export declare const ristretto255: { - Point: typeof _RistrettoPoint; -}; -/** - * Hashing to ristretto255 points / field. RFC 9380 methods. - * `hashToCurve()` is RFC 9380 Appendix B, `deriveToCurve()` is the RFC 9496 - * §4.3.4 element-derivation building block, and `hashToScalar()` is a - * library-specific helper for OPRF-style use. - * @example - * Hash one message onto ristretto255. - * - * ```ts - * const point = ristretto255_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export declare const ristretto255_hasher: H2CHasherBase; -/** - * ristretto255 OPRF/VOPRF/POPRF bundle, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over ristretto255. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = ristretto255_oprf.oprf.generateKeyPair(); - * const blind = ristretto255_oprf.oprf.blind(input); - * const evaluated = ristretto255_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = ristretto255_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export declare const ristretto255_oprf: TRet; -/** - * FROST threshold signatures over ristretto255. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 ristretto255 signing. - * - * ```ts - * const alice = ristretto255_FROST.Identifier.derive('alice@example.com'); - * const bob = ristretto255_FROST.Identifier.derive('bob@example.com'); - * const carol = ristretto255_FROST.Identifier.derive('carol@example.com'); - * const deal = ristretto255_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export declare const ristretto255_FROST: TRet; -/** - * Weird / bogus points, useful for debugging. - * All 8 ed25519 points of 8-torsion subgroup can be generated from the point - * T = `26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05`. - * The subgroup generated by `T` is `{ O, T, 2T, 3T, 4T, 5T, 6T, 7T }`; the - * array below is that set, not the powers in that exact index order. - * @example - * Decode one known torsion point for debugging. - * - * ```ts - * import { ED25519_TORSION_SUBGROUP, ed25519 } from '@noble/curves/ed25519.js'; - * const point = ed25519.Point.fromHex(ED25519_TORSION_SUBGROUP[1]); - * ``` - */ -export declare const ED25519_TORSION_SUBGROUP: readonly string[]; -export {}; -//# sourceMappingURL=ed25519.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/ed25519.d.ts.map b/node_modules/@noble/curves/ed25519.d.ts.map deleted file mode 100644 index 65d2472..0000000 --- a/node_modules/@noble/curves/ed25519.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed25519.d.ts","sourceRoot":"","sources":["src/ed25519.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAGL,iBAAiB,EACjB,KAAK,KAAK,EAGV,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAML,KAAK,MAAM,EACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAA6C,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAiH7F;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,OAAO,EAAE,KAA8B,CAAC;AACrD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,UAAU,EAAE,KAAsD,CAAC;AAChF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,EAAE,KAAuE,CAAC;AAChG;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E,eAAe,GAAG,OAAO;IAWvC,GAAG,IAAI,OAAO;CAGf;AAMD,6CAA6C;AAC7C,eAAO,MAAM,YAAY,EAAE;IACzB,KAAK,EAAE,OAAO,eAAe,CAAC;CAC6B,CAAC;AAE9D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,OAAO,eAAe,CAiDpE,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAOlC,CAAC;AACR;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,EAAE,IAAI,CAAC,KAAK,CASpC,CAAC;AAER;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EASpD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/ed25519.js b/node_modules/@noble/curves/ed25519.js deleted file mode 100644 index bff1851..0000000 --- a/node_modules/@noble/curves/ed25519.js +++ /dev/null @@ -1,624 +0,0 @@ -/** - * ed25519 Twisted Edwards curve with following addons: - * - X25519 ECDH - * - Ristretto cofactor elimination - * - Elligator hash-to-group / point indistinguishability - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { sha512 } from '@noble/hashes/sha2.js'; -import { abytes, concatBytes, hexToBytes } from '@noble/hashes/utils.js'; -import {} from "./abstract/curve.js"; -import { eddsa, edwards, PrimeEdwardsPoint, } from "./abstract/edwards.js"; -import { createFROST } from "./abstract/frost.js"; -import { _DST_scalar, createHasher, expand_message_xmd, } from "./abstract/hash-to-curve.js"; -import { FpInvertBatch, FpSqrtEven, isNegativeLE, mod, pow2, } from "./abstract/modular.js"; -import { montgomery } from "./abstract/montgomery.js"; -import { createOPRF } from "./abstract/oprf.js"; -import { asciiToBytes, bytesToNumberLE, equalBytes } from "./utils.js"; -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3); -// prettier-ignore -const _5n = /* @__PURE__ */ BigInt(5), _8n = /* @__PURE__ */ BigInt(8); -// P = 2n**255n - 19n -const ed25519_CURVE_p = /* @__PURE__ */ BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed'); -// N = 2n**252n + 27742317777372353535851937790883648493n -// a = Fp.create(BigInt(-1)) -// d = -121665/121666 a.k.a. Fp.neg(121665 * Fp.inv(121666)) -const ed25519_CURVE = /* @__PURE__ */ (() => ({ - p: ed25519_CURVE_p, - n: BigInt('0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed'), - h: _8n, - a: BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec'), - d: BigInt('0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3'), - Gx: BigInt('0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a'), - Gy: BigInt('0x6666666666666666666666666666666666666666666666666666666666666658'), -}))(); -function ed25519_pow_2_252_3(x) { - // prettier-ignore - const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80); - const P = ed25519_CURVE_p; - const x2 = (x * x) % P; - const b2 = (x2 * x) % P; // x^3, 11 - const b4 = (pow2(b2, _2n, P) * b2) % P; // x^15, 1111 - const b5 = (pow2(b4, _1n, P) * x) % P; // x^31 - const b10 = (pow2(b5, _5n, P) * b5) % P; - const b20 = (pow2(b10, _10n, P) * b10) % P; - const b40 = (pow2(b20, _20n, P) * b20) % P; - const b80 = (pow2(b40, _40n, P) * b40) % P; - const b160 = (pow2(b80, _80n, P) * b80) % P; - const b240 = (pow2(b160, _80n, P) * b80) % P; - const b250 = (pow2(b240, _10n, P) * b10) % P; - const pow_p_5_8 = (pow2(b250, _2n, P) * x) % P; - // ^ This is x^((p-5)/8); multiply by x once more to get x^((p+3)/8). - return { pow_p_5_8, b2 }; -} -// Mutates and returns the provided 32-byte buffer in place. -function adjustScalarBytes(bytes) { - // Section 5: For X25519, in order to decode 32 random bytes as an integer scalar, - // set the three least significant bits of the first byte - bytes[0] &= 248; // 0b1111_1000 - // and the most significant bit of the last to zero, - bytes[31] &= 127; // 0b0111_1111 - // set the second most significant bit of the last byte to 1 - bytes[31] |= 64; // 0b0100_0000 - return bytes; -} -// √(-1) aka √(a) aka 2^((p-1)/4) -// Fp.sqrt(Fp.neg(1)) -const ED25519_SQRT_M1 = /* @__PURE__ */ BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752'); -// sqrt(u/v). Returns `{ isValid, value }`; on non-squares `value` is still a -// dummy root-shaped field element so callers can stay constant-time. -function uvRatio(u, v) { - const P = ed25519_CURVE_p; - const v3 = mod(v * v * v, P); // v³ - const v7 = mod(v3 * v3 * v, P); // v⁷ - // (p+3)/8 and (p-5)/8 - const pow = ed25519_pow_2_252_3(u * v7).pow_p_5_8; - let x = mod(u * v3 * pow, P); // (uv³)(uv⁷)^(p-5)/8 - const vx2 = mod(v * x * x, P); // vx² - const root1 = x; // First root candidate - const root2 = mod(x * ED25519_SQRT_M1, P); // Second root candidate - const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root - const useRoot2 = vx2 === mod(-u, P); // If vx² = -u, set x <-- x * 2^((p-1)/4) - const noRoot = vx2 === mod(-u * ED25519_SQRT_M1, P); // There is no valid root, vx² = -u√(-1) - if (useRoot1) - x = root1; - if (useRoot2 || noRoot) - x = root2; // We return root2 anyway, for const-time - if (isNegativeLE(x, P)) - x = mod(-x, P); - return { isValid: useRoot1 || useRoot2, value: x }; -} -const ed25519_Point = /* @__PURE__ */ edwards(ed25519_CURVE, { uvRatio }); -// Public field alias stays stricter than the RFC 8032 Appendix A sample code: -// `Fp.inv(0)` throws instead of returning `0`. -const Fp = /* @__PURE__ */ (() => ed25519_Point.Fp)(); -const Fn = /* @__PURE__ */ (() => ed25519_Point.Fn)(); -// RFC 8032 `dom2` helper for ctx/ph variants only. Plain Ed25519 keeps the -// empty-domain path in `ed()` and would be wrong if routed through this helper. -function ed25519_domain(data, ctx, phflag) { - if (ctx.length > 255) - throw new Error('Context is too big'); - return concatBytes(asciiToBytes('SigEd25519 no Ed25519 collisions'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data); -} -function ed(opts) { - // Ed25519 keeps ZIP-215 default verification semantics for consensus compatibility. - return eddsa(ed25519_Point, sha512, Object.assign({ adjustScalarBytes, zip215: true }, opts)); -} -/** - * ed25519 curve with EdDSA signatures. - * Seeded `keygen(seed)` / `utils.randomSecretKey(seed)` reuse the provided - * 32-byte seed buffer instead of copying it. - * @example - * Generate one Ed25519 keypair, sign a message, and verify it. - * - * ```js - * import { ed25519 } from '@noble/curves/ed25519.js'; - * const { secretKey, publicKey } = ed25519.keygen(); - * // const publicKey = ed25519.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed25519.sign(msg, secretKey); - * const isValid = ed25519.verify(sig, msg, publicKey); // ZIP215 - * // RFC8032 / FIPS 186-5 - * const isValid2 = ed25519.verify(sig, msg, publicKey, { zip215: false }); - * ``` - */ -export const ed25519 = /* @__PURE__ */ ed({}); -/** - * Context version of ed25519 (ctx for domain separation). See {@link ed25519} - * Seeded `keygen(seed)` / `utils.randomSecretKey(seed)` reuse the provided - * 32-byte seed buffer instead of copying it. - * @example - * Sign and verify with Ed25519ctx under one explicit context. - * - * ```ts - * const context = new TextEncoder().encode('docs'); - * const { secretKey, publicKey } = ed25519ctx.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed25519ctx.sign(msg, secretKey, { context }); - * const isValid = ed25519ctx.verify(sig, msg, publicKey, { context }); - * ``` - */ -export const ed25519ctx = /* @__PURE__ */ ed({ domain: ed25519_domain }); -/** - * Prehashed version of ed25519. See {@link ed25519} - * Seeded `keygen(seed)` / `utils.randomSecretKey(seed)` reuse the provided - * 32-byte seed buffer instead of copying it. - * @example - * Use the prehashed Ed25519 variant for one message. - * - * ```ts - * const { secretKey, publicKey } = ed25519ph.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed25519ph.sign(msg, secretKey); - * const isValid = ed25519ph.verify(sig, msg, publicKey); - * ``` - */ -export const ed25519ph = /* @__PURE__ */ ed({ domain: ed25519_domain, prehash: sha512 }); -/** - * FROST threshold signatures over ed25519. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 ed25519 signing. - * - * ```ts - * const alice = ed25519_FROST.Identifier.derive('alice@example.com'); - * const bob = ed25519_FROST.Identifier.derive('bob@example.com'); - * const carol = ed25519_FROST.Identifier.derive('carol@example.com'); - * const deal = ed25519_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const ed25519_FROST = /* @__PURE__ */ (() => createFROST({ - name: 'FROST-ED25519-SHA512-v1', - Point: ed25519_Point, - validatePoint: (p) => { - p.assertValidity(); - if (!p.isTorsionFree()) - throw new Error('bad point: not torsion-free'); - }, - hash: sha512, - // RFC 9591 keeps H2 undecorated here for RFC 8032 compatibility. In createFROST(), - // `H2: ''` becomes an empty DST prefix; the built-in hashToScalar fallback treats - // that the same as omitted DST, even though custom hooks can still observe the empty bag. - H2: '', -}))(); -/** - * ECDH using curve25519 aka x25519. - * `getSharedSecret()` rejects low-order peer inputs by default, and seeded - * `keygen(seed)` reuses the provided 32-byte seed buffer instead of copying it. - * @example - * Derive one shared secret between two X25519 peers. - * - * ```js - * import { x25519 } from '@noble/curves/ed25519.js'; - * const alice = x25519.keygen(); - * const bob = x25519.keygen(); - * const shared = x25519.getSharedSecret(alice.secretKey, bob.publicKey); - * ``` - */ -export const x25519 = /* @__PURE__ */ (() => { - const P = ed25519_CURVE_p; - return montgomery({ - P, - type: 'x25519', - powPminus2: (x) => { - // x^(p-2) aka x^(2^255-21) - const { pow_p_5_8, b2 } = ed25519_pow_2_252_3(x); - return mod(pow2(pow_p_5_8, _3n, P) * b2, P); - }, - adjustScalarBytes, - }); -})(); -// Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator) -// RFC 9380 Appendix G.2.2 / Err4730 requires `sgn0(c1) = 0` for the Edwards -// map constant below, so use the even root explicitly. -// 1. c1 = (q + 3) / 8 # Integer arithmetic -const ELL2_C1 = /* @__PURE__ */ (() => (ed25519_CURVE_p + _3n) / _8n)(); -const ELL2_C2 = /* @__PURE__ */ (() => Fp.pow(_2n, ELL2_C1))(); // 2. c2 = 2^c1 -const ELL2_C3 = /* @__PURE__ */ (() => Fp.sqrt(Fp.neg(Fp.ONE)))(); // 3. c3 = sqrt(-1) -/** - * RFC 9380 method `map_to_curve_elligator2_curve25519`. Experimental name: may be renamed later. - * @private - */ -// prettier-ignore -export function _map_to_curve_elligator2_curve25519(u) { - const ELL2_C4 = (ed25519_CURVE_p - _5n) / _8n; // 4. c4 = (q - 5) / 8 # Integer arithmetic - const ELL2_J = BigInt(486662); - let tv1 = Fp.sqr(u); // 1. tv1 = u^2 - tv1 = Fp.mul(tv1, _2n); // 2. tv1 = 2 * tv1 - // 3. xd = tv1 + 1 # Nonzero: -1 is square (mod p), tv1 is not - let xd = Fp.add(tv1, Fp.ONE); - let x1n = Fp.neg(ELL2_J); // 4. x1n = -J # x1 = x1n / xd = -J / (1 + 2 * u^2) - let tv2 = Fp.sqr(xd); // 5. tv2 = xd^2 - let gxd = Fp.mul(tv2, xd); // 6. gxd = tv2 * xd # gxd = xd^3 - let gx1 = Fp.mul(tv1, ELL2_J); // 7. gx1 = J * tv1 # x1n + J * xd - gx1 = Fp.mul(gx1, x1n); // 8. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd - gx1 = Fp.add(gx1, tv2); // 9. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 - gx1 = Fp.mul(gx1, x1n); // 10. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 - let tv3 = Fp.sqr(gxd); // 11. tv3 = gxd^2 - tv2 = Fp.sqr(tv3); // 12. tv2 = tv3^2 # gxd^4 - tv3 = Fp.mul(tv3, gxd); // 13. tv3 = tv3 * gxd # gxd^3 - tv3 = Fp.mul(tv3, gx1); // 14. tv3 = tv3 * gx1 # gx1 * gxd^3 - tv2 = Fp.mul(tv2, tv3); // 15. tv2 = tv2 * tv3 # gx1 * gxd^7 - let y11 = Fp.pow(tv2, ELL2_C4); // 16. y11 = tv2^c4 # (gx1 * gxd^7)^((p - 5) / 8) - y11 = Fp.mul(y11, tv3); // 17. y11 = y11 * tv3 # gx1*gxd^3*(gx1*gxd^7)^((p-5)/8) - let y12 = Fp.mul(y11, ELL2_C3); // 18. y12 = y11 * c3 - tv2 = Fp.sqr(y11); // 19. tv2 = y11^2 - tv2 = Fp.mul(tv2, gxd); // 20. tv2 = tv2 * gxd - let e1 = Fp.eql(tv2, gx1); // 21. e1 = tv2 == gx1 - // 22. y1 = CMOV(y12, y11, e1) # If g(x1) is square, this is its sqrt - let y1 = Fp.cmov(y12, y11, e1); - let x2n = Fp.mul(x1n, tv1); // 23. x2n = x1n * tv1 # x2 = x2n / xd = 2 * u^2 * x1n / xd - let y21 = Fp.mul(y11, u); // 24. y21 = y11 * u - y21 = Fp.mul(y21, ELL2_C2); // 25. y21 = y21 * c2 - let y22 = Fp.mul(y21, ELL2_C3); // 26. y22 = y21 * c3 - let gx2 = Fp.mul(gx1, tv1); // 27. gx2 = gx1 * tv1 # g(x2) = gx2 / gxd = 2 * u^2 * g(x1) - tv2 = Fp.sqr(y21); // 28. tv2 = y21^2 - tv2 = Fp.mul(tv2, gxd); // 29. tv2 = tv2 * gxd - let e2 = Fp.eql(tv2, gx2); // 30. e2 = tv2 == gx2 - // 31. y2 = CMOV(y22, y21, e2) # If g(x2) is square, this is its sqrt - let y2 = Fp.cmov(y22, y21, e2); - tv2 = Fp.sqr(y1); // 32. tv2 = y1^2 - tv2 = Fp.mul(tv2, gxd); // 33. tv2 = tv2 * gxd - let e3 = Fp.eql(tv2, gx1); // 34. e3 = tv2 == gx1 - let xn = Fp.cmov(x2n, x1n, e3); // 35. xn = CMOV(x2n, x1n, e3) # If e3, x = x1, else x = x2 - let y = Fp.cmov(y2, y1, e3); // 36. y = CMOV(y2, y1, e3) # If e3, y = y1, else y = y2 - let e4 = Fp.isOdd(y); // 37. e4 = sgn0(y) == 1 # Fix sign of y - y = Fp.cmov(y, Fp.neg(y), e3 !== e4); // 38. y = CMOV(y, -y, e3 XOR e4) - return { xMn: xn, xMd: xd, yMn: y, yMd: _1n }; // 39. return (xn, xd, y, 1) -} -// sgn0(c1) MUST equal 0 -const ELL2_C1_EDWARDS = /* @__PURE__ */ (() => FpSqrtEven(Fp, Fp.neg(BigInt(486664))))(); -function map_to_curve_elligator2_edwards25519(u) { - // 1. (xMn, xMd, yMn, yMd) = map_to_curve_elligator2_curve25519(u) - const { xMn, xMd, yMn, yMd } = _map_to_curve_elligator2_curve25519(u); - // map_to_curve_elligator2_curve25519(u) - let xn = Fp.mul(xMn, yMd); // 2. xn = xMn * yMd - xn = Fp.mul(xn, ELL2_C1_EDWARDS); // 3. xn = xn * c1 - let xd = Fp.mul(xMd, yMn); // 4. xd = xMd * yMn # xn / xd = c1 * xM / yM - let yn = Fp.sub(xMn, xMd); // 5. yn = xMn - xMd - // 6. yd = xMn + xMd # (n / d - 1) / (n / d + 1) = (n - d) / (n + d) - let yd = Fp.add(xMn, xMd); - let tv1 = Fp.mul(xd, yd); // 7. tv1 = xd * yd - let e = Fp.eql(tv1, Fp.ZERO); // 8. e = tv1 == 0 - xn = Fp.cmov(xn, Fp.ZERO, e); // 9. xn = CMOV(xn, 0, e) - xd = Fp.cmov(xd, Fp.ONE, e); // 10. xd = CMOV(xd, 1, e) - yn = Fp.cmov(yn, Fp.ONE, e); // 11. yn = CMOV(yn, 1, e) - yd = Fp.cmov(yd, Fp.ONE, e); // 12. yd = CMOV(yd, 1, e) - const [xd_inv, yd_inv] = FpInvertBatch(Fp, [xd, yd], true); // batch division - // Noble normalizes the RFC rational representation to affine `{ x, y }` - // before returning from the internal helper. - return { x: Fp.mul(xn, xd_inv), y: Fp.mul(yn, yd_inv) }; // 13. return (xn, xd, yn, yd) -} -/** - * Hashing to ed25519 points / field. RFC 9380 methods. - * Public `mapToCurve()` returns the cofactor-cleared subgroup point; the - * internal map callback below consumes one field element bigint, not `[bigint]`. - * @example - * Hash one message onto the ed25519 curve. - * - * ```ts - * const point = ed25519_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const ed25519_hasher = /* @__PURE__ */ (() => createHasher(ed25519_Point, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), { - DST: 'edwards25519_XMD:SHA-512_ELL2_RO_', - encodeDST: 'edwards25519_XMD:SHA-512_ELL2_NU_', - p: ed25519_CURVE_p, - m: 1, - k: 128, - expand: 'xmd', - hash: sha512, -}))(); -// √(-1) aka √(a) aka 2^((p-1)/4) -const SQRT_M1 = ED25519_SQRT_M1; -// √(ad - 1) -const SQRT_AD_MINUS_ONE = /* @__PURE__ */ BigInt('25063068953384623474111414158702152701244531502492656460079210482610430750235'); -// 1 / √(a-d) -const INVSQRT_A_MINUS_D = /* @__PURE__ */ BigInt('54469307008909316920995813868745141605393597292927456921205312896311721017578'); -// 1-d² -const ONE_MINUS_D_SQ = /* @__PURE__ */ BigInt('1159843021668779879193775521855586647937357759715417654439879720876111806838'); -// (d-1)² -const D_MINUS_ONE_SQ = /* @__PURE__ */ BigInt('40440834346308536858101042469323190826248399146238708352240133220865137265952'); -// `SQRT_RATIO_M1(1, number)` specialization. Returns `{ isValid, value }`, -// where non-squares get the nonnegative `sqrt(SQRT_M1 / number)` branch. -const invertSqrt = (number) => uvRatio(_1n, number); -const MAX_255B = /* @__PURE__ */ BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); -// RFC 9496 §4.3.4 MAP parser: masks bit 255 and reduces modulo p for element -// derivation. The decode path has the opposite contract and rejects that bit. -const bytes255ToNumberLE = (bytes) => Fp.create(bytesToNumberLE(bytes) & MAX_255B); -/** - * Computes Elligator map for Ristretto255. - * Primary formula source is RFC 9496 §4.3.4 MAP; RFC 9380 Appendix B builds - * `hash_to_ristretto255` on top of this helper. - * Returns an internal Edwards representative, not a public `_RistrettoPoint`. - */ -function calcElligatorRistrettoMap(r0) { - const { d } = ed25519_CURVE; - const P = ed25519_CURVE_p; - const mod = (n) => Fp.create(n); - const r = mod(SQRT_M1 * r0 * r0); // 1 - const Ns = mod((r + _1n) * ONE_MINUS_D_SQ); // 2 - let c = BigInt(-1); // 3 - const D = mod((c - d * r) * mod(r + d)); // 4 - let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D); // 5 - let s_ = mod(s * r0); // 6 - if (!isNegativeLE(s_, P)) - s_ = mod(-s_); - if (!Ns_D_is_sq) - s = s_; // 7 - if (!Ns_D_is_sq) - c = r; // 8 - const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D); // 9 - const s2 = s * s; - const W0 = mod((s + s) * D); // 10 - const W1 = mod(Nt * SQRT_AD_MINUS_ONE); // 11 - const W2 = mod(_1n - s2); // 12 - const W3 = mod(_1n + s2); // 13 - return new ed25519_Point(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); -} -/** - * Wrapper over Edwards Point for ristretto255. - * - * Each ed25519/EdwardsPoint has 8 different equivalent points. This can be - * a source of bugs for protocols like ring signatures. Ristretto was created to solve this. - * Ristretto point operates in X:Y:Z:T extended coordinates like EdwardsPoint, - * but it should work in its own namespace: do not combine those two. - * See [RFC9496](https://www.rfc-editor.org/rfc/rfc9496). - */ -class _RistrettoPoint extends PrimeEdwardsPoint { - // Do NOT change syntax: the following gymnastics is done, - // because typescript strips comments, which makes bundlers disable tree-shaking. - // prettier-ignore - static BASE = - /* @__PURE__ */ (() => new _RistrettoPoint(ed25519_Point.BASE))(); - // prettier-ignore - static ZERO = - /* @__PURE__ */ (() => new _RistrettoPoint(ed25519_Point.ZERO))(); - // prettier-ignore - static Fp = - /* @__PURE__ */ (() => Fp)(); - // prettier-ignore - static Fn = - /* @__PURE__ */ (() => Fn)(); - constructor(ep) { - super(ep); - } - /** - * Create one Ristretto255 point from affine Edwards coordinates. - * This wraps the internal Edwards representative directly and is not a - * canonical ristretto255 decoding path. - * Use `toBytes()` / `fromBytes()` if canonical ristretto255 bytes matter. - */ - static fromAffine(ap) { - return new _RistrettoPoint(ed25519_Point.fromAffine(ap)); - } - assertSame(other) { - if (!(other instanceof _RistrettoPoint)) - throw new Error('RistrettoPoint expected'); - } - init(ep) { - return new _RistrettoPoint(ep); - } - static fromBytes(bytes) { - abytes(bytes, 32); - const { a, d } = ed25519_CURVE; - const P = ed25519_CURVE_p; - const mod = (n) => Fp.create(n); - const s = bytes255ToNumberLE(bytes); - // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. - // 3. Check that s is non-negative, or else abort - if (!equalBytes(Fp.toBytes(s), bytes) || isNegativeLE(s, P)) - throw new Error('invalid ristretto255 encoding 1'); - const s2 = mod(s * s); - const u1 = mod(_1n + a * s2); // 4 (a is -1) - const u2 = mod(_1n - a * s2); // 5 - const u1_2 = mod(u1 * u1); - const u2_2 = mod(u2 * u2); - const v = mod(a * d * u1_2 - u2_2); // 6 - const { isValid, value: I } = invertSqrt(mod(v * u2_2)); // 7 - const Dx = mod(I * u2); // 8 - const Dy = mod(I * Dx * v); // 9 - let x = mod((s + s) * Dx); // 10 - if (isNegativeLE(x, P)) - x = mod(-x); // 10 - const y = mod(u1 * Dy); // 11 - const t = mod(x * y); // 12 - if (!isValid || isNegativeLE(t, P) || y === _0n) - throw new Error('invalid ristretto255 encoding 2'); - return new _RistrettoPoint(new ed25519_Point(x, y, _1n, t)); - } - /** - * Converts ristretto-encoded string to ristretto point. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-decode). - * @param hex - Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding - */ - static fromHex(hex) { - return _RistrettoPoint.fromBytes(hexToBytes(hex)); - } - /** - * Encodes ristretto point to Uint8Array. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-encode). - */ - toBytes() { - let { X, Y, Z, T } = this.ep; - const P = ed25519_CURVE_p; - const mod = (n) => Fp.create(n); - const u1 = mod(mod(Z + Y) * mod(Z - Y)); // 1 - const u2 = mod(X * Y); // 2 - // Square root always exists - const u2sq = mod(u2 * u2); - const { value: invsqrt } = invertSqrt(mod(u1 * u2sq)); // 3 - const D1 = mod(invsqrt * u1); // 4 - const D2 = mod(invsqrt * u2); // 5 - const zInv = mod(D1 * D2 * T); // 6 - let D; // 7 - if (isNegativeLE(T * zInv, P)) { - let _x = mod(Y * SQRT_M1); - let _y = mod(X * SQRT_M1); - X = _x; - Y = _y; - D = mod(D1 * INVSQRT_A_MINUS_D); - } - else { - D = D2; // 8 - } - if (isNegativeLE(X * zInv, P)) - Y = mod(-Y); // 9 - let s = mod((Z - Y) * D); // 10 (check footer's note, no sqrt(-a)) - if (isNegativeLE(s, P)) - s = mod(-s); - return Fp.toBytes(s); // 11 - } - /** - * Compares two Ristretto points. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-equals). - */ - equals(other) { - this.assertSame(other); - const { X: X1, Y: Y1 } = this.ep; - const { X: X2, Y: Y2 } = other.ep; - const mod = (n) => Fp.create(n); - // (x1 * y2 == y1 * x2) | (y1 * y2 == x1 * x2) - const one = mod(X1 * Y2) === mod(Y1 * X2); - const two = mod(Y1 * Y2) === mod(X1 * X2); - return one || two; - } - is0() { - return this.equals(_RistrettoPoint.ZERO); - } -} -Object.freeze(_RistrettoPoint.BASE); -Object.freeze(_RistrettoPoint.ZERO); -Object.freeze(_RistrettoPoint.prototype); -Object.freeze(_RistrettoPoint); -/** Prime-order Ristretto255 group bundle. */ -export const ristretto255 = /* @__PURE__ */ Object.freeze({ Point: _RistrettoPoint }); -/** - * Hashing to ristretto255 points / field. RFC 9380 methods. - * `hashToCurve()` is RFC 9380 Appendix B, `deriveToCurve()` is the RFC 9496 - * §4.3.4 element-derivation building block, and `hashToScalar()` is a - * library-specific helper for OPRF-style use. - * @example - * Hash one message onto ristretto255. - * - * ```ts - * const point = ristretto255_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const ristretto255_hasher = Object.freeze({ - Point: _RistrettoPoint, - /** - * Spec: https://www.rfc-editor.org/rfc/rfc9380.html#name-hashing-to-ristretto255. Caveats: - * * There are no test vectors - * * encodeToCurve / mapToCurve is undefined - * * mapToCurve would be `calcElligatorRistrettoMap(scalars[0])`, not ristretto255_map! - * * hashToScalar is undefined too, so we just use OPRF implementation - * * We cannot re-use 'createHasher', because ristretto255_map is different algorithm/RFC - (os2ip -> bytes255ToNumberLE) - * * mapToCurve == calcElligatorRistrettoMap, hashToCurve == ristretto255_map - * * hashToScalar is undefined in RFC9380 for ristretto, so we use the OPRF - version here. Using `bytes255ToNumblerLE` will create a different result - if we use `bytes255ToNumberLE` as os2ip - * * current version is closest to spec. - */ - hashToCurve(msg, options) { - // == 'hash_to_ristretto255' - // Preserve explicit empty/invalid DST overrides so expand_message_xmd() can reject them. - const DST = options?.DST === undefined ? 'ristretto255_XMD:SHA-512_R255MAP_RO_' : options.DST; - const xmd = expand_message_xmd(msg, DST, 64, sha512); - // NOTE: RFC 9380 incorrectly calls this function `ristretto255_map`. - // In RFC 9496, `map` was the per-point function inside the construction. - // That also led to confusion that `ristretto255_map` is `mapToCurve`. - // It is not: it is the older hash-to-curve construction. - return ristretto255_hasher.deriveToCurve(xmd); - }, - hashToScalar(msg, options = { DST: _DST_scalar }) { - const xmd = expand_message_xmd(msg, options.DST, 64, sha512); - return Fn.create(bytesToNumberLE(xmd)); - }, - /** - * HashToCurve-like construction based on RFC 9496 (Element Derivation). - * Converts 64 uniform random bytes into a curve point. - * - * WARNING: This represents an older hash-to-curve construction from before - * RFC 9380 was finalized. - * It was later reused as a component in the newer - * `hash_to_ristretto255` function defined in RFC 9380. - */ - deriveToCurve(bytes) { - // https://www.rfc-editor.org/rfc/rfc9496.html#name-element-derivation - abytes(bytes, 64); - const r1 = bytes255ToNumberLE(bytes.subarray(0, 32)); - const R1 = calcElligatorRistrettoMap(r1); - const r2 = bytes255ToNumberLE(bytes.subarray(32, 64)); - const R2 = calcElligatorRistrettoMap(r2); - return new _RistrettoPoint(R1.add(R2)); - }, -}); -/** - * ristretto255 OPRF/VOPRF/POPRF bundle, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over ristretto255. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = ristretto255_oprf.oprf.generateKeyPair(); - * const blind = ristretto255_oprf.oprf.blind(input); - * const evaluated = ristretto255_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = ristretto255_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export const ristretto255_oprf = /* @__PURE__ */ (() => createOPRF({ - name: 'ristretto255-SHA512', - Point: _RistrettoPoint, - hash: sha512, - hashToGroup: ristretto255_hasher.hashToCurve, - hashToScalar: ristretto255_hasher.hashToScalar, -}))(); -/** - * FROST threshold signatures over ristretto255. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 ristretto255 signing. - * - * ```ts - * const alice = ristretto255_FROST.Identifier.derive('alice@example.com'); - * const bob = ristretto255_FROST.Identifier.derive('bob@example.com'); - * const carol = ristretto255_FROST.Identifier.derive('carol@example.com'); - * const deal = ristretto255_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const ristretto255_FROST = /* @__PURE__ */ (() => createFROST({ - name: 'FROST-RISTRETTO255-SHA512-v1', - Point: _RistrettoPoint, - validatePoint: (p) => { - // Prime-order wrappers are torsion-free at the abstract-group level. - p.assertValidity(); - }, - hash: sha512, -}))(); -/** - * Weird / bogus points, useful for debugging. - * All 8 ed25519 points of 8-torsion subgroup can be generated from the point - * T = `26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05`. - * The subgroup generated by `T` is `{ O, T, 2T, 3T, 4T, 5T, 6T, 7T }`; the - * array below is that set, not the powers in that exact index order. - * @example - * Decode one known torsion point for debugging. - * - * ```ts - * import { ED25519_TORSION_SUBGROUP, ed25519 } from '@noble/curves/ed25519.js'; - * const point = ed25519.Point.fromHex(ED25519_TORSION_SUBGROUP[1]); - * ``` - */ -export const ED25519_TORSION_SUBGROUP = /* @__PURE__ */ Object.freeze([ - '0100000000000000000000000000000000000000000000000000000000000000', - 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a', - '0000000000000000000000000000000000000000000000000000000000000080', - '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05', - 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f', - '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85', - '0000000000000000000000000000000000000000000000000000000000000000', - 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa', -]); -//# sourceMappingURL=ed25519.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/ed25519.js.map b/node_modules/@noble/curves/ed25519.js.map deleted file mode 100644 index b629803..0000000 --- a/node_modules/@noble/curves/ed25519.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed25519.js","sourceRoot":"","sources":["src/ed25519.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAoB,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,KAAK,EACL,OAAO,EACP,iBAAiB,GAMlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAc,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,WAAW,EACX,YAAY,EACZ,kBAAkB,GAInB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,aAAa,EAC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tB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,mBAAmB,CAAC,WAAW;IAC5C,YAAY,EAAE,mBAAmB,CAAC,YAAY;CAC/C,CAAC,CAAC,EAAE,CAAC;AACR;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAgB,eAAe,CAAC,CAAC,GAAG,EAAE,CACnE,WAAW,CAAC;IACV,IAAI,EAAE,8BAA8B;IACpC,KAAK,EAAE,eAAe;IACtB,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE;QACnB,qEAAqE;QACrE,CAAC,CAAC,cAAc,EAAE,CAAC;IACrB,CAAC;IACD,IAAI,EAAE,MAAM;CACb,CAAC,CAAC,EAAE,CAAC;AAER;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC;IACvF,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;IAClE,kEAAkE;CACnE,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/ed448.d.ts b/node_modules/@noble/curves/ed448.d.ts deleted file mode 100644 index 90ba82d..0000000 --- a/node_modules/@noble/curves/ed448.d.ts +++ /dev/null @@ -1,185 +0,0 @@ -import type { AffinePoint } from './abstract/curve.ts'; -import { PrimeEdwardsPoint, type EdDSA, type EdwardsPoint, type EdwardsPointCons } from './abstract/edwards.ts'; -import { type FROST } from './abstract/frost.ts'; -import { type H2CHasher, type H2CHasherBase } from './abstract/hash-to-curve.ts'; -import { type IField } from './abstract/modular.ts'; -import { type MontgomeryECDH } from './abstract/montgomery.ts'; -import { type OPRF } from './abstract/oprf.ts'; -import { type TArg, type TRet } from './utils.ts'; -/** - * ed448 EdDSA curve and methods. - * @example - * Generate one Ed448 keypair, sign a message, and verify it. - * - * ```js - * import { ed448 } from '@noble/curves/ed448.js'; - * const { secretKey, publicKey } = ed448.keygen(); - * // const publicKey = ed448.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed448.sign(msg, secretKey); - * const isValid = ed448.verify(sig, msg, publicKey); - * ``` - */ -export declare const ed448: EdDSA; -/** - * Prehashed version of ed448. See {@link ed448} - * @example - * Use the prehashed Ed448 variant for one message. - * - * ```ts - * const { secretKey, publicKey } = ed448ph.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed448ph.sign(msg, secretKey); - * const isValid = ed448ph.verify(sig, msg, publicKey); - * ``` - */ -export declare const ed448ph: EdDSA; -/** - * E448 here is NIST SP 800-186 §3.2.3.3 E448, the Edwards representation of - * Curve448, not RFC 8032 edwards448 / Goldilocks. - * Goldilocks is the separate 4-isogenous curve exposed as `ed448`. - * We keep the corrected prime-order base here; RFC 7748's literal Edwards - * point / map are wrong for this curve model, and the literal point is the - * wrong-sign order-2*n variant. - * @param X - Projective X coordinate. - * @param Y - Projective Y coordinate. - * @param Z - Projective Z coordinate. - * @param T - Projective T coordinate. - * @example - * Multiply the E448 base point. - * - * ```ts - * const point = E448.BASE.multiply(2n); - * ``` - */ -export declare const E448: EdwardsPointCons; -/** - * ECDH using curve448 aka x448. - * The wrapper aborts on all-zero shared secrets by default, and seeded - * `keygen(seed)` reuses the provided 56-byte seed buffer instead of copying it. - * - * @example - * Derive one shared secret between two X448 peers. - * - * ```js - * import { x448 } from '@noble/curves/ed448.js'; - * const alice = x448.keygen(); - * const bob = x448.keygen(); - * const shared = x448.getSharedSecret(alice.secretKey, bob.publicKey); - * ``` - */ -export declare const x448: TRet; -/** - * Hashing / encoding to ed448 points / field. RFC 9380 methods. - * Public `mapToCurve()` consumes one field element bigint for `m = 1`, and RFC - * Appendix J vectors use the special `QUUX-V01-*` test DST overrides rather - * than the default suite IDs below. - * @example - * Hash one message onto the ed448 curve. - * - * ```ts - * const point = ed448_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export declare const ed448_hasher: H2CHasher; -/** - * FROST threshold signatures over ed448. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 ed448 signing. - * - * ```ts - * const alice = ed448_FROST.Identifier.derive('alice@example.com'); - * const bob = ed448_FROST.Identifier.derive('bob@example.com'); - * const carol = ed448_FROST.Identifier.derive('carol@example.com'); - * const deal = ed448_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export declare const ed448_FROST: TRet; -/** - * Each ed448/EdwardsPoint has 4 different equivalent points. This can be - * a source of bugs for protocols like ring signatures. Decaf was created to solve this. - * Decaf point operates in X:Y:Z:T extended coordinates like EdwardsPoint, - * but it should work in its own namespace: do not combine those two. - * See [RFC9496](https://www.rfc-editor.org/rfc/rfc9496). - */ -declare class _DecafPoint extends PrimeEdwardsPoint<_DecafPoint> { - static BASE: _DecafPoint; - static ZERO: _DecafPoint; - static Fp: IField; - static Fn: IField; - constructor(ep: EdwardsPoint); - /** - * Create one Decaf448 point from affine Edwards coordinates. - * This wraps the internal Edwards representative directly and is not a - * canonical decaf448 decoding path. - * Use `toBytes()` / `fromBytes()` if canonical decaf448 bytes matter. - */ - static fromAffine(ap: AffinePoint): _DecafPoint; - protected assertSame(other: _DecafPoint): void; - protected init(ep: EdwardsPoint): _DecafPoint; - static fromBytes(bytes: TArg): _DecafPoint; - /** - * Converts decaf-encoded string to decaf point. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-decode-2). - * @param hex - Decaf-encoded 56 bytes. Not every 56-byte string is valid decaf encoding - */ - static fromHex(hex: string): _DecafPoint; - /** - * Encodes decaf point to Uint8Array. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-encode-2). - */ - toBytes(): TRet; - /** - * Compare one point to another. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-equals-2). - */ - equals(other: _DecafPoint): boolean; - is0(): boolean; -} -/** Prime-order Decaf448 group bundle. */ -export declare const decaf448: { - Point: typeof _DecafPoint; -}; -/** - * Hashing to decaf448 points / field. RFC 9380 methods. - * `hashToCurve()` is RFC 9380 `hash_to_decaf448`, `deriveToCurve()` is RFC - * 9496 element derivation, and `hashToScalar()` is a library helper layered on - * top of RFC 9496 scalar reduction. - * @example - * Hash one message onto decaf448. - * - * ```ts - * const point = decaf448_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export declare const decaf448_hasher: H2CHasherBase; -/** - * decaf448 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over decaf448. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = decaf448_oprf.oprf.generateKeyPair(); - * const blind = decaf448_oprf.oprf.blind(input); - * const evaluated = decaf448_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = decaf448_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export declare const decaf448_oprf: TRet; -/** - * Weird / bogus points, useful for debugging. - * Unlike ed25519, there is no ed448 generator point which can produce full T subgroup. - * Instead, the torsion subgroup here is cyclic of order 4, generated by - * `(1, 0)`, and the array below lists that subgroup set (Klein four-group). - * @example - * Decode one known torsion point for debugging. - * - * ```ts - * import { ED448_TORSION_SUBGROUP, ed448 } from '@noble/curves/ed448.js'; - * const point = ed448.Point.fromHex(ED448_TORSION_SUBGROUP[1]); - * ``` - */ -export declare const ED448_TORSION_SUBGROUP: readonly string[]; -export {}; -//# sourceMappingURL=ed448.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/ed448.d.ts.map b/node_modules/@noble/curves/ed448.d.ts.map deleted file mode 100644 index 5edebc1..0000000 --- a/node_modules/@noble/curves/ed448.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448.d.ts","sourceRoot":"","sources":["src/ed448.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAGL,iBAAiB,EACjB,KAAK,KAAK,EAGV,KAAK,YAAY,EACj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AU,CAAC,EAAE,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,WAAW;IAIvD,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAI9C,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,YAAY,GAAG,WAAW;IAI7C,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,WAAW;IA6BtD;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW;IAIxC;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC;IAe3B;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAQnC,GAAG,IAAI,OAAO;CAGf;AAMD,yCAAyC;AACzC,eAAO,MAAM,QAAQ,EAAE;IACrB,KAAK,EAAE,OAAO,WAAW,CAAC;CAC6B,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,OAAO,WAAW,CAsC5D,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,EAAE,IAAI,CAAC,IAAI,CAO9B,CAAC;AAER;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAKlD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/ed448.js b/node_modules/@noble/curves/ed448.js deleted file mode 100644 index 0745043..0000000 --- a/node_modules/@noble/curves/ed448.js +++ /dev/null @@ -1,594 +0,0 @@ -/** - * Edwards448 (also called Goldilocks) curve with following addons: - * - X448 ECDH - * - Decaf cofactor elimination - * - Elligator hash-to-group / point indistinguishability - * Conforms to RFC 8032 https://www.rfc-editor.org/rfc/rfc8032.html#section-5.2 - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { shake256 } from '@noble/hashes/sha3.js'; -import { concatBytes, hexToBytes, createHasher as wrapConstructor } from '@noble/hashes/utils.js'; -import { eddsa, edwards, PrimeEdwardsPoint, } from "./abstract/edwards.js"; -import { createFROST } from "./abstract/frost.js"; -import { _DST_scalar, createHasher, expand_message_xof, } from "./abstract/hash-to-curve.js"; -import { Field, FpInvertBatch, isNegativeLE, mod, pow2 } from "./abstract/modular.js"; -import { montgomery } from "./abstract/montgomery.js"; -import { createOPRF } from "./abstract/oprf.js"; -import { abytes, asciiToBytes, bytesToNumberLE, equalBytes, } from "./utils.js"; -// edwards448 curve -// a = 1n -// d = Fp.neg(39081n) -// Finite field 2n**448n - 2n**224n - 1n -// Subgroup order -// 2n**446n - 13818066809895115352007386748515426880336692474882178609894547503885n -const ed448_CURVE_p = /* @__PURE__ */ BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); -const ed448_CURVE = /* @__PURE__ */ (() => ({ - p: ed448_CURVE_p, - n: BigInt('0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffff7cca23e9c44edb49aed63690216cc2728dc58f552378c292ab5844f3'), - h: BigInt(4), - a: BigInt(1), - d: BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffff6756'), - Gx: BigInt('0x4f1970c66bed0ded221d15a622bf36da9e146570470f1767ea6de324a3d3a46412ae1af72ab66511433b80e18b00938e2626a82bc70cc05e'), - Gy: BigInt('0x693f46716eb6bc248876203756c9c7624bea73736ca3984087789c1e05a0c2d73ad3ff1ce67c39c4fdbd132c4ed7c8ad9808795bf230fa14'), -}))(); -// This is not RFC 8032 edwards448 / Goldilocks (`ed448` below, d = -39081). -// It is NIST SP 800-186 §3.2.3.3 E448, the Curve448-isomorphic Edwards model -// also described in draft-ietf-lwig-curve-representations-23 Appendix M, with -// d = 39082/39081 and Gy = 3/2. -// RFC 7748's literal Edwards point / birational map are wrong here: the literal -// point is the wrong-sign (Gx, -Gy) order-2*n variant. Keep the corrected -// prime-order (Gx, Gy) base so Point.BASE stays a subgroup generator, which is -// what noble's generic Edwards API expects. -const E448_CURVE = /* @__PURE__ */ (() => Object.assign({}, ed448_CURVE, { - d: BigInt('0xd78b4bdc7f0daf19f24f38c29373a2ccad46157242a50f37809b1da3412a12e79ccc9c81264cfe9ad080997058fb61c4243cc32dbaa156b9'), - Gx: BigInt('0x79a70b2b70400553ae7c9df416c792c61128751ac92969240c25a07d728bdc93e21f7787ed6972249de732f38496cd11698713093e9c04fc'), - Gy: BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffff80000000000000000000000000000000000000000000000000000001'), -}))(); -const shake256_114 = /* @__PURE__ */ wrapConstructor(() => shake256.create({ dkLen: 114 })); -const shake256_64 = /* @__PURE__ */ wrapConstructor(() => shake256.create({ dkLen: 64 })); -// prettier-ignore -const _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3), _4n = /* @__PURE__ */ BigInt(4), _11n = /* @__PURE__ */ BigInt(11); -// prettier-ignore -const _22n = /* @__PURE__ */ BigInt(22), _44n = /* @__PURE__ */ BigInt(44), _88n = /* @__PURE__ */ BigInt(88), _223n = /* @__PURE__ */ BigInt(223); -// powPminus3div4 calculates z = x^k mod p, where k = (p-3)/4. -// Used for efficient square root calculation. -// ((P-3)/4).toString(2) would produce bits [223x 1, 0, 222x 1] -function ed448_pow_Pminus3div4(x) { - const P = ed448_CURVE_p; - const b2 = (x * x * x) % P; - const b3 = (b2 * b2 * x) % P; - const b6 = (pow2(b3, _3n, P) * b3) % P; - const b9 = (pow2(b6, _3n, P) * b3) % P; - const b11 = (pow2(b9, _2n, P) * b2) % P; - const b22 = (pow2(b11, _11n, P) * b11) % P; - const b44 = (pow2(b22, _22n, P) * b22) % P; - const b88 = (pow2(b44, _44n, P) * b44) % P; - const b176 = (pow2(b88, _88n, P) * b88) % P; - const b220 = (pow2(b176, _44n, P) * b44) % P; - const b222 = (pow2(b220, _2n, P) * b2) % P; - const b223 = (pow2(b222, _1n, P) * x) % P; - return (pow2(b223, _223n, P) * b222) % P; -} -// Mutates and returns the provided buffer in place. The final `bytes[56] = 0` -// write is the Ed448 path; for 56-byte X448 inputs it is an out-of-bounds no-op. -function adjustScalarBytes(bytes) { - // Section 5: Likewise, for X448, set the two least significant bits of the first byte to 0, - bytes[0] &= 252; // 0b11111100 - // and the most significant bit of the last byte to 1. - bytes[55] |= 128; // 0b10000000 - // NOTE: is NOOP for 56 bytes scalars (X25519/X448) - bytes[56] = 0; // Byte outside of group (456 buts vs 448 bits) - return bytes; -} -// Constant-time Ed448 decode helper for RFC 8032 §5.2.3 steps 2-3. Unlike -// `SQRT_RATIO_M1`, the returned `value` only has the documented meaning when -// `isValid` is true. -function uvRatio(u, v) { - const P = ed448_CURVE_p; - // https://www.rfc-editor.org/rfc/rfc8032#section-5.2.3 - // To compute the square root of (u/v), the first step is to compute the - // candidate root x = (u/v)^((p+1)/4). This can be done using the - // following trick, to use a single modular powering for both the - // inversion of v and the square root: - // x = (u/v)^((p+1)/4) = u³v(u⁵v³)^((p-3)/4) (mod p) - const u2v = mod(u * u * v, P); // u²v - const u3v = mod(u2v * u, P); // u³v - const u5v3 = mod(u3v * u2v * v, P); // u⁵v³ - const root = ed448_pow_Pminus3div4(u5v3); - const x = mod(u3v * root, P); - // Verify that root is exists - const x2 = mod(x * x, P); // x² - // If vx² = u, the recovered x-coordinate is x. Otherwise, no - // square root exists, and the decoding fails. - return { isValid: mod(x2 * v, P) === u, value: x }; -} -// Finite field 2n**448n - 2n**224n - 1n -// RFC 8032 encodes Ed448 field/scalar elements in 57 bytes even though field -// values fit in 448 bits and scalars in 446 bits. Noble models that with a -// 456-bit storage width so the final-octet x-sign bit (bit 455) still fits in -// the shared little-endian container. -const Fp = /* @__PURE__ */ (() => Field(ed448_CURVE_p, { BITS: 456, isLE: true }))(); -// Same 57-byte container shape as `Fp`; canonical scalar encodings still have -// the top ten bits clear per RFC 8032. -const Fn = /* @__PURE__ */ (() => Field(ed448_CURVE.n, { BITS: 456, isLE: true }))(); -// Generic 56-byte field shape used by decaf448 and raw X448 u-coordinates. -// Plain `Field` decoding stays canonical here, so callers that want RFC 7748's -// modulo-p acceptance must reduce externally. -const Fp448 = /* @__PURE__ */ (() => Field(ed448_CURVE_p, { BITS: 448, isLE: true }))(); -// Strict 56-byte scalar parser matching RFC 9496's recommended canonical form. -const Fn448 = /* @__PURE__ */ (() => Field(ed448_CURVE.n, { BITS: 448, isLE: true }))(); -// SHAKE256(dom4(phflag,context)||x, 114) -// RFC 8032 `dom4` prefix. Empty contexts are valid; the accepted length range -// is 0..255 octets inclusive. -function dom4(data, ctx, phflag) { - if (ctx.length > 255) - throw new Error('context must be smaller than 255, got: ' + ctx.length); - return concatBytes(asciiToBytes('SigEd448'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data); -} -const ed448_Point = /* @__PURE__ */ edwards(ed448_CURVE, { Fp, Fn, uvRatio }); -// Shared internal factory for both `ed448` and `ed448ph`; callers are only -// expected to override narrow family options such as prehashing. -function ed4(opts) { - return eddsa(ed448_Point, shake256_114, Object.assign({ adjustScalarBytes, domain: dom4 }, opts)); -} -/** - * ed448 EdDSA curve and methods. - * @example - * Generate one Ed448 keypair, sign a message, and verify it. - * - * ```js - * import { ed448 } from '@noble/curves/ed448.js'; - * const { secretKey, publicKey } = ed448.keygen(); - * // const publicKey = ed448.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed448.sign(msg, secretKey); - * const isValid = ed448.verify(sig, msg, publicKey); - * ``` - */ -export const ed448 = /* @__PURE__ */ ed4({}); -// There is no ed448ctx, since ed448 supports ctx by default -/** - * Prehashed version of ed448. See {@link ed448} - * @example - * Use the prehashed Ed448 variant for one message. - * - * ```ts - * const { secretKey, publicKey } = ed448ph.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed448ph.sign(msg, secretKey); - * const isValid = ed448ph.verify(sig, msg, publicKey); - * ``` - */ -export const ed448ph = /* @__PURE__ */ ed4({ prehash: shake256_64 }); -/** - * E448 here is NIST SP 800-186 §3.2.3.3 E448, the Edwards representation of - * Curve448, not RFC 8032 edwards448 / Goldilocks. - * Goldilocks is the separate 4-isogenous curve exposed as `ed448`. - * We keep the corrected prime-order base here; RFC 7748's literal Edwards - * point / map are wrong for this curve model, and the literal point is the - * wrong-sign order-2*n variant. - * @param X - Projective X coordinate. - * @param Y - Projective Y coordinate. - * @param Z - Projective Z coordinate. - * @param T - Projective T coordinate. - * @example - * Multiply the E448 base point. - * - * ```ts - * const point = E448.BASE.multiply(2n); - * ``` - */ -export const E448 = /* @__PURE__ */ edwards(E448_CURVE); -/** - * ECDH using curve448 aka x448. - * The wrapper aborts on all-zero shared secrets by default, and seeded - * `keygen(seed)` reuses the provided 56-byte seed buffer instead of copying it. - * - * @example - * Derive one shared secret between two X448 peers. - * - * ```js - * import { x448 } from '@noble/curves/ed448.js'; - * const alice = x448.keygen(); - * const bob = x448.keygen(); - * const shared = x448.getSharedSecret(alice.secretKey, bob.publicKey); - * ``` - */ -export const x448 = /* @__PURE__ */ (() => { - const P = ed448_CURVE_p; - return montgomery({ - P, - type: 'x448', - powPminus2: (x) => { - const Pminus3div4 = ed448_pow_Pminus3div4(x); - const Pminus3 = pow2(Pminus3div4, _2n, P); - return mod(Pminus3 * x, P); // Pminus3 * x = Pminus2 - }, - adjustScalarBytes, - }); -})(); -// Hash To Curve Elligator2 Map -// 1. c1 = (q - 3) / 4 # Integer arithmetic -const ELL2_C1 = /* @__PURE__ */ (() => (ed448_CURVE_p - BigInt(3)) / BigInt(4))(); -const ELL2_J = /* @__PURE__ */ BigInt(156326); -// Returns RFC 9380 Appendix G.2.3 rational Montgomery numerators/denominators -// `{ xn, xd, yn, yd }`, not an affine point. -function map_to_curve_elligator2_curve448(u) { - let tv1 = Fp.sqr(u); // 1. tv1 = u^2 - let e1 = Fp.eql(tv1, Fp.ONE); // 2. e1 = tv1 == 1 - tv1 = Fp.cmov(tv1, Fp.ZERO, e1); // 3. tv1 = CMOV(tv1, 0, e1) # If Z * u^2 == -1, set tv1 = 0 - let xd = Fp.sub(Fp.ONE, tv1); // 4. xd = 1 - tv1 - let x1n = Fp.neg(ELL2_J); // 5. x1n = -J - let tv2 = Fp.sqr(xd); // 6. tv2 = xd^2 - let gxd = Fp.mul(tv2, xd); // 7. gxd = tv2 * xd # gxd = xd^3 - let gx1 = Fp.mul(tv1, Fp.neg(ELL2_J)); // 8. gx1 = -J * tv1 # x1n + J * xd - gx1 = Fp.mul(gx1, x1n); // 9. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd - gx1 = Fp.add(gx1, tv2); // 10. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 - gx1 = Fp.mul(gx1, x1n); // 11. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 - let tv3 = Fp.sqr(gxd); // 12. tv3 = gxd^2 - tv2 = Fp.mul(gx1, gxd); // 13. tv2 = gx1 * gxd # gx1 * gxd - tv3 = Fp.mul(tv3, tv2); // 14. tv3 = tv3 * tv2 # gx1 * gxd^3 - let y1 = Fp.pow(tv3, ELL2_C1); // 15. y1 = tv3^c1 # (gx1 * gxd^3)^((p - 3) / 4) - y1 = Fp.mul(y1, tv2); // 16. y1 = y1 * tv2 # gx1 * gxd * (gx1 * gxd^3)^((p - 3) / 4) - // 17. x2n = -tv1 * x1n # x2 = x2n / xd = -1 * u^2 * x1n / xd - let x2n = Fp.mul(x1n, Fp.neg(tv1)); - let y2 = Fp.mul(y1, u); // 18. y2 = y1 * u - y2 = Fp.cmov(y2, Fp.ZERO, e1); // 19. y2 = CMOV(y2, 0, e1) - tv2 = Fp.sqr(y1); // 20. tv2 = y1^2 - tv2 = Fp.mul(tv2, gxd); // 21. tv2 = tv2 * gxd - let e2 = Fp.eql(tv2, gx1); // 22. e2 = tv2 == gx1 - let xn = Fp.cmov(x2n, x1n, e2); // 23. xn = CMOV(x2n, x1n, e2) # If e2, x = x1, else x = x2 - let y = Fp.cmov(y2, y1, e2); // 24. y = CMOV(y2, y1, e2) # If e2, y = y1, else y = y2 - let e3 = Fp.isOdd(y); // 25. e3 = sgn0(y) == 1 # Fix sign of y - y = Fp.cmov(y, Fp.neg(y), e2 !== e3); // 26. y = CMOV(y, -y, e2 XOR e3) - return { xn, xd, yn: y, yd: Fp.ONE }; // 27. return (xn, xd, y, 1) -} -// Returns affine `{ x, y }` after inverting the Appendix G.2.4 denominators. -function map_to_curve_elligator2_edwards448(u) { - // 1. (xn, xd, yn, yd) = map_to_curve_elligator2_curve448(u) - let { xn, xd, yn, yd } = map_to_curve_elligator2_curve448(u); - let xn2 = Fp.sqr(xn); // 2. xn2 = xn^2 - let xd2 = Fp.sqr(xd); // 3. xd2 = xd^2 - let xd4 = Fp.sqr(xd2); // 4. xd4 = xd2^2 - let yn2 = Fp.sqr(yn); // 5. yn2 = yn^2 - let yd2 = Fp.sqr(yd); // 6. yd2 = yd^2 - let xEn = Fp.sub(xn2, xd2); // 7. xEn = xn2 - xd2 - let tv2 = Fp.sub(xEn, xd2); // 8. tv2 = xEn - xd2 - xEn = Fp.mul(xEn, xd2); // 9. xEn = xEn * xd2 - xEn = Fp.mul(xEn, yd); // 10. xEn = xEn * yd - xEn = Fp.mul(xEn, yn); // 11. xEn = xEn * yn - xEn = Fp.mul(xEn, _4n); // 12. xEn = xEn * 4 - tv2 = Fp.mul(tv2, xn2); // 13. tv2 = tv2 * xn2 - tv2 = Fp.mul(tv2, yd2); // 14. tv2 = tv2 * yd2 - let tv3 = Fp.mul(yn2, _4n); // 15. tv3 = 4 * yn2 - let tv1 = Fp.add(tv3, yd2); // 16. tv1 = tv3 + yd2 - tv1 = Fp.mul(tv1, xd4); // 17. tv1 = tv1 * xd4 - let xEd = Fp.add(tv1, tv2); // 18. xEd = tv1 + tv2 - tv2 = Fp.mul(tv2, xn); // 19. tv2 = tv2 * xn - let tv4 = Fp.mul(xn, xd4); // 20. tv4 = xn * xd4 - let yEn = Fp.sub(tv3, yd2); // 21. yEn = tv3 - yd2 - yEn = Fp.mul(yEn, tv4); // 22. yEn = yEn * tv4 - yEn = Fp.sub(yEn, tv2); // 23. yEn = yEn - tv2 - tv1 = Fp.add(xn2, xd2); // 24. tv1 = xn2 + xd2 - tv1 = Fp.mul(tv1, xd2); // 25. tv1 = tv1 * xd2 - tv1 = Fp.mul(tv1, xd); // 26. tv1 = tv1 * xd - tv1 = Fp.mul(tv1, yn2); // 27. tv1 = tv1 * yn2 - tv1 = Fp.mul(tv1, BigInt(-2)); // 28. tv1 = -2 * tv1 - let yEd = Fp.add(tv2, tv1); // 29. yEd = tv2 + tv1 - tv4 = Fp.mul(tv4, yd2); // 30. tv4 = tv4 * yd2 - yEd = Fp.add(yEd, tv4); // 31. yEd = yEd + tv4 - tv1 = Fp.mul(xEd, yEd); // 32. tv1 = xEd * yEd - let e = Fp.eql(tv1, Fp.ZERO); // 33. e = tv1 == 0 - xEn = Fp.cmov(xEn, Fp.ZERO, e); // 34. xEn = CMOV(xEn, 0, e) - xEd = Fp.cmov(xEd, Fp.ONE, e); // 35. xEd = CMOV(xEd, 1, e) - yEn = Fp.cmov(yEn, Fp.ONE, e); // 36. yEn = CMOV(yEn, 1, e) - yEd = Fp.cmov(yEd, Fp.ONE, e); // 37. yEd = CMOV(yEd, 1, e) - const inv = FpInvertBatch(Fp, [xEd, yEd], true); // batch division - return { x: Fp.mul(xEn, inv[0]), y: Fp.mul(yEn, inv[1]) }; // 38. return (xEn, xEd, yEn, yEd) -} -/** - * Hashing / encoding to ed448 points / field. RFC 9380 methods. - * Public `mapToCurve()` consumes one field element bigint for `m = 1`, and RFC - * Appendix J vectors use the special `QUUX-V01-*` test DST overrides rather - * than the default suite IDs below. - * @example - * Hash one message onto the ed448 curve. - * - * ```ts - * const point = ed448_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const ed448_hasher = /* @__PURE__ */ (() => createHasher(ed448_Point, (scalars) => map_to_curve_elligator2_edwards448(scalars[0]), { - DST: 'edwards448_XOF:SHAKE256_ELL2_RO_', - encodeDST: 'edwards448_XOF:SHAKE256_ELL2_NU_', - p: ed448_CURVE_p, - m: 1, - k: 224, - expand: 'xof', - hash: shake256, -}))(); -/** - * FROST threshold signatures over ed448. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 ed448 signing. - * - * ```ts - * const alice = ed448_FROST.Identifier.derive('alice@example.com'); - * const bob = ed448_FROST.Identifier.derive('bob@example.com'); - * const carol = ed448_FROST.Identifier.derive('carol@example.com'); - * const deal = ed448_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const ed448_FROST = /* @__PURE__ */ (() => createFROST({ - name: 'FROST-ED448-SHAKE256-v1', - Point: ed448_Point, - validatePoint: (p) => { - p.assertValidity(); - if (!p.isTorsionFree()) - throw new Error('bad point: not torsion-free'); - }, - // Group: edwards448 [RFC8032], where Ne = 57 and Ns = 57. - // Fn is 57 bytes, Fp is 57 bytes too - Fn, - hash: shake256_114, - H2: 'SigEd448\0\0', -}))(); -// 1-d -const ONE_MINUS_D = /* @__PURE__ */ BigInt('39082'); -// 1-2d -const ONE_MINUS_TWO_D = /* @__PURE__ */ BigInt('78163'); -// √(-d) -const SQRT_MINUS_D = /* @__PURE__ */ BigInt('98944233647732219769177004876929019128417576295529901074099889598043702116001257856802131563896515373927712232092845883226922417596214'); -// 1 / √(-d) -const INVSQRT_MINUS_D = /* @__PURE__ */ BigInt('315019913931389607337177038330951043522456072897266928557328499619017160722351061360252776265186336876723201881398623946864393857820716'); -// RFC 9496 `SQRT_RATIO_M1` must return `CT_ABS(s)`, i.e. the nonnegative root. -// Keep this Decaf-local: RFC 9496 decode/encode/map formulas depend on that -// canonical representative, while ordinary Ed448 decoding still uses `uvRatio()` -// plus the public sign bit from RFC 8032. -const sqrtRatioM1 = (u, v) => { - const P = ed448_CURVE_p; - const { isValid, value } = uvRatio(u, v); - return { isValid, value: isNegativeLE(value, P) ? Fp448.create(-value) : value }; -}; -const invertSqrt = (number) => sqrtRatioM1(_1n, number); -/** - * Elligator map for hash-to-curve of decaf448. - * Primary formula source is RFC 9496 §5.3.4. Step 1 intentionally reduces the - * input modulo `p`, and the return value is the internal Edwards - * representation, not a public decaf encoding. - */ -function calcElligatorDecafMap(r0) { - const { d, p: P } = ed448_CURVE; - const mod = (n) => Fp448.create(n); - const r = mod(-(r0 * r0)); // 1 - const u0 = mod(d * (r - _1n)); // 2 - const u1 = mod((u0 + _1n) * (u0 - r)); // 3 - const { isValid: was_square, value: v } = sqrtRatioM1(ONE_MINUS_TWO_D, mod((r + _1n) * u1)); // 4 - let v_prime = v; // 5 - if (!was_square) - v_prime = mod(r0 * v); - let sgn = _1n; // 6 - if (!was_square) - sgn = mod(-_1n); - const s = mod(v_prime * (r + _1n)); // 7 - let s_abs = s; - if (isNegativeLE(s, P)) - s_abs = mod(-s); - const s2 = s * s; - const W0 = mod(s_abs * _2n); // 8 - const W1 = mod(s2 + _1n); // 9 - const W2 = mod(s2 - _1n); // 10 - const W3 = mod(v_prime * s * (r - _1n) * ONE_MINUS_TWO_D + sgn); // 11 - return new ed448_Point(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); -} -// Keep the Decaf448 base representative literal here: deriving it with -// `new _DecafPoint(ed448_Point.BASE).multiplyUnsafe(2)` forces eager WNAF precomputes and -// adds about 100ms to `ed448.js` import time. -const DECAF_BASE_X = /* @__PURE__ */ BigInt('0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa955555555555555555555555555555555555555555555555555555555'); -const DECAF_BASE_Y = /* @__PURE__ */ BigInt('0xae05e9634ad7048db359d6205086c2b0036ed7a035884dd7b7e36d728ad8c4b80d6565833a2a3098bbbcb2bed1cda06bdaeafbcdea9386ed'); -const DECAF_BASE_T = /* @__PURE__ */ BigInt('0x696d84643374bace9d70983a12aa9d461da74d2d5c35e8d97ba72c3aba4450a5d29274229bd22c1d5e3a6474ee4ffb0e7a9e200a28eee402'); -/** - * Each ed448/EdwardsPoint has 4 different equivalent points. This can be - * a source of bugs for protocols like ring signatures. Decaf was created to solve this. - * Decaf point operates in X:Y:Z:T extended coordinates like EdwardsPoint, - * but it should work in its own namespace: do not combine those two. - * See [RFC9496](https://www.rfc-editor.org/rfc/rfc9496). - */ -class _DecafPoint extends PrimeEdwardsPoint { - // The following gymnastics is done because typescript strips comments otherwise - // prettier-ignore - static BASE = - /* @__PURE__ */ (() => new _DecafPoint(new ed448_Point(DECAF_BASE_X, DECAF_BASE_Y, _1n, DECAF_BASE_T)))(); - // prettier-ignore - static ZERO = - /* @__PURE__ */ (() => new _DecafPoint(ed448_Point.ZERO))(); - // prettier-ignore - static Fp = - /* @__PURE__ */ (() => Fp448)(); - // prettier-ignore - static Fn = - /* @__PURE__ */ (() => Fn448)(); - constructor(ep) { - super(ep); - } - /** - * Create one Decaf448 point from affine Edwards coordinates. - * This wraps the internal Edwards representative directly and is not a - * canonical decaf448 decoding path. - * Use `toBytes()` / `fromBytes()` if canonical decaf448 bytes matter. - */ - static fromAffine(ap) { - return new _DecafPoint(ed448_Point.fromAffine(ap)); - } - assertSame(other) { - if (!(other instanceof _DecafPoint)) - throw new Error('DecafPoint expected'); - } - init(ep) { - return new _DecafPoint(ep); - } - static fromBytes(bytes) { - abytes(bytes, 56); - const { d, p: P } = ed448_CURVE; - const mod = (n) => Fp448.create(n); - const s = Fp448.fromBytes(bytes); - // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. - // 2. Check that s is non-negative, or else abort - if (!equalBytes(Fn448.toBytes(s), bytes) || isNegativeLE(s, P)) - throw new Error('invalid decaf448 encoding 1'); - const s2 = mod(s * s); // 1 - const u1 = mod(_1n + s2); // 2 - const u1sq = mod(u1 * u1); - const u2 = mod(u1sq - _4n * d * s2); // 3 - const { isValid, value: invsqrt } = invertSqrt(mod(u2 * u1sq)); // 4 - let u3 = mod((s + s) * invsqrt * u1 * SQRT_MINUS_D); // 5 - if (isNegativeLE(u3, P)) - u3 = mod(-u3); - const x = mod(u3 * invsqrt * u2 * INVSQRT_MINUS_D); // 6 - const y = mod((_1n - s2) * invsqrt * u1); // 7 - const t = mod(x * y); // 8 - if (!isValid) - throw new Error('invalid decaf448 encoding 2'); - return new _DecafPoint(new ed448_Point(x, y, _1n, t)); - } - /** - * Converts decaf-encoded string to decaf point. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-decode-2). - * @param hex - Decaf-encoded 56 bytes. Not every 56-byte string is valid decaf encoding - */ - static fromHex(hex) { - return _DecafPoint.fromBytes(hexToBytes(hex)); - } - /** - * Encodes decaf point to Uint8Array. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-encode-2). - */ - toBytes() { - const { X, Z, T } = this.ep; - const P = ed448_CURVE.p; - const mod = (n) => Fp448.create(n); - const u1 = mod(mod(X + T) * mod(X - T)); // 1 - const x2 = mod(X * X); - const { value: invsqrt } = invertSqrt(mod(u1 * ONE_MINUS_D * x2)); // 2 - let ratio = mod(invsqrt * u1 * SQRT_MINUS_D); // 3 - if (isNegativeLE(ratio, P)) - ratio = mod(-ratio); - const u2 = mod(INVSQRT_MINUS_D * ratio * Z - T); // 4 - let s = mod(ONE_MINUS_D * invsqrt * X * u2); // 5 - if (isNegativeLE(s, P)) - s = mod(-s); - return Fn448.toBytes(s); - } - /** - * Compare one point to another. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-equals-2). - */ - equals(other) { - this.assertSame(other); - const { X: X1, Y: Y1 } = this.ep; - const { X: X2, Y: Y2 } = other.ep; - // (x1 * y2 == y1 * x2) - return Fp448.create(X1 * Y2) === Fp448.create(Y1 * X2); - } - is0() { - return this.equals(_DecafPoint.ZERO); - } -} -Object.freeze(_DecafPoint.BASE); -Object.freeze(_DecafPoint.ZERO); -Object.freeze(_DecafPoint.prototype); -Object.freeze(_DecafPoint); -/** Prime-order Decaf448 group bundle. */ -export const decaf448 = /* @__PURE__ */ Object.freeze({ Point: _DecafPoint }); -/** - * Hashing to decaf448 points / field. RFC 9380 methods. - * `hashToCurve()` is RFC 9380 `hash_to_decaf448`, `deriveToCurve()` is RFC - * 9496 element derivation, and `hashToScalar()` is a library helper layered on - * top of RFC 9496 scalar reduction. - * @example - * Hash one message onto decaf448. - * - * ```ts - * const point = decaf448_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const decaf448_hasher = Object.freeze({ - Point: _DecafPoint, - hashToCurve(msg, options) { - // Preserve explicit empty/invalid DST overrides so expand_message_xof() can reject them. - const DST = options?.DST === undefined ? 'decaf448_XOF:SHAKE256_D448MAP_RO_' : options.DST; - return decaf448_hasher.deriveToCurve(expand_message_xof(msg, DST, 112, 224, shake256)); - }, - /** - * Warning: has big modulo bias of 2^-64. - * RFC is invalid. RFC says "use 64-byte xof", while for 2^-112 bias - * it must use 84-byte xof (56+56/2), not 64. - */ - hashToScalar(msg, options = { DST: _DST_scalar }) { - // Can't use `Fn448.fromBytes()`. 64-byte input => 56-byte field element - const xof = expand_message_xof(msg, options.DST, 64, 256, shake256); - return Fn448.create(bytesToNumberLE(xof)); - }, - /** - * HashToCurve-like construction based on RFC 9496 (Element Derivation). - * Converts 112 uniform random bytes into a curve point. - * - * WARNING: This represents an older hash-to-curve construction from before - * RFC 9380 was finalized. - * It was later reused as a component in the newer - * `hash_to_decaf448` function defined in RFC 9380. - */ - deriveToCurve(bytes) { - abytes(bytes, 112); - const skipValidation = true; - // Note: Similar to the field element decoding described in - // [RFC7748], and unlike the field element decoding described in - // Section 5.3.1, non-canonical values are accepted. - const r1 = Fp448.create(Fp448.fromBytes(bytes.subarray(0, 56), skipValidation)); - const R1 = calcElligatorDecafMap(r1); - const r2 = Fp448.create(Fp448.fromBytes(bytes.subarray(56, 112), skipValidation)); - const R2 = calcElligatorDecafMap(r2); - return new _DecafPoint(R1.add(R2)); - }, -}); -/** - * decaf448 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over decaf448. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = decaf448_oprf.oprf.generateKeyPair(); - * const blind = decaf448_oprf.oprf.blind(input); - * const evaluated = decaf448_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = decaf448_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export const decaf448_oprf = /* @__PURE__ */ (() => createOPRF({ - name: 'decaf448-SHAKE256', - Point: _DecafPoint, - hash: (msg) => shake256(msg, { dkLen: 64 }), - hashToGroup: decaf448_hasher.hashToCurve, - hashToScalar: decaf448_hasher.hashToScalar, -}))(); -/** - * Weird / bogus points, useful for debugging. - * Unlike ed25519, there is no ed448 generator point which can produce full T subgroup. - * Instead, the torsion subgroup here is cyclic of order 4, generated by - * `(1, 0)`, and the array below lists that subgroup set (Klein four-group). - * @example - * Decode one known torsion point for debugging. - * - * ```ts - * import { ED448_TORSION_SUBGROUP, ed448 } from '@noble/curves/ed448.js'; - * const point = ed448.Point.fromHex(ED448_TORSION_SUBGROUP[1]); - * ``` - */ -export const ED448_TORSION_SUBGROUP = /* @__PURE__ */ Object.freeze([ - '010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - 'fefffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffff00', - '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080', -]); -//# sourceMappingURL=ed448.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/ed448.js.map b/node_modules/@noble/curves/ed448.js.map deleted file mode 100644 index 73572e0..0000000 --- a/node_modules/@noble/curves/ed448.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ed448.js","sourceRoot":"","sources":["src/ed448.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,sEAAsE;AACtE,OAAO,EAAE,QAAQ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G,EAAE,CAC7D,UAAU,CAAC;IACT,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,CAAC,GAAqB,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC7D,WAAW,EAAE,eAAe,CAAC,WAAW;IACxC,YAAY,EAAE,eAAe,CAAC,YAAY;CAC3C,CAAC,CAAC,EAAE,CAAC;AAER;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC;IACrF,oHAAoH;IACpH,oHAAoH;IACpH,oHAAoH;IACpH,oHAAoH;CACrH,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/index.d.ts b/node_modules/@noble/curves/index.d.ts deleted file mode 100644 index e26a57a..0000000 --- a/node_modules/@noble/curves/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/index.d.ts.map b/node_modules/@noble/curves/index.d.ts.map deleted file mode 100644 index 4e8c581..0000000 --- a/node_modules/@noble/curves/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@noble/curves/index.js b/node_modules/@noble/curves/index.js deleted file mode 100644 index 49820ba..0000000 --- a/node_modules/@noble/curves/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Audited & minimal JS implementation of elliptic curve cryptography. - * @module - * @example -```js -import { secp256k1, schnorr } from '@noble/curves/secp256k1.js'; -import { ed25519, ed25519ph, ed25519ctx, x25519, ristretto255 } from '@noble/curves/ed25519.js'; -import { ed448, ed448ph, x448, decaf448 } from '@noble/curves/ed448.js'; -import { p256, p384, p521 } from '@noble/curves/nist.js'; -import { bls12_381 } from '@noble/curves/bls12-381.js'; -import { bn254 } from '@noble/curves/bn254.js'; -import { - jubjub, - babyjubjub, - brainpoolP256r1, - brainpoolP384r1, - brainpoolP512r1, -} from '@noble/curves/misc.js'; -import * as webcrypto from '@noble/curves/webcrypto.js'; - -// hash-to-curve -import { secp256k1_hasher } from '@noble/curves/secp256k1.js'; -import { p256_hasher, p384_hasher, p521_hasher } from '@noble/curves/nist.js'; -import { ristretto255_hasher } from '@noble/curves/ed25519.js'; -import { decaf448_hasher } from '@noble/curves/ed448.js'; - -// OPRFs -import { p256_oprf, p384_oprf, p521_oprf } from '@noble/curves/nist.js'; -import { ristretto255_oprf } from '@noble/curves/ed25519.js'; -import { decaf448_oprf } from '@noble/curves/ed448.js'; - -// utils -import { bytesToHex, hexToBytes, concatBytes } from '@noble/curves/abstract/utils.js'; -import { Field } from '@noble/curves/abstract/modular.js'; -``` - */ -throw new Error('root module cannot be imported: import submodules instead. Check out README'); -export {}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/index.js.map b/node_modules/@noble/curves/index.js.map deleted file mode 100644 index 671e14b..0000000 --- a/node_modules/@noble/curves/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/misc.d.ts b/node_modules/@noble/curves/misc.d.ts deleted file mode 100644 index ead84f7..0000000 --- a/node_modules/@noble/curves/misc.d.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { type EdDSA, type EdwardsPoint } from './abstract/edwards.ts'; -import { type ECDSA } from './abstract/weierstrass.ts'; -import { type TArg } from './utils.ts'; -/** - * Generic EdDSA-over-Jubjub convenience wrapper with `sha512`. - * This is not the Zcash RedJubjub / Sapling signature scheme. - * @example - * Generate one Jubjub keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = jubjub.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = jubjub.sign(msg, secretKey); - * const isValid = jubjub.verify(sig, msg, publicKey); - * ``` - */ -export declare const jubjub: EdDSA; -/** - * Curve over scalar field of bn254. babyjubjub Fp = bn254 n - * This is a working generic EdDSA-over-BabyJubJub wrapper that uses `blake512` for the 64-byte - * secret expansion required by the shared EdDSA helper. - * It is not the BabyJubJub stack used by iden3/circomlib, `babyjubjub-rs`, or - * `@zk-kit/eddsa-poseidon`: those pair the subgroup base B/B8 with Blake-style secret expansion - * plus dedicated Poseidon / MiMC / Pedersen transcript hashing. This wrapper stays generic and is - * not meant as an interoperability target for those BabyJubJub signing stacks. - * @example - * Access the BabyJubJub base point and round-trip it through the point codec. - * - * ```ts - * import { babyjubjub } from '@noble/curves/misc.js'; - * const base = babyjubjub.Point.BASE; - * const encoded = base.toBytes(); - * const decoded = babyjubjub.Point.fromBytes(encoded); - * ``` - */ -export declare const babyjubjub: EdDSA; -/** - * @param tag - Hash input. - * @param personalization - BLAKE2 personalization bytes. - * @returns Prime-order Jubjub point. - * @throws If the digest does not decode to a Jubjub point, or if the - * cofactor-cleared point has small order. {@link Error} - * @example - * Hash a tag into a prime-order Jubjub point. - * - * ```ts - * import { jubjub_groupHash } from '@noble/curves/misc.js'; - * import { asciiToBytes } from '@noble/curves/utils.js'; - * const tag = Uint8Array.of(2); - * const personalization = asciiToBytes('Zcash_G_'); - * const point = jubjub_groupHash(tag, personalization); - * ``` - */ -export declare function jubjub_groupHash(tag: TArg, personalization: TArg): EdwardsPoint; -/** - * No secret data is leaked here at all. - * It operates over public data. - * @param m - Message prefix. - * @param personalization - 8-byte BLAKE2 personalization bytes. - * @returns First non-zero group hash. - * @throws If the personalization is invalid, or if no non-zero Jubjub group - * hash can be found. {@link Error} - * @example - * Derive the first non-zero Jubjub group hash for one personalization tag. - * - * ```ts - * import { jubjub_findGroupHash } from '@noble/curves/misc.js'; - * import { asciiToBytes } from '@noble/curves/utils.js'; - * const msg = Uint8Array.of(); - * const personalization = asciiToBytes('Zcash_G_'); - * const point = jubjub_findGroupHash(msg, personalization); - * ``` - */ -export declare function jubjub_findGroupHash(m: TArg, personalization: TArg): EdwardsPoint; -/** - * Brainpool P256r1 with sha256, from RFC 5639. - * @example - * Generate one Brainpool P256r1 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = brainpoolP256r1.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = brainpoolP256r1.sign(msg, secretKey); - * const isValid = brainpoolP256r1.verify(sig, msg, publicKey); - * ``` - */ -export declare const brainpoolP256r1: ECDSA; -/** - * Brainpool P384r1 with sha384, from RFC 5639. - * @example - * Generate one Brainpool P384r1 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = brainpoolP384r1.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = brainpoolP384r1.sign(msg, secretKey); - * const isValid = brainpoolP384r1.verify(sig, msg, publicKey); - * ``` - */ -export declare const brainpoolP384r1: ECDSA; -/** - * Brainpool P512r1 with sha512, from RFC 5639. - * @example - * Generate one Brainpool P512r1 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = brainpoolP512r1.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = brainpoolP512r1.sign(msg, secretKey); - * const isValid = brainpoolP512r1.verify(sig, msg, publicKey); - * ``` - */ -export declare const brainpoolP512r1: ECDSA; -//# sourceMappingURL=misc.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/misc.d.ts.map b/node_modules/@noble/curves/misc.d.ts.map deleted file mode 100644 index abfb0d1..0000000 --- a/node_modules/@noble/curves/misc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["src/misc.ts"],"names":[],"mappings":"AAUA,OAAO,EAGL,KAAK,KAAK,EAEV,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsB,KAAK,KAAK,EAAwB,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAgBrD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,MAAM,EAAE,KAAsE,CAAC;AAoB5F;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,EAAE,KACsB,CAAC;AAQhD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,EACrB,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,GAChC,YAAY,CAUd;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,EACnB,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,GAChC,YAAY,CAcd;AAWD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,KACwB,CAAC;AAuBvD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,KACwB,CAAC;AAuBvD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,KACwB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/misc.js b/node_modules/@noble/curves/misc.js deleted file mode 100644 index 4c01302..0000000 --- a/node_modules/@noble/curves/misc.js +++ /dev/null @@ -1,212 +0,0 @@ -/** - * Miscellaneous, rarely used curves. - * jubjub, babyjubjub, pallas, vesta. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { blake512 } from '@noble/hashes/blake1.js'; -import { blake2s } from '@noble/hashes/blake2.js'; -import { sha256, sha384, sha512 } from '@noble/hashes/sha2.js'; -import { abytes, concatBytes } from '@noble/hashes/utils.js'; -import { eddsa, edwards, } from "./abstract/edwards.js"; -import { ecdsa, weierstrass } from "./abstract/weierstrass.js"; -import { asciiToBytes } from "./utils.js"; -// Jubjub curves have 𝔽p over scalar fields of other curves. They are friendly to ZK proofs. -// Zcash Protocol Specification "Jubjub" parameters: -// q = BLS12-381 Fr, r, h = 8, a = -1, d = -10240/10241. -// Gx/Gy keep the canonical Jubjub base point used by Zcash implementations. -const jubjub_CURVE = /* @__PURE__ */ (() => ({ - p: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001'), - n: BigInt('0xe7db4ea6533afa906673b0101343b00a6682093ccc81082d0970e5ed6f72cb7'), - h: BigInt(8), - a: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000'), - d: BigInt('0x2a9318e74bfa2b48f5fd9207e6bd7fd4292d7f6d37579d2601065fd6d6343eb1'), - Gx: BigInt('0x11dafe5d23e1218086a365b99fbf3d3be72f6afd7d1f72623e6b071492d1122b'), - Gy: BigInt('0x1d523cf1ddab1a1793132e78c866c0c33e26ba5cc220fed7cc3f870e59d292aa'), -}))(); -/** - * Generic EdDSA-over-Jubjub convenience wrapper with `sha512`. - * This is not the Zcash RedJubjub / Sapling signature scheme. - * @example - * Generate one Jubjub keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = jubjub.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = jubjub.sign(msg, secretKey); - * const isValid = jubjub.verify(sig, msg, publicKey); - * ``` - */ -export const jubjub = /* @__PURE__ */ (() => eddsa(edwards(jubjub_CURVE), sha512))(); -// BabyJubJub over bn254 Fr. EIP-2494 explicitly defines both the full-group generator G and the -// prime-order subgroup base point B = 8*G. -// noble's Edwards abstraction expects Point.BASE / curve.n to describe the prime-order subgroup, so -// use the EIP base point B here. -// Historical noble incorrectly used the EIP generator G as Point.BASE, which mismatched the -// abstraction and leaked the wrong order into consumers. -// Historical noble used G instead: -// Gx = 995203441582195749578291179787384436505546430278305826713579947235728471134 -// Gy = 5472060717959818805561601436314318772137091100104008585924551046643952123905 -const babyjubjub_CURVE = /* @__PURE__ */ (() => ({ - p: BigInt('0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001'), - n: BigInt('0x060c89ce5c263405370a08b6d0302b0bab3eedb83920ee0a677297dc392126f1'), - h: BigInt(8), - a: BigInt('168700'), - d: BigInt('168696'), - Gx: BigInt('0xbb77a6ad63e739b4eacb2e09d6277c12ab8d8010534e0b62893f3f6bb957051'), - Gy: BigInt('0x25797203f7a0b24925572e1cd16bf9edfce0051fb9e133774b3c257a872d7d8b'), -}))(); -/** - * Curve over scalar field of bn254. babyjubjub Fp = bn254 n - * This is a working generic EdDSA-over-BabyJubJub wrapper that uses `blake512` for the 64-byte - * secret expansion required by the shared EdDSA helper. - * It is not the BabyJubJub stack used by iden3/circomlib, `babyjubjub-rs`, or - * `@zk-kit/eddsa-poseidon`: those pair the subgroup base B/B8 with Blake-style secret expansion - * plus dedicated Poseidon / MiMC / Pedersen transcript hashing. This wrapper stays generic and is - * not meant as an interoperability target for those BabyJubJub signing stacks. - * @example - * Access the BabyJubJub base point and round-trip it through the point codec. - * - * ```ts - * import { babyjubjub } from '@noble/curves/misc.js'; - * const base = babyjubjub.Point.BASE; - * const encoded = base.toBytes(); - * const decoded = babyjubjub.Point.fromBytes(encoded); - * ``` - */ -export const babyjubjub = /* @__PURE__ */ (() => eddsa(edwards(babyjubjub_CURVE), blake512))(); -// Sapling URS randomness beacon from the Zcash protocol. This stays as the 64-byte ASCII -// lowercase-hex string used for the first Blake2s block, not 32 raw bytes. -const jubjub_gh_first_block = /* @__PURE__ */ asciiToBytes('096b36a5804bfacef1691e173c366a47ff5ba84a44f26ddd7e8d9f79d5b42df0'); -/** - * @param tag - Hash input. - * @param personalization - BLAKE2 personalization bytes. - * @returns Prime-order Jubjub point. - * @throws If the digest does not decode to a Jubjub point, or if the - * cofactor-cleared point has small order. {@link Error} - * @example - * Hash a tag into a prime-order Jubjub point. - * - * ```ts - * import { jubjub_groupHash } from '@noble/curves/misc.js'; - * import { asciiToBytes } from '@noble/curves/utils.js'; - * const tag = Uint8Array.of(2); - * const personalization = asciiToBytes('Zcash_G_'); - * const point = jubjub_groupHash(tag, personalization); - * ``` - */ -export function jubjub_groupHash(tag, personalization) { - const h = blake2s.create({ personalization, dkLen: 32 }); - h.update(jubjub_gh_first_block); - h.update(tag); - // NOTE: returns EdwardsPoint, in case it will be multiplied later - let p = jubjub.Point.fromBytes(h.digest()); - // NOTE: cannot replace with isSmallOrder, returns Point*8 - p = p.multiply(jubjub_CURVE.h); - if (p.equals(jubjub.Point.ZERO)) - throw new Error('Point has small order'); - return p; -} -/** - * No secret data is leaked here at all. - * It operates over public data. - * @param m - Message prefix. - * @param personalization - 8-byte BLAKE2 personalization bytes. - * @returns First non-zero group hash. - * @throws If the personalization is invalid, or if no non-zero Jubjub group - * hash can be found. {@link Error} - * @example - * Derive the first non-zero Jubjub group hash for one personalization tag. - * - * ```ts - * import { jubjub_findGroupHash } from '@noble/curves/misc.js'; - * import { asciiToBytes } from '@noble/curves/utils.js'; - * const msg = Uint8Array.of(); - * const personalization = asciiToBytes('Zcash_G_'); - * const point = jubjub_findGroupHash(msg, personalization); - * ``` - */ -export function jubjub_findGroupHash(m, personalization) { - // Validate BLAKE2s personalization once up front; otherwise the retry loop swallows the real - // input error and turns it into a misleading "tag overflow". - abytes(personalization, 8, 'personalization'); - const tag = concatBytes(m, Uint8Array.of(0)); - const hashes = []; - for (let i = 0; i < 256; i++) { - tag[tag.length - 1] = i; - try { - hashes.push(jubjub_groupHash(tag, personalization)); - } - catch (e) { } - } - if (!hashes.length) - throw new Error('findGroupHash tag overflow'); - return hashes[0]; -} -const brainpoolP256r1_CURVE = /* @__PURE__ */ (() => ({ - p: BigInt('0xa9fb57dba1eea9bc3e660a909d838d726e3bf623d52620282013481d1f6e5377'), - a: BigInt('0x7d5a0975fc2c3057eef67530417affe7fb8055c126dc5c6ce94a4b44f330b5d9'), - b: BigInt('0x26dc5c6ce94a4b44f330b5d9bbd77cbf958416295cf7e1ce6bccdc18ff8c07b6'), - n: BigInt('0xa9fb57dba1eea9bc3e660a909d838d718c397aa3b561a6f7901e0e82974856a7'), - Gx: BigInt('0x8bd2aeb9cb7e57cb2c4b482ffc81b7afb9de27e1e3bd23c23a4453bd9ace3262'), - Gy: BigInt('0x547ef835c3dac4fd97f8461a14611dc9c27745132ded8e545c1d54c72f046997'), - h: BigInt(1), -}))(); -/** - * Brainpool P256r1 with sha256, from RFC 5639. - * @example - * Generate one Brainpool P256r1 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = brainpoolP256r1.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = brainpoolP256r1.sign(msg, secretKey); - * const isValid = brainpoolP256r1.verify(sig, msg, publicKey); - * ``` - */ -export const brainpoolP256r1 = /* @__PURE__ */ (() => ecdsa(weierstrass(brainpoolP256r1_CURVE), sha256))(); -const brainpoolP384r1_CURVE = /* @__PURE__ */ (() => ({ - p: BigInt('0x8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b412b1da197fb71123acd3a729901d1a71874700133107ec53'), - a: BigInt('0x7bc382c63d8c150c3c72080ace05afa0c2bea28e4fb22787139165efba91f90f8aa5814a503ad4eb04a8c7dd22ce2826'), - b: BigInt('0x04a8c7dd22ce28268b39b55416f0447c2fb77de107dcd2a62e880ea53eeb62d57cb4390295dbc9943ab78696fa504c11'), - n: BigInt('0x8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b31f166e6cac0425a7cf3ab6af6b7fc3103b883202e9046565'), - Gx: BigInt('0x1d1c64f068cf45ffa2a63a81b7c13f6b8847a3e77ef14fe3db7fcafe0cbd10e8e826e03436d646aaef87b2e247d4af1e'), - Gy: BigInt('0x8abe1d7520f9c2a45cb1eb8e95cfd55262b70b29feec5864e19c054ff99129280e4646217791811142820341263c5315'), - h: BigInt(1), -}))(); -/** - * Brainpool P384r1 with sha384, from RFC 5639. - * @example - * Generate one Brainpool P384r1 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = brainpoolP384r1.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = brainpoolP384r1.sign(msg, secretKey); - * const isValid = brainpoolP384r1.verify(sig, msg, publicKey); - * ``` - */ -export const brainpoolP384r1 = /* @__PURE__ */ (() => ecdsa(weierstrass(brainpoolP384r1_CURVE), sha384))(); -const brainpoolP512r1_CURVE = /* @__PURE__ */ (() => ({ - p: BigInt('0xaadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca703308717d4d9b009bc66842aecda12ae6a380e62881ff2f2d82c68528aa6056583a48f3'), - a: BigInt('0x7830a3318b603b89e2327145ac234cc594cbdd8d3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94ca'), - b: BigInt('0x3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94cadc083e67984050b75ebae5dd2809bd638016f723'), - n: BigInt('0xaadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca70330870553e5c414ca92619418661197fac10471db1d381085ddaddb58796829ca90069'), - Gx: BigInt('0x81aee4bdd82ed9645a21322e9c4c6a9385ed9f70b5d916c1b43b62eef4d0098eff3b1f78e2d0d48d50d1687b93b97d5f7c6d5047406a5e688b352209bcb9f822'), - Gy: BigInt('0x7dde385d566332ecc0eabfa9cf7822fdf209f70024a57b1aa000c55b881f8111b2dcde494a5f485e5bca4bd88a2763aed1ca2b2fa8f0540678cd1e0f3ad80892'), - h: BigInt(1), -}))(); -/** - * Brainpool P512r1 with sha512, from RFC 5639. - * @example - * Generate one Brainpool P512r1 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = brainpoolP512r1.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = brainpoolP512r1.sign(msg, secretKey); - * const isValid = brainpoolP512r1.verify(sig, msg, publicKey); - * ``` - */ -export const brainpoolP512r1 = /* @__PURE__ */ (() => ecdsa(weierstrass(brainpoolP512r1_CURVE), sha512))(); -//# sourceMappingURL=misc.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/misc.js.map b/node_modules/@noble/curves/misc.js.map deleted file mode 100644 index 198561a..0000000 --- a/node_modules/@noble/curves/misc.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"misc.js","sourceRoot":"","sources":["src/misc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,sEAAsE;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,KAAK,EACL,OAAO,GAIR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAoC,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,YAAY,EAAa,MAAM,YAAY,CAAC;AAErD,6FAA6F;AAE7F,oDAAoD;AACpD,wDAAwD;AACxD,4EAA4E;AAC5E,MAAM,YAAY,GAAgB,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACxD,CAAC,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAC/E,CAAC,EAAE,MAAM,CAAC,mEAAmE,CAAC;IAC9E,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAC/E,CAAC,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAC/E,EAAE,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAChF,EAAE,EAAE,MAAM,CAAC,oEAAoE,CAAC;CACjF,CAAC,CAAC,EAAE,CAAC;AACN;;;;;;;;;;;;GAYG;AACH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;IACD,CAAC,EAAE,MAAM,CACP,oIAAoI,CACrI;IACD,CAAC,EAAE,MAAM,CACP,oIAAoI,CACrI;IACD,EAAE,EAAE,MAAM,CACR,oIAAoI,CACrI;IACD,EAAE,EAAE,MAAM,CACR,oIAAoI,CACrI;IACD,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CACb,CAAC,CAAC,EAAE,CAAC;AACN;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAU,eAAe,CAAC,CAAC,GAAG,EAAE,CAC1D,KAAK,CAAC,WAAW,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/nist.d.ts b/node_modules/@noble/curves/nist.d.ts deleted file mode 100644 index 03b3691..0000000 --- a/node_modules/@noble/curves/nist.d.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { type FROST } from './abstract/frost.ts'; -import { type H2CHasher } from './abstract/hash-to-curve.ts'; -import { type OPRF } from './abstract/oprf.ts'; -import { type ECDSA, type WeierstrassPointCons } from './abstract/weierstrass.ts'; -import { type TRet } from './utils.ts'; -/** - * NIST P256 (aka secp256r1, prime256v1) curve, ECDSA and ECDH methods. - * Hashes inputs with sha256 by default. - * - * @example - * Generate one P-256 keypair, sign a message, and verify it. - * - * ```js - * import { p256 } from '@noble/curves/nist.js'; - * const { secretKey, publicKey } = p256.keygen(); - * // const publicKey = p256.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p256.sign(msg, secretKey); - * const isValid = p256.verify(sig, msg, publicKey); - * // const sigKeccak = p256.sign(keccak256(msg), secretKey, { prehash: false }); - * ``` - */ -export declare const p256: ECDSA; -/** - * Hashing / encoding to p256 points / field. RFC 9380 methods. - * @example - * Hash one message onto the P-256 curve. - * - * ```ts - * const point = p256_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export declare const p256_hasher: H2CHasher>; -/** - * p256 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over P-256. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = p256_oprf.oprf.generateKeyPair(); - * const blind = p256_oprf.oprf.blind(input); - * const evaluated = p256_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = p256_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export declare const p256_oprf: TRet; -/** - * FROST threshold signatures over p256. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 p256 signing. - * - * ```ts - * const alice = p256_FROST.Identifier.derive('alice@example.com'); - * const bob = p256_FROST.Identifier.derive('bob@example.com'); - * const carol = p256_FROST.Identifier.derive('carol@example.com'); - * const deal = p256_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export declare const p256_FROST: TRet; -/** - * NIST P384 (aka secp384r1) curve, ECDSA and ECDH methods. Hashes inputs with sha384 by default. - * @example - * Generate one P-384 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = p384.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p384.sign(msg, secretKey); - * const isValid = p384.verify(sig, msg, publicKey); - * ``` - */ -export declare const p384: ECDSA; -/** - * Hashing / encoding to p384 points / field. RFC 9380 methods. - * @example - * Hash one message onto the P-384 curve. - * - * ```ts - * const point = p384_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export declare const p384_hasher: H2CHasher>; -/** - * p384 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over P-384. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = p384_oprf.oprf.generateKeyPair(); - * const blind = p384_oprf.oprf.blind(input); - * const evaluated = p384_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = p384_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export declare const p384_oprf: TRet; -/** - * NIST P521 (aka secp521r1) curve, ECDSA and ECDH methods. Hashes inputs with sha512 by default. - * Deterministic `keygen(seed)` expects 99 seed bytes here because the generic scalar-derivation - * helper uses `getMinHashLength(n)`, not the 66-byte canonical secret-key width. - * @example - * Generate one P-521 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = p521.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p521.sign(msg, secretKey); - * const isValid = p521.verify(sig, msg, publicKey); - * ``` - */ -export declare const p521: ECDSA; -/** - * Hashing / encoding to p521 points / field. RFC 9380 methods. - * @example - * Hash one message onto the P-521 curve. - * - * ```ts - * const point = p521_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export declare const p521_hasher: H2CHasher>; -/** - * p521 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over P-521. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = p521_oprf.oprf.generateKeyPair(); - * const blind = p521_oprf.oprf.blind(input); - * const evaluated = p521_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = p521_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export declare const p521_oprf: TRet; -//# sourceMappingURL=nist.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/nist.d.ts.map b/node_modules/@noble/curves/nist.d.ts.map deleted file mode 100644 index f7d6d54..0000000 --- a/node_modules/@noble/curves/nist.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"nist.d.ts","sourceRoot":"","sources":["src/nist.ts"],"names":[],"mappings":"AAOA,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAIL,KAAK,KAAK,EAEV,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AA4EvC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI,EAAE,KAAiD,CAAC;AACrE;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAkB5D,CAAC;AACL;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,IAAI,CAO1B,CAAC;AACR;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,EAAE,IAAI,CAAC,KAAK,CAM5B,CAAC;AAIR;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,IAAI,EAAE,KAAiD,CAAC;AACrE;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAkB5D,CAAC;AACL;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,IAAI,CAO1B,CAAC;AAmBR;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,IAAI,EAAE,KAAiD,CAAC;AACrE;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAkB5D,CAAC;AACL;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,IAAI,CAO1B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/nist.js b/node_modules/@noble/curves/nist.js deleted file mode 100644 index 9c1741e..0000000 --- a/node_modules/@noble/curves/nist.js +++ /dev/null @@ -1,268 +0,0 @@ -/** - * Internal module for NIST P256, P384, P521 curves. - * Do not use for now. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { sha256, sha384, sha512 } from '@noble/hashes/sha2.js'; -import { createFROST } from "./abstract/frost.js"; -import { createHasher } from "./abstract/hash-to-curve.js"; -import { createOPRF } from "./abstract/oprf.js"; -import { ecdsa, mapToCurveSimpleSWU, weierstrass, } from "./abstract/weierstrass.js"; -import {} from "./utils.js"; -// p = 2n**224n * (2n**32n-1n) + 2n**192n + 2n**96n - 1n -// a = Fp256.create(BigInt('-3')); -const p256_CURVE = /* @__PURE__ */ (() => ({ - p: BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff'), - n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'), - h: BigInt(1), - a: BigInt('0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc'), - b: BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b'), - Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'), - Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'), -}))(); -// p = 2n**384n - 2n**128n - 2n**96n + 2n**32n - 1n -const p384_CURVE = /* @__PURE__ */ (() => ({ - p: BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff'), - n: BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973'), - h: BigInt(1), - a: BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc'), - b: BigInt('0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef'), - Gx: BigInt('0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7'), - Gy: BigInt('0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f'), -}))(); -// p = 2n**521n - 1n -const p521_CURVE = /* @__PURE__ */ (() => ({ - p: BigInt('0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'), - n: BigInt('0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409'), - h: BigInt(1), - a: BigInt('0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc'), - b: BigInt('0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00'), - Gx: BigInt('0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66'), - Gy: BigInt('0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650'), -}))(); -function createSWU(Point, opts) { - let map; - // RFC 9380's NIST suites here all use m = 1, so createHasher passes one field element per map. - // Building the SWU sqrt-ratio helper eagerly adds noticeable `nist.js` import cost, so defer it - // to first use; after that the cached mapper is reused directly. - return (scalars) => (map || (map = mapToCurveSimpleSWU(Point.Fp, opts)))(scalars[0]); -} -// NIST P256 -const p256_Point = /* @__PURE__ */ weierstrass(p256_CURVE); -/** - * NIST P256 (aka secp256r1, prime256v1) curve, ECDSA and ECDH methods. - * Hashes inputs with sha256 by default. - * - * @example - * Generate one P-256 keypair, sign a message, and verify it. - * - * ```js - * import { p256 } from '@noble/curves/nist.js'; - * const { secretKey, publicKey } = p256.keygen(); - * // const publicKey = p256.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p256.sign(msg, secretKey); - * const isValid = p256.verify(sig, msg, publicKey); - * // const sigKeccak = p256.sign(keccak256(msg), secretKey, { prehash: false }); - * ``` - */ -export const p256 = /* @__PURE__ */ ecdsa(p256_Point, sha256); -/** - * Hashing / encoding to p256 points / field. RFC 9380 methods. - * @example - * Hash one message onto the P-256 curve. - * - * ```ts - * const point = p256_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const p256_hasher = /* @__PURE__ */ (() => { - return createHasher(p256_Point, createSWU(p256_Point, { - A: p256_CURVE.a, - B: p256_CURVE.b, - Z: p256_Point.Fp.create(BigInt('-10')), - }), { - DST: 'P256_XMD:SHA-256_SSWU_RO_', - encodeDST: 'P256_XMD:SHA-256_SSWU_NU_', - p: p256_CURVE.p, - m: 1, - k: 128, - expand: 'xmd', - hash: sha256, - }); -})(); -/** - * p256 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over P-256. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = p256_oprf.oprf.generateKeyPair(); - * const blind = p256_oprf.oprf.blind(input); - * const evaluated = p256_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = p256_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export const p256_oprf = /* @__PURE__ */ (() => createOPRF({ - name: 'P256-SHA256', - Point: p256_Point, - hash: sha256, - hashToGroup: p256_hasher.hashToCurve, - hashToScalar: p256_hasher.hashToScalar, -}))(); -/** - * FROST threshold signatures over p256. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 p256 signing. - * - * ```ts - * const alice = p256_FROST.Identifier.derive('alice@example.com'); - * const bob = p256_FROST.Identifier.derive('bob@example.com'); - * const carol = p256_FROST.Identifier.derive('carol@example.com'); - * const deal = p256_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const p256_FROST = /* @__PURE__ */ (() => createFROST({ - name: 'FROST-P256-SHA256-v1', - Point: p256_Point, - hashToScalar: p256_hasher.hashToScalar, - hash: sha256, -}))(); -// NIST P384 -const p384_Point = /* @__PURE__ */ weierstrass(p384_CURVE); -/** - * NIST P384 (aka secp384r1) curve, ECDSA and ECDH methods. Hashes inputs with sha384 by default. - * @example - * Generate one P-384 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = p384.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p384.sign(msg, secretKey); - * const isValid = p384.verify(sig, msg, publicKey); - * ``` - */ -export const p384 = /* @__PURE__ */ ecdsa(p384_Point, sha384); -/** - * Hashing / encoding to p384 points / field. RFC 9380 methods. - * @example - * Hash one message onto the P-384 curve. - * - * ```ts - * const point = p384_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const p384_hasher = /* @__PURE__ */ (() => { - return createHasher(p384_Point, createSWU(p384_Point, { - A: p384_CURVE.a, - B: p384_CURVE.b, - Z: p384_Point.Fp.create(BigInt('-12')), - }), { - DST: 'P384_XMD:SHA-384_SSWU_RO_', - encodeDST: 'P384_XMD:SHA-384_SSWU_NU_', - p: p384_CURVE.p, - m: 1, - k: 192, - expand: 'xmd', - hash: sha384, - }); -})(); -/** - * p384 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over P-384. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = p384_oprf.oprf.generateKeyPair(); - * const blind = p384_oprf.oprf.blind(input); - * const evaluated = p384_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = p384_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export const p384_oprf = /* @__PURE__ */ (() => createOPRF({ - name: 'P384-SHA384', - Point: p384_Point, - hash: sha384, - hashToGroup: p384_hasher.hashToCurve, - hashToScalar: p384_hasher.hashToScalar, -}))(); -// NIST P521 -// RFC 7518 fixes the canonical JWK/JOSE width at 66 bytes: -// - Section 3.4 says ECDSA octet strings must not omit leading zero octets -// - Sections 6.2.1.2/6.2.1.3 say P-521 coordinates "x"/"y" must be 66 octets -// - Section 6.2.2.1 says private scalar "d" must be ceil(log2(n)/8) octets, i.e. 66 for P-521 -// NIST FIPS 186-5 Appendix A.3.3 also routes deterministic ECDSA private keys through Appendix -// B.2.3, whose Integer-to-Octet-String output has explicit fixed length L; for P-521 that is the -// same 66-byte order width. -// RFC 6979 matches that width too: private key x is an integer, while `int2octets(x)` uses -// rlen = 8 * ceil(qlen/8); for P-521, qlen = 521 so the canonical octet width is 66 bytes. -// Wycheproof ECDH stores private values as integers, not fixed-width scalar bytes, so it does not -// require a dedicated 65-byte parser path; the repo tests now normalize those integer fixtures to -// the canonical 66-byte width before use. There is no good standards or oracle reason to accept -// exactly 65 bytes here: the coherent choices are canonical 66 only, or a broader integer-style -// parser across many widths. Since this field parser is fixed-width, keep it canonical and use the -// default exact-66-byte scalar field path. -const p521_Point = /* @__PURE__ */ weierstrass(p521_CURVE); -/** - * NIST P521 (aka secp521r1) curve, ECDSA and ECDH methods. Hashes inputs with sha512 by default. - * Deterministic `keygen(seed)` expects 99 seed bytes here because the generic scalar-derivation - * helper uses `getMinHashLength(n)`, not the 66-byte canonical secret-key width. - * @example - * Generate one P-521 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = p521.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p521.sign(msg, secretKey); - * const isValid = p521.verify(sig, msg, publicKey); - * ``` - */ -export const p521 = /* @__PURE__ */ ecdsa(p521_Point, sha512); -/** - * Hashing / encoding to p521 points / field. RFC 9380 methods. - * @example - * Hash one message onto the P-521 curve. - * - * ```ts - * const point = p521_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const p521_hasher = /* @__PURE__ */ (() => { - return createHasher(p521_Point, createSWU(p521_Point, { - A: p521_CURVE.a, - B: p521_CURVE.b, - Z: p521_Point.Fp.create(BigInt('-4')), - }), { - DST: 'P521_XMD:SHA-512_SSWU_RO_', - encodeDST: 'P521_XMD:SHA-512_SSWU_NU_', - p: p521_CURVE.p, - m: 1, - k: 256, - expand: 'xmd', - hash: sha512, - }); -})(); -/** - * p521 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over P-521. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = p521_oprf.oprf.generateKeyPair(); - * const blind = p521_oprf.oprf.blind(input); - * const evaluated = p521_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = p521_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export const p521_oprf = /* @__PURE__ */ (() => createOPRF({ - name: 'P521-SHA512', - Point: p521_Point, - hash: sha512, - hashToGroup: p521_hasher.hashToCurve, - hashToScalar: p521_hasher.hashToScalar, // produces L=98 just like in RFC -}))(); -//# sourceMappingURL=nist.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/nist.js.map b/node_modules/@noble/curves/nist.js.map deleted file mode 100644 index 7596d15..0000000 --- a/node_modules/@noble/curves/nist.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"nist.js","sourceRoot":"","sources":["src/nist.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAc,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAkB,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAa,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,KAAK,EACL,mBAAmB,EACnB,WAAW,GAIZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAa,MAAM,YAAY,CAAC;AAEvC,wDAAwD;AACxD,kCAAkC;AAClC,MAAM,UAAU,GAA4B,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAClE,CAAC,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAC/E,CAAC,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAC/E,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC,oEAAoE,CA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AC5B,2FAA2F;AAC3F,2FAA2F;AAC3F,kGAAkG;AAClG,kGAAkG;AAClG,gGAAgG;AAChG,gGAAgG;AAChG,mGAAmG;AACnG,2CAA2C;AAC3C,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC3D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,IAAI,GAAU,eAAe,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACrE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAA4C,eAAe,CAAC,CAAC,GAAG,EAAE;IACxF,OAAO,YAAY,CACjB,UAAU,EACV,SAAS,CAAC,UAAU,EAAE;QACpB,CAAC,EAAE,UAAU,CAAC,CAAC;QACf,CAAC,EAAE,UAAU,CAAC,CAAC;QACf,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACtC,CAAC,EACF;QACE,GAAG,EAAE,2BAA2B;QAChC,SAAS,EAAE,2BAA2B;QACtC,CAAC,EAAE,UAAU,CAAC,CAAC;QACf,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,GAAG;QACN,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,MAAM;KACb,CACF,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC;AACL;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,SAAS,GAAe,eAAe,CAAC,CAAC,GAAG,EAAE,CACzD,UAAU,CAAC;IACT,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,WAAW,CAAC,WAAW;IACpC,YAAY,EAAE,WAAW,CAAC,YAAY,EAAE,iCAAiC;CAC1E,CAAC,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/package.json b/node_modules/@noble/curves/package.json deleted file mode 100644 index fcc6b92..0000000 --- a/node_modules/@noble/curves/package.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "name": "@noble/curves", - "version": "2.2.0", - "description": "Audited & minimal JS implementation of elliptic curve cryptography", - "files": [ - "*.js", - "*.js.map", - "*.d.ts", - "*.d.ts.map", - "abstract", - "src" - ], - "dependencies": { - "@noble/hashes": "2.2.0" - }, - "devDependencies": { - "@paulmillr/jsbt": "0.5.0", - "@types/node": "25.3.0", - "fast-check": "4.2.0", - "prettier": "3.6.2", - "typescript": "6.0.2" - }, - "scripts": { - "bench": "cd test/benchmark; node secp256k1.ts; node curves.ts; node utils.ts; node bls.ts", - "bench:install": "cd test/benchmark; npm install; npm install ../.. --install-links", - "build": "tsc", - "build:release": "npx --no @paulmillr/jsbt esbuild test/build", - "check": "npm run check:readme && npm run check:treeshake && npm run check:jsdoc", - "check:readme": "npx --no @paulmillr/jsbt readme package.json", - "check:treeshake": "npx --no @paulmillr/jsbt treeshake package.json test/build/out-treeshake", - "check:jsdoc": "npx --no @paulmillr/jsbt tsdoc package.json", - "build:clean": "rm {.,abstract}/*.{js,d.ts,d.ts.map,js.map} 2> /dev/null", - "format": "prettier --write 'src/**/*.{js,ts}' 'test/*.{js,ts}'", - "test": "node test/index.ts", - "test:bun": "bun test/index.ts", - "test:deno": "deno --allow-env --allow-read test/index.ts", - "test:node20": "cd test; npx tsc; node compiled/test/index.js", - "test:coverage": "npm install --no-save c8@10.1.2 && npx c8 npm test" - }, - "exports": { - ".": "./index.js", - "./abstract/bls.js": "./abstract/bls.js", - "./abstract/curve.js": "./abstract/curve.js", - "./abstract/edwards.js": "./abstract/edwards.js", - "./abstract/fft.js": "./abstract/fft.js", - "./abstract/frost.js": "./abstract/frost.js", - "./abstract/hash-to-curve.js": "./abstract/hash-to-curve.js", - "./abstract/modular.js": "./abstract/modular.js", - "./abstract/montgomery.js": "./abstract/montgomery.js", - "./abstract/oprf.js": "./abstract/oprf.js", - "./abstract/poseidon.js": "./abstract/poseidon.js", - "./abstract/tower.js": "./abstract/tower.js", - "./abstract/weierstrass.js": "./abstract/weierstrass.js", - "./bls12-381.js": "./bls12-381.js", - "./bn254.js": "./bn254.js", - "./ed448.js": "./ed448.js", - "./ed25519.js": "./ed25519.js", - "./misc.js": "./misc.js", - "./nist.js": "./nist.js", - "./secp256k1.js": "./secp256k1.js", - "./utils.js": "./utils.js", - "./webcrypto.js": "./webcrypto.js" - }, - "engines": { - "node": ">= 20.19.0" - }, - "keywords": [ - "cryptography", - "secp256k1", - "ed25519", - "p256", - "p384", - "p521", - "secp256r1", - "ed448", - "x25519", - "ed25519", - "bls12-381", - "bn254", - "alt_bn128", - "bls", - "noble", - "ecc", - "ecdsa", - "eddsa", - "oprf", - "schnorr", - "fft" - ], - "homepage": "https://paulmillr.com/noble/", - "funding": "https://paulmillr.com/funding/", - "repository": { - "type": "git", - "url": "git+https://github.com/paulmillr/noble-curves.git" - }, - "type": "module", - "main": "index.js", - "module": "index.js", - "types": "index.d.ts", - "sideEffects": false, - "author": "Paul Miller (https://paulmillr.com)", - "license": "MIT" -} diff --git a/node_modules/@noble/curves/secp256k1.d.ts b/node_modules/@noble/curves/secp256k1.d.ts deleted file mode 100644 index baf5050..0000000 --- a/node_modules/@noble/curves/secp256k1.d.ts +++ /dev/null @@ -1,153 +0,0 @@ -import { type CurveLengths } from './abstract/curve.ts'; -import { type FROST } from './abstract/frost.ts'; -import { type H2CHasher } from './abstract/hash-to-curve.ts'; -import { type ECDSA, type WeierstrassPoint as PointType, type WeierstrassPointCons } from './abstract/weierstrass.ts'; -import { type TArg, type TRet } from './utils.ts'; -/** - * secp256k1 curve: ECDSA and ECDH methods. - * - * Uses sha256 to hash messages. To use a different hash, - * pass `{ prehash: false }` to sign / verify. - * - * @example - * Generate one secp256k1 keypair, sign a message, and verify it. - * - * ```js - * import { secp256k1 } from '@noble/curves/secp256k1.js'; - * const { secretKey, publicKey } = secp256k1.keygen(); - * // const publicKey = secp256k1.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = secp256k1.sign(msg, secretKey); - * const isValid = secp256k1.verify(sig, msg, publicKey); - * // const sigKeccak = secp256k1.sign(keccak256(msg), secretKey, { prehash: false }); - * ``` - */ -export declare const secp256k1: ECDSA; -declare function taggedHash(tag: string, ...messages: TArg): TRet; -/** - * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point. - * @returns valid point checked for being on-curve - */ -declare function lift_x(x: bigint): PointType; -/** Schnorr public key is just `x` coordinate of Point as per BIP340. */ -declare function schnorrGetPublicKey(secretKey: TArg): TRet; -/** - * Creates Schnorr signature as per BIP340. Verifies itself before returning anything. - * `auxRand` is optional and is not the sole source of `k` generation: bad CSPRNG output will not - * be catastrophic, but BIP-340 still recommends fresh auxiliary randomness when available to harden - * deterministic signing against side-channel and fault-injection attacks. - */ -declare function schnorrSign(message: TArg, secretKey: TArg, auxRand?: TArg): TRet; -/** - * Verifies Schnorr signature. - * Will swallow errors & return false except for initial type validation of arguments. - */ -declare function schnorrVerify(signature: TArg, message: TArg, publicKey: TArg): boolean; -export declare const __TEST: { - lift_x: typeof lift_x; -}; -/** Schnorr-specific secp256k1 API from BIP340. */ -export type SecpSchnorr = { - /** - * Generate one Schnorr secret/public keypair. - * @param seed - Optional seed for deterministic testing or custom randomness. - * @returns Fresh secret/public keypair. - */ - keygen: (seed?: TArg) => { - secretKey: TRet; - publicKey: TRet; - }; - /** - * Derive the x-only public key from a secret key. - * @param secretKey - Secret key bytes. - * @returns X-only public key bytes. - */ - getPublicKey: typeof schnorrGetPublicKey; - /** - * Create one BIP340 Schnorr signature. - * @param message - Message bytes to sign. - * @param secretKey - Secret key bytes. - * @param auxRand - Optional auxiliary randomness. - * @returns Compact Schnorr signature bytes. - */ - sign: typeof schnorrSign; - /** - * Verify one BIP340 Schnorr signature. - * @param signature - Compact signature bytes. - * @param message - Signed message bytes. - * @param publicKey - X-only public key bytes. - * @returns `true` when the signature is valid. - */ - verify: typeof schnorrVerify; - /** Underlying secp256k1 point constructor. */ - Point: WeierstrassPointCons; - /** Helper utilities for Schnorr-specific key handling and tagged hashing. */ - utils: { - /** Generate one Schnorr secret key. */ - randomSecretKey: (seed?: TArg) => TRet; - /** Convert one point into its x-only BIP340 byte encoding. */ - pointToBytes: (point: TArg>) => TRet; - /** Lift one x coordinate into the unique even-Y point. */ - lift_x: typeof lift_x; - /** Compute a BIP340 tagged hash. */ - taggedHash: typeof taggedHash; - }; - /** Public byte lengths for keys, signatures, and seeds. */ - lengths: CurveLengths; -}; -/** - * Schnorr signatures over secp256k1. - * See {@link https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki | BIP 340}. - * @example - * Generate one BIP340 Schnorr keypair, sign a message, and verify it. - * - * ```js - * import { schnorr } from '@noble/curves/secp256k1.js'; - * const { secretKey, publicKey } = schnorr.keygen(); - * // const publicKey = schnorr.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello'); - * const sig = schnorr.sign(msg, secretKey); - * const isValid = schnorr.verify(sig, msg, publicKey); - * ``` - */ -export declare const schnorr: SecpSchnorr; -/** - * Hashing / encoding to secp256k1 points / field. RFC 9380 methods. - * @example - * Hash one message onto secp256k1. - * - * ```ts - * const point = secp256k1_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export declare const secp256k1_hasher: H2CHasher>; -/** - * FROST threshold signatures over secp256k1. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 secp256k1 signing. - * - * ```ts - * const alice = secp256k1_FROST.Identifier.derive('alice@example.com'); - * const bob = secp256k1_FROST.Identifier.derive('bob@example.com'); - * const carol = secp256k1_FROST.Identifier.derive('carol@example.com'); - * const deal = secp256k1_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export declare const secp256k1_FROST: TRet; -/** - * FROST threshold signatures over secp256k1-schnorr-taproot. RFC 9591. - * DKG outputs are auto-tweaked with the empty Taproot merkle root for compatibility, while - * `trustedDealer()` outputs stay untweaked unless callers apply the Taproot tweak themselves. - * @example - * Create one trusted-dealer package for Taproot-compatible FROST signing. - * - * ```ts - * const alice = schnorr_FROST.Identifier.derive('alice@example.com'); - * const bob = schnorr_FROST.Identifier.derive('bob@example.com'); - * const carol = schnorr_FROST.Identifier.derive('carol@example.com'); - * const deal = schnorr_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export declare const schnorr_FROST: TRet; -export {}; -//# sourceMappingURL=secp256k1.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/secp256k1.d.ts.map b/node_modules/@noble/curves/secp256k1.d.ts.map deleted file mode 100644 index 63dcca6..0000000 --- a/node_modules/@noble/curves/secp256k1.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"secp256k1.d.ts","sourceRoot":"","sources":["src/secp256k1.ts"],"names":[],"mappings":"AAUA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAEL,KAAK,KAAK,EAIX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAgB,KAAK,SAAS,EAAc,MAAM,6BAA6B,CAAC;AAEvF,OAAO,EACL,KAAK,KAAK,EAIV,KAAK,gBAAgB,IAAI,SAAS,EAGlC,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAKL,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AA4DpB;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS,EAAE,KAA8C,CAAC;AAOvE,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAQlF;AAeD;;;GAGG;AACH,iBAAS,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAY5C;AASD,wEAAwE;AACxE,iBAAS,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CA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AU,CAAC,CAAC;QACnE,0DAA0D;QAC1D,MAAM,EAAE,OAAO,MAAM,CAAC;QACtB,oCAAoC;QACpC,UAAU,EAAE,OAAO,UAAU,CAAC;KAC/B,CAAC;IACF,2DAA2D;IAC3D,OAAO,EAAE,YAAY,CAAC;CACvB,CAAC;AACF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,OAAO,EAAE,WA2BlB,CAAC;AAiDL;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAgB/D,CAAC;AACP;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,IAAI,CAAC,KAAK,CAMjC,CAAC;AAqFR;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,EAAE,IAAI,CAAC,KAAK,CAuC/B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/secp256k1.js b/node_modules/@noble/curves/secp256k1.js deleted file mode 100644 index fc6cf70..0000000 --- a/node_modules/@noble/curves/secp256k1.js +++ /dev/null @@ -1,466 +0,0 @@ -/** - * SECG secp256k1. See [pdf](https://www.secg.org/sec2-v2.pdf). - * - * Belongs to Koblitz curves: it has efficiently-computable GLV endomorphism ψ, - * check out {@link EndomorphismOpts}. Seems to be rigid (not backdoored). - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { sha256 } from '@noble/hashes/sha2.js'; -import { randomBytes } from '@noble/hashes/utils.js'; -import { createKeygen } from "./abstract/curve.js"; -import { createFROST, } from "./abstract/frost.js"; -import { createHasher, isogenyMap } from "./abstract/hash-to-curve.js"; -import { Field, mapHashToField, pow2 } from "./abstract/modular.js"; -import { ecdsa, mapToCurveSimpleSWU, weierstrass, } from "./abstract/weierstrass.js"; -import { abytes, asciiToBytes, bytesToNumberBE, concatBytes, } from "./utils.js"; -// Seems like generator was produced from some seed: -// `Pointk1.BASE.multiply(Pointk1.Fn.inv(2n, N)).toAffine().x` -// // gives short x 0x3b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63n -const secp256k1_CURVE = { - p: BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'), - n: BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'), - h: BigInt(1), - a: BigInt(0), - b: BigInt(7), - Gx: BigInt('0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'), - Gy: BigInt('0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8'), -}; -const secp256k1_ENDO = { - beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'), - basises: [ - [BigInt('0x3086d221a7d46bcde86c90e49284eb15'), -BigInt('0xe4437ed6010e88286f547fa90abfe4c3')], - [BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8'), BigInt('0x3086d221a7d46bcde86c90e49284eb15')], - ], -}; -const _0n = /* @__PURE__ */ BigInt(0); -const _2n = /* @__PURE__ */ BigInt(2); -/** - * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit. - * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00] - */ -function sqrtMod(y) { - const P = secp256k1_CURVE.p; - // prettier-ignore - const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); - // prettier-ignore - const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); - const b2 = (y * y * y) % P; // x^3, 11 - const b3 = (b2 * b2 * y) % P; // x^7 - const b6 = (pow2(b3, _3n, P) * b3) % P; - const b9 = (pow2(b6, _3n, P) * b3) % P; - const b11 = (pow2(b9, _2n, P) * b2) % P; - const b22 = (pow2(b11, _11n, P) * b11) % P; - const b44 = (pow2(b22, _22n, P) * b22) % P; - const b88 = (pow2(b44, _44n, P) * b44) % P; - const b176 = (pow2(b88, _88n, P) * b88) % P; - const b220 = (pow2(b176, _44n, P) * b44) % P; - const b223 = (pow2(b220, _3n, P) * b3) % P; - const t1 = (pow2(b223, _23n, P) * b22) % P; - const t2 = (pow2(t1, _6n, P) * b2) % P; - const root = pow2(t2, _2n, P); - if (!Fpk1.eql(Fpk1.sqr(root), y)) - throw new Error('Cannot find square root'); - return root; -} -const Fpk1 = Field(secp256k1_CURVE.p, { sqrt: sqrtMod }); -const Pointk1 = /* @__PURE__ */ weierstrass(secp256k1_CURVE, { - Fp: Fpk1, - endo: secp256k1_ENDO, -}); -/** - * secp256k1 curve: ECDSA and ECDH methods. - * - * Uses sha256 to hash messages. To use a different hash, - * pass `{ prehash: false }` to sign / verify. - * - * @example - * Generate one secp256k1 keypair, sign a message, and verify it. - * - * ```js - * import { secp256k1 } from '@noble/curves/secp256k1.js'; - * const { secretKey, publicKey } = secp256k1.keygen(); - * // const publicKey = secp256k1.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = secp256k1.sign(msg, secretKey); - * const isValid = secp256k1.verify(sig, msg, publicKey); - * // const sigKeccak = secp256k1.sign(keccak256(msg), secretKey, { prehash: false }); - * ``` - */ -export const secp256k1 = /* @__PURE__ */ ecdsa(Pointk1, sha256); -// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code. -// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki -/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */ -const TAGGED_HASH_PREFIXES = {}; -// BIP-340 phrases tags as UTF-8, but all current standardized names here are 7-bit ASCII. -function taggedHash(tag, ...messages) { - let tagP = TAGGED_HASH_PREFIXES[tag]; - if (tagP === undefined) { - const tagH = sha256(asciiToBytes(tag)); - tagP = concatBytes(tagH, tagH); - TAGGED_HASH_PREFIXES[tag] = tagP; - } - return sha256(concatBytes(tagP, ...messages)); -} -// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03 -const pointToBytes = (point) => point.toBytes(true).slice(1); -const hasEven = (y) => y % _2n === _0n; -// Calculate point, scalar and bytes -function schnorrGetExtPubKey(priv) { - const { Fn, BASE } = Pointk1; - const d_ = Fn.fromBytes(priv); - const p = BASE.multiply(d_); // P = d'⋅G; 0 < d' < n check is done inside - const scalar = hasEven(p.y) ? d_ : Fn.neg(d_); - return { scalar, bytes: pointToBytes(p) }; -} -/** - * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point. - * @returns valid point checked for being on-curve - */ -function lift_x(x) { - const Fp = Fpk1; - if (!Fp.isValidNot0(x)) - throw new Error('invalid x: Fail if x ≥ p'); - const xx = Fp.create(x * x); - const c = Fp.create(xx * x + BigInt(7)); // Let c = x³ + 7 mod p. - let y = Fp.sqrt(c); // Let y = c^(p+1)/4 mod p. Same as sqrt(). - // Return the unique point P such that x(P) = x and - // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise. - if (!hasEven(y)) - y = Fp.neg(y); - const p = Pointk1.fromAffine({ x, y }); - p.assertValidity(); - return p; -} -// BIP-340 callers still need to supply canonical 32-byte inputs where required; this alias only -// parses big-endian bytes and does not enforce the fixed-width contract itself. -const num = bytesToNumberBE; -/** Create tagged hash, convert it to bigint, reduce modulo-n. */ -function challenge(...args) { - return Pointk1.Fn.create(num(taggedHash('BIP0340/challenge', ...args))); -} -/** Schnorr public key is just `x` coordinate of Point as per BIP340. */ -function schnorrGetPublicKey(secretKey) { - return schnorrGetExtPubKey(secretKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G) -} -/** - * Creates Schnorr signature as per BIP340. Verifies itself before returning anything. - * `auxRand` is optional and is not the sole source of `k` generation: bad CSPRNG output will not - * be catastrophic, but BIP-340 still recommends fresh auxiliary randomness when available to harden - * deterministic signing against side-channel and fault-injection attacks. - */ -function schnorrSign(message, secretKey, auxRand = randomBytes(32)) { - const { Fn, BASE } = Pointk1; - const m = abytes(message, undefined, 'message'); - const { bytes: px, scalar: d } = schnorrGetExtPubKey(secretKey); // checks for isWithinCurveOrder - const a = abytes(auxRand, 32, 'auxRand'); // Auxiliary random data a: a 32-byte array - // Let t be the byte-wise xor of bytes(d) and hash/aux(a). - const t = Fn.toBytes(d ^ num(taggedHash('BIP0340/aux', a))); - const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m) - // BIP340 defines k' = int(rand) mod n. We can't reuse schnorrGetExtPubKey(rand) - // here: that helper parses canonical secret keys and rejects rand >= n instead - // of reducing the nonce hash modulo the group order. - const k_ = Fn.create(num(rand)); - // BIP-340: "Let k' = int(rand) mod n. Fail if k' = 0. Let R = k'⋅G." - if (k_ === 0n) - throw new Error('sign failed: k is zero'); - const p = BASE.multiply(k_); // Rejects zero; only the raw nonce hash needs reduction. - const k = hasEven(p.y) ? k_ : Fn.neg(k_); - const rx = pointToBytes(p); - const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n. - const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n). - sig.set(rx, 0); - sig.set(Fn.toBytes(Fn.create(k + e * d)), 32); - // If Verify(bytes(P), m, sig) (see below) returns failure, abort - if (!schnorrVerify(sig, m, px)) - throw new Error('sign: Invalid signature produced'); - return sig; -} -/** - * Verifies Schnorr signature. - * Will swallow errors & return false except for initial type validation of arguments. - */ -function schnorrVerify(signature, message, publicKey) { - const { Fp, Fn, BASE } = Pointk1; - const sig = abytes(signature, 64, 'signature'); - const m = abytes(message, undefined, 'message'); - const pub = abytes(publicKey, 32, 'publicKey'); - try { - const P = lift_x(num(pub)); // P = lift_x(int(pk)); fail if that fails - const r = num(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p. - if (!Fp.isValidNot0(r)) - return false; - const s = num(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n. - // Stricter than BIP-340/libsecp256k1, which only reject s >= n. Honest signing reaches - // s = 0 only with negligible probability (k + e*d ≡ 0 mod n), so treat zero-s inputs as - // crafted edge cases and fail closed instead of carrying that extra verification surface. - if (!Fn.isValidNot0(s)) - return false; - // int(challenge(bytes(r) || bytes(P) || m)) % n - const e = challenge(Fn.toBytes(r), pointToBytes(P), m); - // R = s⋅G - e⋅P, where -eP == (n-e)P - const R = BASE.multiplyUnsafe(s).add(P.multiplyUnsafe(Fn.neg(e))); - const { x, y } = R.toAffine(); - // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r. - if (R.is0() || !hasEven(y) || x !== r) - return false; - return true; - } - catch (error) { - return false; - } -} -export const __TEST = /* @__PURE__ */ Object.freeze({ lift_x }); -/** - * Schnorr signatures over secp256k1. - * See {@link https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki | BIP 340}. - * @example - * Generate one BIP340 Schnorr keypair, sign a message, and verify it. - * - * ```js - * import { schnorr } from '@noble/curves/secp256k1.js'; - * const { secretKey, publicKey } = schnorr.keygen(); - * // const publicKey = schnorr.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello'); - * const sig = schnorr.sign(msg, secretKey); - * const isValid = schnorr.verify(sig, msg, publicKey); - * ``` - */ -export const schnorr = /* @__PURE__ */ (() => { - const size = 32; - const seedLength = 48; - const randomSecretKey = (seed) => { - seed = seed === undefined ? randomBytes(seedLength) : seed; - return mapHashToField(seed, secp256k1_CURVE.n); - }; - return Object.freeze({ - keygen: createKeygen(randomSecretKey, schnorrGetPublicKey), - getPublicKey: schnorrGetPublicKey, - sign: schnorrSign, - verify: schnorrVerify, - Point: Pointk1, - utils: Object.freeze({ - randomSecretKey, - taggedHash, - lift_x, - pointToBytes, - }), - lengths: Object.freeze({ - secretKey: size, - publicKey: size, - publicKeyHasPrefix: false, - signature: size * 2, - seed: seedLength, - }), - }); -})(); -// RFC 9380 Appendix E.1 3-isogeny coefficients for secp256k1, stored in ascending degree order. -// The final `1` in each denominator array is the explicit monic leading term. -const isoMap = /* @__PURE__ */ (() => isogenyMap(Fpk1, [ - // xNum - [ - '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7', - '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581', - '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262', - '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c', - ], - // xDen - [ - '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b', - '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14', - '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 - ], - // yNum - [ - '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c', - '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3', - '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931', - '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84', - ], - // yDen - [ - '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b', - '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573', - '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f', - '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 - ], -].map((i) => i.map((j) => BigInt(j)))))(); -// RFC 9380 §8.7 secp256k1 E' parameters for the SWU-to-isogeny pipeline below. -let mapSWU; -const getMapSWU = () => mapSWU || - (mapSWU = mapToCurveSimpleSWU(Fpk1, { - // Building the SWU sqrt-ratio helper eagerly adds noticeable `secp256k1.js` import cost, so - // defer it to first use; after that the cached mapper is reused directly. - A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'), - B: BigInt('1771'), - Z: Fpk1.create(BigInt('-11')), - })); -/** - * Hashing / encoding to secp256k1 points / field. RFC 9380 methods. - * @example - * Hash one message onto secp256k1. - * - * ```ts - * const point = secp256k1_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const secp256k1_hasher = /* @__PURE__ */ (() => createHasher(Pointk1, (scalars) => { - const { x, y } = getMapSWU()(Fpk1.create(scalars[0])); - return isoMap(x, y); -}, { - DST: 'secp256k1_XMD:SHA-256_SSWU_RO_', - encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_', - p: Fpk1.ORDER, - m: 1, - k: 128, - expand: 'xmd', - hash: sha256, -}))(); -/** - * FROST threshold signatures over secp256k1. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 secp256k1 signing. - * - * ```ts - * const alice = secp256k1_FROST.Identifier.derive('alice@example.com'); - * const bob = secp256k1_FROST.Identifier.derive('bob@example.com'); - * const carol = secp256k1_FROST.Identifier.derive('carol@example.com'); - * const deal = secp256k1_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const secp256k1_FROST = /* @__PURE__ */ (() => createFROST({ - name: 'FROST-secp256k1-SHA256-v1', - Point: Pointk1, - hashToScalar: secp256k1_hasher.hashToScalar, - hash: sha256, -}))(); -// Taproot utils -// `undefined` means "disable TapTweak entirely"; callers that want the BIP-341/BIP-386 empty -// merkle root must pass `new Uint8Array(0)` explicitly. -function tweak(point, merkleRoot) { - if (merkleRoot === undefined) - return _0n; - const x = pointToBytes(point); - const t = bytesToNumberBE(taggedHash('TapTweak', x, merkleRoot)); - // BIP-341 taproot_tweak_pubkey/taproot_tweak_seckey: "if t >= SECP256K1_ORDER: - // raise ValueError". TapTweak must reject overflow instead of reducing modulo n. - if (!Pointk1.Fn.isValid(t)) - throw new Error('invalid TapTweak hash'); - return t; -} -function frostPubToEvenY(pub) { - const VK = Pointk1.fromBytes(pub.commitments[0]); - // Keep aliasing on the already-even path so wrapper callers can skip unnecessary cloning. - if (hasEven(VK.y)) - return pub; - return { - signers: { min: pub.signers.min, max: pub.signers.max }, - commitments: pub.commitments.map((i) => Pointk1.fromBytes(i).negate().toBytes()), - verifyingShares: Object.fromEntries(Object.entries(pub.verifyingShares).map(([k, v]) => [ - k, - Pointk1.fromBytes(v).negate().toBytes(), - ])), - }; -} -function frostSecretToEvenY(s, pub) { - const VK = Pointk1.fromBytes(pub.commitments[0]); - // Keep aliasing on the already-even path so wrapper callers can preserve package identity. - if (hasEven(VK.y)) - return s; - const Fn = Pointk1.Fn; - return { - ...s, - signingShare: Fn.toBytes(Fn.neg(Fn.fromBytes(s.signingShare))), - }; -} -function frostNoncesToEvenY(PK, nonces) { - if (hasEven(PK.y)) - return nonces; - const Fn = Pointk1.Fn; - return { - binding: Fn.toBytes(Fn.neg(Fn.fromBytes(nonces.binding))), - hiding: Fn.toBytes(Fn.neg(Fn.fromBytes(nonces.hiding))), - }; -} -function frostTweakSecret(s, pub, merkleRoot) { - const Fn = Pointk1.Fn; - const keyPackage = frostSecretToEvenY(s, pub); - const evenPub = frostPubToEvenY(pub); - const t = tweak(Pointk1.fromBytes(evenPub.commitments[0]), merkleRoot); - const signingShare = Fn.toBytes(Fn.add(Fn.fromBytes(keyPackage.signingShare), t)); - return { - identifier: keyPackage.identifier, - signingShare, - }; -} -function frostTweakPublic(pub, merkleRoot) { - const PKPackage = frostPubToEvenY(pub); - const t = tweak(Pointk1.fromBytes(PKPackage.commitments[0]), merkleRoot); - const tp = Pointk1.BASE.multiply(t); - const commitments = PKPackage.commitments.map((c, i) => (i === 0 ? Pointk1.fromBytes(c).add(tp) : Pointk1.fromBytes(c)).toBytes()); - const verifyingShares = {}; - for (const k in PKPackage.verifyingShares) { - verifyingShares[k] = Pointk1.fromBytes(PKPackage.verifyingShares[k]).add(tp).toBytes(); - } - return { - signers: { min: PKPackage.signers.min, max: PKPackage.signers.max }, - commitments, - verifyingShares, - }; -} -/** - * FROST threshold signatures over secp256k1-schnorr-taproot. RFC 9591. - * DKG outputs are auto-tweaked with the empty Taproot merkle root for compatibility, while - * `trustedDealer()` outputs stay untweaked unless callers apply the Taproot tweak themselves. - * @example - * Create one trusted-dealer package for Taproot-compatible FROST signing. - * - * ```ts - * const alice = schnorr_FROST.Identifier.derive('alice@example.com'); - * const bob = schnorr_FROST.Identifier.derive('bob@example.com'); - * const carol = schnorr_FROST.Identifier.derive('carol@example.com'); - * const deal = schnorr_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const schnorr_FROST = /* @__PURE__ */ (() => createFROST({ - name: 'FROST-secp256k1-SHA256-TR-v1', - Point: Pointk1, - hashToScalar: secp256k1_hasher.hashToScalar, - hash: sha256, - // Taproot related hacks - parsePublicKey(publicKey) { - // External Taproot keys are x-only, but local key packages still use compressed points. - if (publicKey.length === 32) - return lift_x(bytesToNumberBE(publicKey)); - if (publicKey.length === 33) - return Pointk1.fromBytes(publicKey); - throw new Error(`expected x-only or compressed public key, got length=${publicKey.length}`); - }, - adjustScalar(n) { - const PK = Pointk1.BASE.multiply(n); - return hasEven(PK.y) ? n : Pointk1.Fn.neg(n); - }, - adjustPoint: (p) => (hasEven(p.y) ? p : p.negate()), - challenge(R, PK, msg) { - return challenge(pointToBytes(R), pointToBytes(PK), msg); - }, - adjustNonces: frostNoncesToEvenY, - adjustGroupCommitmentShare: (GC, GCShare) => (!hasEven(GC.y) ? GCShare.negate() : GCShare), - adjustPublic: frostPubToEvenY, - adjustSecret: frostSecretToEvenY, - adjustTx: { - // Compat with official implementation - encode: (tx) => tx.subarray(1), - decode: (tx) => concatBytes(Uint8Array.of(0x02), tx), - }, - adjustDKG: (k) => { - // Compatibility with frost-secp256k1-tr: DKG output is auto-tweaked with the - // empty Taproot merkle root, while dealer-generated keys stay untweaked. - const merkleRoot = new Uint8Array(0); - return { - public: frostTweakPublic(k.public, merkleRoot), - secret: frostTweakSecret(k.secret, k.public, merkleRoot), - }; - }, -}))(); -//# sourceMappingURL=secp256k1.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/secp256k1.js.map b/node_modules/@noble/curves/secp256k1.js.map deleted file mode 100644 index 983cf1e..0000000 --- a/node_modules/@no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C,MAAM,EAAE,CAAC;IACnD,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG;QAClB,OAAO,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IACD,YAAY,EAAE,kBAAkB;IAChC,0BAA0B,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1F,YAAY,EAAE,eAAe;IAC7B,YAAY,EAAE,kBAAkB;IAChC,QAAQ,EAAE;QACR,sCAAsC;QACtC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAqB;QAClD,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAqB;KACzE;IACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;QACf,6EAA6E;QAC7E,yEAAyE;QACzE,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;QACrC,OAAO;YACL,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC;YAC9C,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC;SACzD,CAAC;IACJ,CAAC;CACF,CAAC,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/src/abstract/bls.ts b/node_modules/@noble/curves/src/abstract/bls.ts deleted file mode 100644 index bc575b8..0000000 --- a/node_modules/@noble/curves/src/abstract/bls.ts +++ /dev/null @@ -1,887 +0,0 @@ -/** - * BLS != BLS. - * The file implements BLS (Boneh-Lynn-Shacham) signatures. - * Used in both BLS (Barreto-Lynn-Scott) and BN (Barreto-Naehrig) - * families of pairing-friendly curves. - * Consists of two curves: G1 and G2: - * - G1 is a subgroup of (x, y) E(Fq) over y² = x³ + 4. - * - G2 is a subgroup of ((x₁, x₂+i), (y₁, y₂+i)) E(Fq²) over y² = x³ + 4(1 + i) where i is √-1 - * - Gt, created by bilinear (ate) pairing e(G1, G2), consists of p-th roots of unity in - * Fq^k where k is embedding degree. Only degree 12 is currently supported, 24 is not. - * Pairing is used to aggregate and verify signatures. - * There are two modes of operation: - * - Long signatures: X-byte keys + 2X-byte sigs (G1 keys + G2 sigs). - * - Short signatures: 2X-byte keys + X-byte sigs (G2 keys + G1 sigs). - * @module - **/ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { abytes, notImplemented, randomBytes, type TArg, type TRet } from '../utils.ts'; -import { type CurveLengths } from './curve.ts'; -import { - createHasher, - type H2CDSTOpts, - type H2CHasher, - type H2COpts, - type MapToCurve, -} from './hash-to-curve.ts'; -import { getMinHashLength, mapHashToField, type IField } from './modular.ts'; -import type { Fp12, Fp12Bls, Fp2, Fp2Bls, Fp6Bls } from './tower.ts'; -import { type WeierstrassPoint, type WeierstrassPointCons } from './weierstrass.ts'; - -type Fp = bigint; // Can be different field? - -// prettier-ignore -const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3); - -/** - * Twist convention used by the pairing formulas for a concrete curve family. - * BLS12-381 uses a multiplicative twist, while BN254 uses a divisive one. - */ -export type BlsTwistType = 'multiplicative' | 'divisive'; - -/** - * Codec exposed as `curve.shortSignatures.Signature`. - * Use it to parse or serialize G1 signatures in short-signature mode. - * In this mode, public keys live in G2. - */ -export type BlsShortSignatureCoder = { - /** - * Parse a compressed signature from raw bytes. - * @param bytes - Compressed signature bytes. - * @returns Parsed signature point. - */ - fromBytes(bytes: TArg): WeierstrassPoint; - /** - * Parse a compressed signature from a hex string. - * @param hex - Compressed signature hex string. - * @returns Parsed signature point. - */ - fromHex(hex: string): WeierstrassPoint; - /** - * Encode a signature point into compressed bytes. - * @param point - Signature point. - * @returns Compressed signature bytes. - */ - toBytes(point: WeierstrassPoint): TRet; - /** - * Encode a signature point into a hex string. - * @param point - Signature point. - * @returns Compressed signature hex. - */ - toHex(point: WeierstrassPoint): string; -}; - -/** - * Codec exposed as `curve.longSignatures.Signature`. - * Use it to parse or serialize G2 signatures in long-signature mode. - * In this mode, public keys live in G1. - */ -export type BlsLongSignatureCoder = { - /** - * Parse a compressed signature from raw bytes. - * @param bytes - Compressed signature bytes. - * @returns Parsed signature point. - */ - fromBytes(bytes: TArg): WeierstrassPoint; - /** - * Parse a compressed signature from a hex string. - * @param hex - Compressed signature hex string. - * @returns Parsed signature point. - */ - fromHex(hex: string): WeierstrassPoint; - /** - * Encode a signature point into compressed bytes. - * @param point - Signature point. - * @returns Compressed signature bytes. - */ - toBytes(point: WeierstrassPoint): TRet; - /** - * Encode a signature point into a hex string. - * @param point - Signature point. - * @returns Compressed signature hex. - */ - toHex(point: WeierstrassPoint): string; -}; - -/** Tower fields needed by pairing code, hash-to-curve, and subgroup arithmetic. */ -export type BlsFields = { - /** Base field of G1 coordinates. */ - Fp: IField; - /** Scalar field used for secret scalars and subgroup order arithmetic. */ - Fr: IField; - /** Quadratic extension field used by G2. */ - Fp2: Fp2Bls; - /** Sextic extension field used inside pairing arithmetic. */ - Fp6: Fp6Bls; - /** Degree-12 extension field that contains the GT target group. */ - Fp12: Fp12Bls; -}; - -/** - * Callback used by pairing post-processing hooks to add one more G2 point to the Miller-loop state. - * @param Rx - Current projective X coordinate. - * @param Ry - Current projective Y coordinate. - * @param Rz - Current projective Z coordinate. - * @param Qx - G2 affine x coordinate. - * @param Qy - G2 affine y coordinate. - * @returns Updated projective accumulator coordinates. - */ -export type BlsPostPrecomputePointAddFn = ( - Rx: Fp2, - Ry: Fp2, - Rz: Fp2, - Qx: Fp2, - Qy: Fp2 -) => { Rx: Fp2; Ry: Fp2; Rz: Fp2 }; -/** - * Hook for curve-specific pairing cleanup after the Miller loop precomputes are built. - * @param Rx - Current projective X coordinate. - * @param Ry - Current projective Y coordinate. - * @param Rz - Current projective Z coordinate. - * @param Qx - G2 affine x coordinate. - * @param Qy - G2 affine y coordinate. - * @param pointAdd - Callback used to fold one more point into the accumulator. - */ -export type BlsPostPrecomputeFn = ( - Rx: Fp2, - Ry: Fp2, - Rz: Fp2, - Qx: Fp2, - Qy: Fp2, - pointAdd: BlsPostPrecomputePointAddFn -) => void; -/** Low-level pairing helpers shared by BLS curve bundles. */ -export type BlsPairing = { - /** Byte lengths for keys and signatures exposed by this pairing family. */ - lengths: CurveLengths; - /** Scalar field used by the pairing and signing helpers. */ - Fr: IField; - /** Target field used for the GT result of pairings. */ - Fp12: Fp12Bls; - /** - * Build Miller-loop precomputes for one G2 point. - * @param p - G2 point to precompute. - * @returns Pairing precompute table. - */ - calcPairingPrecomputes: (p: WeierstrassPoint) => Precompute; - /** - * Evaluate a batch of Miller loops from precomputed line coefficients. - * @param pairs - Precomputed Miller-loop inputs. - * @returns Accumulated GT value before or after final exponentiation. - */ - millerLoopBatch: (pairs: [Precompute, Fp, Fp][]) => Fp12; - /** - * Pair one G1 point with one G2 point. - * @param P - G1 point. - * @param Q - G2 point. - * @param withFinalExponent - Whether to apply the final exponentiation step. - * @returns GT pairing result. - * @throws If either point is the point at infinity. {@link Error} - */ - pairing: (P: WeierstrassPoint, Q: WeierstrassPoint, withFinalExponent?: boolean) => Fp12; - /** - * Pair many G1/G2 pairs in one batch. - * @param pairs - Point pairs to accumulate. - * @param withFinalExponent - Whether to apply the final exponentiation step. - * @returns GT pairing result. Empty input returns the multiplicative identity in GT. - */ - pairingBatch: ( - pairs: { g1: WeierstrassPoint; g2: WeierstrassPoint }[], - withFinalExponent?: boolean - ) => Fp12; - /** - * Generate a random secret key for this pairing family. - * @param seed - Optional seed material. - * @returns Secret key bytes. - */ - randomSecretKey: (seed?: TArg) => TRet; -}; - -/** - * Parameters that define the Miller-loop shape and twist handling - * for a concrete pairing family. - */ -export type BlsPairingParams = { - // MSB is always ignored and used as marker for length, otherwise leading zeros will be lost. - // Can be different from `X` (seed) param. - /** Signed loop parameter used by the Miller loop. */ - ateLoopSize: bigint; - /** Whether the signed Miller-loop parameter is negative. */ - xNegative: boolean; - /** - * Twist convention used by the pairing formulas. - * BLS12-381 is multiplicative; BN254 is divisive. - */ - twistType: BlsTwistType; - /** - * Optional RNG override used by helper constructors. - * Receives the requested byte length and returns random bytes. - */ - randomBytes?: (len?: number) => TRet; - /** - * Optional hook for curve-specific untwisting after precomputation. - * Used by BN254 after the Miller loop. - */ - postPrecompute?: BlsPostPrecomputeFn; -}; -/** Hash-to-curve settings shared by the G1 and G2 hashers inside a BLS curve bundle. */ -export type BlsHasherParams = { - /** - * Optional map-to-curve override for G1. - * Receives the hash-to-field tuple and returns one affine G1 point. - */ - mapToG1?: MapToCurve; - /** - * Optional map-to-curve override for G2. - * Receives the hash-to-field tuple and returns one affine G2 point. - */ - mapToG2?: MapToCurve; - /** Shared baseline hash-to-curve options. */ - hasherOpts: H2COpts; - /** G1-specific hash-to-curve options merged on top of `hasherOpts`. */ - hasherOptsG1: H2COpts; - /** G2-specific hash-to-curve options merged on top of `hasherOpts`. */ - hasherOptsG2: H2COpts; -}; -type PrecomputeSingle = [Fp2, Fp2, Fp2][]; -type Precompute = PrecomputeSingle[]; - -/** - * BLS consists of two curves: G1 and G2: - * - G1 is a subgroup of (x, y) E(Fq) over y² = x³ + 4. - * - G2 is a subgroup of ((x₁, x₂+i), (y₁, y₂+i)) E(Fq²) over y² = x³ + 4(1 + i) where i is √-1 - */ -export interface BlsCurvePair { - /** Byte lengths for keys and signatures exposed by this curve family. */ - lengths: CurveLengths; - /** - * Shared Miller-loop batch evaluator. - * @param pairs - Precomputed Miller-loop inputs. - * @returns Accumulated GT value. - */ - millerLoopBatch: BlsPairing['millerLoopBatch']; - /** - * Pair one G1 point with one G2 point. - * @param P - G1 point. - * @param Q - G2 point. - * @param withFinalExponent - Whether to apply the final exponentiation step. - * @returns GT pairing result. - * @throws If either point is the point at infinity. {@link Error} - */ - pairing: BlsPairing['pairing']; - /** - * Pair many G1/G2 pairs in one batch. - * @param pairs - Point pairs to accumulate. - * @param withFinalExponent - Whether to apply the final exponentiation step. - * @returns GT pairing result. Empty input returns the multiplicative identity in GT. - */ - pairingBatch: BlsPairing['pairingBatch']; - /** G1 point constructor for the base field subgroup. */ - G1: { Point: WeierstrassPointCons }; - /** G2 point constructor for the twist subgroup. */ - G2: { Point: WeierstrassPointCons }; - /** Tower fields exposed by the pairing implementation. */ - fields: { - Fp: IField; - Fp2: Fp2Bls; - Fp6: Fp6Bls; - Fp12: Fp12Bls; - Fr: IField; - }; - /** Utility helpers shared by hashers and signers. */ - utils: { - randomSecretKey: (seed?: TArg) => TRet; - calcPairingPrecomputes: BlsPairing['calcPairingPrecomputes']; - }; - /** Public pairing parameters exposed for introspection. */ - params: { - ateLoopSize: bigint; - twistType: BlsTwistType; - }; -} - -/** BLS curve bundle extended with hash-to-curve helpers for G1 and G2. */ -export interface BlsCurvePairWithHashers extends BlsCurvePair { - /** G1 hasher bundle with RFC 9380 helpers. */ - G1: H2CHasher>; - /** G2 hasher bundle with RFC 9380 helpers. */ - G2: H2CHasher>; -} - -/** BLS curve bundle extended with both hashers and signature helpers. */ -export interface BlsCurvePairWithSignatures extends BlsCurvePairWithHashers { - /** Long-signature mode: G1 public keys and G2 signatures. */ - longSignatures: BlsSigs; - /** Short-signature mode: G2 public keys and G1 signatures. */ - shortSignatures: BlsSigs; -} - -type BLSInput = TArg; -/** BLS signer helpers for one signature mode. */ -export interface BlsSigs { - /** Byte lengths for secret keys, public keys, and signatures. */ - lengths: CurveLengths; - /** - * Generate a secret/public key pair for this signature mode. - * @param seed - Optional seed material. - * @returns Secret and public key pair. - */ - keygen(seed?: TArg): { - secretKey: TRet; - publicKey: WeierstrassPoint

; - }; - /** - * Derive the public key from a secret key. - * @param secretKey - Secret key bytes. - * @returns Public-key point. - */ - getPublicKey(secretKey: TArg): WeierstrassPoint

; - /** - * Sign a message already hashed onto the signature subgroup. - * @param hashedMessage - Message mapped to the signature subgroup. - * @param secretKey - Secret key bytes. - * @returns Signature point. - */ - sign(hashedMessage: WeierstrassPoint, secretKey: TArg): WeierstrassPoint; - /** - * Verify one signature against one public key and hashed message. - * @param signature - Signature point or encoded signature. - * @param message - Hashed message point. - * @param publicKey - Public-key point or encoded key. - * @returns Whether the signature is valid. - */ - verify( - signature: WeierstrassPoint | BLSInput, - message: WeierstrassPoint, - publicKey: WeierstrassPoint

| BLSInput - ): boolean; - /** - * Verify one aggregated signature against many `(message, publicKey)` pairs. - * @param signature - Aggregated signature. - * @param items - Message/public-key pairs. - * @returns Whether the aggregated signature is valid. Same-message aggregate verification still - * requires proof of possession or another rogue-key defense from the caller. - */ - verifyBatch: ( - signature: WeierstrassPoint | BLSInput, - items: { message: WeierstrassPoint; publicKey: WeierstrassPoint

| BLSInput }[] - ) => boolean; - /** - * Add many public keys into one aggregate point. - * @param publicKeys - Public keys to aggregate. - * @returns Aggregated public-key point. This is raw point addition and does not add proof of - * possession or rogue-key protection on its own. - */ - aggregatePublicKeys(publicKeys: (WeierstrassPoint

| BLSInput)[]): WeierstrassPoint

; - /** - * Add many signatures into one aggregate point. - * @param signatures - Signatures to aggregate. - * @returns Aggregated signature point. This is raw point addition and does not change the proof - * of possession requirements of the aggregate-verification scheme. - */ - aggregateSignatures(signatures: (WeierstrassPoint | BLSInput)[]): WeierstrassPoint; - /** - * Hash an arbitrary message onto the signature subgroup. - * @param message - Message bytes. - * @param DST - Optional domain separation tag. - * @returns Curve point on the signature subgroup. - */ - hash(message: TArg, DST?: TArg): WeierstrassPoint; - /** Signature codec for this mode. */ - Signature: BlsLongSignatureCoder; -} - -// Signed non-adjacent decomposition of the spec-defined Miller-loop parameter. -// BN254 benefits most because `6x+2` has multiple adjacent `11` runs, but BLS12-381's -// stored `|x|` still starts with `11`, so the Miller loop must also handle one `-1` digit there. -function NAfDecomposition(a: bigint) { - const res = []; - // a>1 because of marker bit - for (; a > _1n; a >>= _1n) { - if ((a & _1n) === _0n) res.unshift(0); - else if ((a & _3n) === _3n) { - res.unshift(-1); - a += _1n; - } else res.unshift(1); - } - return res; -} -function aNonEmpty(arr: any[]) { - // Aggregate helpers use this to reject empty variable-length inputs consistently. - // Without the guard, each caller would fall through into a different empty-input / identity - // case and hide missing inputs behind outputs that still look structurally valid. - if (!Array.isArray(arr) || arr.length === 0) throw new Error('expected non-empty array'); -} - -// This should be enough for bn254, no need to export full stuff? -function createBlsPairing( - fields: TArg, - G1: WeierstrassPointCons, - G2: WeierstrassPointCons, - params: TArg -): BlsPairing { - const { Fr, Fp2, Fp12 } = fields; - const { twistType, ateLoopSize, xNegative, postPrecompute } = params; - type G1 = typeof G1.BASE; - type G2 = typeof G2.BASE; - // Applies sparse multiplication as line function - let lineFunction: (c0: Fp2, c1: Fp2, c2: Fp2, f: Fp12, Px: Fp, Py: Fp) => Fp12; - if (twistType === 'multiplicative') { - lineFunction = (c0: Fp2, c1: Fp2, c2: Fp2, f: Fp12, Px: Fp, Py: Fp) => - Fp12.mul014(f, c0, Fp2.mul(c1, Px), Fp2.mul(c2, Py)); - } else if (twistType === 'divisive') { - // NOTE: it should be [c0, c1, c2], but we use different order here to reduce complexity of - // precompute calculations. - lineFunction = (c0: Fp2, c1: Fp2, c2: Fp2, f: Fp12, Px: Fp, Py: Fp) => - Fp12.mul034(f, Fp2.mul(c2, Py), Fp2.mul(c1, Px), c0); - } else throw new Error('bls: unknown twist type'); - - const Fp2div2 = Fp2.div(Fp2.ONE, Fp2.mul(Fp2.ONE, _2n)); - function pointDouble(ell: PrecomputeSingle, Rx: Fp2, Ry: Fp2, Rz: Fp2) { - const t0 = Fp2.sqr(Ry); // Ry² - const t1 = Fp2.sqr(Rz); // Rz² - const t2 = Fp2.mulByB(Fp2.mul(t1, _3n)); // 3 * T1 * B - const t3 = Fp2.mul(t2, _3n); // 3 * T2 - const t4 = Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(Ry, Rz)), t1), t0); // (Ry + Rz)² - T1 - T0 - const c0 = Fp2.sub(t2, t0); // T2 - T0 (i) - const c1 = Fp2.mul(Fp2.sqr(Rx), _3n); // 3 * Rx² - const c2 = Fp2.neg(t4); // -T4 (-h) - - ell.push([c0, c1, c2]); - - Rx = Fp2.mul(Fp2.mul(Fp2.mul(Fp2.sub(t0, t3), Rx), Ry), Fp2div2); // ((T0 - T3) * Rx * Ry) / 2 - // ((T0 + T3) / 2)² - 3 * T2² - Ry = Fp2.sub(Fp2.sqr(Fp2.mul(Fp2.add(t0, t3), Fp2div2)), Fp2.mul(Fp2.sqr(t2), _3n)); - Rz = Fp2.mul(t0, t4); // T0 * T4 - return { Rx, Ry, Rz }; - } - function pointAdd(ell: PrecomputeSingle, Rx: Fp2, Ry: Fp2, Rz: Fp2, Qx: Fp2, Qy: Fp2) { - // Addition - const t0 = Fp2.sub(Ry, Fp2.mul(Qy, Rz)); // Ry - Qy * Rz - const t1 = Fp2.sub(Rx, Fp2.mul(Qx, Rz)); // Rx - Qx * Rz - const c0 = Fp2.sub(Fp2.mul(t0, Qx), Fp2.mul(t1, Qy)); // T0 * Qx - T1 * Qy == Ry * Qx - Rx * Qy - const c1 = Fp2.neg(t0); // -T0 == Qy * Rz - Ry - const c2 = t1; // == Rx - Qx * Rz - - ell.push([c0, c1, c2]); - - const t2 = Fp2.sqr(t1); // T1² - const t3 = Fp2.mul(t2, t1); // T2 * T1 - const t4 = Fp2.mul(t2, Rx); // T2 * Rx - // T3 - 2 * T4 + T0² * Rz - const t5 = Fp2.add(Fp2.sub(t3, Fp2.mul(t4, _2n)), Fp2.mul(Fp2.sqr(t0), Rz)); - Rx = Fp2.mul(t1, t5); // T1 * T5 - Ry = Fp2.sub(Fp2.mul(Fp2.sub(t4, t5), t0), Fp2.mul(t3, Ry)); // (T4 - T5) * T0 - T3 * Ry - Rz = Fp2.mul(Rz, t3); // Rz * T3 - return { Rx, Ry, Rz }; - } - - // Pre-compute coefficients for sparse multiplication - // Point addition and point double calculations is reused for coefficients - // pointAdd happens only if bit set, so wNAF is reasonable. Unfortunately we cannot combine - // add + double in windowed precomputes here, otherwise it would be single op (since X is static) - const ATE_NAF = NAfDecomposition(ateLoopSize); - - const calcPairingPrecomputes = (point: G2) => { - const p = point; - const { x, y } = p.toAffine(); - // prettier-ignore - const Qx = x, Qy = y, negQy = Fp2.neg(y); - // prettier-ignore - let Rx = Qx, Ry = Qy, Rz = Fp2.ONE; - const ell: Precompute = []; - for (const bit of ATE_NAF) { - const cur: PrecomputeSingle = []; - ({ Rx, Ry, Rz } = pointDouble(cur, Rx, Ry, Rz)); - if (bit) ({ Rx, Ry, Rz } = pointAdd(cur, Rx, Ry, Rz, Qx, bit === -1 ? negQy : Qy)); - ell.push(cur); - } - if (postPrecompute) { - const last = ell[ell.length - 1]; - postPrecompute(Rx, Ry, Rz, Qx, Qy, pointAdd.bind(null, last)); - } - return ell; - }; - - // Main pairing logic is here. Computes product of miller loops + final exponentiate - // Applies calculated precomputes - type MillerInput = [Precompute, Fp, Fp][]; - function millerLoopBatch(pairs: MillerInput, withFinalExponent: boolean = false) { - let f12 = Fp12.ONE; - if (pairs.length) { - const ellLen = pairs[0][0].length; - for (let i = 0; i < ellLen; i++) { - f12 = Fp12.sqr(f12); // This allows us to do sqr only one time for all pairings - // NOTE: we apply multiple pairings in parallel here - for (const [ell, Px, Py] of pairs) { - for (const [c0, c1, c2] of ell[i]) f12 = lineFunction(c0, c1, c2, f12, Px, Py); - } - } - } - if (xNegative) f12 = Fp12.conjugate(f12); - return withFinalExponent ? Fp12.finalExponentiate(f12) : f12; - } - type PairingInput = { g1: G1; g2: G2 }; - // Calculates product of multiple pairings - // This up to x2 faster than just `map(({g1, g2})=>pairing({g1,g2}))` - function pairingBatch(pairs: PairingInput[], withFinalExponent: boolean = true) { - const res: MillerInput = []; - for (const { g1, g2 } of pairs) { - // Mathematically, a zero pairing term contributes GT.ONE. We still reject it here because - // this API mainly backs BLS verification, where ZERO inputs usually mean broken hash / - // wiring. Silently skipping them would turn those failures into a neutral pairing product. - // Callers that want the algebraic neutral-element behavior can filter ZERO terms first. - if (g1.is0() || g2.is0()) throw new Error('pairing is not available for ZERO point'); - // This uses toAffine inside - g1.assertValidity(); - g2.assertValidity(); - const Qa = g1.toAffine(); - res.push([calcPairingPrecomputes(g2), Qa.x, Qa.y]); - } - return millerLoopBatch(res, withFinalExponent); - } - // Calculates bilinear pairing - function pairing(Q: G1, P: G2, withFinalExponent: boolean = true): Fp12 { - return pairingBatch([{ g1: Q, g2: P }], withFinalExponent); - } - const lengths = { - seed: getMinHashLength(Fr.ORDER), - }; - const rand = params.randomBytes === undefined ? randomBytes : params.randomBytes; - // Seeded calls deterministically reduce exactly `lengths.seed` bytes into `1..Fr.ORDER-1`; - // omitting `seed` just fills that input buffer from the configured RNG first. - const randomSecretKey = (seed?: TArg): TRet => { - seed = seed === undefined ? rand(lengths.seed) : seed; - abytes(seed, lengths.seed, 'seed'); - return mapHashToField(seed, Fr.ORDER) as TRet; - }; - Object.freeze(lengths); - return { - lengths, - Fr, - Fp12, // NOTE: we re-export Fp12 here because pairing results are Fp12! - millerLoopBatch, - pairing, - pairingBatch, - calcPairingPrecomputes, - randomSecretKey, - }; -} - -function createBlsSig( - blsPairing: BlsPairing, - PubPoint: WeierstrassPointCons

, - SigPoint: WeierstrassPointCons, - isSigG1: boolean, - hashToSigCurve: (msg: TArg, options?: TArg) => WeierstrassPoint, - SignatureCoder?: BlsLongSignatureCoder -): BlsSigs { - const { Fr, Fp12, pairingBatch, randomSecretKey, lengths } = blsPairing; - if (!SignatureCoder) { - SignatureCoder = { - fromBytes: notImplemented, - fromHex: notImplemented, - toBytes: notImplemented, - toHex: notImplemented, - }; - } - type PubPoint = WeierstrassPoint

; - type SigPoint = WeierstrassPoint; - function normPub(point: PubPoint | BLSInput): PubPoint { - return point instanceof PubPoint ? (point as PubPoint) : PubPoint.fromBytes(point); - } - function normSig(point: SigPoint | BLSInput): SigPoint { - return point instanceof SigPoint ? (point as SigPoint) : SigPoint.fromBytes(point); - } - // Sign/verify here take points already hashed onto the signature subgroup. - // Raw bytes and points from the other subgroup must fail this constructor-brand - // check before later validity checks run. - function amsg(m: unknown): SigPoint { - if (!(m instanceof SigPoint)) - throw new Error(`expected valid message hashed to ${!isSigG1 ? 'G2' : 'G1'} curve`); - return m as SigPoint; - } - - type G1 = WeierstrassPoint; - type G2 = WeierstrassPoint; - type PairingInput = { g1: G1; g2: G2 }; - // What matters here is what point pairing API accepts as G1 or G2, not actual size or names - const pair: (a: PubPoint, b: SigPoint) => PairingInput = !isSigG1 - ? (a: PubPoint, b: SigPoint) => ({ g1: a, g2: b }) as PairingInput - : (a: PubPoint, b: SigPoint) => ({ g1: b, g2: a }) as PairingInput; - return Object.freeze({ - lengths: Object.freeze({ ...lengths, secretKey: Fr.BYTES }), - keygen(seed?: TArg) { - const secretKey = randomSecretKey(seed); - const publicKey = this.getPublicKey(secretKey); - return { secretKey, publicKey }; - }, - // P = pk x G - getPublicKey(secretKey: TArg): PubPoint { - let sec; - try { - sec = PubPoint.Fn.fromBytes(secretKey); - } catch (error) { - // @ts-ignore - throw new Error('invalid private key: ' + typeof secretKey, { cause: error }); - } - return PubPoint.BASE.multiply(sec); - }, - // S = pk x H(m) - sign(message: SigPoint, secretKey: TArg, unusedArg?: any): SigPoint { - if (unusedArg != null) throw new Error('sign() expects 2 arguments'); - const sec = PubPoint.Fn.fromBytes(secretKey); - amsg(message).assertValidity(); - return message.multiply(sec); - }, - // Checks if pairing of public key & hash is equal to pairing of generator & signature. - // e(P, H(m)) == e(G, S) - // e(S, G) == e(H(m), P) - verify( - signature: SigPoint | BLSInput, - message: SigPoint, - publicKey: PubPoint | BLSInput, - unusedArg?: any - ): boolean { - if (unusedArg != null) throw new Error('verify() expects 3 arguments'); - signature = normSig(signature); - publicKey = normPub(publicKey); - const P = publicKey.negate(); - const G = PubPoint.BASE; - const Hm = amsg(message); - const S = signature; - // This code was changed in 1.9.x: - // Before it was G.negate() in G2, now it's always pubKey.negate - // e(P, -Q)===e(-P, Q)==e(P, Q)^-1. Negate can be done anywhere (as long it is done once per pair). - // We just moving sign, but since pairing is multiplicative, we doing X * X^-1 = 1 - try { - const exp = pairingBatch([pair(P, Hm), pair(G, S)]); - return Fp12.eql(exp, Fp12.ONE); - } catch { - return false; - } - }, - // https://ethresear.ch/t/fast-verification-of-multiple-bls-signatures/5407 - // e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si)) - // TODO: maybe `{message: G2Hex, publicKey: G1Hex}[]` instead? - verifyBatch( - signature: SigPoint | BLSInput, - items: { message: SigPoint; publicKey: PubPoint | BLSInput }[] - ): boolean { - aNonEmpty(items); - const sig = normSig(signature); - const nMessages = items.map((i) => i.message); - const nPublicKeys = items.map((i) => normPub(i.publicKey)); - // NOTE: this works only for exact same object - const messagePubKeyMap = new Map(); - for (let i = 0; i < nPublicKeys.length; i++) { - const pub = nPublicKeys[i]; - const msg = nMessages[i]; - let keys = messagePubKeyMap.get(msg); - if (keys === undefined) { - keys = []; - messagePubKeyMap.set(msg, keys); - } - keys.push(pub); - } - const paired = []; - const G = PubPoint.BASE; - try { - for (const [msg, keys] of messagePubKeyMap) { - const groupPublicKey = keys.reduce((acc, msg) => acc.add(msg)); - paired.push(pair(groupPublicKey, msg)); - } - paired.push(pair(G.negate(), sig)); - return Fp12.eql(pairingBatch(paired), Fp12.ONE); - } catch { - return false; - } - }, - // Adds a bunch of public key points together. - // pk1 + pk2 + pk3 = pkA - aggregatePublicKeys(publicKeys: (PubPoint | BLSInput)[]): PubPoint { - aNonEmpty(publicKeys); - publicKeys = publicKeys.map((pub) => normPub(pub)); - const agg = (publicKeys as PubPoint[]).reduce((sum, p) => sum.add(p), PubPoint.ZERO); - agg.assertValidity(); - return agg; - }, - - // Adds a bunch of signature points together. - // pk1 + pk2 + pk3 = pkA - aggregateSignatures(signatures: (SigPoint | BLSInput)[]): SigPoint { - aNonEmpty(signatures); - signatures = signatures.map((sig) => normSig(sig)); - const agg = (signatures as SigPoint[]).reduce((sum, s) => sum.add(s), SigPoint.ZERO); - agg.assertValidity(); - return agg; - }, - - hash(messageBytes: TArg, DST?: TArg): SigPoint { - abytes(messageBytes); - const opts = DST ? { DST } : undefined; - return hashToSigCurve(messageBytes, opts); - }, - Signature: Object.freeze({ ...SignatureCoder }), - }) /*satisfies Signer */; -} - -type BlsSignatureCoders = Partial<{ - LongSignature: BlsLongSignatureCoder; - ShortSignature: BlsShortSignatureCoder; -}>; - -// NOTE: separate function instead of function override, so we don't depend on hasher in bn254. -/** - * @param fields - Tower field implementations. - * @param G1_Point - G1 point constructor. - * @param G2_Point - G2 point constructor. - * @param params - Pairing parameters. See {@link BlsPairingParams}. - * @returns Pairing-only BLS helpers. The returned pairing surface rejects infinity inputs, while - * empty `pairingBatch(...)` calls return the multiplicative identity in GT. This keeps the - * low-level pairing API fail-closed for BLS-style callers, where identity points usually signal - * broken hash / wiring instead of an intentionally neutral pairing term. This also eagerly - * precomputes the G1 base-point table as a performance side effect. - * @throws If the pairing parameters or underlying curve helpers are inconsistent. {@link Error} - * @example - * ```ts - * import { blsBasic } from '@noble/curves/abstract/bls.js'; - * import { bn254 } from '@noble/curves/bn254.js'; - * // Pair a G1 point with a G2 point without the higher-level signer helpers. - * const gt = bn254.pairing(bn254.G1.Point.BASE, bn254.G2.Point.BASE); - * ``` - */ -export function blsBasic( - fields: TArg, - G1_Point: WeierstrassPointCons, - G2_Point: WeierstrassPointCons, - params: TArg -): BlsCurvePair { - // Fields are specific for curve, so for now we'll need to pass them with opts - const { Fp, Fr, Fp2, Fp6, Fp12 } = fields; - // Point on G1 curve: (x, y) - // const G1_Point = weierstrass(CURVE.G1, { Fn: Fr }); - const G1 = { Point: G1_Point }; - // Point on G2 curve (complex numbers): (x₁, x₂+i), (y₁, y₂+i) - const G2 = { Point: G2_Point }; - - const pairingRes = createBlsPairing(fields, G1_Point, G2_Point, params); - const { - millerLoopBatch, - pairing, - pairingBatch, - calcPairingPrecomputes, - randomSecretKey, - lengths, - } = pairingRes; - - G1.Point.BASE.precompute(4); - Object.freeze(G1); - Object.freeze(G2); - return Object.freeze({ - lengths: Object.freeze(lengths), - millerLoopBatch, - pairing, - pairingBatch, - G1, - G2, - fields: Object.freeze({ Fr, Fp, Fp2, Fp6, Fp12 }), - params: Object.freeze({ - ateLoopSize: params.ateLoopSize, - twistType: params.twistType, - }), - utils: Object.freeze({ - randomSecretKey, - calcPairingPrecomputes, - }), - }); -} - -// We can export this too, but seems there is not much reasons for now? If user wants hasher, they can just create hasher. -function blsHashers( - fields: TArg, - G1_Point: WeierstrassPointCons, - G2_Point: WeierstrassPointCons, - params: TArg, - hasherParams: TArg -): BlsCurvePairWithHashers { - const base = blsBasic(fields, G1_Point, G2_Point, params); - // Missing map hooks intentionally fail closed via notImplemented on first hash use. - const G1Hasher = createHasher( - G1_Point, - hasherParams.mapToG1 === undefined ? notImplemented : hasherParams.mapToG1, - { - ...hasherParams.hasherOpts, - ...hasherParams.hasherOptsG1, - } - ); - const G2Hasher = createHasher( - G2_Point, - hasherParams.mapToG2 === undefined ? notImplemented : hasherParams.mapToG2, - { - ...hasherParams.hasherOpts, - ...hasherParams.hasherOptsG2, - } - ); - return Object.freeze({ ...base, G1: G1Hasher, G2: G2Hasher }); -} - -// G1_Point: ProjConstructor, G2_Point: ProjConstructor, -// Rename to blsSignatures? -/** - * @param fields - Tower field implementations. - * @param G1_Point - G1 point constructor. - * @param G2_Point - G2 point constructor. - * @param params - Pairing parameters. See {@link BlsPairingParams}. - * @param hasherParams - Hash-to-curve configuration. See {@link BlsHasherParams}. - * @param signatureCoders - Signature codecs. - * @returns BLS helpers with signers. The inherited pairing surface still rejects infinity inputs, - * and empty `pairingBatch(...)` calls still return the multiplicative identity in GT. Aggregate - * verification still requires proof of possession or another rogue-key defense from the caller. - * @throws If the pairing, hashing, or signature helpers are configured inconsistently. {@link Error} - * @example - * ```ts - * import { bls } from '@noble/curves/abstract/bls.js'; - * import { bls12_381 } from '@noble/curves/bls12-381.js'; - * const sigs = bls12_381.longSignatures; - * // Use the full BLS helper set when you need hashing, keygen, signing, and verification. - * const { secretKey, publicKey } = sigs.keygen(); - * const msg = sigs.hash(new TextEncoder().encode('hello noble')); - * const sig = sigs.sign(msg, secretKey); - * const isValid = sigs.verify(sig, msg, publicKey); - * ``` - */ -export function bls( - fields: TArg, - G1_Point: WeierstrassPointCons, - G2_Point: WeierstrassPointCons, - params: TArg, - hasherParams: TArg, - signatureCoders: BlsSignatureCoders -): BlsCurvePairWithSignatures { - const base = blsHashers(fields, G1_Point, G2_Point, params, hasherParams); - const pairingRes: BlsPairing = { - ...base, - Fr: base.fields.Fr, - Fp12: base.fields.Fp12, - calcPairingPrecomputes: base.utils.calcPairingPrecomputes, - randomSecretKey: base.utils.randomSecretKey, - }; - const longSignatures = createBlsSig( - pairingRes, - G1_Point, - G2_Point, - false, - base.G2.hashToCurve, - signatureCoders?.LongSignature - ); - const shortSignatures = createBlsSig( - pairingRes, - G2_Point, - G1_Point, - true, - base.G1.hashToCurve, - signatureCoders?.ShortSignature - ); - return Object.freeze({ ...base, longSignatures, shortSignatures }); -} diff --git a/node_modules/@noble/curves/src/abstract/curve.ts b/node_modules/@noble/curves/src/abstract/curve.ts deleted file mode 100644 index c65e71d..0000000 --- a/node_modules/@noble/curves/src/abstract/curve.ts +++ /dev/null @@ -1,916 +0,0 @@ -/** - * Methods for elliptic curve multiplication by scalars. - * Contains wNAF, pippenger. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { bitLen, bitMask, validateObject, type Signer, type TArg, type TRet } from '../utils.ts'; -import { Field, FpInvertBatch, validateField, type IField } from './modular.ts'; - -const _0n = /* @__PURE__ */ BigInt(0); -const _1n = /* @__PURE__ */ BigInt(1); - -/** Affine point coordinates without projective fields. */ -export type AffinePoint = { - /** Affine x coordinate. */ - x: T; - /** Affine y coordinate. */ - y: T; -} & { Z?: never }; - -// We can't "abstract out" coordinates (X, Y, Z; and T in Edwards): argument names of constructor -// are not accessible. See Typescript gh-56093, gh-41594. -// -// We have to use recursive types, so it will return actual point, not constained `CurvePoint`. -// If, at any point, P is `any`, it will erase all types and replace it -// with `any`, because of recursion, `any implements CurvePoint`, -// but we lose all constrains on methods. - -/** Base interface for all elliptic-curve point instances. */ -export interface CurvePoint> { - /** Affine x coordinate. Different from projective / extended X coordinate. */ - x: F; - /** Affine y coordinate. Different from projective / extended Y coordinate. */ - y: F; - /** Projective Z coordinate when the point keeps projective state. */ - Z?: F; - /** - * Double the point. - * @returns Doubled point. - */ - double(): P; - /** - * Negate the point. - * @returns Negated point. - */ - negate(): P; - /** - * Add another point from the same curve. - * @param other - Point to add. - * @returns Sum point. - */ - add(other: P): P; - /** - * Subtract another point from the same curve. - * @param other - Point to subtract. - * @returns Difference point. - */ - subtract(other: P): P; - /** - * Compare two points for equality. - * @param other - Point to compare. - * @returns Whether the points are equal. - */ - equals(other: P): boolean; - /** - * Multiply the point by a scalar in constant time. - * Implementations keep the subgroup-scalar contract strict and may reject - * `0` instead of returning the identity point. - * @param scalar - Scalar multiplier. - * @returns Product point. - */ - multiply(scalar: bigint): P; - /** Assert that the point satisfies the curve equation and subgroup checks. */ - assertValidity(): void; - /** - * Map the point into the prime-order subgroup when the curve requires it. - * @returns Prime-order point. - */ - clearCofactor(): P; - /** - * Check whether the point is the point at infinity. - * @returns Whether the point is zero. - */ - is0(): boolean; - /** - * Check whether the point belongs to the prime-order subgroup. - * @returns Whether the point is torsion-free. - */ - isTorsionFree(): boolean; - /** - * Check whether the point lies in a small torsion subgroup. - * @returns Whether the point has small order. - */ - isSmallOrder(): boolean; - /** - * Multiply the point by a scalar without constant-time guarantees. - * Public-scalar callers that need `0` should use this method instead of - * relying on `multiply(...)` to return the identity point. - * @param scalar - Scalar multiplier. - * @returns Product point. - */ - multiplyUnsafe(scalar: bigint): P; - /** - * Massively speeds up `p.multiply(n)` by using precompute tables (caching). See {@link wNAF}. - * Cache state lives in internal WeakMaps keyed by point identity, not on the point object. - * Repeating `precompute(...)` for the same point identity replaces the remembered window size - * and forces table regeneration for that point. - * @param windowSize - Precompute window size. - * @param isLazy - calculate cache now. Default (true) ensures it's deferred to first `multiply()` - * @returns Same point instance with precompute tables attached. - */ - precompute(windowSize?: number, isLazy?: boolean): P; - /** - * Converts point to 2D xy affine coordinates. - * @param invertedZ - Optional inverted Z coordinate for batch normalization. - * @returns Affine x/y coordinates. - */ - toAffine(invertedZ?: F): AffinePoint; - /** - * Encode the point into the curve's canonical byte form. - * @returns Encoded point bytes. - */ - toBytes(): Uint8Array; - /** - * Encode the point into the curve's canonical hex form. - * @returns Encoded point hex. - */ - toHex(): string; -} - -/** Base interface for elliptic-curve point constructors. */ -export interface CurvePointCons

> { - /** - * Runtime brand check for points created by this constructor. - * @param item - Value to test. - * @returns Whether the value is a point from this constructor. - */ - [Symbol.hasInstance]: (item: unknown) => boolean; - /** Canonical subgroup generator. */ - BASE: P; - /** Point at infinity. */ - ZERO: P; - /** Field for basic curve math */ - Fp: IField>; - /** Scalar field, for scalars in multiply and others */ - Fn: IField; - /** - * Create one point from affine coordinates. - * Does NOT validate curve, subgroup, or wrapper invariants. - * Use `.assertValidity()` on adversarial inputs. - * @param p - Affine point coordinates. - * @returns Point instance. - */ - fromAffine(p: AffinePoint>): P; - /** - * Decode a point from the canonical byte encoding. - * @param bytes - Encoded point bytes. - * Implementations MUST treat `bytes` as read-only. - * @returns Point instance. - */ - fromBytes(bytes: Uint8Array): P; - /** - * Decode a point from the canonical hex encoding. - * @param hex - Encoded point hex. - * @returns Point instance. - */ - fromHex(hex: string): P; -} - -// Type inference helpers: PC - PointConstructor, P - Point, Fp - Field element -// Short names, because we use them a lot in result types: -// * we can't do 'P = GetCurvePoint': this is default value and doesn't constrain anything -// * we can't do 'type X = GetCurvePoint': it won't be accesible for arguments/return types -// * `CurvePointCons

>` constraints from interface definition -// won't propagate, if `PC extends CurvePointCons`: the P would be 'any', which is incorrect -// * PC could be super specific with super specific P, which implements CurvePoint. -// this means we need to do stuff like -// `function test

, PC extends CurvePointCons

>(` -// if we want type safety around P, otherwise PC_P will be any - -/** Returns the affine field type for a point instance (`P_F

== P.F`). */ -export type P_F

> = P extends CurvePoint ? F : never; -/** Returns the affine field type for a point constructor (`PC_F == PC.P.F`). */ -export type PC_F>> = PC['Fp']['ZERO']; -/** Returns the point instance type for a point constructor (`PC_P == PC.P`). */ -export type PC_P>> = PC['ZERO']; - -// Ugly hack to get proper type inference, because in typescript fails to infer resursively. -// The hack allows to do up to 10 chained operations without applying type erasure. -// -// Types which won't work: -// * `CurvePointCons>`, will return `any` after 1 operation -// * `CurvePointCons: WeierstrassPointCons extends CurvePointCons = false` -// * `P extends CurvePoint, PC extends CurvePointCons

` -// * It can't infer P from PC alone -// * Too many relations between F, P & PC -// * It will infer P/F if `arg: CurvePointCons`, but will fail if PC is generic -// * It will work correctly if there is an additional argument of type P -// * But generally, we don't want to parametrize `CurvePointCons` over `F`: it will complicate -// types, making them un-inferable -// prettier-ignore -/** Wide point-constructor type used when the concrete curve is not important. */ -export type PC_ANY = CurvePointCons< - CurvePoint - >>>>>>>>> ->; - -/** - * Validates the static surface of a point constructor. - * This is only a cheap sanity check for the constructor hooks and fields consumed by generic - * factories; it does not certify `BASE`/`ZERO` semantics or prove the curve implementation itself. - * @param Point - Runtime point constructor. - * @throws On missing constructor hooks or malformed field metadata. {@link TypeError} - * @example - * Check that one point constructor exposes the static hooks generic helpers need. - * - * ```ts - * import { ed25519 } from '@noble/curves/ed25519.js'; - * import { validatePointCons } from '@noble/curves/abstract/curve.js'; - * validatePointCons(ed25519.Point); - * ``` - */ -export function validatePointCons

>(Point: CurvePointCons

): void { - const pc = Point as unknown as CurvePointCons; - if (typeof (pc as unknown) !== 'function') throw new TypeError('Point must be a constructor'); - // validateObject only accepts plain objects, so copy the constructor statics into one bag first. - validateObject( - { - Fp: pc.Fp, - Fn: pc.Fn, - fromAffine: pc.fromAffine, - fromBytes: pc.fromBytes, - fromHex: pc.fromHex, - }, - { - Fp: 'object', - Fn: 'object', - fromAffine: 'function', - fromBytes: 'function', - fromHex: 'function', - } - ); - validateField(pc.Fp); - validateField(pc.Fn); -} - -/** Byte lengths used by one curve implementation. */ -export interface CurveLengths { - /** Secret-key length in bytes. */ - secretKey?: number; - /** Compressed public-key length in bytes. */ - publicKey?: number; - /** Uncompressed public-key length in bytes. */ - publicKeyUncompressed?: number; - /** Whether public-key encodings include a format prefix byte. */ - publicKeyHasPrefix?: boolean; - /** Signature length in bytes. */ - signature?: number; - /** Seed length in bytes when the curve exposes deterministic keygen from seed. */ - seed?: number; -} - -/** Reorders or otherwise remaps a batch while preserving its element type. */ -export type Mapper = (i: T[]) => T[]; - -/** - * Computes both candidates first, but the final selection still branches on `condition`, so this - * is not a strict constant-time CMOV primitive. - * @param condition - Whether to negate the point. - * @param item - Point-like value. - * @returns Original or negated value. - * @example - * Keep the point or return its negation based on one boolean branch. - * - * ```ts - * import { negateCt } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const maybeNegated = negateCt(true, p256.Point.BASE); - * ``` - */ -export function negateCt T }>(condition: boolean, item: T): T { - const neg = item.negate(); - return condition ? neg : item; -} - -/** - * Takes a bunch of Projective Points but executes only one - * inversion on all of them. Inversion is very slow operation, - * so this improves performance massively. - * Optimization: converts a list of projective points to a list of identical points with Z=1. - * Input points are left unchanged; the normalized points are returned as fresh instances. - * @param c - Point constructor. - * @param points - Projective points. - * @returns Fresh projective points reconstructed from normalized affine coordinates. - * @example - * Batch-normalize projective points with a single shared inversion. - * - * ```ts - * import { normalizeZ } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const points = normalizeZ(p256.Point, [p256.Point.BASE, p256.Point.BASE.double()]); - * ``` - */ -export function normalizeZ

, PC extends CurvePointCons

>( - c: PC, - points: P[] -): P[] { - const invertedZs = FpInvertBatch( - c.Fp, - points.map((p) => p.Z!) - ); - return points.map((p, i) => c.fromAffine(p.toAffine(invertedZs[i]))); -} - -function validateW(W: number, bits: number) { - if (!Number.isSafeInteger(W) || W <= 0 || W > bits) - throw new Error('invalid window size, expected [1..' + bits + '], got W=' + W); -} - -/** Internal wNAF opts for specific W and scalarBits. - * Zero digits are skipped, so tables store only the positive half-window and callers reserve one - * extra carry window. - */ -type WOpts = { - windows: number; - windowSize: number; - mask: bigint; - maxNumber: number; - shiftBy: bigint; -}; - -function calcWOpts(W: number, scalarBits: number): WOpts { - validateW(W, scalarBits); - const windows = Math.ceil(scalarBits / W) + 1; // W=8 33. Not 32, because we skip zero - const windowSize = 2 ** (W - 1); // W=8 128. Not 256, because we skip zero - const maxNumber = 2 ** W; // W=8 256 - const mask = bitMask(W); // W=8 255 == mask 0b11111111 - const shiftBy = BigInt(W); // W=8 8 - return { windows, windowSize, mask, maxNumber, shiftBy }; -} - -function calcOffsets(n: bigint, window: number, wOpts: WOpts) { - const { windowSize, mask, maxNumber, shiftBy } = wOpts; - let wbits = Number(n & mask); // extract W bits. - let nextN = n >> shiftBy; // shift number by W bits. - - // What actually happens here: - // const highestBit = Number(mask ^ (mask >> 1n)); - // let wbits2 = wbits - 1; // skip zero - // if (wbits2 & highestBit) { wbits2 ^= Number(mask); // (~); - - // split if bits > max: +224 => 256-32 - if (wbits > windowSize) { - // we skip zero, which means instead of `>= size-1`, we do `> size` - wbits -= maxNumber; // -32, can be maxNumber - wbits, but then we need to set isNeg here. - nextN += _1n; // +256 (carry) - } - const offsetStart = window * windowSize; - const offset = offsetStart + Math.abs(wbits) - 1; // -1 because we skip zero; ignore when isZero - const isZero = wbits === 0; // is current window slice a 0? - const isNeg = wbits < 0; // is current window slice negative? - const isNegF = window % 2 !== 0; // fake branch noise only - const offsetF = offsetStart; // fake branch noise only - return { nextN, offset, isZero, isNeg, isNegF, offsetF }; -} - -function validateMSMPoints(points: any[], c: any) { - if (!Array.isArray(points)) throw new Error('array expected'); - points.forEach((p, i) => { - if (!(p instanceof c)) throw new Error('invalid point at index ' + i); - }); -} -function validateMSMScalars(scalars: any[], field: any) { - if (!Array.isArray(scalars)) throw new Error('array of scalars expected'); - scalars.forEach((s, i) => { - if (!field.isValid(s)) throw new Error('invalid scalar at index ' + i); - }); -} - -// Since points in different groups cannot be equal (different object constructor), -// we can have single place to store precomputes. -// Allows to make points frozen / immutable. -const pointPrecomputes = new WeakMap(); -const pointWindowSizes = new WeakMap(); - -function getW(P: any): number { - // To disable precomputes: - // return 1; - // `1` is also the uncached sentinel: use the ladder / non-precomputed path. - return pointWindowSizes.get(P) || 1; -} - -function assert0(n: bigint): void { - // Internal invariant: a non-zero remainder here means the wNAF window decomposition or loop - // count is inconsistent, not that the original caller provided a bad scalar. - if (n !== _0n) throw new Error('invalid wNAF'); -} - -/** - * Elliptic curve multiplication of Point by scalar. Fragile. - * Table generation takes **30MB of ram and 10ms on high-end CPU**, - * but may take much longer on slow devices. Actual generation will happen on - * first call of `multiply()`. By default, `BASE` point is precomputed. - * - * Scalars should always be less than curve order: this should be checked inside of a curve itself. - * Creates precomputation tables for fast multiplication: - * - private scalar is split by fixed size windows of W bits - * - every window point is collected from window's table & added to accumulator - * - since windows are different, same point inside tables won't be accessed more than once per calc - * - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) - * - +1 window is neccessary for wNAF - * - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication - * - * TODO: research returning a 2d JS array of windows instead of a single window. - * This would allow windows to be in different memory locations. - * @param Point - Point constructor. - * @param bits - Scalar bit length. - * @example - * Elliptic curve multiplication of Point by scalar. - * - * ```ts - * import { wNAF } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const ladder = new wNAF(p256.Point, p256.Point.Fn.BITS); - * ``` - */ -export class wNAF { - private readonly BASE: PC_P; - private readonly ZERO: PC_P; - private readonly Fn: PC['Fn']; - readonly bits: number; - - // Parametrized with a given Point class (not individual point) - constructor(Point: PC, bits: number) { - this.BASE = Point.BASE; - this.ZERO = Point.ZERO; - this.Fn = Point.Fn; - this.bits = bits; - } - - // non-const time multiplication ladder - _unsafeLadder(elm: PC_P, n: bigint, p: PC_P = this.ZERO): PC_P { - let d: PC_P = elm; - while (n > _0n) { - if (n & _1n) p = p.add(d); - d = d.double(); - n >>= _1n; - } - return p; - } - - /** - * Creates a wNAF precomputation window. Used for caching. - * Default window size is set by `utils.precompute()` and is equal to 8. - * Number of precomputed points depends on the curve size: - * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: - * - 𝑊 is the window size - * - 𝑛 is the bitlength of the curve order. - * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. - * @param point - Point instance - * @param W - window size - * @returns precomputed point tables flattened to a single array - */ - private precomputeWindow(point: PC_P, W: number): PC_P[] { - const { windows, windowSize } = calcWOpts(W, this.bits); - const points: PC_P[] = []; - let p: PC_P = point; - let base = p; - for (let window = 0; window < windows; window++) { - base = p; - points.push(base); - // i=1, bc we skip 0 - for (let i = 1; i < windowSize; i++) { - base = base.add(p); - points.push(base); - } - p = base.double(); - } - return points; - } - - /** - * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. - * More compact implementation: - * https://github.com/paulmillr/noble-secp256k1/blob/47cb1669b6e506ad66b35fe7d76132ae97465da2/index.ts#L502-L541 - * @returns real and fake (for const-time) points - */ - private wNAF(W: number, precomputes: PC_P[], n: bigint): { p: PC_P; f: PC_P } { - // Scalar should be smaller than field order - if (!this.Fn.isValid(n)) throw new Error('invalid scalar'); - // Accumulators - let p = this.ZERO; - let f = this.BASE; - // This code was first written with assumption that 'f' and 'p' will never be infinity point: - // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, - // there is negate now: it is possible that negated element from low value - // would be the same as high element, which will create carry into next window. - // It's not obvious how this can fail, but still worth investigating later. - const wo = calcWOpts(W, this.bits); - for (let window = 0; window < wo.windows; window++) { - // (n === _0n) is handled and not early-exited. isEven and offsetF are used for noise - const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo); - n = nextN; - if (isZero) { - // bits are 0: add garbage to fake point - // Important part for const-time getPublicKey: add random "noise" point to f. - f = f.add(negateCt(isNegF, precomputes[offsetF])); - } else { - // bits are 1: add to result point - p = p.add(negateCt(isNeg, precomputes[offset])); - } - } - assert0(n); - // Return both real and fake points so JIT keeps the noise path alive. - // Known caveat: negate/carry interactions can still drive `f` to infinity even when `p` is not, - // which weakens the noise path and leaves this only "less const-time" by about one bigint mul. - return { p, f }; - } - - /** - * Implements unsafe EC multiplication using precomputed tables - * and w-ary non-adjacent form. - * @param acc - accumulator point to add result of multiplication - * @returns point - */ - private wNAFUnsafe( - W: number, - precomputes: PC_P[], - n: bigint, - acc: PC_P = this.ZERO - ): PC_P { - const wo = calcWOpts(W, this.bits); - for (let window = 0; window < wo.windows; window++) { - if (n === _0n) break; // Early-exit, skip 0 value - const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo); - n = nextN; - if (isZero) { - // Window bits are 0: skip processing. - // Move to next window. - continue; - } else { - const item = precomputes[offset]; - acc = acc.add(isNeg ? item.negate() : item); // Re-using acc allows to save adds in MSM - } - } - assert0(n); - return acc; - } - - private getPrecomputes(W: number, point: PC_P, transform?: Mapper>): PC_P[] { - // Cache key is only point identity plus the remembered window size; callers must not reuse the - // same point with incompatible `transform(...)` layouts and expect a separate cache entry. - let comp = pointPrecomputes.get(point); - if (!comp) { - comp = this.precomputeWindow(point, W) as PC_P[]; - if (W !== 1) { - // Doing transform outside of if brings 15% perf hit - if (typeof transform === 'function') comp = transform(comp); - pointPrecomputes.set(point, comp); - } - } - return comp; - } - - cached( - point: PC_P, - scalar: bigint, - transform?: Mapper> - ): { p: PC_P; f: PC_P } { - const W = getW(point); - return this.wNAF(W, this.getPrecomputes(W, point, transform), scalar); - } - - unsafe(point: PC_P, scalar: bigint, transform?: Mapper>, prev?: PC_P): PC_P { - const W = getW(point); - if (W === 1) return this._unsafeLadder(point, scalar, prev); // For W=1 ladder is ~x2 faster - return this.wNAFUnsafe(W, this.getPrecomputes(W, point, transform), scalar, prev); - } - - // We calculate precomputes for elliptic curve point multiplication - // using windowed method. This specifies window size and - // stores precomputed values. Usually only base point would be precomputed. - createCache(P: PC_P, W: number): void { - validateW(W, this.bits); - pointWindowSizes.set(P, W); - pointPrecomputes.delete(P); - } - - hasCache(elm: PC_P): boolean { - return getW(elm) !== 1; - } -} - -/** - * Endomorphism-specific multiplication for Koblitz curves. - * Cost: 128 dbl, 0-256 adds. - * @param Point - Point constructor. - * @param point - Input point. - * @param k1 - First non-negative absolute scalar chunk. - * @param k2 - Second non-negative absolute scalar chunk. - * @returns Partial multiplication results. - * @example - * Endomorphism-specific multiplication for Koblitz curves. - * - * ```ts - * import { mulEndoUnsafe } from '@noble/curves/abstract/curve.js'; - * import { secp256k1 } from '@noble/curves/secp256k1.js'; - * const parts = mulEndoUnsafe(secp256k1.Point, secp256k1.Point.BASE, 3n, 5n); - * ``` - */ -export function mulEndoUnsafe

, PC extends CurvePointCons

>( - Point: PC, - point: P, - k1: bigint, - k2: bigint -): { p1: P; p2: P } { - let acc = point; - let p1 = Point.ZERO; - let p2 = Point.ZERO; - while (k1 > _0n || k2 > _0n) { - if (k1 & _1n) p1 = p1.add(acc); - if (k2 & _1n) p2 = p2.add(acc); - acc = acc.double(); - k1 >>= _1n; - k2 >>= _1n; - } - return { p1, p2 }; -} - -/** - * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * 30x faster vs naive addition on L=4096, 10x faster than precomputes. - * For N=254bit, L=1, it does: 1024 ADD + 254 DBL. For L=5: 1536 ADD + 254 DBL. - * Algorithmically constant-time (for same L), even when 1 point + scalar, or when scalar = 0. - * @param c - Curve Point constructor - * @param points - array of L curve points - * @param scalars - array of L scalars (aka secret keys / bigints) - * @returns MSM result point. Empty input is accepted and returns the identity. - * @throws If the point set, scalar set, or MSM sizing is invalid. {@link Error} - * @example - * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * - * ```ts - * import { pippenger } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const point = pippenger(p256.Point, [p256.Point.BASE, p256.Point.BASE.double()], [2n, 3n]); - * ``` - */ -export function pippenger

, PC extends CurvePointCons

>( - c: PC, - points: P[], - scalars: bigint[] -): P { - // If we split scalars by some window (let's say 8 bits), every chunk will only - // take 256 buckets even if there are 4096 scalars, also re-uses double. - // TODO: - // - https://eprint.iacr.org/2024/750.pdf - // - https://tches.iacr.org/index.php/TCHES/article/view/10287 - // 0 is accepted in scalars - const fieldN = c.Fn; - validateMSMPoints(points, c); - validateMSMScalars(scalars, fieldN); - const plength = points.length; - const slength = scalars.length; - if (plength !== slength) throw new Error('arrays of points and scalars must have equal length'); - // if (plength === 0) throw new Error('array must be of length >= 2'); - const zero = c.ZERO; - const wbits = bitLen(BigInt(plength)); - let windowSize = 1; // bits - if (wbits > 12) windowSize = wbits - 3; - else if (wbits > 4) windowSize = wbits - 2; - else if (wbits > 0) windowSize = 2; - const MASK = bitMask(windowSize); - const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array - const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize; - let sum = zero; - for (let i = lastBits; i >= 0; i -= windowSize) { - buckets.fill(zero); - for (let j = 0; j < slength; j++) { - const scalar = scalars[j]; - const wbits = Number((scalar >> BigInt(i)) & MASK); - buckets[wbits] = buckets[wbits].add(points[j]); - } - let resI = zero; // not using this will do small speed-up, but will lose ct - // Skip first bucket, because it is zero - for (let j = buckets.length - 1, sumI = zero; j > 0; j--) { - sumI = sumI.add(buckets[j]); - resI = resI.add(sumI); - } - sum = sum.add(resI); - if (i !== 0) for (let j = 0; j < windowSize; j++) sum = sum.double(); - } - return sum as P; -} -/** - * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * @param c - Curve Point constructor - * @param points - array of L curve points - * @param windowSize - Precompute window size. - * @returns Function which multiplies points with scalars. The closure accepts - * `scalars.length <= points.length`, and omitted trailing scalars are treated as zero. - * @throws If the point set or precompute window is invalid. {@link Error} - * @example - * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). - * - * ```ts - * import { precomputeMSMUnsafe } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const msm = precomputeMSMUnsafe(p256.Point, [p256.Point.BASE], 4); - * const point = msm([3n]); - * ``` - */ -export function precomputeMSMUnsafe

, PC extends CurvePointCons

>( - c: PC, - points: P[], - windowSize: number -): (scalars: bigint[]) => P { - /** - * Performance Analysis of Window-based Precomputation - * - * Base Case (256-bit scalar, 8-bit window): - * - Standard precomputation requires: - * - 31 additions per scalar × 256 scalars = 7,936 ops - * - Plus 255 summary additions = 8,191 total ops - * Note: Summary additions can be optimized via accumulator - * - * Chunked Precomputation Analysis: - * - Using 32 chunks requires: - * - 255 additions per chunk - * - 256 doublings - * - Total: (255 × 32) + 256 = 8,416 ops - * - * Memory Usage Comparison: - * Window Size | Standard Points | Chunked Points - * ------------|-----------------|--------------- - * 4-bit | 520 | 15 - * 8-bit | 4,224 | 255 - * 10-bit | 13,824 | 1,023 - * 16-bit | 557,056 | 65,535 - * - * Key Advantages: - * 1. Enables larger window sizes due to reduced memory overhead - * 2. More efficient for smaller scalar counts: - * - 16 chunks: (16 × 255) + 256 = 4,336 ops - * - ~2x faster than standard 8,191 ops - * - * Limitations: - * - Not suitable for plain precomputes (requires 256 constant doublings) - * - Performance degrades with larger scalar counts: - * - Optimal for ~256 scalars - * - Less efficient for 4096+ scalars (Pippenger preferred) - */ - const fieldN = c.Fn; - validateW(windowSize, fieldN.BITS); - validateMSMPoints(points, c); - const zero = c.ZERO; - const tableSize = 2 ** windowSize - 1; // table size (without zero) - const chunks = Math.ceil(fieldN.BITS / windowSize); // chunks of item - const MASK = bitMask(windowSize); - const tables = points.map((p: P) => { - const res = []; - for (let i = 0, acc = p; i < tableSize; i++) { - res.push(acc); - acc = acc.add(p); - } - return res; - }); - return (scalars: bigint[]): P => { - validateMSMScalars(scalars, fieldN); - if (scalars.length > points.length) - throw new Error('array of scalars must be smaller than array of points'); - let res = zero; - for (let i = 0; i < chunks; i++) { - // No need to double if accumulator is still zero. - if (res !== zero) for (let j = 0; j < windowSize; j++) res = res.double(); - const shiftBy = BigInt(chunks * windowSize - (i + 1) * windowSize); - for (let j = 0; j < scalars.length; j++) { - const n = scalars[j]; - const curr = Number((n >> shiftBy) & MASK); - if (!curr) continue; // skip zero scalars chunks - res = res.add(tables[j][curr - 1]); - } - } - return res; - }; -} - -/** Minimal curve parameters needed to construct a Weierstrass or Edwards curve. */ -export type ValidCurveParams = { - /** Base-field modulus. */ - p: bigint; - /** Prime subgroup order. */ - n: bigint; - /** Cofactor. */ - h: bigint; - /** Curve parameter `a`. */ - a: T; - /** Weierstrass curve parameter `b`. */ - b?: T; - /** Edwards curve parameter `d`. */ - d?: T; - /** Generator x coordinate. */ - Gx: T; - /** Generator y coordinate. */ - Gy: T; -}; - -function createField(order: bigint, field?: TArg>, isLE?: boolean): TRet> { - if (field) { - // Reuse supplied field overrides as-is; `isLE` only affects freshly constructed fallback - // fields, and validateField() below only checks the arithmetic subset, not full byte/cmov - // behavior. - if (field.ORDER !== order) throw new Error('Field.ORDER must match order: Fp == p, Fn == n'); - validateField(field); - return field as TRet>; - } else { - return Field(order, { isLE }) as unknown as TRet>; - } -} -/** Pair of fields used by curve constructors. */ -export type FpFn = { - /** Base field used for curve coordinates. */ - Fp: IField; - /** Scalar field used for secret scalars and subgroup arithmetic. */ - Fn: IField; -}; - -/** - * Validates basic CURVE shape and field membership, then creates fields. - * This does not prove that the generator is on-curve, that subgroup/order data are consistent, or - * that the curve equation itself is otherwise sane. - * @param type - Curve family. - * @param CURVE - Curve parameters. - * @param curveOpts - Optional field overrides: - * - `Fp` (optional): Optional base-field override. - * - `Fn` (optional): Optional scalar-field override. - * @param FpFnLE - Whether field encoding is little-endian. - * @returns Frozen curve parameters and fields. - * @throws If the curve parameters or field overrides are invalid. {@link Error} - * @example - * Build curve fields from raw constants before constructing a curve instance. - * - * ```ts - * const curve = createCurveFields('weierstrass', { - * p: 17n, - * n: 19n, - * h: 1n, - * a: 2n, - * b: 2n, - * Gx: 5n, - * Gy: 1n, - * }); - * ``` - */ -export function createCurveFields( - type: 'weierstrass' | 'edwards', - CURVE: ValidCurveParams, - curveOpts: TArg>> = {}, - FpFnLE?: boolean -): TRet & { CURVE: ValidCurveParams }> { - if (FpFnLE === undefined) FpFnLE = type === 'edwards'; - if (!CURVE || typeof CURVE !== 'object') throw new Error(`expected valid ${type} CURVE object`); - for (const p of ['p', 'n', 'h'] as const) { - const val = CURVE[p]; - if (!(typeof val === 'bigint' && val > _0n)) - throw new Error(`CURVE.${p} must be positive bigint`); - } - const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE); - const Fn = createField(CURVE.n, curveOpts.Fn, FpFnLE); - const _b: 'b' | 'd' = type === 'weierstrass' ? 'b' : 'd'; - const params = ['Gx', 'Gy', 'a', _b] as const; - for (const p of params) { - // @ts-ignore - if (!Fp.isValid(CURVE[p])) - throw new Error(`CURVE.${p} must be valid field element of CURVE.Fp`); - } - CURVE = Object.freeze(Object.assign({}, CURVE)); - return { CURVE, Fp, Fn } as TRet & { CURVE: ValidCurveParams }>; -} - -type KeygenFn = ( - seed?: Uint8Array, - isCompressed?: boolean -) => { secretKey: Uint8Array; publicKey: Uint8Array }; -/** - * @param randomSecretKey - Secret-key generator. - * @param getPublicKey - Public-key derivation helper. - * @returns Keypair generator. - * @example - * Build a `keygen()` helper from existing secret-key and public-key primitives. - * - * ```ts - * import { createKeygen } from '@noble/curves/abstract/curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const keygen = createKeygen(p256.utils.randomSecretKey, p256.getPublicKey); - * const pair = keygen(); - * ``` - */ -export function createKeygen( - randomSecretKey: Function, - getPublicKey: TArg -): TRet { - return function keygen(seed?: TArg) { - const secretKey = randomSecretKey(seed) as TRet; - return { secretKey, publicKey: getPublicKey(secretKey) as TRet }; - }; -} diff --git a/node_modules/@noble/curves/src/abstract/edwards.ts b/node_modules/@noble/curves/src/abstract/edwards.ts deleted file mode 100644 index e5e278f..0000000 --- a/node_modules/@noble/curves/src/abstract/edwards.ts +++ /dev/null @@ -1,1013 +0,0 @@ -/** - * Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y². - * For design rationale of types / exports, see weierstrass module documentation. - * Untwisted Edwards curves exist, but they aren't used in real-world protocols. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { - abool, - abytes, - aInRange, - asafenumber, - bytesToHex, - bytesToNumberLE, - concatBytes, - copyBytes, - hexToBytes, - isBytes, - notImplemented, - validateObject, - randomBytes as wcRandomBytes, - type FHash, - type Signer, - type TArg, - type TRet, -} from '../utils.ts'; -import { - createCurveFields, - createKeygen, - normalizeZ, - wNAF, - type AffinePoint, - type CurveLengths, - type CurvePoint, - type CurvePointCons, -} from './curve.ts'; -import { type IField } from './modular.ts'; - -// Be friendly to bad ECMAScript parsers by not using bigint literals -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _8n = /* @__PURE__ */ BigInt(8); - -/** Extended Edwards point with X/Y/Z/T coordinates. */ -export interface EdwardsPoint extends CurvePoint { - /** extended X coordinate. Different from affine x. */ - readonly X: bigint; - /** extended Y coordinate. Different from affine y. */ - readonly Y: bigint; - /** extended Z coordinate */ - readonly Z: bigint; - /** extended T coordinate */ - readonly T: bigint; -} -/** Constructor and decoding helpers for extended Edwards points. */ -export interface EdwardsPointCons extends CurvePointCons { - /** Create a point from extended X/Y/Z/T coordinates without validation. */ - new (X: bigint, Y: bigint, Z: bigint, T: bigint): EdwardsPoint; - /** - * Return the curve parameters used by this point constructor. - * @returns Curve parameters. - */ - CURVE(): EdwardsOpts; - /** - * Decode a point from bytes, optionally using ZIP-215 rules. - * @param bytes - Encoded point bytes. - * @param zip215 - Whether to accept ZIP-215 encodings. - * @returns Decoded Edwards point. - */ - fromBytes(bytes: Uint8Array, zip215?: boolean): EdwardsPoint; - /** - * Decode a point from hex, optionally using ZIP-215 rules. - * @param hex - Encoded point hex. - * @param zip215 - Whether to accept ZIP-215 encodings. - * @returns Decoded Edwards point. - */ - fromHex(hex: string, zip215?: boolean): EdwardsPoint; -} - -/** - * Twisted Edwards curve options. - * - * * a: formula param - * * d: formula param - * * p: prime characteristic (order) of finite field, in which arithmetics is done - * * n: order of prime subgroup a.k.a total amount of valid curve points - * * h: cofactor. h*n is group order; n is subgroup order - * * Gx: x coordinate of generator point a.k.a. base point - * * Gy: y coordinate of generator point - */ -export type EdwardsOpts = Readonly<{ - /** Base-field modulus. */ - p: bigint; - /** Prime subgroup order. */ - n: bigint; - /** Curve cofactor. */ - h: bigint; - /** Edwards curve parameter `a`. */ - a: bigint; - /** Edwards curve parameter `d`. */ - d: bigint; - /** Generator x coordinate. */ - Gx: bigint; - /** Generator y coordinate. */ - Gy: bigint; -}>; - -/** - * Extra curve options for Twisted Edwards. - * - * * Fp: redefined Field over curve.p - * * Fn: redefined Field over curve.n - * * uvRatio: helper function for decompression, calculating √(u/v) - */ -export type EdwardsExtraOpts = Partial<{ - /** Optional base-field override. */ - Fp: IField; - /** Optional scalar-field override. */ - Fn: IField; - /** Whether field encodings are little-endian. */ - FpFnLE: boolean; - /** Square-root ratio helper used during point decompression. */ - uvRatio: (u: bigint, v: bigint) => { isValid: boolean; value: bigint }; -}>; - -/** - * EdDSA (Edwards Digital Signature algorithm) options. - * - * * hash: hash function used to hash secret keys and messages - * * adjustScalarBytes: clears bits to get valid field element - * * domain: Used for hashing - * * mapToCurve: for hash-to-curve standard - * * prehash: RFC 8032 pre-hashing of messages to sign() / verify() - * * randomBytes: function generating random bytes, used for randomSecretKey - */ -export type EdDSAOpts = Partial<{ - /** Clamp or otherwise normalize secret-scalar bytes before reducing mod `n`. */ - adjustScalarBytes: (bytes: TArg) => TRet; - /** Domain-separation helper for contexts and prehash mode. */ - domain: (data: TArg, ctx: TArg, phflag: boolean) => TRet; - /** Optional hash-to-curve mapper for protocols like Ristretto hash-to-group. */ - mapToCurve: (scalar: bigint[]) => AffinePoint; - /** Optional prehash function used before signing or verifying messages. */ - prehash: FHash; - /** Default verification decoding policy. ZIP-215 is more permissive than RFC 8032 / NIST. */ - zip215: boolean; - /** RNG override used by helper constructors. */ - randomBytes: (bytesLength?: number) => TRet; -}>; - -/** - * EdDSA (Edwards Digital Signature algorithm) helper namespace. - * Allows creating and verifying signatures, and deriving public keys. - */ -export interface EdDSA { - /** - * Generate a secret/public key pair. - * @param seed - Optional seed material. - * @returns Secret/public key pair. - */ - keygen: (seed?: TArg) => { secretKey: TRet; publicKey: TRet }; - /** - * Derive the public key from a secret key. - * @param secretKey - Secret key bytes. - * @returns Encoded public key. - */ - getPublicKey: (secretKey: TArg) => TRet; - /** - * Sign a message with an EdDSA secret key. - * @param message - Message bytes. - * @param secretKey - Secret key bytes. - * @param options - Optional signature tweaks: - * - `context` (optional): Domain-separation context for Ed25519ctx/Ed448. - * @returns Encoded signature bytes. - */ - sign: ( - message: TArg, - secretKey: TArg, - options?: TArg<{ context?: Uint8Array }> - ) => TRet; - /** - * Verify a signature against a message and public key. - * @param sig - Encoded signature bytes. - * @param message - Message bytes. - * @param publicKey - Encoded public key. - * @param options - Optional verification tweaks: - * - `context` (optional): Domain-separation context for Ed25519ctx/Ed448. - * - `zip215` (optional): Whether to accept ZIP-215 encodings. - * @returns Whether the signature is valid. - */ - verify: ( - sig: TArg, - message: TArg, - publicKey: TArg, - options?: TArg<{ context?: Uint8Array; zip215?: boolean }> - ) => boolean; - /** Point constructor used by this signature scheme. */ - Point: EdwardsPointCons; - /** Helper utilities for key validation and Montgomery conversion. */ - utils: { - /** - * Generate a valid random secret key. - * Optional seed bytes are only length-checked and returned unchanged. - */ - randomSecretKey: (seed?: TArg) => TRet; - /** Check whether a secret key has the expected encoding. */ - isValidSecretKey: (secretKey: TArg) => boolean; - /** Check whether a public key decodes to a valid point. */ - isValidPublicKey: (publicKey: TArg, zip215?: boolean) => boolean; - - /** - * Converts ed public key to x public key. - * - * There is NO `fromMontgomery`: - * - There are 2 valid ed25519 points for every x25519, with flipped coordinate - * - Sometimes there are 0 valid ed25519 points, because x25519 *additionally* - * accepts inputs on the quadratic twist, which can't be moved to ed25519 - * - * @example - * Converts ed public key to x public key. - * - * ```js - * const someonesPub_ed = ed25519.getPublicKey(ed25519.utils.randomSecretKey()); - * const someonesPub = ed25519.utils.toMontgomery(someonesPub); - * const aPriv = x25519.utils.randomSecretKey(); - * const shared = x25519.getSharedSecret(aPriv, someonesPub) - * ``` - */ - toMontgomery: (publicKey: TArg) => TRet; - /** - * Converts ed secret key to x secret key. - * @example - * Converts ed secret key to x secret key. - * - * ```js - * const someonesPub = x25519.getPublicKey(x25519.utils.randomSecretKey()); - * const aPriv_ed = ed25519.utils.randomSecretKey(); - * const aPriv = ed25519.utils.toMontgomerySecret(aPriv_ed); - * const shared = x25519.getSharedSecret(aPriv, someonesPub) - * ``` - */ - toMontgomerySecret: (secretKey: TArg) => TRet; - /** Return the expanded private key components used by RFC8032 signing. */ - getExtendedPublicKey: (key: TArg) => { - head: TRet; - prefix: TRet; - scalar: bigint; - point: EdwardsPoint; - pointBytes: TRet; - }; - }; - /** Byte lengths for keys and signatures exposed by this scheme. */ - lengths: CurveLengths; -} - -// Affine Edwards-equation check only; this does not prove subgroup membership, canonical -// encoding, prime-order base-point requirements, or identity exclusion. -function isEdValidXY(Fp: TArg>, CURVE: EdwardsOpts, x: bigint, y: bigint): boolean { - const x2 = Fp.sqr(x); - const y2 = Fp.sqr(y); - const left = Fp.add(Fp.mul(CURVE.a, x2), y2); - const right = Fp.add(Fp.ONE, Fp.mul(CURVE.d, Fp.mul(x2, y2))); - return Fp.eql(left, right); -} - -/** - * @param params - Curve parameters. See {@link EdwardsOpts}. - * @param extraOpts - Optional helpers and overrides. See {@link EdwardsExtraOpts}. - * @returns Edwards point constructor. Generator validation here only checks - * that `(Gx, Gy)` satisfies the affine Edwards equation. - * RFC 8032 base-point constraints like `B != (0,1)` and `[L]B = 0` - * are left to the caller's chosen parameters, since eager subgroup - * validation here adds about 10-15ms to heavyweight imports like ed448. - * The returned constructor also eagerly marks `Point.BASE` for W=8 - * precompute caching. Some code paths still assume - * `Fp.BYTES === Fn.BYTES`, so mismatched byte lengths are not fully audited here. - * @throws If the curve parameters or Edwards overrides are invalid. {@link Error} - * @example - * ```ts - * import { edwards } from '@noble/curves/abstract/edwards.js'; - * import { jubjub } from '@noble/curves/misc.js'; - * // Build a point constructor from explicit curve parameters, then use its base point. - * const Point = edwards(jubjub.Point.CURVE()); - * Point.BASE.toHex(); - * ``` - */ -export function edwards( - params: TArg, - extraOpts: TArg = {} -): EdwardsPointCons { - const opts = extraOpts as EdwardsExtraOpts; - const validated = createCurveFields('edwards', params as EdwardsOpts, opts, opts.FpFnLE); - const { Fp, Fn } = validated; - let CURVE = validated.CURVE as EdwardsOpts; - const { h: cofactor } = CURVE; - validateObject(opts, {}, { uvRatio: 'function' }); - - // Important: - // There are some places where Fp.BYTES is used instead of nByteLength. - // So far, everything has been tested with curves of Fp.BYTES == nByteLength. - // TODO: test and find curves which behave otherwise. - const MASK = _2n << (BigInt(Fn.BYTES * 8) - _1n); - const modP = (n: bigint) => Fp.create(n); // Function overrides - - // sqrt(u/v) - const uvRatio = - opts.uvRatio === undefined - ? (u: bigint, v: bigint) => { - try { - return { isValid: true, value: Fp.sqrt(Fp.div(u, v)) }; - } catch (e) { - return { isValid: false, value: _0n }; - } - } - : opts.uvRatio; - - // Validate whether the passed curve params are valid. - // equation ax² + y² = 1 + dx²y² should work for generator point. - if (!isEdValidXY(Fp, CURVE, CURVE.Gx, CURVE.Gy)) - throw new Error('bad curve params: generator point'); - - /** - * Asserts coordinate is valid: 0 <= n < MASK. - * Coordinates >= Fp.ORDER are allowed for zip215. - */ - function acoord(title: string, n: bigint, banZero = false) { - const min = banZero ? _1n : _0n; - aInRange('coordinate ' + title, n, min, MASK); - return n; - } - - function aedpoint(other: unknown) { - if (!(other instanceof Point)) throw new Error('EdwardsPoint expected'); - } - - // Extended Point works in extended coordinates: (X, Y, Z, T) ∋ (x=X/Z, y=Y/Z, T=xy). - // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates - class Point implements EdwardsPoint { - // base / generator point - static readonly BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); - // zero / infinity / identity point - static readonly ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 - // math field - static readonly Fp = Fp; - // scalar field - static readonly Fn = Fn; - - readonly X: bigint; - readonly Y: bigint; - readonly Z: bigint; - readonly T: bigint; - - constructor(X: bigint, Y: bigint, Z: bigint, T: bigint) { - this.X = acoord('x', X); - this.Y = acoord('y', Y); - this.Z = acoord('z', Z, true); - this.T = acoord('t', T); - Object.freeze(this); - } - - static CURVE(): EdwardsOpts { - return CURVE; - } - - /** - * Create one extended Edwards point from affine coordinates. - * Does NOT validate that the point is on-curve or torsion-free. - * Use `.assertValidity()` on adversarial inputs. - */ - static fromAffine(p: AffinePoint): Point { - if (p instanceof Point) throw new Error('extended point not allowed'); - const { x, y } = p || {}; - acoord('x', x); - acoord('y', y); - return new Point(x, y, _1n, modP(x * y)); - } - - // Uses algo from RFC8032 5.1.3. - static fromBytes(bytes: Uint8Array, zip215 = false): Point { - const len = Fp.BYTES; - const { a, d } = CURVE; - bytes = copyBytes(abytes(bytes, len, 'point')); - abool(zip215, 'zip215'); - const normed = copyBytes(bytes); // copy again, we'll manipulate it - const lastByte = bytes[len - 1]; // select last byte - normed[len - 1] = lastByte & ~0x80; // clear last bit - const y = bytesToNumberLE(normed); - - // zip215=true is good for consensus-critical apps. =false follows RFC8032 / NIST186-5. - // RFC8032 prohibits >= p, but ZIP215 doesn't - // zip215=true: 0 <= y < MASK (2^256 for ed25519) - // zip215=false: 0 <= y < P (2^255-19 for ed25519) - const max = zip215 ? MASK : Fp.ORDER; - aInRange('point.y', y, _0n, max); - - // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case: - // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a) - const y2 = modP(y * y); // denominator is always non-0 mod p. - const u = modP(y2 - _1n); // u = y² - 1 - const v = modP(d * y2 - a); // v = d y² + 1. - let { isValid, value: x } = uvRatio(u, v); // √(u/v) - if (!isValid) throw new Error('bad point: invalid y coordinate'); - const isXOdd = (x & _1n) === _1n; // There are 2 square roots. Use x_0 bit to select proper - const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit - if (!zip215 && x === _0n && isLastByteOdd) - // if x=0 and x_0 = 1, fail - throw new Error('bad point: x=0 and x_0=1'); - if (isLastByteOdd !== isXOdd) x = modP(-x); // if x_0 != x mod 2, set x = p-x - return Point.fromAffine({ x, y }); - } - - static fromHex(hex: string, zip215 = false): Point { - return Point.fromBytes(hexToBytes(hex), zip215); - } - - get x(): bigint { - return this.toAffine().x; - } - get y(): bigint { - return this.toAffine().y; - } - - precompute(windowSize: number = 8, isLazy = true) { - wnaf.createCache(this, windowSize); - if (!isLazy) this.multiply(_2n); // random number - return this; - } - - // Useful in fromAffine() - not for fromBytes(), which always created valid points. - assertValidity(): void { - const p = this; - const { a, d } = CURVE; - // Keep generic Edwards validation fail-closed on the neutral point. - // Even though ZERO is algebraically valid and can roundtrip through encodings, higher-level - // callers often reach it only through broken hash/scalar plumbing; rejecting it here avoids - // silently treating that degenerate state as an ordinary public point. - if (p.is0()) throw new Error('bad point: ZERO'); // TODO: optimize, with vars below? - // Equation in affine coordinates: ax² + y² = 1 + dx²y² - // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y² - const { X, Y, Z, T } = p; - const X2 = modP(X * X); // X² - const Y2 = modP(Y * Y); // Y² - const Z2 = modP(Z * Z); // Z² - const Z4 = modP(Z2 * Z2); // Z⁴ - const aX2 = modP(X2 * a); // aX² - const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z² - const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y² - if (left !== right) throw new Error('bad point: equation left != right (1)'); - // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T - const XY = modP(X * Y); - const ZT = modP(Z * T); - if (XY !== ZT) throw new Error('bad point: equation left != right (2)'); - } - - // Compare one point to another. - equals(other: Point): boolean { - aedpoint(other); - const { X: X1, Y: Y1, Z: Z1 } = this; - const { X: X2, Y: Y2, Z: Z2 } = other; - const X1Z2 = modP(X1 * Z2); - const X2Z1 = modP(X2 * Z1); - const Y1Z2 = modP(Y1 * Z2); - const Y2Z1 = modP(Y2 * Z1); - return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; - } - - is0(): boolean { - return this.equals(Point.ZERO); - } - - negate(): Point { - // Flips point sign to a negative one (-x, y in affine coords) - return new Point(modP(-this.X), this.Y, this.Z, modP(-this.T)); - } - - // Fast algo for doubling Extended Point. - // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd - // Cost: 4M + 4S + 1*a + 6add + 1*2. - double(): Point { - const { a } = CURVE; - const { X: X1, Y: Y1, Z: Z1 } = this; - const A = modP(X1 * X1); // A = X12 - const B = modP(Y1 * Y1); // B = Y12 - const C = modP(_2n * modP(Z1 * Z1)); // C = 2*Z12 - const D = modP(a * A); // D = a*A - const x1y1 = X1 + Y1; - const E = modP(modP(x1y1 * x1y1) - A - B); // E = (X1+Y1)2-A-B - const G = D + B; // G = D+B - const F = G - C; // F = G-C - const H = D - B; // H = D-B - const X3 = modP(E * F); // X3 = E*F - const Y3 = modP(G * H); // Y3 = G*H - const T3 = modP(E * H); // T3 = E*H - const Z3 = modP(F * G); // Z3 = F*G - return new Point(X3, Y3, Z3, T3); - } - - // Fast algo for adding 2 Extended Points. - // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd - // Cost: 9M + 1*a + 1*d + 7add. - add(other: Point) { - aedpoint(other); - const { a, d } = CURVE; - const { X: X1, Y: Y1, Z: Z1, T: T1 } = this; - const { X: X2, Y: Y2, Z: Z2, T: T2 } = other; - const A = modP(X1 * X2); // A = X1*X2 - const B = modP(Y1 * Y2); // B = Y1*Y2 - const C = modP(T1 * d * T2); // C = T1*d*T2 - const D = modP(Z1 * Z2); // D = Z1*Z2 - const E = modP((X1 + Y1) * (X2 + Y2) - A - B); // E = (X1+Y1)*(X2+Y2)-A-B - const F = D - C; // F = D-C - const G = D + C; // G = D+C - const H = modP(B - a * A); // H = B-a*A - const X3 = modP(E * F); // X3 = E*F - const Y3 = modP(G * H); // Y3 = G*H - const T3 = modP(E * H); // T3 = E*H - const Z3 = modP(F * G); // Z3 = F*G - return new Point(X3, Y3, Z3, T3); - } - - subtract(other: Point): Point { - // Validate before calling `negate()` so wrong inputs fail with the point guard - // instead of leaking a foreign `negate()` error. - aedpoint(other); - return this.add(other.negate()); - } - - // Constant-time multiplication. - multiply(scalar: bigint): Point { - // 1 <= scalar < L - // Keep the subgroup-scalar contract strict instead of reducing 0 / n to ZERO. - // In keygen/signing-style callers, those values usually mean broken hash/scalar plumbing, - // and failing closed is safer than silently producing the identity point. - if (!Fn.isValidNot0(scalar)) - throw new RangeError('invalid scalar: expected 1 <= sc < curve.n'); - const { p, f } = wnaf.cached(this, scalar, (p) => normalizeZ(Point, p)); - return normalizeZ(Point, [p, f])[0]; - } - - // Non-constant-time multiplication. Uses double-and-add algorithm. - // It's faster, but should only be used when you don't care about - // an exposed private key e.g. sig verification. - // Keeps the same subgroup-scalar contract: 0 is allowed for public-scalar callers, but - // n and larger values are rejected instead of being reduced mod n to the identity point. - multiplyUnsafe(scalar: bigint): Point { - // 0 <= scalar < L - if (!Fn.isValid(scalar)) throw new RangeError('invalid scalar: expected 0 <= sc < curve.n'); - if (scalar === _0n) return Point.ZERO; - if (this.is0() || scalar === _1n) return this; - return wnaf.unsafe(this, scalar, (p) => normalizeZ(Point, p)); - } - - // Checks if point is of small order. - // If you add something to small order point, you will have "dirty" - // point with torsion component. - // Clears cofactor and checks if the result is 0. - isSmallOrder(): boolean { - return this.clearCofactor().is0(); - } - - // Multiplies point by curve order and checks if the result is 0. - // Returns `false` is the point is dirty. - isTorsionFree(): boolean { - return wnaf.unsafe(this, CURVE.n).is0(); - } - - // Converts Extended point to default (x, y) coordinates. - // Can accept precomputed Z^-1 - for example, from invertBatch. - toAffine(invertedZ?: bigint): AffinePoint { - const p = this; - let iz = invertedZ; - const { X, Y, Z } = p; - const is0 = p.is0(); - if (iz == null) iz = is0 ? _8n : (Fp.inv(Z) as bigint); // 8 was chosen arbitrarily - const x = modP(X * iz); - const y = modP(Y * iz); - const zz = Fp.mul(Z, iz); - if (is0) return { x: _0n, y: _1n }; - if (zz !== _1n) throw new Error('invZ was invalid'); - return { x, y }; - } - - clearCofactor(): Point { - if (cofactor === _1n) return this; - return this.multiplyUnsafe(cofactor); - } - - toBytes(): Uint8Array { - const { x, y } = this.toAffine(); - // Fp.toBytes() allows non-canonical encoding of y (>= p). - const bytes = Fp.toBytes(y); - // Each y has 2 valid points: (x, y), (x,-y). - // When compressing, it's enough to store y and use the last byte to encode sign of x - bytes[bytes.length - 1] |= x & _1n ? 0x80 : 0; - return bytes; - } - toHex(): string { - return bytesToHex(this.toBytes()); - } - - toString() { - return ``; - } - } - const wnaf = new wNAF(Point, Fn.BITS); - // Keep constructor work cheap: subgroup/generator validation belongs to the caller's curve - // parameters, and doing the extra checks here adds about 10-15ms to heavy module imports. - // Callers that construct custom curves are responsible for supplying the correct base point. - // try { - // Point.BASE.assertValidity(); - // if (!Point.BASE.isTorsionFree()) throw new Error('bad point: not in prime-order subgroup'); - // } catch { - // throw new Error('bad curve params: generator point'); - // } - // Tiny toy curves can have scalar fields narrower than 8 bits. Skip the - // eager W=8 cache there instead of rejecting an otherwise valid constructor. - if (Fn.BITS >= 8) Point.BASE.precompute(8); // Enable precomputes. Slows down first publicKey computation by 20ms. - Object.freeze(Point.prototype); - Object.freeze(Point); - return Point; -} - -/** - * Base class for prime-order points like Ristretto255 and Decaf448. - * These points eliminate cofactor issues by representing equivalence classes - * of Edwards curve points. Multiple Edwards representatives can describe the - * same abstract wrapper element, so wrapper validity is not the same thing as - * the hidden representative being torsion-free. - * @param ep - Backing Edwards point. - * @example - * Base class for prime-order points like Ristretto255 and Decaf448. - * - * ```ts - * import { ristretto255 } from '@noble/curves/ed25519.js'; - * const point = ristretto255.Point.BASE.multiply(2n); - * ``` - */ -export abstract class PrimeEdwardsPoint> - implements CurvePoint -{ - static BASE: PrimeEdwardsPoint; - static ZERO: PrimeEdwardsPoint; - static Fp: IField; - static Fn: IField; - - protected readonly ep: EdwardsPoint; - - /** - * Wrap one internal Edwards representative directly. - * This is not a canonical encoding boundary: alternate Edwards - * representatives may still describe the same abstract wrapper element. - */ - constructor(ep: EdwardsPoint) { - this.ep = ep; - } - - // Abstract methods that must be implemented by subclasses - abstract toBytes(): Uint8Array; - abstract equals(other: T): boolean; - - // Static methods that must be implemented by subclasses - static fromBytes(_bytes: Uint8Array): any { - notImplemented(); - } - - static fromHex(_hex: string): any { - notImplemented(); - } - - get x(): bigint { - return this.toAffine().x; - } - get y(): bigint { - return this.toAffine().y; - } - - // Common implementations - clearCofactor(): T { - // no-op for the abstract prime-order wrapper group; this is about the - // wrapper element, not the hidden Edwards representative. - return this as any; - } - - assertValidity(): void { - // Keep wrapper validity at the abstract-group boundary. Canonical decode - // may choose Edwards representatives that differ by small torsion, so - // checking `this.ep.isTorsionFree()` here would reject valid wrapper points. - this.ep.assertValidity(); - } - - /** - * Return affine coordinates of the current internal Edwards representative. - * This is a convenience helper, not a canonical Ristretto/Decaf encoding. - * Equal abstract elements may expose different `x` / `y`; use - * `toBytes()` / `fromBytes()` for canonical roundtrips. - */ - toAffine(invertedZ?: bigint): AffinePoint { - return this.ep.toAffine(invertedZ); - } - - toHex(): string { - return bytesToHex(this.toBytes()); - } - - toString(): string { - return this.toHex(); - } - - isTorsionFree(): boolean { - // Abstract Ristretto/Decaf elements are already prime-order even when the - // hidden Edwards representative is not torsion-free. - return true; - } - - isSmallOrder(): boolean { - return false; - } - - add(other: T): T { - this.assertSame(other); - return this.init(this.ep.add(other.ep)); - } - - subtract(other: T): T { - this.assertSame(other); - return this.init(this.ep.subtract(other.ep)); - } - - multiply(scalar: bigint): T { - return this.init(this.ep.multiply(scalar)); - } - - multiplyUnsafe(scalar: bigint): T { - return this.init(this.ep.multiplyUnsafe(scalar)); - } - - double(): T { - return this.init(this.ep.double()); - } - - negate(): T { - return this.init(this.ep.negate()); - } - - precompute(windowSize?: number, isLazy?: boolean): T { - this.ep.precompute(windowSize, isLazy); - // Keep the wrapper identity stable like the backing Edwards API instead of - // allocating a fresh wrapper around the same cached point. - return this as unknown as T; - } - - // Helper methods - abstract is0(): boolean; - protected abstract assertSame(other: T): void; - protected abstract init(ep: EdwardsPoint): T; -} - -/** - * Initializes EdDSA signatures over given Edwards curve. - * @param Point - Edwards point constructor. - * @param cHash - Hash function. - * @param eddsaOpts - Optional signature helpers. See {@link EdDSAOpts}. - * @returns EdDSA helper namespace. - * @throws If the hash function, options, or derived point operations are invalid. {@link Error} - * @example - * Initializes EdDSA signatures over given Edwards curve. - * - * ```ts - * import { eddsa } from '@noble/curves/abstract/edwards.js'; - * import { jubjub } from '@noble/curves/misc.js'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * const sigs = eddsa(jubjub.Point, sha512); - * const { secretKey, publicKey } = sigs.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = sigs.sign(msg, secretKey); - * const isValid = sigs.verify(sig, msg, publicKey); - * ``` - */ -export function eddsa( - Point: EdwardsPointCons, - cHash: TArg, - eddsaOpts: TArg = {} -): EdDSA { - if (typeof cHash !== 'function') throw new Error('"hash" function param is required'); - const hash = cHash as FHash; - const opts = eddsaOpts as EdDSAOpts; - validateObject( - opts, - {}, - { - adjustScalarBytes: 'function', - randomBytes: 'function', - domain: 'function', - prehash: 'function', - zip215: 'boolean', - mapToCurve: 'function', - } - ); - - const { prehash } = opts; - const { BASE, Fp, Fn } = Point; - const outputLen = (hash as FHash & { outputLen?: number }).outputLen; - const expectedLen = 2 * Fp.BYTES; - // When hash metadata is available, reject incompatible EdDSA wrappers at construction time - // instead of deferring the mismatch until the first keygen/sign call. - if (outputLen !== undefined) { - asafenumber(outputLen, 'hash.outputLen'); - if (outputLen !== expectedLen) - throw new Error(`hash.outputLen must be ${expectedLen}, got ${outputLen}`); - } - - const randomBytes = opts.randomBytes === undefined ? wcRandomBytes : opts.randomBytes; - const adjustScalarBytes = - opts.adjustScalarBytes === undefined - ? (bytes: TArg) => bytes as TRet - : opts.adjustScalarBytes; - const domain = - opts.domain === undefined - ? (data: TArg, ctx: TArg, phflag: boolean) => { - abool(phflag, 'phflag'); - if (ctx.length || phflag) throw new Error('Contexts/pre-hash are not supported'); - return data as TRet; - } - : opts.domain; // NOOP - - // Parse an EdDSA digest as a little-endian integer and reduce it modulo the scalar field order. - function modN_LE(hash: TArg): bigint { - return Fn.create(bytesToNumberLE(hash)); // Not Fn.fromBytes: it has length limit - } - - // Get the hashed private scalar per RFC8032 5.1.5 - function getPrivateScalar(key: TArg) { - const len = lengths.secretKey; - abytes(key, lengths.secretKey, 'secretKey'); - // Hash private key with curve's hash function to produce uniformingly random input - // Check byte lengths: ensure(64, h(ensure(32, key))) - const hashed = abytes(hash(key), 2 * len, 'hashedSecretKey'); - // Slice before clamping so in-place adjustors don't corrupt the prefix half. - const head = adjustScalarBytes(hashed.slice(0, len)); // clear first half bits, produce FE - const prefix = hashed.slice(len, 2 * len) as TRet; // second half is called key prefix (5.1.6) - const scalar = modN_LE(head); // The actual private scalar - return { head, prefix, scalar }; - } - - /** Convenience method that creates public key from scalar. RFC8032 5.1.5 - * Also exposes the derived scalar/prefix tuple and point form reused by sign(). - */ - function getExtendedPublicKey(secretKey: TArg) { - const { head, prefix, scalar } = getPrivateScalar(secretKey); - const point = BASE.multiply(scalar); // Point on Edwards curve aka public key - const pointBytes = point.toBytes() as TRet; - return { head, prefix, scalar, point, pointBytes }; - } - - /** Calculates EdDSA pub key. RFC8032 5.1.5. */ - function getPublicKey(secretKey: TArg): TRet { - return getExtendedPublicKey(secretKey).pointBytes; - } - - // Hash domain-separated chunks into a little-endian scalar modulo the group order. - function hashDomainToScalar( - context: TArg = Uint8Array.of(), - ...msgs: TArg - ) { - const msg = concatBytes(...msgs); - return modN_LE(hash(domain(msg, abytes(context, undefined, 'context'), !!prehash))); - } - - /** Signs message with secret key. RFC8032 5.1.6 */ - function sign( - msg: TArg, - secretKey: TArg, - options: TArg<{ context?: Uint8Array }> = {} - ): TRet { - msg = abytes(msg, undefined, 'message'); - if (prehash) msg = prehash(msg); // for ed25519ph etc. - const { prefix, scalar, pointBytes } = getExtendedPublicKey(secretKey); - const r = hashDomainToScalar(options.context, prefix, msg); // r = dom2(F, C) || prefix || PH(M) - // RFC 8032 5.1.6 allows r mod L = 0, and SUPERCOP ref10 accepts the resulting identity-point - // signature. - // We intentionally keep the safe multiply() rejection here so a miswired all-zero hash provider - // fails loudly instead of silently producing a degenerate signature. - const R = BASE.multiply(r).toBytes(); // R = rG - const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M) - const s = Fn.create(r + k * scalar); // S = (r + k * s) mod L - if (!Fn.isValid(s)) throw new Error('sign failed: invalid s'); // 0 <= s < L - const rs = concatBytes(R, Fn.toBytes(s)); - return abytes(rs, lengths.signature, 'result') as TRet; - } - - // Keep the shared helper strict by default: RFC 8032 / NIST-style wrappers should reject - // non-canonical encodings unless they explicitly opt into ZIP-215's more permissive decode rules. - const verifyOpts: TArg<{ context?: Uint8Array; zip215?: boolean }> = { - zip215: opts.zip215, - }; - - /** - * Verifies EdDSA signature against message and public key. RFC 8032 §§5.1.7 and 5.2.7. - * A cofactored verification equation is checked. - */ - function verify( - sig: TArg, - msg: TArg, - publicKey: TArg, - options = verifyOpts - ): boolean { - // Preserve the wrapper-selected default for `{}` / `{ zip215: undefined }`, not just omitted opts. - const { context } = options; - const zip215 = options.zip215 === undefined ? !!verifyOpts.zip215 : options.zip215; - const len = lengths.signature; - sig = abytes(sig, len, 'signature'); - msg = abytes(msg, undefined, 'message'); - publicKey = abytes(publicKey, lengths.publicKey, 'publicKey'); - if (zip215 !== undefined) abool(zip215, 'zip215'); - if (prehash) msg = prehash(msg); // for ed25519ph, etc - - const mid = len / 2; - const r = sig.subarray(0, mid); - const s = bytesToNumberLE(sig.subarray(mid, len)); - let A, R, SB; - try { - // ZIP-215 is more permissive than RFC 8032 / NIST186-5. Use it only for wrappers that - // explicitly want consensus-style unreduced encoding acceptance. - // zip215=true: 0 <= y < MASK (2^256 for ed25519) - // zip215=false: 0 <= y < P (2^255-19 for ed25519) - A = Point.fromBytes(publicKey, zip215); - R = Point.fromBytes(r, zip215); - SB = BASE.multiplyUnsafe(s); // 0 <= s < l is done inside - } catch (error) { - return false; - } - // RFC 8032 §§5.1.7/5.2.7 and FIPS 186-5 §§7.7.2/7.8.2 only decode A' and check the cofactored - // verification equation; they do not add a separate low-order-public-key rejection here. - // Strict mode still rejects small-order A' intentionally for SBS-style non-repudiation and to - // avoid ambiguous verification outcomes where unusual low-order keys can make distinct - // key/signature/message combinations verify. - if (!zip215 && A.isSmallOrder()) return false; - - // ZIP-215 accepts noncanonical / unreduced point encodings, so the challenge hash must use the - // exact signature/public-key bytes rather than canonicalized re-encodings of the decoded points. - const k = hashDomainToScalar(context, r, publicKey, msg); - const RkA = R.add(A.multiplyUnsafe(k)); - // Check the cofactored verification equation via the curve cofactor h. - // [h][S]B = [h]R + [h][k]A' - return RkA.subtract(SB).clearCofactor().is0(); - } - - const _size = Fp.BYTES; // 32 for ed25519, 57 for ed448 - const lengths = { - secretKey: _size, - publicKey: _size, - signature: 2 * _size, - seed: _size, - }; - function randomSecretKey(seed?: TArg): TRet { - seed = seed === undefined ? randomBytes(lengths.seed) : seed; - return abytes(seed, lengths.seed, 'seed') as TRet; - } - - function isValidSecretKey(key: TArg): boolean { - return isBytes(key) && key.length === lengths.secretKey; - } - - function isValidPublicKey(key: TArg, zip215?: boolean): boolean { - try { - // Preserve the wrapper-selected default for omitted / `undefined` ZIP-215 flags here too. - return !!Point.fromBytes(key, zip215 === undefined ? verifyOpts.zip215 : zip215); - } catch (error) { - return false; - } - } - - const utils = { - getExtendedPublicKey, - randomSecretKey, - isValidSecretKey, - isValidPublicKey, - /** - * Converts ed public key to x public key. Uses formula: - * - ed25519: - * - `(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)` - * - `(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))` - * - ed448: - * - `(u, v) = ((y-1)/(y+1), sqrt(156324)*u/x)` - * - `(x, y) = (sqrt(156324)*u/v, (1+u)/(1-u))` - */ - toMontgomery(publicKey: TArg): TRet { - const { y } = Point.fromBytes(publicKey); - const size = lengths.publicKey; - const is25519 = size === 32; - if (!is25519 && size !== 57) throw new Error('only defined for 25519 and 448'); - const u = is25519 ? Fp.div(_1n + y, _1n - y) : Fp.div(y - _1n, y + _1n); - return Fp.toBytes(u) as TRet; - }, - toMontgomerySecret(secretKey: TArg): TRet { - const size = lengths.secretKey; - abytes(secretKey, size); - const hashed = hash(secretKey.subarray(0, size)); - return adjustScalarBytes(hashed).subarray(0, size) as TRet; - }, - }; - Object.freeze(lengths); - Object.freeze(utils); - - return Object.freeze({ - keygen: createKeygen(randomSecretKey, getPublicKey), - getPublicKey, - sign, - verify, - utils, - Point, - lengths, - }) satisfies Signer; -} diff --git a/node_modules/@noble/curves/src/abstract/fft.ts b/node_modules/@noble/curves/src/abstract/fft.ts deleted file mode 100644 index 3edd51b..0000000 --- a/node_modules/@noble/curves/src/abstract/fft.ts +++ /dev/null @@ -1,854 +0,0 @@ -/** - * Experimental implementation of NTT / FFT (Fast Fourier Transform) over finite fields. - * API may change at any time. The code has not been audited. Feature requests are welcome. - * @module - */ -import type { TArg } from '../utils.ts'; -import type { IField } from './modular.ts'; - -/** Array-like coefficient storage that can be mutated in place. */ -export interface MutableArrayLike { - /** Element access by numeric index. */ - [index: number]: T; - /** Current amount of stored coefficients. */ - length: number; - /** - * Return a sliced copy using the same storage shape. - * @param start - Inclusive start index. - * @param end - Exclusive end index. - * @returns Sliced copy. - */ - slice(start?: number, end?: number): this; - /** - * Iterate over stored coefficients in order. - * @returns Coefficient iterator. - */ - [Symbol.iterator](): Iterator; -} - -/** - * Concrete polynomial containers accepted by the high-level `poly(...)` helpers. - * Lower-level FFT helpers can work with structural `MutableArrayLike`, but `poly(...)` - * intentionally keeps runtime dispatch on plain arrays and typed-array views. - */ -export type PolyStorage = T[] | (MutableArrayLike & ArrayBufferView); - -function checkU32(n: number) { - // 0xff_ff_ff_ff - if (!Number.isSafeInteger(n) || n < 0 || n > 0xffffffff) - throw new Error('wrong u32 integer:' + n); - return n; -} - -/** - * Checks if integer is in form of `1 << X`. - * @param x - Integer to inspect. - * @returns `true` when the value is a power of two. - * @throws If `x` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Validate that an FFT size is a power of two. - * - * ```ts - * isPowerOfTwo(8); - * ``` - */ -export function isPowerOfTwo(x: number): boolean { - checkU32(x); - return (x & (x - 1)) === 0 && x !== 0; -} - -/** - * @param n - Input value. - * @returns Next power of two within the u32/array-length domain. - * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Round an integer up to the FFT size it needs. - * - * ```ts - * nextPowerOfTwo(9); - * ``` - */ -export function nextPowerOfTwo(n: number): number { - checkU32(n); - if (n <= 1) return 1; - // FFT sizes here are used as JS array lengths, so `2^32` is not a meaningful result: - // keep the fast u32 bit-twiddling path and fail explicitly instead of wrapping to 1. - if (n > 0x8000_0000) throw new Error('nextPowerOfTwo overflow: result does not fit u32'); - return (1 << (log2(n - 1) + 1)) >>> 0; -} - -/** - * @param n - Value to reverse. - * @param bits - Number of bits to use. - * @returns Bit-reversed integer. - * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Reverse the low `bits` bits of one index. - * - * ```ts - * reverseBits(3, 3); - * ``` - */ -export function reverseBits(n: number, bits: number): number { - checkU32(n); - if (!Number.isSafeInteger(bits) || bits < 0 || bits > 32) - throw new Error(`expected integer 0 <= bits <= 32, got ${bits}`); - let reversed = 0; - for (let i = 0; i < bits; i++, n >>>= 1) reversed = (reversed << 1) | (n & 1); - // JS bitwise ops are signed i32; cast back so 32-bit reversals stay in the unsigned u32 domain. - return reversed >>> 0; -} - -/** - * Similar to `bitLen(x)-1` but much faster for small integers, like indices. - * @param n - Input value. - * @returns Base-2 logarithm. For `n = 0`, the current implementation returns `-1`. - * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error} - * @example - * Compute the radix-2 stage count for one transform size. - * - * ```ts - * log2(8); - * ``` - */ -export function log2(n: number): number { - checkU32(n); - return 31 - Math.clz32(n); -} - -/** - * Moves lowest bit to highest position, which at first step splits - * array on even and odd indices, then it applied again to each part, - * which is core of fft - * @param values - Mutable coefficient array. - * @returns Mutated input array. - * @throws If the array length is not a positive power of two. {@link Error} - * @example - * Reorder coefficients into bit-reversed order in place. - * - * ```ts - * const values = Uint8Array.from([0, 1, 2, 3]); - * bitReversalInplace(values); - * ``` - */ -export function bitReversalInplace>(values: T): T { - const n = values.length; - // Size-1 FFT is the identity, so bit-reversal must stay a no-op there instead of rejecting it. - if (!isPowerOfTwo(n)) throw new Error('expected positive power-of-two length, got ' + n); - const bits = log2(n); - for (let i = 0; i < n; i++) { - const j = reverseBits(i, bits); - if (i < j) { - const tmp = values[i]; - values[i] = values[j]; - values[j] = tmp; - } - } - return values; -} - -/** - * @param values - Input values. - * @returns Reordered copy. - * @throws If the array length is not a positive power of two. {@link Error} - * @example - * Return a reordered copy instead of mutating the input in place. - * - * ```ts - * const reordered = bitReversalPermutation([0, 1, 2, 3]); - * ``` - */ -export function bitReversalPermutation(values: T[]): T[] { - return bitReversalInplace(values.slice()) as T[]; -} - -const _1n = /** @__PURE__ */ BigInt(1); -function findGenerator(field: TArg>) { - let G = BigInt(2); - for (; field.eql(field.pow(G, field.ORDER >> _1n), field.ONE); G++); - return G; -} - -/** Cached roots-of-unity tables derived from one finite field. */ -export type RootsOfUnity = { - /** Generator and 2-adicity metadata for the cached field. */ - info: { G: bigint; oddFactor: bigint; powerOfTwo: number }; - /** - * Return the natural-order roots of unity for one radix-2 size. - * @param bits - Transform size as `log2(N)`. - * @returns Natural-order roots for that size. - */ - roots: (bits: number) => bigint[]; - /** - * Return the bit-reversal permutation of the roots for one radix-2 size. - * @param bits - Transform size as `log2(N)`. - * @returns Bit-reversed roots. - */ - brp(bits: number): bigint[]; - /** - * Return the inverse roots of unity for one radix-2 size. - * @param bits - Transform size as `log2(N)`. - * @returns Inverse roots. - */ - inverse(bits: number): bigint[]; - /** - * Return one primitive root used by a radix-2 stage. - * @param bits - Transform size as `log2(N)`. - * @returns Primitive root for that stage. - */ - omega: (bits: number) => bigint; - /** - * Drop all cached root tables. - * @returns Nothing. - */ - clear: () => void; -}; -/** - * We limit roots up to 2**31, which is a lot: 2-billion polynomimal should be rare. - * @param field - Field implementation. - * @param generator - Optional generator override. - * @returns Roots-of-unity cache. - * @example - * Cache roots once, then ask for the omega table of one FFT size. - * - * ```ts - * import { rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const roots = rootsOfUnity(Field(17n)); - * const omega = roots.omega(4); - * ``` - */ -export function rootsOfUnity(field: TArg>, generator?: bigint): RootsOfUnity { - // Factor field.ORDER-1 as oddFactor * 2^powerOfTwo - let oddFactor = field.ORDER - _1n; - let powerOfTwo = 0; - for (; (oddFactor & _1n) !== _1n; powerOfTwo++, oddFactor >>= _1n); - - // Find non quadratic residue - let G = generator !== undefined ? BigInt(generator) : findGenerator(field); - // Powers of generator - const omegas: bigint[] = new Array(powerOfTwo + 1); - omegas[powerOfTwo] = field.pow(G, oddFactor); - for (let i = powerOfTwo; i > 0; i--) omegas[i - 1] = field.sqr(omegas[i]); - // Compute all roots of unity for powers up to maxPower - const rootsCache: bigint[][] = []; - const checkBits = (bits: number) => { - checkU32(bits); - if (bits > 31 || bits > powerOfTwo) - throw new Error('rootsOfUnity: wrong bits ' + bits + ' powerOfTwo=' + powerOfTwo); - return bits; - }; - const precomputeRoots = (maxPower: number) => { - checkBits(maxPower); - for (let power = maxPower; power >= 0; power--) { - if (rootsCache[power]) continue; // Skip if we've already computed roots for this power - const rootsAtPower: bigint[] = []; - for (let j = 0, cur = field.ONE; j < 2 ** power; j++, cur = field.mul(cur, omegas[power])) - rootsAtPower.push(cur); - rootsCache[power] = rootsAtPower; - } - return rootsCache[maxPower]; - }; - const brpCache = new Map(); - const inverseCache = new Map(); - // roots()/brp()/inverse() expose shared cached arrays by reference for speed; callers must treat them as read-only. - - // NOTE: we use bits instead of power, because power = 2**bits, - // but power is not neccesary isPowerOfTwo(power)! - return { - info: { G, powerOfTwo, oddFactor }, - roots: (bits: number): bigint[] => { - const b = checkBits(bits); - return precomputeRoots(b); - }, - brp(bits: number): bigint[] { - const b = checkBits(bits); - if (brpCache.has(b)) return brpCache.get(b)!; - else { - const res = bitReversalPermutation(this.roots(b)); - brpCache.set(b, res); - return res; - } - }, - inverse(bits: number): bigint[] { - const b = checkBits(bits); - if (inverseCache.has(b)) return inverseCache.get(b)!; - else { - const res = field.invertBatch(this.roots(b)); - inverseCache.set(b, res); - return res; - } - }, - omega: (bits: number): bigint => omegas[checkBits(bits)], - clear: (): void => { - rootsCache.splice(0, rootsCache.length); - brpCache.clear(); - inverseCache.clear(); - }, - }; -} - -/** Polynomial coefficient container used by the FFT helpers. */ -export type Polynomial = MutableArrayLike; - -/** - * Arithmetic operations used by the generic FFT implementation. - * - * Maps great to Field, but not to Group (EC points): - * - inv from scalar field - * - we need multiplyUnsafe here, instead of multiply for speed - * - multiplyUnsafe is safe in the context: we do mul(rootsOfUnity), which are public and sparse - */ -export type FFTOpts = { - /** - * Add two coefficients. - * @param a - Left coefficient. - * @param b - Right coefficient. - * @returns Sum coefficient. - */ - add: (a: T, b: T) => T; - /** - * Subtract two coefficients. - * @param a - Left coefficient. - * @param b - Right coefficient. - * @returns Difference coefficient. - */ - sub: (a: T, b: T) => T; - /** - * Multiply one coefficient by a scalar/root factor. - * @param a - Coefficient value. - * @param scalar - Scalar/root factor. - * @returns Scaled coefficient. - */ - mul: (a: T, scalar: R) => T; - /** - * Invert one scalar/root factor. - * @param a - Scalar/root factor. - * @returns Inverse factor. - */ - inv: (a: R) => R; -}; - -/** Configuration for one low-level FFT loop. */ -export type FFTCoreOpts = { - /** Transform size. Must be a power of two. */ - N: number; - /** Stage roots for the selected transform size. */ - roots: Polynomial; - /** Whether to run the DIT variant instead of DIF. */ - dit: boolean; - /** Whether to invert butterfly placement for decode-oriented layouts. */ - invertButterflies?: boolean; - /** Number of initial stages to skip. */ - skipStages?: number; - /** Whether to apply bit-reversal permutation at the boundary. */ - brp?: boolean; -}; - -/** - * Callable low-level FFT loop over one polynomial storage shape. - * @param values - Polynomial coefficients to transform in place. - * @returns The mutated input polynomial. - */ -export type FFTCoreLoop =

>(values: P) => P; - -/** - * Constructs different flavors of FFT. radix2 implementation of low level mutating API. Flavors: - * - * - DIT (Decimation-in-Time): Bottom-Up (leaves to root), Cool-Turkey - * - DIF (Decimation-in-Frequency): Top-Down (root to leaves), Gentleman-Sande - * - * DIT takes brp input, returns natural output. - * DIF takes natural input, returns brp output. - * - * The output is actually identical. Time / frequence distinction is not meaningful - * for Polynomial multiplication in fields. - * Which means if protocol supports/needs brp output/inputs, then we can skip this step. - * - * Cyclic NTT: Rq = Zq[x]/(x^n-1). butterfly_DIT+loop_DIT OR butterfly_DIF+loop_DIT, roots are omega - * Negacyclic NTT: Rq = Zq[x]/(x^n+1). butterfly_DIT+loop_DIF, at least for mlkem / mldsa - * @param F - Field operations. - * @param coreOpts - FFT configuration: - * - `N`: Transform size. Must be a power of two. - * - `roots`: Stage roots for the selected transform size. - * - `dit`: Whether to run the DIT variant instead of DIF. - * - `invertButterflies` (optional): Whether to invert butterfly placement. - * - `skipStages` (optional): Number of initial stages to skip. - * - `brp` (optional): Whether to apply bit-reversal permutation at the boundary. - * @returns Low-level FFT loop. - * @throws If the FFT options or cached roots are invalid for the requested size. {@link Error} - * @example - * Constructs different flavors of FFT. - * - * ```ts - * import { FFTCore, rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const roots = rootsOfUnity(Fp).roots(2); - * const loop = FFTCore(Fp, { N: 4, roots, dit: true }); - * const values = loop([1n, 2n, 3n, 4n]); - * ``` - */ -export const FFTCore = (F: FFTOpts, coreOpts: FFTCoreOpts): FFTCoreLoop => { - const { N, roots, dit, invertButterflies = false, skipStages = 0, brp = true } = coreOpts; - const bits = log2(N); - if (!isPowerOfTwo(N)) throw new Error('FFT: Polynomial size should be power of two'); - // Wrong-sized root tables can stay in-bounds for some loop shapes and silently compute nonsense. - if (roots.length !== N) - throw new Error(`FFT: wrong roots length: expected ${N}, got ${roots.length}`); - const isDit = dit !== invertButterflies; - isDit; - return

>(values: P): P => { - if (values.length !== N) throw new Error('FFT: wrong Polynomial length'); - if (dit && brp) bitReversalInplace(values); - for (let i = 0, g = 1; i < bits - skipStages; i++) { - // For each stage s (sub-FFT length m = 2^s) - const s = dit ? i + 1 + skipStages : bits - i; - const m = 1 << s; - const m2 = m >> 1; - const stride = N >> s; - // Loop over each subarray of length m - for (let k = 0; k < N; k += m) { - // Loop over each butterfly within the subarray - for (let j = 0, grp = g++; j < m2; j++) { - const rootPos = invertButterflies ? (dit ? N - grp : grp) : j * stride; - const i0 = k + j; - const i1 = k + j + m2; - const omega = roots[rootPos]; - const b = values[i1]; - const a = values[i0]; - // Inlining gives us 10% perf in kyber vs functions - if (isDit) { - const t = F.mul(b, omega); // Standard DIT butterfly - values[i0] = F.add(a, t); - values[i1] = F.sub(a, t); - } else if (invertButterflies) { - values[i0] = F.add(b, a); // DIT loop + inverted butterflies (Kyber decode) - values[i1] = F.mul(F.sub(b, a), omega); - } else { - values[i0] = F.add(a, b); // Standard DIF butterfly - values[i1] = F.mul(F.sub(a, b), omega); - } - } - } - } - if (!dit && brp) bitReversalInplace(values); - return values; - }; -}; - -/** Forward and inverse FFT helpers for one coefficient domain. */ -export type FFTMethods = { - /** - * Apply the forward transform. - * @param values - Polynomial coefficients to transform. - * @param brpInput - Whether the input is already bit-reversed. - * @param brpOutput - Whether to keep the output bit-reversed. - * @returns Transformed copy. - */ - direct

>(values: P, brpInput?: boolean, brpOutput?: boolean): P; - /** - * Apply the inverse transform. - * @param values - Polynomial coefficients to transform. - * @param brpInput - Whether the input is already bit-reversed. - * @param brpOutput - Whether to keep the output bit-reversed. - * @returns Inverse-transformed copy. - */ - inverse

>(values: P, brpInput?: boolean, brpOutput?: boolean): P; -}; - -/** - * NTT aka FFT over finite field (NOT over complex numbers). - * Naming mirrors other libraries. - * @param roots - Roots-of-unity cache. - * @param opts - Field operations. See {@link FFTOpts}. - * @returns Forward and inverse FFT helpers. - * @example - * NTT aka FFT over finite field (NOT over complex numbers). - * - * ```ts - * import { FFT, rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const fft = FFT(rootsOfUnity(Fp), Fp); - * const values = fft.direct([1n, 2n, 3n, 4n]); - * ``` - */ -export function FFT(roots: RootsOfUnity, opts: FFTOpts): FFTMethods { - const getLoop = ( - N: number, - roots: Polynomial, - brpInput = false, - brpOutput = false - ): (

>(values: P) => P) => { - if (brpInput && brpOutput) { - // we cannot optimize this case, but lets support it anyway - return (values) => - FFTCore(opts, { N, roots, dit: false, brp: false })(bitReversalInplace(values)); - } - if (brpInput) return FFTCore(opts, { N, roots, dit: true, brp: false }); - if (brpOutput) return FFTCore(opts, { N, roots, dit: false, brp: false }); - return FFTCore(opts, { N, roots, dit: true, brp: true }); // all natural - }; - return { - direct

>(values: P, brpInput = false, brpOutput = false): P { - const N = values.length; - if (!isPowerOfTwo(N)) throw new Error('FFT: Polynomial size should be power of two'); - const bits = log2(N); - return getLoop(N, roots.roots(bits), brpInput, brpOutput)

(values.slice()); - }, - inverse

>(values: P, brpInput = false, brpOutput = false): P { - const N = values.length; - if (!isPowerOfTwo(N)) throw new Error('FFT: Polynomial size should be power of two'); - const bits = log2(N); - const res = getLoop(N, roots.inverse(bits), brpInput, brpOutput)(values.slice()); - const ivm = opts.inv(BigInt(values.length)); // scale - // we can get brp output if we use dif instead of dit! - for (let i = 0; i < res.length; i++) res[i] = opts.mul(res[i], ivm); - // Allows to re-use non-inverted roots, but is VERY fragile - // return [res[0]].concat(res.slice(1).reverse()); - // inverse calculated as pow(-1), which transforms into ω^{-kn} (-> reverses indices) - return res; - }, - }; -} - -/** - * Factory that allocates one polynomial storage container. - * Callers must ensure `_create(len)` returns field-zero-filled storage when `elm` is omitted, - * because the quadratic `mul()` / `convolve()` paths and the Kronecker-δ shortcut in - * `lagrange.basis()` rely on that default instead of always passing `field.ZERO` explicitly. - * @param len - Requested amount of coefficients. - * @param elm - Optional fill value. - * @returns Newly allocated polynomial container. - */ -export type CreatePolyFn

, T> = (len: number, elm?: T) => P; - -/** High-level polynomial helpers layered on top of FFT and field arithmetic. */ -export type PolyFn

, T> = { - /** Roots-of-unity cache used by the helper namespace. */ - roots: RootsOfUnity; - /** Factory used to allocate new polynomial containers. */ - create: CreatePolyFn; - /** Optional enforced polynomial length. */ - length?: number; - - /** - * Compute the polynomial degree. - * @param a - Polynomial coefficients. - * @returns Polynomial degree. - */ - degree: (a: P) => number; - /** - * Extend or truncate one polynomial to a requested length. - * @param a - Polynomial coefficients. - * @param len - Target length. - * @returns Resized polynomial. - */ - extend: (a: P, len: number) => P; - /** - * Add two polynomials coefficient-wise. - * @param a - Left polynomial. - * @param b - Right polynomial. - * @returns Sum polynomial. - */ - add: (a: P, b: P) => P; - /** - * Subtract two polynomials coefficient-wise. - * @param a - Left polynomial. - * @param b - Right polynomial. - * @returns Difference polynomial. - */ - sub: (a: P, b: P) => P; - /** - * Multiply by another polynomial or by one scalar. - * @param a - Left polynomial. - * @param b - Right polynomial or scalar. - * @returns Product polynomial. - */ - mul: (a: P, b: P | T) => P; - /** - * Multiply coefficients point-wise. - * @param a - Left polynomial. - * @param b - Right polynomial. - * @returns Point-wise product polynomial. - */ - dot: (a: P, b: P) => P; - /** - * Multiply two polynomials with convolution. - * @param a - Left polynomial. - * @param b - Right polynomial. - * @returns Convolution product. - */ - convolve: (a: P, b: P) => P; - /** - * Apply a point-wise coefficient shift by powers of one factor. - * @param p - Polynomial coefficients. - * @param factor - Shift factor. - * @returns Shifted polynomial. - */ - shift: (p: P, factor: bigint) => P; - /** - * Clone one polynomial container. - * @param a - Polynomial coefficients. - * @returns Cloned polynomial. - */ - clone: (a: P) => P; - /** - * Evaluate one polynomial on a basis vector. - * @param a - Polynomial coefficients. - * @param basis - Basis vector. - * @returns Evaluated field element. - */ - eval: (a: P, basis: P) => T; - /** Helpers for monomial-basis polynomials. */ - monomial: { - /** Build the monomial basis vector for one evaluation point. */ - basis: (x: T, n: number) => P; - /** Evaluate a polynomial in the monomial basis. */ - eval: (a: P, x: T) => T; - }; - /** Helpers for Lagrange-basis polynomials. */ - lagrange: { - /** Build the Lagrange basis vector for one evaluation point. */ - basis: (x: T, n: number, brp?: boolean) => P; - /** Evaluate a polynomial in the Lagrange basis. */ - eval: (a: P, x: T, brp?: boolean) => T; - }; - /** - * Build the vanishing polynomial for a root set. - * @param roots - Root set. - * @returns Vanishing polynomial. - */ - vanishing: (roots: P) => P; -}; - -/** - * Poly wants a cracker. - * - * Polynomials are functions like `y=f(x)`, which means when we multiply two polynomials, result is - * function `f3(x) = f1(x) * f2(x)`, we don't multiply values. Key takeaways: - * - * - **Polynomial** is an array of coefficients: `f(x) = sum(coeff[i] * basis[i](x))` - * - **Basis** is array of functions - * - **Monominal** is Polynomial where `basis[i](x) == x**i` (powers) - * - **Array size** is domain size - * - **Lattice** is matrix (Polynomial of Polynomials) - * @param field - Field implementation. - * @param roots - Roots-of-unity cache. - * @param create - Optional polynomial factory. Runtime input validation accepts only plain `Array` - * and typed-array polynomial containers; arbitrary structural wrappers are intentionally rejected. - * @param fft - Optional FFT implementation. - * @param length - Optional fixed polynomial length. - * @returns Polynomial helper namespace. - * @example - * Build polynomial helpers, then convolve two coefficient arrays. - * - * ```ts - * import { poly, rootsOfUnity } from '@noble/curves/abstract/fft.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const poly17 = poly(Fp, rootsOfUnity(Fp)); - * const product = poly17.convolve([1n, 2n], [3n, 4n]); - * ``` - */ -export function poly( - field: TArg>, - roots: RootsOfUnity, - create?: undefined, - fft?: FFTMethods, - length?: number -): PolyFn; -export function poly>( - field: TArg>, - roots: RootsOfUnity, - create: CreatePolyFn, - fft?: FFTMethods, - length?: number -): PolyFn; -export function poly>( - field: TArg>, - roots: RootsOfUnity, - create?: CreatePolyFn, - fft?: FFTMethods, - length?: number -): PolyFn { - const F = field as IField; - const _create = - create || - (((len: number, elm?: T): T[] => new Array(len).fill(elm ?? F.ZERO)) as CreatePolyFn); - - // `poly.mul(a, b)` distinguishes polynomial-vs-scalar at runtime, so keep accepted - // polynomial containers concrete instead of trying to support arbitrary wrappers. - const isPoly = (x: any): x is P => { - if (Array.isArray(x)) return true; - if (!ArrayBuffer.isView(x)) return false; - const v = x as unknown as ArrayLike & { slice?: unknown; [Symbol.iterator]?: unknown }; - return ( - typeof v.length === 'number' && - typeof v.slice === 'function' && - typeof v[Symbol.iterator] === 'function' - ); - }; - const checkLength = (...lst: P[]): number => { - if (!lst.length) return 0; - for (const i of lst) if (!isPoly(i)) throw new Error('poly: not polynomial: ' + i); - const L = lst[0].length; - for (let i = 1; i < lst.length; i++) - if (lst[i].length !== L) throw new Error(`poly: mismatched lengths ${L} vs ${lst[i].length}`); - if (length !== undefined && L !== length) - throw new Error(`poly: expected fixed length ${length}, got ${L}`); - return L; - }; - function findOmegaIndex(x: T, n: number, brp = false): number { - const bits = log2(n); - const omega = brp ? roots.brp(bits) : roots.roots(bits); - for (let i = 0; i < n; i++) if (F.eql(x, omega[i] as T)) return i; - return -1; - } - // TODO: mutating versions for mlkem/mldsa - return { - roots, - create: _create, - length, - extend: (a: P, len: number): P => { - checkLength(a); - const out = _create(len, F.ZERO); - // Plain arrays grow when writing past `out.length`, so cap the copy explicitly to keep - // `extend()` consistent with typed arrays and with its documented truncate behavior. - for (let i = 0; i < Math.min(a.length, len); i++) out[i] = a[i]; - return out; - }, - degree: (a: P): number => { - checkLength(a); - for (let i = a.length - 1; i >= 0; i--) if (!F.is0(a[i])) return i; - return -1; - }, - add: (a: P, b: P): P => { - const len = checkLength(a, b); - const out = _create(len); - for (let i = 0; i < len; i++) out[i] = F.add(a[i], b[i]); - return out; - }, - sub: (a: P, b: P): P => { - const len = checkLength(a, b); - const out = _create(len); - for (let i = 0; i < len; i++) out[i] = F.sub(a[i], b[i]); - return out; - }, - dot: (a: P, b: P): P => { - const len = checkLength(a, b); - const out = _create(len); - for (let i = 0; i < len; i++) out[i] = F.mul(a[i], b[i]); - return out; - }, - mul: (a: P, b: P | T): P => { - if (isPoly(b)) { - const len = checkLength(a, b); - if (fft) { - const A = fft.direct(a, false, true); - const B = fft.direct(b, false, true); - for (let i = 0; i < A.length; i++) A[i] = F.mul(A[i], B[i]); - return fft.inverse(A, true, false) as P; - } else { - // NOTE: this is quadratic and mostly for compat tests with FFT - const res = _create(len); - for (let i = 0; i < len; i++) { - for (let j = 0; j < len; j++) { - const k = (i + j) % len; // wrap mod length - res[k] = F.add(res[k], F.mul(a[i], b[j])); - } - } - return res; - } - } else { - const out = _create(checkLength(a)); - for (let i = 0; i < out.length; i++) out[i] = F.mul(a[i], b); - return out; - } - }, - convolve(a: P, b: P): P { - const len = nextPowerOfTwo(a.length + b.length - 1); - return this.mul(this.extend(a, len), this.extend(b, len)); - }, - shift(p: P, factor: bigint): P { - const out = _create(checkLength(p)); - out[0] = p[0]; - for (let i = 1, power = F.ONE; i < p.length; i++) { - power = F.mul(power, factor); - out[i] = F.mul(p[i], power); - } - return out; - }, - clone: (a: P): P => { - checkLength(a); - const out = _create(a.length); - for (let i = 0; i < a.length; i++) out[i] = a[i]; - return out; - }, - eval: (a: P, basis: P): T => { - checkLength(a, basis); - let acc = F.ZERO; - for (let i = 0; i < a.length; i++) acc = F.add(acc, F.mul(a[i], basis[i])); - return acc; - }, - monomial: { - basis: (x: T, n: number): P => { - const out = _create(n); - let pow = F.ONE; - for (let i = 0; i < n; i++) { - out[i] = pow; - pow = F.mul(pow, x); - } - return out; - }, - eval: (a: P, x: T): T => { - checkLength(a); - // Same as eval(a, monomialBasis(x, a.length)), but it is faster this way - let acc = F.ZERO; - for (let i = a.length - 1; i >= 0; i--) acc = F.add(F.mul(acc, x), a[i]); - return acc; - }, - }, - lagrange: { - basis: (x: T, n: number, brp = false, weights?: P): P => { - const bits = log2(n); - const cache = weights || (brp ? roots.brp(bits) : roots.roots(bits)); // [ω⁰, ω¹, ..., ωⁿ⁻¹] - const out = _create(n); - // Fast Kronecker-δ shortcut - const idx = findOmegaIndex(x, n, brp); - if (idx !== -1) { - out[idx] = F.ONE; - return out; - } - const tm = F.pow(x, BigInt(n)); - const c = F.mul(F.sub(tm, F.ONE), F.inv(BigInt(n) as T)); // c = (xⁿ - 1)/n - const denom = _create(n); - for (let i = 0; i < n; i++) denom[i] = F.sub(x, cache[i] as T); - const inv = F.invertBatch(denom as any as T[]); - for (let i = 0; i < n; i++) out[i] = F.mul(c, F.mul(cache[i] as T, inv[i])); - return out; - }, - eval(a: P, x: T, brp = false): T { - checkLength(a); - const idx = findOmegaIndex(x, a.length, brp); - if (idx !== -1) return a[idx]; // fast path - const L = this.basis(x, a.length, brp); // Lᵢ(x) - let acc = F.ZERO; - for (let i = 0; i < a.length; i++) if (!F.is0(a[i])) acc = F.add(acc, F.mul(a[i], L[i])); - return acc; - }, - }, - vanishing(roots: P): P { - checkLength(roots); - const out = _create(roots.length + 1, F.ZERO); - out[0] = F.ONE; - for (const r of roots) { - const neg = F.neg(r); - for (let j = out.length - 1; j > 0; j--) out[j] = F.add(F.mul(out[j], neg), out[j - 1]); - out[0] = F.mul(out[0], neg); - } - return out; - }, - }; -} diff --git a/node_modules/@noble/curves/src/abstract/frost.ts b/node_modules/@noble/curves/src/abstract/frost.ts deleted file mode 100644 index 6189b51..0000000 --- a/node_modules/@noble/curves/src/abstract/frost.ts +++ /dev/null @@ -1,1092 +0,0 @@ -/** - * FROST: Flexible Round-Optimized Schnorr Threshold Protocol for Two-Round Schnorr Signatures. - * - * See [RFC 9591](https://datatracker.ietf.org/doc/rfc9591/) and [frost.zfnd.org](https://frost.zfnd.org). - * @module - */ -import { utf8ToBytes } from '@noble/hashes/utils.js'; -import { - bytesToHex, - bytesToNumberBE, - bytesToNumberLE, - concatBytes, - hexToBytes, - randomBytes, - validateObject, - type TArg, - type TRet, -} from '../utils.ts'; -import { pippenger, validatePointCons, type CurvePoint, type CurvePointCons } from './curve.ts'; -import { poly, type RootsOfUnity } from './fft.ts'; -import { type H2CDSTOpts } from './hash-to-curve.ts'; -import { getMinHashLength, mapHashToField, type IField } from './modular.ts'; - -export type RNG = typeof randomBytes; -export type Identifier = string; // Identifiers are hex to make comparison easier -export type Commitment = Uint8Array; // serialized point -export type Coefficient = Uint8Array; // serialized scalar -export type Signature = Uint8Array; -export type Signers = { min: number; max: number }; -export type SecretKey = Uint8Array; // Secret key -export type Bytes = Uint8Array; -type Point = Uint8Array; - -export type DKG_Round1 = { - // If identifiers were assigned via fromNumber before, it is worth checking - // that a party doesn't impersonate another one. - // But we throw on duplicate identifiers. - identifier: Identifier; - commitment: TRet; // sender identifier - proofOfKnowledge: TRet; -}; -export type DKG_Round2 = { - identifier: Identifier; // sender identifier - signingShare: TRet; -}; -// This is internal, so we can use bigints -export type DKG_Secret = { - identifier: bigint; - coefficients?: bigint[]; - commitment: TRet; - signers: Signers; - // Keep the local polynomial until round3 succeeds so late DKG failures can be retried. - step?: 1 | 2 | 3; -}; - -export type FrostPublic = { - signers: Signers; - commitments: TRet; // Point[], where commitments[0] is the group public key - verifyingShares: TRet>; // id -> Point -}; -export type FrostSecret = { - identifier: Identifier; - signingShare: TRet; // Scalar -}; -export type Key = { public: FrostPublic; secret: FrostSecret }; -export type DealerShares = { - public: FrostPublic; - secretShares: Record; -}; -// Sign stuff -export type Nonces = { - hiding: TRet; // Scalar - binding: TRet; // Scalar -}; -export type NonceCommitments = { - identifier: Identifier; - hiding: TRet; // Point - binding: TRet; // Point -}; -export type GenNonce = { - nonces: Nonces; - commitments: NonceCommitments; -}; - -export interface FROSTPoint> extends CurvePoint { - add(rhs: T): T; - multiply(rhs: bigint): T; - equals(rhs: T): boolean; - toBytes(compressed?: boolean): Bytes; - clearCofactor(): T; -} -export interface FROSTPointConstructor> extends CurvePointCons { - fromBytes(a: Bytes): T; - Fn: IField; -} - -// Opts -export type FrostOpts

> = { - readonly name: string; - readonly Point: FROSTPointConstructor

; - readonly Fn?: IField; - /** Optional suite hook that tightens canonical decoding with subgroup / identity checks. */ - readonly validatePoint?: (p: P) => void; - /** Optional public-key parser. Implementations MUST preserve the same subgroup / identity policy - * as `validatePoint`, because this bypasses generic canonical decoding in `parsePoint()`. */ - readonly parsePublicKey?: (bytes: TArg) => P; - readonly hash: (msg: TArg) => TRet; - /** Custom scalar hash hook. Implementations MUST treat `msg` and `options` as read-only. */ - readonly hashToScalar?: (msg: TArg, options?: TArg) => bigint; - // Hacks for taproot support - readonly adjustScalar?: (n: bigint) => bigint; - readonly adjustPoint?: (n: P) => P; - readonly challenge?: (R: P, PK: P, msg: TArg) => bigint; - readonly adjustNonces?: (PK: P, nonces: TArg) => TRet; - readonly adjustSecret?: (secret: TArg, pub: TArg) => TRet; - readonly adjustPublic?: (pub: TArg) => TRet; - readonly adjustGroupCommitmentShare?: (GC: P, GCShare: P) => P; - readonly adjustTx?: { - readonly encode: (tx: TArg) => TRet; - readonly decode: (tx: TArg) => TRet; - }; - readonly adjustDKG?: (k: TArg) => TRet; - // Hash function prefixes - readonly H1?: string; - readonly H2?: string; - readonly H3?: string; - readonly H4?: string; - readonly H5?: string; - readonly HDKG?: string; - readonly HID?: string; -}; - -/** - * FROST: Threshold Protocol for Two‑Round Schnorr Signatures - * from [RFC 9591](https://datatracker.ietf.org/doc/rfc9591/). - */ -export type FROST = { - /** - * Methods to construct participant identifiers. - */ - Identifier: { - /** - * Constructs an identifier from a numeric index. - * @param n - A positive integer. - * @returns A canonical serialized Identifier. - */ - fromNumber(n: number): Identifier; - /** - * Derives an identifier deterministically from a string (e.g. an email). - * @param s - Arbitrary string. - * @returns A canonical serialized Identifier. - */ - derive(s: string): Identifier; - }; - /** - * Distributed Key Generation (DKG) protocol interface. - * RFC 9591 leaves DKG out of scope; Appendix C only specifies dealer/VSS key generation. - * These helpers follow the split-round API used by frost-rs for interoperable testing. - */ - DKG: { - /** - * Generates the first round of DKG. - * @param id - Participant's identifier. - * @param signers - Set of all participants (min/max threshold). - * @param secret - Optional initial secret scalar. - * @param rng - Optional RNG for nonce generation. - * @returns Public broadcast and private DKG state. The returned `secret` package is mutable - * round state that will be consumed by `round2()` and `round3()`. - */ - round1: ( - id: Identifier, - signers: Signers, - secret?: TArg, - rng?: RNG - ) => { - public: DKG_Round1; - secret: DKG_Secret; - }; - /** - * Executes DKG round 2 given public round1 data from others. - * @param secret - Private DKG state from round1. This mutates `secret.step` in place. - * @param others - Public round1 broadcasts from other participants. - * @returns A map of round2 messages to be sent to others. - */ - round2: ( - secret: TArg, - others: TArg - ) => TRet>; - /** - * Finalizes key generation in round3 using received round1 + round2 messages. - * @param secret - Private DKG state. This consumes the remaining local polynomial coefficients - * and transitions the package to its final post-round3 state. - * @param round1 - Public round1 broadcasts from all participants. - * @param round2 - Round2 messages received from others. - * @returns Final secret/public key information for the participant. - * Callers MUST pass the same verified remote `round1` package set that was already - * accepted in `round2()`, rather than re-fetching or rebuilding it from the network. - */ - round3: ( - secret: TArg, - round1: TArg, - round2: TArg - ) => TRet; - /** - * Best-effort erasure of internal secret state. Bigint/JIT copies may still survive outside the - * local object even after cleanup. - * @param secret - Private DKG state from round1. - */ - clean(secret: TArg): void; - }; - /** - * Trusted dealer mode: generates key shares from a central trusted authority. - * Mirrors RFC 9591 Appendix C and returns one shared VSS commitment package - * plus per-participant shares. - * @param signers - Threshold parameters (min/max). - * @param identifiers - Optional explicit participant list. - * @param secret - Optional secret scalar. - * @param rng - Optional RNG. - * @returns One shared public package plus the participant secret-share packages. - */ - trustedDealer( - signers: Signers, - identifiers?: Identifier[], - secret?: TArg, - rng?: RNG - ): TRet; - /** - * Validates the consistency of a secret share against the shared public commitments. - * This is the RFC 9591 Appendix C.2 `vss_verify` check against the shared dealer/DKG commitment. - * It does not relax RFC 9591 Section 3.1: public identity elements are still invalid even when - * the scalar/share algebra would otherwise be self-consistent. - * Throws if invalid. - * @param secret - A FrostSecret containing identifier and signing share. - * @param pub - Shared public package containing commitments. - */ - validateSecret(secret: TArg, pub: TArg): void; - /** - * Produces nonces and public commitments used in signing. - * RFC 9591 Section 5.1 `commit()`. - * @param secret - Participant's secret share. - * @param rng - Optional RNG. - * @returns Nonce values and their public commitments. - * Returned nonces are one-time-use and MUST NOT be reused across signing sessions. - * This API does not mutate or zeroize caller-owned nonce objects. - */ - commit(secret: TArg, rng?: RNG): TRet; - /** - * Signs a message using the participant's secret and nonce. - * @param secret - Participant's secret share. - * @param pub - Shared public package containing commitments. - * @param nonces - Participant's nonce pair. - * @param commitmentList - Commitments from all signing participants. - * @param msg - Message to be signed. - * @returns Signature share as a byte array. - * RFC 9591 Sections 4.1/5.1 require round-one commitments to be one-time-use, and - * Section 5.2 signs with the nonce corresponding to that published commitment. - * The caller MUST pass fresh nonces from `commit()`. On successful signing, this helper - * consumes the caller-owned nonce object by zeroing both nonce byte arrays in place. - * Later calls reject an all-zero nonce package, so same-object reuse fails closed and an - * accidentally generated zero nonce package is not silently used for signing. - */ - signShare( - secret: TArg, - pub: TArg, - nonces: TArg, - commitmentList: TArg, - msg: TArg - ): TRet; - /** - * Verifies a signature share against public commitments. - * Matches the coordinator-side individual-share verification from RFC 9591 Section 5.4. - * @param pub - Group public key information. - * @param commitmentList - Commitments from all signing participants. - * @param msg - Message being signed. - * @param identifier - Identifier of the signer whose share is being verified. - * @param sigShare - Signature share to verify. - * @returns True if valid, false otherwise. - */ - verifyShare( - pub: TArg, - commitmentList: TArg, - msg: TArg, - identifier: Identifier, - sigShare: TArg - ): boolean; - /** - * Aggregates signature shares into a full signature. - * RFC 9591 Section 5.3 `aggregate()`. - * @param pub - Group public key. - * @param commitmentList - Nonce commitments from all signers. - * @param msg - Message to sign. - * @param sigShares - Map from identifier to their signature share. - * @returns Final aggregated signature. - */ - aggregate( - pub: TArg, - commitmentList: TArg, - msg: TArg, - sigShares: TArg> - ): TRet; - /** - * Signs a message using a raw secret key (e.g. from combineSecret). - * @param msg - Message to sign. - * @param secretKey - Group secret key as bytes. - * @returns Signature bytes. - */ - sign(msg: TArg, secretKey: TArg): TRet; - /** - * Verifies a full signature against the group public key. - * @param sig - Signature bytes. - * @param msg - Message that was signed. - * @param publicKey - Group public key. - * @returns True if valid, false otherwise. - */ - verify(sig: TArg, msg: TArg, publicKey: TArg): boolean; - /** - * Combines multiple secret shares into a single secret key (e.g. for recovery). - * @param shares - Set of FrostSecret shares. - * @param signers - Threshold parameters. - * @returns Group secret key as bytes. - */ - combineSecret(shares: TArg, signers: Signers): TRet; - /** - * Low-level helper utilities (field arithmetic and polynomial tools). - */ - utils: { - /** - * Finite field used for scalars. - */ - Fn: IField; - /** - * Generates a random scalar (private key). - * @param rng - Optional RNG source. - * @returns Scalar as 32-byte Uint8Array. - */ - randomScalar: (rng?: RNG) => TRet; - /** - * Generates a secret-sharing polynomial and its public commitments. - * @param signers - Threshold parameters. - * @param secret - Optional initial secret scalar. - * @param coeffs - Optional manual coefficients. - * @param rng - Optional RNG. - * @returns Polynomial coefficients, commitments, and secret value. - */ - generateSecretPolynomial: ( - signers: Signers, - secret?: TArg, - coeffs?: bigint[], - rng?: RNG - ) => { - coefficients: bigint[]; - commitment: TRet; - secret: bigint; - }; - }; -}; - -// PubKey = commitments, verifyingShares -// PrivKey = id, signingShare, commitment - -const validateSigners = (signers: Signers) => { - if (!Number.isSafeInteger(signers.min) || !Number.isSafeInteger(signers.max)) - throw new Error('Wrong signers info: min=' + signers.min + ' max=' + signers.max); - // Compatibility with frost-rs intentionally narrows RFC 9591's positive-nonzero threshold rule - // to `min >= 2`, even though the RFC text itself allows `MIN_PARTICIPANTS = 1`. - // This API is for actual threshold signing across participants; 1-of-n degenerates to ordinary - // single-signer mode, which does not need FROST's network/coordination machinery at all. - if (signers.min < 2 || signers.max < 2 || signers.min > signers.max) - throw new Error('Wrong signers info: min=' + signers.min + ' max=' + signers.max); -}; -const validateCommitmentsNum = (signers: Signers, len: number) => { - // RFC 9591 Sections 5.2/5.3 require MIN_PARTICIPANTS <= NUM_PARTICIPANTS <= MAX_PARTICIPANTS. - if (len < signers.min || len > signers.max) throw new Error('Wrong number of commitments=' + len); -}; - -class AggErr extends Error { - // Empty means aggregation failed before per-share verification could attribute a signer. - public cheaters: Identifier[]; - constructor(msg: string, cheaters: Identifier[]) { - super(msg); - this.cheaters = cheaters; - } -} - -export function createFROST

>(opts: FrostOpts

): TRet { - validateObject( - opts, - { - name: 'string', - hash: 'function', - }, - { - hashToScalar: 'function', - validatePoint: 'function', - parsePublicKey: 'function', - adjustScalar: 'function', - adjustPoint: 'function', - challenge: 'function', - adjustNonces: 'function', - adjustSecret: 'function', - adjustPublic: 'function', - adjustGroupCommitmentShare: 'function', - adjustDKG: 'function', - } - ); - // Cheap constructor-surface sanity check only: this verifies the generic static hooks/fields that - // FROST consumes, but it does not certify point semantics like BASE/ZERO correctness. - validatePointCons(opts.Point); - const { Point } = opts; - const Fn = opts.Fn === undefined ? Point.Fn : opts.Fn; - // Hashes - const hashBytes = opts.hash; - const hashToScalar = - opts.hashToScalar === undefined - ? (msg: TArg, opts: TArg = { DST: new Uint8Array() }) => { - const t = hashBytes(concatBytes(opts.DST as Uint8Array, msg)); - return Fn.create(Fn.isLE ? bytesToNumberLE(t) : bytesToNumberBE(t)); - } - : opts.hashToScalar; - const H1Prefix = utf8ToBytes(opts.H1 !== undefined ? opts.H1 : opts.name + 'rho'); - const H2Prefix = utf8ToBytes(opts.H2 !== undefined ? opts.H2 : opts.name + 'chal'); - const H3Prefix = utf8ToBytes(opts.H3 !== undefined ? opts.H3 : opts.name + 'nonce'); - const H4Prefix = utf8ToBytes(opts.H4 !== undefined ? opts.H4 : opts.name + 'msg'); - const H5Prefix = utf8ToBytes(opts.H5 !== undefined ? opts.H5 : opts.name + 'com'); - const HDKGPrefix = utf8ToBytes(opts.HDKG !== undefined ? opts.HDKG : opts.name + 'dkg'); - const HIDPrefix = utf8ToBytes(opts.HID !== undefined ? opts.HID : opts.name + 'id'); - const H1 = (msg: TArg) => hashToScalar(msg, { DST: H1Prefix }); - // Empty H2 still passes `{ DST: new Uint8Array() }` into custom hashToScalar hooks. - // The built-in fallback hashes that identically to omitted DST, which is how - // the Ed25519 suite models RFC 9591's undecorated H2 challenge hash. - const H2 = (msg: TArg) => hashToScalar(msg, { DST: H2Prefix }); - const H3 = (msg: TArg) => hashToScalar(msg, { DST: H3Prefix }); - const H4 = (msg: TArg) => hashBytes(concatBytes(H4Prefix, msg)); - const H5 = (msg: TArg) => hashBytes(concatBytes(H5Prefix, msg)); - const HDKG = (msg: TArg) => hashToScalar(msg, { DST: HDKGPrefix }); - const HID = (msg: TArg) => hashToScalar(msg, { DST: HIDPrefix }); - // /Hashes - const randomScalar = (rng: RNG = randomBytes) => { - // Intentional divergence from RFC 9591 §4.1 / §5.1: the RFC nonce_generate helper outputs a - // Scalar in [0, p-1], but round-one commit publishes ScalarBaseMult(nonce) values and §3.1 - // requires SerializeElement / DeserializeElement to reject the identity element. Keep noble's - // mapHashToField generation here so round-one public nonce commitments stay in 1..n-1. - const t = mapHashToField(rng(getMinHashLength(Fn.ORDER)), Fn.ORDER, Fn.isLE); - // We cannot use Fn.fromBytes here because the field can have a different - // byte width, like ed448. - return Fn.isLE ? bytesToNumberLE(t) : bytesToNumberBE(t); - }; - const serializePoint = (p: P) => p.toBytes(); - const parsePoint = (bytes: TArg) => { - // RFC 9591 Section 3.1 requires DeserializeElement validation. Suite-specific validatePoint - // hooks tighten this further for ciphersuites in Section 6. Bare createFROST(...) only gets - // canonical point decoding unless the caller installs those extra subgroup / identity checks. - const p = Point.fromBytes(bytes); - if (opts.validatePoint) opts.validatePoint(p); - return p; - }; - // RFC 9591 Sections 4.1/5.1 model each participant's round-one output as two public commitments. - const nonceCommitments = (identifier: Identifier, nonces: TArg): TRet => - ({ - identifier, - hiding: serializePoint(Point.BASE.multiply(Fn.fromBytes(nonces.hiding))), - binding: serializePoint(Point.BASE.multiply(Fn.fromBytes(nonces.binding))), - }) as TRet; - const adjustPoint = opts.adjustPoint === undefined ? (n: P) => n : opts.adjustPoint; - // We use hex to make it easier to use inside objects - const validateIdentifier = (n: bigint) => { - // Identifiers are canonical non-zero scalars. Custom / derived identifiers are allowed, so this - // is intentionally not bounded by the current signers.max slot count. - if (!Fn.isValid(n) || Fn.is0(n)) throw new Error('Invalid identifier ' + n); - return n; - }; - const serializeIdentifier = (id: bigint) => bytesToHex(Fn.toBytes(validateIdentifier(id))); - const parseIdentifier = (id: string) => { - const n = validateIdentifier(Fn.fromBytes(hexToBytes(id))); - // Keep string-keyed maps stable by accepting only the canonical serialized form. - if (serializeIdentifier(n) !== id) throw new Error('expected canonical identifier hex'); - return n; - }; - - const Signature = { - // RFC 9591 Appendix A encodes signatures canonically as - // SerializeElement(R) || SerializeScalar(z). - encode: (R: P, z: bigint): TRet => { - let res: Uint8Array = concatBytes(serializePoint(R), Fn.toBytes(z)); - if (opts.adjustTx) res = opts.adjustTx.encode(res); - return res as TRet; - }, - decode: (sig: TArg) => { - if (opts.adjustTx) sig = opts.adjustTx.decode(sig); - // We don't know size of point, but we know size of scalar - const R = parsePoint(sig.subarray(0, -Fn.BYTES)); - const z = Fn.fromBytes(sig.subarray(-Fn.BYTES)); - return { R, z }; - }, - }; - // Generates pair of (scalar, point) - const genPointScalarPair = (rng: RNG = randomBytes) => { - let n = randomScalar(rng); - if (opts.adjustScalar) n = opts.adjustScalar(n); - let p = Point.BASE.multiply(n); - return { scalar: n, point: p }; - }; - // No roots here: root-based methods will throw. - // `poly` expects a structured roots-of-unity domain, but FROST uses an - // arbitrary domain and only needs the non-root operations below. - const nrErr = 'roots are unavailable in FROST polynomial mode'; - const noRoots: RootsOfUnity = { - info: { G: Fn.ZERO, oddFactor: Fn.ZERO, powerOfTwo: 0 }, - roots() { - throw new Error(nrErr); - }, - brp() { - throw new Error(nrErr); - }, - inverse() { - throw new Error(nrErr); - }, - omega() { - throw new Error(nrErr); - }, - clear() {}, - }; - const Poly = poly(Fn, noRoots); - const msm = (points: P[], scalars: bigint[]) => pippenger(Point, points, scalars); - - // Internal stuff uses bigints & Points, external Uint8Arrays - const polynomialEvaluate = (x: bigint, coeffs: bigint[]): bigint => { - if (!coeffs.length) throw new Error('empty coefficients'); - return Poly.monomial.eval(coeffs, x); - }; - const deriveInterpolatingValue = (L: bigint[], xi: bigint): bigint => { - const err = 'invalid parameters'; - // Generates lagrange coefficient - if (!L.some((x) => Fn.eql(x, xi))) throw new Error(err); - // Throws error if any x-coordinate is represented more than once in L. - const Lset = new Set(L); - if (Lset.size !== L.length) throw new Error(err); - // Or if xi is missing - if (!Lset.has(xi)) throw new Error(err); - let num = Fn.ONE; - let den = Fn.ONE; - for (const x of L) { - if (Fn.eql(x, xi)) continue; - num = Fn.mul(num, x); // num *= x - den = Fn.mul(den, Fn.sub(x, xi)); // RFC 9591 §4.2: denominator *= x_j - x_i - } - return Fn.div(num, den); - }; - const evalutateVSS = (identifier: bigint, commitment: P[]) => { - // RFC 9591 Appendix C.2: S_i' = Σ_j ScalarMult(vss_commitment[j], i^j). - const monomial = Poly.monomial.basis(identifier, commitment.length); - return msm(commitment, monomial); - }; - // High-level internal stuff - const generateSecretPolynomial = ( - signers: Signers, - secret?: TArg, - coeffs?: bigint[], - rng: RNG = randomBytes - ) => { - validateSigners(signers); - // Dealer/DKG polynomial sampling reuses the same hardened scalar derivation as round-one - // nonces: overriding `rng` only swaps the entropy source, not the non-zero `1..n-1` policy. - const secretScalar = secret === undefined ? randomScalar(rng) : Fn.fromBytes(secret); - if (!coeffs) { - coeffs = []; - for (let i = 0; i < signers.min - 1; i++) coeffs.push(randomScalar(rng)); - } - if (coeffs.length !== signers.min - 1) throw new Error('wrong coefficients length'); - const coefficients: bigint[] = [secretScalar, ...coeffs]; - // RFC 9591 Appendix C.2 commits to every polynomial coefficient with ScalarBaseMult. - const commitment = coefficients.map((i) => Point.BASE.multiply(i)); - return { coefficients, commitment, secret: secretScalar }; - }; - // Pretty much sign+verify, same as basic - const ProofOfKnowledge = { - challenge: (id: bigint, verKey: P, R: P) => - HDKG(concatBytes(Fn.toBytes(id), serializePoint(verKey), serializePoint(R))), - compute(id: bigint, coefficents: bigint[], commitments: P[], rng: RNG = randomBytes) { - if (coefficents.length < 1) throw new Error('coefficients should have at least one element'); - const { point: R, scalar: k } = genPointScalarPair(rng); - const verKey = commitments[0]; // verify key is first one - const c = this.challenge(id, verKey, R); - const mu = Fn.add(k, Fn.mul(coefficents[0], c)); // mu = k + coeff[0] * c - return Signature.encode(R, mu); - }, - validate(id: bigint, commitment: TArg, proof: TArg) { - if (commitment.length < 1) throw new Error('commitment should have at least one element'); - const { R, z } = Signature.decode(proof); - const phi = parsePoint(commitment[0]); - const c = this.challenge(id, phi, R); - // R === z*G - phi*c - if (!R.equals(Point.BASE.multiply(z).subtract(phi.multiply(c)))) - throw new Error('invalid proof of knowledge'); - }, - }; - const Basic = { - challenge: (R: P, PK: P, msg: TArg) => { - if (opts.challenge) return opts.challenge(R, PK, msg); - return H2(concatBytes(serializePoint(R), serializePoint(PK), msg)); - }, - sign(msg: TArg, sk: bigint, rng: RNG = randomBytes): [P, bigint] { - const { point: R, scalar: r } = genPointScalarPair(rng); - const PK = Point.BASE.multiply(sk); // sk*G - const c = this.challenge(R, PK, msg); - const z = Fn.add(r, Fn.mul(c, sk)); // r + c * sk - return [R, z]; - }, - verify(msg: TArg, R: P, z: bigint, PK: P): boolean { - if (opts.adjustPoint) PK = opts.adjustPoint(PK); - if (opts.adjustPoint) R = opts.adjustPoint(R); - const c = this.challenge(R, PK, msg); - const zB = Point.BASE.multiply(z); // z*G - const cA = PK.multiply(c); // c*PK - let check = zB.subtract(cA).subtract(R); // zB - cA - R - // No clearCoffactor on ristretto - if (check.clearCofactor) check = check.clearCofactor(); - return Point.ZERO.equals(check); - }, - }; - // === vssVerify - const validateSecretShare = (identifier: bigint, commitment: P[], signingShare: bigint) => { - // RFC 9591 Appendix C.2 `vss_verify(share_i, vss_commitment)` is purely algebraic. - // Public FROST packages still go through Section 3.1 element encoding, - // which rejects identity points, so a zero share or commitment does not - // become valid wire data just because VSS matches. - if (!Point.BASE.multiply(signingShare).equals(evalutateVSS(identifier, commitment))) - throw new Error('invalid secret share'); - }; - const Identifier = { - fromNumber(n: number): Identifier { - if (!Number.isSafeInteger(n)) throw new Error('expected safe interger'); - return serializeIdentifier(BigInt(n)); - }, - // Not in spec, but in FROST implementation, - // seems useful and nice, no need to sync identifiers (would require more interactions) - derive(s: string): Identifier { - if (typeof s !== 'string') throw new Error('wrong identifier string: ' + s); - // Derived identifiers may land anywhere in the scalar field; they are not restricted to - // sequential `1..max_signers` values. - return serializeIdentifier(HID(utf8ToBytes(s))); - }, - }; - // RFC 9591 §4.1: nonce_generate() hashes 32 fresh RNG bytes with SerializeScalar(secret). - const generateNonce = (secret: bigint, rng: RNG = randomBytes) => - H3(concatBytes(rng(32), Fn.toBytes(secret))); - - const getGroupCommitment = ( - GPK: P, - commitmentList: TArg, - msg: TArg - ) => { - const CL = commitmentList.map((i) => [ - i.identifier, - parseIdentifier(i.identifier), - parsePoint(i.hiding), - parsePoint(i.binding), - ]) as [Identifier, bigint, P, P][]; - // RFC 9591 Sections 4.3/4.4/4.5 and 5.2/5.3 treat commitment_list as sorted by identifier. - CL.sort((a, b) => (a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0)); - // Encode commitment list - const Cbytes = []; - for (const [_, id, hC, bC] of CL) - Cbytes.push(Fn.toBytes(id), serializePoint(hC), serializePoint(bC)); - const encodedCommitmentHash = H5(concatBytes(...Cbytes)); - const rhoPrefix = concatBytes(serializePoint(GPK), H4(msg), encodedCommitmentHash); - // Compute binding factors - const bindingFactors: Record = {}; - for (const [i, id] of CL) { - bindingFactors[i] = H1(concatBytes(rhoPrefix, Fn.toBytes(id))); - } - const points: P[] = []; - const scalars: bigint[] = []; - for (const [i, _, hC, bC] of CL) { - if (Point.ZERO.equals(hC) || Point.ZERO.equals(bC)) throw new Error('infinity commitment'); - points.push(hC, bC); - scalars.push(Fn.ONE, bindingFactors[i]); - } - const groupCommitment = msm(points, scalars); // GC += hC + bC*bindingFactor - const identifiers = CL.map((i) => i[1]); - return { identifiers, groupCommitment, bindingFactors }; - }; - const prepareShare = ( - PK: TArg, - commitmentList: TArg, - msg: TArg, - identifier: Identifier - ) => { - // RFC 9591 Sections 4.4/4.5/4.6 feed directly into the Section 5.2 signer computation. - const GPK = adjustPoint(parsePoint(PK)); - const id = parseIdentifier(identifier); - const { identifiers, groupCommitment, bindingFactors } = getGroupCommitment( - GPK, - commitmentList, - msg - ); - const bindingFactor = bindingFactors[identifier]; - const lambda = deriveInterpolatingValue(identifiers, id); - const challenge = Basic.challenge(groupCommitment, GPK, msg); - return { lambda, challenge, bindingFactor, groupCommitment }; - }; - Object.freeze(Identifier); - const frost = { - Identifier, - // DKG is Distributed Key Generation, not Trusted Dealer Key Generation. - DKG: Object.freeze({ - // NOTE: we allow to pass secret scalar from user side, - // this way it can be derived, instead of random generation - round1: ( - id: Identifier, - signers: Signers, - secret?: TArg, - rng: RNG = randomBytes - ) => { - validateSigners(signers); - const idNum = parseIdentifier(id); - const { coefficients, commitment } = generateSecretPolynomial( - signers, - secret, - undefined, - rng - ); - const proofOfKnowledge = ProofOfKnowledge.compute(idNum, coefficients, commitment, rng); - const commitmentBytes = commitment.map(serializePoint) as TRet; - const round1Public: DKG_Round1 = { - identifier: serializeIdentifier(idNum), - commitment: commitmentBytes, - proofOfKnowledge, - }; - // store secret information for signing - const round1Secret: DKG_Secret = { - identifier: idNum, - coefficients, - commitment: commitment.map(serializePoint) as TRet, - // Copy threshold metadata instead of retaining the caller-owned object by reference. - signers: { min: signers.min, max: signers.max }, - step: 1, - }; - return { public: round1Public, secret: round1Secret }; - }, - round2: ( - secret: TArg, - others: TArg - ): TRet> => { - if (others.length !== secret.signers.max - 1) - throw new Error('wrong number of round1 packages'); - if (!secret.coefficients || secret.step === 3) - throw new Error('round3 package used in round2'); - const res: Record = {}; - for (const p of others) { - if (p.commitment.length !== secret.signers.min) - throw new Error('wrong number of commitments'); - const id = parseIdentifier(p.identifier); - if (id === secret.identifier) throw new Error('duplicate id=' + serializeIdentifier(id)); - - ProofOfKnowledge.validate(id, p.commitment, p.proofOfKnowledge); - for (const c of p.commitment) parsePoint(c); - if (res[p.identifier]) throw new Error('Duplicate id=' + id); - const signingShare = Fn.toBytes(polynomialEvaluate(id, secret.coefficients)); - res[p.identifier] = { - identifier: serializeIdentifier(secret.identifier), - signingShare: signingShare as TRet, - }; - } - secret.step = 2; - return res as TRet>; - }, - round3: ( - secret: TArg, - round1: TArg, - round2: TArg - ): TRet => { - // DKG is outside RFC 9591's signing flow; callers are expected to reuse the same - // remote round1 packages already accepted in round2, like frost-rs documents. - if (round1.length !== secret.signers.max - 1) - throw new Error('wrong length of round1 packages'); - if (!secret.coefficients || secret.step !== 2) - throw new Error('round2 package used in round3'); - if (round2.length !== round1.length) throw new Error('wrong length of round2 packages'); - const merged: Record & { signingShare?: TArg }> = {}; - for (const r1 of round1) { - if (!r1.identifier || !r1.commitment) throw new Error('wrong round1 share'); - merged[r1.identifier] = { ...r1 }; - } - for (const r2 of round2) { - if (!r2.identifier || !r2.signingShare) throw new Error('wrong round2 share'); - if (!merged[r2.identifier]) - throw new Error('round1 share for ' + r2.identifier + ' is missing'); - merged[r2.identifier].signingShare = r2.signingShare; - } - if (Object.keys(merged).length !== round1.length) - throw new Error('mismatch identifiers between rounds'); - let signingShare = Fn.ZERO; - if (secret.commitment.length !== secret.signers.min) - throw new Error('wrong commitments length'); - const localCommitment = secret.commitment.map(parsePoint); - const localShare = polynomialEvaluate(secret.identifier, secret.coefficients); - validateSecretShare(secret.identifier, localCommitment, localShare); - const localCommitmentBytes = localCommitment.map(serializePoint); - const commitments: Record> = { - [serializeIdentifier(secret.identifier)]: localCommitmentBytes, - }; - for (const k in merged) { - const v = merged[k]; - if (!v.signingShare || !v.commitment) throw new Error('mismatch identifiers'); - const id = parseIdentifier(k); // from - const signingSharePart = Fn.fromBytes(v.signingShare); - const commitment = v.commitment.map(parsePoint); - validateSecretShare(secret.identifier, commitment, signingSharePart); - signingShare = Fn.add(signingShare, signingSharePart); - const idSer = serializeIdentifier(id); - if (commitments[idSer]) throw new Error('duplicated id=' + idSer); - commitments[idSer] = v.commitment; - } - signingShare = Fn.add(signingShare, localShare); - const mergedCommitment = new Array(secret.signers.min).fill(Point.ZERO); - for (const k in commitments) { - const v = commitments[k]; - if (v.length !== secret.signers.min) throw new Error('wrong commitments length'); - for (let i = 0; i < v.length; i++) - mergedCommitment[i] = mergedCommitment[i].add(parsePoint(v[i])); - } - const mergedCommitmentBytes = mergedCommitment.map(serializePoint) as TRet; - const verifyingShares: Record = {}; - for (const k in commitments) - verifyingShares[k] = serializePoint(evalutateVSS(parseIdentifier(k), mergedCommitment)); - // This is enough to sign stuff - let res: TRet = { - public: { - signers: { min: secret.signers.min, max: secret.signers.max }, - commitments: mergedCommitmentBytes, - verifyingShares: Object.fromEntries( - Object.entries(verifyingShares).map(([k, v]) => [k, v.slice()]) - ), - }, - secret: { - identifier: serializeIdentifier(secret.identifier), - signingShare: Fn.toBytes(signingShare) as TRet, - }, - }; - if (opts.adjustDKG) res = opts.adjustDKG(res); - for (let i = 0; i < secret.coefficients.length; i++) - secret.coefficients[i] -= secret.coefficients[i]; - delete secret.coefficients; - secret.step = 3; - return res; - }, - clean(secret: TArg) { - // Instead of replacing secret bigint with another (zero?), we subtract it from itself - // in the hope that JIT will modify it inplace, instead of creating new value. - // This is unverified and may not work, but it is best we can do in regard of bigints. - secret.identifier -= secret.identifier; - if (secret.coefficients) { - for (let i = 0; i < secret.coefficients.length; i++) - secret.coefficients[i] -= secret.coefficients[i]; - } - // for (const c of secret.commitment) c.fill(0); - secret.step = 3; - }, - }), - // Trusted dealer setup - // Generates keys for all participants - trustedDealer( - signers: Signers, - identifiers?: Identifier[], - secret?: TArg, - rng: RNG = randomBytes - ): TRet { - // if no identifiers provided, we generated default identifiers - validateSigners(signers); - if (identifiers === undefined) { - identifiers = []; - for (let i = 1; i <= signers.max; i++) identifiers.push(Identifier.fromNumber(i)); - } else { - if (!Array.isArray(identifiers) || identifiers.length !== signers.max) - throw new Error('identifiers should be array of ' + signers.max); - } - const identifierNums: Record = {}; - for (const id of identifiers) { - const idNum = parseIdentifier(id); - if (id in identifierNums) throw new Error('duplicated id=' + id); - identifierNums[id] = idNum; - } - const sp = generateSecretPolynomial(signers, secret, undefined, rng); - const commitmentBytes = sp.commitment.map(serializePoint); - const secretShares: Record = {}; - const verifyingShares: Record = {}; - for (const id of identifiers) { - const signingShare = polynomialEvaluate(identifierNums[id], sp.coefficients); - verifyingShares[id] = serializePoint(Point.BASE.multiply(signingShare)); - secretShares[id] = { - identifier: id, - signingShare: Fn.toBytes(signingShare) as TRet, - }; - } - return { - public: { - signers: { min: signers.min, max: signers.max }, - commitments: commitmentBytes, - verifyingShares, - }, - secretShares, - } as TRet; - }, - // Validate secret (from trusted dealer or DKG) - validateSecret(secret: TArg, pub: TArg) { - const id = parseIdentifier(secret.identifier); - const commitment = pub.commitments.map(parsePoint); - const signingShare = Fn.fromBytes(secret.signingShare); - validateSecretShare(id, commitment, signingShare); - }, - // Actual signing - // Round 1: each participant commit to nonces - // Nonces kept private, commitments sent to coordinator (or every other participant) - // NOTE: we don't need the message at this point, which lets a coordinator - // keep multiple nonce commitments per participant in advance and skip - // round1 for signing. - // But then each participant needs to remember generated shares - commit(secret: TArg, rng: RNG = randomBytes): TRet { - const secretScalar = Fn.fromBytes(secret.signingShare); - const hiding = generateNonce(secretScalar, rng); - const binding = generateNonce(secretScalar, rng); - const nonces = { hiding: Fn.toBytes(hiding), binding: Fn.toBytes(binding) }; - return { nonces, commitments: nonceCommitments(secret.identifier, nonces) } as TRet; - }, - // Round2: sign. Each participant creates a signature share from the secret - // and the selected nonce commitments. - signShare( - secret: TArg, - pub: TArg, - nonces: TArg, - commitmentList: TArg, - msg: TArg - ): TRet { - validateCommitmentsNum(pub.signers, commitmentList.length); - const hidingNonce0 = Fn.fromBytes(nonces.hiding); - const bindingNonce0 = Fn.fromBytes(nonces.binding); - if (Fn.is0(hidingNonce0) || Fn.is0(bindingNonce0)) - throw new Error('signing nonces already used'); - // Reject a coordinator-assigned commitment pair that does not match the signer's own nonce - // pair. This must happen before suite-specific nonce adjustment; secp256k1-tr may negate the - // actual signing nonces later, but the coordinator still assigns the original commitments. - const expectedCommitment = { - identifier: secret.identifier, - hiding: serializePoint(Point.BASE.multiply(hidingNonce0)), - binding: serializePoint(Point.BASE.multiply(bindingNonce0)), - }; - const commitment = commitmentList.find((i) => i.identifier === secret.identifier); - if (!commitment) throw new Error('missing signer commitment'); - if ( - bytesToHex(commitment.hiding) !== bytesToHex(expectedCommitment.hiding) || - bytesToHex(commitment.binding) !== bytesToHex(expectedCommitment.binding) - ) - throw new Error('incorrect signer commitment'); - if (opts.adjustSecret) secret = opts.adjustSecret(secret, pub); - if (opts.adjustPublic) pub = opts.adjustPublic(pub); - const SK = Fn.fromBytes(secret.signingShare); - const { lambda, challenge, bindingFactor, groupCommitment } = prepareShare( - pub.commitments[0], - commitmentList, - msg, - secret.identifier - ); - const N = opts.adjustNonces ? opts.adjustNonces(groupCommitment, nonces) : nonces; - const hidingNonce = opts.adjustNonces ? Fn.fromBytes(N.hiding) : hidingNonce0; - const bindingNonce = opts.adjustNonces ? Fn.fromBytes(N.binding) : bindingNonce0; - const t = Fn.mul(Fn.mul(lambda, SK), challenge); // challenge * lambda * SK - const t2 = Fn.mul(bindingNonce, bindingFactor); // bindingNonce * bindingFactor - const r = Fn.toBytes(Fn.add(Fn.add(hidingNonce, t2), t)); // t + t2 + hidingNonce - // RFC 9591 round-one commitments are one-time-use, and round two must use the nonce - // corresponding to the published commitment. This API returns mutable local nonce bytes, - // so consume them after a successful signShare() call: later all-zero reuse fails closed. - nonces.hiding.fill(0); - nonces.binding.fill(0); - return r as TRet; - }, - // Each participant (or coordinator) can verify signatures from other participants - verifyShare( - pub: TArg, - commitmentList: TArg, - msg: TArg, - identifier: Identifier, - sigShare: TArg - ) { - if (opts.adjustPublic) pub = opts.adjustPublic(pub); - const comm = commitmentList.find((i) => i.identifier === identifier); - if (!comm) throw new Error('cannot find identifier commitment'); - const PK = parsePoint(pub.verifyingShares[identifier]); - const hidingNonceCommitment = parsePoint(comm.hiding); - const bindingNonceCommitment = parsePoint(comm.binding); - const { lambda, challenge, bindingFactor, groupCommitment } = prepareShare( - pub.commitments[0], - commitmentList, - msg, - identifier - ); - // hC + bC * bF - let commShare = hidingNonceCommitment.add(bindingNonceCommitment.multiply(bindingFactor)); - if (opts.adjustGroupCommitmentShare) - commShare = opts.adjustGroupCommitmentShare(groupCommitment, commShare); - const l = Point.BASE.multiply(Fn.fromBytes(sigShare)); // sigShare*G - // commShare + PK * (challenge * lambda) - const r = commShare.add(PK.multiply(Fn.mul(challenge, lambda))); - return l.equals(r); - }, - // Aggregate multiple signature shares into groupSignature - aggregate( - pub: TArg, - commitmentList: TArg, - msg: TArg, - sigShares: TArg> - ): TRet { - if (opts.adjustPublic) pub = opts.adjustPublic(pub); - try { - validateCommitmentsNum(pub.signers, commitmentList.length); - } catch { - throw new AggErr('aggregation failed', []); - } - const ids = commitmentList.map((i) => i.identifier); - if (ids.length !== Object.keys(sigShares).length) throw new AggErr('aggregation failed', []); - for (const id of ids) { - if (!(id in sigShares) || !(id in pub.verifyingShares)) - throw new AggErr('aggregation failed', []); - } - const GPK = parsePoint(pub.commitments[0]); - const { groupCommitment } = getGroupCommitment(GPK, commitmentList, msg); - let z = Fn.ZERO; - // RFC 9591 Section 5.3 aggregates by summing the validated signature shares. - for (const id of ids) z = Fn.add(z, Fn.fromBytes(sigShares[id])); // z += zi - if (!Basic.verify(msg, groupCommitment, z, GPK)) { - const cheaters = []; - for (const id of ids) { - if (!this.verifyShare(pub, commitmentList, msg, id, sigShares[id])) cheaters.push(id); - } - throw new AggErr('aggregation failed', cheaters); - } - return Signature.encode(groupCommitment, z); - }, - // Basic sign/verify using single key - sign(msg: TArg, secretKey: TArg): TRet { - let sk = Fn.fromBytes(secretKey); - // Taproot single-key signing needs the same scalar normalization as threshold keys. - if (opts.adjustScalar) sk = opts.adjustScalar(sk); - const [R, z] = Basic.sign(msg, sk); - return Signature.encode(R, z); - }, - verify(sig: TArg, msg: TArg, publicKey: TArg) { - const PK = opts.parsePublicKey ? opts.parsePublicKey(publicKey) : parsePoint(publicKey); - const { R, z } = Signature.decode(sig); - return Basic.verify(msg, R, z, PK); - }, - // Combine multiple secret shares to restore secret - combineSecret(shares: TArg, signers: Signers): TRet { - validateSigners(signers); - if (!Array.isArray(shares) || shares.length < signers.min) - throw new Error('wrong secret shares array'); - const points = []; - const seen: Record = {}; - // Interpolate over the full provided share set and reject duplicate identifiers. - for (const s of shares) { - const idNum = parseIdentifier(s.identifier); - const id = serializeIdentifier(idNum); - if (seen[id]) throw new Error('duplicated id=' + id); - seen[id] = true; - points.push([idNum, Fn.fromBytes(s.signingShare)]); - } - const xCoords = points.map(([x]) => x); - let res = Fn.ZERO; - for (const [x, y] of points) - res = Fn.add(res, Fn.mul(y, deriveInterpolatingValue(xCoords, x))); - return Fn.toBytes(res) as TRet; - }, - // Utils - utils: Object.freeze({ - Fn, // NOTE: we re-export it here because it may be different from Point.Fn (ed448 is fun!) - // Test RNG overrides still go through noble's non-zero scalar derivation; this is not a raw - // "bytes become scalar" escape hatch. - randomScalar: (rng: RNG = randomBytes) => - Fn.toBytes(genPointScalarPair(rng).scalar) as TRet, - generateSecretPolynomial: ( - signers: Signers, - secret?: TArg, - coeffs?: bigint[], - rng?: RNG - ) => { - const res = generateSecretPolynomial(signers, secret, coeffs, rng); - return { ...res, commitment: res.commitment.map(serializePoint) as TRet }; - }, - }), - }; - return Object.freeze(frost) as TRet; -} diff --git a/node_modules/@noble/curves/src/abstract/hash-to-curve.ts b/node_modules/@noble/curves/src/abstract/hash-to-curve.ts deleted file mode 100644 index 3ce6dd4..0000000 --- a/node_modules/@noble/curves/src/abstract/hash-to-curve.ts +++ /dev/null @@ -1,491 +0,0 @@ -/** - * hash-to-curve from RFC 9380. - * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F. - * https://www.rfc-editor.org/rfc/rfc9380 - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import type { CHash, TArg, TRet } from '../utils.ts'; -import { - abytes, - asafenumber, - asciiToBytes, - bytesToNumberBE, - copyBytes, - concatBytes, - isBytes, - validateObject, -} from '../utils.ts'; -import type { AffinePoint, PC_ANY, PC_F, PC_P } from './curve.ts'; -import { FpInvertBatch, mod, type IField } from './modular.ts'; - -/** ASCII domain-separation tag or raw bytes. */ -export type AsciiOrBytes = string | Uint8Array; -type H2CDefaults = { - DST: AsciiOrBytes; - expand: 'xmd' | 'xof'; - hash: CHash; - p: bigint; - m: number; - k: number; - encodeDST?: AsciiOrBytes; -}; - -/** - * * `DST` is a domain separation tag, defined in section 2.2.5 - * * `p` characteristic of F, where F is a finite field of characteristic p and order q = p^m - * * `m` is extension degree (1 for prime fields) - * * `k` is the target security target in bits (e.g. 128), from section 5.1 - * * `expand` is `xmd` (SHA2, SHA3, BLAKE) or `xof` (SHAKE, BLAKE-XOF) - * * `hash` conforming to `utils.CHash` interface, with `outputLen` / `blockLen` props - */ -export type H2COpts = { - /** Domain separation tag. */ - DST: AsciiOrBytes; - /** Expander family used by RFC 9380. */ - expand: 'xmd' | 'xof'; - /** Hash or XOF implementation used by the expander. */ - hash: CHash; - /** Base-field characteristic. */ - p: bigint; - /** Extension degree (`1` for prime fields). */ - m: number; - /** Target security level in bits. */ - k: number; -}; -/** Hash-only subset of RFC 9380 options used by per-call overrides. */ -export type H2CHashOpts = { - /** Expander family used by RFC 9380. */ - expand: 'xmd' | 'xof'; - /** Hash or XOF implementation used by the expander. */ - hash: CHash; -}; -/** - * Map one hash-to-field output tuple onto affine curve coordinates. - * Implementations receive the validated scalar tuple by reference for performance and MUST treat it - * as read-only. Callers that need scratch space should copy before mutating. - * @param scalar - Field-element tuple produced by `hash_to_field`. - * @returns Affine point before subgroup clearing. - */ -export type MapToCurve = (scalar: bigint[]) => AffinePoint; - -// Separated from initialization opts, so users won't accidentally change per-curve parameters -// (changing DST is ok!) -/** Per-call override for the domain-separation tag. */ -export type H2CDSTOpts = { - /** Domain-separation tag override. */ - DST: AsciiOrBytes; -}; -/** Base hash-to-curve helpers shared by `hashToCurve` and `encodeToCurve`. */ -export type H2CHasherBase = { - /** - * Hash arbitrary bytes to one curve point. - * @param msg - Input message bytes. - * @param options - Optional domain-separation override. See {@link H2CDSTOpts}. - * @returns Curve point after hash-to-curve. - */ - hashToCurve(msg: TArg, options?: TArg): PC_P; - /** - * Hash arbitrary bytes to one scalar. - * @param msg - Input message bytes. - * @param options - Optional domain-separation override. See {@link H2CDSTOpts}. - * @returns Scalar reduced into the target field. - */ - hashToScalar(msg: TArg, options?: TArg): bigint; - /** - * Derive one curve point from non-uniform bytes without the random-oracle - * guarantees of `hashToCurve`. - * Accepts the same arguments as `hashToCurve`, but runs the encode-to-curve - * path instead of the random-oracle construction. - */ - deriveToCurve?(msg: TArg, options?: TArg): PC_P; - /** Point constructor for the target curve. */ - Point: PC; -}; -/** - * RFC 9380 methods, with cofactor clearing. See {@link https://www.rfc-editor.org/rfc/rfc9380#section-3 | RFC 9380 section 3}. - * - * * hashToCurve: `map(hash(input))`, encodes RANDOM bytes to curve (WITH hashing) - * * encodeToCurve: `map(hash(input))`, encodes NON-UNIFORM bytes to curve (WITH hashing) - * * mapToCurve: `map(scalars)`, encodes NON-UNIFORM scalars to curve (NO hashing) - */ -export type H2CHasher = H2CHasherBase & { - /** - * Encode non-uniform bytes to one curve point. - * @param msg - Input message bytes. - * @param options - Optional domain-separation override. See {@link H2CDSTOpts}. - * @returns Curve point after encode-to-curve. - */ - encodeToCurve(msg: TArg, options?: TArg): PC_P; - /** Deterministic map from `hash_to_field` tuples into affine coordinates. */ - mapToCurve: MapToCurve>; - /** Default RFC 9380 options captured by this hasher bundle. */ - defaults: H2CDefaults; -}; - -// Octet Stream to Integer. "spec" implementation of os2ip is 2.5x slower vs bytesToNumberBE. -const os2ip = bytesToNumberBE; - -// Integer to Octet Stream (numberToBytesBE). -function i2osp(value: number, length: number): TRet { - asafenumber(value); - asafenumber(length); - // This helper stays on the JS bitwise/u32 fast-path. Callers that need wider encodings should - // use bigint + numberToBytesBE instead of routing large widths through this small helper. - if (length < 0 || length > 4) throw new Error('invalid I2OSP length: ' + length); - if (value < 0 || value > 2 ** (8 * length) - 1) throw new Error('invalid I2OSP input: ' + value); - const res = Array.from({ length }).fill(0) as number[]; - for (let i = length - 1; i >= 0; i--) { - res[i] = value & 0xff; - value >>>= 8; - } - return new Uint8Array(res) as TRet; -} - -// RFC 9380 only applies strxor() to equal-length strings; callers must preserve that invariant. -function strxor(a: TArg, b: TArg): TRet { - const arr = new Uint8Array(a.length); - for (let i = 0; i < a.length; i++) { - arr[i] = a[i] ^ b[i]; - } - return arr as TRet; -} - -// User can always use utf8 if they want, by passing Uint8Array. -// If string is passed, we treat it as ASCII: other formats are likely a mistake. -function normDST(DST: TArg): TRet { - if (!isBytes(DST) && typeof DST !== 'string') - throw new Error('DST must be Uint8Array or ascii string'); - const dst = typeof DST === 'string' ? asciiToBytes(DST) : DST; - // RFC 9380 §3.1 requirement 2: tags "MUST have nonzero length". - if (dst.length === 0) throw new Error('DST must be non-empty'); - return dst as TRet; -} - -/** - * Produces a uniformly random byte string using a cryptographic hash - * function H that outputs b bits. - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1 | RFC 9380 section 5.3.1}. - * @param msg - Input message. - * @param DST - Domain separation tag. This helper normalizes DST, rejects empty DSTs, and - * oversize-hashes DST when needed. - * @param lenInBytes - Output length. - * @param H - Hash function. - * @returns Uniform byte string. - * @throws If the message, DST, hash, or output length is invalid. {@link Error} - * @example - * Expand one message into uniform bytes with the XMD construction. - * - * ```ts - * import { expand_message_xmd } from '@noble/curves/abstract/hash-to-curve.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const uniform = expand_message_xmd(new TextEncoder().encode('hello noble'), 'DST', 32, sha256); - * ``` - */ -export function expand_message_xmd( - msg: TArg, - DST: TArg, - lenInBytes: number, - H: TArg -): TRet { - abytes(msg); - asafenumber(lenInBytes); - DST = normDST(DST); - // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 - if (DST.length > 255) DST = H(concatBytes(asciiToBytes('H2C-OVERSIZE-DST-'), DST)); - const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; - const ell = Math.ceil(lenInBytes / b_in_bytes); - if (lenInBytes > 65535 || ell > 255) throw new Error('expand_message_xmd: invalid lenInBytes'); - const DST_prime = concatBytes(DST, i2osp(DST.length, 1)); - const Z_pad = new Uint8Array(r_in_bytes); // RFC 9380: Z_pad = I2OSP(0, s_in_bytes) - const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str - const b = new Array(ell); - const b_0 = H(concatBytes(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); - b[0] = H(concatBytes(b_0, i2osp(1, 1), DST_prime)); - // `b[0]` already stores RFC `b_1`, so only derive `b_2..b_ell` here. The old `<= ell` - // loop computed one extra tail block, which was usually sliced away but broke at max `ell=255` - // by reaching `I2OSP(256, 1)`. - for (let i = 1; i < ell; i++) { - const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; - b[i] = H(concatBytes(...args)); - } - const pseudo_random_bytes = concatBytes(...b); - return pseudo_random_bytes.slice(0, lenInBytes); -} - -/** - * Produces a uniformly random byte string using an extendable-output function (XOF) H. - * 1. The collision resistance of H MUST be at least k bits. - * 2. H MUST be an XOF that has been proved indifferentiable from - * a random oracle under a reasonable cryptographic assumption. - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2 | RFC 9380 section 5.3.2}. - * @param msg - Input message. - * @param DST - Domain separation tag. This helper normalizes DST, rejects empty DSTs, and - * oversize-hashes DST when needed. - * @param lenInBytes - Output length. - * @param k - Target security level. - * @param H - XOF hash function. - * @returns Uniform byte string. - * @throws If the message, DST, XOF, or output length is invalid. {@link Error} - * @example - * Expand one message into uniform bytes with the XOF construction. - * - * ```ts - * import { expand_message_xof } from '@noble/curves/abstract/hash-to-curve.js'; - * import { shake256 } from '@noble/hashes/sha3.js'; - * const uniform = expand_message_xof( - * new TextEncoder().encode('hello noble'), - * 'DST', - * 32, - * 128, - * shake256 - * ); - * ``` - */ -export function expand_message_xof( - msg: TArg, - DST: TArg, - lenInBytes: number, - k: number, - H: TArg -): TRet { - abytes(msg); - asafenumber(lenInBytes); - DST = normDST(DST); - // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 - // RFC 9380 §5.3.3: DST = H("H2C-OVERSIZE-DST-" || a_very_long_DST, ceil(2 * k / 8)). - if (DST.length > 255) { - const dkLen = Math.ceil((2 * k) / 8); - DST = H.create({ dkLen }).update(asciiToBytes('H2C-OVERSIZE-DST-')).update(DST).digest(); - } - if (lenInBytes > 65535 || DST.length > 255) - throw new Error('expand_message_xof: invalid lenInBytes'); - return ( - H.create({ dkLen: lenInBytes }) - .update(msg) - .update(i2osp(lenInBytes, 2)) - // 2. DST_prime = DST || I2OSP(len(DST), 1) - .update(DST) - .update(i2osp(DST.length, 1)) - .digest() - ); -} - -/** - * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F. - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-5.2 | RFC 9380 section 5.2}. - * @param msg - Input message bytes. - * @param count - Number of field elements to derive. Must be `>= 1`. - * @param options - RFC 9380 options. See {@link H2COpts}. `m` must be `>= 1`. - * @returns `[u_0, ..., u_(count - 1)]`, a list of field elements. - * @throws If the expander choice or RFC 9380 options are invalid. {@link Error} - * @example - * Hash one message into field elements before mapping it onto a curve. - * - * ```ts - * import { hash_to_field } from '@noble/curves/abstract/hash-to-curve.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const scalars = hash_to_field(new TextEncoder().encode('hello noble'), 2, { - * DST: 'DST', - * p: 17n, - * m: 1, - * k: 128, - * expand: 'xmd', - * hash: sha256, - * }); - * ``` - */ -export function hash_to_field( - msg: TArg, - count: number, - options: TArg -): bigint[][] { - validateObject(options, { - p: 'bigint', - m: 'number', - k: 'number', - hash: 'function', - }); - const { p, k, m, hash, expand, DST } = options; - asafenumber(hash.outputLen, 'valid hash'); - abytes(msg); - asafenumber(count); - // RFC 9380 §5.2 defines hash_to_field over a list of one or more field elements and requires - // extension degree `m >= 1`; rejecting here avoids degenerate `[]` / `[[]]` helper outputs. - if (count < 1) throw new Error('hash_to_field: expected count >= 1'); - if (m < 1) throw new Error('hash_to_field: expected m >= 1'); - const log2p = p.toString(2).length; - const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above - const len_in_bytes = count * m * L; - let prb; // pseudo_random_bytes - if (expand === 'xmd') { - prb = expand_message_xmd(msg, DST, len_in_bytes, hash); - } else if (expand === 'xof') { - prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); - } else if (expand === '_internal_pass') { - // for internal tests only - prb = msg; - } else { - throw new Error('expand must be "xmd" or "xof"'); - } - const u = new Array(count); - for (let i = 0; i < count; i++) { - const e = new Array(m); - for (let j = 0; j < m; j++) { - const elm_offset = L * (j + i * m); - const tv = prb.subarray(elm_offset, elm_offset + L); - e[j] = mod(os2ip(tv), p); - } - u[i] = e; - } - return u; -} - -type XY = (x: T, y: T) => { x: T; y: T }; -type XYRatio = [T[], T[], T[], T[]]; // xn/xd, yn/yd -/** - * @param field - Field implementation. - * @param map - Isogeny coefficients. - * @returns Isogeny mapping helper. - * @example - * Build one rational isogeny map, then apply it to affine x/y coordinates. - * - * ```ts - * import { isogenyMap } from '@noble/curves/abstract/hash-to-curve.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const iso = isogenyMap(Fp, [[0n, 1n], [1n], [1n], [1n]]); - * const point = iso(3n, 5n); - * ``` - */ -export function isogenyMap>(field: F, map: XYRatio): XY { - // Make same order as in spec - const coeff = map.map((i) => Array.from(i).reverse()); - return (x: T, y: T) => { - const [xn, xd, yn, yd] = coeff.map((val) => - val.reduce((acc, i) => field.add(field.mul(acc, x), i)) - ); - // RFC 9380 §6.6.3 / Appendix E: denominator-zero exceptional cases must - // return the identity on E. - // Shipped Weierstrass consumers encode that affine identity as all-zero - // coordinates, so `passZero=true` intentionally collapses zero - // denominators to `{ x: 0, y: 0 }`. - const [xd_inv, yd_inv] = FpInvertBatch(field, [xd, yd], true); - x = field.mul(xn, xd_inv); // xNum / xDen - y = field.mul(y, field.mul(yn, yd_inv)); // y * (yNum / yDev) - return { x, y }; - }; -} - -// Keep the shared DST removable when the selected bundle never hashes to scalar. -// Callers that need protocol-specific scalar domain separation must override this generic default. -// RFC 9497 §§4.1-4.5 use this ASCII prefix before appending the ciphersuite context string. -// Export a string instead of mutable bytes so callers cannot poison default hash-to-scalar behavior -// by mutating a shared Uint8Array in place. -export const _DST_scalar = 'HashToScalar-' as const; - -/** - * Creates hash-to-curve methods from EC Point and mapToCurve function. See {@link H2CHasher}. - * @param Point - Point constructor. - * @param mapToCurve - Map-to-curve function. - * @param defaults - Default hash-to-curve options. This object is frozen in place and reused as - * the shared defaults bundle for the returned helpers. - * @returns Hash-to-curve helper namespace. - * @throws If the map-to-curve callback or default hash-to-curve options are invalid. {@link Error} - * @example - * Bundle hash-to-curve, hash-to-scalar, and encode-to-curve helpers for one curve. - * - * ```ts - * import { createHasher } from '@noble/curves/abstract/hash-to-curve.js'; - * import { p256 } from '@noble/curves/nist.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const hasher = createHasher(p256.Point, () => p256.Point.BASE.toAffine(), { - * DST: 'P256_XMD:SHA-256_SSWU_RO_', - * encodeDST: 'P256_XMD:SHA-256_SSWU_NU_', - * p: p256.Point.Fp.ORDER, - * m: 1, - * k: 128, - * expand: 'xmd', - * hash: sha256, - * }); - * const point = hasher.encodeToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export function createHasher( - Point: PC, - mapToCurve: MapToCurve>, - defaults: TArg -): H2CHasher { - if (typeof mapToCurve !== 'function') throw new Error('mapToCurve() must be defined'); - // `Point` is intentionally not shape-validated eagerly here: point constructors vary across - // curve families, so this helper only checks the hooks it can validate cheaply. Misconfigured - // suites fail later when hashing first touches Point.fromAffine / Point.ZERO / clearCofactor(). - const snapshot = (src: TArg): TRet => - Object.freeze({ - ...src, - DST: isBytes(src.DST) ? copyBytes(src.DST) : src.DST, - ...(src.encodeDST === undefined - ? {} - : { encodeDST: isBytes(src.encodeDST) ? copyBytes(src.encodeDST) : src.encodeDST }), - }) as TRet; - // Keep one private defaults snapshot for actual hashing and expose fresh - // detached snapshots via the public getter. - // Otherwise a caller could mutate `hasher.defaults.DST` in place and poison - // the singleton hasher for every other consumer in the same process. - const safeDefaults = snapshot(defaults); - function map(num: bigint[]): PC_P { - return Point.fromAffine(mapToCurve(num)) as PC_P; - } - function clear(initial: PC_P): PC_P { - const P = initial.clearCofactor(); - // Keep ZERO as the algebraic cofactor-clearing result here; strict public point-validity - // surfaces may still reject it later, but createHasher.clear() itself is not that boundary. - if (P.equals(Point.ZERO)) return Point.ZERO as PC_P; - P.assertValidity(); - return P as PC_P; - } - - return Object.freeze({ - get defaults() { - return snapshot(safeDefaults); - }, - Point, - - hashToCurve(msg: TArg, options?: TArg): PC_P { - const opts = Object.assign({}, safeDefaults, options); - const u = hash_to_field(msg, 2, opts); - const u0 = map(u[0]); - const u1 = map(u[1]); - return clear(u0.add(u1) as PC_P); - }, - encodeToCurve(msg: TArg, options?: TArg): PC_P { - const optsDst = safeDefaults.encodeDST ? { DST: safeDefaults.encodeDST } : {}; - const opts = Object.assign({}, safeDefaults, optsDst, options); - const u = hash_to_field(msg, 1, opts); - const u0 = map(u[0]); - return clear(u0); - }, - /** See {@link H2CHasher} */ - mapToCurve(scalars: bigint | bigint[]): PC_P { - // Curves with m=1 accept only single scalar - if (safeDefaults.m === 1) { - if (typeof scalars !== 'bigint') throw new Error('expected bigint (m=1)'); - return clear(map([scalars])); - } - if (!Array.isArray(scalars)) throw new Error('expected array of bigints'); - for (const i of scalars) - if (typeof i !== 'bigint') throw new Error('expected array of bigints'); - return clear(map(scalars)); - }, - - // hash_to_scalar can produce 0: https://www.rfc-editor.org/errata/eid8393 - // RFC 9380, draft-irtf-cfrg-bbs-signatures-08. Default scalar DST is the shared generic - // `HashToScalar-` prefix above unless the caller overrides it per invocation. - hashToScalar(msg: TArg, options?: TArg): bigint { - // @ts-ignore - const N = Point.Fn.ORDER; - const opts = Object.assign({}, safeDefaults, { p: N, m: 1, DST: _DST_scalar }, options); - return hash_to_field(msg, 1, opts)[0][0]; - }, - }); -} diff --git a/node_modules/@noble/curves/src/abstract/modular.ts b/node_modules/@noble/curves/src/abstract/modular.ts deleted file mode 100644 index f40eca0..0000000 --- a/node_modules/@noble/curves/src/abstract/modular.ts +++ /dev/null @@ -1,1068 +0,0 @@ -/** - * Utils for modular division and fields. - * Field over 11 is a finite (Galois) field is integer number operations `mod 11`. - * There is no division: it is replaced by modular multiplicative inverse. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { - abool, - abytes, - anumber, - asafenumber, - bitLen, - bytesToNumberBE, - bytesToNumberLE, - numberToBytesBE, - numberToBytesLE, - validateObject, - type TArg, - type TRet, -} from '../utils.ts'; - -// Numbers aren't used in x25519 / x448 builds -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2); -// prettier-ignore -const _3n = /* @__PURE__ */ BigInt(3), _4n = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5); -// prettier-ignore -const _7n = /* @__PURE__ */ BigInt(7), _8n = /* @__PURE__ */ BigInt(8), _9n = /* @__PURE__ */ BigInt(9); -const _16n = /* @__PURE__ */ BigInt(16); - -/** - * @param a - Dividend value. - * @param b - Positive modulus. - * @returns Reduced value in `[0, b)` only when `b` is positive. - * @throws If the modulus is not positive. {@link Error} - * @example - * Normalize a bigint into one field residue. - * - * ```ts - * mod(-1n, 5n); - * ``` - */ -export function mod(a: bigint, b: bigint): bigint { - if (b <= _0n) throw new Error('mod: expected positive modulus, got ' + b); - const result = a % b; - return result >= _0n ? result : b + result; -} -/** - * Efficiently raise num to a power with modular reduction. - * Unsafe in some contexts: uses ladder, so can expose bigint bits. - * Low-level helper: callers that need canonical residues must pass a valid `num` for the chosen - * modulus instead of relying on the `power===0/1` fast paths to normalize it. - * @param num - Base value. - * @param power - Exponent value. - * @param modulo - Reduction modulus. - * @returns Modular exponentiation result. - * @throws If the modulus or exponent is invalid. {@link Error} - * @example - * Raise one bigint to a modular power. - * - * ```ts - * pow(2n, 6n, 11n) // 64n % 11n == 9n - * ``` - */ -export function pow(num: bigint, power: bigint, modulo: bigint): bigint { - return FpPow(Field(modulo), num, power); -} - -/** - * Does `x^(2^power)` mod p. `pow2(30, 4)` == `30^(2^4)`. - * Low-level helper: callers that need canonical residues must pass a valid `x` for the chosen - * modulus; the `power===0` fast path intentionally returns the input unchanged. - * @param x - Base value. - * @param power - Number of squarings. - * @param modulo - Reduction modulus. - * @returns Repeated-squaring result. - * @throws If the exponent is negative. {@link Error} - * @example - * Apply repeated squaring inside one field. - * - * ```ts - * pow2(3n, 2n, 11n); - * ``` - */ -export function pow2(x: bigint, power: bigint, modulo: bigint): bigint { - if (power < _0n) throw new Error('pow2: expected non-negative exponent, got ' + power); - let res = x; - while (power-- > _0n) { - res *= res; - res %= modulo; - } - return res; -} - -/** - * Inverses number over modulo. - * Implemented using the {@link https://brilliant.org/wiki/extended-euclidean-algorithm/ | extended Euclidean algorithm}. - * @param number - Value to invert. - * @param modulo - Positive modulus. - * @returns Multiplicative inverse. - * @throws If the modulus is invalid or the inverse does not exist. {@link Error} - * @example - * Compute one modular inverse with the extended Euclidean algorithm. - * - * ```ts - * invert(3n, 11n); - * ``` - */ -export function invert(number: bigint, modulo: bigint): bigint { - if (number === _0n) throw new Error('invert: expected non-zero number'); - if (modulo <= _0n) throw new Error('invert: expected positive modulus, got ' + modulo); - // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower. - let a = mod(number, modulo); - let b = modulo; - // prettier-ignore - let x = _0n, y = _1n, u = _1n, v = _0n; - while (a !== _0n) { - const q = b / a; - const r = b - a * q; - const m = x - u * q; - const n = y - v * q; - // prettier-ignore - b = a, a = r, x = u, y = v, u = m, v = n; - } - const gcd = b; - if (gcd !== _1n) throw new Error('invert: does not exist'); - return mod(x, modulo); -} - -function assertIsSquare(Fp: TArg>, root: T, n: T): void { - const F = Fp as IField; - if (!F.eql(F.sqr(root), n)) throw new Error('Cannot find square root'); -} - -// Not all roots are possible! Example which will throw: -// const NUM = -// n = 72057594037927816n; -// Fp = Field(BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab')); -function sqrt3mod4(Fp: TArg>, n: T) { - const F = Fp as IField; - const p1div4 = (F.ORDER + _1n) / _4n; - const root = F.pow(n, p1div4); - assertIsSquare(F, root, n); - return root; -} - -// Equivalent `q = 5 (mod 8)` square-root formula (Atkin-style), not the RFC Appendix I.2 CMOV -// pseudocode verbatim. -function sqrt5mod8(Fp: TArg>, n: T) { - const F = Fp as IField; - const p5div8 = (F.ORDER - _5n) / _8n; - const n2 = F.mul(n, _2n); - const v = F.pow(n2, p5div8); - const nv = F.mul(n, v); - const i = F.mul(F.mul(nv, _2n), v); - const root = F.mul(nv, F.sub(i, F.ONE)); - assertIsSquare(F, root, n); - return root; -} - -// Based on RFC9380, Kong algorithm -// prettier-ignore -function sqrt9mod16(P: bigint): TRet<(Fp: IField, n: T) => T> { - const Fp_ = Field(P); - const tn = tonelliShanks(P); - const c1 = tn(Fp_, Fp_.neg(Fp_.ONE));// 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F - const c2 = tn(Fp_, c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F - const c3 = tn(Fp_, Fp_.neg(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F - const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic - return ((Fp: TArg>, n: T): T => { - const F = Fp as IField; - let tv1 = F.pow(n, c4); // 1. tv1 = x^c4 - let tv2 = F.mul(tv1, c1); // 2. tv2 = c1 * tv1 - const tv3 = F.mul(tv1, c2); // 3. tv3 = c2 * tv1 - const tv4 = F.mul(tv1, c3); // 4. tv4 = c3 * tv1 - const e1 = F.eql(F.sqr(tv2), n); // 5. e1 = (tv2^2) == x - const e2 = F.eql(F.sqr(tv3), n); // 6. e2 = (tv3^2) == x - tv1 = F.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x - tv2 = F.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x - const e3 = F.eql(F.sqr(tv2), n); // 9. e3 = (tv2^2) == x - const root = F.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select sqrt from tv1 & tv2 - assertIsSquare(F, root, n); - return root; - }) as TRet<(Fp: IField, n: T) => T>; -} - -/** - * Tonelli-Shanks square root search algorithm. - * This implementation is variable-time: it searches data-dependently for the first non-residue `Z` - * and for the smallest `i` in the main loop, unlike RFC 9380 Appendix I.4's constant-time shape. - * 1. {@link https://eprint.iacr.org/2012/685.pdf | eprint 2012/685}, page 12 - * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks - * @param P - field order - * @returns function that takes field Fp (created from P) and number n - * @throws If the field is too small, non-prime, or the square root does not exist. {@link Error} - * @example - * Construct a square-root helper for primes that need Tonelli-Shanks. - * - * ```ts - * import { Field, tonelliShanks } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const sqrt = tonelliShanks(17n)(Fp, 4n); - * ``` - */ -export function tonelliShanks(P: bigint): TRet<(Fp: IField, n: T) => T> { - // Initialization (precomputation). - // Caching initialization could boost perf by 7%. - if (P < _3n) throw new Error('sqrt is not defined for small field'); - // Factor P - 1 = Q * 2^S, where Q is odd - let Q = P - _1n; - let S = 0; - while (Q % _2n === _0n) { - Q /= _2n; - S++; - } - - // Find the first quadratic non-residue Z >= 2 - let Z = _2n; - const _Fp = Field(P); - while (FpLegendre(_Fp, Z) === 1) { - // Basic primality test for P. After x iterations, chance of - // not finding quadratic non-residue is 2^x, so 2^1000. - if (Z++ > 1000) throw new Error('Cannot find square root: probably non-prime P'); - } - // Fast-path; usually done before Z, but we do "primality test". - if (S === 1) return sqrt3mod4 as TRet<(Fp: IField, n: T) => T>; - - // Slow-path - // TODO: test on Fp2 and others - let cc = _Fp.pow(Z, Q); // c = z^Q - const Q1div2 = (Q + _1n) / _2n; - return function tonelliSlow(Fp: TArg>, n: T): T { - const F = Fp as IField; - if (F.is0(n)) return n; - // Check if n is a quadratic residue using Legendre symbol - if (FpLegendre(F, n) !== 1) throw new Error('Cannot find square root'); - - // Initialize variables for the main loop - let M = S; - let c = F.mul(F.ONE, cc); // c = z^Q, move cc from field _Fp into field Fp - let t = F.pow(n, Q); // t = n^Q, first guess at the fudge factor - let R = F.pow(n, Q1div2); // R = n^((Q+1)/2), first guess at the square root - - // Main loop - // while t != 1 - while (!F.eql(t, F.ONE)) { - if (F.is0(t)) return F.ZERO; // if t=0 return R=0 - let i = 1; - - // Find the smallest i >= 1 such that t^(2^i) ≡ 1 (mod P) - let t_tmp = F.sqr(t); // t^(2^1) - while (!F.eql(t_tmp, F.ONE)) { - i++; - t_tmp = F.sqr(t_tmp); // t^(2^2)... - if (i === M) throw new Error('Cannot find square root'); - } - - // Calculate the exponent for b: 2^(M - i - 1) - const exponent = _1n << BigInt(M - i - 1); // bigint is important - const b = F.pow(c, exponent); // b = 2^(M - i - 1) - - // Update variables - M = i; - c = F.sqr(b); // c = b^2 - t = F.mul(t, c); // t = (t * b^2) - R = F.mul(R, b); // R = R*b - } - return R; - } as TRet<(Fp: IField, n: T) => T>; -} - -/** - * Square root for a finite field. Will try optimized versions first: - * - * 1. P ≡ 3 (mod 4) - * 2. P ≡ 5 (mod 8) - * 3. P ≡ 9 (mod 16) - * 4. Tonelli-Shanks algorithm - * - * Different algorithms can give different roots, it is up to user to decide which one they want. - * For example there is FpSqrtOdd/FpSqrtEven to choose a root by oddness - * (used for hash-to-curve). - * @param P - Field order. - * @returns Square-root helper. The generic fallback inherits Tonelli-Shanks' variable-time - * behavior and this selector assumes prime-field-style integer moduli. - * @throws If the field is unsupported or the square root does not exist. {@link Error} - * @example - * Choose the square-root helper appropriate for one field modulus. - * - * ```ts - * import { Field, FpSqrt } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const sqrt = FpSqrt(17n)(Fp, 4n); - * ``` - */ -export function FpSqrt(P: bigint): TRet<(Fp: IField, n: T) => T> { - // P ≡ 3 (mod 4) => √n = n^((P+1)/4) - if (P % _4n === _3n) return sqrt3mod4 as TRet<(Fp: IField, n: T) => T>; - // P ≡ 5 (mod 8) => Atkin algorithm, page 10 of https://eprint.iacr.org/2012/685.pdf - if (P % _8n === _5n) return sqrt5mod8 as TRet<(Fp: IField, n: T) => T>; - // P ≡ 9 (mod 16) => Kong algorithm, page 11 of https://eprint.iacr.org/2012/685.pdf (algorithm 4) - if (P % _16n === _9n) return sqrt9mod16(P); - // Tonelli-Shanks algorithm - return tonelliShanks(P); -} - -/** - * @param num - Value to inspect. - * @param modulo - Field modulus. - * @returns `true` when the least-significant little-endian bit is set. - * @throws If the modulus is invalid for `mod(...)`. {@link Error} - * @example - * Inspect the low bit used by little-endian sign conventions. - * - * ```ts - * isNegativeLE(3n, 11n); - * ``` - */ -export const isNegativeLE = (num: bigint, modulo: bigint): boolean => - (mod(num, modulo) & _1n) === _1n; - -/** Generic field interface used by prime and extension fields alike. - * Generic helpers treat field operations as pure functions: implementations MUST treat provided - * values/byte buffers as read-only and return detached results instead of mutating arguments. - */ -export interface IField { - /** Field order `q`, which may be prime or a prime power. */ - ORDER: bigint; - /** Canonical encoded byte length. */ - BYTES: number; - /** Canonical encoded bit length. */ - BITS: number; - /** Whether encoded field elements use little-endian bytes. */ - isLE: boolean; - /** Additive identity. */ - ZERO: T; - /** Multiplicative identity. */ - ONE: T; - // 1-arg - /** - * Normalize one value into the field. - * @param num - Input value. - * @returns Normalized field value. - */ - create: (num: T) => T; - /** - * Check whether one value already belongs to the field. - * @param num - Input value. - * Implementations may throw `TypeError` on malformed input types instead of returning `false`. - * @returns Whether the value already belongs to the field. - */ - isValid: (num: T) => boolean; - /** - * Check whether one value is zero. - * @param num - Input value. - * @returns Whether the value is zero. - */ - is0: (num: T) => boolean; - /** - * Check whether one value is non-zero and belongs to the field. - * @param num - Input value. - * Implementations may throw `TypeError` on malformed input types instead of returning `false`. - * @returns Whether the value is non-zero and valid. - */ - isValidNot0: (num: T) => boolean; - /** - * Negate one value. - * @param num - Input value. - * @returns Negated value. - */ - neg(num: T): T; - /** - * Invert one value multiplicatively. - * @param num - Input value. - * @returns Multiplicative inverse. - */ - inv(num: T): T; - /** - * Compute one square root when it exists. - * @param num - Input value. - * @returns Square root. - */ - sqrt(num: T): T; - /** - * Square one value. - * @param num - Input value. - * @returns Squared value. - */ - sqr(num: T): T; - // 2-args - /** - * Compare two field values. - * @param lhs - Left value. - * @param rhs - Right value. - * @returns Whether both values are equal. - */ - eql(lhs: T, rhs: T): boolean; - /** - * Add two normalized field values. - * @param lhs - Left value. - * @param rhs - Right value. - * @returns Sum value. - */ - add(lhs: T, rhs: T): T; - /** - * Subtract two normalized field values. - * @param lhs - Left value. - * @param rhs - Right value. - * @returns Difference value. - */ - sub(lhs: T, rhs: T): T; - /** - * Multiply two field values. - * @param lhs - Left value. - * @param rhs - Right value or scalar. - * @returns Product value. - */ - mul(lhs: T, rhs: T | bigint): T; - /** - * Raise one field value to a power. - * @param lhs - Base value. - * @param power - Exponent. - * @returns Power value. - */ - pow(lhs: T, power: bigint): T; - /** - * Divide one field value by another. - * @param lhs - Dividend. - * @param rhs - Divisor or scalar. - * @returns Quotient value. - */ - div(lhs: T, rhs: T | bigint): T; - // N for NonNormalized (for now) - /** - * Add two values without re-normalizing the result. - * @param lhs - Left value. - * @param rhs - Right value. - * @returns Non-normalized sum. - */ - addN(lhs: T, rhs: T): T; - /** - * Subtract two values without re-normalizing the result. - * @param lhs - Left value. - * @param rhs - Right value. - * @returns Non-normalized difference. - */ - subN(lhs: T, rhs: T): T; - /** - * Multiply two values without re-normalizing the result. - * @param lhs - Left value. - * @param rhs - Right value or scalar. - * @returns Non-normalized product. - */ - mulN(lhs: T, rhs: T | bigint): T; - /** - * Square one value without re-normalizing the result. - * @param num - Input value. - * @returns Non-normalized square. - */ - sqrN(num: T): T; - - // Optional - // Should be same as sgn0 function in - // [RFC9380](https://www.rfc-editor.org/rfc/rfc9380#section-4.1). - // NOTE: sgn0 is "negative in LE", which is the same as odd. - // Negative in LE is a somewhat strange definition anyway. - /** - * Return the RFC 9380 `sgn0`-style oddness bit when supported. - * This uses oddness instead of evenness so extension fields like Fp2 can expose the same hook. - * Returns whether the value is odd under the field encoding. - */ - isOdd?(num: T): boolean; - // legendre?(num: T): T; - /** - * Invert many field elements in one batch. - * @param lst - Values to invert. - * @returns Batch of inverses. - */ - invertBatch: (lst: T[]) => T[]; - /** - * Encode one field value into fixed-width bytes. - * Callers that need canonical encodings MUST supply a valid field element. - * Low-level protocols may also use this to serialize raw / non-canonical residues. - * @param num - Input value. - * @returns Fixed-width byte encoding. - */ - toBytes(num: T): Uint8Array; - /** - * Decode one field value from fixed-width bytes. - * @param bytes - Fixed-width byte encoding. - * @param skipValidation - Whether to skip range validation. - * Implementations MUST treat `bytes` as read-only. - * @returns Decoded field value. - */ - fromBytes(bytes: Uint8Array, skipValidation?: boolean): T; - // If c is False, CMOV returns a, otherwise it returns b. - /** - * Constant-time conditional move. - * @param a - Value used when the condition is false. - * @param b - Value used when the condition is true. - * @param c - Selection bit. - * @returns Selected value. - */ - cmov(a: T, b: T, c: boolean): T; -} -// prettier-ignore -// Arithmetic-only subset checked by validateField(). This is intentionally not the full runtime -// IField contract: helpers like `isValidNot0`, `invertBatch`, `toBytes`, `fromBytes`, `cmov`, and -// field-specific extras like `isOdd` are left to the callers that actually need them. -const FIELD_FIELDS = [ - 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr', - 'eql', 'add', 'sub', 'mul', 'pow', 'div', - 'addN', 'subN', 'mulN', 'sqrN' -] as const; -/** - * @param field - Field implementation. - * @returns Validated field. This only checks the arithmetic subset needed by generic helpers; it - * does not guarantee full runtime-method coverage for serialization, batching, `cmov`, or - * field-specific extras beyond positive `BYTES` / `BITS`. - * @throws If the field shape or numeric metadata are invalid. {@link Error} - * @example - * Check that a field implementation exposes the operations curve code expects. - * - * ```ts - * import { Field, validateField } from '@noble/curves/abstract/modular.js'; - * const Fp = validateField(Field(17n)); - * ``` - */ -export function validateField(field: TArg>): TRet> { - const initial = { - ORDER: 'bigint', - BYTES: 'number', - BITS: 'number', - } as Record; - const opts = FIELD_FIELDS.reduce((map, val: string) => { - map[val] = 'function'; - return map; - }, initial); - validateObject(field, opts); - // Runtime field implementations must expose real integer byte/bit sizes; fractional / NaN / - // infinite metadata leaks through validateObject(type='number') but breaks encoders and caches. - asafenumber(field.BYTES, 'BYTES'); - asafenumber(field.BITS, 'BITS'); - // Runtime field implementations must expose positive byte/bit sizes; zero leaks through the - // numeric shape checks above but still breaks encoding helpers and cached-length assumptions. - if (field.BYTES < 1 || field.BITS < 1) throw new Error('invalid field: expected BYTES/BITS > 0'); - if (field.ORDER <= _1n) throw new Error('invalid field: expected ORDER > 1, got ' + field.ORDER); - return field as TRet>; -} - -// Generic field functions - -/** - * Same as `pow` but for Fp: non-constant-time. - * Unsafe in some contexts: uses ladder, so can expose bigint bits. - * @param Fp - Field implementation. - * @param num - Base value. - * @param power - Exponent value. - * @returns Powered field element. - * @throws If the exponent is negative. {@link Error} - * @example - * Raise one field element to a public exponent. - * - * ```ts - * import { Field, FpPow } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const x = FpPow(Fp, 3n, 5n); - * ``` - */ -export function FpPow(Fp: TArg>, num: T, power: bigint): T { - const F = Fp as IField; - if (power < _0n) throw new Error('invalid exponent, negatives unsupported'); - if (power === _0n) return F.ONE; - if (power === _1n) return num; - let p = F.ONE; - let d = num; - while (power > _0n) { - if (power & _1n) p = F.mul(p, d); - d = F.sqr(d); - power >>= _1n; - } - return p; -} - -/** - * Efficiently invert an array of Field elements. - * Exception-free. Zero-valued field elements stay `undefined` unless `passZero` is enabled. - * @param Fp - Field implementation. - * @param nums - Values to invert. - * @param passZero - map 0 to 0 (instead of undefined) - * @returns Inverted values. - * @example - * Invert several field elements with one shared inversion. - * - * ```ts - * import { Field, FpInvertBatch } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const inv = FpInvertBatch(Fp, [1n, 2n, 4n]); - * ``` - */ -export function FpInvertBatch(Fp: TArg>, nums: T[], passZero = false): T[] { - const F = Fp as IField; - const inverted = new Array(nums.length).fill(passZero ? F.ZERO : undefined) as T[]; - // Walk from first to last, multiply them by each other MOD p - const multipliedAcc = nums.reduce((acc, num, i) => { - if (F.is0(num)) return acc; - inverted[i] = acc; - return F.mul(acc, num); - }, F.ONE); - // Invert last element - const invertedAcc = F.inv(multipliedAcc); - // Walk from last to first, multiply them by inverted each other MOD p - nums.reduceRight((acc, num, i) => { - if (F.is0(num)) return acc; - inverted[i] = F.mul(acc, inverted[i]); - return F.mul(acc, num); - }, invertedAcc); - return inverted; -} - -/** - * @param Fp - Field implementation. - * @param lhs - Dividend value. - * @param rhs - Divisor value. - * @returns Division result. - * @throws If the divisor is non-invertible. {@link Error} - * @example - * Divide one field element by another. - * - * ```ts - * import { Field, FpDiv } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const x = FpDiv(Fp, 6n, 3n); - * ``` - */ -export function FpDiv(Fp: TArg>, lhs: T, rhs: T | bigint): T { - const F = Fp as IField; - return F.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, F.ORDER) : F.inv(rhs)); -} - -/** - * Legendre symbol. - * Legendre constant is used to calculate Legendre symbol (a | p) - * which denotes the value of a^((p-1)/2) (mod p). - * - * * (a | p) ≡ 1 if a is a square (mod p), quadratic residue - * * (a | p) ≡ -1 if a is not a square (mod p), quadratic non residue - * * (a | p) ≡ 0 if a ≡ 0 (mod p) - * @param Fp - Field implementation. - * @param n - Value to inspect. - * @returns Legendre symbol. - * @throws If the field returns an invalid Legendre symbol value. {@link Error} - * @example - * Compute the Legendre symbol of one field element. - * - * ```ts - * import { Field, FpLegendre } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const symbol = FpLegendre(Fp, 4n); - * ``` - */ -export function FpLegendre(Fp: TArg>, n: T): -1 | 0 | 1 { - const F = Fp as IField; - // We can use 3rd argument as optional cache of this value - // but seems unneeded for now. The operation is very fast. - const p1mod2 = (F.ORDER - _1n) / _2n; - const powered = F.pow(n, p1mod2); - const yes = F.eql(powered, F.ONE); - const zero = F.eql(powered, F.ZERO); - const no = F.eql(powered, F.neg(F.ONE)); - if (!yes && !zero && !no) throw new Error('invalid Legendre symbol result'); - return yes ? 1 : zero ? 0 : -1; -} - -/** - * @param Fp - Field implementation. - * @param n - Value to inspect. - * @returns `true` when `Fp.sqrt(n)` exists. This includes `0`, even though strict "quadratic - * residue" terminology often reserves that name for the non-zero square class. - * @throws If the field returns an invalid Legendre symbol value. {@link Error} - * @example - * Check whether one field element has a square root in the field. - * - * ```ts - * import { Field, FpIsSquare } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const isSquare = FpIsSquare(Fp, 4n); - * ``` - */ -export function FpIsSquare(Fp: TArg>, n: T): boolean { - const l = FpLegendre(Fp as IField, n); - // Zero is a square too: 0 = 0^2, and Fp.sqrt(0) already returns 0. - return l !== -1; -} - -/** Byte and bit lengths derived from one scalar order. */ -export type NLength = { - /** Canonical byte length. */ - nByteLength: number; - /** Canonical bit length. */ - nBitLength: number; -}; -/** - * @param n - Curve order. Callers are expected to pass a positive order. - * @param nBitLength - Optional cached bit length. Callers are expected to pass a positive cached - * value when overriding the derived bit length. - * @returns Byte and bit lengths. - * @throws If the order or cached bit length is invalid. {@link Error} - * @example - * Measure the encoding sizes needed for one modulus. - * - * ```ts - * nLength(255n); - * ``` - */ -export function nLength(n: bigint, nBitLength?: number): NLength { - // Bit size, byte size of CURVE.n - if (nBitLength !== undefined) anumber(nBitLength); - if (n <= _0n) throw new Error('invalid n length: expected positive n, got ' + n); - if (nBitLength !== undefined && nBitLength < 1) - throw new Error('invalid n length: expected positive bit length, got ' + nBitLength); - const bits = bitLen(n); - // Cached bit lengths smaller than ORDER would truncate serialized scalars/elements and poison - // any math that relies on the derived field metadata. - if (nBitLength !== undefined && nBitLength < bits) - throw new Error(`invalid n length: expected bit length (${bits}) >= n.length (${nBitLength})`); - const _nBitLength = nBitLength !== undefined ? nBitLength : bits; - const nByteLength = Math.ceil(_nBitLength / 8); - return { nBitLength: _nBitLength, nByteLength }; -} - -type FpField = IField & Required, 'isOdd'>>; -type SqrtFn = (n: bigint) => bigint; -type FieldOpts = Partial<{ - isLE: boolean; - BITS: number; - sqrt: SqrtFn; - allowedLengths?: readonly number[]; // for P521 (adds padding for smaller sizes); must stay > 0 - modFromBytes: boolean; // bls12-381 requires mod(n) instead of rejecting keys >= n -}>; -// Keep the lazy sqrt cache off-instance so Field(...) can return a frozen object. Otherwise the -// cached helper write would keep the field surface externally mutable. -const FIELD_SQRT = new WeakMap>(); -class _Field implements IField { - readonly ORDER: bigint; - readonly BITS: number; - readonly BYTES: number; - readonly isLE: boolean; - readonly ZERO = _0n; - readonly ONE = _1n; - readonly _lengths?: readonly number[]; - private readonly _mod?: boolean; - constructor(ORDER: bigint, opts: FieldOpts = {}) { - // ORDER <= 1 is degenerate: ONE would not be a valid field element and helpers like pow/inv - // would stop modeling field arithmetic. - if (ORDER <= _1n) throw new Error('invalid field: expected ORDER > 1, got ' + ORDER); - let _nbitLength: number | undefined = undefined; - this.isLE = false; - if (opts != null && typeof opts === 'object') { - // Cached bit lengths are trusted here and should already be positive / consistent with ORDER. - if (typeof opts.BITS === 'number') _nbitLength = opts.BITS; - if (typeof opts.sqrt === 'function') - // `_Field.prototype` is frozen below, so custom sqrt hooks must become own properties - // explicitly instead of relying on writable prototype shadowing via assignment. - Object.defineProperty(this, 'sqrt', { value: opts.sqrt, enumerable: true }); - if (typeof opts.isLE === 'boolean') this.isLE = opts.isLE; - if (opts.allowedLengths) this._lengths = Object.freeze(opts.allowedLengths.slice()); - if (typeof opts.modFromBytes === 'boolean') this._mod = opts.modFromBytes; - } - const { nBitLength, nByteLength } = nLength(ORDER, _nbitLength); - if (nByteLength > 2048) throw new Error('invalid field: expected ORDER of <= 2048 bytes'); - this.ORDER = ORDER; - this.BITS = nBitLength; - this.BYTES = nByteLength; - Object.freeze(this); - } - - create(num: bigint) { - return mod(num, this.ORDER); - } - isValid(num: bigint) { - if (typeof num !== 'bigint') - throw new TypeError('invalid field element: expected bigint, got ' + typeof num); - return _0n <= num && num < this.ORDER; // 0 is valid element, but it's not invertible - } - is0(num: bigint) { - return num === _0n; - } - // is valid and invertible - isValidNot0(num: bigint) { - return !this.is0(num) && this.isValid(num); - } - isOdd(num: bigint) { - return (num & _1n) === _1n; - } - neg(num: bigint) { - return mod(-num, this.ORDER); - } - eql(lhs: bigint, rhs: bigint) { - return lhs === rhs; - } - - sqr(num: bigint) { - return mod(num * num, this.ORDER); - } - add(lhs: bigint, rhs: bigint) { - return mod(lhs + rhs, this.ORDER); - } - sub(lhs: bigint, rhs: bigint) { - return mod(lhs - rhs, this.ORDER); - } - mul(lhs: bigint, rhs: bigint) { - return mod(lhs * rhs, this.ORDER); - } - pow(num: bigint, power: bigint): bigint { - return FpPow(this, num, power); - } - div(lhs: bigint, rhs: bigint) { - return mod(lhs * invert(rhs, this.ORDER), this.ORDER); - } - - // Same as above, but doesn't normalize - sqrN(num: bigint) { - return num * num; - } - addN(lhs: bigint, rhs: bigint) { - return lhs + rhs; - } - subN(lhs: bigint, rhs: bigint) { - return lhs - rhs; - } - mulN(lhs: bigint, rhs: bigint) { - return lhs * rhs; - } - - inv(num: bigint) { - return invert(num, this.ORDER); - } - sqrt(num: bigint): bigint { - // Caching sqrt helpers speeds up sqrt9mod16 by 5x and Tonelli-Shanks by about 10% without keeping - // the field instance itself mutable. - let sqrt = FIELD_SQRT.get(this); - if (!sqrt) FIELD_SQRT.set(this, (sqrt = FpSqrt(this.ORDER))); - return sqrt(this, num); - } - toBytes(num: bigint) { - // Serialize fixed-width limbs without re-validating the field range. Callers that need a - // canonical encoding must pass a valid element; some protocols intentionally serialize raw - // residues here and reduce or validate them elsewhere. - return this.isLE ? numberToBytesLE(num, this.BYTES) : numberToBytesBE(num, this.BYTES); - } - fromBytes(bytes: Uint8Array, skipValidation = false) { - abytes(bytes); - const { _lengths: allowedLengths, BYTES, isLE, ORDER, _mod: modFromBytes } = this; - if (allowedLengths) { - // `allowedLengths` must list real positive byte lengths; otherwise empty input would get - // padded into zero and silently decode as a field element. - if (bytes.length < 1 || !allowedLengths.includes(bytes.length) || bytes.length > BYTES) { - throw new Error( - 'Field.fromBytes: expected ' + allowedLengths + ' bytes, got ' + bytes.length - ); - } - const padded = new Uint8Array(BYTES); - // isLE add 0 to right, !isLE to the left. - padded.set(bytes, isLE ? 0 : padded.length - bytes.length); - bytes = padded; - } - if (bytes.length !== BYTES) - throw new Error('Field.fromBytes: expected ' + BYTES + ' bytes, got ' + bytes.length); - let scalar = isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes); - if (modFromBytes) scalar = mod(scalar, ORDER); - if (!skipValidation) - if (!this.isValid(scalar)) - throw new Error('invalid field element: outside of range 0..ORDER'); - // Range validation is optional here because some protocols intentionally decode raw residues - // and reduce or validate them elsewhere. - return scalar; - } - // TODO: we don't need it here, move out to separate fn - invertBatch(lst: bigint[]): bigint[] { - return FpInvertBatch(this, lst); - } - // We can't move this out because Fp6, Fp12 implement it - // and it's unclear what to return in there. - cmov(a: bigint, b: bigint, condition: boolean) { - // Field elements have `isValid(...)`; the CMOV branch bit is a direct runtime input, so reject - // non-boolean selectors here instead of letting JS truthiness silently change arithmetic. - abool(condition, 'condition'); - return condition ? b : a; - } -} -// Freeze the shared method surface too; otherwise callers can still poison every Field instance by -// monkey-patching `_Field.prototype` even if each instance is frozen. -Object.freeze(_Field.prototype); - -/** - * Creates a finite field. Major performance optimizations: - * * 1. Denormalized operations like mulN instead of mul. - * * 2. Identical object shape: never add or remove keys. - * * 3. Frozen stable object shape; the lazy sqrt cache lives in a module-level `WeakMap`. - * Fragile: always run a benchmark on a change. - * Security note: operations and low-level serializers like `toBytes` don't check `isValid` for - * all elements for performance and protocol-flexibility reasons; callers are responsible for - * supplying valid elements when they need canonical field behavior. - * This is low-level code, please make sure you know what you're doing. - * - * Note about field properties: - * * CHARACTERISTIC p = prime number, number of elements in main subgroup. - * * ORDER q = similar to cofactor in curves, may be composite `q = p^m`. - * - * @param ORDER - field order, probably prime, or could be composite - * @param opts - Field options such as bit length or endianness. See {@link FieldOpts}. - * @returns Frozen field instance with a stable object shape. This wrapper forwards `opts` straight - * into `_Field`, so it inherits `_Field`'s assumptions about cached sizes and `allowedLengths`. - * @example - * Construct one prime field with optional overrides. - * - * ```ts - * Field(11n); - * ``` - */ -export function Field(ORDER: bigint, opts: FieldOpts = {}): TRet> { - return new _Field(ORDER, opts); -} - -// Generic random scalar, we can do same for other fields if via Fp2.mul(Fp2.ONE, Fp2.random)? -// This allows unsafe methods like ignore bias or zero. These unsafe, but often used in different protocols (if deterministic RNG). -// which mean we cannot force this via opts. -// Not sure what to do with randomBytes, we can accept it inside opts if wanted. -// Probably need to export getMinHashLength somewhere? -// random(bytes?: Uint8Array, unsafeAllowZero = false, unsafeAllowBias = false) { -// const LEN = !unsafeAllowBias ? getMinHashLength(ORDER) : BYTES; -// if (bytes === undefined) bytes = randomBytes(LEN); // _opts.randomBytes? -// const num = isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes); -// // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 -// const reduced = unsafeAllowZero ? mod(num, ORDER) : mod(num, ORDER - _1n) + _1n; -// return reduced; -// }, - -/** - * @param Fp - Field implementation. - * @param elm - Value to square-root. - * @returns Odd square root when two roots exist. The special case `elm = 0` still returns `0`, - * which is the only square root but is not odd. - * @throws If the field lacks oddness checks or the square root does not exist. {@link Error} - * @example - * Select the odd square root when two roots exist. - * - * ```ts - * import { Field, FpSqrtOdd } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const root = FpSqrtOdd(Fp, 4n); - * ``` - */ -export function FpSqrtOdd(Fp: TArg>, elm: T): T { - const F = Fp as IField; - if (!F.isOdd) throw new Error("Field doesn't have isOdd"); - const root = F.sqrt(elm); - return F.isOdd(root) ? root : F.neg(root); -} - -/** - * @param Fp - Field implementation. - * @param elm - Value to square-root. - * @returns Even square root. - * @throws If the field lacks oddness checks or the square root does not exist. {@link Error} - * @example - * Select the even square root when two roots exist. - * - * ```ts - * import { Field, FpSqrtEven } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const root = FpSqrtEven(Fp, 4n); - * ``` - */ -export function FpSqrtEven(Fp: TArg>, elm: T): T { - const F = Fp as IField; - if (!F.isOdd) throw new Error("Field doesn't have isOdd"); - const root = F.sqrt(elm); - return F.isOdd(root) ? F.neg(root) : root; -} - -/** - * Returns total number of bytes consumed by the field element. - * For example, 32 bytes for usual 256-bit weierstrass curve. - * @param fieldOrder - number of field elements, usually CURVE.n. Callers are expected to pass an - * order greater than 1. - * @returns byte length of field - * @throws If the field order is not a bigint. {@link Error} - * @example - * Read the fixed-width byte length of one field. - * - * ```ts - * getFieldBytesLength(255n); - * ``` - */ -export function getFieldBytesLength(fieldOrder: bigint): number { - if (typeof fieldOrder !== 'bigint') throw new Error('field order must be bigint'); - // Valid field elements are in 0..ORDER-1, so ORDER <= 1 would make the encoded range degenerate. - if (fieldOrder <= _1n) throw new Error('field order must be greater than 1'); - // Valid field elements are < ORDER, so the maximal encoded element is ORDER - 1. - const bitLength = bitLen(fieldOrder - _1n); - return Math.ceil(bitLength / 8); -} - -/** - * Returns minimal amount of bytes that can be safely reduced - * by field order. - * Should be 2^-128 for 128-bit curve such as P256. - * This is the reduction / modulo-bias lower bound; higher-level helpers may still impose a larger - * absolute floor for policy reasons. - * @param fieldOrder - number of field elements greater than 1, usually CURVE.n. - * @returns byte length of target hash - * @throws If the field order is invalid. {@link Error} - * @example - * Compute the minimum hash length needed for field reduction. - * - * ```ts - * getMinHashLength(255n); - * ``` - */ -export function getMinHashLength(fieldOrder: bigint): number { - const length = getFieldBytesLength(fieldOrder); - return length + Math.ceil(length / 2); -} - -/** - * "Constant-time" private key generation utility. - * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF - * and convert them into private scalar, with the modulo bias being negligible. - * Needs at least 48 bytes of input for 32-byte private key. The implementation also keeps a hard - * 16-byte minimum even when `getMinHashLength(...)` is smaller, so toy-small inputs do not look - * accidentally acceptable for real scalar derivation. - * See {@link https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ | Kudelski's modulo-bias guide}, - * {@link https://csrc.nist.gov/publications/detail/fips/186/5/final | FIPS 186-5 appendix A.2}, and - * {@link https://www.rfc-editor.org/rfc/rfc9380#section-5 | RFC 9380 section 5}. Unlike RFC 9380 - * `hash_to_field`, this helper intentionally maps into the non-zero private-scalar range `1..n-1`. - * @param key - Uniform input bytes. - * @param fieldOrder - Size of subgroup. - * @param isLE - interpret hash bytes as LE num - * @returns valid private scalar - * @throws If the hash length or field order is invalid for scalar reduction. {@link Error} - * @example - * Map hash output into a private scalar range. - * - * ```ts - * mapHashToField(new Uint8Array(48).fill(1), 255n); - * ``` - */ -export function mapHashToField( - key: TArg, - fieldOrder: bigint, - isLE = false -): TRet { - abytes(key); - const len = key.length; - const fieldLen = getFieldBytesLength(fieldOrder); - const minLen = Math.max(getMinHashLength(fieldOrder), 16); - // No toy-small inputs: the helper is for real scalar derivation, not tiny test curves. No huge - // inputs: easier to reason about JS timing / allocation behavior. - if (len < minLen || len > 1024) - throw new Error('expected ' + minLen + '-1024 bytes of input, got ' + len); - const num = isLE ? bytesToNumberLE(key) : bytesToNumberBE(key); - // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 - const reduced = mod(num, fieldOrder - _1n) + _1n; - return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); -} diff --git a/node_modules/@noble/curves/src/abstract/montgomery.ts b/node_modules/@noble/curves/src/abstract/montgomery.ts deleted file mode 100644 index cf49cd5..0000000 --- a/node_modules/@noble/curves/src/abstract/montgomery.ts +++ /dev/null @@ -1,271 +0,0 @@ -/** - * Montgomery curve methods. It's not really whole montgomery curve, - * just bunch of very specific methods for X25519 / X448 from - * [RFC 7748](https://www.rfc-editor.org/rfc/rfc7748) - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { - abytes, - aInRange, - bytesToNumberLE, - copyBytes, - numberToBytesLE, - randomBytes, - validateObject, - type CryptoKeys, - type TArg, - type TRet, -} from '../utils.ts'; -import { createKeygen, type CurveLengths } from './curve.ts'; -import { mod } from './modular.ts'; - -const _0n = BigInt(0); -const _1n = BigInt(1); -const _2n = BigInt(2); - -/** Curve-specific hooks required to build one X25519/X448 helper. */ -export type MontgomeryOpts = { - /** Prime field modulus. */ - P: bigint; - /** RFC 7748 variant name. */ - type: 'x25519' | 'x448'; - /** - * Clamp or otherwise normalize one scalar byte string before use. - * @param bytes - Raw secret scalar bytes. - * @returns Adjusted scalar bytes ready for Montgomery multiplication. - */ - adjustScalarBytes: (bytes: TArg) => TRet; - /** - * Invert one field element with exponentiation by `p - 2`. - * @param x - Field element to invert. - * @returns Multiplicative inverse of `x`. - */ - powPminus2: (x: bigint) => bigint; - /** - * Optional randomness source for `keygen()` and `utils.randomSecretKey()`. - * Receives the requested byte length and returns fresh random bytes. - */ - randomBytes?: (bytesLength?: number) => TRet; -}; - -/** Public X25519/X448 ECDH API built on a Montgomery ladder. */ -export type MontgomeryECDH = { - /** - * Multiply one scalar by one Montgomery `u` coordinate. - * @param scalar - Secret scalar bytes. - * @param u - Public Montgomery `u` coordinate. - * @returns Shared point encoded as bytes. - */ - scalarMult: (scalar: TArg, u: TArg) => TRet; - /** - * Multiply one scalar by the curve base point. - * @param scalar - Secret scalar bytes. - * @returns Public key bytes. - */ - scalarMultBase: (scalar: TArg) => TRet; - /** - * Derive a shared secret from a local secret key and peer public key. - * @param secretKeyA - Local secret key bytes. - * @param publicKeyB - Peer public key bytes. - * Rejects low-order public inputs instead of returning the all-zero shared secret. - * @returns Shared secret bytes. - */ - getSharedSecret: (secretKeyA: TArg, publicKeyB: TArg) => TRet; - /** - * Derive one public key from a secret key. - * @param secretKey - Secret key bytes. - * @returns Public key bytes. - */ - getPublicKey: (secretKey: TArg) => TRet; - /** Utility helpers for secret-key generation. */ - utils: { - /** Generate one random secret key with the curve's expected byte length. */ - randomSecretKey: () => TRet; - }; - /** Encoded Montgomery base point `u`. */ - GuBytes: TRet; - /** Public lengths for keys and seeds. */ - lengths: CurveLengths; - /** - * Generate one random secret/public keypair. - * @param seed - Optional seed bytes to use instead of random generation. - * @returns Fresh secret/public keypair. - */ - keygen: (seed?: TArg) => { - secretKey: TRet; - publicKey: TRet; - }; -}; - -function validateOpts(curve: TArg) { - // Validate constructor config eagerly, but do not call user-provided hooks here: - // `randomBytes` may be transcript-backed or otherwise contextual. Runtime type checks are - // enough to fail fast on malformed configs without consuming user state. - validateObject( - curve, - { - P: 'bigint', - type: 'string', - adjustScalarBytes: 'function', - powPminus2: 'function', - }, - { - randomBytes: 'function', - } - ); - return Object.freeze({ ...curve } as const); -} - -/** - * @param curveDef - Montgomery curve definition. - * @returns ECDH helper namespace. - * @throws If the curve definition or derived shared point is invalid. {@link Error} - * @example - * Perform one X25519 key exchange through the generic Montgomery helper. - * - * ```ts - * import { x25519 } from '@noble/curves/ed25519.js'; - * const alice = x25519.keygen(); - * const shared = x25519.getSharedSecret(alice.secretKey, alice.publicKey); - * ``` - */ -export function montgomery(curveDef: TArg): TRet { - const CURVE = validateOpts(curveDef); - const { P, type, adjustScalarBytes, powPminus2, randomBytes: rand } = CURVE; - const is25519 = type === 'x25519'; - if (!is25519 && type !== 'x448') throw new Error('invalid type'); - const randomBytes_ = rand === undefined ? randomBytes : rand; - - const montgomeryBits = is25519 ? 255 : 448; - const fieldLen = is25519 ? 32 : 56; - const Gu = is25519 ? BigInt(9) : BigInt(5); - // RFC 7748 #5: - // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519 and - // (156326 - 2) / 4 = 39081 for curve448/X448 - // const a = is25519 ? 486662n : 156326n; - const a24 = is25519 ? BigInt(121665) : BigInt(39081); - // RFC: x25519 "the resulting integer is of the form 2^254 plus - // eight times a value between 0 and 2^251 - 1 (inclusive)" - // x448: "2^447 plus four times a value between 0 and 2^445 - 1 (inclusive)" - const minScalar = is25519 ? _2n ** BigInt(254) : _2n ** BigInt(447); - const maxAdded = is25519 - ? BigInt(8) * _2n ** BigInt(251) - _1n - : BigInt(4) * _2n ** BigInt(445) - _1n; - const maxScalar = minScalar + maxAdded + _1n; // (inclusive) - const modP = (n: bigint) => mod(n, P); - const GuBytes = encodeU(Gu); - function encodeU(u: bigint): TRet { - return numberToBytesLE(modP(u), fieldLen); - } - function decodeU(u: TArg): bigint { - const _u = copyBytes(abytes(u, fieldLen, 'uCoordinate')); - // RFC: When receiving such an array, implementations of X25519 - // (but not X448) MUST mask the most significant bit in the final byte. - if (is25519) _u[31] &= 127; // 0b0111_1111 - // RFC: Implementations MUST accept non-canonical values and process them as - // if they had been reduced modulo the field prime. The non-canonical - // values are 2^255 - 19 through 2^255 - 1 for X25519 and 2^448 - 2^224 - // - 1 through 2^448 - 1 for X448. - return modP(bytesToNumberLE(_u)); - } - function decodeScalar(scalar: TArg): bigint { - return bytesToNumberLE(adjustScalarBytes(copyBytes(abytes(scalar, fieldLen, 'scalar')))); - } - function scalarMult(scalar: TArg, u: TArg): TRet { - const pu = montgomeryLadder(decodeU(u), decodeScalar(scalar)); - // Some public keys are useless, of low-order. Curve author doesn't think - // it needs to be validated, but we do it nonetheless. - // https://cr.yp.to/ecdh.html#validate - if (pu === _0n) throw new Error('invalid private or public key received'); - return encodeU(pu); - } - // Computes public key from private. By doing scalar multiplication of base point. - function scalarMultBase(scalar: TArg): TRet { - return scalarMult(scalar, GuBytes); - } - const getPublicKey = scalarMultBase; - const getSharedSecret = scalarMult; - - // cswap from RFC7748 "example code" - function cswap(swap: bigint, x_2: bigint, x_3: bigint): { x_2: bigint; x_3: bigint } { - // dummy = mask(swap) AND (x_2 XOR x_3) - // Where mask(swap) is the all-1 or all-0 word of the same length as x_2 - // and x_3, computed, e.g., as mask(swap) = 0 - swap. - const dummy = modP(swap * (x_2 - x_3)); - x_2 = modP(x_2 - dummy); // x_2 = x_2 XOR dummy - x_3 = modP(x_3 + dummy); // x_3 = x_3 XOR dummy - return { x_2, x_3 }; - } - - /** - * Montgomery x-only multiplication ladder for the selected X25519/X448 curve. - * @param pointU - decoded Montgomery u coordinate for the selected curve - * @param scalar - decoded clamped scalar by which the point is multiplied - * @returns resulting Montgomery u coordinate for the selected curve - */ - function montgomeryLadder(u: bigint, scalar: bigint): bigint { - aInRange('u', u, _0n, P); - aInRange('scalar', scalar, minScalar, maxScalar); - const k = scalar; - const x_1 = u; - let x_2 = _1n; - let z_2 = _0n; - let x_3 = u; - let z_3 = _1n; - let swap = _0n; - for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) { - const k_t = (k >> t) & _1n; - swap ^= k_t; - ({ x_2, x_3 } = cswap(swap, x_2, x_3)); - ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3)); - swap = k_t; - - const A = x_2 + z_2; - const AA = modP(A * A); - const B = x_2 - z_2; - const BB = modP(B * B); - const E = AA - BB; - const C = x_3 + z_3; - const D = x_3 - z_3; - const DA = modP(D * A); - const CB = modP(C * B); - const dacb = DA + CB; - const da_cb = DA - CB; - x_3 = modP(dacb * dacb); - z_3 = modP(x_1 * modP(da_cb * da_cb)); - x_2 = modP(AA * BB); - z_2 = modP(E * (AA + modP(a24 * E))); - } - ({ x_2, x_3 } = cswap(swap, x_2, x_3)); - ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3)); - const z2 = powPminus2(z_2); // `Fp.pow(x, P - _2n)` is much slower equivalent - return modP(x_2 * z2); // Return x_2 * (z_2^(p - 2)) - } - const lengths = { - secretKey: fieldLen, - publicKey: fieldLen, - seed: fieldLen, - }; - const randomSecretKey = (seed?: TArg): TRet => { - seed = seed === undefined ? randomBytes_(fieldLen) : seed; - abytes(seed, lengths.seed, 'seed'); - // Reuse caller-supplied seed bytes verbatim; clamping is deferred until - // decodeScalar(...) when the secret key is actually used. - return seed as TRet; - }; - const utils = { randomSecretKey }; - Object.freeze(lengths); - Object.freeze(utils); - - return Object.freeze({ - keygen: createKeygen(randomSecretKey, getPublicKey), - getSharedSecret, - getPublicKey, - scalarMult, - scalarMultBase, - utils, - GuBytes: GuBytes.slice() as TRet, - lengths, - }) satisfies CryptoKeys; -} diff --git a/node_modules/@noble/curves/src/abstract/oprf.ts b/node_modules/@noble/curves/src/abstract/oprf.ts deleted file mode 100644 index 32dab93..0000000 --- a/node_modules/@noble/curves/src/abstract/oprf.ts +++ /dev/null @@ -1,789 +0,0 @@ -/** - * RFC 9497: Oblivious Pseudorandom Functions (OPRFs) Using Prime-Order Groups. - * https://www.rfc-editor.org/rfc/rfc9497 - * - -OPRF allows to interactively create an `Output = PRF(Input, serverSecretKey)`: - -- Server cannot calculate Output by itself: it doesn't know Input -- Client cannot calculate Output by itself: it doesn't know server secretKey -- An attacker interception the communication can't restore Input/Output/serverSecretKey and can't - link Input to some value. - -## Issues - -- Low-entropy inputs (e.g. password '123') enable brute-forced dictionary attacks by the server - (solveable by domain separation in POPRF) -- High-level protocol needs to be constructed on top, because OPRF is low-level - -## Use cases - -1. **Password-Authenticated Key Exchange (PAKE):** Enables secure password login (e.g., OPAQUE) - without revealing the password to the server. -2. **Private Set Intersection (PSI):** Allows two parties to compute the intersection of their - private sets without revealing non-intersecting elements. -3. **Anonymous Credential Systems:** Supports issuance of anonymous, unlinkable credentials - (e.g., Privacy Pass) using blind OPRF evaluation. -4. **Private Information Retrieval (PIR):** Helps users query databases without revealing which - item they accessed. -5. **Encrypted Search / Secure Indexing:** Enables keyword search over encrypted data while keeping - queries private. -6. **Spam Prevention and Rate-Limiting:** Issues anonymous tokens to prevent abuse - (e.g., CAPTCHA bypass) without compromising user privacy. - -## Modes - -- OPRF: simple mode, client doesn't need to know server public key -- VOPRF: verifiable mode. It lets the client verify that the server used the - secret key corresponding to a known public key -- POPRF: partially oblivious mode, VOPRF + domain separation - -There is also non-interactive mode (Evaluate), which creates Output -non-interactively with knowledge of the secret key. - -Flow: -- (once) Server generates secret and public keys, distributes public keys to clients - - deterministically: `deriveKeyPair` or just random: `generateKeyPair` -- Client blinds input: `blind(secretInput)` -- Server evaluates blinded input: `blindEvaluate` generated by client, sends result to client -- Client creates output using result of evaluation via 'finalize' - - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { - abytes, - asciiToBytes, - bytesToNumberBE, - bytesToNumberLE, - concatBytes, - numberToBytesBE, - randomBytes, - validateObject, - type TArg, - type TRet, -} from '../utils.ts'; -import { pippenger, validatePointCons, type CurvePoint, type CurvePointCons } from './curve.ts'; -import { _DST_scalar, type H2CDSTOpts } from './hash-to-curve.ts'; -import { getMinHashLength, mapHashToField } from './modular.ts'; - -// OPRF is designed to be used across network, so we default to serialized values. -/** Serialized group element passed between OPRF participants. */ -export type PointBytes = Uint8Array; -/** Serialized scalar used for blinds and server secret keys. */ -export type ScalarBytes = Uint8Array; -/** Arbitrary byte input or output used by the OPRF protocol. */ -export type Bytes = Uint8Array; -const _DST_scalarBytes = /* @__PURE__ */ asciiToBytes(_DST_scalar); -/** Cryptographically secure byte generator used for blinds and proofs. */ -export type RNG = typeof randomBytes; - -/** Curve and hash hooks required to instantiate one OPRF ciphersuite. */ -export type OPRFOpts

> = { - /** Human-readable suite identifier used for domain separation. */ - name: string; - /** - * Prime-order group used by the OPRF construction. - * Kept generic because the suite returns serialized points. - */ - Point: CurvePointCons

; - // Fn: IField; - /** - * Hash function used for transcripts, proofs, and outputs. - * @param msg - Message bytes to hash. - * @returns Digest bytes. - */ - hash(msg: TArg): TRet; - /** - * Hash arbitrary bytes into one scalar in the suite order. - * @param msg - Message bytes to map. - * @param options - Hash-to-field domain-separation options. See {@link H2CDSTOpts}. - * Implementations MUST treat `msg` and `options` as read-only. - * @returns Scalar in the suite order. - */ - hashToScalar(msg: TArg, options: TArg): bigint; - /** - * Hash arbitrary bytes directly onto one curve point. - * @param msg - Message bytes to map. - * @param options - Hash-to-curve domain-separation options. See {@link H2CDSTOpts}. - * Implementations MUST treat `msg` and `options` as read-only. - * @returns Point on the suite curve. - */ - hashToGroup(msg: TArg, options: TArg): P; -}; - -/** Server keypair for one OPRF suite. */ -export type OPRFKeys = { - /** Secret scalar kept by the server. */ - secretKey: TRet; - /** Public point distributed to clients in verifiable modes. */ - publicKey: TRet; -}; -/** Result of the client-side blind step. */ -export type OPRFBlind = { - /** Secret blind scalar that the client keeps locally. */ - blind: TRet; - /** Blinded group element sent to the server. */ - blinded: TRet; -}; -/** Server response for one verifiable OPRF evaluation. */ -export type OPRFBlindEval = { - /** Evaluated group element returned by the server. */ - evaluated: TRet; - /** DLEQ proof binding the evaluation to the server public key. */ - proof: TRet; -}; -/** Server response for a batch of verifiable OPRF evaluations. */ -export type OPRFBlindEvalBatch = { - /** Evaluated group elements returned for each blinded input. */ - evaluated: TRet; - /** Batch proof covering all evaluated elements. */ - proof: TRet; -}; -/** One finalized transcript item used by batch verification helpers. */ -export type OPRFFinalizeItem = { - /** Original client input. */ - input: Bytes; - /** Secret blind scalar used for the input. */ - blind: ScalarBytes; - /** Evaluated point returned by the server. */ - evaluated: PointBytes; - /** Blinded point originally sent to the server. */ - blinded: PointBytes; -}; -/** Result of the POPRF client-side blind step with the tweaked server public key. */ -export type OPRFBlindTweaked = OPRFBlind & { tweakedKey: TRet }; - -/** - * Represents a full OPRF ciphersuite implementation according to RFC 9497. - * This object bundles the three protocol variants (OPRF, VOPRF, POPRF) for a specific - * prime-order group and hash function combination. - * - * @see https://www.rfc-editor.org/rfc/rfc9497.html - */ -export type OPRF = { - /** - * The unique identifier for the ciphersuite, e.g., "ristretto255-SHA512". - * This name is used for domain separation to prevent cross-protocol attacks. - */ - readonly name: string; - - /** - * The base Oblivious Pseudorandom Function (OPRF) mode (mode 0x00). - * This is a two-party protocol between a client and a server to compute F(k, x) - * where 'k' is the server's key and 'x' is the client's input. - * - * The client learns the output F(k, x) but nothing about 'k'. - * The server learns nothing about 'x' or F(k, x). - * This mode is NOT verifiable; the client cannot prove the server used a specific key. - */ - readonly oprf: { - /** - * (Server-side) Generates a new random private/public key pair for the server. - * @returns A new key pair. - */ - generateKeyPair(): TRet; - - /** - * (Server-side) Deterministically derives a private/public key pair from a seed. - * @param seed - A 32-byte cryptographically secure random seed. - * @param keyInfo - An optional byte string for domain separation. - * @returns The derived key pair. - */ - deriveKeyPair(seed: TArg, keyInfo: TArg): TRet; - - /** - * (Client-side) The first step of the protocol. The client blinds its private input. - * @param input - The client's private input bytes. - * @param rng - An optional cryptographically secure random number generator. - * @returns An object containing the `blind` scalar (which the client MUST keep secret) - * and the `blinded` element (which the client sends to the server). - */ - blind(input: TArg, rng?: RNG): TRet; - - /** - * (Server-side) The second step. The server evaluates the client's blinded element - * using its secret key. - * @param secretKey - The server's private key. - * @param blinded - The blinded group element received from the client. - * @returns The evaluated group element, to be sent back to the client. - */ - blindEvaluate(secretKey: TArg, blinded: TArg): TRet; - - /** - * (Client-side) The final step. The client unblinds the server's response to - * compute the final OPRF output. - * @param input - The original private input from the `blind` step. - * @param blind - The secret scalar from the `blind` step. - * @param evaluated - The evaluated group element received from the server. - * @returns The final OPRF output, `Hash(len(input)||input||len(unblinded)||unblinded||"Finalize")`. - */ - finalize( - input: TArg, - blind: TArg, - evaluated: TArg - ): TRet; - }; - - /** - * The Verifiable Oblivious Pseudorandom Function (VOPRF) mode (mode 0x01). - * This mode extends the base OPRF by providing a proof that the server used the - * secret key corresponding to its known public key. - */ - readonly voprf: { - /** (Server-side) Generates a key pair for the VOPRF mode. */ - generateKeyPair(): TRet; - /** (Server-side) Deterministically derives a key pair for the VOPRF mode. */ - deriveKeyPair(seed: TArg, keyInfo: TArg): TRet; - /** (Client-side) Blinds the client's private input for the VOPRF protocol. */ - blind(input: TArg, rng?: RNG): TRet; - - /** - * (Server-side) Evaluates the client's blinded element and generates a DLEQ proof - * of correctness. - * @param secretKey - The server's private key. - * @param publicKey - The server's public key, used in proof generation. - * @param blinded - The blinded group element received from the client. - * @param rng - An optional cryptographically secure random number generator for the proof. - * @returns The evaluated element and a proof of correct computation. - */ - blindEvaluate( - secretKey: TArg, - publicKey: TArg, - blinded: TArg, - rng?: RNG - ): TRet; - - /** - * (Server-side) An optimized batch version of `blindEvaluate`. It evaluates multiple - * blinded elements and produces a single, constant-size proof for the entire batch, - * amortizing the cost of proof generation. - * @param secretKey - The server's private key. - * @param publicKey - The server's public key. - * @param blinded - An array of blinded group elements from one or more clients. - * @param rng - An optional cryptographically secure random number generator for the proof. - * @returns An array of evaluated elements and a single proof for the batch. - */ - blindEvaluateBatch( - secretKey: TArg, - publicKey: TArg, - blinded: TArg, - rng?: RNG - ): TRet; - - /** - * (Client-side) The final step. The client verifies the server's proof, and if valid, - * unblinds the result to compute the final VOPRF output. - * @param input - The original private input. - * @param blind - The secret scalar from the `blind` step. - * @param evaluated - The evaluated element from the server. - * @param blinded - The blinded element sent to the server (needed for proof verification). - * @param publicKey - The server's public key against which the proof is verified. - * @param proof - The DLEQ proof from the server. - * @returns The final VOPRF output. - * @throws If the proof verification fails. {@link Error} - */ - finalize( - input: TArg, - blind: TArg, - evaluated: TArg, - blinded: TArg, - publicKey: TArg, - proof: TArg - ): TRet; - - /** - * (Client-side) The batch-aware version of `finalize`. It verifies a single batch proof - * against a list of corresponding inputs and outputs. - * @param items - An array of objects, each containing the parameters for a single finalization. - * @param publicKey - The server's public key. - * @param proof - The single DLEQ proof for the entire batch. - * @returns An array of final VOPRF outputs, one for each item in the input. - * @throws If the proof verification fails. {@link Error} - */ - finalizeBatch( - items: TArg, - publicKey: TArg, - proof: TArg - ): TRet; - }; - - /** - * A factory for the Partially Oblivious Pseudorandom Function (POPRF) mode (mode 0x02). - * This mode extends VOPRF to include a public `info` parameter, known to both client and - * server, which is cryptographically bound to the final output. - * This is useful for domain separation at the application level. - * @param info - A public byte string to be mixed into the computation. - * @returns An object with the POPRF protocol functions. - */ - readonly poprf: (info: TArg) => { - /** (Server-side) Generates a key pair for the POPRF mode. */ - generateKeyPair(): TRet; - /** (Server-side) Deterministically derives a key pair for the POPRF mode. */ - deriveKeyPair(seed: TArg, keyInfo: TArg): TRet; - - /** - * (Client-side) Blinds the client's private input and computes the "tweaked key". - * The tweaked key is a public value derived from the server's public key and the public `info`. - * @param input - The client's private input. - * @param publicKey - The server's public key. - * @param rng - An optional cryptographically secure random number generator. - * @returns The `blind`, `blinded` element, and the `tweakedKey` - * the client uses for verification. - */ - blind(input: TArg, publicKey: TArg, rng?: RNG): TRet; - - /** - * (Server-side) Evaluates the blinded element using a key derived from - * its secret key and the public `info`. - * It generates a DLEQ proof against the tweaked key. - * @param secretKey - The server's private key. - * @param blinded - The blinded element from the client. - * @param rng - An optional RNG for the proof. - * @returns The evaluated element and a proof of correct computation. - */ - blindEvaluate( - secretKey: TArg, - blinded: TArg, - rng?: RNG - ): TRet; - - /** - * (Server-side) A batch-aware version of `blindEvaluate` for the POPRF mode. - * @param secretKey - The server's private key. - * @param blinded - An array of blinded elements. - * @param rng - An optional RNG for the proof. - * @returns An array of evaluated elements and a single proof for the batch. - */ - blindEvaluateBatch( - secretKey: TArg, - blinded: TArg, - rng: RNG - ): TRet; - - /** - * (Client-side) A batch-aware version of `finalize` for the POPRF mode. - * It verifies the proof against the tweaked key. - * @param items - An array containing the parameters for each finalization. - * @param proof - The single DLEQ proof for the batch. - * @param tweakedKey - The tweaked key corresponding to the proof. - * All items must share the same `info` and `publicKey`. - * @returns An array of final POPRF outputs. - * @throws If proof verification fails. {@link Error} - */ - finalizeBatch( - items: TArg, - proof: TArg, - tweakedKey: TArg - ): TRet; - - /** - * (Client-side) Finalizes the POPRF protocol. It verifies the server's proof against the - * `tweakedKey` computed in the `blind` step. The final output is bound to the public `info`. - * @param input - The original private input. - * @param blind - The secret scalar. - * @param evaluated - The evaluated element from the server. - * @param blinded - The blinded element sent to the server. - * @param proof - The DLEQ proof from the server. - * @param tweakedKey - The public tweaked key computed by the client during the `blind` step. - * @returns The final POPRF output. - * @throws If proof verification fails. {@link Error} - */ - finalize( - input: TArg, - blind: TArg, - evaluated: TArg, - blinded: TArg, - proof: TArg, - tweakedKey: TArg - ): TRet; - - /** - * A non-interactive evaluation function for an entity that knows all inputs. - * Computes the final POPRF output directly. Useful for testing or specific applications - * where the server needs to compute the output for a known input. - * @param secretKey - The server's private key. - * @param input - The client's private input. - * @returns The final POPRF output. - */ - evaluate(secretKey: TArg, input: TArg): TRet; - }; -}; - -// welcome to generic hell -/** - * @param opts - OPRF ciphersuite options. See {@link OPRFOpts}. - * @returns OPRF helper namespace. - * @example - * Instantiate an OPRF suite from curve-specific hashing hooks. - * - * ```ts - * import { createOPRF } from '@noble/curves/abstract/oprf.js'; - * import { p256, p256_hasher } from '@noble/curves/nist.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const oprf = createOPRF({ - * name: 'P256-SHA256', - * Point: p256.Point, - * hash: sha256, - * hashToGroup: p256_hasher.hashToCurve, - * hashToScalar: p256_hasher.hashToScalar, - * }); - * const keys = oprf.oprf.generateKeyPair(); - * ``` - */ -export function createOPRF

>(opts: OPRFOpts

): TRet { - validateObject(opts, { - name: 'string', - hash: 'function', - hashToScalar: 'function', - hashToGroup: 'function', - }); - // Cheap constructor-surface sanity check only: this verifies the generic static hooks/fields that - // OPRF consumes, but it does not certify point semantics like BASE/ZERO correctness. - validatePointCons(opts.Point); - const { name, Point, hash } = opts; - const { Fn } = Point; - - const hashToGroup = (msg: TArg, ctx: TArg) => - opts.hashToGroup(msg, { - DST: concatBytes(asciiToBytes('HashToGroup-'), ctx), - }) as P; - const hashToScalarPrefixed = (msg: TArg, ctx: TArg) => - opts.hashToScalar(msg, { DST: concatBytes(_DST_scalarBytes, ctx) }); - const randomScalar = (rng: RNG = randomBytes) => { - // RFC 9497 §2.1 defines RandomScalar as nonzero; blind inversion and generated public keys - // both rely on keeping this helper in the `1..n-1` range. - const t = mapHashToField(rng(getMinHashLength(Fn.ORDER)), Fn.ORDER, Fn.isLE); - // We cannot use Fn.fromBytes here, because field - // can have different number of bytes (like ed448) - return Fn.isLE ? bytesToNumberLE(t) : bytesToNumberBE(t); - }; - - const msm = (points: P[], scalars: bigint[]) => pippenger(Point, points, scalars); - - const getCtx = (mode: number) => - concatBytes(asciiToBytes('OPRFV1-'), new Uint8Array([mode]), asciiToBytes('-' + name)); - const ctxOPRF = getCtx(0x00); - const ctxVOPRF = getCtx(0x01); - const ctxPOPRF = getCtx(0x02); - - function encode(...args: TArg<(Uint8Array | number | string)[]>): TRet { - const res = []; - for (const a of args) { - if (typeof a === 'number') res.push(numberToBytesBE(a, 2)); - else if (typeof a === 'string') res.push(asciiToBytes(a)); - else { - abytes(a); - res.push(numberToBytesBE(a.length, 2), a); - } - } - // No wipe here, since will modify actual bytes - return concatBytes(...res) as TRet; - } - const inputBytes = (title: string, bytes: TArg) => { - abytes(bytes, undefined, title); - // RFC 9497 §1.2 limits PrivateInput/PublicInput to 2^16 - 1 bytes because these values are - // length-prefixed with two bytes before use throughout the protocol. - if (bytes.length > 0xffff) - throw new Error( - `"${title}" expected Uint8Array of length <= 65535, got length=${bytes.length}` - ); - return bytes; - }; - const hashInput = (...bytes: TArg): TRet => - hash(encode(...bytes, 'Finalize')) as TRet; - - function getTranscripts(B: P, C: P[], D: P[], ctx: TArg) { - const Bm = B.toBytes(); - const seed = hash(encode(Bm, concatBytes(asciiToBytes('Seed-'), ctx))); - const res: bigint[] = []; - for (let i = 0; i < C.length; i++) { - const Ci = C[i].toBytes(); - const Di = D[i].toBytes(); - const di = hashToScalarPrefixed(encode(seed, i, Ci, Di, 'Composite'), ctx); - res.push(di); - } - return res; - } - - function computeComposites(B: P, C: P[], D: P[], ctx: TArg) { - const T = getTranscripts(B, C, D, ctx); - const M = msm(C, T); - const Z = msm(D, T); - return { M, Z }; - } - - function computeCompositesFast( - k: bigint, - B: P, - C: P[], - D: P[], - ctx: TArg - ): { M: P; Z: P } { - const T = getTranscripts(B, C, D, ctx); - const M = msm(C, T); - // RFC 9497 §2.2.1 ComputeCompositesFast derives weights from both C and D in getTranscripts(), - // then uses the server shortcut Z = k * M instead of a second MSM over D. - const Z = M.multiply(k); - return { M, Z }; - } - - function challengeTranscript(B: P, M: P, Z: P, t2: P, t3: P, ctx: TArg) { - const [Bm, a0, a1, a2, a3] = [B, M, Z, t2, t3].map((i) => i.toBytes()); - return hashToScalarPrefixed(encode(Bm, a0, a1, a2, a3, 'Challenge'), ctx); - } - - function generateProof(ctx: TArg, k: bigint, B: P, C: P[], D: P[], rng: RNG): TRet { - const { M, Z } = computeCompositesFast(k, B, C, D, ctx); - const r = randomScalar(rng); - const t2 = Point.BASE.multiply(r); - const t3 = M.multiply(r); - const c = challengeTranscript(B, M, Z, t2, t3, ctx); - const s = Fn.sub(r, Fn.mul(c, k)); // r - c*k - return concatBytes(...[c, s].map((i) => Fn.toBytes(i))) as TRet; - } - - function verifyProof(ctx: TArg, B: P, C: P[], D: P[], proof: TArg) { - abytes(proof, 2 * Fn.BYTES); - const { M, Z } = computeComposites(B, C, D, ctx); - const [c, s] = [proof.subarray(0, Fn.BYTES), proof.subarray(Fn.BYTES)].map((f) => - Fn.fromBytes(f) - ); - const t2 = Point.BASE.multiply(s).add(B.multiply(c)); // s*G + c*B - const t3 = M.multiply(s).add(Z.multiply(c)); // s*M + c*Z - const expectedC = challengeTranscript(B, M, Z, t2, t3, ctx); - if (!Fn.eql(c, expectedC)) throw new Error('proof verification failed'); - } - - function generateKeyPair(): TRet { - const skS = randomScalar(); - const pkS = Point.BASE.multiply(skS); - return { secretKey: Fn.toBytes(skS), publicKey: pkS.toBytes() } as TRet; - } - - function deriveKeyPair(ctx: TArg, seed: TArg, info: TArg): TRet { - // RFC 9497 §3.2.1 defines `seed[32]`; reject other sizes here because this public API already - // documents a 32-byte seed instead of generic input keying material. - abytes(seed, 32, 'seed'); - info = inputBytes('keyInfo', info); - const dst = concatBytes(asciiToBytes('DeriveKeyPair'), ctx); - const msg = concatBytes(seed, encode(info), Uint8Array.of(0)); - for (let counter = 0; counter <= 255; counter++) { - msg[msg.length - 1] = counter; - const skS = opts.hashToScalar(msg, { DST: dst }); - if (Fn.is0(skS)) continue; // should not happen - return { - secretKey: Fn.toBytes(skS), - publicKey: Point.BASE.multiply(skS).toBytes(), - } as TRet; - } - throw new Error('Cannot derive key'); - } - const wirePoint = (label: string, bytes: TArg) => { - const point = Point.fromBytes(bytes); - // RFC 9497 §3.3 says applications MUST reject group-identity Elements received over the wire - // after deserialization, even if the suite decoder itself accepts the identity encoding. - if (point.equals(Point.ZERO)) throw new Error(label + ' point at infinity'); - return point; - }; - function blind( - ctx: TArg, - input: TArg, - rng: RNG = randomBytes - ): TRet { - input = inputBytes('input', input); - const blind = randomScalar(rng); - const inputPoint = hashToGroup(input, ctx); - if (inputPoint.equals(Point.ZERO)) throw new Error('Input point at infinity'); - const blinded = inputPoint.multiply(blind); - return { blind: Fn.toBytes(blind), blinded: blinded.toBytes() } as TRet; - } - function evaluate( - ctx: TArg, - secretKey: TArg, - input: TArg - ): TRet { - input = inputBytes('input', input); - const skS = Fn.fromBytes(secretKey); - const inputPoint = hashToGroup(input, ctx); - if (inputPoint.equals(Point.ZERO)) throw new Error('Input point at infinity'); - const unblinded = inputPoint.multiply(skS).toBytes(); - return hashInput(input, unblinded); - } - const oprf = Object.freeze({ - generateKeyPair, - deriveKeyPair: (seed: TArg, keyInfo: TArg) => - deriveKeyPair(ctxOPRF, seed, keyInfo), - blind: (input: TArg, rng: RNG = randomBytes) => blind(ctxOPRF, input, rng), - blindEvaluate(secretKey: TArg, blindedPoint: TArg): TRet { - const skS = Fn.fromBytes(secretKey); - const elm = wirePoint('blinded', blindedPoint); - return elm.multiply(skS).toBytes() as TRet; - }, - finalize( - input: TArg, - blindBytes: TArg, - evaluatedBytes: TArg - ): TRet { - input = inputBytes('input', input); - const blind = Fn.fromBytes(blindBytes); - const evalPoint = wirePoint('evaluated', evaluatedBytes); - const unblinded = evalPoint.multiply(Fn.inv(blind)).toBytes(); - return hashInput(input, unblinded); - }, - evaluate: (secretKey: TArg, input: TArg) => - evaluate(ctxOPRF, secretKey, input), - }); - - const voprf = Object.freeze({ - generateKeyPair, - deriveKeyPair: (seed: TArg, keyInfo: TArg) => - deriveKeyPair(ctxVOPRF, seed, keyInfo), - blind: (input: TArg, rng: RNG = randomBytes) => blind(ctxVOPRF, input, rng), - blindEvaluateBatch( - secretKey: TArg, - publicKey: TArg, - blinded: TArg, - rng: RNG = randomBytes - ): TRet { - if (!Array.isArray(blinded)) throw new Error('expected array'); - const skS = Fn.fromBytes(secretKey); - const pkS = wirePoint('public key', publicKey); - const blindedPoints = blinded.map((i) => wirePoint('blinded', i)); - const evaluated = blindedPoints.map((i) => i.multiply(skS)); - const proof = generateProof(ctxVOPRF, skS, pkS, blindedPoints, evaluated, rng); - return { evaluated: evaluated.map((i) => i.toBytes()), proof } as TRet; - }, - blindEvaluate( - secretKey: TArg, - publicKey: TArg, - blinded: TArg, - rng: RNG = randomBytes - ): TRet { - const res = this.blindEvaluateBatch(secretKey, publicKey, [blinded], rng); - return { evaluated: res.evaluated[0], proof: res.proof } as TRet; - }, - finalizeBatch( - items: TArg, - publicKey: TArg, - proof: TArg - ): TRet { - if (!Array.isArray(items)) throw new Error('expected array'); - const pkS = wirePoint('public key', publicKey); - const blindedPoints = items.map((i) => wirePoint('blinded', i.blinded)); - const evalPoints = items.map((i) => wirePoint('evaluated', i.evaluated)); - verifyProof(ctxVOPRF, pkS, blindedPoints, evalPoints, proof); - return items.map((i) => oprf.finalize(i.input, i.blind, i.evaluated)) as TRet; - }, - finalize( - input: TArg, - blind: TArg, - evaluated: TArg, - blinded: TArg, - publicKey: TArg, - proof: TArg - ): TRet { - return this.finalizeBatch([{ input, blind, evaluated, blinded }], publicKey, proof)[0]; - }, - evaluate: (secretKey: TArg, input: TArg) => - evaluate(ctxVOPRF, secretKey, input), - }); - // NOTE: info is domain separation - const poprf = (info: TArg) => { - info = inputBytes('info', info); - const m = hashToScalarPrefixed(encode('Info', info), ctxPOPRF); - const T = Point.BASE.multiply(m); - return Object.freeze({ - generateKeyPair, - deriveKeyPair: (seed: TArg, keyInfo: TArg) => - deriveKeyPair(ctxPOPRF, seed, keyInfo), - blind( - input: TArg, - publicKey: TArg, - rng: RNG = randomBytes - ): TRet { - input = inputBytes('input', input); - const pkS = wirePoint('public key', publicKey); - const tweakedKey = T.add(pkS); - if (tweakedKey.equals(Point.ZERO)) throw new Error('tweakedKey point at infinity'); - const blind = randomScalar(rng); - const inputPoint = hashToGroup(input, ctxPOPRF); - if (inputPoint.equals(Point.ZERO)) throw new Error('Input point at infinity'); - const blindedPoint = inputPoint.multiply(blind); - return { - blind: Fn.toBytes(blind), - blinded: blindedPoint.toBytes(), - tweakedKey: tweakedKey.toBytes(), - } as TRet; - }, - blindEvaluateBatch( - secretKey: TArg, - blinded: TArg, - rng: RNG = randomBytes - ): TRet { - if (!Array.isArray(blinded)) throw new Error('expected array'); - const skS = Fn.fromBytes(secretKey); - const t = Fn.add(skS, m); - // "Hence, this error can be a signal for the server to replace its - // private key". We throw inside; this should be impossible. - const invT = Fn.inv(t); - const blindedPoints = blinded.map((i) => wirePoint('blinded', i)); - const evalPoints = blindedPoints.map((i) => i.multiply(invT)); - const tweakedKey = Point.BASE.multiply(t); - const proof = generateProof(ctxPOPRF, t, tweakedKey, evalPoints, blindedPoints, rng); - return { evaluated: evalPoints.map((i) => i.toBytes()), proof } as TRet; - }, - blindEvaluate( - secretKey: TArg, - blinded: TArg, - rng: RNG = randomBytes - ): TRet { - const res = this.blindEvaluateBatch(secretKey, [blinded], rng); - return { evaluated: res.evaluated[0], proof: res.proof } as TRet; - }, - finalizeBatch( - items: TArg, - proof: TArg, - tweakedKey: TArg - ): TRet { - if (!Array.isArray(items)) throw new Error('expected array'); - const inputs = items.map((i) => inputBytes('input', i.input)); - const evalPoints = items.map((i) => wirePoint('evaluated', i.evaluated)); - verifyProof( - ctxPOPRF, - wirePoint('tweakedKey', tweakedKey), - evalPoints, - items.map((i) => wirePoint('blinded', i.blinded)), - proof - ); - return items.map((i, j) => { - const blind = Fn.fromBytes(i.blind); - const point = evalPoints[j].multiply(Fn.inv(blind)).toBytes(); - return hashInput(inputs[j], info, point); - }) as TRet; - }, - finalize( - input: TArg, - blind: TArg, - evaluated: TArg, - blinded: TArg, - proof: TArg, - tweakedKey: TArg - ): TRet { - return this.finalizeBatch([{ input, blind, evaluated, blinded }], proof, tweakedKey)[0]; - }, - evaluate(secretKey: TArg, input: TArg): TRet { - input = inputBytes('input', input); - const skS = Fn.fromBytes(secretKey); - const inputPoint = hashToGroup(input, ctxPOPRF); - if (inputPoint.equals(Point.ZERO)) throw new Error('Input point at infinity'); - const t = Fn.add(skS, m); - const invT = Fn.inv(t); - const unblinded = inputPoint.multiply(invT).toBytes(); - return hashInput(input, info, unblinded); - }, - }); - }; - const res = { name, oprf, voprf, poprf, __tests: Object.freeze({ Fn }) }; - return Object.freeze(res) as TRet; -} diff --git a/node_modules/@noble/curves/src/abstract/poseidon.ts b/node_modules/@noble/curves/src/abstract/poseidon.ts deleted file mode 100644 index c927e86..0000000 --- a/node_modules/@noble/curves/src/abstract/poseidon.ts +++ /dev/null @@ -1,533 +0,0 @@ -/** - * Implements [Poseidon](https://www.poseidon-hash.info) ZK-friendly hash. - * - * There are many poseidon variants with different constants. - * We don't provide them: you should construct them manually. - * Check out [micro-starknet](https://github.com/paulmillr/micro-starknet) package for a proper example. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { asafenumber, bitGet, validateObject, type TArg, type TRet } from '../utils.ts'; -import { FpInvertBatch, FpPow, type IField, validateField } from './modular.ts'; - -// Grain LFSR (Linear-Feedback Shift Register): https://eprint.iacr.org/2009/109.pdf -function grainLFSR(state: number[]): () => boolean { - // Advances the caller-provided 80-entry state array in place; only the length - // is checked here, so entries are assumed to already be bits. - let pos = 0; - if (state.length !== 80) throw new Error('grainLFRS: wrong state length, should be 80 bits'); - const getBit = (): boolean => { - const r = (offset: number) => state[(pos + offset) % 80]; - const bit = r(62) ^ r(51) ^ r(38) ^ r(23) ^ r(13) ^ r(0); - state[pos] = bit; - pos = ++pos % 80; - return !!bit; - }; - for (let i = 0; i < 160; i++) getBit(); - return () => { - // https://en.wikipedia.org/wiki/Shrinking_generator - while (true) { - const b1 = getBit(); - const b2 = getBit(); - if (!b1) continue; - return b2; - } - }; -} - -/** Core Poseidon permutation parameters shared by all variants. */ -export type PoseidonBasicOpts = { - /** Prime field used by the permutation. */ - Fp: IField; - /** Poseidon width `t = rate + capacity`. */ - t: number; - /** Number of full S-box rounds. */ - roundsFull: number; - /** Number of partial S-box rounds. */ - roundsPartial: number; - /** Whether to use the inverse S-box variant. */ - isSboxInverse?: boolean; -}; - -function assertValidPosOpts(opts: TArg) { - const { Fp, roundsFull } = opts; - validateField(Fp); - validateObject( - opts, - { - t: 'number', - roundsFull: 'number', - roundsPartial: 'number', - }, - { - isSboxInverse: 'boolean', - } - ); - for (const k of ['t', 'roundsFull', 'roundsPartial'] as const) { - asafenumber(opts[k], k); - if (opts[k] < 1) throw new Error('invalid number ' + k); - } - // Poseidon splits full rounds as `R_F / 2`, then partial rounds, then `R_F / 2` again. - if (roundsFull & 1) throw new Error('roundsFull is not even' + roundsFull); -} - -function poseidonGrain(opts: TArg) { - assertValidPosOpts(opts); - const { Fp } = opts; - const state = Array(80).fill(1); - let pos = 0; - const writeBits = (value: bigint, bitCount: number) => { - for (let i = bitCount - 1; i >= 0; i--) state[pos++] = Number(bitGet(value, i)); - }; - const _0n = BigInt(0); - const _1n = BigInt(1); - // The Grain seed layout is fixed-width: `Fp.BITS` and `t` use 12 bits, - // `roundsFull` and `roundsPartial` use 10, so larger values are truncated here. - // This is intentional for compatibility with snarkVM / arkworks PoseidonGrainLFSR: - // they write the same fixed-width seed fields without range checks, then still consume - // the LFSR using the caller-provided round count for ARK/MDS generation. - // Normalizing or rejecting here would diverge from those implementations. - writeBits(_1n, 2); // prime field - writeBits(opts.isSboxInverse ? _1n : _0n, 4); // b2..b5 - writeBits(BigInt(Fp.BITS), 12); // b6..b17 - writeBits(BigInt(opts.t), 12); // b18..b29 - writeBits(BigInt(opts.roundsFull), 10); // b30..b39 - writeBits(BigInt(opts.roundsPartial), 10); // b40..b49 - - const getBit = grainLFSR(state); - return (count: number, reject: boolean): bigint[] => { - const res: bigint[] = []; - for (let i = 0; i < count; i++) { - while (true) { - let num = _0n; - for (let i = 0; i < Fp.BITS; i++) { - num <<= _1n; - if (getBit()) num |= _1n; - } - if (reject && num >= Fp.ORDER) continue; // rejection sampling - res.push(Fp.create(num)); - break; - } - } - return res; - }; -} - -/** Poseidon settings used by the Grain-LFSR constant generator. */ -export type PoseidonGrainOpts = PoseidonBasicOpts & { - /** S-box power used while generating constants. */ - sboxPower?: number; -}; - -type PoseidonConstants = { mds: bigint[][]; roundConstants: bigint[][] }; - -// NOTE: this is not standard but used often for constant generation for poseidon -// (grain LFRS-like structure) -/** - * @param opts - Poseidon grain options. See {@link PoseidonGrainOpts}. - * @param skipMDS - Number of MDS samples to skip. - * @returns Generated constants. - * @throws If the generated MDS matrix contains a zero denominator. {@link Error} - * @example - * Generate Poseidon round constants and an MDS matrix from the Grain LFSR. - * - * ```ts - * import { grainGenConstants } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * ``` - */ -export function grainGenConstants( - opts: TArg, - skipMDS: number = 0 -): PoseidonConstants { - const { Fp, t, roundsFull, roundsPartial } = opts; - // `skipMDS` counts how many candidate matrices to discard before taking one. - asafenumber(skipMDS, 'skipMDS'); - if (skipMDS < 0) throw new Error('invalid number skipMDS'); - const rounds = roundsFull + roundsPartial; - // `sboxPower` is carried in the opts shape for Poseidon compatibility, but - // Grain constant generation here only depends on field/size/round counts/inverse flag. - const sample = poseidonGrain(opts); - const roundConstants: bigint[][] = []; - for (let r = 0; r < rounds; r++) roundConstants.push(sample(t, true)); - if (skipMDS > 0) for (let i = 0; i < skipMDS; i++) sample(2 * t, false); - const xs = sample(t, false); - const ys = sample(t, false); - // Construct MDS Matrix M[i][j] = 1 / (xs[i] + ys[j]) - const mds: bigint[][] = []; - for (let i = 0; i < t; i++) { - const row: bigint[] = []; - for (let j = 0; j < t; j++) { - const xy = Fp.add(xs[i], ys[j]); - if (Fp.is0(xy)) - throw new Error(`Error generating MDS matrix: xs[${i}] + ys[${j}] resulted in zero.`); - row.push(xy); - } - mds.push(FpInvertBatch(Fp, row)); - } - - return { roundConstants, mds }; -} - -/** Fully specified Poseidon permutation options with explicit constants. */ -export type PoseidonOpts = PoseidonBasicOpts & - PoseidonConstants & { - /** S-box power used by the permutation. */ - sboxPower?: number; - /** Whether to reverse the partial-round S-box index. */ - reversePartialPowIdx?: boolean; // Hack for stark - }; - -/** - * @param opts - Poseidon options. See {@link PoseidonOpts}. - * @returns Normalized poseidon options. - * @throws If the Poseidon options, constants, or MDS matrix are invalid. {@link Error} - * @example - * Validate generated constants before constructing a permutation. - * - * ```ts - * import { grainGenConstants, validateOpts } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const opts = validateOpts({ ...constants, Fp, t: 2, roundsFull: 8, roundsPartial: 8, sboxPower: 3 }); - * ``` - */ -export function validateOpts(opts: TArg): TRet< - Readonly<{ - rounds: number; - sboxFn: (n: bigint) => bigint; - roundConstants: bigint[][]; - mds: bigint[][]; - Fp: IField; - t: number; - roundsFull: number; - roundsPartial: number; - sboxPower?: number; - reversePartialPowIdx?: boolean; // Hack for stark - }> -> { - // This only normalizes shapes and field membership for the provided constants; - // it does not prove the stronger MDS/security criteria discussed in the specs. - assertValidPosOpts(opts); - const { Fp, mds, reversePartialPowIdx: rev, roundConstants: rc } = opts; - const { roundsFull, roundsPartial, sboxPower, t } = opts; - - // MDS is TxT matrix - if (!Array.isArray(mds) || mds.length !== t) throw new Error('Poseidon: invalid MDS matrix'); - const _mds = mds.map((mdsRow) => { - if (!Array.isArray(mdsRow) || mdsRow.length !== t) - throw new Error('invalid MDS matrix row: ' + mdsRow); - return mdsRow.map((i) => { - if (typeof i !== 'bigint') throw new Error('invalid MDS matrix bigint: ' + i); - // Hardcoded Poseidon MDS matrices often use signed entries like `-1`; - // accept bigint representatives here and reduce them into the field. - return Fp.create(i); - }); - }); - - if (rev !== undefined && typeof rev !== 'boolean') - throw new Error('invalid param reversePartialPowIdx=' + rev); - - if (roundsFull & 1) throw new Error('roundsFull is not even' + roundsFull); - const rounds = roundsFull + roundsPartial; - - if (!Array.isArray(rc) || rc.length !== rounds) - throw new Error('Poseidon: invalid round constants'); - const roundConstants = rc.map((rc) => { - if (!Array.isArray(rc) || rc.length !== t) throw new Error('invalid round constants'); - return rc.map((i) => { - if (typeof i !== 'bigint' || !Fp.isValid(i)) throw new Error('invalid round constant'); - return Fp.create(i); - }); - }); - // Freeze nested constants so exported handles cannot retune a live permutation instance. - const freezeRows = (rows: bigint[][]) => - Object.freeze(rows.map((row) => Object.freeze(row))) as unknown as bigint[][]; - - if (!sboxPower || ![3, 5, 7, 17].includes(sboxPower)) throw new Error('invalid sboxPower'); - const _sboxPower = BigInt(sboxPower); - let sboxFn = (n: bigint) => FpPow(Fp, n, _sboxPower); - // Unwrapped sbox power for common cases (195->142μs) - if (sboxPower === 3) sboxFn = (n: bigint) => Fp.mul(Fp.sqrN(n), n); - else if (sboxPower === 5) sboxFn = (n: bigint) => Fp.mul(Fp.sqrN(Fp.sqrN(n)), n); - - return Object.freeze({ - ...opts, - rounds, - sboxFn, - roundConstants: freezeRows(roundConstants), - mds: freezeRows(_mds), - }) as TRet< - Readonly<{ - rounds: number; - sboxFn: (n: bigint) => bigint; - roundConstants: bigint[][]; - mds: bigint[][]; - Fp: IField; - t: number; - roundsFull: number; - roundsPartial: number; - sboxPower?: number; - reversePartialPowIdx?: boolean; - }> - >; -} - -/** - * @param rc - Flattened round constants. - * @param t - Poseidon width. - * @returns Constants grouped by round. - * @throws If the width or flattened constant array is invalid. {@link Error} - * @example - * Regroup a flat constant list into per-round chunks. - * - * ```ts - * const rounds = splitConstants([1n, 2n, 3n, 4n], 2); - * ``` - */ -export function splitConstants(rc: bigint[], t: number): bigint[][] { - asafenumber(t, 't'); - if (t < 1) throw new Error('poseidonSplitConstants: invalid t'); - if (!Array.isArray(rc) || rc.length % t) throw new Error('poseidonSplitConstants: invalid rc'); - const res = []; - let tmp = []; - for (let i = 0; i < rc.length; i++) { - const c = rc[i]; - if (typeof c !== 'bigint') throw new Error('invalid bigint=' + c); - tmp.push(c); - if (tmp.length === t) { - res.push(tmp); - tmp = []; - } - } - return res; -} - -/** - * Poseidon permutation callable. - * @param values - Poseidon state vector. Non-canonical bigints are normalized with `Fp.create(...)`. - * @returns Permuted state vector. - */ -export type PoseidonFn = { - (values: bigint[]): bigint[]; - /** Round constants captured by the permutation instance. */ - roundConstants: bigint[][]; -}; -/** Poseidon NTT-friendly hash. */ -/** - * @param opts - Poseidon options. See {@link PoseidonOpts}. - * @returns Poseidon permutation. - * @throws If the Poseidon options or state vector are invalid. {@link Error} - * @example - * Build a Poseidon permutation from validated parameters and constants. - * - * ```ts - * import { grainGenConstants, poseidon } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const hash = poseidon({ ...constants, Fp, t: 2, roundsFull: 8, roundsPartial: 8, sboxPower: 3 }); - * const state = hash([1n, 2n]); - * ``` - */ -export function poseidon(opts: TArg): PoseidonFn { - const _opts = validateOpts(opts); - const { Fp, mds, roundConstants, rounds: totalRounds, roundsPartial, sboxFn, t } = _opts; - const halfRoundsFull = _opts.roundsFull / 2; - const partialIdx = _opts.reversePartialPowIdx ? t - 1 : 0; - const poseidonRound = (values: bigint[], isFull: boolean, idx: number) => { - values = values.map((i, j) => Fp.add(i, roundConstants[idx][j])); - - if (isFull) values = values.map((i) => sboxFn(i)); - else values[partialIdx] = sboxFn(values[partialIdx]); - // Matrix multiplication - values = mds.map((i) => i.reduce((acc, i, j) => Fp.add(acc, Fp.mulN(i, values[j])), Fp.ZERO)); - return values; - }; - const poseidonHash = function poseidonHash(values: bigint[]) { - if (!Array.isArray(values) || values.length !== t) - throw new Error('invalid values, expected array of bigints with length ' + t); - // `.map()` skips sparse holes, which would leak `undefined` into round math below. - values = values.slice(); - for (let j = 0; j < values.length; j++) { - const i = values[j]; - if (typeof i !== 'bigint') throw new Error('invalid bigint=' + i); - values[j] = Fp.create(i); - } - let lastRound = 0; - // Apply r_f/2 full rounds. - for (let i = 0; i < halfRoundsFull; i++) values = poseidonRound(values, true, lastRound++); - // Apply r_p partial rounds. - for (let i = 0; i < roundsPartial; i++) values = poseidonRound(values, false, lastRound++); - // Apply r_f/2 full rounds. - for (let i = 0; i < halfRoundsFull; i++) values = poseidonRound(values, true, lastRound++); - - if (lastRound !== totalRounds) throw new Error('invalid number of rounds'); - return values; - } as PoseidonFn; - // For verification in tests - Object.defineProperty(poseidonHash, 'roundConstants', { - value: roundConstants, - enumerable: true, - }); - return poseidonHash; -} - -/** - * @param Fp - Field implementation. - * @param rate - Sponge rate. - * @param capacity - Sponge capacity. - * @param hash - Poseidon permutation. - * @example - * Wrap one Poseidon permutation in a sponge interface. - * - * ```ts - * import { PoseidonSponge, grainGenConstants, poseidon } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const hash = poseidon({ ...constants, Fp, t: 2, roundsFull: 8, roundsPartial: 8, sboxPower: 3 }); - * const sponge = new PoseidonSponge(Fp, 1, 1, hash); - * sponge.absorb([1n]); - * const out = sponge.squeeze(1); - * ``` - */ -export class PoseidonSponge { - private Fp: IField; - readonly rate: number; - readonly capacity: number; - readonly hash: PoseidonFn; - private state: bigint[]; // [...capacity, ...rate] - private pos = 0; - private isAbsorbing = true; - - constructor(Fp: IField, rate: number, capacity: number, hash: PoseidonFn) { - const width = spongeShape(rate, capacity); - // The direct constructor accepts an arbitrary permutation hook, but callers still - // need to preserve the `PoseidonFn.roundConstants` width metadata. Reject width - // mismatches here instead of deferring them until the first `process()` call. - if (width !== hash.roundConstants[0]?.length) - throw new Error( - `invalid sponge width: expected ${hash.roundConstants[0]?.length}, got ${width}` - ); - this.Fp = Fp; - this.hash = hash; - this.rate = rate; - this.capacity = capacity; - this.state = new Array(width); - this.clean(); - } - private process(): void { - // The permutation is expected to return an owned state array. If callers inject a custom - // hook that reuses external storage, `clean()` will zero that shared buffer too. - this.state = this.hash(this.state); - } - absorb(input: bigint[]): void { - for (const i of input) - if (typeof i !== 'bigint' || !this.Fp.isValid(i)) throw new Error('invalid input: ' + i); - for (let i = 0; i < input.length; ) { - if (!this.isAbsorbing || this.pos === this.rate) { - this.process(); - this.pos = 0; - this.isAbsorbing = true; - } - const chunk = Math.min(this.rate - this.pos, input.length - i); - for (let j = 0; j < chunk; j++) { - const idx = this.capacity + this.pos++; - this.state[idx] = this.Fp.add(this.state[idx], input[i++]); - } - } - } - squeeze(count: number): bigint[] { - // Rust oracles use unsigned counts. In JS we keep `squeeze(0) => []` for - // compatibility, but still reject negative/fractional counts explicitly. - asafenumber(count, 'count'); - if (count < 0) throw new Error('invalid number count'); - const res: bigint[] = []; - while (res.length < count) { - if (this.isAbsorbing || this.pos === this.rate) { - this.process(); - this.pos = 0; - this.isAbsorbing = false; - } - const chunk = Math.min(this.rate - this.pos, count - res.length); - for (let i = 0; i < chunk; i++) res.push(this.state[this.capacity + this.pos++]); - } - return res; - } - clean(): void { - this.state.fill(this.Fp.ZERO); - this.isAbsorbing = true; - this.pos = 0; - } - clone(): PoseidonSponge { - const c = new PoseidonSponge(this.Fp, this.rate, this.capacity, this.hash); - c.pos = this.pos; - c.isAbsorbing = this.isAbsorbing; - c.state = [...this.state]; - return c; - } -} - -/** Options for the non-standard but commonly used Poseidon sponge wrapper. */ -export type PoseidonSpongeOpts = Omit & { - /** Sponge rate. */ - rate: number; - /** Sponge capacity. */ - capacity: number; -}; - -const spongeShape = (rate: number, capacity: number) => { - asafenumber(rate, 'rate'); - asafenumber(capacity, 'capacity'); - // A sponge with zero rate cannot absorb or squeeze any field elements. - if (rate < 1) throw new Error('invalid number rate'); - // Negative capacity can accidentally keep `rate + capacity` coherent while still - // producing a nonsensical sponge shape. - if (capacity < 0) throw new Error('invalid number capacity'); - return rate + capacity; -}; - -/** - * The method is not defined in spec, but nevertheless used often. - * Check carefully for compatibility: there are many edge cases, like absorbing an empty array. - * We cross-test against: - * - {@link https://github.com/ProvableHQ/snarkVM/tree/staging/algorithms | snarkVM algorithms} - * - {@link https://github.com/arkworks-rs/crypto-primitives/tree/main | arkworks crypto-primitives} - * @param opts - Sponge options. See {@link PoseidonSpongeOpts}. - * @returns Factory for sponge instances. - * @throws If the sponge dimensions or backing permutation options are invalid. {@link Error} - * @example - * Use the sponge helper to absorb several field elements and squeeze one digest. - * - * ```ts - * import { grainGenConstants, poseidonSponge } from '@noble/curves/abstract/poseidon.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const constants = grainGenConstants({ Fp, t: 2, roundsFull: 8, roundsPartial: 8 }); - * const makeSponge = poseidonSponge({ - * ...constants, - * Fp, - * rate: 1, - * capacity: 1, - * roundsFull: 8, - * roundsPartial: 8, - * sboxPower: 3, - * }); - * const sponge = makeSponge(); - * sponge.absorb([1n]); - * const out = sponge.squeeze(1); - * ``` - */ -export function poseidonSponge(opts: TArg): TRet<() => PoseidonSponge> { - const { rate, capacity } = opts; - const t = spongeShape(rate, capacity); - // Re-use one hash instance between sponge instances; isolation depends on - // poseidon(...) itself staying immutable and not carrying mutable call state. - const hash = poseidon({ ...opts, t }); - const { Fp } = opts; - return (() => new PoseidonSponge(Fp, rate, capacity, hash)) as TRet<() => PoseidonSponge>; -} diff --git a/node_modules/@noble/curves/src/abstract/tower.ts b/node_modules/@noble/curves/src/abstract/tower.ts deleted file mode 100644 index 51ba82a..0000000 --- a/node_modules/@noble/curves/src/abstract/tower.ts +++ /dev/null @@ -1,1133 +0,0 @@ -/** - * Towered extension fields. - * Rather than implementing a massive 12th-degree extension directly, it is more efficient - * to build it up from smaller extensions: a tower of extensions. - * - * For BLS12-381, the Fp12 field is implemented as a quadratic (degree two) extension, - * on top of a cubic (degree three) extension, on top of a quadratic extension of Fp. - * - * For more info: "Pairings for beginners" by Costello, section 7.3. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { - abytes, - aInRange, - asafenumber, - bitGet, - bitLen, - concatBytes, - notImplemented, - validateObject, - type TArg, - type TRet, -} from '../utils.ts'; -import * as mod from './modular.ts'; -import type { WeierstrassPoint, WeierstrassPointCons } from './weierstrass.ts'; - -// Be friendly to bad ECMAScript parsers by not using bigint literals -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3), _6n = /* @__PURE__ */ BigInt(6), _12n = /* @__PURE__ */ BigInt(12); - -// Fp₂ over complex plane -/** Pair of bigints used for quadratic-extension tuples. */ -export type BigintTuple = [bigint, bigint]; -/** Prime-field element. */ -export type Fp = bigint; -// Finite extension field over irreducible polynominal. -// Fp(u) / (u² - β) where β = -1 -/** Quadratic-extension field element `c0 + c1 * u`. */ -export type Fp2 = { - /** Real component. */ - c0: bigint; - /** Imaginary component. */ - c1: bigint; -}; -/** Six bigints used for sextic-extension tuples. */ -export type BigintSix = [bigint, bigint, bigint, bigint, bigint, bigint]; -/** Sextic-extension field element `c0 + c1 * v + c2 * v^2`. */ -export type Fp6 = { - /** Constant coefficient. */ - c0: Fp2; - /** Linear coefficient. */ - c1: Fp2; - /** Quadratic coefficient. */ - c2: Fp2; -}; -/** - * Degree-12 extension field element `c0 + c1 * w`. - * Fp₁₂ = Fp₆² over Fp₂³, with Fp₆(w) / (w² - γ) where γ = v. - */ -export type Fp12 = { - /** Constant coefficient. */ - c0: Fp6; - /** Linear coefficient. */ - c1: Fp6; -}; -// prettier-ignore -/** Twelve bigints used for degree-12 extension tuples. */ -export type BigintTwelve = [ - bigint, bigint, bigint, bigint, bigint, bigint, - bigint, bigint, bigint, bigint, bigint, bigint -]; - -const isObj = (value: unknown): value is Record => - !!value && typeof value === 'object'; - -/** BLS-friendly helpers on top of the quadratic extension field. */ -export type Fp2Bls = mod.IField & { - /** Underlying prime field. */ - Fp: mod.IField; - /** Apply one Frobenius map. */ - frobeniusMap(num: Fp2, power: number): Fp2; - /** Build one field element from a raw bigint tuple. */ - fromBigTuple(num: BigintTuple): Fp2; - /** Multiply by the curve `b` constant. */ - mulByB: (num: Fp2) => Fp2; - /** Multiply by the quadratic non-residue. */ - mulByNonresidue: (num: Fp2) => Fp2; - /** Split one quadratic element into real and imaginary components. */ - reim: (num: Fp2) => { re: Fp; im: Fp }; - /** Specialized helper used by sextic squaring formulas. */ - Fp4Square: (a: Fp2, b: Fp2) => { first: Fp2; second: Fp2 }; - /** Quadratic non-residue used by the extension. */ - NONRESIDUE: Fp2; -}; - -/** BLS-friendly helpers on top of the sextic extension field. */ -export type Fp6Bls = mod.IField & { - /** Underlying quadratic extension field. */ - Fp2: Fp2Bls; - /** Apply one Frobenius map. */ - frobeniusMap(num: Fp6, power: number): Fp6; - /** Build one field element from a raw six-bigint tuple. */ - fromBigSix: (tuple: BigintSix) => Fp6; - /** Multiply by a sparse `(0, b1, 0)` sextic element. */ - mul1(num: Fp6, b1: Fp2): Fp6; - /** Multiply by a sparse `(b0, b1, 0)` sextic element. */ - mul01(num: Fp6, b0: Fp2, b1: Fp2): Fp6; - /** Multiply by one quadratic-extension element. */ - mulByFp2(lhs: Fp6, rhs: Fp2): Fp6; - /** Multiply by the sextic non-residue. */ - mulByNonresidue: (num: Fp6) => Fp6; -}; - -/** BLS-friendly helpers on top of the degree-12 extension field. */ -export type Fp12Bls = mod.IField & { - /** Underlying sextic extension field. */ - Fp6: Fp6Bls; - /** Apply one Frobenius map. */ - frobeniusMap(num: Fp12, power: number): Fp12; - /** Build one field element from a raw twelve-bigint tuple. */ - fromBigTwelve: (t: BigintTwelve) => Fp12; - /** Multiply by a sparse `(o0, o1, 0, 0, o4, 0)` element. */ - mul014(num: Fp12, o0: Fp2, o1: Fp2, o4: Fp2): Fp12; - /** Multiply by a sparse `(o0, 0, 0, o3, o4, 0)` element. */ - mul034(num: Fp12, o0: Fp2, o3: Fp2, o4: Fp2): Fp12; - /** Multiply by one quadratic-extension element. */ - mulByFp2(lhs: Fp12, rhs: Fp2): Fp12; - /** Conjugate one degree-12 element. */ - conjugate(num: Fp12): Fp12; - /** Apply the final exponentiation from pairing arithmetic. */ - finalExponentiate(num: Fp12): Fp12; - /** Apply one cyclotomic square. */ - _cyclotomicSquare(num: Fp12): Fp12; - /** Apply one cyclotomic exponentiation. */ - _cyclotomicExp(num: Fp12, n: bigint): Fp12; -}; - -function calcFrobeniusCoefficients( - Fp: TArg>, - nonResidue: T, - modulus: bigint, - degree: number, - num: number = 1, - divisor?: number -): T[][] { - asafenumber(num, 'num'); - const F = Fp as mod.IField; - // Generic callers can hit empty / fractional row counts through `__TEST`; fail closed instead of - // silently returning `[]` or deriving extra Frobenius rows from a truncated loop bound. - if (num <= 0) - throw new Error('calcFrobeniusCoefficients: expected positive row count, got ' + num); - const _divisor = BigInt(divisor === undefined ? degree : divisor); - const towerModulus: any = modulus ** BigInt(degree); - const res: T[][] = []; - // Derive tower-basis multipliers for the `p^k` Frobenius action. The - // divisions below are expected to be exact for the chosen tower parameters. - for (let i = 0; i < num; i++) { - const a = BigInt(i + 1); - const powers: T[] = []; - for (let j = 0, qPower = _1n; j < degree; j++) { - const numer = a * qPower - a; - // Shipped towers divide cleanly here, but generic callers can pick bad - // params. Bigint division would floor and derive the wrong Frobenius table. - if (numer % _divisor) throw new Error('calcFrobeniusCoefficients: inexact tower exponent'); - const power = (numer / _divisor) % towerModulus; - powers.push(F.pow(nonResidue, power)); - qPower *= modulus; - } - res.push(powers); - } - return res; -} - -export const __TEST: { calcFrobeniusCoefficients: typeof calcFrobeniusCoefficients } = - /* @__PURE__ */ Object.freeze({ - calcFrobeniusCoefficients, - }); - -// This works same at least for bls12-381, bn254 and bls12-377 -/** - * @param Fp - Base field implementation. - * @param Fp2 - Quadratic extension field. - * @param base - Twist-specific Frobenius base whose powers yield the `c1` / `c2` constants. - * BLS12-381 uses `1 / NONRESIDUE`; BN254 uses `NONRESIDUE`. - * @returns Frobenius endomorphism helpers. - * @throws If the derived Frobenius constants are inconsistent for the tower. {@link Error} - * @example - * Build Frobenius endomorphism helpers for a BLS extension tower. - * - * ```ts - * import { psiFrobenius } from '@noble/curves/abstract/tower.js'; - * import { bls12_381 } from '@noble/curves/bls12-381.js'; - * const Fp = bls12_381.fields.Fp; - * const Fp2 = bls12_381.fields.Fp2; - * const frob = psiFrobenius(Fp, Fp2, Fp2.div(Fp2.ONE, Fp2.NONRESIDUE)); - * const point = frob.G2psi(bls12_381.G2.Point, bls12_381.G2.Point.BASE); - * ``` - */ -export function psiFrobenius( - Fp: TArg>, - Fp2: TArg, - base: TArg -): { - psi: (x: Fp2, y: Fp2) => [Fp2, Fp2]; - psi2: (x: Fp2, y: Fp2) => [Fp2, Fp2]; - G2psi: (c: WeierstrassPointCons, P: WeierstrassPoint) => WeierstrassPoint; - G2psi2: (c: WeierstrassPointCons, P: WeierstrassPoint) => WeierstrassPoint; - PSI_X: Fp2; - PSI_Y: Fp2; - PSI2_X: Fp2; - PSI2_Y: Fp2; -} { - // GLV endomorphism Ψ(P) - const PSI_X = Fp2.pow(base, (Fp.ORDER - _1n) / _3n); // u^((p-1)/3) - const PSI_Y = Fp2.pow(base, (Fp.ORDER - _1n) / _2n); // u^((p-1)/2) - function psi(x: Fp2, y: Fp2): [Fp2, Fp2] { - // This x10 faster than previous version in bls12-381 - const x2 = Fp2.mul(Fp2.frobeniusMap(x, 1), PSI_X); - const y2 = Fp2.mul(Fp2.frobeniusMap(y, 1), PSI_Y); - return [x2, y2]; - } - // Ψ²(P) endomorphism (psi2(x) = psi(psi(x))) - const PSI2_X = Fp2.pow(base, (Fp.ORDER ** _2n - _1n) / _3n); // u^((p^2 - 1)/3) - // Current towers rely on this landing on `-1`, which lets psi2 map `y` with - // one negation instead of carrying a separate Frobenius multiplier. - const PSI2_Y = Fp2.pow(base, (Fp.ORDER ** _2n - _1n) / _2n); // u^((p^2 - 1)/2) - if (!Fp2.eql(PSI2_Y, Fp2.neg(Fp2.ONE))) throw new Error('psiFrobenius: PSI2_Y!==-1'); - function psi2(x: Fp2, y: Fp2): [Fp2, Fp2] { - return [Fp2.mul(x, PSI2_X), Fp2.neg(y)]; - } - // Map points - const mapAffine = - (fn: (x: T, y: T) => [T, T]) => - (c: WeierstrassPointCons, P: WeierstrassPoint) => { - const affine = P.toAffine(); - const p = fn(affine.x, affine.y); - return c.fromAffine({ x: p[0], y: p[1] }); - }; - const G2psi = mapAffine(psi); - const G2psi2 = mapAffine(psi2); - return { psi, psi2, G2psi, G2psi2, PSI_X, PSI_Y, PSI2_X, PSI2_Y }; -} - -/** Construction options for the BLS-style degree-12 tower. */ -export type Tower12Opts = { - /** Prime-field order. */ - ORDER: bigint; - /** Bit length of the BLS parameter `x`. */ - X_LEN: number; - /** Prime-field non-residue used by the quadratic extension. */ - NONRESIDUE?: Fp; - /** Quadratic-extension non-residue used by the sextic tower. */ - FP2_NONRESIDUE: BigintTuple; - /** - * Optional custom quadratic square-root helper. - * Receives one quadratic-extension element and returns one square root. - */ - Fp2sqrt?: (num: Fp2) => Fp2; - /** - * Multiply one quadratic element by the curve `b` constant. - * @param num - Quadratic-extension element to scale. - * @returns Product by the curve `b` constant. - */ - Fp2mulByB: (num: Fp2) => Fp2; - /** - * Final exponentiation used by pairing arithmetic. - * @param num - Degree-12 field element to exponentiate. - * @returns Pairing result after final exponentiation. - */ - Fp12finalExponentiate: (num: Fp12) => Fp12; -}; - -class _Field2 implements mod.IField { - readonly ORDER: bigint; - readonly BITS: number; - readonly BYTES: number; - readonly isLE: boolean; - - readonly ZERO: Fp2; - readonly ONE: Fp2; - readonly Fp: mod.IField; - - readonly NONRESIDUE: Fp2; - readonly mulByB: Tower12Opts['Fp2mulByB']; - readonly Fp_NONRESIDUE: bigint; - readonly Fp_div2: bigint; - readonly FROBENIUS_COEFFICIENTS: readonly Fp[]; - - constructor( - Fp: mod.IField, - opts: Partial<{ - NONRESIDUE: bigint; - FP2_NONRESIDUE: BigintTuple; - Fp2mulByB: Tower12Opts['Fp2mulByB']; - }> = {} - ) { - const { NONRESIDUE = BigInt(-1), FP2_NONRESIDUE, Fp2mulByB } = opts; - const ORDER = Fp.ORDER; - const FP2_ORDER = ORDER * ORDER; - this.Fp = Fp; - this.ORDER = FP2_ORDER; - this.BITS = bitLen(FP2_ORDER); - this.BYTES = Math.ceil(bitLen(FP2_ORDER) / 8); - this.isLE = Fp.isLE; - this.ZERO = this.create({ c0: Fp.ZERO, c1: Fp.ZERO }); - this.ONE = this.create({ c0: Fp.ONE, c1: Fp.ZERO }); - - // These knobs only swap constants for the shipped quadratic tower shape: - // arithmetic below assumes `u^2 = -1`, and bytes are handled as two adjacent - // `Fp` limbs (`fromBytes` / `toBytes` expect the shipped `2 * Fp.BYTES` layout). - this.Fp_NONRESIDUE = Fp.create(NONRESIDUE); - this.Fp_div2 = Fp.div(Fp.ONE, _2n); // 1/2 - this.NONRESIDUE = this.create({ c0: FP2_NONRESIDUE![0], c1: FP2_NONRESIDUE![1] }); - // const Fp2Nonresidue = this.create({ c0: FP2_NONRESIDUE![0], c1: FP2_NONRESIDUE![1] }); - this.FROBENIUS_COEFFICIENTS = Object.freeze( - calcFrobeniusCoefficients(Fp, this.Fp_NONRESIDUE, Fp.ORDER, 2)[0] - ); - this.mulByB = (num) => { - // This config hook is trusted to return a canonical Fp2 value already. - // Copy+freeze it to keep the tower immutability invariant without mutating caller objects. - const { c0, c1 } = Fp2mulByB!(num); - return Object.freeze({ c0, c1 }); - }; - Object.freeze(this); - } - fromBigTuple(tuple: BigintTuple) { - if (!Array.isArray(tuple) || tuple.length !== 2) throw new Error('invalid Fp2.fromBigTuple'); - const [c0, c1] = tuple; - if (typeof c0 !== 'bigint' || typeof c1 !== 'bigint') - throw new Error('invalid Fp2.fromBigTuple'); - return this.create({ c0, c1 }); - } - create(num: Fp2) { - const { Fp } = this; - const c0 = Fp.create(num.c0); - const c1 = Fp.create(num.c1); - // Bigint field elements are immutable values, and higher-level code relies on - // that invariant. Copy+freeze tower values too without mutating caller-owned objects. - return Object.freeze({ c0, c1 }); - } - isValid(num: Fp2) { - if (!isObj(num)) - throw new TypeError('invalid field element: expected object, got ' + typeof num); - const { c0, c1 } = num; - const { Fp } = this; - // Match base-field `isValid(...)`: malformed coordinate types are errors, not a `false` - // predicate result. - return Fp.isValid(c0) && Fp.isValid(c1); - } - is0(num: Fp2) { - if (!isObj(num)) return false; - const { c0, c1 } = num; - const { Fp } = this; - return Fp.is0(c0) && Fp.is0(c1); - } - isValidNot0(num: Fp2) { - return !this.is0(num) && this.isValid(num); - } - eql({ c0, c1 }: Fp2, { c0: r0, c1: r1 }: Fp2) { - const { Fp } = this; - return Fp.eql(c0, r0) && Fp.eql(c1, r1); - } - neg({ c0, c1 }: Fp2) { - const { Fp } = this; - return Object.freeze({ c0: Fp.neg(c0), c1: Fp.neg(c1) }); - } - pow(num: Fp2, power: bigint): Fp2 { - return mod.FpPow(this, num, power); - } - invertBatch(nums: Fp2[]): Fp2[] { - return mod.FpInvertBatch(this, nums); - } - // Normalized - add(f1: Fp2, f2: Fp2): Fp2 { - const { Fp } = this; - const { c0, c1 } = f1; - const { c0: r0, c1: r1 } = f2; - return Object.freeze({ - c0: Fp.add(c0, r0), - c1: Fp.add(c1, r1), - }); - } - sub({ c0, c1 }: Fp2, { c0: r0, c1: r1 }: Fp2) { - const { Fp } = this; - return Object.freeze({ - c0: Fp.sub(c0, r0), - c1: Fp.sub(c1, r1), - }); - } - mul({ c0, c1 }: Fp2, rhs: Fp2) { - const { Fp } = this; - if (typeof rhs === 'bigint') return Object.freeze({ c0: Fp.mul(c0, rhs), c1: Fp.mul(c1, rhs) }); - // (a+bi)(c+di) = (ac−bd) + (ad+bc)i - const { c0: r0, c1: r1 } = rhs; - let t1 = Fp.mul(c0, r0); // c0 * o0 - let t2 = Fp.mul(c1, r1); // c1 * o1 - // (T1 - T2) + ((c0 + c1) * (r0 + r1) - (T1 + T2))*i - const o0 = Fp.sub(t1, t2); - const o1 = Fp.sub(Fp.mul(Fp.add(c0, c1), Fp.add(r0, r1)), Fp.add(t1, t2)); - return Object.freeze({ c0: o0, c1: o1 }); - } - sqr({ c0, c1 }: Fp2) { - const { Fp } = this; - const a = Fp.add(c0, c1); - const b = Fp.sub(c0, c1); - const c = Fp.add(c0, c0); - return Object.freeze({ c0: Fp.mul(a, b), c1: Fp.mul(c, c1) }); - } - // NonNormalized stuff - addN(a: Fp2, b: Fp2): Fp2 { - return this.add(a, b); - } - subN(a: Fp2, b: Fp2): Fp2 { - return this.sub(a, b); - } - mulN(a: Fp2, b: Fp2): Fp2 { - return this.mul(a, b); - } - sqrN(a: Fp2): Fp2 { - return this.sqr(a); - } - // Why inversion for bigint inside Fp instead of Fp2? it is even used in that context? - div(lhs: Fp2, rhs: Fp2): Fp2 { - const { Fp } = this; - // @ts-ignore - return this.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : this.inv(rhs)); - } - inv({ c0: a, c1: b }: Fp2): Fp2 { - // We wish to find the multiplicative inverse of a nonzero - // element a + bu in Fp2. We leverage an identity - // - // (a + bu)(a - bu) = a² + b² - // - // which holds because u² = -1. This can be rewritten as - // - // (a + bu)(a - bu)/(a² + b²) = 1 - // - // because a² + b² = 0 has no nonzero solutions for (a, b). - // This gives that (a - bu)/(a² + b²) is the inverse - // of (a + bu). Importantly, this can be computing using - // only a single inversion in Fp. - const { Fp } = this; - const factor = Fp.inv(Fp.create(a * a + b * b)); - return Object.freeze({ c0: Fp.mul(factor, Fp.create(a)), c1: Fp.mul(factor, Fp.create(-b)) }); - } - sqrt(num: Fp2) { - // This is generic for all quadratic extensions (Fp2) - const { Fp } = this; - const Fp2 = this; - const { c0, c1 } = num; - if (Fp.is0(c1)) { - // if c0 is quadratic residue - if (mod.FpLegendre(Fp, c0) === 1) return Fp2.create({ c0: Fp.sqrt(c0), c1: Fp.ZERO }); - else return Fp2.create({ c0: Fp.ZERO, c1: Fp.sqrt(Fp.div(c0, this.Fp_NONRESIDUE)) }); - } - const a = Fp.sqrt(Fp.sub(Fp.sqr(c0), Fp.mul(Fp.sqr(c1), this.Fp_NONRESIDUE))); - let d = Fp.mul(Fp.add(a, c0), this.Fp_div2); - const legendre = mod.FpLegendre(Fp, d); - // -1, Quadratic non residue - if (legendre === -1) d = Fp.sub(d, a); - const a0 = Fp.sqrt(d); - const candidateSqrt = Fp2.create({ c0: a0, c1: Fp.div(Fp.mul(c1, this.Fp_div2), a0) }); - if (!Fp2.eql(Fp2.sqr(candidateSqrt), num)) throw new Error('Cannot find square root'); - // Normalize root: at this point candidateSqrt ** 2 = num, but also -candidateSqrt ** 2 = num - const x1 = candidateSqrt; - const x2 = Fp2.neg(x1); - const { re: re1, im: im1 } = Fp2.reim(x1); - const { re: re2, im: im2 } = Fp2.reim(x2); - if (im1 > im2 || (im1 === im2 && re1 > re2)) return x1; - return x2; - } - // Same as sgn0_m_eq_2 in RFC 9380 - isOdd(x: Fp2) { - const { re: x0, im: x1 } = this.reim(x); - const sign_0 = x0 % _2n; - const zero_0 = x0 === _0n; - const sign_1 = x1 % _2n; - return BigInt(sign_0 || (zero_0 && sign_1)) == _1n; - } - // Bytes util - fromBytes(b: Uint8Array): Fp2 { - const { Fp } = this; - abytes(b); - if (b.length !== this.BYTES) throw new Error('fromBytes invalid length=' + b.length); - return this.create({ - c0: Fp.fromBytes(b.subarray(0, Fp.BYTES)), - c1: Fp.fromBytes(b.subarray(Fp.BYTES)), - }); - } - toBytes({ c0, c1 }: Fp2): Uint8Array { - return concatBytes(this.Fp.toBytes(c0), this.Fp.toBytes(c1)); - } - cmov({ c0, c1 }: Fp2, { c0: r0, c1: r1 }: Fp2, c: boolean) { - const { Fp } = this; - return this.create({ - c0: Fp.cmov(c0, r0, c), - c1: Fp.cmov(c1, r1, c), - }); - } - reim({ c0, c1 }: Fp2) { - return { re: c0, im: c1 }; - } - Fp4Square(a: Fp2, b: Fp2): { first: Fp2; second: Fp2 } { - const Fp2 = this; - const a2 = Fp2.sqr(a); - const b2 = Fp2.sqr(b); - return { - first: Fp2.add(Fp2.mulByNonresidue(b2), a2), // b² * Nonresidue + a² - second: Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(a, b)), a2), b2), // (a + b)² - a² - b² - }; - } - // multiply by u + 1 - mulByNonresidue({ c0, c1 }: Fp2) { - return this.mul({ c0, c1 }, this.NONRESIDUE); - } - frobeniusMap({ c0, c1 }: Fp2, power: number): Fp2 { - return Object.freeze({ - c0, - c1: this.Fp.mul(c1, this.FROBENIUS_COEFFICIENTS[power % 2]), - }); - } -} - -class _Field6 implements Fp6Bls { - readonly ORDER: bigint; - readonly BITS: number; - readonly BYTES: number; - readonly isLE: boolean; - - readonly ZERO: Fp6; - readonly ONE: Fp6; - readonly Fp2: Fp2Bls; - - constructor(Fp2: Fp2Bls) { - this.Fp2 = Fp2; - // `IField.ORDER` is the field cardinality `q`; for sextic extensions that is `p^6`. - // Generic helpers like Frobenius-style `x^q = x` checks rely on the literal field size here. - this.ORDER = Fp2.Fp.ORDER ** _6n; - this.BITS = 3 * Fp2.BITS; - this.BYTES = 3 * Fp2.BYTES; - this.isLE = Fp2.isLE; - this.ZERO = this.create({ c0: Fp2.ZERO, c1: Fp2.ZERO, c2: Fp2.ZERO }); - this.ONE = this.create({ c0: Fp2.ONE, c1: Fp2.ZERO, c2: Fp2.ZERO }); - Object.freeze(this); - } - // Most callers never touch Frobenius maps, so keep the sextic tables lazy: - // eagerly deriving them dominates `bls12-381.js` / `bn254.js` import time. - get FROBENIUS_COEFFICIENTS_1(): readonly Fp2[] { - const frob = _FROBENIUS_COEFFICIENTS_6.get(this); - if (frob) return frob[0]; - const { Fp2 } = this; - const { Fp } = Fp2; - const rows = calcFrobeniusCoefficients(Fp2, Fp2.NONRESIDUE, Fp.ORDER, 6, 2, 3); - const cache = [Object.freeze(rows[0]), Object.freeze(rows[1])] as const; - _FROBENIUS_COEFFICIENTS_6.set(this, cache); - return cache[0]; - } - get FROBENIUS_COEFFICIENTS_2(): readonly Fp2[] { - const frob = _FROBENIUS_COEFFICIENTS_6.get(this); - if (frob) return frob[1]; - void this.FROBENIUS_COEFFICIENTS_1; - return _FROBENIUS_COEFFICIENTS_6.get(this)![1]; - } - add({ c0, c1, c2 }: Fp6, { c0: r0, c1: r1, c2: r2 }: Fp6) { - const { Fp2 } = this; - return Object.freeze({ - c0: Fp2.add(c0, r0), - c1: Fp2.add(c1, r1), - c2: Fp2.add(c2, r2), - }); - } - sub({ c0, c1, c2 }: Fp6, { c0: r0, c1: r1, c2: r2 }: Fp6) { - const { Fp2 } = this; - return Object.freeze({ - c0: Fp2.sub(c0, r0), - c1: Fp2.sub(c1, r1), - c2: Fp2.sub(c2, r2), - }); - } - mul({ c0, c1, c2 }: Fp6, rhs: Fp6 | bigint) { - const { Fp2 } = this; - if (typeof rhs === 'bigint') { - return Object.freeze({ - c0: Fp2.mul(c0, rhs), - c1: Fp2.mul(c1, rhs), - c2: Fp2.mul(c2, rhs), - }); - } - const { c0: r0, c1: r1, c2: r2 } = rhs; - const t0 = Fp2.mul(c0, r0); // c0 * o0 - const t1 = Fp2.mul(c1, r1); // c1 * o1 - const t2 = Fp2.mul(c2, r2); // c2 * o2 - return Object.freeze({ - // t0 + (c1 + c2) * (r1 * r2) - (T1 + T2) * (u + 1) - c0: Fp2.add( - t0, - Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), Fp2.add(r1, r2)), Fp2.add(t1, t2))) - ), - // (c0 + c1) * (r0 + r1) - (T0 + T1) + T2 * (u + 1) - c1: Fp2.add( - Fp2.sub(Fp2.mul(Fp2.add(c0, c1), Fp2.add(r0, r1)), Fp2.add(t0, t1)), - Fp2.mulByNonresidue(t2) - ), - // T1 + (c0 + c2) * (r0 + r2) - T0 + T2 - c2: Fp2.sub(Fp2.add(t1, Fp2.mul(Fp2.add(c0, c2), Fp2.add(r0, r2))), Fp2.add(t0, t2)), - }); - } - sqr({ c0, c1, c2 }: Fp6) { - const { Fp2 } = this; - let t0 = Fp2.sqr(c0); // c0² - let t1 = Fp2.mul(Fp2.mul(c0, c1), _2n); // 2 * c0 * c1 - let t3 = Fp2.mul(Fp2.mul(c1, c2), _2n); // 2 * c1 * c2 - let t4 = Fp2.sqr(c2); // c2² - return Object.freeze({ - c0: Fp2.add(Fp2.mulByNonresidue(t3), t0), // T3 * (u + 1) + T0 - c1: Fp2.add(Fp2.mulByNonresidue(t4), t1), // T4 * (u + 1) + T1 - // T1 + (c0 - c1 + c2)² + T3 - T0 - T4 - c2: Fp2.sub(Fp2.sub(Fp2.add(Fp2.add(t1, Fp2.sqr(Fp2.add(Fp2.sub(c0, c1), c2))), t3), t0), t4), - }); - } - addN(a: Fp6, b: Fp6): Fp6 { - return this.add(a, b); - } - subN(a: Fp6, b: Fp6): Fp6 { - return this.sub(a, b); - } - mulN(a: Fp6, b: Fp6): Fp6 { - return this.mul(a, b); - } - sqrN(a: Fp6): Fp6 { - return this.sqr(a); - } - - create(num: Fp6) { - const { Fp2 } = this; - const c0 = Fp2.create(num.c0); - const c1 = Fp2.create(num.c1); - const c2 = Fp2.create(num.c2); - return Object.freeze({ c0, c1, c2 }); - } - - isValid(num: Fp6) { - if (!isObj(num)) - throw new TypeError('invalid field element: expected object, got ' + typeof num); - const { c0, c1, c2 } = num; - const { Fp2 } = this; - return Fp2.isValid(c0) && Fp2.isValid(c1) && Fp2.isValid(c2); - } - is0(num: Fp6) { - if (!isObj(num)) return false; - const { c0, c1, c2 } = num; - const { Fp2 } = this; - return Fp2.is0(c0) && Fp2.is0(c1) && Fp2.is0(c2); - } - isValidNot0(num: Fp6) { - return !this.is0(num) && this.isValid(num); - } - neg({ c0, c1, c2 }: Fp6) { - const { Fp2 } = this; - return Object.freeze({ c0: Fp2.neg(c0), c1: Fp2.neg(c1), c2: Fp2.neg(c2) }); - } - eql({ c0, c1, c2 }: Fp6, { c0: r0, c1: r1, c2: r2 }: Fp6) { - const { Fp2 } = this; - return Fp2.eql(c0, r0) && Fp2.eql(c1, r1) && Fp2.eql(c2, r2); - } - sqrt(_: Fp6) { - // Sextic extensions can use generic odd-field Tonelli-Shanks, but the helper must work - // over `IField` with a quadratic non-residue from Fp6 itself. The current - // `mod.tonelliShanks(P)` precomputation only searches integer residues in the base field. - return notImplemented(); - } - // Do we need division by bigint at all? Should be done via order: - div(lhs: Fp6, rhs: Fp6) { - const { Fp2 } = this; - const { Fp } = Fp2; - return this.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : this.inv(rhs)); - } - pow(num: Fp6, power: Fp): Fp6 { - return mod.FpPow(this, num, power); - } - invertBatch(nums: Fp6[]): Fp6[] { - return mod.FpInvertBatch(this, nums); - } - - inv({ c0, c1, c2 }: Fp6) { - const { Fp2 } = this; - let t0 = Fp2.sub(Fp2.sqr(c0), Fp2.mulByNonresidue(Fp2.mul(c2, c1))); // c0² - c2 * c1 * (u + 1) - let t1 = Fp2.sub(Fp2.mulByNonresidue(Fp2.sqr(c2)), Fp2.mul(c0, c1)); // c2² * (u + 1) - c0 * c1 - let t2 = Fp2.sub(Fp2.sqr(c1), Fp2.mul(c0, c2)); // c1² - c0 * c2 - // 1/(((c2 * T1 + c1 * T2) * v) + c0 * T0) - let t4 = Fp2.inv( - Fp2.add(Fp2.mulByNonresidue(Fp2.add(Fp2.mul(c2, t1), Fp2.mul(c1, t2))), Fp2.mul(c0, t0)) - ); - return Object.freeze({ c0: Fp2.mul(t4, t0), c1: Fp2.mul(t4, t1), c2: Fp2.mul(t4, t2) }); - } - // Bytes utils - fromBytes(b: Uint8Array): Fp6 { - const { Fp2 } = this; - abytes(b); - if (b.length !== this.BYTES) throw new Error('fromBytes invalid length=' + b.length); - const B2 = Fp2.BYTES; - return this.create({ - c0: Fp2.fromBytes(b.subarray(0, B2)), - c1: Fp2.fromBytes(b.subarray(B2, B2 * 2)), - c2: Fp2.fromBytes(b.subarray(2 * B2)), - }); - } - toBytes({ c0, c1, c2 }: Fp6): Uint8Array { - const { Fp2 } = this; - return concatBytes(Fp2.toBytes(c0), Fp2.toBytes(c1), Fp2.toBytes(c2)); - } - cmov({ c0, c1, c2 }: Fp6, { c0: r0, c1: r1, c2: r2 }: Fp6, c: boolean) { - const { Fp2 } = this; - return this.create({ - c0: Fp2.cmov(c0, r0, c), - c1: Fp2.cmov(c1, r1, c), - c2: Fp2.cmov(c2, r2, c), - }); - } - fromBigSix(tuple: BigintSix): Fp6 { - const { Fp2 } = this; - if (!Array.isArray(tuple) || tuple.length !== 6) throw new Error('invalid Fp6.fromBigSix'); - for (let i = 0; i < 6; i++) - if (typeof tuple[i] !== 'bigint') throw new Error('invalid Fp6.fromBigSix'); - const t = tuple; - return this.create({ - c0: Fp2.fromBigTuple(t.slice(0, 2) as BigintTuple), - c1: Fp2.fromBigTuple(t.slice(2, 4) as BigintTuple), - c2: Fp2.fromBigTuple(t.slice(4, 6) as BigintTuple), - }); - } - frobeniusMap({ c0, c1, c2 }: Fp6, power: number) { - const { Fp2 } = this; - return Object.freeze({ - c0: Fp2.frobeniusMap(c0, power), - c1: Fp2.mul(Fp2.frobeniusMap(c1, power), this.FROBENIUS_COEFFICIENTS_1[power % 6]), - c2: Fp2.mul(Fp2.frobeniusMap(c2, power), this.FROBENIUS_COEFFICIENTS_2[power % 6]), - }); - } - mulByFp2({ c0, c1, c2 }: Fp6, rhs: Fp2): Fp6 { - const { Fp2 } = this; - return Object.freeze({ - c0: Fp2.mul(c0, rhs), - c1: Fp2.mul(c1, rhs), - c2: Fp2.mul(c2, rhs), - }); - } - mulByNonresidue({ c0, c1, c2 }: Fp6) { - const { Fp2 } = this; - return Object.freeze({ c0: Fp2.mulByNonresidue(c2), c1: c0, c2: c1 }); - } - // Sparse multiplication - mul1({ c0, c1, c2 }: Fp6, b1: Fp2): Fp6 { - const { Fp2 } = this; - return Object.freeze({ - c0: Fp2.mulByNonresidue(Fp2.mul(c2, b1)), - c1: Fp2.mul(c0, b1), - c2: Fp2.mul(c1, b1), - }); - } - // Sparse multiplication - mul01({ c0, c1, c2 }: Fp6, b0: Fp2, b1: Fp2): Fp6 { - const { Fp2 } = this; - let t0 = Fp2.mul(c0, b0); // c0 * b0 - let t1 = Fp2.mul(c1, b1); // c1 * b1 - return Object.freeze({ - // ((c1 + c2) * b1 - T1) * (u + 1) + T0 - c0: Fp2.add(Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), b1), t1)), t0), - // (b0 + b1) * (c0 + c1) - T0 - T1 - c1: Fp2.sub(Fp2.sub(Fp2.mul(Fp2.add(b0, b1), Fp2.add(c0, c1)), t0), t1), - // (c0 + c2) * b0 - T0 + T1 - c2: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c2), b0), t0), t1), - }); - } -} - -// Keep lazy tower caches off-object: field instances stay frozen, and debugger output -// stays readable without JS private slots while second/subsequent lookups still hit cache. -const _FROBENIUS_COEFFICIENTS_6 = new WeakMap<_Field6, readonly [readonly Fp2[], readonly Fp2[]]>(); - -class _Field12 implements Fp12Bls { - readonly ORDER: bigint; - readonly BITS: number; - readonly BYTES: number; - readonly isLE: boolean; - - readonly ZERO: Fp12; - readonly ONE: Fp12; - - readonly Fp6: Fp6Bls; - readonly X_LEN: number; - readonly finalExponentiate: Tower12Opts['Fp12finalExponentiate']; - - constructor(Fp6: Fp6Bls, opts: Tower12Opts) { - const { X_LEN, Fp12finalExponentiate } = opts; - const { Fp2 } = Fp6; - const { Fp } = Fp2; - this.Fp6 = Fp6; - - // `IField.ORDER` is the field cardinality `q`; for degree-12 extensions that is `p^12`. - // Keeping `p^2` here breaks generic field identities like `x^q = x` on Fp12. - this.ORDER = Fp.ORDER ** _12n; - this.BITS = 2 * Fp6.BITS; - this.BYTES = 2 * Fp6.BYTES; - this.isLE = Fp6.isLE; - // Returned tower values are frozen, so larger constants can safely reuse - // already-frozen child coefficients instead of cloning them. - this.ZERO = this.create({ c0: Fp6.ZERO, c1: Fp6.ZERO }); - this.ONE = this.create({ c0: Fp6.ONE, c1: Fp6.ZERO }); - this.X_LEN = X_LEN; - this.finalExponentiate = (num) => { - const copy2 = ({ c0, c1 }: Fp2): Fp2 => Object.freeze({ c0, c1 }); - const copy6 = ({ c0, c1, c2 }: Fp6): Fp6 => - Object.freeze({ c0: copy2(c0), c1: copy2(c1), c2: copy2(c2) }); - // This config hook is trusted to return a canonical Fp12 value already. - // Copy+freeze it to keep the tower immutability invariant without mutating caller objects. - const res = Fp12finalExponentiate(num); - return Object.freeze({ c0: copy6(res.c0), c1: copy6(res.c1) }); - }; - Object.freeze(this); - } - // Keep the degree-12 Frobenius row lazy too; after the first lookup the cached - // array is reused exactly like the old eager table. - get FROBENIUS_COEFFICIENTS(): readonly Fp2[] { - const frob = _FROBENIUS_COEFFICIENTS_12.get(this); - if (frob) return frob; - const { Fp2 } = this.Fp6; - const { Fp } = Fp2; - const cache = Object.freeze( - calcFrobeniusCoefficients(Fp2, Fp2.NONRESIDUE, Fp.ORDER, 12, 1, 6)[0] - ); - _FROBENIUS_COEFFICIENTS_12.set(this, cache); - return cache; - } - create(num: Fp12) { - const { Fp6 } = this; - const c0 = Fp6.create(num.c0); - const c1 = Fp6.create(num.c1); - return Object.freeze({ c0, c1 }); - } - isValid(num: Fp12) { - if (!isObj(num)) - throw new TypeError('invalid field element: expected object, got ' + typeof num); - const { c0, c1 } = num; - const { Fp6 } = this; - return Fp6.isValid(c0) && Fp6.isValid(c1); - } - is0(num: Fp12) { - if (!isObj(num)) return false; - const { c0, c1 } = num; - const { Fp6 } = this; - return Fp6.is0(c0) && Fp6.is0(c1); - } - isValidNot0(num: Fp12) { - return !this.is0(num) && this.isValid(num); - } - neg({ c0, c1 }: Fp12) { - const { Fp6 } = this; - return Object.freeze({ c0: Fp6.neg(c0), c1: Fp6.neg(c1) }); - } - eql({ c0, c1 }: Fp12, { c0: r0, c1: r1 }: Fp12) { - const { Fp6 } = this; - return Fp6.eql(c0, r0) && Fp6.eql(c1, r1); - } - sqrt(_: Fp12): Fp12 { - // Fp12 is quadratic over Fp6, so a dedicated quadratic-extension sqrt is possible here - // once Fp6.sqrt() exists. Without that lower-level sqrt, only a field-generic - // Tonelli-Shanks path over Fp12 itself would work. - return notImplemented(); - } - inv({ c0, c1 }: Fp12) { - const { Fp6 } = this; - let t = Fp6.inv(Fp6.sub(Fp6.sqr(c0), Fp6.mulByNonresidue(Fp6.sqr(c1)))); // 1 / (c0² - c1² * v) - // ((C0 * T) * T) + (-C1 * T) * w - return Object.freeze({ c0: Fp6.mul(c0, t), c1: Fp6.neg(Fp6.mul(c1, t)) }); - } - div(lhs: Fp12, rhs: Fp12) { - const { Fp6 } = this; - const { Fp2 } = Fp6; - const { Fp } = Fp2; - return this.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : this.inv(rhs)); - } - pow(num: Fp12, power: bigint): Fp12 { - return mod.FpPow(this, num, power); - } - invertBatch(nums: Fp12[]): Fp12[] { - return mod.FpInvertBatch(this, nums); - } - - // Normalized - add({ c0, c1 }: Fp12, { c0: r0, c1: r1 }: Fp12) { - const { Fp6 } = this; - return Object.freeze({ - c0: Fp6.add(c0, r0), - c1: Fp6.add(c1, r1), - }); - } - sub({ c0, c1 }: Fp12, { c0: r0, c1: r1 }: Fp12) { - const { Fp6 } = this; - return Object.freeze({ - c0: Fp6.sub(c0, r0), - c1: Fp6.sub(c1, r1), - }); - } - mul({ c0, c1 }: Fp12, rhs: Fp12 | bigint) { - const { Fp6 } = this; - if (typeof rhs === 'bigint') - return Object.freeze({ c0: Fp6.mul(c0, rhs), c1: Fp6.mul(c1, rhs) }); - let { c0: r0, c1: r1 } = rhs; - let t1 = Fp6.mul(c0, r0); // c0 * r0 - let t2 = Fp6.mul(c1, r1); // c1 * r1 - return Object.freeze({ - c0: Fp6.add(t1, Fp6.mulByNonresidue(t2)), // T1 + T2 * v - // (c0 + c1) * (r0 + r1) - (T1 + T2) - c1: Fp6.sub(Fp6.mul(Fp6.add(c0, c1), Fp6.add(r0, r1)), Fp6.add(t1, t2)), - }); - } - sqr({ c0, c1 }: Fp12) { - const { Fp6 } = this; - let ab = Fp6.mul(c0, c1); // c0 * c1 - return Object.freeze({ - // (c1 * v + c0) * (c0 + c1) - AB - AB * v - c0: Fp6.sub( - Fp6.sub(Fp6.mul(Fp6.add(Fp6.mulByNonresidue(c1), c0), Fp6.add(c0, c1)), ab), - Fp6.mulByNonresidue(ab) - ), - c1: Fp6.add(ab, ab), - }); // AB + AB - } - // NonNormalized stuff - addN(a: Fp12, b: Fp12): Fp12 { - return this.add(a, b); - } - subN(a: Fp12, b: Fp12): Fp12 { - return this.sub(a, b); - } - mulN(a: Fp12, b: Fp12): Fp12 { - return this.mul(a, b); - } - sqrN(a: Fp12): Fp12 { - return this.sqr(a); - } - - // Bytes utils - fromBytes(b: Uint8Array): Fp12 { - const { Fp6 } = this; - abytes(b); - if (b.length !== this.BYTES) throw new Error('fromBytes invalid length=' + b.length); - return this.create({ - c0: Fp6.fromBytes(b.subarray(0, Fp6.BYTES)), - c1: Fp6.fromBytes(b.subarray(Fp6.BYTES)), - }); - } - toBytes({ c0, c1 }: Fp12): Uint8Array { - const { Fp6 } = this; - return concatBytes(Fp6.toBytes(c0), Fp6.toBytes(c1)); - } - cmov({ c0, c1 }: Fp12, { c0: r0, c1: r1 }: Fp12, c: boolean) { - const { Fp6 } = this; - return this.create({ - c0: Fp6.cmov(c0, r0, c), - c1: Fp6.cmov(c1, r1, c), - }); - } - // Utils - // toString() { - // return '' + 'Fp12(' + this.c0 + this.c1 + '* w'); - // }, - // fromTuple(c: [Fp6, Fp6]) { - // return new Fp12(...c); - // } - fromBigTwelve(tuple: BigintTwelve): Fp12 { - const { Fp6 } = this; - if (!Array.isArray(tuple) || tuple.length !== 12) throw new Error('invalid Fp12.fromBigTwelve'); - for (let i = 0; i < 12; i++) - if (typeof tuple[i] !== 'bigint') throw new Error('invalid Fp12.fromBigTwelve'); - const t = tuple; - return this.create({ - c0: Fp6.fromBigSix(t.slice(0, 6) as BigintSix), - c1: Fp6.fromBigSix(t.slice(6, 12) as BigintSix), - }); - } - // Raises to q**i -th power - frobeniusMap(lhs: Fp12, power: number) { - const { Fp6 } = this; - const { Fp2 } = Fp6; - const { c0, c1, c2 } = Fp6.frobeniusMap(lhs.c1, power); - const coeff = this.FROBENIUS_COEFFICIENTS[power % 12]; - return Object.freeze({ - c0: Fp6.frobeniusMap(lhs.c0, power), - c1: Object.freeze({ - c0: Fp2.mul(c0, coeff), - c1: Fp2.mul(c1, coeff), - c2: Fp2.mul(c2, coeff), - }), - }); - } - mulByFp2({ c0, c1 }: Fp12, rhs: Fp2): Fp12 { - const { Fp6 } = this; - return Object.freeze({ - c0: Fp6.mulByFp2(c0, rhs), - c1: Fp6.mulByFp2(c1, rhs), - }); - } - conjugate({ c0, c1 }: Fp12): Fp12 { - // Reuse `c0` by reference and only negate the `w` coefficient. - return Object.freeze({ c0, c1: this.Fp6.neg(c1) }); - } - // Sparse multiplication - mul014({ c0, c1 }: Fp12, o0: Fp2, o1: Fp2, o4: Fp2) { - const { Fp6 } = this; - const { Fp2 } = Fp6; - let t0 = Fp6.mul01(c0, o0, o1); - let t1 = Fp6.mul1(c1, o4); - return Object.freeze({ - c0: Fp6.add(Fp6.mulByNonresidue(t1), t0), // T1 * v + T0 - // (c1 + c0) * [o0, o1+o4] - T0 - T1 - c1: Fp6.sub(Fp6.sub(Fp6.mul01(Fp6.add(c1, c0), o0, Fp2.add(o1, o4)), t0), t1), - }); - } - mul034({ c0, c1 }: Fp12, o0: Fp2, o3: Fp2, o4: Fp2) { - const { Fp6 } = this; - const { Fp2 } = Fp6; - const a = Object.freeze({ - c0: Fp2.mul(c0.c0, o0), - c1: Fp2.mul(c0.c1, o0), - c2: Fp2.mul(c0.c2, o0), - }); - const b = Fp6.mul01(c1, o3, o4); - const e = Fp6.mul01(Fp6.add(c0, c1), Fp2.add(o0, o3), o4); - return Object.freeze({ - c0: Fp6.add(Fp6.mulByNonresidue(b), a), - c1: Fp6.sub(e, Fp6.add(a, b)), - }); - } - - // A cyclotomic group is a subgroup of Fp^n defined by - // GΦₙ(p) = {α ∈ Fpⁿ : α^Φₙ(p) = 1} - // The result of any pairing is in a cyclotomic subgroup - // https://eprint.iacr.org/2009/565.pdf - // https://eprint.iacr.org/2010/354.pdf - _cyclotomicSquare({ c0, c1 }: Fp12): Fp12 { - const { Fp6 } = this; - const { Fp2 } = Fp6; - const { c0: c0c0, c1: c0c1, c2: c0c2 } = c0; - const { c0: c1c0, c1: c1c1, c2: c1c2 } = c1; - const { first: t3, second: t4 } = Fp2.Fp4Square(c0c0, c1c1); - const { first: t5, second: t6 } = Fp2.Fp4Square(c1c0, c0c2); - const { first: t7, second: t8 } = Fp2.Fp4Square(c0c1, c1c2); - const t9 = Fp2.mulByNonresidue(t8); // T8 * (u + 1) - return Object.freeze({ - c0: Object.freeze({ - c0: Fp2.add(Fp2.mul(Fp2.sub(t3, c0c0), _2n), t3), // 2 * (T3 - c0c0) + T3 - c1: Fp2.add(Fp2.mul(Fp2.sub(t5, c0c1), _2n), t5), // 2 * (T5 - c0c1) + T5 - c2: Fp2.add(Fp2.mul(Fp2.sub(t7, c0c2), _2n), t7), - }), // 2 * (T7 - c0c2) + T7 - c1: Object.freeze({ - c0: Fp2.add(Fp2.mul(Fp2.add(t9, c1c0), _2n), t9), // 2 * (T9 + c1c0) + T9 - c1: Fp2.add(Fp2.mul(Fp2.add(t4, c1c1), _2n), t4), // 2 * (T4 + c1c1) + T4 - c2: Fp2.add(Fp2.mul(Fp2.add(t6, c1c2), _2n), t6), - }), - }); // 2 * (T6 + c1c2) + T6 - } - // https://eprint.iacr.org/2009/565.pdf - _cyclotomicExp(num: Fp12, n: bigint): Fp12 { - // The loop only consumes `X_LEN` bits, so out-of-range exponents would otherwise get silently - // truncated (or sign-extended for negatives) instead of matching the caller's requested power. - aInRange('cyclotomic exponent', n, _0n, _1n << BigInt(this.X_LEN)); - let z = this.ONE; - for (let i = this.X_LEN - 1; i >= 0; i--) { - z = this._cyclotomicSquare(z); - if (bitGet(n, i)) z = this.mul(z, num); - } - return z; - } -} - -const _FROBENIUS_COEFFICIENTS_12 = new WeakMap<_Field12, readonly Fp2[]>(); - -/** - * @param opts - Tower construction options. See {@link Tower12Opts}. - * @returns BLS tower fields. - * @throws If the tower options or derived Frobenius helpers are invalid. {@link Error} - * @example - * Construct the Fp2/Fp6/Fp12 tower used by a pairing-friendly curve. - * - * ```ts - * const fields = tower12({ - * ORDER: 17n, - * X_LEN: 4, - * FP2_NONRESIDUE: [1n, 1n], - * Fp2mulByB: (num) => num, - * Fp12finalExponentiate: (num) => num, - * }); - * const fp12 = fields.Fp12.ONE; - * ``` - */ -export function tower12(opts: TArg): TRet<{ - Fp: Readonly & Required, 'isOdd'>>>; - Fp2: Fp2Bls; - Fp6: Fp6Bls; - Fp12: Fp12Bls; -}> { - validateObject( - opts, - { - ORDER: 'bigint', - X_LEN: 'number', - FP2_NONRESIDUE: 'object', - Fp2mulByB: 'function', - Fp12finalExponentiate: 'function', - }, - { NONRESIDUE: 'bigint' } - ); - asafenumber(opts.X_LEN, 'X_LEN'); - if (opts.X_LEN < 1) throw new Error('invalid X_LEN'); - const nonresidue = opts.FP2_NONRESIDUE as bigint[]; - if (!Array.isArray(nonresidue) || nonresidue.length !== 2) - throw new Error('invalid FP2_NONRESIDUE'); - if (typeof nonresidue[0] !== 'bigint' || typeof nonresidue[1] !== 'bigint') - throw new Error('invalid FP2_NONRESIDUE'); - const Fp = mod.Field(opts.ORDER); - const Fp2 = new _Field2(Fp, opts); - const Fp6 = new _Field6(Fp2); - const Fp12 = new _Field12(Fp6, opts); - return { Fp, Fp2, Fp6, Fp12 } as TRet<{ - Fp: Readonly & Required, 'isOdd'>>>; - Fp2: Fp2Bls; - Fp6: Fp6Bls; - Fp12: Fp12Bls; - }>; -} diff --git a/node_modules/@noble/curves/src/abstract/weierstrass.ts b/node_modules/@noble/curves/src/abstract/weierstrass.ts deleted file mode 100644 index 62ae5b4..0000000 --- a/node_modules/@noble/curves/src/abstract/weierstrass.ts +++ /dev/null @@ -1,1960 +0,0 @@ -/** - * Short Weierstrass curve methods. The formula is: y² = x³ + ax + b. - * - * ### Design rationale for types - * - * * Interaction between classes from different curves should fail: - * `k256.Point.BASE.add(p256.Point.BASE)` - * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime - * * Different calls of `curve()` would return different classes - - * `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve, - * it won't affect others - * - * TypeScript can't infer types for classes created inside a function. Classes is one instance - * of nominative types in TypeScript and interfaces only check for shape, so it's hard to create - * unique type for every function call. - * - * We can use generic types via some param, like curve opts, but that would: - * 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params) - * which is hard to debug. - * 2. Params can be generic and we can't enforce them to be constant value: - * if somebody creates curve from non-constant params, - * it would be allowed to interact with other curves with non-constant params - * - * @todo https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { hmac as nobleHmac } from '@noble/hashes/hmac.js'; -import { ahash } from '@noble/hashes/utils.js'; -import { - abignumber, - abool, - abytes, - aInRange, - asafenumber, - bitLen, - bitMask, - bytesToHex, - bytesToNumberBE, - concatBytes, - createHmacDrbg, - hexToBytes, - isBytes, - numberToHexUnpadded, - validateObject, - randomBytes as wcRandomBytes, - type CHash, - type HmacFn, - type Signer, - type TArg, - type TRet, -} from '../utils.ts'; -import { - createCurveFields, - createKeygen, - mulEndoUnsafe, - negateCt, - normalizeZ, - wNAF, - type AffinePoint, - type CurveLengths, - type CurvePoint, - type CurvePointCons, -} from './curve.ts'; -import { - FpInvertBatch, - FpIsSquare, - getMinHashLength, - mapHashToField, - validateField, - type IField, -} from './modular.ts'; - -/** Shared affine point shape used by Weierstrass helpers. */ -export type { AffinePoint }; - -type EndoBasis = [[bigint, bigint], [bigint, bigint]]; -/** - * When Weierstrass curve has `a=0`, it becomes Koblitz curve. - * Koblitz curves allow using **efficiently-computable GLV endomorphism ψ**. - * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. - * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. - * - * Endomorphism consists of beta, lambda and splitScalar: - * - * 1. GLV endomorphism ψ transforms a point: `P = (x, y) ↦ ψ(P) = (β·x mod p, y)` - * 2. GLV scalar decomposition transforms a scalar: `k ≡ k₁ + k₂·λ (mod n)` - * 3. Then these are combined: `k·P = k₁·P + k₂·ψ(P)` - * 4. Two 128-bit point-by-scalar multiplications + one point addition is faster than - * one 256-bit multiplication. - * - * where - * * beta: β ∈ Fₚ with β³ = 1, β ≠ 1 - * * lambda: λ ∈ Fₙ with λ³ = 1, λ ≠ 1 - * * splitScalar decomposes k ↦ k₁, k₂, by using reduced basis vectors. - * Gauss lattice reduction calculates them from initial basis vectors `(n, 0), (-λ, 0)` - * - * Check out `test/misc/endomorphism.js` and - * {@link https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 | this endomorphism gist}. - */ -export type EndomorphismOpts = { - /** Cube root of unity used by the GLV endomorphism. */ - beta: bigint; - /** Reduced lattice basis used for scalar splitting. */ - basises?: EndoBasis; - /** - * Optional custom scalar-splitting helper. - * Receives one scalar and returns two half-sized scalar components. - */ - splitScalar?: (k: bigint) => { k1neg: boolean; k1: bigint; k2neg: boolean; k2: bigint }; -}; -// We construct the basis so `den` is always positive and equals `n`, -// but the `num` sign depends on the basis, not on the secret value. -// Exact half-way cases round away from zero, which keeps the split symmetric -// around the reduced-basis boundaries used by endomorphism decomposition. -const divNearest = (num: bigint, den: bigint) => (num + (num >= 0 ? den : -den) / _2n) / den; - -/** Two half-sized scalar components returned by endomorphism splitting. */ -export type ScalarEndoParts = { - /** Whether the first split scalar should be negated. */ - k1neg: boolean; - /** Absolute value of the first split scalar. */ - k1: bigint; - /** Whether the second split scalar should be negated. */ - k2neg: boolean; - /** Absolute value of the second split scalar. */ - k2: bigint; -}; - -/** Splits scalar for GLV endomorphism. */ -export function _splitEndoScalar(k: bigint, basis: EndoBasis, n: bigint): ScalarEndoParts { - // Split scalar into two such that part is ~half bits: `abs(part) < sqrt(N)` - // Since part can be negative, we need to do this on point. - // Callers must provide a reduced GLV basis whose vectors satisfy - // `a + b * lambda ≡ 0 (mod n)`; this helper only sees the basis and `n`. - // Reject unreduced scalars instead of silently treating them mod n. - aInRange('scalar', k, _0n, n); - // TODO: verifyScalar function which consumes lambda - const [[a1, b1], [a2, b2]] = basis; - const c1 = divNearest(b2 * k, n); - const c2 = divNearest(-b1 * k, n); - // |k1|/|k2| is < sqrt(N), but can be negative. - // If we do `k1 mod N`, we'll get big scalar (`> sqrt(N)`): so, we do cheaper negation instead. - let k1 = k - c1 * a1 - c2 * a2; - let k2 = -c1 * b1 - c2 * b2; - const k1neg = k1 < _0n; - const k2neg = k2 < _0n; - if (k1neg) k1 = -k1; - if (k2neg) k2 = -k2; - // Double check that resulting scalar less than half bits of N: otherwise wNAF will fail. - // This should only happen on wrong bases. - // Also, the math inside is complex enough that this guard is worth keeping. - const MAX_NUM = bitMask(Math.ceil(bitLen(n) / 2)) + _1n; // Half bits of N - if (k1 < _0n || k1 >= MAX_NUM || k2 < _0n || k2 >= MAX_NUM) { - throw new Error('splitScalar (endomorphism): failed for k'); - } - return { k1neg, k1, k2neg, k2 }; -} - -/** - * Option to enable hedged signatures with improved security. - * - * * Randomly generated k is bad, because broken CSPRNG would leak private keys. - * * Deterministic k (RFC6979) is better; but is suspectible to fault attacks. - * - * We allow using technique described in RFC6979 3.6: additional k', a.k.a. adding randomness - * to deterministic sig. If CSPRNG is broken & randomness is weak, it would STILL be as secure - * as ordinary sig without ExtraEntropy. - * - * * `true` means "fetch data, from CSPRNG, incorporate it into k generation" - * * `false` means "disable extra entropy, use purely deterministic k" - * * `Uint8Array` passed means "incorporate following data into k generation" - * - * See {@link https://paulmillr.com/posts/deterministic-signatures/ | deterministic signatures}. - */ -export type ECDSAExtraEntropy = boolean | Uint8Array; -/** - * - `compact` is the default format - * - `recovered` is the same as compact, but with an extra byte indicating recovery byte - * - `der` is ASN.1 DER encoding - */ -export type ECDSASignatureFormat = 'compact' | 'recovered' | 'der'; -/** - * - `prehash`: (default: true) indicates whether to do sha256(message). - * When a custom hash is used, it must be set to `false`. - */ -export type ECDSARecoverOpts = { - /** Whether to hash the message before signature recovery. */ - prehash?: boolean; -}; -/** - * - `prehash`: (default: true) indicates whether to do sha256(message). - * When a custom hash is used, it must be set to `false`. - * - `lowS`: (default: true) prohibits signatures with `sig.s >= CURVE.n/2n`. - * Compatible with BTC/ETH. Setting `lowS: false` allows to create malleable signatures, - * which is default openssl behavior. - * Non-malleable signatures can still be successfully verified in openssl. - * - `format`: (default: 'compact') 'compact' or 'recovered' with recovery byte - */ -export type ECDSAVerifyOpts = { - /** Whether to hash the message before verification. */ - prehash?: boolean; - /** Whether to reject high-S signatures. */ - lowS?: boolean; - /** Signature encoding to accept. */ - format?: ECDSASignatureFormat; -}; -/** - * - `prehash`: (default: true) indicates whether to do sha256(message). - * When a custom hash is used, it must be set to `false`. - * - `lowS`: (default: true) prohibits signatures with `sig.s >= CURVE.n/2n`. - * Compatible with BTC/ETH. Setting `lowS: false` allows to create malleable signatures, - * which is default openssl behavior. - * Non-malleable signatures can still be successfully verified in openssl. - * - `format`: (default: 'compact') 'compact' or 'recovered' with recovery byte - * - `extraEntropy`: (default: false) creates signatures with increased - * security, see {@link ECDSAExtraEntropy} - */ -export type ECDSASignOpts = { - /** Whether to hash the message before signing. */ - prehash?: boolean; - /** Whether to normalize signatures into the low-S half-order. */ - lowS?: boolean; - /** Signature encoding to produce. */ - format?: ECDSASignatureFormat; - /** Optional hedging input for deterministic k generation. */ - extraEntropy?: ECDSAExtraEntropy; -}; - -function validateSigFormat(format: string): ECDSASignatureFormat { - if (!['compact', 'recovered', 'der'].includes(format)) - throw new Error('Signature format must be "compact", "recovered", or "der"'); - return format as ECDSASignatureFormat; -} - -function validateSigOpts>( - opts: T, - def: D -): D { - validateObject(opts); - const optsn = {} as D; - // Normalize only the declared option subset from `def`; unknown keys are - // intentionally ignored so shared / superset option bags stay valid here too. - // `extraEntropy` stays an opaque payload until the signing path consumes it. - for (let optName of Object.keys(def) as (keyof D)[]) { - // @ts-ignore - optsn[optName] = opts[optName] === undefined ? def[optName] : opts[optName]; - } - abool(optsn.lowS!, 'lowS'); - abool(optsn.prehash!, 'prehash'); - if (optsn.format !== undefined) validateSigFormat(optsn.format); - return optsn; -} - -/** Projective XYZ point used by short Weierstrass curves. */ -export interface WeierstrassPoint extends CurvePoint> { - /** projective X coordinate. Different from affine x. */ - readonly X: T; - /** projective Y coordinate. Different from affine y. */ - readonly Y: T; - /** projective z coordinate */ - readonly Z: T; - /** affine x coordinate. Different from projective X. */ - get x(): T; - /** affine y coordinate. Different from projective Y. */ - get y(): T; - /** - * Encode the point into compressed or uncompressed SEC1 bytes. - * @param isCompressed - Whether to use the compressed form. - * @returns Encoded point bytes. - */ - toBytes(isCompressed?: boolean): TRet; - /** - * Encode the point into compressed or uncompressed SEC1 hex. - * @param isCompressed - Whether to use the compressed form. - * @returns Encoded point hex. - */ - toHex(isCompressed?: boolean): string; -} - -/** Constructor and metadata helpers for Weierstrass points. */ -export interface WeierstrassPointCons extends CurvePointCons> { - /** Does NOT validate if the point is valid. Use `.assertValidity()`. */ - new (X: T, Y: T, Z: T): WeierstrassPoint; - /** - * Return the curve parameters captured by this point constructor. - * @returns Curve parameters. - */ - CURVE(): WeierstrassOpts; -} - -/** - * Weierstrass curve options. - * - * * p: prime characteristic (order) of finite field, in which arithmetics is done - * * n: order of prime subgroup a.k.a total amount of valid curve points - * * h: cofactor, usually 1. h*n is group order; n is subgroup order - * * a: formula param, must be in field of p - * * b: formula param, must be in field of p - * * Gx: x coordinate of generator point a.k.a. base point - * * Gy: y coordinate of generator point - */ -export type WeierstrassOpts = Readonly<{ - /** Base-field modulus. */ - p: bigint; - /** Prime subgroup order. */ - n: bigint; - /** Curve cofactor. */ - h: bigint; - /** Weierstrass curve parameter `a`. */ - a: T; - /** Weierstrass curve parameter `b`. */ - b: T; - /** Generator x coordinate. */ - Gx: T; - /** Generator y coordinate. */ - Gy: T; -}>; - -/** - * Optional helpers and overrides for a Weierstrass point constructor. - * - * When a cofactor != 1, there can be effective methods to: - * 1. Determine whether a point is torsion-free - * 2. Clear torsion component - */ -export type WeierstrassExtraOpts = Partial<{ - /** Optional base-field override. */ - Fp: IField; - /** Optional scalar-field override. */ - Fn: IField; - /** Whether the point constructor accepts infinity points. */ - allowInfinityPoint: boolean; - /** Optional GLV endomorphism data. */ - endo: EndomorphismOpts; - /** Optional torsion-check override. */ - isTorsionFree: (c: WeierstrassPointCons, point: WeierstrassPoint) => boolean; - /** Optional cofactor-clearing override. */ - clearCofactor: (c: WeierstrassPointCons, point: WeierstrassPoint) => WeierstrassPoint; - /** Optional custom point decoder. */ - fromBytes: (bytes: TArg) => AffinePoint; - /** Optional custom point encoder. */ - toBytes: ( - c: WeierstrassPointCons, - point: WeierstrassPoint, - isCompressed: boolean - ) => TRet; -}>; - -/** - * Options for ECDSA signatures over a Weierstrass curve. - * - * * lowS: (default: true) whether produced or verified signatures occupy the - * low half of `ecdsaOpts.n`. Prevents malleability. - * * hmac: (default: noble-hashes hmac) function, would be used to init hmac-drbg for k generation. - * * randomBytes: (default: webcrypto os-level CSPRNG) custom method for fetching secure randomness. - * * bits2int, bits2int_modN: used in sigs, sometimes overridden by curves. Custom hooks are - * treated as pure functions over validated bytes and MUST NOT mutate caller-owned buffers or - * closure-captured option bags. `bits2int_modN` must also return a canonical scalar in - * `[0..Point.Fn.ORDER-1]`. - */ -export type ECDSAOpts = Partial<{ - /** Default low-S policy for this ECDSA instance. */ - lowS: boolean; - /** HMAC implementation used by RFC6979 DRBG. */ - hmac: HmacFn; - /** RNG override used by helper constructors. */ - randomBytes: (bytesLength?: number) => TRet; - /** Hash-to-integer conversion override. */ - bits2int: (bytes: TArg) => bigint; - /** Hash-to-integer-mod-n conversion override. Returns a canonical scalar in `[0..Fn.ORDER-1]`. */ - bits2int_modN: (bytes: TArg) => bigint; -}>; - -/** Elliptic Curve Diffie-Hellman helper namespace. */ -export interface ECDH { - /** - * Generate a secret/public key pair. - * @param seed - Optional seed material. - * @returns Secret/public key pair. - */ - keygen: (seed?: TArg) => { secretKey: TRet; publicKey: TRet }; - /** - * Derive the public key from a secret key. - * @param secretKey - Secret key bytes. - * @param isCompressed - Whether to emit compressed SEC1 bytes. - * @returns Encoded public key. - */ - getPublicKey: (secretKey: TArg, isCompressed?: boolean) => TRet; - /** - * Compute the shared secret point from a secret key and peer public key. - * @param secretKeyA - Local secret key bytes. - * @param publicKeyB - Peer public key bytes. - * @param isCompressed - Whether to emit compressed SEC1 bytes. - * @returns Encoded shared point. - */ - getSharedSecret: ( - secretKeyA: TArg, - publicKeyB: TArg, - isCompressed?: boolean - ) => TRet; - /** Point constructor used by this ECDH instance. */ - Point: WeierstrassPointCons; - /** Validation and random-key helpers. */ - utils: { - /** Check whether a secret key has the expected encoding. */ - isValidSecretKey: (secretKey: TArg) => boolean; - /** Check whether a public key decodes to a valid point. */ - isValidPublicKey: (publicKey: TArg, isCompressed?: boolean) => boolean; - /** Generate a valid random secret key. */ - randomSecretKey: (seed?: TArg) => TRet; - }; - /** Byte lengths for keys and signatures exposed by this curve. */ - lengths: CurveLengths; -} - -/** - * ECDSA interface. - * Only supported for prime fields, not Fp2 (extension fields). - */ -export interface ECDSA extends ECDH { - /** - * Sign a message with the given secret key. - * @param message - Message bytes. - * @param secretKey - Secret key bytes. - * @param opts - Optional signing tweaks. See {@link ECDSASignOpts}. - * @returns Encoded signature bytes. - */ - sign: ( - message: TArg, - secretKey: TArg, - opts?: TArg - ) => TRet; - /** - * Verify a signature against a message and public key. - * @param signature - Encoded signature bytes. - * @param message - Message bytes. - * @param publicKey - Encoded public key. - * @param opts - Optional verification tweaks. See {@link ECDSAVerifyOpts}. - * @returns Whether the signature is valid. - */ - verify: ( - signature: TArg, - message: TArg, - publicKey: TArg, - opts?: TArg - ) => boolean; - /** - * Recover the public key encoded into a recoverable signature. - * @param signature - Recoverable signature bytes. - * @param message - Message bytes. - * @param opts - Optional recovery tweaks. See {@link ECDSARecoverOpts}. - * @returns Encoded recovered public key. - */ - recoverPublicKey( - signature: TArg, - message: TArg, - opts?: TArg - ): TRet; - /** Signature constructor and parser helpers. */ - Signature: ECDSASignatureCons; -} -/** - * @param m - Error message. - * @example - * Throw a DER-specific error when signature parsing encounters invalid bytes. - * - * ```ts - * new DERErr('bad der'); - * ``` - */ -export class DERErr extends Error { - constructor(m = '') { - super(m); - } -} -/** DER helper namespace used by ECDSA signature parsing and encoding. */ -export type IDER = { - // asn.1 DER encoding utils - /** - * DER-specific error constructor. - * @param m - Error message. - * @returns DER-specific error instance. - */ - Err: typeof DERErr; - // Basic building block is TLV (Tag-Length-Value) - /** Low-level tag-length-value helpers used by DER encoders. */ - _tlv: { - /** - * Encode one TLV record. - * @param tag - ASN.1 tag byte. - * @param data - Hex-encoded value payload. - * @returns Encoded TLV string. - */ - encode: (tag: number, data: string) => string; - // v - value, l - left bytes (unparsed) - /** - * Decode one TLV record and return the value plus leftover bytes. - * @param tag - Expected ASN.1 tag byte. - * @param data - Remaining DER bytes. - * @returns Parsed value plus leftover bytes. - */ - decode(tag: number, data: TArg): TRet<{ v: Uint8Array; l: Uint8Array }>; - }; - // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, - // since we always use positive integers here. It must always be empty: - // - add zero byte if exists - // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) - /** Positive-integer DER helpers used by ECDSA signature encoding. */ - _int: { - /** - * Encode one positive bigint as a DER INTEGER. - * @param num - Positive integer to encode. - * @returns Encoded DER INTEGER. - */ - encode(num: bigint): string; - /** - * Decode one DER INTEGER into a bigint. - * @param data - DER INTEGER bytes. - * @returns Decoded bigint. - */ - decode(data: TArg): bigint; - }; - /** - * Parse a DER signature into `{ r, s }`. - * @param bytes - DER signature bytes. - * @returns Parsed signature components. - */ - toSig(bytes: TArg): { r: bigint; s: bigint }; - /** - * Encode `{ r, s }` as a DER signature. - * @param sig - Signature components. - * @returns DER-encoded signature hex. - */ - hexFromSig(sig: { r: bigint; s: bigint }): string; -}; -/** - * ASN.1 DER encoding utilities. ASN is very complex & fragile. Format: - * - * [0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S] - * - * Docs: {@link https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/ | Let's Encrypt ASN.1 guide} and - * {@link https://luca.ntop.org/Teaching/Appunti/asn1.html | Luca Deri's ASN.1 notes}. - * @example - * ASN.1 DER encoding utilities. - * - * ```ts - * const der = DER.hexFromSig({ r: 1n, s: 2n }); - * ``` - */ -export const DER: IDER = { - // asn.1 DER encoding utils - Err: DERErr, - // Basic building block is TLV (Tag-Length-Value) - _tlv: { - encode: (tag: number, data: string): string => { - const { Err: E } = DER; - asafenumber(tag, 'tag'); - if (tag < 0 || tag > 255) throw new E('tlv.encode: wrong tag'); - if (typeof data !== 'string') - throw new TypeError('"data" expected string, got type=' + typeof data); - // Internal helper: callers hand this already-validated hex payload, so we only enforce - // byte alignment here instead of re-validating every nibble. - if (data.length & 1) throw new E('tlv.encode: unpadded data'); - const dataLen = data.length / 2; - const len = numberToHexUnpadded(dataLen); - if ((len.length / 2) & 0b1000_0000) throw new E('tlv.encode: long form length too big'); - // length of length with long form flag - const lenLen = dataLen > 127 ? numberToHexUnpadded((len.length / 2) | 0b1000_0000) : ''; - const t = numberToHexUnpadded(tag); - return t + lenLen + len + data; - }, - // v - value, l - left bytes (unparsed) - decode(tag: number, data: TArg): TRet<{ v: Uint8Array; l: Uint8Array }> { - const { Err: E } = DER; - data = abytes(data, undefined, 'DER data'); - let pos = 0; - if (tag < 0 || tag > 255) throw new E('tlv.encode: wrong tag'); - if (data.length < 2 || data[pos++] !== tag) throw new E('tlv.decode: wrong tlv'); - const first = data[pos++]; - // First bit of first length byte is the short/long form flag. - const isLong = !!(first & 0b1000_0000); - let length = 0; - if (!isLong) length = first; - else { - // Long form: [longFlag(1bit), lengthLength(7bit), length (BE)] - const lenLen = first & 0b0111_1111; - if (!lenLen) throw new E('tlv.decode(long): indefinite length not supported'); - // This would overflow u32 in JS. - if (lenLen > 4) throw new E('tlv.decode(long): byte length is too big'); - const lengthBytes = data.subarray(pos, pos + lenLen); - if (lengthBytes.length !== lenLen) throw new E('tlv.decode: length bytes not complete'); - if (lengthBytes[0] === 0) throw new E('tlv.decode(long): zero leftmost byte'); - for (const b of lengthBytes) length = (length << 8) | b; - pos += lenLen; - if (length < 128) throw new E('tlv.decode(long): not minimal encoding'); - } - const v = data.subarray(pos, pos + length); - if (v.length !== length) throw new E('tlv.decode: wrong value length'); - return { v, l: data.subarray(pos + length) } as TRet<{ v: Uint8Array; l: Uint8Array }>; - }, - }, - // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, - // since we always use positive integers here. It must always be empty: - // - add zero byte if exists - // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) - _int: { - encode(num: bigint): string { - const { Err: E } = DER; - abignumber(num); - if (num < _0n) throw new E('integer: negative integers are not allowed'); - let hex = numberToHexUnpadded(num); - // Pad with zero byte if negative flag is present - if (Number.parseInt(hex[0], 16) & 0b1000) hex = '00' + hex; - if (hex.length & 1) throw new E('unexpected DER parsing assertion: unpadded hex'); - return hex; - }, - decode(data: TArg): bigint { - const { Err: E } = DER; - if (data.length < 1) throw new E('invalid signature integer: empty'); - if (data[0] & 0b1000_0000) throw new E('invalid signature integer: negative'); - // Single-byte zero `00` is the canonical DER INTEGER encoding for zero. - if (data.length > 1 && data[0] === 0x00 && !(data[1] & 0b1000_0000)) - throw new E('invalid signature integer: unnecessary leading zero'); - return bytesToNumberBE(data); - }, - }, - toSig(bytes: TArg): { r: bigint; s: bigint } { - // parse DER signature - const { Err: E, _int: int, _tlv: tlv } = DER; - const data = abytes(bytes, undefined, 'signature'); - const { v: seqBytes, l: seqLeftBytes } = tlv.decode(0x30, data); - if (seqLeftBytes.length) throw new E('invalid signature: left bytes after parsing'); - const { v: rBytes, l: rLeftBytes } = tlv.decode(0x02, seqBytes); - const { v: sBytes, l: sLeftBytes } = tlv.decode(0x02, rLeftBytes); - if (sLeftBytes.length) throw new E('invalid signature: left bytes after parsing'); - return { r: int.decode(rBytes), s: int.decode(sBytes) }; - }, - hexFromSig(sig: { r: bigint; s: bigint }): string { - const { _tlv: tlv, _int: int } = DER; - const rs = tlv.encode(0x02, int.encode(sig.r)); - const ss = tlv.encode(0x02, int.encode(sig.s)); - const seq = rs + ss; - return tlv.encode(0x30, seq); - }, -}; -Object.freeze(DER._tlv); -Object.freeze(DER._int); -Object.freeze(DER); - -// Be friendly to bad ECMAScript parsers by not using bigint literals -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3), _4n = /* @__PURE__ */ BigInt(4); - -/** - * Creates weierstrass Point constructor, based on specified curve options. - * - * See {@link WeierstrassOpts}. - * @param params - Curve parameters. See {@link WeierstrassOpts}. - * @param extraOpts - Optional helpers and overrides. See {@link WeierstrassExtraOpts}. - * @returns Weierstrass point constructor. - * @throws If the curve parameters, overrides, or point codecs are invalid. {@link Error} - * - * @example - * Construct a point type from explicit Weierstrass curve parameters. - * - * ```js - * const opts = { - * p: 0xfffffffffffffffffffffffffffffffeffffac73n, - * n: 0x100000000000000000001b8fa16dfab9aca16b6b3n, - * h: 1n, - * a: 0n, - * b: 7n, - * Gx: 0x3b4c382ce37aa192a4019e763036f4f5dd4d7ebbn, - * Gy: 0x938cf935318fdced6bc28286531733c3f03c4feen, - * }; - * const secp160k1_Point = weierstrass(opts); - * ``` - */ -export function weierstrass( - params: WeierstrassOpts, - extraOpts: WeierstrassExtraOpts = {} -): WeierstrassPointCons { - const validated = createCurveFields('weierstrass', params, extraOpts); - const Fp = validated.Fp as IField; - const Fn = validated.Fn as IField; - let CURVE = validated.CURVE as WeierstrassOpts; - const { h: cofactor, n: CURVE_ORDER } = CURVE; - validateObject( - extraOpts, - {}, - { - allowInfinityPoint: 'boolean', - clearCofactor: 'function', - isTorsionFree: 'function', - fromBytes: 'function', - toBytes: 'function', - endo: 'object', - } - ); - - // Snapshot constructor-time flags whose later mutation would otherwise change - // validity semantics of an already-built point type. - const { endo, allowInfinityPoint } = extraOpts; - if (endo) { - // validateObject(endo, { beta: 'bigint', splitScalar: 'function' }); - if (!Fp.is0(CURVE.a) || typeof endo.beta !== 'bigint' || !Array.isArray(endo.basises)) { - throw new Error('invalid endo: expected "beta": bigint and "basises": array'); - } - } - - const lengths = getWLengths(Fp as TArg>, Fn); - - function assertCompressionIsSupported() { - if (!Fp.isOdd) throw new Error('compression is not supported: Field does not have .isOdd()'); - } - - // Implements IEEE P1363 point encoding - function pointToBytes( - _c: WeierstrassPointCons, - point: WeierstrassPoint, - isCompressed: boolean - ): TRet { - // SEC 1 v2.0 §2.3.3 encodes infinity as the single octet 0x00. Only curves - // that opt into infinity as a public point value should expose that byte form. - if (allowInfinityPoint && point.is0()) return Uint8Array.of(0) as TRet; - const { x, y } = point.toAffine(); - const bx = Fp.toBytes(x); - abool(isCompressed, 'isCompressed'); - if (isCompressed) { - assertCompressionIsSupported(); - const hasEvenY = !Fp.isOdd!(y); - return concatBytes(pprefix(hasEvenY), bx) as TRet; - } else { - return concatBytes(Uint8Array.of(0x04), bx, Fp.toBytes(y)) as TRet; - } - } - function pointFromBytes(bytes: TArg) { - abytes(bytes, undefined, 'Point'); - const { publicKey: comp, publicKeyUncompressed: uncomp } = lengths; // e.g. for 32-byte: 33, 65 - const length = bytes.length; - const head = bytes[0]; - const tail = bytes.subarray(1); - if (allowInfinityPoint && length === 1 && head === 0x00) return { x: Fp.ZERO, y: Fp.ZERO }; - // SEC 1 v2.0 §2.3.4 decodes 0x00 as infinity, but §3.2.2 public-key validation - // rejects infinity. We therefore keep 0x00 rejected by default because callers - // reuse this parser as the strict public-key boundary, and only admit it when - // the curve explicitly opts into infinity as a public point value. secp256k1 - // crosstests show OpenSSL raw point codecs accept 0x00 too. - // No actual validation is done here: use .assertValidity() - if (length === comp && (head === 0x02 || head === 0x03)) { - const x = Fp.fromBytes(tail); - if (!Fp.isValid(x)) throw new Error('bad point: is not on curve, wrong x'); - const y2 = weierstrassEquation(x); // y² = x³ + ax + b - let y: T; - try { - y = Fp.sqrt(y2); // y = y² ^ (p+1)/4 - } catch (sqrtError) { - const err = sqrtError instanceof Error ? ': ' + sqrtError.message : ''; - throw new Error('bad point: is not on curve, sqrt error' + err); - } - assertCompressionIsSupported(); - const evenY = Fp.isOdd!(y); - const evenH = (head & 1) === 1; // ECDSA-specific - if (evenH !== evenY) y = Fp.neg(y); - return { x, y }; - } else if (length === uncomp && head === 0x04) { - // TODO: more checks - const L = Fp.BYTES; - const x = Fp.fromBytes(tail.subarray(0, L)); - const y = Fp.fromBytes(tail.subarray(L, L * 2)); - if (!isValidXY(x, y)) throw new Error('bad point: is not on curve'); - return { x, y }; - } else { - throw new Error( - `bad point: got length ${length}, expected compressed=${comp} or uncompressed=${uncomp}` - ); - } - } - - const encodePoint = extraOpts.toBytes === undefined ? pointToBytes : extraOpts.toBytes; - const decodePoint = extraOpts.fromBytes === undefined ? pointFromBytes : extraOpts.fromBytes; - function weierstrassEquation(x: T): T { - const x2 = Fp.sqr(x); // x * x - const x3 = Fp.mul(x2, x); // x² * x - return Fp.add(Fp.add(x3, Fp.mul(x, CURVE.a)), CURVE.b); // x³ + a * x + b - } - - // TODO: move top-level - /** Checks whether equation holds for given x, y: y² == x³ + ax + b */ - function isValidXY(x: T, y: T): boolean { - const left = Fp.sqr(y); // y² - const right = weierstrassEquation(x); // x³ + ax + b - return Fp.eql(left, right); - } - - // Keep constructor-time generator validation cheap: callers are responsible for supplying the - // correct prime-order base point, while eager subgroup checks here would slow heavy module imports. - // Test 1: equation y² = x³ + ax + b should work for generator point. - if (!isValidXY(CURVE.Gx, CURVE.Gy)) throw new Error('bad curve params: generator point'); - - // Test 2: discriminant Δ part should be non-zero: 4a³ + 27b² != 0. - // Guarantees curve is genus-1, smooth (non-singular). - const _4a3 = Fp.mul(Fp.pow(CURVE.a, _3n), _4n); - const _27b2 = Fp.mul(Fp.sqr(CURVE.b), BigInt(27)); - if (Fp.is0(Fp.add(_4a3, _27b2))) throw new Error('bad curve params: a or b'); - - /** Asserts coordinate is valid: 0 <= n < Fp.ORDER. */ - function acoord(title: string, n: T, banZero = false) { - if (!Fp.isValid(n) || (banZero && Fp.is0(n))) throw new Error(`bad point coordinate ${title}`); - return n; - } - - function aprjpoint(other: unknown): asserts other is Point { - if (!(other instanceof Point)) throw new Error('Weierstrass Point expected'); - } - - function splitEndoScalarN(k: bigint) { - if (!endo || !endo.basises) throw new Error('no endo'); - return _splitEndoScalar(k, endo.basises, Fn.ORDER); - } - - function finishEndo( - endoBeta: EndomorphismOpts['beta'], - k1p: Point, - k2p: Point, - k1neg: boolean, - k2neg: boolean - ) { - k2p = new Point(Fp.mul(k2p.X, endoBeta), k2p.Y, k2p.Z); - k1p = negateCt(k1neg, k1p); - k2p = negateCt(k2neg, k2p); - return k1p.add(k2p); - } - - /** - * Projective Point works in 3d / projective (homogeneous) coordinates:(X, Y, Z) ∋ (x=X/Z, y=Y/Z). - * Default Point works in 2d / affine coordinates: (x, y). - * We're doing calculations in projective, because its operations don't require costly inversion. - */ - class Point implements WeierstrassPoint { - // base / generator point - static readonly BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); - // zero / infinity / identity point - static readonly ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0 - // math field - static readonly Fp = Fp; - // scalar field - static readonly Fn = Fn; - - readonly X: T; - readonly Y: T; - readonly Z: T; - - /** Does NOT validate if the point is valid. Use `.assertValidity()`. */ - constructor(X: T, Y: T, Z: T) { - this.X = acoord('x', X); - // This is not just about ZERO / infinity: ambient curves can have real - // finite points with y=0. Those points are 2-torsion, so they cannot lie - // in the odd prime-order subgroups this point type is meant to represent. - this.Y = acoord('y', Y, true); - this.Z = acoord('z', Z); - Object.freeze(this); - } - - static CURVE(): WeierstrassOpts { - return CURVE; - } - - /** Does NOT validate if the point is valid. Use `.assertValidity()`. */ - static fromAffine(p: AffinePoint): Point { - const { x, y } = p || {}; - if (!p || !Fp.isValid(x) || !Fp.isValid(y)) throw new Error('invalid affine point'); - if (p instanceof Point) throw new Error('projective point not allowed'); - // (0, 0) would've produced (0, 0, 1) - instead, we need (0, 1, 0) - if (Fp.is0(x) && Fp.is0(y)) return Point.ZERO; - return new Point(x, y, Fp.ONE); - } - - static fromBytes(bytes: TArg): Point { - const P = Point.fromAffine(decodePoint(abytes(bytes, undefined, 'point'))); - P.assertValidity(); - return P; - } - - static fromHex(hex: string): Point { - return Point.fromBytes(hexToBytes(hex)); - } - - get x(): T { - return this.toAffine().x; - } - get y(): T { - return this.toAffine().y; - } - - /** - * - * @param windowSize - * @param isLazy - true will defer table computation until the first multiplication - * @returns - */ - precompute(windowSize: number = 8, isLazy = true): Point { - wnaf.createCache(this, windowSize); - if (!isLazy) this.multiply(_3n); // random number - return this; - } - - // TODO: return `this` - /** A point on curve is valid if it conforms to equation. */ - assertValidity(): void { - const p = this; - if (p.is0()) { - // (0, 1, 0) aka ZERO is invalid in most contexts. - // In BLS, ZERO can be serialized, so we allow it. - // Keep the accepted infinity encoding canonical: projective-equivalent (X, Y, 0) points - // like (1, 1, 0) compare equal to ZERO, but only (0, 1, 0) should pass this guard. - if (extraOpts.allowInfinityPoint && Fp.is0(p.X) && Fp.eql(p.Y, Fp.ONE) && Fp.is0(p.Z)) - return; - throw new Error('bad point: ZERO'); - } - // Some 3rd-party test vectors require different wording between here & `fromCompressedHex` - const { x, y } = p.toAffine(); - if (!Fp.isValid(x) || !Fp.isValid(y)) throw new Error('bad point: x or y not field elements'); - if (!isValidXY(x, y)) throw new Error('bad point: equation left != right'); - if (!p.isTorsionFree()) throw new Error('bad point: not in prime-order subgroup'); - } - - hasEvenY(): boolean { - const { y } = this.toAffine(); - if (!Fp.isOdd) throw new Error("Field doesn't support isOdd"); - return !Fp.isOdd(y); - } - - /** Compare one point to another. */ - equals(other: WeierstrassPoint): boolean { - aprjpoint(other); - const { X: X1, Y: Y1, Z: Z1 } = this; - const { X: X2, Y: Y2, Z: Z2 } = other; - const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1)); - const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1)); - return U1 && U2; - } - - /** Flips point to one corresponding to (x, -y) in Affine coordinates. */ - negate(): Point { - return new Point(this.X, Fp.neg(this.Y), this.Z); - } - - // Renes-Costello-Batina exception-free doubling formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 3 - // Cost: 8M + 3S + 3*a + 2*b3 + 15add. - double() { - const { a, b } = CURVE; - const b3 = Fp.mul(b, _3n); - const { X: X1, Y: Y1, Z: Z1 } = this; - let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore - let t0 = Fp.mul(X1, X1); // step 1 - let t1 = Fp.mul(Y1, Y1); - let t2 = Fp.mul(Z1, Z1); - let t3 = Fp.mul(X1, Y1); - t3 = Fp.add(t3, t3); // step 5 - Z3 = Fp.mul(X1, Z1); - Z3 = Fp.add(Z3, Z3); - X3 = Fp.mul(a, Z3); - Y3 = Fp.mul(b3, t2); - Y3 = Fp.add(X3, Y3); // step 10 - X3 = Fp.sub(t1, Y3); - Y3 = Fp.add(t1, Y3); - Y3 = Fp.mul(X3, Y3); - X3 = Fp.mul(t3, X3); - Z3 = Fp.mul(b3, Z3); // step 15 - t2 = Fp.mul(a, t2); - t3 = Fp.sub(t0, t2); - t3 = Fp.mul(a, t3); - t3 = Fp.add(t3, Z3); - Z3 = Fp.add(t0, t0); // step 20 - t0 = Fp.add(Z3, t0); - t0 = Fp.add(t0, t2); - t0 = Fp.mul(t0, t3); - Y3 = Fp.add(Y3, t0); - t2 = Fp.mul(Y1, Z1); // step 25 - t2 = Fp.add(t2, t2); - t0 = Fp.mul(t2, t3); - X3 = Fp.sub(X3, t0); - Z3 = Fp.mul(t2, t1); - Z3 = Fp.add(Z3, Z3); // step 30 - Z3 = Fp.add(Z3, Z3); - return new Point(X3, Y3, Z3); - } - - // Renes-Costello-Batina exception-free addition formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 1 - // Cost: 12M + 0S + 3*a + 3*b3 + 23add. - add(other: WeierstrassPoint): Point { - aprjpoint(other); - const { X: X1, Y: Y1, Z: Z1 } = this; - const { X: X2, Y: Y2, Z: Z2 } = other; - let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore - const a = CURVE.a; - const b3 = Fp.mul(CURVE.b, _3n); - let t0 = Fp.mul(X1, X2); // step 1 - let t1 = Fp.mul(Y1, Y2); - let t2 = Fp.mul(Z1, Z2); - let t3 = Fp.add(X1, Y1); - let t4 = Fp.add(X2, Y2); // step 5 - t3 = Fp.mul(t3, t4); - t4 = Fp.add(t0, t1); - t3 = Fp.sub(t3, t4); - t4 = Fp.add(X1, Z1); - let t5 = Fp.add(X2, Z2); // step 10 - t4 = Fp.mul(t4, t5); - t5 = Fp.add(t0, t2); - t4 = Fp.sub(t4, t5); - t5 = Fp.add(Y1, Z1); - X3 = Fp.add(Y2, Z2); // step 15 - t5 = Fp.mul(t5, X3); - X3 = Fp.add(t1, t2); - t5 = Fp.sub(t5, X3); - Z3 = Fp.mul(a, t4); - X3 = Fp.mul(b3, t2); // step 20 - Z3 = Fp.add(X3, Z3); - X3 = Fp.sub(t1, Z3); - Z3 = Fp.add(t1, Z3); - Y3 = Fp.mul(X3, Z3); - t1 = Fp.add(t0, t0); // step 25 - t1 = Fp.add(t1, t0); - t2 = Fp.mul(a, t2); - t4 = Fp.mul(b3, t4); - t1 = Fp.add(t1, t2); - t2 = Fp.sub(t0, t2); // step 30 - t2 = Fp.mul(a, t2); - t4 = Fp.add(t4, t2); - t0 = Fp.mul(t1, t4); - Y3 = Fp.add(Y3, t0); - t0 = Fp.mul(t5, t4); // step 35 - X3 = Fp.mul(t3, X3); - X3 = Fp.sub(X3, t0); - t0 = Fp.mul(t3, t1); - Z3 = Fp.mul(t5, Z3); - Z3 = Fp.add(Z3, t0); // step 40 - return new Point(X3, Y3, Z3); - } - - subtract(other: WeierstrassPoint) { - // Validate before calling `negate()` so wrong inputs fail with the point guard - // instead of leaking a foreign `negate()` error. - aprjpoint(other); - return this.add(other.negate()); - } - - is0(): boolean { - return this.equals(Point.ZERO); - } - - /** - * Constant time multiplication. - * Uses wNAF method. Windowed method may be 10% faster, - * but takes 2x longer to generate and consumes 2x memory. - * Uses precomputes when available. - * Uses endomorphism for Koblitz curves. - * @param scalar - by which the point would be multiplied - * @returns New point - */ - multiply(scalar: bigint): Point { - const { endo } = extraOpts; - // Keep the subgroup-scalar contract strict instead of reducing 0 / n to ZERO. - // In key/signature-style callers, those values usually mean broken hash/scalar plumbing, - // and failing closed is safer than silently producing the identity point. - if (!Fn.isValidNot0(scalar)) throw new RangeError('invalid scalar: out of range'); // 0 is invalid - let point: Point, fake: Point; // Fake point is used to const-time mult - const mul = (n: bigint) => wnaf.cached(this, n, (p) => normalizeZ(Point, p)); - /** See docs for {@link EndomorphismOpts} */ - if (endo) { - const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(scalar); - const { p: k1p, f: k1f } = mul(k1); - const { p: k2p, f: k2f } = mul(k2); - fake = k1f.add(k2f); - point = finishEndo(endo.beta, k1p, k2p, k1neg, k2neg); - } else { - const { p, f } = mul(scalar); - point = p; - fake = f; - } - // Normalize `z` for both points, but return only real one - return normalizeZ(Point, [point, fake])[0]; - } - - /** - * Non-constant-time multiplication. Uses double-and-add algorithm. - * It's faster, but should only be used when you don't care about - * an exposed secret key e.g. sig verification, which works over *public* keys. - */ - multiplyUnsafe(scalar: bigint): Point { - const { endo } = extraOpts; - const p = this as Point; - const sc = scalar; - // Public-scalar callers may need 0, but n and larger values stay rejected here too. - // Reducing them mod n would turn bad caller input into an accidental identity point. - if (!Fn.isValid(sc)) throw new RangeError('invalid scalar: out of range'); // 0 is valid - if (sc === _0n || p.is0()) return Point.ZERO; // 0 - if (sc === _1n) return p; // 1 - if (wnaf.hasCache(this)) return this.multiply(sc); // precomputes - // We don't have method for double scalar multiplication (aP + bQ): - // Even with using Strauss-Shamir trick, it's 35% slower than naïve mul+add. - if (endo) { - const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(sc); - const { p1, p2 } = mulEndoUnsafe(Point, p, k1, k2); // 30% faster vs wnaf.unsafe - return finishEndo(endo.beta, p1, p2, k1neg, k2neg); - } else { - return wnaf.unsafe(p, sc); - } - } - - /** - * Converts Projective point to affine (x, y) coordinates. - * (X, Y, Z) ∋ (x=X/Z, y=Y/Z). - * @param invertedZ - Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch - */ - toAffine(invertedZ?: T): AffinePoint { - const p = this; - let iz = invertedZ; - const { X, Y, Z } = p; - // Fast-path for normalized points - if (Fp.eql(Z, Fp.ONE)) return { x: X, y: Y }; - const is0 = p.is0(); - // If invZ was 0, we return zero point. However we still want to execute - // all operations, so we replace invZ with a random number, 1. - if (iz == null) iz = is0 ? Fp.ONE : Fp.inv(Z); - const x = Fp.mul(X, iz); - const y = Fp.mul(Y, iz); - const zz = Fp.mul(Z, iz); - if (is0) return { x: Fp.ZERO, y: Fp.ZERO }; - if (!Fp.eql(zz, Fp.ONE)) throw new Error('invZ was invalid'); - return { x, y }; - } - - /** - * Checks whether Point is free of torsion elements (is in prime subgroup). - * Always torsion-free for cofactor=1 curves. - */ - isTorsionFree(): boolean { - const { isTorsionFree } = extraOpts; - if (cofactor === _1n) return true; - if (isTorsionFree) return isTorsionFree(Point, this); - return wnaf.unsafe(this, CURVE_ORDER).is0(); - } - - clearCofactor(): Point { - const { clearCofactor } = extraOpts; - if (cofactor === _1n) return this; // Fast-path - if (clearCofactor) return clearCofactor(Point, this) as Point; - // Default fallback assumes the cofactor fits the usual subgroup-scalar - // multiplyUnsafe() contract. Curves with larger / structured cofactors - // should define a clearCofactor override anyway (e.g. psi/Frobenius maps). - return this.multiplyUnsafe(cofactor); - } - - isSmallOrder(): boolean { - if (cofactor === _1n) return this.is0(); // Fast-path - return this.clearCofactor().is0(); - } - - toBytes(isCompressed = true): TRet { - abool(isCompressed, 'isCompressed'); - // Same policy as pointFromBytes(): keep ZERO out of the default byte surface because - // callers use these encodings as public keys, where SEC 1 validation rejects infinity. - this.assertValidity(); - return encodePoint(Point, this, isCompressed); - } - - toHex(isCompressed = true): string { - return bytesToHex(this.toBytes(isCompressed)); - } - - toString() { - return ``; - } - } - const bits = Fn.BITS; - const wnaf = new wNAF(Point, extraOpts.endo ? Math.ceil(bits / 2) : bits); - // Tiny toy curves can have scalar fields narrower than 8 bits. Skip the - // eager W=8 cache there instead of rejecting an otherwise valid constructor. - if (bits >= 8) Point.BASE.precompute(8); // Enable precomputes. Slows down first publicKey computation by 20ms. - Object.freeze(Point.prototype); - Object.freeze(Point); - return Point; -} - -/** Parsed ECDSA signature with helpers for recovery and re-encoding. */ -export interface ECDSASignature { - /** Signature component `r`. */ - readonly r: bigint; - /** Signature component `s`. */ - readonly s: bigint; - /** Optional recovery bit for recoverable signatures. */ - readonly recovery?: number; - /** - * Return a copy of the signature with a recovery bit attached. - * @param recovery - Recovery bit to attach. - * @returns Signature with an attached recovery bit. - */ - addRecoveryBit(recovery: number): ECDSASignature & { readonly recovery: number }; - /** - * Check whether the signature uses the high-S half-order. - * @returns Whether the signature uses the high-S half-order. - */ - hasHighS(): boolean; - /** - * Recover the public key from the hashed message and recovery bit. - * @param messageHash - Hashed message bytes. - * @returns Recovered public-key point. - */ - recoverPublicKey(messageHash: TArg): WeierstrassPoint; - /** - * Encode the signature into bytes. - * @param format - Signature encoding to produce. - * @returns Encoded signature bytes. - */ - toBytes(format?: string): TRet; - /** - * Encode the signature into hex. - * @param format - Signature encoding to produce. - * @returns Encoded signature hex. - */ - toHex(format?: string): string; -} -/** Constructor and decoding helpers for ECDSA signatures. */ -export type ECDSASignatureCons = { - /** Create a signature from `r`, `s`, and an optional recovery bit. */ - new (r: bigint, s: bigint, recovery?: number): ECDSASignature; - /** - * Decode a signature from bytes. - * @param bytes - Encoded signature bytes. - * @param format - Signature encoding to parse. - * @returns Parsed signature. - */ - fromBytes(bytes: TArg, format?: ECDSASignatureFormat): ECDSASignature; - /** - * Decode a signature from hex. - * @param hex - Encoded signature hex. - * @param format - Signature encoding to parse. - * @returns Parsed signature. - */ - fromHex(hex: string, format?: ECDSASignatureFormat): ECDSASignature; -}; - -// Points start with byte 0x02 when y is even; otherwise 0x03 -function pprefix(hasEvenY: boolean): TRet { - return Uint8Array.of(hasEvenY ? 0x02 : 0x03) as TRet; -} - -/** - * Implementation of the Shallue and van de Woestijne method for any weierstrass curve. - * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular. - * b = True and y = sqrt(u / v) if (u / v) is square in F, and - * b = False and y = sqrt(Z * (u / v)) otherwise. - * RFC 9380 expects callers to provide `v != 0`; this helper does not enforce it. - * @param Fp - Field implementation. - * @param Z - Simplified SWU map parameter. - * @returns Square-root ratio helper. - * @example - * Build the square-root ratio helper used by SWU map implementations. - * - * ```ts - * import { SWUFpSqrtRatio } from '@noble/curves/abstract/weierstrass.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const sqrtRatio = SWUFpSqrtRatio(Fp, 3n); - * const out = sqrtRatio(4n, 1n); - * ``` - */ -export function SWUFpSqrtRatio( - Fp: TArg>, - Z: T -): (u: T, v: T) => { isValid: boolean; value: T } { - // Fail with the usual field-shape error before touching pow/cmov on malformed field shims. - const F = validateField(Fp as IField) as IField; - // Generic implementation - const q = F.ORDER; - let l = _0n; - for (let o = q - _1n; o % _2n === _0n; o /= _2n) l += _1n; - const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1. - // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<. - // 2n ** c1 == 2n << (c1-1) - const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n); - const _2n_pow_c1 = _2n_pow_c1_1 * _2n; - const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic - const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic - const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic - const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic - const c6 = F.pow(Z, c2); // 6. c6 = Z^c2 - const c7 = F.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2) - // RFC 9380 Appendix F.2.1.1 defines sqrt_ratio(u, v) only for v != 0. - // We keep v=0 on the regular result path with isValid=false instead of - // throwing so the helper stays closer to the RFC's fixed control flow. - let sqrtRatio = (u: T, v: T): { isValid: boolean; value: T } => { - let tv1 = c6; // 1. tv1 = c6 - let tv2 = F.pow(v, c4); // 2. tv2 = v^c4 - let tv3 = F.sqr(tv2); // 3. tv3 = tv2^2 - tv3 = F.mul(tv3, v); // 4. tv3 = tv3 * v - let tv5 = F.mul(u, tv3); // 5. tv5 = u * tv3 - tv5 = F.pow(tv5, c3); // 6. tv5 = tv5^c3 - tv5 = F.mul(tv5, tv2); // 7. tv5 = tv5 * tv2 - tv2 = F.mul(tv5, v); // 8. tv2 = tv5 * v - tv3 = F.mul(tv5, u); // 9. tv3 = tv5 * u - let tv4 = F.mul(tv3, tv2); // 10. tv4 = tv3 * tv2 - tv5 = F.pow(tv4, c5); // 11. tv5 = tv4^c5 - let isQR = F.eql(tv5, F.ONE); // 12. isQR = tv5 == 1 - tv2 = F.mul(tv3, c7); // 13. tv2 = tv3 * c7 - tv5 = F.mul(tv4, tv1); // 14. tv5 = tv4 * tv1 - tv3 = F.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR) - tv4 = F.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR) - // 17. for i in (c1, c1 - 1, ..., 2): - for (let i = c1; i > _1n; i--) { - let tv5 = i - _2n; // 18. tv5 = i - 2 - tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5 - let tvv5 = F.pow(tv4, tv5); // 20. tv5 = tv4^tv5 - const e1 = F.eql(tvv5, F.ONE); // 21. e1 = tv5 == 1 - tv2 = F.mul(tv3, tv1); // 22. tv2 = tv3 * tv1 - tv1 = F.mul(tv1, tv1); // 23. tv1 = tv1 * tv1 - tvv5 = F.mul(tv4, tv1); // 24. tv5 = tv4 * tv1 - tv3 = F.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1) - tv4 = F.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1) - } - // RFC 9380 Appendix F.2.1.1 defines sqrt_ratio(u, v) for v != 0. - // When u = 0 and v != 0, u / v = 0 is square and the computed root is - // still 0, so widen only the final flag and keep the full control flow. - return { isValid: !F.is0(v) && (isQR || F.is0(u)), value: tv3 }; - }; - if (F.ORDER % _4n === _3n) { - // sqrt_ratio_3mod4(u, v) - const c1 = (F.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic - const c2 = F.sqrt(F.neg(Z)); // 2. c2 = sqrt(-Z) - sqrtRatio = (u: T, v: T) => { - let tv1 = F.sqr(v); // 1. tv1 = v^2 - const tv2 = F.mul(u, v); // 2. tv2 = u * v - tv1 = F.mul(tv1, tv2); // 3. tv1 = tv1 * tv2 - let y1 = F.pow(tv1, c1); // 4. y1 = tv1^c1 - y1 = F.mul(y1, tv2); // 5. y1 = y1 * tv2 - const y2 = F.mul(y1, c2); // 6. y2 = y1 * c2 - const tv3 = F.mul(F.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v - const isQR = F.eql(tv3, u); // 9. isQR = tv3 == u - let y = F.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR) - return { isValid: !F.is0(v) && isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2 - }; - } - // No curves uses that - // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8 - return sqrtRatio; -} -/** - * Simplified Shallue-van de Woestijne-Ulas Method - * See {@link https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2 | RFC 9380 section 6.6.2}. - * @param Fp - Field implementation. - * @param opts - SWU parameters: - * - `A`: Curve parameter `A`. - * - `B`: Curve parameter `B`. - * - `Z`: Simplified SWU map parameter. - * @returns Deterministic map-to-curve function. - * @throws If the SWU parameters are invalid or the field lacks the required helpers. {@link Error} - * @example - * Map one field element to a Weierstrass curve point with the SWU recipe. - * - * ```ts - * import { mapToCurveSimpleSWU } from '@noble/curves/abstract/weierstrass.js'; - * import { Field } from '@noble/curves/abstract/modular.js'; - * const Fp = Field(17n); - * const map = mapToCurveSimpleSWU(Fp, { A: 1n, B: 2n, Z: 3n }); - * const point = map(5n); - * ``` - */ -export function mapToCurveSimpleSWU( - Fp: TArg>, - opts: { - A: T; - B: T; - Z: T; - } -): (u: T) => { x: T; y: T } { - const F = validateField(Fp as IField) as IField; - const { A, B, Z } = opts; - if (!F.isValidNot0(A) || !F.isValidNot0(B) || !F.isValid(Z)) - throw new Error('mapToCurveSimpleSWU: invalid opts'); - // RFC 9380 §6.6.2 and Appendix H.2 require: - // 1. Z is non-square in F - // 2. Z != -1 in F - // 3. g(x) - Z is irreducible over F - // 4. g(B / (Z * A)) is square in F - // We can enforce 1, 2, and 4 with the current field API. - // Criterion 3 is not checked here because generic `IField` does not expose - // polynomial-ring / irreducibility operations, and this helper is used for - // both prime and extension fields. - if (F.eql(Z, F.neg(F.ONE)) || FpIsSquare(F, Z)) - throw new Error('mapToCurveSimpleSWU: invalid opts'); - // RFC 9380 Appendix H.2 criterion 4: g(B / (Z * A)) is square in F. - // x = B / (Z * A) - const x = F.mul(B, F.inv(F.mul(Z, A))); - // g(x) = x^3 + A*x + B - const gx = F.add(F.add(F.mul(F.sqr(x), x), F.mul(A, x)), B); - if (!FpIsSquare(F, gx)) throw new Error('mapToCurveSimpleSWU: invalid opts'); - const sqrtRatio = SWUFpSqrtRatio(F, Z); - if (!F.isOdd) throw new Error('Field does not have .isOdd()'); - // Input: u, an element of F. - // Output: (x, y), a point on E. - return (u: T): { x: T; y: T } => { - // prettier-ignore - let tv1, tv2, tv3, tv4, tv5, tv6, x, y; - tv1 = F.sqr(u); // 1. tv1 = u^2 - tv1 = F.mul(tv1, Z); // 2. tv1 = Z * tv1 - tv2 = F.sqr(tv1); // 3. tv2 = tv1^2 - tv2 = F.add(tv2, tv1); // 4. tv2 = tv2 + tv1 - tv3 = F.add(tv2, F.ONE); // 5. tv3 = tv2 + 1 - tv3 = F.mul(tv3, B); // 6. tv3 = B * tv3 - tv4 = F.cmov(Z, F.neg(tv2), !F.eql(tv2, F.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) - tv4 = F.mul(tv4, A); // 8. tv4 = A * tv4 - tv2 = F.sqr(tv3); // 9. tv2 = tv3^2 - tv6 = F.sqr(tv4); // 10. tv6 = tv4^2 - tv5 = F.mul(tv6, A); // 11. tv5 = A * tv6 - tv2 = F.add(tv2, tv5); // 12. tv2 = tv2 + tv5 - tv2 = F.mul(tv2, tv3); // 13. tv2 = tv2 * tv3 - tv6 = F.mul(tv6, tv4); // 14. tv6 = tv6 * tv4 - tv5 = F.mul(tv6, B); // 15. tv5 = B * tv6 - tv2 = F.add(tv2, tv5); // 16. tv2 = tv2 + tv5 - x = F.mul(tv1, tv3); // 17. x = tv1 * tv3 - const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) - y = F.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1 - y = F.mul(y, value); // 20. y = y * y1 - x = F.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square) - y = F.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square) - const e1 = F.isOdd!(u) === F.isOdd!(y); // 23. e1 = sgn0(u) == sgn0(y) - y = F.cmov(F.neg(y), y, e1); // 24. y = CMOV(-y, y, e1) - const tv4_inv = FpInvertBatch(F, [tv4], true)[0]; - x = F.mul(x, tv4_inv); // 25. x = x / tv4 - return { x, y }; - }; -} - -function getWLengths(Fp: TArg>, Fn: TArg>) { - return { - secretKey: Fn.BYTES, - publicKey: 1 + Fp.BYTES, - publicKeyUncompressed: 1 + 2 * Fp.BYTES, - publicKeyHasPrefix: true, - // Raw compact `(r || s)` signature width; DER and recovered signatures use - // different lengths outside this helper. - signature: 2 * Fn.BYTES, - }; -} - -/** - * Sometimes users only need getPublicKey, getSharedSecret, and secret key handling. - * This helper ensures no signature functionality is present. Less code, smaller bundle size. - * @param Point - Weierstrass point constructor. - * @param ecdhOpts - Optional randomness helpers: - * - `randomBytes` (optional): Optional RNG override. - * @returns ECDH helper namespace. - * @example - * Sometimes users only need getPublicKey, getSharedSecret, and secret key handling. - * - * ```ts - * import { ecdh } from '@noble/curves/abstract/weierstrass.js'; - * import { p256 } from '@noble/curves/nist.js'; - * const dh = ecdh(p256.Point); - * const alice = dh.keygen(); - * const shared = dh.getSharedSecret(alice.secretKey, alice.publicKey); - * ``` - */ -export function ecdh( - Point: WeierstrassPointCons, - ecdhOpts: TArg<{ randomBytes?: (bytesLength?: number) => TRet }> = {} -): ECDH { - const { Fn } = Point; - const randomBytes_ = ecdhOpts.randomBytes === undefined ? wcRandomBytes : ecdhOpts.randomBytes; - // Keep the advertised seed length aligned with mapHashToField(), which keeps a hard 16-byte - // minimum even on toy curves. - const lengths = Object.assign(getWLengths(Point.Fp, Fn), { - seed: Math.max(getMinHashLength(Fn.ORDER), 16), - }); - - function isValidSecretKey(secretKey: TArg) { - try { - const num = Fn.fromBytes(secretKey); - return Fn.isValidNot0(num); - } catch (error) { - return false; - } - } - - function isValidPublicKey(publicKey: TArg, isCompressed?: boolean): boolean { - const { publicKey: comp, publicKeyUncompressed } = lengths; - try { - const l = publicKey.length; - if (isCompressed === true && l !== comp) return false; - if (isCompressed === false && l !== publicKeyUncompressed) return false; - return !!Point.fromBytes(publicKey); - } catch (error) { - return false; - } - } - - /** - * Produces cryptographically secure secret key from random of size - * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. - */ - function randomSecretKey(seed?: TArg): TRet { - seed = seed === undefined ? randomBytes_(lengths.seed) : seed; - return mapHashToField(abytes(seed, lengths.seed, 'seed'), Fn.ORDER) as TRet; - } - - /** - * Computes public key for a secret key. Checks for validity of the secret key. - * @param isCompressed - whether to return compact (default), or full key - * @returns Public key, full when isCompressed=false; short when isCompressed=true - */ - function getPublicKey(secretKey: TArg, isCompressed = true): TRet { - return Point.BASE.multiply(Fn.fromBytes(secretKey)).toBytes(isCompressed); - } - - /** - * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. - */ - function isProbPub(item: TArg): boolean | undefined { - const { secretKey, publicKey, publicKeyUncompressed } = lengths; - const allowedLengths = (Fn as { _lengths?: readonly number[] })._lengths; - if (!isBytes(item)) return undefined; - const l = abytes(item, undefined, 'key').length; - const isPub = l === publicKey || l === publicKeyUncompressed; - const isSec = l === secretKey || !!allowedLengths?.includes(l); - // P-521 accepts both 65- and 66-byte secret keys, so overlapping lengths stay ambiguous. - if (isPub && isSec) return undefined; - return isPub; - } - - /** - * ECDH (Elliptic Curve Diffie Hellman). - * Computes encoded shared point from secret key A and public key B. - * Checks: 1) secret key validity 2) shared key is on-curve. - * Does NOT hash the result or expose the SEC 1 x-coordinate-only `z`. - * Returns the encoded shared point on purpose: callers that need `x_P` - * can derive it from the encoded point, but `x_P` alone cannot recover the - * point/parity back. - * This helper only exposes the fully validated public-key path, not cofactor DH. - * @param isCompressed - whether to return compact (default), or full key - * @returns shared point encoding - */ - function getSharedSecret( - secretKeyA: TArg, - publicKeyB: TArg, - isCompressed = true - ): TRet { - if (isProbPub(secretKeyA) === true) throw new Error('first arg must be private key'); - if (isProbPub(publicKeyB) === false) throw new Error('second arg must be public key'); - const s = Fn.fromBytes(secretKeyA); - const b = Point.fromBytes(publicKeyB); // checks for being on-curve - return b.multiply(s).toBytes(isCompressed); - } - - const utils = { - isValidSecretKey, - isValidPublicKey, - randomSecretKey, - }; - const keygen = createKeygen(randomSecretKey, getPublicKey); - Object.freeze(utils); - Object.freeze(lengths); - - return Object.freeze({ getPublicKey, getSharedSecret, keygen, Point, utils, lengths }); -} - -/** - * Creates ECDSA signing interface for given elliptic curve `Point` and `hash` function. - * - * @param Point - created using {@link weierstrass} function - * @param hash - used for 1) message prehash-ing 2) k generation in `sign`, using hmac_drbg(hash) - * @param ecdsaOpts - rarely needed, see {@link ECDSAOpts}: - * - `lowS`: Default low-S policy. - * - `hmac`: HMAC implementation used by RFC6979 DRBG. - * - `randomBytes`: Optional RNG override. - * - `bits2int`: Optional hash-to-int conversion override. - * - `bits2int_modN`: Optional hash-to-int-mod-n conversion override. - * - * @returns ECDSA helper namespace. - * @example - * Create an ECDSA signer/verifier bundle for one curve implementation. - * - * ```ts - * import { ecdsa } from '@noble/curves/abstract/weierstrass.js'; - * import { p256 } from '@noble/curves/nist.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const p256ecdsa = ecdsa(p256.Point, sha256); - * const { secretKey, publicKey } = p256ecdsa.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p256ecdsa.sign(msg, secretKey); - * const isValid = p256ecdsa.verify(sig, msg, publicKey); - * ``` - */ -export function ecdsa( - Point: WeierstrassPointCons, - hash: TArg, - ecdsaOpts: TArg = {} -): ECDSA { - // Custom hash / bits2int hooks are treated as pure functions over validated caller-owned bytes. - const hash_ = hash as CHash; - ahash(hash_); - validateObject( - ecdsaOpts, - {}, - { - hmac: 'function', - lowS: 'boolean', - randomBytes: 'function', - bits2int: 'function', - bits2int_modN: 'function', - } - ); - ecdsaOpts = Object.assign({}, ecdsaOpts); - const randomBytes = ecdsaOpts.randomBytes === undefined ? wcRandomBytes : ecdsaOpts.randomBytes; - const hmac = - ecdsaOpts.hmac === undefined - ? (key: TArg, msg: TArg) => nobleHmac(hash_, key, msg) - : (ecdsaOpts.hmac as HmacFn); - - const { Fp, Fn } = Point; - const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn; - const { keygen, getPublicKey, getSharedSecret, utils, lengths } = ecdh(Point, ecdsaOpts); - const defaultSigOpts: Required = { - prehash: true, - lowS: typeof ecdsaOpts.lowS === 'boolean' ? ecdsaOpts.lowS : true, - format: 'compact' as ECDSASignatureFormat, - extraEntropy: false, - }; - // SEC 1 4.1.6 public-key recovery tries x = r + jn for j = 0..h. Our recovered-signature - // format only stores one overflow bit, so it can only distinguish q.x = r from q.x = r + n. - // A third lift would have the form q.x = r + 2n. Since valid ECDSA r is in 1..n-1, the - // smallest such lift is 1 + 2n, not 2n. - const hasLargeRecoveryLifts = CURVE_ORDER * _2n + _1n < Fp.ORDER; - - function isBiggerThanHalfOrder(number: bigint) { - const HALF = CURVE_ORDER >> _1n; - return number > HALF; - } - function validateRS(title: string, num: bigint): bigint { - if (!Fn.isValidNot0(num)) - throw new Error(`invalid signature ${title}: out of range 1..Point.Fn.ORDER`); - return num; - } - function assertRecoverableCurve(): void { - // ECDSA recovery only supports curves where the current recovery id can distinguish - // q.x = r and q.x = r + n; larger lifts may need additional `r + n*i` branches. - // SEC 1 4.1.6 recovers candidates via x = r + jn, but this format only encodes j = 0 or 1. - // The next possible candidate is q.x = r + 2n, and its smallest valid value is 1 + 2n. - // To easily get i, we either need to: - // a. increase amount of valid recid values (4, 5...); OR - // b. prohibit recovered signatures for those curves. - if (hasLargeRecoveryLifts) - throw new Error('"recovered" sig type is not supported for cofactor >2 curves'); - } - function validateSigLength(bytes: TArg, format: ECDSASignatureFormat) { - validateSigFormat(format); - const size = lengths.signature!; - const sizer = format === 'compact' ? size : format === 'recovered' ? size + 1 : undefined; - return abytes(bytes, sizer); - } - - /** - * ECDSA signature with its (r, s) properties. Supports compact, recovered & DER representations. - */ - class Signature implements ECDSASignature { - readonly r: bigint; - readonly s: bigint; - readonly recovery?: number; - - constructor(r: bigint, s: bigint, recovery?: number) { - this.r = validateRS('r', r); // r in [1..N-1]; - this.s = validateRS('s', s); // s in [1..N-1]; - if (recovery != null) { - assertRecoverableCurve(); - if (![0, 1, 2, 3].includes(recovery)) throw new Error('invalid recovery id'); - this.recovery = recovery; - } - Object.freeze(this); - } - - static fromBytes( - bytes: TArg, - format: ECDSASignatureFormat = defaultSigOpts.format - ): Signature { - validateSigLength(bytes, format); - let recid: number | undefined; - if (format === 'der') { - const { r, s } = DER.toSig(abytes(bytes)); - return new Signature(r, s); - } - if (format === 'recovered') { - recid = bytes[0]; - format = 'compact'; - bytes = bytes.subarray(1); - } - const L = lengths.signature! / 2; - const r = bytes.subarray(0, L); - const s = bytes.subarray(L, L * 2); - return new Signature(Fn.fromBytes(r), Fn.fromBytes(s), recid); - } - - static fromHex(hex: string, format?: ECDSASignatureFormat) { - return this.fromBytes(hexToBytes(hex), format); - } - - private assertRecovery(): number { - const { recovery } = this; - if (recovery == null) throw new Error('invalid recovery id: must be present'); - return recovery; - } - - addRecoveryBit(recovery: number): RecoveredSignature { - return new Signature(this.r, this.s, recovery) as RecoveredSignature; - } - - // Unlike the top-level helper below, this method expects a digest that has - // already been hashed to the curve's message representative. - recoverPublicKey(messageHash: TArg): WeierstrassPoint { - const { r, s } = this; - const recovery = this.assertRecovery(); - const radj = recovery === 2 || recovery === 3 ? r + CURVE_ORDER : r; - if (!Fp.isValid(radj)) throw new Error('invalid recovery id: sig.r+curve.n != R.x'); - const x = Fp.toBytes(radj); - const R = Point.fromBytes(concatBytes(pprefix((recovery & 1) === 0), x)); - const ir = Fn.inv(radj); // r^-1 - const h = bits2int_modN(abytes(messageHash, undefined, 'msgHash')); // Truncate hash - const u1 = Fn.create(-h * ir); // -hr^-1 - const u2 = Fn.create(s * ir); // sr^-1 - // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1). unsafe is fine: there is no private data. - const Q = Point.BASE.multiplyUnsafe(u1).add(R.multiplyUnsafe(u2)); - if (Q.is0()) throw new Error('invalid recovery: point at infinify'); - Q.assertValidity(); - return Q; - } - - // Signatures should be low-s, to prevent malleability. - hasHighS(): boolean { - return isBiggerThanHalfOrder(this.s); - } - - toBytes(format: ECDSASignatureFormat = defaultSigOpts.format): TRet { - validateSigFormat(format); - if (format === 'der') return hexToBytes(DER.hexFromSig(this)) as TRet; - const { r, s } = this; - const rb = Fn.toBytes(r); - const sb = Fn.toBytes(s); - if (format === 'recovered') { - assertRecoverableCurve(); - return concatBytes(Uint8Array.of(this.assertRecovery()), rb, sb) as TRet; - } - return concatBytes(rb, sb) as TRet; - } - - toHex(format?: ECDSASignatureFormat) { - return bytesToHex(this.toBytes(format)); - } - } - type RecoveredSignature = Signature & { recovery: number }; - Object.freeze(Signature.prototype); - Object.freeze(Signature); - - // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets. - // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int. - // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same. - // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors - const bits2int: (bytes: TArg) => bigint = - ecdsaOpts.bits2int === undefined - ? function bits2int_def(bytes: TArg): bigint { - // Our custom check "just in case", for protection against DoS - if (bytes.length > 8192) throw new Error('input is too large'); - // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m) - // for some cases, since bytes.length * 8 is not actual bitLength. - const num = bytesToNumberBE(bytes); // check for == u8 done here - const delta = bytes.length * 8 - fnBits; // truncate to nBitLength leftmost bits - return delta > 0 ? num >> BigInt(delta) : num; - } - : (ecdsaOpts.bits2int as (bytes: TArg) => bigint); - const bits2int_modN: (bytes: TArg) => bigint = - ecdsaOpts.bits2int_modN === undefined - ? function bits2int_modN_def(bytes: TArg): bigint { - return Fn.create(bits2int(bytes)); // can't use bytesToNumberBE here - } - : (ecdsaOpts.bits2int_modN as (bytes: TArg) => bigint); - const ORDER_MASK = bitMask(fnBits); - // Pads output with zero as per spec. - /** Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. */ - function int2octets(num: bigint): TRet { - aInRange('num < 2^' + fnBits, num, _0n, ORDER_MASK); - return Fn.toBytes(num) as TRet; - } - - function validateMsgAndHash(message: TArg, prehash: boolean): TRet { - abytes(message, undefined, 'message'); - return ( - prehash ? abytes(hash_(message), undefined, 'prehashed message') : message - ) as TRet; - } - - /** - * Steps A, D of RFC6979 3.2. - * Creates RFC6979 seed; converts msg/privKey to numbers. - * Used only in sign, not in verify. - * - * Warning: we cannot assume here that message has same amount of bytes as curve order, - * this will be invalid at least for P521. Also it can be bigger for P224 + SHA256. - */ - function prepSig( - message: TArg, - secretKey: TArg, - opts: TArg - ) { - const { lowS, prehash, extraEntropy } = validateSigOpts(opts, defaultSigOpts); - message = validateMsgAndHash(message, prehash); // RFC6979 3.2 A: h1 = H(m) - // We can't later call bits2octets, since nested bits2int is broken for curves - // with fnBits % 8 !== 0. Because of that, we unwrap it here as int2octets call. - // const bits2octets = (bits) => int2octets(bits2int_modN(bits)) - const h1int = bits2int_modN(message); - const d = Fn.fromBytes(secretKey); // validate secret key, convert to bigint - if (!Fn.isValidNot0(d)) throw new Error('invalid private key'); - const seedArgs: TArg[] = [int2octets(d), int2octets(h1int)]; - // extraEntropy. RFC6979 3.6: additional k' (optional). - if (extraEntropy != null && extraEntropy !== false) { - // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k') - // gen random bytes OR pass as-is - const e = extraEntropy === true ? randomBytes(lengths.secretKey) : extraEntropy; - seedArgs.push(abytes(e, undefined, 'extraEntropy')); // check for being bytes - } - const seed = concatBytes(...seedArgs) as TRet; // Step D of RFC6979 3.2 - const m = h1int; // no need to call bits2int second time here, it is inside truncateHash! - // Converts signature params into point w r/s, checks result for validity. - // To transform k => Signature: - // q = k⋅G - // r = q.x mod n - // s = k^-1(m + rd) mod n - // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to - // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it: - // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT - function k2sig(kBytes: TArg): Signature | undefined { - // RFC 6979 Section 3.2, step 3: k = bits2int(T) - // Important: all mod() calls here must be done over N - const k = bits2int(kBytes); // Cannot use fields methods, since it is group element - if (!Fn.isValidNot0(k)) return; // Valid scalars (including k) must be in 1..N-1 - const ik = Fn.inv(k); // k^-1 mod n - const q = Point.BASE.multiply(k).toAffine(); // q = k⋅G - const r = Fn.create(q.x); // r = q.x mod n - if (r === _0n) return; - const s = Fn.create(ik * Fn.create(m + r * d)); // s = k^-1(m + rd) mod n - if (s === _0n) return; - let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3 when q.x>n) - let normS = s; - if (lowS && isBiggerThanHalfOrder(s)) { - normS = Fn.neg(s); // if lowS was passed, ensure s is always in the bottom half of N - recovery ^= 1; - } - return new Signature(r, normS, hasLargeRecoveryLifts ? undefined : recovery); - } - return { seed, k2sig }; - } - - /** - * Signs a message or message hash with a secret key. - * With the default `prehash: true`, raw message bytes are hashed internally; - * only `{ prehash: false }` expects a caller-supplied digest. - * - * ``` - * sign(m, d) where - * k = rfc6979_hmac_drbg(m, d) - * (x, y) = G × k - * r = x mod n - * s = (m + dr) / k mod n - * ``` - */ - function sign( - message: TArg, - secretKey: TArg, - opts: TArg = {} - ): TRet { - const { seed, k2sig } = prepSig(message, secretKey, opts); // Steps A, D of RFC6979 3.2. - const drbg = createHmacDrbg(hash_.outputLen, Fn.BYTES, hmac); - const sig = drbg(seed, k2sig); // Steps B, C, D, E, F, G - return sig.toBytes(opts.format); - } - - /** - * Verifies a signature against message and public key. - * Rejects lowS signatures by default: see {@link ECDSAVerifyOpts}. - * Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf: - * - * ``` - * verify(r, s, h, P) where - * u1 = hs^-1 mod n - * u2 = rs^-1 mod n - * R = u1⋅G + u2⋅P - * mod(R.x, n) == r - * ``` - */ - function verify( - signature: TArg, - message: TArg, - publicKey: TArg, - opts: TArg = {} - ): boolean { - const { lowS, prehash, format } = validateSigOpts(opts, defaultSigOpts); - publicKey = abytes(publicKey, undefined, 'publicKey'); - message = validateMsgAndHash(message, prehash); - if (!isBytes(signature as any)) { - const end = signature instanceof Signature ? ', use sig.toBytes()' : ''; - throw new Error('verify expects Uint8Array signature' + end); - } - validateSigLength(signature, format); // execute this twice because we want loud error - try { - const sig = Signature.fromBytes(signature, format); - const P = Point.fromBytes(publicKey); - if (lowS && sig.hasHighS()) return false; - const { r, s } = sig; - const h = bits2int_modN(message); // mod n, not mod p - const is = Fn.inv(s); // s^-1 mod n - const u1 = Fn.create(h * is); // u1 = hs^-1 mod n - const u2 = Fn.create(r * is); // u2 = rs^-1 mod n - const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2)); // u1⋅G + u2⋅P - if (R.is0()) return false; - const v = Fn.create(R.x); // v = r.x mod n - return v === r; - } catch (e) { - return false; - } - } - - function recoverPublicKey( - signature: TArg, - message: TArg, - opts: TArg = {} - ): TRet { - // Top-level recovery mirrors `sign()` / `verify()`: it hashes raw message - // bytes first unless the caller passes `{ prehash: false }`. - const { prehash } = validateSigOpts(opts, defaultSigOpts); - message = validateMsgAndHash(message, prehash); - return Signature.fromBytes(signature, 'recovered').recoverPublicKey(message).toBytes(); - } - - return Object.freeze({ - keygen, - getPublicKey, - getSharedSecret, - utils, - lengths, - Point, - sign, - verify, - recoverPublicKey, - Signature, - hash: hash_, - }) satisfies Signer; -} diff --git a/node_modules/@noble/curves/src/bls12-381.ts b/node_modules/@noble/curves/src/bls12-381.ts deleted file mode 100644 index 457bd46..0000000 --- a/node_modules/@noble/curves/src/bls12-381.ts +++ /dev/null @@ -1,778 +0,0 @@ -/** - * bls12-381 is pairing-friendly Barreto-Lynn-Scott elliptic curve construction allowing to: - -* Construct zk-SNARKs at the ~120-bit security, as per [Barbulescu-Duquesne 2017](https://hal.science/hal-01534101/file/main.pdf) -* Efficiently verify N aggregate signatures with 1 pairing and N ec additions: -the Boneh-Lynn-Shacham signature scheme is orders of magnitude more efficient than Schnorr - -BLS can mean 2 different things: - -* Barreto-Lynn-Scott: BLS12, a Pairing Friendly Elliptic Curve -* Boneh-Lynn-Shacham: A Signature Scheme. - -### Summary - -1. BLS Relies on expensive bilinear pairing -2. Secret Keys: 32 bytes -3. Public Keys: 48 OR 96 bytes - big-endian x coordinate of point on G1 OR G2 curve -4. Signatures: 96 OR 48 bytes - big-endian x coordinate of point on G2 OR G1 curve -5. The 12 stands for the Embedding degree. - -Modes of operation: - -* Long signatures: 48-byte keys + 96-byte sigs (G1 keys + G2 sigs). -* Short signatures: 96-byte keys + 48-byte sigs (G2 keys + G1 sigs). - -### Formulas - -- `P = pk x G` - public keys -- `S = pk x H(m)` - signing, uses hash-to-curve on m -- `e(P, H(m)) == e(G, S)` - verification using pairings -- `e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si))` - signature aggregation - -### Curves - -G1 is ordinary elliptic curve. G2 is extension field curve, think "over complex numbers". - -- G1: y² = x³ + 4 -- G2: y² = x³ + 4(u + 1) where u = √−1; r-order subgroup of E'(Fp²), M-type twist - -### Towers - -Pairing G1 + G2 produces element in Fp₁₂, 12-degree polynomial. -Fp₁₂ is usually implemented using tower of lower-degree polynomials for speed. - -- Fp₁₂ = Fp₆² => Fp₂³ -- Fp(u) / (u² - β) where β = -1 -- Fp₂(v) / (v³ - ξ) where ξ = u + 1 -- Fp₆(w) / (w² - γ) where γ = v -- Fp²[u] = Fp/u²+1 -- Fp⁶[v] = Fp²/v³-1-u -- Fp¹²[w] = Fp⁶/w²-v - -### Params - -* Embedding degree (k): 12 -* Seed is sometimes named x or t -* t = -15132376222941642752 -* p = (t-1)² * (t⁴-t²+1)/3 + t -* r = t⁴-t²+1 -* Ate loop size: X - -To verify curve parameters, see -[pairing-friendly-curves spec](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-pairing-friendly-curves-11). -Basic math is done over finite fields over p. -More complicated math is done over polynominal extension fields. - -### Compatibility and notes -1. It is compatible with Algorand, Chia, Dfinity, Ethereum, Filecoin, ZEC. -Filecoin uses little endian byte arrays for secret keys - make sure to reverse byte order. -2. Make sure to correctly select mode: "long signature" or "short signature". -3. Compatible with specs: - RFC 9380, - [cfrg-pairing-friendly-curves-11](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-pairing-friendly-curves-11), - [cfrg-bls-signature-05](https://datatracker.ietf.org/doc/draft-irtf-cfrg-bls-signature/). - - * - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { sha256 } from '@noble/hashes/sha2.js'; -import { bls, type BlsCurvePairWithSignatures } from './abstract/bls.ts'; -import { Field, type IField } from './abstract/modular.ts'; -import { - abytes, - bitLen, - bitMask, - bytesToHex, - bytesToNumberBE, - concatBytes, - copyBytes, - hexToBytes, - numberToBytesBE, - randomBytes, - type TArg, - type TRet, -} from './utils.ts'; -// Types -import { isogenyMap } from './abstract/hash-to-curve.ts'; -import type { BigintTuple, Fp, Fp12, Fp2, Fp6 } from './abstract/tower.ts'; -import { psiFrobenius, tower12 } from './abstract/tower.ts'; -import { - mapToCurveSimpleSWU, - weierstrass, - type AffinePoint, - type WeierstrassOpts, - type WeierstrassPoint, - type WeierstrassPointCons, -} from './abstract/weierstrass.ts'; - -// Be friendly to bad ECMAScript parsers by not using bigint literals -// prettier-ignore -const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); - -// To verify math: -// https://tools.ietf.org/html/draft-irtf-cfrg-pairing-friendly-curves-11 - -// The BLS parameter x (seed) for BLS12-381. The stored constant is `|x|`; call -// sites that need the signed parameter apply the minus sign themselves. -// x = -2^63 - 2^62 - 2^60 - 2^57 - 2^48 - 2^16 -const BLS_X = BigInt('0xd201000000010000'); -// t = x (called differently in different places) -// const t = -BLS_X; -const BLS_X_LEN = bitLen(BLS_X); - -// a=0, b=4 -// P is characteristic of field Fp, in which curve calculations are done. -// p = (t-1)² * (t⁴-t²+1)/3 + t -// bls12_381_Fp = (t-1n)**2n * (t**4n - t**2n + 1n) / 3n + t -// r*h is curve order, amount of points on curve, -// where r is order of prime subgroup and h is cofactor. -// r = t⁴-t²+1 -// r = (t**4n - t**2n + 1n) -// cofactor h of G1: (t - 1)²/3, with the signed convention `t = -x` -// cofactorG1 = (t-1n)**2n/3n -// x = 3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507 -// y = 1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569 -const bls12_381_CURVE_G1: WeierstrassOpts = { - p: BigInt( - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab' - ), - n: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001'), - h: BigInt('0x396c8c005555e1568c00aaab0000aaab'), - a: _0n, - b: _4n, - Gx: BigInt( - '0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb' - ), - Gy: BigInt( - '0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1' - ), -}; - -// CURVE FIELDS -// r = z⁴ − z² + 1; CURVE.n from other curves -/** - * bls12-381 Fr (Fn) field. - * `fromBytes()` reduces modulo `q` instead of rejecting non-canonical encodings. - */ -export const bls12_381_Fr: TRet> = Field(bls12_381_CURVE_G1.n, { - modFromBytes: true, -}) as TRet>; -const { Fp, Fp2, Fp6, Fp12 } = tower12({ - ORDER: bls12_381_CURVE_G1.p, - X_LEN: BLS_X_LEN, - // Finite extension field over irreducible polynominal. - // Fp(u) / (u² - β) where β = -1 - // Public `Fp2.NONRESIDUE` below is the sextic-tower value `(1, 1) = u + 1`; - // the quadratic non-residue for the base Fp2 construction is still `-1`. - FP2_NONRESIDUE: [_1n, _1n], - Fp2mulByB: ({ c0, c1 }: Fp2) => { - const t0 = Fp.mul(c0, _4n); // 4 * c0 - const t1 = Fp.mul(c1, _4n); // 4 * c1 - // (T0-T1) + (T0+T1)*i - return { c0: Fp.sub(t0, t1), c1: Fp.add(t0, t1) }; - }, - Fp12finalExponentiate: (num: Fp12) => { - const x = BLS_X; - // this^(q⁶) / this - const t0 = Fp12.div(Fp12.frobeniusMap(num, 6), num); - // t0^(q²) * t0 - const t1 = Fp12.mul(Fp12.frobeniusMap(t0, 2), t0); - const t2 = Fp12.conjugate(Fp12._cyclotomicExp(t1, x)); - const t3 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicSquare(t1)), t2); - const t4 = Fp12.conjugate(Fp12._cyclotomicExp(t3, x)); - const t5 = Fp12.conjugate(Fp12._cyclotomicExp(t4, x)); - const t6 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicExp(t5, x)), Fp12._cyclotomicSquare(t2)); - const t7 = Fp12.conjugate(Fp12._cyclotomicExp(t6, x)); - const t2_t5_pow_q2 = Fp12.frobeniusMap(Fp12.mul(t2, t5), 2); - const t4_t1_pow_q3 = Fp12.frobeniusMap(Fp12.mul(t4, t1), 3); - const t6_t1c_pow_q1 = Fp12.frobeniusMap(Fp12.mul(t6, Fp12.conjugate(t1)), 1); - const t7_t3c_t1 = Fp12.mul(Fp12.mul(t7, Fp12.conjugate(t3)), t1); - // (t2 * t5)^(q²) * (t4 * t1)^(q³) * (t6 * t1.conj)^(q^1) * t7 * t3.conj * t1 - return Fp12.mul(Fp12.mul(Fp12.mul(t2_t5_pow_q2, t4_t1_pow_q3), t6_t1c_pow_q1), t7_t3c_t1); - }, -}); - -// GLV endomorphism Ψ(P), for fast cofactor clearing. `Fp2.NONRESIDUE` here is -// the tower value `u + 1`, so the Frobenius base passed to psiFrobenius is -// `1 / (u + 1)`, and psi2 derives the published `1 / 2^((p - 1) / 3)` constant internally. -let frob: ReturnType | undefined; -const getFrob = () => frob || (frob = psiFrobenius(Fp, Fp2, Fp2.div(Fp2.ONE, Fp2.NONRESIDUE))); -// Eager psiFrobenius setup now dominates `bls12-381.js` import, so defer it to -// first use. After that these locals are rewritten to the direct helper refs. -let G2psi: ReturnType['G2psi'] = (c, P) => { - const fn = getFrob().G2psi; - G2psi = fn; - return fn(c, P); -}; -let G2psi2: ReturnType['G2psi2'] = (c, P) => { - const fn = getFrob().G2psi2; - G2psi2 = fn; - return fn(c, P); -}; - -/** - * Default hash_to_field / hash-to-curve for BLS. - * m: 1 for G1, 2 for G2 - * k: target security level in bits - * hash: any function, e.g. BBS+ uses BLAKE2: see [github](https://github.com/hyperledger/aries-framework-go/issues/2247). - * Field/hash parameters come from [section 8.8.2 of RFC 9380](https://www.rfc-editor.org/rfc/rfc9380#section-8.8.2), - * but the `DST` / `encodeDST` strings below are the BLS-signature-suite override. - */ -const hasher_opts = Object.freeze({ - DST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', - encodeDST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', - p: Fp.ORDER, - m: 2, - k: 128, - expand: 'xmd', - hash: sha256, -}); - -// a=0, b=4 -// cofactor h of G2, derived with the signed convention `t = -x` -// (t^8 - 4t^7 + 5t^6 - 4t^4 + 6t^3 - 4t^2 - 4t + 13)/9 -// cofactorG2 = (t**8n - 4n*t**7n + 5n*t**6n - 4n*t**4n + 6n*t**3n - 4n*t**2n - 4n*t+13n)/9n -// x = 3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758*u + 352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160 -// y = 927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582*u + 1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905 -const bls12_381_CURVE_G2 = { - p: Fp2.ORDER, - n: bls12_381_CURVE_G1.n, - h: BigInt( - '0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5' - ), - a: Fp2.ZERO, - b: Fp2.fromBigTuple([_4n, _4n]), - Gx: Fp2.fromBigTuple([ - BigInt( - '0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8' - ), - BigInt( - '0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e' - ), - ]), - Gy: Fp2.fromBigTuple([ - BigInt( - '0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801' - ), - BigInt( - '0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be' - ), - ]), -}; - -// Encoding utils -const sortBit = (parts: bigint[], p: bigint) => { - for (const part of parts) { - if (part !== _0n) return Boolean((part * _2n) / p); - } - return false; -}; -const fp2 = { - // Generic tower bytes use `c0 || c1`, but the BLS12-381 G2 point/signature wire encoding uses - // `c1 || c0`, so keep this local wrapper instead of changing generic field serialization. - encode({ c0, c1 }: Fp2): TRet { - const { BYTES: L } = Fp; - return concatBytes(numberToBytesBE(c1, L), numberToBytesBE(c0, L)) as TRet; - }, - decode(bytes: TArg) { - const { BYTES: L } = Fp; - return Fp2.create({ - c0: Fp.create(bytesToNumberBE(bytes.subarray(L))), - c1: Fp.create(bytesToNumberBE(bytes.subarray(0, L))), - }); - }, -}; -const BaseFp = Fp; -type Mask = { compressed: boolean; infinity: boolean; sort: boolean }; -// Keep BLS12-381 point/signature codecs on one control-flow skeleton: the G1/G2 -// and point/signature variants differ only in field packing, subgroup bytes, and -// whether uncompressed form is allowed. Copy-paste decoders were diverging. -const coder = ( - name: 'G1' | 'G2', - Fp: TArg>, - b: T, - encode: TArg<(v: T) => TRet>, - decode: TArg<(bytes: TArg) => T>, - yparts: (y: T) => bigint[] -) => { - const F = Fp as IField; - const enc = encode as (v: T) => TRet; - const dec = decode as (bytes: TArg) => T; - const W = F.BYTES; - return (allowUncompressed: boolean) => ({ - encode(point: WeierstrassPoint, compressed = true): TRet { - if (!compressed && !allowUncompressed) - throw new Error('invalid signature: expected compressed encoding'); - const infinity = point.is0(); - const { x, y } = point.toAffine(); - const bytes = compressed ? enc(x) : concatBytes(enc(x), enc(y)); - let sort; - if (compressed && !infinity) sort = sortBit(yparts(y), BaseFp.ORDER); - return setMask(bytes, { compressed, infinity, sort }) as TRet; - }, - decode(bytes: TArg): AffinePoint { - const raw = allowUncompressed - ? abytes(bytes, undefined, 'point') - : abytes(bytes, W, 'signature'); - const { compressed, infinity, sort, value } = parseMask(raw); - if (!allowUncompressed && !compressed) - throw new Error('invalid signature: expected compressed encoding'); - const len = compressed ? W : 2 * W; - if (value.length !== len) throw new Error(`invalid ${name} point: expected ${len} bytes`); - if (infinity) { - // Infinity canonicality has to be checked on raw bytes before decode() - // reduces coordinates modulo p and turns non-empty payloads into zero. - for (const b of value) { - if (b) throw new Error(`invalid ${name} point: non-canonical zero`); - } - return { x: F.ZERO, y: F.ZERO }; - } - const x = dec(compressed ? value : value.subarray(0, W)); - let y; - if (compressed) { - y = F.sqrt(F.add(F.pow(x, _3n), b)); - if (!y) throw new Error(`invalid ${name} point: compressed`); - if (sortBit(yparts(y), BaseFp.ORDER) !== sort) y = F.neg(y); - } else { - y = dec(value.subarray(W)); - } - // Noble keeps the permissive coordinate reduction path here, but an - // omitted infinity flag must not still decode to ZERO afterwards. - if (!compressed && F.is0(x) && F.is0(y)) - throw new Error(`invalid ${name} point: uncompressed`); - return { x, y }; - }, - }); -}; - -// Internal helper only: it copies before clearing the top flag bits. The -// pairing-friendly-curves draft C.2 step 1 rejects 0x20 / 0x60 / 0xe0 because -// S_bit must be zero for infinity and for all uncompressed encodings. -function validateMask({ compressed, infinity, sort }: Mask) { - if ( - (!compressed && !infinity && sort) || // 0010_0000 = 0x20 - (!compressed && infinity && sort) || // 0110_0000 = 0x60 - (compressed && infinity && sort) // 1110_0000 = 0xe0 - ) - throw new Error('invalid encoding flag'); -} -function parseMask(bytes: TArg) { - // Copy, so we can remove mask data. - // It will be removed also later, when Fp.create will call modulo. - bytes = copyBytes(bytes); - const mask = bytes[0] & 0b1110_0000; - const compressed = !!((mask >> 7) & 1); // compression bit (0b1000_0000) - const infinity = !!((mask >> 6) & 1); // point at infinity bit (0b0100_0000) - const sort = !!((mask >> 5) & 1); // sort bit (0b0010_0000) - validateMask({ compressed, infinity, sort }); - bytes[0] &= 0b0001_1111; // clear mask (zero first 3 bits) - return { compressed, infinity, sort, value: bytes }; -} - -// Internal helper only: mutates a non-empty fresh buffer in place and just -// sets bits. Keep the same invalid-flag guard as parseMask() so encoders cannot -// manufacture states that decoders already reject. -function setMask(bytes: TArg, mask: Partial) { - if (bytes[0] & 0b1110_0000) throw new Error('setMask: non-empty mask'); - validateMask({ compressed: !!mask.compressed, infinity: !!mask.infinity, sort: !!mask.sort }); - if (mask.compressed) bytes[0] |= 0b1000_0000; - if (mask.infinity) bytes[0] |= 0b0100_0000; - if (mask.sort) bytes[0] |= 0b0010_0000; - return bytes; -} - -const g1coder = coder( - 'G1', - Fp, - Fp.create(bls12_381_CURVE_G1.b), - (x: Fp) => numberToBytesBE(x, Fp.BYTES), - (bytes: TArg) => Fp.create(bytesToNumberBE(bytes) & bitMask(Fp.BITS)), - (y: Fp) => [y] -); -const g1 = { point: g1coder(true), sig: g1coder(false) }; -const signatureG1ToBytes = (point: WeierstrassPoint): TRet => { - point.assertValidity(); - return g1.sig.encode(point); -}; -function signatureG1FromBytes(bytes: TArg): WeierstrassPoint { - const Point = bls12_381.G1.Point; - const point = Point.fromAffine(g1.sig.decode(bytes)); - point.assertValidity(); - return point; -} - -const g2coder = coder('G2', Fp2, bls12_381_CURVE_G2.b, fp2.encode, fp2.decode, (y: Fp2) => [ - y.c1, - y.c0, -]); -const g2 = { point: g2coder(true), sig: g2coder(false) }; -const signatureG2ToBytes = (point: WeierstrassPoint): TRet => { - point.assertValidity(); - return g2.sig.encode(point); -}; -function signatureG2FromBytes(bytes: TArg) { - const Point = bls12_381.G2.Point; - const point = Point.fromAffine(g2.sig.decode(bytes)); - point.assertValidity(); - return point; -} - -const signatureCoders = { - ShortSignature: { - fromBytes(bytes: TArg) { - return signatureG1FromBytes(abytes(bytes)); - }, - fromHex(hex: string): WeierstrassPoint { - return signatureG1FromBytes(hexToBytes(hex)); - }, - toBytes(point: WeierstrassPoint) { - return signatureG1ToBytes(point); - }, - // Historical alias: BLS signatures have a single compressed byte format here. - toRawBytes(point: WeierstrassPoint) { - return signatureG1ToBytes(point); - }, - toHex(point: WeierstrassPoint) { - return bytesToHex(signatureG1ToBytes(point)); - }, - }, - LongSignature: { - fromBytes(bytes: TArg): WeierstrassPoint { - return signatureG2FromBytes(abytes(bytes)); - }, - fromHex(hex: string): WeierstrassPoint { - return signatureG2FromBytes(hexToBytes(hex)); - }, - toBytes(point: WeierstrassPoint) { - return signatureG2ToBytes(point); - }, - // Historical alias: BLS signatures have a single compressed byte format here. - toRawBytes(point: WeierstrassPoint) { - return signatureG2ToBytes(point); - }, - toHex(point: WeierstrassPoint) { - return bytesToHex(signatureG2ToBytes(point)); - }, - }, -}; - -const fields = { - Fp, - Fp2, - Fp6, - Fp12, - Fr: bls12_381_Fr, -}; -const G1_Point = weierstrass(bls12_381_CURVE_G1, { - // Public point APIs still accept infinity, even though the Zcash proof - // encoding rules cited above only define nonzero point encodings. - allowInfinityPoint: true, - Fn: bls12_381_Fr, - fromBytes: g1.point.decode, - toBytes: ( - _c: WeierstrassPointCons, - point: WeierstrassPoint, - isComp: boolean - ): TRet => g1.point.encode(point, isComp) as TRet, - // Checks is the point resides in prime-order subgroup. - // point.isTorsionFree() should return true for valid points - // It returns false for shitty points. - // https://eprint.iacr.org/2021/1130.pdf - isTorsionFree: (c, point): boolean => { - // GLV endomorphism ψ(P) - const beta = BigInt( - '0x5f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe' - ); - const phi = new c(Fp.mul(point.X, beta), point.Y, point.Z); - // TODO: unroll - const xP = point.multiplyUnsafe(BLS_X).negate(); // [x]P - const u2P = xP.multiplyUnsafe(BLS_X); // [u2]P - return u2P.equals(phi); - }, - // Clear cofactor of G1 - // https://eprint.iacr.org/2019/403 - clearCofactor: (_c, point) => { - // return this.multiplyUnsafe(CURVE.h); - return point.multiplyUnsafe(BLS_X).add(point); // x*P + P - }, -}); -const G2_Point = weierstrass(bls12_381_CURVE_G2, { - Fp: Fp2, - // Public point APIs still accept infinity, even though the Zcash proof - // encoding rules cited above only define nonzero point encodings. - allowInfinityPoint: true, - Fn: bls12_381_Fr, - fromBytes: g2.point.decode, - toBytes: ( - _c: WeierstrassPointCons, - point: WeierstrassPoint, - isComp: boolean - ): TRet => g2.point.encode(point, isComp) as TRet, - // https://eprint.iacr.org/2021/1130.pdf - // Older version: https://eprint.iacr.org/2019/814.pdf - isTorsionFree: (c, P): boolean => { - return P.multiplyUnsafe(BLS_X).negate().equals(G2psi(c, P)); // ψ(P) == [u](P) - }, - // clear_cofactor_bls12381_g2 from RFC 9380. - // https://eprint.iacr.org/2017/419.pdf - // prettier-ignore - clearCofactor: (c, P) => { - const x = BLS_X; - let t1 = P.multiplyUnsafe(x).negate(); // [-x]P - let t2 = G2psi(c, P); // Ψ(P) - let t3 = P.double(); // 2P - t3 = G2psi2(c, t3); // Ψ²(2P) - t3 = t3.subtract(t2); // Ψ²(2P) - Ψ(P) - t2 = t1.add(t2); // [-x]P + Ψ(P) - t2 = t2.multiplyUnsafe(x).negate(); // [x²]P - [x]Ψ(P) - t3 = t3.add(t2); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) - t3 = t3.subtract(t1); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + [x]P - const Q = t3.subtract(P); // Ψ²(2P) - Ψ(P) + [x²]P - [x]Ψ(P) + [x]P - 1P - return Q; // [x²-x-1]P + [x-1]Ψ(P) + Ψ²(2P) - }, -}); - -const bls12_hasher_opts = { - mapToG1: mapToG1, - mapToG2: mapToG2, - hasherOpts: hasher_opts, - // RFC 9380 Appendix J defines distinct G1/G2 RO and NU suite IDs, and - // draft-irtf-cfrg-bls-signature-06 §4.2.1 gives separate G1/G2 `_NUL_` DSTs. - // Keep G1 encode-to-curve on the G1 domain instead of inheriting G2's `encodeDST`. - hasherOptsG1: { - ...hasher_opts, - m: 1, - DST: 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_', - encodeDST: 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_', - }, - hasherOptsG2: { ...hasher_opts }, -} as const; - -const bls12_params = { - ateLoopSize: BLS_X, // The BLS parameter x for BLS12-381 - xNegative: true, - twistType: 'multiplicative' as const, - randomBytes: randomBytes, -}; - -/** - * bls12-381 pairing-friendly curve construction. - * Provides both longSignatures and shortSignatures. - * @example - * bls12-381 pairing-friendly curve construction. - * - * ```ts - * const bls = bls12_381.longSignatures; - * const { secretKey, publicKey } = bls.keygen(); - * const msg = bls.hash(new TextEncoder().encode('hello noble')); - * const sig = bls.sign(msg, secretKey); - * const isValid = bls.verify(sig, msg, publicKey); - * ``` - */ -export const bls12_381: BlsCurvePairWithSignatures = bls( - fields, - G1_Point, - G2_Point, - bls12_params, - bls12_hasher_opts, - signatureCoders -); - -// 3-isogeny map from E' to E https://www.rfc-editor.org/rfc/rfc9380#appendix-E.3 -// Coefficients stay in ascending `k_(?,0)`..`k_(?,d)` order; isogenyMap() -// reverses them internally for Horner evaluation. -const isogenyMapG2 = isogenyMap( - Fp2, - [ - // xNum - [ - [ - '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', - '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', - ], - [ - '0x0', - '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a', - ], - [ - '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e', - '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d', - ], - [ - '0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1', - '0x0', - ], - ], - // xDen - [ - [ - '0x0', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63', - ], - [ - '0xc', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f', - ], - ['0x1', '0x0'], // LAST 1 - ], - // yNum - [ - [ - '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', - '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', - ], - [ - '0x0', - '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be', - ], - [ - '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c', - '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f', - ], - [ - '0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10', - '0x0', - ], - ], - // yDen - [ - [ - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', - ], - [ - '0x0', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3', - ], - [ - '0x12', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99', - ], - ['0x1', '0x0'], // LAST 1 - ], - ].map((i) => i.map((pair) => Fp2.fromBigTuple(pair.map(BigInt) as BigintTuple))) as [ - Fp2[], - Fp2[], - Fp2[], - Fp2[], - ] -); -// 11-isogeny map from E' to E. Coefficients stay in ascending -// `k_(?,0)`..`k_(?,d)` order; isogenyMap() reverses them for Horner evaluation. -const isogenyMapG1 = isogenyMap( - Fp, - [ - // xNum - [ - '0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7', - '0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb', - '0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0', - '0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861', - '0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9', - '0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983', - '0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84', - '0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e', - '0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317', - '0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e', - '0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b', - '0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229', - ], - // xDen - [ - '0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c', - '0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff', - '0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19', - '0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8', - '0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e', - '0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5', - '0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a', - '0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e', - '0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641', - '0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a', - '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', // LAST 1 - ], - // yNum - [ - '0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33', - '0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696', - '0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6', - '0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb', - '0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb', - '0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0', - '0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2', - '0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29', - '0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587', - '0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30', - '0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132', - '0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e', - '0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8', - '0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133', - '0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b', - '0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604', - ], - // yDen - [ - '0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1', - '0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d', - '0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2', - '0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416', - '0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d', - '0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac', - '0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c', - '0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9', - '0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a', - '0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55', - '0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8', - '0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092', - '0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc', - '0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7', - '0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f', - '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', // LAST 1 - ], - ].map((i) => i.map((j) => BigInt(j))) as [Fp[], Fp[], Fp[], Fp[]] -); - -let G1_SWU: ((u: bigint) => { x: bigint; y: bigint }) | undefined; -let G2_SWU: ((u: Fp2) => { x: Fp2; y: Fp2 }) | undefined; -// SWU setup validates the pre-isogeny curve parameters and builds sqrt-ratio helpers. -// Doing that eagerly adds about 10ms to `bls12-381.js` import here, so keep it lazy; after the -// first map call the cached mapper is reused directly. -const getG1_SWU = () => - G1_SWU || - (G1_SWU = mapToCurveSimpleSWU(Fp, { - A: Fp.create( - BigInt( - '0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d' - ) - ), - B: Fp.create( - BigInt( - '0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0' - ) - ), - Z: Fp.create(BigInt(11)), - })); -const getG2_SWU = () => - G2_SWU || - (G2_SWU = mapToCurveSimpleSWU(Fp2, { - // SWU map for the RFC 9380 §8.8.2 pre-isogeny G2 curve E': - // y² = x³ + 240i * x + 1012 + 1012i - A: Fp2.create({ c0: Fp.create(_0n), c1: Fp.create(BigInt(240)) }), // A' = 240 * I - B: Fp2.create({ c0: Fp.create(BigInt(1012)), c1: Fp.create(BigInt(1012)) }), // B' = 1012 * (1 + I) - Z: Fp2.create({ c0: Fp.create(BigInt(-2)), c1: Fp.create(BigInt(-1)) }), // Z: -(2 + I) - })); - -// Internal hash-to-curve step: G1 uses `m = 1`, so only `scalars[0]` is read, -// and the result is the isogeny image on E before the subgroup clear. -function mapToG1(scalars: bigint[]) { - const { x, y } = getG1_SWU()(Fp.create(scalars[0])); - return isogenyMapG1(x, y); -} -// Internal hash-to-curve step: G2 expects the RFC `m = 2` pair, and the result -// is the isogeny image on E before the subgroup clear. -function mapToG2(scalars: bigint[]) { - const { x, y } = getG2_SWU()(Fp2.fromBigTuple(scalars as BigintTuple)); - return isogenyMapG2(x, y); -} diff --git a/node_modules/@noble/curves/src/bn254.ts b/node_modules/@noble/curves/src/bn254.ts deleted file mode 100644 index 4e4590c..0000000 --- a/node_modules/@noble/curves/src/bn254.ts +++ /dev/null @@ -1,280 +0,0 @@ -/** - * bn254, previously known as alt_bn_128, when it had 128-bit security. - -Barbulescu-Duquesne 2017 shown it's weaker: just about 100 bits, -so the naming has been adjusted to its prime bit count: -https://hal.science/hal-01534101/file/main.pdf. -Compatible with EIP-196 and EIP-197. - -There are huge compatibility issues in the ecosystem: - -1. Different libraries call it in different ways: "bn254", "bn256", "alt_bn128", "bn128". -2. libff has bn128, but it's a different curve with different G2: - https://github.com/scipr-lab/libff/blob/a44f482e18b8ac04d034c193bd9d7df7817ad73f/libff/algebra/curves/bn128/bn128_init.cpp#L166-L169 -3. halo2curves bn256 is also incompatible and returns different outputs - -We don't implement Point methods toHex / toBytes. -To work around this limitation, has to initialize points on their own from BigInts. -Reason it's not implemented is because [there is no standard](https://github.com/privacy-scaling-explorations/halo2curves/issues/109). -Points of divergence: - -- Endianness: LE vs BE (byte-swapped) -- Flags as first hex bits (similar to BLS) vs no-flags -- Imaginary part last in G2 vs first (c0, c1 vs c1, c0) - -The goal of our implementation is to support "Ethereum" variant of the curve, -because it at least has specs: - -- EIP196 (https://eips.ethereum.org/EIPS/eip-196) describes bn254 ECADD and ECMUL opcodes for EVM -- EIP197 (https://eips.ethereum.org/EIPS/eip-197) describes bn254 pairings -- It's hard: EIPs don't have proper tests. EIP-197 returns boolean output instead of Fp12 -- The existing implementations are bad. Some are deprecated: - - https://github.com/paritytech/bn (old version) - - https://github.com/ewasm/ethereum-bn128.rs (uses paritytech/bn) - - https://github.com/zcash-hackworks/bn - - https://github.com/arkworks-rs/curves/blob/master/bn254/src/lib.rs -- Python implementations use different towers and produce different Fp12 outputs: - - https://github.com/ethereum/py_pairing - - https://github.com/ethereum/py_ecc/tree/main/py_ecc/bn128 -- Points are encoded differently in different implementations - -### Params -Seed (X): 4965661367192848881 -Fr: (36x⁴+36x³+18x²+6x+1) -Fp: (36x⁴+36x³+24x²+6x+1) -(E / Fp ): Y² = X³+3 -(Et / Fp²): Y² = X³+3/(u+9) (D-type twist) -Ate loop size: 6x+2 - -### Towers -- Fp²[u] = Fp/u²+1 -- Fp⁶[v] = Fp²/v³-9-u -- Fp¹²[w] = Fp⁶/w²-v - - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { - blsBasic, - type BlsCurvePair, - type BlsPostPrecomputeFn, - type BlsPostPrecomputePointAddFn, -} from './abstract/bls.ts'; -import { Field, type IField } from './abstract/modular.ts'; -import type { Fp, Fp12, Fp2 } from './abstract/tower.ts'; -import { psiFrobenius, tower12 } from './abstract/tower.ts'; -import { weierstrass, type WeierstrassOpts } from './abstract/weierstrass.ts'; -import { bitLen, type TRet } from './utils.ts'; -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3); -const _6n = /* @__PURE__ */ BigInt(6); - -// Locally documented BN pairing seed. EIP-197 does not name this scalar -// directly; noble stores the positive value and derives any `-x` uses later. -const BN_X = /* @__PURE__ */ BigInt('4965661367192848881'); -// Bit width of the stored seed itself, not the derived Miller-loop scalar `6x+2`. -const BN_X_LEN = /* @__PURE__ */ (() => bitLen(BN_X))(); -// Derived scalar used by the optimized G2 subgroup test required by EIP-197. -const SIX_X_SQUARED = /* @__PURE__ */ (() => _6n * BN_X ** _2n)(); - -const bn254_G1_CURVE: WeierstrassOpts = { - p: BigInt('0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47'), - n: BigInt('0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001'), - // The Ethereum specs define G1 as prime-order but do not spell out the - // cofactor separately; `h = 1` is the implementation-derived value. - h: _1n, - a: _0n, - b: _3n, - Gx: _1n, - Gy: BigInt(2), -}; - -// r == n -// Finite field over r. It's for convenience and is not used in the code below, -// and its canonical `fromBytes()` decoder is stricter than the EIP-196 MUL -// scalar rule that accepts any 256-bit integer. -// These factories are side-effect free; mark them pure so single-export bundles can drop the rest. -/** bn254 scalar field. */ -export const bn254_Fr: TRet> = /* @__PURE__ */ (() => - Field(bn254_G1_CURVE.n) as TRet>)(); - -// `3 / (i + 9)` from EIP-197, stored in noble's internal `(c0, c1) = (b, a)` -// order rather than the spec's `a * i + b` notation. -const Fp2B = /* @__PURE__ */ (() => ({ - c0: BigInt('19485874751759354771024239261021720505790618469301721065564631296452457478373'), - c1: BigInt('266929791119991161246907387137283842545076965332900288569378510910307636690'), -}))(); - -// Bootstrap binding: `Fp12finalExponentiate` needs to reference the finished -// field object while `tower12(...)` is still constructing it. -let Fp12: ReturnType['Fp12']; -const tower = /* @__PURE__ */ (() => { - const res = tower12({ - ORDER: bn254_G1_CURVE.p, - X_LEN: BN_X_LEN, - // Public `Fp2.NONRESIDUE` below is the sextic-tower seed `(9, 1)`, not the - // quadratic relation `i^2 + 1 = 0` from the EIP text. - FP2_NONRESIDUE: [BigInt(9), _1n], - Fp2mulByB: (num: Fp2) => Fp2.mul(num, Fp2B), - Fp12finalExponentiate: (num: Fp12) => { - const powMinusX = (num: Fp12) => Fp12.conjugate(Fp12._cyclotomicExp(num, BN_X)); - const r0 = Fp12.mul(Fp12.conjugate(num), Fp12.inv(num)); - const r = Fp12.mul(Fp12.frobeniusMap(r0, 2), r0); - const y1 = Fp12._cyclotomicSquare(powMinusX(r)); - const y2 = Fp12.mul(Fp12._cyclotomicSquare(y1), y1); - const y4 = powMinusX(y2); - const y6 = powMinusX(Fp12._cyclotomicSquare(y4)); - const y8 = Fp12.mul(Fp12.mul(Fp12.conjugate(y6), y4), Fp12.conjugate(y2)); - const y9 = Fp12.mul(y8, y1); - return Fp12.mul( - Fp12.frobeniusMap(Fp12.mul(Fp12.conjugate(r), y9), 3), - Fp12.mul( - Fp12.frobeniusMap(y8, 2), - Fp12.mul(Fp12.frobeniusMap(y9, 1), Fp12.mul(Fp12.mul(y8, y4), r)) - ) - ); - }, - }); - Fp12 = res.Fp12; - return res; -})(); -const Fp = /* @__PURE__ */ (() => tower.Fp)(); -const Fp2 = /* @__PURE__ */ (() => tower.Fp2)(); - -// END OF CURVE FIELDS -// BN254 uses the same tower seed `(9, 1)` for the Frobenius helper that powers -// the divisive-twist G2 endomorphism. -let frob: ReturnType | undefined; -const getFrob = () => frob || (frob = psiFrobenius(Fp, Fp2, Fp2.NONRESIDUE)); -// Eager psiFrobenius setup now dominates `bn254.js` import, so defer it to -// first use. After that these locals are rewritten to the direct helper refs. -let psi: ReturnType['psi'] = (x, y) => { - const fn = getFrob().psi; - psi = fn; - return fn(x, y); -}; -let G2psi: ReturnType['G2psi'] = (c, P) => { - const fn = getFrob().G2psi; - G2psi = fn; - return fn(c, P); -}; - -export const _postPrecompute: BlsPostPrecomputeFn = ( - Rx: Fp2, - Ry: Fp2, - Rz: Fp2, - Qx: Fp2, - Qy: Fp2, - pointAdd: BlsPostPrecomputePointAddFn -) => { - const q = psi(Qx, Qy); - ({ Rx, Ry, Rz } = pointAdd(Rx, Ry, Rz, q[0], q[1])); - const q2 = psi(q[0], q[1]); - pointAdd(Rx, Ry, Rz, q2[0], Fp2.neg(q2[1])); -}; - -// cofactor: (36 * X^4) + (36 * X^3) + (30 * X^2) + 6*X + 1 -const bn254_G2_CURVE: WeierstrassOpts = /* @__PURE__ */ (() => ({ - p: Fp2.ORDER, - n: bn254_G1_CURVE.n, - // As with G1, the Ethereum specs do not spell out the G2 cofactor - // separately; this literal is the implementation-derived value. - h: BigInt('0x30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d'), - a: Fp2.ZERO, - b: Fp2B, - Gx: Fp2.fromBigTuple([ - BigInt('10857046999023057135944570762232829481370756359578518086990519993285655852781'), - BigInt('11559732032986387107991004021392285783925812861821192530917403151452391805634'), - ]), - Gy: Fp2.fromBigTuple([ - BigInt('8495653923123431417604973247489272438418190587263600148770280649306958101930'), - BigInt('4082367875863433681332203403145435568316851327593401208105741076214120093531'), - ]), -}))(); - -const fields = /* @__PURE__ */ (() => ({ Fp, Fp2, Fp6: tower.Fp6, Fp12, Fr: bn254_Fr }))(); -const bn254_G1 = /* @__PURE__ */ weierstrass(bn254_G1_CURVE, { - Fp, - Fn: bn254_Fr, - // Ethereum encodes infinity as `(0, 0)`, so the public point API accepts it - // even though it is not an affine curve point, and `fromAffine()` stays lazy: - // adversarial inputs still need `assertValidity()`. - allowInfinityPoint: true, -}); -const bn254_G2 = /* @__PURE__ */ weierstrass(bn254_G2_CURVE, { - Fp: Fp2, - Fn: bn254_Fr, - // Ethereum encodes infinity as `((0, 0), (0, 0))`, so the public point API - // accepts it even though it is not an affine curve point. - allowInfinityPoint: true, - // Optimized BN254 G2 subgroup test used to satisfy the EIP-197 order check. - isTorsionFree: (c, P) => P.multiplyUnsafe(SIX_X_SQUARED).equals(G2psi(c, P)), // [p]P = [6X^2]P -}); -/* -No hashToCurve for now (and signatures): - -- RFC 9380 doesn't mention bn254 and doesn't provide test vectors -- Overall seems like nobody is using BLS signatures on top of bn254 -- Seems like it can utilize SVDW, which is not implemented yet -*/ -// const htfDefaults = Object.freeze({ -// // DST: a domain separation tag defined in section 2.2.5 -// DST: 'BN254G2_XMD:SHA-256_SVDW_RO_', -// encodeDST: 'BN254G2_XMD:SHA-256_SVDW_RO_', -// p: Fp.ORDER, -// m: 2, -// k: 128, -// expand: 'xmd', -// hash: sha256, -// }); -// const hasherOpts = { -// { ...htfDefaults, m: 1, DST: 'BN254G2_XMD:SHA-256_SVDW_RO_' } -// }; -const bn254_params = /* @__PURE__ */ (() => ({ - // Optimal-ate Miller loop parameter derived from the positive BN seed. - ateLoopSize: BN_X * _6n + _2n, - r: bn254_Fr.ORDER, - xNegative: false, - // EIP-197 writes G2 as `y^2 = x^3 + 3 / (i + 9)`, so the pairing - // configuration uses the divisive twist convention. - twistType: 'divisive' as const, - postPrecompute: _postPrecompute, -}))(); -// const bn254_hasher = { -// hasherOpts: htfDefaults, -// hasherOptsG1: { m: 1, DST: 'BN254G2_XMD:SHA-256_SVDW_RO_' }, -// hasherOptsG2: htfDefaults -// }; -// G2_heff hEff: BigInt('21888242871839275222246405745257275088844257914179612981679871602714643921549'), -// fromBytes: notImplemented, -// toBytes: notImplemented, - -// mapToCurve: notImplemented, -// fromBytes: notImplemented, -// toBytes: notImplemented, -// ShortSignature: { -// fromBytes: notImplemented, -// fromHex: notImplemented, -// toBytes: notImplemented, -// toRawBytes: notImplemented, -// toHex: notImplemented, -// }, - -/** - * bn254 (a.k.a. alt_bn128) pairing-friendly curve. - * Contains G1 / G2 operations and pairings only; the commented-out - * hash-to-curve and signature surface is intentionally not exposed here. - * @example - * Compute a pairing from the two generator points. - * - * ```ts - * const gt = bn254.pairing(bn254.G1.Point.BASE, bn254.G2.Point.BASE); - * ``` - */ -// bn254_hasher -export const bn254: BlsCurvePair = /* @__PURE__ */ blsBasic( - fields, - bn254_G1, - bn254_G2, - bn254_params -); diff --git a/node_modules/@noble/curves/src/ed25519.ts b/node_modules/@noble/curves/src/ed25519.ts deleted file mode 100644 index 42cf21a..0000000 --- a/node_modules/@noble/curves/src/ed25519.ts +++ /dev/null @@ -1,705 +0,0 @@ -/** - * ed25519 Twisted Edwards curve with following addons: - * - X25519 ECDH - * - Ristretto cofactor elimination - * - Elligator hash-to-group / point indistinguishability - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { sha512 } from '@noble/hashes/sha2.js'; -import { abytes, concatBytes, hexToBytes } from '@noble/hashes/utils.js'; -import { type AffinePoint } from './abstract/curve.ts'; -import { - eddsa, - edwards, - PrimeEdwardsPoint, - type EdDSA, - type EdDSAOpts, - type EdwardsOpts, - type EdwardsPoint, - type EdwardsPointCons, -} from './abstract/edwards.ts'; -import { createFROST, type FROST } from './abstract/frost.ts'; -import { - _DST_scalar, - createHasher, - expand_message_xmd, - type H2CDSTOpts, - type H2CHasher, - type H2CHasherBase, -} from './abstract/hash-to-curve.ts'; -import { - FpInvertBatch, - FpSqrtEven, - isNegativeLE, - mod, - pow2, - type IField, -} from './abstract/modular.ts'; -import { montgomery, type MontgomeryECDH } from './abstract/montgomery.ts'; -import { createOPRF, type OPRF } from './abstract/oprf.ts'; -import { asciiToBytes, bytesToNumberLE, equalBytes, type TArg, type TRet } from './utils.ts'; - -// prettier-ignore -const _0n = /* @__PURE__ */ BigInt(0), _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3); -// prettier-ignore -const _5n = /* @__PURE__ */ BigInt(5), _8n = /* @__PURE__ */ BigInt(8); - -// P = 2n**255n - 19n -const ed25519_CURVE_p = /* @__PURE__ */ BigInt( - '0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed' -); -// N = 2n**252n + 27742317777372353535851937790883648493n -// a = Fp.create(BigInt(-1)) -// d = -121665/121666 a.k.a. Fp.neg(121665 * Fp.inv(121666)) -const ed25519_CURVE: EdwardsOpts = /* @__PURE__ */ (() => ({ - p: ed25519_CURVE_p, - n: BigInt('0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed'), - h: _8n, - a: BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec'), - d: BigInt('0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3'), - Gx: BigInt('0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a'), - Gy: BigInt('0x6666666666666666666666666666666666666666666666666666666666666658'), -}))(); - -function ed25519_pow_2_252_3(x: bigint) { - // prettier-ignore - const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80); - const P = ed25519_CURVE_p; - const x2 = (x * x) % P; - const b2 = (x2 * x) % P; // x^3, 11 - const b4 = (pow2(b2, _2n, P) * b2) % P; // x^15, 1111 - const b5 = (pow2(b4, _1n, P) * x) % P; // x^31 - const b10 = (pow2(b5, _5n, P) * b5) % P; - const b20 = (pow2(b10, _10n, P) * b10) % P; - const b40 = (pow2(b20, _20n, P) * b20) % P; - const b80 = (pow2(b40, _40n, P) * b40) % P; - const b160 = (pow2(b80, _80n, P) * b80) % P; - const b240 = (pow2(b160, _80n, P) * b80) % P; - const b250 = (pow2(b240, _10n, P) * b10) % P; - const pow_p_5_8 = (pow2(b250, _2n, P) * x) % P; - // ^ This is x^((p-5)/8); multiply by x once more to get x^((p+3)/8). - return { pow_p_5_8, b2 }; -} - -// Mutates and returns the provided 32-byte buffer in place. -function adjustScalarBytes(bytes: TArg): TRet { - // Section 5: For X25519, in order to decode 32 random bytes as an integer scalar, - // set the three least significant bits of the first byte - bytes[0] &= 248; // 0b1111_1000 - // and the most significant bit of the last to zero, - bytes[31] &= 127; // 0b0111_1111 - // set the second most significant bit of the last byte to 1 - bytes[31] |= 64; // 0b0100_0000 - return bytes as TRet; -} - -// √(-1) aka √(a) aka 2^((p-1)/4) -// Fp.sqrt(Fp.neg(1)) -const ED25519_SQRT_M1 = /* @__PURE__ */ BigInt( - '19681161376707505956807079304988542015446066515923890162744021073123829784752' -); -// sqrt(u/v). Returns `{ isValid, value }`; on non-squares `value` is still a -// dummy root-shaped field element so callers can stay constant-time. -function uvRatio(u: bigint, v: bigint): { isValid: boolean; value: bigint } { - const P = ed25519_CURVE_p; - const v3 = mod(v * v * v, P); // v³ - const v7 = mod(v3 * v3 * v, P); // v⁷ - // (p+3)/8 and (p-5)/8 - const pow = ed25519_pow_2_252_3(u * v7).pow_p_5_8; - let x = mod(u * v3 * pow, P); // (uv³)(uv⁷)^(p-5)/8 - const vx2 = mod(v * x * x, P); // vx² - const root1 = x; // First root candidate - const root2 = mod(x * ED25519_SQRT_M1, P); // Second root candidate - const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root - const useRoot2 = vx2 === mod(-u, P); // If vx² = -u, set x <-- x * 2^((p-1)/4) - const noRoot = vx2 === mod(-u * ED25519_SQRT_M1, P); // There is no valid root, vx² = -u√(-1) - if (useRoot1) x = root1; - if (useRoot2 || noRoot) x = root2; // We return root2 anyway, for const-time - if (isNegativeLE(x, P)) x = mod(-x, P); - return { isValid: useRoot1 || useRoot2, value: x }; -} - -const ed25519_Point = /* @__PURE__ */ edwards(ed25519_CURVE, { uvRatio }); -// Public field alias stays stricter than the RFC 8032 Appendix A sample code: -// `Fp.inv(0)` throws instead of returning `0`. -const Fp = /* @__PURE__ */ (() => ed25519_Point.Fp)(); -const Fn = /* @__PURE__ */ (() => ed25519_Point.Fn)(); - -// RFC 8032 `dom2` helper for ctx/ph variants only. Plain Ed25519 keeps the -// empty-domain path in `ed()` and would be wrong if routed through this helper. -function ed25519_domain( - data: TArg, - ctx: TArg, - phflag: boolean -): TRet { - if (ctx.length > 255) throw new Error('Context is too big'); - return concatBytes( - asciiToBytes('SigEd25519 no Ed25519 collisions'), - new Uint8Array([phflag ? 1 : 0, ctx.length]), - ctx, - data - ) as TRet; -} - -function ed(opts: TArg) { - // Ed25519 keeps ZIP-215 default verification semantics for consensus compatibility. - return eddsa( - ed25519_Point, - sha512, - Object.assign({ adjustScalarBytes, zip215: true }, opts as EdDSAOpts) - ); -} - -/** - * ed25519 curve with EdDSA signatures. - * Seeded `keygen(seed)` / `utils.randomSecretKey(seed)` reuse the provided - * 32-byte seed buffer instead of copying it. - * @example - * Generate one Ed25519 keypair, sign a message, and verify it. - * - * ```js - * import { ed25519 } from '@noble/curves/ed25519.js'; - * const { secretKey, publicKey } = ed25519.keygen(); - * // const publicKey = ed25519.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed25519.sign(msg, secretKey); - * const isValid = ed25519.verify(sig, msg, publicKey); // ZIP215 - * // RFC8032 / FIPS 186-5 - * const isValid2 = ed25519.verify(sig, msg, publicKey, { zip215: false }); - * ``` - */ -export const ed25519: EdDSA = /* @__PURE__ */ ed({}); -/** - * Context version of ed25519 (ctx for domain separation). See {@link ed25519} - * Seeded `keygen(seed)` / `utils.randomSecretKey(seed)` reuse the provided - * 32-byte seed buffer instead of copying it. - * @example - * Sign and verify with Ed25519ctx under one explicit context. - * - * ```ts - * const context = new TextEncoder().encode('docs'); - * const { secretKey, publicKey } = ed25519ctx.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed25519ctx.sign(msg, secretKey, { context }); - * const isValid = ed25519ctx.verify(sig, msg, publicKey, { context }); - * ``` - */ -export const ed25519ctx: EdDSA = /* @__PURE__ */ ed({ domain: ed25519_domain }); -/** - * Prehashed version of ed25519. See {@link ed25519} - * Seeded `keygen(seed)` / `utils.randomSecretKey(seed)` reuse the provided - * 32-byte seed buffer instead of copying it. - * @example - * Use the prehashed Ed25519 variant for one message. - * - * ```ts - * const { secretKey, publicKey } = ed25519ph.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed25519ph.sign(msg, secretKey); - * const isValid = ed25519ph.verify(sig, msg, publicKey); - * ``` - */ -export const ed25519ph: EdDSA = /* @__PURE__ */ ed({ domain: ed25519_domain, prehash: sha512 }); -/** - * FROST threshold signatures over ed25519. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 ed25519 signing. - * - * ```ts - * const alice = ed25519_FROST.Identifier.derive('alice@example.com'); - * const bob = ed25519_FROST.Identifier.derive('bob@example.com'); - * const carol = ed25519_FROST.Identifier.derive('carol@example.com'); - * const deal = ed25519_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const ed25519_FROST: TRet = /* @__PURE__ */ (() => - createFROST({ - name: 'FROST-ED25519-SHA512-v1', - Point: ed25519_Point, - validatePoint: (p) => { - p.assertValidity(); - if (!p.isTorsionFree()) throw new Error('bad point: not torsion-free'); - }, - hash: sha512, - // RFC 9591 keeps H2 undecorated here for RFC 8032 compatibility. In createFROST(), - // `H2: ''` becomes an empty DST prefix; the built-in hashToScalar fallback treats - // that the same as omitted DST, even though custom hooks can still observe the empty bag. - H2: '', - }))(); - -/** - * ECDH using curve25519 aka x25519. - * `getSharedSecret()` rejects low-order peer inputs by default, and seeded - * `keygen(seed)` reuses the provided 32-byte seed buffer instead of copying it. - * @example - * Derive one shared secret between two X25519 peers. - * - * ```js - * import { x25519 } from '@noble/curves/ed25519.js'; - * const alice = x25519.keygen(); - * const bob = x25519.keygen(); - * const shared = x25519.getSharedSecret(alice.secretKey, bob.publicKey); - * ``` - */ -export const x25519: TRet = /* @__PURE__ */ (() => { - const P = ed25519_CURVE_p; - return montgomery({ - P, - type: 'x25519', - powPminus2: (x: bigint): bigint => { - // x^(p-2) aka x^(2^255-21) - const { pow_p_5_8, b2 } = ed25519_pow_2_252_3(x); - return mod(pow2(pow_p_5_8, _3n, P) * b2, P); - }, - adjustScalarBytes, - }); -})(); - -// Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator) -// RFC 9380 Appendix G.2.2 / Err4730 requires `sgn0(c1) = 0` for the Edwards -// map constant below, so use the even root explicitly. -// 1. c1 = (q + 3) / 8 # Integer arithmetic -const ELL2_C1 = /* @__PURE__ */ (() => (ed25519_CURVE_p + _3n) / _8n)(); -const ELL2_C2 = /* @__PURE__ */ (() => Fp.pow(_2n, ELL2_C1))(); // 2. c2 = 2^c1 -const ELL2_C3 = /* @__PURE__ */ (() => Fp.sqrt(Fp.neg(Fp.ONE)))(); // 3. c3 = sqrt(-1) - -/** - * RFC 9380 method `map_to_curve_elligator2_curve25519`. Experimental name: may be renamed later. - * @private - */ -// prettier-ignore -export function _map_to_curve_elligator2_curve25519(u: bigint): { - xMn: bigint, xMd: bigint, yMn: bigint, yMd: bigint -} { - const ELL2_C4 = (ed25519_CURVE_p - _5n) / _8n; // 4. c4 = (q - 5) / 8 # Integer arithmetic - const ELL2_J = BigInt(486662); - - let tv1 = Fp.sqr(u); // 1. tv1 = u^2 - tv1 = Fp.mul(tv1, _2n); // 2. tv1 = 2 * tv1 - // 3. xd = tv1 + 1 # Nonzero: -1 is square (mod p), tv1 is not - let xd = Fp.add(tv1, Fp.ONE); - let x1n = Fp.neg(ELL2_J); // 4. x1n = -J # x1 = x1n / xd = -J / (1 + 2 * u^2) - let tv2 = Fp.sqr(xd); // 5. tv2 = xd^2 - let gxd = Fp.mul(tv2, xd); // 6. gxd = tv2 * xd # gxd = xd^3 - let gx1 = Fp.mul(tv1, ELL2_J);// 7. gx1 = J * tv1 # x1n + J * xd - gx1 = Fp.mul(gx1, x1n); // 8. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd - gx1 = Fp.add(gx1, tv2); // 9. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 - gx1 = Fp.mul(gx1, x1n); // 10. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 - let tv3 = Fp.sqr(gxd); // 11. tv3 = gxd^2 - tv2 = Fp.sqr(tv3); // 12. tv2 = tv3^2 # gxd^4 - tv3 = Fp.mul(tv3, gxd); // 13. tv3 = tv3 * gxd # gxd^3 - tv3 = Fp.mul(tv3, gx1); // 14. tv3 = tv3 * gx1 # gx1 * gxd^3 - tv2 = Fp.mul(tv2, tv3); // 15. tv2 = tv2 * tv3 # gx1 * gxd^7 - let y11 = Fp.pow(tv2, ELL2_C4); // 16. y11 = tv2^c4 # (gx1 * gxd^7)^((p - 5) / 8) - y11 = Fp.mul(y11, tv3); // 17. y11 = y11 * tv3 # gx1*gxd^3*(gx1*gxd^7)^((p-5)/8) - let y12 = Fp.mul(y11, ELL2_C3); // 18. y12 = y11 * c3 - tv2 = Fp.sqr(y11); // 19. tv2 = y11^2 - tv2 = Fp.mul(tv2, gxd); // 20. tv2 = tv2 * gxd - let e1 = Fp.eql(tv2, gx1); // 21. e1 = tv2 == gx1 - // 22. y1 = CMOV(y12, y11, e1) # If g(x1) is square, this is its sqrt - let y1 = Fp.cmov(y12, y11, e1); - let x2n = Fp.mul(x1n, tv1); // 23. x2n = x1n * tv1 # x2 = x2n / xd = 2 * u^2 * x1n / xd - let y21 = Fp.mul(y11, u); // 24. y21 = y11 * u - y21 = Fp.mul(y21, ELL2_C2); // 25. y21 = y21 * c2 - let y22 = Fp.mul(y21, ELL2_C3); // 26. y22 = y21 * c3 - let gx2 = Fp.mul(gx1, tv1); // 27. gx2 = gx1 * tv1 # g(x2) = gx2 / gxd = 2 * u^2 * g(x1) - tv2 = Fp.sqr(y21); // 28. tv2 = y21^2 - tv2 = Fp.mul(tv2, gxd); // 29. tv2 = tv2 * gxd - let e2 = Fp.eql(tv2, gx2); // 30. e2 = tv2 == gx2 - // 31. y2 = CMOV(y22, y21, e2) # If g(x2) is square, this is its sqrt - let y2 = Fp.cmov(y22, y21, e2); - tv2 = Fp.sqr(y1); // 32. tv2 = y1^2 - tv2 = Fp.mul(tv2, gxd); // 33. tv2 = tv2 * gxd - let e3 = Fp.eql(tv2, gx1); // 34. e3 = tv2 == gx1 - let xn = Fp.cmov(x2n, x1n, e3); // 35. xn = CMOV(x2n, x1n, e3) # If e3, x = x1, else x = x2 - let y = Fp.cmov(y2, y1, e3); // 36. y = CMOV(y2, y1, e3) # If e3, y = y1, else y = y2 - let e4 = Fp.isOdd!(y); // 37. e4 = sgn0(y) == 1 # Fix sign of y - y = Fp.cmov(y, Fp.neg(y), e3 !== e4); // 38. y = CMOV(y, -y, e3 XOR e4) - return { xMn: xn, xMd: xd, yMn: y, yMd: _1n }; // 39. return (xn, xd, y, 1) -} - -// sgn0(c1) MUST equal 0 -const ELL2_C1_EDWARDS = /* @__PURE__ */ (() => FpSqrtEven(Fp, Fp.neg(BigInt(486664))))(); -function map_to_curve_elligator2_edwards25519(u: bigint) { - // 1. (xMn, xMd, yMn, yMd) = map_to_curve_elligator2_curve25519(u) - const { xMn, xMd, yMn, yMd } = _map_to_curve_elligator2_curve25519(u); - // map_to_curve_elligator2_curve25519(u) - let xn = Fp.mul(xMn, yMd); // 2. xn = xMn * yMd - xn = Fp.mul(xn, ELL2_C1_EDWARDS); // 3. xn = xn * c1 - let xd = Fp.mul(xMd, yMn); // 4. xd = xMd * yMn # xn / xd = c1 * xM / yM - let yn = Fp.sub(xMn, xMd); // 5. yn = xMn - xMd - // 6. yd = xMn + xMd # (n / d - 1) / (n / d + 1) = (n - d) / (n + d) - let yd = Fp.add(xMn, xMd); - let tv1 = Fp.mul(xd, yd); // 7. tv1 = xd * yd - let e = Fp.eql(tv1, Fp.ZERO); // 8. e = tv1 == 0 - xn = Fp.cmov(xn, Fp.ZERO, e); // 9. xn = CMOV(xn, 0, e) - xd = Fp.cmov(xd, Fp.ONE, e); // 10. xd = CMOV(xd, 1, e) - yn = Fp.cmov(yn, Fp.ONE, e); // 11. yn = CMOV(yn, 1, e) - yd = Fp.cmov(yd, Fp.ONE, e); // 12. yd = CMOV(yd, 1, e) - const [xd_inv, yd_inv] = FpInvertBatch(Fp, [xd, yd], true); // batch division - // Noble normalizes the RFC rational representation to affine `{ x, y }` - // before returning from the internal helper. - return { x: Fp.mul(xn, xd_inv), y: Fp.mul(yn, yd_inv) }; // 13. return (xn, xd, yn, yd) -} - -/** - * Hashing to ed25519 points / field. RFC 9380 methods. - * Public `mapToCurve()` returns the cofactor-cleared subgroup point; the - * internal map callback below consumes one field element bigint, not `[bigint]`. - * @example - * Hash one message onto the ed25519 curve. - * - * ```ts - * const point = ed25519_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const ed25519_hasher: H2CHasher = /* @__PURE__ */ (() => - createHasher( - ed25519_Point, - (scalars: bigint[]) => map_to_curve_elligator2_edwards25519(scalars[0]), - { - DST: 'edwards25519_XMD:SHA-512_ELL2_RO_', - encodeDST: 'edwards25519_XMD:SHA-512_ELL2_NU_', - p: ed25519_CURVE_p, - m: 1, - k: 128, - expand: 'xmd', - hash: sha512, - } - ))(); - -// √(-1) aka √(a) aka 2^((p-1)/4) -const SQRT_M1 = ED25519_SQRT_M1; -// √(ad - 1) -const SQRT_AD_MINUS_ONE = /* @__PURE__ */ BigInt( - '25063068953384623474111414158702152701244531502492656460079210482610430750235' -); -// 1 / √(a-d) -const INVSQRT_A_MINUS_D = /* @__PURE__ */ BigInt( - '54469307008909316920995813868745141605393597292927456921205312896311721017578' -); -// 1-d² -const ONE_MINUS_D_SQ = /* @__PURE__ */ BigInt( - '1159843021668779879193775521855586647937357759715417654439879720876111806838' -); -// (d-1)² -const D_MINUS_ONE_SQ = /* @__PURE__ */ BigInt( - '40440834346308536858101042469323190826248399146238708352240133220865137265952' -); -// `SQRT_RATIO_M1(1, number)` specialization. Returns `{ isValid, value }`, -// where non-squares get the nonnegative `sqrt(SQRT_M1 / number)` branch. -const invertSqrt = (number: bigint) => uvRatio(_1n, number); - -const MAX_255B = /* @__PURE__ */ BigInt( - '0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' -); -// RFC 9496 §4.3.4 MAP parser: masks bit 255 and reduces modulo p for element -// derivation. The decode path has the opposite contract and rejects that bit. -const bytes255ToNumberLE = (bytes: TArg) => - Fp.create(bytesToNumberLE(bytes) & MAX_255B); - -/** - * Computes Elligator map for Ristretto255. - * Primary formula source is RFC 9496 §4.3.4 MAP; RFC 9380 Appendix B builds - * `hash_to_ristretto255` on top of this helper. - * Returns an internal Edwards representative, not a public `_RistrettoPoint`. - */ -function calcElligatorRistrettoMap(r0: bigint): EdwardsPoint { - const { d } = ed25519_CURVE; - const P = ed25519_CURVE_p; - const mod = (n: bigint) => Fp.create(n); - const r = mod(SQRT_M1 * r0 * r0); // 1 - const Ns = mod((r + _1n) * ONE_MINUS_D_SQ); // 2 - let c = BigInt(-1); // 3 - const D = mod((c - d * r) * mod(r + d)); // 4 - let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D); // 5 - let s_ = mod(s * r0); // 6 - if (!isNegativeLE(s_, P)) s_ = mod(-s_); - if (!Ns_D_is_sq) s = s_; // 7 - if (!Ns_D_is_sq) c = r; // 8 - const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D); // 9 - const s2 = s * s; - const W0 = mod((s + s) * D); // 10 - const W1 = mod(Nt * SQRT_AD_MINUS_ONE); // 11 - const W2 = mod(_1n - s2); // 12 - const W3 = mod(_1n + s2); // 13 - return new ed25519_Point(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); -} - -/** - * Wrapper over Edwards Point for ristretto255. - * - * Each ed25519/EdwardsPoint has 8 different equivalent points. This can be - * a source of bugs for protocols like ring signatures. Ristretto was created to solve this. - * Ristretto point operates in X:Y:Z:T extended coordinates like EdwardsPoint, - * but it should work in its own namespace: do not combine those two. - * See [RFC9496](https://www.rfc-editor.org/rfc/rfc9496). - */ -class _RistrettoPoint extends PrimeEdwardsPoint<_RistrettoPoint> { - // Do NOT change syntax: the following gymnastics is done, - // because typescript strips comments, which makes bundlers disable tree-shaking. - // prettier-ignore - static BASE: _RistrettoPoint = - /* @__PURE__ */ (() => new _RistrettoPoint(ed25519_Point.BASE))(); - // prettier-ignore - static ZERO: _RistrettoPoint = - /* @__PURE__ */ (() => new _RistrettoPoint(ed25519_Point.ZERO))(); - // prettier-ignore - static Fp: IField = - /* @__PURE__ */ (() => Fp)(); - // prettier-ignore - static Fn: IField = - /* @__PURE__ */ (() => Fn)(); - - constructor(ep: EdwardsPoint) { - super(ep); - } - - /** - * Create one Ristretto255 point from affine Edwards coordinates. - * This wraps the internal Edwards representative directly and is not a - * canonical ristretto255 decoding path. - * Use `toBytes()` / `fromBytes()` if canonical ristretto255 bytes matter. - */ - static fromAffine(ap: AffinePoint): _RistrettoPoint { - return new _RistrettoPoint(ed25519_Point.fromAffine(ap)); - } - - protected assertSame(other: _RistrettoPoint): void { - if (!(other instanceof _RistrettoPoint)) throw new Error('RistrettoPoint expected'); - } - - protected init(ep: EdwardsPoint): _RistrettoPoint { - return new _RistrettoPoint(ep); - } - - static fromBytes(bytes: TArg): _RistrettoPoint { - abytes(bytes, 32); - const { a, d } = ed25519_CURVE; - const P = ed25519_CURVE_p; - const mod = (n: bigint) => Fp.create(n); - const s = bytes255ToNumberLE(bytes); - // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. - // 3. Check that s is non-negative, or else abort - if (!equalBytes(Fp.toBytes(s), bytes) || isNegativeLE(s, P)) - throw new Error('invalid ristretto255 encoding 1'); - const s2 = mod(s * s); - const u1 = mod(_1n + a * s2); // 4 (a is -1) - const u2 = mod(_1n - a * s2); // 5 - const u1_2 = mod(u1 * u1); - const u2_2 = mod(u2 * u2); - const v = mod(a * d * u1_2 - u2_2); // 6 - const { isValid, value: I } = invertSqrt(mod(v * u2_2)); // 7 - const Dx = mod(I * u2); // 8 - const Dy = mod(I * Dx * v); // 9 - let x = mod((s + s) * Dx); // 10 - if (isNegativeLE(x, P)) x = mod(-x); // 10 - const y = mod(u1 * Dy); // 11 - const t = mod(x * y); // 12 - if (!isValid || isNegativeLE(t, P) || y === _0n) - throw new Error('invalid ristretto255 encoding 2'); - return new _RistrettoPoint(new ed25519_Point(x, y, _1n, t)); - } - - /** - * Converts ristretto-encoded string to ristretto point. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-decode). - * @param hex - Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding - */ - static fromHex(hex: string): _RistrettoPoint { - return _RistrettoPoint.fromBytes(hexToBytes(hex)); - } - - /** - * Encodes ristretto point to Uint8Array. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-encode). - */ - toBytes(): TRet { - let { X, Y, Z, T } = this.ep; - const P = ed25519_CURVE_p; - const mod = (n: bigint) => Fp.create(n); - const u1 = mod(mod(Z + Y) * mod(Z - Y)); // 1 - const u2 = mod(X * Y); // 2 - // Square root always exists - const u2sq = mod(u2 * u2); - const { value: invsqrt } = invertSqrt(mod(u1 * u2sq)); // 3 - const D1 = mod(invsqrt * u1); // 4 - const D2 = mod(invsqrt * u2); // 5 - const zInv = mod(D1 * D2 * T); // 6 - let D: bigint; // 7 - if (isNegativeLE(T * zInv, P)) { - let _x = mod(Y * SQRT_M1); - let _y = mod(X * SQRT_M1); - X = _x; - Y = _y; - D = mod(D1 * INVSQRT_A_MINUS_D); - } else { - D = D2; // 8 - } - if (isNegativeLE(X * zInv, P)) Y = mod(-Y); // 9 - let s = mod((Z - Y) * D); // 10 (check footer's note, no sqrt(-a)) - if (isNegativeLE(s, P)) s = mod(-s); - return Fp.toBytes(s) as TRet; // 11 - } - - /** - * Compares two Ristretto points. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-equals). - */ - equals(other: _RistrettoPoint): boolean { - this.assertSame(other); - const { X: X1, Y: Y1 } = this.ep; - const { X: X2, Y: Y2 } = other.ep; - const mod = (n: bigint) => Fp.create(n); - // (x1 * y2 == y1 * x2) | (y1 * y2 == x1 * x2) - const one = mod(X1 * Y2) === mod(Y1 * X2); - const two = mod(Y1 * Y2) === mod(X1 * X2); - return one || two; - } - - is0(): boolean { - return this.equals(_RistrettoPoint.ZERO); - } -} -Object.freeze(_RistrettoPoint.BASE); -Object.freeze(_RistrettoPoint.ZERO); -Object.freeze(_RistrettoPoint.prototype); -Object.freeze(_RistrettoPoint); - -/** Prime-order Ristretto255 group bundle. */ -export const ristretto255: { - Point: typeof _RistrettoPoint; -} = /* @__PURE__ */ Object.freeze({ Point: _RistrettoPoint }); - -/** - * Hashing to ristretto255 points / field. RFC 9380 methods. - * `hashToCurve()` is RFC 9380 Appendix B, `deriveToCurve()` is the RFC 9496 - * §4.3.4 element-derivation building block, and `hashToScalar()` is a - * library-specific helper for OPRF-style use. - * @example - * Hash one message onto ristretto255. - * - * ```ts - * const point = ristretto255_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const ristretto255_hasher: H2CHasherBase = Object.freeze({ - Point: _RistrettoPoint, - /** - * Spec: https://www.rfc-editor.org/rfc/rfc9380.html#name-hashing-to-ristretto255. Caveats: - * * There are no test vectors - * * encodeToCurve / mapToCurve is undefined - * * mapToCurve would be `calcElligatorRistrettoMap(scalars[0])`, not ristretto255_map! - * * hashToScalar is undefined too, so we just use OPRF implementation - * * We cannot re-use 'createHasher', because ristretto255_map is different algorithm/RFC - (os2ip -> bytes255ToNumberLE) - * * mapToCurve == calcElligatorRistrettoMap, hashToCurve == ristretto255_map - * * hashToScalar is undefined in RFC9380 for ristretto, so we use the OPRF - version here. Using `bytes255ToNumblerLE` will create a different result - if we use `bytes255ToNumberLE` as os2ip - * * current version is closest to spec. - */ - hashToCurve(msg: TArg, options?: TArg): _RistrettoPoint { - // == 'hash_to_ristretto255' - // Preserve explicit empty/invalid DST overrides so expand_message_xmd() can reject them. - const DST = options?.DST === undefined ? 'ristretto255_XMD:SHA-512_R255MAP_RO_' : options.DST; - const xmd = expand_message_xmd(msg, DST, 64, sha512); - // NOTE: RFC 9380 incorrectly calls this function `ristretto255_map`. - // In RFC 9496, `map` was the per-point function inside the construction. - // That also led to confusion that `ristretto255_map` is `mapToCurve`. - // It is not: it is the older hash-to-curve construction. - return ristretto255_hasher.deriveToCurve!(xmd); - }, - hashToScalar(msg: TArg, options: TArg = { DST: _DST_scalar }) { - const xmd = expand_message_xmd(msg, options.DST, 64, sha512); - return Fn.create(bytesToNumberLE(xmd)); - }, - /** - * HashToCurve-like construction based on RFC 9496 (Element Derivation). - * Converts 64 uniform random bytes into a curve point. - * - * WARNING: This represents an older hash-to-curve construction from before - * RFC 9380 was finalized. - * It was later reused as a component in the newer - * `hash_to_ristretto255` function defined in RFC 9380. - */ - deriveToCurve(bytes: TArg): _RistrettoPoint { - // https://www.rfc-editor.org/rfc/rfc9496.html#name-element-derivation - abytes(bytes, 64); - const r1 = bytes255ToNumberLE(bytes.subarray(0, 32)); - const R1 = calcElligatorRistrettoMap(r1); - const r2 = bytes255ToNumberLE(bytes.subarray(32, 64)); - const R2 = calcElligatorRistrettoMap(r2); - return new _RistrettoPoint(R1.add(R2)); - }, -}); - -/** - * ristretto255 OPRF/VOPRF/POPRF bundle, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over ristretto255. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = ristretto255_oprf.oprf.generateKeyPair(); - * const blind = ristretto255_oprf.oprf.blind(input); - * const evaluated = ristretto255_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = ristretto255_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export const ristretto255_oprf: TRet = /* @__PURE__ */ (() => - createOPRF({ - name: 'ristretto255-SHA512', - Point: _RistrettoPoint, - hash: sha512, - hashToGroup: ristretto255_hasher.hashToCurve, - hashToScalar: ristretto255_hasher.hashToScalar, - }))(); -/** - * FROST threshold signatures over ristretto255. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 ristretto255 signing. - * - * ```ts - * const alice = ristretto255_FROST.Identifier.derive('alice@example.com'); - * const bob = ristretto255_FROST.Identifier.derive('bob@example.com'); - * const carol = ristretto255_FROST.Identifier.derive('carol@example.com'); - * const deal = ristretto255_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const ristretto255_FROST: TRet = /* @__PURE__ */ (() => - createFROST({ - name: 'FROST-RISTRETTO255-SHA512-v1', - Point: _RistrettoPoint, - validatePoint: (p) => { - // Prime-order wrappers are torsion-free at the abstract-group level. - p.assertValidity(); - }, - hash: sha512, - }))(); - -/** - * Weird / bogus points, useful for debugging. - * All 8 ed25519 points of 8-torsion subgroup can be generated from the point - * T = `26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05`. - * The subgroup generated by `T` is `{ O, T, 2T, 3T, 4T, 5T, 6T, 7T }`; the - * array below is that set, not the powers in that exact index order. - * @example - * Decode one known torsion point for debugging. - * - * ```ts - * import { ED25519_TORSION_SUBGROUP, ed25519 } from '@noble/curves/ed25519.js'; - * const point = ed25519.Point.fromHex(ED25519_TORSION_SUBGROUP[1]); - * ``` - */ -export const ED25519_TORSION_SUBGROUP: readonly string[] = /* @__PURE__ */ Object.freeze([ - '0100000000000000000000000000000000000000000000000000000000000000', - 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a', - '0000000000000000000000000000000000000000000000000000000000000080', - '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05', - 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f', - '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85', - '0000000000000000000000000000000000000000000000000000000000000000', - 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa', -]); diff --git a/node_modules/@noble/curves/src/ed448.ts b/node_modules/@noble/curves/src/ed448.ts deleted file mode 100644 index 9580dc1..0000000 --- a/node_modules/@noble/curves/src/ed448.ts +++ /dev/null @@ -1,695 +0,0 @@ -/** - * Edwards448 (also called Goldilocks) curve with following addons: - * - X448 ECDH - * - Decaf cofactor elimination - * - Elligator hash-to-group / point indistinguishability - * Conforms to RFC 8032 https://www.rfc-editor.org/rfc/rfc8032.html#section-5.2 - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { shake256 } from '@noble/hashes/sha3.js'; -import { concatBytes, hexToBytes, createHasher as wrapConstructor } from '@noble/hashes/utils.js'; -import type { AffinePoint } from './abstract/curve.ts'; -import { - eddsa, - edwards, - PrimeEdwardsPoint, - type EdDSA, - type EdDSAOpts, - type EdwardsOpts, - type EdwardsPoint, - type EdwardsPointCons, -} from './abstract/edwards.ts'; -import { createFROST, type FROST } from './abstract/frost.ts'; -import { - _DST_scalar, - createHasher, - expand_message_xof, - type H2CDSTOpts, - type H2CHasher, - type H2CHasherBase, -} from './abstract/hash-to-curve.ts'; -import { Field, FpInvertBatch, isNegativeLE, mod, pow2, type IField } from './abstract/modular.ts'; -import { montgomery, type MontgomeryECDH } from './abstract/montgomery.ts'; -import { createOPRF, type OPRF } from './abstract/oprf.ts'; -import { - abytes, - asciiToBytes, - bytesToNumberLE, - equalBytes, - type TArg, - type TRet, -} from './utils.ts'; - -// edwards448 curve -// a = 1n -// d = Fp.neg(39081n) -// Finite field 2n**448n - 2n**224n - 1n -// Subgroup order -// 2n**446n - 13818066809895115352007386748515426880336692474882178609894547503885n -const ed448_CURVE_p = /* @__PURE__ */ BigInt( - '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffff' -); -const ed448_CURVE: EdwardsOpts = /* @__PURE__ */ (() => ({ - p: ed448_CURVE_p, - n: BigInt( - '0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffff7cca23e9c44edb49aed63690216cc2728dc58f552378c292ab5844f3' - ), - h: BigInt(4), - a: BigInt(1), - d: BigInt( - '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffff6756' - ), - Gx: BigInt( - '0x4f1970c66bed0ded221d15a622bf36da9e146570470f1767ea6de324a3d3a46412ae1af72ab66511433b80e18b00938e2626a82bc70cc05e' - ), - Gy: BigInt( - '0x693f46716eb6bc248876203756c9c7624bea73736ca3984087789c1e05a0c2d73ad3ff1ce67c39c4fdbd132c4ed7c8ad9808795bf230fa14' - ), -}))(); - -// This is not RFC 8032 edwards448 / Goldilocks (`ed448` below, d = -39081). -// It is NIST SP 800-186 §3.2.3.3 E448, the Curve448-isomorphic Edwards model -// also described in draft-ietf-lwig-curve-representations-23 Appendix M, with -// d = 39082/39081 and Gy = 3/2. -// RFC 7748's literal Edwards point / birational map are wrong here: the literal -// point is the wrong-sign (Gx, -Gy) order-2*n variant. Keep the corrected -// prime-order (Gx, Gy) base so Point.BASE stays a subgroup generator, which is -// what noble's generic Edwards API expects. -const E448_CURVE: EdwardsOpts = /* @__PURE__ */ (() => - Object.assign({}, ed448_CURVE, { - d: BigInt( - '0xd78b4bdc7f0daf19f24f38c29373a2ccad46157242a50f37809b1da3412a12e79ccc9c81264cfe9ad080997058fb61c4243cc32dbaa156b9' - ), - Gx: BigInt( - '0x79a70b2b70400553ae7c9df416c792c61128751ac92969240c25a07d728bdc93e21f7787ed6972249de732f38496cd11698713093e9c04fc' - ), - Gy: BigInt( - '0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffff80000000000000000000000000000000000000000000000000000001' - ), - }))(); - -const shake256_114 = /* @__PURE__ */ wrapConstructor(() => shake256.create({ dkLen: 114 })); -const shake256_64 = /* @__PURE__ */ wrapConstructor(() => shake256.create({ dkLen: 64 })); - -// prettier-ignore -const _1n = /* @__PURE__ */ BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3), _4n = /* @__PURE__ */ BigInt(4), _11n = /* @__PURE__ */ BigInt(11); -// prettier-ignore -const _22n = /* @__PURE__ */ BigInt(22), _44n = /* @__PURE__ */ BigInt(44), _88n = /* @__PURE__ */ BigInt(88), _223n = /* @__PURE__ */ BigInt(223); - -// powPminus3div4 calculates z = x^k mod p, where k = (p-3)/4. -// Used for efficient square root calculation. -// ((P-3)/4).toString(2) would produce bits [223x 1, 0, 222x 1] -function ed448_pow_Pminus3div4(x: bigint): bigint { - const P = ed448_CURVE_p; - const b2 = (x * x * x) % P; - const b3 = (b2 * b2 * x) % P; - const b6 = (pow2(b3, _3n, P) * b3) % P; - const b9 = (pow2(b6, _3n, P) * b3) % P; - const b11 = (pow2(b9, _2n, P) * b2) % P; - const b22 = (pow2(b11, _11n, P) * b11) % P; - const b44 = (pow2(b22, _22n, P) * b22) % P; - const b88 = (pow2(b44, _44n, P) * b44) % P; - const b176 = (pow2(b88, _88n, P) * b88) % P; - const b220 = (pow2(b176, _44n, P) * b44) % P; - const b222 = (pow2(b220, _2n, P) * b2) % P; - const b223 = (pow2(b222, _1n, P) * x) % P; - return (pow2(b223, _223n, P) * b222) % P; -} - -// Mutates and returns the provided buffer in place. The final `bytes[56] = 0` -// write is the Ed448 path; for 56-byte X448 inputs it is an out-of-bounds no-op. -function adjustScalarBytes(bytes: TArg): TRet { - // Section 5: Likewise, for X448, set the two least significant bits of the first byte to 0, - bytes[0] &= 252; // 0b11111100 - // and the most significant bit of the last byte to 1. - bytes[55] |= 128; // 0b10000000 - // NOTE: is NOOP for 56 bytes scalars (X25519/X448) - bytes[56] = 0; // Byte outside of group (456 buts vs 448 bits) - return bytes as TRet; -} - -// Constant-time Ed448 decode helper for RFC 8032 §5.2.3 steps 2-3. Unlike -// `SQRT_RATIO_M1`, the returned `value` only has the documented meaning when -// `isValid` is true. -function uvRatio(u: bigint, v: bigint): { isValid: boolean; value: bigint } { - const P = ed448_CURVE_p; - // https://www.rfc-editor.org/rfc/rfc8032#section-5.2.3 - // To compute the square root of (u/v), the first step is to compute the - // candidate root x = (u/v)^((p+1)/4). This can be done using the - // following trick, to use a single modular powering for both the - // inversion of v and the square root: - // x = (u/v)^((p+1)/4) = u³v(u⁵v³)^((p-3)/4) (mod p) - const u2v = mod(u * u * v, P); // u²v - const u3v = mod(u2v * u, P); // u³v - const u5v3 = mod(u3v * u2v * v, P); // u⁵v³ - const root = ed448_pow_Pminus3div4(u5v3); - const x = mod(u3v * root, P); - // Verify that root is exists - const x2 = mod(x * x, P); // x² - // If vx² = u, the recovered x-coordinate is x. Otherwise, no - // square root exists, and the decoding fails. - return { isValid: mod(x2 * v, P) === u, value: x }; -} - -// Finite field 2n**448n - 2n**224n - 1n -// RFC 8032 encodes Ed448 field/scalar elements in 57 bytes even though field -// values fit in 448 bits and scalars in 446 bits. Noble models that with a -// 456-bit storage width so the final-octet x-sign bit (bit 455) still fits in -// the shared little-endian container. -const Fp = /* @__PURE__ */ (() => Field(ed448_CURVE_p, { BITS: 456, isLE: true }))(); -// Same 57-byte container shape as `Fp`; canonical scalar encodings still have -// the top ten bits clear per RFC 8032. -const Fn = /* @__PURE__ */ (() => Field(ed448_CURVE.n, { BITS: 456, isLE: true }))(); -// Generic 56-byte field shape used by decaf448 and raw X448 u-coordinates. -// Plain `Field` decoding stays canonical here, so callers that want RFC 7748's -// modulo-p acceptance must reduce externally. -const Fp448 = /* @__PURE__ */ (() => Field(ed448_CURVE_p, { BITS: 448, isLE: true }))(); -// Strict 56-byte scalar parser matching RFC 9496's recommended canonical form. -const Fn448 = /* @__PURE__ */ (() => Field(ed448_CURVE.n, { BITS: 448, isLE: true }))(); - -// SHAKE256(dom4(phflag,context)||x, 114) -// RFC 8032 `dom4` prefix. Empty contexts are valid; the accepted length range -// is 0..255 octets inclusive. -function dom4(data: TArg, ctx: TArg, phflag: boolean): TRet { - if (ctx.length > 255) throw new Error('context must be smaller than 255, got: ' + ctx.length); - return concatBytes( - asciiToBytes('SigEd448'), - new Uint8Array([phflag ? 1 : 0, ctx.length]), - ctx, - data - ) as TRet; -} -const ed448_Point = /* @__PURE__ */ edwards(ed448_CURVE, { Fp, Fn, uvRatio }); - -// Shared internal factory for both `ed448` and `ed448ph`; callers are only -// expected to override narrow family options such as prehashing. -function ed4(opts: TArg) { - return eddsa( - ed448_Point, - shake256_114, - Object.assign({ adjustScalarBytes, domain: dom4 }, opts as EdDSAOpts) - ); -} - -/** - * ed448 EdDSA curve and methods. - * @example - * Generate one Ed448 keypair, sign a message, and verify it. - * - * ```js - * import { ed448 } from '@noble/curves/ed448.js'; - * const { secretKey, publicKey } = ed448.keygen(); - * // const publicKey = ed448.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed448.sign(msg, secretKey); - * const isValid = ed448.verify(sig, msg, publicKey); - * ``` - */ -export const ed448: EdDSA = /* @__PURE__ */ ed4({}); - -// There is no ed448ctx, since ed448 supports ctx by default -/** - * Prehashed version of ed448. See {@link ed448} - * @example - * Use the prehashed Ed448 variant for one message. - * - * ```ts - * const { secretKey, publicKey } = ed448ph.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = ed448ph.sign(msg, secretKey); - * const isValid = ed448ph.verify(sig, msg, publicKey); - * ``` - */ -export const ed448ph: EdDSA = /* @__PURE__ */ ed4({ prehash: shake256_64 }); -/** - * E448 here is NIST SP 800-186 §3.2.3.3 E448, the Edwards representation of - * Curve448, not RFC 8032 edwards448 / Goldilocks. - * Goldilocks is the separate 4-isogenous curve exposed as `ed448`. - * We keep the corrected prime-order base here; RFC 7748's literal Edwards - * point / map are wrong for this curve model, and the literal point is the - * wrong-sign order-2*n variant. - * @param X - Projective X coordinate. - * @param Y - Projective Y coordinate. - * @param Z - Projective Z coordinate. - * @param T - Projective T coordinate. - * @example - * Multiply the E448 base point. - * - * ```ts - * const point = E448.BASE.multiply(2n); - * ``` - */ -export const E448: EdwardsPointCons = /* @__PURE__ */ edwards(E448_CURVE); - -/** - * ECDH using curve448 aka x448. - * The wrapper aborts on all-zero shared secrets by default, and seeded - * `keygen(seed)` reuses the provided 56-byte seed buffer instead of copying it. - * - * @example - * Derive one shared secret between two X448 peers. - * - * ```js - * import { x448 } from '@noble/curves/ed448.js'; - * const alice = x448.keygen(); - * const bob = x448.keygen(); - * const shared = x448.getSharedSecret(alice.secretKey, bob.publicKey); - * ``` - */ -export const x448: TRet = /* @__PURE__ */ (() => { - const P = ed448_CURVE_p; - return montgomery({ - P, - type: 'x448', - powPminus2: (x: bigint): bigint => { - const Pminus3div4 = ed448_pow_Pminus3div4(x); - const Pminus3 = pow2(Pminus3div4, _2n, P); - return mod(Pminus3 * x, P); // Pminus3 * x = Pminus2 - }, - adjustScalarBytes, - }); -})(); - -// Hash To Curve Elligator2 Map -// 1. c1 = (q - 3) / 4 # Integer arithmetic -const ELL2_C1 = /* @__PURE__ */ (() => (ed448_CURVE_p - BigInt(3)) / BigInt(4))(); -const ELL2_J = /* @__PURE__ */ BigInt(156326); - -// Returns RFC 9380 Appendix G.2.3 rational Montgomery numerators/denominators -// `{ xn, xd, yn, yd }`, not an affine point. -function map_to_curve_elligator2_curve448(u: bigint) { - let tv1 = Fp.sqr(u); // 1. tv1 = u^2 - let e1 = Fp.eql(tv1, Fp.ONE); // 2. e1 = tv1 == 1 - tv1 = Fp.cmov(tv1, Fp.ZERO, e1); // 3. tv1 = CMOV(tv1, 0, e1) # If Z * u^2 == -1, set tv1 = 0 - let xd = Fp.sub(Fp.ONE, tv1); // 4. xd = 1 - tv1 - let x1n = Fp.neg(ELL2_J); // 5. x1n = -J - let tv2 = Fp.sqr(xd); // 6. tv2 = xd^2 - let gxd = Fp.mul(tv2, xd); // 7. gxd = tv2 * xd # gxd = xd^3 - let gx1 = Fp.mul(tv1, Fp.neg(ELL2_J)); // 8. gx1 = -J * tv1 # x1n + J * xd - gx1 = Fp.mul(gx1, x1n); // 9. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd - gx1 = Fp.add(gx1, tv2); // 10. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 - gx1 = Fp.mul(gx1, x1n); // 11. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 - let tv3 = Fp.sqr(gxd); // 12. tv3 = gxd^2 - tv2 = Fp.mul(gx1, gxd); // 13. tv2 = gx1 * gxd # gx1 * gxd - tv3 = Fp.mul(tv3, tv2); // 14. tv3 = tv3 * tv2 # gx1 * gxd^3 - let y1 = Fp.pow(tv3, ELL2_C1); // 15. y1 = tv3^c1 # (gx1 * gxd^3)^((p - 3) / 4) - y1 = Fp.mul(y1, tv2); // 16. y1 = y1 * tv2 # gx1 * gxd * (gx1 * gxd^3)^((p - 3) / 4) - // 17. x2n = -tv1 * x1n # x2 = x2n / xd = -1 * u^2 * x1n / xd - let x2n = Fp.mul(x1n, Fp.neg(tv1)); - let y2 = Fp.mul(y1, u); // 18. y2 = y1 * u - y2 = Fp.cmov(y2, Fp.ZERO, e1); // 19. y2 = CMOV(y2, 0, e1) - tv2 = Fp.sqr(y1); // 20. tv2 = y1^2 - tv2 = Fp.mul(tv2, gxd); // 21. tv2 = tv2 * gxd - let e2 = Fp.eql(tv2, gx1); // 22. e2 = tv2 == gx1 - let xn = Fp.cmov(x2n, x1n, e2); // 23. xn = CMOV(x2n, x1n, e2) # If e2, x = x1, else x = x2 - let y = Fp.cmov(y2, y1, e2); // 24. y = CMOV(y2, y1, e2) # If e2, y = y1, else y = y2 - let e3 = Fp.isOdd(y); // 25. e3 = sgn0(y) == 1 # Fix sign of y - y = Fp.cmov(y, Fp.neg(y), e2 !== e3); // 26. y = CMOV(y, -y, e2 XOR e3) - return { xn, xd, yn: y, yd: Fp.ONE }; // 27. return (xn, xd, y, 1) -} - -// Returns affine `{ x, y }` after inverting the Appendix G.2.4 denominators. -function map_to_curve_elligator2_edwards448(u: bigint) { - // 1. (xn, xd, yn, yd) = map_to_curve_elligator2_curve448(u) - let { xn, xd, yn, yd } = map_to_curve_elligator2_curve448(u); - let xn2 = Fp.sqr(xn); // 2. xn2 = xn^2 - let xd2 = Fp.sqr(xd); // 3. xd2 = xd^2 - let xd4 = Fp.sqr(xd2); // 4. xd4 = xd2^2 - let yn2 = Fp.sqr(yn); // 5. yn2 = yn^2 - let yd2 = Fp.sqr(yd); // 6. yd2 = yd^2 - let xEn = Fp.sub(xn2, xd2); // 7. xEn = xn2 - xd2 - let tv2 = Fp.sub(xEn, xd2); // 8. tv2 = xEn - xd2 - xEn = Fp.mul(xEn, xd2); // 9. xEn = xEn * xd2 - xEn = Fp.mul(xEn, yd); // 10. xEn = xEn * yd - xEn = Fp.mul(xEn, yn); // 11. xEn = xEn * yn - xEn = Fp.mul(xEn, _4n); // 12. xEn = xEn * 4 - tv2 = Fp.mul(tv2, xn2); // 13. tv2 = tv2 * xn2 - tv2 = Fp.mul(tv2, yd2); // 14. tv2 = tv2 * yd2 - let tv3 = Fp.mul(yn2, _4n); // 15. tv3 = 4 * yn2 - let tv1 = Fp.add(tv3, yd2); // 16. tv1 = tv3 + yd2 - tv1 = Fp.mul(tv1, xd4); // 17. tv1 = tv1 * xd4 - let xEd = Fp.add(tv1, tv2); // 18. xEd = tv1 + tv2 - tv2 = Fp.mul(tv2, xn); // 19. tv2 = tv2 * xn - let tv4 = Fp.mul(xn, xd4); // 20. tv4 = xn * xd4 - let yEn = Fp.sub(tv3, yd2); // 21. yEn = tv3 - yd2 - yEn = Fp.mul(yEn, tv4); // 22. yEn = yEn * tv4 - yEn = Fp.sub(yEn, tv2); // 23. yEn = yEn - tv2 - tv1 = Fp.add(xn2, xd2); // 24. tv1 = xn2 + xd2 - tv1 = Fp.mul(tv1, xd2); // 25. tv1 = tv1 * xd2 - tv1 = Fp.mul(tv1, xd); // 26. tv1 = tv1 * xd - tv1 = Fp.mul(tv1, yn2); // 27. tv1 = tv1 * yn2 - tv1 = Fp.mul(tv1, BigInt(-2)); // 28. tv1 = -2 * tv1 - let yEd = Fp.add(tv2, tv1); // 29. yEd = tv2 + tv1 - tv4 = Fp.mul(tv4, yd2); // 30. tv4 = tv4 * yd2 - yEd = Fp.add(yEd, tv4); // 31. yEd = yEd + tv4 - tv1 = Fp.mul(xEd, yEd); // 32. tv1 = xEd * yEd - let e = Fp.eql(tv1, Fp.ZERO); // 33. e = tv1 == 0 - xEn = Fp.cmov(xEn, Fp.ZERO, e); // 34. xEn = CMOV(xEn, 0, e) - xEd = Fp.cmov(xEd, Fp.ONE, e); // 35. xEd = CMOV(xEd, 1, e) - yEn = Fp.cmov(yEn, Fp.ONE, e); // 36. yEn = CMOV(yEn, 1, e) - yEd = Fp.cmov(yEd, Fp.ONE, e); // 37. yEd = CMOV(yEd, 1, e) - - const inv = FpInvertBatch(Fp, [xEd, yEd], true); // batch division - return { x: Fp.mul(xEn, inv[0]), y: Fp.mul(yEn, inv[1]) }; // 38. return (xEn, xEd, yEn, yEd) -} - -/** - * Hashing / encoding to ed448 points / field. RFC 9380 methods. - * Public `mapToCurve()` consumes one field element bigint for `m = 1`, and RFC - * Appendix J vectors use the special `QUUX-V01-*` test DST overrides rather - * than the default suite IDs below. - * @example - * Hash one message onto the ed448 curve. - * - * ```ts - * const point = ed448_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const ed448_hasher: H2CHasher = /* @__PURE__ */ (() => - createHasher(ed448_Point, (scalars: bigint[]) => map_to_curve_elligator2_edwards448(scalars[0]), { - DST: 'edwards448_XOF:SHAKE256_ELL2_RO_', - encodeDST: 'edwards448_XOF:SHAKE256_ELL2_NU_', - p: ed448_CURVE_p, - m: 1, - k: 224, - expand: 'xof', - hash: shake256, - }))(); -/** - * FROST threshold signatures over ed448. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 ed448 signing. - * - * ```ts - * const alice = ed448_FROST.Identifier.derive('alice@example.com'); - * const bob = ed448_FROST.Identifier.derive('bob@example.com'); - * const carol = ed448_FROST.Identifier.derive('carol@example.com'); - * const deal = ed448_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const ed448_FROST: TRet = /* @__PURE__ */ (() => - createFROST({ - name: 'FROST-ED448-SHAKE256-v1', - Point: ed448_Point, - validatePoint: (p) => { - p.assertValidity(); - if (!p.isTorsionFree()) throw new Error('bad point: not torsion-free'); - }, - // Group: edwards448 [RFC8032], where Ne = 57 and Ns = 57. - // Fn is 57 bytes, Fp is 57 bytes too - Fn, - hash: shake256_114, - H2: 'SigEd448\0\0', - }))(); - -// 1-d -const ONE_MINUS_D = /* @__PURE__ */ BigInt('39082'); -// 1-2d -const ONE_MINUS_TWO_D = /* @__PURE__ */ BigInt('78163'); -// √(-d) -const SQRT_MINUS_D = /* @__PURE__ */ BigInt( - '98944233647732219769177004876929019128417576295529901074099889598043702116001257856802131563896515373927712232092845883226922417596214' -); -// 1 / √(-d) -const INVSQRT_MINUS_D = /* @__PURE__ */ BigInt( - '315019913931389607337177038330951043522456072897266928557328499619017160722351061360252776265186336876723201881398623946864393857820716' -); -// RFC 9496 `SQRT_RATIO_M1` must return `CT_ABS(s)`, i.e. the nonnegative root. -// Keep this Decaf-local: RFC 9496 decode/encode/map formulas depend on that -// canonical representative, while ordinary Ed448 decoding still uses `uvRatio()` -// plus the public sign bit from RFC 8032. -const sqrtRatioM1 = (u: bigint, v: bigint) => { - const P = ed448_CURVE_p; - const { isValid, value } = uvRatio(u, v); - return { isValid, value: isNegativeLE(value, P) ? Fp448.create(-value) : value }; -}; -const invertSqrt = (number: bigint) => sqrtRatioM1(_1n, number); - -/** - * Elligator map for hash-to-curve of decaf448. - * Primary formula source is RFC 9496 §5.3.4. Step 1 intentionally reduces the - * input modulo `p`, and the return value is the internal Edwards - * representation, not a public decaf encoding. - */ -function calcElligatorDecafMap(r0: bigint): EdwardsPoint { - const { d, p: P } = ed448_CURVE; - const mod = (n: bigint) => Fp448.create(n); - - const r = mod(-(r0 * r0)); // 1 - const u0 = mod(d * (r - _1n)); // 2 - const u1 = mod((u0 + _1n) * (u0 - r)); // 3 - - const { isValid: was_square, value: v } = sqrtRatioM1(ONE_MINUS_TWO_D, mod((r + _1n) * u1)); // 4 - - let v_prime = v; // 5 - if (!was_square) v_prime = mod(r0 * v); - - let sgn = _1n; // 6 - if (!was_square) sgn = mod(-_1n); - - const s = mod(v_prime * (r + _1n)); // 7 - let s_abs = s; - if (isNegativeLE(s, P)) s_abs = mod(-s); - - const s2 = s * s; - const W0 = mod(s_abs * _2n); // 8 - const W1 = mod(s2 + _1n); // 9 - const W2 = mod(s2 - _1n); // 10 - const W3 = mod(v_prime * s * (r - _1n) * ONE_MINUS_TWO_D + sgn); // 11 - return new ed448_Point(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); -} - -// Keep the Decaf448 base representative literal here: deriving it with -// `new _DecafPoint(ed448_Point.BASE).multiplyUnsafe(2)` forces eager WNAF precomputes and -// adds about 100ms to `ed448.js` import time. -const DECAF_BASE_X = /* @__PURE__ */ BigInt( - '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa955555555555555555555555555555555555555555555555555555555' -); -const DECAF_BASE_Y = /* @__PURE__ */ BigInt( - '0xae05e9634ad7048db359d6205086c2b0036ed7a035884dd7b7e36d728ad8c4b80d6565833a2a3098bbbcb2bed1cda06bdaeafbcdea9386ed' -); -const DECAF_BASE_T = /* @__PURE__ */ BigInt( - '0x696d84643374bace9d70983a12aa9d461da74d2d5c35e8d97ba72c3aba4450a5d29274229bd22c1d5e3a6474ee4ffb0e7a9e200a28eee402' -); - -/** - * Each ed448/EdwardsPoint has 4 different equivalent points. This can be - * a source of bugs for protocols like ring signatures. Decaf was created to solve this. - * Decaf point operates in X:Y:Z:T extended coordinates like EdwardsPoint, - * but it should work in its own namespace: do not combine those two. - * See [RFC9496](https://www.rfc-editor.org/rfc/rfc9496). - */ -class _DecafPoint extends PrimeEdwardsPoint<_DecafPoint> { - // The following gymnastics is done because typescript strips comments otherwise - // prettier-ignore - static BASE: _DecafPoint = - /* @__PURE__ */ (() => new _DecafPoint(new ed448_Point(DECAF_BASE_X, DECAF_BASE_Y, _1n, DECAF_BASE_T)))(); - // prettier-ignore - static ZERO: _DecafPoint = - /* @__PURE__ */ (() => new _DecafPoint(ed448_Point.ZERO))(); - // prettier-ignore - static Fp: IField = - /* @__PURE__ */ (() => Fp448)(); - // prettier-ignore - static Fn: IField = - /* @__PURE__ */ (() => Fn448)(); - - constructor(ep: EdwardsPoint) { - super(ep); - } - - /** - * Create one Decaf448 point from affine Edwards coordinates. - * This wraps the internal Edwards representative directly and is not a - * canonical decaf448 decoding path. - * Use `toBytes()` / `fromBytes()` if canonical decaf448 bytes matter. - */ - static fromAffine(ap: AffinePoint): _DecafPoint { - return new _DecafPoint(ed448_Point.fromAffine(ap)); - } - - protected assertSame(other: _DecafPoint): void { - if (!(other instanceof _DecafPoint)) throw new Error('DecafPoint expected'); - } - - protected init(ep: EdwardsPoint): _DecafPoint { - return new _DecafPoint(ep); - } - - static fromBytes(bytes: TArg): _DecafPoint { - abytes(bytes, 56); - const { d, p: P } = ed448_CURVE; - const mod = (n: bigint) => Fp448.create(n); - const s = Fp448.fromBytes(bytes); - - // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. - // 2. Check that s is non-negative, or else abort - if (!equalBytes(Fn448.toBytes(s), bytes) || isNegativeLE(s, P)) - throw new Error('invalid decaf448 encoding 1'); - - const s2 = mod(s * s); // 1 - const u1 = mod(_1n + s2); // 2 - const u1sq = mod(u1 * u1); - const u2 = mod(u1sq - _4n * d * s2); // 3 - - const { isValid, value: invsqrt } = invertSqrt(mod(u2 * u1sq)); // 4 - - let u3 = mod((s + s) * invsqrt * u1 * SQRT_MINUS_D); // 5 - if (isNegativeLE(u3, P)) u3 = mod(-u3); - - const x = mod(u3 * invsqrt * u2 * INVSQRT_MINUS_D); // 6 - const y = mod((_1n - s2) * invsqrt * u1); // 7 - const t = mod(x * y); // 8 - - if (!isValid) throw new Error('invalid decaf448 encoding 2'); - return new _DecafPoint(new ed448_Point(x, y, _1n, t)); - } - - /** - * Converts decaf-encoded string to decaf point. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-decode-2). - * @param hex - Decaf-encoded 56 bytes. Not every 56-byte string is valid decaf encoding - */ - static fromHex(hex: string): _DecafPoint { - return _DecafPoint.fromBytes(hexToBytes(hex)); - } - - /** - * Encodes decaf point to Uint8Array. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-encode-2). - */ - toBytes(): TRet { - const { X, Z, T } = this.ep; - const P = ed448_CURVE.p; - const mod = (n: bigint) => Fp448.create(n); - const u1 = mod(mod(X + T) * mod(X - T)); // 1 - const x2 = mod(X * X); - const { value: invsqrt } = invertSqrt(mod(u1 * ONE_MINUS_D * x2)); // 2 - let ratio = mod(invsqrt * u1 * SQRT_MINUS_D); // 3 - if (isNegativeLE(ratio, P)) ratio = mod(-ratio); - const u2 = mod(INVSQRT_MINUS_D * ratio * Z - T); // 4 - let s = mod(ONE_MINUS_D * invsqrt * X * u2); // 5 - if (isNegativeLE(s, P)) s = mod(-s); - return Fn448.toBytes(s) as TRet; - } - - /** - * Compare one point to another. - * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-equals-2). - */ - equals(other: _DecafPoint): boolean { - this.assertSame(other); - const { X: X1, Y: Y1 } = this.ep; - const { X: X2, Y: Y2 } = other.ep; - // (x1 * y2 == y1 * x2) - return Fp448.create(X1 * Y2) === Fp448.create(Y1 * X2); - } - - is0(): boolean { - return this.equals(_DecafPoint.ZERO); - } -} -Object.freeze(_DecafPoint.BASE); -Object.freeze(_DecafPoint.ZERO); -Object.freeze(_DecafPoint.prototype); -Object.freeze(_DecafPoint); - -/** Prime-order Decaf448 group bundle. */ -export const decaf448: { - Point: typeof _DecafPoint; -} = /* @__PURE__ */ Object.freeze({ Point: _DecafPoint }); - -/** - * Hashing to decaf448 points / field. RFC 9380 methods. - * `hashToCurve()` is RFC 9380 `hash_to_decaf448`, `deriveToCurve()` is RFC - * 9496 element derivation, and `hashToScalar()` is a library helper layered on - * top of RFC 9496 scalar reduction. - * @example - * Hash one message onto decaf448. - * - * ```ts - * const point = decaf448_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const decaf448_hasher: H2CHasherBase = Object.freeze({ - Point: _DecafPoint, - hashToCurve(msg: TArg, options?: TArg): _DecafPoint { - // Preserve explicit empty/invalid DST overrides so expand_message_xof() can reject them. - const DST = options?.DST === undefined ? 'decaf448_XOF:SHAKE256_D448MAP_RO_' : options.DST; - return decaf448_hasher.deriveToCurve!(expand_message_xof(msg, DST, 112, 224, shake256)); - }, - /** - * Warning: has big modulo bias of 2^-64. - * RFC is invalid. RFC says "use 64-byte xof", while for 2^-112 bias - * it must use 84-byte xof (56+56/2), not 64. - */ - hashToScalar(msg: TArg, options: TArg = { DST: _DST_scalar }): bigint { - // Can't use `Fn448.fromBytes()`. 64-byte input => 56-byte field element - const xof = expand_message_xof(msg, options.DST, 64, 256, shake256); - return Fn448.create(bytesToNumberLE(xof)); - }, - /** - * HashToCurve-like construction based on RFC 9496 (Element Derivation). - * Converts 112 uniform random bytes into a curve point. - * - * WARNING: This represents an older hash-to-curve construction from before - * RFC 9380 was finalized. - * It was later reused as a component in the newer - * `hash_to_decaf448` function defined in RFC 9380. - */ - deriveToCurve(bytes: TArg): _DecafPoint { - abytes(bytes, 112); - const skipValidation = true; - // Note: Similar to the field element decoding described in - // [RFC7748], and unlike the field element decoding described in - // Section 5.3.1, non-canonical values are accepted. - const r1 = Fp448.create(Fp448.fromBytes(bytes.subarray(0, 56), skipValidation)); - const R1 = calcElligatorDecafMap(r1); - const r2 = Fp448.create(Fp448.fromBytes(bytes.subarray(56, 112), skipValidation)); - const R2 = calcElligatorDecafMap(r2); - return new _DecafPoint(R1.add(R2)); - }, -}); - -/** - * decaf448 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over decaf448. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = decaf448_oprf.oprf.generateKeyPair(); - * const blind = decaf448_oprf.oprf.blind(input); - * const evaluated = decaf448_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = decaf448_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export const decaf448_oprf: TRet = /* @__PURE__ */ (() => - createOPRF({ - name: 'decaf448-SHAKE256', - Point: _DecafPoint, - hash: (msg: TArg) => shake256(msg, { dkLen: 64 }), - hashToGroup: decaf448_hasher.hashToCurve, - hashToScalar: decaf448_hasher.hashToScalar, - }))(); - -/** - * Weird / bogus points, useful for debugging. - * Unlike ed25519, there is no ed448 generator point which can produce full T subgroup. - * Instead, the torsion subgroup here is cyclic of order 4, generated by - * `(1, 0)`, and the array below lists that subgroup set (Klein four-group). - * @example - * Decode one known torsion point for debugging. - * - * ```ts - * import { ED448_TORSION_SUBGROUP, ed448 } from '@noble/curves/ed448.js'; - * const point = ed448.Point.fromHex(ED448_TORSION_SUBGROUP[1]); - * ``` - */ -export const ED448_TORSION_SUBGROUP: readonly string[] = /* @__PURE__ */ Object.freeze([ - '010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - 'fefffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffff00', - '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080', -]); diff --git a/node_modules/@noble/curves/src/index.ts b/node_modules/@noble/curves/src/index.ts deleted file mode 100644 index 201a00a..0000000 --- a/node_modules/@noble/curves/src/index.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Audited & minimal JS implementation of elliptic curve cryptography. - * @module - * @example -```js -import { secp256k1, schnorr } from '@noble/curves/secp256k1.js'; -import { ed25519, ed25519ph, ed25519ctx, x25519, ristretto255 } from '@noble/curves/ed25519.js'; -import { ed448, ed448ph, x448, decaf448 } from '@noble/curves/ed448.js'; -import { p256, p384, p521 } from '@noble/curves/nist.js'; -import { bls12_381 } from '@noble/curves/bls12-381.js'; -import { bn254 } from '@noble/curves/bn254.js'; -import { - jubjub, - babyjubjub, - brainpoolP256r1, - brainpoolP384r1, - brainpoolP512r1, -} from '@noble/curves/misc.js'; -import * as webcrypto from '@noble/curves/webcrypto.js'; - -// hash-to-curve -import { secp256k1_hasher } from '@noble/curves/secp256k1.js'; -import { p256_hasher, p384_hasher, p521_hasher } from '@noble/curves/nist.js'; -import { ristretto255_hasher } from '@noble/curves/ed25519.js'; -import { decaf448_hasher } from '@noble/curves/ed448.js'; - -// OPRFs -import { p256_oprf, p384_oprf, p521_oprf } from '@noble/curves/nist.js'; -import { ristretto255_oprf } from '@noble/curves/ed25519.js'; -import { decaf448_oprf } from '@noble/curves/ed448.js'; - -// utils -import { bytesToHex, hexToBytes, concatBytes } from '@noble/curves/abstract/utils.js'; -import { Field } from '@noble/curves/abstract/modular.js'; -``` - */ -throw new Error('root module cannot be imported: import submodules instead. Check out README'); diff --git a/node_modules/@noble/curves/src/misc.ts b/node_modules/@noble/curves/src/misc.ts deleted file mode 100644 index e9abde2..0000000 --- a/node_modules/@noble/curves/src/misc.ts +++ /dev/null @@ -1,259 +0,0 @@ -/** - * Miscellaneous, rarely used curves. - * jubjub, babyjubjub, pallas, vesta. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { blake512 } from '@noble/hashes/blake1.js'; -import { blake2s } from '@noble/hashes/blake2.js'; -import { sha256, sha384, sha512 } from '@noble/hashes/sha2.js'; -import { abytes, concatBytes } from '@noble/hashes/utils.js'; -import { - eddsa, - edwards, - type EdDSA, - type EdwardsOpts, - type EdwardsPoint, -} from './abstract/edwards.ts'; -import { ecdsa, weierstrass, type ECDSA, type WeierstrassOpts } from './abstract/weierstrass.ts'; -import { asciiToBytes, type TArg } from './utils.ts'; - -// Jubjub curves have 𝔽p over scalar fields of other curves. They are friendly to ZK proofs. - -// Zcash Protocol Specification "Jubjub" parameters: -// q = BLS12-381 Fr, r, h = 8, a = -1, d = -10240/10241. -// Gx/Gy keep the canonical Jubjub base point used by Zcash implementations. -const jubjub_CURVE: EdwardsOpts = /* @__PURE__ */ (() => ({ - p: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001'), - n: BigInt('0xe7db4ea6533afa906673b0101343b00a6682093ccc81082d0970e5ed6f72cb7'), - h: BigInt(8), - a: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000'), - d: BigInt('0x2a9318e74bfa2b48f5fd9207e6bd7fd4292d7f6d37579d2601065fd6d6343eb1'), - Gx: BigInt('0x11dafe5d23e1218086a365b99fbf3d3be72f6afd7d1f72623e6b071492d1122b'), - Gy: BigInt('0x1d523cf1ddab1a1793132e78c866c0c33e26ba5cc220fed7cc3f870e59d292aa'), -}))(); -/** - * Generic EdDSA-over-Jubjub convenience wrapper with `sha512`. - * This is not the Zcash RedJubjub / Sapling signature scheme. - * @example - * Generate one Jubjub keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = jubjub.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = jubjub.sign(msg, secretKey); - * const isValid = jubjub.verify(sig, msg, publicKey); - * ``` - */ -export const jubjub: EdDSA = /* @__PURE__ */ (() => eddsa(edwards(jubjub_CURVE), sha512))(); - -// BabyJubJub over bn254 Fr. EIP-2494 explicitly defines both the full-group generator G and the -// prime-order subgroup base point B = 8*G. -// noble's Edwards abstraction expects Point.BASE / curve.n to describe the prime-order subgroup, so -// use the EIP base point B here. -// Historical noble incorrectly used the EIP generator G as Point.BASE, which mismatched the -// abstraction and leaked the wrong order into consumers. -// Historical noble used G instead: -// Gx = 995203441582195749578291179787384436505546430278305826713579947235728471134 -// Gy = 5472060717959818805561601436314318772137091100104008585924551046643952123905 -const babyjubjub_CURVE: EdwardsOpts = /* @__PURE__ */ (() => ({ - p: BigInt('0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001'), - n: BigInt('0x060c89ce5c263405370a08b6d0302b0bab3eedb83920ee0a677297dc392126f1'), - h: BigInt(8), - a: BigInt('168700'), - d: BigInt('168696'), - Gx: BigInt('0xbb77a6ad63e739b4eacb2e09d6277c12ab8d8010534e0b62893f3f6bb957051'), - Gy: BigInt('0x25797203f7a0b24925572e1cd16bf9edfce0051fb9e133774b3c257a872d7d8b'), -}))(); -/** - * Curve over scalar field of bn254. babyjubjub Fp = bn254 n - * This is a working generic EdDSA-over-BabyJubJub wrapper that uses `blake512` for the 64-byte - * secret expansion required by the shared EdDSA helper. - * It is not the BabyJubJub stack used by iden3/circomlib, `babyjubjub-rs`, or - * `@zk-kit/eddsa-poseidon`: those pair the subgroup base B/B8 with Blake-style secret expansion - * plus dedicated Poseidon / MiMC / Pedersen transcript hashing. This wrapper stays generic and is - * not meant as an interoperability target for those BabyJubJub signing stacks. - * @example - * Access the BabyJubJub base point and round-trip it through the point codec. - * - * ```ts - * import { babyjubjub } from '@noble/curves/misc.js'; - * const base = babyjubjub.Point.BASE; - * const encoded = base.toBytes(); - * const decoded = babyjubjub.Point.fromBytes(encoded); - * ``` - */ -export const babyjubjub: EdDSA = /* @__PURE__ */ (() => - eddsa(edwards(babyjubjub_CURVE), blake512))(); - -// Sapling URS randomness beacon from the Zcash protocol. This stays as the 64-byte ASCII -// lowercase-hex string used for the first Blake2s block, not 32 raw bytes. -const jubjub_gh_first_block = /* @__PURE__ */ asciiToBytes( - '096b36a5804bfacef1691e173c366a47ff5ba84a44f26ddd7e8d9f79d5b42df0' -); - -/** - * @param tag - Hash input. - * @param personalization - BLAKE2 personalization bytes. - * @returns Prime-order Jubjub point. - * @throws If the digest does not decode to a Jubjub point, or if the - * cofactor-cleared point has small order. {@link Error} - * @example - * Hash a tag into a prime-order Jubjub point. - * - * ```ts - * import { jubjub_groupHash } from '@noble/curves/misc.js'; - * import { asciiToBytes } from '@noble/curves/utils.js'; - * const tag = Uint8Array.of(2); - * const personalization = asciiToBytes('Zcash_G_'); - * const point = jubjub_groupHash(tag, personalization); - * ``` - */ -export function jubjub_groupHash( - tag: TArg, - personalization: TArg -): EdwardsPoint { - const h = blake2s.create({ personalization, dkLen: 32 }); - h.update(jubjub_gh_first_block); - h.update(tag); - // NOTE: returns EdwardsPoint, in case it will be multiplied later - let p = jubjub.Point.fromBytes(h.digest()); - // NOTE: cannot replace with isSmallOrder, returns Point*8 - p = p.multiply(jubjub_CURVE.h); - if (p.equals(jubjub.Point.ZERO)) throw new Error('Point has small order'); - return p; -} - -/** - * No secret data is leaked here at all. - * It operates over public data. - * @param m - Message prefix. - * @param personalization - 8-byte BLAKE2 personalization bytes. - * @returns First non-zero group hash. - * @throws If the personalization is invalid, or if no non-zero Jubjub group - * hash can be found. {@link Error} - * @example - * Derive the first non-zero Jubjub group hash for one personalization tag. - * - * ```ts - * import { jubjub_findGroupHash } from '@noble/curves/misc.js'; - * import { asciiToBytes } from '@noble/curves/utils.js'; - * const msg = Uint8Array.of(); - * const personalization = asciiToBytes('Zcash_G_'); - * const point = jubjub_findGroupHash(msg, personalization); - * ``` - */ -export function jubjub_findGroupHash( - m: TArg, - personalization: TArg -): EdwardsPoint { - // Validate BLAKE2s personalization once up front; otherwise the retry loop swallows the real - // input error and turns it into a misleading "tag overflow". - abytes(personalization, 8, 'personalization'); - const tag = concatBytes(m, Uint8Array.of(0)); - const hashes = []; - for (let i = 0; i < 256; i++) { - tag[tag.length - 1] = i; - try { - hashes.push(jubjub_groupHash(tag, personalization)); - } catch (e) {} - } - if (!hashes.length) throw new Error('findGroupHash tag overflow'); - return hashes[0]; -} - -const brainpoolP256r1_CURVE: WeierstrassOpts = /* @__PURE__ */ (() => ({ - p: BigInt('0xa9fb57dba1eea9bc3e660a909d838d726e3bf623d52620282013481d1f6e5377'), - a: BigInt('0x7d5a0975fc2c3057eef67530417affe7fb8055c126dc5c6ce94a4b44f330b5d9'), - b: BigInt('0x26dc5c6ce94a4b44f330b5d9bbd77cbf958416295cf7e1ce6bccdc18ff8c07b6'), - n: BigInt('0xa9fb57dba1eea9bc3e660a909d838d718c397aa3b561a6f7901e0e82974856a7'), - Gx: BigInt('0x8bd2aeb9cb7e57cb2c4b482ffc81b7afb9de27e1e3bd23c23a4453bd9ace3262'), - Gy: BigInt('0x547ef835c3dac4fd97f8461a14611dc9c27745132ded8e545c1d54c72f046997'), - h: BigInt(1), -}))(); -/** - * Brainpool P256r1 with sha256, from RFC 5639. - * @example - * Generate one Brainpool P256r1 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = brainpoolP256r1.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = brainpoolP256r1.sign(msg, secretKey); - * const isValid = brainpoolP256r1.verify(sig, msg, publicKey); - * ``` - */ -export const brainpoolP256r1: ECDSA = /* @__PURE__ */ (() => - ecdsa(weierstrass(brainpoolP256r1_CURVE), sha256))(); - -const brainpoolP384r1_CURVE: WeierstrassOpts = /* @__PURE__ */ (() => ({ - p: BigInt( - '0x8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b412b1da197fb71123acd3a729901d1a71874700133107ec53' - ), - a: BigInt( - '0x7bc382c63d8c150c3c72080ace05afa0c2bea28e4fb22787139165efba91f90f8aa5814a503ad4eb04a8c7dd22ce2826' - ), - b: BigInt( - '0x04a8c7dd22ce28268b39b55416f0447c2fb77de107dcd2a62e880ea53eeb62d57cb4390295dbc9943ab78696fa504c11' - ), - n: BigInt( - '0x8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b31f166e6cac0425a7cf3ab6af6b7fc3103b883202e9046565' - ), - Gx: BigInt( - '0x1d1c64f068cf45ffa2a63a81b7c13f6b8847a3e77ef14fe3db7fcafe0cbd10e8e826e03436d646aaef87b2e247d4af1e' - ), - Gy: BigInt( - '0x8abe1d7520f9c2a45cb1eb8e95cfd55262b70b29feec5864e19c054ff99129280e4646217791811142820341263c5315' - ), - h: BigInt(1), -}))(); -/** - * Brainpool P384r1 with sha384, from RFC 5639. - * @example - * Generate one Brainpool P384r1 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = brainpoolP384r1.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = brainpoolP384r1.sign(msg, secretKey); - * const isValid = brainpoolP384r1.verify(sig, msg, publicKey); - * ``` - */ -export const brainpoolP384r1: ECDSA = /* @__PURE__ */ (() => - ecdsa(weierstrass(brainpoolP384r1_CURVE), sha384))(); - -const brainpoolP512r1_CURVE: WeierstrassOpts = /* @__PURE__ */ (() => ({ - p: BigInt( - '0xaadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca703308717d4d9b009bc66842aecda12ae6a380e62881ff2f2d82c68528aa6056583a48f3' - ), - a: BigInt( - '0x7830a3318b603b89e2327145ac234cc594cbdd8d3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94ca' - ), - b: BigInt( - '0x3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94cadc083e67984050b75ebae5dd2809bd638016f723' - ), - n: BigInt( - '0xaadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca70330870553e5c414ca92619418661197fac10471db1d381085ddaddb58796829ca90069' - ), - Gx: BigInt( - '0x81aee4bdd82ed9645a21322e9c4c6a9385ed9f70b5d916c1b43b62eef4d0098eff3b1f78e2d0d48d50d1687b93b97d5f7c6d5047406a5e688b352209bcb9f822' - ), - Gy: BigInt( - '0x7dde385d566332ecc0eabfa9cf7822fdf209f70024a57b1aa000c55b881f8111b2dcde494a5f485e5bca4bd88a2763aed1ca2b2fa8f0540678cd1e0f3ad80892' - ), - h: BigInt(1), -}))(); -/** - * Brainpool P512r1 with sha512, from RFC 5639. - * @example - * Generate one Brainpool P512r1 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = brainpoolP512r1.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = brainpoolP512r1.sign(msg, secretKey); - * const isValid = brainpoolP512r1.verify(sig, msg, publicKey); - * ``` - */ -export const brainpoolP512r1: ECDSA = /* @__PURE__ */ (() => - ecdsa(weierstrass(brainpoolP512r1_CURVE), sha512))(); diff --git a/node_modules/@noble/curves/src/nist.ts b/node_modules/@noble/curves/src/nist.ts deleted file mode 100644 index ffec01d..0000000 --- a/node_modules/@noble/curves/src/nist.ts +++ /dev/null @@ -1,327 +0,0 @@ -/** - * Internal module for NIST P256, P384, P521 curves. - * Do not use for now. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { sha256, sha384, sha512 } from '@noble/hashes/sha2.js'; -import { createFROST, type FROST } from './abstract/frost.ts'; -import { createHasher, type H2CHasher } from './abstract/hash-to-curve.ts'; -import { createOPRF, type OPRF } from './abstract/oprf.ts'; -import { - ecdsa, - mapToCurveSimpleSWU, - weierstrass, - type ECDSA, - type WeierstrassOpts, - type WeierstrassPointCons, -} from './abstract/weierstrass.ts'; -import { type TRet } from './utils.ts'; - -// p = 2n**224n * (2n**32n-1n) + 2n**192n + 2n**96n - 1n -// a = Fp256.create(BigInt('-3')); -const p256_CURVE: WeierstrassOpts = /* @__PURE__ */ (() => ({ - p: BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff'), - n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'), - h: BigInt(1), - a: BigInt('0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc'), - b: BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b'), - Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'), - Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'), -}))(); - -// p = 2n**384n - 2n**128n - 2n**96n + 2n**32n - 1n -const p384_CURVE: WeierstrassOpts = /* @__PURE__ */ (() => ({ - p: BigInt( - '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff' - ), - n: BigInt( - '0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973' - ), - h: BigInt(1), - a: BigInt( - '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc' - ), - b: BigInt( - '0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef' - ), - Gx: BigInt( - '0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7' - ), - Gy: BigInt( - '0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f' - ), -}))(); - -// p = 2n**521n - 1n -const p521_CURVE: WeierstrassOpts = /* @__PURE__ */ (() => ({ - p: BigInt( - '0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' - ), - n: BigInt( - '0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409' - ), - h: BigInt(1), - a: BigInt( - '0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc' - ), - b: BigInt( - '0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00' - ), - Gx: BigInt( - '0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66' - ), - Gy: BigInt( - '0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650' - ), -}))(); - -type SwuOpts = { - A: bigint; - B: bigint; - Z: bigint; -}; - -function createSWU(Point: WeierstrassPointCons, opts: SwuOpts) { - let map: ((u: bigint) => { x: bigint; y: bigint }) | undefined; - // RFC 9380's NIST suites here all use m = 1, so createHasher passes one field element per map. - // Building the SWU sqrt-ratio helper eagerly adds noticeable `nist.js` import cost, so defer it - // to first use; after that the cached mapper is reused directly. - return (scalars: bigint[]) => (map || (map = mapToCurveSimpleSWU(Point.Fp, opts)))(scalars[0]); -} - -// NIST P256 -const p256_Point = /* @__PURE__ */ weierstrass(p256_CURVE); -/** - * NIST P256 (aka secp256r1, prime256v1) curve, ECDSA and ECDH methods. - * Hashes inputs with sha256 by default. - * - * @example - * Generate one P-256 keypair, sign a message, and verify it. - * - * ```js - * import { p256 } from '@noble/curves/nist.js'; - * const { secretKey, publicKey } = p256.keygen(); - * // const publicKey = p256.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p256.sign(msg, secretKey); - * const isValid = p256.verify(sig, msg, publicKey); - * // const sigKeccak = p256.sign(keccak256(msg), secretKey, { prehash: false }); - * ``` - */ -export const p256: ECDSA = /* @__PURE__ */ ecdsa(p256_Point, sha256); -/** - * Hashing / encoding to p256 points / field. RFC 9380 methods. - * @example - * Hash one message onto the P-256 curve. - * - * ```ts - * const point = p256_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const p256_hasher: H2CHasher> = /* @__PURE__ */ (() => { - return createHasher( - p256_Point, - createSWU(p256_Point, { - A: p256_CURVE.a, - B: p256_CURVE.b, - Z: p256_Point.Fp.create(BigInt('-10')), - }), - { - DST: 'P256_XMD:SHA-256_SSWU_RO_', - encodeDST: 'P256_XMD:SHA-256_SSWU_NU_', - p: p256_CURVE.p, - m: 1, - k: 128, - expand: 'xmd', - hash: sha256, - } - ); -})(); -/** - * p256 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over P-256. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = p256_oprf.oprf.generateKeyPair(); - * const blind = p256_oprf.oprf.blind(input); - * const evaluated = p256_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = p256_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export const p256_oprf: TRet = /* @__PURE__ */ (() => - createOPRF({ - name: 'P256-SHA256', - Point: p256_Point, - hash: sha256, - hashToGroup: p256_hasher.hashToCurve, - hashToScalar: p256_hasher.hashToScalar, - }))(); -/** - * FROST threshold signatures over p256. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 p256 signing. - * - * ```ts - * const alice = p256_FROST.Identifier.derive('alice@example.com'); - * const bob = p256_FROST.Identifier.derive('bob@example.com'); - * const carol = p256_FROST.Identifier.derive('carol@example.com'); - * const deal = p256_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const p256_FROST: TRet = /* @__PURE__ */ (() => - createFROST({ - name: 'FROST-P256-SHA256-v1', - Point: p256_Point, - hashToScalar: p256_hasher.hashToScalar, - hash: sha256, - }))(); - -// NIST P384 -const p384_Point = /* @__PURE__ */ weierstrass(p384_CURVE); -/** - * NIST P384 (aka secp384r1) curve, ECDSA and ECDH methods. Hashes inputs with sha384 by default. - * @example - * Generate one P-384 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = p384.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p384.sign(msg, secretKey); - * const isValid = p384.verify(sig, msg, publicKey); - * ``` - */ -export const p384: ECDSA = /* @__PURE__ */ ecdsa(p384_Point, sha384); -/** - * Hashing / encoding to p384 points / field. RFC 9380 methods. - * @example - * Hash one message onto the P-384 curve. - * - * ```ts - * const point = p384_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const p384_hasher: H2CHasher> = /* @__PURE__ */ (() => { - return createHasher( - p384_Point, - createSWU(p384_Point, { - A: p384_CURVE.a, - B: p384_CURVE.b, - Z: p384_Point.Fp.create(BigInt('-12')), - }), - { - DST: 'P384_XMD:SHA-384_SSWU_RO_', - encodeDST: 'P384_XMD:SHA-384_SSWU_NU_', - p: p384_CURVE.p, - m: 1, - k: 192, - expand: 'xmd', - hash: sha384, - } - ); -})(); -/** - * p384 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over P-384. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = p384_oprf.oprf.generateKeyPair(); - * const blind = p384_oprf.oprf.blind(input); - * const evaluated = p384_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = p384_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export const p384_oprf: TRet = /* @__PURE__ */ (() => - createOPRF({ - name: 'P384-SHA384', - Point: p384_Point, - hash: sha384, - hashToGroup: p384_hasher.hashToCurve, - hashToScalar: p384_hasher.hashToScalar, - }))(); - -// NIST P521 -// RFC 7518 fixes the canonical JWK/JOSE width at 66 bytes: -// - Section 3.4 says ECDSA octet strings must not omit leading zero octets -// - Sections 6.2.1.2/6.2.1.3 say P-521 coordinates "x"/"y" must be 66 octets -// - Section 6.2.2.1 says private scalar "d" must be ceil(log2(n)/8) octets, i.e. 66 for P-521 -// NIST FIPS 186-5 Appendix A.3.3 also routes deterministic ECDSA private keys through Appendix -// B.2.3, whose Integer-to-Octet-String output has explicit fixed length L; for P-521 that is the -// same 66-byte order width. -// RFC 6979 matches that width too: private key x is an integer, while `int2octets(x)` uses -// rlen = 8 * ceil(qlen/8); for P-521, qlen = 521 so the canonical octet width is 66 bytes. -// Wycheproof ECDH stores private values as integers, not fixed-width scalar bytes, so it does not -// require a dedicated 65-byte parser path; the repo tests now normalize those integer fixtures to -// the canonical 66-byte width before use. There is no good standards or oracle reason to accept -// exactly 65 bytes here: the coherent choices are canonical 66 only, or a broader integer-style -// parser across many widths. Since this field parser is fixed-width, keep it canonical and use the -// default exact-66-byte scalar field path. -const p521_Point = /* @__PURE__ */ weierstrass(p521_CURVE); -/** - * NIST P521 (aka secp521r1) curve, ECDSA and ECDH methods. Hashes inputs with sha512 by default. - * Deterministic `keygen(seed)` expects 99 seed bytes here because the generic scalar-derivation - * helper uses `getMinHashLength(n)`, not the 66-byte canonical secret-key width. - * @example - * Generate one P-521 keypair, sign a message, and verify it. - * - * ```ts - * const { secretKey, publicKey } = p521.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = p521.sign(msg, secretKey); - * const isValid = p521.verify(sig, msg, publicKey); - * ``` - */ -export const p521: ECDSA = /* @__PURE__ */ ecdsa(p521_Point, sha512); -/** - * Hashing / encoding to p521 points / field. RFC 9380 methods. - * @example - * Hash one message onto the P-521 curve. - * - * ```ts - * const point = p521_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const p521_hasher: H2CHasher> = /* @__PURE__ */ (() => { - return createHasher( - p521_Point, - createSWU(p521_Point, { - A: p521_CURVE.a, - B: p521_CURVE.b, - Z: p521_Point.Fp.create(BigInt('-4')), - }), - { - DST: 'P521_XMD:SHA-512_SSWU_RO_', - encodeDST: 'P521_XMD:SHA-512_SSWU_NU_', - p: p521_CURVE.p, - m: 1, - k: 256, - expand: 'xmd', - hash: sha512, - } - ); -})(); -/** - * p521 OPRF, defined in RFC 9497. - * @example - * Run one blind/evaluate/finalize OPRF round over P-521. - * - * ```ts - * const input = new TextEncoder().encode('hello noble'); - * const keys = p521_oprf.oprf.generateKeyPair(); - * const blind = p521_oprf.oprf.blind(input); - * const evaluated = p521_oprf.oprf.blindEvaluate(keys.secretKey, blind.blinded); - * const output = p521_oprf.oprf.finalize(input, blind.blind, evaluated); - * ``` - */ -export const p521_oprf: TRet = /* @__PURE__ */ (() => - createOPRF({ - name: 'P521-SHA512', - Point: p521_Point, - hash: sha512, - hashToGroup: p521_hasher.hashToCurve, - hashToScalar: p521_hasher.hashToScalar, // produces L=98 just like in RFC - }))(); diff --git a/node_modules/@noble/curves/src/secp256k1.ts b/node_modules/@noble/curves/src/secp256k1.ts deleted file mode 100644 index 4380a27..0000000 --- a/node_modules/@noble/curves/src/secp256k1.ts +++ /dev/null @@ -1,570 +0,0 @@ -/** - * SECG secp256k1. See [pdf](https://www.secg.org/sec2-v2.pdf). - * - * Belongs to Koblitz curves: it has efficiently-computable GLV endomorphism ψ, - * check out {@link EndomorphismOpts}. Seems to be rigid (not backdoored). - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { sha256 } from '@noble/hashes/sha2.js'; -import { randomBytes } from '@noble/hashes/utils.js'; -import { createKeygen, type CurveLengths } from './abstract/curve.ts'; -import { - createFROST, - type FROST, - type FrostPublic, - type FrostSecret, - type Nonces, -} from './abstract/frost.ts'; -import { createHasher, type H2CHasher, isogenyMap } from './abstract/hash-to-curve.ts'; -import { Field, mapHashToField, pow2 } from './abstract/modular.ts'; -import { - type ECDSA, - ecdsa, - type EndomorphismOpts, - mapToCurveSimpleSWU, - type WeierstrassPoint as PointType, - weierstrass, - type WeierstrassOpts, - type WeierstrassPointCons, -} from './abstract/weierstrass.ts'; -import { - abytes, - asciiToBytes, - bytesToNumberBE, - concatBytes, - type TArg, - type TRet, -} from './utils.ts'; - -// Seems like generator was produced from some seed: -// `Pointk1.BASE.multiply(Pointk1.Fn.inv(2n, N)).toAffine().x` -// // gives short x 0x3b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63n -const secp256k1_CURVE: WeierstrassOpts = { - p: BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'), - n: BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'), - h: BigInt(1), - a: BigInt(0), - b: BigInt(7), - Gx: BigInt('0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'), - Gy: BigInt('0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8'), -}; - -const secp256k1_ENDO: EndomorphismOpts = { - beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'), - basises: [ - [BigInt('0x3086d221a7d46bcde86c90e49284eb15'), -BigInt('0xe4437ed6010e88286f547fa90abfe4c3')], - [BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8'), BigInt('0x3086d221a7d46bcde86c90e49284eb15')], - ], -}; - -const _0n = /* @__PURE__ */ BigInt(0); -const _2n = /* @__PURE__ */ BigInt(2); - -/** - * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit. - * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00] - */ -function sqrtMod(y: bigint): bigint { - const P = secp256k1_CURVE.p; - // prettier-ignore - const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); - // prettier-ignore - const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); - const b2 = (y * y * y) % P; // x^3, 11 - const b3 = (b2 * b2 * y) % P; // x^7 - const b6 = (pow2(b3, _3n, P) * b3) % P; - const b9 = (pow2(b6, _3n, P) * b3) % P; - const b11 = (pow2(b9, _2n, P) * b2) % P; - const b22 = (pow2(b11, _11n, P) * b11) % P; - const b44 = (pow2(b22, _22n, P) * b22) % P; - const b88 = (pow2(b44, _44n, P) * b44) % P; - const b176 = (pow2(b88, _88n, P) * b88) % P; - const b220 = (pow2(b176, _44n, P) * b44) % P; - const b223 = (pow2(b220, _3n, P) * b3) % P; - const t1 = (pow2(b223, _23n, P) * b22) % P; - const t2 = (pow2(t1, _6n, P) * b2) % P; - const root = pow2(t2, _2n, P); - if (!Fpk1.eql(Fpk1.sqr(root), y)) throw new Error('Cannot find square root'); - return root; -} - -const Fpk1 = Field(secp256k1_CURVE.p, { sqrt: sqrtMod }); -const Pointk1 = /* @__PURE__ */ weierstrass(secp256k1_CURVE, { - Fp: Fpk1, - endo: secp256k1_ENDO, -}); - -/** - * secp256k1 curve: ECDSA and ECDH methods. - * - * Uses sha256 to hash messages. To use a different hash, - * pass `{ prehash: false }` to sign / verify. - * - * @example - * Generate one secp256k1 keypair, sign a message, and verify it. - * - * ```js - * import { secp256k1 } from '@noble/curves/secp256k1.js'; - * const { secretKey, publicKey } = secp256k1.keygen(); - * // const publicKey = secp256k1.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = secp256k1.sign(msg, secretKey); - * const isValid = secp256k1.verify(sig, msg, publicKey); - * // const sigKeccak = secp256k1.sign(keccak256(msg), secretKey, { prehash: false }); - * ``` - */ -export const secp256k1: ECDSA = /* @__PURE__ */ ecdsa(Pointk1, sha256); - -// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code. -// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki -/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */ -const TAGGED_HASH_PREFIXES: { [tag: string]: Uint8Array } = {}; -// BIP-340 phrases tags as UTF-8, but all current standardized names here are 7-bit ASCII. -function taggedHash(tag: string, ...messages: TArg): TRet { - let tagP = TAGGED_HASH_PREFIXES[tag]; - if (tagP === undefined) { - const tagH = sha256(asciiToBytes(tag)); - tagP = concatBytes(tagH, tagH); - TAGGED_HASH_PREFIXES[tag] = tagP; - } - return sha256(concatBytes(tagP, ...messages)) as TRet; -} - -// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03 -const pointToBytes = (point: TArg>): TRet => - point.toBytes(true).slice(1) as TRet; -const hasEven = (y: bigint) => y % _2n === _0n; - -// Calculate point, scalar and bytes -function schnorrGetExtPubKey(priv: TArg) { - const { Fn, BASE } = Pointk1; - const d_ = Fn.fromBytes(priv); - const p = BASE.multiply(d_); // P = d'⋅G; 0 < d' < n check is done inside - const scalar = hasEven(p.y) ? d_ : Fn.neg(d_); - return { scalar, bytes: pointToBytes(p) }; -} -/** - * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point. - * @returns valid point checked for being on-curve - */ -function lift_x(x: bigint): PointType { - const Fp = Fpk1; - if (!Fp.isValidNot0(x)) throw new Error('invalid x: Fail if x ≥ p'); - const xx = Fp.create(x * x); - const c = Fp.create(xx * x + BigInt(7)); // Let c = x³ + 7 mod p. - let y = Fp.sqrt(c); // Let y = c^(p+1)/4 mod p. Same as sqrt(). - // Return the unique point P such that x(P) = x and - // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise. - if (!hasEven(y)) y = Fp.neg(y); - const p = Pointk1.fromAffine({ x, y }); - p.assertValidity(); - return p; -} -// BIP-340 callers still need to supply canonical 32-byte inputs where required; this alias only -// parses big-endian bytes and does not enforce the fixed-width contract itself. -const num = bytesToNumberBE; -/** Create tagged hash, convert it to bigint, reduce modulo-n. */ -function challenge(...args: TArg): bigint { - return Pointk1.Fn.create(num(taggedHash('BIP0340/challenge', ...args))); -} - -/** Schnorr public key is just `x` coordinate of Point as per BIP340. */ -function schnorrGetPublicKey(secretKey: TArg): TRet { - return schnorrGetExtPubKey(secretKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G) -} - -/** - * Creates Schnorr signature as per BIP340. Verifies itself before returning anything. - * `auxRand` is optional and is not the sole source of `k` generation: bad CSPRNG output will not - * be catastrophic, but BIP-340 still recommends fresh auxiliary randomness when available to harden - * deterministic signing against side-channel and fault-injection attacks. - */ -function schnorrSign( - message: TArg, - secretKey: TArg, - auxRand: TArg = randomBytes(32) -): TRet { - const { Fn, BASE } = Pointk1; - const m = abytes(message, undefined, 'message'); - const { bytes: px, scalar: d } = schnorrGetExtPubKey(secretKey); // checks for isWithinCurveOrder - const a = abytes(auxRand, 32, 'auxRand'); // Auxiliary random data a: a 32-byte array - // Let t be the byte-wise xor of bytes(d) and hash/aux(a). - const t = Fn.toBytes(d ^ num(taggedHash('BIP0340/aux', a))); - const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m) - // BIP340 defines k' = int(rand) mod n. We can't reuse schnorrGetExtPubKey(rand) - // here: that helper parses canonical secret keys and rejects rand >= n instead - // of reducing the nonce hash modulo the group order. - const k_ = Fn.create(num(rand)); - // BIP-340: "Let k' = int(rand) mod n. Fail if k' = 0. Let R = k'⋅G." - if (k_ === 0n) throw new Error('sign failed: k is zero'); - const p = BASE.multiply(k_); // Rejects zero; only the raw nonce hash needs reduction. - const k = hasEven(p.y) ? k_ : Fn.neg(k_); - const rx = pointToBytes(p); - const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n. - const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n). - sig.set(rx, 0); - sig.set(Fn.toBytes(Fn.create(k + e * d)), 32); - // If Verify(bytes(P), m, sig) (see below) returns failure, abort - if (!schnorrVerify(sig, m, px)) throw new Error('sign: Invalid signature produced'); - return sig as TRet; -} - -/** - * Verifies Schnorr signature. - * Will swallow errors & return false except for initial type validation of arguments. - */ -function schnorrVerify( - signature: TArg, - message: TArg, - publicKey: TArg -): boolean { - const { Fp, Fn, BASE } = Pointk1; - const sig = abytes(signature, 64, 'signature'); - const m = abytes(message, undefined, 'message'); - const pub = abytes(publicKey, 32, 'publicKey'); - try { - const P = lift_x(num(pub)); // P = lift_x(int(pk)); fail if that fails - const r = num(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p. - if (!Fp.isValidNot0(r)) return false; - const s = num(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n. - // Stricter than BIP-340/libsecp256k1, which only reject s >= n. Honest signing reaches - // s = 0 only with negligible probability (k + e*d ≡ 0 mod n), so treat zero-s inputs as - // crafted edge cases and fail closed instead of carrying that extra verification surface. - if (!Fn.isValidNot0(s)) return false; - - // int(challenge(bytes(r) || bytes(P) || m)) % n - const e = challenge(Fn.toBytes(r), pointToBytes(P), m); - // R = s⋅G - e⋅P, where -eP == (n-e)P - const R = BASE.multiplyUnsafe(s).add(P.multiplyUnsafe(Fn.neg(e))); - const { x, y } = R.toAffine(); - // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r. - if (R.is0() || !hasEven(y) || x !== r) return false; - return true; - } catch (error) { - return false; - } -} - -export const __TEST: { lift_x: typeof lift_x } = /* @__PURE__ */ Object.freeze({ lift_x }); - -/** Schnorr-specific secp256k1 API from BIP340. */ -export type SecpSchnorr = { - /** - * Generate one Schnorr secret/public keypair. - * @param seed - Optional seed for deterministic testing or custom randomness. - * @returns Fresh secret/public keypair. - */ - keygen: (seed?: TArg) => { secretKey: TRet; publicKey: TRet }; - /** - * Derive the x-only public key from a secret key. - * @param secretKey - Secret key bytes. - * @returns X-only public key bytes. - */ - getPublicKey: typeof schnorrGetPublicKey; - /** - * Create one BIP340 Schnorr signature. - * @param message - Message bytes to sign. - * @param secretKey - Secret key bytes. - * @param auxRand - Optional auxiliary randomness. - * @returns Compact Schnorr signature bytes. - */ - sign: typeof schnorrSign; - /** - * Verify one BIP340 Schnorr signature. - * @param signature - Compact signature bytes. - * @param message - Signed message bytes. - * @param publicKey - X-only public key bytes. - * @returns `true` when the signature is valid. - */ - verify: typeof schnorrVerify; - /** Underlying secp256k1 point constructor. */ - Point: WeierstrassPointCons; - /** Helper utilities for Schnorr-specific key handling and tagged hashing. */ - utils: { - /** Generate one Schnorr secret key. */ - randomSecretKey: (seed?: TArg) => TRet; - /** Convert one point into its x-only BIP340 byte encoding. */ - pointToBytes: (point: TArg>) => TRet; - /** Lift one x coordinate into the unique even-Y point. */ - lift_x: typeof lift_x; - /** Compute a BIP340 tagged hash. */ - taggedHash: typeof taggedHash; - }; - /** Public byte lengths for keys, signatures, and seeds. */ - lengths: CurveLengths; -}; -/** - * Schnorr signatures over secp256k1. - * See {@link https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki | BIP 340}. - * @example - * Generate one BIP340 Schnorr keypair, sign a message, and verify it. - * - * ```js - * import { schnorr } from '@noble/curves/secp256k1.js'; - * const { secretKey, publicKey } = schnorr.keygen(); - * // const publicKey = schnorr.getPublicKey(secretKey); - * const msg = new TextEncoder().encode('hello'); - * const sig = schnorr.sign(msg, secretKey); - * const isValid = schnorr.verify(sig, msg, publicKey); - * ``` - */ -export const schnorr: SecpSchnorr = /* @__PURE__ */ (() => { - const size = 32; - const seedLength = 48; - const randomSecretKey = (seed?: TArg): TRet => { - seed = seed === undefined ? randomBytes(seedLength) : seed; - return mapHashToField(seed, secp256k1_CURVE.n); - }; - return Object.freeze({ - keygen: createKeygen(randomSecretKey, schnorrGetPublicKey), - getPublicKey: schnorrGetPublicKey, - sign: schnorrSign, - verify: schnorrVerify, - Point: Pointk1, - utils: Object.freeze({ - randomSecretKey, - taggedHash, - lift_x, - pointToBytes, - }), - lengths: Object.freeze({ - secretKey: size, - publicKey: size, - publicKeyHasPrefix: false, - signature: size * 2, - seed: seedLength, - }), - }); -})(); - -// RFC 9380 Appendix E.1 3-isogeny coefficients for secp256k1, stored in ascending degree order. -// The final `1` in each denominator array is the explicit monic leading term. -const isoMap = /* @__PURE__ */ (() => - isogenyMap( - Fpk1, - [ - // xNum - [ - '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7', - '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581', - '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262', - '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c', - ], - // xDen - [ - '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b', - '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14', - '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 - ], - // yNum - [ - '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c', - '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3', - '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931', - '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84', - ], - // yDen - [ - '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b', - '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573', - '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f', - '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 - ], - ].map((i) => i.map((j) => BigInt(j))) as [bigint[], bigint[], bigint[], bigint[]] - ))(); -// RFC 9380 §8.7 secp256k1 E' parameters for the SWU-to-isogeny pipeline below. -let mapSWU: ((u: bigint) => { x: bigint; y: bigint }) | undefined; -const getMapSWU = () => - mapSWU || - (mapSWU = mapToCurveSimpleSWU(Fpk1, { - // Building the SWU sqrt-ratio helper eagerly adds noticeable `secp256k1.js` import cost, so - // defer it to first use; after that the cached mapper is reused directly. - A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'), - B: BigInt('1771'), - Z: Fpk1.create(BigInt('-11')), - })); - -/** - * Hashing / encoding to secp256k1 points / field. RFC 9380 methods. - * @example - * Hash one message onto secp256k1. - * - * ```ts - * const point = secp256k1_hasher.hashToCurve(new TextEncoder().encode('hello noble')); - * ``` - */ -export const secp256k1_hasher: H2CHasher> = /* @__PURE__ */ (() => - createHasher( - Pointk1, - (scalars: bigint[]) => { - const { x, y } = getMapSWU()(Fpk1.create(scalars[0])); - return isoMap(x, y); - }, - { - DST: 'secp256k1_XMD:SHA-256_SSWU_RO_', - encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_', - p: Fpk1.ORDER, - m: 1, - k: 128, - expand: 'xmd', - hash: sha256, - } - ))(); -/** - * FROST threshold signatures over secp256k1. RFC 9591. - * @example - * Create one trusted-dealer package for 2-of-3 secp256k1 signing. - * - * ```ts - * const alice = secp256k1_FROST.Identifier.derive('alice@example.com'); - * const bob = secp256k1_FROST.Identifier.derive('bob@example.com'); - * const carol = secp256k1_FROST.Identifier.derive('carol@example.com'); - * const deal = secp256k1_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const secp256k1_FROST: TRet = /* @__PURE__ */ (() => - createFROST({ - name: 'FROST-secp256k1-SHA256-v1', - Point: Pointk1, - hashToScalar: secp256k1_hasher.hashToScalar, - hash: sha256, - }))(); - -// Taproot utils -// `undefined` means "disable TapTweak entirely"; callers that want the BIP-341/BIP-386 empty -// merkle root must pass `new Uint8Array(0)` explicitly. -function tweak(point: PointType, merkleRoot?: TArg): bigint { - if (merkleRoot === undefined) return _0n; - const x = pointToBytes(point); - const t = bytesToNumberBE(taggedHash('TapTweak', x, merkleRoot)); - // BIP-341 taproot_tweak_pubkey/taproot_tweak_seckey: "if t >= SECP256K1_ORDER: - // raise ValueError". TapTweak must reject overflow instead of reducing modulo n. - if (!Pointk1.Fn.isValid(t)) throw new Error('invalid TapTweak hash'); - return t; -} -function frostPubToEvenY(pub: TArg): TRet { - const VK = Pointk1.fromBytes(pub.commitments[0]); - // Keep aliasing on the already-even path so wrapper callers can skip unnecessary cloning. - if (hasEven(VK.y)) return pub as TRet; - return { - signers: { min: pub.signers.min, max: pub.signers.max }, - commitments: pub.commitments.map((i) => Pointk1.fromBytes(i).negate().toBytes()), - verifyingShares: Object.fromEntries( - Object.entries(pub.verifyingShares).map(([k, v]) => [ - k, - Pointk1.fromBytes(v).negate().toBytes(), - ]) - ), - } as TRet; -} -function frostSecretToEvenY(s: TArg, pub: TArg): TRet { - const VK = Pointk1.fromBytes(pub.commitments[0]); - // Keep aliasing on the already-even path so wrapper callers can preserve package identity. - if (hasEven(VK.y)) return s as TRet; - const Fn = Pointk1.Fn; - return { - ...s, - signingShare: Fn.toBytes(Fn.neg(Fn.fromBytes(s.signingShare))), - } as TRet; -} -function frostNoncesToEvenY(PK: PointType, nonces: TArg): TRet { - if (hasEven(PK.y)) return nonces as TRet; - const Fn = Pointk1.Fn; - return { - binding: Fn.toBytes(Fn.neg(Fn.fromBytes(nonces.binding))), - hiding: Fn.toBytes(Fn.neg(Fn.fromBytes(nonces.hiding))), - } as TRet; -} - -function frostTweakSecret( - s: TArg, - pub: TArg, - merkleRoot?: TArg -): TRet { - const Fn = Pointk1.Fn; - const keyPackage = frostSecretToEvenY(s, pub); - const evenPub = frostPubToEvenY(pub); - const t = tweak(Pointk1.fromBytes(evenPub.commitments[0]), merkleRoot); - const signingShare = Fn.toBytes(Fn.add(Fn.fromBytes(keyPackage.signingShare), t)); - return { - identifier: keyPackage.identifier, - signingShare, - } as TRet; -} - -function frostTweakPublic( - pub: TArg, - merkleRoot?: TArg -): TRet { - const PKPackage = frostPubToEvenY(pub); - const t = tweak(Pointk1.fromBytes(PKPackage.commitments[0]), merkleRoot); - const tp = Pointk1.BASE.multiply(t); - const commitments = PKPackage.commitments.map((c, i) => - (i === 0 ? Pointk1.fromBytes(c).add(tp) : Pointk1.fromBytes(c)).toBytes() - ); - const verifyingShares: Record = {}; - for (const k in PKPackage.verifyingShares) { - verifyingShares[k] = Pointk1.fromBytes(PKPackage.verifyingShares[k]).add(tp).toBytes(); - } - return { - signers: { min: PKPackage.signers.min, max: PKPackage.signers.max }, - commitments, - verifyingShares, - } as TRet; -} - -/** - * FROST threshold signatures over secp256k1-schnorr-taproot. RFC 9591. - * DKG outputs are auto-tweaked with the empty Taproot merkle root for compatibility, while - * `trustedDealer()` outputs stay untweaked unless callers apply the Taproot tweak themselves. - * @example - * Create one trusted-dealer package for Taproot-compatible FROST signing. - * - * ```ts - * const alice = schnorr_FROST.Identifier.derive('alice@example.com'); - * const bob = schnorr_FROST.Identifier.derive('bob@example.com'); - * const carol = schnorr_FROST.Identifier.derive('carol@example.com'); - * const deal = schnorr_FROST.trustedDealer({ min: 2, max: 3 }, [alice, bob, carol]); - * ``` - */ -export const schnorr_FROST: TRet = /* @__PURE__ */ (() => - createFROST({ - name: 'FROST-secp256k1-SHA256-TR-v1', - Point: Pointk1, - hashToScalar: secp256k1_hasher.hashToScalar, - hash: sha256, - // Taproot related hacks - parsePublicKey(publicKey) { - // External Taproot keys are x-only, but local key packages still use compressed points. - if (publicKey.length === 32) return lift_x(bytesToNumberBE(publicKey)); - if (publicKey.length === 33) return Pointk1.fromBytes(publicKey); - throw new Error(`expected x-only or compressed public key, got length=${publicKey.length}`); - }, - adjustScalar(n: bigint) { - const PK = Pointk1.BASE.multiply(n); - return hasEven(PK.y) ? n : Pointk1.Fn.neg(n); - }, - adjustPoint: (p) => (hasEven(p.y) ? p : p.negate()), - challenge(R, PK, msg) { - return challenge(pointToBytes(R), pointToBytes(PK), msg); - }, - adjustNonces: frostNoncesToEvenY, - adjustGroupCommitmentShare: (GC, GCShare) => (!hasEven(GC.y) ? GCShare.negate() : GCShare), - adjustPublic: frostPubToEvenY, - adjustSecret: frostSecretToEvenY, - adjustTx: { - // Compat with official implementation - encode: (tx) => tx.subarray(1) as TRet, - decode: (tx) => concatBytes(Uint8Array.of(0x02), tx) as TRet, - }, - adjustDKG: (k) => { - // Compatibility with frost-secp256k1-tr: DKG output is auto-tweaked with the - // empty Taproot merkle root, while dealer-generated keys stay untweaked. - const merkleRoot = new Uint8Array(0); - return { - public: frostTweakPublic(k.public, merkleRoot), - secret: frostTweakSecret(k.secret, k.public, merkleRoot), - }; - }, - }))(); diff --git a/node_modules/@noble/curves/src/utils.ts b/node_modules/@noble/curves/src/utils.ts deleted file mode 100644 index beec9db..0000000 --- a/node_modules/@noble/curves/src/utils.ts +++ /dev/null @@ -1,808 +0,0 @@ -/** - * Hex, bytes and number utilities. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { - abytes as abytes_, - anumber as anumber_, - bytesToHex as bytesToHex_, - concatBytes as concatBytes_, - hexToBytes as hexToBytes_, - isBytes as isBytes_, - randomBytes as randomBytes_, -} from '@noble/hashes/utils.js'; -/** - * Bytes API type helpers for old + new TypeScript. - * - * TS 5.6 has `Uint8Array`, while TS 5.9+ made it generic `Uint8Array`. - * We can't use specific return type, because TS 5.6 will error. - * We can't use generic return type, because most TS 5.9 software will expect specific type. - * - * Maps typed-array input leaves to broad forms. - * These are compatibility adapters, not ownership guarantees. - * - * - `TArg` keeps byte inputs broad. - * - `TRet` marks byte outputs for TS 5.6 and TS 5.9+ compatibility. - */ -export type TypedArg = T extends BigInt64Array - ? BigInt64Array - : T extends BigUint64Array - ? BigUint64Array - : T extends Float32Array - ? Float32Array - : T extends Float64Array - ? Float64Array - : T extends Int16Array - ? Int16Array - : T extends Int32Array - ? Int32Array - : T extends Int8Array - ? Int8Array - : T extends Uint16Array - ? Uint16Array - : T extends Uint32Array - ? Uint32Array - : T extends Uint8ClampedArray - ? Uint8ClampedArray - : T extends Uint8Array - ? Uint8Array - : never; -/** Maps typed-array output leaves to narrow TS-compatible forms. */ -export type TypedRet = T extends BigInt64Array - ? ReturnType - : T extends BigUint64Array - ? ReturnType - : T extends Float32Array - ? ReturnType - : T extends Float64Array - ? ReturnType - : T extends Int16Array - ? ReturnType - : T extends Int32Array - ? ReturnType - : T extends Int8Array - ? ReturnType - : T extends Uint16Array - ? ReturnType - : T extends Uint32Array - ? ReturnType - : T extends Uint8ClampedArray - ? ReturnType - : T extends Uint8Array - ? ReturnType - : never; -/** Recursively adapts byte-carrying API input types. See {@link TypedArg}. */ -export type TArg = - | T - | ([TypedArg] extends [never] - ? T extends (...args: infer A) => infer R - ? ((...args: { [K in keyof A]: TRet }) => TArg) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TArg; - } - : T extends [infer A, ...infer R] - ? [TArg, ...{ [K in keyof R]: TArg }] - : T extends readonly [infer A, ...infer R] - ? readonly [TArg, ...{ [K in keyof R]: TArg }] - : T extends (infer A)[] - ? TArg[] - : T extends readonly (infer A)[] - ? readonly TArg[] - : T extends Promise - ? Promise> - : T extends object - ? { [K in keyof T]: TArg } - : T - : TypedArg); -/** Recursively adapts byte-carrying API output types. See {@link TypedArg}. */ -export type TRet = T extends unknown - ? T & - ([TypedRet] extends [never] - ? T extends (...args: infer A) => infer R - ? ((...args: { [K in keyof A]: TArg }) => TRet) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TRet; - } - : T extends [infer A, ...infer R] - ? [TRet, ...{ [K in keyof R]: TRet }] - : T extends readonly [infer A, ...infer R] - ? readonly [TRet, ...{ [K in keyof R]: TRet }] - : T extends (infer A)[] - ? TRet[] - : T extends readonly (infer A)[] - ? readonly TRet[] - : T extends Promise - ? Promise> - : T extends object - ? { [K in keyof T]: TRet } - : T - : TypedRet) - : never; -/** - * Validates that a value is a byte array. - * @param value - Value to validate. - * @param length - Optional exact byte length. - * @param title - Optional field name. - * @returns Original byte array. - * @example - * Reject non-byte input before passing data into curve code. - * - * ```ts - * abytes(new Uint8Array(1)); - * ``` - */ -export const abytes = >(value: T, length?: number, title?: string): T => - abytes_(value, length, title) as T; -/** - * Validates that a value is a non-negative safe integer. - * @param n - Value to validate. - * @param title - Optional field name. - * @example - * Validate a numeric length before allocating buffers. - * - * ```ts - * anumber(1); - * ``` - */ -export const anumber: typeof anumber_ = anumber_; -/** - * Encodes bytes as lowercase hex. - * @param bytes - Bytes to encode. - * @returns Lowercase hex string. - * @example - * Serialize bytes as hex for logging or fixtures. - * - * ```ts - * bytesToHex(Uint8Array.of(1, 2, 3)); - * ``` - */ -export const bytesToHex: typeof bytesToHex_ = bytesToHex_; -/** - * Concatenates byte arrays. - * @param arrays - Byte arrays to join. - * @returns Concatenated bytes. - * @example - * Join domain-separated chunks into one buffer. - * - * ```ts - * concatBytes(Uint8Array.of(1), Uint8Array.of(2)); - * ``` - */ -export const concatBytes = (...arrays: TArg): TRet => - concatBytes_(...arrays) as TRet; -/** - * Decodes lowercase or uppercase hex into bytes. - * @param hex - Hex string to decode. - * @returns Decoded bytes. - * @example - * Parse fixture hex into bytes before hashing. - * - * ```ts - * hexToBytes('0102'); - * ``` - */ -export const hexToBytes = (hex: string): TRet => hexToBytes_(hex) as TRet; -/** - * Checks whether a value is a Uint8Array. - * @param a - Value to inspect. - * @returns `true` when `a` is a Uint8Array. - * @example - * Branch on byte input before decoding it. - * - * ```ts - * isBytes(new Uint8Array(1)); - * ``` - */ -export const isBytes: typeof isBytes_ = isBytes_; -/** - * Reads random bytes from the platform CSPRNG. - * @param bytesLength - Number of random bytes to read. - * @returns Fresh random bytes. - * @example - * Generate a random seed for a keypair. - * - * ```ts - * randomBytes(2); - * ``` - */ -export const randomBytes = (bytesLength?: number): TRet => - randomBytes_(bytesLength) as TRet; -const _0n = /* @__PURE__ */ BigInt(0); -const _1n = /* @__PURE__ */ BigInt(1); - -/** Callable hash interface with metadata and optional extendable output support. */ -export type CHash = { - /** - * Hash one message. - * @param message - Message bytes to hash. - * @returns Digest bytes. - */ - (message: TArg): TRet; - /** Hash block length in bytes. */ - blockLen: number; - /** Default output length in bytes. */ - outputLen: number; - /** Whether `.create()` can be used as an XOF stream. */ - canXOF: boolean; - /** - * Create one stateful hash or XOF instance, for example SHAKE with a custom output length. - * @param opts - Optional extendable-output configuration: - * - `dkLen` (optional): Optional output length for XOF-style hashes. - * @returns Hash instance. - */ - create(opts?: { dkLen?: number }): any; -}; -/** Plain callable hash interface. */ -export type FHash = (message: TArg) => TRet; -/** HMAC callback signature. */ -export type HmacFn = (key: TArg, message: TArg) => TRet; -/** - * Validates that a flag is boolean. - * @param value - Value to validate. - * @param title - Optional field name. - * @returns Original value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Reject non-boolean option flags early. - * - * ```ts - * abool(true); - * ``` - */ -export function abool(value: boolean, title: string = ''): boolean { - if (typeof value !== 'boolean') { - const prefix = title && `"${title}" `; - throw new TypeError(prefix + 'expected boolean, got type=' + typeof value); - } - return value; -} - -/** - * Validates that a value is a non-negative bigint or safe integer. - * @param n - Value to validate. - * @returns The same validated value. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate one integer-like value before serializing it. - * - * ```ts - * abignumber(1n); - * ``` - */ -export function abignumber(n: T): T { - if (typeof n === 'bigint') { - if (!isPosBig(n)) throw new RangeError('positive bigint expected, got ' + n); - } else anumber(n); - return n; -} - -/** - * Validates that a value is a safe integer. - * @param value - Integer to validate. - * @param title - Optional field name. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate a window size before scalar arithmetic uses it. - * - * ```ts - * asafenumber(1); - * ``` - */ -export function asafenumber(value: number, title: string = ''): void { - if (typeof value !== 'number') { - const prefix = title && `"${title}" `; - throw new TypeError(prefix + 'expected number, got type=' + typeof value); - } - if (!Number.isSafeInteger(value)) { - const prefix = title && `"${title}" `; - throw new RangeError(prefix + 'expected safe integer, got ' + value); - } -} - -/** - * Encodes a bigint into even-length big-endian hex. - * The historical "unpadded" name only means "no fixed-width field padding"; odd-length hex still - * gets one leading zero nibble so the result always represents whole bytes. - * @param num - Number to encode. - * @returns Big-endian hex string. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Encode a scalar into hex without a `0x` prefix. - * - * ```ts - * numberToHexUnpadded(255n); - * ``` - */ -export function numberToHexUnpadded(num: number | bigint): string { - const hex = abignumber(num).toString(16); - return hex.length & 1 ? '0' + hex : hex; -} - -/** - * Parses a big-endian hex string into bigint. - * Accepts odd-length hex through the native `BigInt('0x' + hex)` parser and currently surfaces the - * same native `SyntaxError` for malformed hex instead of wrapping it in a library-specific error. - * @param hex - Hex string without `0x`. - * @returns Parsed bigint value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Parse a scalar from fixture hex. - * - * ```ts - * hexToNumber('ff'); - * ``` - */ -export function hexToNumber(hex: string): bigint { - if (typeof hex !== 'string') throw new TypeError('hex string expected, got ' + typeof hex); - return hex === '' ? _0n : BigInt('0x' + hex); // Big Endian -} - -// BE: Big Endian, LE: Little Endian -/** - * Parses big-endian bytes into bigint. - * @param bytes - Bytes in big-endian order. - * @returns Parsed bigint value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Read a scalar encoded in network byte order. - * - * ```ts - * bytesToNumberBE(Uint8Array.of(1, 0)); - * ``` - */ -export function bytesToNumberBE(bytes: TArg): bigint { - return hexToNumber(bytesToHex_(bytes)); -} -/** - * Parses little-endian bytes into bigint. - * @param bytes - Bytes in little-endian order. - * @returns Parsed bigint value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Read a scalar encoded in little-endian form. - * - * ```ts - * bytesToNumberLE(Uint8Array.of(1, 0)); - * ``` - */ -export function bytesToNumberLE(bytes: TArg): bigint { - return hexToNumber(bytesToHex_(copyBytes(abytes_(bytes)).reverse())); -} - -/** - * Encodes a bigint into fixed-length big-endian bytes. - * @param n - Number to encode. - * @param len - Output length in bytes. Must be greater than zero. - * @returns Big-endian byte array. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Serialize a scalar into a 32-byte field element. - * - * ```ts - * numberToBytesBE(255n, 2); - * ``` - */ -export function numberToBytesBE(n: number | bigint, len: number): TRet { - anumber_(len); - if (len === 0) throw new RangeError('zero length'); - n = abignumber(n); - const hex = n.toString(16); - // Detect overflow before hex parsing so oversized values don't leak the shared odd-hex error. - if (hex.length > len * 2) throw new RangeError('number too large'); - return hexToBytes_(hex.padStart(len * 2, '0')) as TRet; -} -/** - * Encodes a bigint into fixed-length little-endian bytes. - * @param n - Number to encode. - * @param len - Output length in bytes. - * @returns Little-endian byte array. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Serialize a scalar for little-endian protocols. - * - * ```ts - * numberToBytesLE(255n, 2); - * ``` - */ -export function numberToBytesLE(n: number | bigint, len: number): TRet { - return numberToBytesBE(n, len).reverse() as TRet; -} -// Unpadded, rarely used -/** - * Encodes a bigint into variable-length big-endian bytes. - * @param n - Number to encode. - * @returns Variable-length big-endian bytes. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Serialize a bigint without fixed-width padding. - * - * ```ts - * numberToVarBytesBE(255n); - * ``` - */ -export function numberToVarBytesBE(n: number | bigint): TRet { - return hexToBytes_(numberToHexUnpadded(abignumber(n))) as TRet; -} - -// Compares 2 u8a-s in kinda constant time -/** - * Compares two byte arrays in constant-ish time. - * @param a - Left byte array. - * @param b - Right byte array. - * @returns `true` when bytes match. - * @example - * Compare two encoded points without early exit. - * - * ```ts - * equalBytes(Uint8Array.of(1), Uint8Array.of(1)); - * ``` - */ -export function equalBytes(a: TArg, b: TArg): boolean { - a = abytes(a); - b = abytes(b); - if (a.length !== b.length) return false; - let diff = 0; - for (let i = 0; i < a.length; i++) diff |= a[i] ^ b[i]; - return diff === 0; -} - -/** - * Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer, - * and Buffer#slice creates mutable copy. Never use Buffers! - * @param bytes - Bytes to copy. - * @returns Detached copy. - * @example - * Make an isolated copy before mutating serialized bytes. - * - * ```ts - * copyBytes(Uint8Array.of(1, 2, 3)); - * ``` - */ -export function copyBytes(bytes: TArg): TRet { - // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict - // because callers use it at byte-validation boundaries before mutating the detached copy. - return Uint8Array.from(abytes(bytes)) as TRet; -} - -/** - * Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols - * Should be safe to use for things expected to be ASCII. - * Returns exact same result as `TextEncoder` for ASCII or throws. - * @param ascii - ASCII input text. - * @returns Encoded bytes. - * @throws On wrong argument types. {@link TypeError} - * @example - * Encode an ASCII domain-separation tag. - * - * ```ts - * asciiToBytes('ABC'); - * ``` - */ -export function asciiToBytes(ascii: string): TRet { - if (typeof ascii !== 'string') throw new TypeError('ascii string expected, got ' + typeof ascii); - return Uint8Array.from(ascii, (c, i) => { - const charCode = c.charCodeAt(0); - if (c.length !== 1 || charCode > 127) { - throw new RangeError( - `string contains non-ASCII character "${ascii[i]}" with code ${charCode} at position ${i}` - ); - } - return charCode; - }) as TRet; -} - -// Historical name: this accepts non-negative bigints, including zero. -const isPosBig = (n: bigint) => typeof n === 'bigint' && _0n <= n; - -/** - * Checks whether a bigint lies inside a half-open range. - * @param n - Candidate value. - * @param min - Inclusive lower bound. - * @param max - Exclusive upper bound. - * @returns `true` when the value is inside the range. - * @example - * Check whether a candidate scalar fits the field order. - * - * ```ts - * inRange(2n, 1n, 3n); - * ``` - */ -export function inRange(n: bigint, min: bigint, max: bigint): boolean { - return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max; -} - -/** - * Asserts `min <= n < max`. NOTE: upper bound is exclusive. - * @param title - Value label for error messages. - * @param n - Candidate value. - * @param min - Inclusive lower bound. - * @param max - Exclusive upper bound. - * Wrong-type inputs are not separated from out-of-range values here: they still flow through the - * shared `RangeError` path because this is only a throwing wrapper around `inRange(...)`. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Assert that a bigint stays within one half-open range. - * - * ```ts - * aInRange('x', 2n, 1n, 256n); - * ``` - */ -export function aInRange(title: string, n: bigint, min: bigint, max: bigint): void { - // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)? - // consider P=256n, min=0n, max=P - // - a for min=0 would require -1: `inRange('x', x, -1n, P)` - // - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)` - // - our way is the cleanest: `inRange('x', x, 0n, P) - if (!inRange(n, min, max)) - throw new RangeError('expected valid ' + title + ': ' + min + ' <= n < ' + max + ', got ' + n); -} - -// Bit operations - -/** - * Calculates amount of bits in a bigint. - * Same as `n.toString(2).length` - * TODO: merge with nLength in modular - * @param n - Value to inspect. - * @returns Bit length. - * @throws If the value is negative. {@link Error} - * @example - * Measure the bit length of a scalar before serialization. - * - * ```ts - * bitLen(8n); - * ``` - */ -export function bitLen(n: bigint): number { - // Size callers in this repo only use non-negative orders / scalars, so negative inputs are a - // contract bug and must not silently collapse to zero bits. - if (n < _0n) throw new Error('expected non-negative bigint, got ' + n); - let len; - for (len = 0; n > _0n; n >>= _1n, len += 1); - return len; -} - -/** - * Gets single bit at position. - * NOTE: first bit position is 0 (same as arrays) - * Same as `!!+Array.from(n.toString(2)).reverse()[pos]` - * @param n - Source value. - * @param pos - Bit position. Negative positions are passed through to raw - * bigint shift semantics; because the mask is built as `1n << pos`, - * they currently collapse to `0n` and make the helper a no-op. - * @returns Bit as bigint. - * @example - * Gets single bit at position. - * - * ```ts - * bitGet(5n, 0); - * ``` - */ -export function bitGet(n: bigint, pos: number): bigint { - return (n >> BigInt(pos)) & _1n; -} - -/** - * Sets single bit at position. - * @param n - Source value. - * @param pos - Bit position. Negative positions are passed through to raw bigint shift semantics, - * so they currently behave like left shifts. - * @param value - Whether the bit should be set. - * @returns Updated bigint. - * @example - * Sets single bit at position. - * - * ```ts - * bitSet(0n, 1, true); - * ``` - */ -export function bitSet(n: bigint, pos: number, value: boolean): bigint { - const mask = _1n << BigInt(pos); - // Clearing needs AND-not here; OR with zero leaves an already-set bit untouched. - return value ? n | mask : n & ~mask; -} - -/** - * Calculate mask for N bits. Not using ** operator with bigints because of old engines. - * Same as BigInt(`0b${Array(i).fill('1').join('')}`) - * @param n - Number of bits. Negative widths are currently passed through to raw bigint shift - * semantics and therefore produce `-1n`. - * @returns Bitmask value. - * @example - * Calculate mask for N bits. - * - * ```ts - * bitMask(4); - * ``` - */ -export const bitMask = (n: number): bigint => (_1n << BigInt(n)) - _1n; - -// DRBG - -type Pred = (v: TArg) => T | undefined; -/** - * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. - * @param hashLen - Hash output size in bytes. Callers are expected to pass a positive length; `0` - * is not rejected here and would make the internal generate loop non-progressing. - * @param qByteLen - Requested output size in bytes. Callers are expected to pass a positive length. - * @param hmacFn - HMAC implementation. - * @returns Function that will call DRBG until the predicate returns anything - * other than `undefined`. - * @throws On wrong argument types. {@link TypeError} - * @example - * Build a deterministic nonce generator for RFC6979-style signing. - * - * ```ts - * import { createHmacDrbg } from '@noble/curves/utils.js'; - * import { hmac } from '@noble/hashes/hmac.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const drbg = createHmacDrbg(32, 32, (key, msg) => hmac(sha256, key, msg)); - * const seed = new Uint8Array(32); - * drbg(seed, (bytes) => bytes); - * ``` - */ -export function createHmacDrbg( - hashLen: number, - qByteLen: number, - hmacFn: TArg -): TRet<(seed: Uint8Array, predicate: Pred) => T> { - anumber_(hashLen, 'hashLen'); - anumber_(qByteLen, 'qByteLen'); - if (typeof hmacFn !== 'function') throw new TypeError('hmacFn must be a function'); - // creates Uint8Array - const u8n = (len: number): TRet => new Uint8Array(len) as TRet; - const NULL = Uint8Array.of(); - const byte0 = Uint8Array.of(0x00); - const byte1 = Uint8Array.of(0x01); - const _maxDrbgIters = 1000; - - // Step B, Step C: set hashLen to 8*ceil(hlen/8). - // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 signatures. - let v: Uint8Array = u8n(hashLen); - // Steps B and C of RFC6979 3.2. - let k: Uint8Array = u8n(hashLen); - let i = 0; // Iterations counter, will throw when over 1000 - const reset = () => { - v.fill(1); - k.fill(0); - i = 0; - }; - // hmac(k)(v, ...values) - const h = (...msgs: TArg) => (hmacFn as HmacFn)(k, concatBytes(v, ...msgs)); - const reseed = (seed: TArg = NULL) => { - // HMAC-DRBG reseed() function. Steps D-G - k = h(byte0, seed); // k = hmac(k || v || 0x00 || seed) - v = h(); // v = hmac(k || v) - if (seed.length === 0) return; - k = h(byte1, seed); // k = hmac(k || v || 0x01 || seed) - v = h(); // v = hmac(k || v) - }; - const gen = () => { - // HMAC-DRBG generate() function - if (i++ >= _maxDrbgIters) throw new Error('drbg: tried max amount of iterations'); - let len = 0; - const out: Uint8Array[] = []; - while (len < qByteLen) { - v = h(); - const sl = v.slice(); - out.push(sl); - len += v.length; - } - return concatBytes(...out); - }; - const genUntil = (seed: TArg, pred: TArg>): T => { - reset(); - reseed(seed); // Steps D-G - let res: T | undefined = undefined; // Step H: grind until the predicate accepts a candidate. - // Falsy values like 0 are valid outputs. - while ((res = (pred as Pred)(gen())) === undefined) reseed(); - reset(); - return res; - }; - return genUntil as TRet<(seed: Uint8Array, predicate: Pred) => T>; -} - -/** - * Validates declared required and optional field types on a plain object. - * Extra keys are intentionally ignored because many callers validate only the subset they use from - * richer option bags or runtime objects. - * @param object - Object to validate. - * @param fields - Required field types. - * @param optFields - Optional field types. - * @throws On wrong argument types. {@link TypeError} - * @example - * Check user options before building a curve helper. - * - * ```ts - * validateObject({ flag: true }, { flag: 'boolean' }); - * ``` - */ -export function validateObject( - object: Record, - fields: Record = {}, - optFields: Record = {} -): void { - if (Object.prototype.toString.call(object) !== '[object Object]') - throw new TypeError('expected valid options object'); - type Item = keyof typeof object; - function checkField(fieldName: Item, expectedType: string, isOpt: boolean) { - // Config/data fields must be explicit own properties, but runtime objects such as Field - // instances intentionally satisfy required method slots via their shared prototype. - if (!isOpt && expectedType !== 'function' && !Object.hasOwn(object, fieldName)) - throw new TypeError(`param "${fieldName}" is invalid: expected own property`); - const val = object[fieldName]; - if (isOpt && val === undefined) return; - const current = typeof val; - if (current !== expectedType || val === null) - throw new TypeError( - `param "${fieldName}" is invalid: expected ${expectedType}, got ${current}` - ); - } - const iter = (f: typeof fields, isOpt: boolean) => - Object.entries(f).forEach(([k, v]) => checkField(k, v, isOpt)); - iter(fields, false); - iter(optFields, true); -} - -/** - * Throws not implemented error. - * @returns Never returns. - * @throws If the unfinished code path is reached. {@link Error} - * @example - * Surface the placeholder error from an unfinished code path. - * - * ```ts - * try { - * notImplemented(); - * } catch {} - * ``` - */ -export const notImplemented = (): never => { - throw new Error('not implemented'); -}; - -/** Generic keygen/getPublicKey interface shared by curve helpers. */ -export interface CryptoKeys { - /** Public byte lengths for keys and optional seeds. */ - lengths: { seed?: number; public?: number; secret?: number }; - /** - * Generate one secret/public keypair. - * @param seed - Optional seed bytes for deterministic key generation. - * @returns Fresh secret/public keypair. - */ - keygen: (seed?: Uint8Array) => { secretKey: Uint8Array; publicKey: Uint8Array }; - /** - * Derive one public key from a secret key. - * @param secretKey - Secret key bytes. - * @returns Public key bytes. - */ - getPublicKey: (secretKey: Uint8Array) => Uint8Array; -} - -/** Generic interface for signatures. Has keygen, sign and verify. */ -export interface Signer extends CryptoKeys { - // Interfaces are fun. We cannot just add new fields without copying old ones. - /** Public byte lengths for keys, signatures, and optional signing randomness. */ - lengths: { - seed?: number; - public?: number; - secret?: number; - signRand?: number; - signature?: number; - }; - /** - * Sign one message. - * @param msg - Message bytes to sign. - * @param secretKey - Secret key bytes. - * @returns Signature bytes. - */ - sign: (msg: Uint8Array, secretKey: Uint8Array) => Uint8Array; - /** - * Verify one signature. - * @param sig - Signature bytes. - * @param msg - Signed message bytes. - * @param publicKey - Public key bytes. - * @returns `true` when the signature is valid. - */ - verify: (sig: Uint8Array, msg: Uint8Array, publicKey: Uint8Array) => boolean; -} diff --git a/node_modules/@noble/curves/src/webcrypto.ts b/node_modules/@noble/curves/src/webcrypto.ts deleted file mode 100644 index b30755c..0000000 --- a/node_modules/@noble/curves/src/webcrypto.ts +++ /dev/null @@ -1,632 +0,0 @@ -/** - * Friendly wrapper over elliptic curves from built-in WebCrypto. Experimental: API may change. - -# WebCrypto issues - -## No way to get public keys - -- Export of raw secret key is prohibited by spec: - - https://w3c.github.io/webcrypto/#ecdsa-operations-export-key - -> "If format is "raw":" -> "If the [[type]] internal slot of key is not "public", - then throw an InvalidAccessError." -- Import of raw secret keys is prohibited by spec: - - https://w3c.github.io/webcrypto/#ecdsa-operations-import-key - -> "If format is "raw":" -> "If usages contains a value which is not "verify" - then throw a SyntaxError." -- SPKI (Simple public-key infrastructure) is public-key-only -- PKCS8 is secret-key-only -- No way to get public key from secret key, but we convert to JWK and then - create it manually, since a JWK secret key includes both private and public - parts. -- Noble supports generating keys for both sign, verify & getSharedSecret, - but JWK key includes usage, which forces us to patch it (non-JWK is ok) -- We have import/export for 'raw', but it doesn't work in Firefox / Safari - -## Point encoding - -- Raw export of public points returns uncompressed points, - but this is implementation specific and not much we can do there. -- `getSharedSecret` differs for p256, p384, p521: - Noble returns 33-byte output (y-parity + x coordinate), - while in WebCrypto returns 32-byte output (x coordinate). - This is intentional: noble keeps the full encoded shared point, and x-only - callers can slice it down themselves. -- `getSharedSecret` identical for X25519, X448 - -## Availability - -Node.js additionally supports ed448. -There seems no reasonable way to check for availability, other than actually calling methods. - - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import type { TArg, TRet } from './utils.ts'; - -/** Raw type */ -const TYPE_RAW = 'raw'; -const TYPE_JWK = 'jwk'; -const TYPE_SPKI = 'spki'; -const TYPE_PKCS = 'pkcs8'; -/** Key serialization formats supported by the WebCrypto wrappers. */ -export type WebCryptoFormat = - | typeof TYPE_RAW - | typeof TYPE_JWK - | typeof TYPE_SPKI - | typeof TYPE_PKCS; -/** WebCrypto keys can be in raw, jwk, pkcs8/spki formats. Raw is internal and fragile. */ -export type WebCryptoOpts = { - /** Preferred secret-key serialization format. */ - formatSec?: WebCryptoFormat; - /** Preferred public-key serialization format. */ - formatPub?: WebCryptoFormat; -}; -// default formats -const dfsec = TYPE_PKCS; -const dfpub = TYPE_SPKI; - -function getSubtle(): any { - const s: any = globalThis?.crypto?.subtle; - if (typeof s === 'object' && s != null) return s; - throw new Error('crypto.subtle must be defined'); -} - -function createKeygenA( - randomSecretKey: any, - getPublicKey: any -): TRet<(seed?: Uint8Array) => Promise<{ secretKey: Uint8Array; publicKey: Uint8Array }>> { - // Runtime accepts an accidental `keygen(seed)` argument for parity with other wrappers, but the - // seed is intentionally ignored because WebCrypto keygen here always goes through fresh keygen. - return async function keygenA(_seed?: TArg) { - const secretKey = (await randomSecretKey()) as TRet; - return { secretKey, publicKey: (await getPublicKey(secretKey)) as TRet }; - }; -} - -// Internal helper only: strict hex parser for the local hardcoded PKCS8 header constants. -function hexToBytesLocal(hex: string): TRet { - const pairs = hex.match(/[0-9a-f]{2}/gi); - if (!pairs || pairs.length * 2 !== hex.length) throw new Error('invalid hex'); - return Uint8Array.from(pairs, (b) => Number.parseInt(b, 16)) as TRet; -} - -export const __TEST: { hexToBytesLocal: typeof hexToBytesLocal } = /* @__PURE__ */ Object.freeze({ - hexToBytesLocal, -}); - -// Trying to do generics here creates hell on conversion and usage -type JsonWebKey = { - crv?: string; - d?: string; - kty?: string; - x?: string; - y?: string; - [key: string]: unknown; -}; -type Key = JsonWebKey | Uint8Array; -type CryptoKey = Awaited>; -type KeyUsage = 'deriveBits' | 'deriveKey' | 'sign' | 'verify'; -type Algo = string | { name: string; namedCurve: string }; -type SigAlgo = string | { name: string; hash?: { name: string } }; - -type KeyUtils = { - import(key: TArg, format?: WebCryptoFormat): Promise; - export(key: CryptoKey, format?: WebCryptoFormat): TRet>; - convert( - key: TArg, - inFormat?: WebCryptoFormat, - outFormat?: WebCryptoFormat - ): TRet>; -}; - -function assertType(type: 'private' | 'public', key: any) { - // Callers are expected to pass a non-null key-like object; `null` / `undefined` still fail first - // via property access before reaching the explicit wrapper error. - if (key.type !== type) throw new Error(`invalid key type, expected ${type}`); -} - -function createKeyUtils(algo: Algo, derive: boolean, keyLen: number, pkcs8header: string) { - const secUsage: KeyUsage[] = derive ? ['deriveBits'] : ['sign']; - const pubUsage: KeyUsage[] = derive ? [] : ['verify']; - // Return Uint8Array instead of ArrayBuffer - const arrBufToU8 = (res: TArg, format: WebCryptoFormat): TRet => - (format === TYPE_JWK - ? (res as JsonWebKey) - : new Uint8Array(res as unknown as ArrayBuffer)) as TRet; - const pub: KeyUtils = { - async import(key: TArg, format: WebCryptoFormat): Promise { - // For sign/verify wrappers we pass caller-provided JWK metadata through unchanged and let - // WebCrypto enforce mismatched `key_ops` / extractability instead of normalizing it here. - const keyi: CryptoKey = await getSubtle().importKey(format, key, algo, true, pubUsage); - assertType('public', keyi); - return keyi; - }, - async export(key: CryptoKey, format: WebCryptoFormat): Promise> { - assertType('public', key); - const keyi = await getSubtle().exportKey(format, key); - return arrBufToU8(keyi, format); - }, - async convert( - key: TArg, - inFormat: WebCryptoFormat, - outFormat: WebCryptoFormat - ): Promise> { - return pub.export(await pub.import(key, inFormat), outFormat); - }, - }; - const priv: KeyUtils = { - async import(key: TArg, format: WebCryptoFormat): Promise { - const crypto = getSubtle(); - let keyi: CryptoKey; - if (format === TYPE_RAW) { - // Chrome, node, bun, deno: works - // Safari, Firefox: Data provided to an operation does not meet requirements - // This is the best one can do. JWK can't be used: it contains public key component inside. - const k = key as Uint8Array; - const head = hexToBytesLocal(pkcs8header); - const all = new Uint8Array(head.length + k.length); - all.set(head, 0); - all.set(k, head.length); - - keyi = await crypto.importKey(TYPE_PKCS, all, algo, true, secUsage); - } else { - // Sign/verify wrappers keep caller JWK metadata as-is and assume the supplied `key_ops` - // already match the requested operation. ECDH is different: noble treats the same key - // material as usable for both sign and derive, so JWK imported through the derive path - // must rewrite `key_ops` or WebCrypto refuses otherwise-correct keys exported by keygen. - if (derive && format === TYPE_JWK) key = { ...key, key_ops: secUsage }; - keyi = await crypto.importKey(format, key, algo, true, secUsage); - } - assertType('private', keyi); - return keyi; - }, - async export(key: CryptoKey, format: WebCryptoFormat): Promise> { - const crypto = getSubtle(); - assertType('private', key); - if (format === TYPE_RAW) { - // scure-base base64urlnopad could have been used, but we can't add more deps. - // pkcs8 would be even more fragile - const jwk = await crypto.exportKey(TYPE_JWK, key); - const base64 = jwk.d.replace(/-/g, '+').replace(/_/g, '/'); // base64url - const pad = base64.length % 4 ? '='.repeat(4 - (base64.length % 4)) : ''; // add padding - const binary = atob(base64 + pad); - // This is not ASCII, and not text: this is only semi-safe with atob output - const raw = Uint8Array.from(binary, (c) => c.charCodeAt(0)); - // Pad key to key len because Bun strips leading zero for P-521 only - const res = new Uint8Array(keyLen); - res.set(raw, keyLen - raw.length); - return res as TRet; - } - const keyi = await crypto.exportKey(format, key); - return arrBufToU8(keyi, format); - }, - async convert( - key: TArg, - inFormat: WebCryptoFormat, - outFormat: WebCryptoFormat - ): Promise> { - return priv.export(await priv.import(key, inFormat), outFormat); - }, - }; - async function getPublicKey( - secretKey: TArg, - opts: TArg = {} - ): Promise> { - const fsec = opts.formatSec ?? dfsec; - const fpub = opts.formatPub ?? dfpub; - // Export to jwk, remove private scalar and then convert to format - const jwk = ( - fsec === TYPE_JWK ? { ...secretKey } : await priv.convert(secretKey, fsec, TYPE_JWK) - ) as JsonWebKey; - delete jwk.d; - jwk.key_ops = pubUsage; - if (fpub === TYPE_JWK) return jwk as TRet; - return pub.convert(jwk, TYPE_JWK, fpub); - } - async function randomSecretKey(format: WebCryptoFormat = dfsec): Promise> { - const keyPair = await getSubtle().generateKey(algo, true, secUsage); - return priv.export(keyPair.privateKey, format); - } - // Key generation could be slow, so we cache result once. - let supported: boolean | undefined; - return { - pub: pub as KeyUtils, - priv: priv as KeyUtils, - async isSupported(): Promise { - if (supported !== undefined) return supported; - try { - const crypto = getSubtle(); - const key = await crypto.generateKey(algo, true, secUsage); - // Deno is broken and generates key for unsupported curves, but then fails on export - await priv.export(key.privateKey, TYPE_JWK); - // Bun fails on derive for x25519, but not x448 - if (derive) { - await crypto.deriveBits( - { name: typeof algo === 'string' ? algo : algo.name, public: key.publicKey }, - key.privateKey, - 8 - ); - } - return (supported = true); - } catch (e) { - return (supported = false); - } - }, - getPublicKey, - keygen: createKeygenA(randomSecretKey, getPublicKey), - utils: Object.freeze({ - randomSecretKey, - // Runtime expects both formats explicitly here; omitted formats just flow into - // `subtle.importKey(...)`, and JWK conversion also assumes extractable keys (`ext !== false`). - convertPublicKey: pub.convert as KeyUtils['convert'], - // Runtime expects both formats explicitly here; omitted formats just flow into - // `subtle.importKey(...)`, and JWK conversion also assumes extractable keys (`ext !== false`). - convertSecretKey: priv.convert as KeyUtils['convert'], - }), - }; -} - -function createSigner( - keys: ReturnType, - algo: SigAlgo -): TRet { - return { - // Historical param name: wrappers pass message bytes here, while WebCrypto performs the - // algorithm-specific hashing itself for ECDSA. We also return provider signatures verbatim: - // this wrapper is intentionally "raw WebCrypto", so it does not parse scalars or normalize - // high-S ECDSA outputs into software noble's low-S convention. - async sign( - msgHash: TArg, - secretKey: TArg, - opts: TArg = {} - ): Promise> { - const key = await keys.priv.import(secretKey, opts.formatSec ?? dfsec); - const sig = await getSubtle().sign(algo, key, msgHash); - return new Uint8Array(sig) as TRet; - }, - async verify( - signature: TArg, - msgHash: TArg, - publicKey: TArg, - opts: TArg = {} - ): Promise { - const key = await keys.pub.import(publicKey, opts.formatPub ?? dfpub); - return await getSubtle().verify(algo, key, signature, msgHash); - }, - }; -} - -function createECDH( - keys: ReturnType, - algo: Algo, - keyLen: number -): TRet { - return { - // Runtime accepts the alternate key formats supported by `keys.import(...)`; the public type is - // still narrower than that accepted surface. - async getSharedSecret( - secretKeyA: TArg, - publicKeyB: TArg, - opts: TArg = {} - ): Promise> { - // if (_isCompressed !== true) throw new Error('WebCrypto only supports compressed keys'); - const secKey = await keys.priv.import( - secretKeyA, - opts.formatSec === undefined ? dfsec : opts.formatSec - ); - const pubKey = await keys.pub.import( - publicKeyB, - opts.formatPub === undefined ? dfpub : opts.formatPub - ); - const shared = await getSubtle().deriveBits( - { name: typeof algo === 'string' ? algo : algo.name, public: pubKey }, - secKey, - 8 * keyLen - ); - return new Uint8Array(shared) as TRet; - }, - }; -} - -type WebCryptoBaseCurve = { - name: string; - isSupported(): Promise; - keygen(): TRet>; - getPublicKey(secretKey: TArg, opts?: TArg): TRet>; - utils: { - randomSecretKey: (format?: WebCryptoFormat) => TRet>; - convertSecretKey: ( - key: TArg, - inFormat?: WebCryptoFormat, - outFormat?: WebCryptoFormat - ) => TRet>; - convertPublicKey: ( - key: TArg, - inFormat?: WebCryptoFormat, - outFormat?: WebCryptoFormat - ) => TRet>; - }; -}; - -// Specific per-curve methods - no reason to export them; we can't "add" a new curve -/** WebCrypto signing interface shared by ECDSA and EdDSA helpers. */ -export type WebCryptoSigner = { - /** - * Sign one message with a WebCrypto-backed private key. - * @param message - Message bytes to sign. - * @param secretKey - Secret key in one supported format. - * @param opts - Optional key-format overrides. See {@link WebCryptoOpts}. - * @returns Signature bytes. - */ - sign( - message: TArg, - secretKey: TArg, - opts?: TArg - ): TRet>; - /** - * Verify one signature with a WebCrypto-backed public key. - * @param signature - Signature bytes. - * @param message - Signed message bytes. - * @param publicKey - Public key in one supported format. - * @param opts - Optional key-format overrides. See {@link WebCryptoOpts}. - * @returns `true` when the signature is valid. - */ - verify( - signature: TArg, - message: TArg, - publicKey: TArg, - opts?: TArg - ): Promise; -}; -/** WebCrypto ECDH interface for shared-secret derivation. */ -export type WebCryptoECDH = { - /** - * Derive one shared secret from a local secret key and peer public key. - * Short-Weierstrass wrappers return the raw x-coordinate here, not noble's parity-prefixed - * shared-point encoding. Runtime also accepts alternate key formats through `opts`, even though - * this public type is still narrowed to byte arrays. - * @param secA - Local secret key in one supported format. - * @param pubB - Peer public key in one supported format. - * @param opts - Optional key-format overrides. See {@link WebCryptoOpts}. - * @returns Shared secret bytes. - */ - getSharedSecret( - secA: TArg, - pubB: TArg, - opts?: TArg - ): TRet>; -}; -/** WebCrypto ECDSA interface with keygen, signing, and ECDH helpers. */ -export type WebCryptoECDSA = WebCryptoBaseCurve & WebCryptoSigner & WebCryptoECDH; -/** WebCrypto EdDSA interface with keygen and signing helpers. */ -export type WebCryptoEdDSA = WebCryptoBaseCurve & WebCryptoSigner; -/** WebCrypto Montgomery interface with keygen and ECDH helpers. */ -export type WebCryptoMontgomery = WebCryptoBaseCurve & WebCryptoECDH; - -function wrapECDSA( - curve: 'P-256' | 'P-384' | 'P-521', - hash: string, - keyLen: number, - pkcs8header: string -): TRet { - const ECDH_ALGO = { name: 'ECDH', namedCurve: curve }; - const keys = createKeyUtils({ name: 'ECDSA', namedCurve: curve }, false, keyLen, pkcs8header); - const keysEcdh = createKeyUtils(ECDH_ALGO, true, keyLen, pkcs8header); - return Object.freeze({ - name: curve, - // Support probing comes from the sign-side wrapper only; ECDH availability is not checked - // independently here even though the public wrapper also exposes `getSharedSecret(...)`. - isSupported: keys.isSupported, - getPublicKey: keys.getPublicKey, - keygen: createKeygenA(keys.utils.randomSecretKey, keys.getPublicKey), - ...createSigner(keys, { name: 'ECDSA', hash: { name: hash } }), - ...createECDH(keysEcdh, ECDH_ALGO, keyLen), - utils: Object.freeze({ - ...keys.utils, - async convertSecretKey( - key: TArg, - inFormat?: WebCryptoFormat, - outFormat?: WebCryptoFormat - ): Promise> { - const jwk = inFormat === TYPE_JWK ? (key as JsonWebKey) : undefined; - // `wrapECDSA(...)` exposes the same key material for both sign and derive, so an ECDH-flavored - // JWK secret key from `getSharedSecret(...)` should still round-trip through `utils`. - if ( - Array.isArray(jwk?.key_ops) && - jwk.key_ops.length === 1 && - jwk.key_ops[0] === 'deriveBits' - ) - return keysEcdh.utils.convertSecretKey(key, inFormat, outFormat); - return keys.utils.convertSecretKey(key, inFormat, outFormat); - }, - }), - }); -} - -function wrapEdDSA( - curve: 'Ed25519' | 'Ed448', - keyLen: number, - pkcs8header: string -): TRet { - const keys = createKeyUtils(curve, false, keyLen, pkcs8header); - return Object.freeze({ - name: curve, - isSupported: keys.isSupported, - // This wrapper intentionally re-exports the generic WebCrypto key-conversion/signing behavior - // without adding extra JWK-metadata or extractability guardrails of its own. - getPublicKey: keys.getPublicKey, - keygen: createKeygenA(keys.utils.randomSecretKey, keys.getPublicKey), - ...createSigner(keys, { name: curve }), - utils: keys.utils, - }); -} - -function wrapMontgomery( - curve: 'X25519' | 'X448', - keyLen: number, - pkcs8header: string -): TRet { - const keys = createKeyUtils(curve, true, keyLen, pkcs8header); - return Object.freeze({ - name: curve, - isSupported: keys.isSupported, - // This wrapper intentionally re-exports the generic ECDH key-format behavior without widening - // the narrow public `Uint8Array` key types. - getPublicKey: keys.getPublicKey, - keygen: createKeygenA(keys.utils.randomSecretKey, keys.getPublicKey), - ...createECDH(keys, curve, keyLen), - utils: keys.utils, - }); -} - -/** - * Friendly wrapper over built-in WebCrypto NIST P-256 (secp256r1). - * Inherits the generic WebCrypto ECDSA caveats: `isSupported()` only probes the sign-side API, and - * the conversion/signing helpers keep the shared `createKeyUtils(...)` / `createSigner(...)` quirks, - * including raw WebCrypto ECDSA signatures without low-S normalization. - * @example - * Check support, then sign and verify once with WebCrypto P-256. - * - * ```ts - * if (await p256.isSupported()) { - * const { secretKey, publicKey } = await p256.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await p256.sign(msg, secretKey); - * const isValid = await p256.verify(sig, msg, publicKey); - * } - * ``` - */ -export const p256: TRet = /* @__PURE__ */ wrapECDSA( - 'P-256', - 'SHA-256', - 32, - '3041020100301306072a8648ce3d020106082a8648ce3d030107042730250201010420' -); - -/** - * Friendly wrapper over built-in WebCrypto NIST P-384 (secp384r1). - * Inherits the generic WebCrypto ECDSA caveats around support probing and key/signing conversion. - * @example - * Check support, then sign and verify once with WebCrypto P-384. - * - * ```ts - * if (await p384.isSupported()) { - * const { secretKey, publicKey } = await p384.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await p384.sign(msg, secretKey); - * const isValid = await p384.verify(sig, msg, publicKey); - * } - * ``` - */ -export const p384: TRet = /* @__PURE__ */ wrapECDSA( - 'P-384', - 'SHA-384', - 48, - '304e020100301006072a8648ce3d020106052b81040022043730350201010430' -); - -/** - * Friendly wrapper over built-in WebCrypto NIST P-521 (secp521r1). - * Inherits the generic WebCrypto ECDSA caveats around support probing and key/signing conversion. - * @example - * Check support, then sign and verify once with WebCrypto P-521. - * - * ```ts - * if (await p521.isSupported()) { - * const { secretKey, publicKey } = await p521.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await p521.sign(msg, secretKey); - * const isValid = await p521.verify(sig, msg, publicKey); - * } - * ``` - */ -export const p521: TRet = /* @__PURE__ */ wrapECDSA( - 'P-521', - 'SHA-512', - 66, - '3060020100301006072a8648ce3d020106052b81040023044930470201010442' -); - -/** - * Friendly wrapper over built-in WebCrypto ed25519. - * Inherits the generic WebCrypto EdDSA caveats around JWK conversion metadata and extractability. - * @example - * Check support, then sign and verify once with WebCrypto Ed25519. - * - * ```ts - * if (await ed25519.isSupported()) { - * const { secretKey, publicKey } = await ed25519.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await ed25519.sign(msg, secretKey); - * const isValid = await ed25519.verify(sig, msg, publicKey); - * } - * ``` - */ -export const ed25519: TRet = /* @__PURE__ */ wrapEdDSA( - 'Ed25519', - 32, - '302e020100300506032b657004220420' -); - -/** - * Friendly wrapper over built-in WebCrypto ed448. - * Inherits the generic WebCrypto EdDSA caveats around JWK conversion metadata and extractability. - * @example - * Check support, then sign and verify once with WebCrypto Ed448. - * - * ```ts - * if (await ed448.isSupported()) { - * const { secretKey, publicKey } = await ed448.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await ed448.sign(msg, secretKey); - * const isValid = await ed448.verify(sig, msg, publicKey); - * } - * ``` - */ -export const ed448: TRet = /* @__PURE__ */ wrapEdDSA( - 'Ed448', - 57, - '3047020100300506032b6571043b0439' -); - -/** - * Friendly wrapper over built-in WebCrypto x25519 (ECDH over Curve25519). - * Inherits the generic WebCrypto Montgomery caveat that runtime accepts more key formats than the - * narrow public `Uint8Array` argument types suggest. - * @example - * Check support, then derive one shared secret with WebCrypto X25519. - * - * ```ts - * if (await x25519.isSupported()) { - * const alice = await x25519.keygen(); - * const bob = await x25519.keygen(); - * const shared = await x25519.getSharedSecret(alice.secretKey, bob.publicKey); - * } - * ``` - */ -export const x25519: TRet = /* @__PURE__ */ wrapMontgomery( - 'X25519', - 32, - '302e020100300506032b656e04220420' -); - -/** - * Friendly wrapper over built-in WebCrypto x448 (ECDH over Curve448). - * Inherits the generic WebCrypto Montgomery caveat that runtime accepts more key formats than the - * narrow public `Uint8Array` argument types suggest. - * @example - * Check support, then derive one shared secret with WebCrypto X448. - * - * ```ts - * if (await x448.isSupported()) { - * const alice = await x448.keygen(); - * const bob = await x448.keygen(); - * const shared = await x448.getSharedSecret(alice.secretKey, bob.publicKey); - * } - * ``` - */ -export const x448: TRet = /* @__PURE__ */ wrapMontgomery( - 'X448', - 56, - '3046020100300506032b656f043a0438' -); diff --git a/node_modules/@noble/curves/utils.d.ts b/node_modules/@noble/curves/utils.d.ts deleted file mode 100644 index 078e8d9..0000000 --- a/node_modules/@noble/curves/utils.d.ts +++ /dev/null @@ -1,536 +0,0 @@ -/** - * Hex, bytes and number utilities. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { anumber as anumber_, bytesToHex as bytesToHex_, isBytes as isBytes_ } from '@noble/hashes/utils.js'; -/** - * Bytes API type helpers for old + new TypeScript. - * - * TS 5.6 has `Uint8Array`, while TS 5.9+ made it generic `Uint8Array`. - * We can't use specific return type, because TS 5.6 will error. - * We can't use generic return type, because most TS 5.9 software will expect specific type. - * - * Maps typed-array input leaves to broad forms. - * These are compatibility adapters, not ownership guarantees. - * - * - `TArg` keeps byte inputs broad. - * - `TRet` marks byte outputs for TS 5.6 and TS 5.9+ compatibility. - */ -export type TypedArg = T extends BigInt64Array ? BigInt64Array : T extends BigUint64Array ? BigUint64Array : T extends Float32Array ? Float32Array : T extends Float64Array ? Float64Array : T extends Int16Array ? Int16Array : T extends Int32Array ? Int32Array : T extends Int8Array ? Int8Array : T extends Uint16Array ? Uint16Array : T extends Uint32Array ? Uint32Array : T extends Uint8ClampedArray ? Uint8ClampedArray : T extends Uint8Array ? Uint8Array : never; -/** Maps typed-array output leaves to narrow TS-compatible forms. */ -export type TypedRet = T extends BigInt64Array ? ReturnType : T extends BigUint64Array ? ReturnType : T extends Float32Array ? ReturnType : T extends Float64Array ? ReturnType : T extends Int16Array ? ReturnType : T extends Int32Array ? ReturnType : T extends Int8Array ? ReturnType : T extends Uint16Array ? ReturnType : T extends Uint32Array ? ReturnType : T extends Uint8ClampedArray ? ReturnType : T extends Uint8Array ? ReturnType : never; -/** Recursively adapts byte-carrying API input types. See {@link TypedArg}. */ -export type TArg = T | ([TypedArg] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: { - [K in keyof A]: TRet; -}) => TArg) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TArg; -} : T extends [infer A, ...infer R] ? [TArg, ...{ - [K in keyof R]: TArg; -}] : T extends readonly [infer A, ...infer R] ? readonly [TArg, ...{ - [K in keyof R]: TArg; -}] : T extends (infer A)[] ? TArg[] : T extends readonly (infer A)[] ? readonly TArg[] : T extends Promise ? Promise> : T extends object ? { - [K in keyof T]: TArg; -} : T : TypedArg); -/** Recursively adapts byte-carrying API output types. See {@link TypedArg}. */ -export type TRet = T extends unknown ? T & ([TypedRet] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: { - [K in keyof A]: TArg; -}) => TRet) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TRet; -} : T extends [infer A, ...infer R] ? [TRet, ...{ - [K in keyof R]: TRet; -}] : T extends readonly [infer A, ...infer R] ? readonly [TRet, ...{ - [K in keyof R]: TRet; -}] : T extends (infer A)[] ? TRet[] : T extends readonly (infer A)[] ? readonly TRet[] : T extends Promise ? Promise> : T extends object ? { - [K in keyof T]: TRet; -} : T : TypedRet) : never; -/** - * Validates that a value is a byte array. - * @param value - Value to validate. - * @param length - Optional exact byte length. - * @param title - Optional field name. - * @returns Original byte array. - * @example - * Reject non-byte input before passing data into curve code. - * - * ```ts - * abytes(new Uint8Array(1)); - * ``` - */ -export declare const abytes: >(value: T, length?: number, title?: string) => T; -/** - * Validates that a value is a non-negative safe integer. - * @param n - Value to validate. - * @param title - Optional field name. - * @example - * Validate a numeric length before allocating buffers. - * - * ```ts - * anumber(1); - * ``` - */ -export declare const anumber: typeof anumber_; -/** - * Encodes bytes as lowercase hex. - * @param bytes - Bytes to encode. - * @returns Lowercase hex string. - * @example - * Serialize bytes as hex for logging or fixtures. - * - * ```ts - * bytesToHex(Uint8Array.of(1, 2, 3)); - * ``` - */ -export declare const bytesToHex: typeof bytesToHex_; -/** - * Concatenates byte arrays. - * @param arrays - Byte arrays to join. - * @returns Concatenated bytes. - * @example - * Join domain-separated chunks into one buffer. - * - * ```ts - * concatBytes(Uint8Array.of(1), Uint8Array.of(2)); - * ``` - */ -export declare const concatBytes: (...arrays: TArg) => TRet; -/** - * Decodes lowercase or uppercase hex into bytes. - * @param hex - Hex string to decode. - * @returns Decoded bytes. - * @example - * Parse fixture hex into bytes before hashing. - * - * ```ts - * hexToBytes('0102'); - * ``` - */ -export declare const hexToBytes: (hex: string) => TRet; -/** - * Checks whether a value is a Uint8Array. - * @param a - Value to inspect. - * @returns `true` when `a` is a Uint8Array. - * @example - * Branch on byte input before decoding it. - * - * ```ts - * isBytes(new Uint8Array(1)); - * ``` - */ -export declare const isBytes: typeof isBytes_; -/** - * Reads random bytes from the platform CSPRNG. - * @param bytesLength - Number of random bytes to read. - * @returns Fresh random bytes. - * @example - * Generate a random seed for a keypair. - * - * ```ts - * randomBytes(2); - * ``` - */ -export declare const randomBytes: (bytesLength?: number) => TRet; -/** Callable hash interface with metadata and optional extendable output support. */ -export type CHash = { - /** - * Hash one message. - * @param message - Message bytes to hash. - * @returns Digest bytes. - */ - (message: TArg): TRet; - /** Hash block length in bytes. */ - blockLen: number; - /** Default output length in bytes. */ - outputLen: number; - /** Whether `.create()` can be used as an XOF stream. */ - canXOF: boolean; - /** - * Create one stateful hash or XOF instance, for example SHAKE with a custom output length. - * @param opts - Optional extendable-output configuration: - * - `dkLen` (optional): Optional output length for XOF-style hashes. - * @returns Hash instance. - */ - create(opts?: { - dkLen?: number; - }): any; -}; -/** Plain callable hash interface. */ -export type FHash = (message: TArg) => TRet; -/** HMAC callback signature. */ -export type HmacFn = (key: TArg, message: TArg) => TRet; -/** - * Validates that a flag is boolean. - * @param value - Value to validate. - * @param title - Optional field name. - * @returns Original value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Reject non-boolean option flags early. - * - * ```ts - * abool(true); - * ``` - */ -export declare function abool(value: boolean, title?: string): boolean; -/** - * Validates that a value is a non-negative bigint or safe integer. - * @param n - Value to validate. - * @returns The same validated value. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate one integer-like value before serializing it. - * - * ```ts - * abignumber(1n); - * ``` - */ -export declare function abignumber(n: T): T; -/** - * Validates that a value is a safe integer. - * @param value - Integer to validate. - * @param title - Optional field name. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate a window size before scalar arithmetic uses it. - * - * ```ts - * asafenumber(1); - * ``` - */ -export declare function asafenumber(value: number, title?: string): void; -/** - * Encodes a bigint into even-length big-endian hex. - * The historical "unpadded" name only means "no fixed-width field padding"; odd-length hex still - * gets one leading zero nibble so the result always represents whole bytes. - * @param num - Number to encode. - * @returns Big-endian hex string. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Encode a scalar into hex without a `0x` prefix. - * - * ```ts - * numberToHexUnpadded(255n); - * ``` - */ -export declare function numberToHexUnpadded(num: number | bigint): string; -/** - * Parses a big-endian hex string into bigint. - * Accepts odd-length hex through the native `BigInt('0x' + hex)` parser and currently surfaces the - * same native `SyntaxError` for malformed hex instead of wrapping it in a library-specific error. - * @param hex - Hex string without `0x`. - * @returns Parsed bigint value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Parse a scalar from fixture hex. - * - * ```ts - * hexToNumber('ff'); - * ``` - */ -export declare function hexToNumber(hex: string): bigint; -/** - * Parses big-endian bytes into bigint. - * @param bytes - Bytes in big-endian order. - * @returns Parsed bigint value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Read a scalar encoded in network byte order. - * - * ```ts - * bytesToNumberBE(Uint8Array.of(1, 0)); - * ``` - */ -export declare function bytesToNumberBE(bytes: TArg): bigint; -/** - * Parses little-endian bytes into bigint. - * @param bytes - Bytes in little-endian order. - * @returns Parsed bigint value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Read a scalar encoded in little-endian form. - * - * ```ts - * bytesToNumberLE(Uint8Array.of(1, 0)); - * ``` - */ -export declare function bytesToNumberLE(bytes: TArg): bigint; -/** - * Encodes a bigint into fixed-length big-endian bytes. - * @param n - Number to encode. - * @param len - Output length in bytes. Must be greater than zero. - * @returns Big-endian byte array. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Serialize a scalar into a 32-byte field element. - * - * ```ts - * numberToBytesBE(255n, 2); - * ``` - */ -export declare function numberToBytesBE(n: number | bigint, len: number): TRet; -/** - * Encodes a bigint into fixed-length little-endian bytes. - * @param n - Number to encode. - * @param len - Output length in bytes. - * @returns Little-endian byte array. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Serialize a scalar for little-endian protocols. - * - * ```ts - * numberToBytesLE(255n, 2); - * ``` - */ -export declare function numberToBytesLE(n: number | bigint, len: number): TRet; -/** - * Encodes a bigint into variable-length big-endian bytes. - * @param n - Number to encode. - * @returns Variable-length big-endian bytes. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Serialize a bigint without fixed-width padding. - * - * ```ts - * numberToVarBytesBE(255n); - * ``` - */ -export declare function numberToVarBytesBE(n: number | bigint): TRet; -/** - * Compares two byte arrays in constant-ish time. - * @param a - Left byte array. - * @param b - Right byte array. - * @returns `true` when bytes match. - * @example - * Compare two encoded points without early exit. - * - * ```ts - * equalBytes(Uint8Array.of(1), Uint8Array.of(1)); - * ``` - */ -export declare function equalBytes(a: TArg, b: TArg): boolean; -/** - * Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer, - * and Buffer#slice creates mutable copy. Never use Buffers! - * @param bytes - Bytes to copy. - * @returns Detached copy. - * @example - * Make an isolated copy before mutating serialized bytes. - * - * ```ts - * copyBytes(Uint8Array.of(1, 2, 3)); - * ``` - */ -export declare function copyBytes(bytes: TArg): TRet; -/** - * Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols - * Should be safe to use for things expected to be ASCII. - * Returns exact same result as `TextEncoder` for ASCII or throws. - * @param ascii - ASCII input text. - * @returns Encoded bytes. - * @throws On wrong argument types. {@link TypeError} - * @example - * Encode an ASCII domain-separation tag. - * - * ```ts - * asciiToBytes('ABC'); - * ``` - */ -export declare function asciiToBytes(ascii: string): TRet; -/** - * Checks whether a bigint lies inside a half-open range. - * @param n - Candidate value. - * @param min - Inclusive lower bound. - * @param max - Exclusive upper bound. - * @returns `true` when the value is inside the range. - * @example - * Check whether a candidate scalar fits the field order. - * - * ```ts - * inRange(2n, 1n, 3n); - * ``` - */ -export declare function inRange(n: bigint, min: bigint, max: bigint): boolean; -/** - * Asserts `min <= n < max`. NOTE: upper bound is exclusive. - * @param title - Value label for error messages. - * @param n - Candidate value. - * @param min - Inclusive lower bound. - * @param max - Exclusive upper bound. - * Wrong-type inputs are not separated from out-of-range values here: they still flow through the - * shared `RangeError` path because this is only a throwing wrapper around `inRange(...)`. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Assert that a bigint stays within one half-open range. - * - * ```ts - * aInRange('x', 2n, 1n, 256n); - * ``` - */ -export declare function aInRange(title: string, n: bigint, min: bigint, max: bigint): void; -/** - * Calculates amount of bits in a bigint. - * Same as `n.toString(2).length` - * TODO: merge with nLength in modular - * @param n - Value to inspect. - * @returns Bit length. - * @throws If the value is negative. {@link Error} - * @example - * Measure the bit length of a scalar before serialization. - * - * ```ts - * bitLen(8n); - * ``` - */ -export declare function bitLen(n: bigint): number; -/** - * Gets single bit at position. - * NOTE: first bit position is 0 (same as arrays) - * Same as `!!+Array.from(n.toString(2)).reverse()[pos]` - * @param n - Source value. - * @param pos - Bit position. Negative positions are passed through to raw - * bigint shift semantics; because the mask is built as `1n << pos`, - * they currently collapse to `0n` and make the helper a no-op. - * @returns Bit as bigint. - * @example - * Gets single bit at position. - * - * ```ts - * bitGet(5n, 0); - * ``` - */ -export declare function bitGet(n: bigint, pos: number): bigint; -/** - * Sets single bit at position. - * @param n - Source value. - * @param pos - Bit position. Negative positions are passed through to raw bigint shift semantics, - * so they currently behave like left shifts. - * @param value - Whether the bit should be set. - * @returns Updated bigint. - * @example - * Sets single bit at position. - * - * ```ts - * bitSet(0n, 1, true); - * ``` - */ -export declare function bitSet(n: bigint, pos: number, value: boolean): bigint; -/** - * Calculate mask for N bits. Not using ** operator with bigints because of old engines. - * Same as BigInt(`0b${Array(i).fill('1').join('')}`) - * @param n - Number of bits. Negative widths are currently passed through to raw bigint shift - * semantics and therefore produce `-1n`. - * @returns Bitmask value. - * @example - * Calculate mask for N bits. - * - * ```ts - * bitMask(4); - * ``` - */ -export declare const bitMask: (n: number) => bigint; -type Pred = (v: TArg) => T | undefined; -/** - * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. - * @param hashLen - Hash output size in bytes. Callers are expected to pass a positive length; `0` - * is not rejected here and would make the internal generate loop non-progressing. - * @param qByteLen - Requested output size in bytes. Callers are expected to pass a positive length. - * @param hmacFn - HMAC implementation. - * @returns Function that will call DRBG until the predicate returns anything - * other than `undefined`. - * @throws On wrong argument types. {@link TypeError} - * @example - * Build a deterministic nonce generator for RFC6979-style signing. - * - * ```ts - * import { createHmacDrbg } from '@noble/curves/utils.js'; - * import { hmac } from '@noble/hashes/hmac.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const drbg = createHmacDrbg(32, 32, (key, msg) => hmac(sha256, key, msg)); - * const seed = new Uint8Array(32); - * drbg(seed, (bytes) => bytes); - * ``` - */ -export declare function createHmacDrbg(hashLen: number, qByteLen: number, hmacFn: TArg): TRet<(seed: Uint8Array, predicate: Pred) => T>; -/** - * Validates declared required and optional field types on a plain object. - * Extra keys are intentionally ignored because many callers validate only the subset they use from - * richer option bags or runtime objects. - * @param object - Object to validate. - * @param fields - Required field types. - * @param optFields - Optional field types. - * @throws On wrong argument types. {@link TypeError} - * @example - * Check user options before building a curve helper. - * - * ```ts - * validateObject({ flag: true }, { flag: 'boolean' }); - * ``` - */ -export declare function validateObject(object: Record, fields?: Record, optFields?: Record): void; -/** - * Throws not implemented error. - * @returns Never returns. - * @throws If the unfinished code path is reached. {@link Error} - * @example - * Surface the placeholder error from an unfinished code path. - * - * ```ts - * try { - * notImplemented(); - * } catch {} - * ``` - */ -export declare const notImplemented: () => never; -/** Generic keygen/getPublicKey interface shared by curve helpers. */ -export interface CryptoKeys { - /** Public byte lengths for keys and optional seeds. */ - lengths: { - seed?: number; - public?: number; - secret?: number; - }; - /** - * Generate one secret/public keypair. - * @param seed - Optional seed bytes for deterministic key generation. - * @returns Fresh secret/public keypair. - */ - keygen: (seed?: Uint8Array) => { - secretKey: Uint8Array; - publicKey: Uint8Array; - }; - /** - * Derive one public key from a secret key. - * @param secretKey - Secret key bytes. - * @returns Public key bytes. - */ - getPublicKey: (secretKey: Uint8Array) => Uint8Array; -} -/** Generic interface for signatures. Has keygen, sign and verify. */ -export interface Signer extends CryptoKeys { - /** Public byte lengths for keys, signatures, and optional signing randomness. */ - lengths: { - seed?: number; - public?: number; - secret?: number; - signRand?: number; - signature?: number; - }; - /** - * Sign one message. - * @param msg - Message bytes to sign. - * @param secretKey - Secret key bytes. - * @returns Signature bytes. - */ - sign: (msg: Uint8Array, secretKey: Uint8Array) => Uint8Array; - /** - * Verify one signature. - * @param sig - Signature bytes. - * @param msg - Signed message bytes. - * @param publicKey - Public key bytes. - * @returns `true` when the signature is valid. - */ - verify: (sig: Uint8Array, msg: Uint8Array, publicKey: Uint8Array) => boolean; -} -export {}; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/utils.d.ts.map b/node_modules/@noble/curves/utils.d.ts.map deleted file mode 100644 index 9881ab6..0000000 --- a/node_modules/@noble/curves/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,sEAAsE;AACtE,OAAO,EAEL,OAAO,IAAI,QAAQ,EACnB,UAAU,IAAI,WAAW,EAGzB,OAAO,IAAI,QAAQ,EAEpB,MAAM,wBAAwB,CAAC;AAChC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,GAC7C,aAAa,GACb,CAAC,SAAS,cAAc,GACtB,cAAc,GACd,CAAC,SAAS,YAAY,GACpB,YAAY,GACZ,CAAC,SAAS,YAAY,GACpB,YAAY,GACZ,CAAC,SAAS,UAAU,GAClB,UAAU,GACV,CAAC,SAAS,UAAU,GAClB,UAAU,GACV,CAAC,SAAS,SAAS,GACjB,SAAS,GACT,CAAC,SAAS,WAAW,GACnB,WAAW,GACX,CAAC,SAAS,WAAW,GACnB,WAAW,GACX,CAAC,SAAS,iBAAiB,GACzB,iBAAiB,GACjB,CAAC,SAAS,UAAU,GAClB,UAAU,GACV,KAAK,CAAC;AAC9B,oEAAoE;AACpE,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,GAC7C,UAAU,CAAC,OAAO,aAAa,CAAC,EAAE,CAAC,GACnC,CAAC,SAAS,cAAc,GACtB,UAAU,CAAC,OAAO,cAAc,CAAC,EAAE,CAAC,GACpC,CAAC,SAAS,YAAY,GACpB,UAAU,CAAC,OAAO,YAAY,CAAC,EAAE,CAAC,GAClC,CAAC,SAAS,YAAY,GACpB,UAAU,CAAC,OAAO,YAAY,CAAC,EAAE,CAAC,GAClC,CAAC,SAAS,UAAU,GAClB,UAAU,CAAC,OAAO,UAAU,C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git a/node_modules/@noble/curves/utils.js b/node_modules/@noble/curves/utils.js deleted file mode 100644 index 87cf2f7..0000000 --- a/node_modules/@noble/curves/utils.js +++ /dev/null @@ -1,598 +0,0 @@ -/** - * Hex, bytes and number utilities. - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import { abytes as abytes_, anumber as anumber_, bytesToHex as bytesToHex_, concatBytes as concatBytes_, hexToBytes as hexToBytes_, isBytes as isBytes_, randomBytes as randomBytes_, } from '@noble/hashes/utils.js'; -/** - * Validates that a value is a byte array. - * @param value - Value to validate. - * @param length - Optional exact byte length. - * @param title - Optional field name. - * @returns Original byte array. - * @example - * Reject non-byte input before passing data into curve code. - * - * ```ts - * abytes(new Uint8Array(1)); - * ``` - */ -export const abytes = (value, length, title) => abytes_(value, length, title); -/** - * Validates that a value is a non-negative safe integer. - * @param n - Value to validate. - * @param title - Optional field name. - * @example - * Validate a numeric length before allocating buffers. - * - * ```ts - * anumber(1); - * ``` - */ -export const anumber = anumber_; -/** - * Encodes bytes as lowercase hex. - * @param bytes - Bytes to encode. - * @returns Lowercase hex string. - * @example - * Serialize bytes as hex for logging or fixtures. - * - * ```ts - * bytesToHex(Uint8Array.of(1, 2, 3)); - * ``` - */ -export const bytesToHex = bytesToHex_; -/** - * Concatenates byte arrays. - * @param arrays - Byte arrays to join. - * @returns Concatenated bytes. - * @example - * Join domain-separated chunks into one buffer. - * - * ```ts - * concatBytes(Uint8Array.of(1), Uint8Array.of(2)); - * ``` - */ -export const concatBytes = (...arrays) => concatBytes_(...arrays); -/** - * Decodes lowercase or uppercase hex into bytes. - * @param hex - Hex string to decode. - * @returns Decoded bytes. - * @example - * Parse fixture hex into bytes before hashing. - * - * ```ts - * hexToBytes('0102'); - * ``` - */ -export const hexToBytes = (hex) => hexToBytes_(hex); -/** - * Checks whether a value is a Uint8Array. - * @param a - Value to inspect. - * @returns `true` when `a` is a Uint8Array. - * @example - * Branch on byte input before decoding it. - * - * ```ts - * isBytes(new Uint8Array(1)); - * ``` - */ -export const isBytes = isBytes_; -/** - * Reads random bytes from the platform CSPRNG. - * @param bytesLength - Number of random bytes to read. - * @returns Fresh random bytes. - * @example - * Generate a random seed for a keypair. - * - * ```ts - * randomBytes(2); - * ``` - */ -export const randomBytes = (bytesLength) => randomBytes_(bytesLength); -const _0n = /* @__PURE__ */ BigInt(0); -const _1n = /* @__PURE__ */ BigInt(1); -/** - * Validates that a flag is boolean. - * @param value - Value to validate. - * @param title - Optional field name. - * @returns Original value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Reject non-boolean option flags early. - * - * ```ts - * abool(true); - * ``` - */ -export function abool(value, title = '') { - if (typeof value !== 'boolean') { - const prefix = title && `"${title}" `; - throw new TypeError(prefix + 'expected boolean, got type=' + typeof value); - } - return value; -} -/** - * Validates that a value is a non-negative bigint or safe integer. - * @param n - Value to validate. - * @returns The same validated value. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate one integer-like value before serializing it. - * - * ```ts - * abignumber(1n); - * ``` - */ -export function abignumber(n) { - if (typeof n === 'bigint') { - if (!isPosBig(n)) - throw new RangeError('positive bigint expected, got ' + n); - } - else - anumber(n); - return n; -} -/** - * Validates that a value is a safe integer. - * @param value - Integer to validate. - * @param title - Optional field name. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate a window size before scalar arithmetic uses it. - * - * ```ts - * asafenumber(1); - * ``` - */ -export function asafenumber(value, title = '') { - if (typeof value !== 'number') { - const prefix = title && `"${title}" `; - throw new TypeError(prefix + 'expected number, got type=' + typeof value); - } - if (!Number.isSafeInteger(value)) { - const prefix = title && `"${title}" `; - throw new RangeError(prefix + 'expected safe integer, got ' + value); - } -} -/** - * Encodes a bigint into even-length big-endian hex. - * The historical "unpadded" name only means "no fixed-width field padding"; odd-length hex still - * gets one leading zero nibble so the result always represents whole bytes. - * @param num - Number to encode. - * @returns Big-endian hex string. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Encode a scalar into hex without a `0x` prefix. - * - * ```ts - * numberToHexUnpadded(255n); - * ``` - */ -export function numberToHexUnpadded(num) { - const hex = abignumber(num).toString(16); - return hex.length & 1 ? '0' + hex : hex; -} -/** - * Parses a big-endian hex string into bigint. - * Accepts odd-length hex through the native `BigInt('0x' + hex)` parser and currently surfaces the - * same native `SyntaxError` for malformed hex instead of wrapping it in a library-specific error. - * @param hex - Hex string without `0x`. - * @returns Parsed bigint value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Parse a scalar from fixture hex. - * - * ```ts - * hexToNumber('ff'); - * ``` - */ -export function hexToNumber(hex) { - if (typeof hex !== 'string') - throw new TypeError('hex string expected, got ' + typeof hex); - return hex === '' ? _0n : BigInt('0x' + hex); // Big Endian -} -// BE: Big Endian, LE: Little Endian -/** - * Parses big-endian bytes into bigint. - * @param bytes - Bytes in big-endian order. - * @returns Parsed bigint value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Read a scalar encoded in network byte order. - * - * ```ts - * bytesToNumberBE(Uint8Array.of(1, 0)); - * ``` - */ -export function bytesToNumberBE(bytes) { - return hexToNumber(bytesToHex_(bytes)); -} -/** - * Parses little-endian bytes into bigint. - * @param bytes - Bytes in little-endian order. - * @returns Parsed bigint value. - * @throws On wrong argument types. {@link TypeError} - * @example - * Read a scalar encoded in little-endian form. - * - * ```ts - * bytesToNumberLE(Uint8Array.of(1, 0)); - * ``` - */ -export function bytesToNumberLE(bytes) { - return hexToNumber(bytesToHex_(copyBytes(abytes_(bytes)).reverse())); -} -/** - * Encodes a bigint into fixed-length big-endian bytes. - * @param n - Number to encode. - * @param len - Output length in bytes. Must be greater than zero. - * @returns Big-endian byte array. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Serialize a scalar into a 32-byte field element. - * - * ```ts - * numberToBytesBE(255n, 2); - * ``` - */ -export function numberToBytesBE(n, len) { - anumber_(len); - if (len === 0) - throw new RangeError('zero length'); - n = abignumber(n); - const hex = n.toString(16); - // Detect overflow before hex parsing so oversized values don't leak the shared odd-hex error. - if (hex.length > len * 2) - throw new RangeError('number too large'); - return hexToBytes_(hex.padStart(len * 2, '0')); -} -/** - * Encodes a bigint into fixed-length little-endian bytes. - * @param n - Number to encode. - * @param len - Output length in bytes. - * @returns Little-endian byte array. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Serialize a scalar for little-endian protocols. - * - * ```ts - * numberToBytesLE(255n, 2); - * ``` - */ -export function numberToBytesLE(n, len) { - return numberToBytesBE(n, len).reverse(); -} -// Unpadded, rarely used -/** - * Encodes a bigint into variable-length big-endian bytes. - * @param n - Number to encode. - * @returns Variable-length big-endian bytes. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Serialize a bigint without fixed-width padding. - * - * ```ts - * numberToVarBytesBE(255n); - * ``` - */ -export function numberToVarBytesBE(n) { - return hexToBytes_(numberToHexUnpadded(abignumber(n))); -} -// Compares 2 u8a-s in kinda constant time -/** - * Compares two byte arrays in constant-ish time. - * @param a - Left byte array. - * @param b - Right byte array. - * @returns `true` when bytes match. - * @example - * Compare two encoded points without early exit. - * - * ```ts - * equalBytes(Uint8Array.of(1), Uint8Array.of(1)); - * ``` - */ -export function equalBytes(a, b) { - a = abytes(a); - b = abytes(b); - if (a.length !== b.length) - return false; - let diff = 0; - for (let i = 0; i < a.length; i++) - diff |= a[i] ^ b[i]; - return diff === 0; -} -/** - * Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer, - * and Buffer#slice creates mutable copy. Never use Buffers! - * @param bytes - Bytes to copy. - * @returns Detached copy. - * @example - * Make an isolated copy before mutating serialized bytes. - * - * ```ts - * copyBytes(Uint8Array.of(1, 2, 3)); - * ``` - */ -export function copyBytes(bytes) { - // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict - // because callers use it at byte-validation boundaries before mutating the detached copy. - return Uint8Array.from(abytes(bytes)); -} -/** - * Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols - * Should be safe to use for things expected to be ASCII. - * Returns exact same result as `TextEncoder` for ASCII or throws. - * @param ascii - ASCII input text. - * @returns Encoded bytes. - * @throws On wrong argument types. {@link TypeError} - * @example - * Encode an ASCII domain-separation tag. - * - * ```ts - * asciiToBytes('ABC'); - * ``` - */ -export function asciiToBytes(ascii) { - if (typeof ascii !== 'string') - throw new TypeError('ascii string expected, got ' + typeof ascii); - return Uint8Array.from(ascii, (c, i) => { - const charCode = c.charCodeAt(0); - if (c.length !== 1 || charCode > 127) { - throw new RangeError(`string contains non-ASCII character "${ascii[i]}" with code ${charCode} at position ${i}`); - } - return charCode; - }); -} -// Historical name: this accepts non-negative bigints, including zero. -const isPosBig = (n) => typeof n === 'bigint' && _0n <= n; -/** - * Checks whether a bigint lies inside a half-open range. - * @param n - Candidate value. - * @param min - Inclusive lower bound. - * @param max - Exclusive upper bound. - * @returns `true` when the value is inside the range. - * @example - * Check whether a candidate scalar fits the field order. - * - * ```ts - * inRange(2n, 1n, 3n); - * ``` - */ -export function inRange(n, min, max) { - return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max; -} -/** - * Asserts `min <= n < max`. NOTE: upper bound is exclusive. - * @param title - Value label for error messages. - * @param n - Candidate value. - * @param min - Inclusive lower bound. - * @param max - Exclusive upper bound. - * Wrong-type inputs are not separated from out-of-range values here: they still flow through the - * shared `RangeError` path because this is only a throwing wrapper around `inRange(...)`. - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Assert that a bigint stays within one half-open range. - * - * ```ts - * aInRange('x', 2n, 1n, 256n); - * ``` - */ -export function aInRange(title, n, min, max) { - // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)? - // consider P=256n, min=0n, max=P - // - a for min=0 would require -1: `inRange('x', x, -1n, P)` - // - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)` - // - our way is the cleanest: `inRange('x', x, 0n, P) - if (!inRange(n, min, max)) - throw new RangeError('expected valid ' + title + ': ' + min + ' <= n < ' + max + ', got ' + n); -} -// Bit operations -/** - * Calculates amount of bits in a bigint. - * Same as `n.toString(2).length` - * TODO: merge with nLength in modular - * @param n - Value to inspect. - * @returns Bit length. - * @throws If the value is negative. {@link Error} - * @example - * Measure the bit length of a scalar before serialization. - * - * ```ts - * bitLen(8n); - * ``` - */ -export function bitLen(n) { - // Size callers in this repo only use non-negative orders / scalars, so negative inputs are a - // contract bug and must not silently collapse to zero bits. - if (n < _0n) - throw new Error('expected non-negative bigint, got ' + n); - let len; - for (len = 0; n > _0n; n >>= _1n, len += 1) - ; - return len; -} -/** - * Gets single bit at position. - * NOTE: first bit position is 0 (same as arrays) - * Same as `!!+Array.from(n.toString(2)).reverse()[pos]` - * @param n - Source value. - * @param pos - Bit position. Negative positions are passed through to raw - * bigint shift semantics; because the mask is built as `1n << pos`, - * they currently collapse to `0n` and make the helper a no-op. - * @returns Bit as bigint. - * @example - * Gets single bit at position. - * - * ```ts - * bitGet(5n, 0); - * ``` - */ -export function bitGet(n, pos) { - return (n >> BigInt(pos)) & _1n; -} -/** - * Sets single bit at position. - * @param n - Source value. - * @param pos - Bit position. Negative positions are passed through to raw bigint shift semantics, - * so they currently behave like left shifts. - * @param value - Whether the bit should be set. - * @returns Updated bigint. - * @example - * Sets single bit at position. - * - * ```ts - * bitSet(0n, 1, true); - * ``` - */ -export function bitSet(n, pos, value) { - const mask = _1n << BigInt(pos); - // Clearing needs AND-not here; OR with zero leaves an already-set bit untouched. - return value ? n | mask : n & ~mask; -} -/** - * Calculate mask for N bits. Not using ** operator with bigints because of old engines. - * Same as BigInt(`0b${Array(i).fill('1').join('')}`) - * @param n - Number of bits. Negative widths are currently passed through to raw bigint shift - * semantics and therefore produce `-1n`. - * @returns Bitmask value. - * @example - * Calculate mask for N bits. - * - * ```ts - * bitMask(4); - * ``` - */ -export const bitMask = (n) => (_1n << BigInt(n)) - _1n; -/** - * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. - * @param hashLen - Hash output size in bytes. Callers are expected to pass a positive length; `0` - * is not rejected here and would make the internal generate loop non-progressing. - * @param qByteLen - Requested output size in bytes. Callers are expected to pass a positive length. - * @param hmacFn - HMAC implementation. - * @returns Function that will call DRBG until the predicate returns anything - * other than `undefined`. - * @throws On wrong argument types. {@link TypeError} - * @example - * Build a deterministic nonce generator for RFC6979-style signing. - * - * ```ts - * import { createHmacDrbg } from '@noble/curves/utils.js'; - * import { hmac } from '@noble/hashes/hmac.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const drbg = createHmacDrbg(32, 32, (key, msg) => hmac(sha256, key, msg)); - * const seed = new Uint8Array(32); - * drbg(seed, (bytes) => bytes); - * ``` - */ -export function createHmacDrbg(hashLen, qByteLen, hmacFn) { - anumber_(hashLen, 'hashLen'); - anumber_(qByteLen, 'qByteLen'); - if (typeof hmacFn !== 'function') - throw new TypeError('hmacFn must be a function'); - // creates Uint8Array - const u8n = (len) => new Uint8Array(len); - const NULL = Uint8Array.of(); - const byte0 = Uint8Array.of(0x00); - const byte1 = Uint8Array.of(0x01); - const _maxDrbgIters = 1000; - // Step B, Step C: set hashLen to 8*ceil(hlen/8). - // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 signatures. - let v = u8n(hashLen); - // Steps B and C of RFC6979 3.2. - let k = u8n(hashLen); - let i = 0; // Iterations counter, will throw when over 1000 - const reset = () => { - v.fill(1); - k.fill(0); - i = 0; - }; - // hmac(k)(v, ...values) - const h = (...msgs) => hmacFn(k, concatBytes(v, ...msgs)); - const reseed = (seed = NULL) => { - // HMAC-DRBG reseed() function. Steps D-G - k = h(byte0, seed); // k = hmac(k || v || 0x00 || seed) - v = h(); // v = hmac(k || v) - if (seed.length === 0) - return; - k = h(byte1, seed); // k = hmac(k || v || 0x01 || seed) - v = h(); // v = hmac(k || v) - }; - const gen = () => { - // HMAC-DRBG generate() function - if (i++ >= _maxDrbgIters) - throw new Error('drbg: tried max amount of iterations'); - let len = 0; - const out = []; - while (len < qByteLen) { - v = h(); - const sl = v.slice(); - out.push(sl); - len += v.length; - } - return concatBytes(...out); - }; - const genUntil = (seed, pred) => { - reset(); - reseed(seed); // Steps D-G - let res = undefined; // Step H: grind until the predicate accepts a candidate. - // Falsy values like 0 are valid outputs. - while ((res = pred(gen())) === undefined) - reseed(); - reset(); - return res; - }; - return genUntil; -} -/** - * Validates declared required and optional field types on a plain object. - * Extra keys are intentionally ignored because many callers validate only the subset they use from - * richer option bags or runtime objects. - * @param object - Object to validate. - * @param fields - Required field types. - * @param optFields - Optional field types. - * @throws On wrong argument types. {@link TypeError} - * @example - * Check user options before building a curve helper. - * - * ```ts - * validateObject({ flag: true }, { flag: 'boolean' }); - * ``` - */ -export function validateObject(object, fields = {}, optFields = {}) { - if (Object.prototype.toString.call(object) !== '[object Object]') - throw new TypeError('expected valid options object'); - function checkField(fieldName, expectedType, isOpt) { - // Config/data fields must be explicit own properties, but runtime objects such as Field - // instances intentionally satisfy required method slots via their shared prototype. - if (!isOpt && expectedType !== 'function' && !Object.hasOwn(object, fieldName)) - throw new TypeError(`param "${fieldName}" is invalid: expected own property`); - const val = object[fieldName]; - if (isOpt && val === undefined) - return; - const current = typeof val; - if (current !== expectedType || val === null) - throw new TypeError(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`); - } - const iter = (f, isOpt) => Object.entries(f).forEach(([k, v]) => checkField(k, v, isOpt)); - iter(fields, false); - iter(optFields, true); -} -/** - * Throws not implemented error. - * @returns Never returns. - * @throws If the unfinished code path is reached. {@link Error} - * @example - * Surface the placeholder error from an unfinished code path. - * - * ```ts - * try { - * notImplemented(); - * } catch {} - * ``` - */ -export const notImplemented = () => { - throw new Error('not implemented'); -}; -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/utils.js.map b/node_modules/@noble/curves/utils.js.map deleted file mode 100644 index fbb5eae..0000000 --- a/node_modules/@noble/curves/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["src/utils.ts"],"names":[],"mappings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,CAAC,KAAK,IAAI,YAAY,KAAK,UAAU,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;YAC5E,MAAM,IAAI,SAAS,CAAC,UAAU,SAAS,qCAAqC,CAAC,CAAC;QAChF,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QAC9B,IAAI,KAAK,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO;QACvC,MAAM,OAAO,GAAG,OAAO,GAAG,CAAC;QAC3B,IAAI,OAAO,KAAK,YAAY,IAAI,GAAG,KAAK,IAAI;YAC1C,MAAM,IAAI,SAAS,CACjB,UAAU,SAAS,0BAA0B,YAAY,SAAS,OAAO,EAAE,CAC5E,CAAC;IACN,CAAC;IACD,MAAM,IAAI,GAAG,CAAC,CAAgB,EAAE,KAAc,EAAE,EAAE,CAChD,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IACjE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACpB,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAU,EAAE;IACxC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACrC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/webcrypto.d.ts b/node_modules/@noble/curves/webcrypto.d.ts deleted file mode 100644 index 42d926c..0000000 --- a/node_modules/@noble/curves/webcrypto.d.ts +++ /dev/null @@ -1,241 +0,0 @@ -/** - * Friendly wrapper over elliptic curves from built-in WebCrypto. Experimental: API may change. - -# WebCrypto issues - -## No way to get public keys - -- Export of raw secret key is prohibited by spec: - - https://w3c.github.io/webcrypto/#ecdsa-operations-export-key - -> "If format is "raw":" -> "If the [[type]] internal slot of key is not "public", - then throw an InvalidAccessError." -- Import of raw secret keys is prohibited by spec: - - https://w3c.github.io/webcrypto/#ecdsa-operations-import-key - -> "If format is "raw":" -> "If usages contains a value which is not "verify" - then throw a SyntaxError." -- SPKI (Simple public-key infrastructure) is public-key-only -- PKCS8 is secret-key-only -- No way to get public key from secret key, but we convert to JWK and then - create it manually, since a JWK secret key includes both private and public - parts. -- Noble supports generating keys for both sign, verify & getSharedSecret, - but JWK key includes usage, which forces us to patch it (non-JWK is ok) -- We have import/export for 'raw', but it doesn't work in Firefox / Safari - -## Point encoding - -- Raw export of public points returns uncompressed points, - but this is implementation specific and not much we can do there. -- `getSharedSecret` differs for p256, p384, p521: - Noble returns 33-byte output (y-parity + x coordinate), - while in WebCrypto returns 32-byte output (x coordinate). - This is intentional: noble keeps the full encoded shared point, and x-only - callers can slice it down themselves. -- `getSharedSecret` identical for X25519, X448 - -## Availability - -Node.js additionally supports ed448. -There seems no reasonable way to check for availability, other than actually calling methods. - - * @module - */ -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -import type { TArg, TRet } from './utils.ts'; -/** Raw type */ -declare const TYPE_RAW = "raw"; -declare const TYPE_JWK = "jwk"; -declare const TYPE_SPKI = "spki"; -declare const TYPE_PKCS = "pkcs8"; -/** Key serialization formats supported by the WebCrypto wrappers. */ -export type WebCryptoFormat = typeof TYPE_RAW | typeof TYPE_JWK | typeof TYPE_SPKI | typeof TYPE_PKCS; -/** WebCrypto keys can be in raw, jwk, pkcs8/spki formats. Raw is internal and fragile. */ -export type WebCryptoOpts = { - /** Preferred secret-key serialization format. */ - formatSec?: WebCryptoFormat; - /** Preferred public-key serialization format. */ - formatPub?: WebCryptoFormat; -}; -declare function hexToBytesLocal(hex: string): TRet; -export declare const __TEST: { - hexToBytesLocal: typeof hexToBytesLocal; -}; -type JsonWebKey = { - crv?: string; - d?: string; - kty?: string; - x?: string; - y?: string; - [key: string]: unknown; -}; -type Key = JsonWebKey | Uint8Array; -type WebCryptoBaseCurve = { - name: string; - isSupported(): Promise; - keygen(): TRet>; - getPublicKey(secretKey: TArg, opts?: TArg): TRet>; - utils: { - randomSecretKey: (format?: WebCryptoFormat) => TRet>; - convertSecretKey: (key: TArg, inFormat?: WebCryptoFormat, outFormat?: WebCryptoFormat) => TRet>; - convertPublicKey: (key: TArg, inFormat?: WebCryptoFormat, outFormat?: WebCryptoFormat) => TRet>; - }; -}; -/** WebCrypto signing interface shared by ECDSA and EdDSA helpers. */ -export type WebCryptoSigner = { - /** - * Sign one message with a WebCrypto-backed private key. - * @param message - Message bytes to sign. - * @param secretKey - Secret key in one supported format. - * @param opts - Optional key-format overrides. See {@link WebCryptoOpts}. - * @returns Signature bytes. - */ - sign(message: TArg, secretKey: TArg, opts?: TArg): TRet>; - /** - * Verify one signature with a WebCrypto-backed public key. - * @param signature - Signature bytes. - * @param message - Signed message bytes. - * @param publicKey - Public key in one supported format. - * @param opts - Optional key-format overrides. See {@link WebCryptoOpts}. - * @returns `true` when the signature is valid. - */ - verify(signature: TArg, message: TArg, publicKey: TArg, opts?: TArg): Promise; -}; -/** WebCrypto ECDH interface for shared-secret derivation. */ -export type WebCryptoECDH = { - /** - * Derive one shared secret from a local secret key and peer public key. - * Short-Weierstrass wrappers return the raw x-coordinate here, not noble's parity-prefixed - * shared-point encoding. Runtime also accepts alternate key formats through `opts`, even though - * this public type is still narrowed to byte arrays. - * @param secA - Local secret key in one supported format. - * @param pubB - Peer public key in one supported format. - * @param opts - Optional key-format overrides. See {@link WebCryptoOpts}. - * @returns Shared secret bytes. - */ - getSharedSecret(secA: TArg, pubB: TArg, opts?: TArg): TRet>; -}; -/** WebCrypto ECDSA interface with keygen, signing, and ECDH helpers. */ -export type WebCryptoECDSA = WebCryptoBaseCurve & WebCryptoSigner & WebCryptoECDH; -/** WebCrypto EdDSA interface with keygen and signing helpers. */ -export type WebCryptoEdDSA = WebCryptoBaseCurve & WebCryptoSigner; -/** WebCrypto Montgomery interface with keygen and ECDH helpers. */ -export type WebCryptoMontgomery = WebCryptoBaseCurve & WebCryptoECDH; -/** - * Friendly wrapper over built-in WebCrypto NIST P-256 (secp256r1). - * Inherits the generic WebCrypto ECDSA caveats: `isSupported()` only probes the sign-side API, and - * the conversion/signing helpers keep the shared `createKeyUtils(...)` / `createSigner(...)` quirks, - * including raw WebCrypto ECDSA signatures without low-S normalization. - * @example - * Check support, then sign and verify once with WebCrypto P-256. - * - * ```ts - * if (await p256.isSupported()) { - * const { secretKey, publicKey } = await p256.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await p256.sign(msg, secretKey); - * const isValid = await p256.verify(sig, msg, publicKey); - * } - * ``` - */ -export declare const p256: TRet; -/** - * Friendly wrapper over built-in WebCrypto NIST P-384 (secp384r1). - * Inherits the generic WebCrypto ECDSA caveats around support probing and key/signing conversion. - * @example - * Check support, then sign and verify once with WebCrypto P-384. - * - * ```ts - * if (await p384.isSupported()) { - * const { secretKey, publicKey } = await p384.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await p384.sign(msg, secretKey); - * const isValid = await p384.verify(sig, msg, publicKey); - * } - * ``` - */ -export declare const p384: TRet; -/** - * Friendly wrapper over built-in WebCrypto NIST P-521 (secp521r1). - * Inherits the generic WebCrypto ECDSA caveats around support probing and key/signing conversion. - * @example - * Check support, then sign and verify once with WebCrypto P-521. - * - * ```ts - * if (await p521.isSupported()) { - * const { secretKey, publicKey } = await p521.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await p521.sign(msg, secretKey); - * const isValid = await p521.verify(sig, msg, publicKey); - * } - * ``` - */ -export declare const p521: TRet; -/** - * Friendly wrapper over built-in WebCrypto ed25519. - * Inherits the generic WebCrypto EdDSA caveats around JWK conversion metadata and extractability. - * @example - * Check support, then sign and verify once with WebCrypto Ed25519. - * - * ```ts - * if (await ed25519.isSupported()) { - * const { secretKey, publicKey } = await ed25519.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await ed25519.sign(msg, secretKey); - * const isValid = await ed25519.verify(sig, msg, publicKey); - * } - * ``` - */ -export declare const ed25519: TRet; -/** - * Friendly wrapper over built-in WebCrypto ed448. - * Inherits the generic WebCrypto EdDSA caveats around JWK conversion metadata and extractability. - * @example - * Check support, then sign and verify once with WebCrypto Ed448. - * - * ```ts - * if (await ed448.isSupported()) { - * const { secretKey, publicKey } = await ed448.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await ed448.sign(msg, secretKey); - * const isValid = await ed448.verify(sig, msg, publicKey); - * } - * ``` - */ -export declare const ed448: TRet; -/** - * Friendly wrapper over built-in WebCrypto x25519 (ECDH over Curve25519). - * Inherits the generic WebCrypto Montgomery caveat that runtime accepts more key formats than the - * narrow public `Uint8Array` argument types suggest. - * @example - * Check support, then derive one shared secret with WebCrypto X25519. - * - * ```ts - * if (await x25519.isSupported()) { - * const alice = await x25519.keygen(); - * const bob = await x25519.keygen(); - * const shared = await x25519.getSharedSecret(alice.secretKey, bob.publicKey); - * } - * ``` - */ -export declare const x25519: TRet; -/** - * Friendly wrapper over built-in WebCrypto x448 (ECDH over Curve448). - * Inherits the generic WebCrypto Montgomery caveat that runtime accepts more key formats than the - * narrow public `Uint8Array` argument types suggest. - * @example - * Check support, then derive one shared secret with WebCrypto X448. - * - * ```ts - * if (await x448.isSupported()) { - * const alice = await x448.keygen(); - * const bob = await x448.keygen(); - * const shared = await x448.getSharedSecret(alice.secretKey, bob.publicKey); - * } - * ``` - */ -export declare const x448: TRet; -export {}; -//# sourceMappingURL=webcrypto.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/curves/webcrypto.d.ts.map b/node_modules/@noble/curves/webcrypto.d.ts.map deleted file mode 100644 index d71670e..0000000 --- a/node_modules/@noble/curves/webcrypto.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.d.ts","sourceRoot":"","sources":["src/webcrypto.ts"],"names":[],"mappings":"AAA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D,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;;;OASG;IACH,eAAe,CACb,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,EACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,EACtB,IAAI,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,GACzB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;CAC9B,CAAC;AACF,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,eAAe,GAAG,aAAa,CAAC;AAClF,iEAAiE;AACjE,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,eAAe,CAAC;AAClE,mEAAmE;AACnE,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,aAAa,CAAC;AA8ErE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,cAAc,CAKrC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,cAAc,CAKrC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,cAAc,CAKrC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,OAAO,EAAE,IAAI,CAAC,cAAc,CAIxC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK,EAAE,IAAI,CAAC,cAAc,CAItC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAI5C,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAI1C,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/curves/webcrypto.js b/node_modules/@noble/curves/webcrypto.js deleted file mode 100644 index 41ef43a..0000000 --- a/node_modules/@noble/curves/webcrypto.js +++ /dev/null @@ -1,363 +0,0 @@ -/** Raw type */ -const TYPE_RAW = 'raw'; -const TYPE_JWK = 'jwk'; -const TYPE_SPKI = 'spki'; -const TYPE_PKCS = 'pkcs8'; -// default formats -const dfsec = TYPE_PKCS; -const dfpub = TYPE_SPKI; -function getSubtle() { - const s = globalThis?.crypto?.subtle; - if (typeof s === 'object' && s != null) - return s; - throw new Error('crypto.subtle must be defined'); -} -function createKeygenA(randomSecretKey, getPublicKey) { - // Runtime accepts an accidental `keygen(seed)` argument for parity with other wrappers, but the - // seed is intentionally ignored because WebCrypto keygen here always goes through fresh keygen. - return async function keygenA(_seed) { - const secretKey = (await randomSecretKey()); - return { secretKey, publicKey: (await getPublicKey(secretKey)) }; - }; -} -// Internal helper only: strict hex parser for the local hardcoded PKCS8 header constants. -function hexToBytesLocal(hex) { - const pairs = hex.match(/[0-9a-f]{2}/gi); - if (!pairs || pairs.length * 2 !== hex.length) - throw new Error('invalid hex'); - return Uint8Array.from(pairs, (b) => Number.parseInt(b, 16)); -} -export const __TEST = /* @__PURE__ */ Object.freeze({ - hexToBytesLocal, -}); -function assertType(type, key) { - // Callers are expected to pass a non-null key-like object; `null` / `undefined` still fail first - // via property access before reaching the explicit wrapper error. - if (key.type !== type) - throw new Error(`invalid key type, expected ${type}`); -} -function createKeyUtils(algo, derive, keyLen, pkcs8header) { - const secUsage = derive ? ['deriveBits'] : ['sign']; - const pubUsage = derive ? [] : ['verify']; - // Return Uint8Array instead of ArrayBuffer - const arrBufToU8 = (res, format) => (format === TYPE_JWK - ? res - : new Uint8Array(res)); - const pub = { - async import(key, format) { - // For sign/verify wrappers we pass caller-provided JWK metadata through unchanged and let - // WebCrypto enforce mismatched `key_ops` / extractability instead of normalizing it here. - const keyi = await getSubtle().importKey(format, key, algo, true, pubUsage); - assertType('public', keyi); - return keyi; - }, - async export(key, format) { - assertType('public', key); - const keyi = await getSubtle().exportKey(format, key); - return arrBufToU8(keyi, format); - }, - async convert(key, inFormat, outFormat) { - return pub.export(await pub.import(key, inFormat), outFormat); - }, - }; - const priv = { - async import(key, format) { - const crypto = getSubtle(); - let keyi; - if (format === TYPE_RAW) { - // Chrome, node, bun, deno: works - // Safari, Firefox: Data provided to an operation does not meet requirements - // This is the best one can do. JWK can't be used: it contains public key component inside. - const k = key; - const head = hexToBytesLocal(pkcs8header); - const all = new Uint8Array(head.length + k.length); - all.set(head, 0); - all.set(k, head.length); - keyi = await crypto.importKey(TYPE_PKCS, all, algo, true, secUsage); - } - else { - // Sign/verify wrappers keep caller JWK metadata as-is and assume the supplied `key_ops` - // already match the requested operation. ECDH is different: noble treats the same key - // material as usable for both sign and derive, so JWK imported through the derive path - // must rewrite `key_ops` or WebCrypto refuses otherwise-correct keys exported by keygen. - if (derive && format === TYPE_JWK) - key = { ...key, key_ops: secUsage }; - keyi = await crypto.importKey(format, key, algo, true, secUsage); - } - assertType('private', keyi); - return keyi; - }, - async export(key, format) { - const crypto = getSubtle(); - assertType('private', key); - if (format === TYPE_RAW) { - // scure-base base64urlnopad could have been used, but we can't add more deps. - // pkcs8 would be even more fragile - const jwk = await crypto.exportKey(TYPE_JWK, key); - const base64 = jwk.d.replace(/-/g, '+').replace(/_/g, '/'); // base64url - const pad = base64.length % 4 ? '='.repeat(4 - (base64.length % 4)) : ''; // add padding - const binary = atob(base64 + pad); - // This is not ASCII, and not text: this is only semi-safe with atob output - const raw = Uint8Array.from(binary, (c) => c.charCodeAt(0)); - // Pad key to key len because Bun strips leading zero for P-521 only - const res = new Uint8Array(keyLen); - res.set(raw, keyLen - raw.length); - return res; - } - const keyi = await crypto.exportKey(format, key); - return arrBufToU8(keyi, format); - }, - async convert(key, inFormat, outFormat) { - return priv.export(await priv.import(key, inFormat), outFormat); - }, - }; - async function getPublicKey(secretKey, opts = {}) { - const fsec = opts.formatSec ?? dfsec; - const fpub = opts.formatPub ?? dfpub; - // Export to jwk, remove private scalar and then convert to format - const jwk = (fsec === TYPE_JWK ? { ...secretKey } : await priv.convert(secretKey, fsec, TYPE_JWK)); - delete jwk.d; - jwk.key_ops = pubUsage; - if (fpub === TYPE_JWK) - return jwk; - return pub.convert(jwk, TYPE_JWK, fpub); - } - async function randomSecretKey(format = dfsec) { - const keyPair = await getSubtle().generateKey(algo, true, secUsage); - return priv.export(keyPair.privateKey, format); - } - // Key generation could be slow, so we cache result once. - let supported; - return { - pub: pub, - priv: priv, - async isSupported() { - if (supported !== undefined) - return supported; - try { - const crypto = getSubtle(); - const key = await crypto.generateKey(algo, true, secUsage); - // Deno is broken and generates key for unsupported curves, but then fails on export - await priv.export(key.privateKey, TYPE_JWK); - // Bun fails on derive for x25519, but not x448 - if (derive) { - await crypto.deriveBits({ name: typeof algo === 'string' ? algo : algo.name, public: key.publicKey }, key.privateKey, 8); - } - return (supported = true); - } - catch (e) { - return (supported = false); - } - }, - getPublicKey, - keygen: createKeygenA(randomSecretKey, getPublicKey), - utils: Object.freeze({ - randomSecretKey, - // Runtime expects both formats explicitly here; omitted formats just flow into - // `subtle.importKey(...)`, and JWK conversion also assumes extractable keys (`ext !== false`). - convertPublicKey: pub.convert, - // Runtime expects both formats explicitly here; omitted formats just flow into - // `subtle.importKey(...)`, and JWK conversion also assumes extractable keys (`ext !== false`). - convertSecretKey: priv.convert, - }), - }; -} -function createSigner(keys, algo) { - return { - // Historical param name: wrappers pass message bytes here, while WebCrypto performs the - // algorithm-specific hashing itself for ECDSA. We also return provider signatures verbatim: - // this wrapper is intentionally "raw WebCrypto", so it does not parse scalars or normalize - // high-S ECDSA outputs into software noble's low-S convention. - async sign(msgHash, secretKey, opts = {}) { - const key = await keys.priv.import(secretKey, opts.formatSec ?? dfsec); - const sig = await getSubtle().sign(algo, key, msgHash); - return new Uint8Array(sig); - }, - async verify(signature, msgHash, publicKey, opts = {}) { - const key = await keys.pub.import(publicKey, opts.formatPub ?? dfpub); - return await getSubtle().verify(algo, key, signature, msgHash); - }, - }; -} -function createECDH(keys, algo, keyLen) { - return { - // Runtime accepts the alternate key formats supported by `keys.import(...)`; the public type is - // still narrower than that accepted surface. - async getSharedSecret(secretKeyA, publicKeyB, opts = {}) { - // if (_isCompressed !== true) throw new Error('WebCrypto only supports compressed keys'); - const secKey = await keys.priv.import(secretKeyA, opts.formatSec === undefined ? dfsec : opts.formatSec); - const pubKey = await keys.pub.import(publicKeyB, opts.formatPub === undefined ? dfpub : opts.formatPub); - const shared = await getSubtle().deriveBits({ name: typeof algo === 'string' ? algo : algo.name, public: pubKey }, secKey, 8 * keyLen); - return new Uint8Array(shared); - }, - }; -} -function wrapECDSA(curve, hash, keyLen, pkcs8header) { - const ECDH_ALGO = { name: 'ECDH', namedCurve: curve }; - const keys = createKeyUtils({ name: 'ECDSA', namedCurve: curve }, false, keyLen, pkcs8header); - const keysEcdh = createKeyUtils(ECDH_ALGO, true, keyLen, pkcs8header); - return Object.freeze({ - name: curve, - // Support probing comes from the sign-side wrapper only; ECDH availability is not checked - // independently here even though the public wrapper also exposes `getSharedSecret(...)`. - isSupported: keys.isSupported, - getPublicKey: keys.getPublicKey, - keygen: createKeygenA(keys.utils.randomSecretKey, keys.getPublicKey), - ...createSigner(keys, { name: 'ECDSA', hash: { name: hash } }), - ...createECDH(keysEcdh, ECDH_ALGO, keyLen), - utils: Object.freeze({ - ...keys.utils, - async convertSecretKey(key, inFormat, outFormat) { - const jwk = inFormat === TYPE_JWK ? key : undefined; - // `wrapECDSA(...)` exposes the same key material for both sign and derive, so an ECDH-flavored - // JWK secret key from `getSharedSecret(...)` should still round-trip through `utils`. - if (Array.isArray(jwk?.key_ops) && - jwk.key_ops.length === 1 && - jwk.key_ops[0] === 'deriveBits') - return keysEcdh.utils.convertSecretKey(key, inFormat, outFormat); - return keys.utils.convertSecretKey(key, inFormat, outFormat); - }, - }), - }); -} -function wrapEdDSA(curve, keyLen, pkcs8header) { - const keys = createKeyUtils(curve, false, keyLen, pkcs8header); - return Object.freeze({ - name: curve, - isSupported: keys.isSupported, - // This wrapper intentionally re-exports the generic WebCrypto key-conversion/signing behavior - // without adding extra JWK-metadata or extractability guardrails of its own. - getPublicKey: keys.getPublicKey, - keygen: createKeygenA(keys.utils.randomSecretKey, keys.getPublicKey), - ...createSigner(keys, { name: curve }), - utils: keys.utils, - }); -} -function wrapMontgomery(curve, keyLen, pkcs8header) { - const keys = createKeyUtils(curve, true, keyLen, pkcs8header); - return Object.freeze({ - name: curve, - isSupported: keys.isSupported, - // This wrapper intentionally re-exports the generic ECDH key-format behavior without widening - // the narrow public `Uint8Array` key types. - getPublicKey: keys.getPublicKey, - keygen: createKeygenA(keys.utils.randomSecretKey, keys.getPublicKey), - ...createECDH(keys, curve, keyLen), - utils: keys.utils, - }); -} -/** - * Friendly wrapper over built-in WebCrypto NIST P-256 (secp256r1). - * Inherits the generic WebCrypto ECDSA caveats: `isSupported()` only probes the sign-side API, and - * the conversion/signing helpers keep the shared `createKeyUtils(...)` / `createSigner(...)` quirks, - * including raw WebCrypto ECDSA signatures without low-S normalization. - * @example - * Check support, then sign and verify once with WebCrypto P-256. - * - * ```ts - * if (await p256.isSupported()) { - * const { secretKey, publicKey } = await p256.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await p256.sign(msg, secretKey); - * const isValid = await p256.verify(sig, msg, publicKey); - * } - * ``` - */ -export const p256 = /* @__PURE__ */ wrapECDSA('P-256', 'SHA-256', 32, '3041020100301306072a8648ce3d020106082a8648ce3d030107042730250201010420'); -/** - * Friendly wrapper over built-in WebCrypto NIST P-384 (secp384r1). - * Inherits the generic WebCrypto ECDSA caveats around support probing and key/signing conversion. - * @example - * Check support, then sign and verify once with WebCrypto P-384. - * - * ```ts - * if (await p384.isSupported()) { - * const { secretKey, publicKey } = await p384.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await p384.sign(msg, secretKey); - * const isValid = await p384.verify(sig, msg, publicKey); - * } - * ``` - */ -export const p384 = /* @__PURE__ */ wrapECDSA('P-384', 'SHA-384', 48, '304e020100301006072a8648ce3d020106052b81040022043730350201010430'); -/** - * Friendly wrapper over built-in WebCrypto NIST P-521 (secp521r1). - * Inherits the generic WebCrypto ECDSA caveats around support probing and key/signing conversion. - * @example - * Check support, then sign and verify once with WebCrypto P-521. - * - * ```ts - * if (await p521.isSupported()) { - * const { secretKey, publicKey } = await p521.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await p521.sign(msg, secretKey); - * const isValid = await p521.verify(sig, msg, publicKey); - * } - * ``` - */ -export const p521 = /* @__PURE__ */ wrapECDSA('P-521', 'SHA-512', 66, '3060020100301006072a8648ce3d020106052b81040023044930470201010442'); -/** - * Friendly wrapper over built-in WebCrypto ed25519. - * Inherits the generic WebCrypto EdDSA caveats around JWK conversion metadata and extractability. - * @example - * Check support, then sign and verify once with WebCrypto Ed25519. - * - * ```ts - * if (await ed25519.isSupported()) { - * const { secretKey, publicKey } = await ed25519.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await ed25519.sign(msg, secretKey); - * const isValid = await ed25519.verify(sig, msg, publicKey); - * } - * ``` - */ -export const ed25519 = /* @__PURE__ */ wrapEdDSA('Ed25519', 32, '302e020100300506032b657004220420'); -/** - * Friendly wrapper over built-in WebCrypto ed448. - * Inherits the generic WebCrypto EdDSA caveats around JWK conversion metadata and extractability. - * @example - * Check support, then sign and verify once with WebCrypto Ed448. - * - * ```ts - * if (await ed448.isSupported()) { - * const { secretKey, publicKey } = await ed448.keygen(); - * const msg = new TextEncoder().encode('hello noble'); - * const sig = await ed448.sign(msg, secretKey); - * const isValid = await ed448.verify(sig, msg, publicKey); - * } - * ``` - */ -export const ed448 = /* @__PURE__ */ wrapEdDSA('Ed448', 57, '3047020100300506032b6571043b0439'); -/** - * Friendly wrapper over built-in WebCrypto x25519 (ECDH over Curve25519). - * Inherits the generic WebCrypto Montgomery caveat that runtime accepts more key formats than the - * narrow public `Uint8Array` argument types suggest. - * @example - * Check support, then derive one shared secret with WebCrypto X25519. - * - * ```ts - * if (await x25519.isSupported()) { - * const alice = await x25519.keygen(); - * const bob = await x25519.keygen(); - * const shared = await x25519.getSharedSecret(alice.secretKey, bob.publicKey); - * } - * ``` - */ -export const x25519 = /* @__PURE__ */ wrapMontgomery('X25519', 32, '302e020100300506032b656e04220420'); -/** - * Friendly wrapper over built-in WebCrypto x448 (ECDH over Curve448). - * Inherits the generic WebCrypto Montgomery caveat that runtime accepts more key formats than the - * narrow public `Uint8Array` argument types suggest. - * @example - * Check support, then derive one shared secret with WebCrypto X448. - * - * ```ts - * if (await x448.isSupported()) { - * const alice = await x448.keygen(); - * const bob = await x448.keygen(); - * const shared = await x448.getSharedSecret(alice.secretKey, bob.publicKey); - * } - * ``` - */ -export const x448 = /* @__PURE__ */ wrapMontgomery('X448', 56, '3046020100300506032b656f043a0438'); -//# sourceMappingURL=webcrypto.js.map \ No newline at end of file diff --git a/node_modules/@noble/curves/webcrypto.js.map b/node_modules/@noble/curves/webcrypto.js.map deleted file mode 100644 index 5b4d753..0000000 --- a/node_modules/@noble/curves/webcrypto.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.js","sourceRoot":"","sources":["src/webcrypto.ts"],"names":[],"mappings":"AA6CA,eAAe;AACf,MAAM,QAAQ,GAAG,KAAK,CAAC;AACvB,MAAM,QAAQ,GAAG,KAAK,CAAC;AACvB,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,SAAS,GAAG,OAAO,CAAC;AAc1B,kBAAkB;AAClB,MAAM,KAAK,GAAG,SAAS,CAAC;AACxB,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,SAAS,SAAS;IAChB,MAAM,CAAC,GAAQ,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC;IAC1C,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,CAAC,CAAC;IACjD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,aAAa,CACpB,eAAoB,EACpB,YAAiB;IAEjB,gGAAgG;IAChG,gGAAg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CACzE,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,IAAI,GAAyB,eAAe,CAAC,SAAS,CACjE,OAAO,EACP,SAAS,EACT,EAAE,EACF,kEAAkE,CACnE,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,IAAI,GAAyB,eAAe,CAAC,SAAS,CACjE,OAAO,EACP,SAAS,EACT,EAAE,EACF,kEAAkE,CACnE,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,OAAO,GAAyB,eAAe,CAAC,SAAS,CACpE,SAAS,EACT,EAAE,EACF,kCAAkC,CACnC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,KAAK,GAAyB,eAAe,CAAC,SAAS,CAClE,OAAO,EACP,EAAE,EACF,kCAAkC,CACnC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,MAAM,GAA8B,eAAe,CAAC,cAAc,CAC7E,QAAQ,EACR,EAAE,EACF,kCAAkC,CACnC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,IAAI,GAA8B,eAAe,CAAC,cAAc,CAC3E,MAAM,EACN,EAAE,EACF,kCAAkC,CACnC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/ed25519/LICENSE b/node_modules/@noble/ed25519/LICENSE deleted file mode 100644 index a5e0151..0000000 --- a/node_modules/@noble/ed25519/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 Paul Miller (https://paulmillr.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the “Software”), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/@noble/ed25519/README.md b/node_modules/@noble/ed25519/README.md deleted file mode 100644 index 9919ef1..0000000 --- a/node_modules/@noble/ed25519/README.md +++ /dev/null @@ -1,370 +0,0 @@ -# noble-ed25519 - -Fastest 5KB JS implementation of ed25519 signatures. - -- ✍️ [EDDSA](https://en.wikipedia.org/wiki/EdDSA) signatures compliant with - [RFC8032](https://tools.ietf.org/html/rfc8032), FIPS 186-5 -- 🪢 Consensus-friendly, compliant with [ZIP215](https://zips.z.cash/zip-0215) -- 🔖 SUF-CMA (strong unforgeability under chosen message attacks) and - SBS (non-repudiation / exclusive ownership) -- 🪶 3.9KB (gzipped) - -The module is a sister project of [noble-curves](https://github.com/paulmillr/noble-curves). -Use noble-ed25519 if you need smaller attack surface & better auditability. -Switch to noble-curves (drop-in) if you need features like ristretto255, x25519 / curve25519, ed25519ph, hash-to-curve, oprf. - -### This library belongs to _noble_ cryptography - -> **noble-cryptography** — high-security, easily auditable set of contained cryptographic libraries and tools. - -- Zero or minimal dependencies -- Highly readable TypeScript / JS code -- PGP-signed releases and transparent NPM builds -- All libraries: - [ciphers](https://github.com/paulmillr/noble-ciphers), - [curves](https://github.com/paulmillr/noble-curves), - [hashes](https://github.com/paulmillr/noble-hashes), - [post-quantum](https://github.com/paulmillr/noble-post-quantum), - 5kb [secp256k1](https://github.com/paulmillr/noble-secp256k1) / - [ed25519](https://github.com/paulmillr/noble-ed25519) -- [Check out the homepage](https://paulmillr.com/noble/) - for reading resources, documentation, and apps built with noble - -## Usage - -> `npm install @noble/ed25519` - -> `deno add jsr:@noble/ed25519` - -We support all major platforms and runtimes. For React Native, additional polyfills are needed: see below. - -```js -import * as ed from '@noble/ed25519'; -(async () => { - const { secretKey, publicKey } = await ed.keygenAsync(); - // const publicKey = await ed.getPublicKeyAsync(secretKey); - const message = new TextEncoder().encode('hello noble'); - const signature = await ed.signAsync(message, secretKey); - const isValid = await ed.verifyAsync(signature, message, publicKey); -})(); -``` - -### Enabling synchronous methods - -Only async methods are available by default, to keep the library dependency-free. -To enable sync methods: - -> `npm install @noble/hashes` - -```ts -import * as ed from '@noble/ed25519'; -import { sha512 } from '@noble/hashes/sha2.js'; -ed.hashes.sha512 = sha512; -// Sync methods can be used now: -const { secretKey, publicKey } = ed.keygen(); -const msg = new TextEncoder().encode('hello noble'); -// const publicKey = ed.getPublicKey(secretKey); -const sig = ed.sign(msg, secretKey); -const isValid = ed.verify(sig, msg, publicKey); -``` - -### React Native: polyfill getRandomValues and sha512 - -React Native does not provide secure getRandomValues by default. -This can't be securely polyfilled from our end, so one will need a RN-specific compile-time dep. - -```ts -import 'react-native-get-random-values'; -import * as ed from '@noble/ed25519'; -import { sha512 } from '@noble/hashes/sha2.js'; -ed.hashes.sha512 = sha512; -ed.hashes.sha512Async = (m: Uint8Array) => Promise.resolve(sha512(m)); -``` - -## API - -There are 4 main methods, which accept Uint8Array-s: - -- `keygen()` and `keygenAsync()` -- `getPublicKey(secretKey)` and `getPublicKeyAsync(secretKey)` -- `sign(message, secretKey)` and `signAsync(message, secretKey)` -- `verify(signature, message, publicKey)` and `verifyAsync(signature, message, publicKey)` - -### keygen - -```typescript -import * as ed from '@noble/ed25519'; -import { sha512 } from '@noble/hashes/sha2.js'; -ed.hashes.sha512 = sha512; -(async () => { - const keys = ed.keygen(); - const { secretKey, publicKey } = keys; - const keysA = await ed.keygenAsync(); -})(); -``` - -### getPublicKey - -```typescript -import * as ed from '@noble/ed25519'; -import { sha512 } from '@noble/hashes/sha2.js'; -ed.hashes.sha512 = sha512; -(async () => { - const { secretKey: secretKeyA } = ed.keygen(); - const pubKey = ed.getPublicKey(secretKeyA); - const pubKeyA = await ed.getPublicKeyAsync(secretKeyA); - const pubKeyPoint = ed.Point.fromBytes(pubKey); - const pubKeyExtended = ed.utils.getExtendedPublicKey(secretKeyA); -})(); -``` - -Generates 32-byte public key from 32-byte private key. - -- Some libraries have 64-byte private keys - those are just priv+pub concatenated -- Use `ExtendedPoint.fromHex(publicKey)` if you want to convert hex / bytes into Point. - It will use decompression algorithm 5.1.3 of RFC 8032. -- Use `utils.getExtendedPublicKey` if you need full SHA512 hash of seed - -### sign - -```ts -import * as ed from '@noble/ed25519'; -import { sha512 } from '@noble/hashes/sha2.js'; -ed.hashes.sha512 = sha512; -(async () => { - const { secretKey, publicKey } = ed.keygen(); - const message = new TextEncoder().encode('hello noble'); - const signature = ed.sign(message, secretKey); - const signatureA = await ed.signAsync(message, secretKey); -})(); -``` - -Generates deterministic EdDSA signature. `message` would be hashed by ed25519 internally. -For prehashed ed25519ph, switch to noble-curves. - -### verify - -```ts -import * as ed from '@noble/ed25519'; -import { sha512 } from '@noble/hashes/sha2.js'; -ed.hashes.sha512 = sha512; -(async () => { - const { secretKey, publicKey } = ed.keygen(); - const message = new TextEncoder().encode('hello noble'); - const signature = ed.sign(message, secretKey); - const isValid = ed.verify(signature, message, publicKey); - - const isValidFips = ed.verify(signature, message, publicKey, { zip215: false }); - const isValidA = await ed.verifyAsync(signature, message, publicKey); -})(); -``` - -Verifies EdDSA signature. Has SUF-CMA (strong unforgeability under chosen message attacks). -By default, follows ZIP215 [^1] and can be used in consensus-critical apps [^2]. -`zip215: false` option switches verification criteria to strict -RFC8032 / FIPS 186-5 and provides non-repudiation with SBS (Strongly Binding Signatures) [^3]. - -> [!NOTE] -> Most other libraries don't have SUF-CMA & SBS - less optimal choice for their security. - -> [!NOTE] -> Any message with pubkey from `ED25519_TORSION_SUBGROUP` would be valid in sigs under ZIP215. - -### utils - -A bunch of useful **utilities** are also exposed: - -```typescript -import * as ed from '@noble/ed25519'; -const { bytesToHex, hexToBytes, concatBytes, mod, invert, randomBytes } = ed.etc; -const { getExtendedPublicKey, getExtendedPublicKeyAsync, randomSecretKey } = ed.utils; -const { Point } = ed; -console.log(Point.CURVE(), Point.BASE); -/* -class Point { - static BASE: Point; - static ZERO: Point; - readonly X: bigint; - readonly Y: bigint; - readonly Z: bigint; - readonly T: bigint; - constructor(X: bigint, Y: bigint, Z: bigint, T: bigint); - static CURVE(): EdwardsOpts; - static fromAffine(p: AffinePoint): Point; - static fromBytes(hex: Bytes, zip215?: boolean): Point; - static fromHex(hex: string, zip215?: boolean): Point; - get x(): bigint; - get y(): bigint; - assertValidity(): this; - equals(other: Point): boolean; - is0(): boolean; - negate(): Point; - double(): Point; - add(other: Point): Point; - subtract(other: Point): Point; - multiply(n: bigint, safe?: boolean): Point; - multiplyUnsafe(scalar: bigint): Point; - toAffine(): AffinePoint; - toBytes(): Bytes; - toHex(): string; - clearCofactor(): Point; - isSmallOrder(): boolean; - isTorsionFree(): boolean; -} -*/ -``` - -## Security - -The module is production-ready. - -We cross-test against sister project [noble-curves](https://github.com/paulmillr/noble-curves), which was audited and provides improved security. - -- The current version has not been independently audited. It is a rewrite of v1, which has been audited by cure53 in Feb 2022: - [PDF](https://cure53.de/pentest-report_ed25519.pdf). -- It's being fuzzed [in a separate repository](https://github.com/paulmillr/fuzzing) - -If you see anything unusual: investigate and report. - -### Constant-timeness - -We're targetting algorithmic constant time. _JIT-compiler_ and _Garbage Collector_ make "constant time" -extremely hard to achieve [timing attack](https://en.wikipedia.org/wiki/Timing_attack) resistance -in a scripting language. Which means _any other JS library can't have -constant-timeness_. Even statically typed Rust, a language without GC, -[makes it harder to achieve constant-time](https://www.chosenplaintext.ca/open-source/rust-timing-shield/security) -for some cases. If your goal is absolute security, don't use any JS lib — including bindings to native ones. -Use low-level libraries & languages. - -### Supply chain security - -- **Commits** are signed with PGP keys to prevent forgery. Be sure to verify the commit signatures -- **Releases** are made transparently through token-less GitHub CI and Trusted Publishing. Be sure to verify the [provenance logs](https://docs.npmjs.com/generating-provenance-statements) for authenticity. -- **Rare releasing** is practiced to minimize the need for re-audits by end-users. -- **Dependencies** are minimized and strictly pinned to reduce supply-chain risk. - - We use as few dependencies as possible. - - Version ranges are locked, and changes are checked with npm-diff. -- **Dev dependencies** are excluded from end-user installs; they’re only used for development and build steps. - -For this package, there are 0 dependencies; and a few dev dependencies: - -- [noble-hashes](https://github.com/paulmillr/noble-hashes) provides cryptographic hashing functionality -- jsbt is used for benchmarking / testing / build tooling and developed by the same author -- prettier, fast-check and typescript are used for code quality / test generation / ts compilation - -### Randomness - -We rely on the built-in -[`crypto.getRandomValues`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues), -which is considered a cryptographically secure PRNG. - -Browsers have had weaknesses in the past - and could again - but implementing a userspace CSPRNG is even worse, as there’s no reliable userspace source of high-quality entropy. - -### Quantum computers - -Cryptographically relevant quantum computer, if built, will allow to -break elliptic curve cryptography (both ECDSA / EdDSA & ECDH) using Shor's algorithm. - -Consider switching to newer / hybrid algorithms, such as SPHINCS+. They are available in -[noble-post-quantum](https://github.com/paulmillr/noble-post-quantum). - -NIST prohibits classical cryptography (RSA, DSA, ECDSA, ECDH) [after 2035](https://nvlpubs.nist.gov/nistpubs/ir/2024/NIST.IR.8547.ipd.pdf). Australian ASD prohibits it [after 2030](https://www.cyber.gov.au/resources-business-and-government/essential-cyber-security/ism/cyber-security-guidelines/guidelines-cryptography). - -## Upgrading - -### v2 to v3 - -v3 brings the package closer to noble-curves v2. - -- Most methods now expect Uint8Array, string hex inputs are prohibited -- Add `keygen`, `keygenAsync` method -- Node v20.19 is now the minimum required version -- Various small changes for types and Point class -- etc: hashes are now set in `hashes` object: - -```ts -import * as ed from '@noble/ed25519'; -import { sha512 } from '@noble/hashes/sha2.js'; -// before -ed.etc.sha512Sync = (...m: Uint8Array[]) => sha512(ed.etc.concatBytes(...m)); -ed.etc.sha512Async = (...m: Uint8Array[]) => Promise.resolve(sha512(ed.etc.concatBytes(...m))); -// after -ed.hashes.sha512 = sha512; -ed.hashes.sha512Async = (m: Uint8Array) => Promise.resolve(sha512(m)); -``` - -### v1 to v2 - -v2 features improved security and smaller attack surface. -The goal of v2 is to provide minimum possible JS library which is safe and fast. - -That means the library was reduced 4x, to just over 300 lines. In order to -achieve the goal, **some features were moved** to -[noble-curves](https://github.com/paulmillr/noble-curves), which is -even safer and faster drop-in replacement library with same API. -Switch to curves if you intend to keep using these features: - -- x25519 / curve25519 / getSharedSecret -- ristretto255 / RistrettoPoint -- Using `utils.precompute()` for non-base point -- Support for environments which don't support bigint literals -- Common.js support -- Support for node.js 18 and older without [shim](#usage) - -Other changes for upgrading from @noble/ed25519 1.7 to 2.0: - -- Methods are now sync by default; use `getPublicKeyAsync`, `signAsync`, `verifyAsync` for async versions -- `bigint` is no longer allowed in `getPublicKey`, `sign`, `verify`. Reason: ed25519 is LE, can lead to bugs -- `Point` (2d xy) has been changed to `ExtendedPoint` (xyzt) -- `Signature` was removed: just use raw bytes or hex now -- `utils` were split into `utils` (same api as in noble-curves) and - `etc` (`sha512Sync` and others) - -## Contributing & testing - -- `npm install && npm run build && npm test` will build the code and run tests. -- `npm run bench` will run benchmarks -- `npm run build:release` will build single file - -See [paulmillr.com/noble](https://paulmillr.com/noble/) -for useful resources, articles, documentation and demos -related to the library. - -## Speed - - npm run bench - -Benchmarks measured with Apple M4. - - init 11ms - keygen x 14,467 ops/sec @ 69μs/op - sign x 7,275 ops/sec @ 137μs/op - verify x 2,004 ops/sec @ 498μs/op - - keygenAsync x 12,822 ops/sec @ 77μs/op - signAsync x 5,902 ops/sec @ 169μs/op - verifyAsync x 1,955 ops/sec @ 511μs/op - - Point.fromBytes x 36,545 ops/sec @ 27μs/op - - -Compare to alternative implementations: - - tweetnacl@1.0.3 getPublicKey x 1,808 ops/sec @ 552μs/op ± 1.64% - tweetnacl@1.0.3 sign x 651 ops/sec @ 1ms/op - ristretto255@0.1.2 getPublicKey x 640 ops/sec @ 1ms/op ± 1.59% - sodium-native#sign x 83,654 ops/sec @ 11μs/op - -## License - -The MIT License (MIT) - -Copyright (c) 2019 Paul Miller [(https://paulmillr.com)](https://paulmillr.com) - -See LICENSE file. - -[^1]: https://zips.z.cash/zip-0215 - -[^2]: https://hdevalence.ca/blog/2020-10-04-its-25519am - -[^3]: https://eprint.iacr.org/2020/1244 diff --git a/node_modules/@noble/ed25519/index.d.ts b/node_modules/@noble/ed25519/index.d.ts deleted file mode 100644 index ead0ef4..0000000 --- a/node_modules/@noble/ed25519/index.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/** Alias to Uint8Array. */ -export type Bytes = Uint8Array; -/** - * Bytes API type helpers for old + new TypeScript. - * - * TS 5.6 has `Uint8Array`, while TS 5.9+ made it generic `Uint8Array`. - * We can't use specific return type, because TS 5.6 will error. - * We can't use generic return type, because most TS 5.9 software will expect specific type. - * - * Maps typed-array input leaves to broad forms. - * These are compatibility adapters, not ownership guarantees. - * - * - `TArg` keeps byte inputs broad. - * - `TRet` marks byte outputs for TS 5.6 and TS 5.9+ compatibility. - */ -export type TypedArg = T extends BigInt64Array ? BigInt64Array : T extends BigUint64Array ? BigUint64Array : T extends Float32Array ? Float32Array : T extends Float64Array ? Float64Array : T extends Int16Array ? Int16Array : T extends Int32Array ? Int32Array : T extends Int8Array ? Int8Array : T extends Uint16Array ? Uint16Array : T extends Uint32Array ? Uint32Array : T extends Uint8ClampedArray ? Uint8ClampedArray : T extends Uint8Array ? Uint8Array : never; -/** Maps typed-array output leaves to narrow TS-compatible forms. */ -export type TypedRet = T extends BigInt64Array ? ReturnType : T extends BigUint64Array ? ReturnType : T extends Float32Array ? ReturnType : T extends Float64Array ? ReturnType : T extends Int16Array ? ReturnType : T extends Int32Array ? ReturnType : T extends Int8Array ? ReturnType : T extends Uint16Array ? ReturnType : T extends Uint32Array ? ReturnType : T extends Uint8ClampedArray ? ReturnType : T extends Uint8Array ? ReturnType : never; -/** Recursively adapts byte-carrying API input types. See {@link TypedArg}. */ -export type TArg = T | ([TypedArg] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: { - [K in keyof A]: TRet; -}) => TArg) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TArg; -} : T extends [infer A, ...infer R] ? [TArg, ...{ - [K in keyof R]: TArg; -}] : T extends readonly [infer A, ...infer R] ? readonly [TArg, ...{ - [K in keyof R]: TArg; -}] : T extends (infer A)[] ? TArg[] : T extends readonly (infer A)[] ? readonly TArg[] : T extends Promise ? Promise> : T extends object ? { - [K in keyof T]: TArg; -} : T : TypedArg); -/** Recursively adapts byte-carrying API output types. See {@link TypedArg}. */ -export type TRet = T extends unknown ? T & ([TypedRet] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: { - [K in keyof A]: TArg; -}) => TRet) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TRet; -} : T extends [infer A, ...infer R] ? [TRet, ...{ - [K in keyof R]: TRet; -}] : T extends readonly [infer A, ...infer R] ? readonly [TRet, ...{ - [K in keyof R]: TRet; -}] : T extends (infer A)[] ? TRet[] : T extends readonly (infer A)[] ? readonly TRet[] : T extends Promise ? Promise> : T extends object ? { - [K in keyof T]: TRet; -} : T : TypedRet) : never; -/** Edwards elliptic curve options. */ -export type EdwardsOpts = Readonly<{ - /** Prime field modulus. */ - p: bigint; - /** Group order. */ - n: bigint; - /** Curve cofactor. */ - h: bigint; - /** Edwards curve parameter `a`. */ - a: bigint; - /** Edwards curve parameter `d`. */ - d: bigint; - /** Generator x coordinate. */ - Gx: bigint; - /** Generator y coordinate. */ - Gy: bigint; -}>; -/** Canonical modular reduction into `[0, b)`. */ -declare const M: (a: bigint, b?: bigint) => bigint; -/** Modular inversion using Euclidean GCD (non-CT) instead of the RFC's `x^(p-2)` formulation. - * This still sits on secret-dependent paths like point normalization during keygen/signing. */ -declare const invert: (num: bigint, md: bigint) => bigint; -/** - * SHA-512 helper used by the synchronous API. - * @param msg - Message bytes to hash. - * @returns 64-byte SHA-512 digest. - * @example - * Hash message bytes after wiring the synchronous SHA-512 implementation. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const digest = ed.hash(new Uint8Array([1, 2, 3])); - * ``` - */ -declare const hash: (msg: TArg) => TRet; -/** Point in 2d xy affine coordinates. */ -export type AffinePoint = { - /** Affine x coordinate. */ - x: bigint; - /** Affine y coordinate. */ - y: bigint; -}; -/** - * Point in XYZT extended coordinates. - * @param X - X coordinate. - * @param Y - Y coordinate. - * @param Z - Projective Z coordinate. - * @param T - Cached cross-product term. - * @example - * Do point arithmetic with the built-in base point and encode the result as hex. - * - * ```ts - * const hex = Point.BASE.double().toHex(); - * ``` - */ -declare class Point { - static BASE: Point; - static ZERO: Point; - readonly X: bigint; - readonly Y: bigint; - readonly Z: bigint; - readonly T: bigint; - constructor(X: bigint, Y: bigint, Z: bigint, T: bigint); - static CURVE(): EdwardsOpts; - static fromAffine(p: AffinePoint): Point; - /** RFC8032 5.1.3: Bytes to Point. */ - static fromBytes(hex: TArg, zip215?: boolean): Point; - static fromHex(hex: string, zip215?: boolean): Point; - get x(): bigint; - get y(): bigint; - /** Checks if the point is valid and on-curve. */ - assertValidity(): this; - /** Equality check: compare points P&Q. */ - equals(other: Point): boolean; - is0(): boolean; - /** Flip point over y coordinate. */ - negate(): Point; - /** Point doubling. Complete formula. Cost: `4M + 4S + 1*a + 6add + 1*2`. */ - double(): Point; - /** Point addition. Complete formula. Cost: `8M + 1*k + 8add + 1*2`. */ - add(other: Point): Point; - subtract(other: Point): Point; - /** - * Point-by-scalar multiplication. Safe mode requires `1 <= n < CURVE.n`. - * Unsafe mode additionally permits `n = 0` and returns the identity point for that case. - * Uses {@link wNAF} for base point. - * Uses fake point to mitigate side-channel leakage. - * @param n - scalar by which point is multiplied - * @param safe - safe mode guards against timing attacks; unsafe mode is faster - */ - multiply(n: bigint, safe?: boolean): Point; - multiplyUnsafe(scalar: bigint): Point; - /** Convert point to 2d xy affine point. (X, Y, Z) ∋ (x=X/Z, y=Y/Z) */ - toAffine(): AffinePoint; - toBytes(): TRet; - toHex(): string; - clearCofactor(): Point; - isSmallOrder(): boolean; - isTorsionFree(): boolean; -} -type ExtK = { - head: Bytes; - prefix: Bytes; - scalar: bigint; - point: Point; - pointBytes: Bytes; -}; -declare const getExtendedPublicKeyAsync: (secretKey: TArg) => Promise>; -declare const getExtendedPublicKey: (secretKey: TArg) => TRet; -/** - * Creates a 32-byte Ed25519 public key from the RFC 8032 32-byte secret-key seed. Async. - * @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 32-byte public key. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Derive the public key bytes for a newly generated signer secret. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const publicKey = await ed.getPublicKeyAsync(secretKey); - * ``` - */ -declare const getPublicKeyAsync: (secretKey: TArg) => Promise>; -/** - * Creates a 32-byte Ed25519 public key from the RFC 8032 32-byte secret-key seed. - * To use, set `hashes.sha512` first. - * @param priv - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 32-byte public key. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Derive the public key entirely through the synchronous API. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const secretKey = ed.utils.randomSecretKey(); - * const publicKey = ed.getPublicKey(secretKey); - * ``` - */ -declare const getPublicKey: (priv: TArg) => TRet; -/** - * Signs message using secret key. Async. - * Follows RFC8032 5.1.6. - * @param message - Message bytes to sign. - * @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 64-byte Ed25519 signature. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Sign an arbitrary message with a fresh Ed25519 secret key. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const message = new Uint8Array([1, 2, 3]); - * const signature = await ed.signAsync(message, secretKey); - * ``` - */ -declare const signAsync: (message: TArg, secretKey: TArg) => Promise>; -/** - * Signs message using secret key. To use, set `hashes.sha512` first. - * Follows RFC8032 5.1.6. - * @param message - Message bytes to sign. - * @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 64-byte Ed25519 signature. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Use the sync API when you've wired a SHA-512 implementation yourself. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const secretKey = ed.utils.randomSecretKey(); - * const signature = ed.sign(new Uint8Array([1, 2, 3]), secretKey); - * ``` - */ -declare const sign: (message: TArg, secretKey: TArg) => TRet; -/** - * Verification options. zip215: true (default) follows ZIP215 spec. false would follow RFC8032. - * - * Any message with pubkey from `ED25519_TORSION_SUBGROUP` would be valid in sigs under ZIP215. - */ -export type EdDSAVerifyOpts = { - /** Whether to use ZIP215 verification semantics instead of the library's stricter branch. */ - zip215?: boolean; -}; -/** - * Verifies a signature on message and public key. Async. - * The implementation is based on RFC8032 5.1.7, but default opts use ZIP-215 semantics; pass - * `{ zip215: false }` for the library's stricter branch. - * @param signature - 64-byte signature. - * @param message - Signed message bytes. - * @param publicKey - 32-byte public key. - * @param opts - Verification options. Defaults to ZIP-215 semantics. See {@link EdDSAVerifyOpts}. - * @returns `true` when the signature is valid. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Verify the signature against the same message and derived public key. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const message = new Uint8Array([1, 2, 3]); - * const publicKey = await ed.getPublicKeyAsync(secretKey); - * const signature = await ed.signAsync(message, secretKey); - * const isValid = await ed.verifyAsync(signature, message, publicKey); - * ``` - */ -declare const verifyAsync: (signature: TArg, message: TArg, publicKey: TArg, opts?: TArg) => Promise; -/** - * Verifies a signature on message and public key using the synchronous hash path. - * The implementation is based on RFC8032 5.1.7, but default opts use ZIP-215 semantics; pass - * `{ zip215: false }` for the library's stricter branch. - * @param signature - 64-byte signature. - * @param message - Signed message bytes. - * @param publicKey - 32-byte public key. - * @param opts - Verification options. Defaults to ZIP-215 semantics. See {@link EdDSAVerifyOpts}. - * @returns `true` when the signature is valid. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Verify a signature entirely through the synchronous API. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const secretKey = ed.utils.randomSecretKey(); - * const message = new Uint8Array([1, 2, 3]); - * const publicKey = ed.getPublicKey(secretKey); - * const signature = ed.sign(message, secretKey); - * const isValid = ed.verify(signature, message, publicKey); - * ``` - */ -declare const verify: (signature: TArg, message: TArg, publicKey: TArg, opts?: TArg) => boolean; -/** - * Math, hex, byte helpers. Not in `utils` because utils share API with noble-curves. - * Exposes the same low-level field-default `mod` reducer and non-CT `invert` helper used - * internally. - * @example - * Convert bytes to a hex string with the low-level helper namespace. - * - * ```ts - * const hex = etc.bytesToHex(new Uint8Array([1, 2, 3])); - * ``` - */ -declare const etc: { - bytesToHex: (bytes: TArg) => string; - hexToBytes: (hex: string) => TRet; - concatBytes: (...arrs: TArg) => TRet; - mod: typeof M; - invert: typeof invert; - randomBytes: (len?: number) => TRet; -}; -/** - * Hash implementations used by the synchronous API plus the default async WebCrypto provider. - * Both slots are configurable API surface; wrapper helpers revalidate that providers still return - * 64-byte SHA-512 digests. - * @example - * Provide a SHA-512 implementation before calling synchronous helpers. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const { publicKey } = ed.keygen(); - * ``` - */ -declare const hashes: { - sha512Async: (message: TArg) => Promise>; - sha512: undefined | ((message: TArg) => TRet); -}; -declare const randomSecretKey: (seed?: TArg) => TRet; -type KeysSecPub = { - secretKey: Bytes; - publicKey: Bytes; -}; -/** - * Generates a secret/public keypair. - * @param seed - Optional 32-byte Ed25519 secret-key seed, returned verbatim as `secretKey`. - * @returns Keypair with `secretKey` and `publicKey`. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Generate a new keypair through the synchronous API after wiring SHA-512. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const { secretKey, publicKey } = ed.keygen(); - * ``` - */ -declare const keygen: (seed?: TArg) => TRet; -/** - * Generates a secret/public keypair asynchronously. - * @param seed - Optional 32-byte Ed25519 secret-key seed, returned verbatim as `secretKey`. - * @returns Keypair with `secretKey` and `publicKey`. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Generate a new keypair through the asynchronous WebCrypto-backed path. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const { secretKey, publicKey } = await ed.keygenAsync(); - * ``` - */ -declare const keygenAsync: (seed?: TArg) => Promise>; -/** - * Ed25519-specific key utilities. - * `utils.getExtendedPublicKey*` expose secret-derived internals (`head`, `prefix`, `scalar`, and - * point objects), not just public-key bytes. - * @example - * Generate a new Ed25519 secret key and derive the matching public key. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const publicKey = await ed.getPublicKeyAsync(secretKey); - * ``` - */ -declare const utils: { - getExtendedPublicKeyAsync: typeof getExtendedPublicKeyAsync; - getExtendedPublicKey: typeof getExtendedPublicKey; - randomSecretKey: typeof randomSecretKey; -}; -export { etc, getPublicKey, getPublicKeyAsync, hash, hashes, keygen, keygenAsync, Point, sign, signAsync, utils, verify, verifyAsync }; diff --git a/node_modules/@noble/ed25519/index.js b/node_modules/@noble/ed25519/index.js deleted file mode 100644 index eb41079..0000000 --- a/node_modules/@noble/ed25519/index.js +++ /dev/null @@ -1,945 +0,0 @@ -/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */ -/** - * 5KB JS implementation of ed25519 EdDSA signatures. - * Targets RFC8032, FIPS 186-5, and ZIP215 behavior. - * @module - * @example - * ```js -import * as ed from '@noble/ed25519'; -(async () => { - const secretKey = ed.utils.randomSecretKey(); - const message = Uint8Array.from([0xab, 0xbc, 0xcd, 0xde]); - const pubKey = await ed.getPublicKeyAsync(secretKey); // Sync methods are also present - const signature = await ed.signAsync(message, secretKey); - const isValid = await ed.verifyAsync(signature, message, pubKey); -})(); -``` - */ -/** - * Curve params. edwards25519 uses the RFC equation `-x² + y² = 1 + dx²y²`. - * The stored `a` literal below is `p - 1`, i.e. the field-element encoding of RFC `a = -1`. - * * P = `2n**255n - 19n` // field over which calculations are done - * * N = `2n**252n + 27742317777372353535851937790883648493n` // prime-order subgroup order - * * h = 8 // cofactor - * * a = `Fp.create(BigInt(-1))` // equation param, stored here as `p - 1` - * * d = -121665/121666 a.k.a. `Fp.neg(121665 * Fp.inv(121666))` // equation param - * * Gx, Gy are coordinates of Generator / base point - * - * Mirror noble-curves: Point.CURVE() exposes shared params, but callers must not be able to mutate - * that shared view and desynchronize it from the arithmetic constants captured below. - */ -const ed25519_CURVE = Object.freeze({ - p: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn, - n: 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn, - h: 8n, - a: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn, - d: 0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n, - Gx: 0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an, - Gy: 0x6666666666666666666666666666666666666666666666666666666666666658n, -}); -const { p: P, n: N, Gx, Gy, a: _a, d: _d, h } = ed25519_CURVE; -const L = 32; // shared 32-byte encoded width for Ed25519 points, scalars, signatures, and keys -// Helpers and Precomputes sections are reused between libraries -// ## Helpers -// ---------- -// @ts-ignore -const captureTrace = (...args) => { - if ('captureStackTrace' in Error && typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(...args); - } -}; -const err = (message = '') => { - const e = new Error(message); - captureTrace(e, err); - throw e; -}; -const isBig = (n) => typeof n === 'bigint'; // is big integer -const isStr = (s) => typeof s === 'string'; // is string -// Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases. The -// fallback still requires a real ArrayBuffer view so plain JSON-deserialized `{ constructor: ... }` -// spoofing is rejected, and `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views. -const isBytes = (a) => a instanceof Uint8Array || - (ArrayBuffer.isView(a) && - a.constructor.name === 'Uint8Array' && - 'BYTES_PER_ELEMENT' in a && - a.BYTES_PER_ELEMENT === 1); -/** - * Asserts something is Bytes, optionally enforces exact length, - * and returns the same reference. - */ -const abytes = (value, length, title = '') => { - const bytes = isBytes(value); - const len = value?.length; - const needsLen = length !== undefined; - if (!bytes || (needsLen && len !== length)) { - const prefix = title && `"${title}" `; - const ofLen = needsLen ? ` of length ${length}` : ''; - const got = bytes ? `length=${len}` : `type=${typeof value}`; - const msg = prefix + 'expected Uint8Array' + ofLen + ', got ' + got; - throw bytes ? new RangeError(msg) : new TypeError(msg); - } - return value; -}; -/** create Uint8Array */ -const u8n = (len) => new Uint8Array(len); -// Clone helper used before in-place byte edits such as sign-bit clearing or endian reversal. -const u8fr = (buf) => Uint8Array.from(buf); -// Left-pad hex to a caller-chosen width. Width enforcement/truncation policy stays with callers. -const padh = (n, pad) => n.toString(16).padStart(pad, '0'); -// Lowercase hex serializer. -const bytesToHex = (b) => Array.from(abytes(b)) - .map((e) => padh(e, 2)) - .join(''); -const C = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; // ASCII characters -const _ch = (ch) => { - if (ch >= C._0 && ch <= C._9) - return ch - C._0; // '2' => 50-48 - if (ch >= C.A && ch <= C.F) - return ch - (C.A - 10); // 'B' => 66-(65-10) - if (ch >= C.a && ch <= C.f) - return ch - (C.a - 10); // 'b' => 98-(97-10) - return; -}; -// Accepts both uppercase and lowercase hex; all parse failures intentionally collapse to `hex invalid`. -const hexToBytes = (hex) => { - const e = 'hex invalid'; - if (!isStr(hex)) - return err(e); - const hl = hex.length; - const al = hl / 2; - if (hl % 2) - return err(e); - const array = u8n(al); - for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { - // treat each char as ASCII - const n1 = _ch(hex.charCodeAt(hi)); // parse first char, multiply it by 16 - const n2 = _ch(hex.charCodeAt(hi + 1)); // parse second char - if (n1 === undefined || n2 === undefined) - return err(e); - array[ai] = n1 * 16 + n2; // example: 'A9' => 10*16 + 9 - } - return array; -}; -const cr = () => globalThis?.crypto; // Optional WebCrypto lookup; sync code still handles absence. -// Async-path capability helper for WebCrypto-backed APIs. -const subtle = () => cr()?.subtle ?? err('crypto.subtle must be defined, consider polyfill'); -// prettier-ignore -const concatBytes = (...arrs) => { - // Argument order is transcript-significant for hash/signature callers, and input validation here - // intentionally reuses `abytes(...)` without making defensive copies of the source chunks. - let len = 0; - for (const a of arrs) - len += abytes(a).length; - const r = u8n(len); // create u8a of summed length - let pad = 0; // walk through each array, - arrs.forEach(a => { r.set(a, pad); pad += a.length; }); // ensure they have proper type - return r; -}; -/** WebCrypto OS-level CSPRNG (random number generator). Absence still fails later via `cr()`. */ -const randomBytes = (len = L) => { - const c = cr(); - return c.getRandomValues(u8n(len)); -}; -const big = BigInt; -/** Inclusive-lower, exclusive-upper bigint range assertion. */ -const assertRange = (n, min, max, msg = 'bad number: out of range') => { - if (!isBig(n)) - throw new TypeError(msg); - if (min <= n && n < max) - return n; - throw new RangeError(msg); -}; -/** Canonical modular reduction into `[0, b)`. */ -const M = (a, b = P) => { - const r = a % b; - return r >= 0n ? r : b + r; -}; -// Low-255-bit mask used by the `2^255 - 19` fast reduction in `modP(...)`. -const P_MASK = (1n << 255n) - 1n; -// Fast reduction for the special prime `2^255 - 19`. This path assumes nonnegative inputs; the -// generic fallback would simply be `M(num, P)`. -const modP = (num) => { - // return M(num, P); - if (num < 0n) - err('negative coordinate'); - let r = (num >> 255n) * 19n + (num & P_MASK); - r = (r >> 255n) * 19n + (r & P_MASK); - return r % P; -}; -// Reduce modulo the subgroup order stored in implementation constant `N` (RFC 8032's `L`). -const modN = (a) => M(a, N); -/** Modular inversion using Euclidean GCD (non-CT) instead of the RFC's `x^(p-2)` formulation. - * This still sits on secret-dependent paths like point normalization during keygen/signing. */ -// prettier-ignore -const invert = (num, md) => { - if (num === 0n || md <= 0n) - err('no inverse n=' + num + ' mod=' + md); - let a = M(num, md), b = md, x = 0n, y = 1n, u = 1n, v = 0n; - while (a !== 0n) { - const q = b / a, r = b % a; - const m = x - u * q, n = y - v * q; - b = a, a = r, x = u, y = v, u = m, v = n; - } - return b === 1n ? M(x, md) : err('no inverse'); // b is gcd at this point -}; -// Dynamic lookup keeps sync/async hash providers configurable at runtime. Both exported slots are -// caller-owned and may be unset; wrapper helpers use this lookup first and then enforce the digest -// contract instead of trusting provider output. -const callHash = (name) => { - // @ts-ignore - const fn = hashes[name]; - if (typeof fn !== 'function') - err('hashes.' + name + ' not set'); - return fn; -}; -// Both provider slots are configurable API surface and may return arbitrary values, so callers must -// enforce the promised 64-byte SHA-512 digest contract here instead of trusting provider output. -const checkDigest = (value) => abytes(value, 64, 'digest'); -/** - * SHA-512 helper used by the synchronous API. - * @param msg - Message bytes to hash. - * @returns 64-byte SHA-512 digest. - * @example - * Hash message bytes after wiring the synchronous SHA-512 implementation. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const digest = ed.hash(new Uint8Array([1, 2, 3])); - * ``` - */ -// Public helper validates the message boundary explicitly; the configured provider is still looked -// up dynamically and its output is checked with `checkDigest(...)`. -const hash = (msg) => checkDigest(callHash('sha512')(abytes(msg, undefined, 'message'))); -// Runtime class guard: this is `instanceof Point`, so cross-realm / duplicate-bundle Point objects -// are rejected even if they are structurally identical. -const apoint = (p) => (p instanceof Point ? p : err('Point expected')); -// ## End of Helpers -// ----------------- -// Exclusive upper bound `2^256` used by 32-byte decode/serialization range checks. -const B256 = 2n ** 256n; -/** - * Point in XYZT extended coordinates. - * @param X - X coordinate. - * @param Y - Y coordinate. - * @param Z - Projective Z coordinate. - * @param T - Cached cross-product term. - * @example - * Do point arithmetic with the built-in base point and encode the result as hex. - * - * ```ts - * const hex = Point.BASE.double().toHex(); - * ``` - */ -class Point { - static BASE; - static ZERO; - X; - Y; - Z; - T; - // Constructor only bounds-checks and freezes XYZT coordinates; it does not prove the point is - // on-curve or that T matches X*Y/Z. - constructor(X, Y, Z, T) { - const max = B256; - this.X = assertRange(X, 0n, max); - this.Y = assertRange(Y, 0n, max); - this.Z = assertRange(Z, 1n, max); - this.T = assertRange(T, 0n, max); - Object.freeze(this); - } - static CURVE() { - return ed25519_CURVE; - } - static fromAffine(p) { - return new Point(p.x, p.y, 1n, modP(p.x * p.y)); - } - /** RFC8032 5.1.3: Bytes to Point. */ - static fromBytes(hex, zip215 = false) { - const d = _d; - // Copy array to not mess it up. - const normed = u8fr(abytes(hex, L)); - // adjust first LE byte = last BE byte - const lastByte = hex[31]; - normed[31] = lastByte & ~0x80; - const y = bytesToNumberLE(normed); - // After clearing the sign bit, parsed `y` is always < 2^255. ZIP-215 still accepts the full - // post-mask range here, while strict RFC8032 decoding further requires `y < p`. - const max = zip215 ? B256 : P; - assertRange(y, 0n, max); - const y2 = modP(y * y); // y² - const u = M(y2 - 1n); // u=y²-1 - const v = modP(d * y2 + 1n); // v=dy²+1 - let { isValid, value: x } = uvRatio(u, v); // (uv³)(uv⁷)^(p-5)/8; square root - if (!isValid) - err('bad point: y not sqrt'); // not square root: bad point - const isXOdd = (x & 1n) === 1n; // adjust sign of x coordinate - const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit - // ZIP-215-compatible decoding keeps the x=0 / sign-bit=1 encoding accepted; strict RFC 8032 - // rejects it, but the vendored ZIP-215 compliance vectors include this form in A/R bytes. - if (!zip215 && x === 0n && isLastByteOdd) - err('bad point: x==0, isLastByteOdd'); // x=0, x_0=1 - if (isLastByteOdd !== isXOdd) - x = M(-x); - return new Point(x, y, 1n, modP(x * y)); // Z=1, T=xy - } - static fromHex(hex, zip215) { - return Point.fromBytes(hexToBytes(hex), zip215); - } - get x() { - return this.toAffine().x; - } - get y() { - return this.toAffine().y; - } - /** Checks if the point is valid and on-curve. */ - assertValidity() { - const a = _a; - const d = _d; - const p = this; - // Intentional stricter-than-on-curve policy: reject ZERO by default because many protocols - // require a non-zero point, and silently accepting identity points is a common caller mistake. - if (p.is0()) - return err('bad point: ZERO'); // TODO: optimize, with vars below? - // Equation in affine coordinates: ax² + y² = 1 + dx²y² - // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y² - const { X, Y, Z, T } = p; - const X2 = modP(X * X); // X² - const Y2 = modP(Y * Y); // Y² - const Z2 = modP(Z * Z); // Z² - const Z4 = modP(Z2 * Z2); // Z⁴ - const aX2 = modP(X2 * a); // aX² - const left = modP(Z2 * (aX2 + Y2)); // (aX² + Y²)Z² - const right = M(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y² - if (left !== right) - return err('bad point: equation left != right (1)'); - // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T - const XY = modP(X * Y); - const ZT = modP(Z * T); - if (XY !== ZT) - return err('bad point: equation left != right (2)'); - return this; - } - /** Equality check: compare points P&Q. */ - equals(other) { - const { X: X1, Y: Y1, Z: Z1 } = this; - const { X: X2, Y: Y2, Z: Z2 } = apoint(other); // checks class equality - const X1Z2 = modP(X1 * Z2); - const X2Z1 = modP(X2 * Z1); - const Y1Z2 = modP(Y1 * Z2); - const Y2Z1 = modP(Y2 * Z1); - return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; - } - is0() { - return this.equals(I); - } - /** Flip point over y coordinate. */ - negate() { - return new Point(M(-this.X), this.Y, this.Z, M(-this.T)); - } - /** Point doubling. Complete formula. Cost: `4M + 4S + 1*a + 6add + 1*2`. */ - double() { - const { X: X1, Y: Y1, Z: Z1 } = this; - const a = _a; - // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd - const A = modP(X1 * X1); - const B = modP(Y1 * Y1); - const C = modP(2n * Z1 * Z1); - const D = modP(a * A); - const x1y1 = M(X1 + Y1); - const E = M(modP(x1y1 * x1y1) - A - B); - const G = M(D + B); - const F = M(G - C); - const H = M(D - B); - const X3 = modP(E * F); - const Y3 = modP(G * H); - const T3 = modP(E * H); - const Z3 = modP(F * G); - return new Point(X3, Y3, Z3, T3); - } - /** Point addition. Complete formula. Cost: `8M + 1*k + 8add + 1*2`. */ - add(other) { - const { X: X1, Y: Y1, Z: Z1, T: T1 } = this; - const { X: X2, Y: Y2, Z: Z2, T: T2 } = apoint(other); // doesn't check if other on-curve - const a = _a; - const d = _d; - // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3 - const A = modP(X1 * X2); - const B = modP(Y1 * Y2); - const C = modP(modP(T1 * d) * T2); - const D = modP(Z1 * Z2); - const E = M(modP(M(X1 + Y1) * M(X2 + Y2)) - A - B); - const F = M(D - C); - const G = M(D + C); - const H = M(B - modP(a * A)); - const X3 = modP(E * F); - const Y3 = modP(G * H); - const T3 = modP(E * H); - const Z3 = modP(F * G); - return new Point(X3, Y3, Z3, T3); - } - subtract(other) { - return this.add(apoint(other).negate()); - } - /** - * Point-by-scalar multiplication. Safe mode requires `1 <= n < CURVE.n`. - * Unsafe mode additionally permits `n = 0` and returns the identity point for that case. - * Uses {@link wNAF} for base point. - * Uses fake point to mitigate side-channel leakage. - * @param n - scalar by which point is multiplied - * @param safe - safe mode guards against timing attacks; unsafe mode is faster - */ - multiply(n, safe = true) { - // Mirror noble-curves: unsafe mode still validates scalar range first, but intentionally keeps - // `n = 0` as the one extra accepted case used by verification-style callers. - if (!safe && n === 0n) - return I; - assertRange(n, 1n, N); - if (!safe && this.is0()) - return I; - if (n === 1n) - return this; - if (this.equals(G)) - return wNAF(n).p; - // init result point & fake point - let p = I; - let f = G; - for (let d = this; n > 0n; d = d.double(), n >>= 1n) { - // if bit is present, add to point - // if not present, add to fake, for timing safety - if (n & 1n) - p = p.add(d); - else if (safe) - f = f.add(d); - } - return p; - } - multiplyUnsafe(scalar) { - return this.multiply(scalar, false); - } - /** Convert point to 2d xy affine point. (X, Y, Z) ∋ (x=X/Z, y=Y/Z) */ - toAffine() { - const { X, Y, Z } = this; - // Fast-path only for the identity point; all other inputs still go through inversion. - if (this.equals(I)) - return { x: 0n, y: 1n }; - const iz = invert(Z, P); - // (Z * Z^-1) must be 1, otherwise bad math - if (modP(Z * iz) !== 1n) - err('invalid inverse'); - // x = X*Z^-1; y = Y*Z^-1 - const x = modP(X * iz); - const y = modP(Y * iz); - return { x, y }; - } - toBytes() { - const { x, y } = this.toAffine(); - const b = numTo32bLE(y); - // store sign in first LE byte - b[31] |= x & 1n ? 0x80 : 0; - return b; - } - toHex() { - return bytesToHex(this.toBytes()); - } - clearCofactor() { - return this.multiply(big(h), false); - } - isSmallOrder() { - return this.clearCofactor().is0(); - } - isTorsionFree() { - // Multiply by big number N. We can't `mul(N)` because of checks. Instead, we `mul(N/2)*2+1` - let p = this.multiply(N / 2n, false).double(); - if (N % 2n) - p = p.add(this); - return p.is0(); - } -} -/** Generator / base point */ -const G = new Point(Gx, Gy, 1n, M(Gx * Gy)); -/** Identity / zero point */ -const I = new Point(0n, 1n, 1n, 0n); -// Static aliases -Point.BASE = G; -Point.ZERO = I; -const numTo32bLE = (num) => hexToBytes(padh(assertRange(num, 0n, B256), 64)).reverse(); -// Caller-enforced width: some sites require 32-byte RFC encodings, while others intentionally feed -// wider SHA-512 output chunks through the same little-endian parser. -const bytesToNumberLE = (b) => big('0x' + bytesToHex(u8fr(abytes(b)).reverse())); -const pow2 = (x, power) => { - // pow2(x, 4) == x^(2^4) - // Negative `power` values are not rejected here and currently leave `x` unchanged. - let r = x; - while (power-- > 0n) { - r = modP(r * r); - } - return r; -}; -// prettier-ignore -const pow_2_252_3 = (x) => { - const x2 = modP(x * x); // x^2, bits 1 - const b2 = modP(x2 * x); // x^3, bits 11 - const b4 = modP(pow2(b2, 2n) * b2); // x^(2^4-1), bits 1111 - const b5 = modP(pow2(b4, 1n) * x); // x^(2^5-1), bits 11111 - const b10 = modP(pow2(b5, 5n) * b5); // x^(2^10-1) - const b20 = modP(pow2(b10, 10n) * b10); // x^(2^20-1) - const b40 = modP(pow2(b20, 20n) * b20); // x^(2^40-1) - const b80 = modP(pow2(b40, 40n) * b40); // x^(2^80-1) - const b160 = modP(pow2(b80, 80n) * b80); // x^(2^160-1) - const b240 = modP(pow2(b160, 80n) * b80); // x^(2^240-1) - const b250 = modP(pow2(b240, 10n) * b10); // x^(2^250-1) - const pow_p_5_8 = modP(pow2(b250, 2n) * x); // x^((p-5)/8), used by RFC8032 point decode - return { pow_p_5_8, b2 }; -}; -const RM1 = 0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n; // 2^((p-1)/4) = sqrt(-1) -// RFC8032 §5.1.3 square-root helper for point decompression. `value` is only meaningful when -// `isValid` is true; callers are also expected to pass canonical field elements with non-zero `v`. -// prettier-ignore -const uvRatio = (u, v) => { - const v3 = modP(v * modP(v * v)); // v³ - const v7 = modP(modP(v3 * v3) * v); // v⁷ - const pow = pow_2_252_3(modP(u * v7)).pow_p_5_8; // (uv⁷)^(p-5)/8 - let x = modP(u * modP(v3 * pow)); // (uv³)(uv⁷)^(p-5)/8 - const vx2 = modP(v * modP(x * x)); // vx² - const root1 = x; // First root candidate - const root2 = modP(x * RM1); // Second root candidate; RM1 is √-1 - const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root - const useRoot2 = vx2 === M(-u); // If vx² = -u, set x <-- x * 2^((p-1)/4) - const noRoot = vx2 === M(-u * RM1); // There is no valid root, vx² = -u√-1 - if (useRoot1) - x = root1; - if (useRoot2 || noRoot) - x = root2; // We return root2 anyway, for const-time - if ((M(x) & 1n) === 1n) - x = M(-x); // edIsNegative - return { isValid: useRoot1 || useRoot2, value: x }; -}; -// Implementation `N` is the subgroup order; `L` is only the shared 32-byte encoded width constant. -// Reduce any little-endian byte string modulo the subgroup order; the `hash` name reflects the -// common caller shape, not an input restriction. -const modL_LE = (hash) => modN(bytesToNumberLE(hash)); // modulo L; but little-endian -// Both sync and async SHA-512 slots are exported/configurable; use `callHash(...)` for both so -// missing async overrides fail explicitly, then validate the returned digest type/length. -const sha512a = (...m) => Promise.resolve(callHash('sha512Async')(concatBytes(...m))).then(checkDigest); -const sha512s = (...m) => checkDigest(callHash('sha512')(concatBytes(...m))); -// RFC8032 5.1.5. Split the 64-byte hashed seed into the clamped scalar half and nonce prefix. -const hash2extK = (hashed) => { - // slice creates a copy, unlike subarray - const copy = u8fr(hashed); - const head = copy.slice(0, 32); - head[0] &= 248; // Clamp bits: 0b1111_1000 - head[31] &= 127; // 0b0111_1111 - head[31] |= 64; // 0b0100_0000 - const prefix = copy.slice(32, 64); // secret key "prefix" - // RFC words this as `[s]B`; reducing the clamped little-endian scalar modulo `N` is equivalent - // for base-point multiplication because `G` already has subgroup order `N`. - const scalar = modL_LE(head); - const point = G.multiply(scalar); // public key point - const pointBytes = point.toBytes(); // point serialized to Uint8Array - return { head, prefix, scalar, point, pointBytes }; -}; -// RFC8032 5.1.5; getPublicKey async, sync. Hash priv key and extract point. -const getExtendedPublicKeyAsync = (secretKey) => sha512a(abytes(secretKey, L)).then(hash2extK); -const getExtendedPublicKey = (secretKey) => hash2extK(sha512s(abytes(secretKey, L))); -/** - * Creates a 32-byte Ed25519 public key from the RFC 8032 32-byte secret-key seed. Async. - * @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 32-byte public key. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Derive the public key bytes for a newly generated signer secret. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const publicKey = await ed.getPublicKeyAsync(secretKey); - * ``` - */ -const getPublicKeyAsync = (secretKey) => getExtendedPublicKeyAsync(secretKey).then((p) => p.pointBytes); -/** - * Creates a 32-byte Ed25519 public key from the RFC 8032 32-byte secret-key seed. - * To use, set `hashes.sha512` first. - * @param priv - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 32-byte public key. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Derive the public key entirely through the synchronous API. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const secretKey = ed.utils.randomSecretKey(); - * const publicKey = ed.getPublicKey(secretKey); - * ``` - */ -const getPublicKey = (priv) => getExtendedPublicKey(priv).pointBytes; -const hashFinishA = (res) => sha512a(res.hashable).then(res.finish); -const hashFinishS = (res) => res.finish(sha512s(res.hashable)); -// Code, shared between sync & async sign -const _sign = (e, rBytes, msg) => { - const { pointBytes: P, scalar: s } = e; - const r = modL_LE(rBytes); // r was created outside, reduce it modulo L - // RFC 8032 5.1.6 allows r mod L = 0, and SUPERCOP ref10 accepts the resulting identity-point - // signature. - // We intentionally keep the safe multiply() rejection here so a miswired all-zero SHA-512 provider - // fails loudly instead of silently producing a degenerate signature. - const R = G.multiply(r).toBytes(); // R = [r]B - const hashable = concatBytes(R, P, msg); // dom2(F, C) || R || A || PH(M) - const finish = (hashed) => { - // k = SHA512(dom2(F, C) || R || A || PH(M)) - const S = modN(r + modL_LE(hashed) * s); // S = (r + k * s) mod L; 0 <= s < l - return abytes(concatBytes(R, numTo32bLE(S)), 64); // 64-byte sig: 32-byte encoded R point || 32-byte LE(S) - }; - return { hashable, finish }; -}; -/** - * Signs message using secret key. Async. - * Follows RFC8032 5.1.6. - * @param message - Message bytes to sign. - * @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 64-byte Ed25519 signature. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Sign an arbitrary message with a fresh Ed25519 secret key. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const message = new Uint8Array([1, 2, 3]); - * const signature = await ed.signAsync(message, secretKey); - * ``` - */ -const signAsync = async (message, secretKey) => { - const m = abytes(message); - const e = await getExtendedPublicKeyAsync(secretKey); - const rBytes = await sha512a(e.prefix, m); // r = SHA512(dom2(F, C) || prefix || PH(M)) - return hashFinishA(_sign(e, rBytes, m)); // gen R, k, S, then 64-byte signature -}; -/** - * Signs message using secret key. To use, set `hashes.sha512` first. - * Follows RFC8032 5.1.6. - * @param message - Message bytes to sign. - * @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 64-byte Ed25519 signature. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Use the sync API when you've wired a SHA-512 implementation yourself. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const secretKey = ed.utils.randomSecretKey(); - * const signature = ed.sign(new Uint8Array([1, 2, 3]), secretKey); - * ``` - */ -const sign = (message, secretKey) => { - const m = abytes(message); - const e = getExtendedPublicKey(secretKey); - const rBytes = sha512s(e.prefix, m); // r = SHA512(dom2(F, C) || prefix || PH(M)) - return hashFinishS(_sign(e, rBytes, m)); // gen R, k, S, then 64-byte signature -}; -// Exported defaults favor ZIP-215 interoperability semantics; callers must opt into the stricter -// branch with `{ zip215: false }`. -const defaultVerifyOpts = { zip215: true }; -const _verify = (sig, msg, publicKey, options = defaultVerifyOpts) => { - sig = abytes(sig, 64); // Signature hex str/Bytes, must be 64 bytes - msg = abytes(msg); // Message hex str/Bytes - publicKey = abytes(publicKey, L); - // zip215=false keeps the library's stricter branch, which still canonicalizes `R` / `A` before - // hashing and rejects small-order public keys earlier than pure RFC8032 text would require. - // Preserve the exported ZIP-215 default for `{}` / `{ zip215: undefined }`, not just omitted opts. - const { zip215 = true } = options; - const r = sig.subarray(0, L); - const s = bytesToNumberLE(sig.subarray(L, L * 2)); // Decode second half as an integer S; - let A, R, SB; - let hashable = Uint8Array.of(); - let finished = false; - try { - // zip215=true is good for consensus-critical apps. =false follows RFC8032 / NIST186-5. - // zip215=true: 0 <= y < MASK (2^256 for ed25519) - // zip215=false: 0 <= y < P (2^255-19 for ed25519) - A = Point.fromBytes(publicKey, zip215); - R = Point.fromBytes(r, zip215); - SB = G.multiply(s, false); // 0 <= s < l is done inside - // ZIP-215 accepts noncanonical / unreduced point encodings, so the challenge hash must use the - // exact signature/public-key bytes rather than canonicalized re-encodings of the decoded points. - hashable = concatBytes(r, publicKey, msg); // dom2(F, C) || R || A || PH(M) - finished = true; - } - catch (error) { } - const finish = (hashed) => { - if (!finished) - return false; - // Policy: strict mode intentionally rejects all small-order public keys, even though the raw RFC - // equation text is looser here. This matches libsodium and avoids weak / ambiguous verification - // outcomes where unusual low-order public keys can make distinct key/signature combinations verify. - if (!zip215 && A.isSmallOrder()) - return false; - // k = SHA512(dom2(F, C) || R || A || PH(M)) - const k = modL_LE(hashed); - const RkA = R.add(A.multiply(k, false)); - // Extended group equation - // [8][S]B = [8]R + [8][k]A' - return RkA.subtract(SB).clearCofactor().is0(); - }; - return { hashable, finish }; -}; -/** - * Verifies a signature on message and public key. Async. - * The implementation is based on RFC8032 5.1.7, but default opts use ZIP-215 semantics; pass - * `{ zip215: false }` for the library's stricter branch. - * @param signature - 64-byte signature. - * @param message - Signed message bytes. - * @param publicKey - 32-byte public key. - * @param opts - Verification options. Defaults to ZIP-215 semantics. See {@link EdDSAVerifyOpts}. - * @returns `true` when the signature is valid. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Verify the signature against the same message and derived public key. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const message = new Uint8Array([1, 2, 3]); - * const publicKey = await ed.getPublicKeyAsync(secretKey); - * const signature = await ed.signAsync(message, secretKey); - * const isValid = await ed.verifyAsync(signature, message, publicKey); - * ``` - */ -const verifyAsync = async (signature, message, publicKey, opts = defaultVerifyOpts) => hashFinishA(_verify(signature, message, publicKey, opts)); -/** - * Verifies a signature on message and public key using the synchronous hash path. - * The implementation is based on RFC8032 5.1.7, but default opts use ZIP-215 semantics; pass - * `{ zip215: false }` for the library's stricter branch. - * @param signature - 64-byte signature. - * @param message - Signed message bytes. - * @param publicKey - 32-byte public key. - * @param opts - Verification options. Defaults to ZIP-215 semantics. See {@link EdDSAVerifyOpts}. - * @returns `true` when the signature is valid. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Verify a signature entirely through the synchronous API. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const secretKey = ed.utils.randomSecretKey(); - * const message = new Uint8Array([1, 2, 3]); - * const publicKey = ed.getPublicKey(secretKey); - * const signature = ed.sign(message, secretKey); - * const isValid = ed.verify(signature, message, publicKey); - * ``` - */ -const verify = (signature, message, publicKey, opts = defaultVerifyOpts) => hashFinishS(_verify(signature, message, publicKey, opts)); -/** - * Math, hex, byte helpers. Not in `utils` because utils share API with noble-curves. - * Exposes the same low-level field-default `mod` reducer and non-CT `invert` helper used - * internally. - * @example - * Convert bytes to a hex string with the low-level helper namespace. - * - * ```ts - * const hex = etc.bytesToHex(new Uint8Array([1, 2, 3])); - * ``` - */ -const etc = /* @__PURE__ */ Object.freeze({ - bytesToHex, - hexToBytes, - concatBytes, - mod: M, - invert: invert, - randomBytes, -}); -/** - * Hash implementations used by the synchronous API plus the default async WebCrypto provider. - * Both slots are configurable API surface; wrapper helpers revalidate that providers still return - * 64-byte SHA-512 digests. - * @example - * Provide a SHA-512 implementation before calling synchronous helpers. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const { publicKey } = ed.keygen(); - * ``` - */ -const hashes = { - sha512Async: async (message) => { - const s = subtle(); - const m = concatBytes(message); - return u8n(await s.digest('SHA-512', m.buffer)); - }, - sha512: undefined, -}; -// Returns the final 32-byte Ed25519 secret-key seed verbatim, generating fresh random bytes only -// when omitted. -const randomSecretKey = (seed) => { - seed = seed === undefined ? randomBytes(L) : seed; - return abytes(seed, L); -}; -/** - * Generates a secret/public keypair. - * @param seed - Optional 32-byte Ed25519 secret-key seed, returned verbatim as `secretKey`. - * @returns Keypair with `secretKey` and `publicKey`. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Generate a new keypair through the synchronous API after wiring SHA-512. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const { secretKey, publicKey } = ed.keygen(); - * ``` - */ -const keygen = (seed) => { - const secretKey = randomSecretKey(seed); - const publicKey = getPublicKey(secretKey); - return { secretKey, publicKey }; -}; -/** - * Generates a secret/public keypair asynchronously. - * @param seed - Optional 32-byte Ed25519 secret-key seed, returned verbatim as `secretKey`. - * @returns Keypair with `secretKey` and `publicKey`. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Generate a new keypair through the asynchronous WebCrypto-backed path. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const { secretKey, publicKey } = await ed.keygenAsync(); - * ``` - */ -const keygenAsync = async (seed) => { - const secretKey = randomSecretKey(seed); - const publicKey = await getPublicKeyAsync(secretKey); - return { secretKey, publicKey }; -}; -/** - * Ed25519-specific key utilities. - * `utils.getExtendedPublicKey*` expose secret-derived internals (`head`, `prefix`, `scalar`, and - * point objects), not just public-key bytes. - * @example - * Generate a new Ed25519 secret key and derive the matching public key. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const publicKey = await ed.getPublicKeyAsync(secretKey); - * ``` - */ -const utils = /* @__PURE__ */ Object.freeze({ - getExtendedPublicKeyAsync: getExtendedPublicKeyAsync, - getExtendedPublicKey: getExtendedPublicKey, - randomSecretKey: randomSecretKey, -}); -// ## Precomputes -// -------------- -const W = 8; // W is window size -const scalarBits = 256; -const pwindows = Math.ceil(scalarBits / W) + 1; // 33 for W=8, NOT 32 - see wNAF loop -const pwindowSize = 2 ** (W - 1); // 128 for W=8 -// Layout is grouped by window: each block stores the positive multiples `1*base .. 128*base` for -// that window, and the extra `+1` window in `pwindows` absorbs carries from signed-digit recoding. -const precompute = () => { - const points = []; - let p = G; - let b = p; - for (let w = 0; w < pwindows; w++) { - b = p; - points.push(b); - for (let i = 1; i < pwindowSize; i++) { - b = b.add(p); - points.push(b); - } // i=1, bc we skip 0 - p = b.double(); - } - return points; -}; -let Gpows = undefined; // shared process-wide cache of base-point precomputes -// Branch-based negate helper used for JS/JIT mitigation symmetry, not a strict constant-time claim. -const ctneg = (cnd, p) => { - const n = p.negate(); - return cnd ? n : p; -}; -/** - * Precomputes give 12x faster getPublicKey(), 10x sign(), 2x verify() by - * caching multiples of G (base point). Cache is stored in 32MB of RAM. - * Any time `G.multiply` is done, precomputes are used. - * Not used for getSharedSecret, which instead multiplies random pubkey `P.multiply`. - * - * w-ary non-adjacent form (wNAF) precomputation method is 10% slower than windowed method, - * but takes 2x less RAM. RAM reduction is possible by utilizing `.subtract`. - * Returns the real accumulator `p` plus a fake accumulator `f`; callers only care about `p`, while - * `f` exists to keep similar work in zero-digit branches as a JS/JIT side-channel mitigation. - * - * !! Precomputes can be disabled by commenting-out call of the wNAF() inside Point#multiply(). - */ -const wNAF = (n) => { - const comp = Gpows || (Gpows = precompute()); - let p = I; - let f = G; // f must be G, or could become I in the end - const pow_2_w = 2 ** W; // 256 for W=8 - const maxNum = pow_2_w; // 256 for W=8 - const mask = big(pow_2_w - 1); // 255 for W=8 == mask 0b11111111 - const shiftBy = big(W); // 8 for W=8 - for (let w = 0; w < pwindows; w++) { - let wbits = Number(n & mask); // extract W bits. - n >>= shiftBy; // shift number by W bits. - // We use negative indexes to reduce size of precomputed table by 2x. - // Instead of needing precomputes 0..256, we only calculate them for 0..128. - // If an index > 128 is found, we do (256-index) - where 256 is next window. - // Naive: index +127 => 127, +224 => 224 - // Optimized: index +127 => 127, +224 => 256-32 - if (wbits > pwindowSize) { - wbits -= maxNum; - n += 1n; - } - const off = w * pwindowSize; - const offF = off; // offsets, evaluate both - const offP = off + Math.abs(wbits) - 1; - const isEven = w % 2 !== 0; // conditions, evaluate both - const isNeg = wbits < 0; - if (wbits === 0) { - // off == I: can't add it. Adding random offF instead. - f = f.add(ctneg(isEven, comp[offF])); // bits are 0: add garbage to fake point - } - else { - p = p.add(ctneg(isNeg, comp[offP])); // bits are 1: add to result point - } - } - if (n !== 0n) - err('invalid wnaf'); - return { p, f }; // callers only need `p`; `f` is kept for zero-digit mitigation symmetry -}; -// !! Remove the export to easily use in REPL / browser console -export { etc, getPublicKey, getPublicKeyAsync, hash, hashes, keygen, keygenAsync, Point, sign, signAsync, utils, verify, verifyAsync }; diff --git a/node_modules/@noble/ed25519/index.ts b/node_modules/@noble/ed25519/index.ts deleted file mode 100644 index a7b986c..0000000 --- a/node_modules/@noble/ed25519/index.ts +++ /dev/null @@ -1,1142 +0,0 @@ -/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */ -/** - * 5KB JS implementation of ed25519 EdDSA signatures. - * Targets RFC8032, FIPS 186-5, and ZIP215 behavior. - * @module - * @example - * ```js -import * as ed from '@noble/ed25519'; -(async () => { - const secretKey = ed.utils.randomSecretKey(); - const message = Uint8Array.from([0xab, 0xbc, 0xcd, 0xde]); - const pubKey = await ed.getPublicKeyAsync(secretKey); // Sync methods are also present - const signature = await ed.signAsync(message, secretKey); - const isValid = await ed.verifyAsync(signature, message, pubKey); -})(); -``` - */ -/** - * Curve params. edwards25519 uses the RFC equation `-x² + y² = 1 + dx²y²`. - * The stored `a` literal below is `p - 1`, i.e. the field-element encoding of RFC `a = -1`. - * * P = `2n**255n - 19n` // field over which calculations are done - * * N = `2n**252n + 27742317777372353535851937790883648493n` // prime-order subgroup order - * * h = 8 // cofactor - * * a = `Fp.create(BigInt(-1))` // equation param, stored here as `p - 1` - * * d = -121665/121666 a.k.a. `Fp.neg(121665 * Fp.inv(121666))` // equation param - * * Gx, Gy are coordinates of Generator / base point - * - * Mirror noble-curves: Point.CURVE() exposes shared params, but callers must not be able to mutate - * that shared view and desynchronize it from the arithmetic constants captured below. - */ -const ed25519_CURVE: EdwardsOpts = Object.freeze({ - p: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn, - n: 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn, - h: 8n, - a: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn, - d: 0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n, - Gx: 0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an, - Gy: 0x6666666666666666666666666666666666666666666666666666666666666658n, -}); -const { p: P, n: N, Gx, Gy, a: _a, d: _d, h } = ed25519_CURVE; -const L = 32; // shared 32-byte encoded width for Ed25519 points, scalars, signatures, and keys -/** Alias to Uint8Array. */ -export type Bytes = Uint8Array; -/** - * Bytes API type helpers for old + new TypeScript. - * - * TS 5.6 has `Uint8Array`, while TS 5.9+ made it generic `Uint8Array`. - * We can't use specific return type, because TS 5.6 will error. - * We can't use generic return type, because most TS 5.9 software will expect specific type. - * - * Maps typed-array input leaves to broad forms. - * These are compatibility adapters, not ownership guarantees. - * - * - `TArg` keeps byte inputs broad. - * - `TRet` marks byte outputs for TS 5.6 and TS 5.9+ compatibility. - */ -export type TypedArg = T extends BigInt64Array - ? BigInt64Array - : T extends BigUint64Array - ? BigUint64Array - : T extends Float32Array - ? Float32Array - : T extends Float64Array - ? Float64Array - : T extends Int16Array - ? Int16Array - : T extends Int32Array - ? Int32Array - : T extends Int8Array - ? Int8Array - : T extends Uint16Array - ? Uint16Array - : T extends Uint32Array - ? Uint32Array - : T extends Uint8ClampedArray - ? Uint8ClampedArray - : T extends Uint8Array - ? Uint8Array - : never; -/** Maps typed-array output leaves to narrow TS-compatible forms. */ -export type TypedRet = T extends BigInt64Array - ? ReturnType - : T extends BigUint64Array - ? ReturnType - : T extends Float32Array - ? ReturnType - : T extends Float64Array - ? ReturnType - : T extends Int16Array - ? ReturnType - : T extends Int32Array - ? ReturnType - : T extends Int8Array - ? ReturnType - : T extends Uint16Array - ? ReturnType - : T extends Uint32Array - ? ReturnType - : T extends Uint8ClampedArray - ? ReturnType - : T extends Uint8Array - ? ReturnType - : never; -/** Recursively adapts byte-carrying API input types. See {@link TypedArg}. */ -export type TArg = - | T - | ([TypedArg] extends [never] - ? T extends (...args: infer A) => infer R - ? ((...args: { [K in keyof A]: TRet }) => TArg) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TArg; - } - : T extends [infer A, ...infer R] - ? [TArg, ...{ [K in keyof R]: TArg }] - : T extends readonly [infer A, ...infer R] - ? readonly [TArg, ...{ [K in keyof R]: TArg }] - : T extends (infer A)[] - ? TArg[] - : T extends readonly (infer A)[] - ? readonly TArg[] - : T extends Promise - ? Promise> - : T extends object - ? { [K in keyof T]: TArg } - : T - : TypedArg); -/** Recursively adapts byte-carrying API output types. See {@link TypedArg}. */ -export type TRet = T extends unknown - ? T & - ([TypedRet] extends [never] - ? T extends (...args: infer A) => infer R - ? ((...args: { [K in keyof A]: TArg }) => TRet) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TRet; - } - : T extends [infer A, ...infer R] - ? [TRet, ...{ [K in keyof R]: TRet }] - : T extends readonly [infer A, ...infer R] - ? readonly [TRet, ...{ [K in keyof R]: TRet }] - : T extends (infer A)[] - ? TRet[] - : T extends readonly (infer A)[] - ? readonly TRet[] - : T extends Promise - ? Promise> - : T extends object - ? { [K in keyof T]: TRet } - : T - : TypedRet) - : never; -/** Edwards elliptic curve options. */ -export type EdwardsOpts = Readonly<{ - /** Prime field modulus. */ - p: bigint; - /** Group order. */ - n: bigint; - /** Curve cofactor. */ - h: bigint; - /** Edwards curve parameter `a`. */ - a: bigint; - /** Edwards curve parameter `d`. */ - d: bigint; - /** Generator x coordinate. */ - Gx: bigint; - /** Generator y coordinate. */ - Gy: bigint; -}>; - -// Helpers and Precomputes sections are reused between libraries - -// ## Helpers -// ---------- -// @ts-ignore -const captureTrace = (...args: Parameters): void => { - if ('captureStackTrace' in Error && typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(...args); - } -}; -const err = (message = ''): never => { - const e = new Error(message); - captureTrace(e, err); - throw e; -}; -const isBig = (n: unknown): n is bigint => typeof n === 'bigint'; // is big integer -const isStr = (s: unknown): s is string => typeof s === 'string'; // is string -// Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases. The -// fallback still requires a real ArrayBuffer view so plain JSON-deserialized `{ constructor: ... }` -// spoofing is rejected, and `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views. -const isBytes = (a: unknown): a is Bytes => - a instanceof Uint8Array || - (ArrayBuffer.isView(a) && - a.constructor.name === 'Uint8Array' && - 'BYTES_PER_ELEMENT' in a && - a.BYTES_PER_ELEMENT === 1); -/** - * Asserts something is Bytes, optionally enforces exact length, - * and returns the same reference. - */ -const abytes = (value: TArg, length?: number, title: string = ''): TRet => { - const bytes = isBytes(value); - const len = value?.length; - const needsLen = length !== undefined; - if (!bytes || (needsLen && len !== length)) { - const prefix = title && `"${title}" `; - const ofLen = needsLen ? ` of length ${length}` : ''; - const got = bytes ? `length=${len}` : `type=${typeof value}`; - const msg = prefix + 'expected Uint8Array' + ofLen + ', got ' + got; - throw bytes ? new RangeError(msg) : new TypeError(msg); - } - return value as TRet; -}; -/** create Uint8Array */ -const u8n = (len: number): TRet => new Uint8Array(len) as TRet; -// Clone helper used before in-place byte edits such as sign-bit clearing or endian reversal. -const u8fr = (buf: ArrayLike): TRet => Uint8Array.from(buf) as TRet; -// Left-pad hex to a caller-chosen width. Width enforcement/truncation policy stays with callers. -const padh = (n: number | bigint, pad: number) => n.toString(16).padStart(pad, '0'); -// Lowercase hex serializer. -const bytesToHex = (b: TArg): string => - Array.from(abytes(b)) - .map((e) => padh(e, 2)) - .join(''); -const C = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 } as const; // ASCII characters -const _ch = (ch: number): number | undefined => { - if (ch >= C._0 && ch <= C._9) return ch - C._0; // '2' => 50-48 - if (ch >= C.A && ch <= C.F) return ch - (C.A - 10); // 'B' => 66-(65-10) - if (ch >= C.a && ch <= C.f) return ch - (C.a - 10); // 'b' => 98-(97-10) - return; -}; -// Accepts both uppercase and lowercase hex; all parse failures intentionally collapse to `hex invalid`. -const hexToBytes = (hex: string): TRet => { - const e = 'hex invalid'; - if (!isStr(hex)) return err(e); - const hl = hex.length; - const al = hl / 2; - if (hl % 2) return err(e); - const array = u8n(al); - for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { - // treat each char as ASCII - const n1 = _ch(hex.charCodeAt(hi)); // parse first char, multiply it by 16 - const n2 = _ch(hex.charCodeAt(hi + 1)); // parse second char - if (n1 === undefined || n2 === undefined) return err(e); - array[ai] = n1 * 16 + n2; // example: 'A9' => 10*16 + 9 - } - return array; -}; -declare const globalThis: Record | undefined; // Typescript symbol present in browsers -const cr = () => globalThis?.crypto; // Optional WebCrypto lookup; sync code still handles absence. -// Async-path capability helper for WebCrypto-backed APIs. -const subtle = () => cr()?.subtle ?? err('crypto.subtle must be defined, consider polyfill'); -// prettier-ignore -const concatBytes = (...arrs: TArg): TRet => { - // Argument order is transcript-significant for hash/signature callers, and input validation here - // intentionally reuses `abytes(...)` without making defensive copies of the source chunks. - let len = 0; - for (const a of arrs) len += abytes(a).length; - const r = u8n(len); // create u8a of summed length - let pad = 0; // walk through each array, - arrs.forEach(a => { r.set(a, pad); pad += a.length; }); // ensure they have proper type - return r as TRet; -}; -/** WebCrypto OS-level CSPRNG (random number generator). Absence still fails later via `cr()`. */ -const randomBytes = (len: number = L): TRet => { - const c = cr(); - return c.getRandomValues(u8n(len)) as TRet; -}; -const big = BigInt; -/** Inclusive-lower, exclusive-upper bigint range assertion. */ -const assertRange = ( - n: bigint, - min: bigint, - max: bigint, - msg = 'bad number: out of range' -): bigint => { - if (!isBig(n)) throw new TypeError(msg); - if (min <= n && n < max) return n; - throw new RangeError(msg); -}; -/** Canonical modular reduction into `[0, b)`. */ -const M = (a: bigint, b: bigint = P): bigint => { - const r = a % b; - return r >= 0n ? r : b + r; -}; -// Low-255-bit mask used by the `2^255 - 19` fast reduction in `modP(...)`. -const P_MASK = (1n << 255n) - 1n; -// Fast reduction for the special prime `2^255 - 19`. This path assumes nonnegative inputs; the -// generic fallback would simply be `M(num, P)`. -const modP = (num: bigint): bigint => { - // return M(num, P); - if (num < 0n) err('negative coordinate'); - let r = (num >> 255n) * 19n + (num & P_MASK); - r = (r >> 255n) * 19n + (r & P_MASK); - return r % P; -}; -// Reduce modulo the subgroup order stored in implementation constant `N` (RFC 8032's `L`). -const modN = (a: bigint) => M(a, N); -/** Modular inversion using Euclidean GCD (non-CT) instead of the RFC's `x^(p-2)` formulation. - * This still sits on secret-dependent paths like point normalization during keygen/signing. */ -// prettier-ignore -const invert = (num: bigint, md: bigint): bigint => { - if (num === 0n || md <= 0n) err('no inverse n=' + num + ' mod=' + md); - let a = M(num, md), b = md, x = 0n, y = 1n, u = 1n, v = 0n; - while (a !== 0n) { - const q = b / a, r = b % a; - const m = x - u * q, n = y - v * q; - b = a, a = r, x = u, y = v, u = m, v = n; - } - return b === 1n ? M(x, md) : err('no inverse'); // b is gcd at this point -}; -// Dynamic lookup keeps sync/async hash providers configurable at runtime. Both exported slots are -// caller-owned and may be unset; wrapper helpers use this lookup first and then enforce the digest -// contract instead of trusting provider output. -const callHash = (name: string) => { - // @ts-ignore - const fn = hashes[name]; - if (typeof fn !== 'function') err('hashes.' + name + ' not set'); - return fn; -}; -// Both provider slots are configurable API surface and may return arbitrary values, so callers must -// enforce the promised 64-byte SHA-512 digest contract here instead of trusting provider output. -const checkDigest = (value: TArg): TRet => abytes(value, 64, 'digest'); -/** - * SHA-512 helper used by the synchronous API. - * @param msg - Message bytes to hash. - * @returns 64-byte SHA-512 digest. - * @example - * Hash message bytes after wiring the synchronous SHA-512 implementation. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const digest = ed.hash(new Uint8Array([1, 2, 3])); - * ``` - */ -// Public helper validates the message boundary explicitly; the configured provider is still looked -// up dynamically and its output is checked with `checkDigest(...)`. -const hash = (msg: TArg): TRet => - checkDigest(callHash('sha512')(abytes(msg, undefined, 'message'))); -// Runtime class guard: this is `instanceof Point`, so cross-realm / duplicate-bundle Point objects -// are rejected even if they are structurally identical. -const apoint = (p: unknown) => (p instanceof Point ? p : err('Point expected')); -/** Point in 2d xy affine coordinates. */ -export type AffinePoint = { - /** Affine x coordinate. */ - x: bigint; - /** Affine y coordinate. */ - y: bigint; -}; -// ## End of Helpers -// ----------------- - -// Exclusive upper bound `2^256` used by 32-byte decode/serialization range checks. -const B256 = 2n ** 256n; -/** - * Point in XYZT extended coordinates. - * @param X - X coordinate. - * @param Y - Y coordinate. - * @param Z - Projective Z coordinate. - * @param T - Cached cross-product term. - * @example - * Do point arithmetic with the built-in base point and encode the result as hex. - * - * ```ts - * const hex = Point.BASE.double().toHex(); - * ``` - */ -class Point { - static BASE: Point; - static ZERO: Point; - readonly X: bigint; - readonly Y: bigint; - readonly Z: bigint; - readonly T: bigint; - // Constructor only bounds-checks and freezes XYZT coordinates; it does not prove the point is - // on-curve or that T matches X*Y/Z. - constructor(X: bigint, Y: bigint, Z: bigint, T: bigint) { - const max = B256; - this.X = assertRange(X, 0n, max); - this.Y = assertRange(Y, 0n, max); - this.Z = assertRange(Z, 1n, max); - this.T = assertRange(T, 0n, max); - Object.freeze(this); - } - static CURVE(): EdwardsOpts { - return ed25519_CURVE; - } - static fromAffine(p: AffinePoint): Point { - return new Point(p.x, p.y, 1n, modP(p.x * p.y)); - } - /** RFC8032 5.1.3: Bytes to Point. */ - static fromBytes(hex: TArg, zip215 = false): Point { - const d = _d; - // Copy array to not mess it up. - const normed = u8fr(abytes(hex, L)); - // adjust first LE byte = last BE byte - const lastByte = hex[31]; - normed[31] = lastByte & ~0x80; - const y = bytesToNumberLE(normed); - // After clearing the sign bit, parsed `y` is always < 2^255. ZIP-215 still accepts the full - // post-mask range here, while strict RFC8032 decoding further requires `y < p`. - const max = zip215 ? B256 : P; - assertRange(y, 0n, max); - - const y2 = modP(y * y); // y² - const u = M(y2 - 1n); // u=y²-1 - const v = modP(d * y2 + 1n); // v=dy²+1 - let { isValid, value: x } = uvRatio(u, v); // (uv³)(uv⁷)^(p-5)/8; square root - if (!isValid) err('bad point: y not sqrt'); // not square root: bad point - const isXOdd = (x & 1n) === 1n; // adjust sign of x coordinate - const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit - // ZIP-215-compatible decoding keeps the x=0 / sign-bit=1 encoding accepted; strict RFC 8032 - // rejects it, but the vendored ZIP-215 compliance vectors include this form in A/R bytes. - if (!zip215 && x === 0n && isLastByteOdd) err('bad point: x==0, isLastByteOdd'); // x=0, x_0=1 - if (isLastByteOdd !== isXOdd) x = M(-x); - return new Point(x, y, 1n, modP(x * y)); // Z=1, T=xy - } - static fromHex(hex: string, zip215?: boolean): Point { - return Point.fromBytes(hexToBytes(hex), zip215); - } - get x(): bigint { - return this.toAffine().x; - } - get y(): bigint { - return this.toAffine().y; - } - /** Checks if the point is valid and on-curve. */ - assertValidity(): this { - const a = _a; - const d = _d; - const p = this; - // Intentional stricter-than-on-curve policy: reject ZERO by default because many protocols - // require a non-zero point, and silently accepting identity points is a common caller mistake. - if (p.is0()) return err('bad point: ZERO'); // TODO: optimize, with vars below? - // Equation in affine coordinates: ax² + y² = 1 + dx²y² - // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y² - const { X, Y, Z, T } = p; - const X2 = modP(X * X); // X² - const Y2 = modP(Y * Y); // Y² - const Z2 = modP(Z * Z); // Z² - const Z4 = modP(Z2 * Z2); // Z⁴ - const aX2 = modP(X2 * a); // aX² - const left = modP(Z2 * (aX2 + Y2)); // (aX² + Y²)Z² - const right = M(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y² - if (left !== right) return err('bad point: equation left != right (1)'); - // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T - const XY = modP(X * Y); - const ZT = modP(Z * T); - if (XY !== ZT) return err('bad point: equation left != right (2)'); - return this; - } - /** Equality check: compare points P&Q. */ - equals(other: Point): boolean { - const { X: X1, Y: Y1, Z: Z1 } = this; - const { X: X2, Y: Y2, Z: Z2 } = apoint(other); // checks class equality - const X1Z2 = modP(X1 * Z2); - const X2Z1 = modP(X2 * Z1); - const Y1Z2 = modP(Y1 * Z2); - const Y2Z1 = modP(Y2 * Z1); - return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; - } - is0(): boolean { - return this.equals(I); - } - /** Flip point over y coordinate. */ - negate(): Point { - return new Point(M(-this.X), this.Y, this.Z, M(-this.T)); - } - /** Point doubling. Complete formula. Cost: `4M + 4S + 1*a + 6add + 1*2`. */ - double(): Point { - const { X: X1, Y: Y1, Z: Z1 } = this; - const a = _a; - // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd - const A = modP(X1 * X1); - const B = modP(Y1 * Y1); - const C = modP(2n * Z1 * Z1); - const D = modP(a * A); - const x1y1 = M(X1 + Y1); - const E = M(modP(x1y1 * x1y1) - A - B); - const G = M(D + B); - const F = M(G - C); - const H = M(D - B); - const X3 = modP(E * F); - const Y3 = modP(G * H); - const T3 = modP(E * H); - const Z3 = modP(F * G); - return new Point(X3, Y3, Z3, T3); - } - /** Point addition. Complete formula. Cost: `8M + 1*k + 8add + 1*2`. */ - add(other: Point): Point { - const { X: X1, Y: Y1, Z: Z1, T: T1 } = this; - const { X: X2, Y: Y2, Z: Z2, T: T2 } = apoint(other); // doesn't check if other on-curve - const a = _a; - const d = _d; - // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3 - const A = modP(X1 * X2); - const B = modP(Y1 * Y2); - const C = modP(modP(T1 * d) * T2); - const D = modP(Z1 * Z2); - const E = M(modP(M(X1 + Y1) * M(X2 + Y2)) - A - B); - const F = M(D - C); - const G = M(D + C); - const H = M(B - modP(a * A)); - const X3 = modP(E * F); - const Y3 = modP(G * H); - const T3 = modP(E * H); - const Z3 = modP(F * G); - return new Point(X3, Y3, Z3, T3); - } - subtract(other: Point): Point { - return this.add(apoint(other).negate()); - } - /** - * Point-by-scalar multiplication. Safe mode requires `1 <= n < CURVE.n`. - * Unsafe mode additionally permits `n = 0` and returns the identity point for that case. - * Uses {@link wNAF} for base point. - * Uses fake point to mitigate side-channel leakage. - * @param n - scalar by which point is multiplied - * @param safe - safe mode guards against timing attacks; unsafe mode is faster - */ - multiply(n: bigint, safe = true): Point { - // Mirror noble-curves: unsafe mode still validates scalar range first, but intentionally keeps - // `n = 0` as the one extra accepted case used by verification-style callers. - if (!safe && n === 0n) return I; - assertRange(n, 1n, N); - if (!safe && this.is0()) return I; - if (n === 1n) return this; - if (this.equals(G)) return wNAF(n).p; - // init result point & fake point - let p = I; - let f = G; - for (let d: Point = this; n > 0n; d = d.double(), n >>= 1n) { - // if bit is present, add to point - // if not present, add to fake, for timing safety - if (n & 1n) p = p.add(d); - else if (safe) f = f.add(d); - } - return p; - } - multiplyUnsafe(scalar: bigint): Point { - return this.multiply(scalar, false); - } - /** Convert point to 2d xy affine point. (X, Y, Z) ∋ (x=X/Z, y=Y/Z) */ - toAffine(): AffinePoint { - const { X, Y, Z } = this; - // Fast-path only for the identity point; all other inputs still go through inversion. - if (this.equals(I)) return { x: 0n, y: 1n }; - const iz = invert(Z, P); - // (Z * Z^-1) must be 1, otherwise bad math - if (modP(Z * iz) !== 1n) err('invalid inverse'); - // x = X*Z^-1; y = Y*Z^-1 - const x = modP(X * iz); - const y = modP(Y * iz); - return { x, y }; - } - toBytes(): TRet { - const { x, y } = this.toAffine(); - const b = numTo32bLE(y); - // store sign in first LE byte - b[31] |= x & 1n ? 0x80 : 0; - return b; - } - toHex(): string { - return bytesToHex(this.toBytes()); - } - - clearCofactor(): Point { - return this.multiply(big(h), false); - } - isSmallOrder(): boolean { - return this.clearCofactor().is0(); - } - isTorsionFree(): boolean { - // Multiply by big number N. We can't `mul(N)` because of checks. Instead, we `mul(N/2)*2+1` - let p = this.multiply(N / 2n, false).double(); - if (N % 2n) p = p.add(this); - return p.is0(); - } -} -/** Generator / base point */ -const G: Point = new Point(Gx, Gy, 1n, M(Gx * Gy)); -/** Identity / zero point */ -const I: Point = new Point(0n, 1n, 1n, 0n); -// Static aliases -Point.BASE = G; -Point.ZERO = I; - -const numTo32bLE = (num: bigint): TRet => - hexToBytes(padh(assertRange(num, 0n, B256), 64)).reverse() as TRet; -// Caller-enforced width: some sites require 32-byte RFC encodings, while others intentionally feed -// wider SHA-512 output chunks through the same little-endian parser. -const bytesToNumberLE = (b: TArg): bigint => - big('0x' + bytesToHex(u8fr(abytes(b)).reverse())); - -const pow2 = (x: bigint, power: bigint): bigint => { - // pow2(x, 4) == x^(2^4) - // Negative `power` values are not rejected here and currently leave `x` unchanged. - let r = x; - while (power-- > 0n) { - r = modP(r * r); - } - return r; -}; - -// prettier-ignore -const pow_2_252_3 = (x: bigint) => { // x^(2^252-3) unrolled util for square root - const x2 = modP(x * x); // x^2, bits 1 - const b2 = modP(x2 * x); // x^3, bits 11 - const b4 = modP(pow2(b2, 2n) * b2); // x^(2^4-1), bits 1111 - const b5 = modP(pow2(b4, 1n) * x); // x^(2^5-1), bits 11111 - const b10 = modP(pow2(b5, 5n) * b5); // x^(2^10-1) - const b20 = modP(pow2(b10, 10n) * b10); // x^(2^20-1) - const b40 = modP(pow2(b20, 20n) * b20); // x^(2^40-1) - const b80 = modP(pow2(b40, 40n) * b40); // x^(2^80-1) - const b160 = modP(pow2(b80, 80n) * b80); // x^(2^160-1) - const b240 = modP(pow2(b160, 80n) * b80); // x^(2^240-1) - const b250 = modP(pow2(b240, 10n) * b10); // x^(2^250-1) - const pow_p_5_8 = modP(pow2(b250, 2n) * x); // x^((p-5)/8), used by RFC8032 point decode - return { pow_p_5_8, b2 }; -} -const RM1 = 0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n; // 2^((p-1)/4) = sqrt(-1) -// RFC8032 §5.1.3 square-root helper for point decompression. `value` is only meaningful when -// `isValid` is true; callers are also expected to pass canonical field elements with non-zero `v`. -// prettier-ignore -const uvRatio = (u: bigint, v: bigint): { isValid: boolean, value: bigint } => { - const v3 = modP(v * modP(v * v)); // v³ - const v7 = modP(modP(v3 * v3) * v); // v⁷ - const pow = pow_2_252_3(modP(u * v7)).pow_p_5_8; // (uv⁷)^(p-5)/8 - let x = modP(u * modP(v3 * pow)); // (uv³)(uv⁷)^(p-5)/8 - const vx2 = modP(v * modP(x * x)); // vx² - const root1 = x; // First root candidate - const root2 = modP(x * RM1); // Second root candidate; RM1 is √-1 - const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root - const useRoot2 = vx2 === M(-u); // If vx² = -u, set x <-- x * 2^((p-1)/4) - const noRoot = vx2 === M(-u * RM1); // There is no valid root, vx² = -u√-1 - if (useRoot1) x = root1; - if (useRoot2 || noRoot) x = root2; // We return root2 anyway, for const-time - if ((M(x) & 1n) === 1n) x = M(-x); // edIsNegative - return { isValid: useRoot1 || useRoot2, value: x }; -} -// Implementation `N` is the subgroup order; `L` is only the shared 32-byte encoded width constant. -// Reduce any little-endian byte string modulo the subgroup order; the `hash` name reflects the -// common caller shape, not an input restriction. -const modL_LE = (hash: TArg): bigint => modN(bytesToNumberLE(hash)); // modulo L; but little-endian -// Both sync and async SHA-512 slots are exported/configurable; use `callHash(...)` for both so -// missing async overrides fail explicitly, then validate the returned digest type/length. -const sha512a = (...m: TArg): Promise> => - Promise.resolve(callHash('sha512Async')(concatBytes(...m))).then(checkDigest); -const sha512s = (...m: TArg): TRet => - checkDigest(callHash('sha512')(concatBytes(...m))); -type ExtK = { head: Bytes; prefix: Bytes; scalar: bigint; point: Point; pointBytes: Bytes }; - -// RFC8032 5.1.5. Split the 64-byte hashed seed into the clamped scalar half and nonce prefix. -const hash2extK = (hashed: TArg): TRet => { - // slice creates a copy, unlike subarray - const copy = u8fr(hashed); - const head = copy.slice(0, 32); - head[0] &= 248; // Clamp bits: 0b1111_1000 - head[31] &= 127; // 0b0111_1111 - head[31] |= 64; // 0b0100_0000 - const prefix = copy.slice(32, 64); // secret key "prefix" - // RFC words this as `[s]B`; reducing the clamped little-endian scalar modulo `N` is equivalent - // for base-point multiplication because `G` already has subgroup order `N`. - const scalar = modL_LE(head); - const point = G.multiply(scalar); // public key point - const pointBytes = point.toBytes(); // point serialized to Uint8Array - return { head, prefix, scalar, point, pointBytes } as TRet; -}; - -// RFC8032 5.1.5; getPublicKey async, sync. Hash priv key and extract point. -const getExtendedPublicKeyAsync = (secretKey: TArg): Promise> => - sha512a(abytes(secretKey, L)).then(hash2extK); -const getExtendedPublicKey = (secretKey: TArg): TRet => - hash2extK(sha512s(abytes(secretKey, L))); -/** - * Creates a 32-byte Ed25519 public key from the RFC 8032 32-byte secret-key seed. Async. - * @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 32-byte public key. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Derive the public key bytes for a newly generated signer secret. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const publicKey = await ed.getPublicKeyAsync(secretKey); - * ``` - */ -const getPublicKeyAsync = (secretKey: TArg): Promise> => - getExtendedPublicKeyAsync(secretKey).then((p) => p.pointBytes as TRet); -/** - * Creates a 32-byte Ed25519 public key from the RFC 8032 32-byte secret-key seed. - * To use, set `hashes.sha512` first. - * @param priv - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 32-byte public key. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Derive the public key entirely through the synchronous API. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const secretKey = ed.utils.randomSecretKey(); - * const publicKey = ed.getPublicKey(secretKey); - * ``` - */ -const getPublicKey = (priv: TArg): TRet => getExtendedPublicKey(priv).pointBytes; -type Finishable = { - // Shared between sync/async sign() and verify(): hash `hashable` with SHA-512, then hand the - // resulting 64-byte digest to `finish(...)`. - hashable: Bytes; - finish: (hashed: Bytes) => T; -}; -const hashFinishA = (res: TArg>): Promise> => - sha512a((res as Finishable).hashable).then((res as Finishable).finish) as Promise>; -const hashFinishS = (res: TArg>): TRet => - (res as Finishable).finish(sha512s((res as Finishable).hashable)) as TRet; -// Code, shared between sync & async sign -const _sign = ( - e: TArg<{ pointBytes: Bytes; scalar: bigint }>, - rBytes: TArg, - msg: TArg -): TRet> => { - const { pointBytes: P, scalar: s } = e; - const r = modL_LE(rBytes); // r was created outside, reduce it modulo L - // RFC 8032 5.1.6 allows r mod L = 0, and SUPERCOP ref10 accepts the resulting identity-point - // signature. - // We intentionally keep the safe multiply() rejection here so a miswired all-zero SHA-512 provider - // fails loudly instead of silently producing a degenerate signature. - const R = G.multiply(r).toBytes(); // R = [r]B - const hashable = concatBytes(R, P, msg); // dom2(F, C) || R || A || PH(M) - const finish = (hashed: TArg): TRet => { - // k = SHA512(dom2(F, C) || R || A || PH(M)) - const S = modN(r + modL_LE(hashed) * s); // S = (r + k * s) mod L; 0 <= s < l - return abytes(concatBytes(R, numTo32bLE(S)), 64); // 64-byte sig: 32-byte encoded R point || 32-byte LE(S) - }; - return { hashable, finish } as TRet>; -}; -/** - * Signs message using secret key. Async. - * Follows RFC8032 5.1.6. - * @param message - Message bytes to sign. - * @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 64-byte Ed25519 signature. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Sign an arbitrary message with a fresh Ed25519 secret key. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const message = new Uint8Array([1, 2, 3]); - * const signature = await ed.signAsync(message, secretKey); - * ``` - */ -const signAsync = async (message: TArg, secretKey: TArg): Promise> => { - const m = abytes(message); - const e = await getExtendedPublicKeyAsync(secretKey); - const rBytes = await sha512a(e.prefix, m); // r = SHA512(dom2(F, C) || prefix || PH(M)) - return hashFinishA(_sign(e, rBytes, m)); // gen R, k, S, then 64-byte signature -}; -/** - * Signs message using secret key. To use, set `hashes.sha512` first. - * Follows RFC8032 5.1.6. - * @param message - Message bytes to sign. - * @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key. - * @returns 64-byte Ed25519 signature. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Use the sync API when you've wired a SHA-512 implementation yourself. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const secretKey = ed.utils.randomSecretKey(); - * const signature = ed.sign(new Uint8Array([1, 2, 3]), secretKey); - * ``` - */ -const sign = (message: TArg, secretKey: TArg): TRet => { - const m = abytes(message); - const e = getExtendedPublicKey(secretKey); - const rBytes = sha512s(e.prefix, m); // r = SHA512(dom2(F, C) || prefix || PH(M)) - return hashFinishS(_sign(e, rBytes, m)); // gen R, k, S, then 64-byte signature -}; -/** - * Verification options. zip215: true (default) follows ZIP215 spec. false would follow RFC8032. - * - * Any message with pubkey from `ED25519_TORSION_SUBGROUP` would be valid in sigs under ZIP215. - */ -export type EdDSAVerifyOpts = { - /** Whether to use ZIP215 verification semantics instead of the library's stricter branch. */ - zip215?: boolean; -}; -// Exported defaults favor ZIP-215 interoperability semantics; callers must opt into the stricter -// branch with `{ zip215: false }`. -const defaultVerifyOpts: EdDSAVerifyOpts = { zip215: true }; -const _verify = ( - sig: TArg, - msg: TArg, - publicKey: TArg, - options: TArg = defaultVerifyOpts -): TRet> => { - sig = abytes(sig, 64); // Signature hex str/Bytes, must be 64 bytes - msg = abytes(msg); // Message hex str/Bytes - publicKey = abytes(publicKey, L); - // zip215=false keeps the library's stricter branch, which still canonicalizes `R` / `A` before - // hashing and rejects small-order public keys earlier than pure RFC8032 text would require. - // Preserve the exported ZIP-215 default for `{}` / `{ zip215: undefined }`, not just omitted opts. - const { zip215 = true } = options; - - const r = sig.subarray(0, L); - const s = bytesToNumberLE(sig.subarray(L, L * 2)); // Decode second half as an integer S; - let A: Point, R: Point, SB: Point; - let hashable: Bytes = Uint8Array.of(); - let finished = false; - try { - // zip215=true is good for consensus-critical apps. =false follows RFC8032 / NIST186-5. - // zip215=true: 0 <= y < MASK (2^256 for ed25519) - // zip215=false: 0 <= y < P (2^255-19 for ed25519) - A = Point.fromBytes(publicKey, zip215); - R = Point.fromBytes(r, zip215); - SB = G.multiply(s, false); // 0 <= s < l is done inside - // ZIP-215 accepts noncanonical / unreduced point encodings, so the challenge hash must use the - // exact signature/public-key bytes rather than canonicalized re-encodings of the decoded points. - hashable = concatBytes(r, publicKey, msg); // dom2(F, C) || R || A || PH(M) - finished = true; - } catch (error) {} - const finish = (hashed: TArg): boolean => { - if (!finished) return false; - // Policy: strict mode intentionally rejects all small-order public keys, even though the raw RFC - // equation text is looser here. This matches libsodium and avoids weak / ambiguous verification - // outcomes where unusual low-order public keys can make distinct key/signature combinations verify. - if (!zip215 && A.isSmallOrder()) return false; - - // k = SHA512(dom2(F, C) || R || A || PH(M)) - const k = modL_LE(hashed); - const RkA = R.add(A.multiply(k, false)); - // Extended group equation - // [8][S]B = [8]R + [8][k]A' - return RkA.subtract(SB).clearCofactor().is0(); - }; - return { hashable, finish } as TRet>; -}; - -/** - * Verifies a signature on message and public key. Async. - * The implementation is based on RFC8032 5.1.7, but default opts use ZIP-215 semantics; pass - * `{ zip215: false }` for the library's stricter branch. - * @param signature - 64-byte signature. - * @param message - Signed message bytes. - * @param publicKey - 32-byte public key. - * @param opts - Verification options. Defaults to ZIP-215 semantics. See {@link EdDSAVerifyOpts}. - * @returns `true` when the signature is valid. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Verify the signature against the same message and derived public key. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const message = new Uint8Array([1, 2, 3]); - * const publicKey = await ed.getPublicKeyAsync(secretKey); - * const signature = await ed.signAsync(message, secretKey); - * const isValid = await ed.verifyAsync(signature, message, publicKey); - * ``` - */ -const verifyAsync = async ( - signature: TArg, - message: TArg, - publicKey: TArg, - opts: TArg = defaultVerifyOpts -): Promise => hashFinishA(_verify(signature, message, publicKey, opts)); -/** - * Verifies a signature on message and public key using the synchronous hash path. - * The implementation is based on RFC8032 5.1.7, but default opts use ZIP-215 semantics; pass - * `{ zip215: false }` for the library's stricter branch. - * @param signature - 64-byte signature. - * @param message - Signed message bytes. - * @param publicKey - 32-byte public key. - * @param opts - Verification options. Defaults to ZIP-215 semantics. See {@link EdDSAVerifyOpts}. - * @returns `true` when the signature is valid. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Verify a signature entirely through the synchronous API. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const secretKey = ed.utils.randomSecretKey(); - * const message = new Uint8Array([1, 2, 3]); - * const publicKey = ed.getPublicKey(secretKey); - * const signature = ed.sign(message, secretKey); - * const isValid = ed.verify(signature, message, publicKey); - * ``` - */ -const verify = ( - signature: TArg, - message: TArg, - publicKey: TArg, - opts: TArg = defaultVerifyOpts -): boolean => hashFinishS(_verify(signature, message, publicKey, opts)); - -/** - * Math, hex, byte helpers. Not in `utils` because utils share API with noble-curves. - * Exposes the same low-level field-default `mod` reducer and non-CT `invert` helper used - * internally. - * @example - * Convert bytes to a hex string with the low-level helper namespace. - * - * ```ts - * const hex = etc.bytesToHex(new Uint8Array([1, 2, 3])); - * ``` - */ -const etc: { - bytesToHex: (bytes: TArg) => string; - hexToBytes: (hex: string) => TRet; - concatBytes: (...arrs: TArg) => TRet; - mod: typeof M; - invert: typeof invert; - randomBytes: (len?: number) => TRet; -} = /* @__PURE__ */ Object.freeze({ - bytesToHex, - hexToBytes, - concatBytes, - mod: M as typeof M, - invert: invert as typeof invert, - randomBytes, -}); -/** - * Hash implementations used by the synchronous API plus the default async WebCrypto provider. - * Both slots are configurable API surface; wrapper helpers revalidate that providers still return - * 64-byte SHA-512 digests. - * @example - * Provide a SHA-512 implementation before calling synchronous helpers. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const { publicKey } = ed.keygen(); - * ``` - */ -const hashes = { - sha512Async: async (message: TArg): Promise> => { - const s = subtle(); - const m = concatBytes(message); - return u8n(await s.digest('SHA-512', m.buffer)) as TRet; - }, - sha512: undefined as undefined | ((message: TArg) => TRet), -}; - -// Returns the final 32-byte Ed25519 secret-key seed verbatim, generating fresh random bytes only -// when omitted. -const randomSecretKey = (seed?: TArg): TRet => { - seed = seed === undefined ? randomBytes(L) : seed; - return abytes(seed, L); -}; - -type KeysSecPub = { secretKey: Bytes; publicKey: Bytes }; -/** - * Generates a secret/public keypair. - * @param seed - Optional 32-byte Ed25519 secret-key seed, returned verbatim as `secretKey`. - * @returns Keypair with `secretKey` and `publicKey`. - * @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error} - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Generate a new keypair through the synchronous API after wiring SHA-512. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * import { sha512 } from '@noble/hashes/sha2.js'; - * - * ed.hashes.sha512 = sha512; - * const { secretKey, publicKey } = ed.keygen(); - * ``` - */ -const keygen = (seed?: TArg): TRet => { - const secretKey = randomSecretKey(seed); - const publicKey = getPublicKey(secretKey); - return { secretKey, publicKey } as TRet; -}; -/** - * Generates a secret/public keypair asynchronously. - * @param seed - Optional 32-byte Ed25519 secret-key seed, returned verbatim as `secretKey`. - * @returns Keypair with `secretKey` and `publicKey`. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Generate a new keypair through the asynchronous WebCrypto-backed path. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const { secretKey, publicKey } = await ed.keygenAsync(); - * ``` - */ -const keygenAsync = async (seed?: TArg): Promise> => { - const secretKey = randomSecretKey(seed); - const publicKey = await getPublicKeyAsync(secretKey); - return { secretKey, publicKey } as TRet; -}; - -/** - * Ed25519-specific key utilities. - * `utils.getExtendedPublicKey*` expose secret-derived internals (`head`, `prefix`, `scalar`, and - * point objects), not just public-key bytes. - * @example - * Generate a new Ed25519 secret key and derive the matching public key. - * - * ```ts - * import * as ed from '@noble/ed25519'; - * - * const secretKey = ed.utils.randomSecretKey(); - * const publicKey = await ed.getPublicKeyAsync(secretKey); - * ``` - */ -const utils: { - getExtendedPublicKeyAsync: typeof getExtendedPublicKeyAsync; - getExtendedPublicKey: typeof getExtendedPublicKey; - randomSecretKey: typeof randomSecretKey; -} = /* @__PURE__ */ Object.freeze({ - getExtendedPublicKeyAsync: getExtendedPublicKeyAsync as typeof getExtendedPublicKeyAsync, - getExtendedPublicKey: getExtendedPublicKey as typeof getExtendedPublicKey, - randomSecretKey: randomSecretKey as typeof randomSecretKey, -}); - -// ## Precomputes -// -------------- - -const W = 8; // W is window size -const scalarBits = 256; -const pwindows = Math.ceil(scalarBits / W) + 1; // 33 for W=8, NOT 32 - see wNAF loop -const pwindowSize = 2 ** (W - 1); // 128 for W=8 -// Layout is grouped by window: each block stores the positive multiples `1*base .. 128*base` for -// that window, and the extra `+1` window in `pwindows` absorbs carries from signed-digit recoding. -const precompute = () => { - const points: Point[] = []; - let p = G; - let b = p; - for (let w = 0; w < pwindows; w++) { - b = p; - points.push(b); - for (let i = 1; i < pwindowSize; i++) { - b = b.add(p); - points.push(b); - } // i=1, bc we skip 0 - p = b.double(); - } - return points; -}; -let Gpows: Point[] | undefined = undefined; // shared process-wide cache of base-point precomputes -// Branch-based negate helper used for JS/JIT mitigation symmetry, not a strict constant-time claim. -const ctneg = (cnd: boolean, p: TArg) => { - const n = (p as Point).negate(); - return cnd ? n : (p as Point); -}; - -/** - * Precomputes give 12x faster getPublicKey(), 10x sign(), 2x verify() by - * caching multiples of G (base point). Cache is stored in 32MB of RAM. - * Any time `G.multiply` is done, precomputes are used. - * Not used for getSharedSecret, which instead multiplies random pubkey `P.multiply`. - * - * w-ary non-adjacent form (wNAF) precomputation method is 10% slower than windowed method, - * but takes 2x less RAM. RAM reduction is possible by utilizing `.subtract`. - * Returns the real accumulator `p` plus a fake accumulator `f`; callers only care about `p`, while - * `f` exists to keep similar work in zero-digit branches as a JS/JIT side-channel mitigation. - * - * !! Precomputes can be disabled by commenting-out call of the wNAF() inside Point#multiply(). - */ -const wNAF = (n: bigint): TRet<{ p: Point; f: Point }> => { - const comp = Gpows || (Gpows = precompute()); - let p = I; - let f = G; // f must be G, or could become I in the end - const pow_2_w = 2 ** W; // 256 for W=8 - const maxNum = pow_2_w; // 256 for W=8 - const mask = big(pow_2_w - 1); // 255 for W=8 == mask 0b11111111 - const shiftBy = big(W); // 8 for W=8 - for (let w = 0; w < pwindows; w++) { - let wbits = Number(n & mask); // extract W bits. - n >>= shiftBy; // shift number by W bits. - // We use negative indexes to reduce size of precomputed table by 2x. - // Instead of needing precomputes 0..256, we only calculate them for 0..128. - // If an index > 128 is found, we do (256-index) - where 256 is next window. - // Naive: index +127 => 127, +224 => 224 - // Optimized: index +127 => 127, +224 => 256-32 - if (wbits > pwindowSize) { - wbits -= maxNum; - n += 1n; - } - const off = w * pwindowSize; - const offF = off; // offsets, evaluate both - const offP = off + Math.abs(wbits) - 1; - const isEven = w % 2 !== 0; // conditions, evaluate both - const isNeg = wbits < 0; - if (wbits === 0) { - // off == I: can't add it. Adding random offF instead. - f = f.add(ctneg(isEven, comp[offF])); // bits are 0: add garbage to fake point - } else { - p = p.add(ctneg(isNeg, comp[offP])); // bits are 1: add to result point - } - } - if (n !== 0n) err('invalid wnaf'); - return { p, f } as TRet<{ p: Point; f: Point }>; // callers only need `p`; `f` is kept for zero-digit mitigation symmetry -}; - -// !! Remove the export to easily use in REPL / browser console -export { - etc, - getPublicKey, - getPublicKeyAsync, - hash, - hashes, - keygen, - keygenAsync, - Point, - sign, - signAsync, - utils, - verify, - verifyAsync -}; - diff --git a/node_modules/@noble/ed25519/package.json b/node_modules/@noble/ed25519/package.json deleted file mode 100644 index 9217f39..0000000 --- a/node_modules/@noble/ed25519/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@noble/ed25519", - "version": "3.1.0", - "description": "Fastest 5KB JS implementation of ed25519 EDDSA signatures compliant with RFC8032, FIPS 186-5 & ZIP215", - "files": [ - "index.js", - "index.d.ts", - "index.ts" - ], - "devDependencies": { - "@noble/hashes": "2.2.0", - "@paulmillr/jsbt": "0.5.0", - "@types/node": "25.3.0", - "fast-check": "4.2.0", - "prettier": "3.6.2", - "typescript": "6.0.2" - }, - "scripts": { - "build": "tsc", - "build:release": "npx --no @paulmillr/jsbt esbuild test/build", - "check": "npm run check:readme && npm run check:treeshake && npm run check:jsdoc", - "check:readme": "npx --no @paulmillr/jsbt readme package.json", - "check:treeshake": "npx --no @paulmillr/jsbt treeshake package.json test/build/out-treeshake", - "check:jsdoc": "npx --no @paulmillr/jsbt tsdoc package.json", - "bench": "node test/benchmark.ts", - "format": "prettier --write 'index.ts' 'test/**/*.{js,ts}'", - "test": "node test/index.ts", - "test:bun": "bun test/index.ts", - "test:deno": "deno --allow-env --allow-read test/index.ts", - "test:node20": "cd test; npx tsc; node compiled/test/index.js" - }, - "keywords": [ - "ed25519", - "rfc8032", - "fips186", - "signature", - "eddsa", - "noble", - "cryptography", - "elliptic curve", - "rfc7748", - "zip215", - "x25519", - "curve25519" - ], - "homepage": "https://paulmillr.com/noble/", - "funding": "https://paulmillr.com/funding/", - "repository": { - "type": "git", - "url": "git+https://github.com/paulmillr/noble-ed25519.git" - }, - "type": "module", - "main": "index.js", - "module": "index.js", - "types": "index.d.ts", - "sideEffects": false, - "author": "Paul Miller (https://paulmillr.com)", - "license": "MIT" -} diff --git a/node_modules/@noble/hashes/LICENSE b/node_modules/@noble/hashes/LICENSE deleted file mode 100644 index 9297a04..0000000 --- a/node_modules/@noble/hashes/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2022 Paul Miller (https://paulmillr.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the “Software”), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/@noble/hashes/README.md b/node_modules/@noble/hashes/README.md deleted file mode 100644 index 7cb8034..0000000 --- a/node_modules/@noble/hashes/README.md +++ /dev/null @@ -1,563 +0,0 @@ -# noble-hashes - -Audited & minimal JS implementation of hash functions, MACs and KDFs. - -- 🔒 [**Audited**](#security) by an independent security firm -- 🔻 Tree-shakeable: unused code is excluded from your builds -- 🏎 Fast: hand-optimized for caveats of JS engines -- 🔍 Reliable: chained / sliding window / DoS / ACVP tests and fuzzing -- 🔁 No unrolled loops: makes it easier to verify and reduces source code size up to 5x -- 🦘 Includes SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF, Scrypt, Argon2 -- 🥈 Optional, friendly wrapper over native WebCrypto -- 🪶 22KB (gzipped) for everything, 2.4KB for single-hash build - -Use [awasm-noble](https://github.com/paulmillr/awasm-noble) if you need an even faster (WASM) alternative. -Check out [Upgrading](#upgrading) for information about upgrading from previous versions. -Take a glance at [GitHub Discussions](https://github.com/paulmillr/noble-hashes/discussions) for questions and support. - -The library's initial development was funded by [Ethereum Foundation](https://ethereum.org/). - -### This library belongs to _noble_ cryptography - -> **noble cryptography** — high-security, easily auditable set of contained cryptographic libraries and tools. - -- Zero or minimal dependencies -- Highly readable TypeScript / JS code -- PGP-signed releases and transparent NPM builds -- All libraries: - [ciphers](https://github.com/paulmillr/noble-ciphers), - [curves](https://github.com/paulmillr/noble-curves), - [hashes](https://github.com/paulmillr/noble-hashes), - [post-quantum](https://github.com/paulmillr/noble-post-quantum), - 5kb [secp256k1](https://github.com/paulmillr/noble-secp256k1) / - [ed25519](https://github.com/paulmillr/noble-ed25519) -- [Check out the homepage](https://paulmillr.com/noble/) - for reading resources, documentation, and apps built with noble - -## Usage - -> `npm install @noble/hashes` - -> `deno add jsr:@noble/hashes` - -We support all major platforms and runtimes. -For React Native, you may need a [polyfill for getRandomValues](https://github.com/LinusU/react-native-get-random-values). -A standalone file [noble-hashes.js](https://github.com/paulmillr/noble-hashes/releases) is also available. - -```js -// import * from '@noble/hashes'; // Error: use sub-imports, to ensure small app size -import { sha256 as noble_sha256 } from '@noble/hashes/sha2.js'; -const hash = noble_sha256(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); - -// Available modules -import { sha256, sha384, sha512, sha224, sha512_224, sha512_256 } from '@noble/hashes/sha2.js'; -import { - sha3_256, sha3_512, - keccak_256, keccak_512, - shake128, shake256, -} from '@noble/hashes/sha3.js'; -import { - cshake256, turboshake256, kmac256, tuplehash256, - kt128, kt256, keccakprg, -} from '@noble/hashes/sha3-addons.js'; -import { blake3 } from '@noble/hashes/blake3.js'; -import { blake2b, blake2s } from '@noble/hashes/blake2.js'; -import { blake256, blake512 } from '@noble/hashes/blake1.js'; -import { sha1, md5, ripemd160 } from '@noble/hashes/legacy.js'; -import { hmac } from '@noble/hashes/hmac.js'; -import { hkdf } from '@noble/hashes/hkdf.js'; -import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js'; -import { scrypt, scryptAsync } from '@noble/hashes/scrypt.js'; -import { argon2d, argon2i, argon2id } from '@noble/hashes/argon2.js'; -import * as webcrypto from '@noble/hashes/webcrypto.js'; -// const { sha256, sha384, sha512, hmac, hkdf, pbkdf2 } = webcrypto; -import * as utils from '@noble/hashes/utils.js'; -const { bytesToHex, concatBytes, equalBytes, hexToBytes } = utils; -``` - -- [sha2: sha256, sha384, sha512](#sha2-sha256-sha384-sha512-and-others) -- [sha3: FIPS, SHAKE, Keccak](#sha3-fips-shake-keccak) -- [sha3-addons: cSHAKE, KMAC, KT128, TurboSHAKE](#sha3-addons-cshake-kmac-kt128-turboshake) -- [blake1, blake2, blake3](#blake1-blake2-blake3) -- [legacy: sha1, md5, ripemd160](#legacy-sha1-md5-ripemd160) -- MACs: [hmac](#hmac) | [kmac](#sha3-addons-cshake-kmac-kt128-turboshake) | [blake3 key mode](#blake1-blake2-blake3) -- KDFs: [hkdf](#hkdf) | [pbkdf2](#pbkdf2) | [scrypt](#scrypt) | [argon2](#argon2) -- [webcrypto: friendly wrapper](#webcrypto-friendly-wrapper) -- [utils](#utils) -- [Security](#security) | [Speed](#speed) | [Contributing & testing](#contributing--testing) | [License](#license) - -### Implementations - -Hash functions: - -- `sha256()`: receive & return `Uint8Array` -- `sha256.create().update(a).update(b).digest()`: support partial updates -- `blake3.create({ context: 'e', dkLen: 32 })`: can have options -- support little-endian architecture; also experimentally big-endian -- can hash up to 4GB per chunk, with any amount of chunks - -#### sha2: sha256, sha384, sha512 and others - -```typescript -import { sha224, sha256, sha384, sha512, sha512_224, sha512_256 } from '@noble/hashes/sha2.js'; -const res = sha256(Uint8Array.from([0xbc])); // basic -for (let hash of [sha256, sha384, sha512, sha224, sha512_224, sha512_256]) { - const arr = Uint8Array.from([0x10, 0x20, 0x30]); - const a = hash(arr); - const b = hash.create().update(arr).digest(); -} -``` - -Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and -[the paper on truncated SHA512/256](https://eprint.iacr.org/2010/548.pdf). - -#### sha3: FIPS, SHAKE, Keccak - -```typescript -import { - sha3_224, sha3_256, sha3_384, sha3_512, - keccak_224, keccak_256, keccak_384, keccak_512, - shake128, shake256, -} from '@noble/hashes/sha3.js'; -for (let hash of [ - sha3_224, sha3_256, sha3_384, sha3_512, - keccak_224, keccak_256, keccak_384, keccak_512, -]) { - const arr = Uint8Array.from([0x10, 0x20, 0x30]); - const a = hash(arr); - const b = hash.create().update(arr).digest(); -} -const shka = shake128(Uint8Array.from([0x10]), { dkLen: 512 }); -const shkb = shake256(Uint8Array.from([0x30]), { dkLen: 512 }); -``` - -Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf), -[Website](https://keccak.team/keccak.html). - -Check out [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub) - -#### sha3-addons: cSHAKE, KMAC, K12, TurboSHAKE - -```typescript -import { - cshake128, cshake256, kt128, kt256, - keccakprg, kmac128, kmac256, - parallelhash256, tuplehash256, - turboshake128, turboshake256, -} from '@noble/hashes/sha3-addons.js'; -const data = Uint8Array.from([0x10, 0x20, 0x30]); -const personalization = new TextEncoder().encode('def'); -const ec1 = cshake128(data, { personalization }); -const ec2 = cshake256(data, { personalization }); -const et1 = turboshake128(data); -const et2 = turboshake256(data, { D: 0x05 }); -// tuplehash(['ab', 'c']) !== tuplehash(['a', 'bc']) !== tuplehash([data]) -const et3 = tuplehash256([new TextEncoder().encode('ab'), new TextEncoder().encode('c')]); -// Not parallel in JS (similar to blake3 / kt128), added for compat -const ep1 = parallelhash256(data, { blockLen: 8 }); -const kk = Uint8Array.from([0xca]); -const ek10 = kmac128(kk, data); -const ek11 = kmac256(kk, data); -const ek12 = kt128(data); // kangarootwelve 128-bit -const ek13 = kt256(data); // kangarootwelve 256-bit -// pseudo-random generator, first argument is capacity. XKCP recommends 254 bits capacity for 128-bit security strength. -// * with a capacity of 254 bits. -const p = keccakprg(254); -p.addEntropy(Uint8Array.from([1, 2, 3])); -const rand1b = p.randomBytes(32); -``` - -- cSHAKE, KMAC, TupleHash, ParallelHash + XOF are available, matching - [NIST SP 800-185](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-185.pdf) -- Reduced-round Keccak KT128 (KangarooTwelve 🦘, K12) and TurboSHAKE are available, matching - [RFC 9861](https://datatracker.ietf.org/doc/rfc9861/). -- [KeccakPRG](https://keccak.team/files/CSF-0.1.pdf): pseudo-random generator based on Keccak - -#### blake1, blake2, blake3 - -```typescript -import { blake224, blake256, blake384, blake512 } from '@noble/hashes/blake1.js'; -import { blake2b, blake2s } from '@noble/hashes/blake2.js'; -import { blake3 } from '@noble/hashes/blake3.js'; - -for (let hash of [blake224, blake256, blake384, blake512, blake2b, blake2s, blake3]) { - const arr = Uint8Array.from([0x10, 0x20, 0x30]); - const a = hash(arr); - const b = hash.create().update(arr).digest(); -} - -// blake2 advanced usage -const ab = Uint8Array.from([0x01]); -const txt = new TextEncoder(); -blake2s(ab); -blake2s(ab, { key: new Uint8Array(32) }); -blake2s(ab, { personalization: txt.encode('pers1234') }); -blake2s(ab, { salt: txt.encode('salt1234') }); -blake2b(ab); -blake2b(ab, { key: new Uint8Array(64) }); -blake2b(ab, { personalization: txt.encode('pers1234pers1234') }); -blake2b(ab, { salt: txt.encode('salt1234salt1234') }); - -// blake3 advanced usage -blake3(ab); -blake3(ab, { dkLen: 256 }); -blake3(ab, { key: new Uint8Array(32) }); -blake3(ab, { context: txt.encode('application-name') }); -``` - -- Blake1 is legacy hash, one of SHA3 proposals. It is rarely used anywhere. See [pdf](https://www.aumasson.jp/blake/blake.pdf). -- Blake2 is popular fast hash. blake2b focuses on 64-bit platforms while blake2s is for 8-bit to 32-bit ones. See [RFC 7693](https://datatracker.ietf.org/doc/html/rfc7693), [Website](https://www.blake2.net) -- Blake3 is faster, reduced-round blake2. See [Website & specs](https://blake3.io) - -#### legacy: sha1, md5, ripemd160 - -SHA1 (RFC 3174), MD5 (RFC 1321) and RIPEMD160 (RFC 2286) legacy, weak hash functions. -Don't use them in a new protocol. What "weak" means: - -- Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160. -- No practical pre-image attacks (only theoretical, 2^123.4) -- HMAC seems kinda ok: https://datatracker.ietf.org/doc/html/rfc6151 - -```typescript -import { md5, ripemd160, sha1 } from '@noble/hashes/legacy.js'; -for (let hash of [md5, ripemd160, sha1]) { - const arr = Uint8Array.from([0x10, 0x20, 0x30]); - const a = hash(arr); - const b = hash.create().update(arr).digest(); -} -``` - -#### hmac - -```typescript -import { hmac } from '@noble/hashes/hmac.js'; -import { sha256 } from '@noble/hashes/sha2.js'; -const key = new Uint8Array(32).fill(1); -const msg = new Uint8Array(32).fill(2); -const mac1 = hmac(sha256, key, msg); -const mac2 = hmac.create(sha256, key).update(msg).digest(); -``` - -Conforms to [RFC 2104](https://datatracker.ietf.org/doc/html/rfc2104). - -#### hkdf - -```typescript -import { hkdf } from '@noble/hashes/hkdf.js'; -import { randomBytes } from '@noble/hashes/utils.js'; -import { sha256 } from '@noble/hashes/sha2.js'; -const inputKey = randomBytes(32); -const salt = randomBytes(32); -const info = new TextEncoder().encode('application-key'); -const hk1 = hkdf(sha256, inputKey, salt, info, 32); - -// == same as -import { extract, expand } from '@noble/hashes/hkdf.js'; -const prk = extract(sha256, inputKey, salt); -const hk2 = expand(sha256, prk, info, 32); -``` - -Conforms to [RFC 5869](https://datatracker.ietf.org/doc/html/rfc5869). - -#### pbkdf2 - -```typescript -import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js'; -import { sha256 } from '@noble/hashes/sha2.js'; -const pbkey1 = pbkdf2(sha256, 'password', 'salt', { c: 524288, dkLen: 32 }); -const pbkey2 = await pbkdf2Async(sha256, 'password', 'salt', { c: 524288, dkLen: 32 }); -const pbkey3 = await pbkdf2Async(sha256, Uint8Array.from([1, 2, 3]), Uint8Array.from([4, 5, 6]), { - c: 524288, - dkLen: 32, -}); -``` - -Conforms to [RFC 2898](https://datatracker.ietf.org/doc/html/rfc2898). - -#### scrypt - -```typescript -import { scrypt, scryptAsync } from '@noble/hashes/scrypt.js'; -const scr1 = scrypt('password', 'salt', { N: 2 ** 16, r: 8, p: 1, dkLen: 32 }); -const scr2 = await scryptAsync('password', 'salt', { N: 2 ** 16, r: 8, p: 1, dkLen: 32 }); -const scr3 = await scryptAsync(Uint8Array.from([1, 2, 3]), Uint8Array.from([4, 5, 6]), { - N: 2 ** 17, - r: 8, - p: 1, - dkLen: 32, - onProgress(percentage) { - console.log('progress', percentage); - }, - maxmem: 2 ** 32 + 128 * 8 * 1, // N * r * p * 128 + (128*r*p) -}); -``` - -Conforms to [RFC 7914](https://datatracker.ietf.org/doc/html/rfc7914), -[Website](https://www.tarsnap.com/scrypt.html) - -- `N, r, p` are work factors. It is common to only adjust N, while keeping `r: 8, p: 1`. - See [the blog post](https://blog.filippo.io/the-scrypt-parameters/). - JS doesn't support parallelization, making increasing `p` meaningless. -- `dkLen` is the length of output bytes e.g. `32` or `64` -- `onProgress` can be used with async version of the function to report progress to a user. -- `maxmem` prevents DoS and is limited to `1GB + 1KB` (`2**30 + 2**10`), but can be adjusted using formula: `N * r * p * 128 + (128 * r * p)` - -Time it takes to derive Scrypt key under different values of N (2\*\*N) on Apple M4 (mobile phones can be 1x-4x slower): - -| N pow | Time | RAM | -| ----- | ---- | ----- | -| 16 | 0.1s | 64MB | -| 17 | 0.2s | 128MB | -| 18 | 0.4s | 256MB | -| 19 | 0.8s | 512MB | -| 20 | 1.5s | 1GB | -| 21 | 3.1s | 2GB | -| 22 | 6.2s | 4GB | -| 23 | 13s | 8GB | -| 24 | 27s | 16GB | - -> [!NOTE] -> We support N larger than `2**20` where available, however, -> not all JS engines support >= 2GB ArrayBuffer-s. -> When using such N, you'll need to manually adjust `maxmem`, using formula above. -> Other JS implementations don't support large N-s. - -#### argon2 - -```ts -import { argon2d, argon2i, argon2id } from '@noble/hashes/argon2.js'; -const arg1 = argon2id('password', 'saltsalt', { t: 2, m: 65536, p: 1, maxmem: 2 ** 32 - 1 }); -``` - -Argon2 [RFC 9106](https://datatracker.ietf.org/doc/html/rfc9106) implementation. - -> [!WARNING] -> Argon2 can't be fast in JS, because there is no fast Uint64Array. -> It is suggested to use [Scrypt](#scrypt) instead. -> Being 5x slower than native code means brute-forcing attackers have bigger advantage. - -#### webcrypto: friendly wrapper - -```js -import { sha256, sha384, sha512, hmac, hkdf, pbkdf2 } from '@noble/hashes/webcrypto.js'; -import { randomBytes } from '@noble/hashes/utils.js'; -const whash = await sha256(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); - -const key = new Uint8Array(32).fill(1); -const msg = new Uint8Array(32).fill(2); -const wmac = await hmac(sha256, key, msg); - -const inputKey = randomBytes(32); -const salt = randomBytes(32); -const info = new TextEncoder().encode('application-key'); -const hk1 = await hkdf(sha256, inputKey, salt, info, 32); - -const pbkey1 = await pbkdf2(sha256, 'password', 'salt', { c: 524288, dkLen: 32 }); -``` - -Sometimes people want to use built-in `crypto.subtle` instead of pure JS implementation. -However, it has terrible API. - -We simplify access to built-ins with API which mirrors noble-hashes. -The overhead is minimal - just 30+ lines of code, which verify input correctness. - -> [!NOTE] -> Webcrypto methods are always async. - -#### utils - -```typescript -import { bytesToHex as toHex, randomBytes } from '@noble/hashes/utils.js'; -console.log(toHex(randomBytes(32))); -``` - -- `bytesToHex` will convert `Uint8Array` to a hex string -- `randomBytes(bytes)` will produce cryptographically secure random `Uint8Array` of length `bytes` - -## Security - -The library has been audited: - -- at version 2.2.0, in Apr 2026, by ourselves (self-audited) - - Scope: everything - - [Changes since audit](https://github.com/paulmillr/noble-hashes/compare/2.2.0..main) -- at version 1.0.0, in Jan 2022, independently, by [Cure53](https://cure53.de) - - PDFs: [website](https://cure53.de/pentest-report_hashing-libs.pdf), [in-repo](./audit/2022-01-05-cure53-audit-nbl2.pdf) - - Scope: everything, besides `blake3`, `sha3-addons`, `sha1` and `argon2`, which have not been audited - - The audit has been funded by [Ethereum Foundation](https://ethereum.org/en/) with help of [Nomic Labs](https://nomiclabs.io) - -It is tested against property-based, cross-library and Wycheproof vectors, -and is being fuzzed in [the separate repo](https://github.com/paulmillr/fuzzing). - -If you see anything unusual: investigate and report. - -### Constant-timeness - -We're targetting algorithmic constant time. _JIT-compiler_ and _Garbage Collector_ make "constant time" -extremely hard to achieve [timing attack](https://en.wikipedia.org/wiki/Timing_attack) resistance -in a scripting language. Which means _any other JS library can't have -constant-timeness_. Even statically typed Rust, a language without GC, -[makes it harder to achieve constant-time](https://www.chosenplaintext.ca/open-source/rust-timing-shield/security) -for some cases. If your goal is absolute security, don't use any JS lib — including bindings to native ones. -Use low-level libraries & languages. - -### Memory dumping - -The library shares state buffers between hash -function calls. The buffers are zeroed-out after each call. However, if an attacker -can read application memory, you are doomed in any case: - -- At some point, input will be a string and strings are immutable in JS: - there is no way to overwrite them with zeros. For example: deriving - key from `scrypt(password, salt)` where password and salt are strings -- Input from a file will stay in file buffers -- Input / output will be re-used multiple times in application which means it could stay in memory -- `await anything()` will always write all internal variables (including numbers) - to memory. With async functions / Promises there are no guarantees when the code - chunk would be executed. Which means attacker can have plenty of time to read data from memory -- There is no way to guarantee anything about zeroing sensitive data without - complex tests-suite which will dump process memory and verify that there is - no sensitive data left. For JS it means testing all browsers (incl. mobile), - which is complex. And of course it will be useless without using the same - test-suite in the actual application that consumes the library - -### Supply chain security - -- **Commits** are signed with PGP keys to prevent forgery. Be sure to verify the commit signatures -- **Releases** are made transparently through token-less GitHub CI and Trusted Publishing. Be sure to verify the [provenance logs](https://docs.npmjs.com/generating-provenance-statements) for authenticity. -- **Rare releasing** is practiced to minimize the need for re-audits by end-users. -- **Dependencies** are minimized and strictly pinned to reduce supply-chain risk. - - We use as few dependencies as possible. - - Version ranges are locked, and changes are checked with npm-diff. -- **Dev dependencies** are excluded from end-user installs; they’re only used for development and build steps. - -For this package, there are 0 dependencies; and a few dev dependencies: - -- jsbt contains helpers for building, benchmarking & testing secure JS apps. It is developed by the same author -- prettier, fast-check and typescript are used for code quality / test generation / ts compilation - -### Randomness - -We rely on the built-in -[`crypto.getRandomValues`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues), -which is considered a cryptographically secure PRNG. - -Browsers have had weaknesses in the past - and could again - but implementing a userspace CSPRNG is even worse, as there’s no reliable userspace source of high-quality entropy. - -### Quantum computers - -Cryptographically relevant quantum computer, if built, will allow to -utilize Grover's algorithm to break hashes in 2^n/2 operations, instead of 2^n. - -This means SHA256 should be replaced with SHA512, SHA3-256 with SHA3-512, SHAKE128 with SHAKE256 etc. - -Australian ASD prohibits SHA256 and similar hashes [after 2030](https://www.cyber.gov.au/resources-business-and-government/essential-cyber-security/ism/cyber-security-guidelines/guidelines-cryptography). - -## Upgrading - -Supported node.js versions: - -- v2: v20.19+ (ESM-only) -- v1: v14.21+ (ESM & CJS) - -v2.0 changelog: - -- The package is now ESM-only. ESM can finally be loaded from common.js on node v20.19+ -- `.js` extension must be used for all modules - - Old: `@noble/hashes/sha3` - - New: `@noble/hashes/sha3.js` - - This simplifies working in browsers natively without transpilers -- Only allow Uint8Array as hash inputs, prohibit `string` - - Strict validation checks improve security - - To replicate previous behavior, use `utils.utf8ToBytes` -- Rename / remove some modules for consistency. Previously, sha384 resided in sha512, which was weird - - `sha256`, `sha512` => `sha2.js` (consistent with `sha3.js`) - - `blake2b`, `blake2s` => `blake2.js` (consistent with `blake3.js`, `blake1.js`) - - `ripemd160`, `sha1`, `md5` => `legacy.js` (all low-security hashes are there) - - `_assert` => `utils.js` - - `crypto` internal module got removed: use built-in WebCrypto instead -- Improve typescript types & option autocomplete -- Bump compilation target from es2020 to es2022 - -## Contributing & testing - -`test/misc` directory contains implementations of loop unrolling and md5. - -- `npm install && npm run build && npm test` will build the code and run tests. -- `npm run lint` / `npm run format` will run linter / fix linter issues. -- `npm run bench` will run benchmarks -- `npm run build:release` will build single file -- There is **additional** 20-min DoS test `npm run test:dos` and 2-hour multicore test `npm run test:slow`. - See [our approach to testing](./test/README.md) - -Some hashes are outside of scope of the library: -- [Pedersen in micro-zk-proofs](https://github.com/paulmillr/micro-zk-proofs/blob/1ed5ce1253583b2e540eef7f3477fb52bf5344ff/src/pedersen.ts) -- [Poseidon in noble-curves](https://github.com/paulmillr/noble-curves/blob/3d124dd3ecec8b6634cc0b2ba1c183aded5304f9/src/abstract/poseidon.ts) -- [Poly1305 & GHash in noble-ciphers](https://github.com/paulmillr/noble-ciphers) - -See [paulmillr.com/noble](https://paulmillr.com/noble/) for useful resources, articles, documentation and demos related to the library. - -## Speed - -```sh -npm run bench -``` - -Benchmarks measured on Apple M4. If you need truly exemplar performance, switch to [awasm-noble](https://github.com/paulmillr/awasm-noble). - -``` -# 32B -sha256 x 2,016,129 ops/sec @ 496ns/op -sha512 x 740,740 ops/sec @ 1μs/op -sha3_256 x 287,686 ops/sec @ 3μs/op -sha3_512 x 288,267 ops/sec @ 3μs/op -k12 x 476,190 ops/sec @ 2μs/op -blake2b x 410,340 ops/sec @ 2μs/op -blake2s x 942,507 ops/sec @ 1μs/op -blake3 x 1,006,036 ops/sec @ 994ns/op -ripemd160 x 1,410,437 ops/sec @ 709ns/op -md5 x 1,663,893 ops/sec @ 601ns/op -sha1 x 1,589,825 ops/sec @ 629ns/op - -# 1MB -sha256 x 331 ops/sec @ 3ms/op -sha512 x 128 ops/sec @ 7ms/op -sha3_256 x 39 ops/sec @ 25ms/op -sha3_512 x 21 ops/sec @ 46ms/op -kt128 x 91 ops/sec @ 10ms/op -kt256 x 75 ops/sec @ 13ms/op -turboshake128 x 93 ops/sec @ 10ms/op -blake256 x 57 ops/sec @ 17ms/op -blake2b x 61 ops/sec @ 16ms/op -blake2s x 78 ops/sec @ 12ms/op -blake3 x 95 ops/sec @ 10ms/op -ripemd160 x 177 ops/sec @ 5ms/op -md5 x 250 ops/sec @ 3ms/op -sha1 x 416 ops/sec @ 2ms/op - -# MAC -hmac(sha256) x 599,880 ops/sec @ 1μs/op -hmac(sha512) x 197,122 ops/sec @ 5μs/op -kmac256 x 87,981 ops/sec @ 11μs/op -blake3(key) x 796,812 ops/sec @ 1μs/op - -# KDF -hkdf(sha256) x 259,942 ops/sec @ 3μs/op -blake3(context) x 424,808 ops/sec @ 2μs/op -pbkdf2(sha256, c: 2 ** 18) x 5 ops/sec @ 197ms/op -pbkdf2(sha512, c: 2 ** 18) x 1 ops/sec @ 630ms/op -scrypt(n: 2 ** 18, r: 8, p: 1) x 2 ops/sec @ 400ms/op -argon2id(t: 1, m: 256MB) 2881ms -``` - -The library could be 3x faster by utilizing loop unrolling. It isn't used because -unrolling a) would increase bundle size b) make lib un-readable c) current perf is "fast enough" -for most use-cases. - -## License - -The MIT License (MIT) - -Copyright (c) 2022 Paul Miller [(https://paulmillr.com)](https://paulmillr.com) - -See LICENSE file. diff --git a/node_modules/@noble/hashes/_blake.d.ts b/node_modules/@noble/hashes/_blake.d.ts deleted file mode 100644 index e509cf5..0000000 --- a/node_modules/@noble/hashes/_blake.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Internal helpers for blake hash. - * @module - */ -import { type TRet } from './utils.ts'; -/** - * Internal blake permutation table. - * Rows `0..9` serve BLAKE2s, rows `0..11` serve BLAKE2b with `10..11 = 0..1`, and Blake1 also - * reuses the later rows shown below. Blake1 expands rounds `10..15` as `SIGMA[i % 10]`, so rows - * `10..15` intentionally repeat rows `0..5` for the 14-round (256) and 16-round (512) variants. - */ -export declare const BSIGMA: TRet; -export type Num4 = { - a: number; - b: number; - c: number; - d: number; -}; -export declare function G1s(a: number, b: number, c: number, d: number, x: number): Num4; -export declare function G2s(a: number, b: number, c: number, d: number, x: number): Num4; -//# sourceMappingURL=_blake.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/_blake.d.ts.map b/node_modules/@noble/hashes/_blake.d.ts.map deleted file mode 100644 index c7de007..0000000 --- a/node_modules/@noble/hashes/_blake.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_blake.d.ts","sourceRoot":"","sources":["src/_blake.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAQ,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;GAKG;AAEH,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,UAAU,CAkBlC,CAAC;AAGH,MAAM,MAAM,IAAI,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;CAAE,CAAC;AAKnE,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM/E;AAKD,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM/E"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/_blake.js b/node_modules/@noble/hashes/_blake.js deleted file mode 100644 index 23a11c6..0000000 --- a/node_modules/@noble/hashes/_blake.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Internal helpers for blake hash. - * @module - */ -import { rotr } from "./utils.js"; -/** - * Internal blake permutation table. - * Rows `0..9` serve BLAKE2s, rows `0..11` serve BLAKE2b with `10..11 = 0..1`, and Blake1 also - * reuses the later rows shown below. Blake1 expands rounds `10..15` as `SIGMA[i % 10]`, so rows - * `10..15` intentionally repeat rows `0..5` for the 14-round (256) and 16-round (512) variants. - */ -// prettier-ignore -export const BSIGMA = /* @__PURE__ */ Uint8Array.from([ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, - 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, - 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, - 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, - 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, - 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, - 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, - 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, - 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, - // Blake1, unused in others - 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, - 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, - 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, - 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, -]); -// 32-bit / BLAKE2s first half of G, with the fixed `(16, 12)` rotation pair. -// Parameter `x` is the RFC 7693 first-half message word, or Blake1's pre-mixed -// `m[sigma[r][2i]] ^ u[sigma[r][2i+1]]` addend in the 32-bit path. -export function G1s(a, b, c, d, x) { - a = (a + b + x) | 0; - d = rotr(d ^ a, 16); - c = (c + d) | 0; - b = rotr(b ^ c, 12); - return { a, b, c, d }; -} -// 32-bit / BLAKE2s second half of G. -// Parameter `x` is the RFC 7693 second-half (`y`) message word, or Blake1's pre-mixed -// `m[sigma[r][2i + 1]] ^ u[sigma[r][2i]]` addend in the 32-bit path. -export function G2s(a, b, c, d, x) { - a = (a + b + x) | 0; - d = rotr(d ^ a, 8); - c = (c + d) | 0; - b = rotr(b ^ c, 7); - return { a, b, c, d }; -} -//# sourceMappingURL=_blake.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/_blake.js.map b/node_modules/@noble/hashes/_blake.js.map deleted file mode 100644 index 1869f1b..0000000 --- a/node_modules/@noble/hashes/_blake.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_blake.js","sourceRoot":"","sources":["src/_blake.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAa,MAAM,YAAY,CAAC;AAE7C;;;;;GAKG;AACH,kBAAkB;AAClB,MAAM,CAAC,MAAM,MAAM,GAAqB,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC;IACtE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;IACpD,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACpD,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,E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/node_modules/@noble/hashes/_md.d.ts deleted file mode 100644 index 44b0272..0000000 --- a/node_modules/@noble/hashes/_md.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Internal Merkle-Damgard hash utils. - * @module - */ -import { type Hash, type TArg, type TRet } from './utils.ts'; -/** - * Shared 32-bit conditional boolean primitive reused by SHA-256, SHA-1, and MD5 `F`. - * Returns bits from `b` when `a` is set, otherwise from `c`. - * The XOR form is equivalent to MD5's `F(X,Y,Z) = XY v not(X)Z` because the masked terms never - * set the same bit. - * @param a - selector word - * @param b - word chosen when selector bit is set - * @param c - word chosen when selector bit is clear - * @returns Mixed 32-bit word. - * @example - * Combine three words with the shared 32-bit choice primitive. - * ```ts - * Chi(0xffffffff, 0x12345678, 0x87654321); - * ``` - */ -export declare function Chi(a: number, b: number, c: number): number; -/** - * Shared 32-bit majority primitive reused by SHA-256 and SHA-1. - * Returns bits shared by at least two inputs. - * @param a - first input word - * @param b - second input word - * @param c - third input word - * @returns Mixed 32-bit word. - * @example - * Combine three words with the shared 32-bit majority primitive. - * ```ts - * Maj(0xffffffff, 0x12345678, 0x87654321); - * ``` - */ -export declare function Maj(a: number, b: number, c: number): number; -/** - * Merkle-Damgard hash construction base class. - * Could be used to create MD5, RIPEMD, SHA1, SHA2. - * Accepts only byte-aligned `Uint8Array` input, even when the underlying spec describes bit - * strings with partial-byte tails. - * @param blockLen - internal block size in bytes - * @param outputLen - digest size in bytes - * @param padOffset - trailing length field size in bytes - * @param isLE - whether length and state words are encoded in little-endian - * @example - * Use a concrete subclass to get the shared Merkle-Damgard update/digest flow. - * ```ts - * import { _SHA1 } from '@noble/hashes/legacy.js'; - * const hash = new _SHA1(); - * hash.update(new Uint8Array([97, 98, 99])); - * hash.digest(); - * ``` - */ -export declare abstract class HashMD> implements Hash { - protected abstract process(buf: DataView, offset: number): void; - protected abstract get(): number[]; - protected abstract set(...args: number[]): void; - abstract destroy(): void; - protected abstract roundClean(): void; - readonly blockLen: number; - readonly outputLen: number; - readonly canXOF = false; - readonly padOffset: number; - readonly isLE: boolean; - protected buffer: Uint8Array; - protected view: DataView; - protected finished: boolean; - protected length: number; - protected pos: number; - protected destroyed: boolean; - constructor(blockLen: number, outputLen: number, padOffset: number, isLE: boolean); - update(data: TArg): this; - digestInto(out: TArg): void; - digest(): TRet; - _cloneInto(to?: T): T; - clone(): T; -} -/** - * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53. - * Check out `test/misc/sha2-gen-iv.js` for recomputation guide. - */ -/** Initial SHA256 state from RFC 6234 §6.1: the first 32 bits of the fractional parts of the - * square roots of the first eight prime numbers. Exported as a shared table; callers must treat - * it as read-only because constructors copy words from it by index. */ -export declare const SHA256_IV: TRet; -/** Initial SHA224 state `H(0)` from RFC 6234 §6.1. Exported as a shared table; callers must - * treat it as read-only because constructors copy words from it by index. */ -export declare const SHA224_IV: TRet; -/** Initial SHA384 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen - * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the ninth - * through sixteenth prime numbers. Exported as a shared table; callers must treat it as read-only - * because constructors copy halves from it by index. */ -export declare const SHA384_IV: TRet; -/** Initial SHA512 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen - * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the first - * eight prime numbers. Exported as a shared table; callers must treat it as read-only because - * constructors copy halves from it by index. */ -export declare const SHA512_IV: TRet; -//# sourceMappingURL=_md.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/_md.d.ts.map b/node_modules/@noble/hashes/_md.d.ts.map deleted file mode 100644 index 0d42283..0000000 --- a/node_modules/@noble/hashes/_md.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_md.d.ts","sourceRoot":"","sources":["src/_md.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAML,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CA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EAAE,IAAI,EAAE,OAAO;IAQjF,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI;IA0BpC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI;IAkCvC,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC;IAS1B,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC;IAarB,KAAK,IAAI,CAAC;CAGX;AAED;;;GAGG;AAEH;;uEAEuE;AACvE,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,WAAW,CAEtC,CAAC;AAEH;6EAC6E;AAC7E,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,WAAW,CAEtC,CAAC;AAEH;;;wDAGwD;AACxD,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,WAAW,CAGtC,CAAC;AAEH;;;gDAGgD;AAChD,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,WAAW,CAGtC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/_md.js b/node_modules/@noble/hashes/_md.js deleted file mode 100644 index 0fda375..0000000 --- a/node_modules/@noble/hashes/_md.js +++ /dev/null @@ -1,202 +0,0 @@ -/** - * Internal Merkle-Damgard hash utils. - * @module - */ -import { abytes, aexists, aoutput, clean, createView, } from "./utils.js"; -/** - * Shared 32-bit conditional boolean primitive reused by SHA-256, SHA-1, and MD5 `F`. - * Returns bits from `b` when `a` is set, otherwise from `c`. - * The XOR form is equivalent to MD5's `F(X,Y,Z) = XY v not(X)Z` because the masked terms never - * set the same bit. - * @param a - selector word - * @param b - word chosen when selector bit is set - * @param c - word chosen when selector bit is clear - * @returns Mixed 32-bit word. - * @example - * Combine three words with the shared 32-bit choice primitive. - * ```ts - * Chi(0xffffffff, 0x12345678, 0x87654321); - * ``` - */ -export function Chi(a, b, c) { - return (a & b) ^ (~a & c); -} -/** - * Shared 32-bit majority primitive reused by SHA-256 and SHA-1. - * Returns bits shared by at least two inputs. - * @param a - first input word - * @param b - second input word - * @param c - third input word - * @returns Mixed 32-bit word. - * @example - * Combine three words with the shared 32-bit majority primitive. - * ```ts - * Maj(0xffffffff, 0x12345678, 0x87654321); - * ``` - */ -export function Maj(a, b, c) { - return (a & b) ^ (a & c) ^ (b & c); -} -/** - * Merkle-Damgard hash construction base class. - * Could be used to create MD5, RIPEMD, SHA1, SHA2. - * Accepts only byte-aligned `Uint8Array` input, even when the underlying spec describes bit - * strings with partial-byte tails. - * @param blockLen - internal block size in bytes - * @param outputLen - digest size in bytes - * @param padOffset - trailing length field size in bytes - * @param isLE - whether length and state words are encoded in little-endian - * @example - * Use a concrete subclass to get the shared Merkle-Damgard update/digest flow. - * ```ts - * import { _SHA1 } from '@noble/hashes/legacy.js'; - * const hash = new _SHA1(); - * hash.update(new Uint8Array([97, 98, 99])); - * hash.digest(); - * ``` - */ -export class HashMD { - blockLen; - outputLen; - canXOF = false; - padOffset; - isLE; - // For partial updates less than block size - buffer; - view; - finished = false; - length = 0; - pos = 0; - destroyed = false; - constructor(blockLen, outputLen, padOffset, isLE) { - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - } - update(data) { - aexists(this); - abytes(data); - const { view, buffer, blockLen } = this; - const len = data.length; - for (let pos = 0; pos < len;) { - const take = Math.min(blockLen - this.pos, len - pos); - // Fast path only when there is no buffered partial block: `take === blockLen` implies - // `this.pos === 0`, so we can process full blocks directly from the input view. - if (take === blockLen) { - const dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) - this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - aexists(this); - aoutput(out, this); - this.finished = true; - // Padding - // We can avoid allocation of buffer for padding completely if it - // was previously not allocated here. But it won't change performance. - const { buffer, view, blockLen, isLE } = this; - let { pos } = this; - // append the bit '1' to the message - buffer[pos++] = 0b10000000; - clean(this.buffer.subarray(pos)); - // we have less than padOffset left in buffer, so we cannot put length in - // current block, need process it and pad again - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - // Pad until full block byte with zeros - for (let i = pos; i < blockLen; i++) - buffer[i] = 0; - // `padOffset` reserves the whole length field. For SHA-384/512 the high 64 bits stay zero from - // the padding fill above, and JS will overflow before user input can make that half non-zero. - // So we only need to write the low 64 bits here. - view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE); - this.process(view, 0); - const oview = createView(out); - const len = this.outputLen; - // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT - if (len % 4) - throw new Error('_sha2: outputLen must be aligned to 32bit'); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) - throw new Error('_sha2: outputLen bigger than state'); - for (let i = 0; i < outLen; i++) - oview.setUint32(4 * i, state[i], isLE); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - // Copy before destroy(): subclasses wipe `buffer` during cleanup, but `digest()` must return - // fresh bytes to the caller. - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to ||= new this.constructor(); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.destroyed = destroyed; - to.finished = finished; - to.length = length; - to.pos = pos; - // Only partial-block bytes need copying: when `length % blockLen === 0`, `pos === 0` and - // later `update()` / `digestInto()` overwrite `to.buffer` from the start before reading it. - if (length % blockLen) - to.buffer.set(buffer); - return to; - } - clone() { - return this._cloneInto(); - } -} -/** - * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53. - * Check out `test/misc/sha2-gen-iv.js` for recomputation guide. - */ -/** Initial SHA256 state from RFC 6234 §6.1: the first 32 bits of the fractional parts of the - * square roots of the first eight prime numbers. Exported as a shared table; callers must treat - * it as read-only because constructors copy words from it by index. */ -export const SHA256_IV = /* @__PURE__ */ Uint32Array.from([ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19, -]); -/** Initial SHA224 state `H(0)` from RFC 6234 §6.1. Exported as a shared table; callers must - * treat it as read-only because constructors copy words from it by index. */ -export const SHA224_IV = /* @__PURE__ */ Uint32Array.from([ - 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4, -]); -/** Initial SHA384 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen - * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the ninth - * through sixteenth prime numbers. Exported as a shared table; callers must treat it as read-only - * because constructors copy halves from it by index. */ -export const SHA384_IV = /* @__PURE__ */ Uint32Array.from([ - 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939, - 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4, -]); -/** Initial SHA512 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen - * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the first - * eight prime numbers. Exported as a shared table; callers must treat it as read-only because - * constructors copy halves from it by index. */ -export const SHA512_IV = /* @__PURE__ */ Uint32Array.from([ - 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1, - 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179, -]); -//# sourceMappingURL=_md.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/_md.js.map b/node_modules/@noble/hashes/_md.js.map deleted file mode 100644 index 9f2e86c..0000000 --- a/node_modules/@noble/hashes/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diff --git a/node_modules/@noble/hashes/_u64.d.ts b/node_modules/@noble/hashes/_u64.d.ts deleted file mode 100644 index 306b1c5..0000000 --- a/node_modules/@noble/hashes/_u64.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Internal helpers for u64. - * BigUint64Array is too slow as per 2026, so we implement it using - * Uint32Array. - * @privateRemarks TODO: re-check {@link https://issues.chromium.org/issues/42212588} - * @module - */ -import type { TRet } from './utils.ts'; -declare function fromBig(n: bigint, le?: boolean): { - h: number; - l: number; -}; -declare function split(lst: bigint[], le?: boolean): TRet; -declare const toBig: (h: number, l: number) => bigint; -declare const shrSH: (h: number, _l: number, s: number) => number; -declare const shrSL: (h: number, l: number, s: number) => number; -declare const rotrSH: (h: number, l: number, s: number) => number; -declare const rotrSL: (h: number, l: number, s: number) => number; -declare const rotrBH: (h: number, l: number, s: number) => number; -declare const rotrBL: (h: number, l: number, s: number) => number; -declare const rotr32H: (_h: number, l: number) => number; -declare const rotr32L: (h: number, _l: number) => number; -declare const rotlSH: (h: number, l: number, s: number) => number; -declare const rotlSL: (h: number, l: number, s: number) => number; -declare const rotlBH: (h: number, l: number, s: number) => number; -declare const rotlBL: (h: number, l: number, s: number) => number; -declare function add(Ah: number, Al: number, Bh: number, Bl: number): { - h: number; - l: number; -}; -declare const add3L: (Al: number, Bl: number, Cl: number) => number; -declare const add3H: (low: number, Ah: number, Bh: number, Ch: number) => number; -declare const add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number; -declare const add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number; -declare const add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number; -declare const add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number; -export { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig }; -declare const u64: { - fromBig: typeof fromBig; - split: typeof split; - toBig: (h: number, l: number) => bigint; - shrSH: (h: number, _l: number, s: number) => number; - shrSL: (h: number, l: number, s: number) => number; - rotrSH: (h: number, l: number, s: number) => number; - rotrSL: (h: number, l: number, s: number) => number; - rotrBH: (h: number, l: number, s: number) => number; - rotrBL: (h: number, l: number, s: number) => number; - rotr32H: (_h: number, l: number) => number; - rotr32L: (h: number, _l: number) => number; - rotlSH: (h: number, l: number, s: number) => number; - rotlSL: (h: number, l: number, s: number) => number; - rotlBH: (h: number, l: number, s: number) => number; - rotlBL: (h: number, l: number, s: number) => number; - add: typeof add; - add3L: (Al: number, Bl: number, Cl: number) => number; - add3H: (low: number, Ah: number, Bh: number, Ch: number) => number; - add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number; - add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number; - add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number; - add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number; -}; -export default u64; -//# sourceMappingURL=_u64.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/_u64.d.ts.map b/node_modules/@noble/hashes/_u64.d.ts.map deleted file mode 100644 index 6fa63a4..0000000 --- a/node_modules/@noble/hashes/_u64.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_u64.d.ts","sourceRoot":"","sources":["src/_u64.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOvC,iBAAS,OAAO,CACd,CAAC,EAAE,MAAM,EACT,EAAE,UAAQ,GACT;IACD,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAGA;AAID,iBAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,UAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,CAS7D;AAID,QAAA,MAAM,KAAK,GAAI,GAAG,MAAM,EAAE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MAAM,KAAK,MAAM,CAAC;IAAC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,GAAG,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;CAOrpC,CAAC;AAEF,eAAe,GAAG,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/_u64.js b/node_modules/@noble/hashes/_u64.js deleted file mode 100644 index e66551e..0000000 --- a/node_modules/@noble/hashes/_u64.js +++ /dev/null @@ -1,84 +0,0 @@ -const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); -const _32n = /* @__PURE__ */ BigInt(32); -// Split bigint into two 32-bit halves. With `le=true`, returned fields become `{ h: low, l: high -// }` to match little-endian word order rather than the property names. -function fromBig(n, le = false) { - if (le) - return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; - return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; -} -// Split bigint list into `[highWords, lowWords]` when `le=false`; with `le=true`, the first array -// holds the low halves because `fromBig(...)` swaps the semantic meaning of `h` and `l`. -function split(lst, le = false) { - const len = lst.length; - let Ah = new Uint32Array(len); - let Al = new Uint32Array(len); - for (let i = 0; i < len; i++) { - const { h, l } = fromBig(lst[i], le); - [Ah[i], Al[i]] = [h, l]; - } - return [Ah, Al]; -} -// Combine explicit `(high, low)` 32-bit halves into a bigint; `>>> 0` normalizes signed JS -// bitwise results back to uint32 first, and little-endian callers must swap. -const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); -// High 32-bit half of a 64-bit logical right shift for `s` in `0..31`. -const shrSH = (h, _l, s) => h >>> s; -// Low 32-bit half of a 64-bit logical right shift, valid for `s` in `1..31`. -const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); -// High 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`. -const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); -// Low 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`. -const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); -// High 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`. -const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); -// Low 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`. -const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); -// High 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped low half. -const rotr32H = (_h, l) => l; -// Low 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped high half. -const rotr32L = (h, _l) => h; -// High 32-bit half of a 64-bit left rotate, valid for `s` in `1..31`. -const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); -// Low 32-bit half of a 64-bit left rotate, valid for `s` in `1..31`. -const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); -// High 32-bit half of a 64-bit left rotate, valid for `s` in `33..63`; `32` uses `rotr32*`. -const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); -// Low 32-bit half of a 64-bit left rotate, valid for `s` in `33..63`; `32` uses `rotr32*`. -const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); -// Add two split 64-bit words and return the split `{ h, l }` sum. -// JS uses 32-bit signed integers for bitwise operations, so we cannot simply shift the carry out -// of the low sum and instead use division. -function add(Ah, Al, Bh, Bl) { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; -} -// Addition with more than 2 elements -// Unmasked low-word accumulator for 3-way addition; pass the raw result into `add3H(...)`. -const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); -// High-word finalize step for 3-way addition; `low` must be the untruncated output of `add3L(...)`. -const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; -// Unmasked low-word accumulator for 4-way addition; pass the raw result into `add4H(...)`. -const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); -// High-word finalize step for 4-way addition; `low` must be the untruncated output of `add4L(...)`. -const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; -// Unmasked low-word accumulator for 5-way addition; pass the raw result into `add5H(...)`. -const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); -// High-word finalize step for 5-way addition; `low` must be the untruncated output of `add5L(...)`. -const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; -// prettier-ignore -export { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig }; -// Canonical grouped namespace for callers that prefer one object. -// Named exports stay for direct imports. -// prettier-ignore -const u64 = { - fromBig, split, toBig, - shrSH, shrSL, - rotrSH, rotrSL, rotrBH, rotrBL, - rotr32H, rotr32L, - rotlSH, rotlSL, rotlBH, rotlBL, - add, add3L, add3H, add4L, add4H, add5H, add5L, -}; -// Default export mirrors named `u64` for compatibility with object-style imports. -export default u64; -//# sourceMappingURL=_u64.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/_u64.js.map b/node_modules/@noble/hashes/_u64.js.map deleted file mode 100644 index 538e533..0000000 --- a/node_modules/@noble/hashes/_u64.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_u64.js","sourceRoot":"","sources":["src/_u64.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;AACvD,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAExC,iGAAiG;AACjG,uEAAuE;AACvE,SAAS,OAAO,CACd,CAAS,EACT,EAAE,GAAG,KAAK;IAKV,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;IAClF,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAA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EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAEvD,kBAAkB;AAClB,OAAO,EACL,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EACrK,CAAC;AACF,kEAAkE;AAClE,yCAAyC;AACzC,kBAAkB;AAClB,MAAM,GAAG,GAAkpC;IACzpC,OAAO,EAAE,KAAK,EAAE,KAAK;IACrB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9B,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9B,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;CAC9C,CAAC;AACF,kFAAkF;AAClF,eAAe,GAAG,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/argon2.d.ts b/node_modules/@noble/hashes/argon2.d.ts deleted file mode 100644 index 541fdac..0000000 --- a/node_modules/@noble/hashes/argon2.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { type KDFInput, type TArg, type TRet } from './utils.ts'; -/** Argon2 cost, output, and optional secret/personalization inputs. */ -export type ArgonOpts = { - /** Time cost measured in iterations. */ - t: number; - /** Memory cost in kibibytes. */ - m: number; - /** Parallelization parameter. */ - p: number; - /** Argon2 version number. Defaults to `0x13`. */ - version?: number; - /** Optional secret key mixed into initialization. */ - key?: KDFInput; - /** Optional personalization string or bytes. */ - personalization?: KDFInput; - /** Desired output length in bytes. RFC 9106 §3.1 requires `T` in the 4..(2^32 - 1) range. */ - dkLen?: number; - /** Max scheduler block time in milliseconds for the async variants. */ - asyncTick?: number; - /** Maximum temporary memory budget in bytes. */ - maxmem?: number; - /** - * Optional progress callback invoked during long-running derivations. - * param progress - completion fraction in the `0..1` range - */ - onProgress?: (progress: number) => void; -}; -/** - * Argon2d GPU-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2d. - * ```ts - * argon2d('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export declare const argon2d: (password: TArg, salt: TArg, opts: TArg) => TRet; -/** - * Argon2i side-channel-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2i. - * ```ts - * argon2i('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export declare const argon2i: (password: TArg, salt: TArg, opts: TArg) => TRet; -/** - * Argon2id, combining i+d, the most popular version from RFC 9106. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2id. - * ```ts - * argon2id('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export declare const argon2id: (password: TArg, salt: TArg, opts: TArg) => TRet; -/** - * Argon2d async GPU-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2d asynchronously. - * ```ts - * await argon2dAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export declare const argon2dAsync: (password: TArg, salt: TArg, opts: TArg) => Promise>; -/** - * Argon2i async side-channel-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2i asynchronously. - * ```ts - * await argon2iAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export declare const argon2iAsync: (password: TArg, salt: TArg, opts: TArg) => Promise>; -/** - * Argon2id async, combining i+d, the most popular version from RFC 9106. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2id asynchronously. - * ```ts - * await argon2idAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export declare const argon2idAsync: (password: TArg, salt: TArg, opts: TArg) => Promise>; -//# sourceMappingURL=argon2.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/argon2.d.ts.map b/node_modules/@noble/hashes/argon2.d.ts.map deleted file mode 100644 index 6d0f0d8..0000000 --- a/node_modules/@noble/hashes/argon2.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"argon2.d.ts","sourceRoot":"","sources":["src/argon2.ts"],"names":[],"mappings":"AAYA,OAAO,EASL,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAuLpB,uEAAuE;AACvE,MAAM,MAAM,SAAS,GAAG;IACtB,wCAAwC;IACxC,CAAC,EAAE,MAAM,CAAC;IACV,gCAAgC;IAChC,CAAC,E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,CAAC,UAAU,CAAC,CAAmD,CAAC;AAC/E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,IAAI,CAAC,QAAQ,CAAC,EACxB,MAAM,IAAI,CAAC,QAAQ,CAAC,EACpB,MAAM,IAAI,CAAC,SAAS,CAAC,KACpB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAkD,CAAC;AAC9E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,IAAI,CAAC,QAAQ,CAAC,EACxB,MAAM,IAAI,CAAC,QAAQ,CAAC,EACpB,MAAM,IAAI,CAAC,SAAS,CAAC,KACpB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAmD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/argon2.js b/node_modules/@noble/hashes/argon2.js deleted file mode 100644 index b2fcd1f..0000000 --- a/node_modules/@noble/hashes/argon2.js +++ /dev/null @@ -1,517 +0,0 @@ -/** - * Argon2 KDF from RFC 9106. Can be used to create a key from password and salt. - * We suggest to use Scrypt. JS Argon is 2-10x slower than native code because of 64-bitness: - * * argon uses uint64, but JS doesn't have fast uint64array - * * uint64 multiplication is 1/3 of time - * * `P` function would be very nice with u64, because most of value will be in registers, - * hovewer with u32 it will require 32 registers, which is too much. - * * JS arrays do slow bound checks, so reading from `A2_BUF` slows it down - * @module - */ -import { add3H, add3L, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL } from "./_u64.js"; -import { blake2b } from "./blake2.js"; -import { anumber, clean, kdfInputToBytes, nextTick, swap32IfBE, swap8IfBE, u32, u8, } from "./utils.js"; -// RFC 9106 §3.1 type `y`: 0 = Argon2d, 1 = Argon2i, 2 = Argon2id. The numeric values are the -// spec-bound part here; the object keys are internal labels. -const AT = { Argond2d: 0, Argon2i: 1, Argon2id: 2 }; -// RFC 9106 sync points constant `SL = 4`, fixed by the design rather than exposed as a tuning knob. -const ARGON2_SYNC_POINTS = 4; -// Preserve Argon2's `LE32(len(X)) || X` encoding for omitted -// optional fields by emitting empty bytes. -const abytesOrZero = (buf, errorTitle = '') => { - if (buf === undefined) - return Uint8Array.of(); - return kdfInputToBytes(buf, errorTitle); -}; -// Unsigned `u32 * u32 = { h, l }`, returned as split 64-bit halves. -function mul(a, b) { - // Split into 16-bit limbs so each partial product stays exact under `Math.imul`. - const aL = a & 0xffff; - const aH = a >>> 16; - const bL = b & 0xffff; - const bH = b >>> 16; - const ll = Math.imul(aL, bL); - const hl = Math.imul(aH, bL); - const lh = Math.imul(aL, bH); - const hh = Math.imul(aH, bH); - const carry = (ll >>> 16) + (hl & 0xffff) + lh; - const high = (hh + (hl >>> 16) + (carry >>> 16)) | 0; - const low = (carry << 16) | (ll & 0xffff); - return { h: high, l: low }; -} -function mul2(a, b) { - // Double the split 64-bit product; carry from `l` is folded back into `h` via `l >>> 31`. - const { h, l } = mul(a, b); - return { h: ((h << 1) | (l >>> 31)) & 0xffff_ffff, l: (l << 1) & 0xffff_ffff }; -} -// BlaMka permutation for Argon2 -// `A + B + 2 * trunc(A) * trunc(B)`, where `trunc(...)` means the low 32-bit halves. -function blamka(Ah, Al, Bh, Bl) { - const { h: Ch, l: Cl } = mul2(Al, Bl); - // A + B + (2 * A * B) - const Rll = add3L(Al, Bl, Cl); - return { h: add3H(Rll, Ah, Bh, Ch), l: Rll | 0 }; -} -// Temporary block buffer. -// 1024-byte block: 256 u32 = 128 interleaved low/high halves = RFC's -// 8x8 matrix of 16-byte registers. -const A2_BUF = new Uint32Array(256); -// Quarter-round over 64-bit word indices into `A2_BUF`; each index maps to adjacent low/high u32s. -function G(a, b, c, d) { - let Al = A2_BUF[2 * a], Ah = A2_BUF[2 * a + 1]; // prettier-ignore - let Bl = A2_BUF[2 * b], Bh = A2_BUF[2 * b + 1]; // prettier-ignore - let Cl = A2_BUF[2 * c], Ch = A2_BUF[2 * c + 1]; // prettier-ignore - let Dl = A2_BUF[2 * d], Dh = A2_BUF[2 * d + 1]; // prettier-ignore - // RFC 9106 Figure 19 GB rotates by 32, 24, 16, and 63 bits after each XOR step. - ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) }); - ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) }); - ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) }); - ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) }); - ((A2_BUF[2 * a] = Al), (A2_BUF[2 * a + 1] = Ah)); - ((A2_BUF[2 * b] = Bl), (A2_BUF[2 * b + 1] = Bh)); - ((A2_BUF[2 * c] = Cl), (A2_BUF[2 * c + 1] = Ch)); - ((A2_BUF[2 * d] = Dl), (A2_BUF[2 * d + 1] = Dh)); -} -// Argon2 permutation over 16 register indices into `A2_BUF`, not the register values themselves. -// RFC 9106 Figure 17: these arguments are the 16 `v0..v15` 64-bit word -// indices inside eight 16-byte inputs, not copied word values. -// prettier-ignore -function P(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12, v13, v14, v15) { - // RFC 9106 Figure 18: first apply GB across rows, then across columns of the 8x8 register matrix. - G(v00, v04, v08, v12); - G(v01, v05, v09, v13); - G(v02, v06, v10, v14); - G(v03, v07, v11, v15); - G(v00, v05, v10, v15); - G(v01, v06, v11, v12); - G(v02, v07, v08, v13); - G(v03, v04, v09, v14); -} -function block(x, xPos, yPos, outPos, needXor) { - for (let i = 0; i < 256; i++) - A2_BUF[i] = x[xPos + i] ^ x[yPos + i]; - // rows (8 consecutive 16-register groups) - for (let i = 0; i < 128; i += 16) { - // prettier-ignore - P(i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15); - } - // columns (8 strided 16-register groups) - for (let i = 0; i < 16; i += 2) { - // prettier-ignore - P(i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49, i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113); - } - // RFC 9106 step 6: passes after the first XOR the old destination block into the new G(X, Y). - if (needXor) - for (let i = 0; i < 256; i++) - x[outPos + i] ^= A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i]; - else - for (let i = 0; i < 256; i++) - x[outPos + i] = A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i]; - clean(A2_BUF); -} -// Variable-Length Hash Function H' -// Returns bytes, not words; 1024-byte block callers explicitly reinterpret with `u32(...)`. -function Hp(A, dkLen) { - const A8 = u8(A); - const T = new Uint32Array(1); - const T8 = u8(T); - // Argon2 H' prefixes dkLen as LE32; native Uint32Array writes would serialize as BE on s390x. - T[0] = swap8IfBE(dkLen); - // Fast path - if (dkLen <= 64) - return blake2b.create({ dkLen }).update(T8).update(A8).digest(); - const out = new Uint8Array(dkLen); - let V = blake2b.create({}).update(T8).update(A8).digest(); - let pos = 0; - // RFC 9106 Figure 8: each intermediate `V_i` contributes only `W_i`, its first 32 bytes; only - // `V_{r+1}` is emitted in full at the remaining length. - out.set(V.subarray(0, 32)); - pos += 32; - // Rest blocks - for (; dkLen - pos > 64; pos += 32) { - const Vh = blake2b.create({}).update(V); - Vh.digestInto(V); - Vh.destroy(); - out.set(V.subarray(0, 32), pos); - } - // Last block - out.set(blake2b(V, { dkLen: dkLen - pos }), pos); - clean(V, T); - // H' is byte-oriented; returning `u32(out)` would silently drop dkLen % 4 tail bytes. - return out; -} -// Used only inside process block! -function indexAlpha(r, s, laneLen, segmentLen, index, randL, sameLane = false) { - // RFC 9106 §3.4.2 Figures 12-13: map `J1` / `J2` into the current lane's reference area `W`. - let area; - if (r === 0) { - if (s === 0) - area = index - 1; - else if (sameLane) - area = s * segmentLen + index - 1; - else - area = s * segmentLen + (index == 0 ? -1 : 0); - } - else if (sameLane) - area = laneLen - segmentLen + index - 1; - else - area = laneLen - segmentLen + (index == 0 ? -1 : 0); - const startPos = r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0; - // RFC 9106 Figure 13: `mul(randL, randL).h` is `floor(J_1^2 / 2^32)`, and the outer high-half - // multiply computes `floor(|W| * x / 2^32)` without floating-point math. - const rel = area - 1 - mul(area, mul(randL, randL).h).h; - return (startPos + rel) % laneLen; -} -// Exclusive `2^32` sentinel used by `isU32(...)`, not the inclusive maximum u32 value. -const maxUint32 = Math.pow(2, 32); -// Validate safe JS integers in `[0, 2^32 - 1]`. -function isU32(num) { - return Number.isSafeInteger(num) && num >= 0 && num < maxUint32; -} -function argon2Opts(opts) { - const merged = { - version: 0x13, - dkLen: 32, - maxmem: maxUint32 - 1, - asyncTick: 10, - }; - // Unknown keys are copied through unchanged here and later ignored unless - // destructuring consumes them. - for (let [k, v] of Object.entries(opts)) - if (v !== undefined) - merged[k] = v; - const { dkLen, p, m, t, version, onProgress, asyncTick } = merged; - // RFC 9106 §3.1: tag length `T` MUST be an integer number of bytes from 4 to 2^32-1. - if (!isU32(dkLen) || dkLen < 4) - throw new Error('"dkLen" must be 4..'); - if (!isU32(p) || p < 1 || p >= Math.pow(2, 24)) - throw new Error('"p" must be 1..2^24'); - if (!isU32(m)) - throw new Error('"m" must be 0..2^32'); - if (!isU32(t) || t < 1) - throw new Error('"t" (iterations) must be 1..2^32'); - if (onProgress !== undefined && typeof onProgress !== 'function') - throw new Error('"progressCb" must be a function'); - anumber(asyncTick, 'asyncTick'); - /* - Memory size m MUST be an integer number of kibibytes from 8*p - to 2^(32)-1. The actual number of blocks is m', which is m - rounded down to the nearest multiple of 4*p. - */ - if (!isU32(m) || m < 8 * p) - throw new Error('"m" (memory) must be at least 8*p bytes'); - // Accept legacy `0x10` for compatibility even though RFC 9106 profiles standardize `0x13`. - if (version !== 0x10 && version !== 0x13) - throw new Error('"version" must be 0x10 or 0x13, got ' + version); - return merged; -} -function argon2Init(password, salt, type, opts) { - password = kdfInputToBytes(password, 'password'); - salt = kdfInputToBytes(salt, 'salt'); - if (!isU32(password.length)) - throw new Error('"password" must be less of length 1..4Gb'); - // RFC 9106 §3.1 only requires S <= 2^32-1 bytes and says 16 bytes is RECOMMENDED for password - // hashing; this library intentionally takes the stricter common >=8-byte salt path. - if (!isU32(salt.length) || salt.length < 8) - throw new Error('"salt" must be of length 8..4Gb'); - if (!Object.values(AT).includes(type)) - throw new Error('"type" was invalid'); - let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress, asyncTick } = argon2Opts(opts); - // Validation - key = abytesOrZero(key, 'key'); - personalization = abytesOrZero(personalization, 'personalization'); - // H_0 = H^(64)(LE32(p) || LE32(T) || LE32(m) || LE32(t) || - // LE32(v) || LE32(y) || LE32(length(P)) || P || - // LE32(length(S)) || S || LE32(length(K)) || K || - // LE32(length(X)) || X) - const h = blake2b.create(); - const BUF = new Uint32Array(1); - const BUF8 = u8(BUF); - for (let item of [p, dkLen, m, t, version, type]) { - // RFC 9106 H0 encodes these scalars as LE32, so normalize the host word before exposing bytes. - BUF[0] = swap8IfBE(item); - h.update(BUF8); - } - for (let i of [password, salt, key, personalization]) { - BUF[0] = swap8IfBE(i.length); // BUF is u32 array, this is valid once normalized to LE bytes - h.update(BUF8).update(i); - } - // Reserve two extra LE32 words after the 64-byte `H_0` so Figures 3-4 can append - // `LE32(0 or 1) || LE32(i)` in place for the lane-starting blocks. - const H0 = new Uint32Array(18); - const H0_8 = u8(H0); - h.digestInto(H0_8); - // 256 u32 = 1024 (BLOCK_SIZE), fills A2_BUF on processing - // Params - const lanes = p; - // m' = 4 * p * floor (m / 4p) - const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p)); - //q = m' / p columns - const laneLen = Math.floor(mP / p); - const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS); - // `maxmem` is documented in bytes; compare against the actual 1024-byte block allocation. - const memUsed = mP * 1024; - if (!isU32(maxmem)) - throw new Error('"maxmem" expected <2**32, got ' + maxmem); - if (memUsed > maxmem) - throw new Error('"maxmem" limit was hit: memUsed(mP*1024)=' + memUsed + ', maxmem=' + maxmem); - const B = new Uint32Array(memUsed / 4); - // Fill first blocks - for (let l = 0; l < p; l++) { - const i = 256 * laneLen * l; - // B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i)) - H0[17] = swap8IfBE(l); - H0[16] = swap8IfBE(0); - B.set(swap32IfBE(u32(Hp(H0, 1024))), i); - // B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i)) - H0[16] = swap8IfBE(1); - B.set(swap32IfBE(u32(Hp(H0, 1024))), i + 256); - } - let perBlock = () => { }; - if (onProgress) { - // The first segment of the first pass skips two preinitialized blocks per lane. - const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen - 2 * p; - // Invoke callback if progress changes from 10.01 to 10.02 - // Allows to draw smooth progress bar on up to 8K screen - const callbackPer = Math.max(Math.floor(totalBlock / 10000), 1); - let blockCnt = 0; - perBlock = () => { - blockCnt++; - if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock)) - onProgress(blockCnt / totalBlock); - }; - } - clean(BUF, H0); - return { type, mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick }; -} -function argon2Output(B, p, laneLen, dkLen) { - const B_final = new Uint32Array(256); - for (let l = 0; l < p; l++) - for (let j = 0; j < 256; j++) - B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j]; - // RFC 9106 steps 7-8 feed the byte string `C` into `H'^T(C)`, so normalize the xor'ed words - // back to spec byte order before `Hp(...)` reinterprets them as bytes. - const res = Hp(swap32IfBE(B_final), dkLen); - // Wipe both the xor scratch and the full working matrix once final digest bytes exist. - // JS cleanup is still only best-effort, but this local buffer is no longer needed here. - clean(B, B_final); - return res; -} -function processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor) { - if (offset % laneLen) - prev = offset - 1; - let randL, randH; - if (dataIndependent) { - let i128 = index % 128; - // RFC 9106 §3.4.1.2: each 1024-byte address block yields 128 `(J1, J2)` pairs, so regenerate - // it whenever the segment index crosses a multiple of 128. - if (i128 === 0) { - address[256 + 12]++; - block(address, 256, 2 * 256, 0, false); - block(address, 0, 2 * 256, 0, false); - } - randL = address[2 * i128]; - randH = address[2 * i128 + 1]; - } - else { - const T = 256 * prev; - randL = B[T]; - randH = B[T + 1]; - } - // Address-block path selects `J1` / `J2`, then maps them to the reference - // lane/block per RFC 9106 §3.4. - const refLane = r === 0 && s === 0 ? l : randH % lanes; - const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l); - const refBlock = laneLen * refLane + refPos; - // B[i][j] = G(B[i][j-1], B[l][z]) - block(B, 256 * prev, 256 * refBlock, offset * 256, needXor); -} -function argon2(type, password, salt, opts) { - const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock } = argon2Init(password, salt, type, opts); - // Pre-loop setup - // [address, input, zero_block] format so we can pass single U32 to block function - const address = new Uint32Array(3 * 256); - address[256 + 6] = mP; - address[256 + 8] = t; - address[256 + 10] = type; - for (let r = 0; r < t; r++) { - // RFC 9106 step 6 applies the XOR-on-later-passes rule only for version `0x13`; legacy - // `0x10` keeps the older overwrite behavior used by the v16 test vectors. - const needXor = r !== 0 && version === 0x13; - address[256 + 0] = r; - for (let s = 0; s < ARGON2_SYNC_POINTS; s++) { - address[256 + 4] = s; - // RFC 9106 §3.4.1.3: Argon2id uses Argon2i's data-independent `J1` / `J2` generation only - // in pass 0, slices 0 and 1; Argon2i uses it in every segment. - const dataIndependent = type == AT.Argon2i || (type == AT.Argon2id && r === 0 && s < 2); - for (let l = 0; l < p; l++) { - address[256 + 2] = l; - address[256 + 12] = 0; - let startPos = 0; - if (r === 0 && s === 0) { - startPos = 2; - if (dataIndependent) { - address[256 + 12]++; - block(address, 256, 2 * 256, 0, false); - block(address, 0, 2 * 256, 0, false); - } - } - // current block postion - let offset = l * laneLen + s * segmentLen + startPos; - // previous block position - let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1; - for (let index = startPos; index < segmentLen; index++, offset++, prev++) { - perBlock(); - processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor); - } - } - } - } - clean(address); - return argon2Output(B, p, laneLen, dkLen); -} -/** - * Argon2d GPU-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2d. - * ```ts - * argon2d('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2d = (password, salt, opts) => argon2(AT.Argond2d, password, salt, opts); -/** - * Argon2i side-channel-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2i. - * ```ts - * argon2i('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2i = (password, salt, opts) => argon2(AT.Argon2i, password, salt, opts); -/** - * Argon2id, combining i+d, the most popular version from RFC 9106. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2id. - * ```ts - * argon2id('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2id = (password, salt, opts) => argon2(AT.Argon2id, password, salt, opts); -async function argon2Async(type, password, salt, opts) { - const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick } = argon2Init(password, salt, type, opts); - // Pre-loop setup - // [address, input, zero_block] format so we can pass single U32 to block function - const address = new Uint32Array(3 * 256); - address[256 + 6] = mP; - address[256 + 8] = t; - address[256 + 10] = type; - let ts = Date.now(); - for (let r = 0; r < t; r++) { - // RFC 9106 step 6 applies the XOR-on-later-passes rule only for version `0x13`; legacy - // `0x10` keeps the older overwrite behavior used by the v16 test vectors. - const needXor = r !== 0 && version === 0x13; - address[256 + 0] = r; - for (let s = 0; s < ARGON2_SYNC_POINTS; s++) { - address[256 + 4] = s; - // RFC 9106 §3.4.1.3: Argon2id uses Argon2i's data-independent `J1` / `J2` generation only - // in pass 0, slices 0 and 1; Argon2i uses it in every segment. - const dataIndependent = type == AT.Argon2i || (type == AT.Argon2id && r === 0 && s < 2); - for (let l = 0; l < p; l++) { - address[256 + 2] = l; - address[256 + 12] = 0; - let startPos = 0; - if (r === 0 && s === 0) { - startPos = 2; - if (dataIndependent) { - address[256 + 12]++; - block(address, 256, 2 * 256, 0, false); - block(address, 0, 2 * 256, 0, false); - } - } - // current block postion - let offset = l * laneLen + s * segmentLen + startPos; - // previous block position - let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1; - for (let index = startPos; index < segmentLen; index++, offset++, prev++) { - perBlock(); - processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor); - // Date.now() is not monotonic. If the clock goes backwards, - // still yield control. - const diff = Date.now() - ts; - if (!(diff >= 0 && diff < asyncTick)) { - await nextTick(); - ts += diff; - } - } - } - } - } - clean(address); - return argon2Output(B, p, laneLen, dkLen); -} -/** - * Argon2d async GPU-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2d asynchronously. - * ```ts - * await argon2dAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2dAsync = (password, salt, opts) => argon2Async(AT.Argond2d, password, salt, opts); -/** - * Argon2i async side-channel-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2i asynchronously. - * ```ts - * await argon2iAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2iAsync = (password, salt, opts) => argon2Async(AT.Argon2i, password, salt, opts); -/** - * Argon2id async, combining i+d, the most popular version from RFC 9106. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2id asynchronously. - * ```ts - * await argon2idAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2idAsync = (password, salt, opts) => argon2Async(AT.Argon2id, password, salt, opts); -//# sourceMappingURL=argon2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/argon2.js.map b/node_modules/@noble/hashes/argon2.js.map deleted file mode 100644 index d98e07e..0000000 --- a/node_modules/@noble/hashes/argon2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"argon2.js","sourceRoot":"","sources":["src/argon2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,O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a,GAAG,CAC3B,QAAwB,EACxB,IAAoB,EACpB,IAAqB,EACM,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake1.d.ts b/node_modules/@noble/hashes/blake1.d.ts deleted file mode 100644 index 11d8782..0000000 --- a/node_modules/@noble/hashes/blake1.d.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { type CHash, type Hash, type TArg, type TRet } from './utils.ts'; -/** Blake1 options. Basically just `salt`. */ -export type BlakeOpts = { - /** Optional salt mixed into initialization. */ - salt?: Uint8Array; -}; -declare abstract class BLAKE1> implements Hash { - readonly canXOF = false; - protected finished: boolean; - protected length: number; - protected pos: number; - protected destroyed: boolean; - protected buffer: Uint8Array; - protected view: DataView; - protected salt: Uint32Array; - abstract compress(view: DataView, offset: number, withLength?: boolean): void; - protected abstract get(): number[]; - protected abstract set(...args: number[]): void; - readonly blockLen: number; - readonly outputLen: number; - private lengthFlag; - private counterLen; - protected constants: Uint32Array; - constructor(blockLen: number, outputLen: number, lengthFlag: number, counterLen: number, saltLen: number, constants: Uint32Array, opts?: BlakeOpts); - update(data: TArg): this; - destroy(): void; - _cloneInto(to?: T): T; - clone(): T; - digestInto(out: TArg): void; - digest(): TRet; -} -declare class BLAKE1_32B extends BLAKE1 { - private v0; - private v1; - private v2; - private v3; - private v4; - private v5; - private v6; - private v7; - constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts?: BlakeOpts); - protected get(): [number, number, number, number, number, number, number, number]; - protected set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number): void; - destroy(): void; - compress(view: DataView, offset: number, withLength?: boolean): void; -} -declare class BLAKE1_64B extends BLAKE1 { - private v0l; - private v0h; - private v1l; - private v1h; - private v2l; - private v2h; - private v3l; - private v3h; - private v4l; - private v4h; - private v5l; - private v5h; - private v6l; - private v6h; - private v7l; - private v7h; - constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts?: BlakeOpts); - protected get(): [ - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number - ]; - protected set(v0l: number, v0h: number, v1l: number, v1h: number, v2l: number, v2h: number, v3l: number, v3h: number, v4l: number, v4h: number, v5l: number, v5h: number, v6l: number, v6h: number, v7l: number, v7h: number): void; - destroy(): void; - compress(view: DataView, offset: number, withLength?: boolean): void; -} -/** Internal blake1-224 hash class. */ -export declare class _BLAKE224 extends BLAKE1_32B { - constructor(opts?: BlakeOpts); -} -/** Internal blake1-256 hash class. */ -export declare class _BLAKE256 extends BLAKE1_32B { - constructor(opts?: BlakeOpts); -} -/** Internal blake1-384 hash class. */ -export declare class _BLAKE384 extends BLAKE1_64B { - constructor(opts?: BlakeOpts); -} -/** Internal blake1-512 hash class. */ -export declare class _BLAKE512 extends BLAKE1_64B { - constructor(opts?: BlakeOpts); -} -/** - * Blake1-224 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 16 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-224. - * ```ts - * blake224(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const blake224: TRet>; -/** - * Blake1-256 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 16 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-256. - * ```ts - * blake256(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const blake256: TRet>; -/** - * Blake1-384 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 32 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-384. - * ```ts - * blake384(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const blake384: TRet>; -/** - * Blake1-512 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 32 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-512. - * ```ts - * blake512(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const blake512: TRet>; -export {}; -//# sourceMappingURL=blake1.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake1.d.ts.map b/node_modules/@noble/hashes/blake1.d.ts.map deleted file mode 100644 index 16d351e..0000000 --- a/node_modules/@noble/hashes/blake1.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blake1.d.ts","sourceRoot":"","sources":["src/blake1.ts"],"names":[],"mappings":"AA4BA,OAAO,EAIL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,6CAA6C;AAC7C,MAAM,MAAM,SAAS,GAAG;IACtB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAOF,uBAAe,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,CAAE,YAAW,IAAI,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,MAAM,SAAS;IACxB,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,CAAC,MAAM,SAAK;IACrB,SAAS,CAAC,GAAG,SAAK;IAClB,SAAS,CAAC,SAAS,UAAS;IAE5B,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC;IACzB,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI;IAC7E,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,MAAM,EAAE;IAClC,SAAS,CAAC,QAAQ,CAAC,GAAG,C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,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAEtD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake1.js b/node_modules/@noble/hashes/blake1.js deleted file mode 100644 index 01ff8e0..0000000 --- a/node_modules/@noble/hashes/blake1.js +++ /dev/null @@ -1,560 +0,0 @@ -/** - * Blake1 legacy hash function, one of SHA3 proposals. - * Rarely used. Check out blake2 or blake3 instead. - * {@link https://www.aumasson.jp/blake/blake.pdf} - * - * In the best case, there are 0 allocations. - * - * Differences from blake2: - * - * - BE instead of LE - * - Paddings, similar to MD5, RIPEMD, SHA1, SHA2, but: - * - length flag is located before actual length - * - padding block is compressed differently (no lengths) - * Instead of msg[sigma[k]], we have `msg[sigma[k]] ^ constants[sigma[k-1]]` - * (-1 for g1, g2 without -1) - * - Salt is XOR-ed into constants instead of state - * - Salt is XOR-ed with output in `compress` - * - Additional rows (+64 bytes) in SIGMA for new rounds - * - Different round count: - * - 14 / 10 rounds in blake256 / blake2s - * - 16 / 12 rounds in blake512 / blake2b - * - blake512: G1b: rotr 24 -> 25, G2b: rotr 63 -> 11 - * @module - */ -import { BSIGMA, G1s, G2s } from "./_blake.js"; -import { SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from "./_md.js"; -import * as u64 from "./_u64.js"; -// prettier-ignore -import { abytes, aexists, aoutput, clean, createHasher, createView } from "./utils.js"; -// Shared unsalted sentinel, sized for the 64-bit path and reused by the 32-bit path via prefix. -const EMPTY_SALT = /* @__PURE__ */ new Uint32Array(8); -// Base destroy logic only clears salt-derived state; the partial message buffer and length/position -// bookkeeping remain until the instance or backing buffer is reused. -class BLAKE1 { - canXOF = false; - finished = false; - length = 0; - pos = 0; - destroyed = false; - // For partial updates less than block size - buffer; - view; - salt; - blockLen; - outputLen; - lengthFlag; - counterLen; - constants; - constructor(blockLen, outputLen, lengthFlag, counterLen, saltLen, constants, opts = {}) { - const { salt } = opts; - this.blockLen = blockLen; - this.outputLen = outputLen; - this.lengthFlag = lengthFlag; - this.counterLen = counterLen; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - if (salt !== undefined) { - let slt = salt; - abytes(slt, 4 * saltLen, 'salt'); - // if (slt.length !== 4 * saltLen) throw new Error('wrong salt length'); - const salt32 = (this.salt = new Uint32Array(saltLen)); - const sv = createView(slt); - this.constants = constants.slice(); - for (let i = 0, offset = 0; i < salt32.length; i++, offset += 4) { - salt32[i] = sv.getUint32(offset, false); - this.constants[i] ^= salt32[i]; - } - } - else { - this.salt = EMPTY_SALT; - this.constants = constants; - } - } - update(data) { - aexists(this); - abytes(data); - // From _md, but update length before each compress - const { view, buffer, blockLen } = this; - const len = data.length; - let dataView; - for (let pos = 0; pos < len;) { - const take = Math.min(blockLen - this.pos, len - pos); - // Fast path only when there is no buffered partial block: `take === blockLen` implies - // `this.pos === 0`, so we can process full blocks directly from the input view. - if (take === blockLen) { - if (!dataView) - dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) { - this.length += blockLen; - this.compress(dataView, pos); - } - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.length += blockLen; - this.compress(view, 0, true); - this.pos = 0; - } - } - return this; - } - destroy() { - this.destroyed = true; - if (this.salt !== EMPTY_SALT) { - clean(this.salt, this.constants); - } - } - _cloneInto(to) { - to ||= new this.constructor(); - to.set(...this.get()); - const { buffer, length, finished, destroyed, constants, salt, pos } = this; - to.buffer.set(buffer); - // Clone salt-derived arrays by value so destroying the clone cannot wipe the source instance. - to.constants = constants.slice(); - to.destroyed = destroyed; - to.finished = finished; - to.length = length; - to.pos = pos; - to.salt = salt.slice(); - return to; - } - clone() { - return this._cloneInto(); - } - digestInto(out) { - aexists(this); - aoutput(out, this); - this.finished = true; - // Padding - const { buffer, blockLen, counterLen, lengthFlag, view } = this; - clean(buffer.subarray(this.pos)); // clean buf - const counter = BigInt((this.length + this.pos) * 8); - const counterPos = blockLen - counterLen - 1; - buffer[this.pos] |= 0b1000_0000; // End block flag - this.length += this.pos; // add unwritten length - // Not enough in buffer for length: write what we have. - if (this.pos > counterPos) { - this.compress(view, 0); - clean(buffer); - this.pos = 0; - } - // Difference with md: here we have lengthFlag! - buffer[counterPos] |= lengthFlag; // Length flag - // We always set 8 byte length flag. Because length will overflow significantly sooner. - view.setBigUint64(blockLen - 8, counter, false); - // Blake1 omits the counter from the extra all-padding block; only the block that still carries - // message bytes mixes in the final bit length. - this.compress(view, 0, this.pos !== 0); - // Write output - clean(buffer); - const v = createView(out); - const state = this.get(); - for (let i = 0; i < this.outputLen / 4; ++i) - v.setUint32(i * 4, state[i]); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - // Return a copy so callers do not alias the instance scratch buffer used during finalization. - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } -} -// Blake1-512 / Blake1-384 constant table `C512`. -// Stored as sixteen 64-bit constants split into `[high32, low32]` halves so -// the Blake1-64 path can reuse one layout for both `v8..v15` initialization -// and the permuted constant lookups. -const B64C = /* @__PURE__ */ Uint32Array.from([ - 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, - 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, - 0x9216d5d9, 0x8979fb1b, 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, - 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, -]); -// Blake1-256 / Blake1-224 constant table `C256`, derived as the first half of `C512`. -const B32C = /* @__PURE__ */ B64C.slice(0, 16); -// Blake1-256 IV cloned from SHA-256. -const B256_IV = /* @__PURE__ */ SHA256_IV.slice(); -// Blake1-224 IV cloned from SHA-224. -const B224_IV = /* @__PURE__ */ SHA224_IV.slice(); -// Blake1-384 IV cloned from the SHA-384 high-then-low 32-bit halves. -const B384_IV = /* @__PURE__ */ SHA384_IV.slice(); -// Blake1-512 IV cloned from the SHA-512 high-then-low 32-bit halves. -const B512_IV = /* @__PURE__ */ SHA512_IV.slice(); -// Precompute the odd/even companion constants used by all 14 Blake1-32 rounds. -// Each pair stores `u[sigma[2i + 1]]` then `u[sigma[2i]]`, matching the `G1s` / `G2s` xor order. -function generateTBL256() { - const TBL = []; - for (let i = 0, j = 0; i < 14; i++, j += 16) { - for (let offset = 1; offset < 16; offset += 2) { - TBL.push(B32C[BSIGMA[j + offset]]); - TBL.push(B32C[BSIGMA[j + offset - 1]]); - } - } - return new Uint32Array(TBL); -} -// Full 14-round companion-constant table for Blake1-32. -const TBL256 = /* @__PURE__ */ generateTBL256(); -// Shared synchronous message-word scratch for the 32-bit Blake1 path. -const BLAKE256_W = /* @__PURE__ */ new Uint32Array(16); -class BLAKE1_32B extends BLAKE1 { - v0; - v1; - v2; - v3; - v4; - v5; - v6; - v7; - constructor(outputLen, IV, lengthFlag, opts = {}) { - super(64, outputLen, lengthFlag, 8, 4, B32C, opts); - this.v0 = IV[0] | 0; - this.v1 = IV[1] | 0; - this.v2 = IV[2] | 0; - this.v3 = IV[3] | 0; - this.v4 = IV[4] | 0; - this.v5 = IV[5] | 0; - this.v6 = IV[6] | 0; - this.v7 = IV[7] | 0; - } - get() { - const { v0, v1, v2, v3, v4, v5, v6, v7 } = this; - return [v0, v1, v2, v3, v4, v5, v6, v7]; - } - // prettier-ignore - set(v0, v1, v2, v3, v4, v5, v6, v7) { - this.v0 = v0 | 0; - this.v1 = v1 | 0; - this.v2 = v2 | 0; - this.v3 = v3 | 0; - this.v4 = v4 | 0; - this.v5 = v5 | 0; - this.v6 = v6 | 0; - this.v7 = v7 | 0; - } - destroy() { - super.destroy(); - this.set(0, 0, 0, 0, 0, 0, 0, 0); - } - compress(view, offset, withLength = true) { - for (let i = 0; i < 16; i++, offset += 4) - BLAKE256_W[i] = view.getUint32(offset, false); - // Cannot reuse blake2s compress: Blake1 mixes each message word with the companion constants - // precomputed in `TBL256`, rather than using the raw schedule words directly. - let v00 = this.v0 | 0; - let v01 = this.v1 | 0; - let v02 = this.v2 | 0; - let v03 = this.v3 | 0; - let v04 = this.v4 | 0; - let v05 = this.v5 | 0; - let v06 = this.v6 | 0; - let v07 = this.v7 | 0; - let v08 = this.constants[0] | 0; - let v09 = this.constants[1] | 0; - let v10 = this.constants[2] | 0; - let v11 = this.constants[3] | 0; - // Blake1-32 injects the 64-bit bit counter as `[t0, t0, t1, t1]` across `v12..v15`; the - // final all-padding block passes `withLength = false`, leaving these lanes as raw constants. - const { h, l } = u64.fromBig(BigInt(withLength ? this.length * 8 : 0)); - let v12 = (this.constants[4] ^ l) >>> 0; - let v13 = (this.constants[5] ^ l) >>> 0; - let v14 = (this.constants[6] ^ h) >>> 0; - let v15 = (this.constants[7] ^ h) >>> 0; - // prettier-ignore - for (let i = 0, k = 0, j = 0; i < 14; i++) { - ({ a: v00, b: v04, c: v08, d: v12 } = G1s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v00, b: v04, c: v08, d: v12 } = G2s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v01, b: v05, c: v09, d: v13 } = G1s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v01, b: v05, c: v09, d: v13 } = G2s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v02, b: v06, c: v10, d: v14 } = G1s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v02, b: v06, c: v10, d: v14 } = G2s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v03, b: v07, c: v11, d: v15 } = G1s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v03, b: v07, c: v11, d: v15 } = G2s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v00, b: v05, c: v10, d: v15 } = G1s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v00, b: v05, c: v10, d: v15 } = G2s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v01, b: v06, c: v11, d: v12 } = G1s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v01, b: v06, c: v11, d: v12 } = G2s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v02, b: v07, c: v08, d: v13 } = G1s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v02, b: v07, c: v08, d: v13 } = G2s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v03, b: v04, c: v09, d: v14 } = G1s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v03, b: v04, c: v09, d: v14 } = G2s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - } - this.v0 = (this.v0 ^ v00 ^ v08 ^ this.salt[0]) >>> 0; - this.v1 = (this.v1 ^ v01 ^ v09 ^ this.salt[1]) >>> 0; - this.v2 = (this.v2 ^ v02 ^ v10 ^ this.salt[2]) >>> 0; - this.v3 = (this.v3 ^ v03 ^ v11 ^ this.salt[3]) >>> 0; - this.v4 = (this.v4 ^ v04 ^ v12 ^ this.salt[0]) >>> 0; - this.v5 = (this.v5 ^ v05 ^ v13 ^ this.salt[1]) >>> 0; - this.v6 = (this.v6 ^ v06 ^ v14 ^ this.salt[2]) >>> 0; - this.v7 = (this.v7 ^ v07 ^ v15 ^ this.salt[3]) >>> 0; - clean(BLAKE256_W); - } -} -// Shared Blake1-64 work vector storing 16 working words as adjacent high/low 32-bit halves. -const BBUF = /* @__PURE__ */ new Uint32Array(32); -// Shared synchronous message-word scratch for the 64-bit Blake1 path. -const BLAKE512_W = /* @__PURE__ */ new Uint32Array(32); -// Precompute the high/low companion constants used by all 16 Blake1-64 rounds. -// Each quartet stores `u[sigma[2i + 1]]` high/low halves, then `u[sigma[2i]]` high/low halves. -function generateTBL512() { - const TBL = []; - for (let r = 0, k = 0; r < 16; r++, k += 16) { - for (let offset = 1; offset < 16; offset += 2) { - TBL.push(B64C[BSIGMA[k + offset] * 2 + 0]); - TBL.push(B64C[BSIGMA[k + offset] * 2 + 1]); - TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 0]); - TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 1]); - } - } - return new Uint32Array(TBL); -} -// Full 16-round companion-constant table as high/low halves. -const TBL512 = /* @__PURE__ */ generateTBL512(); -// Blake1-64 first half-round with rotations `32` and `25`; `k` is the half-call schedule index. -function G1b(a, b, c, d, msg, k) { - const Xpos = 2 * BSIGMA[k]; - const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore - let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore - let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore - let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore - let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore - // v[a] = (v[a] + v[b] + x) | 0; - let ll = u64.add3L(Al, Bl, Xl); - Ah = u64.add3H(ll, Ah, Bh, Xh) >>> 0; - Al = (ll | 0) >>> 0; - // v[d] = rotr(v[d] ^ v[a], 32) - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) }); - // v[c] = (v[c] + v[d]) | 0; - ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); - // v[b] = rotr(v[b] ^ v[c], 25) - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 25), Bl: u64.rotrSL(Bh, Bl, 25) }); - ((BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah)); - ((BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh)); - ((BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch)); - ((BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh)); -} -// Blake1-64 second half-round with rotations `16` and `11`; `k` is the half-call schedule index. -function G2b(a, b, c, d, msg, k) { - const Xpos = 2 * BSIGMA[k]; - const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore - let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore - let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore - let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore - let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore - // v[a] = (v[a] + v[b] + x) | 0; - let ll = u64.add3L(Al, Bl, Xl); - Ah = u64.add3H(ll, Ah, Bh, Xh); - Al = ll | 0; - // v[d] = rotr(v[d] ^ v[a], 16) - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) }); - // v[c] = (v[c] + v[d]) | 0; - ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); - // v[b] = rotr(v[b] ^ v[c], 11) - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 11), Bl: u64.rotrSL(Bh, Bl, 11) }); - ((BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah)); - ((BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh)); - ((BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch)); - ((BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh)); -} -// Legacy field names keep the local `l/h` spelling, but array/state order stays `[high, low]` to -// match the IV tables and `BBUF` layout. -class BLAKE1_64B extends BLAKE1 { - v0l; - v0h; - v1l; - v1h; - v2l; - v2h; - v3l; - v3h; - v4l; - v4h; - v5l; - v5h; - v6l; - v6h; - v7l; - v7h; - constructor(outputLen, IV, lengthFlag, opts = {}) { - super(128, outputLen, lengthFlag, 16, 8, B64C, opts); - this.v0l = IV[0] | 0; - this.v0h = IV[1] | 0; - this.v1l = IV[2] | 0; - this.v1h = IV[3] | 0; - this.v2l = IV[4] | 0; - this.v2h = IV[5] | 0; - this.v3l = IV[6] | 0; - this.v3h = IV[7] | 0; - this.v4l = IV[8] | 0; - this.v4h = IV[9] | 0; - this.v5l = IV[10] | 0; - this.v5h = IV[11] | 0; - this.v6l = IV[12] | 0; - this.v6h = IV[13] | 0; - this.v7l = IV[14] | 0; - this.v7h = IV[15] | 0; - } - // prettier-ignore - get() { - let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this; - return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h]; - } - // prettier-ignore - set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) { - this.v0l = v0l | 0; - this.v0h = v0h | 0; - this.v1l = v1l | 0; - this.v1h = v1h | 0; - this.v2l = v2l | 0; - this.v2h = v2h | 0; - this.v3l = v3l | 0; - this.v3h = v3h | 0; - this.v4l = v4l | 0; - this.v4h = v4h | 0; - this.v5l = v5l | 0; - this.v5h = v5h | 0; - this.v6l = v6l | 0; - this.v6h = v6h | 0; - this.v7l = v7l | 0; - this.v7h = v7h | 0; - } - destroy() { - super.destroy(); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } - compress(view, offset, withLength = true) { - for (let i = 0; i < 32; i++, offset += 4) - BLAKE512_W[i] = view.getUint32(offset, false); - this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state. - BBUF.set(this.constants.subarray(0, 16), 16); - if (withLength) { - // Blake1-64 injects the 64-bit bit counter into `v12` and `v13`; the final all-padding - // block passes `withLength = false`, leaving the trailing constant lanes untouched. - const { h, l } = u64.fromBig(BigInt(this.length * 8)); - BBUF[24] = (BBUF[24] ^ h) >>> 0; - BBUF[25] = (BBUF[25] ^ l) >>> 0; - BBUF[26] = (BBUF[26] ^ h) >>> 0; - BBUF[27] = (BBUF[27] ^ l) >>> 0; - } - for (let i = 0, k = 0; i < 16; i++) { - G1b(0, 4, 8, 12, BLAKE512_W, k++); - G2b(0, 4, 8, 12, BLAKE512_W, k++); - G1b(1, 5, 9, 13, BLAKE512_W, k++); - G2b(1, 5, 9, 13, BLAKE512_W, k++); - G1b(2, 6, 10, 14, BLAKE512_W, k++); - G2b(2, 6, 10, 14, BLAKE512_W, k++); - G1b(3, 7, 11, 15, BLAKE512_W, k++); - G2b(3, 7, 11, 15, BLAKE512_W, k++); - G1b(0, 5, 10, 15, BLAKE512_W, k++); - G2b(0, 5, 10, 15, BLAKE512_W, k++); - G1b(1, 6, 11, 12, BLAKE512_W, k++); - G2b(1, 6, 11, 12, BLAKE512_W, k++); - G1b(2, 7, 8, 13, BLAKE512_W, k++); - G2b(2, 7, 8, 13, BLAKE512_W, k++); - G1b(3, 4, 9, 14, BLAKE512_W, k++); - G2b(3, 4, 9, 14, BLAKE512_W, k++); - } - this.v0l ^= BBUF[0] ^ BBUF[16] ^ this.salt[0]; - this.v0h ^= BBUF[1] ^ BBUF[17] ^ this.salt[1]; - this.v1l ^= BBUF[2] ^ BBUF[18] ^ this.salt[2]; - this.v1h ^= BBUF[3] ^ BBUF[19] ^ this.salt[3]; - this.v2l ^= BBUF[4] ^ BBUF[20] ^ this.salt[4]; - this.v2h ^= BBUF[5] ^ BBUF[21] ^ this.salt[5]; - this.v3l ^= BBUF[6] ^ BBUF[22] ^ this.salt[6]; - this.v3h ^= BBUF[7] ^ BBUF[23] ^ this.salt[7]; - this.v4l ^= BBUF[8] ^ BBUF[24] ^ this.salt[0]; - this.v4h ^= BBUF[9] ^ BBUF[25] ^ this.salt[1]; - this.v5l ^= BBUF[10] ^ BBUF[26] ^ this.salt[2]; - this.v5h ^= BBUF[11] ^ BBUF[27] ^ this.salt[3]; - this.v6l ^= BBUF[12] ^ BBUF[28] ^ this.salt[4]; - this.v6h ^= BBUF[13] ^ BBUF[29] ^ this.salt[5]; - this.v7l ^= BBUF[14] ^ BBUF[30] ^ this.salt[6]; - this.v7h ^= BBUF[15] ^ BBUF[31] ^ this.salt[7]; - clean(BBUF, BLAKE512_W); - } -} -/** Internal blake1-224 hash class. */ -export class _BLAKE224 extends BLAKE1_32B { - constructor(opts = {}) { - super(28, B224_IV, 0b0000_0000, opts); - } -} -/** Internal blake1-256 hash class. */ -export class _BLAKE256 extends BLAKE1_32B { - constructor(opts = {}) { - super(32, B256_IV, 0b0000_0001, opts); - } -} -/** Internal blake1-384 hash class. */ -export class _BLAKE384 extends BLAKE1_64B { - constructor(opts = {}) { - super(48, B384_IV, 0b0000_0000, opts); - } -} -/** Internal blake1-512 hash class. */ -export class _BLAKE512 extends BLAKE1_64B { - constructor(opts = {}) { - super(64, B512_IV, 0b0000_0001, opts); - } -} -/** - * Blake1-224 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 16 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-224. - * ```ts - * blake224(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake224 = /* @__PURE__ */ createHasher((opts) => new _BLAKE224(opts)); -/** - * Blake1-256 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 16 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-256. - * ```ts - * blake256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake256 = /* @__PURE__ */ createHasher((opts) => new _BLAKE256(opts)); -/** - * Blake1-384 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 32 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-384. - * ```ts - * blake384(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake384 = /* @__PURE__ */ createHasher((opts) => new _BLAKE384(opts)); -/** - * Blake1-512 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 32 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-512. - * ```ts - * blake512(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake512 = /* @__PURE__ */ createHasher((opts) => new _BLAKE512(opts)); -//# sourceMappingURL=blake1.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake1.js.map b/node_modules/@noble/hashes/blake1.js.map deleted file mode 100644 index 496638d..0000000 --- a/node_modules/@noble/hashes/blake1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blake1.js","sourceRoot":"","sources":["src/blake1.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,KAAK,GAAG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U,SAAQ,UAAU;IACvC,YAAY,OAAkB,EAAE;QAC9B,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;CACF;AACD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAsC,eAAe,CAAC,YAAY,CACrF,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAC9B,CAAC;AACF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAsC,eAAe,CAAC,YAAY,CACrF,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAC9B,CAAC;AACF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAsC,eAAe,CAAC,YAAY,CACrF,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAC9B,CAAC;AACF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAsC,eAAe,CAAC,YAAY,CACrF,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAC9B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake2.d.ts b/node_modules/@noble/hashes/blake2.d.ts deleted file mode 100644 index ff66cdb..0000000 --- a/node_modules/@noble/hashes/blake2.d.ts +++ /dev/null @@ -1,184 +0,0 @@ -import { type CHash, type Hash, type TArg, type TRet } from './utils.ts'; -/** - * Blake hash options. - * `dkLen` is output length. `key` is used in MAC mode. `salt` is used in - * KDF mode. - */ -export type Blake2Opts = { - /** Desired digest length in bytes. RFC 7693 uses 1..64 for blake2b and 1..32 for blake2s. */ - dkLen?: number; - /** Optional MAC key. */ - key?: Uint8Array; - /** Optional salt mixed into initialization. */ - salt?: Uint8Array; - /** Optional personalization bytes. */ - personalization?: Uint8Array; -}; -/** Internal base class for BLAKE2. */ -export declare abstract class _BLAKE2> implements Hash { - protected abstract compress(msg: Uint32Array, offset: number, isLast: boolean): void; - protected abstract get(): number[]; - protected abstract set(...args: number[]): void; - abstract destroy(): void; - protected buffer: Uint8Array; - protected buffer32: Uint32Array; - protected finished: boolean; - protected destroyed: boolean; - protected length: number; - protected pos: number; - readonly blockLen: number; - readonly outputLen: number; - readonly canXOF: boolean; - constructor(blockLen: number, outputLen: number); - update(data: TArg): this; - digestInto(out: TArg): void; - digest(): TRet; - _cloneInto(to?: T): T; - clone(): T; -} -/** Internal blake2b hash class with state stored as LE u32 low/high halves. */ -export declare class _BLAKE2b extends _BLAKE2<_BLAKE2b> { - private v0l; - private v0h; - private v1l; - private v1h; - private v2l; - private v2h; - private v3l; - private v3h; - private v4l; - private v4h; - private v5l; - private v5h; - private v6l; - private v6h; - private v7l; - private v7h; - constructor(opts?: Blake2Opts); - protected get(): [ - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number - ]; - protected set(v0l: number, v0h: number, v1l: number, v1h: number, v2l: number, v2h: number, v3l: number, v3h: number, v4l: number, v4h: number, v5l: number, v5h: number, v6l: number, v6h: number, v7l: number, v7h: number): void; - protected compress(msg: Uint32Array, offset: number, isLast: boolean): void; - destroy(): void; -} -/** - * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS. - * @param msg - message that would be hashed - * @param opts - Optional output, MAC, salt, and personalization settings. - * `dkLen` must be 1..64 bytes; `salt` and `personalization`, if present, - * must be 16 bytes each. See {@link Blake2Opts}. - * @returns Digest bytes. - * @example - * Hash a message with Blake2b. - * ```ts - * blake2b(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const blake2b: TRet>; -/** Internal type, 16 numbers. */ -export type _Num16 = { - v0: number; - v1: number; - v2: number; - v3: number; - v4: number; - v5: number; - v6: number; - v7: number; - v8: number; - v9: number; - v10: number; - v11: number; - v12: number; - v13: number; - v14: number; - v15: number; -}; -/** - * BLAKE2-compress core method. - * Runs only the round function over a caller-supplied local vector; callers initialize `v0..v15` - * and apply the final `h[i] ^= v[i] ^ v[i + 8]` fold themselves. - * @param s - flattened sigma schedule bytes - * @param offset - starting word offset inside `msg`, not a byte offset - * @param msg - message words - * @param rounds - round count to execute - * @param v0 - state word 0 - * @param v1 - state word 1 - * @param v2 - state word 2 - * @param v3 - state word 3 - * @param v4 - state word 4 - * @param v5 - state word 5 - * @param v6 - state word 6 - * @param v7 - state word 7 - * @param v8 - state word 8 - * @param v9 - state word 9 - * @param v10 - state word 10 - * @param v11 - state word 11 - * @param v12 - state word 12 - * @param v13 - state word 13 - * @param v14 - state word 14 - * @param v15 - state word 15 - * @returns Updated compression state words. - * @example - * Run the BLAKE2 compression core on zeroed state and message words. - * ```ts - * import { compress } from '@noble/hashes/blake2.js'; - * const state = compress( - * new Uint8Array(16), - * 0, - * new Uint32Array(16), - * 1, - * 0, 0, 0, 0, 0, 0, 0, 0, - * 0, 0, 0, 0, 0, 0, 0, 0 - * ); - * state.v0; - * ``` - */ -export declare function compress(s: TArg, offset: number, msg: TArg, rounds: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number): _Num16; -/** Internal blake2s hash class. */ -export declare class _BLAKE2s extends _BLAKE2<_BLAKE2s> { - private v0; - private v1; - private v2; - private v3; - private v4; - private v5; - private v6; - private v7; - constructor(opts?: Blake2Opts); - protected get(): [number, number, number, number, number, number, number, number]; - protected set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number): void; - protected compress(msg: Uint32Array, offset: number, isLast: boolean): void; - destroy(): void; -} -/** - * Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS. - * @param msg - message that would be hashed - * @param opts - Optional output, MAC, salt, and personalization settings. - * `dkLen` must be 1..32 bytes; `salt` and `personalization`, if present, - * must be 8 bytes each. See {@link Blake2Opts}. - * @returns Digest bytes. - * @example - * Hash a message with Blake2s. - * ```ts - * blake2s(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const blake2s: TRet>; -//# sourceMappingURL=blake2.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake2.d.ts.map b/node_modules/@noble/hashes/blake2.d.ts.map deleted file mode 100644 index 947c111..0000000 --- a/node_modules/@noble/hashes/blake2.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blake2.d.ts","sourceRoot":"","sources":["src/blake2.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,sCAAsC;IACtC,eAAe,CAAC,EAAE,UAAU,CAAC;CAC9B,CAAC;AAiFF,sCAAsC;AACtC,8BAAsB,OAAO,CAAC,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,CAAE,YAAW,IAAI,CAAC,CAAC,CAAC;IACpE,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IACpF,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,MAAM,EAAE;IAClC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAC/C,QAAQ,CAAC,OAAO,IAAI,IAAI;IACxB,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC;IAChC,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,C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,EAAE,MAAM,EAAE,MAAM,CAAC;IAKjF,SAAS,CAAC,GAAG,CACX,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAC7F,IAAI;IAUP,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAoB3E,OAAO,IAAI,IAAI;CAKhB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,CAErD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake2.js b/node_modules/@noble/hashes/blake2.js deleted file mode 100644 index 7c80cef..0000000 --- a/node_modules/@noble/hashes/blake2.js +++ /dev/null @@ -1,501 +0,0 @@ -/** - * blake2b (64-bit) & blake2s (8 to 32-bit) hash functions. - * b could have been faster, but there is no fast u64 in js, so s is 1.5x faster. - * @module - */ -import { BSIGMA, G1s, G2s } from "./_blake.js"; -import { SHA256_IV } from "./_md.js"; -import * as u64 from "./_u64.js"; -// prettier-ignore -import { abytes, aexists, anumber, aoutput, clean, createHasher, swap32IfBE, swap8IfBE, u32 } from "./utils.js"; -// Same IV words as `SHA512_IV`, but endian-swapped into LE u32 low/high halves -// for the BLAKE2b u64 helpers below. -const B2B_IV = /* @__PURE__ */ Uint32Array.from([ - 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, - 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19, -]); -// Shared synchronous BLAKE2b work vector as LE u32 low/high halves. -const BBUF = /* @__PURE__ */ new Uint32Array(32); -// BLAKE2b G mix split into two half-rounds over LE u32 low/high limbs. -function G1b(a, b, c, d, msg, x) { - // NOTE: V is LE here - const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore - let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore - let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore - let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore - let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore - // v[a] = (v[a] + v[b] + x) | 0; - let ll = u64.add3L(Al, Bl, Xl); - Ah = u64.add3H(ll, Ah, Bh, Xh); - Al = ll | 0; - // v[d] = rotr(v[d] ^ v[a], 32) - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) }); - // v[c] = (v[c] + v[d]) | 0; - ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); - // v[b] = rotr(v[b] ^ v[c], 24) - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 24), Bl: u64.rotrSL(Bh, Bl, 24) }); - ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah)); - ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh)); - ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch)); - ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh)); -} -// Second half-round of the same LE-limb BLAKE2b G mix; `x` is the message word offset. -function G2b(a, b, c, d, msg, x) { - // NOTE: V is LE here - const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore - let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore - let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore - let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore - let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore - // v[a] = (v[a] + v[b] + x) | 0; - let ll = u64.add3L(Al, Bl, Xl); - Ah = u64.add3H(ll, Ah, Bh, Xh); - Al = ll | 0; - // v[d] = rotr(v[d] ^ v[a], 16) - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) }); - // v[c] = (v[c] + v[d]) | 0; - ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); - // v[b] = rotr(v[b] ^ v[c], 63) - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: u64.rotrBH(Bh, Bl, 63), Bl: u64.rotrBL(Bh, Bl, 63) }); - ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah)); - ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh)); - ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch)); - ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh)); -} -function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) { - anumber(keyLen); - // RFC 7693 §2.1 requires digest length nn in 1..keyLen. - if (outputLen <= 0 || outputLen > keyLen) - throw new Error('outputLen bigger than keyLen'); - const { key, salt, personalization } = opts; - // This API uses `undefined` for the RFC 7693 `kk = 0` case, so a provided key must be non-empty. - if (key !== undefined && (key.length < 1 || key.length > keyLen)) - throw new Error('"key" expected to be undefined or of length=1..' + keyLen); - if (salt !== undefined) - abytes(salt, saltLen, 'salt'); - if (personalization !== undefined) - abytes(personalization, persLen, 'personalization'); -} -/** Internal base class for BLAKE2. */ -export class _BLAKE2 { - buffer; - buffer32; - finished = false; - destroyed = false; - length = 0; - pos = 0; - blockLen; - outputLen; - canXOF = false; - constructor(blockLen, outputLen) { - anumber(blockLen); - anumber(outputLen); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.buffer = new Uint8Array(blockLen); - this.buffer32 = u32(this.buffer); - } - update(data) { - aexists(this); - abytes(data); - // Main difference with other hashes: there is flag for last block, - // so we cannot process current block before we know that there - // is the next one. This significantly complicates logic and reduces ability - // to do zero-copy processing - const { blockLen, buffer, buffer32 } = this; - const len = data.length; - const offset = data.byteOffset; - const buf = data.buffer; - for (let pos = 0; pos < len;) { - // If buffer is full and we still have input (don't process last block, same as blake2s) - if (this.pos === blockLen) { - swap32IfBE(buffer32); - this.compress(buffer32, 0, false); - swap32IfBE(buffer32); - this.pos = 0; - } - const take = Math.min(blockLen - this.pos, len - pos); - const dataOffset = offset + pos; - // Zero-copy only for full, 4-byte-aligned, non-final blocks. - if (take === blockLen && !(dataOffset % 4) && pos + take < len) { - const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4)); - swap32IfBE(data32); - for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) { - this.length += blockLen; - this.compress(data32, pos32, false); - } - swap32IfBE(data32); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - this.length += take; - pos += take; - } - return this; - } - digestInto(out) { - aexists(this); - aoutput(out, this); - const { pos, buffer32 } = this; - this.finished = true; - // Padding - clean(this.buffer.subarray(pos)); - swap32IfBE(buffer32); - this.compress(buffer32, 0, true); - swap32IfBE(buffer32); - // Reject unaligned views explicitly instead of hiding them behind a full scratch copy. - if (out.byteOffset & 3) - throw new RangeError('"digestInto() output" expected 4-byte aligned byteOffset, got ' + out.byteOffset); - const state = this.get(); - const out32 = u32(out); - const full = Math.floor(this.outputLen / 4); - for (let i = 0; i < full; i++) - out32[i] = swap8IfBE(state[i]); - const tail = this.outputLen % 4; - if (!tail) - return; - const off = full * 4; - const word = state[full]; - for (let i = 0; i < tail; i++) - out[off + i] = word >>> (8 * i); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - // Return a copy so callers do not alias the instance scratch buffer used during finalization. - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - const { buffer, length, finished, destroyed, outputLen, pos } = this; - // Recreate only `dkLen`; key/salt/personalization are already absorbed into the copied state. - to ||= new this.constructor({ dkLen: outputLen }); - to.set(...this.get()); - to.buffer.set(buffer); - to.destroyed = destroyed; - to.finished = finished; - to.length = length; - to.pos = pos; - // @ts-ignore - to.outputLen = outputLen; - return to; - } - clone() { - return this._cloneInto(); - } -} -/** Internal blake2b hash class with state stored as LE u32 low/high halves. */ -export class _BLAKE2b extends _BLAKE2 { - // Same IV words as SHA-512 / BLAKE2b, encoded as LE u32 low/high halves. - v0l = B2B_IV[0] | 0; - v0h = B2B_IV[1] | 0; - v1l = B2B_IV[2] | 0; - v1h = B2B_IV[3] | 0; - v2l = B2B_IV[4] | 0; - v2h = B2B_IV[5] | 0; - v3l = B2B_IV[6] | 0; - v3h = B2B_IV[7] | 0; - v4l = B2B_IV[8] | 0; - v4h = B2B_IV[9] | 0; - v5l = B2B_IV[10] | 0; - v5h = B2B_IV[11] | 0; - v6l = B2B_IV[12] | 0; - v6h = B2B_IV[13] | 0; - v7l = B2B_IV[14] | 0; - v7h = B2B_IV[15] | 0; - constructor(opts = {}) { - const olen = opts.dkLen === undefined ? 64 : opts.dkLen; - super(128, olen); - checkBlake2Opts(olen, opts, 64, 16, 16); - let { key, personalization, salt } = opts; - let keyLength = 0; - if (key !== undefined) { - abytes(key, undefined, 'key'); - keyLength = key.length; - } - // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` into the low 32 bits of `h[0]`; - // the high 32 bits stay at `IV[0]`. - this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24); - if (salt !== undefined) { - abytes(salt, undefined, 'salt'); - const slt = u32(salt); - this.v4l ^= swap8IfBE(slt[0]); - this.v4h ^= swap8IfBE(slt[1]); - this.v5l ^= swap8IfBE(slt[2]); - this.v5h ^= swap8IfBE(slt[3]); - } - if (personalization !== undefined) { - abytes(personalization, undefined, 'personalization'); - const pers = u32(personalization); - this.v6l ^= swap8IfBE(pers[0]); - this.v6h ^= swap8IfBE(pers[1]); - this.v7l ^= swap8IfBE(pers[2]); - this.v7h ^= swap8IfBE(pers[3]); - } - if (key !== undefined) { - // Pad to blockLen and update - const tmp = new Uint8Array(this.blockLen); - tmp.set(key); - this.update(tmp); - } - } - // prettier-ignore - get() { - let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this; - return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h]; - } - // prettier-ignore - set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) { - this.v0l = v0l | 0; - this.v0h = v0h | 0; - this.v1l = v1l | 0; - this.v1h = v1h | 0; - this.v2l = v2l | 0; - this.v2h = v2h | 0; - this.v3l = v3l | 0; - this.v3h = v3h | 0; - this.v4l = v4l | 0; - this.v4h = v4h | 0; - this.v5l = v5l | 0; - this.v5h = v5h | 0; - this.v6l = v6l | 0; - this.v6h = v6h | 0; - this.v7l = v7l | 0; - this.v7h = v7h | 0; - } - compress(msg, offset, isLast) { - this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state. - BBUF.set(B2B_IV, 16); // Second half from IV. - let { h, l } = u64.fromBig(BigInt(this.length)); - BBUF[24] = B2B_IV[8] ^ l; // Low word of the offset. - BBUF[25] = B2B_IV[9] ^ h; // High word. - // Invert all bits for last block - if (isLast) { - BBUF[28] = ~BBUF[28]; - BBUF[29] = ~BBUF[29]; - } - let j = 0; - const s = BSIGMA; - // SIGMA selects 64-bit message words; multiply by 2 because `msg` stores - // each word as [low32, high32]. - for (let i = 0; i < 12; i++) { - G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]); - G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]); - G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]); - G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]); - G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]); - G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]); - G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]); - G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]); - G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]); - G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]); - G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]); - G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]); - G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]); - G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]); - G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]); - G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]); - } - this.v0l ^= BBUF[0] ^ BBUF[16]; - this.v0h ^= BBUF[1] ^ BBUF[17]; - this.v1l ^= BBUF[2] ^ BBUF[18]; - this.v1h ^= BBUF[3] ^ BBUF[19]; - this.v2l ^= BBUF[4] ^ BBUF[20]; - this.v2h ^= BBUF[5] ^ BBUF[21]; - this.v3l ^= BBUF[6] ^ BBUF[22]; - this.v3h ^= BBUF[7] ^ BBUF[23]; - this.v4l ^= BBUF[8] ^ BBUF[24]; - this.v4h ^= BBUF[9] ^ BBUF[25]; - this.v5l ^= BBUF[10] ^ BBUF[26]; - this.v5h ^= BBUF[11] ^ BBUF[27]; - this.v6l ^= BBUF[12] ^ BBUF[28]; - this.v6h ^= BBUF[13] ^ BBUF[29]; - this.v7l ^= BBUF[14] ^ BBUF[30]; - this.v7h ^= BBUF[15] ^ BBUF[31]; - clean(BBUF); - } - destroy() { - this.destroyed = true; - clean(this.buffer32); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } -} -/** - * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS. - * @param msg - message that would be hashed - * @param opts - Optional output, MAC, salt, and personalization settings. - * `dkLen` must be 1..64 bytes; `salt` and `personalization`, if present, - * must be 16 bytes each. See {@link Blake2Opts}. - * @returns Digest bytes. - * @example - * Hash a message with Blake2b. - * ```ts - * blake2b(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts)); -/** - * BLAKE2-compress core method. - * Runs only the round function over a caller-supplied local vector; callers initialize `v0..v15` - * and apply the final `h[i] ^= v[i] ^ v[i + 8]` fold themselves. - * @param s - flattened sigma schedule bytes - * @param offset - starting word offset inside `msg`, not a byte offset - * @param msg - message words - * @param rounds - round count to execute - * @param v0 - state word 0 - * @param v1 - state word 1 - * @param v2 - state word 2 - * @param v3 - state word 3 - * @param v4 - state word 4 - * @param v5 - state word 5 - * @param v6 - state word 6 - * @param v7 - state word 7 - * @param v8 - state word 8 - * @param v9 - state word 9 - * @param v10 - state word 10 - * @param v11 - state word 11 - * @param v12 - state word 12 - * @param v13 - state word 13 - * @param v14 - state word 14 - * @param v15 - state word 15 - * @returns Updated compression state words. - * @example - * Run the BLAKE2 compression core on zeroed state and message words. - * ```ts - * import { compress } from '@noble/hashes/blake2.js'; - * const state = compress( - * new Uint8Array(16), - * 0, - * new Uint32Array(16), - * 1, - * 0, 0, 0, 0, 0, 0, 0, 0, - * 0, 0, 0, 0, 0, 0, 0, 0 - * ); - * state.v0; - * ``` - */ -// prettier-ignore -export function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) { - let j = 0; - for (let i = 0; i < rounds; i++) { - ({ a: v0, b: v4, c: v8, d: v12 } = G1s(v0, v4, v8, v12, msg[offset + s[j++]])); - ({ a: v0, b: v4, c: v8, d: v12 } = G2s(v0, v4, v8, v12, msg[offset + s[j++]])); - ({ a: v1, b: v5, c: v9, d: v13 } = G1s(v1, v5, v9, v13, msg[offset + s[j++]])); - ({ a: v1, b: v5, c: v9, d: v13 } = G2s(v1, v5, v9, v13, msg[offset + s[j++]])); - ({ a: v2, b: v6, c: v10, d: v14 } = G1s(v2, v6, v10, v14, msg[offset + s[j++]])); - ({ a: v2, b: v6, c: v10, d: v14 } = G2s(v2, v6, v10, v14, msg[offset + s[j++]])); - ({ a: v3, b: v7, c: v11, d: v15 } = G1s(v3, v7, v11, v15, msg[offset + s[j++]])); - ({ a: v3, b: v7, c: v11, d: v15 } = G2s(v3, v7, v11, v15, msg[offset + s[j++]])); - ({ a: v0, b: v5, c: v10, d: v15 } = G1s(v0, v5, v10, v15, msg[offset + s[j++]])); - ({ a: v0, b: v5, c: v10, d: v15 } = G2s(v0, v5, v10, v15, msg[offset + s[j++]])); - ({ a: v1, b: v6, c: v11, d: v12 } = G1s(v1, v6, v11, v12, msg[offset + s[j++]])); - ({ a: v1, b: v6, c: v11, d: v12 } = G2s(v1, v6, v11, v12, msg[offset + s[j++]])); - ({ a: v2, b: v7, c: v8, d: v13 } = G1s(v2, v7, v8, v13, msg[offset + s[j++]])); - ({ a: v2, b: v7, c: v8, d: v13 } = G2s(v2, v7, v8, v13, msg[offset + s[j++]])); - ({ a: v3, b: v4, c: v9, d: v14 } = G1s(v3, v4, v9, v14, msg[offset + s[j++]])); - ({ a: v3, b: v4, c: v9, d: v14 } = G2s(v3, v4, v9, v14, msg[offset + s[j++]])); - } - return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 }; -} -// Blake2s reuses the SHA-256 IV words as-is. -const B2S_IV = /* @__PURE__ */ SHA256_IV.slice(); -/** Internal blake2s hash class. */ -export class _BLAKE2s extends _BLAKE2 { - // Internal state, same as SHA-256 - v0 = B2S_IV[0] | 0; - v1 = B2S_IV[1] | 0; - v2 = B2S_IV[2] | 0; - v3 = B2S_IV[3] | 0; - v4 = B2S_IV[4] | 0; - v5 = B2S_IV[5] | 0; - v6 = B2S_IV[6] | 0; - v7 = B2S_IV[7] | 0; - constructor(opts = {}) { - const olen = opts.dkLen === undefined ? 32 : opts.dkLen; - super(64, olen); - checkBlake2Opts(olen, opts, 32, 8, 8); - let { key, personalization, salt } = opts; - let keyLength = 0; - if (key !== undefined) { - abytes(key, undefined, 'key'); - keyLength = key.length; - } - // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` directly into `h[0]`, since - // BLAKE2s stores each state word as one `u32`. - this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24); - if (salt !== undefined) { - abytes(salt, undefined, 'salt'); - const slt = u32(salt); - this.v4 ^= swap8IfBE(slt[0]); - this.v5 ^= swap8IfBE(slt[1]); - } - if (personalization !== undefined) { - abytes(personalization, undefined, 'personalization'); - const pers = u32(personalization); - this.v6 ^= swap8IfBE(pers[0]); - this.v7 ^= swap8IfBE(pers[1]); - } - if (key !== undefined) { - // Pad to blockLen and update - const tmp = new Uint8Array(this.blockLen); - tmp.set(key); - this.update(tmp); - } - } - get() { - const { v0, v1, v2, v3, v4, v5, v6, v7 } = this; - return [v0, v1, v2, v3, v4, v5, v6, v7]; - } - // prettier-ignore - set(v0, v1, v2, v3, v4, v5, v6, v7) { - this.v0 = v0 | 0; - this.v1 = v1 | 0; - this.v2 = v2 | 0; - this.v3 = v3 | 0; - this.v4 = v4 | 0; - this.v5 = v5 | 0; - this.v6 = v6 | 0; - this.v7 = v7 | 0; - } - compress(msg, offset, isLast) { - const { h, l } = u64.fromBig(BigInt(this.length)); - // Seed v8..v15 from the IV, xor the low/high 32-bit byte counter into - // v12/v13, and invert v14 on the final block. - // prettier-ignore - const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(BSIGMA, offset, msg, 10, this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7, B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], l ^ B2S_IV[4], h ^ B2S_IV[5], isLast ? ~B2S_IV[6] : B2S_IV[6], B2S_IV[7]); - this.v0 ^= v0 ^ v8; - this.v1 ^= v1 ^ v9; - this.v2 ^= v2 ^ v10; - this.v3 ^= v3 ^ v11; - this.v4 ^= v4 ^ v12; - this.v5 ^= v5 ^ v13; - this.v6 ^= v6 ^ v14; - this.v7 ^= v7 ^ v15; - } - destroy() { - this.destroyed = true; - clean(this.buffer32); - this.set(0, 0, 0, 0, 0, 0, 0, 0); - } -} -/** - * Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS. - * @param msg - message that would be hashed - * @param opts - Optional output, MAC, salt, and personalization settings. - * `dkLen` must be 1..32 bytes; `salt` and `personalization`, if present, - * must be 8 bytes each. See {@link Blake2Opts}. - * @returns Digest bytes. - * @example - * Hash a message with Blake2s. - * ```ts - * blake2s(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake2s = /* @__PURE__ */ createHasher((opts) => new _BLAKE2s(opts)); -//# sourceMappingURL=blake2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake2.js.map b/node_modules/@noble/hashes/blake2.js.map deleted file mode 100644 index 2f8733f..0000000 --- a/node_modules/@noble/hashes/blake2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blake2.js","sourceRoot":"","sources":["src/blake2.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,kBAAkB;AAClB,OAAO,EACL,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EACjC,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,SAAS,EACrB,GAAG,EAKJ,MAAM,YAAY,CAAC;AAkBpB,+EAA+E;AAC/E,qCAAqC;AACrC,MAAM,MAAM,GAAG,e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sC,eAAe,CAAC,YAAY,CACpF,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAC7B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake3.d.ts b/node_modules/@noble/hashes/blake3.d.ts deleted file mode 100644 index 1fd4cc7..0000000 --- a/node_modules/@noble/hashes/blake3.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { _BLAKE2 } from './blake2.ts'; -import { type CHashXOF, type HashXOF, type TArg, type TRet } from './utils.ts'; -/** - * Ensure to use EITHER `key` OR `context`, not both. - * - * * `key`: 32-byte MAC key. - * * `context`: caller-encoded KDF context bytes. If your protocol defines a - * string context, encode it before passing it here. - * A good default format for the original context string is - * "[application] [commit timestamp] [purpose]". - */ -export type Blake3Opts = { - /** Desired digest length in bytes. The BLAKE3 spec allows 0..2^64-1 bytes of output. */ - dkLen?: number; - /** Optional 32-byte MAC key. */ - key?: Uint8Array; - /** Optional KDF context bytes. */ - context?: Uint8Array; -}; -/** Blake3 hash. Can be used as MAC and KDF with caller-encoded context bytes. */ -export declare class _BLAKE3 extends _BLAKE2<_BLAKE3> implements HashXOF<_BLAKE3> { - readonly canXOF = true; - private chunkPos; - private chunksDone; - private flags; - private IV; - private state; - private stack; - private posOut; - private bufferOut32; - private bufferOut; - private chunkOut; - private enableXOF; - constructor(opts?: Blake3Opts, flags?: number); - protected get(): []; - protected set(): void; - private b2Compress; - protected compress(buf: Uint32Array, bufPos?: number, isLast?: boolean): void; - _cloneInto(to?: _BLAKE3): _BLAKE3; - destroy(): void; - private b2CompressOut; - protected finish(): void; - private writeInto; - xofInto(out: TArg): TRet; - xof(bytes: number): TRet; - digestInto(out: TArg): void; - digest(): TRet; -} -/** - * BLAKE3 hash function. Can be used as MAC and KDF. - * @param msg - message that would be hashed - * @param opts - Optional output, MAC, or KDF configuration. `key` must be - * exactly 32 bytes, `context` is caller-encoded bytes, and `dkLen` can be - * 0..2^64-1 via the XOF-backed output path. See {@link Blake3Opts}. - * @returns Digest bytes. - * @example - * Hash, MAC, or derive key material with BLAKE3. - * ```ts - * import { blake3 } from '@noble/hashes/blake3.js'; - * import { utf8ToBytes } from '@noble/hashes/utils.js'; - * const data = new Uint8Array(32); - * const hash = blake3(data); - * const mac = blake3(data, { key: new Uint8Array(32) }); - * const kdf = blake3(data, { context: utf8ToBytes('application name') }); - * ``` - */ -export declare const blake3: TRet>; -//# sourceMappingURL=blake3.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake3.d.ts.map b/node_modules/@noble/hashes/blake3.d.ts.map deleted file mode 100644 index 94e019e..0000000 --- a/node_modules/@noble/hashes/blake3.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blake3.d.ts","sourceRoot":"","sources":["src/blake3.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAY,MAAM,aAAa,CAAC;AAEhD,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AA4BpB;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,kCAAkC;IAClC,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB,CAAC;AAEF,iFAAiF;AACjF,qBAAa,OAAQ,SAAQ,OAAO,CAAC,OAAO,CAAE,YAAW,OAAO,CAAC,OAAO,CAAC;IACvE,QAAQ,CAAC,MAAM,QAAQ;IACvB,OAAO,CAAC,QAAQ,CAAK;IAGrB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,EAAE,CAAc;IACxB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,KAAK,CAAqB;IAElC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,SAAS,CAAa;IAG9B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,SAAS,CAAQ;gBAEb,IAAI,GAAE,UAAe,EAAE,KAAK,SAAI;IA6B5C,SAAS,CAAC,GAAG,IAAI,EAAE;IAGnB,SAAS,CAAC,GAAG,IAAI,IAAI;IAGrB,OAAO,CAAC,UAAU;IAmBlB,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,GAAE,MAAU,EAAE,MAAM,GAAE,OAAe,GAAG,IAAI;IAkCvF,UAAU,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO;IAiBjC,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,aAAa;IA+BrB,SAAS,CAAC,MAAM,IAAI,IAAI;IAsBxB,OAAO,CAAC,SAAS;IAcjB,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;IAIhD,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;IAIpC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI;IAQvC,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC;CAK3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,CAEtD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake3.js b/node_modules/@noble/hashes/blake3.js deleted file mode 100644 index a5718c2..0000000 --- a/node_modules/@noble/hashes/blake3.js +++ /dev/null @@ -1,284 +0,0 @@ -/** - * Blake3 fast hash is Blake2 with reduced security (round count). Can also be used as MAC & KDF. - * - * It is advertised as "the fastest cryptographic hash". However, it isn't true in JS. - * Why is this so slow? While it must be 6x faster than blake2b, perf diff is only 20%: - * - * * There is only 30% reduction in number of rounds from blake2s - * * Speed-up comes from tree structure, which is parallelized using SIMD & threading. - * These features are not present in JS, so we only get overhead from trees. - * * Parallelization only happens on 1024-byte chunks: there is no benefit for small inputs. - * * It is still possible to make it faster using: a) loop unrolling b) web workers c) wasm - * @module - */ -import { SHA256_IV } from "./_md.js"; -import { fromBig } from "./_u64.js"; -import { _BLAKE2, compress } from "./blake2.js"; -// prettier-ignore -import { abytes, aexists, anumber, aoutput, clean, copyBytes, createHasher, swap32IfBE, u32, u8 } from "./utils.js"; -// Constructor-time mode flags (`KEYED_HASH`, `DERIVE_*`) plus per-node tree -// flags (`CHUNK_*`, `PARENT`, `ROOT`). -const B3_Flags = { - CHUNK_START: 0b1, - CHUNK_END: 0b10, - PARENT: 0b100, - ROOT: 0b1000, - KEYED_HASH: 0b10000, - DERIVE_KEY_CONTEXT: 0b100000, - DERIVE_KEY_MATERIAL: 0b1000000, -}; -// Default BLAKE3 IV, cloned from the shared BLAKE2s / SHA-256 IV basis. -const B3_IV = /* @__PURE__ */ SHA256_IV.slice(); -// Seven 16-word rounds of BLAKE3 message schedule, generated by repeatedly -// permuting the identity row. -const B3_SIGMA = /* @__PURE__ */ (() => { - const Id = Array.from({ length: 16 }, (_, i) => i); - const permute = (arr) => [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]); - const res = []; - for (let i = 0, v = Id; i < 7; i++, v = permute(v)) - res.push(...v); - return Uint8Array.from(res); -})(); -/** Blake3 hash. Can be used as MAC and KDF with caller-encoded context bytes. */ -export class _BLAKE3 extends _BLAKE2 { - canXOF = true; - chunkPos = 0; // Position of current block in chunk - // How many chunks we already have; exact while this stays within - // JS's safe-integer range. - chunksDone = 0; - flags = 0 | 0; - IV; - state; - stack = []; - // Output - posOut = 0; - bufferOut32 = new Uint32Array(16); - bufferOut; - // Index of output chunk; exact while this stays within JS's - // safe-integer range. - chunkOut = 0; - enableXOF = true; - constructor(opts = {}, flags = 0) { - super(64, opts.dkLen === undefined ? 32 : opts.dkLen); - const { key, context } = opts; - const hasContext = context !== undefined; - if (key !== undefined) { - if (hasContext) - throw new Error('Only "key" or "context" can be specified at same time'); - abytes(key, 32, 'key'); - const k = copyBytes(key); - this.IV = u32(k); - swap32IfBE(this.IV); - this.flags = flags | B3_Flags.KEYED_HASH; - } - else if (hasContext) { - abytes(context, undefined, 'context'); - const ctx = context; - const contextKey = new _BLAKE3({ dkLen: 32 }, B3_Flags.DERIVE_KEY_CONTEXT) - .update(ctx) - .digest(); - this.IV = u32(contextKey); - swap32IfBE(this.IV); - this.flags = flags | B3_Flags.DERIVE_KEY_MATERIAL; - } - else { - this.IV = B3_IV.slice(); - this.flags = flags; - } - this.state = this.IV.slice(); - this.bufferOut = u8(this.bufferOut32); - } - // _BLAKE2's scalar-state hooks are unused here: BLAKE3 keeps its tree/XOF state in arrays and - // copies it directly in _cloneInto(). - get() { - return []; - } - set() { } - // Truncated chunk/parent compression: seed v8..v15 as IV[0..3], t0, t1, - // block length, and flags, then keep only the first 8 output words. - b2Compress(counter, flags, buf, bufPos = 0) { - const { state: s, pos } = this; - const { h, l } = fromBig(BigInt(counter), true); - // prettier-ignore - const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(B3_SIGMA, bufPos, buf, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], h, l, pos, flags); - s[0] = v0 ^ v8; - s[1] = v1 ^ v9; - s[2] = v2 ^ v10; - s[3] = v3 ^ v11; - s[4] = v4 ^ v12; - s[5] = v5 ^ v13; - s[6] = v6 ^ v14; - s[7] = v7 ^ v15; - } - compress(buf, bufPos = 0, isLast = false) { - // Compress last block - let flags = this.flags; - if (!this.chunkPos) - flags |= B3_Flags.CHUNK_START; - if (this.chunkPos === 15 || isLast) - flags |= B3_Flags.CHUNK_END; - if (!isLast) - this.pos = this.blockLen; - this.b2Compress(this.chunksDone, flags, buf, bufPos); - this.chunkPos += 1; - // If current block is last in chunk (16 blocks), then compress chunks - if (this.chunkPos === 16 || isLast) { - let chunk = this.state; - this.state = this.IV.slice(); - // If not the last one, compress only when there are trailing zeros in chunk counter - // Chunks are used as a binary tree where the current stack is the path. - // Zero means the current leaf is finished and can be compressed. - // 1 (001) - leaf not finished (just push current chunk to stack) - // 2 (010) - leaf finished at depth=1 (merge with last elm on stack and push back) - // 3 (011) - last leaf not finished - // 4 (100) - leafs finished at depth=1 and depth=2 - for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks >>= 1) { - if (!(last = this.stack.pop())) - break; - this.buffer32.set(last, 0); - this.buffer32.set(chunk, 8); - this.pos = this.blockLen; - this.b2Compress(0, this.flags | B3_Flags.PARENT, this.buffer32, 0); - chunk = this.state; - this.state = this.IV.slice(); - } - this.chunksDone++; - this.chunkPos = 0; - this.stack.push(chunk); - } - this.pos = 0; - } - _cloneInto(to) { - to = super._cloneInto(to); - const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this; - to.state.set(state.slice()); - // Clone each CV stack entry by value so extending or destroying the clone - // cannot alias the source tree state. - to.stack = stack.map((i) => Uint32Array.from(i)); - to.IV.set(IV); - to.flags = flags; - to.chunkPos = chunkPos; - to.chunksDone = chunksDone; - to.posOut = posOut; - to.chunkOut = chunkOut; - to.enableXOF = this.enableXOF; - to.bufferOut32.set(this.bufferOut32); - return to; - } - destroy() { - this.destroyed = true; - clean(this.state, this.buffer32, this.IV, this.bufferOut32); - clean(...this.stack); - } - // Root/XOF compression: rerun the same ROOT inputs with incrementing output - // counter `t` and materialize all 16 output words. - // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8) - b2CompressOut() { - const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this; - const { h, l } = fromBig(BigInt(this.chunkOut++)); - swap32IfBE(buffer32); - // prettier-ignore - const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(B3_SIGMA, 0, buffer32, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], l, h, pos, flags); - out32[0] = v0 ^ v8; - out32[1] = v1 ^ v9; - out32[2] = v2 ^ v10; - out32[3] = v3 ^ v11; - out32[4] = v4 ^ v12; - out32[5] = v5 ^ v13; - out32[6] = v6 ^ v14; - out32[7] = v7 ^ v15; - out32[8] = s[0] ^ v8; - out32[9] = s[1] ^ v9; - out32[10] = s[2] ^ v10; - out32[11] = s[3] ^ v11; - out32[12] = s[4] ^ v12; - out32[13] = s[5] ^ v13; - out32[14] = s[6] ^ v14; - out32[15] = s[7] ^ v15; - swap32IfBE(buffer32); - swap32IfBE(out32); - this.posOut = 0; - } - finish() { - if (this.finished) - return; - this.finished = true; - // Padding - clean(this.buffer.subarray(this.pos)); - // Process last chunk - let flags = this.flags | B3_Flags.ROOT; - if (this.stack.length) { - // Finalize the current chunk first, then rerun the last parent - // compression as ROOT with t = 0 and b = 64. - flags |= B3_Flags.PARENT; - swap32IfBE(this.buffer32); - this.compress(this.buffer32, 0, true); - swap32IfBE(this.buffer32); - this.chunksDone = 0; - this.pos = this.blockLen; - } - else { - flags |= (!this.chunkPos ? B3_Flags.CHUNK_START : 0) | B3_Flags.CHUNK_END; - } - this.flags = flags; - this.b2CompressOut(); - } - writeInto(out) { - aexists(this, false); - abytes(out); - this.finish(); - const { blockLen, bufferOut } = this; - for (let pos = 0, len = out.length; pos < len;) { - if (this.posOut >= blockLen) - this.b2CompressOut(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out; - } - xofInto(out) { - if (!this.enableXOF) - throw new Error('XOF is not possible after digest call'); - return this.writeInto(out); - } - xof(bytes) { - anumber(bytes); - return this.xofInto(new Uint8Array(bytes)); - } - digestInto(out) { - aoutput(out, this); - if (this.finished) - throw new Error('digest() was already called'); - this.enableXOF = false; - // `aoutput(...)` allows oversized buffers; digestInto() must fill only the configured digest. - this.writeInto(out.subarray(0, this.outputLen)); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.outputLen); - this.digestInto(out); - return out; - } -} -/** - * BLAKE3 hash function. Can be used as MAC and KDF. - * @param msg - message that would be hashed - * @param opts - Optional output, MAC, or KDF configuration. `key` must be - * exactly 32 bytes, `context` is caller-encoded bytes, and `dkLen` can be - * 0..2^64-1 via the XOF-backed output path. See {@link Blake3Opts}. - * @returns Digest bytes. - * @example - * Hash, MAC, or derive key material with BLAKE3. - * ```ts - * import { blake3 } from '@noble/hashes/blake3.js'; - * import { utf8ToBytes } from '@noble/hashes/utils.js'; - * const data = new Uint8Array(32); - * const hash = blake3(data); - * const mac = blake3(data, { key: new Uint8Array(32) }); - * const kdf = blake3(data, { context: utf8ToBytes('application name') }); - * ``` - */ -export const blake3 = /* @__PURE__ */ createHasher((opts = {}) => new _BLAKE3(opts)); -//# sourceMappingURL=blake3.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/blake3.js.map b/node_modules/@noble/hashes/blake3.js.map deleted file mode 100644 index 40965f6..0000000 --- a/node_modules/@noble/hashes/blake3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blake3.js","sourceRoot":"","sources":["src/blake3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAChD,kBAAkB;AAClB,OAAO,EACL,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EACjC,KAAK,EACL,SAAS,EACT,YAAY,EAAE,UAAU,EACxB,GAAG,EAAE,EAAE,EAKR,MAAM,YAAY,CAAC;AAEpB,4EAA4E;AAC5E,uCAAuC;AACvC,MAAM,Q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ACjB,CAAC;IACD,MAAM;QACJ,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACrB,OAAO,GAAuB,CAAC;IACjC,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAwC,eAAe,CAAC,YAAY,CACrF,CAAC,IAAI,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CACjC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/eskdf.d.ts b/node_modules/@noble/hashes/eskdf.d.ts deleted file mode 100644 index 7ff4281..0000000 --- a/node_modules/@noble/hashes/eskdf.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { type TRet } from './utils.ts'; -/** - * Scrypt KDF with the fixed ESKDF policy tuple `{ N: 2^19, r: 8, p: 1, dkLen: 32 }`. - * @param password - user password string, UTF-8 encoded before entering RFC 7914 - * @param salt - unique salt string, UTF-8 encoded before entering RFC 7914 - * @returns Derived 32-byte key. - * @example - * Derive the 32-byte scrypt key used by ESKDF. - * ```ts - * scrypt('password123', 'user@example.com'); - * ``` - */ -export declare function scrypt(password: string, salt: string): TRet; -/** - * PBKDF2-HMAC-SHA256 with the fixed ESKDF policy tuple `{ sha256, c: 2^17, dkLen: 32 }`. - * @param password - user password string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256 - * @param salt - unique salt string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256 - * @returns Derived 32-byte key. - * @example - * Derive the 32-byte PBKDF2 key used by ESKDF. - * ```ts - * pbkdf2('password123', 'user@example.com'); - * ``` - */ -export declare function pbkdf2(password: string, salt: string): TRet; -/** - * Derives main seed. Takes a lot of time; prefer the higher-level `eskdf(...)` - * flow unless you specifically need the raw main seed. - * Derives the main seed by xor'ing two branches: - * the scrypt branch uses a `0x01` separator byte on username/password, - * and the PBKDF2 branch uses `0x02`. - * Username and password strings are encoded by the underlying KDFs after the - * local separator bytes are appended. - * @param username - account identifier used as public salt - * @param password - user password string - * @returns Main 32-byte seed for the account. - * @throws If the username or password length is invalid. {@link Error} - * @example - * Derive the main ESKDF seed from username and password. - * ```ts - * deriveMainSeed('example-user', 'example-password'); - * ``` - */ -export declare function deriveMainSeed(username: string, password: string): TRet; -type AccountID = number | string; -type OptsLength = { - keyLength: number; -}; -type OptsMod = { - modulus: bigint; -}; -type KeyOpts = undefined | OptsLength | OptsMod; -/** Not using classes because constructor cannot be async. */ -export interface ESKDF { - /** - * Derives a child key. Child key will not be associated with any - * other child key because of properties of underlying KDF. - * - * @param protocol - 3-15 character protocol name - * @param accountId - numeric account identifier, or a string id for - * `password\d{0,3}`, `ssh`, `tor`, or `file` - * @param options - Optional child-key shaping parameters. See {@link KeyOpts}. - * @returns Derived child key bytes. - */ - deriveChildKey: (protocol: string, accountId: AccountID, options?: KeyOpts) => TRet; - /** Deletes the main seed from the ESKDF instance. */ - expire: () => void; - /** - * Human-readable fingerprint: first 6 bytes of - * `deriveChildKey('fingerprint', 0)`, formatted as uppercase - * colon-separated hex. - */ - fingerprint: string; -} -/** - * ESKDF - * @param username - username, email, or identifier, min: 8 characters, should have enough entropy - * @param password - password, min: 8 characters, should have enough entropy - * @returns Frozen API that derives child keys and exposes the account fingerprint. - * @throws If the username or password length is invalid. {@link Error} - * @example - * Derive account-specific child keys from the main ESKDF seed. - * ```ts - * const kdf = await eskdf('example-university', 'beginning-new-example'); - * const key = kdf.deriveChildKey('aes', 0); - * const fingerprint = kdf.fingerprint; - * kdf.expire(); - * ``` - */ -export declare function eskdf(username: string, password: string): Promise>; -export {}; -//# sourceMappingURL=eskdf.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/eskdf.d.ts.map b/node_modules/@noble/hashes/eskdf.d.ts.map deleted file mode 100644 index d0a7953..0000000 --- a/node_modules/@noble/hashes/eskdf.d.ts.map +++ /dev/null @@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of file diff --git a/node_modules/@noble/hashes/eskdf.js b/node_modules/@noble/hashes/eskdf.js deleted file mode 100644 index 5ea541d..0000000 --- a/node_modules/@noble/hashes/eskdf.js +++ /dev/null @@ -1,218 +0,0 @@ -/** - * Experimental KDF for AES. - * @module - */ -import { hkdf } from "./hkdf.js"; -import { pbkdf2 as _pbkdf2 } from "./pbkdf2.js"; -import { scrypt as _scrypt } from "./scrypt.js"; -import { sha256 } from "./sha2.js"; -import { abytes, bytesToHex, clean, createView, hexToBytes, kdfInputToBytes, } from "./utils.js"; -// A tiny KDF for various applications like AES key-gen. -// Uses HKDF in a non-standard way, so it's not "KDF-secure", only "PRF-secure". -// Which is good enough: assume sha2-256 retained preimage resistance. -// Fixed ESKDF scrypt work factor: interactive-latency target with about 512 MiB RAM per derivation. -const SCRYPT_FACTOR = /* @__PURE__ */ (() => 2 ** 19)(); -// Fixed ESKDF PBKDF2 work factor: CPU-only companion branch in the same rough -// interactive-latency range. -const PBKDF2_FACTOR = /* @__PURE__ */ (() => 2 ** 17)(); -/** - * Scrypt KDF with the fixed ESKDF policy tuple `{ N: 2^19, r: 8, p: 1, dkLen: 32 }`. - * @param password - user password string, UTF-8 encoded before entering RFC 7914 - * @param salt - unique salt string, UTF-8 encoded before entering RFC 7914 - * @returns Derived 32-byte key. - * @example - * Derive the 32-byte scrypt key used by ESKDF. - * ```ts - * scrypt('password123', 'user@example.com'); - * ``` - */ -export function scrypt(password, salt) { - return _scrypt(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 }); -} -/** - * PBKDF2-HMAC-SHA256 with the fixed ESKDF policy tuple `{ sha256, c: 2^17, dkLen: 32 }`. - * @param password - user password string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256 - * @param salt - unique salt string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256 - * @returns Derived 32-byte key. - * @example - * Derive the 32-byte PBKDF2 key used by ESKDF. - * ```ts - * pbkdf2('password123', 'user@example.com'); - * ``` - */ -export function pbkdf2(password, salt) { - return _pbkdf2(sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 }); -} -// Combines two 32-byte byte arrays into a fresh 32-byte result without aliasing either input. -function xor32(a, b) { - abytes(a, 32); - abytes(b, 32); - const arr = new Uint8Array(32); - for (let i = 0; i < 32; i++) { - arr[i] = a[i] ^ b[i]; - } - return arr; -} -// All local string length checks are in JS UTF-16 code units, not UTF-8 bytes. -function strHasLength(str, min, max) { - return typeof str === 'string' && str.length >= min && str.length <= max; -} -/** - * Derives main seed. Takes a lot of time; prefer the higher-level `eskdf(...)` - * flow unless you specifically need the raw main seed. - * Derives the main seed by xor'ing two branches: - * the scrypt branch uses a `0x01` separator byte on username/password, - * and the PBKDF2 branch uses `0x02`. - * Username and password strings are encoded by the underlying KDFs after the - * local separator bytes are appended. - * @param username - account identifier used as public salt - * @param password - user password string - * @returns Main 32-byte seed for the account. - * @throws If the username or password length is invalid. {@link Error} - * @example - * Derive the main ESKDF seed from username and password. - * ```ts - * deriveMainSeed('example-user', 'example-password'); - * ``` - */ -export function deriveMainSeed(username, password) { - if (!strHasLength(username, 8, 255)) - throw new Error('invalid username'); - if (!strHasLength(password, 8, 255)) - throw new Error('invalid password'); - // Keep the protocol separators as the literal bytes 0x01 / 0x02 even after minification. - // Embedding them as non-printable characters directly can be awkward across - // JS tooling and environments. - const codes = { _1: 1, _2: 2 }; - const sep = { s: String.fromCharCode(codes._1), p: String.fromCharCode(codes._2) }; - const scr = scrypt(password + sep.s, username + sep.s); - const pbk = pbkdf2(password + sep.p, username + sep.p); - const res = xor32(scr, pbk); - clean(scr, pbk); - return res; -} -/** - * Converts protocol & accountId pair to HKDF params: - * `info` is UTF-8 protocol bytes, numeric ids become 4-byte BE `salt`, - * and string ids become UTF-8 `salt` bytes. - */ -function getSaltInfo(protocol, accountId = 0) { - // Note that length here also repeats two lines below - // We do an additional length check here to reduce the scope of DoS attacks - if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) { - throw new Error('invalid protocol'); - } - // Exact-match only: substring matches like `assh` / `mentor` must not widen the public whitelist. - const allowsStr = /^(password\d{0,3}|ssh|tor|file)$/.test(protocol); - let salt; // Assigned below: either 4-byte BE account bytes or UTF-8 account bytes. - if (typeof accountId === 'string') { - if (!allowsStr) - throw new Error('accountId must be a number'); - if (!strHasLength(accountId, 1, 255)) - throw new Error('accountId must be string of length 1..255'); - salt = kdfInputToBytes(accountId); - } - else if (Number.isSafeInteger(accountId)) { - if (accountId < 0 || accountId > Math.pow(2, 32) - 1) - throw new Error('invalid accountId'); - // Convert to Big Endian Uint32 - salt = new Uint8Array(4); - createView(salt).setUint32(0, accountId, false); - } - else { - throw new Error('accountId must be a number' + (allowsStr ? ' or string' : '')); - } - const info = kdfInputToBytes(protocol); - return { salt, info }; -} -// Local modulus-size helper, not a general bigint-byte-length primitive: -// `<= 128n` is rejected by ESKDF policy. -function countBytes(num) { - if (typeof num !== 'bigint' || num <= BigInt(128)) - throw new Error('invalid number'); - return Math.ceil(num.toString(2).length / 8); -} -/** - * Parses keyLength and modulus options to extract length of result key. - * If modulus is used, adds 64 bits to it per the FIPS 186-5 Appendix A.3.1 / - * A.4.1 extra-bits guidance. - */ -function getKeyLength(options) { - if (!options || typeof options !== 'object') - return 32; - const hasLen = 'keyLength' in options; - const hasMod = 'modulus' in options; - if (hasLen && hasMod) - throw new Error('cannot combine keyLength and modulus options'); - if (!hasLen && !hasMod) - throw new Error('must have either keyLength or modulus option'); - // FIPS 186-5 Appendix A.3.1 / A.4.1 calls for at least 64 extra bits. - const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength; - if (!(typeof l === 'number' && l >= 16 && l <= 8192)) - throw new Error('invalid keyLength'); - return l; -} -/** - * Converts key to bigint and divides it by modulus. Big Endian. - * Adapts FIPS 186-5 Appendix A.4.1: `getKeyLength()` already requested the - * extra 64-bit margin, and this step maps the result into `1..modulus-1`. - */ -function modReduceKey(key, modulus) { - const _1 = BigInt(1); - const num = BigInt('0x' + bytesToHex(key)); // check for ui8a, then bytesToNumber() - const res = (num % (modulus - _1)) + _1; // Remove 0 from output - if (res < _1) - throw new Error('expected positive number'); // Guard against bad values - // Strip the extra 64-bit margin that `getKeyLength()` requested - // for bias reduction. - const len = key.length - 8; - const hex = res.toString(16).padStart(len * 2, '0'); // numberToHex() - const bytes = hexToBytes(hex); - if (bytes.length !== len) - throw new Error('invalid length of result key'); - return bytes; -} -/** - * ESKDF - * @param username - username, email, or identifier, min: 8 characters, should have enough entropy - * @param password - password, min: 8 characters, should have enough entropy - * @returns Frozen API that derives child keys and exposes the account fingerprint. - * @throws If the username or password length is invalid. {@link Error} - * @example - * Derive account-specific child keys from the main ESKDF seed. - * ```ts - * const kdf = await eskdf('example-university', 'beginning-new-example'); - * const key = kdf.deriveChildKey('aes', 0); - * const fingerprint = kdf.fingerprint; - * kdf.expire(); - * ``` - */ -export async function eskdf(username, password) { - // We are using closure + object instead of class because - // we want to make `seed` non-accessible for any external function. - let seed = deriveMainSeed(username, password); - function deriveCK(protocol, accountId = 0, options) { - // Reject expired instances before deriving any HKDF inputs from the closure-held seed. - abytes(seed, 32); - const { salt, info } = getSaltInfo(protocol, accountId); // validate protocol & accountId - // Validate option shape and coarse length bounds; - // `hkdf()` still rejects non-integer lengths. - const keyLength = getKeyLength(options); - const key = hkdf(sha256, seed, salt, info, keyLength); - // Modulus has already been validated - return options && 'modulus' in options ? modReduceKey(key, options.modulus) : key; - } - function expire() { - // Overwrite the closure-held seed before dropping the reference. - if (seed) - seed.fill(1); - seed = undefined; - } - // prettier-ignore - const fingerprint = Array.from(deriveCK('fingerprint', 0)) - .slice(0, 6) - .map((char) => char.toString(16).padStart(2, '0').toUpperCase()) - .join(':'); - return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint }); -} -//# sourceMappingURL=eskdf.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/eskdf.js.map b/node_modules/@noble/hashes/eskdf.js.map deleted file mode 100644 index 49209e5..0000000 --- a/node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,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;AAC1E,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/hkdf.d.ts b/node_modules/@noble/hashes/hkdf.d.ts deleted file mode 100644 index 0ace1fe..0000000 --- a/node_modules/@noble/hashes/hkdf.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { type CHash, type TArg, type TRet } from './utils.ts'; -/** - * HKDF-extract from spec. Less important part. `HKDF-Extract(IKM, salt) -> PRK` - * Arguments position differs from spec (IKM is first one, since it is not optional) - * Local validation only checks `hash`; `ikm` / `salt` byte validation is delegated to `hmac()`. - * @param hash - hash function that would be used (e.g. sha256) - * @param ikm - input keying material, the initial key - * @param salt - optional salt value (a non-secret random value) - * @returns Pseudorandom key derived from input keying material. - * @example - * Run the HKDF extract step. - * ```ts - * import { extract } from '@noble/hashes/hkdf.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * extract(sha256, new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -export declare function extract(hash: TArg, ikm: TArg, salt?: TArg): TRet; -/** - * HKDF-expand from the spec. The most important part. `HKDF-Expand(PRK, info, L) -> OKM` - * @param hash - hash function that would be used (e.g. sha256) - * @param prk - a pseudorandom key of at least HashLen octets - * (usually, the output from the extract step) - * @param info - optional context and application specific information (can be a zero-length string) - * @param length - length of output keying material in bytes. - * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` returns an empty OKM. - * @returns Output keying material with the requested length. - * @throws If the requested output length exceeds the HKDF limit - * for the selected hash. {@link Error} - * @example - * Run the HKDF expand step. - * ```ts - * import { expand } from '@noble/hashes/hkdf.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * expand(sha256, new Uint8Array(32), new Uint8Array([1, 2, 3]), 16); - * ``` - */ -export declare function expand(hash: TArg, prk: TArg, info?: TArg, length?: number): TRet; -/** - * HKDF (RFC 5869): derive keys from an initial input. - * Combines hkdf_extract + hkdf_expand in one step - * @param hash - hash function that would be used (e.g. sha256) - * @param ikm - input keying material, the initial key - * @param salt - optional salt value (a non-secret random value) - * @param info - optional context and application specific information bytes - * @param length - length of output keying material in bytes. - * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` returns an empty OKM. - * @returns Output keying material derived from the input key. - * @throws If the requested output length exceeds the HKDF limit - * for the selected hash. {@link Error} - * @example - * HKDF (RFC 5869): derive keys from an initial input. - * ```ts - * import { hkdf } from '@noble/hashes/hkdf.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * import { randomBytes, utf8ToBytes } from '@noble/hashes/utils.js'; - * const inputKey = randomBytes(32); - * const salt = randomBytes(32); - * const info = utf8ToBytes('application-key'); - * const okm = hkdf(sha256, inputKey, salt, info, 32); - * ``` - */ -export declare const hkdf: (hash: TArg, ikm: TArg, salt: TArg, info: TArg, length: number) => TRet; -//# sourceMappingURL=hkdf.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/hkdf.d.ts.map b/node_modules/@noble/hashes/hkdf.d.ts.map deleted file mode 100644 index 9b6a97f..0000000 --- a/node_modules/@noble/hashes/hkdf.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hkdf.d.ts","sourceRoot":"","sources":["src/hkdf.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0B,KAAK,KAAK,EAAS,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE7F;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CACrB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EACjB,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,EACrB,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,GACtB,IAAI,CAAC,UAAU,CAAC,CAOlB;AAQD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EACjB,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,EACrB,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,EACvB,MAAM,GAAE,MAAW,GAClB,IAAI,CAAC,UAAU,CAAC,CAiClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,IAAI,GACf,MAAM,IAAI,CAAC,KAAK,CAAC,EACjB,KAAK,IAAI,CAAC,UAAU,CAAC,EACrB,MAAM,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,EAClC,MAAM,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,EAClC,QAAQ,MAAM,KACb,IAAI,CAAC,UAAU,CAAyD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/hkdf.js b/node_modules/@noble/hashes/hkdf.js deleted file mode 100644 index ccb0130..0000000 --- a/node_modules/@noble/hashes/hkdf.js +++ /dev/null @@ -1,120 +0,0 @@ -/** - * HKDF (RFC 5869): extract + expand in one step. - * See {@link https://soatok.blog/2021/11/17/understanding-hkdf/}. - * @module - */ -import { hmac } from "./hmac.js"; -import { abytes, ahash, anumber, clean } from "./utils.js"; -/** - * HKDF-extract from spec. Less important part. `HKDF-Extract(IKM, salt) -> PRK` - * Arguments position differs from spec (IKM is first one, since it is not optional) - * Local validation only checks `hash`; `ikm` / `salt` byte validation is delegated to `hmac()`. - * @param hash - hash function that would be used (e.g. sha256) - * @param ikm - input keying material, the initial key - * @param salt - optional salt value (a non-secret random value) - * @returns Pseudorandom key derived from input keying material. - * @example - * Run the HKDF extract step. - * ```ts - * import { extract } from '@noble/hashes/hkdf.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * extract(sha256, new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -export function extract(hash, ikm, salt) { - ahash(hash); - // NOTE: some libraries treat zero-length array as 'not provided'; - // we don't, since we have undefined as 'not provided' - // https://github.com/RustCrypto/KDFs/issues/15 - if (salt === undefined) - salt = new Uint8Array(hash.outputLen); - return hmac(hash, salt, ikm); -} -// Shared mutable scratch byte for the RFC 5869 block counter `N`. -// Safe to reuse because `expand()` is synchronous and resets it with `clean(...)` before returning. -const HKDF_COUNTER = /* @__PURE__ */ Uint8Array.of(0); -// Shared RFC 5869 empty string for both `info === undefined` and the first-block `T(0)` input. -const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of(); -/** - * HKDF-expand from the spec. The most important part. `HKDF-Expand(PRK, info, L) -> OKM` - * @param hash - hash function that would be used (e.g. sha256) - * @param prk - a pseudorandom key of at least HashLen octets - * (usually, the output from the extract step) - * @param info - optional context and application specific information (can be a zero-length string) - * @param length - length of output keying material in bytes. - * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` returns an empty OKM. - * @returns Output keying material with the requested length. - * @throws If the requested output length exceeds the HKDF limit - * for the selected hash. {@link Error} - * @example - * Run the HKDF expand step. - * ```ts - * import { expand } from '@noble/hashes/hkdf.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * expand(sha256, new Uint8Array(32), new Uint8Array([1, 2, 3]), 16); - * ``` - */ -export function expand(hash, prk, info, length = 32) { - ahash(hash); - anumber(length, 'length'); - abytes(prk, undefined, 'prk'); - const olen = hash.outputLen; - // RFC 5869 §2.3: PRK is "a pseudorandom key of at least HashLen octets". - if (prk.length < olen) - throw new Error('"prk" must be at least HashLen octets'); - // RFC 5869 §2.3 only bounds `L` by `<= 255*HashLen`; `L=0` is valid and yields empty OKM. - if (length > 255 * olen) - throw new Error('Length must be <= 255*HashLen'); - const blocks = Math.ceil(length / olen); - if (info === undefined) - info = EMPTY_BUFFER; - else - abytes(info, undefined, 'info'); - // first L(ength) octets of T - const okm = new Uint8Array(blocks * olen); - // Re-use HMAC instance between blocks - const HMAC = hmac.create(hash, prk); - const HMACTmp = HMAC._cloneInto(); - const T = new Uint8Array(HMAC.outputLen); - for (let counter = 0; counter < blocks; counter++) { - HKDF_COUNTER[0] = counter + 1; - // T(0) = empty string (zero length) - // T(N) = HMAC-Hash(PRK, T(N-1) | info | N) - HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T) - .update(info) - .update(HKDF_COUNTER) - .digestInto(T); - okm.set(T, olen * counter); - HMAC._cloneInto(HMACTmp); - } - HMAC.destroy(); - HMACTmp.destroy(); - clean(T, HKDF_COUNTER); - return okm.slice(0, length); -} -/** - * HKDF (RFC 5869): derive keys from an initial input. - * Combines hkdf_extract + hkdf_expand in one step - * @param hash - hash function that would be used (e.g. sha256) - * @param ikm - input keying material, the initial key - * @param salt - optional salt value (a non-secret random value) - * @param info - optional context and application specific information bytes - * @param length - length of output keying material in bytes. - * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` returns an empty OKM. - * @returns Output keying material derived from the input key. - * @throws If the requested output length exceeds the HKDF limit - * for the selected hash. {@link Error} - * @example - * HKDF (RFC 5869): derive keys from an initial input. - * ```ts - * import { hkdf } from '@noble/hashes/hkdf.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * import { randomBytes, utf8ToBytes } from '@noble/hashes/utils.js'; - * const inputKey = randomBytes(32); - * const salt = randomBytes(32); - * const info = utf8ToBytes('application-key'); - * const okm = hkdf(sha256, inputKey, salt, info, 32); - * ``` - */ -export const hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length); -//# sourceMappingURL=hkdf.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/hkdf.js.map b/node_modules/@noble/hashes/hkdf.js.map deleted file mode 100644 index 1a783f4..0000000 --- a/node_modules/@noble/hashes/hkdf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hkdf.js","sourceRoot":"","sources":["src/hkdf.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAc,KAAK,EAAwB,MAAM,YAAY,CAAC;AAE7F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,OAAO,CACrB,IAAiB,EACj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E,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/hmac.d.ts b/node_modules/@noble/hashes/hmac.d.ts deleted file mode 100644 index 7ec669d..0000000 --- a/node_modules/@noble/hashes/hmac.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * HMAC: RFC2104 message authentication code. - * @module - */ -import { type CHash, type Hash, type TArg, type TRet } from './utils.ts'; -/** - * Internal class for HMAC. - * Accepts any byte key, although RFC 2104 §3 recommends keys at least - * `HashLen` bytes long. - */ -export declare class _HMAC> implements Hash<_HMAC> { - oHash: T; - iHash: T; - blockLen: number; - outputLen: number; - canXOF: boolean; - private finished; - private destroyed; - constructor(hash: TArg, key: TArg); - update(buf: TArg): this; - digestInto(out: TArg): void; - digest(): TRet; - _cloneInto(to?: _HMAC): _HMAC; - clone(): _HMAC; - destroy(): void; -} -/** - * HMAC: RFC2104 message authentication code. - * @param hash - function that would be used e.g. sha256 - * @param key - authentication key bytes - * @param message - message bytes to authenticate - * @returns Authentication tag bytes. - * @example - * Compute an RFC 2104 HMAC. - * ```ts - * import { hmac } from '@noble/hashes/hmac.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const mac = hmac(sha256, new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -type HmacFn = { - (hash: TArg, key: TArg, message: TArg): TRet; - create(hash: TArg, key: TArg): TRet<_HMAC>; -}; -export declare const hmac: TRet; -export {}; -//# sourceMappingURL=hmac.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/hmac.d.ts.map b/node_modules/@noble/hashes/hmac.d.ts.map deleted file mode 100644 index 07fe4ab..0000000 --- a/node_modules/@noble/hashes/hmac.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["src/hmac.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAML,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KA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"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/hmac.js b/node_modules/@noble/hashes/hmac.js deleted file mode 100644 index fd066ea..0000000 --- a/node_modules/@noble/hashes/hmac.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * HMAC: RFC2104 message authentication code. - * @module - */ -import { abytes, aexists, ahash, aoutput, clean, } from "./utils.js"; -/** - * Internal class for HMAC. - * Accepts any byte key, although RFC 2104 §3 recommends keys at least - * `HashLen` bytes long. - */ -export class _HMAC { - oHash; - iHash; - blockLen; - outputLen; - canXOF = false; - finished = false; - destroyed = false; - constructor(hash, key) { - ahash(hash); - abytes(key, undefined, 'key'); - this.iHash = hash.create(); - if (typeof this.iHash.update !== 'function') - throw new Error('Expected instance of class which extends utils.Hash'); - this.blockLen = this.iHash.blockLen; - this.outputLen = this.iHash.outputLen; - const blockLen = this.blockLen; - const pad = new Uint8Array(blockLen); - // blockLen can be bigger than outputLen - pad.set(key.length > blockLen ? hash.create().update(key).digest() : key); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 0x36; - this.iHash.update(pad); - // By doing update (processing of the first block) of the outer hash here, - // we can re-use it between multiple calls via clone. - this.oHash = hash.create(); - // Undo internal XOR && apply outer XOR - for (let i = 0; i < pad.length; i++) - pad[i] ^= 0x36 ^ 0x5c; - this.oHash.update(pad); - clean(pad); - } - update(buf) { - aexists(this); - this.iHash.update(buf); - return this; - } - digestInto(out) { - aexists(this); - aoutput(out, this); - this.finished = true; - const buf = out.subarray(0, this.outputLen); - // Reuse the first outputLen bytes for the inner digest; the outer hash consumes them before - // overwriting that same prefix with the final tag, leaving any oversized tail untouched. - this.iHash.digestInto(buf); - this.oHash.update(buf); - this.oHash.digestInto(buf); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.oHash.outputLen); - this.digestInto(out); - return out; - } - _cloneInto(to) { - // Create new instance without calling constructor since the key - // is already in state and we don't know it. - to ||= Object.create(Object.getPrototypeOf(this), {}); - const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; - to = to; - to.finished = finished; - to.destroyed = destroyed; - to.blockLen = blockLen; - to.outputLen = outputLen; - to.oHash = oHash._cloneInto(to.oHash); - to.iHash = iHash._cloneInto(to.iHash); - return to; - } - clone() { - return this._cloneInto(); - } - destroy() { - this.destroyed = true; - this.oHash.destroy(); - this.iHash.destroy(); - } -} -export const hmac = /* @__PURE__ */ (() => { - const hmac_ = ((hash, key, message) => new _HMAC(hash, key).update(message).digest()); - hmac_.create = (hash, key) => new _HMAC(hash, key); - return hmac_; -})(); -//# sourceMappingURL=hmac.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/hmac.js.map b/node_modules/@noble/hashes/hmac.js.map deleted file mode 100644 index 4f3ed1a..0000000 --- a/node_modules/@noble/hashes/hmac.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hmac.js","sourceRoot":"","sources":["src/hmac.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,OAAO,EACP,KAAK,GAKN,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,OAAO,KAAK;IAChB,KAAK,CAAI;IACT,KAAK,CAAI;IACT,QAAQ,CAAS;IACjB,SAAS,CAAS;IAClB,MAAM,GAAG,KAAK,CAAC;IACP,QAAQ,GAAG,KAAK,CAAC;IACjB,SAAS,GAAG,KAAK,CAAC;IAE1B,YAAY,IAAiB,EAAE,GAAqB;QAClD,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,EAAO,CAAC;QAChC,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,UAAU;YACzC,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CA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ACD,KAAK;QACH,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO;QACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;CACF;AAoBD,MAAM,CAAC,MAAM,IAAI,GAAiB,eAAe,CAAC,CAAC,GAAG,EAAE;IACtD,MAAM,KAAK,GAAG,CAAC,CACb,IAAiB,EACjB,GAAqB,EACrB,OAAyB,EACP,EAAE,CAAC,IAAI,KAAK,CAAM,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAiB,CAAC;IAC3F,KAAK,CAAC,MAAM,GAAG,CAAC,IAAiB,EAAE,GAAqB,EAAoB,EAAE,CAC5E,IAAI,KAAK,CAAM,IAAI,EAAE,GAAG,CAAqB,CAAC;IAChD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/index.d.ts b/node_modules/@noble/hashes/index.d.ts deleted file mode 100644 index e26a57a..0000000 --- a/node_modules/@noble/hashes/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/index.d.ts.map b/node_modules/@noble/hashes/index.d.ts.map deleted file mode 100644 index 4e8c581..0000000 --- a/node_modules/@noble/hashes/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@noble/hashes/index.js b/node_modules/@noble/hashes/index.js deleted file mode 100644 index 5bcf959..0000000 --- a/node_modules/@noble/hashes/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Audited & minimal JS implementation of hash functions, MACs, and KDFs. - * Check out individual modules. - * @module - * @example -```js -import { - sha256, sha384, sha512, sha224, sha512_224, sha512_256 -} from '@noble/hashes/sha2.js'; -import { - sha3_224, sha3_256, sha3_384, sha3_512, - keccak_224, keccak_256, keccak_384, keccak_512, - shake128, shake256 -} from '@noble/hashes/sha3.js'; -import { - cshake128, cshake256, - turboshake128, turboshake256, - kt128, kt256, - kmac128, kmac256, - tuplehash256, parallelhash256, - keccakprg -} from '@noble/hashes/sha3-addons.js'; -import { blake3 } from '@noble/hashes/blake3.js'; -import { blake2b, blake2s } from '@noble/hashes/blake2.js'; -import { hmac } from '@noble/hashes/hmac.js'; -import { hkdf } from '@noble/hashes/hkdf.js'; -import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js'; -import { scrypt, scryptAsync } from '@noble/hashes/scrypt.js'; -import { md5, ripemd160, sha1 } from '@noble/hashes/legacy.js'; -import * as utils from '@noble/hashes/utils.js'; -``` - */ -throw new Error('root module cannot be imported: import submodules instead. Check out README'); -export {}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/index.js.map b/node_modules/@noble/hashes/index.js.map deleted file mode 100644 index 9ad47d2..0000000 --- a/node_modules/@noble/hashes/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/legacy.d.ts b/node_modules/@noble/hashes/legacy.d.ts deleted file mode 100644 index 1f9fd43..0000000 --- a/node_modules/@noble/hashes/legacy.d.ts +++ /dev/null @@ -1,102 +0,0 @@ -/** - -SHA1 (RFC 3174), MD5 (RFC 1321), and RIPEMD160 legacy, weak hash functions. -RFC 2286 only covers HMAC-RIPEMD160 wrapper material and test vectors, -not the base RIPEMD-160 compression spec. -Don't use them in a new protocol. What "weak" means: - -- Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160. -- No practical pre-image attacks (only theoretical, 2^123.4) -- HMAC seems kinda ok: https://www.rfc-editor.org/rfc/rfc6151 - * @module - */ -import { HashMD } from './_md.ts'; -import { type CHash, type TRet } from './utils.ts'; -/** Internal SHA1 legacy hash class. */ -export declare class _SHA1 extends HashMD<_SHA1> { - private A; - private B; - private C; - private D; - private E; - constructor(); - protected get(): [number, number, number, number, number]; - protected set(A: number, B: number, C: number, D: number, E: number): void; - protected process(view: DataView, offset: number): void; - protected roundClean(): void; - destroy(): void; -} -/** - * SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA1. - * ```ts - * sha1(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha1: TRet; -/** Internal MD5 legacy hash class. */ -export declare class _MD5 extends HashMD<_MD5> { - private A; - private B; - private C; - private D; - constructor(); - protected get(): [number, number, number, number]; - protected set(A: number, B: number, C: number, D: number): void; - protected process(view: DataView, offset: number): void; - protected roundClean(): void; - destroy(): void; -} -/** - * MD5 (RFC 1321) legacy hash function. It was cryptographically broken. - * MD5 architecture is similar to SHA1, with some differences: - * - Reduced output length: 16 bytes (128 bit) instead of 20 - * - 64 rounds, instead of 80 - * - Little-endian: could be faster, but will require more code - * - Non-linear index selection: huge speed-up for unroll - * - Per round constants: more memory accesses, additional speed-up for unroll - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with MD5. - * ```ts - * md5(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const md5: TRet; -/** - * Internal RIPEMD-160 legacy hash class. - * RFC 2286 only adds HMAC-RIPEMD160 material, not the core hash specification. - */ -export declare class _RIPEMD160 extends HashMD<_RIPEMD160> { - private h0; - private h1; - private h2; - private h3; - private h4; - constructor(); - protected get(): [number, number, number, number, number]; - protected set(h0: number, h1: number, h2: number, h3: number, h4: number): void; - protected process(view: DataView, offset: number): void; - protected roundClean(): void; - destroy(): void; -} -/** - * RIPEMD-160 - a legacy hash function from 1990s. - * RFC 2286 only covers HMAC-RIPEMD160 test material; the links below point - * at the base RIPEMD-160 references. - * * {@link https://homes.esat.kuleuven.be/~bosselae/ripemd160.html} - * * {@link https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf} - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with RIPEMD-160. - * ```ts - * ripemd160(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const ripemd160: TRet; -//# sourceMappingURL=legacy.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/legacy.d.ts.map b/node_modules/@noble/hashes/legacy.d.ts.map deleted file mode 100644 index 538ff86..0000000 --- a/node_modules/@noble/hashes/legacy.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"legacy.d.ts","sourceRoot":"","sources":["src/legacy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAO,MAAM,EAAO,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,KAAK,KAAK,EAA6B,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAU9E,uCAAuC;AACvC,qBAAa,KAAM,SAAQ,MAAM,CAAC,KAAK,CAAC;IACtC,OAAO,CAAC,CAAC,CAAkB;IAC3B,OAAO,CAAC,CAAC,CAAkB;IAC3B,OAAO,CAAC,CAAC,CAAkB;IAC3B,OAAO,CAAC,CAAC,CAAkB;IAC3B,OAAO,CAAC,CAAC,CAAkB;;IAK3B,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAIzD,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CA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,EAAE,MAAM,CAAC;IAIzD,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;IAO/E,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAoCvD,SAAS,CAAC,UAAU,IAAI,IAAI;IAG5B,OAAO,IAAI,IAAI;CAKhB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,KAAK,CAAwD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/legacy.js b/node_modules/@noble/hashes/legacy.js deleted file mode 100644 index 20c3b99..0000000 --- a/node_modules/@noble/hashes/legacy.js +++ /dev/null @@ -1,327 +0,0 @@ -/** - -SHA1 (RFC 3174), MD5 (RFC 1321), and RIPEMD160 legacy, weak hash functions. -RFC 2286 only covers HMAC-RIPEMD160 wrapper material and test vectors, -not the base RIPEMD-160 compression spec. -Don't use them in a new protocol. What "weak" means: - -- Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160. -- No practical pre-image attacks (only theoretical, 2^123.4) -- HMAC seems kinda ok: https://www.rfc-editor.org/rfc/rfc6151 - * @module - */ -import { Chi, HashMD, Maj } from "./_md.js"; -import { clean, createHasher, rotl } from "./utils.js"; -/** Initial SHA-1 state from RFC 3174 §6.1. */ -const SHA1_IV = /* @__PURE__ */ Uint32Array.from([ - 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0, -]); -// Reusable 80-word SHA-1 message schedule buffer. -const SHA1_W = /* @__PURE__ */ new Uint32Array(80); -/** Internal SHA1 legacy hash class. */ -export class _SHA1 extends HashMD { - A = SHA1_IV[0] | 0; - B = SHA1_IV[1] | 0; - C = SHA1_IV[2] | 0; - D = SHA1_IV[3] | 0; - E = SHA1_IV[4] | 0; - constructor() { - super(64, 20, 8, false); - } - get() { - const { A, B, C, D, E } = this; - return [A, B, C, D, E]; - } - set(A, B, C, D, E) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - SHA1_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 80; i++) - SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1); - // Compression function main loop, 80 rounds - let { A, B, C, D, E } = this; - for (let i = 0; i < 80; i++) { - let F, K; - if (i < 20) { - F = Chi(B, C, D); - K = 0x5a827999; - } - else if (i < 40) { - F = B ^ C ^ D; - K = 0x6ed9eba1; - } - else if (i < 60) { - F = Maj(B, C, D); - K = 0x8f1bbcdc; - } - else { - F = B ^ C ^ D; - K = 0xca62c1d6; - } - const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0; - E = D; - D = C; - C = rotl(B, 30); - B = A; - A = T; - } - // Add the compressed chunk to the current hash value - A = (A + this.A) | 0; - B = (B + this.B) | 0; - C = (C + this.C) | 0; - D = (D + this.D) | 0; - E = (E + this.E) | 0; - this.set(A, B, C, D, E); - } - roundClean() { - clean(SHA1_W); - } - destroy() { - // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves - // update()/digest() callable on reused instances. - this.destroyed = true; - this.set(0, 0, 0, 0, 0); - clean(this.buffer); - } -} -/** - * SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA1. - * ```ts - * sha1(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha1 = /* @__PURE__ */ createHasher(() => new _SHA1()); -/** RFC 1321 `T[i]` uses `floor(2^32 * abs(sin(i)))`; this is the shared `2^32` scale factor. */ -const p32 = /* @__PURE__ */ Math.pow(2, 32); -/** RFC 1321 `T[1..64]` table. */ -const K = /* @__PURE__ */ Array.from({ length: 64 }, (_, i) => Math.floor(p32 * Math.abs(Math.sin(i + 1)))); -/** MD5 initial state from RFC 1321, stored as 4 u32 words. */ -const MD5_IV = /* @__PURE__ */ SHA1_IV.slice(0, 4); -// Reusable 16-word MD5 message block buffer. -const MD5_W = /* @__PURE__ */ new Uint32Array(16); -/** Internal MD5 legacy hash class. */ -export class _MD5 extends HashMD { - A = MD5_IV[0] | 0; - B = MD5_IV[1] | 0; - C = MD5_IV[2] | 0; - D = MD5_IV[3] | 0; - constructor() { - super(64, 16, 8, true); - } - get() { - const { A, B, C, D } = this; - return [A, B, C, D]; - } - set(A, B, C, D) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - MD5_W[i] = view.getUint32(offset, true); - // Compression function main loop, 64 rounds - let { A, B, C, D } = this; - for (let i = 0; i < 64; i++) { - let F, g, s; - if (i < 16) { - F = Chi(B, C, D); - g = i; - s = [7, 12, 17, 22]; - } - else if (i < 32) { - // RFC 1321 round 2 uses G(B,C,D) = (B & D) | (C & ~D), which is `Chi(D, B, C)`. - F = Chi(D, B, C); - g = (5 * i + 1) % 16; - s = [5, 9, 14, 20]; - } - else if (i < 48) { - F = B ^ C ^ D; - g = (3 * i + 5) % 16; - s = [4, 11, 16, 23]; - } - else { - F = C ^ (B | ~D); - g = (7 * i) % 16; - s = [6, 10, 15, 21]; - } - F = F + A + K[i] + MD5_W[g]; - A = D; - D = C; - C = B; - B = B + rotl(F, s[i % 4]); - } - // Add the compressed chunk to the current hash value - A = (A + this.A) | 0; - B = (B + this.B) | 0; - C = (C + this.C) | 0; - D = (D + this.D) | 0; - this.set(A, B, C, D); - } - roundClean() { - clean(MD5_W); - } - destroy() { - // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves - // update()/digest() callable on reused instances. - this.destroyed = true; - this.set(0, 0, 0, 0); - clean(this.buffer); - } -} -/** - * MD5 (RFC 1321) legacy hash function. It was cryptographically broken. - * MD5 architecture is similar to SHA1, with some differences: - * - Reduced output length: 16 bytes (128 bit) instead of 20 - * - 64 rounds, instead of 80 - * - Little-endian: could be faster, but will require more code - * - Non-linear index selection: huge speed-up for unroll - * - Per round constants: more memory accesses, additional speed-up for unroll - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with MD5. - * ```ts - * md5(new Uint8Array([97, 98, 99])); - * ``` - */ -export const md5 = /* @__PURE__ */ createHasher(() => new _MD5()); -// RIPEMD-160 -// Permutation repeatedly applied to derive the later RIPEMD-160 message-order tables. -const Rho160 = /* @__PURE__ */ Uint8Array.from([ - 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, -]); -const Id160 = /* @__PURE__ */ (() => Uint8Array.from(new Array(16).fill(0).map((_, i) => i)))(); -const Pi160 = /* @__PURE__ */ (() => Id160.map((i) => (9 * i + 5) % 16))(); -// Five left/right message-word orderings for the RIPEMD-160 dual-lane rounds. -const idxLR = /* @__PURE__ */ (() => { - const L = [Id160]; - const R = [Pi160]; - const res = [L, R]; - for (let i = 0; i < 4; i++) - for (let j of res) - j.push(j[i].map((k) => Rho160[k])); - return res; -})(); -const idxL = /* @__PURE__ */ (() => idxLR[0])(); -const idxR = /* @__PURE__ */ (() => idxLR[1])(); -// const [idxL, idxR] = idxLR; -// Base per-group shift table before the left/right message-order permutations are applied. -const shifts160 = /* @__PURE__ */ [ - [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], - [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], - [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], - [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], - [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5], -].map((i) => Uint8Array.from(i)); -const shiftsL160 = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts160[i][j])); -const shiftsR160 = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts160[i][j])); -// Five left-lane additive constants for RIPEMD-160. -const Kl160 = /* @__PURE__ */ Uint32Array.from([ - 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e, -]); -// Five right-lane additive constants for RIPEMD-160. -const Kr160 = /* @__PURE__ */ Uint32Array.from([ - 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000, -]); -// Called `f()` in the spec; valid `group` values are 0..4, and out-of-range -// inputs currently fall through to the group-4 branch. -function ripemd_f(group, x, y, z) { - if (group === 0) - return x ^ y ^ z; - if (group === 1) - return (x & y) | (~x & z); - if (group === 2) - return (x | ~y) ^ z; - if (group === 3) - return (x & z) | (y & ~z); - return x ^ (y | ~z); -} -// Reusable 16-word RIPEMD-160 message block buffer. -const BUF_160 = /* @__PURE__ */ new Uint32Array(16); -/** - * Internal RIPEMD-160 legacy hash class. - * RFC 2286 only adds HMAC-RIPEMD160 material, not the core hash specification. - */ -export class _RIPEMD160 extends HashMD { - h0 = 0x67452301 | 0; - h1 = 0xefcdab89 | 0; - h2 = 0x98badcfe | 0; - h3 = 0x10325476 | 0; - h4 = 0xc3d2e1f0 | 0; - constructor() { - super(64, 20, 8, true); - } - get() { - const { h0, h1, h2, h3, h4 } = this; - return [h0, h1, h2, h3, h4]; - } - set(h0, h1, h2, h3, h4) { - this.h0 = h0 | 0; - this.h1 = h1 | 0; - this.h2 = h2 | 0; - this.h3 = h3 | 0; - this.h4 = h4 | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - BUF_160[i] = view.getUint32(offset, true); - // prettier-ignore - let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; - // Instead of iterating 0 to 80, we split it into 5 groups - // And use the groups in constants, functions, etc. Much simpler - for (let group = 0; group < 5; group++) { - const rGroup = 4 - group; - const hbl = Kl160[group], hbr = Kr160[group]; // prettier-ignore - const rl = idxL[group], rr = idxR[group]; // prettier-ignore - const sl = shiftsL160[group], sr = shiftsR160[group]; // prettier-ignore - for (let i = 0; i < 16; i++) { - const tl = (rotl(al + ripemd_f(group, bl, cl, dl) + BUF_160[rl[i]] + hbl, sl[i]) + el) | 0; - al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore - } - // 2 loops are 10% faster - for (let i = 0; i < 16; i++) { - const tr = (rotl(ar + ripemd_f(rGroup, br, cr, dr) + BUF_160[rr[i]] + hbr, sr[i]) + er) | 0; - ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore - } - } - // Add the compressed chunk to the current hash value - // Final recombination cross-adds the left/right lane accumulators into the next h0..h4 order. - this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0); - } - roundClean() { - clean(BUF_160); - } - destroy() { - this.destroyed = true; - clean(this.buffer); - this.set(0, 0, 0, 0, 0); - } -} -/** - * RIPEMD-160 - a legacy hash function from 1990s. - * RFC 2286 only covers HMAC-RIPEMD160 test material; the links below point - * at the base RIPEMD-160 references. - * * {@link https://homes.esat.kuleuven.be/~bosselae/ripemd160.html} - * * {@link https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf} - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with RIPEMD-160. - * ```ts - * ripemd160(new Uint8Array([97, 98, 99])); - * ``` - */ -export const ripemd160 = /* @__PURE__ */ createHasher(() => new _RIPEMD160()); -//# sourceMappingURL=legacy.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/legacy.js.map b/node_modules/@noble/hashes/legacy.js.map deleted file mode 100644 index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,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,SAAS,GAAgB,eAAe,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/package.json b/node_modules/@noble/hashes/package.json deleted file mode 100644 index 0ace74d..0000000 --- a/node_modules/@noble/hashes/package.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "name": "@noble/hashes", - "version": "2.2.0", - "description": "Audited & minimal 0-dependency JS implementation of SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF & Scrypt", - "files": [ - "*.js", - "*.js.map", - "*.d.ts", - "*.d.ts.map", - "src" - ], - "devDependencies": { - "@paulmillr/jsbt": "0.5.0", - "@types/node": "25.3.0", - "fast-check": "4.2.0", - "prettier": "3.6.2", - "typescript": "6.0.2" - }, - "scripts": { - "bench": "node test/benchmark/noble.ts", - "bench:compare": "MBENCH_DIMS='algorithm,buffer,library' node test/benchmark/hashes.ts", - "bench:compare-scrypt": "MBENCH_DIMS='iters,library' MBENCH_FILTER='async' node test/benchmark/scrypt.ts", - "bench:install": "cd test/benchmark; npm install", - "build": "tsc", - "build:release": "npx --no @paulmillr/jsbt esbuild test/build", - "check": "npm run check:readme && npm run check:treeshake && npm run check:jsdoc", - "check:readme": "npx --no @paulmillr/jsbt readme package.json", - "check:treeshake": "npx --no @paulmillr/jsbt treeshake package.json test/build/out-treeshake", - "check:jsdoc": "npx --no @paulmillr/jsbt tsdoc package.json", - "build:clean": "rm *.{js,js.map,d.ts,d.ts.map} 2> /dev/null", - "format": "prettier --write 'src/**/*.{js,ts}' 'test/**/*.{js,ts}'", - "test": "node test/index.ts", - "test:bun": "bun test/index.ts", - "test:deno": "deno --allow-env --allow-read test/index.ts", - "test:node20": "cd test; npx tsc; node compiled/test/index.js", - "test:dos": "node test/slow-dos.test.ts", - "test:slow": "node test/slow-big.test.ts", - "test:acvp": "node test/slow-acvp.test.ts", - "test:kdf": "node test/slow-kdf.test.ts" - }, - "exports": { - ".": "./index.js", - "./_md.js": "./_md.js", - "./argon2.js": "./argon2.js", - "./blake1.js": "./blake1.js", - "./blake2.js": "./blake2.js", - "./blake3.js": "./blake3.js", - "./eskdf.js": "./eskdf.js", - "./hkdf.js": "./hkdf.js", - "./hmac.js": "./hmac.js", - "./legacy.js": "./legacy.js", - "./pbkdf2.js": "./pbkdf2.js", - "./scrypt.js": "./scrypt.js", - "./sha2.js": "./sha2.js", - "./sha3-addons.js": "./sha3-addons.js", - "./sha3.js": "./sha3.js", - "./webcrypto.js": "./webcrypto.js", - "./utils.js": "./utils.js" - }, - "engines": { - "node": ">= 20.19.0" - }, - "keywords": [ - "sha1", - "sha2", - "sha3", - "blake", - "blake2", - "blake3", - "hmac", - "hkdf", - "pbkdf2", - "scrypt", - "sha256", - "sha512", - "keccak", - "ripemd160", - "kdf", - "hash", - "cryptography", - "security", - "noble" - ], - "homepage": "https://paulmillr.com/noble/", - "funding": "https://paulmillr.com/funding/", - "repository": { - "type": "git", - "url": "git+https://github.com/paulmillr/noble-hashes.git" - }, - "type": "module", - "main": "index.js", - "module": "index.js", - "types": "index.d.ts", - "sideEffects": false, - "author": "Paul Miller (https://paulmillr.com)", - "license": "MIT" -} diff --git a/node_modules/@noble/hashes/pbkdf2.d.ts b/node_modules/@noble/hashes/pbkdf2.d.ts deleted file mode 100644 index cf4a659..0000000 --- a/node_modules/@noble/hashes/pbkdf2.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { type CHash, type KDFInput, type TArg, type TRet } from './utils.ts'; -/** - * PBKDF2 options: - * * c: iterations, should probably be higher than 100_000 - * * dkLen: desired length of derived key in bytes, must be `>= 1` per RFC 8018 §5.2 - * * asyncTick: max time in ms for which async function can block execution - */ -export type Pbkdf2Opt = { - /** Iteration count. Higher values increase CPU cost. */ - c: number; - /** Desired derived key length in bytes, must be `>= 1` per RFC 8018 §5.2. */ - dkLen?: number; - /** Max scheduler block time in milliseconds for the async variant. */ - asyncTick?: number; -}; -/** - * PBKDF2-HMAC: RFC 8018 key derivation function. - * @param hash - hash function that would be used e.g. sha256 - * @param password - password from which a derived key is generated; - * JS string inputs are UTF-8 encoded first - * @param salt - cryptographic salt; JS string inputs are UTF-8 encoded first - * @param opts - PBKDF2 work factor and output settings. `dkLen`, if provided, - * must be `>= 1` per RFC 8018 §5.2. See {@link Pbkdf2Opt}. - * @returns Derived key bytes. - * @throws If the PBKDF2 iteration count or derived-key settings are invalid. {@link Error} - * @example - * PBKDF2-HMAC: RFC 2898 key derivation function. - * ```ts - * import { pbkdf2 } from '@noble/hashes/pbkdf2.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const key = pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) }); - * ``` - */ -export declare function pbkdf2(hash: TArg, password: TArg, salt: TArg, opts: TArg): TRet; -/** - * PBKDF2-HMAC: RFC 8018 key derivation function. Async version. - * @param hash - hash function that would be used e.g. sha256 - * @param password - password from which a derived key is generated; - * JS string inputs are UTF-8 encoded first - * @param salt - cryptographic salt; JS string inputs are UTF-8 encoded first - * @param opts - PBKDF2 work factor and output settings. `dkLen`, if provided, - * must be `>= 1` per RFC 8018 §5.2. `asyncTick` is only a local - * scheduler-yield knob for this JS wrapper, not part of RFC 8018. - * See {@link Pbkdf2Opt}. - * @returns Promise resolving to derived key bytes. - * @throws If the PBKDF2 iteration count or derived-key settings are invalid. {@link Error} - * @example - * PBKDF2-HMAC: RFC 2898 key derivation function. - * ```ts - * import { pbkdf2Async } from '@noble/hashes/pbkdf2.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const key = await pbkdf2Async(sha256, 'password', 'salt', { dkLen: 32, c: 500_000 }); - * ``` - */ -export declare function pbkdf2Async(hash: TArg, password: TArg, salt: TArg, opts: TArg): Promise>; -//# sourceMappingURL=pbkdf2.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/pbkdf2.d.ts.map b/node_modules/@noble/hashes/pbkdf2.d.ts.map deleted file mode 100644 index 2f7dc08..0000000 --- a/node_modules/@noble/hashes/pbkdf2.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pbkdf2.d.ts","sourceRoot":"","sources":["src/pbkdf2.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,KAAK,EAEV,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,wDAAwD;IACxD,CAAC,EAAE,MAAM,CAAC;IACV,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA+CF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EACxB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,EACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GACpB,IAAI,CAAC,UAAU,CAAC,CAwBlB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EACxB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,EACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GACpB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAwB3B"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/pbkdf2.js b/node_modules/@noble/hashes/pbkdf2.js deleted file mode 100644 index 50ee4db..0000000 --- a/node_modules/@noble/hashes/pbkdf2.js +++ /dev/null @@ -1,135 +0,0 @@ -/** - * PBKDF (RFC 2898). Can be used to create a key from password and salt. - * @module - */ -import { hmac } from "./hmac.js"; -// prettier-ignore -import { ahash, anumber, asyncLoop, checkOpts, clean, createView, kdfInputToBytes } from "./utils.js"; -// Common start and end for sync/async functions -function pbkdf2Init(hash, _password, _salt, _opts) { - ahash(hash); - const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); - const { c, dkLen, asyncTick } = opts; - anumber(c, 'c'); - anumber(dkLen, 'dkLen'); - anumber(asyncTick, 'asyncTick'); - if (c < 1) - throw new Error('iterations (c) must be >= 1'); - // RFC 8018 §5.2 defines `dkLen` as "a positive integer". - if (dkLen < 1) - throw new Error('"dkLen" must be >= 1'); - // RFC 8018 §5.2 step 1 requires rejecting oversize `dkLen` - // before allocating the destination buffer. - if (dkLen > (2 ** 32 - 1) * hash.outputLen) - throw new Error('derived key too long'); - const password = kdfInputToBytes(_password, 'password'); - const salt = kdfInputToBytes(_salt, 'salt'); - // DK = PBKDF2(PRF, Password, Salt, c, dkLen); - const DK = new Uint8Array(dkLen); - // U1 = PRF(Password, Salt + INT_32_BE(i)) - const PRF = hmac.create(hash, password); - // Cache PRF(P, S || ...) prefix state so each block only appends INT_32_BE(i). - const PRFSalt = PRF._cloneInto().update(salt); - return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; -} -function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { - // Shared sync/async cleanup point: wipe transient PRF state - // while preserving the derived key buffer. - PRF.destroy(); - PRFSalt.destroy(); - if (prfW) - prfW.destroy(); - clean(u); - return DK; -} -/** - * PBKDF2-HMAC: RFC 8018 key derivation function. - * @param hash - hash function that would be used e.g. sha256 - * @param password - password from which a derived key is generated; - * JS string inputs are UTF-8 encoded first - * @param salt - cryptographic salt; JS string inputs are UTF-8 encoded first - * @param opts - PBKDF2 work factor and output settings. `dkLen`, if provided, - * must be `>= 1` per RFC 8018 §5.2. See {@link Pbkdf2Opt}. - * @returns Derived key bytes. - * @throws If the PBKDF2 iteration count or derived-key settings are invalid. {@link Error} - * @example - * PBKDF2-HMAC: RFC 2898 key derivation function. - * ```ts - * import { pbkdf2 } from '@noble/hashes/pbkdf2.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const key = pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) }); - * ``` - */ -export function pbkdf2(hash, password, salt, opts) { - const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); - let prfW; // Working copy - const arr = new Uint8Array(4); - const view = createView(arr); - const u = new Uint8Array(PRF.outputLen); - // DK = T1 + T2 + ⋯ + Tdklen/hlen - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - // Ti = F(Password, Salt, c, i) - // The last Ti view can be shorter than hLen, which applies - // RFC 8018 §5.2 step 4's T_l<0..r-1> truncation without extra copies. - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc - // U1 = PRF(Password, Salt + INT_32_BE(i)) - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - for (let ui = 1; ui < c; ui++) { - // Uc = PRF(Password, Uc−1) - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) - Ti[i] ^= u[i]; - } - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); -} -/** - * PBKDF2-HMAC: RFC 8018 key derivation function. Async version. - * @param hash - hash function that would be used e.g. sha256 - * @param password - password from which a derived key is generated; - * JS string inputs are UTF-8 encoded first - * @param salt - cryptographic salt; JS string inputs are UTF-8 encoded first - * @param opts - PBKDF2 work factor and output settings. `dkLen`, if provided, - * must be `>= 1` per RFC 8018 §5.2. `asyncTick` is only a local - * scheduler-yield knob for this JS wrapper, not part of RFC 8018. - * See {@link Pbkdf2Opt}. - * @returns Promise resolving to derived key bytes. - * @throws If the PBKDF2 iteration count or derived-key settings are invalid. {@link Error} - * @example - * PBKDF2-HMAC: RFC 2898 key derivation function. - * ```ts - * import { pbkdf2Async } from '@noble/hashes/pbkdf2.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const key = await pbkdf2Async(sha256, 'password', 'salt', { dkLen: 32, c: 500_000 }); - * ``` - */ -export async function pbkdf2Async(hash, password, salt, opts) { - const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); - let prfW; // Working copy - const arr = new Uint8Array(4); - const view = createView(arr); - const u = new Uint8Array(PRF.outputLen); - // DK = T1 + T2 + ⋯ + Tdklen/hlen - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - // Ti = F(Password, Salt, c, i) - // The last Ti view can be shorter than hLen, which applies - // RFC 8018 §5.2 step 4's T_l<0..r-1> truncation without extra copies. - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc - // U1 = PRF(Password, Salt + INT_32_BE(i)) - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - await asyncLoop(c - 1, asyncTick, () => { - // Uc = PRF(Password, Uc−1) - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) - Ti[i] ^= u[i]; - }); - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); -} -//# sourceMappingURL=pbkdf2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/pbkdf2.js.map b/node_modules/@noble/hashes/pbkdf2.js.map deleted file mode 100644 index 291eca4..0000000 --- a/node_modules/@noble/hashes/pbkdf2.js.map +++ /dev/null @@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AK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE;gBAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/scrypt.d.ts b/node_modules/@noble/hashes/scrypt.d.ts deleted file mode 100644 index b23a26e..0000000 --- a/node_modules/@noble/hashes/scrypt.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { type KDFInput, type TArg, type TRet } from './utils.ts'; -/** - * Scrypt options: - * - `N` is cpu/mem work factor (power of 2 e.g. `2**18`) - * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance - * - `p` is parallelization factor (1 is common) - * - `dkLen` is output key length in bytes e.g. 32, and must be `>= 1` per RFC 7914 §2. - * - `asyncTick` - (default: 10) max time in ms for which async function can block execution - * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt - * - `onProgress` - callback function that would be executed for progress report - */ -export type ScryptOpts = { - /** CPU and memory work factor. Must be a power of two. */ - N: number; - /** Block size parameter. */ - r: number; - /** Parallelization factor. */ - p: number; - /** Desired derived key length in bytes, must be `>= 1` per RFC 7914 §2. */ - dkLen?: number; - /** Max scheduler block time in milliseconds for the async variant. */ - asyncTick?: number; - /** Maximum temporary memory budget in bytes. */ - maxmem?: number; - /** - * Optional progress callback invoked during long-running derivations. - * param progress - completion fraction in the `0..1` range - */ - onProgress?: (progress: number) => void; -}; -/** - * Scrypt KDF from RFC 7914. See {@link ScryptOpts}. - * @param password - password or key material to derive from; - * JS string inputs are UTF-8 encoded first - * @param salt - unique salt bytes or string; JS string inputs are UTF-8 encoded first - * @param opts - Scrypt cost and memory parameters. `dkLen`, if provided, - * must be `>= 1` per RFC 7914 §2. See {@link ScryptOpts}. - * @returns Derived key bytes. - * @throws If the Scrypt cost, memory, or callback options are invalid. {@link Error} - * @example - * Derive a key with scrypt. - * ```ts - * scrypt('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 }); - * ``` - */ -export declare function scrypt(password: TArg, salt: TArg, opts: TArg): TRet; -/** - * Scrypt KDF from RFC 7914. Async version. See {@link ScryptOpts}. - * @param password - password or key material to derive from; - * JS string inputs are UTF-8 encoded first - * @param salt - unique salt bytes or string; JS string inputs are UTF-8 encoded first - * @param opts - Scrypt cost and memory parameters. `dkLen`, if provided, - * must be `>= 1` per RFC 7914 §2. `asyncTick` is only a local - * scheduler-yield control for this JS wrapper, not part of RFC 7914. - * See {@link ScryptOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Scrypt cost, memory, or callback options are invalid. {@link Error} - * @example - * Derive a key with scrypt asynchronously. - * ```ts - * await scryptAsync('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 }); - * ``` - */ -export declare function scryptAsync(password: TArg, salt: TArg, opts: TArg): Promise>; -//# sourceMappingURL=scrypt.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/scrypt.d.ts.map b/node_modules/@noble/hashes/scrypt.d.ts.map deleted file mode 100644 index 4b642af..0000000 --- a/node_modules/@noble/hashes/scrypt.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scrypt.d.ts","sourceRoot":"","sources":["src/scrypt.ts"],"names":[],"mappings":"AAOA,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAkFpB;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,0DAA0D;IAC1D,CAAC,EAAE,MAAM,CAAC;IACV,4BAA4B;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,8BAA8B;IAC9B,CAAC,EAAE,MAAM,CAAC;IACV,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAiFF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EACxB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,EACpB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,GACrB,IAAI,CAAC,UAAU,CAAC,CAgClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EACxB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,EACpB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,GACrB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAiC3B"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/scrypt.js b/node_modules/@noble/hashes/scrypt.js deleted file mode 100644 index 29ff883..0000000 --- a/node_modules/@noble/hashes/scrypt.js +++ /dev/null @@ -1,257 +0,0 @@ -/** - * RFC 7914 Scrypt KDF. Can be used to create a key from password and salt. - * @module - */ -import { pbkdf2 } from "./pbkdf2.js"; -import { sha256 } from "./sha2.js"; -// prettier-ignore -import { anumber, asyncLoop, checkOpts, clean, rotl, swap32IfBE, u32 } from "./utils.js"; -// The main Scrypt loop: uses Salsa extensively. -// Six versions of the function were tried, this is the fastest one. -// RFC 7914 §3 / §4 step 2 applies Salsa20/8 to one 16-word (64-byte) block -// after xor'ing two such blocks. -// The local `y*` snapshot keeps the xor input stable even when `out` aliases `prev` or `input`. -// prettier-ignore -function XorAndSalsa(prev, pi, input, ii, out, oi) { - // Based on https://cr.yp.to/salsa20.html and RFC 7914's Salsa20/8 core. - // Xor blocks - let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; - let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; - let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; - let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; - let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; - let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; - let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; - let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; - // Save state to temporary variables (salsa) - let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15; - // Main loop (salsa) - for (let i = 0; i < 8; i += 2) { - x04 ^= rotl(x00 + x12 | 0, 7); - x08 ^= rotl(x04 + x00 | 0, 9); - x12 ^= rotl(x08 + x04 | 0, 13); - x00 ^= rotl(x12 + x08 | 0, 18); - x09 ^= rotl(x05 + x01 | 0, 7); - x13 ^= rotl(x09 + x05 | 0, 9); - x01 ^= rotl(x13 + x09 | 0, 13); - x05 ^= rotl(x01 + x13 | 0, 18); - x14 ^= rotl(x10 + x06 | 0, 7); - x02 ^= rotl(x14 + x10 | 0, 9); - x06 ^= rotl(x02 + x14 | 0, 13); - x10 ^= rotl(x06 + x02 | 0, 18); - x03 ^= rotl(x15 + x11 | 0, 7); - x07 ^= rotl(x03 + x15 | 0, 9); - x11 ^= rotl(x07 + x03 | 0, 13); - x15 ^= rotl(x11 + x07 | 0, 18); - x01 ^= rotl(x00 + x03 | 0, 7); - x02 ^= rotl(x01 + x00 | 0, 9); - x03 ^= rotl(x02 + x01 | 0, 13); - x00 ^= rotl(x03 + x02 | 0, 18); - x06 ^= rotl(x05 + x04 | 0, 7); - x07 ^= rotl(x06 + x05 | 0, 9); - x04 ^= rotl(x07 + x06 | 0, 13); - x05 ^= rotl(x04 + x07 | 0, 18); - x11 ^= rotl(x10 + x09 | 0, 7); - x08 ^= rotl(x11 + x10 | 0, 9); - x09 ^= rotl(x08 + x11 | 0, 13); - x10 ^= rotl(x09 + x08 | 0, 18); - x12 ^= rotl(x15 + x14 | 0, 7); - x13 ^= rotl(x12 + x15 | 0, 9); - x14 ^= rotl(x13 + x12 | 0, 13); - x15 ^= rotl(x14 + x13 | 0, 18); - } - // Write output (salsa) - out[oi++] = (y00 + x00) | 0; - out[oi++] = (y01 + x01) | 0; - out[oi++] = (y02 + x02) | 0; - out[oi++] = (y03 + x03) | 0; - out[oi++] = (y04 + x04) | 0; - out[oi++] = (y05 + x05) | 0; - out[oi++] = (y06 + x06) | 0; - out[oi++] = (y07 + x07) | 0; - out[oi++] = (y08 + x08) | 0; - out[oi++] = (y09 + x09) | 0; - out[oi++] = (y10 + x10) | 0; - out[oi++] = (y11 + x11) | 0; - out[oi++] = (y12 + x12) | 0; - out[oi++] = (y13 + x13) | 0; - out[oi++] = (y14 + x14) | 0; - out[oi++] = (y15 + x15) | 0; -} -function BlockMix(input, ii, out, oi, r) { - // The block B is `r` 128-byte chunks, i.e. `2r` 16-word (64-byte) Salsa blocks. - let head = oi + 0; - let tail = oi + 16 * r; - for (let i = 0; i < 16; i++) - out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1] - for (let i = 0; i < r; i++, head += 16, ii += 16) { - // RFC 7914 §4 step 3 outputs `Y[0], Y[2], ...` first, then `Y[1], Y[3], ...`; - // `head` and `tail` lay out those even/odd halves in place. - XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1]) - if (i > 0) - tail += 16; // First iteration overwrites tmp value in tail - // tail[i] = Salsa(blockIn[2*i+1] ^ head[i]) - XorAndSalsa(out, head, input, (ii += 16), out, tail); - } -} -// Common prologue and epilogue for sync/async functions -function scryptInit(password, salt, _opts) { - // Maxmem - 1GB+1KB by default - const opts = checkOpts({ - dkLen: 32, - asyncTick: 10, - maxmem: 1024 ** 3 + 1024, - }, _opts); - const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; - anumber(N, 'N'); - anumber(r, 'r'); - anumber(p, 'p'); - anumber(dkLen, 'dkLen'); - anumber(asyncTick, 'asyncTick'); - anumber(maxmem, 'maxmem'); - if (onProgress !== undefined && typeof onProgress !== 'function') - throw new Error('progressCb must be a function'); - const blockSize = 128 * r; - const blockSize32 = blockSize / 4; - // Max N is 2^32 (Integrify is 32-bit). - // Real limit can be 2^22: some JS engines limit Uint8Array to 4GB. - // Spec check `N >= 2^(blockSize / 8)` is not done for compat with popular libs, - // which used incorrect r: 1, p: 8. Also, the check seems to be a spec error: - // https://www.rfc-editor.org/errata_search.php?rfc=7914 - const pow32 = Math.pow(2, 32); - if (N <= 1 || (N & (N - 1)) !== 0 || N > pow32) - throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32'); - if (p < 1 || p > ((pow32 - 1) * 32) / blockSize) - throw new Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)'); - // RFC 7914 §2 defines `dkLen` as a positive integer. - if (dkLen < 1 || dkLen > (pow32 - 1) * 32) - throw new Error('"dkLen" expected integer 1..(2^32 - 1) * 32'); - // Include the shared `tmp` scratch block so `maxmem` matches noble's actual temporary allocation. - // Node requires more headroom here, so this accounting is intentionally noble-specific. - const memUsed = blockSize * (N + p + 1); - if (memUsed > maxmem) - throw new Error('"maxmem" limit was hit: memUsed(128*r*(N+p+1))=' + memUsed + ', maxmem=' + maxmem); - // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor) - // Since it has only one iteration there is no reason to use async variant - const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p }); - const B32 = u32(B); - // Re-used between parallel iterations. Array(iterations) of B - const V = u32(new Uint8Array(blockSize * N)); - const tmp = u32(new Uint8Array(blockSize)); - let blockMixCb = () => { }; - if (onProgress) { - const totalBlockMix = 2 * N * p; - // Invoke callback if progress changes from 10.01 to 10.02 - // Allows to draw smooth progress bar on up to 8K screen - const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1); - let blockMixCnt = 0; - blockMixCb = () => { - blockMixCnt++; - if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) - onProgress(blockMixCnt / totalBlockMix); - }; - } - return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; -} -function scryptOutput(password, dkLen, B, V, tmp) { - // Shared final PBKDF2-and-cleanup step: keep the derived key, wipe the scrypt workspace. - const res = pbkdf2(sha256, password, B, { c: 1, dkLen }); - clean(B, V, tmp); - return res; -} -/** - * Scrypt KDF from RFC 7914. See {@link ScryptOpts}. - * @param password - password or key material to derive from; - * JS string inputs are UTF-8 encoded first - * @param salt - unique salt bytes or string; JS string inputs are UTF-8 encoded first - * @param opts - Scrypt cost and memory parameters. `dkLen`, if provided, - * must be `>= 1` per RFC 7914 §2. See {@link ScryptOpts}. - * @returns Derived key bytes. - * @throws If the Scrypt cost, memory, or callback options are invalid. {@link Error} - * @example - * Derive a key with scrypt. - * ```ts - * scrypt('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 }); - * ``` - */ -export function scrypt(password, salt, opts) { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts); - swap32IfBE(B32); - for (let pi = 0; pi < p; pi++) { - const Pi = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi + i]; // V[0] = B[i] - for (let i = 0, pos = 0; i < N - 1; i++) { - BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); - blockMixCb(); - } - BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element - blockMixCb(); - for (let i = 0; i < N; i++) { - // First u32 of the last 64-byte block (u32 is LE) - // RFC 7914 Integerify(X) uses the whole last 64-byte block, but mod N - // only depends on the low word here because N is a power of two and - // this implementation caps N at 2^32. - // & (N - 1) is % N as N is a power of 2, N & (N - 1) = 0 is checked - // above; >>> 0 for unsigned, input fits in u32. - const j = (B32[Pi + blockSize32 - 16] & (N - 1)) >>> 0; // j = Integrify(X) % iterations - // tmp = B ^ V[j] - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; - BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) - blockMixCb(); - } - } - swap32IfBE(B32); - return scryptOutput(password, dkLen, B, V, tmp); -} -/** - * Scrypt KDF from RFC 7914. Async version. See {@link ScryptOpts}. - * @param password - password or key material to derive from; - * JS string inputs are UTF-8 encoded first - * @param salt - unique salt bytes or string; JS string inputs are UTF-8 encoded first - * @param opts - Scrypt cost and memory parameters. `dkLen`, if provided, - * must be `>= 1` per RFC 7914 §2. `asyncTick` is only a local - * scheduler-yield control for this JS wrapper, not part of RFC 7914. - * See {@link ScryptOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Scrypt cost, memory, or callback options are invalid. {@link Error} - * @example - * Derive a key with scrypt asynchronously. - * ```ts - * await scryptAsync('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 }); - * ``` - */ -export async function scryptAsync(password, salt, opts) { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts); - swap32IfBE(B32); - for (let pi = 0; pi < p; pi++) { - const Pi = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi + i]; // V[0] = B[i] - let pos = 0; - await asyncLoop(N - 1, asyncTick, () => { - BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); - blockMixCb(); - }); - BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element - blockMixCb(); - await asyncLoop(N, asyncTick, () => { - // First u32 of the last 64-byte block (u32 is LE) - // RFC 7914 Integerify(X) uses the whole last 64-byte block, but mod N - // only depends on the low word here because N is a power of two and - // this implementation caps N at 2^32. - // & (N - 1) is % N as N is a power of 2, N & (N - 1) = 0 is checked - // above; >>> 0 for unsigned, input fits in u32. - const j = (B32[Pi + blockSize32 - 16] & (N - 1)) >>> 0; // j = Integrify(X) % iterations - // tmp = B ^ V[j] - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; - BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) - blockMixCb(); - }); - } - swap32IfBE(B32); - return scryptOutput(password, dkLen, B, V, tmp); -} -//# sourceMappingURL=scrypt.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/scrypt.js.map b/node_modules/@noble/hashes/scrypt.js.map deleted file mode 100644 index 7daddda..0000000 --- a/node_modules/@noble/hashes/scrypt.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scrypt.js","sourceRoot":"","sources":["src/scrypt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,kBAAkB;AAClB,OAAO,EACL,OAAO,EAAE,SAAS,EAClB,SAAS,EAAE,KAAK,EAChB,IAAI,EACJ,UAAU,EACV,GAAG,EAIJ,MAAM,YAAY,CAAC;AAEpB,gDAAgD;AAChD,oEAAoE;AACpE,2EAA2E;AAC3E,iCAAiC;AACjC,gGAAgG;AAChG,kBAAkB;AAClB,SAAS,WAAW,CAClB,IAAuB,EACvB,EAAU,EACV,KAAwB,EACxB,EAAU,EACV,GAAsB,EACtB,EAAU;IAEV,wEAAwE;IACxE,aAAa;IACb,IAAI,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,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CAAC,CAAC,CAAC,gCAAgC;YACxF,iBAAiB;YACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE;gBAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC;YACpF,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,yBAAyB;YACvD,UAAU,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IACD,UAAU,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha2.d.ts b/node_modules/@noble/hashes/sha2.d.ts deleted file mode 100644 index b7a1d54..0000000 --- a/node_modules/@noble/hashes/sha2.d.ts +++ /dev/null @@ -1,249 +0,0 @@ -/** - * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256. - * SHA256 is the fastest hash implementable in JS, even faster than Blake3. - * Check out {@link https://www.rfc-editor.org/rfc/rfc4634 | RFC 4634} and - * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf | FIPS 180-4}. - * @module - */ -import { HashMD } from './_md.ts'; -import { type CHash, type TRet } from './utils.ts'; -/** Internal SHA-224 / SHA-256 compression engine from RFC 6234 §6.2. */ -declare abstract class SHA2_32B> extends HashMD { - protected abstract A: number; - protected abstract B: number; - protected abstract C: number; - protected abstract D: number; - protected abstract E: number; - protected abstract F: number; - protected abstract G: number; - protected abstract H: number; - constructor(outputLen: number); - protected get(): [number, number, number, number, number, number, number, number]; - protected set(A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number): void; - protected process(view: DataView, offset: number): void; - protected roundClean(): void; - destroy(): void; -} -/** Internal SHA-256 hash class grounded in RFC 6234 §6.2. */ -export declare class _SHA256 extends SHA2_32B<_SHA256> { - protected A: number; - protected B: number; - protected C: number; - protected D: number; - protected E: number; - protected F: number; - protected G: number; - protected H: number; - constructor(); -} -/** Internal SHA-224 hash class grounded in RFC 6234 §6.2 and §8.5. */ -export declare class _SHA224 extends SHA2_32B<_SHA224> { - protected A: number; - protected B: number; - protected C: number; - protected D: number; - protected E: number; - protected F: number; - protected G: number; - protected H: number; - constructor(); -} -/** Internal SHA-384 / SHA-512 compression engine from RFC 6234 §6.4. */ -declare abstract class SHA2_64B> extends HashMD { - protected abstract Ah: number; - protected abstract Al: number; - protected abstract Bh: number; - protected abstract Bl: number; - protected abstract Ch: number; - protected abstract Cl: number; - protected abstract Dh: number; - protected abstract Dl: number; - protected abstract Eh: number; - protected abstract El: number; - protected abstract Fh: number; - protected abstract Fl: number; - protected abstract Gh: number; - protected abstract Gl: number; - protected abstract Hh: number; - protected abstract Hl: number; - constructor(outputLen: number); - protected get(): [ - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number, - number - ]; - protected set(Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number, Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number): void; - protected process(view: DataView, offset: number): void; - protected roundClean(): void; - destroy(): void; -} -/** Internal SHA-512 hash class grounded in RFC 6234 §6.3 and §6.4. */ -export declare class _SHA512 extends SHA2_64B<_SHA512> { - protected Ah: number; - protected Al: number; - protected Bh: number; - protected Bl: number; - protected Ch: number; - protected Cl: number; - protected Dh: number; - protected Dl: number; - protected Eh: number; - protected El: number; - protected Fh: number; - protected Fl: number; - protected Gh: number; - protected Gl: number; - protected Hh: number; - protected Hl: number; - constructor(); -} -/** Internal SHA-384 hash class grounded in RFC 6234 §6.3 and §6.4. */ -export declare class _SHA384 extends SHA2_64B<_SHA384> { - protected Ah: number; - protected Al: number; - protected Bh: number; - protected Bl: number; - protected Ch: number; - protected Cl: number; - protected Dh: number; - protected Dl: number; - protected Eh: number; - protected El: number; - protected Fh: number; - protected Fl: number; - protected Gh: number; - protected Gl: number; - protected Hh: number; - protected Hl: number; - constructor(); -} -/** Internal SHA-512/224 hash class using the derived `T224_IV` and the shared - * RFC 6234 §6.4 compression engine. */ -export declare class _SHA512_224 extends SHA2_64B<_SHA512_224> { - protected Ah: number; - protected Al: number; - protected Bh: number; - protected Bl: number; - protected Ch: number; - protected Cl: number; - protected Dh: number; - protected Dl: number; - protected Eh: number; - protected El: number; - protected Fh: number; - protected Fl: number; - protected Gh: number; - protected Gl: number; - protected Hh: number; - protected Hl: number; - constructor(); -} -/** Internal SHA-512/256 hash class using the derived `T256_IV` and the shared - * RFC 6234 §6.4 compression engine. */ -export declare class _SHA512_256 extends SHA2_64B<_SHA512_256> { - protected Ah: number; - protected Al: number; - protected Bh: number; - protected Bl: number; - protected Ch: number; - protected Cl: number; - protected Dh: number; - protected Dl: number; - protected Eh: number; - protected El: number; - protected Fh: number; - protected Fl: number; - protected Gh: number; - protected Gl: number; - protected Hh: number; - protected Hl: number; - constructor(); -} -/** - * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info: - * - * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack. - * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025. - * - Each sha256 hash is executing 2^18 bit operations. - * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-256. - * ```ts - * sha256(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha256: TRet>; -/** - * SHA2-224 hash function from RFC 4634. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-224. - * ```ts - * sha224(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha224: TRet>; -/** - * SHA2-512 hash function from RFC 4634. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-512. - * ```ts - * sha512(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha512: TRet>; -/** - * SHA2-384 hash function from RFC 4634. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-384. - * ```ts - * sha384(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha384: TRet>; -/** - * SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks. - * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-512/256. - * ```ts - * sha512_256(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha512_256: TRet>; -/** - * SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks. - * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-512/224. - * ```ts - * sha512_224(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha512_224: TRet>; -export {}; -//# sourceMappingURL=sha2.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha2.d.ts.map b/node_modules/@noble/hashes/sha2.d.ts.map deleted file mode 100644 index 717e788..0000000 --- a/node_modules/@noble/hashes/sha2.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha2.d.ts","sourceRoot":"","sources":["src/sha2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAO,MAAM,EAAmD,MAAM,UAAU,CAAC;AAExF,OAAO,EAAE,KAAK,KAAK,EAAsC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAqBvF,wEAAwE;AACxE,uBAAe,QAAQ,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,CAAE,SAAQ,MAAM,CAAC,CAA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ff --git a/node_modules/@noble/hashes/sha2.js b/node_modules/@noble/hashes/sha2.js deleted file mode 100644 index be20232..0000000 --- a/node_modules/@noble/hashes/sha2.js +++ /dev/null @@ -1,458 +0,0 @@ -/** - * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256. - * SHA256 is the fastest hash implementable in JS, even faster than Blake3. - * Check out {@link https://www.rfc-editor.org/rfc/rfc4634 | RFC 4634} and - * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf | FIPS 180-4}. - * @module - */ -import { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from "./_md.js"; -import * as u64 from "./_u64.js"; -import { clean, createHasher, oidNist, rotr } from "./utils.js"; -/** - * SHA-224 / SHA-256 round constants from RFC 6234 §5.1: the first 32 bits - * of the cube roots of the first 64 primes (2..311). - */ -// prettier-ignore -const SHA256_K = /* @__PURE__ */ Uint32Array.from([ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -]); -/** Reusable SHA-224 / SHA-256 message schedule buffer `W_t` from RFC 6234 §6.2 step 1. */ -const SHA256_W = /* @__PURE__ */ new Uint32Array(64); -/** Internal SHA-224 / SHA-256 compression engine from RFC 6234 §6.2. */ -class SHA2_32B extends HashMD { - constructor(outputLen) { - super(64, outputLen, 8, false); - } - get() { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - // prettier-ignore - set(A, B, C, D, E, F, G, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - process(view, offset) { - // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array - for (let i = 0; i < 16; i++, offset += 4) - SHA256_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W[i - 15]; - const W2 = SHA256_W[i - 2]; - const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); - const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); - SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; - } - // Compression function main loop, 64 rounds - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); - const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); - const T2 = (sigma0 + Maj(A, B, C)) | 0; - H = G; - G = F; - F = E; - E = (D + T1) | 0; - D = C; - C = B; - B = A; - A = (T1 + T2) | 0; - } - // Add the compressed chunk to the current hash value - A = (A + this.A) | 0; - B = (B + this.B) | 0; - C = (C + this.C) | 0; - D = (D + this.D) | 0; - E = (E + this.E) | 0; - F = (F + this.F) | 0; - G = (G + this.G) | 0; - H = (H + this.H) | 0; - this.set(A, B, C, D, E, F, G, H); - } - roundClean() { - clean(SHA256_W); - } - destroy() { - // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves - // update()/digest() callable on reused instances. - this.destroyed = true; - this.set(0, 0, 0, 0, 0, 0, 0, 0); - clean(this.buffer); - } -} -/** Internal SHA-256 hash class grounded in RFC 6234 §6.2. */ -export class _SHA256 extends SHA2_32B { - // We cannot use array here since array allows indexing by variable - // which means optimizer/compiler cannot use registers. - A = SHA256_IV[0] | 0; - B = SHA256_IV[1] | 0; - C = SHA256_IV[2] | 0; - D = SHA256_IV[3] | 0; - E = SHA256_IV[4] | 0; - F = SHA256_IV[5] | 0; - G = SHA256_IV[6] | 0; - H = SHA256_IV[7] | 0; - constructor() { - super(32); - } -} -/** Internal SHA-224 hash class grounded in RFC 6234 §6.2 and §8.5. */ -export class _SHA224 extends SHA2_32B { - A = SHA224_IV[0] | 0; - B = SHA224_IV[1] | 0; - C = SHA224_IV[2] | 0; - D = SHA224_IV[3] | 0; - E = SHA224_IV[4] | 0; - F = SHA224_IV[5] | 0; - G = SHA224_IV[6] | 0; - H = SHA224_IV[7] | 0; - constructor() { - super(28); - } -} -// SHA2-512 is slower than sha256 in js because u64 operations are slow. -// SHA-384 / SHA-512 round constants from RFC 6234 §5.2: -// 80 full 64-bit words split into high/low halves. -// prettier-ignore -const K512 = /* @__PURE__ */ (() => u64.split([ - '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', - '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', - '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', - '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', - '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', - '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', - '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', - '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', - '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', - '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', - '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', - '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', - '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', - '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', - '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', - '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', - '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', - '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', - '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', - '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' -].map(n => BigInt(n))))(); -const SHA512_Kh = /* @__PURE__ */ (() => K512[0])(); -const SHA512_Kl = /* @__PURE__ */ (() => K512[1])(); -// Reusable high-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words. -const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); -// Reusable low-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words. -const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); -/** Internal SHA-384 / SHA-512 compression engine from RFC 6234 §6.4. */ -class SHA2_64B extends HashMD { - constructor(outputLen) { - super(128, outputLen, 16, false); - } - // prettier-ignore - get() { - const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; - } - // prettier-ignore - set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { - this.Ah = Ah | 0; - this.Al = Al | 0; - this.Bh = Bh | 0; - this.Bl = Bl | 0; - this.Ch = Ch | 0; - this.Cl = Cl | 0; - this.Dh = Dh | 0; - this.Dl = Dl | 0; - this.Eh = Eh | 0; - this.El = El | 0; - this.Fh = Fh | 0; - this.Fl = Fl | 0; - this.Gh = Gh | 0; - this.Gl = Gl | 0; - this.Hh = Hh | 0; - this.Hl = Hl | 0; - } - process(view, offset) { - // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array - for (let i = 0; i < 16; i++, offset += 4) { - SHA512_W_H[i] = view.getUint32(offset); - SHA512_W_L[i] = view.getUint32((offset += 4)); - } - for (let i = 16; i < 80; i++) { - // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) - const W15h = SHA512_W_H[i - 15] | 0; - const W15l = SHA512_W_L[i - 15] | 0; - const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7); - const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7); - // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) - const W2h = SHA512_W_H[i - 2] | 0; - const W2l = SHA512_W_L[i - 2] | 0; - const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6); - const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6); - // SHA512_W[i] = s0 + s1 + SHA512_W[i - 7] + SHA512_W[i - 16]; - const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); - const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); - SHA512_W_H[i] = SUMh | 0; - SHA512_W_L[i] = SUMl | 0; - } - let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - // Compression function main loop, 80 rounds - for (let i = 0; i < 80; i++) { - // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) - const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41); - const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41); - //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const CHIh = (Eh & Fh) ^ (~Eh & Gh); - const CHIl = (El & Fl) ^ (~El & Gl); - // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] - // prettier-ignore - const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); - const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); - const T1l = T1ll | 0; - // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) - const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39); - const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39); - const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); - const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); - Hh = Gh | 0; - Hl = Gl | 0; - Gh = Fh | 0; - Gl = Fl | 0; - Fh = Eh | 0; - Fl = El | 0; - ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); - Dh = Ch | 0; - Dl = Cl | 0; - Ch = Bh | 0; - Cl = Bl | 0; - Bh = Ah | 0; - Bl = Al | 0; - const All = u64.add3L(T1l, sigma0l, MAJl); - Ah = u64.add3H(All, T1h, sigma0h, MAJh); - Al = All | 0; - } - // Add the compressed chunk to the current hash value - ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); - ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); - ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); - ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); - ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); - ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); - ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); - ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); - this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); - } - roundClean() { - clean(SHA512_W_H, SHA512_W_L); - } - destroy() { - // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves - // update()/digest() callable on reused instances. - this.destroyed = true; - clean(this.buffer); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } -} -/** Internal SHA-512 hash class grounded in RFC 6234 §6.3 and §6.4. */ -export class _SHA512 extends SHA2_64B { - Ah = SHA512_IV[0] | 0; - Al = SHA512_IV[1] | 0; - Bh = SHA512_IV[2] | 0; - Bl = SHA512_IV[3] | 0; - Ch = SHA512_IV[4] | 0; - Cl = SHA512_IV[5] | 0; - Dh = SHA512_IV[6] | 0; - Dl = SHA512_IV[7] | 0; - Eh = SHA512_IV[8] | 0; - El = SHA512_IV[9] | 0; - Fh = SHA512_IV[10] | 0; - Fl = SHA512_IV[11] | 0; - Gh = SHA512_IV[12] | 0; - Gl = SHA512_IV[13] | 0; - Hh = SHA512_IV[14] | 0; - Hl = SHA512_IV[15] | 0; - constructor() { - super(64); - } -} -/** Internal SHA-384 hash class grounded in RFC 6234 §6.3 and §6.4. */ -export class _SHA384 extends SHA2_64B { - Ah = SHA384_IV[0] | 0; - Al = SHA384_IV[1] | 0; - Bh = SHA384_IV[2] | 0; - Bl = SHA384_IV[3] | 0; - Ch = SHA384_IV[4] | 0; - Cl = SHA384_IV[5] | 0; - Dh = SHA384_IV[6] | 0; - Dl = SHA384_IV[7] | 0; - Eh = SHA384_IV[8] | 0; - El = SHA384_IV[9] | 0; - Fh = SHA384_IV[10] | 0; - Fl = SHA384_IV[11] | 0; - Gh = SHA384_IV[12] | 0; - Gl = SHA384_IV[13] | 0; - Hh = SHA384_IV[14] | 0; - Hl = SHA384_IV[15] | 0; - constructor() { - super(48); - } -} -/** - * Truncated SHA512/256 and SHA512/224. - * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as "intermediary" IV of SHA512/t. - * Then t hashes string to produce result IV. - * See the repo-side derivation recipe in `test/misc/sha2-gen-iv.js`. - * These IV literals are checked against that script rather than a dedicated - * local RFC section. - */ -/** SHA-512/224 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and - * stored as sixteen big-endian 32-bit halves. */ -const T224_IV = /* @__PURE__ */ Uint32Array.from([ - 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf, - 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1, -]); -/** SHA-512/256 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and - * stored as sixteen big-endian 32-bit halves. */ -const T256_IV = /* @__PURE__ */ Uint32Array.from([ - 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd, - 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2, -]); -/** Internal SHA-512/224 hash class using the derived `T224_IV` and the shared - * RFC 6234 §6.4 compression engine. */ -export class _SHA512_224 extends SHA2_64B { - Ah = T224_IV[0] | 0; - Al = T224_IV[1] | 0; - Bh = T224_IV[2] | 0; - Bl = T224_IV[3] | 0; - Ch = T224_IV[4] | 0; - Cl = T224_IV[5] | 0; - Dh = T224_IV[6] | 0; - Dl = T224_IV[7] | 0; - Eh = T224_IV[8] | 0; - El = T224_IV[9] | 0; - Fh = T224_IV[10] | 0; - Fl = T224_IV[11] | 0; - Gh = T224_IV[12] | 0; - Gl = T224_IV[13] | 0; - Hh = T224_IV[14] | 0; - Hl = T224_IV[15] | 0; - constructor() { - super(28); - } -} -/** Internal SHA-512/256 hash class using the derived `T256_IV` and the shared - * RFC 6234 §6.4 compression engine. */ -export class _SHA512_256 extends SHA2_64B { - Ah = T256_IV[0] | 0; - Al = T256_IV[1] | 0; - Bh = T256_IV[2] | 0; - Bl = T256_IV[3] | 0; - Ch = T256_IV[4] | 0; - Cl = T256_IV[5] | 0; - Dh = T256_IV[6] | 0; - Dl = T256_IV[7] | 0; - Eh = T256_IV[8] | 0; - El = T256_IV[9] | 0; - Fh = T256_IV[10] | 0; - Fl = T256_IV[11] | 0; - Gh = T256_IV[12] | 0; - Gl = T256_IV[13] | 0; - Hh = T256_IV[14] | 0; - Hl = T256_IV[15] | 0; - constructor() { - super(32); - } -} -/** - * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info: - * - * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack. - * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025. - * - Each sha256 hash is executing 2^18 bit operations. - * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-256. - * ```ts - * sha256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha256 = /* @__PURE__ */ createHasher(() => new _SHA256(), -/* @__PURE__ */ oidNist(0x01)); -/** - * SHA2-224 hash function from RFC 4634. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-224. - * ```ts - * sha224(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha224 = /* @__PURE__ */ createHasher(() => new _SHA224(), -/* @__PURE__ */ oidNist(0x04)); -/** - * SHA2-512 hash function from RFC 4634. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-512. - * ```ts - * sha512(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha512 = /* @__PURE__ */ createHasher(() => new _SHA512(), -/* @__PURE__ */ oidNist(0x03)); -/** - * SHA2-384 hash function from RFC 4634. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-384. - * ```ts - * sha384(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha384 = /* @__PURE__ */ createHasher(() => new _SHA384(), -/* @__PURE__ */ oidNist(0x02)); -/** - * SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks. - * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-512/256. - * ```ts - * sha512_256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha512_256 = /* @__PURE__ */ createHasher(() => new _SHA512_256(), -/* @__PURE__ */ oidNist(0x06)); -/** - * SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks. - * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-512/224. - * ```ts - * sha512_224(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha512_224 = /* @__PURE__ */ createHasher(() => new _SHA512_224(), -/* @__PURE__ */ oidNist(0x05)); -//# sourceMappingURL=sha2.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha2.js.map b/node_modules/@noble/hashes/sha2.js.map deleted file mode 100644 index 9c8bb3d..0000000 --- a/node_modules/@noble/hashes/sha2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha2.js","sourceRoot":"","sources":["src/sha2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACxF,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAc,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAa,MAAM,YAAY,CAAC;AAEvF;;;GAGG;AACH,kBAAkB;AAClB,MAAM,QAAQ,GAAG,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC;IAChD,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,E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C;AACF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAA6B,eAAe,CAAC,YAAY,CAC9E,GAAG,EAAE,CAAC,IAAI,WAAW,EAAE;AACvB,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAC9B,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3-addons.d.ts b/node_modules/@noble/hashes/sha3-addons.d.ts deleted file mode 100644 index 762b044..0000000 --- a/node_modules/@noble/hashes/sha3-addons.d.ts +++ /dev/null @@ -1,461 +0,0 @@ -/** - * SHA3 (keccak) addons. - * - * * cSHAKE, KMAC, TupleHash, ParallelHash + XOF variants from - * {@link https://csrc.nist.gov/pubs/sp/800/185/final | NIST SP 800-185} - * * KangarooTwelve 🦘 and TurboSHAKE - reduced-round keccak from - * {@link https://datatracker.ietf.org/doc/rfc9861/ | RFC 9861} - * * KeccakPRG: Pseudo-random generator based on Keccak - * ({@link https://keccak.team/files/CSF-0.1.pdf | pdf}) - * @module - */ -import { Keccak, type ShakeOpts } from './sha3.ts'; -import { type CHash, type CHashXOF, type Hash, type HashXOF, type KDFInput, type PRG, type TArg, type TRet } from './utils.ts'; -/** Options for cSHAKE and related SP 800-185 functions. */ -export type cShakeOpts = ShakeOpts & { - /** Optional personalization string mixed into domain separation. */ - personalization?: Uint8Array; - /** - * Optional NIST function-name string used for domain separation. - * SP 800-185 reserves this for standardized function names; applications - * should generally stick to `personalization`. - */ - NISTfn?: KDFInput; -}; -/** TupleHash callable interface. */ -export type ITupleHash = { - /** - * Hashes an ordered tuple of byte arrays. - * @param messages - Ordered byte-array tuple to hash. - * @param opts - TupleHash output and personalization options. See {@link cShakeOpts}. - * @returns Digest bytes. - */ - (messages: TArg, opts?: TArg): TRet; - /** - * Creates an incremental TupleHash state. - * @param opts - TupleHash output and personalization options. See {@link cShakeOpts}. - * @returns Stateful TupleHash instance. - */ - create(opts?: cShakeOpts): _TupleHash; -}; -/** - * 128-bit NIST cSHAKE XOF. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and NIST function-name - * settings. When both `NISTfn` and `personalization` are empty, - * SP 800-185 defines this as plain SHAKE128. Defaults to 16 output bytes - * when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with cSHAKE128. - * ```ts - * cshake128(new Uint8Array([1, 2, 3]), { dkLen: 32 }); - * ``` - */ -export declare const cshake128: TRet>; -/** - * 256-bit NIST cSHAKE XOF. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and NIST function-name - * settings. When both `NISTfn` and `personalization` are empty, - * SP 800-185 defines this as plain SHAKE256. Defaults to 32 output bytes - * when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with cSHAKE256. - * ```ts - * cshake256(new Uint8Array([1, 2, 3]), { dkLen: 64 }); - * ``` - */ -export declare const cshake256: TRet>; -/** - * Internal KMAC class. - * SP 800-185 §8.4.1 still recommends keys at least as long as the target - * security strength. - */ -export declare class _KMAC extends Keccak implements HashXOF<_KMAC> { - constructor(blockLen: number, outputLen: number, enableXOF: boolean, key: TArg, opts?: TArg); - protected finish(): void; - _cloneInto(to?: _KMAC): _KMAC; - clone(): _KMAC; -} -/** KMAC callable interface. */ -export type IKMAC = { - /** - * Computes a keyed KMAC digest for one message. - * @param key - Secret key bytes. - * @param message - Message bytes to authenticate. - * @param opts - KMAC output and personalization options. See {@link KangarooOpts}. - * @returns Authentication tag bytes. - */ - (key: TArg, message: TArg, opts?: TArg): TRet; - /** - * Creates an incremental KMAC state. - * @param key - Secret key bytes. - * @param opts - KMAC output and personalization options. See {@link cShakeOpts}. - * @returns Stateful KMAC instance. - */ - create(key: TArg, opts?: TArg): _KMAC; -}; -/** - * 128-bit Keccak MAC. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC128. - * ```ts - * kmac128(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -export declare const kmac128: TRet; -/** - * 256-bit Keccak MAC. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC256. - * ```ts - * kmac256(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -export declare const kmac256: TRet; -/** - * 128-bit Keccak-MAC XOF. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC128 XOF output. - * ```ts - * kmac128xof(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]), { dkLen: 32 }); - * ``` - */ -export declare const kmac128xof: TRet; -/** - * 256-bit Keccak-MAC XOF. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC256 XOF output. - * ```ts - * kmac256xof(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]), { dkLen: 64 }); - * ``` - */ -export declare const kmac256xof: TRet; -/** - * Internal TupleHash class for byte-array tuple elements. - * This implementation relies on SP 800-185's byte-oriented encoding form - * rather than arbitrary bit strings. - */ -export declare class _TupleHash extends Keccak implements HashXOF<_TupleHash> { - constructor(blockLen: number, outputLen: number, enableXOF: boolean, opts?: TArg); - protected finish(): void; - _cloneInto(to?: _TupleHash): _TupleHash; - clone(): _TupleHash; -} -/** - * 128-bit TupleHASH. `tuple(['ab', 'cd']) != tuple(['a', 'bcd'])`. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash128. - * ```ts - * tuplehash128([new Uint8Array([1]), new Uint8Array([2])]); - * ``` - */ -export declare const tuplehash128: TRet; -/** - * 256-bit TupleHASH. `tuple(['ab', 'cd']) != tuple(['a', 'bcd'])`. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash256. - * ```ts - * tuplehash256([new Uint8Array([1]), new Uint8Array([2])]); - * ``` - */ -export declare const tuplehash256: TRet; -/** - * 128-bit TupleHASH XOF. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash128 XOF output. - * ```ts - * tuplehash128xof([new Uint8Array([1]), new Uint8Array([2])], { dkLen: 32 }); - * ``` - */ -export declare const tuplehash128xof: TRet; -/** - * 256-bit TupleHASH XOF. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash256 XOF output. - * ```ts - * tuplehash256xof([new Uint8Array([1]), new Uint8Array([2])], { dkLen: 64 }); - * ``` - */ -export declare const tuplehash256xof: TRet; -type ParallelOpts = KangarooOpts & { - blockLen?: number; -}; -/** Internal Parallel Keccak Hash class. */ -export declare class _ParallelHash extends Keccak implements HashXOF<_ParallelHash> { - private leafHash?; - protected leafCons: () => Hash; - private chunkPos; - private chunksDone; - private chunkLen; - constructor(blockLen: number, outputLen: number, leafCons: () => Hash, enableXOF: boolean, opts?: TArg); - protected finish(): void; - _cloneInto(to?: _ParallelHash): _ParallelHash; - destroy(): void; - clone(): _ParallelHash; -} -/** - * 128-bit ParallelHash. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 16 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash128. - * ```ts - * parallelhash128(new Uint8Array([1, 2, 3])); - * ``` - */ -export declare const parallelhash128: TRet>; -/** - * 256-bit ParallelHash. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 32 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash256. - * ```ts - * parallelhash256(new Uint8Array([1, 2, 3])); - * ``` - */ -export declare const parallelhash256: TRet>; -/** - * 128-bit ParallelHash XOF. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 16 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash128 XOF output. - * ```ts - * parallelhash128xof(new Uint8Array([1, 2, 3]), { dkLen: 32 }); - * ``` - */ -export declare const parallelhash128xof: TRet>; -/** - * 256-bit ParallelHash XOF. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 32 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash256 XOF output. - * ```ts - * parallelhash256xof(new Uint8Array([1, 2, 3]), { dkLen: 64 }); - * ``` - */ -export declare const parallelhash256xof: TRet>; -/** - * TurboSHAKE options. - * `D` is the domain separation byte; RFC 9861 defines output length `L` - * as a positive integer. - */ -export type TurboshakeOpts = ShakeOpts & { - /** Optional domain separation byte in the `0x01..0x7f` range. */ - D?: number; -}; -/** - * TurboSHAKE 128-bit: reduced 12-round keccak. - * Should've been a simple "shake with 12 rounds", but we got a whole new - * spec about Turbo SHAKE Pro MAX. - * @param msg - message bytes to hash - * @param opts - Optional output-length and domain-separation settings. - * RFC 9861 §2.1 defaults `D` to `0x1f`. Defaults to 32 output bytes when - * `dkLen` is omitted. See {@link TurboshakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with TurboSHAKE128. - * ```ts - * turboshake128(new Uint8Array([1, 2, 3]), { dkLen: 32 }); - * ``` - */ -export declare const turboshake128: TRet>; -/** - * TurboSHAKE 256-bit: reduced 12-round keccak. - * @param msg - message bytes to hash - * @param opts - Optional output-length and domain-separation settings. - * RFC 9861 §2.1 defaults `D` to `0x1f`. Defaults to 64 output bytes when - * `dkLen` is omitted. See {@link TurboshakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with TurboSHAKE256. - * ```ts - * turboshake256(new Uint8Array([1, 2, 3]), { dkLen: 64 }); - * ``` - */ -export declare const turboshake256: TRet>; -/** K12 options. */ -export type KangarooOpts = { - /** - * Desired digest length in bytes. - * RFC 9861 §3 defines output length `L` as a positive integer. - */ - dkLen?: number; - /** - * Optional personalization string mixed into the sponge state. - * Stateful K12 instances keep an internal copy so caller buffers can be - * wiped independently. - */ - personalization?: Uint8Array; -}; -/** Internal K12 hash class. */ -export declare class _KangarooTwelve extends Keccak implements HashXOF<_KangarooTwelve> { - readonly chunkLen = 8192; - private leafHash?; - protected leafLen: number; - private personalization; - private chunkPos; - private chunksDone; - constructor(blockLen: number, leafLen: number, outputLen: number, rounds: number, opts: TArg); - update(data: TArg): this; - protected finish(): void; - destroy(): void; - _cloneInto(to?: _KangarooTwelve): _KangarooTwelve; - clone(): _KangarooTwelve; -} -/** - * 128-bit KangarooTwelve (k12): reduced 12-round keccak. - * @param msg - message bytes to hash - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link KangarooOpts}. - * @returns Digest bytes. - * @example - * Hash a message with KangarooTwelve-128. - * ```ts - * kt128(new Uint8Array([1, 2, 3])); - * ``` - */ -export declare const kt128: TRet>; -/** - * 256-bit KangarooTwelve (k12): reduced 12-round keccak. - * @param msg - message bytes to hash - * @param opts - Optional output and personalization settings. Defaults to - * 64 output bytes when `dkLen` is omitted. See {@link KangarooOpts}. - * @returns Digest bytes. - * @example - * Hash a message with KangarooTwelve-256. - * ```ts - * kt256(new Uint8Array([1, 2, 3])); - * ``` - */ -export declare const kt256: TRet>; -/** KangarooTwelve-based MAC function type. */ -export type HopMAC = (key: TArg, message: TArg, personalization: TArg, dkLen?: number) => TRet; -/** - * 128-bit KangarooTwelve-based MAC. - * - * These untested (there is no test vectors or implementation available). Use at your own risk. - * HopMAC128(Key, M, C, L) = KT128(Key, KT128(M, C, 32), L) - * HopMAC256(Key, M, C, L) = KT256(Key, KT256(M, C, 64), L) - * The inner KangarooTwelve call always uses a fixed 32-byte digest here, - * regardless of the outer `dkLen`. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param personalization - personalization bytes mixed into the inner hash - * @param dkLen - optional output length in bytes - * @returns Authentication tag bytes. - * @example - * Authenticate a message with HopMAC128. - * ```ts - * HopMAC128(new Uint8Array([1]), new Uint8Array([2]), new Uint8Array([3]), 32); - * ``` - */ -export declare const HopMAC128: TRet; -/** - * 256-bit KangarooTwelve-based MAC. - * Like `HopMAC128`, there are no test vectors or known independent - * implementations available for cross-checking. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param personalization - personalization bytes mixed into the inner hash - * @param dkLen - optional output length in bytes. The inner KangarooTwelve - * call still uses a fixed 64-byte digest here, regardless of the outer - * `dkLen`. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with HopMAC256. - * ```ts - * HopMAC256(new Uint8Array([1]), new Uint8Array([2]), new Uint8Array([3]), 64); - * ``` - */ -export declare const HopMAC256: TRet; -/** - * More at - * {@link https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG}. - * Accepted capacities must keep `rho = 1598 - capacity` byte-aligned, and - * `.clean()` later also requires `rate > 801`. - */ -export declare class _KeccakPRG extends Keccak implements PRG { - protected rate: number; - constructor(capacity: number); - protected keccak(): void; - update(data: TArg): this; - protected finish(): void; - digestInto(_out: TArg): void; - addEntropy(seed: TArg): void; - randomBytes(length: number): TRet; - clean(): void; - _cloneInto(to?: _KeccakPRG): _KeccakPRG; - clone(): _KeccakPRG; -} -/** - * KeccakPRG: pseudo-random generator based on Keccak. - * See {@link https://keccak.team/files/CSF-0.1.pdf}. - * @param capacity - sponge capacity in bits. Accepted values are those that - * keep `rho = 1598 - capacity` byte-aligned; the default `254` is chosen - * because it satisfies that duplex layout while leaving a wide byte-aligned - * rate. - * @returns PRG instance backed by a Keccak sponge. - * @example - * Create a Keccak-based pseudorandom generator and read bytes from it. - * ```ts - * const prg = keccakprg(254); - * prg.randomBytes(8); - * ``` - */ -export declare const keccakprg: (capacity?: number) => TRet<_KeccakPRG>; -export {}; -//# sourceMappingURL=sha3-addons.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3-addons.d.ts.map b/node_modules/@noble/hashes/sha3-addons.d.ts.map deleted file mode 100644 index e43e1e3..0000000 --- a/node_modules/@noble/hashes/sha3-addons.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha3-addons.d.ts","sourceRoot":"","sources":["src/sha3-addons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAIL,KAAK,KAAK,EACV,KAAK,QAAQ,EAIb,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,KAAK,QAAQ,EAEb,KAAK,GAAG,EACR,KAAK,IAAI,EACT,KAAK,IAAI,EAEV,MAAM,YAAY,CAAC;AA4CpB,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG;IACnC,oEAAoE;IACpE,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC;CACnB,CAAC;AAuCF,oCAAoC;AACpC,MAAM,MAAM,UAAU,G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,CAAC,EACjC,KAAK,CAAC,EAAE,MAAM,KACX,IAAI,CAAC,UAAU,CAAC,CAAC;AAatB;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAoC,CAAC;AACxE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAoC,CAAC;AAExE;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,MAAO,YAAW,GAAG;IACnD,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;gBACX,QAAQ,EAAE,MAAM;IAW5B,SAAS,CAAC,MAAM,IAAI,IAAI;IAQxB,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI;IAKpC,SAAS,CAAC,MAAM,IAAI,IAAI;IACxB,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI;IAGxC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI;IAGxC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;IAG7C,KAAK,IAAI,IAAI;IAWb,UAAU,CAAC,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU;IAOvC,KAAK,IAAI,UAAU;CAGpB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,GAAI,iBAAc,KAAG,IAAI,CAAC,UAAU,CACZ,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3-addons.js b/node_modules/@noble/hashes/sha3-addons.js deleted file mode 100644 index 21229ed..0000000 --- a/node_modules/@noble/hashes/sha3-addons.js +++ /dev/null @@ -1,783 +0,0 @@ -/** - * SHA3 (keccak) addons. - * - * * cSHAKE, KMAC, TupleHash, ParallelHash + XOF variants from - * {@link https://csrc.nist.gov/pubs/sp/800/185/final | NIST SP 800-185} - * * KangarooTwelve 🦘 and TurboSHAKE - reduced-round keccak from - * {@link https://datatracker.ietf.org/doc/rfc9861/ | RFC 9861} - * * KeccakPRG: Pseudo-random generator based on Keccak - * ({@link https://keccak.team/files/CSF-0.1.pdf | pdf}) - * @module - */ -import { Keccak } from "./sha3.js"; -import { abytes, aexists, anumber, clean, copyBytes, createHasher, kdfInputToBytes, u32, } from "./utils.js"; -// cSHAKE && KMAC (NIST SP800-185) -const _8n = /* @__PURE__ */ BigInt(8); -const _ffn = /* @__PURE__ */ BigInt(0xff); -// It is safe to use bigints here, since they used only for length encoding (not actual data). -// We use bigints in sha256 for lengths too. -// Callers are still expected to supply SP 800-185-valid lengths -// (`0 <= x < 2^2040`); this helper does not enforce that bound. -function leftEncode(n) { - n = BigInt(n); - const res = [Number(n & _ffn)]; - n >>= _8n; - for (; n > 0; n >>= _8n) - res.unshift(Number(n & _ffn)); - res.unshift(res.length); - return new Uint8Array(res); -} -// Same caller contract as `leftEncode(...)`: lengths must already satisfy SP 800-185 §2.3.1. -function rightEncode(n) { - n = BigInt(n); - const res = [Number(n & _ffn)]; - n >>= _8n; - for (; n > 0; n >>= _8n) - res.unshift(Number(n & _ffn)); - res.push(res.length); - return new Uint8Array(res); -} -// `dkLen` validation is deferred to the downstream Keccak constructor. -function chooseLen(opts, outputLen) { - return opts.dkLen === undefined ? outputLen : opts.dkLen; -} -const abytesOrZero = (buf, title = '') => { - if (buf === undefined) - return EMPTY_BUFFER; - abytes(buf, undefined, title); - return buf; -}; -// NOTE: second modulo is necessary since we don't need to add padding if the -// current element takes a whole block. -// Callers only pass the fixed positive Keccak rates here (`168` or `136`); -// `block <= 0` is not validated locally. -const getPadding = (len, block) => new Uint8Array((block - (len % block)) % block); -// Personalization -function cshakePers(hash, opts = {}) { - const h = hash; - if (!opts || (opts.personalization === undefined && opts.NISTfn === undefined)) - return h; - // Encode and pad inplace to avoid unneccesary memory copies/slices so we - // don't need to zero them later. - // bytepad(encode_string(N) || encode_string(S), rate), where `rate` is the - // current cSHAKE/KMAC/TupleHash/ParallelHash block length. - const blockLenBytes = leftEncode(h.blockLen); - const fn = opts.NISTfn === undefined ? EMPTY_BUFFER : kdfInputToBytes(opts.NISTfn); - const fnLen = leftEncode(_8n * BigInt(fn.length)); // length in bits - const pers = abytesOrZero(opts.personalization, 'personalization'); - const persLen = leftEncode(_8n * BigInt(pers.length)); // length in bits - if (!fn.length && !pers.length) - return h; - // SP 800-185 cSHAKE appends `00` instead of SHAKE's `1111`; in this Keccak implementation - // that changes the delimited suffix byte from `0x1f` to `0x04` once N or S is non-empty. - h.suffix = 0x04; - h.update(blockLenBytes).update(fnLen).update(fn).update(persLen).update(pers); - let totalLen = blockLenBytes.length + fnLen.length + fn.length + persLen.length + pers.length; - h.update(getPadding(totalLen, h.blockLen)); - return h; -} -const gencShake = (suffix, blockLen, outputLen) => createHasher((opts = {}) => cshakePers(new Keccak(blockLen, suffix, chooseLen(opts, outputLen), true), opts)); -/** - * 128-bit NIST cSHAKE XOF. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and NIST function-name - * settings. When both `NISTfn` and `personalization` are empty, - * SP 800-185 defines this as plain SHAKE128. Defaults to 16 output bytes - * when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with cSHAKE128. - * ```ts - * cshake128(new Uint8Array([1, 2, 3]), { dkLen: 32 }); - * ``` - */ -export const cshake128 = /* @__PURE__ */ gencShake(0x1f, 168, 16); -/** - * 256-bit NIST cSHAKE XOF. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and NIST function-name - * settings. When both `NISTfn` and `personalization` are empty, - * SP 800-185 defines this as plain SHAKE256. Defaults to 32 output bytes - * when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with cSHAKE256. - * ```ts - * cshake256(new Uint8Array([1, 2, 3]), { dkLen: 64 }); - * ``` - */ -export const cshake256 = /* @__PURE__ */ gencShake(0x1f, 136, 32); -/** - * Internal KMAC class. - * SP 800-185 §8.4.1 still recommends keys at least as long as the target - * security strength. - */ -export class _KMAC extends Keccak { - constructor(blockLen, outputLen, enableXOF, key, opts = {}) { - super(blockLen, 0x1f, outputLen, enableXOF); - // Preload T = bytepad(encode_string("KMAC") || encode_string(S), rate); later updates append - // newX = bytepad(encode_string(K), rate) || X and `finish()` appends right_encode(L or 0). - cshakePers(this, { - NISTfn: 'KMAC', - personalization: opts.personalization, - }); - abytes(key, undefined, 'key'); - // 1. newX = bytepad(encode_string(K), rate) || X || right_encode(L), - // with `rate = this.blockLen`. - const blockLenBytes = leftEncode(this.blockLen); - const keyLen = leftEncode(_8n * BigInt(key.length)); - this.update(blockLenBytes).update(keyLen).update(key); - const totalLen = blockLenBytes.length + keyLen.length + key.length; - this.update(getPadding(totalLen, this.blockLen)); - } - finish() { - // SP 800-185 uses right_encode(L) for fixed-length KMAC and right_encode(0) for KMACXOF. - // outputLen in bits - if (!this.finished) - this.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); - super.finish(); - } - _cloneInto(to) { - // Create new instance without calling constructor since the key - // is already in state and we don't know it. - // Force "to" to be instance of KMAC instead of Sha3. - if (!to) { - to = Object.create(Object.getPrototypeOf(this), {}); - to.state = this.state.slice(); - to.blockLen = this.blockLen; - to.state32 = u32(to.state); - } - return super._cloneInto(to); - } - clone() { - return this._cloneInto(); - } -} -function genKmac(blockLen, outputLen, xof = false) { - // One-shot XOF wrappers still finalize via `.digest()` because `_KMAC` - // already bakes the requested output length into the state. - const kmac = (key, message, opts) => kmac.create(key, opts).update(message).digest(); - kmac.create = (key, opts = {}) => new _KMAC(blockLen, chooseLen(opts, outputLen), xof, key, opts); - return kmac; -} -/** - * 128-bit Keccak MAC. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC128. - * ```ts - * kmac128(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -export const kmac128 = /* @__PURE__ */ genKmac(168, 16); -/** - * 256-bit Keccak MAC. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC256. - * ```ts - * kmac256(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -export const kmac256 = /* @__PURE__ */ genKmac(136, 32); -/** - * 128-bit Keccak-MAC XOF. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC128 XOF output. - * ```ts - * kmac128xof(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]), { dkLen: 32 }); - * ``` - */ -export const kmac128xof = /* @__PURE__ */ genKmac(168, 16, true); -/** - * 256-bit Keccak-MAC XOF. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC256 XOF output. - * ```ts - * kmac256xof(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]), { dkLen: 64 }); - * ``` - */ -export const kmac256xof = /* @__PURE__ */ genKmac(136, 32, true); -/** - * Internal TupleHash class for byte-array tuple elements. - * This implementation relies on SP 800-185's byte-oriented encoding form - * rather than arbitrary bit strings. - */ -export class _TupleHash extends Keccak { - constructor(blockLen, outputLen, enableXOF, opts = {}) { - super(blockLen, 0x1f, outputLen, enableXOF); - cshakePers(this, { - NISTfn: 'TupleHash', - personalization: opts.personalization, - }); - // Change update after cshake processed - this.update = (data) => { - abytes(data); - // SP 800-185 encodes each tuple element as - // encode_string(X[i]) = left_encode(len(X[i])) || X[i]. - super.update(leftEncode(_8n * BigInt(data.length))); - super.update(data); - return this; - }; - } - finish() { - // SP 800-185 uses right_encode(L) for fixed-length TupleHash - // and right_encode(0) for TupleHashXOF. - if (!this.finished) - // outputLen in bits - super.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); - super.finish(); - } - _cloneInto(to) { - to ||= new _TupleHash(this.blockLen, this.outputLen, this.enableXOF); - return super._cloneInto(to); - } - clone() { - return this._cloneInto(); - } -} -function genTuple(blockLen, outputLen, xof = false) { - // One-shot XOF wrappers still use `.digest()` because `_TupleHash` stores - // the requested output length in the state itself. - const tuple = (messages, opts) => { - const h = tuple.create(opts); - if (!Array.isArray(messages)) - throw new Error('expected array of messages'); - for (const msg of messages) - h.update(msg); - return h.digest(); - }; - tuple.create = (opts = {}) => new _TupleHash(blockLen, chooseLen(opts, outputLen), xof, opts); - return tuple; -} -/** - * 128-bit TupleHASH. `tuple(['ab', 'cd']) != tuple(['a', 'bcd'])`. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash128. - * ```ts - * tuplehash128([new Uint8Array([1]), new Uint8Array([2])]); - * ``` - */ -export const tuplehash128 = /* @__PURE__ */ genTuple(168, 16); -/** - * 256-bit TupleHASH. `tuple(['ab', 'cd']) != tuple(['a', 'bcd'])`. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash256. - * ```ts - * tuplehash256([new Uint8Array([1]), new Uint8Array([2])]); - * ``` - */ -export const tuplehash256 = /* @__PURE__ */ genTuple(136, 32); -/** - * 128-bit TupleHASH XOF. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash128 XOF output. - * ```ts - * tuplehash128xof([new Uint8Array([1]), new Uint8Array([2])], { dkLen: 32 }); - * ``` - */ -export const tuplehash128xof = /* @__PURE__ */ genTuple(168, 16, true); -/** - * 256-bit TupleHASH XOF. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash256 XOF output. - * ```ts - * tuplehash256xof([new Uint8Array([1]), new Uint8Array([2])], { dkLen: 64 }); - * ``` - */ -export const tuplehash256xof = /* @__PURE__ */ genTuple(136, 32, true); -/** Internal Parallel Keccak Hash class. */ -export class _ParallelHash extends Keccak { - leafHash; - leafCons; - chunkPos = 0; // Position of current block in chunk - chunksDone = 0; // How many chunks we already have - chunkLen; - constructor(blockLen, outputLen, leafCons, enableXOF, opts = {}) { - super(blockLen, 0x1f, outputLen, enableXOF); - cshakePers(this, { - NISTfn: 'ParallelHash', - personalization: opts.personalization, - }); - this.leafCons = leafCons; - let { blockLen: B = 8 } = opts; - anumber(B); - // blockLen=0 makes take=0 in update(), so pos never advances and the hash hangs. - if (B < 1) - throw new Error('"blockLen" must be >= 1, got ' + B); - this.chunkLen = B; - // SP 800-185 initializes z = left_encode(B); each completed chunk appends - // one fixed-size cSHAKE leaf digest before finish() adds right_encode(n) - // and right_encode(L or 0). - super.update(leftEncode(B)); - // Change update after cshake processed - this.update = (data) => { - abytes(data); - const { chunkLen, leafCons } = this; - for (let pos = 0, len = data.length; pos < len;) { - if (this.chunkPos == chunkLen || !this.leafHash) { - if (this.leafHash) { - super.update(this.leafHash.digest()); - this.chunksDone++; - } - this.leafHash = leafCons(); - this.chunkPos = 0; - } - const take = Math.min(chunkLen - this.chunkPos, len - pos); - this.leafHash.update(data.subarray(pos, pos + take)); - this.chunkPos += take; - pos += take; - } - return this; - }; - } - finish() { - if (this.finished) - return; - if (this.leafHash) { - super.update(this.leafHash.digest()); - this.chunksDone++; - } - // SP 800-185 finishes ParallelHash as - // z || right_encode(n) || right_encode(L); XOF mode replaces - // right_encode(L) with right_encode(0). - super.update(rightEncode(this.chunksDone)); - // outputLen in bits - super.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); - super.finish(); - } - _cloneInto(to) { - to ||= new _ParallelHash(this.blockLen, this.outputLen, this.leafCons, this.enableXOF); - to.leafCons = this.leafCons; - // Reused destinations can carry a stale partial leaf - // when the source is still on the root sponge. - if (this.leafHash) - to.leafHash = this.leafHash._cloneInto(to.leafHash); - else if (to.leafHash) { - to.leafHash.destroy(); - to.leafHash = undefined; - } - to.chunkPos = this.chunkPos; - to.chunkLen = this.chunkLen; - to.chunksDone = this.chunksDone; - return super._cloneInto(to); - } - destroy() { - super.destroy.call(this); - if (this.leafHash) - this.leafHash.destroy(); - } - clone() { - return this._cloneInto(); - } -} -function genPrl(blockLen, outputLen, leaf, xof = false) { - const parallel = (message, opts) => parallel.create(opts).update(message).digest(); - parallel.create = (opts = {}) => new _ParallelHash(blockLen, chooseLen(opts, outputLen), - // SP 800-185 fixes leaf digests at 256 bits for ParallelHash128 and - // 512 bits for ParallelHash256; only the final cSHAKE output uses the - // caller-selected dkLen. - () => leaf.create({ dkLen: 2 * outputLen }), xof, opts); - parallel.outputLen = outputLen; - parallel.blockLen = blockLen; - parallel.canXOF = xof; - return parallel; -} -/** - * 128-bit ParallelHash. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 16 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash128. - * ```ts - * parallelhash128(new Uint8Array([1, 2, 3])); - * ``` - */ -export const parallelhash128 = /* @__PURE__ */ genPrl(168, 16, cshake128); -/** - * 256-bit ParallelHash. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 32 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash256. - * ```ts - * parallelhash256(new Uint8Array([1, 2, 3])); - * ``` - */ -export const parallelhash256 = /* @__PURE__ */ genPrl(136, 32, cshake256); -/** - * 128-bit ParallelHash XOF. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 16 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash128 XOF output. - * ```ts - * parallelhash128xof(new Uint8Array([1, 2, 3]), { dkLen: 32 }); - * ``` - */ -export const parallelhash128xof = /* @__PURE__ */ genPrl(168, 16, cshake128, true); -/** - * 256-bit ParallelHash XOF. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 32 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash256 XOF output. - * ```ts - * parallelhash256xof(new Uint8Array([1, 2, 3]), { dkLen: 64 }); - * ``` - */ -export const parallelhash256xof = /* @__PURE__ */ genPrl(136, 32, cshake256, true); -const genTurbo = (blockLen, outputLen) => createHasher((opts = {}) => { - const D = opts.D === undefined ? 0x1f : opts.D; - // RFC 9861 §2.1 fixes the default `D = 0x1f`; §2.2 defines the 12-round - // TurboSHAKE family selected here. - if (!Number.isSafeInteger(D) || D < 0x01 || D > 0x7f) - throw new Error('"D" (domain separation byte) must be 0x01..0x7f, got: ' + D); - const dkLen = opts.dkLen === undefined ? outputLen : opts.dkLen; - // RFC 9861 §§2.1-2.2 define output length L as a positive integer. - if (dkLen < 1) - throw new Error('"dkLen" must be >= 1'); - return new Keccak(blockLen, D, dkLen, true, 12); -}); -/** - * TurboSHAKE 128-bit: reduced 12-round keccak. - * Should've been a simple "shake with 12 rounds", but we got a whole new - * spec about Turbo SHAKE Pro MAX. - * @param msg - message bytes to hash - * @param opts - Optional output-length and domain-separation settings. - * RFC 9861 §2.1 defaults `D` to `0x1f`. Defaults to 32 output bytes when - * `dkLen` is omitted. See {@link TurboshakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with TurboSHAKE128. - * ```ts - * turboshake128(new Uint8Array([1, 2, 3]), { dkLen: 32 }); - * ``` - */ -export const turboshake128 = /* @__PURE__ */ genTurbo(168, 32); -/** - * TurboSHAKE 256-bit: reduced 12-round keccak. - * @param msg - message bytes to hash - * @param opts - Optional output-length and domain-separation settings. - * RFC 9861 §2.1 defaults `D` to `0x1f`. Defaults to 64 output bytes when - * `dkLen` is omitted. See {@link TurboshakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with TurboSHAKE256. - * ```ts - * turboshake256(new Uint8Array([1, 2, 3]), { dkLen: 64 }); - * ``` - */ -export const turboshake256 = /* @__PURE__ */ genTurbo(136, 64); -// Same as NIST rightEncode, but returns `[0]` for the zero string. -// Callers still need to keep `x < 256^255` per RFC 9861 §3.3. -function rightEncodeK12(n) { - n = BigInt(n); - const res = []; - for (; n > 0; n >>= _8n) - res.unshift(Number(n & _ffn)); - res.push(res.length); - return Uint8Array.from(res); -} -const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of(); -/** Internal K12 hash class. */ -export class _KangarooTwelve extends Keccak { - chunkLen = 8192; - leafHash; - leafLen; - personalization; - chunkPos = 0; // Position of current block in chunk - chunksDone = 0; // How many chunks we already have - constructor(blockLen, leafLen, outputLen, rounds, opts) { - super(blockLen, 0x07, outputLen, true, rounds); - // RFC 9861 §3 defines output length L as a positive integer. - if (outputLen < 1) - throw new Error('"dkLen" must be >= 1'); - this.leafLen = leafLen; - this.personalization = - opts.personalization === undefined - ? EMPTY_BUFFER - : copyBytes(abytes(opts.personalization, undefined, 'personalization')); - } - update(data) { - abytes(data); - const { chunkLen, blockLen, leafLen, rounds } = this; - for (let pos = 0, len = data.length; pos < len;) { - if (this.chunkPos == chunkLen) { - if (this.leafHash) - super.update(this.leafHash.digest()); - else { - // RFC 9861 §3.2 switches from SingleNode (`07`) to FinalNode (`06`) - // once S exceeds 8192 bytes and prefixes S_0 with - // `03 00 00 00 00 00 00 00`. - this.suffix = 0x06; // Its safe to change suffix here since its used only in digest() - super.update(Uint8Array.from([3, 0, 0, 0, 0, 0, 0, 0])); - } - // Secondary chunks S_1..S_(n-1) become fixed-length - // CV_i = TurboSHAKE*(S_i, `0B`, 32|64) chaining values. - this.leafHash = new Keccak(blockLen, 0x0b, leafLen, false, rounds); - this.chunksDone++; - this.chunkPos = 0; - } - const take = Math.min(chunkLen - this.chunkPos, len - pos); - const chunk = data.subarray(pos, pos + take); - if (this.leafHash) - this.leafHash.update(chunk); - else - super.update(chunk); - this.chunkPos += take; - pos += take; - } - return this; - } - finish() { - if (this.finished) - return; - const { personalization } = this; - // RFC 9861 §3.2 forms S = M || C || length_encode(|C|) before any tree hashing logic. - this.update(personalization).update(rightEncodeK12(personalization.length)); - // Leaf hash - if (this.leafHash) { - // Multi-chunk K12 appends - // CV_1..CV_(n-1) || length_encode(n-1) || `FF FF` - // before the final TurboSHAKE call. - super.update(this.leafHash.digest()); - super.update(rightEncodeK12(this.chunksDone)); - super.update(Uint8Array.from([0xff, 0xff])); - } - super.finish.call(this); - } - destroy() { - super.destroy.call(this); - if (this.leafHash) - this.leafHash.destroy(); - // Personalization is copied on create/clone, so destroy can wipe it - // without touching caller input. - if (this.personalization !== EMPTY_BUFFER) - clean(this.personalization); - this.personalization = EMPTY_BUFFER; - } - _cloneInto(to) { - const { blockLen, leafLen, leafHash, outputLen, rounds } = this; - const personalization = this.personalization === EMPTY_BUFFER ? EMPTY_BUFFER : copyBytes(this.personalization); - // Personalization is absorbed only during finish(), so clones need the same pending value. - to ||= new _KangarooTwelve(blockLen, leafLen, outputLen, rounds, { - personalization, - }); - super._cloneInto(to); - // Reused destinations can carry a stale leaf from an older multi-chunk state. - if (leafHash) - to.leafHash = leafHash._cloneInto(to.leafHash); - else if (to.leafHash) { - to.leafHash.destroy(); - to.leafHash = undefined; - } - // Snapshot the pending personalization so clone state does not alias caller-owned input. - to.personalization = personalization; - to.leafLen = this.leafLen; - to.chunkPos = this.chunkPos; - to.chunksDone = this.chunksDone; - return to; - } - clone() { - return this._cloneInto(); - } -} -/** - * 128-bit KangarooTwelve (k12): reduced 12-round keccak. - * @param msg - message bytes to hash - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link KangarooOpts}. - * @returns Digest bytes. - * @example - * Hash a message with KangarooTwelve-128. - * ```ts - * kt128(new Uint8Array([1, 2, 3])); - * ``` - */ -export const kt128 = /* @__PURE__ */ createHasher((opts = {}) => new _KangarooTwelve(168, 32, chooseLen(opts, 32), 12, opts)); -/** - * 256-bit KangarooTwelve (k12): reduced 12-round keccak. - * @param msg - message bytes to hash - * @param opts - Optional output and personalization settings. Defaults to - * 64 output bytes when `dkLen` is omitted. See {@link KangarooOpts}. - * @returns Digest bytes. - * @example - * Hash a message with KangarooTwelve-256. - * ```ts - * kt256(new Uint8Array([1, 2, 3])); - * ``` - */ -export const kt256 = /* @__PURE__ */ createHasher((opts = {}) => new _KangarooTwelve(136, 64, chooseLen(opts, 64), 12, opts)); -const genHopMAC = (hash) => (key, message, personalization, dkLen) => { - const h = hash; - return h(key, { personalization: h(message, { personalization }), dkLen }); -}; -/** - * 128-bit KangarooTwelve-based MAC. - * - * These untested (there is no test vectors or implementation available). Use at your own risk. - * HopMAC128(Key, M, C, L) = KT128(Key, KT128(M, C, 32), L) - * HopMAC256(Key, M, C, L) = KT256(Key, KT256(M, C, 64), L) - * The inner KangarooTwelve call always uses a fixed 32-byte digest here, - * regardless of the outer `dkLen`. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param personalization - personalization bytes mixed into the inner hash - * @param dkLen - optional output length in bytes - * @returns Authentication tag bytes. - * @example - * Authenticate a message with HopMAC128. - * ```ts - * HopMAC128(new Uint8Array([1]), new Uint8Array([2]), new Uint8Array([3]), 32); - * ``` - */ -export const HopMAC128 = /* @__PURE__ */ genHopMAC(kt128); -/** - * 256-bit KangarooTwelve-based MAC. - * Like `HopMAC128`, there are no test vectors or known independent - * implementations available for cross-checking. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param personalization - personalization bytes mixed into the inner hash - * @param dkLen - optional output length in bytes. The inner KangarooTwelve - * call still uses a fixed 64-byte digest here, regardless of the outer - * `dkLen`. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with HopMAC256. - * ```ts - * HopMAC256(new Uint8Array([1]), new Uint8Array([2]), new Uint8Array([3]), 64); - * ``` - */ -export const HopMAC256 = /* @__PURE__ */ genHopMAC(kt256); -/** - * More at - * {@link https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG}. - * Accepted capacities must keep `rho = 1598 - capacity` byte-aligned, and - * `.clean()` later also requires `rate > 801`. - */ -export class _KeccakPRG extends Keccak { - rate; - constructor(capacity) { - anumber(capacity); - const rate = 1600 - capacity; - const rho = rate - 2; - // Rho must be full bytes - if (capacity < 0 || capacity > 1600 - 10 || rho % 8) - throw new Error('invalid capacity'); - // blockLen = rho in bytes - super(rho / 8, 0, 0, true); - this.rate = rate; - this.posOut = Math.floor((rate + 7) / 8); - } - keccak() { - // Duplex padding - this.state[this.pos] ^= 0x01; - this.state[this.blockLen] ^= 0x02; // Rho is full bytes - super.keccak(); - this.pos = 0; - this.posOut = 0; - } - update(data) { - super.update(data); - this.posOut = this.blockLen; - return this; - } - finish() { } - digestInto(_out) { - throw new Error('digest is not allowed, use .randomBytes() instead'); - } - addEntropy(seed) { - this.update(seed); - } - randomBytes(length) { - return this.xof(length); - } - clean() { - // clean() mutates live sponge state just like randomBytes(), - // so destroyed instances must reject it. - aexists(this, false); - if (this.rate < 1600 / 2 + 1) - throw new Error('rate is too low to use .forget()'); - this.keccak(); - for (let i = 0; i < this.blockLen; i++) - this.state[i] = 0; - this.pos = this.blockLen; - this.keccak(); - this.posOut = this.blockLen; - } - _cloneInto(to) { - const { rate } = this; - to ||= new _KeccakPRG(1600 - rate); - super._cloneInto(to); - to.rate = rate; - return to; - } - clone() { - return this._cloneInto(); - } -} -/** - * KeccakPRG: pseudo-random generator based on Keccak. - * See {@link https://keccak.team/files/CSF-0.1.pdf}. - * @param capacity - sponge capacity in bits. Accepted values are those that - * keep `rho = 1598 - capacity` byte-aligned; the default `254` is chosen - * because it satisfies that duplex layout while leaving a wide byte-aligned - * rate. - * @returns PRG instance backed by a Keccak sponge. - * @example - * Create a Keccak-based pseudorandom generator and read bytes from it. - * ```ts - * const prg = keccakprg(254); - * prg.randomBytes(8); - * ``` - */ -export const keccakprg = (capacity = 254) => new _KeccakPRG(capacity); -//# sourceMappingURL=sha3-addons.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3-addons.js.map b/node_modules/@noble/hashes/sha3-addons.js.map deleted file mode 100644 index 1065329..0000000 --- a/node_modules/@noble/hashes/sha3-addons.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha3-addons.js","sourceRoot":"","sources":["src/sha3-addons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAkB,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,MAAM,EACN,OAAO,EACP,OAAO,EAGP,KAAK,EACL,SAAS,EACT,YAAY,EAIZ,eAAe,EAIf,GAAG,GACJ,MAAM,YAAY,CAAC;AAEpB,kCAAkC;AAClC,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAE1C,8FAA8F;AAC9F,4CAA4C;AAC5C,gEAAgE;AAChE,gEAAgE;AAChE,SAAS,UAAU,CAAC,CAAkB;IACpC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACd,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,C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,KAAK;QACH,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,QAAQ,GAAG,GAAG,EAAoB,EAAE,CAC5D,IAAI,UAAU,CAAC,QAAQ,CAAqB,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3.d.ts b/node_modules/@noble/hashes/sha3.d.ts deleted file mode 100644 index 19e8075..0000000 --- a/node_modules/@noble/hashes/sha3.d.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { type CHash, type CHashXOF, type Hash, type HashXOF, type TArg, type TRet } from './utils.ts'; -/** - * `keccakf1600` internal permutation, additionally allows adjusting the round count. - * @param s - 5x5 Keccak state encoded as 25 lanes split into 50 uint32 words - * in this file's local little-endian lane-word order - * @param rounds - number of rounds to execute - * @throws If `rounds` is outside the supported `1..24` range. {@link Error} - * @example - * Permute a Keccak state with the default 24 rounds. - * ```ts - * keccakP(new Uint32Array(50)); - * ``` - */ -export declare function keccakP(s: TArg, rounds?: number): void; -/** - * Keccak sponge function. - * @param blockLen - absorb/squeeze rate in bytes - * @param suffix - domain separation suffix byte - * @param outputLen - default digest length in bytes. This base sponge only - * requires a non-negative integer; wrappers that need positive output - * lengths must enforce that themselves. - * @param enableXOF - whether XOF output is allowed - * @param rounds - number of Keccak-f rounds - * @example - * Build a sponge state, absorb bytes, then finalize a digest. - * ```ts - * const hash = new Keccak(136, 0x06, 32); - * hash.update(new Uint8Array([1, 2, 3])); - * hash.digest(); - * ``` - */ -export declare class Keccak implements Hash, HashXOF { - protected state: Uint8Array; - protected pos: number; - protected posOut: number; - protected finished: boolean; - protected state32: Uint32Array; - protected destroyed: boolean; - blockLen: number; - suffix: number; - outputLen: number; - canXOF: boolean; - protected enableXOF: boolean; - protected rounds: number; - constructor(blockLen: number, suffix: number, outputLen: number, enableXOF?: boolean, rounds?: number); - clone(): Keccak; - protected keccak(): void; - update(data: TArg): this; - protected finish(): void; - protected writeInto(out: TArg): TRet; - xofInto(out: TArg): TRet; - xof(bytes: number): TRet; - digestInto(out: TArg): void; - digest(): TRet; - destroy(): void; - _cloneInto(to?: Keccak): Keccak; -} -/** - * SHA3-224 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-224. - * ```ts - * sha3_224(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha3_224: TRet; -/** - * SHA3-256 hash function. Different from keccak-256. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-256. - * ```ts - * sha3_256(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha3_256: TRet; -/** - * SHA3-384 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-384. - * ```ts - * sha3_384(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha3_384: TRet; -/** - * SHA3-512 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-512. - * ```ts - * sha3_512(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha3_512: TRet; -/** - * Keccak-224 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-224. - * ```ts - * keccak_224(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const keccak_224: TRet; -/** - * Keccak-256 hash function. Different from SHA3-256. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-256. - * ```ts - * keccak_256(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const keccak_256: TRet; -/** - * Keccak-384 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-384. - * ```ts - * keccak_384(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const keccak_384: TRet; -/** - * Keccak-512 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-512. - * ```ts - * keccak_512(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const keccak_512: TRet; -/** Options for SHAKE XOF. */ -export type ShakeOpts = { - /** Desired number of output bytes. */ - dkLen?: number; -}; -/** - * SHAKE128 XOF with 128-bit security and a 16-byte default output. - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE128. - * ```ts - * shake128(new Uint8Array([97, 98, 99]), { dkLen: 32 }); - * ``` - */ -export declare const shake128: TRet>; -/** - * SHAKE256 XOF with 256-bit security and a 32-byte default output. - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE256. - * ```ts - * shake256(new Uint8Array([97, 98, 99]), { dkLen: 64 }); - * ``` - */ -export declare const shake256: TRet>; -/** - * SHAKE128 XOF with 256-bit output (NIST version). - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE128 using a 32-byte default output. - * ```ts - * shake128_32(new Uint8Array([97, 98, 99]), { dkLen: 32 }); - * ``` - */ -export declare const shake128_32: TRet>; -/** - * SHAKE256 XOF with 512-bit output (NIST version). - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE256 using a 64-byte default output. - * ```ts - * shake256_64(new Uint8Array([97, 98, 99]), { dkLen: 64 }); - * ``` - */ -export declare const shake256_64: TRet>; -//# sourceMappingURL=sha3.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3.d.ts.map b/node_modules/@noble/hashes/sha3.d.ts.map deleted file mode 100644 index 12d5be2..0000000 --- a/node_modules/@noble/hashes/sha3.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha3.d.ts","sourceRoot":"","sources":["src/sha3.ts"],"names":[],"mappings":"AAeA,OAAO,EAML,KAAK,KAAK,EAAE,KAAK,QAAQ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;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAEF,CAAC;AACzD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAEF,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3.js b/node_modules/@noble/hashes/sha3.js deleted file mode 100644 index 02e6432..0000000 --- a/node_modules/@noble/hashes/sha3.js +++ /dev/null @@ -1,431 +0,0 @@ -/** - * SHA3 (keccak) hash function, based on a new "Sponge function" design. - * Different from older hashes, the internal state is bigger than output size. - * - * Check out - * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf | FIPS-202}, - * {@link https://keccak.team/keccak.html | Website}, and - * {@link https://crypto.stackexchange.com/q/15727 | the differences between - * SHA-3 and Keccak}. - * - * Check out `sha3-addons` module for cSHAKE, k12, and others. - * @module - */ -import { rotlBH, rotlBL, rotlSH, rotlSL, split } from "./_u64.js"; -// prettier-ignore -import { abytes, aexists, anumber, aoutput, clean, createHasher, oidNist, swap32IfBE, u32 } from "./utils.js"; -// No __PURE__ annotations in sha3 header: -// EVERYTHING is in fact used on every export. -// Various per round constants calculations -const _0n = BigInt(0); -const _1n = BigInt(1); -const _2n = BigInt(2); -const _7n = BigInt(7); -const _256n = BigInt(256); -// FIPS 202 Algorithm 5 rc(): when the outgoing bit is 1, the 8-bit LFSR xors -// taps 0, 4, 5, and 6, which compresses to the feedback mask `0x71`. -const _0x71n = BigInt(0x71); -const SHA3_PI = []; -const SHA3_ROTL = []; -const _SHA3_IOTA = []; // no pure annotation: var is always used -for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { - // Pi - [x, y] = [y, (2 * x + 3 * y) % 5]; - SHA3_PI.push(2 * (5 * y + x)); - // Rotational - SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); - // Iota - let t = _0n; - for (let j = 0; j < 7; j++) { - R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; - if (R & _2n) - t ^= _1n << ((_1n << BigInt(j)) - _1n); - } - _SHA3_IOTA.push(t); -} -const IOTAS = split(_SHA3_IOTA, true); -// `split(..., true)` keeps the local little-endian lane-word layout used by -// `state32`, so these `H` / `L` tables follow the file's first-word / -// second-word lane slots rather than `_u64.ts`'s usual high/low naming. -const SHA3_IOTA_H = IOTAS[0]; -const SHA3_IOTA_L = IOTAS[1]; -// Left rotation (without 0, 32, 64) -const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); -const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s)); -/** - * `keccakf1600` internal permutation, additionally allows adjusting the round count. - * @param s - 5x5 Keccak state encoded as 25 lanes split into 50 uint32 words - * in this file's local little-endian lane-word order - * @param rounds - number of rounds to execute - * @throws If `rounds` is outside the supported `1..24` range. {@link Error} - * @example - * Permute a Keccak state with the default 24 rounds. - * ```ts - * keccakP(new Uint32Array(50)); - * ``` - */ -export function keccakP(s, rounds = 24) { - anumber(rounds, 'rounds'); - // This implementation precomputes only the standard Keccak-f[1600] 24-round Iota table. - if (rounds < 1 || rounds > 24) - throw new Error('"rounds" expected integer 1..24'); - const B = new Uint32Array(5 * 2); - // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) - for (let round = 24 - rounds; round < 24; round++) { - // Theta θ - for (let x = 0; x < 10; x++) - B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; - for (let x = 0; x < 10; x += 2) { - const idx1 = (x + 8) % 10; - const idx0 = (x + 2) % 10; - const B0 = B[idx0]; - const B1 = B[idx0 + 1]; - const Th = rotlH(B0, B1, 1) ^ B[idx1]; - const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; - for (let y = 0; y < 50; y += 10) { - s[x + y] ^= Th; - s[x + y + 1] ^= Tl; - } - } - // Rho (ρ) and Pi (π) - let curH = s[2]; - let curL = s[3]; - for (let t = 0; t < 24; t++) { - const shift = SHA3_ROTL[t]; - const Th = rotlH(curH, curL, shift); - const Tl = rotlL(curH, curL, shift); - const PI = SHA3_PI[t]; - curH = s[PI]; - curL = s[PI + 1]; - s[PI] = Th; - s[PI + 1] = Tl; - } - // Chi (χ) - // Same as: - // for (let x = 0; x < 10; x++) B[x] = s[y + x]; - // for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; - for (let y = 0; y < 50; y += 10) { - const b0 = s[y], b1 = s[y + 1], b2 = s[y + 2], b3 = s[y + 3]; - s[y] ^= ~s[y + 2] & s[y + 4]; - s[y + 1] ^= ~s[y + 3] & s[y + 5]; - s[y + 2] ^= ~s[y + 4] & s[y + 6]; - s[y + 3] ^= ~s[y + 5] & s[y + 7]; - s[y + 4] ^= ~s[y + 6] & s[y + 8]; - s[y + 5] ^= ~s[y + 7] & s[y + 9]; - s[y + 6] ^= ~s[y + 8] & b0; - s[y + 7] ^= ~s[y + 9] & b1; - s[y + 8] ^= ~b0 & b2; - s[y + 9] ^= ~b1 & b3; - } - // Iota (ι) - s[0] ^= SHA3_IOTA_H[round]; - s[1] ^= SHA3_IOTA_L[round]; - } - clean(B); -} -/** - * Keccak sponge function. - * @param blockLen - absorb/squeeze rate in bytes - * @param suffix - domain separation suffix byte - * @param outputLen - default digest length in bytes. This base sponge only - * requires a non-negative integer; wrappers that need positive output - * lengths must enforce that themselves. - * @param enableXOF - whether XOF output is allowed - * @param rounds - number of Keccak-f rounds - * @example - * Build a sponge state, absorb bytes, then finalize a digest. - * ```ts - * const hash = new Keccak(136, 0x06, 32); - * hash.update(new Uint8Array([1, 2, 3])); - * hash.digest(); - * ``` - */ -export class Keccak { - state; - pos = 0; - posOut = 0; - finished = false; - state32; - destroyed = false; - blockLen; - suffix; - outputLen; - canXOF; - enableXOF = false; - rounds; - // NOTE: we accept arguments in bytes instead of bits here. - constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { - this.blockLen = blockLen; - this.suffix = suffix; - this.outputLen = outputLen; - this.enableXOF = enableXOF; - this.canXOF = enableXOF; - this.rounds = rounds; - // Can be passed from user as dkLen - anumber(outputLen, 'outputLen'); - // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes - // 0 < blockLen < 200 - if (!(0 < blockLen && blockLen < 200)) - throw new Error('only keccak-f1600 function is supported'); - this.state = new Uint8Array(200); - this.state32 = u32(this.state); - } - clone() { - return this._cloneInto(); - } - keccak() { - swap32IfBE(this.state32); - keccakP(this.state32, this.rounds); - swap32IfBE(this.state32); - this.posOut = 0; - this.pos = 0; - } - update(data) { - aexists(this); - abytes(data); - const { blockLen, state } = this; - const len = data.length; - for (let pos = 0; pos < len;) { - const take = Math.min(blockLen - this.pos, len - pos); - for (let i = 0; i < take; i++) - state[this.pos++] ^= data[pos++]; - if (this.pos === blockLen) - this.keccak(); - } - return this; - } - finish() { - if (this.finished) - return; - this.finished = true; - const { state, suffix, pos, blockLen } = this; - // FIPS 202 appends the SHA3/SHAKE domain-separation suffix before pad10*1. - // These byte values already include the first padding bit, while the - // final `0x80` below supplies the closing `1` bit in the last rate byte. - state[pos] ^= suffix; - // If that combined suffix lands in the last rate byte and already sets - // bit 7, absorb it first so the final pad10*1 bit can be xored into a - // fresh block. - if ((suffix & 0x80) !== 0 && pos === blockLen - 1) - this.keccak(); - state[blockLen - 1] ^= 0x80; - this.keccak(); - } - writeInto(out) { - aexists(this, false); - abytes(out); - this.finish(); - const bufferOut = this.state; - const { blockLen } = this; - for (let pos = 0, len = out.length; pos < len;) { - if (this.posOut >= blockLen) - this.keccak(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out; - } - xofInto(out) { - // Plain SHA3/Keccak usage with XOF is probably a mistake, but this base - // class is also reused by SHAKE/cSHAKE/KMAC/TupleHash/ParallelHash/ - // TurboSHAKE/KangarooTwelve wrappers that intentionally enable XOF. - if (!this.enableXOF) - throw new Error('XOF is not possible for this instance'); - return this.writeInto(out); - } - xof(bytes) { - anumber(bytes); - return this.xofInto(new Uint8Array(bytes)); - } - digestInto(out) { - aoutput(out, this); - if (this.finished) - throw new Error('digest() was already called'); - // `aoutput(...)` allows oversized buffers; digestInto() must fill only the advertised digest. - this.writeInto(out.subarray(0, this.outputLen)); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.outputLen); - this.digestInto(out); - return out; - } - destroy() { - this.destroyed = true; - clean(this.state); - } - _cloneInto(to) { - const { blockLen, suffix, outputLen, rounds, enableXOF } = this; - to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds); - // Reused destinations can come from a different rate/capacity variant, so clone must rewrite - // the sponge geometry as well as the state words. - to.blockLen = blockLen; - to.state32.set(this.state32); - to.pos = this.pos; - to.posOut = this.posOut; - to.finished = this.finished; - to.rounds = rounds; - // Suffix can change in cSHAKE - to.suffix = suffix; - to.outputLen = outputLen; - to.enableXOF = enableXOF; - // Clones must preserve the public capability bit too; `_KMAC` reuses this path and deep clone - // tests compare instance fields directly, so leaving `canXOF` behind makes the clone lie. - to.canXOF = this.canXOF; - to.destroyed = this.destroyed; - return to; - } -} -const genKeccak = (suffix, blockLen, outputLen, info = {}) => createHasher(() => new Keccak(blockLen, suffix, outputLen), info); -/** - * SHA3-224 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-224. - * ```ts - * sha3_224(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha3_224 = /* @__PURE__ */ genKeccak(0x06, 144, 28, -/* @__PURE__ */ oidNist(0x07)); -/** - * SHA3-256 hash function. Different from keccak-256. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-256. - * ```ts - * sha3_256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha3_256 = /* @__PURE__ */ genKeccak(0x06, 136, 32, -/* @__PURE__ */ oidNist(0x08)); -/** - * SHA3-384 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-384. - * ```ts - * sha3_384(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha3_384 = /* @__PURE__ */ genKeccak(0x06, 104, 48, -/* @__PURE__ */ oidNist(0x09)); -/** - * SHA3-512 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-512. - * ```ts - * sha3_512(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha3_512 = /* @__PURE__ */ genKeccak(0x06, 72, 64, -/* @__PURE__ */ oidNist(0x0a)); -/** - * Keccak-224 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-224. - * ```ts - * keccak_224(new Uint8Array([97, 98, 99])); - * ``` - */ -export const keccak_224 = /* @__PURE__ */ genKeccak(0x01, 144, 28); -/** - * Keccak-256 hash function. Different from SHA3-256. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-256. - * ```ts - * keccak_256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const keccak_256 = /* @__PURE__ */ genKeccak(0x01, 136, 32); -/** - * Keccak-384 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-384. - * ```ts - * keccak_384(new Uint8Array([97, 98, 99])); - * ``` - */ -export const keccak_384 = /* @__PURE__ */ genKeccak(0x01, 104, 48); -/** - * Keccak-512 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-512. - * ```ts - * keccak_512(new Uint8Array([97, 98, 99])); - * ``` - */ -export const keccak_512 = /* @__PURE__ */ genKeccak(0x01, 72, 64); -const genShake = (suffix, blockLen, outputLen, info = {}) => createHasher((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true), info); -/** - * SHAKE128 XOF with 128-bit security and a 16-byte default output. - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE128. - * ```ts - * shake128(new Uint8Array([97, 98, 99]), { dkLen: 32 }); - * ``` - */ -export const shake128 = -/* @__PURE__ */ -genShake(0x1f, 168, 16, /* @__PURE__ */ oidNist(0x0b)); -/** - * SHAKE256 XOF with 256-bit security and a 32-byte default output. - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE256. - * ```ts - * shake256(new Uint8Array([97, 98, 99]), { dkLen: 64 }); - * ``` - */ -export const shake256 = -/* @__PURE__ */ -genShake(0x1f, 136, 32, /* @__PURE__ */ oidNist(0x0c)); -/** - * SHAKE128 XOF with 256-bit output (NIST version). - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE128 using a 32-byte default output. - * ```ts - * shake128_32(new Uint8Array([97, 98, 99]), { dkLen: 32 }); - * ``` - */ -export const shake128_32 = -/* @__PURE__ */ -genShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b)); -/** - * SHAKE256 XOF with 512-bit output (NIST version). - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE256 using a 64-byte default output. - * ```ts - * shake256_64(new Uint8Array([97, 98, 99]), { dkLen: 64 }); - * ``` - */ -export const shake256_64 = -/* @__PURE__ */ -genShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c)); -//# sourceMappingURL=sha3.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/sha3.js.map b/node_modules/@noble/hashes/sha3.js.map deleted file mode 100644 index 4be5999..0000000 --- a/node_modules/@noble/hashes/sha3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sha3.js","sourceRoot":"","sources":["src/sha3.ts"],"names":[],"mappings":"AAAA;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,EAAE,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,EACvF,IAAI,CACL,CAAC;AAEJ;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ;AACnB,eAAe;AACf,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ;AACnB,eAAe;AACf,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW;AACtB,eAAe;AACf,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW;AACtB,eAAe;AACf,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/src/_blake.ts b/node_modules/@noble/hashes/src/_blake.ts deleted file mode 100644 index 7433033..0000000 --- a/node_modules/@noble/hashes/src/_blake.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Internal helpers for blake hash. - * @module - */ -import { rotr, type TRet } from './utils.ts'; - -/** - * Internal blake permutation table. - * Rows `0..9` serve BLAKE2s, rows `0..11` serve BLAKE2b with `10..11 = 0..1`, and Blake1 also - * reuses the later rows shown below. Blake1 expands rounds `10..15` as `SIGMA[i % 10]`, so rows - * `10..15` intentionally repeat rows `0..5` for the 14-round (256) and 16-round (512) variants. - */ -// prettier-ignore -export const BSIGMA: TRet = /* @__PURE__ */ Uint8Array.from([ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, - 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, - 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, - 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, - 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, - 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, - 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, - 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, - 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, - // Blake1, unused in others - 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, - 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, - 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, - 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, -]); - -// prettier-ignore -export type Num4 = { a: number; b: number; c: number; d: number; }; - -// 32-bit / BLAKE2s first half of G, with the fixed `(16, 12)` rotation pair. -// Parameter `x` is the RFC 7693 first-half message word, or Blake1's pre-mixed -// `m[sigma[r][2i]] ^ u[sigma[r][2i+1]]` addend in the 32-bit path. -export function G1s(a: number, b: number, c: number, d: number, x: number): Num4 { - a = (a + b + x) | 0; - d = rotr(d ^ a, 16); - c = (c + d) | 0; - b = rotr(b ^ c, 12); - return { a, b, c, d }; -} - -// 32-bit / BLAKE2s second half of G. -// Parameter `x` is the RFC 7693 second-half (`y`) message word, or Blake1's pre-mixed -// `m[sigma[r][2i + 1]] ^ u[sigma[r][2i]]` addend in the 32-bit path. -export function G2s(a: number, b: number, c: number, d: number, x: number): Num4 { - a = (a + b + x) | 0; - d = rotr(d ^ a, 8); - c = (c + d) | 0; - b = rotr(b ^ c, 7); - return { a, b, c, d }; -} diff --git a/node_modules/@noble/hashes/src/_md.ts b/node_modules/@noble/hashes/src/_md.ts deleted file mode 100644 index 1de1258..0000000 --- a/node_modules/@noble/hashes/src/_md.ts +++ /dev/null @@ -1,222 +0,0 @@ -/** - * Internal Merkle-Damgard hash utils. - * @module - */ -import { - abytes, - aexists, - aoutput, - clean, - createView, - type Hash, - type TArg, - type TRet, -} from './utils.ts'; - -/** - * Shared 32-bit conditional boolean primitive reused by SHA-256, SHA-1, and MD5 `F`. - * Returns bits from `b` when `a` is set, otherwise from `c`. - * The XOR form is equivalent to MD5's `F(X,Y,Z) = XY v not(X)Z` because the masked terms never - * set the same bit. - * @param a - selector word - * @param b - word chosen when selector bit is set - * @param c - word chosen when selector bit is clear - * @returns Mixed 32-bit word. - * @example - * Combine three words with the shared 32-bit choice primitive. - * ```ts - * Chi(0xffffffff, 0x12345678, 0x87654321); - * ``` - */ -export function Chi(a: number, b: number, c: number): number { - return (a & b) ^ (~a & c); -} - -/** - * Shared 32-bit majority primitive reused by SHA-256 and SHA-1. - * Returns bits shared by at least two inputs. - * @param a - first input word - * @param b - second input word - * @param c - third input word - * @returns Mixed 32-bit word. - * @example - * Combine three words with the shared 32-bit majority primitive. - * ```ts - * Maj(0xffffffff, 0x12345678, 0x87654321); - * ``` - */ -export function Maj(a: number, b: number, c: number): number { - return (a & b) ^ (a & c) ^ (b & c); -} - -/** - * Merkle-Damgard hash construction base class. - * Could be used to create MD5, RIPEMD, SHA1, SHA2. - * Accepts only byte-aligned `Uint8Array` input, even when the underlying spec describes bit - * strings with partial-byte tails. - * @param blockLen - internal block size in bytes - * @param outputLen - digest size in bytes - * @param padOffset - trailing length field size in bytes - * @param isLE - whether length and state words are encoded in little-endian - * @example - * Use a concrete subclass to get the shared Merkle-Damgard update/digest flow. - * ```ts - * import { _SHA1 } from '@noble/hashes/legacy.js'; - * const hash = new _SHA1(); - * hash.update(new Uint8Array([97, 98, 99])); - * hash.digest(); - * ``` - */ -export abstract class HashMD> implements Hash { - // Subclasses must treat `buf` as read-only: `update()` may pass a direct view over caller input - // when it can process whole blocks without buffering first. - protected abstract process(buf: DataView, offset: number): void; - protected abstract get(): number[]; - protected abstract set(...args: number[]): void; - abstract destroy(): void; - protected abstract roundClean(): void; - - readonly blockLen: number; - readonly outputLen: number; - readonly canXOF = false; - readonly padOffset: number; - readonly isLE: boolean; - - // For partial updates less than block size - protected buffer: Uint8Array; - protected view: DataView; - protected finished = false; - protected length = 0; - protected pos = 0; - protected destroyed = false; - - constructor(blockLen: number, outputLen: number, padOffset: number, isLE: boolean) { - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - } - update(data: TArg): this { - aexists(this); - abytes(data); - const { view, buffer, blockLen } = this; - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - // Fast path only when there is no buffered partial block: `take === blockLen` implies - // `this.pos === 0`, so we can process full blocks directly from the input view. - if (take === blockLen) { - const dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out: TArg): void { - aexists(this); - aoutput(out, this); - this.finished = true; - // Padding - // We can avoid allocation of buffer for padding completely if it - // was previously not allocated here. But it won't change performance. - const { buffer, view, blockLen, isLE } = this; - let { pos } = this; - // append the bit '1' to the message - buffer[pos++] = 0b10000000; - clean(this.buffer.subarray(pos)); - // we have less than padOffset left in buffer, so we cannot put length in - // current block, need process it and pad again - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - // Pad until full block byte with zeros - for (let i = pos; i < blockLen; i++) buffer[i] = 0; - // `padOffset` reserves the whole length field. For SHA-384/512 the high 64 bits stay zero from - // the padding fill above, and JS will overflow before user input can make that half non-zero. - // So we only need to write the low 64 bits here. - view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE); - this.process(view, 0); - const oview = createView(out); - const len = this.outputLen; - // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT - if (len % 4) throw new Error('_sha2: outputLen must be aligned to 32bit'); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state'); - for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE); - } - digest(): TRet { - const { buffer, outputLen } = this; - this.digestInto(buffer); - // Copy before destroy(): subclasses wipe `buffer` during cleanup, but `digest()` must return - // fresh bytes to the caller. - const res = buffer.slice(0, outputLen); - this.destroy(); - return res as TRet; - } - _cloneInto(to?: T): T { - to ||= new (this.constructor as any)() as T; - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.destroyed = destroyed; - to.finished = finished; - to.length = length; - to.pos = pos; - // Only partial-block bytes need copying: when `length % blockLen === 0`, `pos === 0` and - // later `update()` / `digestInto()` overwrite `to.buffer` from the start before reading it. - if (length % blockLen) to.buffer.set(buffer); - return to as unknown as any; - } - clone(): T { - return this._cloneInto(); - } -} - -/** - * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53. - * Check out `test/misc/sha2-gen-iv.js` for recomputation guide. - */ - -/** Initial SHA256 state from RFC 6234 §6.1: the first 32 bits of the fractional parts of the - * square roots of the first eight prime numbers. Exported as a shared table; callers must treat - * it as read-only because constructors copy words from it by index. */ -export const SHA256_IV: TRet = /* @__PURE__ */ Uint32Array.from([ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19, -]); - -/** Initial SHA224 state `H(0)` from RFC 6234 §6.1. Exported as a shared table; callers must - * treat it as read-only because constructors copy words from it by index. */ -export const SHA224_IV: TRet = /* @__PURE__ */ Uint32Array.from([ - 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4, -]); - -/** Initial SHA384 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen - * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the ninth - * through sixteenth prime numbers. Exported as a shared table; callers must treat it as read-only - * because constructors copy halves from it by index. */ -export const SHA384_IV: TRet = /* @__PURE__ */ Uint32Array.from([ - 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939, - 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4, -]); - -/** Initial SHA512 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen - * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the first - * eight prime numbers. Exported as a shared table; callers must treat it as read-only because - * constructors copy halves from it by index. */ -export const SHA512_IV: TRet = /* @__PURE__ */ Uint32Array.from([ - 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1, - 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179, -]); diff --git a/node_modules/@noble/hashes/src/_u64.ts b/node_modules/@noble/hashes/src/_u64.ts deleted file mode 100644 index 2b7c593..0000000 --- a/node_modules/@noble/hashes/src/_u64.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Internal helpers for u64. - * BigUint64Array is too slow as per 2026, so we implement it using - * Uint32Array. - * @privateRemarks TODO: re-check {@link https://issues.chromium.org/issues/42212588} - * @module - */ -import type { TRet } from './utils.ts'; - -const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); -const _32n = /* @__PURE__ */ BigInt(32); - -// Split bigint into two 32-bit halves. With `le=true`, returned fields become `{ h: low, l: high -// }` to match little-endian word order rather than the property names. -function fromBig( - n: bigint, - le = false -): { - h: number; - l: number; -} { - if (le) return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; - return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; -} - -// Split bigint list into `[highWords, lowWords]` when `le=false`; with `le=true`, the first array -// holds the low halves because `fromBig(...)` swaps the semantic meaning of `h` and `l`. -function split(lst: bigint[], le = false): TRet { - const len = lst.length; - let Ah = new Uint32Array(len); - let Al = new Uint32Array(len); - for (let i = 0; i < len; i++) { - const { h, l } = fromBig(lst[i], le); - [Ah[i], Al[i]] = [h, l]; - } - return [Ah, Al] as TRet; -} - -// Combine explicit `(high, low)` 32-bit halves into a bigint; `>>> 0` normalizes signed JS -// bitwise results back to uint32 first, and little-endian callers must swap. -const toBig = (h: number, l: number): bigint => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); -// High 32-bit half of a 64-bit logical right shift for `s` in `0..31`. -const shrSH = (h: number, _l: number, s: number): number => h >>> s; -// Low 32-bit half of a 64-bit logical right shift, valid for `s` in `1..31`. -const shrSL = (h: number, l: number, s: number): number => (h << (32 - s)) | (l >>> s); -// High 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`. -const rotrSH = (h: number, l: number, s: number): number => (h >>> s) | (l << (32 - s)); -// Low 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`. -const rotrSL = (h: number, l: number, s: number): number => (h << (32 - s)) | (l >>> s); -// High 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`. -const rotrBH = (h: number, l: number, s: number): number => (h << (64 - s)) | (l >>> (s - 32)); -// Low 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`. -const rotrBL = (h: number, l: number, s: number): number => (h >>> (s - 32)) | (l << (64 - s)); -// High 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped low half. -const rotr32H = (_h: number, l: number): number => l; -// Low 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped high half. -const rotr32L = (h: number, _l: number): number => h; -// High 32-bit half of a 64-bit left rotate, valid for `s` in `1..31`. -const rotlSH = (h: number, l: number, s: number): number => (h << s) | (l >>> (32 - s)); -// Low 32-bit half of a 64-bit left rotate, valid for `s` in `1..31`. -const rotlSL = (h: number, l: number, s: number): number => (l << s) | (h >>> (32 - s)); -// High 32-bit half of a 64-bit left rotate, valid for `s` in `33..63`; `32` uses `rotr32*`. -const rotlBH = (h: number, l: number, s: number): number => (l << (s - 32)) | (h >>> (64 - s)); -// Low 32-bit half of a 64-bit left rotate, valid for `s` in `33..63`; `32` uses `rotr32*`. -const rotlBL = (h: number, l: number, s: number): number => (h << (s - 32)) | (l >>> (64 - s)); - -// Add two split 64-bit words and return the split `{ h, l }` sum. -// JS uses 32-bit signed integers for bitwise operations, so we cannot simply shift the carry out -// of the low sum and instead use division. -function add( - Ah: number, - Al: number, - Bh: number, - Bl: number -): { - h: number; - l: number; -} { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; -} -// Addition with more than 2 elements -// Unmasked low-word accumulator for 3-way addition; pass the raw result into `add3H(...)`. -const add3L = (Al: number, Bl: number, Cl: number): number => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); -// High-word finalize step for 3-way addition; `low` must be the untruncated output of `add3L(...)`. -const add3H = (low: number, Ah: number, Bh: number, Ch: number): number => - (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; -// Unmasked low-word accumulator for 4-way addition; pass the raw result into `add4H(...)`. -const add4L = (Al: number, Bl: number, Cl: number, Dl: number): number => - (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); -// High-word finalize step for 4-way addition; `low` must be the untruncated output of `add4L(...)`. -const add4H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number): number => - (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; -// Unmasked low-word accumulator for 5-way addition; pass the raw result into `add5H(...)`. -const add5L = (Al: number, Bl: number, Cl: number, Dl: number, El: number): number => - (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); -// High-word finalize step for 5-way addition; `low` must be the untruncated output of `add5L(...)`. -const add5H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number): number => - (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; - -// prettier-ignore -export { - add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig -}; -// Canonical grouped namespace for callers that prefer one object. -// Named exports stay for direct imports. -// prettier-ignore -const u64: { fromBig: typeof fromBig; split: typeof split; toBig: (h: number, l: number) => bigint; shrSH: (h: number, _l: number, s: number) => number; shrSL: (h: number, l: number, s: number) => number; rotrSH: (h: number, l: number, s: number) => number; rotrSL: (h: number, l: number, s: number) => number; rotrBH: (h: number, l: number, s: number) => number; rotrBL: (h: number, l: number, s: number) => number; rotr32H: (_h: number, l: number) => number; rotr32L: (h: number, _l: number) => number; rotlSH: (h: number, l: number, s: number) => number; rotlSL: (h: number, l: number, s: number) => number; rotlBH: (h: number, l: number, s: number) => number; rotlBL: (h: number, l: number, s: number) => number; add: typeof add; add3L: (Al: number, Bl: number, Cl: number) => number; add3H: (low: number, Ah: number, Bh: number, Ch: number) => number; add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number; add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number; add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number; add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number; } = { - fromBig, split, toBig, - shrSH, shrSL, - rotrSH, rotrSL, rotrBH, rotrBL, - rotr32H, rotr32L, - rotlSH, rotlSL, rotlBH, rotlBL, - add, add3L, add3H, add4L, add4H, add5H, add5L, -}; -// Default export mirrors named `u64` for compatibility with object-style imports. -export default u64; diff --git a/node_modules/@noble/hashes/src/argon2.ts b/node_modules/@noble/hashes/src/argon2.ts deleted file mode 100644 index 51fd315..0000000 --- a/node_modules/@noble/hashes/src/argon2.ts +++ /dev/null @@ -1,667 +0,0 @@ -/** - * Argon2 KDF from RFC 9106. Can be used to create a key from password and salt. - * We suggest to use Scrypt. JS Argon is 2-10x slower than native code because of 64-bitness: - * * argon uses uint64, but JS doesn't have fast uint64array - * * uint64 multiplication is 1/3 of time - * * `P` function would be very nice with u64, because most of value will be in registers, - * hovewer with u32 it will require 32 registers, which is too much. - * * JS arrays do slow bound checks, so reading from `A2_BUF` slows it down - * @module - */ -import { add3H, add3L, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL } from './_u64.ts'; -import { blake2b } from './blake2.ts'; -import { - anumber, - clean, - kdfInputToBytes, - nextTick, - swap32IfBE, - swap8IfBE, - u32, - u8, - type KDFInput, - type TArg, - type TRet, -} from './utils.ts'; - -// RFC 9106 §3.1 type `y`: 0 = Argon2d, 1 = Argon2i, 2 = Argon2id. The numeric values are the -// spec-bound part here; the object keys are internal labels. -const AT = { Argond2d: 0, Argon2i: 1, Argon2id: 2 } as const; -type Types = (typeof AT)[keyof typeof AT]; - -// RFC 9106 sync points constant `SL = 4`, fixed by the design rather than exposed as a tuning knob. -const ARGON2_SYNC_POINTS = 4; -// Preserve Argon2's `LE32(len(X)) || X` encoding for omitted -// optional fields by emitting empty bytes. -const abytesOrZero = (buf?: TArg, errorTitle = ''): TRet => { - if (buf === undefined) return Uint8Array.of(); - return kdfInputToBytes(buf, errorTitle); -}; - -// Unsigned `u32 * u32 = { h, l }`, returned as split 64-bit halves. -function mul(a: number, b: number) { - // Split into 16-bit limbs so each partial product stays exact under `Math.imul`. - const aL = a & 0xffff; - const aH = a >>> 16; - const bL = b & 0xffff; - const bH = b >>> 16; - const ll = Math.imul(aL, bL); - const hl = Math.imul(aH, bL); - const lh = Math.imul(aL, bH); - const hh = Math.imul(aH, bH); - const carry = (ll >>> 16) + (hl & 0xffff) + lh; - const high = (hh + (hl >>> 16) + (carry >>> 16)) | 0; - const low = (carry << 16) | (ll & 0xffff); - return { h: high, l: low }; -} - -function mul2(a: number, b: number) { - // Double the split 64-bit product; carry from `l` is folded back into `h` via `l >>> 31`. - const { h, l } = mul(a, b); - return { h: ((h << 1) | (l >>> 31)) & 0xffff_ffff, l: (l << 1) & 0xffff_ffff }; -} - -// BlaMka permutation for Argon2 -// `A + B + 2 * trunc(A) * trunc(B)`, where `trunc(...)` means the low 32-bit halves. -function blamka(Ah: number, Al: number, Bh: number, Bl: number) { - const { h: Ch, l: Cl } = mul2(Al, Bl); - // A + B + (2 * A * B) - const Rll = add3L(Al, Bl, Cl); - return { h: add3H(Rll, Ah, Bh, Ch), l: Rll | 0 }; -} - -// Temporary block buffer. -// 1024-byte block: 256 u32 = 128 interleaved low/high halves = RFC's -// 8x8 matrix of 16-byte registers. -const A2_BUF = new Uint32Array(256); - -// Quarter-round over 64-bit word indices into `A2_BUF`; each index maps to adjacent low/high u32s. -function G(a: number, b: number, c: number, d: number) { - let Al = A2_BUF[2*a], Ah = A2_BUF[2*a + 1]; // prettier-ignore - let Bl = A2_BUF[2*b], Bh = A2_BUF[2*b + 1]; // prettier-ignore - let Cl = A2_BUF[2*c], Ch = A2_BUF[2*c + 1]; // prettier-ignore - let Dl = A2_BUF[2*d], Dh = A2_BUF[2*d + 1]; // prettier-ignore - - // RFC 9106 Figure 19 GB rotates by 32, 24, 16, and 63 bits after each XOR step. - ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) }); - - ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) }); - - ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) }); - - ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) }); - - ((A2_BUF[2 * a] = Al), (A2_BUF[2 * a + 1] = Ah)); - ((A2_BUF[2 * b] = Bl), (A2_BUF[2 * b + 1] = Bh)); - ((A2_BUF[2 * c] = Cl), (A2_BUF[2 * c + 1] = Ch)); - ((A2_BUF[2 * d] = Dl), (A2_BUF[2 * d + 1] = Dh)); -} - -// Argon2 permutation over 16 register indices into `A2_BUF`, not the register values themselves. -// RFC 9106 Figure 17: these arguments are the 16 `v0..v15` 64-bit word -// indices inside eight 16-byte inputs, not copied word values. -// prettier-ignore -function P( - v00: number, v01: number, v02: number, v03: number, v04: number, v05: number, v06: number, v07: number, - v08: number, v09: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, -) { - // RFC 9106 Figure 18: first apply GB across rows, then across columns of the 8x8 register matrix. - G(v00, v04, v08, v12); - G(v01, v05, v09, v13); - G(v02, v06, v10, v14); - G(v03, v07, v11, v15); - G(v00, v05, v10, v15); - G(v01, v06, v11, v12); - G(v02, v07, v08, v13); - G(v03, v04, v09, v14); -} - -function block(x: TArg, xPos: number, yPos: number, outPos: number, needXor: boolean) { - for (let i = 0; i < 256; i++) A2_BUF[i] = x[xPos + i] ^ x[yPos + i]; - // rows (8 consecutive 16-register groups) - for (let i = 0; i < 128; i += 16) { - // prettier-ignore - P( - i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, - i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15 - ); - } - // columns (8 strided 16-register groups) - for (let i = 0; i < 16; i += 2) { - // prettier-ignore - P( - i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49, - i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113 - ); - } - - // RFC 9106 step 6: passes after the first XOR the old destination block into the new G(X, Y). - if (needXor) for (let i = 0; i < 256; i++) x[outPos + i] ^= A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i]; - else for (let i = 0; i < 256; i++) x[outPos + i] = A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i]; - clean(A2_BUF); -} - -// Variable-Length Hash Function H' -// Returns bytes, not words; 1024-byte block callers explicitly reinterpret with `u32(...)`. -function Hp(A: TArg, dkLen: number): TRet { - const A8 = u8(A); - const T = new Uint32Array(1); - const T8 = u8(T); - // Argon2 H' prefixes dkLen as LE32; native Uint32Array writes would serialize as BE on s390x. - T[0] = swap8IfBE(dkLen); - // Fast path - if (dkLen <= 64) return blake2b.create({ dkLen }).update(T8).update(A8).digest(); - const out = new Uint8Array(dkLen); - let V = blake2b.create({}).update(T8).update(A8).digest(); - let pos = 0; - // RFC 9106 Figure 8: each intermediate `V_i` contributes only `W_i`, its first 32 bytes; only - // `V_{r+1}` is emitted in full at the remaining length. - out.set(V.subarray(0, 32)); - pos += 32; - // Rest blocks - for (; dkLen - pos > 64; pos += 32) { - const Vh = blake2b.create({}).update(V); - Vh.digestInto(V); - Vh.destroy(); - out.set(V.subarray(0, 32), pos); - } - // Last block - out.set(blake2b(V, { dkLen: dkLen - pos }), pos); - clean(V, T); - // H' is byte-oriented; returning `u32(out)` would silently drop dkLen % 4 tail bytes. - return out as TRet; -} - -// Used only inside process block! -function indexAlpha( - r: number, - s: number, - laneLen: number, - segmentLen: number, - index: number, - randL: number, - sameLane: boolean = false -) { - // RFC 9106 §3.4.2 Figures 12-13: map `J1` / `J2` into the current lane's reference area `W`. - let area: number; - if (r === 0) { - if (s === 0) area = index - 1; - else if (sameLane) area = s * segmentLen + index - 1; - else area = s * segmentLen + (index == 0 ? -1 : 0); - } else if (sameLane) area = laneLen - segmentLen + index - 1; - else area = laneLen - segmentLen + (index == 0 ? -1 : 0); - const startPos = r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0; - // RFC 9106 Figure 13: `mul(randL, randL).h` is `floor(J_1^2 / 2^32)`, and the outer high-half - // multiply computes `floor(|W| * x / 2^32)` without floating-point math. - const rel = area - 1 - mul(area, mul(randL, randL).h).h; - return (startPos + rel) % laneLen; -} - -/** Argon2 cost, output, and optional secret/personalization inputs. */ -export type ArgonOpts = { - /** Time cost measured in iterations. */ - t: number; - /** Memory cost in kibibytes. */ - m: number; - /** Parallelization parameter. */ - p: number; - /** Argon2 version number. Defaults to `0x13`. */ - version?: number; - /** Optional secret key mixed into initialization. */ - key?: KDFInput; - /** Optional personalization string or bytes. */ - personalization?: KDFInput; - /** Desired output length in bytes. RFC 9106 §3.1 requires `T` in the 4..(2^32 - 1) range. */ - dkLen?: number; - /** Max scheduler block time in milliseconds for the async variants. */ - asyncTick?: number; - /** Maximum temporary memory budget in bytes. */ - maxmem?: number; - /** - * Optional progress callback invoked during long-running derivations. - * param progress - completion fraction in the `0..1` range - */ - onProgress?: (progress: number) => void; -}; - -// Exclusive `2^32` sentinel used by `isU32(...)`, not the inclusive maximum u32 value. -const maxUint32 = Math.pow(2, 32); -// Validate safe JS integers in `[0, 2^32 - 1]`. -function isU32(num: number) { - return Number.isSafeInteger(num) && num >= 0 && num < maxUint32; -} - -function argon2Opts(opts: TArg) { - const merged: any = { - version: 0x13, - dkLen: 32, - maxmem: maxUint32 - 1, - asyncTick: 10, - }; - // Unknown keys are copied through unchanged here and later ignored unless - // destructuring consumes them. - for (let [k, v] of Object.entries(opts)) if (v !== undefined) merged[k] = v; - - const { dkLen, p, m, t, version, onProgress, asyncTick } = merged; - // RFC 9106 §3.1: tag length `T` MUST be an integer number of bytes from 4 to 2^32-1. - if (!isU32(dkLen) || dkLen < 4) throw new Error('"dkLen" must be 4..'); - if (!isU32(p) || p < 1 || p >= Math.pow(2, 24)) throw new Error('"p" must be 1..2^24'); - if (!isU32(m)) throw new Error('"m" must be 0..2^32'); - if (!isU32(t) || t < 1) throw new Error('"t" (iterations) must be 1..2^32'); - if (onProgress !== undefined && typeof onProgress !== 'function') - throw new Error('"progressCb" must be a function'); - anumber(asyncTick, 'asyncTick'); - /* - Memory size m MUST be an integer number of kibibytes from 8*p - to 2^(32)-1. The actual number of blocks is m', which is m - rounded down to the nearest multiple of 4*p. - */ - if (!isU32(m) || m < 8 * p) throw new Error('"m" (memory) must be at least 8*p bytes'); - // Accept legacy `0x10` for compatibility even though RFC 9106 profiles standardize `0x13`. - if (version !== 0x10 && version !== 0x13) - throw new Error('"version" must be 0x10 or 0x13, got ' + version); - return merged; -} - -function argon2Init( - password: TArg, - salt: TArg, - type: Types, - opts: TArg -) { - password = kdfInputToBytes(password, 'password'); - salt = kdfInputToBytes(salt, 'salt'); - if (!isU32(password.length)) throw new Error('"password" must be less of length 1..4Gb'); - // RFC 9106 §3.1 only requires S <= 2^32-1 bytes and says 16 bytes is RECOMMENDED for password - // hashing; this library intentionally takes the stricter common >=8-byte salt path. - if (!isU32(salt.length) || salt.length < 8) throw new Error('"salt" must be of length 8..4Gb'); - if (!Object.values(AT).includes(type)) throw new Error('"type" was invalid'); - let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress, asyncTick } = - argon2Opts(opts); - // Validation - key = abytesOrZero(key, 'key'); - personalization = abytesOrZero(personalization, 'personalization'); - // H_0 = H^(64)(LE32(p) || LE32(T) || LE32(m) || LE32(t) || - // LE32(v) || LE32(y) || LE32(length(P)) || P || - // LE32(length(S)) || S || LE32(length(K)) || K || - // LE32(length(X)) || X) - const h = blake2b.create(); - const BUF = new Uint32Array(1); - const BUF8 = u8(BUF); - for (let item of [p, dkLen, m, t, version, type]) { - // RFC 9106 H0 encodes these scalars as LE32, so normalize the host word before exposing bytes. - BUF[0] = swap8IfBE(item); - h.update(BUF8); - } - for (let i of [password, salt, key, personalization]) { - BUF[0] = swap8IfBE(i.length); // BUF is u32 array, this is valid once normalized to LE bytes - h.update(BUF8).update(i); - } - // Reserve two extra LE32 words after the 64-byte `H_0` so Figures 3-4 can append - // `LE32(0 or 1) || LE32(i)` in place for the lane-starting blocks. - const H0 = new Uint32Array(18); - const H0_8 = u8(H0); - h.digestInto(H0_8); - // 256 u32 = 1024 (BLOCK_SIZE), fills A2_BUF on processing - - // Params - const lanes = p; - // m' = 4 * p * floor (m / 4p) - const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p)); - //q = m' / p columns - const laneLen = Math.floor(mP / p); - const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS); - // `maxmem` is documented in bytes; compare against the actual 1024-byte block allocation. - const memUsed = mP * 1024; - if (!isU32(maxmem)) throw new Error('"maxmem" expected <2**32, got ' + maxmem); - if (memUsed > maxmem) - throw new Error('"maxmem" limit was hit: memUsed(mP*1024)=' + memUsed + ', maxmem=' + maxmem); - const B = new Uint32Array(memUsed / 4); - // Fill first blocks - for (let l = 0; l < p; l++) { - const i = 256 * laneLen * l; - // B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i)) - H0[17] = swap8IfBE(l); - H0[16] = swap8IfBE(0); - B.set(swap32IfBE(u32(Hp(H0, 1024))), i); - // B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i)) - H0[16] = swap8IfBE(1); - B.set(swap32IfBE(u32(Hp(H0, 1024))), i + 256); - } - let perBlock = () => {}; - if (onProgress) { - // The first segment of the first pass skips two preinitialized blocks per lane. - const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen - 2 * p; - // Invoke callback if progress changes from 10.01 to 10.02 - // Allows to draw smooth progress bar on up to 8K screen - const callbackPer = Math.max(Math.floor(totalBlock / 10000), 1); - let blockCnt = 0; - perBlock = () => { - blockCnt++; - if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock)) - onProgress(blockCnt / totalBlock); - }; - } - clean(BUF, H0); - return { type, mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick }; -} - -function argon2Output( - B: TArg, - p: number, - laneLen: number, - dkLen: number -): TRet { - const B_final = new Uint32Array(256); - for (let l = 0; l < p; l++) - for (let j = 0; j < 256; j++) B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j]; - // RFC 9106 steps 7-8 feed the byte string `C` into `H'^T(C)`, so normalize the xor'ed words - // back to spec byte order before `Hp(...)` reinterprets them as bytes. - const res = Hp(swap32IfBE(B_final), dkLen); - // Wipe both the xor scratch and the full working matrix once final digest bytes exist. - // JS cleanup is still only best-effort, but this local buffer is no longer needed here. - clean(B, B_final); - return res; -} - -function processBlock( - B: TArg, - address: TArg, - l: number, - r: number, - s: number, - index: number, - laneLen: number, - segmentLen: number, - lanes: number, - offset: number, - prev: number, - dataIndependent: boolean, - needXor: boolean -) { - if (offset % laneLen) prev = offset - 1; - let randL, randH; - if (dataIndependent) { - let i128 = index % 128; - // RFC 9106 §3.4.1.2: each 1024-byte address block yields 128 `(J1, J2)` pairs, so regenerate - // it whenever the segment index crosses a multiple of 128. - if (i128 === 0) { - address[256 + 12]++; - block(address, 256, 2 * 256, 0, false); - block(address, 0, 2 * 256, 0, false); - } - randL = address[2 * i128]; - randH = address[2 * i128 + 1]; - } else { - const T = 256 * prev; - randL = B[T]; - randH = B[T + 1]; - } - // Address-block path selects `J1` / `J2`, then maps them to the reference - // lane/block per RFC 9106 §3.4. - const refLane = r === 0 && s === 0 ? l : randH % lanes; - const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l); - const refBlock = laneLen * refLane + refPos; - // B[i][j] = G(B[i][j-1], B[l][z]) - block(B, 256 * prev, 256 * refBlock, offset * 256, needXor); -} - -function argon2( - type: Types, - password: TArg, - salt: TArg, - opts: TArg -): TRet { - const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock } = argon2Init( - password, - salt, - type, - opts - ); - // Pre-loop setup - // [address, input, zero_block] format so we can pass single U32 to block function - const address = new Uint32Array(3 * 256); - address[256 + 6] = mP; - address[256 + 8] = t; - address[256 + 10] = type; - for (let r = 0; r < t; r++) { - // RFC 9106 step 6 applies the XOR-on-later-passes rule only for version `0x13`; legacy - // `0x10` keeps the older overwrite behavior used by the v16 test vectors. - const needXor = r !== 0 && version === 0x13; - address[256 + 0] = r; - for (let s = 0; s < ARGON2_SYNC_POINTS; s++) { - address[256 + 4] = s; - // RFC 9106 §3.4.1.3: Argon2id uses Argon2i's data-independent `J1` / `J2` generation only - // in pass 0, slices 0 and 1; Argon2i uses it in every segment. - const dataIndependent = type == AT.Argon2i || (type == AT.Argon2id && r === 0 && s < 2); - for (let l = 0; l < p; l++) { - address[256 + 2] = l; - address[256 + 12] = 0; - let startPos = 0; - if (r === 0 && s === 0) { - startPos = 2; - if (dataIndependent) { - address[256 + 12]++; - block(address, 256, 2 * 256, 0, false); - block(address, 0, 2 * 256, 0, false); - } - } - // current block postion - let offset = l * laneLen + s * segmentLen + startPos; - // previous block position - let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1; - for (let index = startPos; index < segmentLen; index++, offset++, prev++) { - perBlock(); - processBlock( - B, - address, - l, - r, - s, - index, - laneLen, - segmentLen, - lanes, - offset, - prev, - dataIndependent, - needXor - ); - } - } - } - } - clean(address); - return argon2Output(B, p, laneLen, dkLen); -} - -/** - * Argon2d GPU-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2d. - * ```ts - * argon2d('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2d = ( - password: TArg, - salt: TArg, - opts: TArg -): TRet => argon2(AT.Argond2d, password, salt, opts); -/** - * Argon2i side-channel-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2i. - * ```ts - * argon2i('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2i = ( - password: TArg, - salt: TArg, - opts: TArg -): TRet => argon2(AT.Argon2i, password, salt, opts); -/** - * Argon2id, combining i+d, the most popular version from RFC 9106. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2id. - * ```ts - * argon2id('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2id = ( - password: TArg, - salt: TArg, - opts: TArg -): TRet => argon2(AT.Argon2id, password, salt, opts); - -async function argon2Async( - type: Types, - password: TArg, - salt: TArg, - opts: TArg -): Promise> { - const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick } = - argon2Init(password, salt, type, opts); - // Pre-loop setup - // [address, input, zero_block] format so we can pass single U32 to block function - const address = new Uint32Array(3 * 256); - address[256 + 6] = mP; - address[256 + 8] = t; - address[256 + 10] = type; - let ts = Date.now(); - for (let r = 0; r < t; r++) { - // RFC 9106 step 6 applies the XOR-on-later-passes rule only for version `0x13`; legacy - // `0x10` keeps the older overwrite behavior used by the v16 test vectors. - const needXor = r !== 0 && version === 0x13; - address[256 + 0] = r; - for (let s = 0; s < ARGON2_SYNC_POINTS; s++) { - address[256 + 4] = s; - // RFC 9106 §3.4.1.3: Argon2id uses Argon2i's data-independent `J1` / `J2` generation only - // in pass 0, slices 0 and 1; Argon2i uses it in every segment. - const dataIndependent = type == AT.Argon2i || (type == AT.Argon2id && r === 0 && s < 2); - for (let l = 0; l < p; l++) { - address[256 + 2] = l; - address[256 + 12] = 0; - let startPos = 0; - if (r === 0 && s === 0) { - startPos = 2; - if (dataIndependent) { - address[256 + 12]++; - block(address, 256, 2 * 256, 0, false); - block(address, 0, 2 * 256, 0, false); - } - } - // current block postion - let offset = l * laneLen + s * segmentLen + startPos; - // previous block position - let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1; - for (let index = startPos; index < segmentLen; index++, offset++, prev++) { - perBlock(); - processBlock( - B, - address, - l, - r, - s, - index, - laneLen, - segmentLen, - lanes, - offset, - prev, - dataIndependent, - needXor - ); - // Date.now() is not monotonic. If the clock goes backwards, - // still yield control. - const diff = Date.now() - ts; - if (!(diff >= 0 && diff < asyncTick)) { - await nextTick(); - ts += diff; - } - } - } - } - } - clean(address); - return argon2Output(B, p, laneLen, dkLen); -} - -/** - * Argon2d async GPU-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2d asynchronously. - * ```ts - * await argon2dAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2dAsync = ( - password: TArg, - salt: TArg, - opts: TArg -): Promise> => argon2Async(AT.Argond2d, password, salt, opts); -/** - * Argon2i async side-channel-resistant version. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2i asynchronously. - * ```ts - * await argon2iAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2iAsync = ( - password: TArg, - salt: TArg, - opts: TArg -): Promise> => argon2Async(AT.Argon2i, password, salt, opts); -/** - * Argon2id async, combining i+d, the most popular version from RFC 9106. - * @param password - password or input key material - * @param salt - unique salt value - * @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Argon2 input or cost parameters are invalid. {@link Error} - * @example - * Derive a key with Argon2id asynchronously. - * ```ts - * await argon2idAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 }); - * ``` - */ -export const argon2idAsync = ( - password: TArg, - salt: TArg, - opts: TArg -): Promise> => argon2Async(AT.Argon2id, password, salt, opts); diff --git a/node_modules/@noble/hashes/src/blake1.ts b/node_modules/@noble/hashes/src/blake1.ts deleted file mode 100644 index 72cb4f6..0000000 --- a/node_modules/@noble/hashes/src/blake1.ts +++ /dev/null @@ -1,614 +0,0 @@ -/** - * Blake1 legacy hash function, one of SHA3 proposals. - * Rarely used. Check out blake2 or blake3 instead. - * {@link https://www.aumasson.jp/blake/blake.pdf} - * - * In the best case, there are 0 allocations. - * - * Differences from blake2: - * - * - BE instead of LE - * - Paddings, similar to MD5, RIPEMD, SHA1, SHA2, but: - * - length flag is located before actual length - * - padding block is compressed differently (no lengths) - * Instead of msg[sigma[k]], we have `msg[sigma[k]] ^ constants[sigma[k-1]]` - * (-1 for g1, g2 without -1) - * - Salt is XOR-ed into constants instead of state - * - Salt is XOR-ed with output in `compress` - * - Additional rows (+64 bytes) in SIGMA for new rounds - * - Different round count: - * - 14 / 10 rounds in blake256 / blake2s - * - 16 / 12 rounds in blake512 / blake2b - * - blake512: G1b: rotr 24 -> 25, G2b: rotr 63 -> 11 - * @module - */ -import { BSIGMA, G1s, G2s } from './_blake.ts'; -import { SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from './_md.ts'; -import * as u64 from './_u64.ts'; -// prettier-ignore -import { - abytes, aexists, aoutput, - clean, createHasher, - createView, - type CHash, - type Hash, - type TArg, - type TRet -} from './utils.ts'; - -/** Blake1 options. Basically just `salt`. */ -export type BlakeOpts = { - /** Optional salt mixed into initialization. */ - salt?: Uint8Array; -}; - -// Shared unsalted sentinel, sized for the 64-bit path and reused by the 32-bit path via prefix. -const EMPTY_SALT = /* @__PURE__ */ new Uint32Array(8); - -// Base destroy logic only clears salt-derived state; the partial message buffer and length/position -// bookkeeping remain until the instance or backing buffer is reused. -abstract class BLAKE1> implements Hash { - readonly canXOF = false; - protected finished = false; - protected length = 0; - protected pos = 0; - protected destroyed = false; - // For partial updates less than block size - protected buffer: Uint8Array; - protected view: DataView; - protected salt: Uint32Array; - abstract compress(view: DataView, offset: number, withLength?: boolean): void; - protected abstract get(): number[]; - protected abstract set(...args: number[]): void; - - readonly blockLen: number; - readonly outputLen: number; - private lengthFlag: number; - private counterLen: number; - protected constants: Uint32Array; - - constructor( - blockLen: number, - outputLen: number, - lengthFlag: number, - counterLen: number, - saltLen: number, - constants: Uint32Array, - opts: BlakeOpts = {} - ) { - const { salt } = opts; - this.blockLen = blockLen; - this.outputLen = outputLen; - this.lengthFlag = lengthFlag; - this.counterLen = counterLen; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - if (salt !== undefined) { - let slt = salt; - abytes(slt, 4 * saltLen, 'salt'); - // if (slt.length !== 4 * saltLen) throw new Error('wrong salt length'); - const salt32 = (this.salt = new Uint32Array(saltLen)); - const sv = createView(slt); - this.constants = constants.slice(); - for (let i = 0, offset = 0; i < salt32.length; i++, offset += 4) { - salt32[i] = sv.getUint32(offset, false); - this.constants[i] ^= salt32[i]; - } - } else { - this.salt = EMPTY_SALT; - this.constants = constants; - } - } - update(data: TArg): this { - aexists(this); - abytes(data); - // From _md, but update length before each compress - const { view, buffer, blockLen } = this; - const len = data.length; - let dataView; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - // Fast path only when there is no buffered partial block: `take === blockLen` implies - // `this.pos === 0`, so we can process full blocks directly from the input view. - if (take === blockLen) { - if (!dataView) dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) { - this.length += blockLen; - this.compress(dataView, pos); - } - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.length += blockLen; - this.compress(view, 0, true); - this.pos = 0; - } - } - return this; - } - destroy(): void { - this.destroyed = true; - if (this.salt !== EMPTY_SALT) { - clean(this.salt, this.constants); - } - } - _cloneInto(to?: T): T { - to ||= new (this.constructor as any)() as T; - to.set(...this.get()); - const { buffer, length, finished, destroyed, constants, salt, pos } = this; - to.buffer.set(buffer); - // Clone salt-derived arrays by value so destroying the clone cannot wipe the source instance. - to.constants = constants.slice(); - to.destroyed = destroyed; - to.finished = finished; - to.length = length; - to.pos = pos; - to.salt = salt.slice(); - return to; - } - clone(): T { - return this._cloneInto(); - } - digestInto(out: TArg): void { - aexists(this); - aoutput(out, this); - this.finished = true; - // Padding - const { buffer, blockLen, counterLen, lengthFlag, view } = this; - clean(buffer.subarray(this.pos)); // clean buf - const counter = BigInt((this.length + this.pos) * 8); - const counterPos = blockLen - counterLen - 1; - buffer[this.pos] |= 0b1000_0000; // End block flag - this.length += this.pos; // add unwritten length - // Not enough in buffer for length: write what we have. - if (this.pos > counterPos) { - this.compress(view, 0); - clean(buffer); - this.pos = 0; - } - // Difference with md: here we have lengthFlag! - buffer[counterPos] |= lengthFlag; // Length flag - // We always set 8 byte length flag. Because length will overflow significantly sooner. - view.setBigUint64(blockLen - 8, counter, false); - // Blake1 omits the counter from the extra all-padding block; only the block that still carries - // message bytes mixes in the final bit length. - this.compress(view, 0, this.pos !== 0); - // Write output - clean(buffer); - const v = createView(out); - const state = this.get(); - for (let i = 0; i < this.outputLen / 4; ++i) v.setUint32(i * 4, state[i]); - } - digest(): TRet { - const { buffer, outputLen } = this; - this.digestInto(buffer); - // Return a copy so callers do not alias the instance scratch buffer used during finalization. - const res = buffer.slice(0, outputLen); - this.destroy(); - return res as TRet; - } -} - -// Blake1-512 / Blake1-384 constant table `C512`. -// Stored as sixteen 64-bit constants split into `[high32, low32]` halves so -// the Blake1-64 path can reuse one layout for both `v8..v15` initialization -// and the permuted constant lookups. -const B64C = /* @__PURE__ */ Uint32Array.from([ - 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, - 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, - 0x9216d5d9, 0x8979fb1b, 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, - 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, -]); -// Blake1-256 / Blake1-224 constant table `C256`, derived as the first half of `C512`. -const B32C = /* @__PURE__ */ B64C.slice(0, 16); - -// Blake1-256 IV cloned from SHA-256. -const B256_IV = /* @__PURE__ */ SHA256_IV.slice(); -// Blake1-224 IV cloned from SHA-224. -const B224_IV = /* @__PURE__ */ SHA224_IV.slice(); -// Blake1-384 IV cloned from the SHA-384 high-then-low 32-bit halves. -const B384_IV = /* @__PURE__ */ SHA384_IV.slice(); -// Blake1-512 IV cloned from the SHA-512 high-then-low 32-bit halves. -const B512_IV = /* @__PURE__ */ SHA512_IV.slice(); - -// Precompute the odd/even companion constants used by all 14 Blake1-32 rounds. -// Each pair stores `u[sigma[2i + 1]]` then `u[sigma[2i]]`, matching the `G1s` / `G2s` xor order. -function generateTBL256() { - const TBL = []; - for (let i = 0, j = 0; i < 14; i++, j += 16) { - for (let offset = 1; offset < 16; offset += 2) { - TBL.push(B32C[BSIGMA[j + offset]]); - TBL.push(B32C[BSIGMA[j + offset - 1]]); - } - } - return new Uint32Array(TBL); -} -// Full 14-round companion-constant table for Blake1-32. -const TBL256 = /* @__PURE__ */ generateTBL256(); - -// Shared synchronous message-word scratch for the 32-bit Blake1 path. -const BLAKE256_W = /* @__PURE__ */ new Uint32Array(16); - -class BLAKE1_32B extends BLAKE1 { - private v0: number; - private v1: number; - private v2: number; - private v3: number; - private v4: number; - private v5: number; - private v6: number; - private v7: number; - constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts: BlakeOpts = {}) { - super(64, outputLen, lengthFlag, 8, 4, B32C, opts); - this.v0 = IV[0] | 0; - this.v1 = IV[1] | 0; - this.v2 = IV[2] | 0; - this.v3 = IV[3] | 0; - this.v4 = IV[4] | 0; - this.v5 = IV[5] | 0; - this.v6 = IV[6] | 0; - this.v7 = IV[7] | 0; - } - protected get(): [number, number, number, number, number, number, number, number] { - const { v0, v1, v2, v3, v4, v5, v6, v7 } = this; - return [v0, v1, v2, v3, v4, v5, v6, v7]; - } - // prettier-ignore - protected set( - v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number - ): void { - this.v0 = v0 | 0; - this.v1 = v1 | 0; - this.v2 = v2 | 0; - this.v3 = v3 | 0; - this.v4 = v4 | 0; - this.v5 = v5 | 0; - this.v6 = v6 | 0; - this.v7 = v7 | 0; - } - destroy(): void { - super.destroy(); - this.set(0, 0, 0, 0, 0, 0, 0, 0); - } - compress(view: DataView, offset: number, withLength = true): void { - for (let i = 0; i < 16; i++, offset += 4) BLAKE256_W[i] = view.getUint32(offset, false); - // Cannot reuse blake2s compress: Blake1 mixes each message word with the companion constants - // precomputed in `TBL256`, rather than using the raw schedule words directly. - let v00 = this.v0 | 0; - let v01 = this.v1 | 0; - let v02 = this.v2 | 0; - let v03 = this.v3 | 0; - let v04 = this.v4 | 0; - let v05 = this.v5 | 0; - let v06 = this.v6 | 0; - let v07 = this.v7 | 0; - let v08 = this.constants[0] | 0; - let v09 = this.constants[1] | 0; - let v10 = this.constants[2] | 0; - let v11 = this.constants[3] | 0; - // Blake1-32 injects the 64-bit bit counter as `[t0, t0, t1, t1]` across `v12..v15`; the - // final all-padding block passes `withLength = false`, leaving these lanes as raw constants. - const { h, l } = u64.fromBig(BigInt(withLength ? this.length * 8 : 0)); - let v12 = (this.constants[4] ^ l) >>> 0; - let v13 = (this.constants[5] ^ l) >>> 0; - let v14 = (this.constants[6] ^ h) >>> 0; - let v15 = (this.constants[7] ^ h) >>> 0; - // prettier-ignore - for (let i = 0, k = 0, j = 0; i < 14; i++) { - ({ a: v00, b: v04, c: v08, d: v12 } = G1s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v00, b: v04, c: v08, d: v12 } = G2s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v01, b: v05, c: v09, d: v13 } = G1s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v01, b: v05, c: v09, d: v13 } = G2s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v02, b: v06, c: v10, d: v14 } = G1s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v02, b: v06, c: v10, d: v14 } = G2s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v03, b: v07, c: v11, d: v15 } = G1s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v03, b: v07, c: v11, d: v15 } = G2s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v00, b: v05, c: v10, d: v15 } = G1s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v00, b: v05, c: v10, d: v15 } = G2s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v01, b: v06, c: v11, d: v12 } = G1s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v01, b: v06, c: v11, d: v12 } = G2s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v02, b: v07, c: v08, d: v13 } = G1s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v02, b: v07, c: v08, d: v13 } = G2s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v03, b: v04, c: v09, d: v14 } = G1s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - ({ a: v03, b: v04, c: v09, d: v14 } = G2s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++])); - } - this.v0 = (this.v0 ^ v00 ^ v08 ^ this.salt[0]) >>> 0; - this.v1 = (this.v1 ^ v01 ^ v09 ^ this.salt[1]) >>> 0; - this.v2 = (this.v2 ^ v02 ^ v10 ^ this.salt[2]) >>> 0; - this.v3 = (this.v3 ^ v03 ^ v11 ^ this.salt[3]) >>> 0; - this.v4 = (this.v4 ^ v04 ^ v12 ^ this.salt[0]) >>> 0; - this.v5 = (this.v5 ^ v05 ^ v13 ^ this.salt[1]) >>> 0; - this.v6 = (this.v6 ^ v06 ^ v14 ^ this.salt[2]) >>> 0; - this.v7 = (this.v7 ^ v07 ^ v15 ^ this.salt[3]) >>> 0; - clean(BLAKE256_W); - } -} - -// Shared Blake1-64 work vector storing 16 working words as adjacent high/low 32-bit halves. -const BBUF = /* @__PURE__ */ new Uint32Array(32); -// Shared synchronous message-word scratch for the 64-bit Blake1 path. -const BLAKE512_W = /* @__PURE__ */ new Uint32Array(32); - -// Precompute the high/low companion constants used by all 16 Blake1-64 rounds. -// Each quartet stores `u[sigma[2i + 1]]` high/low halves, then `u[sigma[2i]]` high/low halves. -function generateTBL512() { - const TBL = []; - for (let r = 0, k = 0; r < 16; r++, k += 16) { - for (let offset = 1; offset < 16; offset += 2) { - TBL.push(B64C[BSIGMA[k + offset] * 2 + 0]); - TBL.push(B64C[BSIGMA[k + offset] * 2 + 1]); - TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 0]); - TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 1]); - } - } - return new Uint32Array(TBL); -} -// Full 16-round companion-constant table as high/low halves. -const TBL512 = /* @__PURE__ */ generateTBL512(); - -// Blake1-64 first half-round with rotations `32` and `25`; `k` is the half-call schedule index. -function G1b(a: number, b: number, c: number, d: number, msg: TArg, k: number) { - const Xpos = 2 * BSIGMA[k]; - const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore - let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore - let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore - let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore - let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore - // v[a] = (v[a] + v[b] + x) | 0; - let ll = u64.add3L(Al, Bl, Xl); - Ah = u64.add3H(ll, Ah, Bh, Xh) >>> 0; - Al = (ll | 0) >>> 0; - // v[d] = rotr(v[d] ^ v[a], 32) - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) }); - // v[c] = (v[c] + v[d]) | 0; - ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); - // v[b] = rotr(v[b] ^ v[c], 25) - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 25), Bl: u64.rotrSL(Bh, Bl, 25) }); - ((BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah)); - ((BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh)); - ((BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch)); - ((BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh)); -} - -// Blake1-64 second half-round with rotations `16` and `11`; `k` is the half-call schedule index. -function G2b(a: number, b: number, c: number, d: number, msg: TArg, k: number) { - const Xpos = 2 * BSIGMA[k]; - const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore - let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore - let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore - let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore - let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore - // v[a] = (v[a] + v[b] + x) | 0; - let ll = u64.add3L(Al, Bl, Xl); - Ah = u64.add3H(ll, Ah, Bh, Xh); - Al = ll | 0; - // v[d] = rotr(v[d] ^ v[a], 16) - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) }); - // v[c] = (v[c] + v[d]) | 0; - ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); - // v[b] = rotr(v[b] ^ v[c], 11) - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 11), Bl: u64.rotrSL(Bh, Bl, 11) }); - ((BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah)); - ((BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh)); - ((BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch)); - ((BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh)); -} - -// Legacy field names keep the local `l/h` spelling, but array/state order stays `[high, low]` to -// match the IV tables and `BBUF` layout. -class BLAKE1_64B extends BLAKE1 { - private v0l: number; - private v0h: number; - private v1l: number; - private v1h: number; - private v2l: number; - private v2h: number; - private v3l: number; - private v3h: number; - private v4l: number; - private v4h: number; - private v5l: number; - private v5h: number; - private v6l: number; - private v6h: number; - private v7l: number; - private v7h: number; - constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts: BlakeOpts = {}) { - super(128, outputLen, lengthFlag, 16, 8, B64C, opts); - this.v0l = IV[0] | 0; - this.v0h = IV[1] | 0; - this.v1l = IV[2] | 0; - this.v1h = IV[3] | 0; - this.v2l = IV[4] | 0; - this.v2h = IV[5] | 0; - this.v3l = IV[6] | 0; - this.v3h = IV[7] | 0; - this.v4l = IV[8] | 0; - this.v4h = IV[9] | 0; - this.v5l = IV[10] | 0; - this.v5h = IV[11] | 0; - this.v6l = IV[12] | 0; - this.v6h = IV[13] | 0; - this.v7l = IV[14] | 0; - this.v7h = IV[15] | 0; - } - // prettier-ignore - protected get(): [ - number, number, number, number, number, number, number, number, - number, number, number, number, number, number, number, number - ] { - let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this; - return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h]; - } - // prettier-ignore - protected set( - v0l: number, v0h: number, v1l: number, v1h: number, - v2l: number, v2h: number, v3l: number, v3h: number, - v4l: number, v4h: number, v5l: number, v5h: number, - v6l: number, v6h: number, v7l: number, v7h: number - ): void { - this.v0l = v0l | 0; - this.v0h = v0h | 0; - this.v1l = v1l | 0; - this.v1h = v1h | 0; - this.v2l = v2l | 0; - this.v2h = v2h | 0; - this.v3l = v3l | 0; - this.v3h = v3h | 0; - this.v4l = v4l | 0; - this.v4h = v4h | 0; - this.v5l = v5l | 0; - this.v5h = v5h | 0; - this.v6l = v6l | 0; - this.v6h = v6h | 0; - this.v7l = v7l | 0; - this.v7h = v7h | 0; - } - destroy(): void { - super.destroy(); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } - compress(view: DataView, offset: number, withLength = true): void { - for (let i = 0; i < 32; i++, offset += 4) BLAKE512_W[i] = view.getUint32(offset, false); - - this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state. - BBUF.set(this.constants.subarray(0, 16), 16); - if (withLength) { - // Blake1-64 injects the 64-bit bit counter into `v12` and `v13`; the final all-padding - // block passes `withLength = false`, leaving the trailing constant lanes untouched. - const { h, l } = u64.fromBig(BigInt(this.length * 8)); - BBUF[24] = (BBUF[24] ^ h) >>> 0; - BBUF[25] = (BBUF[25] ^ l) >>> 0; - BBUF[26] = (BBUF[26] ^ h) >>> 0; - BBUF[27] = (BBUF[27] ^ l) >>> 0; - } - for (let i = 0, k = 0; i < 16; i++) { - G1b(0, 4, 8, 12, BLAKE512_W, k++); - G2b(0, 4, 8, 12, BLAKE512_W, k++); - G1b(1, 5, 9, 13, BLAKE512_W, k++); - G2b(1, 5, 9, 13, BLAKE512_W, k++); - G1b(2, 6, 10, 14, BLAKE512_W, k++); - G2b(2, 6, 10, 14, BLAKE512_W, k++); - G1b(3, 7, 11, 15, BLAKE512_W, k++); - G2b(3, 7, 11, 15, BLAKE512_W, k++); - - G1b(0, 5, 10, 15, BLAKE512_W, k++); - G2b(0, 5, 10, 15, BLAKE512_W, k++); - G1b(1, 6, 11, 12, BLAKE512_W, k++); - G2b(1, 6, 11, 12, BLAKE512_W, k++); - G1b(2, 7, 8, 13, BLAKE512_W, k++); - G2b(2, 7, 8, 13, BLAKE512_W, k++); - G1b(3, 4, 9, 14, BLAKE512_W, k++); - G2b(3, 4, 9, 14, BLAKE512_W, k++); - } - this.v0l ^= BBUF[0] ^ BBUF[16] ^ this.salt[0]; - this.v0h ^= BBUF[1] ^ BBUF[17] ^ this.salt[1]; - this.v1l ^= BBUF[2] ^ BBUF[18] ^ this.salt[2]; - this.v1h ^= BBUF[3] ^ BBUF[19] ^ this.salt[3]; - this.v2l ^= BBUF[4] ^ BBUF[20] ^ this.salt[4]; - this.v2h ^= BBUF[5] ^ BBUF[21] ^ this.salt[5]; - this.v3l ^= BBUF[6] ^ BBUF[22] ^ this.salt[6]; - this.v3h ^= BBUF[7] ^ BBUF[23] ^ this.salt[7]; - this.v4l ^= BBUF[8] ^ BBUF[24] ^ this.salt[0]; - this.v4h ^= BBUF[9] ^ BBUF[25] ^ this.salt[1]; - this.v5l ^= BBUF[10] ^ BBUF[26] ^ this.salt[2]; - this.v5h ^= BBUF[11] ^ BBUF[27] ^ this.salt[3]; - this.v6l ^= BBUF[12] ^ BBUF[28] ^ this.salt[4]; - this.v6h ^= BBUF[13] ^ BBUF[29] ^ this.salt[5]; - this.v7l ^= BBUF[14] ^ BBUF[30] ^ this.salt[6]; - this.v7h ^= BBUF[15] ^ BBUF[31] ^ this.salt[7]; - clean(BBUF, BLAKE512_W); - } -} - -/** Internal blake1-224 hash class. */ -export class _BLAKE224 extends BLAKE1_32B { - constructor(opts: BlakeOpts = {}) { - super(28, B224_IV, 0b0000_0000, opts); - } -} -/** Internal blake1-256 hash class. */ -export class _BLAKE256 extends BLAKE1_32B { - constructor(opts: BlakeOpts = {}) { - super(32, B256_IV, 0b0000_0001, opts); - } -} -/** Internal blake1-384 hash class. */ -export class _BLAKE384 extends BLAKE1_64B { - constructor(opts: BlakeOpts = {}) { - super(48, B384_IV, 0b0000_0000, opts); - } -} -/** Internal blake1-512 hash class. */ -export class _BLAKE512 extends BLAKE1_64B { - constructor(opts: BlakeOpts = {}) { - super(64, B512_IV, 0b0000_0001, opts); - } -} -/** - * Blake1-224 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 16 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-224. - * ```ts - * blake224(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake224: TRet> = /* @__PURE__ */ createHasher( - (opts) => new _BLAKE224(opts) -); -/** - * Blake1-256 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 16 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-256. - * ```ts - * blake256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake256: TRet> = /* @__PURE__ */ createHasher( - (opts) => new _BLAKE256(opts) -); -/** - * Blake1-384 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 32 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-384. - * ```ts - * blake384(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake384: TRet> = /* @__PURE__ */ createHasher( - (opts) => new _BLAKE384(opts) -); -/** - * Blake1-512 hash function. - * @param msg - message bytes to hash - * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set, - * `opts.salt` must be exactly 32 bytes. - * @returns Digest bytes. - * @example - * Hash a message with Blake1-512. - * ```ts - * blake512(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake512: TRet> = /* @__PURE__ */ createHasher( - (opts) => new _BLAKE512(opts) -); diff --git a/node_modules/@noble/hashes/src/blake2.ts b/node_modules/@noble/hashes/src/blake2.ts deleted file mode 100644 index 01f6046..0000000 --- a/node_modules/@noble/hashes/src/blake2.ts +++ /dev/null @@ -1,582 +0,0 @@ -/** - * blake2b (64-bit) & blake2s (8 to 32-bit) hash functions. - * b could have been faster, but there is no fast u64 in js, so s is 1.5x faster. - * @module - */ -import { BSIGMA, G1s, G2s } from './_blake.ts'; -import { SHA256_IV } from './_md.ts'; -import * as u64 from './_u64.ts'; -// prettier-ignore -import { - abytes, aexists, anumber, aoutput, - clean, createHasher, - swap32IfBE, swap8IfBE, - u32, - type CHash, - type Hash, - type TArg, - type TRet -} from './utils.ts'; - -/** - * Blake hash options. - * `dkLen` is output length. `key` is used in MAC mode. `salt` is used in - * KDF mode. - */ -export type Blake2Opts = { - /** Desired digest length in bytes. RFC 7693 uses 1..64 for blake2b and 1..32 for blake2s. */ - dkLen?: number; - /** Optional MAC key. */ - key?: Uint8Array; - /** Optional salt mixed into initialization. */ - salt?: Uint8Array; - /** Optional personalization bytes. */ - personalization?: Uint8Array; -}; - -// Same IV words as `SHA512_IV`, but endian-swapped into LE u32 low/high halves -// for the BLAKE2b u64 helpers below. -const B2B_IV = /* @__PURE__ */ Uint32Array.from([ - 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, - 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19, -]); -// Shared synchronous BLAKE2b work vector as LE u32 low/high halves. -const BBUF = /* @__PURE__ */ new Uint32Array(32); - -// BLAKE2b G mix split into two half-rounds over LE u32 low/high limbs. -function G1b(a: number, b: number, c: number, d: number, msg: TArg, x: number) { - // NOTE: V is LE here - const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore - let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore - let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore - let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore - let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore - // v[a] = (v[a] + v[b] + x) | 0; - let ll = u64.add3L(Al, Bl, Xl); - Ah = u64.add3H(ll, Ah, Bh, Xh); - Al = ll | 0; - // v[d] = rotr(v[d] ^ v[a], 32) - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) }); - // v[c] = (v[c] + v[d]) | 0; - ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); - // v[b] = rotr(v[b] ^ v[c], 24) - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 24), Bl: u64.rotrSL(Bh, Bl, 24) }); - ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah)); - ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh)); - ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch)); - ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh)); -} - -// Second half-round of the same LE-limb BLAKE2b G mix; `x` is the message word offset. -function G2b(a: number, b: number, c: number, d: number, msg: TArg, x: number) { - // NOTE: V is LE here - const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore - let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore - let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore - let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore - let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore - // v[a] = (v[a] + v[b] + x) | 0; - let ll = u64.add3L(Al, Bl, Xl); - Ah = u64.add3H(ll, Ah, Bh, Xh); - Al = ll | 0; - // v[d] = rotr(v[d] ^ v[a], 16) - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) }); - // v[c] = (v[c] + v[d]) | 0; - ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl)); - // v[b] = rotr(v[b] ^ v[c], 63) - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: u64.rotrBH(Bh, Bl, 63), Bl: u64.rotrBL(Bh, Bl, 63) }); - ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah)); - ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh)); - ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch)); - ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh)); -} - -function checkBlake2Opts( - outputLen: number, - opts: TArg = {}, - keyLen: number, - saltLen: number, - persLen: number -) { - anumber(keyLen); - // RFC 7693 §2.1 requires digest length nn in 1..keyLen. - if (outputLen <= 0 || outputLen > keyLen) throw new Error('outputLen bigger than keyLen'); - const { key, salt, personalization } = opts; - // This API uses `undefined` for the RFC 7693 `kk = 0` case, so a provided key must be non-empty. - if (key !== undefined && (key.length < 1 || key.length > keyLen)) - throw new Error('"key" expected to be undefined or of length=1..' + keyLen); - if (salt !== undefined) abytes(salt, saltLen, 'salt'); - if (personalization !== undefined) abytes(personalization, persLen, 'personalization'); -} - -/** Internal base class for BLAKE2. */ -export abstract class _BLAKE2> implements Hash { - protected abstract compress(msg: Uint32Array, offset: number, isLast: boolean): void; - protected abstract get(): number[]; - protected abstract set(...args: number[]): void; - abstract destroy(): void; - protected buffer: Uint8Array; - protected buffer32: Uint32Array; - protected finished = false; - protected destroyed = false; - protected length: number = 0; - protected pos: number = 0; - readonly blockLen: number; - readonly outputLen: number; - readonly canXOF: boolean = false; - - constructor(blockLen: number, outputLen: number) { - anumber(blockLen); - anumber(outputLen); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.buffer = new Uint8Array(blockLen); - this.buffer32 = u32(this.buffer); - } - update(data: TArg): this { - aexists(this); - abytes(data); - // Main difference with other hashes: there is flag for last block, - // so we cannot process current block before we know that there - // is the next one. This significantly complicates logic and reduces ability - // to do zero-copy processing - const { blockLen, buffer, buffer32 } = this; - const len = data.length; - const offset = data.byteOffset; - const buf = data.buffer; - for (let pos = 0; pos < len; ) { - // If buffer is full and we still have input (don't process last block, same as blake2s) - if (this.pos === blockLen) { - swap32IfBE(buffer32); - this.compress(buffer32, 0, false); - swap32IfBE(buffer32); - this.pos = 0; - } - const take = Math.min(blockLen - this.pos, len - pos); - const dataOffset = offset + pos; - // Zero-copy only for full, 4-byte-aligned, non-final blocks. - if (take === blockLen && !(dataOffset % 4) && pos + take < len) { - const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4)); - swap32IfBE(data32); - for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) { - this.length += blockLen; - this.compress(data32, pos32, false); - } - swap32IfBE(data32); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - this.length += take; - pos += take; - } - return this; - } - digestInto(out: TArg): void { - aexists(this); - aoutput(out, this); - const { pos, buffer32 } = this; - this.finished = true; - // Padding - clean(this.buffer.subarray(pos)); - swap32IfBE(buffer32); - this.compress(buffer32, 0, true); - swap32IfBE(buffer32); - // Reject unaligned views explicitly instead of hiding them behind a full scratch copy. - if (out.byteOffset & 3) - throw new RangeError( - '"digestInto() output" expected 4-byte aligned byteOffset, got ' + out.byteOffset - ); - const state = this.get(); - const out32 = u32(out); - const full = Math.floor(this.outputLen / 4); - for (let i = 0; i < full; i++) out32[i] = swap8IfBE(state[i]); - const tail = this.outputLen % 4; - if (!tail) return; - const off = full * 4; - const word = state[full]; - for (let i = 0; i < tail; i++) out[off + i] = word >>> (8 * i); - } - digest(): TRet { - const { buffer, outputLen } = this; - this.digestInto(buffer); - // Return a copy so callers do not alias the instance scratch buffer used during finalization. - const res = buffer.slice(0, outputLen); - this.destroy(); - return res as TRet; - } - _cloneInto(to?: T): T { - const { buffer, length, finished, destroyed, outputLen, pos } = this; - // Recreate only `dkLen`; key/salt/personalization are already absorbed into the copied state. - to ||= new (this.constructor as any)({ dkLen: outputLen }) as T; - to.set(...this.get()); - to.buffer.set(buffer); - to.destroyed = destroyed; - to.finished = finished; - to.length = length; - to.pos = pos; - // @ts-ignore - to.outputLen = outputLen; - return to; - } - clone(): T { - return this._cloneInto(); - } -} - -/** Internal blake2b hash class with state stored as LE u32 low/high halves. */ -export class _BLAKE2b extends _BLAKE2<_BLAKE2b> { - // Same IV words as SHA-512 / BLAKE2b, encoded as LE u32 low/high halves. - private v0l = B2B_IV[0] | 0; - private v0h = B2B_IV[1] | 0; - private v1l = B2B_IV[2] | 0; - private v1h = B2B_IV[3] | 0; - private v2l = B2B_IV[4] | 0; - private v2h = B2B_IV[5] | 0; - private v3l = B2B_IV[6] | 0; - private v3h = B2B_IV[7] | 0; - private v4l = B2B_IV[8] | 0; - private v4h = B2B_IV[9] | 0; - private v5l = B2B_IV[10] | 0; - private v5h = B2B_IV[11] | 0; - private v6l = B2B_IV[12] | 0; - private v6h = B2B_IV[13] | 0; - private v7l = B2B_IV[14] | 0; - private v7h = B2B_IV[15] | 0; - - constructor(opts: Blake2Opts = {}) { - const olen = opts.dkLen === undefined ? 64 : opts.dkLen; - super(128, olen); - checkBlake2Opts(olen, opts, 64, 16, 16); - let { key, personalization, salt } = opts; - let keyLength = 0; - if (key !== undefined) { - abytes(key, undefined, 'key'); - keyLength = key.length; - } - // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` into the low 32 bits of `h[0]`; - // the high 32 bits stay at `IV[0]`. - this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24); - if (salt !== undefined) { - abytes(salt, undefined, 'salt'); - const slt = u32(salt); - this.v4l ^= swap8IfBE(slt[0]); - this.v4h ^= swap8IfBE(slt[1]); - this.v5l ^= swap8IfBE(slt[2]); - this.v5h ^= swap8IfBE(slt[3]); - } - if (personalization !== undefined) { - abytes(personalization, undefined, 'personalization'); - const pers = u32(personalization); - this.v6l ^= swap8IfBE(pers[0]); - this.v6h ^= swap8IfBE(pers[1]); - this.v7l ^= swap8IfBE(pers[2]); - this.v7h ^= swap8IfBE(pers[3]); - } - if (key !== undefined) { - // Pad to blockLen and update - const tmp = new Uint8Array(this.blockLen); - tmp.set(key); - this.update(tmp); - } - } - // prettier-ignore - protected get(): [ - number, number, number, number, number, number, number, number, - number, number, number, number, number, number, number, number - ] { - let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this; - return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h]; - } - // prettier-ignore - protected set( - v0l: number, v0h: number, v1l: number, v1h: number, - v2l: number, v2h: number, v3l: number, v3h: number, - v4l: number, v4h: number, v5l: number, v5h: number, - v6l: number, v6h: number, v7l: number, v7h: number - ): void { - this.v0l = v0l | 0; - this.v0h = v0h | 0; - this.v1l = v1l | 0; - this.v1h = v1h | 0; - this.v2l = v2l | 0; - this.v2h = v2h | 0; - this.v3l = v3l | 0; - this.v3h = v3h | 0; - this.v4l = v4l | 0; - this.v4h = v4h | 0; - this.v5l = v5l | 0; - this.v5h = v5h | 0; - this.v6l = v6l | 0; - this.v6h = v6h | 0; - this.v7l = v7l | 0; - this.v7h = v7h | 0; - } - protected compress(msg: Uint32Array, offset: number, isLast: boolean): void { - this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state. - BBUF.set(B2B_IV, 16); // Second half from IV. - let { h, l } = u64.fromBig(BigInt(this.length)); - BBUF[24] = B2B_IV[8] ^ l; // Low word of the offset. - BBUF[25] = B2B_IV[9] ^ h; // High word. - // Invert all bits for last block - if (isLast) { - BBUF[28] = ~BBUF[28]; - BBUF[29] = ~BBUF[29]; - } - let j = 0; - const s = BSIGMA; - // SIGMA selects 64-bit message words; multiply by 2 because `msg` stores - // each word as [low32, high32]. - for (let i = 0; i < 12; i++) { - G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]); - G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]); - G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]); - G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]); - G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]); - G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]); - G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]); - G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]); - - G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]); - G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]); - G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]); - G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]); - G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]); - G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]); - G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]); - G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]); - } - this.v0l ^= BBUF[0] ^ BBUF[16]; - this.v0h ^= BBUF[1] ^ BBUF[17]; - this.v1l ^= BBUF[2] ^ BBUF[18]; - this.v1h ^= BBUF[3] ^ BBUF[19]; - this.v2l ^= BBUF[4] ^ BBUF[20]; - this.v2h ^= BBUF[5] ^ BBUF[21]; - this.v3l ^= BBUF[6] ^ BBUF[22]; - this.v3h ^= BBUF[7] ^ BBUF[23]; - this.v4l ^= BBUF[8] ^ BBUF[24]; - this.v4h ^= BBUF[9] ^ BBUF[25]; - this.v5l ^= BBUF[10] ^ BBUF[26]; - this.v5h ^= BBUF[11] ^ BBUF[27]; - this.v6l ^= BBUF[12] ^ BBUF[28]; - this.v6h ^= BBUF[13] ^ BBUF[29]; - this.v7l ^= BBUF[14] ^ BBUF[30]; - this.v7h ^= BBUF[15] ^ BBUF[31]; - clean(BBUF); - } - destroy(): void { - this.destroyed = true; - clean(this.buffer32); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } -} - -/** - * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS. - * @param msg - message that would be hashed - * @param opts - Optional output, MAC, salt, and personalization settings. - * `dkLen` must be 1..64 bytes; `salt` and `personalization`, if present, - * must be 16 bytes each. See {@link Blake2Opts}. - * @returns Digest bytes. - * @example - * Hash a message with Blake2b. - * ```ts - * blake2b(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake2b: TRet> = /* @__PURE__ */ createHasher( - (opts) => new _BLAKE2b(opts) -); - -// ================= -// Blake2S -// ================= - -/** Internal type, 16 numbers. */ -// prettier-ignore -export type _Num16 = { - v0: number; v1: number; v2: number; v3: number; - v4: number; v5: number; v6: number; v7: number; - v8: number; v9: number; v10: number; v11: number; - v12: number; v13: number; v14: number; v15: number; -}; - -/** - * BLAKE2-compress core method. - * Runs only the round function over a caller-supplied local vector; callers initialize `v0..v15` - * and apply the final `h[i] ^= v[i] ^ v[i + 8]` fold themselves. - * @param s - flattened sigma schedule bytes - * @param offset - starting word offset inside `msg`, not a byte offset - * @param msg - message words - * @param rounds - round count to execute - * @param v0 - state word 0 - * @param v1 - state word 1 - * @param v2 - state word 2 - * @param v3 - state word 3 - * @param v4 - state word 4 - * @param v5 - state word 5 - * @param v6 - state word 6 - * @param v7 - state word 7 - * @param v8 - state word 8 - * @param v9 - state word 9 - * @param v10 - state word 10 - * @param v11 - state word 11 - * @param v12 - state word 12 - * @param v13 - state word 13 - * @param v14 - state word 14 - * @param v15 - state word 15 - * @returns Updated compression state words. - * @example - * Run the BLAKE2 compression core on zeroed state and message words. - * ```ts - * import { compress } from '@noble/hashes/blake2.js'; - * const state = compress( - * new Uint8Array(16), - * 0, - * new Uint32Array(16), - * 1, - * 0, 0, 0, 0, 0, 0, 0, 0, - * 0, 0, 0, 0, 0, 0, 0, 0 - * ); - * state.v0; - * ``` - */ -// prettier-ignore -export function compress(s: TArg, offset: number, msg: TArg, rounds: number, - v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, - v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, -): _Num16 { - let j = 0; - for (let i = 0; i < rounds; i++) { - ({ a: v0, b: v4, c: v8, d: v12 } = G1s(v0, v4, v8, v12, msg[offset + s[j++]])); - ({ a: v0, b: v4, c: v8, d: v12 } = G2s(v0, v4, v8, v12, msg[offset + s[j++]])); - ({ a: v1, b: v5, c: v9, d: v13 } = G1s(v1, v5, v9, v13, msg[offset + s[j++]])); - ({ a: v1, b: v5, c: v9, d: v13 } = G2s(v1, v5, v9, v13, msg[offset + s[j++]])); - ({ a: v2, b: v6, c: v10, d: v14 } = G1s(v2, v6, v10, v14, msg[offset + s[j++]])); - ({ a: v2, b: v6, c: v10, d: v14 } = G2s(v2, v6, v10, v14, msg[offset + s[j++]])); - ({ a: v3, b: v7, c: v11, d: v15 } = G1s(v3, v7, v11, v15, msg[offset + s[j++]])); - ({ a: v3, b: v7, c: v11, d: v15 } = G2s(v3, v7, v11, v15, msg[offset + s[j++]])); - - ({ a: v0, b: v5, c: v10, d: v15 } = G1s(v0, v5, v10, v15, msg[offset + s[j++]])); - ({ a: v0, b: v5, c: v10, d: v15 } = G2s(v0, v5, v10, v15, msg[offset + s[j++]])); - ({ a: v1, b: v6, c: v11, d: v12 } = G1s(v1, v6, v11, v12, msg[offset + s[j++]])); - ({ a: v1, b: v6, c: v11, d: v12 } = G2s(v1, v6, v11, v12, msg[offset + s[j++]])); - ({ a: v2, b: v7, c: v8, d: v13 } = G1s(v2, v7, v8, v13, msg[offset + s[j++]])); - ({ a: v2, b: v7, c: v8, d: v13 } = G2s(v2, v7, v8, v13, msg[offset + s[j++]])); - ({ a: v3, b: v4, c: v9, d: v14 } = G1s(v3, v4, v9, v14, msg[offset + s[j++]])); - ({ a: v3, b: v4, c: v9, d: v14 } = G2s(v3, v4, v9, v14, msg[offset + s[j++]])); - } - return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 }; -} - -// Blake2s reuses the SHA-256 IV words as-is. -const B2S_IV = /* @__PURE__ */ SHA256_IV.slice(); - -/** Internal blake2s hash class. */ -export class _BLAKE2s extends _BLAKE2<_BLAKE2s> { - // Internal state, same as SHA-256 - private v0 = B2S_IV[0] | 0; - private v1 = B2S_IV[1] | 0; - private v2 = B2S_IV[2] | 0; - private v3 = B2S_IV[3] | 0; - private v4 = B2S_IV[4] | 0; - private v5 = B2S_IV[5] | 0; - private v6 = B2S_IV[6] | 0; - private v7 = B2S_IV[7] | 0; - - constructor(opts: Blake2Opts = {}) { - const olen = opts.dkLen === undefined ? 32 : opts.dkLen; - super(64, olen); - checkBlake2Opts(olen, opts, 32, 8, 8); - let { key, personalization, salt } = opts; - let keyLength = 0; - if (key !== undefined) { - abytes(key, undefined, 'key'); - keyLength = key.length; - } - // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` directly into `h[0]`, since - // BLAKE2s stores each state word as one `u32`. - this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24); - if (salt !== undefined) { - abytes(salt, undefined, 'salt'); - const slt = u32(salt as Uint8Array); - this.v4 ^= swap8IfBE(slt[0]); - this.v5 ^= swap8IfBE(slt[1]); - } - if (personalization !== undefined) { - abytes(personalization, undefined, 'personalization'); - const pers = u32(personalization as Uint8Array); - this.v6 ^= swap8IfBE(pers[0]); - this.v7 ^= swap8IfBE(pers[1]); - } - if (key !== undefined) { - // Pad to blockLen and update - const tmp = new Uint8Array(this.blockLen); - tmp.set(key); - this.update(tmp); - } - } - protected get(): [number, number, number, number, number, number, number, number] { - const { v0, v1, v2, v3, v4, v5, v6, v7 } = this; - return [v0, v1, v2, v3, v4, v5, v6, v7]; - } - // prettier-ignore - protected set( - v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number - ): void { - this.v0 = v0 | 0; - this.v1 = v1 | 0; - this.v2 = v2 | 0; - this.v3 = v3 | 0; - this.v4 = v4 | 0; - this.v5 = v5 | 0; - this.v6 = v6 | 0; - this.v7 = v7 | 0; - } - protected compress(msg: Uint32Array, offset: number, isLast: boolean): void { - const { h, l } = u64.fromBig(BigInt(this.length)); - // Seed v8..v15 from the IV, xor the low/high 32-bit byte counter into - // v12/v13, and invert v14 on the final block. - // prettier-ignore - const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = - compress( - BSIGMA, offset, msg, 10, - this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7, - B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], l ^ B2S_IV[4], h ^ B2S_IV[5], isLast ? ~B2S_IV[6] : B2S_IV[6], B2S_IV[7] - ); - this.v0 ^= v0 ^ v8; - this.v1 ^= v1 ^ v9; - this.v2 ^= v2 ^ v10; - this.v3 ^= v3 ^ v11; - this.v4 ^= v4 ^ v12; - this.v5 ^= v5 ^ v13; - this.v6 ^= v6 ^ v14; - this.v7 ^= v7 ^ v15; - } - destroy(): void { - this.destroyed = true; - clean(this.buffer32); - this.set(0, 0, 0, 0, 0, 0, 0, 0); - } -} - -/** - * Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS. - * @param msg - message that would be hashed - * @param opts - Optional output, MAC, salt, and personalization settings. - * `dkLen` must be 1..32 bytes; `salt` and `personalization`, if present, - * must be 8 bytes each. See {@link Blake2Opts}. - * @returns Digest bytes. - * @example - * Hash a message with Blake2s. - * ```ts - * blake2s(new Uint8Array([97, 98, 99])); - * ``` - */ -export const blake2s: TRet> = /* @__PURE__ */ createHasher( - (opts) => new _BLAKE2s(opts) -); diff --git a/node_modules/@noble/hashes/src/blake3.ts b/node_modules/@noble/hashes/src/blake3.ts deleted file mode 100644 index bb96a5a..0000000 --- a/node_modules/@noble/hashes/src/blake3.ts +++ /dev/null @@ -1,317 +0,0 @@ -/** - * Blake3 fast hash is Blake2 with reduced security (round count). Can also be used as MAC & KDF. - * - * It is advertised as "the fastest cryptographic hash". However, it isn't true in JS. - * Why is this so slow? While it must be 6x faster than blake2b, perf diff is only 20%: - * - * * There is only 30% reduction in number of rounds from blake2s - * * Speed-up comes from tree structure, which is parallelized using SIMD & threading. - * These features are not present in JS, so we only get overhead from trees. - * * Parallelization only happens on 1024-byte chunks: there is no benefit for small inputs. - * * It is still possible to make it faster using: a) loop unrolling b) web workers c) wasm - * @module - */ -import { SHA256_IV } from './_md.ts'; -import { fromBig } from './_u64.ts'; -import { _BLAKE2, compress } from './blake2.ts'; -// prettier-ignore -import { - abytes, aexists, anumber, aoutput, - clean, - copyBytes, - createHasher, swap32IfBE, - u32, u8, - type CHashXOF, - type HashXOF, - type TArg, - type TRet -} from './utils.ts'; - -// Constructor-time mode flags (`KEYED_HASH`, `DERIVE_*`) plus per-node tree -// flags (`CHUNK_*`, `PARENT`, `ROOT`). -const B3_Flags = { - CHUNK_START: 0b1, - CHUNK_END: 0b10, - PARENT: 0b100, - ROOT: 0b1000, - KEYED_HASH: 0b10000, - DERIVE_KEY_CONTEXT: 0b100000, - DERIVE_KEY_MATERIAL: 0b1000000, -} as const; - -// Default BLAKE3 IV, cloned from the shared BLAKE2s / SHA-256 IV basis. -const B3_IV = /* @__PURE__ */ SHA256_IV.slice(); - -// Seven 16-word rounds of BLAKE3 message schedule, generated by repeatedly -// permuting the identity row. -const B3_SIGMA: TRet = /* @__PURE__ */ (() => { - const Id = Array.from({ length: 16 }, (_, i) => i); - const permute = (arr: number[]) => - [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]); - const res: number[] = []; - for (let i = 0, v = Id; i < 7; i++, v = permute(v)) res.push(...v); - return Uint8Array.from(res); -})(); - -/** - * Ensure to use EITHER `key` OR `context`, not both. - * - * * `key`: 32-byte MAC key. - * * `context`: caller-encoded KDF context bytes. If your protocol defines a - * string context, encode it before passing it here. - * A good default format for the original context string is - * "[application] [commit timestamp] [purpose]". - */ -export type Blake3Opts = { - /** Desired digest length in bytes. The BLAKE3 spec allows 0..2^64-1 bytes of output. */ - dkLen?: number; - /** Optional 32-byte MAC key. */ - key?: Uint8Array; - /** Optional KDF context bytes. */ - context?: Uint8Array; -}; - -/** Blake3 hash. Can be used as MAC and KDF with caller-encoded context bytes. */ -export class _BLAKE3 extends _BLAKE2<_BLAKE3> implements HashXOF<_BLAKE3> { - readonly canXOF = true; - private chunkPos = 0; // Position of current block in chunk - // How many chunks we already have; exact while this stays within - // JS's safe-integer range. - private chunksDone = 0; - private flags = 0 | 0; - private IV: Uint32Array; - private state: Uint32Array; - private stack: Uint32Array[] = []; - // Output - private posOut = 0; - private bufferOut32 = new Uint32Array(16); - private bufferOut: Uint8Array; - // Index of output chunk; exact while this stays within JS's - // safe-integer range. - private chunkOut = 0; - private enableXOF = true; - - constructor(opts: Blake3Opts = {}, flags = 0) { - super(64, opts.dkLen === undefined ? 32 : opts.dkLen); - const { key, context } = opts; - const hasContext = context !== undefined; - if (key !== undefined) { - if (hasContext) throw new Error('Only "key" or "context" can be specified at same time'); - abytes(key, 32, 'key'); - const k = copyBytes(key); - this.IV = u32(k); - swap32IfBE(this.IV); - this.flags = flags | B3_Flags.KEYED_HASH; - } else if (hasContext) { - abytes(context, undefined, 'context'); - const ctx = context; - const contextKey = new _BLAKE3({ dkLen: 32 }, B3_Flags.DERIVE_KEY_CONTEXT) - .update(ctx) - .digest(); - this.IV = u32(contextKey); - swap32IfBE(this.IV); - this.flags = flags | B3_Flags.DERIVE_KEY_MATERIAL; - } else { - this.IV = B3_IV.slice(); - this.flags = flags; - } - this.state = this.IV.slice(); - this.bufferOut = u8(this.bufferOut32); - } - // _BLAKE2's scalar-state hooks are unused here: BLAKE3 keeps its tree/XOF state in arrays and - // copies it directly in _cloneInto(). - protected get(): [] { - return []; - } - protected set(): void {} - // Truncated chunk/parent compression: seed v8..v15 as IV[0..3], t0, t1, - // block length, and flags, then keep only the first 8 output words. - private b2Compress(counter: number, flags: number, buf: Uint32Array, bufPos: number = 0) { - const { state: s, pos } = this; - const { h, l } = fromBig(BigInt(counter), true); - // prettier-ignore - const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = - compress( - B3_SIGMA, bufPos, buf, 7, - s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], - B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], h, l, pos, flags - ); - s[0] = v0 ^ v8; - s[1] = v1 ^ v9; - s[2] = v2 ^ v10; - s[3] = v3 ^ v11; - s[4] = v4 ^ v12; - s[5] = v5 ^ v13; - s[6] = v6 ^ v14; - s[7] = v7 ^ v15; - } - protected compress(buf: Uint32Array, bufPos: number = 0, isLast: boolean = false): void { - // Compress last block - let flags = this.flags; - if (!this.chunkPos) flags |= B3_Flags.CHUNK_START; - if (this.chunkPos === 15 || isLast) flags |= B3_Flags.CHUNK_END; - if (!isLast) this.pos = this.blockLen; - this.b2Compress(this.chunksDone, flags, buf, bufPos); - this.chunkPos += 1; - // If current block is last in chunk (16 blocks), then compress chunks - if (this.chunkPos === 16 || isLast) { - let chunk = this.state; - this.state = this.IV.slice(); - // If not the last one, compress only when there are trailing zeros in chunk counter - // Chunks are used as a binary tree where the current stack is the path. - // Zero means the current leaf is finished and can be compressed. - // 1 (001) - leaf not finished (just push current chunk to stack) - // 2 (010) - leaf finished at depth=1 (merge with last elm on stack and push back) - // 3 (011) - last leaf not finished - // 4 (100) - leafs finished at depth=1 and depth=2 - for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks >>= 1) { - if (!(last = this.stack.pop())) break; - this.buffer32.set(last, 0); - this.buffer32.set(chunk, 8); - this.pos = this.blockLen; - this.b2Compress(0, this.flags | B3_Flags.PARENT, this.buffer32, 0); - chunk = this.state; - this.state = this.IV.slice(); - } - this.chunksDone++; - this.chunkPos = 0; - this.stack.push(chunk); - } - this.pos = 0; - } - _cloneInto(to?: _BLAKE3): _BLAKE3 { - to = super._cloneInto(to) as _BLAKE3; - const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this; - to.state.set(state.slice()); - // Clone each CV stack entry by value so extending or destroying the clone - // cannot alias the source tree state. - to.stack = stack.map((i) => Uint32Array.from(i)); - to.IV.set(IV); - to.flags = flags; - to.chunkPos = chunkPos; - to.chunksDone = chunksDone; - to.posOut = posOut; - to.chunkOut = chunkOut; - to.enableXOF = this.enableXOF; - to.bufferOut32.set(this.bufferOut32); - return to; - } - destroy(): void { - this.destroyed = true; - clean(this.state, this.buffer32, this.IV, this.bufferOut32); - clean(...this.stack); - } - // Root/XOF compression: rerun the same ROOT inputs with incrementing output - // counter `t` and materialize all 16 output words. - // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8) - private b2CompressOut() { - const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this; - const { h, l } = fromBig(BigInt(this.chunkOut++)); - swap32IfBE(buffer32); - // prettier-ignore - const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = - compress( - B3_SIGMA, 0, buffer32, 7, - s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], - B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], l, h, pos, flags - ); - out32[0] = v0 ^ v8; - out32[1] = v1 ^ v9; - out32[2] = v2 ^ v10; - out32[3] = v3 ^ v11; - out32[4] = v4 ^ v12; - out32[5] = v5 ^ v13; - out32[6] = v6 ^ v14; - out32[7] = v7 ^ v15; - out32[8] = s[0] ^ v8; - out32[9] = s[1] ^ v9; - out32[10] = s[2] ^ v10; - out32[11] = s[3] ^ v11; - out32[12] = s[4] ^ v12; - out32[13] = s[5] ^ v13; - out32[14] = s[6] ^ v14; - out32[15] = s[7] ^ v15; - swap32IfBE(buffer32); - swap32IfBE(out32); - this.posOut = 0; - } - protected finish(): void { - if (this.finished) return; - this.finished = true; - // Padding - clean(this.buffer.subarray(this.pos)); - // Process last chunk - let flags = this.flags | B3_Flags.ROOT; - if (this.stack.length) { - // Finalize the current chunk first, then rerun the last parent - // compression as ROOT with t = 0 and b = 64. - flags |= B3_Flags.PARENT; - swap32IfBE(this.buffer32); - this.compress(this.buffer32, 0, true); - swap32IfBE(this.buffer32); - this.chunksDone = 0; - this.pos = this.blockLen; - } else { - flags |= (!this.chunkPos ? B3_Flags.CHUNK_START : 0) | B3_Flags.CHUNK_END; - } - this.flags = flags; - this.b2CompressOut(); - } - private writeInto(out: TArg): TRet { - aexists(this, false); - abytes(out); - this.finish(); - const { blockLen, bufferOut } = this; - for (let pos = 0, len = out.length; pos < len; ) { - if (this.posOut >= blockLen) this.b2CompressOut(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out as TRet; - } - xofInto(out: TArg): TRet { - if (!this.enableXOF) throw new Error('XOF is not possible after digest call'); - return this.writeInto(out); - } - xof(bytes: number): TRet { - anumber(bytes); - return this.xofInto(new Uint8Array(bytes)); - } - digestInto(out: TArg): void { - aoutput(out, this); - if (this.finished) throw new Error('digest() was already called'); - this.enableXOF = false; - // `aoutput(...)` allows oversized buffers; digestInto() must fill only the configured digest. - this.writeInto(out.subarray(0, this.outputLen)); - this.destroy(); - } - digest(): TRet { - const out = new Uint8Array(this.outputLen); - this.digestInto(out); - return out as TRet; - } -} - -/** - * BLAKE3 hash function. Can be used as MAC and KDF. - * @param msg - message that would be hashed - * @param opts - Optional output, MAC, or KDF configuration. `key` must be - * exactly 32 bytes, `context` is caller-encoded bytes, and `dkLen` can be - * 0..2^64-1 via the XOF-backed output path. See {@link Blake3Opts}. - * @returns Digest bytes. - * @example - * Hash, MAC, or derive key material with BLAKE3. - * ```ts - * import { blake3 } from '@noble/hashes/blake3.js'; - * import { utf8ToBytes } from '@noble/hashes/utils.js'; - * const data = new Uint8Array(32); - * const hash = blake3(data); - * const mac = blake3(data, { key: new Uint8Array(32) }); - * const kdf = blake3(data, { context: utf8ToBytes('application name') }); - * ``` - */ -export const blake3: TRet> = /* @__PURE__ */ createHasher( - (opts = {}) => new _BLAKE3(opts) -); diff --git a/node_modules/@noble/hashes/src/eskdf.ts b/node_modules/@noble/hashes/src/eskdf.ts deleted file mode 100644 index 08d50cd..0000000 --- a/node_modules/@noble/hashes/src/eskdf.ts +++ /dev/null @@ -1,259 +0,0 @@ -/** - * Experimental KDF for AES. - * @module - */ -import { hkdf } from './hkdf.ts'; -import { pbkdf2 as _pbkdf2 } from './pbkdf2.ts'; -import { scrypt as _scrypt } from './scrypt.ts'; -import { sha256 } from './sha2.ts'; -import { - abytes, - bytesToHex, - clean, - createView, - hexToBytes, - kdfInputToBytes, - type TArg, - type TRet, -} from './utils.ts'; - -// A tiny KDF for various applications like AES key-gen. -// Uses HKDF in a non-standard way, so it's not "KDF-secure", only "PRF-secure". -// Which is good enough: assume sha2-256 retained preimage resistance. - -// Fixed ESKDF scrypt work factor: interactive-latency target with about 512 MiB RAM per derivation. -const SCRYPT_FACTOR = /* @__PURE__ */ (() => 2 ** 19)(); -// Fixed ESKDF PBKDF2 work factor: CPU-only companion branch in the same rough -// interactive-latency range. -const PBKDF2_FACTOR = /* @__PURE__ */ (() => 2 ** 17)(); - -/** - * Scrypt KDF with the fixed ESKDF policy tuple `{ N: 2^19, r: 8, p: 1, dkLen: 32 }`. - * @param password - user password string, UTF-8 encoded before entering RFC 7914 - * @param salt - unique salt string, UTF-8 encoded before entering RFC 7914 - * @returns Derived 32-byte key. - * @example - * Derive the 32-byte scrypt key used by ESKDF. - * ```ts - * scrypt('password123', 'user@example.com'); - * ``` - */ -export function scrypt(password: string, salt: string): TRet { - return _scrypt(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 }); -} - -/** - * PBKDF2-HMAC-SHA256 with the fixed ESKDF policy tuple `{ sha256, c: 2^17, dkLen: 32 }`. - * @param password - user password string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256 - * @param salt - unique salt string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256 - * @returns Derived 32-byte key. - * @example - * Derive the 32-byte PBKDF2 key used by ESKDF. - * ```ts - * pbkdf2('password123', 'user@example.com'); - * ``` - */ -export function pbkdf2(password: string, salt: string): TRet { - return _pbkdf2(sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 }); -} - -// Combines two 32-byte byte arrays into a fresh 32-byte result without aliasing either input. -function xor32(a: TArg, b: TArg): TRet { - abytes(a, 32); - abytes(b, 32); - const arr = new Uint8Array(32); - for (let i = 0; i < 32; i++) { - arr[i] = a[i] ^ b[i]; - } - return arr as TRet; -} - -// All local string length checks are in JS UTF-16 code units, not UTF-8 bytes. -function strHasLength(str: string, min: number, max: number): boolean { - return typeof str === 'string' && str.length >= min && str.length <= max; -} - -/** - * Derives main seed. Takes a lot of time; prefer the higher-level `eskdf(...)` - * flow unless you specifically need the raw main seed. - * Derives the main seed by xor'ing two branches: - * the scrypt branch uses a `0x01` separator byte on username/password, - * and the PBKDF2 branch uses `0x02`. - * Username and password strings are encoded by the underlying KDFs after the - * local separator bytes are appended. - * @param username - account identifier used as public salt - * @param password - user password string - * @returns Main 32-byte seed for the account. - * @throws If the username or password length is invalid. {@link Error} - * @example - * Derive the main ESKDF seed from username and password. - * ```ts - * deriveMainSeed('example-user', 'example-password'); - * ``` - */ -export function deriveMainSeed(username: string, password: string): TRet { - if (!strHasLength(username, 8, 255)) throw new Error('invalid username'); - if (!strHasLength(password, 8, 255)) throw new Error('invalid password'); - // Keep the protocol separators as the literal bytes 0x01 / 0x02 even after minification. - // Embedding them as non-printable characters directly can be awkward across - // JS tooling and environments. - const codes = { _1: 1, _2: 2 }; - const sep = { s: String.fromCharCode(codes._1), p: String.fromCharCode(codes._2) }; - const scr = scrypt(password + sep.s, username + sep.s); - const pbk = pbkdf2(password + sep.p, username + sep.p); - const res = xor32(scr, pbk); - clean(scr, pbk); - return res; -} - -type AccountID = number | string; - -/** - * Converts protocol & accountId pair to HKDF params: - * `info` is UTF-8 protocol bytes, numeric ids become 4-byte BE `salt`, - * and string ids become UTF-8 `salt` bytes. - */ -function getSaltInfo(protocol: string, accountId: AccountID = 0) { - // Note that length here also repeats two lines below - // We do an additional length check here to reduce the scope of DoS attacks - if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) { - throw new Error('invalid protocol'); - } - - // Exact-match only: substring matches like `assh` / `mentor` must not widen the public whitelist. - const allowsStr = /^(password\d{0,3}|ssh|tor|file)$/.test(protocol); - let salt: Uint8Array; // Assigned below: either 4-byte BE account bytes or UTF-8 account bytes. - if (typeof accountId === 'string') { - if (!allowsStr) throw new Error('accountId must be a number'); - if (!strHasLength(accountId, 1, 255)) - throw new Error('accountId must be string of length 1..255'); - salt = kdfInputToBytes(accountId); - } else if (Number.isSafeInteger(accountId)) { - if (accountId < 0 || accountId > Math.pow(2, 32) - 1) throw new Error('invalid accountId'); - // Convert to Big Endian Uint32 - salt = new Uint8Array(4); - createView(salt).setUint32(0, accountId, false); - } else { - throw new Error('accountId must be a number' + (allowsStr ? ' or string' : '')); - } - const info = kdfInputToBytes(protocol); - return { salt, info }; -} - -type OptsLength = { keyLength: number }; -type OptsMod = { modulus: bigint }; -type KeyOpts = undefined | OptsLength | OptsMod; - -// Local modulus-size helper, not a general bigint-byte-length primitive: -// `<= 128n` is rejected by ESKDF policy. -function countBytes(num: bigint): number { - if (typeof num !== 'bigint' || num <= BigInt(128)) throw new Error('invalid number'); - return Math.ceil(num.toString(2).length / 8); -} - -/** - * Parses keyLength and modulus options to extract length of result key. - * If modulus is used, adds 64 bits to it per the FIPS 186-5 Appendix A.3.1 / - * A.4.1 extra-bits guidance. - */ -function getKeyLength(options: KeyOpts): number { - if (!options || typeof options !== 'object') return 32; - const hasLen = 'keyLength' in options; - const hasMod = 'modulus' in options; - if (hasLen && hasMod) throw new Error('cannot combine keyLength and modulus options'); - if (!hasLen && !hasMod) throw new Error('must have either keyLength or modulus option'); - // FIPS 186-5 Appendix A.3.1 / A.4.1 calls for at least 64 extra bits. - const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength; - if (!(typeof l === 'number' && l >= 16 && l <= 8192)) throw new Error('invalid keyLength'); - return l; -} - -/** - * Converts key to bigint and divides it by modulus. Big Endian. - * Adapts FIPS 186-5 Appendix A.4.1: `getKeyLength()` already requested the - * extra 64-bit margin, and this step maps the result into `1..modulus-1`. - */ -function modReduceKey(key: TArg, modulus: bigint): TRet { - const _1 = BigInt(1); - const num = BigInt('0x' + bytesToHex(key)); // check for ui8a, then bytesToNumber() - const res = (num % (modulus - _1)) + _1; // Remove 0 from output - if (res < _1) throw new Error('expected positive number'); // Guard against bad values - // Strip the extra 64-bit margin that `getKeyLength()` requested - // for bias reduction. - const len = key.length - 8; - const hex = res.toString(16).padStart(len * 2, '0'); // numberToHex() - const bytes = hexToBytes(hex); - if (bytes.length !== len) throw new Error('invalid length of result key'); - return bytes; -} - -/** Not using classes because constructor cannot be async. */ -export interface ESKDF { - /** - * Derives a child key. Child key will not be associated with any - * other child key because of properties of underlying KDF. - * - * @param protocol - 3-15 character protocol name - * @param accountId - numeric account identifier, or a string id for - * `password\d{0,3}`, `ssh`, `tor`, or `file` - * @param options - Optional child-key shaping parameters. See {@link KeyOpts}. - * @returns Derived child key bytes. - */ - deriveChildKey: (protocol: string, accountId: AccountID, options?: KeyOpts) => TRet; - /** Deletes the main seed from the ESKDF instance. */ - expire: () => void; - /** - * Human-readable fingerprint: first 6 bytes of - * `deriveChildKey('fingerprint', 0)`, formatted as uppercase - * colon-separated hex. - */ - fingerprint: string; -} - -/** - * ESKDF - * @param username - username, email, or identifier, min: 8 characters, should have enough entropy - * @param password - password, min: 8 characters, should have enough entropy - * @returns Frozen API that derives child keys and exposes the account fingerprint. - * @throws If the username or password length is invalid. {@link Error} - * @example - * Derive account-specific child keys from the main ESKDF seed. - * ```ts - * const kdf = await eskdf('example-university', 'beginning-new-example'); - * const key = kdf.deriveChildKey('aes', 0); - * const fingerprint = kdf.fingerprint; - * kdf.expire(); - * ``` - */ -export async function eskdf(username: string, password: string): Promise> { - // We are using closure + object instead of class because - // we want to make `seed` non-accessible for any external function. - let seed: Uint8Array | undefined = deriveMainSeed(username, password); - - function deriveCK( - protocol: string, - accountId: AccountID = 0, - options?: KeyOpts - ): TRet { - // Reject expired instances before deriving any HKDF inputs from the closure-held seed. - abytes(seed!, 32); - const { salt, info } = getSaltInfo(protocol, accountId); // validate protocol & accountId - // Validate option shape and coarse length bounds; - // `hkdf()` still rejects non-integer lengths. - const keyLength = getKeyLength(options); - const key = hkdf(sha256, seed!, salt, info, keyLength); - // Modulus has already been validated - return options && 'modulus' in options ? modReduceKey(key, options.modulus) : key; - } - function expire() { - // Overwrite the closure-held seed before dropping the reference. - if (seed) seed.fill(1); - seed = undefined; - } - // prettier-ignore - const fingerprint = Array.from(deriveCK('fingerprint', 0)) - .slice(0, 6) - .map((char) => char.toString(16).padStart(2, '0').toUpperCase()) - .join(':'); - return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint }); -} diff --git a/node_modules/@noble/hashes/src/hkdf.ts b/node_modules/@noble/hashes/src/hkdf.ts deleted file mode 100644 index 1adbc7e..0000000 --- a/node_modules/@noble/hashes/src/hkdf.ts +++ /dev/null @@ -1,133 +0,0 @@ -/** - * HKDF (RFC 5869): extract + expand in one step. - * See {@link https://soatok.blog/2021/11/17/understanding-hkdf/}. - * @module - */ -import { hmac } from './hmac.ts'; -import { abytes, ahash, anumber, type CHash, clean, type TArg, type TRet } from './utils.ts'; - -/** - * HKDF-extract from spec. Less important part. `HKDF-Extract(IKM, salt) -> PRK` - * Arguments position differs from spec (IKM is first one, since it is not optional) - * Local validation only checks `hash`; `ikm` / `salt` byte validation is delegated to `hmac()`. - * @param hash - hash function that would be used (e.g. sha256) - * @param ikm - input keying material, the initial key - * @param salt - optional salt value (a non-secret random value) - * @returns Pseudorandom key derived from input keying material. - * @example - * Run the HKDF extract step. - * ```ts - * import { extract } from '@noble/hashes/hkdf.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * extract(sha256, new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -export function extract( - hash: TArg, - ikm: TArg, - salt?: TArg -): TRet { - ahash(hash); - // NOTE: some libraries treat zero-length array as 'not provided'; - // we don't, since we have undefined as 'not provided' - // https://github.com/RustCrypto/KDFs/issues/15 - if (salt === undefined) salt = new Uint8Array(hash.outputLen); - return hmac(hash, salt, ikm); -} - -// Shared mutable scratch byte for the RFC 5869 block counter `N`. -// Safe to reuse because `expand()` is synchronous and resets it with `clean(...)` before returning. -const HKDF_COUNTER = /* @__PURE__ */ Uint8Array.of(0); -// Shared RFC 5869 empty string for both `info === undefined` and the first-block `T(0)` input. -const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of(); - -/** - * HKDF-expand from the spec. The most important part. `HKDF-Expand(PRK, info, L) -> OKM` - * @param hash - hash function that would be used (e.g. sha256) - * @param prk - a pseudorandom key of at least HashLen octets - * (usually, the output from the extract step) - * @param info - optional context and application specific information (can be a zero-length string) - * @param length - length of output keying material in bytes. - * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` returns an empty OKM. - * @returns Output keying material with the requested length. - * @throws If the requested output length exceeds the HKDF limit - * for the selected hash. {@link Error} - * @example - * Run the HKDF expand step. - * ```ts - * import { expand } from '@noble/hashes/hkdf.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * expand(sha256, new Uint8Array(32), new Uint8Array([1, 2, 3]), 16); - * ``` - */ -export function expand( - hash: TArg, - prk: TArg, - info?: TArg, - length: number = 32 -): TRet { - ahash(hash); - anumber(length, 'length'); - abytes(prk, undefined, 'prk'); - const olen = hash.outputLen; - // RFC 5869 §2.3: PRK is "a pseudorandom key of at least HashLen octets". - if (prk.length < olen) throw new Error('"prk" must be at least HashLen octets'); - // RFC 5869 §2.3 only bounds `L` by `<= 255*HashLen`; `L=0` is valid and yields empty OKM. - if (length > 255 * olen) throw new Error('Length must be <= 255*HashLen'); - const blocks = Math.ceil(length / olen); - if (info === undefined) info = EMPTY_BUFFER; - else abytes(info, undefined, 'info'); - // first L(ength) octets of T - const okm = new Uint8Array(blocks * olen); - // Re-use HMAC instance between blocks - const HMAC = hmac.create(hash, prk); - const HMACTmp = HMAC._cloneInto(); - const T = new Uint8Array(HMAC.outputLen); - for (let counter = 0; counter < blocks; counter++) { - HKDF_COUNTER[0] = counter + 1; - // T(0) = empty string (zero length) - // T(N) = HMAC-Hash(PRK, T(N-1) | info | N) - HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T) - .update(info) - .update(HKDF_COUNTER) - .digestInto(T); - okm.set(T, olen * counter); - HMAC._cloneInto(HMACTmp); - } - HMAC.destroy(); - HMACTmp.destroy(); - clean(T, HKDF_COUNTER); - return okm.slice(0, length) as TRet; -} - -/** - * HKDF (RFC 5869): derive keys from an initial input. - * Combines hkdf_extract + hkdf_expand in one step - * @param hash - hash function that would be used (e.g. sha256) - * @param ikm - input keying material, the initial key - * @param salt - optional salt value (a non-secret random value) - * @param info - optional context and application specific information bytes - * @param length - length of output keying material in bytes. - * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` returns an empty OKM. - * @returns Output keying material derived from the input key. - * @throws If the requested output length exceeds the HKDF limit - * for the selected hash. {@link Error} - * @example - * HKDF (RFC 5869): derive keys from an initial input. - * ```ts - * import { hkdf } from '@noble/hashes/hkdf.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * import { randomBytes, utf8ToBytes } from '@noble/hashes/utils.js'; - * const inputKey = randomBytes(32); - * const salt = randomBytes(32); - * const info = utf8ToBytes('application-key'); - * const okm = hkdf(sha256, inputKey, salt, info, 32); - * ``` - */ -export const hkdf = ( - hash: TArg, - ikm: TArg, - salt: TArg, - info: TArg, - length: number -): TRet => expand(hash, extract(hash, ikm, salt), info, length); diff --git a/node_modules/@noble/hashes/src/hmac.ts b/node_modules/@noble/hashes/src/hmac.ts deleted file mode 100644 index b914ebf..0000000 --- a/node_modules/@noble/hashes/src/hmac.ts +++ /dev/null @@ -1,126 +0,0 @@ -/** - * HMAC: RFC2104 message authentication code. - * @module - */ -import { - abytes, - aexists, - ahash, - aoutput, - clean, - type CHash, - type Hash, - type TArg, - type TRet, -} from './utils.ts'; - -/** - * Internal class for HMAC. - * Accepts any byte key, although RFC 2104 §3 recommends keys at least - * `HashLen` bytes long. - */ -export class _HMAC> implements Hash<_HMAC> { - oHash: T; - iHash: T; - blockLen: number; - outputLen: number; - canXOF = false; - private finished = false; - private destroyed = false; - - constructor(hash: TArg, key: TArg) { - ahash(hash); - abytes(key, undefined, 'key'); - this.iHash = hash.create() as T; - if (typeof this.iHash.update !== 'function') - throw new Error('Expected instance of class which extends utils.Hash'); - this.blockLen = this.iHash.blockLen; - this.outputLen = this.iHash.outputLen; - const blockLen = this.blockLen; - const pad = new Uint8Array(blockLen); - // blockLen can be bigger than outputLen - pad.set(key.length > blockLen ? hash.create().update(key).digest() : key); - for (let i = 0; i < pad.length; i++) pad[i] ^= 0x36; - this.iHash.update(pad); - // By doing update (processing of the first block) of the outer hash here, - // we can re-use it between multiple calls via clone. - this.oHash = hash.create() as T; - // Undo internal XOR && apply outer XOR - for (let i = 0; i < pad.length; i++) pad[i] ^= 0x36 ^ 0x5c; - this.oHash.update(pad); - clean(pad); - } - update(buf: TArg): this { - aexists(this); - this.iHash.update(buf); - return this; - } - digestInto(out: TArg): void { - aexists(this); - aoutput(out, this); - this.finished = true; - const buf = out.subarray(0, this.outputLen); - // Reuse the first outputLen bytes for the inner digest; the outer hash consumes them before - // overwriting that same prefix with the final tag, leaving any oversized tail untouched. - this.iHash.digestInto(buf); - this.oHash.update(buf); - this.oHash.digestInto(buf); - this.destroy(); - } - digest(): TRet { - const out = new Uint8Array(this.oHash.outputLen); - this.digestInto(out); - return out as TRet; - } - _cloneInto(to?: _HMAC): _HMAC { - // Create new instance without calling constructor since the key - // is already in state and we don't know it. - to ||= Object.create(Object.getPrototypeOf(this), {}); - const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; - to = to as this; - to.finished = finished; - to.destroyed = destroyed; - to.blockLen = blockLen; - to.outputLen = outputLen; - to.oHash = oHash._cloneInto(to.oHash); - to.iHash = iHash._cloneInto(to.iHash); - return to; - } - clone(): _HMAC { - return this._cloneInto(); - } - destroy(): void { - this.destroyed = true; - this.oHash.destroy(); - this.iHash.destroy(); - } -} - -/** - * HMAC: RFC2104 message authentication code. - * @param hash - function that would be used e.g. sha256 - * @param key - authentication key bytes - * @param message - message bytes to authenticate - * @returns Authentication tag bytes. - * @example - * Compute an RFC 2104 HMAC. - * ```ts - * import { hmac } from '@noble/hashes/hmac.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const mac = hmac(sha256, new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -type HmacFn = { - (hash: TArg, key: TArg, message: TArg): TRet; - create(hash: TArg, key: TArg): TRet<_HMAC>; -}; -export const hmac: TRet = /* @__PURE__ */ (() => { - const hmac_ = (( - hash: TArg, - key: TArg, - message: TArg - ): TRet => new _HMAC(hash, key).update(message).digest()) as TRet; - hmac_.create = (hash: TArg, key: TArg): TRet<_HMAC> => - new _HMAC(hash, key) as TRet<_HMAC>; - return hmac_; -})(); diff --git a/node_modules/@noble/hashes/src/index.ts b/node_modules/@noble/hashes/src/index.ts deleted file mode 100644 index c6a9c23..0000000 --- a/node_modules/@noble/hashes/src/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Audited & minimal JS implementation of hash functions, MACs, and KDFs. - * Check out individual modules. - * @module - * @example -```js -import { - sha256, sha384, sha512, sha224, sha512_224, sha512_256 -} from '@noble/hashes/sha2.js'; -import { - sha3_224, sha3_256, sha3_384, sha3_512, - keccak_224, keccak_256, keccak_384, keccak_512, - shake128, shake256 -} from '@noble/hashes/sha3.js'; -import { - cshake128, cshake256, - turboshake128, turboshake256, - kt128, kt256, - kmac128, kmac256, - tuplehash256, parallelhash256, - keccakprg -} from '@noble/hashes/sha3-addons.js'; -import { blake3 } from '@noble/hashes/blake3.js'; -import { blake2b, blake2s } from '@noble/hashes/blake2.js'; -import { hmac } from '@noble/hashes/hmac.js'; -import { hkdf } from '@noble/hashes/hkdf.js'; -import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js'; -import { scrypt, scryptAsync } from '@noble/hashes/scrypt.js'; -import { md5, ripemd160, sha1 } from '@noble/hashes/legacy.js'; -import * as utils from '@noble/hashes/utils.js'; -``` - */ -throw new Error('root module cannot be imported: import submodules instead. Check out README'); diff --git a/node_modules/@noble/hashes/src/legacy.ts b/node_modules/@noble/hashes/src/legacy.ts deleted file mode 100644 index 0e185fb..0000000 --- a/node_modules/@noble/hashes/src/legacy.ts +++ /dev/null @@ -1,339 +0,0 @@ -/** - -SHA1 (RFC 3174), MD5 (RFC 1321), and RIPEMD160 legacy, weak hash functions. -RFC 2286 only covers HMAC-RIPEMD160 wrapper material and test vectors, -not the base RIPEMD-160 compression spec. -Don't use them in a new protocol. What "weak" means: - -- Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160. -- No practical pre-image attacks (only theoretical, 2^123.4) -- HMAC seems kinda ok: https://www.rfc-editor.org/rfc/rfc6151 - * @module - */ -import { Chi, HashMD, Maj } from './_md.ts'; -import { type CHash, clean, createHasher, rotl, type TRet } from './utils.ts'; - -/** Initial SHA-1 state from RFC 3174 §6.1. */ -const SHA1_IV = /* @__PURE__ */ Uint32Array.from([ - 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0, -]); - -// Reusable 80-word SHA-1 message schedule buffer. -const SHA1_W = /* @__PURE__ */ new Uint32Array(80); - -/** Internal SHA1 legacy hash class. */ -export class _SHA1 extends HashMD<_SHA1> { - private A = SHA1_IV[0] | 0; - private B = SHA1_IV[1] | 0; - private C = SHA1_IV[2] | 0; - private D = SHA1_IV[3] | 0; - private E = SHA1_IV[4] | 0; - - constructor() { - super(64, 20, 8, false); - } - protected get(): [number, number, number, number, number] { - const { A, B, C, D, E } = this; - return [A, B, C, D, E]; - } - protected set(A: number, B: number, C: number, D: number, E: number): void { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - } - protected process(view: DataView, offset: number): void { - for (let i = 0; i < 16; i++, offset += 4) SHA1_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 80; i++) - SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1); - // Compression function main loop, 80 rounds - let { A, B, C, D, E } = this; - for (let i = 0; i < 80; i++) { - let F, K; - if (i < 20) { - F = Chi(B, C, D); - K = 0x5a827999; - } else if (i < 40) { - F = B ^ C ^ D; - K = 0x6ed9eba1; - } else if (i < 60) { - F = Maj(B, C, D); - K = 0x8f1bbcdc; - } else { - F = B ^ C ^ D; - K = 0xca62c1d6; - } - const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0; - E = D; - D = C; - C = rotl(B, 30); - B = A; - A = T; - } - // Add the compressed chunk to the current hash value - A = (A + this.A) | 0; - B = (B + this.B) | 0; - C = (C + this.C) | 0; - D = (D + this.D) | 0; - E = (E + this.E) | 0; - this.set(A, B, C, D, E); - } - protected roundClean(): void { - clean(SHA1_W); - } - destroy(): void { - // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves - // update()/digest() callable on reused instances. - this.destroyed = true; - this.set(0, 0, 0, 0, 0); - clean(this.buffer); - } -} - -/** - * SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA1. - * ```ts - * sha1(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha1: TRet = /* @__PURE__ */ createHasher(() => new _SHA1()); - -/** RFC 1321 `T[i]` uses `floor(2^32 * abs(sin(i)))`; this is the shared `2^32` scale factor. */ -const p32 = /* @__PURE__ */ Math.pow(2, 32); -/** RFC 1321 `T[1..64]` table. */ -const K = /* @__PURE__ */ Array.from({ length: 64 }, (_, i) => - Math.floor(p32 * Math.abs(Math.sin(i + 1))) -); - -/** MD5 initial state from RFC 1321, stored as 4 u32 words. */ -const MD5_IV = /* @__PURE__ */ SHA1_IV.slice(0, 4); - -// Reusable 16-word MD5 message block buffer. -const MD5_W = /* @__PURE__ */ new Uint32Array(16); -/** Internal MD5 legacy hash class. */ -export class _MD5 extends HashMD<_MD5> { - private A = MD5_IV[0] | 0; - private B = MD5_IV[1] | 0; - private C = MD5_IV[2] | 0; - private D = MD5_IV[3] | 0; - - constructor() { - super(64, 16, 8, true); - } - protected get(): [number, number, number, number] { - const { A, B, C, D } = this; - return [A, B, C, D]; - } - protected set(A: number, B: number, C: number, D: number): void { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - } - protected process(view: DataView, offset: number): void { - for (let i = 0; i < 16; i++, offset += 4) MD5_W[i] = view.getUint32(offset, true); - // Compression function main loop, 64 rounds - let { A, B, C, D } = this; - for (let i = 0; i < 64; i++) { - let F, g, s; - if (i < 16) { - F = Chi(B, C, D); - g = i; - s = [7, 12, 17, 22]; - } else if (i < 32) { - // RFC 1321 round 2 uses G(B,C,D) = (B & D) | (C & ~D), which is `Chi(D, B, C)`. - F = Chi(D, B, C); - g = (5 * i + 1) % 16; - s = [5, 9, 14, 20]; - } else if (i < 48) { - F = B ^ C ^ D; - g = (3 * i + 5) % 16; - s = [4, 11, 16, 23]; - } else { - F = C ^ (B | ~D); - g = (7 * i) % 16; - s = [6, 10, 15, 21]; - } - F = F + A + K[i] + MD5_W[g]; - A = D; - D = C; - C = B; - B = B + rotl(F, s[i % 4]); - } - // Add the compressed chunk to the current hash value - A = (A + this.A) | 0; - B = (B + this.B) | 0; - C = (C + this.C) | 0; - D = (D + this.D) | 0; - this.set(A, B, C, D); - } - protected roundClean(): void { - clean(MD5_W); - } - destroy(): void { - // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves - // update()/digest() callable on reused instances. - this.destroyed = true; - this.set(0, 0, 0, 0); - clean(this.buffer); - } -} - -/** - * MD5 (RFC 1321) legacy hash function. It was cryptographically broken. - * MD5 architecture is similar to SHA1, with some differences: - * - Reduced output length: 16 bytes (128 bit) instead of 20 - * - 64 rounds, instead of 80 - * - Little-endian: could be faster, but will require more code - * - Non-linear index selection: huge speed-up for unroll - * - Per round constants: more memory accesses, additional speed-up for unroll - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with MD5. - * ```ts - * md5(new Uint8Array([97, 98, 99])); - * ``` - */ -export const md5: TRet = /* @__PURE__ */ createHasher(() => new _MD5()); - -// RIPEMD-160 - -// Permutation repeatedly applied to derive the later RIPEMD-160 message-order tables. -const Rho160 = /* @__PURE__ */ Uint8Array.from([ - 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, -]); -const Id160 = /* @__PURE__ */ (() => Uint8Array.from(new Array(16).fill(0).map((_, i) => i)))(); -const Pi160 = /* @__PURE__ */ (() => Id160.map((i) => (9 * i + 5) % 16))(); -// Five left/right message-word orderings for the RIPEMD-160 dual-lane rounds. -const idxLR = /* @__PURE__ */ (() => { - const L = [Id160]; - const R = [Pi160]; - const res = [L, R]; - for (let i = 0; i < 4; i++) for (let j of res) j.push(j[i].map((k) => Rho160[k])); - return res; -})(); -const idxL = /* @__PURE__ */ (() => idxLR[0])(); -const idxR = /* @__PURE__ */ (() => idxLR[1])(); -// const [idxL, idxR] = idxLR; - -// Base per-group shift table before the left/right message-order permutations are applied. -const shifts160 = /* @__PURE__ */ [ - [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], - [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], - [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], - [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], - [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5], -].map((i) => Uint8Array.from(i)); -const shiftsL160 = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts160[i][j])); -const shiftsR160 = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts160[i][j])); -// Five left-lane additive constants for RIPEMD-160. -const Kl160 = /* @__PURE__ */ Uint32Array.from([ - 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e, -]); -// Five right-lane additive constants for RIPEMD-160. -const Kr160 = /* @__PURE__ */ Uint32Array.from([ - 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000, -]); -// Called `f()` in the spec; valid `group` values are 0..4, and out-of-range -// inputs currently fall through to the group-4 branch. -function ripemd_f(group: number, x: number, y: number, z: number): number { - if (group === 0) return x ^ y ^ z; - if (group === 1) return (x & y) | (~x & z); - if (group === 2) return (x | ~y) ^ z; - if (group === 3) return (x & z) | (y & ~z); - return x ^ (y | ~z); -} -// Reusable 16-word RIPEMD-160 message block buffer. -const BUF_160 = /* @__PURE__ */ new Uint32Array(16); -/** - * Internal RIPEMD-160 legacy hash class. - * RFC 2286 only adds HMAC-RIPEMD160 material, not the core hash specification. - */ -export class _RIPEMD160 extends HashMD<_RIPEMD160> { - private h0 = 0x67452301 | 0; - private h1 = 0xefcdab89 | 0; - private h2 = 0x98badcfe | 0; - private h3 = 0x10325476 | 0; - private h4 = 0xc3d2e1f0 | 0; - - constructor() { - super(64, 20, 8, true); - } - protected get(): [number, number, number, number, number] { - const { h0, h1, h2, h3, h4 } = this; - return [h0, h1, h2, h3, h4]; - } - protected set(h0: number, h1: number, h2: number, h3: number, h4: number): void { - this.h0 = h0 | 0; - this.h1 = h1 | 0; - this.h2 = h2 | 0; - this.h3 = h3 | 0; - this.h4 = h4 | 0; - } - protected process(view: DataView, offset: number): void { - for (let i = 0; i < 16; i++, offset += 4) BUF_160[i] = view.getUint32(offset, true); - // prettier-ignore - let al = this.h0 | 0, ar = al, - bl = this.h1 | 0, br = bl, - cl = this.h2 | 0, cr = cl, - dl = this.h3 | 0, dr = dl, - el = this.h4 | 0, er = el; - - // Instead of iterating 0 to 80, we split it into 5 groups - // And use the groups in constants, functions, etc. Much simpler - for (let group = 0; group < 5; group++) { - const rGroup = 4 - group; - const hbl = Kl160[group], hbr = Kr160[group]; // prettier-ignore - const rl = idxL[group], rr = idxR[group]; // prettier-ignore - const sl = shiftsL160[group], sr = shiftsR160[group]; // prettier-ignore - for (let i = 0; i < 16; i++) { - const tl = (rotl(al + ripemd_f(group, bl, cl, dl) + BUF_160[rl[i]] + hbl, sl[i]) + el) | 0; - al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore - } - // 2 loops are 10% faster - for (let i = 0; i < 16; i++) { - const tr = (rotl(ar + ripemd_f(rGroup, br, cr, dr) + BUF_160[rr[i]] + hbr, sr[i]) + er) | 0; - ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore - } - } - // Add the compressed chunk to the current hash value - // Final recombination cross-adds the left/right lane accumulators into the next h0..h4 order. - this.set( - (this.h1 + cl + dr) | 0, - (this.h2 + dl + er) | 0, - (this.h3 + el + ar) | 0, - (this.h4 + al + br) | 0, - (this.h0 + bl + cr) | 0 - ); - } - protected roundClean(): void { - clean(BUF_160); - } - destroy(): void { - this.destroyed = true; - clean(this.buffer); - this.set(0, 0, 0, 0, 0); - } -} - -/** - * RIPEMD-160 - a legacy hash function from 1990s. - * RFC 2286 only covers HMAC-RIPEMD160 test material; the links below point - * at the base RIPEMD-160 references. - * * {@link https://homes.esat.kuleuven.be/~bosselae/ripemd160.html} - * * {@link https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf} - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with RIPEMD-160. - * ```ts - * ripemd160(new Uint8Array([97, 98, 99])); - * ``` - */ -export const ripemd160: TRet = /* @__PURE__ */ createHasher(() => new _RIPEMD160()); diff --git a/node_modules/@noble/hashes/src/pbkdf2.ts b/node_modules/@noble/hashes/src/pbkdf2.ts deleted file mode 100644 index ea7cda6..0000000 --- a/node_modules/@noble/hashes/src/pbkdf2.ts +++ /dev/null @@ -1,175 +0,0 @@ -/** - * PBKDF (RFC 2898). Can be used to create a key from password and salt. - * @module - */ -import { hmac } from './hmac.ts'; -// prettier-ignore -import { - ahash, anumber, - asyncLoop, checkOpts, clean, createView, kdfInputToBytes, - type CHash, - type Hash, - type KDFInput, - type TArg, - type TRet -} from './utils.ts'; - -/** - * PBKDF2 options: - * * c: iterations, should probably be higher than 100_000 - * * dkLen: desired length of derived key in bytes, must be `>= 1` per RFC 8018 §5.2 - * * asyncTick: max time in ms for which async function can block execution - */ -export type Pbkdf2Opt = { - /** Iteration count. Higher values increase CPU cost. */ - c: number; - /** Desired derived key length in bytes, must be `>= 1` per RFC 8018 §5.2. */ - dkLen?: number; - /** Max scheduler block time in milliseconds for the async variant. */ - asyncTick?: number; -}; -// Common start and end for sync/async functions -function pbkdf2Init( - hash: TArg, - _password: TArg, - _salt: TArg, - _opts: TArg -) { - ahash(hash); - const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); - const { c, dkLen, asyncTick } = opts; - anumber(c, 'c'); - anumber(dkLen, 'dkLen'); - anumber(asyncTick, 'asyncTick'); - if (c < 1) throw new Error('iterations (c) must be >= 1'); - // RFC 8018 §5.2 defines `dkLen` as "a positive integer". - if (dkLen < 1) throw new Error('"dkLen" must be >= 1'); - // RFC 8018 §5.2 step 1 requires rejecting oversize `dkLen` - // before allocating the destination buffer. - if (dkLen > (2 ** 32 - 1) * hash.outputLen) throw new Error('derived key too long'); - const password = kdfInputToBytes(_password, 'password'); - const salt = kdfInputToBytes(_salt, 'salt'); - // DK = PBKDF2(PRF, Password, Salt, c, dkLen); - const DK = new Uint8Array(dkLen); - // U1 = PRF(Password, Salt + INT_32_BE(i)) - const PRF = hmac.create(hash, password); - // Cache PRF(P, S || ...) prefix state so each block only appends INT_32_BE(i). - const PRFSalt = PRF._cloneInto().update(salt); - return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; -} - -function pbkdf2Output>( - PRF: TArg>, - PRFSalt: TArg>, - DK: TArg, - prfW: TArg | undefined>, - u: TArg -): TRet { - // Shared sync/async cleanup point: wipe transient PRF state - // while preserving the derived key buffer. - PRF.destroy(); - PRFSalt.destroy(); - if (prfW) prfW.destroy(); - clean(u); - return DK as TRet; -} - -/** - * PBKDF2-HMAC: RFC 8018 key derivation function. - * @param hash - hash function that would be used e.g. sha256 - * @param password - password from which a derived key is generated; - * JS string inputs are UTF-8 encoded first - * @param salt - cryptographic salt; JS string inputs are UTF-8 encoded first - * @param opts - PBKDF2 work factor and output settings. `dkLen`, if provided, - * must be `>= 1` per RFC 8018 §5.2. See {@link Pbkdf2Opt}. - * @returns Derived key bytes. - * @throws If the PBKDF2 iteration count or derived-key settings are invalid. {@link Error} - * @example - * PBKDF2-HMAC: RFC 2898 key derivation function. - * ```ts - * import { pbkdf2 } from '@noble/hashes/pbkdf2.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const key = pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) }); - * ``` - */ -export function pbkdf2( - hash: TArg, - password: TArg, - salt: TArg, - opts: TArg -): TRet { - const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); - let prfW: any; // Working copy - const arr = new Uint8Array(4); - const view = createView(arr); - const u = new Uint8Array(PRF.outputLen); - // DK = T1 + T2 + ⋯ + Tdklen/hlen - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - // Ti = F(Password, Salt, c, i) - // The last Ti view can be shorter than hLen, which applies - // RFC 8018 §5.2 step 4's T_l<0..r-1> truncation without extra copies. - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc - // U1 = PRF(Password, Salt + INT_32_BE(i)) - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - for (let ui = 1; ui < c; ui++) { - // Uc = PRF(Password, Uc−1) - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i]; - } - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); -} - -/** - * PBKDF2-HMAC: RFC 8018 key derivation function. Async version. - * @param hash - hash function that would be used e.g. sha256 - * @param password - password from which a derived key is generated; - * JS string inputs are UTF-8 encoded first - * @param salt - cryptographic salt; JS string inputs are UTF-8 encoded first - * @param opts - PBKDF2 work factor and output settings. `dkLen`, if provided, - * must be `>= 1` per RFC 8018 §5.2. `asyncTick` is only a local - * scheduler-yield knob for this JS wrapper, not part of RFC 8018. - * See {@link Pbkdf2Opt}. - * @returns Promise resolving to derived key bytes. - * @throws If the PBKDF2 iteration count or derived-key settings are invalid. {@link Error} - * @example - * PBKDF2-HMAC: RFC 2898 key derivation function. - * ```ts - * import { pbkdf2Async } from '@noble/hashes/pbkdf2.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const key = await pbkdf2Async(sha256, 'password', 'salt', { dkLen: 32, c: 500_000 }); - * ``` - */ -export async function pbkdf2Async( - hash: TArg, - password: TArg, - salt: TArg, - opts: TArg -): Promise> { - const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts); - let prfW: any; // Working copy - const arr = new Uint8Array(4); - const view = createView(arr); - const u = new Uint8Array(PRF.outputLen); - // DK = T1 + T2 + ⋯ + Tdklen/hlen - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - // Ti = F(Password, Salt, c, i) - // The last Ti view can be shorter than hLen, which applies - // RFC 8018 §5.2 step 4's T_l<0..r-1> truncation without extra copies. - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc - // U1 = PRF(Password, Salt + INT_32_BE(i)) - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - await asyncLoop(c - 1, asyncTick, () => { - // Uc = PRF(Password, Uc−1) - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i]; - }); - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); -} diff --git a/node_modules/@noble/hashes/src/scrypt.ts b/node_modules/@noble/hashes/src/scrypt.ts deleted file mode 100644 index a68c890..0000000 --- a/node_modules/@noble/hashes/src/scrypt.ts +++ /dev/null @@ -1,315 +0,0 @@ -/** - * RFC 7914 Scrypt KDF. Can be used to create a key from password and salt. - * @module - */ -import { pbkdf2 } from './pbkdf2.ts'; -import { sha256 } from './sha2.ts'; -// prettier-ignore -import { - anumber, asyncLoop, - checkOpts, clean, - rotl, - swap32IfBE, - u32, - type KDFInput, - type TArg, - type TRet -} from './utils.ts'; - -// The main Scrypt loop: uses Salsa extensively. -// Six versions of the function were tried, this is the fastest one. -// RFC 7914 §3 / §4 step 2 applies Salsa20/8 to one 16-word (64-byte) block -// after xor'ing two such blocks. -// The local `y*` snapshot keeps the xor input stable even when `out` aliases `prev` or `input`. -// prettier-ignore -function XorAndSalsa( - prev: TArg, - pi: number, - input: TArg, - ii: number, - out: TArg, - oi: number -) { - // Based on https://cr.yp.to/salsa20.html and RFC 7914's Salsa20/8 core. - // Xor blocks - let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; - let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; - let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; - let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; - let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; - let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; - let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; - let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; - // Save state to temporary variables (salsa) - let x00 = y00, x01 = y01, x02 = y02, x03 = y03, - x04 = y04, x05 = y05, x06 = y06, x07 = y07, - x08 = y08, x09 = y09, x10 = y10, x11 = y11, - x12 = y12, x13 = y13, x14 = y14, x15 = y15; - // Main loop (salsa) - for (let i = 0; i < 8; i += 2) { - x04 ^= rotl(x00 + x12 | 0, 7); x08 ^= rotl(x04 + x00 | 0, 9); - x12 ^= rotl(x08 + x04 | 0, 13); x00 ^= rotl(x12 + x08 | 0, 18); - x09 ^= rotl(x05 + x01 | 0, 7); x13 ^= rotl(x09 + x05 | 0, 9); - x01 ^= rotl(x13 + x09 | 0, 13); x05 ^= rotl(x01 + x13 | 0, 18); - x14 ^= rotl(x10 + x06 | 0, 7); x02 ^= rotl(x14 + x10 | 0, 9); - x06 ^= rotl(x02 + x14 | 0, 13); x10 ^= rotl(x06 + x02 | 0, 18); - x03 ^= rotl(x15 + x11 | 0, 7); x07 ^= rotl(x03 + x15 | 0, 9); - x11 ^= rotl(x07 + x03 | 0, 13); x15 ^= rotl(x11 + x07 | 0, 18); - x01 ^= rotl(x00 + x03 | 0, 7); x02 ^= rotl(x01 + x00 | 0, 9); - x03 ^= rotl(x02 + x01 | 0, 13); x00 ^= rotl(x03 + x02 | 0, 18); - x06 ^= rotl(x05 + x04 | 0, 7); x07 ^= rotl(x06 + x05 | 0, 9); - x04 ^= rotl(x07 + x06 | 0, 13); x05 ^= rotl(x04 + x07 | 0, 18); - x11 ^= rotl(x10 + x09 | 0, 7); x08 ^= rotl(x11 + x10 | 0, 9); - x09 ^= rotl(x08 + x11 | 0, 13); x10 ^= rotl(x09 + x08 | 0, 18); - x12 ^= rotl(x15 + x14 | 0, 7); x13 ^= rotl(x12 + x15 | 0, 9); - x14 ^= rotl(x13 + x12 | 0, 13); x15 ^= rotl(x14 + x13 | 0, 18); - } - // Write output (salsa) - out[oi++] = (y00 + x00) | 0; out[oi++] = (y01 + x01) | 0; - out[oi++] = (y02 + x02) | 0; out[oi++] = (y03 + x03) | 0; - out[oi++] = (y04 + x04) | 0; out[oi++] = (y05 + x05) | 0; - out[oi++] = (y06 + x06) | 0; out[oi++] = (y07 + x07) | 0; - out[oi++] = (y08 + x08) | 0; out[oi++] = (y09 + x09) | 0; - out[oi++] = (y10 + x10) | 0; out[oi++] = (y11 + x11) | 0; - out[oi++] = (y12 + x12) | 0; out[oi++] = (y13 + x13) | 0; - out[oi++] = (y14 + x14) | 0; out[oi++] = (y15 + x15) | 0; -} - -function BlockMix( - input: TArg, - ii: number, - out: TArg, - oi: number, - r: number -) { - // The block B is `r` 128-byte chunks, i.e. `2r` 16-word (64-byte) Salsa blocks. - let head = oi + 0; - let tail = oi + 16 * r; - for (let i = 0; i < 16; i++) out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1] - for (let i = 0; i < r; i++, head += 16, ii += 16) { - // RFC 7914 §4 step 3 outputs `Y[0], Y[2], ...` first, then `Y[1], Y[3], ...`; - // `head` and `tail` lay out those even/odd halves in place. - XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1]) - if (i > 0) tail += 16; // First iteration overwrites tmp value in tail - // tail[i] = Salsa(blockIn[2*i+1] ^ head[i]) - XorAndSalsa(out, head, input, (ii += 16), out, tail); - } -} - -/** - * Scrypt options: - * - `N` is cpu/mem work factor (power of 2 e.g. `2**18`) - * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance - * - `p` is parallelization factor (1 is common) - * - `dkLen` is output key length in bytes e.g. 32, and must be `>= 1` per RFC 7914 §2. - * - `asyncTick` - (default: 10) max time in ms for which async function can block execution - * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt - * - `onProgress` - callback function that would be executed for progress report - */ -export type ScryptOpts = { - /** CPU and memory work factor. Must be a power of two. */ - N: number; - /** Block size parameter. */ - r: number; - /** Parallelization factor. */ - p: number; - /** Desired derived key length in bytes, must be `>= 1` per RFC 7914 §2. */ - dkLen?: number; - /** Max scheduler block time in milliseconds for the async variant. */ - asyncTick?: number; - /** Maximum temporary memory budget in bytes. */ - maxmem?: number; - /** - * Optional progress callback invoked during long-running derivations. - * param progress - completion fraction in the `0..1` range - */ - onProgress?: (progress: number) => void; -}; - -// Common prologue and epilogue for sync/async functions -function scryptInit(password: TArg, salt: TArg, _opts?: TArg) { - // Maxmem - 1GB+1KB by default - const opts = checkOpts( - { - dkLen: 32, - asyncTick: 10, - maxmem: 1024 ** 3 + 1024, - }, - _opts - ); - const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; - anumber(N, 'N'); - anumber(r, 'r'); - anumber(p, 'p'); - anumber(dkLen, 'dkLen'); - anumber(asyncTick, 'asyncTick'); - anumber(maxmem, 'maxmem'); - if (onProgress !== undefined && typeof onProgress !== 'function') - throw new Error('progressCb must be a function'); - const blockSize = 128 * r; - const blockSize32 = blockSize / 4; - - // Max N is 2^32 (Integrify is 32-bit). - // Real limit can be 2^22: some JS engines limit Uint8Array to 4GB. - // Spec check `N >= 2^(blockSize / 8)` is not done for compat with popular libs, - // which used incorrect r: 1, p: 8. Also, the check seems to be a spec error: - // https://www.rfc-editor.org/errata_search.php?rfc=7914 - const pow32 = Math.pow(2, 32); - if (N <= 1 || (N & (N - 1)) !== 0 || N > pow32) - throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32'); - if (p < 1 || p > ((pow32 - 1) * 32) / blockSize) - throw new Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)'); - // RFC 7914 §2 defines `dkLen` as a positive integer. - if (dkLen < 1 || dkLen > (pow32 - 1) * 32) - throw new Error('"dkLen" expected integer 1..(2^32 - 1) * 32'); - // Include the shared `tmp` scratch block so `maxmem` matches noble's actual temporary allocation. - // Node requires more headroom here, so this accounting is intentionally noble-specific. - const memUsed = blockSize * (N + p + 1); - if (memUsed > maxmem) - throw new Error( - '"maxmem" limit was hit: memUsed(128*r*(N+p+1))=' + memUsed + ', maxmem=' + maxmem - ); - // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor) - // Since it has only one iteration there is no reason to use async variant - const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p }); - const B32 = u32(B); - // Re-used between parallel iterations. Array(iterations) of B - const V = u32(new Uint8Array(blockSize * N)); - const tmp = u32(new Uint8Array(blockSize)); - let blockMixCb = () => {}; - if (onProgress) { - const totalBlockMix = 2 * N * p; - // Invoke callback if progress changes from 10.01 to 10.02 - // Allows to draw smooth progress bar on up to 8K screen - const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1); - let blockMixCnt = 0; - blockMixCb = () => { - blockMixCnt++; - if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) - onProgress(blockMixCnt / totalBlockMix); - }; - } - return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; -} - -function scryptOutput( - password: TArg, - dkLen: number, - B: TArg, - V: TArg, - tmp: TArg -): TRet { - // Shared final PBKDF2-and-cleanup step: keep the derived key, wipe the scrypt workspace. - const res = pbkdf2(sha256, password, B, { c: 1, dkLen }); - clean(B, V, tmp); - return res; -} - -/** - * Scrypt KDF from RFC 7914. See {@link ScryptOpts}. - * @param password - password or key material to derive from; - * JS string inputs are UTF-8 encoded first - * @param salt - unique salt bytes or string; JS string inputs are UTF-8 encoded first - * @param opts - Scrypt cost and memory parameters. `dkLen`, if provided, - * must be `>= 1` per RFC 7914 §2. See {@link ScryptOpts}. - * @returns Derived key bytes. - * @throws If the Scrypt cost, memory, or callback options are invalid. {@link Error} - * @example - * Derive a key with scrypt. - * ```ts - * scrypt('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 }); - * ``` - */ -export function scrypt( - password: TArg, - salt: TArg, - opts: TArg -): TRet { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit( - password, - salt, - opts - ); - swap32IfBE(B32); - for (let pi = 0; pi < p; pi++) { - const Pi = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) V[i] = B32[Pi + i]; // V[0] = B[i] - for (let i = 0, pos = 0; i < N - 1; i++) { - BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); - blockMixCb(); - } - BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element - blockMixCb(); - for (let i = 0; i < N; i++) { - // First u32 of the last 64-byte block (u32 is LE) - // RFC 7914 Integerify(X) uses the whole last 64-byte block, but mod N - // only depends on the low word here because N is a power of two and - // this implementation caps N at 2^32. - // & (N - 1) is % N as N is a power of 2, N & (N - 1) = 0 is checked - // above; >>> 0 for unsigned, input fits in u32. - const j = (B32[Pi + blockSize32 - 16] & (N - 1)) >>> 0; // j = Integrify(X) % iterations - // tmp = B ^ V[j] - for (let k = 0; k < blockSize32; k++) tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; - BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) - blockMixCb(); - } - } - swap32IfBE(B32); - return scryptOutput(password, dkLen, B, V, tmp); -} - -/** - * Scrypt KDF from RFC 7914. Async version. See {@link ScryptOpts}. - * @param password - password or key material to derive from; - * JS string inputs are UTF-8 encoded first - * @param salt - unique salt bytes or string; JS string inputs are UTF-8 encoded first - * @param opts - Scrypt cost and memory parameters. `dkLen`, if provided, - * must be `>= 1` per RFC 7914 §2. `asyncTick` is only a local - * scheduler-yield control for this JS wrapper, not part of RFC 7914. - * See {@link ScryptOpts}. - * @returns Promise resolving to derived key bytes. - * @throws If the Scrypt cost, memory, or callback options are invalid. {@link Error} - * @example - * Derive a key with scrypt asynchronously. - * ```ts - * await scryptAsync('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 }); - * ``` - */ -export async function scryptAsync( - password: TArg, - salt: TArg, - opts: TArg -): Promise> { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit( - password, - salt, - opts - ); - swap32IfBE(B32); - for (let pi = 0; pi < p; pi++) { - const Pi = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) V[i] = B32[Pi + i]; // V[0] = B[i] - let pos = 0; - await asyncLoop(N - 1, asyncTick, () => { - BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]); - blockMixCb(); - }); - BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element - blockMixCb(); - await asyncLoop(N, asyncTick, () => { - // First u32 of the last 64-byte block (u32 is LE) - // RFC 7914 Integerify(X) uses the whole last 64-byte block, but mod N - // only depends on the low word here because N is a power of two and - // this implementation caps N at 2^32. - // & (N - 1) is % N as N is a power of 2, N & (N - 1) = 0 is checked - // above; >>> 0 for unsigned, input fits in u32. - const j = (B32[Pi + blockSize32 - 16] & (N - 1)) >>> 0; // j = Integrify(X) % iterations - // tmp = B ^ V[j] - for (let k = 0; k < blockSize32; k++) tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; - BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j]) - blockMixCb(); - }); - } - swap32IfBE(B32); - return scryptOutput(password, dkLen, B, V, tmp); -} diff --git a/node_modules/@noble/hashes/src/sha2.ts b/node_modules/@noble/hashes/src/sha2.ts deleted file mode 100644 index 2ff7e65..0000000 --- a/node_modules/@noble/hashes/src/sha2.ts +++ /dev/null @@ -1,530 +0,0 @@ -/** - * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256. - * SHA256 is the fastest hash implementable in JS, even faster than Blake3. - * Check out {@link https://www.rfc-editor.org/rfc/rfc4634 | RFC 4634} and - * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf | FIPS 180-4}. - * @module - */ -import { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from './_md.ts'; -import * as u64 from './_u64.ts'; -import { type CHash, clean, createHasher, oidNist, rotr, type TRet } from './utils.ts'; - -/** - * SHA-224 / SHA-256 round constants from RFC 6234 §5.1: the first 32 bits - * of the cube roots of the first 64 primes (2..311). - */ -// prettier-ignore -const SHA256_K = /* @__PURE__ */ Uint32Array.from([ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -]); - -/** Reusable SHA-224 / SHA-256 message schedule buffer `W_t` from RFC 6234 §6.2 step 1. */ -const SHA256_W = /* @__PURE__ */ new Uint32Array(64); - -/** Internal SHA-224 / SHA-256 compression engine from RFC 6234 §6.2. */ -abstract class SHA2_32B> extends HashMD { - // We cannot use array here since array allows indexing by variable - // which means optimizer/compiler cannot use registers. - protected abstract A: number; - protected abstract B: number; - protected abstract C: number; - protected abstract D: number; - protected abstract E: number; - protected abstract F: number; - protected abstract G: number; - protected abstract H: number; - - constructor(outputLen: number) { - super(64, outputLen, 8, false); - } - protected get(): [number, number, number, number, number, number, number, number] { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - // prettier-ignore - protected set( - A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number - ): void { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - protected process(view: DataView, offset: number): void { - // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array - for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W[i - 15]; - const W2 = SHA256_W[i - 2]; - const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); - const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); - SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; - } - // Compression function main loop, 64 rounds - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); - const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); - const T2 = (sigma0 + Maj(A, B, C)) | 0; - H = G; - G = F; - F = E; - E = (D + T1) | 0; - D = C; - C = B; - B = A; - A = (T1 + T2) | 0; - } - // Add the compressed chunk to the current hash value - A = (A + this.A) | 0; - B = (B + this.B) | 0; - C = (C + this.C) | 0; - D = (D + this.D) | 0; - E = (E + this.E) | 0; - F = (F + this.F) | 0; - G = (G + this.G) | 0; - H = (H + this.H) | 0; - this.set(A, B, C, D, E, F, G, H); - } - protected roundClean(): void { - clean(SHA256_W); - } - destroy(): void { - // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves - // update()/digest() callable on reused instances. - this.destroyed = true; - this.set(0, 0, 0, 0, 0, 0, 0, 0); - clean(this.buffer); - } -} - -/** Internal SHA-256 hash class grounded in RFC 6234 §6.2. */ -export class _SHA256 extends SHA2_32B<_SHA256> { - // We cannot use array here since array allows indexing by variable - // which means optimizer/compiler cannot use registers. - protected A: number = SHA256_IV[0] | 0; - protected B: number = SHA256_IV[1] | 0; - protected C: number = SHA256_IV[2] | 0; - protected D: number = SHA256_IV[3] | 0; - protected E: number = SHA256_IV[4] | 0; - protected F: number = SHA256_IV[5] | 0; - protected G: number = SHA256_IV[6] | 0; - protected H: number = SHA256_IV[7] | 0; - constructor() { - super(32); - } -} - -/** Internal SHA-224 hash class grounded in RFC 6234 §6.2 and §8.5. */ -export class _SHA224 extends SHA2_32B<_SHA224> { - protected A: number = SHA224_IV[0] | 0; - protected B: number = SHA224_IV[1] | 0; - protected C: number = SHA224_IV[2] | 0; - protected D: number = SHA224_IV[3] | 0; - protected E: number = SHA224_IV[4] | 0; - protected F: number = SHA224_IV[5] | 0; - protected G: number = SHA224_IV[6] | 0; - protected H: number = SHA224_IV[7] | 0; - constructor() { - super(28); - } -} - -// SHA2-512 is slower than sha256 in js because u64 operations are slow. - -// SHA-384 / SHA-512 round constants from RFC 6234 §5.2: -// 80 full 64-bit words split into high/low halves. -// prettier-ignore -const K512 = /* @__PURE__ */ (() => u64.split([ - '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc', - '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118', - '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2', - '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694', - '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65', - '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5', - '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4', - '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70', - '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df', - '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b', - '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30', - '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8', - '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8', - '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3', - '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec', - '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b', - '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178', - '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b', - '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c', - '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817' -].map(n => BigInt(n))))(); -const SHA512_Kh = /* @__PURE__ */ (() => K512[0])(); -const SHA512_Kl = /* @__PURE__ */ (() => K512[1])(); - -// Reusable high-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words. -const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); -// Reusable low-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words. -const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); - -/** Internal SHA-384 / SHA-512 compression engine from RFC 6234 §6.4. */ -abstract class SHA2_64B> extends HashMD { - // We cannot use array here since array allows indexing by variable - // which means optimizer/compiler cannot use registers. - // h -- high 32 bits, l -- low 32 bits - protected abstract Ah: number; - protected abstract Al: number; - protected abstract Bh: number; - protected abstract Bl: number; - protected abstract Ch: number; - protected abstract Cl: number; - protected abstract Dh: number; - protected abstract Dl: number; - protected abstract Eh: number; - protected abstract El: number; - protected abstract Fh: number; - protected abstract Fl: number; - protected abstract Gh: number; - protected abstract Gl: number; - protected abstract Hh: number; - protected abstract Hl: number; - - constructor(outputLen: number) { - super(128, outputLen, 16, false); - } - // prettier-ignore - protected get(): [ - number, number, number, number, number, number, number, number, - number, number, number, number, number, number, number, number - ] { - const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; - } - // prettier-ignore - protected set( - Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number, - Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number - ): void { - this.Ah = Ah | 0; - this.Al = Al | 0; - this.Bh = Bh | 0; - this.Bl = Bl | 0; - this.Ch = Ch | 0; - this.Cl = Cl | 0; - this.Dh = Dh | 0; - this.Dl = Dl | 0; - this.Eh = Eh | 0; - this.El = El | 0; - this.Fh = Fh | 0; - this.Fl = Fl | 0; - this.Gh = Gh | 0; - this.Gl = Gl | 0; - this.Hh = Hh | 0; - this.Hl = Hl | 0; - } - protected process(view: DataView, offset: number): void { - // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array - for (let i = 0; i < 16; i++, offset += 4) { - SHA512_W_H[i] = view.getUint32(offset); - SHA512_W_L[i] = view.getUint32((offset += 4)); - } - for (let i = 16; i < 80; i++) { - // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) - const W15h = SHA512_W_H[i - 15] | 0; - const W15l = SHA512_W_L[i - 15] | 0; - const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7); - const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7); - // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) - const W2h = SHA512_W_H[i - 2] | 0; - const W2l = SHA512_W_L[i - 2] | 0; - const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6); - const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6); - // SHA512_W[i] = s0 + s1 + SHA512_W[i - 7] + SHA512_W[i - 16]; - const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); - const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); - SHA512_W_H[i] = SUMh | 0; - SHA512_W_L[i] = SUMl | 0; - } - let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - // Compression function main loop, 80 rounds - for (let i = 0; i < 80; i++) { - // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) - const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41); - const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41); - //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const CHIh = (Eh & Fh) ^ (~Eh & Gh); - const CHIl = (El & Fl) ^ (~El & Gl); - // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] - // prettier-ignore - const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); - const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); - const T1l = T1ll | 0; - // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) - const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39); - const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39); - const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); - const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); - Hh = Gh | 0; - Hl = Gl | 0; - Gh = Fh | 0; - Gl = Fl | 0; - Fh = Eh | 0; - Fl = El | 0; - ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); - Dh = Ch | 0; - Dl = Cl | 0; - Ch = Bh | 0; - Cl = Bl | 0; - Bh = Ah | 0; - Bl = Al | 0; - const All = u64.add3L(T1l, sigma0l, MAJl); - Ah = u64.add3H(All, T1h, sigma0h, MAJh); - Al = All | 0; - } - // Add the compressed chunk to the current hash value - ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); - ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); - ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); - ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); - ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); - ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); - ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); - ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); - this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); - } - protected roundClean(): void { - clean(SHA512_W_H, SHA512_W_L); - } - destroy(): void { - // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves - // update()/digest() callable on reused instances. - this.destroyed = true; - clean(this.buffer); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } -} - -/** Internal SHA-512 hash class grounded in RFC 6234 §6.3 and §6.4. */ -export class _SHA512 extends SHA2_64B<_SHA512> { - protected Ah: number = SHA512_IV[0] | 0; - protected Al: number = SHA512_IV[1] | 0; - protected Bh: number = SHA512_IV[2] | 0; - protected Bl: number = SHA512_IV[3] | 0; - protected Ch: number = SHA512_IV[4] | 0; - protected Cl: number = SHA512_IV[5] | 0; - protected Dh: number = SHA512_IV[6] | 0; - protected Dl: number = SHA512_IV[7] | 0; - protected Eh: number = SHA512_IV[8] | 0; - protected El: number = SHA512_IV[9] | 0; - protected Fh: number = SHA512_IV[10] | 0; - protected Fl: number = SHA512_IV[11] | 0; - protected Gh: number = SHA512_IV[12] | 0; - protected Gl: number = SHA512_IV[13] | 0; - protected Hh: number = SHA512_IV[14] | 0; - protected Hl: number = SHA512_IV[15] | 0; - - constructor() { - super(64); - } -} - -/** Internal SHA-384 hash class grounded in RFC 6234 §6.3 and §6.4. */ -export class _SHA384 extends SHA2_64B<_SHA384> { - protected Ah: number = SHA384_IV[0] | 0; - protected Al: number = SHA384_IV[1] | 0; - protected Bh: number = SHA384_IV[2] | 0; - protected Bl: number = SHA384_IV[3] | 0; - protected Ch: number = SHA384_IV[4] | 0; - protected Cl: number = SHA384_IV[5] | 0; - protected Dh: number = SHA384_IV[6] | 0; - protected Dl: number = SHA384_IV[7] | 0; - protected Eh: number = SHA384_IV[8] | 0; - protected El: number = SHA384_IV[9] | 0; - protected Fh: number = SHA384_IV[10] | 0; - protected Fl: number = SHA384_IV[11] | 0; - protected Gh: number = SHA384_IV[12] | 0; - protected Gl: number = SHA384_IV[13] | 0; - protected Hh: number = SHA384_IV[14] | 0; - protected Hl: number = SHA384_IV[15] | 0; - - constructor() { - super(48); - } -} - -/** - * Truncated SHA512/256 and SHA512/224. - * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as "intermediary" IV of SHA512/t. - * Then t hashes string to produce result IV. - * See the repo-side derivation recipe in `test/misc/sha2-gen-iv.js`. - * These IV literals are checked against that script rather than a dedicated - * local RFC section. - */ - -/** SHA-512/224 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and - * stored as sixteen big-endian 32-bit halves. */ -const T224_IV = /* @__PURE__ */ Uint32Array.from([ - 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf, - 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1, -]); - -/** SHA-512/256 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and - * stored as sixteen big-endian 32-bit halves. */ -const T256_IV = /* @__PURE__ */ Uint32Array.from([ - 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd, - 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2, -]); - -/** Internal SHA-512/224 hash class using the derived `T224_IV` and the shared - * RFC 6234 §6.4 compression engine. */ -export class _SHA512_224 extends SHA2_64B<_SHA512_224> { - protected Ah: number = T224_IV[0] | 0; - protected Al: number = T224_IV[1] | 0; - protected Bh: number = T224_IV[2] | 0; - protected Bl: number = T224_IV[3] | 0; - protected Ch: number = T224_IV[4] | 0; - protected Cl: number = T224_IV[5] | 0; - protected Dh: number = T224_IV[6] | 0; - protected Dl: number = T224_IV[7] | 0; - protected Eh: number = T224_IV[8] | 0; - protected El: number = T224_IV[9] | 0; - protected Fh: number = T224_IV[10] | 0; - protected Fl: number = T224_IV[11] | 0; - protected Gh: number = T224_IV[12] | 0; - protected Gl: number = T224_IV[13] | 0; - protected Hh: number = T224_IV[14] | 0; - protected Hl: number = T224_IV[15] | 0; - - constructor() { - super(28); - } -} - -/** Internal SHA-512/256 hash class using the derived `T256_IV` and the shared - * RFC 6234 §6.4 compression engine. */ -export class _SHA512_256 extends SHA2_64B<_SHA512_256> { - protected Ah: number = T256_IV[0] | 0; - protected Al: number = T256_IV[1] | 0; - protected Bh: number = T256_IV[2] | 0; - protected Bl: number = T256_IV[3] | 0; - protected Ch: number = T256_IV[4] | 0; - protected Cl: number = T256_IV[5] | 0; - protected Dh: number = T256_IV[6] | 0; - protected Dl: number = T256_IV[7] | 0; - protected Eh: number = T256_IV[8] | 0; - protected El: number = T256_IV[9] | 0; - protected Fh: number = T256_IV[10] | 0; - protected Fl: number = T256_IV[11] | 0; - protected Gh: number = T256_IV[12] | 0; - protected Gl: number = T256_IV[13] | 0; - protected Hh: number = T256_IV[14] | 0; - protected Hl: number = T256_IV[15] | 0; - - constructor() { - super(32); - } -} - -/** - * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info: - * - * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack. - * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025. - * - Each sha256 hash is executing 2^18 bit operations. - * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-256. - * ```ts - * sha256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha256: TRet> = /* @__PURE__ */ createHasher( - () => new _SHA256(), - /* @__PURE__ */ oidNist(0x01) -); -/** - * SHA2-224 hash function from RFC 4634. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-224. - * ```ts - * sha224(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha224: TRet> = /* @__PURE__ */ createHasher( - () => new _SHA224(), - /* @__PURE__ */ oidNist(0x04) -); - -/** - * SHA2-512 hash function from RFC 4634. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-512. - * ```ts - * sha512(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha512: TRet> = /* @__PURE__ */ createHasher( - () => new _SHA512(), - /* @__PURE__ */ oidNist(0x03) -); -/** - * SHA2-384 hash function from RFC 4634. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-384. - * ```ts - * sha384(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha384: TRet> = /* @__PURE__ */ createHasher( - () => new _SHA384(), - /* @__PURE__ */ oidNist(0x02) -); - -/** - * SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks. - * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-512/256. - * ```ts - * sha512_256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha512_256: TRet> = /* @__PURE__ */ createHasher( - () => new _SHA512_256(), - /* @__PURE__ */ oidNist(0x06) -); -/** - * SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks. - * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA2-512/224. - * ```ts - * sha512_224(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha512_224: TRet> = /* @__PURE__ */ createHasher( - () => new _SHA512_224(), - /* @__PURE__ */ oidNist(0x05) -); diff --git a/node_modules/@noble/hashes/src/sha3-addons.ts b/node_modules/@noble/hashes/src/sha3-addons.ts deleted file mode 100644 index a50a2ac..0000000 --- a/node_modules/@noble/hashes/src/sha3-addons.ts +++ /dev/null @@ -1,983 +0,0 @@ -/** - * SHA3 (keccak) addons. - * - * * cSHAKE, KMAC, TupleHash, ParallelHash + XOF variants from - * {@link https://csrc.nist.gov/pubs/sp/800/185/final | NIST SP 800-185} - * * KangarooTwelve 🦘 and TurboSHAKE - reduced-round keccak from - * {@link https://datatracker.ietf.org/doc/rfc9861/ | RFC 9861} - * * KeccakPRG: Pseudo-random generator based on Keccak - * ({@link https://keccak.team/files/CSF-0.1.pdf | pdf}) - * @module - */ -import { Keccak, type ShakeOpts } from './sha3.ts'; -import { - abytes, - aexists, - anumber, - type CHash, - type CHashXOF, - clean, - copyBytes, - createHasher, - type Hash, - type HashXOF, - type KDFInput, - kdfInputToBytes, - type PRG, - type TArg, - type TRet, - u32, -} from './utils.ts'; - -// cSHAKE && KMAC (NIST SP800-185) -const _8n = /* @__PURE__ */ BigInt(8); -const _ffn = /* @__PURE__ */ BigInt(0xff); - -// It is safe to use bigints here, since they used only for length encoding (not actual data). -// We use bigints in sha256 for lengths too. -// Callers are still expected to supply SP 800-185-valid lengths -// (`0 <= x < 2^2040`); this helper does not enforce that bound. -function leftEncode(n: number | bigint): TRet { - n = BigInt(n); - const res = [Number(n & _ffn)]; - n >>= _8n; - for (; n > 0; n >>= _8n) res.unshift(Number(n & _ffn)); - res.unshift(res.length); - return new Uint8Array(res) as TRet; -} - -// Same caller contract as `leftEncode(...)`: lengths must already satisfy SP 800-185 §2.3.1. -function rightEncode(n: number | bigint): TRet { - n = BigInt(n); - const res = [Number(n & _ffn)]; - n >>= _8n; - for (; n > 0; n >>= _8n) res.unshift(Number(n & _ffn)); - res.push(res.length); - return new Uint8Array(res) as TRet; -} - -// `dkLen` validation is deferred to the downstream Keccak constructor. -function chooseLen(opts: ShakeOpts, outputLen: number): number { - return opts.dkLen === undefined ? outputLen : opts.dkLen; -} - -const abytesOrZero = (buf?: TArg, title = '') => { - if (buf === undefined) return EMPTY_BUFFER; - abytes(buf, undefined, title); - return buf; -}; -// NOTE: second modulo is necessary since we don't need to add padding if the -// current element takes a whole block. -// Callers only pass the fixed positive Keccak rates here (`168` or `136`); -// `block <= 0` is not validated locally. -const getPadding = (len: number, block: number) => new Uint8Array((block - (len % block)) % block); -/** Options for cSHAKE and related SP 800-185 functions. */ -export type cShakeOpts = ShakeOpts & { - /** Optional personalization string mixed into domain separation. */ - personalization?: Uint8Array; - /** - * Optional NIST function-name string used for domain separation. - * SP 800-185 reserves this for standardized function names; applications - * should generally stick to `personalization`. - */ - NISTfn?: KDFInput; -}; - -// Personalization -function cshakePers(hash: TArg, opts: TArg = {}): TRet { - const h = hash as unknown as Keccak; - if (!opts || (opts.personalization === undefined && opts.NISTfn === undefined)) - return h as TRet; - // Encode and pad inplace to avoid unneccesary memory copies/slices so we - // don't need to zero them later. - // bytepad(encode_string(N) || encode_string(S), rate), where `rate` is the - // current cSHAKE/KMAC/TupleHash/ParallelHash block length. - const blockLenBytes = leftEncode(h.blockLen); - const fn = opts.NISTfn === undefined ? EMPTY_BUFFER : kdfInputToBytes(opts.NISTfn); - const fnLen = leftEncode(_8n * BigInt(fn.length)); // length in bits - const pers = abytesOrZero(opts.personalization, 'personalization'); - const persLen = leftEncode(_8n * BigInt(pers.length)); // length in bits - if (!fn.length && !pers.length) return h as TRet; - // SP 800-185 cSHAKE appends `00` instead of SHAKE's `1111`; in this Keccak implementation - // that changes the delimited suffix byte from `0x1f` to `0x04` once N or S is non-empty. - h.suffix = 0x04; - h.update(blockLenBytes).update(fnLen).update(fn).update(persLen).update(pers); - let totalLen = blockLenBytes.length + fnLen.length + fn.length + persLen.length + pers.length; - h.update(getPadding(totalLen, h.blockLen)); - return h as TRet; -} - -const gencShake = ( - suffix: number, - blockLen: number, - outputLen: number -): TRet> => - createHasher( - (opts: TArg = {}) => - cshakePers( - new Keccak(blockLen, suffix, chooseLen(opts, outputLen), true) as unknown as TArg, - opts - ) as Keccak - ); - -/** TupleHash callable interface. */ -export type ITupleHash = { - /** - * Hashes an ordered tuple of byte arrays. - * @param messages - Ordered byte-array tuple to hash. - * @param opts - TupleHash output and personalization options. See {@link cShakeOpts}. - * @returns Digest bytes. - */ - (messages: TArg, opts?: TArg): TRet; - /** - * Creates an incremental TupleHash state. - * @param opts - TupleHash output and personalization options. See {@link cShakeOpts}. - * @returns Stateful TupleHash instance. - */ - create(opts?: cShakeOpts): _TupleHash; -}; -/** - * 128-bit NIST cSHAKE XOF. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and NIST function-name - * settings. When both `NISTfn` and `personalization` are empty, - * SP 800-185 defines this as plain SHAKE128. Defaults to 16 output bytes - * when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with cSHAKE128. - * ```ts - * cshake128(new Uint8Array([1, 2, 3]), { dkLen: 32 }); - * ``` - */ -export const cshake128: TRet> = /* @__PURE__ */ gencShake( - 0x1f, - 168, - 16 -); -/** - * 256-bit NIST cSHAKE XOF. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and NIST function-name - * settings. When both `NISTfn` and `personalization` are empty, - * SP 800-185 defines this as plain SHAKE256. Defaults to 32 output bytes - * when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with cSHAKE256. - * ```ts - * cshake256(new Uint8Array([1, 2, 3]), { dkLen: 64 }); - * ``` - */ -export const cshake256: TRet> = /* @__PURE__ */ gencShake( - 0x1f, - 136, - 32 -); - -/** - * Internal KMAC class. - * SP 800-185 §8.4.1 still recommends keys at least as long as the target - * security strength. - */ -export class _KMAC extends Keccak implements HashXOF<_KMAC> { - constructor( - blockLen: number, - outputLen: number, - enableXOF: boolean, - key: TArg, - opts: TArg = {} - ) { - super(blockLen, 0x1f, outputLen, enableXOF); - // Preload T = bytepad(encode_string("KMAC") || encode_string(S), rate); later updates append - // newX = bytepad(encode_string(K), rate) || X and `finish()` appends right_encode(L or 0). - cshakePers(this as unknown as TArg, { - NISTfn: 'KMAC', - personalization: opts.personalization, - }); - abytes(key, undefined, 'key'); - // 1. newX = bytepad(encode_string(K), rate) || X || right_encode(L), - // with `rate = this.blockLen`. - const blockLenBytes = leftEncode(this.blockLen); - const keyLen = leftEncode(_8n * BigInt(key.length)); - this.update(blockLenBytes).update(keyLen).update(key); - const totalLen = blockLenBytes.length + keyLen.length + key.length; - this.update(getPadding(totalLen, this.blockLen)); - } - protected finish(): void { - // SP 800-185 uses right_encode(L) for fixed-length KMAC and right_encode(0) for KMACXOF. - // outputLen in bits - if (!this.finished) this.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); - super.finish(); - } - _cloneInto(to?: _KMAC): _KMAC { - // Create new instance without calling constructor since the key - // is already in state and we don't know it. - // Force "to" to be instance of KMAC instead of Sha3. - if (!to) { - to = Object.create(Object.getPrototypeOf(this), {}) as _KMAC; - to.state = this.state.slice(); - to.blockLen = this.blockLen; - to.state32 = u32(to.state); - } - return super._cloneInto(to) as _KMAC; - } - clone(): _KMAC { - return this._cloneInto(); - } -} - -function genKmac(blockLen: number, outputLen: number, xof = false): TRet { - // One-shot XOF wrappers still finalize via `.digest()` because `_KMAC` - // already bakes the requested output length into the state. - const kmac = ( - key: TArg, - message: TArg, - opts?: TArg - ): TRet => kmac.create(key, opts).update(message).digest(); - kmac.create = (key: TArg, opts: TArg = {}) => - new _KMAC(blockLen, chooseLen(opts, outputLen), xof, key, opts); - return kmac as TRet; -} - -/** KMAC callable interface. */ -export type IKMAC = { - /** - * Computes a keyed KMAC digest for one message. - * @param key - Secret key bytes. - * @param message - Message bytes to authenticate. - * @param opts - KMAC output and personalization options. See {@link KangarooOpts}. - * @returns Authentication tag bytes. - */ - (key: TArg, message: TArg, opts?: TArg): TRet; - /** - * Creates an incremental KMAC state. - * @param key - Secret key bytes. - * @param opts - KMAC output and personalization options. See {@link cShakeOpts}. - * @returns Stateful KMAC instance. - */ - create(key: TArg, opts?: TArg): _KMAC; -}; -/** - * 128-bit Keccak MAC. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC128. - * ```ts - * kmac128(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -export const kmac128: TRet = /* @__PURE__ */ genKmac(168, 16); -/** - * 256-bit Keccak MAC. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC256. - * ```ts - * kmac256(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -export const kmac256: TRet = /* @__PURE__ */ genKmac(136, 32); -/** - * 128-bit Keccak-MAC XOF. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC128 XOF output. - * ```ts - * kmac128xof(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]), { dkLen: 32 }); - * ``` - */ -export const kmac128xof: TRet = /* @__PURE__ */ genKmac(168, 16, true); -/** - * 256-bit Keccak-MAC XOF. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with KMAC256 XOF output. - * ```ts - * kmac256xof(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]), { dkLen: 64 }); - * ``` - */ -export const kmac256xof: TRet = /* @__PURE__ */ genKmac(136, 32, true); - -/** - * Internal TupleHash class for byte-array tuple elements. - * This implementation relies on SP 800-185's byte-oriented encoding form - * rather than arbitrary bit strings. - */ -export class _TupleHash extends Keccak implements HashXOF<_TupleHash> { - constructor( - blockLen: number, - outputLen: number, - enableXOF: boolean, - opts: TArg = {} - ) { - super(blockLen, 0x1f, outputLen, enableXOF); - cshakePers(this as unknown as TArg, { - NISTfn: 'TupleHash', - personalization: opts.personalization, - }); - // Change update after cshake processed - this.update = (data: TArg) => { - abytes(data); - // SP 800-185 encodes each tuple element as - // encode_string(X[i]) = left_encode(len(X[i])) || X[i]. - super.update(leftEncode(_8n * BigInt(data.length))); - super.update(data); - return this; - }; - } - protected finish(): void { - // SP 800-185 uses right_encode(L) for fixed-length TupleHash - // and right_encode(0) for TupleHashXOF. - if (!this.finished) - // outputLen in bits - super.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); - super.finish(); - } - _cloneInto(to?: _TupleHash): _TupleHash { - to ||= new _TupleHash(this.blockLen, this.outputLen, this.enableXOF); - return super._cloneInto(to) as _TupleHash; - } - clone(): _TupleHash { - return this._cloneInto(); - } -} - -function genTuple(blockLen: number, outputLen: number, xof = false): TRet { - // One-shot XOF wrappers still use `.digest()` because `_TupleHash` stores - // the requested output length in the state itself. - const tuple = (messages: TArg, opts?: TArg): TRet => { - const h = tuple.create(opts); - if (!Array.isArray(messages)) throw new Error('expected array of messages'); - for (const msg of messages) h.update(msg); - return h.digest(); - }; - tuple.create = (opts: TArg = {}) => - new _TupleHash(blockLen, chooseLen(opts, outputLen), xof, opts); - return tuple as TRet; -} - -/** - * 128-bit TupleHASH. `tuple(['ab', 'cd']) != tuple(['a', 'bcd'])`. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash128. - * ```ts - * tuplehash128([new Uint8Array([1]), new Uint8Array([2])]); - * ``` - */ -export const tuplehash128: TRet = /* @__PURE__ */ genTuple(168, 16); -/** - * 256-bit TupleHASH. `tuple(['ab', 'cd']) != tuple(['a', 'bcd'])`. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash256. - * ```ts - * tuplehash256([new Uint8Array([1]), new Uint8Array([2])]); - * ``` - */ -export const tuplehash256: TRet = /* @__PURE__ */ genTuple(136, 32); -/** - * 128-bit TupleHASH XOF. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash128 XOF output. - * ```ts - * tuplehash128xof([new Uint8Array([1]), new Uint8Array([2])], { dkLen: 32 }); - * ``` - */ -export const tuplehash128xof: TRet = /* @__PURE__ */ genTuple(168, 16, true); -/** - * 256-bit TupleHASH XOF. - * @param messages - ordered byte-array tuple - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a tuple of byte arrays with TupleHash256 XOF output. - * ```ts - * tuplehash256xof([new Uint8Array([1]), new Uint8Array([2])], { dkLen: 64 }); - * ``` - */ -export const tuplehash256xof: TRet = /* @__PURE__ */ genTuple(136, 32, true); - -// Same as K12/M14, but without speedup for inputs less 8kb, -// reduced number of rounds and simpler. -type ParallelOpts = KangarooOpts & { blockLen?: number }; - -/** Internal Parallel Keccak Hash class. */ -export class _ParallelHash extends Keccak implements HashXOF<_ParallelHash> { - private leafHash?: Hash; - protected leafCons: () => Hash; - private chunkPos = 0; // Position of current block in chunk - private chunksDone = 0; // How many chunks we already have - private chunkLen: number; - constructor( - blockLen: number, - outputLen: number, - leafCons: () => Hash, - enableXOF: boolean, - opts: TArg = {} - ) { - super(blockLen, 0x1f, outputLen, enableXOF); - cshakePers(this as unknown as TArg, { - NISTfn: 'ParallelHash', - personalization: opts.personalization, - }); - this.leafCons = leafCons; - let { blockLen: B = 8 } = opts; - anumber(B); - // blockLen=0 makes take=0 in update(), so pos never advances and the hash hangs. - if (B < 1) throw new Error('"blockLen" must be >= 1, got ' + B); - this.chunkLen = B; - // SP 800-185 initializes z = left_encode(B); each completed chunk appends - // one fixed-size cSHAKE leaf digest before finish() adds right_encode(n) - // and right_encode(L or 0). - super.update(leftEncode(B)); - // Change update after cshake processed - this.update = (data: TArg) => { - abytes(data); - const { chunkLen, leafCons } = this; - for (let pos = 0, len = data.length; pos < len; ) { - if (this.chunkPos == chunkLen || !this.leafHash) { - if (this.leafHash) { - super.update(this.leafHash.digest()); - this.chunksDone++; - } - this.leafHash = leafCons(); - this.chunkPos = 0; - } - const take = Math.min(chunkLen - this.chunkPos, len - pos); - this.leafHash.update(data.subarray(pos, pos + take)); - this.chunkPos += take; - pos += take; - } - return this; - }; - } - protected finish(): void { - if (this.finished) return; - if (this.leafHash) { - super.update(this.leafHash.digest()); - this.chunksDone++; - } - // SP 800-185 finishes ParallelHash as - // z || right_encode(n) || right_encode(L); XOF mode replaces - // right_encode(L) with right_encode(0). - super.update(rightEncode(this.chunksDone)); - // outputLen in bits - super.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); - super.finish(); - } - _cloneInto(to?: _ParallelHash): _ParallelHash { - to ||= new _ParallelHash(this.blockLen, this.outputLen, this.leafCons, this.enableXOF); - to.leafCons = this.leafCons; - // Reused destinations can carry a stale partial leaf - // when the source is still on the root sponge. - if (this.leafHash) to.leafHash = this.leafHash._cloneInto(to.leafHash as Keccak); - else if (to.leafHash) { - to.leafHash.destroy(); - to.leafHash = undefined; - } - to.chunkPos = this.chunkPos; - to.chunkLen = this.chunkLen; - to.chunksDone = this.chunksDone; - return super._cloneInto(to) as _ParallelHash; - } - destroy(): void { - super.destroy.call(this); - if (this.leafHash) this.leafHash.destroy(); - } - clone(): _ParallelHash { - return this._cloneInto(); - } -} - -function genPrl( - blockLen: number, - outputLen: number, - leaf: ReturnType, - xof = false -): TRet> { - const parallel = (message: TArg, opts?: TArg): TRet => - parallel.create(opts).update(message).digest(); - parallel.create = (opts: TArg = {}) => - new _ParallelHash( - blockLen, - chooseLen(opts, outputLen), - // SP 800-185 fixes leaf digests at 256 bits for ParallelHash128 and - // 512 bits for ParallelHash256; only the final cSHAKE output uses the - // caller-selected dkLen. - () => leaf.create({ dkLen: 2 * outputLen }), - xof, - opts - ); - parallel.outputLen = outputLen; - parallel.blockLen = blockLen; - parallel.canXOF = xof; - return parallel as TRet>; -} - -/** - * 128-bit ParallelHash. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 16 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash128. - * ```ts - * parallelhash128(new Uint8Array([1, 2, 3])); - * ``` - */ -export const parallelhash128: TRet> = /* @__PURE__ */ genPrl( - 168, - 16, - cshake128 -); -/** - * 256-bit ParallelHash. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 32 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash256. - * ```ts - * parallelhash256(new Uint8Array([1, 2, 3])); - * ``` - */ -export const parallelhash256: TRet> = /* @__PURE__ */ genPrl( - 136, - 32, - cshake256 -); -/** - * 128-bit ParallelHash XOF. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 16 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash128 XOF output. - * ```ts - * parallelhash128xof(new Uint8Array([1, 2, 3]), { dkLen: 32 }); - * ``` - */ -export const parallelhash128xof: TRet> = /* @__PURE__ */ genPrl( - 168, - 16, - cshake128, - true -); -/** - * 256-bit ParallelHash XOF. In JS, it is not parallel. - * @param msg - message bytes to hash - * @param opts - Optional output, personalization, and chunking settings. - * Defaults to 32 output bytes when `dkLen` is omitted. - * See {@link ParallelOpts}. - * @returns Digest bytes. - * @example - * Hash a message with ParallelHash256 XOF output. - * ```ts - * parallelhash256xof(new Uint8Array([1, 2, 3]), { dkLen: 64 }); - * ``` - */ -export const parallelhash256xof: TRet> = /* @__PURE__ */ genPrl( - 136, - 32, - cshake256, - true -); - -/** - * TurboSHAKE options. - * `D` is the domain separation byte; RFC 9861 defines output length `L` - * as a positive integer. - */ -export type TurboshakeOpts = ShakeOpts & { - /** Optional domain separation byte in the `0x01..0x7f` range. */ - D?: number; -}; - -const genTurbo = (blockLen: number, outputLen: number) => - createHasher((opts: TArg = {}) => { - const D = opts.D === undefined ? 0x1f : opts.D; - // RFC 9861 §2.1 fixes the default `D = 0x1f`; §2.2 defines the 12-round - // TurboSHAKE family selected here. - if (!Number.isSafeInteger(D) || D < 0x01 || D > 0x7f) - throw new Error('"D" (domain separation byte) must be 0x01..0x7f, got: ' + D); - const dkLen = opts.dkLen === undefined ? outputLen : opts.dkLen; - // RFC 9861 §§2.1-2.2 define output length L as a positive integer. - if (dkLen < 1) throw new Error('"dkLen" must be >= 1'); - return new Keccak(blockLen, D, dkLen, true, 12); - }); - -/** - * TurboSHAKE 128-bit: reduced 12-round keccak. - * Should've been a simple "shake with 12 rounds", but we got a whole new - * spec about Turbo SHAKE Pro MAX. - * @param msg - message bytes to hash - * @param opts - Optional output-length and domain-separation settings. - * RFC 9861 §2.1 defaults `D` to `0x1f`. Defaults to 32 output bytes when - * `dkLen` is omitted. See {@link TurboshakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with TurboSHAKE128. - * ```ts - * turboshake128(new Uint8Array([1, 2, 3]), { dkLen: 32 }); - * ``` - */ -export const turboshake128: TRet> = /* @__PURE__ */ genTurbo( - 168, - 32 -); -/** - * TurboSHAKE 256-bit: reduced 12-round keccak. - * @param msg - message bytes to hash - * @param opts - Optional output-length and domain-separation settings. - * RFC 9861 §2.1 defaults `D` to `0x1f`. Defaults to 64 output bytes when - * `dkLen` is omitted. See {@link TurboshakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with TurboSHAKE256. - * ```ts - * turboshake256(new Uint8Array([1, 2, 3]), { dkLen: 64 }); - * ``` - */ -export const turboshake256: TRet> = /* @__PURE__ */ genTurbo( - 136, - 64 -); - -// Same as NIST rightEncode, but returns `[0]` for the zero string. -// Callers still need to keep `x < 256^255` per RFC 9861 §3.3. -function rightEncodeK12(n: number | bigint): TRet { - n = BigInt(n); - const res: number[] = []; - for (; n > 0; n >>= _8n) res.unshift(Number(n & _ffn)); - res.push(res.length); - return Uint8Array.from(res); -} - -/** K12 options. */ -export type KangarooOpts = { - /** - * Desired digest length in bytes. - * RFC 9861 §3 defines output length `L` as a positive integer. - */ - dkLen?: number; - /** - * Optional personalization string mixed into the sponge state. - * Stateful K12 instances keep an internal copy so caller buffers can be - * wiped independently. - */ - personalization?: Uint8Array; -}; -const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of(); - -/** Internal K12 hash class. */ -export class _KangarooTwelve extends Keccak implements HashXOF<_KangarooTwelve> { - readonly chunkLen = 8192; - private leafHash?: Keccak; - protected leafLen: number; - private personalization: Uint8Array; - private chunkPos = 0; // Position of current block in chunk - private chunksDone = 0; // How many chunks we already have - constructor( - blockLen: number, - leafLen: number, - outputLen: number, - rounds: number, - opts: TArg - ) { - super(blockLen, 0x07, outputLen, true, rounds); - // RFC 9861 §3 defines output length L as a positive integer. - if (outputLen < 1) throw new Error('"dkLen" must be >= 1'); - this.leafLen = leafLen; - this.personalization = - opts.personalization === undefined - ? EMPTY_BUFFER - : copyBytes(abytes(opts.personalization, undefined, 'personalization')); - } - update(data: TArg): this { - abytes(data); - const { chunkLen, blockLen, leafLen, rounds } = this; - for (let pos = 0, len = data.length; pos < len; ) { - if (this.chunkPos == chunkLen) { - if (this.leafHash) super.update(this.leafHash.digest()); - else { - // RFC 9861 §3.2 switches from SingleNode (`07`) to FinalNode (`06`) - // once S exceeds 8192 bytes and prefixes S_0 with - // `03 00 00 00 00 00 00 00`. - this.suffix = 0x06; // Its safe to change suffix here since its used only in digest() - super.update(Uint8Array.from([3, 0, 0, 0, 0, 0, 0, 0])); - } - // Secondary chunks S_1..S_(n-1) become fixed-length - // CV_i = TurboSHAKE*(S_i, `0B`, 32|64) chaining values. - this.leafHash = new Keccak(blockLen, 0x0b, leafLen, false, rounds); - this.chunksDone++; - this.chunkPos = 0; - } - const take = Math.min(chunkLen - this.chunkPos, len - pos); - const chunk = data.subarray(pos, pos + take); - if (this.leafHash) this.leafHash.update(chunk); - else super.update(chunk); - this.chunkPos += take; - pos += take; - } - return this; - } - protected finish(): void { - if (this.finished) return; - const { personalization } = this; - // RFC 9861 §3.2 forms S = M || C || length_encode(|C|) before any tree hashing logic. - this.update(personalization).update(rightEncodeK12(personalization.length)); - // Leaf hash - if (this.leafHash) { - // Multi-chunk K12 appends - // CV_1..CV_(n-1) || length_encode(n-1) || `FF FF` - // before the final TurboSHAKE call. - super.update(this.leafHash.digest()); - super.update(rightEncodeK12(this.chunksDone)); - super.update(Uint8Array.from([0xff, 0xff])); - } - super.finish.call(this); - } - destroy(): void { - super.destroy.call(this); - if (this.leafHash) this.leafHash.destroy(); - // Personalization is copied on create/clone, so destroy can wipe it - // without touching caller input. - if (this.personalization !== EMPTY_BUFFER) clean(this.personalization); - this.personalization = EMPTY_BUFFER; - } - _cloneInto(to?: _KangarooTwelve): _KangarooTwelve { - const { blockLen, leafLen, leafHash, outputLen, rounds } = this; - const personalization = - this.personalization === EMPTY_BUFFER ? EMPTY_BUFFER : copyBytes(this.personalization); - // Personalization is absorbed only during finish(), so clones need the same pending value. - to ||= new _KangarooTwelve(blockLen, leafLen, outputLen, rounds, { - personalization, - }); - super._cloneInto(to); - // Reused destinations can carry a stale leaf from an older multi-chunk state. - if (leafHash) to.leafHash = leafHash._cloneInto(to.leafHash); - else if (to.leafHash) { - to.leafHash.destroy(); - to.leafHash = undefined; - } - // Snapshot the pending personalization so clone state does not alias caller-owned input. - to.personalization = personalization; - to.leafLen = this.leafLen; - to.chunkPos = this.chunkPos; - to.chunksDone = this.chunksDone; - return to; - } - clone(): _KangarooTwelve { - return this._cloneInto(); - } -} - -/** - * 128-bit KangarooTwelve (k12): reduced 12-round keccak. - * @param msg - message bytes to hash - * @param opts - Optional output and personalization settings. Defaults to - * 32 output bytes when `dkLen` is omitted. See {@link KangarooOpts}. - * @returns Digest bytes. - * @example - * Hash a message with KangarooTwelve-128. - * ```ts - * kt128(new Uint8Array([1, 2, 3])); - * ``` - */ -export const kt128: TRet> = /* @__PURE__ */ createHasher( - (opts: TArg = {}) => new _KangarooTwelve(168, 32, chooseLen(opts, 32), 12, opts) -); -/** - * 256-bit KangarooTwelve (k12): reduced 12-round keccak. - * @param msg - message bytes to hash - * @param opts - Optional output and personalization settings. Defaults to - * 64 output bytes when `dkLen` is omitted. See {@link KangarooOpts}. - * @returns Digest bytes. - * @example - * Hash a message with KangarooTwelve-256. - * ```ts - * kt256(new Uint8Array([1, 2, 3])); - * ``` - */ -export const kt256: TRet> = /* @__PURE__ */ createHasher( - (opts: TArg = {}) => new _KangarooTwelve(136, 64, chooseLen(opts, 64), 12, opts) -); - -// MarsupilamiFourteen (14-rounds) can be defined as: -// `new KangarooTwelve(136, 64, chooseLen(opts, 64), 14, opts)` - -/** KangarooTwelve-based MAC function type. */ -export type HopMAC = ( - key: TArg, - message: TArg, - personalization: TArg, - dkLen?: number -) => TRet; -const genHopMAC = - (hash: TArg>): TRet => - ( - key: TArg, - message: TArg, - personalization: TArg, - dkLen?: number - ) => { - const h = hash as unknown as CHash<_KangarooTwelve, KangarooOpts>; - return h(key, { personalization: h(message, { personalization }), dkLen }) as TRet; - }; - -/** - * 128-bit KangarooTwelve-based MAC. - * - * These untested (there is no test vectors or implementation available). Use at your own risk. - * HopMAC128(Key, M, C, L) = KT128(Key, KT128(M, C, 32), L) - * HopMAC256(Key, M, C, L) = KT256(Key, KT256(M, C, 64), L) - * The inner KangarooTwelve call always uses a fixed 32-byte digest here, - * regardless of the outer `dkLen`. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param personalization - personalization bytes mixed into the inner hash - * @param dkLen - optional output length in bytes - * @returns Authentication tag bytes. - * @example - * Authenticate a message with HopMAC128. - * ```ts - * HopMAC128(new Uint8Array([1]), new Uint8Array([2]), new Uint8Array([3]), 32); - * ``` - */ -export const HopMAC128: TRet = /* @__PURE__ */ genHopMAC(kt128); -/** - * 256-bit KangarooTwelve-based MAC. - * Like `HopMAC128`, there are no test vectors or known independent - * implementations available for cross-checking. - * @param key - MAC key bytes - * @param message - message bytes to authenticate - * @param personalization - personalization bytes mixed into the inner hash - * @param dkLen - optional output length in bytes. The inner KangarooTwelve - * call still uses a fixed 64-byte digest here, regardless of the outer - * `dkLen`. - * @returns Authentication tag bytes. - * @example - * Authenticate a message with HopMAC256. - * ```ts - * HopMAC256(new Uint8Array([1]), new Uint8Array([2]), new Uint8Array([3]), 64); - * ``` - */ -export const HopMAC256: TRet = /* @__PURE__ */ genHopMAC(kt256); - -/** - * More at - * {@link https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG}. - * Accepted capacities must keep `rho = 1598 - capacity` byte-aligned, and - * `.clean()` later also requires `rate > 801`. - */ -export class _KeccakPRG extends Keccak implements PRG { - protected rate: number; - constructor(capacity: number) { - anumber(capacity); - const rate = 1600 - capacity; - const rho = rate - 2; - // Rho must be full bytes - if (capacity < 0 || capacity > 1600 - 10 || rho % 8) throw new Error('invalid capacity'); - // blockLen = rho in bytes - super(rho / 8, 0, 0, true); - this.rate = rate; - this.posOut = Math.floor((rate + 7) / 8); - } - protected keccak(): void { - // Duplex padding - this.state[this.pos] ^= 0x01; - this.state[this.blockLen] ^= 0x02; // Rho is full bytes - super.keccak(); - this.pos = 0; - this.posOut = 0; - } - update(data: TArg): this { - super.update(data); - this.posOut = this.blockLen; - return this; - } - protected finish(): void {} - digestInto(_out: TArg): void { - throw new Error('digest is not allowed, use .randomBytes() instead'); - } - addEntropy(seed: TArg): void { - this.update(seed); - } - randomBytes(length: number): TRet { - return this.xof(length); - } - clean(): void { - // clean() mutates live sponge state just like randomBytes(), - // so destroyed instances must reject it. - aexists(this, false); - if (this.rate < 1600 / 2 + 1) throw new Error('rate is too low to use .forget()'); - this.keccak(); - for (let i = 0; i < this.blockLen; i++) this.state[i] = 0; - this.pos = this.blockLen; - this.keccak(); - this.posOut = this.blockLen; - } - _cloneInto(to?: _KeccakPRG): _KeccakPRG { - const { rate } = this; - to ||= new _KeccakPRG(1600 - rate); - super._cloneInto(to); - to.rate = rate; - return to; - } - clone(): _KeccakPRG { - return this._cloneInto(); - } -} - -/** - * KeccakPRG: pseudo-random generator based on Keccak. - * See {@link https://keccak.team/files/CSF-0.1.pdf}. - * @param capacity - sponge capacity in bits. Accepted values are those that - * keep `rho = 1598 - capacity` byte-aligned; the default `254` is chosen - * because it satisfies that duplex layout while leaving a wide byte-aligned - * rate. - * @returns PRG instance backed by a Keccak sponge. - * @example - * Create a Keccak-based pseudorandom generator and read bytes from it. - * ```ts - * const prg = keccakprg(254); - * prg.randomBytes(8); - * ``` - */ -export const keccakprg = (capacity = 254): TRet<_KeccakPRG> => - new _KeccakPRG(capacity) as TRet<_KeccakPRG>; diff --git a/node_modules/@noble/hashes/src/sha3.ts b/node_modules/@noble/hashes/src/sha3.ts deleted file mode 100644 index c81af06..0000000 --- a/node_modules/@noble/hashes/src/sha3.ts +++ /dev/null @@ -1,485 +0,0 @@ -/** - * SHA3 (keccak) hash function, based on a new "Sponge function" design. - * Different from older hashes, the internal state is bigger than output size. - * - * Check out - * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf | FIPS-202}, - * {@link https://keccak.team/keccak.html | Website}, and - * {@link https://crypto.stackexchange.com/q/15727 | the differences between - * SHA-3 and Keccak}. - * - * Check out `sha3-addons` module for cSHAKE, k12, and others. - * @module - */ -import { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.ts'; -// prettier-ignore -import { - abytes, aexists, anumber, aoutput, - clean, createHasher, - oidNist, - swap32IfBE, - u32, - type CHash, type CHashXOF, - type Hash, - type HashInfo, - type HashXOF, - type TArg, - type TRet -} from './utils.ts'; - -// No __PURE__ annotations in sha3 header: -// EVERYTHING is in fact used on every export. -// Various per round constants calculations -const _0n = BigInt(0); -const _1n = BigInt(1); -const _2n = BigInt(2); -const _7n = BigInt(7); -const _256n = BigInt(256); -// FIPS 202 Algorithm 5 rc(): when the outgoing bit is 1, the 8-bit LFSR xors -// taps 0, 4, 5, and 6, which compresses to the feedback mask `0x71`. -const _0x71n = BigInt(0x71); -const SHA3_PI: number[] = []; -const SHA3_ROTL: number[] = []; -const _SHA3_IOTA: bigint[] = []; // no pure annotation: var is always used -for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { - // Pi - [x, y] = [y, (2 * x + 3 * y) % 5]; - SHA3_PI.push(2 * (5 * y + x)); - // Rotational - SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); - // Iota - let t = _0n; - for (let j = 0; j < 7; j++) { - R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; - if (R & _2n) t ^= _1n << ((_1n << BigInt(j)) - _1n); - } - _SHA3_IOTA.push(t); -} -const IOTAS = split(_SHA3_IOTA, true); -// `split(..., true)` keeps the local little-endian lane-word layout used by -// `state32`, so these `H` / `L` tables follow the file's first-word / -// second-word lane slots rather than `_u64.ts`'s usual high/low naming. -const SHA3_IOTA_H = IOTAS[0]; -const SHA3_IOTA_L = IOTAS[1]; - -// Left rotation (without 0, 32, 64) -const rotlH = (h: number, l: number, s: number) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s)); -const rotlL = (h: number, l: number, s: number) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s)); - -/** - * `keccakf1600` internal permutation, additionally allows adjusting the round count. - * @param s - 5x5 Keccak state encoded as 25 lanes split into 50 uint32 words - * in this file's local little-endian lane-word order - * @param rounds - number of rounds to execute - * @throws If `rounds` is outside the supported `1..24` range. {@link Error} - * @example - * Permute a Keccak state with the default 24 rounds. - * ```ts - * keccakP(new Uint32Array(50)); - * ``` - */ -export function keccakP(s: TArg, rounds: number = 24): void { - anumber(rounds, 'rounds'); - // This implementation precomputes only the standard Keccak-f[1600] 24-round Iota table. - if (rounds < 1 || rounds > 24) throw new Error('"rounds" expected integer 1..24'); - const B = new Uint32Array(5 * 2); - // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) - for (let round = 24 - rounds; round < 24; round++) { - // Theta θ - for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; - for (let x = 0; x < 10; x += 2) { - const idx1 = (x + 8) % 10; - const idx0 = (x + 2) % 10; - const B0 = B[idx0]; - const B1 = B[idx0 + 1]; - const Th = rotlH(B0, B1, 1) ^ B[idx1]; - const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; - for (let y = 0; y < 50; y += 10) { - s[x + y] ^= Th; - s[x + y + 1] ^= Tl; - } - } - // Rho (ρ) and Pi (π) - let curH = s[2]; - let curL = s[3]; - for (let t = 0; t < 24; t++) { - const shift = SHA3_ROTL[t]; - const Th = rotlH(curH, curL, shift); - const Tl = rotlL(curH, curL, shift); - const PI = SHA3_PI[t]; - curH = s[PI]; - curL = s[PI + 1]; - s[PI] = Th; - s[PI + 1] = Tl; - } - // Chi (χ) - // Same as: - // for (let x = 0; x < 10; x++) B[x] = s[y + x]; - // for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; - for (let y = 0; y < 50; y += 10) { - const b0 = s[y], - b1 = s[y + 1], - b2 = s[y + 2], - b3 = s[y + 3]; - s[y] ^= ~s[y + 2] & s[y + 4]; - s[y + 1] ^= ~s[y + 3] & s[y + 5]; - s[y + 2] ^= ~s[y + 4] & s[y + 6]; - s[y + 3] ^= ~s[y + 5] & s[y + 7]; - s[y + 4] ^= ~s[y + 6] & s[y + 8]; - s[y + 5] ^= ~s[y + 7] & s[y + 9]; - s[y + 6] ^= ~s[y + 8] & b0; - s[y + 7] ^= ~s[y + 9] & b1; - s[y + 8] ^= ~b0 & b2; - s[y + 9] ^= ~b1 & b3; - } - // Iota (ι) - s[0] ^= SHA3_IOTA_H[round]; - s[1] ^= SHA3_IOTA_L[round]; - } - clean(B); -} - -/** - * Keccak sponge function. - * @param blockLen - absorb/squeeze rate in bytes - * @param suffix - domain separation suffix byte - * @param outputLen - default digest length in bytes. This base sponge only - * requires a non-negative integer; wrappers that need positive output - * lengths must enforce that themselves. - * @param enableXOF - whether XOF output is allowed - * @param rounds - number of Keccak-f rounds - * @example - * Build a sponge state, absorb bytes, then finalize a digest. - * ```ts - * const hash = new Keccak(136, 0x06, 32); - * hash.update(new Uint8Array([1, 2, 3])); - * hash.digest(); - * ``` - */ -export class Keccak implements Hash, HashXOF { - protected state: Uint8Array; - protected pos = 0; - protected posOut = 0; - protected finished = false; - protected state32: Uint32Array; - protected destroyed = false; - - public blockLen: number; - public suffix: number; - public outputLen: number; - public canXOF: boolean; - protected enableXOF = false; - protected rounds: number; - - // NOTE: we accept arguments in bytes instead of bits here. - constructor( - blockLen: number, - suffix: number, - outputLen: number, - enableXOF = false, - rounds: number = 24 - ) { - this.blockLen = blockLen; - this.suffix = suffix; - this.outputLen = outputLen; - this.enableXOF = enableXOF; - this.canXOF = enableXOF; - this.rounds = rounds; - // Can be passed from user as dkLen - anumber(outputLen, 'outputLen'); - // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes - // 0 < blockLen < 200 - if (!(0 < blockLen && blockLen < 200)) - throw new Error('only keccak-f1600 function is supported'); - this.state = new Uint8Array(200); - this.state32 = u32(this.state); - } - clone(): Keccak { - return this._cloneInto(); - } - protected keccak(): void { - swap32IfBE(this.state32); - keccakP(this.state32, this.rounds); - swap32IfBE(this.state32); - this.posOut = 0; - this.pos = 0; - } - update(data: TArg): this { - aexists(this); - abytes(data); - const { blockLen, state } = this; - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++]; - if (this.pos === blockLen) this.keccak(); - } - return this; - } - protected finish(): void { - if (this.finished) return; - this.finished = true; - const { state, suffix, pos, blockLen } = this; - // FIPS 202 appends the SHA3/SHAKE domain-separation suffix before pad10*1. - // These byte values already include the first padding bit, while the - // final `0x80` below supplies the closing `1` bit in the last rate byte. - state[pos] ^= suffix; - // If that combined suffix lands in the last rate byte and already sets - // bit 7, absorb it first so the final pad10*1 bit can be xored into a - // fresh block. - if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak(); - state[blockLen - 1] ^= 0x80; - this.keccak(); - } - protected writeInto(out: TArg): TRet { - aexists(this, false); - abytes(out); - this.finish(); - const bufferOut = this.state; - const { blockLen } = this; - for (let pos = 0, len = out.length; pos < len; ) { - if (this.posOut >= blockLen) this.keccak(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out as TRet; - } - xofInto(out: TArg): TRet { - // Plain SHA3/Keccak usage with XOF is probably a mistake, but this base - // class is also reused by SHAKE/cSHAKE/KMAC/TupleHash/ParallelHash/ - // TurboSHAKE/KangarooTwelve wrappers that intentionally enable XOF. - if (!this.enableXOF) throw new Error('XOF is not possible for this instance'); - return this.writeInto(out); - } - xof(bytes: number): TRet { - anumber(bytes); - return this.xofInto(new Uint8Array(bytes)); - } - digestInto(out: TArg): void { - aoutput(out, this); - if (this.finished) throw new Error('digest() was already called'); - // `aoutput(...)` allows oversized buffers; digestInto() must fill only the advertised digest. - this.writeInto(out.subarray(0, this.outputLen)); - this.destroy(); - } - digest(): TRet { - const out = new Uint8Array(this.outputLen); - this.digestInto(out); - return out as TRet; - } - destroy(): void { - this.destroyed = true; - clean(this.state); - } - _cloneInto(to?: Keccak): Keccak { - const { blockLen, suffix, outputLen, rounds, enableXOF } = this; - to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds); - // Reused destinations can come from a different rate/capacity variant, so clone must rewrite - // the sponge geometry as well as the state words. - to.blockLen = blockLen; - to.state32.set(this.state32); - to.pos = this.pos; - to.posOut = this.posOut; - to.finished = this.finished; - to.rounds = rounds; - // Suffix can change in cSHAKE - to.suffix = suffix; - to.outputLen = outputLen; - to.enableXOF = enableXOF; - // Clones must preserve the public capability bit too; `_KMAC` reuses this path and deep clone - // tests compare instance fields directly, so leaving `canXOF` behind makes the clone lie. - to.canXOF = this.canXOF; - to.destroyed = this.destroyed; - return to; - } -} - -const genKeccak = ( - suffix: number, - blockLen: number, - outputLen: number, - info: TArg = {} -) => createHasher(() => new Keccak(blockLen, suffix, outputLen), info); - -/** - * SHA3-224 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-224. - * ```ts - * sha3_224(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha3_224: TRet = /* @__PURE__ */ genKeccak( - 0x06, - 144, - 28, - /* @__PURE__ */ oidNist(0x07) -); -/** - * SHA3-256 hash function. Different from keccak-256. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-256. - * ```ts - * sha3_256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha3_256: TRet = /* @__PURE__ */ genKeccak( - 0x06, - 136, - 32, - /* @__PURE__ */ oidNist(0x08) -); -/** - * SHA3-384 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-384. - * ```ts - * sha3_384(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha3_384: TRet = /* @__PURE__ */ genKeccak( - 0x06, - 104, - 48, - /* @__PURE__ */ oidNist(0x09) -); -/** - * SHA3-512 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with SHA3-512. - * ```ts - * sha3_512(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha3_512: TRet = /* @__PURE__ */ genKeccak( - 0x06, - 72, - 64, - /* @__PURE__ */ oidNist(0x0a) -); - -/** - * Keccak-224 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-224. - * ```ts - * keccak_224(new Uint8Array([97, 98, 99])); - * ``` - */ -export const keccak_224: TRet = /* @__PURE__ */ genKeccak(0x01, 144, 28); -/** - * Keccak-256 hash function. Different from SHA3-256. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-256. - * ```ts - * keccak_256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const keccak_256: TRet = /* @__PURE__ */ genKeccak(0x01, 136, 32); -/** - * Keccak-384 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-384. - * ```ts - * keccak_384(new Uint8Array([97, 98, 99])); - * ``` - */ -export const keccak_384: TRet = /* @__PURE__ */ genKeccak(0x01, 104, 48); -/** - * Keccak-512 hash function. - * @param msg - message bytes to hash - * @returns Digest bytes. - * @example - * Hash a message with Keccak-512. - * ```ts - * keccak_512(new Uint8Array([97, 98, 99])); - * ``` - */ -export const keccak_512: TRet = /* @__PURE__ */ genKeccak(0x01, 72, 64); - -/** Options for SHAKE XOF. */ -export type ShakeOpts = { - /** Desired number of output bytes. */ - dkLen?: number; -}; - -const genShake = (suffix: number, blockLen: number, outputLen: number, info: TArg = {}) => - createHasher( - (opts: ShakeOpts = {}) => - new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true), - info - ); - -/** - * SHAKE128 XOF with 128-bit security and a 16-byte default output. - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE128. - * ```ts - * shake128(new Uint8Array([97, 98, 99]), { dkLen: 32 }); - * ``` - */ -export const shake128: TRet> = - /* @__PURE__ */ - genShake(0x1f, 168, 16, /* @__PURE__ */ oidNist(0x0b)); -/** - * SHAKE256 XOF with 256-bit security and a 32-byte default output. - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE256. - * ```ts - * shake256(new Uint8Array([97, 98, 99]), { dkLen: 64 }); - * ``` - */ -export const shake256: TRet> = - /* @__PURE__ */ - genShake(0x1f, 136, 32, /* @__PURE__ */ oidNist(0x0c)); - -/** - * SHAKE128 XOF with 256-bit output (NIST version). - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE128 using a 32-byte default output. - * ```ts - * shake128_32(new Uint8Array([97, 98, 99]), { dkLen: 32 }); - * ``` - */ -export const shake128_32: TRet> = - /* @__PURE__ */ - genShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b)); -/** - * SHAKE256 XOF with 512-bit output (NIST version). - * @param msg - message bytes to hash - * @param opts - Optional output-length override. See {@link ShakeOpts}. - * @returns Digest bytes. - * @example - * Hash a message with SHAKE256 using a 64-byte default output. - * ```ts - * shake256_64(new Uint8Array([97, 98, 99]), { dkLen: 64 }); - * ``` - */ -export const shake256_64: TRet> = - /* @__PURE__ */ - genShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c)); diff --git a/node_modules/@noble/hashes/src/utils.ts b/node_modules/@noble/hashes/src/utils.ts deleted file mode 100644 index 961dab2..0000000 --- a/node_modules/@noble/hashes/src/utils.ts +++ /dev/null @@ -1,848 +0,0 @@ -/** - * Utilities for hex, bytes, CSPRNG. - * @module - */ -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -/** - * Bytes API type helpers for old + new TypeScript. - * - * TS 5.6 has `Uint8Array`, while TS 5.9+ made it generic `Uint8Array`. - * We can't use specific return type, because TS 5.6 will error. - * We can't use generic return type, because most TS 5.9 software will expect specific type. - * - * Maps typed-array input leaves to broad forms. - * These are compatibility adapters, not ownership guarantees. - * - * - `TArg` keeps byte inputs broad. - * - `TRet` marks byte outputs for TS 5.6 and TS 5.9+ compatibility. - */ -export type TypedArg = T extends BigInt64Array - ? BigInt64Array - : T extends BigUint64Array - ? BigUint64Array - : T extends Float32Array - ? Float32Array - : T extends Float64Array - ? Float64Array - : T extends Int16Array - ? Int16Array - : T extends Int32Array - ? Int32Array - : T extends Int8Array - ? Int8Array - : T extends Uint16Array - ? Uint16Array - : T extends Uint32Array - ? Uint32Array - : T extends Uint8ClampedArray - ? Uint8ClampedArray - : T extends Uint8Array - ? Uint8Array - : never; -/** Maps typed-array output leaves to narrow TS-compatible forms. */ -export type TypedRet = T extends BigInt64Array - ? ReturnType - : T extends BigUint64Array - ? ReturnType - : T extends Float32Array - ? ReturnType - : T extends Float64Array - ? ReturnType - : T extends Int16Array - ? ReturnType - : T extends Int32Array - ? ReturnType - : T extends Int8Array - ? ReturnType - : T extends Uint16Array - ? ReturnType - : T extends Uint32Array - ? ReturnType - : T extends Uint8ClampedArray - ? ReturnType - : T extends Uint8Array - ? ReturnType - : never; -/** Recursively adapts byte-carrying API input types. See {@link TypedArg}. */ -export type TArg = - | T - | ([TypedArg] extends [never] - ? T extends (...args: infer A) => infer R - ? ((...args: { [K in keyof A]: TRet }) => TArg) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TArg; - } - : T extends [infer A, ...infer R] - ? [TArg, ...{ [K in keyof R]: TArg }] - : T extends readonly [infer A, ...infer R] - ? readonly [TArg, ...{ [K in keyof R]: TArg }] - : T extends (infer A)[] - ? TArg[] - : T extends readonly (infer A)[] - ? readonly TArg[] - : T extends Promise - ? Promise> - : T extends object - ? { [K in keyof T]: TArg } - : T - : TypedArg); -/** Recursively adapts byte-carrying API output types. See {@link TypedArg}. */ -export type TRet = T extends unknown - ? T & - ([TypedRet] extends [never] - ? T extends (...args: infer A) => infer R - ? ((...args: { [K in keyof A]: TArg }) => TRet) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TRet; - } - : T extends [infer A, ...infer R] - ? [TRet, ...{ [K in keyof R]: TRet }] - : T extends readonly [infer A, ...infer R] - ? readonly [TRet, ...{ [K in keyof R]: TRet }] - : T extends (infer A)[] - ? TRet[] - : T extends readonly (infer A)[] - ? readonly TRet[] - : T extends Promise - ? Promise> - : T extends object - ? { [K in keyof T]: TRet } - : T - : TypedRet) - : never; -/** - * Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. - * @param a - value to test - * @returns `true` when the value is a Uint8Array-compatible view. - * @example - * Check whether a value is a Uint8Array-compatible view. - * ```ts - * isBytes(new Uint8Array([1, 2, 3])); - * ``` - */ -export function isBytes(a: unknown): a is Uint8Array { - // Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases. - // The fallback still requires a real ArrayBuffer view, so plain - // JSON-deserialized `{ constructor: ... }` spoofing is rejected, and - // `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views. - return ( - a instanceof Uint8Array || - (ArrayBuffer.isView(a) && - a.constructor.name === 'Uint8Array' && - 'BYTES_PER_ELEMENT' in a && - a.BYTES_PER_ELEMENT === 1) - ); -} - -/** - * Asserts something is a non-negative integer. - * @param n - number to validate - * @param title - label included in thrown errors - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate a non-negative integer option. - * ```ts - * anumber(32, 'length'); - * ``` - */ -export function anumber(n: number, title: string = ''): void { - if (typeof n !== 'number') { - const prefix = title && `"${title}" `; - throw new TypeError(`${prefix}expected number, got ${typeof n}`); - } - if (!Number.isSafeInteger(n) || n < 0) { - const prefix = title && `"${title}" `; - throw new RangeError(`${prefix}expected integer >= 0, got ${n}`); - } -} - -/** - * Asserts something is Uint8Array. - * @param value - value to validate - * @param length - optional exact length constraint - * @param title - label included in thrown errors - * @returns The validated byte array. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate that a value is a byte array. - * ```ts - * abytes(new Uint8Array([1, 2, 3])); - * ``` - */ -export function abytes( - value: TArg, - length?: number, - title: string = '' -): TRet { - const bytes = isBytes(value); - const len = value?.length; - const needsLen = length !== undefined; - if (!bytes || (needsLen && len !== length)) { - const prefix = title && `"${title}" `; - const ofLen = needsLen ? ` of length ${length}` : ''; - const got = bytes ? `length=${len}` : `type=${typeof value}`; - const message = prefix + 'expected Uint8Array' + ofLen + ', got ' + got; - if (!bytes) throw new TypeError(message); - throw new RangeError(message); - } - return value as TRet; -} - -/** - * Copies bytes into a fresh Uint8Array. - * Buffer-style slices can alias the same backing store, so callers that need ownership should copy. - * @param bytes - source bytes to clone - * @returns Freshly allocated copy of `bytes`. - * @throws On wrong argument types. {@link TypeError} - * @example - * Clone a byte array before mutating it. - * ```ts - * const copy = copyBytes(new Uint8Array([1, 2, 3])); - * ``` - */ -export function copyBytes(bytes: TArg): TRet { - // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict - // because callers use it at byte-validation boundaries before mutating the detached copy. - return Uint8Array.from(abytes(bytes)) as TRet; -} - -/** - * Asserts something is a wrapped hash constructor. - * @param h - hash constructor to validate - * @throws On wrong argument types or invalid hash wrapper shape. {@link TypeError} - * @throws On invalid hash metadata ranges or values. {@link RangeError} - * @throws If the hash metadata allows empty outputs or block sizes. {@link Error} - * @example - * Validate a callable hash wrapper. - * ```ts - * import { ahash } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * ahash(sha256); - * ``` - */ -export function ahash(h: TArg): void { - if (typeof h !== 'function' || typeof h.create !== 'function') - throw new TypeError('Hash must wrapped by utils.createHasher'); - anumber(h.outputLen); - anumber(h.blockLen); - // HMAC and KDF callers treat these as real byte lengths; allowing zero lets fake wrappers pass - // validation and can produce empty outputs instead of failing fast. - if (h.outputLen < 1) throw new Error('"outputLen" must be >= 1'); - if (h.blockLen < 1) throw new Error('"blockLen" must be >= 1'); -} - -/** - * Asserts a hash instance has not been destroyed or finished. - * @param instance - hash instance to validate - * @param checkFinished - whether to reject finalized instances - * @throws If the hash instance has already been destroyed or finalized. {@link Error} - * @example - * Validate that a hash instance is still usable. - * ```ts - * import { aexists } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const hash = sha256.create(); - * aexists(hash); - * ``` - */ -export function aexists(instance: any, checkFinished = true): void { - if (instance.destroyed) throw new Error('Hash instance has been destroyed'); - if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called'); -} - -/** - * Asserts output is a sufficiently-sized byte array. - * @param out - destination buffer - * @param instance - hash instance providing output length - * Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate a caller-provided digest buffer. - * ```ts - * import { aoutput } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const hash = sha256.create(); - * aoutput(new Uint8Array(hash.outputLen), hash); - * ``` - */ -export function aoutput(out: any, instance: any): void { - abytes(out, undefined, 'digestInto() output'); - const min = instance.outputLen; - if (out.length < min) { - throw new RangeError('"digestInto() output" expected to be of length >=' + min); - } -} - -/** Generic type encompassing 8/16/32-byte array views, but not 64-bit variants. */ -// prettier-ignore -export type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array | - Uint16Array | Int16Array | Uint32Array | Int32Array; - -/** - * Casts a typed array view to Uint8Array. - * @param arr - source typed array - * @returns Uint8Array view over the same buffer. - * @example - * Reinterpret a typed array as bytes. - * ```ts - * u8(new Uint32Array([1, 2])); - * ``` - */ -export function u8(arr: TArg): TRet { - return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength) as TRet; -} - -/** - * Casts a typed array view to Uint32Array. - * `arr.byteOffset` must already be 4-byte aligned or the platform - * Uint32Array constructor will throw. - * @param arr - source typed array - * @returns Uint32Array view over the same buffer. - * @example - * Reinterpret a byte array as 32-bit words. - * ```ts - * u32(new Uint8Array(8)); - * ``` - */ -export function u32(arr: TArg): TRet { - return new Uint32Array( - arr.buffer, - arr.byteOffset, - Math.floor(arr.byteLength / 4) - ) as TRet; -} - -/** - * Zeroizes typed arrays in place. Warning: JS provides no guarantees. - * @param arrays - arrays to overwrite with zeros - * @example - * Zeroize sensitive buffers in place. - * ```ts - * clean(new Uint8Array([1, 2, 3])); - * ``` - */ -export function clean(...arrays: TArg): void { - for (let i = 0; i < arrays.length; i++) { - arrays[i].fill(0); - } -} - -/** - * Creates a DataView for byte-level manipulation. - * @param arr - source typed array - * @returns DataView over the same buffer region. - * @example - * Create a DataView over an existing buffer. - * ```ts - * createView(new Uint8Array(4)); - * ``` - */ -export function createView(arr: TArg): DataView { - return new DataView(arr.buffer, arr.byteOffset, arr.byteLength); -} - -/** - * Rotate-right operation for uint32 values. - * @param word - source word - * @param shift - shift amount in bits - * @returns Rotated word. - * @example - * Rotate a 32-bit word to the right. - * ```ts - * rotr(0x12345678, 8); - * ``` - */ -export function rotr(word: number, shift: number): number { - return (word << (32 - shift)) | (word >>> shift); -} - -/** - * Rotate-left operation for uint32 values. - * @param word - source word - * @param shift - shift amount in bits - * @returns Rotated word. - * @example - * Rotate a 32-bit word to the left. - * ```ts - * rotl(0x12345678, 8); - * ``` - */ -export function rotl(word: number, shift: number): number { - return (word << shift) | ((word >>> (32 - shift)) >>> 0); -} - -/** Whether the current platform is little-endian. */ -export const isLE: boolean = /* @__PURE__ */ (() => - new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)(); - -/** - * Byte-swap operation for uint32 values. - * @param word - source word - * @returns Word with reversed byte order. - * @example - * Reverse the byte order of a 32-bit word. - * ```ts - * byteSwap(0x11223344); - * ``` - */ -export function byteSwap(word: number): number { - return ( - ((word << 24) & 0xff000000) | - ((word << 8) & 0xff0000) | - ((word >>> 8) & 0xff00) | - ((word >>> 24) & 0xff) - ); -} -/** - * Conditionally byte-swaps one 32-bit word on big-endian platforms. - * @param n - source word - * @returns Original or byte-swapped word depending on platform endianness. - * @example - * Normalize a 32-bit word for host endianness. - * ```ts - * swap8IfBE(0x11223344); - * ``` - */ -export const swap8IfBE: (n: number) => number = isLE - ? (n: number) => n - : (n: number) => byteSwap(n) >>> 0; - -/** - * Byte-swaps every word of a Uint32Array in place. - * @param arr - array to mutate - * @returns The same array after mutation; callers pass live state arrays here. - * @example - * Reverse the byte order of every word in place. - * ```ts - * byteSwap32(new Uint32Array([0x11223344])); - * ``` - */ -export function byteSwap32(arr: TArg): TRet { - for (let i = 0; i < arr.length; i++) { - arr[i] = byteSwap(arr[i]); - } - return arr as TRet; -} - -/** - * Conditionally byte-swaps a Uint32Array on big-endian platforms. - * @param u - array to normalize for host endianness - * @returns Original or byte-swapped array depending on platform endianness. - * On big-endian runtimes this mutates `u` in place via `byteSwap32(...)`. - * @example - * Normalize a word array for host endianness. - * ```ts - * swap32IfBE(new Uint32Array([0x11223344])); - * ``` - */ -export const swap32IfBE: (u: TArg) => TRet = isLE - ? (u: TArg) => u as TRet - : byteSwap32; - -// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex -const hasHexBuiltin: boolean = /* @__PURE__ */ (() => - // @ts-ignore - typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')(); - -// Array where index 0xf0 (240) is mapped to string 'f0' -const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => - i.toString(16).padStart(2, '0') -); - -/** - * Convert byte array to hex string. - * Uses the built-in function when available and assumes it matches the tested - * fallback semantics. - * @param bytes - bytes to encode - * @returns Lowercase hexadecimal string. - * @throws On wrong argument types. {@link TypeError} - * @example - * Convert bytes to lowercase hexadecimal. - * ```ts - * bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); // 'cafe0123' - * ``` - */ -export function bytesToHex(bytes: TArg): string { - abytes(bytes); - // @ts-ignore - if (hasHexBuiltin) return bytes.toHex(); - // pre-caching improves the speed 6x - let hex = ''; - for (let i = 0; i < bytes.length; i++) { - hex += hexes[bytes[i]]; - } - return hex; -} - -// We use optimized technique to convert hex string to byte array -const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 } as const; -function asciiToBase16(ch: number): number | undefined { - if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0; // '2' => 50-48 - if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10); // 'B' => 66-(65-10) - if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10); // 'b' => 98-(97-10) - return; -} - -/** - * Convert hex string to byte array. Uses built-in function, when available. - * @param hex - hexadecimal string to decode - * @returns Decoded bytes. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Decode lowercase hexadecimal into bytes. - * ```ts - * hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) - * ``` - */ -export function hexToBytes(hex: string): TRet { - if (typeof hex !== 'string') throw new TypeError('hex string expected, got ' + typeof hex); - if (hasHexBuiltin) { - try { - return (Uint8Array as any).fromHex(hex); - } catch (error) { - if (error instanceof SyntaxError) throw new RangeError(error.message); - throw error; - } - } - const hl = hex.length; - const al = hl / 2; - if (hl % 2) throw new RangeError('hex string expected, got unpadded hex of length ' + hl); - const array = new Uint8Array(al); - for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { - const n1 = asciiToBase16(hex.charCodeAt(hi)); - const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); - if (n1 === undefined || n2 === undefined) { - const char = hex[hi] + hex[hi + 1]; - throw new RangeError( - 'hex string expected, got non-hex character "' + char + '" at index ' + hi - ); - } - array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163 - } - return array; -} - -/** - * There is no setImmediate in browser and setTimeout is slow. - * This yields to the Promise/microtask scheduler queue, not to timers or the - * full macrotask event loop. - * @example - * Yield to the next scheduler tick. - * ```ts - * await nextTick(); - * ``` - */ -export const nextTick = async (): Promise => {}; - -/** - * Returns control to the Promise/microtask scheduler every `tick` - * milliseconds to avoid blocking long loops. - * @param iters - number of loop iterations to run - * @param tick - maximum time slice in milliseconds - * @param cb - callback executed on each iteration - * @example - * Run a loop that periodically yields back to the event loop. - * ```ts - * await asyncLoop(2, 0, () => {}); - * ``` - */ -export async function asyncLoop( - iters: number, - tick: number, - cb: (i: number) => void -): Promise { - let ts = Date.now(); - for (let i = 0; i < iters; i++) { - cb(i); - // Date.now() is not monotonic, so in case if clock goes backwards we return return control too - const diff = Date.now() - ts; - if (diff >= 0 && diff < tick) continue; - await nextTick(); - ts += diff; - } -} - -// Global symbols, but ts doesn't see them: https://github.com/microsoft/TypeScript/issues/31535 -declare const TextEncoder: any; - -/** - * Converts string to bytes using UTF8 encoding. - * Built-in doesn't validate input to be string: we do the check. - * Non-ASCII details are delegated to the platform `TextEncoder`. - * @param str - string to encode - * @returns UTF-8 encoded bytes. - * @throws On wrong argument types. {@link TypeError} - * @example - * Encode a string as UTF-8 bytes. - * ```ts - * utf8ToBytes('abc'); // Uint8Array.from([97, 98, 99]) - * ``` - */ -export function utf8ToBytes(str: string): TRet { - if (typeof str !== 'string') throw new TypeError('string expected'); - return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 -} - -/** KDFs can accept string or Uint8Array for user convenience. */ -export type KDFInput = string | Uint8Array; - -/** - * Helper for KDFs: consumes Uint8Array or string. - * String inputs are UTF-8 encoded; byte-array inputs stay aliased to the caller buffer. - * @param data - user-provided KDF input - * @param errorTitle - label included in thrown errors - * @returns Byte representation of the input. - * @throws On wrong argument types. {@link TypeError} - * @example - * Normalize KDF input to bytes. - * ```ts - * kdfInputToBytes('password'); - * ``` - */ -export function kdfInputToBytes(data: TArg, errorTitle = ''): TRet { - if (typeof data === 'string') return utf8ToBytes(data); - return abytes(data, undefined, errorTitle); -} - -/** - * Copies several Uint8Arrays into one. - * @param arrays - arrays to concatenate - * @returns Concatenated byte array. - * @throws On wrong argument types. {@link TypeError} - * @example - * Concatenate multiple byte arrays. - * ```ts - * concatBytes(new Uint8Array([1]), new Uint8Array([2])); - * ``` - */ -export function concatBytes(...arrays: TArg): TRet { - let sum = 0; - for (let i = 0; i < arrays.length; i++) { - const a = arrays[i]; - abytes(a); - sum += a.length; - } - const res = new Uint8Array(sum); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const a = arrays[i]; - res.set(a, pad); - pad += a.length; - } - return res; -} - -type EmptyObj = {}; -/** - * Merges default options and passed options. - * @param defaults - base option object - * @param opts - user overrides - * @returns Merged option object. The merge mutates `defaults` in place. - * @throws On wrong argument types. {@link TypeError} - * @example - * Merge user overrides onto default options. - * ```ts - * checkOpts({ dkLen: 32 }, { asyncTick: 10 }); - * ``` - */ -export function checkOpts( - defaults: T1, - opts?: T2 -): T1 & T2 { - if (opts !== undefined && {}.toString.call(opts) !== '[object Object]') - throw new TypeError('options must be object or undefined'); - const merged = Object.assign(defaults, opts); - return merged as T1 & T2; -} - -/** Common interface for all hash instances. */ -export interface Hash { - /** Bytes processed per compression block. */ - blockLen: number; - /** Bytes produced by `digest()`. */ - outputLen: number; - /** Whether the instance supports XOF-style variable-length output via `xof()` / `xofInto()`. */ - canXOF: boolean; - /** - * Absorbs more message bytes into the running hash state. - * @param buf - message chunk to absorb - * @returns The same hash instance for chaining. - */ - update(buf: TArg): this; - /** - * Finalizes the hash into a caller-provided buffer. - * @param buf - destination buffer - * @returns Nothing. Implementations write into `buf` in place. - */ - digestInto(buf: TArg): void; - /** - * Finalizes the hash and returns a freshly allocated digest. - * @returns Digest bytes. - */ - digest(): TRet; - /** Wipes internal state and makes the instance unusable. */ - destroy(): void; - /** - * Copies the current hash state into an existing or new instance. - * @param to - Optional destination instance to reuse. - * @returns Cloned hash state. - */ - _cloneInto(to?: T): T; - /** - * Creates an independent copy of the current hash state. - * @returns Cloned hash instance. - */ - clone(): T; -} - -/** Pseudorandom generator interface. */ -export interface PRG { - /** - * Mixes more entropy into the generator state. - * @param seed - fresh entropy bytes - * @returns Nothing. Implementations update internal state in place. - */ - addEntropy(seed: TArg): void; - /** - * Generates pseudorandom output bytes. - * @param length - number of bytes to generate - * @returns Generated pseudorandom bytes. - */ - randomBytes(length: number): TRet; - /** Wipes generator state and makes the instance unusable. */ - clean(): void; -} - -/** - * XOF: streaming API to read digest in chunks. - * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name. - * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot - * destroy state, next call can require more bytes. - */ -export type HashXOF> = Hash & { - /** - * Reads more bytes from the XOF stream. - * @param bytes - number of bytes to read - * @returns Requested digest bytes. - */ - xof(bytes: number): TRet; - /** - * Reads more bytes from the XOF stream into a caller-provided buffer. - * @param buf - destination buffer - * @returns Filled output buffer. - */ - xofInto(buf: TArg): TRet; -}; - -/** Hash constructor or factory type. */ -export type HasherCons = Opts extends undefined ? () => T : (opts?: Opts) => T; -/** Optional hash metadata. */ -export type HashInfo = { - /** DER-encoded object identifier bytes for the hash algorithm. */ - oid?: TRet; -}; -/** Callable hash function type. */ -export type CHash = Hash, Opts = undefined> = { - /** Digest size in bytes. */ - outputLen: number; - /** Input block size in bytes. */ - blockLen: number; - /** Whether `.create()` returns a hash instance that can be used as an XOF stream. */ - canXOF: boolean; -} & HashInfo & - (Opts extends undefined - ? { - (msg: TArg): TRet; - create(): T; - } - : { - (msg: TArg, opts?: TArg): TRet; - create(opts?: Opts): T; - }); -/** Callable extendable-output hash function type. */ -export type CHashXOF = HashXOF, Opts = undefined> = CHash; - -/** - * Creates a callable hash function from a stateful class constructor. - * @param hashCons - hash constructor or factory - * @param info - optional metadata such as DER OID - * @returns Frozen callable hash wrapper with `.create()`. - * Wrapper construction eagerly calls `hashCons(undefined)` once to read - * `outputLen` / `blockLen`, so constructor side effects happen at module - * init time. - * @example - * Wrap a stateful hash constructor into a callable helper. - * ```ts - * import { createHasher } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const wrapped = createHasher(sha256.create, { oid: sha256.oid }); - * wrapped(new Uint8Array([1])); - * ``` - */ -export function createHasher, Opts = undefined>( - hashCons: HasherCons, - info: TArg = {} -): TRet> { - const hashC: any = (msg: TArg, opts?: TArg) => - hashCons(opts as Opts) - .update(msg) - .digest(); - const tmp = hashCons(undefined); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.canXOF = tmp.canXOF; - hashC.create = (opts?: Opts) => hashCons(opts); - Object.assign(hashC, info); - return Object.freeze(hashC) as TRet>; -} - -/** - * Cryptographically secure PRNG backed by `crypto.getRandomValues`. - * @param bytesLength - number of random bytes to generate - * @returns Random bytes. - * The platform `getRandomValues()` implementation still defines any - * single-call length cap, and this helper rejects oversize requests - * with a stable library `RangeError` instead of host-specific errors. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @throws If the current runtime does not provide `crypto.getRandomValues`. {@link Error} - * @example - * Generate a fresh random key or nonce. - * ```ts - * const key = randomBytes(16); - * ``` - */ -export function randomBytes(bytesLength = 32): TRet { - // Match the repo's other length-taking helpers instead of relying on Uint8Array coercion. - anumber(bytesLength, 'bytesLength'); - const cr = typeof globalThis === 'object' ? (globalThis as any).crypto : null; - if (typeof cr?.getRandomValues !== 'function') - throw new Error('crypto.getRandomValues must be defined'); - // Web Cryptography API Level 2 §10.1.1: - // if `byteLength > 65536`, throw `QuotaExceededError`. - // Keep the guard explicit so callers can see the quota in code - // instead of discovering it by reading the spec or host errors. - // This wrapper surfaces the same quota as a stable library RangeError. - if (bytesLength > 65536) - throw new RangeError(`"bytesLength" expected <= 65536, got ${bytesLength}`); - return cr.getRandomValues(new Uint8Array(bytesLength)); -} - -/** - * Creates OID metadata for NIST hashes with prefix `06 09 60 86 48 01 65 03 04 02`. - * @param suffix - final OID byte for the selected hash. - * The helper accepts any byte even though only the documented NIST hash - * suffixes are meaningful downstream. - * @returns Object containing the DER-encoded OID. - * @example - * Build OID metadata for a NIST hash. - * ```ts - * oidNist(0x01); - * ``` - */ -export const oidNist = (suffix: number): TRet> => ({ - // Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet. - // Larger suffix values would need base-128 OID encoding and a different length byte. - oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]), -}); diff --git a/node_modules/@noble/hashes/src/webcrypto.ts b/node_modules/@noble/hashes/src/webcrypto.ts deleted file mode 100644 index 3f772e1..0000000 --- a/node_modules/@noble/hashes/src/webcrypto.ts +++ /dev/null @@ -1,239 +0,0 @@ -import { type Pbkdf2Opt } from './pbkdf2.ts'; -import { - abytes, - ahash, - anumber, - checkOpts, - kdfInputToBytes, - type CHash, - type KDFInput, - type TArg, - type TRet, -} from './utils.ts'; - -function _subtle(): typeof crypto.subtle { - const cr = typeof globalThis === 'object' ? (globalThis as any).crypto : null; - const sb = cr?.subtle; - if (typeof sb === 'object' && sb != null) return sb; - throw new Error('crypto.subtle must be defined'); -} - -/** Callable WebCrypto hash function descriptor. */ -export type WebHash = { - /** - * Hashes one message with the selected WebCrypto digest. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - */ - (msg: TArg): Promise>; - /** WebCrypto algorithm name passed to `crypto.subtle`. */ - webCryptoName: string; - /** Digest size in bytes. */ - outputLen: number; - /** Input block size in bytes. */ - blockLen: number; -}; - -function createWebHash(name: string, blockLen: number, outputLen: number): TRet { - const hashC: any = async (msg: TArg): Promise> => { - abytes(msg); - const crypto = _subtle(); - return new Uint8Array(await crypto.digest(name, msg as BufferSource)) as TRet; - }; - hashC.webCryptoName = name; // make sure it won't interfere with function name - hashC.outputLen = outputLen; - hashC.blockLen = blockLen; - hashC.create = () => { - // Present only so this async wrapper satisfies the shared - // hash-wrapper shape checked by `ahashWeb()`. - throw new Error('not implemented'); - }; - // Later WebCrypto HMAC/HKDF/PBKDF2 calls read descriptor metadata directly, so freezing prevents - // callers from retargeting a `sha256` wrapper into a different backend digest by mutation. - return Object.freeze(hashC) as TRet; -} - -function ahashWeb(hash: TArg) { - ahash(hash as unknown as TArg); - if (typeof hash.webCryptoName !== 'string') throw new Error('non-web hash'); -} - -/** WebCrypto SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */ -// export const sha1: WebHash = createHash('SHA-1', 64, 20); - -/** - * WebCrypto SHA2-256 hash function from RFC 6234. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - * @example - * Hash a message with WebCrypto SHA2-256. - * ```ts - * await sha256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha256: TRet = /* @__PURE__ */ createWebHash('SHA-256', 64, 32); -/** - * WebCrypto SHA2-384 hash function from RFC 6234. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - * @example - * Hash a message with WebCrypto SHA2-384. - * ```ts - * await sha384(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha384: TRet = /* @__PURE__ */ createWebHash('SHA-384', 128, 48); -/** - * WebCrypto SHA2-512 hash function from RFC 6234. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - * @example - * Hash a message with WebCrypto SHA2-512. - * ```ts - * await sha512(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha512: TRet = /* @__PURE__ */ createWebHash('SHA-512', 128, 64); - -/** - * WebCrypto HMAC: RFC2104 message authentication code. - * @param hash - function that would be used e.g. sha256. Webcrypto version. - * @param key - authentication key bytes - * @param message - message bytes to authenticate - * @returns Promise resolving to authentication tag bytes. - * `.create()` exists only to mirror the synchronous API surface - * and always throws `not implemented`. - * @example - * Compute an RFC 2104 HMAC with WebCrypto. - * ```ts - * import { hmac, sha256 } from '@noble/hashes/webcrypto.js'; - * await hmac(sha256, new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -type WebHmacFn = { - ( - hash: TArg, - key: TArg, - message: TArg - ): Promise>; - create(hash: TArg, key: TArg): any; -}; -export const hmac: TRet = /* @__PURE__ */ (() => { - const hmac_ = async ( - hash: TArg, - key: TArg, - message: TArg - ): Promise> => { - const crypto = _subtle(); - abytes(key, undefined, 'key'); - abytes(message, undefined, 'message'); - ahashWeb(hash); - // WebCrypto keys can't be zeroized - // prettier-ignore - const wkey = await crypto.importKey( - 'raw', - key as BufferSource, - { name: 'HMAC', hash: hash.webCryptoName }, - false, - ['sign'] - ); - return new Uint8Array( - await crypto.sign('HMAC', wkey, message as BufferSource) - ) as TRet; - }; - hmac_.create = (_hash: TArg, _key: TArg) => { - throw new Error('not implemented'); - }; - return hmac_ as TRet; -})(); - -/** - * WebCrypto HKDF (RFC 5869): derive keys from an initial input. - * Combines hkdf_extract + hkdf_expand in one step - * @param hash - hash function that would be used (e.g. sha256). Webcrypto version. - * @param ikm - input keying material, the initial key - * @param salt - optional salt value (a non-secret random value) - * @param info - optional context and application specific information bytes - * @param length - length of output keying material in bytes. - * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` requests an empty OKM. - * @returns Promise resolving to derived key bytes. - * The RFC `L <= 255 * HashLen` bound is currently enforced only by backend - * `deriveBits()` rejection, not by an explicit library-side guard. - * @throws If the current runtime does not provide `crypto.subtle`. {@link Error} - * @example - * WebCrypto HKDF (RFC 5869): derive keys from an initial input. - * ```ts - * import { hkdf, sha256 } from '@noble/hashes/webcrypto.js'; - * import { randomBytes, utf8ToBytes } from '@noble/hashes/utils.js'; - * const inputKey = randomBytes(32); - * const salt = randomBytes(32); - * const info = utf8ToBytes('application-key'); - * const okm = await hkdf(sha256, inputKey, salt, info, 32); - * ``` - */ -export async function hkdf( - hash: TArg, - ikm: TArg, - salt: TArg, - info: TArg, - length: number -): Promise> { - const crypto = _subtle(); - ahashWeb(hash); - abytes(ikm, undefined, 'ikm'); - anumber(length, 'length'); - if (salt !== undefined) abytes(salt, undefined, 'salt'); - if (info !== undefined) abytes(info, undefined, 'info'); - const wkey = await crypto.importKey('raw', ikm as BufferSource, 'HKDF', false, ['deriveBits']); - const opts = { - name: 'HKDF', - hash: hash.webCryptoName, - salt: salt === undefined ? new Uint8Array(0) : salt, - info: info === undefined ? new Uint8Array(0) : info, - }; - return new Uint8Array(await crypto.deriveBits(opts, wkey, 8 * length)) as TRet; -} - -/** - * WebCrypto PBKDF2-HMAC: RFC 8018 key derivation function. - * @param hash - hash function that would be used e.g. sha256. Webcrypto version. - * @param password - password from which a derived key is generated; string - * inputs are normalized through `kdfInputToBytes()`, i.e. UTF-8 - * @param salt - cryptographic salt; string inputs are normalized through - * `kdfInputToBytes()`, i.e. UTF-8 - * @param opts - PBKDF2 work factor and output settings. `dkLen`, if provided, - * must be `>= 1` per RFC 8018 §5.2. See {@link Pbkdf2Opt}. - * @returns Promise resolving to derived key bytes. - * Positive-iteration enforcement is currently delegated to backend - * `deriveBits()` rejection (for example `c = 0`), not a dedicated - * library-side guard. - * @throws If the current runtime does not provide `crypto.subtle`. {@link Error} - * @example - * WebCrypto PBKDF2-HMAC: RFC 2898 key derivation function. - * ```ts - * import { pbkdf2, sha256 } from '@noble/hashes/webcrypto.js'; - * const key = await pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) }); - * ``` - */ -export async function pbkdf2( - hash: TArg, - password: TArg, - salt: TArg, - opts: Pbkdf2Opt -): Promise> { - const crypto = _subtle(); - ahashWeb(hash); - const _opts = checkOpts({ dkLen: 32 }, opts); - const { c, dkLen } = _opts; - anumber(c, 'c'); - anumber(dkLen, 'dkLen'); - // RFC 8018 §5.2 defines dkLen as a positive integer. - if (dkLen < 1) throw new Error('"dkLen" must be >= 1'); - const _password = kdfInputToBytes(password, 'password'); - const _salt = kdfInputToBytes(salt, 'salt'); - const key = await crypto.importKey('raw', _password as BufferSource, 'PBKDF2', false, [ - 'deriveBits', - ]); - const deriveOpts = { name: 'PBKDF2', salt: _salt, iterations: c, hash: hash.webCryptoName }; - return new Uint8Array(await crypto.deriveBits(deriveOpts, key, 8 * dkLen)) as TRet; -} diff --git a/node_modules/@noble/hashes/utils.d.ts b/node_modules/@noble/hashes/utils.d.ts deleted file mode 100644 index 4033d83..0000000 --- a/node_modules/@noble/hashes/utils.d.ts +++ /dev/null @@ -1,519 +0,0 @@ -/** - * Utilities for hex, bytes, CSPRNG. - * @module - */ -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -/** - * Bytes API type helpers for old + new TypeScript. - * - * TS 5.6 has `Uint8Array`, while TS 5.9+ made it generic `Uint8Array`. - * We can't use specific return type, because TS 5.6 will error. - * We can't use generic return type, because most TS 5.9 software will expect specific type. - * - * Maps typed-array input leaves to broad forms. - * These are compatibility adapters, not ownership guarantees. - * - * - `TArg` keeps byte inputs broad. - * - `TRet` marks byte outputs for TS 5.6 and TS 5.9+ compatibility. - */ -export type TypedArg = T extends BigInt64Array ? BigInt64Array : T extends BigUint64Array ? BigUint64Array : T extends Float32Array ? Float32Array : T extends Float64Array ? Float64Array : T extends Int16Array ? Int16Array : T extends Int32Array ? Int32Array : T extends Int8Array ? Int8Array : T extends Uint16Array ? Uint16Array : T extends Uint32Array ? Uint32Array : T extends Uint8ClampedArray ? Uint8ClampedArray : T extends Uint8Array ? Uint8Array : never; -/** Maps typed-array output leaves to narrow TS-compatible forms. */ -export type TypedRet = T extends BigInt64Array ? ReturnType : T extends BigUint64Array ? ReturnType : T extends Float32Array ? ReturnType : T extends Float64Array ? ReturnType : T extends Int16Array ? ReturnType : T extends Int32Array ? ReturnType : T extends Int8Array ? ReturnType : T extends Uint16Array ? ReturnType : T extends Uint32Array ? ReturnType : T extends Uint8ClampedArray ? ReturnType : T extends Uint8Array ? ReturnType : never; -/** Recursively adapts byte-carrying API input types. See {@link TypedArg}. */ -export type TArg = T | ([TypedArg] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: { - [K in keyof A]: TRet; -}) => TArg) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TArg; -} : T extends [infer A, ...infer R] ? [TArg, ...{ - [K in keyof R]: TArg; -}] : T extends readonly [infer A, ...infer R] ? readonly [TArg, ...{ - [K in keyof R]: TArg; -}] : T extends (infer A)[] ? TArg[] : T extends readonly (infer A)[] ? readonly TArg[] : T extends Promise ? Promise> : T extends object ? { - [K in keyof T]: TArg; -} : T : TypedArg); -/** Recursively adapts byte-carrying API output types. See {@link TypedArg}. */ -export type TRet = T extends unknown ? T & ([TypedRet] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: { - [K in keyof A]: TArg; -}) => TRet) & { - [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TRet; -} : T extends [infer A, ...infer R] ? [TRet, ...{ - [K in keyof R]: TRet; -}] : T extends readonly [infer A, ...infer R] ? readonly [TRet, ...{ - [K in keyof R]: TRet; -}] : T extends (infer A)[] ? TRet[] : T extends readonly (infer A)[] ? readonly TRet[] : T extends Promise ? Promise> : T extends object ? { - [K in keyof T]: TRet; -} : T : TypedRet) : never; -/** - * Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. - * @param a - value to test - * @returns `true` when the value is a Uint8Array-compatible view. - * @example - * Check whether a value is a Uint8Array-compatible view. - * ```ts - * isBytes(new Uint8Array([1, 2, 3])); - * ``` - */ -export declare function isBytes(a: unknown): a is Uint8Array; -/** - * Asserts something is a non-negative integer. - * @param n - number to validate - * @param title - label included in thrown errors - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate a non-negative integer option. - * ```ts - * anumber(32, 'length'); - * ``` - */ -export declare function anumber(n: number, title?: string): void; -/** - * Asserts something is Uint8Array. - * @param value - value to validate - * @param length - optional exact length constraint - * @param title - label included in thrown errors - * @returns The validated byte array. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate that a value is a byte array. - * ```ts - * abytes(new Uint8Array([1, 2, 3])); - * ``` - */ -export declare function abytes(value: TArg, length?: number, title?: string): TRet; -/** - * Copies bytes into a fresh Uint8Array. - * Buffer-style slices can alias the same backing store, so callers that need ownership should copy. - * @param bytes - source bytes to clone - * @returns Freshly allocated copy of `bytes`. - * @throws On wrong argument types. {@link TypeError} - * @example - * Clone a byte array before mutating it. - * ```ts - * const copy = copyBytes(new Uint8Array([1, 2, 3])); - * ``` - */ -export declare function copyBytes(bytes: TArg): TRet; -/** - * Asserts something is a wrapped hash constructor. - * @param h - hash constructor to validate - * @throws On wrong argument types or invalid hash wrapper shape. {@link TypeError} - * @throws On invalid hash metadata ranges or values. {@link RangeError} - * @throws If the hash metadata allows empty outputs or block sizes. {@link Error} - * @example - * Validate a callable hash wrapper. - * ```ts - * import { ahash } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * ahash(sha256); - * ``` - */ -export declare function ahash(h: TArg): void; -/** - * Asserts a hash instance has not been destroyed or finished. - * @param instance - hash instance to validate - * @param checkFinished - whether to reject finalized instances - * @throws If the hash instance has already been destroyed or finalized. {@link Error} - * @example - * Validate that a hash instance is still usable. - * ```ts - * import { aexists } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const hash = sha256.create(); - * aexists(hash); - * ``` - */ -export declare function aexists(instance: any, checkFinished?: boolean): void; -/** - * Asserts output is a sufficiently-sized byte array. - * @param out - destination buffer - * @param instance - hash instance providing output length - * Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate a caller-provided digest buffer. - * ```ts - * import { aoutput } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const hash = sha256.create(); - * aoutput(new Uint8Array(hash.outputLen), hash); - * ``` - */ -export declare function aoutput(out: any, instance: any): void; -/** Generic type encompassing 8/16/32-byte array views, but not 64-bit variants. */ -export type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array | Uint16Array | Int16Array | Uint32Array | Int32Array; -/** - * Casts a typed array view to Uint8Array. - * @param arr - source typed array - * @returns Uint8Array view over the same buffer. - * @example - * Reinterpret a typed array as bytes. - * ```ts - * u8(new Uint32Array([1, 2])); - * ``` - */ -export declare function u8(arr: TArg): TRet; -/** - * Casts a typed array view to Uint32Array. - * `arr.byteOffset` must already be 4-byte aligned or the platform - * Uint32Array constructor will throw. - * @param arr - source typed array - * @returns Uint32Array view over the same buffer. - * @example - * Reinterpret a byte array as 32-bit words. - * ```ts - * u32(new Uint8Array(8)); - * ``` - */ -export declare function u32(arr: TArg): TRet; -/** - * Zeroizes typed arrays in place. Warning: JS provides no guarantees. - * @param arrays - arrays to overwrite with zeros - * @example - * Zeroize sensitive buffers in place. - * ```ts - * clean(new Uint8Array([1, 2, 3])); - * ``` - */ -export declare function clean(...arrays: TArg): void; -/** - * Creates a DataView for byte-level manipulation. - * @param arr - source typed array - * @returns DataView over the same buffer region. - * @example - * Create a DataView over an existing buffer. - * ```ts - * createView(new Uint8Array(4)); - * ``` - */ -export declare function createView(arr: TArg): DataView; -/** - * Rotate-right operation for uint32 values. - * @param word - source word - * @param shift - shift amount in bits - * @returns Rotated word. - * @example - * Rotate a 32-bit word to the right. - * ```ts - * rotr(0x12345678, 8); - * ``` - */ -export declare function rotr(word: number, shift: number): number; -/** - * Rotate-left operation for uint32 values. - * @param word - source word - * @param shift - shift amount in bits - * @returns Rotated word. - * @example - * Rotate a 32-bit word to the left. - * ```ts - * rotl(0x12345678, 8); - * ``` - */ -export declare function rotl(word: number, shift: number): number; -/** Whether the current platform is little-endian. */ -export declare const isLE: boolean; -/** - * Byte-swap operation for uint32 values. - * @param word - source word - * @returns Word with reversed byte order. - * @example - * Reverse the byte order of a 32-bit word. - * ```ts - * byteSwap(0x11223344); - * ``` - */ -export declare function byteSwap(word: number): number; -/** - * Conditionally byte-swaps one 32-bit word on big-endian platforms. - * @param n - source word - * @returns Original or byte-swapped word depending on platform endianness. - * @example - * Normalize a 32-bit word for host endianness. - * ```ts - * swap8IfBE(0x11223344); - * ``` - */ -export declare const swap8IfBE: (n: number) => number; -/** - * Byte-swaps every word of a Uint32Array in place. - * @param arr - array to mutate - * @returns The same array after mutation; callers pass live state arrays here. - * @example - * Reverse the byte order of every word in place. - * ```ts - * byteSwap32(new Uint32Array([0x11223344])); - * ``` - */ -export declare function byteSwap32(arr: TArg): TRet; -/** - * Conditionally byte-swaps a Uint32Array on big-endian platforms. - * @param u - array to normalize for host endianness - * @returns Original or byte-swapped array depending on platform endianness. - * On big-endian runtimes this mutates `u` in place via `byteSwap32(...)`. - * @example - * Normalize a word array for host endianness. - * ```ts - * swap32IfBE(new Uint32Array([0x11223344])); - * ``` - */ -export declare const swap32IfBE: (u: TArg) => TRet; -/** - * Convert byte array to hex string. - * Uses the built-in function when available and assumes it matches the tested - * fallback semantics. - * @param bytes - bytes to encode - * @returns Lowercase hexadecimal string. - * @throws On wrong argument types. {@link TypeError} - * @example - * Convert bytes to lowercase hexadecimal. - * ```ts - * bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); // 'cafe0123' - * ``` - */ -export declare function bytesToHex(bytes: TArg): string; -/** - * Convert hex string to byte array. Uses built-in function, when available. - * @param hex - hexadecimal string to decode - * @returns Decoded bytes. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Decode lowercase hexadecimal into bytes. - * ```ts - * hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) - * ``` - */ -export declare function hexToBytes(hex: string): TRet; -/** - * There is no setImmediate in browser and setTimeout is slow. - * This yields to the Promise/microtask scheduler queue, not to timers or the - * full macrotask event loop. - * @example - * Yield to the next scheduler tick. - * ```ts - * await nextTick(); - * ``` - */ -export declare const nextTick: () => Promise; -/** - * Returns control to the Promise/microtask scheduler every `tick` - * milliseconds to avoid blocking long loops. - * @param iters - number of loop iterations to run - * @param tick - maximum time slice in milliseconds - * @param cb - callback executed on each iteration - * @example - * Run a loop that periodically yields back to the event loop. - * ```ts - * await asyncLoop(2, 0, () => {}); - * ``` - */ -export declare function asyncLoop(iters: number, tick: number, cb: (i: number) => void): Promise; -/** - * Converts string to bytes using UTF8 encoding. - * Built-in doesn't validate input to be string: we do the check. - * Non-ASCII details are delegated to the platform `TextEncoder`. - * @param str - string to encode - * @returns UTF-8 encoded bytes. - * @throws On wrong argument types. {@link TypeError} - * @example - * Encode a string as UTF-8 bytes. - * ```ts - * utf8ToBytes('abc'); // Uint8Array.from([97, 98, 99]) - * ``` - */ -export declare function utf8ToBytes(str: string): TRet; -/** KDFs can accept string or Uint8Array for user convenience. */ -export type KDFInput = string | Uint8Array; -/** - * Helper for KDFs: consumes Uint8Array or string. - * String inputs are UTF-8 encoded; byte-array inputs stay aliased to the caller buffer. - * @param data - user-provided KDF input - * @param errorTitle - label included in thrown errors - * @returns Byte representation of the input. - * @throws On wrong argument types. {@link TypeError} - * @example - * Normalize KDF input to bytes. - * ```ts - * kdfInputToBytes('password'); - * ``` - */ -export declare function kdfInputToBytes(data: TArg, errorTitle?: string): TRet; -/** - * Copies several Uint8Arrays into one. - * @param arrays - arrays to concatenate - * @returns Concatenated byte array. - * @throws On wrong argument types. {@link TypeError} - * @example - * Concatenate multiple byte arrays. - * ```ts - * concatBytes(new Uint8Array([1]), new Uint8Array([2])); - * ``` - */ -export declare function concatBytes(...arrays: TArg): TRet; -type EmptyObj = {}; -/** - * Merges default options and passed options. - * @param defaults - base option object - * @param opts - user overrides - * @returns Merged option object. The merge mutates `defaults` in place. - * @throws On wrong argument types. {@link TypeError} - * @example - * Merge user overrides onto default options. - * ```ts - * checkOpts({ dkLen: 32 }, { asyncTick: 10 }); - * ``` - */ -export declare function checkOpts(defaults: T1, opts?: T2): T1 & T2; -/** Common interface for all hash instances. */ -export interface Hash { - /** Bytes processed per compression block. */ - blockLen: number; - /** Bytes produced by `digest()`. */ - outputLen: number; - /** Whether the instance supports XOF-style variable-length output via `xof()` / `xofInto()`. */ - canXOF: boolean; - /** - * Absorbs more message bytes into the running hash state. - * @param buf - message chunk to absorb - * @returns The same hash instance for chaining. - */ - update(buf: TArg): this; - /** - * Finalizes the hash into a caller-provided buffer. - * @param buf - destination buffer - * @returns Nothing. Implementations write into `buf` in place. - */ - digestInto(buf: TArg): void; - /** - * Finalizes the hash and returns a freshly allocated digest. - * @returns Digest bytes. - */ - digest(): TRet; - /** Wipes internal state and makes the instance unusable. */ - destroy(): void; - /** - * Copies the current hash state into an existing or new instance. - * @param to - Optional destination instance to reuse. - * @returns Cloned hash state. - */ - _cloneInto(to?: T): T; - /** - * Creates an independent copy of the current hash state. - * @returns Cloned hash instance. - */ - clone(): T; -} -/** Pseudorandom generator interface. */ -export interface PRG { - /** - * Mixes more entropy into the generator state. - * @param seed - fresh entropy bytes - * @returns Nothing. Implementations update internal state in place. - */ - addEntropy(seed: TArg): void; - /** - * Generates pseudorandom output bytes. - * @param length - number of bytes to generate - * @returns Generated pseudorandom bytes. - */ - randomBytes(length: number): TRet; - /** Wipes generator state and makes the instance unusable. */ - clean(): void; -} -/** - * XOF: streaming API to read digest in chunks. - * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name. - * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot - * destroy state, next call can require more bytes. - */ -export type HashXOF> = Hash & { - /** - * Reads more bytes from the XOF stream. - * @param bytes - number of bytes to read - * @returns Requested digest bytes. - */ - xof(bytes: number): TRet; - /** - * Reads more bytes from the XOF stream into a caller-provided buffer. - * @param buf - destination buffer - * @returns Filled output buffer. - */ - xofInto(buf: TArg): TRet; -}; -/** Hash constructor or factory type. */ -export type HasherCons = Opts extends undefined ? () => T : (opts?: Opts) => T; -/** Optional hash metadata. */ -export type HashInfo = { - /** DER-encoded object identifier bytes for the hash algorithm. */ - oid?: TRet; -}; -/** Callable hash function type. */ -export type CHash = Hash, Opts = undefined> = { - /** Digest size in bytes. */ - outputLen: number; - /** Input block size in bytes. */ - blockLen: number; - /** Whether `.create()` returns a hash instance that can be used as an XOF stream. */ - canXOF: boolean; -} & HashInfo & (Opts extends undefined ? { - (msg: TArg): TRet; - create(): T; -} : { - (msg: TArg, opts?: TArg): TRet; - create(opts?: Opts): T; -}); -/** Callable extendable-output hash function type. */ -export type CHashXOF = HashXOF, Opts = undefined> = CHash; -/** - * Creates a callable hash function from a stateful class constructor. - * @param hashCons - hash constructor or factory - * @param info - optional metadata such as DER OID - * @returns Frozen callable hash wrapper with `.create()`. - * Wrapper construction eagerly calls `hashCons(undefined)` once to read - * `outputLen` / `blockLen`, so constructor side effects happen at module - * init time. - * @example - * Wrap a stateful hash constructor into a callable helper. - * ```ts - * import { createHasher } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const wrapped = createHasher(sha256.create, { oid: sha256.oid }); - * wrapped(new Uint8Array([1])); - * ``` - */ -export declare function createHasher, Opts = undefined>(hashCons: HasherCons, info?: TArg): TRet>; -/** - * Cryptographically secure PRNG backed by `crypto.getRandomValues`. - * @param bytesLength - number of random bytes to generate - * @returns Random bytes. - * The platform `getRandomValues()` implementation still defines any - * single-call length cap, and this helper rejects oversize requests - * with a stable library `RangeError` instead of host-specific errors. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @throws If the current runtime does not provide `crypto.getRandomValues`. {@link Error} - * @example - * Generate a fresh random key or nonce. - * ```ts - * const key = randomBytes(16); - * ``` - */ -export declare function randomBytes(bytesLength?: number): TRet; -/** - * Creates OID metadata for NIST hashes with prefix `06 09 60 86 48 01 65 03 04 02`. - * @param suffix - final OID byte for the selected hash. - * The helper accepts any byte even though only the documented NIST hash - * suffixes are meaningful downstream. - * @returns Object containing the DER-encoded OID. - * @example - * Build OID metadata for a NIST hash. - * ```ts - * oidNist(0x01); - * ``` - */ -export declare const oidNist: (suffix: number) => TRet>; -export {}; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/utils.d.ts.map b/node_modules/@noble/hashes/utils.d.ts.map deleted file mode 100644 index a76edfc..0000000 --- a/node_modules/@noble/hashes/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,sEAAsE;AACtE;;;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AC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,EAC9D,QAAQ,EAAE,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,EAC7B,IAAI,GAAE,IAAI,CAAC,QAAQ,CAAM,GACxB,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAYtB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,WAAW,SAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAc9D;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,MAAM,KAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAI9D,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/utils.js b/node_modules/@noble/hashes/utils.js deleted file mode 100644 index b4c71b6..0000000 --- a/node_modules/@noble/hashes/utils.js +++ /dev/null @@ -1,578 +0,0 @@ -/** - * Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. - * @param a - value to test - * @returns `true` when the value is a Uint8Array-compatible view. - * @example - * Check whether a value is a Uint8Array-compatible view. - * ```ts - * isBytes(new Uint8Array([1, 2, 3])); - * ``` - */ -export function isBytes(a) { - // Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases. - // The fallback still requires a real ArrayBuffer view, so plain - // JSON-deserialized `{ constructor: ... }` spoofing is rejected, and - // `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views. - return (a instanceof Uint8Array || - (ArrayBuffer.isView(a) && - a.constructor.name === 'Uint8Array' && - 'BYTES_PER_ELEMENT' in a && - a.BYTES_PER_ELEMENT === 1)); -} -/** - * Asserts something is a non-negative integer. - * @param n - number to validate - * @param title - label included in thrown errors - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate a non-negative integer option. - * ```ts - * anumber(32, 'length'); - * ``` - */ -export function anumber(n, title = '') { - if (typeof n !== 'number') { - const prefix = title && `"${title}" `; - throw new TypeError(`${prefix}expected number, got ${typeof n}`); - } - if (!Number.isSafeInteger(n) || n < 0) { - const prefix = title && `"${title}" `; - throw new RangeError(`${prefix}expected integer >= 0, got ${n}`); - } -} -/** - * Asserts something is Uint8Array. - * @param value - value to validate - * @param length - optional exact length constraint - * @param title - label included in thrown errors - * @returns The validated byte array. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate that a value is a byte array. - * ```ts - * abytes(new Uint8Array([1, 2, 3])); - * ``` - */ -export function abytes(value, length, title = '') { - const bytes = isBytes(value); - const len = value?.length; - const needsLen = length !== undefined; - if (!bytes || (needsLen && len !== length)) { - const prefix = title && `"${title}" `; - const ofLen = needsLen ? ` of length ${length}` : ''; - const got = bytes ? `length=${len}` : `type=${typeof value}`; - const message = prefix + 'expected Uint8Array' + ofLen + ', got ' + got; - if (!bytes) - throw new TypeError(message); - throw new RangeError(message); - } - return value; -} -/** - * Copies bytes into a fresh Uint8Array. - * Buffer-style slices can alias the same backing store, so callers that need ownership should copy. - * @param bytes - source bytes to clone - * @returns Freshly allocated copy of `bytes`. - * @throws On wrong argument types. {@link TypeError} - * @example - * Clone a byte array before mutating it. - * ```ts - * const copy = copyBytes(new Uint8Array([1, 2, 3])); - * ``` - */ -export function copyBytes(bytes) { - // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict - // because callers use it at byte-validation boundaries before mutating the detached copy. - return Uint8Array.from(abytes(bytes)); -} -/** - * Asserts something is a wrapped hash constructor. - * @param h - hash constructor to validate - * @throws On wrong argument types or invalid hash wrapper shape. {@link TypeError} - * @throws On invalid hash metadata ranges or values. {@link RangeError} - * @throws If the hash metadata allows empty outputs or block sizes. {@link Error} - * @example - * Validate a callable hash wrapper. - * ```ts - * import { ahash } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * ahash(sha256); - * ``` - */ -export function ahash(h) { - if (typeof h !== 'function' || typeof h.create !== 'function') - throw new TypeError('Hash must wrapped by utils.createHasher'); - anumber(h.outputLen); - anumber(h.blockLen); - // HMAC and KDF callers treat these as real byte lengths; allowing zero lets fake wrappers pass - // validation and can produce empty outputs instead of failing fast. - if (h.outputLen < 1) - throw new Error('"outputLen" must be >= 1'); - if (h.blockLen < 1) - throw new Error('"blockLen" must be >= 1'); -} -/** - * Asserts a hash instance has not been destroyed or finished. - * @param instance - hash instance to validate - * @param checkFinished - whether to reject finalized instances - * @throws If the hash instance has already been destroyed or finalized. {@link Error} - * @example - * Validate that a hash instance is still usable. - * ```ts - * import { aexists } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const hash = sha256.create(); - * aexists(hash); - * ``` - */ -export function aexists(instance, checkFinished = true) { - if (instance.destroyed) - throw new Error('Hash instance has been destroyed'); - if (checkFinished && instance.finished) - throw new Error('Hash#digest() has already been called'); -} -/** - * Asserts output is a sufficiently-sized byte array. - * @param out - destination buffer - * @param instance - hash instance providing output length - * Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Validate a caller-provided digest buffer. - * ```ts - * import { aoutput } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const hash = sha256.create(); - * aoutput(new Uint8Array(hash.outputLen), hash); - * ``` - */ -export function aoutput(out, instance) { - abytes(out, undefined, 'digestInto() output'); - const min = instance.outputLen; - if (out.length < min) { - throw new RangeError('"digestInto() output" expected to be of length >=' + min); - } -} -/** - * Casts a typed array view to Uint8Array. - * @param arr - source typed array - * @returns Uint8Array view over the same buffer. - * @example - * Reinterpret a typed array as bytes. - * ```ts - * u8(new Uint32Array([1, 2])); - * ``` - */ -export function u8(arr) { - return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); -} -/** - * Casts a typed array view to Uint32Array. - * `arr.byteOffset` must already be 4-byte aligned or the platform - * Uint32Array constructor will throw. - * @param arr - source typed array - * @returns Uint32Array view over the same buffer. - * @example - * Reinterpret a byte array as 32-bit words. - * ```ts - * u32(new Uint8Array(8)); - * ``` - */ -export function u32(arr) { - return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); -} -/** - * Zeroizes typed arrays in place. Warning: JS provides no guarantees. - * @param arrays - arrays to overwrite with zeros - * @example - * Zeroize sensitive buffers in place. - * ```ts - * clean(new Uint8Array([1, 2, 3])); - * ``` - */ -export function clean(...arrays) { - for (let i = 0; i < arrays.length; i++) { - arrays[i].fill(0); - } -} -/** - * Creates a DataView for byte-level manipulation. - * @param arr - source typed array - * @returns DataView over the same buffer region. - * @example - * Create a DataView over an existing buffer. - * ```ts - * createView(new Uint8Array(4)); - * ``` - */ -export function createView(arr) { - return new DataView(arr.buffer, arr.byteOffset, arr.byteLength); -} -/** - * Rotate-right operation for uint32 values. - * @param word - source word - * @param shift - shift amount in bits - * @returns Rotated word. - * @example - * Rotate a 32-bit word to the right. - * ```ts - * rotr(0x12345678, 8); - * ``` - */ -export function rotr(word, shift) { - return (word << (32 - shift)) | (word >>> shift); -} -/** - * Rotate-left operation for uint32 values. - * @param word - source word - * @param shift - shift amount in bits - * @returns Rotated word. - * @example - * Rotate a 32-bit word to the left. - * ```ts - * rotl(0x12345678, 8); - * ``` - */ -export function rotl(word, shift) { - return (word << shift) | ((word >>> (32 - shift)) >>> 0); -} -/** Whether the current platform is little-endian. */ -export const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)(); -/** - * Byte-swap operation for uint32 values. - * @param word - source word - * @returns Word with reversed byte order. - * @example - * Reverse the byte order of a 32-bit word. - * ```ts - * byteSwap(0x11223344); - * ``` - */ -export function byteSwap(word) { - return (((word << 24) & 0xff000000) | - ((word << 8) & 0xff0000) | - ((word >>> 8) & 0xff00) | - ((word >>> 24) & 0xff)); -} -/** - * Conditionally byte-swaps one 32-bit word on big-endian platforms. - * @param n - source word - * @returns Original or byte-swapped word depending on platform endianness. - * @example - * Normalize a 32-bit word for host endianness. - * ```ts - * swap8IfBE(0x11223344); - * ``` - */ -export const swap8IfBE = isLE - ? (n) => n - : (n) => byteSwap(n) >>> 0; -/** - * Byte-swaps every word of a Uint32Array in place. - * @param arr - array to mutate - * @returns The same array after mutation; callers pass live state arrays here. - * @example - * Reverse the byte order of every word in place. - * ```ts - * byteSwap32(new Uint32Array([0x11223344])); - * ``` - */ -export function byteSwap32(arr) { - for (let i = 0; i < arr.length; i++) { - arr[i] = byteSwap(arr[i]); - } - return arr; -} -/** - * Conditionally byte-swaps a Uint32Array on big-endian platforms. - * @param u - array to normalize for host endianness - * @returns Original or byte-swapped array depending on platform endianness. - * On big-endian runtimes this mutates `u` in place via `byteSwap32(...)`. - * @example - * Normalize a word array for host endianness. - * ```ts - * swap32IfBE(new Uint32Array([0x11223344])); - * ``` - */ -export const swap32IfBE = isLE - ? (u) => u - : byteSwap32; -// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex -const hasHexBuiltin = /* @__PURE__ */ (() => -// @ts-ignore -typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')(); -// Array where index 0xf0 (240) is mapped to string 'f0' -const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); -/** - * Convert byte array to hex string. - * Uses the built-in function when available and assumes it matches the tested - * fallback semantics. - * @param bytes - bytes to encode - * @returns Lowercase hexadecimal string. - * @throws On wrong argument types. {@link TypeError} - * @example - * Convert bytes to lowercase hexadecimal. - * ```ts - * bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); // 'cafe0123' - * ``` - */ -export function bytesToHex(bytes) { - abytes(bytes); - // @ts-ignore - if (hasHexBuiltin) - return bytes.toHex(); - // pre-caching improves the speed 6x - let hex = ''; - for (let i = 0; i < bytes.length; i++) { - hex += hexes[bytes[i]]; - } - return hex; -} -// We use optimized technique to convert hex string to byte array -const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; -function asciiToBase16(ch) { - if (ch >= asciis._0 && ch <= asciis._9) - return ch - asciis._0; // '2' => 50-48 - if (ch >= asciis.A && ch <= asciis.F) - return ch - (asciis.A - 10); // 'B' => 66-(65-10) - if (ch >= asciis.a && ch <= asciis.f) - return ch - (asciis.a - 10); // 'b' => 98-(97-10) - return; -} -/** - * Convert hex string to byte array. Uses built-in function, when available. - * @param hex - hexadecimal string to decode - * @returns Decoded bytes. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @example - * Decode lowercase hexadecimal into bytes. - * ```ts - * hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) - * ``` - */ -export function hexToBytes(hex) { - if (typeof hex !== 'string') - throw new TypeError('hex string expected, got ' + typeof hex); - if (hasHexBuiltin) { - try { - return Uint8Array.fromHex(hex); - } - catch (error) { - if (error instanceof SyntaxError) - throw new RangeError(error.message); - throw error; - } - } - const hl = hex.length; - const al = hl / 2; - if (hl % 2) - throw new RangeError('hex string expected, got unpadded hex of length ' + hl); - const array = new Uint8Array(al); - for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { - const n1 = asciiToBase16(hex.charCodeAt(hi)); - const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); - if (n1 === undefined || n2 === undefined) { - const char = hex[hi] + hex[hi + 1]; - throw new RangeError('hex string expected, got non-hex character "' + char + '" at index ' + hi); - } - array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163 - } - return array; -} -/** - * There is no setImmediate in browser and setTimeout is slow. - * This yields to the Promise/microtask scheduler queue, not to timers or the - * full macrotask event loop. - * @example - * Yield to the next scheduler tick. - * ```ts - * await nextTick(); - * ``` - */ -export const nextTick = async () => { }; -/** - * Returns control to the Promise/microtask scheduler every `tick` - * milliseconds to avoid blocking long loops. - * @param iters - number of loop iterations to run - * @param tick - maximum time slice in milliseconds - * @param cb - callback executed on each iteration - * @example - * Run a loop that periodically yields back to the event loop. - * ```ts - * await asyncLoop(2, 0, () => {}); - * ``` - */ -export async function asyncLoop(iters, tick, cb) { - let ts = Date.now(); - for (let i = 0; i < iters; i++) { - cb(i); - // Date.now() is not monotonic, so in case if clock goes backwards we return return control too - const diff = Date.now() - ts; - if (diff >= 0 && diff < tick) - continue; - await nextTick(); - ts += diff; - } -} -/** - * Converts string to bytes using UTF8 encoding. - * Built-in doesn't validate input to be string: we do the check. - * Non-ASCII details are delegated to the platform `TextEncoder`. - * @param str - string to encode - * @returns UTF-8 encoded bytes. - * @throws On wrong argument types. {@link TypeError} - * @example - * Encode a string as UTF-8 bytes. - * ```ts - * utf8ToBytes('abc'); // Uint8Array.from([97, 98, 99]) - * ``` - */ -export function utf8ToBytes(str) { - if (typeof str !== 'string') - throw new TypeError('string expected'); - return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 -} -/** - * Helper for KDFs: consumes Uint8Array or string. - * String inputs are UTF-8 encoded; byte-array inputs stay aliased to the caller buffer. - * @param data - user-provided KDF input - * @param errorTitle - label included in thrown errors - * @returns Byte representation of the input. - * @throws On wrong argument types. {@link TypeError} - * @example - * Normalize KDF input to bytes. - * ```ts - * kdfInputToBytes('password'); - * ``` - */ -export function kdfInputToBytes(data, errorTitle = '') { - if (typeof data === 'string') - return utf8ToBytes(data); - return abytes(data, undefined, errorTitle); -} -/** - * Copies several Uint8Arrays into one. - * @param arrays - arrays to concatenate - * @returns Concatenated byte array. - * @throws On wrong argument types. {@link TypeError} - * @example - * Concatenate multiple byte arrays. - * ```ts - * concatBytes(new Uint8Array([1]), new Uint8Array([2])); - * ``` - */ -export function concatBytes(...arrays) { - let sum = 0; - for (let i = 0; i < arrays.length; i++) { - const a = arrays[i]; - abytes(a); - sum += a.length; - } - const res = new Uint8Array(sum); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const a = arrays[i]; - res.set(a, pad); - pad += a.length; - } - return res; -} -/** - * Merges default options and passed options. - * @param defaults - base option object - * @param opts - user overrides - * @returns Merged option object. The merge mutates `defaults` in place. - * @throws On wrong argument types. {@link TypeError} - * @example - * Merge user overrides onto default options. - * ```ts - * checkOpts({ dkLen: 32 }, { asyncTick: 10 }); - * ``` - */ -export function checkOpts(defaults, opts) { - if (opts !== undefined && {}.toString.call(opts) !== '[object Object]') - throw new TypeError('options must be object or undefined'); - const merged = Object.assign(defaults, opts); - return merged; -} -/** - * Creates a callable hash function from a stateful class constructor. - * @param hashCons - hash constructor or factory - * @param info - optional metadata such as DER OID - * @returns Frozen callable hash wrapper with `.create()`. - * Wrapper construction eagerly calls `hashCons(undefined)` once to read - * `outputLen` / `blockLen`, so constructor side effects happen at module - * init time. - * @example - * Wrap a stateful hash constructor into a callable helper. - * ```ts - * import { createHasher } from '@noble/hashes/utils.js'; - * import { sha256 } from '@noble/hashes/sha2.js'; - * const wrapped = createHasher(sha256.create, { oid: sha256.oid }); - * wrapped(new Uint8Array([1])); - * ``` - */ -export function createHasher(hashCons, info = {}) { - const hashC = (msg, opts) => hashCons(opts) - .update(msg) - .digest(); - const tmp = hashCons(undefined); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.canXOF = tmp.canXOF; - hashC.create = (opts) => hashCons(opts); - Object.assign(hashC, info); - return Object.freeze(hashC); -} -/** - * Cryptographically secure PRNG backed by `crypto.getRandomValues`. - * @param bytesLength - number of random bytes to generate - * @returns Random bytes. - * The platform `getRandomValues()` implementation still defines any - * single-call length cap, and this helper rejects oversize requests - * with a stable library `RangeError` instead of host-specific errors. - * @throws On wrong argument types. {@link TypeError} - * @throws On wrong argument ranges or values. {@link RangeError} - * @throws If the current runtime does not provide `crypto.getRandomValues`. {@link Error} - * @example - * Generate a fresh random key or nonce. - * ```ts - * const key = randomBytes(16); - * ``` - */ -export function randomBytes(bytesLength = 32) { - // Match the repo's other length-taking helpers instead of relying on Uint8Array coercion. - anumber(bytesLength, 'bytesLength'); - const cr = typeof globalThis === 'object' ? globalThis.crypto : null; - if (typeof cr?.getRandomValues !== 'function') - throw new Error('crypto.getRandomValues must be defined'); - // Web Cryptography API Level 2 §10.1.1: - // if `byteLength > 65536`, throw `QuotaExceededError`. - // Keep the guard explicit so callers can see the quota in code - // instead of discovering it by reading the spec or host errors. - // This wrapper surfaces the same quota as a stable library RangeError. - if (bytesLength > 65536) - throw new RangeError(`"bytesLength" expected <= 65536, got ${bytesLength}`); - return cr.getRandomValues(new Uint8Array(bytesLength)); -} -/** - * Creates OID metadata for NIST hashes with prefix `06 09 60 86 48 01 65 03 04 02`. - * @param suffix - final OID byte for the selected hash. - * The helper accepts any byte even though only the documented NIST hash - * suffixes are meaningful downstream. - * @returns Object containing the DER-encoded OID. - * @example - * Build OID metadata for a NIST hash. - * ```ts - * oidNist(0x01); - * ``` - */ -export const oidNist = (suffix) => ({ - // Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet. - // Larger suffix values would need base-128 OID encoding and a different length byte. - oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]), -}); -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/utils.js.map b/node_modules/@noble/hashes/utils.js.map deleted file mode 100644 index 76f809d..0000000 --- a/node_modules/@noble/hashes/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["src/utils.ts"],"names":[],"mappings":"AA8GA;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAC,CAAU;IAChC,2FAA2F;IAC3F,gEAAgE;IAChE,qEAAqE;IACrE,uEAAuE;IACvE,OAAO,CACL,CAAC,YAAY,UAAU;QACvB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;YACpB,CAAC,CAAC,WAAW,CAAC,IAAI,KAAK,YAAY;YACnC,mBAAmB,IAAI,CAAC;YAC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;;;;;;GAeG;AACH,MAAM,UAAU,WAAW,CAAC,WAAW,GAAG,EAAE;IAC1C,0FAA0F;IAC1F,OAAO,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACpC,MAAM,EAAE,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAE,UAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9E,IAAI,OAAO,EAAE,EAAE,eAAe,KAAK,UAAU;QAC3C,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,wCAAwC;IACxC,uDAAuD;IACvD,+DAA+D;IAC/D,gEAAgE;IAChE,uEAAuE;IACvE,IAAI,WAAW,GAAG,KAAK;QACrB,MAAM,IAAI,UAAU,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;IAC9E,OAAO,EAAE,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAc,EAA4B,EAAE,CAAC,CAAC;IACpE,+EAA+E;IAC/E,qFAAqF;IACrF,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;CAC3F,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/webcrypto.d.ts b/node_modules/@noble/hashes/webcrypto.d.ts deleted file mode 100644 index 9226c66..0000000 --- a/node_modules/@noble/hashes/webcrypto.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { type Pbkdf2Opt } from './pbkdf2.ts'; -import { type KDFInput, type TArg, type TRet } from './utils.ts'; -/** Callable WebCrypto hash function descriptor. */ -export type WebHash = { - /** - * Hashes one message with the selected WebCrypto digest. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - */ - (msg: TArg): Promise>; - /** WebCrypto algorithm name passed to `crypto.subtle`. */ - webCryptoName: string; - /** Digest size in bytes. */ - outputLen: number; - /** Input block size in bytes. */ - blockLen: number; -}; -/** WebCrypto SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */ -/** - * WebCrypto SHA2-256 hash function from RFC 6234. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - * @example - * Hash a message with WebCrypto SHA2-256. - * ```ts - * await sha256(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha256: TRet; -/** - * WebCrypto SHA2-384 hash function from RFC 6234. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - * @example - * Hash a message with WebCrypto SHA2-384. - * ```ts - * await sha384(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha384: TRet; -/** - * WebCrypto SHA2-512 hash function from RFC 6234. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - * @example - * Hash a message with WebCrypto SHA2-512. - * ```ts - * await sha512(new Uint8Array([97, 98, 99])); - * ``` - */ -export declare const sha512: TRet; -/** - * WebCrypto HMAC: RFC2104 message authentication code. - * @param hash - function that would be used e.g. sha256. Webcrypto version. - * @param key - authentication key bytes - * @param message - message bytes to authenticate - * @returns Promise resolving to authentication tag bytes. - * `.create()` exists only to mirror the synchronous API surface - * and always throws `not implemented`. - * @example - * Compute an RFC 2104 HMAC with WebCrypto. - * ```ts - * import { hmac, sha256 } from '@noble/hashes/webcrypto.js'; - * await hmac(sha256, new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])); - * ``` - */ -type WebHmacFn = { - (hash: TArg, key: TArg, message: TArg): Promise>; - create(hash: TArg, key: TArg): any; -}; -export declare const hmac: TRet; -/** - * WebCrypto HKDF (RFC 5869): derive keys from an initial input. - * Combines hkdf_extract + hkdf_expand in one step - * @param hash - hash function that would be used (e.g. sha256). Webcrypto version. - * @param ikm - input keying material, the initial key - * @param salt - optional salt value (a non-secret random value) - * @param info - optional context and application specific information bytes - * @param length - length of output keying material in bytes. - * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` requests an empty OKM. - * @returns Promise resolving to derived key bytes. - * The RFC `L <= 255 * HashLen` bound is currently enforced only by backend - * `deriveBits()` rejection, not by an explicit library-side guard. - * @throws If the current runtime does not provide `crypto.subtle`. {@link Error} - * @example - * WebCrypto HKDF (RFC 5869): derive keys from an initial input. - * ```ts - * import { hkdf, sha256 } from '@noble/hashes/webcrypto.js'; - * import { randomBytes, utf8ToBytes } from '@noble/hashes/utils.js'; - * const inputKey = randomBytes(32); - * const salt = randomBytes(32); - * const info = utf8ToBytes('application-key'); - * const okm = await hkdf(sha256, inputKey, salt, info, 32); - * ``` - */ -export declare function hkdf(hash: TArg, ikm: TArg, salt: TArg, info: TArg, length: number): Promise>; -/** - * WebCrypto PBKDF2-HMAC: RFC 8018 key derivation function. - * @param hash - hash function that would be used e.g. sha256. Webcrypto version. - * @param password - password from which a derived key is generated; string - * inputs are normalized through `kdfInputToBytes()`, i.e. UTF-8 - * @param salt - cryptographic salt; string inputs are normalized through - * `kdfInputToBytes()`, i.e. UTF-8 - * @param opts - PBKDF2 work factor and output settings. `dkLen`, if provided, - * must be `>= 1` per RFC 8018 §5.2. See {@link Pbkdf2Opt}. - * @returns Promise resolving to derived key bytes. - * Positive-iteration enforcement is currently delegated to backend - * `deriveBits()` rejection (for example `c = 0`), not a dedicated - * library-side guard. - * @throws If the current runtime does not provide `crypto.subtle`. {@link Error} - * @example - * WebCrypto PBKDF2-HMAC: RFC 2898 key derivation function. - * ```ts - * import { pbkdf2, sha256 } from '@noble/hashes/webcrypto.js'; - * const key = await pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) }); - * ``` - */ -export declare function pbkdf2(hash: TArg, password: TArg, salt: TArg, opts: Pbkdf2Opt): Promise>; -export {}; -//# sourceMappingURL=webcrypto.d.ts.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/webcrypto.d.ts.map b/node_modules/@noble/hashes/webcrypto.d.ts.map deleted file mode 100644 index be40d07..0000000 --- a/node_modules/@noble/hashes/webcrypto.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.d.ts","sourceRoot":"","sources":["src/webcrypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAOL,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AASpB,mDAAmD;AACnD,MAAM,MAAM,OAAO,GAAG;IACpB;;;;OAIG;IACH,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACnD,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA0BF,uFAAuF;AAGvF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,OAAO,CAAoD,CAAC;AACtF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,OAAO,CAAqD,CAAC;AACvF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,OAAO,CAAqD,CAAC;AAEvF;;;;;;;;;;;;;;GAcG;AACH,KAAK,SAAS,GAAG;IACf,CACE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EACnB,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,EACrB,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,GACxB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7B,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC;CACzD,CAAC;AACF,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,CA2B7B,CAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EACnB,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,EACrB,IAAI,EAAE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,EAClC,IAAI,EAAE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,EAClC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAe3B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EACxB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,EACpB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAgB3B"} \ No newline at end of file diff --git a/node_modules/@noble/hashes/webcrypto.js b/node_modules/@noble/hashes/webcrypto.js deleted file mode 100644 index 0818023..0000000 --- a/node_modules/@noble/hashes/webcrypto.js +++ /dev/null @@ -1,165 +0,0 @@ -import {} from "./pbkdf2.js"; -import { abytes, ahash, anumber, checkOpts, kdfInputToBytes, } from "./utils.js"; -function _subtle() { - const cr = typeof globalThis === 'object' ? globalThis.crypto : null; - const sb = cr?.subtle; - if (typeof sb === 'object' && sb != null) - return sb; - throw new Error('crypto.subtle must be defined'); -} -function createWebHash(name, blockLen, outputLen) { - const hashC = async (msg) => { - abytes(msg); - const crypto = _subtle(); - return new Uint8Array(await crypto.digest(name, msg)); - }; - hashC.webCryptoName = name; // make sure it won't interfere with function name - hashC.outputLen = outputLen; - hashC.blockLen = blockLen; - hashC.create = () => { - // Present only so this async wrapper satisfies the shared - // hash-wrapper shape checked by `ahashWeb()`. - throw new Error('not implemented'); - }; - // Later WebCrypto HMAC/HKDF/PBKDF2 calls read descriptor metadata directly, so freezing prevents - // callers from retargeting a `sha256` wrapper into a different backend digest by mutation. - return Object.freeze(hashC); -} -function ahashWeb(hash) { - ahash(hash); - if (typeof hash.webCryptoName !== 'string') - throw new Error('non-web hash'); -} -/** WebCrypto SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */ -// export const sha1: WebHash = createHash('SHA-1', 64, 20); -/** - * WebCrypto SHA2-256 hash function from RFC 6234. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - * @example - * Hash a message with WebCrypto SHA2-256. - * ```ts - * await sha256(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha256 = /* @__PURE__ */ createWebHash('SHA-256', 64, 32); -/** - * WebCrypto SHA2-384 hash function from RFC 6234. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - * @example - * Hash a message with WebCrypto SHA2-384. - * ```ts - * await sha384(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha384 = /* @__PURE__ */ createWebHash('SHA-384', 128, 48); -/** - * WebCrypto SHA2-512 hash function from RFC 6234. - * @param msg - message bytes to hash - * @returns Promise resolving to digest bytes. - * @example - * Hash a message with WebCrypto SHA2-512. - * ```ts - * await sha512(new Uint8Array([97, 98, 99])); - * ``` - */ -export const sha512 = /* @__PURE__ */ createWebHash('SHA-512', 128, 64); -export const hmac = /* @__PURE__ */ (() => { - const hmac_ = async (hash, key, message) => { - const crypto = _subtle(); - abytes(key, undefined, 'key'); - abytes(message, undefined, 'message'); - ahashWeb(hash); - // WebCrypto keys can't be zeroized - // prettier-ignore - const wkey = await crypto.importKey('raw', key, { name: 'HMAC', hash: hash.webCryptoName }, false, ['sign']); - return new Uint8Array(await crypto.sign('HMAC', wkey, message)); - }; - hmac_.create = (_hash, _key) => { - throw new Error('not implemented'); - }; - return hmac_; -})(); -/** - * WebCrypto HKDF (RFC 5869): derive keys from an initial input. - * Combines hkdf_extract + hkdf_expand in one step - * @param hash - hash function that would be used (e.g. sha256). Webcrypto version. - * @param ikm - input keying material, the initial key - * @param salt - optional salt value (a non-secret random value) - * @param info - optional context and application specific information bytes - * @param length - length of output keying material in bytes. - * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` requests an empty OKM. - * @returns Promise resolving to derived key bytes. - * The RFC `L <= 255 * HashLen` bound is currently enforced only by backend - * `deriveBits()` rejection, not by an explicit library-side guard. - * @throws If the current runtime does not provide `crypto.subtle`. {@link Error} - * @example - * WebCrypto HKDF (RFC 5869): derive keys from an initial input. - * ```ts - * import { hkdf, sha256 } from '@noble/hashes/webcrypto.js'; - * import { randomBytes, utf8ToBytes } from '@noble/hashes/utils.js'; - * const inputKey = randomBytes(32); - * const salt = randomBytes(32); - * const info = utf8ToBytes('application-key'); - * const okm = await hkdf(sha256, inputKey, salt, info, 32); - * ``` - */ -export async function hkdf(hash, ikm, salt, info, length) { - const crypto = _subtle(); - ahashWeb(hash); - abytes(ikm, undefined, 'ikm'); - anumber(length, 'length'); - if (salt !== undefined) - abytes(salt, undefined, 'salt'); - if (info !== undefined) - abytes(info, undefined, 'info'); - const wkey = await crypto.importKey('raw', ikm, 'HKDF', false, ['deriveBits']); - const opts = { - name: 'HKDF', - hash: hash.webCryptoName, - salt: salt === undefined ? new Uint8Array(0) : salt, - info: info === undefined ? new Uint8Array(0) : info, - }; - return new Uint8Array(await crypto.deriveBits(opts, wkey, 8 * length)); -} -/** - * WebCrypto PBKDF2-HMAC: RFC 8018 key derivation function. - * @param hash - hash function that would be used e.g. sha256. Webcrypto version. - * @param password - password from which a derived key is generated; string - * inputs are normalized through `kdfInputToBytes()`, i.e. UTF-8 - * @param salt - cryptographic salt; string inputs are normalized through - * `kdfInputToBytes()`, i.e. UTF-8 - * @param opts - PBKDF2 work factor and output settings. `dkLen`, if provided, - * must be `>= 1` per RFC 8018 §5.2. See {@link Pbkdf2Opt}. - * @returns Promise resolving to derived key bytes. - * Positive-iteration enforcement is currently delegated to backend - * `deriveBits()` rejection (for example `c = 0`), not a dedicated - * library-side guard. - * @throws If the current runtime does not provide `crypto.subtle`. {@link Error} - * @example - * WebCrypto PBKDF2-HMAC: RFC 2898 key derivation function. - * ```ts - * import { pbkdf2, sha256 } from '@noble/hashes/webcrypto.js'; - * const key = await pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) }); - * ``` - */ -export async function pbkdf2(hash, password, salt, opts) { - const crypto = _subtle(); - ahashWeb(hash); - const _opts = checkOpts({ dkLen: 32 }, opts); - const { c, dkLen } = _opts; - anumber(c, 'c'); - anumber(dkLen, 'dkLen'); - // RFC 8018 §5.2 defines dkLen as a positive integer. - if (dkLen < 1) - throw new Error('"dkLen" must be >= 1'); - const _password = kdfInputToBytes(password, 'password'); - const _salt = kdfInputToBytes(salt, 'salt'); - const key = await crypto.importKey('raw', _password, 'PBKDF2', false, [ - 'deriveBits', - ]); - const deriveOpts = { name: 'PBKDF2', salt: _salt, iterations: c, hash: hash.webCryptoName }; - return new Uint8Array(await crypto.deriveBits(deriveOpts, key, 8 * dkLen)); -} -//# sourceMappingURL=webcrypto.js.map \ No newline at end of file diff --git a/node_modules/@noble/hashes/webcrypto.js.map b/node_modules/@noble/hashes/webcrypto.js.map deleted file mode 100644 index f489b26..0000000 --- a/node_modules/@noble/hashes/webcrypto.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webcrypto.js","sourceRoot":"","sources":["src/webcrypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,MAAM,EACN,KAAK,EACL,OAAO,EACP,SAAS,EACT,eAAe,GAKhB,MAAM,YAAY,CAAC;AAEpB,SAAS,OAAO;IACd,MAAM,EAAE,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAE,UAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAC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EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC7C,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAC3B,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxB,qDAAqD;IACrD,IAAI,KAAK,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAyB,EAAE,QAAQ,EAAE,KAAK,EAAE;QACpF,YAAY;KACb,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;IAC5F,OAAO,IAAI,UAAU,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,CAAqB,CAAC;AACjG,CAAC"} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/LICENSE b/node_modules/@opentelemetry/api/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/@opentelemetry/api/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/@opentelemetry/api/README.md b/node_modules/@opentelemetry/api/README.md deleted file mode 100644 index 40015db..0000000 --- a/node_modules/@opentelemetry/api/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# OpenTelemetry API for JavaScript - -

- -API Reference -  •   -Documentation -
- - NPM Release - -
-

- -This package provides everything needed to interact with the OpenTelemetry API, including all TypeScript interfaces, enums, and no-op implementations. It is intended for use both on the server and in the browser. - -The methods in this package perform no operations by default. This means they can be safely called by a library or end-user application whether there is an SDK registered or not. In order to generate and export telemetry data, you will also need an SDK such as the [OpenTelemetry JS SDK][opentelemetry-js]. - -## Tracing Quick Start - -### You Will Need - -- An application you wish to instrument -- [OpenTelemetry JS SDK][opentelemetry-js] -- Node.js >=8.5.0 (14+ is preferred) or an ECMAScript 5+ compatible browser - -**Note:** ECMAScript 5+ compatibility is for this package only. Please refer to the documentation for the SDK you are using to determine its minimum ECMAScript version. - -**Note for library authors:** Only your end users will need an OpenTelemetry SDK. If you wish to support OpenTelemetry in your library, you only need to use the OpenTelemetry API. For more information, please read the [tracing documentation][docs-tracing]. - -### Install Dependencies - -```sh -npm install @opentelemetry/api @opentelemetry/sdk-trace-base -``` - -### Trace Your Application - -In order to get started with tracing, you will need to first register an SDK. The SDK you are using may provide a convenience method which calls the registration methods for you, but if you would like to call them directly they are documented here: [SDK registration methods][docs-sdk-registration]. - -Once you have registered an SDK, you can start and end spans. A simple example of basic SDK registration and tracing a simple operation is below. The example should export spans to the console once per second. For more information, see the [tracing documentation][docs-tracing]. - -```javascript -const { trace } = require("@opentelemetry/api"); -const { BasicTracerProvider, ConsoleSpanExporter, SimpleSpanProcessor } = require("@opentelemetry/sdk-trace-base"); - -// Create and register an SDK -const provider = new BasicTracerProvider({ - spanProcessors: [new SimpleSpanProcessor(new ConsoleSpanExporter())] -}); -trace.setGlobalTracerProvider(provider); - -// Acquire a tracer from the global tracer provider which will be used to trace the application -const name = 'my-application-name'; -const version = '0.1.0'; -const tracer = trace.getTracer(name, version); - -// Trace your application by creating spans -async function operation() { - const span = tracer.startSpan("do operation"); - - // mock some work by sleeping 1 second - await new Promise((resolve, reject) => { - setTimeout(resolve, 1000); - }) - - span.end(); -} - -async function main() { - while (true) { - await operation(); - } -} - -main(); -``` - -## Version Compatibility - -Because the npm installer and node module resolution algorithm could potentially allow two or more copies of any given package to exist within the same `node_modules` structure, the OpenTelemetry API takes advantage of a variable on the `global` object to store the global API. When an API method in the API package is called, it checks if this `global` API exists and proxies calls to it if and only if it is a compatible API version. This means if a package has a dependency on an OpenTelemetry API version which is not compatible with the API used by the end user, the package will receive a no-op implementation of the API. - -## Upgrade Guidelines - -### 0.21.0 to 1.0.0 - -No breaking changes - -### 0.20.0 to 0.21.0 - -- [#78](https://github.com/open-telemetry/opentelemetry-js-api/issues/78) `api.context.bind` arguments reversed and `context` is now a required argument. -- [#46](https://github.com/open-telemetry/opentelemetry-js-api/issues/46) Noop classes and singletons are no longer exported. To create a noop span it is recommended to use `api.trace.wrapSpanContext` with `INVALID_SPAN_CONTEXT` instead of using the `NOOP_TRACER`. - -### 1.0.0-rc.3 to 0.20.0 - -- Removing `TimedEvent` which was not part of spec -- `HttpBaggage` renamed to `HttpBaggagePropagator` -- [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) `Span#context` renamed to `Span#spanContext` -- [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) `getSpan`/`setSpan`/`getSpanContext`/`setSpanContext` moved to `trace` namespace -- [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) `getBaggage`/`setBaggage`/`createBaggage` moved to `propagation` namespace - -## Useful links - -- For more information on OpenTelemetry, visit: -- For more about OpenTelemetry JavaScript: -- For help or feedback on this project, join us in [GitHub Discussions][discussions-url] - -## License - -Apache 2.0 - See [LICENSE][license-url] for more information. - -[opentelemetry-js]: https://github.com/open-telemetry/opentelemetry-js - -[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions -[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/api/LICENSE -[docs-tracing]: https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/tracing.md -[docs-sdk-registration]: https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/sdk-registration.md diff --git a/node_modules/@opentelemetry/api/build/esm/api/context.d.ts b/node_modules/@opentelemetry/api/build/esm/api/context.d.ts deleted file mode 100644 index 7771d2a..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/context.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { Context, ContextManager } from '../context/types'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Context API - * - * @since 1.0.0 - */ -export declare class ContextAPI { - private static _instance?; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Context API */ - static getInstance(): ContextAPI; - /** - * Set the current context manager. - * - * @returns true if the context manager was successfully registered, else false - */ - setGlobalContextManager(contextManager: ContextManager): boolean; - /** - * Get the currently active context - */ - active(): Context; - /** - * Execute a function with an active context - * - * @param context context to be active during function execution - * @param fn function to execute in a context - * @param thisArg optional receiver to be used for calling fn - * @param args optional arguments forwarded to fn - */ - with ReturnType>(context: Context, fn: F, thisArg?: ThisParameterType, ...args: A): ReturnType; - /** - * Bind a context to a target function or event emitter - * - * @param context context to bind to the event emitter or function. Defaults to the currently active context - * @param target function or event emitter to bind - */ - bind(context: Context, target: T): T; - private _getContextManager; - /** Disable and remove the global context manager */ - disable(): void; -} -//# sourceMappingURL=context.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/context.js b/node_modules/@opentelemetry/api/build/esm/api/context.js deleted file mode 100644 index 7dfcd82..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/context.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { NoopContextManager } from '../context/NoopContextManager'; -import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils'; -import { DiagAPI } from './diag'; -const API_NAME = 'context'; -const NOOP_CONTEXT_MANAGER = new NoopContextManager(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Context API - * - * @since 1.0.0 - */ -export class ContextAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { } - /** Get the singleton instance of the Context API */ - static getInstance() { - if (!this._instance) { - this._instance = new ContextAPI(); - } - return this._instance; - } - /** - * Set the current context manager. - * - * @returns true if the context manager was successfully registered, else false - */ - setGlobalContextManager(contextManager) { - return registerGlobal(API_NAME, contextManager, DiagAPI.instance()); - } - /** - * Get the currently active context - */ - active() { - return this._getContextManager().active(); - } - /** - * Execute a function with an active context - * - * @param context context to be active during function execution - * @param fn function to execute in a context - * @param thisArg optional receiver to be used for calling fn - * @param args optional arguments forwarded to fn - */ - with(context, fn, thisArg, ...args) { - return this._getContextManager().with(context, fn, thisArg, ...args); - } - /** - * Bind a context to a target function or event emitter - * - * @param context context to bind to the event emitter or function. Defaults to the currently active context - * @param target function or event emitter to bind - */ - bind(context, target) { - return this._getContextManager().bind(context, target); - } - _getContextManager() { - return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER; - } - /** Disable and remove the global context manager */ - disable() { - this._getContextManager().disable(); - unregisterGlobal(API_NAME, DiagAPI.instance()); - } -} -//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/context.js.map b/node_modules/@opentelemetry/api/build/esm/api/context.js.map deleted file mode 100644 index 67dc9a4..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/api/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA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AAE,CAAC,OAAO,EAAE,CAAC;QACpC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { NoopContextManager } from '../context/NoopContextManager';\nimport type { Context, ContextManager } from '../context/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'context';\nconst NOOP_CONTEXT_MANAGER = new NoopContextManager();\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Context API\n *\n * @since 1.0.0\n */\nexport class ContextAPI {\n private static _instance?: ContextAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Context API */\n public static getInstance(): ContextAPI {\n if (!this._instance) {\n this._instance = new ContextAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current context manager.\n *\n * @returns true if the context manager was successfully registered, else false\n */\n public setGlobalContextManager(contextManager: ContextManager): boolean {\n return registerGlobal(API_NAME, contextManager, DiagAPI.instance());\n }\n\n /**\n * Get the currently active context\n */\n public active(): Context {\n return this._getContextManager().active();\n }\n\n /**\n * Execute a function with an active context\n *\n * @param context context to be active during function execution\n * @param fn function to execute in a context\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n public with ReturnType>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType,\n ...args: A\n ): ReturnType {\n return this._getContextManager().with(context, fn, thisArg, ...args);\n }\n\n /**\n * Bind a context to a target function or event emitter\n *\n * @param context context to bind to the event emitter or function. Defaults to the currently active context\n * @param target function or event emitter to bind\n */\n public bind(context: Context, target: T): T {\n return this._getContextManager().bind(context, target);\n }\n\n private _getContextManager(): ContextManager {\n return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;\n }\n\n /** Disable and remove the global context manager */\n public disable() {\n this._getContextManager().disable();\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/diag.d.ts b/node_modules/@opentelemetry/api/build/esm/api/diag.d.ts deleted file mode 100644 index 478c771..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/diag.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { ComponentLoggerOptions, DiagLogFunction, DiagLogger, DiagLoggerApi } from '../diag/types'; -/** - * Singleton object which represents the entry point to the OpenTelemetry internal - * diagnostic API - * - * @since 1.0.0 - */ -export declare class DiagAPI implements DiagLogger, DiagLoggerApi { - private static _instance?; - /** Get the singleton instance of the DiagAPI API */ - static instance(): DiagAPI; - /** - * Private internal constructor - * @private - */ - private constructor(); - setLogger: DiagLoggerApi['setLogger']; - /** - * - */ - createComponentLogger: (options: ComponentLoggerOptions) => DiagLogger; - verbose: DiagLogFunction; - debug: DiagLogFunction; - info: DiagLogFunction; - warn: DiagLogFunction; - error: DiagLogFunction; - /** - * Unregister the global logger and return to Noop - */ - disable: () => void; -} -//# sourceMappingURL=diag.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/diag.js b/node_modules/@opentelemetry/api/build/esm/api/diag.js deleted file mode 100644 index a995e1e..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/diag.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { DiagComponentLogger } from '../diag/ComponentLogger'; -import { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger'; -import { DiagLogLevel } from '../diag/types'; -import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils'; -const API_NAME = 'diag'; -/** - * Singleton object which represents the entry point to the OpenTelemetry internal - * diagnostic API - * - * @since 1.0.0 - */ -export class DiagAPI { - /** Get the singleton instance of the DiagAPI API */ - static instance() { - if (!this._instance) { - this._instance = new DiagAPI(); - } - return this._instance; - } - /** - * Private internal constructor - * @private - */ - constructor() { - function _logProxy(funcName) { - return function (...args) { - const logger = getGlobal('diag'); - // shortcut if logger not set - if (!logger) - return; - return logger[funcName](...args); - }; - } - // Using self local variable for minification purposes as 'this' cannot be minified - const self = this; - // DiagAPI specific functions - const setLogger = (logger, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => { - var _a, _b, _c; - if (logger === self) { - // There isn't much we can do here. - // Logging to the console might break the user application. - // Try to log to self. If a logger was previously registered it will receive the log. - const err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'); - self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message); - return false; - } - if (typeof optionsOrLogLevel === 'number') { - optionsOrLogLevel = { - logLevel: optionsOrLogLevel, - }; - } - const oldLogger = getGlobal('diag'); - const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger); - // There already is an logger registered. We'll let it know before overwriting it. - if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) { - const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : ''; - oldLogger.warn(`Current logger will be overwritten from ${stack}`); - newLogger.warn(`Current logger will overwrite one already registered from ${stack}`); - } - return registerGlobal('diag', newLogger, self, true); - }; - self.setLogger = setLogger; - self.disable = () => { - unregisterGlobal(API_NAME, self); - }; - self.createComponentLogger = (options) => { - return new DiagComponentLogger(options); - }; - self.verbose = _logProxy('verbose'); - self.debug = _logProxy('debug'); - self.info = _logProxy('info'); - self.warn = _logProxy('warn'); - self.error = _logProxy('error'); - } -} -//# sourceMappingURL=diag.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/diag.js.map b/node_modules/@opentelemetry/api/build/esm/api/diag.js.map deleted file mode 100644 index 7f724bc..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/diag.js.map +++ /dev/null @@ -1 +0,0 @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AC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CAqBF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DiagComponentLogger } from '../diag/ComponentLogger';\nimport { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';\nimport type {\n ComponentLoggerOptions,\n DiagLogFunction,\n DiagLogger,\n DiagLoggerApi,\n} from '../diag/types';\nimport { DiagLogLevel } from '../diag/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\n\nconst API_NAME = 'diag';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry internal\n * diagnostic API\n *\n * @since 1.0.0\n */\nexport class DiagAPI implements DiagLogger, DiagLoggerApi {\n private static _instance?: DiagAPI;\n\n /** Get the singleton instance of the DiagAPI API */\n public static instance(): DiagAPI {\n if (!this._instance) {\n this._instance = new DiagAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Private internal constructor\n * @private\n */\n private constructor() {\n function _logProxy(funcName: keyof DiagLogger): DiagLogFunction {\n return function (...args) {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) return;\n return logger[funcName](...args);\n };\n }\n\n // Using self local variable for minification purposes as 'this' cannot be minified\n const self = this;\n\n // DiagAPI specific functions\n\n const setLogger: DiagLoggerApi['setLogger'] = (\n logger,\n optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }\n ) => {\n if (logger === self) {\n // There isn't much we can do here.\n // Logging to the console might break the user application.\n // Try to log to self. If a logger was previously registered it will receive the log.\n const err = new Error(\n 'Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'\n );\n self.error(err.stack ?? err.message);\n return false;\n }\n\n if (typeof optionsOrLogLevel === 'number') {\n optionsOrLogLevel = {\n logLevel: optionsOrLogLevel,\n };\n }\n\n const oldLogger = getGlobal('diag');\n const newLogger = createLogLevelDiagLogger(\n optionsOrLogLevel.logLevel ?? DiagLogLevel.INFO,\n logger\n );\n // There already is an logger registered. We'll let it know before overwriting it.\n if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {\n const stack = new Error().stack ?? '';\n oldLogger.warn(`Current logger will be overwritten from ${stack}`);\n newLogger.warn(\n `Current logger will overwrite one already registered from ${stack}`\n );\n }\n\n return registerGlobal('diag', newLogger, self, true);\n };\n\n self.setLogger = setLogger;\n\n self.disable = () => {\n unregisterGlobal(API_NAME, self);\n };\n\n self.createComponentLogger = (options: ComponentLoggerOptions) => {\n return new DiagComponentLogger(options);\n };\n\n self.verbose = _logProxy('verbose');\n self.debug = _logProxy('debug');\n self.info = _logProxy('info');\n self.warn = _logProxy('warn');\n self.error = _logProxy('error');\n }\n\n public setLogger!: DiagLoggerApi['setLogger'];\n /**\n *\n */\n public createComponentLogger!: (\n options: ComponentLoggerOptions\n ) => DiagLogger;\n\n // DiagLogger implementation\n public verbose!: DiagLogFunction;\n public debug!: DiagLogFunction;\n public info!: DiagLogFunction;\n public warn!: DiagLogFunction;\n public error!: DiagLogFunction;\n\n /**\n * Unregister the global logger and return to Noop\n */\n public disable!: () => void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/metrics.d.ts b/node_modules/@opentelemetry/api/build/esm/api/metrics.d.ts deleted file mode 100644 index 09d2147..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/metrics.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Meter, MeterOptions } from '../metrics/Meter'; -import type { MeterProvider } from '../metrics/MeterProvider'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Metrics API - */ -export declare class MetricsAPI { - private static _instance?; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Metrics API */ - static getInstance(): MetricsAPI; - /** - * Set the current global meter provider. - * Returns true if the meter provider was successfully registered, else false. - */ - setGlobalMeterProvider(provider: MeterProvider): boolean; - /** - * Returns the global meter provider. - */ - getMeterProvider(): MeterProvider; - /** - * Returns a meter from the global meter provider. - */ - getMeter(name: string, version?: string, options?: MeterOptions): Meter; - /** Remove the global meter provider */ - disable(): void; -} -//# sourceMappingURL=metrics.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/metrics.js b/node_modules/@opentelemetry/api/build/esm/api/metrics.js deleted file mode 100644 index 20c82f3..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/metrics.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider'; -import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils'; -import { DiagAPI } from './diag'; -const API_NAME = 'metrics'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Metrics API - */ -export class MetricsAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { } - /** Get the singleton instance of the Metrics API */ - static getInstance() { - if (!this._instance) { - this._instance = new MetricsAPI(); - } - return this._instance; - } - /** - * Set the current global meter provider. - * Returns true if the meter provider was successfully registered, else false. - */ - setGlobalMeterProvider(provider) { - return registerGlobal(API_NAME, provider, DiagAPI.instance()); - } - /** - * Returns the global meter provider. - */ - getMeterProvider() { - return getGlobal(API_NAME) || NOOP_METER_PROVIDER; - } - /** - * Returns a meter from the global meter provider. - */ - getMeter(name, version, options) { - return this.getMeterProvider().getMeter(name, version, options); - } - /** Remove the global meter provider */ - disable() { - unregisterGlobal(API_NAME, DiagAPI.instance()); - } -} -//# sourceMappingURL=metrics.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/metrics.js.map b/node_modules/@opentelemetry/api/build/esm/api/metrics.js.map deleted file mode 100644 index d760f14..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/metrics.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/api/metrics.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAE3B;;GAEG;AACH,MAAM,OAAO,UAAU;IAGrB,+FAA+F;IAC/F,gBAAuB,CAAC;IAExB,oDAAoD;IAC7C,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,UAAU,EAAE,CAAC;SACnC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,sBAAsB,CAAC,QAAuB;QACnD,OAAO,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,mBAAmB,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,QAAQ,CACb,IAAY,EACZ,OAAgB,EAChB,OAAsB;QAEtB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,uCAAuC;IAChC,OAAO;QACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter, MeterOptions } from '../metrics/Meter';\nimport type { MeterProvider } from '../metrics/MeterProvider';\nimport { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'metrics';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Metrics API\n */\nexport class MetricsAPI {\n private static _instance?: MetricsAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Metrics API */\n public static getInstance(): MetricsAPI {\n if (!this._instance) {\n this._instance = new MetricsAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current global meter provider.\n * Returns true if the meter provider was successfully registered, else false.\n */\n public setGlobalMeterProvider(provider: MeterProvider): boolean {\n return registerGlobal(API_NAME, provider, DiagAPI.instance());\n }\n\n /**\n * Returns the global meter provider.\n */\n public getMeterProvider(): MeterProvider {\n return getGlobal(API_NAME) || NOOP_METER_PROVIDER;\n }\n\n /**\n * Returns a meter from the global meter provider.\n */\n public getMeter(\n name: string,\n version?: string,\n options?: MeterOptions\n ): Meter {\n return this.getMeterProvider().getMeter(name, version, options);\n }\n\n /** Remove the global meter provider */\n public disable(): void {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/propagation.d.ts b/node_modules/@opentelemetry/api/build/esm/api/propagation.d.ts deleted file mode 100644 index 1ef2c0b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/propagation.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { Context } from '../context/types'; -import type { TextMapGetter, TextMapPropagator, TextMapSetter } from '../propagation/TextMapPropagator'; -import { getBaggage, getActiveBaggage, setBaggage, deleteBaggage } from '../baggage/context-helpers'; -import { createBaggage } from '../baggage/utils'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Propagation API - * - * @since 1.0.0 - */ -export declare class PropagationAPI { - private static _instance?; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Propagator API */ - static getInstance(): PropagationAPI; - /** - * Set the current propagator. - * - * @returns true if the propagator was successfully registered, else false - */ - setGlobalPropagator(propagator: TextMapPropagator): boolean; - /** - * Inject context into a carrier to be propagated inter-process - * - * @param context Context carrying tracing data to inject - * @param carrier carrier to inject context into - * @param setter Function used to set values on the carrier - */ - inject(context: Context, carrier: Carrier, setter?: TextMapSetter): void; - /** - * Extract context from a carrier - * - * @param context Context which the newly created context will inherit from - * @param carrier Carrier to extract context from - * @param getter Function used to extract keys from a carrier - */ - extract(context: Context, carrier: Carrier, getter?: TextMapGetter): Context; - /** - * Return a list of all fields which may be used by the propagator. - */ - fields(): string[]; - /** Remove the global propagator */ - disable(): void; - createBaggage: typeof createBaggage; - getBaggage: typeof getBaggage; - getActiveBaggage: typeof getActiveBaggage; - setBaggage: typeof setBaggage; - deleteBaggage: typeof deleteBaggage; - private _getGlobalPropagator; -} -//# sourceMappingURL=propagation.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/propagation.js b/node_modules/@opentelemetry/api/build/esm/api/propagation.js deleted file mode 100644 index ffe4f4b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/propagation.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils'; -import { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator'; -import { defaultTextMapGetter, defaultTextMapSetter, } from '../propagation/TextMapPropagator'; -import { getBaggage, getActiveBaggage, setBaggage, deleteBaggage, } from '../baggage/context-helpers'; -import { createBaggage } from '../baggage/utils'; -import { DiagAPI } from './diag'; -const API_NAME = 'propagation'; -const NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Propagation API - * - * @since 1.0.0 - */ -export class PropagationAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this.createBaggage = createBaggage; - this.getBaggage = getBaggage; - this.getActiveBaggage = getActiveBaggage; - this.setBaggage = setBaggage; - this.deleteBaggage = deleteBaggage; - } - /** Get the singleton instance of the Propagator API */ - static getInstance() { - if (!this._instance) { - this._instance = new PropagationAPI(); - } - return this._instance; - } - /** - * Set the current propagator. - * - * @returns true if the propagator was successfully registered, else false - */ - setGlobalPropagator(propagator) { - return registerGlobal(API_NAME, propagator, DiagAPI.instance()); - } - /** - * Inject context into a carrier to be propagated inter-process - * - * @param context Context carrying tracing data to inject - * @param carrier carrier to inject context into - * @param setter Function used to set values on the carrier - */ - inject(context, carrier, setter = defaultTextMapSetter) { - return this._getGlobalPropagator().inject(context, carrier, setter); - } - /** - * Extract context from a carrier - * - * @param context Context which the newly created context will inherit from - * @param carrier Carrier to extract context from - * @param getter Function used to extract keys from a carrier - */ - extract(context, carrier, getter = defaultTextMapGetter) { - return this._getGlobalPropagator().extract(context, carrier, getter); - } - /** - * Return a list of all fields which may be used by the propagator. - */ - fields() { - return this._getGlobalPropagator().fields(); - } - /** Remove the global propagator */ - disable() { - unregisterGlobal(API_NAME, DiagAPI.instance()); - } - _getGlobalPropagator() { - return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR; - } -} -//# sourceMappingURL=propagation.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/propagation.js.map b/node_modules/@opentelemetry/api/build/esm/api/propagation.js.map deleted file mode 100644 index 75b33df..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/propagation.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../src/api/propagation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAM7E,OAAO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,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,MAAM;QACX,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC9C,CAAC;IAED,mCAAmC;IAC5B,OAAO;QACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAYO,oBAAoB;QAC1B,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,wBAAwB,CAAC;IACzD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator';\nimport type {\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n} from '../propagation/TextMapPropagator';\nimport {\n defaultTextMapGetter,\n defaultTextMapSetter,\n} from '../propagation/TextMapPropagator';\nimport {\n getBaggage,\n getActiveBaggage,\n setBaggage,\n deleteBaggage,\n} from '../baggage/context-helpers';\nimport { createBaggage } from '../baggage/utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'propagation';\nconst NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Propagation API\n *\n * @since 1.0.0\n */\nexport class PropagationAPI {\n private static _instance?: PropagationAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Propagator API */\n public static getInstance(): PropagationAPI {\n if (!this._instance) {\n this._instance = new PropagationAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current propagator.\n *\n * @returns true if the propagator was successfully registered, else false\n */\n public setGlobalPropagator(propagator: TextMapPropagator): boolean {\n return registerGlobal(API_NAME, propagator, DiagAPI.instance());\n }\n\n /**\n * Inject context into a carrier to be propagated inter-process\n *\n * @param context Context carrying tracing data to inject\n * @param carrier carrier to inject context into\n * @param setter Function used to set values on the carrier\n */\n public inject(\n context: Context,\n carrier: Carrier,\n setter: TextMapSetter = defaultTextMapSetter\n ): void {\n return this._getGlobalPropagator().inject(context, carrier, setter);\n }\n\n /**\n * Extract context from a carrier\n *\n * @param context Context which the newly created context will inherit from\n * @param carrier Carrier to extract context from\n * @param getter Function used to extract keys from a carrier\n */\n public extract(\n context: Context,\n carrier: Carrier,\n getter: TextMapGetter = defaultTextMapGetter\n ): Context {\n return this._getGlobalPropagator().extract(context, carrier, getter);\n }\n\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n public fields(): string[] {\n return this._getGlobalPropagator().fields();\n }\n\n /** Remove the global propagator */\n public disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n\n public createBaggage = createBaggage;\n\n public getBaggage = getBaggage;\n\n public getActiveBaggage = getActiveBaggage;\n\n public setBaggage = setBaggage;\n\n public deleteBaggage = deleteBaggage;\n\n private _getGlobalPropagator(): TextMapPropagator {\n return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/trace.d.ts b/node_modules/@opentelemetry/api/build/esm/api/trace.d.ts deleted file mode 100644 index 1f4efd4..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/trace.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { isSpanContextValid, wrapSpanContext } from '../trace/spancontext-utils'; -import type { Tracer } from '../trace/tracer'; -import type { TracerProvider } from '../trace/tracer_provider'; -import { deleteSpan, getActiveSpan, getSpan, getSpanContext, setSpan, setSpanContext } from '../trace/context-utils'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Tracing API - * - * @since 1.0.0 - */ -export declare class TraceAPI { - private static _instance?; - private _proxyTracerProvider; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Trace API */ - static getInstance(): TraceAPI; - /** - * Set the current global tracer. - * - * @returns true if the tracer provider was successfully registered, else false - */ - setGlobalTracerProvider(provider: TracerProvider): boolean; - /** - * Returns the global tracer provider. - */ - getTracerProvider(): TracerProvider; - /** - * Returns a tracer from the global tracer provider. - */ - getTracer(name: string, version?: string): Tracer; - /** Remove the global tracer provider */ - disable(): void; - wrapSpanContext: typeof wrapSpanContext; - isSpanContextValid: typeof isSpanContextValid; - deleteSpan: typeof deleteSpan; - getSpan: typeof getSpan; - getActiveSpan: typeof getActiveSpan; - getSpanContext: typeof getSpanContext; - setSpan: typeof setSpan; - setSpanContext: typeof setSpanContext; -} -//# sourceMappingURL=trace.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/trace.js b/node_modules/@opentelemetry/api/build/esm/api/trace.js deleted file mode 100644 index 9f667ed..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/trace.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils'; -import { ProxyTracerProvider } from '../trace/ProxyTracerProvider'; -import { isSpanContextValid, wrapSpanContext, } from '../trace/spancontext-utils'; -import { deleteSpan, getActiveSpan, getSpan, getSpanContext, setSpan, setSpanContext, } from '../trace/context-utils'; -import { DiagAPI } from './diag'; -const API_NAME = 'trace'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Tracing API - * - * @since 1.0.0 - */ -export class TraceAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._proxyTracerProvider = new ProxyTracerProvider(); - this.wrapSpanContext = wrapSpanContext; - this.isSpanContextValid = isSpanContextValid; - this.deleteSpan = deleteSpan; - this.getSpan = getSpan; - this.getActiveSpan = getActiveSpan; - this.getSpanContext = getSpanContext; - this.setSpan = setSpan; - this.setSpanContext = setSpanContext; - } - /** Get the singleton instance of the Trace API */ - static getInstance() { - if (!this._instance) { - this._instance = new TraceAPI(); - } - return this._instance; - } - /** - * Set the current global tracer. - * - * @returns true if the tracer provider was successfully registered, else false - */ - setGlobalTracerProvider(provider) { - const success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance()); - if (success) { - this._proxyTracerProvider.setDelegate(provider); - } - return success; - } - /** - * Returns the global tracer provider. - */ - getTracerProvider() { - return getGlobal(API_NAME) || this._proxyTracerProvider; - } - /** - * Returns a tracer from the global tracer provider. - */ - getTracer(name, version) { - return this.getTracerProvider().getTracer(name, version); - } - /** Remove the global tracer provider */ - disable() { - unregisterGlobal(API_NAME, DiagAPI.instance()); - this._proxyTracerProvider = new ProxyTracerProvider(); - } -} -//# sourceMappingURL=trace.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/api/trace.js.map b/node_modules/@opentelemetry/api/build/esm/api/trace.js.map deleted file mode 100644 index 729a05c..0000000 --- a/node_modules/@opentelemetry/api/build/esm/api/trace.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/api/trace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,kBAAkB,EAClB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,UAAU,EACV,aAAa,EACb,OAAO,EACP,cAAc,EACd,OAAO,EACP,cAAc,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,OAAO,CAAC;AAEzB;;;;GAIG;AACH,MAAM,OAAO,QAAQ;IAKnB,+FAA+F;IAC/F;QAHQ,yBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAmDlD,oBAAe,GAAG,eAAe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registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { ProxyTracerProvider } from '../trace/ProxyTracerProvider';\nimport {\n isSpanContextValid,\n wrapSpanContext,\n} from '../trace/spancontext-utils';\nimport type { Tracer } from '../trace/tracer';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport {\n deleteSpan,\n getActiveSpan,\n getSpan,\n getSpanContext,\n setSpan,\n setSpanContext,\n} from '../trace/context-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'trace';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Tracing API\n *\n * @since 1.0.0\n */\nexport class TraceAPI {\n private static _instance?: TraceAPI;\n\n private _proxyTracerProvider = new ProxyTracerProvider();\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Trace API */\n public static getInstance(): TraceAPI {\n if (!this._instance) {\n this._instance = new TraceAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current global tracer.\n *\n * @returns true if the tracer provider was successfully registered, else false\n */\n public setGlobalTracerProvider(provider: TracerProvider): boolean {\n const success = registerGlobal(\n API_NAME,\n this._proxyTracerProvider,\n DiagAPI.instance()\n );\n if (success) {\n this._proxyTracerProvider.setDelegate(provider);\n }\n return success;\n }\n\n /**\n * Returns the global tracer provider.\n */\n public getTracerProvider(): TracerProvider {\n return getGlobal(API_NAME) || this._proxyTracerProvider;\n }\n\n /**\n * Returns a tracer from the global tracer provider.\n */\n public getTracer(name: string, version?: string): Tracer {\n return this.getTracerProvider().getTracer(name, version);\n }\n\n /** Remove the global tracer provider */\n public disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n this._proxyTracerProvider = new ProxyTracerProvider();\n }\n\n public wrapSpanContext = wrapSpanContext;\n\n public isSpanContextValid = isSpanContextValid;\n\n public deleteSpan = deleteSpan;\n\n public getSpan = getSpan;\n\n public getActiveSpan = getActiveSpan;\n\n public getSpanContext = getSpanContext;\n\n public setSpan = setSpan;\n\n public setSpanContext = setSpanContext;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.d.ts b/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.d.ts deleted file mode 100644 index 39278cb..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { Context } from '../context/types'; -import type { Baggage } from './types'; -/** - * Retrieve the current baggage from the given context - * - * @param {Context} Context that manage all context values - * @returns {Baggage} Extracted baggage from the context - */ -export declare function getBaggage(context: Context): Baggage | undefined; -/** - * Retrieve the current baggage from the active/current context - * - * @returns {Baggage} Extracted baggage from the context - */ -export declare function getActiveBaggage(): Baggage | undefined; -/** - * Store a baggage in the given context - * - * @param {Context} Context that manage all context values - * @param {Baggage} baggage that will be set in the actual context - */ -export declare function setBaggage(context: Context, baggage: Baggage): Context; -/** - * Delete the baggage stored in the given context - * - * @param {Context} Context that manage all context values - */ -export declare function deleteBaggage(context: Context): Context; -//# sourceMappingURL=context-helpers.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js b/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js deleted file mode 100644 index 739f2c7..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { ContextAPI } from '../api/context'; -import { createContextKey } from '../context/context'; -/** - * Baggage key - */ -const BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key'); -/** - * Retrieve the current baggage from the given context - * - * @param {Context} Context that manage all context values - * @returns {Baggage} Extracted baggage from the context - */ -export function getBaggage(context) { - return context.getValue(BAGGAGE_KEY) || undefined; -} -/** - * Retrieve the current baggage from the active/current context - * - * @returns {Baggage} Extracted baggage from the context - */ -export function getActiveBaggage() { - return getBaggage(ContextAPI.getInstance().active()); -} -/** - * Store a baggage in the given context - * - * @param {Context} Context that manage all context values - * @param {Baggage} baggage that will be set in the actual context - */ -export function setBaggage(context, baggage) { - return context.setValue(BAGGAGE_KEY, baggage); -} -/** - * Delete the baggage stored in the given context - * - * @param {Context} Context that manage all context values - */ -export function deleteBaggage(context) { - return context.deleteValue(BAGGAGE_KEY); -} -//# sourceMappingURL=context-helpers.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js.map b/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js.map deleted file mode 100644 index ce5d7bb..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context-helpers.js","sourceRoot":"","sources":["../../../src/baggage/context-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD;;GAEG;AACH,MAAM,WAAW,GAAG,gBAAgB,CAAC,2BAA2B,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAQ,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa,IAAI,SAAS,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AACvD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,OAAgB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ContextAPI } from '../api/context';\nimport { createContextKey } from '../context/context';\nimport type { Context } from '../context/types';\nimport type { Baggage } from './types';\n\n/**\n * Baggage key\n */\nconst BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');\n\n/**\n * Retrieve the current baggage from the given context\n *\n * @param {Context} Context that manage all context values\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getBaggage(context: Context): Baggage | undefined {\n return (context.getValue(BAGGAGE_KEY) as Baggage) || undefined;\n}\n\n/**\n * Retrieve the current baggage from the active/current context\n *\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getActiveBaggage(): Baggage | undefined {\n return getBaggage(ContextAPI.getInstance().active());\n}\n\n/**\n * Store a baggage in the given context\n *\n * @param {Context} Context that manage all context values\n * @param {Baggage} baggage that will be set in the actual context\n */\nexport function setBaggage(context: Context, baggage: Baggage): Context {\n return context.setValue(BAGGAGE_KEY, baggage);\n}\n\n/**\n * Delete the baggage stored in the given context\n *\n * @param {Context} Context that manage all context values\n */\nexport function deleteBaggage(context: Context): Context {\n return context.deleteValue(BAGGAGE_KEY);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.d.ts b/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.d.ts deleted file mode 100644 index e6b4554..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Baggage, BaggageEntry } from '../types'; -export declare class BaggageImpl implements Baggage { - private _entries; - constructor(entries?: Map); - getEntry(key: string): BaggageEntry | undefined; - getAllEntries(): [string, BaggageEntry][]; - setEntry(key: string, entry: BaggageEntry): BaggageImpl; - removeEntry(key: string): BaggageImpl; - removeEntries(...keys: string[]): BaggageImpl; - clear(): BaggageImpl; -} -//# sourceMappingURL=baggage-impl.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js b/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js deleted file mode 100644 index 129a258..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export class BaggageImpl { - constructor(entries) { - this._entries = entries ? new Map(entries) : new Map(); - } - getEntry(key) { - const entry = this._entries.get(key); - if (!entry) { - return undefined; - } - return Object.assign({}, entry); - } - getAllEntries() { - return Array.from(this._entries.entries()); - } - setEntry(key, entry) { - const newBaggage = new BaggageImpl(this._entries); - newBaggage._entries.set(key, entry); - return newBaggage; - } - removeEntry(key) { - const newBaggage = new BaggageImpl(this._entries); - newBaggage._entries.delete(key); - return newBaggage; - } - removeEntries(...keys) { - const newBaggage = new BaggageImpl(this._entries); - for (const key of keys) { - newBaggage._entries.delete(key); - } - return newBaggage; - } - clear() { - return new BaggageImpl(); - } -} -//# sourceMappingURL=baggage-impl.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js.map b/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js.map deleted file mode 100644 index eae0ece..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"baggage-impl.js","sourceRoot":"","sources":["../../../../src/baggage/internal/baggage-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,OAAO,WAAW;IAGtB,YAAY,OAAmC;QAC7C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IACzD,CAAC;IAED,QAAQ,CAAC,GAAW;QAClB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,aAAa;QACX,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAmB;QACvC,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACpC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,WAAW,CAAC,GAAW;QACrB,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,aAAa,CAAC,GAAG,IAAc;QAC7B,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACjC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Baggage, BaggageEntry } from '../types';\n\nexport class BaggageImpl implements Baggage {\n private _entries: Map;\n\n constructor(entries?: Map) {\n this._entries = entries ? new Map(entries) : new Map();\n }\n\n getEntry(key: string): BaggageEntry | undefined {\n const entry = this._entries.get(key);\n if (!entry) {\n return undefined;\n }\n\n return Object.assign({}, entry);\n }\n\n getAllEntries(): [string, BaggageEntry][] {\n return Array.from(this._entries.entries());\n }\n\n setEntry(key: string, entry: BaggageEntry): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.set(key, entry);\n return newBaggage;\n }\n\n removeEntry(key: string): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.delete(key);\n return newBaggage;\n }\n\n removeEntries(...keys: string[]): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n for (const key of keys) {\n newBaggage._entries.delete(key);\n }\n return newBaggage;\n }\n\n clear(): BaggageImpl {\n return new BaggageImpl();\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.d.ts b/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.d.ts deleted file mode 100644 index 9cd991c..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Symbol used to make BaggageEntryMetadata an opaque type - */ -export declare const baggageEntryMetadataSymbol: unique symbol; -//# sourceMappingURL=symbol.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.js b/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.js deleted file mode 100644 index 9aed0c9..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * Symbol used to make BaggageEntryMetadata an opaque type - */ -export const baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata'); -//# sourceMappingURL=symbol.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.js.map b/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.js.map deleted file mode 100644 index 62546b8..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"symbol.js","sourceRoot":"","sources":["../../../../src/baggage/internal/symbol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Symbol used to make BaggageEntryMetadata an opaque type\n */\nexport const baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata');\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/types.d.ts b/node_modules/@opentelemetry/api/build/esm/baggage/types.d.ts deleted file mode 100644 index 43eaa4a..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/types.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -import type { baggageEntryMetadataSymbol } from './internal/symbol'; -/** - * @since 1.0.0 - */ -export interface BaggageEntry { - /** `String` value of the `BaggageEntry`. */ - value: string; - /** - * Metadata is an optional string property defined by the W3C baggage specification. - * It currently has no special meaning defined by the specification. - */ - metadata?: BaggageEntryMetadata; -} -/** - * Serializable Metadata defined by the W3C baggage specification. - * It currently has no special meaning defined by the OpenTelemetry or W3C. - * - * @since 1.0.0 - */ -export type BaggageEntryMetadata = { - toString(): string; -} & { - __TYPE__: typeof baggageEntryMetadataSymbol; -}; -/** - * Baggage represents collection of key-value pairs with optional metadata. - * Each key of Baggage is associated with exactly one value. - * Baggage may be used to annotate and enrich telemetry data. - * - * @since 1.0.0 - */ -export interface Baggage { - /** - * Get an entry from Baggage if it exists - * - * @param key The key which identifies the BaggageEntry - */ - getEntry(key: string): BaggageEntry | undefined; - /** - * Get a list of all entries in the Baggage - */ - getAllEntries(): [string, BaggageEntry][]; - /** - * Returns a new baggage with the entries from the current bag and the specified entry - * - * @param key string which identifies the baggage entry - * @param entry BaggageEntry for the given key - */ - setEntry(key: string, entry: BaggageEntry): Baggage; - /** - * Returns a new baggage with the entries from the current bag except the removed entry - * - * @param key key identifying the entry to be removed - */ - removeEntry(key: string): Baggage; - /** - * Returns a new baggage with the entries from the current bag except the removed entries - * - * @param key keys identifying the entries to be removed - */ - removeEntries(...key: string[]): Baggage; - /** - * Returns a new baggage with no entries - */ - clear(): Baggage; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/types.js b/node_modules/@opentelemetry/api/build/esm/baggage/types.js deleted file mode 100644 index 70b3a72..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/types.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/types.js.map b/node_modules/@opentelemetry/api/build/esm/baggage/types.js.map deleted file mode 100644 index 84d490e..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/baggage/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { baggageEntryMetadataSymbol } from './internal/symbol';\n\n/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface BaggageEntry {\n /** `String` value of the `BaggageEntry`. */\n value: string;\n /**\n * Metadata is an optional string property defined by the W3C baggage specification.\n * It currently has no special meaning defined by the specification.\n */\n metadata?: BaggageEntryMetadata;\n}\n\n/**\n * Serializable Metadata defined by the W3C baggage specification.\n * It currently has no special meaning defined by the OpenTelemetry or W3C.\n *\n * @since 1.0.0\n */\nexport type BaggageEntryMetadata = { toString(): string } & {\n __TYPE__: typeof baggageEntryMetadataSymbol;\n};\n\n/**\n * Baggage represents collection of key-value pairs with optional metadata.\n * Each key of Baggage is associated with exactly one value.\n * Baggage may be used to annotate and enrich telemetry data.\n *\n * @since 1.0.0\n */\nexport interface Baggage {\n /**\n * Get an entry from Baggage if it exists\n *\n * @param key The key which identifies the BaggageEntry\n */\n getEntry(key: string): BaggageEntry | undefined;\n\n /**\n * Get a list of all entries in the Baggage\n */\n getAllEntries(): [string, BaggageEntry][];\n\n /**\n * Returns a new baggage with the entries from the current bag and the specified entry\n *\n * @param key string which identifies the baggage entry\n * @param entry BaggageEntry for the given key\n */\n setEntry(key: string, entry: BaggageEntry): Baggage;\n\n /**\n * Returns a new baggage with the entries from the current bag except the removed entry\n *\n * @param key key identifying the entry to be removed\n */\n removeEntry(key: string): Baggage;\n\n /**\n * Returns a new baggage with the entries from the current bag except the removed entries\n *\n * @param key keys identifying the entries to be removed\n */\n removeEntries(...key: string[]): Baggage;\n\n /**\n * Returns a new baggage with no entries\n */\n clear(): Baggage;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/utils.d.ts b/node_modules/@opentelemetry/api/build/esm/baggage/utils.d.ts deleted file mode 100644 index c58ba53..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/utils.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { Baggage, BaggageEntry, BaggageEntryMetadata } from './types'; -/** - * Create a new Baggage with optional entries - * - * @param entries An array of baggage entries the new baggage should contain - */ -export declare function createBaggage(entries?: Record): Baggage; -/** - * Create a serializable BaggageEntryMetadata object from a string. - * - * @param str string metadata. Format is currently not defined by the spec and has no special meaning. - * - * @since 1.0.0 - */ -export declare function baggageEntryMetadataFromString(str: string): BaggageEntryMetadata; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/utils.js b/node_modules/@opentelemetry/api/build/esm/baggage/utils.js deleted file mode 100644 index b57ff2b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/utils.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { DiagAPI } from '../api/diag'; -import { BaggageImpl } from './internal/baggage-impl'; -import { baggageEntryMetadataSymbol } from './internal/symbol'; -const diag = DiagAPI.instance(); -/** - * Create a new Baggage with optional entries - * - * @param entries An array of baggage entries the new baggage should contain - */ -export function createBaggage(entries = {}) { - return new BaggageImpl(new Map(Object.entries(entries))); -} -/** - * Create a serializable BaggageEntryMetadata object from a string. - * - * @param str string metadata. Format is currently not defined by the spec and has no special meaning. - * - * @since 1.0.0 - */ -export function baggageEntryMetadataFromString(str) { - if (typeof str !== 'string') { - diag.error(`Cannot create baggage metadata from unknown type: ${typeof str}`); - str = ''; - } - return { - __TYPE__: baggageEntryMetadataSymbol, - toString() { - return str; - }, - }; -} -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/baggage/utils.js.map b/node_modules/@opentelemetry/api/build/esm/baggage/utils.js.map deleted file mode 100644 index 2232f2b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/baggage/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/baggage/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,UAAwC,EAAE;IAE1C,OAAO,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC5C,GAAW;IAEX,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,IAAI,CAAC,KAAK,CACR,qDAAqD,OAAO,GAAG,EAAE,CAClE,CAAC;QACF,GAAG,GAAG,EAAE,CAAC;KACV;IAED,OAAO;QACL,QAAQ,EAAE,0BAA0B;QACpC,QAAQ;YACN,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DiagAPI } from '../api/diag';\nimport { BaggageImpl } from './internal/baggage-impl';\nimport { baggageEntryMetadataSymbol } from './internal/symbol';\nimport type { Baggage, BaggageEntry, BaggageEntryMetadata } from './types';\n\nconst diag = DiagAPI.instance();\n\n/**\n * Create a new Baggage with optional entries\n *\n * @param entries An array of baggage entries the new baggage should contain\n */\nexport function createBaggage(\n entries: Record = {}\n): Baggage {\n return new BaggageImpl(new Map(Object.entries(entries)));\n}\n\n/**\n * Create a serializable BaggageEntryMetadata object from a string.\n *\n * @param str string metadata. Format is currently not defined by the spec and has no special meaning.\n *\n * @since 1.0.0\n */\nexport function baggageEntryMetadataFromString(\n str: string\n): BaggageEntryMetadata {\n if (typeof str !== 'string') {\n diag.error(\n `Cannot create baggage metadata from unknown type: ${typeof str}`\n );\n str = '';\n }\n\n return {\n __TYPE__: baggageEntryMetadataSymbol,\n toString() {\n return str;\n },\n };\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/common/Attributes.d.ts b/node_modules/@opentelemetry/api/build/esm/common/Attributes.d.ts deleted file mode 100644 index 99a72b3..0000000 --- a/node_modules/@opentelemetry/api/build/esm/common/Attributes.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Attributes is a map from string to attribute values. - * - * Note: only the own enumerable keys are counted as valid attribute keys. - * - * @since 1.3.0 - */ -export interface Attributes { - [attributeKey: string]: AttributeValue | undefined; -} -/** - * Attribute values may be any non-nullish primitive value except an object. - * - * null or undefined attribute values are invalid and will result in undefined behavior. - * - * @since 1.3.0 - */ -export type AttributeValue = string | number | boolean | Array | Array | Array; -//# sourceMappingURL=Attributes.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/common/Attributes.js b/node_modules/@opentelemetry/api/build/esm/common/Attributes.js deleted file mode 100644 index 4cf7a82..0000000 --- a/node_modules/@opentelemetry/api/build/esm/common/Attributes.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=Attributes.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/common/Attributes.js.map b/node_modules/@opentelemetry/api/build/esm/common/Attributes.js.map deleted file mode 100644 index 1a23f4e..0000000 --- a/node_modules/@opentelemetry/api/build/esm/common/Attributes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Attributes.js","sourceRoot":"","sources":["../../../src/common/Attributes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Attributes is a map from string to attribute values.\n *\n * Note: only the own enumerable keys are counted as valid attribute keys.\n *\n * @since 1.3.0\n */\nexport interface Attributes {\n [attributeKey: string]: AttributeValue | undefined;\n}\n\n/**\n * Attribute values may be any non-nullish primitive value except an object.\n *\n * null or undefined attribute values are invalid and will result in undefined behavior.\n *\n * @since 1.3.0\n */\nexport type AttributeValue =\n | string\n | number\n | boolean\n | Array\n | Array\n | Array;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/common/Exception.d.ts b/node_modules/@opentelemetry/api/build/esm/common/Exception.d.ts deleted file mode 100644 index 704fec1..0000000 --- a/node_modules/@opentelemetry/api/build/esm/common/Exception.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -interface ExceptionWithCode { - code: string | number; - name?: string; - message?: string; - stack?: string; -} -interface ExceptionWithMessage { - code?: string | number; - message: string; - name?: string; - stack?: string; -} -interface ExceptionWithName { - code?: string | number; - message?: string; - name: string; - stack?: string; -} -/** - * Defines Exception. - * - * string or an object with one of (message or name or code) and optional stack - * - * @since 1.0.0 - */ -export type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string; -export {}; -//# sourceMappingURL=Exception.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/common/Exception.js b/node_modules/@opentelemetry/api/build/esm/common/Exception.js deleted file mode 100644 index 0a64e53..0000000 --- a/node_modules/@opentelemetry/api/build/esm/common/Exception.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=Exception.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/common/Exception.js.map b/node_modules/@opentelemetry/api/build/esm/common/Exception.js.map deleted file mode 100644 index 83d006c..0000000 --- a/node_modules/@opentelemetry/api/build/esm/common/Exception.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/common/Exception.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\ninterface ExceptionWithCode {\n code: string | number;\n name?: string;\n message?: string;\n stack?: string;\n}\n\ninterface ExceptionWithMessage {\n code?: string | number;\n message: string;\n name?: string;\n stack?: string;\n}\n\ninterface ExceptionWithName {\n code?: string | number;\n message?: string;\n name: string;\n stack?: string;\n}\n\n/**\n * Defines Exception.\n *\n * string or an object with one of (message or name or code) and optional stack\n *\n * @since 1.0.0\n */\nexport type Exception =\n | ExceptionWithCode\n | ExceptionWithMessage\n | ExceptionWithName\n | string;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/common/Time.d.ts b/node_modules/@opentelemetry/api/build/esm/common/Time.d.ts deleted file mode 100644 index 265d617..0000000 --- a/node_modules/@opentelemetry/api/build/esm/common/Time.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Defines High-Resolution Time. - * - * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970. - * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds. - * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150. - * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds: - * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210. - * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds: - * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000. - * This is represented in HrTime format as [1609504210, 150000000]. - * - * @since 1.0.0 - */ -export type HrTime = [number, number]; -/** - * Defines TimeInput. - * - * hrtime, epoch milliseconds, performance.now() or Date - * - * @since 1.0.0 - */ -export type TimeInput = HrTime | number | Date; -//# sourceMappingURL=Time.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/common/Time.js b/node_modules/@opentelemetry/api/build/esm/common/Time.js deleted file mode 100644 index 2abdf58..0000000 --- a/node_modules/@opentelemetry/api/build/esm/common/Time.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=Time.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/common/Time.js.map b/node_modules/@opentelemetry/api/build/esm/common/Time.js.map deleted file mode 100644 index 77ac321..0000000 --- a/node_modules/@opentelemetry/api/build/esm/common/Time.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../src/common/Time.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Defines High-Resolution Time.\n *\n * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.\n * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.\n * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.\n * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:\n * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.\n * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:\n * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.\n * This is represented in HrTime format as [1609504210, 150000000].\n *\n * @since 1.0.0\n */\nexport type HrTime = [number, number];\n\n/**\n * Defines TimeInput.\n *\n * hrtime, epoch milliseconds, performance.now() or Date\n *\n * @since 1.0.0\n */\nexport type TimeInput = HrTime | number | Date;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context-api.d.ts b/node_modules/@opentelemetry/api/build/esm/context-api.d.ts deleted file mode 100644 index b842571..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context-api.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ContextAPI } from './api/context'; -/** - * Entrypoint for context API - * @since 1.0.0 - */ -export declare const context: ContextAPI; -//# sourceMappingURL=context-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context-api.js b/node_modules/@opentelemetry/api/build/esm/context-api.js deleted file mode 100644 index 24d4373..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context-api.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { ContextAPI } from './api/context'; -/** - * Entrypoint for context API - * @since 1.0.0 - */ -export const context = ContextAPI.getInstance(); -//# sourceMappingURL=context-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context-api.js.map b/node_modules/@opentelemetry/api/build/esm/context-api.js.map deleted file mode 100644 index 125de4c..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context-api.js","sourceRoot":"","sources":["../../src/context-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { ContextAPI } from './api/context';\n/**\n * Entrypoint for context API\n * @since 1.0.0\n */\nexport const context = ContextAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.d.ts b/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.d.ts deleted file mode 100644 index d3599db..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type * as types from './types'; -export declare class NoopContextManager implements types.ContextManager { - active(): types.Context; - with ReturnType>(_context: types.Context, fn: F, thisArg?: ThisParameterType, ...args: A): ReturnType; - bind(_context: types.Context, target: T): T; - enable(): this; - disable(): this; -} -//# sourceMappingURL=NoopContextManager.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js b/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js deleted file mode 100644 index 40752d5..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { ROOT_CONTEXT } from './context'; -export class NoopContextManager { - active() { - return ROOT_CONTEXT; - } - with(_context, fn, thisArg, ...args) { - return fn.call(thisArg, ...args); - } - bind(_context, target) { - return target; - } - enable() { - return this; - } - disable() { - return this; - } -} -//# sourceMappingURL=NoopContextManager.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js.map b/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js.map deleted file mode 100644 index 9a52705..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopContextManager.js","sourceRoot":"","sources":["../../../src/context/NoopContextManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,OAAO,kBAAkB;IAC7B,MAAM;QACJ,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,IAAI,CACF,QAAuB,EACvB,EAAK,EACL,OAA8B,EAC9B,GAAG,IAAO;QAEV,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,CAAI,QAAuB,EAAE,MAAS;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ROOT_CONTEXT } from './context';\nimport type * as types from './types';\n\nexport class NoopContextManager implements types.ContextManager {\n active(): types.Context {\n return ROOT_CONTEXT;\n }\n\n with ReturnType>(\n _context: types.Context,\n fn: F,\n thisArg?: ThisParameterType,\n ...args: A\n ): ReturnType {\n return fn.call(thisArg, ...args);\n }\n\n bind(_context: types.Context, target: T): T {\n return target;\n }\n\n enable(): this {\n return this;\n }\n\n disable(): this {\n return this;\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context/context.d.ts b/node_modules/@opentelemetry/api/build/esm/context/context.d.ts deleted file mode 100644 index 8d0aa04..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context/context.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Context } from './types'; -/** - * Get a key to uniquely identify a context value - * - * @since 1.0.0 - */ -export declare function createContextKey(description: string): symbol; -/** - * The root context is used as the default parent context when there is no active context - * - * @since 1.0.0 - */ -export declare const ROOT_CONTEXT: Context; -//# sourceMappingURL=context.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context/context.js b/node_modules/@opentelemetry/api/build/esm/context/context.js deleted file mode 100644 index 79cf0e9..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context/context.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * Get a key to uniquely identify a context value - * - * @since 1.0.0 - */ -export function createContextKey(description) { - // The specification states that for the same input, multiple calls should - // return different keys. Due to the nature of the JS dependency management - // system, this creates problems where multiple versions of some package - // could hold different keys for the same property. - // - // Therefore, we use Symbol.for which returns the same key for the same input. - return Symbol.for(description); -} -class BaseContext { - /** - * Construct a new context which inherits values from an optional parent context. - * - * @param parentContext a context from which to inherit values - */ - constructor(parentContext) { - // for minification - const self = this; - self._currentContext = parentContext ? new Map(parentContext) : new Map(); - self.getValue = (key) => self._currentContext.get(key); - self.setValue = (key, value) => { - const context = new BaseContext(self._currentContext); - context._currentContext.set(key, value); - return context; - }; - self.deleteValue = (key) => { - const context = new BaseContext(self._currentContext); - context._currentContext.delete(key); - return context; - }; - } -} -/** - * The root context is used as the default parent context when there is no active context - * - * @since 1.0.0 - */ -export const ROOT_CONTEXT = new BaseContext(); -//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context/context.js.map b/node_modules/@opentelemetry/api/build/esm/context/context.js.map deleted file mode 100644 index b13abfb..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context/context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/context/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,0EAA0E;IAC1E,2EAA2E;IAC3E,wEAAwE;IACxE,mDAAmD;IACnD,EAAE;IACF,8EAA8E;IAC9E,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,WAAW;IAGf;;;;OAIG;IACH,YAAY,aAAoC;QAC9C,mBAAmB;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;QAE1E,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE/D,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAW,EAAE,KAAc,EAAW,EAAE;YACvD,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtD,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACxC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,CAAC,GAAW,EAAW,EAAE;YAC1C,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtD,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACpC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;CAyBF;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAY,IAAI,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from './types';\n\n/**\n * Get a key to uniquely identify a context value\n *\n * @since 1.0.0\n */\nexport function createContextKey(description: string) {\n // The specification states that for the same input, multiple calls should\n // return different keys. Due to the nature of the JS dependency management\n // system, this creates problems where multiple versions of some package\n // could hold different keys for the same property.\n //\n // Therefore, we use Symbol.for which returns the same key for the same input.\n return Symbol.for(description);\n}\n\nclass BaseContext implements Context {\n private _currentContext!: Map;\n\n /**\n * Construct a new context which inherits values from an optional parent context.\n *\n * @param parentContext a context from which to inherit values\n */\n constructor(parentContext?: Map) {\n // for minification\n const self = this;\n\n self._currentContext = parentContext ? new Map(parentContext) : new Map();\n\n self.getValue = (key: symbol) => self._currentContext.get(key);\n\n self.setValue = (key: symbol, value: unknown): Context => {\n const context = new BaseContext(self._currentContext);\n context._currentContext.set(key, value);\n return context;\n };\n\n self.deleteValue = (key: symbol): Context => {\n const context = new BaseContext(self._currentContext);\n context._currentContext.delete(key);\n return context;\n };\n }\n\n /**\n * Get a value from the context.\n *\n * @param key key which identifies a context value\n */\n public getValue!: (key: symbol) => unknown;\n\n /**\n * Create a new context which inherits from this context and has\n * the given key set to the given value.\n *\n * @param key context key for which to set the value\n * @param value value to set for the given key\n */\n public setValue!: (key: symbol, value: unknown) => Context;\n\n /**\n * Return a new context which inherits from this context but does\n * not contain a value for the given key.\n *\n * @param key context key for which to clear a value\n */\n public deleteValue!: (key: symbol) => Context;\n}\n\n/**\n * The root context is used as the default parent context when there is no active context\n *\n * @since 1.0.0\n */\nexport const ROOT_CONTEXT: Context = new BaseContext();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context/types.d.ts b/node_modules/@opentelemetry/api/build/esm/context/types.d.ts deleted file mode 100644 index 3c1f7a5..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context/types.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @since 1.0.0 - */ -export interface Context { - /** - * Get a value from the context. - * - * @param key key which identifies a context value - */ - getValue(key: symbol): unknown; - /** - * Create a new context which inherits from this context and has - * the given key set to the given value. - * - * @param key context key for which to set the value - * @param value value to set for the given key - */ - setValue(key: symbol, value: unknown): Context; - /** - * Return a new context which inherits from this context but does - * not contain a value for the given key. - * - * @param key context key for which to clear a value - */ - deleteValue(key: symbol): Context; -} -/** - * @since 1.0.0 - */ -export interface ContextManager { - /** - * Get the current active context - */ - active(): Context; - /** - * Run the fn callback with object set as the current active context - * @param context Any object to set as the current active context - * @param fn A callback to be immediately run within a specific context - * @param thisArg optional receiver to be used for calling fn - * @param args optional arguments forwarded to fn - */ - with ReturnType>(context: Context, fn: F, thisArg?: ThisParameterType, ...args: A): ReturnType; - /** - * Bind an object as the current context (or a specific one) - * @param [context] Optionally specify the context which you want to assign - * @param target Any object to which a context need to be set - */ - bind(context: Context, target: T): T; - /** - * Enable context management - */ - enable(): this; - /** - * Disable context management - */ - disable(): this; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context/types.js b/node_modules/@opentelemetry/api/build/esm/context/types.js deleted file mode 100644 index 70b3a72..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context/types.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/context/types.js.map b/node_modules/@opentelemetry/api/build/esm/context/types.js.map deleted file mode 100644 index 0d7fd83..0000000 --- a/node_modules/@opentelemetry/api/build/esm/context/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/context/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface Context {\n /**\n * Get a value from the context.\n *\n * @param key key which identifies a context value\n */\n getValue(key: symbol): unknown;\n\n /**\n * Create a new context which inherits from this context and has\n * the given key set to the given value.\n *\n * @param key context key for which to set the value\n * @param value value to set for the given key\n */\n setValue(key: symbol, value: unknown): Context;\n\n /**\n * Return a new context which inherits from this context but does\n * not contain a value for the given key.\n *\n * @param key context key for which to clear a value\n */\n deleteValue(key: symbol): Context;\n}\n\n/**\n * @since 1.0.0\n */\nexport interface ContextManager {\n /**\n * Get the current active context\n */\n active(): Context;\n\n /**\n * Run the fn callback with object set as the current active context\n * @param context Any object to set as the current active context\n * @param fn A callback to be immediately run within a specific context\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n with ReturnType>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType,\n ...args: A\n ): ReturnType;\n\n /**\n * Bind an object as the current context (or a specific one)\n * @param [context] Optionally specify the context which you want to assign\n * @param target Any object to which a context need to be set\n */\n bind(context: Context, target: T): T;\n\n /**\n * Enable context management\n */\n enable(): this;\n\n /**\n * Disable context management\n */\n disable(): this;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag-api.d.ts b/node_modules/@opentelemetry/api/build/esm/diag-api.d.ts deleted file mode 100644 index ae1045b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag-api.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { DiagAPI } from './api/diag'; -/** - * Entrypoint for Diag API. - * Defines Diagnostic handler used for internal diagnostic logging operations. - * The default provides a Noop DiagLogger implementation which may be changed via the - * diag.setLogger(logger: DiagLogger) function. - * - * @since 1.0.0 - */ -export declare const diag: DiagAPI; -//# sourceMappingURL=diag-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag-api.js b/node_modules/@opentelemetry/api/build/esm/diag-api.js deleted file mode 100644 index f3e1907..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag-api.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { DiagAPI } from './api/diag'; -/** - * Entrypoint for Diag API. - * Defines Diagnostic handler used for internal diagnostic logging operations. - * The default provides a Noop DiagLogger implementation which may be changed via the - * diag.setLogger(logger: DiagLogger) function. - * - * @since 1.0.0 - */ -export const diag = DiagAPI.instance(); -//# sourceMappingURL=diag-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag-api.js.map b/node_modules/@opentelemetry/api/build/esm/diag-api.js.map deleted file mode 100644 index 5412485..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diag-api.js","sourceRoot":"","sources":["../../src/diag-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { DiagAPI } from './api/diag';\n/**\n * Entrypoint for Diag API.\n * Defines Diagnostic handler used for internal diagnostic logging operations.\n * The default provides a Noop DiagLogger implementation which may be changed via the\n * diag.setLogger(logger: DiagLogger) function.\n *\n * @since 1.0.0\n */\nexport const diag = DiagAPI.instance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.d.ts b/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.d.ts deleted file mode 100644 index 76e2f56..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { ComponentLoggerOptions, DiagLogger } from './types'; -/** - * Component Logger which is meant to be used as part of any component which - * will add automatically additional namespace in front of the log message. - * It will then forward all message to global diag logger - * @example - * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' }); - * cLogger.debug('test'); - * // @opentelemetry/instrumentation-http test - */ -export declare class DiagComponentLogger implements DiagLogger { - private _namespace; - constructor(props: ComponentLoggerOptions); - debug(...args: unknown[]): void; - error(...args: unknown[]): void; - info(...args: unknown[]): void; - warn(...args: unknown[]): void; - verbose(...args: unknown[]): void; -} -//# sourceMappingURL=ComponentLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js b/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js deleted file mode 100644 index d442e7f..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { getGlobal } from '../internal/global-utils'; -/** - * Component Logger which is meant to be used as part of any component which - * will add automatically additional namespace in front of the log message. - * It will then forward all message to global diag logger - * @example - * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' }); - * cLogger.debug('test'); - * // @opentelemetry/instrumentation-http test - */ -export class DiagComponentLogger { - constructor(props) { - this._namespace = props.namespace || 'DiagComponentLogger'; - } - debug(...args) { - return logProxy('debug', this._namespace, args); - } - error(...args) { - return logProxy('error', this._namespace, args); - } - info(...args) { - return logProxy('info', this._namespace, args); - } - warn(...args) { - return logProxy('warn', this._namespace, args); - } - verbose(...args) { - return logProxy('verbose', this._namespace, args); - } -} -function logProxy(funcName, namespace, args) { - const logger = getGlobal('diag'); - // shortcut if logger not set - if (!logger) { - return; - } - return logger[funcName](namespace, ...args); -} -//# sourceMappingURL=ComponentLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js.map b/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js.map deleted file mode 100644 index aa86d30..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ComponentLogger.js","sourceRoot":"","sources":["../../../src/diag/ComponentLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGrD;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IAG9B,YAAY,KAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,IAAI,qBAAqB,CAAC;IAC7D,CAAC;IAEM,KAAK,CAAC,GAAG,IAAe;QAC7B,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,GAAG,IAAe;QAC7B,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAe;QAC5B,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAe;QAC5B,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,OAAO,CAAC,GAAG,IAAe;QAC/B,OAAO,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF;AAED,SAAS,QAAQ,CACf,QAA0B,EAC1B,SAAiB,EACjB,IAAe;IAEf,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,6BAA6B;IAC7B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IAED,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { getGlobal } from '../internal/global-utils';\nimport type { ComponentLoggerOptions, DiagLogger } from './types';\n\n/**\n * Component Logger which is meant to be used as part of any component which\n * will add automatically additional namespace in front of the log message.\n * It will then forward all message to global diag logger\n * @example\n * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });\n * cLogger.debug('test');\n * // @opentelemetry/instrumentation-http test\n */\nexport class DiagComponentLogger implements DiagLogger {\n private _namespace: string;\n\n constructor(props: ComponentLoggerOptions) {\n this._namespace = props.namespace || 'DiagComponentLogger';\n }\n\n public debug(...args: unknown[]): void {\n return logProxy('debug', this._namespace, args);\n }\n\n public error(...args: unknown[]): void {\n return logProxy('error', this._namespace, args);\n }\n\n public info(...args: unknown[]): void {\n return logProxy('info', this._namespace, args);\n }\n\n public warn(...args: unknown[]): void {\n return logProxy('warn', this._namespace, args);\n }\n\n public verbose(...args: unknown[]): void {\n return logProxy('verbose', this._namespace, args);\n }\n}\n\nfunction logProxy(\n funcName: keyof DiagLogger,\n namespace: string,\n args: unknown[]\n): void {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) {\n return;\n }\n\n return logger[funcName](namespace, ...args);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.d.ts b/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.d.ts deleted file mode 100644 index 8bae476..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { DiagLogger, DiagLogFunction } from './types'; -type ConsoleMapKeys = 'error' | 'warn' | 'info' | 'debug' | 'trace'; -export declare const _originalConsoleMethods: Partial>; -/** - * A simple Immutable Console based diagnostic logger which will output any messages to the Console. - * If you want to limit the amount of logging to a specific level or lower use the - * {@link createLogLevelDiagLogger} - * - * @since 1.0.0 - */ -export declare class DiagConsoleLogger implements DiagLogger { - constructor(); - /** Log an error scenario that was not expected and caused the requested operation to fail. */ - error: DiagLogFunction; - /** - * Log a warning scenario to inform the developer of an issues that should be investigated. - * The requested operation may or may not have succeeded or completed. - */ - warn: DiagLogFunction; - /** - * Log a general informational message, this should not affect functionality. - * This is also the default logging level so this should NOT be used for logging - * debugging level information. - */ - info: DiagLogFunction; - /** - * Log a general debug message that can be useful for identifying a failure. - * Information logged at this level may include diagnostic details that would - * help identify a failure scenario. Useful scenarios would be to log the execution - * order of async operations - */ - debug: DiagLogFunction; - /** - * Log a detailed (verbose) trace level logging that can be used to identify failures - * where debug level logging would be insufficient, this level of tracing can include - * input and output parameters and as such may include PII information passing through - * the API. As such it is recommended that this level of tracing should not be enabled - * in a production environment. - */ - verbose: DiagLogFunction; -} -export {}; -//# sourceMappingURL=consoleLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js b/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js deleted file mode 100644 index c1a341b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -const consoleMap = [ - { n: 'error', c: 'error' }, - { n: 'warn', c: 'warn' }, - { n: 'info', c: 'info' }, - { n: 'debug', c: 'debug' }, - { n: 'verbose', c: 'trace' }, -]; -// Save original console methods at module load time, before any instrumentation -// can wrap them. This ensures DiagConsoleLogger calls the unwrapped originals. -// Exported for testing only — not part of the public API. -export const _originalConsoleMethods = {}; -if (typeof console !== 'undefined') { - const keys = [ - 'error', - 'warn', - 'info', - 'debug', - 'trace', - 'log', - ]; - for (const key of keys) { - // eslint-disable-next-line no-console - if (typeof console[key] === 'function') { - // eslint-disable-next-line no-console - _originalConsoleMethods[key] = console[key]; - } - } -} -/** - * A simple Immutable Console based diagnostic logger which will output any messages to the Console. - * If you want to limit the amount of logging to a specific level or lower use the - * {@link createLogLevelDiagLogger} - * - * @since 1.0.0 - */ -export class DiagConsoleLogger { - constructor() { - function _consoleFunc(funcName) { - return function (...args) { - // Prefer original (pre-instrumentation) methods saved at module load time. - let theFunc = _originalConsoleMethods[funcName]; - // Some environments only expose the console when the F12 developer console is open - if (typeof theFunc !== 'function') { - theFunc = _originalConsoleMethods['log']; - } - // Fall back in case console was not available at module load time but became available later. - if (typeof theFunc !== 'function' && console) { - // eslint-disable-next-line no-console - theFunc = console[funcName]; - if (typeof theFunc !== 'function') { - // eslint-disable-next-line no-console - theFunc = console.log; - } - } - if (typeof theFunc === 'function') { - return theFunc.apply(console, args); - } - }; - } - for (let i = 0; i < consoleMap.length; i++) { - this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c); - } - } -} -//# sourceMappingURL=consoleLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js.map b/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js.map deleted file mode 100644 index bbf5739..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"consoleLogger.js","sourceRoot":"","sources":["../../../src/diag/consoleLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,UAAU,GAAiD;IAC/D,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACxB,EAAE,CAAC,EAAE,MAAM,EAAE,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AAO,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;iBACrC;YACH,CAAC,CAAC;QACJ,CAAC;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvD;IACH,CAAC;CAkCF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DiagLogger, DiagLogFunction } from './types';\n\ntype ConsoleMapKeys = 'error' | 'warn' | 'info' | 'debug' | 'trace';\nconst consoleMap: { n: keyof DiagLogger; c: ConsoleMapKeys }[] = [\n { n: 'error', c: 'error' },\n { n: 'warn', c: 'warn' },\n { n: 'info', c: 'info' },\n { n: 'debug', c: 'debug' },\n { n: 'verbose', c: 'trace' },\n];\n\n// Save original console methods at module load time, before any instrumentation\n// can wrap them. This ensures DiagConsoleLogger calls the unwrapped originals.\n// Exported for testing only — not part of the public API.\nexport const _originalConsoleMethods: Partial<\n Record\n> = {};\nif (typeof console !== 'undefined') {\n const keys: (ConsoleMapKeys | 'log')[] = [\n 'error',\n 'warn',\n 'info',\n 'debug',\n 'trace',\n 'log',\n ];\n for (const key of keys) {\n // eslint-disable-next-line no-console\n if (typeof console[key] === 'function') {\n // eslint-disable-next-line no-console\n _originalConsoleMethods[key] = console[key];\n }\n }\n}\n\n/**\n * A simple Immutable Console based diagnostic logger which will output any messages to the Console.\n * If you want to limit the amount of logging to a specific level or lower use the\n * {@link createLogLevelDiagLogger}\n *\n * @since 1.0.0\n */\nexport class DiagConsoleLogger implements DiagLogger {\n constructor() {\n function _consoleFunc(funcName: ConsoleMapKeys): DiagLogFunction {\n return function (...args) {\n // Prefer original (pre-instrumentation) methods saved at module load time.\n let theFunc = _originalConsoleMethods[funcName];\n // Some environments only expose the console when the F12 developer console is open\n if (typeof theFunc !== 'function') {\n theFunc = _originalConsoleMethods['log'];\n }\n // Fall back in case console was not available at module load time but became available later.\n if (typeof theFunc !== 'function' && console) {\n // eslint-disable-next-line no-console\n theFunc = console[funcName];\n if (typeof theFunc !== 'function') {\n // eslint-disable-next-line no-console\n theFunc = console.log;\n }\n }\n if (typeof theFunc === 'function') {\n return theFunc.apply(console, args);\n }\n };\n }\n\n for (let i = 0; i < consoleMap.length; i++) {\n this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);\n }\n }\n\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n public error!: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n public warn!: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n public info!: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario. Useful scenarios would be to log the execution\n * order of async operations\n */\n public debug!: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n public verbose!: DiagLogFunction;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.d.ts b/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.d.ts deleted file mode 100644 index b85ee88..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { DiagLogger } from '../types'; -import { DiagLogLevel } from '../types'; -export declare function createLogLevelDiagLogger(maxLevel: DiagLogLevel, logger: DiagLogger): DiagLogger; -//# sourceMappingURL=logLevelLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js b/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js deleted file mode 100644 index 7ab05fe..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { DiagLogLevel } from '../types'; -export function createLogLevelDiagLogger(maxLevel, logger) { - if (maxLevel < DiagLogLevel.NONE) { - maxLevel = DiagLogLevel.NONE; - } - else if (maxLevel > DiagLogLevel.ALL) { - maxLevel = DiagLogLevel.ALL; - } - // In case the logger is null or undefined - logger = logger || {}; - function _filterFunc(funcName, theLevel) { - const theFunc = logger[funcName]; - if (typeof theFunc === 'function' && maxLevel >= theLevel) { - return theFunc.bind(logger); - } - return function () { }; - } - return { - error: _filterFunc('error', DiagLogLevel.ERROR), - warn: _filterFunc('warn', DiagLogLevel.WARN), - info: _filterFunc('info', DiagLogLevel.INFO), - debug: _filterFunc('debug', DiagLogLevel.DEBUG), - verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE), - }; -} -//# sourceMappingURL=logLevelLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js.map b/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js.map deleted file mode 100644 index b8c8c49..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logLevelLogger.js","sourceRoot":"","sources":["../../../../src/diag/internal/logLevelLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,UAAU,wBAAwB,CACtC,QAAsB,EACtB,MAAkB;IAElB,IAAI,QAAQ,GAAG,YAAY,CAAC,IAAI,EAAE;QAChC,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC;KAC9B;SAAM,IAAI,QAAQ,GAAG,YAAY,CAAC,GAAG,EAAE;QACtC,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC;KAC7B;IAED,0CAA0C;IAC1C,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAEtB,SAAS,WAAW,CAClB,QAA0B,EAC1B,QAAsB;QAEtB,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEjC,IAAI,OAAO,OAAO,KAAK,UAAU,IAAI,QAAQ,IAAI,QAAQ,EAAE;YACzD,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,cAAa,CAAC,CAAC;IACxB,CAAC;IAED,OAAO;QACL,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;QAC/C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;QAC5C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;QAC5C,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;QAC/C,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DiagLogFunction, DiagLogger } from '../types';\nimport { DiagLogLevel } from '../types';\n\nexport function createLogLevelDiagLogger(\n maxLevel: DiagLogLevel,\n logger: DiagLogger\n): DiagLogger {\n if (maxLevel < DiagLogLevel.NONE) {\n maxLevel = DiagLogLevel.NONE;\n } else if (maxLevel > DiagLogLevel.ALL) {\n maxLevel = DiagLogLevel.ALL;\n }\n\n // In case the logger is null or undefined\n logger = logger || {};\n\n function _filterFunc(\n funcName: keyof DiagLogger,\n theLevel: DiagLogLevel\n ): DiagLogFunction {\n const theFunc = logger[funcName];\n\n if (typeof theFunc === 'function' && maxLevel >= theLevel) {\n return theFunc.bind(logger);\n }\n return function () {};\n }\n\n return {\n error: _filterFunc('error', DiagLogLevel.ERROR),\n warn: _filterFunc('warn', DiagLogLevel.WARN),\n info: _filterFunc('info', DiagLogLevel.INFO),\n debug: _filterFunc('debug', DiagLogLevel.DEBUG),\n verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE),\n };\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/internal/noopLogger.d.ts b/node_modules/@opentelemetry/api/build/esm/diag/internal/noopLogger.d.ts deleted file mode 100644 index f4d02f5..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/internal/noopLogger.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { DiagLogger } from '../types'; -/** - * Returns a No-Op Diagnostic logger where all messages do nothing. - * @implements {@link DiagLogger} - * @returns {DiagLogger} - */ -export declare function createNoopDiagLogger(): DiagLogger; -//# sourceMappingURL=noopLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/internal/noopLogger.js b/node_modules/@opentelemetry/api/build/esm/diag/internal/noopLogger.js deleted file mode 100644 index ab739d5..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/internal/noopLogger.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -function noopLogFunction() { } -/** - * Returns a No-Op Diagnostic logger where all messages do nothing. - * @implements {@link DiagLogger} - * @returns {DiagLogger} - */ -export function createNoopDiagLogger() { - return { - verbose: noopLogFunction, - debug: noopLogFunction, - info: noopLogFunction, - warn: noopLogFunction, - error: noopLogFunction, - }; -} -//# sourceMappingURL=noopLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/internal/noopLogger.js.map b/node_modules/@opentelemetry/api/build/esm/diag/internal/noopLogger.js.map deleted file mode 100644 index 9b4866b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/internal/noopLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"noopLogger.js","sourceRoot":"","sources":["../../../../src/diag/internal/noopLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,SAAS,eAAe,KAAI,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,eAAe;KACvB,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DiagLogger } from '../types';\n\nfunction noopLogFunction() {}\n\n/**\n * Returns a No-Op Diagnostic logger where all messages do nothing.\n * @implements {@link DiagLogger}\n * @returns {DiagLogger}\n */\nexport function createNoopDiagLogger(): DiagLogger {\n return {\n verbose: noopLogFunction,\n debug: noopLogFunction,\n info: noopLogFunction,\n warn: noopLogFunction,\n error: noopLogFunction,\n };\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/types.d.ts b/node_modules/@opentelemetry/api/build/esm/diag/types.d.ts deleted file mode 100644 index 64950a7..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/types.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @since 1.0.0 - */ -export type DiagLogFunction = (message: string, ...args: unknown[]) => void; -/** - * Defines an internal diagnostic logger interface which is used to log internal diagnostic - * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function. - * API provided implementations include :- - * - a No-Op {@link createNoopDiagLogger} - * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger} - * - a general Console {@link DiagConsoleLogger} version. - * - * @since 1.0.0 - */ -export interface DiagLogger { - /** Log an error scenario that was not expected and caused the requested operation to fail. */ - error: DiagLogFunction; - /** - * Log a warning scenario to inform the developer of an issues that should be investigated. - * The requested operation may or may not have succeeded or completed. - */ - warn: DiagLogFunction; - /** - * Log a general informational message, this should not affect functionality. - * This is also the default logging level so this should NOT be used for logging - * debugging level information. - */ - info: DiagLogFunction; - /** - * Log a general debug message that can be useful for identifying a failure. - * Information logged at this level may include diagnostic details that would - * help identify a failure scenario. - * For example: Logging the order of execution of async operations. - */ - debug: DiagLogFunction; - /** - * Log a detailed (verbose) trace level logging that can be used to identify failures - * where debug level logging would be insufficient, this level of tracing can include - * input and output parameters and as such may include PII information passing through - * the API. As such it is recommended that this level of tracing should not be enabled - * in a production environment. - */ - verbose: DiagLogFunction; -} -/** - * Defines the available internal logging levels for the diagnostic logger, the numeric values - * of the levels are defined to match the original values from the initial LogLevel to avoid - * compatibility/migration issues for any implementation that assume the numeric ordering. - */ -export declare enum DiagLogLevel { - /** Diagnostic Logging level setting to disable all logging (except and forced logs) */ - NONE = 0, - /** Identifies an error scenario */ - ERROR = 30, - /** Identifies a warning scenario */ - WARN = 50, - /** General informational log message */ - INFO = 60, - /** General debug log message */ - DEBUG = 70, - /** - * Detailed trace level logging should only be used for development, should only be set - * in a development environment. - */ - VERBOSE = 80, - /** Used to set the logging level to include all logging */ - ALL = 9999 -} -/** - * Defines options for ComponentLogger - * - * @since 1.0.0 - */ -export interface ComponentLoggerOptions { - namespace: string; -} -/** - * @since 1.4.1 - */ -export interface DiagLoggerOptions { - /** - * The {@link DiagLogLevel} used to filter logs sent to the logger. - * - * @defaultValue DiagLogLevel.INFO - */ - logLevel?: DiagLogLevel; - /** - * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered. - */ - suppressOverrideMessage?: boolean; -} -export interface DiagLoggerApi { - /** - * Set the global DiagLogger and DiagLogLevel. - * If a global diag logger is already set, this will override it. - * - * @param logger - The {@link DiagLogger} instance to set as the default logger. - * @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set. - * @returns `true` if the logger was successfully registered, else `false` - */ - setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean; - /** - * - * @param logger - The {@link DiagLogger} instance to set as the default logger. - * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}. - * @returns `true` if the logger was successfully registered, else `false` - */ - setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/types.js b/node_modules/@opentelemetry/api/build/esm/diag/types.js deleted file mode 100644 index 3fc610a..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/types.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * Defines the available internal logging levels for the diagnostic logger, the numeric values - * of the levels are defined to match the original values from the initial LogLevel to avoid - * compatibility/migration issues for any implementation that assume the numeric ordering. - */ -export var DiagLogLevel; -(function (DiagLogLevel) { - /** Diagnostic Logging level setting to disable all logging (except and forced logs) */ - DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE"; - /** Identifies an error scenario */ - DiagLogLevel[DiagLogLevel["ERROR"] = 30] = "ERROR"; - /** Identifies a warning scenario */ - DiagLogLevel[DiagLogLevel["WARN"] = 50] = "WARN"; - /** General informational log message */ - DiagLogLevel[DiagLogLevel["INFO"] = 60] = "INFO"; - /** General debug log message */ - DiagLogLevel[DiagLogLevel["DEBUG"] = 70] = "DEBUG"; - /** - * Detailed trace level logging should only be used for development, should only be set - * in a development environment. - */ - DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE"; - /** Used to set the logging level to include all logging */ - DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL"; -})(DiagLogLevel || (DiagLogLevel = {})); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/diag/types.js.map b/node_modules/@opentelemetry/api/build/esm/diag/types.js.map deleted file mode 100644 index 0f15390..0000000 --- a/node_modules/@opentelemetry/api/build/esm/diag/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/diag/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoDH;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAwBX;AAxBD,WAAY,YAAY;IACtB,uFAAuF;IACvF,+CAAQ,CAAA;IAER,mCAAmC;IACnC,kDAAU,CAAA;IAEV,oCAAoC;IACpC,gDAAS,CAAA;IAET,wCAAwC;IACxC,gDAAS,CAAA;IAET,gCAAgC;IAChC,kDAAU,CAAA;IAEV;;;OAGG;IACH,sDAAY,CAAA;IAEZ,2DAA2D;IAC3D,gDAAU,CAAA;AACZ,CAAC,EAxBW,YAAY,KAAZ,YAAY,QAwBvB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport type DiagLogFunction = (message: string, ...args: unknown[]) => void;\n\n/**\n * Defines an internal diagnostic logger interface which is used to log internal diagnostic\n * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.\n * API provided implementations include :-\n * - a No-Op {@link createNoopDiagLogger}\n * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}\n * - a general Console {@link DiagConsoleLogger} version.\n *\n * @since 1.0.0\n */\nexport interface DiagLogger {\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n error: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n warn: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n info: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario.\n * For example: Logging the order of execution of async operations.\n */\n debug: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n verbose: DiagLogFunction;\n}\n\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport enum DiagLogLevel {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n NONE = 0,\n\n /** Identifies an error scenario */\n ERROR = 30,\n\n /** Identifies a warning scenario */\n WARN = 50,\n\n /** General informational log message */\n INFO = 60,\n\n /** General debug log message */\n DEBUG = 70,\n\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n VERBOSE = 80,\n\n /** Used to set the logging level to include all logging */\n ALL = 9999,\n}\n\n/**\n * Defines options for ComponentLogger\n *\n * @since 1.0.0\n */\nexport interface ComponentLoggerOptions {\n namespace: string;\n}\n\n/**\n * @since 1.4.1\n */\nexport interface DiagLoggerOptions {\n /**\n * The {@link DiagLogLevel} used to filter logs sent to the logger.\n *\n * @defaultValue DiagLogLevel.INFO\n */\n logLevel?: DiagLogLevel;\n\n /**\n * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered.\n */\n suppressOverrideMessage?: boolean;\n}\n\nexport interface DiagLoggerApi {\n /**\n * Set the global DiagLogger and DiagLogLevel.\n * If a global diag logger is already set, this will override it.\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean;\n\n /**\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/experimental/index.d.ts b/node_modules/@opentelemetry/api/build/esm/experimental/index.d.ts deleted file mode 100644 index 020da5d..0000000 --- a/node_modules/@opentelemetry/api/build/esm/experimental/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Any exports here may change at any time and without warning - * @module @opentelemetry/api/experimental - */ -export { wrapTracer, SugaredTracer } from './trace/SugaredTracer'; -export type { SugaredSpanOptions } from './trace/SugaredOptions'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/experimental/index.js b/node_modules/@opentelemetry/api/build/esm/experimental/index.js deleted file mode 100644 index 04e092b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/experimental/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * Any exports here may change at any time and without warning - * @module @opentelemetry/api/experimental - */ -export { wrapTracer, SugaredTracer } from './trace/SugaredTracer'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/experimental/index.js.map b/node_modules/@opentelemetry/api/build/esm/experimental/index.js.map deleted file mode 100644 index e12fb66..0000000 --- a/node_modules/@opentelemetry/api/build/esm/experimental/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/experimental/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Any exports here may change at any time and without warning\n * @module @opentelemetry/api/experimental\n */\n\nexport { wrapTracer, SugaredTracer } from './trace/SugaredTracer';\nexport type { SugaredSpanOptions } from './trace/SugaredOptions';\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredOptions.d.ts b/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredOptions.d.ts deleted file mode 100644 index ea74870..0000000 --- a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredOptions.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Span, SpanOptions } from '../../'; -/** - * Options needed for span creation - */ -export interface SugaredSpanOptions extends SpanOptions { - /** - * function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function. - * @param e Error which triggered this exception - * @param span current span from context - */ - onException?: (e: Error, span: Span) => void; -} -//# sourceMappingURL=SugaredOptions.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredOptions.js b/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredOptions.js deleted file mode 100644 index 6e661f5..0000000 --- a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredOptions.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=SugaredOptions.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredOptions.js.map b/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredOptions.js.map deleted file mode 100644 index fabbdc1..0000000 --- a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SugaredOptions.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredOptions.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Span, SpanOptions } from '../../';\n\n/**\n * Options needed for span creation\n */\nexport interface SugaredSpanOptions extends SpanOptions {\n /**\n * function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function.\n * @param e Error which triggered this exception\n * @param span current span from context\n */\n onException?: (e: Error, span: Span) => void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.d.ts b/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.d.ts deleted file mode 100644 index f78235b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { SugaredSpanOptions } from './SugaredOptions'; -import type { Context, Span, Tracer } from '../../'; -/** - * return a new SugaredTracer created from the supplied one - * @param tracer - */ -export declare function wrapTracer(tracer: Tracer): SugaredTracer; -export declare class SugaredTracer implements Tracer { - private readonly _tracer; - constructor(tracer: Tracer); - startActiveSpan: Tracer['startActiveSpan']; - startSpan: Tracer['startSpan']; - /** - * Starts a new {@link Span} and calls the given function passing it the - * created span as first argument. - * Additionally, the new span gets set in context and this context is activated - * for the duration of the function call. - * The span will be closed after the function has executed. - * If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown. - * - * @param name The name of the span - * @param [options] SugaredSpanOptions used for span creation - * @param [context] Context to use to extract parent - * @param fn function called in the context of the span and receives the newly created span as an argument - * @returns return value of fn - * @example - * const something = tracer.withActiveSpan('op', span => { - * // do some work - * }); - * @example - * const something = await tracer.withActiveSpan('op', span => { - * // do some async work - * }); - */ - withActiveSpan ReturnType>(name: string, fn: F): ReturnType; - withActiveSpan ReturnType>(name: string, options: SugaredSpanOptions, fn: F): ReturnType; - withActiveSpan ReturnType>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType; - /** - * Starts a new {@link Span} and ends it after execution of fn without setting it on context. - * The span will be closed after the function has executed. - * If an exception occurs, it is recorded, the status is et to ERROR and rethrown. - * - * This method does NOT modify the current Context. - * - * @param name The name of the span - * @param [options] SugaredSpanOptions used for span creation - * @param [context] Context to use to extract parent - * @param fn function called in the context of the span and receives the newly created span as an argument - * @returns Span The newly created span - * @example - * const something = tracer.withSpan('op', span => { - * // do some work - * }); - * @example - * const something = await tracer.withSpan('op', span => { - * // do some async work - * }); - */ - withSpan ReturnType>(name: string, fn: F): ReturnType; - withSpan ReturnType>(name: string, options: SugaredSpanOptions, fn: F): ReturnType; - withSpan ReturnType>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType; - withSpan ReturnType>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType; -} -//# sourceMappingURL=SugaredTracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.js b/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.js deleted file mode 100644 index 7487cb7..0000000 --- a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.js +++ /dev/null @@ -1,88 +0,0 @@ -import { context as contextApi, SpanStatusCode } from '../../'; -const defaultOnException = (e, span) => { - span.recordException(e); - span.setStatus({ - code: SpanStatusCode.ERROR, - }); -}; -/** - * return a new SugaredTracer created from the supplied one - * @param tracer - */ -export function wrapTracer(tracer) { - return new SugaredTracer(tracer); -} -export class SugaredTracer { - constructor(tracer) { - this._tracer = tracer; - this.startSpan = tracer.startSpan.bind(this._tracer); - this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer); - } - withActiveSpan(name, arg2, arg3, arg4) { - const { opts, ctx, fn } = massageParams(arg2, arg3, arg4); - return this._tracer.startActiveSpan(name, opts, ctx, (span) => handleFn(span, opts, fn)); - } - withSpan(name, arg2, arg3, arg4) { - const { opts, ctx, fn } = massageParams(arg2, arg3, arg4); - const span = this._tracer.startSpan(name, opts, ctx); - return handleFn(span, opts, fn); - } -} -/** - * Massages parameters of withSpan and withActiveSpan to allow signature overwrites - * @param arg - * @param arg2 - * @param arg3 - */ -function massageParams(arg, arg2, arg3) { - let opts; - let ctx; - let fn; - if (!arg2 && !arg3) { - fn = arg; - } - else if (!arg3) { - opts = arg; - fn = arg2; - } - else { - opts = arg; - ctx = arg2; - fn = arg3; - } - opts = opts !== null && opts !== void 0 ? opts : {}; - ctx = ctx !== null && ctx !== void 0 ? ctx : contextApi.active(); - return { opts, ctx, fn }; -} -/** - * Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling - * @param span - * @param opts - * @param fn - */ -function handleFn(span, opts, fn) { - var _a; - const onException = (_a = opts.onException) !== null && _a !== void 0 ? _a : defaultOnException; - const errorHandler = (e) => { - onException(e, span); - span.end(); - throw e; - }; - try { - const ret = fn(span); - // if fn is an async function, attach a recordException and spanEnd callback to the promise - if (typeof (ret === null || ret === void 0 ? void 0 : ret.then) === 'function') { - return ret.then(val => { - span.end(); - return val; - }, errorHandler); - } - span.end(); - return ret; - } - catch (e) { - // add throw to signal the compiler that this will throw in the inner scope - throw errorHandler(e); - } -} -//# sourceMappingURL=SugaredTracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.js.map b/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.js.map deleted file mode 100644 index 77bc2ce..0000000 --- a/node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SugaredTracer.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredTracer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAQ,EAAE,IAAU,EAAE,EAAE;IAClD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,CAAC,SAAS,CAAC;QACb,IAAI,EAAE,cAAc,CAAC,KAAK;KAC3B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,OAAO,IAAI,aAA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AA2E;QAC3E,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC;KACvB;AACH,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { SugaredSpanOptions } from './SugaredOptions';\nimport type { Context, Span, Tracer } from '../../';\nimport { context as contextApi, SpanStatusCode } from '../../';\n\nconst defaultOnException = (e: Error, span: Span) => {\n span.recordException(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n });\n};\n\n/**\n * return a new SugaredTracer created from the supplied one\n * @param tracer\n */\nexport function wrapTracer(tracer: Tracer): SugaredTracer {\n return new SugaredTracer(tracer);\n}\n\nexport class SugaredTracer implements Tracer {\n private readonly _tracer: Tracer;\n\n constructor(tracer: Tracer) {\n this._tracer = tracer;\n this.startSpan = tracer.startSpan.bind(this._tracer);\n this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer);\n }\n\n startActiveSpan: Tracer['startActiveSpan'];\n startSpan: Tracer['startSpan'];\n\n /**\n * Starts a new {@link Span} and calls the given function passing it the\n * created span as first argument.\n * Additionally, the new span gets set in context and this context is activated\n * for the duration of the function call.\n * The span will be closed after the function has executed.\n * If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown.\n *\n * @param name The name of the span\n * @param [options] SugaredSpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns return value of fn\n * @example\n * const something = tracer.withActiveSpan('op', span => {\n * // do some work\n * });\n * @example\n * const something = await tracer.withActiveSpan('op', span => {\n * // do some async work\n * });\n */\n withActiveSpan ReturnType>(\n name: string,\n fn: F\n ): ReturnType;\n withActiveSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n fn: F\n ): ReturnType;\n withActiveSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n withActiveSpan ReturnType>(\n name: string,\n arg2: F | SugaredSpanOptions,\n arg3?: F | Context,\n arg4?: F\n ): ReturnType {\n const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);\n\n return this._tracer.startActiveSpan(name, opts, ctx, (span: Span) =>\n handleFn(span, opts, fn)\n ) as ReturnType;\n }\n\n /**\n * Starts a new {@link Span} and ends it after execution of fn without setting it on context.\n * The span will be closed after the function has executed.\n * If an exception occurs, it is recorded, the status is et to ERROR and rethrown.\n *\n * This method does NOT modify the current Context.\n *\n * @param name The name of the span\n * @param [options] SugaredSpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns Span The newly created span\n * @example\n * const something = tracer.withSpan('op', span => {\n * // do some work\n * });\n * @example\n * const something = await tracer.withSpan('op', span => {\n * // do some async work\n * });\n */\n withSpan ReturnType>(\n name: string,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n arg2: SugaredSpanOptions | F,\n arg3?: Context | F,\n arg4?: F\n ): ReturnType {\n const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);\n\n const span = this._tracer.startSpan(name, opts, ctx);\n return handleFn(span, opts, fn) as ReturnType;\n }\n}\n\n/**\n * Massages parameters of withSpan and withActiveSpan to allow signature overwrites\n * @param arg\n * @param arg2\n * @param arg3\n */\nfunction massageParams ReturnType>(\n arg: F | SugaredSpanOptions,\n arg2?: F | Context,\n arg3?: F\n) {\n let opts: SugaredSpanOptions | undefined;\n let ctx: Context | undefined;\n let fn: F;\n\n if (!arg2 && !arg3) {\n fn = arg as F;\n } else if (!arg3) {\n opts = arg as SugaredSpanOptions;\n fn = arg2 as F;\n } else {\n opts = arg as SugaredSpanOptions;\n ctx = arg2 as Context;\n fn = arg3 as F;\n }\n opts = opts ?? {};\n ctx = ctx ?? contextApi.active();\n\n return { opts, ctx, fn };\n}\n\n/**\n * Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling\n * @param span\n * @param opts\n * @param fn\n */\nfunction handleFn ReturnType>(\n span: Span,\n opts: SugaredSpanOptions,\n fn: F\n): ReturnType {\n const onException = opts.onException ?? defaultOnException;\n const errorHandler = (e: Error) => {\n onException(e, span);\n span.end();\n throw e;\n };\n\n try {\n const ret = fn(span) as Promise>;\n // if fn is an async function, attach a recordException and spanEnd callback to the promise\n if (typeof ret?.then === 'function') {\n return ret.then(val => {\n span.end();\n return val;\n }, errorHandler) as ReturnType;\n }\n span.end();\n return ret as ReturnType;\n } catch (e) {\n // add throw to signal the compiler that this will throw in the inner scope\n throw errorHandler(e);\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/index.d.ts b/node_modules/@opentelemetry/api/build/esm/index.d.ts deleted file mode 100644 index 93f0644..0000000 --- a/node_modules/@opentelemetry/api/build/esm/index.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @module @opentelemetry/api - */ -export type { BaggageEntry, BaggageEntryMetadata, Baggage, } from './baggage/types'; -export { baggageEntryMetadataFromString } from './baggage/utils'; -export type { Exception } from './common/Exception'; -export type { HrTime, TimeInput } from './common/Time'; -export type { Attributes, AttributeValue } from './common/Attributes'; -export { createContextKey, ROOT_CONTEXT } from './context/context'; -export type { Context, ContextManager } from './context/types'; -export type { ContextAPI } from './api/context'; -export { DiagConsoleLogger } from './diag/consoleLogger'; -export { DiagLogLevel } from './diag/types'; -export type { DiagLogFunction, DiagLogger, ComponentLoggerOptions, DiagLoggerOptions, } from './diag/types'; -export type { DiagAPI } from './api/diag'; -export { createNoopMeter } from './metrics/NoopMeter'; -export type { MeterOptions, Meter } from './metrics/Meter'; -export type { MeterProvider } from './metrics/MeterProvider'; -export { ValueType } from './metrics/Metric'; -export type { Counter, Gauge, Histogram, MetricOptions, UpDownCounter, MetricAdvice, MetricAttributes, MetricAttributeValue, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, BatchObservableCallback, ObservableCallback, BatchObservableResult, ObservableResult, } from './metrics/Metric'; -export type { MetricsAPI } from './api/metrics'; -export { defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator'; -export type { TextMapPropagator, TextMapSetter, TextMapGetter, } from './propagation/TextMapPropagator'; -export type { PropagationAPI } from './api/propagation'; -export type { SpanAttributes, SpanAttributeValue } from './trace/attributes'; -export type { Link } from './trace/link'; -export { ProxyTracer, type TracerDelegator } from './trace/ProxyTracer'; -export { ProxyTracerProvider } from './trace/ProxyTracerProvider'; -export type { Sampler } from './trace/Sampler'; -export { SamplingDecision, type SamplingResult } from './trace/SamplingResult'; -export type { SpanContext } from './trace/span_context'; -export { SpanKind } from './trace/span_kind'; -export type { Span } from './trace/span'; -export type { SpanOptions } from './trace/SpanOptions'; -export { type SpanStatus, SpanStatusCode } from './trace/status'; -export { TraceFlags } from './trace/trace_flags'; -export type { TraceState } from './trace/trace_state'; -export { createTraceState } from './trace/internal/utils'; -export type { TracerProvider } from './trace/tracer_provider'; -export type { Tracer } from './trace/tracer'; -export type { TracerOptions } from './trace/tracer_options'; -export { isSpanContextValid, isValidTraceId, isValidSpanId, } from './trace/spancontext-utils'; -export { INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT, } from './trace/invalid-span-constants'; -export type { TraceAPI } from './api/trace'; -import { context } from './context-api'; -import { diag } from './diag-api'; -import { metrics } from './metrics-api'; -import { propagation } from './propagation-api'; -import { trace } from './trace-api'; -export { context, diag, metrics, propagation, trace }; -declare const _default: { - context: import("./api/context").ContextAPI; - diag: import("./api/diag").DiagAPI; - metrics: import("./api/metrics").MetricsAPI; - propagation: import("./api/propagation").PropagationAPI; - trace: import("./api/trace").TraceAPI; -}; -export default _default; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/index.js b/node_modules/@opentelemetry/api/build/esm/index.js deleted file mode 100644 index 9dc35ec..0000000 --- a/node_modules/@opentelemetry/api/build/esm/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export { baggageEntryMetadataFromString } from './baggage/utils'; -// Context APIs -export { createContextKey, ROOT_CONTEXT } from './context/context'; -// Diag APIs -export { DiagConsoleLogger } from './diag/consoleLogger'; -export { DiagLogLevel } from './diag/types'; -// Metrics APIs -export { createNoopMeter } from './metrics/NoopMeter'; -export { ValueType } from './metrics/Metric'; -// Propagation APIs -export { defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator'; -export { ProxyTracer } from './trace/ProxyTracer'; -// TODO: Remove ProxyTracerProvider export in the next major version. -export { ProxyTracerProvider } from './trace/ProxyTracerProvider'; -export { SamplingDecision } from './trace/SamplingResult'; -export { SpanKind } from './trace/span_kind'; -export { SpanStatusCode } from './trace/status'; -export { TraceFlags } from './trace/trace_flags'; -export { createTraceState } from './trace/internal/utils'; -export { isSpanContextValid, isValidTraceId, isValidSpanId, } from './trace/spancontext-utils'; -export { INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT, } from './trace/invalid-span-constants'; -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { context } from './context-api'; -import { diag } from './diag-api'; -import { metrics } from './metrics-api'; -import { propagation } from './propagation-api'; -import { trace } from './trace-api'; -// Named export. -export { context, diag, metrics, propagation, trace }; -// Default export. -export default { - context, - diag, - metrics, - propagation, - trace, -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/index.js.map b/node_modules/@opentelemetry/api/build/esm/index.js.map deleted file mode 100644 index cb797c4..0000000 --- a/node_modules/@opentelemetry/api/build/esm/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;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AAE,MAAM,aAAa,CAAC;AAEpC,gBAAgB;AAChB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AACtD,kBAAkB;AAClB,eAAe;IACb,OAAO;IACP,IAAI;IACJ,OAAO;IACP,WAAW;IACX,KAAK;CACN,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @module @opentelemetry/api\n */\n\nexport type {\n BaggageEntry,\n BaggageEntryMetadata,\n Baggage,\n} from './baggage/types';\nexport { baggageEntryMetadataFromString } from './baggage/utils';\nexport type { Exception } from './common/Exception';\nexport type { HrTime, TimeInput } from './common/Time';\nexport type { Attributes, AttributeValue } from './common/Attributes';\n\n// Context APIs\nexport { createContextKey, ROOT_CONTEXT } from './context/context';\nexport type { Context, ContextManager } from './context/types';\nexport type { ContextAPI } from './api/context';\n\n// Diag APIs\nexport { DiagConsoleLogger } from './diag/consoleLogger';\nexport { DiagLogLevel } from './diag/types';\nexport type {\n DiagLogFunction,\n DiagLogger,\n ComponentLoggerOptions,\n DiagLoggerOptions,\n} from './diag/types';\nexport type { DiagAPI } from './api/diag';\n\n// Metrics APIs\nexport { createNoopMeter } from './metrics/NoopMeter';\nexport type { MeterOptions, Meter } from './metrics/Meter';\nexport type { MeterProvider } from './metrics/MeterProvider';\nexport { ValueType } from './metrics/Metric';\nexport type {\n Counter,\n Gauge,\n Histogram,\n MetricOptions,\n UpDownCounter,\n MetricAdvice,\n MetricAttributes,\n MetricAttributeValue,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n BatchObservableCallback,\n ObservableCallback,\n BatchObservableResult,\n ObservableResult,\n} from './metrics/Metric';\nexport type { MetricsAPI } from './api/metrics';\n\n// Propagation APIs\nexport {\n defaultTextMapGetter,\n defaultTextMapSetter,\n} from './propagation/TextMapPropagator';\nexport type {\n TextMapPropagator,\n TextMapSetter,\n TextMapGetter,\n} from './propagation/TextMapPropagator';\nexport type { PropagationAPI } from './api/propagation';\n\n// Trace APIs\nexport type { SpanAttributes, SpanAttributeValue } from './trace/attributes';\nexport type { Link } from './trace/link';\nexport { ProxyTracer, type TracerDelegator } from './trace/ProxyTracer';\n// TODO: Remove ProxyTracerProvider export in the next major version.\nexport { ProxyTracerProvider } from './trace/ProxyTracerProvider';\nexport type { Sampler } from './trace/Sampler';\nexport { SamplingDecision, type SamplingResult } from './trace/SamplingResult';\nexport type { SpanContext } from './trace/span_context';\nexport { SpanKind } from './trace/span_kind';\nexport type { Span } from './trace/span';\nexport type { SpanOptions } from './trace/SpanOptions';\nexport { type SpanStatus, SpanStatusCode } from './trace/status';\nexport { TraceFlags } from './trace/trace_flags';\nexport type { TraceState } from './trace/trace_state';\nexport { createTraceState } from './trace/internal/utils';\nexport type { TracerProvider } from './trace/tracer_provider';\nexport type { Tracer } from './trace/tracer';\nexport type { TracerOptions } from './trace/tracer_options';\nexport {\n isSpanContextValid,\n isValidTraceId,\n isValidSpanId,\n} from './trace/spancontext-utils';\nexport {\n INVALID_SPANID,\n INVALID_TRACEID,\n INVALID_SPAN_CONTEXT,\n} from './trace/invalid-span-constants';\nexport type { TraceAPI } from './api/trace';\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { context } from './context-api';\nimport { diag } from './diag-api';\nimport { metrics } from './metrics-api';\nimport { propagation } from './propagation-api';\nimport { trace } from './trace-api';\n\n// Named export.\nexport { context, diag, metrics, propagation, trace };\n// Default export.\nexport default {\n context,\n diag,\n metrics,\n propagation,\n trace,\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/internal/global-utils.d.ts b/node_modules/@opentelemetry/api/build/esm/internal/global-utils.d.ts deleted file mode 100644 index e03d908..0000000 --- a/node_modules/@opentelemetry/api/build/esm/internal/global-utils.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { MeterProvider } from '../metrics/MeterProvider'; -import type { ContextManager } from '../context/types'; -import type { DiagLogger } from '../diag/types'; -import type { TextMapPropagator } from '../propagation/TextMapPropagator'; -import type { TracerProvider } from '../trace/tracer_provider'; -export declare function registerGlobal(type: Type, instance: OTelGlobalAPI[Type], diag: DiagLogger, allowOverride?: boolean): boolean; -export declare function getGlobal(type: Type): OTelGlobalAPI[Type] | undefined; -export declare function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger): void; -type OTelGlobalAPI = { - version: string; - diag?: DiagLogger; - trace?: TracerProvider; - context?: ContextManager; - metrics?: MeterProvider; - propagation?: TextMapPropagator; -}; -export {}; -//# sourceMappingURL=global-utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js b/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js deleted file mode 100644 index 13a8d2e..0000000 --- a/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { VERSION } from '../version'; -import { isCompatible } from './semver'; -const major = VERSION.split('.')[0]; -const GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`); -const _global = (typeof globalThis === 'object' - ? globalThis - : typeof self === 'object' - ? self - : typeof window === 'object' - ? window - : typeof global === 'object' - ? global - : {}); -export function registerGlobal(type, instance, diag, allowOverride = false) { - var _a; - const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { - version: VERSION, - }); - if (!allowOverride && api[type]) { - // already registered an API of this type - const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`); - diag.error(err.stack || err.message); - return false; - } - if (api.version !== VERSION) { - // All registered APIs must be of the same version exactly - const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`); - diag.error(err.stack || err.message); - return false; - } - api[type] = instance; - diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION}.`); - return true; -} -export function getGlobal(type) { - var _a, _b; - const globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version; - if (!globalVersion || !isCompatible(globalVersion)) { - return; - } - return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type]; -} -export function unregisterGlobal(type, diag) { - diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`); - const api = _global[GLOBAL_OPENTELEMETRY_API_KEY]; - if (api) { - delete api[type]; - } -} -//# sourceMappingURL=global-utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js.map b/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js.map deleted file mode 100644 index caebec6..0000000 --- a/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAC7C,wBAAwB,KAAK,EAAE,CAChC,CAAC;AAMF,MAAM,OAAO,GAAG,CACd,OAAO,UAAU,KAAK,QAAQ;IAC5B,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;QACxB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;gBAC1B,CAAC,CAAC,M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AAI,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAyB,EAAE,IAAgB;IAC1E,IAAI,CAAC,KAAK,CACR,kDAAkD,IAAI,KAAK,OAAO,GAAG,CACtE,CAAC;IACF,MAAM,GAAG,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAElD,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;KAClB;AACH,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { MeterProvider } from '../metrics/MeterProvider';\nimport type { ContextManager } from '../context/types';\nimport type { DiagLogger } from '../diag/types';\nimport type { TextMapPropagator } from '../propagation/TextMapPropagator';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport { VERSION } from '../version';\nimport { isCompatible } from './semver';\n\nconst major = VERSION.split('.')[0];\nconst GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(\n `opentelemetry.js.api.${major}`\n);\n\ndeclare const self: unknown;\ndeclare const window: unknown;\ndeclare const global: unknown;\n\nconst _global = (\n typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : {}\n) as OTelGlobal;\n\nexport function registerGlobal(\n type: Type,\n instance: OTelGlobalAPI[Type],\n diag: DiagLogger,\n allowOverride = false\n): boolean {\n const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = _global[\n GLOBAL_OPENTELEMETRY_API_KEY\n ] ?? {\n version: VERSION,\n });\n\n if (!allowOverride && api[type]) {\n // already registered an API of this type\n const err = new Error(\n `@opentelemetry/api: Attempted duplicate registration of API: ${type}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n if (api.version !== VERSION) {\n // All registered APIs must be of the same version exactly\n const err = new Error(\n `@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n api[type] = instance;\n diag.debug(\n `@opentelemetry/api: Registered a global for ${type} v${VERSION}.`\n );\n\n return true;\n}\n\nexport function getGlobal(\n type: Type\n): OTelGlobalAPI[Type] | undefined {\n const globalVersion = _global[GLOBAL_OPENTELEMETRY_API_KEY]?.version;\n if (!globalVersion || !isCompatible(globalVersion)) {\n return;\n }\n return _global[GLOBAL_OPENTELEMETRY_API_KEY]?.[type];\n}\n\nexport function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger) {\n diag.debug(\n `@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`\n );\n const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n\n if (api) {\n delete api[type];\n }\n}\n\ntype OTelGlobal = {\n [GLOBAL_OPENTELEMETRY_API_KEY]?: OTelGlobalAPI;\n};\n\ntype OTelGlobalAPI = {\n version: string;\n\n diag?: DiagLogger;\n trace?: TracerProvider;\n context?: ContextManager;\n metrics?: MeterProvider;\n propagation?: TextMapPropagator;\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/internal/semver.d.ts b/node_modules/@opentelemetry/api/build/esm/internal/semver.d.ts deleted file mode 100644 index d9f4259..0000000 --- a/node_modules/@opentelemetry/api/build/esm/internal/semver.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Create a function to test an API version to see if it is compatible with the provided ownVersion. - * - * The returned function has the following semantics: - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param ownVersion version which should be checked against - */ -export declare function _makeCompatibilityCheck(ownVersion: string): (globalVersion: string) => boolean; -/** - * Test an API version to see if it is compatible with this API. - * - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param version version of the API requesting an instance of the global API - */ -export declare const isCompatible: (globalVersion: string) => boolean; -//# sourceMappingURL=semver.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/internal/semver.js b/node_modules/@opentelemetry/api/build/esm/internal/semver.js deleted file mode 100644 index 0ba64ce..0000000 --- a/node_modules/@opentelemetry/api/build/esm/internal/semver.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { VERSION } from '../version'; -const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/; -/** - * Create a function to test an API version to see if it is compatible with the provided ownVersion. - * - * The returned function has the following semantics: - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param ownVersion version which should be checked against - */ -export function _makeCompatibilityCheck(ownVersion) { - const acceptedVersions = new Set([ownVersion]); - const rejectedVersions = new Set(); - const myVersionMatch = ownVersion.match(re); - if (!myVersionMatch) { - // we cannot guarantee compatibility so we always return noop - return () => false; - } - const ownVersionParsed = { - major: +myVersionMatch[1], - minor: +myVersionMatch[2], - patch: +myVersionMatch[3], - prerelease: myVersionMatch[4], - }; - // if ownVersion has a prerelease tag, versions must match exactly - if (ownVersionParsed.prerelease != null) { - return function isExactmatch(globalVersion) { - return globalVersion === ownVersion; - }; - } - function _reject(v) { - rejectedVersions.add(v); - return false; - } - function _accept(v) { - acceptedVersions.add(v); - return true; - } - return function isCompatible(globalVersion) { - if (acceptedVersions.has(globalVersion)) { - return true; - } - if (rejectedVersions.has(globalVersion)) { - return false; - } - const globalVersionMatch = globalVersion.match(re); - if (!globalVersionMatch) { - // cannot parse other version - // we cannot guarantee compatibility so we always noop - return _reject(globalVersion); - } - const globalVersionParsed = { - major: +globalVersionMatch[1], - minor: +globalVersionMatch[2], - patch: +globalVersionMatch[3], - prerelease: globalVersionMatch[4], - }; - // if globalVersion has a prerelease tag, versions must match exactly - if (globalVersionParsed.prerelease != null) { - return _reject(globalVersion); - } - // major versions must match - if (ownVersionParsed.major !== globalVersionParsed.major) { - return _reject(globalVersion); - } - if (ownVersionParsed.major === 0) { - if (ownVersionParsed.minor === globalVersionParsed.minor && - ownVersionParsed.patch <= globalVersionParsed.patch) { - return _accept(globalVersion); - } - return _reject(globalVersion); - } - if (ownVersionParsed.minor <= globalVersionParsed.minor) { - return _accept(globalVersion); - } - return _reject(globalVersion); - }; -} -/** - * Test an API version to see if it is compatible with this API. - * - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param version version of the API requesting an instance of the global API - */ -export const isCompatible = _makeCompatibilityCheck(VERSION); -//# sourceMappingURL=semver.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/internal/semver.js.map b/node_modules/@opentelemetry/api/build/esm/internal/semver.js.map deleted file mode 100644 index 3af80d3..0000000 --- a/node_modules/@opentelemetry/api/build/esm/internal/semver.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../src/internal/semver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,EAAE,GAAG,+BAA+B,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAkB;IAElB,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5C,IAAI,CAAC,cAAc,EAAE;QACnB,6DAA6D;QAC7D,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC;KACpB;IAED,MAAM,gBAAgB,GAAG;QACvB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;KAC9B,CAAC;IAEF,kEAAkE;IAClE,IAAI,gBAAgB,CAAC,UAAU,IAAI,IAAI,EAAE;QACvC,OAAO,SAAS,YAAY,CAAC,aAAqB;YAChD,OAAO,aAAa,KAAK,UAAU,CAAC;QACtC,CAAC,CAAC;KACH;IAED,SAAS,OAAO,CAAC,CAAS;QACxB,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS,OAAO,CAAC,CAAS;QACxB,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,SAAS,Y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OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { VERSION } from '../version';\n\nconst re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n\n/**\n * Create a function to test an API version to see if it is compatible with the provided ownVersion.\n *\n * The returned function has the following semantics:\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param ownVersion version which should be checked against\n */\nexport function _makeCompatibilityCheck(\n ownVersion: string\n): (globalVersion: string) => boolean {\n const acceptedVersions = new Set([ownVersion]);\n const rejectedVersions = new Set();\n\n const myVersionMatch = ownVersion.match(re);\n if (!myVersionMatch) {\n // we cannot guarantee compatibility so we always return noop\n return () => false;\n }\n\n const ownVersionParsed = {\n major: +myVersionMatch[1],\n minor: +myVersionMatch[2],\n patch: +myVersionMatch[3],\n prerelease: myVersionMatch[4],\n };\n\n // if ownVersion has a prerelease tag, versions must match exactly\n if (ownVersionParsed.prerelease != null) {\n return function isExactmatch(globalVersion: string): boolean {\n return globalVersion === ownVersion;\n };\n }\n\n function _reject(v: string) {\n rejectedVersions.add(v);\n return false;\n }\n\n function _accept(v: string) {\n acceptedVersions.add(v);\n return true;\n }\n\n return function isCompatible(globalVersion: string): boolean {\n if (acceptedVersions.has(globalVersion)) {\n return true;\n }\n\n if (rejectedVersions.has(globalVersion)) {\n return false;\n }\n\n const globalVersionMatch = globalVersion.match(re);\n if (!globalVersionMatch) {\n // cannot parse other version\n // we cannot guarantee compatibility so we always noop\n return _reject(globalVersion);\n }\n\n const globalVersionParsed = {\n major: +globalVersionMatch[1],\n minor: +globalVersionMatch[2],\n patch: +globalVersionMatch[3],\n prerelease: globalVersionMatch[4],\n };\n\n // if globalVersion has a prerelease tag, versions must match exactly\n if (globalVersionParsed.prerelease != null) {\n return _reject(globalVersion);\n }\n\n // major versions must match\n if (ownVersionParsed.major !== globalVersionParsed.major) {\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.major === 0) {\n if (\n ownVersionParsed.minor === globalVersionParsed.minor &&\n ownVersionParsed.patch <= globalVersionParsed.patch\n ) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.minor <= globalVersionParsed.minor) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n };\n}\n\n/**\n * Test an API version to see if it is compatible with this API.\n *\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param version version of the API requesting an instance of the global API\n */\nexport const isCompatible = _makeCompatibilityCheck(VERSION);\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics-api.d.ts b/node_modules/@opentelemetry/api/build/esm/metrics-api.d.ts deleted file mode 100644 index a5f33ae..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics-api.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { MetricsAPI } from './api/metrics'; -/** - * Entrypoint for metrics API - * - * @since 1.3.0 - */ -export declare const metrics: MetricsAPI; -//# sourceMappingURL=metrics-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics-api.js b/node_modules/@opentelemetry/api/build/esm/metrics-api.js deleted file mode 100644 index 5928528..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics-api.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { MetricsAPI } from './api/metrics'; -/** - * Entrypoint for metrics API - * - * @since 1.3.0 - */ -export const metrics = MetricsAPI.getInstance(); -//# sourceMappingURL=metrics-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics-api.js.map b/node_modules/@opentelemetry/api/build/esm/metrics-api.js.map deleted file mode 100644 index cafb066..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metrics-api.js","sourceRoot":"","sources":["../../src/metrics-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { MetricsAPI } from './api/metrics';\n/**\n * Entrypoint for metrics API\n *\n * @since 1.3.0\n */\nexport const metrics = MetricsAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/Meter.d.ts b/node_modules/@opentelemetry/api/build/esm/metrics/Meter.d.ts deleted file mode 100644 index e1236d7..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/Meter.d.ts +++ /dev/null @@ -1,114 +0,0 @@ -import type { BatchObservableCallback, Counter, Gauge, Histogram, MetricAttributes, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric'; -/** - * An interface describes additional metadata of a meter. - * - * @since 1.3.0 - */ -export interface MeterOptions { - /** - * The schemaUrl of the meter or instrumentation library - */ - schemaUrl?: string; -} -/** - * An interface to allow the recording metrics. - * - * {@link Metric}s are used for recording pre-defined aggregation (`Counter`), - * or raw values (`Histogram`) in which the aggregation and attributes - * for the exported metric are deferred. - * - * @since 1.3.0 - */ -export interface Meter { - /** - * Creates and returns a new `Gauge`. - * @param name the name of the metric. - * @param [options] the metric options. - */ - createGauge(name: string, options?: MetricOptions): Gauge; - /** - * Creates and returns a new `Histogram`. - * @param name the name of the metric. - * @param [options] the metric options. - */ - createHistogram(name: string, options?: MetricOptions): Histogram; - /** - * Creates a new `Counter` metric. Generally, this kind of metric when the - * value is a quantity, the sum is of primary interest, and the event count - * and value distribution are not of primary interest. - * @param name the name of the metric. - * @param [options] the metric options. - */ - createCounter(name: string, options?: MetricOptions): Counter; - /** - * Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous - * instrument and very similar to Counter except that Add(increment) - * supports negative increments. It is generally useful for capturing changes - * in an amount of resources used, or any quantity that rises and falls - * during a request. - * Example uses for UpDownCounter: - *
    - *
  1. count the number of active requests.
  2. - *
  3. count memory in use by instrumenting new and delete.
  4. - *
  5. count queue size by instrumenting enqueue and dequeue.
  6. - *
  7. count semaphore up and down operations.
  8. - *
- * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createUpDownCounter(name: string, options?: MetricOptions): UpDownCounter; - /** - * Creates a new `ObservableGauge` metric. - * - * The callback SHOULD be safe to be invoked concurrently. - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createObservableGauge(name: string, options?: MetricOptions): ObservableGauge; - /** - * Creates a new `ObservableCounter` metric. - * - * The callback SHOULD be safe to be invoked concurrently. - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createObservableCounter(name: string, options?: MetricOptions): ObservableCounter; - /** - * Creates a new `ObservableUpDownCounter` metric. - * - * The callback SHOULD be safe to be invoked concurrently. - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createObservableUpDownCounter(name: string, options?: MetricOptions): ObservableUpDownCounter; - /** - * Sets up a function that will be called whenever a metric collection is - * initiated. - * - * If the function is already in the list of callbacks for this Observable, - * the function is not added a second time. - * - * Only the associated observables can be observed in the callback. - * Measurements of observables that are not associated observed in the - * callback are dropped. - * - * @param callback the batch observable callback - * @param observables the observables associated with this batch observable callback - */ - addBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void; - /** - * Removes a callback previously registered with {@link Meter.addBatchObservableCallback}. - * - * The callback to be removed is identified using a combination of the callback itself, - * and the set of the observables associated with it. - * - * @param callback the batch observable callback - * @param observables the observables associated with this batch observable callback - */ - removeBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void; -} -//# sourceMappingURL=Meter.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/Meter.js b/node_modules/@opentelemetry/api/build/esm/metrics/Meter.js deleted file mode 100644 index 6698765..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/Meter.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=Meter.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/Meter.js.map b/node_modules/@opentelemetry/api/build/esm/metrics/Meter.js.map deleted file mode 100644 index c72178a..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/Meter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Meter.js","sourceRoot":"","sources":["../../../src/metrics/Meter.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n BatchObservableCallback,\n Counter,\n Gauge,\n Histogram,\n MetricAttributes,\n MetricOptions,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n} from './Metric';\n\n/**\n * An interface describes additional metadata of a meter.\n *\n * @since 1.3.0\n */\nexport interface MeterOptions {\n /**\n * The schemaUrl of the meter or instrumentation library\n */\n schemaUrl?: string;\n}\n\n/**\n * An interface to allow the recording metrics.\n *\n * {@link Metric}s are used for recording pre-defined aggregation (`Counter`),\n * or raw values (`Histogram`) in which the aggregation and attributes\n * for the exported metric are deferred.\n *\n * @since 1.3.0\n */\nexport interface Meter {\n /**\n * Creates and returns a new `Gauge`.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createGauge(\n name: string,\n options?: MetricOptions\n ): Gauge;\n\n /**\n * Creates and returns a new `Histogram`.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createHistogram(\n name: string,\n options?: MetricOptions\n ): Histogram;\n\n /**\n * Creates a new `Counter` metric. Generally, this kind of metric when the\n * value is a quantity, the sum is of primary interest, and the event count\n * and value distribution are not of primary interest.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createCounter(\n name: string,\n options?: MetricOptions\n ): Counter;\n\n /**\n * Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous\n * instrument and very similar to Counter except that Add(increment)\n * supports negative increments. It is generally useful for capturing changes\n * in an amount of resources used, or any quantity that rises and falls\n * during a request.\n * Example uses for UpDownCounter:\n *
    \n *
  1. count the number of active requests.
  2. \n *
  3. count memory in use by instrumenting new and delete.
  4. \n *
  5. count queue size by instrumenting enqueue and dequeue.
  6. \n *
  7. count semaphore up and down operations.
  8. \n *
\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): UpDownCounter;\n\n /**\n * Creates a new `ObservableGauge` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableGauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): ObservableGauge;\n\n /**\n * Creates a new `ObservableCounter` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): ObservableCounter;\n\n /**\n * Creates a new `ObservableUpDownCounter` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): ObservableUpDownCounter;\n\n /**\n * Sets up a function that will be called whenever a metric collection is\n * initiated.\n *\n * If the function is already in the list of callbacks for this Observable,\n * the function is not added a second time.\n *\n * Only the associated observables can be observed in the callback.\n * Measurements of observables that are not associated observed in the\n * callback are dropped.\n *\n * @param callback the batch observable callback\n * @param observables the observables associated with this batch observable callback\n */\n addBatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n callback: BatchObservableCallback,\n observables: Observable[]\n ): void;\n\n /**\n * Removes a callback previously registered with {@link Meter.addBatchObservableCallback}.\n *\n * The callback to be removed is identified using a combination of the callback itself,\n * and the set of the observables associated with it.\n *\n * @param callback the batch observable callback\n * @param observables the observables associated with this batch observable callback\n */\n removeBatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n callback: BatchObservableCallback,\n observables: Observable[]\n ): void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/MeterProvider.d.ts b/node_modules/@opentelemetry/api/build/esm/metrics/MeterProvider.d.ts deleted file mode 100644 index 83378c5..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/MeterProvider.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { Meter, MeterOptions } from './Meter'; -/** - * A registry for creating named {@link Meter}s. - * - * @since 1.3.0 - */ -export interface MeterProvider { - /** - * Returns a Meter, creating one if one with the given name, version, and - * schemaUrl pair is not already created. - * - * @param name The name of the meter or instrumentation library. - * @param version The version of the meter or instrumentation library. - * @param options The options of the meter or instrumentation library. - * @returns Meter A Meter with the given name and version - */ - getMeter(name: string, version?: string, options?: MeterOptions): Meter; -} -//# sourceMappingURL=MeterProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/MeterProvider.js b/node_modules/@opentelemetry/api/build/esm/metrics/MeterProvider.js deleted file mode 100644 index ea77b98..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/MeterProvider.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=MeterProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/MeterProvider.js.map b/node_modules/@opentelemetry/api/build/esm/metrics/MeterProvider.js.map deleted file mode 100644 index 3aeb498..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/MeterProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MeterProvider.js","sourceRoot":"","sources":["../../../src/metrics/MeterProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter, MeterOptions } from './Meter';\n\n/**\n * A registry for creating named {@link Meter}s.\n *\n * @since 1.3.0\n */\nexport interface MeterProvider {\n /**\n * Returns a Meter, creating one if one with the given name, version, and\n * schemaUrl pair is not already created.\n *\n * @param name The name of the meter or instrumentation library.\n * @param version The version of the meter or instrumentation library.\n * @param options The options of the meter or instrumentation library.\n * @returns Meter A Meter with the given name and version\n */\n getMeter(name: string, version?: string, options?: MeterOptions): Meter;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/Metric.d.ts b/node_modules/@opentelemetry/api/build/esm/metrics/Metric.d.ts deleted file mode 100644 index c298737..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/Metric.d.ts +++ /dev/null @@ -1,183 +0,0 @@ -import type { Attributes, AttributeValue } from '../common/Attributes'; -import type { Context } from '../context/types'; -/** - * Advisory options influencing aggregation configuration parameters. - * - * @since 1.7.0 - * @experimental - */ -export interface MetricAdvice { - /** - * Hint the explicit bucket boundaries for SDK if the metric is been - * aggregated with a HistogramAggregator. - */ - explicitBucketBoundaries?: number[]; -} -/** - * Options needed for metric creation - * - * @since 1.3.0 - */ -export interface MetricOptions { - /** - * The description of the Metric. - * @default '' - */ - description?: string; - /** - * The unit of the Metric values. - * @default '' - */ - unit?: string; - /** - * Indicates the type of the recorded value. - * @default {@link ValueType.DOUBLE} - */ - valueType?: ValueType; - /** - * The advice influencing aggregation configuration parameters. - * @experimental - * @since 1.7.0 - */ - advice?: MetricAdvice; -} -/** - * The Type of value. It describes how the data is reported. - * - * @since 1.3.0 - */ -export declare enum ValueType { - INT = 0, - DOUBLE = 1 -} -/** - * Counter is the most common synchronous instrument. This instrument supports - * an `Add(increment)` function for reporting a sum, and is restricted to - * non-negative increments. The default aggregation is Sum, as for any additive - * instrument. - * - * Example uses for Counter: - *
    - *
  1. count the number of bytes received.
  2. - *
  3. count the number of requests completed.
  4. - *
  5. count the number of accounts created.
  6. - *
  7. count the number of checkpoints run.
  8. - *
  9. count the number of 5xx errors.
  10. - *
      - * - * @since 1.3.0 - */ -export interface Counter { - /** - * Increment value of counter by the input. Inputs must not be negative. - */ - add(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @since 1.3.0 - */ -export interface UpDownCounter { - /** - * Increment value of counter by the input. Inputs may be negative. - */ - add(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @since 1.9.0 - */ -export interface Gauge { - /** - * Records a measurement. - */ - record(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @since 1.3.0 - */ -export interface Histogram { - /** - * Records a measurement. Value of the measurement must not be negative. - */ - record(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @deprecated please use {@link Attributes} - * @since 1.3.0 - */ -export type MetricAttributes = Attributes; -/** - * @deprecated please use {@link AttributeValue} - * @since 1.3.0 - */ -export type MetricAttributeValue = AttributeValue; -/** - * Interface that is being used in callback function for Observable Metric. - * - * @since 1.3.0 - */ -export interface ObservableResult { - /** - * Observe a measurement of the value associated with the given attributes. - * - * @param value The value to be observed. - * @param attributes The attributes associated with the value. If more than - * one value is associated with the same attributes values, SDK may pick the - * last one or simply drop the entire observable result. - */ - observe(this: ObservableResult, value: number, attributes?: AttributesTypes): void; -} -/** - * Interface that is being used in batch observable callback function. - */ -export interface BatchObservableResult { - /** - * Observe a measurement of the value associated with the given attributes. - * - * @param metric The observable metric to be observed. - * @param value The value to be observed. - * @param attributes The attributes associated with the value. If more than - * one value is associated with the same attributes values, SDK may pick the - * last one or simply drop the entire observable result. - */ - observe(this: BatchObservableResult, metric: Observable, value: number, attributes?: AttributesTypes): void; -} -/** - * The observable callback for Observable instruments. - * - * @since 1.3.0 - */ -export type ObservableCallback = (observableResult: ObservableResult) => void | Promise; -/** - * The observable callback for a batch of Observable instruments. - * - * @since 1.3.0 - */ -export type BatchObservableCallback = (observableResult: BatchObservableResult) => void | Promise; -/** - * @since 1.3.0 - */ -export interface Observable { - /** - * Sets up a function that will be called whenever a metric collection is initiated. - * - * If the function is already in the list of callbacks for this Observable, the function is not added a second time. - */ - addCallback(callback: ObservableCallback): void; - /** - * Removes a callback previously registered with {@link Observable.addCallback}. - */ - removeCallback(callback: ObservableCallback): void; -} -/** - * @since 1.3.0 - */ -export type ObservableCounter = Observable; -/** - * @since 1.3.0 - */ -export type ObservableUpDownCounter = Observable; -/** - * @since 1.3.0 - */ -export type ObservableGauge = Observable; -//# sourceMappingURL=Metric.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/Metric.js b/node_modules/@opentelemetry/api/build/esm/metrics/Metric.js deleted file mode 100644 index 155db39..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/Metric.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * The Type of value. It describes how the data is reported. - * - * @since 1.3.0 - */ -export var ValueType; -(function (ValueType) { - ValueType[ValueType["INT"] = 0] = "INT"; - ValueType[ValueType["DOUBLE"] = 1] = "DOUBLE"; -})(ValueType || (ValueType = {})); -//# sourceMappingURL=Metric.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/Metric.js.map b/node_modules/@opentelemetry/api/build/esm/metrics/Metric.js.map deleted file mode 100644 index 487204b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/Metric.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../../src/metrics/Metric.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmDH;;;;GAIG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;AACR,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes, AttributeValue } from '../common/Attributes';\nimport type { Context } from '../context/types';\n\n/**\n * Advisory options influencing aggregation configuration parameters.\n *\n * @since 1.7.0\n * @experimental\n */\nexport interface MetricAdvice {\n /**\n * Hint the explicit bucket boundaries for SDK if the metric is been\n * aggregated with a HistogramAggregator.\n */\n explicitBucketBoundaries?: number[];\n}\n\n/**\n * Options needed for metric creation\n *\n * @since 1.3.0\n */\nexport interface MetricOptions {\n /**\n * The description of the Metric.\n * @default ''\n */\n description?: string;\n\n /**\n * The unit of the Metric values.\n * @default ''\n */\n unit?: string;\n\n /**\n * Indicates the type of the recorded value.\n * @default {@link ValueType.DOUBLE}\n */\n valueType?: ValueType;\n\n /**\n * The advice influencing aggregation configuration parameters.\n * @experimental\n * @since 1.7.0\n */\n advice?: MetricAdvice;\n}\n\n/**\n * The Type of value. It describes how the data is reported.\n *\n * @since 1.3.0\n */\nexport enum ValueType {\n INT,\n DOUBLE,\n}\n\n/**\n * Counter is the most common synchronous instrument. This instrument supports\n * an `Add(increment)` function for reporting a sum, and is restricted to\n * non-negative increments. The default aggregation is Sum, as for any additive\n * instrument.\n *\n * Example uses for Counter:\n *
        \n *
      1. count the number of bytes received.
      2. \n *
      3. count the number of requests completed.
      4. \n *
      5. count the number of accounts created.
      6. \n *
      7. count the number of checkpoints run.
      8. \n *
      9. count the number of 5xx errors.
      10. \n *
          \n *\n * @since 1.3.0\n */\nexport interface Counter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Increment value of counter by the input. Inputs must not be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport interface UpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Increment value of counter by the input. Inputs may be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.9.0\n */\nexport interface Gauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Records a measurement.\n */\n record(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport interface Histogram<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Records a measurement. Value of the measurement must not be negative.\n */\n record(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @deprecated please use {@link Attributes}\n * @since 1.3.0\n */\nexport type MetricAttributes = Attributes;\n\n/**\n * @deprecated please use {@link AttributeValue}\n * @since 1.3.0\n */\nexport type MetricAttributeValue = AttributeValue;\n\n/**\n * Interface that is being used in callback function for Observable Metric.\n *\n * @since 1.3.0\n */\nexport interface ObservableResult<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Observe a measurement of the value associated with the given attributes.\n *\n * @param value The value to be observed.\n * @param attributes The attributes associated with the value. If more than\n * one value is associated with the same attributes values, SDK may pick the\n * last one or simply drop the entire observable result.\n */\n observe(\n this: ObservableResult,\n value: number,\n attributes?: AttributesTypes\n ): void;\n}\n\n/**\n * Interface that is being used in batch observable callback function.\n */\nexport interface BatchObservableResult<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Observe a measurement of the value associated with the given attributes.\n *\n * @param metric The observable metric to be observed.\n * @param value The value to be observed.\n * @param attributes The attributes associated with the value. If more than\n * one value is associated with the same attributes values, SDK may pick the\n * last one or simply drop the entire observable result.\n */\n observe(\n this: BatchObservableResult,\n metric: Observable,\n value: number,\n attributes?: AttributesTypes\n ): void;\n}\n\n/**\n * The observable callback for Observable instruments.\n *\n * @since 1.3.0\n */\nexport type ObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = (\n observableResult: ObservableResult\n) => void | Promise;\n\n/**\n * The observable callback for a batch of Observable instruments.\n *\n * @since 1.3.0\n */\nexport type BatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = (\n observableResult: BatchObservableResult\n) => void | Promise;\n\n/**\n * @since 1.3.0\n */\nexport interface Observable<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Sets up a function that will be called whenever a metric collection is initiated.\n *\n * If the function is already in the list of callbacks for this Observable, the function is not added a second time.\n */\n addCallback(callback: ObservableCallback): void;\n\n /**\n * Removes a callback previously registered with {@link Observable.addCallback}.\n */\n removeCallback(callback: ObservableCallback): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport type ObservableCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable;\n/**\n * @since 1.3.0\n */\nexport type ObservableUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable;\n/**\n * @since 1.3.0\n */\nexport type ObservableGauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.d.ts b/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.d.ts deleted file mode 100644 index 408aa24..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -import type { Meter } from './Meter'; -import type { BatchObservableCallback, Counter, Gauge, Histogram, MetricAttributes, MetricOptions, Observable, ObservableCallback, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric'; -/** - * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses - * constant NoopMetrics for all of its methods. - */ -export declare class NoopMeter implements Meter { - constructor(); - /** - * @see {@link Meter.createGauge} - */ - createGauge(_name: string, _options?: MetricOptions): Gauge; - /** - * @see {@link Meter.createHistogram} - */ - createHistogram(_name: string, _options?: MetricOptions): Histogram; - /** - * @see {@link Meter.createCounter} - */ - createCounter(_name: string, _options?: MetricOptions): Counter; - /** - * @see {@link Meter.createUpDownCounter} - */ - createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter; - /** - * @see {@link Meter.createObservableGauge} - */ - createObservableGauge(_name: string, _options?: MetricOptions): ObservableGauge; - /** - * @see {@link Meter.createObservableCounter} - */ - createObservableCounter(_name: string, _options?: MetricOptions): ObservableCounter; - /** - * @see {@link Meter.createObservableUpDownCounter} - */ - createObservableUpDownCounter(_name: string, _options?: MetricOptions): ObservableUpDownCounter; - /** - * @see {@link Meter.addBatchObservableCallback} - */ - addBatchObservableCallback(_callback: BatchObservableCallback, _observables: Observable[]): void; - /** - * @see {@link Meter.removeBatchObservableCallback} - */ - removeBatchObservableCallback(_callback: BatchObservableCallback): void; -} -export declare class NoopMetric { -} -export declare class NoopCounterMetric extends NoopMetric implements Counter { - add(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopUpDownCounterMetric extends NoopMetric implements UpDownCounter { - add(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopGaugeMetric extends NoopMetric implements Gauge { - record(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopHistogramMetric extends NoopMetric implements Histogram { - record(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopObservableMetric { - addCallback(_callback: ObservableCallback): void; - removeCallback(_callback: ObservableCallback): void; -} -export declare class NoopObservableCounterMetric extends NoopObservableMetric implements ObservableCounter { -} -export declare class NoopObservableGaugeMetric extends NoopObservableMetric implements ObservableGauge { -} -export declare class NoopObservableUpDownCounterMetric extends NoopObservableMetric implements ObservableUpDownCounter { -} -export declare const NOOP_METER: NoopMeter; -export declare const NOOP_COUNTER_METRIC: NoopCounterMetric; -export declare const NOOP_GAUGE_METRIC: NoopGaugeMetric; -export declare const NOOP_HISTOGRAM_METRIC: NoopHistogramMetric; -export declare const NOOP_UP_DOWN_COUNTER_METRIC: NoopUpDownCounterMetric; -export declare const NOOP_OBSERVABLE_COUNTER_METRIC: NoopObservableCounterMetric; -export declare const NOOP_OBSERVABLE_GAUGE_METRIC: NoopObservableGaugeMetric; -export declare const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC: NoopObservableUpDownCounterMetric; -/** - * Create a no-op Meter - * - * @since 1.3.0 - */ -export declare function createNoopMeter(): Meter; -//# sourceMappingURL=NoopMeter.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js b/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js deleted file mode 100644 index 7125b36..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses - * constant NoopMetrics for all of its methods. - */ -export class NoopMeter { - constructor() { } - /** - * @see {@link Meter.createGauge} - */ - createGauge(_name, _options) { - return NOOP_GAUGE_METRIC; - } - /** - * @see {@link Meter.createHistogram} - */ - createHistogram(_name, _options) { - return NOOP_HISTOGRAM_METRIC; - } - /** - * @see {@link Meter.createCounter} - */ - createCounter(_name, _options) { - return NOOP_COUNTER_METRIC; - } - /** - * @see {@link Meter.createUpDownCounter} - */ - createUpDownCounter(_name, _options) { - return NOOP_UP_DOWN_COUNTER_METRIC; - } - /** - * @see {@link Meter.createObservableGauge} - */ - createObservableGauge(_name, _options) { - return NOOP_OBSERVABLE_GAUGE_METRIC; - } - /** - * @see {@link Meter.createObservableCounter} - */ - createObservableCounter(_name, _options) { - return NOOP_OBSERVABLE_COUNTER_METRIC; - } - /** - * @see {@link Meter.createObservableUpDownCounter} - */ - createObservableUpDownCounter(_name, _options) { - return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC; - } - /** - * @see {@link Meter.addBatchObservableCallback} - */ - addBatchObservableCallback(_callback, _observables) { } - /** - * @see {@link Meter.removeBatchObservableCallback} - */ - removeBatchObservableCallback(_callback) { } -} -export class NoopMetric { -} -export class NoopCounterMetric extends NoopMetric { - add(_value, _attributes) { } -} -export class NoopUpDownCounterMetric extends NoopMetric { - add(_value, _attributes) { } -} -export class NoopGaugeMetric extends NoopMetric { - record(_value, _attributes) { } -} -export class NoopHistogramMetric extends NoopMetric { - record(_value, _attributes) { } -} -export class NoopObservableMetric { - addCallback(_callback) { } - removeCallback(_callback) { } -} -export class NoopObservableCounterMetric extends NoopObservableMetric { -} -export class NoopObservableGaugeMetric extends NoopObservableMetric { -} -export class NoopObservableUpDownCounterMetric extends NoopObservableMetric { -} -export const NOOP_METER = new NoopMeter(); -// Synchronous instruments -export const NOOP_COUNTER_METRIC = new NoopCounterMetric(); -export const NOOP_GAUGE_METRIC = new NoopGaugeMetric(); -export const NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric(); -export const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric(); -// Asynchronous instruments -export const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric(); -export const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric(); -export const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric(); -/** - * Create a no-op Meter - * - * @since 1.3.0 - */ -export function createNoopMeter() { - return NOOP_METER; -} -//# sourceMappingURL=NoopMeter.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js.map b/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js.map deleted file mode 100644 index 65fa846..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopMeter.js","sourceRoot":"","sources":["../../../src/metrics/NoopMeter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH;;;GAGG;AACH,MAAM,OAAO,SAAS;IACpB,gBAAe,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,KAAa,EAAE,QAAwB;QACjD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,KAAa,EAAE,QAAwB;QACrD,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,KAAa,EAAE,QAAwB;QACnD,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,KAAa,EAAE,QAAwB;QACzD,OAAO,2BAA2B,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,qBAAqB,CACnB,KAAa,EACb,QAAwB;QAExB,OAAO,4BAA4B,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,uBAAuB,CACrB,KAAa,EACb,QAAwB;QAExB,OAAO,8BAA8B,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,6BAA6B,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G,IAAI,2BAA2B,EAAE,CAAC;AAChF,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,yBAAyB,EAAE,CAAC;AAC5E,MAAM,CAAC,MAAM,sCAAsC,GACjD,IAAI,iCAAiC,EAAE,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter } from './Meter';\nimport type {\n BatchObservableCallback,\n Counter,\n Gauge,\n Histogram,\n MetricAttributes,\n MetricOptions,\n Observable,\n ObservableCallback,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n} from './Metric';\n\n/**\n * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses\n * constant NoopMetrics for all of its methods.\n */\nexport class NoopMeter implements Meter {\n constructor() {}\n\n /**\n * @see {@link Meter.createGauge}\n */\n createGauge(_name: string, _options?: MetricOptions): Gauge {\n return NOOP_GAUGE_METRIC;\n }\n\n /**\n * @see {@link Meter.createHistogram}\n */\n createHistogram(_name: string, _options?: MetricOptions): Histogram {\n return NOOP_HISTOGRAM_METRIC;\n }\n\n /**\n * @see {@link Meter.createCounter}\n */\n createCounter(_name: string, _options?: MetricOptions): Counter {\n return NOOP_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createUpDownCounter}\n */\n createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter {\n return NOOP_UP_DOWN_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableGauge}\n */\n createObservableGauge(\n _name: string,\n _options?: MetricOptions\n ): ObservableGauge {\n return NOOP_OBSERVABLE_GAUGE_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableCounter}\n */\n createObservableCounter(\n _name: string,\n _options?: MetricOptions\n ): ObservableCounter {\n return NOOP_OBSERVABLE_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableUpDownCounter}\n */\n createObservableUpDownCounter(\n _name: string,\n _options?: MetricOptions\n ): ObservableUpDownCounter {\n return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.addBatchObservableCallback}\n */\n addBatchObservableCallback(\n _callback: BatchObservableCallback,\n _observables: Observable[]\n ): void {}\n\n /**\n * @see {@link Meter.removeBatchObservableCallback}\n */\n removeBatchObservableCallback(_callback: BatchObservableCallback): void {}\n}\n\nexport class NoopMetric {}\n\nexport class NoopCounterMetric extends NoopMetric implements Counter {\n add(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopUpDownCounterMetric\n extends NoopMetric\n implements UpDownCounter\n{\n add(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopGaugeMetric extends NoopMetric implements Gauge {\n record(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopHistogramMetric extends NoopMetric implements Histogram {\n record(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopObservableMetric {\n addCallback(_callback: ObservableCallback) {}\n\n removeCallback(_callback: ObservableCallback) {}\n}\n\nexport class NoopObservableCounterMetric\n extends NoopObservableMetric\n implements ObservableCounter {}\n\nexport class NoopObservableGaugeMetric\n extends NoopObservableMetric\n implements ObservableGauge {}\n\nexport class NoopObservableUpDownCounterMetric\n extends NoopObservableMetric\n implements ObservableUpDownCounter {}\n\nexport const NOOP_METER = new NoopMeter();\n\n// Synchronous instruments\nexport const NOOP_COUNTER_METRIC = new NoopCounterMetric();\nexport const NOOP_GAUGE_METRIC = new NoopGaugeMetric();\nexport const NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric();\nexport const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();\n\n// Asynchronous instruments\nexport const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();\nexport const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();\nexport const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC =\n new NoopObservableUpDownCounterMetric();\n\n/**\n * Create a no-op Meter\n *\n * @since 1.3.0\n */\nexport function createNoopMeter(): Meter {\n return NOOP_METER;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.d.ts b/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.d.ts deleted file mode 100644 index 50cf9ae..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Meter, MeterOptions } from './Meter'; -import type { MeterProvider } from './MeterProvider'; -/** - * An implementation of the {@link MeterProvider} which returns an impotent Meter - * for all calls to `getMeter` - */ -export declare class NoopMeterProvider implements MeterProvider { - getMeter(_name: string, _version?: string, _options?: MeterOptions): Meter; -} -export declare const NOOP_METER_PROVIDER: NoopMeterProvider; -//# sourceMappingURL=NoopMeterProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js b/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js deleted file mode 100644 index 7adc79a..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { NOOP_METER } from './NoopMeter'; -/** - * An implementation of the {@link MeterProvider} which returns an impotent Meter - * for all calls to `getMeter` - */ -export class NoopMeterProvider { - getMeter(_name, _version, _options) { - return NOOP_METER; - } -} -export const NOOP_METER_PROVIDER = new NoopMeterProvider(); -//# sourceMappingURL=NoopMeterProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js.map b/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js.map deleted file mode 100644 index 0c9b3f5..0000000 --- a/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopMeterProvider.js","sourceRoot":"","sources":["../../../src/metrics/NoopMeterProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAC5B,QAAQ,CAAC,KAAa,EAAE,QAAiB,EAAE,QAAuB;QAChE,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,iBAAiB,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter, MeterOptions } from './Meter';\nimport type { MeterProvider } from './MeterProvider';\nimport { NOOP_METER } from './NoopMeter';\n\n/**\n * An implementation of the {@link MeterProvider} which returns an impotent Meter\n * for all calls to `getMeter`\n */\nexport class NoopMeterProvider implements MeterProvider {\n getMeter(_name: string, _version?: string, _options?: MeterOptions): Meter {\n return NOOP_METER;\n }\n}\n\nexport const NOOP_METER_PROVIDER = new NoopMeterProvider();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/propagation-api.d.ts b/node_modules/@opentelemetry/api/build/esm/propagation-api.d.ts deleted file mode 100644 index 66df25f..0000000 --- a/node_modules/@opentelemetry/api/build/esm/propagation-api.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { PropagationAPI } from './api/propagation'; -/** - * Entrypoint for propagation API - * - * @since 1.0.0 - */ -export declare const propagation: PropagationAPI; -//# sourceMappingURL=propagation-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/propagation-api.js b/node_modules/@opentelemetry/api/build/esm/propagation-api.js deleted file mode 100644 index eff0273..0000000 --- a/node_modules/@opentelemetry/api/build/esm/propagation-api.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { PropagationAPI } from './api/propagation'; -/** - * Entrypoint for propagation API - * - * @since 1.0.0 - */ -export const propagation = PropagationAPI.getInstance(); -//# sourceMappingURL=propagation-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/propagation-api.js.map b/node_modules/@opentelemetry/api/build/esm/propagation-api.js.map deleted file mode 100644 index 3845fdc..0000000 --- a/node_modules/@opentelemetry/api/build/esm/propagation-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"propagation-api.js","sourceRoot":"","sources":["../../src/propagation-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { PropagationAPI } from './api/propagation';\n/**\n * Entrypoint for propagation API\n *\n * @since 1.0.0\n */\nexport const propagation = PropagationAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.d.ts b/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.d.ts deleted file mode 100644 index 9ea4a42..0000000 --- a/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Context } from '../context/types'; -import type { TextMapPropagator } from './TextMapPropagator'; -/** - * No-op implementations of {@link TextMapPropagator}. - */ -export declare class NoopTextMapPropagator implements TextMapPropagator { - /** Noop inject function does nothing */ - inject(_context: Context, _carrier: unknown): void; - /** Noop extract function does nothing and returns the input context */ - extract(context: Context, _carrier: unknown): Context; - fields(): string[]; -} -//# sourceMappingURL=NoopTextMapPropagator.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js b/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js deleted file mode 100644 index 6e34483..0000000 --- a/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * No-op implementations of {@link TextMapPropagator}. - */ -export class NoopTextMapPropagator { - /** Noop inject function does nothing */ - inject(_context, _carrier) { } - /** Noop extract function does nothing and returns the input context */ - extract(context, _carrier) { - return context; - } - fields() { - return []; - } -} -//# sourceMappingURL=NoopTextMapPropagator.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js.map b/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js.map deleted file mode 100644 index f4316c6..0000000 --- a/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopTextMapPropagator.js","sourceRoot":"","sources":["../../../src/propagation/NoopTextMapPropagator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAChC,wCAAwC;IACxC,MAAM,CAAC,QAAiB,EAAE,QAAiB,IAAS,CAAC;IACrD,uEAAuE;IACvE,OAAO,CAAC,OAAgB,EAAE,QAAiB;QACzC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM;QACJ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport type { TextMapPropagator } from './TextMapPropagator';\n\n/**\n * No-op implementations of {@link TextMapPropagator}.\n */\nexport class NoopTextMapPropagator implements TextMapPropagator {\n /** Noop inject function does nothing */\n inject(_context: Context, _carrier: unknown): void {}\n /** Noop extract function does nothing and returns the input context */\n extract(context: Context, _carrier: unknown): Context {\n return context;\n }\n fields(): string[] {\n return [];\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.d.ts b/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.d.ts deleted file mode 100644 index 057552e..0000000 --- a/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -import type { Context } from '../context/types'; -/** - * Injects `Context` into and extracts it from carriers that travel - * in-band across process boundaries. Encoding is expected to conform to the - * HTTP Header Field semantics. Values are often encoded as RPC/HTTP request - * headers. - * - * The carrier of propagated data on both the client (injector) and server - * (extractor) side is usually an object such as http headers. Propagation is - * usually implemented via library-specific request interceptors, where the - * client-side injects values and the server-side extracts them. - * - * @since 1.0.0 - */ -export interface TextMapPropagator { - /** - * Injects values from a given `Context` into a carrier. - * - * OpenTelemetry defines a common set of format values (TextMapPropagator), - * and each has an expected `carrier` type. - * - * @param context the Context from which to extract values to transmit over - * the wire. - * @param carrier the carrier of propagation fields, such as http request - * headers. - * @param setter an optional {@link TextMapSetter}. If undefined, values will be - * set by direct object assignment. - */ - inject(context: Context, carrier: Carrier, setter: TextMapSetter): void; - /** - * Given a `Context` and a carrier, extract context values from a - * carrier and return a new context, created from the old context, with the - * extracted values. - * - * @param context the Context from which to extract values to transmit over - * the wire. - * @param carrier the carrier of propagation fields, such as http request - * headers. - * @param getter an optional {@link TextMapGetter}. If undefined, keys will be all - * own properties, and keys will be accessed by direct object access. - */ - extract(context: Context, carrier: Carrier, getter: TextMapGetter): Context; - /** - * Return a list of all fields which may be used by the propagator. - */ - fields(): string[]; -} -/** - * A setter is specified by the caller to define a specific method - * to set key/value pairs on the carrier within a propagator - * - * @since 1.0.0 - */ -export interface TextMapSetter { - /** - * Callback used to set a key/value pair on an object. - * - * Should be called by the propagator each time a key/value pair - * should be set, and should set that key/value pair on the propagator. - * - * @param carrier object or class which carries key/value pairs - * @param key string key to modify - * @param value value to be set to the key on the carrier - */ - set(carrier: Carrier, key: string, value: string): void; -} -/** - * A getter is specified by the caller to define a specific method - * to get the value of a key from a carrier. - * - * @since 1.0.0 - */ -export interface TextMapGetter { - /** - * Get a list of all keys available on the carrier. - * - * @param carrier - */ - keys(carrier: Carrier): string[]; - /** - * Get the value of a specific key from the carrier. - * - * @param carrier - * @param key - */ - get(carrier: Carrier, key: string): undefined | string | string[]; -} -/** - * @since 1.0.0 - */ -export declare const defaultTextMapGetter: TextMapGetter; -/** - * @since 1.0.0 - */ -export declare const defaultTextMapSetter: TextMapSetter; -//# sourceMappingURL=TextMapPropagator.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js b/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js deleted file mode 100644 index 8d8ec5c..0000000 --- a/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * @since 1.0.0 - */ -export const defaultTextMapGetter = { - get(carrier, key) { - if (carrier == null) { - return undefined; - } - return carrier[key]; - }, - keys(carrier) { - if (carrier == null) { - return []; - } - return Object.keys(carrier); - }, -}; -/** - * @since 1.0.0 - */ -export const defaultTextMapSetter = { - set(carrier, key, value) { - if (carrier == null) { - return; - } - carrier[key] = value; - }, -}; -//# sourceMappingURL=TextMapPropagator.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js.map b/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js.map deleted file mode 100644 index 5de140b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"TextMapPropagator.js","sourceRoot":"","sources":["../../../src/propagation/TextMapPropagator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2GH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IACjD,GAAG,CAAC,OAAO,EAAE,GAAG;QACd,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,OAAO;QACV,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO,EAAE,CAAC;SACX;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IACjD,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK;QACrB,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO;SACR;QAED,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\n\n/**\n * Injects `Context` into and extracts it from carriers that travel\n * in-band across process boundaries. Encoding is expected to conform to the\n * HTTP Header Field semantics. Values are often encoded as RPC/HTTP request\n * headers.\n *\n * The carrier of propagated data on both the client (injector) and server\n * (extractor) side is usually an object such as http headers. Propagation is\n * usually implemented via library-specific request interceptors, where the\n * client-side injects values and the server-side extracts them.\n *\n * @since 1.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TextMapPropagator {\n /**\n * Injects values from a given `Context` into a carrier.\n *\n * OpenTelemetry defines a common set of format values (TextMapPropagator),\n * and each has an expected `carrier` type.\n *\n * @param context the Context from which to extract values to transmit over\n * the wire.\n * @param carrier the carrier of propagation fields, such as http request\n * headers.\n * @param setter an optional {@link TextMapSetter}. If undefined, values will be\n * set by direct object assignment.\n */\n inject(\n context: Context,\n carrier: Carrier,\n setter: TextMapSetter\n ): void;\n\n /**\n * Given a `Context` and a carrier, extract context values from a\n * carrier and return a new context, created from the old context, with the\n * extracted values.\n *\n * @param context the Context from which to extract values to transmit over\n * the wire.\n * @param carrier the carrier of propagation fields, such as http request\n * headers.\n * @param getter an optional {@link TextMapGetter}. If undefined, keys will be all\n * own properties, and keys will be accessed by direct object access.\n */\n extract(\n context: Context,\n carrier: Carrier,\n getter: TextMapGetter\n ): Context;\n\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n fields(): string[];\n}\n\n/**\n * A setter is specified by the caller to define a specific method\n * to set key/value pairs on the carrier within a propagator\n *\n * @since 1.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TextMapSetter {\n /**\n * Callback used to set a key/value pair on an object.\n *\n * Should be called by the propagator each time a key/value pair\n * should be set, and should set that key/value pair on the propagator.\n *\n * @param carrier object or class which carries key/value pairs\n * @param key string key to modify\n * @param value value to be set to the key on the carrier\n */\n set(carrier: Carrier, key: string, value: string): void;\n}\n\n/**\n * A getter is specified by the caller to define a specific method\n * to get the value of a key from a carrier.\n *\n * @since 1.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TextMapGetter {\n /**\n * Get a list of all keys available on the carrier.\n *\n * @param carrier\n */\n keys(carrier: Carrier): string[];\n\n /**\n * Get the value of a specific key from the carrier.\n *\n * @param carrier\n * @param key\n */\n get(carrier: Carrier, key: string): undefined | string | string[];\n}\n\n/**\n * @since 1.0.0\n */\nexport const defaultTextMapGetter: TextMapGetter = {\n get(carrier, key) {\n if (carrier == null) {\n return undefined;\n }\n return carrier[key];\n },\n\n keys(carrier) {\n if (carrier == null) {\n return [];\n }\n return Object.keys(carrier);\n },\n};\n\n/**\n * @since 1.0.0\n */\nexport const defaultTextMapSetter: TextMapSetter = {\n set(carrier, key, value) {\n if (carrier == null) {\n return;\n }\n\n carrier[key] = value;\n },\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace-api.d.ts b/node_modules/@opentelemetry/api/build/esm/trace-api.d.ts deleted file mode 100644 index 7064168..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace-api.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { TraceAPI } from './api/trace'; -/** - * Entrypoint for trace API - * - * @since 1.0.0 - */ -export declare const trace: TraceAPI; -//# sourceMappingURL=trace-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace-api.js b/node_modules/@opentelemetry/api/build/esm/trace-api.js deleted file mode 100644 index 2c02742..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace-api.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { TraceAPI } from './api/trace'; -/** - * Entrypoint for trace API - * - * @since 1.0.0 - */ -export const trace = TraceAPI.getInstance(); -//# sourceMappingURL=trace-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace-api.js.map b/node_modules/@opentelemetry/api/build/esm/trace-api.js.map deleted file mode 100644 index 08c0fa8..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace-api.js","sourceRoot":"","sources":["../../src/trace-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { TraceAPI } from './api/trace';\n\n/**\n * Entrypoint for trace API\n *\n * @since 1.0.0\n */\nexport const trace = TraceAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.d.ts deleted file mode 100644 index ba793f6..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Exception } from '../common/Exception'; -import type { TimeInput } from '../common/Time'; -import type { SpanAttributes } from './attributes'; -import type { Span } from './span'; -import type { SpanContext } from './span_context'; -import type { SpanStatus } from './status'; -import type { Link } from './link'; -/** - * The NonRecordingSpan is the default {@link Span} that is used when no Span - * implementation is available. All operations are no-op including context - * propagation. - */ -export declare class NonRecordingSpan implements Span { - private readonly _spanContext; - constructor(spanContext?: SpanContext); - spanContext(): SpanContext; - setAttribute(_key: string, _value: unknown): this; - setAttributes(_attributes: SpanAttributes): this; - addEvent(_name: string, _attributes?: SpanAttributes): this; - addLink(_link: Link): this; - addLinks(_links: Link[]): this; - setStatus(_status: SpanStatus): this; - updateName(_name: string): this; - end(_endTime?: TimeInput): void; - isRecording(): boolean; - recordException(_exception: Exception, _time?: TimeInput): void; -} -//# sourceMappingURL=NonRecordingSpan.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js b/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js deleted file mode 100644 index 9235397..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { INVALID_SPAN_CONTEXT } from './invalid-span-constants'; -/** - * The NonRecordingSpan is the default {@link Span} that is used when no Span - * implementation is available. All operations are no-op including context - * propagation. - */ -export class NonRecordingSpan { - constructor(spanContext = INVALID_SPAN_CONTEXT) { - this._spanContext = spanContext; - } - // Returns a SpanContext. - spanContext() { - return this._spanContext; - } - // By default does nothing - setAttribute(_key, _value) { - return this; - } - // By default does nothing - setAttributes(_attributes) { - return this; - } - // By default does nothing - addEvent(_name, _attributes) { - return this; - } - addLink(_link) { - return this; - } - addLinks(_links) { - return this; - } - // By default does nothing - setStatus(_status) { - return this; - } - // By default does nothing - updateName(_name) { - return this; - } - // By default does nothing - end(_endTime) { } - // isRecording always returns false for NonRecordingSpan. - isRecording() { - return false; - } - // By default does nothing - recordException(_exception, _time) { } -} -//# sourceMappingURL=NonRecordingSpan.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js.map b/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js.map deleted file mode 100644 index eac2f50..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NonRecordingSpan.js","sourceRoot":"","sources":["../../../src/trace/NonRecordingSpan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAMhE;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAG3B,YAAY,cAA2B,oBAAoB;QACzD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED,yBAAyB;IACzB,WAAW;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,0BAA0B;IAC1B,YAAY,CAAC,IAAY,EAAE,MAAe;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,aAAa,CAAC,WAA2B;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,QAAQ,CAAC,KAAa,EAAE,WAA4B;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAW;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,MAAc;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,SAAS,CAAC,OAAmB;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,UAAU,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,GAAG,CAAC,QAAoB,IAAS,CAAC;IAElC,yDAAyD;IACzD,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0BAA0B;IAC1B,eAAe,CAAC,UAAqB,EAAE,KAAiB,IAAS,CAAC;CACnE","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Exception } from '../common/Exception';\nimport type { TimeInput } from '../common/Time';\nimport type { SpanAttributes } from './attributes';\nimport { INVALID_SPAN_CONTEXT } from './invalid-span-constants';\nimport type { Span } from './span';\nimport type { SpanContext } from './span_context';\nimport type { SpanStatus } from './status';\nimport type { Link } from './link';\n\n/**\n * The NonRecordingSpan is the default {@link Span} that is used when no Span\n * implementation is available. All operations are no-op including context\n * propagation.\n */\nexport class NonRecordingSpan implements Span {\n private readonly _spanContext: SpanContext;\n\n constructor(spanContext: SpanContext = INVALID_SPAN_CONTEXT) {\n this._spanContext = spanContext;\n }\n\n // Returns a SpanContext.\n spanContext(): SpanContext {\n return this._spanContext;\n }\n\n // By default does nothing\n setAttribute(_key: string, _value: unknown): this {\n return this;\n }\n\n // By default does nothing\n setAttributes(_attributes: SpanAttributes): this {\n return this;\n }\n\n // By default does nothing\n addEvent(_name: string, _attributes?: SpanAttributes): this {\n return this;\n }\n\n addLink(_link: Link): this {\n return this;\n }\n\n addLinks(_links: Link[]): this {\n return this;\n }\n\n // By default does nothing\n setStatus(_status: SpanStatus): this {\n return this;\n }\n\n // By default does nothing\n updateName(_name: string): this {\n return this;\n }\n\n // By default does nothing\n end(_endTime?: TimeInput): void {}\n\n // isRecording always returns false for NonRecordingSpan.\n isRecording(): boolean {\n return false;\n }\n\n // By default does nothing\n recordException(_exception: Exception, _time?: TimeInput): void {}\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.d.ts deleted file mode 100644 index f1efbcf..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanOptions } from './SpanOptions'; -import type { Tracer } from './tracer'; -/** - * No-op implementations of {@link Tracer}. - */ -export declare class NoopTracer implements Tracer { - startSpan(name: string, options?: SpanOptions, context?: Context): Span; - startActiveSpan ReturnType>(name: string, fn: F): ReturnType; - startActiveSpan ReturnType>(name: string, opts: SpanOptions | undefined, fn: F): ReturnType; - startActiveSpan ReturnType>(name: string, opts: SpanOptions | undefined, ctx: Context | undefined, fn: F): ReturnType; -} -//# sourceMappingURL=NoopTracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js b/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js deleted file mode 100644 index acb8cd2..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { ContextAPI } from '../api/context'; -import { getSpanContext, setSpan } from '../trace/context-utils'; -import { NonRecordingSpan } from './NonRecordingSpan'; -import { isSpanContextValid } from './spancontext-utils'; -const contextApi = ContextAPI.getInstance(); -/** - * No-op implementations of {@link Tracer}. - */ -export class NoopTracer { - // startSpan starts a noop span. - startSpan(name, options, context = contextApi.active()) { - const root = Boolean(options === null || options === void 0 ? void 0 : options.root); - if (root) { - return new NonRecordingSpan(); - } - const parentFromContext = context && getSpanContext(context); - if (isSpanContext(parentFromContext) && - isSpanContextValid(parentFromContext)) { - return new NonRecordingSpan(parentFromContext); - } - else { - return new NonRecordingSpan(); - } - } - startActiveSpan(name, arg2, arg3, arg4) { - let opts; - let ctx; - let fn; - if (arguments.length < 2) { - return; - } - else if (arguments.length === 2) { - fn = arg2; - } - else if (arguments.length === 3) { - opts = arg2; - fn = arg3; - } - else { - opts = arg2; - ctx = arg3; - fn = arg4; - } - const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active(); - const span = this.startSpan(name, opts, parentContext); - const contextWithSpanSet = setSpan(parentContext, span); - return contextApi.with(contextWithSpanSet, fn, undefined, span); - } -} -function isSpanContext(spanContext) { - return (spanContext !== null && - typeof spanContext === 'object' && - 'spanId' in spanContext && - typeof spanContext['spanId'] === 'string' && - 'traceId' in spanContext && - typeof spanContext['traceId'] === 'string' && - 'traceFlags' in spanContext && - typeof spanContext['traceFlags'] === 'number'); -} -//# sourceMappingURL=NoopTracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js.map b/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js.map deleted file mode 100644 index 6cced85..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopTracer.js","sourceRoot":"","sources":["../../../src/trace/NoopTracer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAKzD,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,UAAU;IACrB,gCAAgC;IACh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EAAE,IAAI,CAAC,CAAC;QAExD,OAAO,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;CACF;AAED,SAAS,aAAa,CAAC,WAAoB;IACzC,OAAO,CACL,WAAW,KAAK,IAAI;QACpB,OAAO,WAAW,KAAK,QAAQ;QAC/B,QAAQ,IAAI,WAAW;QACvB,OAAO,WAAW,CAAC,QAAQ,CAAC,KAAK,QAAQ;QACzC,SAAS,IAAI,WAAW;QACxB,OAAO,WAAW,CAAC,SAAS,CAAC,KAAK,QAAQ;QAC1C,YAAY,IAAI,WAAW;QAC3B,OAAO,WAAW,CAAC,YAAY,CAAC,KAAK,QAAQ,CAC9C,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ContextAPI } from '../api/context';\nimport type { Context } from '../context/types';\nimport { getSpanContext, setSpan } from '../trace/context-utils';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport type { Span } from './span';\nimport { isSpanContextValid } from './spancontext-utils';\nimport type { SpanOptions } from './SpanOptions';\nimport type { SpanContext } from './span_context';\nimport type { Tracer } from './tracer';\n\nconst contextApi = ContextAPI.getInstance();\n\n/**\n * No-op implementations of {@link Tracer}.\n */\nexport class NoopTracer implements Tracer {\n // startSpan starts a noop span.\n startSpan(\n name: string,\n options?: SpanOptions,\n context = contextApi.active()\n ): Span {\n const root = Boolean(options?.root);\n if (root) {\n return new NonRecordingSpan();\n }\n\n const parentFromContext = context && getSpanContext(context);\n\n if (\n isSpanContext(parentFromContext) &&\n isSpanContextValid(parentFromContext)\n ) {\n return new NonRecordingSpan(parentFromContext);\n } else {\n return new NonRecordingSpan();\n }\n }\n\n startActiveSpan ReturnType>(\n name: string,\n fn: F\n ): ReturnType;\n startActiveSpan ReturnType>(\n name: string,\n opts: SpanOptions | undefined,\n fn: F\n ): ReturnType;\n startActiveSpan ReturnType>(\n name: string,\n opts: SpanOptions | undefined,\n ctx: Context | undefined,\n fn: F\n ): ReturnType;\n startActiveSpan ReturnType>(\n name: string,\n arg2?: F | SpanOptions,\n arg3?: F | Context,\n arg4?: F\n ): ReturnType | undefined {\n let opts: SpanOptions | undefined;\n let ctx: Context | undefined;\n let fn: F;\n\n if (arguments.length < 2) {\n return;\n } else if (arguments.length === 2) {\n fn = arg2 as F;\n } else if (arguments.length === 3) {\n opts = arg2 as SpanOptions | undefined;\n fn = arg3 as F;\n } else {\n opts = arg2 as SpanOptions | undefined;\n ctx = arg3 as Context | undefined;\n fn = arg4 as F;\n }\n\n const parentContext = ctx ?? contextApi.active();\n const span = this.startSpan(name, opts, parentContext);\n const contextWithSpanSet = setSpan(parentContext, span);\n\n return contextApi.with(contextWithSpanSet, fn, undefined, span);\n }\n}\n\nfunction isSpanContext(spanContext: unknown): spanContext is SpanContext {\n return (\n spanContext !== null &&\n typeof spanContext === 'object' &&\n 'spanId' in spanContext &&\n typeof spanContext['spanId'] === 'string' &&\n 'traceId' in spanContext &&\n typeof spanContext['traceId'] === 'string' &&\n 'traceFlags' in spanContext &&\n typeof spanContext['traceFlags'] === 'number'\n );\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.d.ts deleted file mode 100644 index 0c29a20..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Tracer } from './tracer'; -import type { TracerOptions } from './tracer_options'; -import type { TracerProvider } from './tracer_provider'; -/** - * An implementation of the {@link TracerProvider} which returns an impotent - * Tracer for all calls to `getTracer`. - * - * All operations are no-op. - */ -export declare class NoopTracerProvider implements TracerProvider { - getTracer(_name?: string, _version?: string, _options?: TracerOptions): Tracer; -} -//# sourceMappingURL=NoopTracerProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js b/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js deleted file mode 100644 index e9b5da7..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { NoopTracer } from './NoopTracer'; -/** - * An implementation of the {@link TracerProvider} which returns an impotent - * Tracer for all calls to `getTracer`. - * - * All operations are no-op. - */ -export class NoopTracerProvider { - getTracer(_name, _version, _options) { - return new NoopTracer(); - } -} -//# sourceMappingURL=NoopTracerProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js.map b/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js.map deleted file mode 100644 index 105766d..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopTracerProvider.js","sourceRoot":"","sources":["../../../src/trace/NoopTracerProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IAC7B,SAAS,CACP,KAAc,EACd,QAAiB,EACjB,QAAwB;QAExB,OAAO,IAAI,UAAU,EAAE,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { NoopTracer } from './NoopTracer';\nimport type { Tracer } from './tracer';\nimport type { TracerOptions } from './tracer_options';\nimport type { TracerProvider } from './tracer_provider';\n\n/**\n * An implementation of the {@link TracerProvider} which returns an impotent\n * Tracer for all calls to `getTracer`.\n *\n * All operations are no-op.\n */\nexport class NoopTracerProvider implements TracerProvider {\n getTracer(\n _name?: string,\n _version?: string,\n _options?: TracerOptions\n ): Tracer {\n return new NoopTracer();\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.d.ts deleted file mode 100644 index af0d3ae..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanOptions } from './SpanOptions'; -import type { Tracer } from './tracer'; -import type { TracerOptions } from './tracer_options'; -/** - * Proxy tracer provided by the proxy tracer provider - * - * @since 1.0.0 - */ -export declare class ProxyTracer implements Tracer { - private _delegate?; - private _provider; - readonly name: string; - readonly version?: string; - readonly options?: TracerOptions; - constructor(provider: TracerDelegator, name: string, version?: string, options?: TracerOptions); - startSpan(name: string, options?: SpanOptions, context?: Context): Span; - startActiveSpan unknown>(_name: string, _options: F | SpanOptions, _context?: F | Context, _fn?: F): ReturnType; - /** - * Try to get a tracer from the proxy tracer provider. - * If the proxy tracer provider has no delegate, return a noop tracer. - */ - private _getTracer; -} -/** - * @since 1.0.3 - */ -export interface TracerDelegator { - getDelegateTracer(name: string, version?: string, options?: TracerOptions): Tracer | undefined; -} -//# sourceMappingURL=ProxyTracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js b/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js deleted file mode 100644 index d79c959..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { NoopTracer } from './NoopTracer'; -const NOOP_TRACER = new NoopTracer(); -/** - * Proxy tracer provided by the proxy tracer provider - * - * @since 1.0.0 - */ -export class ProxyTracer { - constructor(provider, name, version, options) { - this._provider = provider; - this.name = name; - this.version = version; - this.options = options; - } - startSpan(name, options, context) { - return this._getTracer().startSpan(name, options, context); - } - startActiveSpan(_name, _options, _context, _fn) { - const tracer = this._getTracer(); - return Reflect.apply(tracer.startActiveSpan, tracer, arguments); - } - /** - * Try to get a tracer from the proxy tracer provider. - * If the proxy tracer provider has no delegate, return a noop tracer. - */ - _getTracer() { - if (this._delegate) { - return this._delegate; - } - const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options); - if (!tracer) { - return NOOP_TRACER; - } - this._delegate = tracer; - return this._delegate; - } -} -//# sourceMappingURL=ProxyTracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js.map b/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js.map deleted file mode 100644 index a9724eb..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ProxyTracer.js","sourceRoot":"","sources":["../../../src/trace/ProxyTracer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,MAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC;AAErC;;;;GAIG;AACH,MAAM,OAAO,WAAW;IAQtB,YACE,QAAyB,EACzB,IAAY,EACZ,OAAgB,EAChB,OAAuB;QAEvB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,OAAqB,EAAE,OAAiB;QAC9D,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,eAAe,CACb,KAAa,EACb,QAAyB,EACzB,QAAsB,EACtB,GAAO;QAEP,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;IAED;;;OAGG;IACK,UAAU;QAChB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,IAAI,CAAC,SAAS,CAAC;SACvB;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAC7C,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,OAAO,CACb,CAAC;QAEF,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,WAAW,CAAC;SACpB;QAED,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport { NoopTracer } from './NoopTracer';\nimport type { Span } from './span';\nimport type { SpanOptions } from './SpanOptions';\nimport type { Tracer } from './tracer';\nimport type { TracerOptions } from './tracer_options';\n\nconst NOOP_TRACER = new NoopTracer();\n\n/**\n * Proxy tracer provided by the proxy tracer provider\n *\n * @since 1.0.0\n */\nexport class ProxyTracer implements Tracer {\n // When a real implementation is provided, this will be it\n private _delegate?: Tracer;\n private _provider: TracerDelegator;\n public readonly name: string;\n public readonly version?: string;\n public readonly options?: TracerOptions;\n\n constructor(\n provider: TracerDelegator,\n name: string,\n version?: string,\n options?: TracerOptions\n ) {\n this._provider = provider;\n this.name = name;\n this.version = version;\n this.options = options;\n }\n\n startSpan(name: string, options?: SpanOptions, context?: Context): Span {\n return this._getTracer().startSpan(name, options, context);\n }\n\n startActiveSpan unknown>(\n _name: string,\n _options: F | SpanOptions,\n _context?: F | Context,\n _fn?: F\n ): ReturnType {\n const tracer = this._getTracer();\n return Reflect.apply(tracer.startActiveSpan, tracer, arguments);\n }\n\n /**\n * Try to get a tracer from the proxy tracer provider.\n * If the proxy tracer provider has no delegate, return a noop tracer.\n */\n private _getTracer() {\n if (this._delegate) {\n return this._delegate;\n }\n\n const tracer = this._provider.getDelegateTracer(\n this.name,\n this.version,\n this.options\n );\n\n if (!tracer) {\n return NOOP_TRACER;\n }\n\n this._delegate = tracer;\n return this._delegate;\n }\n}\n\n/**\n * @since 1.0.3\n */\nexport interface TracerDelegator {\n getDelegateTracer(\n name: string,\n version?: string,\n options?: TracerOptions\n ): Tracer | undefined;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.d.ts deleted file mode 100644 index 8be668a..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Tracer } from './tracer'; -import type { TracerProvider } from './tracer_provider'; -import type { TracerOptions } from './tracer_options'; -/** - * Tracer provider which provides {@link ProxyTracer}s. - * - * Before a delegate is set, tracers provided are NoOp. - * When a delegate is set, traces are provided from the delegate. - * When a delegate is set after tracers have already been provided, - * all tracers already provided will use the provided delegate implementation. - * - * @deprecated This will be removed in the next major version. - * @since 1.0.0 - */ -export declare class ProxyTracerProvider implements TracerProvider { - private _delegate?; - /** - * Get a {@link ProxyTracer} - */ - getTracer(name: string, version?: string, options?: TracerOptions): Tracer; - getDelegate(): TracerProvider; - /** - * Set the delegate tracer provider - */ - setDelegate(delegate: TracerProvider): void; - getDelegateTracer(name: string, version?: string, options?: TracerOptions): Tracer | undefined; -} -//# sourceMappingURL=ProxyTracerProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js b/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js deleted file mode 100644 index c6a9aa8..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { ProxyTracer } from './ProxyTracer'; -import { NoopTracerProvider } from './NoopTracerProvider'; -const NOOP_TRACER_PROVIDER = new NoopTracerProvider(); -/** - * Tracer provider which provides {@link ProxyTracer}s. - * - * Before a delegate is set, tracers provided are NoOp. - * When a delegate is set, traces are provided from the delegate. - * When a delegate is set after tracers have already been provided, - * all tracers already provided will use the provided delegate implementation. - * - * @deprecated This will be removed in the next major version. - * @since 1.0.0 - */ -export class ProxyTracerProvider { - /** - * Get a {@link ProxyTracer} - */ - getTracer(name, version, options) { - var _a; - return ((_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options)); - } - getDelegate() { - var _a; - return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER; - } - /** - * Set the delegate tracer provider - */ - setDelegate(delegate) { - this._delegate = delegate; - } - getDelegateTracer(name, version, options) { - var _a; - return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options); - } -} -//# sourceMappingURL=ProxyTracerProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js.map b/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js.map deleted file mode 100644 index dd397f4..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ProxyTracerProvider.js","sourceRoot":"","sources":["../../../src/trace/ProxyTracerProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,mBAAmB;IAG9B;;OAEG;IACH,SAAS,CAAC,IAAY,EAAE,OAAgB,EAAE,OAAuB;;QAC/D,OAAO,CACL,MAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,mCAC9C,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAC9C,CAAC;IACJ,CAAC;IAED,WAAW;;QACT,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,oBAAoB,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAAwB;QAClC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,iBAAiB,CACf,IAAY,EACZ,OAAgB,EAChB,OAAuB;;QAEvB,OAAO,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Tracer } from './tracer';\nimport type { TracerProvider } from './tracer_provider';\nimport { ProxyTracer } from './ProxyTracer';\nimport { NoopTracerProvider } from './NoopTracerProvider';\nimport type { TracerOptions } from './tracer_options';\n\nconst NOOP_TRACER_PROVIDER = new NoopTracerProvider();\n\n/**\n * Tracer provider which provides {@link ProxyTracer}s.\n *\n * Before a delegate is set, tracers provided are NoOp.\n * When a delegate is set, traces are provided from the delegate.\n * When a delegate is set after tracers have already been provided,\n * all tracers already provided will use the provided delegate implementation.\n *\n * @deprecated This will be removed in the next major version.\n * @since 1.0.0\n */\nexport class ProxyTracerProvider implements TracerProvider {\n private _delegate?: TracerProvider;\n\n /**\n * Get a {@link ProxyTracer}\n */\n getTracer(name: string, version?: string, options?: TracerOptions): Tracer {\n return (\n this.getDelegateTracer(name, version, options) ??\n new ProxyTracer(this, name, version, options)\n );\n }\n\n getDelegate(): TracerProvider {\n return this._delegate ?? NOOP_TRACER_PROVIDER;\n }\n\n /**\n * Set the delegate tracer provider\n */\n setDelegate(delegate: TracerProvider) {\n this._delegate = delegate;\n }\n\n getDelegateTracer(\n name: string,\n version?: string,\n options?: TracerOptions\n ): Tracer | undefined {\n return this._delegate?.getTracer(name, version, options);\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/Sampler.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/Sampler.d.ts deleted file mode 100644 index 341a792..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/Sampler.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { Context } from '../context/types'; -import type { SpanAttributes } from './attributes'; -import type { Link } from './link'; -import type { SamplingResult } from './SamplingResult'; -import type { SpanKind } from './span_kind'; -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * This interface represent a sampler. Sampling is a mechanism to control the - * noise and overhead introduced by OpenTelemetry by reducing the number of - * samples of traces collected and sent to the backend. - * - * @since 1.0.0 - */ -export interface Sampler { - /** - * Checks whether span needs to be created and tracked. - * - * @param context Parent Context which may contain a span. - * @param traceId of the span to be created. It can be different from the - * traceId in the {@link SpanContext}. Typically in situations when the - * span to be created starts a new trace. - * @param spanName of the span to be created. - * @param spanKind of the span to be created. - * @param attributes Initial set of SpanAttributes for the Span being constructed. - * @param links Collection of links that will be associated with the Span to - * be created. Typically useful for batch operations. - * @returns a {@link SamplingResult}. - */ - shouldSample(context: Context, traceId: string, spanName: string, spanKind: SpanKind, attributes: SpanAttributes, links: Link[]): SamplingResult; - /** Returns the sampler name or short description with the configuration. */ - toString(): string; -} -//# sourceMappingURL=Sampler.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/Sampler.js b/node_modules/@opentelemetry/api/build/esm/trace/Sampler.js deleted file mode 100644 index a04eda8..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/Sampler.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=Sampler.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/Sampler.js.map b/node_modules/@opentelemetry/api/build/esm/trace/Sampler.js.map deleted file mode 100644 index 82fc451..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/Sampler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Sampler.js","sourceRoot":"","sources":["../../../src/trace/Sampler.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport type { SpanAttributes } from './attributes';\nimport type { Link } from './link';\nimport type { SamplingResult } from './SamplingResult';\nimport type { SpanKind } from './span_kind';\n\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * This interface represent a sampler. Sampling is a mechanism to control the\n * noise and overhead introduced by OpenTelemetry by reducing the number of\n * samples of traces collected and sent to the backend.\n *\n * @since 1.0.0\n */\nexport interface Sampler {\n /**\n * Checks whether span needs to be created and tracked.\n *\n * @param context Parent Context which may contain a span.\n * @param traceId of the span to be created. It can be different from the\n * traceId in the {@link SpanContext}. Typically in situations when the\n * span to be created starts a new trace.\n * @param spanName of the span to be created.\n * @param spanKind of the span to be created.\n * @param attributes Initial set of SpanAttributes for the Span being constructed.\n * @param links Collection of links that will be associated with the Span to\n * be created. Typically useful for batch operations.\n * @returns a {@link SamplingResult}.\n */\n shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n spanKind: SpanKind,\n attributes: SpanAttributes,\n links: Link[]\n ): SamplingResult;\n\n /** Returns the sampler name or short description with the configuration. */\n toString(): string;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.d.ts deleted file mode 100644 index 3ef2299..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import type { SpanAttributes } from './attributes'; -import type { TraceState } from './trace_state'; -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * A sampling decision that determines how a {@link Span} will be recorded - * and collected. - * - * @since 1.0.0 - */ -export declare enum SamplingDecision { - /** - * `Span.isRecording() === false`, span will not be recorded and all events - * and attributes will be dropped. - */ - NOT_RECORD = 0, - /** - * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} - * MUST NOT be set. - */ - RECORD = 1, - /** - * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} - * MUST be set. - */ - RECORD_AND_SAMPLED = 2 -} -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * A sampling result contains a decision for a {@link Span} and additional - * attributes the sampler would like to added to the Span. - * - * @since 1.0.0 - */ -export interface SamplingResult { - /** - * A sampling decision, refer to {@link SamplingDecision} for details. - */ - decision: SamplingDecision; - /** - * The list of attributes returned by SamplingResult MUST be immutable. - * Caller may call {@link Sampler}.shouldSample any number of times and - * can safely cache the returned value. - */ - attributes?: Readonly; - /** - * A {@link TraceState} that will be associated with the {@link Span} through - * the new {@link SpanContext}. Samplers SHOULD return the TraceState from - * the passed-in {@link Context} if they do not intend to change it. Leaving - * the value undefined will also leave the TraceState unchanged. - */ - traceState?: TraceState; -} -//# sourceMappingURL=SamplingResult.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js b/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js deleted file mode 100644 index 9acb56a..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * A sampling decision that determines how a {@link Span} will be recorded - * and collected. - * - * @since 1.0.0 - */ -export var SamplingDecision; -(function (SamplingDecision) { - /** - * `Span.isRecording() === false`, span will not be recorded and all events - * and attributes will be dropped. - */ - SamplingDecision[SamplingDecision["NOT_RECORD"] = 0] = "NOT_RECORD"; - /** - * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} - * MUST NOT be set. - */ - SamplingDecision[SamplingDecision["RECORD"] = 1] = "RECORD"; - /** - * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} - * MUST be set. - */ - SamplingDecision[SamplingDecision["RECORD_AND_SAMPLED"] = 2] = "RECORD_AND_SAMPLED"; -})(SamplingDecision || (SamplingDecision = {})); -//# sourceMappingURL=SamplingResult.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js.map b/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js.map deleted file mode 100644 index ce98b09..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SamplingResult.js","sourceRoot":"","sources":["../../../src/trace/SamplingResult.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,gBAgBX;AAhBD,WAAY,gBAAgB;IAC1B;;;OAGG;IACH,mEAAU,CAAA;IACV;;;OAGG;IACH,2DAAM,CAAA;IACN;;;OAGG;IACH,mFAAkB,CAAA;AACpB,CAAC,EAhBW,gBAAgB,KAAhB,gBAAgB,QAgB3B","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SpanAttributes } from './attributes';\nimport type { TraceState } from './trace_state';\n\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * A sampling decision that determines how a {@link Span} will be recorded\n * and collected.\n *\n * @since 1.0.0\n */\nexport enum SamplingDecision {\n /**\n * `Span.isRecording() === false`, span will not be recorded and all events\n * and attributes will be dropped.\n */\n NOT_RECORD,\n /**\n * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}\n * MUST NOT be set.\n */\n RECORD,\n /**\n * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}\n * MUST be set.\n */\n RECORD_AND_SAMPLED,\n}\n\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * A sampling result contains a decision for a {@link Span} and additional\n * attributes the sampler would like to added to the Span.\n *\n * @since 1.0.0\n */\nexport interface SamplingResult {\n /**\n * A sampling decision, refer to {@link SamplingDecision} for details.\n */\n decision: SamplingDecision;\n /**\n * The list of attributes returned by SamplingResult MUST be immutable.\n * Caller may call {@link Sampler}.shouldSample any number of times and\n * can safely cache the returned value.\n */\n attributes?: Readonly;\n /**\n * A {@link TraceState} that will be associated with the {@link Span} through\n * the new {@link SpanContext}. Samplers SHOULD return the TraceState from\n * the passed-in {@link Context} if they do not intend to change it. Leaving\n * the value undefined will also leave the TraceState unchanged.\n */\n traceState?: TraceState;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/SpanOptions.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/SpanOptions.d.ts deleted file mode 100644 index 2021bd7..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/SpanOptions.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Attributes } from '../common/Attributes'; -import type { TimeInput } from '../common/Time'; -import type { Link } from './link'; -import type { SpanKind } from './span_kind'; -/** - * Options needed for span creation - * - * @since 1.0.0 - */ -export interface SpanOptions { - /** - * The SpanKind of a span - * @default {@link SpanKind.INTERNAL} - */ - kind?: SpanKind; - /** A span's attributes */ - attributes?: Attributes; - /** {@link Link}s span to other spans */ - links?: Link[]; - /** A manually specified start time for the created `Span` object. */ - startTime?: TimeInput; - /** The new span should be a root span. (Ignore parent from context). */ - root?: boolean; -} -//# sourceMappingURL=SpanOptions.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/SpanOptions.js b/node_modules/@opentelemetry/api/build/esm/trace/SpanOptions.js deleted file mode 100644 index 83807c4..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/SpanOptions.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=SpanOptions.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/SpanOptions.js.map b/node_modules/@opentelemetry/api/build/esm/trace/SpanOptions.js.map deleted file mode 100644 index 5753122..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/SpanOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SpanOptions.js","sourceRoot":"","sources":["../../../src/trace/SpanOptions.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes } from '../common/Attributes';\nimport type { TimeInput } from '../common/Time';\nimport type { Link } from './link';\nimport type { SpanKind } from './span_kind';\n\n/**\n * Options needed for span creation\n *\n * @since 1.0.0\n */\nexport interface SpanOptions {\n /**\n * The SpanKind of a span\n * @default {@link SpanKind.INTERNAL}\n */\n kind?: SpanKind;\n\n /** A span's attributes */\n attributes?: Attributes;\n\n /** {@link Link}s span to other spans */\n links?: Link[];\n\n /** A manually specified start time for the created `Span` object. */\n startTime?: TimeInput;\n\n /** The new span should be a root span. (Ignore parent from context). */\n root?: boolean;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/attributes.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/attributes.d.ts deleted file mode 100644 index db01605..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/attributes.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Attributes, AttributeValue } from '../common/Attributes'; -/** - * @deprecated please use {@link Attributes} - * @since 1.0.0 - */ -export type SpanAttributes = Attributes; -/** - * @deprecated please use {@link AttributeValue} - * @since 1.0.0 - */ -export type SpanAttributeValue = AttributeValue; -//# sourceMappingURL=attributes.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/attributes.js b/node_modules/@opentelemetry/api/build/esm/trace/attributes.js deleted file mode 100644 index bfb40ba..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/attributes.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=attributes.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/attributes.js.map b/node_modules/@opentelemetry/api/build/esm/trace/attributes.js.map deleted file mode 100644 index fcfe43a..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/attributes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../src/trace/attributes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes, AttributeValue } from '../common/Attributes';\n\n/**\n * @deprecated please use {@link Attributes}\n * @since 1.0.0\n */\nexport type SpanAttributes = Attributes;\n\n/**\n * @deprecated please use {@link AttributeValue}\n * @since 1.0.0\n */\nexport type SpanAttributeValue = AttributeValue;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/context-utils.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/context-utils.d.ts deleted file mode 100644 index 783a4ca..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/context-utils.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanContext } from './span_context'; -/** - * Return the span if one exists - * - * @param context context to get span from - */ -export declare function getSpan(context: Context): Span | undefined; -/** - * Gets the span from the current context, if one exists. - */ -export declare function getActiveSpan(): Span | undefined; -/** - * Set the span on a context - * - * @param context context to use as parent - * @param span span to set active - */ -export declare function setSpan(context: Context, span: Span): Context; -/** - * Remove current span stored in the context - * - * @param context context to delete span from - */ -export declare function deleteSpan(context: Context): Context; -/** - * Wrap span context in a NoopSpan and set as span in a new - * context - * - * @param context context to set active span on - * @param spanContext span context to be wrapped - */ -export declare function setSpanContext(context: Context, spanContext: SpanContext): Context; -/** - * Get the span context of the span if it exists. - * - * @param context context to get values from - */ -export declare function getSpanContext(context: Context): SpanContext | undefined; -//# sourceMappingURL=context-utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js b/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js deleted file mode 100644 index c44d08f..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { createContextKey } from '../context/context'; -import { NonRecordingSpan } from './NonRecordingSpan'; -import { ContextAPI } from '../api/context'; -/** - * span key - */ -const SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN'); -/** - * Return the span if one exists - * - * @param context context to get span from - */ -export function getSpan(context) { - return context.getValue(SPAN_KEY) || undefined; -} -/** - * Gets the span from the current context, if one exists. - */ -export function getActiveSpan() { - return getSpan(ContextAPI.getInstance().active()); -} -/** - * Set the span on a context - * - * @param context context to use as parent - * @param span span to set active - */ -export function setSpan(context, span) { - return context.setValue(SPAN_KEY, span); -} -/** - * Remove current span stored in the context - * - * @param context context to delete span from - */ -export function deleteSpan(context) { - return context.deleteValue(SPAN_KEY); -} -/** - * Wrap span context in a NoopSpan and set as span in a new - * context - * - * @param context context to set active span on - * @param spanContext span context to be wrapped - */ -export function setSpanContext(context, spanContext) { - return setSpan(context, new NonRecordingSpan(spanContext)); -} -/** - * Get the span context of the span if it exists. - * - * @param context context to get values from - */ -export function getSpanContext(context) { - var _a; - return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext(); -} -//# sourceMappingURL=context-utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js.map b/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js.map deleted file mode 100644 index 181731f..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context-utils.js","sourceRoot":"","sources":["../../../src/trace/context-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,QAAQ,GAAG,gBAAgB,CAAC,gCAAgC,CAAC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAgB;IACtC,OAAQ,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU,IAAI,SAAS,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAgB,EAAE,IAAU;IAClD,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAO,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgB,EAChB,WAAwB;IAExB,OAAO,OAAO,CAAC,OAAO,EAAE,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgB;;IAC7C,OAAO,MAAA,OAAO,CAAC,OAAO,CAAC,0CAAE,WAAW,EAAE,CAAC;AACzC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createContextKey } from '../context/context';\nimport type { Context } from '../context/types';\nimport type { Span } from './span';\nimport type { SpanContext } from './span_context';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport { ContextAPI } from '../api/context';\n\n/**\n * span key\n */\nconst SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');\n\n/**\n * Return the span if one exists\n *\n * @param context context to get span from\n */\nexport function getSpan(context: Context): Span | undefined {\n return (context.getValue(SPAN_KEY) as Span) || undefined;\n}\n\n/**\n * Gets the span from the current context, if one exists.\n */\nexport function getActiveSpan(): Span | undefined {\n return getSpan(ContextAPI.getInstance().active());\n}\n\n/**\n * Set the span on a context\n *\n * @param context context to use as parent\n * @param span span to set active\n */\nexport function setSpan(context: Context, span: Span): Context {\n return context.setValue(SPAN_KEY, span);\n}\n\n/**\n * Remove current span stored in the context\n *\n * @param context context to delete span from\n */\nexport function deleteSpan(context: Context): Context {\n return context.deleteValue(SPAN_KEY);\n}\n\n/**\n * Wrap span context in a NoopSpan and set as span in a new\n * context\n *\n * @param context context to set active span on\n * @param spanContext span context to be wrapped\n */\nexport function setSpanContext(\n context: Context,\n spanContext: SpanContext\n): Context {\n return setSpan(context, new NonRecordingSpan(spanContext));\n}\n\n/**\n * Get the span context of the span if it exists.\n *\n * @param context context to get values from\n */\nexport function getSpanContext(context: Context): SpanContext | undefined {\n return getSpan(context)?.spanContext();\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-impl.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-impl.d.ts deleted file mode 100644 index 47ecac8..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-impl.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { TraceState } from '../trace_state'; -/** - * TraceState must be a class and not a simple object type because of the spec - * requirement (https://www.w3.org/TR/trace-context/#tracestate-field). - * - * Here is the list of allowed mutations: - * - New key-value pair should be added into the beginning of the list - * - The value of any key can be updated. Modified keys MUST be moved to the - * beginning of the list. - */ -export declare class TraceStateImpl implements TraceState { - private _internalState; - constructor(rawTraceState?: string); - set(key: string, value: string): TraceStateImpl; - unset(key: string): TraceStateImpl; - get(key: string): string | undefined; - serialize(): string; - private _parse; - private _keys; - private _clone; -} -//# sourceMappingURL=tracestate-impl.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-impl.js b/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-impl.js deleted file mode 100644 index b763df8..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-impl.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { validateKey, validateValue } from './tracestate-validators'; -const MAX_TRACE_STATE_ITEMS = 32; -const MAX_TRACE_STATE_LEN = 512; -const LIST_MEMBERS_SEPARATOR = ','; -const LIST_MEMBER_KEY_VALUE_SPLITTER = '='; -/** - * TraceState must be a class and not a simple object type because of the spec - * requirement (https://www.w3.org/TR/trace-context/#tracestate-field). - * - * Here is the list of allowed mutations: - * - New key-value pair should be added into the beginning of the list - * - The value of any key can be updated. Modified keys MUST be moved to the - * beginning of the list. - */ -export class TraceStateImpl { - constructor(rawTraceState) { - this._internalState = new Map(); - if (rawTraceState) - this._parse(rawTraceState); - } - set(key, value) { - // TODO: Benchmark the different approaches(map vs list) and - // use the faster one. - const traceState = this._clone(); - if (traceState._internalState.has(key)) { - traceState._internalState.delete(key); - } - traceState._internalState.set(key, value); - return traceState; - } - unset(key) { - const traceState = this._clone(); - traceState._internalState.delete(key); - return traceState; - } - get(key) { - return this._internalState.get(key); - } - serialize() { - return (Array.from(this._internalState.keys()) - // Use reduceRight() because keys are stored in reverse insertion order. - .reduceRight((agg, key) => { - agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key)); - return agg; - }, []) - .join(LIST_MEMBERS_SEPARATOR)); - } - _parse(rawTraceState) { - if (rawTraceState.length > MAX_TRACE_STATE_LEN) - return; - this._internalState = rawTraceState - .split(LIST_MEMBERS_SEPARATOR) - // Use reduceRight() so new keys (.set(...)) will be placed at the beginning - .reduceRight((agg, part) => { - const listMember = part.trim(); // Optional Whitespace (OWS) handling - const i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER); - if (i !== -1) { - const key = listMember.slice(0, i); - const value = listMember.slice(i + 1, part.length); - if (validateKey(key) && validateValue(value)) { - agg.set(key, value); - } - else { - // TODO: Consider to add warning log - } - } - return agg; - }, new Map()); - // Because of the reverse() requirement, trunc must be done after map is created - if (this._internalState.size > MAX_TRACE_STATE_ITEMS) { - this._internalState = new Map(Array.from(this._internalState.entries()) - .reverse() // Use reverse same as original tracestate parse chain - .slice(0, MAX_TRACE_STATE_ITEMS)); - } - } - // @ts-expect-error TS6133 Accessed in tests only. - _keys() { - return Array.from(this._internalState.keys()).reverse(); - } - _clone() { - const traceState = new TraceStateImpl(); - traceState._internalState = new Map(this._internalState); - return traceState; - } -} -//# sourceMappingURL=tracestate-impl.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-impl.js.map b/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-impl.js.map deleted file mode 100644 index 8cb7d39..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-impl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracestate-impl.js","sourceRoot":"","sources":["../../../../src/trace/internal/tracestate-impl.ts"],"names":[],"mappings":"AAAA;;;G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,CAAC,sDAAsD;iBAChE,KAAK,CAAC,CAAC,EAAE,qBAAqB,CAAC,CACnC,CAAC;SACH;IACH,CAAC;IAED,kDAAkD;IAC1C,KAAK;QACX,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAC1D,CAAC;IAEO,MAAM;QACZ,MAAM,UAAU,GAAG,IAAI,cAAc,EAAE,CAAC;QACxC,UAAU,CAAC,cAAc,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACzD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TraceState } from '../trace_state';\nimport { validateKey, validateValue } from './tracestate-validators';\n\nconst MAX_TRACE_STATE_ITEMS = 32;\nconst MAX_TRACE_STATE_LEN = 512;\nconst LIST_MEMBERS_SEPARATOR = ',';\nconst LIST_MEMBER_KEY_VALUE_SPLITTER = '=';\n\n/**\n * TraceState must be a class and not a simple object type because of the spec\n * requirement (https://www.w3.org/TR/trace-context/#tracestate-field).\n *\n * Here is the list of allowed mutations:\n * - New key-value pair should be added into the beginning of the list\n * - The value of any key can be updated. Modified keys MUST be moved to the\n * beginning of the list.\n */\nexport class TraceStateImpl implements TraceState {\n private _internalState: Map = new Map();\n\n constructor(rawTraceState?: string) {\n if (rawTraceState) this._parse(rawTraceState);\n }\n\n set(key: string, value: string): TraceStateImpl {\n // TODO: Benchmark the different approaches(map vs list) and\n // use the faster one.\n const traceState = this._clone();\n if (traceState._internalState.has(key)) {\n traceState._internalState.delete(key);\n }\n traceState._internalState.set(key, value);\n return traceState;\n }\n\n unset(key: string): TraceStateImpl {\n const traceState = this._clone();\n traceState._internalState.delete(key);\n return traceState;\n }\n\n get(key: string): string | undefined {\n return this._internalState.get(key);\n }\n\n serialize(): string {\n return (\n Array.from(this._internalState.keys())\n // Use reduceRight() because keys are stored in reverse insertion order.\n .reduceRight((agg: string[], key) => {\n agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key));\n return agg;\n }, [])\n .join(LIST_MEMBERS_SEPARATOR)\n );\n }\n\n private _parse(rawTraceState: string) {\n if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;\n this._internalState = rawTraceState\n .split(LIST_MEMBERS_SEPARATOR)\n // Use reduceRight() so new keys (.set(...)) will be placed at the beginning\n .reduceRight((agg: Map, part: string) => {\n const listMember = part.trim(); // Optional Whitespace (OWS) handling\n const i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);\n if (i !== -1) {\n const key = listMember.slice(0, i);\n const value = listMember.slice(i + 1, part.length);\n if (validateKey(key) && validateValue(value)) {\n agg.set(key, value);\n } else {\n // TODO: Consider to add warning log\n }\n }\n return agg;\n }, new Map());\n\n // Because of the reverse() requirement, trunc must be done after map is created\n if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {\n this._internalState = new Map(\n Array.from(this._internalState.entries())\n .reverse() // Use reverse same as original tracestate parse chain\n .slice(0, MAX_TRACE_STATE_ITEMS)\n );\n }\n }\n\n // @ts-expect-error TS6133 Accessed in tests only.\n private _keys(): string[] {\n return Array.from(this._internalState.keys()).reverse();\n }\n\n private _clone(): TraceStateImpl {\n const traceState = new TraceStateImpl();\n traceState._internalState = new Map(this._internalState);\n return traceState;\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-validators.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-validators.d.ts deleted file mode 100644 index 4917f99..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-validators.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Key is opaque string up to 256 characters printable. It MUST begin with a - * lowercase letter, and can only contain lowercase letters a-z, digits 0-9, - * underscores _, dashes -, asterisks *, and forward slashes /. - * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the - * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key. - * see https://www.w3.org/TR/trace-context/#key - */ -export declare function validateKey(key: string): boolean; -/** - * Value is opaque string up to 256 characters printable ASCII RFC0020 - * characters (i.e., the range 0x20 to 0x7E) except comma , and =. - */ -export declare function validateValue(value: string): boolean; -//# sourceMappingURL=tracestate-validators.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-validators.js b/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-validators.js deleted file mode 100644 index 041ef60..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-validators.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -const VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]'; -const VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`; -const VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`; -const VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`); -const VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/; -const INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/; -/** - * Key is opaque string up to 256 characters printable. It MUST begin with a - * lowercase letter, and can only contain lowercase letters a-z, digits 0-9, - * underscores _, dashes -, asterisks *, and forward slashes /. - * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the - * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key. - * see https://www.w3.org/TR/trace-context/#key - */ -export function validateKey(key) { - return VALID_KEY_REGEX.test(key); -} -/** - * Value is opaque string up to 256 characters printable ASCII RFC0020 - * characters (i.e., the range 0x20 to 0x7E) except comma , and =. - */ -export function validateValue(value) { - return (VALID_VALUE_BASE_REGEX.test(value) && - !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value)); -} -//# sourceMappingURL=tracestate-validators.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-validators.js.map b/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-validators.js.map deleted file mode 100644 index 94bfa4b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/internal/tracestate-validators.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracestate-validators.js","sourceRoot":"","sources":["../../../../src/trace/internal/tracestate-validators.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAC5C,MAAM,SAAS,GAAG,QAAQ,oBAAoB,SAAS,CAAC;AACxD,MAAM,gBAAgB,GAAG,WAAW,oBAAoB,gBAAgB,oBAAoB,QAAQ,CAAC;AACrG,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC,OAAO,SAAS,IAAI,gBAAgB,IAAI,CAAC,CAAC;AAC7E,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AACrD,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,CACL,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC;QAClC,CAAC,+BAA+B,CAAC,IAAI,CAAC,KAAK,CAAC,CAC7C,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nconst VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';\nconst VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;\nconst VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;\nconst VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`);\nconst VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;\nconst INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;\n\n/**\n * Key is opaque string up to 256 characters printable. It MUST begin with a\n * lowercase letter, and can only contain lowercase letters a-z, digits 0-9,\n * underscores _, dashes -, asterisks *, and forward slashes /.\n * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the\n * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.\n * see https://www.w3.org/TR/trace-context/#key\n */\nexport function validateKey(key: string): boolean {\n return VALID_KEY_REGEX.test(key);\n}\n\n/**\n * Value is opaque string up to 256 characters printable ASCII RFC0020\n * characters (i.e., the range 0x20 to 0x7E) except comma , and =.\n */\nexport function validateValue(value: string): boolean {\n return (\n VALID_VALUE_BASE_REGEX.test(value) &&\n !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value)\n );\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/internal/utils.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/internal/utils.d.ts deleted file mode 100644 index 7112fe5..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/internal/utils.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { TraceState } from '../trace_state'; -/** - * @since 1.1.0 - */ -export declare function createTraceState(rawTraceState?: string): TraceState; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/internal/utils.js b/node_modules/@opentelemetry/api/build/esm/trace/internal/utils.js deleted file mode 100644 index bb637bb..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/internal/utils.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { TraceStateImpl } from './tracestate-impl'; -/** - * @since 1.1.0 - */ -export function createTraceState(rawTraceState) { - return new TraceStateImpl(rawTraceState); -} -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/internal/utils.js.map b/node_modules/@opentelemetry/api/build/esm/trace/internal/utils.js.map deleted file mode 100644 index 3904da3..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/internal/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/trace/internal/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,aAAsB;IACrD,OAAO,IAAI,cAAc,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TraceState } from '../trace_state';\nimport { TraceStateImpl } from './tracestate-impl';\n\n/**\n * @since 1.1.0\n */\nexport function createTraceState(rawTraceState?: string): TraceState {\n return new TraceStateImpl(rawTraceState);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.d.ts deleted file mode 100644 index d51c859..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { SpanContext } from './span_context'; -/** - * @since 1.0.0 - */ -export declare const INVALID_SPANID = "0000000000000000"; -/** - * @since 1.0.0 - */ -export declare const INVALID_TRACEID = "00000000000000000000000000000000"; -/** - * @since 1.0.0 - */ -export declare const INVALID_SPAN_CONTEXT: SpanContext; -//# sourceMappingURL=invalid-span-constants.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js b/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js deleted file mode 100644 index d063f60..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { TraceFlags } from './trace_flags'; -/** - * @since 1.0.0 - */ -export const INVALID_SPANID = '0000000000000000'; -/** - * @since 1.0.0 - */ -export const INVALID_TRACEID = '00000000000000000000000000000000'; -/** - * @since 1.0.0 - */ -export const INVALID_SPAN_CONTEXT = { - traceId: INVALID_TRACEID, - spanId: INVALID_SPANID, - traceFlags: TraceFlags.NONE, -}; -//# sourceMappingURL=invalid-span-constants.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js.map b/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js.map deleted file mode 100644 index b307f45..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"invalid-span-constants.js","sourceRoot":"","sources":["../../../src/trace/invalid-span-constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,kCAAkC,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,OAAO,EAAE,eAAe;IACxB,MAAM,EAAE,cAAc;IACtB,UAAU,EAAE,UAAU,CAAC,IAAI;CAC5B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SpanContext } from './span_context';\nimport { TraceFlags } from './trace_flags';\n\n/**\n * @since 1.0.0\n */\nexport const INVALID_SPANID = '0000000000000000';\n\n/**\n * @since 1.0.0\n */\nexport const INVALID_TRACEID = '00000000000000000000000000000000';\n\n/**\n * @since 1.0.0\n */\nexport const INVALID_SPAN_CONTEXT: SpanContext = {\n traceId: INVALID_TRACEID,\n spanId: INVALID_SPANID,\n traceFlags: TraceFlags.NONE,\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/link.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/link.d.ts deleted file mode 100644 index 6147717..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/link.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { SpanAttributes } from './attributes'; -import type { SpanContext } from './span_context'; -/** - * A pointer from the current {@link Span} to another span in the same trace or - * in a different trace. - * Few examples of Link usage. - * 1. Batch Processing: A batch of elements may contain elements associated - * with one or more traces/spans. Since there can only be one parent - * SpanContext, Link is used to keep reference to SpanContext of all - * elements in the batch. - * 2. Public Endpoint: A SpanContext in incoming client request on a public - * endpoint is untrusted from service provider perspective. In such case it - * is advisable to start a new trace with appropriate sampling decision. - * However, it is desirable to associate incoming SpanContext to new trace - * initiated on service provider side so two traces (from Client and from - * Service Provider) can be correlated. - * - * @since 1.0.0 - */ -export interface Link { - /** The {@link SpanContext} of a linked span. */ - context: SpanContext; - /** A set of {@link SpanAttributes} on the link. */ - attributes?: SpanAttributes; - /** Count of attributes of the link that were dropped due to collection limits */ - droppedAttributesCount?: number; -} -//# sourceMappingURL=link.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/link.js b/node_modules/@opentelemetry/api/build/esm/trace/link.js deleted file mode 100644 index b714104..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/link.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=link.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/link.js.map b/node_modules/@opentelemetry/api/build/esm/trace/link.js.map deleted file mode 100644 index 1088c50..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/link.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/trace/link.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SpanAttributes } from './attributes';\nimport type { SpanContext } from './span_context';\n\n/**\n * A pointer from the current {@link Span} to another span in the same trace or\n * in a different trace.\n * Few examples of Link usage.\n * 1. Batch Processing: A batch of elements may contain elements associated\n * with one or more traces/spans. Since there can only be one parent\n * SpanContext, Link is used to keep reference to SpanContext of all\n * elements in the batch.\n * 2. Public Endpoint: A SpanContext in incoming client request on a public\n * endpoint is untrusted from service provider perspective. In such case it\n * is advisable to start a new trace with appropriate sampling decision.\n * However, it is desirable to associate incoming SpanContext to new trace\n * initiated on service provider side so two traces (from Client and from\n * Service Provider) can be correlated.\n *\n * @since 1.0.0\n */\nexport interface Link {\n /** The {@link SpanContext} of a linked span. */\n context: SpanContext;\n /** A set of {@link SpanAttributes} on the link. */\n attributes?: SpanAttributes;\n /** Count of attributes of the link that were dropped due to collection limits */\n droppedAttributesCount?: number;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/span.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/span.d.ts deleted file mode 100644 index f6517ca..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/span.d.ts +++ /dev/null @@ -1,132 +0,0 @@ -import type { Exception } from '../common/Exception'; -import type { TimeInput } from '../common/Time'; -import type { SpanAttributes, SpanAttributeValue } from './attributes'; -import type { SpanContext } from './span_context'; -import type { SpanStatus } from './status'; -import type { Link } from './link'; -/** - * An interface that represents a span. A span represents a single operation - * within a trace. Examples of span might include remote procedure calls or a - * in-process function calls to sub-components. A Trace has a single, top-level - * "root" Span that in turn may have zero or more child Spans, which in turn - * may have children. - * - * Spans are created by the {@link Tracer.startSpan} method. - * - * @since 1.0.0 - */ -export interface Span { - /** - * Returns the {@link SpanContext} object associated with this Span. - * - * Get an immutable, serializable identifier for this span that can be used - * to create new child spans. Returned SpanContext is usable even after the - * span ends. - * - * @returns the SpanContext object associated with this Span. - */ - spanContext(): SpanContext; - /** - * Sets an attribute to the span. - * - * Sets a single Attribute with the key and value passed as arguments. - * - * @param key the key for this attribute. - * @param value the value for this attribute. Setting a value null or - * undefined is invalid and will result in undefined behavior. - */ - setAttribute(key: string, value: SpanAttributeValue): this; - /** - * Sets attributes to the span. - * - * @param attributes the attributes that will be added. - * null or undefined attribute values - * are invalid and will result in undefined behavior. - */ - setAttributes(attributes: SpanAttributes): this; - /** - * Adds an event to the Span. - * - * @param name the name of the event. - * @param [attributesOrStartTime] the attributes that will be added; these are - * associated with this event. Can be also a start time - * if type is {@type TimeInput} and 3rd param is undefined - * @param [startTime] start time of the event. - */ - addEvent(name: string, attributesOrStartTime?: SpanAttributes | TimeInput, startTime?: TimeInput): this; - /** - * Adds a single link to the span. - * - * Links added after the creation will not affect the sampling decision. - * It is preferred span links be added at span creation. - * - * @param link the link to add. - */ - addLink(link: Link): this; - /** - * Adds multiple links to the span. - * - * Links added after the creation will not affect the sampling decision. - * It is preferred span links be added at span creation. - * - * @param links the links to add. - */ - addLinks(links: Link[]): this; - /** - * Sets the status of the span. - * - * By default, a span has status {@link SpanStatusCode.UNSET}. - * Calling this method overrides that default. - * - * The status codes have a total order: `OK > ERROR > UNSET`. - * - * - Once {@link SpanStatusCode.OK} is set, any further attempts to change - * the status are ignored. - * - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored. - * - * The `message` field is only used when {@link SpanStatusCode.ERROR} is set. - * For all other status codes, `message` is ignored. - * - * @param status The {@link SpanStatus} to set. - */ - setStatus(status: SpanStatus): this; - /** - * Updates the Span name. - * - * This will override the name provided via {@link Tracer.startSpan}. - * - * Upon this update, any sampling behavior based on Span name will depend on - * the implementation. - * - * @param name the Span name. - */ - updateName(name: string): this; - /** - * Marks the end of Span execution. - * - * Call to End of a Span MUST not have any effects on child spans. Those may - * still be running and can be ended later. - * - * Do not return `this`. The Span generally should not be used after it - * is ended so chaining is not desired in this context. - * - * @param [endTime] the time to set as Span's end time. If not provided, - * use the current time as the span's end time. - */ - end(endTime?: TimeInput): void; - /** - * Returns the flag whether this span will be recorded. - * - * @returns true if this Span is active and recording information like events - * with the `AddEvent` operation and attributes using `setAttributes`. - */ - isRecording(): boolean; - /** - * Sets exception as a span event - * @param exception the exception the only accepted values are string or Error - * @param [time] the time to set as Span's event time. If not provided, - * use the current time. - */ - recordException(exception: Exception, time?: TimeInput): void; -} -//# sourceMappingURL=span.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/span.js b/node_modules/@opentelemetry/api/build/esm/trace/span.js deleted file mode 100644 index 6364590..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/span.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=span.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/span.js.map b/node_modules/@opentelemetry/api/build/esm/trace/span.js.map deleted file mode 100644 index 9961668..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/span.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"span.js","sourceRoot":"","sources":["../../../src/trace/span.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Exception } from '../common/Exception';\nimport type { TimeInput } from '../common/Time';\nimport type { SpanAttributes, SpanAttributeValue } from './attributes';\nimport type { SpanContext } from './span_context';\nimport type { SpanStatus } from './status';\nimport type { Link } from './link';\n\n/**\n * An interface that represents a span. A span represents a single operation\n * within a trace. Examples of span might include remote procedure calls or a\n * in-process function calls to sub-components. A Trace has a single, top-level\n * \"root\" Span that in turn may have zero or more child Spans, which in turn\n * may have children.\n *\n * Spans are created by the {@link Tracer.startSpan} method.\n *\n * @since 1.0.0\n */\nexport interface Span {\n /**\n * Returns the {@link SpanContext} object associated with this Span.\n *\n * Get an immutable, serializable identifier for this span that can be used\n * to create new child spans. Returned SpanContext is usable even after the\n * span ends.\n *\n * @returns the SpanContext object associated with this Span.\n */\n spanContext(): SpanContext;\n\n /**\n * Sets an attribute to the span.\n *\n * Sets a single Attribute with the key and value passed as arguments.\n *\n * @param key the key for this attribute.\n * @param value the value for this attribute. Setting a value null or\n * undefined is invalid and will result in undefined behavior.\n */\n setAttribute(key: string, value: SpanAttributeValue): this;\n\n /**\n * Sets attributes to the span.\n *\n * @param attributes the attributes that will be added.\n * null or undefined attribute values\n * are invalid and will result in undefined behavior.\n */\n setAttributes(attributes: SpanAttributes): this;\n\n /**\n * Adds an event to the Span.\n *\n * @param name the name of the event.\n * @param [attributesOrStartTime] the attributes that will be added; these are\n * associated with this event. Can be also a start time\n * if type is {@type TimeInput} and 3rd param is undefined\n * @param [startTime] start time of the event.\n */\n addEvent(\n name: string,\n attributesOrStartTime?: SpanAttributes | TimeInput,\n startTime?: TimeInput\n ): this;\n\n /**\n * Adds a single link to the span.\n *\n * Links added after the creation will not affect the sampling decision.\n * It is preferred span links be added at span creation.\n *\n * @param link the link to add.\n */\n addLink(link: Link): this;\n\n /**\n * Adds multiple links to the span.\n *\n * Links added after the creation will not affect the sampling decision.\n * It is preferred span links be added at span creation.\n *\n * @param links the links to add.\n */\n addLinks(links: Link[]): this;\n\n /**\n * Sets the status of the span.\n *\n * By default, a span has status {@link SpanStatusCode.UNSET}.\n * Calling this method overrides that default.\n *\n * The status codes have a total order: `OK > ERROR > UNSET`.\n *\n * - Once {@link SpanStatusCode.OK} is set, any further attempts to change\n * the status are ignored.\n * - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored.\n *\n * The `message` field is only used when {@link SpanStatusCode.ERROR} is set.\n * For all other status codes, `message` is ignored.\n *\n * @param status The {@link SpanStatus} to set.\n */\n setStatus(status: SpanStatus): this;\n\n /**\n * Updates the Span name.\n *\n * This will override the name provided via {@link Tracer.startSpan}.\n *\n * Upon this update, any sampling behavior based on Span name will depend on\n * the implementation.\n *\n * @param name the Span name.\n */\n updateName(name: string): this;\n\n /**\n * Marks the end of Span execution.\n *\n * Call to End of a Span MUST not have any effects on child spans. Those may\n * still be running and can be ended later.\n *\n * Do not return `this`. The Span generally should not be used after it\n * is ended so chaining is not desired in this context.\n *\n * @param [endTime] the time to set as Span's end time. If not provided,\n * use the current time as the span's end time.\n */\n end(endTime?: TimeInput): void;\n\n /**\n * Returns the flag whether this span will be recorded.\n *\n * @returns true if this Span is active and recording information like events\n * with the `AddEvent` operation and attributes using `setAttributes`.\n */\n isRecording(): boolean;\n\n /**\n * Sets exception as a span event\n * @param exception the exception the only accepted values are string or Error\n * @param [time] the time to set as Span's event time. If not provided,\n * use the current time.\n */\n recordException(exception: Exception, time?: TimeInput): void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/span_context.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/span_context.d.ts deleted file mode 100644 index 443436d..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/span_context.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { TraceState } from './trace_state'; -/** - * A SpanContext represents the portion of a {@link Span} which must be - * serialized and propagated along side of a {@link Baggage}. - * - * @since 1.0.0 - */ -export interface SpanContext { - /** - * The ID of the trace that this span belongs to. It is worldwide unique - * with practically sufficient probability by being made as 16 randomly - * generated bytes, encoded as a 32 lowercase hex characters corresponding to - * 128 bits. - */ - traceId: string; - /** - * The ID of the Span. It is globally unique with practically sufficient - * probability by being made as 8 randomly generated bytes, encoded as a 16 - * lowercase hex characters corresponding to 64 bits. - */ - spanId: string; - /** - * Only true if the SpanContext was propagated from a remote parent. - */ - isRemote?: boolean; - /** - * Trace flags to propagate. - * - * It is represented as 1 byte (bitmap). Bit to represent whether trace is - * sampled or not. When set, the least significant bit documents that the - * caller may have recorded trace data. A caller who does not record trace - * data out-of-band leaves this flag unset. - * - * see {@link TraceFlags} for valid flag values. - */ - traceFlags: number; - /** - * Tracing-system-specific info to propagate. - * - * The tracestate field value is a `list` as defined below. The `list` is a - * series of `list-members` separated by commas `,`, and a list-member is a - * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs - * surrounding `list-members` are ignored. There can be a maximum of 32 - * `list-members` in a `list`. - * More Info: https://www.w3.org/TR/trace-context/#tracestate-field - * - * Examples: - * Single tracing system (generic format): - * tracestate: rojo=00f067aa0ba902b7 - * Multiple tracing systems (with different formatting): - * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE - */ - traceState?: TraceState; -} -//# sourceMappingURL=span_context.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/span_context.js b/node_modules/@opentelemetry/api/build/esm/trace/span_context.js deleted file mode 100644 index 740b541..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/span_context.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=span_context.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/span_context.js.map b/node_modules/@opentelemetry/api/build/esm/trace/span_context.js.map deleted file mode 100644 index 9c139af..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/span_context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"span_context.js","sourceRoot":"","sources":["../../../src/trace/span_context.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TraceState } from './trace_state';\n\n/**\n * A SpanContext represents the portion of a {@link Span} which must be\n * serialized and propagated along side of a {@link Baggage}.\n *\n * @since 1.0.0\n */\nexport interface SpanContext {\n /**\n * The ID of the trace that this span belongs to. It is worldwide unique\n * with practically sufficient probability by being made as 16 randomly\n * generated bytes, encoded as a 32 lowercase hex characters corresponding to\n * 128 bits.\n */\n traceId: string;\n /**\n * The ID of the Span. It is globally unique with practically sufficient\n * probability by being made as 8 randomly generated bytes, encoded as a 16\n * lowercase hex characters corresponding to 64 bits.\n */\n spanId: string;\n /**\n * Only true if the SpanContext was propagated from a remote parent.\n */\n isRemote?: boolean;\n /**\n * Trace flags to propagate.\n *\n * It is represented as 1 byte (bitmap). Bit to represent whether trace is\n * sampled or not. When set, the least significant bit documents that the\n * caller may have recorded trace data. A caller who does not record trace\n * data out-of-band leaves this flag unset.\n *\n * see {@link TraceFlags} for valid flag values.\n */\n traceFlags: number;\n /**\n * Tracing-system-specific info to propagate.\n *\n * The tracestate field value is a `list` as defined below. The `list` is a\n * series of `list-members` separated by commas `,`, and a list-member is a\n * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs\n * surrounding `list-members` are ignored. There can be a maximum of 32\n * `list-members` in a `list`.\n * More Info: https://www.w3.org/TR/trace-context/#tracestate-field\n *\n * Examples:\n * Single tracing system (generic format):\n * tracestate: rojo=00f067aa0ba902b7\n * Multiple tracing systems (with different formatting):\n * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE\n */\n traceState?: TraceState;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/span_kind.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/span_kind.d.ts deleted file mode 100644 index 03c9d0f..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/span_kind.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @since 1.0.0 - */ -export declare enum SpanKind { - /** Default value. Indicates that the span is used internally. */ - INTERNAL = 0, - /** - * Indicates that the span covers server-side handling of an RPC or other - * remote request. - */ - SERVER = 1, - /** - * Indicates that the span covers the client-side wrapper around an RPC or - * other remote request. - */ - CLIENT = 2, - /** - * Indicates that the span describes producer sending a message to a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - PRODUCER = 3, - /** - * Indicates that the span describes consumer receiving a message from a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - CONSUMER = 4 -} -//# sourceMappingURL=span_kind.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js b/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js deleted file mode 100644 index 65863f8..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * @since 1.0.0 - */ -export var SpanKind; -(function (SpanKind) { - /** Default value. Indicates that the span is used internally. */ - SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL"; - /** - * Indicates that the span covers server-side handling of an RPC or other - * remote request. - */ - SpanKind[SpanKind["SERVER"] = 1] = "SERVER"; - /** - * Indicates that the span covers the client-side wrapper around an RPC or - * other remote request. - */ - SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT"; - /** - * Indicates that the span describes producer sending a message to a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER"; - /** - * Indicates that the span describes consumer receiving a message from a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER"; -})(SpanKind || (SpanKind = {})); -//# sourceMappingURL=span_kind.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js.map b/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js.map deleted file mode 100644 index 480b32b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"span_kind.js","sourceRoot":"","sources":["../../../src/trace/span_kind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,QA6BX;AA7BD,WAAY,QAAQ;IAClB,iEAAiE;IACjE,+CAAY,CAAA;IAEZ;;;OAGG;IACH,2CAAU,CAAA;IAEV;;;OAGG;IACH,2CAAU,CAAA;IAEV;;;;OAIG;IACH,+CAAY,CAAA;IAEZ;;;;OAIG;IACH,+CAAY,CAAA;AACd,CAAC,EA7BW,QAAQ,KAAR,QAAQ,QA6BnB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport enum SpanKind {\n /** Default value. Indicates that the span is used internally. */\n INTERNAL = 0,\n\n /**\n * Indicates that the span covers server-side handling of an RPC or other\n * remote request.\n */\n SERVER = 1,\n\n /**\n * Indicates that the span covers the client-side wrapper around an RPC or\n * other remote request.\n */\n CLIENT = 2,\n\n /**\n * Indicates that the span describes producer sending a message to a\n * broker. Unlike client and server, there is no direct critical path latency\n * relationship between producer and consumer spans.\n */\n PRODUCER = 3,\n\n /**\n * Indicates that the span describes consumer receiving a message from a\n * broker. Unlike client and server, there is no direct critical path latency\n * relationship between producer and consumer spans.\n */\n CONSUMER = 4,\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.d.ts deleted file mode 100644 index 637ef2b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Span } from './span'; -import type { SpanContext } from './span_context'; -/** - * @since 1.0.0 - */ -export declare function isValidTraceId(traceId: string): boolean; -/** - * @since 1.0.0 - */ -export declare function isValidSpanId(spanId: string): boolean; -/** - * Returns true if this {@link SpanContext} is valid. - * @return true if this {@link SpanContext} is valid. - * - * @since 1.0.0 - */ -export declare function isSpanContextValid(spanContext: SpanContext): boolean; -/** - * Wrap the given {@link SpanContext} in a new non-recording {@link Span} - * - * @param spanContext span context to be wrapped - * @returns a new non-recording {@link Span} with the provided context - */ -export declare function wrapSpanContext(spanContext: SpanContext): Span; -//# sourceMappingURL=spancontext-utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js b/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js deleted file mode 100644 index 5c1887f..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { INVALID_SPANID, INVALID_TRACEID } from './invalid-span-constants'; -import { NonRecordingSpan } from './NonRecordingSpan'; -// Valid characters (0-9, a-f, A-F) are marked as 1. -const isHex = new Uint8Array([ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, -]); -function isValidHex(id, length) { - // As of 1.9.0 the id was allowed to be a non-string value, - // even though it was not possible in the types. - if (typeof id !== 'string' || id.length !== length) - return false; - let r = 0; - for (let i = 0; i < id.length; i += 4) { - r += - (isHex[id.charCodeAt(i)] | 0) + - (isHex[id.charCodeAt(i + 1)] | 0) + - (isHex[id.charCodeAt(i + 2)] | 0) + - (isHex[id.charCodeAt(i + 3)] | 0); - } - return r === length; -} -/** - * @since 1.0.0 - */ -export function isValidTraceId(traceId) { - return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID; -} -/** - * @since 1.0.0 - */ -export function isValidSpanId(spanId) { - return isValidHex(spanId, 16) && spanId !== INVALID_SPANID; -} -/** - * Returns true if this {@link SpanContext} is valid. - * @return true if this {@link SpanContext} is valid. - * - * @since 1.0.0 - */ -export function isSpanContextValid(spanContext) { - return (isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId)); -} -/** - * Wrap the given {@link SpanContext} in a new non-recording {@link Span} - * - * @param spanContext span context to be wrapped - * @returns a new non-recording {@link Span} with the provided context - */ -export function wrapSpanContext(spanContext) { - return new NonRecordingSpan(spanContext); -} -//# sourceMappingURL=spancontext-utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js.map b/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js.map deleted file mode 100644 index 4844cb5..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"spancontext-utils.js","sourceRoot":"","sources":["../../../src/trace/spancontext-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,oDAAoD;AACpD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC;IAC3B,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC5E,CAAC,EAAE,CAAC,EA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ACrC,CAAC;YACC,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBAC7B,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBACjC,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBACjC,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;KACrC;IAED,OAAO,CAAC,KAAK,MAAM,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,OAAO,KAAK,eAAe,CAAC;AAChE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAO,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,KAAK,cAAc,CAAC;AAC7D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAwB;IACzD,OAAO,CACL,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CACzE,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,WAAwB;IACtD,OAAO,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { INVALID_SPANID, INVALID_TRACEID } from './invalid-span-constants';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport type { Span } from './span';\nimport type { SpanContext } from './span_context';\n\n// Valid characters (0-9, a-f, A-F) are marked as 1.\nconst isHex = new Uint8Array([\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,\n]);\n\nfunction isValidHex(id: string, length: number): boolean {\n // As of 1.9.0 the id was allowed to be a non-string value,\n // even though it was not possible in the types.\n if (typeof id !== 'string' || id.length !== length) return false;\n\n let r = 0;\n for (let i = 0; i < id.length; i += 4) {\n r +=\n (isHex[id.charCodeAt(i)] | 0) +\n (isHex[id.charCodeAt(i + 1)] | 0) +\n (isHex[id.charCodeAt(i + 2)] | 0) +\n (isHex[id.charCodeAt(i + 3)] | 0);\n }\n\n return r === length;\n}\n\n/**\n * @since 1.0.0\n */\nexport function isValidTraceId(traceId: string): boolean {\n return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;\n}\n\n/**\n * @since 1.0.0\n */\nexport function isValidSpanId(spanId: string): boolean {\n return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;\n}\n\n/**\n * Returns true if this {@link SpanContext} is valid.\n * @return true if this {@link SpanContext} is valid.\n *\n * @since 1.0.0\n */\nexport function isSpanContextValid(spanContext: SpanContext): boolean {\n return (\n isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId)\n );\n}\n\n/**\n * Wrap the given {@link SpanContext} in a new non-recording {@link Span}\n *\n * @param spanContext span context to be wrapped\n * @returns a new non-recording {@link Span} with the provided context\n */\nexport function wrapSpanContext(spanContext: SpanContext): Span {\n return new NonRecordingSpan(spanContext);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/status.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/status.d.ts deleted file mode 100644 index 77cbacb..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/status.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @since 1.0.0 - */ -export interface SpanStatus { - /** The status code of this message. */ - code: SpanStatusCode; - /** A developer-facing error message. */ - message?: string; -} -/** - * An enumeration of status codes. - * - * @since 1.0.0 - */ -export declare enum SpanStatusCode { - /** - * The default status. - */ - UNSET = 0, - /** - * The operation has been validated by an Application developer or - * Operator to have completed successfully. - */ - OK = 1, - /** - * The operation contains an error. - */ - ERROR = 2 -} -//# sourceMappingURL=status.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/status.js b/node_modules/@opentelemetry/api/build/esm/trace/status.js deleted file mode 100644 index 2969ab7..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/status.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * An enumeration of status codes. - * - * @since 1.0.0 - */ -export var SpanStatusCode; -(function (SpanStatusCode) { - /** - * The default status. - */ - SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET"; - /** - * The operation has been validated by an Application developer or - * Operator to have completed successfully. - */ - SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK"; - /** - * The operation contains an error. - */ - SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR"; -})(SpanStatusCode || (SpanStatusCode = {})); -//# sourceMappingURL=status.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/status.js.map b/node_modules/@opentelemetry/api/build/esm/trace/status.js.map deleted file mode 100644 index 7089c72..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/status.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/trace/status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;GAIG;AACH,MAAM,CAAN,IAAY,cAcX;AAdD,WAAY,cAAc;IACxB;;OAEG;IACH,qDAAS,CAAA;IACT;;;OAGG;IACH,+CAAM,CAAA;IACN;;OAEG;IACH,qDAAS,CAAA;AACX,CAAC,EAdW,cAAc,KAAd,cAAc,QAczB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface SpanStatus {\n /** The status code of this message. */\n code: SpanStatusCode;\n /** A developer-facing error message. */\n message?: string;\n}\n\n/**\n * An enumeration of status codes.\n *\n * @since 1.0.0\n */\nexport enum SpanStatusCode {\n /**\n * The default status.\n */\n UNSET = 0,\n /**\n * The operation has been validated by an Application developer or\n * Operator to have completed successfully.\n */\n OK = 1,\n /**\n * The operation contains an error.\n */\n ERROR = 2,\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.d.ts deleted file mode 100644 index 9977efc..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @since 1.0.0 - */ -export declare enum TraceFlags { - /** Represents no flag set. */ - NONE = 0, - /** Bit to represent whether trace is sampled in trace flags. */ - SAMPLED = 1 -} -//# sourceMappingURL=trace_flags.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js b/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js deleted file mode 100644 index 1242ee3..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * @since 1.0.0 - */ -export var TraceFlags; -(function (TraceFlags) { - /** Represents no flag set. */ - TraceFlags[TraceFlags["NONE"] = 0] = "NONE"; - /** Bit to represent whether trace is sampled in trace flags. */ - TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED"; -})(TraceFlags || (TraceFlags = {})); -//# sourceMappingURL=trace_flags.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js.map b/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js.map deleted file mode 100644 index 8fd3c66..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace_flags.js","sourceRoot":"","sources":["../../../src/trace/trace_flags.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AACH,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,8BAA8B;IAC9B,2CAAU,CAAA;IACV,gEAAgE;IAChE,iDAAkB,CAAA;AACpB,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @since 1.0.0\n */\nexport enum TraceFlags {\n /** Represents no flag set. */\n NONE = 0x0,\n /** Bit to represent whether trace is sampled in trace flags. */\n SAMPLED = 0x1 << 0,\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/trace_state.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/trace_state.d.ts deleted file mode 100644 index 2c7cf02..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/trace_state.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @since 1.0.0 - */ -export interface TraceState { - /** - * Create a new TraceState which inherits from this TraceState and has the - * given key set. - * The new entry will always be added in the front of the list of states. - * - * @param key key of the TraceState entry. - * @param value value of the TraceState entry. - */ - set(key: string, value: string): TraceState; - /** - * Return a new TraceState which inherits from this TraceState but does not - * contain the given key. - * - * @param key the key for the TraceState entry to be removed. - */ - unset(key: string): TraceState; - /** - * Returns the value to which the specified key is mapped, or `undefined` if - * this map contains no mapping for the key. - * - * @param key with which the specified value is to be associated. - * @returns the value to which the specified key is mapped, or `undefined` if - * this map contains no mapping for the key. - */ - get(key: string): string | undefined; - /** - * Serializes the TraceState to a `list` as defined below. The `list` is a - * series of `list-members` separated by commas `,`, and a list-member is a - * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs - * surrounding `list-members` are ignored. There can be a maximum of 32 - * `list-members` in a `list`. - * - * @returns the serialized string. - */ - serialize(): string; -} -//# sourceMappingURL=trace_state.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/trace_state.js b/node_modules/@opentelemetry/api/build/esm/trace/trace_state.js deleted file mode 100644 index 1efb1c9..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/trace_state.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=trace_state.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/trace_state.js.map b/node_modules/@opentelemetry/api/build/esm/trace/trace_state.js.map deleted file mode 100644 index 2d6bdb4..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/trace_state.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace_state.js","sourceRoot":"","sources":["../../../src/trace/trace_state.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface TraceState {\n /**\n * Create a new TraceState which inherits from this TraceState and has the\n * given key set.\n * The new entry will always be added in the front of the list of states.\n *\n * @param key key of the TraceState entry.\n * @param value value of the TraceState entry.\n */\n set(key: string, value: string): TraceState;\n\n /**\n * Return a new TraceState which inherits from this TraceState but does not\n * contain the given key.\n *\n * @param key the key for the TraceState entry to be removed.\n */\n unset(key: string): TraceState;\n\n /**\n * Returns the value to which the specified key is mapped, or `undefined` if\n * this map contains no mapping for the key.\n *\n * @param key with which the specified value is to be associated.\n * @returns the value to which the specified key is mapped, or `undefined` if\n * this map contains no mapping for the key.\n */\n get(key: string): string | undefined;\n\n // TODO: Consider to add support for merging an object as well by also\n // accepting a single internalTraceState argument similar to the constructor.\n\n /**\n * Serializes the TraceState to a `list` as defined below. The `list` is a\n * series of `list-members` separated by commas `,`, and a list-member is a\n * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs\n * surrounding `list-members` are ignored. There can be a maximum of 32\n * `list-members` in a `list`.\n *\n * @returns the serialized string.\n */\n serialize(): string;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/tracer.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/tracer.d.ts deleted file mode 100644 index d1ecaef..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/tracer.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanOptions } from './SpanOptions'; -/** - * Tracer provides an interface for creating {@link Span}s. - * - * @since 1.0.0 - */ -export interface Tracer { - /** - * Starts a new {@link Span}. Start the span without setting it on context. - * - * This method do NOT modify the current Context. - * - * @param name The name of the span - * @param [options] SpanOptions used for span creation - * @param [context] Context to use to extract parent - * @returns Span The newly created span - * @example - * const span = tracer.startSpan('op'); - * span.setAttribute('key', 'value'); - * span.end(); - */ - startSpan(name: string, options?: SpanOptions, context?: Context): Span; - /** - * Starts a new {@link Span} and calls the given function passing it the - * created span as first argument. - * Additionally the new span gets set in context and this context is activated - * for the duration of the function call. - * - * @param name The name of the span - * @param [options] SpanOptions used for span creation - * @param [context] Context to use to extract parent - * @param fn function called in the context of the span and receives the newly created span as an argument - * @returns return value of fn - * @example - * const something = tracer.startActiveSpan('op', span => { - * try { - * do some work - * span.setStatus({code: SpanStatusCode.OK}); - * return something; - * } catch (err) { - * span.setStatus({ - * code: SpanStatusCode.ERROR, - * message: err.message, - * }); - * throw err; - * } finally { - * span.end(); - * } - * }); - * - * @example - * const span = tracer.startActiveSpan('op', span => { - * try { - * do some work - * return span; - * } catch (err) { - * span.setStatus({ - * code: SpanStatusCode.ERROR, - * message: err.message, - * }); - * throw err; - * } - * }); - * do some more work - * span.end(); - */ - startActiveSpan unknown>(name: string, fn: F): ReturnType; - startActiveSpan unknown>(name: string, options: SpanOptions, fn: F): ReturnType; - startActiveSpan unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType; -} -//# sourceMappingURL=tracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/tracer.js b/node_modules/@opentelemetry/api/build/esm/trace/tracer.js deleted file mode 100644 index f7b7a75..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/tracer.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=tracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/tracer.js.map b/node_modules/@opentelemetry/api/build/esm/trace/tracer.js.map deleted file mode 100644 index abfdfbc..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/tracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracer.js","sourceRoot":"","sources":["../../../src/trace/tracer.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport type { Span } from './span';\nimport type { SpanOptions } from './SpanOptions';\n\n/**\n * Tracer provides an interface for creating {@link Span}s.\n *\n * @since 1.0.0\n */\nexport interface Tracer {\n /**\n * Starts a new {@link Span}. Start the span without setting it on context.\n *\n * This method do NOT modify the current Context.\n *\n * @param name The name of the span\n * @param [options] SpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @returns Span The newly created span\n * @example\n * const span = tracer.startSpan('op');\n * span.setAttribute('key', 'value');\n * span.end();\n */\n startSpan(name: string, options?: SpanOptions, context?: Context): Span;\n\n /**\n * Starts a new {@link Span} and calls the given function passing it the\n * created span as first argument.\n * Additionally the new span gets set in context and this context is activated\n * for the duration of the function call.\n *\n * @param name The name of the span\n * @param [options] SpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns return value of fn\n * @example\n * const something = tracer.startActiveSpan('op', span => {\n * try {\n * do some work\n * span.setStatus({code: SpanStatusCode.OK});\n * return something;\n * } catch (err) {\n * span.setStatus({\n * code: SpanStatusCode.ERROR,\n * message: err.message,\n * });\n * throw err;\n * } finally {\n * span.end();\n * }\n * });\n *\n * @example\n * const span = tracer.startActiveSpan('op', span => {\n * try {\n * do some work\n * return span;\n * } catch (err) {\n * span.setStatus({\n * code: SpanStatusCode.ERROR,\n * message: err.message,\n * });\n * throw err;\n * }\n * });\n * do some more work\n * span.end();\n */\n startActiveSpan unknown>(\n name: string,\n fn: F\n ): ReturnType;\n startActiveSpan unknown>(\n name: string,\n options: SpanOptions,\n fn: F\n ): ReturnType;\n startActiveSpan unknown>(\n name: string,\n options: SpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/tracer_options.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/tracer_options.d.ts deleted file mode 100644 index ab4e483..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/tracer_options.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * An interface describes additional metadata of a tracer. - * - * @since 1.3.0 - */ -export interface TracerOptions { - /** - * The schemaUrl of the tracer or instrumentation library - */ - schemaUrl?: string; -} -//# sourceMappingURL=tracer_options.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/tracer_options.js b/node_modules/@opentelemetry/api/build/esm/trace/tracer_options.js deleted file mode 100644 index c82e483..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/tracer_options.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=tracer_options.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/tracer_options.js.map b/node_modules/@opentelemetry/api/build/esm/trace/tracer_options.js.map deleted file mode 100644 index fd8375b..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/tracer_options.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracer_options.js","sourceRoot":"","sources":["../../../src/trace/tracer_options.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An interface describes additional metadata of a tracer.\n *\n * @since 1.3.0\n */\nexport interface TracerOptions {\n /**\n * The schemaUrl of the tracer or instrumentation library\n */\n schemaUrl?: string;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/tracer_provider.d.ts b/node_modules/@opentelemetry/api/build/esm/trace/tracer_provider.d.ts deleted file mode 100644 index eacef7f..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/tracer_provider.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { Tracer } from './tracer'; -import type { TracerOptions } from './tracer_options'; -/** - * A registry for creating named {@link Tracer}s. - * - * @since 1.0.0 - */ -export interface TracerProvider { - /** - * Returns a Tracer, creating one if one with the given name and version is - * not already created. - * - * This function may return different Tracer types (e.g. - * {@link NoopTracerProvider} vs. a functional tracer). - * - * @param name The name of the tracer or instrumentation library. - * @param version The version of the tracer or instrumentation library. - * @param options The options of the tracer or instrumentation library. - * @returns Tracer A Tracer with the given name and version - */ - getTracer(name: string, version?: string, options?: TracerOptions): Tracer; -} -//# sourceMappingURL=tracer_provider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/tracer_provider.js b/node_modules/@opentelemetry/api/build/esm/trace/tracer_provider.js deleted file mode 100644 index b06f420..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/tracer_provider.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=tracer_provider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/trace/tracer_provider.js.map b/node_modules/@opentelemetry/api/build/esm/trace/tracer_provider.js.map deleted file mode 100644 index 9f5ef09..0000000 --- a/node_modules/@opentelemetry/api/build/esm/trace/tracer_provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracer_provider.js","sourceRoot":"","sources":["../../../src/trace/tracer_provider.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Tracer } from './tracer';\nimport type { TracerOptions } from './tracer_options';\n\n/**\n * A registry for creating named {@link Tracer}s.\n *\n * @since 1.0.0\n */\nexport interface TracerProvider {\n /**\n * Returns a Tracer, creating one if one with the given name and version is\n * not already created.\n *\n * This function may return different Tracer types (e.g.\n * {@link NoopTracerProvider} vs. a functional tracer).\n *\n * @param name The name of the tracer or instrumentation library.\n * @param version The version of the tracer or instrumentation library.\n * @param options The options of the tracer or instrumentation library.\n * @returns Tracer A Tracer with the given name and version\n */\n getTracer(name: string, version?: string, options?: TracerOptions): Tracer;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/version.d.ts b/node_modules/@opentelemetry/api/build/esm/version.d.ts deleted file mode 100644 index fe80997..0000000 --- a/node_modules/@opentelemetry/api/build/esm/version.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const VERSION = "1.9.1"; -//# sourceMappingURL=version.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/version.js b/node_modules/@opentelemetry/api/build/esm/version.js deleted file mode 100644 index f409ae4..0000000 --- a/node_modules/@opentelemetry/api/build/esm/version.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// this is autogenerated file, see scripts/version-update.js -export const VERSION = '1.9.1'; -//# sourceMappingURL=version.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esm/version.js.map b/node_modules/@opentelemetry/api/build/esm/version.js.map deleted file mode 100644 index f1e6503..0000000 --- a/node_modules/@opentelemetry/api/build/esm/version.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '1.9.1';\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/context.d.ts b/node_modules/@opentelemetry/api/build/esnext/api/context.d.ts deleted file mode 100644 index 7771d2a..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/context.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { Context, ContextManager } from '../context/types'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Context API - * - * @since 1.0.0 - */ -export declare class ContextAPI { - private static _instance?; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Context API */ - static getInstance(): ContextAPI; - /** - * Set the current context manager. - * - * @returns true if the context manager was successfully registered, else false - */ - setGlobalContextManager(contextManager: ContextManager): boolean; - /** - * Get the currently active context - */ - active(): Context; - /** - * Execute a function with an active context - * - * @param context context to be active during function execution - * @param fn function to execute in a context - * @param thisArg optional receiver to be used for calling fn - * @param args optional arguments forwarded to fn - */ - with ReturnType>(context: Context, fn: F, thisArg?: ThisParameterType, ...args: A): ReturnType; - /** - * Bind a context to a target function or event emitter - * - * @param context context to bind to the event emitter or function. Defaults to the currently active context - * @param target function or event emitter to bind - */ - bind(context: Context, target: T): T; - private _getContextManager; - /** Disable and remove the global context manager */ - disable(): void; -} -//# sourceMappingURL=context.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/context.js b/node_modules/@opentelemetry/api/build/esnext/api/context.js deleted file mode 100644 index 7dfcd82..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/context.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { NoopContextManager } from '../context/NoopContextManager'; -import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils'; -import { DiagAPI } from './diag'; -const API_NAME = 'context'; -const NOOP_CONTEXT_MANAGER = new NoopContextManager(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Context API - * - * @since 1.0.0 - */ -export class ContextAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { } - /** Get the singleton instance of the Context API */ - static getInstance() { - if (!this._instance) { - this._instance = new ContextAPI(); - } - return this._instance; - } - /** - * Set the current context manager. - * - * @returns true if the context manager was successfully registered, else false - */ - setGlobalContextManager(contextManager) { - return registerGlobal(API_NAME, contextManager, DiagAPI.instance()); - } - /** - * Get the currently active context - */ - active() { - return this._getContextManager().active(); - } - /** - * Execute a function with an active context - * - * @param context context to be active during function execution - * @param fn function to execute in a context - * @param thisArg optional receiver to be used for calling fn - * @param args optional arguments forwarded to fn - */ - with(context, fn, thisArg, ...args) { - return this._getContextManager().with(context, fn, thisArg, ...args); - } - /** - * Bind a context to a target function or event emitter - * - * @param context context to bind to the event emitter or function. Defaults to the currently active context - * @param target function or event emitter to bind - */ - bind(context, target) { - return this._getContextManager().bind(context, target); - } - _getContextManager() { - return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER; - } - /** Disable and remove the global context manager */ - disable() { - this._getContextManager().disable(); - unregisterGlobal(API_NAME, DiagAPI.instance()); - } -} -//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/context.js.map b/node_modules/@opentelemetry/api/build/esnext/api/context.js.map deleted file mode 100644 index 67dc9a4..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/api/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAEtD;;;;GAIG;AACH,MAAM,OAAO,UAAU;IAGrB,+FAA+F;IAC/F,gBAAuB,CAAC;IAExB,oDAAoD;IAC7C,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,UAAU,EAAE,CAAC;SACnC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,uBAAuB,CAAC,cAA8B;QAC3D,OAAO,cAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACI,MAAM;QACX,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACI,IAAI,CACT,OAAgB,EAChB,EAAK,EACL,OAA8B,EAC9B,GAAG,IAAO;QAEV,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAI,OAAgB,EAAE,MAAS;QACxC,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAEO,kBAAkB;QACxB,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC;IACrD,CAAC;IAED,oDAAoD;IAC7C,OAAO;QACZ,IAAI,CAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,CAAC;QACpC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { NoopContextManager } from '../context/NoopContextManager';\nimport type { Context, ContextManager } from '../context/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'context';\nconst NOOP_CONTEXT_MANAGER = new NoopContextManager();\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Context API\n *\n * @since 1.0.0\n */\nexport class ContextAPI {\n private static _instance?: ContextAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Context API */\n public static getInstance(): ContextAPI {\n if (!this._instance) {\n this._instance = new ContextAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current context manager.\n *\n * @returns true if the context manager was successfully registered, else false\n */\n public setGlobalContextManager(contextManager: ContextManager): boolean {\n return registerGlobal(API_NAME, contextManager, DiagAPI.instance());\n }\n\n /**\n * Get the currently active context\n */\n public active(): Context {\n return this._getContextManager().active();\n }\n\n /**\n * Execute a function with an active context\n *\n * @param context context to be active during function execution\n * @param fn function to execute in a context\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n public with ReturnType>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType,\n ...args: A\n ): ReturnType {\n return this._getContextManager().with(context, fn, thisArg, ...args);\n }\n\n /**\n * Bind a context to a target function or event emitter\n *\n * @param context context to bind to the event emitter or function. Defaults to the currently active context\n * @param target function or event emitter to bind\n */\n public bind(context: Context, target: T): T {\n return this._getContextManager().bind(context, target);\n }\n\n private _getContextManager(): ContextManager {\n return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;\n }\n\n /** Disable and remove the global context manager */\n public disable() {\n this._getContextManager().disable();\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/diag.d.ts b/node_modules/@opentelemetry/api/build/esnext/api/diag.d.ts deleted file mode 100644 index 478c771..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/diag.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { ComponentLoggerOptions, DiagLogFunction, DiagLogger, DiagLoggerApi } from '../diag/types'; -/** - * Singleton object which represents the entry point to the OpenTelemetry internal - * diagnostic API - * - * @since 1.0.0 - */ -export declare class DiagAPI implements DiagLogger, DiagLoggerApi { - private static _instance?; - /** Get the singleton instance of the DiagAPI API */ - static instance(): DiagAPI; - /** - * Private internal constructor - * @private - */ - private constructor(); - setLogger: DiagLoggerApi['setLogger']; - /** - * - */ - createComponentLogger: (options: ComponentLoggerOptions) => DiagLogger; - verbose: DiagLogFunction; - debug: DiagLogFunction; - info: DiagLogFunction; - warn: DiagLogFunction; - error: DiagLogFunction; - /** - * Unregister the global logger and return to Noop - */ - disable: () => void; -} -//# sourceMappingURL=diag.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/diag.js b/node_modules/@opentelemetry/api/build/esnext/api/diag.js deleted file mode 100644 index a995e1e..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/diag.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { DiagComponentLogger } from '../diag/ComponentLogger'; -import { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger'; -import { DiagLogLevel } from '../diag/types'; -import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils'; -const API_NAME = 'diag'; -/** - * Singleton object which represents the entry point to the OpenTelemetry internal - * diagnostic API - * - * @since 1.0.0 - */ -export class DiagAPI { - /** Get the singleton instance of the DiagAPI API */ - static instance() { - if (!this._instance) { - this._instance = new DiagAPI(); - } - return this._instance; - } - /** - * Private internal constructor - * @private - */ - constructor() { - function _logProxy(funcName) { - return function (...args) { - const logger = getGlobal('diag'); - // shortcut if logger not set - if (!logger) - return; - return logger[funcName](...args); - }; - } - // Using self local variable for minification purposes as 'this' cannot be minified - const self = this; - // DiagAPI specific functions - const setLogger = (logger, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => { - var _a, _b, _c; - if (logger === self) { - // There isn't much we can do here. - // Logging to the console might break the user application. - // Try to log to self. If a logger was previously registered it will receive the log. - const err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'); - self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message); - return false; - } - if (typeof optionsOrLogLevel === 'number') { - optionsOrLogLevel = { - logLevel: optionsOrLogLevel, - }; - } - const oldLogger = getGlobal('diag'); - const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger); - // There already is an logger registered. We'll let it know before overwriting it. - if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) { - const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : ''; - oldLogger.warn(`Current logger will be overwritten from ${stack}`); - newLogger.warn(`Current logger will overwrite one already registered from ${stack}`); - } - return registerGlobal('diag', newLogger, self, true); - }; - self.setLogger = setLogger; - self.disable = () => { - unregisterGlobal(API_NAME, self); - }; - self.createComponentLogger = (options) => { - return new DiagComponentLogger(options); - }; - self.verbose = _logProxy('verbose'); - self.debug = _logProxy('debug'); - self.info = _logProxy('info'); - self.warn = _logProxy('warn'); - self.error = _logProxy('error'); - } -} -//# sourceMappingURL=diag.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/diag.js.map b/node_modules/@opentelemetry/api/build/esnext/api/diag.js.map deleted file mode 100644 index 7f724bc..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/diag.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diag.js","sourceRoot":"","sources":["../../../src/api/diag.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAO3E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAExB;;;;;GAKG;AACH,MAAM,OAAO,OAAO;IAGlB,oDAAoD;IAC7C,MAAM,CAAC,QAAQ;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH;QACE,SAAS,SAAS,CAAC,QAA0B;YAC3C,OAAO,UAAU,GAAG,IAAI;gBACtB,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;gBACjC,6BAA6B;gBAC7B,IAAI,CAAC,MAAM;oBAAE,OAAO;gBACpB,OAAO,MAAM,CAAC,QA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B,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE;YAClB,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC;QAEF,IAAI,CAAC,qBAAqB,GAAG,CAAC,OAA+B,EAAE,EAAE;YAC/D,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CAqBF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DiagComponentLogger } from '../diag/ComponentLogger';\nimport { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';\nimport type {\n ComponentLoggerOptions,\n DiagLogFunction,\n DiagLogger,\n DiagLoggerApi,\n} from '../diag/types';\nimport { DiagLogLevel } from '../diag/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\n\nconst API_NAME = 'diag';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry internal\n * diagnostic API\n *\n * @since 1.0.0\n */\nexport class DiagAPI implements DiagLogger, DiagLoggerApi {\n private static _instance?: DiagAPI;\n\n /** Get the singleton instance of the DiagAPI API */\n public static instance(): DiagAPI {\n if (!this._instance) {\n this._instance = new DiagAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Private internal constructor\n * @private\n */\n private constructor() {\n function _logProxy(funcName: keyof DiagLogger): DiagLogFunction {\n return function (...args) {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) return;\n return logger[funcName](...args);\n };\n }\n\n // Using self local variable for minification purposes as 'this' cannot be minified\n const self = this;\n\n // DiagAPI specific functions\n\n const setLogger: DiagLoggerApi['setLogger'] = (\n logger,\n optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }\n ) => {\n if (logger === self) {\n // There isn't much we can do here.\n // Logging to the console might break the user application.\n // Try to log to self. If a logger was previously registered it will receive the log.\n const err = new Error(\n 'Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'\n );\n self.error(err.stack ?? err.message);\n return false;\n }\n\n if (typeof optionsOrLogLevel === 'number') {\n optionsOrLogLevel = {\n logLevel: optionsOrLogLevel,\n };\n }\n\n const oldLogger = getGlobal('diag');\n const newLogger = createLogLevelDiagLogger(\n optionsOrLogLevel.logLevel ?? DiagLogLevel.INFO,\n logger\n );\n // There already is an logger registered. We'll let it know before overwriting it.\n if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {\n const stack = new Error().stack ?? '';\n oldLogger.warn(`Current logger will be overwritten from ${stack}`);\n newLogger.warn(\n `Current logger will overwrite one already registered from ${stack}`\n );\n }\n\n return registerGlobal('diag', newLogger, self, true);\n };\n\n self.setLogger = setLogger;\n\n self.disable = () => {\n unregisterGlobal(API_NAME, self);\n };\n\n self.createComponentLogger = (options: ComponentLoggerOptions) => {\n return new DiagComponentLogger(options);\n };\n\n self.verbose = _logProxy('verbose');\n self.debug = _logProxy('debug');\n self.info = _logProxy('info');\n self.warn = _logProxy('warn');\n self.error = _logProxy('error');\n }\n\n public setLogger!: DiagLoggerApi['setLogger'];\n /**\n *\n */\n public createComponentLogger!: (\n options: ComponentLoggerOptions\n ) => DiagLogger;\n\n // DiagLogger implementation\n public verbose!: DiagLogFunction;\n public debug!: DiagLogFunction;\n public info!: DiagLogFunction;\n public warn!: DiagLogFunction;\n public error!: DiagLogFunction;\n\n /**\n * Unregister the global logger and return to Noop\n */\n public disable!: () => void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/metrics.d.ts b/node_modules/@opentelemetry/api/build/esnext/api/metrics.d.ts deleted file mode 100644 index 09d2147..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/metrics.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Meter, MeterOptions } from '../metrics/Meter'; -import type { MeterProvider } from '../metrics/MeterProvider'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Metrics API - */ -export declare class MetricsAPI { - private static _instance?; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Metrics API */ - static getInstance(): MetricsAPI; - /** - * Set the current global meter provider. - * Returns true if the meter provider was successfully registered, else false. - */ - setGlobalMeterProvider(provider: MeterProvider): boolean; - /** - * Returns the global meter provider. - */ - getMeterProvider(): MeterProvider; - /** - * Returns a meter from the global meter provider. - */ - getMeter(name: string, version?: string, options?: MeterOptions): Meter; - /** Remove the global meter provider */ - disable(): void; -} -//# sourceMappingURL=metrics.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/metrics.js b/node_modules/@opentelemetry/api/build/esnext/api/metrics.js deleted file mode 100644 index 20c82f3..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/metrics.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider'; -import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils'; -import { DiagAPI } from './diag'; -const API_NAME = 'metrics'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Metrics API - */ -export class MetricsAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { } - /** Get the singleton instance of the Metrics API */ - static getInstance() { - if (!this._instance) { - this._instance = new MetricsAPI(); - } - return this._instance; - } - /** - * Set the current global meter provider. - * Returns true if the meter provider was successfully registered, else false. - */ - setGlobalMeterProvider(provider) { - return registerGlobal(API_NAME, provider, DiagAPI.instance()); - } - /** - * Returns the global meter provider. - */ - getMeterProvider() { - return getGlobal(API_NAME) || NOOP_METER_PROVIDER; - } - /** - * Returns a meter from the global meter provider. - */ - getMeter(name, version, options) { - return this.getMeterProvider().getMeter(name, version, options); - } - /** Remove the global meter provider */ - disable() { - unregisterGlobal(API_NAME, DiagAPI.instance()); - } -} -//# sourceMappingURL=metrics.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/metrics.js.map b/node_modules/@opentelemetry/api/build/esnext/api/metrics.js.map deleted file mode 100644 index d760f14..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/metrics.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/api/metrics.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAE3B;;GAEG;AACH,MAAM,OAAO,UAAU;IAGrB,+FAA+F;IAC/F,gBAAuB,CAAC;IAExB,oDAAoD;IAC7C,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,UAAU,EAAE,CAAC;SACnC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,sBAAsB,CAAC,QAAuB;QACnD,OAAO,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,mBAAmB,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,QAAQ,CACb,IAAY,EACZ,OAAgB,EAChB,OAAsB;QAEtB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,uCAAuC;IAChC,OAAO;QACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter, MeterOptions } from '../metrics/Meter';\nimport type { MeterProvider } from '../metrics/MeterProvider';\nimport { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'metrics';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Metrics API\n */\nexport class MetricsAPI {\n private static _instance?: MetricsAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Metrics API */\n public static getInstance(): MetricsAPI {\n if (!this._instance) {\n this._instance = new MetricsAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current global meter provider.\n * Returns true if the meter provider was successfully registered, else false.\n */\n public setGlobalMeterProvider(provider: MeterProvider): boolean {\n return registerGlobal(API_NAME, provider, DiagAPI.instance());\n }\n\n /**\n * Returns the global meter provider.\n */\n public getMeterProvider(): MeterProvider {\n return getGlobal(API_NAME) || NOOP_METER_PROVIDER;\n }\n\n /**\n * Returns a meter from the global meter provider.\n */\n public getMeter(\n name: string,\n version?: string,\n options?: MeterOptions\n ): Meter {\n return this.getMeterProvider().getMeter(name, version, options);\n }\n\n /** Remove the global meter provider */\n public disable(): void {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/propagation.d.ts b/node_modules/@opentelemetry/api/build/esnext/api/propagation.d.ts deleted file mode 100644 index 1ef2c0b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/propagation.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { Context } from '../context/types'; -import type { TextMapGetter, TextMapPropagator, TextMapSetter } from '../propagation/TextMapPropagator'; -import { getBaggage, getActiveBaggage, setBaggage, deleteBaggage } from '../baggage/context-helpers'; -import { createBaggage } from '../baggage/utils'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Propagation API - * - * @since 1.0.0 - */ -export declare class PropagationAPI { - private static _instance?; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Propagator API */ - static getInstance(): PropagationAPI; - /** - * Set the current propagator. - * - * @returns true if the propagator was successfully registered, else false - */ - setGlobalPropagator(propagator: TextMapPropagator): boolean; - /** - * Inject context into a carrier to be propagated inter-process - * - * @param context Context carrying tracing data to inject - * @param carrier carrier to inject context into - * @param setter Function used to set values on the carrier - */ - inject(context: Context, carrier: Carrier, setter?: TextMapSetter): void; - /** - * Extract context from a carrier - * - * @param context Context which the newly created context will inherit from - * @param carrier Carrier to extract context from - * @param getter Function used to extract keys from a carrier - */ - extract(context: Context, carrier: Carrier, getter?: TextMapGetter): Context; - /** - * Return a list of all fields which may be used by the propagator. - */ - fields(): string[]; - /** Remove the global propagator */ - disable(): void; - createBaggage: typeof createBaggage; - getBaggage: typeof getBaggage; - getActiveBaggage: typeof getActiveBaggage; - setBaggage: typeof setBaggage; - deleteBaggage: typeof deleteBaggage; - private _getGlobalPropagator; -} -//# sourceMappingURL=propagation.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/propagation.js b/node_modules/@opentelemetry/api/build/esnext/api/propagation.js deleted file mode 100644 index ffe4f4b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/propagation.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils'; -import { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator'; -import { defaultTextMapGetter, defaultTextMapSetter, } from '../propagation/TextMapPropagator'; -import { getBaggage, getActiveBaggage, setBaggage, deleteBaggage, } from '../baggage/context-helpers'; -import { createBaggage } from '../baggage/utils'; -import { DiagAPI } from './diag'; -const API_NAME = 'propagation'; -const NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Propagation API - * - * @since 1.0.0 - */ -export class PropagationAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this.createBaggage = createBaggage; - this.getBaggage = getBaggage; - this.getActiveBaggage = getActiveBaggage; - this.setBaggage = setBaggage; - this.deleteBaggage = deleteBaggage; - } - /** Get the singleton instance of the Propagator API */ - static getInstance() { - if (!this._instance) { - this._instance = new PropagationAPI(); - } - return this._instance; - } - /** - * Set the current propagator. - * - * @returns true if the propagator was successfully registered, else false - */ - setGlobalPropagator(propagator) { - return registerGlobal(API_NAME, propagator, DiagAPI.instance()); - } - /** - * Inject context into a carrier to be propagated inter-process - * - * @param context Context carrying tracing data to inject - * @param carrier carrier to inject context into - * @param setter Function used to set values on the carrier - */ - inject(context, carrier, setter = defaultTextMapSetter) { - return this._getGlobalPropagator().inject(context, carrier, setter); - } - /** - * Extract context from a carrier - * - * @param context Context which the newly created context will inherit from - * @param carrier Carrier to extract context from - * @param getter Function used to extract keys from a carrier - */ - extract(context, carrier, getter = defaultTextMapGetter) { - return this._getGlobalPropagator().extract(context, carrier, getter); - } - /** - * Return a list of all fields which may be used by the propagator. - */ - fields() { - return this._getGlobalPropagator().fields(); - } - /** Remove the global propagator */ - disable() { - unregisterGlobal(API_NAME, DiagAPI.instance()); - } - _getGlobalPropagator() { - return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR; - } -} -//# sourceMappingURL=propagation.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/propagation.js.map b/node_modules/@opentelemetry/api/build/esnext/api/propagation.js.map deleted file mode 100644 index 75b33df..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/propagation.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../src/api/propagation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAM7E,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,aAAa,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,aAAa,CAAC;AAC/B,MAAM,wBAAwB,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAE7D;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAGzB,+FAA+F;IAC/F;QA8DO,kBAAa,GAAG,aAAa,CAAC;QAE9B,eAAU,GAAG,UAAU,CAAC;QAExB,qBAAgB,GAAG,gBAAgB,CAAC;QAEpC,eAAU,GAAG,UAAU,CAAC;QAExB,kBAAa,GAAG,aAAa,CAAC;IAtEd,CAAC;IAExB,uDAAuD;IAChD,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;SACvC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,UAA6B;QACtD,OAAO,cAAc,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CACX,OAAgB,EAChB,OAAgB,EAChB,SAAiC,oBAAoB;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CACZ,OAAgB,EAChB,OAAgB,EAChB,SAAiC,oBAAoB;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,MAAM;QACX,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC9C,CAAC;IAED,mCAAmC;IAC5B,OAAO;QACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAYO,oBAAoB;QAC1B,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,wBAAwB,CAAC;IACzD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator';\nimport type {\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n} from '../propagation/TextMapPropagator';\nimport {\n defaultTextMapGetter,\n defaultTextMapSetter,\n} from '../propagation/TextMapPropagator';\nimport {\n getBaggage,\n getActiveBaggage,\n setBaggage,\n deleteBaggage,\n} from '../baggage/context-helpers';\nimport { createBaggage } from '../baggage/utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'propagation';\nconst NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Propagation API\n *\n * @since 1.0.0\n */\nexport class PropagationAPI {\n private static _instance?: PropagationAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Propagator API */\n public static getInstance(): PropagationAPI {\n if (!this._instance) {\n this._instance = new PropagationAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current propagator.\n *\n * @returns true if the propagator was successfully registered, else false\n */\n public setGlobalPropagator(propagator: TextMapPropagator): boolean {\n return registerGlobal(API_NAME, propagator, DiagAPI.instance());\n }\n\n /**\n * Inject context into a carrier to be propagated inter-process\n *\n * @param context Context carrying tracing data to inject\n * @param carrier carrier to inject context into\n * @param setter Function used to set values on the carrier\n */\n public inject(\n context: Context,\n carrier: Carrier,\n setter: TextMapSetter = defaultTextMapSetter\n ): void {\n return this._getGlobalPropagator().inject(context, carrier, setter);\n }\n\n /**\n * Extract context from a carrier\n *\n * @param context Context which the newly created context will inherit from\n * @param carrier Carrier to extract context from\n * @param getter Function used to extract keys from a carrier\n */\n public extract(\n context: Context,\n carrier: Carrier,\n getter: TextMapGetter = defaultTextMapGetter\n ): Context {\n return this._getGlobalPropagator().extract(context, carrier, getter);\n }\n\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n public fields(): string[] {\n return this._getGlobalPropagator().fields();\n }\n\n /** Remove the global propagator */\n public disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n\n public createBaggage = createBaggage;\n\n public getBaggage = getBaggage;\n\n public getActiveBaggage = getActiveBaggage;\n\n public setBaggage = setBaggage;\n\n public deleteBaggage = deleteBaggage;\n\n private _getGlobalPropagator(): TextMapPropagator {\n return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/trace.d.ts b/node_modules/@opentelemetry/api/build/esnext/api/trace.d.ts deleted file mode 100644 index 1f4efd4..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/trace.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { isSpanContextValid, wrapSpanContext } from '../trace/spancontext-utils'; -import type { Tracer } from '../trace/tracer'; -import type { TracerProvider } from '../trace/tracer_provider'; -import { deleteSpan, getActiveSpan, getSpan, getSpanContext, setSpan, setSpanContext } from '../trace/context-utils'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Tracing API - * - * @since 1.0.0 - */ -export declare class TraceAPI { - private static _instance?; - private _proxyTracerProvider; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Trace API */ - static getInstance(): TraceAPI; - /** - * Set the current global tracer. - * - * @returns true if the tracer provider was successfully registered, else false - */ - setGlobalTracerProvider(provider: TracerProvider): boolean; - /** - * Returns the global tracer provider. - */ - getTracerProvider(): TracerProvider; - /** - * Returns a tracer from the global tracer provider. - */ - getTracer(name: string, version?: string): Tracer; - /** Remove the global tracer provider */ - disable(): void; - wrapSpanContext: typeof wrapSpanContext; - isSpanContextValid: typeof isSpanContextValid; - deleteSpan: typeof deleteSpan; - getSpan: typeof getSpan; - getActiveSpan: typeof getActiveSpan; - getSpanContext: typeof getSpanContext; - setSpan: typeof setSpan; - setSpanContext: typeof setSpanContext; -} -//# sourceMappingURL=trace.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/trace.js b/node_modules/@opentelemetry/api/build/esnext/api/trace.js deleted file mode 100644 index 9f667ed..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/trace.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils'; -import { ProxyTracerProvider } from '../trace/ProxyTracerProvider'; -import { isSpanContextValid, wrapSpanContext, } from '../trace/spancontext-utils'; -import { deleteSpan, getActiveSpan, getSpan, getSpanContext, setSpan, setSpanContext, } from '../trace/context-utils'; -import { DiagAPI } from './diag'; -const API_NAME = 'trace'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Tracing API - * - * @since 1.0.0 - */ -export class TraceAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._proxyTracerProvider = new ProxyTracerProvider(); - this.wrapSpanContext = wrapSpanContext; - this.isSpanContextValid = isSpanContextValid; - this.deleteSpan = deleteSpan; - this.getSpan = getSpan; - this.getActiveSpan = getActiveSpan; - this.getSpanContext = getSpanContext; - this.setSpan = setSpan; - this.setSpanContext = setSpanContext; - } - /** Get the singleton instance of the Trace API */ - static getInstance() { - if (!this._instance) { - this._instance = new TraceAPI(); - } - return this._instance; - } - /** - * Set the current global tracer. - * - * @returns true if the tracer provider was successfully registered, else false - */ - setGlobalTracerProvider(provider) { - const success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance()); - if (success) { - this._proxyTracerProvider.setDelegate(provider); - } - return success; - } - /** - * Returns the global tracer provider. - */ - getTracerProvider() { - return getGlobal(API_NAME) || this._proxyTracerProvider; - } - /** - * Returns a tracer from the global tracer provider. - */ - getTracer(name, version) { - return this.getTracerProvider().getTracer(name, version); - } - /** Remove the global tracer provider */ - disable() { - unregisterGlobal(API_NAME, DiagAPI.instance()); - this._proxyTracerProvider = new ProxyTracerProvider(); - } -} -//# sourceMappingURL=trace.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/api/trace.js.map b/node_modules/@opentelemetry/api/build/esnext/api/trace.js.map deleted file mode 100644 index 729a05c..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/api/trace.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/api/trace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,M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Q,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,IAAY,EAAE,OAAgB;QAC7C,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,wCAAwC;IACjC,OAAO;QACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,oBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACxD,CAAC;CAiBF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { ProxyTracerProvider } from '../trace/ProxyTracerProvider';\nimport {\n isSpanContextValid,\n wrapSpanContext,\n} from '../trace/spancontext-utils';\nimport type { Tracer } from '../trace/tracer';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport {\n deleteSpan,\n getActiveSpan,\n getSpan,\n getSpanContext,\n setSpan,\n setSpanContext,\n} from '../trace/context-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'trace';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Tracing API\n *\n * @since 1.0.0\n */\nexport class TraceAPI {\n private static _instance?: TraceAPI;\n\n private _proxyTracerProvider = new ProxyTracerProvider();\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Trace API */\n public static getInstance(): TraceAPI {\n if (!this._instance) {\n this._instance = new TraceAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current global tracer.\n *\n * @returns true if the tracer provider was successfully registered, else false\n */\n public setGlobalTracerProvider(provider: TracerProvider): boolean {\n const success = registerGlobal(\n API_NAME,\n this._proxyTracerProvider,\n DiagAPI.instance()\n );\n if (success) {\n this._proxyTracerProvider.setDelegate(provider);\n }\n return success;\n }\n\n /**\n * Returns the global tracer provider.\n */\n public getTracerProvider(): TracerProvider {\n return getGlobal(API_NAME) || this._proxyTracerProvider;\n }\n\n /**\n * Returns a tracer from the global tracer provider.\n */\n public getTracer(name: string, version?: string): Tracer {\n return this.getTracerProvider().getTracer(name, version);\n }\n\n /** Remove the global tracer provider */\n public disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n this._proxyTracerProvider = new ProxyTracerProvider();\n }\n\n public wrapSpanContext = wrapSpanContext;\n\n public isSpanContextValid = isSpanContextValid;\n\n public deleteSpan = deleteSpan;\n\n public getSpan = getSpan;\n\n public getActiveSpan = getActiveSpan;\n\n public getSpanContext = getSpanContext;\n\n public setSpan = setSpan;\n\n public setSpanContext = setSpanContext;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/context-helpers.d.ts b/node_modules/@opentelemetry/api/build/esnext/baggage/context-helpers.d.ts deleted file mode 100644 index 39278cb..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/context-helpers.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { Context } from '../context/types'; -import type { Baggage } from './types'; -/** - * Retrieve the current baggage from the given context - * - * @param {Context} Context that manage all context values - * @returns {Baggage} Extracted baggage from the context - */ -export declare function getBaggage(context: Context): Baggage | undefined; -/** - * Retrieve the current baggage from the active/current context - * - * @returns {Baggage} Extracted baggage from the context - */ -export declare function getActiveBaggage(): Baggage | undefined; -/** - * Store a baggage in the given context - * - * @param {Context} Context that manage all context values - * @param {Baggage} baggage that will be set in the actual context - */ -export declare function setBaggage(context: Context, baggage: Baggage): Context; -/** - * Delete the baggage stored in the given context - * - * @param {Context} Context that manage all context values - */ -export declare function deleteBaggage(context: Context): Context; -//# sourceMappingURL=context-helpers.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/context-helpers.js b/node_modules/@opentelemetry/api/build/esnext/baggage/context-helpers.js deleted file mode 100644 index 739f2c7..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/context-helpers.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { ContextAPI } from '../api/context'; -import { createContextKey } from '../context/context'; -/** - * Baggage key - */ -const BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key'); -/** - * Retrieve the current baggage from the given context - * - * @param {Context} Context that manage all context values - * @returns {Baggage} Extracted baggage from the context - */ -export function getBaggage(context) { - return context.getValue(BAGGAGE_KEY) || undefined; -} -/** - * Retrieve the current baggage from the active/current context - * - * @returns {Baggage} Extracted baggage from the context - */ -export function getActiveBaggage() { - return getBaggage(ContextAPI.getInstance().active()); -} -/** - * Store a baggage in the given context - * - * @param {Context} Context that manage all context values - * @param {Baggage} baggage that will be set in the actual context - */ -export function setBaggage(context, baggage) { - return context.setValue(BAGGAGE_KEY, baggage); -} -/** - * Delete the baggage stored in the given context - * - * @param {Context} Context that manage all context values - */ -export function deleteBaggage(context) { - return context.deleteValue(BAGGAGE_KEY); -} -//# sourceMappingURL=context-helpers.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/context-helpers.js.map b/node_modules/@opentelemetry/api/build/esnext/baggage/context-helpers.js.map deleted file mode 100644 index ce5d7bb..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/context-helpers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context-helpers.js","sourceRoot":"","sources":["../../../src/baggage/context-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD;;GAEG;AACH,MAAM,WAAW,GAAG,gBAAgB,CAAC,2BAA2B,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAQ,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa,IAAI,SAAS,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AACvD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,OAAgB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ContextAPI } from '../api/context';\nimport { createContextKey } from '../context/context';\nimport type { Context } from '../context/types';\nimport type { Baggage } from './types';\n\n/**\n * Baggage key\n */\nconst BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');\n\n/**\n * Retrieve the current baggage from the given context\n *\n * @param {Context} Context that manage all context values\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getBaggage(context: Context): Baggage | undefined {\n return (context.getValue(BAGGAGE_KEY) as Baggage) || undefined;\n}\n\n/**\n * Retrieve the current baggage from the active/current context\n *\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getActiveBaggage(): Baggage | undefined {\n return getBaggage(ContextAPI.getInstance().active());\n}\n\n/**\n * Store a baggage in the given context\n *\n * @param {Context} Context that manage all context values\n * @param {Baggage} baggage that will be set in the actual context\n */\nexport function setBaggage(context: Context, baggage: Baggage): Context {\n return context.setValue(BAGGAGE_KEY, baggage);\n}\n\n/**\n * Delete the baggage stored in the given context\n *\n * @param {Context} Context that manage all context values\n */\nexport function deleteBaggage(context: Context): Context {\n return context.deleteValue(BAGGAGE_KEY);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/baggage-impl.d.ts b/node_modules/@opentelemetry/api/build/esnext/baggage/internal/baggage-impl.d.ts deleted file mode 100644 index e6b4554..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/baggage-impl.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Baggage, BaggageEntry } from '../types'; -export declare class BaggageImpl implements Baggage { - private _entries; - constructor(entries?: Map); - getEntry(key: string): BaggageEntry | undefined; - getAllEntries(): [string, BaggageEntry][]; - setEntry(key: string, entry: BaggageEntry): BaggageImpl; - removeEntry(key: string): BaggageImpl; - removeEntries(...keys: string[]): BaggageImpl; - clear(): BaggageImpl; -} -//# sourceMappingURL=baggage-impl.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/baggage-impl.js b/node_modules/@opentelemetry/api/build/esnext/baggage/internal/baggage-impl.js deleted file mode 100644 index 129a258..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/baggage-impl.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export class BaggageImpl { - constructor(entries) { - this._entries = entries ? new Map(entries) : new Map(); - } - getEntry(key) { - const entry = this._entries.get(key); - if (!entry) { - return undefined; - } - return Object.assign({}, entry); - } - getAllEntries() { - return Array.from(this._entries.entries()); - } - setEntry(key, entry) { - const newBaggage = new BaggageImpl(this._entries); - newBaggage._entries.set(key, entry); - return newBaggage; - } - removeEntry(key) { - const newBaggage = new BaggageImpl(this._entries); - newBaggage._entries.delete(key); - return newBaggage; - } - removeEntries(...keys) { - const newBaggage = new BaggageImpl(this._entries); - for (const key of keys) { - newBaggage._entries.delete(key); - } - return newBaggage; - } - clear() { - return new BaggageImpl(); - } -} -//# sourceMappingURL=baggage-impl.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/baggage-impl.js.map b/node_modules/@opentelemetry/api/build/esnext/baggage/internal/baggage-impl.js.map deleted file mode 100644 index eae0ece..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/baggage-impl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"baggage-impl.js","sourceRoot":"","sources":["../../../../src/baggage/internal/baggage-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,OAAO,WAAW;IAGtB,YAAY,OAAmC;QAC7C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IACzD,CAAC;IAED,QAAQ,CAAC,GAAW;QAClB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,aAAa;QACX,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAmB;QACvC,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACpC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,WAAW,CAAC,GAAW;QACrB,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,aAAa,CAAC,GAAG,IAAc;QAC7B,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACjC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Baggage, BaggageEntry } from '../types';\n\nexport class BaggageImpl implements Baggage {\n private _entries: Map;\n\n constructor(entries?: Map) {\n this._entries = entries ? new Map(entries) : new Map();\n }\n\n getEntry(key: string): BaggageEntry | undefined {\n const entry = this._entries.get(key);\n if (!entry) {\n return undefined;\n }\n\n return Object.assign({}, entry);\n }\n\n getAllEntries(): [string, BaggageEntry][] {\n return Array.from(this._entries.entries());\n }\n\n setEntry(key: string, entry: BaggageEntry): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.set(key, entry);\n return newBaggage;\n }\n\n removeEntry(key: string): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.delete(key);\n return newBaggage;\n }\n\n removeEntries(...keys: string[]): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n for (const key of keys) {\n newBaggage._entries.delete(key);\n }\n return newBaggage;\n }\n\n clear(): BaggageImpl {\n return new BaggageImpl();\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/symbol.d.ts b/node_modules/@opentelemetry/api/build/esnext/baggage/internal/symbol.d.ts deleted file mode 100644 index 9cd991c..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/symbol.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Symbol used to make BaggageEntryMetadata an opaque type - */ -export declare const baggageEntryMetadataSymbol: unique symbol; -//# sourceMappingURL=symbol.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/symbol.js b/node_modules/@opentelemetry/api/build/esnext/baggage/internal/symbol.js deleted file mode 100644 index 9aed0c9..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/symbol.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * Symbol used to make BaggageEntryMetadata an opaque type - */ -export const baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata'); -//# sourceMappingURL=symbol.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/symbol.js.map b/node_modules/@opentelemetry/api/build/esnext/baggage/internal/symbol.js.map deleted file mode 100644 index 62546b8..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/internal/symbol.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"symbol.js","sourceRoot":"","sources":["../../../../src/baggage/internal/symbol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Symbol used to make BaggageEntryMetadata an opaque type\n */\nexport const baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata');\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/types.d.ts b/node_modules/@opentelemetry/api/build/esnext/baggage/types.d.ts deleted file mode 100644 index 43eaa4a..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/types.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -import type { baggageEntryMetadataSymbol } from './internal/symbol'; -/** - * @since 1.0.0 - */ -export interface BaggageEntry { - /** `String` value of the `BaggageEntry`. */ - value: string; - /** - * Metadata is an optional string property defined by the W3C baggage specification. - * It currently has no special meaning defined by the specification. - */ - metadata?: BaggageEntryMetadata; -} -/** - * Serializable Metadata defined by the W3C baggage specification. - * It currently has no special meaning defined by the OpenTelemetry or W3C. - * - * @since 1.0.0 - */ -export type BaggageEntryMetadata = { - toString(): string; -} & { - __TYPE__: typeof baggageEntryMetadataSymbol; -}; -/** - * Baggage represents collection of key-value pairs with optional metadata. - * Each key of Baggage is associated with exactly one value. - * Baggage may be used to annotate and enrich telemetry data. - * - * @since 1.0.0 - */ -export interface Baggage { - /** - * Get an entry from Baggage if it exists - * - * @param key The key which identifies the BaggageEntry - */ - getEntry(key: string): BaggageEntry | undefined; - /** - * Get a list of all entries in the Baggage - */ - getAllEntries(): [string, BaggageEntry][]; - /** - * Returns a new baggage with the entries from the current bag and the specified entry - * - * @param key string which identifies the baggage entry - * @param entry BaggageEntry for the given key - */ - setEntry(key: string, entry: BaggageEntry): Baggage; - /** - * Returns a new baggage with the entries from the current bag except the removed entry - * - * @param key key identifying the entry to be removed - */ - removeEntry(key: string): Baggage; - /** - * Returns a new baggage with the entries from the current bag except the removed entries - * - * @param key keys identifying the entries to be removed - */ - removeEntries(...key: string[]): Baggage; - /** - * Returns a new baggage with no entries - */ - clear(): Baggage; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/types.js b/node_modules/@opentelemetry/api/build/esnext/baggage/types.js deleted file mode 100644 index 70b3a72..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/types.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/types.js.map b/node_modules/@opentelemetry/api/build/esnext/baggage/types.js.map deleted file mode 100644 index 84d490e..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/baggage/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { baggageEntryMetadataSymbol } from './internal/symbol';\n\n/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface BaggageEntry {\n /** `String` value of the `BaggageEntry`. */\n value: string;\n /**\n * Metadata is an optional string property defined by the W3C baggage specification.\n * It currently has no special meaning defined by the specification.\n */\n metadata?: BaggageEntryMetadata;\n}\n\n/**\n * Serializable Metadata defined by the W3C baggage specification.\n * It currently has no special meaning defined by the OpenTelemetry or W3C.\n *\n * @since 1.0.0\n */\nexport type BaggageEntryMetadata = { toString(): string } & {\n __TYPE__: typeof baggageEntryMetadataSymbol;\n};\n\n/**\n * Baggage represents collection of key-value pairs with optional metadata.\n * Each key of Baggage is associated with exactly one value.\n * Baggage may be used to annotate and enrich telemetry data.\n *\n * @since 1.0.0\n */\nexport interface Baggage {\n /**\n * Get an entry from Baggage if it exists\n *\n * @param key The key which identifies the BaggageEntry\n */\n getEntry(key: string): BaggageEntry | undefined;\n\n /**\n * Get a list of all entries in the Baggage\n */\n getAllEntries(): [string, BaggageEntry][];\n\n /**\n * Returns a new baggage with the entries from the current bag and the specified entry\n *\n * @param key string which identifies the baggage entry\n * @param entry BaggageEntry for the given key\n */\n setEntry(key: string, entry: BaggageEntry): Baggage;\n\n /**\n * Returns a new baggage with the entries from the current bag except the removed entry\n *\n * @param key key identifying the entry to be removed\n */\n removeEntry(key: string): Baggage;\n\n /**\n * Returns a new baggage with the entries from the current bag except the removed entries\n *\n * @param key keys identifying the entries to be removed\n */\n removeEntries(...key: string[]): Baggage;\n\n /**\n * Returns a new baggage with no entries\n */\n clear(): Baggage;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/utils.d.ts b/node_modules/@opentelemetry/api/build/esnext/baggage/utils.d.ts deleted file mode 100644 index c58ba53..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/utils.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { Baggage, BaggageEntry, BaggageEntryMetadata } from './types'; -/** - * Create a new Baggage with optional entries - * - * @param entries An array of baggage entries the new baggage should contain - */ -export declare function createBaggage(entries?: Record): Baggage; -/** - * Create a serializable BaggageEntryMetadata object from a string. - * - * @param str string metadata. Format is currently not defined by the spec and has no special meaning. - * - * @since 1.0.0 - */ -export declare function baggageEntryMetadataFromString(str: string): BaggageEntryMetadata; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/utils.js b/node_modules/@opentelemetry/api/build/esnext/baggage/utils.js deleted file mode 100644 index b57ff2b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/utils.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { DiagAPI } from '../api/diag'; -import { BaggageImpl } from './internal/baggage-impl'; -import { baggageEntryMetadataSymbol } from './internal/symbol'; -const diag = DiagAPI.instance(); -/** - * Create a new Baggage with optional entries - * - * @param entries An array of baggage entries the new baggage should contain - */ -export function createBaggage(entries = {}) { - return new BaggageImpl(new Map(Object.entries(entries))); -} -/** - * Create a serializable BaggageEntryMetadata object from a string. - * - * @param str string metadata. Format is currently not defined by the spec and has no special meaning. - * - * @since 1.0.0 - */ -export function baggageEntryMetadataFromString(str) { - if (typeof str !== 'string') { - diag.error(`Cannot create baggage metadata from unknown type: ${typeof str}`); - str = ''; - } - return { - __TYPE__: baggageEntryMetadataSymbol, - toString() { - return str; - }, - }; -} -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/baggage/utils.js.map b/node_modules/@opentelemetry/api/build/esnext/baggage/utils.js.map deleted file mode 100644 index 2232f2b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/baggage/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/baggage/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,UAAwC,EAAE;IAE1C,OAAO,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC5C,GAAW;IAEX,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,IAAI,CAAC,KAAK,CACR,qDAAqD,OAAO,GAAG,EAAE,CAClE,CAAC;QACF,GAAG,GAAG,EAAE,CAAC;KACV;IAED,OAAO;QACL,QAAQ,EAAE,0BAA0B;QACpC,QAAQ;YACN,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DiagAPI } from '../api/diag';\nimport { BaggageImpl } from './internal/baggage-impl';\nimport { baggageEntryMetadataSymbol } from './internal/symbol';\nimport type { Baggage, BaggageEntry, BaggageEntryMetadata } from './types';\n\nconst diag = DiagAPI.instance();\n\n/**\n * Create a new Baggage with optional entries\n *\n * @param entries An array of baggage entries the new baggage should contain\n */\nexport function createBaggage(\n entries: Record = {}\n): Baggage {\n return new BaggageImpl(new Map(Object.entries(entries)));\n}\n\n/**\n * Create a serializable BaggageEntryMetadata object from a string.\n *\n * @param str string metadata. Format is currently not defined by the spec and has no special meaning.\n *\n * @since 1.0.0\n */\nexport function baggageEntryMetadataFromString(\n str: string\n): BaggageEntryMetadata {\n if (typeof str !== 'string') {\n diag.error(\n `Cannot create baggage metadata from unknown type: ${typeof str}`\n );\n str = '';\n }\n\n return {\n __TYPE__: baggageEntryMetadataSymbol,\n toString() {\n return str;\n },\n };\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/common/Attributes.d.ts b/node_modules/@opentelemetry/api/build/esnext/common/Attributes.d.ts deleted file mode 100644 index 99a72b3..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/common/Attributes.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Attributes is a map from string to attribute values. - * - * Note: only the own enumerable keys are counted as valid attribute keys. - * - * @since 1.3.0 - */ -export interface Attributes { - [attributeKey: string]: AttributeValue | undefined; -} -/** - * Attribute values may be any non-nullish primitive value except an object. - * - * null or undefined attribute values are invalid and will result in undefined behavior. - * - * @since 1.3.0 - */ -export type AttributeValue = string | number | boolean | Array | Array | Array; -//# sourceMappingURL=Attributes.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/common/Attributes.js b/node_modules/@opentelemetry/api/build/esnext/common/Attributes.js deleted file mode 100644 index 4cf7a82..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/common/Attributes.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=Attributes.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/common/Attributes.js.map b/node_modules/@opentelemetry/api/build/esnext/common/Attributes.js.map deleted file mode 100644 index 1a23f4e..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/common/Attributes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Attributes.js","sourceRoot":"","sources":["../../../src/common/Attributes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Attributes is a map from string to attribute values.\n *\n * Note: only the own enumerable keys are counted as valid attribute keys.\n *\n * @since 1.3.0\n */\nexport interface Attributes {\n [attributeKey: string]: AttributeValue | undefined;\n}\n\n/**\n * Attribute values may be any non-nullish primitive value except an object.\n *\n * null or undefined attribute values are invalid and will result in undefined behavior.\n *\n * @since 1.3.0\n */\nexport type AttributeValue =\n | string\n | number\n | boolean\n | Array\n | Array\n | Array;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/common/Exception.d.ts b/node_modules/@opentelemetry/api/build/esnext/common/Exception.d.ts deleted file mode 100644 index 704fec1..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/common/Exception.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -interface ExceptionWithCode { - code: string | number; - name?: string; - message?: string; - stack?: string; -} -interface ExceptionWithMessage { - code?: string | number; - message: string; - name?: string; - stack?: string; -} -interface ExceptionWithName { - code?: string | number; - message?: string; - name: string; - stack?: string; -} -/** - * Defines Exception. - * - * string or an object with one of (message or name or code) and optional stack - * - * @since 1.0.0 - */ -export type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string; -export {}; -//# sourceMappingURL=Exception.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/common/Exception.js b/node_modules/@opentelemetry/api/build/esnext/common/Exception.js deleted file mode 100644 index 0a64e53..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/common/Exception.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=Exception.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/common/Exception.js.map b/node_modules/@opentelemetry/api/build/esnext/common/Exception.js.map deleted file mode 100644 index 83d006c..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/common/Exception.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/common/Exception.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\ninterface ExceptionWithCode {\n code: string | number;\n name?: string;\n message?: string;\n stack?: string;\n}\n\ninterface ExceptionWithMessage {\n code?: string | number;\n message: string;\n name?: string;\n stack?: string;\n}\n\ninterface ExceptionWithName {\n code?: string | number;\n message?: string;\n name: string;\n stack?: string;\n}\n\n/**\n * Defines Exception.\n *\n * string or an object with one of (message or name or code) and optional stack\n *\n * @since 1.0.0\n */\nexport type Exception =\n | ExceptionWithCode\n | ExceptionWithMessage\n | ExceptionWithName\n | string;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/common/Time.d.ts b/node_modules/@opentelemetry/api/build/esnext/common/Time.d.ts deleted file mode 100644 index 265d617..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/common/Time.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Defines High-Resolution Time. - * - * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970. - * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds. - * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150. - * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds: - * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210. - * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds: - * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000. - * This is represented in HrTime format as [1609504210, 150000000]. - * - * @since 1.0.0 - */ -export type HrTime = [number, number]; -/** - * Defines TimeInput. - * - * hrtime, epoch milliseconds, performance.now() or Date - * - * @since 1.0.0 - */ -export type TimeInput = HrTime | number | Date; -//# sourceMappingURL=Time.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/common/Time.js b/node_modules/@opentelemetry/api/build/esnext/common/Time.js deleted file mode 100644 index 2abdf58..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/common/Time.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=Time.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/common/Time.js.map b/node_modules/@opentelemetry/api/build/esnext/common/Time.js.map deleted file mode 100644 index 77ac321..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/common/Time.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../src/common/Time.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Defines High-Resolution Time.\n *\n * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.\n * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.\n * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.\n * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:\n * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.\n * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:\n * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.\n * This is represented in HrTime format as [1609504210, 150000000].\n *\n * @since 1.0.0\n */\nexport type HrTime = [number, number];\n\n/**\n * Defines TimeInput.\n *\n * hrtime, epoch milliseconds, performance.now() or Date\n *\n * @since 1.0.0\n */\nexport type TimeInput = HrTime | number | Date;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context-api.d.ts b/node_modules/@opentelemetry/api/build/esnext/context-api.d.ts deleted file mode 100644 index b842571..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context-api.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ContextAPI } from './api/context'; -/** - * Entrypoint for context API - * @since 1.0.0 - */ -export declare const context: ContextAPI; -//# sourceMappingURL=context-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context-api.js b/node_modules/@opentelemetry/api/build/esnext/context-api.js deleted file mode 100644 index 24d4373..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context-api.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { ContextAPI } from './api/context'; -/** - * Entrypoint for context API - * @since 1.0.0 - */ -export const context = ContextAPI.getInstance(); -//# sourceMappingURL=context-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context-api.js.map b/node_modules/@opentelemetry/api/build/esnext/context-api.js.map deleted file mode 100644 index 125de4c..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context-api.js","sourceRoot":"","sources":["../../src/context-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { ContextAPI } from './api/context';\n/**\n * Entrypoint for context API\n * @since 1.0.0\n */\nexport const context = ContextAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context/NoopContextManager.d.ts b/node_modules/@opentelemetry/api/build/esnext/context/NoopContextManager.d.ts deleted file mode 100644 index d3599db..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context/NoopContextManager.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type * as types from './types'; -export declare class NoopContextManager implements types.ContextManager { - active(): types.Context; - with ReturnType>(_context: types.Context, fn: F, thisArg?: ThisParameterType, ...args: A): ReturnType; - bind(_context: types.Context, target: T): T; - enable(): this; - disable(): this; -} -//# sourceMappingURL=NoopContextManager.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context/NoopContextManager.js b/node_modules/@opentelemetry/api/build/esnext/context/NoopContextManager.js deleted file mode 100644 index 40752d5..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context/NoopContextManager.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { ROOT_CONTEXT } from './context'; -export class NoopContextManager { - active() { - return ROOT_CONTEXT; - } - with(_context, fn, thisArg, ...args) { - return fn.call(thisArg, ...args); - } - bind(_context, target) { - return target; - } - enable() { - return this; - } - disable() { - return this; - } -} -//# sourceMappingURL=NoopContextManager.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context/NoopContextManager.js.map b/node_modules/@opentelemetry/api/build/esnext/context/NoopContextManager.js.map deleted file mode 100644 index 9a52705..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context/NoopContextManager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopContextManager.js","sourceRoot":"","sources":["../../../src/context/NoopContextManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,OAAO,kBAAkB;IAC7B,MAAM;QACJ,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,IAAI,CACF,QAAuB,EACvB,EAAK,EACL,OAA8B,EAC9B,GAAG,IAAO;QAEV,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,CAAI,QAAuB,EAAE,MAAS;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ROOT_CONTEXT } from './context';\nimport type * as types from './types';\n\nexport class NoopContextManager implements types.ContextManager {\n active(): types.Context {\n return ROOT_CONTEXT;\n }\n\n with ReturnType>(\n _context: types.Context,\n fn: F,\n thisArg?: ThisParameterType,\n ...args: A\n ): ReturnType {\n return fn.call(thisArg, ...args);\n }\n\n bind(_context: types.Context, target: T): T {\n return target;\n }\n\n enable(): this {\n return this;\n }\n\n disable(): this {\n return this;\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context/context.d.ts b/node_modules/@opentelemetry/api/build/esnext/context/context.d.ts deleted file mode 100644 index 8d0aa04..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context/context.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Context } from './types'; -/** - * Get a key to uniquely identify a context value - * - * @since 1.0.0 - */ -export declare function createContextKey(description: string): symbol; -/** - * The root context is used as the default parent context when there is no active context - * - * @since 1.0.0 - */ -export declare const ROOT_CONTEXT: Context; -//# sourceMappingURL=context.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context/context.js b/node_modules/@opentelemetry/api/build/esnext/context/context.js deleted file mode 100644 index 79cf0e9..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context/context.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * Get a key to uniquely identify a context value - * - * @since 1.0.0 - */ -export function createContextKey(description) { - // The specification states that for the same input, multiple calls should - // return different keys. Due to the nature of the JS dependency management - // system, this creates problems where multiple versions of some package - // could hold different keys for the same property. - // - // Therefore, we use Symbol.for which returns the same key for the same input. - return Symbol.for(description); -} -class BaseContext { - /** - * Construct a new context which inherits values from an optional parent context. - * - * @param parentContext a context from which to inherit values - */ - constructor(parentContext) { - // for minification - const self = this; - self._currentContext = parentContext ? new Map(parentContext) : new Map(); - self.getValue = (key) => self._currentContext.get(key); - self.setValue = (key, value) => { - const context = new BaseContext(self._currentContext); - context._currentContext.set(key, value); - return context; - }; - self.deleteValue = (key) => { - const context = new BaseContext(self._currentContext); - context._currentContext.delete(key); - return context; - }; - } -} -/** - * The root context is used as the default parent context when there is no active context - * - * @since 1.0.0 - */ -export const ROOT_CONTEXT = new BaseContext(); -//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context/context.js.map b/node_modules/@opentelemetry/api/build/esnext/context/context.js.map deleted file mode 100644 index b13abfb..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context/context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/context/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,0EAA0E;IAC1E,2EAA2E;IAC3E,wEAAwE;IACxE,mDAAmD;IACnD,EAAE;IACF,8EAA8E;IAC9E,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,WAAW;IAGf;;;;OAIG;IACH,YAAY,aAAoC;QAC9C,mBAAmB;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;QAE1E,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE/D,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAW,EAAE,KAAc,EAAW,EAAE;YACvD,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtD,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACxC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,CAAC,GAAW,EAAW,EAAE;YAC1C,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtD,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACpC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;CAyBF;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAY,IAAI,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from './types';\n\n/**\n * Get a key to uniquely identify a context value\n *\n * @since 1.0.0\n */\nexport function createContextKey(description: string) {\n // The specification states that for the same input, multiple calls should\n // return different keys. Due to the nature of the JS dependency management\n // system, this creates problems where multiple versions of some package\n // could hold different keys for the same property.\n //\n // Therefore, we use Symbol.for which returns the same key for the same input.\n return Symbol.for(description);\n}\n\nclass BaseContext implements Context {\n private _currentContext!: Map;\n\n /**\n * Construct a new context which inherits values from an optional parent context.\n *\n * @param parentContext a context from which to inherit values\n */\n constructor(parentContext?: Map) {\n // for minification\n const self = this;\n\n self._currentContext = parentContext ? new Map(parentContext) : new Map();\n\n self.getValue = (key: symbol) => self._currentContext.get(key);\n\n self.setValue = (key: symbol, value: unknown): Context => {\n const context = new BaseContext(self._currentContext);\n context._currentContext.set(key, value);\n return context;\n };\n\n self.deleteValue = (key: symbol): Context => {\n const context = new BaseContext(self._currentContext);\n context._currentContext.delete(key);\n return context;\n };\n }\n\n /**\n * Get a value from the context.\n *\n * @param key key which identifies a context value\n */\n public getValue!: (key: symbol) => unknown;\n\n /**\n * Create a new context which inherits from this context and has\n * the given key set to the given value.\n *\n * @param key context key for which to set the value\n * @param value value to set for the given key\n */\n public setValue!: (key: symbol, value: unknown) => Context;\n\n /**\n * Return a new context which inherits from this context but does\n * not contain a value for the given key.\n *\n * @param key context key for which to clear a value\n */\n public deleteValue!: (key: symbol) => Context;\n}\n\n/**\n * The root context is used as the default parent context when there is no active context\n *\n * @since 1.0.0\n */\nexport const ROOT_CONTEXT: Context = new BaseContext();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context/types.d.ts b/node_modules/@opentelemetry/api/build/esnext/context/types.d.ts deleted file mode 100644 index 3c1f7a5..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context/types.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @since 1.0.0 - */ -export interface Context { - /** - * Get a value from the context. - * - * @param key key which identifies a context value - */ - getValue(key: symbol): unknown; - /** - * Create a new context which inherits from this context and has - * the given key set to the given value. - * - * @param key context key for which to set the value - * @param value value to set for the given key - */ - setValue(key: symbol, value: unknown): Context; - /** - * Return a new context which inherits from this context but does - * not contain a value for the given key. - * - * @param key context key for which to clear a value - */ - deleteValue(key: symbol): Context; -} -/** - * @since 1.0.0 - */ -export interface ContextManager { - /** - * Get the current active context - */ - active(): Context; - /** - * Run the fn callback with object set as the current active context - * @param context Any object to set as the current active context - * @param fn A callback to be immediately run within a specific context - * @param thisArg optional receiver to be used for calling fn - * @param args optional arguments forwarded to fn - */ - with ReturnType>(context: Context, fn: F, thisArg?: ThisParameterType, ...args: A): ReturnType; - /** - * Bind an object as the current context (or a specific one) - * @param [context] Optionally specify the context which you want to assign - * @param target Any object to which a context need to be set - */ - bind(context: Context, target: T): T; - /** - * Enable context management - */ - enable(): this; - /** - * Disable context management - */ - disable(): this; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context/types.js b/node_modules/@opentelemetry/api/build/esnext/context/types.js deleted file mode 100644 index 70b3a72..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context/types.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/context/types.js.map b/node_modules/@opentelemetry/api/build/esnext/context/types.js.map deleted file mode 100644 index 0d7fd83..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/context/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/context/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface Context {\n /**\n * Get a value from the context.\n *\n * @param key key which identifies a context value\n */\n getValue(key: symbol): unknown;\n\n /**\n * Create a new context which inherits from this context and has\n * the given key set to the given value.\n *\n * @param key context key for which to set the value\n * @param value value to set for the given key\n */\n setValue(key: symbol, value: unknown): Context;\n\n /**\n * Return a new context which inherits from this context but does\n * not contain a value for the given key.\n *\n * @param key context key for which to clear a value\n */\n deleteValue(key: symbol): Context;\n}\n\n/**\n * @since 1.0.0\n */\nexport interface ContextManager {\n /**\n * Get the current active context\n */\n active(): Context;\n\n /**\n * Run the fn callback with object set as the current active context\n * @param context Any object to set as the current active context\n * @param fn A callback to be immediately run within a specific context\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n with ReturnType>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType,\n ...args: A\n ): ReturnType;\n\n /**\n * Bind an object as the current context (or a specific one)\n * @param [context] Optionally specify the context which you want to assign\n * @param target Any object to which a context need to be set\n */\n bind(context: Context, target: T): T;\n\n /**\n * Enable context management\n */\n enable(): this;\n\n /**\n * Disable context management\n */\n disable(): this;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag-api.d.ts b/node_modules/@opentelemetry/api/build/esnext/diag-api.d.ts deleted file mode 100644 index ae1045b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag-api.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { DiagAPI } from './api/diag'; -/** - * Entrypoint for Diag API. - * Defines Diagnostic handler used for internal diagnostic logging operations. - * The default provides a Noop DiagLogger implementation which may be changed via the - * diag.setLogger(logger: DiagLogger) function. - * - * @since 1.0.0 - */ -export declare const diag: DiagAPI; -//# sourceMappingURL=diag-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag-api.js b/node_modules/@opentelemetry/api/build/esnext/diag-api.js deleted file mode 100644 index f3e1907..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag-api.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { DiagAPI } from './api/diag'; -/** - * Entrypoint for Diag API. - * Defines Diagnostic handler used for internal diagnostic logging operations. - * The default provides a Noop DiagLogger implementation which may be changed via the - * diag.setLogger(logger: DiagLogger) function. - * - * @since 1.0.0 - */ -export const diag = DiagAPI.instance(); -//# sourceMappingURL=diag-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag-api.js.map b/node_modules/@opentelemetry/api/build/esnext/diag-api.js.map deleted file mode 100644 index 5412485..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diag-api.js","sourceRoot":"","sources":["../../src/diag-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { DiagAPI } from './api/diag';\n/**\n * Entrypoint for Diag API.\n * Defines Diagnostic handler used for internal diagnostic logging operations.\n * The default provides a Noop DiagLogger implementation which may be changed via the\n * diag.setLogger(logger: DiagLogger) function.\n *\n * @since 1.0.0\n */\nexport const diag = DiagAPI.instance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/ComponentLogger.d.ts b/node_modules/@opentelemetry/api/build/esnext/diag/ComponentLogger.d.ts deleted file mode 100644 index 76e2f56..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/ComponentLogger.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { ComponentLoggerOptions, DiagLogger } from './types'; -/** - * Component Logger which is meant to be used as part of any component which - * will add automatically additional namespace in front of the log message. - * It will then forward all message to global diag logger - * @example - * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' }); - * cLogger.debug('test'); - * // @opentelemetry/instrumentation-http test - */ -export declare class DiagComponentLogger implements DiagLogger { - private _namespace; - constructor(props: ComponentLoggerOptions); - debug(...args: unknown[]): void; - error(...args: unknown[]): void; - info(...args: unknown[]): void; - warn(...args: unknown[]): void; - verbose(...args: unknown[]): void; -} -//# sourceMappingURL=ComponentLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/ComponentLogger.js b/node_modules/@opentelemetry/api/build/esnext/diag/ComponentLogger.js deleted file mode 100644 index d442e7f..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/ComponentLogger.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { getGlobal } from '../internal/global-utils'; -/** - * Component Logger which is meant to be used as part of any component which - * will add automatically additional namespace in front of the log message. - * It will then forward all message to global diag logger - * @example - * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' }); - * cLogger.debug('test'); - * // @opentelemetry/instrumentation-http test - */ -export class DiagComponentLogger { - constructor(props) { - this._namespace = props.namespace || 'DiagComponentLogger'; - } - debug(...args) { - return logProxy('debug', this._namespace, args); - } - error(...args) { - return logProxy('error', this._namespace, args); - } - info(...args) { - return logProxy('info', this._namespace, args); - } - warn(...args) { - return logProxy('warn', this._namespace, args); - } - verbose(...args) { - return logProxy('verbose', this._namespace, args); - } -} -function logProxy(funcName, namespace, args) { - const logger = getGlobal('diag'); - // shortcut if logger not set - if (!logger) { - return; - } - return logger[funcName](namespace, ...args); -} -//# sourceMappingURL=ComponentLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/ComponentLogger.js.map b/node_modules/@opentelemetry/api/build/esnext/diag/ComponentLogger.js.map deleted file mode 100644 index aa86d30..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/ComponentLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ComponentLogger.js","sourceRoot":"","sources":["../../../src/diag/ComponentLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGrD;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IAG9B,YAAY,KAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,IAAI,qBAAqB,CAAC;IAC7D,CAAC;IAEM,KAAK,CAAC,GAAG,IAAe;QAC7B,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,GAAG,IAAe;QAC7B,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAe;QAC5B,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAe;QAC5B,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,OAAO,CAAC,GAAG,IAAe;QAC/B,OAAO,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF;AAED,SAAS,QAAQ,CACf,QAA0B,EAC1B,SAAiB,EACjB,IAAe;IAEf,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,6BAA6B;IAC7B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IAED,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { getGlobal } from '../internal/global-utils';\nimport type { ComponentLoggerOptions, DiagLogger } from './types';\n\n/**\n * Component Logger which is meant to be used as part of any component which\n * will add automatically additional namespace in front of the log message.\n * It will then forward all message to global diag logger\n * @example\n * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });\n * cLogger.debug('test');\n * // @opentelemetry/instrumentation-http test\n */\nexport class DiagComponentLogger implements DiagLogger {\n private _namespace: string;\n\n constructor(props: ComponentLoggerOptions) {\n this._namespace = props.namespace || 'DiagComponentLogger';\n }\n\n public debug(...args: unknown[]): void {\n return logProxy('debug', this._namespace, args);\n }\n\n public error(...args: unknown[]): void {\n return logProxy('error', this._namespace, args);\n }\n\n public info(...args: unknown[]): void {\n return logProxy('info', this._namespace, args);\n }\n\n public warn(...args: unknown[]): void {\n return logProxy('warn', this._namespace, args);\n }\n\n public verbose(...args: unknown[]): void {\n return logProxy('verbose', this._namespace, args);\n }\n}\n\nfunction logProxy(\n funcName: keyof DiagLogger,\n namespace: string,\n args: unknown[]\n): void {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) {\n return;\n }\n\n return logger[funcName](namespace, ...args);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/consoleLogger.d.ts b/node_modules/@opentelemetry/api/build/esnext/diag/consoleLogger.d.ts deleted file mode 100644 index 8bae476..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/consoleLogger.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { DiagLogger, DiagLogFunction } from './types'; -type ConsoleMapKeys = 'error' | 'warn' | 'info' | 'debug' | 'trace'; -export declare const _originalConsoleMethods: Partial>; -/** - * A simple Immutable Console based diagnostic logger which will output any messages to the Console. - * If you want to limit the amount of logging to a specific level or lower use the - * {@link createLogLevelDiagLogger} - * - * @since 1.0.0 - */ -export declare class DiagConsoleLogger implements DiagLogger { - constructor(); - /** Log an error scenario that was not expected and caused the requested operation to fail. */ - error: DiagLogFunction; - /** - * Log a warning scenario to inform the developer of an issues that should be investigated. - * The requested operation may or may not have succeeded or completed. - */ - warn: DiagLogFunction; - /** - * Log a general informational message, this should not affect functionality. - * This is also the default logging level so this should NOT be used for logging - * debugging level information. - */ - info: DiagLogFunction; - /** - * Log a general debug message that can be useful for identifying a failure. - * Information logged at this level may include diagnostic details that would - * help identify a failure scenario. Useful scenarios would be to log the execution - * order of async operations - */ - debug: DiagLogFunction; - /** - * Log a detailed (verbose) trace level logging that can be used to identify failures - * where debug level logging would be insufficient, this level of tracing can include - * input and output parameters and as such may include PII information passing through - * the API. As such it is recommended that this level of tracing should not be enabled - * in a production environment. - */ - verbose: DiagLogFunction; -} -export {}; -//# sourceMappingURL=consoleLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/consoleLogger.js b/node_modules/@opentelemetry/api/build/esnext/diag/consoleLogger.js deleted file mode 100644 index c1a341b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/consoleLogger.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -const consoleMap = [ - { n: 'error', c: 'error' }, - { n: 'warn', c: 'warn' }, - { n: 'info', c: 'info' }, - { n: 'debug', c: 'debug' }, - { n: 'verbose', c: 'trace' }, -]; -// Save original console methods at module load time, before any instrumentation -// can wrap them. This ensures DiagConsoleLogger calls the unwrapped originals. -// Exported for testing only — not part of the public API. -export const _originalConsoleMethods = {}; -if (typeof console !== 'undefined') { - const keys = [ - 'error', - 'warn', - 'info', - 'debug', - 'trace', - 'log', - ]; - for (const key of keys) { - // eslint-disable-next-line no-console - if (typeof console[key] === 'function') { - // eslint-disable-next-line no-console - _originalConsoleMethods[key] = console[key]; - } - } -} -/** - * A simple Immutable Console based diagnostic logger which will output any messages to the Console. - * If you want to limit the amount of logging to a specific level or lower use the - * {@link createLogLevelDiagLogger} - * - * @since 1.0.0 - */ -export class DiagConsoleLogger { - constructor() { - function _consoleFunc(funcName) { - return function (...args) { - // Prefer original (pre-instrumentation) methods saved at module load time. - let theFunc = _originalConsoleMethods[funcName]; - // Some environments only expose the console when the F12 developer console is open - if (typeof theFunc !== 'function') { - theFunc = _originalConsoleMethods['log']; - } - // Fall back in case console was not available at module load time but became available later. - if (typeof theFunc !== 'function' && console) { - // eslint-disable-next-line no-console - theFunc = console[funcName]; - if (typeof theFunc !== 'function') { - // eslint-disable-next-line no-console - theFunc = console.log; - } - } - if (typeof theFunc === 'function') { - return theFunc.apply(console, args); - } - }; - } - for (let i = 0; i < consoleMap.length; i++) { - this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c); - } - } -} -//# sourceMappingURL=consoleLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/consoleLogger.js.map b/node_modules/@opentelemetry/api/build/esnext/diag/consoleLogger.js.map deleted file mode 100644 index bbf5739..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/consoleLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"consoleLogger.js","sourceRoot":"","sources":["../../../src/diag/consoleLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,UAAU,GAAiD;IAC/D,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACxB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACxB,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1B,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE;CAC7B,CAAC;AAEF,gFAAgF;AAChF,+EAA+E;AAC/E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAEhC,EAAE,CAAC;AACP,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;IAClC,MAAM,IAAI,GAA+B;QACvC,OAAO;QACP,MAAM;QACN,MAAM;QACN,OAAO;QACP,OAAO;QACP,KAAK;KACN,CAAC;IACF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,sCAAsC;QACtC,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,UAAU,EAAE;YACtC,sCAAsC;YACtC,uBAAuB,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;SAC7C;KACF;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,iBAAiB;IAC5B;QACE,SAAS,YAAY,CAAC,QAAwB;YAC5C,OAAO,UAAU,GAAG,IAAI;gBACtB,2EAA2E;gBAC3E,IAAI,OAAO,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;gBAChD,mFAAmF;gBACnF,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;oBACjC,OAAO,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;iBAC1C;gBACD,8FAA8F;gBAC9F,IAAI,OAAO,OAAO,KAAK,UAAU,IAAI,OAAO,EAAE;oBAC5C,sCAAsC;oBACtC,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAC5B,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;wBACjC,sCAAsC;wBACtC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;qBACvB;iBACF;gBACD,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;oBACjC,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;iBACrC;YACH,CAAC,CAAC;QACJ,CAAC;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvD;IACH,CAAC;CAkCF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DiagLogger, DiagLogFunction } from './types';\n\ntype ConsoleMapKeys = 'error' | 'warn' | 'info' | 'debug' | 'trace';\nconst consoleMap: { n: keyof DiagLogger; c: ConsoleMapKeys }[] = [\n { n: 'error', c: 'error' },\n { n: 'warn', c: 'warn' },\n { n: 'info', c: 'info' },\n { n: 'debug', c: 'debug' },\n { n: 'verbose', c: 'trace' },\n];\n\n// Save original console methods at module load time, before any instrumentation\n// can wrap them. This ensures DiagConsoleLogger calls the unwrapped originals.\n// Exported for testing only — not part of the public API.\nexport const _originalConsoleMethods: Partial<\n Record\n> = {};\nif (typeof console !== 'undefined') {\n const keys: (ConsoleMapKeys | 'log')[] = [\n 'error',\n 'warn',\n 'info',\n 'debug',\n 'trace',\n 'log',\n ];\n for (const key of keys) {\n // eslint-disable-next-line no-console\n if (typeof console[key] === 'function') {\n // eslint-disable-next-line no-console\n _originalConsoleMethods[key] = console[key];\n }\n }\n}\n\n/**\n * A simple Immutable Console based diagnostic logger which will output any messages to the Console.\n * If you want to limit the amount of logging to a specific level or lower use the\n * {@link createLogLevelDiagLogger}\n *\n * @since 1.0.0\n */\nexport class DiagConsoleLogger implements DiagLogger {\n constructor() {\n function _consoleFunc(funcName: ConsoleMapKeys): DiagLogFunction {\n return function (...args) {\n // Prefer original (pre-instrumentation) methods saved at module load time.\n let theFunc = _originalConsoleMethods[funcName];\n // Some environments only expose the console when the F12 developer console is open\n if (typeof theFunc !== 'function') {\n theFunc = _originalConsoleMethods['log'];\n }\n // Fall back in case console was not available at module load time but became available later.\n if (typeof theFunc !== 'function' && console) {\n // eslint-disable-next-line no-console\n theFunc = console[funcName];\n if (typeof theFunc !== 'function') {\n // eslint-disable-next-line no-console\n theFunc = console.log;\n }\n }\n if (typeof theFunc === 'function') {\n return theFunc.apply(console, args);\n }\n };\n }\n\n for (let i = 0; i < consoleMap.length; i++) {\n this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);\n }\n }\n\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n public error!: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n public warn!: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n public info!: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario. Useful scenarios would be to log the execution\n * order of async operations\n */\n public debug!: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n public verbose!: DiagLogFunction;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/internal/logLevelLogger.d.ts b/node_modules/@opentelemetry/api/build/esnext/diag/internal/logLevelLogger.d.ts deleted file mode 100644 index b85ee88..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/internal/logLevelLogger.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { DiagLogger } from '../types'; -import { DiagLogLevel } from '../types'; -export declare function createLogLevelDiagLogger(maxLevel: DiagLogLevel, logger: DiagLogger): DiagLogger; -//# sourceMappingURL=logLevelLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/internal/logLevelLogger.js b/node_modules/@opentelemetry/api/build/esnext/diag/internal/logLevelLogger.js deleted file mode 100644 index 7ab05fe..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/internal/logLevelLogger.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { DiagLogLevel } from '../types'; -export function createLogLevelDiagLogger(maxLevel, logger) { - if (maxLevel < DiagLogLevel.NONE) { - maxLevel = DiagLogLevel.NONE; - } - else if (maxLevel > DiagLogLevel.ALL) { - maxLevel = DiagLogLevel.ALL; - } - // In case the logger is null or undefined - logger = logger || {}; - function _filterFunc(funcName, theLevel) { - const theFunc = logger[funcName]; - if (typeof theFunc === 'function' && maxLevel >= theLevel) { - return theFunc.bind(logger); - } - return function () { }; - } - return { - error: _filterFunc('error', DiagLogLevel.ERROR), - warn: _filterFunc('warn', DiagLogLevel.WARN), - info: _filterFunc('info', DiagLogLevel.INFO), - debug: _filterFunc('debug', DiagLogLevel.DEBUG), - verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE), - }; -} -//# sourceMappingURL=logLevelLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/internal/logLevelLogger.js.map b/node_modules/@opentelemetry/api/build/esnext/diag/internal/logLevelLogger.js.map deleted file mode 100644 index b8c8c49..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/internal/logLevelLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logLevelLogger.js","sourceRoot":"","sources":["../../../../src/diag/internal/logLevelLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,UAAU,wBAAwB,CACtC,QAAsB,EACtB,MAAkB;IAElB,IAAI,QAAQ,GAAG,YAAY,CAAC,IAAI,EAAE;QAChC,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC;KAC9B;SAAM,IAAI,QAAQ,GAAG,YAAY,CAAC,GAAG,EAAE;QACtC,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC;KAC7B;IAED,0CAA0C;IAC1C,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAEtB,SAAS,WAAW,CAClB,QAA0B,EAC1B,QAAsB;QAEtB,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEjC,IAAI,OAAO,OAAO,KAAK,UAAU,IAAI,QAAQ,IAAI,QAAQ,EAAE;YACzD,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,cAAa,CAAC,CAAC;IACxB,CAAC;IAED,OAAO;QACL,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;QAC/C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;QAC5C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;QAC5C,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;QAC/C,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DiagLogFunction, DiagLogger } from '../types';\nimport { DiagLogLevel } from '../types';\n\nexport function createLogLevelDiagLogger(\n maxLevel: DiagLogLevel,\n logger: DiagLogger\n): DiagLogger {\n if (maxLevel < DiagLogLevel.NONE) {\n maxLevel = DiagLogLevel.NONE;\n } else if (maxLevel > DiagLogLevel.ALL) {\n maxLevel = DiagLogLevel.ALL;\n }\n\n // In case the logger is null or undefined\n logger = logger || {};\n\n function _filterFunc(\n funcName: keyof DiagLogger,\n theLevel: DiagLogLevel\n ): DiagLogFunction {\n const theFunc = logger[funcName];\n\n if (typeof theFunc === 'function' && maxLevel >= theLevel) {\n return theFunc.bind(logger);\n }\n return function () {};\n }\n\n return {\n error: _filterFunc('error', DiagLogLevel.ERROR),\n warn: _filterFunc('warn', DiagLogLevel.WARN),\n info: _filterFunc('info', DiagLogLevel.INFO),\n debug: _filterFunc('debug', DiagLogLevel.DEBUG),\n verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE),\n };\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/internal/noopLogger.d.ts b/node_modules/@opentelemetry/api/build/esnext/diag/internal/noopLogger.d.ts deleted file mode 100644 index f4d02f5..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/internal/noopLogger.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { DiagLogger } from '../types'; -/** - * Returns a No-Op Diagnostic logger where all messages do nothing. - * @implements {@link DiagLogger} - * @returns {DiagLogger} - */ -export declare function createNoopDiagLogger(): DiagLogger; -//# sourceMappingURL=noopLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/internal/noopLogger.js b/node_modules/@opentelemetry/api/build/esnext/diag/internal/noopLogger.js deleted file mode 100644 index ab739d5..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/internal/noopLogger.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -function noopLogFunction() { } -/** - * Returns a No-Op Diagnostic logger where all messages do nothing. - * @implements {@link DiagLogger} - * @returns {DiagLogger} - */ -export function createNoopDiagLogger() { - return { - verbose: noopLogFunction, - debug: noopLogFunction, - info: noopLogFunction, - warn: noopLogFunction, - error: noopLogFunction, - }; -} -//# sourceMappingURL=noopLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/internal/noopLogger.js.map b/node_modules/@opentelemetry/api/build/esnext/diag/internal/noopLogger.js.map deleted file mode 100644 index 9b4866b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/internal/noopLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"noopLogger.js","sourceRoot":"","sources":["../../../../src/diag/internal/noopLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,SAAS,eAAe,KAAI,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,eAAe;KACvB,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DiagLogger } from '../types';\n\nfunction noopLogFunction() {}\n\n/**\n * Returns a No-Op Diagnostic logger where all messages do nothing.\n * @implements {@link DiagLogger}\n * @returns {DiagLogger}\n */\nexport function createNoopDiagLogger(): DiagLogger {\n return {\n verbose: noopLogFunction,\n debug: noopLogFunction,\n info: noopLogFunction,\n warn: noopLogFunction,\n error: noopLogFunction,\n };\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/types.d.ts b/node_modules/@opentelemetry/api/build/esnext/diag/types.d.ts deleted file mode 100644 index 64950a7..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/types.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @since 1.0.0 - */ -export type DiagLogFunction = (message: string, ...args: unknown[]) => void; -/** - * Defines an internal diagnostic logger interface which is used to log internal diagnostic - * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function. - * API provided implementations include :- - * - a No-Op {@link createNoopDiagLogger} - * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger} - * - a general Console {@link DiagConsoleLogger} version. - * - * @since 1.0.0 - */ -export interface DiagLogger { - /** Log an error scenario that was not expected and caused the requested operation to fail. */ - error: DiagLogFunction; - /** - * Log a warning scenario to inform the developer of an issues that should be investigated. - * The requested operation may or may not have succeeded or completed. - */ - warn: DiagLogFunction; - /** - * Log a general informational message, this should not affect functionality. - * This is also the default logging level so this should NOT be used for logging - * debugging level information. - */ - info: DiagLogFunction; - /** - * Log a general debug message that can be useful for identifying a failure. - * Information logged at this level may include diagnostic details that would - * help identify a failure scenario. - * For example: Logging the order of execution of async operations. - */ - debug: DiagLogFunction; - /** - * Log a detailed (verbose) trace level logging that can be used to identify failures - * where debug level logging would be insufficient, this level of tracing can include - * input and output parameters and as such may include PII information passing through - * the API. As such it is recommended that this level of tracing should not be enabled - * in a production environment. - */ - verbose: DiagLogFunction; -} -/** - * Defines the available internal logging levels for the diagnostic logger, the numeric values - * of the levels are defined to match the original values from the initial LogLevel to avoid - * compatibility/migration issues for any implementation that assume the numeric ordering. - */ -export declare enum DiagLogLevel { - /** Diagnostic Logging level setting to disable all logging (except and forced logs) */ - NONE = 0, - /** Identifies an error scenario */ - ERROR = 30, - /** Identifies a warning scenario */ - WARN = 50, - /** General informational log message */ - INFO = 60, - /** General debug log message */ - DEBUG = 70, - /** - * Detailed trace level logging should only be used for development, should only be set - * in a development environment. - */ - VERBOSE = 80, - /** Used to set the logging level to include all logging */ - ALL = 9999 -} -/** - * Defines options for ComponentLogger - * - * @since 1.0.0 - */ -export interface ComponentLoggerOptions { - namespace: string; -} -/** - * @since 1.4.1 - */ -export interface DiagLoggerOptions { - /** - * The {@link DiagLogLevel} used to filter logs sent to the logger. - * - * @defaultValue DiagLogLevel.INFO - */ - logLevel?: DiagLogLevel; - /** - * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered. - */ - suppressOverrideMessage?: boolean; -} -export interface DiagLoggerApi { - /** - * Set the global DiagLogger and DiagLogLevel. - * If a global diag logger is already set, this will override it. - * - * @param logger - The {@link DiagLogger} instance to set as the default logger. - * @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set. - * @returns `true` if the logger was successfully registered, else `false` - */ - setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean; - /** - * - * @param logger - The {@link DiagLogger} instance to set as the default logger. - * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}. - * @returns `true` if the logger was successfully registered, else `false` - */ - setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/types.js b/node_modules/@opentelemetry/api/build/esnext/diag/types.js deleted file mode 100644 index 3fc610a..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/types.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * Defines the available internal logging levels for the diagnostic logger, the numeric values - * of the levels are defined to match the original values from the initial LogLevel to avoid - * compatibility/migration issues for any implementation that assume the numeric ordering. - */ -export var DiagLogLevel; -(function (DiagLogLevel) { - /** Diagnostic Logging level setting to disable all logging (except and forced logs) */ - DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE"; - /** Identifies an error scenario */ - DiagLogLevel[DiagLogLevel["ERROR"] = 30] = "ERROR"; - /** Identifies a warning scenario */ - DiagLogLevel[DiagLogLevel["WARN"] = 50] = "WARN"; - /** General informational log message */ - DiagLogLevel[DiagLogLevel["INFO"] = 60] = "INFO"; - /** General debug log message */ - DiagLogLevel[DiagLogLevel["DEBUG"] = 70] = "DEBUG"; - /** - * Detailed trace level logging should only be used for development, should only be set - * in a development environment. - */ - DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE"; - /** Used to set the logging level to include all logging */ - DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL"; -})(DiagLogLevel || (DiagLogLevel = {})); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/diag/types.js.map b/node_modules/@opentelemetry/api/build/esnext/diag/types.js.map deleted file mode 100644 index 0f15390..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/diag/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/diag/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoDH;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAwBX;AAxBD,WAAY,YAAY;IACtB,uFAAuF;IACvF,+CAAQ,CAAA;IAER,mCAAmC;IACnC,kDAAU,CAAA;IAEV,oCAAoC;IACpC,gDAAS,CAAA;IAET,wCAAwC;IACxC,gDAAS,CAAA;IAET,gCAAgC;IAChC,kDAAU,CAAA;IAEV;;;OAGG;IACH,sDAAY,CAAA;IAEZ,2DAA2D;IAC3D,gDAAU,CAAA;AACZ,CAAC,EAxBW,YAAY,KAAZ,YAAY,QAwBvB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport type DiagLogFunction = (message: string, ...args: unknown[]) => void;\n\n/**\n * Defines an internal diagnostic logger interface which is used to log internal diagnostic\n * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.\n * API provided implementations include :-\n * - a No-Op {@link createNoopDiagLogger}\n * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}\n * - a general Console {@link DiagConsoleLogger} version.\n *\n * @since 1.0.0\n */\nexport interface DiagLogger {\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n error: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n warn: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n info: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario.\n * For example: Logging the order of execution of async operations.\n */\n debug: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n verbose: DiagLogFunction;\n}\n\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport enum DiagLogLevel {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n NONE = 0,\n\n /** Identifies an error scenario */\n ERROR = 30,\n\n /** Identifies a warning scenario */\n WARN = 50,\n\n /** General informational log message */\n INFO = 60,\n\n /** General debug log message */\n DEBUG = 70,\n\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n VERBOSE = 80,\n\n /** Used to set the logging level to include all logging */\n ALL = 9999,\n}\n\n/**\n * Defines options for ComponentLogger\n *\n * @since 1.0.0\n */\nexport interface ComponentLoggerOptions {\n namespace: string;\n}\n\n/**\n * @since 1.4.1\n */\nexport interface DiagLoggerOptions {\n /**\n * The {@link DiagLogLevel} used to filter logs sent to the logger.\n *\n * @defaultValue DiagLogLevel.INFO\n */\n logLevel?: DiagLogLevel;\n\n /**\n * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered.\n */\n suppressOverrideMessage?: boolean;\n}\n\nexport interface DiagLoggerApi {\n /**\n * Set the global DiagLogger and DiagLogLevel.\n * If a global diag logger is already set, this will override it.\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean;\n\n /**\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/experimental/index.d.ts b/node_modules/@opentelemetry/api/build/esnext/experimental/index.d.ts deleted file mode 100644 index 020da5d..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/experimental/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Any exports here may change at any time and without warning - * @module @opentelemetry/api/experimental - */ -export { wrapTracer, SugaredTracer } from './trace/SugaredTracer'; -export type { SugaredSpanOptions } from './trace/SugaredOptions'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/experimental/index.js b/node_modules/@opentelemetry/api/build/esnext/experimental/index.js deleted file mode 100644 index 04e092b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/experimental/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * Any exports here may change at any time and without warning - * @module @opentelemetry/api/experimental - */ -export { wrapTracer, SugaredTracer } from './trace/SugaredTracer'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/experimental/index.js.map b/node_modules/@opentelemetry/api/build/esnext/experimental/index.js.map deleted file mode 100644 index e12fb66..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/experimental/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/experimental/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Any exports here may change at any time and without warning\n * @module @opentelemetry/api/experimental\n */\n\nexport { wrapTracer, SugaredTracer } from './trace/SugaredTracer';\nexport type { SugaredSpanOptions } from './trace/SugaredOptions';\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredOptions.d.ts b/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredOptions.d.ts deleted file mode 100644 index ea74870..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredOptions.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Span, SpanOptions } from '../../'; -/** - * Options needed for span creation - */ -export interface SugaredSpanOptions extends SpanOptions { - /** - * function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function. - * @param e Error which triggered this exception - * @param span current span from context - */ - onException?: (e: Error, span: Span) => void; -} -//# sourceMappingURL=SugaredOptions.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredOptions.js b/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredOptions.js deleted file mode 100644 index 6e661f5..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredOptions.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=SugaredOptions.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredOptions.js.map b/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredOptions.js.map deleted file mode 100644 index fabbdc1..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SugaredOptions.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredOptions.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Span, SpanOptions } from '../../';\n\n/**\n * Options needed for span creation\n */\nexport interface SugaredSpanOptions extends SpanOptions {\n /**\n * function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function.\n * @param e Error which triggered this exception\n * @param span current span from context\n */\n onException?: (e: Error, span: Span) => void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredTracer.d.ts b/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredTracer.d.ts deleted file mode 100644 index f78235b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredTracer.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { SugaredSpanOptions } from './SugaredOptions'; -import type { Context, Span, Tracer } from '../../'; -/** - * return a new SugaredTracer created from the supplied one - * @param tracer - */ -export declare function wrapTracer(tracer: Tracer): SugaredTracer; -export declare class SugaredTracer implements Tracer { - private readonly _tracer; - constructor(tracer: Tracer); - startActiveSpan: Tracer['startActiveSpan']; - startSpan: Tracer['startSpan']; - /** - * Starts a new {@link Span} and calls the given function passing it the - * created span as first argument. - * Additionally, the new span gets set in context and this context is activated - * for the duration of the function call. - * The span will be closed after the function has executed. - * If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown. - * - * @param name The name of the span - * @param [options] SugaredSpanOptions used for span creation - * @param [context] Context to use to extract parent - * @param fn function called in the context of the span and receives the newly created span as an argument - * @returns return value of fn - * @example - * const something = tracer.withActiveSpan('op', span => { - * // do some work - * }); - * @example - * const something = await tracer.withActiveSpan('op', span => { - * // do some async work - * }); - */ - withActiveSpan ReturnType>(name: string, fn: F): ReturnType; - withActiveSpan ReturnType>(name: string, options: SugaredSpanOptions, fn: F): ReturnType; - withActiveSpan ReturnType>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType; - /** - * Starts a new {@link Span} and ends it after execution of fn without setting it on context. - * The span will be closed after the function has executed. - * If an exception occurs, it is recorded, the status is et to ERROR and rethrown. - * - * This method does NOT modify the current Context. - * - * @param name The name of the span - * @param [options] SugaredSpanOptions used for span creation - * @param [context] Context to use to extract parent - * @param fn function called in the context of the span and receives the newly created span as an argument - * @returns Span The newly created span - * @example - * const something = tracer.withSpan('op', span => { - * // do some work - * }); - * @example - * const something = await tracer.withSpan('op', span => { - * // do some async work - * }); - */ - withSpan ReturnType>(name: string, fn: F): ReturnType; - withSpan ReturnType>(name: string, options: SugaredSpanOptions, fn: F): ReturnType; - withSpan ReturnType>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType; - withSpan ReturnType>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType; -} -//# sourceMappingURL=SugaredTracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredTracer.js b/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredTracer.js deleted file mode 100644 index 7487cb7..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredTracer.js +++ /dev/null @@ -1,88 +0,0 @@ -import { context as contextApi, SpanStatusCode } from '../../'; -const defaultOnException = (e, span) => { - span.recordException(e); - span.setStatus({ - code: SpanStatusCode.ERROR, - }); -}; -/** - * return a new SugaredTracer created from the supplied one - * @param tracer - */ -export function wrapTracer(tracer) { - return new SugaredTracer(tracer); -} -export class SugaredTracer { - constructor(tracer) { - this._tracer = tracer; - this.startSpan = tracer.startSpan.bind(this._tracer); - this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer); - } - withActiveSpan(name, arg2, arg3, arg4) { - const { opts, ctx, fn } = massageParams(arg2, arg3, arg4); - return this._tracer.startActiveSpan(name, opts, ctx, (span) => handleFn(span, opts, fn)); - } - withSpan(name, arg2, arg3, arg4) { - const { opts, ctx, fn } = massageParams(arg2, arg3, arg4); - const span = this._tracer.startSpan(name, opts, ctx); - return handleFn(span, opts, fn); - } -} -/** - * Massages parameters of withSpan and withActiveSpan to allow signature overwrites - * @param arg - * @param arg2 - * @param arg3 - */ -function massageParams(arg, arg2, arg3) { - let opts; - let ctx; - let fn; - if (!arg2 && !arg3) { - fn = arg; - } - else if (!arg3) { - opts = arg; - fn = arg2; - } - else { - opts = arg; - ctx = arg2; - fn = arg3; - } - opts = opts !== null && opts !== void 0 ? opts : {}; - ctx = ctx !== null && ctx !== void 0 ? ctx : contextApi.active(); - return { opts, ctx, fn }; -} -/** - * Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling - * @param span - * @param opts - * @param fn - */ -function handleFn(span, opts, fn) { - var _a; - const onException = (_a = opts.onException) !== null && _a !== void 0 ? _a : defaultOnException; - const errorHandler = (e) => { - onException(e, span); - span.end(); - throw e; - }; - try { - const ret = fn(span); - // if fn is an async function, attach a recordException and spanEnd callback to the promise - if (typeof (ret === null || ret === void 0 ? void 0 : ret.then) === 'function') { - return ret.then(val => { - span.end(); - return val; - }, errorHandler); - } - span.end(); - return ret; - } - catch (e) { - // add throw to signal the compiler that this will throw in the inner scope - throw errorHandler(e); - } -} -//# sourceMappingURL=SugaredTracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredTracer.js.map b/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredTracer.js.map deleted file mode 100644 index 77bc2ce..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/experimental/trace/SugaredTracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SugaredTracer.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredTracer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAQ,EAAE,IAAU,EAAE,EAAE;IAClD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,CAAC,SAAS,CAAC;QACb,IAAI,EAAE,cAAc,CAAC,KAAK;KAC3B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,OAAO,aAAa;IAGxB,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC;IA0CD,cAAc,CACZ,IAAY,EACZ,IAA4B,EAC5B,IAAkB,EAClB,IAAQ;QAER,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAC,OAAO,C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AAwB,EACxB,EAAK;;IAEL,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,WAAW,mCAAI,kBAAkB,CAAC;IAC3D,MAAM,YAAY,GAAG,CAAC,CAAQ,EAAE,EAAE;QAChC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,MAAM,CAAC,CAAC;IACV,CAAC,CAAC;IAEF,IAAI;QACF,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAA2B,CAAC;QAC/C,2FAA2F;QAC3F,IAAI,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAA,KAAK,UAAU,EAAE;YACnC,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACpB,IAAI,CAAC,GAAG,EAAE,CAAC;gBACX,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,YAAY,CAAkB,CAAC;SACnC;QACD,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,OAAO,GAAoB,CAAC;KAC7B;IAAC,OAAO,CAAC,EAAE;QACV,2EAA2E;QAC3E,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC;KACvB;AACH,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { SugaredSpanOptions } from './SugaredOptions';\nimport type { Context, Span, Tracer } from '../../';\nimport { context as contextApi, SpanStatusCode } from '../../';\n\nconst defaultOnException = (e: Error, span: Span) => {\n span.recordException(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n });\n};\n\n/**\n * return a new SugaredTracer created from the supplied one\n * @param tracer\n */\nexport function wrapTracer(tracer: Tracer): SugaredTracer {\n return new SugaredTracer(tracer);\n}\n\nexport class SugaredTracer implements Tracer {\n private readonly _tracer: Tracer;\n\n constructor(tracer: Tracer) {\n this._tracer = tracer;\n this.startSpan = tracer.startSpan.bind(this._tracer);\n this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer);\n }\n\n startActiveSpan: Tracer['startActiveSpan'];\n startSpan: Tracer['startSpan'];\n\n /**\n * Starts a new {@link Span} and calls the given function passing it the\n * created span as first argument.\n * Additionally, the new span gets set in context and this context is activated\n * for the duration of the function call.\n * The span will be closed after the function has executed.\n * If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown.\n *\n * @param name The name of the span\n * @param [options] SugaredSpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns return value of fn\n * @example\n * const something = tracer.withActiveSpan('op', span => {\n * // do some work\n * });\n * @example\n * const something = await tracer.withActiveSpan('op', span => {\n * // do some async work\n * });\n */\n withActiveSpan ReturnType>(\n name: string,\n fn: F\n ): ReturnType;\n withActiveSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n fn: F\n ): ReturnType;\n withActiveSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n withActiveSpan ReturnType>(\n name: string,\n arg2: F | SugaredSpanOptions,\n arg3?: F | Context,\n arg4?: F\n ): ReturnType {\n const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);\n\n return this._tracer.startActiveSpan(name, opts, ctx, (span: Span) =>\n handleFn(span, opts, fn)\n ) as ReturnType;\n }\n\n /**\n * Starts a new {@link Span} and ends it after execution of fn without setting it on context.\n * The span will be closed after the function has executed.\n * If an exception occurs, it is recorded, the status is et to ERROR and rethrown.\n *\n * This method does NOT modify the current Context.\n *\n * @param name The name of the span\n * @param [options] SugaredSpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns Span The newly created span\n * @example\n * const something = tracer.withSpan('op', span => {\n * // do some work\n * });\n * @example\n * const something = await tracer.withSpan('op', span => {\n * // do some async work\n * });\n */\n withSpan ReturnType>(\n name: string,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n arg2: SugaredSpanOptions | F,\n arg3?: Context | F,\n arg4?: F\n ): ReturnType {\n const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);\n\n const span = this._tracer.startSpan(name, opts, ctx);\n return handleFn(span, opts, fn) as ReturnType;\n }\n}\n\n/**\n * Massages parameters of withSpan and withActiveSpan to allow signature overwrites\n * @param arg\n * @param arg2\n * @param arg3\n */\nfunction massageParams ReturnType>(\n arg: F | SugaredSpanOptions,\n arg2?: F | Context,\n arg3?: F\n) {\n let opts: SugaredSpanOptions | undefined;\n let ctx: Context | undefined;\n let fn: F;\n\n if (!arg2 && !arg3) {\n fn = arg as F;\n } else if (!arg3) {\n opts = arg as SugaredSpanOptions;\n fn = arg2 as F;\n } else {\n opts = arg as SugaredSpanOptions;\n ctx = arg2 as Context;\n fn = arg3 as F;\n }\n opts = opts ?? {};\n ctx = ctx ?? contextApi.active();\n\n return { opts, ctx, fn };\n}\n\n/**\n * Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling\n * @param span\n * @param opts\n * @param fn\n */\nfunction handleFn ReturnType>(\n span: Span,\n opts: SugaredSpanOptions,\n fn: F\n): ReturnType {\n const onException = opts.onException ?? defaultOnException;\n const errorHandler = (e: Error) => {\n onException(e, span);\n span.end();\n throw e;\n };\n\n try {\n const ret = fn(span) as Promise>;\n // if fn is an async function, attach a recordException and spanEnd callback to the promise\n if (typeof ret?.then === 'function') {\n return ret.then(val => {\n span.end();\n return val;\n }, errorHandler) as ReturnType;\n }\n span.end();\n return ret as ReturnType;\n } catch (e) {\n // add throw to signal the compiler that this will throw in the inner scope\n throw errorHandler(e);\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/index.d.ts b/node_modules/@opentelemetry/api/build/esnext/index.d.ts deleted file mode 100644 index 93f0644..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/index.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @module @opentelemetry/api - */ -export type { BaggageEntry, BaggageEntryMetadata, Baggage, } from './baggage/types'; -export { baggageEntryMetadataFromString } from './baggage/utils'; -export type { Exception } from './common/Exception'; -export type { HrTime, TimeInput } from './common/Time'; -export type { Attributes, AttributeValue } from './common/Attributes'; -export { createContextKey, ROOT_CONTEXT } from './context/context'; -export type { Context, ContextManager } from './context/types'; -export type { ContextAPI } from './api/context'; -export { DiagConsoleLogger } from './diag/consoleLogger'; -export { DiagLogLevel } from './diag/types'; -export type { DiagLogFunction, DiagLogger, ComponentLoggerOptions, DiagLoggerOptions, } from './diag/types'; -export type { DiagAPI } from './api/diag'; -export { createNoopMeter } from './metrics/NoopMeter'; -export type { MeterOptions, Meter } from './metrics/Meter'; -export type { MeterProvider } from './metrics/MeterProvider'; -export { ValueType } from './metrics/Metric'; -export type { Counter, Gauge, Histogram, MetricOptions, UpDownCounter, MetricAdvice, MetricAttributes, MetricAttributeValue, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, BatchObservableCallback, ObservableCallback, BatchObservableResult, ObservableResult, } from './metrics/Metric'; -export type { MetricsAPI } from './api/metrics'; -export { defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator'; -export type { TextMapPropagator, TextMapSetter, TextMapGetter, } from './propagation/TextMapPropagator'; -export type { PropagationAPI } from './api/propagation'; -export type { SpanAttributes, SpanAttributeValue } from './trace/attributes'; -export type { Link } from './trace/link'; -export { ProxyTracer, type TracerDelegator } from './trace/ProxyTracer'; -export { ProxyTracerProvider } from './trace/ProxyTracerProvider'; -export type { Sampler } from './trace/Sampler'; -export { SamplingDecision, type SamplingResult } from './trace/SamplingResult'; -export type { SpanContext } from './trace/span_context'; -export { SpanKind } from './trace/span_kind'; -export type { Span } from './trace/span'; -export type { SpanOptions } from './trace/SpanOptions'; -export { type SpanStatus, SpanStatusCode } from './trace/status'; -export { TraceFlags } from './trace/trace_flags'; -export type { TraceState } from './trace/trace_state'; -export { createTraceState } from './trace/internal/utils'; -export type { TracerProvider } from './trace/tracer_provider'; -export type { Tracer } from './trace/tracer'; -export type { TracerOptions } from './trace/tracer_options'; -export { isSpanContextValid, isValidTraceId, isValidSpanId, } from './trace/spancontext-utils'; -export { INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT, } from './trace/invalid-span-constants'; -export type { TraceAPI } from './api/trace'; -import { context } from './context-api'; -import { diag } from './diag-api'; -import { metrics } from './metrics-api'; -import { propagation } from './propagation-api'; -import { trace } from './trace-api'; -export { context, diag, metrics, propagation, trace }; -declare const _default: { - context: import("./api/context").ContextAPI; - diag: import("./api/diag").DiagAPI; - metrics: import("./api/metrics").MetricsAPI; - propagation: import("./api/propagation").PropagationAPI; - trace: import("./api/trace").TraceAPI; -}; -export default _default; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/index.js b/node_modules/@opentelemetry/api/build/esnext/index.js deleted file mode 100644 index 9dc35ec..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export { baggageEntryMetadataFromString } from './baggage/utils'; -// Context APIs -export { createContextKey, ROOT_CONTEXT } from './context/context'; -// Diag APIs -export { DiagConsoleLogger } from './diag/consoleLogger'; -export { DiagLogLevel } from './diag/types'; -// Metrics APIs -export { createNoopMeter } from './metrics/NoopMeter'; -export { ValueType } from './metrics/Metric'; -// Propagation APIs -export { defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator'; -export { ProxyTracer } from './trace/ProxyTracer'; -// TODO: Remove ProxyTracerProvider export in the next major version. -export { ProxyTracerProvider } from './trace/ProxyTracerProvider'; -export { SamplingDecision } from './trace/SamplingResult'; -export { SpanKind } from './trace/span_kind'; -export { SpanStatusCode } from './trace/status'; -export { TraceFlags } from './trace/trace_flags'; -export { createTraceState } from './trace/internal/utils'; -export { isSpanContextValid, isValidTraceId, isValidSpanId, } from './trace/spancontext-utils'; -export { INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT, } from './trace/invalid-span-constants'; -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { context } from './context-api'; -import { diag } from './diag-api'; -import { metrics } from './metrics-api'; -import { propagation } from './propagation-api'; -import { trace } from './trace-api'; -// Named export. -export { context, diag, metrics, propagation, trace }; -// Default export. -export default { - context, - diag, - metrics, - propagation, - trace, -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/index.js.map b/node_modules/@opentelemetry/api/build/esnext/index.js.map deleted file mode 100644 index cb797c4..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAKjE,eAAe;AACf,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAInE,YAAY;AACZ,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAS5C,eAAe;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAqB7C,mBAAmB;AACnB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AAWzC,OAAO,EAAE,WAAW,EAAwB,MAAM,qBAAqB,CAAC;AACxE,qEAAqE;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAmB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AAGxC,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,gBAAgB;AAChB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AACtD,kBAAkB;AAClB,eAAe;IACb,OAAO;IACP,IAAI;IACJ,OAAO;IACP,WAAW;IACX,KAAK;CACN,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @module @opentelemetry/api\n */\n\nexport type {\n BaggageEntry,\n BaggageEntryMetadata,\n Baggage,\n} from './baggage/types';\nexport { baggageEntryMetadataFromString } from './baggage/utils';\nexport type { Exception } from './common/Exception';\nexport type { HrTime, TimeInput } from './common/Time';\nexport type { Attributes, AttributeValue } from './common/Attributes';\n\n// Context APIs\nexport { createContextKey, ROOT_CONTEXT } from './context/context';\nexport type { Context, ContextManager } from './context/types';\nexport type { ContextAPI } from './api/context';\n\n// Diag APIs\nexport { DiagConsoleLogger } from './diag/consoleLogger';\nexport { DiagLogLevel } from './diag/types';\nexport type {\n DiagLogFunction,\n DiagLogger,\n ComponentLoggerOptions,\n DiagLoggerOptions,\n} from './diag/types';\nexport type { DiagAPI } from './api/diag';\n\n// Metrics APIs\nexport { createNoopMeter } from './metrics/NoopMeter';\nexport type { MeterOptions, Meter } from './metrics/Meter';\nexport type { MeterProvider } from './metrics/MeterProvider';\nexport { ValueType } from './metrics/Metric';\nexport type {\n Counter,\n Gauge,\n Histogram,\n MetricOptions,\n UpDownCounter,\n MetricAdvice,\n MetricAttributes,\n MetricAttributeValue,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n BatchObservableCallback,\n ObservableCallback,\n BatchObservableResult,\n ObservableResult,\n} from './metrics/Metric';\nexport type { MetricsAPI } from './api/metrics';\n\n// Propagation APIs\nexport {\n defaultTextMapGetter,\n defaultTextMapSetter,\n} from './propagation/TextMapPropagator';\nexport type {\n TextMapPropagator,\n TextMapSetter,\n TextMapGetter,\n} from './propagation/TextMapPropagator';\nexport type { PropagationAPI } from './api/propagation';\n\n// Trace APIs\nexport type { SpanAttributes, SpanAttributeValue } from './trace/attributes';\nexport type { Link } from './trace/link';\nexport { ProxyTracer, type TracerDelegator } from './trace/ProxyTracer';\n// TODO: Remove ProxyTracerProvider export in the next major version.\nexport { ProxyTracerProvider } from './trace/ProxyTracerProvider';\nexport type { Sampler } from './trace/Sampler';\nexport { SamplingDecision, type SamplingResult } from './trace/SamplingResult';\nexport type { SpanContext } from './trace/span_context';\nexport { SpanKind } from './trace/span_kind';\nexport type { Span } from './trace/span';\nexport type { SpanOptions } from './trace/SpanOptions';\nexport { type SpanStatus, SpanStatusCode } from './trace/status';\nexport { TraceFlags } from './trace/trace_flags';\nexport type { TraceState } from './trace/trace_state';\nexport { createTraceState } from './trace/internal/utils';\nexport type { TracerProvider } from './trace/tracer_provider';\nexport type { Tracer } from './trace/tracer';\nexport type { TracerOptions } from './trace/tracer_options';\nexport {\n isSpanContextValid,\n isValidTraceId,\n isValidSpanId,\n} from './trace/spancontext-utils';\nexport {\n INVALID_SPANID,\n INVALID_TRACEID,\n INVALID_SPAN_CONTEXT,\n} from './trace/invalid-span-constants';\nexport type { TraceAPI } from './api/trace';\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { context } from './context-api';\nimport { diag } from './diag-api';\nimport { metrics } from './metrics-api';\nimport { propagation } from './propagation-api';\nimport { trace } from './trace-api';\n\n// Named export.\nexport { context, diag, metrics, propagation, trace };\n// Default export.\nexport default {\n context,\n diag,\n metrics,\n propagation,\n trace,\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/internal/global-utils.d.ts b/node_modules/@opentelemetry/api/build/esnext/internal/global-utils.d.ts deleted file mode 100644 index e03d908..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/internal/global-utils.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { MeterProvider } from '../metrics/MeterProvider'; -import type { ContextManager } from '../context/types'; -import type { DiagLogger } from '../diag/types'; -import type { TextMapPropagator } from '../propagation/TextMapPropagator'; -import type { TracerProvider } from '../trace/tracer_provider'; -export declare function registerGlobal(type: Type, instance: OTelGlobalAPI[Type], diag: DiagLogger, allowOverride?: boolean): boolean; -export declare function getGlobal(type: Type): OTelGlobalAPI[Type] | undefined; -export declare function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger): void; -type OTelGlobalAPI = { - version: string; - diag?: DiagLogger; - trace?: TracerProvider; - context?: ContextManager; - metrics?: MeterProvider; - propagation?: TextMapPropagator; -}; -export {}; -//# sourceMappingURL=global-utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/internal/global-utils.js b/node_modules/@opentelemetry/api/build/esnext/internal/global-utils.js deleted file mode 100644 index 13a8d2e..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/internal/global-utils.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { VERSION } from '../version'; -import { isCompatible } from './semver'; -const major = VERSION.split('.')[0]; -const GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`); -const _global = (typeof globalThis === 'object' - ? globalThis - : typeof self === 'object' - ? self - : typeof window === 'object' - ? window - : typeof global === 'object' - ? global - : {}); -export function registerGlobal(type, instance, diag, allowOverride = false) { - var _a; - const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { - version: VERSION, - }); - if (!allowOverride && api[type]) { - // already registered an API of this type - const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`); - diag.error(err.stack || err.message); - return false; - } - if (api.version !== VERSION) { - // All registered APIs must be of the same version exactly - const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`); - diag.error(err.stack || err.message); - return false; - } - api[type] = instance; - diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION}.`); - return true; -} -export function getGlobal(type) { - var _a, _b; - const globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version; - if (!globalVersion || !isCompatible(globalVersion)) { - return; - } - return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type]; -} -export function unregisterGlobal(type, diag) { - diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`); - const api = _global[GLOBAL_OPENTELEMETRY_API_KEY]; - if (api) { - delete api[type]; - } -} -//# sourceMappingURL=global-utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/internal/global-utils.js.map b/node_modules/@opentelemetry/api/build/esnext/internal/global-utils.js.map deleted file mode 100644 index caebec6..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/internal/global-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAC7C,wBAAwB,KAAK,EAAE,CAChC,CAAC;AAMF,MAAM,OAAO,GAAG,CACd,OAAO,UAAU,KAAK,QAAQ;IAC5B,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;QACxB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;gBAC1B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,EAAE,CACC,CAAC;AAEhB,MAAM,UAAU,cAAc,CAC5B,IAAU,EACV,QAA6B,EAC7B,IAAgB,EAChB,aAAa,GAAG,KAAK;;IAErB,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,GAAG,MAAA,OAAO,CAC1D,4BAA4B,CAC7B,mCAAI;QACH,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,IAAI,CAAC,aAAa,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE;QAC/B,yCAAyC;QACzC,MAAM,GAAG,GAAG,IAAI,KAAK,CACnB,gEAAgE,IAAI,EAAE,CACvE,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,EAAE;QAC3B,0DAA0D;QAC1D,MAAM,GAAG,GAAG,IAAI,KAAK,CACnB,gDAAgD,GAAG,CAAC,OAAO,QAAQ,IAAI,8CAA8C,OAAO,EAAE,CAC/H,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC;KACd;IAED,GAAG,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IACrB,IAAI,CAAC,KAAK,CACR,+CAA+C,IAAI,KAAK,OAAO,GAAG,CACnE,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,IAAU;;IAEV,MAAM,aAAa,GAAG,MAAA,OAAO,CAAC,4BAA4B,CAAC,0CAAE,OAAO,CAAC;IACrE,IAAI,CAAC,aAAa,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE;QAClD,OAAO;KACR;IACD,OAAO,MAAA,OAAO,CAAC,4BAA4B,CAAC,0CAAG,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAyB,EAAE,IAAgB;IAC1E,IAAI,CAAC,KAAK,CACR,kDAAkD,IAAI,KAAK,OAAO,GAAG,CACtE,CAAC;IACF,MAAM,GAAG,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAElD,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;KAClB;AACH,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { MeterProvider } from '../metrics/MeterProvider';\nimport type { ContextManager } from '../context/types';\nimport type { DiagLogger } from '../diag/types';\nimport type { TextMapPropagator } from '../propagation/TextMapPropagator';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport { VERSION } from '../version';\nimport { isCompatible } from './semver';\n\nconst major = VERSION.split('.')[0];\nconst GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(\n `opentelemetry.js.api.${major}`\n);\n\ndeclare const self: unknown;\ndeclare const window: unknown;\ndeclare const global: unknown;\n\nconst _global = (\n typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : {}\n) as OTelGlobal;\n\nexport function registerGlobal(\n type: Type,\n instance: OTelGlobalAPI[Type],\n diag: DiagLogger,\n allowOverride = false\n): boolean {\n const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = _global[\n GLOBAL_OPENTELEMETRY_API_KEY\n ] ?? {\n version: VERSION,\n });\n\n if (!allowOverride && api[type]) {\n // already registered an API of this type\n const err = new Error(\n `@opentelemetry/api: Attempted duplicate registration of API: ${type}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n if (api.version !== VERSION) {\n // All registered APIs must be of the same version exactly\n const err = new Error(\n `@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n api[type] = instance;\n diag.debug(\n `@opentelemetry/api: Registered a global for ${type} v${VERSION}.`\n );\n\n return true;\n}\n\nexport function getGlobal(\n type: Type\n): OTelGlobalAPI[Type] | undefined {\n const globalVersion = _global[GLOBAL_OPENTELEMETRY_API_KEY]?.version;\n if (!globalVersion || !isCompatible(globalVersion)) {\n return;\n }\n return _global[GLOBAL_OPENTELEMETRY_API_KEY]?.[type];\n}\n\nexport function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger) {\n diag.debug(\n `@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`\n );\n const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n\n if (api) {\n delete api[type];\n }\n}\n\ntype OTelGlobal = {\n [GLOBAL_OPENTELEMETRY_API_KEY]?: OTelGlobalAPI;\n};\n\ntype OTelGlobalAPI = {\n version: string;\n\n diag?: DiagLogger;\n trace?: TracerProvider;\n context?: ContextManager;\n metrics?: MeterProvider;\n propagation?: TextMapPropagator;\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/internal/semver.d.ts b/node_modules/@opentelemetry/api/build/esnext/internal/semver.d.ts deleted file mode 100644 index d9f4259..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/internal/semver.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Create a function to test an API version to see if it is compatible with the provided ownVersion. - * - * The returned function has the following semantics: - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param ownVersion version which should be checked against - */ -export declare function _makeCompatibilityCheck(ownVersion: string): (globalVersion: string) => boolean; -/** - * Test an API version to see if it is compatible with this API. - * - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param version version of the API requesting an instance of the global API - */ -export declare const isCompatible: (globalVersion: string) => boolean; -//# sourceMappingURL=semver.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/internal/semver.js b/node_modules/@opentelemetry/api/build/esnext/internal/semver.js deleted file mode 100644 index 0ba64ce..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/internal/semver.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { VERSION } from '../version'; -const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/; -/** - * Create a function to test an API version to see if it is compatible with the provided ownVersion. - * - * The returned function has the following semantics: - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param ownVersion version which should be checked against - */ -export function _makeCompatibilityCheck(ownVersion) { - const acceptedVersions = new Set([ownVersion]); - const rejectedVersions = new Set(); - const myVersionMatch = ownVersion.match(re); - if (!myVersionMatch) { - // we cannot guarantee compatibility so we always return noop - return () => false; - } - const ownVersionParsed = { - major: +myVersionMatch[1], - minor: +myVersionMatch[2], - patch: +myVersionMatch[3], - prerelease: myVersionMatch[4], - }; - // if ownVersion has a prerelease tag, versions must match exactly - if (ownVersionParsed.prerelease != null) { - return function isExactmatch(globalVersion) { - return globalVersion === ownVersion; - }; - } - function _reject(v) { - rejectedVersions.add(v); - return false; - } - function _accept(v) { - acceptedVersions.add(v); - return true; - } - return function isCompatible(globalVersion) { - if (acceptedVersions.has(globalVersion)) { - return true; - } - if (rejectedVersions.has(globalVersion)) { - return false; - } - const globalVersionMatch = globalVersion.match(re); - if (!globalVersionMatch) { - // cannot parse other version - // we cannot guarantee compatibility so we always noop - return _reject(globalVersion); - } - const globalVersionParsed = { - major: +globalVersionMatch[1], - minor: +globalVersionMatch[2], - patch: +globalVersionMatch[3], - prerelease: globalVersionMatch[4], - }; - // if globalVersion has a prerelease tag, versions must match exactly - if (globalVersionParsed.prerelease != null) { - return _reject(globalVersion); - } - // major versions must match - if (ownVersionParsed.major !== globalVersionParsed.major) { - return _reject(globalVersion); - } - if (ownVersionParsed.major === 0) { - if (ownVersionParsed.minor === globalVersionParsed.minor && - ownVersionParsed.patch <= globalVersionParsed.patch) { - return _accept(globalVersion); - } - return _reject(globalVersion); - } - if (ownVersionParsed.minor <= globalVersionParsed.minor) { - return _accept(globalVersion); - } - return _reject(globalVersion); - }; -} -/** - * Test an API version to see if it is compatible with this API. - * - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param version version of the API requesting an instance of the global API - */ -export const isCompatible = _makeCompatibilityCheck(VERSION); -//# sourceMappingURL=semver.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/internal/semver.js.map b/node_modules/@opentelemetry/api/build/esnext/internal/semver.js.map deleted file mode 100644 index 3af80d3..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/internal/semver.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../src/internal/semver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,EAAE,GAAG,+BAA+B,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAkB;IAElB,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IA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K,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;YAC7B,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC;SAClC,CAAC;QAEF,qEAAqE;QACrE,IAAI,mBAAmB,CAAC,UAAU,IAAI,IAAI,EAAE;YAC1C,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;SAC/B;QAED,4BAA4B;QAC5B,IAAI,gBAAgB,CAAC,KAAK,KAAK,mBAAmB,CAAC,KAAK,EAAE;YACxD,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;SAC/B;QAED,IAAI,gBAAgB,CAAC,KAAK,KAAK,CAAC,EAAE;YAChC,IACE,gBAAgB,CAAC,KAAK,KAAK,mBAAmB,CAAC,KAAK;gBACpD,gBAAgB,CAAC,KAAK,IAAI,mBAAmB,CAAC,KAAK,EACnD;gBACA,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;aAC/B;YAED,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;SAC/B;QAED,IAAI,gBAAgB,CAAC,KAAK,IAAI,mBAAmB,CAAC,KAAK,EAAE;YACvD,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;SAC/B;QAED,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { VERSION } from '../version';\n\nconst re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n\n/**\n * Create a function to test an API version to see if it is compatible with the provided ownVersion.\n *\n * The returned function has the following semantics:\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param ownVersion version which should be checked against\n */\nexport function _makeCompatibilityCheck(\n ownVersion: string\n): (globalVersion: string) => boolean {\n const acceptedVersions = new Set([ownVersion]);\n const rejectedVersions = new Set();\n\n const myVersionMatch = ownVersion.match(re);\n if (!myVersionMatch) {\n // we cannot guarantee compatibility so we always return noop\n return () => false;\n }\n\n const ownVersionParsed = {\n major: +myVersionMatch[1],\n minor: +myVersionMatch[2],\n patch: +myVersionMatch[3],\n prerelease: myVersionMatch[4],\n };\n\n // if ownVersion has a prerelease tag, versions must match exactly\n if (ownVersionParsed.prerelease != null) {\n return function isExactmatch(globalVersion: string): boolean {\n return globalVersion === ownVersion;\n };\n }\n\n function _reject(v: string) {\n rejectedVersions.add(v);\n return false;\n }\n\n function _accept(v: string) {\n acceptedVersions.add(v);\n return true;\n }\n\n return function isCompatible(globalVersion: string): boolean {\n if (acceptedVersions.has(globalVersion)) {\n return true;\n }\n\n if (rejectedVersions.has(globalVersion)) {\n return false;\n }\n\n const globalVersionMatch = globalVersion.match(re);\n if (!globalVersionMatch) {\n // cannot parse other version\n // we cannot guarantee compatibility so we always noop\n return _reject(globalVersion);\n }\n\n const globalVersionParsed = {\n major: +globalVersionMatch[1],\n minor: +globalVersionMatch[2],\n patch: +globalVersionMatch[3],\n prerelease: globalVersionMatch[4],\n };\n\n // if globalVersion has a prerelease tag, versions must match exactly\n if (globalVersionParsed.prerelease != null) {\n return _reject(globalVersion);\n }\n\n // major versions must match\n if (ownVersionParsed.major !== globalVersionParsed.major) {\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.major === 0) {\n if (\n ownVersionParsed.minor === globalVersionParsed.minor &&\n ownVersionParsed.patch <= globalVersionParsed.patch\n ) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.minor <= globalVersionParsed.minor) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n };\n}\n\n/**\n * Test an API version to see if it is compatible with this API.\n *\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param version version of the API requesting an instance of the global API\n */\nexport const isCompatible = _makeCompatibilityCheck(VERSION);\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics-api.d.ts b/node_modules/@opentelemetry/api/build/esnext/metrics-api.d.ts deleted file mode 100644 index a5f33ae..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics-api.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { MetricsAPI } from './api/metrics'; -/** - * Entrypoint for metrics API - * - * @since 1.3.0 - */ -export declare const metrics: MetricsAPI; -//# sourceMappingURL=metrics-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics-api.js b/node_modules/@opentelemetry/api/build/esnext/metrics-api.js deleted file mode 100644 index 5928528..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics-api.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { MetricsAPI } from './api/metrics'; -/** - * Entrypoint for metrics API - * - * @since 1.3.0 - */ -export const metrics = MetricsAPI.getInstance(); -//# sourceMappingURL=metrics-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics-api.js.map b/node_modules/@opentelemetry/api/build/esnext/metrics-api.js.map deleted file mode 100644 index cafb066..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metrics-api.js","sourceRoot":"","sources":["../../src/metrics-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { MetricsAPI } from './api/metrics';\n/**\n * Entrypoint for metrics API\n *\n * @since 1.3.0\n */\nexport const metrics = MetricsAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/Meter.d.ts b/node_modules/@opentelemetry/api/build/esnext/metrics/Meter.d.ts deleted file mode 100644 index e1236d7..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/Meter.d.ts +++ /dev/null @@ -1,114 +0,0 @@ -import type { BatchObservableCallback, Counter, Gauge, Histogram, MetricAttributes, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric'; -/** - * An interface describes additional metadata of a meter. - * - * @since 1.3.0 - */ -export interface MeterOptions { - /** - * The schemaUrl of the meter or instrumentation library - */ - schemaUrl?: string; -} -/** - * An interface to allow the recording metrics. - * - * {@link Metric}s are used for recording pre-defined aggregation (`Counter`), - * or raw values (`Histogram`) in which the aggregation and attributes - * for the exported metric are deferred. - * - * @since 1.3.0 - */ -export interface Meter { - /** - * Creates and returns a new `Gauge`. - * @param name the name of the metric. - * @param [options] the metric options. - */ - createGauge(name: string, options?: MetricOptions): Gauge; - /** - * Creates and returns a new `Histogram`. - * @param name the name of the metric. - * @param [options] the metric options. - */ - createHistogram(name: string, options?: MetricOptions): Histogram; - /** - * Creates a new `Counter` metric. Generally, this kind of metric when the - * value is a quantity, the sum is of primary interest, and the event count - * and value distribution are not of primary interest. - * @param name the name of the metric. - * @param [options] the metric options. - */ - createCounter(name: string, options?: MetricOptions): Counter; - /** - * Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous - * instrument and very similar to Counter except that Add(increment) - * supports negative increments. It is generally useful for capturing changes - * in an amount of resources used, or any quantity that rises and falls - * during a request. - * Example uses for UpDownCounter: - *
            - *
          1. count the number of active requests.
          2. - *
          3. count memory in use by instrumenting new and delete.
          4. - *
          5. count queue size by instrumenting enqueue and dequeue.
          6. - *
          7. count semaphore up and down operations.
          8. - *
          - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createUpDownCounter(name: string, options?: MetricOptions): UpDownCounter; - /** - * Creates a new `ObservableGauge` metric. - * - * The callback SHOULD be safe to be invoked concurrently. - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createObservableGauge(name: string, options?: MetricOptions): ObservableGauge; - /** - * Creates a new `ObservableCounter` metric. - * - * The callback SHOULD be safe to be invoked concurrently. - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createObservableCounter(name: string, options?: MetricOptions): ObservableCounter; - /** - * Creates a new `ObservableUpDownCounter` metric. - * - * The callback SHOULD be safe to be invoked concurrently. - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createObservableUpDownCounter(name: string, options?: MetricOptions): ObservableUpDownCounter; - /** - * Sets up a function that will be called whenever a metric collection is - * initiated. - * - * If the function is already in the list of callbacks for this Observable, - * the function is not added a second time. - * - * Only the associated observables can be observed in the callback. - * Measurements of observables that are not associated observed in the - * callback are dropped. - * - * @param callback the batch observable callback - * @param observables the observables associated with this batch observable callback - */ - addBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void; - /** - * Removes a callback previously registered with {@link Meter.addBatchObservableCallback}. - * - * The callback to be removed is identified using a combination of the callback itself, - * and the set of the observables associated with it. - * - * @param callback the batch observable callback - * @param observables the observables associated with this batch observable callback - */ - removeBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void; -} -//# sourceMappingURL=Meter.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/Meter.js b/node_modules/@opentelemetry/api/build/esnext/metrics/Meter.js deleted file mode 100644 index 6698765..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/Meter.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=Meter.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/Meter.js.map b/node_modules/@opentelemetry/api/build/esnext/metrics/Meter.js.map deleted file mode 100644 index c72178a..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/Meter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Meter.js","sourceRoot":"","sources":["../../../src/metrics/Meter.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n BatchObservableCallback,\n Counter,\n Gauge,\n Histogram,\n MetricAttributes,\n MetricOptions,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n} from './Metric';\n\n/**\n * An interface describes additional metadata of a meter.\n *\n * @since 1.3.0\n */\nexport interface MeterOptions {\n /**\n * The schemaUrl of the meter or instrumentation library\n */\n schemaUrl?: string;\n}\n\n/**\n * An interface to allow the recording metrics.\n *\n * {@link Metric}s are used for recording pre-defined aggregation (`Counter`),\n * or raw values (`Histogram`) in which the aggregation and attributes\n * for the exported metric are deferred.\n *\n * @since 1.3.0\n */\nexport interface Meter {\n /**\n * Creates and returns a new `Gauge`.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createGauge(\n name: string,\n options?: MetricOptions\n ): Gauge;\n\n /**\n * Creates and returns a new `Histogram`.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createHistogram(\n name: string,\n options?: MetricOptions\n ): Histogram;\n\n /**\n * Creates a new `Counter` metric. Generally, this kind of metric when the\n * value is a quantity, the sum is of primary interest, and the event count\n * and value distribution are not of primary interest.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createCounter(\n name: string,\n options?: MetricOptions\n ): Counter;\n\n /**\n * Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous\n * instrument and very similar to Counter except that Add(increment)\n * supports negative increments. It is generally useful for capturing changes\n * in an amount of resources used, or any quantity that rises and falls\n * during a request.\n * Example uses for UpDownCounter:\n *
            \n *
          1. count the number of active requests.
          2. \n *
          3. count memory in use by instrumenting new and delete.
          4. \n *
          5. count queue size by instrumenting enqueue and dequeue.
          6. \n *
          7. count semaphore up and down operations.
          8. \n *
          \n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): UpDownCounter;\n\n /**\n * Creates a new `ObservableGauge` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableGauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): ObservableGauge;\n\n /**\n * Creates a new `ObservableCounter` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): ObservableCounter;\n\n /**\n * Creates a new `ObservableUpDownCounter` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): ObservableUpDownCounter;\n\n /**\n * Sets up a function that will be called whenever a metric collection is\n * initiated.\n *\n * If the function is already in the list of callbacks for this Observable,\n * the function is not added a second time.\n *\n * Only the associated observables can be observed in the callback.\n * Measurements of observables that are not associated observed in the\n * callback are dropped.\n *\n * @param callback the batch observable callback\n * @param observables the observables associated with this batch observable callback\n */\n addBatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n callback: BatchObservableCallback,\n observables: Observable[]\n ): void;\n\n /**\n * Removes a callback previously registered with {@link Meter.addBatchObservableCallback}.\n *\n * The callback to be removed is identified using a combination of the callback itself,\n * and the set of the observables associated with it.\n *\n * @param callback the batch observable callback\n * @param observables the observables associated with this batch observable callback\n */\n removeBatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n callback: BatchObservableCallback,\n observables: Observable[]\n ): void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/MeterProvider.d.ts b/node_modules/@opentelemetry/api/build/esnext/metrics/MeterProvider.d.ts deleted file mode 100644 index 83378c5..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/MeterProvider.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { Meter, MeterOptions } from './Meter'; -/** - * A registry for creating named {@link Meter}s. - * - * @since 1.3.0 - */ -export interface MeterProvider { - /** - * Returns a Meter, creating one if one with the given name, version, and - * schemaUrl pair is not already created. - * - * @param name The name of the meter or instrumentation library. - * @param version The version of the meter or instrumentation library. - * @param options The options of the meter or instrumentation library. - * @returns Meter A Meter with the given name and version - */ - getMeter(name: string, version?: string, options?: MeterOptions): Meter; -} -//# sourceMappingURL=MeterProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/MeterProvider.js b/node_modules/@opentelemetry/api/build/esnext/metrics/MeterProvider.js deleted file mode 100644 index ea77b98..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/MeterProvider.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=MeterProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/MeterProvider.js.map b/node_modules/@opentelemetry/api/build/esnext/metrics/MeterProvider.js.map deleted file mode 100644 index 3aeb498..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/MeterProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MeterProvider.js","sourceRoot":"","sources":["../../../src/metrics/MeterProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter, MeterOptions } from './Meter';\n\n/**\n * A registry for creating named {@link Meter}s.\n *\n * @since 1.3.0\n */\nexport interface MeterProvider {\n /**\n * Returns a Meter, creating one if one with the given name, version, and\n * schemaUrl pair is not already created.\n *\n * @param name The name of the meter or instrumentation library.\n * @param version The version of the meter or instrumentation library.\n * @param options The options of the meter or instrumentation library.\n * @returns Meter A Meter with the given name and version\n */\n getMeter(name: string, version?: string, options?: MeterOptions): Meter;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/Metric.d.ts b/node_modules/@opentelemetry/api/build/esnext/metrics/Metric.d.ts deleted file mode 100644 index c298737..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/Metric.d.ts +++ /dev/null @@ -1,183 +0,0 @@ -import type { Attributes, AttributeValue } from '../common/Attributes'; -import type { Context } from '../context/types'; -/** - * Advisory options influencing aggregation configuration parameters. - * - * @since 1.7.0 - * @experimental - */ -export interface MetricAdvice { - /** - * Hint the explicit bucket boundaries for SDK if the metric is been - * aggregated with a HistogramAggregator. - */ - explicitBucketBoundaries?: number[]; -} -/** - * Options needed for metric creation - * - * @since 1.3.0 - */ -export interface MetricOptions { - /** - * The description of the Metric. - * @default '' - */ - description?: string; - /** - * The unit of the Metric values. - * @default '' - */ - unit?: string; - /** - * Indicates the type of the recorded value. - * @default {@link ValueType.DOUBLE} - */ - valueType?: ValueType; - /** - * The advice influencing aggregation configuration parameters. - * @experimental - * @since 1.7.0 - */ - advice?: MetricAdvice; -} -/** - * The Type of value. It describes how the data is reported. - * - * @since 1.3.0 - */ -export declare enum ValueType { - INT = 0, - DOUBLE = 1 -} -/** - * Counter is the most common synchronous instrument. This instrument supports - * an `Add(increment)` function for reporting a sum, and is restricted to - * non-negative increments. The default aggregation is Sum, as for any additive - * instrument. - * - * Example uses for Counter: - *
            - *
          1. count the number of bytes received.
          2. - *
          3. count the number of requests completed.
          4. - *
          5. count the number of accounts created.
          6. - *
          7. count the number of checkpoints run.
          8. - *
          9. count the number of 5xx errors.
          10. - *
              - * - * @since 1.3.0 - */ -export interface Counter { - /** - * Increment value of counter by the input. Inputs must not be negative. - */ - add(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @since 1.3.0 - */ -export interface UpDownCounter { - /** - * Increment value of counter by the input. Inputs may be negative. - */ - add(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @since 1.9.0 - */ -export interface Gauge { - /** - * Records a measurement. - */ - record(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @since 1.3.0 - */ -export interface Histogram { - /** - * Records a measurement. Value of the measurement must not be negative. - */ - record(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @deprecated please use {@link Attributes} - * @since 1.3.0 - */ -export type MetricAttributes = Attributes; -/** - * @deprecated please use {@link AttributeValue} - * @since 1.3.0 - */ -export type MetricAttributeValue = AttributeValue; -/** - * Interface that is being used in callback function for Observable Metric. - * - * @since 1.3.0 - */ -export interface ObservableResult { - /** - * Observe a measurement of the value associated with the given attributes. - * - * @param value The value to be observed. - * @param attributes The attributes associated with the value. If more than - * one value is associated with the same attributes values, SDK may pick the - * last one or simply drop the entire observable result. - */ - observe(this: ObservableResult, value: number, attributes?: AttributesTypes): void; -} -/** - * Interface that is being used in batch observable callback function. - */ -export interface BatchObservableResult { - /** - * Observe a measurement of the value associated with the given attributes. - * - * @param metric The observable metric to be observed. - * @param value The value to be observed. - * @param attributes The attributes associated with the value. If more than - * one value is associated with the same attributes values, SDK may pick the - * last one or simply drop the entire observable result. - */ - observe(this: BatchObservableResult, metric: Observable, value: number, attributes?: AttributesTypes): void; -} -/** - * The observable callback for Observable instruments. - * - * @since 1.3.0 - */ -export type ObservableCallback = (observableResult: ObservableResult) => void | Promise; -/** - * The observable callback for a batch of Observable instruments. - * - * @since 1.3.0 - */ -export type BatchObservableCallback = (observableResult: BatchObservableResult) => void | Promise; -/** - * @since 1.3.0 - */ -export interface Observable { - /** - * Sets up a function that will be called whenever a metric collection is initiated. - * - * If the function is already in the list of callbacks for this Observable, the function is not added a second time. - */ - addCallback(callback: ObservableCallback): void; - /** - * Removes a callback previously registered with {@link Observable.addCallback}. - */ - removeCallback(callback: ObservableCallback): void; -} -/** - * @since 1.3.0 - */ -export type ObservableCounter = Observable; -/** - * @since 1.3.0 - */ -export type ObservableUpDownCounter = Observable; -/** - * @since 1.3.0 - */ -export type ObservableGauge = Observable; -//# sourceMappingURL=Metric.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/Metric.js b/node_modules/@opentelemetry/api/build/esnext/metrics/Metric.js deleted file mode 100644 index 155db39..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/Metric.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * The Type of value. It describes how the data is reported. - * - * @since 1.3.0 - */ -export var ValueType; -(function (ValueType) { - ValueType[ValueType["INT"] = 0] = "INT"; - ValueType[ValueType["DOUBLE"] = 1] = "DOUBLE"; -})(ValueType || (ValueType = {})); -//# sourceMappingURL=Metric.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/Metric.js.map b/node_modules/@opentelemetry/api/build/esnext/metrics/Metric.js.map deleted file mode 100644 index 487204b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/Metric.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../../src/metrics/Metric.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmDH;;;;GAIG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;AACR,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes, AttributeValue } from '../common/Attributes';\nimport type { Context } from '../context/types';\n\n/**\n * Advisory options influencing aggregation configuration parameters.\n *\n * @since 1.7.0\n * @experimental\n */\nexport interface MetricAdvice {\n /**\n * Hint the explicit bucket boundaries for SDK if the metric is been\n * aggregated with a HistogramAggregator.\n */\n explicitBucketBoundaries?: number[];\n}\n\n/**\n * Options needed for metric creation\n *\n * @since 1.3.0\n */\nexport interface MetricOptions {\n /**\n * The description of the Metric.\n * @default ''\n */\n description?: string;\n\n /**\n * The unit of the Metric values.\n * @default ''\n */\n unit?: string;\n\n /**\n * Indicates the type of the recorded value.\n * @default {@link ValueType.DOUBLE}\n */\n valueType?: ValueType;\n\n /**\n * The advice influencing aggregation configuration parameters.\n * @experimental\n * @since 1.7.0\n */\n advice?: MetricAdvice;\n}\n\n/**\n * The Type of value. It describes how the data is reported.\n *\n * @since 1.3.0\n */\nexport enum ValueType {\n INT,\n DOUBLE,\n}\n\n/**\n * Counter is the most common synchronous instrument. This instrument supports\n * an `Add(increment)` function for reporting a sum, and is restricted to\n * non-negative increments. The default aggregation is Sum, as for any additive\n * instrument.\n *\n * Example uses for Counter:\n *
                \n *
              1. count the number of bytes received.
              2. \n *
              3. count the number of requests completed.
              4. \n *
              5. count the number of accounts created.
              6. \n *
              7. count the number of checkpoints run.
              8. \n *
              9. count the number of 5xx errors.
              10. \n *
                  \n *\n * @since 1.3.0\n */\nexport interface Counter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Increment value of counter by the input. Inputs must not be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport interface UpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Increment value of counter by the input. Inputs may be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.9.0\n */\nexport interface Gauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Records a measurement.\n */\n record(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport interface Histogram<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Records a measurement. Value of the measurement must not be negative.\n */\n record(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @deprecated please use {@link Attributes}\n * @since 1.3.0\n */\nexport type MetricAttributes = Attributes;\n\n/**\n * @deprecated please use {@link AttributeValue}\n * @since 1.3.0\n */\nexport type MetricAttributeValue = AttributeValue;\n\n/**\n * Interface that is being used in callback function for Observable Metric.\n *\n * @since 1.3.0\n */\nexport interface ObservableResult<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Observe a measurement of the value associated with the given attributes.\n *\n * @param value The value to be observed.\n * @param attributes The attributes associated with the value. If more than\n * one value is associated with the same attributes values, SDK may pick the\n * last one or simply drop the entire observable result.\n */\n observe(\n this: ObservableResult,\n value: number,\n attributes?: AttributesTypes\n ): void;\n}\n\n/**\n * Interface that is being used in batch observable callback function.\n */\nexport interface BatchObservableResult<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Observe a measurement of the value associated with the given attributes.\n *\n * @param metric The observable metric to be observed.\n * @param value The value to be observed.\n * @param attributes The attributes associated with the value. If more than\n * one value is associated with the same attributes values, SDK may pick the\n * last one or simply drop the entire observable result.\n */\n observe(\n this: BatchObservableResult,\n metric: Observable,\n value: number,\n attributes?: AttributesTypes\n ): void;\n}\n\n/**\n * The observable callback for Observable instruments.\n *\n * @since 1.3.0\n */\nexport type ObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = (\n observableResult: ObservableResult\n) => void | Promise;\n\n/**\n * The observable callback for a batch of Observable instruments.\n *\n * @since 1.3.0\n */\nexport type BatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = (\n observableResult: BatchObservableResult\n) => void | Promise;\n\n/**\n * @since 1.3.0\n */\nexport interface Observable<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Sets up a function that will be called whenever a metric collection is initiated.\n *\n * If the function is already in the list of callbacks for this Observable, the function is not added a second time.\n */\n addCallback(callback: ObservableCallback): void;\n\n /**\n * Removes a callback previously registered with {@link Observable.addCallback}.\n */\n removeCallback(callback: ObservableCallback): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport type ObservableCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable;\n/**\n * @since 1.3.0\n */\nexport type ObservableUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable;\n/**\n * @since 1.3.0\n */\nexport type ObservableGauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeter.d.ts b/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeter.d.ts deleted file mode 100644 index 408aa24..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeter.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -import type { Meter } from './Meter'; -import type { BatchObservableCallback, Counter, Gauge, Histogram, MetricAttributes, MetricOptions, Observable, ObservableCallback, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric'; -/** - * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses - * constant NoopMetrics for all of its methods. - */ -export declare class NoopMeter implements Meter { - constructor(); - /** - * @see {@link Meter.createGauge} - */ - createGauge(_name: string, _options?: MetricOptions): Gauge; - /** - * @see {@link Meter.createHistogram} - */ - createHistogram(_name: string, _options?: MetricOptions): Histogram; - /** - * @see {@link Meter.createCounter} - */ - createCounter(_name: string, _options?: MetricOptions): Counter; - /** - * @see {@link Meter.createUpDownCounter} - */ - createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter; - /** - * @see {@link Meter.createObservableGauge} - */ - createObservableGauge(_name: string, _options?: MetricOptions): ObservableGauge; - /** - * @see {@link Meter.createObservableCounter} - */ - createObservableCounter(_name: string, _options?: MetricOptions): ObservableCounter; - /** - * @see {@link Meter.createObservableUpDownCounter} - */ - createObservableUpDownCounter(_name: string, _options?: MetricOptions): ObservableUpDownCounter; - /** - * @see {@link Meter.addBatchObservableCallback} - */ - addBatchObservableCallback(_callback: BatchObservableCallback, _observables: Observable[]): void; - /** - * @see {@link Meter.removeBatchObservableCallback} - */ - removeBatchObservableCallback(_callback: BatchObservableCallback): void; -} -export declare class NoopMetric { -} -export declare class NoopCounterMetric extends NoopMetric implements Counter { - add(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopUpDownCounterMetric extends NoopMetric implements UpDownCounter { - add(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopGaugeMetric extends NoopMetric implements Gauge { - record(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopHistogramMetric extends NoopMetric implements Histogram { - record(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopObservableMetric { - addCallback(_callback: ObservableCallback): void; - removeCallback(_callback: ObservableCallback): void; -} -export declare class NoopObservableCounterMetric extends NoopObservableMetric implements ObservableCounter { -} -export declare class NoopObservableGaugeMetric extends NoopObservableMetric implements ObservableGauge { -} -export declare class NoopObservableUpDownCounterMetric extends NoopObservableMetric implements ObservableUpDownCounter { -} -export declare const NOOP_METER: NoopMeter; -export declare const NOOP_COUNTER_METRIC: NoopCounterMetric; -export declare const NOOP_GAUGE_METRIC: NoopGaugeMetric; -export declare const NOOP_HISTOGRAM_METRIC: NoopHistogramMetric; -export declare const NOOP_UP_DOWN_COUNTER_METRIC: NoopUpDownCounterMetric; -export declare const NOOP_OBSERVABLE_COUNTER_METRIC: NoopObservableCounterMetric; -export declare const NOOP_OBSERVABLE_GAUGE_METRIC: NoopObservableGaugeMetric; -export declare const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC: NoopObservableUpDownCounterMetric; -/** - * Create a no-op Meter - * - * @since 1.3.0 - */ -export declare function createNoopMeter(): Meter; -//# sourceMappingURL=NoopMeter.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeter.js b/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeter.js deleted file mode 100644 index 7125b36..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeter.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses - * constant NoopMetrics for all of its methods. - */ -export class NoopMeter { - constructor() { } - /** - * @see {@link Meter.createGauge} - */ - createGauge(_name, _options) { - return NOOP_GAUGE_METRIC; - } - /** - * @see {@link Meter.createHistogram} - */ - createHistogram(_name, _options) { - return NOOP_HISTOGRAM_METRIC; - } - /** - * @see {@link Meter.createCounter} - */ - createCounter(_name, _options) { - return NOOP_COUNTER_METRIC; - } - /** - * @see {@link Meter.createUpDownCounter} - */ - createUpDownCounter(_name, _options) { - return NOOP_UP_DOWN_COUNTER_METRIC; - } - /** - * @see {@link Meter.createObservableGauge} - */ - createObservableGauge(_name, _options) { - return NOOP_OBSERVABLE_GAUGE_METRIC; - } - /** - * @see {@link Meter.createObservableCounter} - */ - createObservableCounter(_name, _options) { - return NOOP_OBSERVABLE_COUNTER_METRIC; - } - /** - * @see {@link Meter.createObservableUpDownCounter} - */ - createObservableUpDownCounter(_name, _options) { - return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC; - } - /** - * @see {@link Meter.addBatchObservableCallback} - */ - addBatchObservableCallback(_callback, _observables) { } - /** - * @see {@link Meter.removeBatchObservableCallback} - */ - removeBatchObservableCallback(_callback) { } -} -export class NoopMetric { -} -export class NoopCounterMetric extends NoopMetric { - add(_value, _attributes) { } -} -export class NoopUpDownCounterMetric extends NoopMetric { - add(_value, _attributes) { } -} -export class NoopGaugeMetric extends NoopMetric { - record(_value, _attributes) { } -} -export class NoopHistogramMetric extends NoopMetric { - record(_value, _attributes) { } -} -export class NoopObservableMetric { - addCallback(_callback) { } - removeCallback(_callback) { } -} -export class NoopObservableCounterMetric extends NoopObservableMetric { -} -export class NoopObservableGaugeMetric extends NoopObservableMetric { -} -export class NoopObservableUpDownCounterMetric extends NoopObservableMetric { -} -export const NOOP_METER = new NoopMeter(); -// Synchronous instruments -export const NOOP_COUNTER_METRIC = new NoopCounterMetric(); -export const NOOP_GAUGE_METRIC = new NoopGaugeMetric(); -export const NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric(); -export const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric(); -// Asynchronous instruments -export const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric(); -export const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric(); -export const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric(); -/** - * Create a no-op Meter - * - * @since 1.3.0 - */ -export function createNoopMeter() { - return NOOP_METER; -} -//# sourceMappingURL=NoopMeter.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeter.js.map b/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeter.js.map deleted file mode 100644 index 65fa846..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopMeter.js","sourceRoot":"","sources":["../../../src/metrics/NoopMeter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH;;;GAGG;AACH,MAAM,OAAO,SAAS;IACpB,gBAAe,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,KAAa,EAAE,QAAwB;QACjD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,KAAa,EAAE,QAAwB;QACrD,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,KAAa,EAAE,QAAwB;QACnD,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,KAAa,EAAE,QAAwB;QACzD,OAAO,2BAA2B,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,qBAAqB,CACnB,KAAa,EACb,QAAwB;QAExB,OAAO,4BAA4B,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,uBAAuB,CACrB,KAAa,EACb,QAAwB;QAExB,OAAO,8BAA8B,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,6BAA6B,CAC3B,KAAa,EACb,QAAwB;QAExB,OAAO,sCAAsC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,0BAA0B,CACxB,SAAkC,EAClC,YAA0B,IACnB,CAAC;IAEV;;OAEG;IACH,6BAA6B,CAAC,SAAkC,IAAS,CAAC;CAC3E;AAED,MAAM,OAAO,UAAU;CAAG;AAE1B,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAC/C,GAAG,CAAC,MAAc,EAAE,WAA6B,IAAS,CAAC;CAC5D;AAED,MAAM,OAAO,uBACX,SAAQ,UAAU;IAGlB,GAAG,CAAC,MAAc,EAAE,WAA6B,IAAS,CAAC;CAC5D;AAED,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAC7C,MAAM,CAAC,MAAc,EAAE,WAA6B,IAAS,CAAC;CAC/D;AAED,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IACjD,MAAM,CAAC,MAAc,EAAE,WAA6B,IAAS,CAAC;CAC/D;AAED,MAAM,OAAO,oBAAoB;IAC/B,WAAW,CAAC,SAA6B,IAAG,CAAC;IAE7C,cAAc,CAAC,SAA6B,IAAG,CAAC;CACjD;AAED,MAAM,OAAO,2BACX,SAAQ,oBAAoB;CACG;AAEjC,MAAM,OAAO,yBACX,SAAQ,oBAAoB;CACC;AAE/B,MAAM,OAAO,iCACX,SAAQ,oBAAoB;CACS;AAEvC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,SAAS,EAAE,CAAC;AAE1C,0BAA0B;AAC1B,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,eAAe,EAAE,CAAC;AACvD,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,mBAAmB,EAAE,CAAC;AAC/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,uBAAuB,EAAE,CAAC;AAEzE,2BAA2B;AAC3B,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,2BAA2B,EAAE,CAAC;AAChF,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,yBAAyB,EAAE,CAAC;AAC5E,MAAM,CAAC,MAAM,sCAAsC,GACjD,IAAI,iCAAiC,EAAE,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter } from './Meter';\nimport type {\n BatchObservableCallback,\n Counter,\n Gauge,\n Histogram,\n MetricAttributes,\n MetricOptions,\n Observable,\n ObservableCallback,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n} from './Metric';\n\n/**\n * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses\n * constant NoopMetrics for all of its methods.\n */\nexport class NoopMeter implements Meter {\n constructor() {}\n\n /**\n * @see {@link Meter.createGauge}\n */\n createGauge(_name: string, _options?: MetricOptions): Gauge {\n return NOOP_GAUGE_METRIC;\n }\n\n /**\n * @see {@link Meter.createHistogram}\n */\n createHistogram(_name: string, _options?: MetricOptions): Histogram {\n return NOOP_HISTOGRAM_METRIC;\n }\n\n /**\n * @see {@link Meter.createCounter}\n */\n createCounter(_name: string, _options?: MetricOptions): Counter {\n return NOOP_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createUpDownCounter}\n */\n createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter {\n return NOOP_UP_DOWN_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableGauge}\n */\n createObservableGauge(\n _name: string,\n _options?: MetricOptions\n ): ObservableGauge {\n return NOOP_OBSERVABLE_GAUGE_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableCounter}\n */\n createObservableCounter(\n _name: string,\n _options?: MetricOptions\n ): ObservableCounter {\n return NOOP_OBSERVABLE_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableUpDownCounter}\n */\n createObservableUpDownCounter(\n _name: string,\n _options?: MetricOptions\n ): ObservableUpDownCounter {\n return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.addBatchObservableCallback}\n */\n addBatchObservableCallback(\n _callback: BatchObservableCallback,\n _observables: Observable[]\n ): void {}\n\n /**\n * @see {@link Meter.removeBatchObservableCallback}\n */\n removeBatchObservableCallback(_callback: BatchObservableCallback): void {}\n}\n\nexport class NoopMetric {}\n\nexport class NoopCounterMetric extends NoopMetric implements Counter {\n add(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopUpDownCounterMetric\n extends NoopMetric\n implements UpDownCounter\n{\n add(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopGaugeMetric extends NoopMetric implements Gauge {\n record(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopHistogramMetric extends NoopMetric implements Histogram {\n record(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopObservableMetric {\n addCallback(_callback: ObservableCallback) {}\n\n removeCallback(_callback: ObservableCallback) {}\n}\n\nexport class NoopObservableCounterMetric\n extends NoopObservableMetric\n implements ObservableCounter {}\n\nexport class NoopObservableGaugeMetric\n extends NoopObservableMetric\n implements ObservableGauge {}\n\nexport class NoopObservableUpDownCounterMetric\n extends NoopObservableMetric\n implements ObservableUpDownCounter {}\n\nexport const NOOP_METER = new NoopMeter();\n\n// Synchronous instruments\nexport const NOOP_COUNTER_METRIC = new NoopCounterMetric();\nexport const NOOP_GAUGE_METRIC = new NoopGaugeMetric();\nexport const NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric();\nexport const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();\n\n// Asynchronous instruments\nexport const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();\nexport const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();\nexport const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC =\n new NoopObservableUpDownCounterMetric();\n\n/**\n * Create a no-op Meter\n *\n * @since 1.3.0\n */\nexport function createNoopMeter(): Meter {\n return NOOP_METER;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeterProvider.d.ts b/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeterProvider.d.ts deleted file mode 100644 index 50cf9ae..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeterProvider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Meter, MeterOptions } from './Meter'; -import type { MeterProvider } from './MeterProvider'; -/** - * An implementation of the {@link MeterProvider} which returns an impotent Meter - * for all calls to `getMeter` - */ -export declare class NoopMeterProvider implements MeterProvider { - getMeter(_name: string, _version?: string, _options?: MeterOptions): Meter; -} -export declare const NOOP_METER_PROVIDER: NoopMeterProvider; -//# sourceMappingURL=NoopMeterProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeterProvider.js b/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeterProvider.js deleted file mode 100644 index 7adc79a..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeterProvider.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { NOOP_METER } from './NoopMeter'; -/** - * An implementation of the {@link MeterProvider} which returns an impotent Meter - * for all calls to `getMeter` - */ -export class NoopMeterProvider { - getMeter(_name, _version, _options) { - return NOOP_METER; - } -} -export const NOOP_METER_PROVIDER = new NoopMeterProvider(); -//# sourceMappingURL=NoopMeterProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeterProvider.js.map b/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeterProvider.js.map deleted file mode 100644 index 0c9b3f5..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/metrics/NoopMeterProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopMeterProvider.js","sourceRoot":"","sources":["../../../src/metrics/NoopMeterProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAC5B,QAAQ,CAAC,KAAa,EAAE,QAAiB,EAAE,QAAuB;QAChE,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,iBAAiB,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter, MeterOptions } from './Meter';\nimport type { MeterProvider } from './MeterProvider';\nimport { NOOP_METER } from './NoopMeter';\n\n/**\n * An implementation of the {@link MeterProvider} which returns an impotent Meter\n * for all calls to `getMeter`\n */\nexport class NoopMeterProvider implements MeterProvider {\n getMeter(_name: string, _version?: string, _options?: MeterOptions): Meter {\n return NOOP_METER;\n }\n}\n\nexport const NOOP_METER_PROVIDER = new NoopMeterProvider();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/propagation-api.d.ts b/node_modules/@opentelemetry/api/build/esnext/propagation-api.d.ts deleted file mode 100644 index 66df25f..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/propagation-api.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { PropagationAPI } from './api/propagation'; -/** - * Entrypoint for propagation API - * - * @since 1.0.0 - */ -export declare const propagation: PropagationAPI; -//# sourceMappingURL=propagation-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/propagation-api.js b/node_modules/@opentelemetry/api/build/esnext/propagation-api.js deleted file mode 100644 index eff0273..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/propagation-api.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { PropagationAPI } from './api/propagation'; -/** - * Entrypoint for propagation API - * - * @since 1.0.0 - */ -export const propagation = PropagationAPI.getInstance(); -//# sourceMappingURL=propagation-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/propagation-api.js.map b/node_modules/@opentelemetry/api/build/esnext/propagation-api.js.map deleted file mode 100644 index 3845fdc..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/propagation-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"propagation-api.js","sourceRoot":"","sources":["../../src/propagation-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { PropagationAPI } from './api/propagation';\n/**\n * Entrypoint for propagation API\n *\n * @since 1.0.0\n */\nexport const propagation = PropagationAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/propagation/NoopTextMapPropagator.d.ts b/node_modules/@opentelemetry/api/build/esnext/propagation/NoopTextMapPropagator.d.ts deleted file mode 100644 index 9ea4a42..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/propagation/NoopTextMapPropagator.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Context } from '../context/types'; -import type { TextMapPropagator } from './TextMapPropagator'; -/** - * No-op implementations of {@link TextMapPropagator}. - */ -export declare class NoopTextMapPropagator implements TextMapPropagator { - /** Noop inject function does nothing */ - inject(_context: Context, _carrier: unknown): void; - /** Noop extract function does nothing and returns the input context */ - extract(context: Context, _carrier: unknown): Context; - fields(): string[]; -} -//# sourceMappingURL=NoopTextMapPropagator.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/propagation/NoopTextMapPropagator.js b/node_modules/@opentelemetry/api/build/esnext/propagation/NoopTextMapPropagator.js deleted file mode 100644 index 6e34483..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/propagation/NoopTextMapPropagator.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * No-op implementations of {@link TextMapPropagator}. - */ -export class NoopTextMapPropagator { - /** Noop inject function does nothing */ - inject(_context, _carrier) { } - /** Noop extract function does nothing and returns the input context */ - extract(context, _carrier) { - return context; - } - fields() { - return []; - } -} -//# sourceMappingURL=NoopTextMapPropagator.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/propagation/NoopTextMapPropagator.js.map b/node_modules/@opentelemetry/api/build/esnext/propagation/NoopTextMapPropagator.js.map deleted file mode 100644 index f4316c6..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/propagation/NoopTextMapPropagator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopTextMapPropagator.js","sourceRoot":"","sources":["../../../src/propagation/NoopTextMapPropagator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAChC,wCAAwC;IACxC,MAAM,CAAC,QAAiB,EAAE,QAAiB,IAAS,CAAC;IACrD,uEAAuE;IACvE,OAAO,CAAC,OAAgB,EAAE,QAAiB;QACzC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM;QACJ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport type { TextMapPropagator } from './TextMapPropagator';\n\n/**\n * No-op implementations of {@link TextMapPropagator}.\n */\nexport class NoopTextMapPropagator implements TextMapPropagator {\n /** Noop inject function does nothing */\n inject(_context: Context, _carrier: unknown): void {}\n /** Noop extract function does nothing and returns the input context */\n extract(context: Context, _carrier: unknown): Context {\n return context;\n }\n fields(): string[] {\n return [];\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/propagation/TextMapPropagator.d.ts b/node_modules/@opentelemetry/api/build/esnext/propagation/TextMapPropagator.d.ts deleted file mode 100644 index 057552e..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/propagation/TextMapPropagator.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -import type { Context } from '../context/types'; -/** - * Injects `Context` into and extracts it from carriers that travel - * in-band across process boundaries. Encoding is expected to conform to the - * HTTP Header Field semantics. Values are often encoded as RPC/HTTP request - * headers. - * - * The carrier of propagated data on both the client (injector) and server - * (extractor) side is usually an object such as http headers. Propagation is - * usually implemented via library-specific request interceptors, where the - * client-side injects values and the server-side extracts them. - * - * @since 1.0.0 - */ -export interface TextMapPropagator { - /** - * Injects values from a given `Context` into a carrier. - * - * OpenTelemetry defines a common set of format values (TextMapPropagator), - * and each has an expected `carrier` type. - * - * @param context the Context from which to extract values to transmit over - * the wire. - * @param carrier the carrier of propagation fields, such as http request - * headers. - * @param setter an optional {@link TextMapSetter}. If undefined, values will be - * set by direct object assignment. - */ - inject(context: Context, carrier: Carrier, setter: TextMapSetter): void; - /** - * Given a `Context` and a carrier, extract context values from a - * carrier and return a new context, created from the old context, with the - * extracted values. - * - * @param context the Context from which to extract values to transmit over - * the wire. - * @param carrier the carrier of propagation fields, such as http request - * headers. - * @param getter an optional {@link TextMapGetter}. If undefined, keys will be all - * own properties, and keys will be accessed by direct object access. - */ - extract(context: Context, carrier: Carrier, getter: TextMapGetter): Context; - /** - * Return a list of all fields which may be used by the propagator. - */ - fields(): string[]; -} -/** - * A setter is specified by the caller to define a specific method - * to set key/value pairs on the carrier within a propagator - * - * @since 1.0.0 - */ -export interface TextMapSetter { - /** - * Callback used to set a key/value pair on an object. - * - * Should be called by the propagator each time a key/value pair - * should be set, and should set that key/value pair on the propagator. - * - * @param carrier object or class which carries key/value pairs - * @param key string key to modify - * @param value value to be set to the key on the carrier - */ - set(carrier: Carrier, key: string, value: string): void; -} -/** - * A getter is specified by the caller to define a specific method - * to get the value of a key from a carrier. - * - * @since 1.0.0 - */ -export interface TextMapGetter { - /** - * Get a list of all keys available on the carrier. - * - * @param carrier - */ - keys(carrier: Carrier): string[]; - /** - * Get the value of a specific key from the carrier. - * - * @param carrier - * @param key - */ - get(carrier: Carrier, key: string): undefined | string | string[]; -} -/** - * @since 1.0.0 - */ -export declare const defaultTextMapGetter: TextMapGetter; -/** - * @since 1.0.0 - */ -export declare const defaultTextMapSetter: TextMapSetter; -//# sourceMappingURL=TextMapPropagator.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/propagation/TextMapPropagator.js b/node_modules/@opentelemetry/api/build/esnext/propagation/TextMapPropagator.js deleted file mode 100644 index 8d8ec5c..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/propagation/TextMapPropagator.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * @since 1.0.0 - */ -export const defaultTextMapGetter = { - get(carrier, key) { - if (carrier == null) { - return undefined; - } - return carrier[key]; - }, - keys(carrier) { - if (carrier == null) { - return []; - } - return Object.keys(carrier); - }, -}; -/** - * @since 1.0.0 - */ -export const defaultTextMapSetter = { - set(carrier, key, value) { - if (carrier == null) { - return; - } - carrier[key] = value; - }, -}; -//# sourceMappingURL=TextMapPropagator.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/propagation/TextMapPropagator.js.map b/node_modules/@opentelemetry/api/build/esnext/propagation/TextMapPropagator.js.map deleted file mode 100644 index 5de140b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/propagation/TextMapPropagator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"TextMapPropagator.js","sourceRoot":"","sources":["../../../src/propagation/TextMapPropagator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2GH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IACjD,GAAG,CAAC,OAAO,EAAE,GAAG;QACd,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,OAAO;QACV,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO,EAAE,CAAC;SACX;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IACjD,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK;QACrB,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO;SACR;QAED,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\n\n/**\n * Injects `Context` into and extracts it from carriers that travel\n * in-band across process boundaries. Encoding is expected to conform to the\n * HTTP Header Field semantics. Values are often encoded as RPC/HTTP request\n * headers.\n *\n * The carrier of propagated data on both the client (injector) and server\n * (extractor) side is usually an object such as http headers. Propagation is\n * usually implemented via library-specific request interceptors, where the\n * client-side injects values and the server-side extracts them.\n *\n * @since 1.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TextMapPropagator {\n /**\n * Injects values from a given `Context` into a carrier.\n *\n * OpenTelemetry defines a common set of format values (TextMapPropagator),\n * and each has an expected `carrier` type.\n *\n * @param context the Context from which to extract values to transmit over\n * the wire.\n * @param carrier the carrier of propagation fields, such as http request\n * headers.\n * @param setter an optional {@link TextMapSetter}. If undefined, values will be\n * set by direct object assignment.\n */\n inject(\n context: Context,\n carrier: Carrier,\n setter: TextMapSetter\n ): void;\n\n /**\n * Given a `Context` and a carrier, extract context values from a\n * carrier and return a new context, created from the old context, with the\n * extracted values.\n *\n * @param context the Context from which to extract values to transmit over\n * the wire.\n * @param carrier the carrier of propagation fields, such as http request\n * headers.\n * @param getter an optional {@link TextMapGetter}. If undefined, keys will be all\n * own properties, and keys will be accessed by direct object access.\n */\n extract(\n context: Context,\n carrier: Carrier,\n getter: TextMapGetter\n ): Context;\n\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n fields(): string[];\n}\n\n/**\n * A setter is specified by the caller to define a specific method\n * to set key/value pairs on the carrier within a propagator\n *\n * @since 1.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TextMapSetter {\n /**\n * Callback used to set a key/value pair on an object.\n *\n * Should be called by the propagator each time a key/value pair\n * should be set, and should set that key/value pair on the propagator.\n *\n * @param carrier object or class which carries key/value pairs\n * @param key string key to modify\n * @param value value to be set to the key on the carrier\n */\n set(carrier: Carrier, key: string, value: string): void;\n}\n\n/**\n * A getter is specified by the caller to define a specific method\n * to get the value of a key from a carrier.\n *\n * @since 1.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TextMapGetter {\n /**\n * Get a list of all keys available on the carrier.\n *\n * @param carrier\n */\n keys(carrier: Carrier): string[];\n\n /**\n * Get the value of a specific key from the carrier.\n *\n * @param carrier\n * @param key\n */\n get(carrier: Carrier, key: string): undefined | string | string[];\n}\n\n/**\n * @since 1.0.0\n */\nexport const defaultTextMapGetter: TextMapGetter = {\n get(carrier, key) {\n if (carrier == null) {\n return undefined;\n }\n return carrier[key];\n },\n\n keys(carrier) {\n if (carrier == null) {\n return [];\n }\n return Object.keys(carrier);\n },\n};\n\n/**\n * @since 1.0.0\n */\nexport const defaultTextMapSetter: TextMapSetter = {\n set(carrier, key, value) {\n if (carrier == null) {\n return;\n }\n\n carrier[key] = value;\n },\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace-api.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace-api.d.ts deleted file mode 100644 index 7064168..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace-api.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { TraceAPI } from './api/trace'; -/** - * Entrypoint for trace API - * - * @since 1.0.0 - */ -export declare const trace: TraceAPI; -//# sourceMappingURL=trace-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace-api.js b/node_modules/@opentelemetry/api/build/esnext/trace-api.js deleted file mode 100644 index 2c02742..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace-api.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -import { TraceAPI } from './api/trace'; -/** - * Entrypoint for trace API - * - * @since 1.0.0 - */ -export const trace = TraceAPI.getInstance(); -//# sourceMappingURL=trace-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace-api.js.map b/node_modules/@opentelemetry/api/build/esnext/trace-api.js.map deleted file mode 100644 index 08c0fa8..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace-api.js","sourceRoot":"","sources":["../../src/trace-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { TraceAPI } from './api/trace';\n\n/**\n * Entrypoint for trace API\n *\n * @since 1.0.0\n */\nexport const trace = TraceAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/NonRecordingSpan.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/NonRecordingSpan.d.ts deleted file mode 100644 index ba793f6..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/NonRecordingSpan.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Exception } from '../common/Exception'; -import type { TimeInput } from '../common/Time'; -import type { SpanAttributes } from './attributes'; -import type { Span } from './span'; -import type { SpanContext } from './span_context'; -import type { SpanStatus } from './status'; -import type { Link } from './link'; -/** - * The NonRecordingSpan is the default {@link Span} that is used when no Span - * implementation is available. All operations are no-op including context - * propagation. - */ -export declare class NonRecordingSpan implements Span { - private readonly _spanContext; - constructor(spanContext?: SpanContext); - spanContext(): SpanContext; - setAttribute(_key: string, _value: unknown): this; - setAttributes(_attributes: SpanAttributes): this; - addEvent(_name: string, _attributes?: SpanAttributes): this; - addLink(_link: Link): this; - addLinks(_links: Link[]): this; - setStatus(_status: SpanStatus): this; - updateName(_name: string): this; - end(_endTime?: TimeInput): void; - isRecording(): boolean; - recordException(_exception: Exception, _time?: TimeInput): void; -} -//# sourceMappingURL=NonRecordingSpan.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/NonRecordingSpan.js b/node_modules/@opentelemetry/api/build/esnext/trace/NonRecordingSpan.js deleted file mode 100644 index 9235397..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/NonRecordingSpan.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { INVALID_SPAN_CONTEXT } from './invalid-span-constants'; -/** - * The NonRecordingSpan is the default {@link Span} that is used when no Span - * implementation is available. All operations are no-op including context - * propagation. - */ -export class NonRecordingSpan { - constructor(spanContext = INVALID_SPAN_CONTEXT) { - this._spanContext = spanContext; - } - // Returns a SpanContext. - spanContext() { - return this._spanContext; - } - // By default does nothing - setAttribute(_key, _value) { - return this; - } - // By default does nothing - setAttributes(_attributes) { - return this; - } - // By default does nothing - addEvent(_name, _attributes) { - return this; - } - addLink(_link) { - return this; - } - addLinks(_links) { - return this; - } - // By default does nothing - setStatus(_status) { - return this; - } - // By default does nothing - updateName(_name) { - return this; - } - // By default does nothing - end(_endTime) { } - // isRecording always returns false for NonRecordingSpan. - isRecording() { - return false; - } - // By default does nothing - recordException(_exception, _time) { } -} -//# sourceMappingURL=NonRecordingSpan.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/NonRecordingSpan.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/NonRecordingSpan.js.map deleted file mode 100644 index eac2f50..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/NonRecordingSpan.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NonRecordingSpan.js","sourceRoot":"","sources":["../../../src/trace/NonRecordingSpan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAMhE;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAG3B,YAAY,cAA2B,oBAAoB;QACzD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED,yBAAyB;IACzB,WAAW;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,0BAA0B;IAC1B,YAAY,CAAC,IAAY,EAAE,MAAe;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,aAAa,CAAC,WAA2B;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,QAAQ,CAAC,KAAa,EAAE,WAA4B;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAW;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,MAAc;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,SAAS,CAAC,OAAmB;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,UAAU,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,GAAG,CAAC,QAAoB,IAAS,CAAC;IAElC,yDAAyD;IACzD,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0BAA0B;IAC1B,eAAe,CAAC,UAAqB,EAAE,KAAiB,IAAS,CAAC;CACnE","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Exception } from '../common/Exception';\nimport type { TimeInput } from '../common/Time';\nimport type { SpanAttributes } from './attributes';\nimport { INVALID_SPAN_CONTEXT } from './invalid-span-constants';\nimport type { Span } from './span';\nimport type { SpanContext } from './span_context';\nimport type { SpanStatus } from './status';\nimport type { Link } from './link';\n\n/**\n * The NonRecordingSpan is the default {@link Span} that is used when no Span\n * implementation is available. All operations are no-op including context\n * propagation.\n */\nexport class NonRecordingSpan implements Span {\n private readonly _spanContext: SpanContext;\n\n constructor(spanContext: SpanContext = INVALID_SPAN_CONTEXT) {\n this._spanContext = spanContext;\n }\n\n // Returns a SpanContext.\n spanContext(): SpanContext {\n return this._spanContext;\n }\n\n // By default does nothing\n setAttribute(_key: string, _value: unknown): this {\n return this;\n }\n\n // By default does nothing\n setAttributes(_attributes: SpanAttributes): this {\n return this;\n }\n\n // By default does nothing\n addEvent(_name: string, _attributes?: SpanAttributes): this {\n return this;\n }\n\n addLink(_link: Link): this {\n return this;\n }\n\n addLinks(_links: Link[]): this {\n return this;\n }\n\n // By default does nothing\n setStatus(_status: SpanStatus): this {\n return this;\n }\n\n // By default does nothing\n updateName(_name: string): this {\n return this;\n }\n\n // By default does nothing\n end(_endTime?: TimeInput): void {}\n\n // isRecording always returns false for NonRecordingSpan.\n isRecording(): boolean {\n return false;\n }\n\n // By default does nothing\n recordException(_exception: Exception, _time?: TimeInput): void {}\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracer.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracer.d.ts deleted file mode 100644 index f1efbcf..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracer.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanOptions } from './SpanOptions'; -import type { Tracer } from './tracer'; -/** - * No-op implementations of {@link Tracer}. - */ -export declare class NoopTracer implements Tracer { - startSpan(name: string, options?: SpanOptions, context?: Context): Span; - startActiveSpan ReturnType>(name: string, fn: F): ReturnType; - startActiveSpan ReturnType>(name: string, opts: SpanOptions | undefined, fn: F): ReturnType; - startActiveSpan ReturnType>(name: string, opts: SpanOptions | undefined, ctx: Context | undefined, fn: F): ReturnType; -} -//# sourceMappingURL=NoopTracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracer.js b/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracer.js deleted file mode 100644 index acb8cd2..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracer.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { ContextAPI } from '../api/context'; -import { getSpanContext, setSpan } from '../trace/context-utils'; -import { NonRecordingSpan } from './NonRecordingSpan'; -import { isSpanContextValid } from './spancontext-utils'; -const contextApi = ContextAPI.getInstance(); -/** - * No-op implementations of {@link Tracer}. - */ -export class NoopTracer { - // startSpan starts a noop span. - startSpan(name, options, context = contextApi.active()) { - const root = Boolean(options === null || options === void 0 ? void 0 : options.root); - if (root) { - return new NonRecordingSpan(); - } - const parentFromContext = context && getSpanContext(context); - if (isSpanContext(parentFromContext) && - isSpanContextValid(parentFromContext)) { - return new NonRecordingSpan(parentFromContext); - } - else { - return new NonRecordingSpan(); - } - } - startActiveSpan(name, arg2, arg3, arg4) { - let opts; - let ctx; - let fn; - if (arguments.length < 2) { - return; - } - else if (arguments.length === 2) { - fn = arg2; - } - else if (arguments.length === 3) { - opts = arg2; - fn = arg3; - } - else { - opts = arg2; - ctx = arg3; - fn = arg4; - } - const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active(); - const span = this.startSpan(name, opts, parentContext); - const contextWithSpanSet = setSpan(parentContext, span); - return contextApi.with(contextWithSpanSet, fn, undefined, span); - } -} -function isSpanContext(spanContext) { - return (spanContext !== null && - typeof spanContext === 'object' && - 'spanId' in spanContext && - typeof spanContext['spanId'] === 'string' && - 'traceId' in spanContext && - typeof spanContext['traceId'] === 'string' && - 'traceFlags' in spanContext && - typeof spanContext['traceFlags'] === 'number'); -} -//# sourceMappingURL=NoopTracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracer.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracer.js.map deleted file mode 100644 index 6cced85..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopTracer.js","sourceRoot":"","sources":["../../../src/trace/NoopTracer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAKzD,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,UAAU;IACrB,gCAAgC;IAChC,SAAS,CACP,IAAY,EACZ,OAAqB,EACrB,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE;QAE7B,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CAAC;QACpC,IAAI,IAAI,EAAE;YACR,OAAO,IAAI,gBAAgB,EAAE,CAAC;SAC/B;QAED,MAAM,iBAAiB,GAAG,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QAE7D,IACE,aAAa,CAAC,iBAAiB,CAAC;YAChC,kBAAkB,CAAC,iBAAiB,CA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QAAQ;QAC1C,YAAY,IAAI,WAAW;QAC3B,OAAO,WAAW,CAAC,YAAY,CAAC,KAAK,QAAQ,CAC9C,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ContextAPI } from '../api/context';\nimport type { Context } from '../context/types';\nimport { getSpanContext, setSpan } from '../trace/context-utils';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport type { Span } from './span';\nimport { isSpanContextValid } from './spancontext-utils';\nimport type { SpanOptions } from './SpanOptions';\nimport type { SpanContext } from './span_context';\nimport type { Tracer } from './tracer';\n\nconst contextApi = ContextAPI.getInstance();\n\n/**\n * No-op implementations of {@link Tracer}.\n */\nexport class NoopTracer implements Tracer {\n // startSpan starts a noop span.\n startSpan(\n name: string,\n options?: SpanOptions,\n context = contextApi.active()\n ): Span {\n const root = Boolean(options?.root);\n if (root) {\n return new NonRecordingSpan();\n }\n\n const parentFromContext = context && getSpanContext(context);\n\n if (\n isSpanContext(parentFromContext) &&\n isSpanContextValid(parentFromContext)\n ) {\n return new NonRecordingSpan(parentFromContext);\n } else {\n return new NonRecordingSpan();\n }\n }\n\n startActiveSpan ReturnType>(\n name: string,\n fn: F\n ): ReturnType;\n startActiveSpan ReturnType>(\n name: string,\n opts: SpanOptions | undefined,\n fn: F\n ): ReturnType;\n startActiveSpan ReturnType>(\n name: string,\n opts: SpanOptions | undefined,\n ctx: Context | undefined,\n fn: F\n ): ReturnType;\n startActiveSpan ReturnType>(\n name: string,\n arg2?: F | SpanOptions,\n arg3?: F | Context,\n arg4?: F\n ): ReturnType | undefined {\n let opts: SpanOptions | undefined;\n let ctx: Context | undefined;\n let fn: F;\n\n if (arguments.length < 2) {\n return;\n } else if (arguments.length === 2) {\n fn = arg2 as F;\n } else if (arguments.length === 3) {\n opts = arg2 as SpanOptions | undefined;\n fn = arg3 as F;\n } else {\n opts = arg2 as SpanOptions | undefined;\n ctx = arg3 as Context | undefined;\n fn = arg4 as F;\n }\n\n const parentContext = ctx ?? contextApi.active();\n const span = this.startSpan(name, opts, parentContext);\n const contextWithSpanSet = setSpan(parentContext, span);\n\n return contextApi.with(contextWithSpanSet, fn, undefined, span);\n }\n}\n\nfunction isSpanContext(spanContext: unknown): spanContext is SpanContext {\n return (\n spanContext !== null &&\n typeof spanContext === 'object' &&\n 'spanId' in spanContext &&\n typeof spanContext['spanId'] === 'string' &&\n 'traceId' in spanContext &&\n typeof spanContext['traceId'] === 'string' &&\n 'traceFlags' in spanContext &&\n typeof spanContext['traceFlags'] === 'number'\n );\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracerProvider.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracerProvider.d.ts deleted file mode 100644 index 0c29a20..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracerProvider.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Tracer } from './tracer'; -import type { TracerOptions } from './tracer_options'; -import type { TracerProvider } from './tracer_provider'; -/** - * An implementation of the {@link TracerProvider} which returns an impotent - * Tracer for all calls to `getTracer`. - * - * All operations are no-op. - */ -export declare class NoopTracerProvider implements TracerProvider { - getTracer(_name?: string, _version?: string, _options?: TracerOptions): Tracer; -} -//# sourceMappingURL=NoopTracerProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracerProvider.js b/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracerProvider.js deleted file mode 100644 index e9b5da7..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracerProvider.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { NoopTracer } from './NoopTracer'; -/** - * An implementation of the {@link TracerProvider} which returns an impotent - * Tracer for all calls to `getTracer`. - * - * All operations are no-op. - */ -export class NoopTracerProvider { - getTracer(_name, _version, _options) { - return new NoopTracer(); - } -} -//# sourceMappingURL=NoopTracerProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracerProvider.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracerProvider.js.map deleted file mode 100644 index 105766d..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/NoopTracerProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopTracerProvider.js","sourceRoot":"","sources":["../../../src/trace/NoopTracerProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IAC7B,SAAS,CACP,KAAc,EACd,QAAiB,EACjB,QAAwB;QAExB,OAAO,IAAI,UAAU,EAAE,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { NoopTracer } from './NoopTracer';\nimport type { Tracer } from './tracer';\nimport type { TracerOptions } from './tracer_options';\nimport type { TracerProvider } from './tracer_provider';\n\n/**\n * An implementation of the {@link TracerProvider} which returns an impotent\n * Tracer for all calls to `getTracer`.\n *\n * All operations are no-op.\n */\nexport class NoopTracerProvider implements TracerProvider {\n getTracer(\n _name?: string,\n _version?: string,\n _options?: TracerOptions\n ): Tracer {\n return new NoopTracer();\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracer.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracer.d.ts deleted file mode 100644 index af0d3ae..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracer.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanOptions } from './SpanOptions'; -import type { Tracer } from './tracer'; -import type { TracerOptions } from './tracer_options'; -/** - * Proxy tracer provided by the proxy tracer provider - * - * @since 1.0.0 - */ -export declare class ProxyTracer implements Tracer { - private _delegate?; - private _provider; - readonly name: string; - readonly version?: string; - readonly options?: TracerOptions; - constructor(provider: TracerDelegator, name: string, version?: string, options?: TracerOptions); - startSpan(name: string, options?: SpanOptions, context?: Context): Span; - startActiveSpan unknown>(_name: string, _options: F | SpanOptions, _context?: F | Context, _fn?: F): ReturnType; - /** - * Try to get a tracer from the proxy tracer provider. - * If the proxy tracer provider has no delegate, return a noop tracer. - */ - private _getTracer; -} -/** - * @since 1.0.3 - */ -export interface TracerDelegator { - getDelegateTracer(name: string, version?: string, options?: TracerOptions): Tracer | undefined; -} -//# sourceMappingURL=ProxyTracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracer.js b/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracer.js deleted file mode 100644 index d79c959..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracer.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { NoopTracer } from './NoopTracer'; -const NOOP_TRACER = new NoopTracer(); -/** - * Proxy tracer provided by the proxy tracer provider - * - * @since 1.0.0 - */ -export class ProxyTracer { - constructor(provider, name, version, options) { - this._provider = provider; - this.name = name; - this.version = version; - this.options = options; - } - startSpan(name, options, context) { - return this._getTracer().startSpan(name, options, context); - } - startActiveSpan(_name, _options, _context, _fn) { - const tracer = this._getTracer(); - return Reflect.apply(tracer.startActiveSpan, tracer, arguments); - } - /** - * Try to get a tracer from the proxy tracer provider. - * If the proxy tracer provider has no delegate, return a noop tracer. - */ - _getTracer() { - if (this._delegate) { - return this._delegate; - } - const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options); - if (!tracer) { - return NOOP_TRACER; - } - this._delegate = tracer; - return this._delegate; - } -} -//# sourceMappingURL=ProxyTracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracer.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracer.js.map deleted file mode 100644 index a9724eb..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ProxyTracer.js","sourceRoot":"","sources":["../../../src/trace/ProxyTracer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,MAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC;AAErC;;;;GAIG;AACH,MAAM,OAAO,WAAW;IAQtB,YACE,QAAyB,EACzB,IAAY,EACZ,OAAgB,EAChB,OAAuB;QAEvB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,OAAqB,EAAE,OAAiB;QAC9D,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,eAAe,CACb,KAAa,EACb,QAAyB,EACzB,QAAsB,EACtB,GAAO;QAEP,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;IAED;;;OAGG;IACK,UAAU;QAChB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,IAAI,CAAC,SAAS,CAAC;SACvB;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAC7C,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,OAAO,CACb,CAAC;QAEF,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,WAAW,CAAC;SACpB;QAED,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport { NoopTracer } from './NoopTracer';\nimport type { Span } from './span';\nimport type { SpanOptions } from './SpanOptions';\nimport type { Tracer } from './tracer';\nimport type { TracerOptions } from './tracer_options';\n\nconst NOOP_TRACER = new NoopTracer();\n\n/**\n * Proxy tracer provided by the proxy tracer provider\n *\n * @since 1.0.0\n */\nexport class ProxyTracer implements Tracer {\n // When a real implementation is provided, this will be it\n private _delegate?: Tracer;\n private _provider: TracerDelegator;\n public readonly name: string;\n public readonly version?: string;\n public readonly options?: TracerOptions;\n\n constructor(\n provider: TracerDelegator,\n name: string,\n version?: string,\n options?: TracerOptions\n ) {\n this._provider = provider;\n this.name = name;\n this.version = version;\n this.options = options;\n }\n\n startSpan(name: string, options?: SpanOptions, context?: Context): Span {\n return this._getTracer().startSpan(name, options, context);\n }\n\n startActiveSpan unknown>(\n _name: string,\n _options: F | SpanOptions,\n _context?: F | Context,\n _fn?: F\n ): ReturnType {\n const tracer = this._getTracer();\n return Reflect.apply(tracer.startActiveSpan, tracer, arguments);\n }\n\n /**\n * Try to get a tracer from the proxy tracer provider.\n * If the proxy tracer provider has no delegate, return a noop tracer.\n */\n private _getTracer() {\n if (this._delegate) {\n return this._delegate;\n }\n\n const tracer = this._provider.getDelegateTracer(\n this.name,\n this.version,\n this.options\n );\n\n if (!tracer) {\n return NOOP_TRACER;\n }\n\n this._delegate = tracer;\n return this._delegate;\n }\n}\n\n/**\n * @since 1.0.3\n */\nexport interface TracerDelegator {\n getDelegateTracer(\n name: string,\n version?: string,\n options?: TracerOptions\n ): Tracer | undefined;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracerProvider.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracerProvider.d.ts deleted file mode 100644 index 8be668a..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracerProvider.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Tracer } from './tracer'; -import type { TracerProvider } from './tracer_provider'; -import type { TracerOptions } from './tracer_options'; -/** - * Tracer provider which provides {@link ProxyTracer}s. - * - * Before a delegate is set, tracers provided are NoOp. - * When a delegate is set, traces are provided from the delegate. - * When a delegate is set after tracers have already been provided, - * all tracers already provided will use the provided delegate implementation. - * - * @deprecated This will be removed in the next major version. - * @since 1.0.0 - */ -export declare class ProxyTracerProvider implements TracerProvider { - private _delegate?; - /** - * Get a {@link ProxyTracer} - */ - getTracer(name: string, version?: string, options?: TracerOptions): Tracer; - getDelegate(): TracerProvider; - /** - * Set the delegate tracer provider - */ - setDelegate(delegate: TracerProvider): void; - getDelegateTracer(name: string, version?: string, options?: TracerOptions): Tracer | undefined; -} -//# sourceMappingURL=ProxyTracerProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracerProvider.js b/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracerProvider.js deleted file mode 100644 index c6a9aa8..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracerProvider.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { ProxyTracer } from './ProxyTracer'; -import { NoopTracerProvider } from './NoopTracerProvider'; -const NOOP_TRACER_PROVIDER = new NoopTracerProvider(); -/** - * Tracer provider which provides {@link ProxyTracer}s. - * - * Before a delegate is set, tracers provided are NoOp. - * When a delegate is set, traces are provided from the delegate. - * When a delegate is set after tracers have already been provided, - * all tracers already provided will use the provided delegate implementation. - * - * @deprecated This will be removed in the next major version. - * @since 1.0.0 - */ -export class ProxyTracerProvider { - /** - * Get a {@link ProxyTracer} - */ - getTracer(name, version, options) { - var _a; - return ((_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options)); - } - getDelegate() { - var _a; - return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER; - } - /** - * Set the delegate tracer provider - */ - setDelegate(delegate) { - this._delegate = delegate; - } - getDelegateTracer(name, version, options) { - var _a; - return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options); - } -} -//# sourceMappingURL=ProxyTracerProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracerProvider.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracerProvider.js.map deleted file mode 100644 index dd397f4..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/ProxyTracerProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ProxyTracerProvider.js","sourceRoot":"","sources":["../../../src/trace/ProxyTracerProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,mBAAmB;IAG9B;;OAEG;IACH,SAAS,CAAC,IAAY,EAAE,OAAgB,EAAE,OAAuB;;QAC/D,OAAO,CACL,MAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,mCAC9C,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAC9C,CAAC;IACJ,CAAC;IAED,WAAW;;QACT,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,oBAAoB,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAAwB;QAClC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,iBAAiB,CACf,IAAY,EACZ,OAAgB,EAChB,OAAuB;;QAEvB,OAAO,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Tracer } from './tracer';\nimport type { TracerProvider } from './tracer_provider';\nimport { ProxyTracer } from './ProxyTracer';\nimport { NoopTracerProvider } from './NoopTracerProvider';\nimport type { TracerOptions } from './tracer_options';\n\nconst NOOP_TRACER_PROVIDER = new NoopTracerProvider();\n\n/**\n * Tracer provider which provides {@link ProxyTracer}s.\n *\n * Before a delegate is set, tracers provided are NoOp.\n * When a delegate is set, traces are provided from the delegate.\n * When a delegate is set after tracers have already been provided,\n * all tracers already provided will use the provided delegate implementation.\n *\n * @deprecated This will be removed in the next major version.\n * @since 1.0.0\n */\nexport class ProxyTracerProvider implements TracerProvider {\n private _delegate?: TracerProvider;\n\n /**\n * Get a {@link ProxyTracer}\n */\n getTracer(name: string, version?: string, options?: TracerOptions): Tracer {\n return (\n this.getDelegateTracer(name, version, options) ??\n new ProxyTracer(this, name, version, options)\n );\n }\n\n getDelegate(): TracerProvider {\n return this._delegate ?? NOOP_TRACER_PROVIDER;\n }\n\n /**\n * Set the delegate tracer provider\n */\n setDelegate(delegate: TracerProvider) {\n this._delegate = delegate;\n }\n\n getDelegateTracer(\n name: string,\n version?: string,\n options?: TracerOptions\n ): Tracer | undefined {\n return this._delegate?.getTracer(name, version, options);\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/Sampler.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/Sampler.d.ts deleted file mode 100644 index 341a792..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/Sampler.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { Context } from '../context/types'; -import type { SpanAttributes } from './attributes'; -import type { Link } from './link'; -import type { SamplingResult } from './SamplingResult'; -import type { SpanKind } from './span_kind'; -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * This interface represent a sampler. Sampling is a mechanism to control the - * noise and overhead introduced by OpenTelemetry by reducing the number of - * samples of traces collected and sent to the backend. - * - * @since 1.0.0 - */ -export interface Sampler { - /** - * Checks whether span needs to be created and tracked. - * - * @param context Parent Context which may contain a span. - * @param traceId of the span to be created. It can be different from the - * traceId in the {@link SpanContext}. Typically in situations when the - * span to be created starts a new trace. - * @param spanName of the span to be created. - * @param spanKind of the span to be created. - * @param attributes Initial set of SpanAttributes for the Span being constructed. - * @param links Collection of links that will be associated with the Span to - * be created. Typically useful for batch operations. - * @returns a {@link SamplingResult}. - */ - shouldSample(context: Context, traceId: string, spanName: string, spanKind: SpanKind, attributes: SpanAttributes, links: Link[]): SamplingResult; - /** Returns the sampler name or short description with the configuration. */ - toString(): string; -} -//# sourceMappingURL=Sampler.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/Sampler.js b/node_modules/@opentelemetry/api/build/esnext/trace/Sampler.js deleted file mode 100644 index a04eda8..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/Sampler.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=Sampler.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/Sampler.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/Sampler.js.map deleted file mode 100644 index 82fc451..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/Sampler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Sampler.js","sourceRoot":"","sources":["../../../src/trace/Sampler.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport type { SpanAttributes } from './attributes';\nimport type { Link } from './link';\nimport type { SamplingResult } from './SamplingResult';\nimport type { SpanKind } from './span_kind';\n\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * This interface represent a sampler. Sampling is a mechanism to control the\n * noise and overhead introduced by OpenTelemetry by reducing the number of\n * samples of traces collected and sent to the backend.\n *\n * @since 1.0.0\n */\nexport interface Sampler {\n /**\n * Checks whether span needs to be created and tracked.\n *\n * @param context Parent Context which may contain a span.\n * @param traceId of the span to be created. It can be different from the\n * traceId in the {@link SpanContext}. Typically in situations when the\n * span to be created starts a new trace.\n * @param spanName of the span to be created.\n * @param spanKind of the span to be created.\n * @param attributes Initial set of SpanAttributes for the Span being constructed.\n * @param links Collection of links that will be associated with the Span to\n * be created. Typically useful for batch operations.\n * @returns a {@link SamplingResult}.\n */\n shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n spanKind: SpanKind,\n attributes: SpanAttributes,\n links: Link[]\n ): SamplingResult;\n\n /** Returns the sampler name or short description with the configuration. */\n toString(): string;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/SamplingResult.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/SamplingResult.d.ts deleted file mode 100644 index 3ef2299..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/SamplingResult.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import type { SpanAttributes } from './attributes'; -import type { TraceState } from './trace_state'; -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * A sampling decision that determines how a {@link Span} will be recorded - * and collected. - * - * @since 1.0.0 - */ -export declare enum SamplingDecision { - /** - * `Span.isRecording() === false`, span will not be recorded and all events - * and attributes will be dropped. - */ - NOT_RECORD = 0, - /** - * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} - * MUST NOT be set. - */ - RECORD = 1, - /** - * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} - * MUST be set. - */ - RECORD_AND_SAMPLED = 2 -} -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * A sampling result contains a decision for a {@link Span} and additional - * attributes the sampler would like to added to the Span. - * - * @since 1.0.0 - */ -export interface SamplingResult { - /** - * A sampling decision, refer to {@link SamplingDecision} for details. - */ - decision: SamplingDecision; - /** - * The list of attributes returned by SamplingResult MUST be immutable. - * Caller may call {@link Sampler}.shouldSample any number of times and - * can safely cache the returned value. - */ - attributes?: Readonly; - /** - * A {@link TraceState} that will be associated with the {@link Span} through - * the new {@link SpanContext}. Samplers SHOULD return the TraceState from - * the passed-in {@link Context} if they do not intend to change it. Leaving - * the value undefined will also leave the TraceState unchanged. - */ - traceState?: TraceState; -} -//# sourceMappingURL=SamplingResult.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/SamplingResult.js b/node_modules/@opentelemetry/api/build/esnext/trace/SamplingResult.js deleted file mode 100644 index 9acb56a..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/SamplingResult.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * A sampling decision that determines how a {@link Span} will be recorded - * and collected. - * - * @since 1.0.0 - */ -export var SamplingDecision; -(function (SamplingDecision) { - /** - * `Span.isRecording() === false`, span will not be recorded and all events - * and attributes will be dropped. - */ - SamplingDecision[SamplingDecision["NOT_RECORD"] = 0] = "NOT_RECORD"; - /** - * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} - * MUST NOT be set. - */ - SamplingDecision[SamplingDecision["RECORD"] = 1] = "RECORD"; - /** - * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} - * MUST be set. - */ - SamplingDecision[SamplingDecision["RECORD_AND_SAMPLED"] = 2] = "RECORD_AND_SAMPLED"; -})(SamplingDecision || (SamplingDecision = {})); -//# sourceMappingURL=SamplingResult.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/SamplingResult.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/SamplingResult.js.map deleted file mode 100644 index ce98b09..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/SamplingResult.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SamplingResult.js","sourceRoot":"","sources":["../../../src/trace/SamplingResult.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,gBAgBX;AAhBD,WAAY,gBAAgB;IAC1B;;;OAGG;IACH,mEAAU,CAAA;IACV;;;OAGG;IACH,2DAAM,CAAA;IACN;;;OAGG;IACH,mFAAkB,CAAA;AACpB,CAAC,EAhBW,gBAAgB,KAAhB,gBAAgB,QAgB3B","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SpanAttributes } from './attributes';\nimport type { TraceState } from './trace_state';\n\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * A sampling decision that determines how a {@link Span} will be recorded\n * and collected.\n *\n * @since 1.0.0\n */\nexport enum SamplingDecision {\n /**\n * `Span.isRecording() === false`, span will not be recorded and all events\n * and attributes will be dropped.\n */\n NOT_RECORD,\n /**\n * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}\n * MUST NOT be set.\n */\n RECORD,\n /**\n * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}\n * MUST be set.\n */\n RECORD_AND_SAMPLED,\n}\n\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * A sampling result contains a decision for a {@link Span} and additional\n * attributes the sampler would like to added to the Span.\n *\n * @since 1.0.0\n */\nexport interface SamplingResult {\n /**\n * A sampling decision, refer to {@link SamplingDecision} for details.\n */\n decision: SamplingDecision;\n /**\n * The list of attributes returned by SamplingResult MUST be immutable.\n * Caller may call {@link Sampler}.shouldSample any number of times and\n * can safely cache the returned value.\n */\n attributes?: Readonly;\n /**\n * A {@link TraceState} that will be associated with the {@link Span} through\n * the new {@link SpanContext}. Samplers SHOULD return the TraceState from\n * the passed-in {@link Context} if they do not intend to change it. Leaving\n * the value undefined will also leave the TraceState unchanged.\n */\n traceState?: TraceState;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/SpanOptions.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/SpanOptions.d.ts deleted file mode 100644 index 2021bd7..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/SpanOptions.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Attributes } from '../common/Attributes'; -import type { TimeInput } from '../common/Time'; -import type { Link } from './link'; -import type { SpanKind } from './span_kind'; -/** - * Options needed for span creation - * - * @since 1.0.0 - */ -export interface SpanOptions { - /** - * The SpanKind of a span - * @default {@link SpanKind.INTERNAL} - */ - kind?: SpanKind; - /** A span's attributes */ - attributes?: Attributes; - /** {@link Link}s span to other spans */ - links?: Link[]; - /** A manually specified start time for the created `Span` object. */ - startTime?: TimeInput; - /** The new span should be a root span. (Ignore parent from context). */ - root?: boolean; -} -//# sourceMappingURL=SpanOptions.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/SpanOptions.js b/node_modules/@opentelemetry/api/build/esnext/trace/SpanOptions.js deleted file mode 100644 index 83807c4..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/SpanOptions.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=SpanOptions.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/SpanOptions.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/SpanOptions.js.map deleted file mode 100644 index 5753122..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/SpanOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SpanOptions.js","sourceRoot":"","sources":["../../../src/trace/SpanOptions.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes } from '../common/Attributes';\nimport type { TimeInput } from '../common/Time';\nimport type { Link } from './link';\nimport type { SpanKind } from './span_kind';\n\n/**\n * Options needed for span creation\n *\n * @since 1.0.0\n */\nexport interface SpanOptions {\n /**\n * The SpanKind of a span\n * @default {@link SpanKind.INTERNAL}\n */\n kind?: SpanKind;\n\n /** A span's attributes */\n attributes?: Attributes;\n\n /** {@link Link}s span to other spans */\n links?: Link[];\n\n /** A manually specified start time for the created `Span` object. */\n startTime?: TimeInput;\n\n /** The new span should be a root span. (Ignore parent from context). */\n root?: boolean;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/attributes.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/attributes.d.ts deleted file mode 100644 index db01605..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/attributes.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Attributes, AttributeValue } from '../common/Attributes'; -/** - * @deprecated please use {@link Attributes} - * @since 1.0.0 - */ -export type SpanAttributes = Attributes; -/** - * @deprecated please use {@link AttributeValue} - * @since 1.0.0 - */ -export type SpanAttributeValue = AttributeValue; -//# sourceMappingURL=attributes.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/attributes.js b/node_modules/@opentelemetry/api/build/esnext/trace/attributes.js deleted file mode 100644 index bfb40ba..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/attributes.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=attributes.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/attributes.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/attributes.js.map deleted file mode 100644 index fcfe43a..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/attributes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../src/trace/attributes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes, AttributeValue } from '../common/Attributes';\n\n/**\n * @deprecated please use {@link Attributes}\n * @since 1.0.0\n */\nexport type SpanAttributes = Attributes;\n\n/**\n * @deprecated please use {@link AttributeValue}\n * @since 1.0.0\n */\nexport type SpanAttributeValue = AttributeValue;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/context-utils.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/context-utils.d.ts deleted file mode 100644 index 783a4ca..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/context-utils.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanContext } from './span_context'; -/** - * Return the span if one exists - * - * @param context context to get span from - */ -export declare function getSpan(context: Context): Span | undefined; -/** - * Gets the span from the current context, if one exists. - */ -export declare function getActiveSpan(): Span | undefined; -/** - * Set the span on a context - * - * @param context context to use as parent - * @param span span to set active - */ -export declare function setSpan(context: Context, span: Span): Context; -/** - * Remove current span stored in the context - * - * @param context context to delete span from - */ -export declare function deleteSpan(context: Context): Context; -/** - * Wrap span context in a NoopSpan and set as span in a new - * context - * - * @param context context to set active span on - * @param spanContext span context to be wrapped - */ -export declare function setSpanContext(context: Context, spanContext: SpanContext): Context; -/** - * Get the span context of the span if it exists. - * - * @param context context to get values from - */ -export declare function getSpanContext(context: Context): SpanContext | undefined; -//# sourceMappingURL=context-utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/context-utils.js b/node_modules/@opentelemetry/api/build/esnext/trace/context-utils.js deleted file mode 100644 index c44d08f..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/context-utils.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { createContextKey } from '../context/context'; -import { NonRecordingSpan } from './NonRecordingSpan'; -import { ContextAPI } from '../api/context'; -/** - * span key - */ -const SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN'); -/** - * Return the span if one exists - * - * @param context context to get span from - */ -export function getSpan(context) { - return context.getValue(SPAN_KEY) || undefined; -} -/** - * Gets the span from the current context, if one exists. - */ -export function getActiveSpan() { - return getSpan(ContextAPI.getInstance().active()); -} -/** - * Set the span on a context - * - * @param context context to use as parent - * @param span span to set active - */ -export function setSpan(context, span) { - return context.setValue(SPAN_KEY, span); -} -/** - * Remove current span stored in the context - * - * @param context context to delete span from - */ -export function deleteSpan(context) { - return context.deleteValue(SPAN_KEY); -} -/** - * Wrap span context in a NoopSpan and set as span in a new - * context - * - * @param context context to set active span on - * @param spanContext span context to be wrapped - */ -export function setSpanContext(context, spanContext) { - return setSpan(context, new NonRecordingSpan(spanContext)); -} -/** - * Get the span context of the span if it exists. - * - * @param context context to get values from - */ -export function getSpanContext(context) { - var _a; - return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext(); -} -//# sourceMappingURL=context-utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/context-utils.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/context-utils.js.map deleted file mode 100644 index 181731f..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/context-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context-utils.js","sourceRoot":"","sources":["../../../src/trace/context-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,QAAQ,GAAG,gBAAgB,CAAC,gCAAgC,CAAC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAgB;IACtC,OAAQ,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU,IAAI,SAAS,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAgB,EAAE,IAAU;IAClD,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAO,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgB,EAChB,WAAwB;IAExB,OAAO,OAAO,CAAC,OAAO,EAAE,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgB;;IAC7C,OAAO,MAAA,OAAO,CAAC,OAAO,CAAC,0CAAE,WAAW,EAAE,CAAC;AACzC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createContextKey } from '../context/context';\nimport type { Context } from '../context/types';\nimport type { Span } from './span';\nimport type { SpanContext } from './span_context';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport { ContextAPI } from '../api/context';\n\n/**\n * span key\n */\nconst SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');\n\n/**\n * Return the span if one exists\n *\n * @param context context to get span from\n */\nexport function getSpan(context: Context): Span | undefined {\n return (context.getValue(SPAN_KEY) as Span) || undefined;\n}\n\n/**\n * Gets the span from the current context, if one exists.\n */\nexport function getActiveSpan(): Span | undefined {\n return getSpan(ContextAPI.getInstance().active());\n}\n\n/**\n * Set the span on a context\n *\n * @param context context to use as parent\n * @param span span to set active\n */\nexport function setSpan(context: Context, span: Span): Context {\n return context.setValue(SPAN_KEY, span);\n}\n\n/**\n * Remove current span stored in the context\n *\n * @param context context to delete span from\n */\nexport function deleteSpan(context: Context): Context {\n return context.deleteValue(SPAN_KEY);\n}\n\n/**\n * Wrap span context in a NoopSpan and set as span in a new\n * context\n *\n * @param context context to set active span on\n * @param spanContext span context to be wrapped\n */\nexport function setSpanContext(\n context: Context,\n spanContext: SpanContext\n): Context {\n return setSpan(context, new NonRecordingSpan(spanContext));\n}\n\n/**\n * Get the span context of the span if it exists.\n *\n * @param context context to get values from\n */\nexport function getSpanContext(context: Context): SpanContext | undefined {\n return getSpan(context)?.spanContext();\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-impl.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-impl.d.ts deleted file mode 100644 index 47ecac8..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-impl.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { TraceState } from '../trace_state'; -/** - * TraceState must be a class and not a simple object type because of the spec - * requirement (https://www.w3.org/TR/trace-context/#tracestate-field). - * - * Here is the list of allowed mutations: - * - New key-value pair should be added into the beginning of the list - * - The value of any key can be updated. Modified keys MUST be moved to the - * beginning of the list. - */ -export declare class TraceStateImpl implements TraceState { - private _internalState; - constructor(rawTraceState?: string); - set(key: string, value: string): TraceStateImpl; - unset(key: string): TraceStateImpl; - get(key: string): string | undefined; - serialize(): string; - private _parse; - private _keys; - private _clone; -} -//# sourceMappingURL=tracestate-impl.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-impl.js b/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-impl.js deleted file mode 100644 index b763df8..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-impl.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { validateKey, validateValue } from './tracestate-validators'; -const MAX_TRACE_STATE_ITEMS = 32; -const MAX_TRACE_STATE_LEN = 512; -const LIST_MEMBERS_SEPARATOR = ','; -const LIST_MEMBER_KEY_VALUE_SPLITTER = '='; -/** - * TraceState must be a class and not a simple object type because of the spec - * requirement (https://www.w3.org/TR/trace-context/#tracestate-field). - * - * Here is the list of allowed mutations: - * - New key-value pair should be added into the beginning of the list - * - The value of any key can be updated. Modified keys MUST be moved to the - * beginning of the list. - */ -export class TraceStateImpl { - constructor(rawTraceState) { - this._internalState = new Map(); - if (rawTraceState) - this._parse(rawTraceState); - } - set(key, value) { - // TODO: Benchmark the different approaches(map vs list) and - // use the faster one. - const traceState = this._clone(); - if (traceState._internalState.has(key)) { - traceState._internalState.delete(key); - } - traceState._internalState.set(key, value); - return traceState; - } - unset(key) { - const traceState = this._clone(); - traceState._internalState.delete(key); - return traceState; - } - get(key) { - return this._internalState.get(key); - } - serialize() { - return (Array.from(this._internalState.keys()) - // Use reduceRight() because keys are stored in reverse insertion order. - .reduceRight((agg, key) => { - agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key)); - return agg; - }, []) - .join(LIST_MEMBERS_SEPARATOR)); - } - _parse(rawTraceState) { - if (rawTraceState.length > MAX_TRACE_STATE_LEN) - return; - this._internalState = rawTraceState - .split(LIST_MEMBERS_SEPARATOR) - // Use reduceRight() so new keys (.set(...)) will be placed at the beginning - .reduceRight((agg, part) => { - const listMember = part.trim(); // Optional Whitespace (OWS) handling - const i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER); - if (i !== -1) { - const key = listMember.slice(0, i); - const value = listMember.slice(i + 1, part.length); - if (validateKey(key) && validateValue(value)) { - agg.set(key, value); - } - else { - // TODO: Consider to add warning log - } - } - return agg; - }, new Map()); - // Because of the reverse() requirement, trunc must be done after map is created - if (this._internalState.size > MAX_TRACE_STATE_ITEMS) { - this._internalState = new Map(Array.from(this._internalState.entries()) - .reverse() // Use reverse same as original tracestate parse chain - .slice(0, MAX_TRACE_STATE_ITEMS)); - } - } - // @ts-expect-error TS6133 Accessed in tests only. - _keys() { - return Array.from(this._internalState.keys()).reverse(); - } - _clone() { - const traceState = new TraceStateImpl(); - traceState._internalState = new Map(this._internalState); - return traceState; - } -} -//# sourceMappingURL=tracestate-impl.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-impl.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-impl.js.map deleted file mode 100644 index 8cb7d39..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-impl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracestate-impl.js","sourceRoot":"","sources":["../../../../src/trace/internal/tracestate-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAc;IAGzB,YA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c,EAAE,CAAC;QACxC,UAAU,CAAC,cAAc,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACzD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TraceState } from '../trace_state';\nimport { validateKey, validateValue } from './tracestate-validators';\n\nconst MAX_TRACE_STATE_ITEMS = 32;\nconst MAX_TRACE_STATE_LEN = 512;\nconst LIST_MEMBERS_SEPARATOR = ',';\nconst LIST_MEMBER_KEY_VALUE_SPLITTER = '=';\n\n/**\n * TraceState must be a class and not a simple object type because of the spec\n * requirement (https://www.w3.org/TR/trace-context/#tracestate-field).\n *\n * Here is the list of allowed mutations:\n * - New key-value pair should be added into the beginning of the list\n * - The value of any key can be updated. Modified keys MUST be moved to the\n * beginning of the list.\n */\nexport class TraceStateImpl implements TraceState {\n private _internalState: Map = new Map();\n\n constructor(rawTraceState?: string) {\n if (rawTraceState) this._parse(rawTraceState);\n }\n\n set(key: string, value: string): TraceStateImpl {\n // TODO: Benchmark the different approaches(map vs list) and\n // use the faster one.\n const traceState = this._clone();\n if (traceState._internalState.has(key)) {\n traceState._internalState.delete(key);\n }\n traceState._internalState.set(key, value);\n return traceState;\n }\n\n unset(key: string): TraceStateImpl {\n const traceState = this._clone();\n traceState._internalState.delete(key);\n return traceState;\n }\n\n get(key: string): string | undefined {\n return this._internalState.get(key);\n }\n\n serialize(): string {\n return (\n Array.from(this._internalState.keys())\n // Use reduceRight() because keys are stored in reverse insertion order.\n .reduceRight((agg: string[], key) => {\n agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key));\n return agg;\n }, [])\n .join(LIST_MEMBERS_SEPARATOR)\n );\n }\n\n private _parse(rawTraceState: string) {\n if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;\n this._internalState = rawTraceState\n .split(LIST_MEMBERS_SEPARATOR)\n // Use reduceRight() so new keys (.set(...)) will be placed at the beginning\n .reduceRight((agg: Map, part: string) => {\n const listMember = part.trim(); // Optional Whitespace (OWS) handling\n const i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);\n if (i !== -1) {\n const key = listMember.slice(0, i);\n const value = listMember.slice(i + 1, part.length);\n if (validateKey(key) && validateValue(value)) {\n agg.set(key, value);\n } else {\n // TODO: Consider to add warning log\n }\n }\n return agg;\n }, new Map());\n\n // Because of the reverse() requirement, trunc must be done after map is created\n if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {\n this._internalState = new Map(\n Array.from(this._internalState.entries())\n .reverse() // Use reverse same as original tracestate parse chain\n .slice(0, MAX_TRACE_STATE_ITEMS)\n );\n }\n }\n\n // @ts-expect-error TS6133 Accessed in tests only.\n private _keys(): string[] {\n return Array.from(this._internalState.keys()).reverse();\n }\n\n private _clone(): TraceStateImpl {\n const traceState = new TraceStateImpl();\n traceState._internalState = new Map(this._internalState);\n return traceState;\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-validators.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-validators.d.ts deleted file mode 100644 index 4917f99..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-validators.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Key is opaque string up to 256 characters printable. It MUST begin with a - * lowercase letter, and can only contain lowercase letters a-z, digits 0-9, - * underscores _, dashes -, asterisks *, and forward slashes /. - * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the - * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key. - * see https://www.w3.org/TR/trace-context/#key - */ -export declare function validateKey(key: string): boolean; -/** - * Value is opaque string up to 256 characters printable ASCII RFC0020 - * characters (i.e., the range 0x20 to 0x7E) except comma , and =. - */ -export declare function validateValue(value: string): boolean; -//# sourceMappingURL=tracestate-validators.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-validators.js b/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-validators.js deleted file mode 100644 index 041ef60..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-validators.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -const VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]'; -const VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`; -const VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`; -const VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`); -const VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/; -const INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/; -/** - * Key is opaque string up to 256 characters printable. It MUST begin with a - * lowercase letter, and can only contain lowercase letters a-z, digits 0-9, - * underscores _, dashes -, asterisks *, and forward slashes /. - * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the - * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key. - * see https://www.w3.org/TR/trace-context/#key - */ -export function validateKey(key) { - return VALID_KEY_REGEX.test(key); -} -/** - * Value is opaque string up to 256 characters printable ASCII RFC0020 - * characters (i.e., the range 0x20 to 0x7E) except comma , and =. - */ -export function validateValue(value) { - return (VALID_VALUE_BASE_REGEX.test(value) && - !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value)); -} -//# sourceMappingURL=tracestate-validators.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-validators.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-validators.js.map deleted file mode 100644 index 94bfa4b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/internal/tracestate-validators.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracestate-validators.js","sourceRoot":"","sources":["../../../../src/trace/internal/tracestate-validators.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAC5C,MAAM,SAAS,GAAG,QAAQ,oBAAoB,SAAS,CAAC;AACxD,MAAM,gBAAgB,GAAG,WAAW,oBAAoB,gBAAgB,oBAAoB,QAAQ,CAAC;AACrG,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC,OAAO,SAAS,IAAI,gBAAgB,IAAI,CAAC,CAAC;AAC7E,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AACrD,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,CACL,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC;QAClC,CAAC,+BAA+B,CAAC,IAAI,CAAC,KAAK,CAAC,CAC7C,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nconst VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';\nconst VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;\nconst VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;\nconst VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`);\nconst VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;\nconst INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;\n\n/**\n * Key is opaque string up to 256 characters printable. It MUST begin with a\n * lowercase letter, and can only contain lowercase letters a-z, digits 0-9,\n * underscores _, dashes -, asterisks *, and forward slashes /.\n * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the\n * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.\n * see https://www.w3.org/TR/trace-context/#key\n */\nexport function validateKey(key: string): boolean {\n return VALID_KEY_REGEX.test(key);\n}\n\n/**\n * Value is opaque string up to 256 characters printable ASCII RFC0020\n * characters (i.e., the range 0x20 to 0x7E) except comma , and =.\n */\nexport function validateValue(value: string): boolean {\n return (\n VALID_VALUE_BASE_REGEX.test(value) &&\n !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value)\n );\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/internal/utils.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/internal/utils.d.ts deleted file mode 100644 index 7112fe5..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/internal/utils.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { TraceState } from '../trace_state'; -/** - * @since 1.1.0 - */ -export declare function createTraceState(rawTraceState?: string): TraceState; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/internal/utils.js b/node_modules/@opentelemetry/api/build/esnext/trace/internal/utils.js deleted file mode 100644 index bb637bb..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/internal/utils.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { TraceStateImpl } from './tracestate-impl'; -/** - * @since 1.1.0 - */ -export function createTraceState(rawTraceState) { - return new TraceStateImpl(rawTraceState); -} -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/internal/utils.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/internal/utils.js.map deleted file mode 100644 index 3904da3..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/internal/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/trace/internal/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,aAAsB;IACrD,OAAO,IAAI,cAAc,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TraceState } from '../trace_state';\nimport { TraceStateImpl } from './tracestate-impl';\n\n/**\n * @since 1.1.0\n */\nexport function createTraceState(rawTraceState?: string): TraceState {\n return new TraceStateImpl(rawTraceState);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/invalid-span-constants.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/invalid-span-constants.d.ts deleted file mode 100644 index d51c859..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/invalid-span-constants.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { SpanContext } from './span_context'; -/** - * @since 1.0.0 - */ -export declare const INVALID_SPANID = "0000000000000000"; -/** - * @since 1.0.0 - */ -export declare const INVALID_TRACEID = "00000000000000000000000000000000"; -/** - * @since 1.0.0 - */ -export declare const INVALID_SPAN_CONTEXT: SpanContext; -//# sourceMappingURL=invalid-span-constants.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/invalid-span-constants.js b/node_modules/@opentelemetry/api/build/esnext/trace/invalid-span-constants.js deleted file mode 100644 index d063f60..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/invalid-span-constants.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { TraceFlags } from './trace_flags'; -/** - * @since 1.0.0 - */ -export const INVALID_SPANID = '0000000000000000'; -/** - * @since 1.0.0 - */ -export const INVALID_TRACEID = '00000000000000000000000000000000'; -/** - * @since 1.0.0 - */ -export const INVALID_SPAN_CONTEXT = { - traceId: INVALID_TRACEID, - spanId: INVALID_SPANID, - traceFlags: TraceFlags.NONE, -}; -//# sourceMappingURL=invalid-span-constants.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/invalid-span-constants.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/invalid-span-constants.js.map deleted file mode 100644 index b307f45..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/invalid-span-constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"invalid-span-constants.js","sourceRoot":"","sources":["../../../src/trace/invalid-span-constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,kCAAkC,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,OAAO,EAAE,eAAe;IACxB,MAAM,EAAE,cAAc;IACtB,UAAU,EAAE,UAAU,CAAC,IAAI;CAC5B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SpanContext } from './span_context';\nimport { TraceFlags } from './trace_flags';\n\n/**\n * @since 1.0.0\n */\nexport const INVALID_SPANID = '0000000000000000';\n\n/**\n * @since 1.0.0\n */\nexport const INVALID_TRACEID = '00000000000000000000000000000000';\n\n/**\n * @since 1.0.0\n */\nexport const INVALID_SPAN_CONTEXT: SpanContext = {\n traceId: INVALID_TRACEID,\n spanId: INVALID_SPANID,\n traceFlags: TraceFlags.NONE,\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/link.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/link.d.ts deleted file mode 100644 index 6147717..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/link.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { SpanAttributes } from './attributes'; -import type { SpanContext } from './span_context'; -/** - * A pointer from the current {@link Span} to another span in the same trace or - * in a different trace. - * Few examples of Link usage. - * 1. Batch Processing: A batch of elements may contain elements associated - * with one or more traces/spans. Since there can only be one parent - * SpanContext, Link is used to keep reference to SpanContext of all - * elements in the batch. - * 2. Public Endpoint: A SpanContext in incoming client request on a public - * endpoint is untrusted from service provider perspective. In such case it - * is advisable to start a new trace with appropriate sampling decision. - * However, it is desirable to associate incoming SpanContext to new trace - * initiated on service provider side so two traces (from Client and from - * Service Provider) can be correlated. - * - * @since 1.0.0 - */ -export interface Link { - /** The {@link SpanContext} of a linked span. */ - context: SpanContext; - /** A set of {@link SpanAttributes} on the link. */ - attributes?: SpanAttributes; - /** Count of attributes of the link that were dropped due to collection limits */ - droppedAttributesCount?: number; -} -//# sourceMappingURL=link.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/link.js b/node_modules/@opentelemetry/api/build/esnext/trace/link.js deleted file mode 100644 index b714104..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/link.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=link.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/link.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/link.js.map deleted file mode 100644 index 1088c50..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/link.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/trace/link.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SpanAttributes } from './attributes';\nimport type { SpanContext } from './span_context';\n\n/**\n * A pointer from the current {@link Span} to another span in the same trace or\n * in a different trace.\n * Few examples of Link usage.\n * 1. Batch Processing: A batch of elements may contain elements associated\n * with one or more traces/spans. Since there can only be one parent\n * SpanContext, Link is used to keep reference to SpanContext of all\n * elements in the batch.\n * 2. Public Endpoint: A SpanContext in incoming client request on a public\n * endpoint is untrusted from service provider perspective. In such case it\n * is advisable to start a new trace with appropriate sampling decision.\n * However, it is desirable to associate incoming SpanContext to new trace\n * initiated on service provider side so two traces (from Client and from\n * Service Provider) can be correlated.\n *\n * @since 1.0.0\n */\nexport interface Link {\n /** The {@link SpanContext} of a linked span. */\n context: SpanContext;\n /** A set of {@link SpanAttributes} on the link. */\n attributes?: SpanAttributes;\n /** Count of attributes of the link that were dropped due to collection limits */\n droppedAttributesCount?: number;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/span.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/span.d.ts deleted file mode 100644 index f6517ca..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/span.d.ts +++ /dev/null @@ -1,132 +0,0 @@ -import type { Exception } from '../common/Exception'; -import type { TimeInput } from '../common/Time'; -import type { SpanAttributes, SpanAttributeValue } from './attributes'; -import type { SpanContext } from './span_context'; -import type { SpanStatus } from './status'; -import type { Link } from './link'; -/** - * An interface that represents a span. A span represents a single operation - * within a trace. Examples of span might include remote procedure calls or a - * in-process function calls to sub-components. A Trace has a single, top-level - * "root" Span that in turn may have zero or more child Spans, which in turn - * may have children. - * - * Spans are created by the {@link Tracer.startSpan} method. - * - * @since 1.0.0 - */ -export interface Span { - /** - * Returns the {@link SpanContext} object associated with this Span. - * - * Get an immutable, serializable identifier for this span that can be used - * to create new child spans. Returned SpanContext is usable even after the - * span ends. - * - * @returns the SpanContext object associated with this Span. - */ - spanContext(): SpanContext; - /** - * Sets an attribute to the span. - * - * Sets a single Attribute with the key and value passed as arguments. - * - * @param key the key for this attribute. - * @param value the value for this attribute. Setting a value null or - * undefined is invalid and will result in undefined behavior. - */ - setAttribute(key: string, value: SpanAttributeValue): this; - /** - * Sets attributes to the span. - * - * @param attributes the attributes that will be added. - * null or undefined attribute values - * are invalid and will result in undefined behavior. - */ - setAttributes(attributes: SpanAttributes): this; - /** - * Adds an event to the Span. - * - * @param name the name of the event. - * @param [attributesOrStartTime] the attributes that will be added; these are - * associated with this event. Can be also a start time - * if type is {@type TimeInput} and 3rd param is undefined - * @param [startTime] start time of the event. - */ - addEvent(name: string, attributesOrStartTime?: SpanAttributes | TimeInput, startTime?: TimeInput): this; - /** - * Adds a single link to the span. - * - * Links added after the creation will not affect the sampling decision. - * It is preferred span links be added at span creation. - * - * @param link the link to add. - */ - addLink(link: Link): this; - /** - * Adds multiple links to the span. - * - * Links added after the creation will not affect the sampling decision. - * It is preferred span links be added at span creation. - * - * @param links the links to add. - */ - addLinks(links: Link[]): this; - /** - * Sets the status of the span. - * - * By default, a span has status {@link SpanStatusCode.UNSET}. - * Calling this method overrides that default. - * - * The status codes have a total order: `OK > ERROR > UNSET`. - * - * - Once {@link SpanStatusCode.OK} is set, any further attempts to change - * the status are ignored. - * - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored. - * - * The `message` field is only used when {@link SpanStatusCode.ERROR} is set. - * For all other status codes, `message` is ignored. - * - * @param status The {@link SpanStatus} to set. - */ - setStatus(status: SpanStatus): this; - /** - * Updates the Span name. - * - * This will override the name provided via {@link Tracer.startSpan}. - * - * Upon this update, any sampling behavior based on Span name will depend on - * the implementation. - * - * @param name the Span name. - */ - updateName(name: string): this; - /** - * Marks the end of Span execution. - * - * Call to End of a Span MUST not have any effects on child spans. Those may - * still be running and can be ended later. - * - * Do not return `this`. The Span generally should not be used after it - * is ended so chaining is not desired in this context. - * - * @param [endTime] the time to set as Span's end time. If not provided, - * use the current time as the span's end time. - */ - end(endTime?: TimeInput): void; - /** - * Returns the flag whether this span will be recorded. - * - * @returns true if this Span is active and recording information like events - * with the `AddEvent` operation and attributes using `setAttributes`. - */ - isRecording(): boolean; - /** - * Sets exception as a span event - * @param exception the exception the only accepted values are string or Error - * @param [time] the time to set as Span's event time. If not provided, - * use the current time. - */ - recordException(exception: Exception, time?: TimeInput): void; -} -//# sourceMappingURL=span.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/span.js b/node_modules/@opentelemetry/api/build/esnext/trace/span.js deleted file mode 100644 index 6364590..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/span.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=span.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/span.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/span.js.map deleted file mode 100644 index 9961668..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/span.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"span.js","sourceRoot":"","sources":["../../../src/trace/span.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Exception } from '../common/Exception';\nimport type { TimeInput } from '../common/Time';\nimport type { SpanAttributes, SpanAttributeValue } from './attributes';\nimport type { SpanContext } from './span_context';\nimport type { SpanStatus } from './status';\nimport type { Link } from './link';\n\n/**\n * An interface that represents a span. A span represents a single operation\n * within a trace. Examples of span might include remote procedure calls or a\n * in-process function calls to sub-components. A Trace has a single, top-level\n * \"root\" Span that in turn may have zero or more child Spans, which in turn\n * may have children.\n *\n * Spans are created by the {@link Tracer.startSpan} method.\n *\n * @since 1.0.0\n */\nexport interface Span {\n /**\n * Returns the {@link SpanContext} object associated with this Span.\n *\n * Get an immutable, serializable identifier for this span that can be used\n * to create new child spans. Returned SpanContext is usable even after the\n * span ends.\n *\n * @returns the SpanContext object associated with this Span.\n */\n spanContext(): SpanContext;\n\n /**\n * Sets an attribute to the span.\n *\n * Sets a single Attribute with the key and value passed as arguments.\n *\n * @param key the key for this attribute.\n * @param value the value for this attribute. Setting a value null or\n * undefined is invalid and will result in undefined behavior.\n */\n setAttribute(key: string, value: SpanAttributeValue): this;\n\n /**\n * Sets attributes to the span.\n *\n * @param attributes the attributes that will be added.\n * null or undefined attribute values\n * are invalid and will result in undefined behavior.\n */\n setAttributes(attributes: SpanAttributes): this;\n\n /**\n * Adds an event to the Span.\n *\n * @param name the name of the event.\n * @param [attributesOrStartTime] the attributes that will be added; these are\n * associated with this event. Can be also a start time\n * if type is {@type TimeInput} and 3rd param is undefined\n * @param [startTime] start time of the event.\n */\n addEvent(\n name: string,\n attributesOrStartTime?: SpanAttributes | TimeInput,\n startTime?: TimeInput\n ): this;\n\n /**\n * Adds a single link to the span.\n *\n * Links added after the creation will not affect the sampling decision.\n * It is preferred span links be added at span creation.\n *\n * @param link the link to add.\n */\n addLink(link: Link): this;\n\n /**\n * Adds multiple links to the span.\n *\n * Links added after the creation will not affect the sampling decision.\n * It is preferred span links be added at span creation.\n *\n * @param links the links to add.\n */\n addLinks(links: Link[]): this;\n\n /**\n * Sets the status of the span.\n *\n * By default, a span has status {@link SpanStatusCode.UNSET}.\n * Calling this method overrides that default.\n *\n * The status codes have a total order: `OK > ERROR > UNSET`.\n *\n * - Once {@link SpanStatusCode.OK} is set, any further attempts to change\n * the status are ignored.\n * - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored.\n *\n * The `message` field is only used when {@link SpanStatusCode.ERROR} is set.\n * For all other status codes, `message` is ignored.\n *\n * @param status The {@link SpanStatus} to set.\n */\n setStatus(status: SpanStatus): this;\n\n /**\n * Updates the Span name.\n *\n * This will override the name provided via {@link Tracer.startSpan}.\n *\n * Upon this update, any sampling behavior based on Span name will depend on\n * the implementation.\n *\n * @param name the Span name.\n */\n updateName(name: string): this;\n\n /**\n * Marks the end of Span execution.\n *\n * Call to End of a Span MUST not have any effects on child spans. Those may\n * still be running and can be ended later.\n *\n * Do not return `this`. The Span generally should not be used after it\n * is ended so chaining is not desired in this context.\n *\n * @param [endTime] the time to set as Span's end time. If not provided,\n * use the current time as the span's end time.\n */\n end(endTime?: TimeInput): void;\n\n /**\n * Returns the flag whether this span will be recorded.\n *\n * @returns true if this Span is active and recording information like events\n * with the `AddEvent` operation and attributes using `setAttributes`.\n */\n isRecording(): boolean;\n\n /**\n * Sets exception as a span event\n * @param exception the exception the only accepted values are string or Error\n * @param [time] the time to set as Span's event time. If not provided,\n * use the current time.\n */\n recordException(exception: Exception, time?: TimeInput): void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/span_context.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/span_context.d.ts deleted file mode 100644 index 443436d..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/span_context.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { TraceState } from './trace_state'; -/** - * A SpanContext represents the portion of a {@link Span} which must be - * serialized and propagated along side of a {@link Baggage}. - * - * @since 1.0.0 - */ -export interface SpanContext { - /** - * The ID of the trace that this span belongs to. It is worldwide unique - * with practically sufficient probability by being made as 16 randomly - * generated bytes, encoded as a 32 lowercase hex characters corresponding to - * 128 bits. - */ - traceId: string; - /** - * The ID of the Span. It is globally unique with practically sufficient - * probability by being made as 8 randomly generated bytes, encoded as a 16 - * lowercase hex characters corresponding to 64 bits. - */ - spanId: string; - /** - * Only true if the SpanContext was propagated from a remote parent. - */ - isRemote?: boolean; - /** - * Trace flags to propagate. - * - * It is represented as 1 byte (bitmap). Bit to represent whether trace is - * sampled or not. When set, the least significant bit documents that the - * caller may have recorded trace data. A caller who does not record trace - * data out-of-band leaves this flag unset. - * - * see {@link TraceFlags} for valid flag values. - */ - traceFlags: number; - /** - * Tracing-system-specific info to propagate. - * - * The tracestate field value is a `list` as defined below. The `list` is a - * series of `list-members` separated by commas `,`, and a list-member is a - * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs - * surrounding `list-members` are ignored. There can be a maximum of 32 - * `list-members` in a `list`. - * More Info: https://www.w3.org/TR/trace-context/#tracestate-field - * - * Examples: - * Single tracing system (generic format): - * tracestate: rojo=00f067aa0ba902b7 - * Multiple tracing systems (with different formatting): - * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE - */ - traceState?: TraceState; -} -//# sourceMappingURL=span_context.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/span_context.js b/node_modules/@opentelemetry/api/build/esnext/trace/span_context.js deleted file mode 100644 index 740b541..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/span_context.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=span_context.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/span_context.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/span_context.js.map deleted file mode 100644 index 9c139af..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/span_context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"span_context.js","sourceRoot":"","sources":["../../../src/trace/span_context.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TraceState } from './trace_state';\n\n/**\n * A SpanContext represents the portion of a {@link Span} which must be\n * serialized and propagated along side of a {@link Baggage}.\n *\n * @since 1.0.0\n */\nexport interface SpanContext {\n /**\n * The ID of the trace that this span belongs to. It is worldwide unique\n * with practically sufficient probability by being made as 16 randomly\n * generated bytes, encoded as a 32 lowercase hex characters corresponding to\n * 128 bits.\n */\n traceId: string;\n /**\n * The ID of the Span. It is globally unique with practically sufficient\n * probability by being made as 8 randomly generated bytes, encoded as a 16\n * lowercase hex characters corresponding to 64 bits.\n */\n spanId: string;\n /**\n * Only true if the SpanContext was propagated from a remote parent.\n */\n isRemote?: boolean;\n /**\n * Trace flags to propagate.\n *\n * It is represented as 1 byte (bitmap). Bit to represent whether trace is\n * sampled or not. When set, the least significant bit documents that the\n * caller may have recorded trace data. A caller who does not record trace\n * data out-of-band leaves this flag unset.\n *\n * see {@link TraceFlags} for valid flag values.\n */\n traceFlags: number;\n /**\n * Tracing-system-specific info to propagate.\n *\n * The tracestate field value is a `list` as defined below. The `list` is a\n * series of `list-members` separated by commas `,`, and a list-member is a\n * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs\n * surrounding `list-members` are ignored. There can be a maximum of 32\n * `list-members` in a `list`.\n * More Info: https://www.w3.org/TR/trace-context/#tracestate-field\n *\n * Examples:\n * Single tracing system (generic format):\n * tracestate: rojo=00f067aa0ba902b7\n * Multiple tracing systems (with different formatting):\n * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE\n */\n traceState?: TraceState;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/span_kind.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/span_kind.d.ts deleted file mode 100644 index 03c9d0f..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/span_kind.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @since 1.0.0 - */ -export declare enum SpanKind { - /** Default value. Indicates that the span is used internally. */ - INTERNAL = 0, - /** - * Indicates that the span covers server-side handling of an RPC or other - * remote request. - */ - SERVER = 1, - /** - * Indicates that the span covers the client-side wrapper around an RPC or - * other remote request. - */ - CLIENT = 2, - /** - * Indicates that the span describes producer sending a message to a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - PRODUCER = 3, - /** - * Indicates that the span describes consumer receiving a message from a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - CONSUMER = 4 -} -//# sourceMappingURL=span_kind.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/span_kind.js b/node_modules/@opentelemetry/api/build/esnext/trace/span_kind.js deleted file mode 100644 index 65863f8..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/span_kind.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * @since 1.0.0 - */ -export var SpanKind; -(function (SpanKind) { - /** Default value. Indicates that the span is used internally. */ - SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL"; - /** - * Indicates that the span covers server-side handling of an RPC or other - * remote request. - */ - SpanKind[SpanKind["SERVER"] = 1] = "SERVER"; - /** - * Indicates that the span covers the client-side wrapper around an RPC or - * other remote request. - */ - SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT"; - /** - * Indicates that the span describes producer sending a message to a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER"; - /** - * Indicates that the span describes consumer receiving a message from a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER"; -})(SpanKind || (SpanKind = {})); -//# sourceMappingURL=span_kind.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/span_kind.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/span_kind.js.map deleted file mode 100644 index 480b32b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/span_kind.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"span_kind.js","sourceRoot":"","sources":["../../../src/trace/span_kind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,QA6BX;AA7BD,WAAY,QAAQ;IAClB,iEAAiE;IACjE,+CAAY,CAAA;IAEZ;;;OAGG;IACH,2CAAU,CAAA;IAEV;;;OAGG;IACH,2CAAU,CAAA;IAEV;;;;OAIG;IACH,+CAAY,CAAA;IAEZ;;;;OAIG;IACH,+CAAY,CAAA;AACd,CAAC,EA7BW,QAAQ,KAAR,QAAQ,QA6BnB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport enum SpanKind {\n /** Default value. Indicates that the span is used internally. */\n INTERNAL = 0,\n\n /**\n * Indicates that the span covers server-side handling of an RPC or other\n * remote request.\n */\n SERVER = 1,\n\n /**\n * Indicates that the span covers the client-side wrapper around an RPC or\n * other remote request.\n */\n CLIENT = 2,\n\n /**\n * Indicates that the span describes producer sending a message to a\n * broker. Unlike client and server, there is no direct critical path latency\n * relationship between producer and consumer spans.\n */\n PRODUCER = 3,\n\n /**\n * Indicates that the span describes consumer receiving a message from a\n * broker. Unlike client and server, there is no direct critical path latency\n * relationship between producer and consumer spans.\n */\n CONSUMER = 4,\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/spancontext-utils.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/spancontext-utils.d.ts deleted file mode 100644 index 637ef2b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/spancontext-utils.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Span } from './span'; -import type { SpanContext } from './span_context'; -/** - * @since 1.0.0 - */ -export declare function isValidTraceId(traceId: string): boolean; -/** - * @since 1.0.0 - */ -export declare function isValidSpanId(spanId: string): boolean; -/** - * Returns true if this {@link SpanContext} is valid. - * @return true if this {@link SpanContext} is valid. - * - * @since 1.0.0 - */ -export declare function isSpanContextValid(spanContext: SpanContext): boolean; -/** - * Wrap the given {@link SpanContext} in a new non-recording {@link Span} - * - * @param spanContext span context to be wrapped - * @returns a new non-recording {@link Span} with the provided context - */ -export declare function wrapSpanContext(spanContext: SpanContext): Span; -//# sourceMappingURL=spancontext-utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/spancontext-utils.js b/node_modules/@opentelemetry/api/build/esnext/trace/spancontext-utils.js deleted file mode 100644 index 5c1887f..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/spancontext-utils.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -import { INVALID_SPANID, INVALID_TRACEID } from './invalid-span-constants'; -import { NonRecordingSpan } from './NonRecordingSpan'; -// Valid characters (0-9, a-f, A-F) are marked as 1. -const isHex = new Uint8Array([ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, -]); -function isValidHex(id, length) { - // As of 1.9.0 the id was allowed to be a non-string value, - // even though it was not possible in the types. - if (typeof id !== 'string' || id.length !== length) - return false; - let r = 0; - for (let i = 0; i < id.length; i += 4) { - r += - (isHex[id.charCodeAt(i)] | 0) + - (isHex[id.charCodeAt(i + 1)] | 0) + - (isHex[id.charCodeAt(i + 2)] | 0) + - (isHex[id.charCodeAt(i + 3)] | 0); - } - return r === length; -} -/** - * @since 1.0.0 - */ -export function isValidTraceId(traceId) { - return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID; -} -/** - * @since 1.0.0 - */ -export function isValidSpanId(spanId) { - return isValidHex(spanId, 16) && spanId !== INVALID_SPANID; -} -/** - * Returns true if this {@link SpanContext} is valid. - * @return true if this {@link SpanContext} is valid. - * - * @since 1.0.0 - */ -export function isSpanContextValid(spanContext) { - return (isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId)); -} -/** - * Wrap the given {@link SpanContext} in a new non-recording {@link Span} - * - * @param spanContext span context to be wrapped - * @returns a new non-recording {@link Span} with the provided context - */ -export function wrapSpanContext(spanContext) { - return new NonRecordingSpan(spanContext); -} -//# sourceMappingURL=spancontext-utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/spancontext-utils.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/spancontext-utils.js.map deleted file mode 100644 index 4844cb5..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/spancontext-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"spancontext-utils.js","sourceRoot":"","sources":["../../../src/trace/spancontext-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,oDAAoD;AACpD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC;IAC3B,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC5E,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC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AC;gBACjC,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBACjC,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;KACrC;IAED,OAAO,CAAC,KAAK,MAAM,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,OAAO,KAAK,eAAe,CAAC;AAChE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAO,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,KAAK,cAAc,CAAC;AAC7D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAwB;IACzD,OAAO,CACL,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CACzE,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,WAAwB;IACtD,OAAO,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { INVALID_SPANID, INVALID_TRACEID } from './invalid-span-constants';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport type { Span } from './span';\nimport type { SpanContext } from './span_context';\n\n// Valid characters (0-9, a-f, A-F) are marked as 1.\nconst isHex = new Uint8Array([\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,\n]);\n\nfunction isValidHex(id: string, length: number): boolean {\n // As of 1.9.0 the id was allowed to be a non-string value,\n // even though it was not possible in the types.\n if (typeof id !== 'string' || id.length !== length) return false;\n\n let r = 0;\n for (let i = 0; i < id.length; i += 4) {\n r +=\n (isHex[id.charCodeAt(i)] | 0) +\n (isHex[id.charCodeAt(i + 1)] | 0) +\n (isHex[id.charCodeAt(i + 2)] | 0) +\n (isHex[id.charCodeAt(i + 3)] | 0);\n }\n\n return r === length;\n}\n\n/**\n * @since 1.0.0\n */\nexport function isValidTraceId(traceId: string): boolean {\n return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;\n}\n\n/**\n * @since 1.0.0\n */\nexport function isValidSpanId(spanId: string): boolean {\n return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;\n}\n\n/**\n * Returns true if this {@link SpanContext} is valid.\n * @return true if this {@link SpanContext} is valid.\n *\n * @since 1.0.0\n */\nexport function isSpanContextValid(spanContext: SpanContext): boolean {\n return (\n isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId)\n );\n}\n\n/**\n * Wrap the given {@link SpanContext} in a new non-recording {@link Span}\n *\n * @param spanContext span context to be wrapped\n * @returns a new non-recording {@link Span} with the provided context\n */\nexport function wrapSpanContext(spanContext: SpanContext): Span {\n return new NonRecordingSpan(spanContext);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/status.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/status.d.ts deleted file mode 100644 index 77cbacb..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/status.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @since 1.0.0 - */ -export interface SpanStatus { - /** The status code of this message. */ - code: SpanStatusCode; - /** A developer-facing error message. */ - message?: string; -} -/** - * An enumeration of status codes. - * - * @since 1.0.0 - */ -export declare enum SpanStatusCode { - /** - * The default status. - */ - UNSET = 0, - /** - * The operation has been validated by an Application developer or - * Operator to have completed successfully. - */ - OK = 1, - /** - * The operation contains an error. - */ - ERROR = 2 -} -//# sourceMappingURL=status.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/status.js b/node_modules/@opentelemetry/api/build/esnext/trace/status.js deleted file mode 100644 index 2969ab7..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/status.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * An enumeration of status codes. - * - * @since 1.0.0 - */ -export var SpanStatusCode; -(function (SpanStatusCode) { - /** - * The default status. - */ - SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET"; - /** - * The operation has been validated by an Application developer or - * Operator to have completed successfully. - */ - SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK"; - /** - * The operation contains an error. - */ - SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR"; -})(SpanStatusCode || (SpanStatusCode = {})); -//# sourceMappingURL=status.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/status.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/status.js.map deleted file mode 100644 index 7089c72..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/status.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/trace/status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;GAIG;AACH,MAAM,CAAN,IAAY,cAcX;AAdD,WAAY,cAAc;IACxB;;OAEG;IACH,qDAAS,CAAA;IACT;;;OAGG;IACH,+CAAM,CAAA;IACN;;OAEG;IACH,qDAAS,CAAA;AACX,CAAC,EAdW,cAAc,KAAd,cAAc,QAczB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface SpanStatus {\n /** The status code of this message. */\n code: SpanStatusCode;\n /** A developer-facing error message. */\n message?: string;\n}\n\n/**\n * An enumeration of status codes.\n *\n * @since 1.0.0\n */\nexport enum SpanStatusCode {\n /**\n * The default status.\n */\n UNSET = 0,\n /**\n * The operation has been validated by an Application developer or\n * Operator to have completed successfully.\n */\n OK = 1,\n /**\n * The operation contains an error.\n */\n ERROR = 2,\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/trace_flags.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/trace_flags.d.ts deleted file mode 100644 index 9977efc..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/trace_flags.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @since 1.0.0 - */ -export declare enum TraceFlags { - /** Represents no flag set. */ - NONE = 0, - /** Bit to represent whether trace is sampled in trace flags. */ - SAMPLED = 1 -} -//# sourceMappingURL=trace_flags.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/trace_flags.js b/node_modules/@opentelemetry/api/build/esnext/trace/trace_flags.js deleted file mode 100644 index 1242ee3..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/trace_flags.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * @since 1.0.0 - */ -export var TraceFlags; -(function (TraceFlags) { - /** Represents no flag set. */ - TraceFlags[TraceFlags["NONE"] = 0] = "NONE"; - /** Bit to represent whether trace is sampled in trace flags. */ - TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED"; -})(TraceFlags || (TraceFlags = {})); -//# sourceMappingURL=trace_flags.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/trace_flags.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/trace_flags.js.map deleted file mode 100644 index 8fd3c66..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/trace_flags.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace_flags.js","sourceRoot":"","sources":["../../../src/trace/trace_flags.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AACH,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,8BAA8B;IAC9B,2CAAU,CAAA;IACV,gEAAgE;IAChE,iDAAkB,CAAA;AACpB,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @since 1.0.0\n */\nexport enum TraceFlags {\n /** Represents no flag set. */\n NONE = 0x0,\n /** Bit to represent whether trace is sampled in trace flags. */\n SAMPLED = 0x1 << 0,\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/trace_state.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/trace_state.d.ts deleted file mode 100644 index 2c7cf02..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/trace_state.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @since 1.0.0 - */ -export interface TraceState { - /** - * Create a new TraceState which inherits from this TraceState and has the - * given key set. - * The new entry will always be added in the front of the list of states. - * - * @param key key of the TraceState entry. - * @param value value of the TraceState entry. - */ - set(key: string, value: string): TraceState; - /** - * Return a new TraceState which inherits from this TraceState but does not - * contain the given key. - * - * @param key the key for the TraceState entry to be removed. - */ - unset(key: string): TraceState; - /** - * Returns the value to which the specified key is mapped, or `undefined` if - * this map contains no mapping for the key. - * - * @param key with which the specified value is to be associated. - * @returns the value to which the specified key is mapped, or `undefined` if - * this map contains no mapping for the key. - */ - get(key: string): string | undefined; - /** - * Serializes the TraceState to a `list` as defined below. The `list` is a - * series of `list-members` separated by commas `,`, and a list-member is a - * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs - * surrounding `list-members` are ignored. There can be a maximum of 32 - * `list-members` in a `list`. - * - * @returns the serialized string. - */ - serialize(): string; -} -//# sourceMappingURL=trace_state.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/trace_state.js b/node_modules/@opentelemetry/api/build/esnext/trace/trace_state.js deleted file mode 100644 index 1efb1c9..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/trace_state.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=trace_state.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/trace_state.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/trace_state.js.map deleted file mode 100644 index 2d6bdb4..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/trace_state.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace_state.js","sourceRoot":"","sources":["../../../src/trace/trace_state.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface TraceState {\n /**\n * Create a new TraceState which inherits from this TraceState and has the\n * given key set.\n * The new entry will always be added in the front of the list of states.\n *\n * @param key key of the TraceState entry.\n * @param value value of the TraceState entry.\n */\n set(key: string, value: string): TraceState;\n\n /**\n * Return a new TraceState which inherits from this TraceState but does not\n * contain the given key.\n *\n * @param key the key for the TraceState entry to be removed.\n */\n unset(key: string): TraceState;\n\n /**\n * Returns the value to which the specified key is mapped, or `undefined` if\n * this map contains no mapping for the key.\n *\n * @param key with which the specified value is to be associated.\n * @returns the value to which the specified key is mapped, or `undefined` if\n * this map contains no mapping for the key.\n */\n get(key: string): string | undefined;\n\n // TODO: Consider to add support for merging an object as well by also\n // accepting a single internalTraceState argument similar to the constructor.\n\n /**\n * Serializes the TraceState to a `list` as defined below. The `list` is a\n * series of `list-members` separated by commas `,`, and a list-member is a\n * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs\n * surrounding `list-members` are ignored. There can be a maximum of 32\n * `list-members` in a `list`.\n *\n * @returns the serialized string.\n */\n serialize(): string;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/tracer.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/tracer.d.ts deleted file mode 100644 index d1ecaef..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/tracer.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanOptions } from './SpanOptions'; -/** - * Tracer provides an interface for creating {@link Span}s. - * - * @since 1.0.0 - */ -export interface Tracer { - /** - * Starts a new {@link Span}. Start the span without setting it on context. - * - * This method do NOT modify the current Context. - * - * @param name The name of the span - * @param [options] SpanOptions used for span creation - * @param [context] Context to use to extract parent - * @returns Span The newly created span - * @example - * const span = tracer.startSpan('op'); - * span.setAttribute('key', 'value'); - * span.end(); - */ - startSpan(name: string, options?: SpanOptions, context?: Context): Span; - /** - * Starts a new {@link Span} and calls the given function passing it the - * created span as first argument. - * Additionally the new span gets set in context and this context is activated - * for the duration of the function call. - * - * @param name The name of the span - * @param [options] SpanOptions used for span creation - * @param [context] Context to use to extract parent - * @param fn function called in the context of the span and receives the newly created span as an argument - * @returns return value of fn - * @example - * const something = tracer.startActiveSpan('op', span => { - * try { - * do some work - * span.setStatus({code: SpanStatusCode.OK}); - * return something; - * } catch (err) { - * span.setStatus({ - * code: SpanStatusCode.ERROR, - * message: err.message, - * }); - * throw err; - * } finally { - * span.end(); - * } - * }); - * - * @example - * const span = tracer.startActiveSpan('op', span => { - * try { - * do some work - * return span; - * } catch (err) { - * span.setStatus({ - * code: SpanStatusCode.ERROR, - * message: err.message, - * }); - * throw err; - * } - * }); - * do some more work - * span.end(); - */ - startActiveSpan unknown>(name: string, fn: F): ReturnType; - startActiveSpan unknown>(name: string, options: SpanOptions, fn: F): ReturnType; - startActiveSpan unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType; -} -//# sourceMappingURL=tracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/tracer.js b/node_modules/@opentelemetry/api/build/esnext/trace/tracer.js deleted file mode 100644 index f7b7a75..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/tracer.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=tracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/tracer.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/tracer.js.map deleted file mode 100644 index abfdfbc..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/tracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracer.js","sourceRoot":"","sources":["../../../src/trace/tracer.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport type { Span } from './span';\nimport type { SpanOptions } from './SpanOptions';\n\n/**\n * Tracer provides an interface for creating {@link Span}s.\n *\n * @since 1.0.0\n */\nexport interface Tracer {\n /**\n * Starts a new {@link Span}. Start the span without setting it on context.\n *\n * This method do NOT modify the current Context.\n *\n * @param name The name of the span\n * @param [options] SpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @returns Span The newly created span\n * @example\n * const span = tracer.startSpan('op');\n * span.setAttribute('key', 'value');\n * span.end();\n */\n startSpan(name: string, options?: SpanOptions, context?: Context): Span;\n\n /**\n * Starts a new {@link Span} and calls the given function passing it the\n * created span as first argument.\n * Additionally the new span gets set in context and this context is activated\n * for the duration of the function call.\n *\n * @param name The name of the span\n * @param [options] SpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns return value of fn\n * @example\n * const something = tracer.startActiveSpan('op', span => {\n * try {\n * do some work\n * span.setStatus({code: SpanStatusCode.OK});\n * return something;\n * } catch (err) {\n * span.setStatus({\n * code: SpanStatusCode.ERROR,\n * message: err.message,\n * });\n * throw err;\n * } finally {\n * span.end();\n * }\n * });\n *\n * @example\n * const span = tracer.startActiveSpan('op', span => {\n * try {\n * do some work\n * return span;\n * } catch (err) {\n * span.setStatus({\n * code: SpanStatusCode.ERROR,\n * message: err.message,\n * });\n * throw err;\n * }\n * });\n * do some more work\n * span.end();\n */\n startActiveSpan unknown>(\n name: string,\n fn: F\n ): ReturnType;\n startActiveSpan unknown>(\n name: string,\n options: SpanOptions,\n fn: F\n ): ReturnType;\n startActiveSpan unknown>(\n name: string,\n options: SpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_options.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/tracer_options.d.ts deleted file mode 100644 index ab4e483..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_options.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * An interface describes additional metadata of a tracer. - * - * @since 1.3.0 - */ -export interface TracerOptions { - /** - * The schemaUrl of the tracer or instrumentation library - */ - schemaUrl?: string; -} -//# sourceMappingURL=tracer_options.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_options.js b/node_modules/@opentelemetry/api/build/esnext/trace/tracer_options.js deleted file mode 100644 index c82e483..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_options.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=tracer_options.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_options.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/tracer_options.js.map deleted file mode 100644 index fd8375b..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_options.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracer_options.js","sourceRoot":"","sources":["../../../src/trace/tracer_options.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An interface describes additional metadata of a tracer.\n *\n * @since 1.3.0\n */\nexport interface TracerOptions {\n /**\n * The schemaUrl of the tracer or instrumentation library\n */\n schemaUrl?: string;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_provider.d.ts b/node_modules/@opentelemetry/api/build/esnext/trace/tracer_provider.d.ts deleted file mode 100644 index eacef7f..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_provider.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { Tracer } from './tracer'; -import type { TracerOptions } from './tracer_options'; -/** - * A registry for creating named {@link Tracer}s. - * - * @since 1.0.0 - */ -export interface TracerProvider { - /** - * Returns a Tracer, creating one if one with the given name and version is - * not already created. - * - * This function may return different Tracer types (e.g. - * {@link NoopTracerProvider} vs. a functional tracer). - * - * @param name The name of the tracer or instrumentation library. - * @param version The version of the tracer or instrumentation library. - * @param options The options of the tracer or instrumentation library. - * @returns Tracer A Tracer with the given name and version - */ - getTracer(name: string, version?: string, options?: TracerOptions): Tracer; -} -//# sourceMappingURL=tracer_provider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_provider.js b/node_modules/@opentelemetry/api/build/esnext/trace/tracer_provider.js deleted file mode 100644 index b06f420..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_provider.js +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -export {}; -//# sourceMappingURL=tracer_provider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_provider.js.map b/node_modules/@opentelemetry/api/build/esnext/trace/tracer_provider.js.map deleted file mode 100644 index 9f5ef09..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/trace/tracer_provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracer_provider.js","sourceRoot":"","sources":["../../../src/trace/tracer_provider.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Tracer } from './tracer';\nimport type { TracerOptions } from './tracer_options';\n\n/**\n * A registry for creating named {@link Tracer}s.\n *\n * @since 1.0.0\n */\nexport interface TracerProvider {\n /**\n * Returns a Tracer, creating one if one with the given name and version is\n * not already created.\n *\n * This function may return different Tracer types (e.g.\n * {@link NoopTracerProvider} vs. a functional tracer).\n *\n * @param name The name of the tracer or instrumentation library.\n * @param version The version of the tracer or instrumentation library.\n * @param options The options of the tracer or instrumentation library.\n * @returns Tracer A Tracer with the given name and version\n */\n getTracer(name: string, version?: string, options?: TracerOptions): Tracer;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/version.d.ts b/node_modules/@opentelemetry/api/build/esnext/version.d.ts deleted file mode 100644 index fe80997..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/version.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const VERSION = "1.9.1"; -//# sourceMappingURL=version.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/version.js b/node_modules/@opentelemetry/api/build/esnext/version.js deleted file mode 100644 index f409ae4..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/version.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// this is autogenerated file, see scripts/version-update.js -export const VERSION = '1.9.1'; -//# sourceMappingURL=version.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/esnext/version.js.map b/node_modules/@opentelemetry/api/build/esnext/version.js.map deleted file mode 100644 index f1e6503..0000000 --- a/node_modules/@opentelemetry/api/build/esnext/version.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '1.9.1';\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/context.d.ts b/node_modules/@opentelemetry/api/build/src/api/context.d.ts deleted file mode 100644 index 7771d2a..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/context.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { Context, ContextManager } from '../context/types'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Context API - * - * @since 1.0.0 - */ -export declare class ContextAPI { - private static _instance?; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Context API */ - static getInstance(): ContextAPI; - /** - * Set the current context manager. - * - * @returns true if the context manager was successfully registered, else false - */ - setGlobalContextManager(contextManager: ContextManager): boolean; - /** - * Get the currently active context - */ - active(): Context; - /** - * Execute a function with an active context - * - * @param context context to be active during function execution - * @param fn function to execute in a context - * @param thisArg optional receiver to be used for calling fn - * @param args optional arguments forwarded to fn - */ - with ReturnType>(context: Context, fn: F, thisArg?: ThisParameterType, ...args: A): ReturnType; - /** - * Bind a context to a target function or event emitter - * - * @param context context to bind to the event emitter or function. Defaults to the currently active context - * @param target function or event emitter to bind - */ - bind(context: Context, target: T): T; - private _getContextManager; - /** Disable and remove the global context manager */ - disable(): void; -} -//# sourceMappingURL=context.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/context.js b/node_modules/@opentelemetry/api/build/src/api/context.js deleted file mode 100644 index 244c1a7..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/context.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ContextAPI = void 0; -const NoopContextManager_1 = require("../context/NoopContextManager"); -const global_utils_1 = require("../internal/global-utils"); -const diag_1 = require("./diag"); -const API_NAME = 'context'; -const NOOP_CONTEXT_MANAGER = new NoopContextManager_1.NoopContextManager(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Context API - * - * @since 1.0.0 - */ -class ContextAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { } - /** Get the singleton instance of the Context API */ - static getInstance() { - if (!this._instance) { - this._instance = new ContextAPI(); - } - return this._instance; - } - /** - * Set the current context manager. - * - * @returns true if the context manager was successfully registered, else false - */ - setGlobalContextManager(contextManager) { - return (0, global_utils_1.registerGlobal)(API_NAME, contextManager, diag_1.DiagAPI.instance()); - } - /** - * Get the currently active context - */ - active() { - return this._getContextManager().active(); - } - /** - * Execute a function with an active context - * - * @param context context to be active during function execution - * @param fn function to execute in a context - * @param thisArg optional receiver to be used for calling fn - * @param args optional arguments forwarded to fn - */ - with(context, fn, thisArg, ...args) { - return this._getContextManager().with(context, fn, thisArg, ...args); - } - /** - * Bind a context to a target function or event emitter - * - * @param context context to bind to the event emitter or function. Defaults to the currently active context - * @param target function or event emitter to bind - */ - bind(context, target) { - return this._getContextManager().bind(context, target); - } - _getContextManager() { - return (0, global_utils_1.getGlobal)(API_NAME) || NOOP_CONTEXT_MANAGER; - } - /** Disable and remove the global context manager */ - disable() { - this._getContextManager().disable(); - (0, global_utils_1.unregisterGlobal)(API_NAME, diag_1.DiagAPI.instance()); - } -} -exports.ContextAPI = ContextAPI; -//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/context.js.map b/node_modules/@opentelemetry/api/build/src/api/context.js.map deleted file mode 100644 index 21541ee..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/api/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sEAAmE;AAEnE,2DAIkC;AAClC,iCAAiC;AAEjC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,oBAAoB,GAAG,IAAI,uCAAkB,EAAE,CAAC;AAEtD;;;;GAIG;AACH,MAAa,UAAU;IAGrB,+FAA+F;IAC/F,gBAAuB,CAAC;IAExB,oDAAoD;IAC7C,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,UAAU,EAAE,CAAC;SACnC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,uBAAuB,CAAC,cAA8B;QAC3D,OAAO,IAAA,6BAAc,EAAC,QAAQ,EAAE,cAAc,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACI,MAAM;QACX,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACI,IAAI,CACT,OAAgB,EAChB,EAAK,EACL,OAA8B,EAC9B,GAAG,IAAO;QAEV,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAI,OAAgB,EAAE,MAAS;QACxC,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAEO,kBAAkB;QACxB,OAAO,IAAA,wBAAS,EAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC;IACrD,CAAC;IAED,oDAAoD;IAC7C,OAAO;QACZ,IAAI,CAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,CAAC;QACpC,IAAA,+BAAgB,EAAC,QAAQ,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;CACF;AAnED,gCAmEC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { NoopContextManager } from '../context/NoopContextManager';\nimport type { Context, ContextManager } from '../context/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'context';\nconst NOOP_CONTEXT_MANAGER = new NoopContextManager();\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Context API\n *\n * @since 1.0.0\n */\nexport class ContextAPI {\n private static _instance?: ContextAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Context API */\n public static getInstance(): ContextAPI {\n if (!this._instance) {\n this._instance = new ContextAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current context manager.\n *\n * @returns true if the context manager was successfully registered, else false\n */\n public setGlobalContextManager(contextManager: ContextManager): boolean {\n return registerGlobal(API_NAME, contextManager, DiagAPI.instance());\n }\n\n /**\n * Get the currently active context\n */\n public active(): Context {\n return this._getContextManager().active();\n }\n\n /**\n * Execute a function with an active context\n *\n * @param context context to be active during function execution\n * @param fn function to execute in a context\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n public with ReturnType>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType,\n ...args: A\n ): ReturnType {\n return this._getContextManager().with(context, fn, thisArg, ...args);\n }\n\n /**\n * Bind a context to a target function or event emitter\n *\n * @param context context to bind to the event emitter or function. Defaults to the currently active context\n * @param target function or event emitter to bind\n */\n public bind(context: Context, target: T): T {\n return this._getContextManager().bind(context, target);\n }\n\n private _getContextManager(): ContextManager {\n return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;\n }\n\n /** Disable and remove the global context manager */\n public disable() {\n this._getContextManager().disable();\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/diag.d.ts b/node_modules/@opentelemetry/api/build/src/api/diag.d.ts deleted file mode 100644 index 478c771..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/diag.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { ComponentLoggerOptions, DiagLogFunction, DiagLogger, DiagLoggerApi } from '../diag/types'; -/** - * Singleton object which represents the entry point to the OpenTelemetry internal - * diagnostic API - * - * @since 1.0.0 - */ -export declare class DiagAPI implements DiagLogger, DiagLoggerApi { - private static _instance?; - /** Get the singleton instance of the DiagAPI API */ - static instance(): DiagAPI; - /** - * Private internal constructor - * @private - */ - private constructor(); - setLogger: DiagLoggerApi['setLogger']; - /** - * - */ - createComponentLogger: (options: ComponentLoggerOptions) => DiagLogger; - verbose: DiagLogFunction; - debug: DiagLogFunction; - info: DiagLogFunction; - warn: DiagLogFunction; - error: DiagLogFunction; - /** - * Unregister the global logger and return to Noop - */ - disable: () => void; -} -//# sourceMappingURL=diag.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/diag.js b/node_modules/@opentelemetry/api/build/src/api/diag.js deleted file mode 100644 index 2ab4b71..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/diag.js +++ /dev/null @@ -1,84 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DiagAPI = void 0; -const ComponentLogger_1 = require("../diag/ComponentLogger"); -const logLevelLogger_1 = require("../diag/internal/logLevelLogger"); -const types_1 = require("../diag/types"); -const global_utils_1 = require("../internal/global-utils"); -const API_NAME = 'diag'; -/** - * Singleton object which represents the entry point to the OpenTelemetry internal - * diagnostic API - * - * @since 1.0.0 - */ -class DiagAPI { - /** Get the singleton instance of the DiagAPI API */ - static instance() { - if (!this._instance) { - this._instance = new DiagAPI(); - } - return this._instance; - } - /** - * Private internal constructor - * @private - */ - constructor() { - function _logProxy(funcName) { - return function (...args) { - const logger = (0, global_utils_1.getGlobal)('diag'); - // shortcut if logger not set - if (!logger) - return; - return logger[funcName](...args); - }; - } - // Using self local variable for minification purposes as 'this' cannot be minified - const self = this; - // DiagAPI specific functions - const setLogger = (logger, optionsOrLogLevel = { logLevel: types_1.DiagLogLevel.INFO }) => { - var _a, _b, _c; - if (logger === self) { - // There isn't much we can do here. - // Logging to the console might break the user application. - // Try to log to self. If a logger was previously registered it will receive the log. - const err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'); - self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message); - return false; - } - if (typeof optionsOrLogLevel === 'number') { - optionsOrLogLevel = { - logLevel: optionsOrLogLevel, - }; - } - const oldLogger = (0, global_utils_1.getGlobal)('diag'); - const newLogger = (0, logLevelLogger_1.createLogLevelDiagLogger)((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : types_1.DiagLogLevel.INFO, logger); - // There already is an logger registered. We'll let it know before overwriting it. - if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) { - const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : ''; - oldLogger.warn(`Current logger will be overwritten from ${stack}`); - newLogger.warn(`Current logger will overwrite one already registered from ${stack}`); - } - return (0, global_utils_1.registerGlobal)('diag', newLogger, self, true); - }; - self.setLogger = setLogger; - self.disable = () => { - (0, global_utils_1.unregisterGlobal)(API_NAME, self); - }; - self.createComponentLogger = (options) => { - return new ComponentLogger_1.DiagComponentLogger(options); - }; - self.verbose = _logProxy('verbose'); - self.debug = _logProxy('debug'); - self.info = _logProxy('info'); - self.warn = _logProxy('warn'); - self.error = _logProxy('error'); - } -} -exports.DiagAPI = DiagAPI; -//# sourceMappingURL=diag.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/diag.js.map b/node_modules/@opentelemetry/api/build/src/api/diag.js.map deleted file mode 100644 index 6b10e48..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/diag.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diag.js","sourceRoot":"","sources":["../../../src/api/diag.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAA8D;AAC9D,oEAA2E;AAO3E,yCAA6C;AAC7C,2DAIkC;AAElC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAExB;;;;;GAKG;AACH,MAAa,OAAO;IAGlB,oDAAoD;IAC7C,MAAM,CAAC,QAAQ;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH;QACE,SAAS,SAAS,CAAC,QAA0B;YAC3C,OAAO,UAAU,GAAG,IAAI;gBACtB,MAAM,MAAM,GAAG,IAAA,wBAAS,EAAC,MAAM,CAAC,CAAC;gBACjC,6BAA6B;gBAC7B,IAAI,CAAC,MAAM;oBAAE,OAAO;gBACpB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;YACnC,CAAC,CAAC;QACJ,CAAC;QAED,mFAAmF;QACnF,MAAM,IAAI,GAAG,IAAI,CAAC;QAElB,6BAA6B;QAE7B,MAAM,SAAS,GAA+B,C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,GAAG,CAAC,OAA+B,EAAE,EAAE;YAC/D,OAAO,IAAI,qCAAmB,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CAqBF;AAzGD,0BAyGC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DiagComponentLogger } from '../diag/ComponentLogger';\nimport { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';\nimport type {\n ComponentLoggerOptions,\n DiagLogFunction,\n DiagLogger,\n DiagLoggerApi,\n} from '../diag/types';\nimport { DiagLogLevel } from '../diag/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\n\nconst API_NAME = 'diag';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry internal\n * diagnostic API\n *\n * @since 1.0.0\n */\nexport class DiagAPI implements DiagLogger, DiagLoggerApi {\n private static _instance?: DiagAPI;\n\n /** Get the singleton instance of the DiagAPI API */\n public static instance(): DiagAPI {\n if (!this._instance) {\n this._instance = new DiagAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Private internal constructor\n * @private\n */\n private constructor() {\n function _logProxy(funcName: keyof DiagLogger): DiagLogFunction {\n return function (...args) {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) return;\n return logger[funcName](...args);\n };\n }\n\n // Using self local variable for minification purposes as 'this' cannot be minified\n const self = this;\n\n // DiagAPI specific functions\n\n const setLogger: DiagLoggerApi['setLogger'] = (\n logger,\n optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }\n ) => {\n if (logger === self) {\n // There isn't much we can do here.\n // Logging to the console might break the user application.\n // Try to log to self. If a logger was previously registered it will receive the log.\n const err = new Error(\n 'Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'\n );\n self.error(err.stack ?? err.message);\n return false;\n }\n\n if (typeof optionsOrLogLevel === 'number') {\n optionsOrLogLevel = {\n logLevel: optionsOrLogLevel,\n };\n }\n\n const oldLogger = getGlobal('diag');\n const newLogger = createLogLevelDiagLogger(\n optionsOrLogLevel.logLevel ?? DiagLogLevel.INFO,\n logger\n );\n // There already is an logger registered. We'll let it know before overwriting it.\n if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {\n const stack = new Error().stack ?? '';\n oldLogger.warn(`Current logger will be overwritten from ${stack}`);\n newLogger.warn(\n `Current logger will overwrite one already registered from ${stack}`\n );\n }\n\n return registerGlobal('diag', newLogger, self, true);\n };\n\n self.setLogger = setLogger;\n\n self.disable = () => {\n unregisterGlobal(API_NAME, self);\n };\n\n self.createComponentLogger = (options: ComponentLoggerOptions) => {\n return new DiagComponentLogger(options);\n };\n\n self.verbose = _logProxy('verbose');\n self.debug = _logProxy('debug');\n self.info = _logProxy('info');\n self.warn = _logProxy('warn');\n self.error = _logProxy('error');\n }\n\n public setLogger!: DiagLoggerApi['setLogger'];\n /**\n *\n */\n public createComponentLogger!: (\n options: ComponentLoggerOptions\n ) => DiagLogger;\n\n // DiagLogger implementation\n public verbose!: DiagLogFunction;\n public debug!: DiagLogFunction;\n public info!: DiagLogFunction;\n public warn!: DiagLogFunction;\n public error!: DiagLogFunction;\n\n /**\n * Unregister the global logger and return to Noop\n */\n public disable!: () => void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/metrics.d.ts b/node_modules/@opentelemetry/api/build/src/api/metrics.d.ts deleted file mode 100644 index 09d2147..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/metrics.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Meter, MeterOptions } from '../metrics/Meter'; -import type { MeterProvider } from '../metrics/MeterProvider'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Metrics API - */ -export declare class MetricsAPI { - private static _instance?; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Metrics API */ - static getInstance(): MetricsAPI; - /** - * Set the current global meter provider. - * Returns true if the meter provider was successfully registered, else false. - */ - setGlobalMeterProvider(provider: MeterProvider): boolean; - /** - * Returns the global meter provider. - */ - getMeterProvider(): MeterProvider; - /** - * Returns a meter from the global meter provider. - */ - getMeter(name: string, version?: string, options?: MeterOptions): Meter; - /** Remove the global meter provider */ - disable(): void; -} -//# sourceMappingURL=metrics.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/metrics.js b/node_modules/@opentelemetry/api/build/src/api/metrics.js deleted file mode 100644 index f145fc1..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/metrics.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MetricsAPI = void 0; -const NoopMeterProvider_1 = require("../metrics/NoopMeterProvider"); -const global_utils_1 = require("../internal/global-utils"); -const diag_1 = require("./diag"); -const API_NAME = 'metrics'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Metrics API - */ -class MetricsAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { } - /** Get the singleton instance of the Metrics API */ - static getInstance() { - if (!this._instance) { - this._instance = new MetricsAPI(); - } - return this._instance; - } - /** - * Set the current global meter provider. - * Returns true if the meter provider was successfully registered, else false. - */ - setGlobalMeterProvider(provider) { - return (0, global_utils_1.registerGlobal)(API_NAME, provider, diag_1.DiagAPI.instance()); - } - /** - * Returns the global meter provider. - */ - getMeterProvider() { - return (0, global_utils_1.getGlobal)(API_NAME) || NoopMeterProvider_1.NOOP_METER_PROVIDER; - } - /** - * Returns a meter from the global meter provider. - */ - getMeter(name, version, options) { - return this.getMeterProvider().getMeter(name, version, options); - } - /** Remove the global meter provider */ - disable() { - (0, global_utils_1.unregisterGlobal)(API_NAME, diag_1.DiagAPI.instance()); - } -} -exports.MetricsAPI = MetricsAPI; -//# sourceMappingURL=metrics.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/metrics.js.map b/node_modules/@opentelemetry/api/build/src/api/metrics.js.map deleted file mode 100644 index e08d43c..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/metrics.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/api/metrics.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,oEAAmE;AACnE,2DAIkC;AAClC,iCAAiC;AAEjC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAE3B;;GAEG;AACH,MAAa,UAAU;IAGrB,+FAA+F;IAC/F,gBAAuB,CAAC;IAExB,oDAAoD;IAC7C,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,UAAU,EAAE,CAAC;SACnC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,sBAAsB,CAAC,QAAuB;QACnD,OAAO,IAAA,6BAAc,EAAC,QAAQ,EAAE,QAAQ,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,IAAA,wBAAS,EAAC,QAAQ,CAAC,IAAI,uCAAmB,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,QAAQ,CACb,IAAY,EACZ,OAAgB,EAChB,OAAsB;QAEtB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,uCAAuC;IAChC,OAAO;QACZ,IAAA,+BAAgB,EAAC,QAAQ,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;CACF;AA7CD,gCA6CC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter, MeterOptions } from '../metrics/Meter';\nimport type { MeterProvider } from '../metrics/MeterProvider';\nimport { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'metrics';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Metrics API\n */\nexport class MetricsAPI {\n private static _instance?: MetricsAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Metrics API */\n public static getInstance(): MetricsAPI {\n if (!this._instance) {\n this._instance = new MetricsAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current global meter provider.\n * Returns true if the meter provider was successfully registered, else false.\n */\n public setGlobalMeterProvider(provider: MeterProvider): boolean {\n return registerGlobal(API_NAME, provider, DiagAPI.instance());\n }\n\n /**\n * Returns the global meter provider.\n */\n public getMeterProvider(): MeterProvider {\n return getGlobal(API_NAME) || NOOP_METER_PROVIDER;\n }\n\n /**\n * Returns a meter from the global meter provider.\n */\n public getMeter(\n name: string,\n version?: string,\n options?: MeterOptions\n ): Meter {\n return this.getMeterProvider().getMeter(name, version, options);\n }\n\n /** Remove the global meter provider */\n public disable(): void {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/propagation.d.ts b/node_modules/@opentelemetry/api/build/src/api/propagation.d.ts deleted file mode 100644 index 1ef2c0b..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/propagation.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { Context } from '../context/types'; -import type { TextMapGetter, TextMapPropagator, TextMapSetter } from '../propagation/TextMapPropagator'; -import { getBaggage, getActiveBaggage, setBaggage, deleteBaggage } from '../baggage/context-helpers'; -import { createBaggage } from '../baggage/utils'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Propagation API - * - * @since 1.0.0 - */ -export declare class PropagationAPI { - private static _instance?; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Propagator API */ - static getInstance(): PropagationAPI; - /** - * Set the current propagator. - * - * @returns true if the propagator was successfully registered, else false - */ - setGlobalPropagator(propagator: TextMapPropagator): boolean; - /** - * Inject context into a carrier to be propagated inter-process - * - * @param context Context carrying tracing data to inject - * @param carrier carrier to inject context into - * @param setter Function used to set values on the carrier - */ - inject(context: Context, carrier: Carrier, setter?: TextMapSetter): void; - /** - * Extract context from a carrier - * - * @param context Context which the newly created context will inherit from - * @param carrier Carrier to extract context from - * @param getter Function used to extract keys from a carrier - */ - extract(context: Context, carrier: Carrier, getter?: TextMapGetter): Context; - /** - * Return a list of all fields which may be used by the propagator. - */ - fields(): string[]; - /** Remove the global propagator */ - disable(): void; - createBaggage: typeof createBaggage; - getBaggage: typeof getBaggage; - getActiveBaggage: typeof getActiveBaggage; - setBaggage: typeof setBaggage; - deleteBaggage: typeof deleteBaggage; - private _getGlobalPropagator; -} -//# sourceMappingURL=propagation.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/propagation.js b/node_modules/@opentelemetry/api/build/src/api/propagation.js deleted file mode 100644 index 1099969..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/propagation.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PropagationAPI = void 0; -const global_utils_1 = require("../internal/global-utils"); -const NoopTextMapPropagator_1 = require("../propagation/NoopTextMapPropagator"); -const TextMapPropagator_1 = require("../propagation/TextMapPropagator"); -const context_helpers_1 = require("../baggage/context-helpers"); -const utils_1 = require("../baggage/utils"); -const diag_1 = require("./diag"); -const API_NAME = 'propagation'; -const NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator_1.NoopTextMapPropagator(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Propagation API - * - * @since 1.0.0 - */ -class PropagationAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this.createBaggage = utils_1.createBaggage; - this.getBaggage = context_helpers_1.getBaggage; - this.getActiveBaggage = context_helpers_1.getActiveBaggage; - this.setBaggage = context_helpers_1.setBaggage; - this.deleteBaggage = context_helpers_1.deleteBaggage; - } - /** Get the singleton instance of the Propagator API */ - static getInstance() { - if (!this._instance) { - this._instance = new PropagationAPI(); - } - return this._instance; - } - /** - * Set the current propagator. - * - * @returns true if the propagator was successfully registered, else false - */ - setGlobalPropagator(propagator) { - return (0, global_utils_1.registerGlobal)(API_NAME, propagator, diag_1.DiagAPI.instance()); - } - /** - * Inject context into a carrier to be propagated inter-process - * - * @param context Context carrying tracing data to inject - * @param carrier carrier to inject context into - * @param setter Function used to set values on the carrier - */ - inject(context, carrier, setter = TextMapPropagator_1.defaultTextMapSetter) { - return this._getGlobalPropagator().inject(context, carrier, setter); - } - /** - * Extract context from a carrier - * - * @param context Context which the newly created context will inherit from - * @param carrier Carrier to extract context from - * @param getter Function used to extract keys from a carrier - */ - extract(context, carrier, getter = TextMapPropagator_1.defaultTextMapGetter) { - return this._getGlobalPropagator().extract(context, carrier, getter); - } - /** - * Return a list of all fields which may be used by the propagator. - */ - fields() { - return this._getGlobalPropagator().fields(); - } - /** Remove the global propagator */ - disable() { - (0, global_utils_1.unregisterGlobal)(API_NAME, diag_1.DiagAPI.instance()); - } - _getGlobalPropagator() { - return (0, global_utils_1.getGlobal)(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR; - } -} -exports.PropagationAPI = PropagationAPI; -//# sourceMappingURL=propagation.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/propagation.js.map b/node_modules/@opentelemetry/api/build/src/api/propagation.js.map deleted file mode 100644 index eaa9e21..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/propagation.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../src/api/propagation.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2DAIkC;AAClC,gFAA6E;AAM7E,wEAG0C;AAC1C,gEAKoC;AACpC,4CAAiD;AACjD,iCAAiC;AAEjC,MAAM,QAAQ,GAAG,aAAa,CAAC;AAC/B,MAAM,wBAAwB,GAAG,IAAI,6CAAqB,EAAE,CAAC;AAE7D;;;;GAIG;AACH,MAAa,cAAc;IAGzB,+FAA+F;IAC/F;QA8DO,kBAAa,GAAG,qBAAa,CAAC;QAE9B,eAAU,GAAG,4BAAU,CAAC;QAExB,qBAAgB,GAAG,kCAAgB,CAAC;QAEpC,eAAU,GAAG,4BAAU,CAAC;QAExB,kBAAa,GAAG,+BAAa,CAAC;IAtEd,CAAC;IAExB,uDAAuD;IAChD,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;SACvC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,UAA6B;QACtD,OAAO,IAAA,6BAAc,EAAC,QAAQ,EAAE,UAAU,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CACX,OAAgB,EAChB,OAAgB,EAChB,SAAiC,wCAAoB;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CACZ,OAAgB,EAChB,OAAgB,EAChB,SAAiC,wCAAoB;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,MAAM;QACX,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC9C,CAAC;IAED,mCAAmC;IAC5B,OAAO;QACZ,IAAA,+BAAgB,EAAC,QAAQ,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAYO,oBAAoB;QAC1B,OAAO,IAAA,wBAAS,EAAC,QAAQ,CAAC,IAAI,wBAAwB,CAAC;IACzD,CAAC;CACF;AA/ED,wCA+EC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator';\nimport type {\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n} from '../propagation/TextMapPropagator';\nimport {\n defaultTextMapGetter,\n defaultTextMapSetter,\n} from '../propagation/TextMapPropagator';\nimport {\n getBaggage,\n getActiveBaggage,\n setBaggage,\n deleteBaggage,\n} from '../baggage/context-helpers';\nimport { createBaggage } from '../baggage/utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'propagation';\nconst NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Propagation API\n *\n * @since 1.0.0\n */\nexport class PropagationAPI {\n private static _instance?: PropagationAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Propagator API */\n public static getInstance(): PropagationAPI {\n if (!this._instance) {\n this._instance = new PropagationAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current propagator.\n *\n * @returns true if the propagator was successfully registered, else false\n */\n public setGlobalPropagator(propagator: TextMapPropagator): boolean {\n return registerGlobal(API_NAME, propagator, DiagAPI.instance());\n }\n\n /**\n * Inject context into a carrier to be propagated inter-process\n *\n * @param context Context carrying tracing data to inject\n * @param carrier carrier to inject context into\n * @param setter Function used to set values on the carrier\n */\n public inject(\n context: Context,\n carrier: Carrier,\n setter: TextMapSetter = defaultTextMapSetter\n ): void {\n return this._getGlobalPropagator().inject(context, carrier, setter);\n }\n\n /**\n * Extract context from a carrier\n *\n * @param context Context which the newly created context will inherit from\n * @param carrier Carrier to extract context from\n * @param getter Function used to extract keys from a carrier\n */\n public extract(\n context: Context,\n carrier: Carrier,\n getter: TextMapGetter = defaultTextMapGetter\n ): Context {\n return this._getGlobalPropagator().extract(context, carrier, getter);\n }\n\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n public fields(): string[] {\n return this._getGlobalPropagator().fields();\n }\n\n /** Remove the global propagator */\n public disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n\n public createBaggage = createBaggage;\n\n public getBaggage = getBaggage;\n\n public getActiveBaggage = getActiveBaggage;\n\n public setBaggage = setBaggage;\n\n public deleteBaggage = deleteBaggage;\n\n private _getGlobalPropagator(): TextMapPropagator {\n return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/trace.d.ts b/node_modules/@opentelemetry/api/build/src/api/trace.d.ts deleted file mode 100644 index 1f4efd4..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/trace.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { isSpanContextValid, wrapSpanContext } from '../trace/spancontext-utils'; -import type { Tracer } from '../trace/tracer'; -import type { TracerProvider } from '../trace/tracer_provider'; -import { deleteSpan, getActiveSpan, getSpan, getSpanContext, setSpan, setSpanContext } from '../trace/context-utils'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Tracing API - * - * @since 1.0.0 - */ -export declare class TraceAPI { - private static _instance?; - private _proxyTracerProvider; - /** Empty private constructor prevents end users from constructing a new instance of the API */ - private constructor(); - /** Get the singleton instance of the Trace API */ - static getInstance(): TraceAPI; - /** - * Set the current global tracer. - * - * @returns true if the tracer provider was successfully registered, else false - */ - setGlobalTracerProvider(provider: TracerProvider): boolean; - /** - * Returns the global tracer provider. - */ - getTracerProvider(): TracerProvider; - /** - * Returns a tracer from the global tracer provider. - */ - getTracer(name: string, version?: string): Tracer; - /** Remove the global tracer provider */ - disable(): void; - wrapSpanContext: typeof wrapSpanContext; - isSpanContextValid: typeof isSpanContextValid; - deleteSpan: typeof deleteSpan; - getSpan: typeof getSpan; - getActiveSpan: typeof getActiveSpan; - getSpanContext: typeof getSpanContext; - setSpan: typeof setSpan; - setSpanContext: typeof setSpanContext; -} -//# sourceMappingURL=trace.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/trace.js b/node_modules/@opentelemetry/api/build/src/api/trace.js deleted file mode 100644 index 12869fc..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/trace.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TraceAPI = void 0; -const global_utils_1 = require("../internal/global-utils"); -const ProxyTracerProvider_1 = require("../trace/ProxyTracerProvider"); -const spancontext_utils_1 = require("../trace/spancontext-utils"); -const context_utils_1 = require("../trace/context-utils"); -const diag_1 = require("./diag"); -const API_NAME = 'trace'; -/** - * Singleton object which represents the entry point to the OpenTelemetry Tracing API - * - * @since 1.0.0 - */ -class TraceAPI { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider(); - this.wrapSpanContext = spancontext_utils_1.wrapSpanContext; - this.isSpanContextValid = spancontext_utils_1.isSpanContextValid; - this.deleteSpan = context_utils_1.deleteSpan; - this.getSpan = context_utils_1.getSpan; - this.getActiveSpan = context_utils_1.getActiveSpan; - this.getSpanContext = context_utils_1.getSpanContext; - this.setSpan = context_utils_1.setSpan; - this.setSpanContext = context_utils_1.setSpanContext; - } - /** Get the singleton instance of the Trace API */ - static getInstance() { - if (!this._instance) { - this._instance = new TraceAPI(); - } - return this._instance; - } - /** - * Set the current global tracer. - * - * @returns true if the tracer provider was successfully registered, else false - */ - setGlobalTracerProvider(provider) { - const success = (0, global_utils_1.registerGlobal)(API_NAME, this._proxyTracerProvider, diag_1.DiagAPI.instance()); - if (success) { - this._proxyTracerProvider.setDelegate(provider); - } - return success; - } - /** - * Returns the global tracer provider. - */ - getTracerProvider() { - return (0, global_utils_1.getGlobal)(API_NAME) || this._proxyTracerProvider; - } - /** - * Returns a tracer from the global tracer provider. - */ - getTracer(name, version) { - return this.getTracerProvider().getTracer(name, version); - } - /** Remove the global tracer provider */ - disable() { - (0, global_utils_1.unregisterGlobal)(API_NAME, diag_1.DiagAPI.instance()); - this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider(); - } -} -exports.TraceAPI = TraceAPI; -//# sourceMappingURL=trace.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/api/trace.js.map b/node_modules/@opentelemetry/api/build/src/api/trace.js.map deleted file mode 100644 index 7e14d02..0000000 --- a/node_modules/@opentelemetry/api/build/src/api/trace.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/api/trace.ts"],"names":[],"mappings":";AAAA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AAC;IAC3D,CAAC;IAED,wCAAwC;IACjC,OAAO;QACZ,IAAA,+BAAgB,EAAC,QAAQ,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,oBAAoB,GAAG,IAAI,yCAAmB,EAAE,CAAC;IACxD,CAAC;CAiBF;AArED,4BAqEC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { ProxyTracerProvider } from '../trace/ProxyTracerProvider';\nimport {\n isSpanContextValid,\n wrapSpanContext,\n} from '../trace/spancontext-utils';\nimport type { Tracer } from '../trace/tracer';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport {\n deleteSpan,\n getActiveSpan,\n getSpan,\n getSpanContext,\n setSpan,\n setSpanContext,\n} from '../trace/context-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'trace';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Tracing API\n *\n * @since 1.0.0\n */\nexport class TraceAPI {\n private static _instance?: TraceAPI;\n\n private _proxyTracerProvider = new ProxyTracerProvider();\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Trace API */\n public static getInstance(): TraceAPI {\n if (!this._instance) {\n this._instance = new TraceAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current global tracer.\n *\n * @returns true if the tracer provider was successfully registered, else false\n */\n public setGlobalTracerProvider(provider: TracerProvider): boolean {\n const success = registerGlobal(\n API_NAME,\n this._proxyTracerProvider,\n DiagAPI.instance()\n );\n if (success) {\n this._proxyTracerProvider.setDelegate(provider);\n }\n return success;\n }\n\n /**\n * Returns the global tracer provider.\n */\n public getTracerProvider(): TracerProvider {\n return getGlobal(API_NAME) || this._proxyTracerProvider;\n }\n\n /**\n * Returns a tracer from the global tracer provider.\n */\n public getTracer(name: string, version?: string): Tracer {\n return this.getTracerProvider().getTracer(name, version);\n }\n\n /** Remove the global tracer provider */\n public disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n this._proxyTracerProvider = new ProxyTracerProvider();\n }\n\n public wrapSpanContext = wrapSpanContext;\n\n public isSpanContextValid = isSpanContextValid;\n\n public deleteSpan = deleteSpan;\n\n public getSpan = getSpan;\n\n public getActiveSpan = getActiveSpan;\n\n public getSpanContext = getSpanContext;\n\n public setSpan = setSpan;\n\n public setSpanContext = setSpanContext;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.d.ts b/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.d.ts deleted file mode 100644 index 39278cb..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { Context } from '../context/types'; -import type { Baggage } from './types'; -/** - * Retrieve the current baggage from the given context - * - * @param {Context} Context that manage all context values - * @returns {Baggage} Extracted baggage from the context - */ -export declare function getBaggage(context: Context): Baggage | undefined; -/** - * Retrieve the current baggage from the active/current context - * - * @returns {Baggage} Extracted baggage from the context - */ -export declare function getActiveBaggage(): Baggage | undefined; -/** - * Store a baggage in the given context - * - * @param {Context} Context that manage all context values - * @param {Baggage} baggage that will be set in the actual context - */ -export declare function setBaggage(context: Context, baggage: Baggage): Context; -/** - * Delete the baggage stored in the given context - * - * @param {Context} Context that manage all context values - */ -export declare function deleteBaggage(context: Context): Context; -//# sourceMappingURL=context-helpers.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.js b/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.js deleted file mode 100644 index 8965b3e..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.deleteBaggage = exports.setBaggage = exports.getActiveBaggage = exports.getBaggage = void 0; -const context_1 = require("../api/context"); -const context_2 = require("../context/context"); -/** - * Baggage key - */ -const BAGGAGE_KEY = (0, context_2.createContextKey)('OpenTelemetry Baggage Key'); -/** - * Retrieve the current baggage from the given context - * - * @param {Context} Context that manage all context values - * @returns {Baggage} Extracted baggage from the context - */ -function getBaggage(context) { - return context.getValue(BAGGAGE_KEY) || undefined; -} -exports.getBaggage = getBaggage; -/** - * Retrieve the current baggage from the active/current context - * - * @returns {Baggage} Extracted baggage from the context - */ -function getActiveBaggage() { - return getBaggage(context_1.ContextAPI.getInstance().active()); -} -exports.getActiveBaggage = getActiveBaggage; -/** - * Store a baggage in the given context - * - * @param {Context} Context that manage all context values - * @param {Baggage} baggage that will be set in the actual context - */ -function setBaggage(context, baggage) { - return context.setValue(BAGGAGE_KEY, baggage); -} -exports.setBaggage = setBaggage; -/** - * Delete the baggage stored in the given context - * - * @param {Context} Context that manage all context values - */ -function deleteBaggage(context) { - return context.deleteValue(BAGGAGE_KEY); -} -exports.deleteBaggage = deleteBaggage; -//# sourceMappingURL=context-helpers.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.js.map b/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.js.map deleted file mode 100644 index eecff7e..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context-helpers.js","sourceRoot":"","sources":["../../../src/baggage/context-helpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4CAA4C;AAC5C,gDAAsD;AAItD;;GAEG;AACH,MAAM,WAAW,GAAG,IAAA,0BAAgB,EAAC,2BAA2B,CAAC,CAAC;AAElE;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,OAAgB;IACzC,OAAQ,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa,IAAI,SAAS,CAAC;AACjE,CAAC;AAFD,gCAEC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB;IAC9B,OAAO,UAAU,CAAC,oBAAU,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AACvD,CAAC;AAFD,4CAEC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,OAAgB,EAAE,OAAgB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAFD,gCAEC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,OAAgB;IAC5C,OAAO,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AAC1C,CAAC;AAFD,sCAEC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ContextAPI } from '../api/context';\nimport { createContextKey } from '../context/context';\nimport type { Context } from '../context/types';\nimport type { Baggage } from './types';\n\n/**\n * Baggage key\n */\nconst BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');\n\n/**\n * Retrieve the current baggage from the given context\n *\n * @param {Context} Context that manage all context values\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getBaggage(context: Context): Baggage | undefined {\n return (context.getValue(BAGGAGE_KEY) as Baggage) || undefined;\n}\n\n/**\n * Retrieve the current baggage from the active/current context\n *\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getActiveBaggage(): Baggage | undefined {\n return getBaggage(ContextAPI.getInstance().active());\n}\n\n/**\n * Store a baggage in the given context\n *\n * @param {Context} Context that manage all context values\n * @param {Baggage} baggage that will be set in the actual context\n */\nexport function setBaggage(context: Context, baggage: Baggage): Context {\n return context.setValue(BAGGAGE_KEY, baggage);\n}\n\n/**\n * Delete the baggage stored in the given context\n *\n * @param {Context} Context that manage all context values\n */\nexport function deleteBaggage(context: Context): Context {\n return context.deleteValue(BAGGAGE_KEY);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.d.ts b/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.d.ts deleted file mode 100644 index e6b4554..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Baggage, BaggageEntry } from '../types'; -export declare class BaggageImpl implements Baggage { - private _entries; - constructor(entries?: Map); - getEntry(key: string): BaggageEntry | undefined; - getAllEntries(): [string, BaggageEntry][]; - setEntry(key: string, entry: BaggageEntry): BaggageImpl; - removeEntry(key: string): BaggageImpl; - removeEntries(...keys: string[]): BaggageImpl; - clear(): BaggageImpl; -} -//# sourceMappingURL=baggage-impl.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.js b/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.js deleted file mode 100644 index 3731408..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BaggageImpl = void 0; -class BaggageImpl { - constructor(entries) { - this._entries = entries ? new Map(entries) : new Map(); - } - getEntry(key) { - const entry = this._entries.get(key); - if (!entry) { - return undefined; - } - return Object.assign({}, entry); - } - getAllEntries() { - return Array.from(this._entries.entries()); - } - setEntry(key, entry) { - const newBaggage = new BaggageImpl(this._entries); - newBaggage._entries.set(key, entry); - return newBaggage; - } - removeEntry(key) { - const newBaggage = new BaggageImpl(this._entries); - newBaggage._entries.delete(key); - return newBaggage; - } - removeEntries(...keys) { - const newBaggage = new BaggageImpl(this._entries); - for (const key of keys) { - newBaggage._entries.delete(key); - } - return newBaggage; - } - clear() { - return new BaggageImpl(); - } -} -exports.BaggageImpl = BaggageImpl; -//# sourceMappingURL=baggage-impl.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.js.map b/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.js.map deleted file mode 100644 index 28ee563..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"baggage-impl.js","sourceRoot":"","sources":["../../../../src/baggage/internal/baggage-impl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,MAAa,WAAW;IAGtB,YAAY,OAAmC;QAC7C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IACzD,CAAC;IAED,QAAQ,CAAC,GAAW;QAClB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,aAAa;QACX,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAmB;QACvC,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACpC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,WAAW,CAAC,GAAW;QACrB,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,aAAa,CAAC,GAAG,IAAc;QAC7B,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACjC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;CACF;AA3CD,kCA2CC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Baggage, BaggageEntry } from '../types';\n\nexport class BaggageImpl implements Baggage {\n private _entries: Map;\n\n constructor(entries?: Map) {\n this._entries = entries ? new Map(entries) : new Map();\n }\n\n getEntry(key: string): BaggageEntry | undefined {\n const entry = this._entries.get(key);\n if (!entry) {\n return undefined;\n }\n\n return Object.assign({}, entry);\n }\n\n getAllEntries(): [string, BaggageEntry][] {\n return Array.from(this._entries.entries());\n }\n\n setEntry(key: string, entry: BaggageEntry): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.set(key, entry);\n return newBaggage;\n }\n\n removeEntry(key: string): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.delete(key);\n return newBaggage;\n }\n\n removeEntries(...keys: string[]): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n for (const key of keys) {\n newBaggage._entries.delete(key);\n }\n return newBaggage;\n }\n\n clear(): BaggageImpl {\n return new BaggageImpl();\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.d.ts b/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.d.ts deleted file mode 100644 index 9cd991c..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Symbol used to make BaggageEntryMetadata an opaque type - */ -export declare const baggageEntryMetadataSymbol: unique symbol; -//# sourceMappingURL=symbol.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.js b/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.js deleted file mode 100644 index 3bf3546..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.baggageEntryMetadataSymbol = void 0; -/** - * Symbol used to make BaggageEntryMetadata an opaque type - */ -exports.baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata'); -//# sourceMappingURL=symbol.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.js.map b/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.js.map deleted file mode 100644 index 3c6f411..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"symbol.js","sourceRoot":"","sources":["../../../../src/baggage/internal/symbol.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACU,QAAA,0BAA0B,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Symbol used to make BaggageEntryMetadata an opaque type\n */\nexport const baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata');\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/types.d.ts b/node_modules/@opentelemetry/api/build/src/baggage/types.d.ts deleted file mode 100644 index 43eaa4a..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/types.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -import type { baggageEntryMetadataSymbol } from './internal/symbol'; -/** - * @since 1.0.0 - */ -export interface BaggageEntry { - /** `String` value of the `BaggageEntry`. */ - value: string; - /** - * Metadata is an optional string property defined by the W3C baggage specification. - * It currently has no special meaning defined by the specification. - */ - metadata?: BaggageEntryMetadata; -} -/** - * Serializable Metadata defined by the W3C baggage specification. - * It currently has no special meaning defined by the OpenTelemetry or W3C. - * - * @since 1.0.0 - */ -export type BaggageEntryMetadata = { - toString(): string; -} & { - __TYPE__: typeof baggageEntryMetadataSymbol; -}; -/** - * Baggage represents collection of key-value pairs with optional metadata. - * Each key of Baggage is associated with exactly one value. - * Baggage may be used to annotate and enrich telemetry data. - * - * @since 1.0.0 - */ -export interface Baggage { - /** - * Get an entry from Baggage if it exists - * - * @param key The key which identifies the BaggageEntry - */ - getEntry(key: string): BaggageEntry | undefined; - /** - * Get a list of all entries in the Baggage - */ - getAllEntries(): [string, BaggageEntry][]; - /** - * Returns a new baggage with the entries from the current bag and the specified entry - * - * @param key string which identifies the baggage entry - * @param entry BaggageEntry for the given key - */ - setEntry(key: string, entry: BaggageEntry): Baggage; - /** - * Returns a new baggage with the entries from the current bag except the removed entry - * - * @param key key identifying the entry to be removed - */ - removeEntry(key: string): Baggage; - /** - * Returns a new baggage with the entries from the current bag except the removed entries - * - * @param key keys identifying the entries to be removed - */ - removeEntries(...key: string[]): Baggage; - /** - * Returns a new baggage with no entries - */ - clear(): Baggage; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/types.js b/node_modules/@opentelemetry/api/build/src/baggage/types.js deleted file mode 100644 index 6ca0a43..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/types.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/types.js.map b/node_modules/@opentelemetry/api/build/src/baggage/types.js.map deleted file mode 100644 index 363badd..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/baggage/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { baggageEntryMetadataSymbol } from './internal/symbol';\n\n/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface BaggageEntry {\n /** `String` value of the `BaggageEntry`. */\n value: string;\n /**\n * Metadata is an optional string property defined by the W3C baggage specification.\n * It currently has no special meaning defined by the specification.\n */\n metadata?: BaggageEntryMetadata;\n}\n\n/**\n * Serializable Metadata defined by the W3C baggage specification.\n * It currently has no special meaning defined by the OpenTelemetry or W3C.\n *\n * @since 1.0.0\n */\nexport type BaggageEntryMetadata = { toString(): string } & {\n __TYPE__: typeof baggageEntryMetadataSymbol;\n};\n\n/**\n * Baggage represents collection of key-value pairs with optional metadata.\n * Each key of Baggage is associated with exactly one value.\n * Baggage may be used to annotate and enrich telemetry data.\n *\n * @since 1.0.0\n */\nexport interface Baggage {\n /**\n * Get an entry from Baggage if it exists\n *\n * @param key The key which identifies the BaggageEntry\n */\n getEntry(key: string): BaggageEntry | undefined;\n\n /**\n * Get a list of all entries in the Baggage\n */\n getAllEntries(): [string, BaggageEntry][];\n\n /**\n * Returns a new baggage with the entries from the current bag and the specified entry\n *\n * @param key string which identifies the baggage entry\n * @param entry BaggageEntry for the given key\n */\n setEntry(key: string, entry: BaggageEntry): Baggage;\n\n /**\n * Returns a new baggage with the entries from the current bag except the removed entry\n *\n * @param key key identifying the entry to be removed\n */\n removeEntry(key: string): Baggage;\n\n /**\n * Returns a new baggage with the entries from the current bag except the removed entries\n *\n * @param key keys identifying the entries to be removed\n */\n removeEntries(...key: string[]): Baggage;\n\n /**\n * Returns a new baggage with no entries\n */\n clear(): Baggage;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/utils.d.ts b/node_modules/@opentelemetry/api/build/src/baggage/utils.d.ts deleted file mode 100644 index c58ba53..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/utils.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { Baggage, BaggageEntry, BaggageEntryMetadata } from './types'; -/** - * Create a new Baggage with optional entries - * - * @param entries An array of baggage entries the new baggage should contain - */ -export declare function createBaggage(entries?: Record): Baggage; -/** - * Create a serializable BaggageEntryMetadata object from a string. - * - * @param str string metadata. Format is currently not defined by the spec and has no special meaning. - * - * @since 1.0.0 - */ -export declare function baggageEntryMetadataFromString(str: string): BaggageEntryMetadata; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/utils.js b/node_modules/@opentelemetry/api/build/src/baggage/utils.js deleted file mode 100644 index e469723..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/utils.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.baggageEntryMetadataFromString = exports.createBaggage = void 0; -const diag_1 = require("../api/diag"); -const baggage_impl_1 = require("./internal/baggage-impl"); -const symbol_1 = require("./internal/symbol"); -const diag = diag_1.DiagAPI.instance(); -/** - * Create a new Baggage with optional entries - * - * @param entries An array of baggage entries the new baggage should contain - */ -function createBaggage(entries = {}) { - return new baggage_impl_1.BaggageImpl(new Map(Object.entries(entries))); -} -exports.createBaggage = createBaggage; -/** - * Create a serializable BaggageEntryMetadata object from a string. - * - * @param str string metadata. Format is currently not defined by the spec and has no special meaning. - * - * @since 1.0.0 - */ -function baggageEntryMetadataFromString(str) { - if (typeof str !== 'string') { - diag.error(`Cannot create baggage metadata from unknown type: ${typeof str}`); - str = ''; - } - return { - __TYPE__: symbol_1.baggageEntryMetadataSymbol, - toString() { - return str; - }, - }; -} -exports.baggageEntryMetadataFromString = baggageEntryMetadataFromString; -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/baggage/utils.js.map b/node_modules/@opentelemetry/api/build/src/baggage/utils.js.map deleted file mode 100644 index 9fb1f93..0000000 --- a/node_modules/@opentelemetry/api/build/src/baggage/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/baggage/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sCAAsC;AACtC,0DAAsD;AACtD,8CAA+D;AAG/D,MAAM,IAAI,GAAG,cAAO,CAAC,QAAQ,EAAE,CAAC;AAEhC;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,UAAwC,EAAE;IAE1C,OAAO,IAAI,0BAAW,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAJD,sCAIC;AAED;;;;;;GAMG;AACH,SAAgB,8BAA8B,CAC5C,GAAW;IAEX,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,IAAI,CAAC,KAAK,CACR,qDAAqD,OAAO,GAAG,EAAE,CAClE,CAAC;QACF,GAAG,GAAG,EAAE,CAAC;KACV;IAED,OAAO;QACL,QAAQ,EAAE,mCAA0B;QACpC,QAAQ;YACN,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC;AAhBD,wEAgBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DiagAPI } from '../api/diag';\nimport { BaggageImpl } from './internal/baggage-impl';\nimport { baggageEntryMetadataSymbol } from './internal/symbol';\nimport type { Baggage, BaggageEntry, BaggageEntryMetadata } from './types';\n\nconst diag = DiagAPI.instance();\n\n/**\n * Create a new Baggage with optional entries\n *\n * @param entries An array of baggage entries the new baggage should contain\n */\nexport function createBaggage(\n entries: Record = {}\n): Baggage {\n return new BaggageImpl(new Map(Object.entries(entries)));\n}\n\n/**\n * Create a serializable BaggageEntryMetadata object from a string.\n *\n * @param str string metadata. Format is currently not defined by the spec and has no special meaning.\n *\n * @since 1.0.0\n */\nexport function baggageEntryMetadataFromString(\n str: string\n): BaggageEntryMetadata {\n if (typeof str !== 'string') {\n diag.error(\n `Cannot create baggage metadata from unknown type: ${typeof str}`\n );\n str = '';\n }\n\n return {\n __TYPE__: baggageEntryMetadataSymbol,\n toString() {\n return str;\n },\n };\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/common/Attributes.d.ts b/node_modules/@opentelemetry/api/build/src/common/Attributes.d.ts deleted file mode 100644 index 99a72b3..0000000 --- a/node_modules/@opentelemetry/api/build/src/common/Attributes.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Attributes is a map from string to attribute values. - * - * Note: only the own enumerable keys are counted as valid attribute keys. - * - * @since 1.3.0 - */ -export interface Attributes { - [attributeKey: string]: AttributeValue | undefined; -} -/** - * Attribute values may be any non-nullish primitive value except an object. - * - * null or undefined attribute values are invalid and will result in undefined behavior. - * - * @since 1.3.0 - */ -export type AttributeValue = string | number | boolean | Array | Array | Array; -//# sourceMappingURL=Attributes.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/common/Attributes.js b/node_modules/@opentelemetry/api/build/src/common/Attributes.js deleted file mode 100644 index f528fb2..0000000 --- a/node_modules/@opentelemetry/api/build/src/common/Attributes.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Attributes.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/common/Attributes.js.map b/node_modules/@opentelemetry/api/build/src/common/Attributes.js.map deleted file mode 100644 index 5f3e528..0000000 --- a/node_modules/@opentelemetry/api/build/src/common/Attributes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Attributes.js","sourceRoot":"","sources":["../../../src/common/Attributes.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Attributes is a map from string to attribute values.\n *\n * Note: only the own enumerable keys are counted as valid attribute keys.\n *\n * @since 1.3.0\n */\nexport interface Attributes {\n [attributeKey: string]: AttributeValue | undefined;\n}\n\n/**\n * Attribute values may be any non-nullish primitive value except an object.\n *\n * null or undefined attribute values are invalid and will result in undefined behavior.\n *\n * @since 1.3.0\n */\nexport type AttributeValue =\n | string\n | number\n | boolean\n | Array\n | Array\n | Array;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/common/Exception.d.ts b/node_modules/@opentelemetry/api/build/src/common/Exception.d.ts deleted file mode 100644 index 704fec1..0000000 --- a/node_modules/@opentelemetry/api/build/src/common/Exception.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -interface ExceptionWithCode { - code: string | number; - name?: string; - message?: string; - stack?: string; -} -interface ExceptionWithMessage { - code?: string | number; - message: string; - name?: string; - stack?: string; -} -interface ExceptionWithName { - code?: string | number; - message?: string; - name: string; - stack?: string; -} -/** - * Defines Exception. - * - * string or an object with one of (message or name or code) and optional stack - * - * @since 1.0.0 - */ -export type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string; -export {}; -//# sourceMappingURL=Exception.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/common/Exception.js b/node_modules/@opentelemetry/api/build/src/common/Exception.js deleted file mode 100644 index d88a87e..0000000 --- a/node_modules/@opentelemetry/api/build/src/common/Exception.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Exception.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/common/Exception.js.map b/node_modules/@opentelemetry/api/build/src/common/Exception.js.map deleted file mode 100644 index 9c0bb44..0000000 --- a/node_modules/@opentelemetry/api/build/src/common/Exception.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/common/Exception.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\ninterface ExceptionWithCode {\n code: string | number;\n name?: string;\n message?: string;\n stack?: string;\n}\n\ninterface ExceptionWithMessage {\n code?: string | number;\n message: string;\n name?: string;\n stack?: string;\n}\n\ninterface ExceptionWithName {\n code?: string | number;\n message?: string;\n name: string;\n stack?: string;\n}\n\n/**\n * Defines Exception.\n *\n * string or an object with one of (message or name or code) and optional stack\n *\n * @since 1.0.0\n */\nexport type Exception =\n | ExceptionWithCode\n | ExceptionWithMessage\n | ExceptionWithName\n | string;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/common/Time.d.ts b/node_modules/@opentelemetry/api/build/src/common/Time.d.ts deleted file mode 100644 index 265d617..0000000 --- a/node_modules/@opentelemetry/api/build/src/common/Time.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Defines High-Resolution Time. - * - * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970. - * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds. - * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150. - * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds: - * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210. - * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds: - * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000. - * This is represented in HrTime format as [1609504210, 150000000]. - * - * @since 1.0.0 - */ -export type HrTime = [number, number]; -/** - * Defines TimeInput. - * - * hrtime, epoch milliseconds, performance.now() or Date - * - * @since 1.0.0 - */ -export type TimeInput = HrTime | number | Date; -//# sourceMappingURL=Time.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/common/Time.js b/node_modules/@opentelemetry/api/build/src/common/Time.js deleted file mode 100644 index 1faaf69..0000000 --- a/node_modules/@opentelemetry/api/build/src/common/Time.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Time.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/common/Time.js.map b/node_modules/@opentelemetry/api/build/src/common/Time.js.map deleted file mode 100644 index 77ac321..0000000 --- a/node_modules/@opentelemetry/api/build/src/common/Time.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../src/common/Time.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Defines High-Resolution Time.\n *\n * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.\n * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.\n * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.\n * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:\n * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.\n * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:\n * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.\n * This is represented in HrTime format as [1609504210, 150000000].\n *\n * @since 1.0.0\n */\nexport type HrTime = [number, number];\n\n/**\n * Defines TimeInput.\n *\n * hrtime, epoch milliseconds, performance.now() or Date\n *\n * @since 1.0.0\n */\nexport type TimeInput = HrTime | number | Date;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context-api.d.ts b/node_modules/@opentelemetry/api/build/src/context-api.d.ts deleted file mode 100644 index b842571..0000000 --- a/node_modules/@opentelemetry/api/build/src/context-api.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ContextAPI } from './api/context'; -/** - * Entrypoint for context API - * @since 1.0.0 - */ -export declare const context: ContextAPI; -//# sourceMappingURL=context-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context-api.js b/node_modules/@opentelemetry/api/build/src/context-api.js deleted file mode 100644 index f0cbf8b..0000000 --- a/node_modules/@opentelemetry/api/build/src/context-api.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.context = void 0; -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -const context_1 = require("./api/context"); -/** - * Entrypoint for context API - * @since 1.0.0 - */ -exports.context = context_1.ContextAPI.getInstance(); -//# sourceMappingURL=context-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context-api.js.map b/node_modules/@opentelemetry/api/build/src/context-api.js.map deleted file mode 100644 index aba4ad9..0000000 --- a/node_modules/@opentelemetry/api/build/src/context-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context-api.js","sourceRoot":"","sources":["../../src/context-api.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,2CAA2C;AAC3C;;;GAGG;AACU,QAAA,OAAO,GAAG,oBAAU,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { ContextAPI } from './api/context';\n/**\n * Entrypoint for context API\n * @since 1.0.0\n */\nexport const context = ContextAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.d.ts b/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.d.ts deleted file mode 100644 index d3599db..0000000 --- a/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type * as types from './types'; -export declare class NoopContextManager implements types.ContextManager { - active(): types.Context; - with ReturnType>(_context: types.Context, fn: F, thisArg?: ThisParameterType, ...args: A): ReturnType; - bind(_context: types.Context, target: T): T; - enable(): this; - disable(): this; -} -//# sourceMappingURL=NoopContextManager.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js b/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js deleted file mode 100644 index 758eeb2..0000000 --- a/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NoopContextManager = void 0; -const context_1 = require("./context"); -class NoopContextManager { - active() { - return context_1.ROOT_CONTEXT; - } - with(_context, fn, thisArg, ...args) { - return fn.call(thisArg, ...args); - } - bind(_context, target) { - return target; - } - enable() { - return this; - } - disable() { - return this; - } -} -exports.NoopContextManager = NoopContextManager; -//# sourceMappingURL=NoopContextManager.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js.map b/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js.map deleted file mode 100644 index cabf10e..0000000 --- a/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopContextManager.js","sourceRoot":"","sources":["../../../src/context/NoopContextManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCAAyC;AAGzC,MAAa,kBAAkB;IAC7B,MAAM;QACJ,OAAO,sBAAY,CAAC;IACtB,CAAC;IAED,IAAI,CACF,QAAuB,EACvB,EAAK,EACL,OAA8B,EAC9B,GAAG,IAAO;QAEV,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,CAAI,QAAuB,EAAE,MAAS;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzBD,gDAyBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ROOT_CONTEXT } from './context';\nimport type * as types from './types';\n\nexport class NoopContextManager implements types.ContextManager {\n active(): types.Context {\n return ROOT_CONTEXT;\n }\n\n with ReturnType>(\n _context: types.Context,\n fn: F,\n thisArg?: ThisParameterType,\n ...args: A\n ): ReturnType {\n return fn.call(thisArg, ...args);\n }\n\n bind(_context: types.Context, target: T): T {\n return target;\n }\n\n enable(): this {\n return this;\n }\n\n disable(): this {\n return this;\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context/context.d.ts b/node_modules/@opentelemetry/api/build/src/context/context.d.ts deleted file mode 100644 index 8d0aa04..0000000 --- a/node_modules/@opentelemetry/api/build/src/context/context.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Context } from './types'; -/** - * Get a key to uniquely identify a context value - * - * @since 1.0.0 - */ -export declare function createContextKey(description: string): symbol; -/** - * The root context is used as the default parent context when there is no active context - * - * @since 1.0.0 - */ -export declare const ROOT_CONTEXT: Context; -//# sourceMappingURL=context.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context/context.js b/node_modules/@opentelemetry/api/build/src/context/context.js deleted file mode 100644 index 7ecd57c..0000000 --- a/node_modules/@opentelemetry/api/build/src/context/context.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ROOT_CONTEXT = exports.createContextKey = void 0; -/** - * Get a key to uniquely identify a context value - * - * @since 1.0.0 - */ -function createContextKey(description) { - // The specification states that for the same input, multiple calls should - // return different keys. Due to the nature of the JS dependency management - // system, this creates problems where multiple versions of some package - // could hold different keys for the same property. - // - // Therefore, we use Symbol.for which returns the same key for the same input. - return Symbol.for(description); -} -exports.createContextKey = createContextKey; -class BaseContext { - /** - * Construct a new context which inherits values from an optional parent context. - * - * @param parentContext a context from which to inherit values - */ - constructor(parentContext) { - // for minification - const self = this; - self._currentContext = parentContext ? new Map(parentContext) : new Map(); - self.getValue = (key) => self._currentContext.get(key); - self.setValue = (key, value) => { - const context = new BaseContext(self._currentContext); - context._currentContext.set(key, value); - return context; - }; - self.deleteValue = (key) => { - const context = new BaseContext(self._currentContext); - context._currentContext.delete(key); - return context; - }; - } -} -/** - * The root context is used as the default parent context when there is no active context - * - * @since 1.0.0 - */ -exports.ROOT_CONTEXT = new BaseContext(); -//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context/context.js.map b/node_modules/@opentelemetry/api/build/src/context/context.js.map deleted file mode 100644 index 33e2014..0000000 --- a/node_modules/@opentelemetry/api/build/src/context/context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/context/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,WAAmB;IAClD,0EAA0E;IAC1E,2EAA2E;IAC3E,wEAAwE;IACxE,mDAAmD;IACnD,EAAE;IACF,8EAA8E;IAC9E,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC;AARD,4CAQC;AAED,MAAM,WAAW;IAGf;;;;OAIG;IACH,YAAY,aAAoC;QAC9C,mBAAmB;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;QAE1E,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE/D,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAW,EAAE,KAAc,EAAW,EAAE;YACvD,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtD,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACxC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,CAAC,GAAW,EAAW,EAAE;YAC1C,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtD,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACpC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;CAyBF;AAED;;;;GAIG;AACU,QAAA,YAAY,GAAY,IAAI,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from './types';\n\n/**\n * Get a key to uniquely identify a context value\n *\n * @since 1.0.0\n */\nexport function createContextKey(description: string) {\n // The specification states that for the same input, multiple calls should\n // return different keys. Due to the nature of the JS dependency management\n // system, this creates problems where multiple versions of some package\n // could hold different keys for the same property.\n //\n // Therefore, we use Symbol.for which returns the same key for the same input.\n return Symbol.for(description);\n}\n\nclass BaseContext implements Context {\n private _currentContext!: Map;\n\n /**\n * Construct a new context which inherits values from an optional parent context.\n *\n * @param parentContext a context from which to inherit values\n */\n constructor(parentContext?: Map) {\n // for minification\n const self = this;\n\n self._currentContext = parentContext ? new Map(parentContext) : new Map();\n\n self.getValue = (key: symbol) => self._currentContext.get(key);\n\n self.setValue = (key: symbol, value: unknown): Context => {\n const context = new BaseContext(self._currentContext);\n context._currentContext.set(key, value);\n return context;\n };\n\n self.deleteValue = (key: symbol): Context => {\n const context = new BaseContext(self._currentContext);\n context._currentContext.delete(key);\n return context;\n };\n }\n\n /**\n * Get a value from the context.\n *\n * @param key key which identifies a context value\n */\n public getValue!: (key: symbol) => unknown;\n\n /**\n * Create a new context which inherits from this context and has\n * the given key set to the given value.\n *\n * @param key context key for which to set the value\n * @param value value to set for the given key\n */\n public setValue!: (key: symbol, value: unknown) => Context;\n\n /**\n * Return a new context which inherits from this context but does\n * not contain a value for the given key.\n *\n * @param key context key for which to clear a value\n */\n public deleteValue!: (key: symbol) => Context;\n}\n\n/**\n * The root context is used as the default parent context when there is no active context\n *\n * @since 1.0.0\n */\nexport const ROOT_CONTEXT: Context = new BaseContext();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context/types.d.ts b/node_modules/@opentelemetry/api/build/src/context/types.d.ts deleted file mode 100644 index 3c1f7a5..0000000 --- a/node_modules/@opentelemetry/api/build/src/context/types.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @since 1.0.0 - */ -export interface Context { - /** - * Get a value from the context. - * - * @param key key which identifies a context value - */ - getValue(key: symbol): unknown; - /** - * Create a new context which inherits from this context and has - * the given key set to the given value. - * - * @param key context key for which to set the value - * @param value value to set for the given key - */ - setValue(key: symbol, value: unknown): Context; - /** - * Return a new context which inherits from this context but does - * not contain a value for the given key. - * - * @param key context key for which to clear a value - */ - deleteValue(key: symbol): Context; -} -/** - * @since 1.0.0 - */ -export interface ContextManager { - /** - * Get the current active context - */ - active(): Context; - /** - * Run the fn callback with object set as the current active context - * @param context Any object to set as the current active context - * @param fn A callback to be immediately run within a specific context - * @param thisArg optional receiver to be used for calling fn - * @param args optional arguments forwarded to fn - */ - with ReturnType>(context: Context, fn: F, thisArg?: ThisParameterType, ...args: A): ReturnType; - /** - * Bind an object as the current context (or a specific one) - * @param [context] Optionally specify the context which you want to assign - * @param target Any object to which a context need to be set - */ - bind(context: Context, target: T): T; - /** - * Enable context management - */ - enable(): this; - /** - * Disable context management - */ - disable(): this; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context/types.js b/node_modules/@opentelemetry/api/build/src/context/types.js deleted file mode 100644 index 6ca0a43..0000000 --- a/node_modules/@opentelemetry/api/build/src/context/types.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/context/types.js.map b/node_modules/@opentelemetry/api/build/src/context/types.js.map deleted file mode 100644 index 1003f23..0000000 --- a/node_modules/@opentelemetry/api/build/src/context/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/context/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface Context {\n /**\n * Get a value from the context.\n *\n * @param key key which identifies a context value\n */\n getValue(key: symbol): unknown;\n\n /**\n * Create a new context which inherits from this context and has\n * the given key set to the given value.\n *\n * @param key context key for which to set the value\n * @param value value to set for the given key\n */\n setValue(key: symbol, value: unknown): Context;\n\n /**\n * Return a new context which inherits from this context but does\n * not contain a value for the given key.\n *\n * @param key context key for which to clear a value\n */\n deleteValue(key: symbol): Context;\n}\n\n/**\n * @since 1.0.0\n */\nexport interface ContextManager {\n /**\n * Get the current active context\n */\n active(): Context;\n\n /**\n * Run the fn callback with object set as the current active context\n * @param context Any object to set as the current active context\n * @param fn A callback to be immediately run within a specific context\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n with ReturnType>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType,\n ...args: A\n ): ReturnType;\n\n /**\n * Bind an object as the current context (or a specific one)\n * @param [context] Optionally specify the context which you want to assign\n * @param target Any object to which a context need to be set\n */\n bind(context: Context, target: T): T;\n\n /**\n * Enable context management\n */\n enable(): this;\n\n /**\n * Disable context management\n */\n disable(): this;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag-api.d.ts b/node_modules/@opentelemetry/api/build/src/diag-api.d.ts deleted file mode 100644 index ae1045b..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag-api.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { DiagAPI } from './api/diag'; -/** - * Entrypoint for Diag API. - * Defines Diagnostic handler used for internal diagnostic logging operations. - * The default provides a Noop DiagLogger implementation which may be changed via the - * diag.setLogger(logger: DiagLogger) function. - * - * @since 1.0.0 - */ -export declare const diag: DiagAPI; -//# sourceMappingURL=diag-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag-api.js b/node_modules/@opentelemetry/api/build/src/diag-api.js deleted file mode 100644 index ae6f797..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag-api.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.diag = void 0; -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -const diag_1 = require("./api/diag"); -/** - * Entrypoint for Diag API. - * Defines Diagnostic handler used for internal diagnostic logging operations. - * The default provides a Noop DiagLogger implementation which may be changed via the - * diag.setLogger(logger: DiagLogger) function. - * - * @since 1.0.0 - */ -exports.diag = diag_1.DiagAPI.instance(); -//# sourceMappingURL=diag-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag-api.js.map b/node_modules/@opentelemetry/api/build/src/diag-api.js.map deleted file mode 100644 index 7356f59..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"diag-api.js","sourceRoot":"","sources":["../../src/diag-api.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,qCAAqC;AACrC;;;;;;;GAOG;AACU,QAAA,IAAI,GAAG,cAAO,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { DiagAPI } from './api/diag';\n/**\n * Entrypoint for Diag API.\n * Defines Diagnostic handler used for internal diagnostic logging operations.\n * The default provides a Noop DiagLogger implementation which may be changed via the\n * diag.setLogger(logger: DiagLogger) function.\n *\n * @since 1.0.0\n */\nexport const diag = DiagAPI.instance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.d.ts b/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.d.ts deleted file mode 100644 index 76e2f56..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { ComponentLoggerOptions, DiagLogger } from './types'; -/** - * Component Logger which is meant to be used as part of any component which - * will add automatically additional namespace in front of the log message. - * It will then forward all message to global diag logger - * @example - * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' }); - * cLogger.debug('test'); - * // @opentelemetry/instrumentation-http test - */ -export declare class DiagComponentLogger implements DiagLogger { - private _namespace; - constructor(props: ComponentLoggerOptions); - debug(...args: unknown[]): void; - error(...args: unknown[]): void; - info(...args: unknown[]): void; - warn(...args: unknown[]): void; - verbose(...args: unknown[]): void; -} -//# sourceMappingURL=ComponentLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js b/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js deleted file mode 100644 index 085806b..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DiagComponentLogger = void 0; -const global_utils_1 = require("../internal/global-utils"); -/** - * Component Logger which is meant to be used as part of any component which - * will add automatically additional namespace in front of the log message. - * It will then forward all message to global diag logger - * @example - * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' }); - * cLogger.debug('test'); - * // @opentelemetry/instrumentation-http test - */ -class DiagComponentLogger { - constructor(props) { - this._namespace = props.namespace || 'DiagComponentLogger'; - } - debug(...args) { - return logProxy('debug', this._namespace, args); - } - error(...args) { - return logProxy('error', this._namespace, args); - } - info(...args) { - return logProxy('info', this._namespace, args); - } - warn(...args) { - return logProxy('warn', this._namespace, args); - } - verbose(...args) { - return logProxy('verbose', this._namespace, args); - } -} -exports.DiagComponentLogger = DiagComponentLogger; -function logProxy(funcName, namespace, args) { - const logger = (0, global_utils_1.getGlobal)('diag'); - // shortcut if logger not set - if (!logger) { - return; - } - return logger[funcName](namespace, ...args); -} -//# sourceMappingURL=ComponentLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js.map b/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js.map deleted file mode 100644 index 33810a6..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ComponentLogger.js","sourceRoot":"","sources":["../../../src/diag/ComponentLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAqD;AAGrD;;;;;;;;GAQG;AACH,MAAa,mBAAmB;IAG9B,YAAY,KAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,IAAI,qBAAqB,CAAC;IAC7D,CAAC;IAEM,KAAK,CAAC,GAAG,IAAe;QAC7B,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,GAAG,IAAe;QAC7B,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAe;QAC5B,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAe;QAC5B,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,OAAO,CAAC,GAAG,IAAe;QAC/B,OAAO,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF;AA1BD,kDA0BC;AAED,SAAS,QAAQ,CACf,QAA0B,EAC1B,SAAiB,EACjB,IAAe;IAEf,MAAM,MAAM,GAAG,IAAA,wBAAS,EAAC,MAAM,CAAC,CAAC;IACjC,6BAA6B;IAC7B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IAED,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { getGlobal } from '../internal/global-utils';\nimport type { ComponentLoggerOptions, DiagLogger } from './types';\n\n/**\n * Component Logger which is meant to be used as part of any component which\n * will add automatically additional namespace in front of the log message.\n * It will then forward all message to global diag logger\n * @example\n * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });\n * cLogger.debug('test');\n * // @opentelemetry/instrumentation-http test\n */\nexport class DiagComponentLogger implements DiagLogger {\n private _namespace: string;\n\n constructor(props: ComponentLoggerOptions) {\n this._namespace = props.namespace || 'DiagComponentLogger';\n }\n\n public debug(...args: unknown[]): void {\n return logProxy('debug', this._namespace, args);\n }\n\n public error(...args: unknown[]): void {\n return logProxy('error', this._namespace, args);\n }\n\n public info(...args: unknown[]): void {\n return logProxy('info', this._namespace, args);\n }\n\n public warn(...args: unknown[]): void {\n return logProxy('warn', this._namespace, args);\n }\n\n public verbose(...args: unknown[]): void {\n return logProxy('verbose', this._namespace, args);\n }\n}\n\nfunction logProxy(\n funcName: keyof DiagLogger,\n namespace: string,\n args: unknown[]\n): void {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) {\n return;\n }\n\n return logger[funcName](namespace, ...args);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.d.ts b/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.d.ts deleted file mode 100644 index 8bae476..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { DiagLogger, DiagLogFunction } from './types'; -type ConsoleMapKeys = 'error' | 'warn' | 'info' | 'debug' | 'trace'; -export declare const _originalConsoleMethods: Partial>; -/** - * A simple Immutable Console based diagnostic logger which will output any messages to the Console. - * If you want to limit the amount of logging to a specific level or lower use the - * {@link createLogLevelDiagLogger} - * - * @since 1.0.0 - */ -export declare class DiagConsoleLogger implements DiagLogger { - constructor(); - /** Log an error scenario that was not expected and caused the requested operation to fail. */ - error: DiagLogFunction; - /** - * Log a warning scenario to inform the developer of an issues that should be investigated. - * The requested operation may or may not have succeeded or completed. - */ - warn: DiagLogFunction; - /** - * Log a general informational message, this should not affect functionality. - * This is also the default logging level so this should NOT be used for logging - * debugging level information. - */ - info: DiagLogFunction; - /** - * Log a general debug message that can be useful for identifying a failure. - * Information logged at this level may include diagnostic details that would - * help identify a failure scenario. Useful scenarios would be to log the execution - * order of async operations - */ - debug: DiagLogFunction; - /** - * Log a detailed (verbose) trace level logging that can be used to identify failures - * where debug level logging would be insufficient, this level of tracing can include - * input and output parameters and as such may include PII information passing through - * the API. As such it is recommended that this level of tracing should not be enabled - * in a production environment. - */ - verbose: DiagLogFunction; -} -export {}; -//# sourceMappingURL=consoleLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js b/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js deleted file mode 100644 index 567a1cd..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DiagConsoleLogger = exports._originalConsoleMethods = void 0; -const consoleMap = [ - { n: 'error', c: 'error' }, - { n: 'warn', c: 'warn' }, - { n: 'info', c: 'info' }, - { n: 'debug', c: 'debug' }, - { n: 'verbose', c: 'trace' }, -]; -// Save original console methods at module load time, before any instrumentation -// can wrap them. This ensures DiagConsoleLogger calls the unwrapped originals. -// Exported for testing only — not part of the public API. -exports._originalConsoleMethods = {}; -if (typeof console !== 'undefined') { - const keys = [ - 'error', - 'warn', - 'info', - 'debug', - 'trace', - 'log', - ]; - for (const key of keys) { - // eslint-disable-next-line no-console - if (typeof console[key] === 'function') { - // eslint-disable-next-line no-console - exports._originalConsoleMethods[key] = console[key]; - } - } -} -/** - * A simple Immutable Console based diagnostic logger which will output any messages to the Console. - * If you want to limit the amount of logging to a specific level or lower use the - * {@link createLogLevelDiagLogger} - * - * @since 1.0.0 - */ -class DiagConsoleLogger { - constructor() { - function _consoleFunc(funcName) { - return function (...args) { - // Prefer original (pre-instrumentation) methods saved at module load time. - let theFunc = exports._originalConsoleMethods[funcName]; - // Some environments only expose the console when the F12 developer console is open - if (typeof theFunc !== 'function') { - theFunc = exports._originalConsoleMethods['log']; - } - // Fall back in case console was not available at module load time but became available later. - if (typeof theFunc !== 'function' && console) { - // eslint-disable-next-line no-console - theFunc = console[funcName]; - if (typeof theFunc !== 'function') { - // eslint-disable-next-line no-console - theFunc = console.log; - } - } - if (typeof theFunc === 'function') { - return theFunc.apply(console, args); - } - }; - } - for (let i = 0; i < consoleMap.length; i++) { - this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c); - } - } -} -exports.DiagConsoleLogger = DiagConsoleLogger; -//# sourceMappingURL=consoleLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js.map b/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js.map deleted file mode 100644 index 4bc5bbc..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"consoleLogger.js","sourceRoot":"","sources":["../../../src/diag/consoleLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAM,UAAU,GAAiD;IAC/D,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACxB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACxB,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1B,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE;CAC7B,CAAC;AAEF,gFAAgF;AAChF,+EAA+E;AAC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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvD;IACH,CAAC;CAkCF;AA9DD,8CA8DC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DiagLogger, DiagLogFunction } from './types';\n\ntype ConsoleMapKeys = 'error' | 'warn' | 'info' | 'debug' | 'trace';\nconst consoleMap: { n: keyof DiagLogger; c: ConsoleMapKeys }[] = [\n { n: 'error', c: 'error' },\n { n: 'warn', c: 'warn' },\n { n: 'info', c: 'info' },\n { n: 'debug', c: 'debug' },\n { n: 'verbose', c: 'trace' },\n];\n\n// Save original console methods at module load time, before any instrumentation\n// can wrap them. This ensures DiagConsoleLogger calls the unwrapped originals.\n// Exported for testing only — not part of the public API.\nexport const _originalConsoleMethods: Partial<\n Record\n> = {};\nif (typeof console !== 'undefined') {\n const keys: (ConsoleMapKeys | 'log')[] = [\n 'error',\n 'warn',\n 'info',\n 'debug',\n 'trace',\n 'log',\n ];\n for (const key of keys) {\n // eslint-disable-next-line no-console\n if (typeof console[key] === 'function') {\n // eslint-disable-next-line no-console\n _originalConsoleMethods[key] = console[key];\n }\n }\n}\n\n/**\n * A simple Immutable Console based diagnostic logger which will output any messages to the Console.\n * If you want to limit the amount of logging to a specific level or lower use the\n * {@link createLogLevelDiagLogger}\n *\n * @since 1.0.0\n */\nexport class DiagConsoleLogger implements DiagLogger {\n constructor() {\n function _consoleFunc(funcName: ConsoleMapKeys): DiagLogFunction {\n return function (...args) {\n // Prefer original (pre-instrumentation) methods saved at module load time.\n let theFunc = _originalConsoleMethods[funcName];\n // Some environments only expose the console when the F12 developer console is open\n if (typeof theFunc !== 'function') {\n theFunc = _originalConsoleMethods['log'];\n }\n // Fall back in case console was not available at module load time but became available later.\n if (typeof theFunc !== 'function' && console) {\n // eslint-disable-next-line no-console\n theFunc = console[funcName];\n if (typeof theFunc !== 'function') {\n // eslint-disable-next-line no-console\n theFunc = console.log;\n }\n }\n if (typeof theFunc === 'function') {\n return theFunc.apply(console, args);\n }\n };\n }\n\n for (let i = 0; i < consoleMap.length; i++) {\n this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);\n }\n }\n\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n public error!: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n public warn!: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n public info!: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario. Useful scenarios would be to log the execution\n * order of async operations\n */\n public debug!: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n public verbose!: DiagLogFunction;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.d.ts b/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.d.ts deleted file mode 100644 index b85ee88..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { DiagLogger } from '../types'; -import { DiagLogLevel } from '../types'; -export declare function createLogLevelDiagLogger(maxLevel: DiagLogLevel, logger: DiagLogger): DiagLogger; -//# sourceMappingURL=logLevelLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.js b/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.js deleted file mode 100644 index 8e009ed..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createLogLevelDiagLogger = void 0; -const types_1 = require("../types"); -function createLogLevelDiagLogger(maxLevel, logger) { - if (maxLevel < types_1.DiagLogLevel.NONE) { - maxLevel = types_1.DiagLogLevel.NONE; - } - else if (maxLevel > types_1.DiagLogLevel.ALL) { - maxLevel = types_1.DiagLogLevel.ALL; - } - // In case the logger is null or undefined - logger = logger || {}; - function _filterFunc(funcName, theLevel) { - const theFunc = logger[funcName]; - if (typeof theFunc === 'function' && maxLevel >= theLevel) { - return theFunc.bind(logger); - } - return function () { }; - } - return { - error: _filterFunc('error', types_1.DiagLogLevel.ERROR), - warn: _filterFunc('warn', types_1.DiagLogLevel.WARN), - info: _filterFunc('info', types_1.DiagLogLevel.INFO), - debug: _filterFunc('debug', types_1.DiagLogLevel.DEBUG), - verbose: _filterFunc('verbose', types_1.DiagLogLevel.VERBOSE), - }; -} -exports.createLogLevelDiagLogger = createLogLevelDiagLogger; -//# sourceMappingURL=logLevelLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.js.map b/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.js.map deleted file mode 100644 index c46edd5..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logLevelLogger.js","sourceRoot":"","sources":["../../../../src/diag/internal/logLevelLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,oCAAwC;AAExC,SAAgB,wBAAwB,CACtC,QAAsB,EACtB,MAAkB;IAElB,IAAI,QAAQ,GAAG,oBAAY,CAAC,IAAI,EAAE;QAChC,QAAQ,GAAG,oBAAY,CAAC,IAAI,CAAC;KAC9B;SAAM,IAAI,QAAQ,GAAG,oBAAY,CAAC,GAAG,EAAE;QACtC,QAAQ,GAAG,oBAAY,CAAC,GAAG,CAAC;KAC7B;IAED,0CAA0C;IAC1C,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAEtB,SAAS,WAAW,CAClB,QAA0B,EAC1B,QAAsB;QAEtB,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEjC,IAAI,OAAO,OAAO,KAAK,UAAU,IAAI,QAAQ,IAAI,QAAQ,EAAE;YACzD,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,cAAa,CAAC,CAAC;IACxB,CAAC;IAED,OAAO;QACL,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,oBAAY,CAAC,KAAK,CAAC;QAC/C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAY,CAAC,IAAI,CAAC;QAC5C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAY,CAAC,IAAI,CAAC;QAC5C,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,oBAAY,CAAC,KAAK,CAAC;QAC/C,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,oBAAY,CAAC,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC;AAhCD,4DAgCC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DiagLogFunction, DiagLogger } from '../types';\nimport { DiagLogLevel } from '../types';\n\nexport function createLogLevelDiagLogger(\n maxLevel: DiagLogLevel,\n logger: DiagLogger\n): DiagLogger {\n if (maxLevel < DiagLogLevel.NONE) {\n maxLevel = DiagLogLevel.NONE;\n } else if (maxLevel > DiagLogLevel.ALL) {\n maxLevel = DiagLogLevel.ALL;\n }\n\n // In case the logger is null or undefined\n logger = logger || {};\n\n function _filterFunc(\n funcName: keyof DiagLogger,\n theLevel: DiagLogLevel\n ): DiagLogFunction {\n const theFunc = logger[funcName];\n\n if (typeof theFunc === 'function' && maxLevel >= theLevel) {\n return theFunc.bind(logger);\n }\n return function () {};\n }\n\n return {\n error: _filterFunc('error', DiagLogLevel.ERROR),\n warn: _filterFunc('warn', DiagLogLevel.WARN),\n info: _filterFunc('info', DiagLogLevel.INFO),\n debug: _filterFunc('debug', DiagLogLevel.DEBUG),\n verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE),\n };\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/internal/noopLogger.d.ts b/node_modules/@opentelemetry/api/build/src/diag/internal/noopLogger.d.ts deleted file mode 100644 index f4d02f5..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/internal/noopLogger.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { DiagLogger } from '../types'; -/** - * Returns a No-Op Diagnostic logger where all messages do nothing. - * @implements {@link DiagLogger} - * @returns {DiagLogger} - */ -export declare function createNoopDiagLogger(): DiagLogger; -//# sourceMappingURL=noopLogger.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/internal/noopLogger.js b/node_modules/@opentelemetry/api/build/src/diag/internal/noopLogger.js deleted file mode 100644 index a68ed58..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/internal/noopLogger.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createNoopDiagLogger = void 0; -function noopLogFunction() { } -/** - * Returns a No-Op Diagnostic logger where all messages do nothing. - * @implements {@link DiagLogger} - * @returns {DiagLogger} - */ -function createNoopDiagLogger() { - return { - verbose: noopLogFunction, - debug: noopLogFunction, - info: noopLogFunction, - warn: noopLogFunction, - error: noopLogFunction, - }; -} -exports.createNoopDiagLogger = createNoopDiagLogger; -//# sourceMappingURL=noopLogger.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/internal/noopLogger.js.map b/node_modules/@opentelemetry/api/build/src/diag/internal/noopLogger.js.map deleted file mode 100644 index b900ab8..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/internal/noopLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"noopLogger.js","sourceRoot":"","sources":["../../../../src/diag/internal/noopLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,SAAS,eAAe,KAAI,CAAC;AAE7B;;;;GAIG;AACH,SAAgB,oBAAoB;IAClC,OAAO;QACL,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,eAAe;KACvB,CAAC;AACJ,CAAC;AARD,oDAQC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DiagLogger } from '../types';\n\nfunction noopLogFunction() {}\n\n/**\n * Returns a No-Op Diagnostic logger where all messages do nothing.\n * @implements {@link DiagLogger}\n * @returns {DiagLogger}\n */\nexport function createNoopDiagLogger(): DiagLogger {\n return {\n verbose: noopLogFunction,\n debug: noopLogFunction,\n info: noopLogFunction,\n warn: noopLogFunction,\n error: noopLogFunction,\n };\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/types.d.ts b/node_modules/@opentelemetry/api/build/src/diag/types.d.ts deleted file mode 100644 index 64950a7..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/types.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @since 1.0.0 - */ -export type DiagLogFunction = (message: string, ...args: unknown[]) => void; -/** - * Defines an internal diagnostic logger interface which is used to log internal diagnostic - * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function. - * API provided implementations include :- - * - a No-Op {@link createNoopDiagLogger} - * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger} - * - a general Console {@link DiagConsoleLogger} version. - * - * @since 1.0.0 - */ -export interface DiagLogger { - /** Log an error scenario that was not expected and caused the requested operation to fail. */ - error: DiagLogFunction; - /** - * Log a warning scenario to inform the developer of an issues that should be investigated. - * The requested operation may or may not have succeeded or completed. - */ - warn: DiagLogFunction; - /** - * Log a general informational message, this should not affect functionality. - * This is also the default logging level so this should NOT be used for logging - * debugging level information. - */ - info: DiagLogFunction; - /** - * Log a general debug message that can be useful for identifying a failure. - * Information logged at this level may include diagnostic details that would - * help identify a failure scenario. - * For example: Logging the order of execution of async operations. - */ - debug: DiagLogFunction; - /** - * Log a detailed (verbose) trace level logging that can be used to identify failures - * where debug level logging would be insufficient, this level of tracing can include - * input and output parameters and as such may include PII information passing through - * the API. As such it is recommended that this level of tracing should not be enabled - * in a production environment. - */ - verbose: DiagLogFunction; -} -/** - * Defines the available internal logging levels for the diagnostic logger, the numeric values - * of the levels are defined to match the original values from the initial LogLevel to avoid - * compatibility/migration issues for any implementation that assume the numeric ordering. - */ -export declare enum DiagLogLevel { - /** Diagnostic Logging level setting to disable all logging (except and forced logs) */ - NONE = 0, - /** Identifies an error scenario */ - ERROR = 30, - /** Identifies a warning scenario */ - WARN = 50, - /** General informational log message */ - INFO = 60, - /** General debug log message */ - DEBUG = 70, - /** - * Detailed trace level logging should only be used for development, should only be set - * in a development environment. - */ - VERBOSE = 80, - /** Used to set the logging level to include all logging */ - ALL = 9999 -} -/** - * Defines options for ComponentLogger - * - * @since 1.0.0 - */ -export interface ComponentLoggerOptions { - namespace: string; -} -/** - * @since 1.4.1 - */ -export interface DiagLoggerOptions { - /** - * The {@link DiagLogLevel} used to filter logs sent to the logger. - * - * @defaultValue DiagLogLevel.INFO - */ - logLevel?: DiagLogLevel; - /** - * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered. - */ - suppressOverrideMessage?: boolean; -} -export interface DiagLoggerApi { - /** - * Set the global DiagLogger and DiagLogLevel. - * If a global diag logger is already set, this will override it. - * - * @param logger - The {@link DiagLogger} instance to set as the default logger. - * @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set. - * @returns `true` if the logger was successfully registered, else `false` - */ - setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean; - /** - * - * @param logger - The {@link DiagLogger} instance to set as the default logger. - * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}. - * @returns `true` if the logger was successfully registered, else `false` - */ - setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean; -} -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/types.js b/node_modules/@opentelemetry/api/build/src/diag/types.js deleted file mode 100644 index d288aa7..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/types.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DiagLogLevel = void 0; -/** - * Defines the available internal logging levels for the diagnostic logger, the numeric values - * of the levels are defined to match the original values from the initial LogLevel to avoid - * compatibility/migration issues for any implementation that assume the numeric ordering. - */ -var DiagLogLevel; -(function (DiagLogLevel) { - /** Diagnostic Logging level setting to disable all logging (except and forced logs) */ - DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE"; - /** Identifies an error scenario */ - DiagLogLevel[DiagLogLevel["ERROR"] = 30] = "ERROR"; - /** Identifies a warning scenario */ - DiagLogLevel[DiagLogLevel["WARN"] = 50] = "WARN"; - /** General informational log message */ - DiagLogLevel[DiagLogLevel["INFO"] = 60] = "INFO"; - /** General debug log message */ - DiagLogLevel[DiagLogLevel["DEBUG"] = 70] = "DEBUG"; - /** - * Detailed trace level logging should only be used for development, should only be set - * in a development environment. - */ - DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE"; - /** Used to set the logging level to include all logging */ - DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL"; -})(DiagLogLevel = exports.DiagLogLevel || (exports.DiagLogLevel = {})); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/diag/types.js.map b/node_modules/@opentelemetry/api/build/src/diag/types.js.map deleted file mode 100644 index 0bd269e..0000000 --- a/node_modules/@opentelemetry/api/build/src/diag/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/diag/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoDH;;;;GAIG;AACH,IAAY,YAwBX;AAxBD,WAAY,YAAY;IACtB,uFAAuF;IACvF,+CAAQ,CAAA;IAER,mCAAmC;IACnC,kDAAU,CAAA;IAEV,oCAAoC;IACpC,gDAAS,CAAA;IAET,wCAAwC;IACxC,gDAAS,CAAA;IAET,gCAAgC;IAChC,kDAAU,CAAA;IAEV;;;OAGG;IACH,sDAAY,CAAA;IAEZ,2DAA2D;IAC3D,gDAAU,CAAA;AACZ,CAAC,EAxBW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAwBvB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport type DiagLogFunction = (message: string, ...args: unknown[]) => void;\n\n/**\n * Defines an internal diagnostic logger interface which is used to log internal diagnostic\n * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.\n * API provided implementations include :-\n * - a No-Op {@link createNoopDiagLogger}\n * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}\n * - a general Console {@link DiagConsoleLogger} version.\n *\n * @since 1.0.0\n */\nexport interface DiagLogger {\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n error: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n warn: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n info: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario.\n * For example: Logging the order of execution of async operations.\n */\n debug: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n verbose: DiagLogFunction;\n}\n\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport enum DiagLogLevel {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n NONE = 0,\n\n /** Identifies an error scenario */\n ERROR = 30,\n\n /** Identifies a warning scenario */\n WARN = 50,\n\n /** General informational log message */\n INFO = 60,\n\n /** General debug log message */\n DEBUG = 70,\n\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n VERBOSE = 80,\n\n /** Used to set the logging level to include all logging */\n ALL = 9999,\n}\n\n/**\n * Defines options for ComponentLogger\n *\n * @since 1.0.0\n */\nexport interface ComponentLoggerOptions {\n namespace: string;\n}\n\n/**\n * @since 1.4.1\n */\nexport interface DiagLoggerOptions {\n /**\n * The {@link DiagLogLevel} used to filter logs sent to the logger.\n *\n * @defaultValue DiagLogLevel.INFO\n */\n logLevel?: DiagLogLevel;\n\n /**\n * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered.\n */\n suppressOverrideMessage?: boolean;\n}\n\nexport interface DiagLoggerApi {\n /**\n * Set the global DiagLogger and DiagLogLevel.\n * If a global diag logger is already set, this will override it.\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean;\n\n /**\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/experimental/index.d.ts b/node_modules/@opentelemetry/api/build/src/experimental/index.d.ts deleted file mode 100644 index 020da5d..0000000 --- a/node_modules/@opentelemetry/api/build/src/experimental/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Any exports here may change at any time and without warning - * @module @opentelemetry/api/experimental - */ -export { wrapTracer, SugaredTracer } from './trace/SugaredTracer'; -export type { SugaredSpanOptions } from './trace/SugaredOptions'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/experimental/index.js b/node_modules/@opentelemetry/api/build/src/experimental/index.js deleted file mode 100644 index 005e877..0000000 --- a/node_modules/@opentelemetry/api/build/src/experimental/index.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SugaredTracer = exports.wrapTracer = void 0; -/** - * Any exports here may change at any time and without warning - * @module @opentelemetry/api/experimental - */ -var SugaredTracer_1 = require("./trace/SugaredTracer"); -Object.defineProperty(exports, "wrapTracer", { enumerable: true, get: function () { return SugaredTracer_1.wrapTracer; } }); -Object.defineProperty(exports, "SugaredTracer", { enumerable: true, get: function () { return SugaredTracer_1.SugaredTracer; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/experimental/index.js.map b/node_modules/@opentelemetry/api/build/src/experimental/index.js.map deleted file mode 100644 index f66e74d..0000000 --- a/node_modules/@opentelemetry/api/build/src/experimental/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/experimental/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;GAGG;AAEH,uDAAkE;AAAzD,2GAAA,UAAU,OAAA;AAAE,8GAAA,aAAa,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Any exports here may change at any time and without warning\n * @module @opentelemetry/api/experimental\n */\n\nexport { wrapTracer, SugaredTracer } from './trace/SugaredTracer';\nexport type { SugaredSpanOptions } from './trace/SugaredOptions';\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredOptions.d.ts b/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredOptions.d.ts deleted file mode 100644 index ea74870..0000000 --- a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredOptions.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Span, SpanOptions } from '../../'; -/** - * Options needed for span creation - */ -export interface SugaredSpanOptions extends SpanOptions { - /** - * function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function. - * @param e Error which triggered this exception - * @param span current span from context - */ - onException?: (e: Error, span: Span) => void; -} -//# sourceMappingURL=SugaredOptions.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredOptions.js b/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredOptions.js deleted file mode 100644 index 0808da3..0000000 --- a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredOptions.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=SugaredOptions.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredOptions.js.map b/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredOptions.js.map deleted file mode 100644 index f827587..0000000 --- a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SugaredOptions.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredOptions.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Span, SpanOptions } from '../../';\n\n/**\n * Options needed for span creation\n */\nexport interface SugaredSpanOptions extends SpanOptions {\n /**\n * function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function.\n * @param e Error which triggered this exception\n * @param span current span from context\n */\n onException?: (e: Error, span: Span) => void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredTracer.d.ts b/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredTracer.d.ts deleted file mode 100644 index f78235b..0000000 --- a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredTracer.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { SugaredSpanOptions } from './SugaredOptions'; -import type { Context, Span, Tracer } from '../../'; -/** - * return a new SugaredTracer created from the supplied one - * @param tracer - */ -export declare function wrapTracer(tracer: Tracer): SugaredTracer; -export declare class SugaredTracer implements Tracer { - private readonly _tracer; - constructor(tracer: Tracer); - startActiveSpan: Tracer['startActiveSpan']; - startSpan: Tracer['startSpan']; - /** - * Starts a new {@link Span} and calls the given function passing it the - * created span as first argument. - * Additionally, the new span gets set in context and this context is activated - * for the duration of the function call. - * The span will be closed after the function has executed. - * If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown. - * - * @param name The name of the span - * @param [options] SugaredSpanOptions used for span creation - * @param [context] Context to use to extract parent - * @param fn function called in the context of the span and receives the newly created span as an argument - * @returns return value of fn - * @example - * const something = tracer.withActiveSpan('op', span => { - * // do some work - * }); - * @example - * const something = await tracer.withActiveSpan('op', span => { - * // do some async work - * }); - */ - withActiveSpan ReturnType>(name: string, fn: F): ReturnType; - withActiveSpan ReturnType>(name: string, options: SugaredSpanOptions, fn: F): ReturnType; - withActiveSpan ReturnType>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType; - /** - * Starts a new {@link Span} and ends it after execution of fn without setting it on context. - * The span will be closed after the function has executed. - * If an exception occurs, it is recorded, the status is et to ERROR and rethrown. - * - * This method does NOT modify the current Context. - * - * @param name The name of the span - * @param [options] SugaredSpanOptions used for span creation - * @param [context] Context to use to extract parent - * @param fn function called in the context of the span and receives the newly created span as an argument - * @returns Span The newly created span - * @example - * const something = tracer.withSpan('op', span => { - * // do some work - * }); - * @example - * const something = await tracer.withSpan('op', span => { - * // do some async work - * }); - */ - withSpan ReturnType>(name: string, fn: F): ReturnType; - withSpan ReturnType>(name: string, options: SugaredSpanOptions, fn: F): ReturnType; - withSpan ReturnType>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType; - withSpan ReturnType>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType; -} -//# sourceMappingURL=SugaredTracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredTracer.js b/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredTracer.js deleted file mode 100644 index aae6249..0000000 --- a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredTracer.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SugaredTracer = exports.wrapTracer = void 0; -const __1 = require("../../"); -const defaultOnException = (e, span) => { - span.recordException(e); - span.setStatus({ - code: __1.SpanStatusCode.ERROR, - }); -}; -/** - * return a new SugaredTracer created from the supplied one - * @param tracer - */ -function wrapTracer(tracer) { - return new SugaredTracer(tracer); -} -exports.wrapTracer = wrapTracer; -class SugaredTracer { - constructor(tracer) { - this._tracer = tracer; - this.startSpan = tracer.startSpan.bind(this._tracer); - this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer); - } - withActiveSpan(name, arg2, arg3, arg4) { - const { opts, ctx, fn } = massageParams(arg2, arg3, arg4); - return this._tracer.startActiveSpan(name, opts, ctx, (span) => handleFn(span, opts, fn)); - } - withSpan(name, arg2, arg3, arg4) { - const { opts, ctx, fn } = massageParams(arg2, arg3, arg4); - const span = this._tracer.startSpan(name, opts, ctx); - return handleFn(span, opts, fn); - } -} -exports.SugaredTracer = SugaredTracer; -/** - * Massages parameters of withSpan and withActiveSpan to allow signature overwrites - * @param arg - * @param arg2 - * @param arg3 - */ -function massageParams(arg, arg2, arg3) { - let opts; - let ctx; - let fn; - if (!arg2 && !arg3) { - fn = arg; - } - else if (!arg3) { - opts = arg; - fn = arg2; - } - else { - opts = arg; - ctx = arg2; - fn = arg3; - } - opts = opts !== null && opts !== void 0 ? opts : {}; - ctx = ctx !== null && ctx !== void 0 ? ctx : __1.context.active(); - return { opts, ctx, fn }; -} -/** - * Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling - * @param span - * @param opts - * @param fn - */ -function handleFn(span, opts, fn) { - var _a; - const onException = (_a = opts.onException) !== null && _a !== void 0 ? _a : defaultOnException; - const errorHandler = (e) => { - onException(e, span); - span.end(); - throw e; - }; - try { - const ret = fn(span); - // if fn is an async function, attach a recordException and spanEnd callback to the promise - if (typeof (ret === null || ret === void 0 ? void 0 : ret.then) === 'function') { - return ret.then(val => { - span.end(); - return val; - }, errorHandler); - } - span.end(); - return ret; - } - catch (e) { - // add throw to signal the compiler that this will throw in the inner scope - throw errorHandler(e); - } -} -//# sourceMappingURL=SugaredTracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredTracer.js.map b/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredTracer.js.map deleted file mode 100644 index 90475a3..0000000 --- a/node_modules/@opentelemetry/api/build/src/experimental/trace/SugaredTracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SugaredTracer.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredTracer.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AI,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAA,KAAK,UAAU,EAAE;YACnC,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACpB,IAAI,CAAC,GAAG,EAAE,CAAC;gBACX,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,YAAY,CAAkB,CAAC;SACnC;QACD,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,OAAO,GAAoB,CAAC;KAC7B;IAAC,OAAO,CAAC,EAAE;QACV,2EAA2E;QAC3E,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC;KACvB;AACH,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { SugaredSpanOptions } from './SugaredOptions';\nimport type { Context, Span, Tracer } from '../../';\nimport { context as contextApi, SpanStatusCode } from '../../';\n\nconst defaultOnException = (e: Error, span: Span) => {\n span.recordException(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n });\n};\n\n/**\n * return a new SugaredTracer created from the supplied one\n * @param tracer\n */\nexport function wrapTracer(tracer: Tracer): SugaredTracer {\n return new SugaredTracer(tracer);\n}\n\nexport class SugaredTracer implements Tracer {\n private readonly _tracer: Tracer;\n\n constructor(tracer: Tracer) {\n this._tracer = tracer;\n this.startSpan = tracer.startSpan.bind(this._tracer);\n this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer);\n }\n\n startActiveSpan: Tracer['startActiveSpan'];\n startSpan: Tracer['startSpan'];\n\n /**\n * Starts a new {@link Span} and calls the given function passing it the\n * created span as first argument.\n * Additionally, the new span gets set in context and this context is activated\n * for the duration of the function call.\n * The span will be closed after the function has executed.\n * If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown.\n *\n * @param name The name of the span\n * @param [options] SugaredSpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns return value of fn\n * @example\n * const something = tracer.withActiveSpan('op', span => {\n * // do some work\n * });\n * @example\n * const something = await tracer.withActiveSpan('op', span => {\n * // do some async work\n * });\n */\n withActiveSpan ReturnType>(\n name: string,\n fn: F\n ): ReturnType;\n withActiveSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n fn: F\n ): ReturnType;\n withActiveSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n withActiveSpan ReturnType>(\n name: string,\n arg2: F | SugaredSpanOptions,\n arg3?: F | Context,\n arg4?: F\n ): ReturnType {\n const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);\n\n return this._tracer.startActiveSpan(name, opts, ctx, (span: Span) =>\n handleFn(span, opts, fn)\n ) as ReturnType;\n }\n\n /**\n * Starts a new {@link Span} and ends it after execution of fn without setting it on context.\n * The span will be closed after the function has executed.\n * If an exception occurs, it is recorded, the status is et to ERROR and rethrown.\n *\n * This method does NOT modify the current Context.\n *\n * @param name The name of the span\n * @param [options] SugaredSpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns Span The newly created span\n * @example\n * const something = tracer.withSpan('op', span => {\n * // do some work\n * });\n * @example\n * const something = await tracer.withSpan('op', span => {\n * // do some async work\n * });\n */\n withSpan ReturnType>(\n name: string,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n withSpan ReturnType>(\n name: string,\n arg2: SugaredSpanOptions | F,\n arg3?: Context | F,\n arg4?: F\n ): ReturnType {\n const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);\n\n const span = this._tracer.startSpan(name, opts, ctx);\n return handleFn(span, opts, fn) as ReturnType;\n }\n}\n\n/**\n * Massages parameters of withSpan and withActiveSpan to allow signature overwrites\n * @param arg\n * @param arg2\n * @param arg3\n */\nfunction massageParams ReturnType>(\n arg: F | SugaredSpanOptions,\n arg2?: F | Context,\n arg3?: F\n) {\n let opts: SugaredSpanOptions | undefined;\n let ctx: Context | undefined;\n let fn: F;\n\n if (!arg2 && !arg3) {\n fn = arg as F;\n } else if (!arg3) {\n opts = arg as SugaredSpanOptions;\n fn = arg2 as F;\n } else {\n opts = arg as SugaredSpanOptions;\n ctx = arg2 as Context;\n fn = arg3 as F;\n }\n opts = opts ?? {};\n ctx = ctx ?? contextApi.active();\n\n return { opts, ctx, fn };\n}\n\n/**\n * Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling\n * @param span\n * @param opts\n * @param fn\n */\nfunction handleFn ReturnType>(\n span: Span,\n opts: SugaredSpanOptions,\n fn: F\n): ReturnType {\n const onException = opts.onException ?? defaultOnException;\n const errorHandler = (e: Error) => {\n onException(e, span);\n span.end();\n throw e;\n };\n\n try {\n const ret = fn(span) as Promise>;\n // if fn is an async function, attach a recordException and spanEnd callback to the promise\n if (typeof ret?.then === 'function') {\n return ret.then(val => {\n span.end();\n return val;\n }, errorHandler) as ReturnType;\n }\n span.end();\n return ret as ReturnType;\n } catch (e) {\n // add throw to signal the compiler that this will throw in the inner scope\n throw errorHandler(e);\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/index.d.ts b/node_modules/@opentelemetry/api/build/src/index.d.ts deleted file mode 100644 index 93f0644..0000000 --- a/node_modules/@opentelemetry/api/build/src/index.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @module @opentelemetry/api - */ -export type { BaggageEntry, BaggageEntryMetadata, Baggage, } from './baggage/types'; -export { baggageEntryMetadataFromString } from './baggage/utils'; -export type { Exception } from './common/Exception'; -export type { HrTime, TimeInput } from './common/Time'; -export type { Attributes, AttributeValue } from './common/Attributes'; -export { createContextKey, ROOT_CONTEXT } from './context/context'; -export type { Context, ContextManager } from './context/types'; -export type { ContextAPI } from './api/context'; -export { DiagConsoleLogger } from './diag/consoleLogger'; -export { DiagLogLevel } from './diag/types'; -export type { DiagLogFunction, DiagLogger, ComponentLoggerOptions, DiagLoggerOptions, } from './diag/types'; -export type { DiagAPI } from './api/diag'; -export { createNoopMeter } from './metrics/NoopMeter'; -export type { MeterOptions, Meter } from './metrics/Meter'; -export type { MeterProvider } from './metrics/MeterProvider'; -export { ValueType } from './metrics/Metric'; -export type { Counter, Gauge, Histogram, MetricOptions, UpDownCounter, MetricAdvice, MetricAttributes, MetricAttributeValue, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, BatchObservableCallback, ObservableCallback, BatchObservableResult, ObservableResult, } from './metrics/Metric'; -export type { MetricsAPI } from './api/metrics'; -export { defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator'; -export type { TextMapPropagator, TextMapSetter, TextMapGetter, } from './propagation/TextMapPropagator'; -export type { PropagationAPI } from './api/propagation'; -export type { SpanAttributes, SpanAttributeValue } from './trace/attributes'; -export type { Link } from './trace/link'; -export { ProxyTracer, type TracerDelegator } from './trace/ProxyTracer'; -export { ProxyTracerProvider } from './trace/ProxyTracerProvider'; -export type { Sampler } from './trace/Sampler'; -export { SamplingDecision, type SamplingResult } from './trace/SamplingResult'; -export type { SpanContext } from './trace/span_context'; -export { SpanKind } from './trace/span_kind'; -export type { Span } from './trace/span'; -export type { SpanOptions } from './trace/SpanOptions'; -export { type SpanStatus, SpanStatusCode } from './trace/status'; -export { TraceFlags } from './trace/trace_flags'; -export type { TraceState } from './trace/trace_state'; -export { createTraceState } from './trace/internal/utils'; -export type { TracerProvider } from './trace/tracer_provider'; -export type { Tracer } from './trace/tracer'; -export type { TracerOptions } from './trace/tracer_options'; -export { isSpanContextValid, isValidTraceId, isValidSpanId, } from './trace/spancontext-utils'; -export { INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT, } from './trace/invalid-span-constants'; -export type { TraceAPI } from './api/trace'; -import { context } from './context-api'; -import { diag } from './diag-api'; -import { metrics } from './metrics-api'; -import { propagation } from './propagation-api'; -import { trace } from './trace-api'; -export { context, diag, metrics, propagation, trace }; -declare const _default: { - context: import("./api/context").ContextAPI; - diag: import("./api/diag").DiagAPI; - metrics: import("./api/metrics").MetricsAPI; - propagation: import("./api/propagation").PropagationAPI; - trace: import("./api/trace").TraceAPI; -}; -export default _default; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/index.js b/node_modules/@opentelemetry/api/build/src/index.js deleted file mode 100644 index bde4c3f..0000000 --- a/node_modules/@opentelemetry/api/build/src/index.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.trace = exports.propagation = exports.metrics = exports.diag = exports.context = exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = exports.isValidSpanId = exports.isValidTraceId = exports.isSpanContextValid = exports.createTraceState = exports.TraceFlags = exports.SpanStatusCode = exports.SpanKind = exports.SamplingDecision = exports.ProxyTracerProvider = exports.ProxyTracer = exports.defaultTextMapSetter = exports.defaultTextMapGetter = exports.ValueType = exports.createNoopMeter = exports.DiagLogLevel = exports.DiagConsoleLogger = exports.ROOT_CONTEXT = exports.createContextKey = exports.baggageEntryMetadataFromString = void 0; -var utils_1 = require("./baggage/utils"); -Object.defineProperty(exports, "baggageEntryMetadataFromString", { enumerable: true, get: function () { return utils_1.baggageEntryMetadataFromString; } }); -// Context APIs -var context_1 = require("./context/context"); -Object.defineProperty(exports, "createContextKey", { enumerable: true, get: function () { return context_1.createContextKey; } }); -Object.defineProperty(exports, "ROOT_CONTEXT", { enumerable: true, get: function () { return context_1.ROOT_CONTEXT; } }); -// Diag APIs -var consoleLogger_1 = require("./diag/consoleLogger"); -Object.defineProperty(exports, "DiagConsoleLogger", { enumerable: true, get: function () { return consoleLogger_1.DiagConsoleLogger; } }); -var types_1 = require("./diag/types"); -Object.defineProperty(exports, "DiagLogLevel", { enumerable: true, get: function () { return types_1.DiagLogLevel; } }); -// Metrics APIs -var NoopMeter_1 = require("./metrics/NoopMeter"); -Object.defineProperty(exports, "createNoopMeter", { enumerable: true, get: function () { return NoopMeter_1.createNoopMeter; } }); -var Metric_1 = require("./metrics/Metric"); -Object.defineProperty(exports, "ValueType", { enumerable: true, get: function () { return Metric_1.ValueType; } }); -// Propagation APIs -var TextMapPropagator_1 = require("./propagation/TextMapPropagator"); -Object.defineProperty(exports, "defaultTextMapGetter", { enumerable: true, get: function () { return TextMapPropagator_1.defaultTextMapGetter; } }); -Object.defineProperty(exports, "defaultTextMapSetter", { enumerable: true, get: function () { return TextMapPropagator_1.defaultTextMapSetter; } }); -var ProxyTracer_1 = require("./trace/ProxyTracer"); -Object.defineProperty(exports, "ProxyTracer", { enumerable: true, get: function () { return ProxyTracer_1.ProxyTracer; } }); -// TODO: Remove ProxyTracerProvider export in the next major version. -var ProxyTracerProvider_1 = require("./trace/ProxyTracerProvider"); -Object.defineProperty(exports, "ProxyTracerProvider", { enumerable: true, get: function () { return ProxyTracerProvider_1.ProxyTracerProvider; } }); -var SamplingResult_1 = require("./trace/SamplingResult"); -Object.defineProperty(exports, "SamplingDecision", { enumerable: true, get: function () { return SamplingResult_1.SamplingDecision; } }); -var span_kind_1 = require("./trace/span_kind"); -Object.defineProperty(exports, "SpanKind", { enumerable: true, get: function () { return span_kind_1.SpanKind; } }); -var status_1 = require("./trace/status"); -Object.defineProperty(exports, "SpanStatusCode", { enumerable: true, get: function () { return status_1.SpanStatusCode; } }); -var trace_flags_1 = require("./trace/trace_flags"); -Object.defineProperty(exports, "TraceFlags", { enumerable: true, get: function () { return trace_flags_1.TraceFlags; } }); -var utils_2 = require("./trace/internal/utils"); -Object.defineProperty(exports, "createTraceState", { enumerable: true, get: function () { return utils_2.createTraceState; } }); -var spancontext_utils_1 = require("./trace/spancontext-utils"); -Object.defineProperty(exports, "isSpanContextValid", { enumerable: true, get: function () { return spancontext_utils_1.isSpanContextValid; } }); -Object.defineProperty(exports, "isValidTraceId", { enumerable: true, get: function () { return spancontext_utils_1.isValidTraceId; } }); -Object.defineProperty(exports, "isValidSpanId", { enumerable: true, get: function () { return spancontext_utils_1.isValidSpanId; } }); -var invalid_span_constants_1 = require("./trace/invalid-span-constants"); -Object.defineProperty(exports, "INVALID_SPANID", { enumerable: true, get: function () { return invalid_span_constants_1.INVALID_SPANID; } }); -Object.defineProperty(exports, "INVALID_TRACEID", { enumerable: true, get: function () { return invalid_span_constants_1.INVALID_TRACEID; } }); -Object.defineProperty(exports, "INVALID_SPAN_CONTEXT", { enumerable: true, get: function () { return invalid_span_constants_1.INVALID_SPAN_CONTEXT; } }); -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -const context_api_1 = require("./context-api"); -Object.defineProperty(exports, "context", { enumerable: true, get: function () { return context_api_1.context; } }); -const diag_api_1 = require("./diag-api"); -Object.defineProperty(exports, "diag", { enumerable: true, get: function () { return diag_api_1.diag; } }); -const metrics_api_1 = require("./metrics-api"); -Object.defineProperty(exports, "metrics", { enumerable: true, get: function () { return metrics_api_1.metrics; } }); -const propagation_api_1 = require("./propagation-api"); -Object.defineProperty(exports, "propagation", { enumerable: true, get: function () { return propagation_api_1.propagation; } }); -const trace_api_1 = require("./trace-api"); -Object.defineProperty(exports, "trace", { enumerable: true, get: function () { return trace_api_1.trace; } }); -// Default export. -exports.default = { - context: context_api_1.context, - diag: diag_api_1.diag, - metrics: metrics_api_1.metrics, - propagation: propagation_api_1.propagation, - trace: trace_api_1.trace, -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/index.js.map b/node_modules/@opentelemetry/api/build/src/index.js.map deleted file mode 100644 index b995ba0..0000000 --- a/node_modules/@opentelemetry/api/build/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"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AAe;IACb,OAAO,EAAP,qBAAO;IACP,IAAI,EAAJ,eAAI;IACJ,OAAO,EAAP,qBAAO;IACP,WAAW,EAAX,6BAAW;IACX,KAAK,EAAL,iBAAK;CACN,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @module @opentelemetry/api\n */\n\nexport type {\n BaggageEntry,\n BaggageEntryMetadata,\n Baggage,\n} from './baggage/types';\nexport { baggageEntryMetadataFromString } from './baggage/utils';\nexport type { Exception } from './common/Exception';\nexport type { HrTime, TimeInput } from './common/Time';\nexport type { Attributes, AttributeValue } from './common/Attributes';\n\n// Context APIs\nexport { createContextKey, ROOT_CONTEXT } from './context/context';\nexport type { Context, ContextManager } from './context/types';\nexport type { ContextAPI } from './api/context';\n\n// Diag APIs\nexport { DiagConsoleLogger } from './diag/consoleLogger';\nexport { DiagLogLevel } from './diag/types';\nexport type {\n DiagLogFunction,\n DiagLogger,\n ComponentLoggerOptions,\n DiagLoggerOptions,\n} from './diag/types';\nexport type { DiagAPI } from './api/diag';\n\n// Metrics APIs\nexport { createNoopMeter } from './metrics/NoopMeter';\nexport type { MeterOptions, Meter } from './metrics/Meter';\nexport type { MeterProvider } from './metrics/MeterProvider';\nexport { ValueType } from './metrics/Metric';\nexport type {\n Counter,\n Gauge,\n Histogram,\n MetricOptions,\n UpDownCounter,\n MetricAdvice,\n MetricAttributes,\n MetricAttributeValue,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n BatchObservableCallback,\n ObservableCallback,\n BatchObservableResult,\n ObservableResult,\n} from './metrics/Metric';\nexport type { MetricsAPI } from './api/metrics';\n\n// Propagation APIs\nexport {\n defaultTextMapGetter,\n defaultTextMapSetter,\n} from './propagation/TextMapPropagator';\nexport type {\n TextMapPropagator,\n TextMapSetter,\n TextMapGetter,\n} from './propagation/TextMapPropagator';\nexport type { PropagationAPI } from './api/propagation';\n\n// Trace APIs\nexport type { SpanAttributes, SpanAttributeValue } from './trace/attributes';\nexport type { Link } from './trace/link';\nexport { ProxyTracer, type TracerDelegator } from './trace/ProxyTracer';\n// TODO: Remove ProxyTracerProvider export in the next major version.\nexport { ProxyTracerProvider } from './trace/ProxyTracerProvider';\nexport type { Sampler } from './trace/Sampler';\nexport { SamplingDecision, type SamplingResult } from './trace/SamplingResult';\nexport type { SpanContext } from './trace/span_context';\nexport { SpanKind } from './trace/span_kind';\nexport type { Span } from './trace/span';\nexport type { SpanOptions } from './trace/SpanOptions';\nexport { type SpanStatus, SpanStatusCode } from './trace/status';\nexport { TraceFlags } from './trace/trace_flags';\nexport type { TraceState } from './trace/trace_state';\nexport { createTraceState } from './trace/internal/utils';\nexport type { TracerProvider } from './trace/tracer_provider';\nexport type { Tracer } from './trace/tracer';\nexport type { TracerOptions } from './trace/tracer_options';\nexport {\n isSpanContextValid,\n isValidTraceId,\n isValidSpanId,\n} from './trace/spancontext-utils';\nexport {\n INVALID_SPANID,\n INVALID_TRACEID,\n INVALID_SPAN_CONTEXT,\n} from './trace/invalid-span-constants';\nexport type { TraceAPI } from './api/trace';\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { context } from './context-api';\nimport { diag } from './diag-api';\nimport { metrics } from './metrics-api';\nimport { propagation } from './propagation-api';\nimport { trace } from './trace-api';\n\n// Named export.\nexport { context, diag, metrics, propagation, trace };\n// Default export.\nexport default {\n context,\n diag,\n metrics,\n propagation,\n trace,\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/internal/global-utils.d.ts b/node_modules/@opentelemetry/api/build/src/internal/global-utils.d.ts deleted file mode 100644 index e03d908..0000000 --- a/node_modules/@opentelemetry/api/build/src/internal/global-utils.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { MeterProvider } from '../metrics/MeterProvider'; -import type { ContextManager } from '../context/types'; -import type { DiagLogger } from '../diag/types'; -import type { TextMapPropagator } from '../propagation/TextMapPropagator'; -import type { TracerProvider } from '../trace/tracer_provider'; -export declare function registerGlobal(type: Type, instance: OTelGlobalAPI[Type], diag: DiagLogger, allowOverride?: boolean): boolean; -export declare function getGlobal(type: Type): OTelGlobalAPI[Type] | undefined; -export declare function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger): void; -type OTelGlobalAPI = { - version: string; - diag?: DiagLogger; - trace?: TracerProvider; - context?: ContextManager; - metrics?: MeterProvider; - propagation?: TextMapPropagator; -}; -export {}; -//# sourceMappingURL=global-utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/internal/global-utils.js b/node_modules/@opentelemetry/api/build/src/internal/global-utils.js deleted file mode 100644 index 83a3f21..0000000 --- a/node_modules/@opentelemetry/api/build/src/internal/global-utils.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.unregisterGlobal = exports.getGlobal = exports.registerGlobal = void 0; -const version_1 = require("../version"); -const semver_1 = require("./semver"); -const major = version_1.VERSION.split('.')[0]; -const GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`); -const _global = (typeof globalThis === 'object' - ? globalThis - : typeof self === 'object' - ? self - : typeof window === 'object' - ? window - : typeof global === 'object' - ? global - : {}); -function registerGlobal(type, instance, diag, allowOverride = false) { - var _a; - const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { - version: version_1.VERSION, - }); - if (!allowOverride && api[type]) { - // already registered an API of this type - const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`); - diag.error(err.stack || err.message); - return false; - } - if (api.version !== version_1.VERSION) { - // All registered APIs must be of the same version exactly - const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${version_1.VERSION}`); - diag.error(err.stack || err.message); - return false; - } - api[type] = instance; - diag.debug(`@opentelemetry/api: Registered a global for ${type} v${version_1.VERSION}.`); - return true; -} -exports.registerGlobal = registerGlobal; -function getGlobal(type) { - var _a, _b; - const globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version; - if (!globalVersion || !(0, semver_1.isCompatible)(globalVersion)) { - return; - } - return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type]; -} -exports.getGlobal = getGlobal; -function unregisterGlobal(type, diag) { - diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${version_1.VERSION}.`); - const api = _global[GLOBAL_OPENTELEMETRY_API_KEY]; - if (api) { - delete api[type]; - } -} -exports.unregisterGlobal = unregisterGlobal; -//# sourceMappingURL=global-utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/internal/global-utils.js.map b/node_modules/@opentelemetry/api/build/src/internal/global-utils.js.map deleted file mode 100644 index 1ba9b33..0000000 --- a/node_modules/@opentelemetry/api/build/src/internal/global-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,wCAAqC;AACrC,qCAAwC;AAExC,MAAM,KAAK,GAAG,iBAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAC7C,wBAAwB,KAAK,EAAE,CAChC,CAAC;AAMF,MAAM,OAAO,GAAG,CACd,OAAO,UAAU,KAAK,QAAQ;IAC5B,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;QACxB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,MAAM,K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ACD,OAAO,MAAA,OAAO,CAAC,4BAA4B,CAAC,0CAAG,IAAI,CAAC,CAAC;AACvD,CAAC;AARD,8BAQC;AAED,SAAgB,gBAAgB,CAAC,IAAyB,EAAE,IAAgB;IAC1E,IAAI,CAAC,KAAK,CACR,kDAAkD,IAAI,KAAK,iBAAO,GAAG,CACtE,CAAC;IACF,MAAM,GAAG,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAElD,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;KAClB;AACH,CAAC;AATD,4CASC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { MeterProvider } from '../metrics/MeterProvider';\nimport type { ContextManager } from '../context/types';\nimport type { DiagLogger } from '../diag/types';\nimport type { TextMapPropagator } from '../propagation/TextMapPropagator';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport { VERSION } from '../version';\nimport { isCompatible } from './semver';\n\nconst major = VERSION.split('.')[0];\nconst GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(\n `opentelemetry.js.api.${major}`\n);\n\ndeclare const self: unknown;\ndeclare const window: unknown;\ndeclare const global: unknown;\n\nconst _global = (\n typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : {}\n) as OTelGlobal;\n\nexport function registerGlobal(\n type: Type,\n instance: OTelGlobalAPI[Type],\n diag: DiagLogger,\n allowOverride = false\n): boolean {\n const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = _global[\n GLOBAL_OPENTELEMETRY_API_KEY\n ] ?? {\n version: VERSION,\n });\n\n if (!allowOverride && api[type]) {\n // already registered an API of this type\n const err = new Error(\n `@opentelemetry/api: Attempted duplicate registration of API: ${type}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n if (api.version !== VERSION) {\n // All registered APIs must be of the same version exactly\n const err = new Error(\n `@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n api[type] = instance;\n diag.debug(\n `@opentelemetry/api: Registered a global for ${type} v${VERSION}.`\n );\n\n return true;\n}\n\nexport function getGlobal(\n type: Type\n): OTelGlobalAPI[Type] | undefined {\n const globalVersion = _global[GLOBAL_OPENTELEMETRY_API_KEY]?.version;\n if (!globalVersion || !isCompatible(globalVersion)) {\n return;\n }\n return _global[GLOBAL_OPENTELEMETRY_API_KEY]?.[type];\n}\n\nexport function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger) {\n diag.debug(\n `@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`\n );\n const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n\n if (api) {\n delete api[type];\n }\n}\n\ntype OTelGlobal = {\n [GLOBAL_OPENTELEMETRY_API_KEY]?: OTelGlobalAPI;\n};\n\ntype OTelGlobalAPI = {\n version: string;\n\n diag?: DiagLogger;\n trace?: TracerProvider;\n context?: ContextManager;\n metrics?: MeterProvider;\n propagation?: TextMapPropagator;\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/internal/semver.d.ts b/node_modules/@opentelemetry/api/build/src/internal/semver.d.ts deleted file mode 100644 index d9f4259..0000000 --- a/node_modules/@opentelemetry/api/build/src/internal/semver.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Create a function to test an API version to see if it is compatible with the provided ownVersion. - * - * The returned function has the following semantics: - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param ownVersion version which should be checked against - */ -export declare function _makeCompatibilityCheck(ownVersion: string): (globalVersion: string) => boolean; -/** - * Test an API version to see if it is compatible with this API. - * - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param version version of the API requesting an instance of the global API - */ -export declare const isCompatible: (globalVersion: string) => boolean; -//# sourceMappingURL=semver.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/internal/semver.js b/node_modules/@opentelemetry/api/build/src/internal/semver.js deleted file mode 100644 index b78026d..0000000 --- a/node_modules/@opentelemetry/api/build/src/internal/semver.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isCompatible = exports._makeCompatibilityCheck = void 0; -const version_1 = require("../version"); -const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/; -/** - * Create a function to test an API version to see if it is compatible with the provided ownVersion. - * - * The returned function has the following semantics: - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param ownVersion version which should be checked against - */ -function _makeCompatibilityCheck(ownVersion) { - const acceptedVersions = new Set([ownVersion]); - const rejectedVersions = new Set(); - const myVersionMatch = ownVersion.match(re); - if (!myVersionMatch) { - // we cannot guarantee compatibility so we always return noop - return () => false; - } - const ownVersionParsed = { - major: +myVersionMatch[1], - minor: +myVersionMatch[2], - patch: +myVersionMatch[3], - prerelease: myVersionMatch[4], - }; - // if ownVersion has a prerelease tag, versions must match exactly - if (ownVersionParsed.prerelease != null) { - return function isExactmatch(globalVersion) { - return globalVersion === ownVersion; - }; - } - function _reject(v) { - rejectedVersions.add(v); - return false; - } - function _accept(v) { - acceptedVersions.add(v); - return true; - } - return function isCompatible(globalVersion) { - if (acceptedVersions.has(globalVersion)) { - return true; - } - if (rejectedVersions.has(globalVersion)) { - return false; - } - const globalVersionMatch = globalVersion.match(re); - if (!globalVersionMatch) { - // cannot parse other version - // we cannot guarantee compatibility so we always noop - return _reject(globalVersion); - } - const globalVersionParsed = { - major: +globalVersionMatch[1], - minor: +globalVersionMatch[2], - patch: +globalVersionMatch[3], - prerelease: globalVersionMatch[4], - }; - // if globalVersion has a prerelease tag, versions must match exactly - if (globalVersionParsed.prerelease != null) { - return _reject(globalVersion); - } - // major versions must match - if (ownVersionParsed.major !== globalVersionParsed.major) { - return _reject(globalVersion); - } - if (ownVersionParsed.major === 0) { - if (ownVersionParsed.minor === globalVersionParsed.minor && - ownVersionParsed.patch <= globalVersionParsed.patch) { - return _accept(globalVersion); - } - return _reject(globalVersion); - } - if (ownVersionParsed.minor <= globalVersionParsed.minor) { - return _accept(globalVersion); - } - return _reject(globalVersion); - }; -} -exports._makeCompatibilityCheck = _makeCompatibilityCheck; -/** - * Test an API version to see if it is compatible with this API. - * - * - Exact match is always compatible - * - Major versions must match exactly - * - 1.x package cannot use global 2.x package - * - 2.x package cannot use global 1.x package - * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API - * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects - * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3 - * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor - * - Patch and build tag differences are not considered at this time - * - * @param version version of the API requesting an instance of the global API - */ -exports.isCompatible = _makeCompatibilityCheck(version_1.VERSION); -//# sourceMappingURL=semver.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/internal/semver.js.map b/node_modules/@opentelemetry/api/build/src/internal/semver.js.map deleted file mode 100644 index 82cab18..0000000 --- a/node_modules/@opentelemetry/api/build/src/internal/semver.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../src/internal/semver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,wCAAqC;AAErC,MAAM,EAAE,GAAG,+BAA+B,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,uBAAuB,CACrC,UAAkB;IAElB,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5C,IAAI,CAAC,cAAc,EAAE;QACnB,6DAA6D;QAC7D,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC;KACpB;IAED,MAAM,gBAAgB,GAAG;QACvB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;KAC9B,CAAC;IAEF,kEAAkE;IAClE,IAAI,gBAAgB,CAAC,UAAU,IAAI,IAAI,EAAE;QACvC,OAAO,SAAS,YAAY,CAAC,aAAqB;YAChD,OAAO,aAAa,KAAK,UAAU,CAAC;QACtC,CAAC,CAAC;KACH;IAED,SAAS,OAAO,CAAC,CAAS;QACxB,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IA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AAC;SAC/B;QAED,IAAI,gBAAgB,CAAC,KAAK,IAAI,mBAAmB,CAAC,KAAK,EAAE;YACvD,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;SAC/B;QAED,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAtFD,0DAsFC;AAED;;;;;;;;;;;;;;GAcG;AACU,QAAA,YAAY,GAAG,uBAAuB,CAAC,iBAAO,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { VERSION } from '../version';\n\nconst re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n\n/**\n * Create a function to test an API version to see if it is compatible with the provided ownVersion.\n *\n * The returned function has the following semantics:\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param ownVersion version which should be checked against\n */\nexport function _makeCompatibilityCheck(\n ownVersion: string\n): (globalVersion: string) => boolean {\n const acceptedVersions = new Set([ownVersion]);\n const rejectedVersions = new Set();\n\n const myVersionMatch = ownVersion.match(re);\n if (!myVersionMatch) {\n // we cannot guarantee compatibility so we always return noop\n return () => false;\n }\n\n const ownVersionParsed = {\n major: +myVersionMatch[1],\n minor: +myVersionMatch[2],\n patch: +myVersionMatch[3],\n prerelease: myVersionMatch[4],\n };\n\n // if ownVersion has a prerelease tag, versions must match exactly\n if (ownVersionParsed.prerelease != null) {\n return function isExactmatch(globalVersion: string): boolean {\n return globalVersion === ownVersion;\n };\n }\n\n function _reject(v: string) {\n rejectedVersions.add(v);\n return false;\n }\n\n function _accept(v: string) {\n acceptedVersions.add(v);\n return true;\n }\n\n return function isCompatible(globalVersion: string): boolean {\n if (acceptedVersions.has(globalVersion)) {\n return true;\n }\n\n if (rejectedVersions.has(globalVersion)) {\n return false;\n }\n\n const globalVersionMatch = globalVersion.match(re);\n if (!globalVersionMatch) {\n // cannot parse other version\n // we cannot guarantee compatibility so we always noop\n return _reject(globalVersion);\n }\n\n const globalVersionParsed = {\n major: +globalVersionMatch[1],\n minor: +globalVersionMatch[2],\n patch: +globalVersionMatch[3],\n prerelease: globalVersionMatch[4],\n };\n\n // if globalVersion has a prerelease tag, versions must match exactly\n if (globalVersionParsed.prerelease != null) {\n return _reject(globalVersion);\n }\n\n // major versions must match\n if (ownVersionParsed.major !== globalVersionParsed.major) {\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.major === 0) {\n if (\n ownVersionParsed.minor === globalVersionParsed.minor &&\n ownVersionParsed.patch <= globalVersionParsed.patch\n ) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.minor <= globalVersionParsed.minor) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n };\n}\n\n/**\n * Test an API version to see if it is compatible with this API.\n *\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param version version of the API requesting an instance of the global API\n */\nexport const isCompatible = _makeCompatibilityCheck(VERSION);\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics-api.d.ts b/node_modules/@opentelemetry/api/build/src/metrics-api.d.ts deleted file mode 100644 index a5f33ae..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics-api.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { MetricsAPI } from './api/metrics'; -/** - * Entrypoint for metrics API - * - * @since 1.3.0 - */ -export declare const metrics: MetricsAPI; -//# sourceMappingURL=metrics-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics-api.js b/node_modules/@opentelemetry/api/build/src/metrics-api.js deleted file mode 100644 index 288e004..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics-api.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.metrics = void 0; -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -const metrics_1 = require("./api/metrics"); -/** - * Entrypoint for metrics API - * - * @since 1.3.0 - */ -exports.metrics = metrics_1.MetricsAPI.getInstance(); -//# sourceMappingURL=metrics-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics-api.js.map b/node_modules/@opentelemetry/api/build/src/metrics-api.js.map deleted file mode 100644 index 817f6e7..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metrics-api.js","sourceRoot":"","sources":["../../src/metrics-api.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,2CAA2C;AAC3C;;;;GAIG;AACU,QAAA,OAAO,GAAG,oBAAU,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { MetricsAPI } from './api/metrics';\n/**\n * Entrypoint for metrics API\n *\n * @since 1.3.0\n */\nexport const metrics = MetricsAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/Meter.d.ts b/node_modules/@opentelemetry/api/build/src/metrics/Meter.d.ts deleted file mode 100644 index e1236d7..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/Meter.d.ts +++ /dev/null @@ -1,114 +0,0 @@ -import type { BatchObservableCallback, Counter, Gauge, Histogram, MetricAttributes, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric'; -/** - * An interface describes additional metadata of a meter. - * - * @since 1.3.0 - */ -export interface MeterOptions { - /** - * The schemaUrl of the meter or instrumentation library - */ - schemaUrl?: string; -} -/** - * An interface to allow the recording metrics. - * - * {@link Metric}s are used for recording pre-defined aggregation (`Counter`), - * or raw values (`Histogram`) in which the aggregation and attributes - * for the exported metric are deferred. - * - * @since 1.3.0 - */ -export interface Meter { - /** - * Creates and returns a new `Gauge`. - * @param name the name of the metric. - * @param [options] the metric options. - */ - createGauge(name: string, options?: MetricOptions): Gauge; - /** - * Creates and returns a new `Histogram`. - * @param name the name of the metric. - * @param [options] the metric options. - */ - createHistogram(name: string, options?: MetricOptions): Histogram; - /** - * Creates a new `Counter` metric. Generally, this kind of metric when the - * value is a quantity, the sum is of primary interest, and the event count - * and value distribution are not of primary interest. - * @param name the name of the metric. - * @param [options] the metric options. - */ - createCounter(name: string, options?: MetricOptions): Counter; - /** - * Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous - * instrument and very similar to Counter except that Add(increment) - * supports negative increments. It is generally useful for capturing changes - * in an amount of resources used, or any quantity that rises and falls - * during a request. - * Example uses for UpDownCounter: - *
                    - *
                  1. count the number of active requests.
                  2. - *
                  3. count memory in use by instrumenting new and delete.
                  4. - *
                  5. count queue size by instrumenting enqueue and dequeue.
                  6. - *
                  7. count semaphore up and down operations.
                  8. - *
                  - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createUpDownCounter(name: string, options?: MetricOptions): UpDownCounter; - /** - * Creates a new `ObservableGauge` metric. - * - * The callback SHOULD be safe to be invoked concurrently. - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createObservableGauge(name: string, options?: MetricOptions): ObservableGauge; - /** - * Creates a new `ObservableCounter` metric. - * - * The callback SHOULD be safe to be invoked concurrently. - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createObservableCounter(name: string, options?: MetricOptions): ObservableCounter; - /** - * Creates a new `ObservableUpDownCounter` metric. - * - * The callback SHOULD be safe to be invoked concurrently. - * - * @param name the name of the metric. - * @param [options] the metric options. - */ - createObservableUpDownCounter(name: string, options?: MetricOptions): ObservableUpDownCounter; - /** - * Sets up a function that will be called whenever a metric collection is - * initiated. - * - * If the function is already in the list of callbacks for this Observable, - * the function is not added a second time. - * - * Only the associated observables can be observed in the callback. - * Measurements of observables that are not associated observed in the - * callback are dropped. - * - * @param callback the batch observable callback - * @param observables the observables associated with this batch observable callback - */ - addBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void; - /** - * Removes a callback previously registered with {@link Meter.addBatchObservableCallback}. - * - * The callback to be removed is identified using a combination of the callback itself, - * and the set of the observables associated with it. - * - * @param callback the batch observable callback - * @param observables the observables associated with this batch observable callback - */ - removeBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void; -} -//# sourceMappingURL=Meter.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/Meter.js b/node_modules/@opentelemetry/api/build/src/metrics/Meter.js deleted file mode 100644 index 38b0ee7..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/Meter.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Meter.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/Meter.js.map b/node_modules/@opentelemetry/api/build/src/metrics/Meter.js.map deleted file mode 100644 index 6081e0c..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/Meter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Meter.js","sourceRoot":"","sources":["../../../src/metrics/Meter.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n BatchObservableCallback,\n Counter,\n Gauge,\n Histogram,\n MetricAttributes,\n MetricOptions,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n} from './Metric';\n\n/**\n * An interface describes additional metadata of a meter.\n *\n * @since 1.3.0\n */\nexport interface MeterOptions {\n /**\n * The schemaUrl of the meter or instrumentation library\n */\n schemaUrl?: string;\n}\n\n/**\n * An interface to allow the recording metrics.\n *\n * {@link Metric}s are used for recording pre-defined aggregation (`Counter`),\n * or raw values (`Histogram`) in which the aggregation and attributes\n * for the exported metric are deferred.\n *\n * @since 1.3.0\n */\nexport interface Meter {\n /**\n * Creates and returns a new `Gauge`.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createGauge(\n name: string,\n options?: MetricOptions\n ): Gauge;\n\n /**\n * Creates and returns a new `Histogram`.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createHistogram(\n name: string,\n options?: MetricOptions\n ): Histogram;\n\n /**\n * Creates a new `Counter` metric. Generally, this kind of metric when the\n * value is a quantity, the sum is of primary interest, and the event count\n * and value distribution are not of primary interest.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createCounter(\n name: string,\n options?: MetricOptions\n ): Counter;\n\n /**\n * Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous\n * instrument and very similar to Counter except that Add(increment)\n * supports negative increments. It is generally useful for capturing changes\n * in an amount of resources used, or any quantity that rises and falls\n * during a request.\n * Example uses for UpDownCounter:\n *
                    \n *
                  1. count the number of active requests.
                  2. \n *
                  3. count memory in use by instrumenting new and delete.
                  4. \n *
                  5. count queue size by instrumenting enqueue and dequeue.
                  6. \n *
                  7. count semaphore up and down operations.
                  8. \n *
                  \n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): UpDownCounter;\n\n /**\n * Creates a new `ObservableGauge` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableGauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): ObservableGauge;\n\n /**\n * Creates a new `ObservableCounter` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): ObservableCounter;\n\n /**\n * Creates a new `ObservableUpDownCounter` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n name: string,\n options?: MetricOptions\n ): ObservableUpDownCounter;\n\n /**\n * Sets up a function that will be called whenever a metric collection is\n * initiated.\n *\n * If the function is already in the list of callbacks for this Observable,\n * the function is not added a second time.\n *\n * Only the associated observables can be observed in the callback.\n * Measurements of observables that are not associated observed in the\n * callback are dropped.\n *\n * @param callback the batch observable callback\n * @param observables the observables associated with this batch observable callback\n */\n addBatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n callback: BatchObservableCallback,\n observables: Observable[]\n ): void;\n\n /**\n * Removes a callback previously registered with {@link Meter.addBatchObservableCallback}.\n *\n * The callback to be removed is identified using a combination of the callback itself,\n * and the set of the observables associated with it.\n *\n * @param callback the batch observable callback\n * @param observables the observables associated with this batch observable callback\n */\n removeBatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n >(\n callback: BatchObservableCallback,\n observables: Observable[]\n ): void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.d.ts b/node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.d.ts deleted file mode 100644 index 83378c5..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { Meter, MeterOptions } from './Meter'; -/** - * A registry for creating named {@link Meter}s. - * - * @since 1.3.0 - */ -export interface MeterProvider { - /** - * Returns a Meter, creating one if one with the given name, version, and - * schemaUrl pair is not already created. - * - * @param name The name of the meter or instrumentation library. - * @param version The version of the meter or instrumentation library. - * @param options The options of the meter or instrumentation library. - * @returns Meter A Meter with the given name and version - */ - getMeter(name: string, version?: string, options?: MeterOptions): Meter; -} -//# sourceMappingURL=MeterProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.js b/node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.js deleted file mode 100644 index b5f5401..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=MeterProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.js.map b/node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.js.map deleted file mode 100644 index 90b9e95..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/MeterProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MeterProvider.js","sourceRoot":"","sources":["../../../src/metrics/MeterProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter, MeterOptions } from './Meter';\n\n/**\n * A registry for creating named {@link Meter}s.\n *\n * @since 1.3.0\n */\nexport interface MeterProvider {\n /**\n * Returns a Meter, creating one if one with the given name, version, and\n * schemaUrl pair is not already created.\n *\n * @param name The name of the meter or instrumentation library.\n * @param version The version of the meter or instrumentation library.\n * @param options The options of the meter or instrumentation library.\n * @returns Meter A Meter with the given name and version\n */\n getMeter(name: string, version?: string, options?: MeterOptions): Meter;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/Metric.d.ts b/node_modules/@opentelemetry/api/build/src/metrics/Metric.d.ts deleted file mode 100644 index c298737..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/Metric.d.ts +++ /dev/null @@ -1,183 +0,0 @@ -import type { Attributes, AttributeValue } from '../common/Attributes'; -import type { Context } from '../context/types'; -/** - * Advisory options influencing aggregation configuration parameters. - * - * @since 1.7.0 - * @experimental - */ -export interface MetricAdvice { - /** - * Hint the explicit bucket boundaries for SDK if the metric is been - * aggregated with a HistogramAggregator. - */ - explicitBucketBoundaries?: number[]; -} -/** - * Options needed for metric creation - * - * @since 1.3.0 - */ -export interface MetricOptions { - /** - * The description of the Metric. - * @default '' - */ - description?: string; - /** - * The unit of the Metric values. - * @default '' - */ - unit?: string; - /** - * Indicates the type of the recorded value. - * @default {@link ValueType.DOUBLE} - */ - valueType?: ValueType; - /** - * The advice influencing aggregation configuration parameters. - * @experimental - * @since 1.7.0 - */ - advice?: MetricAdvice; -} -/** - * The Type of value. It describes how the data is reported. - * - * @since 1.3.0 - */ -export declare enum ValueType { - INT = 0, - DOUBLE = 1 -} -/** - * Counter is the most common synchronous instrument. This instrument supports - * an `Add(increment)` function for reporting a sum, and is restricted to - * non-negative increments. The default aggregation is Sum, as for any additive - * instrument. - * - * Example uses for Counter: - *
                    - *
                  1. count the number of bytes received.
                  2. - *
                  3. count the number of requests completed.
                  4. - *
                  5. count the number of accounts created.
                  6. - *
                  7. count the number of checkpoints run.
                  8. - *
                  9. count the number of 5xx errors.
                  10. - *
                      - * - * @since 1.3.0 - */ -export interface Counter { - /** - * Increment value of counter by the input. Inputs must not be negative. - */ - add(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @since 1.3.0 - */ -export interface UpDownCounter { - /** - * Increment value of counter by the input. Inputs may be negative. - */ - add(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @since 1.9.0 - */ -export interface Gauge { - /** - * Records a measurement. - */ - record(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @since 1.3.0 - */ -export interface Histogram { - /** - * Records a measurement. Value of the measurement must not be negative. - */ - record(value: number, attributes?: AttributesTypes, context?: Context): void; -} -/** - * @deprecated please use {@link Attributes} - * @since 1.3.0 - */ -export type MetricAttributes = Attributes; -/** - * @deprecated please use {@link AttributeValue} - * @since 1.3.0 - */ -export type MetricAttributeValue = AttributeValue; -/** - * Interface that is being used in callback function for Observable Metric. - * - * @since 1.3.0 - */ -export interface ObservableResult { - /** - * Observe a measurement of the value associated with the given attributes. - * - * @param value The value to be observed. - * @param attributes The attributes associated with the value. If more than - * one value is associated with the same attributes values, SDK may pick the - * last one or simply drop the entire observable result. - */ - observe(this: ObservableResult, value: number, attributes?: AttributesTypes): void; -} -/** - * Interface that is being used in batch observable callback function. - */ -export interface BatchObservableResult { - /** - * Observe a measurement of the value associated with the given attributes. - * - * @param metric The observable metric to be observed. - * @param value The value to be observed. - * @param attributes The attributes associated with the value. If more than - * one value is associated with the same attributes values, SDK may pick the - * last one or simply drop the entire observable result. - */ - observe(this: BatchObservableResult, metric: Observable, value: number, attributes?: AttributesTypes): void; -} -/** - * The observable callback for Observable instruments. - * - * @since 1.3.0 - */ -export type ObservableCallback = (observableResult: ObservableResult) => void | Promise; -/** - * The observable callback for a batch of Observable instruments. - * - * @since 1.3.0 - */ -export type BatchObservableCallback = (observableResult: BatchObservableResult) => void | Promise; -/** - * @since 1.3.0 - */ -export interface Observable { - /** - * Sets up a function that will be called whenever a metric collection is initiated. - * - * If the function is already in the list of callbacks for this Observable, the function is not added a second time. - */ - addCallback(callback: ObservableCallback): void; - /** - * Removes a callback previously registered with {@link Observable.addCallback}. - */ - removeCallback(callback: ObservableCallback): void; -} -/** - * @since 1.3.0 - */ -export type ObservableCounter = Observable; -/** - * @since 1.3.0 - */ -export type ObservableUpDownCounter = Observable; -/** - * @since 1.3.0 - */ -export type ObservableGauge = Observable; -//# sourceMappingURL=Metric.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/Metric.js b/node_modules/@opentelemetry/api/build/src/metrics/Metric.js deleted file mode 100644 index b95ee1c..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/Metric.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueType = void 0; -/** - * The Type of value. It describes how the data is reported. - * - * @since 1.3.0 - */ -var ValueType; -(function (ValueType) { - ValueType[ValueType["INT"] = 0] = "INT"; - ValueType[ValueType["DOUBLE"] = 1] = "DOUBLE"; -})(ValueType = exports.ValueType || (exports.ValueType = {})); -//# sourceMappingURL=Metric.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/Metric.js.map b/node_modules/@opentelemetry/api/build/src/metrics/Metric.js.map deleted file mode 100644 index 2456ec0..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/Metric.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../../src/metrics/Metric.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAmDH;;;;GAIG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;AACR,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes, AttributeValue } from '../common/Attributes';\nimport type { Context } from '../context/types';\n\n/**\n * Advisory options influencing aggregation configuration parameters.\n *\n * @since 1.7.0\n * @experimental\n */\nexport interface MetricAdvice {\n /**\n * Hint the explicit bucket boundaries for SDK if the metric is been\n * aggregated with a HistogramAggregator.\n */\n explicitBucketBoundaries?: number[];\n}\n\n/**\n * Options needed for metric creation\n *\n * @since 1.3.0\n */\nexport interface MetricOptions {\n /**\n * The description of the Metric.\n * @default ''\n */\n description?: string;\n\n /**\n * The unit of the Metric values.\n * @default ''\n */\n unit?: string;\n\n /**\n * Indicates the type of the recorded value.\n * @default {@link ValueType.DOUBLE}\n */\n valueType?: ValueType;\n\n /**\n * The advice influencing aggregation configuration parameters.\n * @experimental\n * @since 1.7.0\n */\n advice?: MetricAdvice;\n}\n\n/**\n * The Type of value. It describes how the data is reported.\n *\n * @since 1.3.0\n */\nexport enum ValueType {\n INT,\n DOUBLE,\n}\n\n/**\n * Counter is the most common synchronous instrument. This instrument supports\n * an `Add(increment)` function for reporting a sum, and is restricted to\n * non-negative increments. The default aggregation is Sum, as for any additive\n * instrument.\n *\n * Example uses for Counter:\n *
                        \n *
                      1. count the number of bytes received.
                      2. \n *
                      3. count the number of requests completed.
                      4. \n *
                      5. count the number of accounts created.
                      6. \n *
                      7. count the number of checkpoints run.
                      8. \n *
                      9. count the number of 5xx errors.
                      10. \n *
                          \n *\n * @since 1.3.0\n */\nexport interface Counter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Increment value of counter by the input. Inputs must not be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport interface UpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Increment value of counter by the input. Inputs may be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.9.0\n */\nexport interface Gauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Records a measurement.\n */\n record(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport interface Histogram<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Records a measurement. Value of the measurement must not be negative.\n */\n record(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @deprecated please use {@link Attributes}\n * @since 1.3.0\n */\nexport type MetricAttributes = Attributes;\n\n/**\n * @deprecated please use {@link AttributeValue}\n * @since 1.3.0\n */\nexport type MetricAttributeValue = AttributeValue;\n\n/**\n * Interface that is being used in callback function for Observable Metric.\n *\n * @since 1.3.0\n */\nexport interface ObservableResult<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Observe a measurement of the value associated with the given attributes.\n *\n * @param value The value to be observed.\n * @param attributes The attributes associated with the value. If more than\n * one value is associated with the same attributes values, SDK may pick the\n * last one or simply drop the entire observable result.\n */\n observe(\n this: ObservableResult,\n value: number,\n attributes?: AttributesTypes\n ): void;\n}\n\n/**\n * Interface that is being used in batch observable callback function.\n */\nexport interface BatchObservableResult<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Observe a measurement of the value associated with the given attributes.\n *\n * @param metric The observable metric to be observed.\n * @param value The value to be observed.\n * @param attributes The attributes associated with the value. If more than\n * one value is associated with the same attributes values, SDK may pick the\n * last one or simply drop the entire observable result.\n */\n observe(\n this: BatchObservableResult,\n metric: Observable,\n value: number,\n attributes?: AttributesTypes\n ): void;\n}\n\n/**\n * The observable callback for Observable instruments.\n *\n * @since 1.3.0\n */\nexport type ObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = (\n observableResult: ObservableResult\n) => void | Promise;\n\n/**\n * The observable callback for a batch of Observable instruments.\n *\n * @since 1.3.0\n */\nexport type BatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = (\n observableResult: BatchObservableResult\n) => void | Promise;\n\n/**\n * @since 1.3.0\n */\nexport interface Observable<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Sets up a function that will be called whenever a metric collection is initiated.\n *\n * If the function is already in the list of callbacks for this Observable, the function is not added a second time.\n */\n addCallback(callback: ObservableCallback): void;\n\n /**\n * Removes a callback previously registered with {@link Observable.addCallback}.\n */\n removeCallback(callback: ObservableCallback): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport type ObservableCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable;\n/**\n * @since 1.3.0\n */\nexport type ObservableUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable;\n/**\n * @since 1.3.0\n */\nexport type ObservableGauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.d.ts b/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.d.ts deleted file mode 100644 index 408aa24..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -import type { Meter } from './Meter'; -import type { BatchObservableCallback, Counter, Gauge, Histogram, MetricAttributes, MetricOptions, Observable, ObservableCallback, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric'; -/** - * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses - * constant NoopMetrics for all of its methods. - */ -export declare class NoopMeter implements Meter { - constructor(); - /** - * @see {@link Meter.createGauge} - */ - createGauge(_name: string, _options?: MetricOptions): Gauge; - /** - * @see {@link Meter.createHistogram} - */ - createHistogram(_name: string, _options?: MetricOptions): Histogram; - /** - * @see {@link Meter.createCounter} - */ - createCounter(_name: string, _options?: MetricOptions): Counter; - /** - * @see {@link Meter.createUpDownCounter} - */ - createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter; - /** - * @see {@link Meter.createObservableGauge} - */ - createObservableGauge(_name: string, _options?: MetricOptions): ObservableGauge; - /** - * @see {@link Meter.createObservableCounter} - */ - createObservableCounter(_name: string, _options?: MetricOptions): ObservableCounter; - /** - * @see {@link Meter.createObservableUpDownCounter} - */ - createObservableUpDownCounter(_name: string, _options?: MetricOptions): ObservableUpDownCounter; - /** - * @see {@link Meter.addBatchObservableCallback} - */ - addBatchObservableCallback(_callback: BatchObservableCallback, _observables: Observable[]): void; - /** - * @see {@link Meter.removeBatchObservableCallback} - */ - removeBatchObservableCallback(_callback: BatchObservableCallback): void; -} -export declare class NoopMetric { -} -export declare class NoopCounterMetric extends NoopMetric implements Counter { - add(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopUpDownCounterMetric extends NoopMetric implements UpDownCounter { - add(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopGaugeMetric extends NoopMetric implements Gauge { - record(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopHistogramMetric extends NoopMetric implements Histogram { - record(_value: number, _attributes: MetricAttributes): void; -} -export declare class NoopObservableMetric { - addCallback(_callback: ObservableCallback): void; - removeCallback(_callback: ObservableCallback): void; -} -export declare class NoopObservableCounterMetric extends NoopObservableMetric implements ObservableCounter { -} -export declare class NoopObservableGaugeMetric extends NoopObservableMetric implements ObservableGauge { -} -export declare class NoopObservableUpDownCounterMetric extends NoopObservableMetric implements ObservableUpDownCounter { -} -export declare const NOOP_METER: NoopMeter; -export declare const NOOP_COUNTER_METRIC: NoopCounterMetric; -export declare const NOOP_GAUGE_METRIC: NoopGaugeMetric; -export declare const NOOP_HISTOGRAM_METRIC: NoopHistogramMetric; -export declare const NOOP_UP_DOWN_COUNTER_METRIC: NoopUpDownCounterMetric; -export declare const NOOP_OBSERVABLE_COUNTER_METRIC: NoopObservableCounterMetric; -export declare const NOOP_OBSERVABLE_GAUGE_METRIC: NoopObservableGaugeMetric; -export declare const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC: NoopObservableUpDownCounterMetric; -/** - * Create a no-op Meter - * - * @since 1.3.0 - */ -export declare function createNoopMeter(): Meter; -//# sourceMappingURL=NoopMeter.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.js b/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.js deleted file mode 100644 index 70cf350..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.js +++ /dev/null @@ -1,118 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createNoopMeter = exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = exports.NOOP_OBSERVABLE_GAUGE_METRIC = exports.NOOP_OBSERVABLE_COUNTER_METRIC = exports.NOOP_UP_DOWN_COUNTER_METRIC = exports.NOOP_HISTOGRAM_METRIC = exports.NOOP_GAUGE_METRIC = exports.NOOP_COUNTER_METRIC = exports.NOOP_METER = exports.NoopObservableUpDownCounterMetric = exports.NoopObservableGaugeMetric = exports.NoopObservableCounterMetric = exports.NoopObservableMetric = exports.NoopHistogramMetric = exports.NoopGaugeMetric = exports.NoopUpDownCounterMetric = exports.NoopCounterMetric = exports.NoopMetric = exports.NoopMeter = void 0; -/** - * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses - * constant NoopMetrics for all of its methods. - */ -class NoopMeter { - constructor() { } - /** - * @see {@link Meter.createGauge} - */ - createGauge(_name, _options) { - return exports.NOOP_GAUGE_METRIC; - } - /** - * @see {@link Meter.createHistogram} - */ - createHistogram(_name, _options) { - return exports.NOOP_HISTOGRAM_METRIC; - } - /** - * @see {@link Meter.createCounter} - */ - createCounter(_name, _options) { - return exports.NOOP_COUNTER_METRIC; - } - /** - * @see {@link Meter.createUpDownCounter} - */ - createUpDownCounter(_name, _options) { - return exports.NOOP_UP_DOWN_COUNTER_METRIC; - } - /** - * @see {@link Meter.createObservableGauge} - */ - createObservableGauge(_name, _options) { - return exports.NOOP_OBSERVABLE_GAUGE_METRIC; - } - /** - * @see {@link Meter.createObservableCounter} - */ - createObservableCounter(_name, _options) { - return exports.NOOP_OBSERVABLE_COUNTER_METRIC; - } - /** - * @see {@link Meter.createObservableUpDownCounter} - */ - createObservableUpDownCounter(_name, _options) { - return exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC; - } - /** - * @see {@link Meter.addBatchObservableCallback} - */ - addBatchObservableCallback(_callback, _observables) { } - /** - * @see {@link Meter.removeBatchObservableCallback} - */ - removeBatchObservableCallback(_callback) { } -} -exports.NoopMeter = NoopMeter; -class NoopMetric { -} -exports.NoopMetric = NoopMetric; -class NoopCounterMetric extends NoopMetric { - add(_value, _attributes) { } -} -exports.NoopCounterMetric = NoopCounterMetric; -class NoopUpDownCounterMetric extends NoopMetric { - add(_value, _attributes) { } -} -exports.NoopUpDownCounterMetric = NoopUpDownCounterMetric; -class NoopGaugeMetric extends NoopMetric { - record(_value, _attributes) { } -} -exports.NoopGaugeMetric = NoopGaugeMetric; -class NoopHistogramMetric extends NoopMetric { - record(_value, _attributes) { } -} -exports.NoopHistogramMetric = NoopHistogramMetric; -class NoopObservableMetric { - addCallback(_callback) { } - removeCallback(_callback) { } -} -exports.NoopObservableMetric = NoopObservableMetric; -class NoopObservableCounterMetric extends NoopObservableMetric { -} -exports.NoopObservableCounterMetric = NoopObservableCounterMetric; -class NoopObservableGaugeMetric extends NoopObservableMetric { -} -exports.NoopObservableGaugeMetric = NoopObservableGaugeMetric; -class NoopObservableUpDownCounterMetric extends NoopObservableMetric { -} -exports.NoopObservableUpDownCounterMetric = NoopObservableUpDownCounterMetric; -exports.NOOP_METER = new NoopMeter(); -// Synchronous instruments -exports.NOOP_COUNTER_METRIC = new NoopCounterMetric(); -exports.NOOP_GAUGE_METRIC = new NoopGaugeMetric(); -exports.NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric(); -exports.NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric(); -// Asynchronous instruments -exports.NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric(); -exports.NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric(); -exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric(); -/** - * Create a no-op Meter - * - * @since 1.3.0 - */ -function createNoopMeter() { - return exports.NOOP_METER; -} -exports.createNoopMeter = createNoopMeter; -//# sourceMappingURL=NoopMeter.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.js.map b/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.js.map deleted file mode 100644 index 8dc975f..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopMeter.js","sourceRoot":"","sources":["../../../src/metrics/NoopMeter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkBH;;;GAGG;AACH,MAAa,SAAS;IACpB,gBAAe,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,KAAa,EAAE,QAAwB;QACjD,OAAO,yBAAiB,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,KAAa,EAAE,QAAwB;QACrD,OAAO,6BAAqB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,KAAa,EAAE,QAAwB;QACnD,OAAO,2BAAmB,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,KAAa,EAAE,QAAwB;QACzD,OAAO,mCAA2B,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,qBAAqB,CACnB,KAAa,EACb,QAAwB;QAExB,OAAO,oCAA4B,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,uBAAuB,CACrB,KAAa,EACb,QAAwB;QAExB,OAAO,sCAA8B,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,6BAA6B,CAC3B,KAAa,EACb,QAAwB;QAExB,OAAO,8CAAsC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,0BAA0B,CACxB,SAAk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QAAA,sCAAsC,GACjD,IAAI,iCAAiC,EAAE,CAAC;AAE1C;;;;GAIG;AACH,SAAgB,eAAe;IAC7B,OAAO,kBAAU,CAAC;AACpB,CAAC;AAFD,0CAEC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter } from './Meter';\nimport type {\n BatchObservableCallback,\n Counter,\n Gauge,\n Histogram,\n MetricAttributes,\n MetricOptions,\n Observable,\n ObservableCallback,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n} from './Metric';\n\n/**\n * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses\n * constant NoopMetrics for all of its methods.\n */\nexport class NoopMeter implements Meter {\n constructor() {}\n\n /**\n * @see {@link Meter.createGauge}\n */\n createGauge(_name: string, _options?: MetricOptions): Gauge {\n return NOOP_GAUGE_METRIC;\n }\n\n /**\n * @see {@link Meter.createHistogram}\n */\n createHistogram(_name: string, _options?: MetricOptions): Histogram {\n return NOOP_HISTOGRAM_METRIC;\n }\n\n /**\n * @see {@link Meter.createCounter}\n */\n createCounter(_name: string, _options?: MetricOptions): Counter {\n return NOOP_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createUpDownCounter}\n */\n createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter {\n return NOOP_UP_DOWN_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableGauge}\n */\n createObservableGauge(\n _name: string,\n _options?: MetricOptions\n ): ObservableGauge {\n return NOOP_OBSERVABLE_GAUGE_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableCounter}\n */\n createObservableCounter(\n _name: string,\n _options?: MetricOptions\n ): ObservableCounter {\n return NOOP_OBSERVABLE_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableUpDownCounter}\n */\n createObservableUpDownCounter(\n _name: string,\n _options?: MetricOptions\n ): ObservableUpDownCounter {\n return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.addBatchObservableCallback}\n */\n addBatchObservableCallback(\n _callback: BatchObservableCallback,\n _observables: Observable[]\n ): void {}\n\n /**\n * @see {@link Meter.removeBatchObservableCallback}\n */\n removeBatchObservableCallback(_callback: BatchObservableCallback): void {}\n}\n\nexport class NoopMetric {}\n\nexport class NoopCounterMetric extends NoopMetric implements Counter {\n add(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopUpDownCounterMetric\n extends NoopMetric\n implements UpDownCounter\n{\n add(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopGaugeMetric extends NoopMetric implements Gauge {\n record(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopHistogramMetric extends NoopMetric implements Histogram {\n record(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopObservableMetric {\n addCallback(_callback: ObservableCallback) {}\n\n removeCallback(_callback: ObservableCallback) {}\n}\n\nexport class NoopObservableCounterMetric\n extends NoopObservableMetric\n implements ObservableCounter {}\n\nexport class NoopObservableGaugeMetric\n extends NoopObservableMetric\n implements ObservableGauge {}\n\nexport class NoopObservableUpDownCounterMetric\n extends NoopObservableMetric\n implements ObservableUpDownCounter {}\n\nexport const NOOP_METER = new NoopMeter();\n\n// Synchronous instruments\nexport const NOOP_COUNTER_METRIC = new NoopCounterMetric();\nexport const NOOP_GAUGE_METRIC = new NoopGaugeMetric();\nexport const NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric();\nexport const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();\n\n// Asynchronous instruments\nexport const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();\nexport const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();\nexport const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC =\n new NoopObservableUpDownCounterMetric();\n\n/**\n * Create a no-op Meter\n *\n * @since 1.3.0\n */\nexport function createNoopMeter(): Meter {\n return NOOP_METER;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.d.ts b/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.d.ts deleted file mode 100644 index 50cf9ae..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Meter, MeterOptions } from './Meter'; -import type { MeterProvider } from './MeterProvider'; -/** - * An implementation of the {@link MeterProvider} which returns an impotent Meter - * for all calls to `getMeter` - */ -export declare class NoopMeterProvider implements MeterProvider { - getMeter(_name: string, _version?: string, _options?: MeterOptions): Meter; -} -export declare const NOOP_METER_PROVIDER: NoopMeterProvider; -//# sourceMappingURL=NoopMeterProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.js b/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.js deleted file mode 100644 index dec4cda..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_METER_PROVIDER = exports.NoopMeterProvider = void 0; -const NoopMeter_1 = require("./NoopMeter"); -/** - * An implementation of the {@link MeterProvider} which returns an impotent Meter - * for all calls to `getMeter` - */ -class NoopMeterProvider { - getMeter(_name, _version, _options) { - return NoopMeter_1.NOOP_METER; - } -} -exports.NoopMeterProvider = NoopMeterProvider; -exports.NOOP_METER_PROVIDER = new NoopMeterProvider(); -//# sourceMappingURL=NoopMeterProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.js.map b/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.js.map deleted file mode 100644 index 00782a5..0000000 --- a/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopMeterProvider.js","sourceRoot":"","sources":["../../../src/metrics/NoopMeterProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2CAAyC;AAEzC;;;GAGG;AACH,MAAa,iBAAiB;IAC5B,QAAQ,CAAC,KAAa,EAAE,QAAiB,EAAE,QAAuB;QAChE,OAAO,sBAAU,CAAC;IACpB,CAAC;CACF;AAJD,8CAIC;AAEY,QAAA,mBAAmB,GAAG,IAAI,iBAAiB,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Meter, MeterOptions } from './Meter';\nimport type { MeterProvider } from './MeterProvider';\nimport { NOOP_METER } from './NoopMeter';\n\n/**\n * An implementation of the {@link MeterProvider} which returns an impotent Meter\n * for all calls to `getMeter`\n */\nexport class NoopMeterProvider implements MeterProvider {\n getMeter(_name: string, _version?: string, _options?: MeterOptions): Meter {\n return NOOP_METER;\n }\n}\n\nexport const NOOP_METER_PROVIDER = new NoopMeterProvider();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/propagation-api.d.ts b/node_modules/@opentelemetry/api/build/src/propagation-api.d.ts deleted file mode 100644 index 66df25f..0000000 --- a/node_modules/@opentelemetry/api/build/src/propagation-api.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { PropagationAPI } from './api/propagation'; -/** - * Entrypoint for propagation API - * - * @since 1.0.0 - */ -export declare const propagation: PropagationAPI; -//# sourceMappingURL=propagation-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/propagation-api.js b/node_modules/@opentelemetry/api/build/src/propagation-api.js deleted file mode 100644 index 2107037..0000000 --- a/node_modules/@opentelemetry/api/build/src/propagation-api.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.propagation = void 0; -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -const propagation_1 = require("./api/propagation"); -/** - * Entrypoint for propagation API - * - * @since 1.0.0 - */ -exports.propagation = propagation_1.PropagationAPI.getInstance(); -//# sourceMappingURL=propagation-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/propagation-api.js.map b/node_modules/@opentelemetry/api/build/src/propagation-api.js.map deleted file mode 100644 index f57aa20..0000000 --- a/node_modules/@opentelemetry/api/build/src/propagation-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"propagation-api.js","sourceRoot":"","sources":["../../src/propagation-api.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,mDAAmD;AACnD;;;;GAIG;AACU,QAAA,WAAW,GAAG,4BAAc,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { PropagationAPI } from './api/propagation';\n/**\n * Entrypoint for propagation API\n *\n * @since 1.0.0\n */\nexport const propagation = PropagationAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.d.ts b/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.d.ts deleted file mode 100644 index 9ea4a42..0000000 --- a/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Context } from '../context/types'; -import type { TextMapPropagator } from './TextMapPropagator'; -/** - * No-op implementations of {@link TextMapPropagator}. - */ -export declare class NoopTextMapPropagator implements TextMapPropagator { - /** Noop inject function does nothing */ - inject(_context: Context, _carrier: unknown): void; - /** Noop extract function does nothing and returns the input context */ - extract(context: Context, _carrier: unknown): Context; - fields(): string[]; -} -//# sourceMappingURL=NoopTextMapPropagator.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.js b/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.js deleted file mode 100644 index 9f33a26..0000000 --- a/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NoopTextMapPropagator = void 0; -/** - * No-op implementations of {@link TextMapPropagator}. - */ -class NoopTextMapPropagator { - /** Noop inject function does nothing */ - inject(_context, _carrier) { } - /** Noop extract function does nothing and returns the input context */ - extract(context, _carrier) { - return context; - } - fields() { - return []; - } -} -exports.NoopTextMapPropagator = NoopTextMapPropagator; -//# sourceMappingURL=NoopTextMapPropagator.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.js.map b/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.js.map deleted file mode 100644 index 81e20ad..0000000 --- a/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopTextMapPropagator.js","sourceRoot":"","sources":["../../../src/propagation/NoopTextMapPropagator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;GAEG;AACH,MAAa,qBAAqB;IAChC,wCAAwC;IACxC,MAAM,CAAC,QAAiB,EAAE,QAAiB,IAAS,CAAC;IACrD,uEAAuE;IACvE,OAAO,CAAC,OAAgB,EAAE,QAAiB;QACzC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM;QACJ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAVD,sDAUC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport type { TextMapPropagator } from './TextMapPropagator';\n\n/**\n * No-op implementations of {@link TextMapPropagator}.\n */\nexport class NoopTextMapPropagator implements TextMapPropagator {\n /** Noop inject function does nothing */\n inject(_context: Context, _carrier: unknown): void {}\n /** Noop extract function does nothing and returns the input context */\n extract(context: Context, _carrier: unknown): Context {\n return context;\n }\n fields(): string[] {\n return [];\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.d.ts b/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.d.ts deleted file mode 100644 index 057552e..0000000 --- a/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -import type { Context } from '../context/types'; -/** - * Injects `Context` into and extracts it from carriers that travel - * in-band across process boundaries. Encoding is expected to conform to the - * HTTP Header Field semantics. Values are often encoded as RPC/HTTP request - * headers. - * - * The carrier of propagated data on both the client (injector) and server - * (extractor) side is usually an object such as http headers. Propagation is - * usually implemented via library-specific request interceptors, where the - * client-side injects values and the server-side extracts them. - * - * @since 1.0.0 - */ -export interface TextMapPropagator { - /** - * Injects values from a given `Context` into a carrier. - * - * OpenTelemetry defines a common set of format values (TextMapPropagator), - * and each has an expected `carrier` type. - * - * @param context the Context from which to extract values to transmit over - * the wire. - * @param carrier the carrier of propagation fields, such as http request - * headers. - * @param setter an optional {@link TextMapSetter}. If undefined, values will be - * set by direct object assignment. - */ - inject(context: Context, carrier: Carrier, setter: TextMapSetter): void; - /** - * Given a `Context` and a carrier, extract context values from a - * carrier and return a new context, created from the old context, with the - * extracted values. - * - * @param context the Context from which to extract values to transmit over - * the wire. - * @param carrier the carrier of propagation fields, such as http request - * headers. - * @param getter an optional {@link TextMapGetter}. If undefined, keys will be all - * own properties, and keys will be accessed by direct object access. - */ - extract(context: Context, carrier: Carrier, getter: TextMapGetter): Context; - /** - * Return a list of all fields which may be used by the propagator. - */ - fields(): string[]; -} -/** - * A setter is specified by the caller to define a specific method - * to set key/value pairs on the carrier within a propagator - * - * @since 1.0.0 - */ -export interface TextMapSetter { - /** - * Callback used to set a key/value pair on an object. - * - * Should be called by the propagator each time a key/value pair - * should be set, and should set that key/value pair on the propagator. - * - * @param carrier object or class which carries key/value pairs - * @param key string key to modify - * @param value value to be set to the key on the carrier - */ - set(carrier: Carrier, key: string, value: string): void; -} -/** - * A getter is specified by the caller to define a specific method - * to get the value of a key from a carrier. - * - * @since 1.0.0 - */ -export interface TextMapGetter { - /** - * Get a list of all keys available on the carrier. - * - * @param carrier - */ - keys(carrier: Carrier): string[]; - /** - * Get the value of a specific key from the carrier. - * - * @param carrier - * @param key - */ - get(carrier: Carrier, key: string): undefined | string | string[]; -} -/** - * @since 1.0.0 - */ -export declare const defaultTextMapGetter: TextMapGetter; -/** - * @since 1.0.0 - */ -export declare const defaultTextMapSetter: TextMapSetter; -//# sourceMappingURL=TextMapPropagator.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.js b/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.js deleted file mode 100644 index 8a607d9..0000000 --- a/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.defaultTextMapSetter = exports.defaultTextMapGetter = void 0; -/** - * @since 1.0.0 - */ -exports.defaultTextMapGetter = { - get(carrier, key) { - if (carrier == null) { - return undefined; - } - return carrier[key]; - }, - keys(carrier) { - if (carrier == null) { - return []; - } - return Object.keys(carrier); - }, -}; -/** - * @since 1.0.0 - */ -exports.defaultTextMapSetter = { - set(carrier, key, value) { - if (carrier == null) { - return; - } - carrier[key] = value; - }, -}; -//# sourceMappingURL=TextMapPropagator.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.js.map b/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.js.map deleted file mode 100644 index 45e5439..0000000 --- a/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"TextMapPropagator.js","sourceRoot":"","sources":["../../../src/propagation/TextMapPropagator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA2GH;;GAEG;AACU,QAAA,oBAAoB,GAAkB;IACjD,GAAG,CAAC,OAAO,EAAE,GAAG;QACd,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,OAAO;QACV,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO,EAAE,CAAC;SACX;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC;AAEF;;GAEG;AACU,QAAA,oBAAoB,GAAkB;IACjD,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK;QACrB,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO;SACR;QAED,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\n\n/**\n * Injects `Context` into and extracts it from carriers that travel\n * in-band across process boundaries. Encoding is expected to conform to the\n * HTTP Header Field semantics. Values are often encoded as RPC/HTTP request\n * headers.\n *\n * The carrier of propagated data on both the client (injector) and server\n * (extractor) side is usually an object such as http headers. Propagation is\n * usually implemented via library-specific request interceptors, where the\n * client-side injects values and the server-side extracts them.\n *\n * @since 1.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TextMapPropagator {\n /**\n * Injects values from a given `Context` into a carrier.\n *\n * OpenTelemetry defines a common set of format values (TextMapPropagator),\n * and each has an expected `carrier` type.\n *\n * @param context the Context from which to extract values to transmit over\n * the wire.\n * @param carrier the carrier of propagation fields, such as http request\n * headers.\n * @param setter an optional {@link TextMapSetter}. If undefined, values will be\n * set by direct object assignment.\n */\n inject(\n context: Context,\n carrier: Carrier,\n setter: TextMapSetter\n ): void;\n\n /**\n * Given a `Context` and a carrier, extract context values from a\n * carrier and return a new context, created from the old context, with the\n * extracted values.\n *\n * @param context the Context from which to extract values to transmit over\n * the wire.\n * @param carrier the carrier of propagation fields, such as http request\n * headers.\n * @param getter an optional {@link TextMapGetter}. If undefined, keys will be all\n * own properties, and keys will be accessed by direct object access.\n */\n extract(\n context: Context,\n carrier: Carrier,\n getter: TextMapGetter\n ): Context;\n\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n fields(): string[];\n}\n\n/**\n * A setter is specified by the caller to define a specific method\n * to set key/value pairs on the carrier within a propagator\n *\n * @since 1.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TextMapSetter {\n /**\n * Callback used to set a key/value pair on an object.\n *\n * Should be called by the propagator each time a key/value pair\n * should be set, and should set that key/value pair on the propagator.\n *\n * @param carrier object or class which carries key/value pairs\n * @param key string key to modify\n * @param value value to be set to the key on the carrier\n */\n set(carrier: Carrier, key: string, value: string): void;\n}\n\n/**\n * A getter is specified by the caller to define a specific method\n * to get the value of a key from a carrier.\n *\n * @since 1.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TextMapGetter {\n /**\n * Get a list of all keys available on the carrier.\n *\n * @param carrier\n */\n keys(carrier: Carrier): string[];\n\n /**\n * Get the value of a specific key from the carrier.\n *\n * @param carrier\n * @param key\n */\n get(carrier: Carrier, key: string): undefined | string | string[];\n}\n\n/**\n * @since 1.0.0\n */\nexport const defaultTextMapGetter: TextMapGetter = {\n get(carrier, key) {\n if (carrier == null) {\n return undefined;\n }\n return carrier[key];\n },\n\n keys(carrier) {\n if (carrier == null) {\n return [];\n }\n return Object.keys(carrier);\n },\n};\n\n/**\n * @since 1.0.0\n */\nexport const defaultTextMapSetter: TextMapSetter = {\n set(carrier, key, value) {\n if (carrier == null) {\n return;\n }\n\n carrier[key] = value;\n },\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace-api.d.ts b/node_modules/@opentelemetry/api/build/src/trace-api.d.ts deleted file mode 100644 index 7064168..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace-api.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { TraceAPI } from './api/trace'; -/** - * Entrypoint for trace API - * - * @since 1.0.0 - */ -export declare const trace: TraceAPI; -//# sourceMappingURL=trace-api.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace-api.js b/node_modules/@opentelemetry/api/build/src/trace-api.js deleted file mode 100644 index a8ce5ba..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace-api.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.trace = void 0; -// Split module-level variable definition into separate files to allow -// tree-shaking on each api instance. -const trace_1 = require("./api/trace"); -/** - * Entrypoint for trace API - * - * @since 1.0.0 - */ -exports.trace = trace_1.TraceAPI.getInstance(); -//# sourceMappingURL=trace-api.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace-api.js.map b/node_modules/@opentelemetry/api/build/src/trace-api.js.map deleted file mode 100644 index 76921d8..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace-api.js","sourceRoot":"","sources":["../../src/trace-api.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,uCAAuC;AAEvC;;;;GAIG;AACU,QAAA,KAAK,GAAG,gBAAQ,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { TraceAPI } from './api/trace';\n\n/**\n * Entrypoint for trace API\n *\n * @since 1.0.0\n */\nexport const trace = TraceAPI.getInstance();\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.d.ts b/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.d.ts deleted file mode 100644 index ba793f6..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Exception } from '../common/Exception'; -import type { TimeInput } from '../common/Time'; -import type { SpanAttributes } from './attributes'; -import type { Span } from './span'; -import type { SpanContext } from './span_context'; -import type { SpanStatus } from './status'; -import type { Link } from './link'; -/** - * The NonRecordingSpan is the default {@link Span} that is used when no Span - * implementation is available. All operations are no-op including context - * propagation. - */ -export declare class NonRecordingSpan implements Span { - private readonly _spanContext; - constructor(spanContext?: SpanContext); - spanContext(): SpanContext; - setAttribute(_key: string, _value: unknown): this; - setAttributes(_attributes: SpanAttributes): this; - addEvent(_name: string, _attributes?: SpanAttributes): this; - addLink(_link: Link): this; - addLinks(_links: Link[]): this; - setStatus(_status: SpanStatus): this; - updateName(_name: string): this; - end(_endTime?: TimeInput): void; - isRecording(): boolean; - recordException(_exception: Exception, _time?: TimeInput): void; -} -//# sourceMappingURL=NonRecordingSpan.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.js b/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.js deleted file mode 100644 index 5b5f455..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NonRecordingSpan = void 0; -const invalid_span_constants_1 = require("./invalid-span-constants"); -/** - * The NonRecordingSpan is the default {@link Span} that is used when no Span - * implementation is available. All operations are no-op including context - * propagation. - */ -class NonRecordingSpan { - constructor(spanContext = invalid_span_constants_1.INVALID_SPAN_CONTEXT) { - this._spanContext = spanContext; - } - // Returns a SpanContext. - spanContext() { - return this._spanContext; - } - // By default does nothing - setAttribute(_key, _value) { - return this; - } - // By default does nothing - setAttributes(_attributes) { - return this; - } - // By default does nothing - addEvent(_name, _attributes) { - return this; - } - addLink(_link) { - return this; - } - addLinks(_links) { - return this; - } - // By default does nothing - setStatus(_status) { - return this; - } - // By default does nothing - updateName(_name) { - return this; - } - // By default does nothing - end(_endTime) { } - // isRecording always returns false for NonRecordingSpan. - isRecording() { - return false; - } - // By default does nothing - recordException(_exception, _time) { } -} -exports.NonRecordingSpan = NonRecordingSpan; -//# sourceMappingURL=NonRecordingSpan.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.js.map b/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.js.map deleted file mode 100644 index 8fbf92e..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NonRecordingSpan.js","sourceRoot":"","sources":["../../../src/trace/NonRecordingSpan.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,qEAAgE;AAMhE;;;;GAIG;AACH,MAAa,gBAAgB;IAG3B,YAAY,cAA2B,6CAAoB;QACzD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED,yBAAyB;IACzB,WAAW;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,0BAA0B;IAC1B,YAAY,CAAC,IAAY,EAAE,MAAe;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,aAAa,CAAC,WAA2B;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,QAAQ,CAAC,KAAa,EAAE,WAA4B;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAW;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,MAAc;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,SAAS,CAAC,OAAmB;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,UAAU,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,GAAG,CAAC,QAAoB,IAAS,CAAC;IAElC,yDAAyD;IACzD,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0BAA0B;IAC1B,eAAe,CAAC,UAAqB,EAAE,KAAiB,IAAS,CAAC;CACnE;AAvDD,4CAuDC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Exception } from '../common/Exception';\nimport type { TimeInput } from '../common/Time';\nimport type { SpanAttributes } from './attributes';\nimport { INVALID_SPAN_CONTEXT } from './invalid-span-constants';\nimport type { Span } from './span';\nimport type { SpanContext } from './span_context';\nimport type { SpanStatus } from './status';\nimport type { Link } from './link';\n\n/**\n * The NonRecordingSpan is the default {@link Span} that is used when no Span\n * implementation is available. All operations are no-op including context\n * propagation.\n */\nexport class NonRecordingSpan implements Span {\n private readonly _spanContext: SpanContext;\n\n constructor(spanContext: SpanContext = INVALID_SPAN_CONTEXT) {\n this._spanContext = spanContext;\n }\n\n // Returns a SpanContext.\n spanContext(): SpanContext {\n return this._spanContext;\n }\n\n // By default does nothing\n setAttribute(_key: string, _value: unknown): this {\n return this;\n }\n\n // By default does nothing\n setAttributes(_attributes: SpanAttributes): this {\n return this;\n }\n\n // By default does nothing\n addEvent(_name: string, _attributes?: SpanAttributes): this {\n return this;\n }\n\n addLink(_link: Link): this {\n return this;\n }\n\n addLinks(_links: Link[]): this {\n return this;\n }\n\n // By default does nothing\n setStatus(_status: SpanStatus): this {\n return this;\n }\n\n // By default does nothing\n updateName(_name: string): this {\n return this;\n }\n\n // By default does nothing\n end(_endTime?: TimeInput): void {}\n\n // isRecording always returns false for NonRecordingSpan.\n isRecording(): boolean {\n return false;\n }\n\n // By default does nothing\n recordException(_exception: Exception, _time?: TimeInput): void {}\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.d.ts b/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.d.ts deleted file mode 100644 index f1efbcf..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanOptions } from './SpanOptions'; -import type { Tracer } from './tracer'; -/** - * No-op implementations of {@link Tracer}. - */ -export declare class NoopTracer implements Tracer { - startSpan(name: string, options?: SpanOptions, context?: Context): Span; - startActiveSpan ReturnType>(name: string, fn: F): ReturnType; - startActiveSpan ReturnType>(name: string, opts: SpanOptions | undefined, fn: F): ReturnType; - startActiveSpan ReturnType>(name: string, opts: SpanOptions | undefined, ctx: Context | undefined, fn: F): ReturnType; -} -//# sourceMappingURL=NoopTracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js b/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js deleted file mode 100644 index 9cacd47..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NoopTracer = void 0; -const context_1 = require("../api/context"); -const context_utils_1 = require("../trace/context-utils"); -const NonRecordingSpan_1 = require("./NonRecordingSpan"); -const spancontext_utils_1 = require("./spancontext-utils"); -const contextApi = context_1.ContextAPI.getInstance(); -/** - * No-op implementations of {@link Tracer}. - */ -class NoopTracer { - // startSpan starts a noop span. - startSpan(name, options, context = contextApi.active()) { - const root = Boolean(options === null || options === void 0 ? void 0 : options.root); - if (root) { - return new NonRecordingSpan_1.NonRecordingSpan(); - } - const parentFromContext = context && (0, context_utils_1.getSpanContext)(context); - if (isSpanContext(parentFromContext) && - (0, spancontext_utils_1.isSpanContextValid)(parentFromContext)) { - return new NonRecordingSpan_1.NonRecordingSpan(parentFromContext); - } - else { - return new NonRecordingSpan_1.NonRecordingSpan(); - } - } - startActiveSpan(name, arg2, arg3, arg4) { - let opts; - let ctx; - let fn; - if (arguments.length < 2) { - return; - } - else if (arguments.length === 2) { - fn = arg2; - } - else if (arguments.length === 3) { - opts = arg2; - fn = arg3; - } - else { - opts = arg2; - ctx = arg3; - fn = arg4; - } - const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active(); - const span = this.startSpan(name, opts, parentContext); - const contextWithSpanSet = (0, context_utils_1.setSpan)(parentContext, span); - return contextApi.with(contextWithSpanSet, fn, undefined, span); - } -} -exports.NoopTracer = NoopTracer; -function isSpanContext(spanContext) { - return (spanContext !== null && - typeof spanContext === 'object' && - 'spanId' in spanContext && - typeof spanContext['spanId'] === 'string' && - 'traceId' in spanContext && - typeof spanContext['traceId'] === 'string' && - 'traceFlags' in spanContext && - typeof spanContext['traceFlags'] === 'number'); -} -//# sourceMappingURL=NoopTracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js.map b/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js.map deleted file mode 100644 index 8e8e107..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopTracer.js","sourceRoot":"","sources":["../../../src/trace/NoopTracer.ts"],"names":[],"mappings":";AAAA;;;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AAG,cAAH,GAAG,GAAI,UAAU,CAAC,MAAM,EAAE,CAAC;QACjD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QACvD,MAAM,kBAAkB,GAAG,IAAA,uBAAO,EAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAExD,OAAO,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;CACF;AApED,gCAoEC;AAED,SAAS,aAAa,CAAC,WAAoB;IACzC,OAAO,CACL,WAAW,KAAK,IAAI;QACpB,OAAO,WAAW,KAAK,QAAQ;QAC/B,QAAQ,IAAI,WAAW;QACvB,OAAO,WAAW,CAAC,QAAQ,CAAC,KAAK,QAAQ;QACzC,SAAS,IAAI,WAAW;QACxB,OAAO,WAAW,CAAC,SAAS,CAAC,KAAK,QAAQ;QAC1C,YAAY,IAAI,WAAW;QAC3B,OAAO,WAAW,CAAC,YAAY,CAAC,KAAK,QAAQ,CAC9C,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ContextAPI } from '../api/context';\nimport type { Context } from '../context/types';\nimport { getSpanContext, setSpan } from '../trace/context-utils';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport type { Span } from './span';\nimport { isSpanContextValid } from './spancontext-utils';\nimport type { SpanOptions } from './SpanOptions';\nimport type { SpanContext } from './span_context';\nimport type { Tracer } from './tracer';\n\nconst contextApi = ContextAPI.getInstance();\n\n/**\n * No-op implementations of {@link Tracer}.\n */\nexport class NoopTracer implements Tracer {\n // startSpan starts a noop span.\n startSpan(\n name: string,\n options?: SpanOptions,\n context = contextApi.active()\n ): Span {\n const root = Boolean(options?.root);\n if (root) {\n return new NonRecordingSpan();\n }\n\n const parentFromContext = context && getSpanContext(context);\n\n if (\n isSpanContext(parentFromContext) &&\n isSpanContextValid(parentFromContext)\n ) {\n return new NonRecordingSpan(parentFromContext);\n } else {\n return new NonRecordingSpan();\n }\n }\n\n startActiveSpan ReturnType>(\n name: string,\n fn: F\n ): ReturnType;\n startActiveSpan ReturnType>(\n name: string,\n opts: SpanOptions | undefined,\n fn: F\n ): ReturnType;\n startActiveSpan ReturnType>(\n name: string,\n opts: SpanOptions | undefined,\n ctx: Context | undefined,\n fn: F\n ): ReturnType;\n startActiveSpan ReturnType>(\n name: string,\n arg2?: F | SpanOptions,\n arg3?: F | Context,\n arg4?: F\n ): ReturnType | undefined {\n let opts: SpanOptions | undefined;\n let ctx: Context | undefined;\n let fn: F;\n\n if (arguments.length < 2) {\n return;\n } else if (arguments.length === 2) {\n fn = arg2 as F;\n } else if (arguments.length === 3) {\n opts = arg2 as SpanOptions | undefined;\n fn = arg3 as F;\n } else {\n opts = arg2 as SpanOptions | undefined;\n ctx = arg3 as Context | undefined;\n fn = arg4 as F;\n }\n\n const parentContext = ctx ?? contextApi.active();\n const span = this.startSpan(name, opts, parentContext);\n const contextWithSpanSet = setSpan(parentContext, span);\n\n return contextApi.with(contextWithSpanSet, fn, undefined, span);\n }\n}\n\nfunction isSpanContext(spanContext: unknown): spanContext is SpanContext {\n return (\n spanContext !== null &&\n typeof spanContext === 'object' &&\n 'spanId' in spanContext &&\n typeof spanContext['spanId'] === 'string' &&\n 'traceId' in spanContext &&\n typeof spanContext['traceId'] === 'string' &&\n 'traceFlags' in spanContext &&\n typeof spanContext['traceFlags'] === 'number'\n );\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.d.ts b/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.d.ts deleted file mode 100644 index 0c29a20..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Tracer } from './tracer'; -import type { TracerOptions } from './tracer_options'; -import type { TracerProvider } from './tracer_provider'; -/** - * An implementation of the {@link TracerProvider} which returns an impotent - * Tracer for all calls to `getTracer`. - * - * All operations are no-op. - */ -export declare class NoopTracerProvider implements TracerProvider { - getTracer(_name?: string, _version?: string, _options?: TracerOptions): Tracer; -} -//# sourceMappingURL=NoopTracerProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js b/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js deleted file mode 100644 index 912de03..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NoopTracerProvider = void 0; -const NoopTracer_1 = require("./NoopTracer"); -/** - * An implementation of the {@link TracerProvider} which returns an impotent - * Tracer for all calls to `getTracer`. - * - * All operations are no-op. - */ -class NoopTracerProvider { - getTracer(_name, _version, _options) { - return new NoopTracer_1.NoopTracer(); - } -} -exports.NoopTracerProvider = NoopTracerProvider; -//# sourceMappingURL=NoopTracerProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js.map b/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js.map deleted file mode 100644 index f8ead2e..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoopTracerProvider.js","sourceRoot":"","sources":["../../../src/trace/NoopTracerProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6CAA0C;AAK1C;;;;;GAKG;AACH,MAAa,kBAAkB;IAC7B,SAAS,CACP,KAAc,EACd,QAAiB,EACjB,QAAwB;QAExB,OAAO,IAAI,uBAAU,EAAE,CAAC;IAC1B,CAAC;CACF;AARD,gDAQC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { NoopTracer } from './NoopTracer';\nimport type { Tracer } from './tracer';\nimport type { TracerOptions } from './tracer_options';\nimport type { TracerProvider } from './tracer_provider';\n\n/**\n * An implementation of the {@link TracerProvider} which returns an impotent\n * Tracer for all calls to `getTracer`.\n *\n * All operations are no-op.\n */\nexport class NoopTracerProvider implements TracerProvider {\n getTracer(\n _name?: string,\n _version?: string,\n _options?: TracerOptions\n ): Tracer {\n return new NoopTracer();\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.d.ts b/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.d.ts deleted file mode 100644 index af0d3ae..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanOptions } from './SpanOptions'; -import type { Tracer } from './tracer'; -import type { TracerOptions } from './tracer_options'; -/** - * Proxy tracer provided by the proxy tracer provider - * - * @since 1.0.0 - */ -export declare class ProxyTracer implements Tracer { - private _delegate?; - private _provider; - readonly name: string; - readonly version?: string; - readonly options?: TracerOptions; - constructor(provider: TracerDelegator, name: string, version?: string, options?: TracerOptions); - startSpan(name: string, options?: SpanOptions, context?: Context): Span; - startActiveSpan unknown>(_name: string, _options: F | SpanOptions, _context?: F | Context, _fn?: F): ReturnType; - /** - * Try to get a tracer from the proxy tracer provider. - * If the proxy tracer provider has no delegate, return a noop tracer. - */ - private _getTracer; -} -/** - * @since 1.0.3 - */ -export interface TracerDelegator { - getDelegateTracer(name: string, version?: string, options?: TracerOptions): Tracer | undefined; -} -//# sourceMappingURL=ProxyTracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js b/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js deleted file mode 100644 index fa0db7d..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ProxyTracer = void 0; -const NoopTracer_1 = require("./NoopTracer"); -const NOOP_TRACER = new NoopTracer_1.NoopTracer(); -/** - * Proxy tracer provided by the proxy tracer provider - * - * @since 1.0.0 - */ -class ProxyTracer { - constructor(provider, name, version, options) { - this._provider = provider; - this.name = name; - this.version = version; - this.options = options; - } - startSpan(name, options, context) { - return this._getTracer().startSpan(name, options, context); - } - startActiveSpan(_name, _options, _context, _fn) { - const tracer = this._getTracer(); - return Reflect.apply(tracer.startActiveSpan, tracer, arguments); - } - /** - * Try to get a tracer from the proxy tracer provider. - * If the proxy tracer provider has no delegate, return a noop tracer. - */ - _getTracer() { - if (this._delegate) { - return this._delegate; - } - const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options); - if (!tracer) { - return NOOP_TRACER; - } - this._delegate = tracer; - return this._delegate; - } -} -exports.ProxyTracer = ProxyTracer; -//# sourceMappingURL=ProxyTracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js.map b/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js.map deleted file mode 100644 index f7c8ef2..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ProxyTracer.js","sourceRoot":"","sources":["../../../src/trace/ProxyTracer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,6CAA0C;AAM1C,MAAM,WAAW,GAAG,IAAI,uBAAU,EAAE,CAAC;AAErC;;;;GAIG;AACH,MAAa,WAAW;IAQtB,YACE,QAAyB,EACzB,IAAY,EACZ,OAAgB,EAChB,OAAuB;QAEvB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,OAAqB,EAAE,OAAiB;QAC9D,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,eAAe,CACb,KAAa,EACb,QAAyB,EACzB,QAAsB,EACtB,GAAO;QAEP,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;IAED;;;OAGG;IACK,UAAU;QAChB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,IAAI,CAAC,SAAS,CAAC;SACvB;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAC7C,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,OAAO,CACb,CAAC;QAEF,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,WAAW,CAAC;SACpB;QAED,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AAxDD,kCAwDC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport { NoopTracer } from './NoopTracer';\nimport type { Span } from './span';\nimport type { SpanOptions } from './SpanOptions';\nimport type { Tracer } from './tracer';\nimport type { TracerOptions } from './tracer_options';\n\nconst NOOP_TRACER = new NoopTracer();\n\n/**\n * Proxy tracer provided by the proxy tracer provider\n *\n * @since 1.0.0\n */\nexport class ProxyTracer implements Tracer {\n // When a real implementation is provided, this will be it\n private _delegate?: Tracer;\n private _provider: TracerDelegator;\n public readonly name: string;\n public readonly version?: string;\n public readonly options?: TracerOptions;\n\n constructor(\n provider: TracerDelegator,\n name: string,\n version?: string,\n options?: TracerOptions\n ) {\n this._provider = provider;\n this.name = name;\n this.version = version;\n this.options = options;\n }\n\n startSpan(name: string, options?: SpanOptions, context?: Context): Span {\n return this._getTracer().startSpan(name, options, context);\n }\n\n startActiveSpan unknown>(\n _name: string,\n _options: F | SpanOptions,\n _context?: F | Context,\n _fn?: F\n ): ReturnType {\n const tracer = this._getTracer();\n return Reflect.apply(tracer.startActiveSpan, tracer, arguments);\n }\n\n /**\n * Try to get a tracer from the proxy tracer provider.\n * If the proxy tracer provider has no delegate, return a noop tracer.\n */\n private _getTracer() {\n if (this._delegate) {\n return this._delegate;\n }\n\n const tracer = this._provider.getDelegateTracer(\n this.name,\n this.version,\n this.options\n );\n\n if (!tracer) {\n return NOOP_TRACER;\n }\n\n this._delegate = tracer;\n return this._delegate;\n }\n}\n\n/**\n * @since 1.0.3\n */\nexport interface TracerDelegator {\n getDelegateTracer(\n name: string,\n version?: string,\n options?: TracerOptions\n ): Tracer | undefined;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.d.ts b/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.d.ts deleted file mode 100644 index 8be668a..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Tracer } from './tracer'; -import type { TracerProvider } from './tracer_provider'; -import type { TracerOptions } from './tracer_options'; -/** - * Tracer provider which provides {@link ProxyTracer}s. - * - * Before a delegate is set, tracers provided are NoOp. - * When a delegate is set, traces are provided from the delegate. - * When a delegate is set after tracers have already been provided, - * all tracers already provided will use the provided delegate implementation. - * - * @deprecated This will be removed in the next major version. - * @since 1.0.0 - */ -export declare class ProxyTracerProvider implements TracerProvider { - private _delegate?; - /** - * Get a {@link ProxyTracer} - */ - getTracer(name: string, version?: string, options?: TracerOptions): Tracer; - getDelegate(): TracerProvider; - /** - * Set the delegate tracer provider - */ - setDelegate(delegate: TracerProvider): void; - getDelegateTracer(name: string, version?: string, options?: TracerOptions): Tracer | undefined; -} -//# sourceMappingURL=ProxyTracerProvider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js b/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js deleted file mode 100644 index 922f3b5..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ProxyTracerProvider = void 0; -const ProxyTracer_1 = require("./ProxyTracer"); -const NoopTracerProvider_1 = require("./NoopTracerProvider"); -const NOOP_TRACER_PROVIDER = new NoopTracerProvider_1.NoopTracerProvider(); -/** - * Tracer provider which provides {@link ProxyTracer}s. - * - * Before a delegate is set, tracers provided are NoOp. - * When a delegate is set, traces are provided from the delegate. - * When a delegate is set after tracers have already been provided, - * all tracers already provided will use the provided delegate implementation. - * - * @deprecated This will be removed in the next major version. - * @since 1.0.0 - */ -class ProxyTracerProvider { - /** - * Get a {@link ProxyTracer} - */ - getTracer(name, version, options) { - var _a; - return ((_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer_1.ProxyTracer(this, name, version, options)); - } - getDelegate() { - var _a; - return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER; - } - /** - * Set the delegate tracer provider - */ - setDelegate(delegate) { - this._delegate = delegate; - } - getDelegateTracer(name, version, options) { - var _a; - return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options); - } -} -exports.ProxyTracerProvider = ProxyTracerProvider; -//# sourceMappingURL=ProxyTracerProvider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js.map b/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js.map deleted file mode 100644 index 7df582a..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ProxyTracerProvider.js","sourceRoot":"","sources":["../../../src/trace/ProxyTracerProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,+CAA4C;AAC5C,6DAA0D;AAG1D,MAAM,oBAAoB,GAAG,IAAI,uCAAkB,EAAE,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,MAAa,mBAAmB;IAG9B;;OAEG;IACH,SAAS,CAAC,IAAY,EAAE,OAAgB,EAAE,OAAuB;;QAC/D,OAAO,CACL,MAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,mCAC9C,IAAI,yBAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAC9C,CAAC;IACJ,CAAC;IAED,WAAW;;QACT,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,oBAAoB,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAAwB;QAClC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,iBAAiB,CACf,IAAY,EACZ,OAAgB,EAChB,OAAuB;;QAEvB,OAAO,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AA/BD,kDA+BC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Tracer } from './tracer';\nimport type { TracerProvider } from './tracer_provider';\nimport { ProxyTracer } from './ProxyTracer';\nimport { NoopTracerProvider } from './NoopTracerProvider';\nimport type { TracerOptions } from './tracer_options';\n\nconst NOOP_TRACER_PROVIDER = new NoopTracerProvider();\n\n/**\n * Tracer provider which provides {@link ProxyTracer}s.\n *\n * Before a delegate is set, tracers provided are NoOp.\n * When a delegate is set, traces are provided from the delegate.\n * When a delegate is set after tracers have already been provided,\n * all tracers already provided will use the provided delegate implementation.\n *\n * @deprecated This will be removed in the next major version.\n * @since 1.0.0\n */\nexport class ProxyTracerProvider implements TracerProvider {\n private _delegate?: TracerProvider;\n\n /**\n * Get a {@link ProxyTracer}\n */\n getTracer(name: string, version?: string, options?: TracerOptions): Tracer {\n return (\n this.getDelegateTracer(name, version, options) ??\n new ProxyTracer(this, name, version, options)\n );\n }\n\n getDelegate(): TracerProvider {\n return this._delegate ?? NOOP_TRACER_PROVIDER;\n }\n\n /**\n * Set the delegate tracer provider\n */\n setDelegate(delegate: TracerProvider) {\n this._delegate = delegate;\n }\n\n getDelegateTracer(\n name: string,\n version?: string,\n options?: TracerOptions\n ): Tracer | undefined {\n return this._delegate?.getTracer(name, version, options);\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/Sampler.d.ts b/node_modules/@opentelemetry/api/build/src/trace/Sampler.d.ts deleted file mode 100644 index 341a792..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/Sampler.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { Context } from '../context/types'; -import type { SpanAttributes } from './attributes'; -import type { Link } from './link'; -import type { SamplingResult } from './SamplingResult'; -import type { SpanKind } from './span_kind'; -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * This interface represent a sampler. Sampling is a mechanism to control the - * noise and overhead introduced by OpenTelemetry by reducing the number of - * samples of traces collected and sent to the backend. - * - * @since 1.0.0 - */ -export interface Sampler { - /** - * Checks whether span needs to be created and tracked. - * - * @param context Parent Context which may contain a span. - * @param traceId of the span to be created. It can be different from the - * traceId in the {@link SpanContext}. Typically in situations when the - * span to be created starts a new trace. - * @param spanName of the span to be created. - * @param spanKind of the span to be created. - * @param attributes Initial set of SpanAttributes for the Span being constructed. - * @param links Collection of links that will be associated with the Span to - * be created. Typically useful for batch operations. - * @returns a {@link SamplingResult}. - */ - shouldSample(context: Context, traceId: string, spanName: string, spanKind: SpanKind, attributes: SpanAttributes, links: Link[]): SamplingResult; - /** Returns the sampler name or short description with the configuration. */ - toString(): string; -} -//# sourceMappingURL=Sampler.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/Sampler.js b/node_modules/@opentelemetry/api/build/src/trace/Sampler.js deleted file mode 100644 index 4405912..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/Sampler.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Sampler.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/Sampler.js.map b/node_modules/@opentelemetry/api/build/src/trace/Sampler.js.map deleted file mode 100644 index 1279c16..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/Sampler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Sampler.js","sourceRoot":"","sources":["../../../src/trace/Sampler.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport type { SpanAttributes } from './attributes';\nimport type { Link } from './link';\nimport type { SamplingResult } from './SamplingResult';\nimport type { SpanKind } from './span_kind';\n\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * This interface represent a sampler. Sampling is a mechanism to control the\n * noise and overhead introduced by OpenTelemetry by reducing the number of\n * samples of traces collected and sent to the backend.\n *\n * @since 1.0.0\n */\nexport interface Sampler {\n /**\n * Checks whether span needs to be created and tracked.\n *\n * @param context Parent Context which may contain a span.\n * @param traceId of the span to be created. It can be different from the\n * traceId in the {@link SpanContext}. Typically in situations when the\n * span to be created starts a new trace.\n * @param spanName of the span to be created.\n * @param spanKind of the span to be created.\n * @param attributes Initial set of SpanAttributes for the Span being constructed.\n * @param links Collection of links that will be associated with the Span to\n * be created. Typically useful for batch operations.\n * @returns a {@link SamplingResult}.\n */\n shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n spanKind: SpanKind,\n attributes: SpanAttributes,\n links: Link[]\n ): SamplingResult;\n\n /** Returns the sampler name or short description with the configuration. */\n toString(): string;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.d.ts b/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.d.ts deleted file mode 100644 index 3ef2299..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import type { SpanAttributes } from './attributes'; -import type { TraceState } from './trace_state'; -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * A sampling decision that determines how a {@link Span} will be recorded - * and collected. - * - * @since 1.0.0 - */ -export declare enum SamplingDecision { - /** - * `Span.isRecording() === false`, span will not be recorded and all events - * and attributes will be dropped. - */ - NOT_RECORD = 0, - /** - * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} - * MUST NOT be set. - */ - RECORD = 1, - /** - * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} - * MUST be set. - */ - RECORD_AND_SAMPLED = 2 -} -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * A sampling result contains a decision for a {@link Span} and additional - * attributes the sampler would like to added to the Span. - * - * @since 1.0.0 - */ -export interface SamplingResult { - /** - * A sampling decision, refer to {@link SamplingDecision} for details. - */ - decision: SamplingDecision; - /** - * The list of attributes returned by SamplingResult MUST be immutable. - * Caller may call {@link Sampler}.shouldSample any number of times and - * can safely cache the returned value. - */ - attributes?: Readonly; - /** - * A {@link TraceState} that will be associated with the {@link Span} through - * the new {@link SpanContext}. Samplers SHOULD return the TraceState from - * the passed-in {@link Context} if they do not intend to change it. Leaving - * the value undefined will also leave the TraceState unchanged. - */ - traceState?: TraceState; -} -//# sourceMappingURL=SamplingResult.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js b/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js deleted file mode 100644 index 7cac673..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SamplingDecision = void 0; -/** - * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead. - * A sampling decision that determines how a {@link Span} will be recorded - * and collected. - * - * @since 1.0.0 - */ -var SamplingDecision; -(function (SamplingDecision) { - /** - * `Span.isRecording() === false`, span will not be recorded and all events - * and attributes will be dropped. - */ - SamplingDecision[SamplingDecision["NOT_RECORD"] = 0] = "NOT_RECORD"; - /** - * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} - * MUST NOT be set. - */ - SamplingDecision[SamplingDecision["RECORD"] = 1] = "RECORD"; - /** - * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} - * MUST be set. - */ - SamplingDecision[SamplingDecision["RECORD_AND_SAMPLED"] = 2] = "RECORD_AND_SAMPLED"; -})(SamplingDecision = exports.SamplingDecision || (exports.SamplingDecision = {})); -//# sourceMappingURL=SamplingResult.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js.map b/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js.map deleted file mode 100644 index a580d2f..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SamplingResult.js","sourceRoot":"","sources":["../../../src/trace/SamplingResult.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;;;;;GAMG;AACH,IAAY,gBAgBX;AAhBD,WAAY,gBAAgB;IAC1B;;;OAGG;IACH,mEAAU,CAAA;IACV;;;OAGG;IACH,2DAAM,CAAA;IACN;;;OAGG;IACH,mFAAkB,CAAA;AACpB,CAAC,EAhBW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAgB3B","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SpanAttributes } from './attributes';\nimport type { TraceState } from './trace_state';\n\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * A sampling decision that determines how a {@link Span} will be recorded\n * and collected.\n *\n * @since 1.0.0\n */\nexport enum SamplingDecision {\n /**\n * `Span.isRecording() === false`, span will not be recorded and all events\n * and attributes will be dropped.\n */\n NOT_RECORD,\n /**\n * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}\n * MUST NOT be set.\n */\n RECORD,\n /**\n * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}\n * MUST be set.\n */\n RECORD_AND_SAMPLED,\n}\n\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * A sampling result contains a decision for a {@link Span} and additional\n * attributes the sampler would like to added to the Span.\n *\n * @since 1.0.0\n */\nexport interface SamplingResult {\n /**\n * A sampling decision, refer to {@link SamplingDecision} for details.\n */\n decision: SamplingDecision;\n /**\n * The list of attributes returned by SamplingResult MUST be immutable.\n * Caller may call {@link Sampler}.shouldSample any number of times and\n * can safely cache the returned value.\n */\n attributes?: Readonly;\n /**\n * A {@link TraceState} that will be associated with the {@link Span} through\n * the new {@link SpanContext}. Samplers SHOULD return the TraceState from\n * the passed-in {@link Context} if they do not intend to change it. Leaving\n * the value undefined will also leave the TraceState unchanged.\n */\n traceState?: TraceState;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/SpanOptions.d.ts b/node_modules/@opentelemetry/api/build/src/trace/SpanOptions.d.ts deleted file mode 100644 index 2021bd7..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/SpanOptions.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Attributes } from '../common/Attributes'; -import type { TimeInput } from '../common/Time'; -import type { Link } from './link'; -import type { SpanKind } from './span_kind'; -/** - * Options needed for span creation - * - * @since 1.0.0 - */ -export interface SpanOptions { - /** - * The SpanKind of a span - * @default {@link SpanKind.INTERNAL} - */ - kind?: SpanKind; - /** A span's attributes */ - attributes?: Attributes; - /** {@link Link}s span to other spans */ - links?: Link[]; - /** A manually specified start time for the created `Span` object. */ - startTime?: TimeInput; - /** The new span should be a root span. (Ignore parent from context). */ - root?: boolean; -} -//# sourceMappingURL=SpanOptions.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js b/node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js deleted file mode 100644 index f8c4653..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=SpanOptions.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js.map b/node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js.map deleted file mode 100644 index a577302..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SpanOptions.js","sourceRoot":"","sources":["../../../src/trace/SpanOptions.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes } from '../common/Attributes';\nimport type { TimeInput } from '../common/Time';\nimport type { Link } from './link';\nimport type { SpanKind } from './span_kind';\n\n/**\n * Options needed for span creation\n *\n * @since 1.0.0\n */\nexport interface SpanOptions {\n /**\n * The SpanKind of a span\n * @default {@link SpanKind.INTERNAL}\n */\n kind?: SpanKind;\n\n /** A span's attributes */\n attributes?: Attributes;\n\n /** {@link Link}s span to other spans */\n links?: Link[];\n\n /** A manually specified start time for the created `Span` object. */\n startTime?: TimeInput;\n\n /** The new span should be a root span. (Ignore parent from context). */\n root?: boolean;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/attributes.d.ts b/node_modules/@opentelemetry/api/build/src/trace/attributes.d.ts deleted file mode 100644 index db01605..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/attributes.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Attributes, AttributeValue } from '../common/Attributes'; -/** - * @deprecated please use {@link Attributes} - * @since 1.0.0 - */ -export type SpanAttributes = Attributes; -/** - * @deprecated please use {@link AttributeValue} - * @since 1.0.0 - */ -export type SpanAttributeValue = AttributeValue; -//# sourceMappingURL=attributes.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/attributes.js b/node_modules/@opentelemetry/api/build/src/trace/attributes.js deleted file mode 100644 index 00f25d9..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/attributes.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=attributes.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/attributes.js.map b/node_modules/@opentelemetry/api/build/src/trace/attributes.js.map deleted file mode 100644 index 37e3608..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/attributes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../src/trace/attributes.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes, AttributeValue } from '../common/Attributes';\n\n/**\n * @deprecated please use {@link Attributes}\n * @since 1.0.0\n */\nexport type SpanAttributes = Attributes;\n\n/**\n * @deprecated please use {@link AttributeValue}\n * @since 1.0.0\n */\nexport type SpanAttributeValue = AttributeValue;\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/context-utils.d.ts b/node_modules/@opentelemetry/api/build/src/trace/context-utils.d.ts deleted file mode 100644 index 783a4ca..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/context-utils.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanContext } from './span_context'; -/** - * Return the span if one exists - * - * @param context context to get span from - */ -export declare function getSpan(context: Context): Span | undefined; -/** - * Gets the span from the current context, if one exists. - */ -export declare function getActiveSpan(): Span | undefined; -/** - * Set the span on a context - * - * @param context context to use as parent - * @param span span to set active - */ -export declare function setSpan(context: Context, span: Span): Context; -/** - * Remove current span stored in the context - * - * @param context context to delete span from - */ -export declare function deleteSpan(context: Context): Context; -/** - * Wrap span context in a NoopSpan and set as span in a new - * context - * - * @param context context to set active span on - * @param spanContext span context to be wrapped - */ -export declare function setSpanContext(context: Context, spanContext: SpanContext): Context; -/** - * Get the span context of the span if it exists. - * - * @param context context to get values from - */ -export declare function getSpanContext(context: Context): SpanContext | undefined; -//# sourceMappingURL=context-utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/context-utils.js b/node_modules/@opentelemetry/api/build/src/trace/context-utils.js deleted file mode 100644 index 31e5f81..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/context-utils.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getSpanContext = exports.setSpanContext = exports.deleteSpan = exports.setSpan = exports.getActiveSpan = exports.getSpan = void 0; -const context_1 = require("../context/context"); -const NonRecordingSpan_1 = require("./NonRecordingSpan"); -const context_2 = require("../api/context"); -/** - * span key - */ -const SPAN_KEY = (0, context_1.createContextKey)('OpenTelemetry Context Key SPAN'); -/** - * Return the span if one exists - * - * @param context context to get span from - */ -function getSpan(context) { - return context.getValue(SPAN_KEY) || undefined; -} -exports.getSpan = getSpan; -/** - * Gets the span from the current context, if one exists. - */ -function getActiveSpan() { - return getSpan(context_2.ContextAPI.getInstance().active()); -} -exports.getActiveSpan = getActiveSpan; -/** - * Set the span on a context - * - * @param context context to use as parent - * @param span span to set active - */ -function setSpan(context, span) { - return context.setValue(SPAN_KEY, span); -} -exports.setSpan = setSpan; -/** - * Remove current span stored in the context - * - * @param context context to delete span from - */ -function deleteSpan(context) { - return context.deleteValue(SPAN_KEY); -} -exports.deleteSpan = deleteSpan; -/** - * Wrap span context in a NoopSpan and set as span in a new - * context - * - * @param context context to set active span on - * @param spanContext span context to be wrapped - */ -function setSpanContext(context, spanContext) { - return setSpan(context, new NonRecordingSpan_1.NonRecordingSpan(spanContext)); -} -exports.setSpanContext = setSpanContext; -/** - * Get the span context of the span if it exists. - * - * @param context context to get values from - */ -function getSpanContext(context) { - var _a; - return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext(); -} -exports.getSpanContext = getSpanContext; -//# sourceMappingURL=context-utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/context-utils.js.map b/node_modules/@opentelemetry/api/build/src/trace/context-utils.js.map deleted file mode 100644 index 5406f2a..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/context-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context-utils.js","sourceRoot":"","sources":["../../../src/trace/context-utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gDAAsD;AAItD,yDAAsD;AACtD,4CAA4C;AAE5C;;GAEG;AACH,MAAM,QAAQ,GAAG,IAAA,0BAAgB,EAAC,gCAAgC,CAAC,CAAC;AAEpE;;;;GAIG;AACH,SAAgB,OAAO,CAAC,OAAgB;IACtC,OAAQ,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU,IAAI,SAAS,CAAC;AAC3D,CAAC;AAFD,0BAEC;AAED;;GAEG;AACH,SAAgB,aAAa;IAC3B,OAAO,OAAO,CAAC,oBAAU,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AACpD,CAAC;AAFD,sCAEC;AAED;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,OAAgB,EAAE,IAAU;IAClD,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC1C,CAAC;AAFD,0BAEC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,OAAgB;IACzC,OAAO,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC;AAFD,gCAEC;AAED;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,OAAgB,EAChB,WAAwB;IAExB,OAAO,OAAO,CAAC,OAAO,EAAE,IAAI,mCAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;AAC7D,CAAC;AALD,wCAKC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAgB;;IAC7C,OAAO,MAAA,OAAO,CAAC,OAAO,CAAC,0CAAE,WAAW,EAAE,CAAC;AACzC,CAAC;AAFD,wCAEC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createContextKey } from '../context/context';\nimport type { Context } from '../context/types';\nimport type { Span } from './span';\nimport type { SpanContext } from './span_context';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport { ContextAPI } from '../api/context';\n\n/**\n * span key\n */\nconst SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');\n\n/**\n * Return the span if one exists\n *\n * @param context context to get span from\n */\nexport function getSpan(context: Context): Span | undefined {\n return (context.getValue(SPAN_KEY) as Span) || undefined;\n}\n\n/**\n * Gets the span from the current context, if one exists.\n */\nexport function getActiveSpan(): Span | undefined {\n return getSpan(ContextAPI.getInstance().active());\n}\n\n/**\n * Set the span on a context\n *\n * @param context context to use as parent\n * @param span span to set active\n */\nexport function setSpan(context: Context, span: Span): Context {\n return context.setValue(SPAN_KEY, span);\n}\n\n/**\n * Remove current span stored in the context\n *\n * @param context context to delete span from\n */\nexport function deleteSpan(context: Context): Context {\n return context.deleteValue(SPAN_KEY);\n}\n\n/**\n * Wrap span context in a NoopSpan and set as span in a new\n * context\n *\n * @param context context to set active span on\n * @param spanContext span context to be wrapped\n */\nexport function setSpanContext(\n context: Context,\n spanContext: SpanContext\n): Context {\n return setSpan(context, new NonRecordingSpan(spanContext));\n}\n\n/**\n * Get the span context of the span if it exists.\n *\n * @param context context to get values from\n */\nexport function getSpanContext(context: Context): SpanContext | undefined {\n return getSpan(context)?.spanContext();\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.d.ts b/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.d.ts deleted file mode 100644 index 47ecac8..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { TraceState } from '../trace_state'; -/** - * TraceState must be a class and not a simple object type because of the spec - * requirement (https://www.w3.org/TR/trace-context/#tracestate-field). - * - * Here is the list of allowed mutations: - * - New key-value pair should be added into the beginning of the list - * - The value of any key can be updated. Modified keys MUST be moved to the - * beginning of the list. - */ -export declare class TraceStateImpl implements TraceState { - private _internalState; - constructor(rawTraceState?: string); - set(key: string, value: string): TraceStateImpl; - unset(key: string): TraceStateImpl; - get(key: string): string | undefined; - serialize(): string; - private _parse; - private _keys; - private _clone; -} -//# sourceMappingURL=tracestate-impl.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.js b/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.js deleted file mode 100644 index 57816e1..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TraceStateImpl = void 0; -const tracestate_validators_1 = require("./tracestate-validators"); -const MAX_TRACE_STATE_ITEMS = 32; -const MAX_TRACE_STATE_LEN = 512; -const LIST_MEMBERS_SEPARATOR = ','; -const LIST_MEMBER_KEY_VALUE_SPLITTER = '='; -/** - * TraceState must be a class and not a simple object type because of the spec - * requirement (https://www.w3.org/TR/trace-context/#tracestate-field). - * - * Here is the list of allowed mutations: - * - New key-value pair should be added into the beginning of the list - * - The value of any key can be updated. Modified keys MUST be moved to the - * beginning of the list. - */ -class TraceStateImpl { - constructor(rawTraceState) { - this._internalState = new Map(); - if (rawTraceState) - this._parse(rawTraceState); - } - set(key, value) { - // TODO: Benchmark the different approaches(map vs list) and - // use the faster one. - const traceState = this._clone(); - if (traceState._internalState.has(key)) { - traceState._internalState.delete(key); - } - traceState._internalState.set(key, value); - return traceState; - } - unset(key) { - const traceState = this._clone(); - traceState._internalState.delete(key); - return traceState; - } - get(key) { - return this._internalState.get(key); - } - serialize() { - return (Array.from(this._internalState.keys()) - // Use reduceRight() because keys are stored in reverse insertion order. - .reduceRight((agg, key) => { - agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key)); - return agg; - }, []) - .join(LIST_MEMBERS_SEPARATOR)); - } - _parse(rawTraceState) { - if (rawTraceState.length > MAX_TRACE_STATE_LEN) - return; - this._internalState = rawTraceState - .split(LIST_MEMBERS_SEPARATOR) - // Use reduceRight() so new keys (.set(...)) will be placed at the beginning - .reduceRight((agg, part) => { - const listMember = part.trim(); // Optional Whitespace (OWS) handling - const i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER); - if (i !== -1) { - const key = listMember.slice(0, i); - const value = listMember.slice(i + 1, part.length); - if ((0, tracestate_validators_1.validateKey)(key) && (0, tracestate_validators_1.validateValue)(value)) { - agg.set(key, value); - } - else { - // TODO: Consider to add warning log - } - } - return agg; - }, new Map()); - // Because of the reverse() requirement, trunc must be done after map is created - if (this._internalState.size > MAX_TRACE_STATE_ITEMS) { - this._internalState = new Map(Array.from(this._internalState.entries()) - .reverse() // Use reverse same as original tracestate parse chain - .slice(0, MAX_TRACE_STATE_ITEMS)); - } - } - // @ts-expect-error TS6133 Accessed in tests only. - _keys() { - return Array.from(this._internalState.keys()).reverse(); - } - _clone() { - const traceState = new TraceStateImpl(); - traceState._internalState = new Map(this._internalState); - return traceState; - } -} -exports.TraceStateImpl = TraceStateImpl; -//# sourceMappingURL=tracestate-impl.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.js.map b/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.js.map deleted file mode 100644 index 5153236..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracestate-impl.js","sourceRoot":"","sources":["../../../../src/trace/internal/tracestate-impl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,mEAAqE;AAErE,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAa,cAAc;IAGzB,YAAY,aAAsB;QAF1B,mBAAc,GAAwB,IAAI,GAAG,EAAE,CAAC;QAGtD,IAAI,aAAa;YAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAChD,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,KAAa;QAC5B,4DA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yright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TraceState } from '../trace_state';\nimport { validateKey, validateValue } from './tracestate-validators';\n\nconst MAX_TRACE_STATE_ITEMS = 32;\nconst MAX_TRACE_STATE_LEN = 512;\nconst LIST_MEMBERS_SEPARATOR = ',';\nconst LIST_MEMBER_KEY_VALUE_SPLITTER = '=';\n\n/**\n * TraceState must be a class and not a simple object type because of the spec\n * requirement (https://www.w3.org/TR/trace-context/#tracestate-field).\n *\n * Here is the list of allowed mutations:\n * - New key-value pair should be added into the beginning of the list\n * - The value of any key can be updated. Modified keys MUST be moved to the\n * beginning of the list.\n */\nexport class TraceStateImpl implements TraceState {\n private _internalState: Map = new Map();\n\n constructor(rawTraceState?: string) {\n if (rawTraceState) this._parse(rawTraceState);\n }\n\n set(key: string, value: string): TraceStateImpl {\n // TODO: Benchmark the different approaches(map vs list) and\n // use the faster one.\n const traceState = this._clone();\n if (traceState._internalState.has(key)) {\n traceState._internalState.delete(key);\n }\n traceState._internalState.set(key, value);\n return traceState;\n }\n\n unset(key: string): TraceStateImpl {\n const traceState = this._clone();\n traceState._internalState.delete(key);\n return traceState;\n }\n\n get(key: string): string | undefined {\n return this._internalState.get(key);\n }\n\n serialize(): string {\n return (\n Array.from(this._internalState.keys())\n // Use reduceRight() because keys are stored in reverse insertion order.\n .reduceRight((agg: string[], key) => {\n agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key));\n return agg;\n }, [])\n .join(LIST_MEMBERS_SEPARATOR)\n );\n }\n\n private _parse(rawTraceState: string) {\n if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;\n this._internalState = rawTraceState\n .split(LIST_MEMBERS_SEPARATOR)\n // Use reduceRight() so new keys (.set(...)) will be placed at the beginning\n .reduceRight((agg: Map, part: string) => {\n const listMember = part.trim(); // Optional Whitespace (OWS) handling\n const i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);\n if (i !== -1) {\n const key = listMember.slice(0, i);\n const value = listMember.slice(i + 1, part.length);\n if (validateKey(key) && validateValue(value)) {\n agg.set(key, value);\n } else {\n // TODO: Consider to add warning log\n }\n }\n return agg;\n }, new Map());\n\n // Because of the reverse() requirement, trunc must be done after map is created\n if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {\n this._internalState = new Map(\n Array.from(this._internalState.entries())\n .reverse() // Use reverse same as original tracestate parse chain\n .slice(0, MAX_TRACE_STATE_ITEMS)\n );\n }\n }\n\n // @ts-expect-error TS6133 Accessed in tests only.\n private _keys(): string[] {\n return Array.from(this._internalState.keys()).reverse();\n }\n\n private _clone(): TraceStateImpl {\n const traceState = new TraceStateImpl();\n traceState._internalState = new Map(this._internalState);\n return traceState;\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.d.ts b/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.d.ts deleted file mode 100644 index 4917f99..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Key is opaque string up to 256 characters printable. It MUST begin with a - * lowercase letter, and can only contain lowercase letters a-z, digits 0-9, - * underscores _, dashes -, asterisks *, and forward slashes /. - * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the - * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key. - * see https://www.w3.org/TR/trace-context/#key - */ -export declare function validateKey(key: string): boolean; -/** - * Value is opaque string up to 256 characters printable ASCII RFC0020 - * characters (i.e., the range 0x20 to 0x7E) except comma , and =. - */ -export declare function validateValue(value: string): boolean; -//# sourceMappingURL=tracestate-validators.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.js b/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.js deleted file mode 100644 index 6ba0cc6..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validateValue = exports.validateKey = void 0; -const VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]'; -const VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`; -const VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`; -const VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`); -const VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/; -const INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/; -/** - * Key is opaque string up to 256 characters printable. It MUST begin with a - * lowercase letter, and can only contain lowercase letters a-z, digits 0-9, - * underscores _, dashes -, asterisks *, and forward slashes /. - * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the - * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key. - * see https://www.w3.org/TR/trace-context/#key - */ -function validateKey(key) { - return VALID_KEY_REGEX.test(key); -} -exports.validateKey = validateKey; -/** - * Value is opaque string up to 256 characters printable ASCII RFC0020 - * characters (i.e., the range 0x20 to 0x7E) except comma , and =. - */ -function validateValue(value) { - return (VALID_VALUE_BASE_REGEX.test(value) && - !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value)); -} -exports.validateValue = validateValue; -//# sourceMappingURL=tracestate-validators.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.js.map b/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.js.map deleted file mode 100644 index 4dfe083..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracestate-validators.js","sourceRoot":"","sources":["../../../../src/trace/internal/tracestate-validators.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAC5C,MAAM,SAAS,GAAG,QAAQ,oBAAoB,SAAS,CAAC;AACxD,MAAM,gBAAgB,GAAG,WAAW,oBAAoB,gBAAgB,oBAAoB,QAAQ,CAAC;AACrG,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC,OAAO,SAAS,IAAI,gBAAgB,IAAI,CAAC,CAAC;AAC7E,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AACrD,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAE9C;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,KAAa;IACzC,OAAO,CACL,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC;QAClC,CAAC,+BAA+B,CAAC,IAAI,CAAC,KAAK,CAAC,CAC7C,CAAC;AACJ,CAAC;AALD,sCAKC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nconst VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';\nconst VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;\nconst VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;\nconst VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`);\nconst VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;\nconst INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;\n\n/**\n * Key is opaque string up to 256 characters printable. It MUST begin with a\n * lowercase letter, and can only contain lowercase letters a-z, digits 0-9,\n * underscores _, dashes -, asterisks *, and forward slashes /.\n * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the\n * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.\n * see https://www.w3.org/TR/trace-context/#key\n */\nexport function validateKey(key: string): boolean {\n return VALID_KEY_REGEX.test(key);\n}\n\n/**\n * Value is opaque string up to 256 characters printable ASCII RFC0020\n * characters (i.e., the range 0x20 to 0x7E) except comma , and =.\n */\nexport function validateValue(value: string): boolean {\n return (\n VALID_VALUE_BASE_REGEX.test(value) &&\n !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value)\n );\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/internal/utils.d.ts b/node_modules/@opentelemetry/api/build/src/trace/internal/utils.d.ts deleted file mode 100644 index 7112fe5..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/internal/utils.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { TraceState } from '../trace_state'; -/** - * @since 1.1.0 - */ -export declare function createTraceState(rawTraceState?: string): TraceState; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/internal/utils.js b/node_modules/@opentelemetry/api/build/src/trace/internal/utils.js deleted file mode 100644 index 8fd319c..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/internal/utils.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createTraceState = void 0; -const tracestate_impl_1 = require("./tracestate-impl"); -/** - * @since 1.1.0 - */ -function createTraceState(rawTraceState) { - return new tracestate_impl_1.TraceStateImpl(rawTraceState); -} -exports.createTraceState = createTraceState; -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/internal/utils.js.map b/node_modules/@opentelemetry/api/build/src/trace/internal/utils.js.map deleted file mode 100644 index c362dd4..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/internal/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/trace/internal/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uDAAmD;AAEnD;;GAEG;AACH,SAAgB,gBAAgB,CAAC,aAAsB;IACrD,OAAO,IAAI,gCAAc,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC;AAFD,4CAEC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TraceState } from '../trace_state';\nimport { TraceStateImpl } from './tracestate-impl';\n\n/**\n * @since 1.1.0\n */\nexport function createTraceState(rawTraceState?: string): TraceState {\n return new TraceStateImpl(rawTraceState);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.d.ts b/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.d.ts deleted file mode 100644 index d51c859..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { SpanContext } from './span_context'; -/** - * @since 1.0.0 - */ -export declare const INVALID_SPANID = "0000000000000000"; -/** - * @since 1.0.0 - */ -export declare const INVALID_TRACEID = "00000000000000000000000000000000"; -/** - * @since 1.0.0 - */ -export declare const INVALID_SPAN_CONTEXT: SpanContext; -//# sourceMappingURL=invalid-span-constants.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.js b/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.js deleted file mode 100644 index ea3f87a..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = void 0; -const trace_flags_1 = require("./trace_flags"); -/** - * @since 1.0.0 - */ -exports.INVALID_SPANID = '0000000000000000'; -/** - * @since 1.0.0 - */ -exports.INVALID_TRACEID = '00000000000000000000000000000000'; -/** - * @since 1.0.0 - */ -exports.INVALID_SPAN_CONTEXT = { - traceId: exports.INVALID_TRACEID, - spanId: exports.INVALID_SPANID, - traceFlags: trace_flags_1.TraceFlags.NONE, -}; -//# sourceMappingURL=invalid-span-constants.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.js.map b/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.js.map deleted file mode 100644 index 39f9f95..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"invalid-span-constants.js","sourceRoot":"","sources":["../../../src/trace/invalid-span-constants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+CAA2C;AAE3C;;GAEG;AACU,QAAA,cAAc,GAAG,kBAAkB,CAAC;AAEjD;;GAEG;AACU,QAAA,eAAe,GAAG,kCAAkC,CAAC;AAElE;;GAEG;AACU,QAAA,oBAAoB,GAAgB;IAC/C,OAAO,EAAE,uBAAe;IACxB,MAAM,EAAE,sBAAc;IACtB,UAAU,EAAE,wBAAU,CAAC,IAAI;CAC5B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SpanContext } from './span_context';\nimport { TraceFlags } from './trace_flags';\n\n/**\n * @since 1.0.0\n */\nexport const INVALID_SPANID = '0000000000000000';\n\n/**\n * @since 1.0.0\n */\nexport const INVALID_TRACEID = '00000000000000000000000000000000';\n\n/**\n * @since 1.0.0\n */\nexport const INVALID_SPAN_CONTEXT: SpanContext = {\n traceId: INVALID_TRACEID,\n spanId: INVALID_SPANID,\n traceFlags: TraceFlags.NONE,\n};\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/link.d.ts b/node_modules/@opentelemetry/api/build/src/trace/link.d.ts deleted file mode 100644 index 6147717..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/link.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { SpanAttributes } from './attributes'; -import type { SpanContext } from './span_context'; -/** - * A pointer from the current {@link Span} to another span in the same trace or - * in a different trace. - * Few examples of Link usage. - * 1. Batch Processing: A batch of elements may contain elements associated - * with one or more traces/spans. Since there can only be one parent - * SpanContext, Link is used to keep reference to SpanContext of all - * elements in the batch. - * 2. Public Endpoint: A SpanContext in incoming client request on a public - * endpoint is untrusted from service provider perspective. In such case it - * is advisable to start a new trace with appropriate sampling decision. - * However, it is desirable to associate incoming SpanContext to new trace - * initiated on service provider side so two traces (from Client and from - * Service Provider) can be correlated. - * - * @since 1.0.0 - */ -export interface Link { - /** The {@link SpanContext} of a linked span. */ - context: SpanContext; - /** A set of {@link SpanAttributes} on the link. */ - attributes?: SpanAttributes; - /** Count of attributes of the link that were dropped due to collection limits */ - droppedAttributesCount?: number; -} -//# sourceMappingURL=link.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/link.js b/node_modules/@opentelemetry/api/build/src/trace/link.js deleted file mode 100644 index 942caea..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/link.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=link.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/link.js.map b/node_modules/@opentelemetry/api/build/src/trace/link.js.map deleted file mode 100644 index cd17191..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/link.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/trace/link.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { SpanAttributes } from './attributes';\nimport type { SpanContext } from './span_context';\n\n/**\n * A pointer from the current {@link Span} to another span in the same trace or\n * in a different trace.\n * Few examples of Link usage.\n * 1. Batch Processing: A batch of elements may contain elements associated\n * with one or more traces/spans. Since there can only be one parent\n * SpanContext, Link is used to keep reference to SpanContext of all\n * elements in the batch.\n * 2. Public Endpoint: A SpanContext in incoming client request on a public\n * endpoint is untrusted from service provider perspective. In such case it\n * is advisable to start a new trace with appropriate sampling decision.\n * However, it is desirable to associate incoming SpanContext to new trace\n * initiated on service provider side so two traces (from Client and from\n * Service Provider) can be correlated.\n *\n * @since 1.0.0\n */\nexport interface Link {\n /** The {@link SpanContext} of a linked span. */\n context: SpanContext;\n /** A set of {@link SpanAttributes} on the link. */\n attributes?: SpanAttributes;\n /** Count of attributes of the link that were dropped due to collection limits */\n droppedAttributesCount?: number;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/span.d.ts b/node_modules/@opentelemetry/api/build/src/trace/span.d.ts deleted file mode 100644 index f6517ca..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/span.d.ts +++ /dev/null @@ -1,132 +0,0 @@ -import type { Exception } from '../common/Exception'; -import type { TimeInput } from '../common/Time'; -import type { SpanAttributes, SpanAttributeValue } from './attributes'; -import type { SpanContext } from './span_context'; -import type { SpanStatus } from './status'; -import type { Link } from './link'; -/** - * An interface that represents a span. A span represents a single operation - * within a trace. Examples of span might include remote procedure calls or a - * in-process function calls to sub-components. A Trace has a single, top-level - * "root" Span that in turn may have zero or more child Spans, which in turn - * may have children. - * - * Spans are created by the {@link Tracer.startSpan} method. - * - * @since 1.0.0 - */ -export interface Span { - /** - * Returns the {@link SpanContext} object associated with this Span. - * - * Get an immutable, serializable identifier for this span that can be used - * to create new child spans. Returned SpanContext is usable even after the - * span ends. - * - * @returns the SpanContext object associated with this Span. - */ - spanContext(): SpanContext; - /** - * Sets an attribute to the span. - * - * Sets a single Attribute with the key and value passed as arguments. - * - * @param key the key for this attribute. - * @param value the value for this attribute. Setting a value null or - * undefined is invalid and will result in undefined behavior. - */ - setAttribute(key: string, value: SpanAttributeValue): this; - /** - * Sets attributes to the span. - * - * @param attributes the attributes that will be added. - * null or undefined attribute values - * are invalid and will result in undefined behavior. - */ - setAttributes(attributes: SpanAttributes): this; - /** - * Adds an event to the Span. - * - * @param name the name of the event. - * @param [attributesOrStartTime] the attributes that will be added; these are - * associated with this event. Can be also a start time - * if type is {@type TimeInput} and 3rd param is undefined - * @param [startTime] start time of the event. - */ - addEvent(name: string, attributesOrStartTime?: SpanAttributes | TimeInput, startTime?: TimeInput): this; - /** - * Adds a single link to the span. - * - * Links added after the creation will not affect the sampling decision. - * It is preferred span links be added at span creation. - * - * @param link the link to add. - */ - addLink(link: Link): this; - /** - * Adds multiple links to the span. - * - * Links added after the creation will not affect the sampling decision. - * It is preferred span links be added at span creation. - * - * @param links the links to add. - */ - addLinks(links: Link[]): this; - /** - * Sets the status of the span. - * - * By default, a span has status {@link SpanStatusCode.UNSET}. - * Calling this method overrides that default. - * - * The status codes have a total order: `OK > ERROR > UNSET`. - * - * - Once {@link SpanStatusCode.OK} is set, any further attempts to change - * the status are ignored. - * - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored. - * - * The `message` field is only used when {@link SpanStatusCode.ERROR} is set. - * For all other status codes, `message` is ignored. - * - * @param status The {@link SpanStatus} to set. - */ - setStatus(status: SpanStatus): this; - /** - * Updates the Span name. - * - * This will override the name provided via {@link Tracer.startSpan}. - * - * Upon this update, any sampling behavior based on Span name will depend on - * the implementation. - * - * @param name the Span name. - */ - updateName(name: string): this; - /** - * Marks the end of Span execution. - * - * Call to End of a Span MUST not have any effects on child spans. Those may - * still be running and can be ended later. - * - * Do not return `this`. The Span generally should not be used after it - * is ended so chaining is not desired in this context. - * - * @param [endTime] the time to set as Span's end time. If not provided, - * use the current time as the span's end time. - */ - end(endTime?: TimeInput): void; - /** - * Returns the flag whether this span will be recorded. - * - * @returns true if this Span is active and recording information like events - * with the `AddEvent` operation and attributes using `setAttributes`. - */ - isRecording(): boolean; - /** - * Sets exception as a span event - * @param exception the exception the only accepted values are string or Error - * @param [time] the time to set as Span's event time. If not provided, - * use the current time. - */ - recordException(exception: Exception, time?: TimeInput): void; -} -//# sourceMappingURL=span.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/span.js b/node_modules/@opentelemetry/api/build/src/trace/span.js deleted file mode 100644 index 49e1301..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/span.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=span.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/span.js.map b/node_modules/@opentelemetry/api/build/src/trace/span.js.map deleted file mode 100644 index e33ab90..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/span.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"span.js","sourceRoot":"","sources":["../../../src/trace/span.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Exception } from '../common/Exception';\nimport type { TimeInput } from '../common/Time';\nimport type { SpanAttributes, SpanAttributeValue } from './attributes';\nimport type { SpanContext } from './span_context';\nimport type { SpanStatus } from './status';\nimport type { Link } from './link';\n\n/**\n * An interface that represents a span. A span represents a single operation\n * within a trace. Examples of span might include remote procedure calls or a\n * in-process function calls to sub-components. A Trace has a single, top-level\n * \"root\" Span that in turn may have zero or more child Spans, which in turn\n * may have children.\n *\n * Spans are created by the {@link Tracer.startSpan} method.\n *\n * @since 1.0.0\n */\nexport interface Span {\n /**\n * Returns the {@link SpanContext} object associated with this Span.\n *\n * Get an immutable, serializable identifier for this span that can be used\n * to create new child spans. Returned SpanContext is usable even after the\n * span ends.\n *\n * @returns the SpanContext object associated with this Span.\n */\n spanContext(): SpanContext;\n\n /**\n * Sets an attribute to the span.\n *\n * Sets a single Attribute with the key and value passed as arguments.\n *\n * @param key the key for this attribute.\n * @param value the value for this attribute. Setting a value null or\n * undefined is invalid and will result in undefined behavior.\n */\n setAttribute(key: string, value: SpanAttributeValue): this;\n\n /**\n * Sets attributes to the span.\n *\n * @param attributes the attributes that will be added.\n * null or undefined attribute values\n * are invalid and will result in undefined behavior.\n */\n setAttributes(attributes: SpanAttributes): this;\n\n /**\n * Adds an event to the Span.\n *\n * @param name the name of the event.\n * @param [attributesOrStartTime] the attributes that will be added; these are\n * associated with this event. Can be also a start time\n * if type is {@type TimeInput} and 3rd param is undefined\n * @param [startTime] start time of the event.\n */\n addEvent(\n name: string,\n attributesOrStartTime?: SpanAttributes | TimeInput,\n startTime?: TimeInput\n ): this;\n\n /**\n * Adds a single link to the span.\n *\n * Links added after the creation will not affect the sampling decision.\n * It is preferred span links be added at span creation.\n *\n * @param link the link to add.\n */\n addLink(link: Link): this;\n\n /**\n * Adds multiple links to the span.\n *\n * Links added after the creation will not affect the sampling decision.\n * It is preferred span links be added at span creation.\n *\n * @param links the links to add.\n */\n addLinks(links: Link[]): this;\n\n /**\n * Sets the status of the span.\n *\n * By default, a span has status {@link SpanStatusCode.UNSET}.\n * Calling this method overrides that default.\n *\n * The status codes have a total order: `OK > ERROR > UNSET`.\n *\n * - Once {@link SpanStatusCode.OK} is set, any further attempts to change\n * the status are ignored.\n * - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored.\n *\n * The `message` field is only used when {@link SpanStatusCode.ERROR} is set.\n * For all other status codes, `message` is ignored.\n *\n * @param status The {@link SpanStatus} to set.\n */\n setStatus(status: SpanStatus): this;\n\n /**\n * Updates the Span name.\n *\n * This will override the name provided via {@link Tracer.startSpan}.\n *\n * Upon this update, any sampling behavior based on Span name will depend on\n * the implementation.\n *\n * @param name the Span name.\n */\n updateName(name: string): this;\n\n /**\n * Marks the end of Span execution.\n *\n * Call to End of a Span MUST not have any effects on child spans. Those may\n * still be running and can be ended later.\n *\n * Do not return `this`. The Span generally should not be used after it\n * is ended so chaining is not desired in this context.\n *\n * @param [endTime] the time to set as Span's end time. If not provided,\n * use the current time as the span's end time.\n */\n end(endTime?: TimeInput): void;\n\n /**\n * Returns the flag whether this span will be recorded.\n *\n * @returns true if this Span is active and recording information like events\n * with the `AddEvent` operation and attributes using `setAttributes`.\n */\n isRecording(): boolean;\n\n /**\n * Sets exception as a span event\n * @param exception the exception the only accepted values are string or Error\n * @param [time] the time to set as Span's event time. If not provided,\n * use the current time.\n */\n recordException(exception: Exception, time?: TimeInput): void;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/span_context.d.ts b/node_modules/@opentelemetry/api/build/src/trace/span_context.d.ts deleted file mode 100644 index 443436d..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/span_context.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { TraceState } from './trace_state'; -/** - * A SpanContext represents the portion of a {@link Span} which must be - * serialized and propagated along side of a {@link Baggage}. - * - * @since 1.0.0 - */ -export interface SpanContext { - /** - * The ID of the trace that this span belongs to. It is worldwide unique - * with practically sufficient probability by being made as 16 randomly - * generated bytes, encoded as a 32 lowercase hex characters corresponding to - * 128 bits. - */ - traceId: string; - /** - * The ID of the Span. It is globally unique with practically sufficient - * probability by being made as 8 randomly generated bytes, encoded as a 16 - * lowercase hex characters corresponding to 64 bits. - */ - spanId: string; - /** - * Only true if the SpanContext was propagated from a remote parent. - */ - isRemote?: boolean; - /** - * Trace flags to propagate. - * - * It is represented as 1 byte (bitmap). Bit to represent whether trace is - * sampled or not. When set, the least significant bit documents that the - * caller may have recorded trace data. A caller who does not record trace - * data out-of-band leaves this flag unset. - * - * see {@link TraceFlags} for valid flag values. - */ - traceFlags: number; - /** - * Tracing-system-specific info to propagate. - * - * The tracestate field value is a `list` as defined below. The `list` is a - * series of `list-members` separated by commas `,`, and a list-member is a - * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs - * surrounding `list-members` are ignored. There can be a maximum of 32 - * `list-members` in a `list`. - * More Info: https://www.w3.org/TR/trace-context/#tracestate-field - * - * Examples: - * Single tracing system (generic format): - * tracestate: rojo=00f067aa0ba902b7 - * Multiple tracing systems (with different formatting): - * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE - */ - traceState?: TraceState; -} -//# sourceMappingURL=span_context.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/span_context.js b/node_modules/@opentelemetry/api/build/src/trace/span_context.js deleted file mode 100644 index 8e32814..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/span_context.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=span_context.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/span_context.js.map b/node_modules/@opentelemetry/api/build/src/trace/span_context.js.map deleted file mode 100644 index 605d799..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/span_context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"span_context.js","sourceRoot":"","sources":["../../../src/trace/span_context.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TraceState } from './trace_state';\n\n/**\n * A SpanContext represents the portion of a {@link Span} which must be\n * serialized and propagated along side of a {@link Baggage}.\n *\n * @since 1.0.0\n */\nexport interface SpanContext {\n /**\n * The ID of the trace that this span belongs to. It is worldwide unique\n * with practically sufficient probability by being made as 16 randomly\n * generated bytes, encoded as a 32 lowercase hex characters corresponding to\n * 128 bits.\n */\n traceId: string;\n /**\n * The ID of the Span. It is globally unique with practically sufficient\n * probability by being made as 8 randomly generated bytes, encoded as a 16\n * lowercase hex characters corresponding to 64 bits.\n */\n spanId: string;\n /**\n * Only true if the SpanContext was propagated from a remote parent.\n */\n isRemote?: boolean;\n /**\n * Trace flags to propagate.\n *\n * It is represented as 1 byte (bitmap). Bit to represent whether trace is\n * sampled or not. When set, the least significant bit documents that the\n * caller may have recorded trace data. A caller who does not record trace\n * data out-of-band leaves this flag unset.\n *\n * see {@link TraceFlags} for valid flag values.\n */\n traceFlags: number;\n /**\n * Tracing-system-specific info to propagate.\n *\n * The tracestate field value is a `list` as defined below. The `list` is a\n * series of `list-members` separated by commas `,`, and a list-member is a\n * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs\n * surrounding `list-members` are ignored. There can be a maximum of 32\n * `list-members` in a `list`.\n * More Info: https://www.w3.org/TR/trace-context/#tracestate-field\n *\n * Examples:\n * Single tracing system (generic format):\n * tracestate: rojo=00f067aa0ba902b7\n * Multiple tracing systems (with different formatting):\n * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE\n */\n traceState?: TraceState;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/span_kind.d.ts b/node_modules/@opentelemetry/api/build/src/trace/span_kind.d.ts deleted file mode 100644 index 03c9d0f..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/span_kind.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @since 1.0.0 - */ -export declare enum SpanKind { - /** Default value. Indicates that the span is used internally. */ - INTERNAL = 0, - /** - * Indicates that the span covers server-side handling of an RPC or other - * remote request. - */ - SERVER = 1, - /** - * Indicates that the span covers the client-side wrapper around an RPC or - * other remote request. - */ - CLIENT = 2, - /** - * Indicates that the span describes producer sending a message to a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - PRODUCER = 3, - /** - * Indicates that the span describes consumer receiving a message from a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - CONSUMER = 4 -} -//# sourceMappingURL=span_kind.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/span_kind.js b/node_modules/@opentelemetry/api/build/src/trace/span_kind.js deleted file mode 100644 index 35a71c7..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/span_kind.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SpanKind = void 0; -/** - * @since 1.0.0 - */ -var SpanKind; -(function (SpanKind) { - /** Default value. Indicates that the span is used internally. */ - SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL"; - /** - * Indicates that the span covers server-side handling of an RPC or other - * remote request. - */ - SpanKind[SpanKind["SERVER"] = 1] = "SERVER"; - /** - * Indicates that the span covers the client-side wrapper around an RPC or - * other remote request. - */ - SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT"; - /** - * Indicates that the span describes producer sending a message to a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER"; - /** - * Indicates that the span describes consumer receiving a message from a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER"; -})(SpanKind = exports.SpanKind || (exports.SpanKind = {})); -//# sourceMappingURL=span_kind.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/span_kind.js.map b/node_modules/@opentelemetry/api/build/src/trace/span_kind.js.map deleted file mode 100644 index db4dc77..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/span_kind.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"span_kind.js","sourceRoot":"","sources":["../../../src/trace/span_kind.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,IAAY,QA6BX;AA7BD,WAAY,QAAQ;IAClB,iEAAiE;IACjE,+CAAY,CAAA;IAEZ;;;OAGG;IACH,2CAAU,CAAA;IAEV;;;OAGG;IACH,2CAAU,CAAA;IAEV;;;;OAIG;IACH,+CAAY,CAAA;IAEZ;;;;OAIG;IACH,+CAAY,CAAA;AACd,CAAC,EA7BW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA6BnB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport enum SpanKind {\n /** Default value. Indicates that the span is used internally. */\n INTERNAL = 0,\n\n /**\n * Indicates that the span covers server-side handling of an RPC or other\n * remote request.\n */\n SERVER = 1,\n\n /**\n * Indicates that the span covers the client-side wrapper around an RPC or\n * other remote request.\n */\n CLIENT = 2,\n\n /**\n * Indicates that the span describes producer sending a message to a\n * broker. Unlike client and server, there is no direct critical path latency\n * relationship between producer and consumer spans.\n */\n PRODUCER = 3,\n\n /**\n * Indicates that the span describes consumer receiving a message from a\n * broker. Unlike client and server, there is no direct critical path latency\n * relationship between producer and consumer spans.\n */\n CONSUMER = 4,\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.d.ts b/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.d.ts deleted file mode 100644 index 637ef2b..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Span } from './span'; -import type { SpanContext } from './span_context'; -/** - * @since 1.0.0 - */ -export declare function isValidTraceId(traceId: string): boolean; -/** - * @since 1.0.0 - */ -export declare function isValidSpanId(spanId: string): boolean; -/** - * Returns true if this {@link SpanContext} is valid. - * @return true if this {@link SpanContext} is valid. - * - * @since 1.0.0 - */ -export declare function isSpanContextValid(spanContext: SpanContext): boolean; -/** - * Wrap the given {@link SpanContext} in a new non-recording {@link Span} - * - * @param spanContext span context to be wrapped - * @returns a new non-recording {@link Span} with the provided context - */ -export declare function wrapSpanContext(spanContext: SpanContext): Span; -//# sourceMappingURL=spancontext-utils.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.js b/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.js deleted file mode 100644 index 7a8a072..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.wrapSpanContext = exports.isSpanContextValid = exports.isValidSpanId = exports.isValidTraceId = void 0; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -const invalid_span_constants_1 = require("./invalid-span-constants"); -const NonRecordingSpan_1 = require("./NonRecordingSpan"); -// Valid characters (0-9, a-f, A-F) are marked as 1. -const isHex = new Uint8Array([ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, -]); -function isValidHex(id, length) { - // As of 1.9.0 the id was allowed to be a non-string value, - // even though it was not possible in the types. - if (typeof id !== 'string' || id.length !== length) - return false; - let r = 0; - for (let i = 0; i < id.length; i += 4) { - r += - (isHex[id.charCodeAt(i)] | 0) + - (isHex[id.charCodeAt(i + 1)] | 0) + - (isHex[id.charCodeAt(i + 2)] | 0) + - (isHex[id.charCodeAt(i + 3)] | 0); - } - return r === length; -} -/** - * @since 1.0.0 - */ -function isValidTraceId(traceId) { - return isValidHex(traceId, 32) && traceId !== invalid_span_constants_1.INVALID_TRACEID; -} -exports.isValidTraceId = isValidTraceId; -/** - * @since 1.0.0 - */ -function isValidSpanId(spanId) { - return isValidHex(spanId, 16) && spanId !== invalid_span_constants_1.INVALID_SPANID; -} -exports.isValidSpanId = isValidSpanId; -/** - * Returns true if this {@link SpanContext} is valid. - * @return true if this {@link SpanContext} is valid. - * - * @since 1.0.0 - */ -function isSpanContextValid(spanContext) { - return (isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId)); -} -exports.isSpanContextValid = isSpanContextValid; -/** - * Wrap the given {@link SpanContext} in a new non-recording {@link Span} - * - * @param spanContext span context to be wrapped - * @returns a new non-recording {@link Span} with the provided context - */ -function wrapSpanContext(spanContext) { - return new NonRecordingSpan_1.NonRecordingSpan(spanContext); -} -exports.wrapSpanContext = wrapSpanContext; -//# sourceMappingURL=spancontext-utils.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.js.map b/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.js.map deleted file mode 100644 index e860622..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"spancontext-utils.js","sourceRoot":"","sources":["../../../src/trace/spancontext-utils.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,qEAA2E;AAC3E,yDAAsD;AAItD,oDAAoD;AACpD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC;IAC3B,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EA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EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACrC,CAAC;YACC,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBAC7B,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBACjC,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBACjC,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;KACrC;IAED,OAAO,CAAC,KAAK,MAAM,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,OAAe;IAC5C,OAAO,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,OAAO,KAAK,wCAAe,CAAC;AAChE,CAAC;AAFD,wCAEC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,MAAc;IAC1C,OAAO,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,KAAK,uCAAc,CAAC;AAC7D,CAAC;AAFD,sCAEC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,WAAwB;IACzD,OAAO,CACL,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CACzE,CAAC;AACJ,CAAC;AAJD,gDAIC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,WAAwB;IACtD,OAAO,IAAI,mCAAgB,CAAC,WAAW,CAAC,CAAC;AAC3C,CAAC;AAFD,0CAEC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { INVALID_SPANID, INVALID_TRACEID } from './invalid-span-constants';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport type { Span } from './span';\nimport type { SpanContext } from './span_context';\n\n// Valid characters (0-9, a-f, A-F) are marked as 1.\nconst isHex = new Uint8Array([\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,\n]);\n\nfunction isValidHex(id: string, length: number): boolean {\n // As of 1.9.0 the id was allowed to be a non-string value,\n // even though it was not possible in the types.\n if (typeof id !== 'string' || id.length !== length) return false;\n\n let r = 0;\n for (let i = 0; i < id.length; i += 4) {\n r +=\n (isHex[id.charCodeAt(i)] | 0) +\n (isHex[id.charCodeAt(i + 1)] | 0) +\n (isHex[id.charCodeAt(i + 2)] | 0) +\n (isHex[id.charCodeAt(i + 3)] | 0);\n }\n\n return r === length;\n}\n\n/**\n * @since 1.0.0\n */\nexport function isValidTraceId(traceId: string): boolean {\n return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;\n}\n\n/**\n * @since 1.0.0\n */\nexport function isValidSpanId(spanId: string): boolean {\n return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;\n}\n\n/**\n * Returns true if this {@link SpanContext} is valid.\n * @return true if this {@link SpanContext} is valid.\n *\n * @since 1.0.0\n */\nexport function isSpanContextValid(spanContext: SpanContext): boolean {\n return (\n isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId)\n );\n}\n\n/**\n * Wrap the given {@link SpanContext} in a new non-recording {@link Span}\n *\n * @param spanContext span context to be wrapped\n * @returns a new non-recording {@link Span} with the provided context\n */\nexport function wrapSpanContext(spanContext: SpanContext): Span {\n return new NonRecordingSpan(spanContext);\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/status.d.ts b/node_modules/@opentelemetry/api/build/src/trace/status.d.ts deleted file mode 100644 index 77cbacb..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/status.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @since 1.0.0 - */ -export interface SpanStatus { - /** The status code of this message. */ - code: SpanStatusCode; - /** A developer-facing error message. */ - message?: string; -} -/** - * An enumeration of status codes. - * - * @since 1.0.0 - */ -export declare enum SpanStatusCode { - /** - * The default status. - */ - UNSET = 0, - /** - * The operation has been validated by an Application developer or - * Operator to have completed successfully. - */ - OK = 1, - /** - * The operation contains an error. - */ - ERROR = 2 -} -//# sourceMappingURL=status.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/status.js b/node_modules/@opentelemetry/api/build/src/trace/status.js deleted file mode 100644 index 945da88..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/status.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SpanStatusCode = void 0; -/** - * An enumeration of status codes. - * - * @since 1.0.0 - */ -var SpanStatusCode; -(function (SpanStatusCode) { - /** - * The default status. - */ - SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET"; - /** - * The operation has been validated by an Application developer or - * Operator to have completed successfully. - */ - SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK"; - /** - * The operation contains an error. - */ - SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR"; -})(SpanStatusCode = exports.SpanStatusCode || (exports.SpanStatusCode = {})); -//# sourceMappingURL=status.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/status.js.map b/node_modules/@opentelemetry/api/build/src/trace/status.js.map deleted file mode 100644 index 4b20293..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/status.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/trace/status.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH;;;;GAIG;AACH,IAAY,cAcX;AAdD,WAAY,cAAc;IACxB;;OAEG;IACH,qDAAS,CAAA;IACT;;;OAGG;IACH,+CAAM,CAAA;IACN;;OAEG;IACH,qDAAS,CAAA;AACX,CAAC,EAdW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAczB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface SpanStatus {\n /** The status code of this message. */\n code: SpanStatusCode;\n /** A developer-facing error message. */\n message?: string;\n}\n\n/**\n * An enumeration of status codes.\n *\n * @since 1.0.0\n */\nexport enum SpanStatusCode {\n /**\n * The default status.\n */\n UNSET = 0,\n /**\n * The operation has been validated by an Application developer or\n * Operator to have completed successfully.\n */\n OK = 1,\n /**\n * The operation contains an error.\n */\n ERROR = 2,\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/trace_flags.d.ts b/node_modules/@opentelemetry/api/build/src/trace/trace_flags.d.ts deleted file mode 100644 index 9977efc..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/trace_flags.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @since 1.0.0 - */ -export declare enum TraceFlags { - /** Represents no flag set. */ - NONE = 0, - /** Bit to represent whether trace is sampled in trace flags. */ - SAMPLED = 1 -} -//# sourceMappingURL=trace_flags.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/trace_flags.js b/node_modules/@opentelemetry/api/build/src/trace/trace_flags.js deleted file mode 100644 index 1a13f69..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/trace_flags.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TraceFlags = void 0; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -/** - * @since 1.0.0 - */ -var TraceFlags; -(function (TraceFlags) { - /** Represents no flag set. */ - TraceFlags[TraceFlags["NONE"] = 0] = "NONE"; - /** Bit to represent whether trace is sampled in trace flags. */ - TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED"; -})(TraceFlags = exports.TraceFlags || (exports.TraceFlags = {})); -//# sourceMappingURL=trace_flags.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/trace_flags.js.map b/node_modules/@opentelemetry/api/build/src/trace/trace_flags.js.map deleted file mode 100644 index a96799e..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/trace_flags.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace_flags.js","sourceRoot":"","sources":["../../../src/trace/trace_flags.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;GAEG;AACH,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,8BAA8B;IAC9B,2CAAU,CAAA;IACV,gEAAgE;IAChE,iDAAkB,CAAA;AACpB,CAAC,EALW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAKrB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @since 1.0.0\n */\nexport enum TraceFlags {\n /** Represents no flag set. */\n NONE = 0x0,\n /** Bit to represent whether trace is sampled in trace flags. */\n SAMPLED = 0x1 << 0,\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/trace_state.d.ts b/node_modules/@opentelemetry/api/build/src/trace/trace_state.d.ts deleted file mode 100644 index 2c7cf02..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/trace_state.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @since 1.0.0 - */ -export interface TraceState { - /** - * Create a new TraceState which inherits from this TraceState and has the - * given key set. - * The new entry will always be added in the front of the list of states. - * - * @param key key of the TraceState entry. - * @param value value of the TraceState entry. - */ - set(key: string, value: string): TraceState; - /** - * Return a new TraceState which inherits from this TraceState but does not - * contain the given key. - * - * @param key the key for the TraceState entry to be removed. - */ - unset(key: string): TraceState; - /** - * Returns the value to which the specified key is mapped, or `undefined` if - * this map contains no mapping for the key. - * - * @param key with which the specified value is to be associated. - * @returns the value to which the specified key is mapped, or `undefined` if - * this map contains no mapping for the key. - */ - get(key: string): string | undefined; - /** - * Serializes the TraceState to a `list` as defined below. The `list` is a - * series of `list-members` separated by commas `,`, and a list-member is a - * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs - * surrounding `list-members` are ignored. There can be a maximum of 32 - * `list-members` in a `list`. - * - * @returns the serialized string. - */ - serialize(): string; -} -//# sourceMappingURL=trace_state.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/trace_state.js b/node_modules/@opentelemetry/api/build/src/trace/trace_state.js deleted file mode 100644 index eff9a4d..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/trace_state.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=trace_state.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/trace_state.js.map b/node_modules/@opentelemetry/api/build/src/trace/trace_state.js.map deleted file mode 100644 index 6a6f994..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/trace_state.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace_state.js","sourceRoot":"","sources":["../../../src/trace/trace_state.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport interface TraceState {\n /**\n * Create a new TraceState which inherits from this TraceState and has the\n * given key set.\n * The new entry will always be added in the front of the list of states.\n *\n * @param key key of the TraceState entry.\n * @param value value of the TraceState entry.\n */\n set(key: string, value: string): TraceState;\n\n /**\n * Return a new TraceState which inherits from this TraceState but does not\n * contain the given key.\n *\n * @param key the key for the TraceState entry to be removed.\n */\n unset(key: string): TraceState;\n\n /**\n * Returns the value to which the specified key is mapped, or `undefined` if\n * this map contains no mapping for the key.\n *\n * @param key with which the specified value is to be associated.\n * @returns the value to which the specified key is mapped, or `undefined` if\n * this map contains no mapping for the key.\n */\n get(key: string): string | undefined;\n\n // TODO: Consider to add support for merging an object as well by also\n // accepting a single internalTraceState argument similar to the constructor.\n\n /**\n * Serializes the TraceState to a `list` as defined below. The `list` is a\n * series of `list-members` separated by commas `,`, and a list-member is a\n * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs\n * surrounding `list-members` are ignored. There can be a maximum of 32\n * `list-members` in a `list`.\n *\n * @returns the serialized string.\n */\n serialize(): string;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/tracer.d.ts b/node_modules/@opentelemetry/api/build/src/trace/tracer.d.ts deleted file mode 100644 index d1ecaef..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/tracer.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type { Context } from '../context/types'; -import type { Span } from './span'; -import type { SpanOptions } from './SpanOptions'; -/** - * Tracer provides an interface for creating {@link Span}s. - * - * @since 1.0.0 - */ -export interface Tracer { - /** - * Starts a new {@link Span}. Start the span without setting it on context. - * - * This method do NOT modify the current Context. - * - * @param name The name of the span - * @param [options] SpanOptions used for span creation - * @param [context] Context to use to extract parent - * @returns Span The newly created span - * @example - * const span = tracer.startSpan('op'); - * span.setAttribute('key', 'value'); - * span.end(); - */ - startSpan(name: string, options?: SpanOptions, context?: Context): Span; - /** - * Starts a new {@link Span} and calls the given function passing it the - * created span as first argument. - * Additionally the new span gets set in context and this context is activated - * for the duration of the function call. - * - * @param name The name of the span - * @param [options] SpanOptions used for span creation - * @param [context] Context to use to extract parent - * @param fn function called in the context of the span and receives the newly created span as an argument - * @returns return value of fn - * @example - * const something = tracer.startActiveSpan('op', span => { - * try { - * do some work - * span.setStatus({code: SpanStatusCode.OK}); - * return something; - * } catch (err) { - * span.setStatus({ - * code: SpanStatusCode.ERROR, - * message: err.message, - * }); - * throw err; - * } finally { - * span.end(); - * } - * }); - * - * @example - * const span = tracer.startActiveSpan('op', span => { - * try { - * do some work - * return span; - * } catch (err) { - * span.setStatus({ - * code: SpanStatusCode.ERROR, - * message: err.message, - * }); - * throw err; - * } - * }); - * do some more work - * span.end(); - */ - startActiveSpan unknown>(name: string, fn: F): ReturnType; - startActiveSpan unknown>(name: string, options: SpanOptions, fn: F): ReturnType; - startActiveSpan unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType; -} -//# sourceMappingURL=tracer.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/tracer.js b/node_modules/@opentelemetry/api/build/src/trace/tracer.js deleted file mode 100644 index c7a13c6..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/tracer.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=tracer.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/tracer.js.map b/node_modules/@opentelemetry/api/build/src/trace/tracer.js.map deleted file mode 100644 index 4177be4..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/tracer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracer.js","sourceRoot":"","sources":["../../../src/trace/tracer.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Context } from '../context/types';\nimport type { Span } from './span';\nimport type { SpanOptions } from './SpanOptions';\n\n/**\n * Tracer provides an interface for creating {@link Span}s.\n *\n * @since 1.0.0\n */\nexport interface Tracer {\n /**\n * Starts a new {@link Span}. Start the span without setting it on context.\n *\n * This method do NOT modify the current Context.\n *\n * @param name The name of the span\n * @param [options] SpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @returns Span The newly created span\n * @example\n * const span = tracer.startSpan('op');\n * span.setAttribute('key', 'value');\n * span.end();\n */\n startSpan(name: string, options?: SpanOptions, context?: Context): Span;\n\n /**\n * Starts a new {@link Span} and calls the given function passing it the\n * created span as first argument.\n * Additionally the new span gets set in context and this context is activated\n * for the duration of the function call.\n *\n * @param name The name of the span\n * @param [options] SpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns return value of fn\n * @example\n * const something = tracer.startActiveSpan('op', span => {\n * try {\n * do some work\n * span.setStatus({code: SpanStatusCode.OK});\n * return something;\n * } catch (err) {\n * span.setStatus({\n * code: SpanStatusCode.ERROR,\n * message: err.message,\n * });\n * throw err;\n * } finally {\n * span.end();\n * }\n * });\n *\n * @example\n * const span = tracer.startActiveSpan('op', span => {\n * try {\n * do some work\n * return span;\n * } catch (err) {\n * span.setStatus({\n * code: SpanStatusCode.ERROR,\n * message: err.message,\n * });\n * throw err;\n * }\n * });\n * do some more work\n * span.end();\n */\n startActiveSpan unknown>(\n name: string,\n fn: F\n ): ReturnType;\n startActiveSpan unknown>(\n name: string,\n options: SpanOptions,\n fn: F\n ): ReturnType;\n startActiveSpan unknown>(\n name: string,\n options: SpanOptions,\n context: Context,\n fn: F\n ): ReturnType;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/tracer_options.d.ts b/node_modules/@opentelemetry/api/build/src/trace/tracer_options.d.ts deleted file mode 100644 index ab4e483..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/tracer_options.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * An interface describes additional metadata of a tracer. - * - * @since 1.3.0 - */ -export interface TracerOptions { - /** - * The schemaUrl of the tracer or instrumentation library - */ - schemaUrl?: string; -} -//# sourceMappingURL=tracer_options.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/tracer_options.js b/node_modules/@opentelemetry/api/build/src/trace/tracer_options.js deleted file mode 100644 index 13e8105..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/tracer_options.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=tracer_options.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/tracer_options.js.map b/node_modules/@opentelemetry/api/build/src/trace/tracer_options.js.map deleted file mode 100644 index b3035e5..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/tracer_options.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracer_options.js","sourceRoot":"","sources":["../../../src/trace/tracer_options.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An interface describes additional metadata of a tracer.\n *\n * @since 1.3.0\n */\nexport interface TracerOptions {\n /**\n * The schemaUrl of the tracer or instrumentation library\n */\n schemaUrl?: string;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/tracer_provider.d.ts b/node_modules/@opentelemetry/api/build/src/trace/tracer_provider.d.ts deleted file mode 100644 index eacef7f..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/tracer_provider.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { Tracer } from './tracer'; -import type { TracerOptions } from './tracer_options'; -/** - * A registry for creating named {@link Tracer}s. - * - * @since 1.0.0 - */ -export interface TracerProvider { - /** - * Returns a Tracer, creating one if one with the given name and version is - * not already created. - * - * This function may return different Tracer types (e.g. - * {@link NoopTracerProvider} vs. a functional tracer). - * - * @param name The name of the tracer or instrumentation library. - * @param version The version of the tracer or instrumentation library. - * @param options The options of the tracer or instrumentation library. - * @returns Tracer A Tracer with the given name and version - */ - getTracer(name: string, version?: string, options?: TracerOptions): Tracer; -} -//# sourceMappingURL=tracer_provider.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/tracer_provider.js b/node_modules/@opentelemetry/api/build/src/trace/tracer_provider.js deleted file mode 100644 index 89a18cf..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/tracer_provider.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=tracer_provider.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/trace/tracer_provider.js.map b/node_modules/@opentelemetry/api/build/src/trace/tracer_provider.js.map deleted file mode 100644 index 805626d..0000000 --- a/node_modules/@opentelemetry/api/build/src/trace/tracer_provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tracer_provider.js","sourceRoot":"","sources":["../../../src/trace/tracer_provider.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Tracer } from './tracer';\nimport type { TracerOptions } from './tracer_options';\n\n/**\n * A registry for creating named {@link Tracer}s.\n *\n * @since 1.0.0\n */\nexport interface TracerProvider {\n /**\n * Returns a Tracer, creating one if one with the given name and version is\n * not already created.\n *\n * This function may return different Tracer types (e.g.\n * {@link NoopTracerProvider} vs. a functional tracer).\n *\n * @param name The name of the tracer or instrumentation library.\n * @param version The version of the tracer or instrumentation library.\n * @param options The options of the tracer or instrumentation library.\n * @returns Tracer A Tracer with the given name and version\n */\n getTracer(name: string, version?: string, options?: TracerOptions): Tracer;\n}\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/version.d.ts b/node_modules/@opentelemetry/api/build/src/version.d.ts deleted file mode 100644 index fe80997..0000000 --- a/node_modules/@opentelemetry/api/build/src/version.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const VERSION = "1.9.1"; -//# sourceMappingURL=version.d.ts.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/version.js b/node_modules/@opentelemetry/api/build/src/version.js deleted file mode 100644 index 04f5d26..0000000 --- a/node_modules/@opentelemetry/api/build/src/version.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VERSION = void 0; -// this is autogenerated file, see scripts/version-update.js -exports.VERSION = '1.9.1'; -//# sourceMappingURL=version.js.map \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/build/src/version.js.map b/node_modules/@opentelemetry/api/build/src/version.js.map deleted file mode 100644 index 98207e9..0000000 --- a/node_modules/@opentelemetry/api/build/src/version.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '1.9.1';\n"]} \ No newline at end of file diff --git a/node_modules/@opentelemetry/api/package.json b/node_modules/@opentelemetry/api/package.json deleted file mode 100644 index 1fae1b7..0000000 --- a/node_modules/@opentelemetry/api/package.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "name": "@opentelemetry/api", - "version": "1.9.1", - "description": "Public API for OpenTelemetry", - "main": "build/src/index.js", - "module": "build/esm/index.js", - "esnext": "build/esnext/index.js", - "types": "build/src/index.d.ts", - "exports": { - ".": { - "esnext": "./build/esnext/index.js", - "module": "./build/esm/index.js", - "types": "./build/src/index.d.ts", - "default": "./build/src/index.js" - }, - "./experimental": { - "esnext": "./build/esnext/experimental/index.js", - "module": "./build/esm/experimental/index.js", - "types": "./build/src/experimental/index.d.ts", - "default": "./build/src/experimental/index.js" - } - }, - "repository": "open-telemetry/opentelemetry-js", - "scripts": { - "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "lint:fix": "eslint . --ext .ts --fix", - "lint": "eslint . --ext .ts && npm run cycle-check", - "test:browser": "karma start --single-run", - "test": "nyc mocha 'test/**/*.test.ts'", - "test:node8-compat": "node test/backcompat/node8-compat.js", - "test:webworker": "karma start karma.worker.js --single-run", - "cycle-check": "dpdm --exit-code circular:1 src/index.ts", - "version": "node ../scripts/version-update.js", - "prewatch": "npm run precompile", - "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "peer-api-check": "node ../scripts/peer-api-check.js" - }, - "keywords": [ - "opentelemetry", - "nodejs", - "browser", - "tracing", - "profiling", - "stats", - "monitoring" - ], - "author": "OpenTelemetry Authors", - "license": "Apache-2.0", - "engines": { - "node": ">=8.0.0" - }, - "files": [ - "build/esm/**/*.js", - "build/esm/**/*.js.map", - "build/esm/**/*.d.ts", - "build/esnext/**/*.js", - "build/esnext/**/*.js.map", - "build/esnext/**/*.d.ts", - "build/src/**/*.js", - "build/src/**/*.js.map", - "build/src/**/*.d.ts", - "LICENSE", - "README.md" - ], - "publishConfig": { - "access": "public" - }, - "devDependencies": { - "@types/mocha": "10.0.10", - "@types/node": "^8.10.66", - "@types/sinon": "17.0.4", - "@types/webpack": "5.28.5", - "@types/webpack-env": "1.16.3", - "babel-plugin-istanbul": "7.0.1", - "dpdm": "4.0.1", - "karma": "6.4.4", - "karma-chrome-launcher": "3.1.0", - "karma-coverage": "2.2.1", - "karma-mocha": "2.0.1", - "karma-mocha-webworker": "1.3.0", - "karma-spec-reporter": "0.0.36", - "karma-webpack": "5.0.1", - "memfs": "3.5.3", - "mocha": "11.7.5", - "nyc": "17.1.0", - "sinon": "18.0.1", - "ts-loader": "9.5.4", - "typescript": "5.0.4", - "unionfs": "4.5.4", - "webpack": "5.104.1" - }, - "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/api", - "sideEffects": false, - "gitHead": "7e74509a4d848e94b2970bb5262dd3e8efeed0a2" -} diff --git a/node_modules/@tsconfig/node10/LICENSE b/node_modules/@tsconfig/node10/LICENSE deleted file mode 100644 index 48ea661..0000000 --- a/node_modules/@tsconfig/node10/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE diff --git a/node_modules/@tsconfig/node10/README.md b/node_modules/@tsconfig/node10/README.md deleted file mode 100644 index 1d7df8a..0000000 --- a/node_modules/@tsconfig/node10/README.md +++ /dev/null @@ -1,38 +0,0 @@ -### A base TSConfig for working with Node 10. - -Add the package to your `"devDependencies"`: - -```sh -npm install --save-dev @tsconfig/node10 -yarn add --dev @tsconfig/node10 -``` - -Add to your `tsconfig.json`: - -```json -"extends": "@tsconfig/node10/tsconfig.json" -``` - ---- - -The `tsconfig.json`: - -```jsonc -{ - "$schema": "https://www.schemastore.org/tsconfig", - - "compilerOptions": { - "lib": ["es2018"], - "module": "commonjs", - "target": "es2018", - - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "moduleResolution": "node" - } -} - -``` - -You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/node10.json). diff --git a/node_modules/@tsconfig/node10/package.json b/node_modules/@tsconfig/node10/package.json deleted file mode 100644 index 7a7729e..0000000 --- a/node_modules/@tsconfig/node10/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "@tsconfig/node10", - "repository": { - "type": "git", - "url": "https://github.com/tsconfig/bases.git", - "directory": "bases" - }, - "license": "MIT", - "description": "A base TSConfig for working with Node 10.", - "keywords": [ - "tsconfig", - "node10" - ], - "version": "1.0.12" -} \ No newline at end of file diff --git a/node_modules/@tsconfig/node10/tsconfig.json b/node_modules/@tsconfig/node10/tsconfig.json deleted file mode 100644 index ec3fba3..0000000 --- a/node_modules/@tsconfig/node10/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://www.schemastore.org/tsconfig", - - "compilerOptions": { - "lib": ["es2018"], - "module": "commonjs", - "target": "es2018", - - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "moduleResolution": "node" - } -} diff --git a/node_modules/@tsconfig/node12/LICENSE b/node_modules/@tsconfig/node12/LICENSE deleted file mode 100644 index 48ea661..0000000 --- a/node_modules/@tsconfig/node12/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE diff --git a/node_modules/@tsconfig/node12/README.md b/node_modules/@tsconfig/node12/README.md deleted file mode 100644 index 6352ccd..0000000 --- a/node_modules/@tsconfig/node12/README.md +++ /dev/null @@ -1,40 +0,0 @@ -### A base TSConfig for working with Node 12. - -Add the package to your `"devDependencies"`: - -```sh -npm install --save-dev @tsconfig/node12 -yarn add --dev @tsconfig/node12 -``` - -Add to your `tsconfig.json`: - -```json -"extends": "@tsconfig/node12/tsconfig.json" -``` - ---- - -The `tsconfig.json`: - -```jsonc -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Node 12", - - "compilerOptions": { - "lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"], - "module": "commonjs", - "target": "es2019", - - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" - } -} - -``` - -You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/node12.json). diff --git a/node_modules/@tsconfig/node12/package.json b/node_modules/@tsconfig/node12/package.json deleted file mode 100644 index 56aad61..0000000 --- a/node_modules/@tsconfig/node12/package.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"@tsconfig/node12","repository":{"type":"git","url":"https://github.com/tsconfig/bases.git","directory":"bases"},"license":"MIT","description":"A base TSConfig for working with Node 12.","keywords":["tsconfig","node12"],"version":"1.0.11"} \ No newline at end of file diff --git a/node_modules/@tsconfig/node12/tsconfig.json b/node_modules/@tsconfig/node12/tsconfig.json deleted file mode 100644 index eeaf944..0000000 --- a/node_modules/@tsconfig/node12/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Node 12", - - "compilerOptions": { - "lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"], - "module": "commonjs", - "target": "es2019", - - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" - } -} diff --git a/node_modules/@tsconfig/node14/LICENSE b/node_modules/@tsconfig/node14/LICENSE deleted file mode 100644 index 48ea661..0000000 --- a/node_modules/@tsconfig/node14/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE diff --git a/node_modules/@tsconfig/node14/README.md b/node_modules/@tsconfig/node14/README.md deleted file mode 100644 index dad7f02..0000000 --- a/node_modules/@tsconfig/node14/README.md +++ /dev/null @@ -1,40 +0,0 @@ -### A base TSConfig for working with Node 14. - -Add the package to your `"devDependencies"`: - -```sh -npm install --save-dev @tsconfig/node14 -yarn add --dev @tsconfig/node14 -``` - -Add to your `tsconfig.json`: - -```json -"extends": "@tsconfig/node14/tsconfig.json" -``` - ---- - -The `tsconfig.json`: - -```jsonc -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Node 14", - - "compilerOptions": { - "lib": ["es2020"], - "module": "commonjs", - "target": "es2020", - - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" - } -} - -``` - -You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/node14.json). diff --git a/node_modules/@tsconfig/node14/package.json b/node_modules/@tsconfig/node14/package.json deleted file mode 100644 index 742f97b..0000000 --- a/node_modules/@tsconfig/node14/package.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"@tsconfig/node14","repository":{"type":"git","url":"https://github.com/tsconfig/bases.git","directory":"bases"},"license":"MIT","description":"A base TSConfig for working with Node 14.","keywords":["tsconfig","node14"],"version":"1.0.3"} \ No newline at end of file diff --git a/node_modules/@tsconfig/node14/tsconfig.json b/node_modules/@tsconfig/node14/tsconfig.json deleted file mode 100644 index d1d7551..0000000 --- a/node_modules/@tsconfig/node14/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Node 14", - - "compilerOptions": { - "lib": ["es2020"], - "module": "commonjs", - "target": "es2020", - - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" - } -} diff --git a/node_modules/@tsconfig/node16/LICENSE b/node_modules/@tsconfig/node16/LICENSE deleted file mode 100644 index 48ea661..0000000 --- a/node_modules/@tsconfig/node16/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE diff --git a/node_modules/@tsconfig/node16/README.md b/node_modules/@tsconfig/node16/README.md deleted file mode 100644 index 2946b2f..0000000 --- a/node_modules/@tsconfig/node16/README.md +++ /dev/null @@ -1,40 +0,0 @@ -### A base TSConfig for working with Node 16. - -Add the package to your `"devDependencies"`: - -```sh -npm install --save-dev @tsconfig/node16 -yarn add --dev @tsconfig/node16 -``` - -Add to your `tsconfig.json`: - -```json -"extends": "@tsconfig/node16/tsconfig.json" -``` - ---- - -The `tsconfig.json`: - -```jsonc -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Node 16", - - "compilerOptions": { - "lib": ["es2021"], - "module": "Node16", - "target": "es2021", - - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" - } -} - -``` - -You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/node16.json). diff --git a/node_modules/@tsconfig/node16/package.json b/node_modules/@tsconfig/node16/package.json deleted file mode 100644 index 8ccc97f..0000000 --- a/node_modules/@tsconfig/node16/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "@tsconfig/node16", - "repository": { - "type": "git", - "url": "https://github.com/tsconfig/bases.git", - "directory": "bases" - }, - "license": "MIT", - "description": "A base TSConfig for working with Node 16.", - "keywords": [ - "tsconfig", - "node16" - ], - "version": "1.0.4" -} \ No newline at end of file diff --git a/node_modules/@tsconfig/node16/tsconfig.json b/node_modules/@tsconfig/node16/tsconfig.json deleted file mode 100644 index 2671912..0000000 --- a/node_modules/@tsconfig/node16/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Node 16", - - "compilerOptions": { - "lib": ["es2021"], - "module": "Node16", - "target": "es2021", - - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" - } -} diff --git a/node_modules/@types/node/LICENSE b/node_modules/@types/node/LICENSE deleted file mode 100644 index 9e841e7..0000000 --- a/node_modules/@types/node/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/node_modules/@types/node/README.md b/node_modules/@types/node/README.md deleted file mode 100644 index 6545032..0000000 --- a/node_modules/@types/node/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Installation -> `npm install --save @types/node` - -# Summary -This package contains type definitions for node (https://nodejs.org/). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v22. - -### Additional Details - * Last updated: Wed, 10 Jun 2026 22:15:09 GMT - * Dependencies: [undici-types](https://npmjs.com/package/undici-types) - -# Credits -These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), and [René](https://github.com/Renegade334). diff --git a/node_modules/@types/node/assert.d.ts b/node_modules/@types/node/assert.d.ts deleted file mode 100644 index 330d860..0000000 --- a/node_modules/@types/node/assert.d.ts +++ /dev/null @@ -1,1078 +0,0 @@ -/** - * The `node:assert` module provides a set of assertion functions for verifying - * invariants. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/assert.js) - */ -declare module "assert" { - import strict = require("assert/strict"); - /** - * An alias of {@link assert.ok}. - * @since v0.5.9 - * @param value The input that is checked for being truthy. - */ - function assert(value: unknown, message?: string | Error): asserts value; - const kOptions: unique symbol; - namespace assert { - type AssertMethodNames = - | "deepEqual" - | "deepStrictEqual" - | "doesNotMatch" - | "doesNotReject" - | "doesNotThrow" - | "equal" - | "fail" - | "ifError" - | "match" - | "notDeepEqual" - | "notDeepStrictEqual" - | "notEqual" - | "notStrictEqual" - | "ok" - | "partialDeepStrictEqual" - | "rejects" - | "strictEqual" - | "throws"; - interface AssertOptions { - /** - * If set to `'full'`, shows the full diff in assertion errors. - * @default 'simple' - */ - diff?: "simple" | "full" | undefined; - /** - * If set to `true`, non-strict methods behave like their - * corresponding strict methods. - * @default true - */ - strict?: boolean | undefined; - } - interface Assert extends Pick { - readonly [kOptions]: AssertOptions & { strict: false }; - } - interface AssertStrict extends Pick { - readonly [kOptions]: AssertOptions & { strict: true }; - } - /** - * The `Assert` class allows creating independent assertion instances with custom options. - * @since v22.19.0 - */ - var Assert: { - /** - * Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages. - * - * ```js - * const { Assert } = require('node:assert'); - * const assertInstance = new Assert({ diff: 'full' }); - * assertInstance.deepStrictEqual({ a: 1 }, { a: 2 }); - * // Shows a full diff in the error message. - * ``` - * - * **Important**: When destructuring assertion methods from an `Assert` instance, - * the methods lose their connection to the instance's configuration options (such as `diff` and `strict` settings). - * The destructured methods will fall back to default behavior instead. - * - * ```js - * const myAssert = new Assert({ diff: 'full' }); - * - * // This works as expected - uses 'full' diff - * myAssert.strictEqual({ a: 1 }, { b: { c: 1 } }); - * - * // This loses the 'full' diff setting - falls back to default 'simple' diff - * const { strictEqual } = myAssert; - * strictEqual({ a: 1 }, { b: { c: 1 } }); - * ``` - * - * When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior - * (diff: 'simple', non-strict mode). - * To maintain custom options when using destructured methods, avoid - * destructuring and call methods directly on the instance. - * @since v22.19.0 - */ - new( - options?: AssertOptions & { strict?: true }, - ): AssertStrict; - new( - options: AssertOptions, - ): Assert; - }; - interface AssertionErrorOptions { - /** - * If provided, the error message is set to this value. - */ - message?: string | undefined; - /** - * The `actual` property on the error instance. - */ - actual?: unknown; - /** - * The `expected` property on the error instance. - */ - expected?: unknown; - /** - * The `operator` property on the error instance. - */ - operator?: string | undefined; - /** - * If provided, the generated stack trace omits frames before this function. - */ - stackStartFn?: Function | undefined; - /** - * If set to `'full'`, shows the full diff in assertion errors. - * @default 'simple' - */ - diff?: "simple" | "full" | undefined; - } - /** - * Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class. - */ - class AssertionError extends Error { - constructor(options: AssertionErrorOptions); - /** - * Set to the `actual` argument for methods such as {@link assert.strictEqual()}. - */ - actual: unknown; - /** - * Set to the `expected` argument for methods such as {@link assert.strictEqual()}. - */ - expected: unknown; - /** - * Indicates if the message was auto-generated (`true`) or not. - */ - generatedMessage: boolean; - /** - * Value is always `ERR_ASSERTION` to show that the error is an assertion error. - */ - code: "ERR_ASSERTION"; - /** - * Set to the passed in operator value. - */ - operator: string; - } - /** - * This feature is deprecated and will be removed in a future version. - * Please consider using alternatives such as the `mock` helper function. - * @since v14.2.0, v12.19.0 - * @deprecated Deprecated - */ - class CallTracker { - /** - * The wrapper function is expected to be called exactly `exact` times. If the - * function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an - * error. - * - * ```js - * import assert from 'node:assert'; - * - * // Creates call tracker. - * const tracker = new assert.CallTracker(); - * - * function func() {} - * - * // Returns a function that wraps func() that must be called exact times - * // before tracker.verify(). - * const callsfunc = tracker.calls(func); - * ``` - * @since v14.2.0, v12.19.0 - * @param [fn='A no-op function'] - * @param [exact=1] - * @return A function that wraps `fn`. - */ - calls(exact?: number): () => void; - calls any>(fn?: Func, exact?: number): Func; - /** - * Example: - * - * ```js - * import assert from 'node:assert'; - * - * const tracker = new assert.CallTracker(); - * - * function func() {} - * const callsfunc = tracker.calls(func); - * callsfunc(1, 2, 3); - * - * assert.deepStrictEqual(tracker.getCalls(callsfunc), - * [{ thisArg: undefined, arguments: [1, 2, 3] }]); - * ``` - * @since v18.8.0, v16.18.0 - * @return An array with all the calls to a tracked function. - */ - getCalls(fn: Function): CallTrackerCall[]; - /** - * The arrays contains information about the expected and actual number of calls of - * the functions that have not been called the expected number of times. - * - * ```js - * import assert from 'node:assert'; - * - * // Creates call tracker. - * const tracker = new assert.CallTracker(); - * - * function func() {} - * - * // Returns a function that wraps func() that must be called exact times - * // before tracker.verify(). - * const callsfunc = tracker.calls(func, 2); - * - * // Returns an array containing information on callsfunc() - * console.log(tracker.report()); - * // [ - * // { - * // message: 'Expected the func function to be executed 2 time(s) but was - * // executed 0 time(s).', - * // actual: 0, - * // expected: 2, - * // operator: 'func', - * // stack: stack trace - * // } - * // ] - * ``` - * @since v14.2.0, v12.19.0 - * @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}. - */ - report(): CallTrackerReportInformation[]; - /** - * Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it. - * If no arguments are passed, all tracked functions will be reset. - * - * ```js - * import assert from 'node:assert'; - * - * const tracker = new assert.CallTracker(); - * - * function func() {} - * const callsfunc = tracker.calls(func); - * - * callsfunc(); - * // Tracker was called once - * assert.strictEqual(tracker.getCalls(callsfunc).length, 1); - * - * tracker.reset(callsfunc); - * assert.strictEqual(tracker.getCalls(callsfunc).length, 0); - * ``` - * @since v18.8.0, v16.18.0 - * @param fn a tracked function to reset. - */ - reset(fn?: Function): void; - /** - * Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that - * have not been called the expected number of times. - * - * ```js - * import assert from 'node:assert'; - * - * // Creates call tracker. - * const tracker = new assert.CallTracker(); - * - * function func() {} - * - * // Returns a function that wraps func() that must be called exact times - * // before tracker.verify(). - * const callsfunc = tracker.calls(func, 2); - * - * callsfunc(); - * - * // Will throw an error since callsfunc() was only called once. - * tracker.verify(); - * ``` - * @since v14.2.0, v12.19.0 - */ - verify(): void; - } - interface CallTrackerCall { - thisArg: object; - arguments: unknown[]; - } - interface CallTrackerReportInformation { - message: string; - /** The actual number of times the function was called. */ - actual: number; - /** The number of times the function was expected to be called. */ - expected: number; - /** The name of the function that is wrapped. */ - operator: string; - /** A stack trace of the function. */ - stack: object; - } - type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error; - /** - * Throws an `AssertionError` with the provided error message or a default - * error message. If the `message` parameter is an instance of an `Error` then - * it will be thrown instead of the `AssertionError`. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.fail(); - * // AssertionError [ERR_ASSERTION]: Failed - * - * assert.fail('boom'); - * // AssertionError [ERR_ASSERTION]: boom - * - * assert.fail(new TypeError('need array')); - * // TypeError: need array - * ``` - * - * Using `assert.fail()` with more than two arguments is possible but deprecated. - * See below for further details. - * @since v0.1.21 - * @param [message='Failed'] - */ - function fail(message?: string | Error): never; - /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ - function fail( - actual: unknown, - expected: unknown, - message?: string | Error, - operator?: string, - // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type - stackStartFn?: Function, - ): never; - /** - * Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`. - * - * If `value` is not truthy, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is `undefined`, a default - * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`. - * If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``. - * - * Be aware that in the `repl` the error message will be different to the one - * thrown in a file! See below for further details. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.ok(true); - * // OK - * assert.ok(1); - * // OK - * - * assert.ok(); - * // AssertionError: No value argument passed to `assert.ok()` - * - * assert.ok(false, 'it\'s false'); - * // AssertionError: it's false - * - * // In the repl: - * assert.ok(typeof 123 === 'string'); - * // AssertionError: false == true - * - * // In a file (e.g. test.js): - * assert.ok(typeof 123 === 'string'); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert.ok(typeof 123 === 'string') - * - * assert.ok(false); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert.ok(false) - * - * assert.ok(0); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert.ok(0) - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * // Using `assert()` works the same: - * assert(0); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert(0) - * ``` - * @since v0.1.21 - */ - function ok(value: unknown, message?: string | Error): asserts value; - /** - * **Strict assertion mode** - * - * An alias of {@link strictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link strictEqual} instead. - * - * Tests shallow, coercive equality between the `actual` and `expected` parameters - * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled - * and treated as being identical if both sides are `NaN`. - * - * ```js - * import assert from 'node:assert'; - * - * assert.equal(1, 1); - * // OK, 1 == 1 - * assert.equal(1, '1'); - * // OK, 1 == '1' - * assert.equal(NaN, NaN); - * // OK - * - * assert.equal(1, 2); - * // AssertionError: 1 == 2 - * assert.equal({ a: { b: 1 } }, { a: { b: 1 } }); - * // AssertionError: { a: { b: 1 } } == { a: { b: 1 } } - * ``` - * - * If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default - * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`. - * @since v0.1.21 - */ - function equal(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * **Strict assertion mode** - * - * An alias of {@link notStrictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link notStrictEqual} instead. - * - * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is - * specially handled and treated as being identical if both sides are `NaN`. - * - * ```js - * import assert from 'node:assert'; - * - * assert.notEqual(1, 2); - * // OK - * - * assert.notEqual(1, 1); - * // AssertionError: 1 != 1 - * - * assert.notEqual(1, '1'); - * // AssertionError: 1 != '1' - * ``` - * - * If the values are equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error - * message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`. - * @since v0.1.21 - */ - function notEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * **Strict assertion mode** - * - * An alias of {@link deepStrictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead. - * - * Tests for deep equality between the `actual` and `expected` parameters. Consider - * using {@link deepStrictEqual} instead. {@link deepEqual} can have - * surprising results. - * - * _Deep equality_ means that the enumerable "own" properties of child objects - * are also recursively evaluated by the following rules. - * @since v0.1.21 - */ - function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * **Strict assertion mode** - * - * An alias of {@link notDeepStrictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead. - * - * Tests for any deep inequality. Opposite of {@link deepEqual}. - * - * ```js - * import assert from 'node:assert'; - * - * const obj1 = { - * a: { - * b: 1, - * }, - * }; - * const obj2 = { - * a: { - * b: 2, - * }, - * }; - * const obj3 = { - * a: { - * b: 1, - * }, - * }; - * const obj4 = { __proto__: obj1 }; - * - * assert.notDeepEqual(obj1, obj1); - * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } - * - * assert.notDeepEqual(obj1, obj2); - * // OK - * - * assert.notDeepEqual(obj1, obj3); - * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } - * - * assert.notDeepEqual(obj1, obj4); - * // OK - * ``` - * - * If the values are deeply equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default - * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v0.1.21 - */ - function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * Tests strict equality between the `actual` and `expected` parameters as - * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.strictEqual(1, 2); - * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: - * // - * // 1 !== 2 - * - * assert.strictEqual(1, 1); - * // OK - * - * assert.strictEqual('Hello foobar', 'Hello World!'); - * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: - * // + actual - expected - * // - * // + 'Hello foobar' - * // - 'Hello World!' - * // ^ - * - * const apples = 1; - * const oranges = 2; - * assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`); - * // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2 - * - * assert.strictEqual(1, '1', new TypeError('Inputs are not identical')); - * // TypeError: Inputs are not identical - * ``` - * - * If the values are not strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a - * default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v0.1.21 - */ - function strictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; - /** - * Tests strict inequality between the `actual` and `expected` parameters as - * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.notStrictEqual(1, 2); - * // OK - * - * assert.notStrictEqual(1, 1); - * // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to: - * // - * // 1 - * - * assert.notStrictEqual(1, '1'); - * // OK - * ``` - * - * If the values are strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a - * default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v0.1.21 - */ - function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * Tests for deep equality between the `actual` and `expected` parameters. - * "Deep" equality means that the enumerable "own" properties of child objects - * are recursively evaluated also by the following rules. - * @since v1.2.0 - */ - function deepStrictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; - /** - * Tests for deep strict inequality. Opposite of {@link deepStrictEqual}. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.notDeepStrictEqual({ a: 1 }, { a: '1' }); - * // OK - * ``` - * - * If the values are deeply and strictly equal, an `AssertionError` is thrown - * with a `message` property set equal to the value of the `message` parameter. If - * the `message` parameter is undefined, a default error message is assigned. If - * the `message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v1.2.0 - */ - function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * Expects the function `fn` to throw an error. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, - * a validation object where each property will be tested for strict deep equality, - * or an instance of error where each property will be tested for strict deep - * equality including the non-enumerable `message` and `name` properties. When - * using an object, it is also possible to use a regular expression, when - * validating against a string property. See below for examples. - * - * If specified, `message` will be appended to the message provided by the `AssertionError` if the `fn` call fails to throw or in case the error validation - * fails. - * - * Custom validation object/error instance: - * - * ```js - * import assert from 'node:assert/strict'; - * - * const err = new TypeError('Wrong value'); - * err.code = 404; - * err.foo = 'bar'; - * err.info = { - * nested: true, - * baz: 'text', - * }; - * err.reg = /abc/i; - * - * assert.throws( - * () => { - * throw err; - * }, - * { - * name: 'TypeError', - * message: 'Wrong value', - * info: { - * nested: true, - * baz: 'text', - * }, - * // Only properties on the validation object will be tested for. - * // Using nested objects requires all properties to be present. Otherwise - * // the validation is going to fail. - * }, - * ); - * - * // Using regular expressions to validate error properties: - * assert.throws( - * () => { - * throw err; - * }, - * { - * // The `name` and `message` properties are strings and using regular - * // expressions on those will match against the string. If they fail, an - * // error is thrown. - * name: /^TypeError$/, - * message: /Wrong/, - * foo: 'bar', - * info: { - * nested: true, - * // It is not possible to use regular expressions for nested properties! - * baz: 'text', - * }, - * // The `reg` property contains a regular expression and only if the - * // validation object contains an identical regular expression, it is going - * // to pass. - * reg: /abc/i, - * }, - * ); - * - * // Fails due to the different `message` and `name` properties: - * assert.throws( - * () => { - * const otherErr = new Error('Not found'); - * // Copy all enumerable properties from `err` to `otherErr`. - * for (const [key, value] of Object.entries(err)) { - * otherErr[key] = value; - * } - * throw otherErr; - * }, - * // The error's `message` and `name` properties will also be checked when using - * // an error as validation object. - * err, - * ); - * ``` - * - * Validate instanceof using constructor: - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.throws( - * () => { - * throw new Error('Wrong value'); - * }, - * Error, - * ); - * ``` - * - * Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions): - * - * Using a regular expression runs `.toString` on the error object, and will - * therefore also include the error name. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.throws( - * () => { - * throw new Error('Wrong value'); - * }, - * /^Error: Wrong value$/, - * ); - * ``` - * - * Custom error validation: - * - * The function must return `true` to indicate all internal validations passed. - * It will otherwise fail with an `AssertionError`. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.throws( - * () => { - * throw new Error('Wrong value'); - * }, - * (err) => { - * assert(err instanceof Error); - * assert(/value/.test(err)); - * // Avoid returning anything from validation functions besides `true`. - * // Otherwise, it's not clear what part of the validation failed. Instead, - * // throw an error about the specific validation that failed (as done in this - * // example) and add as much helpful debugging information to that error as - * // possible. - * return true; - * }, - * 'unexpected error', - * ); - * ``` - * - * `error` cannot be a string. If a string is provided as the second - * argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Using the same - * message as the thrown error message is going to result in an `ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using - * a string as the second argument gets considered: - * - * ```js - * import assert from 'node:assert/strict'; - * - * function throwingFirst() { - * throw new Error('First'); - * } - * - * function throwingSecond() { - * throw new Error('Second'); - * } - * - * function notThrowing() {} - * - * // The second argument is a string and the input function threw an Error. - * // The first case will not throw as it does not match for the error message - * // thrown by the input function! - * assert.throws(throwingFirst, 'Second'); - * // In the next example the message has no benefit over the message from the - * // error and since it is not clear if the user intended to actually match - * // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error. - * assert.throws(throwingSecond, 'Second'); - * // TypeError [ERR_AMBIGUOUS_ARGUMENT] - * - * // The string is only used (as message) in case the function does not throw: - * assert.throws(notThrowing, 'Second'); - * // AssertionError [ERR_ASSERTION]: Missing expected exception: Second - * - * // If it was intended to match for the error message do this instead: - * // It does not throw because the error messages match. - * assert.throws(throwingSecond, /Second$/); - * - * // If the error message does not match, an AssertionError is thrown. - * assert.throws(throwingFirst, /Second$/); - * // AssertionError [ERR_ASSERTION] - * ``` - * - * Due to the confusing error-prone notation, avoid a string as the second - * argument. - * @since v0.1.21 - */ - function throws(block: () => unknown, message?: string | Error): void; - function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void; - /** - * Asserts that the function `fn` does not throw an error. - * - * Using `assert.doesNotThrow()` is actually not useful because there - * is no benefit in catching an error and then rethrowing it. Instead, consider - * adding a comment next to the specific code path that should not throw and keep - * error messages as expressive as possible. - * - * When `assert.doesNotThrow()` is called, it will immediately call the `fn` function. - * - * If an error is thrown and it is the same type as that specified by the `error` parameter, then an `AssertionError` is thrown. If the error is of a - * different type, or if the `error` parameter is undefined, the error is - * propagated back to the caller. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation - * function. See {@link throws} for more details. - * - * The following, for instance, will throw the `TypeError` because there is no - * matching error type in the assertion: - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotThrow( - * () => { - * throw new TypeError('Wrong value'); - * }, - * SyntaxError, - * ); - * ``` - * - * However, the following will result in an `AssertionError` with the message - * 'Got unwanted exception...': - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotThrow( - * () => { - * throw new TypeError('Wrong value'); - * }, - * TypeError, - * ); - * ``` - * - * If an `AssertionError` is thrown and a value is provided for the `message` parameter, the value of `message` will be appended to the `AssertionError` message: - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotThrow( - * () => { - * throw new TypeError('Wrong value'); - * }, - * /Wrong value/, - * 'Whoops', - * ); - * // Throws: AssertionError: Got unwanted exception: Whoops - * ``` - * @since v0.1.21 - */ - function doesNotThrow(block: () => unknown, message?: string | Error): void; - function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void; - /** - * Throws `value` if `value` is not `undefined` or `null`. This is useful when - * testing the `error` argument in callbacks. The stack trace contains all frames - * from the error passed to `ifError()` including the potential new frames for `ifError()` itself. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.ifError(null); - * // OK - * assert.ifError(0); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0 - * assert.ifError('error'); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error' - * assert.ifError(new Error()); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error - * - * // Create some random error frames. - * let err; - * (function errorFrame() { - * err = new Error('test error'); - * })(); - * - * (function ifErrorFrame() { - * assert.ifError(err); - * })(); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error - * // at ifErrorFrame - * // at errorFrame - * ``` - * @since v0.1.97 - */ - function ifError(value: unknown): asserts value is null | undefined; - /** - * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately - * calls the function and awaits the returned promise to complete. It will then - * check that the promise is rejected. - * - * If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the - * function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v22.x/api/errors.html#err_invalid_return_value) - * error. In both cases the error handler is skipped. - * - * Besides the async nature to await the completion behaves identically to {@link throws}. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, - * an object where each property will be tested for, or an instance of error where - * each property will be tested for including the non-enumerable `message` and `name` properties. - * - * If specified, `message` will be the message provided by the `{@link AssertionError}` if the `asyncFn` fails to reject. - * - * ```js - * import assert from 'node:assert/strict'; - * - * await assert.rejects( - * async () => { - * throw new TypeError('Wrong value'); - * }, - * { - * name: 'TypeError', - * message: 'Wrong value', - * }, - * ); - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * await assert.rejects( - * async () => { - * throw new TypeError('Wrong value'); - * }, - * (err) => { - * assert.strictEqual(err.name, 'TypeError'); - * assert.strictEqual(err.message, 'Wrong value'); - * return true; - * }, - * ); - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.rejects( - * Promise.reject(new Error('Wrong value')), - * Error, - * ).then(() => { - * // ... - * }); - * ``` - * - * `error` cannot be a string. If a string is provided as the second argument, then `error` is assumed to - * be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Please read the - * example in {@link throws} carefully if using a string as the second argument gets considered. - * @since v10.0.0 - */ - function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; - function rejects( - block: (() => Promise) | Promise, - error: AssertPredicate, - message?: string | Error, - ): Promise; - /** - * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately - * calls the function and awaits the returned promise to complete. It will then - * check that the promise is not rejected. - * - * If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If - * the function does not return a promise, `assert.doesNotReject()` will return a - * rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v22.x/api/errors.html#err_invalid_return_value) error. In both cases - * the error handler is skipped. - * - * Using `assert.doesNotReject()` is actually not useful because there is little - * benefit in catching a rejection and then rejecting it again. Instead, consider - * adding a comment next to the specific code path that should not reject and keep - * error messages as expressive as possible. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation - * function. See {@link throws} for more details. - * - * Besides the async nature to await the completion behaves identically to {@link doesNotThrow}. - * - * ```js - * import assert from 'node:assert/strict'; - * - * await assert.doesNotReject( - * async () => { - * throw new TypeError('Wrong value'); - * }, - * SyntaxError, - * ); - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotReject(Promise.reject(new TypeError('Wrong value'))) - * .then(() => { - * // ... - * }); - * ``` - * @since v10.0.0 - */ - function doesNotReject( - block: (() => Promise) | Promise, - message?: string | Error, - ): Promise; - function doesNotReject( - block: (() => Promise) | Promise, - error: AssertPredicate, - message?: string | Error, - ): Promise; - /** - * Expects the `string` input to match the regular expression. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.match('I will fail', /pass/); - * // AssertionError [ERR_ASSERTION]: The input did not match the regular ... - * - * assert.match(123, /pass/); - * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. - * - * assert.match('I will pass', /pass/); - * // OK - * ``` - * - * If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal - * to the value of the `message` parameter. If the `message` parameter is - * undefined, a default error message is assigned. If the `message` parameter is an - * instance of an [Error](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`. - * @since v13.6.0, v12.16.0 - */ - function match(value: string, regExp: RegExp, message?: string | Error): void; - /** - * Expects the `string` input not to match the regular expression. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotMatch('I will fail', /fail/); - * // AssertionError [ERR_ASSERTION]: The input was expected to not match the ... - * - * assert.doesNotMatch(123, /pass/); - * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. - * - * assert.doesNotMatch('I will pass', /different/); - * // OK - * ``` - * - * If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal - * to the value of the `message` parameter. If the `message` parameter is - * undefined, a default error message is assigned. If the `message` parameter is an - * instance of an [Error](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`. - * @since v13.6.0, v12.16.0 - */ - function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; - /** - * Tests for partial deep equality between the `actual` and `expected` parameters. - * "Deep" equality means that the enumerable "own" properties of child objects - * are recursively evaluated also by the following rules. "Partial" equality means - * that only properties that exist on the `expected` parameter are going to be - * compared. - * - * This method always passes the same test cases as `assert.deepStrictEqual()`, - * behaving as a super set of it. - * @since v22.13.0 - */ - function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; - } - namespace assert { - export { strict }; - } - export = assert; -} -declare module "node:assert" { - import assert = require("assert"); - export = assert; -} diff --git a/node_modules/@types/node/assert/strict.d.ts b/node_modules/@types/node/assert/strict.d.ts deleted file mode 100644 index 83ce1fe..0000000 --- a/node_modules/@types/node/assert/strict.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -/** - * In strict assertion mode, non-strict methods behave like their corresponding - * strict methods. For example, `assert.deepEqual()` will behave like - * `assert.deepStrictEqual()`. - * - * In strict assertion mode, error messages for objects display a diff. In legacy - * assertion mode, error messages for objects display the objects, often truncated. - * - * To use strict assertion mode: - * - * ```js - * import { strict as assert } from 'node:assert'; - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * ``` - * - * Example error diff: - * - * ```js - * import { strict as assert } from 'node:assert'; - * - * assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]); - * // AssertionError: Expected inputs to be strictly deep-equal: - * // + actual - expected ... Lines skipped - * // - * // [ - * // [ - * // ... - * // 2, - * // + 3 - * // - '3' - * // ], - * // ... - * // 5 - * // ] - * ``` - * - * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` - * environment variables. This will also deactivate the colors in the REPL. For - * more on color support in terminal environments, read the tty - * [`getColorDepth()`](https://nodejs.org/docs/latest-v22.x/api/tty.html#writestreamgetcolordepthenv) documentation. - * @since v15.0.0 - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/assert/strict.js) - */ -declare module "assert/strict" { - import { - Assert, - AssertionError, - AssertionErrorOptions, - AssertOptions, - AssertPredicate, - AssertStrict, - CallTracker, - CallTrackerCall, - CallTrackerReportInformation, - deepStrictEqual, - doesNotMatch, - doesNotReject, - doesNotThrow, - fail, - ifError, - match, - notDeepStrictEqual, - notStrictEqual, - ok, - partialDeepStrictEqual, - rejects, - strictEqual, - throws, - } from "node:assert"; - function strict(value: unknown, message?: string | Error): asserts value; - namespace strict { - export { - Assert, - AssertionError, - AssertionErrorOptions, - AssertOptions, - AssertPredicate, - AssertStrict, - CallTracker, - CallTrackerCall, - CallTrackerReportInformation, - deepStrictEqual, - deepStrictEqual as deepEqual, - doesNotMatch, - doesNotReject, - doesNotThrow, - fail, - ifError, - match, - notDeepStrictEqual, - notDeepStrictEqual as notDeepEqual, - notStrictEqual, - notStrictEqual as notEqual, - ok, - partialDeepStrictEqual, - rejects, - strict, - strictEqual, - strictEqual as equal, - throws, - }; - } - export = strict; -} -declare module "node:assert/strict" { - import strict = require("assert/strict"); - export = strict; -} diff --git a/node_modules/@types/node/async_hooks.d.ts b/node_modules/@types/node/async_hooks.d.ts deleted file mode 100644 index 01d21d4..0000000 --- a/node_modules/@types/node/async_hooks.d.ts +++ /dev/null @@ -1,603 +0,0 @@ -/** - * We strongly discourage the use of the `async_hooks` API. - * Other APIs that can cover most of its use cases include: - * - * * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v22.x/api/async_context.html#class-asynclocalstorage) tracks async context - * * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v22.x/api/process.html#processgetactiveresourcesinfo) tracks active resources - * - * The `node:async_hooks` module provides an API to track asynchronous resources. - * It can be accessed using: - * - * ```js - * import async_hooks from 'node:async_hooks'; - * ``` - * @experimental - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/async_hooks.js) - */ -declare module "async_hooks" { - /** - * ```js - * import { executionAsyncId } from 'node:async_hooks'; - * import fs from 'node:fs'; - * - * console.log(executionAsyncId()); // 1 - bootstrap - * const path = '.'; - * fs.open(path, 'r', (err, fd) => { - * console.log(executionAsyncId()); // 6 - open() - * }); - * ``` - * - * The ID returned from `executionAsyncId()` is related to execution timing, not - * causality (which is covered by `triggerAsyncId()`): - * - * ```js - * const server = net.createServer((conn) => { - * // Returns the ID of the server, not of the new connection, because the - * // callback runs in the execution scope of the server's MakeCallback(). - * async_hooks.executionAsyncId(); - * - * }).listen(port, () => { - * // Returns the ID of a TickObject (process.nextTick()) because all - * // callbacks passed to .listen() are wrapped in a nextTick(). - * async_hooks.executionAsyncId(); - * }); - * ``` - * - * Promise contexts may not get precise `executionAsyncIds` by default. - * See the section on [promise execution tracking](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html#promise-execution-tracking). - * @since v8.1.0 - * @return The `asyncId` of the current execution context. Useful to track when something calls. - */ - function executionAsyncId(): number; - /** - * Resource objects returned by `executionAsyncResource()` are most often internal - * Node.js handle objects with undocumented APIs. Using any functions or properties - * on the object is likely to crash your application and should be avoided. - * - * Using `executionAsyncResource()` in the top-level execution context will - * return an empty object as there is no handle or request object to use, - * but having an object representing the top-level can be helpful. - * - * ```js - * import { open } from 'node:fs'; - * import { executionAsyncId, executionAsyncResource } from 'node:async_hooks'; - * - * console.log(executionAsyncId(), executionAsyncResource()); // 1 {} - * open(new URL(import.meta.url), 'r', (err, fd) => { - * console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap - * }); - * ``` - * - * This can be used to implement continuation local storage without the - * use of a tracking `Map` to store the metadata: - * - * ```js - * import { createServer } from 'node:http'; - * import { - * executionAsyncId, - * executionAsyncResource, - * createHook, - * } from 'node:async_hooks'; - * const sym = Symbol('state'); // Private symbol to avoid pollution - * - * createHook({ - * init(asyncId, type, triggerAsyncId, resource) { - * const cr = executionAsyncResource(); - * if (cr) { - * resource[sym] = cr[sym]; - * } - * }, - * }).enable(); - * - * const server = createServer((req, res) => { - * executionAsyncResource()[sym] = { state: req.url }; - * setTimeout(function() { - * res.end(JSON.stringify(executionAsyncResource()[sym])); - * }, 100); - * }).listen(3000); - * ``` - * @since v13.9.0, v12.17.0 - * @return The resource representing the current execution. Useful to store data within the resource. - */ - function executionAsyncResource(): object; - /** - * ```js - * const server = net.createServer((conn) => { - * // The resource that caused (or triggered) this callback to be called - * // was that of the new connection. Thus the return value of triggerAsyncId() - * // is the asyncId of "conn". - * async_hooks.triggerAsyncId(); - * - * }).listen(port, () => { - * // Even though all callbacks passed to .listen() are wrapped in a nextTick() - * // the callback itself exists because the call to the server's .listen() - * // was made. So the return value would be the ID of the server. - * async_hooks.triggerAsyncId(); - * }); - * ``` - * - * Promise contexts may not get valid `triggerAsyncId`s by default. See - * the section on [promise execution tracking](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html#promise-execution-tracking). - * @return The ID of the resource responsible for calling the callback that is currently being executed. - */ - function triggerAsyncId(): number; - interface HookCallbacks { - /** - * Called when a class is constructed that has the possibility to emit an asynchronous event. - * @param asyncId A unique ID for the async resource - * @param type The type of the async resource - * @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created - * @param resource Reference to the resource representing the async operation, needs to be released during destroy - */ - init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; - /** - * When an asynchronous operation is initiated or completes a callback is called to notify the user. - * The before callback is called just before said callback is executed. - * @param asyncId the unique identifier assigned to the resource about to execute the callback. - */ - before?(asyncId: number): void; - /** - * Called immediately after the callback specified in `before` is completed. - * - * If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs. - * @param asyncId the unique identifier assigned to the resource which has executed the callback. - */ - after?(asyncId: number): void; - /** - * Called when a promise has resolve() called. This may not be in the same execution id - * as the promise itself. - * @param asyncId the unique id for the promise that was resolve()d. - */ - promiseResolve?(asyncId: number): void; - /** - * Called after the resource corresponding to asyncId is destroyed - * @param asyncId a unique ID for the async resource - */ - destroy?(asyncId: number): void; - } - interface AsyncHook { - /** - * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop. - */ - enable(): this; - /** - * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled. - */ - disable(): this; - } - /** - * Registers functions to be called for different lifetime events of each async - * operation. - * - * The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the - * respective asynchronous event during a resource's lifetime. - * - * All callbacks are optional. For example, if only resource cleanup needs to - * be tracked, then only the `destroy` callback needs to be passed. The - * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section. - * - * ```js - * import { createHook } from 'node:async_hooks'; - * - * const asyncHook = createHook({ - * init(asyncId, type, triggerAsyncId, resource) { }, - * destroy(asyncId) { }, - * }); - * ``` - * - * The callbacks will be inherited via the prototype chain: - * - * ```js - * class MyAsyncCallbacks { - * init(asyncId, type, triggerAsyncId, resource) { } - * destroy(asyncId) {} - * } - * - * class MyAddedCallbacks extends MyAsyncCallbacks { - * before(asyncId) { } - * after(asyncId) { } - * } - * - * const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); - * ``` - * - * Because promises are asynchronous resources whose lifecycle is tracked - * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises. - * @since v8.1.0 - * @param callbacks The `Hook Callbacks` to register - * @return Instance used for disabling and enabling hooks - */ - function createHook(callbacks: HookCallbacks): AsyncHook; - interface AsyncResourceOptions { - /** - * The ID of the execution context that created this async event. - * @default executionAsyncId() - */ - triggerAsyncId?: number | undefined; - /** - * Disables automatic `emitDestroy` when the object is garbage collected. - * This usually does not need to be set (even if `emitDestroy` is called - * manually), unless the resource's `asyncId` is retrieved and the - * sensitive API's `emitDestroy` is called with it. - * @default false - */ - requireManualDestroy?: boolean | undefined; - } - /** - * The class `AsyncResource` is designed to be extended by the embedder's async - * resources. Using this, users can easily trigger the lifetime events of their - * own resources. - * - * The `init` hook will trigger when an `AsyncResource` is instantiated. - * - * The following is an overview of the `AsyncResource` API. - * - * ```js - * import { AsyncResource, executionAsyncId } from 'node:async_hooks'; - * - * // AsyncResource() is meant to be extended. Instantiating a - * // new AsyncResource() also triggers init. If triggerAsyncId is omitted then - * // async_hook.executionAsyncId() is used. - * const asyncResource = new AsyncResource( - * type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }, - * ); - * - * // Run a function in the execution context of the resource. This will - * // * establish the context of the resource - * // * trigger the AsyncHooks before callbacks - * // * call the provided function `fn` with the supplied arguments - * // * trigger the AsyncHooks after callbacks - * // * restore the original execution context - * asyncResource.runInAsyncScope(fn, thisArg, ...args); - * - * // Call AsyncHooks destroy callbacks. - * asyncResource.emitDestroy(); - * - * // Return the unique ID assigned to the AsyncResource instance. - * asyncResource.asyncId(); - * - * // Return the trigger ID for the AsyncResource instance. - * asyncResource.triggerAsyncId(); - * ``` - */ - class AsyncResource { - /** - * AsyncResource() is meant to be extended. Instantiating a - * new AsyncResource() also triggers init. If triggerAsyncId is omitted then - * async_hook.executionAsyncId() is used. - * @param type The type of async event. - * @param triggerAsyncId The ID of the execution context that created - * this async event (default: `executionAsyncId()`), or an - * AsyncResourceOptions object (since v9.3.0) - */ - constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions); - /** - * Binds the given function to the current execution context. - * @since v14.8.0, v12.19.0 - * @param fn The function to bind to the current execution context. - * @param type An optional name to associate with the underlying `AsyncResource`. - */ - static bind any, ThisArg>( - fn: Func, - type?: string, - thisArg?: ThisArg, - ): Func; - /** - * Binds the given function to execute to this `AsyncResource`'s scope. - * @since v14.8.0, v12.19.0 - * @param fn The function to bind to the current `AsyncResource`. - */ - bind any>(fn: Func): Func; - /** - * Call the provided function with the provided arguments in the execution context - * of the async resource. This will establish the context, trigger the AsyncHooks - * before callbacks, call the function, trigger the AsyncHooks after callbacks, and - * then restore the original execution context. - * @since v9.6.0 - * @param fn The function to call in the execution context of this async resource. - * @param thisArg The receiver to be used for the function call. - * @param args Optional arguments to pass to the function. - */ - runInAsyncScope( - fn: (this: This, ...args: any[]) => Result, - thisArg?: This, - ...args: any[] - ): Result; - /** - * Call all `destroy` hooks. This should only ever be called once. An error will - * be thrown if it is called more than once. This **must** be manually called. If - * the resource is left to be collected by the GC then the `destroy` hooks will - * never be called. - * @return A reference to `asyncResource`. - */ - emitDestroy(): this; - /** - * @return The unique `asyncId` assigned to the resource. - */ - asyncId(): number; - /** - * @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor. - */ - triggerAsyncId(): number; - } - /** - * This class creates stores that stay coherent through asynchronous operations. - * - * While you can create your own implementation on top of the `node:async_hooks` module, `AsyncLocalStorage` should be preferred as it is a performant and memory - * safe implementation that involves significant optimizations that are non-obvious - * to implement. - * - * The following example uses `AsyncLocalStorage` to build a simple logger - * that assigns IDs to incoming HTTP requests and includes them in messages - * logged within each request. - * - * ```js - * import http from 'node:http'; - * import { AsyncLocalStorage } from 'node:async_hooks'; - * - * const asyncLocalStorage = new AsyncLocalStorage(); - * - * function logWithId(msg) { - * const id = asyncLocalStorage.getStore(); - * console.log(`${id !== undefined ? id : '-'}:`, msg); - * } - * - * let idSeq = 0; - * http.createServer((req, res) => { - * asyncLocalStorage.run(idSeq++, () => { - * logWithId('start'); - * // Imagine any chain of async operations here - * setImmediate(() => { - * logWithId('finish'); - * res.end(); - * }); - * }); - * }).listen(8080); - * - * http.get('http://localhost:8080'); - * http.get('http://localhost:8080'); - * // Prints: - * // 0: start - * // 0: finish - * // 1: start - * // 1: finish - * ``` - * - * Each instance of `AsyncLocalStorage` maintains an independent storage context. - * Multiple instances can safely exist simultaneously without risk of interfering - * with each other's data. - * @since v13.10.0, v12.17.0 - */ - class AsyncLocalStorage { - /** - * Binds the given function to the current execution context. - * @since v19.8.0 - * @param fn The function to bind to the current execution context. - * @return A new function that calls `fn` within the captured execution context. - */ - static bind any>(fn: Func): Func; - /** - * Captures the current execution context and returns a function that accepts a - * function as an argument. Whenever the returned function is called, it - * calls the function passed to it within the captured context. - * - * ```js - * const asyncLocalStorage = new AsyncLocalStorage(); - * const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot()); - * const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore())); - * console.log(result); // returns 123 - * ``` - * - * AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple - * async context tracking purposes, for example: - * - * ```js - * class Foo { - * #runInAsyncScope = AsyncLocalStorage.snapshot(); - * - * get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); } - * } - * - * const foo = asyncLocalStorage.run(123, () => new Foo()); - * console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123 - * ``` - * @since v19.8.0 - * @return A new function with the signature `(fn: (...args) : R, ...args) : R`. - */ - static snapshot(): (fn: (...args: TArgs) => R, ...args: TArgs) => R; - /** - * Disables the instance of `AsyncLocalStorage`. All subsequent calls - * to `asyncLocalStorage.getStore()` will return `undefined` until `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again. - * - * When calling `asyncLocalStorage.disable()`, all current contexts linked to the - * instance will be exited. - * - * Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores - * provided by the `asyncLocalStorage`, as those objects are garbage collected - * along with the corresponding async resources. - * - * Use this method when the `asyncLocalStorage` is not in use anymore - * in the current process. - * @since v13.10.0, v12.17.0 - * @experimental - */ - disable(): void; - /** - * Returns the current store. - * If called outside of an asynchronous context initialized by - * calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it - * returns `undefined`. - * @since v13.10.0, v12.17.0 - */ - getStore(): T | undefined; - /** - * Runs a function synchronously within a context and returns its - * return value. The store is not accessible outside of the callback function. - * The store is accessible to any asynchronous operations created within the - * callback. - * - * The optional `args` are passed to the callback function. - * - * If the callback function throws an error, the error is thrown by `run()` too. - * The stacktrace is not impacted by this call and the context is exited. - * - * Example: - * - * ```js - * const store = { id: 2 }; - * try { - * asyncLocalStorage.run(store, () => { - * asyncLocalStorage.getStore(); // Returns the store object - * setTimeout(() => { - * asyncLocalStorage.getStore(); // Returns the store object - * }, 200); - * throw new Error(); - * }); - * } catch (e) { - * asyncLocalStorage.getStore(); // Returns undefined - * // The error will be caught here - * } - * ``` - * @since v13.10.0, v12.17.0 - */ - run(store: T, callback: () => R): R; - run(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R; - /** - * Runs a function synchronously outside of a context and returns its - * return value. The store is not accessible within the callback function or - * the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`. - * - * The optional `args` are passed to the callback function. - * - * If the callback function throws an error, the error is thrown by `exit()` too. - * The stacktrace is not impacted by this call and the context is re-entered. - * - * Example: - * - * ```js - * // Within a call to run - * try { - * asyncLocalStorage.getStore(); // Returns the store object or value - * asyncLocalStorage.exit(() => { - * asyncLocalStorage.getStore(); // Returns undefined - * throw new Error(); - * }); - * } catch (e) { - * asyncLocalStorage.getStore(); // Returns the same object or value - * // The error will be caught here - * } - * ``` - * @since v13.10.0, v12.17.0 - * @experimental - */ - exit(callback: (...args: TArgs) => R, ...args: TArgs): R; - /** - * Transitions into the context for the remainder of the current - * synchronous execution and then persists the store through any following - * asynchronous calls. - * - * Example: - * - * ```js - * const store = { id: 1 }; - * // Replaces previous store with the given store object - * asyncLocalStorage.enterWith(store); - * asyncLocalStorage.getStore(); // Returns the store object - * someAsyncOperation(() => { - * asyncLocalStorage.getStore(); // Returns the same object - * }); - * ``` - * - * This transition will continue for the _entire_ synchronous execution. - * This means that if, for example, the context is entered within an event - * handler subsequent event handlers will also run within that context unless - * specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons - * to use the latter method. - * - * ```js - * const store = { id: 1 }; - * - * emitter.on('my-event', () => { - * asyncLocalStorage.enterWith(store); - * }); - * emitter.on('my-event', () => { - * asyncLocalStorage.getStore(); // Returns the same object - * }); - * - * asyncLocalStorage.getStore(); // Returns undefined - * emitter.emit('my-event'); - * asyncLocalStorage.getStore(); // Returns the same object - * ``` - * @since v13.11.0, v12.17.0 - * @experimental - */ - enterWith(store: T): void; - } - /** - * @since v17.2.0, v16.14.0 - * @return A map of provider types to the corresponding numeric id. - * This map contains all the event types that might be emitted by the `async_hooks.init()` event. - */ - namespace asyncWrapProviders { - const NONE: number; - const DIRHANDLE: number; - const DNSCHANNEL: number; - const ELDHISTOGRAM: number; - const FILEHANDLE: number; - const FILEHANDLECLOSEREQ: number; - const FIXEDSIZEBLOBCOPY: number; - const FSEVENTWRAP: number; - const FSREQCALLBACK: number; - const FSREQPROMISE: number; - const GETADDRINFOREQWRAP: number; - const GETNAMEINFOREQWRAP: number; - const HEAPSNAPSHOT: number; - const HTTP2SESSION: number; - const HTTP2STREAM: number; - const HTTP2PING: number; - const HTTP2SETTINGS: number; - const HTTPINCOMINGMESSAGE: number; - const HTTPCLIENTREQUEST: number; - const JSSTREAM: number; - const JSUDPWRAP: number; - const MESSAGEPORT: number; - const PIPECONNECTWRAP: number; - const PIPESERVERWRAP: number; - const PIPEWRAP: number; - const PROCESSWRAP: number; - const PROMISE: number; - const QUERYWRAP: number; - const SHUTDOWNWRAP: number; - const SIGNALWRAP: number; - const STATWATCHER: number; - const STREAMPIPE: number; - const TCPCONNECTWRAP: number; - const TCPSERVERWRAP: number; - const TCPWRAP: number; - const TTYWRAP: number; - const UDPSENDWRAP: number; - const UDPWRAP: number; - const SIGINTWATCHDOG: number; - const WORKER: number; - const WORKERHEAPSNAPSHOT: number; - const WRITEWRAP: number; - const ZLIB: number; - const CHECKPRIMEREQUEST: number; - const PBKDF2REQUEST: number; - const KEYPAIRGENREQUEST: number; - const KEYGENREQUEST: number; - const KEYEXPORTREQUEST: number; - const CIPHERREQUEST: number; - const DERIVEBITSREQUEST: number; - const HASHREQUEST: number; - const RANDOMBYTESREQUEST: number; - const RANDOMPRIMEREQUEST: number; - const SCRYPTREQUEST: number; - const SIGNREQUEST: number; - const TLSWRAP: number; - const VERIFYREQUEST: number; - } -} -declare module "node:async_hooks" { - export * from "async_hooks"; -} diff --git a/node_modules/@types/node/buffer.buffer.d.ts b/node_modules/@types/node/buffer.buffer.d.ts deleted file mode 100644 index 8823dee..0000000 --- a/node_modules/@types/node/buffer.buffer.d.ts +++ /dev/null @@ -1,472 +0,0 @@ -declare module "buffer" { - type ImplicitArrayBuffer> = T extends - { valueOf(): infer V extends ArrayBufferLike } ? V : T; - global { - interface BufferConstructor { - // see buffer.d.ts for implementation shared with all TypeScript versions - - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. - */ - new(str: string, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). - */ - new(size: number): Buffer; - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - new(array: ArrayLike): Buffer; - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}/{SharedArrayBuffer}. - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. - */ - new(arrayBuffer: TArrayBuffer): Buffer; - /** - * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. - * Array entries outside that range will be truncated to fit into it. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'. - * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); - * ``` - * - * If `array` is an `Array`-like object (that is, one with a `length` property of - * type `number`), it is treated as if it is an array, unless it is a `Buffer` or - * a `Uint8Array`. This means all other `TypedArray` variants get treated as an - * `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use - * `Buffer.copyBytesFrom()`. - * - * A `TypeError` will be thrown if `array` is not an `Array` or another type - * appropriate for `Buffer.from()` variants. - * - * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal - * `Buffer` pool like `Buffer.allocUnsafe()` does. - * @since v5.10.0 - */ - from(array: WithImplicitCoercion>): Buffer; - /** - * This creates a view of the `ArrayBuffer` without copying the underlying - * memory. For example, when passed a reference to the `.buffer` property of a - * `TypedArray` instance, the newly created `Buffer` will share the same - * allocated memory as the `TypedArray`'s underlying `ArrayBuffer`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const arr = new Uint16Array(2); - * - * arr[0] = 5000; - * arr[1] = 4000; - * - * // Shares memory with `arr`. - * const buf = Buffer.from(arr.buffer); - * - * console.log(buf); - * // Prints: - * - * // Changing the original Uint16Array changes the Buffer also. - * arr[1] = 6000; - * - * console.log(buf); - * // Prints: - * ``` - * - * The optional `byteOffset` and `length` arguments specify a memory range within - * the `arrayBuffer` that will be shared by the `Buffer`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const ab = new ArrayBuffer(10); - * const buf = Buffer.from(ab, 0, 2); - * - * console.log(buf.length); - * // Prints: 2 - * ``` - * - * A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer` or a - * `SharedArrayBuffer` or another type appropriate for `Buffer.from()` - * variants. - * - * It is important to remember that a backing `ArrayBuffer` can cover a range - * of memory that extends beyond the bounds of a `TypedArray` view. A new - * `Buffer` created using the `buffer` property of a `TypedArray` may extend - * beyond the range of the `TypedArray`: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements - * const arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements - * console.log(arrA.buffer === arrB.buffer); // true - * - * const buf = Buffer.from(arrB.buffer); - * console.log(buf); - * // Prints: - * ``` - * @since v5.10.0 - * @param arrayBuffer An `ArrayBuffer`, `SharedArrayBuffer`, for example the - * `.buffer` property of a `TypedArray`. - * @param byteOffset Index of first byte to expose. **Default:** `0`. - * @param length Number of bytes to expose. **Default:** - * `arrayBuffer.byteLength - byteOffset`. - */ - from>( - arrayBuffer: TArrayBuffer, - byteOffset?: number, - length?: number, - ): Buffer>; - /** - * Creates a new `Buffer` containing `string`. The `encoding` parameter identifies - * the character encoding to be used when converting `string` into bytes. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('this is a tést'); - * const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); - * - * console.log(buf1.toString()); - * // Prints: this is a tést - * console.log(buf2.toString()); - * // Prints: this is a tést - * console.log(buf1.toString('latin1')); - * // Prints: this is a tést - * ``` - * - * A `TypeError` will be thrown if `string` is not a string or another type - * appropriate for `Buffer.from()` variants. - * - * `Buffer.from(string)` may also use the internal `Buffer` pool like - * `Buffer.allocUnsafe()` does. - * @since v5.10.0 - * @param string A string to encode. - * @param encoding The encoding of `string`. **Default:** `'utf8'`. - */ - from(string: WithImplicitCoercion, encoding?: BufferEncoding): Buffer; - from(arrayOrString: WithImplicitCoercion | string>): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param values to create a new Buffer - */ - of(...items: number[]): Buffer; - /** - * Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together. - * - * If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned. - * - * If `totalLength` is not provided, it is calculated from the `Buffer` instances - * in `list` by adding their lengths. - * - * If `totalLength` is provided, it is coerced to an unsigned integer. If the - * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is - * truncated to `totalLength`. If the combined length of the `Buffer`s in `list` is - * less than `totalLength`, the remaining space is filled with zeros. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a single `Buffer` from a list of three `Buffer` instances. - * - * const buf1 = Buffer.alloc(10); - * const buf2 = Buffer.alloc(14); - * const buf3 = Buffer.alloc(18); - * const totalLength = buf1.length + buf2.length + buf3.length; - * - * console.log(totalLength); - * // Prints: 42 - * - * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength); - * - * console.log(bufA); - * // Prints: - * console.log(bufA.length); - * // Prints: 42 - * ``` - * - * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does. - * @since v0.7.11 - * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate. - * @param totalLength Total length of the `Buffer` instances in `list` when concatenated. - */ - concat(list: readonly Uint8Array[], totalLength?: number): Buffer; - /** - * Copies the underlying memory of `view` into a new `Buffer`. - * - * ```js - * const u16 = new Uint16Array([0, 0xffff]); - * const buf = Buffer.copyBytesFrom(u16, 1, 1); - * u16[1] = 0; - * console.log(buf.length); // 2 - * console.log(buf[0]); // 255 - * console.log(buf[1]); // 255 - * ``` - * @since v19.8.0 - * @param view The {TypedArray} to copy. - * @param [offset=0] The starting offset within `view`. - * @param [length=view.length - offset] The number of elements from `view` to copy. - */ - copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer; - /** - * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(5); - * - * console.log(buf); - * // Prints: - * ``` - * - * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. - * - * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(5, 'a'); - * - * console.log(buf); - * // Prints: - * ``` - * - * If both `fill` and `encoding` are specified, the allocated `Buffer` will be - * initialized by calling `buf.fill(fill, encoding)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); - * - * console.log(buf); - * // Prints: - * ``` - * - * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance - * contents will never contain sensitive data from previous allocations, including - * data that might not have been allocated for `Buffer`s. - * - * A `TypeError` will be thrown if `size` is not a number. - * @since v5.10.0 - * @param size The desired length of the new `Buffer`. - * @param [fill=0] A value to pre-fill the new `Buffer` with. - * @param [encoding='utf8'] If `fill` is a string, this is its encoding. - */ - alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. - * - * The underlying memory for `Buffer` instances created in this way is _not_ - * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(10); - * - * console.log(buf); - * // Prints (contents may vary): - * - * buf.fill(0); - * - * console.log(buf); - * // Prints: - * ``` - * - * A `TypeError` will be thrown if `size` is not a number. - * - * The `Buffer` module pre-allocates an internal `Buffer` instance of - * size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`, - * and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two). - * - * Use of this pre-allocated internal memory pool is a key difference between - * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. - * Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less - * than or equal to half `Buffer.poolSize`. The - * difference is subtle but can be important when an application requires the - * additional performance that `Buffer.allocUnsafe()` provides. - * @since v5.10.0 - * @param size The desired length of the new `Buffer`. - */ - allocUnsafe(size: number): Buffer; - /** - * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if - * `size` is 0. - * - * The underlying memory for `Buffer` instances created in this way is _not_ - * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize - * such `Buffer` instances with zeroes. - * - * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, - * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This - * allows applications to avoid the garbage collection overhead of creating many - * individually allocated `Buffer` instances. This approach improves both - * performance and memory usage by eliminating the need to track and clean up as - * many individual `ArrayBuffer` objects. - * - * However, in the case where a developer may need to retain a small chunk of - * memory from a pool for an indeterminate amount of time, it may be appropriate - * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and - * then copying out the relevant bits. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Need to keep around a few small chunks of memory. - * const store = []; - * - * socket.on('readable', () => { - * let data; - * while (null !== (data = readable.read())) { - * // Allocate for retained data. - * const sb = Buffer.allocUnsafeSlow(10); - * - * // Copy the data into the new allocation. - * data.copy(sb, 0, 0, 10); - * - * store.push(sb); - * } - * }); - * ``` - * - * A `TypeError` will be thrown if `size` is not a number. - * @since v5.12.0 - * @param size The desired length of the new `Buffer`. - */ - allocUnsafeSlow(size: number): Buffer; - } - interface Buffer extends Uint8Array { - // see buffer.d.ts for implementation shared with all TypeScript versions - - /** - * Returns a new `Buffer` that references the same memory as the original, but - * offset and cropped by the `start` and `end` indices. - * - * This method is not compatible with the `Uint8Array.prototype.slice()`, - * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * const copiedBuf = Uint8Array.prototype.slice.call(buf); - * copiedBuf[0]++; - * console.log(copiedBuf.toString()); - * // Prints: cuffer - * - * console.log(buf.toString()); - * // Prints: buffer - * - * // With buf.slice(), the original buffer is modified. - * const notReallyCopiedBuf = buf.slice(); - * notReallyCopiedBuf[0]++; - * console.log(notReallyCopiedBuf.toString()); - * // Prints: cuffer - * console.log(buf.toString()); - * // Also prints: cuffer (!) - * ``` - * @since v0.3.0 - * @deprecated Use `subarray` instead. - * @param [start=0] Where the new `Buffer` will start. - * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). - */ - slice(start?: number, end?: number): Buffer; - /** - * Returns a new `Buffer` that references the same memory as the original, but - * offset and cropped by the `start` and `end` indices. - * - * Specifying `end` greater than `buf.length` will return the same result as - * that of `end` equal to `buf.length`. - * - * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). - * - * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte - * // from the original `Buffer`. - * - * const buf1 = Buffer.allocUnsafe(26); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf1[i] = i + 97; - * } - * - * const buf2 = buf1.subarray(0, 3); - * - * console.log(buf2.toString('ascii', 0, buf2.length)); - * // Prints: abc - * - * buf1[0] = 33; - * - * console.log(buf2.toString('ascii', 0, buf2.length)); - * // Prints: !bc - * ``` - * - * Specifying negative indexes causes the slice to be generated relative to the - * end of `buf` rather than the beginning. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * console.log(buf.subarray(-6, -1).toString()); - * // Prints: buffe - * // (Equivalent to buf.subarray(0, 5).) - * - * console.log(buf.subarray(-6, -2).toString()); - * // Prints: buff - * // (Equivalent to buf.subarray(0, 4).) - * - * console.log(buf.subarray(-5, -2).toString()); - * // Prints: uff - * // (Equivalent to buf.subarray(1, 4).) - * ``` - * @since v3.0.0 - * @param [start=0] Where the new `Buffer` will start. - * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). - */ - subarray(start?: number, end?: number): Buffer; - } - // TODO: remove globals in future version - /** - * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports - * TypeScript versions earlier than 5.7. - */ - type NonSharedBuffer = Buffer; - /** - * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports - * TypeScript versions earlier than 5.7. - */ - type AllowSharedBuffer = Buffer; - } - /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ - var SlowBuffer: { - /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ - new(size: number): Buffer; - prototype: Buffer; - }; -} diff --git a/node_modules/@types/node/buffer.d.ts b/node_modules/@types/node/buffer.d.ts deleted file mode 100644 index 354e08a..0000000 --- a/node_modules/@types/node/buffer.d.ts +++ /dev/null @@ -1,1934 +0,0 @@ -// If lib.dom.d.ts or lib.webworker.d.ts is loaded, then use the global types. -// Otherwise, use the types from node. -type _Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : import("buffer").Blob; -type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : import("buffer").File; - -/** - * `Buffer` objects are used to represent a fixed-length sequence of bytes. Many - * Node.js APIs support `Buffer`s. - * - * The `Buffer` class is a subclass of JavaScript's [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class and - * extends it with methods that cover additional use cases. Node.js APIs accept - * plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) s wherever `Buffer`s are supported as well. - * - * While the `Buffer` class is available within the global scope, it is still - * recommended to explicitly reference it via an import or require statement. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Creates a zero-filled Buffer of length 10. - * const buf1 = Buffer.alloc(10); - * - * // Creates a Buffer of length 10, - * // filled with bytes which all have the value `1`. - * const buf2 = Buffer.alloc(10, 1); - * - * // Creates an uninitialized buffer of length 10. - * // This is faster than calling Buffer.alloc() but the returned - * // Buffer instance might contain old data that needs to be - * // overwritten using fill(), write(), or other functions that fill the Buffer's - * // contents. - * const buf3 = Buffer.allocUnsafe(10); - * - * // Creates a Buffer containing the bytes [1, 2, 3]. - * const buf4 = Buffer.from([1, 2, 3]); - * - * // Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries - * // are all truncated using `(value & 255)` to fit into the range 0–255. - * const buf5 = Buffer.from([257, 257.5, -255, '1']); - * - * // Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést': - * // [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation) - * // [116, 195, 169, 115, 116] (in decimal notation) - * const buf6 = Buffer.from('tést'); - * - * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74]. - * const buf7 = Buffer.from('tést', 'latin1'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/buffer.js) - */ -declare module "buffer" { - import { BinaryLike } from "node:crypto"; - import { ReadableStream as WebReadableStream } from "node:stream/web"; - /** - * This function returns `true` if `input` contains only valid UTF-8-encoded data, - * including the case in which `input` is empty. - * - * Throws if the `input` is a detached array buffer. - * @since v19.4.0, v18.14.0 - * @param input The input to validate. - */ - export function isUtf8(input: ArrayBuffer | NodeJS.TypedArray): boolean; - /** - * This function returns `true` if `input` contains only valid ASCII-encoded data, - * including the case in which `input` is empty. - * - * Throws if the `input` is a detached array buffer. - * @since v19.6.0, v18.15.0 - * @param input The input to validate. - */ - export function isAscii(input: ArrayBuffer | NodeJS.TypedArray): boolean; - export let INSPECT_MAX_BYTES: number; - export const kMaxLength: number; - export const kStringMaxLength: number; - export const constants: { - MAX_LENGTH: number; - MAX_STRING_LENGTH: number; - }; - export type TranscodeEncoding = - | "ascii" - | "utf8" - | "utf-8" - | "utf16le" - | "utf-16le" - | "ucs2" - | "ucs-2" - | "latin1" - | "binary"; - /** - * Re-encodes the given `Buffer` or `Uint8Array` instance from one character - * encoding to another. Returns a new `Buffer` instance. - * - * Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if - * conversion from `fromEnc` to `toEnc` is not permitted. - * - * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`, `'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`. - * - * The transcoding process will use substitution characters if a given byte - * sequence cannot be adequately represented in the target encoding. For instance: - * - * ```js - * import { Buffer, transcode } from 'node:buffer'; - * - * const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii'); - * console.log(newBuf.toString('ascii')); - * // Prints: '?' - * ``` - * - * Because the Euro (`€`) sign is not representable in US-ASCII, it is replaced - * with `?` in the transcoded `Buffer`. - * @since v7.1.0 - * @param source A `Buffer` or `Uint8Array` instance. - * @param fromEnc The current encoding. - * @param toEnc To target encoding. - */ - export function transcode( - source: Uint8Array, - fromEnc: TranscodeEncoding, - toEnc: TranscodeEncoding, - ): NonSharedBuffer; - /** - * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using - * a prior call to `URL.createObjectURL()`. - * @since v16.7.0 - * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. - */ - export function resolveObjectURL(id: string): Blob | undefined; - export { type AllowSharedBuffer, Buffer, type NonSharedBuffer }; - /** - * @experimental - */ - export interface BlobOptions { - /** - * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts - * will be converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`. - */ - endings?: "transparent" | "native"; - /** - * The Blob content-type. The intent is for `type` to convey - * the MIME media type of the data, however no validation of the type format - * is performed. - */ - type?: string | undefined; - } - /** - * A `Blob` encapsulates immutable, raw data that can be safely shared across - * multiple worker threads. - * @since v15.7.0, v14.18.0 - */ - export class Blob { - /** - * The total size of the `Blob` in bytes. - * @since v15.7.0, v14.18.0 - */ - readonly size: number; - /** - * The content-type of the `Blob`. - * @since v15.7.0, v14.18.0 - */ - readonly type: string; - /** - * Creates a new `Blob` object containing a concatenation of the given sources. - * - * {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into - * the 'Blob' and can therefore be safely modified after the 'Blob' is created. - * - * String sources are also copied into the `Blob`. - */ - constructor(sources: Array, options?: BlobOptions); - /** - * Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of - * the `Blob` data. - * @since v15.7.0, v14.18.0 - */ - arrayBuffer(): Promise; - /** - * The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise`. - * - * ```js - * const blob = new Blob(['hello']); - * blob.bytes().then((bytes) => { - * console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ] - * }); - * ``` - */ - bytes(): Promise; - /** - * Creates and returns a new `Blob` containing a subset of this `Blob` objects - * data. The original `Blob` is not altered. - * @since v15.7.0, v14.18.0 - * @param start The starting index. - * @param end The ending index. - * @param type The content-type for the new `Blob` - */ - slice(start?: number, end?: number, type?: string): Blob; - /** - * Returns a promise that fulfills with the contents of the `Blob` decoded as a - * UTF-8 string. - * @since v15.7.0, v14.18.0 - */ - text(): Promise; - /** - * Returns a new `ReadableStream` that allows the content of the `Blob` to be read. - * @since v16.7.0 - */ - stream(): WebReadableStream; - } - export interface FileOptions { - /** - * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be - * converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`. - */ - endings?: "native" | "transparent"; - /** The File content-type. */ - type?: string; - /** The last modified date of the file. `Default`: Date.now(). */ - lastModified?: number; - } - /** - * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files. - * @since v19.2.0, v18.13.0 - */ - export class File extends Blob { - constructor(sources: Array, fileName: string, options?: FileOptions); - /** - * The name of the `File`. - * @since v19.2.0, v18.13.0 - */ - readonly name: string; - /** - * The last modified date of the `File`. - * @since v19.2.0, v18.13.0 - */ - readonly lastModified: number; - } - export import atob = globalThis.atob; - export import btoa = globalThis.btoa; - export type WithImplicitCoercion = - | T - | { valueOf(): T } - | (T extends string ? { [Symbol.toPrimitive](hint: "string"): T } : never); - global { - namespace NodeJS { - export { BufferEncoding }; - } - // Buffer class - type BufferEncoding = - | "ascii" - | "utf8" - | "utf-8" - | "utf16le" - | "utf-16le" - | "ucs2" - | "ucs-2" - | "base64" - | "base64url" - | "latin1" - | "binary" - | "hex"; - /** - * Raw data is stored in instances of the Buffer class. - * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. - * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex' - */ - interface BufferConstructor { - // see buffer.buffer.d.ts for implementation specific to TypeScript 5.7 and later - // see ts5.6/buffer.buffer.d.ts for implementation specific to TypeScript 5.6 and earlier - - /** - * Returns `true` if `obj` is a `Buffer`, `false` otherwise. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * Buffer.isBuffer(Buffer.alloc(10)); // true - * Buffer.isBuffer(Buffer.from('foo')); // true - * Buffer.isBuffer('a string'); // false - * Buffer.isBuffer([]); // false - * Buffer.isBuffer(new Uint8Array(1024)); // false - * ``` - * @since v0.1.101 - */ - isBuffer(obj: any): obj is Buffer; - /** - * Returns `true` if `encoding` is the name of a supported character encoding, - * or `false` otherwise. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * console.log(Buffer.isEncoding('utf8')); - * // Prints: true - * - * console.log(Buffer.isEncoding('hex')); - * // Prints: true - * - * console.log(Buffer.isEncoding('utf/8')); - * // Prints: false - * - * console.log(Buffer.isEncoding('')); - * // Prints: false - * ``` - * @since v0.9.1 - * @param encoding A character encoding name to check. - */ - isEncoding(encoding: string): encoding is BufferEncoding; - /** - * Returns the byte length of a string when encoded using `encoding`. - * This is not the same as [`String.prototype.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), which does not account - * for the encoding that is used to convert the string into bytes. - * - * For `'base64'`, `'base64url'`, and `'hex'`, this function assumes valid input. - * For strings that contain non-base64/hex-encoded data (e.g. whitespace), the - * return value might be greater than the length of a `Buffer` created from the - * string. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const str = '\u00bd + \u00bc = \u00be'; - * - * console.log(`${str}: ${str.length} characters, ` + - * `${Buffer.byteLength(str, 'utf8')} bytes`); - * // Prints: ½ + ¼ = ¾: 9 characters, 12 bytes - * ``` - * - * When `string` is a - * `Buffer`/[`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)/[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/- - * Reference/Global_Objects/TypedArray)/[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)/[`SharedArrayBuffer`](https://develop- - * er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), the byte length as reported by `.byteLength`is returned. - * @since v0.1.90 - * @param string A value to calculate the length of. - * @param [encoding='utf8'] If `string` is a string, this is its encoding. - * @return The number of bytes contained within `string`. - */ - byteLength( - string: string | NodeJS.ArrayBufferView | ArrayBufferLike, - encoding?: BufferEncoding, - ): number; - /** - * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('1234'); - * const buf2 = Buffer.from('0123'); - * const arr = [buf1, buf2]; - * - * console.log(arr.sort(Buffer.compare)); - * // Prints: [ , ] - * // (This result is equal to: [buf2, buf1].) - * ``` - * @since v0.11.13 - * @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details. - */ - compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1; - /** - * This is the size (in bytes) of pre-allocated internal `Buffer` instances used - * for pooling. This value may be modified. - * @since v0.11.3 - */ - poolSize: number; - } - interface Buffer { - // see buffer.buffer.d.ts for implementation specific to TypeScript 5.7 and later - // see ts5.6/buffer.buffer.d.ts for implementation specific to TypeScript 5.6 and earlier - - /** - * Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did - * not contain enough space to fit the entire string, only part of `string` will be - * written. However, partially encoded characters will not be written. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(256); - * - * const len = buf.write('\u00bd + \u00bc = \u00be', 0); - * - * console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); - * // Prints: 12 bytes: ½ + ¼ = ¾ - * - * const buffer = Buffer.alloc(10); - * - * const length = buffer.write('abcd', 8); - * - * console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`); - * // Prints: 2 bytes : ab - * ``` - * @since v0.1.90 - * @param string String to write to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write `string`. - * @param [length=buf.length - offset] Maximum number of bytes to write (written bytes will not exceed `buf.length - offset`). - * @param [encoding='utf8'] The character encoding of `string`. - * @return Number of bytes written. - */ - write(string: string, encoding?: BufferEncoding): number; - write(string: string, offset: number, encoding?: BufferEncoding): number; - write(string: string, offset: number, length: number, encoding?: BufferEncoding): number; - /** - * Decodes `buf` to a string according to the specified character encoding in`encoding`. `start` and `end` may be passed to decode only a subset of `buf`. - * - * If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8, - * then each invalid byte is replaced with the replacement character `U+FFFD`. - * - * The maximum length of a string instance (in UTF-16 code units) is available - * as {@link constants.MAX_STRING_LENGTH}. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.allocUnsafe(26); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf1[i] = i + 97; - * } - * - * console.log(buf1.toString('utf8')); - * // Prints: abcdefghijklmnopqrstuvwxyz - * console.log(buf1.toString('utf8', 0, 5)); - * // Prints: abcde - * - * const buf2 = Buffer.from('tést'); - * - * console.log(buf2.toString('hex')); - * // Prints: 74c3a97374 - * console.log(buf2.toString('utf8', 0, 3)); - * // Prints: té - * console.log(buf2.toString(undefined, 0, 3)); - * // Prints: té - * ``` - * @since v0.1.90 - * @param [encoding='utf8'] The character encoding to use. - * @param [start=0] The byte offset to start decoding at. - * @param [end=buf.length] The byte offset to stop decoding at (not inclusive). - */ - toString(encoding?: BufferEncoding, start?: number, end?: number): string; - /** - * Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) implicitly calls - * this function when stringifying a `Buffer` instance. - * - * `Buffer.from()` accepts objects in the format returned from this method. - * In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]); - * const json = JSON.stringify(buf); - * - * console.log(json); - * // Prints: {"type":"Buffer","data":[1,2,3,4,5]} - * - * const copy = JSON.parse(json, (key, value) => { - * return value && value.type === 'Buffer' ? - * Buffer.from(value) : - * value; - * }); - * - * console.log(copy); - * // Prints: - * ``` - * @since v0.9.2 - */ - toJSON(): { - type: "Buffer"; - data: number[]; - }; - /** - * Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('ABC'); - * const buf2 = Buffer.from('414243', 'hex'); - * const buf3 = Buffer.from('ABCD'); - * - * console.log(buf1.equals(buf2)); - * // Prints: true - * console.log(buf1.equals(buf3)); - * // Prints: false - * ``` - * @since v0.11.13 - * @param otherBuffer A `Buffer` or {@link Uint8Array} with which to compare `buf`. - */ - equals(otherBuffer: Uint8Array): boolean; - /** - * Compares `buf` with `target` and returns a number indicating whether `buf`comes before, after, or is the same as `target` in sort order. - * Comparison is based on the actual sequence of bytes in each `Buffer`. - * - * * `0` is returned if `target` is the same as `buf` - * * `1` is returned if `target` should come _before_`buf` when sorted. - * * `-1` is returned if `target` should come _after_`buf` when sorted. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('ABC'); - * const buf2 = Buffer.from('BCD'); - * const buf3 = Buffer.from('ABCD'); - * - * console.log(buf1.compare(buf1)); - * // Prints: 0 - * console.log(buf1.compare(buf2)); - * // Prints: -1 - * console.log(buf1.compare(buf3)); - * // Prints: -1 - * console.log(buf2.compare(buf1)); - * // Prints: 1 - * console.log(buf2.compare(buf3)); - * // Prints: 1 - * console.log([buf1, buf2, buf3].sort(Buffer.compare)); - * // Prints: [ , , ] - * // (This result is equal to: [buf1, buf3, buf2].) - * ``` - * - * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd` arguments can be used to limit the comparison to specific ranges within `target` and `buf` respectively. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]); - * const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]); - * - * console.log(buf1.compare(buf2, 5, 9, 0, 4)); - * // Prints: 0 - * console.log(buf1.compare(buf2, 0, 6, 4)); - * // Prints: -1 - * console.log(buf1.compare(buf2, 5, 6, 5)); - * // Prints: 1 - * ``` - * - * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`, `targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`. - * @since v0.11.13 - * @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`. - * @param [targetStart=0] The offset within `target` at which to begin comparison. - * @param [targetEnd=target.length] The offset within `target` at which to end comparison (not inclusive). - * @param [sourceStart=0] The offset within `buf` at which to begin comparison. - * @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive). - */ - compare( - target: Uint8Array, - targetStart?: number, - targetEnd?: number, - sourceStart?: number, - sourceEnd?: number, - ): -1 | 0 | 1; - /** - * Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`. - * - * [`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set) performs the same operation, and is available - * for all TypedArrays, including Node.js `Buffer`s, although it takes - * different function arguments. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create two `Buffer` instances. - * const buf1 = Buffer.allocUnsafe(26); - * const buf2 = Buffer.allocUnsafe(26).fill('!'); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf1[i] = i + 97; - * } - * - * // Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`. - * buf1.copy(buf2, 8, 16, 20); - * // This is equivalent to: - * // buf2.set(buf1.subarray(16, 20), 8); - * - * console.log(buf2.toString('ascii', 0, 25)); - * // Prints: !!!!!!!!qrst!!!!!!!!!!!!! - * ``` - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a `Buffer` and copy data from one region to an overlapping region - * // within the same `Buffer`. - * - * const buf = Buffer.allocUnsafe(26); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf[i] = i + 97; - * } - * - * buf.copy(buf, 0, 4, 10); - * - * console.log(buf.toString()); - * // Prints: efghijghijklmnopqrstuvwxyz - * ``` - * @since v0.1.90 - * @param target A `Buffer` or {@link Uint8Array} to copy into. - * @param [targetStart=0] The offset within `target` at which to begin writing. - * @param [sourceStart=0] The offset within `buf` from which to begin copying. - * @param [sourceEnd=buf.length] The offset within `buf` at which to stop copying (not inclusive). - * @return The number of bytes copied. - */ - copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. - * - * `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigInt64BE(0x0102030405060708n, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigInt64BE(value: bigint, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. - * - * `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigInt64LE(0x0102030405060708n, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigInt64LE(value: bigint, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. - * - * This function is also available under the `writeBigUint64BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigUInt64BE(0xdecafafecacefaden, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigUInt64BE(value: bigint, offset?: number): number; - /** - * @alias Buffer.writeBigUInt64BE - * @since v14.10.0, v12.19.0 - */ - writeBigUint64BE(value: bigint, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigUInt64LE(0xdecafafecacefaden, 0); - * - * console.log(buf); - * // Prints: - * ``` - * - * This function is also available under the `writeBigUint64LE` alias. - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigUInt64LE(value: bigint, offset?: number): number; - /** - * @alias Buffer.writeBigUInt64LE - * @since v14.10.0, v12.19.0 - */ - writeBigUint64LE(value: bigint, offset?: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined - * when `value` is anything other than an unsigned integer. - * - * This function is also available under the `writeUintLE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeUIntLE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeUIntLE(value: number, offset: number, byteLength: number): number; - /** - * @alias Buffer.writeUIntLE - * @since v14.9.0, v12.19.0 - */ - writeUintLE(value: number, offset: number, byteLength: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined - * when `value` is anything other than an unsigned integer. - * - * This function is also available under the `writeUintBE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeUIntBE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeUIntBE(value: number, offset: number, byteLength: number): number; - /** - * @alias Buffer.writeUIntBE - * @since v14.9.0, v12.19.0 - */ - writeUintBE(value: number, offset: number, byteLength: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined - * when `value` is anything other than a signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeIntLE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeIntLE(value: number, offset: number, byteLength: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when`value` is anything other than a - * signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeIntBE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeIntBE(value: number, offset: number, byteLength: number): number; - /** - * Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readBigUint64BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); - * - * console.log(buf.readBigUInt64BE(0)); - * // Prints: 4294967295n - * ``` - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigUInt64BE(offset?: number): bigint; - /** - * @alias Buffer.readBigUInt64BE - * @since v14.10.0, v12.19.0 - */ - readBigUint64BE(offset?: number): bigint; - /** - * Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readBigUint64LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); - * - * console.log(buf.readBigUInt64LE(0)); - * // Prints: 18446744069414584320n - * ``` - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigUInt64LE(offset?: number): bigint; - /** - * @alias Buffer.readBigUInt64LE - * @since v14.10.0, v12.19.0 - */ - readBigUint64LE(offset?: number): bigint; - /** - * Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed - * values. - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigInt64BE(offset?: number): bigint; - /** - * Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed - * values. - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigInt64LE(offset?: number): bigint; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned, little-endian integer supporting - * up to 48 bits of accuracy. - * - * This function is also available under the `readUintLE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readUIntLE(0, 6).toString(16)); - * // Prints: ab9078563412 - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readUIntLE(offset: number, byteLength: number): number; - /** - * @alias Buffer.readUIntLE - * @since v14.9.0, v12.19.0 - */ - readUintLE(offset: number, byteLength: number): number; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned big-endian integer supporting - * up to 48 bits of accuracy. - * - * This function is also available under the `readUintBE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readUIntBE(0, 6).toString(16)); - * // Prints: 1234567890ab - * console.log(buf.readUIntBE(1, 6).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readUIntBE(offset: number, byteLength: number): number; - /** - * @alias Buffer.readUIntBE - * @since v14.9.0, v12.19.0 - */ - readUintBE(offset: number, byteLength: number): number; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a little-endian, two's complement signed value - * supporting up to 48 bits of accuracy. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readIntLE(0, 6).toString(16)); - * // Prints: -546f87a9cbee - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readIntLE(offset: number, byteLength: number): number; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a big-endian, two's complement signed value - * supporting up to 48 bits of accuracy. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readIntBE(0, 6).toString(16)); - * // Prints: 1234567890ab - * console.log(buf.readIntBE(1, 6).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * console.log(buf.readIntBE(1, 0).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readIntBE(offset: number, byteLength: number): number; - /** - * Reads an unsigned 8-bit integer from `buf` at the specified `offset`. - * - * This function is also available under the `readUint8` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, -2]); - * - * console.log(buf.readUInt8(0)); - * // Prints: 1 - * console.log(buf.readUInt8(1)); - * // Prints: 254 - * console.log(buf.readUInt8(2)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. - */ - readUInt8(offset?: number): number; - /** - * @alias Buffer.readUInt8 - * @since v14.9.0, v12.19.0 - */ - readUint8(offset?: number): number; - /** - * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified `offset`. - * - * This function is also available under the `readUint16LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56]); - * - * console.log(buf.readUInt16LE(0).toString(16)); - * // Prints: 3412 - * console.log(buf.readUInt16LE(1).toString(16)); - * // Prints: 5634 - * console.log(buf.readUInt16LE(2).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readUInt16LE(offset?: number): number; - /** - * @alias Buffer.readUInt16LE - * @since v14.9.0, v12.19.0 - */ - readUint16LE(offset?: number): number; - /** - * Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint16BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56]); - * - * console.log(buf.readUInt16BE(0).toString(16)); - * // Prints: 1234 - * console.log(buf.readUInt16BE(1).toString(16)); - * // Prints: 3456 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readUInt16BE(offset?: number): number; - /** - * @alias Buffer.readUInt16BE - * @since v14.9.0, v12.19.0 - */ - readUint16BE(offset?: number): number; - /** - * Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint32LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); - * - * console.log(buf.readUInt32LE(0).toString(16)); - * // Prints: 78563412 - * console.log(buf.readUInt32LE(1).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readUInt32LE(offset?: number): number; - /** - * @alias Buffer.readUInt32LE - * @since v14.9.0, v12.19.0 - */ - readUint32LE(offset?: number): number; - /** - * Reads an unsigned, big-endian 32-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint32BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); - * - * console.log(buf.readUInt32BE(0).toString(16)); - * // Prints: 12345678 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readUInt32BE(offset?: number): number; - /** - * @alias Buffer.readUInt32BE - * @since v14.9.0, v12.19.0 - */ - readUint32BE(offset?: number): number; - /** - * Reads a signed 8-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([-1, 5]); - * - * console.log(buf.readInt8(0)); - * // Prints: -1 - * console.log(buf.readInt8(1)); - * // Prints: 5 - * console.log(buf.readInt8(2)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. - */ - readInt8(offset?: number): number; - /** - * Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 5]); - * - * console.log(buf.readInt16LE(0)); - * // Prints: 1280 - * console.log(buf.readInt16LE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readInt16LE(offset?: number): number; - /** - * Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 5]); - * - * console.log(buf.readInt16BE(0)); - * // Prints: 5 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readInt16BE(offset?: number): number; - /** - * Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 0, 0, 5]); - * - * console.log(buf.readInt32LE(0)); - * // Prints: 83886080 - * console.log(buf.readInt32LE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readInt32LE(offset?: number): number; - /** - * Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 0, 0, 5]); - * - * console.log(buf.readInt32BE(0)); - * // Prints: 5 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readInt32BE(offset?: number): number; - /** - * Reads a 32-bit, little-endian float from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4]); - * - * console.log(buf.readFloatLE(0)); - * // Prints: 1.539989614439558e-36 - * console.log(buf.readFloatLE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readFloatLE(offset?: number): number; - /** - * Reads a 32-bit, big-endian float from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4]); - * - * console.log(buf.readFloatBE(0)); - * // Prints: 2.387939260590663e-38 - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readFloatBE(offset?: number): number; - /** - * Reads a 64-bit, little-endian double from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); - * - * console.log(buf.readDoubleLE(0)); - * // Prints: 5.447603722011605e-270 - * console.log(buf.readDoubleLE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. - */ - readDoubleLE(offset?: number): number; - /** - * Reads a 64-bit, big-endian double from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); - * - * console.log(buf.readDoubleBE(0)); - * // Prints: 8.20788039913184e-304 - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. - */ - readDoubleBE(offset?: number): number; - reverse(): this; - /** - * Interprets `buf` as an array of unsigned 16-bit integers and swaps the - * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); - * - * console.log(buf1); - * // Prints: - * - * buf1.swap16(); - * - * console.log(buf1); - * // Prints: - * - * const buf2 = Buffer.from([0x1, 0x2, 0x3]); - * - * buf2.swap16(); - * // Throws ERR_INVALID_BUFFER_SIZE. - * ``` - * - * One convenient use of `buf.swap16()` is to perform a fast in-place conversion - * between UTF-16 little-endian and UTF-16 big-endian: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('This is little-endian UTF-16', 'utf16le'); - * buf.swap16(); // Convert to big-endian UTF-16 text. - * ``` - * @since v5.10.0 - * @return A reference to `buf`. - */ - swap16(): this; - /** - * Interprets `buf` as an array of unsigned 32-bit integers and swaps the - * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); - * - * console.log(buf1); - * // Prints: - * - * buf1.swap32(); - * - * console.log(buf1); - * // Prints: - * - * const buf2 = Buffer.from([0x1, 0x2, 0x3]); - * - * buf2.swap32(); - * // Throws ERR_INVALID_BUFFER_SIZE. - * ``` - * @since v5.10.0 - * @return A reference to `buf`. - */ - swap32(): this; - /** - * Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_. - * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); - * - * console.log(buf1); - * // Prints: - * - * buf1.swap64(); - * - * console.log(buf1); - * // Prints: - * - * const buf2 = Buffer.from([0x1, 0x2, 0x3]); - * - * buf2.swap64(); - * // Throws ERR_INVALID_BUFFER_SIZE. - * ``` - * @since v6.3.0 - * @return A reference to `buf`. - */ - swap64(): this; - /** - * Writes `value` to `buf` at the specified `offset`. `value` must be a - * valid unsigned 8-bit integer. Behavior is undefined when `value` is anything - * other than an unsigned 8-bit integer. - * - * This function is also available under the `writeUint8` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt8(0x3, 0); - * buf.writeUInt8(0x4, 1); - * buf.writeUInt8(0x23, 2); - * buf.writeUInt8(0x42, 3); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. - * @return `offset` plus the number of bytes written. - */ - writeUInt8(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt8 - * @since v14.9.0, v12.19.0 - */ - writeUint8(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is - * anything other than an unsigned 16-bit integer. - * - * This function is also available under the `writeUint16LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt16LE(0xdead, 0); - * buf.writeUInt16LE(0xbeef, 2); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeUInt16LE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt16LE - * @since v14.9.0, v12.19.0 - */ - writeUint16LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an - * unsigned 16-bit integer. - * - * This function is also available under the `writeUint16BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt16BE(0xdead, 0); - * buf.writeUInt16BE(0xbeef, 2); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeUInt16BE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt16BE - * @since v14.9.0, v12.19.0 - */ - writeUint16BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is - * anything other than an unsigned 32-bit integer. - * - * This function is also available under the `writeUint32LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt32LE(0xfeedface, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeUInt32LE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt32LE - * @since v14.9.0, v12.19.0 - */ - writeUint32LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an - * unsigned 32-bit integer. - * - * This function is also available under the `writeUint32BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt32BE(0xfeedface, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeUInt32BE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt32BE - * @since v14.9.0, v12.19.0 - */ - writeUint32BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset`. `value` must be a valid - * signed 8-bit integer. Behavior is undefined when `value` is anything other than - * a signed 8-bit integer. - * - * `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(2); - * - * buf.writeInt8(2, 0); - * buf.writeInt8(-2, 1); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. - * @return `offset` plus the number of bytes written. - */ - writeInt8(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is - * anything other than a signed 16-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(2); - * - * buf.writeInt16LE(0x0304, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeInt16LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is - * anything other than a signed 16-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(2); - * - * buf.writeInt16BE(0x0102, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeInt16BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is - * anything other than a signed 32-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeInt32LE(0x05060708, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeInt32LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is - * anything other than a signed 32-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeInt32BE(0x01020304, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeInt32BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is - * undefined when `value` is anything other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeFloatLE(0xcafebabe, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeFloatLE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is - * undefined when `value` is anything other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeFloatBE(0xcafebabe, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeFloatBE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything - * other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeDoubleLE(123.456, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeDoubleLE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything - * other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeDoubleBE(123.456, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeDoubleBE(value: number, offset?: number): number; - /** - * Fills `buf` with the specified `value`. If the `offset` and `end` are not given, - * the entire `buf` will be filled: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Fill a `Buffer` with the ASCII character 'h'. - * - * const b = Buffer.allocUnsafe(50).fill('h'); - * - * console.log(b.toString()); - * // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh - * - * // Fill a buffer with empty string - * const c = Buffer.allocUnsafe(5).fill(''); - * - * console.log(c.fill('')); - * // Prints: - * ``` - * - * `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or - * integer. If the resulting integer is greater than `255` (decimal), `buf` will be - * filled with `value & 255`. - * - * If the final write of a `fill()` operation falls on a multi-byte character, - * then only the bytes of that character that fit into `buf` are written: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Fill a `Buffer` with character that takes up two bytes in UTF-8. - * - * console.log(Buffer.allocUnsafe(5).fill('\u0222')); - * // Prints: - * ``` - * - * If `value` contains invalid characters, it is truncated; if no valid - * fill data remains, an exception is thrown: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(5); - * - * console.log(buf.fill('a')); - * // Prints: - * console.log(buf.fill('aazz', 'hex')); - * // Prints: - * console.log(buf.fill('zz', 'hex')); - * // Throws an exception. - * ``` - * @since v0.5.0 - * @param value The value with which to fill `buf`. Empty value (string, Uint8Array, Buffer) is coerced to `0`. - * @param [offset=0] Number of bytes to skip before starting to fill `buf`. - * @param [end=buf.length] Where to stop filling `buf` (not inclusive). - * @param [encoding='utf8'] The encoding for `value` if `value` is a string. - * @return A reference to `buf`. - */ - fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this; - fill(value: string | Uint8Array | number, offset: number, encoding: BufferEncoding): this; - fill(value: string | Uint8Array | number, encoding: BufferEncoding): this; - /** - * If `value` is: - * - * * a string, `value` is interpreted according to the character encoding in `encoding`. - * * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety. - * To compare a partial `Buffer`, use `buf.subarray`. - * * a number, `value` will be interpreted as an unsigned 8-bit integer - * value between `0` and `255`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('this is a buffer'); - * - * console.log(buf.indexOf('this')); - * // Prints: 0 - * console.log(buf.indexOf('is')); - * // Prints: 2 - * console.log(buf.indexOf(Buffer.from('a buffer'))); - * // Prints: 8 - * console.log(buf.indexOf(97)); - * // Prints: 8 (97 is the decimal ASCII value for 'a') - * console.log(buf.indexOf(Buffer.from('a buffer example'))); - * // Prints: -1 - * console.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8))); - * // Prints: 8 - * - * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); - * - * console.log(utf16Buffer.indexOf('\u03a3', 0, 'utf16le')); - * // Prints: 4 - * console.log(utf16Buffer.indexOf('\u03a3', -4, 'utf16le')); - * // Prints: 6 - * ``` - * - * If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value, - * an integer between 0 and 255. - * - * If `byteOffset` is not a number, it will be coerced to a number. If the result - * of coercion is `NaN` or `0`, then the entire buffer will be searched. This - * behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf). - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const b = Buffer.from('abcdef'); - * - * // Passing a value that's a number, but not a valid byte. - * // Prints: 2, equivalent to searching for 99 or 'c'. - * console.log(b.indexOf(99.9)); - * console.log(b.indexOf(256 + 99)); - * - * // Passing a byteOffset that coerces to NaN or 0. - * // Prints: 1, searching the whole buffer. - * console.log(b.indexOf('b', undefined)); - * console.log(b.indexOf('b', {})); - * console.log(b.indexOf('b', null)); - * console.log(b.indexOf('b', [])); - * ``` - * - * If `value` is an empty string or empty `Buffer` and `byteOffset` is less - * than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOffset` is at least `buf.length`, `buf.length` will be returned. - * @since v1.5.0 - * @param value What to search for. - * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. - * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. - * @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. - */ - indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - indexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number; - /** - * Identical to `buf.indexOf()`, except the last occurrence of `value` is found - * rather than the first occurrence. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('this buffer is a buffer'); - * - * console.log(buf.lastIndexOf('this')); - * // Prints: 0 - * console.log(buf.lastIndexOf('buffer')); - * // Prints: 17 - * console.log(buf.lastIndexOf(Buffer.from('buffer'))); - * // Prints: 17 - * console.log(buf.lastIndexOf(97)); - * // Prints: 15 (97 is the decimal ASCII value for 'a') - * console.log(buf.lastIndexOf(Buffer.from('yolo'))); - * // Prints: -1 - * console.log(buf.lastIndexOf('buffer', 5)); - * // Prints: 5 - * console.log(buf.lastIndexOf('buffer', 4)); - * // Prints: -1 - * - * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); - * - * console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le')); - * // Prints: 6 - * console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le')); - * // Prints: 4 - * ``` - * - * If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value, - * an integer between 0 and 255. - * - * If `byteOffset` is not a number, it will be coerced to a number. Any arguments - * that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer. - * This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf). - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const b = Buffer.from('abcdef'); - * - * // Passing a value that's a number, but not a valid byte. - * // Prints: 2, equivalent to searching for 99 or 'c'. - * console.log(b.lastIndexOf(99.9)); - * console.log(b.lastIndexOf(256 + 99)); - * - * // Passing a byteOffset that coerces to NaN. - * // Prints: 1, searching the whole buffer. - * console.log(b.lastIndexOf('b', undefined)); - * console.log(b.lastIndexOf('b', {})); - * - * // Passing a byteOffset that coerces to 0. - * // Prints: -1, equivalent to passing 0. - * console.log(b.lastIndexOf('b', null)); - * console.log(b.lastIndexOf('b', [])); - * ``` - * - * If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned. - * @since v6.0.0 - * @param value What to search for. - * @param [byteOffset=buf.length - 1] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. - * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. - * @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. - */ - lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - lastIndexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number; - /** - * Equivalent to `buf.indexOf() !== -1`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('this is a buffer'); - * - * console.log(buf.includes('this')); - * // Prints: true - * console.log(buf.includes('is')); - * // Prints: true - * console.log(buf.includes(Buffer.from('a buffer'))); - * // Prints: true - * console.log(buf.includes(97)); - * // Prints: true (97 is the decimal ASCII value for 'a') - * console.log(buf.includes(Buffer.from('a buffer example'))); - * // Prints: false - * console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8))); - * // Prints: true - * console.log(buf.includes('this', 4)); - * // Prints: false - * ``` - * @since v5.3.0 - * @param value What to search for. - * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. - * @param [encoding='utf8'] If `value` is a string, this is its encoding. - * @return `true` if `value` was found in `buf`, `false` otherwise. - */ - includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean; - includes(value: string | number | Buffer, encoding: BufferEncoding): boolean; - } - var Buffer: BufferConstructor; - /** - * Decodes a string of Base64-encoded data into bytes, and encodes those bytes - * into a string using Latin-1 (ISO-8859-1). - * - * The `data` may be any JavaScript-value that can be coerced into a string. - * - * **This function is only provided for compatibility with legacy web platform APIs** - * **and should never be used in new code, because they use strings to represent** - * **binary data and predate the introduction of typed arrays in JavaScript.** - * **For code running using Node.js APIs, converting between base64-encoded strings** - * **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.** - * @since v15.13.0, v14.17.0 - * @legacy Use `Buffer.from(data, 'base64')` instead. - * @param data The Base64-encoded input string. - */ - function atob(data: string): string; - /** - * Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes - * into a string using Base64. - * - * The `data` may be any JavaScript-value that can be coerced into a string. - * - * **This function is only provided for compatibility with legacy web platform APIs** - * **and should never be used in new code, because they use strings to represent** - * **binary data and predate the introduction of typed arrays in JavaScript.** - * **For code running using Node.js APIs, converting between base64-encoded strings** - * **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.** - * @since v15.13.0, v14.17.0 - * @legacy Use `buf.toString('base64')` instead. - * @param data An ASCII (Latin1) string. - */ - function btoa(data: string): string; - interface Blob extends _Blob {} - /** - * `Blob` class is a global reference for `import { Blob } from 'node:buffer'` - * https://nodejs.org/api/buffer.html#class-blob - * @since v18.0.0 - */ - var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T - : typeof import("buffer").Blob; - interface File extends _File {} - /** - * `File` class is a global reference for `import { File } from 'node:buffer'` - * https://nodejs.org/api/buffer.html#class-file - * @since v20.0.0 - */ - var File: typeof globalThis extends { onmessage: any; File: infer T } ? T - : typeof import("buffer").File; - } -} -declare module "node:buffer" { - export * from "buffer"; -} diff --git a/node_modules/@types/node/child_process.d.ts b/node_modules/@types/node/child_process.d.ts deleted file mode 100644 index 313c33c..0000000 --- a/node_modules/@types/node/child_process.d.ts +++ /dev/null @@ -1,1476 +0,0 @@ -/** - * The `node:child_process` module provides the ability to spawn subprocesses in - * a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability - * is primarily provided by the {@link spawn} function: - * - * ```js - * import { spawn } from 'node:child_process'; - * const ls = spawn('ls', ['-lh', '/usr']); - * - * ls.stdout.on('data', (data) => { - * console.log(`stdout: ${data}`); - * }); - * - * ls.stderr.on('data', (data) => { - * console.error(`stderr: ${data}`); - * }); - * - * ls.on('close', (code) => { - * console.log(`child process exited with code ${code}`); - * }); - * ``` - * - * By default, pipes for `stdin`, `stdout`, and `stderr` are established between - * the parent Node.js process and the spawned subprocess. These pipes have - * limited (and platform-specific) capacity. If the subprocess writes to - * stdout in excess of that limit without the output being captured, the - * subprocess blocks, waiting for the pipe buffer to accept more data. This is - * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed. - * - * The command lookup is performed using the `options.env.PATH` environment - * variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is - * used. If `options.env` is set without `PATH`, lookup on Unix is performed - * on a default search path search of `/usr/bin:/bin` (see your operating system's - * manual for execvpe/execvp), on Windows the current processes environment - * variable `PATH` is used. - * - * On Windows, environment variables are case-insensitive. Node.js - * lexicographically sorts the `env` keys and uses the first one that - * case-insensitively matches. Only first (in lexicographic order) entry will be - * passed to the subprocess. This might lead to issues on Windows when passing - * objects to the `env` option that have multiple variants of the same key, such as `PATH` and `Path`. - * - * The {@link spawn} method spawns the child process asynchronously, - * without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks - * the event loop until the spawned process either exits or is terminated. - * - * For convenience, the `node:child_process` module provides a handful of - * synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on - * top of {@link spawn} or {@link spawnSync}. - * - * * {@link exec}: spawns a shell and runs a command within that - * shell, passing the `stdout` and `stderr` to a callback function when - * complete. - * * {@link execFile}: similar to {@link exec} except - * that it spawns the command directly without first spawning a shell by - * default. - * * {@link fork}: spawns a new Node.js process and invokes a - * specified module with an IPC communication channel established that allows - * sending messages between parent and child. - * * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop. - * * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop. - * - * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however, - * the synchronous methods can have significant impact on performance due to - * stalling the event loop while spawned processes complete. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/child_process.js) - */ -declare module "child_process" { - import { NonSharedBuffer } from "node:buffer"; - import { Abortable, EventEmitter } from "node:events"; - import * as dgram from "node:dgram"; - import * as net from "node:net"; - import { Readable, Stream, Writable } from "node:stream"; - import { URL } from "node:url"; - type Serializable = string | object | number | boolean | bigint; - type SendHandle = net.Socket | net.Server | dgram.Socket | undefined; - /** - * Instances of the `ChildProcess` represent spawned child processes. - * - * Instances of `ChildProcess` are not intended to be created directly. Rather, - * use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create - * instances of `ChildProcess`. - * @since v2.2.0 - */ - class ChildProcess extends EventEmitter { - /** - * A `Writable Stream` that represents the child process's `stdin`. - * - * If a child process waits to read all of its input, the child will not continue - * until this stream has been closed via `end()`. - * - * If the child was spawned with `stdio[0]` set to anything other than `'pipe'`, - * then this will be `null`. - * - * `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will - * refer to the same value. - * - * The `subprocess.stdin` property can be `null` or `undefined` if the child process could not be successfully spawned. - * @since v0.1.90 - */ - stdin: Writable | null; - /** - * A `Readable Stream` that represents the child process's `stdout`. - * - * If the child was spawned with `stdio[1]` set to anything other than `'pipe'`, - * then this will be `null`. - * - * `subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will - * refer to the same value. - * - * ```js - * import { spawn } from 'node:child_process'; - * - * const subprocess = spawn('ls'); - * - * subprocess.stdout.on('data', (data) => { - * console.log(`Received chunk ${data}`); - * }); - * ``` - * - * The `subprocess.stdout` property can be `null` or `undefined` if the child process could not be successfully spawned. - * @since v0.1.90 - */ - stdout: Readable | null; - /** - * A `Readable Stream` that represents the child process's `stderr`. - * - * If the child was spawned with `stdio[2]` set to anything other than `'pipe'`, - * then this will be `null`. - * - * `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will - * refer to the same value. - * - * The `subprocess.stderr` property can be `null` or `undefined` if the child process could not be successfully spawned. - * @since v0.1.90 - */ - stderr: Readable | null; - /** - * The `subprocess.channel` property is a reference to the child's IPC channel. If - * no IPC channel exists, this property is `undefined`. - * @since v7.1.0 - */ - readonly channel?: Control | null; - /** - * A sparse array of pipes to the child process, corresponding with positions in - * the `stdio` option passed to {@link spawn} that have been set - * to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and `subprocess.stdio[2]` are also available as `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr`, - * respectively. - * - * In the following example, only the child's fd `1` (stdout) is configured as a - * pipe, so only the parent's `subprocess.stdio[1]` is a stream, all other values - * in the array are `null`. - * - * ```js - * import assert from 'node:assert'; - * import fs from 'node:fs'; - * import child_process from 'node:child_process'; - * - * const subprocess = child_process.spawn('ls', { - * stdio: [ - * 0, // Use parent's stdin for child. - * 'pipe', // Pipe child's stdout to parent. - * fs.openSync('err.out', 'w'), // Direct child's stderr to a file. - * ], - * }); - * - * assert.strictEqual(subprocess.stdio[0], null); - * assert.strictEqual(subprocess.stdio[0], subprocess.stdin); - * - * assert(subprocess.stdout); - * assert.strictEqual(subprocess.stdio[1], subprocess.stdout); - * - * assert.strictEqual(subprocess.stdio[2], null); - * assert.strictEqual(subprocess.stdio[2], subprocess.stderr); - * ``` - * - * The `subprocess.stdio` property can be `undefined` if the child process could - * not be successfully spawned. - * @since v0.7.10 - */ - readonly stdio: [ - Writable | null, - // stdin - Readable | null, - // stdout - Readable | null, - // stderr - Readable | Writable | null | undefined, - // extra - Readable | Writable | null | undefined, // extra - ]; - /** - * The `subprocess.killed` property indicates whether the child process - * successfully received a signal from `subprocess.kill()`. The `killed` property - * does not indicate that the child process has been terminated. - * @since v0.5.10 - */ - readonly killed: boolean; - /** - * Returns the process identifier (PID) of the child process. If the child process - * fails to spawn due to errors, then the value is `undefined` and `error` is - * emitted. - * - * ```js - * import { spawn } from 'node:child_process'; - * const grep = spawn('grep', ['ssh']); - * - * console.log(`Spawned child pid: ${grep.pid}`); - * grep.stdin.end(); - * ``` - * @since v0.1.90 - */ - readonly pid?: number | undefined; - /** - * The `subprocess.connected` property indicates whether it is still possible to - * send and receive messages from a child process. When `subprocess.connected` is `false`, it is no longer possible to send or receive messages. - * @since v0.7.2 - */ - readonly connected: boolean; - /** - * The `subprocess.exitCode` property indicates the exit code of the child process. - * If the child process is still running, the field will be `null`. - */ - readonly exitCode: number | null; - /** - * The `subprocess.signalCode` property indicates the signal received by - * the child process if any, else `null`. - */ - readonly signalCode: NodeJS.Signals | null; - /** - * The `subprocess.spawnargs` property represents the full list of command-line - * arguments the child process was launched with. - */ - readonly spawnargs: string[]; - /** - * The `subprocess.spawnfile` property indicates the executable file name of - * the child process that is launched. - * - * For {@link fork}, its value will be equal to `process.execPath`. - * For {@link spawn}, its value will be the name of - * the executable file. - * For {@link exec}, its value will be the name of the shell - * in which the child process is launched. - */ - readonly spawnfile: string; - /** - * The `subprocess.kill()` method sends a signal to the child process. If no - * argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function - * returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise. - * - * ```js - * import { spawn } from 'node:child_process'; - * const grep = spawn('grep', ['ssh']); - * - * grep.on('close', (code, signal) => { - * console.log( - * `child process terminated due to receipt of signal ${signal}`); - * }); - * - * // Send SIGHUP to process. - * grep.kill('SIGHUP'); - * ``` - * - * The `ChildProcess` object may emit an `'error'` event if the signal - * cannot be delivered. Sending a signal to a child process that has already exited - * is not an error but may have unforeseen consequences. Specifically, if the - * process identifier (PID) has been reassigned to another process, the signal will - * be delivered to that process instead which can have unexpected results. - * - * While the function is called `kill`, the signal delivered to the child process - * may not actually terminate the process. - * - * See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference. - * - * On Windows, where POSIX signals do not exist, the `signal` argument will be - * ignored, and the process will be killed forcefully and abruptly (similar to `'SIGKILL'`). - * See `Signal Events` for more details. - * - * On Linux, child processes of child processes will not be terminated - * when attempting to kill their parent. This is likely to happen when running a - * new process in a shell or with the use of the `shell` option of `ChildProcess`: - * - * ```js - * 'use strict'; - * import { spawn } from 'node:child_process'; - * - * const subprocess = spawn( - * 'sh', - * [ - * '-c', - * `node -e "setInterval(() => { - * console.log(process.pid, 'is alive') - * }, 500);"`, - * ], { - * stdio: ['inherit', 'inherit', 'inherit'], - * }, - * ); - * - * setTimeout(() => { - * subprocess.kill(); // Does not terminate the Node.js process in the shell. - * }, 2000); - * ``` - * @since v0.1.90 - */ - kill(signal?: NodeJS.Signals | number): boolean; - /** - * Calls {@link ChildProcess.kill} with `'SIGTERM'`. - * @since v20.5.0 - */ - [Symbol.dispose](): void; - /** - * When an IPC channel has been established between the parent and child ( - * i.e. when using {@link fork}), the `subprocess.send()` method can - * be used to send messages to the child process. When the child process is a - * Node.js instance, these messages can be received via the `'message'` event. - * - * The message goes through serialization and parsing. The resulting - * message might not be the same as what is originally sent. - * - * For example, in the parent script: - * - * ```js - * import cp from 'node:child_process'; - * const n = cp.fork(`${__dirname}/sub.js`); - * - * n.on('message', (m) => { - * console.log('PARENT got message:', m); - * }); - * - * // Causes the child to print: CHILD got message: { hello: 'world' } - * n.send({ hello: 'world' }); - * ``` - * - * And then the child script, `'sub.js'` might look like this: - * - * ```js - * process.on('message', (m) => { - * console.log('CHILD got message:', m); - * }); - * - * // Causes the parent to print: PARENT got message: { foo: 'bar', baz: null } - * process.send({ foo: 'bar', baz: NaN }); - * ``` - * - * Child Node.js processes will have a `process.send()` method of their own - * that allows the child to send messages back to the parent. - * - * There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages - * containing a `NODE_` prefix in the `cmd` property are reserved for use within - * Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the `'internalMessage'` event and are consumed internally by Node.js. - * Applications should avoid using such messages or listening for `'internalMessage'` events as it is subject to change without notice. - * - * The optional `sendHandle` argument that may be passed to `subprocess.send()` is - * for passing a TCP server or socket object to the child process. The child will - * receive the object as the second argument passed to the callback function - * registered on the `'message'` event. Any data that is received and buffered in - * the socket will not be sent to the child. Sending IPC sockets is not supported on Windows. - * - * The optional `callback` is a function that is invoked after the message is - * sent but before the child may have received it. The function is called with a - * single argument: `null` on success, or an `Error` object on failure. - * - * If no `callback` function is provided and the message cannot be sent, an `'error'` event will be emitted by the `ChildProcess` object. This can - * happen, for instance, when the child process has already exited. - * - * `subprocess.send()` will return `false` if the channel has closed or when the - * backlog of unsent messages exceeds a threshold that makes it unwise to send - * more. Otherwise, the method returns `true`. The `callback` function can be - * used to implement flow control. - * - * #### Example: sending a server object - * - * The `sendHandle` argument can be used, for instance, to pass the handle of - * a TCP server object to the child process as illustrated in the example below: - * - * ```js - * import { createServer } from 'node:net'; - * import { fork } from 'node:child_process'; - * const subprocess = fork('subprocess.js'); - * - * // Open up the server object and send the handle. - * const server = createServer(); - * server.on('connection', (socket) => { - * socket.end('handled by parent'); - * }); - * server.listen(1337, () => { - * subprocess.send('server', server); - * }); - * ``` - * - * The child would then receive the server object as: - * - * ```js - * process.on('message', (m, server) => { - * if (m === 'server') { - * server.on('connection', (socket) => { - * socket.end('handled by child'); - * }); - * } - * }); - * ``` - * - * Once the server is now shared between the parent and child, some connections - * can be handled by the parent and some by the child. - * - * While the example above uses a server created using the `node:net` module, `node:dgram` module servers use exactly the same workflow with the exceptions of - * listening on a `'message'` event instead of `'connection'` and using `server.bind()` instead of `server.listen()`. This is, however, only - * supported on Unix platforms. - * - * #### Example: sending a socket object - * - * Similarly, the `sendHandler` argument can be used to pass the handle of a - * socket to the child process. The example below spawns two children that each - * handle connections with "normal" or "special" priority: - * - * ```js - * import { createServer } from 'node:net'; - * import { fork } from 'node:child_process'; - * const normal = fork('subprocess.js', ['normal']); - * const special = fork('subprocess.js', ['special']); - * - * // Open up the server and send sockets to child. Use pauseOnConnect to prevent - * // the sockets from being read before they are sent to the child process. - * const server = createServer({ pauseOnConnect: true }); - * server.on('connection', (socket) => { - * - * // If this is special priority... - * if (socket.remoteAddress === '74.125.127.100') { - * special.send('socket', socket); - * return; - * } - * // This is normal priority. - * normal.send('socket', socket); - * }); - * server.listen(1337); - * ``` - * - * The `subprocess.js` would receive the socket handle as the second argument - * passed to the event callback function: - * - * ```js - * process.on('message', (m, socket) => { - * if (m === 'socket') { - * if (socket) { - * // Check that the client socket exists. - * // It is possible for the socket to be closed between the time it is - * // sent and the time it is received in the child process. - * socket.end(`Request handled with ${process.argv[2]} priority`); - * } - * } - * }); - * ``` - * - * Do not use `.maxConnections` on a socket that has been passed to a subprocess. - * The parent cannot track when the socket is destroyed. - * - * Any `'message'` handlers in the subprocess should verify that `socket` exists, - * as the connection may have been closed during the time it takes to send the - * connection to the child. - * @since v0.5.9 - * @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v22.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v22.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v22.x/api/dgram.html#class-dgramsocket) object. - * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: - */ - send(message: Serializable, callback?: (error: Error | null) => void): boolean; - send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean; - send( - message: Serializable, - sendHandle?: SendHandle, - options?: MessageOptions, - callback?: (error: Error | null) => void, - ): boolean; - /** - * Closes the IPC channel between parent and child, allowing the child to exit - * gracefully once there are no other connections keeping it alive. After calling - * this method the `subprocess.connected` and `process.connected` properties in - * both the parent and child (respectively) will be set to `false`, and it will be - * no longer possible to pass messages between the processes. - * - * The `'disconnect'` event will be emitted when there are no messages in the - * process of being received. This will most often be triggered immediately after - * calling `subprocess.disconnect()`. - * - * When the child process is a Node.js instance (e.g. spawned using {@link fork}), the `process.disconnect()` method can be invoked - * within the child process to close the IPC channel as well. - * @since v0.7.2 - */ - disconnect(): void; - /** - * By default, the parent will wait for the detached child to exit. To prevent the - * parent from waiting for a given `subprocess` to exit, use the `subprocess.unref()` method. Doing so will cause the parent's event loop to not - * include the child in its reference count, allowing the parent to exit - * independently of the child, unless there is an established IPC channel between - * the child and the parent. - * - * ```js - * import { spawn } from 'node:child_process'; - * - * const subprocess = spawn(process.argv[0], ['child_program.js'], { - * detached: true, - * stdio: 'ignore', - * }); - * - * subprocess.unref(); - * ``` - * @since v0.7.10 - */ - unref(): void; - /** - * Calling `subprocess.ref()` after making a call to `subprocess.unref()` will - * restore the removed reference count for the child process, forcing the parent - * to wait for the child to exit before exiting itself. - * - * ```js - * import { spawn } from 'node:child_process'; - * - * const subprocess = spawn(process.argv[0], ['child_program.js'], { - * detached: true, - * stdio: 'ignore', - * }); - * - * subprocess.unref(); - * subprocess.ref(); - * ``` - * @since v0.7.10 - */ - ref(): void; - /** - * events.EventEmitter - * 1. close - * 2. disconnect - * 3. error - * 4. exit - * 5. message - * 6. spawn - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - addListener(event: "spawn", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean; - emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean; - emit(event: "spawn", listener: () => void): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - on(event: "spawn", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - once(event: "spawn", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - prependListener(event: "spawn", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "close", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener( - event: "exit", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - prependOnceListener(event: "spawn", listener: () => void): this; - } - // return this object when stdio option is undefined or not specified - interface ChildProcessWithoutNullStreams extends ChildProcess { - stdin: Writable; - stdout: Readable; - stderr: Readable; - readonly stdio: [ - Writable, - Readable, - Readable, - // stderr - Readable | Writable | null | undefined, - // extra, no modification - Readable | Writable | null | undefined, // extra, no modification - ]; - } - // return this object when stdio option is a tuple of 3 - interface ChildProcessByStdio - extends ChildProcess - { - stdin: I; - stdout: O; - stderr: E; - readonly stdio: [ - I, - O, - E, - Readable | Writable | null | undefined, - // extra, no modification - Readable | Writable | null | undefined, // extra, no modification - ]; - } - interface Control extends EventEmitter { - ref(): void; - unref(): void; - } - interface MessageOptions { - keepOpen?: boolean | undefined; - } - type IOType = "overlapped" | "pipe" | "ignore" | "inherit"; - type StdioOptions = IOType | Array; - type SerializationType = "json" | "advanced"; - interface MessagingOptions extends Abortable { - /** - * Specify the kind of serialization used for sending messages between processes. - * @default 'json' - */ - serialization?: SerializationType | undefined; - /** - * The signal value to be used when the spawned process will be killed by the abort signal. - * @default 'SIGTERM' - */ - killSignal?: NodeJS.Signals | number | undefined; - /** - * In milliseconds the maximum amount of time the process is allowed to run. - */ - timeout?: number | undefined; - } - interface ProcessEnvOptions { - uid?: number | undefined; - gid?: number | undefined; - cwd?: string | URL | undefined; - env?: NodeJS.ProcessEnv | undefined; - } - interface CommonOptions extends ProcessEnvOptions { - /** - * @default false - */ - windowsHide?: boolean | undefined; - /** - * @default 0 - */ - timeout?: number | undefined; - } - interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable { - argv0?: string | undefined; - /** - * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. - * If passed as an array, the first element is used for `stdin`, the second for - * `stdout`, and the third for `stderr`. A fourth element can be used to - * specify the `stdio` behavior beyond the standard streams. See - * {@link ChildProcess.stdio} for more information. - * - * @default 'pipe' - */ - stdio?: StdioOptions | undefined; - shell?: boolean | string | undefined; - windowsVerbatimArguments?: boolean | undefined; - } - interface SpawnOptions extends CommonSpawnOptions { - detached?: boolean | undefined; - } - interface SpawnOptionsWithoutStdio extends SpawnOptions { - stdio?: StdioPipeNamed | StdioPipe[] | undefined; - } - type StdioNull = "inherit" | "ignore" | Stream; - type StdioPipeNamed = "pipe" | "overlapped"; - type StdioPipe = undefined | null | StdioPipeNamed; - interface SpawnOptionsWithStdioTuple< - Stdin extends StdioNull | StdioPipe, - Stdout extends StdioNull | StdioPipe, - Stderr extends StdioNull | StdioPipe, - > extends SpawnOptions { - stdio: [Stdin, Stdout, Stderr]; - } - /** - * The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults - * to an empty array. - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * - * A third argument may be used to specify additional options, with these defaults: - * - * ```js - * const defaults = { - * cwd: undefined, - * env: process.env, - * }; - * ``` - * - * Use `cwd` to specify the working directory from which the process is spawned. - * If not given, the default is to inherit the current working directory. If given, - * but the path does not exist, the child process emits an `ENOENT` error - * and exits immediately. `ENOENT` is also emitted when the command - * does not exist. - * - * Use `env` to specify environment variables that will be visible to the new - * process, the default is `process.env`. - * - * `undefined` values in `env` will be ignored. - * - * Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the - * exit code: - * - * ```js - * import { spawn } from 'node:child_process'; - * const ls = spawn('ls', ['-lh', '/usr']); - * - * ls.stdout.on('data', (data) => { - * console.log(`stdout: ${data}`); - * }); - * - * ls.stderr.on('data', (data) => { - * console.error(`stderr: ${data}`); - * }); - * - * ls.on('close', (code) => { - * console.log(`child process exited with code ${code}`); - * }); - * ``` - * - * Example: A very elaborate way to run `ps ax | grep ssh` - * - * ```js - * import { spawn } from 'node:child_process'; - * const ps = spawn('ps', ['ax']); - * const grep = spawn('grep', ['ssh']); - * - * ps.stdout.on('data', (data) => { - * grep.stdin.write(data); - * }); - * - * ps.stderr.on('data', (data) => { - * console.error(`ps stderr: ${data}`); - * }); - * - * ps.on('close', (code) => { - * if (code !== 0) { - * console.log(`ps process exited with code ${code}`); - * } - * grep.stdin.end(); - * }); - * - * grep.stdout.on('data', (data) => { - * console.log(data.toString()); - * }); - * - * grep.stderr.on('data', (data) => { - * console.error(`grep stderr: ${data}`); - * }); - * - * grep.on('close', (code) => { - * if (code !== 0) { - * console.log(`grep process exited with code ${code}`); - * } - * }); - * ``` - * - * Example of checking for failed `spawn`: - * - * ```js - * import { spawn } from 'node:child_process'; - * const subprocess = spawn('bad_command'); - * - * subprocess.on('error', (err) => { - * console.error('Failed to start subprocess.'); - * }); - * ``` - * - * Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process - * title while others (Windows, SunOS) will use `command`. - * - * Node.js overwrites `argv[0]` with `process.execPath` on startup, so `process.argv[0]` in a Node.js child process will not match the `argv0` parameter passed to `spawn` from the parent. Retrieve - * it with the `process.argv0` property instead. - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * import { spawn } from 'node:child_process'; - * const controller = new AbortController(); - * const { signal } = controller; - * const grep = spawn('grep', ['ssh'], { signal }); - * grep.on('error', (err) => { - * // This will be called with err being an AbortError if the controller aborts - * }); - * controller.abort(); // Stops the child process - * ``` - * @since v0.1.90 - * @param command The command to run. - * @param args List of string arguments. - */ - function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn(command: string, options: SpawnOptions): ChildProcess; - // overloads of spawn with 'args' - function spawn( - command: string, - args?: readonly string[], - options?: SpawnOptionsWithoutStdio, - ): ChildProcessWithoutNullStreams; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn(command: string, args: readonly string[], options: SpawnOptions): ChildProcess; - interface ExecOptions extends CommonOptions { - shell?: string | undefined; - signal?: AbortSignal | undefined; - maxBuffer?: number | undefined; - killSignal?: NodeJS.Signals | number | undefined; - encoding?: string | null | undefined; - } - interface ExecOptionsWithStringEncoding extends ExecOptions { - encoding?: BufferEncoding | undefined; - } - interface ExecOptionsWithBufferEncoding extends ExecOptions { - encoding: "buffer" | null; // specify `null`. - } - // TODO: Just Plain Wrong™ (see also nodejs/node#57392) - interface ExecException extends Error { - cmd?: string; - killed?: boolean; - code?: number; - signal?: NodeJS.Signals; - stdout?: string; - stderr?: string; - } - /** - * Spawns a shell then executes the `command` within that shell, buffering any - * generated output. The `command` string passed to the exec function is processed - * directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters)) - * need to be dealt with accordingly: - * - * ```js - * import { exec } from 'node:child_process'; - * - * exec('"/path/to/test file/test.sh" arg1 arg2'); - * // Double quotes are used so that the space in the path is not interpreted as - * // a delimiter of multiple arguments. - * - * exec('echo "The \\$HOME variable is $HOME"'); - * // The $HOME variable is escaped in the first instance, but not in the second. - * ``` - * - * **Never pass unsanitized user input to this function. Any input containing shell** - * **metacharacters may be used to trigger arbitrary command execution.** - * - * If a `callback` function is provided, it is called with the arguments `(error, stdout, stderr)`. On success, `error` will be `null`. On error, `error` will be an instance of `Error`. The - * `error.code` property will be - * the exit code of the process. By convention, any exit code other than `0` indicates an error. `error.signal` will be the signal that terminated the - * process. - * - * The `stdout` and `stderr` arguments passed to the callback will contain the - * stdout and stderr output of the child process. By default, Node.js will decode - * the output as UTF-8 and pass strings to the callback. The `encoding` option - * can be used to specify the character encoding used to decode the stdout and - * stderr output. If `encoding` is `'buffer'`, or an unrecognized character - * encoding, `Buffer` objects will be passed to the callback instead. - * - * ```js - * import { exec } from 'node:child_process'; - * exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => { - * if (error) { - * console.error(`exec error: ${error}`); - * return; - * } - * console.log(`stdout: ${stdout}`); - * console.error(`stderr: ${stderr}`); - * }); - * ``` - * - * If `timeout` is greater than `0`, the parent will send the signal - * identified by the `killSignal` property (the default is `'SIGTERM'`) if the - * child runs longer than `timeout` milliseconds. - * - * Unlike the [`exec(3)`](http://man7.org/linux/man-pages/man3/exec.3.html) POSIX system call, `child_process.exec()` does not replace - * the existing process and uses a shell to execute the command. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In - * case of an error (including any error resulting in an exit code other than 0), a - * rejected promise is returned, with the same `error` object given in the - * callback, but with two additional properties `stdout` and `stderr`. - * - * ```js - * import util from 'node:util'; - * import child_process from 'node:child_process'; - * const exec = util.promisify(child_process.exec); - * - * async function lsExample() { - * const { stdout, stderr } = await exec('ls'); - * console.log('stdout:', stdout); - * console.error('stderr:', stderr); - * } - * lsExample(); - * ``` - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * import { exec } from 'node:child_process'; - * const controller = new AbortController(); - * const { signal } = controller; - * const child = exec('grep ssh', { signal }, (error) => { - * console.error(error); // an AbortError - * }); - * controller.abort(); - * ``` - * @since v0.1.90 - * @param command The command to run, with space-separated arguments. - * @param callback called with the output when process terminates. - */ - function exec( - command: string, - callback?: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function exec( - command: string, - options: ExecOptionsWithBufferEncoding, - callback?: (error: ExecException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void, - ): ChildProcess; - // `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`. - function exec( - command: string, - options: ExecOptionsWithStringEncoding, - callback?: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function exec( - command: string, - options: ExecOptions | undefined | null, - callback?: ( - error: ExecException | null, - stdout: string | NonSharedBuffer, - stderr: string | NonSharedBuffer, - ) => void, - ): ChildProcess; - interface PromiseWithChild extends Promise { - child: ChildProcess; - } - namespace exec { - function __promisify__(command: string): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - command: string, - options: ExecOptionsWithBufferEncoding, - ): PromiseWithChild<{ - stdout: NonSharedBuffer; - stderr: NonSharedBuffer; - }>; - function __promisify__( - command: string, - options: ExecOptionsWithStringEncoding, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - command: string, - options: ExecOptions | undefined | null, - ): PromiseWithChild<{ - stdout: string | NonSharedBuffer; - stderr: string | NonSharedBuffer; - }>; - } - interface ExecFileOptions extends CommonOptions, Abortable { - maxBuffer?: number | undefined; - killSignal?: NodeJS.Signals | number | undefined; - windowsVerbatimArguments?: boolean | undefined; - shell?: boolean | string | undefined; - signal?: AbortSignal | undefined; - encoding?: string | null | undefined; - } - interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { - encoding?: BufferEncoding | undefined; - } - interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { - encoding: "buffer" | null; - } - /** @deprecated Use `ExecFileOptions` instead. */ - interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {} - // TODO: execFile exceptions can take many forms... this accurately describes none of them - type ExecFileException = - & Omit - & Omit - & { code?: string | number | null }; - /** - * The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified - * executable `file` is spawned directly as a new process making it slightly more - * efficient than {@link exec}. - * - * The same options as {@link exec} are supported. Since a shell is - * not spawned, behaviors such as I/O redirection and file globbing are not - * supported. - * - * ```js - * import { execFile } from 'node:child_process'; - * const child = execFile('node', ['--version'], (error, stdout, stderr) => { - * if (error) { - * throw error; - * } - * console.log(stdout); - * }); - * ``` - * - * The `stdout` and `stderr` arguments passed to the callback will contain the - * stdout and stderr output of the child process. By default, Node.js will decode - * the output as UTF-8 and pass strings to the callback. The `encoding` option - * can be used to specify the character encoding used to decode the stdout and - * stderr output. If `encoding` is `'buffer'`, or an unrecognized character - * encoding, `Buffer` objects will be passed to the callback instead. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In - * case of an error (including any error resulting in an exit code other than 0), a - * rejected promise is returned, with the same `error` object given in the - * callback, but with two additional properties `stdout` and `stderr`. - * - * ```js - * import util from 'node:util'; - * import child_process from 'node:child_process'; - * const execFile = util.promisify(child_process.execFile); - * async function getVersion() { - * const { stdout } = await execFile('node', ['--version']); - * console.log(stdout); - * } - * getVersion(); - * ``` - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * import { execFile } from 'node:child_process'; - * const controller = new AbortController(); - * const { signal } = controller; - * const child = execFile('node', ['--version'], { signal }, (error) => { - * console.error(error); // an AbortError - * }); - * controller.abort(); - * ``` - * @since v0.1.91 - * @param file The name or path of the executable file to run. - * @param args List of string arguments. - * @param callback Called with the output when process terminates. - */ - // no `options` definitely means stdout/stderr are `string`. - function execFile( - file: string, - callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function execFile( - file: string, - options: ExecFileOptionsWithBufferEncoding, - callback?: (error: ExecFileException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithBufferEncoding, - callback?: (error: ExecFileException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void, - ): ChildProcess; - // `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`. - function execFile( - file: string, - options: ExecFileOptionsWithStringEncoding, - callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithStringEncoding, - callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function execFile( - file: string, - options: ExecFileOptions | undefined | null, - callback: - | (( - error: ExecFileException | null, - stdout: string | NonSharedBuffer, - stderr: string | NonSharedBuffer, - ) => void) - | undefined - | null, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptions | undefined | null, - callback: - | (( - error: ExecFileException | null, - stdout: string | NonSharedBuffer, - stderr: string | NonSharedBuffer, - ) => void) - | undefined - | null, - ): ChildProcess; - namespace execFile { - function __promisify__(file: string): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - options: ExecFileOptionsWithBufferEncoding, - ): PromiseWithChild<{ - stdout: NonSharedBuffer; - stderr: NonSharedBuffer; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithBufferEncoding, - ): PromiseWithChild<{ - stdout: NonSharedBuffer; - stderr: NonSharedBuffer; - }>; - function __promisify__( - file: string, - options: ExecFileOptionsWithStringEncoding, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithStringEncoding, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - options: ExecFileOptions | undefined | null, - ): PromiseWithChild<{ - stdout: string | NonSharedBuffer; - stderr: string | NonSharedBuffer; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptions | undefined | null, - ): PromiseWithChild<{ - stdout: string | NonSharedBuffer; - stderr: string | NonSharedBuffer; - }>; - } - interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable { - execPath?: string | undefined; - execArgv?: string[] | undefined; - silent?: boolean | undefined; - /** - * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. - * If passed as an array, the first element is used for `stdin`, the second for - * `stdout`, and the third for `stderr`. A fourth element can be used to - * specify the `stdio` behavior beyond the standard streams. See - * {@link ChildProcess.stdio} for more information. - * - * @default 'pipe' - */ - stdio?: StdioOptions | undefined; - detached?: boolean | undefined; - windowsVerbatimArguments?: boolean | undefined; - } - /** - * The `child_process.fork()` method is a special case of {@link spawn} used specifically to spawn new Node.js processes. - * Like {@link spawn}, a `ChildProcess` object is returned. The - * returned `ChildProcess` will have an additional communication channel - * built-in that allows messages to be passed back and forth between the parent and - * child. See `subprocess.send()` for details. - * - * Keep in mind that spawned Node.js child processes are - * independent of the parent with exception of the IPC communication channel - * that is established between the two. Each process has its own memory, with - * their own V8 instances. Because of the additional resource allocations - * required, spawning a large number of child Node.js processes is not - * recommended. - * - * By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the `options` object allows for an alternative - * execution path to be used. - * - * Node.js processes launched with a custom `execPath` will communicate with the - * parent process using the file descriptor (fd) identified using the - * environment variable `NODE_CHANNEL_FD` on the child process. - * - * Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the - * current process. - * - * The `shell` option available in {@link spawn} is not supported by `child_process.fork()` and will be ignored if set. - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * if (process.argv[2] === 'child') { - * setTimeout(() => { - * console.log(`Hello from ${process.argv[2]}!`); - * }, 1_000); - * } else { - * import { fork } from 'node:child_process'; - * const controller = new AbortController(); - * const { signal } = controller; - * const child = fork(__filename, ['child'], { signal }); - * child.on('error', (err) => { - * // This will be called with err being an AbortError if the controller aborts - * }); - * controller.abort(); // Stops the child process - * } - * ``` - * @since v0.5.0 - * @param modulePath The module to run in the child. - * @param args List of string arguments. - */ - function fork(modulePath: string | URL, options?: ForkOptions): ChildProcess; - function fork(modulePath: string | URL, args?: readonly string[], options?: ForkOptions): ChildProcess; - interface SpawnSyncOptions extends CommonSpawnOptions { - input?: string | NodeJS.ArrayBufferView | undefined; - maxBuffer?: number | undefined; - encoding?: BufferEncoding | "buffer" | null | undefined; - } - interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { - encoding: BufferEncoding; - } - interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions { - encoding?: "buffer" | null | undefined; - } - interface SpawnSyncReturns { - pid: number; - output: Array; - stdout: T; - stderr: T; - status: number | null; - signal: NodeJS.Signals | null; - error?: Error; - } - /** - * The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return - * until the child process has fully closed. When a timeout has been encountered - * and `killSignal` is sent, the method won't return until the process has - * completely exited. If the process intercepts and handles the `SIGTERM` signal - * and doesn't exit, the parent process will wait until the child process has - * exited. - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * @since v0.11.12 - * @param command The command to run. - * @param args List of string arguments. - */ - function spawnSync(command: string): SpawnSyncReturns; - function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; - function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns; - function spawnSync( - command: string, - args: readonly string[], - options: SpawnSyncOptionsWithStringEncoding, - ): SpawnSyncReturns; - function spawnSync( - command: string, - args: readonly string[], - options: SpawnSyncOptionsWithBufferEncoding, - ): SpawnSyncReturns; - function spawnSync( - command: string, - args?: readonly string[], - options?: SpawnSyncOptions, - ): SpawnSyncReturns; - interface CommonExecOptions extends CommonOptions { - input?: string | NodeJS.ArrayBufferView | undefined; - /** - * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings. - * If passed as an array, the first element is used for `stdin`, the second for - * `stdout`, and the third for `stderr`. A fourth element can be used to - * specify the `stdio` behavior beyond the standard streams. See - * {@link ChildProcess.stdio} for more information. - * - * @default 'pipe' - */ - stdio?: StdioOptions | undefined; - killSignal?: NodeJS.Signals | number | undefined; - maxBuffer?: number | undefined; - encoding?: BufferEncoding | "buffer" | null | undefined; - } - interface ExecSyncOptions extends CommonExecOptions { - shell?: string | undefined; - } - interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions { - encoding: BufferEncoding; - } - interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions { - encoding?: "buffer" | null | undefined; - } - /** - * The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return - * until the child process has fully closed. When a timeout has been encountered - * and `killSignal` is sent, the method won't return until the process has - * completely exited. If the child process intercepts and handles the `SIGTERM` signal and doesn't exit, the parent process will wait until the child process - * has exited. - * - * If the process times out or has a non-zero exit code, this method will throw. - * The `Error` object will contain the entire result from {@link spawnSync}. - * - * **Never pass unsanitized user input to this function. Any input containing shell** - * **metacharacters may be used to trigger arbitrary command execution.** - * @since v0.11.12 - * @param command The command to run. - * @return The stdout from the command. - */ - function execSync(command: string): NonSharedBuffer; - function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string; - function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): NonSharedBuffer; - function execSync(command: string, options?: ExecSyncOptions): string | NonSharedBuffer; - interface ExecFileSyncOptions extends CommonExecOptions { - shell?: boolean | string | undefined; - } - interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions { - encoding: BufferEncoding; - } - interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions { - encoding?: "buffer" | null | undefined; // specify `null`. - } - /** - * The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not - * return until the child process has fully closed. When a timeout has been - * encountered and `killSignal` is sent, the method won't return until the process - * has completely exited. - * - * If the child process intercepts and handles the `SIGTERM` signal and - * does not exit, the parent process will still wait until the child process has - * exited. - * - * If the process times out or has a non-zero exit code, this method will throw an `Error` that will include the full result of the underlying {@link spawnSync}. - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * @since v0.11.12 - * @param file The name or path of the executable file to run. - * @param args List of string arguments. - * @return The stdout from the command. - */ - function execFileSync(file: string): NonSharedBuffer; - function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string; - function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): NonSharedBuffer; - function execFileSync(file: string, options?: ExecFileSyncOptions): string | NonSharedBuffer; - function execFileSync(file: string, args: readonly string[]): NonSharedBuffer; - function execFileSync( - file: string, - args: readonly string[], - options: ExecFileSyncOptionsWithStringEncoding, - ): string; - function execFileSync( - file: string, - args: readonly string[], - options: ExecFileSyncOptionsWithBufferEncoding, - ): NonSharedBuffer; - function execFileSync( - file: string, - args?: readonly string[], - options?: ExecFileSyncOptions, - ): string | NonSharedBuffer; -} -declare module "node:child_process" { - export * from "child_process"; -} diff --git a/node_modules/@types/node/cluster.d.ts b/node_modules/@types/node/cluster.d.ts deleted file mode 100644 index eab9783..0000000 --- a/node_modules/@types/node/cluster.d.ts +++ /dev/null @@ -1,578 +0,0 @@ -/** - * Clusters of Node.js processes can be used to run multiple instances of Node.js - * that can distribute workloads among their application threads. When process isolation - * is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html) - * module instead, which allows running multiple application threads within a single Node.js instance. - * - * The cluster module allows easy creation of child processes that all share - * server ports. - * - * ```js - * import cluster from 'node:cluster'; - * import http from 'node:http'; - * import { availableParallelism } from 'node:os'; - * import process from 'node:process'; - * - * const numCPUs = availableParallelism(); - * - * if (cluster.isPrimary) { - * console.log(`Primary ${process.pid} is running`); - * - * // Fork workers. - * for (let i = 0; i < numCPUs; i++) { - * cluster.fork(); - * } - * - * cluster.on('exit', (worker, code, signal) => { - * console.log(`worker ${worker.process.pid} died`); - * }); - * } else { - * // Workers can share any TCP connection - * // In this case it is an HTTP server - * http.createServer((req, res) => { - * res.writeHead(200); - * res.end('hello world\n'); - * }).listen(8000); - * - * console.log(`Worker ${process.pid} started`); - * } - * ``` - * - * Running Node.js will now share port 8000 between the workers: - * - * ```console - * $ node server.js - * Primary 3596 is running - * Worker 4324 started - * Worker 4520 started - * Worker 6056 started - * Worker 5644 started - * ``` - * - * On Windows, it is not yet possible to set up a named pipe server in a worker. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/cluster.js) - */ -declare module "cluster" { - import * as child from "node:child_process"; - import EventEmitter = require("node:events"); - import * as net from "node:net"; - type SerializationType = "json" | "advanced"; - export interface ClusterSettings { - /** - * List of string arguments passed to the Node.js executable. - * @default process.execArgv - */ - execArgv?: string[] | undefined; - /** - * File path to worker file. - * @default process.argv[1] - */ - exec?: string | undefined; - /** - * String arguments passed to worker. - * @default process.argv.slice(2) - */ - args?: readonly string[] | undefined; - /** - * Whether or not to send output to parent's stdio. - * @default false - */ - silent?: boolean | undefined; - /** - * Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must - * contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processspawncommand-args-options)'s - * [`stdio`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#optionsstdio). - */ - stdio?: any[] | undefined; - /** - * Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).) - */ - uid?: number | undefined; - /** - * Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).) - */ - gid?: number | undefined; - /** - * Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number. - * By default each worker gets its own port, incremented from the primary's `process.debugPort`. - */ - inspectPort?: number | (() => number) | undefined; - /** - * Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`. - * See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#advanced-serialization) for more details. - * @default false - */ - serialization?: SerializationType | undefined; - /** - * Current working directory of the worker process. - * @default undefined (inherits from parent process) - */ - cwd?: string | undefined; - /** - * Hide the forked processes console window that would normally be created on Windows systems. - * @default false - */ - windowsHide?: boolean | undefined; - } - export interface Address { - address: string; - port: number; - /** - * The `addressType` is one of: - * - * * `4` (TCPv4) - * * `6` (TCPv6) - * * `-1` (Unix domain socket) - * * `'udp4'` or `'udp6'` (UDPv4 or UDPv6) - */ - addressType: 4 | 6 | -1 | "udp4" | "udp6"; - } - /** - * A `Worker` object contains all public information and method about a worker. - * In the primary it can be obtained using `cluster.workers`. In a worker - * it can be obtained using `cluster.worker`. - * @since v0.7.0 - */ - export class Worker extends EventEmitter { - /** - * Each new worker is given its own unique id, this id is stored in the `id`. - * - * While a worker is alive, this is the key that indexes it in `cluster.workers`. - * @since v0.8.0 - */ - id: number; - /** - * All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object - * from this function is stored as `.process`. In a worker, the global `process` is stored. - * - * See: [Child Process module](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processforkmodulepath-args-options). - * - * Workers will call `process.exit(0)` if the `'disconnect'` event occurs - * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against - * accidental disconnection. - * @since v0.7.0 - */ - process: child.ChildProcess; - /** - * Send a message to a worker or primary, optionally with a handle. - * - * In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). - * - * In a worker, this sends a message to the primary. It is identical to `process.send()`. - * - * This example will echo back all messages from the primary: - * - * ```js - * if (cluster.isPrimary) { - * const worker = cluster.fork(); - * worker.send('hi there'); - * - * } else if (cluster.isWorker) { - * process.on('message', (msg) => { - * process.send(msg); - * }); - * } - * ``` - * @since v0.7.0 - * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. - */ - send(message: child.Serializable, callback?: (error: Error | null) => void): boolean; - send( - message: child.Serializable, - sendHandle: child.SendHandle, - callback?: (error: Error | null) => void, - ): boolean; - send( - message: child.Serializable, - sendHandle: child.SendHandle, - options?: child.MessageOptions, - callback?: (error: Error | null) => void, - ): boolean; - /** - * This function will kill the worker. In the primary worker, it does this by - * disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by killing the process with `signal`. - * - * The `kill()` function kills the worker process without waiting for a graceful - * disconnect, it has the same behavior as `worker.process.kill()`. - * - * This method is aliased as `worker.destroy()` for backwards compatibility. - * - * In a worker, `process.kill()` exists, but it is not this function; - * it is [`kill()`](https://nodejs.org/docs/latest-v22.x/api/process.html#processkillpid-signal). - * @since v0.9.12 - * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process. - */ - kill(signal?: string): void; - destroy(signal?: string): void; - /** - * In a worker, this function will close all servers, wait for the `'close'` event - * on those servers, and then disconnect the IPC channel. - * - * In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself. - * - * Causes `.exitedAfterDisconnect` to be set. - * - * After a server is closed, it will no longer accept new connections, - * but connections may be accepted by any other listening worker. Existing - * connections will be allowed to close as usual. When no more connections exist, - * see `server.close()`, the IPC channel to the worker will close allowing it - * to die gracefully. - * - * The above applies _only_ to server connections, client connections are not - * automatically closed by workers, and disconnect does not wait for them to close - * before exiting. - * - * In a worker, `process.disconnect` exists, but it is not this function; - * it is `disconnect()`. - * - * Because long living server connections may block workers from disconnecting, it - * may be useful to send a message, so application specific actions may be taken to - * close them. It also may be useful to implement a timeout, killing a worker if - * the `'disconnect'` event has not been emitted after some time. - * - * ```js - * import net from 'node:net'; - * - * if (cluster.isPrimary) { - * const worker = cluster.fork(); - * let timeout; - * - * worker.on('listening', (address) => { - * worker.send('shutdown'); - * worker.disconnect(); - * timeout = setTimeout(() => { - * worker.kill(); - * }, 2000); - * }); - * - * worker.on('disconnect', () => { - * clearTimeout(timeout); - * }); - * - * } else if (cluster.isWorker) { - * const server = net.createServer((socket) => { - * // Connections never end - * }); - * - * server.listen(8000); - * - * process.on('message', (msg) => { - * if (msg === 'shutdown') { - * // Initiate graceful close of any connections to server - * } - * }); - * } - * ``` - * @since v0.7.7 - * @return A reference to `worker`. - */ - disconnect(): this; - /** - * This function returns `true` if the worker is connected to its primary via its - * IPC channel, `false` otherwise. A worker is connected to its primary after it - * has been created. It is disconnected after the `'disconnect'` event is emitted. - * @since v0.11.14 - */ - isConnected(): boolean; - /** - * This function returns `true` if the worker's process has terminated (either - * because of exiting or being signaled). Otherwise, it returns `false`. - * - * ```js - * import cluster from 'node:cluster'; - * import http from 'node:http'; - * import { availableParallelism } from 'node:os'; - * import process from 'node:process'; - * - * const numCPUs = availableParallelism(); - * - * if (cluster.isPrimary) { - * console.log(`Primary ${process.pid} is running`); - * - * // Fork workers. - * for (let i = 0; i < numCPUs; i++) { - * cluster.fork(); - * } - * - * cluster.on('fork', (worker) => { - * console.log('worker is dead:', worker.isDead()); - * }); - * - * cluster.on('exit', (worker, code, signal) => { - * console.log('worker is dead:', worker.isDead()); - * }); - * } else { - * // Workers can share any TCP connection. In this case, it is an HTTP server. - * http.createServer((req, res) => { - * res.writeHead(200); - * res.end(`Current process\n ${process.pid}`); - * process.kill(process.pid); - * }).listen(8000); - * } - * ``` - * @since v0.11.14 - */ - isDead(): boolean; - /** - * This property is `true` if the worker exited due to `.disconnect()`. - * If the worker exited any other way, it is `false`. If the - * worker has not exited, it is `undefined`. - * - * The boolean `worker.exitedAfterDisconnect` allows distinguishing between - * voluntary and accidental exit, the primary may choose not to respawn a worker - * based on this value. - * - * ```js - * cluster.on('exit', (worker, code, signal) => { - * if (worker.exitedAfterDisconnect === true) { - * console.log('Oh, it was just voluntary – no need to worry'); - * } - * }); - * - * // kill worker - * worker.kill(); - * ``` - * @since v6.0.0 - */ - exitedAfterDisconnect: boolean; - /** - * events.EventEmitter - * 1. disconnect - * 2. error - * 3. exit - * 4. listening - * 5. message - * 6. online - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "exit", listener: (code: number, signal: string) => void): this; - addListener(event: "listening", listener: (address: Address) => void): this; - addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "exit", code: number, signal: string): boolean; - emit(event: "listening", address: Address): boolean; - emit(event: "message", message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online"): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "exit", listener: (code: number, signal: string) => void): this; - on(event: "listening", listener: (address: Address) => void): this; - on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "exit", listener: (code: number, signal: string) => void): this; - once(event: "listening", listener: (address: Address) => void): this; - once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependListener(event: "listening", listener: (address: Address) => void): this; - prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependListener(event: "online", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependOnceListener(event: "listening", listener: (address: Address) => void): this; - prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener(event: "online", listener: () => void): this; - } - export interface Cluster extends EventEmitter { - disconnect(callback?: () => void): void; - /** - * Spawn a new worker process. - * - * This can only be called from the primary process. - * @param env Key/value pairs to add to worker process environment. - * @since v0.6.0 - */ - fork(env?: any): Worker; - /** @deprecated since v16.0.0 - use isPrimary. */ - readonly isMaster: boolean; - /** - * True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID` - * is undefined, then `isPrimary` is `true`. - * @since v16.0.0 - */ - readonly isPrimary: boolean; - /** - * True if the process is not a primary (it is the negation of `cluster.isPrimary`). - * @since v0.6.0 - */ - readonly isWorker: boolean; - /** - * The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a - * global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) - * is called, whichever comes first. - * - * `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute - * IOCP handles without incurring a large performance hit. - * - * `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`. - * @since v0.11.2 - */ - schedulingPolicy: number; - /** - * After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) - * (or [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv)) this settings object will contain - * the settings, including the default values. - * - * This object is not intended to be changed or set manually. - * @since v0.7.1 - */ - readonly settings: ClusterSettings; - /** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) instead. */ - setupMaster(settings?: ClusterSettings): void; - /** - * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`. - * - * Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv) - * and have no effect on workers that are already running. - * - * The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to - * [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv). - * - * The defaults above apply to the first call only; the defaults for later calls are the current values at the time of - * `cluster.setupPrimary()` is called. - * - * ```js - * import cluster from 'node:cluster'; - * - * cluster.setupPrimary({ - * exec: 'worker.js', - * args: ['--use', 'https'], - * silent: true, - * }); - * cluster.fork(); // https worker - * cluster.setupPrimary({ - * exec: 'worker.js', - * args: ['--use', 'http'], - * }); - * cluster.fork(); // http worker - * ``` - * - * This can only be called from the primary process. - * @since v16.0.0 - */ - setupPrimary(settings?: ClusterSettings): void; - /** - * A reference to the current worker object. Not available in the primary process. - * - * ```js - * import cluster from 'node:cluster'; - * - * if (cluster.isPrimary) { - * console.log('I am primary'); - * cluster.fork(); - * cluster.fork(); - * } else if (cluster.isWorker) { - * console.log(`I am worker #${cluster.worker.id}`); - * } - * ``` - * @since v0.7.0 - */ - readonly worker?: Worker; - /** - * A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process. - * - * A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it - * is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted. - * - * ```js - * import cluster from 'node:cluster'; - * - * for (const worker of Object.values(cluster.workers)) { - * worker.send('big announcement to all workers'); - * } - * ``` - * @since v0.7.0 - */ - readonly workers?: NodeJS.Dict; - readonly SCHED_NONE: number; - readonly SCHED_RR: number; - /** - * events.EventEmitter - * 1. disconnect - * 2. exit - * 3. fork - * 4. listening - * 5. message - * 6. online - * 7. setup - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: (worker: Worker) => void): this; - addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - addListener(event: "fork", listener: (worker: Worker) => void): this; - addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - addListener( - event: "message", - listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, - ): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: (worker: Worker) => void): this; - addListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect", worker: Worker): boolean; - emit(event: "exit", worker: Worker, code: number, signal: string): boolean; - emit(event: "fork", worker: Worker): boolean; - emit(event: "listening", worker: Worker, address: Address): boolean; - emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online", worker: Worker): boolean; - emit(event: "setup", settings: ClusterSettings): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: (worker: Worker) => void): this; - on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - on(event: "fork", listener: (worker: Worker) => void): this; - on(event: "listening", listener: (worker: Worker, address: Address) => void): this; - on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: (worker: Worker) => void): this; - on(event: "setup", listener: (settings: ClusterSettings) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: (worker: Worker) => void): this; - once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - once(event: "fork", listener: (worker: Worker) => void): this; - once(event: "listening", listener: (worker: Worker, address: Address) => void): this; - once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: (worker: Worker) => void): this; - once(event: "setup", listener: (settings: ClusterSettings) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependListener(event: "fork", listener: (worker: Worker) => void): this; - prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - prependListener( - event: "message", - listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, - ): this; - prependListener(event: "online", listener: (worker: Worker) => void): this; - prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependOnceListener(event: "fork", listener: (worker: Worker) => void): this; - prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener( - event: "message", - listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, - ): this; - prependOnceListener(event: "online", listener: (worker: Worker) => void): this; - prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - } - const cluster: Cluster; - export default cluster; -} -declare module "node:cluster" { - export * from "cluster"; - export { default as default } from "cluster"; -} diff --git a/node_modules/@types/node/compatibility/disposable.d.ts b/node_modules/@types/node/compatibility/disposable.d.ts deleted file mode 100644 index e23d5a7..0000000 --- a/node_modules/@types/node/compatibility/disposable.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Polyfills for the explicit resource management types added in TypeScript 5.2. - -interface SymbolConstructor { - readonly dispose: unique symbol; - readonly asyncDispose: unique symbol; -} - -interface Disposable { - [Symbol.dispose](): void; -} - -interface AsyncDisposable { - [Symbol.asyncDispose](): PromiseLike; -} diff --git a/node_modules/@types/node/compatibility/index.d.ts b/node_modules/@types/node/compatibility/index.d.ts deleted file mode 100644 index 5c41e37..0000000 --- a/node_modules/@types/node/compatibility/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Declaration files in this directory contain types relating to TypeScript library features -// that are not included in all TypeScript versions supported by DefinitelyTyped, but -// which can be made backwards-compatible without needing `typesVersions`. -// If adding declarations to this directory, please specify which versions of TypeScript require them, -// so that they can be removed when no longer needed. - -/// -/// -/// diff --git a/node_modules/@types/node/compatibility/indexable.d.ts b/node_modules/@types/node/compatibility/indexable.d.ts deleted file mode 100644 index 262ba09..0000000 --- a/node_modules/@types/node/compatibility/indexable.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Polyfill for ES2022's .at() method on string/array prototypes, added to TypeScript in 4.6. - -interface RelativeIndexable { - at(index: number): T | undefined; -} - -interface String extends RelativeIndexable {} -interface Array extends RelativeIndexable {} -interface ReadonlyArray extends RelativeIndexable {} -interface Int8Array extends RelativeIndexable {} -interface Uint8Array extends RelativeIndexable {} -interface Uint8ClampedArray extends RelativeIndexable {} -interface Int16Array extends RelativeIndexable {} -interface Uint16Array extends RelativeIndexable {} -interface Int32Array extends RelativeIndexable {} -interface Uint32Array extends RelativeIndexable {} -interface Float32Array extends RelativeIndexable {} -interface Float64Array extends RelativeIndexable {} -interface BigInt64Array extends RelativeIndexable {} -interface BigUint64Array extends RelativeIndexable {} diff --git a/node_modules/@types/node/compatibility/iterators.d.ts b/node_modules/@types/node/compatibility/iterators.d.ts deleted file mode 100644 index 2f9be9c..0000000 --- a/node_modules/@types/node/compatibility/iterators.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Backwards-compatible iterator interfaces, augmented with iterator helper methods by lib.esnext.iterator in TypeScript 5.6. -// The IterableIterator interface does not contain these methods, which creates assignability issues in places where IteratorObjects -// are expected (eg. DOM-compatible APIs) if lib.esnext.iterator is loaded. -// Also ensures that iterators returned by the Node API, which inherit from Iterator.prototype, correctly expose the iterator helper methods -// if lib.esnext.iterator is loaded. - -// Placeholders for TS <5.6 -interface IteratorObject {} -interface AsyncIteratorObject {} - -declare namespace NodeJS { - // Populate iterator methods for TS <5.6 - interface Iterator extends globalThis.Iterator {} - interface AsyncIterator extends globalThis.AsyncIterator {} - - // Polyfill for TS 5.6's instrinsic BuiltinIteratorReturn type, required for DOM-compatible iterators - type BuiltinIteratorReturn = ReturnType extends - globalThis.Iterator ? TReturn - : any; -} diff --git a/node_modules/@types/node/console.d.ts b/node_modules/@types/node/console.d.ts deleted file mode 100644 index 3e4c2d9..0000000 --- a/node_modules/@types/node/console.d.ts +++ /dev/null @@ -1,452 +0,0 @@ -/** - * The `node:console` module provides a simple debugging console that is similar to - * the JavaScript console mechanism provided by web browsers. - * - * The module exports two specific components: - * - * * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream. - * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and - * [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. - * - * _**Warning**_: The global console object's methods are neither consistently - * synchronous like the browser APIs they resemble, nor are they consistently - * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for - * more information. - * - * Example using the global `console`: - * - * ```js - * console.log('hello world'); - * // Prints: hello world, to stdout - * console.log('hello %s', 'world'); - * // Prints: hello world, to stdout - * console.error(new Error('Whoops, something bad happened')); - * // Prints error message and stack trace to stderr: - * // Error: Whoops, something bad happened - * // at [eval]:5:15 - * // at Script.runInThisContext (node:vm:132:18) - * // at Object.runInThisContext (node:vm:309:38) - * // at node:internal/process/execution:77:19 - * // at [eval]-wrapper:6:22 - * // at evalScript (node:internal/process/execution:76:60) - * // at node:internal/main/eval_string:23:3 - * - * const name = 'Will Robinson'; - * console.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to stderr - * ``` - * - * Example using the `Console` class: - * - * ```js - * const out = getStreamSomehow(); - * const err = getStreamSomehow(); - * const myConsole = new console.Console(out, err); - * - * myConsole.log('hello world'); - * // Prints: hello world, to out - * myConsole.log('hello %s', 'world'); - * // Prints: hello world, to out - * myConsole.error(new Error('Whoops, something bad happened')); - * // Prints: [Error: Whoops, something bad happened], to err - * - * const name = 'Will Robinson'; - * myConsole.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to err - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/console.js) - */ -declare module "console" { - import console = require("node:console"); - export = console; -} -declare module "node:console" { - import { InspectOptions } from "node:util"; - global { - // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build - interface Console { - Console: console.ConsoleConstructor; - /** - * `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only - * writes a message and does not otherwise affect execution. The output always - * starts with `"Assertion failed"`. If provided, `message` is formatted using - * [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args). - * - * If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens. - * - * ```js - * console.assert(true, 'does nothing'); - * - * console.assert(false, 'Whoops %s work', 'didn\'t'); - * // Assertion failed: Whoops didn't work - * - * console.assert(); - * // Assertion failed - * ``` - * @since v0.1.101 - * @param value The value tested for being truthy. - * @param message All arguments besides `value` are used as error message. - */ - assert(value: any, message?: string, ...optionalParams: any[]): void; - /** - * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the - * TTY. When `stdout` is not a TTY, this method does nothing. - * - * The specific operation of `console.clear()` can vary across operating systems - * and terminal types. For most Linux operating systems, `console.clear()` operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the - * current terminal viewport for the Node.js - * binary. - * @since v8.3.0 - */ - clear(): void; - /** - * Maintains an internal counter specific to `label` and outputs to `stdout` the - * number of times `console.count()` has been called with the given `label`. - * - * ```js - * > console.count() - * default: 1 - * undefined - * > console.count('default') - * default: 2 - * undefined - * > console.count('abc') - * abc: 1 - * undefined - * > console.count('xyz') - * xyz: 1 - * undefined - * > console.count('abc') - * abc: 2 - * undefined - * > console.count() - * default: 3 - * undefined - * > - * ``` - * @since v8.3.0 - * @param [label='default'] The display label for the counter. - */ - count(label?: string): void; - /** - * Resets the internal counter specific to `label`. - * - * ```js - * > console.count('abc'); - * abc: 1 - * undefined - * > console.countReset('abc'); - * undefined - * > console.count('abc'); - * abc: 1 - * undefined - * > - * ``` - * @since v8.3.0 - * @param [label='default'] The display label for the counter. - */ - countReset(label?: string): void; - /** - * The `console.debug()` function is an alias for {@link log}. - * @since v8.0.0 - */ - debug(message?: any, ...optionalParams: any[]): void; - /** - * Uses [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`. - * This function bypasses any custom `inspect()` function defined on `obj`. - * @since v0.1.101 - */ - dir(obj: any, options?: InspectOptions): void; - /** - * This method calls `console.log()` passing it the arguments received. - * This method does not produce any XML formatting. - * @since v8.0.0 - */ - dirxml(...data: any[]): void; - /** - * Prints to `stderr` with newline. Multiple arguments can be passed, with the - * first used as the primary message and all additional used as substitution - * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) - * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). - * - * ```js - * const code = 5; - * console.error('error #%d', code); - * // Prints: error #5, to stderr - * console.error('error', code); - * // Prints: error 5, to stderr - * ``` - * - * If formatting elements (e.g. `%d`) are not found in the first string then - * [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options) is called on each argument and the - * resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) - * for more information. - * @since v0.1.100 - */ - error(message?: any, ...optionalParams: any[]): void; - /** - * Increases indentation of subsequent lines by spaces for `groupIndentation` length. - * - * If one or more `label`s are provided, those are printed first without the - * additional indentation. - * @since v8.5.0 - */ - group(...label: any[]): void; - /** - * An alias for {@link group}. - * @since v8.5.0 - */ - groupCollapsed(...label: any[]): void; - /** - * Decreases indentation of subsequent lines by spaces for `groupIndentation` length. - * @since v8.5.0 - */ - groupEnd(): void; - /** - * The `console.info()` function is an alias for {@link log}. - * @since v0.1.100 - */ - info(message?: any, ...optionalParams: any[]): void; - /** - * Prints to `stdout` with newline. Multiple arguments can be passed, with the - * first used as the primary message and all additional used as substitution - * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) - * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). - * - * ```js - * const count = 5; - * console.log('count: %d', count); - * // Prints: count: 5, to stdout - * console.log('count:', count); - * // Prints: count: 5, to stdout - * ``` - * - * See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information. - * @since v0.1.100 - */ - log(message?: any, ...optionalParams: any[]): void; - /** - * Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and rows of `tabularData` and log it. Falls back to just - * logging the argument if it can't be parsed as tabular. - * - * ```js - * // These can't be parsed as tabular data - * console.table(Symbol()); - * // Symbol() - * - * console.table(undefined); - * // undefined - * - * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]); - * // ┌─────────┬─────┬─────┐ - * // │ (index) │ a │ b │ - * // ├─────────┼─────┼─────┤ - * // │ 0 │ 1 │ 'Y' │ - * // │ 1 │ 'Z' │ 2 │ - * // └─────────┴─────┴─────┘ - * - * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']); - * // ┌─────────┬─────┐ - * // │ (index) │ a │ - * // ├─────────┼─────┤ - * // │ 0 │ 1 │ - * // │ 1 │ 'Z' │ - * // └─────────┴─────┘ - * ``` - * @since v10.0.0 - * @param properties Alternate properties for constructing the table. - */ - table(tabularData: any, properties?: readonly string[]): void; - /** - * Starts a timer that can be used to compute the duration of an operation. Timers - * are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in - * suitable time units to `stdout`. For example, if the elapsed - * time is 3869ms, `console.timeEnd()` displays "3.869s". - * @since v0.1.104 - * @param [label='default'] - */ - time(label?: string): void; - /** - * Stops a timer that was previously started by calling {@link time} and - * prints the result to `stdout`: - * - * ```js - * console.time('bunch-of-stuff'); - * // Do a bunch of stuff. - * console.timeEnd('bunch-of-stuff'); - * // Prints: bunch-of-stuff: 225.438ms - * ``` - * @since v0.1.104 - * @param [label='default'] - */ - timeEnd(label?: string): void; - /** - * For a timer that was previously started by calling {@link time}, prints - * the elapsed time and other `data` arguments to `stdout`: - * - * ```js - * console.time('process'); - * const value = expensiveProcess1(); // Returns 42 - * console.timeLog('process', value); - * // Prints "process: 365.227ms 42". - * doExpensiveProcess2(value); - * console.timeEnd('process'); - * ``` - * @since v10.7.0 - * @param [label='default'] - */ - timeLog(label?: string, ...data: any[]): void; - /** - * Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) - * formatted message and stack trace to the current position in the code. - * - * ```js - * console.trace('Show me'); - * // Prints: (stack trace will vary based on where trace is called) - * // Trace: Show me - * // at repl:2:9 - * // at REPLServer.defaultEval (repl.js:248:27) - * // at bound (domain.js:287:14) - * // at REPLServer.runBound [as eval] (domain.js:300:12) - * // at REPLServer. (repl.js:412:12) - * // at emitOne (events.js:82:20) - * // at REPLServer.emit (events.js:169:7) - * // at REPLServer.Interface._onLine (readline.js:210:10) - * // at REPLServer.Interface._line (readline.js:549:8) - * // at REPLServer.Interface._ttyWrite (readline.js:826:14) - * ``` - * @since v0.1.104 - */ - trace(message?: any, ...optionalParams: any[]): void; - /** - * The `console.warn()` function is an alias for {@link error}. - * @since v0.1.100 - */ - warn(message?: any, ...optionalParams: any[]): void; - // --- Inspector mode only --- - /** - * This method does not display anything unless used in the inspector. The `console.profile()` - * method starts a JavaScript CPU profile with an optional label until {@link profileEnd} - * is called. The profile is then added to the Profile panel of the inspector. - * - * ```js - * console.profile('MyLabel'); - * // Some code - * console.profileEnd('MyLabel'); - * // Adds the profile 'MyLabel' to the Profiles panel of the inspector. - * ``` - * @since v8.0.0 - */ - profile(label?: string): void; - /** - * This method does not display anything unless used in the inspector. Stops the current - * JavaScript CPU profiling session if one has been started and prints the report to the - * Profiles panel of the inspector. See {@link profile} for an example. - * - * If this method is called without a label, the most recently started profile is stopped. - * @since v8.0.0 - */ - profileEnd(label?: string): void; - /** - * This method does not display anything unless used in the inspector. The `console.timeStamp()` - * method adds an event with the label `'label'` to the Timeline panel of the inspector. - * @since v8.0.0 - */ - timeStamp(label?: string): void; - } - /** - * The `console` module provides a simple debugging console that is similar to the - * JavaScript console mechanism provided by web browsers. - * - * The module exports two specific components: - * - * * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. - * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and - * [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. - * - * _**Warning**_: The global console object's methods are neither consistently - * synchronous like the browser APIs they resemble, nor are they consistently - * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for - * more information. - * - * Example using the global `console`: - * - * ```js - * console.log('hello world'); - * // Prints: hello world, to stdout - * console.log('hello %s', 'world'); - * // Prints: hello world, to stdout - * console.error(new Error('Whoops, something bad happened')); - * // Prints error message and stack trace to stderr: - * // Error: Whoops, something bad happened - * // at [eval]:5:15 - * // at Script.runInThisContext (node:vm:132:18) - * // at Object.runInThisContext (node:vm:309:38) - * // at node:internal/process/execution:77:19 - * // at [eval]-wrapper:6:22 - * // at evalScript (node:internal/process/execution:76:60) - * // at node:internal/main/eval_string:23:3 - * - * const name = 'Will Robinson'; - * console.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to stderr - * ``` - * - * Example using the `Console` class: - * - * ```js - * const out = getStreamSomehow(); - * const err = getStreamSomehow(); - * const myConsole = new console.Console(out, err); - * - * myConsole.log('hello world'); - * // Prints: hello world, to out - * myConsole.log('hello %s', 'world'); - * // Prints: hello world, to out - * myConsole.error(new Error('Whoops, something bad happened')); - * // Prints: [Error: Whoops, something bad happened], to err - * - * const name = 'Will Robinson'; - * myConsole.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to err - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/console.js) - */ - namespace console { - interface ConsoleConstructorOptions { - stdout: NodeJS.WritableStream; - stderr?: NodeJS.WritableStream | undefined; - /** - * Ignore errors when writing to the underlying streams. - * @default true - */ - ignoreErrors?: boolean | undefined; - /** - * Set color support for this `Console` instance. Setting to true enables coloring while inspecting - * values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color - * support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the - * respective stream. This option can not be used, if `inspectOptions.colors` is set as well. - * @default auto - */ - colorMode?: boolean | "auto" | undefined; - /** - * Specifies options that are passed along to - * [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options). - */ - inspectOptions?: InspectOptions | undefined; - /** - * Set group indentation. - * @default 2 - */ - groupIndentation?: number | undefined; - } - interface ConsoleConstructor { - prototype: Console; - new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console; - new(options: ConsoleConstructorOptions): Console; - } - } - var console: Console; - } - export = globalThis.console; -} diff --git a/node_modules/@types/node/constants.d.ts b/node_modules/@types/node/constants.d.ts deleted file mode 100644 index 5685a9d..0000000 --- a/node_modules/@types/node/constants.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @deprecated The `node:constants` module is deprecated. When requiring access to constants - * relevant to specific Node.js builtin modules, developers should instead refer - * to the `constants` property exposed by the relevant module. For instance, - * `require('node:fs').constants` and `require('node:os').constants`. - */ -declare module "constants" { - const constants: - & typeof import("node:os").constants.dlopen - & typeof import("node:os").constants.errno - & typeof import("node:os").constants.priority - & typeof import("node:os").constants.signals - & typeof import("node:fs").constants - & typeof import("node:crypto").constants; - export = constants; -} - -declare module "node:constants" { - import constants = require("constants"); - export = constants; -} diff --git a/node_modules/@types/node/crypto.d.ts b/node_modules/@types/node/crypto.d.ts deleted file mode 100644 index 9023805..0000000 --- a/node_modules/@types/node/crypto.d.ts +++ /dev/null @@ -1,4545 +0,0 @@ -/** - * The `node:crypto` module provides cryptographic functionality that includes a - * set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify - * functions. - * - * ```js - * const { createHmac } = await import('node:crypto'); - * - * const secret = 'abcdefg'; - * const hash = createHmac('sha256', secret) - * .update('I love cupcakes') - * .digest('hex'); - * console.log(hash); - * // Prints: - * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/crypto.js) - */ -declare module "crypto" { - import { NonSharedBuffer } from "node:buffer"; - import * as stream from "node:stream"; - import { PeerCertificate } from "node:tls"; - /** - * SPKAC is a Certificate Signing Request mechanism originally implemented by - * Netscape and was specified formally as part of HTML5's `keygen` element. - * - * `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects - * should not use this element anymore. - * - * The `node:crypto` module provides the `Certificate` class for working with SPKAC - * data. The most common usage is handling output generated by the HTML5 `` element. Node.js uses [OpenSSL's SPKAC - * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally. - * @since v0.11.8 - */ - class Certificate { - /** - * ```js - * const { Certificate } = await import('node:crypto'); - * const spkac = getSpkacSomehow(); - * const challenge = Certificate.exportChallenge(spkac); - * console.log(challenge.toString('utf8')); - * // Prints: the challenge as a UTF8 string - * ``` - * @since v9.0.0 - * @param encoding The `encoding` of the `spkac` string. - * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge. - */ - static exportChallenge(spkac: BinaryLike): NonSharedBuffer; - /** - * ```js - * const { Certificate } = await import('node:crypto'); - * const spkac = getSpkacSomehow(); - * const publicKey = Certificate.exportPublicKey(spkac); - * console.log(publicKey); - * // Prints: the public key as - * ``` - * @since v9.0.0 - * @param encoding The `encoding` of the `spkac` string. - * @return The public key component of the `spkac` data structure, which includes a public key and a challenge. - */ - static exportPublicKey(spkac: BinaryLike, encoding?: string): NonSharedBuffer; - /** - * ```js - * import { Buffer } from 'node:buffer'; - * const { Certificate } = await import('node:crypto'); - * - * const spkac = getSpkacSomehow(); - * console.log(Certificate.verifySpkac(Buffer.from(spkac))); - * // Prints: true or false - * ``` - * @since v9.0.0 - * @param encoding The `encoding` of the `spkac` string. - * @return `true` if the given `spkac` data structure is valid, `false` otherwise. - */ - static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; - /** - * @deprecated - * @param spkac - * @returns The challenge component of the `spkac` data structure, - * which includes a public key and a challenge. - */ - exportChallenge(spkac: BinaryLike): NonSharedBuffer; - /** - * @deprecated - * @param spkac - * @param encoding The encoding of the spkac string. - * @returns The public key component of the `spkac` data structure, - * which includes a public key and a challenge. - */ - exportPublicKey(spkac: BinaryLike, encoding?: string): NonSharedBuffer; - /** - * @deprecated - * @param spkac - * @returns `true` if the given `spkac` data structure is valid, - * `false` otherwise. - */ - verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; - } - namespace constants { - // https://nodejs.org/dist/latest-v22.x/docs/api/crypto.html#crypto-constants - const OPENSSL_VERSION_NUMBER: number; - /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */ - const SSL_OP_ALL: number; - /** Instructs OpenSSL to allow a non-[EC]DHE-based key exchange mode for TLS v1.3 */ - const SSL_OP_ALLOW_NO_DHE_KEX: number; - /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; - /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_CIPHER_SERVER_PREFERENCE: number; - /** Instructs OpenSSL to use Cisco's version identifier of DTLS_BAD_VER. */ - const SSL_OP_CISCO_ANYCONNECT: number; - /** Instructs OpenSSL to turn on cookie exchange. */ - const SSL_OP_COOKIE_EXCHANGE: number; - /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */ - const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; - /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */ - const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; - /** Allows initial connection to servers that do not support RI. */ - const SSL_OP_LEGACY_SERVER_CONNECT: number; - /** Instructs OpenSSL to disable support for SSL/TLS compression. */ - const SSL_OP_NO_COMPRESSION: number; - /** Instructs OpenSSL to disable encrypt-then-MAC. */ - const SSL_OP_NO_ENCRYPT_THEN_MAC: number; - const SSL_OP_NO_QUERY_MTU: number; - /** Instructs OpenSSL to disable renegotiation. */ - const SSL_OP_NO_RENEGOTIATION: number; - /** Instructs OpenSSL to always start a new session when performing renegotiation. */ - const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; - /** Instructs OpenSSL to turn off SSL v2 */ - const SSL_OP_NO_SSLv2: number; - /** Instructs OpenSSL to turn off SSL v3 */ - const SSL_OP_NO_SSLv3: number; - /** Instructs OpenSSL to disable use of RFC4507bis tickets. */ - const SSL_OP_NO_TICKET: number; - /** Instructs OpenSSL to turn off TLS v1 */ - const SSL_OP_NO_TLSv1: number; - /** Instructs OpenSSL to turn off TLS v1.1 */ - const SSL_OP_NO_TLSv1_1: number; - /** Instructs OpenSSL to turn off TLS v1.2 */ - const SSL_OP_NO_TLSv1_2: number; - /** Instructs OpenSSL to turn off TLS v1.3 */ - const SSL_OP_NO_TLSv1_3: number; - /** Instructs OpenSSL server to prioritize ChaCha20-Poly1305 when the client does. This option has no effect if `SSL_OP_CIPHER_SERVER_PREFERENCE` is not enabled. */ - const SSL_OP_PRIORITIZE_CHACHA: number; - /** Instructs OpenSSL to disable version rollback attack detection. */ - const SSL_OP_TLS_ROLLBACK_BUG: number; - const ENGINE_METHOD_RSA: number; - const ENGINE_METHOD_DSA: number; - const ENGINE_METHOD_DH: number; - const ENGINE_METHOD_RAND: number; - const ENGINE_METHOD_EC: number; - const ENGINE_METHOD_CIPHERS: number; - const ENGINE_METHOD_DIGESTS: number; - const ENGINE_METHOD_PKEY_METHS: number; - const ENGINE_METHOD_PKEY_ASN1_METHS: number; - const ENGINE_METHOD_ALL: number; - const ENGINE_METHOD_NONE: number; - const DH_CHECK_P_NOT_SAFE_PRIME: number; - const DH_CHECK_P_NOT_PRIME: number; - const DH_UNABLE_TO_CHECK_GENERATOR: number; - const DH_NOT_SUITABLE_GENERATOR: number; - const RSA_PKCS1_PADDING: number; - const RSA_SSLV23_PADDING: number; - const RSA_NO_PADDING: number; - const RSA_PKCS1_OAEP_PADDING: number; - const RSA_X931_PADDING: number; - const RSA_PKCS1_PSS_PADDING: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */ - const RSA_PSS_SALTLEN_DIGEST: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */ - const RSA_PSS_SALTLEN_MAX_SIGN: number; - /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */ - const RSA_PSS_SALTLEN_AUTO: number; - const POINT_CONVERSION_COMPRESSED: number; - const POINT_CONVERSION_UNCOMPRESSED: number; - const POINT_CONVERSION_HYBRID: number; - /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */ - const defaultCoreCipherList: string; - /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */ - const defaultCipherList: string; - } - interface HashOptions extends stream.TransformOptions { - /** - * For XOF hash functions such as `shake256`, the - * outputLength option can be used to specify the desired output length in bytes. - */ - outputLength?: number | undefined; - } - /** @deprecated since v10.0.0 */ - const fips: boolean; - /** - * Creates and returns a `Hash` object that can be used to generate hash digests - * using the given `algorithm`. Optional `options` argument controls stream - * behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option - * can be used to specify the desired output length in bytes. - * - * The `algorithm` is dependent on the available algorithms supported by the - * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. - * On recent releases of OpenSSL, `openssl list -digest-algorithms` will - * display the available digest algorithms. - * - * Example: generating the sha256 sum of a file - * - * ```js - * import { - * createReadStream, - * } from 'node:fs'; - * import { argv } from 'node:process'; - * const { - * createHash, - * } = await import('node:crypto'); - * - * const filename = argv[2]; - * - * const hash = createHash('sha256'); - * - * const input = createReadStream(filename); - * input.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = input.read(); - * if (data) - * hash.update(data); - * else { - * console.log(`${hash.digest('hex')} ${filename}`); - * } - * }); - * ``` - * @since v0.1.92 - * @param options `stream.transform` options - */ - function createHash(algorithm: string, options?: HashOptions): Hash; - /** - * Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. - * Optional `options` argument controls stream behavior. - * - * The `algorithm` is dependent on the available algorithms supported by the - * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. - * On recent releases of OpenSSL, `openssl list -digest-algorithms` will - * display the available digest algorithms. - * - * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is - * a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was - * obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not - * exceed the block size of `algorithm` (e.g., 512 bits for SHA-256). - * - * Example: generating the sha256 HMAC of a file - * - * ```js - * import { - * createReadStream, - * } from 'node:fs'; - * import { argv } from 'node:process'; - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const filename = argv[2]; - * - * const hmac = createHmac('sha256', 'a secret'); - * - * const input = createReadStream(filename); - * input.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = input.read(); - * if (data) - * hmac.update(data); - * else { - * console.log(`${hmac.digest('hex')} ${filename}`); - * } - * }); - * ``` - * @since v0.1.94 - * @param options `stream.transform` options - */ - function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac; - // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings - type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary"; - type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "utf-16le" | "latin1"; - type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2"; - type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding; - type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid"; - /** - * The `Hash` class is a utility for creating hash digests of data. It can be - * used in one of two ways: - * - * * As a `stream` that is both readable and writable, where data is written - * to produce a computed hash digest on the readable side, or - * * Using the `hash.update()` and `hash.digest()` methods to produce the - * computed hash. - * - * The {@link createHash} method is used to create `Hash` instances. `Hash`objects are not to be created directly using the `new` keyword. - * - * Example: Using `Hash` objects as streams: - * - * ```js - * const { - * createHash, - * } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * hash.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = hash.read(); - * if (data) { - * console.log(data.toString('hex')); - * // Prints: - * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 - * } - * }); - * - * hash.write('some data to hash'); - * hash.end(); - * ``` - * - * Example: Using `Hash` and piped streams: - * - * ```js - * import { createReadStream } from 'node:fs'; - * import { stdout } from 'node:process'; - * const { createHash } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * const input = createReadStream('test.js'); - * input.pipe(hash).setEncoding('hex').pipe(stdout); - * ``` - * - * Example: Using the `hash.update()` and `hash.digest()` methods: - * - * ```js - * const { - * createHash, - * } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * hash.update('some data to hash'); - * console.log(hash.digest('hex')); - * // Prints: - * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 - * ``` - * @since v0.1.92 - */ - class Hash extends stream.Transform { - private constructor(); - /** - * Creates a new `Hash` object that contains a deep copy of the internal state - * of the current `Hash` object. - * - * The optional `options` argument controls stream behavior. For XOF hash - * functions such as `'shake256'`, the `outputLength` option can be used to - * specify the desired output length in bytes. - * - * An error is thrown when an attempt is made to copy the `Hash` object after - * its `hash.digest()` method has been called. - * - * ```js - * // Calculate a rolling hash. - * const { - * createHash, - * } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * hash.update('one'); - * console.log(hash.copy().digest('hex')); - * - * hash.update('two'); - * console.log(hash.copy().digest('hex')); - * - * hash.update('three'); - * console.log(hash.copy().digest('hex')); - * - * // Etc. - * ``` - * @since v13.1.0 - * @param options `stream.transform` options - */ - copy(options?: HashOptions): Hash; - /** - * Updates the hash content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `encoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.92 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): Hash; - update(data: string, inputEncoding: Encoding): Hash; - /** - * Calculates the digest of all of the data passed to be hashed (using the `hash.update()` method). - * If `encoding` is provided a string will be returned; otherwise - * a `Buffer` is returned. - * - * The `Hash` object can not be used again after `hash.digest()` method has been - * called. Multiple calls will cause an error to be thrown. - * @since v0.1.92 - * @param encoding The `encoding` of the return value. - */ - digest(): NonSharedBuffer; - digest(encoding: BinaryToTextEncoding): string; - } - /** - * The `Hmac` class is a utility for creating cryptographic HMAC digests. It can - * be used in one of two ways: - * - * * As a `stream` that is both readable and writable, where data is written - * to produce a computed HMAC digest on the readable side, or - * * Using the `hmac.update()` and `hmac.digest()` methods to produce the - * computed HMAC digest. - * - * The {@link createHmac} method is used to create `Hmac` instances. `Hmac`objects are not to be created directly using the `new` keyword. - * - * Example: Using `Hmac` objects as streams: - * - * ```js - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const hmac = createHmac('sha256', 'a secret'); - * - * hmac.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = hmac.read(); - * if (data) { - * console.log(data.toString('hex')); - * // Prints: - * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e - * } - * }); - * - * hmac.write('some data to hash'); - * hmac.end(); - * ``` - * - * Example: Using `Hmac` and piped streams: - * - * ```js - * import { createReadStream } from 'node:fs'; - * import { stdout } from 'node:process'; - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const hmac = createHmac('sha256', 'a secret'); - * - * const input = createReadStream('test.js'); - * input.pipe(hmac).pipe(stdout); - * ``` - * - * Example: Using the `hmac.update()` and `hmac.digest()` methods: - * - * ```js - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const hmac = createHmac('sha256', 'a secret'); - * - * hmac.update('some data to hash'); - * console.log(hmac.digest('hex')); - * // Prints: - * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e - * ``` - * @since v0.1.94 - * @deprecated Since v20.13.0 Calling `Hmac` class directly with `Hmac()` or `new Hmac()` is deprecated due to being internals, not intended for public use. Please use the {@link createHmac} method to create Hmac instances. - */ - class Hmac extends stream.Transform { - private constructor(); - /** - * Updates the `Hmac` content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `encoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.94 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): Hmac; - update(data: string, inputEncoding: Encoding): Hmac; - /** - * Calculates the HMAC digest of all of the data passed using `hmac.update()`. - * If `encoding` is - * provided a string is returned; otherwise a `Buffer` is returned; - * - * The `Hmac` object can not be used again after `hmac.digest()` has been - * called. Multiple calls to `hmac.digest()` will result in an error being thrown. - * @since v0.1.94 - * @param encoding The `encoding` of the return value. - */ - digest(): NonSharedBuffer; - digest(encoding: BinaryToTextEncoding): string; - } - type KeyObjectType = "secret" | "public" | "private"; - interface KeyExportOptions { - type: "pkcs1" | "spki" | "pkcs8" | "sec1"; - format: T; - cipher?: string | undefined; - passphrase?: string | Buffer | undefined; - } - interface JwkKeyExportOptions { - format: "jwk"; - } - interface JsonWebKey { - crv?: string; - d?: string; - dp?: string; - dq?: string; - e?: string; - k?: string; - kty?: string; - n?: string; - p?: string; - q?: string; - qi?: string; - x?: string; - y?: string; - [key: string]: unknown; - } - interface AsymmetricKeyDetails { - /** - * Key size in bits (RSA, DSA). - */ - modulusLength?: number; - /** - * Public exponent (RSA). - */ - publicExponent?: bigint; - /** - * Name of the message digest (RSA-PSS). - */ - hashAlgorithm?: string; - /** - * Name of the message digest used by MGF1 (RSA-PSS). - */ - mgf1HashAlgorithm?: string; - /** - * Minimal salt length in bytes (RSA-PSS). - */ - saltLength?: number; - /** - * Size of q in bits (DSA). - */ - divisorLength?: number; - /** - * Name of the curve (EC). - */ - namedCurve?: string; - } - /** - * Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key, - * and each kind of key exposes different functions. The {@link createSecretKey}, {@link createPublicKey} and {@link createPrivateKey} methods are used to create `KeyObject`instances. `KeyObject` - * objects are not to be created directly using the `new`keyword. - * - * Most applications should consider using the new `KeyObject` API instead of - * passing keys as strings or `Buffer`s due to improved security features. - * - * `KeyObject` instances can be passed to other threads via `postMessage()`. - * The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to - * be listed in the `transferList` argument. - * @since v11.6.0 - */ - class KeyObject { - private constructor(); - /** - * Example: Converting a `CryptoKey` instance to a `KeyObject`: - * - * ```js - * const { KeyObject } = await import('node:crypto'); - * const { subtle } = globalThis.crypto; - * - * const key = await subtle.generateKey({ - * name: 'HMAC', - * hash: 'SHA-256', - * length: 256, - * }, true, ['sign', 'verify']); - * - * const keyObject = KeyObject.from(key); - * console.log(keyObject.symmetricKeySize); - * // Prints: 32 (symmetric key size in bytes) - * ``` - * @since v15.0.0 - */ - static from(key: webcrypto.CryptoKey): KeyObject; - /** - * For asymmetric keys, this property represents the type of the key. Supported key - * types are: - * - * * `'rsa'` (OID 1.2.840.113549.1.1.1) - * * `'rsa-pss'` (OID 1.2.840.113549.1.1.10) - * * `'dsa'` (OID 1.2.840.10040.4.1) - * * `'ec'` (OID 1.2.840.10045.2.1) - * * `'x25519'` (OID 1.3.101.110) - * * `'x448'` (OID 1.3.101.111) - * * `'ed25519'` (OID 1.3.101.112) - * * `'ed448'` (OID 1.3.101.113) - * * `'dh'` (OID 1.2.840.113549.1.3.1) - * - * This property is `undefined` for unrecognized `KeyObject` types and symmetric - * keys. - * @since v11.6.0 - */ - asymmetricKeyType?: KeyType; - /** - * This property exists only on asymmetric keys. Depending on the type of the key, - * this object contains information about the key. None of the information obtained - * through this property can be used to uniquely identify a key or to compromise - * the security of the key. - * - * For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence, - * the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be - * set. - * - * Other key details might be exposed via this API using additional attributes. - * @since v15.7.0 - */ - asymmetricKeyDetails?: AsymmetricKeyDetails; - /** - * For symmetric keys, the following encoding options can be used: - * - * For public keys, the following encoding options can be used: - * - * For private keys, the following encoding options can be used: - * - * The result type depends on the selected encoding format, when PEM the - * result is a string, when DER it will be a buffer containing the data - * encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object. - * - * When [JWK](https://tools.ietf.org/html/rfc7517) encoding format was selected, all other encoding options are - * ignored. - * - * PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of - * the `cipher` and `format` options. The PKCS#8 `type` can be used with any`format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a`cipher`. PKCS#1 and SEC1 can only be - * encrypted by specifying a `cipher`when the PEM `format` is used. For maximum compatibility, use PKCS#8 for - * encrypted private keys. Since PKCS#8 defines its own - * encryption mechanism, PEM-level encryption is not supported when encrypting - * a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for - * PKCS#1 and SEC1 encryption. - * @since v11.6.0 - */ - export(options: KeyExportOptions<"pem">): string | NonSharedBuffer; - export(options?: KeyExportOptions<"der">): NonSharedBuffer; - export(options?: JwkKeyExportOptions): JsonWebKey; - /** - * Returns `true` or `false` depending on whether the keys have exactly the same - * type, value, and parameters. This method is not [constant time](https://en.wikipedia.org/wiki/Timing_attack). - * @since v17.7.0, v16.15.0 - * @param otherKeyObject A `KeyObject` with which to compare `keyObject`. - */ - equals(otherKeyObject: KeyObject): boolean; - /** - * For secret keys, this property represents the size of the key in bytes. This - * property is `undefined` for asymmetric keys. - * @since v11.6.0 - */ - symmetricKeySize?: number; - /** - * Converts a `KeyObject` instance to a `CryptoKey`. - * @since 22.10.0 - */ - toCryptoKey( - algorithm: - | webcrypto.AlgorithmIdentifier - | webcrypto.RsaHashedImportParams - | webcrypto.EcKeyImportParams - | webcrypto.HmacImportParams, - extractable: boolean, - keyUsages: readonly webcrypto.KeyUsage[], - ): webcrypto.CryptoKey; - /** - * Depending on the type of this `KeyObject`, this property is either`'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys - * or `'private'` for private (asymmetric) keys. - * @since v11.6.0 - */ - type: KeyObjectType; - } - type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm"; - type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm"; - type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb"; - type CipherChaCha20Poly1305Types = "chacha20-poly1305"; - type BinaryLike = string | NodeJS.ArrayBufferView; - type CipherKey = BinaryLike | KeyObject; - interface CipherCCMOptions extends stream.TransformOptions { - authTagLength: number; - } - interface CipherGCMOptions extends stream.TransformOptions { - authTagLength?: number | undefined; - } - interface CipherOCBOptions extends stream.TransformOptions { - authTagLength: number; - } - interface CipherChaCha20Poly1305Options extends stream.TransformOptions { - /** @default 16 */ - authTagLength?: number | undefined; - } - /** - * Creates and returns a `Cipher` object, with the given `algorithm`, `key` and - * initialization vector (`iv`). - * - * The `options` argument controls stream behavior and is optional except when a - * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the - * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication - * tag that will be returned by `getAuthTag()` and defaults to 16 bytes. - * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. - * - * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On - * recent OpenSSL releases, `openssl list -cipher-algorithms` will - * display the available cipher algorithms. - * - * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded - * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be - * a `KeyObject` of type `secret`. If the cipher does not need - * an initialization vector, `iv` may be `null`. - * - * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * Initialization vectors should be unpredictable and unique; ideally, they will be - * cryptographically random. They do not have to be secret: IVs are typically just - * added to ciphertext messages unencrypted. It may sound contradictory that - * something has to be unpredictable and unique, but does not have to be secret; - * remember that an attacker must not be able to predict ahead of time what a - * given IV will be. - * @since v0.1.94 - * @param options `stream.transform` options - */ - function createCipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherCCMOptions, - ): CipherCCM; - function createCipheriv( - algorithm: CipherOCBTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherOCBOptions, - ): CipherOCB; - function createCipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike, - options?: CipherGCMOptions, - ): CipherGCM; - function createCipheriv( - algorithm: CipherChaCha20Poly1305Types, - key: CipherKey, - iv: BinaryLike, - options?: CipherChaCha20Poly1305Options, - ): CipherChaCha20Poly1305; - function createCipheriv( - algorithm: string, - key: CipherKey, - iv: BinaryLike | null, - options?: stream.TransformOptions, - ): Cipher; - /** - * Instances of the `Cipher` class are used to encrypt data. The class can be - * used in one of two ways: - * - * * As a `stream` that is both readable and writable, where plain unencrypted - * data is written to produce encrypted data on the readable side, or - * * Using the `cipher.update()` and `cipher.final()` methods to produce - * the encrypted data. - * - * The {@link createCipheriv} method is - * used to create `Cipher` instances. `Cipher` objects are not to be created - * directly using the `new` keyword. - * - * Example: Using `Cipher` objects as streams: - * - * ```js - * const { - * scrypt, - * randomFill, - * createCipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * - * // First, we'll generate the key. The key length is dependent on the algorithm. - * // In this case for aes192, it is 24 bytes (192 bits). - * scrypt(password, 'salt', 24, (err, key) => { - * if (err) throw err; - * // Then, we'll generate a random initialization vector - * randomFill(new Uint8Array(16), (err, iv) => { - * if (err) throw err; - * - * // Once we have the key and iv, we can create and use the cipher... - * const cipher = createCipheriv(algorithm, key, iv); - * - * let encrypted = ''; - * cipher.setEncoding('hex'); - * - * cipher.on('data', (chunk) => encrypted += chunk); - * cipher.on('end', () => console.log(encrypted)); - * - * cipher.write('some clear text data'); - * cipher.end(); - * }); - * }); - * ``` - * - * Example: Using `Cipher` and piped streams: - * - * ```js - * import { - * createReadStream, - * createWriteStream, - * } from 'node:fs'; - * - * import { - * pipeline, - * } from 'node:stream'; - * - * const { - * scrypt, - * randomFill, - * createCipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * - * // First, we'll generate the key. The key length is dependent on the algorithm. - * // In this case for aes192, it is 24 bytes (192 bits). - * scrypt(password, 'salt', 24, (err, key) => { - * if (err) throw err; - * // Then, we'll generate a random initialization vector - * randomFill(new Uint8Array(16), (err, iv) => { - * if (err) throw err; - * - * const cipher = createCipheriv(algorithm, key, iv); - * - * const input = createReadStream('test.js'); - * const output = createWriteStream('test.enc'); - * - * pipeline(input, cipher, output, (err) => { - * if (err) throw err; - * }); - * }); - * }); - * ``` - * - * Example: Using the `cipher.update()` and `cipher.final()` methods: - * - * ```js - * const { - * scrypt, - * randomFill, - * createCipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * - * // First, we'll generate the key. The key length is dependent on the algorithm. - * // In this case for aes192, it is 24 bytes (192 bits). - * scrypt(password, 'salt', 24, (err, key) => { - * if (err) throw err; - * // Then, we'll generate a random initialization vector - * randomFill(new Uint8Array(16), (err, iv) => { - * if (err) throw err; - * - * const cipher = createCipheriv(algorithm, key, iv); - * - * let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); - * encrypted += cipher.final('hex'); - * console.log(encrypted); - * }); - * }); - * ``` - * @since v0.1.94 - */ - class Cipher extends stream.Transform { - private constructor(); - /** - * Updates the cipher with `data`. If the `inputEncoding` argument is given, - * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`, `TypedArray`, or `DataView`. If `data` is a `Buffer`, - * `TypedArray`, or `DataView`, then `inputEncoding` is ignored. - * - * The `outputEncoding` specifies the output format of the enciphered - * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned. - * - * The `cipher.update()` method can be called multiple times with new data until `cipher.final()` is called. Calling `cipher.update()` after `cipher.final()` will result in an error being - * thrown. - * @since v0.1.94 - * @param inputEncoding The `encoding` of the data. - * @param outputEncoding The `encoding` of the return value. - */ - update(data: BinaryLike): NonSharedBuffer; - update(data: string, inputEncoding: Encoding): NonSharedBuffer; - update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; - update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; - /** - * Once the `cipher.final()` method has been called, the `Cipher` object can no - * longer be used to encrypt data. Attempts to call `cipher.final()` more than - * once will result in an error being thrown. - * @since v0.1.94 - * @param outputEncoding The `encoding` of the return value. - * @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. - */ - final(): NonSharedBuffer; - final(outputEncoding: BufferEncoding): string; - /** - * When using block encryption algorithms, the `Cipher` class will automatically - * add padding to the input data to the appropriate block size. To disable the - * default padding call `cipher.setAutoPadding(false)`. - * - * When `autoPadding` is `false`, the length of the entire input data must be a - * multiple of the cipher's block size or `cipher.final()` will throw an error. - * Disabling automatic padding is useful for non-standard padding, for instance - * using `0x0` instead of PKCS padding. - * - * The `cipher.setAutoPadding()` method must be called before `cipher.final()`. - * @since v0.7.1 - * @param [autoPadding=true] - * @return for method chaining. - */ - setAutoPadding(autoPadding?: boolean): this; - } - interface CipherCCM extends Cipher { - setAAD( - buffer: NodeJS.ArrayBufferView, - options: { - plaintextLength: number; - }, - ): this; - getAuthTag(): NonSharedBuffer; - } - interface CipherGCM extends Cipher { - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - getAuthTag(): NonSharedBuffer; - } - interface CipherOCB extends Cipher { - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - getAuthTag(): NonSharedBuffer; - } - interface CipherChaCha20Poly1305 extends Cipher { - setAAD( - buffer: NodeJS.ArrayBufferView, - options: { - plaintextLength: number; - }, - ): this; - getAuthTag(): NonSharedBuffer; - } - /** - * Creates and returns a `Decipher` object that uses the given `algorithm`, `key` and initialization vector (`iv`). - * - * The `options` argument controls stream behavior and is optional except when a - * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the `authTagLength` option is required and specifies the length of the - * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength` option is not required but can be used to restrict accepted authentication tags - * to those with the specified length. - * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. - * - * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On - * recent OpenSSL releases, `openssl list -cipher-algorithms` will - * display the available cipher algorithms. - * - * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded - * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be - * a `KeyObject` of type `secret`. If the cipher does not need - * an initialization vector, `iv` may be `null`. - * - * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * Initialization vectors should be unpredictable and unique; ideally, they will be - * cryptographically random. They do not have to be secret: IVs are typically just - * added to ciphertext messages unencrypted. It may sound contradictory that - * something has to be unpredictable and unique, but does not have to be secret; - * remember that an attacker must not be able to predict ahead of time what a given - * IV will be. - * @since v0.1.94 - * @param options `stream.transform` options - */ - function createDecipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherCCMOptions, - ): DecipherCCM; - function createDecipheriv( - algorithm: CipherOCBTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherOCBOptions, - ): DecipherOCB; - function createDecipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike, - options?: CipherGCMOptions, - ): DecipherGCM; - function createDecipheriv( - algorithm: CipherChaCha20Poly1305Types, - key: CipherKey, - iv: BinaryLike, - options?: CipherChaCha20Poly1305Options, - ): DecipherChaCha20Poly1305; - function createDecipheriv( - algorithm: string, - key: CipherKey, - iv: BinaryLike | null, - options?: stream.TransformOptions, - ): Decipher; - /** - * Instances of the `Decipher` class are used to decrypt data. The class can be - * used in one of two ways: - * - * * As a `stream` that is both readable and writable, where plain encrypted - * data is written to produce unencrypted data on the readable side, or - * * Using the `decipher.update()` and `decipher.final()` methods to - * produce the unencrypted data. - * - * The {@link createDecipheriv} method is - * used to create `Decipher` instances. `Decipher` objects are not to be created - * directly using the `new` keyword. - * - * Example: Using `Decipher` objects as streams: - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * scryptSync, - * createDecipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * // Key length is dependent on the algorithm. In this case for aes192, it is - * // 24 bytes (192 bits). - * // Use the async `crypto.scrypt()` instead. - * const key = scryptSync(password, 'salt', 24); - * // The IV is usually passed along with the ciphertext. - * const iv = Buffer.alloc(16, 0); // Initialization vector. - * - * const decipher = createDecipheriv(algorithm, key, iv); - * - * let decrypted = ''; - * decipher.on('readable', () => { - * let chunk; - * while (null !== (chunk = decipher.read())) { - * decrypted += chunk.toString('utf8'); - * } - * }); - * decipher.on('end', () => { - * console.log(decrypted); - * // Prints: some clear text data - * }); - * - * // Encrypted with same algorithm, key and iv. - * const encrypted = - * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; - * decipher.write(encrypted, 'hex'); - * decipher.end(); - * ``` - * - * Example: Using `Decipher` and piped streams: - * - * ```js - * import { - * createReadStream, - * createWriteStream, - * } from 'node:fs'; - * import { Buffer } from 'node:buffer'; - * const { - * scryptSync, - * createDecipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * // Use the async `crypto.scrypt()` instead. - * const key = scryptSync(password, 'salt', 24); - * // The IV is usually passed along with the ciphertext. - * const iv = Buffer.alloc(16, 0); // Initialization vector. - * - * const decipher = createDecipheriv(algorithm, key, iv); - * - * const input = createReadStream('test.enc'); - * const output = createWriteStream('test.js'); - * - * input.pipe(decipher).pipe(output); - * ``` - * - * Example: Using the `decipher.update()` and `decipher.final()` methods: - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * scryptSync, - * createDecipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * // Use the async `crypto.scrypt()` instead. - * const key = scryptSync(password, 'salt', 24); - * // The IV is usually passed along with the ciphertext. - * const iv = Buffer.alloc(16, 0); // Initialization vector. - * - * const decipher = createDecipheriv(algorithm, key, iv); - * - * // Encrypted using same algorithm, key and iv. - * const encrypted = - * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; - * let decrypted = decipher.update(encrypted, 'hex', 'utf8'); - * decrypted += decipher.final('utf8'); - * console.log(decrypted); - * // Prints: some clear text data - * ``` - * @since v0.1.94 - */ - class Decipher extends stream.Transform { - private constructor(); - /** - * Updates the decipher with `data`. If the `inputEncoding` argument is given, - * the `data` argument is a string using the specified encoding. If the `inputEncoding` argument is not given, `data` must be a `Buffer`. If `data` is a `Buffer` then `inputEncoding` is - * ignored. - * - * The `outputEncoding` specifies the output format of the enciphered - * data. If the `outputEncoding` is specified, a string using the specified encoding is returned. If no `outputEncoding` is provided, a `Buffer` is returned. - * - * The `decipher.update()` method can be called multiple times with new data until `decipher.final()` is called. Calling `decipher.update()` after `decipher.final()` will result in an error - * being thrown. - * @since v0.1.94 - * @param inputEncoding The `encoding` of the `data` string. - * @param outputEncoding The `encoding` of the return value. - */ - update(data: NodeJS.ArrayBufferView): NonSharedBuffer; - update(data: string, inputEncoding: Encoding): NonSharedBuffer; - update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; - update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; - /** - * Once the `decipher.final()` method has been called, the `Decipher` object can - * no longer be used to decrypt data. Attempts to call `decipher.final()` more - * than once will result in an error being thrown. - * @since v0.1.94 - * @param outputEncoding The `encoding` of the return value. - * @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. - */ - final(): NonSharedBuffer; - final(outputEncoding: BufferEncoding): string; - /** - * When data has been encrypted without standard block padding, calling `decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and - * removing padding. - * - * Turning auto padding off will only work if the input data's length is a - * multiple of the ciphers block size. - * - * The `decipher.setAutoPadding()` method must be called before `decipher.final()`. - * @since v0.7.1 - * @param [autoPadding=true] - * @return for method chaining. - */ - setAutoPadding(auto_padding?: boolean): this; - } - interface DecipherCCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD( - buffer: NodeJS.ArrayBufferView, - options: { - plaintextLength: number; - }, - ): this; - } - interface DecipherGCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - } - interface DecipherOCB extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - } - interface DecipherChaCha20Poly1305 extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD( - buffer: NodeJS.ArrayBufferView, - options: { - plaintextLength: number; - }, - ): this; - } - interface PrivateKeyInput { - key: string | Buffer; - format?: KeyFormat | undefined; - type?: "pkcs1" | "pkcs8" | "sec1" | undefined; - passphrase?: string | Buffer | undefined; - encoding?: string | undefined; - } - interface PublicKeyInput { - key: string | Buffer; - format?: KeyFormat | undefined; - type?: "pkcs1" | "spki" | undefined; - encoding?: string | undefined; - } - /** - * Asynchronously generates a new random secret key of the given `length`. The `type` will determine which validations will be performed on the `length`. - * - * ```js - * const { - * generateKey, - * } = await import('node:crypto'); - * - * generateKey('hmac', { length: 512 }, (err, key) => { - * if (err) throw err; - * console.log(key.export().toString('hex')); // 46e..........620 - * }); - * ``` - * - * The size of a generated HMAC key should not exceed the block size of the - * underlying hash function. See {@link createHmac} for more information. - * @since v15.0.0 - * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. - */ - function generateKey( - type: "hmac" | "aes", - options: { - length: number; - }, - callback: (err: Error | null, key: KeyObject) => void, - ): void; - /** - * Synchronously generates a new random secret key of the given `length`. The `type` will determine which validations will be performed on the `length`. - * - * ```js - * const { - * generateKeySync, - * } = await import('node:crypto'); - * - * const key = generateKeySync('hmac', { length: 512 }); - * console.log(key.export().toString('hex')); // e89..........41e - * ``` - * - * The size of a generated HMAC key should not exceed the block size of the - * underlying hash function. See {@link createHmac} for more information. - * @since v15.0.0 - * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. - */ - function generateKeySync( - type: "hmac" | "aes", - options: { - length: number; - }, - ): KeyObject; - interface JsonWebKeyInput { - key: JsonWebKey; - format: "jwk"; - } - /** - * Creates and returns a new key object containing a private key. If `key` is a - * string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key` must be an object with the properties described above. - * - * If the private key is encrypted, a `passphrase` must be specified. The length - * of the passphrase is limited to 1024 bytes. - * @since v11.6.0 - */ - function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject; - /** - * Creates and returns a new key object containing a public key. If `key` is a - * string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject` with type `'private'`, the public key is derived from the given private key; - * otherwise, `key` must be an object with the properties described above. - * - * If the format is `'pem'`, the `'key'` may also be an X.509 certificate. - * - * Because public keys can be derived from private keys, a private key may be - * passed instead of a public key. In that case, this function behaves as if {@link createPrivateKey} had been called, except that the type of the - * returned `KeyObject` will be `'public'` and that the private key cannot be - * extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type `'private'` is given, a new `KeyObject` with type `'public'` will be returned - * and it will be impossible to extract the private key from the returned object. - * @since v11.6.0 - */ - function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject; - /** - * Creates and returns a new key object containing a secret key for symmetric - * encryption or `Hmac`. - * @since v11.6.0 - * @param encoding The string encoding when `key` is a string. - */ - function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject; - function createSecretKey(key: string, encoding: BufferEncoding): KeyObject; - /** - * Creates and returns a `Sign` object that uses the given `algorithm`. Use {@link getHashes} to obtain the names of the available digest algorithms. - * Optional `options` argument controls the `stream.Writable` behavior. - * - * In some cases, a `Sign` instance can be created using the name of a signature - * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use - * the corresponding digest algorithm. This does not work for all signature - * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest - * algorithm names. - * @since v0.1.92 - * @param options `stream.Writable` options - */ - function createSign(algorithm: string, options?: stream.WritableOptions): Sign; - type DSAEncoding = "der" | "ieee-p1363"; - interface SigningOptions { - /** - * @see crypto.constants.RSA_PKCS1_PADDING - */ - padding?: number | undefined; - saltLength?: number | undefined; - dsaEncoding?: DSAEncoding | undefined; - } - interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {} - interface SignKeyObjectInput extends SigningOptions { - key: KeyObject; - } - interface SignJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {} - interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {} - interface VerifyKeyObjectInput extends SigningOptions { - key: KeyObject; - } - interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {} - type KeyLike = string | Buffer | KeyObject; - /** - * The `Sign` class is a utility for generating signatures. It can be used in one - * of two ways: - * - * * As a writable `stream`, where data to be signed is written and the `sign.sign()` method is used to generate and return the signature, or - * * Using the `sign.update()` and `sign.sign()` methods to produce the - * signature. - * - * The {@link createSign} method is used to create `Sign` instances. The - * argument is the string name of the hash function to use. `Sign` objects are not - * to be created directly using the `new` keyword. - * - * Example: Using `Sign` and `Verify` objects as streams: - * - * ```js - * const { - * generateKeyPairSync, - * createSign, - * createVerify, - * } = await import('node:crypto'); - * - * const { privateKey, publicKey } = generateKeyPairSync('ec', { - * namedCurve: 'sect239k1', - * }); - * - * const sign = createSign('SHA256'); - * sign.write('some data to sign'); - * sign.end(); - * const signature = sign.sign(privateKey, 'hex'); - * - * const verify = createVerify('SHA256'); - * verify.write('some data to sign'); - * verify.end(); - * console.log(verify.verify(publicKey, signature, 'hex')); - * // Prints: true - * ``` - * - * Example: Using the `sign.update()` and `verify.update()` methods: - * - * ```js - * const { - * generateKeyPairSync, - * createSign, - * createVerify, - * } = await import('node:crypto'); - * - * const { privateKey, publicKey } = generateKeyPairSync('rsa', { - * modulusLength: 2048, - * }); - * - * const sign = createSign('SHA256'); - * sign.update('some data to sign'); - * sign.end(); - * const signature = sign.sign(privateKey); - * - * const verify = createVerify('SHA256'); - * verify.update('some data to sign'); - * verify.end(); - * console.log(verify.verify(publicKey, signature)); - * // Prints: true - * ``` - * @since v0.1.92 - */ - class Sign extends stream.Writable { - private constructor(); - /** - * Updates the `Sign` content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `encoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.92 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): this; - update(data: string, inputEncoding: Encoding): this; - /** - * Calculates the signature on all the data passed through using either `sign.update()` or `sign.write()`. - * - * If `privateKey` is not a `KeyObject`, this function behaves as if `privateKey` had been passed to {@link createPrivateKey}. If it is an - * object, the following additional properties can be passed: - * - * If `outputEncoding` is provided a string is returned; otherwise a `Buffer` is returned. - * - * The `Sign` object can not be again used after `sign.sign()` method has been - * called. Multiple calls to `sign.sign()` will result in an error being thrown. - * @since v0.1.92 - */ - sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput): NonSharedBuffer; - sign( - privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput, - outputFormat: BinaryToTextEncoding, - ): string; - } - /** - * Creates and returns a `Verify` object that uses the given algorithm. - * Use {@link getHashes} to obtain an array of names of the available - * signing algorithms. Optional `options` argument controls the `stream.Writable` behavior. - * - * In some cases, a `Verify` instance can be created using the name of a signature - * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use - * the corresponding digest algorithm. This does not work for all signature - * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest - * algorithm names. - * @since v0.1.92 - * @param options `stream.Writable` options - */ - function createVerify(algorithm: string, options?: stream.WritableOptions): Verify; - /** - * The `Verify` class is a utility for verifying signatures. It can be used in one - * of two ways: - * - * * As a writable `stream` where written data is used to validate against the - * supplied signature, or - * * Using the `verify.update()` and `verify.verify()` methods to verify - * the signature. - * - * The {@link createVerify} method is used to create `Verify` instances. `Verify` objects are not to be created directly using the `new` keyword. - * - * See `Sign` for examples. - * @since v0.1.92 - */ - class Verify extends stream.Writable { - private constructor(); - /** - * Updates the `Verify` content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `inputEncoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or `DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.92 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): Verify; - update(data: string, inputEncoding: Encoding): Verify; - /** - * Verifies the provided data using the given `object` and `signature`. - * - * If `object` is not a `KeyObject`, this function behaves as if `object` had been passed to {@link createPublicKey}. If it is an - * object, the following additional properties can be passed: - * - * The `signature` argument is the previously calculated signature for the data, in - * the `signatureEncoding`. - * If a `signatureEncoding` is specified, the `signature` is expected to be a - * string; otherwise `signature` is expected to be a `Buffer`, `TypedArray`, or `DataView`. - * - * The `verify` object can not be used again after `verify.verify()` has been - * called. Multiple calls to `verify.verify()` will result in an error being - * thrown. - * - * Because public keys can be derived from private keys, a private key may - * be passed instead of a public key. - * @since v0.1.92 - */ - verify( - object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: NodeJS.ArrayBufferView, - ): boolean; - verify( - object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: string, - signature_format?: BinaryToTextEncoding, - ): boolean; - } - /** - * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an - * optional specific `generator`. - * - * The `generator` argument can be a number, string, or `Buffer`. If `generator` is not specified, the value `2` is used. - * - * If `primeEncoding` is specified, `prime` is expected to be a string; otherwise - * a `Buffer`, `TypedArray`, or `DataView` is expected. - * - * If `generatorEncoding` is specified, `generator` is expected to be a string; - * otherwise a number, `Buffer`, `TypedArray`, or `DataView` is expected. - * @since v0.11.12 - * @param primeEncoding The `encoding` of the `prime` string. - * @param [generator=2] - * @param generatorEncoding The `encoding` of the `generator` string. - */ - function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman; - function createDiffieHellman( - prime: ArrayBuffer | NodeJS.ArrayBufferView, - generator?: number | ArrayBuffer | NodeJS.ArrayBufferView, - ): DiffieHellman; - function createDiffieHellman( - prime: ArrayBuffer | NodeJS.ArrayBufferView, - generator: string, - generatorEncoding: BinaryToTextEncoding, - ): DiffieHellman; - function createDiffieHellman( - prime: string, - primeEncoding: BinaryToTextEncoding, - generator?: number | ArrayBuffer | NodeJS.ArrayBufferView, - ): DiffieHellman; - function createDiffieHellman( - prime: string, - primeEncoding: BinaryToTextEncoding, - generator: string, - generatorEncoding: BinaryToTextEncoding, - ): DiffieHellman; - /** - * The `DiffieHellman` class is a utility for creating Diffie-Hellman key - * exchanges. - * - * Instances of the `DiffieHellman` class can be created using the {@link createDiffieHellman} function. - * - * ```js - * import assert from 'node:assert'; - * - * const { - * createDiffieHellman, - * } = await import('node:crypto'); - * - * // Generate Alice's keys... - * const alice = createDiffieHellman(2048); - * const aliceKey = alice.generateKeys(); - * - * // Generate Bob's keys... - * const bob = createDiffieHellman(alice.getPrime(), alice.getGenerator()); - * const bobKey = bob.generateKeys(); - * - * // Exchange and generate the secret... - * const aliceSecret = alice.computeSecret(bobKey); - * const bobSecret = bob.computeSecret(aliceKey); - * - * // OK - * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); - * ``` - * @since v0.5.0 - */ - class DiffieHellman { - private constructor(); - /** - * Generates private and public Diffie-Hellman key values unless they have been - * generated or computed already, and returns - * the public key in the specified `encoding`. This key should be - * transferred to the other party. - * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. - * - * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular, - * once a private key has been generated or set, calling this function only updates - * the public key but does not generate a new private key. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - generateKeys(): NonSharedBuffer; - generateKeys(encoding: BinaryToTextEncoding): string; - /** - * Computes the shared secret using `otherPublicKey` as the other - * party's public key and returns the computed shared secret. The supplied - * key is interpreted using the specified `inputEncoding`, and secret is - * encoded using specified `outputEncoding`. - * If the `inputEncoding` is not - * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or `DataView`. - * - * If `outputEncoding` is given a string is returned; otherwise, a `Buffer` is returned. - * @since v0.5.0 - * @param inputEncoding The `encoding` of an `otherPublicKey` string. - * @param outputEncoding The `encoding` of the return value. - */ - computeSecret( - otherPublicKey: NodeJS.ArrayBufferView, - inputEncoding?: null, - outputEncoding?: null, - ): NonSharedBuffer; - computeSecret( - otherPublicKey: string, - inputEncoding: BinaryToTextEncoding, - outputEncoding?: null, - ): NonSharedBuffer; - computeSecret( - otherPublicKey: NodeJS.ArrayBufferView, - inputEncoding: null, - outputEncoding: BinaryToTextEncoding, - ): string; - computeSecret( - otherPublicKey: string, - inputEncoding: BinaryToTextEncoding, - outputEncoding: BinaryToTextEncoding, - ): string; - /** - * Returns the Diffie-Hellman prime in the specified `encoding`. - * If `encoding` is provided a string is - * returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getPrime(): NonSharedBuffer; - getPrime(encoding: BinaryToTextEncoding): string; - /** - * Returns the Diffie-Hellman generator in the specified `encoding`. - * If `encoding` is provided a string is - * returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getGenerator(): NonSharedBuffer; - getGenerator(encoding: BinaryToTextEncoding): string; - /** - * Returns the Diffie-Hellman public key in the specified `encoding`. - * If `encoding` is provided a - * string is returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getPublicKey(): NonSharedBuffer; - getPublicKey(encoding: BinaryToTextEncoding): string; - /** - * Returns the Diffie-Hellman private key in the specified `encoding`. - * If `encoding` is provided a - * string is returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getPrivateKey(): NonSharedBuffer; - getPrivateKey(encoding: BinaryToTextEncoding): string; - /** - * Sets the Diffie-Hellman public key. If the `encoding` argument is provided, `publicKey` is expected - * to be a string. If no `encoding` is provided, `publicKey` is expected - * to be a `Buffer`, `TypedArray`, or `DataView`. - * @since v0.5.0 - * @param encoding The `encoding` of the `publicKey` string. - */ - setPublicKey(publicKey: NodeJS.ArrayBufferView): void; - setPublicKey(publicKey: string, encoding: BufferEncoding): void; - /** - * Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected - * to be a string. If no `encoding` is provided, `privateKey` is expected - * to be a `Buffer`, `TypedArray`, or `DataView`. - * - * This function does not automatically compute the associated public key. Either `diffieHellman.setPublicKey()` or `diffieHellman.generateKeys()` can be - * used to manually provide the public key or to automatically derive it. - * @since v0.5.0 - * @param encoding The `encoding` of the `privateKey` string. - */ - setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; - setPrivateKey(privateKey: string, encoding: BufferEncoding): void; - /** - * A bit field containing any warnings and/or errors resulting from a check - * performed during initialization of the `DiffieHellman` object. - * - * The following values are valid for this property (as defined in `node:constants` module): - * - * * `DH_CHECK_P_NOT_SAFE_PRIME` - * * `DH_CHECK_P_NOT_PRIME` - * * `DH_UNABLE_TO_CHECK_GENERATOR` - * * `DH_NOT_SUITABLE_GENERATOR` - * @since v0.11.12 - */ - verifyError: number; - } - /** - * The `DiffieHellmanGroup` class takes a well-known modp group as its argument. - * It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation. - * In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods. - * - * ```js - * const { createDiffieHellmanGroup } = await import('node:crypto'); - * const dh = createDiffieHellmanGroup('modp1'); - * ``` - * The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt): - * ```bash - * $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h - * modp1 # 768 bits - * modp2 # 1024 bits - * modp5 # 1536 bits - * modp14 # 2048 bits - * modp15 # etc. - * modp16 - * modp17 - * modp18 - * ``` - * @since v0.7.5 - */ - const DiffieHellmanGroup: DiffieHellmanGroupConstructor; - interface DiffieHellmanGroupConstructor { - new(name: string): DiffieHellmanGroup; - (name: string): DiffieHellmanGroup; - readonly prototype: DiffieHellmanGroup; - } - type DiffieHellmanGroup = Omit; - /** - * Creates a predefined `DiffieHellmanGroup` key exchange object. The - * supported groups are listed in the documentation for `DiffieHellmanGroup`. - * - * The returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing - * the keys (with `diffieHellman.setPublicKey()`, for example). The - * advantage of using this method is that the parties do not have to - * generate nor exchange a group modulus beforehand, saving both processor - * and communication time. - * - * Example (obtaining a shared secret): - * - * ```js - * const { - * getDiffieHellman, - * } = await import('node:crypto'); - * const alice = getDiffieHellman('modp14'); - * const bob = getDiffieHellman('modp14'); - * - * alice.generateKeys(); - * bob.generateKeys(); - * - * const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); - * const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); - * - * // aliceSecret and bobSecret should be the same - * console.log(aliceSecret === bobSecret); - * ``` - * @since v0.7.5 - */ - function getDiffieHellman(groupName: string): DiffieHellmanGroup; - /** - * An alias for {@link getDiffieHellman} - * @since v0.9.3 - */ - function createDiffieHellmanGroup(name: string): DiffieHellmanGroup; - /** - * Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) - * implementation. A selected HMAC digest algorithm specified by `digest` is - * applied to derive a key of the requested byte length (`keylen`) from the `password`, `salt` and `iterations`. - * - * The supplied `callback` function is called with two arguments: `err` and `derivedKey`. If an error occurs while deriving the key, `err` will be set; - * otherwise `err` will be `null`. By default, the successfully generated `derivedKey` will be passed to the callback as a `Buffer`. An error will be - * thrown if any of the input arguments specify invalid values or types. - * - * The `iterations` argument must be a number set as high as possible. The - * higher the number of iterations, the more secure the derived key will be, - * but will take a longer amount of time to complete. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * ```js - * const { - * pbkdf2, - * } = await import('node:crypto'); - * - * pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { - * if (err) throw err; - * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' - * }); - * ``` - * - * An array of supported digest functions can be retrieved using {@link getHashes}. - * - * This API uses libuv's threadpool, which can have surprising and - * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. - * @since v0.5.5 - */ - function pbkdf2( - password: BinaryLike, - salt: BinaryLike, - iterations: number, - keylen: number, - digest: string, - callback: (err: Error | null, derivedKey: NonSharedBuffer) => void, - ): void; - /** - * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) - * implementation. A selected HMAC digest algorithm specified by `digest` is - * applied to derive a key of the requested byte length (`keylen`) from the `password`, `salt` and `iterations`. - * - * If an error occurs an `Error` will be thrown, otherwise the derived key will be - * returned as a `Buffer`. - * - * The `iterations` argument must be a number set as high as possible. The - * higher the number of iterations, the more secure the derived key will be, - * but will take a longer amount of time to complete. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * ```js - * const { - * pbkdf2Sync, - * } = await import('node:crypto'); - * - * const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); - * console.log(key.toString('hex')); // '3745e48...08d59ae' - * ``` - * - * An array of supported digest functions can be retrieved using {@link getHashes}. - * @since v0.9.3 - */ - function pbkdf2Sync( - password: BinaryLike, - salt: BinaryLike, - iterations: number, - keylen: number, - digest: string, - ): NonSharedBuffer; - /** - * Generates cryptographically strong pseudorandom data. The `size` argument - * is a number indicating the number of bytes to generate. - * - * If a `callback` function is provided, the bytes are generated asynchronously - * and the `callback` function is invoked with two arguments: `err` and `buf`. - * If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The `buf` argument is a `Buffer` containing the generated bytes. - * - * ```js - * // Asynchronous - * const { - * randomBytes, - * } = await import('node:crypto'); - * - * randomBytes(256, (err, buf) => { - * if (err) throw err; - * console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); - * }); - * ``` - * - * If the `callback` function is not provided, the random bytes are generated - * synchronously and returned as a `Buffer`. An error will be thrown if - * there is a problem generating the bytes. - * - * ```js - * // Synchronous - * const { - * randomBytes, - * } = await import('node:crypto'); - * - * const buf = randomBytes(256); - * console.log( - * `${buf.length} bytes of random data: ${buf.toString('hex')}`); - * ``` - * - * The `crypto.randomBytes()` method will not complete until there is - * sufficient entropy available. - * This should normally never take longer than a few milliseconds. The only time - * when generating the random bytes may conceivably block for a longer period of - * time is right after boot, when the whole system is still low on entropy. - * - * This API uses libuv's threadpool, which can have surprising and - * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. - * - * The asynchronous version of `crypto.randomBytes()` is carried out in a single - * threadpool request. To minimize threadpool task length variation, partition - * large `randomBytes` requests when doing so as part of fulfilling a client - * request. - * @since v0.5.8 - * @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`. - * @return if the `callback` function is not provided. - */ - function randomBytes(size: number): NonSharedBuffer; - function randomBytes(size: number, callback: (err: Error | null, buf: NonSharedBuffer) => void): void; - function pseudoRandomBytes(size: number): NonSharedBuffer; - function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: NonSharedBuffer) => void): void; - /** - * Return a random integer `n` such that `min <= n < max`. This - * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias). - * - * The range (`max - min`) must be less than 2**48. `min` and `max` must - * be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger). - * - * If the `callback` function is not provided, the random integer is - * generated synchronously. - * - * ```js - * // Asynchronous - * const { - * randomInt, - * } = await import('node:crypto'); - * - * randomInt(3, (err, n) => { - * if (err) throw err; - * console.log(`Random number chosen from (0, 1, 2): ${n}`); - * }); - * ``` - * - * ```js - * // Synchronous - * const { - * randomInt, - * } = await import('node:crypto'); - * - * const n = randomInt(3); - * console.log(`Random number chosen from (0, 1, 2): ${n}`); - * ``` - * - * ```js - * // With `min` argument - * const { - * randomInt, - * } = await import('node:crypto'); - * - * const n = randomInt(1, 7); - * console.log(`The dice rolled: ${n}`); - * ``` - * @since v14.10.0, v12.19.0 - * @param [min=0] Start of random range (inclusive). - * @param max End of random range (exclusive). - * @param callback `function(err, n) {}`. - */ - function randomInt(max: number): number; - function randomInt(min: number, max: number): number; - function randomInt(max: number, callback: (err: Error | null, value: number) => void): void; - function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void; - /** - * Synchronous version of {@link randomFill}. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFillSync } = await import('node:crypto'); - * - * const buf = Buffer.alloc(10); - * console.log(randomFillSync(buf).toString('hex')); - * - * randomFillSync(buf, 5); - * console.log(buf.toString('hex')); - * - * // The above is equivalent to the following: - * randomFillSync(buf, 5, 5); - * console.log(buf.toString('hex')); - * ``` - * - * Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as`buffer`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFillSync } = await import('node:crypto'); - * - * const a = new Uint32Array(10); - * console.log(Buffer.from(randomFillSync(a).buffer, - * a.byteOffset, a.byteLength).toString('hex')); - * - * const b = new DataView(new ArrayBuffer(10)); - * console.log(Buffer.from(randomFillSync(b).buffer, - * b.byteOffset, b.byteLength).toString('hex')); - * - * const c = new ArrayBuffer(10); - * console.log(Buffer.from(randomFillSync(c)).toString('hex')); - * ``` - * @since v7.10.0, v6.13.0 - * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. - * @param [offset=0] - * @param [size=buffer.length - offset] - * @return The object passed as `buffer` argument. - */ - function randomFillSync(buffer: T, offset?: number, size?: number): T; - /** - * This function is similar to {@link randomBytes} but requires the first - * argument to be a `Buffer` that will be filled. It also - * requires that a callback is passed in. - * - * If the `callback` function is not provided, an error will be thrown. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFill } = await import('node:crypto'); - * - * const buf = Buffer.alloc(10); - * randomFill(buf, (err, buf) => { - * if (err) throw err; - * console.log(buf.toString('hex')); - * }); - * - * randomFill(buf, 5, (err, buf) => { - * if (err) throw err; - * console.log(buf.toString('hex')); - * }); - * - * // The above is equivalent to the following: - * randomFill(buf, 5, 5, (err, buf) => { - * if (err) throw err; - * console.log(buf.toString('hex')); - * }); - * ``` - * - * Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as `buffer`. - * - * While this includes instances of `Float32Array` and `Float64Array`, this - * function should not be used to generate random floating-point numbers. The - * result may contain `+Infinity`, `-Infinity`, and `NaN`, and even if the array - * contains finite numbers only, they are not drawn from a uniform random - * distribution and have no meaningful lower or upper bounds. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFill } = await import('node:crypto'); - * - * const a = new Uint32Array(10); - * randomFill(a, (err, buf) => { - * if (err) throw err; - * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) - * .toString('hex')); - * }); - * - * const b = new DataView(new ArrayBuffer(10)); - * randomFill(b, (err, buf) => { - * if (err) throw err; - * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) - * .toString('hex')); - * }); - * - * const c = new ArrayBuffer(10); - * randomFill(c, (err, buf) => { - * if (err) throw err; - * console.log(Buffer.from(buf).toString('hex')); - * }); - * ``` - * - * This API uses libuv's threadpool, which can have surprising and - * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. - * - * The asynchronous version of `crypto.randomFill()` is carried out in a single - * threadpool request. To minimize threadpool task length variation, partition - * large `randomFill` requests when doing so as part of fulfilling a client - * request. - * @since v7.10.0, v6.13.0 - * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. - * @param [offset=0] - * @param [size=buffer.length - offset] - * @param callback `function(err, buf) {}`. - */ - function randomFill( - buffer: T, - callback: (err: Error | null, buf: T) => void, - ): void; - function randomFill( - buffer: T, - offset: number, - callback: (err: Error | null, buf: T) => void, - ): void; - function randomFill( - buffer: T, - offset: number, - size: number, - callback: (err: Error | null, buf: T) => void, - ): void; - interface ScryptOptions { - cost?: number | undefined; - blockSize?: number | undefined; - parallelization?: number | undefined; - N?: number | undefined; - r?: number | undefined; - p?: number | undefined; - maxmem?: number | undefined; - } - /** - * Provides an asynchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based - * key derivation function that is designed to be expensive computationally and - * memory-wise in order to make brute-force attacks unrewarding. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * The `callback` function is called with two arguments: `err` and `derivedKey`. `err` is an exception object when key derivation fails, otherwise `err` is `null`. `derivedKey` is passed to the - * callback as a `Buffer`. - * - * An exception is thrown when any of the input arguments specify invalid values - * or types. - * - * ```js - * const { - * scrypt, - * } = await import('node:crypto'); - * - * // Using the factory defaults. - * scrypt('password', 'salt', 64, (err, derivedKey) => { - * if (err) throw err; - * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' - * }); - * // Using a custom N parameter. Must be a power of two. - * scrypt('password', 'salt', 64, { N: 1024 }, (err, derivedKey) => { - * if (err) throw err; - * console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' - * }); - * ``` - * @since v10.5.0 - */ - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, - callback: (err: Error | null, derivedKey: NonSharedBuffer) => void, - ): void; - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, - options: ScryptOptions, - callback: (err: Error | null, derivedKey: NonSharedBuffer) => void, - ): void; - /** - * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based - * key derivation function that is designed to be expensive computationally and - * memory-wise in order to make brute-force attacks unrewarding. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * An exception is thrown when key derivation fails, otherwise the derived key is - * returned as a `Buffer`. - * - * An exception is thrown when any of the input arguments specify invalid values - * or types. - * - * ```js - * const { - * scryptSync, - * } = await import('node:crypto'); - * // Using the factory defaults. - * - * const key1 = scryptSync('password', 'salt', 64); - * console.log(key1.toString('hex')); // '3745e48...08d59ae' - * // Using a custom N parameter. Must be a power of two. - * const key2 = scryptSync('password', 'salt', 64, { N: 1024 }); - * console.log(key2.toString('hex')); // '3745e48...aa39b34' - * ``` - * @since v10.5.0 - */ - function scryptSync( - password: BinaryLike, - salt: BinaryLike, - keylen: number, - options?: ScryptOptions, - ): NonSharedBuffer; - interface RsaPublicKey { - key: KeyLike; - padding?: number | undefined; - } - interface RsaPrivateKey { - key: KeyLike; - passphrase?: string | undefined; - /** - * @default 'sha1' - */ - oaepHash?: string | undefined; - oaepLabel?: NodeJS.TypedArray | undefined; - padding?: number | undefined; - } - /** - * Encrypts the content of `buffer` with `key` and returns a new `Buffer` with encrypted content. The returned data can be decrypted using - * the corresponding private key, for example using {@link privateDecrypt}. - * - * If `key` is not a `KeyObject`, this function behaves as if `key` had been passed to {@link createPublicKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`. - * - * Because RSA public keys can be derived from private keys, a private key may - * be passed instead of a public key. - * @since v0.11.14 - */ - function publicEncrypt( - key: RsaPublicKey | RsaPrivateKey | KeyLike, - buffer: NodeJS.ArrayBufferView | string, - ): NonSharedBuffer; - /** - * Decrypts `buffer` with `key`.`buffer` was previously encrypted using - * the corresponding private key, for example using {@link privateEncrypt}. - * - * If `key` is not a `KeyObject`, this function behaves as if `key` had been passed to {@link createPublicKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`. - * - * Because RSA public keys can be derived from private keys, a private key may - * be passed instead of a public key. - * @since v1.1.0 - */ - function publicDecrypt( - key: RsaPublicKey | RsaPrivateKey | KeyLike, - buffer: NodeJS.ArrayBufferView | string, - ): NonSharedBuffer; - /** - * Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using - * the corresponding public key, for example using {@link publicEncrypt}. - * - * If `privateKey` is not a `KeyObject`, this function behaves as if `privateKey` had been passed to {@link createPrivateKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`. - * @since v0.11.14 - */ - function privateDecrypt( - privateKey: RsaPrivateKey | KeyLike, - buffer: NodeJS.ArrayBufferView | string, - ): NonSharedBuffer; - /** - * Encrypts `buffer` with `privateKey`. The returned data can be decrypted using - * the corresponding public key, for example using {@link publicDecrypt}. - * - * If `privateKey` is not a `KeyObject`, this function behaves as if `privateKey` had been passed to {@link createPrivateKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`. - * @since v1.1.0 - */ - function privateEncrypt( - privateKey: RsaPrivateKey | KeyLike, - buffer: NodeJS.ArrayBufferView | string, - ): NonSharedBuffer; - /** - * ```js - * const { - * getCiphers, - * } = await import('node:crypto'); - * - * console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...] - * ``` - * @since v0.9.3 - * @return An array with the names of the supported cipher algorithms. - */ - function getCiphers(): string[]; - /** - * ```js - * const { - * getCurves, - * } = await import('node:crypto'); - * - * console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] - * ``` - * @since v2.3.0 - * @return An array with the names of the supported elliptic curves. - */ - function getCurves(): string[]; - /** - * @since v10.0.0 - * @return `1` if and only if a FIPS compliant crypto provider is currently in use, `0` otherwise. A future semver-major release may change the return type of this API to a {boolean}. - */ - function getFips(): 1 | 0; - /** - * Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. - * Throws an error if FIPS mode is not available. - * @since v10.0.0 - * @param bool `true` to enable FIPS mode. - */ - function setFips(bool: boolean): void; - /** - * ```js - * const { - * getHashes, - * } = await import('node:crypto'); - * - * console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] - * ``` - * @since v0.9.3 - * @return An array of the names of the supported hash algorithms, such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms. - */ - function getHashes(): string[]; - /** - * The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) - * key exchanges. - * - * Instances of the `ECDH` class can be created using the {@link createECDH} function. - * - * ```js - * import assert from 'node:assert'; - * - * const { - * createECDH, - * } = await import('node:crypto'); - * - * // Generate Alice's keys... - * const alice = createECDH('secp521r1'); - * const aliceKey = alice.generateKeys(); - * - * // Generate Bob's keys... - * const bob = createECDH('secp521r1'); - * const bobKey = bob.generateKeys(); - * - * // Exchange and generate the secret... - * const aliceSecret = alice.computeSecret(bobKey); - * const bobSecret = bob.computeSecret(aliceKey); - * - * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); - * // OK - * ``` - * @since v0.11.14 - */ - class ECDH { - private constructor(); - /** - * Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the - * format specified by `format`. The `format` argument specifies point encoding - * and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is - * interpreted using the specified `inputEncoding`, and the returned key is encoded - * using the specified `outputEncoding`. - * - * Use {@link getCurves} to obtain a list of available curve names. - * On recent OpenSSL releases, `openssl ecparam -list_curves` will also display - * the name and description of each available elliptic curve. - * - * If `format` is not specified the point will be returned in `'uncompressed'` format. - * - * If the `inputEncoding` is not provided, `key` is expected to be a `Buffer`, `TypedArray`, or `DataView`. - * - * Example (uncompressing a key): - * - * ```js - * const { - * createECDH, - * ECDH, - * } = await import('node:crypto'); - * - * const ecdh = createECDH('secp256k1'); - * ecdh.generateKeys(); - * - * const compressedKey = ecdh.getPublicKey('hex', 'compressed'); - * - * const uncompressedKey = ECDH.convertKey(compressedKey, - * 'secp256k1', - * 'hex', - * 'hex', - * 'uncompressed'); - * - * // The converted key and the uncompressed public key should be the same - * console.log(uncompressedKey === ecdh.getPublicKey('hex')); - * ``` - * @since v10.0.0 - * @param inputEncoding The `encoding` of the `key` string. - * @param outputEncoding The `encoding` of the return value. - * @param [format='uncompressed'] - */ - static convertKey( - key: BinaryLike, - curve: string, - inputEncoding?: BinaryToTextEncoding, - outputEncoding?: "latin1" | "hex" | "base64" | "base64url", - format?: "uncompressed" | "compressed" | "hybrid", - ): NonSharedBuffer | string; - /** - * Generates private and public EC Diffie-Hellman key values, and returns - * the public key in the specified `format` and `encoding`. This key should be - * transferred to the other party. - * - * The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified, the point will be returned in`'uncompressed'` format. - * - * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. - * @since v0.11.14 - * @param encoding The `encoding` of the return value. - * @param [format='uncompressed'] - */ - generateKeys(): NonSharedBuffer; - generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; - /** - * Computes the shared secret using `otherPublicKey` as the other - * party's public key and returns the computed shared secret. The supplied - * key is interpreted using specified `inputEncoding`, and the returned secret - * is encoded using the specified `outputEncoding`. - * If the `inputEncoding` is not - * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or `DataView`. - * - * If `outputEncoding` is given a string will be returned; otherwise a `Buffer` is returned. - * - * `ecdh.computeSecret` will throw an`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey` lies outside of the elliptic curve. Since `otherPublicKey` is - * usually supplied from a remote user over an insecure network, - * be sure to handle this exception accordingly. - * @since v0.11.14 - * @param inputEncoding The `encoding` of the `otherPublicKey` string. - * @param outputEncoding The `encoding` of the return value. - */ - computeSecret(otherPublicKey: NodeJS.ArrayBufferView): NonSharedBuffer; - computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): NonSharedBuffer; - computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string; - computeSecret( - otherPublicKey: string, - inputEncoding: BinaryToTextEncoding, - outputEncoding: BinaryToTextEncoding, - ): string; - /** - * If `encoding` is specified, a string is returned; otherwise a `Buffer` is - * returned. - * @since v0.11.14 - * @param encoding The `encoding` of the return value. - * @return The EC Diffie-Hellman in the specified `encoding`. - */ - getPrivateKey(): NonSharedBuffer; - getPrivateKey(encoding: BinaryToTextEncoding): string; - /** - * The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format. - * - * If `encoding` is specified, a string is returned; otherwise a `Buffer` is - * returned. - * @since v0.11.14 - * @param encoding The `encoding` of the return value. - * @param [format='uncompressed'] - * @return The EC Diffie-Hellman public key in the specified `encoding` and `format`. - */ - getPublicKey(encoding?: null, format?: ECDHKeyFormat): NonSharedBuffer; - getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; - /** - * Sets the EC Diffie-Hellman private key. - * If `encoding` is provided, `privateKey` is expected - * to be a string; otherwise `privateKey` is expected to be a `Buffer`, `TypedArray`, or `DataView`. - * - * If `privateKey` is not valid for the curve specified when the `ECDH` object was - * created, an error is thrown. Upon setting the private key, the associated - * public point (key) is also generated and set in the `ECDH` object. - * @since v0.11.14 - * @param encoding The `encoding` of the `privateKey` string. - */ - setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; - setPrivateKey(privateKey: string, encoding: BinaryToTextEncoding): void; - } - /** - * Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a - * predefined curve specified by the `curveName` string. Use {@link getCurves} to obtain a list of available curve names. On recent - * OpenSSL releases, `openssl ecparam -list_curves` will also display the name - * and description of each available elliptic curve. - * @since v0.11.14 - */ - function createECDH(curveName: string): ECDH; - /** - * This function compares the underlying bytes that represent the given `ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time - * algorithm. - * - * This function does not leak timing information that - * would allow an attacker to guess one of the values. This is suitable for - * comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/). - * - * `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they - * must have the same byte length. An error is thrown if `a` and `b` have - * different byte lengths. - * - * If at least one of `a` and `b` is a `TypedArray` with more than one byte per - * entry, such as `Uint16Array`, the result will be computed using the platform - * byte order. - * - * **When both of the inputs are `Float32Array`s or `Float64Array`s, this function might return unexpected results due to IEEE 754** - * **encoding of floating-point numbers. In particular, neither `x === y` nor `Object.is(x, y)` implies that the byte representations of two floating-point** - * **numbers `x` and `y` are equal.** - * - * Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code - * is timing-safe. Care should be taken to ensure that the surrounding code does - * not introduce timing vulnerabilities. - * @since v6.6.0 - */ - function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean; - type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448"; - type KeyFormat = "pem" | "der" | "jwk"; - interface BasePrivateKeyEncodingOptions { - format: T; - cipher?: string | undefined; - passphrase?: string | undefined; - } - interface KeyPairKeyObjectResult { - publicKey: KeyObject; - privateKey: KeyObject; - } - interface ED25519KeyPairKeyObjectOptions {} - interface ED448KeyPairKeyObjectOptions {} - interface X25519KeyPairKeyObjectOptions {} - interface X448KeyPairKeyObjectOptions {} - interface ECKeyPairKeyObjectOptions { - /** - * Name of the curve to use - */ - namedCurve: string; - /** - * Must be `'named'` or `'explicit'`. Default: `'named'`. - */ - paramEncoding?: "explicit" | "named" | undefined; - } - interface RSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - } - interface RSAPSSKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - /** - * Name of the message digest - */ - hashAlgorithm?: string | undefined; - /** - * Name of the message digest used by MGF1 - */ - mgf1HashAlgorithm?: string | undefined; - /** - * Minimal salt length in bytes - */ - saltLength?: string | undefined; - } - interface DSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Size of q in bits - */ - divisorLength: number; - } - interface RSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - publicKeyEncoding: { - type: "pkcs1" | "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs1" | "pkcs8"; - }; - } - interface RSAPSSKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - /** - * Name of the message digest - */ - hashAlgorithm?: string | undefined; - /** - * Name of the message digest used by MGF1 - */ - mgf1HashAlgorithm?: string | undefined; - /** - * Minimal salt length in bytes - */ - saltLength?: string | undefined; - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface DSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Size of q in bits - */ - divisorLength: number; - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface ECKeyPairOptions extends ECKeyPairKeyObjectOptions { - publicKeyEncoding: { - type: "pkcs1" | "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "sec1" | "pkcs8"; - }; - } - interface ED25519KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface ED448KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface X25519KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface X448KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface KeyPairSyncResult { - publicKey: T1; - privateKey: T2; - } - /** - * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, - * Ed25519, Ed448, X25519, X448, and DH are currently supported. - * - * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function - * behaves as if `keyObject.export()` had been called on its result. Otherwise, - * the respective part of the key is returned as a `KeyObject`. - * - * When encoding public keys, it is recommended to use `'spki'`. When encoding - * private keys, it is recommended to use `'pkcs8'` with a strong passphrase, - * and to keep the passphrase confidential. - * - * ```js - * const { - * generateKeyPairSync, - * } = await import('node:crypto'); - * - * const { - * publicKey, - * privateKey, - * } = generateKeyPairSync('rsa', { - * modulusLength: 4096, - * publicKeyEncoding: { - * type: 'spki', - * format: 'pem', - * }, - * privateKeyEncoding: { - * type: 'pkcs8', - * format: 'pem', - * cipher: 'aes-256-cbc', - * passphrase: 'top secret', - * }, - * }); - * ``` - * - * The return value `{ publicKey, privateKey }` represents the generated key pair. - * When PEM encoding was selected, the respective key will be a string, otherwise - * it will be a buffer containing the data encoded as DER. - * @since v10.12.0 - * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. - */ - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - /** - * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, - * Ed25519, Ed448, X25519, X448, and DH are currently supported. - * - * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function - * behaves as if `keyObject.export()` had been called on its result. Otherwise, - * the respective part of the key is returned as a `KeyObject`. - * - * It is recommended to encode public keys as `'spki'` and private keys as `'pkcs8'` with encryption for long-term storage: - * - * ```js - * const { - * generateKeyPair, - * } = await import('node:crypto'); - * - * generateKeyPair('rsa', { - * modulusLength: 4096, - * publicKeyEncoding: { - * type: 'spki', - * format: 'pem', - * }, - * privateKeyEncoding: { - * type: 'pkcs8', - * format: 'pem', - * cipher: 'aes-256-cbc', - * passphrase: 'top secret', - * }, - * }, (err, publicKey, privateKey) => { - * // Handle errors and use the generated key pair. - * }); - * ``` - * - * On completion, `callback` will be called with `err` set to `undefined` and `publicKey` / `privateKey` representing the generated key pair. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a `Promise` for an `Object` with `publicKey` and `privateKey` properties. - * @since v10.12.0 - * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. - */ - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - namespace generateKeyPair { - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: string; - }>; - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: NonSharedBuffer; - }>; - function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: string; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: string; - }>; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: NonSharedBuffer; - }>; - function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: string; - }>; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: NonSharedBuffer; - }>; - function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: string; - }>; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "ed25519", - options?: ED25519KeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: string; - }>; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: NonSharedBuffer; - }>; - function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: string; - }>; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "x25519", - options?: X25519KeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: NonSharedBuffer; - }>; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: string; - }>; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: NonSharedBuffer; - privateKey: NonSharedBuffer; - }>; - function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise; - } - /** - * Calculates and returns the signature for `data` using the given private key and - * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is - * dependent upon the key type (especially Ed25519 and Ed448). - * - * If `key` is not a `KeyObject`, this function behaves as if `key` had been - * passed to {@link createPrivateKey}. If it is an object, the following - * additional properties can be passed: - * - * If the `callback` function is provided this function uses libuv's threadpool. - * @since v12.0.0 - */ - function sign( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput, - ): NonSharedBuffer; - function sign( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput, - callback: (error: Error | null, data: NonSharedBuffer) => void, - ): void; - /** - * Verifies the given signature for `data` using the given key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the - * key type (especially Ed25519 and Ed448). - * - * If `key` is not a `KeyObject`, this function behaves as if `key` had been - * passed to {@link createPublicKey}. If it is an object, the following - * additional properties can be passed: - * - * The `signature` argument is the previously calculated signature for the `data`. - * - * Because public keys can be derived from private keys, a private key or a public - * key may be passed for `key`. - * - * If the `callback` function is provided this function uses libuv's threadpool. - * @since v12.0.0 - */ - function verify( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: NodeJS.ArrayBufferView, - ): boolean; - function verify( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: NodeJS.ArrayBufferView, - callback: (error: Error | null, result: boolean) => void, - ): void; - /** - * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`. - * Both keys must have the same `asymmetricKeyType`, which must be one of `'dh'` (for Diffie-Hellman), `'ec'` (for ECDH), `'x448'`, or `'x25519'` (for ECDH-ES). - * @since v13.9.0, v12.17.0 - */ - function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): NonSharedBuffer; - /** - * A utility for creating one-shot hash digests of data. It can be faster than the object-based `crypto.createHash()` when hashing a smaller amount of data - * (<= 5MB) that's readily available. If the data can be big or if it is streamed, it's still recommended to use `crypto.createHash()` instead. The `algorithm` - * is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases - * of OpenSSL, `openssl list -digest-algorithms` will display the available digest algorithms. - * - * Example: - * - * ```js - * import crypto from 'node:crypto'; - * import { Buffer } from 'node:buffer'; - * - * // Hashing a string and return the result as a hex-encoded string. - * const string = 'Node.js'; - * // 10b3493287f831e81a438811a1ffba01f8cec4b7 - * console.log(crypto.hash('sha1', string)); - * - * // Encode a base64-encoded string into a Buffer, hash it and return - * // the result as a buffer. - * const base64 = 'Tm9kZS5qcw=='; - * // - * console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer')); - * ``` - * @since v21.7.0, v20.12.0 - * @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different input encoding is desired for a string input, user - * could encode the string into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing the encoded `TypedArray` into this API instead. - * @param [outputEncoding='hex'] [Encoding](https://nodejs.org/docs/latest-v22.x/api/buffer.html#buffers-and-character-encodings) used to encode the returned digest. - */ - function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string; - function hash(algorithm: string, data: BinaryLike, outputEncoding: "buffer"): NonSharedBuffer; - function hash( - algorithm: string, - data: BinaryLike, - outputEncoding?: BinaryToTextEncoding | "buffer", - ): string | NonSharedBuffer; - type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts"; - interface CipherInfoOptions { - /** - * A test key length. - */ - keyLength?: number | undefined; - /** - * A test IV length. - */ - ivLength?: number | undefined; - } - interface CipherInfo { - /** - * The name of the cipher. - */ - name: string; - /** - * The nid of the cipher. - */ - nid: number; - /** - * The block size of the cipher in bytes. - * This property is omitted when mode is 'stream'. - */ - blockSize?: number | undefined; - /** - * The expected or default initialization vector length in bytes. - * This property is omitted if the cipher does not use an initialization vector. - */ - ivLength?: number | undefined; - /** - * The expected or default key length in bytes. - */ - keyLength: number; - /** - * The cipher mode. - */ - mode: CipherMode; - } - /** - * Returns information about a given cipher. - * - * Some ciphers accept variable length keys and initialization vectors. By default, - * the `crypto.getCipherInfo()` method will return the default values for these - * ciphers. To test if a given key length or iv length is acceptable for given - * cipher, use the `keyLength` and `ivLength` options. If the given values are - * unacceptable, `undefined` will be returned. - * @since v15.0.0 - * @param nameOrNid The name or nid of the cipher to query. - */ - function getCipherInfo(nameOrNid: string | number, options?: CipherInfoOptions): CipherInfo | undefined; - /** - * HKDF is a simple key derivation function defined in RFC 5869\. The given `ikm`, `salt` and `info` are used with the `digest` to derive a key of `keylen` bytes. - * - * The supplied `callback` function is called with two arguments: `err` and `derivedKey`. If an errors occurs while deriving the key, `err` will be set; - * otherwise `err` will be `null`. The successfully generated `derivedKey` will - * be passed to the callback as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). An error will be thrown if any - * of the input arguments specify invalid values or types. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * hkdf, - * } = await import('node:crypto'); - * - * hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => { - * if (err) throw err; - * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' - * }); - * ``` - * @since v15.0.0 - * @param digest The digest algorithm to use. - * @param ikm The input keying material. Must be provided but can be zero-length. - * @param salt The salt value. Must be provided but can be zero-length. - * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. - * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` - * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). - */ - function hkdf( - digest: string, - irm: BinaryLike | KeyObject, - salt: BinaryLike, - info: BinaryLike, - keylen: number, - callback: (err: Error | null, derivedKey: ArrayBuffer) => void, - ): void; - /** - * Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The - * given `ikm`, `salt` and `info` are used with the `digest` to derive a key of `keylen` bytes. - * - * The successfully generated `derivedKey` will be returned as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). - * - * An error will be thrown if any of the input arguments specify invalid values or - * types, or if the derived key cannot be generated. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * hkdfSync, - * } = await import('node:crypto'); - * - * const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64); - * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' - * ``` - * @since v15.0.0 - * @param digest The digest algorithm to use. - * @param ikm The input keying material. Must be provided but can be zero-length. - * @param salt The salt value. Must be provided but can be zero-length. - * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. - * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` - * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). - */ - function hkdfSync( - digest: string, - ikm: BinaryLike | KeyObject, - salt: BinaryLike, - info: BinaryLike, - keylen: number, - ): ArrayBuffer; - interface SecureHeapUsage { - /** - * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag. - */ - total: number; - /** - * The minimum allocation from the secure heap as specified using the `--secure-heap-min` command-line flag. - */ - min: number; - /** - * The total number of bytes currently allocated from the secure heap. - */ - used: number; - /** - * The calculated ratio of `used` to `total` allocated bytes. - */ - utilization: number; - } - /** - * @since v15.6.0 - */ - function secureHeapUsed(): SecureHeapUsage; - interface RandomUUIDOptions { - /** - * By default, to improve performance, - * Node.js will pre-emptively generate and persistently cache enough - * random data to generate up to 128 random UUIDs. To generate a UUID - * without using the cache, set `disableEntropyCache` to `true`. - * - * @default `false` - */ - disableEntropyCache?: boolean | undefined; - } - type UUID = `${string}-${string}-${string}-${string}-${string}`; - /** - * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a - * cryptographic pseudorandom number generator. - * @since v15.6.0, v14.17.0 - */ - function randomUUID(options?: RandomUUIDOptions): UUID; - interface X509CheckOptions { - /** - * @default 'always' - */ - subject?: "always" | "default" | "never" | undefined; - /** - * @default true - */ - wildcards?: boolean | undefined; - /** - * @default true - */ - partialWildcards?: boolean | undefined; - /** - * @default false - */ - multiLabelWildcards?: boolean | undefined; - /** - * @default false - */ - singleLabelSubdomains?: boolean | undefined; - } - /** - * Encapsulates an X509 certificate and provides read-only access to - * its information. - * - * ```js - * const { X509Certificate } = await import('node:crypto'); - * - * const x509 = new X509Certificate('{... pem encoded cert ...}'); - * - * console.log(x509.subject); - * ``` - * @since v15.6.0 - */ - class X509Certificate { - /** - * Will be \`true\` if this is a Certificate Authority (CA) certificate. - * @since v15.6.0 - */ - readonly ca: boolean; - /** - * The SHA-1 fingerprint of this certificate. - * - * Because SHA-1 is cryptographically broken and because the security of SHA-1 is - * significantly worse than that of algorithms that are commonly used to sign - * certificates, consider using `x509.fingerprint256` instead. - * @since v15.6.0 - */ - readonly fingerprint: string; - /** - * The SHA-256 fingerprint of this certificate. - * @since v15.6.0 - */ - readonly fingerprint256: string; - /** - * The SHA-512 fingerprint of this certificate. - * - * Because computing the SHA-256 fingerprint is usually faster and because it is - * only half the size of the SHA-512 fingerprint, `x509.fingerprint256` may be - * a better choice. While SHA-512 presumably provides a higher level of security in - * general, the security of SHA-256 matches that of most algorithms that are - * commonly used to sign certificates. - * @since v17.2.0, v16.14.0 - */ - readonly fingerprint512: string; - /** - * The complete subject of this certificate. - * @since v15.6.0 - */ - readonly subject: string; - /** - * The subject alternative name specified for this certificate. - * - * This is a comma-separated list of subject alternative names. Each entry begins - * with a string identifying the kind of the subject alternative name followed by - * a colon and the value associated with the entry. - * - * Earlier versions of Node.js incorrectly assumed that it is safe to split this - * property at the two-character sequence `', '` (see [CVE-2021-44532](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44532)). However, - * both malicious and legitimate certificates can contain subject alternative names - * that include this sequence when represented as a string. - * - * After the prefix denoting the type of the entry, the remainder of each entry - * might be enclosed in quotes to indicate that the value is a JSON string literal. - * For backward compatibility, Node.js only uses JSON string literals within this - * property when necessary to avoid ambiguity. Third-party code should be prepared - * to handle both possible entry formats. - * @since v15.6.0 - */ - readonly subjectAltName: string | undefined; - /** - * A textual representation of the certificate's authority information access - * extension. - * - * This is a line feed separated list of access descriptions. Each line begins with - * the access method and the kind of the access location, followed by a colon and - * the value associated with the access location. - * - * After the prefix denoting the access method and the kind of the access location, - * the remainder of each line might be enclosed in quotes to indicate that the - * value is a JSON string literal. For backward compatibility, Node.js only uses - * JSON string literals within this property when necessary to avoid ambiguity. - * Third-party code should be prepared to handle both possible entry formats. - * @since v15.6.0 - */ - readonly infoAccess: string | undefined; - /** - * An array detailing the key usages for this certificate. - * @since v15.6.0 - */ - readonly keyUsage: string[]; - /** - * The issuer identification included in this certificate. - * @since v15.6.0 - */ - readonly issuer: string; - /** - * The issuer certificate or `undefined` if the issuer certificate is not - * available. - * @since v15.9.0 - */ - readonly issuerCertificate: X509Certificate | undefined; - /** - * The public key `KeyObject` for this certificate. - * @since v15.6.0 - */ - readonly publicKey: KeyObject; - /** - * A `Buffer` containing the DER encoding of this certificate. - * @since v15.6.0 - */ - readonly raw: NonSharedBuffer; - /** - * The serial number of this certificate. - * - * Serial numbers are assigned by certificate authorities and do not uniquely - * identify certificates. Consider using `x509.fingerprint256` as a unique - * identifier instead. - * @since v15.6.0 - */ - readonly serialNumber: string; - /** - * The date/time from which this certificate is considered valid. - * @since v15.6.0 - */ - readonly validFrom: string; - /** - * The date/time from which this certificate is valid, encapsulated in a `Date` object. - * @since v22.10.0 - */ - readonly validFromDate: Date; - /** - * The date/time until which this certificate is considered valid. - * @since v15.6.0 - */ - readonly validTo: string; - /** - * The date/time until which this certificate is valid, encapsulated in a `Date` object. - * @since v22.10.0 - */ - readonly validToDate: Date; - constructor(buffer: BinaryLike); - /** - * Checks whether the certificate matches the given email address. - * - * If the `'subject'` option is undefined or set to `'default'`, the certificate - * subject is only considered if the subject alternative name extension either does - * not exist or does not contain any email addresses. - * - * If the `'subject'` option is set to `'always'` and if the subject alternative - * name extension either does not exist or does not contain a matching email - * address, the certificate subject is considered. - * - * If the `'subject'` option is set to `'never'`, the certificate subject is never - * considered, even if the certificate contains no subject alternative names. - * @since v15.6.0 - * @return Returns `email` if the certificate matches, `undefined` if it does not. - */ - checkEmail(email: string, options?: Pick): string | undefined; - /** - * Checks whether the certificate matches the given host name. - * - * If the certificate matches the given host name, the matching subject name is - * returned. The returned name might be an exact match (e.g., `foo.example.com`) - * or it might contain wildcards (e.g., `*.example.com`). Because host name - * comparisons are case-insensitive, the returned subject name might also differ - * from the given `name` in capitalization. - * - * If the `'subject'` option is undefined or set to `'default'`, the certificate - * subject is only considered if the subject alternative name extension either does - * not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818](https://www.rfc-editor.org/rfc/rfc2818.txt) ("HTTP Over TLS"). - * - * If the `'subject'` option is set to `'always'` and if the subject alternative - * name extension either does not exist or does not contain a matching DNS name, - * the certificate subject is considered. - * - * If the `'subject'` option is set to `'never'`, the certificate subject is never - * considered, even if the certificate contains no subject alternative names. - * @since v15.6.0 - * @return Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`. - */ - checkHost(name: string, options?: X509CheckOptions): string | undefined; - /** - * Checks whether the certificate matches the given IP address (IPv4 or IPv6). - * - * Only [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.txt) `iPAddress` subject alternative names are considered, and they - * must match the given `ip` address exactly. Other subject alternative names as - * well as the subject field of the certificate are ignored. - * @since v15.6.0 - * @return Returns `ip` if the certificate matches, `undefined` if it does not. - */ - checkIP(ip: string): string | undefined; - /** - * Checks whether this certificate was potentially issued by the given `otherCert` - * by comparing the certificate metadata. - * - * This is useful for pruning a list of possible issuer certificates which have been - * selected using a more rudimentary filtering routine, i.e. just based on subject - * and issuer names. - * - * Finally, to verify that this certificate's signature was produced by a private key - * corresponding to `otherCert`'s public key use `x509.verify(publicKey)` - * with `otherCert`'s public key represented as a `KeyObject` - * like so - * - * ```js - * if (!x509.verify(otherCert.publicKey)) { - * throw new Error('otherCert did not issue x509'); - * } - * ``` - * @since v15.6.0 - */ - checkIssued(otherCert: X509Certificate): boolean; - /** - * Checks whether the public key for this certificate is consistent with - * the given private key. - * @since v15.6.0 - * @param privateKey A private key. - */ - checkPrivateKey(privateKey: KeyObject): boolean; - /** - * There is no standard JSON encoding for X509 certificates. The`toJSON()` method returns a string containing the PEM encoded - * certificate. - * @since v15.6.0 - */ - toJSON(): string; - /** - * Returns information about this certificate using the legacy `certificate object` encoding. - * @since v15.6.0 - */ - toLegacyObject(): PeerCertificate; - /** - * Returns the PEM-encoded certificate. - * @since v15.6.0 - */ - toString(): string; - /** - * Verifies that this certificate was signed by the given public key. - * Does not perform any other validation checks on the certificate. - * @since v15.6.0 - * @param publicKey A public key. - */ - verify(publicKey: KeyObject): boolean; - } - type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint; - interface GeneratePrimeOptions { - add?: LargeNumberLike | undefined; - rem?: LargeNumberLike | undefined; - /** - * @default false - */ - safe?: boolean | undefined; - bigint?: boolean | undefined; - } - interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions { - bigint: true; - } - interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions { - bigint?: false | undefined; - } - /** - * Generates a pseudorandom prime of `size` bits. - * - * If `options.safe` is `true`, the prime will be a safe prime -- that is, `(prime - 1) / 2` will also be a prime. - * - * The `options.add` and `options.rem` parameters can be used to enforce additional - * requirements, e.g., for Diffie-Hellman: - * - * * If `options.add` and `options.rem` are both set, the prime will satisfy the - * condition that `prime % add = rem`. - * * If only `options.add` is set and `options.safe` is not `true`, the prime will - * satisfy the condition that `prime % add = 1`. - * * If only `options.add` is set and `options.safe` is set to `true`, the prime - * will instead satisfy the condition that `prime % add = 3`. This is necessary - * because `prime % add = 1` for `options.add > 2` would contradict the condition - * enforced by `options.safe`. - * * `options.rem` is ignored if `options.add` is not given. - * - * Both `options.add` and `options.rem` must be encoded as big-endian sequences - * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or `DataView`. - * - * By default, the prime is encoded as a big-endian sequence of octets - * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a - * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. - * @since v15.8.0 - * @param size The size (in bits) of the prime to generate. - */ - function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void; - function generatePrime( - size: number, - options: GeneratePrimeOptionsBigInt, - callback: (err: Error | null, prime: bigint) => void, - ): void; - function generatePrime( - size: number, - options: GeneratePrimeOptionsArrayBuffer, - callback: (err: Error | null, prime: ArrayBuffer) => void, - ): void; - function generatePrime( - size: number, - options: GeneratePrimeOptions, - callback: (err: Error | null, prime: ArrayBuffer | bigint) => void, - ): void; - /** - * Generates a pseudorandom prime of `size` bits. - * - * If `options.safe` is `true`, the prime will be a safe prime -- that is, `(prime - 1) / 2` will also be a prime. - * - * The `options.add` and `options.rem` parameters can be used to enforce additional - * requirements, e.g., for Diffie-Hellman: - * - * * If `options.add` and `options.rem` are both set, the prime will satisfy the - * condition that `prime % add = rem`. - * * If only `options.add` is set and `options.safe` is not `true`, the prime will - * satisfy the condition that `prime % add = 1`. - * * If only `options.add` is set and `options.safe` is set to `true`, the prime - * will instead satisfy the condition that `prime % add = 3`. This is necessary - * because `prime % add = 1` for `options.add > 2` would contradict the condition - * enforced by `options.safe`. - * * `options.rem` is ignored if `options.add` is not given. - * - * Both `options.add` and `options.rem` must be encoded as big-endian sequences - * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or `DataView`. - * - * By default, the prime is encoded as a big-endian sequence of octets - * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a - * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. - * @since v15.8.0 - * @param size The size (in bits) of the prime to generate. - */ - function generatePrimeSync(size: number): ArrayBuffer; - function generatePrimeSync(size: number, options: GeneratePrimeOptionsBigInt): bigint; - function generatePrimeSync(size: number, options: GeneratePrimeOptionsArrayBuffer): ArrayBuffer; - function generatePrimeSync(size: number, options: GeneratePrimeOptions): ArrayBuffer | bigint; - interface CheckPrimeOptions { - /** - * The number of Miller-Rabin probabilistic primality iterations to perform. - * When the value is 0 (zero), a number of checks is used that yields a false positive rate of at most `2**-64` for random input. - * Care must be used when selecting a number of checks. - * Refer to the OpenSSL documentation for the BN_is_prime_ex function nchecks options for more details. - * - * @default 0 - */ - checks?: number | undefined; - } - /** - * Checks the primality of the `candidate`. - * @since v15.8.0 - * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. - */ - function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void; - function checkPrime( - value: LargeNumberLike, - options: CheckPrimeOptions, - callback: (err: Error | null, result: boolean) => void, - ): void; - /** - * Checks the primality of the `candidate`. - * @since v15.8.0 - * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. - * @return `true` if the candidate is a prime with an error probability less than `0.25 ** options.checks`. - */ - function checkPrimeSync(candidate: LargeNumberLike, options?: CheckPrimeOptions): boolean; - /** - * Load and set the `engine` for some or all OpenSSL functions (selected by flags). - * - * `engine` could be either an id or a path to the engine's shared library. - * - * The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` is a bit field taking one of or a mix of the following flags (defined in `crypto.constants`): - * - * * `crypto.constants.ENGINE_METHOD_RSA` - * * `crypto.constants.ENGINE_METHOD_DSA` - * * `crypto.constants.ENGINE_METHOD_DH` - * * `crypto.constants.ENGINE_METHOD_RAND` - * * `crypto.constants.ENGINE_METHOD_EC` - * * `crypto.constants.ENGINE_METHOD_CIPHERS` - * * `crypto.constants.ENGINE_METHOD_DIGESTS` - * * `crypto.constants.ENGINE_METHOD_PKEY_METHS` - * * `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` - * * `crypto.constants.ENGINE_METHOD_ALL` - * * `crypto.constants.ENGINE_METHOD_NONE` - * @since v0.11.11 - * @param flags - */ - function setEngine(engine: string, flags?: number): void; - /** - * A convenient alias for {@link webcrypto.getRandomValues}. This - * implementation is not compliant with the Web Crypto spec, to write - * web-compatible code use {@link webcrypto.getRandomValues} instead. - * @since v17.4.0 - * @return Returns `typedArray`. - */ - function getRandomValues(typedArray: T): T; - /** - * A convenient alias for `crypto.webcrypto.subtle`. - * @since v17.4.0 - */ - const subtle: webcrypto.SubtleCrypto; - /** - * An implementation of the Web Crypto API standard. - * - * See the {@link https://nodejs.org/docs/latest/api/webcrypto.html Web Crypto API documentation} for details. - * @since v15.0.0 - */ - const webcrypto: webcrypto.Crypto; - namespace webcrypto { - type BufferSource = ArrayBufferView | ArrayBuffer; - type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki"; - type KeyType = "private" | "public" | "secret"; - type KeyUsage = - | "decrypt" - | "deriveBits" - | "deriveKey" - | "encrypt" - | "sign" - | "unwrapKey" - | "verify" - | "wrapKey"; - type AlgorithmIdentifier = Algorithm | string; - type HashAlgorithmIdentifier = AlgorithmIdentifier; - type NamedCurve = string; - type BigInteger = Uint8Array; - interface AesCbcParams extends Algorithm { - iv: BufferSource; - } - interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; - } - interface AesDerivedKeyParams extends Algorithm { - length: number; - } - interface AesGcmParams extends Algorithm { - additionalData?: BufferSource; - iv: BufferSource; - tagLength?: number; - } - interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; - } - interface AesKeyGenParams extends Algorithm { - length: number; - } - interface Algorithm { - name: string; - } - interface EcKeyAlgorithm extends KeyAlgorithm { - namedCurve: NamedCurve; - } - interface EcKeyGenParams extends Algorithm { - namedCurve: NamedCurve; - } - interface EcKeyImportParams extends Algorithm { - namedCurve: NamedCurve; - } - interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; - } - interface EcdsaParams extends Algorithm { - hash: HashAlgorithmIdentifier; - } - interface Ed448Params extends Algorithm { - context?: BufferSource; - } - interface HkdfParams extends Algorithm { - hash: HashAlgorithmIdentifier; - info: BufferSource; - salt: BufferSource; - } - interface HmacImportParams extends Algorithm { - hash: HashAlgorithmIdentifier; - length?: number; - } - interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: KeyAlgorithm; - length: number; - } - interface HmacKeyGenParams extends Algorithm { - hash: HashAlgorithmIdentifier; - length?: number; - } - interface JsonWebKey { - alg?: string; - crv?: string; - d?: string; - dp?: string; - dq?: string; - e?: string; - ext?: boolean; - k?: string; - key_ops?: string[]; - kty?: string; - n?: string; - oth?: RsaOtherPrimesInfo[]; - p?: string; - q?: string; - qi?: string; - use?: string; - x?: string; - y?: string; - } - interface KeyAlgorithm { - name: string; - } - interface Pbkdf2Params extends Algorithm { - hash: HashAlgorithmIdentifier; - iterations: number; - salt: BufferSource; - } - interface RsaHashedImportParams extends Algorithm { - hash: HashAlgorithmIdentifier; - } - interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: KeyAlgorithm; - } - interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: HashAlgorithmIdentifier; - } - interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: BigInteger; - } - interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: BigInteger; - } - interface RsaOaepParams extends Algorithm { - label?: BufferSource; - } - interface RsaOtherPrimesInfo { - d?: string; - r?: string; - t?: string; - } - interface RsaPssParams extends Algorithm { - saltLength: number; - } - /** - * Importing the `webcrypto` object (`import { webcrypto } from 'node:crypto'`) gives an instance of the `Crypto` class. - * `Crypto` is a singleton that provides access to the remainder of the crypto API. - * @since v15.0.0 - */ - interface Crypto { - /** - * Provides access to the `SubtleCrypto` API. - * @since v15.0.0 - */ - readonly subtle: SubtleCrypto; - /** - * Generates cryptographically strong random values. - * The given `typedArray` is filled with random values, and a reference to `typedArray` is returned. - * - * The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted. - * - * An error will be thrown if the given `typedArray` is larger than 65,536 bytes. - * @since v15.0.0 - */ - getRandomValues>(typedArray: T): T; - /** - * Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID. - * The UUID is generated using a cryptographic pseudorandom number generator. - * @since v16.7.0 - */ - randomUUID(): UUID; - CryptoKey: CryptoKeyConstructor; - } - // This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable. - interface CryptoKeyConstructor { - /** Illegal constructor */ - (_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user. - readonly length: 0; - readonly name: "CryptoKey"; - readonly prototype: CryptoKey; - } - /** - * @since v15.0.0 - */ - interface CryptoKey { - /** - * An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters. - * @since v15.0.0 - */ - readonly algorithm: KeyAlgorithm; - /** - * When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`. - * @since v15.0.0 - */ - readonly extractable: boolean; - /** - * A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key. - * @since v15.0.0 - */ - readonly type: KeyType; - /** - * An array of strings identifying the operations for which the key may be used. - * - * The possible usages are: - * - `'encrypt'` - The key may be used to encrypt data. - * - `'decrypt'` - The key may be used to decrypt data. - * - `'sign'` - The key may be used to generate digital signatures. - * - `'verify'` - The key may be used to verify digital signatures. - * - `'deriveKey'` - The key may be used to derive a new key. - * - `'deriveBits'` - The key may be used to derive bits. - * - `'wrapKey'` - The key may be used to wrap another key. - * - `'unwrapKey'` - The key may be used to unwrap another key. - * - * Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`). - * @since v15.0.0 - */ - readonly usages: KeyUsage[]; - } - /** - * The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair. - * @since v15.0.0 - */ - interface CryptoKeyPair { - /** - * A {@link CryptoKey} whose type will be `'private'`. - * @since v15.0.0 - */ - privateKey: CryptoKey; - /** - * A {@link CryptoKey} whose type will be `'public'`. - * @since v15.0.0 - */ - publicKey: CryptoKey; - } - /** - * @since v15.0.0 - */ - interface SubtleCrypto { - /** - * Using the method and parameters specified in `algorithm` and the keying material provided by `key`, - * `subtle.decrypt()` attempts to decipher the provided `data`. If successful, - * the returned promise will be resolved with an `` containing the plaintext result. - * - * The algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * @since v15.0.0 - */ - decrypt( - algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - key: CryptoKey, - data: BufferSource, - ): Promise; - /** - * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`, - * `subtle.deriveBits()` attempts to generate `length` bits. - * The Node.js implementation requires that when `length` is a number it must be multiple of `8`. - * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed - * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms. - * If successful, the returned promise will be resolved with an `` containing the generated data. - * - * The algorithms currently supported include: - * - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * - `'HKDF'` - * - `'PBKDF2'` - * @since v15.0.0 - */ - deriveBits( - algorithm: EcdhKeyDeriveParams, - baseKey: CryptoKey, - length?: number | null, - ): Promise; - deriveBits( - algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, - baseKey: CryptoKey, - length: number, - ): Promise; - /** - * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`, - * `subtle.deriveKey()` attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. - * - * Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material, - * then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input. - * - * The algorithms currently supported include: - * - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * - `'HKDF'` - * - `'PBKDF2'` - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - deriveKey( - algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, - baseKey: CryptoKey, - derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - /** - * Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`. - * If successful, the returned promise is resolved with an `` containing the computed digest. - * - * If `algorithm` is provided as a ``, it must be one of: - * - * - `'SHA-1'` - * - `'SHA-256'` - * - `'SHA-384'` - * - `'SHA-512'` - * - * If `algorithm` is provided as an ``, it must have a `name` property whose value is one of the above. - * @since v15.0.0 - */ - digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise; - /** - * Using the method and parameters specified by `algorithm` and the keying material provided by `key`, - * `subtle.encrypt()` attempts to encipher `data`. If successful, - * the returned promise is resolved with an `` containing the encrypted result. - * - * The algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * @since v15.0.0 - */ - encrypt( - algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - key: CryptoKey, - data: BufferSource, - ): Promise; - /** - * Exports the given key into the specified format, if supported. - * - * If the `` is not extractable, the returned promise will reject. - * - * When `format` is either `'pkcs8'` or `'spki'` and the export is successful, - * the returned promise will be resolved with an `` containing the exported key data. - * - * When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a - * JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification. - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @returns `` containing ``. - * @since v15.0.0 - */ - exportKey(format: "jwk", key: CryptoKey): Promise; - exportKey(format: Exclude, key: CryptoKey): Promise; - /** - * Using the method and parameters provided in `algorithm`, - * `subtle.generateKey()` attempts to generate new keying material. - * Depending the method used, the method may generate either a single `` or a ``. - * - * The `` (public and private key) generating algorithms supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'RSA-OAEP'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * The `` (secret key) generating algorithms supported include: - * - * - `'HMAC'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - generateKey( - algorithm: RsaHashedKeyGenParams | EcKeyGenParams, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - generateKey( - algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - generateKey( - algorithm: AlgorithmIdentifier, - extractable: boolean, - keyUsages: KeyUsage[], - ): Promise; - /** - * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format` - * to create a `` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments. - * If the import is successful, the returned promise will be resolved with the created ``. - * - * If importing a `'PBKDF2'` key, `extractable` must be `false`. - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - importKey( - format: "jwk", - keyData: JsonWebKey, - algorithm: - | AlgorithmIdentifier - | RsaHashedImportParams - | EcKeyImportParams - | HmacImportParams - | AesKeyAlgorithm, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - importKey( - format: Exclude, - keyData: BufferSource, - algorithm: - | AlgorithmIdentifier - | RsaHashedImportParams - | EcKeyImportParams - | HmacImportParams - | AesKeyAlgorithm, - extractable: boolean, - keyUsages: KeyUsage[], - ): Promise; - /** - * Using the method and parameters given by `algorithm` and the keying material provided by `key`, - * `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful, - * the returned promise is resolved with an `` containing the generated signature. - * - * The algorithms currently supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'HMAC'` - * @since v15.0.0 - */ - sign( - algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, - key: CryptoKey, - data: BufferSource, - ): Promise; - /** - * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. - * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `` instance. - * It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input) - * then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs. - * If successful, the returned promise is resolved with a `` object. - * - * The wrapping algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * - * The unwrapped key algorithms supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'RSA-OAEP'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * - `'HMAC'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - unwrapKey( - format: KeyFormat, - wrappedKey: BufferSource, - unwrappingKey: CryptoKey, - unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - unwrappedKeyAlgorithm: - | AlgorithmIdentifier - | RsaHashedImportParams - | EcKeyImportParams - | HmacImportParams - | AesKeyAlgorithm, - extractable: boolean, - keyUsages: KeyUsage[], - ): Promise; - /** - * Using the method and parameters given in `algorithm` and the keying material provided by `key`, - * `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`. - * The returned promise is resolved with either `true` or `false`. - * - * The algorithms currently supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'HMAC'` - * @since v15.0.0 - */ - verify( - algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, - key: CryptoKey, - signature: BufferSource, - data: BufferSource, - ): Promise; - /** - * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. - * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`, - * then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`. - * It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments, - * then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs. - * If successful, the returned promise will be resolved with an `` containing the encrypted key data. - * - * The wrapping algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @since v15.0.0 - */ - wrapKey( - format: KeyFormat, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - ): Promise; - } - } - - global { - var crypto: typeof globalThis extends { - crypto: infer T; - onmessage: any; - } ? T - : webcrypto.Crypto; - } -} -declare module "node:crypto" { - export * from "crypto"; -} diff --git a/node_modules/@types/node/dgram.d.ts b/node_modules/@types/node/dgram.d.ts deleted file mode 100644 index 9776de0..0000000 --- a/node_modules/@types/node/dgram.d.ts +++ /dev/null @@ -1,600 +0,0 @@ -/** - * The `node:dgram` module provides an implementation of UDP datagram sockets. - * - * ```js - * import dgram from 'node:dgram'; - * - * const server = dgram.createSocket('udp4'); - * - * server.on('error', (err) => { - * console.error(`server error:\n${err.stack}`); - * server.close(); - * }); - * - * server.on('message', (msg, rinfo) => { - * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); - * }); - * - * server.on('listening', () => { - * const address = server.address(); - * console.log(`server listening ${address.address}:${address.port}`); - * }); - * - * server.bind(41234); - * // Prints: server listening 0.0.0.0:41234 - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/dgram.js) - */ -declare module "dgram" { - import { NonSharedBuffer } from "node:buffer"; - import { AddressInfo, BlockList } from "node:net"; - import * as dns from "node:dns"; - import { Abortable, EventEmitter } from "node:events"; - interface RemoteInfo { - address: string; - family: "IPv4" | "IPv6"; - port: number; - size: number; - } - interface BindOptions { - port?: number | undefined; - address?: string | undefined; - exclusive?: boolean | undefined; - fd?: number | undefined; - } - type SocketType = "udp4" | "udp6"; - interface SocketOptions extends Abortable { - type: SocketType; - reuseAddr?: boolean | undefined; - reusePort?: boolean | undefined; - /** - * @default false - */ - ipv6Only?: boolean | undefined; - recvBufferSize?: number | undefined; - sendBufferSize?: number | undefined; - lookup?: - | (( - hostname: string, - options: dns.LookupOneOptions, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ) => void) - | undefined; - receiveBlockList?: BlockList | undefined; - sendBlockList?: BlockList | undefined; - } - /** - * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram - * messages. When `address` and `port` are not passed to `socket.bind()` the - * method will bind the socket to the "all interfaces" address on a random port - * (it does the right thing for both `udp4` and `udp6` sockets). The bound address - * and port can be retrieved using `socket.address().address` and `socket.address().port`. - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.close()` on the socket: - * - * ```js - * const controller = new AbortController(); - * const { signal } = controller; - * const server = dgram.createSocket({ type: 'udp4', signal }); - * server.on('message', (msg, rinfo) => { - * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); - * }); - * // Later, when you want to close the server. - * controller.abort(); - * ``` - * @since v0.11.13 - * @param options Available options are: - * @param callback Attached as a listener for `'message'` events. Optional. - */ - function createSocket(type: SocketType, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket; - function createSocket(options: SocketOptions, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket; - /** - * Encapsulates the datagram functionality. - * - * New instances of `dgram.Socket` are created using {@link createSocket}. - * The `new` keyword is not to be used to create `dgram.Socket` instances. - * @since v0.1.99 - */ - class Socket extends EventEmitter { - /** - * Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not - * specified, the operating system will choose - * one interface and will add membership to it. To add membership to every - * available interface, call `addMembership` multiple times, once per interface. - * - * When called on an unbound socket, this method will implicitly bind to a random - * port, listening on all interfaces. - * - * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur: - * - * ```js - * import cluster from 'node:cluster'; - * import dgram from 'node:dgram'; - * - * if (cluster.isPrimary) { - * cluster.fork(); // Works ok. - * cluster.fork(); // Fails with EADDRINUSE. - * } else { - * const s = dgram.createSocket('udp4'); - * s.bind(1234, () => { - * s.addMembership('224.0.0.114'); - * }); - * } - * ``` - * @since v0.6.9 - */ - addMembership(multicastAddress: string, multicastInterface?: string): void; - /** - * Returns an object containing the address information for a socket. - * For UDP sockets, this object will contain `address`, `family`, and `port` properties. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.1.99 - */ - address(): AddressInfo; - /** - * For UDP sockets, causes the `dgram.Socket` to listen for datagram - * messages on a named `port` and optional `address`. If `port` is not - * specified or is `0`, the operating system will attempt to bind to a - * random port. If `address` is not specified, the operating system will - * attempt to listen on all addresses. Once binding is complete, a `'listening'` event is emitted and the optional `callback` function is - * called. - * - * Specifying both a `'listening'` event listener and passing a `callback` to the `socket.bind()` method is not harmful but not very - * useful. - * - * A bound datagram socket keeps the Node.js process running to receive - * datagram messages. - * - * If binding fails, an `'error'` event is generated. In rare case (e.g. - * attempting to bind with a closed socket), an `Error` may be thrown. - * - * Example of a UDP server listening on port 41234: - * - * ```js - * import dgram from 'node:dgram'; - * - * const server = dgram.createSocket('udp4'); - * - * server.on('error', (err) => { - * console.error(`server error:\n${err.stack}`); - * server.close(); - * }); - * - * server.on('message', (msg, rinfo) => { - * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); - * }); - * - * server.on('listening', () => { - * const address = server.address(); - * console.log(`server listening ${address.address}:${address.port}`); - * }); - * - * server.bind(41234); - * // Prints: server listening 0.0.0.0:41234 - * ``` - * @since v0.1.99 - * @param callback with no parameters. Called when binding is complete. - */ - bind(port?: number, address?: string, callback?: () => void): this; - bind(port?: number, callback?: () => void): this; - bind(callback?: () => void): this; - bind(options: BindOptions, callback?: () => void): this; - /** - * Close the underlying socket and stop listening for data on it. If a callback is - * provided, it is added as a listener for the `'close'` event. - * @since v0.1.99 - * @param callback Called when the socket has been closed. - */ - close(callback?: () => void): this; - /** - * Associates the `dgram.Socket` to a remote address and port. Every - * message sent by this handle is automatically sent to that destination. Also, - * the socket will only receive messages from that remote peer. - * Trying to call `connect()` on an already connected socket will result - * in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not - * provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) - * will be used by default. Once the connection is complete, a `'connect'` event - * is emitted and the optional `callback` function is called. In case of failure, - * the `callback` is called or, failing this, an `'error'` event is emitted. - * @since v12.0.0 - * @param callback Called when the connection is completed or on error. - */ - connect(port: number, address?: string, callback?: () => void): void; - connect(port: number, callback: () => void): void; - /** - * A synchronous function that disassociates a connected `dgram.Socket` from - * its remote address. Trying to call `disconnect()` on an unbound or already - * disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception. - * @since v12.0.0 - */ - disconnect(): void; - /** - * Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the - * kernel when the socket is closed or the process terminates, so most apps will - * never have reason to call this. - * - * If `multicastInterface` is not specified, the operating system will attempt to - * drop membership on all valid interfaces. - * @since v0.6.9 - */ - dropMembership(multicastAddress: string, multicastInterface?: string): void; - /** - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - * @return the `SO_RCVBUF` socket receive buffer size in bytes. - */ - getRecvBufferSize(): number; - /** - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - * @return the `SO_SNDBUF` socket send buffer size in bytes. - */ - getSendBufferSize(): number; - /** - * @since v18.8.0, v16.19.0 - * @return Number of bytes queued for sending. - */ - getSendQueueSize(): number; - /** - * @since v18.8.0, v16.19.0 - * @return Number of send requests currently in the queue awaiting to be processed. - */ - getSendQueueCount(): number; - /** - * By default, binding a socket will cause it to block the Node.js process from - * exiting as long as the socket is open. The `socket.unref()` method can be used - * to exclude the socket from the reference counting that keeps the Node.js - * process active. The `socket.ref()` method adds the socket back to the reference - * counting and restores the default behavior. - * - * Calling `socket.ref()` multiples times will have no additional effect. - * - * The `socket.ref()` method returns a reference to the socket so calls can be - * chained. - * @since v0.9.1 - */ - ref(): this; - /** - * Returns an object containing the `address`, `family`, and `port` of the remote - * endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception - * if the socket is not connected. - * @since v12.0.0 - */ - remoteAddress(): AddressInfo; - /** - * Broadcasts a datagram on the socket. - * For connectionless sockets, the destination `port` and `address` must be - * specified. Connected sockets, on the other hand, will use their associated - * remote endpoint, so the `port` and `address` arguments must not be set. - * - * The `msg` argument contains the message to be sent. - * Depending on its type, different behavior can apply. If `msg` is a `Buffer`, - * any `TypedArray` or a `DataView`, - * the `offset` and `length` specify the offset within the `Buffer` where the - * message begins and the number of bytes in the message, respectively. - * If `msg` is a `String`, then it is automatically converted to a `Buffer` with `'utf8'` encoding. With messages that - * contain multi-byte characters, `offset` and `length` will be calculated with - * respect to `byte length` and not the character position. - * If `msg` is an array, `offset` and `length` must not be specified. - * - * The `address` argument is a string. If the value of `address` is a host name, - * DNS will be used to resolve the address of the host. If `address` is not - * provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) will be used by default. - * - * If the socket has not been previously bound with a call to `bind`, the socket - * is assigned a random port number and is bound to the "all interfaces" address - * (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.) - * - * An optional `callback` function may be specified to as a way of reporting - * DNS errors or for determining when it is safe to reuse the `buf` object. - * DNS lookups delay the time to send for at least one tick of the - * Node.js event loop. - * - * The only way to know for sure that the datagram has been sent is by using a `callback`. If an error occurs and a `callback` is given, the error will be - * passed as the first argument to the `callback`. If a `callback` is not given, - * the error is emitted as an `'error'` event on the `socket` object. - * - * Offset and length are optional but both _must_ be set if either are used. - * They are supported only when the first argument is a `Buffer`, a `TypedArray`, - * or a `DataView`. - * - * This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket. - * - * Example of sending a UDP packet to a port on `localhost`; - * - * ```js - * import dgram from 'node:dgram'; - * import { Buffer } from 'node:buffer'; - * - * const message = Buffer.from('Some bytes'); - * const client = dgram.createSocket('udp4'); - * client.send(message, 41234, 'localhost', (err) => { - * client.close(); - * }); - * ``` - * - * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`; - * - * ```js - * import dgram from 'node:dgram'; - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('Some '); - * const buf2 = Buffer.from('bytes'); - * const client = dgram.createSocket('udp4'); - * client.send([buf1, buf2], 41234, (err) => { - * client.close(); - * }); - * ``` - * - * Sending multiple buffers might be faster or slower depending on the - * application and operating system. Run benchmarks to - * determine the optimal strategy on a case-by-case basis. Generally speaking, - * however, sending multiple buffers is faster. - * - * Example of sending a UDP packet using a socket connected to a port on `localhost`: - * - * ```js - * import dgram from 'node:dgram'; - * import { Buffer } from 'node:buffer'; - * - * const message = Buffer.from('Some bytes'); - * const client = dgram.createSocket('udp4'); - * client.connect(41234, 'localhost', (err) => { - * client.send(message, (err) => { - * client.close(); - * }); - * }); - * ``` - * @since v0.1.99 - * @param msg Message to be sent. - * @param offset Offset in the buffer where the message starts. - * @param length Number of bytes in the message. - * @param port Destination port. - * @param address Destination host name or IP address. - * @param callback Called when the message has been sent. - */ - send( - msg: string | NodeJS.ArrayBufferView | readonly any[], - port?: number, - address?: string, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | NodeJS.ArrayBufferView | readonly any[], - port?: number, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | NodeJS.ArrayBufferView | readonly any[], - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | NodeJS.ArrayBufferView, - offset: number, - length: number, - port?: number, - address?: string, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | NodeJS.ArrayBufferView, - offset: number, - length: number, - port?: number, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | NodeJS.ArrayBufferView, - offset: number, - length: number, - callback?: (error: Error | null, bytes: number) => void, - ): void; - /** - * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP - * packets may be sent to a local interface's broadcast address. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.6.9 - */ - setBroadcast(flag: boolean): void; - /** - * _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC - * 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_ - * _with a scope index is written as `'IP%scope'` where scope is an interface name_ - * _or interface number._ - * - * Sets the default outgoing multicast interface of the socket to a chosen - * interface or back to system interface selection. The `multicastInterface` must - * be a valid string representation of an IP from the socket's family. - * - * For IPv4 sockets, this should be the IP configured for the desired physical - * interface. All packets sent to multicast on the socket will be sent on the - * interface determined by the most recent successful use of this call. - * - * For IPv6 sockets, `multicastInterface` should include a scope to indicate the - * interface as in the examples that follow. In IPv6, individual `send` calls can - * also use explicit scope in addresses, so only packets sent to a multicast - * address without specifying an explicit scope are affected by the most recent - * successful use of this call. - * - * This method throws `EBADF` if called on an unbound socket. - * - * #### Example: IPv6 outgoing multicast interface - * - * On most systems, where scope format uses the interface name: - * - * ```js - * const socket = dgram.createSocket('udp6'); - * - * socket.bind(1234, () => { - * socket.setMulticastInterface('::%eth1'); - * }); - * ``` - * - * On Windows, where scope format uses an interface number: - * - * ```js - * const socket = dgram.createSocket('udp6'); - * - * socket.bind(1234, () => { - * socket.setMulticastInterface('::%2'); - * }); - * ``` - * - * #### Example: IPv4 outgoing multicast interface - * - * All systems use an IP of the host on the desired physical interface: - * - * ```js - * const socket = dgram.createSocket('udp4'); - * - * socket.bind(1234, () => { - * socket.setMulticastInterface('10.0.0.2'); - * }); - * ``` - * @since v8.6.0 - */ - setMulticastInterface(multicastInterface: string): void; - /** - * Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`, - * multicast packets will also be received on the local interface. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.3.8 - */ - setMulticastLoopback(flag: boolean): boolean; - /** - * Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for - * "Time to Live", in this context it specifies the number of IP hops that a - * packet is allowed to travel through, specifically for multicast traffic. Each - * router or gateway that forwards a packet decrements the TTL. If the TTL is - * decremented to 0 by a router, it will not be forwarded. - * - * The `ttl` argument may be between 0 and 255\. The default on most systems is `1`. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.3.8 - */ - setMulticastTTL(ttl: number): number; - /** - * Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer - * in bytes. - * - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - */ - setRecvBufferSize(size: number): void; - /** - * Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer - * in bytes. - * - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - */ - setSendBufferSize(size: number): void; - /** - * Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live", - * in this context it specifies the number of IP hops that a packet is allowed to - * travel through. Each router or gateway that forwards a packet decrements the - * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. - * Changing TTL values is typically done for network probes or when multicasting. - * - * The `ttl` argument may be between 1 and 255\. The default on most systems - * is 64. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.1.101 - */ - setTTL(ttl: number): number; - /** - * By default, binding a socket will cause it to block the Node.js process from - * exiting as long as the socket is open. The `socket.unref()` method can be used - * to exclude the socket from the reference counting that keeps the Node.js - * process active, allowing the process to exit even if the socket is still - * listening. - * - * Calling `socket.unref()` multiple times will have no additional effect. - * - * The `socket.unref()` method returns a reference to the socket so calls can be - * chained. - * @since v0.9.1 - */ - unref(): this; - /** - * Tells the kernel to join a source-specific multicast channel at the given `sourceAddress` and `groupAddress`, using the `multicastInterface` with the `IP_ADD_SOURCE_MEMBERSHIP` socket - * option. If the `multicastInterface` argument - * is not specified, the operating system will choose one interface and will add - * membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface. - * - * When called on an unbound socket, this method will implicitly bind to a random - * port, listening on all interfaces. - * @since v13.1.0, v12.16.0 - */ - addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; - /** - * Instructs the kernel to leave a source-specific multicast channel at the given `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` socket option. This method is - * automatically called by the kernel when the - * socket is closed or the process terminates, so most apps will never have - * reason to call this. - * - * If `multicastInterface` is not specified, the operating system will attempt to - * drop membership on all valid interfaces. - * @since v13.1.0, v12.16.0 - */ - dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. error - * 4. listening - * 5. message - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit(event: "message", msg: NonSharedBuffer, rinfo: RemoteInfo): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this; - /** - * Calls `socket.close()` and returns a promise that fulfills when the socket has closed. - * @since v20.5.0 - */ - [Symbol.asyncDispose](): Promise; - } -} -declare module "node:dgram" { - export * from "dgram"; -} diff --git a/node_modules/@types/node/diagnostics_channel.d.ts b/node_modules/@types/node/diagnostics_channel.d.ts deleted file mode 100644 index f3bac52..0000000 --- a/node_modules/@types/node/diagnostics_channel.d.ts +++ /dev/null @@ -1,578 +0,0 @@ -/** - * The `node:diagnostics_channel` module provides an API to create named channels - * to report arbitrary message data for diagnostics purposes. - * - * It can be accessed using: - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * ``` - * - * It is intended that a module writer wanting to report diagnostics messages - * will create one or many top-level channels to report messages through. - * Channels may also be acquired at runtime but it is not encouraged - * due to the additional overhead of doing so. Channels may be exported for - * convenience, but as long as the name is known it can be acquired anywhere. - * - * If you intend for your module to produce diagnostics data for others to - * consume it is recommended that you include documentation of what named - * channels are used along with the shape of the message data. Channel names - * should generally include the module name to avoid collisions with data from - * other modules. - * @since v15.1.0, v14.17.0 - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/diagnostics_channel.js) - */ -declare module "diagnostics_channel" { - import { AsyncLocalStorage } from "node:async_hooks"; - /** - * Check if there are active subscribers to the named channel. This is helpful if - * the message you want to send might be expensive to prepare. - * - * This API is optional but helpful when trying to publish messages from very - * performance-sensitive code. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * if (diagnostics_channel.hasSubscribers('my-channel')) { - * // There are subscribers, prepare and publish message - * } - * ``` - * @since v15.1.0, v14.17.0 - * @param name The channel name - * @return If there are active subscribers - */ - function hasSubscribers(name: string | symbol): boolean; - /** - * This is the primary entry-point for anyone wanting to publish to a named - * channel. It produces a channel object which is optimized to reduce overhead at - * publish time as much as possible. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * ``` - * @since v15.1.0, v14.17.0 - * @param name The channel name - * @return The named channel object - */ - function channel(name: string | symbol): Channel; - type ChannelListener = (message: unknown, name: string | symbol) => void; - /** - * Register a message handler to subscribe to this channel. This message handler - * will be run synchronously whenever a message is published to the channel. Any - * errors thrown in the message handler will trigger an `'uncaughtException'`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * diagnostics_channel.subscribe('my-channel', (message, name) => { - * // Received data - * }); - * ``` - * @since v18.7.0, v16.17.0 - * @param name The channel name - * @param onMessage The handler to receive channel messages - */ - function subscribe(name: string | symbol, onMessage: ChannelListener): void; - /** - * Remove a message handler previously registered to this channel with {@link subscribe}. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * function onMessage(message, name) { - * // Received data - * } - * - * diagnostics_channel.subscribe('my-channel', onMessage); - * - * diagnostics_channel.unsubscribe('my-channel', onMessage); - * ``` - * @since v18.7.0, v16.17.0 - * @param name The channel name - * @param onMessage The previous subscribed handler to remove - * @return `true` if the handler was found, `false` otherwise. - */ - function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean; - /** - * Creates a `TracingChannel` wrapper for the given `TracingChannel Channels`. If a name is given, the corresponding tracing - * channels will be created in the form of `tracing:${name}:${eventType}` where `eventType` corresponds to the types of `TracingChannel Channels`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channelsByName = diagnostics_channel.tracingChannel('my-channel'); - * - * // or... - * - * const channelsByCollection = diagnostics_channel.tracingChannel({ - * start: diagnostics_channel.channel('tracing:my-channel:start'), - * end: diagnostics_channel.channel('tracing:my-channel:end'), - * asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'), - * asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'), - * error: diagnostics_channel.channel('tracing:my-channel:error'), - * }); - * ``` - * @since v19.9.0 - * @experimental - * @param nameOrChannels Channel name or object containing all the `TracingChannel Channels` - * @return Collection of channels to trace with - */ - function tracingChannel< - StoreType = unknown, - ContextType extends object = StoreType extends object ? StoreType : object, - >( - nameOrChannels: string | TracingChannelCollection, - ): TracingChannel; - /** - * The class `Channel` represents an individual named channel within the data - * pipeline. It is used to track subscribers and to publish messages when there - * are subscribers present. It exists as a separate object to avoid channel - * lookups at publish time, enabling very fast publish speeds and allowing - * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly - * with `new Channel(name)` is not supported. - * @since v15.1.0, v14.17.0 - */ - class Channel { - readonly name: string | symbol; - /** - * Check if there are active subscribers to this channel. This is helpful if - * the message you want to send might be expensive to prepare. - * - * This API is optional but helpful when trying to publish messages from very - * performance-sensitive code. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * if (channel.hasSubscribers) { - * // There are subscribers, prepare and publish message - * } - * ``` - * @since v15.1.0, v14.17.0 - */ - readonly hasSubscribers: boolean; - private constructor(name: string | symbol); - /** - * Publish a message to any subscribers to the channel. This will trigger - * message handlers synchronously so they will execute within the same context. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * channel.publish({ - * some: 'message', - * }); - * ``` - * @since v15.1.0, v14.17.0 - * @param message The message to send to the channel subscribers - */ - publish(message: unknown): void; - /** - * Register a message handler to subscribe to this channel. This message handler - * will be run synchronously whenever a message is published to the channel. Any - * errors thrown in the message handler will trigger an `'uncaughtException'`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * channel.subscribe((message, name) => { - * // Received data - * }); - * ``` - * @since v15.1.0, v14.17.0 - * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)} - * @param onMessage The handler to receive channel messages - */ - subscribe(onMessage: ChannelListener): void; - /** - * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * function onMessage(message, name) { - * // Received data - * } - * - * channel.subscribe(onMessage); - * - * channel.unsubscribe(onMessage); - * ``` - * @since v15.1.0, v14.17.0 - * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)} - * @param onMessage The previous subscribed handler to remove - * @return `true` if the handler was found, `false` otherwise. - */ - unsubscribe(onMessage: ChannelListener): void; - /** - * When `channel.runStores(context, ...)` is called, the given context data - * will be applied to any store bound to the channel. If the store has already been - * bound the previous `transform` function will be replaced with the new one. - * The `transform` function may be omitted to set the given context data as the - * context directly. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * import { AsyncLocalStorage } from 'node:async_hooks'; - * - * const store = new AsyncLocalStorage(); - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * channel.bindStore(store, (data) => { - * return { data }; - * }); - * ``` - * @since v19.9.0 - * @experimental - * @param store The store to which to bind the context data - * @param transform Transform context data before setting the store context - */ - bindStore(store: AsyncLocalStorage, transform?: (context: ContextType) => StoreType): void; - /** - * Remove a message handler previously registered to this channel with `channel.bindStore(store)`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * import { AsyncLocalStorage } from 'node:async_hooks'; - * - * const store = new AsyncLocalStorage(); - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * channel.bindStore(store); - * channel.unbindStore(store); - * ``` - * @since v19.9.0 - * @experimental - * @param store The store to unbind from the channel. - * @return `true` if the store was found, `false` otherwise. - */ - unbindStore(store: AsyncLocalStorage): boolean; - /** - * Applies the given data to any AsyncLocalStorage instances bound to the channel - * for the duration of the given function, then publishes to the channel within - * the scope of that data is applied to the stores. - * - * If a transform function was given to `channel.bindStore(store)` it will be - * applied to transform the message data before it becomes the context value for - * the store. The prior storage context is accessible from within the transform - * function in cases where context linking is required. - * - * The context applied to the store should be accessible in any async code which - * continues from execution which began during the given function, however - * there are some situations in which `context loss` may occur. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * import { AsyncLocalStorage } from 'node:async_hooks'; - * - * const store = new AsyncLocalStorage(); - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * channel.bindStore(store, (message) => { - * const parent = store.getStore(); - * return new Span(message, parent); - * }); - * channel.runStores({ some: 'message' }, () => { - * store.getStore(); // Span({ some: 'message' }) - * }); - * ``` - * @since v19.9.0 - * @experimental - * @param context Message to send to subscribers and bind to stores - * @param fn Handler to run within the entered storage context - * @param thisArg The receiver to be used for the function call. - * @param args Optional arguments to pass to the function. - */ - runStores( - context: ContextType, - fn: (this: ThisArg, ...args: Args) => Result, - thisArg?: ThisArg, - ...args: Args - ): Result; - } - interface TracingChannelSubscribers { - start: (message: ContextType) => void; - end: ( - message: ContextType & { - error?: unknown; - result?: unknown; - }, - ) => void; - asyncStart: ( - message: ContextType & { - error?: unknown; - result?: unknown; - }, - ) => void; - asyncEnd: ( - message: ContextType & { - error?: unknown; - result?: unknown; - }, - ) => void; - error: ( - message: ContextType & { - error: unknown; - }, - ) => void; - } - interface TracingChannelCollection { - start: Channel; - end: Channel; - asyncStart: Channel; - asyncEnd: Channel; - error: Channel; - } - /** - * The class `TracingChannel` is a collection of `TracingChannel Channels` which - * together express a single traceable action. It is used to formalize and - * simplify the process of producing events for tracing application flow. {@link tracingChannel} is used to construct a `TracingChannel`. As with `Channel` it is recommended to create and reuse a - * single `TracingChannel` at the top-level of the file rather than creating them - * dynamically. - * @since v19.9.0 - * @experimental - */ - class TracingChannel implements TracingChannelCollection { - start: Channel; - end: Channel; - asyncStart: Channel; - asyncEnd: Channel; - error: Channel; - /** - * Helper to subscribe a collection of functions to the corresponding channels. - * This is the same as calling `channel.subscribe(onMessage)` on each channel - * individually. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channels = diagnostics_channel.tracingChannel('my-channel'); - * - * channels.subscribe({ - * start(message) { - * // Handle start message - * }, - * end(message) { - * // Handle end message - * }, - * asyncStart(message) { - * // Handle asyncStart message - * }, - * asyncEnd(message) { - * // Handle asyncEnd message - * }, - * error(message) { - * // Handle error message - * }, - * }); - * ``` - * @since v19.9.0 - * @experimental - * @param subscribers Set of `TracingChannel Channels` subscribers - */ - subscribe(subscribers: TracingChannelSubscribers): void; - /** - * Helper to unsubscribe a collection of functions from the corresponding channels. - * This is the same as calling `channel.unsubscribe(onMessage)` on each channel - * individually. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channels = diagnostics_channel.tracingChannel('my-channel'); - * - * channels.unsubscribe({ - * start(message) { - * // Handle start message - * }, - * end(message) { - * // Handle end message - * }, - * asyncStart(message) { - * // Handle asyncStart message - * }, - * asyncEnd(message) { - * // Handle asyncEnd message - * }, - * error(message) { - * // Handle error message - * }, - * }); - * ``` - * @since v19.9.0 - * @experimental - * @param subscribers Set of `TracingChannel Channels` subscribers - * @return `true` if all handlers were successfully unsubscribed, and `false` otherwise. - */ - unsubscribe(subscribers: TracingChannelSubscribers): void; - /** - * Trace a synchronous function call. This will always produce a `start event` and `end event` around the execution and may produce an `error event` if the given function throws an error. - * This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all - * events should have any bound stores set to match this trace context. - * - * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions - * which are added after the trace begins will not receive future events from that trace, only future traces will be seen. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channels = diagnostics_channel.tracingChannel('my-channel'); - * - * channels.traceSync(() => { - * // Do something - * }, { - * some: 'thing', - * }); - * ``` - * @since v19.9.0 - * @experimental - * @param fn Function to wrap a trace around - * @param context Shared object to correlate events through - * @param thisArg The receiver to be used for the function call - * @param args Optional arguments to pass to the function - * @return The return value of the given function - */ - traceSync( - fn: (this: ThisArg, ...args: Args) => Result, - context?: ContextType, - thisArg?: ThisArg, - ...args: Args - ): Result; - /** - * Trace a promise-returning function call. This will always produce a `start event` and `end event` around the synchronous portion of the - * function execution, and will produce an `asyncStart event` and `asyncEnd event` when a promise continuation is reached. It may also - * produce an `error event` if the given function throws an error or the - * returned promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all - * events should have any bound stores set to match this trace context. - * - * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions - * which are added after the trace begins will not receive future events from that trace, only future traces will be seen. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channels = diagnostics_channel.tracingChannel('my-channel'); - * - * channels.tracePromise(async () => { - * // Do something - * }, { - * some: 'thing', - * }); - * ``` - * @since v19.9.0 - * @experimental - * @param fn Promise-returning function to wrap a trace around - * @param context Shared object to correlate trace events through - * @param thisArg The receiver to be used for the function call - * @param args Optional arguments to pass to the function - * @return Chained from promise returned by the given function - */ - tracePromise( - fn: (this: ThisArg, ...args: Args) => Promise, - context?: ContextType, - thisArg?: ThisArg, - ...args: Args - ): Promise; - /** - * Trace a callback-receiving function call. This will always produce a `start event` and `end event` around the synchronous portion of the - * function execution, and will produce a `asyncStart event` and `asyncEnd event` around the callback execution. It may also produce an `error event` if the given function throws an error or - * the returned - * promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all - * events should have any bound stores set to match this trace context. - * - * The `position` will be -1 by default to indicate the final argument should - * be used as the callback. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channels = diagnostics_channel.tracingChannel('my-channel'); - * - * channels.traceCallback((arg1, callback) => { - * // Do something - * callback(null, 'result'); - * }, 1, { - * some: 'thing', - * }, thisArg, arg1, callback); - * ``` - * - * The callback will also be run with `channel.runStores(context, ...)` which - * enables context loss recovery in some cases. - * - * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions - * which are added after the trace begins will not receive future events from that trace, only future traces will be seen. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * import { AsyncLocalStorage } from 'node:async_hooks'; - * - * const channels = diagnostics_channel.tracingChannel('my-channel'); - * const myStore = new AsyncLocalStorage(); - * - * // The start channel sets the initial store data to something - * // and stores that store data value on the trace context object - * channels.start.bindStore(myStore, (data) => { - * const span = new Span(data); - * data.span = span; - * return span; - * }); - * - * // Then asyncStart can restore from that data it stored previously - * channels.asyncStart.bindStore(myStore, (data) => { - * return data.span; - * }); - * ``` - * @since v19.9.0 - * @experimental - * @param fn callback using function to wrap a trace around - * @param position Zero-indexed argument position of expected callback - * @param context Shared object to correlate trace events through - * @param thisArg The receiver to be used for the function call - * @param args Optional arguments to pass to the function - * @return The return value of the given function - */ - traceCallback( - fn: (this: ThisArg, ...args: Args) => Result, - position?: number, - context?: ContextType, - thisArg?: ThisArg, - ...args: Args - ): Result; - /** - * `true` if any of the individual channels has a subscriber, `false` if not. - * - * This is a helper method available on a {@link TracingChannel} instance to check - * if any of the [TracingChannel Channels](https://nodejs.org/api/diagnostics_channel.html#tracingchannel-channels) have subscribers. - * A `true` is returned if any of them have at least one subscriber, a `false` is returned otherwise. - * - * ```js - * const diagnostics_channel = require('node:diagnostics_channel'); - * - * const channels = diagnostics_channel.tracingChannel('my-channel'); - * - * if (channels.hasSubscribers) { - * // Do something - * } - * ``` - * @since v22.0.0, v20.13.0 - */ - readonly hasSubscribers: boolean; - } -} -declare module "node:diagnostics_channel" { - export * from "diagnostics_channel"; -} diff --git a/node_modules/@types/node/dns.d.ts b/node_modules/@types/node/dns.d.ts deleted file mode 100644 index 9cb2055..0000000 --- a/node_modules/@types/node/dns.d.ts +++ /dev/null @@ -1,923 +0,0 @@ -/** - * The `node:dns` module enables name resolution. For example, use it to look up IP - * addresses of host names. - * - * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the - * DNS protocol for lookups. {@link lookup} uses the operating system - * facilities to perform name resolution. It may not need to perform any network - * communication. To perform name resolution the way other applications on the same - * system do, use {@link lookup}. - * - * ```js - * import dns from 'node:dns'; - * - * dns.lookup('example.org', (err, address, family) => { - * console.log('address: %j family: IPv%s', address, family); - * }); - * // address: "93.184.216.34" family: IPv4 - * ``` - * - * All other functions in the `node:dns` module connect to an actual DNS server to - * perform name resolution. They will always use the network to perform DNS - * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform - * DNS queries, bypassing other name-resolution facilities. - * - * ```js - * import dns from 'node:dns'; - * - * dns.resolve4('archive.org', (err, addresses) => { - * if (err) throw err; - * - * console.log(`addresses: ${JSON.stringify(addresses)}`); - * - * addresses.forEach((a) => { - * dns.reverse(a, (err, hostnames) => { - * if (err) { - * throw err; - * } - * console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`); - * }); - * }); - * }); - * ``` - * - * See the [Implementation considerations section](https://nodejs.org/docs/latest-v22.x/api/dns.html#implementation-considerations) for more information. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/dns.js) - */ -declare module "dns" { - import * as dnsPromises from "node:dns/promises"; - // Supported getaddrinfo flags. - /** - * Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are - * only returned if the current system has at least one IPv4 address configured. - */ - export const ADDRCONFIG: number; - /** - * If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported - * on some operating systems (e.g. FreeBSD 10.1). - */ - export const V4MAPPED: number; - /** - * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as - * well as IPv4 mapped IPv6 addresses. - */ - export const ALL: number; - export interface LookupOptions { - /** - * The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted - * as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used - * with `{ all: true } (see below)`, both IPv4 and IPv6 addresses are returned. - * @default 0 - */ - family?: number | "IPv4" | "IPv6" | undefined; - /** - * One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v22.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be - * passed by bitwise `OR`ing their values. - */ - hints?: number | undefined; - /** - * When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address. - * @default false - */ - all?: boolean | undefined; - /** - * When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted - * by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6 - * addresses before IPv4 addresses. Default value is configurable using - * {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). - * @default `verbatim` (addresses are not reordered) - * @since v22.1.0 - */ - order?: "ipv4first" | "ipv6first" | "verbatim" | undefined; - /** - * When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4 - * addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified, - * `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder} - * @default true (addresses are not reordered) - * @deprecated Please use `order` option - */ - verbatim?: boolean | undefined; - } - export interface LookupOneOptions extends LookupOptions { - all?: false | undefined; - } - export interface LookupAllOptions extends LookupOptions { - all: true; - } - export interface LookupAddress { - /** - * A string representation of an IPv4 or IPv6 address. - */ - address: string; - /** - * `4` or `6`, denoting the family of `address`, or `0` if the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a - * bug in the name resolution service used by the operating system. - */ - family: number; - } - /** - * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or - * AAAA (IPv6) record. All `option` properties are optional. If `options` is an - * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then - * IPv4 and IPv6 addresses are both returned if found. - * - * With the `all` option set to `true`, the arguments for `callback` change to `(err, addresses)`, with `addresses` being an array of objects with the - * properties `address` and `family`. - * - * On error, `err` is an `Error` object, where `err.code` is the error code. - * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when - * the host name does not exist but also when the lookup fails in other ways - * such as no available file descriptors. - * - * `dns.lookup()` does not necessarily have anything to do with the DNS protocol. - * The implementation uses an operating system facility that can associate names - * with addresses and vice versa. This implementation can have subtle but - * important consequences on the behavior of any Node.js program. Please take some - * time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v22.x/api/dns.html#implementation-considerations) - * before using `dns.lookup()`. - * - * Example usage: - * - * ```js - * import dns from 'node:dns'; - * const options = { - * family: 6, - * hints: dns.ADDRCONFIG | dns.V4MAPPED, - * }; - * dns.lookup('example.com', options, (err, address, family) => - * console.log('address: %j family: IPv%s', address, family)); - * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 - * - * // When options.all is true, the result will be an Array. - * options.all = true; - * dns.lookup('example.com', options, (err, addresses) => - * console.log('addresses: %j', addresses)); - * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] - * ``` - * - * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v22.x/api/util.html#utilpromisifyoriginal) ed - * version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties. - * @since v0.1.90 - */ - export function lookup( - hostname: string, - family: number, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ): void; - export function lookup( - hostname: string, - options: LookupOneOptions, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ): void; - export function lookup( - hostname: string, - options: LookupAllOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void, - ): void; - export function lookup( - hostname: string, - options: LookupOptions, - callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void, - ): void; - export function lookup( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ): void; - export namespace lookup { - function __promisify__(hostname: string, options: LookupAllOptions): Promise; - function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise; - function __promisify__(hostname: string, options: LookupOptions): Promise; - } - /** - * Resolves the given `address` and `port` into a host name and service using - * the operating system's underlying `getnameinfo` implementation. - * - * If `address` is not a valid IP address, a `TypeError` will be thrown. - * The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown. - * - * On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, - * where `err.code` is the error code. - * - * ```js - * import dns from 'node:dns'; - * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { - * console.log(hostname, service); - * // Prints: localhost ssh - * }); - * ``` - * - * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v22.x/api/util.html#utilpromisifyoriginal) ed - * version, it returns a `Promise` for an `Object` with `hostname` and `service` properties. - * @since v0.11.14 - */ - export function lookupService( - address: string, - port: number, - callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void, - ): void; - export namespace lookupService { - function __promisify__( - address: string, - port: number, - ): Promise<{ - hostname: string; - service: string; - }>; - } - export interface ResolveOptions { - ttl: boolean; - } - export interface ResolveWithTtlOptions extends ResolveOptions { - ttl: true; - } - export interface RecordWithTtl { - address: string; - ttl: number; - } - /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */ - export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; - export interface AnyARecord extends RecordWithTtl { - type: "A"; - } - export interface AnyAaaaRecord extends RecordWithTtl { - type: "AAAA"; - } - export interface CaaRecord { - critical: number; - issue?: string | undefined; - issuewild?: string | undefined; - iodef?: string | undefined; - contactemail?: string | undefined; - contactphone?: string | undefined; - } - export interface AnyCaaRecord extends CaaRecord { - type: "CAA"; - } - export interface MxRecord { - priority: number; - exchange: string; - } - export interface AnyMxRecord extends MxRecord { - type: "MX"; - } - export interface NaptrRecord { - flags: string; - service: string; - regexp: string; - replacement: string; - order: number; - preference: number; - } - export interface AnyNaptrRecord extends NaptrRecord { - type: "NAPTR"; - } - export interface SoaRecord { - nsname: string; - hostmaster: string; - serial: number; - refresh: number; - retry: number; - expire: number; - minttl: number; - } - export interface AnySoaRecord extends SoaRecord { - type: "SOA"; - } - export interface SrvRecord { - priority: number; - weight: number; - port: number; - name: string; - } - export interface AnySrvRecord extends SrvRecord { - type: "SRV"; - } - export interface TlsaRecord { - certUsage: number; - selector: number; - match: number; - data: ArrayBuffer; - } - export interface AnyTlsaRecord extends TlsaRecord { - type: "TLSA"; - } - export interface AnyTxtRecord { - type: "TXT"; - entries: string[]; - } - export interface AnyNsRecord { - type: "NS"; - value: string; - } - export interface AnyPtrRecord { - type: "PTR"; - value: string; - } - export interface AnyCnameRecord { - type: "CNAME"; - value: string; - } - export type AnyRecord = - | AnyARecord - | AnyAaaaRecord - | AnyCaaRecord - | AnyCnameRecord - | AnyMxRecord - | AnyNaptrRecord - | AnyNsRecord - | AnyPtrRecord - | AnySoaRecord - | AnySrvRecord - | AnyTlsaRecord - | AnyTxtRecord; - /** - * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array - * of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource - * records. The type and structure of individual results varies based on `rrtype`: - * - * - * - * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, - * where `err.code` is one of the `DNS error codes`. - * @since v0.1.27 - * @param hostname Host name to resolve. - * @param [rrtype='A'] Resource record type. - */ - export function resolve( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "ANY", - callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "CAA", - callback: (err: NodeJS.ErrnoException | null, address: CaaRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "MX", - callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "NAPTR", - callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "SOA", - callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "SRV", - callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "TLSA", - callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "TXT", - callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: string, - callback: ( - err: NodeJS.ErrnoException | null, - addresses: - | string[] - | CaaRecord[] - | MxRecord[] - | NaptrRecord[] - | SoaRecord - | SrvRecord[] - | TlsaRecord[] - | string[][] - | AnyRecord[], - ) => void, - ): void; - export namespace resolve { - function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; - function __promisify__(hostname: string, rrtype: "ANY"): Promise; - function __promisify__(hostname: string, rrtype: "CAA"): Promise; - function __promisify__(hostname: string, rrtype: "MX"): Promise; - function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; - function __promisify__(hostname: string, rrtype: "SOA"): Promise; - function __promisify__(hostname: string, rrtype: "SRV"): Promise; - function __promisify__(hostname: string, rrtype: "TLSA"): Promise; - function __promisify__(hostname: string, rrtype: "TXT"): Promise; - function __promisify__( - hostname: string, - rrtype: string, - ): Promise< - | string[] - | CaaRecord[] - | MxRecord[] - | NaptrRecord[] - | SoaRecord - | SrvRecord[] - | TlsaRecord[] - | string[][] - | AnyRecord[] - >; - } - /** - * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function - * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`). - * @since v0.1.16 - * @param hostname Host name to resolve. - */ - export function resolve4( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve4( - hostname: string, - options: ResolveWithTtlOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, - ): void; - export function resolve4( - hostname: string, - options: ResolveOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, - ): void; - export namespace resolve4 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - /** - * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function - * will contain an array of IPv6 addresses. - * @since v0.1.16 - * @param hostname Host name to resolve. - */ - export function resolve6( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve6( - hostname: string, - options: ResolveWithTtlOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, - ): void; - export function resolve6( - hostname: string, - options: ResolveOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, - ): void; - export namespace resolve6 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - /** - * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function - * will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`). - * @since v0.3.2 - */ - export function resolveCname( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export namespace resolveCname { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The `addresses` argument passed to the `callback` function - * will contain an array of certification authority authorization records - * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`). - * @since v15.0.0, v14.17.0 - */ - export function resolveCaa( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void, - ): void; - export namespace resolveCaa { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will - * contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). - * @since v0.1.27 - */ - export function resolveMx( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, - ): void; - export namespace resolveMx { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of - * objects with the following properties: - * - * * `flags` - * * `service` - * * `regexp` - * * `replacement` - * * `order` - * * `preference` - * - * ```js - * { - * flags: 's', - * service: 'SIP+D2U', - * regexp: '', - * replacement: '_sip._udp.example.com', - * order: 30, - * preference: 100 - * } - * ``` - * @since v0.9.12 - */ - export function resolveNaptr( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, - ): void; - export namespace resolveNaptr { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will - * contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`). - * @since v0.1.90 - */ - export function resolveNs( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export namespace resolveNs { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will - * be an array of strings containing the reply records. - * @since v6.0.0 - */ - export function resolvePtr( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export namespace resolvePtr { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for - * the `hostname`. The `address` argument passed to the `callback` function will - * be an object with the following properties: - * - * * `nsname` - * * `hostmaster` - * * `serial` - * * `refresh` - * * `retry` - * * `expire` - * * `minttl` - * - * ```js - * { - * nsname: 'ns.example.com', - * hostmaster: 'root.example.com', - * serial: 2013101809, - * refresh: 10000, - * retry: 2400, - * expire: 604800, - * minttl: 3600 - * } - * ``` - * @since v0.11.10 - */ - export function resolveSoa( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void, - ): void; - export namespace resolveSoa { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will - * be an array of objects with the following properties: - * - * * `priority` - * * `weight` - * * `port` - * * `name` - * - * ```js - * { - * priority: 10, - * weight: 5, - * port: 21223, - * name: 'service.example.com' - * } - * ``` - * @since v0.1.27 - */ - export function resolveSrv( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, - ): void; - export namespace resolveSrv { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve certificate associations (`TLSA` records) for - * the `hostname`. The `records` argument passed to the `callback` function is an - * array of objects with these properties: - * - * * `certUsage` - * * `selector` - * * `match` - * * `data` - * - * ```js - * { - * certUsage: 3, - * selector: 1, - * match: 1, - * data: [ArrayBuffer] - * } - * ``` - * @since v22.15.0 - */ - export function resolveTlsa( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void, - ): void; - export namespace resolveTlsa { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a - * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of - * one record. Depending on the use case, these could be either joined together or - * treated separately. - * @since v0.1.27 - */ - export function resolveTxt( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, - ): void; - export namespace resolveTxt { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). - * The `ret` argument passed to the `callback` function will be an array containing - * various types of records. Each object has a property `type` that indicates the - * type of the current record. And depending on the `type`, additional properties - * will be present on the object: - * - * - * - * Here is an example of the `ret` object passed to the callback: - * - * ```js - * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, - * { type: 'CNAME', value: 'example.com' }, - * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, - * { type: 'NS', value: 'ns1.example.com' }, - * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, - * { type: 'SOA', - * nsname: 'ns1.example.com', - * hostmaster: 'admin.example.com', - * serial: 156696742, - * refresh: 900, - * retry: 900, - * expire: 1800, - * minttl: 60 } ] - * ``` - * - * DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see - * [RFC 8482](https://tools.ietf.org/html/rfc8482). - */ - export function resolveAny( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, - ): void; - export namespace resolveAny { - function __promisify__(hostname: string): Promise; - } - /** - * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an - * array of host names. - * - * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, where `err.code` is - * one of the [DNS error codes](https://nodejs.org/docs/latest-v22.x/api/dns.html#error-codes). - * @since v0.1.16 - */ - export function reverse( - ip: string, - callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void, - ): void; - /** - * Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options). - * The value could be: - * - * * `ipv4first`: for `order` defaulting to `ipv4first`. - * * `ipv6first`: for `order` defaulting to `ipv6first`. - * * `verbatim`: for `order` defaulting to `verbatim`. - * @since v18.17.0 - */ - export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim"; - /** - * Sets the IP address and port of servers to be used when performing DNS - * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted - * addresses. If the port is the IANA default DNS port (53) it can be omitted. - * - * ```js - * dns.setServers([ - * '4.4.4.4', - * '[2001:4860:4860::8888]', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ]); - * ``` - * - * An error will be thrown if an invalid address is provided. - * - * The `dns.setServers()` method must not be called while a DNS query is in - * progress. - * - * The {@link setServers} method affects only {@link resolve}, `dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}). - * - * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). - * That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with - * subsequent servers provided. Fallback DNS servers will only be used if the - * earlier ones time out or result in some other error. - * @since v0.11.3 - * @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses - */ - export function setServers(servers: readonly string[]): void; - /** - * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), - * that are currently configured for DNS resolution. A string will include a port - * section if a custom port is used. - * - * ```js - * [ - * '4.4.4.4', - * '2001:4860:4860::8888', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ] - * ``` - * @since v0.11.3 - */ - export function getServers(): string[]; - /** - * Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options). - * The value could be: - * - * * `ipv4first`: sets default `order` to `ipv4first`. - * * `ipv6first`: sets default `order` to `ipv6first`. - * * `verbatim`: sets default `order` to `verbatim`. - * - * The default is `verbatim` and {@link setDefaultResultOrder} have higher - * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). When using - * [worker threads](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main - * thread won't affect the default dns orders in workers. - * @since v16.4.0, v14.18.0 - * @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`. - */ - export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void; - // Error codes - export const NODATA: "ENODATA"; - export const FORMERR: "EFORMERR"; - export const SERVFAIL: "ESERVFAIL"; - export const NOTFOUND: "ENOTFOUND"; - export const NOTIMP: "ENOTIMP"; - export const REFUSED: "EREFUSED"; - export const BADQUERY: "EBADQUERY"; - export const BADNAME: "EBADNAME"; - export const BADFAMILY: "EBADFAMILY"; - export const BADRESP: "EBADRESP"; - export const CONNREFUSED: "ECONNREFUSED"; - export const TIMEOUT: "ETIMEOUT"; - export const EOF: "EOF"; - export const FILE: "EFILE"; - export const NOMEM: "ENOMEM"; - export const DESTRUCTION: "EDESTRUCTION"; - export const BADSTR: "EBADSTR"; - export const BADFLAGS: "EBADFLAGS"; - export const NONAME: "ENONAME"; - export const BADHINTS: "EBADHINTS"; - export const NOTINITIALIZED: "ENOTINITIALIZED"; - export const LOADIPHLPAPI: "ELOADIPHLPAPI"; - export const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS"; - export const CANCELLED: "ECANCELLED"; - export interface ResolverOptions { - /** - * Query timeout in milliseconds, or `-1` to use the default timeout. - */ - timeout?: number | undefined; - /** - * The number of tries the resolver will try contacting each name server before giving up. - * @default 4 - */ - tries?: number | undefined; - /** - * The max retry timeout, in milliseconds. - * @default 0 - */ - maxTimeout?: number | undefined; - } - /** - * An independent resolver for DNS requests. - * - * Creating a new resolver uses the default server settings. Setting - * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnssetserversservers) does not affect - * other resolvers: - * - * ```js - * import { Resolver } from 'node:dns'; - * const resolver = new Resolver(); - * resolver.setServers(['4.4.4.4']); - * - * // This request will use the server at 4.4.4.4, independent of global settings. - * resolver.resolve4('example.org', (err, addresses) => { - * // ... - * }); - * ``` - * - * The following methods from the `node:dns` module are available: - * - * * `resolver.getServers()` - * * `resolver.resolve()` - * * `resolver.resolve4()` - * * `resolver.resolve6()` - * * `resolver.resolveAny()` - * * `resolver.resolveCaa()` - * * `resolver.resolveCname()` - * * `resolver.resolveMx()` - * * `resolver.resolveNaptr()` - * * `resolver.resolveNs()` - * * `resolver.resolvePtr()` - * * `resolver.resolveSoa()` - * * `resolver.resolveSrv()` - * * `resolver.resolveTxt()` - * * `resolver.reverse()` - * * `resolver.setServers()` - * @since v8.3.0 - */ - export class Resolver { - constructor(options?: ResolverOptions); - /** - * Cancel all outstanding DNS queries made by this resolver. The corresponding - * callbacks will be called with an error with code `ECANCELLED`. - * @since v8.3.0 - */ - cancel(): void; - getServers: typeof getServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCaa: typeof resolveCaa; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTlsa: typeof resolveTlsa; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - /** - * The resolver instance will send its requests from the specified IP address. - * This allows programs to specify outbound interfaces when used on multi-homed - * systems. - * - * If a v4 or v6 address is not specified, it is set to the default and the - * operating system will choose a local address automatically. - * - * The resolver will use the v4 local address when making requests to IPv4 DNS - * servers, and the v6 local address when making requests to IPv6 DNS servers. - * The `rrtype` of resolution requests has no impact on the local address used. - * @since v15.1.0, v14.17.0 - * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address. - * @param [ipv6='::0'] A string representation of an IPv6 address. - */ - setLocalAddress(ipv4?: string, ipv6?: string): void; - setServers: typeof setServers; - } - export { dnsPromises as promises }; -} -declare module "node:dns" { - export * from "dns"; -} diff --git a/node_modules/@types/node/dns/promises.d.ts b/node_modules/@types/node/dns/promises.d.ts deleted file mode 100644 index a7ba9bb..0000000 --- a/node_modules/@types/node/dns/promises.d.ts +++ /dev/null @@ -1,503 +0,0 @@ -/** - * The `dns.promises` API provides an alternative set of asynchronous DNS methods - * that return `Promise` objects rather than using callbacks. The API is accessible - * via `import { promises as dnsPromises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`. - * @since v10.6.0 - */ -declare module "dns/promises" { - import { - AnyRecord, - CaaRecord, - LookupAddress, - LookupAllOptions, - LookupOneOptions, - LookupOptions, - MxRecord, - NaptrRecord, - RecordWithTtl, - ResolveOptions, - ResolverOptions, - ResolveWithTtlOptions, - SoaRecord, - SrvRecord, - TlsaRecord, - } from "node:dns"; - /** - * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), - * that are currently configured for DNS resolution. A string will include a port - * section if a custom port is used. - * - * ```js - * [ - * '4.4.4.4', - * '2001:4860:4860::8888', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ] - * ``` - * @since v10.6.0 - */ - function getServers(): string[]; - /** - * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or - * AAAA (IPv6) record. All `option` properties are optional. If `options` is an - * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4 - * and IPv6 addresses are both returned if found. - * - * With the `all` option set to `true`, the `Promise` is resolved with `addresses` being an array of objects with the properties `address` and `family`. - * - * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code. - * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when - * the host name does not exist but also when the lookup fails in other ways - * such as no available file descriptors. - * - * [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options) does not necessarily have anything to do with the DNS - * protocol. The implementation uses an operating system facility that can - * associate names with addresses and vice versa. This implementation can have - * subtle but important consequences on the behavior of any Node.js program. Please - * take some time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) before - * using `dnsPromises.lookup()`. - * - * Example usage: - * - * ```js - * import dns from 'node:dns'; - * const dnsPromises = dns.promises; - * const options = { - * family: 6, - * hints: dns.ADDRCONFIG | dns.V4MAPPED, - * }; - * - * dnsPromises.lookup('example.com', options).then((result) => { - * console.log('address: %j family: IPv%s', result.address, result.family); - * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 - * }); - * - * // When options.all is true, the result will be an Array. - * options.all = true; - * dnsPromises.lookup('example.com', options).then((result) => { - * console.log('addresses: %j', result); - * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] - * }); - * ``` - * @since v10.6.0 - */ - function lookup(hostname: string, family: number): Promise; - function lookup(hostname: string, options: LookupOneOptions): Promise; - function lookup(hostname: string, options: LookupAllOptions): Promise; - function lookup(hostname: string, options: LookupOptions): Promise; - function lookup(hostname: string): Promise; - /** - * Resolves the given `address` and `port` into a host name and service using - * the operating system's underlying `getnameinfo` implementation. - * - * If `address` is not a valid IP address, a `TypeError` will be thrown. - * The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown. - * - * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code. - * - * ```js - * import dnsPromises from 'node:dns'; - * dnsPromises.lookupService('127.0.0.1', 22).then((result) => { - * console.log(result.hostname, result.service); - * // Prints: localhost ssh - * }); - * ``` - * @since v10.6.0 - */ - function lookupService( - address: string, - port: number, - ): Promise<{ - hostname: string; - service: string; - }>; - /** - * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array - * of the resource records. When successful, the `Promise` is resolved with an - * array of resource records. The type and structure of individual results vary - * based on `rrtype`: - * - * - * - * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` - * is one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes). - * @since v10.6.0 - * @param hostname Host name to resolve. - * @param [rrtype='A'] Resource record type. - */ - function resolve(hostname: string): Promise; - function resolve(hostname: string, rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; - function resolve(hostname: string, rrtype: "ANY"): Promise; - function resolve(hostname: string, rrtype: "CAA"): Promise; - function resolve(hostname: string, rrtype: "MX"): Promise; - function resolve(hostname: string, rrtype: "NAPTR"): Promise; - function resolve(hostname: string, rrtype: "SOA"): Promise; - function resolve(hostname: string, rrtype: "SRV"): Promise; - function resolve(hostname: string, rrtype: "TLSA"): Promise; - function resolve(hostname: string, rrtype: "TXT"): Promise; - function resolve(hostname: string, rrtype: string): Promise< - | string[] - | CaaRecord[] - | MxRecord[] - | NaptrRecord[] - | SoaRecord - | SrvRecord[] - | TlsaRecord[] - | string[][] - | AnyRecord[] - >; - /** - * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4 - * addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`). - * @since v10.6.0 - * @param hostname Host name to resolve. - */ - function resolve4(hostname: string): Promise; - function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve4(hostname: string, options: ResolveOptions): Promise; - /** - * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv6 - * addresses. - * @since v10.6.0 - * @param hostname Host name to resolve. - */ - function resolve6(hostname: string): Promise; - function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve6(hostname: string, options: ResolveOptions): Promise; - /** - * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). - * On success, the `Promise` is resolved with an array containing various types of - * records. Each object has a property `type` that indicates the type of the - * current record. And depending on the `type`, additional properties will be - * present on the object: - * - * - * - * Here is an example of the result object: - * - * ```js - * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, - * { type: 'CNAME', value: 'example.com' }, - * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, - * { type: 'NS', value: 'ns1.example.com' }, - * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, - * { type: 'SOA', - * nsname: 'ns1.example.com', - * hostmaster: 'admin.example.com', - * serial: 156696742, - * refresh: 900, - * retry: 900, - * expire: 1800, - * minttl: 60 } ] - * ``` - * @since v10.6.0 - */ - function resolveAny(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success, - * the `Promise` is resolved with an array of objects containing available - * certification authority authorization records available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`). - * @since v15.0.0, v14.17.0 - */ - function resolveCaa(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success, - * the `Promise` is resolved with an array of canonical name records available for - * the `hostname` (e.g. `['bar.example.com']`). - * @since v10.6.0 - */ - function resolveCname(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects - * containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`). - * @since v10.6.0 - */ - function resolveMx(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. On success, the `Promise` is resolved with an array - * of objects with the following properties: - * - * * `flags` - * * `service` - * * `regexp` - * * `replacement` - * * `order` - * * `preference` - * - * ```js - * { - * flags: 's', - * service: 'SIP+D2U', - * regexp: '', - * replacement: '_sip._udp.example.com', - * order: 30, - * preference: 100 - * } - * ``` - * @since v10.6.0 - */ - function resolveNaptr(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. On success, the `Promise` is resolved with an array of name server - * records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`). - * @since v10.6.0 - */ - function resolveNs(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. On success, the `Promise` is resolved with an array of strings - * containing the reply records. - * @since v10.6.0 - */ - function resolvePtr(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for - * the `hostname`. On success, the `Promise` is resolved with an object with the - * following properties: - * - * * `nsname` - * * `hostmaster` - * * `serial` - * * `refresh` - * * `retry` - * * `expire` - * * `minttl` - * - * ```js - * { - * nsname: 'ns.example.com', - * hostmaster: 'root.example.com', - * serial: 2013101809, - * refresh: 10000, - * retry: 2400, - * expire: 604800, - * minttl: 3600 - * } - * ``` - * @since v10.6.0 - */ - function resolveSoa(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects with - * the following properties: - * - * * `priority` - * * `weight` - * * `port` - * * `name` - * - * ```js - * { - * priority: 10, - * weight: 5, - * port: 21223, - * name: 'service.example.com' - * } - * ``` - * @since v10.6.0 - */ - function resolveSrv(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve certificate associations (`TLSA` records) for - * the `hostname`. On success, the `Promise` is resolved with an array of objectsAdd commentMore actions - * with these properties: - * - * * `certUsage` - * * `selector` - * * `match` - * * `data` - * - * ```js - * { - * certUsage: 3, - * selector: 1, - * match: 1, - * data: [ArrayBuffer] - * } - * ``` - * @since v22.15.0 - */ - function resolveTlsa(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a two-dimensional array - * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of - * one record. Depending on the use case, these could be either joined together or - * treated separately. - * @since v10.6.0 - */ - function resolveTxt(hostname: string): Promise; - /** - * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an - * array of host names. - * - * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` - * is one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes). - * @since v10.6.0 - */ - function reverse(ip: string): Promise; - /** - * Get the default value for `verbatim` in {@link lookup} and [dnsPromises.lookup()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options). - * The value could be: - * - * * `ipv4first`: for `verbatim` defaulting to `false`. - * * `verbatim`: for `verbatim` defaulting to `true`. - * @since v20.1.0 - */ - function getDefaultResultOrder(): "ipv4first" | "verbatim"; - /** - * Sets the IP address and port of servers to be used when performing DNS - * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted - * addresses. If the port is the IANA default DNS port (53) it can be omitted. - * - * ```js - * dnsPromises.setServers([ - * '4.4.4.4', - * '[2001:4860:4860::8888]', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ]); - * ``` - * - * An error will be thrown if an invalid address is provided. - * - * The `dnsPromises.setServers()` method must not be called while a DNS query is in - * progress. - * - * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). - * That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with - * subsequent servers provided. Fallback DNS servers will only be used if the - * earlier ones time out or result in some other error. - * @since v10.6.0 - * @param servers array of `RFC 5952` formatted addresses - */ - function setServers(servers: readonly string[]): void; - /** - * Set the default value of `order` in `dns.lookup()` and `{@link lookup}`. The value could be: - * - * * `ipv4first`: sets default `order` to `ipv4first`. - * * `ipv6first`: sets default `order` to `ipv6first`. - * * `verbatim`: sets default `order` to `verbatim`. - * - * The default is `verbatim` and [dnsPromises.setDefaultResultOrder()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder) - * have higher priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder). - * When using [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), [`dnsPromises.setDefaultResultOrder()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder) - * from the main thread won't affect the default dns orders in workers. - * @since v16.4.0, v14.18.0 - * @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`. - */ - function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void; - // Error codes - const NODATA: "ENODATA"; - const FORMERR: "EFORMERR"; - const SERVFAIL: "ESERVFAIL"; - const NOTFOUND: "ENOTFOUND"; - const NOTIMP: "ENOTIMP"; - const REFUSED: "EREFUSED"; - const BADQUERY: "EBADQUERY"; - const BADNAME: "EBADNAME"; - const BADFAMILY: "EBADFAMILY"; - const BADRESP: "EBADRESP"; - const CONNREFUSED: "ECONNREFUSED"; - const TIMEOUT: "ETIMEOUT"; - const EOF: "EOF"; - const FILE: "EFILE"; - const NOMEM: "ENOMEM"; - const DESTRUCTION: "EDESTRUCTION"; - const BADSTR: "EBADSTR"; - const BADFLAGS: "EBADFLAGS"; - const NONAME: "ENONAME"; - const BADHINTS: "EBADHINTS"; - const NOTINITIALIZED: "ENOTINITIALIZED"; - const LOADIPHLPAPI: "ELOADIPHLPAPI"; - const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS"; - const CANCELLED: "ECANCELLED"; - - /** - * An independent resolver for DNS requests. - * - * Creating a new resolver uses the default server settings. Setting - * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetserversservers) does not affect - * other resolvers: - * - * ```js - * import { promises } from 'node:dns'; - * const resolver = new promises.Resolver(); - * resolver.setServers(['4.4.4.4']); - * - * // This request will use the server at 4.4.4.4, independent of global settings. - * resolver.resolve4('example.org').then((addresses) => { - * // ... - * }); - * - * // Alternatively, the same code can be written using async-await style. - * (async function() { - * const addresses = await resolver.resolve4('example.org'); - * })(); - * ``` - * - * The following methods from the `dnsPromises` API are available: - * - * * `resolver.getServers()` - * * `resolver.resolve()` - * * `resolver.resolve4()` - * * `resolver.resolve6()` - * * `resolver.resolveAny()` - * * `resolver.resolveCaa()` - * * `resolver.resolveCname()` - * * `resolver.resolveMx()` - * * `resolver.resolveNaptr()` - * * `resolver.resolveNs()` - * * `resolver.resolvePtr()` - * * `resolver.resolveSoa()` - * * `resolver.resolveSrv()` - * * `resolver.resolveTxt()` - * * `resolver.reverse()` - * * `resolver.setServers()` - * @since v10.6.0 - */ - class Resolver { - constructor(options?: ResolverOptions); - /** - * Cancel all outstanding DNS queries made by this resolver. The corresponding - * callbacks will be called with an error with code `ECANCELLED`. - * @since v8.3.0 - */ - cancel(): void; - getServers: typeof getServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCaa: typeof resolveCaa; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTlsa: typeof resolveTlsa; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - /** - * The resolver instance will send its requests from the specified IP address. - * This allows programs to specify outbound interfaces when used on multi-homed - * systems. - * - * If a v4 or v6 address is not specified, it is set to the default and the - * operating system will choose a local address automatically. - * - * The resolver will use the v4 local address when making requests to IPv4 DNS - * servers, and the v6 local address when making requests to IPv6 DNS servers. - * The `rrtype` of resolution requests has no impact on the local address used. - * @since v15.1.0, v14.17.0 - * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address. - * @param [ipv6='::0'] A string representation of an IPv6 address. - */ - setLocalAddress(ipv4?: string, ipv6?: string): void; - setServers: typeof setServers; - } -} -declare module "node:dns/promises" { - export * from "dns/promises"; -} diff --git a/node_modules/@types/node/domain.d.ts b/node_modules/@types/node/domain.d.ts deleted file mode 100644 index ba8a02c..0000000 --- a/node_modules/@types/node/domain.d.ts +++ /dev/null @@ -1,170 +0,0 @@ -/** - * **This module is pending deprecation.** Once a replacement API has been - * finalized, this module will be fully deprecated. Most developers should - * **not** have cause to use this module. Users who absolutely must have - * the functionality that domains provide may rely on it for the time being - * but should expect to have to migrate to a different solution - * in the future. - * - * Domains provide a way to handle multiple different IO operations as a - * single group. If any of the event emitters or callbacks registered to a - * domain emit an `'error'` event, or throw an error, then the domain object - * will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to - * exit immediately with an error code. - * @deprecated Since v1.4.2 - Deprecated - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/domain.js) - */ -declare module "domain" { - import EventEmitter = require("node:events"); - /** - * The `Domain` class encapsulates the functionality of routing errors and - * uncaught exceptions to the active `Domain` object. - * - * To handle the errors that it catches, listen to its `'error'` event. - */ - class Domain extends EventEmitter { - /** - * An array of timers and event emitters that have been explicitly added - * to the domain. - */ - members: Array; - /** - * The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly - * pushes the domain onto the domain - * stack managed by the domain module (see {@link exit} for details on the - * domain stack). The call to `enter()` delimits the beginning of a chain of - * asynchronous calls and I/O operations bound to a domain. - * - * Calling `enter()` changes only the active domain, and does not alter the domain - * itself. `enter()` and `exit()` can be called an arbitrary number of times on a - * single domain. - */ - enter(): void; - /** - * The `exit()` method exits the current domain, popping it off the domain stack. - * Any time execution is going to switch to the context of a different chain of - * asynchronous calls, it's important to ensure that the current domain is exited. - * The call to `exit()` delimits either the end of or an interruption to the chain - * of asynchronous calls and I/O operations bound to a domain. - * - * If there are multiple, nested domains bound to the current execution context, `exit()` will exit any domains nested within this domain. - * - * Calling `exit()` changes only the active domain, and does not alter the domain - * itself. `enter()` and `exit()` can be called an arbitrary number of times on a - * single domain. - */ - exit(): void; - /** - * Run the supplied function in the context of the domain, implicitly - * binding all event emitters, timers, and low-level requests that are - * created in that context. Optionally, arguments can be passed to - * the function. - * - * This is the most basic way to use a domain. - * - * ```js - * import domain from 'node:domain'; - * import fs from 'node:fs'; - * const d = domain.create(); - * d.on('error', (er) => { - * console.error('Caught error!', er); - * }); - * d.run(() => { - * process.nextTick(() => { - * setTimeout(() => { // Simulating some various async stuff - * fs.open('non-existent file', 'r', (er, fd) => { - * if (er) throw er; - * // proceed... - * }); - * }, 100); - * }); - * }); - * ``` - * - * In this example, the `d.on('error')` handler will be triggered, rather - * than crashing the program. - */ - run(fn: (...args: any[]) => T, ...args: any[]): T; - /** - * Explicitly adds an emitter to the domain. If any event handlers called by - * the emitter throw an error, or if the emitter emits an `'error'` event, it - * will be routed to the domain's `'error'` event, just like with implicit - * binding. - * - * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by - * the domain `'error'` handler. - * - * If the Timer or `EventEmitter` was already bound to a domain, it is removed - * from that one, and bound to this one instead. - * @param emitter emitter or timer to be added to the domain - */ - add(emitter: EventEmitter | NodeJS.Timer): void; - /** - * The opposite of {@link add}. Removes domain handling from the - * specified emitter. - * @param emitter emitter or timer to be removed from the domain - */ - remove(emitter: EventEmitter | NodeJS.Timer): void; - /** - * The returned function will be a wrapper around the supplied callback - * function. When the returned function is called, any errors that are - * thrown will be routed to the domain's `'error'` event. - * - * ```js - * const d = domain.create(); - * - * function readSomeFile(filename, cb) { - * fs.readFile(filename, 'utf8', d.bind((er, data) => { - * // If this throws, it will also be passed to the domain. - * return cb(er, data ? JSON.parse(data) : null); - * })); - * } - * - * d.on('error', (er) => { - * // An error occurred somewhere. If we throw it now, it will crash the program - * // with the normal line number and stack message. - * }); - * ``` - * @param callback The callback function - * @return The bound function - */ - bind(callback: T): T; - /** - * This method is almost identical to {@link bind}. However, in - * addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function. - * - * In this way, the common `if (err) return callback(err);` pattern can be replaced - * with a single error handler in a single place. - * - * ```js - * const d = domain.create(); - * - * function readSomeFile(filename, cb) { - * fs.readFile(filename, 'utf8', d.intercept((data) => { - * // Note, the first argument is never passed to the - * // callback since it is assumed to be the 'Error' argument - * // and thus intercepted by the domain. - * - * // If this throws, it will also be passed to the domain - * // so the error-handling logic can be moved to the 'error' - * // event on the domain instead of being repeated throughout - * // the program. - * return cb(null, JSON.parse(data)); - * })); - * } - * - * d.on('error', (er) => { - * // An error occurred somewhere. If we throw it now, it will crash the program - * // with the normal line number and stack message. - * }); - * ``` - * @param callback The callback function - * @return The intercepted function - */ - intercept(callback: T): T; - } - function create(): Domain; -} -declare module "node:domain" { - export * from "domain"; -} diff --git a/node_modules/@types/node/events.d.ts b/node_modules/@types/node/events.d.ts deleted file mode 100644 index c336a28..0000000 --- a/node_modules/@types/node/events.d.ts +++ /dev/null @@ -1,976 +0,0 @@ -/** - * Much of the Node.js core API is built around an idiomatic asynchronous - * event-driven architecture in which certain kinds of objects (called "emitters") - * emit named events that cause `Function` objects ("listeners") to be called. - * - * For instance: a `net.Server` object emits an event each time a peer - * connects to it; a `fs.ReadStream` emits an event when the file is opened; - * a `stream` emits an event whenever data is available to be read. - * - * All objects that emit events are instances of the `EventEmitter` class. These - * objects expose an `eventEmitter.on()` function that allows one or more - * functions to be attached to named events emitted by the object. Typically, - * event names are camel-cased strings but any valid JavaScript property key - * can be used. - * - * When the `EventEmitter` object emits an event, all of the functions attached - * to that specific event are called _synchronously_. Any values returned by the - * called listeners are _ignored_ and discarded. - * - * The following example shows a simple `EventEmitter` instance with a single - * listener. The `eventEmitter.on()` method is used to register listeners, while - * the `eventEmitter.emit()` method is used to trigger the event. - * - * ```js - * import { EventEmitter } from 'node:events'; - * - * class MyEmitter extends EventEmitter {} - * - * const myEmitter = new MyEmitter(); - * myEmitter.on('event', () => { - * console.log('an event occurred!'); - * }); - * myEmitter.emit('event'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/events.js) - */ -declare module "events" { - import { AsyncResource, AsyncResourceOptions } from "node:async_hooks"; - interface EventEmitterOptions { - /** - * Enables automatic capturing of promise rejection. - */ - captureRejections?: boolean | undefined; - } - interface StaticEventEmitterOptions { - /** - * Can be used to cancel awaiting events. - */ - signal?: AbortSignal | undefined; - } - interface StaticEventEmitterIteratorOptions extends StaticEventEmitterOptions { - /** - * Names of events that will end the iteration. - */ - close?: string[] | undefined; - /** - * The high watermark. The emitter is paused every time the size of events being buffered is higher than it. - * Supported only on emitters implementing `pause()` and `resume()` methods. - * @default Number.MAX_SAFE_INTEGER - */ - highWaterMark?: number | undefined; - /** - * The low watermark. The emitter is resumed every time the size of events being buffered is lower than it. - * Supported only on emitters implementing `pause()` and `resume()` methods. - * @default 1 - */ - lowWaterMark?: number | undefined; - } - interface EventEmitter = DefaultEventMap> extends NodeJS.EventEmitter {} - type EventMap = Record | DefaultEventMap; - type DefaultEventMap = [never]; - type AnyRest = [...args: any[]]; - type Args = T extends DefaultEventMap ? AnyRest : ( - K extends keyof T ? T[K] : never - ); - type Key = T extends DefaultEventMap ? string | symbol : K | keyof T; - type Key2 = T extends DefaultEventMap ? string | symbol : K & keyof T; - type Listener = T extends DefaultEventMap ? F : ( - K extends keyof T ? ( - T[K] extends unknown[] ? (...args: T[K]) => void : never - ) - : never - ); - type Listener1 = Listener void>; - type Listener2 = Listener; - - /** - * The `EventEmitter` class is defined and exposed by the `node:events` module: - * - * ```js - * import { EventEmitter } from 'node:events'; - * ``` - * - * All `EventEmitter`s emit the event `'newListener'` when new listeners are - * added and `'removeListener'` when existing listeners are removed. - * - * It supports the following option: - * @since v0.1.26 - */ - class EventEmitter = DefaultEventMap> { - constructor(options?: EventEmitterOptions); - - [EventEmitter.captureRejectionSymbol]?(error: Error, event: Key, ...args: Args): void; - - /** - * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given - * event or that is rejected if the `EventEmitter` emits `'error'` while waiting. - * The `Promise` will resolve with an array of all the arguments emitted to the - * given event. - * - * This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event - * semantics and does not listen to the `'error'` event. - * - * ```js - * import { once, EventEmitter } from 'node:events'; - * import process from 'node:process'; - * - * const ee = new EventEmitter(); - * - * process.nextTick(() => { - * ee.emit('myevent', 42); - * }); - * - * const [value] = await once(ee, 'myevent'); - * console.log(value); - * - * const err = new Error('kaboom'); - * process.nextTick(() => { - * ee.emit('error', err); - * }); - * - * try { - * await once(ee, 'myevent'); - * } catch (err) { - * console.error('error happened', err); - * } - * ``` - * - * The special handling of the `'error'` event is only used when `events.once()` is used to wait for another event. If `events.once()` is used to wait for the - * '`error'` event itself, then it is treated as any other kind of event without - * special handling: - * - * ```js - * import { EventEmitter, once } from 'node:events'; - * - * const ee = new EventEmitter(); - * - * once(ee, 'error') - * .then(([err]) => console.log('ok', err.message)) - * .catch((err) => console.error('error', err.message)); - * - * ee.emit('error', new Error('boom')); - * - * // Prints: ok boom - * ``` - * - * An `AbortSignal` can be used to cancel waiting for the event: - * - * ```js - * import { EventEmitter, once } from 'node:events'; - * - * const ee = new EventEmitter(); - * const ac = new AbortController(); - * - * async function foo(emitter, event, signal) { - * try { - * await once(emitter, event, { signal }); - * console.log('event emitted!'); - * } catch (error) { - * if (error.name === 'AbortError') { - * console.error('Waiting for the event was canceled!'); - * } else { - * console.error('There was an error', error.message); - * } - * } - * } - * - * foo(ee, 'foo', ac.signal); - * ac.abort(); // Abort waiting for the event - * ee.emit('foo'); // Prints: Waiting for the event was canceled! - * ``` - * @since v11.13.0, v10.16.0 - */ - static once( - emitter: NodeJS.EventEmitter, - eventName: string | symbol, - options?: StaticEventEmitterOptions, - ): Promise; - static once(emitter: EventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise; - /** - * ```js - * import { on, EventEmitter } from 'node:events'; - * import process from 'node:process'; - * - * const ee = new EventEmitter(); - * - * // Emit later on - * process.nextTick(() => { - * ee.emit('foo', 'bar'); - * ee.emit('foo', 42); - * }); - * - * for await (const event of on(ee, 'foo')) { - * // The execution of this inner block is synchronous and it - * // processes one event at a time (even with await). Do not use - * // if concurrent execution is required. - * console.log(event); // prints ['bar'] [42] - * } - * // Unreachable here - * ``` - * - * Returns an `AsyncIterator` that iterates `eventName` events. It will throw - * if the `EventEmitter` emits `'error'`. It removes all listeners when - * exiting the loop. The `value` returned by each iteration is an array - * composed of the emitted event arguments. - * - * An `AbortSignal` can be used to cancel waiting on events: - * - * ```js - * import { on, EventEmitter } from 'node:events'; - * import process from 'node:process'; - * - * const ac = new AbortController(); - * - * (async () => { - * const ee = new EventEmitter(); - * - * // Emit later on - * process.nextTick(() => { - * ee.emit('foo', 'bar'); - * ee.emit('foo', 42); - * }); - * - * for await (const event of on(ee, 'foo', { signal: ac.signal })) { - * // The execution of this inner block is synchronous and it - * // processes one event at a time (even with await). Do not use - * // if concurrent execution is required. - * console.log(event); // prints ['bar'] [42] - * } - * // Unreachable here - * })(); - * - * process.nextTick(() => ac.abort()); - * ``` - * - * Use the `close` option to specify an array of event names that will end the iteration: - * - * ```js - * import { on, EventEmitter } from 'node:events'; - * import process from 'node:process'; - * - * const ee = new EventEmitter(); - * - * // Emit later on - * process.nextTick(() => { - * ee.emit('foo', 'bar'); - * ee.emit('foo', 42); - * ee.emit('close'); - * }); - * - * for await (const event of on(ee, 'foo', { close: ['close'] })) { - * console.log(event); // prints ['bar'] [42] - * } - * // the loop will exit after 'close' is emitted - * console.log('done'); // prints 'done' - * ``` - * @since v13.6.0, v12.16.0 - * @return An `AsyncIterator` that iterates `eventName` events emitted by the `emitter` - */ - static on( - emitter: NodeJS.EventEmitter, - eventName: string | symbol, - options?: StaticEventEmitterIteratorOptions, - ): NodeJS.AsyncIterator; - static on( - emitter: EventTarget, - eventName: string, - options?: StaticEventEmitterIteratorOptions, - ): NodeJS.AsyncIterator; - /** - * A class method that returns the number of listeners for the given `eventName` registered on the given `emitter`. - * - * ```js - * import { EventEmitter, listenerCount } from 'node:events'; - * - * const myEmitter = new EventEmitter(); - * myEmitter.on('event', () => {}); - * myEmitter.on('event', () => {}); - * console.log(listenerCount(myEmitter, 'event')); - * // Prints: 2 - * ``` - * @since v0.9.12 - * @deprecated Since v3.2.0 - Use `listenerCount` instead. - * @param emitter The emitter to query - * @param eventName The event name - */ - static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number; - /** - * Returns a copy of the array of listeners for the event named `eventName`. - * - * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on - * the emitter. - * - * For `EventTarget`s this is the only way to get the event listeners for the - * event target. This is useful for debugging and diagnostic purposes. - * - * ```js - * import { getEventListeners, EventEmitter } from 'node:events'; - * - * { - * const ee = new EventEmitter(); - * const listener = () => console.log('Events are fun'); - * ee.on('foo', listener); - * console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ] - * } - * { - * const et = new EventTarget(); - * const listener = () => console.log('Events are fun'); - * et.addEventListener('foo', listener); - * console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ] - * } - * ``` - * @since v15.2.0, v14.17.0 - */ - static getEventListeners(emitter: EventTarget | NodeJS.EventEmitter, name: string | symbol): Function[]; - /** - * Returns the currently set max amount of listeners. - * - * For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on - * the emitter. - * - * For `EventTarget`s this is the only way to get the max event listeners for the - * event target. If the number of event handlers on a single EventTarget exceeds - * the max set, the EventTarget will print a warning. - * - * ```js - * import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events'; - * - * { - * const ee = new EventEmitter(); - * console.log(getMaxListeners(ee)); // 10 - * setMaxListeners(11, ee); - * console.log(getMaxListeners(ee)); // 11 - * } - * { - * const et = new EventTarget(); - * console.log(getMaxListeners(et)); // 10 - * setMaxListeners(11, et); - * console.log(getMaxListeners(et)); // 11 - * } - * ``` - * @since v19.9.0 - */ - static getMaxListeners(emitter: EventTarget | NodeJS.EventEmitter): number; - /** - * ```js - * import { setMaxListeners, EventEmitter } from 'node:events'; - * - * const target = new EventTarget(); - * const emitter = new EventEmitter(); - * - * setMaxListeners(5, target, emitter); - * ``` - * @since v15.4.0 - * @param n A non-negative number. The maximum number of listeners per `EventTarget` event. - * @param eventTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter} - * objects. - */ - static setMaxListeners(n?: number, ...eventTargets: Array): void; - /** - * Listens once to the `abort` event on the provided `signal`. - * - * Listening to the `abort` event on abort signals is unsafe and may - * lead to resource leaks since another third party with the signal can - * call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change - * this since it would violate the web standard. Additionally, the original - * API makes it easy to forget to remove listeners. - * - * This API allows safely using `AbortSignal`s in Node.js APIs by solving these - * two issues by listening to the event such that `stopImmediatePropagation` does - * not prevent the listener from running. - * - * Returns a disposable so that it may be unsubscribed from more easily. - * - * ```js - * import { addAbortListener } from 'node:events'; - * - * function example(signal) { - * let disposable; - * try { - * signal.addEventListener('abort', (e) => e.stopImmediatePropagation()); - * disposable = addAbortListener(signal, (e) => { - * // Do something when signal is aborted. - * }); - * } finally { - * disposable?.[Symbol.dispose](); - * } - * } - * ``` - * @since v20.5.0 - * @return Disposable that removes the `abort` listener. - */ - static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable; - /** - * This symbol shall be used to install a listener for only monitoring `'error'` events. Listeners installed using this symbol are called before the regular `'error'` listeners are called. - * - * Installing a listener using this symbol does not change the behavior once an `'error'` event is emitted. Therefore, the process will still crash if no - * regular `'error'` listener is installed. - * @since v13.6.0, v12.17.0 - */ - static readonly errorMonitor: unique symbol; - /** - * Value: `Symbol.for('nodejs.rejection')` - * - * See how to write a custom `rejection handler`. - * @since v13.4.0, v12.16.0 - */ - static readonly captureRejectionSymbol: unique symbol; - /** - * Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) - * - * Change the default `captureRejections` option on all new `EventEmitter` objects. - * @since v13.4.0, v12.16.0 - */ - static captureRejections: boolean; - /** - * By default, a maximum of `10` listeners can be registered for any single - * event. This limit can be changed for individual `EventEmitter` instances - * using the `emitter.setMaxListeners(n)` method. To change the default - * for _all_`EventEmitter` instances, the `events.defaultMaxListeners` property - * can be used. If this value is not a positive number, a `RangeError` is thrown. - * - * Take caution when setting the `events.defaultMaxListeners` because the - * change affects _all_ `EventEmitter` instances, including those created before - * the change is made. However, calling `emitter.setMaxListeners(n)` still has - * precedence over `events.defaultMaxListeners`. - * - * This is not a hard limit. The `EventEmitter` instance will allow - * more listeners to be added but will output a trace warning to stderr indicating - * that a "possible EventEmitter memory leak" has been detected. For any single - * `EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()` methods can be used to - * temporarily avoid this warning: - * - * ```js - * import { EventEmitter } from 'node:events'; - * const emitter = new EventEmitter(); - * emitter.setMaxListeners(emitter.getMaxListeners() + 1); - * emitter.once('event', () => { - * // do stuff - * emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0)); - * }); - * ``` - * - * The `--trace-warnings` command-line flag can be used to display the - * stack trace for such warnings. - * - * The emitted warning can be inspected with `process.on('warning')` and will - * have the additional `emitter`, `type`, and `count` properties, referring to - * the event emitter instance, the event's name and the number of attached - * listeners, respectively. - * Its `name` property is set to `'MaxListenersExceededWarning'`. - * @since v0.11.2 - */ - static defaultMaxListeners: number; - } - import internal = require("node:events"); - namespace EventEmitter { - // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4 - export { internal as EventEmitter }; - export interface Abortable { - /** - * When provided the corresponding `AbortController` can be used to cancel an asynchronous action. - */ - signal?: AbortSignal | undefined; - } - - export interface EventEmitterReferencingAsyncResource extends AsyncResource { - readonly eventEmitter: EventEmitterAsyncResource; - } - - export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions { - /** - * The type of async event, this is required when instantiating `EventEmitterAsyncResource` - * directly rather than as a child class. - * @default new.target.name if instantiated as a child class. - */ - name?: string | undefined; - } - - /** - * Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that - * require manual async tracking. Specifically, all events emitted by instances - * of `events.EventEmitterAsyncResource` will run within its `async context`. - * - * ```js - * import { EventEmitterAsyncResource, EventEmitter } from 'node:events'; - * import { notStrictEqual, strictEqual } from 'node:assert'; - * import { executionAsyncId, triggerAsyncId } from 'node:async_hooks'; - * - * // Async tracking tooling will identify this as 'Q'. - * const ee1 = new EventEmitterAsyncResource({ name: 'Q' }); - * - * // 'foo' listeners will run in the EventEmitters async context. - * ee1.on('foo', () => { - * strictEqual(executionAsyncId(), ee1.asyncId); - * strictEqual(triggerAsyncId(), ee1.triggerAsyncId); - * }); - * - * const ee2 = new EventEmitter(); - * - * // 'foo' listeners on ordinary EventEmitters that do not track async - * // context, however, run in the same async context as the emit(). - * ee2.on('foo', () => { - * notStrictEqual(executionAsyncId(), ee2.asyncId); - * notStrictEqual(triggerAsyncId(), ee2.triggerAsyncId); - * }); - * - * Promise.resolve().then(() => { - * ee1.emit('foo'); - * ee2.emit('foo'); - * }); - * ``` - * - * The `EventEmitterAsyncResource` class has the same methods and takes the - * same options as `EventEmitter` and `AsyncResource` themselves. - * @since v17.4.0, v16.14.0 - */ - export class EventEmitterAsyncResource extends EventEmitter { - /** - * @param options Only optional in child class. - */ - constructor(options?: EventEmitterAsyncResourceOptions); - /** - * Call all `destroy` hooks. This should only ever be called once. An error will - * be thrown if it is called more than once. This **must** be manually called. If - * the resource is left to be collected by the GC then the `destroy` hooks will - * never be called. - */ - emitDestroy(): void; - /** - * The unique `asyncId` assigned to the resource. - */ - readonly asyncId: number; - /** - * The same triggerAsyncId that is passed to the AsyncResource constructor. - */ - readonly triggerAsyncId: number; - /** - * The returned `AsyncResource` object has an additional `eventEmitter` property - * that provides a reference to this `EventEmitterAsyncResource`. - */ - readonly asyncResource: EventEmitterReferencingAsyncResource; - } - /** - * The `NodeEventTarget` is a Node.js-specific extension to `EventTarget` - * that emulates a subset of the `EventEmitter` API. - * @since v14.5.0 - */ - export interface NodeEventTarget extends EventTarget { - /** - * Node.js-specific extension to the `EventTarget` class that emulates the - * equivalent `EventEmitter` API. The only difference between `addListener()` and - * `addEventListener()` is that `addListener()` will return a reference to the - * `EventTarget`. - * @since v14.5.0 - */ - addListener(type: string, listener: (arg: any) => void): this; - /** - * Node.js-specific extension to the `EventTarget` class that dispatches the - * `arg` to the list of handlers for `type`. - * @since v15.2.0 - * @returns `true` if event listeners registered for the `type` exist, - * otherwise `false`. - */ - emit(type: string, arg: any): boolean; - /** - * Node.js-specific extension to the `EventTarget` class that returns an array - * of event `type` names for which event listeners are registered. - * @since 14.5.0 - */ - eventNames(): string[]; - /** - * Node.js-specific extension to the `EventTarget` class that returns the number - * of event listeners registered for the `type`. - * @since v14.5.0 - */ - listenerCount(type: string): number; - /** - * Node.js-specific extension to the `EventTarget` class that sets the number - * of max event listeners as `n`. - * @since v14.5.0 - */ - setMaxListeners(n: number): void; - /** - * Node.js-specific extension to the `EventTarget` class that returns the number - * of max event listeners. - * @since v14.5.0 - */ - getMaxListeners(): number; - /** - * Node.js-specific alias for `eventTarget.removeEventListener()`. - * @since v14.5.0 - */ - off(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this; - /** - * Node.js-specific alias for `eventTarget.addEventListener()`. - * @since v14.5.0 - */ - on(type: string, listener: (arg: any) => void): this; - /** - * Node.js-specific extension to the `EventTarget` class that adds a `once` - * listener for the given event `type`. This is equivalent to calling `on` - * with the `once` option set to `true`. - * @since v14.5.0 - */ - once(type: string, listener: (arg: any) => void): this; - /** - * Node.js-specific extension to the `EventTarget` class. If `type` is specified, - * removes all registered listeners for `type`, otherwise removes all registered - * listeners. - * @since v14.5.0 - */ - removeAllListeners(type?: string): this; - /** - * Node.js-specific extension to the `EventTarget` class that removes the - * `listener` for the given `type`. The only difference between `removeListener()` - * and `removeEventListener()` is that `removeListener()` will return a reference - * to the `EventTarget`. - * @since v14.5.0 - */ - removeListener(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this; - } - } - global { - namespace NodeJS { - interface EventEmitter = DefaultEventMap> { - [EventEmitter.captureRejectionSymbol]?(error: Error, event: Key, ...args: Args): void; - /** - * Alias for `emitter.on(eventName, listener)`. - * @since v0.1.26 - */ - addListener(eventName: Key, listener: Listener1): this; - /** - * Adds the `listener` function to the end of the listeners array for the event - * named `eventName`. No checks are made to see if the `listener` has already - * been added. Multiple calls passing the same combination of `eventName` and - * `listener` will result in the `listener` being added, and called, multiple times. - * - * ```js - * server.on('connection', (stream) => { - * console.log('someone connected!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * - * By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the - * event listener to the beginning of the listeners array. - * - * ```js - * import { EventEmitter } from 'node:events'; - * const myEE = new EventEmitter(); - * myEE.on('foo', () => console.log('a')); - * myEE.prependListener('foo', () => console.log('b')); - * myEE.emit('foo'); - * // Prints: - * // b - * // a - * ``` - * @since v0.1.101 - * @param eventName The name of the event. - * @param listener The callback function - */ - on(eventName: Key, listener: Listener1): this; - /** - * Adds a **one-time** `listener` function for the event named `eventName`. The - * next time `eventName` is triggered, this listener is removed and then invoked. - * - * ```js - * server.once('connection', (stream) => { - * console.log('Ah, we have our first user!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * - * By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the - * event listener to the beginning of the listeners array. - * - * ```js - * import { EventEmitter } from 'node:events'; - * const myEE = new EventEmitter(); - * myEE.once('foo', () => console.log('a')); - * myEE.prependOnceListener('foo', () => console.log('b')); - * myEE.emit('foo'); - * // Prints: - * // b - * // a - * ``` - * @since v0.3.0 - * @param eventName The name of the event. - * @param listener The callback function - */ - once(eventName: Key, listener: Listener1): this; - /** - * Removes the specified `listener` from the listener array for the event named `eventName`. - * - * ```js - * const callback = (stream) => { - * console.log('someone connected!'); - * }; - * server.on('connection', callback); - * // ... - * server.removeListener('connection', callback); - * ``` - * - * `removeListener()` will remove, at most, one instance of a listener from the - * listener array. If any single listener has been added multiple times to the - * listener array for the specified `eventName`, then `removeListener()` must be - * called multiple times to remove each instance. - * - * Once an event is emitted, all listeners attached to it at the - * time of emitting are called in order. This implies that any `removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution - * will not remove them from`emit()` in progress. Subsequent events behave as expected. - * - * ```js - * import { EventEmitter } from 'node:events'; - * class MyEmitter extends EventEmitter {} - * const myEmitter = new MyEmitter(); - * - * const callbackA = () => { - * console.log('A'); - * myEmitter.removeListener('event', callbackB); - * }; - * - * const callbackB = () => { - * console.log('B'); - * }; - * - * myEmitter.on('event', callbackA); - * - * myEmitter.on('event', callbackB); - * - * // callbackA removes listener callbackB but it will still be called. - * // Internal listener array at time of emit [callbackA, callbackB] - * myEmitter.emit('event'); - * // Prints: - * // A - * // B - * - * // callbackB is now removed. - * // Internal listener array [callbackA] - * myEmitter.emit('event'); - * // Prints: - * // A - * ``` - * - * Because listeners are managed using an internal array, calling this will - * change the position indices of any listener registered _after_ the listener - * being removed. This will not impact the order in which listeners are called, - * but it means that any copies of the listener array as returned by - * the `emitter.listeners()` method will need to be recreated. - * - * When a single function has been added as a handler multiple times for a single - * event (as in the example below), `removeListener()` will remove the most - * recently added instance. In the example the `once('ping')` listener is removed: - * - * ```js - * import { EventEmitter } from 'node:events'; - * const ee = new EventEmitter(); - * - * function pong() { - * console.log('pong'); - * } - * - * ee.on('ping', pong); - * ee.once('ping', pong); - * ee.removeListener('ping', pong); - * - * ee.emit('ping'); - * ee.emit('ping'); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v0.1.26 - */ - removeListener(eventName: Key, listener: Listener1): this; - /** - * Alias for `emitter.removeListener()`. - * @since v10.0.0 - */ - off(eventName: Key, listener: Listener1): this; - /** - * Removes all listeners, or those of the specified `eventName`. - * - * It is bad practice to remove listeners added elsewhere in the code, - * particularly when the `EventEmitter` instance was created by some other - * component or module (e.g. sockets or file streams). - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v0.1.26 - */ - removeAllListeners(eventName?: Key): this; - /** - * By default `EventEmitter`s will print a warning if more than `10` listeners are - * added for a particular event. This is a useful default that helps finding - * memory leaks. The `emitter.setMaxListeners()` method allows the limit to be - * modified for this specific `EventEmitter` instance. The value can be set to `Infinity` (or `0`) to indicate an unlimited number of listeners. - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v0.3.5 - */ - setMaxListeners(n: number): this; - /** - * Returns the current max listener value for the `EventEmitter` which is either - * set by `emitter.setMaxListeners(n)` or defaults to {@link EventEmitter.defaultMaxListeners}. - * @since v1.0.0 - */ - getMaxListeners(): number; - /** - * Returns a copy of the array of listeners for the event named `eventName`. - * - * ```js - * server.on('connection', (stream) => { - * console.log('someone connected!'); - * }); - * console.log(util.inspect(server.listeners('connection'))); - * // Prints: [ [Function] ] - * ``` - * @since v0.1.26 - */ - listeners(eventName: Key): Array>; - /** - * Returns a copy of the array of listeners for the event named `eventName`, - * including any wrappers (such as those created by `.once()`). - * - * ```js - * import { EventEmitter } from 'node:events'; - * const emitter = new EventEmitter(); - * emitter.once('log', () => console.log('log once')); - * - * // Returns a new Array with a function `onceWrapper` which has a property - * // `listener` which contains the original listener bound above - * const listeners = emitter.rawListeners('log'); - * const logFnWrapper = listeners[0]; - * - * // Logs "log once" to the console and does not unbind the `once` event - * logFnWrapper.listener(); - * - * // Logs "log once" to the console and removes the listener - * logFnWrapper(); - * - * emitter.on('log', () => console.log('log persistently')); - * // Will return a new Array with a single function bound by `.on()` above - * const newListeners = emitter.rawListeners('log'); - * - * // Logs "log persistently" twice - * newListeners[0](); - * emitter.emit('log'); - * ``` - * @since v9.4.0 - */ - rawListeners(eventName: Key): Array>; - /** - * Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments - * to each. - * - * Returns `true` if the event had listeners, `false` otherwise. - * - * ```js - * import { EventEmitter } from 'node:events'; - * const myEmitter = new EventEmitter(); - * - * // First listener - * myEmitter.on('event', function firstListener() { - * console.log('Helloooo! first listener'); - * }); - * // Second listener - * myEmitter.on('event', function secondListener(arg1, arg2) { - * console.log(`event with parameters ${arg1}, ${arg2} in second listener`); - * }); - * // Third listener - * myEmitter.on('event', function thirdListener(...args) { - * const parameters = args.join(', '); - * console.log(`event with parameters ${parameters} in third listener`); - * }); - * - * console.log(myEmitter.listeners('event')); - * - * myEmitter.emit('event', 1, 2, 3, 4, 5); - * - * // Prints: - * // [ - * // [Function: firstListener], - * // [Function: secondListener], - * // [Function: thirdListener] - * // ] - * // Helloooo! first listener - * // event with parameters 1, 2 in second listener - * // event with parameters 1, 2, 3, 4, 5 in third listener - * ``` - * @since v0.1.26 - */ - emit(eventName: Key, ...args: Args): boolean; - /** - * Returns the number of listeners listening for the event named `eventName`. - * If `listener` is provided, it will return how many times the listener is found - * in the list of the listeners of the event. - * @since v3.2.0 - * @param eventName The name of the event being listened for - * @param listener The event handler function - */ - listenerCount(eventName: Key, listener?: Listener2): number; - /** - * Adds the `listener` function to the _beginning_ of the listeners array for the - * event named `eventName`. No checks are made to see if the `listener` has - * already been added. Multiple calls passing the same combination of `eventName` - * and `listener` will result in the `listener` being added, and called, multiple times. - * - * ```js - * server.prependListener('connection', (stream) => { - * console.log('someone connected!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v6.0.0 - * @param eventName The name of the event. - * @param listener The callback function - */ - prependListener(eventName: Key, listener: Listener1): this; - /** - * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this - * listener is removed, and then invoked. - * - * ```js - * server.prependOnceListener('connection', (stream) => { - * console.log('Ah, we have our first user!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v6.0.0 - * @param eventName The name of the event. - * @param listener The callback function - */ - prependOnceListener(eventName: Key, listener: Listener1): this; - /** - * Returns an array listing the events for which the emitter has registered - * listeners. The values in the array are strings or `Symbol`s. - * - * ```js - * import { EventEmitter } from 'node:events'; - * - * const myEE = new EventEmitter(); - * myEE.on('foo', () => {}); - * myEE.on('bar', () => {}); - * - * const sym = Symbol('symbol'); - * myEE.on(sym, () => {}); - * - * console.log(myEE.eventNames()); - * // Prints: [ 'foo', 'bar', Symbol(symbol) ] - * ``` - * @since v6.0.0 - */ - eventNames(): Array<(string | symbol) & Key2>; - } - } - } - export = EventEmitter; -} -declare module "node:events" { - import events = require("events"); - export = events; -} diff --git a/node_modules/@types/node/fs.d.ts b/node_modules/@types/node/fs.d.ts deleted file mode 100644 index d40515b..0000000 --- a/node_modules/@types/node/fs.d.ts +++ /dev/null @@ -1,4461 +0,0 @@ -/** - * The `node:fs` module enables interacting with the file system in a - * way modeled on standard POSIX functions. - * - * To use the promise-based APIs: - * - * ```js - * import * as fs from 'node:fs/promises'; - * ``` - * - * To use the callback and sync APIs: - * - * ```js - * import * as fs from 'node:fs'; - * ``` - * - * All file system operations have synchronous, callback, and promise-based - * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM). - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/fs.js) - */ -declare module "fs" { - import { NonSharedBuffer } from "node:buffer"; - import * as stream from "node:stream"; - import { Abortable, EventEmitter } from "node:events"; - import { URL } from "node:url"; - import * as promises from "node:fs/promises"; - export { promises }; - /** - * Valid types for path values in "fs". - */ - export type PathLike = string | Buffer | URL; - export type PathOrFileDescriptor = PathLike | number; - export type TimeLike = string | number | Date; - export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void; - export type BufferEncodingOption = - | "buffer" - | { - encoding: "buffer"; - }; - export interface ObjectEncodingOptions { - encoding?: BufferEncoding | null | undefined; - } - export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null; - export type OpenMode = number | string; - export type Mode = number | string; - export interface StatsBase { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - dev: T; - ino: T; - mode: T; - nlink: T; - uid: T; - gid: T; - rdev: T; - size: T; - blksize: T; - blocks: T; - atimeMs: T; - mtimeMs: T; - ctimeMs: T; - birthtimeMs: T; - atime: Date; - mtime: Date; - ctime: Date; - birthtime: Date; - } - export interface Stats extends StatsBase {} - /** - * A `fs.Stats` object provides information about a file. - * - * Objects returned from {@link stat}, {@link lstat}, {@link fstat}, and - * their synchronous counterparts are of this type. - * If `bigint` in the `options` passed to those methods is true, the numeric values - * will be `bigint` instead of `number`, and the object will contain additional - * nanosecond-precision properties suffixed with `Ns`. `Stat` objects are not to be created directly using the `new` keyword. - * - * ```console - * Stats { - * dev: 2114, - * ino: 48064969, - * mode: 33188, - * nlink: 1, - * uid: 85, - * gid: 100, - * rdev: 0, - * size: 527, - * blksize: 4096, - * blocks: 8, - * atimeMs: 1318289051000.1, - * mtimeMs: 1318289051000.1, - * ctimeMs: 1318289051000.1, - * birthtimeMs: 1318289051000.1, - * atime: Mon, 10 Oct 2011 23:24:11 GMT, - * mtime: Mon, 10 Oct 2011 23:24:11 GMT, - * ctime: Mon, 10 Oct 2011 23:24:11 GMT, - * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } - * ``` - * - * `bigint` version: - * - * ```console - * BigIntStats { - * dev: 2114n, - * ino: 48064969n, - * mode: 33188n, - * nlink: 1n, - * uid: 85n, - * gid: 100n, - * rdev: 0n, - * size: 527n, - * blksize: 4096n, - * blocks: 8n, - * atimeMs: 1318289051000n, - * mtimeMs: 1318289051000n, - * ctimeMs: 1318289051000n, - * birthtimeMs: 1318289051000n, - * atimeNs: 1318289051000000000n, - * mtimeNs: 1318289051000000000n, - * ctimeNs: 1318289051000000000n, - * birthtimeNs: 1318289051000000000n, - * atime: Mon, 10 Oct 2011 23:24:11 GMT, - * mtime: Mon, 10 Oct 2011 23:24:11 GMT, - * ctime: Mon, 10 Oct 2011 23:24:11 GMT, - * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } - * ``` - * @since v0.1.21 - */ - export class Stats { - private constructor(); - } - export interface StatsFsBase { - /** Type of file system. */ - type: T; - /** Optimal transfer block size. */ - bsize: T; - /** Total data blocks in file system. */ - blocks: T; - /** Free blocks in file system. */ - bfree: T; - /** Available blocks for unprivileged users */ - bavail: T; - /** Total file nodes in file system. */ - files: T; - /** Free file nodes in file system. */ - ffree: T; - } - export interface StatsFs extends StatsFsBase {} - /** - * Provides information about a mounted file system. - * - * Objects returned from {@link statfs} and its synchronous counterpart are of - * this type. If `bigint` in the `options` passed to those methods is `true`, the - * numeric values will be `bigint` instead of `number`. - * - * ```console - * StatFs { - * type: 1397114950, - * bsize: 4096, - * blocks: 121938943, - * bfree: 61058895, - * bavail: 61058895, - * files: 999, - * ffree: 1000000 - * } - * ``` - * - * `bigint` version: - * - * ```console - * StatFs { - * type: 1397114950n, - * bsize: 4096n, - * blocks: 121938943n, - * bfree: 61058895n, - * bavail: 61058895n, - * files: 999n, - * ffree: 1000000n - * } - * ``` - * @since v19.6.0, v18.15.0 - */ - export class StatsFs {} - export interface BigIntStatsFs extends StatsFsBase {} - export interface StatFsOptions { - bigint?: boolean | undefined; - } - /** - * A representation of a directory entry, which can be a file or a subdirectory - * within the directory, as returned by reading from an `fs.Dir`. The - * directory entry is a combination of the file name and file type pairs. - * - * Additionally, when {@link readdir} or {@link readdirSync} is called with - * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s. - * @since v10.10.0 - */ - export class Dirent { - /** - * Returns `true` if the `fs.Dirent` object describes a regular file. - * @since v10.10.0 - */ - isFile(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a file system - * directory. - * @since v10.10.0 - */ - isDirectory(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a block device. - * @since v10.10.0 - */ - isBlockDevice(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a character device. - * @since v10.10.0 - */ - isCharacterDevice(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a symbolic link. - * @since v10.10.0 - */ - isSymbolicLink(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a first-in-first-out - * (FIFO) pipe. - * @since v10.10.0 - */ - isFIFO(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a socket. - * @since v10.10.0 - */ - isSocket(): boolean; - /** - * The file name that this `fs.Dirent` object refers to. The type of this - * value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}. - * @since v10.10.0 - */ - name: Name; - /** - * The path to the parent directory of the file this `fs.Dirent` object refers to. - * @since v20.12.0, v18.20.0 - */ - parentPath: string; - /** - * Alias for `dirent.parentPath`. - * @since v20.1.0 - * @deprecated Since v20.12.0 - */ - path: string; - } - /** - * A class representing a directory stream. - * - * Created by {@link opendir}, {@link opendirSync}, or `fsPromises.opendir()`. - * - * ```js - * import { opendir } from 'node:fs/promises'; - * - * try { - * const dir = await opendir('./'); - * for await (const dirent of dir) - * console.log(dirent.name); - * } catch (err) { - * console.error(err); - * } - * ``` - * - * When using the async iterator, the `fs.Dir` object will be automatically - * closed after the iterator exits. - * @since v12.12.0 - */ - export class Dir implements AsyncIterable { - /** - * The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`. - * @since v12.12.0 - */ - readonly path: string; - /** - * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read. - */ - [Symbol.asyncIterator](): NodeJS.AsyncIterator; - /** - * Asynchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - * - * A promise is returned that will be fulfilled after the resource has been - * closed. - * @since v12.12.0 - */ - close(): Promise; - close(cb: NoParamCallback): void; - /** - * Synchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - * @since v12.12.0 - */ - closeSync(): void; - /** - * Asynchronously read the next directory entry via [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) as an `fs.Dirent`. - * - * A promise is returned that will be fulfilled with an `fs.Dirent`, or `null` if there are no more directory entries to read. - * - * Directory entries returned by this function are in no particular order as - * provided by the operating system's underlying directory mechanisms. - * Entries added or removed while iterating over the directory might not be - * included in the iteration results. - * @since v12.12.0 - * @return containing {fs.Dirent|null} - */ - read(): Promise; - read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void; - /** - * Synchronously read the next directory entry as an `fs.Dirent`. See the - * POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more detail. - * - * If there are no more directory entries to read, `null` will be returned. - * - * Directory entries returned by this function are in no particular order as - * provided by the operating system's underlying directory mechanisms. - * Entries added or removed while iterating over the directory might not be - * included in the iteration results. - * @since v12.12.0 - */ - readSync(): Dirent | null; - /** - * Calls `dir.close()` if the directory handle is open, and returns a promise that - * fulfills when disposal is complete. - * @since v22.17.0 - * @experimental - */ - [Symbol.asyncDispose](): Promise; - /** - * Calls `dir.closeSync()` if the directory handle is open, and returns - * `undefined`. - * @since v22.17.0 - * @experimental - */ - [Symbol.dispose](): void; - } - /** - * Class: fs.StatWatcher - * @since v14.3.0, v12.20.0 - * Extends `EventEmitter` - * A successful call to {@link watchFile} method will return a new fs.StatWatcher object. - */ - export interface StatWatcher extends EventEmitter { - /** - * When called, requests that the Node.js event loop _not_ exit so long as the `fs.StatWatcher` is active. Calling `watcher.ref()` multiple times will have - * no effect. - * - * By default, all `fs.StatWatcher` objects are "ref'ed", making it normally - * unnecessary to call `watcher.ref()` unless `watcher.unref()` had been - * called previously. - * @since v14.3.0, v12.20.0 - */ - ref(): this; - /** - * When called, the active `fs.StatWatcher` object will not require the Node.js - * event loop to remain active. If there is no other activity keeping the - * event loop running, the process may exit before the `fs.StatWatcher` object's - * callback is invoked. Calling `watcher.unref()` multiple times will have - * no effect. - * @since v14.3.0, v12.20.0 - */ - unref(): this; - } - export interface FSWatcher extends EventEmitter { - /** - * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable. - * @since v0.5.8 - */ - close(): void; - /** - * When called, requests that the Node.js event loop _not_ exit so long as the `fs.FSWatcher` is active. Calling `watcher.ref()` multiple times will have - * no effect. - * - * By default, all `fs.FSWatcher` objects are "ref'ed", making it normally - * unnecessary to call `watcher.ref()` unless `watcher.unref()` had been - * called previously. - * @since v14.3.0, v12.20.0 - */ - ref(): this; - /** - * When called, the active `fs.FSWatcher` object will not require the Node.js - * event loop to remain active. If there is no other activity keeping the - * event loop running, the process may exit before the `fs.FSWatcher` object's - * callback is invoked. Calling `watcher.unref()` multiple times will have - * no effect. - * @since v14.3.0, v12.20.0 - */ - unref(): this; - /** - * events.EventEmitter - * 1. change - * 2. close - * 3. error - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this; - on(event: "close", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this; - once(event: "close", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener( - event: "change", - listener: (eventType: string, filename: string | NonSharedBuffer) => void, - ): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "change", - listener: (eventType: string, filename: string | NonSharedBuffer) => void, - ): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - } - /** - * Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function. - * @since v0.1.93 - */ - export class ReadStream extends stream.Readable { - close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; - /** - * The number of bytes that have been read so far. - * @since v6.4.0 - */ - bytesRead: number; - /** - * The path to the file the stream is reading from as specified in the first - * argument to `fs.createReadStream()`. If `path` is passed as a string, then`readStream.path` will be a string. If `path` is passed as a `Buffer`, then`readStream.path` will be a - * `Buffer`. If `fd` is specified, then`readStream.path` will be `undefined`. - * @since v0.1.93 - */ - path: string | Buffer; - /** - * This property is `true` if the underlying file has not been opened yet, - * i.e. before the `'ready'` event is emitted. - * @since v11.2.0, v10.16.0 - */ - pending: boolean; - /** - * events.EventEmitter - * 1. open - * 2. close - * 3. ready - */ - addListener(event: K, listener: ReadStreamEvents[K]): this; - on(event: K, listener: ReadStreamEvents[K]): this; - once(event: K, listener: ReadStreamEvents[K]): this; - prependListener(event: K, listener: ReadStreamEvents[K]): this; - prependOnceListener(event: K, listener: ReadStreamEvents[K]): this; - } - - /** - * The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted. - */ - type ReadStreamEvents = { - close: () => void; - data: (chunk: Buffer | string) => void; - end: () => void; - error: (err: Error) => void; - open: (fd: number) => void; - pause: () => void; - readable: () => void; - ready: () => void; - resume: () => void; - } & CustomEvents; - - /** - * string & {} allows to allow any kind of strings for the event - * but still allows to have auto completion for the normal events. - */ - type CustomEvents = { [Key in string & {} | symbol]: (...args: any[]) => void }; - - /** - * The Keys are events of the WriteStream and the values are the functions that are called when the event is emitted. - */ - type WriteStreamEvents = { - close: () => void; - drain: () => void; - error: (err: Error) => void; - finish: () => void; - open: (fd: number) => void; - pipe: (src: stream.Readable) => void; - ready: () => void; - unpipe: (src: stream.Readable) => void; - } & CustomEvents; - /** - * * Extends `stream.Writable` - * - * Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function. - * @since v0.1.93 - */ - export class WriteStream extends stream.Writable { - /** - * Closes `writeStream`. Optionally accepts a - * callback that will be executed once the `writeStream`is closed. - * @since v0.9.4 - */ - close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; - /** - * The number of bytes written so far. Does not include data that is still queued - * for writing. - * @since v0.4.7 - */ - bytesWritten: number; - /** - * The path to the file the stream is writing to as specified in the first - * argument to {@link createWriteStream}. If `path` is passed as a string, then`writeStream.path` will be a string. If `path` is passed as a `Buffer`, then`writeStream.path` will be a - * `Buffer`. - * @since v0.1.93 - */ - path: string | Buffer; - /** - * This property is `true` if the underlying file has not been opened yet, - * i.e. before the `'ready'` event is emitted. - * @since v11.2.0 - */ - pending: boolean; - /** - * events.EventEmitter - * 1. open - * 2. close - * 3. ready - */ - addListener(event: K, listener: WriteStreamEvents[K]): this; - on(event: K, listener: WriteStreamEvents[K]): this; - once(event: K, listener: WriteStreamEvents[K]): this; - prependListener(event: K, listener: WriteStreamEvents[K]): this; - prependOnceListener(event: K, listener: WriteStreamEvents[K]): this; - } - /** - * Asynchronously rename file at `oldPath` to the pathname provided - * as `newPath`. In the case that `newPath` already exists, it will - * be overwritten. If there is a directory at `newPath`, an error will - * be raised instead. No arguments other than a possible exception are - * given to the completion callback. - * - * See also: [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html). - * - * ```js - * import { rename } from 'node:fs'; - * - * rename('oldFile.txt', 'newFile.txt', (err) => { - * if (err) throw err; - * console.log('Rename complete!'); - * }); - * ``` - * @since v0.0.2 - */ - export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - export namespace rename { - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(oldPath: PathLike, newPath: PathLike): Promise; - } - /** - * Renames the file from `oldPath` to `newPath`. Returns `undefined`. - * - * See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details. - * @since v0.1.21 - */ - export function renameSync(oldPath: PathLike, newPath: PathLike): void; - /** - * Truncates the file. No arguments other than a possible exception are - * given to the completion callback. A file descriptor can also be passed as the - * first argument. In this case, `fs.ftruncate()` is called. - * - * ```js - * import { truncate } from 'node:fs'; - * // Assuming that 'path/file.txt' is a regular file. - * truncate('path/file.txt', (err) => { - * if (err) throw err; - * console.log('path/file.txt was truncated'); - * }); - * ``` - * - * Passing a file descriptor is deprecated and may result in an error being thrown - * in the future. - * - * See the POSIX [`truncate(2)`](http://man7.org/linux/man-pages/man2/truncate.2.html) documentation for more details. - * @since v0.8.6 - * @param [len=0] - */ - export function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void; - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function truncate(path: PathLike, callback: NoParamCallback): void; - export namespace truncate { - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(path: PathLike, len?: number): Promise; - } - /** - * Truncates the file. Returns `undefined`. A file descriptor can also be - * passed as the first argument. In this case, `fs.ftruncateSync()` is called. - * - * Passing a file descriptor is deprecated and may result in an error being thrown - * in the future. - * @since v0.8.6 - * @param [len=0] - */ - export function truncateSync(path: PathLike, len?: number): void; - /** - * Truncates the file descriptor. No arguments other than a possible exception are - * given to the completion callback. - * - * See the POSIX [`ftruncate(2)`](http://man7.org/linux/man-pages/man2/ftruncate.2.html) documentation for more detail. - * - * If the file referred to by the file descriptor was larger than `len` bytes, only - * the first `len` bytes will be retained in the file. - * - * For example, the following program retains only the first four bytes of the - * file: - * - * ```js - * import { open, close, ftruncate } from 'node:fs'; - * - * function closeFd(fd) { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * - * open('temp.txt', 'r+', (err, fd) => { - * if (err) throw err; - * - * try { - * ftruncate(fd, 4, (err) => { - * closeFd(fd); - * if (err) throw err; - * }); - * } catch (err) { - * closeFd(fd); - * if (err) throw err; - * } - * }); - * ``` - * - * If the file previously was shorter than `len` bytes, it is extended, and the - * extended part is filled with null bytes (`'\0'`): - * - * If `len` is negative then `0` will be used. - * @since v0.8.6 - * @param [len=0] - */ - export function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void; - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - */ - export function ftruncate(fd: number, callback: NoParamCallback): void; - export namespace ftruncate { - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(fd: number, len?: number): Promise; - } - /** - * Truncates the file descriptor. Returns `undefined`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link ftruncate}. - * @since v0.8.6 - * @param [len=0] - */ - export function ftruncateSync(fd: number, len?: number): void; - /** - * Asynchronously changes owner and group of a file. No arguments other than a - * possible exception are given to the completion callback. - * - * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. - * @since v0.1.97 - */ - export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - export namespace chown { - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - /** - * Synchronously changes owner and group of a file. Returns `undefined`. - * This is the synchronous version of {@link chown}. - * - * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. - * @since v0.1.97 - */ - export function chownSync(path: PathLike, uid: number, gid: number): void; - /** - * Sets the owner of the file. No arguments other than a possible exception are - * given to the completion callback. - * - * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. - * @since v0.4.7 - */ - export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; - export namespace fchown { - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - function __promisify__(fd: number, uid: number, gid: number): Promise; - } - /** - * Sets the owner of the file. Returns `undefined`. - * - * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. - * @since v0.4.7 - * @param uid The file's new owner's user id. - * @param gid The file's new group's group id. - */ - export function fchownSync(fd: number, uid: number, gid: number): void; - /** - * Set the owner of the symbolic link. No arguments other than a possible - * exception are given to the completion callback. - * - * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail. - */ - export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - export namespace lchown { - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - /** - * Set the owner for the path. Returns `undefined`. - * - * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more details. - * @param uid The file's new owner's user id. - * @param gid The file's new group's group id. - */ - export function lchownSync(path: PathLike, uid: number, gid: number): void; - /** - * Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic - * link, then the link is not dereferenced: instead, the timestamps of the - * symbolic link itself are changed. - * - * No arguments other than a possible exception are given to the completion - * callback. - * @since v14.5.0, v12.19.0 - */ - export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; - export namespace lutimes { - /** - * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, - * with the difference that if the path refers to a symbolic link, then the link is not - * dereferenced: instead, the timestamps of the symbolic link itself are changed. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - } - /** - * Change the file system timestamps of the symbolic link referenced by `path`. - * Returns `undefined`, or throws an exception when parameters are incorrect or - * the operation fails. This is the synchronous version of {@link lutimes}. - * @since v14.5.0, v12.19.0 - */ - export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; - /** - * Asynchronously changes the permissions of a file. No arguments other than a - * possible exception are given to the completion callback. - * - * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. - * - * ```js - * import { chmod } from 'node:fs'; - * - * chmod('my_file.txt', 0o775, (err) => { - * if (err) throw err; - * console.log('The permissions for file "my_file.txt" have been changed!'); - * }); - * ``` - * @since v0.1.30 - */ - export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; - export namespace chmod { - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: Mode): Promise; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link chmod}. - * - * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. - * @since v0.6.7 - */ - export function chmodSync(path: PathLike, mode: Mode): void; - /** - * Sets the permissions on the file. No arguments other than a possible exception - * are given to the completion callback. - * - * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. - * @since v0.4.7 - */ - export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void; - export namespace fchmod { - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(fd: number, mode: Mode): Promise; - } - /** - * Sets the permissions on the file. Returns `undefined`. - * - * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. - * @since v0.4.7 - */ - export function fchmodSync(fd: number, mode: Mode): void; - /** - * Changes the permissions on a symbolic link. No arguments other than a possible - * exception are given to the completion callback. - * - * This method is only implemented on macOS. - * - * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. - * @deprecated Since v0.4.7 - */ - export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; - /** @deprecated */ - export namespace lchmod { - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: Mode): Promise; - } - /** - * Changes the permissions on a symbolic link. Returns `undefined`. - * - * This method is only implemented on macOS. - * - * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. - * @deprecated Since v0.4.7 - */ - export function lchmodSync(path: PathLike, mode: Mode): void; - /** - * Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object. - * - * In case of an error, the `err.code` will be one of `Common System Errors`. - * - * {@link stat} follows symbolic links. Use {@link lstat} to look at the - * links themselves. - * - * Using `fs.stat()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. - * Instead, user code should open/read/write the file directly and handle the - * error raised if the file is not available. - * - * To check if a file exists without manipulating it afterwards, {@link access} is recommended. - * - * For example, given the following directory structure: - * - * ```text - * - txtDir - * -- file.txt - * - app.js - * ``` - * - * The next program will check for the stats of the given paths: - * - * ```js - * import { stat } from 'node:fs'; - * - * const pathsToCheck = ['./txtDir', './txtDir/file.txt']; - * - * for (let i = 0; i < pathsToCheck.length; i++) { - * stat(pathsToCheck[i], (err, stats) => { - * console.log(stats.isDirectory()); - * console.log(stats); - * }); - * } - * ``` - * - * The resulting output will resemble: - * - * ```console - * true - * Stats { - * dev: 16777220, - * mode: 16877, - * nlink: 3, - * uid: 501, - * gid: 20, - * rdev: 0, - * blksize: 4096, - * ino: 14214262, - * size: 96, - * blocks: 0, - * atimeMs: 1561174653071.963, - * mtimeMs: 1561174614583.3518, - * ctimeMs: 1561174626623.5366, - * birthtimeMs: 1561174126937.2893, - * atime: 2019-06-22T03:37:33.072Z, - * mtime: 2019-06-22T03:36:54.583Z, - * ctime: 2019-06-22T03:37:06.624Z, - * birthtime: 2019-06-22T03:28:46.937Z - * } - * false - * Stats { - * dev: 16777220, - * mode: 33188, - * nlink: 1, - * uid: 501, - * gid: 20, - * rdev: 0, - * blksize: 4096, - * ino: 14214074, - * size: 8, - * blocks: 8, - * atimeMs: 1561174616618.8555, - * mtimeMs: 1561174614584, - * ctimeMs: 1561174614583.8145, - * birthtimeMs: 1561174007710.7478, - * atime: 2019-06-22T03:36:56.619Z, - * mtime: 2019-06-22T03:36:54.584Z, - * ctime: 2019-06-22T03:36:54.584Z, - * birthtime: 2019-06-22T03:26:47.711Z - * } - * ``` - * @since v0.0.2 - */ - export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - export function stat( - path: PathLike, - options: - | (StatOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, - ): void; - export function stat( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, - ): void; - export function stat( - path: PathLike, - options: StatOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, - ): void; - export namespace stat { - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__( - path: PathLike, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(path: PathLike, options?: StatOptions): Promise; - } - export interface StatSyncFn extends Function { - (path: PathLike, options?: undefined): Stats; - ( - path: PathLike, - options?: StatSyncOptions & { - bigint?: false | undefined; - throwIfNoEntry: false; - }, - ): Stats | undefined; - ( - path: PathLike, - options: StatSyncOptions & { - bigint: true; - throwIfNoEntry: false; - }, - ): BigIntStats | undefined; - ( - path: PathLike, - options?: StatSyncOptions & { - bigint?: false | undefined; - }, - ): Stats; - ( - path: PathLike, - options: StatSyncOptions & { - bigint: true; - }, - ): BigIntStats; - ( - path: PathLike, - options: StatSyncOptions & { - bigint: boolean; - throwIfNoEntry?: false | undefined; - }, - ): Stats | BigIntStats; - (path: PathLike, options?: StatSyncOptions): Stats | BigIntStats | undefined; - } - /** - * Synchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export const statSync: StatSyncFn; - /** - * Invokes the callback with the `fs.Stats` for the file descriptor. - * - * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. - * @since v0.1.95 - */ - export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - export function fstat( - fd: number, - options: - | (StatOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, - ): void; - export function fstat( - fd: number, - options: StatOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, - ): void; - export function fstat( - fd: number, - options: StatOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, - ): void; - export namespace fstat { - /** - * Asynchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - function __promisify__( - fd: number, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - fd: number, - options: StatOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(fd: number, options?: StatOptions): Promise; - } - /** - * Retrieves the `fs.Stats` for the file descriptor. - * - * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. - * @since v0.1.95 - */ - export function fstatSync( - fd: number, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Stats; - export function fstatSync( - fd: number, - options: StatOptions & { - bigint: true; - }, - ): BigIntStats; - export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats; - /** - * Retrieves the `fs.Stats` for the symbolic link referred to by the path. - * The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic - * link, then the link itself is stat-ed, not the file that it refers to. - * - * See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details. - * @since v0.1.30 - */ - export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - export function lstat( - path: PathLike, - options: - | (StatOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, - ): void; - export function lstat( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, - ): void; - export function lstat( - path: PathLike, - options: StatOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, - ): void; - export namespace lstat { - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__( - path: PathLike, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(path: PathLike, options?: StatOptions): Promise; - } - /** - * Asynchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which - * contains `path`. The callback gets two arguments `(err, stats)` where `stats`is an `fs.StatFs` object. - * - * In case of an error, the `err.code` will be one of `Common System Errors`. - * @since v19.6.0, v18.15.0 - * @param path A path to an existing file or directory on the file system to be queried. - */ - export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void; - export function statfs( - path: PathLike, - options: - | (StatFsOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void, - ): void; - export function statfs( - path: PathLike, - options: StatFsOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void, - ): void; - export function statfs( - path: PathLike, - options: StatFsOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void, - ): void; - export namespace statfs { - /** - * Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an object. - * @param path A path to an existing file or directory on the file system to be queried. - */ - function __promisify__( - path: PathLike, - options?: StatFsOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - path: PathLike, - options: StatFsOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(path: PathLike, options?: StatFsOptions): Promise; - } - /** - * Synchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which - * contains `path`. - * - * In case of an error, the `err.code` will be one of `Common System Errors`. - * @since v19.6.0, v18.15.0 - * @param path A path to an existing file or directory on the file system to be queried. - */ - export function statfsSync( - path: PathLike, - options?: StatFsOptions & { - bigint?: false | undefined; - }, - ): StatsFs; - export function statfsSync( - path: PathLike, - options: StatFsOptions & { - bigint: true; - }, - ): BigIntStatsFs; - export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs; - /** - * Synchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export const lstatSync: StatSyncFn; - /** - * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. No arguments other than - * a possible - * exception are given to the completion callback. - * @since v0.1.31 - */ - export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - export namespace link { - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(existingPath: PathLike, newPath: PathLike): Promise; - } - /** - * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. Returns `undefined`. - * @since v0.1.31 - */ - export function linkSync(existingPath: PathLike, newPath: PathLike): void; - /** - * Creates the link called `path` pointing to `target`. No arguments other than a - * possible exception are given to the completion callback. - * - * See the POSIX [`symlink(2)`](http://man7.org/linux/man-pages/man2/symlink.2.html) documentation for more details. - * - * The `type` argument is only available on Windows and ignored on other platforms. - * It can be set to `'dir'`, `'file'`, or `'junction'`. If the `type` argument is - * not a string, Node.js will autodetect `target` type and use `'file'` or `'dir'`. - * If the `target` does not exist, `'file'` will be used. Windows junction points - * require the destination path to be absolute. When using `'junction'`, the`target` argument will automatically be normalized to absolute path. Junction - * points on NTFS volumes can only point to directories. - * - * Relative targets are relative to the link's parent directory. - * - * ```js - * import { symlink } from 'node:fs'; - * - * symlink('./mew', './mewtwo', callback); - * ``` - * - * The above example creates a symbolic link `mewtwo` which points to `mew` in the - * same directory: - * - * ```bash - * $ tree . - * . - * ├── mew - * └── mewtwo -> ./mew - * ``` - * @since v0.1.31 - * @param [type='null'] - */ - export function symlink( - target: PathLike, - path: PathLike, - type: symlink.Type | undefined | null, - callback: NoParamCallback, - ): void; - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - */ - export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void; - export namespace symlink { - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise; - type Type = "dir" | "file" | "junction"; - } - /** - * Returns `undefined`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link symlink}. - * @since v0.1.31 - * @param [type='null'] - */ - export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void; - /** - * Reads the contents of the symbolic link referred to by `path`. The callback gets - * two arguments `(err, linkString)`. - * - * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the link path passed to the callback. If the `encoding` is set to `'buffer'`, - * the link path returned will be passed as a `Buffer` object. - * @since v0.1.31 - */ - export function readlink( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: string) => void, - ): void; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlink( - path: PathLike, - options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void, - ): void; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlink( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void, - ): void; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function readlink( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, linkString: string) => void, - ): void; - export namespace readlink { - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - } - /** - * Returns the symbolic link's string value. - * - * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the link path returned. If the `encoding` is set to `'buffer'`, - * the link path returned will be passed as a `Buffer` object. - * @since v0.1.31 - */ - export function readlinkSync(path: PathLike, options?: EncodingOption): string; - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer; - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer; - /** - * Asynchronously computes the canonical pathname by resolving `.`, `..`, and - * symbolic links. - * - * A canonical pathname is not necessarily unique. Hard links and bind mounts can - * expose a file system entity through many pathnames. - * - * This function behaves like [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html), with some exceptions: - * - * 1. No case conversion is performed on case-insensitive file systems. - * 2. The maximum number of symbolic links is platform-independent and generally - * (much) higher than what the native [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html) implementation supports. - * - * The `callback` gets two arguments `(err, resolvedPath)`. May use `process.cwd` to resolve relative paths. - * - * Only paths that can be converted to UTF8 strings are supported. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the path passed to the callback. If the `encoding` is set to `'buffer'`, - * the path returned will be passed as a `Buffer` object. - * - * If `path` resolves to a socket or a pipe, the function will return a system - * dependent name for that object. - * @since v0.1.31 - */ - export function realpath( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpath( - path: PathLike, - options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void, - ): void; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpath( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void, - ): void; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function realpath( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - export namespace realpath { - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - /** - * Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html). - * - * The `callback` gets two arguments `(err, resolvedPath)`. - * - * Only paths that can be converted to UTF8 strings are supported. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the path passed to the callback. If the `encoding` is set to `'buffer'`, - * the path returned will be passed as a `Buffer` object. - * - * On Linux, when Node.js is linked against musl libc, the procfs file system must - * be mounted on `/proc` in order for this function to work. Glibc does not have - * this restriction. - * @since v9.2.0 - */ - function native( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - function native( - path: PathLike, - options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void, - ): void; - function native( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void, - ): void; - function native( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - } - /** - * Returns the resolved pathname. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link realpath}. - * @since v0.1.31 - */ - export function realpathSync(path: PathLike, options?: EncodingOption): string; - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer; - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer; - export namespace realpathSync { - function native(path: PathLike, options?: EncodingOption): string; - function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer; - function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer; - } - /** - * Asynchronously removes a file or symbolic link. No arguments other than a - * possible exception are given to the completion callback. - * - * ```js - * import { unlink } from 'node:fs'; - * // Assuming that 'path/file.txt' is a regular file. - * unlink('path/file.txt', (err) => { - * if (err) throw err; - * console.log('path/file.txt was deleted'); - * }); - * ``` - * - * `fs.unlink()` will not work on a directory, empty or otherwise. To remove a - * directory, use {@link rmdir}. - * - * See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details. - * @since v0.0.2 - */ - export function unlink(path: PathLike, callback: NoParamCallback): void; - export namespace unlink { - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike): Promise; - } - /** - * Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`. - * @since v0.1.21 - */ - export function unlinkSync(path: PathLike): void; - export interface RmDirOptions { - /** - * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or - * `EPERM` error is encountered, Node.js will retry the operation with a linear - * backoff wait of `retryDelay` ms longer on each try. This option represents the - * number of retries. This option is ignored if the `recursive` option is not - * `true`. - * @default 0 - */ - maxRetries?: number | undefined; - /** - * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning - * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file. - * Use `fs.rm(path, { recursive: true, force: true })` instead. - * - * If `true`, perform a recursive directory removal. In - * recursive mode, operations are retried on failure. - * @default false - */ - recursive?: boolean | undefined; - /** - * The amount of time in milliseconds to wait between retries. - * This option is ignored if the `recursive` option is not `true`. - * @default 100 - */ - retryDelay?: number | undefined; - } - /** - * Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given - * to the completion callback. - * - * Using `fs.rmdir()` on a file (not a directory) results in an `ENOENT` error on - * Windows and an `ENOTDIR` error on POSIX. - * - * To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`. - * @since v0.0.2 - */ - export function rmdir(path: PathLike, callback: NoParamCallback): void; - export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void; - export namespace rmdir { - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, options?: RmDirOptions): Promise; - } - /** - * Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`. - * - * Using `fs.rmdirSync()` on a file (not a directory) results in an `ENOENT` error - * on Windows and an `ENOTDIR` error on POSIX. - * - * To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`. - * @since v0.1.21 - */ - export function rmdirSync(path: PathLike, options?: RmDirOptions): void; - export interface RmOptions { - /** - * When `true`, exceptions will be ignored if `path` does not exist. - * @default false - */ - force?: boolean | undefined; - /** - * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or - * `EPERM` error is encountered, Node.js will retry the operation with a linear - * backoff wait of `retryDelay` ms longer on each try. This option represents the - * number of retries. This option is ignored if the `recursive` option is not - * `true`. - * @default 0 - */ - maxRetries?: number | undefined; - /** - * If `true`, perform a recursive directory removal. In - * recursive mode, operations are retried on failure. - * @default false - */ - recursive?: boolean | undefined; - /** - * The amount of time in milliseconds to wait between retries. - * This option is ignored if the `recursive` option is not `true`. - * @default 100 - */ - retryDelay?: number | undefined; - } - /** - * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). No arguments other than a possible exception are given to the - * completion callback. - * @since v14.14.0 - */ - export function rm(path: PathLike, callback: NoParamCallback): void; - export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void; - export namespace rm { - /** - * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). - */ - function __promisify__(path: PathLike, options?: RmOptions): Promise; - } - /** - * Synchronously removes files and directories (modeled on the standard POSIX `rm` utility). Returns `undefined`. - * @since v14.14.0 - */ - export function rmSync(path: PathLike, options?: RmOptions): void; - export interface MakeDirectoryOptions { - /** - * Indicates whether parent folders should be created. - * If a folder was created, the path to the first created folder will be returned. - * @default false - */ - recursive?: boolean | undefined; - /** - * A file mode. If a string is passed, it is parsed as an octal integer. If not specified - * @default 0o777 - */ - mode?: Mode | undefined; - } - /** - * Asynchronously creates a directory. - * - * The callback is given a possible exception and, if `recursive` is `true`, the - * first directory path created, `(err[, path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was - * created (for instance, if it was previously created). - * - * The optional `options` argument can be an integer specifying `mode` (permission - * and sticky bits), or an object with a `mode` property and a `recursive` property indicating whether parent directories should be created. Calling `fs.mkdir()` when `path` is a directory that - * exists results in an error only - * when `recursive` is false. If `recursive` is false and the directory exists, - * an `EEXIST` error occurs. - * - * ```js - * import { mkdir } from 'node:fs'; - * - * // Create ./tmp/a/apple, regardless of whether ./tmp and ./tmp/a exist. - * mkdir('./tmp/a/apple', { recursive: true }, (err) => { - * if (err) throw err; - * }); - * ``` - * - * On Windows, using `fs.mkdir()` on the root directory even with recursion will - * result in an error: - * - * ```js - * import { mkdir } from 'node:fs'; - * - * mkdir('/', { recursive: true }, (err) => { - * // => [Error: EPERM: operation not permitted, mkdir 'C:\'] - * }); - * ``` - * - * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. - * @since v0.1.8 - */ - export function mkdir( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - callback: (err: NodeJS.ErrnoException | null, path?: string) => void, - ): void; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdir( - path: PathLike, - options: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null - | undefined, - callback: NoParamCallback, - ): void; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdir( - path: PathLike, - options: Mode | MakeDirectoryOptions | null | undefined, - callback: (err: NodeJS.ErrnoException | null, path?: string) => void, - ): void; - /** - * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function mkdir(path: PathLike, callback: NoParamCallback): void; - export namespace mkdir { - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__( - path: PathLike, - options?: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__( - path: PathLike, - options?: Mode | MakeDirectoryOptions | null, - ): Promise; - } - /** - * Synchronously creates a directory. Returns `undefined`, or if `recursive` is `true`, the first directory path created. - * This is the synchronous version of {@link mkdir}. - * - * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. - * @since v0.1.21 - */ - export function mkdirSync( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - ): string | undefined; - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdirSync( - path: PathLike, - options?: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null, - ): void; - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined; - /** - * Creates a unique temporary directory. - * - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. Due to platform - * inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms, - * notably the BSDs, can return more than six random characters, and replace - * trailing `X` characters in `prefix` with random characters. - * - * The created directory path is passed as a string to the callback's second - * parameter. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * - * ```js - * import { mkdtemp } from 'node:fs'; - * import { join } from 'node:path'; - * import { tmpdir } from 'node:os'; - * - * mkdtemp(join(tmpdir(), 'foo-'), (err, directory) => { - * if (err) throw err; - * console.log(directory); - * // Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2 - * }); - * ``` - * - * The `fs.mkdtemp()` method will append the six randomly selected characters - * directly to the `prefix` string. For instance, given a directory `/tmp`, if the - * intention is to create a temporary directory _within_`/tmp`, the `prefix`must end with a trailing platform-specific path separator - * (`import { sep } from 'node:path'`). - * - * ```js - * import { tmpdir } from 'node:os'; - * import { mkdtemp } from 'node:fs'; - * - * // The parent directory for the new temporary directory - * const tmpDir = tmpdir(); - * - * // This method is *INCORRECT*: - * mkdtemp(tmpDir, (err, directory) => { - * if (err) throw err; - * console.log(directory); - * // Will print something similar to `/tmpabc123`. - * // A new temporary directory is created at the file system root - * // rather than *within* the /tmp directory. - * }); - * - * // This method is *CORRECT*: - * import { sep } from 'node:path'; - * mkdtemp(`${tmpDir}${sep}`, (err, directory) => { - * if (err) throw err; - * console.log(directory); - * // Will print something similar to `/tmp/abc123`. - * // A new temporary directory is created within - * // the /tmp directory. - * }); - * ``` - * @since v5.10.0 - */ - export function mkdtemp( - prefix: string, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, folder: string) => void, - ): void; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtemp( - prefix: string, - options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void, - ): void; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtemp( - prefix: string, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void, - ): void; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - */ - export function mkdtemp( - prefix: string, - callback: (err: NodeJS.ErrnoException | null, folder: string) => void, - ): void; - export namespace mkdtemp { - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: EncodingOption): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options: BufferEncodingOption): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: EncodingOption): Promise; - } - /** - * Returns the created directory path. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link mkdtemp}. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * @since v5.10.0 - */ - export function mkdtempSync(prefix: string, options?: EncodingOption): string; - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer; - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer; - /** - * Reads the contents of a directory. The callback gets two arguments `(err, files)` where `files` is an array of the names of the files in the directory excluding `'.'` and `'..'`. - * - * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the filenames passed to the callback. If the `encoding` is set to `'buffer'`, - * the filenames returned will be passed as `Buffer` objects. - * - * If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects. - * @since v0.1.8 - */ - export function readdir( - path: PathLike, - options: - | { - encoding: BufferEncoding | null; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | BufferEncoding - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdir( - path: PathLike, - options: - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | "buffer", - callback: (err: NodeJS.ErrnoException | null, files: NonSharedBuffer[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdir( - path: PathLike, - options: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, files: string[] | NonSharedBuffer[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function readdir( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - export function readdir( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`. - */ - export function readdir( - path: PathLike, - options: { - encoding: "buffer"; - withFileTypes: true; - recursive?: boolean | undefined; - }, - callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void, - ): void; - export namespace readdir { - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__( - path: PathLike, - options?: - | { - encoding: BufferEncoding | null; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__( - path: PathLike, - options: - | "buffer" - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent - */ - function __promisify__( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`. - */ - function __promisify__( - path: PathLike, - options: { - encoding: "buffer"; - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Promise[]>; - } - /** - * Reads the contents of the directory. - * - * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the filenames returned. If the `encoding` is set to `'buffer'`, - * the filenames returned will be passed as `Buffer` objects. - * - * If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects. - * @since v0.1.21 - */ - export function readdirSync( - path: PathLike, - options?: - | { - encoding: BufferEncoding | null; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | BufferEncoding - | null, - ): string[]; - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdirSync( - path: PathLike, - options: - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | "buffer", - ): NonSharedBuffer[]; - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdirSync( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): string[] | NonSharedBuffer[]; - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - export function readdirSync( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Dirent[]; - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`. - */ - export function readdirSync( - path: PathLike, - options: { - encoding: "buffer"; - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Dirent[]; - /** - * Closes the file descriptor. No arguments other than a possible exception are - * given to the completion callback. - * - * Calling `fs.close()` on any file descriptor (`fd`) that is currently in use - * through any other `fs` operation may lead to undefined behavior. - * - * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. - * @since v0.0.2 - */ - export function close(fd: number, callback?: NoParamCallback): void; - export namespace close { - /** - * Asynchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - /** - * Closes the file descriptor. Returns `undefined`. - * - * Calling `fs.closeSync()` on any file descriptor (`fd`) that is currently in use - * through any other `fs` operation may lead to undefined behavior. - * - * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. - * @since v0.1.21 - */ - export function closeSync(fd: number): void; - /** - * Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details. - * - * `mode` sets the file mode (permission and sticky bits), but only if the file was - * created. On Windows, only the write permission can be manipulated; see {@link chmod}. - * - * The callback gets two arguments `(err, fd)`. - * - * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented - * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains - * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). - * - * Functions based on `fs.open()` exhibit this behavior as well:`fs.writeFile()`, `fs.readFile()`, etc. - * @since v0.0.2 - * @param [flags='r'] See `support of file system `flags``. - * @param [mode=0o666] - */ - export function open( - path: PathLike, - flags: OpenMode | undefined, - mode: Mode | undefined | null, - callback: (err: NodeJS.ErrnoException | null, fd: number) => void, - ): void; - /** - * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param [flags='r'] See `support of file system `flags``. - */ - export function open( - path: PathLike, - flags: OpenMode | undefined, - callback: (err: NodeJS.ErrnoException | null, fd: number) => void, - ): void; - /** - * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; - export namespace open { - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - function __promisify__(path: PathLike, flags: OpenMode, mode?: Mode | null): Promise; - } - /** - * Returns an integer representing the file descriptor. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link open}. - * @since v0.1.21 - * @param [flags='r'] - * @param [mode=0o666] - */ - export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number; - /** - * Change the file system timestamps of the object referenced by `path`. - * - * The `atime` and `mtime` arguments follow these rules: - * - * * Values can be either numbers representing Unix epoch time in seconds, `Date`s, or a numeric string like `'123456789.0'`. - * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown. - * @since v0.4.2 - */ - export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; - export namespace utimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - } - /** - * Returns `undefined`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link utimes}. - * @since v0.4.2 - */ - export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; - /** - * Change the file system timestamps of the object referenced by the supplied file - * descriptor. See {@link utimes}. - * @since v0.4.2 - */ - export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; - export namespace futimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(fd: number, atime: TimeLike, mtime: TimeLike): Promise; - } - /** - * Synchronous version of {@link futimes}. Returns `undefined`. - * @since v0.4.2 - */ - export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void; - /** - * Request that all data for the open file descriptor is flushed to the storage - * device. The specific implementation is operating system and device specific. - * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. No arguments other - * than a possible exception are given to the completion callback. - * @since v0.1.96 - */ - export function fsync(fd: number, callback: NoParamCallback): void; - export namespace fsync { - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - /** - * Request that all data for the open file descriptor is flushed to the storage - * device. The specific implementation is operating system and device specific. - * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`. - * @since v0.1.96 - */ - export function fsyncSync(fd: number): void; - export interface WriteOptions { - /** - * @default 0 - */ - offset?: number | undefined; - /** - * @default `buffer.byteLength - offset` - */ - length?: number | undefined; - /** - * @default null - */ - position?: number | null | undefined; - } - /** - * Write `buffer` to the file specified by `fd`. - * - * `offset` determines the part of the buffer to be written, and `length` is - * an integer specifying the number of bytes to write. - * - * `position` refers to the offset from the beginning of the file where this data - * should be written. If `typeof position !== 'number'`, the data will be written - * at the current position. See [`pwrite(2)`](http://man7.org/linux/man-pages/man2/pwrite.2.html). - * - * The callback will be given three arguments `(err, bytesWritten, buffer)` where `bytesWritten` specifies how many _bytes_ were written from `buffer`. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a promise for an `Object` with `bytesWritten` and `buffer` properties. - * - * It is unsafe to use `fs.write()` multiple times on the same file without waiting - * for the callback. For this scenario, {@link createWriteStream} is - * recommended. - * - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v0.0.2 - * @param [offset=0] - * @param [length=buffer.byteLength - offset] - * @param [position='null'] - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - position: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - */ - export function write( - fd: number, - buffer: TBuffer, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param options An object with the following properties: - * * `offset` The part of the buffer to be written. If not supplied, defaults to `0`. - * * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - export function write( - fd: number, - buffer: TBuffer, - options: WriteOptions, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - export function write( - fd: number, - string: string, - position: number | undefined | null, - encoding: BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - export function write( - fd: number, - string: string, - position: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - */ - export function write( - fd: number, - string: string, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - export namespace write { - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function __promisify__( - fd: number, - buffer?: TBuffer, - offset?: number, - length?: number, - position?: number | null, - ): Promise<{ - bytesWritten: number; - buffer: TBuffer; - }>; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param options An object with the following properties: - * * `offset` The part of the buffer to be written. If not supplied, defaults to `0`. - * * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function __promisify__( - fd: number, - buffer?: TBuffer, - options?: WriteOptions, - ): Promise<{ - bytesWritten: number; - buffer: TBuffer; - }>; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function __promisify__( - fd: number, - string: string, - position?: number | null, - encoding?: BufferEncoding | null, - ): Promise<{ - bytesWritten: number; - buffer: string; - }>; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link write}. - * @since v0.1.21 - * @param [offset=0] - * @param [length=buffer.byteLength - offset] - * @param [position='null'] - * @return The number of bytes written. - */ - export function writeSync( - fd: number, - buffer: NodeJS.ArrayBufferView, - offset?: number | null, - length?: number | null, - position?: number | null, - ): number; - /** - * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - export function writeSync( - fd: number, - string: string, - position?: number | null, - encoding?: BufferEncoding | null, - ): number; - export type ReadPosition = number | bigint; - export interface ReadOptions { - /** - * @default 0 - */ - offset?: number | undefined; - /** - * @default `length of buffer` - */ - length?: number | undefined; - /** - * @default null - */ - position?: ReadPosition | null | undefined; - } - export interface ReadOptionsWithBuffer extends ReadOptions { - buffer?: T | undefined; - } - /** @deprecated Use `ReadOptions` instead. */ - // TODO: remove in future major - export interface ReadSyncOptions extends ReadOptions {} - /** @deprecated Use `ReadOptionsWithBuffer` instead. */ - // TODO: remove in future major - export interface ReadAsyncOptions extends ReadOptionsWithBuffer {} - /** - * Read data from the file specified by `fd`. - * - * The callback is given the three arguments, `(err, bytesRead, buffer)`. - * - * If the file is not modified concurrently, the end-of-file is reached when the - * number of bytes read is zero. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a promise for an `Object` with `bytesRead` and `buffer` properties. - * @since v0.0.2 - * @param buffer The buffer that the data will be written to. - * @param offset The position in `buffer` to write the data to. - * @param length The number of bytes to read. - * @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If - * `position` is an integer, the file position will be unchanged. - */ - export function read( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: ReadPosition | null, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - /** - * Similar to the above `fs.read` function, this version takes an optional `options` object. - * If not otherwise specified in an `options` object, - * `buffer` defaults to `Buffer.alloc(16384)`, - * `offset` defaults to `0`, - * `length` defaults to `buffer.byteLength`, `- offset` as of Node 17.6.0 - * `position` defaults to `null` - * @since v12.17.0, 13.11.0 - */ - export function read( - fd: number, - options: ReadOptionsWithBuffer, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - export function read( - fd: number, - buffer: TBuffer, - options: ReadOptions, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - export function read( - fd: number, - buffer: TBuffer, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - export function read( - fd: number, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void, - ): void; - export namespace read { - /** - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - function __promisify__( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: ReadPosition | null, - ): Promise<{ - bytesRead: number; - buffer: TBuffer; - }>; - function __promisify__( - fd: number, - options: ReadOptionsWithBuffer, - ): Promise<{ - bytesRead: number; - buffer: TBuffer; - }>; - function __promisify__(fd: number): Promise<{ - bytesRead: number; - buffer: NonSharedBuffer; - }>; - } - /** - * Returns the number of `bytesRead`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link read}. - * @since v0.1.21 - * @param [position='null'] - */ - export function readSync( - fd: number, - buffer: NodeJS.ArrayBufferView, - offset: number, - length: number, - position: ReadPosition | null, - ): number; - /** - * Similar to the above `fs.readSync` function, this version takes an optional `options` object. - * If no `options` object is specified, it will default with the above values. - */ - export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number; - /** - * Asynchronously reads the entire contents of a file. - * - * ```js - * import { readFile } from 'node:fs'; - * - * readFile('/etc/passwd', (err, data) => { - * if (err) throw err; - * console.log(data); - * }); - * ``` - * - * The callback is passed two arguments `(err, data)`, where `data` is the - * contents of the file. - * - * If no encoding is specified, then the raw buffer is returned. - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { readFile } from 'node:fs'; - * - * readFile('/etc/passwd', 'utf8', callback); - * ``` - * - * When the path is a directory, the behavior of `fs.readFile()` and {@link readFileSync} is platform-specific. On macOS, Linux, and Windows, an - * error will be returned. On FreeBSD, a representation of the directory's contents - * will be returned. - * - * ```js - * import { readFile } from 'node:fs'; - * - * // macOS, Linux, and Windows - * readFile('', (err, data) => { - * // => [Error: EISDIR: illegal operation on a directory, read ] - * }); - * - * // FreeBSD - * readFile('', (err, data) => { - * // => null, - * }); - * ``` - * - * It is possible to abort an ongoing request using an `AbortSignal`. If a - * request is aborted the callback is called with an `AbortError`: - * - * ```js - * import { readFile } from 'node:fs'; - * - * const controller = new AbortController(); - * const signal = controller.signal; - * readFile(fileInfo[0].name, { signal }, (err, buf) => { - * // ... - * }); - * // When you want to abort the request - * controller.abort(); - * ``` - * - * The `fs.readFile()` function buffers the entire file. To minimize memory costs, - * when possible prefer streaming via `fs.createReadStream()`. - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.readFile` performs. - * @since v0.1.29 - * @param path filename or file descriptor - */ - export function readFile( - path: PathOrFileDescriptor, - options: - | ({ - encoding?: null | undefined; - flag?: string | undefined; - } & Abortable) - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void, - ): void; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFile( - path: PathOrFileDescriptor, - options: - | ({ - encoding: BufferEncoding; - flag?: string | undefined; - } & Abortable) - | BufferEncoding, - callback: (err: NodeJS.ErrnoException | null, data: string) => void, - ): void; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFile( - path: PathOrFileDescriptor, - options: - | (ObjectEncodingOptions & { - flag?: string | undefined; - } & Abortable) - | BufferEncoding - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, data: string | NonSharedBuffer) => void, - ): void; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - */ - export function readFile( - path: PathOrFileDescriptor, - callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void, - ): void; - export namespace readFile { - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__( - path: PathOrFileDescriptor, - options?: { - encoding?: null | undefined; - flag?: string | undefined; - } | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__( - path: PathOrFileDescriptor, - options: - | { - encoding: BufferEncoding; - flag?: string | undefined; - } - | BufferEncoding, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__( - path: PathOrFileDescriptor, - options?: - | (ObjectEncodingOptions & { - flag?: string | undefined; - }) - | BufferEncoding - | null, - ): Promise; - } - /** - * Returns the contents of the `path`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link readFile}. - * - * If the `encoding` option is specified then this function returns a - * string. Otherwise it returns a buffer. - * - * Similar to {@link readFile}, when the path is a directory, the behavior of `fs.readFileSync()` is platform-specific. - * - * ```js - * import { readFileSync } from 'node:fs'; - * - * // macOS, Linux, and Windows - * readFileSync(''); - * // => [Error: EISDIR: illegal operation on a directory, read ] - * - * // FreeBSD - * readFileSync(''); // => - * ``` - * @since v0.1.8 - * @param path filename or file descriptor - */ - export function readFileSync( - path: PathOrFileDescriptor, - options?: { - encoding?: null | undefined; - flag?: string | undefined; - } | null, - ): NonSharedBuffer; - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFileSync( - path: PathOrFileDescriptor, - options: - | { - encoding: BufferEncoding; - flag?: string | undefined; - } - | BufferEncoding, - ): string; - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFileSync( - path: PathOrFileDescriptor, - options?: - | (ObjectEncodingOptions & { - flag?: string | undefined; - }) - | BufferEncoding - | null, - ): string | NonSharedBuffer; - export type WriteFileOptions = - | ( - & ObjectEncodingOptions - & Abortable - & { - mode?: Mode | undefined; - flag?: string | undefined; - flush?: boolean | undefined; - } - ) - | BufferEncoding - | null; - /** - * When `file` is a filename, asynchronously writes data to the file, replacing the - * file if it already exists. `data` can be a string or a buffer. - * - * When `file` is a file descriptor, the behavior is similar to calling `fs.write()` directly (which is recommended). See the notes below on using - * a file descriptor. - * - * The `encoding` option is ignored if `data` is a buffer. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * ```js - * import { writeFile } from 'node:fs'; - * import { Buffer } from 'node:buffer'; - * - * const data = new Uint8Array(Buffer.from('Hello Node.js')); - * writeFile('message.txt', data, (err) => { - * if (err) throw err; - * console.log('The file has been saved!'); - * }); - * ``` - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { writeFile } from 'node:fs'; - * - * writeFile('message.txt', 'Hello Node.js', 'utf8', callback); - * ``` - * - * It is unsafe to use `fs.writeFile()` multiple times on the same file without - * waiting for the callback. For this scenario, {@link createWriteStream} is - * recommended. - * - * Similarly to `fs.readFile` \- `fs.writeFile` is a convenience method that - * performs multiple `write` calls internally to write the buffer passed to it. - * For performance sensitive code consider using {@link createWriteStream}. - * - * It is possible to use an `AbortSignal` to cancel an `fs.writeFile()`. - * Cancelation is "best effort", and some amount of data is likely still - * to be written. - * - * ```js - * import { writeFile } from 'node:fs'; - * import { Buffer } from 'node:buffer'; - * - * const controller = new AbortController(); - * const { signal } = controller; - * const data = new Uint8Array(Buffer.from('Hello Node.js')); - * writeFile('message.txt', data, { signal }, (err) => { - * // When a request is aborted - the callback is called with an AbortError - * }); - * // When the request should be aborted - * controller.abort(); - * ``` - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.writeFile` performs. - * @since v0.1.29 - * @param file filename or file descriptor - */ - export function writeFile( - file: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - options: WriteFileOptions, - callback: NoParamCallback, - ): void; - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - export function writeFile( - path: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - callback: NoParamCallback, - ): void; - export namespace writeFile { - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function __promisify__( - path: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - options?: WriteFileOptions, - ): Promise; - } - /** - * Returns `undefined`. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link writeFile}. - * @since v0.1.29 - * @param file filename or file descriptor - */ - export function writeFileSync( - file: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - options?: WriteFileOptions, - ): void; - /** - * Asynchronously append data to a file, creating the file if it does not yet - * exist. `data` can be a string or a `Buffer`. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * ```js - * import { appendFile } from 'node:fs'; - * - * appendFile('message.txt', 'data to append', (err) => { - * if (err) throw err; - * console.log('The "data to append" was appended to file!'); - * }); - * ``` - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { appendFile } from 'node:fs'; - * - * appendFile('message.txt', 'data to append', 'utf8', callback); - * ``` - * - * The `path` may be specified as a numeric file descriptor that has been opened - * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will - * not be closed automatically. - * - * ```js - * import { open, close, appendFile } from 'node:fs'; - * - * function closeFd(fd) { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * - * open('message.txt', 'a', (err, fd) => { - * if (err) throw err; - * - * try { - * appendFile(fd, 'data to append', 'utf8', (err) => { - * closeFd(fd); - * if (err) throw err; - * }); - * } catch (err) { - * closeFd(fd); - * throw err; - * } - * }); - * ``` - * @since v0.6.7 - * @param path filename or file descriptor - */ - export function appendFile( - path: PathOrFileDescriptor, - data: string | Uint8Array, - options: WriteFileOptions, - callback: NoParamCallback, - ): void; - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void; - export namespace appendFile { - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function __promisify__( - file: PathOrFileDescriptor, - data: string | Uint8Array, - options?: WriteFileOptions, - ): Promise; - } - /** - * Synchronously append data to a file, creating the file if it does not yet - * exist. `data` can be a string or a `Buffer`. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * ```js - * import { appendFileSync } from 'node:fs'; - * - * try { - * appendFileSync('message.txt', 'data to append'); - * console.log('The "data to append" was appended to file!'); - * } catch (err) { - * // Handle the error - * } - * ``` - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { appendFileSync } from 'node:fs'; - * - * appendFileSync('message.txt', 'data to append', 'utf8'); - * ``` - * - * The `path` may be specified as a numeric file descriptor that has been opened - * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will - * not be closed automatically. - * - * ```js - * import { openSync, closeSync, appendFileSync } from 'node:fs'; - * - * let fd; - * - * try { - * fd = openSync('message.txt', 'a'); - * appendFileSync(fd, 'data to append', 'utf8'); - * } catch (err) { - * // Handle the error - * } finally { - * if (fd !== undefined) - * closeSync(fd); - * } - * ``` - * @since v0.6.7 - * @param path filename or file descriptor - */ - export function appendFileSync( - path: PathOrFileDescriptor, - data: string | Uint8Array, - options?: WriteFileOptions, - ): void; - /** - * Watch for changes on `filename`. The callback `listener` will be called each - * time the file is accessed. - * - * The `options` argument may be omitted. If provided, it should be an object. The `options` object may contain a boolean named `persistent` that indicates - * whether the process should continue to run as long as files are being watched. - * The `options` object may specify an `interval` property indicating how often the - * target should be polled in milliseconds. - * - * The `listener` gets two arguments the current stat object and the previous - * stat object: - * - * ```js - * import { watchFile } from 'node:fs'; - * - * watchFile('message.text', (curr, prev) => { - * console.log(`the current mtime is: ${curr.mtime}`); - * console.log(`the previous mtime was: ${prev.mtime}`); - * }); - * ``` - * - * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, - * the numeric values in these objects are specified as `BigInt`s. - * - * To be notified when the file was modified, not just accessed, it is necessary - * to compare `curr.mtimeMs` and `prev.mtimeMs`. - * - * When an `fs.watchFile` operation results in an `ENOENT` error, it - * will invoke the listener once, with all the fields zeroed (or, for dates, the - * Unix Epoch). If the file is created later on, the listener will be called - * again, with the latest stat objects. This is a change in functionality since - * v0.10. - * - * Using {@link watch} is more efficient than `fs.watchFile` and `fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and `fs.unwatchFile` when possible. - * - * When a file being watched by `fs.watchFile()` disappears and reappears, - * then the contents of `previous` in the second callback event (the file's - * reappearance) will be the same as the contents of `previous` in the first - * callback event (its disappearance). - * - * This happens when: - * - * * the file is deleted, followed by a restore - * * the file is renamed and then renamed a second time back to its original name - * @since v0.1.31 - */ - export interface WatchFileOptions { - bigint?: boolean | undefined; - persistent?: boolean | undefined; - interval?: number | undefined; - } - /** - * Watch for changes on `filename`. The callback `listener` will be called each - * time the file is accessed. - * - * The `options` argument may be omitted. If provided, it should be an object. The `options` object may contain a boolean named `persistent` that indicates - * whether the process should continue to run as long as files are being watched. - * The `options` object may specify an `interval` property indicating how often the - * target should be polled in milliseconds. - * - * The `listener` gets two arguments the current stat object and the previous - * stat object: - * - * ```js - * import { watchFile } from 'node:fs'; - * - * watchFile('message.text', (curr, prev) => { - * console.log(`the current mtime is: ${curr.mtime}`); - * console.log(`the previous mtime was: ${prev.mtime}`); - * }); - * ``` - * - * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, - * the numeric values in these objects are specified as `BigInt`s. - * - * To be notified when the file was modified, not just accessed, it is necessary - * to compare `curr.mtimeMs` and `prev.mtimeMs`. - * - * When an `fs.watchFile` operation results in an `ENOENT` error, it - * will invoke the listener once, with all the fields zeroed (or, for dates, the - * Unix Epoch). If the file is created later on, the listener will be called - * again, with the latest stat objects. This is a change in functionality since - * v0.10. - * - * Using {@link watch} is more efficient than `fs.watchFile` and `fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and `fs.unwatchFile` when possible. - * - * When a file being watched by `fs.watchFile()` disappears and reappears, - * then the contents of `previous` in the second callback event (the file's - * reappearance) will be the same as the contents of `previous` in the first - * callback event (its disappearance). - * - * This happens when: - * - * * the file is deleted, followed by a restore - * * the file is renamed and then renamed a second time back to its original name - * @since v0.1.31 - */ - export function watchFile( - filename: PathLike, - options: - | (WatchFileOptions & { - bigint?: false | undefined; - }) - | undefined, - listener: StatsListener, - ): StatWatcher; - export function watchFile( - filename: PathLike, - options: - | (WatchFileOptions & { - bigint: true; - }) - | undefined, - listener: BigIntStatsListener, - ): StatWatcher; - /** - * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - */ - export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher; - /** - * Stop watching for changes on `filename`. If `listener` is specified, only that - * particular listener is removed. Otherwise, _all_ listeners are removed, - * effectively stopping watching of `filename`. - * - * Calling `fs.unwatchFile()` with a filename that is not being watched is a - * no-op, not an error. - * - * Using {@link watch} is more efficient than `fs.watchFile()` and `fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()` and `fs.unwatchFile()` when possible. - * @since v0.1.31 - * @param listener Optional, a listener previously attached using `fs.watchFile()` - */ - export function unwatchFile(filename: PathLike, listener?: StatsListener): void; - export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void; - export interface WatchOptions extends Abortable { - encoding?: BufferEncoding | "buffer" | undefined; - persistent?: boolean | undefined; - recursive?: boolean | undefined; - } - export interface WatchOptionsWithBufferEncoding extends WatchOptions { - encoding: "buffer"; - } - export interface WatchOptionsWithStringEncoding extends WatchOptions { - encoding?: BufferEncoding | undefined; - } - export type WatchEventType = "rename" | "change"; - export type WatchListener = (event: WatchEventType, filename: T | null) => void; - export type StatsListener = (curr: Stats, prev: Stats) => void; - export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void; - /** - * Watch for changes on `filename`, where `filename` is either a file or a - * directory. - * - * The second argument is optional. If `options` is provided as a string, it - * specifies the `encoding`. Otherwise `options` should be passed as an object. - * - * The listener callback gets two arguments `(eventType, filename)`. `eventType`is either `'rename'` or `'change'`, and `filename` is the name of the file - * which triggered the event. - * - * On most platforms, `'rename'` is emitted whenever a filename appears or - * disappears in the directory. - * - * The listener callback is attached to the `'change'` event fired by `fs.FSWatcher`, but it is not the same thing as the `'change'` value of `eventType`. - * - * If a `signal` is passed, aborting the corresponding AbortController will close - * the returned `fs.FSWatcher`. - * @since v0.5.10 - * @param listener - */ - export function watch( - filename: PathLike, - options?: WatchOptionsWithStringEncoding | BufferEncoding | null, - listener?: WatchListener, - ): FSWatcher; - export function watch( - filename: PathLike, - options: WatchOptionsWithBufferEncoding | "buffer", - listener: WatchListener, - ): FSWatcher; - export function watch( - filename: PathLike, - options: WatchOptions | BufferEncoding | "buffer" | null, - listener: WatchListener, - ): FSWatcher; - export function watch(filename: PathLike, listener: WatchListener): FSWatcher; - /** - * Test whether or not the given path exists by checking with the file system. - * Then call the `callback` argument with either true or false: - * - * ```js - * import { exists } from 'node:fs'; - * - * exists('/etc/passwd', (e) => { - * console.log(e ? 'it exists' : 'no passwd!'); - * }); - * ``` - * - * **The parameters for this callback are not consistent with other Node.js** - * **callbacks.** Normally, the first parameter to a Node.js callback is an `err` parameter, optionally followed by other parameters. The `fs.exists()` callback - * has only one boolean parameter. This is one reason `fs.access()` is recommended - * instead of `fs.exists()`. - * - * Using `fs.exists()` to check for the existence of a file before calling `fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. Doing - * so introduces a race condition, since other processes may change the file's - * state between the two calls. Instead, user code should open/read/write the - * file directly and handle the error raised if the file does not exist. - * - * **write (NOT RECOMMENDED)** - * - * ```js - * import { exists, open, close } from 'node:fs'; - * - * exists('myfile', (e) => { - * if (e) { - * console.error('myfile already exists'); - * } else { - * open('myfile', 'wx', (err, fd) => { - * if (err) throw err; - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * } - * }); - * ``` - * - * **write (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * open('myfile', 'wx', (err, fd) => { - * if (err) { - * if (err.code === 'EEXIST') { - * console.error('myfile already exists'); - * return; - * } - * - * throw err; - * } - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * **read (NOT RECOMMENDED)** - * - * ```js - * import { open, close, exists } from 'node:fs'; - * - * exists('myfile', (e) => { - * if (e) { - * open('myfile', 'r', (err, fd) => { - * if (err) throw err; - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * } else { - * console.error('myfile does not exist'); - * } - * }); - * ``` - * - * **read (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * - * open('myfile', 'r', (err, fd) => { - * if (err) { - * if (err.code === 'ENOENT') { - * console.error('myfile does not exist'); - * return; - * } - * - * throw err; - * } - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * The "not recommended" examples above check for existence and then use the - * file; the "recommended" examples are better because they use the file directly - * and handle the error, if any. - * - * In general, check for the existence of a file only if the file won't be - * used directly, for example when its existence is a signal from another - * process. - * @since v0.0.2 - * @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead. - */ - export function exists(path: PathLike, callback: (exists: boolean) => void): void; - /** @deprecated */ - export namespace exists { - /** - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike): Promise; - } - /** - * Returns `true` if the path exists, `false` otherwise. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link exists}. - * - * `fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback` parameter to `fs.exists()` accepts parameters that are inconsistent with other - * Node.js callbacks. `fs.existsSync()` does not use a callback. - * - * ```js - * import { existsSync } from 'node:fs'; - * - * if (existsSync('/etc/passwd')) - * console.log('The path exists.'); - * ``` - * @since v0.1.21 - */ - export function existsSync(path: PathLike): boolean; - export namespace constants { - // File Access Constants - /** Constant for fs.access(). File is visible to the calling process. */ - const F_OK: number; - /** Constant for fs.access(). File can be read by the calling process. */ - const R_OK: number; - /** Constant for fs.access(). File can be written by the calling process. */ - const W_OK: number; - /** Constant for fs.access(). File can be executed by the calling process. */ - const X_OK: number; - // File Copy Constants - /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */ - const COPYFILE_EXCL: number; - /** - * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used. - */ - const COPYFILE_FICLONE: number; - /** - * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then the operation will fail with an error. - */ - const COPYFILE_FICLONE_FORCE: number; - // File Open Constants - /** Constant for fs.open(). Flag indicating to open a file for read-only access. */ - const O_RDONLY: number; - /** Constant for fs.open(). Flag indicating to open a file for write-only access. */ - const O_WRONLY: number; - /** Constant for fs.open(). Flag indicating to open a file for read-write access. */ - const O_RDWR: number; - /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */ - const O_CREAT: number; - /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */ - const O_EXCL: number; - /** - * Constant for fs.open(). Flag indicating that if path identifies a terminal device, - * opening the path shall not cause that terminal to become the controlling terminal for the process - * (if the process does not already have one). - */ - const O_NOCTTY: number; - /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */ - const O_TRUNC: number; - /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */ - const O_APPEND: number; - /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */ - const O_DIRECTORY: number; - /** - * constant for fs.open(). - * Flag indicating reading accesses to the file system will no longer result in - * an update to the atime information associated with the file. - * This flag is available on Linux operating systems only. - */ - const O_NOATIME: number; - /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */ - const O_NOFOLLOW: number; - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */ - const O_SYNC: number; - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */ - const O_DSYNC: number; - /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */ - const O_SYMLINK: number; - /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */ - const O_DIRECT: number; - /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */ - const O_NONBLOCK: number; - // File Type Constants - /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */ - const S_IFMT: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */ - const S_IFREG: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */ - const S_IFDIR: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */ - const S_IFCHR: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */ - const S_IFBLK: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */ - const S_IFIFO: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */ - const S_IFLNK: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */ - const S_IFSOCK: number; - // File Mode Constants - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */ - const S_IRWXU: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */ - const S_IRUSR: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */ - const S_IWUSR: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */ - const S_IXUSR: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */ - const S_IRWXG: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */ - const S_IRGRP: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */ - const S_IWGRP: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */ - const S_IXGRP: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */ - const S_IRWXO: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */ - const S_IROTH: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */ - const S_IWOTH: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */ - const S_IXOTH: number; - /** - * When set, a memory file mapping is used to access the file. This flag - * is available on Windows operating systems only. On other operating systems, - * this flag is ignored. - */ - const UV_FS_O_FILEMAP: number; - } - /** - * Tests a user's permissions for the file or directory specified by `path`. - * The `mode` argument is an optional integer that specifies the accessibility - * checks to be performed. `mode` should be either the value `fs.constants.F_OK` or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`, `fs.constants.W_OK`, and `fs.constants.X_OK` - * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for - * possible values of `mode`. - * - * The final argument, `callback`, is a callback function that is invoked with - * a possible error argument. If any of the accessibility checks fail, the error - * argument will be an `Error` object. The following examples check if `package.json` exists, and if it is readable or writable. - * - * ```js - * import { access, constants } from 'node:fs'; - * - * const file = 'package.json'; - * - * // Check if the file exists in the current directory. - * access(file, constants.F_OK, (err) => { - * console.log(`${file} ${err ? 'does not exist' : 'exists'}`); - * }); - * - * // Check if the file is readable. - * access(file, constants.R_OK, (err) => { - * console.log(`${file} ${err ? 'is not readable' : 'is readable'}`); - * }); - * - * // Check if the file is writable. - * access(file, constants.W_OK, (err) => { - * console.log(`${file} ${err ? 'is not writable' : 'is writable'}`); - * }); - * - * // Check if the file is readable and writable. - * access(file, constants.R_OK | constants.W_OK, (err) => { - * console.log(`${file} ${err ? 'is not' : 'is'} readable and writable`); - * }); - * ``` - * - * Do not use `fs.access()` to check for the accessibility of a file before calling `fs.open()`, `fs.readFile()`, or `fs.writeFile()`. Doing - * so introduces a race condition, since other processes may change the file's - * state between the two calls. Instead, user code should open/read/write the - * file directly and handle the error raised if the file is not accessible. - * - * **write (NOT RECOMMENDED)** - * - * ```js - * import { access, open, close } from 'node:fs'; - * - * access('myfile', (err) => { - * if (!err) { - * console.error('myfile already exists'); - * return; - * } - * - * open('myfile', 'wx', (err, fd) => { - * if (err) throw err; - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * }); - * ``` - * - * **write (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * - * open('myfile', 'wx', (err, fd) => { - * if (err) { - * if (err.code === 'EEXIST') { - * console.error('myfile already exists'); - * return; - * } - * - * throw err; - * } - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * **read (NOT RECOMMENDED)** - * - * ```js - * import { access, open, close } from 'node:fs'; - * access('myfile', (err) => { - * if (err) { - * if (err.code === 'ENOENT') { - * console.error('myfile does not exist'); - * return; - * } - * - * throw err; - * } - * - * open('myfile', 'r', (err, fd) => { - * if (err) throw err; - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * }); - * ``` - * - * **read (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * - * open('myfile', 'r', (err, fd) => { - * if (err) { - * if (err.code === 'ENOENT') { - * console.error('myfile does not exist'); - * return; - * } - * - * throw err; - * } - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * The "not recommended" examples above check for accessibility and then use the - * file; the "recommended" examples are better because they use the file directly - * and handle the error, if any. - * - * In general, check for the accessibility of a file only if the file will not be - * used directly, for example when its accessibility is a signal from another - * process. - * - * On Windows, access-control policies (ACLs) on a directory may limit access to - * a file or directory. The `fs.access()` function, however, does not check the - * ACL and therefore may report that a path is accessible even if the ACL restricts - * the user from reading or writing to it. - * @since v0.11.15 - * @param [mode=fs.constants.F_OK] - */ - export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void; - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - */ - export function access(path: PathLike, callback: NoParamCallback): void; - export namespace access { - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike, mode?: number): Promise; - } - /** - * Synchronously tests a user's permissions for the file or directory specified - * by `path`. The `mode` argument is an optional integer that specifies the - * accessibility checks to be performed. `mode` should be either the value `fs.constants.F_OK` or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`, `fs.constants.W_OK`, and - * `fs.constants.X_OK` (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for - * possible values of `mode`. - * - * If any of the accessibility checks fail, an `Error` will be thrown. Otherwise, - * the method will return `undefined`. - * - * ```js - * import { accessSync, constants } from 'node:fs'; - * - * try { - * accessSync('etc/passwd', constants.R_OK | constants.W_OK); - * console.log('can read/write'); - * } catch (err) { - * console.error('no access!'); - * } - * ``` - * @since v0.11.15 - * @param [mode=fs.constants.F_OK] - */ - export function accessSync(path: PathLike, mode?: number): void; - interface StreamOptions { - flags?: string | undefined; - encoding?: BufferEncoding | undefined; - fd?: number | promises.FileHandle | undefined; - mode?: number | undefined; - autoClose?: boolean | undefined; - emitClose?: boolean | undefined; - start?: number | undefined; - signal?: AbortSignal | null | undefined; - highWaterMark?: number | undefined; - } - interface FSImplementation { - open?: (...args: any[]) => any; - close?: (...args: any[]) => any; - } - interface CreateReadStreamFSImplementation extends FSImplementation { - read: (...args: any[]) => any; - } - interface CreateWriteStreamFSImplementation extends FSImplementation { - write: (...args: any[]) => any; - writev?: (...args: any[]) => any; - } - interface ReadStreamOptions extends StreamOptions { - fs?: CreateReadStreamFSImplementation | null | undefined; - end?: number | undefined; - } - interface WriteStreamOptions extends StreamOptions { - fs?: CreateWriteStreamFSImplementation | null | undefined; - flush?: boolean | undefined; - } - /** - * `options` can include `start` and `end` values to read a range of bytes from - * the file instead of the entire file. Both `start` and `end` are inclusive and - * start counting at 0, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `fd` is specified and `start` is - * omitted or `undefined`, `fs.createReadStream()` reads sequentially from the - * current file position. The `encoding` can be any one of those accepted by `Buffer`. - * - * If `fd` is specified, `ReadStream` will ignore the `path` argument and will use - * the specified file descriptor. This means that no `'open'` event will be - * emitted. `fd` should be blocking; non-blocking `fd`s should be passed to `net.Socket`. - * - * If `fd` points to a character device that only supports blocking reads - * (such as keyboard or sound card), read operations do not finish until data is - * available. This can prevent the process from exiting and the stream from - * closing naturally. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * - * By providing the `fs` option, it is possible to override the corresponding `fs` implementations for `open`, `read`, and `close`. When providing the `fs` option, - * an override for `read` is required. If no `fd` is provided, an override for `open` is also required. If `autoClose` is `true`, an override for `close` is - * also required. - * - * ```js - * import { createReadStream } from 'node:fs'; - * - * // Create a stream from some character device. - * const stream = createReadStream('/dev/input/event0'); - * setTimeout(() => { - * stream.close(); // This may not close the stream. - * // Artificially marking end-of-stream, as if the underlying resource had - * // indicated end-of-file by itself, allows the stream to close. - * // This does not cancel pending read operations, and if there is such an - * // operation, the process may still not be able to exit successfully - * // until it finishes. - * stream.push(null); - * stream.read(0); - * }, 100); - * ``` - * - * If `autoClose` is false, then the file descriptor won't be closed, even if - * there's an error. It is the application's responsibility to close it and make - * sure there's no file descriptor leak. If `autoClose` is set to true (default - * behavior), on `'error'` or `'end'` the file descriptor will be closed - * automatically. - * - * `mode` sets the file mode (permission and sticky bits), but only if the - * file was created. - * - * An example to read the last 10 bytes of a file which is 100 bytes long: - * - * ```js - * import { createReadStream } from 'node:fs'; - * - * createReadStream('sample.txt', { start: 90, end: 99 }); - * ``` - * - * If `options` is a string, then it specifies the encoding. - * @since v0.1.31 - */ - export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream; - /** - * `options` may also include a `start` option to allow writing data at some - * position past the beginning of the file, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than - * replacing it may require the `flags` option to be set to `r+` rather than the - * default `w`. The `encoding` can be any one of those accepted by `Buffer`. - * - * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'` the file descriptor will be closed automatically. If `autoClose` is false, - * then the file descriptor won't be closed, even if there's an error. - * It is the application's responsibility to close it and make sure there's no - * file descriptor leak. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * - * By providing the `fs` option it is possible to override the corresponding `fs` implementations for `open`, `write`, `writev`, and `close`. Overriding `write()` without `writev()` can reduce - * performance as some optimizations (`_writev()`) - * will be disabled. When providing the `fs` option, overrides for at least one of `write` and `writev` are required. If no `fd` option is supplied, an override - * for `open` is also required. If `autoClose` is `true`, an override for `close` is also required. - * - * Like `fs.ReadStream`, if `fd` is specified, `fs.WriteStream` will ignore the `path` argument and will use the specified file descriptor. This means that no `'open'` event will be - * emitted. `fd` should be blocking; non-blocking `fd`s - * should be passed to `net.Socket`. - * - * If `options` is a string, then it specifies the encoding. - * @since v0.1.31 - */ - export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream; - /** - * Forces all currently queued I/O operations associated with the file to the - * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other - * than a possible - * exception are given to the completion callback. - * @since v0.1.96 - */ - export function fdatasync(fd: number, callback: NoParamCallback): void; - export namespace fdatasync { - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - /** - * Forces all currently queued I/O operations associated with the file to the - * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`. - * @since v0.1.96 - */ - export function fdatasyncSync(fd: number): void; - /** - * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it - * already exists. No arguments other than a possible exception are given to the - * callback function. Node.js makes no guarantees about the atomicity of the copy - * operation. If an error occurs after the destination file has been opened for - * writing, Node.js will attempt to remove the destination. - * - * `mode` is an optional integer that specifies the behavior - * of the copy operation. It is possible to create a mask consisting of the bitwise - * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). - * - * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already - * exists. - * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a - * copy-on-write reflink. If the platform does not support copy-on-write, then a - * fallback copy mechanism is used. - * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to - * create a copy-on-write reflink. If the platform does not support - * copy-on-write, then the operation will fail. - * - * ```js - * import { copyFile, constants } from 'node:fs'; - * - * function callback(err) { - * if (err) throw err; - * console.log('source.txt was copied to destination.txt'); - * } - * - * // destination.txt will be created or overwritten by default. - * copyFile('source.txt', 'destination.txt', callback); - * - * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. - * copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL, callback); - * ``` - * @since v8.5.0 - * @param src source filename to copy - * @param dest destination filename of the copy operation - * @param [mode=0] modifiers for copy operation. - */ - export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void; - export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void; - export namespace copyFile { - function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise; - } - /** - * Synchronously copies `src` to `dest`. By default, `dest` is overwritten if it - * already exists. Returns `undefined`. Node.js makes no guarantees about the - * atomicity of the copy operation. If an error occurs after the destination file - * has been opened for writing, Node.js will attempt to remove the destination. - * - * `mode` is an optional integer that specifies the behavior - * of the copy operation. It is possible to create a mask consisting of the bitwise - * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). - * - * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already - * exists. - * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a - * copy-on-write reflink. If the platform does not support copy-on-write, then a - * fallback copy mechanism is used. - * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to - * create a copy-on-write reflink. If the platform does not support - * copy-on-write, then the operation will fail. - * - * ```js - * import { copyFileSync, constants } from 'node:fs'; - * - * // destination.txt will be created or overwritten by default. - * copyFileSync('source.txt', 'destination.txt'); - * console.log('source.txt was copied to destination.txt'); - * - * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. - * copyFileSync('source.txt', 'destination.txt', constants.COPYFILE_EXCL); - * ``` - * @since v8.5.0 - * @param src source filename to copy - * @param dest destination filename of the copy operation - * @param [mode=0] modifiers for copy operation. - */ - export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void; - /** - * Write an array of `ArrayBufferView`s to the file specified by `fd` using `writev()`. - * - * `position` is the offset from the beginning of the file where this data - * should be written. If `typeof position !== 'number'`, the data will be written - * at the current position. - * - * The callback will be given three arguments: `err`, `bytesWritten`, and `buffers`. `bytesWritten` is how many bytes were written from `buffers`. - * - * If this method is `util.promisify()` ed, it returns a promise for an `Object` with `bytesWritten` and `buffers` properties. - * - * It is unsafe to use `fs.writev()` multiple times on the same file without - * waiting for the callback. For this scenario, use {@link createWriteStream}. - * - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v12.9.0 - * @param [position='null'] - */ - export function writev( - fd: number, - buffers: TBuffers, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void, - ): void; - export function writev( - fd: number, - buffers: TBuffers, - position: number | null, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void, - ): void; - // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314 - // TODO: remove default in future major version - export interface WriteVResult { - bytesWritten: number; - buffers: T; - } - export namespace writev { - function __promisify__( - fd: number, - buffers: TBuffers, - position?: number, - ): Promise>; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link writev}. - * @since v12.9.0 - * @param [position='null'] - * @return The number of bytes written. - */ - export function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number; - /** - * Read from a file specified by `fd` and write to an array of `ArrayBufferView`s - * using `readv()`. - * - * `position` is the offset from the beginning of the file from where data - * should be read. If `typeof position !== 'number'`, the data will be read - * from the current position. - * - * The callback will be given three arguments: `err`, `bytesRead`, and `buffers`. `bytesRead` is how many bytes were read from the file. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a promise for an `Object` with `bytesRead` and `buffers` properties. - * @since v13.13.0, v12.17.0 - * @param [position='null'] - */ - export function readv( - fd: number, - buffers: TBuffers, - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void, - ): void; - export function readv( - fd: number, - buffers: TBuffers, - position: number | null, - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void, - ): void; - // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314 - // TODO: remove default in future major version - export interface ReadVResult { - bytesRead: number; - buffers: T; - } - export namespace readv { - function __promisify__( - fd: number, - buffers: TBuffers, - position?: number, - ): Promise>; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link readv}. - * @since v13.13.0, v12.17.0 - * @param [position='null'] - * @return The number of bytes read. - */ - export function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number; - - export interface OpenAsBlobOptions { - /** - * An optional mime type for the blob. - * - * @default 'undefined' - */ - type?: string | undefined; - } - - /** - * Returns a `Blob` whose data is backed by the given file. - * - * The file must not be modified after the `Blob` is created. Any modifications - * will cause reading the `Blob` data to fail with a `DOMException` error. - * Synchronous stat operations on the file when the `Blob` is created, and before - * each read in order to detect whether the file data has been modified on disk. - * - * ```js - * import { openAsBlob } from 'node:fs'; - * - * const blob = await openAsBlob('the.file.txt'); - * const ab = await blob.arrayBuffer(); - * blob.stream(); - * ``` - * @since v19.8.0 - */ - export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise; - - export interface OpenDirOptions { - /** - * @default 'utf8' - */ - encoding?: BufferEncoding | undefined; - /** - * Number of directory entries that are buffered - * internally when reading from the directory. Higher values lead to better - * performance but higher memory usage. - * @default 32 - */ - bufferSize?: number | undefined; - /** - * @default false - */ - recursive?: boolean | undefined; - } - /** - * Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html). - * - * Creates an `fs.Dir`, which contains all further functions for reading from - * and cleaning up the directory. - * - * The `encoding` option sets the encoding for the `path` while opening the - * directory and subsequent read operations. - * @since v12.12.0 - */ - export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir; - /** - * Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for - * more details. - * - * Creates an `fs.Dir`, which contains all further functions for reading from - * and cleaning up the directory. - * - * The `encoding` option sets the encoding for the `path` while opening the - * directory and subsequent read operations. - * @since v12.12.0 - */ - export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; - export function opendir( - path: PathLike, - options: OpenDirOptions, - cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void, - ): void; - export namespace opendir { - function __promisify__(path: PathLike, options?: OpenDirOptions): Promise; - } - export interface BigIntStats extends StatsBase { - atimeNs: bigint; - mtimeNs: bigint; - ctimeNs: bigint; - birthtimeNs: bigint; - } - export interface BigIntOptions { - bigint: true; - } - export interface StatOptions { - bigint?: boolean | undefined; - } - export interface StatSyncOptions extends StatOptions { - throwIfNoEntry?: boolean | undefined; - } - interface CopyOptionsBase { - /** - * Dereference symlinks - * @default false - */ - dereference?: boolean | undefined; - /** - * When `force` is `false`, and the destination - * exists, throw an error. - * @default false - */ - errorOnExist?: boolean | undefined; - /** - * Overwrite existing file or directory. _The copy - * operation will ignore errors if you set this to false and the destination - * exists. Use the `errorOnExist` option to change this behavior. - * @default true - */ - force?: boolean | undefined; - /** - * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()} - */ - mode?: number | undefined; - /** - * When `true` timestamps from `src` will - * be preserved. - * @default false - */ - preserveTimestamps?: boolean | undefined; - /** - * Copy directories recursively. - * @default false - */ - recursive?: boolean | undefined; - /** - * When true, path resolution for symlinks will be skipped - * @default false - */ - verbatimSymlinks?: boolean | undefined; - } - export interface CopyOptions extends CopyOptionsBase { - /** - * Function to filter copied files/directories. Return - * `true` to copy the item, `false` to ignore it. - */ - filter?: ((source: string, destination: string) => boolean | Promise) | undefined; - } - export interface CopySyncOptions extends CopyOptionsBase { - /** - * Function to filter copied files/directories. Return - * `true` to copy the item, `false` to ignore it. - */ - filter?: ((source: string, destination: string) => boolean) | undefined; - } - /** - * Asynchronously copies the entire directory structure from `src` to `dest`, - * including subdirectories and files. - * - * When copying a directory to another directory, globs are not supported and - * behavior is similar to `cp dir1/ dir2/`. - * @since v16.7.0 - * @experimental - * @param src source path to copy. - * @param dest destination path to copy to. - */ - export function cp( - source: string | URL, - destination: string | URL, - callback: (err: NodeJS.ErrnoException | null) => void, - ): void; - export function cp( - source: string | URL, - destination: string | URL, - opts: CopyOptions, - callback: (err: NodeJS.ErrnoException | null) => void, - ): void; - /** - * Synchronously copies the entire directory structure from `src` to `dest`, - * including subdirectories and files. - * - * When copying a directory to another directory, globs are not supported and - * behavior is similar to `cp dir1/ dir2/`. - * @since v16.7.0 - * @experimental - * @param src source path to copy. - * @param dest destination path to copy to. - */ - export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void; - - interface _GlobOptions { - /** - * Current working directory. - * @default process.cwd() - */ - cwd?: string | URL | undefined; - /** - * `true` if the glob should return paths as `Dirent`s, `false` otherwise. - * @default false - * @since v22.2.0 - */ - withFileTypes?: boolean | undefined; - /** - * Function to filter out files/directories or a - * list of glob patterns to be excluded. If a function is provided, return - * `true` to exclude the item, `false` to include it. - * @default undefined - */ - exclude?: ((fileName: T) => boolean) | readonly string[] | undefined; - } - export interface GlobOptions extends _GlobOptions {} - export interface GlobOptionsWithFileTypes extends _GlobOptions { - withFileTypes: true; - } - export interface GlobOptionsWithoutFileTypes extends _GlobOptions { - withFileTypes?: false | undefined; - } - - /** - * Retrieves the files matching the specified pattern. - * - * ```js - * import { glob } from 'node:fs'; - * - * glob('*.js', (err, matches) => { - * if (err) throw err; - * console.log(matches); - * }); - * ``` - * @since v22.0.0 - */ - export function glob( - pattern: string | readonly string[], - callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void, - ): void; - export function glob( - pattern: string | readonly string[], - options: GlobOptionsWithFileTypes, - callback: ( - err: NodeJS.ErrnoException | null, - matches: Dirent[], - ) => void, - ): void; - export function glob( - pattern: string | readonly string[], - options: GlobOptionsWithoutFileTypes, - callback: ( - err: NodeJS.ErrnoException | null, - matches: string[], - ) => void, - ): void; - export function glob( - pattern: string | readonly string[], - options: GlobOptions, - callback: ( - err: NodeJS.ErrnoException | null, - matches: Dirent[] | string[], - ) => void, - ): void; - /** - * ```js - * import { globSync } from 'node:fs'; - * - * console.log(globSync('*.js')); - * ``` - * @since v22.0.0 - * @returns paths of files that match the pattern. - */ - export function globSync(pattern: string | readonly string[]): string[]; - export function globSync( - pattern: string | readonly string[], - options: GlobOptionsWithFileTypes, - ): Dirent[]; - export function globSync( - pattern: string | readonly string[], - options: GlobOptionsWithoutFileTypes, - ): string[]; - export function globSync( - pattern: string | readonly string[], - options: GlobOptions, - ): Dirent[] | string[]; -} -declare module "node:fs" { - export * from "fs"; -} diff --git a/node_modules/@types/node/fs/promises.d.ts b/node_modules/@types/node/fs/promises.d.ts deleted file mode 100644 index 051ddba..0000000 --- a/node_modules/@types/node/fs/promises.d.ts +++ /dev/null @@ -1,1295 +0,0 @@ -/** - * The `fs/promises` API provides asynchronous file system methods that return - * promises. - * - * The promise APIs use the underlying Node.js threadpool to perform file - * system operations off the event loop thread. These operations are not - * synchronized or threadsafe. Care must be taken when performing multiple - * concurrent modifications on the same file or data corruption may occur. - * @since v10.0.0 - */ -declare module "fs/promises" { - import { NonSharedBuffer } from "node:buffer"; - import { Abortable } from "node:events"; - import { Stream } from "node:stream"; - import { ReadableStream } from "node:stream/web"; - import { - BigIntStats, - BigIntStatsFs, - BufferEncodingOption, - constants as fsConstants, - CopyOptions, - Dir, - Dirent, - GlobOptions, - GlobOptionsWithFileTypes, - GlobOptionsWithoutFileTypes, - MakeDirectoryOptions, - Mode, - ObjectEncodingOptions, - OpenDirOptions, - OpenMode, - PathLike, - ReadOptions, - ReadOptionsWithBuffer, - ReadPosition, - ReadStream, - ReadVResult, - RmDirOptions, - RmOptions, - StatFsOptions, - StatOptions, - Stats, - StatsFs, - TimeLike, - WatchEventType, - WatchOptions as _WatchOptions, - WriteStream, - WriteVResult, - } from "node:fs"; - import { Interface as ReadlineInterface } from "node:readline"; - interface FileChangeInfo { - eventType: WatchEventType; - filename: T | null; - } - interface FlagAndOpenMode { - mode?: Mode | undefined; - flag?: OpenMode | undefined; - } - interface FileReadResult { - bytesRead: number; - buffer: T; - } - /** @deprecated This interface will be removed in a future version. Use `import { ReadOptionsWithBuffer } from "node:fs"` instead. */ - interface FileReadOptions { - /** - * @default `Buffer.alloc(0xffff)` - */ - buffer?: T; - /** - * @default 0 - */ - offset?: number | null; - /** - * @default `buffer.byteLength` - */ - length?: number | null; - position?: ReadPosition | null; - } - interface CreateReadStreamOptions extends Abortable { - encoding?: BufferEncoding | null | undefined; - autoClose?: boolean | undefined; - emitClose?: boolean | undefined; - start?: number | undefined; - end?: number | undefined; - highWaterMark?: number | undefined; - } - interface CreateWriteStreamOptions { - encoding?: BufferEncoding | null | undefined; - autoClose?: boolean | undefined; - emitClose?: boolean | undefined; - start?: number | undefined; - highWaterMark?: number | undefined; - flush?: boolean | undefined; - } - interface ReadableWebStreamOptions { - autoClose?: boolean | undefined; - } - // TODO: Add `EventEmitter` close - interface FileHandle { - /** - * The numeric file descriptor managed by the {FileHandle} object. - * @since v10.0.0 - */ - readonly fd: number; - /** - * Alias of `filehandle.writeFile()`. - * - * When operating on file handles, the mode cannot be changed from what it was set - * to with `fsPromises.open()`. Therefore, this is equivalent to `filehandle.writeFile()`. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - appendFile( - data: string | Uint8Array, - options?: - | (ObjectEncodingOptions & Abortable) - | BufferEncoding - | null, - ): Promise; - /** - * Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html). - * @since v10.0.0 - * @param uid The file's new owner's user id. - * @param gid The file's new group's group id. - * @return Fulfills with `undefined` upon success. - */ - chown(uid: number, gid: number): Promise; - /** - * Modifies the permissions on the file. See [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html). - * @since v10.0.0 - * @param mode the file mode bit mask. - * @return Fulfills with `undefined` upon success. - */ - chmod(mode: Mode): Promise; - /** - * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream - * returned by this method has a default `highWaterMark` of 64 KiB. - * - * `options` can include `start` and `end` values to read a range of bytes from - * the file instead of the entire file. Both `start` and `end` are inclusive and - * start counting at 0, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `start` is - * omitted or `undefined`, `filehandle.createReadStream()` reads sequentially from - * the current file position. The `encoding` can be any one of those accepted by `Buffer`. - * - * If the `FileHandle` points to a character device that only supports blocking - * reads (such as keyboard or sound card), read operations do not finish until data - * is available. This can prevent the process from exiting and the stream from - * closing naturally. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * - * ```js - * import { open } from 'node:fs/promises'; - * - * const fd = await open('/dev/input/event0'); - * // Create a stream from some character device. - * const stream = fd.createReadStream(); - * setTimeout(() => { - * stream.close(); // This may not close the stream. - * // Artificially marking end-of-stream, as if the underlying resource had - * // indicated end-of-file by itself, allows the stream to close. - * // This does not cancel pending read operations, and if there is such an - * // operation, the process may still not be able to exit successfully - * // until it finishes. - * stream.push(null); - * stream.read(0); - * }, 100); - * ``` - * - * If `autoClose` is false, then the file descriptor won't be closed, even if - * there's an error. It is the application's responsibility to close it and make - * sure there's no file descriptor leak. If `autoClose` is set to true (default - * behavior), on `'error'` or `'end'` the file descriptor will be closed - * automatically. - * - * An example to read the last 10 bytes of a file which is 100 bytes long: - * - * ```js - * import { open } from 'node:fs/promises'; - * - * const fd = await open('sample.txt'); - * fd.createReadStream({ start: 90, end: 99 }); - * ``` - * @since v16.11.0 - */ - createReadStream(options?: CreateReadStreamOptions): ReadStream; - /** - * `options` may also include a `start` option to allow writing data at some - * position past the beginning of the file, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than - * replacing it may require the `flags` `open` option to be set to `r+` rather than - * the default `r`. The `encoding` can be any one of those accepted by `Buffer`. - * - * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'` the file descriptor will be closed automatically. If `autoClose` is false, - * then the file descriptor won't be closed, even if there's an error. - * It is the application's responsibility to close it and make sure there's no - * file descriptor leak. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * @since v16.11.0 - */ - createWriteStream(options?: CreateWriteStreamOptions): WriteStream; - /** - * Forces all currently queued I/O operations associated with the file to the - * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. - * - * Unlike `filehandle.sync` this method does not flush modified metadata. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - datasync(): Promise; - /** - * Request that all data for the open file descriptor is flushed to the storage - * device. The specific implementation is operating system and device specific. - * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - sync(): Promise; - /** - * Reads data from the file and stores that in the given buffer. - * - * If the file is not modified concurrently, the end-of-file is reached when the - * number of bytes read is zero. - * @since v10.0.0 - * @param buffer A buffer that will be filled with the file data read. - * @param offset The location in the buffer at which to start filling. - * @param length The number of bytes to read. - * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an - * integer, the current file position will remain unchanged. - * @return Fulfills upon success with an object with two properties: - */ - read( - buffer: T, - offset?: number | null, - length?: number | null, - position?: ReadPosition | null, - ): Promise>; - read( - buffer: T, - options?: ReadOptions, - ): Promise>; - read( - options?: ReadOptionsWithBuffer, - ): Promise>; - /** - * Returns a byte-oriented `ReadableStream` that may be used to read the file's - * contents. - * - * An error will be thrown if this method is called more than once or is called - * after the `FileHandle` is closed or closing. - * - * ```js - * import { - * open, - * } from 'node:fs/promises'; - * - * const file = await open('./some/file/to/read'); - * - * for await (const chunk of file.readableWebStream()) - * console.log(chunk); - * - * await file.close(); - * ``` - * - * While the `ReadableStream` will read the file to completion, it will not - * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method. - * @since v17.0.0 - */ - readableWebStream(options?: ReadableWebStreamOptions): ReadableStream; - /** - * Asynchronously reads the entire contents of a file. - * - * If `options` is a string, then it specifies the `encoding`. - * - * The `FileHandle` has to support reading. - * - * If one or more `filehandle.read()` calls are made on a file handle and then a `filehandle.readFile()` call is made, the data will be read from the current - * position till the end of the file. It doesn't always read from the beginning - * of the file. - * @since v10.0.0 - * @return Fulfills upon a successful read with the contents of the file. If no encoding is specified (using `options.encoding`), the data is returned as a {Buffer} object. Otherwise, the - * data will be a string. - */ - readFile( - options?: - | ({ encoding?: null | undefined } & Abortable) - | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - */ - readFile( - options: - | ({ encoding: BufferEncoding } & Abortable) - | BufferEncoding, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - */ - readFile( - options?: - | (ObjectEncodingOptions & Abortable) - | BufferEncoding - | null, - ): Promise; - /** - * Convenience method to create a `readline` interface and stream over the file. - * See `filehandle.createReadStream()` for the options. - * - * ```js - * import { open } from 'node:fs/promises'; - * - * const file = await open('./some/file/to/read'); - * - * for await (const line of file.readLines()) { - * console.log(line); - * } - * ``` - * @since v18.11.0 - */ - readLines(options?: CreateReadStreamOptions): ReadlineInterface; - /** - * @since v10.0.0 - * @return Fulfills with an {fs.Stats} for the file. - */ - stat( - opts?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - stat( - opts: StatOptions & { - bigint: true; - }, - ): Promise; - stat(opts?: StatOptions): Promise; - /** - * Truncates the file. - * - * If the file was larger than `len` bytes, only the first `len` bytes will be - * retained in the file. - * - * The following example retains only the first four bytes of the file: - * - * ```js - * import { open } from 'node:fs/promises'; - * - * let filehandle = null; - * try { - * filehandle = await open('temp.txt', 'r+'); - * await filehandle.truncate(4); - * } finally { - * await filehandle?.close(); - * } - * ``` - * - * If the file previously was shorter than `len` bytes, it is extended, and the - * extended part is filled with null bytes (`'\0'`): - * - * If `len` is negative then `0` will be used. - * @since v10.0.0 - * @param [len=0] - * @return Fulfills with `undefined` upon success. - */ - truncate(len?: number): Promise; - /** - * Change the file system timestamps of the object referenced by the `FileHandle` then fulfills the promise with no arguments upon success. - * @since v10.0.0 - */ - utimes(atime: TimeLike, mtime: TimeLike): Promise; - /** - * Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an - * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an - * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. - * The promise is fulfilled with no arguments upon success. - * - * If `options` is a string, then it specifies the `encoding`. - * - * The `FileHandle` has to support writing. - * - * It is unsafe to use `filehandle.writeFile()` multiple times on the same file - * without waiting for the promise to be fulfilled (or rejected). - * - * If one or more `filehandle.write()` calls are made on a file handle and then a`filehandle.writeFile()` call is made, the data will be written from the - * current position till the end of the file. It doesn't always write from the - * beginning of the file. - * @since v10.0.0 - */ - writeFile( - data: string | Uint8Array, - options?: - | (ObjectEncodingOptions & Abortable) - | BufferEncoding - | null, - ): Promise; - /** - * Write `buffer` to the file. - * - * The promise is fulfilled with an object containing two properties: - * - * It is unsafe to use `filehandle.write()` multiple times on the same file - * without waiting for the promise to be fulfilled (or rejected). For this - * scenario, use `filehandle.createWriteStream()`. - * - * On Linux, positional writes do not work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v10.0.0 - * @param offset The start position from within `buffer` where the data to write begins. - * @param [length=buffer.byteLength - offset] The number of bytes from `buffer` to write. - * @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current - * position. See the POSIX pwrite(2) documentation for more detail. - */ - write( - buffer: TBuffer, - offset?: number | null, - length?: number | null, - position?: number | null, - ): Promise<{ - bytesWritten: number; - buffer: TBuffer; - }>; - write( - buffer: TBuffer, - options?: { offset?: number; length?: number; position?: number }, - ): Promise<{ - bytesWritten: number; - buffer: TBuffer; - }>; - write( - data: string, - position?: number | null, - encoding?: BufferEncoding | null, - ): Promise<{ - bytesWritten: number; - buffer: string; - }>; - /** - * Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file. - * - * The promise is fulfilled with an object containing a two properties: - * - * It is unsafe to call `writev()` multiple times on the same file without waiting - * for the promise to be fulfilled (or rejected). - * - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v12.9.0 - * @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current - * position. - */ - writev( - buffers: TBuffers, - position?: number, - ): Promise>; - /** - * Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s - * @since v13.13.0, v12.17.0 - * @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position. - * @return Fulfills upon success an object containing two properties: - */ - readv( - buffers: TBuffers, - position?: number, - ): Promise>; - /** - * Closes the file handle after waiting for any pending operation on the handle to - * complete. - * - * ```js - * import { open } from 'node:fs/promises'; - * - * let filehandle; - * try { - * filehandle = await open('thefile.txt', 'r'); - * } finally { - * await filehandle?.close(); - * } - * ``` - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - close(): Promise; - /** - * Calls `filehandle.close()` and returns a promise that fulfills when the - * filehandle is closed. - * @since v20.4.0 - */ - [Symbol.asyncDispose](): Promise; - } - const constants: typeof fsConstants; - /** - * Tests a user's permissions for the file or directory specified by `path`. - * The `mode` argument is an optional integer that specifies the accessibility - * checks to be performed. `mode` should be either the value `fs.constants.F_OK` or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`, `fs.constants.W_OK`, and `fs.constants.X_OK` - * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for - * possible values of `mode`. - * - * If the accessibility check is successful, the promise is fulfilled with no - * value. If any of the accessibility checks fail, the promise is rejected - * with an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and - * written by the current process. - * - * ```js - * import { access, constants } from 'node:fs/promises'; - * - * try { - * await access('/etc/passwd', constants.R_OK | constants.W_OK); - * console.log('can access'); - * } catch { - * console.error('cannot access'); - * } - * ``` - * - * Using `fsPromises.access()` to check for the accessibility of a file before - * calling `fsPromises.open()` is not recommended. Doing so introduces a race - * condition, since other processes may change the file's state between the two - * calls. Instead, user code should open/read/write the file directly and handle - * the error raised if the file is not accessible. - * @since v10.0.0 - * @param [mode=fs.constants.F_OK] - * @return Fulfills with `undefined` upon success. - */ - function access(path: PathLike, mode?: number): Promise; - /** - * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it - * already exists. - * - * No guarantees are made about the atomicity of the copy operation. If an - * error occurs after the destination file has been opened for writing, an attempt - * will be made to remove the destination. - * - * ```js - * import { copyFile, constants } from 'node:fs/promises'; - * - * try { - * await copyFile('source.txt', 'destination.txt'); - * console.log('source.txt was copied to destination.txt'); - * } catch { - * console.error('The file could not be copied'); - * } - * - * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. - * try { - * await copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL); - * console.log('source.txt was copied to destination.txt'); - * } catch { - * console.error('The file could not be copied'); - * } - * ``` - * @since v10.0.0 - * @param src source filename to copy - * @param dest destination filename of the copy operation - * @param [mode=0] Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. - * `fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`) - * @return Fulfills with `undefined` upon success. - */ - function copyFile(src: PathLike, dest: PathLike, mode?: number): Promise; - /** - * Opens a `FileHandle`. - * - * Refer to the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more detail. - * - * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented - * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains - * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). - * @since v10.0.0 - * @param [flags='r'] See `support of file system `flags``. - * @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created. - * @return Fulfills with a {FileHandle} object. - */ - function open(path: PathLike, flags?: string | number, mode?: Mode): Promise; - /** - * Renames `oldPath` to `newPath`. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function rename(oldPath: PathLike, newPath: PathLike): Promise; - /** - * Truncates (shortens or extends the length) of the content at `path` to `len` bytes. - * @since v10.0.0 - * @param [len=0] - * @return Fulfills with `undefined` upon success. - */ - function truncate(path: PathLike, len?: number): Promise; - /** - * Removes the directory identified by `path`. - * - * Using `fsPromises.rmdir()` on a file (not a directory) results in the - * promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR` error on POSIX. - * - * To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` with options `{ recursive: true, force: true }`. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function rmdir(path: PathLike, options?: RmDirOptions): Promise; - /** - * Removes files and directories (modeled on the standard POSIX `rm` utility). - * @since v14.14.0 - * @return Fulfills with `undefined` upon success. - */ - function rm(path: PathLike, options?: RmOptions): Promise; - /** - * Asynchronously creates a directory. - * - * The optional `options` argument can be an integer specifying `mode` (permission - * and sticky bits), or an object with a `mode` property and a `recursive` property indicating whether parent directories should be created. Calling `fsPromises.mkdir()` when `path` is a directory - * that exists results in a - * rejection only when `recursive` is false. - * - * ```js - * import { mkdir } from 'node:fs/promises'; - * - * try { - * const projectFolder = new URL('./test/project/', import.meta.url); - * const createDir = await mkdir(projectFolder, { recursive: true }); - * - * console.log(`created ${createDir}`); - * } catch (err) { - * console.error(err.message); - * } - * ``` - * @since v10.0.0 - * @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`. - */ - function mkdir( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir( - path: PathLike, - options?: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise; - /** - * Reads the contents of a directory. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the filenames. If the `encoding` is set to `'buffer'`, the filenames returned - * will be passed as `Buffer` objects. - * - * If `options.withFileTypes` is set to `true`, the returned array will contain `fs.Dirent` objects. - * - * ```js - * import { readdir } from 'node:fs/promises'; - * - * try { - * const files = await readdir(path); - * for (const file of files) - * console.log(file); - * } catch (err) { - * console.error(err); - * } - * ``` - * @since v10.0.0 - * @return Fulfills with an array of the names of the files in the directory excluding `'.'` and `'..'`. - */ - function readdir( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir( - path: PathLike, - options: - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | "buffer", - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - function readdir( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a directory. If a URL is provided, it must use the `file:` protocol. - * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`. - */ - function readdir( - path: PathLike, - options: { - encoding: "buffer"; - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Promise[]>; - /** - * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is - * fulfilled with the`linkString` upon success. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the link path returned. If the `encoding` is set to `'buffer'`, the link path - * returned will be passed as a `Buffer` object. - * @since v10.0.0 - * @return Fulfills with the `linkString` upon success. - */ - function readlink(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink( - path: PathLike, - options?: ObjectEncodingOptions | string | null, - ): Promise; - /** - * Creates a symbolic link. - * - * The `type` argument is only used on Windows platforms and can be one of `'dir'`, `'file'`, or `'junction'`. If the `type` argument is not a string, Node.js will - * autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not - * exist, `'file'` will be used. Windows junction points require the destination - * path to be absolute. When using `'junction'`, the `target` argument will - * automatically be normalized to absolute path. Junction points on NTFS volumes - * can only point to directories. - * @since v10.0.0 - * @param [type='null'] - * @return Fulfills with `undefined` upon success. - */ - function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; - /** - * Equivalent to `fsPromises.stat()` unless `path` refers to a symbolic link, - * in which case the link itself is stat-ed, not the file that it refers to. - * Refer to the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) document for more detail. - * @since v10.0.0 - * @return Fulfills with the {fs.Stats} object for the given symbolic link `path`. - */ - function lstat( - path: PathLike, - opts?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function lstat( - path: PathLike, - opts: StatOptions & { - bigint: true; - }, - ): Promise; - function lstat(path: PathLike, opts?: StatOptions): Promise; - /** - * @since v10.0.0 - * @return Fulfills with the {fs.Stats} object for the given `path`. - */ - function stat( - path: PathLike, - opts?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function stat( - path: PathLike, - opts: StatOptions & { - bigint: true; - }, - ): Promise; - function stat(path: PathLike, opts?: StatOptions): Promise; - /** - * @since v19.6.0, v18.15.0 - * @return Fulfills with the {fs.StatFs} object for the given `path`. - */ - function statfs( - path: PathLike, - opts?: StatFsOptions & { - bigint?: false | undefined; - }, - ): Promise; - function statfs( - path: PathLike, - opts: StatFsOptions & { - bigint: true; - }, - ): Promise; - function statfs(path: PathLike, opts?: StatFsOptions): Promise; - /** - * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function link(existingPath: PathLike, newPath: PathLike): Promise; - /** - * If `path` refers to a symbolic link, then the link is removed without affecting - * the file or directory to which that link refers. If the `path` refers to a file - * path that is not a symbolic link, the file is deleted. See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more detail. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function unlink(path: PathLike): Promise; - /** - * Changes the permissions of a file. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function chmod(path: PathLike, mode: Mode): Promise; - /** - * Changes the permissions on a symbolic link. - * - * This method is only implemented on macOS. - * @deprecated Since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function lchmod(path: PathLike, mode: Mode): Promise; - /** - * Changes the ownership on a symbolic link. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function lchown(path: PathLike, uid: number, gid: number): Promise; - /** - * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, with the difference that if the path refers to a - * symbolic link, then the link is not dereferenced: instead, the timestamps of - * the symbolic link itself are changed. - * @since v14.5.0, v12.19.0 - * @return Fulfills with `undefined` upon success. - */ - function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - /** - * Changes the ownership of a file. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function chown(path: PathLike, uid: number, gid: number): Promise; - /** - * Change the file system timestamps of the object referenced by `path`. - * - * The `atime` and `mtime` arguments follow these rules: - * - * * Values can be either numbers representing Unix epoch time, `Date`s, or a - * numeric string like `'123456789.0'`. - * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - /** - * Determines the actual location of `path` using the same semantics as the `fs.realpath.native()` function. - * - * Only paths that can be converted to UTF8 strings are supported. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the path. If the `encoding` is set to `'buffer'`, the path returned will be - * passed as a `Buffer` object. - * - * On Linux, when Node.js is linked against musl libc, the procfs file system must - * be mounted on `/proc` in order for this function to work. Glibc does not have - * this restriction. - * @since v10.0.0 - * @return Fulfills with the resolved path upon success. - */ - function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath( - path: PathLike, - options?: ObjectEncodingOptions | BufferEncoding | null, - ): Promise; - /** - * Creates a unique temporary directory. A unique directory name is generated by - * appending six random characters to the end of the provided `prefix`. Due to - * platform inconsistencies, avoid trailing `X` characters in `prefix`. Some - * platforms, notably the BSDs, can return more than six random characters, and - * replace trailing `X` characters in `prefix` with random characters. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * - * ```js - * import { mkdtemp } from 'node:fs/promises'; - * import { join } from 'node:path'; - * import { tmpdir } from 'node:os'; - * - * try { - * await mkdtemp(join(tmpdir(), 'foo-')); - * } catch (err) { - * console.error(err); - * } - * ``` - * - * The `fsPromises.mkdtemp()` method will append the six randomly selected - * characters directly to the `prefix` string. For instance, given a directory `/tmp`, if the intention is to create a temporary directory _within_ `/tmp`, the `prefix` must end with a trailing - * platform-specific path separator - * (`import { sep } from 'node:path'`). - * @since v10.0.0 - * @return Fulfills with a string containing the file system path of the newly created temporary directory. - */ - function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: BufferEncodingOption): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp( - prefix: string, - options?: ObjectEncodingOptions | BufferEncoding | null, - ): Promise; - /** - * Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an - * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an - * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. - * - * The `encoding` option is ignored if `data` is a buffer. - * - * If `options` is a string, then it specifies the encoding. - * - * The `mode` option only affects the newly created file. See `fs.open()` for more details. - * - * Any specified `FileHandle` has to support writing. - * - * It is unsafe to use `fsPromises.writeFile()` multiple times on the same file - * without waiting for the promise to be settled. - * - * Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience - * method that performs multiple `write` calls internally to write the buffer - * passed to it. For performance sensitive code consider using `fs.createWriteStream()` or `filehandle.createWriteStream()`. - * - * It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`. - * Cancelation is "best effort", and some amount of data is likely still - * to be written. - * - * ```js - * import { writeFile } from 'node:fs/promises'; - * import { Buffer } from 'node:buffer'; - * - * try { - * const controller = new AbortController(); - * const { signal } = controller; - * const data = new Uint8Array(Buffer.from('Hello Node.js')); - * const promise = writeFile('message.txt', data, { signal }); - * - * // Abort the request before the promise settles. - * controller.abort(); - * - * await promise; - * } catch (err) { - * // When a request is aborted - err is an AbortError - * console.error(err); - * } - * ``` - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.writeFile` performs. - * @since v10.0.0 - * @param file filename or `FileHandle` - * @return Fulfills with `undefined` upon success. - */ - function writeFile( - file: PathLike | FileHandle, - data: - | string - | NodeJS.ArrayBufferView - | Iterable - | AsyncIterable - | Stream, - options?: - | (ObjectEncodingOptions & { - mode?: Mode | undefined; - flag?: OpenMode | undefined; - /** - * If all data is successfully written to the file, and `flush` - * is `true`, `filehandle.sync()` is used to flush the data. - * @default false - */ - flush?: boolean | undefined; - } & Abortable) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronously append data to a file, creating the file if it does not yet - * exist. `data` can be a string or a `Buffer`. - * - * If `options` is a string, then it specifies the `encoding`. - * - * The `mode` option only affects the newly created file. See `fs.open()` for more details. - * - * The `path` may be specified as a `FileHandle` that has been opened - * for appending (using `fsPromises.open()`). - * @since v10.0.0 - * @param path filename or {FileHandle} - * @return Fulfills with `undefined` upon success. - */ - function appendFile( - path: PathLike | FileHandle, - data: string | Uint8Array, - options?: (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) | BufferEncoding | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * - * If no encoding is specified (using `options.encoding`), the data is returned - * as a `Buffer` object. Otherwise, the data will be a string. - * - * If `options` is a string, then it specifies the encoding. - * - * When the `path` is a directory, the behavior of `fsPromises.readFile()` is - * platform-specific. On macOS, Linux, and Windows, the promise will be rejected - * with an error. On FreeBSD, a representation of the directory's contents will be - * returned. - * - * An example of reading a `package.json` file located in the same directory of the - * running code: - * - * ```js - * import { readFile } from 'node:fs/promises'; - * try { - * const filePath = new URL('./package.json', import.meta.url); - * const contents = await readFile(filePath, { encoding: 'utf8' }); - * console.log(contents); - * } catch (err) { - * console.error(err.message); - * } - * ``` - * - * It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a - * request is aborted the promise returned is rejected with an `AbortError`: - * - * ```js - * import { readFile } from 'node:fs/promises'; - * - * try { - * const controller = new AbortController(); - * const { signal } = controller; - * const promise = readFile(fileName, { signal }); - * - * // Abort the request before the promise settles. - * controller.abort(); - * - * await promise; - * } catch (err) { - * // When a request is aborted - err is an AbortError - * console.error(err); - * } - * ``` - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.readFile` performs. - * - * Any specified `FileHandle` has to support reading. - * @since v10.0.0 - * @param path filename or `FileHandle` - * @return Fulfills with the contents of the file. - */ - function readFile( - path: PathLike | FileHandle, - options?: - | ({ - encoding?: null | undefined; - flag?: OpenMode | undefined; - } & Abortable) - | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile( - path: PathLike | FileHandle, - options: - | ({ - encoding: BufferEncoding; - flag?: OpenMode | undefined; - } & Abortable) - | BufferEncoding, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile( - path: PathLike | FileHandle, - options?: - | ( - & ObjectEncodingOptions - & Abortable - & { - flag?: OpenMode | undefined; - } - ) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail. - * - * Creates an `fs.Dir`, which contains all further functions for reading from - * and cleaning up the directory. - * - * The `encoding` option sets the encoding for the `path` while opening the - * directory and subsequent read operations. - * - * Example using async iteration: - * - * ```js - * import { opendir } from 'node:fs/promises'; - * - * try { - * const dir = await opendir('./'); - * for await (const dirent of dir) - * console.log(dirent.name); - * } catch (err) { - * console.error(err); - * } - * ``` - * - * When using the async iterator, the `fs.Dir` object will be automatically - * closed after the iterator exits. - * @since v12.12.0 - * @return Fulfills with an {fs.Dir}. - */ - function opendir(path: PathLike, options?: OpenDirOptions): Promise; - interface WatchOptions extends _WatchOptions { - maxQueue?: number | undefined; - overflow?: "ignore" | "throw" | undefined; - } - interface WatchOptionsWithBufferEncoding extends WatchOptions { - encoding: "buffer"; - } - interface WatchOptionsWithStringEncoding extends WatchOptions { - encoding?: BufferEncoding | undefined; - } - /** - * Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory. - * - * ```js - * import { watch } from 'node:fs/promises'; - * - * const ac = new AbortController(); - * const { signal } = ac; - * setTimeout(() => ac.abort(), 10000); - * - * (async () => { - * try { - * const watcher = watch(__filename, { signal }); - * for await (const event of watcher) - * console.log(event); - * } catch (err) { - * if (err.name === 'AbortError') - * return; - * throw err; - * } - * })(); - * ``` - * - * On most platforms, `'rename'` is emitted whenever a filename appears or - * disappears in the directory. - * - * All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`. - * @since v15.9.0, v14.18.0 - * @return of objects with the properties: - */ - function watch( - filename: PathLike, - options?: WatchOptionsWithStringEncoding | BufferEncoding, - ): NodeJS.AsyncIterator>; - function watch( - filename: PathLike, - options: WatchOptionsWithBufferEncoding | "buffer", - ): NodeJS.AsyncIterator>; - function watch( - filename: PathLike, - options: WatchOptions | BufferEncoding | "buffer", - ): NodeJS.AsyncIterator>; - /** - * Asynchronously copies the entire directory structure from `src` to `dest`, - * including subdirectories and files. - * - * When copying a directory to another directory, globs are not supported and - * behavior is similar to `cp dir1/ dir2/`. - * @since v16.7.0 - * @experimental - * @param src source path to copy. - * @param dest destination path to copy to. - * @return Fulfills with `undefined` upon success. - */ - function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise; - /** - * ```js - * import { glob } from 'node:fs/promises'; - * - * for await (const entry of glob('*.js')) - * console.log(entry); - * ``` - * @since v22.0.0 - * @returns An AsyncIterator that yields the paths of files - * that match the pattern. - */ - function glob(pattern: string | readonly string[]): NodeJS.AsyncIterator; - function glob( - pattern: string | readonly string[], - options: GlobOptionsWithFileTypes, - ): NodeJS.AsyncIterator; - function glob( - pattern: string | readonly string[], - options: GlobOptionsWithoutFileTypes, - ): NodeJS.AsyncIterator; - function glob( - pattern: string | readonly string[], - options: GlobOptions, - ): NodeJS.AsyncIterator; -} -declare module "node:fs/promises" { - export * from "fs/promises"; -} diff --git a/node_modules/@types/node/globals.d.ts b/node_modules/@types/node/globals.d.ts deleted file mode 100644 index 8358597..0000000 --- a/node_modules/@types/node/globals.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -declare var global: typeof globalThis; - -declare var process: NodeJS.Process; -declare var console: Console; - -interface ErrorConstructor { - /** - * Creates a `.stack` property on `targetObject`, which when accessed returns - * a string representing the location in the code at which - * `Error.captureStackTrace()` was called. - * - * ```js - * const myObject = {}; - * Error.captureStackTrace(myObject); - * myObject.stack; // Similar to `new Error().stack` - * ``` - * - * The first line of the trace will be prefixed with - * `${myObject.name}: ${myObject.message}`. - * - * The optional `constructorOpt` argument accepts a function. If given, all frames - * above `constructorOpt`, including `constructorOpt`, will be omitted from the - * generated stack trace. - * - * The `constructorOpt` argument is useful for hiding implementation - * details of error generation from the user. For instance: - * - * ```js - * function a() { - * b(); - * } - * - * function b() { - * c(); - * } - * - * function c() { - * // Create an error without stack trace to avoid calculating the stack trace twice. - * const { stackTraceLimit } = Error; - * Error.stackTraceLimit = 0; - * const error = new Error(); - * Error.stackTraceLimit = stackTraceLimit; - * - * // Capture the stack trace above function b - * Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace - * throw error; - * } - * - * a(); - * ``` - */ - captureStackTrace(targetObject: object, constructorOpt?: Function): void; - /** - * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces - */ - prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any; - /** - * The `Error.stackTraceLimit` property specifies the number of stack frames - * collected by a stack trace (whether generated by `new Error().stack` or - * `Error.captureStackTrace(obj)`). - * - * The default value is `10` but may be set to any valid JavaScript number. Changes - * will affect any stack trace captured _after_ the value has been changed. - * - * If set to a non-number value, or set to a negative number, stack traces will - * not capture any frames. - */ - stackTraceLimit: number; -} - -/** - * Enable this API with the `--expose-gc` CLI flag. - */ -declare var gc: NodeJS.GCFunction | undefined; - -declare namespace NodeJS { - interface CallSite { - getColumnNumber(): number | null; - getEnclosingColumnNumber(): number | null; - getEnclosingLineNumber(): number | null; - getEvalOrigin(): string | undefined; - getFileName(): string | null; - getFunction(): Function | undefined; - getFunctionName(): string | null; - getLineNumber(): number | null; - getMethodName(): string | null; - getPosition(): number; - getPromiseIndex(): number | null; - getScriptHash(): string; - getScriptNameOrSourceURL(): string | null; - getThis(): unknown; - getTypeName(): string | null; - isAsync(): boolean; - isConstructor(): boolean; - isEval(): boolean; - isNative(): boolean; - isPromiseAll(): boolean; - isToplevel(): boolean; - } - - interface ErrnoException extends Error { - errno?: number | undefined; - code?: string | undefined; - path?: string | undefined; - syscall?: string | undefined; - } - - interface ReadableStream extends EventEmitter { - readable: boolean; - read(size?: number): string | Buffer; - setEncoding(encoding: BufferEncoding): this; - pause(): this; - resume(): this; - isPaused(): boolean; - pipe(destination: T, options?: { end?: boolean | undefined }): T; - unpipe(destination?: WritableStream): this; - unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void; - wrap(oldStream: ReadableStream): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - interface WritableStream extends EventEmitter { - writable: boolean; - write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; - write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean; - end(cb?: () => void): this; - end(data: string | Uint8Array, cb?: () => void): this; - end(str: string, encoding?: BufferEncoding, cb?: () => void): this; - } - - interface ReadWriteStream extends ReadableStream, WritableStream {} - - interface RefCounted { - ref(): this; - unref(): this; - } - - interface Dict { - [key: string]: T | undefined; - } - - interface ReadOnlyDict { - readonly [key: string]: T | undefined; - } - - type PartialOptions = { [K in keyof T]?: T[K] | undefined }; - - interface GCFunction { - (minor?: boolean): void; - (options: NodeJS.GCOptions & { execution: "async" }): Promise; - (options: NodeJS.GCOptions): void; - } - - interface GCOptions { - execution?: "sync" | "async" | undefined; - flavor?: "regular" | "last-resort" | undefined; - type?: "major-snapshot" | "major" | "minor" | undefined; - filename?: string | undefined; - } - - /** An iterable iterator returned by the Node.js API. */ - // Default TReturn/TNext in v22 is `any`, for compatibility with the previously-used IterableIterator. - interface Iterator extends IteratorObject { - [Symbol.iterator](): NodeJS.Iterator; - } - - /** An async iterable iterator returned by the Node.js API. */ - // Default TReturn/TNext in v22 is `any`, for compatibility with the previously-used AsyncIterableIterator. - interface AsyncIterator extends AsyncIteratorObject { - [Symbol.asyncIterator](): NodeJS.AsyncIterator; - } -} diff --git a/node_modules/@types/node/globals.typedarray.d.ts b/node_modules/@types/node/globals.typedarray.d.ts deleted file mode 100644 index 8eafc3b..0000000 --- a/node_modules/@types/node/globals.typedarray.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -export {}; // Make this a module - -declare global { - namespace NodeJS { - type TypedArray = - | Uint8Array - | Uint8ClampedArray - | Uint16Array - | Uint32Array - | Int8Array - | Int16Array - | Int32Array - | BigUint64Array - | BigInt64Array - | Float32Array - | Float64Array; - type ArrayBufferView = - | TypedArray - | DataView; - - // The following aliases are required to allow use of non-shared ArrayBufferViews in @types/node - // while maintaining compatibility with TS <=5.6. - type NonSharedUint8Array = Uint8Array; - type NonSharedUint8ClampedArray = Uint8ClampedArray; - type NonSharedUint16Array = Uint16Array; - type NonSharedUint32Array = Uint32Array; - type NonSharedInt8Array = Int8Array; - type NonSharedInt16Array = Int16Array; - type NonSharedInt32Array = Int32Array; - type NonSharedBigUint64Array = BigUint64Array; - type NonSharedBigInt64Array = BigInt64Array; - type NonSharedFloat32Array = Float32Array; - type NonSharedFloat64Array = Float64Array; - type NonSharedDataView = DataView; - type NonSharedTypedArray = TypedArray; - type NonSharedArrayBufferView = ArrayBufferView; - } -} diff --git a/node_modules/@types/node/http.d.ts b/node_modules/@types/node/http.d.ts deleted file mode 100644 index af7d21c..0000000 --- a/node_modules/@types/node/http.d.ts +++ /dev/null @@ -1,2089 +0,0 @@ -/** - * To use the HTTP server and client one must import the `node:http` module. - * - * The HTTP interfaces in Node.js are designed to support many features - * of the protocol which have been traditionally difficult to use. - * In particular, large, possibly chunk-encoded, messages. The interface is - * careful to never buffer entire requests or responses, so the - * user is able to stream data. - * - * HTTP message headers are represented by an object like this: - * - * ```json - * { "content-length": "123", - * "content-type": "text/plain", - * "connection": "keep-alive", - * "host": "example.com", - * "accept": "*" } - * ``` - * - * Keys are lowercased. Values are not modified. - * - * In order to support the full spectrum of possible HTTP applications, the Node.js - * HTTP API is very low-level. It deals with stream handling and message - * parsing only. It parses a message into headers and body but it does not - * parse the actual headers or the body. - * - * See `message.headers` for details on how duplicate headers are handled. - * - * The raw headers as they were received are retained in the `rawHeaders` property, which is an array of `[key, value, key2, value2, ...]`. For - * example, the previous message header object might have a `rawHeaders` list like the following: - * - * ```js - * [ 'ConTent-Length', '123456', - * 'content-LENGTH', '123', - * 'content-type', 'text/plain', - * 'CONNECTION', 'keep-alive', - * 'Host', 'example.com', - * 'accepT', '*' ] - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/http.js) - */ -declare module "http" { - import { NonSharedBuffer } from "node:buffer"; - import * as stream from "node:stream"; - import { URL } from "node:url"; - import { LookupOptions } from "node:dns"; - import { EventEmitter } from "node:events"; - import { LookupFunction, Server as NetServer, Socket, TcpSocketConnectOpts } from "node:net"; - // incoming headers will never contain number - interface IncomingHttpHeaders extends NodeJS.Dict { - accept?: string | undefined; - "accept-encoding"?: string | undefined; - "accept-language"?: string | undefined; - "accept-patch"?: string | undefined; - "accept-ranges"?: string | undefined; - "access-control-allow-credentials"?: string | undefined; - "access-control-allow-headers"?: string | undefined; - "access-control-allow-methods"?: string | undefined; - "access-control-allow-origin"?: string | undefined; - "access-control-expose-headers"?: string | undefined; - "access-control-max-age"?: string | undefined; - "access-control-request-headers"?: string | undefined; - "access-control-request-method"?: string | undefined; - age?: string | undefined; - allow?: string | undefined; - "alt-svc"?: string | undefined; - authorization?: string | undefined; - "cache-control"?: string | undefined; - connection?: string | undefined; - "content-disposition"?: string | undefined; - "content-encoding"?: string | undefined; - "content-language"?: string | undefined; - "content-length"?: string | undefined; - "content-location"?: string | undefined; - "content-range"?: string | undefined; - "content-type"?: string | undefined; - cookie?: string | undefined; - date?: string | undefined; - etag?: string | undefined; - expect?: string | undefined; - expires?: string | undefined; - forwarded?: string | undefined; - from?: string | undefined; - host?: string | undefined; - "if-match"?: string | undefined; - "if-modified-since"?: string | undefined; - "if-none-match"?: string | undefined; - "if-unmodified-since"?: string | undefined; - "last-modified"?: string | undefined; - location?: string | undefined; - origin?: string | undefined; - pragma?: string | undefined; - "proxy-authenticate"?: string | undefined; - "proxy-authorization"?: string | undefined; - "public-key-pins"?: string | undefined; - range?: string | undefined; - referer?: string | undefined; - "retry-after"?: string | undefined; - "sec-fetch-site"?: string | undefined; - "sec-fetch-mode"?: string | undefined; - "sec-fetch-user"?: string | undefined; - "sec-fetch-dest"?: string | undefined; - "sec-websocket-accept"?: string | undefined; - "sec-websocket-extensions"?: string | undefined; - "sec-websocket-key"?: string | undefined; - "sec-websocket-protocol"?: string | undefined; - "sec-websocket-version"?: string | undefined; - "set-cookie"?: string[] | undefined; - "strict-transport-security"?: string | undefined; - tk?: string | undefined; - trailer?: string | undefined; - "transfer-encoding"?: string | undefined; - upgrade?: string | undefined; - "user-agent"?: string | undefined; - vary?: string | undefined; - via?: string | undefined; - warning?: string | undefined; - "www-authenticate"?: string | undefined; - } - // outgoing headers allows numbers (as they are converted internally to strings) - type OutgoingHttpHeader = number | string | string[]; - interface OutgoingHttpHeaders extends NodeJS.Dict { - accept?: string | string[] | undefined; - "accept-charset"?: string | string[] | undefined; - "accept-encoding"?: string | string[] | undefined; - "accept-language"?: string | string[] | undefined; - "accept-ranges"?: string | undefined; - "access-control-allow-credentials"?: string | undefined; - "access-control-allow-headers"?: string | undefined; - "access-control-allow-methods"?: string | undefined; - "access-control-allow-origin"?: string | undefined; - "access-control-expose-headers"?: string | undefined; - "access-control-max-age"?: string | undefined; - "access-control-request-headers"?: string | undefined; - "access-control-request-method"?: string | undefined; - age?: string | undefined; - allow?: string | undefined; - authorization?: string | undefined; - "cache-control"?: string | undefined; - "cdn-cache-control"?: string | undefined; - connection?: string | string[] | undefined; - "content-disposition"?: string | undefined; - "content-encoding"?: string | undefined; - "content-language"?: string | undefined; - "content-length"?: string | number | undefined; - "content-location"?: string | undefined; - "content-range"?: string | undefined; - "content-security-policy"?: string | undefined; - "content-security-policy-report-only"?: string | undefined; - "content-type"?: string | undefined; - cookie?: string | string[] | undefined; - dav?: string | string[] | undefined; - dnt?: string | undefined; - date?: string | undefined; - etag?: string | undefined; - expect?: string | undefined; - expires?: string | undefined; - forwarded?: string | undefined; - from?: string | undefined; - host?: string | undefined; - "if-match"?: string | undefined; - "if-modified-since"?: string | undefined; - "if-none-match"?: string | undefined; - "if-range"?: string | undefined; - "if-unmodified-since"?: string | undefined; - "last-modified"?: string | undefined; - link?: string | string[] | undefined; - location?: string | undefined; - "max-forwards"?: string | undefined; - origin?: string | undefined; - pragma?: string | string[] | undefined; - "proxy-authenticate"?: string | string[] | undefined; - "proxy-authorization"?: string | undefined; - "public-key-pins"?: string | undefined; - "public-key-pins-report-only"?: string | undefined; - range?: string | undefined; - referer?: string | undefined; - "referrer-policy"?: string | undefined; - refresh?: string | undefined; - "retry-after"?: string | undefined; - "sec-websocket-accept"?: string | undefined; - "sec-websocket-extensions"?: string | string[] | undefined; - "sec-websocket-key"?: string | undefined; - "sec-websocket-protocol"?: string | string[] | undefined; - "sec-websocket-version"?: string | undefined; - server?: string | undefined; - "set-cookie"?: string | string[] | undefined; - "strict-transport-security"?: string | undefined; - te?: string | undefined; - trailer?: string | undefined; - "transfer-encoding"?: string | undefined; - "user-agent"?: string | undefined; - upgrade?: string | undefined; - "upgrade-insecure-requests"?: string | undefined; - vary?: string | undefined; - via?: string | string[] | undefined; - warning?: string | undefined; - "www-authenticate"?: string | string[] | undefined; - "x-content-type-options"?: string | undefined; - "x-dns-prefetch-control"?: string | undefined; - "x-frame-options"?: string | undefined; - "x-xss-protection"?: string | undefined; - } - interface ClientRequestArgs extends Pick { - _defaultAgent?: Agent | undefined; - agent?: Agent | boolean | undefined; - auth?: string | null | undefined; - createConnection?: - | (( - options: ClientRequestArgs, - oncreate: (err: Error | null, socket: stream.Duplex) => void, - ) => stream.Duplex | null | undefined) - | undefined; - defaultPort?: number | string | undefined; - family?: number | undefined; - headers?: OutgoingHttpHeaders | readonly string[] | undefined; - host?: string | null | undefined; - hostname?: string | null | undefined; - insecureHTTPParser?: boolean | undefined; - localAddress?: string | undefined; - localPort?: number | undefined; - lookup?: LookupFunction | undefined; - /** - * @default 16384 - */ - maxHeaderSize?: number | undefined; - method?: string | undefined; - path?: string | null | undefined; - port?: number | string | null | undefined; - protocol?: string | null | undefined; - setDefaultHeaders?: boolean | undefined; - setHost?: boolean | undefined; - signal?: AbortSignal | undefined; - socketPath?: string | undefined; - timeout?: number | undefined; - uniqueHeaders?: Array | undefined; - joinDuplicateHeaders?: boolean | undefined; - } - interface ServerOptions< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse> = typeof ServerResponse, - > { - /** - * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`. - */ - IncomingMessage?: Request | undefined; - /** - * Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`. - */ - ServerResponse?: Response | undefined; - /** - * Sets the timeout value in milliseconds for receiving the entire request from the client. - * @see Server.requestTimeout for more information. - * @default 300000 - * @since v18.0.0 - */ - requestTimeout?: number | undefined; - /** - * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates. - * @default false - * @since v18.14.0 - */ - joinDuplicateHeaders?: boolean | undefined; - /** - * The number of milliseconds of inactivity a server needs to wait for additional incoming data, - * after it has finished writing the last response, before a socket will be destroyed. - * @see Server.keepAliveTimeout for more information. - * @default 5000 - * @since v18.0.0 - */ - keepAliveTimeout?: number | undefined; - /** - * An additional buffer time added to the - * `server.keepAliveTimeout` to extend the internal socket timeout. - * @since 22.19.0 - * @default 1000 - */ - keepAliveTimeoutBuffer?: number | undefined; - /** - * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests. - * @default 30000 - */ - connectionsCheckingInterval?: number | undefined; - /** - * Sets the timeout value in milliseconds for receiving the complete HTTP headers from the client. - * See {@link Server.headersTimeout} for more information. - * @default 60000 - * @since 18.0.0 - */ - headersTimeout?: number | undefined; - /** - * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. - * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`. - * Default: @see stream.getDefaultHighWaterMark(). - * @since v20.1.0 - */ - highWaterMark?: number | undefined; - /** - * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`. - * Using the insecure parser should be avoided. - * See --insecure-http-parser for more information. - * @default false - */ - insecureHTTPParser?: boolean | undefined; - /** - * Optionally overrides the value of `--max-http-header-size` for requests received by - * this server, i.e. the maximum length of request headers in bytes. - * @default 16384 - * @since v13.3.0 - */ - maxHeaderSize?: number | undefined; - /** - * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. - * @default true - * @since v16.5.0 - */ - noDelay?: boolean | undefined; - /** - * If set to `true`, it forces the server to respond with a 400 (Bad Request) status code - * to any HTTP/1.1 request message that lacks a Host header (as mandated by the specification). - * @default true - * @since 20.0.0 - */ - requireHostHeader?: boolean | undefined; - /** - * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, - * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. - * @default false - * @since v16.5.0 - */ - keepAlive?: boolean | undefined; - /** - * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. - * @default 0 - * @since v16.5.0 - */ - keepAliveInitialDelay?: number | undefined; - /** - * A list of response headers that should be sent only once. - * If the header's value is an array, the items will be joined using `; `. - */ - uniqueHeaders?: Array | undefined; - /** - * If set to `true`, an error is thrown when writing to an HTTP response which does not have a body. - * @default false - * @since v18.17.0, v20.2.0 - */ - rejectNonStandardBodyWrites?: boolean | undefined; - } - type RequestListener< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse> = typeof ServerResponse, - > = (req: InstanceType, res: InstanceType & { req: InstanceType }) => void; - /** - * @since v0.1.17 - */ - class Server< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse> = typeof ServerResponse, - > extends NetServer { - constructor(requestListener?: RequestListener); - constructor(options: ServerOptions, requestListener?: RequestListener); - /** - * Sets the timeout value for sockets, and emits a `'timeout'` event on - * the Server object, passing the socket as an argument, if a timeout - * occurs. - * - * If there is a `'timeout'` event listener on the Server object, then it - * will be called with the timed-out socket as an argument. - * - * By default, the Server does not timeout sockets. However, if a callback - * is assigned to the Server's `'timeout'` event, timeouts must be handled - * explicitly. - * @since v0.9.12 - * @param [msecs=0 (no timeout)] - */ - setTimeout(msecs?: number, callback?: (socket: Socket) => void): this; - setTimeout(callback: (socket: Socket) => void): this; - /** - * Limits maximum incoming headers count. If set to 0, no limit will be applied. - * @since v0.7.0 - */ - maxHeadersCount: number | null; - /** - * The maximum number of requests socket can handle - * before closing keep alive connection. - * - * A value of `0` will disable the limit. - * - * When the limit is reached it will set the `Connection` header value to `close`, - * but will not actually close the connection, subsequent requests sent - * after the limit is reached will get `503 Service Unavailable` as a response. - * @since v16.10.0 - */ - maxRequestsPerSocket: number | null; - /** - * The number of milliseconds of inactivity before a socket is presumed - * to have timed out. - * - * A value of `0` will disable the timeout behavior on incoming connections. - * - * The socket timeout logic is set up on connection, so changing this - * value only affects new connections to the server, not any existing connections. - * @since v0.9.12 - */ - timeout: number; - /** - * Limit the amount of time the parser will wait to receive the complete HTTP - * headers. - * - * If the timeout expires, the server responds with status 408 without - * forwarding the request to the request listener and then closes the connection. - * - * It must be set to a non-zero value (e.g. 120 seconds) to protect against - * potential Denial-of-Service attacks in case the server is deployed without a - * reverse proxy in front. - * @since v11.3.0, v10.14.0 - */ - headersTimeout: number; - /** - * The number of milliseconds of inactivity a server needs to wait for additional - * incoming data, after it has finished writing the last response, before a socket - * will be destroyed. - * - * This timeout value is combined with the - * `server.keepAliveTimeoutBuffer` option to determine the actual socket - * timeout, calculated as: - * socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer - * If the server receives new data before the keep-alive timeout has fired, it - * will reset the regular inactivity timeout, i.e., `server.timeout`. - * - * A value of `0` will disable the keep-alive timeout behavior on incoming - * connections. - * A value of `0` makes the HTTP server behave similarly to Node.js versions prior - * to 8.0.0, which did not have a keep-alive timeout. - * - * The socket timeout logic is set up on connection, so changing this value only - * affects new connections to the server, not any existing connections. - * @since v8.0.0 - */ - keepAliveTimeout: number; - /** - * An additional buffer time added to the - * `server.keepAliveTimeout` to extend the internal socket timeout. - * - * This buffer helps reduce connection reset (`ECONNRESET`) errors by increasing - * the socket timeout slightly beyond the advertised keep-alive timeout. - * - * This option applies only to new incoming connections. - * @since v22.19.0 - * @default 1000 - */ - keepAliveTimeoutBuffer: number; - /** - * Sets the timeout value in milliseconds for receiving the entire request from - * the client. - * - * If the timeout expires, the server responds with status 408 without - * forwarding the request to the request listener and then closes the connection. - * - * It must be set to a non-zero value (e.g. 120 seconds) to protect against - * potential Denial-of-Service attacks in case the server is deployed without a - * reverse proxy in front. - * @since v14.11.0 - */ - requestTimeout: number; - /** - * Closes all connections connected to this server. - * @since v18.2.0 - */ - closeAllConnections(): void; - /** - * Closes all connections connected to this server which are not sending a request - * or waiting for a response. - * @since v18.2.0 - */ - closeIdleConnections(): void; - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Socket) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "checkContinue", listener: RequestListener): this; - addListener(event: "checkExpectation", listener: RequestListener): this; - addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - addListener( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, - ): this; - addListener(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; - addListener(event: "request", listener: RequestListener): this; - addListener( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, - ): this; - emit(event: string, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Socket): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit( - event: "checkContinue", - req: InstanceType, - res: InstanceType & { req: InstanceType }, - ): boolean; - emit( - event: "checkExpectation", - req: InstanceType, - res: InstanceType & { req: InstanceType }, - ): boolean; - emit(event: "clientError", err: Error, socket: stream.Duplex): boolean; - emit(event: "connect", req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer): boolean; - emit(event: "dropRequest", req: InstanceType, socket: stream.Duplex): boolean; - emit( - event: "request", - req: InstanceType, - res: InstanceType & { req: InstanceType }, - ): boolean; - emit(event: "upgrade", req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Socket) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "checkContinue", listener: RequestListener): this; - on(event: "checkExpectation", listener: RequestListener): this; - on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - on( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, - ): this; - on(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; - on(event: "request", listener: RequestListener): this; - on( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, - ): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Socket) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "checkContinue", listener: RequestListener): this; - once(event: "checkExpectation", listener: RequestListener): this; - once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - once( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, - ): this; - once(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; - once(event: "request", listener: RequestListener): this; - once( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, - ): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Socket) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "checkContinue", listener: RequestListener): this; - prependListener(event: "checkExpectation", listener: RequestListener): this; - prependListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - prependListener( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, - ): this; - prependListener( - event: "dropRequest", - listener: (req: InstanceType, socket: stream.Duplex) => void, - ): this; - prependListener(event: "request", listener: RequestListener): this; - prependListener( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, - ): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "checkContinue", listener: RequestListener): this; - prependOnceListener(event: "checkExpectation", listener: RequestListener): this; - prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - prependOnceListener( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, - ): this; - prependOnceListener( - event: "dropRequest", - listener: (req: InstanceType, socket: stream.Duplex) => void, - ): this; - prependOnceListener(event: "request", listener: RequestListener): this; - prependOnceListener( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: NonSharedBuffer) => void, - ): this; - } - /** - * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from - * the perspective of the participants of an HTTP transaction. - * @since v0.1.17 - */ - class OutgoingMessage extends stream.Writable { - readonly req: Request; - chunkedEncoding: boolean; - shouldKeepAlive: boolean; - useChunkedEncodingByDefault: boolean; - sendDate: boolean; - /** - * @deprecated Use `writableEnded` instead. - */ - finished: boolean; - /** - * Read-only. `true` if the headers were sent, otherwise `false`. - * @since v0.9.3 - */ - readonly headersSent: boolean; - /** - * Alias of `outgoingMessage.socket`. - * @since v0.3.0 - * @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead. - */ - readonly connection: Socket | null; - /** - * Reference to the underlying socket. Usually, users will not want to access - * this property. - * - * After calling `outgoingMessage.end()`, this property will be nulled. - * @since v0.3.0 - */ - readonly socket: Socket | null; - constructor(); - /** - * Once a socket is associated with the message and is connected, `socket.setTimeout()` will be called with `msecs` as the first parameter. - * @since v0.9.12 - * @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event. - */ - setTimeout(msecs: number, callback?: () => void): this; - /** - * Sets a single header value. If the header already exists in the to-be-sent - * headers, its value will be replaced. Use an array of strings to send multiple - * headers with the same name. - * @since v0.4.0 - * @param name Header name - * @param value Header value - */ - setHeader(name: string, value: number | string | readonly string[]): this; - /** - * Sets multiple header values for implicit headers. headers must be an instance of - * `Headers` or `Map`, if a header already exists in the to-be-sent headers, its - * value will be replaced. - * - * ```js - * const headers = new Headers({ foo: 'bar' }); - * outgoingMessage.setHeaders(headers); - * ``` - * - * or - * - * ```js - * const headers = new Map([['foo', 'bar']]); - * outgoingMessage.setHeaders(headers); - * ``` - * - * When headers have been set with `outgoingMessage.setHeaders()`, they will be - * merged with any headers passed to `response.writeHead()`, with the headers passed - * to `response.writeHead()` given precedence. - * - * ```js - * // Returns content-type = text/plain - * const server = http.createServer((req, res) => { - * const headers = new Headers({ 'Content-Type': 'text/html' }); - * res.setHeaders(headers); - * res.writeHead(200, { 'Content-Type': 'text/plain' }); - * res.end('ok'); - * }); - * ``` - * - * @since v19.6.0, v18.15.0 - * @param name Header name - * @param value Header value - */ - setHeaders(headers: Headers | Map): this; - /** - * Append a single header value to the header object. - * - * If the value is an array, this is equivalent to calling this method multiple - * times. - * - * If there were no previous values for the header, this is equivalent to calling `outgoingMessage.setHeader(name, value)`. - * - * Depending of the value of `options.uniqueHeaders` when the client request or the - * server were created, this will end up in the header being sent multiple times or - * a single time with values joined using `; `. - * @since v18.3.0, v16.17.0 - * @param name Header name - * @param value Header value - */ - appendHeader(name: string, value: string | readonly string[]): this; - /** - * Gets the value of the HTTP header with the given name. If that header is not - * set, the returned value will be `undefined`. - * @since v0.4.0 - * @param name Name of header - */ - getHeader(name: string): number | string | string[] | undefined; - /** - * Returns a shallow copy of the current outgoing headers. Since a shallow - * copy is used, array values may be mutated without additional calls to - * various header-related HTTP module methods. The keys of the returned - * object are the header names and the values are the respective header - * values. All header names are lowercase. - * - * The object returned by the `outgoingMessage.getHeaders()` method does - * not prototypically inherit from the JavaScript `Object`. This means that - * typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, - * and others are not defined and will not work. - * - * ```js - * outgoingMessage.setHeader('Foo', 'bar'); - * outgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headers = outgoingMessage.getHeaders(); - * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } - * ``` - * @since v7.7.0 - */ - getHeaders(): OutgoingHttpHeaders; - /** - * Returns an array containing the unique names of the current outgoing headers. - * All names are lowercase. - * @since v7.7.0 - */ - getHeaderNames(): string[]; - /** - * Returns `true` if the header identified by `name` is currently set in the - * outgoing headers. The header name is case-insensitive. - * - * ```js - * const hasContentType = outgoingMessage.hasHeader('content-type'); - * ``` - * @since v7.7.0 - */ - hasHeader(name: string): boolean; - /** - * Removes a header that is queued for implicit sending. - * - * ```js - * outgoingMessage.removeHeader('Content-Encoding'); - * ``` - * @since v0.4.0 - * @param name Header name - */ - removeHeader(name: string): void; - /** - * Adds HTTP trailers (headers but at the end of the message) to the message. - * - * Trailers will **only** be emitted if the message is chunked encoded. If not, - * the trailers will be silently discarded. - * - * HTTP requires the `Trailer` header to be sent to emit trailers, - * with a list of header field names in its value, e.g. - * - * ```js - * message.writeHead(200, { 'Content-Type': 'text/plain', - * 'Trailer': 'Content-MD5' }); - * message.write(fileData); - * message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' }); - * message.end(); - * ``` - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * @since v0.3.0 - */ - addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void; - /** - * Flushes the message headers. - * - * For efficiency reason, Node.js normally buffers the message headers - * until `outgoingMessage.end()` is called or the first chunk of message data - * is written. It then tries to pack the headers and data into a single TCP - * packet. - * - * It is usually desired (it saves a TCP round-trip), but not when the first - * data is not sent until possibly much later. `outgoingMessage.flushHeaders()` bypasses the optimization and kickstarts the message. - * @since v1.6.0 - */ - flushHeaders(): void; - } - /** - * This object is created internally by an HTTP server, not by the user. It is - * passed as the second parameter to the `'request'` event. - * @since v0.1.17 - */ - class ServerResponse extends OutgoingMessage { - /** - * When using implicit headers (not calling `response.writeHead()` explicitly), - * this property controls the status code that will be sent to the client when - * the headers get flushed. - * - * ```js - * response.statusCode = 404; - * ``` - * - * After response header was sent to the client, this property indicates the - * status code which was sent out. - * @since v0.4.0 - */ - statusCode: number; - /** - * When using implicit headers (not calling `response.writeHead()` explicitly), - * this property controls the status message that will be sent to the client when - * the headers get flushed. If this is left as `undefined` then the standard - * message for the status code will be used. - * - * ```js - * response.statusMessage = 'Not found'; - * ``` - * - * After response header was sent to the client, this property indicates the - * status message which was sent out. - * @since v0.11.8 - */ - statusMessage: string; - /** - * If set to `true`, Node.js will check whether the `Content-Length` header value and the size of the body, in bytes, are equal. - * Mismatching the `Content-Length` header value will result - * in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. - * @since v18.10.0, v16.18.0 - */ - strictContentLength: boolean; - constructor(req: Request); - assignSocket(socket: Socket): void; - detachSocket(socket: Socket): void; - /** - * Sends an HTTP/1.1 100 Continue message to the client, indicating that - * the request body should be sent. See the `'checkContinue'` event on `Server`. - * @since v0.3.0 - */ - writeContinue(callback?: () => void): void; - /** - * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header, - * indicating that the user agent can preload/preconnect the linked resources. - * The `hints` is an object containing the values of headers to be sent with - * early hints message. The optional `callback` argument will be called when - * the response message has been written. - * - * **Example** - * - * ```js - * const earlyHintsLink = '; rel=preload; as=style'; - * response.writeEarlyHints({ - * 'link': earlyHintsLink, - * }); - * - * const earlyHintsLinks = [ - * '; rel=preload; as=style', - * '; rel=preload; as=script', - * ]; - * response.writeEarlyHints({ - * 'link': earlyHintsLinks, - * 'x-trace-id': 'id for diagnostics', - * }); - * - * const earlyHintsCallback = () => console.log('early hints message sent'); - * response.writeEarlyHints({ - * 'link': earlyHintsLinks, - * }, earlyHintsCallback); - * ``` - * @since v18.11.0 - * @param hints An object containing the values of headers - * @param callback Will be called when the response message has been written - */ - writeEarlyHints(hints: Record, callback?: () => void): void; - /** - * Sends a response header to the request. The status code is a 3-digit HTTP - * status code, like `404`. The last argument, `headers`, are the response headers. - * Optionally one can give a human-readable `statusMessage` as the second - * argument. - * - * `headers` may be an `Array` where the keys and values are in the same list. - * It is _not_ a list of tuples. So, the even-numbered offsets are key values, - * and the odd-numbered offsets are the associated values. The array is in the same - * format as `request.rawHeaders`. - * - * Returns a reference to the `ServerResponse`, so that calls can be chained. - * - * ```js - * const body = 'hello world'; - * response - * .writeHead(200, { - * 'Content-Length': Buffer.byteLength(body), - * 'Content-Type': 'text/plain', - * }) - * .end(body); - * ``` - * - * This method must only be called once on a message and it must - * be called before `response.end()` is called. - * - * If `response.write()` or `response.end()` are called before calling - * this, the implicit/mutable headers will be calculated and call this function. - * - * When headers have been set with `response.setHeader()`, they will be merged - * with any headers passed to `response.writeHead()`, with the headers passed - * to `response.writeHead()` given precedence. - * - * If this method is called and `response.setHeader()` has not been called, - * it will directly write the supplied header values onto the network channel - * without caching internally, and the `response.getHeader()` on the header - * will not yield the expected result. If progressive population of headers is - * desired with potential future retrieval and modification, use `response.setHeader()` instead. - * - * ```js - * // Returns content-type = text/plain - * const server = http.createServer((req, res) => { - * res.setHeader('Content-Type', 'text/html'); - * res.setHeader('X-Foo', 'bar'); - * res.writeHead(200, { 'Content-Type': 'text/plain' }); - * res.end('ok'); - * }); - * ``` - * - * `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js - * will check whether `Content-Length` and the length of the body which has - * been transmitted are equal or not. - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `Error` being thrown. - * @since v0.1.30 - */ - writeHead( - statusCode: number, - statusMessage?: string, - headers?: OutgoingHttpHeaders | OutgoingHttpHeader[], - ): this; - writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this; - /** - * Sends a HTTP/1.1 102 Processing message to the client, indicating that - * the request body should be sent. - * @since v10.0.0 - */ - writeProcessing(callback?: () => void): void; - } - interface InformationEvent { - statusCode: number; - statusMessage: string; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - headers: IncomingHttpHeaders; - rawHeaders: string[]; - } - /** - * This object is created internally and returned from {@link request}. It - * represents an _in-progress_ request whose header has already been queued. The - * header is still mutable using the `setHeader(name, value)`, `getHeader(name)`, `removeHeader(name)` API. The actual header will - * be sent along with the first data chunk or when calling `request.end()`. - * - * To get the response, add a listener for `'response'` to the request object. `'response'` will be emitted from the request object when the response - * headers have been received. The `'response'` event is executed with one - * argument which is an instance of {@link IncomingMessage}. - * - * During the `'response'` event, one can add listeners to the - * response object; particularly to listen for the `'data'` event. - * - * If no `'response'` handler is added, then the response will be - * entirely discarded. However, if a `'response'` event handler is added, - * then the data from the response object **must** be consumed, either by - * calling `response.read()` whenever there is a `'readable'` event, or - * by adding a `'data'` handler, or by calling the `.resume()` method. - * Until the data is consumed, the `'end'` event will not fire. Also, until - * the data is read it will consume memory that can eventually lead to a - * 'process out of memory' error. - * - * For backward compatibility, `res` will only emit `'error'` if there is an `'error'` listener registered. - * - * Set `Content-Length` header to limit the response body size. - * If `response.strictContentLength` is set to `true`, mismatching the `Content-Length` header value will result in an `Error` being thrown, - * identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. - * - * `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. - * @since v0.1.17 - */ - class ClientRequest extends OutgoingMessage { - /** - * The `request.aborted` property will be `true` if the request has - * been aborted. - * @since v0.11.14 - * @deprecated Since v17.0.0, v16.12.0 - Check `destroyed` instead. - */ - aborted: boolean; - /** - * The request host. - * @since v14.5.0, v12.19.0 - */ - host: string; - /** - * The request protocol. - * @since v14.5.0, v12.19.0 - */ - protocol: string; - /** - * When sending request through a keep-alive enabled agent, the underlying socket - * might be reused. But if server closes connection at unfortunate time, client - * may run into a 'ECONNRESET' error. - * - * ```js - * import http from 'node:http'; - * - * // Server has a 5 seconds keep-alive timeout by default - * http - * .createServer((req, res) => { - * res.write('hello\n'); - * res.end(); - * }) - * .listen(3000); - * - * setInterval(() => { - * // Adapting a keep-alive agent - * http.get('http://localhost:3000', { agent }, (res) => { - * res.on('data', (data) => { - * // Do nothing - * }); - * }); - * }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout - * ``` - * - * By marking a request whether it reused socket or not, we can do - * automatic error retry base on it. - * - * ```js - * import http from 'node:http'; - * const agent = new http.Agent({ keepAlive: true }); - * - * function retriableRequest() { - * const req = http - * .get('http://localhost:3000', { agent }, (res) => { - * // ... - * }) - * .on('error', (err) => { - * // Check if retry is needed - * if (req.reusedSocket && err.code === 'ECONNRESET') { - * retriableRequest(); - * } - * }); - * } - * - * retriableRequest(); - * ``` - * @since v13.0.0, v12.16.0 - */ - reusedSocket: boolean; - /** - * Limits maximum response headers count. If set to 0, no limit will be applied. - */ - maxHeadersCount: number; - constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); - /** - * The request method. - * @since v0.1.97 - */ - method: string; - /** - * The request path. - * @since v0.4.0 - */ - path: string; - /** - * Marks the request as aborting. Calling this will cause remaining data - * in the response to be dropped and the socket to be destroyed. - * @since v0.3.8 - * @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead. - */ - abort(): void; - onSocket(socket: Socket): void; - /** - * Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called. - * @since v0.5.9 - * @param timeout Milliseconds before a request times out. - * @param callback Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event. - */ - setTimeout(timeout: number, callback?: () => void): this; - /** - * Once a socket is assigned to this request and is connected `socket.setNoDelay()` will be called. - * @since v0.5.9 - */ - setNoDelay(noDelay?: boolean): void; - /** - * Once a socket is assigned to this request and is connected `socket.setKeepAlive()` will be called. - * @since v0.5.9 - */ - setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; - /** - * Returns an array containing the unique names of the current outgoing raw - * headers. Header names are returned with their exact casing being set. - * - * ```js - * request.setHeader('Foo', 'bar'); - * request.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headerNames = request.getRawHeaderNames(); - * // headerNames === ['Foo', 'Set-Cookie'] - * ``` - * @since v15.13.0, v14.17.0 - */ - getRawHeaderNames(): string[]; - /** - * @deprecated - */ - addListener(event: "abort", listener: () => void): this; - addListener( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, - ): this; - addListener(event: "continue", listener: () => void): this; - addListener(event: "information", listener: (info: InformationEvent) => void): this; - addListener(event: "response", listener: (response: IncomingMessage) => void): this; - addListener(event: "socket", listener: (socket: Socket) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, - ): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - on(event: "abort", listener: () => void): this; - on( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, - ): this; - on(event: "continue", listener: () => void): this; - on(event: "information", listener: (info: InformationEvent) => void): this; - on(event: "response", listener: (response: IncomingMessage) => void): this; - on(event: "socket", listener: (socket: Socket) => void): this; - on(event: "timeout", listener: () => void): this; - on( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, - ): this; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - once(event: "abort", listener: () => void): this; - once( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, - ): this; - once(event: "continue", listener: () => void): this; - once(event: "information", listener: (info: InformationEvent) => void): this; - once(event: "response", listener: (response: IncomingMessage) => void): this; - once(event: "socket", listener: (socket: Socket) => void): this; - once(event: "timeout", listener: () => void): this; - once( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, - ): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - prependListener(event: "abort", listener: () => void): this; - prependListener( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, - ): this; - prependListener(event: "continue", listener: () => void): this; - prependListener(event: "information", listener: (info: InformationEvent) => void): this; - prependListener(event: "response", listener: (response: IncomingMessage) => void): this; - prependListener(event: "socket", listener: (socket: Socket) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, - ): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - prependOnceListener(event: "abort", listener: () => void): this; - prependOnceListener( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, - ): this; - prependOnceListener(event: "continue", listener: () => void): this; - prependOnceListener(event: "information", listener: (info: InformationEvent) => void): this; - prependOnceListener(event: "response", listener: (response: IncomingMessage) => void): this; - prependOnceListener(event: "socket", listener: (socket: Socket) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void, - ): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to - * access response - * status, headers, and data. - * - * Different from its `socket` value which is a subclass of `stream.Duplex`, the `IncomingMessage` itself extends `stream.Readable` and is created separately to - * parse and emit the incoming HTTP headers and payload, as the underlying socket - * may be reused multiple times in case of keep-alive. - * @since v0.1.17 - */ - class IncomingMessage extends stream.Readable { - constructor(socket: Socket); - /** - * The `message.aborted` property will be `true` if the request has - * been aborted. - * @since v10.1.0 - * @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from stream.Readable. - */ - aborted: boolean; - /** - * In case of server request, the HTTP version sent by the client. In the case of - * client response, the HTTP version of the connected-to server. - * Probably either `'1.1'` or `'1.0'`. - * - * Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second. - * @since v0.1.1 - */ - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - /** - * The `message.complete` property will be `true` if a complete HTTP message has - * been received and successfully parsed. - * - * This property is particularly useful as a means of determining if a client or - * server fully transmitted a message before a connection was terminated: - * - * ```js - * const req = http.request({ - * host: '127.0.0.1', - * port: 8080, - * method: 'POST', - * }, (res) => { - * res.resume(); - * res.on('end', () => { - * if (!res.complete) - * console.error( - * 'The connection was terminated while the message was still being sent'); - * }); - * }); - * ``` - * @since v0.3.0 - */ - complete: boolean; - /** - * Alias for `message.socket`. - * @since v0.1.90 - * @deprecated Since v16.0.0 - Use `socket`. - */ - connection: Socket; - /** - * The `net.Socket` object associated with the connection. - * - * With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the - * client's authentication details. - * - * This property is guaranteed to be an instance of the `net.Socket` class, - * a subclass of `stream.Duplex`, unless the user specified a socket - * type other than `net.Socket` or internally nulled. - * @since v0.3.0 - */ - socket: Socket; - /** - * The request/response headers object. - * - * Key-value pairs of header names and values. Header names are lower-cased. - * - * ```js - * // Prints something like: - * // - * // { 'user-agent': 'curl/7.22.0', - * // host: '127.0.0.1:8000', - * // accept: '*' } - * console.log(request.headers); - * ``` - * - * Duplicates in raw headers are handled in the following ways, depending on the - * header name: - * - * * Duplicates of `age`, `authorization`, `content-length`, `content-type`, `etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`, - * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`, or `user-agent` are discarded. - * To allow duplicate values of the headers listed above to be joined, - * use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more - * information. - * * `set-cookie` is always an array. Duplicates are added to the array. - * * For duplicate `cookie` headers, the values are joined together with `; `. - * * For all other headers, the values are joined together with `, `. - * @since v0.1.5 - */ - headers: IncomingHttpHeaders; - /** - * Similar to `message.headers`, but there is no join logic and the values are - * always arrays of strings, even for headers received just once. - * - * ```js - * // Prints something like: - * // - * // { 'user-agent': ['curl/7.22.0'], - * // host: ['127.0.0.1:8000'], - * // accept: ['*'] } - * console.log(request.headersDistinct); - * ``` - * @since v18.3.0, v16.17.0 - */ - headersDistinct: NodeJS.Dict; - /** - * The raw request/response headers list exactly as they were received. - * - * The keys and values are in the same list. It is _not_ a - * list of tuples. So, the even-numbered offsets are key values, and the - * odd-numbered offsets are the associated values. - * - * Header names are not lowercased, and duplicates are not merged. - * - * ```js - * // Prints something like: - * // - * // [ 'user-agent', - * // 'this is invalid because there can be only one', - * // 'User-Agent', - * // 'curl/7.22.0', - * // 'Host', - * // '127.0.0.1:8000', - * // 'ACCEPT', - * // '*' ] - * console.log(request.rawHeaders); - * ``` - * @since v0.11.6 - */ - rawHeaders: string[]; - /** - * The request/response trailers object. Only populated at the `'end'` event. - * @since v0.3.0 - */ - trailers: NodeJS.Dict; - /** - * Similar to `message.trailers`, but there is no join logic and the values are - * always arrays of strings, even for headers received just once. - * Only populated at the `'end'` event. - * @since v18.3.0, v16.17.0 - */ - trailersDistinct: NodeJS.Dict; - /** - * The raw request/response trailer keys and values exactly as they were - * received. Only populated at the `'end'` event. - * @since v0.11.6 - */ - rawTrailers: string[]; - /** - * Calls `message.socket.setTimeout(msecs, callback)`. - * @since v0.5.9 - */ - setTimeout(msecs: number, callback?: () => void): this; - /** - * **Only valid for request obtained from {@link Server}.** - * - * The request method as a string. Read only. Examples: `'GET'`, `'DELETE'`. - * @since v0.1.1 - */ - method?: string | undefined; - /** - * **Only valid for request obtained from {@link Server}.** - * - * Request URL string. This contains only the URL that is present in the actual - * HTTP request. Take the following request: - * - * ```http - * GET /status?name=ryan HTTP/1.1 - * Accept: text/plain - * ``` - * - * To parse the URL into its parts: - * - * ```js - * new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`); - * ``` - * - * When `request.url` is `'/status?name=ryan'` and `process.env.HOST` is undefined: - * - * ```console - * $ node - * > new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`); - * URL { - * href: 'http://localhost/status?name=ryan', - * origin: 'http://localhost', - * protocol: 'http:', - * username: '', - * password: '', - * host: 'localhost', - * hostname: 'localhost', - * port: '', - * pathname: '/status', - * search: '?name=ryan', - * searchParams: URLSearchParams { 'name' => 'ryan' }, - * hash: '' - * } - * ``` - * - * Ensure that you set `process.env.HOST` to the server's host name, or consider replacing this part entirely. If using `req.headers.host`, ensure proper - * validation is used, as clients may specify a custom `Host` header. - * @since v0.1.90 - */ - url?: string | undefined; - /** - * **Only valid for response obtained from {@link ClientRequest}.** - * - * The 3-digit HTTP response status code. E.G. `404`. - * @since v0.1.1 - */ - statusCode?: number | undefined; - /** - * **Only valid for response obtained from {@link ClientRequest}.** - * - * The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`. - * @since v0.11.10 - */ - statusMessage?: string | undefined; - /** - * Calls `destroy()` on the socket that received the `IncomingMessage`. If `error` is provided, an `'error'` event is emitted on the socket and `error` is passed - * as an argument to any listeners on the event. - * @since v0.3.0 - */ - destroy(error?: Error): this; - } - interface AgentOptions extends NodeJS.PartialOptions { - /** - * Keep sockets around in a pool to be used by other requests in the future. Default = false - */ - keepAlive?: boolean | undefined; - /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - */ - keepAliveMsecs?: number | undefined; - /** - * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity - */ - maxSockets?: number | undefined; - /** - * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity. - */ - maxTotalSockets?: number | undefined; - /** - * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. - */ - maxFreeSockets?: number | undefined; - /** - * Socket timeout in milliseconds. This will set the timeout after the socket is connected. - */ - timeout?: number | undefined; - /** - * Scheduling strategy to apply when picking the next free socket to use. - * @default `lifo` - */ - scheduling?: "fifo" | "lifo" | undefined; - } - /** - * An `Agent` is responsible for managing connection persistence - * and reuse for HTTP clients. It maintains a queue of pending requests - * for a given host and port, reusing a single socket connection for each - * until the queue is empty, at which time the socket is either destroyed - * or put into a pool where it is kept to be used again for requests to the - * same host and port. Whether it is destroyed or pooled depends on the `keepAlive` `option`. - * - * Pooled connections have TCP Keep-Alive enabled for them, but servers may - * still close idle connections, in which case they will be removed from the - * pool and a new connection will be made when a new HTTP request is made for - * that host and port. Servers may also refuse to allow multiple requests - * over the same connection, in which case the connection will have to be - * remade for every request and cannot be pooled. The `Agent` will still make - * the requests to that server, but each one will occur over a new connection. - * - * When a connection is closed by the client or the server, it is removed - * from the pool. Any unused sockets in the pool will be unrefed so as not - * to keep the Node.js process running when there are no outstanding requests. - * (see `socket.unref()`). - * - * It is good practice, to `destroy()` an `Agent` instance when it is no - * longer in use, because unused sockets consume OS resources. - * - * Sockets are removed from an agent when the socket emits either - * a `'close'` event or an `'agentRemove'` event. When intending to keep one - * HTTP request open for a long time without keeping it in the agent, something - * like the following may be done: - * - * ```js - * http.get(options, (res) => { - * // Do stuff - * }).on('socket', (socket) => { - * socket.emit('agentRemove'); - * }); - * ``` - * - * An agent may also be used for an individual request. By providing `{agent: false}` as an option to the `http.get()` or `http.request()` functions, a one-time use `Agent` with default options - * will be used - * for the client connection. - * - * `agent:false`: - * - * ```js - * http.get({ - * hostname: 'localhost', - * port: 80, - * path: '/', - * agent: false, // Create a new agent just for this one request - * }, (res) => { - * // Do stuff with response - * }); - * ``` - * - * `options` in [`socket.connect()`](https://nodejs.org/docs/latest-v22.x/api/net.html#socketconnectoptions-connectlistener) are also supported. - * - * To configure any of them, a custom {@link Agent} instance must be created. - * - * ```js - * import http from 'node:http'; - * const keepAliveAgent = new http.Agent({ keepAlive: true }); - * options.agent = keepAliveAgent; - * http.request(options, onResponseCallback) - * ``` - * @since v0.3.4 - */ - class Agent extends EventEmitter { - /** - * By default set to 256. For agents with `keepAlive` enabled, this - * sets the maximum number of sockets that will be left open in the free - * state. - * @since v0.11.7 - */ - maxFreeSockets: number; - /** - * By default set to `Infinity`. Determines how many concurrent sockets the agent - * can have open per origin. Origin is the returned value of `agent.getName()`. - * @since v0.3.6 - */ - maxSockets: number; - /** - * By default set to `Infinity`. Determines how many concurrent sockets the agent - * can have open. Unlike `maxSockets`, this parameter applies across all origins. - * @since v14.5.0, v12.19.0 - */ - maxTotalSockets: number; - /** - * An object which contains arrays of sockets currently awaiting use by - * the agent when `keepAlive` is enabled. Do not modify. - * - * Sockets in the `freeSockets` list will be automatically destroyed and - * removed from the array on `'timeout'`. - * @since v0.11.4 - */ - readonly freeSockets: NodeJS.ReadOnlyDict; - /** - * An object which contains arrays of sockets currently in use by the - * agent. Do not modify. - * @since v0.3.6 - */ - readonly sockets: NodeJS.ReadOnlyDict; - /** - * An object which contains queues of requests that have not yet been assigned to - * sockets. Do not modify. - * @since v0.5.9 - */ - readonly requests: NodeJS.ReadOnlyDict; - constructor(opts?: AgentOptions); - /** - * Destroy any sockets that are currently in use by the agent. - * - * It is usually not necessary to do this. However, if using an - * agent with `keepAlive` enabled, then it is best to explicitly shut down - * the agent when it is no longer needed. Otherwise, - * sockets might stay open for quite a long time before the server - * terminates them. - * @since v0.11.4 - */ - destroy(): void; - /** - * Produces a socket/stream to be used for HTTP requests. - * - * By default, this function is the same as `net.createConnection()`. However, - * custom agents may override this method in case greater flexibility is desired. - * - * A socket/stream can be supplied in one of two ways: by returning the - * socket/stream from this function, or by passing the socket/stream to `callback`. - * - * This method is guaranteed to return an instance of the `net.Socket` class, - * a subclass of `stream.Duplex`, unless the user specifies a socket - * type other than `net.Socket`. - * - * `callback` has a signature of `(err, stream)`. - * @since v0.11.4 - * @param options Options containing connection details. Check `createConnection` for the format of the options - * @param callback Callback function that receives the created socket - */ - createConnection( - options: ClientRequestArgs, - callback?: (err: Error | null, stream: stream.Duplex) => void, - ): stream.Duplex | null | undefined; - /** - * Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to: - * - * ```js - * socket.setKeepAlive(true, this.keepAliveMsecs); - * socket.unref(); - * return true; - * ``` - * - * This method can be overridden by a particular `Agent` subclass. If this - * method returns a falsy value, the socket will be destroyed instead of persisting - * it for use with the next request. - * - * The `socket` argument can be an instance of `net.Socket`, a subclass of `stream.Duplex`. - * @since v8.1.0 - */ - keepSocketAlive(socket: stream.Duplex): void; - /** - * Called when `socket` is attached to `request` after being persisted because of - * the keep-alive options. Default behavior is to: - * - * ```js - * socket.ref(); - * ``` - * - * This method can be overridden by a particular `Agent` subclass. - * - * The `socket` argument can be an instance of `net.Socket`, a subclass of `stream.Duplex`. - * @since v8.1.0 - */ - reuseSocket(socket: stream.Duplex, request: ClientRequest): void; - /** - * Get a unique name for a set of request options, to determine whether a - * connection can be reused. For an HTTP agent, this returns`host:port:localAddress` or `host:port:localAddress:family`. For an HTTPS agent, - * the name includes the CA, cert, ciphers, and other HTTPS/TLS-specific options - * that determine socket reusability. - * @since v0.11.4 - * @param options A set of options providing information for name generation - */ - getName(options?: ClientRequestArgs): string; - } - const METHODS: string[]; - const STATUS_CODES: { - [errorCode: number]: string | undefined; - [errorCode: string]: string | undefined; - }; - /** - * Returns a new instance of {@link Server}. - * - * The `requestListener` is a function which is automatically - * added to the `'request'` event. - * - * ```js - * import http from 'node:http'; - * - * // Create a local server to receive data from - * const server = http.createServer((req, res) => { - * res.writeHead(200, { 'Content-Type': 'application/json' }); - * res.end(JSON.stringify({ - * data: 'Hello World!', - * })); - * }); - * - * server.listen(8000); - * ``` - * - * ```js - * import http from 'node:http'; - * - * // Create a local server to receive data from - * const server = http.createServer(); - * - * // Listen to the request event - * server.on('request', (request, res) => { - * res.writeHead(200, { 'Content-Type': 'application/json' }); - * res.end(JSON.stringify({ - * data: 'Hello World!', - * })); - * }); - * - * server.listen(8000); - * ``` - * @since v0.1.13 - */ - function createServer< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse> = typeof ServerResponse, - >(requestListener?: RequestListener): Server; - function createServer< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse> = typeof ServerResponse, - >( - options: ServerOptions, - requestListener?: RequestListener, - ): Server; - // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, - // create interface RequestOptions would make the naming more clear to developers - interface RequestOptions extends ClientRequestArgs {} - /** - * `options` in `socket.connect()` are also supported. - * - * Node.js maintains several connections per server to make HTTP requests. - * This function allows one to transparently issue requests. - * - * `url` can be a string or a `URL` object. If `url` is a - * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. - * - * If both `url` and `options` are specified, the objects are merged, with the `options` properties taking precedence. - * - * The optional `callback` parameter will be added as a one-time listener for - * the `'response'` event. - * - * `http.request()` returns an instance of the {@link ClientRequest} class. The `ClientRequest` instance is a writable stream. If one needs to - * upload a file with a POST request, then write to the `ClientRequest` object. - * - * ```js - * import http from 'node:http'; - * import { Buffer } from 'node:buffer'; - * - * const postData = JSON.stringify({ - * 'msg': 'Hello World!', - * }); - * - * const options = { - * hostname: 'www.google.com', - * port: 80, - * path: '/upload', - * method: 'POST', - * headers: { - * 'Content-Type': 'application/json', - * 'Content-Length': Buffer.byteLength(postData), - * }, - * }; - * - * const req = http.request(options, (res) => { - * console.log(`STATUS: ${res.statusCode}`); - * console.log(`HEADERS: ${JSON.stringify(res.headers)}`); - * res.setEncoding('utf8'); - * res.on('data', (chunk) => { - * console.log(`BODY: ${chunk}`); - * }); - * res.on('end', () => { - * console.log('No more data in response.'); - * }); - * }); - * - * req.on('error', (e) => { - * console.error(`problem with request: ${e.message}`); - * }); - * - * // Write data to request body - * req.write(postData); - * req.end(); - * ``` - * - * In the example `req.end()` was called. With `http.request()` one - * must always call `req.end()` to signify the end of the request - - * even if there is no data being written to the request body. - * - * If any error is encountered during the request (be that with DNS resolution, - * TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted - * on the returned request object. As with all `'error'` events, if no listeners - * are registered the error will be thrown. - * - * There are a few special headers that should be noted. - * - * * Sending a 'Connection: keep-alive' will notify Node.js that the connection to - * the server should be persisted until the next request. - * * Sending a 'Content-Length' header will disable the default chunked encoding. - * * Sending an 'Expect' header will immediately send the request headers. - * Usually, when sending 'Expect: 100-continue', both a timeout and a listener - * for the `'continue'` event should be set. See RFC 2616 Section 8.2.3 for more - * information. - * * Sending an Authorization header will override using the `auth` option - * to compute basic authentication. - * - * Example using a `URL` as `options`: - * - * ```js - * const options = new URL('http://abc:xyz@example.com'); - * - * const req = http.request(options, (res) => { - * // ... - * }); - * ``` - * - * In a successful request, the following events will be emitted in the following - * order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * (`'data'` will not be emitted at all if the response body is empty, for - * instance, in most redirects) - * * `'end'` on the `res` object - * * `'close'` - * - * In the case of a connection error, the following events will be emitted: - * - * * `'socket'` - * * `'error'` - * * `'close'` - * - * In the case of a premature connection close before the response is received, - * the following events will be emitted in the following order: - * - * * `'socket'` - * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'` - * * `'close'` - * - * In the case of a premature connection close after the response is received, - * the following events will be emitted in the following order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * * (connection closed here) - * * `'aborted'` on the `res` object - * * `'close'` - * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'` - * * `'close'` on the `res` object - * - * If `req.destroy()` is called before a socket is assigned, the following - * events will be emitted in the following order: - * - * * (`req.destroy()` called here) - * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called - * * `'close'` - * - * If `req.destroy()` is called before the connection succeeds, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * (`req.destroy()` called here) - * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called - * * `'close'` - * - * If `req.destroy()` is called after the response is received, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * * (`req.destroy()` called here) - * * `'aborted'` on the `res` object - * * `'close'` - * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called - * * `'close'` on the `res` object - * - * If `req.abort()` is called before a socket is assigned, the following - * events will be emitted in the following order: - * - * * (`req.abort()` called here) - * * `'abort'` - * * `'close'` - * - * If `req.abort()` is called before the connection succeeds, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * (`req.abort()` called here) - * * `'abort'` - * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'` - * * `'close'` - * - * If `req.abort()` is called after the response is received, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * * (`req.abort()` called here) - * * `'abort'` - * * `'aborted'` on the `res` object - * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'`. - * * `'close'` - * * `'close'` on the `res` object - * - * Setting the `timeout` option or using the `setTimeout()` function will - * not abort the request or do anything besides add a `'timeout'` event. - * - * Passing an `AbortSignal` and then calling `abort()` on the corresponding `AbortController` will behave the same way as calling `.destroy()` on the - * request. Specifically, the `'error'` event will be emitted with an error with - * the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'` and the `cause`, if one was provided. - * @since v0.3.6 - */ - function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function request( - url: string | URL, - options: RequestOptions, - callback?: (res: IncomingMessage) => void, - ): ClientRequest; - /** - * Since most requests are GET requests without bodies, Node.js provides this - * convenience method. The only difference between this method and {@link request} is that it sets the method to GET by default and calls `req.end()` automatically. The callback must take care to - * consume the response - * data for reasons stated in {@link ClientRequest} section. - * - * The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}. - * - * JSON fetching example: - * - * ```js - * http.get('http://localhost:8000/', (res) => { - * const { statusCode } = res; - * const contentType = res.headers['content-type']; - * - * let error; - * // Any 2xx status code signals a successful response but - * // here we're only checking for 200. - * if (statusCode !== 200) { - * error = new Error('Request Failed.\n' + - * `Status Code: ${statusCode}`); - * } else if (!/^application\/json/.test(contentType)) { - * error = new Error('Invalid content-type.\n' + - * `Expected application/json but received ${contentType}`); - * } - * if (error) { - * console.error(error.message); - * // Consume response data to free up memory - * res.resume(); - * return; - * } - * - * res.setEncoding('utf8'); - * let rawData = ''; - * res.on('data', (chunk) => { rawData += chunk; }); - * res.on('end', () => { - * try { - * const parsedData = JSON.parse(rawData); - * console.log(parsedData); - * } catch (e) { - * console.error(e.message); - * } - * }); - * }).on('error', (e) => { - * console.error(`Got error: ${e.message}`); - * }); - * - * // Create a local server to receive data from - * const server = http.createServer((req, res) => { - * res.writeHead(200, { 'Content-Type': 'application/json' }); - * res.end(JSON.stringify({ - * data: 'Hello World!', - * })); - * }); - * - * server.listen(8000); - * ``` - * @since v0.3.6 - * @param options Accepts the same `options` as {@link request}, with the method set to GET by default. - */ - function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; - /** - * Performs the low-level validations on the provided `name` that are done when `res.setHeader(name, value)` is called. - * - * Passing illegal value as `name` will result in a `TypeError` being thrown, - * identified by `code: 'ERR_INVALID_HTTP_TOKEN'`. - * - * It is not necessary to use this method before passing headers to an HTTP request - * or response. The HTTP module will automatically validate such headers. - * - * Example: - * - * ```js - * import { validateHeaderName } from 'node:http'; - * - * try { - * validateHeaderName(''); - * } catch (err) { - * console.error(err instanceof TypeError); // --> true - * console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN' - * console.error(err.message); // --> 'Header name must be a valid HTTP token [""]' - * } - * ``` - * @since v14.3.0 - * @param [label='Header name'] Label for error message. - */ - function validateHeaderName(name: string): void; - /** - * Performs the low-level validations on the provided `value` that are done when `res.setHeader(name, value)` is called. - * - * Passing illegal value as `value` will result in a `TypeError` being thrown. - * - * * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`. - * * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`. - * - * It is not necessary to use this method before passing headers to an HTTP request - * or response. The HTTP module will automatically validate such headers. - * - * Examples: - * - * ```js - * import { validateHeaderValue } from 'node:http'; - * - * try { - * validateHeaderValue('x-my-header', undefined); - * } catch (err) { - * console.error(err instanceof TypeError); // --> true - * console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true - * console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"' - * } - * - * try { - * validateHeaderValue('x-my-header', 'oʊmɪɡə'); - * } catch (err) { - * console.error(err instanceof TypeError); // --> true - * console.error(err.code === 'ERR_INVALID_CHAR'); // --> true - * console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]' - * } - * ``` - * @since v14.3.0 - * @param name Header name - * @param value Header value - */ - function validateHeaderValue(name: string, value: string): void; - /** - * Set the maximum number of idle HTTP parsers. - * @since v18.8.0, v16.18.0 - * @param [max=1000] - */ - function setMaxIdleHTTPParsers(max: number): void; - /** - * Global instance of `Agent` which is used as the default for all HTTP client - * requests. Diverges from a default `Agent` configuration by having `keepAlive` - * enabled and a `timeout` of 5 seconds. - * @since v0.5.9 - */ - let globalAgent: Agent; - /** - * Read-only property specifying the maximum allowed size of HTTP headers in bytes. - * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option. - */ - const maxHeaderSize: number; - /** - * A browser-compatible implementation of `WebSocket`. - * @since v22.5.0 - */ - const WebSocket: typeof import("undici-types").WebSocket; - /** - * @since v22.5.0 - */ - const CloseEvent: typeof import("undici-types").CloseEvent; - /** - * @since v22.5.0 - */ - const MessageEvent: typeof import("undici-types").MessageEvent; -} -declare module "node:http" { - export * from "http"; -} diff --git a/node_modules/@types/node/http2.d.ts b/node_modules/@types/node/http2.d.ts deleted file mode 100644 index 4937d8a..0000000 --- a/node_modules/@types/node/http2.d.ts +++ /dev/null @@ -1,2725 +0,0 @@ -/** - * The `node:http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol. - * It can be accessed using: - * - * ```js - * import http2 from 'node:http2'; - * ``` - * @since v8.4.0 - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/http2.js) - */ -declare module "http2" { - import { NonSharedBuffer } from "node:buffer"; - import EventEmitter = require("node:events"); - import * as fs from "node:fs"; - import * as net from "node:net"; - import * as stream from "node:stream"; - import * as tls from "node:tls"; - import * as url from "node:url"; - import { - IncomingHttpHeaders as Http1IncomingHttpHeaders, - IncomingMessage, - OutgoingHttpHeaders, - ServerResponse, - } from "node:http"; - export { OutgoingHttpHeaders } from "node:http"; - export interface IncomingHttpStatusHeader { - ":status"?: number | undefined; - } - export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders { - ":path"?: string | undefined; - ":method"?: string | undefined; - ":authority"?: string | undefined; - ":scheme"?: string | undefined; - ":protocol"?: string | undefined; - } - // Http2Stream - export interface StreamPriorityOptions { - exclusive?: boolean | undefined; - parent?: number | undefined; - weight?: number | undefined; - silent?: boolean | undefined; - } - export interface StreamState { - localWindowSize?: number | undefined; - state?: number | undefined; - localClose?: number | undefined; - remoteClose?: number | undefined; - sumDependencyWeight?: number | undefined; - weight?: number | undefined; - } - export interface ServerStreamResponseOptions { - endStream?: boolean | undefined; - waitForTrailers?: boolean | undefined; - } - export interface StatOptions { - offset: number; - length: number; - } - export interface ServerStreamFileResponseOptions { - statCheck?: - | ((stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void) - | undefined; - waitForTrailers?: boolean | undefined; - offset?: number | undefined; - length?: number | undefined; - } - export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { - onError?: ((err: NodeJS.ErrnoException) => void) | undefined; - } - export interface Http2Stream extends stream.Duplex { - /** - * Set to `true` if the `Http2Stream` instance was aborted abnormally. When set, - * the `'aborted'` event will have been emitted. - * @since v8.4.0 - */ - readonly aborted: boolean; - /** - * This property shows the number of characters currently buffered to be written. - * See `net.Socket.bufferSize` for details. - * @since v11.2.0, v10.16.0 - */ - readonly bufferSize: number; - /** - * Set to `true` if the `Http2Stream` instance has been closed. - * @since v9.4.0 - */ - readonly closed: boolean; - /** - * Set to `true` if the `Http2Stream` instance has been destroyed and is no longer - * usable. - * @since v8.4.0 - */ - readonly destroyed: boolean; - /** - * Set to `true` if the `END_STREAM` flag was set in the request or response - * HEADERS frame received, indicating that no additional data should be received - * and the readable side of the `Http2Stream` will be closed. - * @since v10.11.0 - */ - readonly endAfterHeaders: boolean; - /** - * The numeric stream identifier of this `Http2Stream` instance. Set to `undefined` if the stream identifier has not yet been assigned. - * @since v8.4.0 - */ - readonly id?: number | undefined; - /** - * Set to `true` if the `Http2Stream` instance has not yet been assigned a - * numeric stream identifier. - * @since v9.4.0 - */ - readonly pending: boolean; - /** - * Set to the `RST_STREAM` `error code` reported when the `Http2Stream` is - * destroyed after either receiving an `RST_STREAM` frame from the connected peer, - * calling `http2stream.close()`, or `http2stream.destroy()`. Will be `undefined` if the `Http2Stream` has not been closed. - * @since v8.4.0 - */ - readonly rstCode: number; - /** - * An object containing the outbound headers sent for this `Http2Stream`. - * @since v9.5.0 - */ - readonly sentHeaders: OutgoingHttpHeaders; - /** - * An array of objects containing the outbound informational (additional) headers - * sent for this `Http2Stream`. - * @since v9.5.0 - */ - readonly sentInfoHeaders?: OutgoingHttpHeaders[] | undefined; - /** - * An object containing the outbound trailers sent for this `HttpStream`. - * @since v9.5.0 - */ - readonly sentTrailers?: OutgoingHttpHeaders | undefined; - /** - * A reference to the `Http2Session` instance that owns this `Http2Stream`. The - * value will be `undefined` after the `Http2Stream` instance is destroyed. - * @since v8.4.0 - */ - readonly session: Http2Session | undefined; - /** - * Provides miscellaneous information about the current state of the `Http2Stream`. - * - * A current state of this `Http2Stream`. - * @since v8.4.0 - */ - readonly state: StreamState; - /** - * Closes the `Http2Stream` instance by sending an `RST_STREAM` frame to the - * connected HTTP/2 peer. - * @since v8.4.0 - * @param [code=http2.constants.NGHTTP2_NO_ERROR] Unsigned 32-bit integer identifying the error code. - * @param callback An optional function registered to listen for the `'close'` event. - */ - close(code?: number, callback?: () => void): void; - /** - * Updates the priority for this `Http2Stream` instance. - * @since v8.4.0 - */ - priority(options: StreamPriorityOptions): void; - /** - * ```js - * import http2 from 'node:http2'; - * const client = http2.connect('http://example.org:8000'); - * const { NGHTTP2_CANCEL } = http2.constants; - * const req = client.request({ ':path': '/' }); - * - * // Cancel the stream if there's no activity after 5 seconds - * req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL)); - * ``` - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - /** - * Sends a trailing `HEADERS` frame to the connected HTTP/2 peer. This method - * will cause the `Http2Stream` to be immediately closed and must only be - * called after the `'wantTrailers'` event has been emitted. When sending a - * request or sending a response, the `options.waitForTrailers` option must be set - * in order to keep the `Http2Stream` open after the final `DATA` frame so that - * trailers can be sent. - * - * ```js - * import http2 from 'node:http2'; - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond(undefined, { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ xyz: 'abc' }); - * }); - * stream.end('Hello World'); - * }); - * ``` - * - * The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header - * fields (e.g. `':method'`, `':path'`, etc). - * @since v10.0.0 - */ - sendTrailers(headers: OutgoingHttpHeaders): void; - addListener(event: "aborted", listener: () => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener( - event: "frameError", - listener: (frameType: number, errorCode: number, id: number) => void, - ): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: "streamClosed", listener: (code: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "wantTrailers", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "aborted"): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: NonSharedBuffer | string): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "frameError", frameType: number, errorCode: number, id: number): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: "streamClosed", code: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "wantTrailers"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "aborted", listener: () => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number, id: number) => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: "streamClosed", listener: (code: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "wantTrailers", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "aborted", listener: () => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number, id: number) => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: "streamClosed", listener: (code: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "wantTrailers", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "aborted", listener: () => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener( - event: "frameError", - listener: (frameType: number, errorCode: number, id: number) => void, - ): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "streamClosed", listener: (code: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "wantTrailers", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "aborted", listener: () => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener( - event: "frameError", - listener: (frameType: number, errorCode: number, id: number) => void, - ): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "streamClosed", listener: (code: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "wantTrailers", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface ClientHttp2Stream extends Http2Stream { - addListener(event: "continue", listener: () => {}): this; - addListener( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - addListener( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "continue"): boolean; - emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "continue", listener: () => {}): this; - on( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - on( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "continue", listener: () => {}): this; - once( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - once( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "continue", listener: () => {}): this; - prependListener( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "continue", listener: () => {}): this; - prependOnceListener( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface ServerHttp2Stream extends Http2Stream { - /** - * True if headers were sent, false otherwise (read-only). - * @since v8.4.0 - */ - readonly headersSent: boolean; - /** - * Read-only property mapped to the `SETTINGS_ENABLE_PUSH` flag of the remote - * client's most recent `SETTINGS` frame. Will be `true` if the remote peer - * accepts push streams, `false` otherwise. Settings are the same for every `Http2Stream` in the same `Http2Session`. - * @since v8.4.0 - */ - readonly pushAllowed: boolean; - /** - * Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer. - * @since v8.4.0 - */ - additionalHeaders(headers: OutgoingHttpHeaders): void; - /** - * Initiates a push stream. The callback is invoked with the new `Http2Stream` instance created for the push stream passed as the second argument, or an `Error` passed as the first argument. - * - * ```js - * import http2 from 'node:http2'; - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond({ ':status': 200 }); - * stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => { - * if (err) throw err; - * pushStream.respond({ ':status': 200 }); - * pushStream.end('some pushed data'); - * }); - * stream.end('some data'); - * }); - * ``` - * - * Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass - * a `weight` value to `http2stream.priority` with the `silent` option set to `true` to enable server-side bandwidth balancing between concurrent streams. - * - * Calling `http2stream.pushStream()` from within a pushed stream is not permitted - * and will throw an error. - * @since v8.4.0 - * @param callback Callback that is called once the push stream has been initiated. - */ - pushStream( - headers: OutgoingHttpHeaders, - callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void, - ): void; - pushStream( - headers: OutgoingHttpHeaders, - options?: StreamPriorityOptions, - callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void, - ): void; - /** - * ```js - * import http2 from 'node:http2'; - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond({ ':status': 200 }); - * stream.end('some data'); - * }); - * ``` - * - * Initiates a response. When the `options.waitForTrailers` option is set, the `'wantTrailers'` event - * will be emitted immediately after queuing the last chunk of payload data to be sent. - * The `http2stream.sendTrailers()` method can then be used to send trailing header fields to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`. - * - * ```js - * import http2 from 'node:http2'; - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond({ ':status': 200 }, { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ ABC: 'some value to send' }); - * }); - * stream.end('some data'); - * }); - * ``` - * @since v8.4.0 - */ - respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; - /** - * Initiates a response whose data is read from the given file descriptor. No - * validation is performed on the given file descriptor. If an error occurs while - * attempting to read data using the file descriptor, the `Http2Stream` will be - * closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. - * - * When used, the `Http2Stream` object's `Duplex` interface will be closed - * automatically. - * - * ```js - * import http2 from 'node:http2'; - * import fs from 'node:fs'; - * - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * const fd = fs.openSync('/some/file', 'r'); - * - * const stat = fs.fstatSync(fd); - * const headers = { - * 'content-length': stat.size, - * 'last-modified': stat.mtime.toUTCString(), - * 'content-type': 'text/plain; charset=utf-8', - * }; - * stream.respondWithFD(fd, headers); - * stream.on('close', () => fs.closeSync(fd)); - * }); - * ``` - * - * The optional `options.statCheck` function may be specified to give user code - * an opportunity to set additional content headers based on the `fs.Stat` details - * of the given fd. If the `statCheck` function is provided, the `http2stream.respondWithFD()` method will - * perform an `fs.fstat()` call to collect details on the provided file descriptor. - * - * The `offset` and `length` options may be used to limit the response to a - * specific range subset. This can be used, for instance, to support HTTP Range - * requests. - * - * The file descriptor or `FileHandle` is not closed when the stream is closed, - * so it will need to be closed manually once it is no longer needed. - * Using the same file descriptor concurrently for multiple streams - * is not supported and may result in data loss. Re-using a file descriptor - * after a stream has finished is supported. - * - * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event - * will be emitted immediately after queuing the last chunk of payload data to be - * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing - * header fields to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code _must_ call either `http2stream.sendTrailers()` - * or `http2stream.close()` to close the `Http2Stream`. - * - * ```js - * import http2 from 'node:http2'; - * import fs from 'node:fs'; - * - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * const fd = fs.openSync('/some/file', 'r'); - * - * const stat = fs.fstatSync(fd); - * const headers = { - * 'content-length': stat.size, - * 'last-modified': stat.mtime.toUTCString(), - * 'content-type': 'text/plain; charset=utf-8', - * }; - * stream.respondWithFD(fd, headers, { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ ABC: 'some value to send' }); - * }); - * - * stream.on('close', () => fs.closeSync(fd)); - * }); - * ``` - * @since v8.4.0 - * @param fd A readable file descriptor. - */ - respondWithFD( - fd: number | fs.promises.FileHandle, - headers?: OutgoingHttpHeaders, - options?: ServerStreamFileResponseOptions, - ): void; - /** - * Sends a regular file as the response. The `path` must specify a regular file - * or an `'error'` event will be emitted on the `Http2Stream` object. - * - * When used, the `Http2Stream` object's `Duplex` interface will be closed - * automatically. - * - * The optional `options.statCheck` function may be specified to give user code - * an opportunity to set additional content headers based on the `fs.Stat` details - * of the given file: - * - * If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an - * `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. - * If the `onError` callback is defined, then it will be called. Otherwise, the stream will be destroyed. - * - * Example using a file path: - * - * ```js - * import http2 from 'node:http2'; - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * function statCheck(stat, headers) { - * headers['last-modified'] = stat.mtime.toUTCString(); - * } - * - * function onError(err) { - * // stream.respond() can throw if the stream has been destroyed by - * // the other side. - * try { - * if (err.code === 'ENOENT') { - * stream.respond({ ':status': 404 }); - * } else { - * stream.respond({ ':status': 500 }); - * } - * } catch (err) { - * // Perform actual error handling. - * console.error(err); - * } - * stream.end(); - * } - * - * stream.respondWithFile('/some/file', - * { 'content-type': 'text/plain; charset=utf-8' }, - * { statCheck, onError }); - * }); - * ``` - * - * The `options.statCheck` function may also be used to cancel the send operation - * by returning `false`. For instance, a conditional request may check the stat - * results to determine if the file has been modified to return an appropriate `304` response: - * - * ```js - * import http2 from 'node:http2'; - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * function statCheck(stat, headers) { - * // Check the stat here... - * stream.respond({ ':status': 304 }); - * return false; // Cancel the send operation - * } - * stream.respondWithFile('/some/file', - * { 'content-type': 'text/plain; charset=utf-8' }, - * { statCheck }); - * }); - * ``` - * - * The `content-length` header field will be automatically set. - * - * The `offset` and `length` options may be used to limit the response to a - * specific range subset. This can be used, for instance, to support HTTP Range - * requests. - * - * The `options.onError` function may also be used to handle all the errors - * that could happen before the delivery of the file is initiated. The - * default behavior is to destroy the stream. - * - * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event - * will be emitted immediately after queuing the last chunk of payload data to be - * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing - * header fields to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. - * - * ```js - * import http2 from 'node:http2'; - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respondWithFile('/some/file', - * { 'content-type': 'text/plain; charset=utf-8' }, - * { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ ABC: 'some value to send' }); - * }); - * }); - * ``` - * @since v8.4.0 - */ - respondWithFile( - path: string, - headers?: OutgoingHttpHeaders, - options?: ServerStreamFileResponseOptionsWithError, - ): void; - } - // Http2Session - export interface Settings { - headerTableSize?: number | undefined; - enablePush?: boolean | undefined; - initialWindowSize?: number | undefined; - maxFrameSize?: number | undefined; - maxConcurrentStreams?: number | undefined; - maxHeaderListSize?: number | undefined; - enableConnectProtocol?: boolean | undefined; - customSettings?: { [key: number]: number }; - } - export interface ClientSessionRequestOptions { - endStream?: boolean | undefined; - exclusive?: boolean | undefined; - parent?: number | undefined; - weight?: number | undefined; - waitForTrailers?: boolean | undefined; - signal?: AbortSignal | undefined; - } - export interface SessionState { - effectiveLocalWindowSize?: number | undefined; - effectiveRecvDataLength?: number | undefined; - nextStreamID?: number | undefined; - localWindowSize?: number | undefined; - lastProcStreamID?: number | undefined; - remoteWindowSize?: number | undefined; - outboundQueueSize?: number | undefined; - deflateDynamicTableSize?: number | undefined; - inflateDynamicTableSize?: number | undefined; - } - export interface Http2Session extends EventEmitter { - /** - * Value will be `undefined` if the `Http2Session` is not yet connected to a - * socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or - * will return the value of the connected `TLSSocket`'s own `alpnProtocol` property. - * @since v9.4.0 - */ - readonly alpnProtocol?: string | undefined; - /** - * Will be `true` if this `Http2Session` instance has been closed, otherwise `false`. - * @since v9.4.0 - */ - readonly closed: boolean; - /** - * Will be `true` if this `Http2Session` instance is still connecting, will be set - * to `false` before emitting `connect` event and/or calling the `http2.connect` callback. - * @since v10.0.0 - */ - readonly connecting: boolean; - /** - * Will be `true` if this `Http2Session` instance has been destroyed and must no - * longer be used, otherwise `false`. - * @since v8.4.0 - */ - readonly destroyed: boolean; - /** - * Value is `undefined` if the `Http2Session` session socket has not yet been - * connected, `true` if the `Http2Session` is connected with a `TLSSocket`, - * and `false` if the `Http2Session` is connected to any other kind of socket - * or stream. - * @since v9.4.0 - */ - readonly encrypted?: boolean | undefined; - /** - * A prototype-less object describing the current local settings of this `Http2Session`. - * The local settings are local to _this_`Http2Session` instance. - * @since v8.4.0 - */ - readonly localSettings: Settings; - /** - * If the `Http2Session` is connected to a `TLSSocket`, the `originSet` property - * will return an `Array` of origins for which the `Http2Session` may be - * considered authoritative. - * - * The `originSet` property is only available when using a secure TLS connection. - * @since v9.4.0 - */ - readonly originSet?: string[] | undefined; - /** - * Indicates whether the `Http2Session` is currently waiting for acknowledgment of - * a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method. - * Will be `false` once all sent `SETTINGS` frames have been acknowledged. - * @since v8.4.0 - */ - readonly pendingSettingsAck: boolean; - /** - * A prototype-less object describing the current remote settings of this`Http2Session`. - * The remote settings are set by the _connected_ HTTP/2 peer. - * @since v8.4.0 - */ - readonly remoteSettings: Settings; - /** - * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but - * limits available methods to ones safe to use with HTTP/2. - * - * `destroy`, `emit`, `end`, `pause`, `read`, `resume`, and `write` will throw - * an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for more information. - * - * `setTimeout` method will be called on this `Http2Session`. - * - * All other interactions will be routed directly to the socket. - * @since v8.4.0 - */ - readonly socket: net.Socket | tls.TLSSocket; - /** - * Provides miscellaneous information about the current state of the`Http2Session`. - * - * An object describing the current status of this `Http2Session`. - * @since v8.4.0 - */ - readonly state: SessionState; - /** - * The `http2session.type` will be equal to `http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a - * server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a - * client. - * @since v8.4.0 - */ - readonly type: number; - /** - * Gracefully closes the `Http2Session`, allowing any existing streams to - * complete on their own and preventing new `Http2Stream` instances from being - * created. Once closed, `http2session.destroy()`_might_ be called if there - * are no open `Http2Stream` instances. - * - * If specified, the `callback` function is registered as a handler for the`'close'` event. - * @since v9.4.0 - */ - close(callback?: () => void): void; - /** - * Immediately terminates the `Http2Session` and the associated `net.Socket` or `tls.TLSSocket`. - * - * Once destroyed, the `Http2Session` will emit the `'close'` event. If `error` is not undefined, an `'error'` event will be emitted immediately before the `'close'` event. - * - * If there are any remaining open `Http2Streams` associated with the `Http2Session`, those will also be destroyed. - * @since v8.4.0 - * @param error An `Error` object if the `Http2Session` is being destroyed due to an error. - * @param code The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`, otherwise defaults to `NO_ERROR`. - */ - destroy(error?: Error, code?: number): void; - /** - * Transmits a `GOAWAY` frame to the connected peer _without_ shutting down the`Http2Session`. - * @since v9.4.0 - * @param code An HTTP/2 error code - * @param lastStreamID The numeric ID of the last processed `Http2Stream` - * @param opaqueData A `TypedArray` or `DataView` instance containing additional data to be carried within the `GOAWAY` frame. - */ - goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void; - /** - * Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must - * be provided. The method will return `true` if the `PING` was sent, `false` otherwise. - * - * The maximum number of outstanding (unacknowledged) pings is determined by the `maxOutstandingPings` configuration option. The default maximum is 10. - * - * If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView` containing 8 bytes of data that will be transmitted with the `PING` and - * returned with the ping acknowledgment. - * - * The callback will be invoked with three arguments: an error argument that will - * be `null` if the `PING` was successfully acknowledged, a `duration` argument - * that reports the number of milliseconds elapsed since the ping was sent and the - * acknowledgment was received, and a `Buffer` containing the 8-byte `PING` payload. - * - * ```js - * session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => { - * if (!err) { - * console.log(`Ping acknowledged in ${duration} milliseconds`); - * console.log(`With payload '${payload.toString()}'`); - * } - * }); - * ``` - * - * If the `payload` argument is not specified, the default payload will be the - * 64-bit timestamp (little endian) marking the start of the `PING` duration. - * @since v8.9.3 - * @param payload Optional ping payload. - */ - ping(callback: (err: Error | null, duration: number, payload: NonSharedBuffer) => void): boolean; - ping( - payload: NodeJS.ArrayBufferView, - callback: (err: Error | null, duration: number, payload: NonSharedBuffer) => void, - ): boolean; - /** - * Calls `ref()` on this `Http2Session` instance's underlying `net.Socket`. - * @since v9.4.0 - */ - ref(): void; - /** - * Sets the local endpoint's window size. - * The `windowSize` is the total window size to set, not - * the delta. - * - * ```js - * import http2 from 'node:http2'; - * - * const server = http2.createServer(); - * const expectedWindowSize = 2 ** 20; - * server.on('connect', (session) => { - * - * // Set local window size to be 2 ** 20 - * session.setLocalWindowSize(expectedWindowSize); - * }); - * ``` - * @since v15.3.0, v14.18.0 - */ - setLocalWindowSize(windowSize: number): void; - /** - * Used to set a callback function that is called when there is no activity on - * the `Http2Session` after `msecs` milliseconds. The given `callback` is - * registered as a listener on the `'timeout'` event. - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - /** - * Updates the current local settings for this `Http2Session` and sends a new `SETTINGS` frame to the connected HTTP/2 peer. - * - * Once called, the `http2session.pendingSettingsAck` property will be `true` while the session is waiting for the remote peer to acknowledge the new - * settings. - * - * The new settings will not become effective until the `SETTINGS` acknowledgment - * is received and the `'localSettings'` event is emitted. It is possible to send - * multiple `SETTINGS` frames while acknowledgment is still pending. - * @since v8.4.0 - * @param callback Callback that is called once the session is connected or right away if the session is already connected. - */ - settings( - settings: Settings, - callback?: (err: Error | null, settings: Settings, duration: number) => void, - ): void; - /** - * Calls `unref()` on this `Http2Session`instance's underlying `net.Socket`. - * @since v9.4.0 - */ - unref(): void; - addListener(event: "close", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener( - event: "frameError", - listener: (frameType: number, errorCode: number, id: number) => void, - ): this; - addListener( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void, - ): this; - addListener(event: "localSettings", listener: (settings: Settings) => void): this; - addListener(event: "ping", listener: () => void): this; - addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "frameError", frameType: number, errorCode: number, id: number): boolean; - emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer): boolean; - emit(event: "localSettings", settings: Settings): boolean; - emit(event: "ping"): boolean; - emit(event: "remoteSettings", settings: Settings): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number, id: number) => void): this; - on( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void, - ): this; - on(event: "localSettings", listener: (settings: Settings) => void): this; - on(event: "ping", listener: () => void): this; - on(event: "remoteSettings", listener: (settings: Settings) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number, id: number) => void): this; - once( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void, - ): this; - once(event: "localSettings", listener: (settings: Settings) => void): this; - once(event: "ping", listener: () => void): this; - once(event: "remoteSettings", listener: (settings: Settings) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener( - event: "frameError", - listener: (frameType: number, errorCode: number, id: number) => void, - ): this; - prependListener( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void, - ): this; - prependListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependListener(event: "ping", listener: () => void): this; - prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener( - event: "frameError", - listener: (frameType: number, errorCode: number, id: number) => void, - ): this; - prependOnceListener( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void, - ): this; - prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "ping", listener: () => void): this; - prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface ClientHttp2Session extends Http2Session { - /** - * For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` creates and returns an `Http2Stream` instance that can be used to send an - * HTTP/2 request to the connected server. - * - * When a `ClientHttp2Session` is first created, the socket may not yet be - * connected. if `clienthttp2session.request()` is called during this time, the - * actual request will be deferred until the socket is ready to go. - * If the `session` is closed before the actual request be executed, an `ERR_HTTP2_GOAWAY_SESSION` is thrown. - * - * This method is only available if `http2session.type` is equal to `http2.constants.NGHTTP2_SESSION_CLIENT`. - * - * ```js - * import http2 from 'node:http2'; - * const clientSession = http2.connect('https://localhost:1234'); - * const { - * HTTP2_HEADER_PATH, - * HTTP2_HEADER_STATUS, - * } = http2.constants; - * - * const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' }); - * req.on('response', (headers) => { - * console.log(headers[HTTP2_HEADER_STATUS]); - * req.on('data', (chunk) => { // .. }); - * req.on('end', () => { // .. }); - * }); - * ``` - * - * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event - * is emitted immediately after queuing the last chunk of payload data to be sent. - * The `http2stream.sendTrailers()` method can then be called to send trailing - * headers to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. - * - * When `options.signal` is set with an `AbortSignal` and then `abort` on the - * corresponding `AbortController` is called, the request will emit an `'error'`event with an `AbortError` error. - * - * The `:method` and `:path` pseudo-headers are not specified within `headers`, - * they respectively default to: - * - * * `:method` \= `'GET'` - * * `:path` \= `/` - * @since v8.4.0 - */ - request( - headers?: OutgoingHttpHeaders | readonly string[], - options?: ClientSessionRequestOptions, - ): ClientHttp2Stream; - addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - addListener(event: "origin", listener: (origins: string[]) => void): this; - addListener( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - addListener( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "altsvc", alt: string, origin: string, stream: number): boolean; - emit(event: "origin", origins: readonly string[]): boolean; - emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit( - event: "stream", - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - on(event: "origin", listener: (origins: string[]) => void): this; - on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - once(event: "origin", listener: (origins: string[]) => void): this; - once( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - once( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependListener(event: "origin", listener: (origins: string[]) => void): this; - prependListener( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - prependListener( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependOnceListener(event: "origin", listener: (origins: string[]) => void): this; - prependOnceListener( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - prependOnceListener( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface AlternativeServiceOptions { - origin: number | string | url.URL; - } - export interface ServerHttp2Session< - Http1Request extends typeof IncomingMessage = typeof IncomingMessage, - Http1Response extends typeof ServerResponse> = typeof ServerResponse, - Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, - Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, - > extends Http2Session { - readonly server: - | Http2Server - | Http2SecureServer; - /** - * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client. - * - * ```js - * import http2 from 'node:http2'; - * - * const server = http2.createServer(); - * server.on('session', (session) => { - * // Set altsvc for origin https://example.org:80 - * session.altsvc('h2=":8000"', 'https://example.org:80'); - * }); - * - * server.on('stream', (stream) => { - * // Set altsvc for a specific stream - * stream.session.altsvc('h2=":8000"', stream.id); - * }); - * ``` - * - * Sending an `ALTSVC` frame with a specific stream ID indicates that the alternate - * service is associated with the origin of the given `Http2Stream`. - * - * The `alt` and origin string _must_ contain only ASCII bytes and are - * strictly interpreted as a sequence of ASCII bytes. The special value `'clear'`may be passed to clear any previously set alternative service for a given - * domain. - * - * When a string is passed for the `originOrStream` argument, it will be parsed as - * a URL and the origin will be derived. For instance, the origin for the - * HTTP URL `'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given string - * cannot be parsed as a URL or if a valid origin cannot be derived. - * - * A `URL` object, or any object with an `origin` property, may be passed as`originOrStream`, in which case the value of the `origin` property will be - * used. The value of the `origin` property _must_ be a properly serialized - * ASCII origin. - * @since v9.4.0 - * @param alt A description of the alternative service configuration as defined by `RFC 7838`. - * @param originOrStream Either a URL string specifying the origin (or an `Object` with an `origin` property) or the numeric identifier of an active `Http2Stream` as given by the - * `http2stream.id` property. - */ - altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; - /** - * Submits an `ORIGIN` frame (as defined by [RFC 8336](https://tools.ietf.org/html/rfc8336)) to the connected client - * to advertise the set of origins for which the server is capable of providing - * authoritative responses. - * - * ```js - * import http2 from 'node:http2'; - * const options = getSecureOptionsSomehow(); - * const server = http2.createSecureServer(options); - * server.on('stream', (stream) => { - * stream.respond(); - * stream.end('ok'); - * }); - * server.on('session', (session) => { - * session.origin('https://example.com', 'https://example.org'); - * }); - * ``` - * - * When a string is passed as an `origin`, it will be parsed as a URL and the - * origin will be derived. For instance, the origin for the HTTP URL `'https://example.org/foo/bar'` is the ASCII string` 'https://example.org'`. An error will be thrown if either the given - * string - * cannot be parsed as a URL or if a valid origin cannot be derived. - * - * A `URL` object, or any object with an `origin` property, may be passed as - * an `origin`, in which case the value of the `origin` property will be - * used. The value of the `origin` property _must_ be a properly serialized - * ASCII origin. - * - * Alternatively, the `origins` option may be used when creating a new HTTP/2 - * server using the `http2.createSecureServer()` method: - * - * ```js - * import http2 from 'node:http2'; - * const options = getSecureOptionsSomehow(); - * options.origins = ['https://example.com', 'https://example.org']; - * const server = http2.createSecureServer(options); - * server.on('stream', (stream) => { - * stream.respond(); - * stream.end('ok'); - * }); - * ``` - * @since v10.12.0 - * @param origins One or more URL Strings passed as separate arguments. - */ - origin( - ...origins: Array< - | string - | url.URL - | { - origin: string; - } - > - ): void; - addListener( - event: "connect", - listener: ( - session: ServerHttp2Session, - socket: net.Socket | tls.TLSSocket, - ) => void, - ): this; - addListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit( - event: "connect", - session: ServerHttp2Session, - socket: net.Socket | tls.TLSSocket, - ): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on( - event: "connect", - listener: ( - session: ServerHttp2Session, - socket: net.Socket | tls.TLSSocket, - ) => void, - ): this; - on( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once( - event: "connect", - listener: ( - session: ServerHttp2Session, - socket: net.Socket | tls.TLSSocket, - ) => void, - ): this; - once( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener( - event: "connect", - listener: ( - session: ServerHttp2Session, - socket: net.Socket | tls.TLSSocket, - ) => void, - ): this; - prependListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "connect", - listener: ( - session: ServerHttp2Session, - socket: net.Socket | tls.TLSSocket, - ) => void, - ): this; - prependOnceListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - // Http2Server - export interface SessionOptions { - /** - * Sets the maximum dynamic table size for deflating header fields. - * @default 4Kib - */ - maxDeflateDynamicTableSize?: number | undefined; - /** - * Sets the maximum number of settings entries per `SETTINGS` frame. - * The minimum value allowed is `1`. - * @default 32 - */ - maxSettings?: number | undefined; - /** - * Sets the maximum memory that the `Http2Session` is permitted to use. - * The value is expressed in terms of number of megabytes, e.g. `1` equal 1 megabyte. - * The minimum value allowed is `1`. - * This is a credit based limit, existing `Http2Stream`s may cause this limit to be exceeded, - * but new `Http2Stream` instances will be rejected while this limit is exceeded. - * The current number of `Http2Stream` sessions, the current memory use of the header compression tables, - * current data queued to be sent, and unacknowledged `PING` and `SETTINGS` frames are all counted towards the current limit. - * @default 10 - */ - maxSessionMemory?: number | undefined; - /** - * Sets the maximum number of header entries. - * This is similar to `server.maxHeadersCount` or `request.maxHeadersCount` in the `node:http` module. - * The minimum value is `1`. - * @default 128 - */ - maxHeaderListPairs?: number | undefined; - /** - * Sets the maximum number of outstanding, unacknowledged pings. - * @default 10 - */ - maxOutstandingPings?: number | undefined; - /** - * Sets the maximum allowed size for a serialized, compressed block of headers. - * Attempts to send headers that exceed this limit will result in - * a `'frameError'` event being emitted and the stream being closed and destroyed. - */ - maxSendHeaderBlockLength?: number | undefined; - /** - * Strategy used for determining the amount of padding to use for `HEADERS` and `DATA` frames. - * @default http2.constants.PADDING_STRATEGY_NONE - */ - paddingStrategy?: number | undefined; - /** - * Sets the maximum number of concurrent streams for the remote peer as if a `SETTINGS` frame had been received. - * Will be overridden if the remote peer sets its own value for `maxConcurrentStreams`. - * @default 100 - */ - peerMaxConcurrentStreams?: number | undefined; - /** - * The initial settings to send to the remote peer upon connection. - */ - settings?: Settings | undefined; - /** - * The array of integer values determines the settings types, - * which are included in the `CustomSettings`-property of the received remoteSettings. - * Please see the `CustomSettings`-property of the `Http2Settings` object for more information, on the allowed setting types. - */ - remoteCustomSettings?: number[] | undefined; - /** - * Specifies a timeout in milliseconds that - * a server should wait when an [`'unknownProtocol'`][] is emitted. If the - * socket has not been destroyed by that time the server will destroy it. - * @default 100000 - */ - unknownProtocolTimeout?: number | undefined; - /** - * If `true`, it turns on strict leading - * and trailing whitespace validation for HTTP/2 header field names and values - * as per [RFC-9113](https://www.rfc-editor.org/rfc/rfc9113.html#section-8.2.1). - * @since v24.2.0 - * @default true - */ - strictFieldWhitespaceValidation?: boolean | undefined; - } - export interface ClientSessionOptions extends SessionOptions { - /** - * Sets the maximum number of reserved push streams the client will accept at any given time. - * Once the current number of currently reserved push streams exceeds reaches this limit, - * new push streams sent by the server will be automatically rejected. - * The minimum allowed value is 0. The maximum allowed value is 232-1. - * A negative value sets this option to the maximum allowed value. - * @default 200 - */ - maxReservedRemoteStreams?: number | undefined; - /** - * An optional callback that receives the `URL` instance passed to `connect` and the `options` object, - * and returns any `Duplex` stream that is to be used as the connection for this session. - */ - createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined; - /** - * The protocol to connect with, if not set in the `authority`. - * Value may be either `'http:'` or `'https:'`. - * @default 'https:' - */ - protocol?: "http:" | "https:" | undefined; - } - export interface ServerSessionOptions< - Http1Request extends typeof IncomingMessage = typeof IncomingMessage, - Http1Response extends typeof ServerResponse> = typeof ServerResponse, - Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, - Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, - > extends SessionOptions { - maxSessionRejectedStreams?: number | undefined; - maxSessionInvalidFrames?: number | undefined; - streamResetBurst?: number | undefined; - streamResetRate?: number | undefined; - Http1IncomingMessage?: Http1Request | undefined; - Http1ServerResponse?: Http1Response | undefined; - Http2ServerRequest?: Http2Request | undefined; - Http2ServerResponse?: Http2Response | undefined; - } - export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {} - export interface SecureServerSessionOptions< - Http1Request extends typeof IncomingMessage = typeof IncomingMessage, - Http1Response extends typeof ServerResponse> = typeof ServerResponse, - Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, - Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, - > extends ServerSessionOptions, tls.TlsOptions {} - export interface ServerOptions< - Http1Request extends typeof IncomingMessage = typeof IncomingMessage, - Http1Response extends typeof ServerResponse> = typeof ServerResponse, - Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, - Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, - > extends ServerSessionOptions {} - export interface SecureServerOptions< - Http1Request extends typeof IncomingMessage = typeof IncomingMessage, - Http1Response extends typeof ServerResponse> = typeof ServerResponse, - Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, - Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, - > extends SecureServerSessionOptions { - allowHTTP1?: boolean | undefined; - origins?: string[] | undefined; - } - interface HTTP2ServerCommon { - setTimeout(msec?: number, callback?: () => void): this; - /** - * Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values. - * Throws ERR_INVALID_ARG_TYPE for invalid settings argument. - */ - updateSettings(settings: Settings): void; - } - export interface Http2Server< - Http1Request extends typeof IncomingMessage = typeof IncomingMessage, - Http1Response extends typeof ServerResponse> = typeof ServerResponse, - Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, - Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, - > extends net.Server, HTTP2ServerCommon { - addListener( - event: "checkContinue", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - addListener( - event: "request", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - addListener( - event: "session", - listener: (session: ServerHttp2Session) => void, - ): this; - addListener( - event: "sessionError", - listener: ( - err: Error, - session: ServerHttp2Session, - ) => void, - ): this; - addListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit( - event: "checkContinue", - request: InstanceType, - response: InstanceType, - ): boolean; - emit(event: "request", request: InstanceType, response: InstanceType): boolean; - emit( - event: "session", - session: ServerHttp2Session, - ): boolean; - emit( - event: "sessionError", - err: Error, - session: ServerHttp2Session, - ): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on( - event: "checkContinue", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - on( - event: "request", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - on( - event: "session", - listener: (session: ServerHttp2Session) => void, - ): this; - on( - event: "sessionError", - listener: ( - err: Error, - session: ServerHttp2Session, - ) => void, - ): this; - on( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once( - event: "checkContinue", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - once( - event: "request", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - once( - event: "session", - listener: (session: ServerHttp2Session) => void, - ): this; - once( - event: "sessionError", - listener: ( - err: Error, - session: ServerHttp2Session, - ) => void, - ): this; - once( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener( - event: "checkContinue", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - prependListener( - event: "request", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - prependListener( - event: "session", - listener: (session: ServerHttp2Session) => void, - ): this; - prependListener( - event: "sessionError", - listener: ( - err: Error, - session: ServerHttp2Session, - ) => void, - ): this; - prependListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "checkContinue", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - prependOnceListener( - event: "request", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - prependOnceListener( - event: "session", - listener: (session: ServerHttp2Session) => void, - ): this; - prependOnceListener( - event: "sessionError", - listener: ( - err: Error, - session: ServerHttp2Session, - ) => void, - ): this; - prependOnceListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface Http2SecureServer< - Http1Request extends typeof IncomingMessage = typeof IncomingMessage, - Http1Response extends typeof ServerResponse> = typeof ServerResponse, - Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, - Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, - > extends tls.Server, HTTP2ServerCommon { - addListener( - event: "checkContinue", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - addListener( - event: "request", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - addListener( - event: "session", - listener: (session: ServerHttp2Session) => void, - ): this; - addListener( - event: "sessionError", - listener: ( - err: Error, - session: ServerHttp2Session, - ) => void, - ): this; - addListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit( - event: "checkContinue", - request: InstanceType, - response: InstanceType, - ): boolean; - emit(event: "request", request: InstanceType, response: InstanceType): boolean; - emit( - event: "session", - session: ServerHttp2Session, - ): boolean; - emit( - event: "sessionError", - err: Error, - session: ServerHttp2Session, - ): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on( - event: "checkContinue", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - on( - event: "request", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - on( - event: "session", - listener: (session: ServerHttp2Session) => void, - ): this; - on( - event: "sessionError", - listener: ( - err: Error, - session: ServerHttp2Session, - ) => void, - ): this; - on( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - on(event: "timeout", listener: () => void): this; - on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once( - event: "checkContinue", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - once( - event: "request", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - once( - event: "session", - listener: (session: ServerHttp2Session) => void, - ): this; - once( - event: "sessionError", - listener: ( - err: Error, - session: ServerHttp2Session, - ) => void, - ): this; - once( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - once(event: "timeout", listener: () => void): this; - once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener( - event: "checkContinue", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - prependListener( - event: "request", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - prependListener( - event: "session", - listener: (session: ServerHttp2Session) => void, - ): this; - prependListener( - event: "sessionError", - listener: ( - err: Error, - session: ServerHttp2Session, - ) => void, - ): this; - prependListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "checkContinue", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - prependOnceListener( - event: "request", - listener: (request: InstanceType, response: InstanceType) => void, - ): this; - prependOnceListener( - event: "session", - listener: (session: ServerHttp2Session) => void, - ): this; - prependOnceListener( - event: "sessionError", - listener: ( - err: Error, - session: ServerHttp2Session, - ) => void, - ): this; - prependOnceListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * A `Http2ServerRequest` object is created by {@link Server} or {@link SecureServer} and passed as the first argument to the `'request'` event. It may be used to access a request status, - * headers, and - * data. - * @since v8.4.0 - */ - export class Http2ServerRequest extends stream.Readable { - constructor( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - options: stream.ReadableOptions, - rawHeaders: readonly string[], - ); - /** - * The `request.aborted` property will be `true` if the request has - * been aborted. - * @since v10.1.0 - */ - readonly aborted: boolean; - /** - * The request authority pseudo header field. Because HTTP/2 allows requests - * to set either `:authority` or `host`, this value is derived from `req.headers[':authority']` if present. Otherwise, it is derived from `req.headers['host']`. - * @since v8.4.0 - */ - readonly authority: string; - /** - * See `request.socket`. - * @since v8.4.0 - * @deprecated Since v13.0.0 - Use `socket`. - */ - readonly connection: net.Socket | tls.TLSSocket; - /** - * The `request.complete` property will be `true` if the request has - * been completed, aborted, or destroyed. - * @since v12.10.0 - */ - readonly complete: boolean; - /** - * The request/response headers object. - * - * Key-value pairs of header names and values. Header names are lower-cased. - * - * ```js - * // Prints something like: - * // - * // { 'user-agent': 'curl/7.22.0', - * // host: '127.0.0.1:8000', - * // accept: '*' } - * console.log(request.headers); - * ``` - * - * See `HTTP/2 Headers Object`. - * - * In HTTP/2, the request path, host name, protocol, and method are represented as - * special headers prefixed with the `:` character (e.g. `':path'`). These special - * headers will be included in the `request.headers` object. Care must be taken not - * to inadvertently modify these special headers or errors may occur. For instance, - * removing all headers from the request will cause errors to occur: - * - * ```js - * removeAllHeaders(request.headers); - * assert(request.url); // Fails because the :path header has been removed - * ``` - * @since v8.4.0 - */ - readonly headers: IncomingHttpHeaders; - /** - * In case of server request, the HTTP version sent by the client. In the case of - * client response, the HTTP version of the connected-to server. Returns `'2.0'`. - * - * Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second. - * @since v8.4.0 - */ - readonly httpVersion: string; - readonly httpVersionMinor: number; - readonly httpVersionMajor: number; - /** - * The request method as a string. Read-only. Examples: `'GET'`, `'DELETE'`. - * @since v8.4.0 - */ - readonly method: string; - /** - * The raw request/response headers list exactly as they were received. - * - * The keys and values are in the same list. It is _not_ a - * list of tuples. So, the even-numbered offsets are key values, and the - * odd-numbered offsets are the associated values. - * - * Header names are not lowercased, and duplicates are not merged. - * - * ```js - * // Prints something like: - * // - * // [ 'user-agent', - * // 'this is invalid because there can be only one', - * // 'User-Agent', - * // 'curl/7.22.0', - * // 'Host', - * // '127.0.0.1:8000', - * // 'ACCEPT', - * // '*' ] - * console.log(request.rawHeaders); - * ``` - * @since v8.4.0 - */ - readonly rawHeaders: string[]; - /** - * The raw request/response trailer keys and values exactly as they were - * received. Only populated at the `'end'` event. - * @since v8.4.0 - */ - readonly rawTrailers: string[]; - /** - * The request scheme pseudo header field indicating the scheme - * portion of the target URL. - * @since v8.4.0 - */ - readonly scheme: string; - /** - * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but - * applies getters, setters, and methods based on HTTP/2 logic. - * - * `destroyed`, `readable`, and `writable` properties will be retrieved from and - * set on `request.stream`. - * - * `destroy`, `emit`, `end`, `on` and `once` methods will be called on `request.stream`. - * - * `setTimeout` method will be called on `request.stream.session`. - * - * `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for - * more information. - * - * All other interactions will be routed directly to the socket. With TLS support, - * use `request.socket.getPeerCertificate()` to obtain the client's - * authentication details. - * @since v8.4.0 - */ - readonly socket: net.Socket | tls.TLSSocket; - /** - * The `Http2Stream` object backing the request. - * @since v8.4.0 - */ - readonly stream: ServerHttp2Stream; - /** - * The request/response trailers object. Only populated at the `'end'` event. - * @since v8.4.0 - */ - readonly trailers: IncomingHttpHeaders; - /** - * Request URL string. This contains only the URL that is present in the actual - * HTTP request. If the request is: - * - * ```http - * GET /status?name=ryan HTTP/1.1 - * Accept: text/plain - * ``` - * - * Then `request.url` will be: - * - * ```js - * '/status?name=ryan' - * ``` - * - * To parse the url into its parts, `new URL()` can be used: - * - * ```console - * $ node - * > new URL('/status?name=ryan', 'http://example.com') - * URL { - * href: 'http://example.com/status?name=ryan', - * origin: 'http://example.com', - * protocol: 'http:', - * username: '', - * password: '', - * host: 'example.com', - * hostname: 'example.com', - * port: '', - * pathname: '/status', - * search: '?name=ryan', - * searchParams: URLSearchParams { 'name' => 'ryan' }, - * hash: '' - * } - * ``` - * @since v8.4.0 - */ - url: string; - /** - * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is - * provided, then it is added as a listener on the `'timeout'` event on - * the response object. - * - * If no `'timeout'` listener is added to the request, the response, or - * the server, then `Http2Stream`s are destroyed when they time out. If a - * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly. - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - read(size?: number): NonSharedBuffer | string | null; - addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "aborted", hadError: boolean, code: number): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: NonSharedBuffer | string): boolean; - emit(event: "end"): boolean; - emit(event: "readable"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; - on(event: "end", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; - once(event: "end", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * This object is created internally by an HTTP server, not by the user. It is - * passed as the second parameter to the `'request'` event. - * @since v8.4.0 - */ - export class Http2ServerResponse extends stream.Writable { - constructor(stream: ServerHttp2Stream); - /** - * See `response.socket`. - * @since v8.4.0 - * @deprecated Since v13.0.0 - Use `socket`. - */ - readonly connection: net.Socket | tls.TLSSocket; - /** - * Append a single header value to the header object. - * - * If the value is an array, this is equivalent to calling this method multiple times. - * - * If there were no previous values for the header, this is equivalent to calling {@link setHeader}. - * - * Attempting to set a header field name or value that contains invalid characters will result in a - * [TypeError](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-typeerror) being thrown. - * - * ```js - * // Returns headers including "set-cookie: a" and "set-cookie: b" - * const server = http2.createServer((req, res) => { - * res.setHeader('set-cookie', 'a'); - * res.appendHeader('set-cookie', 'b'); - * res.writeHead(200); - * res.end('ok'); - * }); - * ``` - * @since v20.12.0 - */ - appendHeader(name: string, value: string | string[]): void; - /** - * Boolean value that indicates whether the response has completed. Starts - * as `false`. After `response.end()` executes, the value will be `true`. - * @since v8.4.0 - * @deprecated Since v13.4.0,v12.16.0 - Use `writableEnded`. - */ - readonly finished: boolean; - /** - * True if headers were sent, false otherwise (read-only). - * @since v8.4.0 - */ - readonly headersSent: boolean; - /** - * A reference to the original HTTP2 `request` object. - * @since v15.7.0 - */ - readonly req: Request; - /** - * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but - * applies getters, setters, and methods based on HTTP/2 logic. - * - * `destroyed`, `readable`, and `writable` properties will be retrieved from and - * set on `response.stream`. - * - * `destroy`, `emit`, `end`, `on` and `once` methods will be called on `response.stream`. - * - * `setTimeout` method will be called on `response.stream.session`. - * - * `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for - * more information. - * - * All other interactions will be routed directly to the socket. - * - * ```js - * import http2 from 'node:http2'; - * const server = http2.createServer((req, res) => { - * const ip = req.socket.remoteAddress; - * const port = req.socket.remotePort; - * res.end(`Your IP address is ${ip} and your source port is ${port}.`); - * }).listen(3000); - * ``` - * @since v8.4.0 - */ - readonly socket: net.Socket | tls.TLSSocket; - /** - * The `Http2Stream` object backing the response. - * @since v8.4.0 - */ - readonly stream: ServerHttp2Stream; - /** - * When true, the Date header will be automatically generated and sent in - * the response if it is not already present in the headers. Defaults to true. - * - * This should only be disabled for testing; HTTP requires the Date header - * in responses. - * @since v8.4.0 - */ - sendDate: boolean; - /** - * When using implicit headers (not calling `response.writeHead()` explicitly), - * this property controls the status code that will be sent to the client when - * the headers get flushed. - * - * ```js - * response.statusCode = 404; - * ``` - * - * After response header was sent to the client, this property indicates the - * status code which was sent out. - * @since v8.4.0 - */ - statusCode: number; - /** - * Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns - * an empty string. - * @since v8.4.0 - */ - statusMessage: ""; - /** - * This method adds HTTP trailing headers (a header but at the end of the - * message) to the response. - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * @since v8.4.0 - */ - addTrailers(trailers: OutgoingHttpHeaders): void; - /** - * This method signals to the server that all of the response headers and body - * have been sent; that server should consider this message complete. - * The method, `response.end()`, MUST be called on each response. - * - * If `data` is specified, it is equivalent to calling `response.write(data, encoding)` followed by `response.end(callback)`. - * - * If `callback` is specified, it will be called when the response stream - * is finished. - * @since v8.4.0 - */ - end(callback?: () => void): this; - end(data: string | Uint8Array, callback?: () => void): this; - end(data: string | Uint8Array, encoding: BufferEncoding, callback?: () => void): this; - /** - * Reads out a header that has already been queued but not sent to the client. - * The name is case-insensitive. - * - * ```js - * const contentType = response.getHeader('content-type'); - * ``` - * @since v8.4.0 - */ - getHeader(name: string): string; - /** - * Returns an array containing the unique names of the current outgoing headers. - * All header names are lowercase. - * - * ```js - * response.setHeader('Foo', 'bar'); - * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headerNames = response.getHeaderNames(); - * // headerNames === ['foo', 'set-cookie'] - * ``` - * @since v8.4.0 - */ - getHeaderNames(): string[]; - /** - * Returns a shallow copy of the current outgoing headers. Since a shallow copy - * is used, array values may be mutated without additional calls to various - * header-related http module methods. The keys of the returned object are the - * header names and the values are the respective header values. All header names - * are lowercase. - * - * The object returned by the `response.getHeaders()` method _does not_ prototypically inherit from the JavaScript `Object`. This means that typical `Object` methods such as `obj.toString()`, - * `obj.hasOwnProperty()`, and others - * are not defined and _will not work_. - * - * ```js - * response.setHeader('Foo', 'bar'); - * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headers = response.getHeaders(); - * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } - * ``` - * @since v8.4.0 - */ - getHeaders(): OutgoingHttpHeaders; - /** - * Returns `true` if the header identified by `name` is currently set in the - * outgoing headers. The header name matching is case-insensitive. - * - * ```js - * const hasContentType = response.hasHeader('content-type'); - * ``` - * @since v8.4.0 - */ - hasHeader(name: string): boolean; - /** - * Removes a header that has been queued for implicit sending. - * - * ```js - * response.removeHeader('Content-Encoding'); - * ``` - * @since v8.4.0 - */ - removeHeader(name: string): void; - /** - * Sets a single header value for implicit headers. If this header already exists - * in the to-be-sent headers, its value will be replaced. Use an array of strings - * here to send multiple headers with the same name. - * - * ```js - * response.setHeader('Content-Type', 'text/html; charset=utf-8'); - * ``` - * - * or - * - * ```js - * response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); - * ``` - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * - * When headers have been set with `response.setHeader()`, they will be merged - * with any headers passed to `response.writeHead()`, with the headers passed - * to `response.writeHead()` given precedence. - * - * ```js - * // Returns content-type = text/plain - * const server = http2.createServer((req, res) => { - * res.setHeader('Content-Type', 'text/html; charset=utf-8'); - * res.setHeader('X-Foo', 'bar'); - * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); - * res.end('ok'); - * }); - * ``` - * @since v8.4.0 - */ - setHeader(name: string, value: number | string | readonly string[]): void; - /** - * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is - * provided, then it is added as a listener on the `'timeout'` event on - * the response object. - * - * If no `'timeout'` listener is added to the request, the response, or - * the server, then `Http2Stream` s are destroyed when they time out. If a - * handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly. - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - /** - * If this method is called and `response.writeHead()` has not been called, - * it will switch to implicit header mode and flush the implicit headers. - * - * This sends a chunk of the response body. This method may - * be called multiple times to provide successive parts of the body. - * - * In the `node:http` module, the response body is omitted when the - * request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body. - * - * `chunk` can be a string or a buffer. If `chunk` is a string, - * the second parameter specifies how to encode it into a byte stream. - * By default the `encoding` is `'utf8'`. `callback` will be called when this chunk - * of data is flushed. - * - * This is the raw HTTP body and has nothing to do with higher-level multi-part - * body encodings that may be used. - * - * The first time `response.write()` is called, it will send the buffered - * header information and the first chunk of the body to the client. The second - * time `response.write()` is called, Node.js assumes data will be streamed, - * and sends the new data separately. That is, the response is buffered up to the - * first chunk of the body. - * - * Returns `true` if the entire data was flushed successfully to the kernel - * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is free again. - * @since v8.4.0 - */ - write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean; - write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean; - /** - * Sends a status `100 Continue` to the client, indicating that the request body - * should be sent. See the `'checkContinue'` event on `Http2Server` and `Http2SecureServer`. - * @since v8.4.0 - */ - writeContinue(): void; - /** - * Sends a status `103 Early Hints` to the client with a Link header, - * indicating that the user agent can preload/preconnect the linked resources. - * The `hints` is an object containing the values of headers to be sent with - * early hints message. - * - * **Example** - * - * ```js - * const earlyHintsLink = '; rel=preload; as=style'; - * response.writeEarlyHints({ - * 'link': earlyHintsLink, - * }); - * - * const earlyHintsLinks = [ - * '; rel=preload; as=style', - * '; rel=preload; as=script', - * ]; - * response.writeEarlyHints({ - * 'link': earlyHintsLinks, - * }); - * ``` - * @since v18.11.0 - */ - writeEarlyHints(hints: Record): void; - /** - * Sends a response header to the request. The status code is a 3-digit HTTP - * status code, like `404`. The last argument, `headers`, are the response headers. - * - * Returns a reference to the `Http2ServerResponse`, so that calls can be chained. - * - * For compatibility with `HTTP/1`, a human-readable `statusMessage` may be - * passed as the second argument. However, because the `statusMessage` has no - * meaning within HTTP/2, the argument will have no effect and a process warning - * will be emitted. - * - * ```js - * const body = 'hello world'; - * response.writeHead(200, { - * 'Content-Length': Buffer.byteLength(body), - * 'Content-Type': 'text/plain; charset=utf-8', - * }); - * ``` - * - * `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a - * given encoding. On outbound messages, Node.js does not check if Content-Length - * and the length of the body being transmitted are equal or not. However, when - * receiving messages, Node.js will automatically reject messages when the `Content-Length` does not match the actual payload size. - * - * This method may be called at most one time on a message before `response.end()` is called. - * - * If `response.write()` or `response.end()` are called before calling - * this, the implicit/mutable headers will be calculated and call this function. - * - * When headers have been set with `response.setHeader()`, they will be merged - * with any headers passed to `response.writeHead()`, with the headers passed - * to `response.writeHead()` given precedence. - * - * ```js - * // Returns content-type = text/plain - * const server = http2.createServer((req, res) => { - * res.setHeader('Content-Type', 'text/html; charset=utf-8'); - * res.setHeader('X-Foo', 'bar'); - * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); - * res.end('ok'); - * }); - * ``` - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * @since v8.4.0 - */ - writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; - writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; - /** - * Call `http2stream.pushStream()` with the given headers, and wrap the - * given `Http2Stream` on a newly created `Http2ServerResponse` as the callback - * parameter if successful. When `Http2ServerRequest` is closed, the callback is - * called with an error `ERR_HTTP2_INVALID_STREAM`. - * @since v8.4.0 - * @param headers An object describing the headers - * @param callback Called once `http2stream.pushStream()` is finished, or either when the attempt to create the pushed `Http2Stream` has failed or has been rejected, or the state of - * `Http2ServerRequest` is closed prior to calling the `http2stream.pushStream()` method - */ - createPushResponse( - headers: OutgoingHttpHeaders, - callback: (err: Error | null, res: Http2ServerResponse) => void, - ): void; - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export namespace constants { - const NGHTTP2_SESSION_SERVER: number; - const NGHTTP2_SESSION_CLIENT: number; - const NGHTTP2_STREAM_STATE_IDLE: number; - const NGHTTP2_STREAM_STATE_OPEN: number; - const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; - const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; - const NGHTTP2_STREAM_STATE_CLOSED: number; - const NGHTTP2_NO_ERROR: number; - const NGHTTP2_PROTOCOL_ERROR: number; - const NGHTTP2_INTERNAL_ERROR: number; - const NGHTTP2_FLOW_CONTROL_ERROR: number; - const NGHTTP2_SETTINGS_TIMEOUT: number; - const NGHTTP2_STREAM_CLOSED: number; - const NGHTTP2_FRAME_SIZE_ERROR: number; - const NGHTTP2_REFUSED_STREAM: number; - const NGHTTP2_CANCEL: number; - const NGHTTP2_COMPRESSION_ERROR: number; - const NGHTTP2_CONNECT_ERROR: number; - const NGHTTP2_ENHANCE_YOUR_CALM: number; - const NGHTTP2_INADEQUATE_SECURITY: number; - const NGHTTP2_HTTP_1_1_REQUIRED: number; - const NGHTTP2_ERR_FRAME_SIZE_ERROR: number; - const NGHTTP2_FLAG_NONE: number; - const NGHTTP2_FLAG_END_STREAM: number; - const NGHTTP2_FLAG_END_HEADERS: number; - const NGHTTP2_FLAG_ACK: number; - const NGHTTP2_FLAG_PADDED: number; - const NGHTTP2_FLAG_PRIORITY: number; - const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; - const DEFAULT_SETTINGS_ENABLE_PUSH: number; - const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; - const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; - const MAX_MAX_FRAME_SIZE: number; - const MIN_MAX_FRAME_SIZE: number; - const MAX_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_DEFAULT_WEIGHT: number; - const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; - const NGHTTP2_SETTINGS_ENABLE_PUSH: number; - const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; - const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; - const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; - const PADDING_STRATEGY_NONE: number; - const PADDING_STRATEGY_MAX: number; - const PADDING_STRATEGY_CALLBACK: number; - const HTTP2_HEADER_STATUS: string; - const HTTP2_HEADER_METHOD: string; - const HTTP2_HEADER_AUTHORITY: string; - const HTTP2_HEADER_SCHEME: string; - const HTTP2_HEADER_PATH: string; - const HTTP2_HEADER_ACCEPT_CHARSET: string; - const HTTP2_HEADER_ACCEPT_ENCODING: string; - const HTTP2_HEADER_ACCEPT_LANGUAGE: string; - const HTTP2_HEADER_ACCEPT_RANGES: string; - const HTTP2_HEADER_ACCEPT: string; - const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: string; - const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: string; - const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: string; - const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; - const HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS: string; - const HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS: string; - const HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD: string; - const HTTP2_HEADER_AGE: string; - const HTTP2_HEADER_ALLOW: string; - const HTTP2_HEADER_AUTHORIZATION: string; - const HTTP2_HEADER_CACHE_CONTROL: string; - const HTTP2_HEADER_CONNECTION: string; - const HTTP2_HEADER_CONTENT_DISPOSITION: string; - const HTTP2_HEADER_CONTENT_ENCODING: string; - const HTTP2_HEADER_CONTENT_LANGUAGE: string; - const HTTP2_HEADER_CONTENT_LENGTH: string; - const HTTP2_HEADER_CONTENT_LOCATION: string; - const HTTP2_HEADER_CONTENT_MD5: string; - const HTTP2_HEADER_CONTENT_RANGE: string; - const HTTP2_HEADER_CONTENT_TYPE: string; - const HTTP2_HEADER_COOKIE: string; - const HTTP2_HEADER_DATE: string; - const HTTP2_HEADER_ETAG: string; - const HTTP2_HEADER_EXPECT: string; - const HTTP2_HEADER_EXPIRES: string; - const HTTP2_HEADER_FROM: string; - const HTTP2_HEADER_HOST: string; - const HTTP2_HEADER_IF_MATCH: string; - const HTTP2_HEADER_IF_MODIFIED_SINCE: string; - const HTTP2_HEADER_IF_NONE_MATCH: string; - const HTTP2_HEADER_IF_RANGE: string; - const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; - const HTTP2_HEADER_LAST_MODIFIED: string; - const HTTP2_HEADER_LINK: string; - const HTTP2_HEADER_LOCATION: string; - const HTTP2_HEADER_MAX_FORWARDS: string; - const HTTP2_HEADER_PREFER: string; - const HTTP2_HEADER_PROXY_AUTHENTICATE: string; - const HTTP2_HEADER_PROXY_AUTHORIZATION: string; - const HTTP2_HEADER_RANGE: string; - const HTTP2_HEADER_REFERER: string; - const HTTP2_HEADER_REFRESH: string; - const HTTP2_HEADER_RETRY_AFTER: string; - const HTTP2_HEADER_SERVER: string; - const HTTP2_HEADER_SET_COOKIE: string; - const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; - const HTTP2_HEADER_TRANSFER_ENCODING: string; - const HTTP2_HEADER_TE: string; - const HTTP2_HEADER_UPGRADE: string; - const HTTP2_HEADER_USER_AGENT: string; - const HTTP2_HEADER_VARY: string; - const HTTP2_HEADER_VIA: string; - const HTTP2_HEADER_WWW_AUTHENTICATE: string; - const HTTP2_HEADER_HTTP2_SETTINGS: string; - const HTTP2_HEADER_KEEP_ALIVE: string; - const HTTP2_HEADER_PROXY_CONNECTION: string; - const HTTP2_METHOD_ACL: string; - const HTTP2_METHOD_BASELINE_CONTROL: string; - const HTTP2_METHOD_BIND: string; - const HTTP2_METHOD_CHECKIN: string; - const HTTP2_METHOD_CHECKOUT: string; - const HTTP2_METHOD_CONNECT: string; - const HTTP2_METHOD_COPY: string; - const HTTP2_METHOD_DELETE: string; - const HTTP2_METHOD_GET: string; - const HTTP2_METHOD_HEAD: string; - const HTTP2_METHOD_LABEL: string; - const HTTP2_METHOD_LINK: string; - const HTTP2_METHOD_LOCK: string; - const HTTP2_METHOD_MERGE: string; - const HTTP2_METHOD_MKACTIVITY: string; - const HTTP2_METHOD_MKCALENDAR: string; - const HTTP2_METHOD_MKCOL: string; - const HTTP2_METHOD_MKREDIRECTREF: string; - const HTTP2_METHOD_MKWORKSPACE: string; - const HTTP2_METHOD_MOVE: string; - const HTTP2_METHOD_OPTIONS: string; - const HTTP2_METHOD_ORDERPATCH: string; - const HTTP2_METHOD_PATCH: string; - const HTTP2_METHOD_POST: string; - const HTTP2_METHOD_PRI: string; - const HTTP2_METHOD_PROPFIND: string; - const HTTP2_METHOD_PROPPATCH: string; - const HTTP2_METHOD_PUT: string; - const HTTP2_METHOD_REBIND: string; - const HTTP2_METHOD_REPORT: string; - const HTTP2_METHOD_SEARCH: string; - const HTTP2_METHOD_TRACE: string; - const HTTP2_METHOD_UNBIND: string; - const HTTP2_METHOD_UNCHECKOUT: string; - const HTTP2_METHOD_UNLINK: string; - const HTTP2_METHOD_UNLOCK: string; - const HTTP2_METHOD_UPDATE: string; - const HTTP2_METHOD_UPDATEREDIRECTREF: string; - const HTTP2_METHOD_VERSION_CONTROL: string; - const HTTP_STATUS_CONTINUE: number; - const HTTP_STATUS_SWITCHING_PROTOCOLS: number; - const HTTP_STATUS_PROCESSING: number; - const HTTP_STATUS_OK: number; - const HTTP_STATUS_CREATED: number; - const HTTP_STATUS_ACCEPTED: number; - const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; - const HTTP_STATUS_NO_CONTENT: number; - const HTTP_STATUS_RESET_CONTENT: number; - const HTTP_STATUS_PARTIAL_CONTENT: number; - const HTTP_STATUS_MULTI_STATUS: number; - const HTTP_STATUS_ALREADY_REPORTED: number; - const HTTP_STATUS_IM_USED: number; - const HTTP_STATUS_MULTIPLE_CHOICES: number; - const HTTP_STATUS_MOVED_PERMANENTLY: number; - const HTTP_STATUS_FOUND: number; - const HTTP_STATUS_SEE_OTHER: number; - const HTTP_STATUS_NOT_MODIFIED: number; - const HTTP_STATUS_USE_PROXY: number; - const HTTP_STATUS_TEMPORARY_REDIRECT: number; - const HTTP_STATUS_PERMANENT_REDIRECT: number; - const HTTP_STATUS_BAD_REQUEST: number; - const HTTP_STATUS_UNAUTHORIZED: number; - const HTTP_STATUS_PAYMENT_REQUIRED: number; - const HTTP_STATUS_FORBIDDEN: number; - const HTTP_STATUS_NOT_FOUND: number; - const HTTP_STATUS_METHOD_NOT_ALLOWED: number; - const HTTP_STATUS_NOT_ACCEPTABLE: number; - const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; - const HTTP_STATUS_REQUEST_TIMEOUT: number; - const HTTP_STATUS_CONFLICT: number; - const HTTP_STATUS_GONE: number; - const HTTP_STATUS_LENGTH_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_FAILED: number; - const HTTP_STATUS_PAYLOAD_TOO_LARGE: number; - const HTTP_STATUS_URI_TOO_LONG: number; - const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; - const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; - const HTTP_STATUS_EXPECTATION_FAILED: number; - const HTTP_STATUS_TEAPOT: number; - const HTTP_STATUS_MISDIRECTED_REQUEST: number; - const HTTP_STATUS_UNPROCESSABLE_ENTITY: number; - const HTTP_STATUS_LOCKED: number; - const HTTP_STATUS_FAILED_DEPENDENCY: number; - const HTTP_STATUS_UNORDERED_COLLECTION: number; - const HTTP_STATUS_UPGRADE_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_REQUIRED: number; - const HTTP_STATUS_TOO_MANY_REQUESTS: number; - const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; - const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; - const HTTP_STATUS_INTERNAL_SERVER_ERROR: number; - const HTTP_STATUS_NOT_IMPLEMENTED: number; - const HTTP_STATUS_BAD_GATEWAY: number; - const HTTP_STATUS_SERVICE_UNAVAILABLE: number; - const HTTP_STATUS_GATEWAY_TIMEOUT: number; - const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; - const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; - const HTTP_STATUS_INSUFFICIENT_STORAGE: number; - const HTTP_STATUS_LOOP_DETECTED: number; - const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; - const HTTP_STATUS_NOT_EXTENDED: number; - const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; - } - /** - * This symbol can be set as a property on the HTTP/2 headers object with - * an array value in order to provide a list of headers considered sensitive. - */ - export const sensitiveHeaders: symbol; - /** - * Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called - * so instances returned may be safely modified for use. - * @since v8.4.0 - */ - export function getDefaultSettings(): Settings; - /** - * Returns a `Buffer` instance containing serialized representation of the given - * HTTP/2 settings as specified in the [HTTP/2](https://tools.ietf.org/html/rfc7540) specification. This is intended - * for use with the `HTTP2-Settings` header field. - * - * ```js - * import http2 from 'node:http2'; - * - * const packed = http2.getPackedSettings({ enablePush: false }); - * - * console.log(packed.toString('base64')); - * // Prints: AAIAAAAA - * ``` - * @since v8.4.0 - */ - export function getPackedSettings(settings: Settings): NonSharedBuffer; - /** - * Returns a `HTTP/2 Settings Object` containing the deserialized settings from - * the given `Buffer` as generated by `http2.getPackedSettings()`. - * @since v8.4.0 - * @param buf The packed settings. - */ - export function getUnpackedSettings(buf: Uint8Array): Settings; - /** - * Returns a `net.Server` instance that creates and manages `Http2Session` instances. - * - * Since there are no browsers known that support [unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when - * communicating - * with browser clients. - * - * ```js - * import http2 from 'node:http2'; - * - * // Create an unencrypted HTTP/2 server. - * // Since there are no browsers known that support - * // unencrypted HTTP/2, the use of `http2.createSecureServer()` - * // is necessary when communicating with browser clients. - * const server = http2.createServer(); - * - * server.on('stream', (stream, headers) => { - * stream.respond({ - * 'content-type': 'text/html; charset=utf-8', - * ':status': 200, - * }); - * stream.end('

                          Hello World

                          '); - * }); - * - * server.listen(8000); - * ``` - * @since v8.4.0 - * @param onRequestHandler See `Compatibility API` - */ - export function createServer( - onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): Http2Server; - export function createServer< - Http1Request extends typeof IncomingMessage = typeof IncomingMessage, - Http1Response extends typeof ServerResponse> = typeof ServerResponse, - Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, - Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, - >( - options: ServerOptions, - onRequestHandler?: (request: InstanceType, response: InstanceType) => void, - ): Http2Server; - /** - * Returns a `tls.Server` instance that creates and manages `Http2Session` instances. - * - * ```js - * import http2 from 'node:http2'; - * import fs from 'node:fs'; - * - * const options = { - * key: fs.readFileSync('server-key.pem'), - * cert: fs.readFileSync('server-cert.pem'), - * }; - * - * // Create a secure HTTP/2 server - * const server = http2.createSecureServer(options); - * - * server.on('stream', (stream, headers) => { - * stream.respond({ - * 'content-type': 'text/html; charset=utf-8', - * ':status': 200, - * }); - * stream.end('

                          Hello World

                          '); - * }); - * - * server.listen(8443); - * ``` - * @since v8.4.0 - * @param onRequestHandler See `Compatibility API` - */ - export function createSecureServer( - onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): Http2SecureServer; - export function createSecureServer< - Http1Request extends typeof IncomingMessage = typeof IncomingMessage, - Http1Response extends typeof ServerResponse> = typeof ServerResponse, - Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, - Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, - >( - options: SecureServerOptions, - onRequestHandler?: (request: InstanceType, response: InstanceType) => void, - ): Http2SecureServer; - /** - * Returns a `ClientHttp2Session` instance. - * - * ```js - * import http2 from 'node:http2'; - * const client = http2.connect('https://localhost:1234'); - * - * // Use the client - * - * client.close(); - * ``` - * @since v8.4.0 - * @param authority The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the `http://` or `https://` prefix, host name, and IP port (if a non-default port - * is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored. - * @param listener Will be registered as a one-time listener of the {@link 'connect'} event. - */ - export function connect( - authority: string | url.URL, - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): ClientHttp2Session; - export function connect( - authority: string | url.URL, - options?: ClientSessionOptions | SecureClientSessionOptions, - listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): ClientHttp2Session; - /** - * Create an HTTP/2 server session from an existing socket. - * @param socket A Duplex Stream - * @param options Any `{@link createServer}` options can be provided. - * @since v20.12.0 - */ - export function performServerHandshake< - Http1Request extends typeof IncomingMessage = typeof IncomingMessage, - Http1Response extends typeof ServerResponse> = typeof ServerResponse, - Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest, - Http2Response extends typeof Http2ServerResponse> = typeof Http2ServerResponse, - >( - socket: stream.Duplex, - options?: ServerOptions, - ): ServerHttp2Session; -} -declare module "node:http2" { - export * from "http2"; -} diff --git a/node_modules/@types/node/https.d.ts b/node_modules/@types/node/https.d.ts deleted file mode 100644 index e050255..0000000 --- a/node_modules/@types/node/https.d.ts +++ /dev/null @@ -1,579 +0,0 @@ -/** - * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a - * separate module. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/https.js) - */ -declare module "https" { - import { NonSharedBuffer } from "node:buffer"; - import { Duplex } from "node:stream"; - import * as tls from "node:tls"; - import * as http from "node:http"; - import { URL } from "node:url"; - interface ServerOptions< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse> = typeof http.ServerResponse, - > extends http.ServerOptions, tls.TlsOptions {} - interface RequestOptions extends http.RequestOptions, tls.SecureContextOptions { - checkServerIdentity?: - | ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined) - | undefined; - rejectUnauthorized?: boolean | undefined; // Defaults to true - servername?: string | undefined; // SNI TLS Extension - } - interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { - maxCachedSessions?: number | undefined; - } - /** - * An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information. - * @since v0.4.5 - */ - class Agent extends http.Agent { - constructor(options?: AgentOptions); - options: AgentOptions; - createConnection( - options: RequestOptions, - callback?: (err: Error | null, stream: Duplex) => void, - ): Duplex | null | undefined; - getName(options?: RequestOptions): string; - } - interface Server< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse> = typeof http.ServerResponse, - > extends http.Server {} - /** - * See `http.Server` for more information. - * @since v0.3.4 - */ - class Server< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse> = typeof http.ServerResponse, - > extends tls.Server { - constructor(requestListener?: http.RequestListener); - constructor( - options: ServerOptions, - requestListener?: http.RequestListener, - ); - /** - * Closes all connections connected to this server. - * @since v18.2.0 - */ - closeAllConnections(): void; - /** - * Closes all connections connected to this server which are not sending a request or waiting for a response. - * @since v18.2.0 - */ - closeIdleConnections(): void; - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this; - addListener( - event: "newSession", - listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, - ): this; - addListener( - event: "OCSPRequest", - listener: ( - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ) => void, - ): this; - addListener( - event: "resumeSession", - listener: ( - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ) => void, - ): this; - addListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Duplex) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "checkContinue", listener: http.RequestListener): this; - addListener(event: "checkExpectation", listener: http.RequestListener): this; - addListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - addListener( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, - ): this; - addListener(event: "request", listener: http.RequestListener): this; - addListener( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, - ): this; - emit(event: string, ...args: any[]): boolean; - emit(event: "keylog", line: NonSharedBuffer, tlsSocket: tls.TLSSocket): boolean; - emit( - event: "newSession", - sessionId: NonSharedBuffer, - sessionData: NonSharedBuffer, - callback: () => void, - ): boolean; - emit( - event: "OCSPRequest", - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ): boolean; - emit( - event: "resumeSession", - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ): boolean; - emit(event: "secureConnection", tlsSocket: tls.TLSSocket): boolean; - emit(event: "tlsClientError", err: Error, tlsSocket: tls.TLSSocket): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Duplex): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit( - event: "checkContinue", - req: InstanceType, - res: InstanceType, - ): boolean; - emit( - event: "checkExpectation", - req: InstanceType, - res: InstanceType, - ): boolean; - emit(event: "clientError", err: Error, socket: Duplex): boolean; - emit(event: "connect", req: InstanceType, socket: Duplex, head: NonSharedBuffer): boolean; - emit( - event: "request", - req: InstanceType, - res: InstanceType, - ): boolean; - emit(event: "upgrade", req: InstanceType, socket: Duplex, head: NonSharedBuffer): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this; - on( - event: "newSession", - listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, - ): this; - on( - event: "OCSPRequest", - listener: ( - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ) => void, - ): this; - on( - event: "resumeSession", - listener: ( - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ) => void, - ): this; - on(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - on(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Duplex) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "checkContinue", listener: http.RequestListener): this; - on(event: "checkExpectation", listener: http.RequestListener): this; - on(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - on( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, - ): this; - on(event: "request", listener: http.RequestListener): this; - on( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, - ): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this; - once( - event: "newSession", - listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, - ): this; - once( - event: "OCSPRequest", - listener: ( - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ) => void, - ): this; - once( - event: "resumeSession", - listener: ( - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ) => void, - ): this; - once(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - once(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Duplex) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "checkContinue", listener: http.RequestListener): this; - once(event: "checkExpectation", listener: http.RequestListener): this; - once(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - once( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, - ): this; - once(event: "request", listener: http.RequestListener): this; - once( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, - ): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this; - prependListener( - event: "newSession", - listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, - ): this; - prependListener( - event: "OCSPRequest", - listener: ( - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ) => void, - ): this; - prependListener( - event: "resumeSession", - listener: ( - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ) => void, - ): this; - prependListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Duplex) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "checkContinue", listener: http.RequestListener): this; - prependListener(event: "checkExpectation", listener: http.RequestListener): this; - prependListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - prependListener( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, - ): this; - prependListener(event: "request", listener: http.RequestListener): this; - prependListener( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, - ): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this; - prependOnceListener( - event: "newSession", - listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, - ): this; - prependOnceListener( - event: "OCSPRequest", - listener: ( - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ) => void, - ): this; - prependOnceListener( - event: "resumeSession", - listener: ( - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ) => void, - ): this; - prependOnceListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Duplex) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "checkContinue", listener: http.RequestListener): this; - prependOnceListener(event: "checkExpectation", listener: http.RequestListener): this; - prependOnceListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - prependOnceListener( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, - ): this; - prependOnceListener(event: "request", listener: http.RequestListener): this; - prependOnceListener( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: NonSharedBuffer) => void, - ): this; - } - /** - * ```js - * // curl -k https://localhost:8000/ - * import https from 'node:https'; - * import fs from 'node:fs'; - * - * const options = { - * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), - * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), - * }; - * - * https.createServer(options, (req, res) => { - * res.writeHead(200); - * res.end('hello world\n'); - * }).listen(8000); - * ``` - * - * Or - * - * ```js - * import https from 'node:https'; - * import fs from 'node:fs'; - * - * const options = { - * pfx: fs.readFileSync('test/fixtures/test_cert.pfx'), - * passphrase: 'sample', - * }; - * - * https.createServer(options, (req, res) => { - * res.writeHead(200); - * res.end('hello world\n'); - * }).listen(8000); - * ``` - * @since v0.3.4 - * @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`. - * @param requestListener A listener to be added to the `'request'` event. - */ - function createServer< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse> = typeof http.ServerResponse, - >(requestListener?: http.RequestListener): Server; - function createServer< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse> = typeof http.ServerResponse, - >( - options: ServerOptions, - requestListener?: http.RequestListener, - ): Server; - /** - * Makes a request to a secure web server. - * - * The following additional `options` from `tls.connect()` are also accepted: `ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`, `honorCipherOrder`, `key`, `passphrase`, - * `pfx`, `rejectUnauthorized`, `secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`, `highWaterMark`. - * - * `options` can be an object, a string, or a `URL` object. If `options` is a - * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. - * - * `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to - * upload a file with a POST request, then write to the `ClientRequest` object. - * - * ```js - * import https from 'node:https'; - * - * const options = { - * hostname: 'encrypted.google.com', - * port: 443, - * path: '/', - * method: 'GET', - * }; - * - * const req = https.request(options, (res) => { - * console.log('statusCode:', res.statusCode); - * console.log('headers:', res.headers); - * - * res.on('data', (d) => { - * process.stdout.write(d); - * }); - * }); - * - * req.on('error', (e) => { - * console.error(e); - * }); - * req.end(); - * ``` - * - * Example using options from `tls.connect()`: - * - * ```js - * const options = { - * hostname: 'encrypted.google.com', - * port: 443, - * path: '/', - * method: 'GET', - * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), - * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), - * }; - * options.agent = new https.Agent(options); - * - * const req = https.request(options, (res) => { - * // ... - * }); - * ``` - * - * Alternatively, opt out of connection pooling by not using an `Agent`. - * - * ```js - * const options = { - * hostname: 'encrypted.google.com', - * port: 443, - * path: '/', - * method: 'GET', - * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), - * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), - * agent: false, - * }; - * - * const req = https.request(options, (res) => { - * // ... - * }); - * ``` - * - * Example using a `URL` as `options`: - * - * ```js - * const options = new URL('https://abc:xyz@example.com'); - * - * const req = https.request(options, (res) => { - * // ... - * }); - * ``` - * - * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`): - * - * ```js - * import tls from 'node:tls'; - * import https from 'node:https'; - * import crypto from 'node:crypto'; - * - * function sha256(s) { - * return crypto.createHash('sha256').update(s).digest('base64'); - * } - * const options = { - * hostname: 'github.com', - * port: 443, - * path: '/', - * method: 'GET', - * checkServerIdentity: function(host, cert) { - * // Make sure the certificate is issued to the host we are connected to - * const err = tls.checkServerIdentity(host, cert); - * if (err) { - * return err; - * } - * - * // Pin the public key, similar to HPKP pin-sha256 pinning - * const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU='; - * if (sha256(cert.pubkey) !== pubkey256) { - * const msg = 'Certificate verification error: ' + - * `The public key of '${cert.subject.CN}' ` + - * 'does not match our pinned fingerprint'; - * return new Error(msg); - * } - * - * // Pin the exact certificate, rather than the pub key - * const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' + - * 'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16'; - * if (cert.fingerprint256 !== cert256) { - * const msg = 'Certificate verification error: ' + - * `The certificate of '${cert.subject.CN}' ` + - * 'does not match our pinned fingerprint'; - * return new Error(msg); - * } - * - * // This loop is informational only. - * // Print the certificate and public key fingerprints of all certs in the - * // chain. Its common to pin the public key of the issuer on the public - * // internet, while pinning the public key of the service in sensitive - * // environments. - * do { - * console.log('Subject Common Name:', cert.subject.CN); - * console.log(' Certificate SHA256 fingerprint:', cert.fingerprint256); - * - * hash = crypto.createHash('sha256'); - * console.log(' Public key ping-sha256:', sha256(cert.pubkey)); - * - * lastprint256 = cert.fingerprint256; - * cert = cert.issuerCertificate; - * } while (cert.fingerprint256 !== lastprint256); - * - * }, - * }; - * - * options.agent = new https.Agent(options); - * const req = https.request(options, (res) => { - * console.log('All OK. Server matched our pinned cert or public key'); - * console.log('statusCode:', res.statusCode); - * // Print the HPKP values - * console.log('headers:', res.headers['public-key-pins']); - * - * res.on('data', (d) => {}); - * }); - * - * req.on('error', (e) => { - * console.error(e.message); - * }); - * req.end(); - * ``` - * - * Outputs for example: - * - * ```text - * Subject Common Name: github.com - * Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16 - * Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU= - * Subject Common Name: DigiCert SHA2 Extended Validation Server CA - * Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A - * Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho= - * Subject Common Name: DigiCert High Assurance EV Root CA - * Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF - * Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18= - * All OK. Server matched our pinned cert or public key - * statusCode: 200 - * headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho="; - * pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4="; - * pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains - * ``` - * @since v0.3.6 - * @param options Accepts all `options` from `request`, with some differences in default values: - */ - function request( - options: RequestOptions | string | URL, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - function request( - url: string | URL, - options: RequestOptions, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - /** - * Like `http.get()` but for HTTPS. - * - * `options` can be an object, a string, or a `URL` object. If `options` is a - * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. - * - * ```js - * import https from 'node:https'; - * - * https.get('https://encrypted.google.com/', (res) => { - * console.log('statusCode:', res.statusCode); - * console.log('headers:', res.headers); - * - * res.on('data', (d) => { - * process.stdout.write(d); - * }); - * - * }).on('error', (e) => { - * console.error(e); - * }); - * ``` - * @since v0.3.6 - * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`. - */ - function get( - options: RequestOptions | string | URL, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - function get( - url: string | URL, - options: RequestOptions, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - let globalAgent: Agent; -} -declare module "node:https" { - export * from "https"; -} diff --git a/node_modules/@types/node/index.d.ts b/node_modules/@types/node/index.d.ts deleted file mode 100644 index c9edbd7..0000000 --- a/node_modules/@types/node/index.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -/** - * License for programmatically and manually incorporated - * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc - * - * Copyright Node.js contributors. All rights reserved. - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -// NOTE: These definitions support Node.js and TypeScript 5.7+. - -// Reference required TypeScript libs: -/// - -// TypeScript backwards-compatibility definitions: -/// - -// Definitions specific to TypeScript 5.7+: -/// -/// - -// Definitions for Node.js modules that are not specific to any version of TypeScript: -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// diff --git a/node_modules/@types/node/inspector.d.ts b/node_modules/@types/node/inspector.d.ts deleted file mode 100644 index 1f1a6fe..0000000 --- a/node_modules/@types/node/inspector.d.ts +++ /dev/null @@ -1,253 +0,0 @@ -/** - * The `node:inspector` module provides an API for interacting with the V8 - * inspector. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/inspector.js) - */ -declare module "inspector" { - import EventEmitter = require("node:events"); - /** - * The `inspector.Session` is used for dispatching messages to the V8 inspector - * back-end and receiving message responses and notifications. - */ - class Session extends EventEmitter { - /** - * Create a new instance of the inspector.Session class. - * The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend. - */ - constructor(); - /** - * Connects a session to the inspector back-end. - */ - connect(): void; - /** - * Connects a session to the inspector back-end. - * An exception will be thrown if this API was not called on a Worker thread. - * @since v12.11.0 - */ - connectToMainThread(): void; - /** - * Immediately close the session. All pending message callbacks will be called with an error. - * `session.connect()` will need to be called to be able to send messages again. - * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints. - */ - disconnect(): void; - } - /** - * Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has - * started. - * - * If wait is `true`, will block until a client has connected to the inspect port - * and flow control has been passed to the debugger client. - * - * See the [security warning](https://nodejs.org/docs/latest-v22.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure) - * regarding the `host` parameter usage. - * @param port Port to listen on for inspector connections. Defaults to what was specified on the CLI. - * @param host Host to listen on for inspector connections. Defaults to what was specified on the CLI. - * @param wait Block until a client has connected. Defaults to what was specified on the CLI. - * @returns Disposable that calls `inspector.close()`. - */ - function open(port?: number, host?: string, wait?: boolean): Disposable; - /** - * Deactivate the inspector. Blocks until there are no active connections. - */ - function close(): void; - /** - * Return the URL of the active inspector, or `undefined` if there is none. - * - * ```console - * $ node --inspect -p 'inspector.url()' - * Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 - * For help, see: https://nodejs.org/en/docs/inspector - * ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 - * - * $ node --inspect=localhost:3000 -p 'inspector.url()' - * Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a - * For help, see: https://nodejs.org/en/docs/inspector - * ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a - * - * $ node -p 'inspector.url()' - * undefined - * ``` - */ - function url(): string | undefined; - /** - * Blocks until a client (existing or connected later) has sent `Runtime.runIfWaitingForDebugger` command. - * - * An exception will be thrown if there is no active inspector. - * @since v12.7.0 - */ - function waitForDebugger(): void; - // These methods are exposed by the V8 inspector console API (inspector/v8-console.h). - // The method signatures differ from those of the Node.js console, and are deliberately - // typed permissively. - interface InspectorConsole { - debug(...data: any[]): void; - error(...data: any[]): void; - info(...data: any[]): void; - log(...data: any[]): void; - warn(...data: any[]): void; - dir(...data: any[]): void; - dirxml(...data: any[]): void; - table(...data: any[]): void; - trace(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(...data: any[]): void; - clear(...data: any[]): void; - count(label?: any): void; - countReset(label?: any): void; - assert(value?: any, ...data: any[]): void; - profile(label?: any): void; - profileEnd(label?: any): void; - time(label?: any): void; - timeLog(label?: any): void; - timeStamp(label?: any): void; - } - /** - * An object to send messages to the remote inspector console. - * @since v11.0.0 - */ - const console: InspectorConsole; - // DevTools protocol event broadcast methods - namespace Network { - /** - * This feature is only available with the `--experimental-network-inspection` flag enabled. - * - * Broadcasts the `Network.requestWillBeSent` event to connected frontends. This event indicates that - * the application is about to send an HTTP request. - * @since v22.6.0 - */ - function requestWillBeSent(params: RequestWillBeSentEventDataType): void; - /** - * This feature is only available with the `--experimental-network-inspection` flag enabled. - * - * Broadcasts the `Network.dataReceived` event to connected frontends, or buffers the data if - * `Network.streamResourceContent` command was not invoked for the given request yet. - * - * Also enables `Network.getResponseBody` command to retrieve the response data. - * @since v22.17.0 - */ - function dataReceived(params: DataReceivedEventDataType): void; - /** - * This feature is only available with the `--experimental-network-inspection` flag enabled. - * - * Enables `Network.getRequestPostData` command to retrieve the request data. - * @since v22.18.0 - */ - function dataSent(params: unknown): void; - /** - * This feature is only available with the `--experimental-network-inspection` flag enabled. - * - * Broadcasts the `Network.responseReceived` event to connected frontends. This event indicates that - * HTTP response is available. - * @since v22.6.0 - */ - function responseReceived(params: ResponseReceivedEventDataType): void; - /** - * This feature is only available with the `--experimental-network-inspection` flag enabled. - * - * Broadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that - * HTTP request has finished loading. - * @since v22.6.0 - */ - function loadingFinished(params: LoadingFinishedEventDataType): void; - /** - * This feature is only available with the `--experimental-network-inspection` flag enabled. - * - * Broadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that - * HTTP request has failed to load. - * @since v22.7.0 - */ - function loadingFailed(params: LoadingFailedEventDataType): void; - } - namespace NetworkResources { - /** - * This feature is only available with the `--experimental-inspector-network-resource` flag enabled. - * - * The inspector.NetworkResources.put method is used to provide a response for a loadNetworkResource - * request issued via the Chrome DevTools Protocol (CDP). - * This is typically triggered when a source map is specified by URL, and a DevTools frontend—such as - * Chrome—requests the resource to retrieve the source map. - * - * This method allows developers to predefine the resource content to be served in response to such CDP requests. - * - * ```js - * const inspector = require('node:inspector'); - * // By preemptively calling put to register the resource, a source map can be resolved when - * // a loadNetworkResource request is made from the frontend. - * async function setNetworkResources() { - * const mapUrl = 'http://localhost:3000/dist/app.js.map'; - * const tsUrl = 'http://localhost:3000/src/app.ts'; - * const distAppJsMap = await fetch(mapUrl).then((res) => res.text()); - * const srcAppTs = await fetch(tsUrl).then((res) => res.text()); - * inspector.NetworkResources.put(mapUrl, distAppJsMap); - * inspector.NetworkResources.put(tsUrl, srcAppTs); - * }; - * setNetworkResources().then(() => { - * require('./dist/app'); - * }); - * ``` - * - * For more details, see the official CDP documentation: [Network.loadNetworkResource](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource) - * @since v22.19.0 - * @experimental - */ - function put(url: string, data: string): void; - } -} - -/** - * The `node:inspector` module provides an API for interacting with the V8 - * inspector. - */ -declare module "node:inspector" { - export * from "inspector"; -} - -/** - * The `node:inspector/promises` module provides an API for interacting with the V8 - * inspector. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/inspector/promises.js) - * @since v19.0.0 - */ -declare module "inspector/promises" { - import EventEmitter = require("node:events"); - export { close, console, NetworkResources, open, url, waitForDebugger } from "inspector"; - /** - * The `inspector.Session` is used for dispatching messages to the V8 inspector - * back-end and receiving message responses and notifications. - * @since v19.0.0 - */ - export class Session extends EventEmitter { - /** - * Create a new instance of the inspector.Session class. - * The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend. - */ - constructor(); - /** - * Connects a session to the inspector back-end. - */ - connect(): void; - /** - * Connects a session to the inspector back-end. - * An exception will be thrown if this API was not called on a Worker thread. - * @since v12.11.0 - */ - connectToMainThread(): void; - /** - * Immediately close the session. All pending message callbacks will be called with an error. - * `session.connect()` will need to be called to be able to send messages again. - * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints. - */ - disconnect(): void; - } -} - -/** - * The `node:inspector/promises` module provides an API for interacting with the V8 - * inspector. - * @since v19.0.0 - */ -declare module "node:inspector/promises" { - export * from "inspector/promises"; -} diff --git a/node_modules/@types/node/inspector.generated.d.ts b/node_modules/@types/node/inspector.generated.d.ts deleted file mode 100644 index bcf0b3b..0000000 --- a/node_modules/@types/node/inspector.generated.d.ts +++ /dev/null @@ -1,4052 +0,0 @@ -// These definitions are automatically generated by the generate-inspector script. -// Do not edit this file directly. -// See scripts/generate-inspector/README.md for information on how to update the protocol definitions. -// Changes to the module itself should be added to the generator template (scripts/generate-inspector/inspector.d.ts.template). - -declare module "inspector" { - interface InspectorNotification { - method: string; - params: T; - } - - namespace Schema { - /** - * Description of the protocol domain. - */ - interface Domain { - /** - * Domain name. - */ - name: string; - /** - * Domain version. - */ - version: string; - } - interface GetDomainsReturnType { - /** - * List of supported domains. - */ - domains: Domain[]; - } - } - namespace Runtime { - /** - * Unique script identifier. - */ - type ScriptId = string; - /** - * Unique object identifier. - */ - type RemoteObjectId = string; - /** - * Primitive value which cannot be JSON-stringified. - */ - type UnserializableValue = string; - /** - * Mirror object referencing original JavaScript object. - */ - interface RemoteObject { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string | undefined; - /** - * Object class (constructor) name. Specified for object type values only. - */ - className?: string | undefined; - /** - * Remote object value in case of primitive values or JSON values (if it was requested). - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified does not have value, but gets this property. - */ - unserializableValue?: UnserializableValue | undefined; - /** - * String representation of the object. - */ - description?: string | undefined; - /** - * Unique object identifier (for non-primitive values). - */ - objectId?: RemoteObjectId | undefined; - /** - * Preview containing abbreviated property values. Specified for object type values only. - * @experimental - */ - preview?: ObjectPreview | undefined; - /** - * @experimental - */ - customPreview?: CustomPreview | undefined; - } - /** - * @experimental - */ - interface CustomPreview { - header: string; - hasBody: boolean; - formatterObjectId: RemoteObjectId; - bindRemoteObjectFunctionId: RemoteObjectId; - configObjectId?: RemoteObjectId | undefined; - } - /** - * Object containing abbreviated remote object value. - * @experimental - */ - interface ObjectPreview { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string | undefined; - /** - * String representation of the object. - */ - description?: string | undefined; - /** - * True iff some of the properties or entries of the original object did not fit. - */ - overflow: boolean; - /** - * List of the properties. - */ - properties: PropertyPreview[]; - /** - * List of the entries. Specified for map and set subtype values only. - */ - entries?: EntryPreview[] | undefined; - } - /** - * @experimental - */ - interface PropertyPreview { - /** - * Property name. - */ - name: string; - /** - * Object type. Accessor means that the property itself is an accessor property. - */ - type: string; - /** - * User-friendly property value string. - */ - value?: string | undefined; - /** - * Nested value preview. - */ - valuePreview?: ObjectPreview | undefined; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string | undefined; - } - /** - * @experimental - */ - interface EntryPreview { - /** - * Preview of the key. Specified for map-like collection entries. - */ - key?: ObjectPreview | undefined; - /** - * Preview of the value. - */ - value: ObjectPreview; - } - /** - * Object property descriptor. - */ - interface PropertyDescriptor { - /** - * Property name or symbol description. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject | undefined; - /** - * True if the value associated with the property may be changed (data descriptors only). - */ - writable?: boolean | undefined; - /** - * A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). - */ - get?: RemoteObject | undefined; - /** - * A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). - */ - set?: RemoteObject | undefined; - /** - * True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. - */ - configurable: boolean; - /** - * True if this property shows up during enumeration of the properties on the corresponding object. - */ - enumerable: boolean; - /** - * True if the result was thrown during the evaluation. - */ - wasThrown?: boolean | undefined; - /** - * True if the property is owned for the object. - */ - isOwn?: boolean | undefined; - /** - * Property symbol object, if the property is of the symbol type. - */ - symbol?: RemoteObject | undefined; - } - /** - * Object internal property descriptor. This property isn't normally visible in JavaScript code. - */ - interface InternalPropertyDescriptor { - /** - * Conventional property name. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject | undefined; - } - /** - * Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified. - */ - interface CallArgument { - /** - * Primitive value or serializable javascript object. - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified. - */ - unserializableValue?: UnserializableValue | undefined; - /** - * Remote object handle. - */ - objectId?: RemoteObjectId | undefined; - } - /** - * Id of an execution context. - */ - type ExecutionContextId = number; - /** - * Description of an isolated world. - */ - interface ExecutionContextDescription { - /** - * Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. - */ - id: ExecutionContextId; - /** - * Execution context origin. - */ - origin: string; - /** - * Human readable name describing given context. - */ - name: string; - /** - * Embedder-specific auxiliary data. - */ - auxData?: object | undefined; - } - /** - * Detailed information about exception (or error) that was thrown during script compilation or execution. - */ - interface ExceptionDetails { - /** - * Exception id. - */ - exceptionId: number; - /** - * Exception text, which should be used together with exception object when available. - */ - text: string; - /** - * Line number of the exception location (0-based). - */ - lineNumber: number; - /** - * Column number of the exception location (0-based). - */ - columnNumber: number; - /** - * Script ID of the exception location. - */ - scriptId?: ScriptId | undefined; - /** - * URL of the exception location, to be used when the script was not reported. - */ - url?: string | undefined; - /** - * JavaScript stack trace if available. - */ - stackTrace?: StackTrace | undefined; - /** - * Exception object if available. - */ - exception?: RemoteObject | undefined; - /** - * Identifier of the context where exception happened. - */ - executionContextId?: ExecutionContextId | undefined; - } - /** - * Number of milliseconds since epoch. - */ - type Timestamp = number; - /** - * Stack entry for runtime errors and assertions. - */ - interface CallFrame { - /** - * JavaScript function name. - */ - functionName: string; - /** - * JavaScript script id. - */ - scriptId: ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * JavaScript script line number (0-based). - */ - lineNumber: number; - /** - * JavaScript script column number (0-based). - */ - columnNumber: number; - } - /** - * Call frames for assertions or error messages. - */ - interface StackTrace { - /** - * String label of this stack trace. For async traces this may be a name of the function that initiated the async call. - */ - description?: string | undefined; - /** - * JavaScript function name. - */ - callFrames: CallFrame[]; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - */ - parent?: StackTrace | undefined; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - * @experimental - */ - parentId?: StackTraceId | undefined; - } - /** - * Unique identifier of current debugger. - * @experimental - */ - type UniqueDebuggerId = string; - /** - * If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages. - * @experimental - */ - interface StackTraceId { - id: string; - debuggerId?: UniqueDebuggerId | undefined; - } - interface EvaluateParameterType { - /** - * Expression to evaluate. - */ - expression: string; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string | undefined; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - contextId?: ExecutionContextId | undefined; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean | undefined; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean | undefined; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean | undefined; - } - interface AwaitPromiseParameterType { - /** - * Identifier of the promise. - */ - promiseObjectId: RemoteObjectId; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean | undefined; - } - interface CallFunctionOnParameterType { - /** - * Declaration of the function to call. - */ - functionDeclaration: string; - /** - * Identifier of the object to call function on. Either objectId or executionContextId should be specified. - */ - objectId?: RemoteObjectId | undefined; - /** - * Call arguments. All call arguments must belong to the same JavaScript world as the target object. - */ - arguments?: CallArgument[] | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean | undefined; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean | undefined; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean | undefined; - /** - * Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. - */ - executionContextId?: ExecutionContextId | undefined; - /** - * Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. - */ - objectGroup?: string | undefined; - } - interface GetPropertiesParameterType { - /** - * Identifier of the object to return properties for. - */ - objectId: RemoteObjectId; - /** - * If true, returns properties belonging only to the element itself, not to its prototype chain. - */ - ownProperties?: boolean | undefined; - /** - * If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. - * @experimental - */ - accessorPropertiesOnly?: boolean | undefined; - /** - * Whether preview should be generated for the results. - * @experimental - */ - generatePreview?: boolean | undefined; - } - interface ReleaseObjectParameterType { - /** - * Identifier of the object to release. - */ - objectId: RemoteObjectId; - } - interface ReleaseObjectGroupParameterType { - /** - * Symbolic object group name. - */ - objectGroup: string; - } - interface SetCustomObjectFormatterEnabledParameterType { - enabled: boolean; - } - interface CompileScriptParameterType { - /** - * Expression to compile. - */ - expression: string; - /** - * Source url to be set for the script. - */ - sourceURL: string; - /** - * Specifies whether the compiled script should be persisted. - */ - persistScript: boolean; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId | undefined; - } - interface RunScriptParameterType { - /** - * Id of the script to run. - */ - scriptId: ScriptId; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId | undefined; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean | undefined; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean | undefined; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean | undefined; - } - interface QueryObjectsParameterType { - /** - * Identifier of the prototype to return objects for. - */ - prototypeObjectId: RemoteObjectId; - } - interface GlobalLexicalScopeNamesParameterType { - /** - * Specifies in which execution context to lookup global scope variables. - */ - executionContextId?: ExecutionContextId | undefined; - } - interface EvaluateReturnType { - /** - * Evaluation result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface AwaitPromiseReturnType { - /** - * Promise result. Will contain rejected value if promise was rejected. - */ - result: RemoteObject; - /** - * Exception details if stack strace is available. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface CallFunctionOnReturnType { - /** - * Call result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface GetPropertiesReturnType { - /** - * Object properties. - */ - result: PropertyDescriptor[]; - /** - * Internal object properties (only of the element itself). - */ - internalProperties?: InternalPropertyDescriptor[] | undefined; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface CompileScriptReturnType { - /** - * Id of the script. - */ - scriptId?: ScriptId | undefined; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface RunScriptReturnType { - /** - * Run result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface QueryObjectsReturnType { - /** - * Array with objects. - */ - objects: RemoteObject; - } - interface GlobalLexicalScopeNamesReturnType { - names: string[]; - } - interface ExecutionContextCreatedEventDataType { - /** - * A newly created execution context. - */ - context: ExecutionContextDescription; - } - interface ExecutionContextDestroyedEventDataType { - /** - * Id of the destroyed context - */ - executionContextId: ExecutionContextId; - } - interface ExceptionThrownEventDataType { - /** - * Timestamp of the exception. - */ - timestamp: Timestamp; - exceptionDetails: ExceptionDetails; - } - interface ExceptionRevokedEventDataType { - /** - * Reason describing why exception was revoked. - */ - reason: string; - /** - * The id of revoked exception, as reported in exceptionThrown. - */ - exceptionId: number; - } - interface ConsoleAPICalledEventDataType { - /** - * Type of the call. - */ - type: string; - /** - * Call arguments. - */ - args: RemoteObject[]; - /** - * Identifier of the context where the call was made. - */ - executionContextId: ExecutionContextId; - /** - * Call timestamp. - */ - timestamp: Timestamp; - /** - * Stack trace captured when the call was made. - */ - stackTrace?: StackTrace | undefined; - /** - * Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. - * @experimental - */ - context?: string | undefined; - } - interface InspectRequestedEventDataType { - object: RemoteObject; - hints: object; - } - } - namespace Debugger { - /** - * Breakpoint identifier. - */ - type BreakpointId = string; - /** - * Call frame identifier. - */ - type CallFrameId = string; - /** - * Location in the source code. - */ - interface Location { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number | undefined; - } - /** - * Location in the source code. - * @experimental - */ - interface ScriptPosition { - lineNumber: number; - columnNumber: number; - } - /** - * JavaScript call frame. Array of call frames form the call stack. - */ - interface CallFrame { - /** - * Call frame identifier. This identifier is only valid while the virtual machine is paused. - */ - callFrameId: CallFrameId; - /** - * Name of the JavaScript function called on this call frame. - */ - functionName: string; - /** - * Location in the source code. - */ - functionLocation?: Location | undefined; - /** - * Location in the source code. - */ - location: Location; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Scope chain for this call frame. - */ - scopeChain: Scope[]; - /** - * this object for this call frame. - */ - this: Runtime.RemoteObject; - /** - * The value being returned, if the function is at return point. - */ - returnValue?: Runtime.RemoteObject | undefined; - } - /** - * Scope description. - */ - interface Scope { - /** - * Scope type. - */ - type: string; - /** - * Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. - */ - object: Runtime.RemoteObject; - name?: string | undefined; - /** - * Location in the source code where scope starts - */ - startLocation?: Location | undefined; - /** - * Location in the source code where scope ends - */ - endLocation?: Location | undefined; - } - /** - * Search match for resource. - */ - interface SearchMatch { - /** - * Line number in resource content. - */ - lineNumber: number; - /** - * Line with match content. - */ - lineContent: string; - } - interface BreakLocation { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number | undefined; - type?: string | undefined; - } - interface SetBreakpointsActiveParameterType { - /** - * New value for breakpoints active state. - */ - active: boolean; - } - interface SetSkipAllPausesParameterType { - /** - * New value for skip pauses state. - */ - skip: boolean; - } - interface SetBreakpointByUrlParameterType { - /** - * Line number to set breakpoint at. - */ - lineNumber: number; - /** - * URL of the resources to set breakpoint on. - */ - url?: string | undefined; - /** - * Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified. - */ - urlRegex?: string | undefined; - /** - * Script hash of the resources to set breakpoint on. - */ - scriptHash?: string | undefined; - /** - * Offset in the line to set breakpoint at. - */ - columnNumber?: number | undefined; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string | undefined; - } - interface SetBreakpointParameterType { - /** - * Location to set breakpoint in. - */ - location: Location; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string | undefined; - } - interface RemoveBreakpointParameterType { - breakpointId: BreakpointId; - } - interface GetPossibleBreakpointsParameterType { - /** - * Start of range to search possible breakpoint locations in. - */ - start: Location; - /** - * End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. - */ - end?: Location | undefined; - /** - * Only consider locations which are in the same (non-nested) function as start. - */ - restrictToFunction?: boolean | undefined; - } - interface ContinueToLocationParameterType { - /** - * Location to continue to. - */ - location: Location; - targetCallFrames?: string | undefined; - } - interface PauseOnAsyncCallParameterType { - /** - * Debugger will pause when async call with given stack trace is started. - */ - parentStackTraceId: Runtime.StackTraceId; - } - interface StepIntoParameterType { - /** - * Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause. - * @experimental - */ - breakOnAsyncCall?: boolean | undefined; - } - interface GetStackTraceParameterType { - stackTraceId: Runtime.StackTraceId; - } - interface SearchInContentParameterType { - /** - * Id of the script to search in. - */ - scriptId: Runtime.ScriptId; - /** - * String to search for. - */ - query: string; - /** - * If true, search is case sensitive. - */ - caseSensitive?: boolean | undefined; - /** - * If true, treats string parameter as regex. - */ - isRegex?: boolean | undefined; - } - interface SetScriptSourceParameterType { - /** - * Id of the script to edit. - */ - scriptId: Runtime.ScriptId; - /** - * New content of the script. - */ - scriptSource: string; - /** - * If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. - */ - dryRun?: boolean | undefined; - } - interface RestartFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - } - interface GetScriptSourceParameterType { - /** - * Id of the script to get source for. - */ - scriptId: Runtime.ScriptId; - } - interface SetPauseOnExceptionsParameterType { - /** - * Pause on exceptions mode. - */ - state: string; - } - interface EvaluateOnCallFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - /** - * Expression to evaluate. - */ - expression: string; - /** - * String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup). - */ - objectGroup?: string | undefined; - /** - * Specifies whether command line API should be available to the evaluated expression, defaults to false. - */ - includeCommandLineAPI?: boolean | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean | undefined; - /** - * Whether to throw an exception if side effect cannot be ruled out during evaluation. - */ - throwOnSideEffect?: boolean | undefined; - } - interface SetVariableValueParameterType { - /** - * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually. - */ - scopeNumber: number; - /** - * Variable name. - */ - variableName: string; - /** - * New variable value. - */ - newValue: Runtime.CallArgument; - /** - * Id of callframe that holds variable. - */ - callFrameId: CallFrameId; - } - interface SetReturnValueParameterType { - /** - * New return value. - */ - newValue: Runtime.CallArgument; - } - interface SetAsyncCallStackDepthParameterType { - /** - * Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default). - */ - maxDepth: number; - } - interface SetBlackboxPatternsParameterType { - /** - * Array of regexps that will be used to check script url for blackbox state. - */ - patterns: string[]; - } - interface SetBlackboxedRangesParameterType { - /** - * Id of the script. - */ - scriptId: Runtime.ScriptId; - positions: ScriptPosition[]; - } - interface EnableReturnType { - /** - * Unique identifier of the debugger. - * @experimental - */ - debuggerId: Runtime.UniqueDebuggerId; - } - interface SetBreakpointByUrlReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * List of the locations this breakpoint resolved into upon addition. - */ - locations: Location[]; - } - interface SetBreakpointReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * Location this breakpoint resolved into. - */ - actualLocation: Location; - } - interface GetPossibleBreakpointsReturnType { - /** - * List of the possible breakpoint locations. - */ - locations: BreakLocation[]; - } - interface GetStackTraceReturnType { - stackTrace: Runtime.StackTrace; - } - interface SearchInContentReturnType { - /** - * List of search matches. - */ - result: SearchMatch[]; - } - interface SetScriptSourceReturnType { - /** - * New stack trace in case editing has happened while VM was stopped. - */ - callFrames?: CallFrame[] | undefined; - /** - * Whether current call stack was modified after applying the changes. - */ - stackChanged?: boolean | undefined; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace | undefined; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId | undefined; - /** - * Exception details if any. - */ - exceptionDetails?: Runtime.ExceptionDetails | undefined; - } - interface RestartFrameReturnType { - /** - * New stack trace. - */ - callFrames: CallFrame[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace | undefined; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId | undefined; - } - interface GetScriptSourceReturnType { - /** - * Script source. - */ - scriptSource: string; - } - interface EvaluateOnCallFrameReturnType { - /** - * Object wrapper for the evaluation result. - */ - result: Runtime.RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: Runtime.ExceptionDetails | undefined; - } - interface ScriptParsedEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: object | undefined; - /** - * True, if this script is generated as a result of the live edit operation. - * @experimental - */ - isLiveEdit?: boolean | undefined; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string | undefined; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean | undefined; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean | undefined; - /** - * This script length. - */ - length?: number | undefined; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace | undefined; - } - interface ScriptFailedToParseEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: object | undefined; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string | undefined; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean | undefined; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean | undefined; - /** - * This script length. - */ - length?: number | undefined; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace | undefined; - } - interface BreakpointResolvedEventDataType { - /** - * Breakpoint unique identifier. - */ - breakpointId: BreakpointId; - /** - * Actual breakpoint location. - */ - location: Location; - } - interface PausedEventDataType { - /** - * Call stack the virtual machine stopped on. - */ - callFrames: CallFrame[]; - /** - * Pause reason. - */ - reason: string; - /** - * Object containing break-specific auxiliary properties. - */ - data?: object | undefined; - /** - * Hit breakpoints IDs - */ - hitBreakpoints?: string[] | undefined; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace | undefined; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId | undefined; - /** - * Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag. - * @experimental - */ - asyncCallStackTraceId?: Runtime.StackTraceId | undefined; - } - } - namespace Console { - /** - * Console message. - */ - interface ConsoleMessage { - /** - * Message source. - */ - source: string; - /** - * Message severity. - */ - level: string; - /** - * Message text. - */ - text: string; - /** - * URL of the message origin. - */ - url?: string | undefined; - /** - * Line number in the resource that generated this message (1-based). - */ - line?: number | undefined; - /** - * Column number in the resource that generated this message (1-based). - */ - column?: number | undefined; - } - interface MessageAddedEventDataType { - /** - * Console message that has been added. - */ - message: ConsoleMessage; - } - } - namespace Profiler { - /** - * Profile node. Holds callsite information, execution statistics and child nodes. - */ - interface ProfileNode { - /** - * Unique id of the node. - */ - id: number; - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Number of samples where this node was on top of the call stack. - */ - hitCount?: number | undefined; - /** - * Child node ids. - */ - children?: number[] | undefined; - /** - * The reason of being not optimized. The function may be deoptimized or marked as don't optimize. - */ - deoptReason?: string | undefined; - /** - * An array of source position ticks. - */ - positionTicks?: PositionTickInfo[] | undefined; - } - /** - * Profile. - */ - interface Profile { - /** - * The list of profile nodes. First item is the root node. - */ - nodes: ProfileNode[]; - /** - * Profiling start timestamp in microseconds. - */ - startTime: number; - /** - * Profiling end timestamp in microseconds. - */ - endTime: number; - /** - * Ids of samples top nodes. - */ - samples?: number[] | undefined; - /** - * Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. - */ - timeDeltas?: number[] | undefined; - } - /** - * Specifies a number of samples attributed to a certain source position. - */ - interface PositionTickInfo { - /** - * Source line number (1-based). - */ - line: number; - /** - * Number of samples attributed to the source line. - */ - ticks: number; - } - /** - * Coverage data for a source range. - */ - interface CoverageRange { - /** - * JavaScript script source offset for the range start. - */ - startOffset: number; - /** - * JavaScript script source offset for the range end. - */ - endOffset: number; - /** - * Collected execution count of the source range. - */ - count: number; - } - /** - * Coverage data for a JavaScript function. - */ - interface FunctionCoverage { - /** - * JavaScript function name. - */ - functionName: string; - /** - * Source ranges inside the function with coverage data. - */ - ranges: CoverageRange[]; - /** - * Whether coverage data for this function has block granularity. - */ - isBlockCoverage: boolean; - } - /** - * Coverage data for a JavaScript script. - */ - interface ScriptCoverage { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Functions contained in the script that has coverage data. - */ - functions: FunctionCoverage[]; - } - interface SetSamplingIntervalParameterType { - /** - * New sampling interval in microseconds. - */ - interval: number; - } - interface StartPreciseCoverageParameterType { - /** - * Collect accurate call counts beyond simple 'covered' or 'not covered'. - */ - callCount?: boolean | undefined; - /** - * Collect block-based coverage. - */ - detailed?: boolean | undefined; - } - interface StopReturnType { - /** - * Recorded profile. - */ - profile: Profile; - } - interface TakePreciseCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - interface GetBestEffortCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - interface ConsoleProfileStartedEventDataType { - id: string; - /** - * Location of console.profile(). - */ - location: Debugger.Location; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string | undefined; - } - interface ConsoleProfileFinishedEventDataType { - id: string; - /** - * Location of console.profileEnd(). - */ - location: Debugger.Location; - profile: Profile; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string | undefined; - } - } - namespace HeapProfiler { - /** - * Heap snapshot object id. - */ - type HeapSnapshotObjectId = string; - /** - * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. - */ - interface SamplingHeapProfileNode { - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Allocations size in bytes for the node excluding children. - */ - selfSize: number; - /** - * Child nodes. - */ - children: SamplingHeapProfileNode[]; - } - /** - * Profile. - */ - interface SamplingHeapProfile { - head: SamplingHeapProfileNode; - } - interface StartTrackingHeapObjectsParameterType { - trackAllocations?: boolean | undefined; - } - interface StopTrackingHeapObjectsParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. - */ - reportProgress?: boolean | undefined; - } - interface TakeHeapSnapshotParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. - */ - reportProgress?: boolean | undefined; - } - interface GetObjectByHeapObjectIdParameterType { - objectId: HeapSnapshotObjectId; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string | undefined; - } - interface AddInspectedHeapObjectParameterType { - /** - * Heap snapshot object id to be accessible by means of $x command line API. - */ - heapObjectId: HeapSnapshotObjectId; - } - interface GetHeapObjectIdParameterType { - /** - * Identifier of the object to get heap object id for. - */ - objectId: Runtime.RemoteObjectId; - } - interface StartSamplingParameterType { - /** - * Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. - */ - samplingInterval?: number | undefined; - } - interface GetObjectByHeapObjectIdReturnType { - /** - * Evaluation result. - */ - result: Runtime.RemoteObject; - } - interface GetHeapObjectIdReturnType { - /** - * Id of the heap snapshot object corresponding to the passed remote object id. - */ - heapSnapshotObjectId: HeapSnapshotObjectId; - } - interface StopSamplingReturnType { - /** - * Recorded sampling heap profile. - */ - profile: SamplingHeapProfile; - } - interface GetSamplingProfileReturnType { - /** - * Return the sampling profile being collected. - */ - profile: SamplingHeapProfile; - } - interface AddHeapSnapshotChunkEventDataType { - chunk: string; - } - interface ReportHeapSnapshotProgressEventDataType { - done: number; - total: number; - finished?: boolean | undefined; - } - interface LastSeenObjectIdEventDataType { - lastSeenObjectId: number; - timestamp: number; - } - interface HeapStatsUpdateEventDataType { - /** - * An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. - */ - statsUpdate: number[]; - } - } - namespace NodeTracing { - interface TraceConfig { - /** - * Controls how the trace buffer stores data. - */ - recordMode?: string | undefined; - /** - * Included category filters. - */ - includedCategories: string[]; - } - interface StartParameterType { - traceConfig: TraceConfig; - } - interface GetCategoriesReturnType { - /** - * A list of supported tracing categories. - */ - categories: string[]; - } - interface DataCollectedEventDataType { - value: object[]; - } - } - namespace NodeWorker { - type WorkerID = string; - /** - * Unique identifier of attached debugging session. - */ - type SessionID = string; - interface WorkerInfo { - workerId: WorkerID; - type: string; - title: string; - url: string; - } - interface SendMessageToWorkerParameterType { - message: string; - /** - * Identifier of the session. - */ - sessionId: SessionID; - } - interface EnableParameterType { - /** - * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` - * message to run them. - */ - waitForDebuggerOnStart: boolean; - } - interface DetachParameterType { - sessionId: SessionID; - } - interface AttachedToWorkerEventDataType { - /** - * Identifier assigned to the session used to send/receive messages. - */ - sessionId: SessionID; - workerInfo: WorkerInfo; - waitingForDebugger: boolean; - } - interface DetachedFromWorkerEventDataType { - /** - * Detached session identifier. - */ - sessionId: SessionID; - } - interface ReceivedMessageFromWorkerEventDataType { - /** - * Identifier of a session which sends a message. - */ - sessionId: SessionID; - message: string; - } - } - namespace Network { - /** - * Resource type as it was perceived by the rendering engine. - */ - type ResourceType = string; - /** - * Unique request identifier. - */ - type RequestId = string; - /** - * UTC time in seconds, counted from January 1, 1970. - */ - type TimeSinceEpoch = number; - /** - * Monotonically increasing time in seconds since an arbitrary point in the past. - */ - type MonotonicTime = number; - /** - * Information about the request initiator. - */ - interface Initiator { - /** - * Type of this initiator. - */ - type: string; - /** - * Initiator JavaScript stack trace, set for Script only. - * Requires the Debugger domain to be enabled. - */ - stack?: Runtime.StackTrace | undefined; - /** - * Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. - */ - url?: string | undefined; - /** - * Initiator line number, set for Parser type or for Script type (when script is importing - * module) (0-based). - */ - lineNumber?: number | undefined; - /** - * Initiator column number, set for Parser type or for Script type (when script is importing - * module) (0-based). - */ - columnNumber?: number | undefined; - /** - * Set if another request triggered this request (e.g. preflight). - */ - requestId?: RequestId | undefined; - } - /** - * HTTP request data. - */ - interface Request { - url: string; - method: string; - headers: Headers; - hasPostData: boolean; - } - /** - * HTTP response data. - */ - interface Response { - url: string; - status: number; - statusText: string; - headers: Headers; - mimeType: string; - charset: string; - } - /** - * Request / response headers as keys / values of JSON object. - */ - interface Headers { - } - interface LoadNetworkResourcePageResult { - success: boolean; - stream?: IO.StreamHandle | undefined; - } - interface GetRequestPostDataParameterType { - /** - * Identifier of the network request to get content for. - */ - requestId: RequestId; - } - interface GetResponseBodyParameterType { - /** - * Identifier of the network request to get content for. - */ - requestId: RequestId; - } - interface StreamResourceContentParameterType { - /** - * Identifier of the request to stream. - */ - requestId: RequestId; - } - interface LoadNetworkResourceParameterType { - /** - * URL of the resource to get content for. - */ - url: string; - } - interface GetRequestPostDataReturnType { - /** - * Request body string, omitting files from multipart requests - */ - postData: string; - } - interface GetResponseBodyReturnType { - /** - * Response body. - */ - body: string; - /** - * True, if content was sent as base64. - */ - base64Encoded: boolean; - } - interface StreamResourceContentReturnType { - /** - * Data that has been buffered until streaming is enabled. - */ - bufferedData: string; - } - interface LoadNetworkResourceReturnType { - resource: LoadNetworkResourcePageResult; - } - interface RequestWillBeSentEventDataType { - /** - * Request identifier. - */ - requestId: RequestId; - /** - * Request data. - */ - request: Request; - /** - * Request initiator. - */ - initiator: Initiator; - /** - * Timestamp. - */ - timestamp: MonotonicTime; - /** - * Timestamp. - */ - wallTime: TimeSinceEpoch; - } - interface ResponseReceivedEventDataType { - /** - * Request identifier. - */ - requestId: RequestId; - /** - * Timestamp. - */ - timestamp: MonotonicTime; - /** - * Resource type. - */ - type: ResourceType; - /** - * Response data. - */ - response: Response; - } - interface LoadingFailedEventDataType { - /** - * Request identifier. - */ - requestId: RequestId; - /** - * Timestamp. - */ - timestamp: MonotonicTime; - /** - * Resource type. - */ - type: ResourceType; - /** - * Error message. - */ - errorText: string; - } - interface LoadingFinishedEventDataType { - /** - * Request identifier. - */ - requestId: RequestId; - /** - * Timestamp. - */ - timestamp: MonotonicTime; - } - interface DataReceivedEventDataType { - /** - * Request identifier. - */ - requestId: RequestId; - /** - * Timestamp. - */ - timestamp: MonotonicTime; - /** - * Data chunk length. - */ - dataLength: number; - /** - * Actual bytes received (might be less than dataLength for compressed encodings). - */ - encodedDataLength: number; - /** - * Data that was received. - * @experimental - */ - data?: string | undefined; - } - } - namespace NodeRuntime { - interface NotifyWhenWaitingForDisconnectParameterType { - enabled: boolean; - } - } - namespace Target { - type SessionID = string; - type TargetID = string; - interface TargetInfo { - targetId: TargetID; - type: string; - title: string; - url: string; - attached: boolean; - canAccessOpener: boolean; - } - interface SetAutoAttachParameterType { - autoAttach: boolean; - waitForDebuggerOnStart: boolean; - } - interface TargetCreatedEventDataType { - targetInfo: TargetInfo; - } - interface AttachedToTargetEventDataType { - sessionId: SessionID; - targetInfo: TargetInfo; - waitingForDebugger: boolean; - } - } - namespace IO { - type StreamHandle = string; - interface ReadParameterType { - /** - * Handle of the stream to read. - */ - handle: StreamHandle; - /** - * Seek to the specified offset before reading (if not specified, proceed with offset - * following the last read). Some types of streams may only support sequential reads. - */ - offset?: number | undefined; - /** - * Maximum number of bytes to read (left upon the agent discretion if not specified). - */ - size?: number | undefined; - } - interface CloseParameterType { - /** - * Handle of the stream to close. - */ - handle: StreamHandle; - } - interface ReadReturnType { - /** - * Data that were read. - */ - data: string; - /** - * Set if the end-of-file condition occurred while reading. - */ - eof: boolean; - } - } - - interface Session { - /** - * Posts a message to the inspector back-end. `callback` will be notified when - * a response is received. `callback` is a function that accepts two optional - * arguments: error and message-specific result. - * - * ```js - * session.post('Runtime.evaluate', { expression: '2 + 2' }, - * (error, { result }) => console.log(result)); - * // Output: { type: 'number', value: 4, description: '4' } - * ``` - * - * The latest version of the V8 inspector protocol is published on the - * [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/). - * - * Node.js inspector supports all the Chrome DevTools Protocol domains declared - * by V8. Chrome DevTools Protocol domain provides an interface for interacting - * with one of the runtime agents used to inspect the application state and listen - * to the run-time events. - */ - post(method: string, callback?: (err: Error | null, params?: object) => void): void; - post(method: string, params?: object, callback?: (err: Error | null, params?: object) => void): void; - /** - * Returns supported domains. - */ - post(method: "Schema.getDomains", callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; - /** - * Evaluates expression on global object. - */ - post(method: "Runtime.evaluate", params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - post(method: "Runtime.evaluate", callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - /** - * Add handler to promise with given promise object id. - */ - post(method: "Runtime.awaitPromise", params?: Runtime.AwaitPromiseParameterType, callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - post(method: "Runtime.awaitPromise", callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - /** - * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. - */ - post(method: "Runtime.callFunctionOn", params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - post(method: "Runtime.callFunctionOn", callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - /** - * Returns properties of a given object. Object group of the result is inherited from the target object. - */ - post(method: "Runtime.getProperties", params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - post(method: "Runtime.getProperties", callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - /** - * Releases remote object with given id. - */ - post(method: "Runtime.releaseObject", params?: Runtime.ReleaseObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.releaseObject", callback?: (err: Error | null) => void): void; - /** - * Releases all remote objects that belong to a given group. - */ - post(method: "Runtime.releaseObjectGroup", params?: Runtime.ReleaseObjectGroupParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.releaseObjectGroup", callback?: (err: Error | null) => void): void; - /** - * Tells inspected instance to run if it was waiting for debugger to attach. - */ - post(method: "Runtime.runIfWaitingForDebugger", callback?: (err: Error | null) => void): void; - /** - * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. - */ - post(method: "Runtime.enable", callback?: (err: Error | null) => void): void; - /** - * Disables reporting of execution contexts creation. - */ - post(method: "Runtime.disable", callback?: (err: Error | null) => void): void; - /** - * Discards collected exceptions and console API calls. - */ - post(method: "Runtime.discardConsoleEntries", callback?: (err: Error | null) => void): void; - /** - * @experimental - */ - post(method: "Runtime.setCustomObjectFormatterEnabled", params?: Runtime.SetCustomObjectFormatterEnabledParameterType, callback?: (err: Error | null) => void): void; - post(method: "Runtime.setCustomObjectFormatterEnabled", callback?: (err: Error | null) => void): void; - /** - * Compiles expression. - */ - post(method: "Runtime.compileScript", params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - post(method: "Runtime.compileScript", callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - /** - * Runs script with given id in a given context. - */ - post(method: "Runtime.runScript", params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - post(method: "Runtime.runScript", callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - post(method: "Runtime.queryObjects", params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - post(method: "Runtime.queryObjects", callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - /** - * Returns all let, const and class variables from global scope. - */ - post( - method: "Runtime.globalLexicalScopeNames", - params?: Runtime.GlobalLexicalScopeNamesParameterType, - callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void - ): void; - post(method: "Runtime.globalLexicalScopeNames", callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; - /** - * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. - */ - post(method: "Debugger.enable", callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void; - /** - * Disables debugger for given page. - */ - post(method: "Debugger.disable", callback?: (err: Error | null) => void): void; - /** - * Activates / deactivates all breakpoints on the page. - */ - post(method: "Debugger.setBreakpointsActive", params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBreakpointsActive", callback?: (err: Error | null) => void): void; - /** - * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). - */ - post(method: "Debugger.setSkipAllPauses", params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setSkipAllPauses", callback?: (err: Error | null) => void): void; - /** - * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. - */ - post(method: "Debugger.setBreakpointByUrl", params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - post(method: "Debugger.setBreakpointByUrl", callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - /** - * Sets JavaScript breakpoint at a given location. - */ - post(method: "Debugger.setBreakpoint", params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - post(method: "Debugger.setBreakpoint", callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - /** - * Removes JavaScript breakpoint. - */ - post(method: "Debugger.removeBreakpoint", params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.removeBreakpoint", callback?: (err: Error | null) => void): void; - /** - * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. - */ - post( - method: "Debugger.getPossibleBreakpoints", - params?: Debugger.GetPossibleBreakpointsParameterType, - callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void - ): void; - post(method: "Debugger.getPossibleBreakpoints", callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; - /** - * Continues execution until specific location is reached. - */ - post(method: "Debugger.continueToLocation", params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.continueToLocation", callback?: (err: Error | null) => void): void; - /** - * @experimental - */ - post(method: "Debugger.pauseOnAsyncCall", params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.pauseOnAsyncCall", callback?: (err: Error | null) => void): void; - /** - * Steps over the statement. - */ - post(method: "Debugger.stepOver", callback?: (err: Error | null) => void): void; - /** - * Steps into the function call. - */ - post(method: "Debugger.stepInto", params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.stepInto", callback?: (err: Error | null) => void): void; - /** - * Steps out of the function call. - */ - post(method: "Debugger.stepOut", callback?: (err: Error | null) => void): void; - /** - * Stops on the next JavaScript statement. - */ - post(method: "Debugger.pause", callback?: (err: Error | null) => void): void; - /** - * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. - * @experimental - */ - post(method: "Debugger.scheduleStepIntoAsync", callback?: (err: Error | null) => void): void; - /** - * Resumes JavaScript execution. - */ - post(method: "Debugger.resume", callback?: (err: Error | null) => void): void; - /** - * Returns stack trace with given stackTraceId. - * @experimental - */ - post(method: "Debugger.getStackTrace", params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - post(method: "Debugger.getStackTrace", callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - /** - * Searches for given string in script content. - */ - post(method: "Debugger.searchInContent", params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - post(method: "Debugger.searchInContent", callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - /** - * Edits JavaScript source live. - */ - post(method: "Debugger.setScriptSource", params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - post(method: "Debugger.setScriptSource", callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - /** - * Restarts particular call frame from the beginning. - */ - post(method: "Debugger.restartFrame", params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - post(method: "Debugger.restartFrame", callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - /** - * Returns source for the script with given id. - */ - post(method: "Debugger.getScriptSource", params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - post(method: "Debugger.getScriptSource", callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - /** - * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. - */ - post(method: "Debugger.setPauseOnExceptions", params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setPauseOnExceptions", callback?: (err: Error | null) => void): void; - /** - * Evaluates expression on a given call frame. - */ - post(method: "Debugger.evaluateOnCallFrame", params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - post(method: "Debugger.evaluateOnCallFrame", callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - /** - * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. - */ - post(method: "Debugger.setVariableValue", params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setVariableValue", callback?: (err: Error | null) => void): void; - /** - * Changes return value in top frame. Available only at return break position. - * @experimental - */ - post(method: "Debugger.setReturnValue", params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setReturnValue", callback?: (err: Error | null) => void): void; - /** - * Enables or disables async call stacks tracking. - */ - post(method: "Debugger.setAsyncCallStackDepth", params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setAsyncCallStackDepth", callback?: (err: Error | null) => void): void; - /** - * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. - * @experimental - */ - post(method: "Debugger.setBlackboxPatterns", params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBlackboxPatterns", callback?: (err: Error | null) => void): void; - /** - * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. - * @experimental - */ - post(method: "Debugger.setBlackboxedRanges", params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBlackboxedRanges", callback?: (err: Error | null) => void): void; - /** - * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. - */ - post(method: "Console.enable", callback?: (err: Error | null) => void): void; - /** - * Disables console domain, prevents further console messages from being reported to the client. - */ - post(method: "Console.disable", callback?: (err: Error | null) => void): void; - /** - * Does nothing. - */ - post(method: "Console.clearMessages", callback?: (err: Error | null) => void): void; - post(method: "Profiler.enable", callback?: (err: Error | null) => void): void; - post(method: "Profiler.disable", callback?: (err: Error | null) => void): void; - /** - * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. - */ - post(method: "Profiler.setSamplingInterval", params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; - post(method: "Profiler.setSamplingInterval", callback?: (err: Error | null) => void): void; - post(method: "Profiler.start", callback?: (err: Error | null) => void): void; - post(method: "Profiler.stop", callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; - /** - * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. - */ - post(method: "Profiler.startPreciseCoverage", params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; - post(method: "Profiler.startPreciseCoverage", callback?: (err: Error | null) => void): void; - /** - * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. - */ - post(method: "Profiler.stopPreciseCoverage", callback?: (err: Error | null) => void): void; - /** - * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. - */ - post(method: "Profiler.takePreciseCoverage", callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; - /** - * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. - */ - post(method: "Profiler.getBestEffortCoverage", callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; - post(method: "HeapProfiler.enable", callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.disable", callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startTrackingHeapObjects", params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startTrackingHeapObjects", callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.stopTrackingHeapObjects", params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.stopTrackingHeapObjects", callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.takeHeapSnapshot", params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.takeHeapSnapshot", callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.collectGarbage", callback?: (err: Error | null) => void): void; - post( - method: "HeapProfiler.getObjectByHeapObjectId", - params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, - callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void - ): void; - post(method: "HeapProfiler.getObjectByHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; - /** - * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). - */ - post(method: "HeapProfiler.addInspectedHeapObject", params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.addInspectedHeapObject", callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.getHeapObjectId", params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - post(method: "HeapProfiler.getHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - post(method: "HeapProfiler.startSampling", params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startSampling", callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.stopSampling", callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; - post(method: "HeapProfiler.getSamplingProfile", callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; - /** - * Gets supported tracing categories. - */ - post(method: "NodeTracing.getCategories", callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; - /** - * Start trace events collection. - */ - post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeTracing.start", callback?: (err: Error | null) => void): void; - /** - * Stop trace events collection. Remaining collected events will be sent as a sequence of - * dataCollected events followed by tracingComplete event. - */ - post(method: "NodeTracing.stop", callback?: (err: Error | null) => void): void; - /** - * Sends protocol message over session with given id. - */ - post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.sendMessageToWorker", callback?: (err: Error | null) => void): void; - /** - * Instructs the inspector to attach to running workers. Will also attach to new workers - * as they start - */ - post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.enable", callback?: (err: Error | null) => void): void; - /** - * Detaches from all running workers and disables attaching to new workers as they are started. - */ - post(method: "NodeWorker.disable", callback?: (err: Error | null) => void): void; - /** - * Detached from the worker with given sessionId. - */ - post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.detach", callback?: (err: Error | null) => void): void; - /** - * Disables network tracking, prevents network events from being sent to the client. - */ - post(method: "Network.disable", callback?: (err: Error | null) => void): void; - /** - * Enables network tracking, network events will now be delivered to the client. - */ - post(method: "Network.enable", callback?: (err: Error | null) => void): void; - /** - * Returns post data sent with the request. Returns an error when no data was sent with the request. - */ - post(method: "Network.getRequestPostData", params?: Network.GetRequestPostDataParameterType, callback?: (err: Error | null, params: Network.GetRequestPostDataReturnType) => void): void; - post(method: "Network.getRequestPostData", callback?: (err: Error | null, params: Network.GetRequestPostDataReturnType) => void): void; - /** - * Returns content served for the given request. - */ - post(method: "Network.getResponseBody", params?: Network.GetResponseBodyParameterType, callback?: (err: Error | null, params: Network.GetResponseBodyReturnType) => void): void; - post(method: "Network.getResponseBody", callback?: (err: Error | null, params: Network.GetResponseBodyReturnType) => void): void; - /** - * Enables streaming of the response for the given requestId. - * If enabled, the dataReceived event contains the data that was received during streaming. - * @experimental - */ - post( - method: "Network.streamResourceContent", - params?: Network.StreamResourceContentParameterType, - callback?: (err: Error | null, params: Network.StreamResourceContentReturnType) => void - ): void; - post(method: "Network.streamResourceContent", callback?: (err: Error | null, params: Network.StreamResourceContentReturnType) => void): void; - /** - * Fetches the resource and returns the content. - */ - post(method: "Network.loadNetworkResource", params?: Network.LoadNetworkResourceParameterType, callback?: (err: Error | null, params: Network.LoadNetworkResourceReturnType) => void): void; - post(method: "Network.loadNetworkResource", callback?: (err: Error | null, params: Network.LoadNetworkResourceReturnType) => void): void; - /** - * Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. - */ - post(method: "NodeRuntime.enable", callback?: (err: Error | null) => void): void; - /** - * Disable NodeRuntime events - */ - post(method: "NodeRuntime.disable", callback?: (err: Error | null) => void): void; - /** - * Enable the `NodeRuntime.waitingForDisconnect`. - */ - post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", callback?: (err: Error | null) => void): void; - post(method: "Target.setAutoAttach", params?: Target.SetAutoAttachParameterType, callback?: (err: Error | null) => void): void; - post(method: "Target.setAutoAttach", callback?: (err: Error | null) => void): void; - /** - * Read a chunk of the stream - */ - post(method: "IO.read", params?: IO.ReadParameterType, callback?: (err: Error | null, params: IO.ReadReturnType) => void): void; - post(method: "IO.read", callback?: (err: Error | null, params: IO.ReadReturnType) => void): void; - post(method: "IO.close", params?: IO.CloseParameterType, callback?: (err: Error | null) => void): void; - post(method: "IO.close", callback?: (err: Error | null) => void): void; - - addListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - addListener(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; - /** - * Issued when new execution context is created. - */ - addListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - addListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - addListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - addListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - addListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - addListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - addListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - addListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - addListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - addListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - addListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - addListener(event: "Debugger.resumed", listener: () => void): this; - /** - * Issued when new console message is added. - */ - addListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - addListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - addListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - addListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - addListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - addListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - addListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Fired when page is about to send HTTP request. - */ - addListener(event: "Network.requestWillBeSent", listener: (message: InspectorNotification) => void): this; - /** - * Fired when HTTP response is available. - */ - addListener(event: "Network.responseReceived", listener: (message: InspectorNotification) => void): this; - addListener(event: "Network.loadingFailed", listener: (message: InspectorNotification) => void): this; - addListener(event: "Network.loadingFinished", listener: (message: InspectorNotification) => void): this; - /** - * Fired when data chunk was received over the network. - */ - addListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - addListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - /** - * This event is fired when the runtime is waiting for the debugger. For - * example, when inspector.waitingForDebugger is called - */ - addListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; - addListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; - addListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "inspectorNotification", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextCreated", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextDestroyed", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextsCleared"): boolean; - emit(event: "Runtime.exceptionThrown", message: InspectorNotification): boolean; - emit(event: "Runtime.exceptionRevoked", message: InspectorNotification): boolean; - emit(event: "Runtime.consoleAPICalled", message: InspectorNotification): boolean; - emit(event: "Runtime.inspectRequested", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptParsed", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptFailedToParse", message: InspectorNotification): boolean; - emit(event: "Debugger.breakpointResolved", message: InspectorNotification): boolean; - emit(event: "Debugger.paused", message: InspectorNotification): boolean; - emit(event: "Debugger.resumed"): boolean; - emit(event: "Console.messageAdded", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileStarted", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileFinished", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.addHeapSnapshotChunk", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.resetProfiles"): boolean; - emit(event: "HeapProfiler.reportHeapSnapshotProgress", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.lastSeenObjectId", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.heapStatsUpdate", message: InspectorNotification): boolean; - emit(event: "NodeTracing.dataCollected", message: InspectorNotification): boolean; - emit(event: "NodeTracing.tracingComplete"): boolean; - emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification): boolean; - emit(event: "Network.requestWillBeSent", message: InspectorNotification): boolean; - emit(event: "Network.responseReceived", message: InspectorNotification): boolean; - emit(event: "Network.loadingFailed", message: InspectorNotification): boolean; - emit(event: "Network.loadingFinished", message: InspectorNotification): boolean; - emit(event: "Network.dataReceived", message: InspectorNotification): boolean; - emit(event: "NodeRuntime.waitingForDisconnect"): boolean; - emit(event: "NodeRuntime.waitingForDebugger"): boolean; - emit(event: "Target.targetCreated", message: InspectorNotification): boolean; - emit(event: "Target.attachedToTarget", message: InspectorNotification): boolean; - on(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - on(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; - /** - * Issued when new execution context is created. - */ - on(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - on(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - on(event: "Runtime.executionContextsCleared", listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - on(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - on(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - on(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - on(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - on(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - on(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - on(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - on(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - on(event: "Debugger.resumed", listener: () => void): this; - /** - * Issued when new console message is added. - */ - on(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - on(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - on(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.resetProfiles", listener: () => void): this; - on(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - on(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - on(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - on(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Fired when page is about to send HTTP request. - */ - on(event: "Network.requestWillBeSent", listener: (message: InspectorNotification) => void): this; - /** - * Fired when HTTP response is available. - */ - on(event: "Network.responseReceived", listener: (message: InspectorNotification) => void): this; - on(event: "Network.loadingFailed", listener: (message: InspectorNotification) => void): this; - on(event: "Network.loadingFinished", listener: (message: InspectorNotification) => void): this; - /** - * Fired when data chunk was received over the network. - */ - on(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - on(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - /** - * This event is fired when the runtime is waiting for the debugger. For - * example, when inspector.waitingForDebugger is called - */ - on(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; - on(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; - on(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - once(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; - /** - * Issued when new execution context is created. - */ - once(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - once(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - once(event: "Runtime.executionContextsCleared", listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - once(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - once(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - once(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - once(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - once(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - once(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - once(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - once(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - once(event: "Debugger.resumed", listener: () => void): this; - /** - * Issued when new console message is added. - */ - once(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - once(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - once(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.resetProfiles", listener: () => void): this; - once(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - once(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - once(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - once(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Fired when page is about to send HTTP request. - */ - once(event: "Network.requestWillBeSent", listener: (message: InspectorNotification) => void): this; - /** - * Fired when HTTP response is available. - */ - once(event: "Network.responseReceived", listener: (message: InspectorNotification) => void): this; - once(event: "Network.loadingFailed", listener: (message: InspectorNotification) => void): this; - once(event: "Network.loadingFinished", listener: (message: InspectorNotification) => void): this; - /** - * Fired when data chunk was received over the network. - */ - once(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - once(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - /** - * This event is fired when the runtime is waiting for the debugger. For - * example, when inspector.waitingForDebugger is called - */ - once(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; - once(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; - once(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependListener(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; - /** - * Issued when new execution context is created. - */ - prependListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - prependListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - prependListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - prependListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - prependListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - prependListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - prependListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - prependListener(event: "Debugger.resumed", listener: () => void): this; - /** - * Issued when new console message is added. - */ - prependListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - prependListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Fired when page is about to send HTTP request. - */ - prependListener(event: "Network.requestWillBeSent", listener: (message: InspectorNotification) => void): this; - /** - * Fired when HTTP response is available. - */ - prependListener(event: "Network.responseReceived", listener: (message: InspectorNotification) => void): this; - prependListener(event: "Network.loadingFailed", listener: (message: InspectorNotification) => void): this; - prependListener(event: "Network.loadingFinished", listener: (message: InspectorNotification) => void): this; - /** - * Fired when data chunk was received over the network. - */ - prependListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - /** - * This event is fired when the runtime is waiting for the debugger. For - * example, when inspector.waitingForDebugger is called - */ - prependListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; - prependListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; - prependListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependOnceListener(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; - /** - * Issued when new execution context is created. - */ - prependOnceListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - prependOnceListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - prependOnceListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - prependOnceListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - prependOnceListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - prependOnceListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependOnceListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependOnceListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - prependOnceListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependOnceListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependOnceListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - prependOnceListener(event: "Debugger.resumed", listener: () => void): this; - /** - * Issued when new console message is added. - */ - prependOnceListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependOnceListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependOnceListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependOnceListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependOnceListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Fired when page is about to send HTTP request. - */ - prependOnceListener(event: "Network.requestWillBeSent", listener: (message: InspectorNotification) => void): this; - /** - * Fired when HTTP response is available. - */ - prependOnceListener(event: "Network.responseReceived", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "Network.loadingFailed", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "Network.loadingFinished", listener: (message: InspectorNotification) => void): this; - /** - * Fired when data chunk was received over the network. - */ - prependOnceListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependOnceListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - /** - * This event is fired when the runtime is waiting for the debugger. For - * example, when inspector.waitingForDebugger is called - */ - prependOnceListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; - prependOnceListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; - } -} - -declare module "inspector/promises" { - export { - Schema, - Runtime, - Debugger, - Console, - Profiler, - HeapProfiler, - NodeTracing, - NodeWorker, - Network, - NodeRuntime, - Target, - IO, - } from 'inspector'; -} - -declare module "inspector/promises" { - import { - InspectorNotification, - Schema, - Runtime, - Debugger, - Console, - Profiler, - HeapProfiler, - NodeTracing, - NodeWorker, - Network, - NodeRuntime, - Target, - IO, - } from "inspector"; - - /** - * The `inspector.Session` is used for dispatching messages to the V8 inspector - * back-end and receiving message responses and notifications. - * @since v19.0.0 - */ - interface Session { - /** - * Posts a message to the inspector back-end. - * - * ```js - * import { Session } from 'node:inspector/promises'; - * try { - * const session = new Session(); - * session.connect(); - * const result = await session.post('Runtime.evaluate', { expression: '2 + 2' }); - * console.log(result); - * } catch (error) { - * console.error(error); - * } - * // Output: { result: { type: 'number', value: 4, description: '4' } } - * ``` - * - * The latest version of the V8 inspector protocol is published on the - * [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/). - * - * Node.js inspector supports all the Chrome DevTools Protocol domains declared - * by V8. Chrome DevTools Protocol domain provides an interface for interacting - * with one of the runtime agents used to inspect the application state and listen - * to the run-time events. - */ - post(method: string, params?: object): Promise; - /** - * Returns supported domains. - */ - post(method: "Schema.getDomains"): Promise; - /** - * Evaluates expression on global object. - */ - post(method: "Runtime.evaluate", params?: Runtime.EvaluateParameterType): Promise; - /** - * Add handler to promise with given promise object id. - */ - post(method: "Runtime.awaitPromise", params?: Runtime.AwaitPromiseParameterType): Promise; - /** - * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. - */ - post(method: "Runtime.callFunctionOn", params?: Runtime.CallFunctionOnParameterType): Promise; - /** - * Returns properties of a given object. Object group of the result is inherited from the target object. - */ - post(method: "Runtime.getProperties", params?: Runtime.GetPropertiesParameterType): Promise; - /** - * Releases remote object with given id. - */ - post(method: "Runtime.releaseObject", params?: Runtime.ReleaseObjectParameterType): Promise; - /** - * Releases all remote objects that belong to a given group. - */ - post(method: "Runtime.releaseObjectGroup", params?: Runtime.ReleaseObjectGroupParameterType): Promise; - /** - * Tells inspected instance to run if it was waiting for debugger to attach. - */ - post(method: "Runtime.runIfWaitingForDebugger"): Promise; - /** - * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. - */ - post(method: "Runtime.enable"): Promise; - /** - * Disables reporting of execution contexts creation. - */ - post(method: "Runtime.disable"): Promise; - /** - * Discards collected exceptions and console API calls. - */ - post(method: "Runtime.discardConsoleEntries"): Promise; - /** - * @experimental - */ - post(method: "Runtime.setCustomObjectFormatterEnabled", params?: Runtime.SetCustomObjectFormatterEnabledParameterType): Promise; - /** - * Compiles expression. - */ - post(method: "Runtime.compileScript", params?: Runtime.CompileScriptParameterType): Promise; - /** - * Runs script with given id in a given context. - */ - post(method: "Runtime.runScript", params?: Runtime.RunScriptParameterType): Promise; - post(method: "Runtime.queryObjects", params?: Runtime.QueryObjectsParameterType): Promise; - /** - * Returns all let, const and class variables from global scope. - */ - post(method: "Runtime.globalLexicalScopeNames", params?: Runtime.GlobalLexicalScopeNamesParameterType): Promise; - /** - * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. - */ - post(method: "Debugger.enable"): Promise; - /** - * Disables debugger for given page. - */ - post(method: "Debugger.disable"): Promise; - /** - * Activates / deactivates all breakpoints on the page. - */ - post(method: "Debugger.setBreakpointsActive", params?: Debugger.SetBreakpointsActiveParameterType): Promise; - /** - * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). - */ - post(method: "Debugger.setSkipAllPauses", params?: Debugger.SetSkipAllPausesParameterType): Promise; - /** - * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. - */ - post(method: "Debugger.setBreakpointByUrl", params?: Debugger.SetBreakpointByUrlParameterType): Promise; - /** - * Sets JavaScript breakpoint at a given location. - */ - post(method: "Debugger.setBreakpoint", params?: Debugger.SetBreakpointParameterType): Promise; - /** - * Removes JavaScript breakpoint. - */ - post(method: "Debugger.removeBreakpoint", params?: Debugger.RemoveBreakpointParameterType): Promise; - /** - * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. - */ - post(method: "Debugger.getPossibleBreakpoints", params?: Debugger.GetPossibleBreakpointsParameterType): Promise; - /** - * Continues execution until specific location is reached. - */ - post(method: "Debugger.continueToLocation", params?: Debugger.ContinueToLocationParameterType): Promise; - /** - * @experimental - */ - post(method: "Debugger.pauseOnAsyncCall", params?: Debugger.PauseOnAsyncCallParameterType): Promise; - /** - * Steps over the statement. - */ - post(method: "Debugger.stepOver"): Promise; - /** - * Steps into the function call. - */ - post(method: "Debugger.stepInto", params?: Debugger.StepIntoParameterType): Promise; - /** - * Steps out of the function call. - */ - post(method: "Debugger.stepOut"): Promise; - /** - * Stops on the next JavaScript statement. - */ - post(method: "Debugger.pause"): Promise; - /** - * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. - * @experimental - */ - post(method: "Debugger.scheduleStepIntoAsync"): Promise; - /** - * Resumes JavaScript execution. - */ - post(method: "Debugger.resume"): Promise; - /** - * Returns stack trace with given stackTraceId. - * @experimental - */ - post(method: "Debugger.getStackTrace", params?: Debugger.GetStackTraceParameterType): Promise; - /** - * Searches for given string in script content. - */ - post(method: "Debugger.searchInContent", params?: Debugger.SearchInContentParameterType): Promise; - /** - * Edits JavaScript source live. - */ - post(method: "Debugger.setScriptSource", params?: Debugger.SetScriptSourceParameterType): Promise; - /** - * Restarts particular call frame from the beginning. - */ - post(method: "Debugger.restartFrame", params?: Debugger.RestartFrameParameterType): Promise; - /** - * Returns source for the script with given id. - */ - post(method: "Debugger.getScriptSource", params?: Debugger.GetScriptSourceParameterType): Promise; - /** - * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. - */ - post(method: "Debugger.setPauseOnExceptions", params?: Debugger.SetPauseOnExceptionsParameterType): Promise; - /** - * Evaluates expression on a given call frame. - */ - post(method: "Debugger.evaluateOnCallFrame", params?: Debugger.EvaluateOnCallFrameParameterType): Promise; - /** - * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. - */ - post(method: "Debugger.setVariableValue", params?: Debugger.SetVariableValueParameterType): Promise; - /** - * Changes return value in top frame. Available only at return break position. - * @experimental - */ - post(method: "Debugger.setReturnValue", params?: Debugger.SetReturnValueParameterType): Promise; - /** - * Enables or disables async call stacks tracking. - */ - post(method: "Debugger.setAsyncCallStackDepth", params?: Debugger.SetAsyncCallStackDepthParameterType): Promise; - /** - * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. - * @experimental - */ - post(method: "Debugger.setBlackboxPatterns", params?: Debugger.SetBlackboxPatternsParameterType): Promise; - /** - * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. - * @experimental - */ - post(method: "Debugger.setBlackboxedRanges", params?: Debugger.SetBlackboxedRangesParameterType): Promise; - /** - * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. - */ - post(method: "Console.enable"): Promise; - /** - * Disables console domain, prevents further console messages from being reported to the client. - */ - post(method: "Console.disable"): Promise; - /** - * Does nothing. - */ - post(method: "Console.clearMessages"): Promise; - post(method: "Profiler.enable"): Promise; - post(method: "Profiler.disable"): Promise; - /** - * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. - */ - post(method: "Profiler.setSamplingInterval", params?: Profiler.SetSamplingIntervalParameterType): Promise; - post(method: "Profiler.start"): Promise; - post(method: "Profiler.stop"): Promise; - /** - * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. - */ - post(method: "Profiler.startPreciseCoverage", params?: Profiler.StartPreciseCoverageParameterType): Promise; - /** - * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. - */ - post(method: "Profiler.stopPreciseCoverage"): Promise; - /** - * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. - */ - post(method: "Profiler.takePreciseCoverage"): Promise; - /** - * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. - */ - post(method: "Profiler.getBestEffortCoverage"): Promise; - post(method: "HeapProfiler.enable"): Promise; - post(method: "HeapProfiler.disable"): Promise; - post(method: "HeapProfiler.startTrackingHeapObjects", params?: HeapProfiler.StartTrackingHeapObjectsParameterType): Promise; - post(method: "HeapProfiler.stopTrackingHeapObjects", params?: HeapProfiler.StopTrackingHeapObjectsParameterType): Promise; - post(method: "HeapProfiler.takeHeapSnapshot", params?: HeapProfiler.TakeHeapSnapshotParameterType): Promise; - post(method: "HeapProfiler.collectGarbage"): Promise; - post(method: "HeapProfiler.getObjectByHeapObjectId", params?: HeapProfiler.GetObjectByHeapObjectIdParameterType): Promise; - /** - * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). - */ - post(method: "HeapProfiler.addInspectedHeapObject", params?: HeapProfiler.AddInspectedHeapObjectParameterType): Promise; - post(method: "HeapProfiler.getHeapObjectId", params?: HeapProfiler.GetHeapObjectIdParameterType): Promise; - post(method: "HeapProfiler.startSampling", params?: HeapProfiler.StartSamplingParameterType): Promise; - post(method: "HeapProfiler.stopSampling"): Promise; - post(method: "HeapProfiler.getSamplingProfile"): Promise; - /** - * Gets supported tracing categories. - */ - post(method: "NodeTracing.getCategories"): Promise; - /** - * Start trace events collection. - */ - post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType): Promise; - /** - * Stop trace events collection. Remaining collected events will be sent as a sequence of - * dataCollected events followed by tracingComplete event. - */ - post(method: "NodeTracing.stop"): Promise; - /** - * Sends protocol message over session with given id. - */ - post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType): Promise; - /** - * Instructs the inspector to attach to running workers. Will also attach to new workers - * as they start - */ - post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType): Promise; - /** - * Detaches from all running workers and disables attaching to new workers as they are started. - */ - post(method: "NodeWorker.disable"): Promise; - /** - * Detached from the worker with given sessionId. - */ - post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType): Promise; - /** - * Disables network tracking, prevents network events from being sent to the client. - */ - post(method: "Network.disable"): Promise; - /** - * Enables network tracking, network events will now be delivered to the client. - */ - post(method: "Network.enable"): Promise; - /** - * Returns post data sent with the request. Returns an error when no data was sent with the request. - */ - post(method: "Network.getRequestPostData", params?: Network.GetRequestPostDataParameterType): Promise; - /** - * Returns content served for the given request. - */ - post(method: "Network.getResponseBody", params?: Network.GetResponseBodyParameterType): Promise; - /** - * Enables streaming of the response for the given requestId. - * If enabled, the dataReceived event contains the data that was received during streaming. - * @experimental - */ - post(method: "Network.streamResourceContent", params?: Network.StreamResourceContentParameterType): Promise; - /** - * Fetches the resource and returns the content. - */ - post(method: "Network.loadNetworkResource", params?: Network.LoadNetworkResourceParameterType): Promise; - /** - * Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. - */ - post(method: "NodeRuntime.enable"): Promise; - /** - * Disable NodeRuntime events - */ - post(method: "NodeRuntime.disable"): Promise; - /** - * Enable the `NodeRuntime.waitingForDisconnect`. - */ - post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType): Promise; - post(method: "Target.setAutoAttach", params?: Target.SetAutoAttachParameterType): Promise; - /** - * Read a chunk of the stream - */ - post(method: "IO.read", params?: IO.ReadParameterType): Promise; - post(method: "IO.close", params?: IO.CloseParameterType): Promise; - - addListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - addListener(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; - /** - * Issued when new execution context is created. - */ - addListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - addListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - addListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - addListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - addListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - addListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - addListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - addListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - addListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - addListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - addListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - addListener(event: "Debugger.resumed", listener: () => void): this; - /** - * Issued when new console message is added. - */ - addListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - addListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - addListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - addListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - addListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - addListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - addListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Fired when page is about to send HTTP request. - */ - addListener(event: "Network.requestWillBeSent", listener: (message: InspectorNotification) => void): this; - /** - * Fired when HTTP response is available. - */ - addListener(event: "Network.responseReceived", listener: (message: InspectorNotification) => void): this; - addListener(event: "Network.loadingFailed", listener: (message: InspectorNotification) => void): this; - addListener(event: "Network.loadingFinished", listener: (message: InspectorNotification) => void): this; - /** - * Fired when data chunk was received over the network. - */ - addListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - addListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - /** - * This event is fired when the runtime is waiting for the debugger. For - * example, when inspector.waitingForDebugger is called - */ - addListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; - addListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; - addListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "inspectorNotification", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextCreated", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextDestroyed", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextsCleared"): boolean; - emit(event: "Runtime.exceptionThrown", message: InspectorNotification): boolean; - emit(event: "Runtime.exceptionRevoked", message: InspectorNotification): boolean; - emit(event: "Runtime.consoleAPICalled", message: InspectorNotification): boolean; - emit(event: "Runtime.inspectRequested", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptParsed", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptFailedToParse", message: InspectorNotification): boolean; - emit(event: "Debugger.breakpointResolved", message: InspectorNotification): boolean; - emit(event: "Debugger.paused", message: InspectorNotification): boolean; - emit(event: "Debugger.resumed"): boolean; - emit(event: "Console.messageAdded", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileStarted", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileFinished", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.addHeapSnapshotChunk", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.resetProfiles"): boolean; - emit(event: "HeapProfiler.reportHeapSnapshotProgress", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.lastSeenObjectId", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.heapStatsUpdate", message: InspectorNotification): boolean; - emit(event: "NodeTracing.dataCollected", message: InspectorNotification): boolean; - emit(event: "NodeTracing.tracingComplete"): boolean; - emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification): boolean; - emit(event: "Network.requestWillBeSent", message: InspectorNotification): boolean; - emit(event: "Network.responseReceived", message: InspectorNotification): boolean; - emit(event: "Network.loadingFailed", message: InspectorNotification): boolean; - emit(event: "Network.loadingFinished", message: InspectorNotification): boolean; - emit(event: "Network.dataReceived", message: InspectorNotification): boolean; - emit(event: "NodeRuntime.waitingForDisconnect"): boolean; - emit(event: "NodeRuntime.waitingForDebugger"): boolean; - emit(event: "Target.targetCreated", message: InspectorNotification): boolean; - emit(event: "Target.attachedToTarget", message: InspectorNotification): boolean; - on(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - on(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; - /** - * Issued when new execution context is created. - */ - on(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - on(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - on(event: "Runtime.executionContextsCleared", listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - on(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - on(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - on(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - on(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - on(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - on(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - on(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - on(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - on(event: "Debugger.resumed", listener: () => void): this; - /** - * Issued when new console message is added. - */ - on(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - on(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - on(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.resetProfiles", listener: () => void): this; - on(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - on(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - on(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - on(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Fired when page is about to send HTTP request. - */ - on(event: "Network.requestWillBeSent", listener: (message: InspectorNotification) => void): this; - /** - * Fired when HTTP response is available. - */ - on(event: "Network.responseReceived", listener: (message: InspectorNotification) => void): this; - on(event: "Network.loadingFailed", listener: (message: InspectorNotification) => void): this; - on(event: "Network.loadingFinished", listener: (message: InspectorNotification) => void): this; - /** - * Fired when data chunk was received over the network. - */ - on(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - on(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - /** - * This event is fired when the runtime is waiting for the debugger. For - * example, when inspector.waitingForDebugger is called - */ - on(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; - on(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; - on(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - once(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; - /** - * Issued when new execution context is created. - */ - once(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - once(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - once(event: "Runtime.executionContextsCleared", listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - once(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - once(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - once(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - once(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - once(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - once(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - once(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - once(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - once(event: "Debugger.resumed", listener: () => void): this; - /** - * Issued when new console message is added. - */ - once(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - once(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - once(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.resetProfiles", listener: () => void): this; - once(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - once(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - once(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - once(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Fired when page is about to send HTTP request. - */ - once(event: "Network.requestWillBeSent", listener: (message: InspectorNotification) => void): this; - /** - * Fired when HTTP response is available. - */ - once(event: "Network.responseReceived", listener: (message: InspectorNotification) => void): this; - once(event: "Network.loadingFailed", listener: (message: InspectorNotification) => void): this; - once(event: "Network.loadingFinished", listener: (message: InspectorNotification) => void): this; - /** - * Fired when data chunk was received over the network. - */ - once(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - once(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - /** - * This event is fired when the runtime is waiting for the debugger. For - * example, when inspector.waitingForDebugger is called - */ - once(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; - once(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; - once(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependListener(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; - /** - * Issued when new execution context is created. - */ - prependListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - prependListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - prependListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - prependListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - prependListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - prependListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - prependListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - prependListener(event: "Debugger.resumed", listener: () => void): this; - /** - * Issued when new console message is added. - */ - prependListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - prependListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Fired when page is about to send HTTP request. - */ - prependListener(event: "Network.requestWillBeSent", listener: (message: InspectorNotification) => void): this; - /** - * Fired when HTTP response is available. - */ - prependListener(event: "Network.responseReceived", listener: (message: InspectorNotification) => void): this; - prependListener(event: "Network.loadingFailed", listener: (message: InspectorNotification) => void): this; - prependListener(event: "Network.loadingFinished", listener: (message: InspectorNotification) => void): this; - /** - * Fired when data chunk was received over the network. - */ - prependListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - /** - * This event is fired when the runtime is waiting for the debugger. For - * example, when inspector.waitingForDebugger is called - */ - prependListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; - prependListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; - prependListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependOnceListener(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; - /** - * Issued when new execution context is created. - */ - prependOnceListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - prependOnceListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - prependOnceListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - prependOnceListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - prependOnceListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - prependOnceListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependOnceListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependOnceListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - prependOnceListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependOnceListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependOnceListener(event: "Debugger.paused", listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - prependOnceListener(event: "Debugger.resumed", listener: () => void): this; - /** - * Issued when new console message is added. - */ - prependOnceListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependOnceListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependOnceListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependOnceListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependOnceListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Fired when page is about to send HTTP request. - */ - prependOnceListener(event: "Network.requestWillBeSent", listener: (message: InspectorNotification) => void): this; - /** - * Fired when HTTP response is available. - */ - prependOnceListener(event: "Network.responseReceived", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "Network.loadingFailed", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "Network.loadingFinished", listener: (message: InspectorNotification) => void): this; - /** - * Fired when data chunk was received over the network. - */ - prependOnceListener(event: "Network.dataReceived", listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependOnceListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this; - /** - * This event is fired when the runtime is waiting for the debugger. For - * example, when inspector.waitingForDebugger is called - */ - prependOnceListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; - prependOnceListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; - } -} diff --git a/node_modules/@types/node/module.d.ts b/node_modules/@types/node/module.d.ts deleted file mode 100644 index b48948e..0000000 --- a/node_modules/@types/node/module.d.ts +++ /dev/null @@ -1,891 +0,0 @@ -/** - * @since v0.3.7 - */ -declare module "module" { - import { URL } from "node:url"; - class Module { - constructor(id: string, parent?: Module); - } - interface Module extends NodeJS.Module {} - namespace Module { - export { Module }; - } - namespace Module { - /** - * A list of the names of all modules provided by Node.js. Can be used to verify - * if a module is maintained by a third party or not. - * - * Note: the list doesn't contain prefix-only modules like `node:test`. - * @since v9.3.0, v8.10.0, v6.13.0 - */ - const builtinModules: readonly string[]; - /** - * @since v12.2.0 - * @param path Filename to be used to construct the require - * function. Must be a file URL object, file URL string, or absolute path - * string. - */ - function createRequire(path: string | URL): NodeJS.Require; - namespace constants { - /** - * The following constants are returned as the `status` field in the object returned by - * {@link enableCompileCache} to indicate the result of the attempt to enable the - * [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache). - * @since v22.8.0 - */ - namespace compileCacheStatus { - /** - * Node.js has enabled the compile cache successfully. The directory used to store the - * compile cache will be returned in the `directory` field in the - * returned object. - */ - const ENABLED: number; - /** - * The compile cache has already been enabled before, either by a previous call to - * {@link enableCompileCache}, or by the `NODE_COMPILE_CACHE=dir` - * environment variable. The directory used to store the - * compile cache will be returned in the `directory` field in the - * returned object. - */ - const ALREADY_ENABLED: number; - /** - * Node.js fails to enable the compile cache. This can be caused by the lack of - * permission to use the specified directory, or various kinds of file system errors. - * The detail of the failure will be returned in the `message` field in the - * returned object. - */ - const FAILED: number; - /** - * Node.js cannot enable the compile cache because the environment variable - * `NODE_DISABLE_COMPILE_CACHE=1` has been set. - */ - const DISABLED: number; - } - } - interface EnableCompileCacheResult { - /** - * One of the {@link constants.compileCacheStatus} - */ - status: number; - /** - * If Node.js cannot enable the compile cache, this contains - * the error message. Only set if `status` is `module.constants.compileCacheStatus.FAILED`. - */ - message?: string; - /** - * If the compile cache is enabled, this contains the directory - * where the compile cache is stored. Only set if `status` is - * `module.constants.compileCacheStatus.ENABLED` or - * `module.constants.compileCacheStatus.ALREADY_ENABLED`. - */ - directory?: string; - } - /** - * Enable [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache) - * in the current Node.js instance. - * - * If `cacheDir` is not specified, Node.js will either use the directory specified by the - * `NODE_COMPILE_CACHE=dir` environment variable if it's set, or use - * `path.join(os.tmpdir(), 'node-compile-cache')` otherwise. For general use cases, it's - * recommended to call `module.enableCompileCache()` without specifying the `cacheDir`, - * so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment - * variable when necessary. - * - * Since compile cache is supposed to be a quiet optimization that is not required for the - * application to be functional, this method is designed to not throw any exception when the - * compile cache cannot be enabled. Instead, it will return an object containing an error - * message in the `message` field to aid debugging. - * If compile cache is enabled successfully, the `directory` field in the returned object - * contains the path to the directory where the compile cache is stored. The `status` - * field in the returned object would be one of the `module.constants.compileCacheStatus` - * values to indicate the result of the attempt to enable the - * [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache). - * - * This method only affects the current Node.js instance. To enable it in child worker threads, - * either call this method in child worker threads too, or set the - * `process.env.NODE_COMPILE_CACHE` value to compile cache directory so the behavior can - * be inherited into the child workers. The directory can be obtained either from the - * `directory` field returned by this method, or with {@link getCompileCacheDir}. - * @since v22.8.0 - * @param cacheDir Optional path to specify the directory where the compile cache - * will be stored/retrieved. - */ - function enableCompileCache(cacheDir?: string): EnableCompileCacheResult; - /** - * Flush the [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache) - * accumulated from modules already loaded - * in the current Node.js instance to disk. This returns after all the flushing - * file system operations come to an end, no matter they succeed or not. If there - * are any errors, this will fail silently, since compile cache misses should not - * interfere with the actual operation of the application. - * @since v22.10.0 - */ - function flushCompileCache(): void; - /** - * @since v22.8.0 - * @return Path to the [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache) - * directory if it is enabled, or `undefined` otherwise. - */ - function getCompileCacheDir(): string | undefined; - /** - * ```text - * /path/to/project - * ├ packages/ - * ├ bar/ - * ├ bar.js - * └ package.json // name = '@foo/bar' - * └ qux/ - * ├ node_modules/ - * └ some-package/ - * └ package.json // name = 'some-package' - * ├ qux.js - * └ package.json // name = '@foo/qux' - * ├ main.js - * └ package.json // name = '@foo' - * ``` - * ```js - * // /path/to/project/packages/bar/bar.js - * import { findPackageJSON } from 'node:module'; - * - * findPackageJSON('..', import.meta.url); - * // '/path/to/project/package.json' - * // Same result when passing an absolute specifier instead: - * findPackageJSON(new URL('../', import.meta.url)); - * findPackageJSON(import.meta.resolve('../')); - * - * findPackageJSON('some-package', import.meta.url); - * // '/path/to/project/packages/bar/node_modules/some-package/package.json' - * // When passing an absolute specifier, you might get a different result if the - * // resolved module is inside a subfolder that has nested `package.json`. - * findPackageJSON(import.meta.resolve('some-package')); - * // '/path/to/project/packages/bar/node_modules/some-package/some-subfolder/package.json' - * - * findPackageJSON('@foo/qux', import.meta.url); - * // '/path/to/project/packages/qux/package.json' - * ``` - * @since v22.14.0 - * @param specifier The specifier for the module whose `package.json` to - * retrieve. When passing a _bare specifier_, the `package.json` at the root of - * the package is returned. When passing a _relative specifier_ or an _absolute specifier_, - * the closest parent `package.json` is returned. - * @param base The absolute location (`file:` URL string or FS path) of the - * containing module. For CJS, use `__filename` (not `__dirname`!); for ESM, use - * `import.meta.url`. You do not need to pass it if `specifier` is an _absolute specifier_. - * @returns A path if the `package.json` is found. When `startLocation` - * is a package, the package's root `package.json`; when a relative or unresolved, the closest - * `package.json` to the `startLocation`. - */ - function findPackageJSON(specifier: string | URL, base?: string | URL): string | undefined; - /** - * @since v18.6.0, v16.17.0 - */ - function isBuiltin(moduleName: string): boolean; - interface RegisterOptions { - /** - * If you want to resolve `specifier` relative to a - * base URL, such as `import.meta.url`, you can pass that URL here. This - * property is ignored if the `parentURL` is supplied as the second argument. - * @default 'data:' - */ - parentURL?: string | URL | undefined; - /** - * Any arbitrary, cloneable JavaScript value to pass into the - * {@link initialize} hook. - */ - data?: Data | undefined; - /** - * [Transferable objects](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html#portpostmessagevalue-transferlist) - * to be passed into the `initialize` hook. - */ - transferList?: any[] | undefined; - } - /* eslint-disable @definitelytyped/no-unnecessary-generics */ - /** - * Register a module that exports hooks that customize Node.js module - * resolution and loading behavior. See - * [Customization hooks](https://nodejs.org/docs/latest-v22.x/api/module.html#customization-hooks). - * - * This feature requires `--allow-worker` if used with the - * [Permission Model](https://nodejs.org/docs/latest-v22.x/api/permissions.html#permission-model). - * @since v20.6.0, v18.19.0 - * @param specifier Customization hooks to be registered; this should be - * the same string that would be passed to `import()`, except that if it is - * relative, it is resolved relative to `parentURL`. - * @param parentURL f you want to resolve `specifier` relative to a base - * URL, such as `import.meta.url`, you can pass that URL here. - */ - function register( - specifier: string | URL, - parentURL?: string | URL, - options?: RegisterOptions, - ): void; - function register(specifier: string | URL, options?: RegisterOptions): void; - interface RegisterHooksOptions { - /** - * See [load hook](https://nodejs.org/docs/latest-v22.x/api/module.html#loadurl-context-nextload). - * @default undefined - */ - load?: LoadHookSync | undefined; - /** - * See [resolve hook](https://nodejs.org/docs/latest-v22.x/api/module.html#resolvespecifier-context-nextresolve). - * @default undefined - */ - resolve?: ResolveHookSync | undefined; - } - interface ModuleHooks { - /** - * Deregister the hook instance. - */ - deregister(): void; - } - /** - * Register [hooks](https://nodejs.org/docs/latest-v22.x/api/module.html#customization-hooks) - * that customize Node.js module resolution and loading behavior. - * @since v22.15.0 - * @experimental - */ - function registerHooks(options: RegisterHooksOptions): ModuleHooks; - interface StripTypeScriptTypesOptions { - /** - * Possible values are: - * * `'strip'` Only strip type annotations without performing the transformation of TypeScript features. - * * `'transform'` Strip type annotations and transform TypeScript features to JavaScript. - * @default 'strip' - */ - mode?: "strip" | "transform" | undefined; - /** - * Only when `mode` is `'transform'`, if `true`, a source map - * will be generated for the transformed code. - * @default false - */ - sourceMap?: boolean | undefined; - /** - * Specifies the source url used in the source map. - */ - sourceUrl?: string | undefined; - } - /** - * `module.stripTypeScriptTypes()` removes type annotations from TypeScript code. It - * can be used to strip type annotations from TypeScript code before running it - * with `vm.runInContext()` or `vm.compileFunction()`. - * By default, it will throw an error if the code contains TypeScript features - * that require transformation such as `Enums`, - * see [type-stripping](https://nodejs.org/docs/latest-v22.x/api/typescript.md#type-stripping) for more information. - * When mode is `'transform'`, it also transforms TypeScript features to JavaScript, - * see [transform TypeScript features](https://nodejs.org/docs/latest-v22.x/api/typescript.md#typescript-features) for more information. - * When mode is `'strip'`, source maps are not generated, because locations are preserved. - * If `sourceMap` is provided, when mode is `'strip'`, an error will be thrown. - * - * _WARNING_: The output of this function should not be considered stable across Node.js versions, - * due to changes in the TypeScript parser. - * - * ```js - * import { stripTypeScriptTypes } from 'node:module'; - * const code = 'const a: number = 1;'; - * const strippedCode = stripTypeScriptTypes(code); - * console.log(strippedCode); - * // Prints: const a = 1; - * ``` - * - * If `sourceUrl` is provided, it will be used appended as a comment at the end of the output: - * - * ```js - * import { stripTypeScriptTypes } from 'node:module'; - * const code = 'const a: number = 1;'; - * const strippedCode = stripTypeScriptTypes(code, { mode: 'strip', sourceUrl: 'source.ts' }); - * console.log(strippedCode); - * // Prints: const a = 1\n\n//# sourceURL=source.ts; - * ``` - * - * When `mode` is `'transform'`, the code is transformed to JavaScript: - * - * ```js - * import { stripTypeScriptTypes } from 'node:module'; - * const code = ` - * namespace MathUtil { - * export const add = (a: number, b: number) => a + b; - * }`; - * const strippedCode = stripTypeScriptTypes(code, { mode: 'transform', sourceMap: true }); - * console.log(strippedCode); - * // Prints: - * // var MathUtil; - * // (function(MathUtil) { - * // MathUtil.add = (a, b)=>a + b; - * // })(MathUtil || (MathUtil = {})); - * // # sourceMappingURL=data:application/json;base64, ... - * ``` - * @since v22.13.0 - * @param code The code to strip type annotations from. - * @returns The code with type annotations stripped. - */ - function stripTypeScriptTypes(code: string, options?: StripTypeScriptTypesOptions): string; - /* eslint-enable @definitelytyped/no-unnecessary-generics */ - /** - * The `module.syncBuiltinESMExports()` method updates all the live bindings for - * builtin `ES Modules` to match the properties of the `CommonJS` exports. It - * does not add or remove exported names from the `ES Modules`. - * - * ```js - * import fs from 'node:fs'; - * import assert from 'node:assert'; - * import { syncBuiltinESMExports } from 'node:module'; - * - * fs.readFile = newAPI; - * - * delete fs.readFileSync; - * - * function newAPI() { - * // ... - * } - * - * fs.newAPI = newAPI; - * - * syncBuiltinESMExports(); - * - * import('node:fs').then((esmFS) => { - * // It syncs the existing readFile property with the new value - * assert.strictEqual(esmFS.readFile, newAPI); - * // readFileSync has been deleted from the required fs - * assert.strictEqual('readFileSync' in fs, false); - * // syncBuiltinESMExports() does not remove readFileSync from esmFS - * assert.strictEqual('readFileSync' in esmFS, true); - * // syncBuiltinESMExports() does not add names - * assert.strictEqual(esmFS.newAPI, undefined); - * }); - * ``` - * @since v12.12.0 - */ - function syncBuiltinESMExports(): void; - interface ImportAttributes extends NodeJS.Dict { - type?: string | undefined; - } - type ModuleFormat = - | "builtin" - | "commonjs" - | "commonjs-typescript" - | "json" - | "module" - | "module-typescript" - | "wasm"; - type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray; - /** - * The `initialize` hook provides a way to define a custom function that runs in - * the hooks thread when the hooks module is initialized. Initialization happens - * when the hooks module is registered via {@link register}. - * - * This hook can receive data from a {@link register} invocation, including - * ports and other transferable objects. The return value of `initialize` can be a - * `Promise`, in which case it will be awaited before the main application thread - * execution resumes. - */ - type InitializeHook = (data: Data) => void | Promise; - interface ResolveHookContext { - /** - * Export conditions of the relevant `package.json` - */ - conditions: string[]; - /** - * An object whose key-value pairs represent the assertions for the module to import - */ - importAttributes: ImportAttributes; - /** - * The module importing this one, or undefined if this is the Node.js entry point - */ - parentURL: string | undefined; - } - interface ResolveFnOutput { - /** - * A hint to the load hook (it might be ignored); can be an intermediary value. - */ - format?: string | null | undefined; - /** - * The import attributes to use when caching the module (optional; if excluded the input will be used) - */ - importAttributes?: ImportAttributes | undefined; - /** - * A signal that this hook intends to terminate the chain of `resolve` hooks. - * @default false - */ - shortCircuit?: boolean | undefined; - /** - * The absolute URL to which this input resolves - */ - url: string; - } - /** - * The `resolve` hook chain is responsible for telling Node.js where to find and - * how to cache a given `import` statement or expression, or `require` call. It can - * optionally return a format (such as `'module'`) as a hint to the `load` hook. If - * a format is specified, the `load` hook is ultimately responsible for providing - * the final `format` value (and it is free to ignore the hint provided by - * `resolve`); if `resolve` provides a `format`, a custom `load` hook is required - * even if only to pass the value to the Node.js default `load` hook. - */ - type ResolveHook = ( - specifier: string, - context: ResolveHookContext, - nextResolve: ( - specifier: string, - context?: Partial, - ) => ResolveFnOutput | Promise, - ) => ResolveFnOutput | Promise; - type ResolveHookSync = ( - specifier: string, - context: ResolveHookContext, - nextResolve: ( - specifier: string, - context?: Partial, - ) => ResolveFnOutput, - ) => ResolveFnOutput; - interface LoadHookContext { - /** - * Export conditions of the relevant `package.json` - */ - conditions: string[]; - /** - * The format optionally supplied by the `resolve` hook chain (can be an intermediary value). - */ - format: string | null | undefined; - /** - * An object whose key-value pairs represent the assertions for the module to import - */ - importAttributes: ImportAttributes; - } - interface LoadFnOutput { - format: string | null | undefined; - /** - * A signal that this hook intends to terminate the chain of `resolve` hooks. - * @default false - */ - shortCircuit?: boolean | undefined; - /** - * The source for Node.js to evaluate - */ - source?: ModuleSource | undefined; - } - /** - * The `load` hook provides a way to define a custom method of determining how a - * URL should be interpreted, retrieved, and parsed. It is also in charge of - * validating the import attributes. - */ - type LoadHook = ( - url: string, - context: LoadHookContext, - nextLoad: ( - url: string, - context?: Partial, - ) => LoadFnOutput | Promise, - ) => LoadFnOutput | Promise; - type LoadHookSync = ( - url: string, - context: LoadHookContext, - nextLoad: ( - url: string, - context?: Partial, - ) => LoadFnOutput, - ) => LoadFnOutput; - interface SourceMapsSupport { - /** - * If the source maps support is enabled - */ - enabled: boolean; - /** - * If the support is enabled for files in `node_modules`. - */ - nodeModules: boolean; - /** - * If the support is enabled for generated code from `eval` or `new Function`. - */ - generatedCode: boolean; - } - /** - * This method returns whether the [Source Map v3](https://tc39.es/ecma426/) support for stack - * traces is enabled. - * @since v22.14.0 - */ - function getSourceMapsSupport(): SourceMapsSupport; - /** - * `path` is the resolved path for the file for which a corresponding source map - * should be fetched. - * @since v13.7.0, v12.17.0 - * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise. - */ - function findSourceMap(path: string): SourceMap | undefined; - interface SetSourceMapsSupportOptions { - /** - * If enabling the support for files in `node_modules`. - * @default false - */ - nodeModules?: boolean | undefined; - /** - * If enabling the support for generated code from `eval` or `new Function`. - * @default false - */ - generatedCode?: boolean | undefined; - } - /** - * This function enables or disables the [Source Map v3](https://tc39.es/ecma426/) support for - * stack traces. - * - * It provides same features as launching Node.js process with commandline options - * `--enable-source-maps`, with additional options to alter the support for files - * in `node_modules` or generated codes. - * - * Only source maps in JavaScript files that are loaded after source maps has been - * enabled will be parsed and loaded. Preferably, use the commandline options - * `--enable-source-maps` to avoid losing track of source maps of modules loaded - * before this API call. - * @since v22.14.0 - */ - function setSourceMapsSupport(enabled: boolean, options?: SetSourceMapsSupportOptions): void; - interface SourceMapConstructorOptions { - /** - * @since v21.0.0, v20.5.0 - */ - lineLengths?: readonly number[] | undefined; - } - interface SourceMapPayload { - file: string; - version: number; - sources: string[]; - sourcesContent: string[]; - names: string[]; - mappings: string; - sourceRoot: string; - } - interface SourceMapping { - generatedLine: number; - generatedColumn: number; - originalSource: string; - originalLine: number; - originalColumn: number; - } - interface SourceOrigin { - /** - * The name of the range in the source map, if one was provided - */ - name: string | undefined; - /** - * The file name of the original source, as reported in the SourceMap - */ - fileName: string; - /** - * The 1-indexed lineNumber of the corresponding call site in the original source - */ - lineNumber: number; - /** - * The 1-indexed columnNumber of the corresponding call site in the original source - */ - columnNumber: number; - } - /** - * @since v13.7.0, v12.17.0 - */ - class SourceMap { - constructor(payload: SourceMapPayload, options?: SourceMapConstructorOptions); - /** - * Getter for the payload used to construct the `SourceMap` instance. - */ - readonly payload: SourceMapPayload; - /** - * Given a line offset and column offset in the generated source - * file, returns an object representing the SourceMap range in the - * original file if found, or an empty object if not. - * - * The object returned contains the following keys: - * - * The returned value represents the raw range as it appears in the - * SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and - * column numbers as they appear in Error messages and CallSite - * objects. - * - * To get the corresponding 1-indexed line and column numbers from a - * lineNumber and columnNumber as they are reported by Error stacks - * and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)` - * @param lineOffset The zero-indexed line number offset in the generated source - * @param columnOffset The zero-indexed column number offset in the generated source - */ - findEntry(lineOffset: number, columnOffset: number): SourceMapping | {}; - /** - * Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source, - * find the corresponding call site location in the original source. - * - * If the `lineNumber` and `columnNumber` provided are not found in any source map, - * then an empty object is returned. - * @param lineNumber The 1-indexed line number of the call site in the generated source - * @param columnNumber The 1-indexed column number of the call site in the generated source - */ - findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {}; - } - function runMain(main?: string): void; - function wrap(script: string): string; - } - global { - interface ImportMeta { - /** - * The directory name of the current module. - * - * This is the same as the `path.dirname()` of the `import.meta.filename`. - * - * > **Caveat**: only present on `file:` modules. - * @since v21.2.0, v20.11.0 - */ - dirname: string; - /** - * The full absolute path and filename of the current module, with - * symlinks resolved. - * - * This is the same as the `url.fileURLToPath()` of the `import.meta.url`. - * - * > **Caveat** only local modules support this property. Modules not using the - * > `file:` protocol will not provide it. - * @since v21.2.0, v20.11.0 - */ - filename: string; - /** - * The absolute `file:` URL of the module. - * - * This is defined exactly the same as it is in browsers providing the URL of the - * current module file. - * - * This enables useful patterns such as relative file loading: - * - * ```js - * import { readFileSync } from 'node:fs'; - * const buffer = readFileSync(new URL('./data.proto', import.meta.url)); - * ``` - */ - url: string; - /** - * `import.meta.resolve` is a module-relative resolution function scoped to - * each module, returning the URL string. - * - * ```js - * const dependencyAsset = import.meta.resolve('component-lib/asset.css'); - * // file:///app/node_modules/component-lib/asset.css - * import.meta.resolve('./dep.js'); - * // file:///app/dep.js - * ``` - * - * All features of the Node.js module resolution are supported. Dependency - * resolutions are subject to the permitted exports resolutions within the package. - * - * **Caveats**: - * - * * This can result in synchronous file-system operations, which - * can impact performance similarly to `require.resolve`. - * * This feature is not available within custom loaders (it would - * create a deadlock). - * @since v13.9.0, v12.16.0 - * @param specifier The module specifier to resolve relative to the - * current module. - * @param parent An optional absolute parent module URL to resolve from. - * **Default:** `import.meta.url` - * @returns The absolute URL string that the specifier would resolve to. - */ - resolve(specifier: string, parent?: string | URL): string; - /** - * `true` when the current module is the entry point of the current process; `false` otherwise. - * - * Equivalent to `require.main === module` in CommonJS. - * - * Analogous to Python's `__name__ == "__main__"`. - * - * ```js - * export function foo() { - * return 'Hello, world'; - * } - * - * function main() { - * const message = foo(); - * console.log(message); - * } - * - * if (import.meta.main) main(); - * // `foo` can be imported from another module without possible side-effects from `main` - * ``` - * @since v22.18.0 - * @experimental - */ - main: boolean; - } - namespace NodeJS { - interface Module { - /** - * The module objects required for the first time by this one. - * @since v0.1.16 - */ - children: Module[]; - /** - * The `module.exports` object is created by the `Module` system. Sometimes this is - * not acceptable; many want their module to be an instance of some class. To do - * this, assign the desired export object to `module.exports`. - * @since v0.1.16 - */ - exports: any; - /** - * The fully resolved filename of the module. - * @since v0.1.16 - */ - filename: string; - /** - * The identifier for the module. Typically this is the fully resolved - * filename. - * @since v0.1.16 - */ - id: string; - /** - * `true` if the module is running during the Node.js preload - * phase. - * @since v15.4.0, v14.17.0 - */ - isPreloading: boolean; - /** - * Whether or not the module is done loading, or is in the process of - * loading. - * @since v0.1.16 - */ - loaded: boolean; - /** - * The module that first required this one, or `null` if the current module is the - * entry point of the current process, or `undefined` if the module was loaded by - * something that is not a CommonJS module (e.g. REPL or `import`). - * @since v0.1.16 - * @deprecated Please use `require.main` and `module.children` instead. - */ - parent: Module | null | undefined; - /** - * The directory name of the module. This is usually the same as the - * `path.dirname()` of the `module.id`. - * @since v11.14.0 - */ - path: string; - /** - * The search paths for the module. - * @since v0.4.0 - */ - paths: string[]; - /** - * The `module.require()` method provides a way to load a module as if - * `require()` was called from the original module. - * @since v0.5.1 - */ - require(id: string): any; - } - interface Require { - /** - * Used to import modules, `JSON`, and local files. - * @since v0.1.13 - */ - (id: string): any; - /** - * Modules are cached in this object when they are required. By deleting a key - * value from this object, the next `require` will reload the module. - * This does not apply to - * [native addons](https://nodejs.org/docs/latest-v22.x/api/addons.html), - * for which reloading will result in an error. - * @since v0.3.0 - */ - cache: Dict; - /** - * Instruct `require` on how to handle certain file extensions. - * @since v0.3.0 - * @deprecated - */ - extensions: RequireExtensions; - /** - * The `Module` object representing the entry script loaded when the Node.js - * process launched, or `undefined` if the entry point of the program is not a - * CommonJS module. - * @since v0.1.17 - */ - main: Module | undefined; - /** - * @since v0.3.0 - */ - resolve: RequireResolve; - } - /** @deprecated */ - interface RequireExtensions extends Dict<(module: Module, filename: string) => any> { - ".js": (module: Module, filename: string) => any; - ".json": (module: Module, filename: string) => any; - ".node": (module: Module, filename: string) => any; - } - interface RequireResolveOptions { - /** - * Paths to resolve module location from. If present, these - * paths are used instead of the default resolution paths, with the exception - * of - * [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v22.x/api/modules.html#loading-from-the-global-folders) - * like `$HOME/.node_modules`, which are - * always included. Each of these paths is used as a starting point for - * the module resolution algorithm, meaning that the `node_modules` hierarchy - * is checked from this location. - * @since v8.9.0 - */ - paths?: string[] | undefined; - } - interface RequireResolve { - /** - * Use the internal `require()` machinery to look up the location of a module, - * but rather than loading the module, just return the resolved filename. - * - * If the module can not be found, a `MODULE_NOT_FOUND` error is thrown. - * @since v0.3.0 - * @param request The module path to resolve. - */ - (request: string, options?: RequireResolveOptions): string; - /** - * Returns an array containing the paths searched during resolution of `request` or - * `null` if the `request` string references a core module, for example `http` or - * `fs`. - * @since v8.9.0 - * @param request The module path whose lookup paths are being retrieved. - */ - paths(request: string): string[] | null; - } - } - /** - * The directory name of the current module. This is the same as the - * `path.dirname()` of the `__filename`. - * @since v0.1.27 - */ - var __dirname: string; - /** - * The file name of the current module. This is the current module file's absolute - * path with symlinks resolved. - * - * For a main program this is not necessarily the same as the file name used in the - * command line. - * @since v0.0.1 - */ - var __filename: string; - /** - * The `exports` variable is available within a module's file-level scope, and is - * assigned the value of `module.exports` before the module is evaluated. - * @since v0.1.16 - */ - var exports: NodeJS.Module["exports"]; - /** - * A reference to the current module. - * @since v0.1.16 - */ - var module: NodeJS.Module; - /** - * @since v0.1.13 - */ - var require: NodeJS.Require; - // Global-scope aliases for backwards compatibility with @types/node <13.0.x - /** @deprecated Use `NodeJS.Module` instead. */ - interface NodeModule extends NodeJS.Module {} - /** @deprecated Use `NodeJS.Require` instead. */ - interface NodeRequire extends NodeJS.Require {} - /** @deprecated Use `NodeJS.RequireResolve` instead. */ - interface RequireResolve extends NodeJS.RequireResolve {} - } - export = Module; -} -declare module "node:module" { - import module = require("module"); - export = module; -} diff --git a/node_modules/@types/node/net.d.ts b/node_modules/@types/node/net.d.ts deleted file mode 100644 index 41cc319..0000000 --- a/node_modules/@types/node/net.d.ts +++ /dev/null @@ -1,1076 +0,0 @@ -/** - * > Stability: 2 - Stable - * - * The `node:net` module provides an asynchronous network API for creating stream-based - * TCP or `IPC` servers ({@link createServer}) and clients - * ({@link createConnection}). - * - * It can be accessed using: - * - * ```js - * import net from 'node:net'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/net.js) - */ -declare module "net" { - import { NonSharedBuffer } from "node:buffer"; - import * as stream from "node:stream"; - import { Abortable, EventEmitter } from "node:events"; - import * as dns from "node:dns"; - type LookupFunction = ( - hostname: string, - options: dns.LookupOptions, - callback: (err: NodeJS.ErrnoException | null, address: string | dns.LookupAddress[], family?: number) => void, - ) => void; - interface AddressInfo { - address: string; - family: string; - port: number; - } - interface SocketConstructorOpts { - fd?: number | undefined; - allowHalfOpen?: boolean | undefined; - onread?: OnReadOpts | undefined; - readable?: boolean | undefined; - writable?: boolean | undefined; - signal?: AbortSignal | undefined; - } - interface OnReadOpts { - buffer: Uint8Array | (() => Uint8Array); - /** - * This function is called for every chunk of incoming data. - * Two arguments are passed to it: the number of bytes written to `buffer` and a reference to `buffer`. - * Return `false` from this function to implicitly `pause()` the socket. - */ - callback(bytesWritten: number, buffer: Uint8Array): boolean; - } - // TODO: remove empty ConnectOpts placeholder at next major @types/node version. - /** @deprecated */ - interface ConnectOpts {} - interface TcpSocketConnectOpts { - port: number; - host?: string | undefined; - localAddress?: string | undefined; - localPort?: number | undefined; - hints?: number | undefined; - family?: number | undefined; - lookup?: LookupFunction | undefined; - noDelay?: boolean | undefined; - keepAlive?: boolean | undefined; - keepAliveInitialDelay?: number | undefined; - /** - * @since v18.13.0 - */ - autoSelectFamily?: boolean | undefined; - /** - * @since v18.13.0 - */ - autoSelectFamilyAttemptTimeout?: number | undefined; - blockList?: BlockList | undefined; - } - interface IpcSocketConnectOpts { - path: string; - } - type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts; - type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed"; - /** - * This class is an abstraction of a TCP socket or a streaming `IPC` endpoint - * (uses named pipes on Windows, and Unix domain sockets otherwise). It is also - * an `EventEmitter`. - * - * A `net.Socket` can be created by the user and used directly to interact with - * a server. For example, it is returned by {@link createConnection}, - * so the user can use it to talk to the server. - * - * It can also be created by Node.js and passed to the user when a connection - * is received. For example, it is passed to the listeners of a `'connection'` event emitted on a {@link Server}, so the user can use - * it to interact with the client. - * @since v0.3.4 - */ - class Socket extends stream.Duplex { - constructor(options?: SocketConstructorOpts); - /** - * Destroys the socket after all data is written. If the `finish` event was already emitted the socket is destroyed immediately. - * If the socket is still writable it implicitly calls `socket.end()`. - * @since v0.3.4 - */ - destroySoon(): void; - /** - * Sends data on the socket. The second parameter specifies the encoding in the - * case of a string. It defaults to UTF8 encoding. - * - * Returns `true` if the entire data was flushed successfully to the kernel - * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is again free. - * - * The optional `callback` parameter will be executed when the data is finally - * written out, which may not be immediately. - * - * See `Writable` stream `write()` method for more - * information. - * @since v0.1.90 - */ - write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; - /** - * Sends data on the socket, with an explicit encoding for string data. - * @see {@link Socket.write} for full details. - * @since v0.1.90 - * @param [encoding='utf8'] Only used when data is `string`. - */ - write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean; - /** - * Initiate a connection on a given socket. - * - * Possible signatures: - * - * * `socket.connect(options[, connectListener])` - * * `socket.connect(path[, connectListener])` for `IPC` connections. - * * `socket.connect(port[, host][, connectListener])` for TCP connections. - * * Returns: `net.Socket` The socket itself. - * - * This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting, - * instead of a `'connect'` event, an `'error'` event will be emitted with - * the error passed to the `'error'` listener. - * The last parameter `connectListener`, if supplied, will be added as a listener - * for the `'connect'` event **once**. - * - * This function should only be used for reconnecting a socket after`'close'` has been emitted or otherwise it may lead to undefined - * behavior. - */ - connect(options: SocketConnectOpts, connectionListener?: () => void): this; - connect(port: number, host: string, connectionListener?: () => void): this; - connect(port: number, connectionListener?: () => void): this; - connect(path: string, connectionListener?: () => void): this; - /** - * Set the encoding for the socket as a `Readable Stream`. See `readable.setEncoding()` for more information. - * @since v0.1.90 - * @return The socket itself. - */ - setEncoding(encoding?: BufferEncoding): this; - /** - * Pauses the reading of data. That is, `'data'` events will not be emitted. - * Useful to throttle back an upload. - * @return The socket itself. - */ - pause(): this; - /** - * Close the TCP connection by sending an RST packet and destroy the stream. - * If this TCP socket is in connecting status, it will send an RST packet and destroy this TCP socket once it is connected. - * Otherwise, it will call `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. - * If this is not a TCP socket (for example, a pipe), calling this method will immediately throw an `ERR_INVALID_HANDLE_TYPE` Error. - * @since v18.3.0, v16.17.0 - */ - resetAndDestroy(): this; - /** - * Resumes reading after a call to `socket.pause()`. - * @return The socket itself. - */ - resume(): this; - /** - * Sets the socket to timeout after `timeout` milliseconds of inactivity on - * the socket. By default `net.Socket` do not have a timeout. - * - * When an idle timeout is triggered the socket will receive a `'timeout'` event but the connection will not be severed. The user must manually call `socket.end()` or `socket.destroy()` to - * end the connection. - * - * ```js - * socket.setTimeout(3000); - * socket.on('timeout', () => { - * console.log('socket timeout'); - * socket.end(); - * }); - * ``` - * - * If `timeout` is 0, then the existing idle timeout is disabled. - * - * The optional `callback` parameter will be added as a one-time listener for the `'timeout'` event. - * @since v0.1.90 - * @return The socket itself. - */ - setTimeout(timeout: number, callback?: () => void): this; - /** - * Enable/disable the use of Nagle's algorithm. - * - * When a TCP connection is created, it will have Nagle's algorithm enabled. - * - * Nagle's algorithm delays data before it is sent via the network. It attempts - * to optimize throughput at the expense of latency. - * - * Passing `true` for `noDelay` or not passing an argument will disable Nagle's - * algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's - * algorithm. - * @since v0.1.90 - * @param [noDelay=true] - * @return The socket itself. - */ - setNoDelay(noDelay?: boolean): this; - /** - * Enable/disable keep-alive functionality, and optionally set the initial - * delay before the first keepalive probe is sent on an idle socket. - * - * Set `initialDelay` (in milliseconds) to set the delay between the last - * data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default - * (or previous) setting. - * - * Enabling the keep-alive functionality will set the following socket options: - * - * * `SO_KEEPALIVE=1` - * * `TCP_KEEPIDLE=initialDelay` - * * `TCP_KEEPCNT=10` - * * `TCP_KEEPINTVL=1` - * @since v0.1.92 - * @param [enable=false] - * @param [initialDelay=0] - * @return The socket itself. - */ - setKeepAlive(enable?: boolean, initialDelay?: number): this; - /** - * Returns the bound `address`, the address `family` name and `port` of the - * socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` - * @since v0.1.90 - */ - address(): AddressInfo | {}; - /** - * Calling `unref()` on a socket will allow the program to exit if this is the only - * active socket in the event system. If the socket is already `unref`ed calling`unref()` again will have no effect. - * @since v0.9.1 - * @return The socket itself. - */ - unref(): this; - /** - * Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior). - * If the socket is `ref`ed calling `ref` again will have no effect. - * @since v0.9.1 - * @return The socket itself. - */ - ref(): this; - /** - * This property is only present if the family autoselection algorithm is enabled in `socket.connect(options)` - * and it is an array of the addresses that have been attempted. - * - * Each address is a string in the form of `$IP:$PORT`. - * If the connection was successful, then the last address is the one that the socket is currently connected to. - * @since v19.4.0 - */ - readonly autoSelectFamilyAttemptedAddresses: string[]; - /** - * This property shows the number of characters buffered for writing. The buffer - * may contain strings whose length after encoding is not yet known. So this number - * is only an approximation of the number of bytes in the buffer. - * - * `net.Socket` has the property that `socket.write()` always works. This is to - * help users get up and running quickly. The computer cannot always keep up - * with the amount of data that is written to a socket. The network connection - * simply might be too slow. Node.js will internally queue up the data written to a - * socket and send it out over the wire when it is possible. - * - * The consequence of this internal buffering is that memory may grow. - * Users who experience large or growing `bufferSize` should attempt to - * "throttle" the data flows in their program with `socket.pause()` and `socket.resume()`. - * @since v0.3.8 - * @deprecated Since v14.6.0 - Use `writableLength` instead. - */ - readonly bufferSize: number; - /** - * The amount of received bytes. - * @since v0.5.3 - */ - readonly bytesRead: number; - /** - * The amount of bytes sent. - * @since v0.5.3 - */ - readonly bytesWritten: number; - /** - * If `true`, `socket.connect(options[, connectListener])` was - * called and has not yet finished. It will stay `true` until the socket becomes - * connected, then it is set to `false` and the `'connect'` event is emitted. Note - * that the `socket.connect(options[, connectListener])` callback is a listener for the `'connect'` event. - * @since v6.1.0 - */ - readonly connecting: boolean; - /** - * This is `true` if the socket is not connected yet, either because `.connect()`has not yet been called or because it is still in the process of connecting - * (see `socket.connecting`). - * @since v11.2.0, v10.16.0 - */ - readonly pending: boolean; - /** - * See `writable.destroyed` for further details. - */ - readonly destroyed: boolean; - /** - * The string representation of the local IP address the remote client is - * connecting on. For example, in a server listening on `'0.0.0.0'`, if a client - * connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`. - * @since v0.9.6 - */ - readonly localAddress?: string; - /** - * The numeric representation of the local port. For example, `80` or `21`. - * @since v0.9.6 - */ - readonly localPort?: number; - /** - * The string representation of the local IP family. `'IPv4'` or `'IPv6'`. - * @since v18.8.0, v16.18.0 - */ - readonly localFamily?: string; - /** - * This property represents the state of the connection as a string. - * - * * If the stream is connecting `socket.readyState` is `opening`. - * * If the stream is readable and writable, it is `open`. - * * If the stream is readable and not writable, it is `readOnly`. - * * If the stream is not readable and writable, it is `writeOnly`. - * @since v0.5.0 - */ - readonly readyState: SocketReadyState; - /** - * The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if - * the socket is destroyed (for example, if the client disconnected). - * @since v0.5.10 - */ - readonly remoteAddress: string | undefined; - /** - * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if - * the socket is destroyed (for example, if the client disconnected). - * @since v0.11.14 - */ - readonly remoteFamily: string | undefined; - /** - * The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if - * the socket is destroyed (for example, if the client disconnected). - * @since v0.5.10 - */ - readonly remotePort: number | undefined; - /** - * The socket timeout in milliseconds as set by `socket.setTimeout()`. - * It is `undefined` if a timeout has not been set. - * @since v10.7.0 - */ - readonly timeout?: number; - /** - * Half-closes the socket. i.e., it sends a FIN packet. It is possible the - * server will still send some data. - * - * See `writable.end()` for further details. - * @since v0.1.90 - * @param callback Optional callback for when the socket is finished. - * @return The socket itself. - */ - end(callback?: () => void): this; - /** - * Half-closes the socket, with one final chunk of data. - * @see {@link Socket.end} for full details. - * @since v0.1.90 - * @param callback Optional callback for when the socket is finished. - * @return The socket itself. - */ - end(buffer: Uint8Array | string, callback?: () => void): this; - /** - * Half-closes the socket, with one final chunk of data. - * @see {@link Socket.end} for full details. - * @since v0.1.90 - * @param [encoding='utf8'] Only used when data is `string`. - * @param callback Optional callback for when the socket is finished. - * @return The socket itself. - */ - end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this; - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. connectionAttempt - * 4. connectionAttemptFailed - * 5. connectionAttemptTimeout - * 6. data - * 7. drain - * 8. end - * 9. error - * 10. lookup - * 11. ready - * 12. timeout - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (hadError: boolean) => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this; - addListener( - event: "connectionAttemptFailed", - listener: (ip: string, port: number, family: number, error: Error) => void, - ): this; - addListener( - event: "connectionAttemptTimeout", - listener: (ip: string, port: number, family: number) => void, - ): this; - addListener(event: "data", listener: (data: NonSharedBuffer) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "timeout", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", hadError: boolean): boolean; - emit(event: "connect"): boolean; - emit(event: "connectionAttempt", ip: string, port: number, family: number): boolean; - emit(event: "connectionAttemptFailed", ip: string, port: number, family: number, error: Error): boolean; - emit(event: "connectionAttemptTimeout", ip: string, port: number, family: number): boolean; - emit(event: "data", data: NonSharedBuffer): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean; - emit(event: "ready"): boolean; - emit(event: "timeout"): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (hadError: boolean) => void): this; - on(event: "connect", listener: () => void): this; - on(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this; - on( - event: "connectionAttemptFailed", - listener: (ip: string, port: number, family: number, error: Error) => void, - ): this; - on(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this; - on(event: "data", listener: (data: NonSharedBuffer) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - on(event: "ready", listener: () => void): this; - on(event: "timeout", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (hadError: boolean) => void): this; - once(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this; - once( - event: "connectionAttemptFailed", - listener: (ip: string, port: number, family: number, error: Error) => void, - ): this; - once(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this; - once(event: "connect", listener: () => void): this; - once(event: "data", listener: (data: NonSharedBuffer) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - once(event: "ready", listener: () => void): this; - once(event: "timeout", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (hadError: boolean) => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this; - prependListener( - event: "connectionAttemptFailed", - listener: (ip: string, port: number, family: number, error: Error) => void, - ): this; - prependListener( - event: "connectionAttemptTimeout", - listener: (ip: string, port: number, family: number) => void, - ): this; - prependListener(event: "data", listener: (data: NonSharedBuffer) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: (hadError: boolean) => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener( - event: "connectionAttempt", - listener: (ip: string, port: number, family: number) => void, - ): this; - prependOnceListener( - event: "connectionAttemptFailed", - listener: (ip: string, port: number, family: number, error: Error) => void, - ): this; - prependOnceListener( - event: "connectionAttemptTimeout", - listener: (ip: string, port: number, family: number) => void, - ): this; - prependOnceListener(event: "data", listener: (data: NonSharedBuffer) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - } - interface ListenOptions extends Abortable { - backlog?: number | undefined; - exclusive?: boolean | undefined; - host?: string | undefined; - /** - * @default false - */ - ipv6Only?: boolean | undefined; - reusePort?: boolean | undefined; - path?: string | undefined; - port?: number | undefined; - readableAll?: boolean | undefined; - writableAll?: boolean | undefined; - } - interface ServerOpts { - /** - * Indicates whether half-opened TCP connections are allowed. - * @default false - */ - allowHalfOpen?: boolean | undefined; - /** - * Indicates whether the socket should be paused on incoming connections. - * @default false - */ - pauseOnConnect?: boolean | undefined; - /** - * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. - * @default false - * @since v16.5.0 - */ - noDelay?: boolean | undefined; - /** - * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, - * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. - * @default false - * @since v16.5.0 - */ - keepAlive?: boolean | undefined; - /** - * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. - * @default 0 - * @since v16.5.0 - */ - keepAliveInitialDelay?: number | undefined; - /** - * Optionally overrides all `net.Socket`s' `readableHighWaterMark` and `writableHighWaterMark`. - * @default See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v22.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode). - * @since v18.17.0, v20.1.0 - */ - highWaterMark?: number | undefined; - /** - * `blockList` can be used for disabling inbound - * access to specific IP addresses, IP ranges, or IP subnets. This does not - * work if the server is behind a reverse proxy, NAT, etc. because the address - * checked against the block list is the address of the proxy, or the one - * specified by the NAT. - * @since v22.13.0 - */ - blockList?: BlockList | undefined; - } - interface DropArgument { - localAddress?: string; - localPort?: number; - localFamily?: string; - remoteAddress?: string; - remotePort?: number; - remoteFamily?: string; - } - /** - * This class is used to create a TCP or `IPC` server. - * @since v0.1.90 - */ - class Server extends EventEmitter { - constructor(connectionListener?: (socket: Socket) => void); - constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void); - /** - * Start a server listening for connections. A `net.Server` can be a TCP or - * an `IPC` server depending on what it listens to. - * - * Possible signatures: - * - * * `server.listen(handle[, backlog][, callback])` - * * `server.listen(options[, callback])` - * * `server.listen(path[, backlog][, callback])` for `IPC` servers - * * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers - * - * This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. The last parameter `callback`will be added as a listener for the `'listening'` - * event. - * - * All `listen()` methods can take a `backlog` parameter to specify the maximum - * length of the queue of pending connections. The actual length will be determined - * by the OS through sysctl settings such as `tcp_max_syn_backlog` and `somaxconn` on Linux. The default value of this parameter is 511 (not 512). - * - * All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for - * details). - * - * The `server.listen()` method can be called again if and only if there was an - * error during the first `server.listen()` call or `server.close()` has been - * called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown. - * - * One of the most common errors raised when listening is `EADDRINUSE`. - * This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry - * after a certain amount of time: - * - * ```js - * server.on('error', (e) => { - * if (e.code === 'EADDRINUSE') { - * console.error('Address in use, retrying...'); - * setTimeout(() => { - * server.close(); - * server.listen(PORT, HOST); - * }, 1000); - * } - * }); - * ``` - */ - listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, hostname?: string, listeningListener?: () => void): this; - listen(port?: number, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, listeningListener?: () => void): this; - listen(path: string, backlog?: number, listeningListener?: () => void): this; - listen(path: string, listeningListener?: () => void): this; - listen(options: ListenOptions, listeningListener?: () => void): this; - listen(handle: any, backlog?: number, listeningListener?: () => void): this; - listen(handle: any, listeningListener?: () => void): this; - /** - * Stops the server from accepting new connections and keeps existing - * connections. This function is asynchronous, the server is finally closed - * when all connections are ended and the server emits a `'close'` event. - * The optional `callback` will be called once the `'close'` event occurs. Unlike - * that event, it will be called with an `Error` as its only argument if the server - * was not open when it was closed. - * @since v0.1.90 - * @param callback Called when the server is closed. - */ - close(callback?: (err?: Error) => void): this; - /** - * Returns the bound `address`, the address `family` name, and `port` of the server - * as reported by the operating system if listening on an IP socket - * (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. - * - * For a server listening on a pipe or Unix domain socket, the name is returned - * as a string. - * - * ```js - * const server = net.createServer((socket) => { - * socket.end('goodbye\n'); - * }).on('error', (err) => { - * // Handle errors here. - * throw err; - * }); - * - * // Grab an arbitrary unused port. - * server.listen(() => { - * console.log('opened server on', server.address()); - * }); - * ``` - * - * `server.address()` returns `null` before the `'listening'` event has been - * emitted or after calling `server.close()`. - * @since v0.1.90 - */ - address(): AddressInfo | string | null; - /** - * Asynchronously get the number of concurrent connections on the server. Works - * when sockets were sent to forks. - * - * Callback should take two arguments `err` and `count`. - * @since v0.9.7 - */ - getConnections(cb: (error: Error | null, count: number) => void): this; - /** - * Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior). - * If the server is `ref`ed calling `ref()` again will have no effect. - * @since v0.9.1 - */ - ref(): this; - /** - * Calling `unref()` on a server will allow the program to exit if this is the only - * active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect. - * @since v0.9.1 - */ - unref(): this; - /** - * Set this property to reject connections when the server's connection count gets - * high. - * - * It is not recommended to use this option once a socket has been sent to a child - * with `child_process.fork()`. - * @since v0.2.0 - */ - maxConnections: number; - connections: number; - /** - * Indicates whether or not the server is listening for connections. - * @since v5.7.0 - */ - readonly listening: boolean; - /** - * events.EventEmitter - * 1. close - * 2. connection - * 3. error - * 4. listening - * 5. drop - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Socket) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "drop", listener: (data?: DropArgument) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Socket): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit(event: "drop", data?: DropArgument): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Socket) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "drop", listener: (data?: DropArgument) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Socket) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "drop", listener: (data?: DropArgument) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Socket) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "drop", listener: (data?: DropArgument) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "drop", listener: (data?: DropArgument) => void): this; - /** - * Calls {@link Server.close()} and returns a promise that fulfills when the server has closed. - * @since v20.5.0 - */ - [Symbol.asyncDispose](): Promise; - } - type IPVersion = "ipv4" | "ipv6"; - /** - * The `BlockList` object can be used with some network APIs to specify rules for - * disabling inbound or outbound access to specific IP addresses, IP ranges, or - * IP subnets. - * @since v15.0.0, v14.18.0 - */ - class BlockList { - /** - * Adds a rule to block the given IP address. - * @since v15.0.0, v14.18.0 - * @param address An IPv4 or IPv6 address. - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - addAddress(address: string, type?: IPVersion): void; - addAddress(address: SocketAddress): void; - /** - * Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive). - * @since v15.0.0, v14.18.0 - * @param start The starting IPv4 or IPv6 address in the range. - * @param end The ending IPv4 or IPv6 address in the range. - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - addRange(start: string, end: string, type?: IPVersion): void; - addRange(start: SocketAddress, end: SocketAddress): void; - /** - * Adds a rule to block a range of IP addresses specified as a subnet mask. - * @since v15.0.0, v14.18.0 - * @param net The network IPv4 or IPv6 address. - * @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`. - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - addSubnet(net: SocketAddress, prefix: number): void; - addSubnet(net: string, prefix: number, type?: IPVersion): void; - /** - * Returns `true` if the given IP address matches any of the rules added to the`BlockList`. - * - * ```js - * const blockList = new net.BlockList(); - * blockList.addAddress('123.123.123.123'); - * blockList.addRange('10.0.0.1', '10.0.0.10'); - * blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6'); - * - * console.log(blockList.check('123.123.123.123')); // Prints: true - * console.log(blockList.check('10.0.0.3')); // Prints: true - * console.log(blockList.check('222.111.111.222')); // Prints: false - * - * // IPv6 notation for IPv4 addresses works: - * console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true - * console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true - * ``` - * @since v15.0.0, v14.18.0 - * @param address The IP address to check - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - check(address: SocketAddress): boolean; - check(address: string, type?: IPVersion): boolean; - /** - * The list of rules added to the blocklist. - * @since v15.0.0, v14.18.0 - */ - rules: readonly string[]; - /** - * Returns `true` if the `value` is a `net.BlockList`. - * @since v22.13.0 - * @param value Any JS value - */ - static isBlockList(value: unknown): value is BlockList; - /** - * ```js - * const blockList = new net.BlockList(); - * const data = [ - * 'Subnet: IPv4 192.168.1.0/24', - * 'Address: IPv4 10.0.0.5', - * 'Range: IPv4 192.168.2.1-192.168.2.10', - * 'Range: IPv4 10.0.0.1-10.0.0.10', - * ]; - * blockList.fromJSON(data); - * blockList.fromJSON(JSON.stringify(data)); - * ``` - * @since v22.19.0 - * @experimental - */ - fromJSON(data: string | readonly string[]): void; - /** - * @since v22.19.0 - * @experimental - */ - toJSON(): readonly string[]; - } - interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts { - timeout?: number | undefined; - } - interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts { - timeout?: number | undefined; - } - type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts; - /** - * Creates a new TCP or `IPC` server. - * - * If `allowHalfOpen` is set to `true`, when the other end of the socket - * signals the end of transmission, the server will only send back the end of - * transmission when `socket.end()` is explicitly called. For example, in the - * context of TCP, when a FIN packed is received, a FIN packed is sent - * back only when `socket.end()` is explicitly called. Until then the - * connection is half-closed (non-readable but still writable). See `'end'` event and [RFC 1122](https://tools.ietf.org/html/rfc1122) (section 4.2.2.13) for more information. - * - * If `pauseOnConnect` is set to `true`, then the socket associated with each - * incoming connection will be paused, and no data will be read from its handle. - * This allows connections to be passed between processes without any data being - * read by the original process. To begin reading data from a paused socket, call `socket.resume()`. - * - * The server can be a TCP server or an `IPC` server, depending on what it `listen()` to. - * - * Here is an example of a TCP echo server which listens for connections - * on port 8124: - * - * ```js - * import net from 'node:net'; - * const server = net.createServer((c) => { - * // 'connection' listener. - * console.log('client connected'); - * c.on('end', () => { - * console.log('client disconnected'); - * }); - * c.write('hello\r\n'); - * c.pipe(c); - * }); - * server.on('error', (err) => { - * throw err; - * }); - * server.listen(8124, () => { - * console.log('server bound'); - * }); - * ``` - * - * Test this by using `telnet`: - * - * ```bash - * telnet localhost 8124 - * ``` - * - * To listen on the socket `/tmp/echo.sock`: - * - * ```js - * server.listen('/tmp/echo.sock', () => { - * console.log('server bound'); - * }); - * ``` - * - * Use `nc` to connect to a Unix domain socket server: - * - * ```bash - * nc -U /tmp/echo.sock - * ``` - * @since v0.5.0 - * @param connectionListener Automatically set as a listener for the {@link 'connection'} event. - */ - function createServer(connectionListener?: (socket: Socket) => void): Server; - function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server; - /** - * Aliases to {@link createConnection}. - * - * Possible signatures: - * - * * {@link connect} - * * {@link connect} for `IPC` connections. - * * {@link connect} for TCP connections. - */ - function connect(options: NetConnectOpts, connectionListener?: () => void): Socket; - function connect(port: number, host?: string, connectionListener?: () => void): Socket; - function connect(path: string, connectionListener?: () => void): Socket; - /** - * A factory function, which creates a new {@link Socket}, - * immediately initiates connection with `socket.connect()`, - * then returns the `net.Socket` that starts the connection. - * - * When the connection is established, a `'connect'` event will be emitted - * on the returned socket. The last parameter `connectListener`, if supplied, - * will be added as a listener for the `'connect'` event **once**. - * - * Possible signatures: - * - * * {@link createConnection} - * * {@link createConnection} for `IPC` connections. - * * {@link createConnection} for TCP connections. - * - * The {@link connect} function is an alias to this function. - */ - function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket; - function createConnection(port: number, host?: string, connectionListener?: () => void): Socket; - function createConnection(path: string, connectionListener?: () => void): Socket; - /** - * Gets the current default value of the `autoSelectFamily` option of `socket.connect(options)`. - * The initial default value is `true`, unless the command line option`--no-network-family-autoselection` is provided. - * @since v19.4.0 - */ - function getDefaultAutoSelectFamily(): boolean; - /** - * Sets the default value of the `autoSelectFamily` option of `socket.connect(options)`. - * @param value The new default value. - * The initial default value is `true`, unless the command line option - * `--no-network-family-autoselection` is provided. - * @since v19.4.0 - */ - function setDefaultAutoSelectFamily(value: boolean): void; - /** - * Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`. - * The initial default value is `250` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`. - * @returns The current default value of the `autoSelectFamilyAttemptTimeout` option. - * @since v19.8.0, v18.8.0 - */ - function getDefaultAutoSelectFamilyAttemptTimeout(): number; - /** - * Sets the default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`. - * @param value The new default value, which must be a positive number. If the number is less than `10`, the value `10` is used instead. The initial default value is `250` or the value specified via the command line - * option `--network-family-autoselection-attempt-timeout`. - * @since v19.8.0, v18.8.0 - */ - function setDefaultAutoSelectFamilyAttemptTimeout(value: number): void; - /** - * Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4 - * address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`. - * - * ```js - * net.isIP('::1'); // returns 6 - * net.isIP('127.0.0.1'); // returns 4 - * net.isIP('127.000.000.001'); // returns 0 - * net.isIP('127.0.0.1/24'); // returns 0 - * net.isIP('fhqwhgads'); // returns 0 - * ``` - * @since v0.3.0 - */ - function isIP(input: string): number; - /** - * Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no - * leading zeroes. Otherwise, returns `false`. - * - * ```js - * net.isIPv4('127.0.0.1'); // returns true - * net.isIPv4('127.000.000.001'); // returns false - * net.isIPv4('127.0.0.1/24'); // returns false - * net.isIPv4('fhqwhgads'); // returns false - * ``` - * @since v0.3.0 - */ - function isIPv4(input: string): boolean; - /** - * Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`. - * - * ```js - * net.isIPv6('::1'); // returns true - * net.isIPv6('fhqwhgads'); // returns false - * ``` - * @since v0.3.0 - */ - function isIPv6(input: string): boolean; - interface SocketAddressInitOptions { - /** - * The network address as either an IPv4 or IPv6 string. - * @default 127.0.0.1 - */ - address?: string | undefined; - /** - * @default `'ipv4'` - */ - family?: IPVersion | undefined; - /** - * An IPv6 flow-label used only if `family` is `'ipv6'`. - * @default 0 - */ - flowlabel?: number | undefined; - /** - * An IP port. - * @default 0 - */ - port?: number | undefined; - } - /** - * @since v15.14.0, v14.18.0 - */ - class SocketAddress { - constructor(options: SocketAddressInitOptions); - /** - * Either \`'ipv4'\` or \`'ipv6'\`. - * @since v15.14.0, v14.18.0 - */ - readonly address: string; - /** - * Either \`'ipv4'\` or \`'ipv6'\`. - * @since v15.14.0, v14.18.0 - */ - readonly family: IPVersion; - /** - * @since v15.14.0, v14.18.0 - */ - readonly port: number; - /** - * @since v15.14.0, v14.18.0 - */ - readonly flowlabel: number; - /** - * @since v22.13.0 - * @param input An input string containing an IP address and optional port, - * e.g. `123.1.2.3:1234` or `[1::1]:1234`. - * @returns Returns a `SocketAddress` if parsing was successful. - * Otherwise returns `undefined`. - */ - static parse(input: string): SocketAddress | undefined; - } -} -declare module "node:net" { - export * from "net"; -} diff --git a/node_modules/@types/node/os.d.ts b/node_modules/@types/node/os.d.ts deleted file mode 100644 index a40bd77..0000000 --- a/node_modules/@types/node/os.d.ts +++ /dev/null @@ -1,506 +0,0 @@ -/** - * The `node:os` module provides operating system-related utility methods and - * properties. It can be accessed using: - * - * ```js - * import os from 'node:os'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/os.js) - */ -declare module "os" { - import { NonSharedBuffer } from "buffer"; - interface CpuInfo { - model: string; - speed: number; - times: { - /** The number of milliseconds the CPU has spent in user mode. */ - user: number; - /** The number of milliseconds the CPU has spent in nice mode. */ - nice: number; - /** The number of milliseconds the CPU has spent in sys mode. */ - sys: number; - /** The number of milliseconds the CPU has spent in idle mode. */ - idle: number; - /** The number of milliseconds the CPU has spent in irq mode. */ - irq: number; - }; - } - interface NetworkInterfaceBase { - address: string; - netmask: string; - mac: string; - internal: boolean; - cidr: string | null; - scopeid?: number; - } - interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase { - family: "IPv4"; - } - interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase { - family: "IPv6"; - scopeid: number; - } - interface UserInfo { - username: T; - uid: number; - gid: number; - shell: T | null; - homedir: T; - } - type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6; - /** - * Returns the host name of the operating system as a string. - * @since v0.3.3 - */ - function hostname(): string; - /** - * Returns an array containing the 1, 5, and 15 minute load averages. - * - * The load average is a measure of system activity calculated by the operating - * system and expressed as a fractional number. - * - * The load average is a Unix-specific concept. On Windows, the return value is - * always `[0, 0, 0]`. - * @since v0.3.3 - */ - function loadavg(): number[]; - /** - * Returns the system uptime in number of seconds. - * @since v0.3.3 - */ - function uptime(): number; - /** - * Returns the amount of free system memory in bytes as an integer. - * @since v0.3.3 - */ - function freemem(): number; - /** - * Returns the total amount of system memory in bytes as an integer. - * @since v0.3.3 - */ - function totalmem(): number; - /** - * Returns an array of objects containing information about each logical CPU core. - * The array will be empty if no CPU information is available, such as if the `/proc` file system is unavailable. - * - * The properties included on each object include: - * - * ```js - * [ - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 252020, - * nice: 0, - * sys: 30340, - * idle: 1070356870, - * irq: 0, - * }, - * }, - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 306960, - * nice: 0, - * sys: 26980, - * idle: 1071569080, - * irq: 0, - * }, - * }, - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 248450, - * nice: 0, - * sys: 21750, - * idle: 1070919370, - * irq: 0, - * }, - * }, - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 256880, - * nice: 0, - * sys: 19430, - * idle: 1070905480, - * irq: 20, - * }, - * }, - * ] - * ``` - * - * `nice` values are POSIX-only. On Windows, the `nice` values of all processors - * are always 0. - * - * `os.cpus().length` should not be used to calculate the amount of parallelism - * available to an application. Use {@link availableParallelism} for this purpose. - * @since v0.3.3 - */ - function cpus(): CpuInfo[]; - /** - * Returns an estimate of the default amount of parallelism a program should use. - * Always returns a value greater than zero. - * - * This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism). - * @since v19.4.0, v18.14.0 - */ - function availableParallelism(): number; - /** - * Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it - * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows. - * - * See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information - * about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems. - * @since v0.3.3 - */ - function type(): string; - /** - * Returns the operating system as a string. - * - * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used. See - * [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. - * @since v0.3.3 - */ - function release(): string; - /** - * Returns an object containing network interfaces that have been assigned a - * network address. - * - * Each key on the returned object identifies a network interface. The associated - * value is an array of objects that each describe an assigned network address. - * - * The properties available on the assigned network address object include: - * - * ```js - * { - * lo: [ - * { - * address: '127.0.0.1', - * netmask: '255.0.0.0', - * family: 'IPv4', - * mac: '00:00:00:00:00:00', - * internal: true, - * cidr: '127.0.0.1/8' - * }, - * { - * address: '::1', - * netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', - * family: 'IPv6', - * mac: '00:00:00:00:00:00', - * scopeid: 0, - * internal: true, - * cidr: '::1/128' - * } - * ], - * eth0: [ - * { - * address: '192.168.1.108', - * netmask: '255.255.255.0', - * family: 'IPv4', - * mac: '01:02:03:0a:0b:0c', - * internal: false, - * cidr: '192.168.1.108/24' - * }, - * { - * address: 'fe80::a00:27ff:fe4e:66a1', - * netmask: 'ffff:ffff:ffff:ffff::', - * family: 'IPv6', - * mac: '01:02:03:0a:0b:0c', - * scopeid: 1, - * internal: false, - * cidr: 'fe80::a00:27ff:fe4e:66a1/64' - * } - * ] - * } - * ``` - * @since v0.6.0 - */ - function networkInterfaces(): NodeJS.Dict; - /** - * Returns the string path of the current user's home directory. - * - * On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it - * uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory. - * - * On Windows, it uses the `USERPROFILE` environment variable if defined. - * Otherwise it uses the path to the profile directory of the current user. - * @since v2.3.0 - */ - function homedir(): string; - interface UserInfoOptions { - encoding?: BufferEncoding | "buffer" | undefined; - } - interface UserInfoOptionsWithBufferEncoding extends UserInfoOptions { - encoding: "buffer"; - } - interface UserInfoOptionsWithStringEncoding extends UserInfoOptions { - encoding?: BufferEncoding | undefined; - } - /** - * Returns information about the currently effective user. On POSIX platforms, - * this is typically a subset of the password file. The returned object includes - * the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and `gid` fields are `-1`, and `shell` is `null`. - * - * The value of `homedir` returned by `os.userInfo()` is provided by the operating - * system. This differs from the result of `os.homedir()`, which queries - * environment variables for the home directory before falling back to the - * operating system response. - * - * Throws a [`SystemError`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`. - * @since v6.0.0 - */ - function userInfo(options?: UserInfoOptionsWithStringEncoding): UserInfo; - function userInfo(options: UserInfoOptionsWithBufferEncoding): UserInfo; - function userInfo(options: UserInfoOptions): UserInfo; - type SignalConstants = { - [key in NodeJS.Signals]: number; - }; - namespace constants { - const UV_UDP_REUSEADDR: number; - namespace signals {} - const signals: SignalConstants; - namespace errno { - const E2BIG: number; - const EACCES: number; - const EADDRINUSE: number; - const EADDRNOTAVAIL: number; - const EAFNOSUPPORT: number; - const EAGAIN: number; - const EALREADY: number; - const EBADF: number; - const EBADMSG: number; - const EBUSY: number; - const ECANCELED: number; - const ECHILD: number; - const ECONNABORTED: number; - const ECONNREFUSED: number; - const ECONNRESET: number; - const EDEADLK: number; - const EDESTADDRREQ: number; - const EDOM: number; - const EDQUOT: number; - const EEXIST: number; - const EFAULT: number; - const EFBIG: number; - const EHOSTUNREACH: number; - const EIDRM: number; - const EILSEQ: number; - const EINPROGRESS: number; - const EINTR: number; - const EINVAL: number; - const EIO: number; - const EISCONN: number; - const EISDIR: number; - const ELOOP: number; - const EMFILE: number; - const EMLINK: number; - const EMSGSIZE: number; - const EMULTIHOP: number; - const ENAMETOOLONG: number; - const ENETDOWN: number; - const ENETRESET: number; - const ENETUNREACH: number; - const ENFILE: number; - const ENOBUFS: number; - const ENODATA: number; - const ENODEV: number; - const ENOENT: number; - const ENOEXEC: number; - const ENOLCK: number; - const ENOLINK: number; - const ENOMEM: number; - const ENOMSG: number; - const ENOPROTOOPT: number; - const ENOSPC: number; - const ENOSR: number; - const ENOSTR: number; - const ENOSYS: number; - const ENOTCONN: number; - const ENOTDIR: number; - const ENOTEMPTY: number; - const ENOTSOCK: number; - const ENOTSUP: number; - const ENOTTY: number; - const ENXIO: number; - const EOPNOTSUPP: number; - const EOVERFLOW: number; - const EPERM: number; - const EPIPE: number; - const EPROTO: number; - const EPROTONOSUPPORT: number; - const EPROTOTYPE: number; - const ERANGE: number; - const EROFS: number; - const ESPIPE: number; - const ESRCH: number; - const ESTALE: number; - const ETIME: number; - const ETIMEDOUT: number; - const ETXTBSY: number; - const EWOULDBLOCK: number; - const EXDEV: number; - const WSAEINTR: number; - const WSAEBADF: number; - const WSAEACCES: number; - const WSAEFAULT: number; - const WSAEINVAL: number; - const WSAEMFILE: number; - const WSAEWOULDBLOCK: number; - const WSAEINPROGRESS: number; - const WSAEALREADY: number; - const WSAENOTSOCK: number; - const WSAEDESTADDRREQ: number; - const WSAEMSGSIZE: number; - const WSAEPROTOTYPE: number; - const WSAENOPROTOOPT: number; - const WSAEPROTONOSUPPORT: number; - const WSAESOCKTNOSUPPORT: number; - const WSAEOPNOTSUPP: number; - const WSAEPFNOSUPPORT: number; - const WSAEAFNOSUPPORT: number; - const WSAEADDRINUSE: number; - const WSAEADDRNOTAVAIL: number; - const WSAENETDOWN: number; - const WSAENETUNREACH: number; - const WSAENETRESET: number; - const WSAECONNABORTED: number; - const WSAECONNRESET: number; - const WSAENOBUFS: number; - const WSAEISCONN: number; - const WSAENOTCONN: number; - const WSAESHUTDOWN: number; - const WSAETOOMANYREFS: number; - const WSAETIMEDOUT: number; - const WSAECONNREFUSED: number; - const WSAELOOP: number; - const WSAENAMETOOLONG: number; - const WSAEHOSTDOWN: number; - const WSAEHOSTUNREACH: number; - const WSAENOTEMPTY: number; - const WSAEPROCLIM: number; - const WSAEUSERS: number; - const WSAEDQUOT: number; - const WSAESTALE: number; - const WSAEREMOTE: number; - const WSASYSNOTREADY: number; - const WSAVERNOTSUPPORTED: number; - const WSANOTINITIALISED: number; - const WSAEDISCON: number; - const WSAENOMORE: number; - const WSAECANCELLED: number; - const WSAEINVALIDPROCTABLE: number; - const WSAEINVALIDPROVIDER: number; - const WSAEPROVIDERFAILEDINIT: number; - const WSASYSCALLFAILURE: number; - const WSASERVICE_NOT_FOUND: number; - const WSATYPE_NOT_FOUND: number; - const WSA_E_NO_MORE: number; - const WSA_E_CANCELLED: number; - const WSAEREFUSED: number; - } - namespace dlopen { - const RTLD_LAZY: number; - const RTLD_NOW: number; - const RTLD_GLOBAL: number; - const RTLD_LOCAL: number; - const RTLD_DEEPBIND: number; - } - namespace priority { - const PRIORITY_LOW: number; - const PRIORITY_BELOW_NORMAL: number; - const PRIORITY_NORMAL: number; - const PRIORITY_ABOVE_NORMAL: number; - const PRIORITY_HIGH: number; - const PRIORITY_HIGHEST: number; - } - } - const devNull: string; - /** - * The operating system-specific end-of-line marker. - * * `\n` on POSIX - * * `\r\n` on Windows - */ - const EOL: string; - /** - * Returns the operating system CPU architecture for which the Node.js binary was - * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, - * and `'x64'`. - * - * The return value is equivalent to [process.arch](https://nodejs.org/docs/latest-v22.x/api/process.html#processarch). - * @since v0.5.0 - */ - function arch(): string; - /** - * Returns a string identifying the kernel version. - * - * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not - * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. - * @since v13.11.0, v12.17.0 - */ - function version(): string; - /** - * Returns a string identifying the operating system platform for which - * the Node.js binary was compiled. The value is set at compile time. - * Possible values are `'aix'`, `'darwin'`, `'freebsd'`, `'linux'`, `'openbsd'`, `'sunos'`, and `'win32'`. - * - * The return value is equivalent to `process.platform`. - * - * The value `'android'` may also be returned if Node.js is built on the Android - * operating system. [Android support is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). - * @since v0.5.0 - */ - function platform(): NodeJS.Platform; - /** - * Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`, `mips`, `mips64`, `ppc64`, `ppc64le`, `s390`, `s390x`, `i386`, `i686`, `x86_64`. - * - * On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not - * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. - * @since v18.9.0, v16.18.0 - */ - function machine(): string; - /** - * Returns the operating system's default directory for temporary files as a - * string. - * @since v0.9.9 - */ - function tmpdir(): string; - /** - * Returns a string identifying the endianness of the CPU for which the Node.js - * binary was compiled. - * - * Possible values are `'BE'` for big endian and `'LE'` for little endian. - * @since v0.9.4 - */ - function endianness(): "BE" | "LE"; - /** - * Returns the scheduling priority for the process specified by `pid`. If `pid` is - * not provided or is `0`, the priority of the current process is returned. - * @since v10.10.0 - * @param [pid=0] The process ID to retrieve scheduling priority for. - */ - function getPriority(pid?: number): number; - /** - * Attempts to set the scheduling priority for the process specified by `pid`. If `pid` is not provided or is `0`, the process ID of the current process is used. - * - * The `priority` input must be an integer between `-20` (high priority) and `19` (low priority). Due to differences between Unix priority levels and Windows - * priority classes, `priority` is mapped to one of six priority constants in `os.constants.priority`. When retrieving a process priority level, this range - * mapping may cause the return value to be slightly different on Windows. To avoid - * confusion, set `priority` to one of the priority constants. - * - * On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user - * privileges. Otherwise the set priority will be silently reduced to `PRIORITY_HIGH`. - * @since v10.10.0 - * @param [pid=0] The process ID to set scheduling priority for. - * @param priority The scheduling priority to assign to the process. - */ - function setPriority(priority: number): void; - function setPriority(pid: number, priority: number): void; -} -declare module "node:os" { - export * from "os"; -} diff --git a/node_modules/@types/node/package.json b/node_modules/@types/node/package.json deleted file mode 100644 index 56b0e12..0000000 --- a/node_modules/@types/node/package.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "name": "@types/node", - "version": "22.19.21", - "description": "TypeScript definitions for node", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", - "license": "MIT", - "contributors": [ - { - "name": "Microsoft TypeScript", - "githubUsername": "Microsoft", - "url": "https://github.com/Microsoft" - }, - { - "name": "Alberto Schiabel", - "githubUsername": "jkomyno", - "url": "https://github.com/jkomyno" - }, - { - "name": "Andrew Makarov", - "githubUsername": "r3nya", - "url": "https://github.com/r3nya" - }, - { - "name": "Benjamin Toueg", - "githubUsername": "btoueg", - "url": "https://github.com/btoueg" - }, - { - "name": "David Junger", - "githubUsername": "touffy", - "url": "https://github.com/touffy" - }, - { - "name": "Mohsen Azimi", - "githubUsername": "mohsen1", - "url": "https://github.com/mohsen1" - }, - { - "name": "Nikita Galkin", - "githubUsername": "galkin", - "url": "https://github.com/galkin" - }, - { - "name": "Sebastian Silbermann", - "githubUsername": "eps1lon", - "url": "https://github.com/eps1lon" - }, - { - "name": "Wilco Bakker", - "githubUsername": "WilcoBakker", - "url": "https://github.com/WilcoBakker" - }, - { - "name": "Marcin Kopacz", - "githubUsername": "chyzwar", - "url": "https://github.com/chyzwar" - }, - { - "name": "Trivikram Kamat", - "githubUsername": "trivikr", - "url": "https://github.com/trivikr" - }, - { - "name": "Junxiao Shi", - "githubUsername": "yoursunny", - "url": "https://github.com/yoursunny" - }, - { - "name": "Ilia Baryshnikov", - "githubUsername": "qwelias", - "url": "https://github.com/qwelias" - }, - { - "name": "ExE Boss", - "githubUsername": "ExE-Boss", - "url": "https://github.com/ExE-Boss" - }, - { - "name": "Piotr Błażejewicz", - "githubUsername": "peterblazejewicz", - "url": "https://github.com/peterblazejewicz" - }, - { - "name": "Anna Henningsen", - "githubUsername": "addaleax", - "url": "https://github.com/addaleax" - }, - { - "name": "Victor Perin", - "githubUsername": "victorperin", - "url": "https://github.com/victorperin" - }, - { - "name": "NodeJS Contributors", - "githubUsername": "NodeJS", - "url": "https://github.com/NodeJS" - }, - { - "name": "Linus Unnebäck", - "githubUsername": "LinusU", - "url": "https://github.com/LinusU" - }, - { - "name": "wafuwafu13", - "githubUsername": "wafuwafu13", - "url": "https://github.com/wafuwafu13" - }, - { - "name": "Matteo Collina", - "githubUsername": "mcollina", - "url": "https://github.com/mcollina" - }, - { - "name": "Dmitry Semigradsky", - "githubUsername": "Semigradsky", - "url": "https://github.com/Semigradsky" - }, - { - "name": "René", - "githubUsername": "Renegade334", - "url": "https://github.com/Renegade334" - } - ], - "main": "", - "types": "index.d.ts", - "typesVersions": { - "<=5.6": { - "*": [ - "ts5.6/*" - ] - } - }, - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/node" - }, - "scripts": {}, - "dependencies": { - "undici-types": "~6.21.0" - }, - "peerDependencies": {}, - "typesPublisherContentHash": "8e6c9feae0854a50279bbba2bfb172f6753303bc233e7b0526dcb589b43e4c9e", - "typeScriptVersion": "5.3" -} \ No newline at end of file diff --git a/node_modules/@types/node/path.d.ts b/node_modules/@types/node/path.d.ts deleted file mode 100644 index b83d8f5..0000000 --- a/node_modules/@types/node/path.d.ts +++ /dev/null @@ -1,200 +0,0 @@ -declare module "path/posix" { - import path = require("path"); - export = path; -} -declare module "path/win32" { - import path = require("path"); - export = path; -} -/** - * The `node:path` module provides utilities for working with file and directory - * paths. It can be accessed using: - * - * ```js - * import path from 'node:path'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/path.js) - */ -declare module "path" { - namespace path { - /** - * A parsed path object generated by path.parse() or consumed by path.format(). - */ - interface ParsedPath { - /** - * The root of the path such as '/' or 'c:\' - */ - root: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base: string; - /** - * The file extension (if any) such as '.html' - */ - ext: string; - /** - * The file name without extension (if any) such as 'index' - */ - name: string; - } - interface FormatInputPathObject { - /** - * The root of the path such as '/' or 'c:\' - */ - root?: string | undefined; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir?: string | undefined; - /** - * The file name including extension (if any) such as 'index.html' - */ - base?: string | undefined; - /** - * The file extension (if any) such as '.html' - */ - ext?: string | undefined; - /** - * The file name without extension (if any) such as 'index' - */ - name?: string | undefined; - } - interface PlatformPath { - /** - * Normalize a string path, reducing '..' and '.' parts. - * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. If the path is a zero-length string, '.' is returned, representing the current working directory. - * - * @param path string path to normalize. - * @throws {TypeError} if `path` is not a string. - */ - normalize(path: string): string; - /** - * Join all arguments together and normalize the resulting path. - * - * @param paths paths to join. - * @throws {TypeError} if any of the path segments is not a string. - */ - join(...paths: string[]): string; - /** - * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. - * - * Starting from leftmost {from} parameter, resolves {to} to an absolute path. - * - * If {to} isn't already absolute, {from} arguments are prepended in right to left order, - * until an absolute path is found. If after using all {from} paths still no absolute path is found, - * the current working directory is used as well. The resulting path is normalized, - * and trailing slashes are removed unless the path gets resolved to the root directory. - * - * @param paths A sequence of paths or path segments. - * @throws {TypeError} if any of the arguments is not a string. - */ - resolve(...paths: string[]): string; - /** - * The `path.matchesGlob()` method determines if `path` matches the `pattern`. - * @param path The path to glob-match against. - * @param pattern The glob to check the path against. - * @returns Whether or not the `path` matched the `pattern`. - * @throws {TypeError} if `path` or `pattern` are not strings. - * @since v22.5.0 - */ - matchesGlob(path: string, pattern: string): boolean; - /** - * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. - * - * If the given {path} is a zero-length string, `false` will be returned. - * - * @param path path to test. - * @throws {TypeError} if `path` is not a string. - */ - isAbsolute(path: string): boolean; - /** - * Solve the relative path from {from} to {to} based on the current working directory. - * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. - * - * @throws {TypeError} if either `from` or `to` is not a string. - */ - relative(from: string, to: string): string; - /** - * Return the directory name of a path. Similar to the Unix dirname command. - * - * @param path the path to evaluate. - * @throws {TypeError} if `path` is not a string. - */ - dirname(path: string): string; - /** - * Return the last portion of a path. Similar to the Unix basename command. - * Often used to extract the file name from a fully qualified path. - * - * @param path the path to evaluate. - * @param suffix optionally, an extension to remove from the result. - * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string. - */ - basename(path: string, suffix?: string): string; - /** - * Return the extension of the path, from the last '.' to end of string in the last portion of the path. - * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string. - * - * @param path the path to evaluate. - * @throws {TypeError} if `path` is not a string. - */ - extname(path: string): string; - /** - * The platform-specific file separator. '\\' or '/'. - */ - readonly sep: "\\" | "/"; - /** - * The platform-specific file delimiter. ';' or ':'. - */ - readonly delimiter: ";" | ":"; - /** - * Returns an object from a path string - the opposite of format(). - * - * @param path path to evaluate. - * @throws {TypeError} if `path` is not a string. - */ - parse(path: string): ParsedPath; - /** - * Returns a path string from an object - the opposite of parse(). - * - * @param pathObject path to evaluate. - */ - format(pathObject: FormatInputPathObject): string; - /** - * On Windows systems only, returns an equivalent namespace-prefixed path for the given path. - * If path is not a string, path will be returned without modifications. - * This method is meaningful only on Windows system. - * On POSIX systems, the method is non-operational and always returns path without modifications. - */ - toNamespacedPath(path: string): string; - /** - * Posix specific pathing. - * Same as parent object on posix. - */ - readonly posix: PlatformPath; - /** - * Windows specific pathing. - * Same as parent object on windows - */ - readonly win32: PlatformPath; - } - } - const path: path.PlatformPath; - export = path; -} -declare module "node:path" { - import path = require("path"); - export = path; -} -declare module "node:path/posix" { - import path = require("path/posix"); - export = path; -} -declare module "node:path/win32" { - import path = require("path/win32"); - export = path; -} diff --git a/node_modules/@types/node/perf_hooks.d.ts b/node_modules/@types/node/perf_hooks.d.ts deleted file mode 100644 index ad0785d..0000000 --- a/node_modules/@types/node/perf_hooks.d.ts +++ /dev/null @@ -1,968 +0,0 @@ -/** - * This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for - * Node.js-specific performance measurements. - * - * Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/): - * - * * [High Resolution Time](https://www.w3.org/TR/hr-time-2) - * * [Performance Timeline](https://w3c.github.io/performance-timeline/) - * * [User Timing](https://www.w3.org/TR/user-timing/) - * * [Resource Timing](https://www.w3.org/TR/resource-timing-2/) - * - * ```js - * import { PerformanceObserver, performance } from 'node:perf_hooks'; - * - * const obs = new PerformanceObserver((items) => { - * console.log(items.getEntries()[0].duration); - * performance.clearMarks(); - * }); - * obs.observe({ type: 'measure' }); - * performance.measure('Start to Now'); - * - * performance.mark('A'); - * doSomeLongRunningProcess(() => { - * performance.measure('A to Now', 'A'); - * - * performance.mark('B'); - * performance.measure('A to B', 'A', 'B'); - * }); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/perf_hooks.js) - */ -declare module "perf_hooks" { - import { AsyncResource } from "node:async_hooks"; - type EntryType = - | "dns" // Node.js only - | "function" // Node.js only - | "gc" // Node.js only - | "http2" // Node.js only - | "http" // Node.js only - | "mark" // available on the Web - | "measure" // available on the Web - | "net" // Node.js only - | "node" // Node.js only - | "resource"; // available on the Web - interface NodeGCPerformanceDetail { - /** - * When `performanceEntry.entryType` is equal to 'gc', the `performance.kind` property identifies - * the type of garbage collection operation that occurred. - * See perf_hooks.constants for valid values. - */ - readonly kind: number; - /** - * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags` - * property contains additional information about garbage collection operation. - * See perf_hooks.constants for valid values. - */ - readonly flags: number; - } - /** - * The constructor of this class is not exposed to users directly. - * @since v8.5.0 - */ - class PerformanceEntry { - protected constructor(); - /** - * The total number of milliseconds elapsed for this entry. This value will not - * be meaningful for all Performance Entry types. - * @since v8.5.0 - */ - readonly duration: number; - /** - * The name of the performance entry. - * @since v8.5.0 - */ - readonly name: string; - /** - * The high resolution millisecond timestamp marking the starting time of the - * Performance Entry. - * @since v8.5.0 - */ - readonly startTime: number; - /** - * The type of the performance entry. It may be one of: - * - * * `'node'` (Node.js only) - * * `'mark'` (available on the Web) - * * `'measure'` (available on the Web) - * * `'gc'` (Node.js only) - * * `'function'` (Node.js only) - * * `'http2'` (Node.js only) - * * `'http'` (Node.js only) - * @since v8.5.0 - */ - readonly entryType: EntryType; - toJSON(): any; - } - /** - * Exposes marks created via the `Performance.mark()` method. - * @since v18.2.0, v16.17.0 - */ - class PerformanceMark extends PerformanceEntry { - readonly detail: any; - readonly duration: 0; - readonly entryType: "mark"; - } - /** - * Exposes measures created via the `Performance.measure()` method. - * - * The constructor of this class is not exposed to users directly. - * @since v18.2.0, v16.17.0 - */ - class PerformanceMeasure extends PerformanceEntry { - readonly detail: any; - readonly entryType: "measure"; - } - interface UVMetrics { - /** - * Number of event loop iterations. - */ - readonly loopCount: number; - /** - * Number of events that have been processed by the event handler. - */ - readonly events: number; - /** - * Number of events that were waiting to be processed when the event provider was called. - */ - readonly eventsWaiting: number; - } - // TODO: PerformanceNodeEntry is missing - /** - * _This property is an extension by Node.js. It is not available in Web browsers._ - * - * Provides timing details for Node.js itself. The constructor of this class - * is not exposed to users. - * @since v8.5.0 - */ - class PerformanceNodeTiming extends PerformanceEntry { - readonly entryType: "node"; - /** - * The high resolution millisecond timestamp at which the Node.js process - * completed bootstrapping. If bootstrapping has not yet finished, the property - * has the value of -1. - * @since v8.5.0 - */ - readonly bootstrapComplete: number; - /** - * The high resolution millisecond timestamp at which the Node.js environment was - * initialized. - * @since v8.5.0 - */ - readonly environment: number; - /** - * The high resolution millisecond timestamp of the amount of time the event loop - * has been idle within the event loop's event provider (e.g. `epoll_wait`). This - * does not take CPU usage into consideration. If the event loop has not yet - * started (e.g., in the first tick of the main script), the property has the - * value of 0. - * @since v14.10.0, v12.19.0 - */ - readonly idleTime: number; - /** - * The high resolution millisecond timestamp at which the Node.js event loop - * exited. If the event loop has not yet exited, the property has the value of -1\. - * It can only have a value of not -1 in a handler of the `'exit'` event. - * @since v8.5.0 - */ - readonly loopExit: number; - /** - * The high resolution millisecond timestamp at which the Node.js event loop - * started. If the event loop has not yet started (e.g., in the first tick of the - * main script), the property has the value of -1. - * @since v8.5.0 - */ - readonly loopStart: number; - /** - * The high resolution millisecond timestamp at which the Node.js process was initialized. - * @since v8.5.0 - */ - readonly nodeStart: number; - /** - * This is a wrapper to the `uv_metrics_info` function. - * It returns the current set of event loop metrics. - * - * It is recommended to use this property inside a function whose execution was - * scheduled using `setImmediate` to avoid collecting metrics before finishing all - * operations scheduled during the current loop iteration. - * @since v22.8.0, v20.18.0 - */ - readonly uvMetricsInfo: UVMetrics; - /** - * The high resolution millisecond timestamp at which the V8 platform was - * initialized. - * @since v8.5.0 - */ - readonly v8Start: number; - } - interface EventLoopUtilization { - idle: number; - active: number; - utilization: number; - } - /** - * @param utilization1 The result of a previous call to `eventLoopUtilization()`. - * @param utilization2 The result of a previous call to `eventLoopUtilization()` prior to `utilization1`. - */ - type EventLoopUtilityFunction = ( - utilization1?: EventLoopUtilization, - utilization2?: EventLoopUtilization, - ) => EventLoopUtilization; - interface MarkOptions { - /** - * Additional optional detail to include with the mark. - */ - detail?: unknown | undefined; - /** - * An optional timestamp to be used as the mark time. - * @default `performance.now()` - */ - startTime?: number | undefined; - } - interface MeasureOptions { - /** - * Additional optional detail to include with the mark. - */ - detail?: unknown; - /** - * Duration between start and end times. - */ - duration?: number | undefined; - /** - * Timestamp to be used as the end time, or a string identifying a previously recorded mark. - */ - end?: number | string | undefined; - /** - * Timestamp to be used as the start time, or a string identifying a previously recorded mark. - */ - start?: number | string | undefined; - } - interface TimerifyOptions { - /** - * A histogram object created using `perf_hooks.createHistogram()` that will record runtime - * durations in nanoseconds. - */ - histogram?: RecordableHistogram | undefined; - } - interface Performance { - /** - * If `name` is not provided, removes all `PerformanceMark` objects from the Performance Timeline. - * If `name` is provided, removes only the named mark. - * @since v8.5.0 - */ - clearMarks(name?: string): void; - /** - * If `name` is not provided, removes all `PerformanceMeasure` objects from the Performance Timeline. - * If `name` is provided, removes only the named measure. - * @since v16.7.0 - */ - clearMeasures(name?: string): void; - /** - * If `name` is not provided, removes all `PerformanceResourceTiming` objects from the Resource Timeline. - * If `name` is provided, removes only the named resource. - * @since v18.2.0, v16.17.0 - */ - clearResourceTimings(name?: string): void; - /** - * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time. - * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait). - * No other CPU idle time is taken into consideration. - */ - eventLoopUtilization: EventLoopUtilityFunction; - /** - * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`. - * If you are only interested in performance entries of certain types or that have certain names, see - * `performance.getEntriesByType()` and `performance.getEntriesByName()`. - * @since v16.7.0 - */ - getEntries(): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` - * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`. - * @param name - * @param type - * @since v16.7.0 - */ - getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` - * whose `performanceEntry.entryType` is equal to `type`. - * @param type - * @since v16.7.0 - */ - getEntriesByType(type: EntryType): PerformanceEntry[]; - /** - * Creates a new `PerformanceMark` entry in the Performance Timeline. - * A `PerformanceMark` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'mark'`, - * and whose `performanceEntry.duration` is always `0`. - * Performance marks are used to mark specific significant moments in the Performance Timeline. - * - * The created `PerformanceMark` entry is put in the global Performance Timeline and can be queried with - * `performance.getEntries`, `performance.getEntriesByName`, and `performance.getEntriesByType`. When the observation is - * performed, the entries should be cleared from the global Performance Timeline manually with `performance.clearMarks`. - * @param name - */ - mark(name: string, options?: MarkOptions): PerformanceMark; - /** - * Creates a new `PerformanceResourceTiming` entry in the Resource Timeline. - * A `PerformanceResourceTiming` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'resource'`. - * Performance resources are used to mark moments in the Resource Timeline. - * @param timingInfo [Fetch Timing Info](https://fetch.spec.whatwg.org/#fetch-timing-info) - * @param requestedUrl The resource url - * @param initiatorType The initiator name, e.g: 'fetch' - * @param global - * @param cacheMode The cache mode must be an empty string ('') or 'local' - * @param bodyInfo [Fetch Response Body Info](https://fetch.spec.whatwg.org/#response-body-info) - * @param responseStatus The response's status code - * @param deliveryType The delivery type. Default: ''. - * @since v18.2.0, v16.17.0 - */ - markResourceTiming( - timingInfo: object, - requestedUrl: string, - initiatorType: string, - global: object, - cacheMode: "" | "local", - bodyInfo: object, - responseStatus: number, - deliveryType?: string, - ): PerformanceResourceTiming; - /** - * Creates a new PerformanceMeasure entry in the Performance Timeline. - * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', - * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. - * - * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify - * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, - * then startMark is set to timeOrigin by default. - * - * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp - * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. - * @param name - * @param startMark - * @param endMark - * @return The PerformanceMeasure entry that was created - */ - measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure; - measure(name: string, options: MeasureOptions): PerformanceMeasure; - /** - * _This property is an extension by Node.js. It is not available in Web browsers._ - * - * An instance of the `PerformanceNodeTiming` class that provides performance metrics for specific Node.js operational milestones. - * @since v8.5.0 - */ - readonly nodeTiming: PerformanceNodeTiming; - /** - * Returns the current high resolution millisecond timestamp, where 0 represents the start of the current `node` process. - * @since v8.5.0 - */ - now(): number; - /** - * Sets the global performance resource timing buffer size to the specified number of "resource" type performance entry objects. - * - * By default the max buffer size is set to 250. - * @since v18.8.0 - */ - setResourceTimingBufferSize(maxSize: number): void; - /** - * The [`timeOrigin`](https://w3c.github.io/hr-time/#dom-performance-timeorigin) specifies the high resolution millisecond timestamp - * at which the current `node` process began, measured in Unix time. - * @since v8.5.0 - */ - readonly timeOrigin: number; - /** - * _This property is an extension by Node.js. It is not available in Web browsers._ - * - * Wraps a function within a new function that measures the running time of the wrapped function. - * A `PerformanceObserver` must be subscribed to the `'function'` event type in order for the timing details to be accessed. - * - * ```js - * import { - * performance, - * PerformanceObserver, - * } from 'node:perf_hooks'; - * - * function someFunction() { - * console.log('hello world'); - * } - * - * const wrapped = performance.timerify(someFunction); - * - * const obs = new PerformanceObserver((list) => { - * console.log(list.getEntries()[0].duration); - * - * performance.clearMarks(); - * performance.clearMeasures(); - * obs.disconnect(); - * }); - * obs.observe({ entryTypes: ['function'] }); - * - * // A performance timeline entry will be created - * wrapped(); - * ``` - * - * If the wrapped function returns a promise, a finally handler will be attached to the promise and the duration will be reported - * once the finally handler is invoked. - * @param fn - */ - timerify any>(fn: T, options?: TimerifyOptions): T; - /** - * An object which is JSON representation of the performance object. It is similar to - * [`window.performance.toJSON`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON) in browsers. - * @since v16.1.0 - */ - toJSON(): any; - } - class PerformanceObserverEntryList { - /** - * Returns a list of `PerformanceEntry` objects in chronological order - * with respect to `performanceEntry.startTime`. - * - * ```js - * import { - * performance, - * PerformanceObserver, - * } from 'node:perf_hooks'; - * - * const obs = new PerformanceObserver((perfObserverList, observer) => { - * console.log(perfObserverList.getEntries()); - * - * * [ - * * PerformanceEntry { - * * name: 'test', - * * entryType: 'mark', - * * startTime: 81.465639, - * * duration: 0, - * * detail: null - * * }, - * * PerformanceEntry { - * * name: 'meow', - * * entryType: 'mark', - * * startTime: 81.860064, - * * duration: 0, - * * detail: null - * * } - * * ] - * - * performance.clearMarks(); - * performance.clearMeasures(); - * observer.disconnect(); - * }); - * obs.observe({ type: 'mark' }); - * - * performance.mark('test'); - * performance.mark('meow'); - * ``` - * @since v8.5.0 - */ - getEntries(): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order - * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is - * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`. - * - * ```js - * import { - * performance, - * PerformanceObserver, - * } from 'node:perf_hooks'; - * - * const obs = new PerformanceObserver((perfObserverList, observer) => { - * console.log(perfObserverList.getEntriesByName('meow')); - * - * * [ - * * PerformanceEntry { - * * name: 'meow', - * * entryType: 'mark', - * * startTime: 98.545991, - * * duration: 0, - * * detail: null - * * } - * * ] - * - * console.log(perfObserverList.getEntriesByName('nope')); // [] - * - * console.log(perfObserverList.getEntriesByName('test', 'mark')); - * - * * [ - * * PerformanceEntry { - * * name: 'test', - * * entryType: 'mark', - * * startTime: 63.518931, - * * duration: 0, - * * detail: null - * * } - * * ] - * - * console.log(perfObserverList.getEntriesByName('test', 'measure')); // [] - * - * performance.clearMarks(); - * performance.clearMeasures(); - * observer.disconnect(); - * }); - * obs.observe({ entryTypes: ['mark', 'measure'] }); - * - * performance.mark('test'); - * performance.mark('meow'); - * ``` - * @since v8.5.0 - */ - getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order - * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType` is equal to `type`. - * - * ```js - * import { - * performance, - * PerformanceObserver, - * } from 'node:perf_hooks'; - * - * const obs = new PerformanceObserver((perfObserverList, observer) => { - * console.log(perfObserverList.getEntriesByType('mark')); - * - * * [ - * * PerformanceEntry { - * * name: 'test', - * * entryType: 'mark', - * * startTime: 55.897834, - * * duration: 0, - * * detail: null - * * }, - * * PerformanceEntry { - * * name: 'meow', - * * entryType: 'mark', - * * startTime: 56.350146, - * * duration: 0, - * * detail: null - * * } - * * ] - * - * performance.clearMarks(); - * performance.clearMeasures(); - * observer.disconnect(); - * }); - * obs.observe({ type: 'mark' }); - * - * performance.mark('test'); - * performance.mark('meow'); - * ``` - * @since v8.5.0 - */ - getEntriesByType(type: EntryType): PerformanceEntry[]; - } - type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void; - /** - * @since v8.5.0 - */ - class PerformanceObserver extends AsyncResource { - constructor(callback: PerformanceObserverCallback); - /** - * Disconnects the `PerformanceObserver` instance from all notifications. - * @since v8.5.0 - */ - disconnect(): void; - /** - * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes` or `options.type`: - * - * ```js - * import { - * performance, - * PerformanceObserver, - * } from 'node:perf_hooks'; - * - * const obs = new PerformanceObserver((list, observer) => { - * // Called once asynchronously. `list` contains three items. - * }); - * obs.observe({ type: 'mark' }); - * - * for (let n = 0; n < 3; n++) - * performance.mark(`test${n}`); - * ``` - * @since v8.5.0 - */ - observe( - options: - | { - entryTypes: readonly EntryType[]; - buffered?: boolean | undefined; - } - | { - type: EntryType; - buffered?: boolean | undefined; - }, - ): void; - /** - * @since v16.0.0 - * @returns Current list of entries stored in the performance observer, emptying it out. - */ - takeRecords(): PerformanceEntry[]; - } - /** - * Provides detailed network timing data regarding the loading of an application's resources. - * - * The constructor of this class is not exposed to users directly. - * @since v18.2.0, v16.17.0 - */ - class PerformanceResourceTiming extends PerformanceEntry { - readonly entryType: "resource"; - protected constructor(); - /** - * The high resolution millisecond timestamp at immediately before dispatching the `fetch` - * request. If the resource is not intercepted by a worker the property will always return 0. - * @since v18.2.0, v16.17.0 - */ - readonly workerStart: number; - /** - * The high resolution millisecond timestamp that represents the start time of the fetch which - * initiates the redirect. - * @since v18.2.0, v16.17.0 - */ - readonly redirectStart: number; - /** - * The high resolution millisecond timestamp that will be created immediately after receiving - * the last byte of the response of the last redirect. - * @since v18.2.0, v16.17.0 - */ - readonly redirectEnd: number; - /** - * The high resolution millisecond timestamp immediately before the Node.js starts to fetch the resource. - * @since v18.2.0, v16.17.0 - */ - readonly fetchStart: number; - /** - * The high resolution millisecond timestamp immediately before the Node.js starts the domain name lookup - * for the resource. - * @since v18.2.0, v16.17.0 - */ - readonly domainLookupStart: number; - /** - * The high resolution millisecond timestamp representing the time immediately after the Node.js finished - * the domain name lookup for the resource. - * @since v18.2.0, v16.17.0 - */ - readonly domainLookupEnd: number; - /** - * The high resolution millisecond timestamp representing the time immediately before Node.js starts to - * establish the connection to the server to retrieve the resource. - * @since v18.2.0, v16.17.0 - */ - readonly connectStart: number; - /** - * The high resolution millisecond timestamp representing the time immediately after Node.js finishes - * establishing the connection to the server to retrieve the resource. - * @since v18.2.0, v16.17.0 - */ - readonly connectEnd: number; - /** - * The high resolution millisecond timestamp representing the time immediately before Node.js starts the - * handshake process to secure the current connection. - * @since v18.2.0, v16.17.0 - */ - readonly secureConnectionStart: number; - /** - * The high resolution millisecond timestamp representing the time immediately before Node.js receives the - * first byte of the response from the server. - * @since v18.2.0, v16.17.0 - */ - readonly requestStart: number; - /** - * The high resolution millisecond timestamp representing the time immediately after Node.js receives the - * last byte of the resource or immediately before the transport connection is closed, whichever comes first. - * @since v18.2.0, v16.17.0 - */ - readonly responseEnd: number; - /** - * A number representing the size (in octets) of the fetched resource. The size includes the response header - * fields plus the response payload body. - * @since v18.2.0, v16.17.0 - */ - readonly transferSize: number; - /** - * A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before - * removing any applied content-codings. - * @since v18.2.0, v16.17.0 - */ - readonly encodedBodySize: number; - /** - * A number representing the size (in octets) received from the fetch (HTTP or cache), of the message body, after - * removing any applied content-codings. - * @since v18.2.0, v16.17.0 - */ - readonly decodedBodySize: number; - /** - * Returns a `object` that is the JSON representation of the `PerformanceResourceTiming` object - * @since v18.2.0, v16.17.0 - */ - toJSON(): any; - } - namespace constants { - const NODE_PERFORMANCE_GC_MAJOR: number; - const NODE_PERFORMANCE_GC_MINOR: number; - const NODE_PERFORMANCE_GC_INCREMENTAL: number; - const NODE_PERFORMANCE_GC_WEAKCB: number; - const NODE_PERFORMANCE_GC_FLAGS_NO: number; - const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number; - const NODE_PERFORMANCE_GC_FLAGS_FORCED: number; - const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number; - const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number; - const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number; - const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number; - } - const performance: Performance; - interface EventLoopMonitorOptions { - /** - * The sampling rate in milliseconds. - * Must be greater than zero. - * @default 10 - */ - resolution?: number | undefined; - } - interface Histogram { - /** - * The number of samples recorded by the histogram. - * @since v17.4.0, v16.14.0 - */ - readonly count: number; - /** - * The number of samples recorded by the histogram. - * v17.4.0, v16.14.0 - */ - readonly countBigInt: bigint; - /** - * The number of times the event loop delay exceeded the maximum 1 hour event - * loop delay threshold. - * @since v11.10.0 - */ - readonly exceeds: number; - /** - * The number of times the event loop delay exceeded the maximum 1 hour event loop delay threshold. - * @since v17.4.0, v16.14.0 - */ - readonly exceedsBigInt: bigint; - /** - * The maximum recorded event loop delay. - * @since v11.10.0 - */ - readonly max: number; - /** - * The maximum recorded event loop delay. - * v17.4.0, v16.14.0 - */ - readonly maxBigInt: number; - /** - * The mean of the recorded event loop delays. - * @since v11.10.0 - */ - readonly mean: number; - /** - * The minimum recorded event loop delay. - * @since v11.10.0 - */ - readonly min: number; - /** - * The minimum recorded event loop delay. - * v17.4.0, v16.14.0 - */ - readonly minBigInt: bigint; - /** - * Returns the value at the given percentile. - * @since v11.10.0 - * @param percentile A percentile value in the range (0, 100]. - */ - percentile(percentile: number): number; - /** - * Returns the value at the given percentile. - * @since v17.4.0, v16.14.0 - * @param percentile A percentile value in the range (0, 100]. - */ - percentileBigInt(percentile: number): bigint; - /** - * Returns a `Map` object detailing the accumulated percentile distribution. - * @since v11.10.0 - */ - readonly percentiles: Map; - /** - * Returns a `Map` object detailing the accumulated percentile distribution. - * @since v17.4.0, v16.14.0 - */ - readonly percentilesBigInt: Map; - /** - * Resets the collected histogram data. - * @since v11.10.0 - */ - reset(): void; - /** - * The standard deviation of the recorded event loop delays. - * @since v11.10.0 - */ - readonly stddev: number; - } - interface IntervalHistogram extends Histogram { - /** - * Enables the update interval timer. Returns `true` if the timer was - * started, `false` if it was already started. - * @since v11.10.0 - */ - enable(): boolean; - /** - * Disables the update interval timer. Returns `true` if the timer was - * stopped, `false` if it was already stopped. - * @since v11.10.0 - */ - disable(): boolean; - } - interface RecordableHistogram extends Histogram { - /** - * @since v15.9.0, v14.18.0 - * @param val The amount to record in the histogram. - */ - record(val: number | bigint): void; - /** - * Calculates the amount of time (in nanoseconds) that has passed since the - * previous call to `recordDelta()` and records that amount in the histogram. - * @since v15.9.0, v14.18.0 - */ - recordDelta(): void; - /** - * Adds the values from `other` to this histogram. - * @since v17.4.0, v16.14.0 - */ - add(other: RecordableHistogram): void; - } - /** - * _This property is an extension by Node.js. It is not available in Web browsers._ - * - * Creates an `IntervalHistogram` object that samples and reports the event loop - * delay over time. The delays will be reported in nanoseconds. - * - * Using a timer to detect approximate event loop delay works because the - * execution of timers is tied specifically to the lifecycle of the libuv - * event loop. That is, a delay in the loop will cause a delay in the execution - * of the timer, and those delays are specifically what this API is intended to - * detect. - * - * ```js - * import { monitorEventLoopDelay } from 'node:perf_hooks'; - * const h = monitorEventLoopDelay({ resolution: 20 }); - * h.enable(); - * // Do something. - * h.disable(); - * console.log(h.min); - * console.log(h.max); - * console.log(h.mean); - * console.log(h.stddev); - * console.log(h.percentiles); - * console.log(h.percentile(50)); - * console.log(h.percentile(99)); - * ``` - * @since v11.10.0 - */ - function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram; - interface CreateHistogramOptions { - /** - * The minimum recordable value. Must be an integer value greater than 0. - * @default 1 - */ - lowest?: number | bigint | undefined; - /** - * The maximum recordable value. Must be an integer value greater than min. - * @default Number.MAX_SAFE_INTEGER - */ - highest?: number | bigint | undefined; - /** - * The number of accuracy digits. Must be a number between 1 and 5. - * @default 3 - */ - figures?: number | undefined; - } - /** - * Returns a `RecordableHistogram`. - * @since v15.9.0, v14.18.0 - */ - function createHistogram(options?: CreateHistogramOptions): RecordableHistogram; - import { - performance as _performance, - PerformanceEntry as _PerformanceEntry, - PerformanceMark as _PerformanceMark, - PerformanceMeasure as _PerformanceMeasure, - PerformanceObserver as _PerformanceObserver, - PerformanceObserverEntryList as _PerformanceObserverEntryList, - PerformanceResourceTiming as _PerformanceResourceTiming, - } from "perf_hooks"; - global { - /** - * `PerformanceEntry` is a global reference for `import { PerformanceEntry } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceentry - * @since v19.0.0 - */ - var PerformanceEntry: typeof globalThis extends { - onmessage: any; - PerformanceEntry: infer T; - } ? T - : typeof _PerformanceEntry; - /** - * `PerformanceMark` is a global reference for `import { PerformanceMark } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemark - * @since v19.0.0 - */ - var PerformanceMark: typeof globalThis extends { - onmessage: any; - PerformanceMark: infer T; - } ? T - : typeof _PerformanceMark; - /** - * `PerformanceMeasure` is a global reference for `import { PerformanceMeasure } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemeasure - * @since v19.0.0 - */ - var PerformanceMeasure: typeof globalThis extends { - onmessage: any; - PerformanceMeasure: infer T; - } ? T - : typeof _PerformanceMeasure; - /** - * `PerformanceObserver` is a global reference for `import { PerformanceObserver } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserver - * @since v19.0.0 - */ - var PerformanceObserver: typeof globalThis extends { - onmessage: any; - PerformanceObserver: infer T; - } ? T - : typeof _PerformanceObserver; - /** - * `PerformanceObserverEntryList` is a global reference for `import { PerformanceObserverEntryList } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserverentrylist - * @since v19.0.0 - */ - var PerformanceObserverEntryList: typeof globalThis extends { - onmessage: any; - PerformanceObserverEntryList: infer T; - } ? T - : typeof _PerformanceObserverEntryList; - /** - * `PerformanceResourceTiming` is a global reference for `import { PerformanceResourceTiming } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceresourcetiming - * @since v19.0.0 - */ - var PerformanceResourceTiming: typeof globalThis extends { - onmessage: any; - PerformanceResourceTiming: infer T; - } ? T - : typeof _PerformanceResourceTiming; - /** - * `performance` is a global reference for `import { performance } from 'node:perf_hooks'` - * @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performance - * @since v16.0.0 - */ - var performance: typeof globalThis extends { - onmessage: any; - performance: infer T; - } ? T - : typeof _performance; - } -} -declare module "node:perf_hooks" { - export * from "perf_hooks"; -} diff --git a/node_modules/@types/node/process.d.ts b/node_modules/@types/node/process.d.ts deleted file mode 100644 index 1073839..0000000 --- a/node_modules/@types/node/process.d.ts +++ /dev/null @@ -1,2084 +0,0 @@ -declare module "process" { - import { Control, MessageOptions, SendHandle } from "node:child_process"; - import { PathLike } from "node:fs"; - import * as tty from "node:tty"; - import { Worker } from "node:worker_threads"; - - interface BuiltInModule { - "assert": typeof import("assert"); - "node:assert": typeof import("node:assert"); - "assert/strict": typeof import("assert/strict"); - "node:assert/strict": typeof import("node:assert/strict"); - "async_hooks": typeof import("async_hooks"); - "node:async_hooks": typeof import("node:async_hooks"); - "buffer": typeof import("buffer"); - "node:buffer": typeof import("node:buffer"); - "child_process": typeof import("child_process"); - "node:child_process": typeof import("node:child_process"); - "cluster": typeof import("cluster"); - "node:cluster": typeof import("node:cluster"); - "console": typeof import("console"); - "node:console": typeof import("node:console"); - "constants": typeof import("constants"); - "node:constants": typeof import("node:constants"); - "crypto": typeof import("crypto"); - "node:crypto": typeof import("node:crypto"); - "dgram": typeof import("dgram"); - "node:dgram": typeof import("node:dgram"); - "diagnostics_channel": typeof import("diagnostics_channel"); - "node:diagnostics_channel": typeof import("node:diagnostics_channel"); - "dns": typeof import("dns"); - "node:dns": typeof import("node:dns"); - "dns/promises": typeof import("dns/promises"); - "node:dns/promises": typeof import("node:dns/promises"); - "domain": typeof import("domain"); - "node:domain": typeof import("node:domain"); - "events": typeof import("events"); - "node:events": typeof import("node:events"); - "fs": typeof import("fs"); - "node:fs": typeof import("node:fs"); - "fs/promises": typeof import("fs/promises"); - "node:fs/promises": typeof import("node:fs/promises"); - "http": typeof import("http"); - "node:http": typeof import("node:http"); - "http2": typeof import("http2"); - "node:http2": typeof import("node:http2"); - "https": typeof import("https"); - "node:https": typeof import("node:https"); - "inspector": typeof import("inspector"); - "node:inspector": typeof import("node:inspector"); - "inspector/promises": typeof import("inspector/promises"); - "node:inspector/promises": typeof import("node:inspector/promises"); - "module": typeof import("module"); - "node:module": typeof import("node:module"); - "net": typeof import("net"); - "node:net": typeof import("node:net"); - "os": typeof import("os"); - "node:os": typeof import("node:os"); - "path": typeof import("path"); - "node:path": typeof import("node:path"); - "path/posix": typeof import("path/posix"); - "node:path/posix": typeof import("node:path/posix"); - "path/win32": typeof import("path/win32"); - "node:path/win32": typeof import("node:path/win32"); - "perf_hooks": typeof import("perf_hooks"); - "node:perf_hooks": typeof import("node:perf_hooks"); - "process": typeof import("process"); - "node:process": typeof import("node:process"); - "punycode": typeof import("punycode"); - "node:punycode": typeof import("node:punycode"); - "querystring": typeof import("querystring"); - "node:querystring": typeof import("node:querystring"); - "readline": typeof import("readline"); - "node:readline": typeof import("node:readline"); - "readline/promises": typeof import("readline/promises"); - "node:readline/promises": typeof import("node:readline/promises"); - "repl": typeof import("repl"); - "node:repl": typeof import("node:repl"); - "node:sea": typeof import("node:sea"); - "node:sqlite": typeof import("node:sqlite"); - "stream": typeof import("stream"); - "node:stream": typeof import("node:stream"); - "stream/consumers": typeof import("stream/consumers"); - "node:stream/consumers": typeof import("node:stream/consumers"); - "stream/promises": typeof import("stream/promises"); - "node:stream/promises": typeof import("node:stream/promises"); - "stream/web": typeof import("stream/web"); - "node:stream/web": typeof import("node:stream/web"); - "string_decoder": typeof import("string_decoder"); - "node:string_decoder": typeof import("node:string_decoder"); - "node:test": typeof import("node:test"); - "node:test/reporters": typeof import("node:test/reporters"); - "timers": typeof import("timers"); - "node:timers": typeof import("node:timers"); - "timers/promises": typeof import("timers/promises"); - "node:timers/promises": typeof import("node:timers/promises"); - "tls": typeof import("tls"); - "node:tls": typeof import("node:tls"); - "trace_events": typeof import("trace_events"); - "node:trace_events": typeof import("node:trace_events"); - "tty": typeof import("tty"); - "node:tty": typeof import("node:tty"); - "url": typeof import("url"); - "node:url": typeof import("node:url"); - "util": typeof import("util"); - "node:util": typeof import("node:util"); - "sys": typeof import("util"); - "node:sys": typeof import("node:util"); - "util/types": typeof import("util/types"); - "node:util/types": typeof import("node:util/types"); - "v8": typeof import("v8"); - "node:v8": typeof import("node:v8"); - "vm": typeof import("vm"); - "node:vm": typeof import("node:vm"); - "wasi": typeof import("wasi"); - "node:wasi": typeof import("node:wasi"); - "worker_threads": typeof import("worker_threads"); - "node:worker_threads": typeof import("node:worker_threads"); - "zlib": typeof import("zlib"); - "node:zlib": typeof import("node:zlib"); - } - global { - var process: NodeJS.Process; - namespace NodeJS { - // this namespace merge is here because these are specifically used - // as the type for process.stdin, process.stdout, and process.stderr. - // they can't live in tty.d.ts because we need to disambiguate the imported name. - interface ReadStream extends tty.ReadStream {} - interface WriteStream extends tty.WriteStream {} - interface MemoryUsageFn { - /** - * The `process.memoryUsage()` method iterate over each page to gather informations about memory - * usage which can be slow depending on the program memory allocations. - */ - (): MemoryUsage; - /** - * method returns an integer representing the Resident Set Size (RSS) in bytes. - */ - rss(): number; - } - interface MemoryUsage { - /** - * Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the - * process, including all C++ and JavaScript objects and code. - */ - rss: number; - /** - * Refers to V8's memory usage. - */ - heapTotal: number; - /** - * Refers to V8's memory usage. - */ - heapUsed: number; - external: number; - /** - * Refers to memory allocated for `ArrayBuffer`s and `SharedArrayBuffer`s, including all Node.js Buffers. This is also included - * in the external value. When Node.js is used as an embedded library, this value may be `0` because allocations for `ArrayBuffer`s - * may not be tracked in that case. - */ - arrayBuffers: number; - } - interface CpuUsage { - user: number; - system: number; - } - interface ProcessRelease { - name: string; - sourceUrl?: string | undefined; - headersUrl?: string | undefined; - libUrl?: string | undefined; - lts?: string | undefined; - } - interface ProcessFeatures { - /** - * A boolean value that is `true` if the current Node.js build is caching builtin modules. - * @since v12.0.0 - */ - readonly cached_builtins: boolean; - /** - * A boolean value that is `true` if the current Node.js build is a debug build. - * @since v0.5.5 - */ - readonly debug: boolean; - /** - * A boolean value that is `true` if the current Node.js build includes the inspector. - * @since v11.10.0 - */ - readonly inspector: boolean; - /** - * A boolean value that is `true` if the current Node.js build includes support for IPv6. - * - * Since all Node.js builds have IPv6 support, this value is always `true`. - * @since v0.5.3 - * @deprecated This property is always true, and any checks based on it are redundant. - */ - readonly ipv6: boolean; - /** - * A boolean value that is `true` if the current Node.js build supports - * [loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v22.x/api/modules.md#loading-ecmascript-modules-using-require). - * @since v22.10.0 - */ - readonly require_module: boolean; - /** - * A boolean value that is `true` if the current Node.js build includes support for TLS. - * @since v0.5.3 - */ - readonly tls: boolean; - /** - * A boolean value that is `true` if the current Node.js build includes support for ALPN in TLS. - * - * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional ALPN support. - * This value is therefore identical to that of `process.features.tls`. - * @since v4.8.0 - * @deprecated Use `process.features.tls` instead. - */ - readonly tls_alpn: boolean; - /** - * A boolean value that is `true` if the current Node.js build includes support for OCSP in TLS. - * - * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional OCSP support. - * This value is therefore identical to that of `process.features.tls`. - * @since v0.11.13 - * @deprecated Use `process.features.tls` instead. - */ - readonly tls_ocsp: boolean; - /** - * A boolean value that is `true` if the current Node.js build includes support for SNI in TLS. - * - * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional SNI support. - * This value is therefore identical to that of `process.features.tls`. - * @since v0.5.3 - * @deprecated Use `process.features.tls` instead. - */ - readonly tls_sni: boolean; - /** - * A value that is `"strip"` by default, - * `"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if - * Node.js is run with `--no-experimental-strip-types`. - * @since v22.10.0 - */ - readonly typescript: "strip" | "transform" | false; - /** - * A boolean value that is `true` if the current Node.js build includes support for libuv. - * - * Since it's not possible to build Node.js without libuv, this value is always `true`. - * @since v0.5.3 - * @deprecated This property is always true, and any checks based on it are redundant. - */ - readonly uv: boolean; - } - interface ProcessVersions extends Dict { - http_parser: string; - node: string; - v8: string; - ares: string; - uv: string; - zlib: string; - modules: string; - openssl: string; - } - type Platform = - | "aix" - | "android" - | "darwin" - | "freebsd" - | "haiku" - | "linux" - | "openbsd" - | "sunos" - | "win32" - | "cygwin" - | "netbsd"; - type Architecture = - | "arm" - | "arm64" - | "ia32" - | "loong64" - | "mips" - | "mipsel" - | "ppc" - | "ppc64" - | "riscv64" - | "s390" - | "s390x" - | "x64"; - type Signals = - | "SIGABRT" - | "SIGALRM" - | "SIGBUS" - | "SIGCHLD" - | "SIGCONT" - | "SIGFPE" - | "SIGHUP" - | "SIGILL" - | "SIGINT" - | "SIGIO" - | "SIGIOT" - | "SIGKILL" - | "SIGPIPE" - | "SIGPOLL" - | "SIGPROF" - | "SIGPWR" - | "SIGQUIT" - | "SIGSEGV" - | "SIGSTKFLT" - | "SIGSTOP" - | "SIGSYS" - | "SIGTERM" - | "SIGTRAP" - | "SIGTSTP" - | "SIGTTIN" - | "SIGTTOU" - | "SIGUNUSED" - | "SIGURG" - | "SIGUSR1" - | "SIGUSR2" - | "SIGVTALRM" - | "SIGWINCH" - | "SIGXCPU" - | "SIGXFSZ" - | "SIGBREAK" - | "SIGLOST" - | "SIGINFO"; - type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection"; - type MultipleResolveType = "resolve" | "reject"; - type BeforeExitListener = (code: number) => void; - type DisconnectListener = () => void; - type ExitListener = (code: number) => void; - type RejectionHandledListener = (promise: Promise) => void; - type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void; - /** - * Most of the time the unhandledRejection will be an Error, but this should not be relied upon - * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error. - */ - type UnhandledRejectionListener = (reason: unknown, promise: Promise) => void; - type WarningListener = (warning: Error) => void; - type MessageListener = (message: unknown, sendHandle: SendHandle) => void; - type SignalsListener = (signal: Signals) => void; - type MultipleResolveListener = ( - type: MultipleResolveType, - promise: Promise, - value: unknown, - ) => void; - type WorkerListener = (worker: Worker) => void; - interface Socket extends ReadWriteStream { - isTTY?: true | undefined; - } - // Alias for compatibility - interface ProcessEnv extends Dict {} - interface HRTime { - /** - * This is the legacy version of {@link process.hrtime.bigint()} - * before bigint was introduced in JavaScript. - * - * The `process.hrtime()` method returns the current high-resolution real time in a `[seconds, nanoseconds]` tuple `Array`, - * where `nanoseconds` is the remaining part of the real time that can't be represented in second precision. - * - * `time` is an optional parameter that must be the result of a previous `process.hrtime()` call to diff with the current time. - * If the parameter passed in is not a tuple `Array`, a TypeError will be thrown. - * Passing in a user-defined array instead of the result of a previous call to `process.hrtime()` will lead to undefined behavior. - * - * These times are relative to an arbitrary time in the past, - * and not related to the time of day and therefore not subject to clock drift. - * The primary use is for measuring performance between intervals: - * ```js - * const { hrtime } = require('node:process'); - * const NS_PER_SEC = 1e9; - * const time = hrtime(); - * // [ 1800216, 25 ] - * - * setTimeout(() => { - * const diff = hrtime(time); - * // [ 1, 552 ] - * - * console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`); - * // Benchmark took 1000000552 nanoseconds - * }, 1000); - * ``` - * @since 0.7.6 - * @legacy Use {@link process.hrtime.bigint()} instead. - * @param time The result of a previous call to `process.hrtime()` - */ - (time?: [number, number]): [number, number]; - /** - * The `bigint` version of the {@link process.hrtime()} method returning the current high-resolution real time in nanoseconds as a `bigint`. - * - * Unlike {@link process.hrtime()}, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s. - * ```js - * import { hrtime } from 'node:process'; - * - * const start = hrtime.bigint(); - * // 191051479007711n - * - * setTimeout(() => { - * const end = hrtime.bigint(); - * // 191052633396993n - * - * console.log(`Benchmark took ${end - start} nanoseconds`); - * // Benchmark took 1154389282 nanoseconds - * }, 1000); - * ``` - * @since v10.7.0 - */ - bigint(): bigint; - } - interface ProcessPermission { - /** - * Verifies that the process is able to access the given scope and reference. - * If no reference is provided, a global scope is assumed, for instance, `process.permission.has('fs.read')` - * will check if the process has ALL file system read permissions. - * - * The reference has a meaning based on the provided scope. For example, the reference when the scope is File System means files and folders. - * - * The available scopes are: - * - * * `fs` - All File System - * * `fs.read` - File System read operations - * * `fs.write` - File System write operations - * * `child` - Child process spawning operations - * * `worker` - Worker thread spawning operation - * - * ```js - * // Check if the process has permission to read the README file - * process.permission.has('fs.read', './README.md'); - * // Check if the process has read permission operations - * process.permission.has('fs.read'); - * ``` - * @since v20.0.0 - */ - has(scope: string, reference?: string): boolean; - } - interface ProcessReport { - /** - * Write reports in a compact format, single-line JSON, more easily consumable by log processing systems - * than the default multi-line format designed for human consumption. - * @since v13.12.0, v12.17.0 - */ - compact: boolean; - /** - * Directory where the report is written. - * The default value is the empty string, indicating that reports are written to the current - * working directory of the Node.js process. - */ - directory: string; - /** - * Filename where the report is written. If set to the empty string, the output filename will be comprised - * of a timestamp, PID, and sequence number. The default value is the empty string. - */ - filename: string; - /** - * Returns a JavaScript Object representation of a diagnostic report for the running process. - * The report's JavaScript stack trace is taken from `err`, if present. - */ - getReport(err?: Error): object; - /** - * If true, a diagnostic report is generated on fatal errors, - * such as out of memory errors or failed C++ assertions. - * @default false - */ - reportOnFatalError: boolean; - /** - * If true, a diagnostic report is generated when the process - * receives the signal specified by process.report.signal. - * @default false - */ - reportOnSignal: boolean; - /** - * If true, a diagnostic report is generated on uncaught exception. - * @default false - */ - reportOnUncaughtException: boolean; - /** - * If true, a diagnostic report is generated without the environment variables. - * @default false - */ - excludeEnv: boolean; - /** - * The signal used to trigger the creation of a diagnostic report. - * @default 'SIGUSR2' - */ - signal: Signals; - /** - * Writes a diagnostic report to a file. If filename is not provided, the default filename - * includes the date, time, PID, and a sequence number. - * The report's JavaScript stack trace is taken from `err`, if present. - * - * If the value of filename is set to `'stdout'` or `'stderr'`, the report is written - * to the stdout or stderr of the process respectively. - * @param fileName Name of the file where the report is written. - * This should be a relative path, that will be appended to the directory specified in - * `process.report.directory`, or the current working directory of the Node.js process, - * if unspecified. - * @param err A custom error used for reporting the JavaScript stack. - * @return Filename of the generated report. - */ - writeReport(fileName?: string, err?: Error): string; - writeReport(err?: Error): string; - } - interface ResourceUsage { - fsRead: number; - fsWrite: number; - involuntaryContextSwitches: number; - ipcReceived: number; - ipcSent: number; - majorPageFault: number; - maxRSS: number; - minorPageFault: number; - sharedMemorySize: number; - signalsCount: number; - swappedOut: number; - systemCPUTime: number; - unsharedDataSize: number; - unsharedStackSize: number; - userCPUTime: number; - voluntaryContextSwitches: number; - } - interface EmitWarningOptions { - /** - * When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted. - * - * @default 'Warning' - */ - type?: string | undefined; - /** - * A unique identifier for the warning instance being emitted. - */ - code?: string | undefined; - /** - * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace. - * - * @default process.emitWarning - */ - ctor?: Function | undefined; - /** - * Additional text to include with the error. - */ - detail?: string | undefined; - } - interface ProcessConfig { - readonly target_defaults: { - readonly cflags: any[]; - readonly default_configuration: string; - readonly defines: string[]; - readonly include_dirs: string[]; - readonly libraries: string[]; - }; - readonly variables: { - readonly clang: number; - readonly host_arch: string; - readonly node_install_npm: boolean; - readonly node_install_waf: boolean; - readonly node_prefix: string; - readonly node_shared_openssl: boolean; - readonly node_shared_v8: boolean; - readonly node_shared_zlib: boolean; - readonly node_use_dtrace: boolean; - readonly node_use_etw: boolean; - readonly node_use_openssl: boolean; - readonly target_arch: string; - readonly v8_no_strict_aliasing: number; - readonly v8_use_snapshot: boolean; - readonly visibility: string; - }; - } - interface Process extends EventEmitter { - /** - * The `process.stdout` property returns a stream connected to`stdout` (fd `1`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `1` refers to a file, in which case it is - * a `Writable` stream. - * - * For example, to copy `process.stdin` to `process.stdout`: - * - * ```js - * import { stdin, stdout } from 'node:process'; - * - * stdin.pipe(stdout); - * ``` - * - * `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information. - */ - stdout: WriteStream & { - fd: 1; - }; - /** - * The `process.stderr` property returns a stream connected to`stderr` (fd `2`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `2` refers to a file, in which case it is - * a `Writable` stream. - * - * `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information. - */ - stderr: WriteStream & { - fd: 2; - }; - /** - * The `process.stdin` property returns a stream connected to`stdin` (fd `0`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `0` refers to a file, in which case it is - * a `Readable` stream. - * - * For details of how to read from `stdin` see `readable.read()`. - * - * As a `Duplex` stream, `process.stdin` can also be used in "old" mode that - * is compatible with scripts written for Node.js prior to v0.10\. - * For more information see `Stream compatibility`. - * - * In "old" streams mode the `stdin` stream is paused by default, so one - * must call `process.stdin.resume()` to read from it. Note also that calling `process.stdin.resume()` itself would switch stream to "old" mode. - */ - stdin: ReadStream & { - fd: 0; - }; - /** - * The `process.argv` property returns an array containing the command-line - * arguments passed when the Node.js process was launched. The first element will - * be {@link execPath}. See `process.argv0` if access to the original value - * of `argv[0]` is needed. The second element will be the path to the JavaScript - * file being executed. The remaining elements will be any additional command-line - * arguments. - * - * For example, assuming the following script for `process-args.js`: - * - * ```js - * import { argv } from 'node:process'; - * - * // print process.argv - * argv.forEach((val, index) => { - * console.log(`${index}: ${val}`); - * }); - * ``` - * - * Launching the Node.js process as: - * - * ```bash - * node process-args.js one two=three four - * ``` - * - * Would generate the output: - * - * ```text - * 0: /usr/local/bin/node - * 1: /Users/mjr/work/node/process-args.js - * 2: one - * 3: two=three - * 4: four - * ``` - * @since v0.1.27 - */ - argv: string[]; - /** - * The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts. - * - * ```console - * $ bash -c 'exec -a customArgv0 ./node' - * > process.argv[0] - * '/Volumes/code/external/node/out/Release/node' - * > process.argv0 - * 'customArgv0' - * ``` - * @since v6.4.0 - */ - argv0: string; - /** - * The `process.execArgv` property returns the set of Node.js-specific command-line - * options passed when the Node.js process was launched. These options do not - * appear in the array returned by the {@link argv} property, and do not - * include the Node.js executable, the name of the script, or any options following - * the script name. These options are useful in order to spawn child processes with - * the same execution environment as the parent. - * - * ```bash - * node --icu-data-dir=./foo --require ./bar.js script.js --version - * ``` - * - * Results in `process.execArgv`: - * - * ```js - * ["--icu-data-dir=./foo", "--require", "./bar.js"] - * ``` - * - * And `process.argv`: - * - * ```js - * ['/usr/local/bin/node', 'script.js', '--version'] - * ``` - * - * Refer to `Worker constructor` for the detailed behavior of worker - * threads with this property. - * @since v0.7.7 - */ - execArgv: string[]; - /** - * The `process.execPath` property returns the absolute pathname of the executable - * that started the Node.js process. Symbolic links, if any, are resolved. - * - * ```js - * '/usr/local/bin/node' - * ``` - * @since v0.1.100 - */ - execPath: string; - /** - * The `process.abort()` method causes the Node.js process to exit immediately and - * generate a core file. - * - * This feature is not available in `Worker` threads. - * @since v0.7.0 - */ - abort(): never; - /** - * The `process.chdir()` method changes the current working directory of the - * Node.js process or throws an exception if doing so fails (for instance, if - * the specified `directory` does not exist). - * - * ```js - * import { chdir, cwd } from 'node:process'; - * - * console.log(`Starting directory: ${cwd()}`); - * try { - * chdir('/tmp'); - * console.log(`New directory: ${cwd()}`); - * } catch (err) { - * console.error(`chdir: ${err}`); - * } - * ``` - * - * This feature is not available in `Worker` threads. - * @since v0.1.17 - */ - chdir(directory: string): void; - /** - * The `process.cwd()` method returns the current working directory of the Node.js - * process. - * - * ```js - * import { cwd } from 'node:process'; - * - * console.log(`Current directory: ${cwd()}`); - * ``` - * @since v0.1.8 - */ - cwd(): string; - /** - * The port used by the Node.js debugger when enabled. - * - * ```js - * import process from 'node:process'; - * - * process.debugPort = 5858; - * ``` - * @since v0.7.2 - */ - debugPort: number; - /** - * The `process.dlopen()` method allows dynamically loading shared objects. It is primarily used by `require()` to load C++ Addons, and - * should not be used directly, except in special cases. In other words, `require()` should be preferred over `process.dlopen()` - * unless there are specific reasons such as custom dlopen flags or loading from ES modules. - * - * The `flags` argument is an integer that allows to specify dlopen behavior. See the `[os.constants.dlopen](https://nodejs.org/docs/latest-v22.x/api/os.html#dlopen-constants)` - * documentation for details. - * - * An important requirement when calling `process.dlopen()` is that the `module` instance must be passed. Functions exported by the C++ Addon - * are then accessible via `module.exports`. - * - * The example below shows how to load a C++ Addon, named `local.node`, that exports a `foo` function. All the symbols are loaded before the call returns, by passing the `RTLD_NOW` constant. - * In this example the constant is assumed to be available. - * - * ```js - * import { dlopen } from 'node:process'; - * import { constants } from 'node:os'; - * import { fileURLToPath } from 'node:url'; - * - * const module = { exports: {} }; - * dlopen(module, fileURLToPath(new URL('local.node', import.meta.url)), - * constants.dlopen.RTLD_NOW); - * module.exports.foo(); - * ``` - */ - dlopen(module: object, filename: string, flags?: number): void; - /** - * The `process.emitWarning()` method can be used to emit custom or application - * specific process warnings. These can be listened for by adding a handler to the `'warning'` event. - * - * ```js - * import { emitWarning } from 'node:process'; - * - * // Emit a warning using a string. - * emitWarning('Something happened!'); - * // Emits: (node: 56338) Warning: Something happened! - * ``` - * - * ```js - * import { emitWarning } from 'node:process'; - * - * // Emit a warning using a string and a type. - * emitWarning('Something Happened!', 'CustomWarning'); - * // Emits: (node:56338) CustomWarning: Something Happened! - * ``` - * - * ```js - * import { emitWarning } from 'node:process'; - * - * emitWarning('Something happened!', 'CustomWarning', 'WARN001'); - * // Emits: (node:56338) [WARN001] CustomWarning: Something happened! - * ```js - * - * In each of the previous examples, an `Error` object is generated internally by `process.emitWarning()` and passed through to the `'warning'` handler. - * - * ```js - * import process from 'node:process'; - * - * process.on('warning', (warning) => { - * console.warn(warning.name); // 'Warning' - * console.warn(warning.message); // 'Something happened!' - * console.warn(warning.code); // 'MY_WARNING' - * console.warn(warning.stack); // Stack trace - * console.warn(warning.detail); // 'This is some additional information' - * }); - * ``` - * - * If `warning` is passed as an `Error` object, it will be passed through to the `'warning'` event handler - * unmodified (and the optional `type`, `code` and `ctor` arguments will be ignored): - * - * ```js - * import { emitWarning } from 'node:process'; - * - * // Emit a warning using an Error object. - * const myWarning = new Error('Something happened!'); - * // Use the Error name property to specify the type name - * myWarning.name = 'CustomWarning'; - * myWarning.code = 'WARN001'; - * - * emitWarning(myWarning); - * // Emits: (node:56338) [WARN001] CustomWarning: Something happened! - * ``` - * - * A `TypeError` is thrown if `warning` is anything other than a string or `Error` object. - * - * While process warnings use `Error` objects, the process warning mechanism is not a replacement for normal error handling mechanisms. - * - * The following additional handling is implemented if the warning `type` is `'DeprecationWarning'`: - * * If the `--throw-deprecation` command-line flag is used, the deprecation warning is thrown as an exception rather than being emitted as an event. - * * If the `--no-deprecation` command-line flag is used, the deprecation warning is suppressed. - * * If the `--trace-deprecation` command-line flag is used, the deprecation warning is printed to `stderr` along with the full stack trace. - * @since v8.0.0 - * @param warning The warning to emit. - */ - emitWarning(warning: string | Error, ctor?: Function): void; - emitWarning(warning: string | Error, type?: string, ctor?: Function): void; - emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void; - emitWarning(warning: string | Error, options?: EmitWarningOptions): void; - /** - * The `process.env` property returns an object containing the user environment. - * See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html). - * - * An example of this object looks like: - * - * ```js - * { - * TERM: 'xterm-256color', - * SHELL: '/usr/local/bin/bash', - * USER: 'maciej', - * PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', - * PWD: '/Users/maciej', - * EDITOR: 'vim', - * SHLVL: '1', - * HOME: '/Users/maciej', - * LOGNAME: 'maciej', - * _: '/usr/local/bin/node' - * } - * ``` - * - * It is possible to modify this object, but such modifications will not be - * reflected outside the Node.js process, or (unless explicitly requested) - * to other `Worker` threads. - * In other words, the following example would not work: - * - * ```bash - * node -e 'process.env.foo = "bar"' && echo $foo - * ``` - * - * While the following will: - * - * ```js - * import { env } from 'node:process'; - * - * env.foo = 'bar'; - * console.log(env.foo); - * ``` - * - * Assigning a property on `process.env` will implicitly convert the value - * to a string. **This behavior is deprecated.** Future versions of Node.js may - * throw an error when the value is not a string, number, or boolean. - * - * ```js - * import { env } from 'node:process'; - * - * env.test = null; - * console.log(env.test); - * // => 'null' - * env.test = undefined; - * console.log(env.test); - * // => 'undefined' - * ``` - * - * Use `delete` to delete a property from `process.env`. - * - * ```js - * import { env } from 'node:process'; - * - * env.TEST = 1; - * delete env.TEST; - * console.log(env.TEST); - * // => undefined - * ``` - * - * On Windows operating systems, environment variables are case-insensitive. - * - * ```js - * import { env } from 'node:process'; - * - * env.TEST = 1; - * console.log(env.test); - * // => 1 - * ``` - * - * Unless explicitly specified when creating a `Worker` instance, - * each `Worker` thread has its own copy of `process.env`, based on its - * parent thread's `process.env`, or whatever was specified as the `env` option - * to the `Worker` constructor. Changes to `process.env` will not be visible - * across `Worker` threads, and only the main thread can make changes that - * are visible to the operating system or to native add-ons. On Windows, a copy of `process.env` on a `Worker` instance operates in a case-sensitive manner - * unlike the main thread. - * @since v0.1.27 - */ - env: ProcessEnv; - /** - * The `process.exit()` method instructs Node.js to terminate the process - * synchronously with an exit status of `code`. If `code` is omitted, exit uses - * either the 'success' code `0` or the value of `process.exitCode` if it has been - * set. Node.js will not terminate until all the `'exit'` event listeners are - * called. - * - * To exit with a 'failure' code: - * - * ```js - * import { exit } from 'node:process'; - * - * exit(1); - * ``` - * - * The shell that executed Node.js should see the exit code as `1`. - * - * Calling `process.exit()` will force the process to exit as quickly as possible - * even if there are still asynchronous operations pending that have not yet - * completed fully, including I/O operations to `process.stdout` and `process.stderr`. - * - * In most situations, it is not actually necessary to call `process.exit()` explicitly. The Node.js process will exit on its own _if there is no additional_ - * _work pending_ in the event loop. The `process.exitCode` property can be set to - * tell the process which exit code to use when the process exits gracefully. - * - * For instance, the following example illustrates a _misuse_ of the `process.exit()` method that could lead to data printed to stdout being - * truncated and lost: - * - * ```js - * import { exit } from 'node:process'; - * - * // This is an example of what *not* to do: - * if (someConditionNotMet()) { - * printUsageToStdout(); - * exit(1); - * } - * ``` - * - * The reason this is problematic is because writes to `process.stdout` in Node.js - * are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js - * event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed. - * - * Rather than calling `process.exit()` directly, the code _should_ set the `process.exitCode` and allow the process to exit naturally by avoiding - * scheduling any additional work for the event loop: - * - * ```js - * import process from 'node:process'; - * - * // How to properly set the exit code while letting - * // the process exit gracefully. - * if (someConditionNotMet()) { - * printUsageToStdout(); - * process.exitCode = 1; - * } - * ``` - * - * If it is necessary to terminate the Node.js process due to an error condition, - * throwing an _uncaught_ error and allowing the process to terminate accordingly - * is safer than calling `process.exit()`. - * - * In `Worker` threads, this function stops the current thread rather - * than the current process. - * @since v0.1.13 - * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed. - */ - exit(code?: number | string | null): never; - /** - * A number which will be the process exit code, when the process either - * exits gracefully, or is exited via {@link exit} without specifying - * a code. - * - * Specifying a code to {@link exit} will override any - * previous setting of `process.exitCode`. - * @default undefined - * @since v0.11.8 - */ - exitCode: number | string | null | undefined; - finalization: { - /** - * This function registers a callback to be called when the process emits the `exit` event if the `ref` object was not garbage collected. - * If the object `ref` was garbage collected before the `exit` event is emitted, the callback will be removed from the finalization registry, and it will not be called on process exit. - * - * Inside the callback you can release the resources allocated by the `ref` object. - * Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function, - * this means that there is a possibility that the callback will not be called under special circumstances. - * - * The idea of ​​this function is to help you free up resources when the starts process exiting, but also let the object be garbage collected if it is no longer being used. - * @param ref The reference to the resource that is being tracked. - * @param callback The callback function to be called when the resource is finalized. - * @since v22.5.0 - * @experimental - */ - register(ref: T, callback: (ref: T, event: "exit") => void): void; - /** - * This function behaves exactly like the `register`, except that the callback will be called when the process emits the `beforeExit` event if `ref` object was not garbage collected. - * - * Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function, this means that there is a possibility that the callback will not be called under special circumstances. - * @param ref The reference to the resource that is being tracked. - * @param callback The callback function to be called when the resource is finalized. - * @since v22.5.0 - * @experimental - */ - registerBeforeExit(ref: T, callback: (ref: T, event: "beforeExit") => void): void; - /** - * This function remove the register of the object from the finalization registry, so the callback will not be called anymore. - * @param ref The reference to the resource that was registered previously. - * @since v22.5.0 - * @experimental - */ - unregister(ref: object): void; - }; - /** - * The `process.getActiveResourcesInfo()` method returns an array of strings containing - * the types of the active resources that are currently keeping the event loop alive. - * - * ```js - * import { getActiveResourcesInfo } from 'node:process'; - * import { setTimeout } from 'node:timers'; - - * console.log('Before:', getActiveResourcesInfo()); - * setTimeout(() => {}, 1000); - * console.log('After:', getActiveResourcesInfo()); - * // Prints: - * // Before: [ 'TTYWrap', 'TTYWrap', 'TTYWrap' ] - * // After: [ 'TTYWrap', 'TTYWrap', 'TTYWrap', 'Timeout' ] - * ``` - * @since v17.3.0, v16.14.0 - */ - getActiveResourcesInfo(): string[]; - /** - * Provides a way to load built-in modules in a globally available function. - * @param id ID of the built-in module being requested. - */ - getBuiltinModule(id: ID): BuiltInModule[ID]; - getBuiltinModule(id: string): object | undefined; - /** - * The `process.getgid()` method returns the numerical group identity of the - * process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).) - * - * ```js - * import process from 'node:process'; - * - * if (process.getgid) { - * console.log(`Current gid: ${process.getgid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v0.1.31 - */ - getgid?: () => number; - /** - * The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a - * numeric ID or a group name - * string. If a group name is specified, this method blocks while resolving the - * associated numeric ID. - * - * ```js - * import process from 'node:process'; - * - * if (process.getgid && process.setgid) { - * console.log(`Current gid: ${process.getgid()}`); - * try { - * process.setgid(501); - * console.log(`New gid: ${process.getgid()}`); - * } catch (err) { - * console.log(`Failed to set gid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v0.1.31 - * @param id The group name or ID - */ - setgid?: (id: number | string) => void; - /** - * The `process.getuid()` method returns the numeric user identity of the process. - * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).) - * - * ```js - * import process from 'node:process'; - * - * if (process.getuid) { - * console.log(`Current uid: ${process.getuid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v0.1.28 - */ - getuid?: () => number; - /** - * The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a - * numeric ID or a username string. - * If a username is specified, the method blocks while resolving the associated - * numeric ID. - * - * ```js - * import process from 'node:process'; - * - * if (process.getuid && process.setuid) { - * console.log(`Current uid: ${process.getuid()}`); - * try { - * process.setuid(501); - * console.log(`New uid: ${process.getuid()}`); - * } catch (err) { - * console.log(`Failed to set uid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v0.1.28 - */ - setuid?: (id: number | string) => void; - /** - * The `process.geteuid()` method returns the numerical effective user identity of - * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).) - * - * ```js - * import process from 'node:process'; - * - * if (process.geteuid) { - * console.log(`Current uid: ${process.geteuid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v2.0.0 - */ - geteuid?: () => number; - /** - * The `process.seteuid()` method sets the effective user identity of the process. - * (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username - * string. If a username is specified, the method blocks while resolving the - * associated numeric ID. - * - * ```js - * import process from 'node:process'; - * - * if (process.geteuid && process.seteuid) { - * console.log(`Current uid: ${process.geteuid()}`); - * try { - * process.seteuid(501); - * console.log(`New uid: ${process.geteuid()}`); - * } catch (err) { - * console.log(`Failed to set uid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v2.0.0 - * @param id A user name or ID - */ - seteuid?: (id: number | string) => void; - /** - * The `process.getegid()` method returns the numerical effective group identity - * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).) - * - * ```js - * import process from 'node:process'; - * - * if (process.getegid) { - * console.log(`Current gid: ${process.getegid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v2.0.0 - */ - getegid?: () => number; - /** - * The `process.setegid()` method sets the effective group identity of the process. - * (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group - * name string. If a group name is specified, this method blocks while resolving - * the associated a numeric ID. - * - * ```js - * import process from 'node:process'; - * - * if (process.getegid && process.setegid) { - * console.log(`Current gid: ${process.getegid()}`); - * try { - * process.setegid(501); - * console.log(`New gid: ${process.getegid()}`); - * } catch (err) { - * console.log(`Failed to set gid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v2.0.0 - * @param id A group name or ID - */ - setegid?: (id: number | string) => void; - /** - * The `process.getgroups()` method returns an array with the supplementary group - * IDs. POSIX leaves it unspecified if the effective group ID is included but - * Node.js ensures it always is. - * - * ```js - * import process from 'node:process'; - * - * if (process.getgroups) { - * console.log(process.getgroups()); // [ 16, 21, 297 ] - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v0.9.4 - */ - getgroups?: () => number[]; - /** - * The `process.setgroups()` method sets the supplementary group IDs for the - * Node.js process. This is a privileged operation that requires the Node.js - * process to have `root` or the `CAP_SETGID` capability. - * - * The `groups` array can contain numeric group IDs, group names, or both. - * - * ```js - * import process from 'node:process'; - * - * if (process.getgroups && process.setgroups) { - * try { - * process.setgroups([501]); - * console.log(process.getgroups()); // new groups - * } catch (err) { - * console.log(`Failed to set groups: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v0.9.4 - */ - setgroups?: (groups: ReadonlyArray) => void; - /** - * The `process.setUncaughtExceptionCaptureCallback()` function sets a function - * that will be invoked when an uncaught exception occurs, which will receive the - * exception value itself as its first argument. - * - * If such a function is set, the `'uncaughtException'` event will - * not be emitted. If `--abort-on-uncaught-exception` was passed from the - * command line or set through `v8.setFlagsFromString()`, the process will - * not abort. Actions configured to take place on exceptions such as report - * generations will be affected too - * - * To unset the capture function, `process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this - * method with a non-`null` argument while another capture function is set will - * throw an error. - * - * Using this function is mutually exclusive with using the deprecated `domain` built-in module. - * @since v9.3.0 - */ - setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void; - /** - * Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}. - * @since v9.3.0 - */ - hasUncaughtExceptionCaptureCallback(): boolean; - /** - * The `process.sourceMapsEnabled` property returns whether the [Source Map v3](https://sourcemaps.info/spec.html) support for stack traces is enabled. - * @since v20.7.0 - * @experimental - */ - readonly sourceMapsEnabled: boolean; - /** - * This function enables or disables the [Source Map v3](https://sourcemaps.info/spec.html) support for - * stack traces. - * - * It provides same features as launching Node.js process with commandline options `--enable-source-maps`. - * - * Only source maps in JavaScript files that are loaded after source maps has been - * enabled will be parsed and loaded. - * @since v16.6.0, v14.18.0 - * @experimental - */ - setSourceMapsEnabled(value: boolean): void; - /** - * The `process.version` property contains the Node.js version string. - * - * ```js - * import { version } from 'node:process'; - * - * console.log(`Version: ${version}`); - * // Version: v14.8.0 - * ``` - * - * To get the version string without the prepended _v_, use`process.versions.node`. - * @since v0.1.3 - */ - readonly version: string; - /** - * The `process.versions` property returns an object listing the version strings of - * Node.js and its dependencies. `process.versions.modules` indicates the current - * ABI version, which is increased whenever a C++ API changes. Node.js will refuse - * to load modules that were compiled against a different module ABI version. - * - * ```js - * import { versions } from 'node:process'; - * - * console.log(versions); - * ``` - * - * Will generate an object similar to: - * - * ```console - * { node: '20.2.0', - * acorn: '8.8.2', - * ada: '2.4.0', - * ares: '1.19.0', - * base64: '0.5.0', - * brotli: '1.0.9', - * cjs_module_lexer: '1.2.2', - * cldr: '43.0', - * icu: '73.1', - * llhttp: '8.1.0', - * modules: '115', - * napi: '8', - * nghttp2: '1.52.0', - * nghttp3: '0.7.0', - * ngtcp2: '0.8.1', - * openssl: '3.0.8+quic', - * simdutf: '3.2.9', - * tz: '2023c', - * undici: '5.22.0', - * unicode: '15.0', - * uv: '1.44.2', - * uvwasi: '0.0.16', - * v8: '11.3.244.8-node.9', - * zlib: '1.2.13' } - * ``` - * @since v0.2.0 - */ - readonly versions: ProcessVersions; - /** - * The `process.config` property returns a frozen `Object` containing the - * JavaScript representation of the configure options used to compile the current - * Node.js executable. This is the same as the `config.gypi` file that was produced - * when running the `./configure` script. - * - * An example of the possible output looks like: - * - * ```js - * { - * target_defaults: - * { cflags: [], - * default_configuration: 'Release', - * defines: [], - * include_dirs: [], - * libraries: [] }, - * variables: - * { - * host_arch: 'x64', - * napi_build_version: 5, - * node_install_npm: 'true', - * node_prefix: '', - * node_shared_cares: 'false', - * node_shared_http_parser: 'false', - * node_shared_libuv: 'false', - * node_shared_zlib: 'false', - * node_use_openssl: 'true', - * node_shared_openssl: 'false', - * strict_aliasing: 'true', - * target_arch: 'x64', - * v8_use_snapshot: 1 - * } - * } - * ``` - * @since v0.7.7 - */ - readonly config: ProcessConfig; - /** - * The `process.kill()` method sends the `signal` to the process identified by`pid`. - * - * Signal names are strings such as `'SIGINT'` or `'SIGHUP'`. See `Signal Events` and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information. - * - * This method will throw an error if the target `pid` does not exist. As a special - * case, a signal of `0` can be used to test for the existence of a process. - * Windows platforms will throw an error if the `pid` is used to kill a process - * group. - * - * Even though the name of this function is `process.kill()`, it is really just a - * signal sender, like the `kill` system call. The signal sent may do something - * other than kill the target process. - * - * ```js - * import process, { kill } from 'node:process'; - * - * process.on('SIGHUP', () => { - * console.log('Got SIGHUP signal.'); - * }); - * - * setTimeout(() => { - * console.log('Exiting.'); - * process.exit(0); - * }, 100); - * - * kill(process.pid, 'SIGHUP'); - * ``` - * - * When `SIGUSR1` is received by a Node.js process, Node.js will start the - * debugger. See `Signal Events`. - * @since v0.0.6 - * @param pid A process ID - * @param [signal='SIGTERM'] The signal to send, either as a string or number. - */ - kill(pid: number, signal?: string | number): true; - /** - * Loads the environment configuration from a `.env` file into `process.env`. If - * the file is not found, error will be thrown. - * - * To load a specific .env file by specifying its path, use the following code: - * - * ```js - * import { loadEnvFile } from 'node:process'; - * - * loadEnvFile('./development.env') - * ``` - * @since v20.12.0 - * @param path The path to the .env file - */ - loadEnvFile(path?: PathLike): void; - /** - * The `process.pid` property returns the PID of the process. - * - * ```js - * import { pid } from 'node:process'; - * - * console.log(`This process is pid ${pid}`); - * ``` - * @since v0.1.15 - */ - readonly pid: number; - /** - * The `process.ppid` property returns the PID of the parent of the - * current process. - * - * ```js - * import { ppid } from 'node:process'; - * - * console.log(`The parent process is pid ${ppid}`); - * ``` - * @since v9.2.0, v8.10.0, v6.13.0 - */ - readonly ppid: number; - /** - * The `process.threadCpuUsage()` method returns the user and system CPU time usage of - * the current worker thread, in an object with properties `user` and `system`, whose - * values are microsecond values (millionth of a second). - * - * The result of a previous call to `process.threadCpuUsage()` can be passed as the - * argument to the function, to get a diff reading. - * @since v22.19.0 - * @param previousValue A previous return value from calling - * `process.threadCpuUsage()` - */ - threadCpuUsage(previousValue?: CpuUsage): CpuUsage; - /** - * The `process.title` property returns the current process title (i.e. returns - * the current value of `ps`). Assigning a new value to `process.title` modifies - * the current value of `ps`. - * - * When a new value is assigned, different platforms will impose different maximum - * length restrictions on the title. Usually such restrictions are quite limited. - * For instance, on Linux and macOS, `process.title` is limited to the size of the - * binary name plus the length of the command-line arguments because setting the `process.title` overwrites the `argv` memory of the process. Node.js v0.8 - * allowed for longer process title strings by also overwriting the `environ` memory but that was potentially insecure and confusing in some (rather obscure) - * cases. - * - * Assigning a value to `process.title` might not result in an accurate label - * within process manager applications such as macOS Activity Monitor or Windows - * Services Manager. - * @since v0.1.104 - */ - title: string; - /** - * The operating system CPU architecture for which the Node.js binary was compiled. - * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`. - * - * ```js - * import { arch } from 'node:process'; - * - * console.log(`This processor architecture is ${arch}`); - * ``` - * @since v0.5.0 - */ - readonly arch: Architecture; - /** - * The `process.platform` property returns a string identifying the operating - * system platform for which the Node.js binary was compiled. - * - * Currently possible values are: - * - * * `'aix'` - * * `'darwin'` - * * `'freebsd'` - * * `'linux'` - * * `'openbsd'` - * * `'sunos'` - * * `'win32'` - * - * ```js - * import { platform } from 'node:process'; - * - * console.log(`This platform is ${platform}`); - * ``` - * - * The value `'android'` may also be returned if the Node.js is built on the - * Android operating system. However, Android support in Node.js [is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). - * @since v0.1.16 - */ - readonly platform: Platform; - /** - * The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at - * runtime, `require.main` may still refer to the original main module in - * modules that were required before the change occurred. Generally, it's - * safe to assume that the two refer to the same module. - * - * As with `require.main`, `process.mainModule` will be `undefined` if there - * is no entry script. - * @since v0.1.17 - * @deprecated Since v14.0.0 - Use `main` instead. - */ - mainModule?: Module; - memoryUsage: MemoryUsageFn; - /** - * Gets the amount of memory available to the process (in bytes) based on - * limits imposed by the OS. If there is no such constraint, or the constraint - * is unknown, `0` is returned. - * - * See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more - * information. - * @since v19.6.0, v18.15.0 - */ - constrainedMemory(): number; - /** - * Gets the amount of free memory that is still available to the process (in bytes). - * See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v22.x/api/process.html#processavailablememory) for more information. - * @since v20.13.0 - */ - availableMemory(): number; - /** - * The `process.cpuUsage()` method returns the user and system CPU time usage of - * the current process, in an object with properties `user` and `system`, whose - * values are microsecond values (millionth of a second). These values measure time - * spent in user and system code respectively, and may end up being greater than - * actual elapsed time if multiple CPU cores are performing work for this process. - * - * The result of a previous call to `process.cpuUsage()` can be passed as the - * argument to the function, to get a diff reading. - * - * ```js - * import { cpuUsage } from 'node:process'; - * - * const startUsage = cpuUsage(); - * // { user: 38579, system: 6986 } - * - * // spin the CPU for 500 milliseconds - * const now = Date.now(); - * while (Date.now() - now < 500); - * - * console.log(cpuUsage(startUsage)); - * // { user: 514883, system: 11226 } - * ``` - * @since v6.1.0 - * @param previousValue A previous return value from calling `process.cpuUsage()` - */ - cpuUsage(previousValue?: CpuUsage): CpuUsage; - /** - * `process.nextTick()` adds `callback` to the "next tick queue". This queue is - * fully drained after the current operation on the JavaScript stack runs to - * completion and before the event loop is allowed to continue. It's possible to - * create an infinite loop if one were to recursively call `process.nextTick()`. - * See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background. - * - * ```js - * import { nextTick } from 'node:process'; - * - * console.log('start'); - * nextTick(() => { - * console.log('nextTick callback'); - * }); - * console.log('scheduled'); - * // Output: - * // start - * // scheduled - * // nextTick callback - * ``` - * - * This is important when developing APIs in order to give users the opportunity - * to assign event handlers _after_ an object has been constructed but before any - * I/O has occurred: - * - * ```js - * import { nextTick } from 'node:process'; - * - * function MyThing(options) { - * this.setupOptions(options); - * - * nextTick(() => { - * this.startDoingStuff(); - * }); - * } - * - * const thing = new MyThing(); - * thing.getReadyForStuff(); - * - * // thing.startDoingStuff() gets called now, not before. - * ``` - * - * It is very important for APIs to be either 100% synchronous or 100% - * asynchronous. Consider this example: - * - * ```js - * // WARNING! DO NOT USE! BAD UNSAFE HAZARD! - * function maybeSync(arg, cb) { - * if (arg) { - * cb(); - * return; - * } - * - * fs.stat('file', cb); - * } - * ``` - * - * This API is hazardous because in the following case: - * - * ```js - * const maybeTrue = Math.random() > 0.5; - * - * maybeSync(maybeTrue, () => { - * foo(); - * }); - * - * bar(); - * ``` - * - * It is not clear whether `foo()` or `bar()` will be called first. - * - * The following approach is much better: - * - * ```js - * import { nextTick } from 'node:process'; - * - * function definitelyAsync(arg, cb) { - * if (arg) { - * nextTick(cb); - * return; - * } - * - * fs.stat('file', cb); - * } - * ``` - * @since v0.1.26 - * @param args Additional arguments to pass when invoking the `callback` - */ - nextTick(callback: Function, ...args: any[]): void; - /** - * The process.noDeprecation property indicates whether the --no-deprecation flag is set on the current Node.js process. - * See the documentation for the ['warning' event](https://nodejs.org/docs/latest/api/process.html#event-warning) and the [emitWarning()](https://nodejs.org/docs/latest/api/process.html#processemitwarningwarning-type-code-ctor) method for more information about this flag's behavior. - */ - noDeprecation?: boolean; - /** - * This API is available through the [--permission](https://nodejs.org/api/cli.html#--permission) flag. - * - * `process.permission` is an object whose methods are used to manage permissions for the current process. - * Additional documentation is available in the [Permission Model](https://nodejs.org/api/permissions.html#permission-model). - * @since v20.0.0 - */ - permission: ProcessPermission; - /** - * The `process.release` property returns an `Object` containing metadata related - * to the current release, including URLs for the source tarball and headers-only - * tarball. - * - * `process.release` contains the following properties: - * - * ```js - * { - * name: 'node', - * lts: 'Hydrogen', - * sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz', - * headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz', - * libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib' - * } - * ``` - * - * In custom builds from non-release versions of the source tree, only the `name` property may be present. The additional properties should not be - * relied upon to exist. - * @since v3.0.0 - */ - readonly release: ProcessRelease; - readonly features: ProcessFeatures; - /** - * `process.umask()` returns the Node.js process's file mode creation mask. Child - * processes inherit the mask from the parent process. - * @since v0.1.19 - * @deprecated Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential - * security vulnerability. There is no safe, cross-platform alternative API. - */ - umask(): number; - /** - * Can only be set if not in worker thread. - */ - umask(mask: string | number): number; - /** - * The `process.uptime()` method returns the number of seconds the current Node.js - * process has been running. - * - * The return value includes fractions of a second. Use `Math.floor()` to get whole - * seconds. - * @since v0.5.0 - */ - uptime(): number; - hrtime: HRTime; - /** - * If the Node.js process was spawned with an IPC channel, the process.channel property is a reference to the IPC channel. - * If no IPC channel exists, this property is undefined. - * @since v7.1.0 - */ - channel?: Control; - /** - * If Node.js is spawned with an IPC channel, the `process.send()` method can be - * used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object. - * - * If Node.js was not spawned with an IPC channel, `process.send` will be `undefined`. - * - * The message goes through serialization and parsing. The resulting message might - * not be the same as what is originally sent. - * @since v0.5.9 - * @param options used to parameterize the sending of certain types of handles. `options` supports the following properties: - */ - send?( - message: any, - sendHandle?: SendHandle, - options?: MessageOptions, - callback?: (error: Error | null) => void, - ): boolean; - send?( - message: any, - sendHandle: SendHandle, - callback?: (error: Error | null) => void, - ): boolean; - send?( - message: any, - callback: (error: Error | null) => void, - ): boolean; - /** - * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the - * IPC channel to the parent process, allowing the child process to exit gracefully - * once there are no other connections keeping it alive. - * - * The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process. - * - * If the Node.js process was not spawned with an IPC channel, `process.disconnect()` will be `undefined`. - * @since v0.7.2 - */ - disconnect(): void; - /** - * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return `true` so long as the IPC - * channel is connected and will return `false` after `process.disconnect()` is called. - * - * Once `process.connected` is `false`, it is no longer possible to send messages - * over the IPC channel using `process.send()`. - * @since v0.7.2 - */ - connected: boolean; - /** - * The `process.allowedNodeEnvironmentFlags` property is a special, - * read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable. - * - * `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides `Set.prototype.has` to recognize several different possible flag - * representations. `process.allowedNodeEnvironmentFlags.has()` will - * return `true` in the following cases: - * - * * Flags may omit leading single (`-`) or double (`--`) dashes; e.g., `inspect-brk` for `--inspect-brk`, or `r` for `-r`. - * * Flags passed through to V8 (as listed in `--v8-options`) may replace - * one or more _non-leading_ dashes for an underscore, or vice-versa; - * e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`, - * etc. - * * Flags may contain one or more equals (`=`) characters; all - * characters after and including the first equals will be ignored; - * e.g., `--stack-trace-limit=100`. - * * Flags _must_ be allowable within `NODE_OPTIONS`. - * - * When iterating over `process.allowedNodeEnvironmentFlags`, flags will - * appear only _once_; each will begin with one or more dashes. Flags - * passed through to V8 will contain underscores instead of non-leading - * dashes: - * - * ```js - * import { allowedNodeEnvironmentFlags } from 'node:process'; - * - * allowedNodeEnvironmentFlags.forEach((flag) => { - * // -r - * // --inspect-brk - * // --abort_on_uncaught_exception - * // ... - * }); - * ``` - * - * The methods `add()`, `clear()`, and `delete()` of`process.allowedNodeEnvironmentFlags` do nothing, and will fail - * silently. - * - * If Node.js was compiled _without_ `NODE_OPTIONS` support (shown in {@link config}), `process.allowedNodeEnvironmentFlags` will - * contain what _would have_ been allowable. - * @since v10.10.0 - */ - allowedNodeEnvironmentFlags: ReadonlySet; - /** - * `process.report` is an object whose methods are used to generate diagnostic reports for the current process. - * Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v22.x/api/report.html). - * @since v11.8.0 - */ - report: ProcessReport; - /** - * ```js - * import { resourceUsage } from 'node:process'; - * - * console.log(resourceUsage()); - * /* - * Will output: - * { - * userCPUTime: 82872, - * systemCPUTime: 4143, - * maxRSS: 33164, - * sharedMemorySize: 0, - * unsharedDataSize: 0, - * unsharedStackSize: 0, - * minorPageFault: 2469, - * majorPageFault: 0, - * swappedOut: 0, - * fsRead: 0, - * fsWrite: 8, - * ipcSent: 0, - * ipcReceived: 0, - * signalsCount: 0, - * voluntaryContextSwitches: 79, - * involuntaryContextSwitches: 1 - * } - * - * ``` - * @since v12.6.0 - * @return the resource usage for the current process. All of these values come from the `uv_getrusage` call which returns a [`uv_rusage_t` struct][uv_rusage_t]. - */ - resourceUsage(): ResourceUsage; - /** - * The initial value of `process.throwDeprecation` indicates whether the `--throw-deprecation` flag is set on the current Node.js process. `process.throwDeprecation` - * is mutable, so whether or not deprecation warnings result in errors may be altered at runtime. See the documentation for the 'warning' event and the emitWarning() - * method for more information. - * - * ```bash - * $ node --throw-deprecation -p "process.throwDeprecation" - * true - * $ node -p "process.throwDeprecation" - * undefined - * $ node - * > process.emitWarning('test', 'DeprecationWarning'); - * undefined - * > (node:26598) DeprecationWarning: test - * > process.throwDeprecation = true; - * true - * > process.emitWarning('test', 'DeprecationWarning'); - * Thrown: - * [DeprecationWarning: test] { name: 'DeprecationWarning' } - * ``` - * @since v0.9.12 - */ - throwDeprecation: boolean; - /** - * The `process.traceDeprecation` property indicates whether the `--trace-deprecation` flag is set on the current Node.js process. See the - * documentation for the `'warning' event` and the `emitWarning() method` for more information about this - * flag's behavior. - * @since v0.8.0 - */ - traceDeprecation: boolean; - /** - * An object is "refable" if it implements the Node.js "Refable protocol". - * Specifically, this means that the object implements the `Symbol.for('nodejs.ref')` - * and `Symbol.for('nodejs.unref')` methods. "Ref'd" objects will keep the Node.js - * event loop alive, while "unref'd" objects will not. Historically, this was - * implemented by using `ref()` and `unref()` methods directly on the objects. - * This pattern, however, is being deprecated in favor of the "Refable protocol" - * in order to better support Web Platform API types whose APIs cannot be modified - * to add `ref()` and `unref()` methods but still need to support that behavior. - * @since v22.14.0 - * @experimental - * @param maybeRefable An object that may be "refable". - */ - ref(maybeRefable: any): void; - /** - * An object is "unrefable" if it implements the Node.js "Refable protocol". - * Specifically, this means that the object implements the `Symbol.for('nodejs.ref')` - * and `Symbol.for('nodejs.unref')` methods. "Ref'd" objects will keep the Node.js - * event loop alive, while "unref'd" objects will not. Historically, this was - * implemented by using `ref()` and `unref()` methods directly on the objects. - * This pattern, however, is being deprecated in favor of the "Refable protocol" - * in order to better support Web Platform API types whose APIs cannot be modified - * to add `ref()` and `unref()` methods but still need to support that behavior. - * @since v22.14.0 - * @experimental - * @param maybeRefable An object that may be "unref'd". - */ - unref(maybeRefable: any): void; - /** - * Replaces the current process with a new process. - * - * This is achieved by using the `execve` POSIX function and therefore no memory or other - * resources from the current process are preserved, except for the standard input, - * standard output and standard error file descriptor. - * - * All other resources are discarded by the system when the processes are swapped, without triggering - * any exit or close events and without running any cleanup handler. - * - * This function will never return, unless an error occurred. - * - * This function is not available on Windows or IBM i. - * @since v22.15.0 - * @experimental - * @param file The name or path of the executable file to run. - * @param args List of string arguments. No argument can contain a null-byte (`\u0000`). - * @param env Environment key-value pairs. - * No key or value can contain a null-byte (`\u0000`). - * **Default:** `process.env`. - */ - execve?(file: string, args?: readonly string[], env?: ProcessEnv): never; - /* EventEmitter */ - addListener(event: "beforeExit", listener: BeforeExitListener): this; - addListener(event: "disconnect", listener: DisconnectListener): this; - addListener(event: "exit", listener: ExitListener): this; - addListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - addListener(event: "warning", listener: WarningListener): this; - addListener(event: "message", listener: MessageListener): this; - addListener(event: "workerMessage", listener: (value: any, source: number) => void): this; - addListener(event: Signals, listener: SignalsListener): this; - addListener(event: "multipleResolves", listener: MultipleResolveListener): this; - addListener(event: "worker", listener: WorkerListener): this; - emit(event: "beforeExit", code: number): boolean; - emit(event: "disconnect"): boolean; - emit(event: "exit", code: number): boolean; - emit(event: "rejectionHandled", promise: Promise): boolean; - emit(event: "uncaughtException", error: Error): boolean; - emit(event: "uncaughtExceptionMonitor", error: Error): boolean; - emit(event: "unhandledRejection", reason: unknown, promise: Promise): boolean; - emit(event: "warning", warning: Error): boolean; - emit(event: "message", message: unknown, sendHandle: SendHandle): this; - emit(event: "workerMessage", value: any, source: number): this; - emit(event: Signals, signal?: Signals): boolean; - emit( - event: "multipleResolves", - type: MultipleResolveType, - promise: Promise, - value: unknown, - ): this; - emit(event: "worker", listener: WorkerListener): this; - on(event: "beforeExit", listener: BeforeExitListener): this; - on(event: "disconnect", listener: DisconnectListener): this; - on(event: "exit", listener: ExitListener): this; - on(event: "rejectionHandled", listener: RejectionHandledListener): this; - on(event: "uncaughtException", listener: UncaughtExceptionListener): this; - on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - on(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - on(event: "warning", listener: WarningListener): this; - on(event: "message", listener: MessageListener): this; - on(event: Signals, listener: SignalsListener): this; - on(event: "multipleResolves", listener: MultipleResolveListener): this; - on(event: "worker", listener: WorkerListener): this; - on(event: "workerMessage", listener: (value: any, source: number) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "beforeExit", listener: BeforeExitListener): this; - once(event: "disconnect", listener: DisconnectListener): this; - once(event: "exit", listener: ExitListener): this; - once(event: "rejectionHandled", listener: RejectionHandledListener): this; - once(event: "uncaughtException", listener: UncaughtExceptionListener): this; - once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - once(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - once(event: "warning", listener: WarningListener): this; - once(event: "message", listener: MessageListener): this; - once(event: Signals, listener: SignalsListener): this; - once(event: "multipleResolves", listener: MultipleResolveListener): this; - once(event: "worker", listener: WorkerListener): this; - once(event: "workerMessage", listener: (value: any, source: number) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "beforeExit", listener: BeforeExitListener): this; - prependListener(event: "disconnect", listener: DisconnectListener): this; - prependListener(event: "exit", listener: ExitListener): this; - prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependListener(event: "warning", listener: WarningListener): this; - prependListener(event: "message", listener: MessageListener): this; - prependListener(event: "workerMessage", listener: (value: any, source: number) => void): this; - prependListener(event: Signals, listener: SignalsListener): this; - prependListener(event: "multipleResolves", listener: MultipleResolveListener): this; - prependListener(event: "worker", listener: WorkerListener): this; - prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this; - prependOnceListener(event: "disconnect", listener: DisconnectListener): this; - prependOnceListener(event: "exit", listener: ExitListener): this; - prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependOnceListener(event: "warning", listener: WarningListener): this; - prependOnceListener(event: "message", listener: MessageListener): this; - prependOnceListener(event: "workerMessage", listener: (value: any, source: number) => void): this; - prependOnceListener(event: Signals, listener: SignalsListener): this; - prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this; - prependOnceListener(event: "worker", listener: WorkerListener): this; - listeners(event: "beforeExit"): BeforeExitListener[]; - listeners(event: "disconnect"): DisconnectListener[]; - listeners(event: "exit"): ExitListener[]; - listeners(event: "rejectionHandled"): RejectionHandledListener[]; - listeners(event: "uncaughtException"): UncaughtExceptionListener[]; - listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[]; - listeners(event: "unhandledRejection"): UnhandledRejectionListener[]; - listeners(event: "warning"): WarningListener[]; - listeners(event: "message"): MessageListener[]; - listeners(event: "workerMessage"): ((value: any, source: number) => void)[]; - listeners(event: Signals): SignalsListener[]; - listeners(event: "multipleResolves"): MultipleResolveListener[]; - listeners(event: "worker"): WorkerListener[]; - } - } - } - export = process; -} -declare module "node:process" { - import process = require("process"); - export = process; -} diff --git a/node_modules/@types/node/punycode.d.ts b/node_modules/@types/node/punycode.d.ts deleted file mode 100644 index 655c47b..0000000 --- a/node_modules/@types/node/punycode.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** - * **The version of the punycode module bundled in Node.js is being deprecated. **In a future major version of Node.js this module will be removed. Users - * currently depending on the `punycode` module should switch to using the - * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL - * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`. - * - * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It - * can be accessed using: - * - * ```js - * import punycode from 'node:punycode'; - * ``` - * - * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is - * primarily intended for use in Internationalized Domain Names. Because host - * names in URLs are limited to ASCII characters only, Domain Names that contain - * non-ASCII characters must be converted into ASCII using the Punycode scheme. - * For instance, the Japanese character that translates into the English word, `'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent - * to `'example.com'`) is represented by Punycode as the ASCII string `'xn--fsq.com'`. - * - * The `punycode` module provides a simple implementation of the Punycode standard. - * - * The `punycode` module is a third-party dependency used by Node.js and - * made available to developers as a convenience. Fixes or other modifications to - * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project. - * @deprecated Since v7.0.0 - Deprecated - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/punycode.js) - */ -declare module "punycode" { - /** - * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only - * characters to the equivalent string of Unicode codepoints. - * - * ```js - * punycode.decode('maana-pta'); // 'mañana' - * punycode.decode('--dqo34k'); // '☃-⌘' - * ``` - * @since v0.5.1 - */ - function decode(string: string): string; - /** - * The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters. - * - * ```js - * punycode.encode('mañana'); // 'maana-pta' - * punycode.encode('☃-⌘'); // '--dqo34k' - * ``` - * @since v0.5.1 - */ - function encode(string: string): string; - /** - * The `punycode.toUnicode()` method converts a string representing a domain name - * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be - * converted. - * - * ```js - * // decode domain names - * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com' - * punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com' - * punycode.toUnicode('example.com'); // 'example.com' - * ``` - * @since v0.6.1 - */ - function toUnicode(domain: string): string; - /** - * The `punycode.toASCII()` method converts a Unicode string representing an - * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the - * domain name will be converted. Calling `punycode.toASCII()` on a string that - * already only contains ASCII characters will have no effect. - * - * ```js - * // encode domain names - * punycode.toASCII('mañana.com'); // 'xn--maana-pta.com' - * punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com' - * punycode.toASCII('example.com'); // 'example.com' - * ``` - * @since v0.6.1 - */ - function toASCII(domain: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const ucs2: ucs2; - interface ucs2 { - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - decode(string: string): number[]; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - encode(codePoints: readonly number[]): string; - } - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const version: string; -} -declare module "node:punycode" { - export * from "punycode"; -} diff --git a/node_modules/@types/node/querystring.d.ts b/node_modules/@types/node/querystring.d.ts deleted file mode 100644 index f0d5257..0000000 --- a/node_modules/@types/node/querystring.d.ts +++ /dev/null @@ -1,152 +0,0 @@ -/** - * The `node:querystring` module provides utilities for parsing and formatting URL - * query strings. It can be accessed using: - * - * ```js - * import querystring from 'node:querystring'; - * ``` - * - * `querystring` is more performant than `URLSearchParams` but is not a - * standardized API. Use `URLSearchParams` when performance is not critical or - * when compatibility with browser code is desirable. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/querystring.js) - */ -declare module "querystring" { - interface StringifyOptions { - /** - * The function to use when converting URL-unsafe characters to percent-encoding in the query string. - * @default `querystring.escape()` - */ - encodeURIComponent?: ((str: string) => string) | undefined; - } - interface ParseOptions { - /** - * Specifies the maximum number of keys to parse. Specify `0` to remove key counting limitations. - * @default 1000 - */ - maxKeys?: number | undefined; - /** - * The function to use when decoding percent-encoded characters in the query string. - * @default `querystring.unescape()` - */ - decodeURIComponent?: ((str: string) => string) | undefined; - } - interface ParsedUrlQuery extends NodeJS.Dict {} - interface ParsedUrlQueryInput extends - NodeJS.Dict< - | string - | number - | boolean - | bigint - | ReadonlyArray - | null - > - {} - /** - * The `querystring.stringify()` method produces a URL query string from a - * given `obj` by iterating through the object's "own properties". - * - * It serializes the following types of values passed in `obj`: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | - * [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | - * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | - * [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | - * [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | - * [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | - * [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | - * [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to - * empty strings. - * - * ```js - * querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }); - * // Returns 'foo=bar&baz=qux&baz=quux&corge=' - * - * querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':'); - * // Returns 'foo:bar;baz:qux' - * ``` - * - * By default, characters requiring percent-encoding within the query string will - * be encoded as UTF-8\. If an alternative encoding is required, then an alternative `encodeURIComponent` option will need to be specified: - * - * ```js - * // Assuming gbkEncodeURIComponent function already exists, - * - * querystring.stringify({ w: '中文', foo: 'bar' }, null, null, - * { encodeURIComponent: gbkEncodeURIComponent }); - * ``` - * @since v0.1.25 - * @param obj The object to serialize into a URL query string - * @param [sep='&'] The substring used to delimit key and value pairs in the query string. - * @param [eq='='] . The substring used to delimit keys and values in the query string. - */ - function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string; - /** - * The `querystring.parse()` method parses a URL query string (`str`) into a - * collection of key and value pairs. - * - * For example, the query string `'foo=bar&abc=xyz&abc=123'` is parsed into: - * - * ```json - * { - * "foo": "bar", - * "abc": ["xyz", "123"] - * } - * ``` - * - * The object returned by the `querystring.parse()` method _does not_ prototypically inherit from the JavaScript `Object`. This means that typical `Object` methods such as `obj.toString()`, - * `obj.hasOwnProperty()`, and others - * are not defined and _will not work_. - * - * By default, percent-encoded characters within the query string will be assumed - * to use UTF-8 encoding. If an alternative character encoding is used, then an - * alternative `decodeURIComponent` option will need to be specified: - * - * ```js - * // Assuming gbkDecodeURIComponent function already exists... - * - * querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null, - * { decodeURIComponent: gbkDecodeURIComponent }); - * ``` - * @since v0.1.25 - * @param str The URL query string to parse - * @param [sep='&'] The substring used to delimit key and value pairs in the query string. - * @param [eq='='] The substring used to delimit keys and values in the query string. - */ - function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; - /** - * The querystring.encode() function is an alias for querystring.stringify(). - */ - const encode: typeof stringify; - /** - * The querystring.decode() function is an alias for querystring.parse(). - */ - const decode: typeof parse; - /** - * The `querystring.escape()` method performs URL percent-encoding on the given `str` in a manner that is optimized for the specific requirements of URL - * query strings. - * - * The `querystring.escape()` method is used by `querystring.stringify()` and is - * generally not expected to be used directly. It is exported primarily to allow - * application code to provide a replacement percent-encoding implementation if - * necessary by assigning `querystring.escape` to an alternative function. - * @since v0.1.25 - */ - function escape(str: string): string; - /** - * The `querystring.unescape()` method performs decoding of URL percent-encoded - * characters on the given `str`. - * - * The `querystring.unescape()` method is used by `querystring.parse()` and is - * generally not expected to be used directly. It is exported primarily to allow - * application code to provide a replacement decoding implementation if - * necessary by assigning `querystring.unescape` to an alternative function. - * - * By default, the `querystring.unescape()` method will attempt to use the - * JavaScript built-in `decodeURIComponent()` method to decode. If that fails, - * a safer equivalent that does not throw on malformed URLs will be used. - * @since v0.1.25 - */ - function unescape(str: string): string; -} -declare module "node:querystring" { - export * from "querystring"; -} diff --git a/node_modules/@types/node/readline.d.ts b/node_modules/@types/node/readline.d.ts deleted file mode 100644 index 338972e..0000000 --- a/node_modules/@types/node/readline.d.ts +++ /dev/null @@ -1,594 +0,0 @@ -/** - * The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v22.x/api/stream.html#readable-streams) stream - * (such as [`process.stdin`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdin)) one line at a time. - * - * To use the promise-based APIs: - * - * ```js - * import * as readline from 'node:readline/promises'; - * ``` - * - * To use the callback and sync APIs: - * - * ```js - * import * as readline from 'node:readline'; - * ``` - * - * The following simple example illustrates the basic use of the `node:readline` module. - * - * ```js - * import * as readline from 'node:readline/promises'; - * import { stdin as input, stdout as output } from 'node:process'; - * - * const rl = readline.createInterface({ input, output }); - * - * const answer = await rl.question('What do you think of Node.js? '); - * - * console.log(`Thank you for your valuable feedback: ${answer}`); - * - * rl.close(); - * ``` - * - * Once this code is invoked, the Node.js application will not terminate until the `readline.Interface` is closed because the interface waits for data to be - * received on the `input` stream. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/readline.js) - */ -declare module "readline" { - import { Abortable, EventEmitter } from "node:events"; - import * as promises from "node:readline/promises"; - export { promises }; - export interface Key { - sequence?: string | undefined; - name?: string | undefined; - ctrl?: boolean | undefined; - meta?: boolean | undefined; - shift?: boolean | undefined; - } - /** - * Instances of the `readline.Interface` class are constructed using the `readline.createInterface()` method. Every instance is associated with a - * single `input` [Readable](https://nodejs.org/docs/latest-v22.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/latest-v22.x/api/stream.html#writable-streams) stream. - * The `output` stream is used to print prompts for user input that arrives on, - * and is read from, the `input` stream. - * @since v0.1.104 - */ - export class Interface extends EventEmitter implements Disposable { - readonly terminal: boolean; - /** - * The current input data being processed by node. - * - * This can be used when collecting input from a TTY stream to retrieve the - * current value that has been processed thus far, prior to the `line` event - * being emitted. Once the `line` event has been emitted, this property will - * be an empty string. - * - * Be aware that modifying the value during the instance runtime may have - * unintended consequences if `rl.cursor` is not also controlled. - * - * **If not using a TTY stream for input, use the `'line'` event.** - * - * One possible use case would be as follows: - * - * ```js - * const values = ['lorem ipsum', 'dolor sit amet']; - * const rl = readline.createInterface(process.stdin); - * const showResults = debounce(() => { - * console.log( - * '\n', - * values.filter((val) => val.startsWith(rl.line)).join(' '), - * ); - * }, 300); - * process.stdin.on('keypress', (c, k) => { - * showResults(); - * }); - * ``` - * @since v0.1.98 - */ - readonly line: string; - /** - * The cursor position relative to `rl.line`. - * - * This will track where the current cursor lands in the input string, when - * reading input from a TTY stream. The position of cursor determines the - * portion of the input string that will be modified as input is processed, - * as well as the column where the terminal caret will be rendered. - * @since v0.1.98 - */ - readonly cursor: number; - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v22.x/docs/api/readline.html#class-interfaceconstructor - */ - protected constructor( - input: NodeJS.ReadableStream, - output?: NodeJS.WritableStream, - completer?: Completer | AsyncCompleter, - terminal?: boolean, - ); - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v22.x/docs/api/readline.html#class-interfaceconstructor - */ - protected constructor(options: ReadLineOptions); - /** - * The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`. - * @since v15.3.0, v14.17.0 - * @return the current prompt string - */ - getPrompt(): string; - /** - * The `rl.setPrompt()` method sets the prompt that will be written to `output` whenever `rl.prompt()` is called. - * @since v0.1.98 - */ - setPrompt(prompt: string): void; - /** - * The `rl.prompt()` method writes the `Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new - * location at which to provide input. - * - * When called, `rl.prompt()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or `undefined` the prompt is not written. - * @since v0.1.98 - * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`. - */ - prompt(preserveCursor?: boolean): void; - /** - * The `rl.question()` method displays the `query` by writing it to the `output`, - * waits for user input to be provided on `input`, then invokes the `callback` function passing the provided input as the first argument. - * - * When called, `rl.question()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or `undefined` the `query` is not written. - * - * The `callback` function passed to `rl.question()` does not follow the typical - * pattern of accepting an `Error` object or `null` as the first argument. - * The `callback` is called with the provided answer as the only argument. - * - * An error will be thrown if calling `rl.question()` after `rl.close()`. - * - * Example usage: - * - * ```js - * rl.question('What is your favorite food? ', (answer) => { - * console.log(`Oh, so your favorite food is ${answer}`); - * }); - * ``` - * - * Using an `AbortController` to cancel a question. - * - * ```js - * const ac = new AbortController(); - * const signal = ac.signal; - * - * rl.question('What is your favorite food? ', { signal }, (answer) => { - * console.log(`Oh, so your favorite food is ${answer}`); - * }); - * - * signal.addEventListener('abort', () => { - * console.log('The food question timed out'); - * }, { once: true }); - * - * setTimeout(() => ac.abort(), 10000); - * ``` - * @since v0.3.3 - * @param query A statement or query to write to `output`, prepended to the prompt. - * @param callback A callback function that is invoked with the user's input in response to the `query`. - */ - question(query: string, callback: (answer: string) => void): void; - question(query: string, options: Abortable, callback: (answer: string) => void): void; - /** - * The `rl.pause()` method pauses the `input` stream, allowing it to be resumed - * later if necessary. - * - * Calling `rl.pause()` does not immediately pause other events (including `'line'`) from being emitted by the `Interface` instance. - * @since v0.3.4 - */ - pause(): this; - /** - * The `rl.resume()` method resumes the `input` stream if it has been paused. - * @since v0.3.4 - */ - resume(): this; - /** - * The `rl.close()` method closes the `Interface` instance and - * relinquishes control over the `input` and `output` streams. When called, - * the `'close'` event will be emitted. - * - * Calling `rl.close()` does not immediately stop other events (including `'line'`) - * from being emitted by the `Interface` instance. - * @since v0.1.98 - */ - close(): void; - /** - * Alias for `rl.close()`. - * @since v22.15.0 - */ - [Symbol.dispose](): void; - /** - * The `rl.write()` method will write either `data` or a key sequence identified - * by `key` to the `output`. The `key` argument is supported only if `output` is - * a `TTY` text terminal. See `TTY keybindings` for a list of key - * combinations. - * - * If `key` is specified, `data` is ignored. - * - * When called, `rl.write()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or `undefined` the `data` and `key` are not written. - * - * ```js - * rl.write('Delete this!'); - * // Simulate Ctrl+U to delete the line written previously - * rl.write(null, { ctrl: true, name: 'u' }); - * ``` - * - * The `rl.write()` method will write the data to the `readline` `Interface`'s `input` _as if it were provided by the user_. - * @since v0.1.98 - */ - write(data: string | Buffer, key?: Key): void; - write(data: undefined | null | string | Buffer, key: Key): void; - /** - * Returns the real position of the cursor in relation to the input - * prompt + string. Long input (wrapping) strings, as well as multiple - * line prompts are included in the calculations. - * @since v13.5.0, v12.16.0 - */ - getCursorPos(): CursorPos; - /** - * events.EventEmitter - * 1. close - * 2. line - * 3. pause - * 4. resume - * 5. SIGCONT - * 6. SIGINT - * 7. SIGTSTP - * 8. history - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - addListener(event: "history", listener: (history: string[]) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - emit(event: "history", history: string[]): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - on(event: "history", listener: (history: string[]) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - once(event: "history", listener: (history: string[]) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - prependListener(event: "history", listener: (history: string[]) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - prependOnceListener(event: "history", listener: (history: string[]) => void): this; - [Symbol.asyncIterator](): NodeJS.AsyncIterator; - } - export type ReadLine = Interface; // type forwarded for backwards compatibility - export type Completer = (line: string) => CompleterResult; - export type AsyncCompleter = ( - line: string, - callback: (err?: null | Error, result?: CompleterResult) => void, - ) => void; - export type CompleterResult = [string[], string]; - export interface ReadLineOptions { - /** - * The [`Readable`](https://nodejs.org/docs/latest-v22.x/api/stream.html#readable-streams) stream to listen to - */ - input: NodeJS.ReadableStream; - /** - * The [`Writable`](https://nodejs.org/docs/latest-v22.x/api/stream.html#writable-streams) stream to write readline data to. - */ - output?: NodeJS.WritableStream | undefined; - /** - * An optional function used for Tab autocompletion. - */ - completer?: Completer | AsyncCompleter | undefined; - /** - * `true` if the `input` and `output` streams should be treated like a TTY, - * and have ANSI/VT100 escape codes written to it. - * Default: checking `isTTY` on the `output` stream upon instantiation. - */ - terminal?: boolean | undefined; - /** - * Initial list of history lines. - * This option makes sense only if `terminal` is set to `true` by the user or by an internal `output` check, - * otherwise the history caching mechanism is not initialized at all. - * @default [] - */ - history?: string[] | undefined; - /** - * Maximum number of history lines retained. - * To disable the history set this value to `0`. - * This option makes sense only if `terminal` is set to `true` by the user or by an internal `output` check, - * otherwise the history caching mechanism is not initialized at all. - * @default 30 - */ - historySize?: number | undefined; - /** - * If `true`, when a new input line added to the history list duplicates an older one, - * this removes the older line from the list. - * @default false - */ - removeHistoryDuplicates?: boolean | undefined; - /** - * The prompt string to use. - * @default "> " - */ - prompt?: string | undefined; - /** - * If the delay between `\r` and `\n` exceeds `crlfDelay` milliseconds, - * both `\r` and `\n` will be treated as separate end-of-line input. - * `crlfDelay` will be coerced to a number no less than `100`. - * It can be set to `Infinity`, in which case - * `\r` followed by `\n` will always be considered a single newline - * (which may be reasonable for [reading files](https://nodejs.org/docs/latest-v22.x/api/readline.html#example-read-file-stream-line-by-line) with `\r\n` line delimiter). - * @default 100 - */ - crlfDelay?: number | undefined; - /** - * The duration `readline` will wait for a character - * (when reading an ambiguous key sequence in milliseconds - * one that can both form a complete key sequence using the input read so far - * and can take additional input to complete a longer key sequence). - * @default 500 - */ - escapeCodeTimeout?: number | undefined; - /** - * The number of spaces a tab is equal to (minimum 1). - * @default 8 - */ - tabSize?: number | undefined; - /** - * Allows closing the interface using an AbortSignal. - * Aborting the signal will internally call `close` on the interface. - */ - signal?: AbortSignal | undefined; - } - /** - * The `readline.createInterface()` method creates a new `readline.Interface` instance. - * - * ```js - * import readline from 'node:readline'; - * const rl = readline.createInterface({ - * input: process.stdin, - * output: process.stdout, - * }); - * ``` - * - * Once the `readline.Interface` instance is created, the most common case is to - * listen for the `'line'` event: - * - * ```js - * rl.on('line', (line) => { - * console.log(`Received: ${line}`); - * }); - * ``` - * - * If `terminal` is `true` for this instance then the `output` stream will get - * the best compatibility if it defines an `output.columns` property and emits - * a `'resize'` event on the `output` if or when the columns ever change - * (`process.stdout` does this automatically when it is a TTY). - * - * When creating a `readline.Interface` using `stdin` as input, the program - * will not terminate until it receives an [EOF character](https://en.wikipedia.org/wiki/End-of-file#EOF_character). To exit without - * waiting for user input, call `process.stdin.unref()`. - * @since v0.1.98 - */ - export function createInterface( - input: NodeJS.ReadableStream, - output?: NodeJS.WritableStream, - completer?: Completer | AsyncCompleter, - terminal?: boolean, - ): Interface; - export function createInterface(options: ReadLineOptions): Interface; - /** - * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input. - * - * Optionally, `interface` specifies a `readline.Interface` instance for which - * autocompletion is disabled when copy-pasted input is detected. - * - * If the `stream` is a `TTY`, then it must be in raw mode. - * - * This is automatically called by any readline instance on its `input` if the `input` is a terminal. Closing the `readline` instance does not stop - * the `input` from emitting `'keypress'` events. - * - * ```js - * readline.emitKeypressEvents(process.stdin); - * if (process.stdin.isTTY) - * process.stdin.setRawMode(true); - * ``` - * - * ## Example: Tiny CLI - * - * The following example illustrates the use of `readline.Interface` class to - * implement a small command-line interface: - * - * ```js - * import readline from 'node:readline'; - * const rl = readline.createInterface({ - * input: process.stdin, - * output: process.stdout, - * prompt: 'OHAI> ', - * }); - * - * rl.prompt(); - * - * rl.on('line', (line) => { - * switch (line.trim()) { - * case 'hello': - * console.log('world!'); - * break; - * default: - * console.log(`Say what? I might have heard '${line.trim()}'`); - * break; - * } - * rl.prompt(); - * }).on('close', () => { - * console.log('Have a great day!'); - * process.exit(0); - * }); - * ``` - * - * ## Example: Read file stream line-by-Line - * - * A common use case for `readline` is to consume an input file one line at a - * time. The easiest way to do so is leveraging the `fs.ReadStream` API as - * well as a `for await...of` loop: - * - * ```js - * import fs from 'node:fs'; - * import readline from 'node:readline'; - * - * async function processLineByLine() { - * const fileStream = fs.createReadStream('input.txt'); - * - * const rl = readline.createInterface({ - * input: fileStream, - * crlfDelay: Infinity, - * }); - * // Note: we use the crlfDelay option to recognize all instances of CR LF - * // ('\r\n') in input.txt as a single line break. - * - * for await (const line of rl) { - * // Each line in input.txt will be successively available here as `line`. - * console.log(`Line from file: ${line}`); - * } - * } - * - * processLineByLine(); - * ``` - * - * Alternatively, one could use the `'line'` event: - * - * ```js - * import fs from 'node:fs'; - * import readline from 'node:readline'; - * - * const rl = readline.createInterface({ - * input: fs.createReadStream('sample.txt'), - * crlfDelay: Infinity, - * }); - * - * rl.on('line', (line) => { - * console.log(`Line from file: ${line}`); - * }); - * ``` - * - * Currently, `for await...of` loop can be a bit slower. If `async` / `await` flow and speed are both essential, a mixed approach can be applied: - * - * ```js - * import { once } from 'node:events'; - * import { createReadStream } from 'node:fs'; - * import { createInterface } from 'node:readline'; - * - * (async function processLineByLine() { - * try { - * const rl = createInterface({ - * input: createReadStream('big-file.txt'), - * crlfDelay: Infinity, - * }); - * - * rl.on('line', (line) => { - * // Process the line. - * }); - * - * await once(rl, 'close'); - * - * console.log('File processed.'); - * } catch (err) { - * console.error(err); - * } - * })(); - * ``` - * @since v0.7.7 - */ - export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void; - export type Direction = -1 | 0 | 1; - export interface CursorPos { - rows: number; - cols: number; - } - /** - * The `readline.clearLine()` method clears current line of given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) stream - * in a specified direction identified by `dir`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean; - /** - * The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) stream from - * the current position of the cursor down. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean; - /** - * The `readline.cursorTo()` method moves cursor to the specified position in a - * given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) `stream`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; - /** - * The `readline.moveCursor()` method moves the cursor _relative_ to its current - * position in a given [TTY](https://nodejs.org/docs/latest-v22.x/api/tty.html) `stream`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean; -} -declare module "node:readline" { - export * from "readline"; -} diff --git a/node_modules/@types/node/readline/promises.d.ts b/node_modules/@types/node/readline/promises.d.ts deleted file mode 100644 index 5bc9a0c..0000000 --- a/node_modules/@types/node/readline/promises.d.ts +++ /dev/null @@ -1,161 +0,0 @@ -/** - * @since v17.0.0 - */ -declare module "readline/promises" { - import { Abortable } from "node:events"; - import { - CompleterResult, - Direction, - Interface as _Interface, - ReadLineOptions as _ReadLineOptions, - } from "node:readline"; - /** - * Instances of the `readlinePromises.Interface` class are constructed using the `readlinePromises.createInterface()` method. Every instance is associated with a - * single `input` `Readable` stream and a single `output` `Writable` stream. - * The `output` stream is used to print prompts for user input that arrives on, - * and is read from, the `input` stream. - * @since v17.0.0 - */ - class Interface extends _Interface { - /** - * The `rl.question()` method displays the `query` by writing it to the `output`, - * waits for user input to be provided on `input`, then invokes the `callback` function passing the provided input as the first argument. - * - * When called, `rl.question()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or `undefined` the `query` is not written. - * - * If the question is called after `rl.close()`, it returns a rejected promise. - * - * Example usage: - * - * ```js - * const answer = await rl.question('What is your favorite food? '); - * console.log(`Oh, so your favorite food is ${answer}`); - * ``` - * - * Using an `AbortSignal` to cancel a question. - * - * ```js - * const signal = AbortSignal.timeout(10_000); - * - * signal.addEventListener('abort', () => { - * console.log('The food question timed out'); - * }, { once: true }); - * - * const answer = await rl.question('What is your favorite food? ', { signal }); - * console.log(`Oh, so your favorite food is ${answer}`); - * ``` - * @since v17.0.0 - * @param query A statement or query to write to `output`, prepended to the prompt. - * @return A promise that is fulfilled with the user's input in response to the `query`. - */ - question(query: string): Promise; - question(query: string, options: Abortable): Promise; - } - /** - * @since v17.0.0 - */ - class Readline { - /** - * @param stream A TTY stream. - */ - constructor( - stream: NodeJS.WritableStream, - options?: { - autoCommit?: boolean | undefined; - }, - ); - /** - * The `rl.clearLine()` method adds to the internal list of pending action an - * action that clears current line of the associated `stream` in a specified - * direction identified by `dir`. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor. - * @since v17.0.0 - * @return this - */ - clearLine(dir: Direction): this; - /** - * The `rl.clearScreenDown()` method adds to the internal list of pending action an - * action that clears the associated stream from the current position of the - * cursor down. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor. - * @since v17.0.0 - * @return this - */ - clearScreenDown(): this; - /** - * The `rl.commit()` method sends all the pending actions to the associated `stream` and clears the internal list of pending actions. - * @since v17.0.0 - */ - commit(): Promise; - /** - * The `rl.cursorTo()` method adds to the internal list of pending action an action - * that moves cursor to the specified position in the associated `stream`. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor. - * @since v17.0.0 - * @return this - */ - cursorTo(x: number, y?: number): this; - /** - * The `rl.moveCursor()` method adds to the internal list of pending action an - * action that moves the cursor _relative_ to its current position in the - * associated `stream`. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor. - * @since v17.0.0 - * @return this - */ - moveCursor(dx: number, dy: number): this; - /** - * The `rl.rollback` methods clears the internal list of pending actions without - * sending it to the associated `stream`. - * @since v17.0.0 - * @return this - */ - rollback(): this; - } - type Completer = (line: string) => CompleterResult | Promise; - interface ReadLineOptions extends Omit<_ReadLineOptions, "completer"> { - /** - * An optional function used for Tab autocompletion. - */ - completer?: Completer | undefined; - } - /** - * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance. - * - * ```js - * import readlinePromises from 'node:readline/promises'; - * const rl = readlinePromises.createInterface({ - * input: process.stdin, - * output: process.stdout, - * }); - * ``` - * - * Once the `readlinePromises.Interface` instance is created, the most common case - * is to listen for the `'line'` event: - * - * ```js - * rl.on('line', (line) => { - * console.log(`Received: ${line}`); - * }); - * ``` - * - * If `terminal` is `true` for this instance then the `output` stream will get - * the best compatibility if it defines an `output.columns` property and emits - * a `'resize'` event on the `output` if or when the columns ever change - * (`process.stdout` does this automatically when it is a TTY). - * @since v17.0.0 - */ - function createInterface( - input: NodeJS.ReadableStream, - output?: NodeJS.WritableStream, - completer?: Completer, - terminal?: boolean, - ): Interface; - function createInterface(options: ReadLineOptions): Interface; -} -declare module "node:readline/promises" { - export * from "readline/promises"; -} diff --git a/node_modules/@types/node/repl.d.ts b/node_modules/@types/node/repl.d.ts deleted file mode 100644 index fb858da..0000000 --- a/node_modules/@types/node/repl.d.ts +++ /dev/null @@ -1,428 +0,0 @@ -/** - * The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation - * that is available both as a standalone program or includible in other - * applications. It can be accessed using: - * - * ```js - * import repl from 'node:repl'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/repl.js) - */ -declare module "repl" { - import { AsyncCompleter, Completer, Interface } from "node:readline"; - import { Context } from "node:vm"; - import { InspectOptions } from "node:util"; - interface ReplOptions { - /** - * The input prompt to display. - * @default "> " - */ - prompt?: string | undefined; - /** - * The `Readable` stream from which REPL input will be read. - * @default process.stdin - */ - input?: NodeJS.ReadableStream | undefined; - /** - * The `Writable` stream to which REPL output will be written. - * @default process.stdout - */ - output?: NodeJS.WritableStream | undefined; - /** - * If `true`, specifies that the output should be treated as a TTY terminal, and have - * ANSI/VT100 escape codes written to it. - * Default: checking the value of the `isTTY` property on the output stream upon - * instantiation. - */ - terminal?: boolean | undefined; - /** - * The function to be used when evaluating each given line of input. - * **Default:** an async wrapper for the JavaScript `eval()` function. An `eval` function can - * error with `repl.Recoverable` to indicate the input was incomplete and prompt for - * additional lines. See the [custom evaluation functions](https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#custom-evaluation-functions) - * section for more details. - */ - eval?: REPLEval | undefined; - /** - * Defines if the repl prints output previews or not. - * @default `true` Always `false` in case `terminal` is falsy. - */ - preview?: boolean | undefined; - /** - * If `true`, specifies that the default `writer` function should include ANSI color - * styling to REPL output. If a custom `writer` function is provided then this has no - * effect. - * @default the REPL instance's `terminal` value - */ - useColors?: boolean | undefined; - /** - * If `true`, specifies that the default evaluation function will use the JavaScript - * `global` as the context as opposed to creating a new separate context for the REPL - * instance. The node CLI REPL sets this value to `true`. - * @default false - */ - useGlobal?: boolean | undefined; - /** - * If `true`, specifies that the default writer will not output the return value of a - * command if it evaluates to `undefined`. - * @default false - */ - ignoreUndefined?: boolean | undefined; - /** - * The function to invoke to format the output of each command before writing to `output`. - * @default a wrapper for `util.inspect` - * - * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_customizing_repl_output - */ - writer?: REPLWriter | undefined; - /** - * An optional function used for custom Tab auto completion. - * - * @see https://nodejs.org/dist/latest-v22.x/docs/api/readline.html#readline_use_of_the_completer_function - */ - completer?: Completer | AsyncCompleter | undefined; - /** - * A flag that specifies whether the default evaluator executes all JavaScript commands in - * strict mode or default (sloppy) mode. - * Accepted values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined; - /** - * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is - * pressed. This cannot be used together with a custom `eval` function. - * @default false - */ - breakEvalOnSigint?: boolean | undefined; - } - type REPLEval = ( - this: REPLServer, - evalCmd: string, - context: Context, - file: string, - cb: (err: Error | null, result: any) => void, - ) => void; - type REPLWriter = (this: REPLServer, obj: any) => string; - /** - * This is the default "writer" value, if none is passed in the REPL options, - * and it can be overridden by custom print functions. - */ - const writer: REPLWriter & { - options: InspectOptions; - }; - type REPLCommandAction = (this: REPLServer, text: string) => void; - interface REPLCommand { - /** - * Help text to be displayed when `.help` is entered. - */ - help?: string | undefined; - /** - * The function to execute, optionally accepting a single string argument. - */ - action: REPLCommandAction; - } - /** - * Instances of `repl.REPLServer` are created using the {@link start} method - * or directly using the JavaScript `new` keyword. - * - * ```js - * import repl from 'node:repl'; - * - * const options = { useColors: true }; - * - * const firstInstance = repl.start(options); - * const secondInstance = new repl.REPLServer(options); - * ``` - * @since v0.1.91 - */ - class REPLServer extends Interface { - /** - * The `vm.Context` provided to the `eval` function to be used for JavaScript - * evaluation. - */ - readonly context: Context; - /** - * @deprecated since v14.3.0 - Use `input` instead. - */ - readonly inputStream: NodeJS.ReadableStream; - /** - * @deprecated since v14.3.0 - Use `output` instead. - */ - readonly outputStream: NodeJS.WritableStream; - /** - * The `Readable` stream from which REPL input will be read. - */ - readonly input: NodeJS.ReadableStream; - /** - * The `Writable` stream to which REPL output will be written. - */ - readonly output: NodeJS.WritableStream; - /** - * The commands registered via `replServer.defineCommand()`. - */ - readonly commands: NodeJS.ReadOnlyDict; - /** - * A value indicating whether the REPL is currently in "editor mode". - * - * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_commands_and_special_keys - */ - readonly editorMode: boolean; - /** - * A value indicating whether the `_` variable has been assigned. - * - * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreAssigned: boolean; - /** - * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). - * - * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly last: any; - /** - * A value indicating whether the `_error` variable has been assigned. - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreErrAssigned: boolean; - /** - * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly lastError: any; - /** - * Specified in the REPL options, this is the function to be used when evaluating each - * given line of input. If not specified in the REPL options, this is an async wrapper - * for the JavaScript `eval()` function. - */ - readonly eval: REPLEval; - /** - * Specified in the REPL options, this is a value indicating whether the default - * `writer` function should include ANSI color styling to REPL output. - */ - readonly useColors: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `eval` - * function will use the JavaScript `global` as the context as opposed to creating a new - * separate context for the REPL instance. - */ - readonly useGlobal: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `writer` - * function should output the result of a command if it evaluates to `undefined`. - */ - readonly ignoreUndefined: boolean; - /** - * Specified in the REPL options, this is the function to invoke to format the output of - * each command before writing to `outputStream`. If not specified in the REPL options, - * this will be a wrapper for `util.inspect`. - */ - readonly writer: REPLWriter; - /** - * Specified in the REPL options, this is the function to use for custom Tab auto-completion. - */ - readonly completer: Completer | AsyncCompleter; - /** - * Specified in the REPL options, this is a flag that specifies whether the default `eval` - * function should execute all JavaScript commands in strict mode or default (sloppy) mode. - * Possible values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; - /** - * NOTE: According to the documentation: - * - * > Instances of `repl.REPLServer` are created using the `repl.start()` method and - * > _should not_ be created directly using the JavaScript `new` keyword. - * - * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. - * - * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_class_replserver - */ - private constructor(); - /** - * The `replServer.defineCommand()` method is used to add new `.`\-prefixed commands - * to the REPL instance. Such commands are invoked by typing a `.` followed by the `keyword`. The `cmd` is either a `Function` or an `Object` with the following - * properties: - * - * The following example shows two new commands added to the REPL instance: - * - * ```js - * import repl from 'node:repl'; - * - * const replServer = repl.start({ prompt: '> ' }); - * replServer.defineCommand('sayhello', { - * help: 'Say hello', - * action(name) { - * this.clearBufferedCommand(); - * console.log(`Hello, ${name}!`); - * this.displayPrompt(); - * }, - * }); - * replServer.defineCommand('saybye', function saybye() { - * console.log('Goodbye!'); - * this.close(); - * }); - * ``` - * - * The new commands can then be used from within the REPL instance: - * - * ```console - * > .sayhello Node.js User - * Hello, Node.js User! - * > .saybye - * Goodbye! - * ``` - * @since v0.3.0 - * @param keyword The command keyword (_without_ a leading `.` character). - * @param cmd The function to invoke when the command is processed. - */ - defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; - /** - * The `replServer.displayPrompt()` method readies the REPL instance for input - * from the user, printing the configured `prompt` to a new line in the `output` and resuming the `input` to accept new input. - * - * When multi-line input is being entered, an ellipsis is printed rather than the - * 'prompt'. - * - * When `preserveCursor` is `true`, the cursor placement will not be reset to `0`. - * - * The `replServer.displayPrompt` method is primarily intended to be called from - * within the action function for commands registered using the `replServer.defineCommand()` method. - * @since v0.1.91 - */ - displayPrompt(preserveCursor?: boolean): void; - /** - * The `replServer.clearBufferedCommand()` method clears any command that has been - * buffered but not yet executed. This method is primarily intended to be - * called from within the action function for commands registered using the `replServer.defineCommand()` method. - * @since v9.0.0 - */ - clearBufferedCommand(): void; - /** - * Initializes a history log file for the REPL instance. When executing the - * Node.js binary and using the command-line REPL, a history file is initialized - * by default. However, this is not the case when creating a REPL - * programmatically. Use this method to initialize a history log file when working - * with REPL instances programmatically. - * @since v11.10.0 - * @param historyPath the path to the history file - * @param callback called when history writes are ready or upon error - */ - setupHistory(path: string, callback: (err: Error | null, repl: this) => void): void; - /** - * events.EventEmitter - * 1. close - inherited from `readline.Interface` - * 2. line - inherited from `readline.Interface` - * 3. pause - inherited from `readline.Interface` - * 4. resume - inherited from `readline.Interface` - * 5. SIGCONT - inherited from `readline.Interface` - * 6. SIGINT - inherited from `readline.Interface` - * 7. SIGTSTP - inherited from `readline.Interface` - * 8. exit - * 9. reset - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - addListener(event: "exit", listener: () => void): this; - addListener(event: "reset", listener: (context: Context) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - emit(event: "exit"): boolean; - emit(event: "reset", context: Context): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - on(event: "exit", listener: () => void): this; - on(event: "reset", listener: (context: Context) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - once(event: "exit", listener: () => void): this; - once(event: "reset", listener: (context: Context) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - prependListener(event: "exit", listener: () => void): this; - prependListener(event: "reset", listener: (context: Context) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - prependOnceListener(event: "exit", listener: () => void): this; - prependOnceListener(event: "reset", listener: (context: Context) => void): this; - } - /** - * A flag passed in the REPL options. Evaluates expressions in sloppy mode. - */ - const REPL_MODE_SLOPPY: unique symbol; - /** - * A flag passed in the REPL options. Evaluates expressions in strict mode. - * This is equivalent to prefacing every repl statement with `'use strict'`. - */ - const REPL_MODE_STRICT: unique symbol; - /** - * The `repl.start()` method creates and starts a {@link REPLServer} instance. - * - * If `options` is a string, then it specifies the input prompt: - * - * ```js - * import repl from 'node:repl'; - * - * // a Unix style prompt - * repl.start('$ '); - * ``` - * @since v0.1.91 - */ - function start(options?: string | ReplOptions): REPLServer; - /** - * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. - * - * @see https://nodejs.org/dist/latest-v22.x/docs/api/repl.html#repl_recoverable_errors - */ - class Recoverable extends SyntaxError { - err: Error; - constructor(err: Error); - } -} -declare module "node:repl" { - export * from "repl"; -} diff --git a/node_modules/@types/node/sea.d.ts b/node_modules/@types/node/sea.d.ts deleted file mode 100644 index 3013074..0000000 --- a/node_modules/@types/node/sea.d.ts +++ /dev/null @@ -1,153 +0,0 @@ -/** - * This feature allows the distribution of a Node.js application conveniently to a - * system that does not have Node.js installed. - * - * Node.js supports the creation of [single executable applications](https://github.com/nodejs/single-executable) by allowing - * the injection of a blob prepared by Node.js, which can contain a bundled script, - * into the `node` binary. During start up, the program checks if anything has been - * injected. If the blob is found, it executes the script in the blob. Otherwise - * Node.js operates as it normally does. - * - * The single executable application feature currently only supports running a - * single embedded script using the `CommonJS` module system. - * - * Users can create a single executable application from their bundled script - * with the `node` binary itself and any tool which can inject resources into the - * binary. - * - * Here are the steps for creating a single executable application using one such - * tool, [postject](https://github.com/nodejs/postject): - * - * 1. Create a JavaScript file: - * ```bash - * echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js - * ``` - * 2. Create a configuration file building a blob that can be injected into the - * single executable application (see `Generating single executable preparation blobs` for details): - * ```bash - * echo '{ "main": "hello.js", "output": "sea-prep.blob" }' > sea-config.json - * ``` - * 3. Generate the blob to be injected: - * ```bash - * node --experimental-sea-config sea-config.json - * ``` - * 4. Create a copy of the `node` executable and name it according to your needs: - * * On systems other than Windows: - * ```bash - * cp $(command -v node) hello - * ``` - * * On Windows: - * ```text - * node -e "require('fs').copyFileSync(process.execPath, 'hello.exe')" - * ``` - * The `.exe` extension is necessary. - * 5. Remove the signature of the binary (macOS and Windows only): - * * On macOS: - * ```bash - * codesign --remove-signature hello - * ``` - * * On Windows (optional): - * [signtool](https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool) can be used from the installed [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/). - * If this step is - * skipped, ignore any signature-related warning from postject. - * ```powershell - * signtool remove /s hello.exe - * ``` - * 6. Inject the blob into the copied binary by running `postject` with - * the following options: - * * `hello` / `hello.exe` \- The name of the copy of the `node` executable - * created in step 4. - * * `NODE_SEA_BLOB` \- The name of the resource / note / section in the binary - * where the contents of the blob will be stored. - * * `sea-prep.blob` \- The name of the blob created in step 1. - * * `--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2` \- The [fuse](https://www.electronjs.org/docs/latest/tutorial/fuses) used by the Node.js project to detect if a file has been - * injected. - * * `--macho-segment-name NODE_SEA` (only needed on macOS) - The name of the - * segment in the binary where the contents of the blob will be - * stored. - * To summarize, here is the required command for each platform: - * * On Linux: - * ```bash - * npx postject hello NODE_SEA_BLOB sea-prep.blob \ - * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 - * ``` - * * On Windows - PowerShell: - * ```powershell - * npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ` - * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 - * ``` - * * On Windows - Command Prompt: - * ```text - * npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ^ - * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 - * ``` - * * On macOS: - * ```bash - * npx postject hello NODE_SEA_BLOB sea-prep.blob \ - * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \ - * --macho-segment-name NODE_SEA - * ``` - * 7. Sign the binary (macOS and Windows only): - * * On macOS: - * ```bash - * codesign --sign - hello - * ``` - * * On Windows (optional): - * A certificate needs to be present for this to work. However, the unsigned - * binary would still be runnable. - * ```powershell - * signtool sign /fd SHA256 hello.exe - * ``` - * 8. Run the binary: - * * On systems other than Windows - * ```console - * $ ./hello world - * Hello, world! - * ``` - * * On Windows - * ```console - * $ .\hello.exe world - * Hello, world! - * ``` - * @since v19.7.0, v18.16.0 - * @experimental - * @see [source](https://github.com/nodejs/node/blob/v22.x/src/node_sea.cc) - */ -declare module "node:sea" { - type AssetKey = string; - /** - * @since v20.12.0 - * @return Whether this script is running inside a single-executable application. - */ - function isSea(): boolean; - /** - * This method can be used to retrieve the assets configured to be bundled into the - * single-executable application at build time. - * An error is thrown when no matching asset can be found. - * @since v20.12.0 - */ - function getAsset(key: AssetKey): ArrayBuffer; - function getAsset(key: AssetKey, encoding: string): string; - /** - * Similar to `sea.getAsset()`, but returns the result in a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob). - * An error is thrown when no matching asset can be found. - * @since v20.12.0 - */ - function getAssetAsBlob(key: AssetKey, options?: { - type: string; - }): Blob; - /** - * This method can be used to retrieve the assets configured to be bundled into the - * single-executable application at build time. - * An error is thrown when no matching asset can be found. - * - * Unlike `sea.getRawAsset()` or `sea.getAssetAsBlob()`, this method does not - * return a copy. Instead, it returns the raw asset bundled inside the executable. - * - * For now, users should avoid writing to the returned array buffer. If the - * injected section is not marked as writable or not aligned properly, - * writes to the returned array buffer is likely to result in a crash. - * @since v20.12.0 - */ - function getRawAsset(key: AssetKey): ArrayBuffer; -} diff --git a/node_modules/@types/node/sqlite.d.ts b/node_modules/@types/node/sqlite.d.ts deleted file mode 100644 index 19d826d..0000000 --- a/node_modules/@types/node/sqlite.d.ts +++ /dev/null @@ -1,721 +0,0 @@ -/** - * The `node:sqlite` module facilitates working with SQLite databases. - * To access it: - * - * ```js - * import sqlite from 'node:sqlite'; - * ``` - * - * This module is only available under the `node:` scheme. The following will not - * work: - * - * ```js - * import sqlite from 'sqlite'; - * ``` - * - * The following example shows the basic usage of the `node:sqlite` module to open - * an in-memory database, write data to the database, and then read the data back. - * - * ```js - * import { DatabaseSync } from 'node:sqlite'; - * const database = new DatabaseSync(':memory:'); - * - * // Execute SQL statements from strings. - * database.exec(` - * CREATE TABLE data( - * key INTEGER PRIMARY KEY, - * value TEXT - * ) STRICT - * `); - * // Create a prepared statement to insert data into the database. - * const insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)'); - * // Execute the prepared statement with bound values. - * insert.run(1, 'hello'); - * insert.run(2, 'world'); - * // Create a prepared statement to read data from the database. - * const query = database.prepare('SELECT * FROM data ORDER BY key'); - * // Execute the prepared statement and log the result set. - * console.log(query.all()); - * // Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ] - * ``` - * @since v22.5.0 - * @experimental - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/sqlite.js) - */ -declare module "node:sqlite" { - import { PathLike } from "node:fs"; - type SQLInputValue = null | number | bigint | string | NodeJS.ArrayBufferView; - type SQLOutputValue = null | number | bigint | string | NodeJS.NonSharedUint8Array; - interface DatabaseSyncOptions { - /** - * If `true`, the database is opened by the constructor. When - * this value is `false`, the database must be opened via the `open()` method. - * @since v22.5.0 - * @default true - */ - open?: boolean | undefined; - /** - * If `true`, foreign key constraints - * are enabled. This is recommended but can be disabled for compatibility with - * legacy database schemas. The enforcement of foreign key constraints can be - * enabled and disabled after opening the database using - * [`PRAGMA foreign_keys`](https://www.sqlite.org/pragma.html#pragma_foreign_keys). - * @since v22.10.0 - * @default true - */ - enableForeignKeyConstraints?: boolean | undefined; - /** - * If `true`, SQLite will accept - * [double-quoted string literals](https://www.sqlite.org/quirks.html#dblquote). - * This is not recommended but can be - * enabled for compatibility with legacy database schemas. - * @since v22.10.0 - * @default false - */ - enableDoubleQuotedStringLiterals?: boolean | undefined; - /** - * If `true`, the database is opened in read-only mode. - * If the database does not exist, opening it will fail. - * @since v22.12.0 - * @default false - */ - readOnly?: boolean | undefined; - /** - * If `true`, the `loadExtension` SQL function - * and the `loadExtension()` method are enabled. - * You can call `enableLoadExtension(false)` later to disable this feature. - * @since v22.13.0 - * @default false - */ - allowExtension?: boolean | undefined; - /** - * The [busy timeout](https://sqlite.org/c3ref/busy_timeout.html) in milliseconds. This is the maximum amount of - * time that SQLite will wait for a database lock to be released before - * returning an error. - * @since v22.16.0 - * @default 0 - */ - timeout?: number | undefined; - /** - * If `true`, integer fields are read as JavaScript `BigInt` values. If `false`, - * integer fields are read as JavaScript numbers. - * @since v22.18.0 - * @default false - */ - readBigInts?: boolean | undefined; - /** - * If `true`, query results are returned as arrays instead of objects. - * @since v22.18.0 - * @default false - */ - returnArrays?: boolean | undefined; - /** - * If `true`, allows binding named parameters without the prefix - * character (e.g., `foo` instead of `:foo`). - * @since v22.18.0 - * @default true - */ - allowBareNamedParameters?: boolean | undefined; - /** - * If `true`, unknown named parameters are ignored when binding. - * If `false`, an exception is thrown for unknown named parameters. - * @since v22.18.0 - * @default false - */ - allowUnknownNamedParameters?: boolean | undefined; - } - interface CreateSessionOptions { - /** - * A specific table to track changes for. By default, changes to all tables are tracked. - * @since v22.12.0 - */ - table?: string | undefined; - /** - * Name of the database to track. This is useful when multiple databases have been added using - * [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html). - * @since v22.12.0 - * @default 'main' - */ - db?: string | undefined; - } - interface ApplyChangesetOptions { - /** - * Skip changes that, when targeted table name is supplied to this function, return a truthy value. - * By default, all changes are attempted. - * @since v22.12.0 - */ - filter?: ((tableName: string) => boolean) | undefined; - /** - * A function that determines how to handle conflicts. The function receives one argument, - * which can be one of the following values: - * - * * `SQLITE_CHANGESET_DATA`: A `DELETE` or `UPDATE` change does not contain the expected "before" values. - * * `SQLITE_CHANGESET_NOTFOUND`: A row matching the primary key of the `DELETE` or `UPDATE` change does not exist. - * * `SQLITE_CHANGESET_CONFLICT`: An `INSERT` change results in a duplicate primary key. - * * `SQLITE_CHANGESET_FOREIGN_KEY`: Applying a change would result in a foreign key violation. - * * `SQLITE_CHANGESET_CONSTRAINT`: Applying a change results in a `UNIQUE`, `CHECK`, or `NOT NULL` constraint - * violation. - * - * The function should return one of the following values: - * - * * `SQLITE_CHANGESET_OMIT`: Omit conflicting changes. - * * `SQLITE_CHANGESET_REPLACE`: Replace existing values with conflicting changes (only valid with - `SQLITE_CHANGESET_DATA` or `SQLITE_CHANGESET_CONFLICT` conflicts). - * * `SQLITE_CHANGESET_ABORT`: Abort on conflict and roll back the database. - * - * When an error is thrown in the conflict handler or when any other value is returned from the handler, - * applying the changeset is aborted and the database is rolled back. - * - * **Default**: A function that returns `SQLITE_CHANGESET_ABORT`. - * @since v22.12.0 - */ - onConflict?: ((conflictType: number) => number) | undefined; - } - interface FunctionOptions { - /** - * If `true`, the [`SQLITE_DETERMINISTIC`](https://www.sqlite.org/c3ref/c_deterministic.html) flag is - * set on the created function. - * @default false - */ - deterministic?: boolean | undefined; - /** - * If `true`, the [`SQLITE_DIRECTONLY`](https://www.sqlite.org/c3ref/c_directonly.html) flag is set on - * the created function. - * @default false - */ - directOnly?: boolean | undefined; - /** - * If `true`, integer arguments to `function` - * are converted to `BigInt`s. If `false`, integer arguments are passed as - * JavaScript numbers. - * @default false - */ - useBigIntArguments?: boolean | undefined; - /** - * If `true`, `function` may be invoked with any number of - * arguments (between zero and - * [`SQLITE_MAX_FUNCTION_ARG`](https://www.sqlite.org/limits.html#max_function_arg)). If `false`, - * `function` must be invoked with exactly `function.length` arguments. - * @default false - */ - varargs?: boolean | undefined; - } - interface AggregateOptions extends FunctionOptions { - /** - * The identity value for the aggregation function. This value is used when the aggregation - * function is initialized. When a `Function` is passed the identity will be its return value. - */ - start: T | (() => T); - /** - * The function to call for each row in the aggregation. The - * function receives the current state and the row value. The return value of - * this function should be the new state. - */ - step: (accumulator: T, ...args: SQLOutputValue[]) => T; - /** - * The function to call to get the result of the - * aggregation. The function receives the final state and should return the - * result of the aggregation. - */ - result?: ((accumulator: T) => SQLInputValue) | undefined; - /** - * When this function is provided, the `aggregate` method will work as a window function. - * The function receives the current state and the dropped row value. The return value of this function should be the - * new state. - */ - inverse?: ((accumulator: T, ...args: SQLOutputValue[]) => T) | undefined; - } - /** - * This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs - * exposed by this class execute synchronously. - * @since v22.5.0 - */ - class DatabaseSync implements Disposable { - /** - * Constructs a new `DatabaseSync` instance. - * @param path The path of the database. - * A SQLite database can be stored in a file or completely [in memory](https://www.sqlite.org/inmemorydb.html). - * To use a file-backed database, the path should be a file path. - * To use an in-memory database, the path should be the special name `':memory:'`. - * @param options Configuration options for the database connection. - */ - constructor(path: PathLike, options?: DatabaseSyncOptions); - /** - * Registers a new aggregate function with the SQLite database. This method is a wrapper around - * [`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html). - * - * When used as a window function, the `result` function will be called multiple times. - * - * ```js - * import { DatabaseSync } from 'node:sqlite'; - * - * const db = new DatabaseSync(':memory:'); - * db.exec(` - * CREATE TABLE t3(x, y); - * INSERT INTO t3 VALUES ('a', 4), - * ('b', 5), - * ('c', 3), - * ('d', 8), - * ('e', 1); - * `); - * - * db.aggregate('sumint', { - * start: 0, - * step: (acc, value) => acc + value, - * }); - * - * db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 } - * ``` - * @since v22.16.0 - * @param name The name of the SQLite function to create. - * @param options Function configuration settings. - */ - aggregate(name: string, options: AggregateOptions): void; - aggregate(name: string, options: AggregateOptions): void; - /** - * Closes the database connection. An exception is thrown if the database is not - * open. This method is a wrapper around [`sqlite3_close_v2()`](https://www.sqlite.org/c3ref/close.html). - * @since v22.5.0 - */ - close(): void; - /** - * Loads a shared library into the database connection. This method is a wrapper - * around [`sqlite3_load_extension()`](https://www.sqlite.org/c3ref/load_extension.html). It is required to enable the - * `allowExtension` option when constructing the `DatabaseSync` instance. - * @since v22.13.0 - * @param path The path to the shared library to load. - */ - loadExtension(path: string): void; - /** - * Enables or disables the `loadExtension` SQL function, and the `loadExtension()` - * method. When `allowExtension` is `false` when constructing, you cannot enable - * loading extensions for security reasons. - * @since v22.13.0 - * @param allow Whether to allow loading extensions. - */ - enableLoadExtension(allow: boolean): void; - /** - * This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html) - * @since v22.16.0 - * @param dbName Name of the database. This can be `'main'` (the default primary database) or any other - * database that has been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) **Default:** `'main'`. - * @returns The location of the database file. When using an in-memory database, - * this method returns null. - */ - location(dbName?: string): string | null; - /** - * This method allows one or more SQL statements to be executed without returning - * any results. This method is useful when executing SQL statements read from a - * file. This method is a wrapper around [`sqlite3_exec()`](https://www.sqlite.org/c3ref/exec.html). - * @since v22.5.0 - * @param sql A SQL string to execute. - */ - exec(sql: string): void; - /** - * This method is used to create SQLite user-defined functions. This method is a - * wrapper around [`sqlite3_create_function_v2()`](https://www.sqlite.org/c3ref/create_function.html). - * @since v22.13.0 - * @param name The name of the SQLite function to create. - * @param options Optional configuration settings for the function. - * @param func The JavaScript function to call when the SQLite - * function is invoked. The return value of this function should be a valid - * SQLite data type: see - * [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-v22.x/api/sqlite.html#type-conversion-between-javascript-and-sqlite). - * The result defaults to `NULL` if the return value is `undefined`. - */ - function( - name: string, - options: FunctionOptions, - func: (...args: SQLOutputValue[]) => SQLInputValue, - ): void; - function(name: string, func: (...args: SQLOutputValue[]) => SQLInputValue): void; - /** - * Whether the database is currently open or not. - * @since v22.15.0 - */ - readonly isOpen: boolean; - /** - * Whether the database is currently within a transaction. This method - * is a wrapper around [`sqlite3_get_autocommit()`](https://sqlite.org/c3ref/get_autocommit.html). - * @since v22.16.0 - */ - readonly isTransaction: boolean; - /** - * Opens the database specified in the `path` argument of the `DatabaseSync`constructor. This method should only be used when the database is not opened via - * the constructor. An exception is thrown if the database is already open. - * @since v22.5.0 - */ - open(): void; - /** - * Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This method is a wrapper - * around [`sqlite3_prepare_v2()`](https://www.sqlite.org/c3ref/prepare.html). - * @since v22.5.0 - * @param sql A SQL string to compile to a prepared statement. - * @return The prepared statement. - */ - prepare(sql: string): StatementSync; - /** - * Creates and attaches a session to the database. This method is a wrapper around - * [`sqlite3session_create()`](https://www.sqlite.org/session/sqlite3session_create.html) and - * [`sqlite3session_attach()`](https://www.sqlite.org/session/sqlite3session_attach.html). - * @param options The configuration options for the session. - * @returns A session handle. - * @since v22.12.0 - */ - createSession(options?: CreateSessionOptions): Session; - /** - * An exception is thrown if the database is not - * open. This method is a wrapper around - * [`sqlite3changeset_apply()`](https://www.sqlite.org/session/sqlite3changeset_apply.html). - * - * ```js - * const sourceDb = new DatabaseSync(':memory:'); - * const targetDb = new DatabaseSync(':memory:'); - * - * sourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)'); - * targetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)'); - * - * const session = sourceDb.createSession(); - * - * const insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)'); - * insert.run(1, 'hello'); - * insert.run(2, 'world'); - * - * const changeset = session.changeset(); - * targetDb.applyChangeset(changeset); - * // Now that the changeset has been applied, targetDb contains the same data as sourceDb. - * ``` - * @param changeset A binary changeset or patchset. - * @param options The configuration options for how the changes will be applied. - * @returns Whether the changeset was applied successfully without being aborted. - * @since v22.12.0 - */ - applyChangeset(changeset: Uint8Array, options?: ApplyChangesetOptions): boolean; - /** - * Closes the database connection. If the database connection is already closed - * then this is a no-op. - * @since v22.15.0 - * @experimental - */ - [Symbol.dispose](): void; - } - /** - * @since v22.12.0 - */ - interface Session { - /** - * Retrieves a changeset containing all changes since the changeset was created. Can be called multiple times. - * An exception is thrown if the database or the session is not open. This method is a wrapper around - * [`sqlite3session_changeset()`](https://www.sqlite.org/session/sqlite3session_changeset.html). - * @returns Binary changeset that can be applied to other databases. - * @since v22.12.0 - */ - changeset(): NodeJS.NonSharedUint8Array; - /** - * Similar to the method above, but generates a more compact patchset. See - * [Changesets and Patchsets](https://www.sqlite.org/sessionintro.html#changesets_and_patchsets) - * in the documentation of SQLite. An exception is thrown if the database or the session is not open. This method is a - * wrapper around - * [`sqlite3session_patchset()`](https://www.sqlite.org/session/sqlite3session_patchset.html). - * @returns Binary patchset that can be applied to other databases. - * @since v22.12.0 - */ - patchset(): NodeJS.NonSharedUint8Array; - /** - * Closes the session. An exception is thrown if the database or the session is not open. This method is a - * wrapper around - * [`sqlite3session_delete()`](https://www.sqlite.org/session/sqlite3session_delete.html). - */ - close(): void; - } - interface StatementColumnMetadata { - /** - * The unaliased name of the column in the origin - * table, or `null` if the column is the result of an expression or subquery. - * This property is the result of [`sqlite3_column_origin_name()`](https://www.sqlite.org/c3ref/column_database_name.html). - */ - column: string | null; - /** - * The unaliased name of the origin database, or - * `null` if the column is the result of an expression or subquery. This - * property is the result of [`sqlite3_column_database_name()`](https://www.sqlite.org/c3ref/column_database_name.html). - */ - database: string | null; - /** - * The name assigned to the column in the result set of a - * `SELECT` statement. This property is the result of - * [`sqlite3_column_name()`](https://www.sqlite.org/c3ref/column_name.html). - */ - name: string; - /** - * The unaliased name of the origin table, or `null` if - * the column is the result of an expression or subquery. This property is the - * result of [`sqlite3_column_table_name()`](https://www.sqlite.org/c3ref/column_database_name.html). - */ - table: string | null; - /** - * The declared data type of the column, or `null` if the - * column is the result of an expression or subquery. This property is the - * result of [`sqlite3_column_decltype()`](https://www.sqlite.org/c3ref/column_decltype.html). - */ - type: string | null; - } - interface StatementResultingChanges { - /** - * The number of rows modified, inserted, or deleted by the most recently completed `INSERT`, `UPDATE`, or `DELETE` statement. - * This field is either a number or a `BigInt` depending on the prepared statement's configuration. - * This property is the result of [`sqlite3_changes64()`](https://www.sqlite.org/c3ref/changes.html). - */ - changes: number | bigint; - /** - * The most recently inserted rowid. - * This field is either a number or a `BigInt` depending on the prepared statement's configuration. - * This property is the result of [`sqlite3_last_insert_rowid()`](https://www.sqlite.org/c3ref/last_insert_rowid.html). - */ - lastInsertRowid: number | bigint; - } - /** - * This class represents a single [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This class cannot be - * instantiated via its constructor. Instead, instances are created via the`database.prepare()` method. All APIs exposed by this class execute - * synchronously. - * - * A prepared statement is an efficient binary representation of the SQL used to - * create it. Prepared statements are parameterizable, and can be invoked multiple - * times with different bound values. Parameters also offer protection against [SQL injection](https://en.wikipedia.org/wiki/SQL_injection) attacks. For these reasons, prepared statements are - * preferred - * over hand-crafted SQL strings when handling user input. - * @since v22.5.0 - */ - class StatementSync { - private constructor(); - /** - * This method executes a prepared statement and returns all results as an array of - * objects. If the prepared statement does not return any results, this method - * returns an empty array. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using - * the values in `namedParameters` and `anonymousParameters`. - * @since v22.5.0 - * @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping. - * @param anonymousParameters Zero or more values to bind to anonymous parameters. - * @return An array of objects. Each object corresponds to a row returned by executing the prepared statement. The keys and values of each object correspond to the column names and values of - * the row. - */ - all(...anonymousParameters: SQLInputValue[]): Record[]; - all( - namedParameters: Record, - ...anonymousParameters: SQLInputValue[] - ): Record[]; - /** - * This method is used to retrieve information about the columns returned by the - * prepared statement. - * @since v22.16.0 - * @returns An array of objects. Each object corresponds to a column - * in the prepared statement, and contains the following properties: - */ - columns(): StatementColumnMetadata[]; - /** - * The source SQL text of the prepared statement with parameter - * placeholders replaced by the values that were used during the most recent - * execution of this prepared statement. This property is a wrapper around - * [`sqlite3_expanded_sql()`](https://www.sqlite.org/c3ref/expanded_sql.html). - * @since v22.5.0 - */ - readonly expandedSQL: string; - /** - * This method executes a prepared statement and returns the first result as an - * object. If the prepared statement does not return any results, this method - * returns `undefined`. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the - * values in `namedParameters` and `anonymousParameters`. - * @since v22.5.0 - * @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping. - * @param anonymousParameters Zero or more values to bind to anonymous parameters. - * @return An object corresponding to the first row returned by executing the prepared statement. The keys and values of the object correspond to the column names and values of the row. If no - * rows were returned from the database then this method returns `undefined`. - */ - get(...anonymousParameters: SQLInputValue[]): Record | undefined; - get( - namedParameters: Record, - ...anonymousParameters: SQLInputValue[] - ): Record | undefined; - /** - * This method executes a prepared statement and returns an iterator of - * objects. If the prepared statement does not return any results, this method - * returns an empty iterator. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using - * the values in `namedParameters` and `anonymousParameters`. - * @since v22.13.0 - * @param namedParameters An optional object used to bind named parameters. - * The keys of this object are used to configure the mapping. - * @param anonymousParameters Zero or more values to bind to anonymous parameters. - * @returns An iterable iterator of objects. Each object corresponds to a row - * returned by executing the prepared statement. The keys and values of each - * object correspond to the column names and values of the row. - */ - iterate(...anonymousParameters: SQLInputValue[]): NodeJS.Iterator>; - iterate( - namedParameters: Record, - ...anonymousParameters: SQLInputValue[] - ): NodeJS.Iterator>; - /** - * This method executes a prepared statement and returns an object summarizing the - * resulting changes. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the - * values in `namedParameters` and `anonymousParameters`. - * @since v22.5.0 - * @param namedParameters An optional object used to bind named parameters. The keys of this object are used to configure the mapping. - * @param anonymousParameters Zero or more values to bind to anonymous parameters. - */ - run(...anonymousParameters: SQLInputValue[]): StatementResultingChanges; - run( - namedParameters: Record, - ...anonymousParameters: SQLInputValue[] - ): StatementResultingChanges; - /** - * The names of SQLite parameters begin with a prefix character. By default,`node:sqlite` requires that this prefix character is present when binding - * parameters. However, with the exception of dollar sign character, these - * prefix characters also require extra quoting when used in object keys. - * - * To improve ergonomics, this method can be used to also allow bare named - * parameters, which do not require the prefix character in JavaScript code. There - * are several caveats to be aware of when enabling bare named parameters: - * - * * The prefix character is still required in SQL. - * * The prefix character is still allowed in JavaScript. In fact, prefixed names - * will have slightly better binding performance. - * * Using ambiguous named parameters, such as `$k` and `@k`, in the same prepared - * statement will result in an exception as it cannot be determined how to bind - * a bare name. - * @since v22.5.0 - * @param enabled Enables or disables support for binding named parameters without the prefix character. - */ - setAllowBareNamedParameters(enabled: boolean): void; - /** - * By default, if an unknown name is encountered while binding parameters, an - * exception is thrown. This method allows unknown named parameters to be ignored. - * @since v22.15.0 - * @param enabled Enables or disables support for unknown named parameters. - */ - setAllowUnknownNamedParameters(enabled: boolean): void; - /** - * When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead - * of objects. - * @since v22.16.0 - * @param enabled Enables or disables the return of query results as arrays. - */ - setReturnArrays(enabled: boolean): void; - /** - * When reading from the database, SQLite `INTEGER`s are mapped to JavaScript - * numbers by default. However, SQLite `INTEGER`s can store values larger than - * JavaScript numbers are capable of representing. In such cases, this method can - * be used to read `INTEGER` data using JavaScript `BigInt`s. This method has no - * impact on database write operations where numbers and `BigInt`s are both - * supported at all times. - * @since v22.5.0 - * @param enabled Enables or disables the use of `BigInt`s when reading `INTEGER` fields from the database. - */ - setReadBigInts(enabled: boolean): void; - /** - * The source SQL text of the prepared statement. This property is a - * wrapper around [`sqlite3_sql()`](https://www.sqlite.org/c3ref/expanded_sql.html). - * @since v22.5.0 - */ - readonly sourceSQL: string; - } - interface BackupOptions { - /** - * Name of the source database. This can be `'main'` (the default primary database) or any other - * database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) - * @default 'main' - */ - source?: string | undefined; - /** - * Name of the target database. This can be `'main'` (the default primary database) or any other - * database that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html) - * @default 'main' - */ - target?: string | undefined; - /** - * Number of pages to be transmitted in each batch of the backup. - * @default 100 - */ - rate?: number | undefined; - /** - * Callback function that will be called with the number of pages copied and the total number of - * pages. - */ - progress?: ((progressInfo: BackupProgressInfo) => void) | undefined; - } - interface BackupProgressInfo { - totalPages: number; - remainingPages: number; - } - /** - * This method makes a database backup. This method abstracts the - * [`sqlite3_backup_init()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit), - * [`sqlite3_backup_step()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep) - * and [`sqlite3_backup_finish()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish) functions. - * - * The backed-up database can be used normally during the backup process. Mutations coming from the same connection - same - * `DatabaseSync` - object will be reflected in the backup right away. However, mutations from other connections will cause - * the backup process to restart. - * - * ```js - * import { backup, DatabaseSync } from 'node:sqlite'; - * - * const sourceDb = new DatabaseSync('source.db'); - * const totalPagesTransferred = await backup(sourceDb, 'backup.db', { - * rate: 1, // Copy one page at a time. - * progress: ({ totalPages, remainingPages }) => { - * console.log('Backup in progress', { totalPages, remainingPages }); - * }, - * }); - * - * console.log('Backup completed', totalPagesTransferred); - * ``` - * @since v22.16.0 - * @param sourceDb The database to backup. The source database must be open. - * @param path The path where the backup will be created. If the file already exists, - * the contents will be overwritten. - * @param options Optional configuration for the backup. The - * following properties are supported: - * @returns A promise that resolves when the backup is completed and rejects if an error occurs. - */ - function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise; - /** - * @since v22.13.0 - */ - namespace constants { - /** - * The conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is present in the database, but one or more other (non primary-key) fields modified by the update do not contain the expected "before" values. - * @since v22.14.0 - */ - const SQLITE_CHANGESET_DATA: number; - /** - * The conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is not present in the database. - * @since v22.14.0 - */ - const SQLITE_CHANGESET_NOTFOUND: number; - /** - * This constant is passed to the conflict handler while processing an INSERT change if the operation would result in duplicate primary key values. - * @since v22.14.0 - */ - const SQLITE_CHANGESET_CONFLICT: number; - /** - * If foreign key handling is enabled, and applying a changeset leaves the database in a state containing foreign key violations, the conflict handler is invoked with this constant exactly once before the changeset is committed. If the conflict handler returns `SQLITE_CHANGESET_OMIT`, the changes, including those that caused the foreign key constraint violation, are committed. Or, if it returns `SQLITE_CHANGESET_ABORT`, the changeset is rolled back. - * @since v22.14.0 - */ - const SQLITE_CHANGESET_FOREIGN_KEY: number; - /** - * Conflicting changes are omitted. - * @since v22.12.0 - */ - const SQLITE_CHANGESET_OMIT: number; - /** - * Conflicting changes replace existing values. Note that this value can only be returned when the type of conflict is either `SQLITE_CHANGESET_DATA` or `SQLITE_CHANGESET_CONFLICT`. - * @since v22.12.0 - */ - const SQLITE_CHANGESET_REPLACE: number; - /** - * Abort when a change encounters a conflict and roll back database. - * @since v22.12.0 - */ - const SQLITE_CHANGESET_ABORT: number; - } -} diff --git a/node_modules/@types/node/stream.d.ts b/node_modules/@types/node/stream.d.ts deleted file mode 100644 index dec1bcc..0000000 --- a/node_modules/@types/node/stream.d.ts +++ /dev/null @@ -1,1687 +0,0 @@ -/** - * A stream is an abstract interface for working with streaming data in Node.js. - * The `node:stream` module provides an API for implementing the stream interface. - * - * There are many stream objects provided by Node.js. For instance, a [request to an HTTP server](https://nodejs.org/docs/latest-v22.x/api/http.html#class-httpincomingmessage) - * and [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) are both stream instances. - * - * Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-v22.x/api/events.html#class-eventemitter). - * - * To access the `node:stream` module: - * - * ```js - * import stream from 'node:stream'; - * ``` - * - * The `node:stream` module is useful for creating new types of stream instances. - * It is usually not necessary to use the `node:stream` module to consume streams. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/stream.js) - */ -declare module "stream" { - import { Abortable, EventEmitter } from "node:events"; - import { Blob as NodeBlob } from "node:buffer"; - import * as streamPromises from "node:stream/promises"; - import * as streamWeb from "node:stream/web"; - - type ComposeFnParam = (source: any) => void; - - class Stream extends EventEmitter { - pipe( - destination: T, - options?: { - end?: boolean | undefined; - }, - ): T; - compose( - stream: T | ComposeFnParam | Iterable | AsyncIterable, - options?: { signal: AbortSignal }, - ): T; - } - namespace Stream { - export { Stream, streamPromises as promises }; - } - namespace Stream { - interface StreamOptions extends Abortable { - emitClose?: boolean | undefined; - highWaterMark?: number | undefined; - objectMode?: boolean | undefined; - construct?: ((this: T, callback: (error?: Error | null) => void) => void) | undefined; - destroy?: ((this: T, error: Error | null, callback: (error?: Error | null) => void) => void) | undefined; - autoDestroy?: boolean | undefined; - } - interface ReadableOptions extends StreamOptions { - encoding?: BufferEncoding | undefined; - read?: ((this: T, size: number) => void) | undefined; - } - interface ArrayOptions { - /** - * The maximum concurrent invocations of `fn` to call on the stream at once. - * @default 1 - */ - concurrency?: number | undefined; - /** Allows destroying the stream if the signal is aborted. */ - signal?: AbortSignal | undefined; - } - /** - * @since v0.9.4 - */ - class Readable extends Stream implements NodeJS.ReadableStream { - /** - * A utility method for creating Readable Streams out of iterators. - * @since v12.3.0, v10.17.0 - * @param iterable Object implementing the `Symbol.asyncIterator` or `Symbol.iterator` iterable protocol. Emits an 'error' event if a null value is passed. - * @param options Options provided to `new stream.Readable([options])`. By default, `Readable.from()` will set `options.objectMode` to `true`, unless this is explicitly opted out by setting `options.objectMode` to `false`. - */ - static from(iterable: Iterable | AsyncIterable, options?: ReadableOptions): Readable; - /** - * A utility method for creating a `Readable` from a web `ReadableStream`. - * @since v17.0.0 - */ - static fromWeb( - readableStream: streamWeb.ReadableStream, - options?: Pick, - ): Readable; - /** - * A utility method for creating a web `ReadableStream` from a `Readable`. - * @since v17.0.0 - */ - static toWeb( - streamReadable: Readable, - options?: { - strategy?: streamWeb.QueuingStrategy | undefined; - }, - ): streamWeb.ReadableStream; - /** - * Returns whether the stream has been read from or cancelled. - * @since v16.8.0 - */ - static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean; - /** - * Returns whether the stream was destroyed or errored before emitting `'end'`. - * @since v16.8.0 - */ - readonly readableAborted: boolean; - /** - * Is `true` if it is safe to call {@link read}, which means - * the stream has not been destroyed or emitted `'error'` or `'end'`. - * @since v11.4.0 - */ - readable: boolean; - /** - * Returns whether `'data'` has been emitted. - * @since v16.7.0, v14.18.0 - */ - readonly readableDidRead: boolean; - /** - * Getter for the property `encoding` of a given `Readable` stream. The `encoding` property can be set using the {@link setEncoding} method. - * @since v12.7.0 - */ - readonly readableEncoding: BufferEncoding | null; - /** - * Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-v22.x/api/stream.html#event-end) event is emitted. - * @since v12.9.0 - */ - readonly readableEnded: boolean; - /** - * This property reflects the current state of a `Readable` stream as described - * in the [Three states](https://nodejs.org/docs/latest-v22.x/api/stream.html#three-states) section. - * @since v9.4.0 - */ - readonly readableFlowing: boolean | null; - /** - * Returns the value of `highWaterMark` passed when creating this `Readable`. - * @since v9.3.0 - */ - readonly readableHighWaterMark: number; - /** - * This property contains the number of bytes (or objects) in the queue - * ready to be read. The value provides introspection data regarding - * the status of the `highWaterMark`. - * @since v9.4.0 - */ - readonly readableLength: number; - /** - * Getter for the property `objectMode` of a given `Readable` stream. - * @since v12.3.0 - */ - readonly readableObjectMode: boolean; - /** - * Is `true` after `readable.destroy()` has been called. - * @since v8.0.0 - */ - destroyed: boolean; - /** - * Is `true` after `'close'` has been emitted. - * @since v18.0.0 - */ - readonly closed: boolean; - /** - * Returns error if the stream has been destroyed with an error. - * @since v18.0.0 - */ - readonly errored: Error | null; - constructor(opts?: ReadableOptions); - _construct?(callback: (error?: Error | null) => void): void; - _read(size: number): void; - /** - * The `readable.read()` method reads data out of the internal buffer and - * returns it. If no data is available to be read, `null` is returned. By default, - * the data is returned as a `Buffer` object unless an encoding has been - * specified using the `readable.setEncoding()` method or the stream is operating - * in object mode. - * - * The optional `size` argument specifies a specific number of bytes to read. If - * `size` bytes are not available to be read, `null` will be returned _unless_ the - * stream has ended, in which case all of the data remaining in the internal buffer - * will be returned. - * - * If the `size` argument is not specified, all of the data contained in the - * internal buffer will be returned. - * - * The `size` argument must be less than or equal to 1 GiB. - * - * The `readable.read()` method should only be called on `Readable` streams - * operating in paused mode. In flowing mode, `readable.read()` is called - * automatically until the internal buffer is fully drained. - * - * ```js - * const readable = getReadableStreamSomehow(); - * - * // 'readable' may be triggered multiple times as data is buffered in - * readable.on('readable', () => { - * let chunk; - * console.log('Stream is readable (new data received in buffer)'); - * // Use a loop to make sure we read all currently available data - * while (null !== (chunk = readable.read())) { - * console.log(`Read ${chunk.length} bytes of data...`); - * } - * }); - * - * // 'end' will be triggered once when there is no more data available - * readable.on('end', () => { - * console.log('Reached end of stream.'); - * }); - * ``` - * - * Each call to `readable.read()` returns a chunk of data, or `null`. The chunks - * are not concatenated. A `while` loop is necessary to consume all data - * currently in the buffer. When reading a large file `.read()` may return `null`, - * having consumed all buffered content so far, but there is still more data to - * come not yet buffered. In this case a new `'readable'` event will be emitted - * when there is more data in the buffer. Finally the `'end'` event will be - * emitted when there is no more data to come. - * - * Therefore to read a file's whole contents from a `readable`, it is necessary - * to collect chunks across multiple `'readable'` events: - * - * ```js - * const chunks = []; - * - * readable.on('readable', () => { - * let chunk; - * while (null !== (chunk = readable.read())) { - * chunks.push(chunk); - * } - * }); - * - * readable.on('end', () => { - * const content = chunks.join(''); - * }); - * ``` - * - * A `Readable` stream in object mode will always return a single item from - * a call to `readable.read(size)`, regardless of the value of the `size` argument. - * - * If the `readable.read()` method returns a chunk of data, a `'data'` event will - * also be emitted. - * - * Calling {@link read} after the `'end'` event has - * been emitted will return `null`. No runtime error will be raised. - * @since v0.9.4 - * @param size Optional argument to specify how much data to read. - */ - read(size?: number): any; - /** - * The `readable.setEncoding()` method sets the character encoding for - * data read from the `Readable` stream. - * - * By default, no encoding is assigned and stream data will be returned as `Buffer` objects. Setting an encoding causes the stream data - * to be returned as strings of the specified encoding rather than as `Buffer` objects. For instance, calling `readable.setEncoding('utf8')` will cause the - * output data to be interpreted as UTF-8 data, and passed as strings. Calling `readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal - * string format. - * - * The `Readable` stream will properly handle multi-byte characters delivered - * through the stream that would otherwise become improperly decoded if simply - * pulled from the stream as `Buffer` objects. - * - * ```js - * const readable = getReadableStreamSomehow(); - * readable.setEncoding('utf8'); - * readable.on('data', (chunk) => { - * assert.equal(typeof chunk, 'string'); - * console.log('Got %d characters of string data:', chunk.length); - * }); - * ``` - * @since v0.9.4 - * @param encoding The encoding to use. - */ - setEncoding(encoding: BufferEncoding): this; - /** - * The `readable.pause()` method will cause a stream in flowing mode to stop - * emitting `'data'` events, switching out of flowing mode. Any data that - * becomes available will remain in the internal buffer. - * - * ```js - * const readable = getReadableStreamSomehow(); - * readable.on('data', (chunk) => { - * console.log(`Received ${chunk.length} bytes of data.`); - * readable.pause(); - * console.log('There will be no additional data for 1 second.'); - * setTimeout(() => { - * console.log('Now data will start flowing again.'); - * readable.resume(); - * }, 1000); - * }); - * ``` - * - * The `readable.pause()` method has no effect if there is a `'readable'` event listener. - * @since v0.9.4 - */ - pause(): this; - /** - * The `readable.resume()` method causes an explicitly paused `Readable` stream to - * resume emitting `'data'` events, switching the stream into flowing mode. - * - * The `readable.resume()` method can be used to fully consume the data from a - * stream without actually processing any of that data: - * - * ```js - * getReadableStreamSomehow() - * .resume() - * .on('end', () => { - * console.log('Reached the end, but did not read anything.'); - * }); - * ``` - * - * The `readable.resume()` method has no effect if there is a `'readable'` event listener. - * @since v0.9.4 - */ - resume(): this; - /** - * The `readable.isPaused()` method returns the current operating state of the `Readable`. - * This is used primarily by the mechanism that underlies the `readable.pipe()` method. - * In most typical cases, there will be no reason to use this method directly. - * - * ```js - * const readable = new stream.Readable(); - * - * readable.isPaused(); // === false - * readable.pause(); - * readable.isPaused(); // === true - * readable.resume(); - * readable.isPaused(); // === false - * ``` - * @since v0.11.14 - */ - isPaused(): boolean; - /** - * The `readable.unpipe()` method detaches a `Writable` stream previously attached - * using the {@link pipe} method. - * - * If the `destination` is not specified, then _all_ pipes are detached. - * - * If the `destination` is specified, but no pipe is set up for it, then - * the method does nothing. - * - * ```js - * import fs from 'node:fs'; - * const readable = getReadableStreamSomehow(); - * const writable = fs.createWriteStream('file.txt'); - * // All the data from readable goes into 'file.txt', - * // but only for the first second. - * readable.pipe(writable); - * setTimeout(() => { - * console.log('Stop writing to file.txt.'); - * readable.unpipe(writable); - * console.log('Manually close the file stream.'); - * writable.end(); - * }, 1000); - * ``` - * @since v0.9.4 - * @param destination Optional specific stream to unpipe - */ - unpipe(destination?: NodeJS.WritableStream): this; - /** - * Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the - * same as `readable.push(null)`, after which no more data can be written. The EOF - * signal is put at the end of the buffer and any buffered data will still be - * flushed. - * - * The `readable.unshift()` method pushes a chunk of data back into the internal - * buffer. This is useful in certain situations where a stream is being consumed by - * code that needs to "un-consume" some amount of data that it has optimistically - * pulled out of the source, so that the data can be passed on to some other party. - * - * The `stream.unshift(chunk)` method cannot be called after the `'end'` event - * has been emitted or a runtime error will be thrown. - * - * Developers using `stream.unshift()` often should consider switching to - * use of a `Transform` stream instead. See the `API for stream implementers` section for more information. - * - * ```js - * // Pull off a header delimited by \n\n. - * // Use unshift() if we get too much. - * // Call the callback with (error, header, stream). - * import { StringDecoder } from 'node:string_decoder'; - * function parseHeader(stream, callback) { - * stream.on('error', callback); - * stream.on('readable', onReadable); - * const decoder = new StringDecoder('utf8'); - * let header = ''; - * function onReadable() { - * let chunk; - * while (null !== (chunk = stream.read())) { - * const str = decoder.write(chunk); - * if (str.includes('\n\n')) { - * // Found the header boundary. - * const split = str.split(/\n\n/); - * header += split.shift(); - * const remaining = split.join('\n\n'); - * const buf = Buffer.from(remaining, 'utf8'); - * stream.removeListener('error', callback); - * // Remove the 'readable' listener before unshifting. - * stream.removeListener('readable', onReadable); - * if (buf.length) - * stream.unshift(buf); - * // Now the body of the message can be read from the stream. - * callback(null, header, stream); - * return; - * } - * // Still reading the header. - * header += str; - * } - * } - * } - * ``` - * - * Unlike {@link push}, `stream.unshift(chunk)` will not - * end the reading process by resetting the internal reading state of the stream. - * This can cause unexpected results if `readable.unshift()` is called during a - * read (i.e. from within a {@link _read} implementation on a - * custom stream). Following the call to `readable.unshift()` with an immediate {@link push} will reset the reading state appropriately, - * however it is best to simply avoid calling `readable.unshift()` while in the - * process of performing a read. - * @since v0.9.11 - * @param chunk Chunk of data to unshift onto the read queue. For streams not operating in object mode, `chunk` must - * be a {string}, {Buffer}, {TypedArray}, {DataView} or `null`. For object mode streams, `chunk` may be any JavaScript value. - * @param encoding Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`. - */ - unshift(chunk: any, encoding?: BufferEncoding): void; - /** - * Prior to Node.js 0.10, streams did not implement the entire `node:stream` module API as it is currently defined. (See `Compatibility` for more - * information.) - * - * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the `readable.wrap()` method can be used to create a `Readable` - * stream that uses - * the old stream as its data source. - * - * It will rarely be necessary to use `readable.wrap()` but the method has been - * provided as a convenience for interacting with older Node.js applications and - * libraries. - * - * ```js - * import { OldReader } from './old-api-module.js'; - * import { Readable } from 'node:stream'; - * const oreader = new OldReader(); - * const myReader = new Readable().wrap(oreader); - * - * myReader.on('readable', () => { - * myReader.read(); // etc. - * }); - * ``` - * @since v0.9.4 - * @param stream An "old style" readable stream - */ - wrap(stream: NodeJS.ReadableStream): this; - push(chunk: any, encoding?: BufferEncoding): boolean; - /** - * The iterator created by this method gives users the option to cancel the destruction - * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`, - * or if the iterator should destroy the stream if the stream emitted an error during iteration. - * @since v16.3.0 - * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator, - * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream. - * **Default: `true`**. - */ - iterator(options?: { destroyOnReturn?: boolean }): NodeJS.AsyncIterator; - /** - * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream. - * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream. - * @since v17.4.0, v16.14.0 - * @param fn a function to map over every chunk in the stream. Async or not. - * @returns a stream mapped with the function *fn*. - */ - map(fn: (data: any, options?: Pick) => any, options?: ArrayOptions): Readable; - /** - * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called - * and if it returns a truthy value, the chunk will be passed to the result stream. - * If the *fn* function returns a promise - that promise will be `await`ed. - * @since v17.4.0, v16.14.0 - * @param fn a function to filter chunks from the stream. Async or not. - * @returns a stream filtered with the predicate *fn*. - */ - filter( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Readable; - /** - * This method allows iterating a stream. For each chunk in the stream the *fn* function will be called. - * If the *fn* function returns a promise - that promise will be `await`ed. - * - * This method is different from `for await...of` loops in that it can optionally process chunks concurrently. - * In addition, a `forEach` iteration can only be stopped by having passed a `signal` option - * and aborting the related AbortController while `for await...of` can be stopped with `break` or `return`. - * In either case the stream will be destroyed. - * - * This method is different from listening to the `'data'` event in that it uses the `readable` event - * in the underlying machinary and can limit the number of concurrent *fn* calls. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise for when the stream has finished. - */ - forEach( - fn: (data: any, options?: Pick) => void | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method allows easily obtaining the contents of a stream. - * - * As this method reads the entire stream into memory, it negates the benefits of streams. It's intended - * for interoperability and convenience, not as the primary way to consume streams. - * @since v17.5.0 - * @returns a promise containing an array with the contents of the stream. - */ - toArray(options?: Pick): Promise; - /** - * This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream - * until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk - * `await`ed return value is truthy, the stream is destroyed and the promise is fulfilled with `true`. - * If none of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `false`. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks. - */ - some( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method is similar to `Array.prototype.find` and calls *fn* on each chunk in the stream - * to find a chunk with a truthy value for *fn*. Once an *fn* call's awaited return value is truthy, - * the stream is destroyed and the promise is fulfilled with value for which *fn* returned a truthy value. - * If all of the *fn* calls on the chunks return a falsy value, the promise is fulfilled with `undefined`. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise evaluating to the first chunk for which *fn* evaluated with a truthy value, - * or `undefined` if no element was found. - */ - find( - fn: (data: any, options?: Pick) => data is T, - options?: ArrayOptions, - ): Promise; - find( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method is similar to `Array.prototype.every` and calls *fn* on each chunk in the stream - * to check if all awaited return values are truthy value for *fn*. Once an *fn* call on a chunk - * `await`ed return value is falsy, the stream is destroyed and the promise is fulfilled with `false`. - * If all of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `true`. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise evaluating to `true` if *fn* returned a truthy value for every one of the chunks. - */ - every( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method returns a new stream by applying the given callback to each chunk of the stream - * and then flattening the result. - * - * It is possible to return a stream or another iterable or async iterable from *fn* and the result streams - * will be merged (flattened) into the returned stream. - * @since v17.5.0 - * @param fn a function to map over every chunk in the stream. May be async. May be a stream or generator. - * @returns a stream flat-mapped with the function *fn*. - */ - flatMap(fn: (data: any, options?: Pick) => any, options?: ArrayOptions): Readable; - /** - * This method returns a new stream with the first *limit* chunks dropped from the start. - * @since v17.5.0 - * @param limit the number of chunks to drop from the readable. - * @returns a stream with *limit* chunks dropped from the start. - */ - drop(limit: number, options?: Pick): Readable; - /** - * This method returns a new stream with the first *limit* chunks. - * @since v17.5.0 - * @param limit the number of chunks to take from the readable. - * @returns a stream with *limit* chunks taken. - */ - take(limit: number, options?: Pick): Readable; - /** - * This method returns a new stream with chunks of the underlying stream paired with a counter - * in the form `[index, chunk]`. The first index value is `0` and it increases by 1 for each chunk produced. - * @since v17.5.0 - * @returns a stream of indexed pairs. - */ - asIndexedPairs(options?: Pick): Readable; - /** - * This method calls *fn* on each chunk of the stream in order, passing it the result from the calculation - * on the previous element. It returns a promise for the final value of the reduction. - * - * If no *initial* value is supplied the first chunk of the stream is used as the initial value. - * If the stream is empty, the promise is rejected with a `TypeError` with the `ERR_INVALID_ARGS` code property. - * - * The reducer function iterates the stream element-by-element which means that there is no *concurrency* parameter - * or parallelism. To perform a reduce concurrently, you can extract the async function to `readable.map` method. - * @since v17.5.0 - * @param fn a reducer function to call over every chunk in the stream. Async or not. - * @param initial the initial value to use in the reduction. - * @returns a promise for the final value of the reduction. - */ - reduce( - fn: (previous: any, data: any, options?: Pick) => T, - initial?: undefined, - options?: Pick, - ): Promise; - reduce( - fn: (previous: T, data: any, options?: Pick) => T, - initial: T, - options?: Pick, - ): Promise; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - /** - * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the readable - * stream will release any internal resources and subsequent calls to `push()` will be ignored. - * - * Once `destroy()` has been called any further calls will be a no-op and no - * further errors except from `_destroy()` may be emitted as `'error'`. - * - * Implementors should not override this method, but instead implement `readable._destroy()`. - * @since v8.0.0 - * @param error Error which will be passed as payload in `'error'` event - */ - destroy(error?: Error): this; - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. data - * 3. end - * 4. error - * 5. pause - * 6. readable - * 7. resume - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: any) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "data", chunk: any): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "pause"): boolean; - emit(event: "readable"): boolean; - emit(event: "resume"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: any) => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: any) => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: any) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: any) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: "close", listener: () => void): this; - removeListener(event: "data", listener: (chunk: any) => void): this; - removeListener(event: "end", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "pause", listener: () => void): this; - removeListener(event: "readable", listener: () => void): this; - removeListener(event: "resume", listener: () => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - [Symbol.asyncIterator](): NodeJS.AsyncIterator; - /** - * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished. - * @since v20.4.0 - */ - [Symbol.asyncDispose](): Promise; - } - interface WritableOptions extends StreamOptions { - decodeStrings?: boolean | undefined; - defaultEncoding?: BufferEncoding | undefined; - write?: - | (( - this: T, - chunk: any, - encoding: BufferEncoding, - callback: (error?: Error | null) => void, - ) => void) - | undefined; - writev?: - | (( - this: T, - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ) => void) - | undefined; - final?: ((this: T, callback: (error?: Error | null) => void) => void) | undefined; - } - /** - * @since v0.9.4 - */ - class Writable extends Stream implements NodeJS.WritableStream { - /** - * A utility method for creating a `Writable` from a web `WritableStream`. - * @since v17.0.0 - */ - static fromWeb( - writableStream: streamWeb.WritableStream, - options?: Pick, - ): Writable; - /** - * A utility method for creating a web `WritableStream` from a `Writable`. - * @since v17.0.0 - */ - static toWeb(streamWritable: Writable): streamWeb.WritableStream; - /** - * Is `true` if it is safe to call `writable.write()`, which means - * the stream has not been destroyed, errored, or ended. - * @since v11.4.0 - */ - readonly writable: boolean; - /** - * Returns whether the stream was destroyed or errored before emitting `'finish'`. - * @since v18.0.0, v16.17.0 - */ - readonly writableAborted: boolean; - /** - * Is `true` after `writable.end()` has been called. This property - * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead. - * @since v12.9.0 - */ - readonly writableEnded: boolean; - /** - * Is set to `true` immediately before the `'finish'` event is emitted. - * @since v12.6.0 - */ - readonly writableFinished: boolean; - /** - * Return the value of `highWaterMark` passed when creating this `Writable`. - * @since v9.3.0 - */ - readonly writableHighWaterMark: number; - /** - * This property contains the number of bytes (or objects) in the queue - * ready to be written. The value provides introspection data regarding - * the status of the `highWaterMark`. - * @since v9.4.0 - */ - readonly writableLength: number; - /** - * Getter for the property `objectMode` of a given `Writable` stream. - * @since v12.3.0 - */ - readonly writableObjectMode: boolean; - /** - * Number of times `writable.uncork()` needs to be - * called in order to fully uncork the stream. - * @since v13.2.0, v12.16.0 - */ - readonly writableCorked: number; - /** - * Is `true` after `writable.destroy()` has been called. - * @since v8.0.0 - */ - destroyed: boolean; - /** - * Is `true` after `'close'` has been emitted. - * @since v18.0.0 - */ - readonly closed: boolean; - /** - * Returns error if the stream has been destroyed with an error. - * @since v18.0.0 - */ - readonly errored: Error | null; - /** - * Is `true` if the stream's buffer has been full and stream will emit `'drain'`. - * @since v15.2.0, v14.17.0 - */ - readonly writableNeedDrain: boolean; - constructor(opts?: WritableOptions); - _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - _writev?( - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - _construct?(callback: (error?: Error | null) => void): void; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - /** - * The `writable.write()` method writes some data to the stream, and calls the - * supplied `callback` once the data has been fully handled. If an error - * occurs, the `callback` will be called with the error as its - * first argument. The `callback` is called asynchronously and before `'error'` is - * emitted. - * - * The return value is `true` if the internal buffer is less than the `highWaterMark` configured when the stream was created after admitting `chunk`. - * If `false` is returned, further attempts to write data to the stream should - * stop until the `'drain'` event is emitted. - * - * While a stream is not draining, calls to `write()` will buffer `chunk`, and - * return false. Once all currently buffered chunks are drained (accepted for - * delivery by the operating system), the `'drain'` event will be emitted. - * Once `write()` returns false, do not write more chunks - * until the `'drain'` event is emitted. While calling `write()` on a stream that - * is not draining is allowed, Node.js will buffer all written chunks until - * maximum memory usage occurs, at which point it will abort unconditionally. - * Even before it aborts, high memory usage will cause poor garbage collector - * performance and high RSS (which is not typically released back to the system, - * even after the memory is no longer required). Since TCP sockets may never - * drain if the remote peer does not read the data, writing a socket that is - * not draining may lead to a remotely exploitable vulnerability. - * - * Writing data while the stream is not draining is particularly - * problematic for a `Transform`, because the `Transform` streams are paused - * by default until they are piped or a `'data'` or `'readable'` event handler - * is added. - * - * If the data to be written can be generated or fetched on demand, it is - * recommended to encapsulate the logic into a `Readable` and use {@link pipe}. However, if calling `write()` is preferred, it is - * possible to respect backpressure and avoid memory issues using the `'drain'` event: - * - * ```js - * function write(data, cb) { - * if (!stream.write(data)) { - * stream.once('drain', cb); - * } else { - * process.nextTick(cb); - * } - * } - * - * // Wait for cb to be called before doing any other write. - * write('hello', () => { - * console.log('Write completed, do more writes now.'); - * }); - * ``` - * - * A `Writable` stream in object mode will always ignore the `encoding` argument. - * @since v0.9.4 - * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer}, - * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`. - * @param callback Callback for when this chunk of data is flushed. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean; - /** - * Writes data to the stream, with an explicit encoding for string data. - * @see {@link Writable.write} for full details. - * @since v0.9.4 - * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer}, - * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`. - * @param encoding The encoding, if `chunk` is a string. - * @param callback Callback for when this chunk of data is flushed. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean; - /** - * The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream. - * @since v0.11.15 - * @param encoding The new default encoding - */ - setDefaultEncoding(encoding: BufferEncoding): this; - /** - * Calling the `writable.end()` method signals that no more data will be written - * to the `Writable`. The optional `chunk` and `encoding` arguments allow one - * final additional chunk of data to be written immediately before closing the - * stream. - * - * Calling the {@link write} method after calling {@link end} will raise an error. - * - * ```js - * // Write 'hello, ' and then end with 'world!'. - * import fs from 'node:fs'; - * const file = fs.createWriteStream('example.txt'); - * file.write('hello, '); - * file.end('world!'); - * // Writing more now is not allowed! - * ``` - * @since v0.9.4 - * @param cb Callback for when the stream is finished. - */ - end(cb?: () => void): this; - /** - * Signals that no more data will be written, with one final chunk of data. - * @see {@link Writable.end} for full details. - * @since v0.9.4 - * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer}, - * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`. - * @param cb Callback for when the stream is finished. - */ - end(chunk: any, cb?: () => void): this; - /** - * Signals that no more data will be written, with one final chunk of data. - * @see {@link Writable.end} for full details. - * @since v0.9.4 - * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer}, - * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`. - * @param encoding The encoding if `chunk` is a string - * @param cb Callback for when the stream is finished. - */ - end(chunk: any, encoding: BufferEncoding, cb?: () => void): this; - /** - * The `writable.cork()` method forces all written data to be buffered in memory. - * The buffered data will be flushed when either the {@link uncork} or {@link end} methods are called. - * - * The primary intent of `writable.cork()` is to accommodate a situation in which - * several small chunks are written to the stream in rapid succession. Instead of - * immediately forwarding them to the underlying destination, `writable.cork()` buffers all the chunks until `writable.uncork()` is called, which will pass them - * all to `writable._writev()`, if present. This prevents a head-of-line blocking - * situation where data is being buffered while waiting for the first small chunk - * to be processed. However, use of `writable.cork()` without implementing `writable._writev()` may have an adverse effect on throughput. - * - * See also: `writable.uncork()`, `writable._writev()`. - * @since v0.11.2 - */ - cork(): void; - /** - * The `writable.uncork()` method flushes all data buffered since {@link cork} was called. - * - * When using `writable.cork()` and `writable.uncork()` to manage the buffering - * of writes to a stream, defer calls to `writable.uncork()` using `process.nextTick()`. Doing so allows batching of all `writable.write()` calls that occur within a given Node.js event - * loop phase. - * - * ```js - * stream.cork(); - * stream.write('some '); - * stream.write('data '); - * process.nextTick(() => stream.uncork()); - * ``` - * - * If the `writable.cork()` method is called multiple times on a stream, the - * same number of calls to `writable.uncork()` must be called to flush the buffered - * data. - * - * ```js - * stream.cork(); - * stream.write('some '); - * stream.cork(); - * stream.write('data '); - * process.nextTick(() => { - * stream.uncork(); - * // The data will not be flushed until uncork() is called a second time. - * stream.uncork(); - * }); - * ``` - * - * See also: `writable.cork()`. - * @since v0.11.2 - */ - uncork(): void; - /** - * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the writable - * stream has ended and subsequent calls to `write()` or `end()` will result in - * an `ERR_STREAM_DESTROYED` error. - * This is a destructive and immediate way to destroy a stream. Previous calls to `write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error. - * Use `end()` instead of destroy if data should flush before close, or wait for - * the `'drain'` event before destroying the stream. - * - * Once `destroy()` has been called any further calls will be a no-op and no - * further errors except from `_destroy()` may be emitted as `'error'`. - * - * Implementors should not override this method, - * but instead implement `writable._destroy()`. - * @since v8.0.0 - * @param error Optional, an error to emit with `'error'` event. - */ - destroy(error?: Error): this; - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. drain - * 3. error - * 4. finish - * 5. pipe - * 6. unpipe - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: Readable) => void): this; - addListener(event: "unpipe", listener: (src: Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: Readable): boolean; - emit(event: "unpipe", src: Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: Readable) => void): this; - on(event: "unpipe", listener: (src: Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: Readable) => void): this; - once(event: "unpipe", listener: (src: Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: Readable) => void): this; - prependListener(event: "unpipe", listener: (src: Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: "close", listener: () => void): this; - removeListener(event: "drain", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "finish", listener: () => void): this; - removeListener(event: "pipe", listener: (src: Readable) => void): this; - removeListener(event: "unpipe", listener: (src: Readable) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - interface DuplexOptions extends ReadableOptions, WritableOptions { - allowHalfOpen?: boolean | undefined; - readableObjectMode?: boolean | undefined; - writableObjectMode?: boolean | undefined; - readableHighWaterMark?: number | undefined; - writableHighWaterMark?: number | undefined; - writableCorked?: number | undefined; - } - /** - * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces. - * - * Examples of `Duplex` streams include: - * - * * `TCP sockets` - * * `zlib streams` - * * `crypto streams` - * @since v0.9.4 - */ - class Duplex extends Stream implements NodeJS.ReadWriteStream { - /** - * If `false` then the stream will automatically end the writable side when the - * readable side ends. Set initially by the `allowHalfOpen` constructor option, - * which defaults to `true`. - * - * This can be changed manually to change the half-open behavior of an existing - * `Duplex` stream instance, but must be changed before the `'end'` event is emitted. - * @since v0.9.4 - */ - allowHalfOpen: boolean; - constructor(opts?: DuplexOptions); - /** - * A utility method for creating duplex streams. - * - * - `Stream` converts writable stream into writable `Duplex` and readable stream - * to `Duplex`. - * - `Blob` converts into readable `Duplex`. - * - `string` converts into readable `Duplex`. - * - `ArrayBuffer` converts into readable `Duplex`. - * - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`. - * - `AsyncGeneratorFunction` converts into a readable/writable transform - * `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield - * `null`. - * - `AsyncFunction` converts into a writable `Duplex`. Must return - * either `null` or `undefined` - * - `Object ({ writable, readable })` converts `readable` and - * `writable` into `Stream` and then combines them into `Duplex` where the - * `Duplex` will write to the `writable` and read from the `readable`. - * - `Promise` converts into readable `Duplex`. Value `null` is ignored. - * - * @since v16.8.0 - */ - static from( - src: - | Stream - | NodeBlob - | ArrayBuffer - | string - | Iterable - | AsyncIterable - | AsyncGeneratorFunction - | Promise - | Object, - ): Duplex; - /** - * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`. - * @since v17.0.0 - */ - static toWeb(streamDuplex: Duplex): { - readable: streamWeb.ReadableStream; - writable: streamWeb.WritableStream; - }; - /** - * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`. - * @since v17.0.0 - */ - static fromWeb( - duplexStream: { - readable: streamWeb.ReadableStream; - writable: streamWeb.WritableStream; - }, - options?: Pick< - DuplexOptions, - "allowHalfOpen" | "decodeStrings" | "encoding" | "highWaterMark" | "objectMode" | "signal" - >, - ): Duplex; - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. data - * 3. drain - * 4. end - * 5. error - * 6. finish - * 7. pause - * 8. pipe - * 9. readable - * 10. resume - * 11. unpipe - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: any) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "pipe", listener: (src: Readable) => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "unpipe", listener: (src: Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "data", chunk: any): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pause"): boolean; - emit(event: "pipe", src: Readable): boolean; - emit(event: "readable"): boolean; - emit(event: "resume"): boolean; - emit(event: "unpipe", src: Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: any) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pause", listener: () => void): this; - on(event: "pipe", listener: (src: Readable) => void): this; - on(event: "readable", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "unpipe", listener: (src: Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: any) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pause", listener: () => void): this; - once(event: "pipe", listener: (src: Readable) => void): this; - once(event: "readable", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "unpipe", listener: (src: Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: any) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "pipe", listener: (src: Readable) => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "unpipe", listener: (src: Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: any) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: "close", listener: () => void): this; - removeListener(event: "data", listener: (chunk: any) => void): this; - removeListener(event: "drain", listener: () => void): this; - removeListener(event: "end", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "finish", listener: () => void): this; - removeListener(event: "pause", listener: () => void): this; - removeListener(event: "pipe", listener: (src: Readable) => void): this; - removeListener(event: "readable", listener: () => void): this; - removeListener(event: "resume", listener: () => void): this; - removeListener(event: "unpipe", listener: (src: Readable) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - interface Duplex extends Readable, Writable {} - /** - * The utility function `duplexPair` returns an Array with two items, - * each being a `Duplex` stream connected to the other side: - * - * ```js - * const [ sideA, sideB ] = duplexPair(); - * ``` - * - * Whatever is written to one stream is made readable on the other. It provides - * behavior analogous to a network connection, where the data written by the client - * becomes readable by the server, and vice-versa. - * - * The Duplex streams are symmetrical; one or the other may be used without any - * difference in behavior. - * @param options A value to pass to both {@link Duplex} constructors, - * to set options such as buffering. - * @since v22.6.0 - */ - function duplexPair(options?: DuplexOptions): [Duplex, Duplex]; - type TransformCallback = (error?: Error | null, data?: any) => void; - interface TransformOptions extends DuplexOptions { - transform?: - | ((this: T, chunk: any, encoding: BufferEncoding, callback: TransformCallback) => void) - | undefined; - flush?: ((this: T, callback: TransformCallback) => void) | undefined; - } - /** - * Transform streams are `Duplex` streams where the output is in some way - * related to the input. Like all `Duplex` streams, `Transform` streams - * implement both the `Readable` and `Writable` interfaces. - * - * Examples of `Transform` streams include: - * - * * `zlib streams` - * * `crypto streams` - * @since v0.9.4 - */ - class Transform extends Duplex { - constructor(opts?: TransformOptions); - _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; - _flush(callback: TransformCallback): void; - } - /** - * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is - * primarily for examples and testing, but there are some use cases where `stream.PassThrough` is useful as a building block for novel sorts of streams. - */ - class PassThrough extends Transform {} - /** - * A stream to attach a signal to. - * - * Attaches an AbortSignal to a readable or writeable stream. This lets code - * control stream destruction using an `AbortController`. - * - * Calling `abort` on the `AbortController` corresponding to the passed `AbortSignal` will behave the same way as calling `.destroy(new AbortError())` on the - * stream, and `controller.error(new AbortError())` for webstreams. - * - * ```js - * import fs from 'node:fs'; - * - * const controller = new AbortController(); - * const read = addAbortSignal( - * controller.signal, - * fs.createReadStream(('object.json')), - * ); - * // Later, abort the operation closing the stream - * controller.abort(); - * ``` - * - * Or using an `AbortSignal` with a readable stream as an async iterable: - * - * ```js - * const controller = new AbortController(); - * setTimeout(() => controller.abort(), 10_000); // set a timeout - * const stream = addAbortSignal( - * controller.signal, - * fs.createReadStream(('object.json')), - * ); - * (async () => { - * try { - * for await (const chunk of stream) { - * await process(chunk); - * } - * } catch (e) { - * if (e.name === 'AbortError') { - * // The operation was cancelled - * } else { - * throw e; - * } - * } - * })(); - * ``` - * - * Or using an `AbortSignal` with a ReadableStream: - * - * ```js - * const controller = new AbortController(); - * const rs = new ReadableStream({ - * start(controller) { - * controller.enqueue('hello'); - * controller.enqueue('world'); - * controller.close(); - * }, - * }); - * - * addAbortSignal(controller.signal, rs); - * - * finished(rs, (err) => { - * if (err) { - * if (err.name === 'AbortError') { - * // The operation was cancelled - * } - * } - * }); - * - * const reader = rs.getReader(); - * - * reader.read().then(({ value, done }) => { - * console.log(value); // hello - * console.log(done); // false - * controller.abort(); - * }); - * ``` - * @since v15.4.0 - * @param signal A signal representing possible cancellation - * @param stream A stream to attach a signal to. - */ - function addAbortSignal(signal: AbortSignal, stream: T): T; - /** - * Returns the default highWaterMark used by streams. - * Defaults to `65536` (64 KiB), or `16` for `objectMode`. - * @since v19.9.0 - */ - function getDefaultHighWaterMark(objectMode: boolean): number; - /** - * Sets the default highWaterMark used by streams. - * @since v19.9.0 - * @param value highWaterMark value - */ - function setDefaultHighWaterMark(objectMode: boolean, value: number): void; - interface FinishedOptions extends Abortable { - error?: boolean | undefined; - readable?: boolean | undefined; - writable?: boolean | undefined; - } - /** - * A readable and/or writable stream/webstream. - * - * A function to get notified when a stream is no longer readable, writable - * or has experienced an error or a premature close event. - * - * ```js - * import { finished } from 'node:stream'; - * import fs from 'node:fs'; - * - * const rs = fs.createReadStream('archive.tar'); - * - * finished(rs, (err) => { - * if (err) { - * console.error('Stream failed.', err); - * } else { - * console.log('Stream is done reading.'); - * } - * }); - * - * rs.resume(); // Drain the stream. - * ``` - * - * Especially useful in error handling scenarios where a stream is destroyed - * prematurely (like an aborted HTTP request), and will not emit `'end'` or `'finish'`. - * - * The `finished` API provides [`promise version`](https://nodejs.org/docs/latest-v22.x/api/stream.html#streamfinishedstream-options). - * - * `stream.finished()` leaves dangling event listeners (in particular `'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been - * invoked. The reason for this is so that unexpected `'error'` events (due to - * incorrect stream implementations) do not cause unexpected crashes. - * If this is unwanted behavior then the returned cleanup function needs to be - * invoked in the callback: - * - * ```js - * const cleanup = finished(rs, (err) => { - * cleanup(); - * // ... - * }); - * ``` - * @since v10.0.0 - * @param stream A readable and/or writable stream. - * @param callback A callback function that takes an optional error argument. - * @returns A cleanup function which removes all registered listeners. - */ - function finished( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - options: FinishedOptions, - callback: (err?: NodeJS.ErrnoException | null) => void, - ): () => void; - function finished( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - callback: (err?: NodeJS.ErrnoException | null) => void, - ): () => void; - namespace finished { - function __promisify__( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - options?: FinishedOptions, - ): Promise; - } - type PipelineSourceFunction = () => Iterable | AsyncIterable; - type PipelineSource = Iterable | AsyncIterable | NodeJS.ReadableStream | PipelineSourceFunction; - type PipelineTransform, U> = - | NodeJS.ReadWriteStream - | (( - source: S extends (...args: any[]) => Iterable | AsyncIterable ? AsyncIterable - : S, - ) => AsyncIterable); - type PipelineTransformSource = PipelineSource | PipelineTransform; - type PipelineDestinationIterableFunction = (source: AsyncIterable) => AsyncIterable; - type PipelineDestinationPromiseFunction = (source: AsyncIterable) => Promise

                          ; - type PipelineDestination, P> = S extends - PipelineTransformSource ? - | NodeJS.WritableStream - | PipelineDestinationIterableFunction - | PipelineDestinationPromiseFunction - : never; - type PipelineCallback> = S extends - PipelineDestinationPromiseFunction ? (err: NodeJS.ErrnoException | null, value: P) => void - : (err: NodeJS.ErrnoException | null) => void; - type PipelinePromise> = S extends - PipelineDestinationPromiseFunction ? Promise

                          : Promise; - interface PipelineOptions { - signal?: AbortSignal | undefined; - end?: boolean | undefined; - } - /** - * A module method to pipe between streams and generators forwarding errors and - * properly cleaning up and provide a callback when the pipeline is complete. - * - * ```js - * import { pipeline } from 'node:stream'; - * import fs from 'node:fs'; - * import zlib from 'node:zlib'; - * - * // Use the pipeline API to easily pipe a series of streams - * // together and get notified when the pipeline is fully done. - * - * // A pipeline to gzip a potentially huge tar file efficiently: - * - * pipeline( - * fs.createReadStream('archive.tar'), - * zlib.createGzip(), - * fs.createWriteStream('archive.tar.gz'), - * (err) => { - * if (err) { - * console.error('Pipeline failed.', err); - * } else { - * console.log('Pipeline succeeded.'); - * } - * }, - * ); - * ``` - * - * The `pipeline` API provides a [`promise version`](https://nodejs.org/docs/latest-v22.x/api/stream.html#streampipelinesource-transforms-destination-options). - * - * `stream.pipeline()` will call `stream.destroy(err)` on all streams except: - * - * * `Readable` streams which have emitted `'end'` or `'close'`. - * * `Writable` streams which have emitted `'finish'` or `'close'`. - * - * `stream.pipeline()` leaves dangling event listeners on the streams - * after the `callback` has been invoked. In the case of reuse of streams after - * failure, this can cause event listener leaks and swallowed errors. If the last - * stream is readable, dangling event listeners will be removed so that the last - * stream can be consumed later. - * - * `stream.pipeline()` closes all the streams when an error is raised. - * The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior - * once it would destroy the socket without sending the expected response. - * See the example below: - * - * ```js - * import fs from 'node:fs'; - * import http from 'node:http'; - * import { pipeline } from 'node:stream'; - * - * const server = http.createServer((req, res) => { - * const fileStream = fs.createReadStream('./fileNotExist.txt'); - * pipeline(fileStream, res, (err) => { - * if (err) { - * console.log(err); // No such file - * // this message can't be sent once `pipeline` already destroyed the socket - * return res.end('error!!!'); - * } - * }); - * }); - * ``` - * @since v10.0.0 - * @param callback Called when the pipeline is fully done. - */ - function pipeline, B extends PipelineDestination>( - source: A, - destination: B, - callback: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - destination: B, - callback: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - destination: B, - callback: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - destination: B, - callback: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - T4 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - transform4: T4, - destination: B, - callback: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline( - streams: ReadonlyArray, - callback: (err: NodeJS.ErrnoException | null) => void, - ): NodeJS.WritableStream; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array< - NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void) - > - ): NodeJS.WritableStream; - namespace pipeline { - function __promisify__, B extends PipelineDestination>( - source: A, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - T4 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - transform4: T4, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__( - streams: ReadonlyArray, - options?: PipelineOptions, - ): Promise; - function __promisify__( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array - ): Promise; - } - // TODO: this interface never existed; remove in next major - interface Pipe { - close(): void; - hasRef(): boolean; - ref(): void; - unref(): void; - } - /** - * Returns whether the stream has encountered an error. - * @since v17.3.0, v16.14.0 - */ - function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean; - /** - * Returns whether the stream is readable. - * @since v17.4.0, v16.14.0 - */ - function isReadable(stream: Readable | NodeJS.ReadableStream): boolean; - } - export = Stream; -} -declare module "node:stream" { - import stream = require("stream"); - export = stream; -} diff --git a/node_modules/@types/node/stream/consumers.d.ts b/node_modules/@types/node/stream/consumers.d.ts deleted file mode 100644 index 05db025..0000000 --- a/node_modules/@types/node/stream/consumers.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * The utility consumer functions provide common options for consuming - * streams. - * @since v16.7.0 - */ -declare module "stream/consumers" { - import { Blob as NodeBlob, NonSharedBuffer } from "node:buffer"; - import { ReadableStream as WebReadableStream } from "node:stream/web"; - /** - * @since v16.7.0 - * @returns Fulfills with an `ArrayBuffer` containing the full contents of the stream. - */ - function arrayBuffer(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable): Promise; - /** - * @since v16.7.0 - * @returns Fulfills with a `Blob` containing the full contents of the stream. - */ - function blob(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable): Promise; - /** - * @since v16.7.0 - * @returns Fulfills with a `Buffer` containing the full contents of the stream. - */ - function buffer(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable): Promise; - /** - * @since v16.7.0 - * @returns Fulfills with the contents of the stream parsed as a - * UTF-8 encoded string that is then passed through `JSON.parse()`. - */ - function json(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable): Promise; - /** - * @since v16.7.0 - * @returns Fulfills with the contents of the stream parsed as a UTF-8 encoded string. - */ - function text(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable): Promise; -} -declare module "node:stream/consumers" { - export * from "stream/consumers"; -} diff --git a/node_modules/@types/node/stream/promises.d.ts b/node_modules/@types/node/stream/promises.d.ts deleted file mode 100644 index d54c14c..0000000 --- a/node_modules/@types/node/stream/promises.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -declare module "stream/promises" { - import { - FinishedOptions as _FinishedOptions, - PipelineDestination, - PipelineOptions, - PipelinePromise, - PipelineSource, - PipelineTransform, - } from "node:stream"; - interface FinishedOptions extends _FinishedOptions { - /** - * If true, removes the listeners registered by this function before the promise is fulfilled. - * @default false - */ - cleanup?: boolean | undefined; - } - function finished( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - options?: FinishedOptions, - ): Promise; - function pipeline, B extends PipelineDestination>( - source: A, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - T4 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - transform4: T4, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline( - streams: ReadonlyArray, - options?: PipelineOptions, - ): Promise; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array - ): Promise; -} -declare module "node:stream/promises" { - export * from "stream/promises"; -} diff --git a/node_modules/@types/node/stream/web.d.ts b/node_modules/@types/node/stream/web.d.ts deleted file mode 100644 index c7432f8..0000000 --- a/node_modules/@types/node/stream/web.d.ts +++ /dev/null @@ -1,622 +0,0 @@ -type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").ByteLengthQueuingStrategy; -type _CompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {} - : import("stream/web").CompressionStream; -type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").CountQueuingStrategy; -type _DecompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {} - : import("stream/web").DecompressionStream; -type _QueuingStrategy = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").QueuingStrategy; -type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").ReadableByteStreamController; -type _ReadableStream = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").ReadableStream; -type _ReadableStreamBYOBReader = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").ReadableStreamBYOBReader; -type _ReadableStreamBYOBRequest = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").ReadableStreamBYOBRequest; -type _ReadableStreamDefaultController = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").ReadableStreamDefaultController; -type _ReadableStreamDefaultReader = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").ReadableStreamDefaultReader; -type _TextDecoderStream = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").TextDecoderStream; -type _TextEncoderStream = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").TextEncoderStream; -type _TransformStream = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").TransformStream; -type _TransformStreamDefaultController = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").TransformStreamDefaultController; -type _WritableStream = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").WritableStream; -type _WritableStreamDefaultController = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").WritableStreamDefaultController; -type _WritableStreamDefaultWriter = typeof globalThis extends { onmessage: any } ? {} - : import("stream/web").WritableStreamDefaultWriter; - -declare module "stream/web" { - // stub module, pending copy&paste from .d.ts or manual impl - // copy from lib.dom.d.ts - interface ReadableWritablePair { - readable: ReadableStream; - /** - * Provides a convenient, chainable way of piping this readable stream - * through a transform stream (or any other { writable, readable } - * pair). It simply pipes the stream into the writable side of the - * supplied pair, and returns the readable side for further use. - * - * Piping a stream will lock it for the duration of the pipe, preventing - * any other consumer from acquiring a reader. - */ - writable: WritableStream; - } - interface StreamPipeOptions { - preventAbort?: boolean; - preventCancel?: boolean; - /** - * Pipes this readable stream to a given writable stream destination. - * The way in which the piping process behaves under various error - * conditions can be customized with a number of passed options. It - * returns a promise that fulfills when the piping process completes - * successfully, or rejects if any errors were encountered. - * - * Piping a stream will lock it for the duration of the pipe, preventing - * any other consumer from acquiring a reader. - * - * Errors and closures of the source and destination streams propagate - * as follows: - * - * An error in this source readable stream will abort destination, - * unless preventAbort is truthy. The returned promise will be rejected - * with the source's error, or with any error that occurs during - * aborting the destination. - * - * An error in destination will cancel this source readable stream, - * unless preventCancel is truthy. The returned promise will be rejected - * with the destination's error, or with any error that occurs during - * canceling the source. - * - * When this source readable stream closes, destination will be closed, - * unless preventClose is truthy. The returned promise will be fulfilled - * once this process completes, unless an error is encountered while - * closing the destination, in which case it will be rejected with that - * error. - * - * If destination starts out closed or closing, this source readable - * stream will be canceled, unless preventCancel is true. The returned - * promise will be rejected with an error indicating piping to a closed - * stream failed, or with any error that occurs during canceling the - * source. - * - * The signal option can be set to an AbortSignal to allow aborting an - * ongoing pipe operation via the corresponding AbortController. In this - * case, this source readable stream will be canceled, and destination - * aborted, unless the respective options preventCancel or preventAbort - * are set. - */ - preventClose?: boolean; - signal?: AbortSignal; - } - interface ReadableStreamGenericReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - } - type ReadableStreamController = ReadableStreamDefaultController; - interface ReadableStreamReadValueResult { - done: false; - value: T; - } - interface ReadableStreamReadDoneResult { - done: true; - value: T | undefined; - } - type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; - interface ReadableByteStreamControllerCallback { - (controller: ReadableByteStreamController): void | PromiseLike; - } - interface UnderlyingSinkAbortCallback { - (reason?: any): void | PromiseLike; - } - interface UnderlyingSinkCloseCallback { - (): void | PromiseLike; - } - interface UnderlyingSinkStartCallback { - (controller: WritableStreamDefaultController): any; - } - interface UnderlyingSinkWriteCallback { - (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike; - } - interface UnderlyingSourceCancelCallback { - (reason?: any): void | PromiseLike; - } - interface UnderlyingSourcePullCallback { - (controller: ReadableStreamController): void | PromiseLike; - } - interface UnderlyingSourceStartCallback { - (controller: ReadableStreamController): any; - } - interface TransformerFlushCallback { - (controller: TransformStreamDefaultController): void | PromiseLike; - } - interface TransformerStartCallback { - (controller: TransformStreamDefaultController): any; - } - interface TransformerTransformCallback { - (chunk: I, controller: TransformStreamDefaultController): void | PromiseLike; - } - interface TransformerCancelCallback { - (reason: any): void | PromiseLike; - } - interface UnderlyingByteSource { - autoAllocateChunkSize?: number; - cancel?: ReadableStreamErrorCallback; - pull?: ReadableByteStreamControllerCallback; - start?: ReadableByteStreamControllerCallback; - type: "bytes"; - } - interface UnderlyingSource { - cancel?: UnderlyingSourceCancelCallback; - pull?: UnderlyingSourcePullCallback; - start?: UnderlyingSourceStartCallback; - type?: undefined; - } - interface UnderlyingSink { - abort?: UnderlyingSinkAbortCallback; - close?: UnderlyingSinkCloseCallback; - start?: UnderlyingSinkStartCallback; - type?: undefined; - write?: UnderlyingSinkWriteCallback; - } - interface ReadableStreamErrorCallback { - (reason: any): void | PromiseLike; - } - interface ReadableStreamAsyncIterator extends NodeJS.AsyncIterator { - [Symbol.asyncIterator](): ReadableStreamAsyncIterator; - } - /** This Streams API interface represents a readable stream of byte data. */ - interface ReadableStream { - readonly locked: boolean; - cancel(reason?: any): Promise; - getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; - getReader(): ReadableStreamDefaultReader; - getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader; - pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; - pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: { preventCancel?: boolean }): ReadableStreamAsyncIterator; - [Symbol.asyncIterator](): ReadableStreamAsyncIterator; - } - const ReadableStream: { - prototype: ReadableStream; - from(iterable: Iterable | AsyncIterable): ReadableStream; - new(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy): ReadableStream; - new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; - }; - type ReadableStreamReaderMode = "byob"; - interface ReadableStreamGetReaderOptions { - /** - * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. - * - * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. - */ - mode?: ReadableStreamReaderMode; - } - type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader; - interface ReadableStreamDefaultReader extends ReadableStreamGenericReader { - read(): Promise>; - releaseLock(): void; - } - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */ - interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */ - read( - view: T, - options?: { - min?: number; - }, - ): Promise>; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */ - releaseLock(): void; - } - const ReadableStreamDefaultReader: { - prototype: ReadableStreamDefaultReader; - new(stream: ReadableStream): ReadableStreamDefaultReader; - }; - const ReadableStreamBYOBReader: { - prototype: ReadableStreamBYOBReader; - new(stream: ReadableStream): ReadableStreamBYOBReader; - }; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */ - interface ReadableStreamBYOBRequest { - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */ - readonly view: ArrayBufferView | null; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */ - respond(bytesWritten: number): void; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */ - respondWithNewView(view: ArrayBufferView): void; - } - const ReadableStreamBYOBRequest: { - prototype: ReadableStreamBYOBRequest; - new(): ReadableStreamBYOBRequest; - }; - interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBufferView): void; - error(error?: any): void; - } - const ReadableByteStreamController: { - prototype: ReadableByteStreamController; - new(): ReadableByteStreamController; - }; - interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: R): void; - error(e?: any): void; - } - const ReadableStreamDefaultController: { - prototype: ReadableStreamDefaultController; - new(): ReadableStreamDefaultController; - }; - interface Transformer { - flush?: TransformerFlushCallback; - readableType?: undefined; - start?: TransformerStartCallback; - transform?: TransformerTransformCallback; - cancel?: TransformerCancelCallback; - writableType?: undefined; - } - interface TransformStream { - readonly readable: ReadableStream; - readonly writable: WritableStream; - } - const TransformStream: { - prototype: TransformStream; - new( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy, - ): TransformStream; - }; - interface TransformStreamDefaultController { - readonly desiredSize: number | null; - enqueue(chunk: O): void; - error(reason?: any): void; - terminate(): void; - } - const TransformStreamDefaultController: { - prototype: TransformStreamDefaultController; - new(): TransformStreamDefaultController; - }; - /** - * This Streams API interface provides a standard abstraction for writing - * streaming data to a destination, known as a sink. This object comes with - * built-in back pressure and queuing. - */ - interface WritableStream { - readonly locked: boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; - } - const WritableStream: { - prototype: WritableStream; - new(underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy): WritableStream; - }; - /** - * This Streams API interface is the object returned by - * WritableStream.getWriter() and once created locks the < writer to the - * WritableStream ensuring that no other streams can write to the underlying - * sink. - */ - interface WritableStreamDefaultWriter { - readonly closed: Promise; - readonly desiredSize: number | null; - readonly ready: Promise; - abort(reason?: any): Promise; - close(): Promise; - releaseLock(): void; - write(chunk: W): Promise; - } - const WritableStreamDefaultWriter: { - prototype: WritableStreamDefaultWriter; - new(stream: WritableStream): WritableStreamDefaultWriter; - }; - /** - * This Streams API interface represents a controller allowing control of a - * WritableStream's state. When constructing a WritableStream, the - * underlying sink is given a corresponding WritableStreamDefaultController - * instance to manipulate. - */ - interface WritableStreamDefaultController { - error(e?: any): void; - } - const WritableStreamDefaultController: { - prototype: WritableStreamDefaultController; - new(): WritableStreamDefaultController; - }; - interface QueuingStrategy { - highWaterMark?: number; - size?: QueuingStrategySize; - } - interface QueuingStrategySize { - (chunk: T): number; - } - interface QueuingStrategyInit { - /** - * Creates a new ByteLengthQueuingStrategy with the provided high water - * mark. - * - * Note that the provided high water mark will not be validated ahead of - * time. Instead, if it is negative, NaN, or not a number, the resulting - * ByteLengthQueuingStrategy will cause the corresponding stream - * constructor to throw. - */ - highWaterMark: number; - } - /** - * This Streams API interface provides a built-in byte length queuing - * strategy that can be used when constructing streams. - */ - interface ByteLengthQueuingStrategy extends QueuingStrategy { - readonly highWaterMark: number; - readonly size: QueuingStrategySize; - } - const ByteLengthQueuingStrategy: { - prototype: ByteLengthQueuingStrategy; - new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; - }; - /** - * This Streams API interface provides a built-in byte length queuing - * strategy that can be used when constructing streams. - */ - interface CountQueuingStrategy extends QueuingStrategy { - readonly highWaterMark: number; - readonly size: QueuingStrategySize; - } - const CountQueuingStrategy: { - prototype: CountQueuingStrategy; - new(init: QueuingStrategyInit): CountQueuingStrategy; - }; - interface TextEncoderStream { - /** Returns "utf-8". */ - readonly encoding: "utf-8"; - readonly readable: ReadableStream; - readonly writable: WritableStream; - readonly [Symbol.toStringTag]: string; - } - const TextEncoderStream: { - prototype: TextEncoderStream; - new(): TextEncoderStream; - }; - interface TextDecoderOptions { - fatal?: boolean; - ignoreBOM?: boolean; - } - type BufferSource = ArrayBufferView | ArrayBuffer; - interface TextDecoderStream { - /** Returns encoding's name, lower cased. */ - readonly encoding: string; - /** Returns `true` if error mode is "fatal", and `false` otherwise. */ - readonly fatal: boolean; - /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */ - readonly ignoreBOM: boolean; - readonly readable: ReadableStream; - readonly writable: WritableStream; - readonly [Symbol.toStringTag]: string; - } - const TextDecoderStream: { - prototype: TextDecoderStream; - new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream; - }; - interface CompressionStream { - readonly readable: ReadableStream; - readonly writable: WritableStream; - } - const CompressionStream: { - prototype: CompressionStream; - new(format: "deflate" | "deflate-raw" | "gzip"): CompressionStream; - }; - interface DecompressionStream { - readonly writable: WritableStream; - readonly readable: ReadableStream; - } - const DecompressionStream: { - prototype: DecompressionStream; - new(format: "deflate" | "deflate-raw" | "gzip"): DecompressionStream; - }; - - global { - interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {} - /** - * `ByteLengthQueuingStrategy` class is a global reference for `import { ByteLengthQueuingStrategy } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-bytelengthqueuingstrategy - * @since v18.0.0 - */ - var ByteLengthQueuingStrategy: typeof globalThis extends { onmessage: any; ByteLengthQueuingStrategy: infer T } - ? T - : typeof import("stream/web").ByteLengthQueuingStrategy; - - interface CompressionStream extends _CompressionStream {} - /** - * `CompressionStream` class is a global reference for `import { CompressionStream } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-compressionstream - * @since v18.0.0 - */ - var CompressionStream: typeof globalThis extends { - onmessage: any; - // CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit. - // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts - ReportingObserver: any; - CompressionStream: infer T; - } ? T - // TS 4.8, 4.9, 5.0 - : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? { - prototype: T; - new(format: "deflate" | "deflate-raw" | "gzip"): T; - } - : typeof import("stream/web").CompressionStream; - - interface CountQueuingStrategy extends _CountQueuingStrategy {} - /** - * `CountQueuingStrategy` class is a global reference for `import { CountQueuingStrategy } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-countqueuingstrategy - * @since v18.0.0 - */ - var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T - : typeof import("stream/web").CountQueuingStrategy; - - interface DecompressionStream extends _DecompressionStream {} - /** - * `DecompressionStream` class is a global reference for `import { DecompressionStream } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-decompressionstream - * @since v18.0.0 - */ - var DecompressionStream: typeof globalThis extends { - onmessage: any; - // CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit. - // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts - ReportingObserver: any; - DecompressionStream: infer T extends object; - } ? T - // TS 4.8, 4.9, 5.0 - : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? { - prototype: T; - new(format: "deflate" | "deflate-raw" | "gzip"): T; - } - : typeof import("stream/web").DecompressionStream; - - interface QueuingStrategy extends _QueuingStrategy {} - - interface ReadableByteStreamController extends _ReadableByteStreamController {} - /** - * `ReadableByteStreamController` class is a global reference for `import { ReadableByteStreamController } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-readablebytestreamcontroller - * @since v18.0.0 - */ - var ReadableByteStreamController: typeof globalThis extends - { onmessage: any; ReadableByteStreamController: infer T } ? T - : typeof import("stream/web").ReadableByteStreamController; - - interface ReadableStream extends _ReadableStream {} - /** - * `ReadableStream` class is a global reference for `import { ReadableStream } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-readablestream - * @since v18.0.0 - */ - var ReadableStream: typeof globalThis extends { onmessage: any; ReadableStream: infer T } ? T - : typeof import("stream/web").ReadableStream; - - interface ReadableStreamBYOBReader extends _ReadableStreamBYOBReader {} - /** - * `ReadableStreamBYOBReader` class is a global reference for `import { ReadableStreamBYOBReader } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-readablestreambyobreader - * @since v18.0.0 - */ - var ReadableStreamBYOBReader: typeof globalThis extends { onmessage: any; ReadableStreamBYOBReader: infer T } - ? T - : typeof import("stream/web").ReadableStreamBYOBReader; - - interface ReadableStreamBYOBRequest extends _ReadableStreamBYOBRequest {} - /** - * `ReadableStreamBYOBRequest` class is a global reference for `import { ReadableStreamBYOBRequest } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-readablestreambyobrequest - * @since v18.0.0 - */ - var ReadableStreamBYOBRequest: typeof globalThis extends { onmessage: any; ReadableStreamBYOBRequest: infer T } - ? T - : typeof import("stream/web").ReadableStreamBYOBRequest; - - interface ReadableStreamDefaultController extends _ReadableStreamDefaultController {} - /** - * `ReadableStreamDefaultController` class is a global reference for `import { ReadableStreamDefaultController } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-readablestreamdefaultcontroller - * @since v18.0.0 - */ - var ReadableStreamDefaultController: typeof globalThis extends - { onmessage: any; ReadableStreamDefaultController: infer T } ? T - : typeof import("stream/web").ReadableStreamDefaultController; - - interface ReadableStreamDefaultReader extends _ReadableStreamDefaultReader {} - /** - * `ReadableStreamDefaultReader` class is a global reference for `import { ReadableStreamDefaultReader } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-readablestreamdefaultreader - * @since v18.0.0 - */ - var ReadableStreamDefaultReader: typeof globalThis extends - { onmessage: any; ReadableStreamDefaultReader: infer T } ? T - : typeof import("stream/web").ReadableStreamDefaultReader; - - interface TextDecoderStream extends _TextDecoderStream {} - /** - * `TextDecoderStream` class is a global reference for `import { TextDecoderStream } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-textdecoderstream - * @since v18.0.0 - */ - var TextDecoderStream: typeof globalThis extends { onmessage: any; TextDecoderStream: infer T } ? T - : typeof import("stream/web").TextDecoderStream; - - interface TextEncoderStream extends _TextEncoderStream {} - /** - * `TextEncoderStream` class is a global reference for `import { TextEncoderStream } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-textencoderstream - * @since v18.0.0 - */ - var TextEncoderStream: typeof globalThis extends { onmessage: any; TextEncoderStream: infer T } ? T - : typeof import("stream/web").TextEncoderStream; - - interface TransformStream extends _TransformStream {} - /** - * `TransformStream` class is a global reference for `import { TransformStream } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-transformstream - * @since v18.0.0 - */ - var TransformStream: typeof globalThis extends { onmessage: any; TransformStream: infer T } ? T - : typeof import("stream/web").TransformStream; - - interface TransformStreamDefaultController extends _TransformStreamDefaultController {} - /** - * `TransformStreamDefaultController` class is a global reference for `import { TransformStreamDefaultController } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-transformstreamdefaultcontroller - * @since v18.0.0 - */ - var TransformStreamDefaultController: typeof globalThis extends - { onmessage: any; TransformStreamDefaultController: infer T } ? T - : typeof import("stream/web").TransformStreamDefaultController; - - interface WritableStream extends _WritableStream {} - /** - * `WritableStream` class is a global reference for `import { WritableStream } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-writablestream - * @since v18.0.0 - */ - var WritableStream: typeof globalThis extends { onmessage: any; WritableStream: infer T } ? T - : typeof import("stream/web").WritableStream; - - interface WritableStreamDefaultController extends _WritableStreamDefaultController {} - /** - * `WritableStreamDefaultController` class is a global reference for `import { WritableStreamDefaultController } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-writablestreamdefaultcontroller - * @since v18.0.0 - */ - var WritableStreamDefaultController: typeof globalThis extends - { onmessage: any; WritableStreamDefaultController: infer T } ? T - : typeof import("stream/web").WritableStreamDefaultController; - - interface WritableStreamDefaultWriter extends _WritableStreamDefaultWriter {} - /** - * `WritableStreamDefaultWriter` class is a global reference for `import { WritableStreamDefaultWriter } from 'node:stream/web'`. - * https://nodejs.org/api/globals.html#class-writablestreamdefaultwriter - * @since v18.0.0 - */ - var WritableStreamDefaultWriter: typeof globalThis extends - { onmessage: any; WritableStreamDefaultWriter: infer T } ? T - : typeof import("stream/web").WritableStreamDefaultWriter; - } -} -declare module "node:stream/web" { - export * from "stream/web"; -} diff --git a/node_modules/@types/node/string_decoder.d.ts b/node_modules/@types/node/string_decoder.d.ts deleted file mode 100644 index d8b9be8..0000000 --- a/node_modules/@types/node/string_decoder.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * The `node:string_decoder` module provides an API for decoding `Buffer` objects - * into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 - * characters. It can be accessed using: - * - * ```js - * import { StringDecoder } from 'node:string_decoder'; - * ``` - * - * The following example shows the basic use of the `StringDecoder` class. - * - * ```js - * import { StringDecoder } from 'node:string_decoder'; - * const decoder = new StringDecoder('utf8'); - * - * const cent = Buffer.from([0xC2, 0xA2]); - * console.log(decoder.write(cent)); // Prints: ¢ - * - * const euro = Buffer.from([0xE2, 0x82, 0xAC]); - * console.log(decoder.write(euro)); // Prints: € - * ``` - * - * When a `Buffer` instance is written to the `StringDecoder` instance, an - * internal buffer is used to ensure that the decoded string does not contain - * any incomplete multibyte characters. These are held in the buffer until the - * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called. - * - * In the following example, the three UTF-8 encoded bytes of the European Euro - * symbol (`€`) are written over three separate operations: - * - * ```js - * import { StringDecoder } from 'node:string_decoder'; - * const decoder = new StringDecoder('utf8'); - * - * decoder.write(Buffer.from([0xE2])); - * decoder.write(Buffer.from([0x82])); - * console.log(decoder.end(Buffer.from([0xAC]))); // Prints: € - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/string_decoder.js) - */ -declare module "string_decoder" { - class StringDecoder { - constructor(encoding?: BufferEncoding); - /** - * Returns a decoded string, ensuring that any incomplete multibyte characters at - * the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the - * returned string and stored in an internal buffer for the next call to `stringDecoder.write()` or `stringDecoder.end()`. - * @since v0.1.99 - * @param buffer The bytes to decode. - */ - write(buffer: string | NodeJS.ArrayBufferView): string; - /** - * Returns any remaining input stored in the internal buffer as a string. Bytes - * representing incomplete UTF-8 and UTF-16 characters will be replaced with - * substitution characters appropriate for the character encoding. - * - * If the `buffer` argument is provided, one final call to `stringDecoder.write()` is performed before returning the remaining input. - * After `end()` is called, the `stringDecoder` object can be reused for new input. - * @since v0.9.3 - * @param buffer The bytes to decode. - */ - end(buffer?: string | NodeJS.ArrayBufferView): string; - } -} -declare module "node:string_decoder" { - export * from "string_decoder"; -} diff --git a/node_modules/@types/node/test.d.ts b/node_modules/@types/node/test.d.ts deleted file mode 100644 index 1e9613a..0000000 --- a/node_modules/@types/node/test.d.ts +++ /dev/null @@ -1,2163 +0,0 @@ -/** - * The `node:test` module facilitates the creation of JavaScript tests. - * To access it: - * - * ```js - * import test from 'node:test'; - * ``` - * - * This module is only available under the `node:` scheme. The following will not - * work: - * - * ```js - * import test from 'node:test'; - * ``` - * - * Tests created via the `test` module consist of a single function that is - * processed in one of three ways: - * - * 1. A synchronous function that is considered failing if it throws an exception, - * and is considered passing otherwise. - * 2. A function that returns a `Promise` that is considered failing if the `Promise` rejects, and is considered passing if the `Promise` fulfills. - * 3. A function that receives a callback function. If the callback receives any - * truthy value as its first argument, the test is considered failing. If a - * falsy value is passed as the first argument to the callback, the test is - * considered passing. If the test function receives a callback function and - * also returns a `Promise`, the test will fail. - * - * The following example illustrates how tests are written using the `test` module. - * - * ```js - * test('synchronous passing test', (t) => { - * // This test passes because it does not throw an exception. - * assert.strictEqual(1, 1); - * }); - * - * test('synchronous failing test', (t) => { - * // This test fails because it throws an exception. - * assert.strictEqual(1, 2); - * }); - * - * test('asynchronous passing test', async (t) => { - * // This test passes because the Promise returned by the async - * // function is settled and not rejected. - * assert.strictEqual(1, 1); - * }); - * - * test('asynchronous failing test', async (t) => { - * // This test fails because the Promise returned by the async - * // function is rejected. - * assert.strictEqual(1, 2); - * }); - * - * test('failing test using Promises', (t) => { - * // Promises can be used directly as well. - * return new Promise((resolve, reject) => { - * setImmediate(() => { - * reject(new Error('this will cause the test to fail')); - * }); - * }); - * }); - * - * test('callback passing test', (t, done) => { - * // done() is the callback function. When the setImmediate() runs, it invokes - * // done() with no arguments. - * setImmediate(done); - * }); - * - * test('callback failing test', (t, done) => { - * // When the setImmediate() runs, done() is invoked with an Error object and - * // the test fails. - * setImmediate(() => { - * done(new Error('callback failure')); - * }); - * }); - * ``` - * - * If any tests fail, the process exit code is set to `1`. - * @since v18.0.0, v16.17.0 - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test.js) - */ -declare module "node:test" { - import { AssertMethodNames } from "node:assert"; - import { Readable } from "node:stream"; - import { URL } from "node:url"; - import TestFn = test.TestFn; - import TestOptions = test.TestOptions; - /** - * The `test()` function is the value imported from the `test` module. Each - * invocation of this function results in reporting the test to the `TestsStream`. - * - * The `TestContext` object passed to the `fn` argument can be used to perform - * actions related to the current test. Examples include skipping the test, adding - * additional diagnostic information, or creating subtests. - * - * `test()` returns a `Promise` that fulfills once the test completes. - * if `test()` is called within a suite, it fulfills immediately. - * The return value can usually be discarded for top level tests. - * However, the return value from subtests should be used to prevent the parent - * test from finishing first and cancelling the subtest - * as shown in the following example. - * - * ```js - * test('top level test', async (t) => { - * // The setTimeout() in the following subtest would cause it to outlive its - * // parent test if 'await' is removed on the next line. Once the parent test - * // completes, it will cancel any outstanding subtests. - * await t.test('longer running subtest', async (t) => { - * return new Promise((resolve, reject) => { - * setTimeout(resolve, 1000); - * }); - * }); - * }); - * ``` - * - * The `timeout` option can be used to fail the test if it takes longer than `timeout` milliseconds to complete. However, it is not a reliable mechanism for - * canceling tests because a running test might block the application thread and - * thus prevent the scheduled cancellation. - * @since v18.0.0, v16.17.0 - * @param name The name of the test, which is displayed when reporting test results. - * Defaults to the `name` property of `fn`, or `''` if `fn` does not have a name. - * @param options Configuration options for the test. - * @param fn The function under test. The first argument to this function is a {@link TestContext} object. - * If the test uses callbacks, the callback function is passed as the second argument. - * @return Fulfilled with `undefined` once the test completes, or immediately if the test runs within a suite. - */ - function test(name?: string, fn?: TestFn): Promise; - function test(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function test(options?: TestOptions, fn?: TestFn): Promise; - function test(fn?: TestFn): Promise; - namespace test { - export { test }; - export { suite as describe, test as it }; - } - namespace test { - /** - * **Note:** `shard` is used to horizontally parallelize test running across - * machines or processes, ideal for large-scale executions across varied - * environments. It's incompatible with `watch` mode, tailored for rapid - * code iteration by automatically rerunning tests on file changes. - * - * ```js - * import { tap } from 'node:test/reporters'; - * import { run } from 'node:test'; - * import process from 'node:process'; - * import path from 'node:path'; - * - * run({ files: [path.resolve('./tests/test.js')] }) - * .compose(tap) - * .pipe(process.stdout); - * ``` - * @since v18.9.0, v16.19.0 - * @param options Configuration options for running tests. - */ - function run(options?: RunOptions): TestsStream; - /** - * The `suite()` function is imported from the `node:test` module. - * @param name The name of the suite, which is displayed when reporting test results. - * Defaults to the `name` property of `fn`, or `''` if `fn` does not have a name. - * @param options Configuration options for the suite. This supports the same options as {@link test}. - * @param fn The suite function declaring nested tests and suites. The first argument to this function is a {@link SuiteContext} object. - * @return Immediately fulfilled with `undefined`. - * @since v20.13.0 - */ - function suite(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function suite(name?: string, fn?: SuiteFn): Promise; - function suite(options?: TestOptions, fn?: SuiteFn): Promise; - function suite(fn?: SuiteFn): Promise; - namespace suite { - /** - * Shorthand for skipping a suite. This is the same as calling {@link suite} with `options.skip` set to `true`. - * @since v20.13.0 - */ - function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function skip(name?: string, fn?: SuiteFn): Promise; - function skip(options?: TestOptions, fn?: SuiteFn): Promise; - function skip(fn?: SuiteFn): Promise; - /** - * Shorthand for marking a suite as `TODO`. This is the same as calling {@link suite} with `options.todo` set to `true`. - * @since v20.13.0 - */ - function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function todo(name?: string, fn?: SuiteFn): Promise; - function todo(options?: TestOptions, fn?: SuiteFn): Promise; - function todo(fn?: SuiteFn): Promise; - /** - * Shorthand for marking a suite as `only`. This is the same as calling {@link suite} with `options.only` set to `true`. - * @since v20.13.0 - */ - function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function only(name?: string, fn?: SuiteFn): Promise; - function only(options?: TestOptions, fn?: SuiteFn): Promise; - function only(fn?: SuiteFn): Promise; - } - /** - * Shorthand for skipping a test. This is the same as calling {@link test} with `options.skip` set to `true`. - * @since v20.2.0 - */ - function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function skip(name?: string, fn?: TestFn): Promise; - function skip(options?: TestOptions, fn?: TestFn): Promise; - function skip(fn?: TestFn): Promise; - /** - * Shorthand for marking a test as `TODO`. This is the same as calling {@link test} with `options.todo` set to `true`. - * @since v20.2.0 - */ - function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function todo(name?: string, fn?: TestFn): Promise; - function todo(options?: TestOptions, fn?: TestFn): Promise; - function todo(fn?: TestFn): Promise; - /** - * Shorthand for marking a test as `only`. This is the same as calling {@link test} with `options.only` set to `true`. - * @since v20.2.0 - */ - function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function only(name?: string, fn?: TestFn): Promise; - function only(options?: TestOptions, fn?: TestFn): Promise; - function only(fn?: TestFn): Promise; - /** - * The type of a function passed to {@link test}. The first argument to this function is a {@link TestContext} object. - * If the test uses callbacks, the callback function is passed as the second argument. - */ - type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise; - /** - * The type of a suite test function. The argument to this function is a {@link SuiteContext} object. - */ - type SuiteFn = (s: SuiteContext) => void | Promise; - interface TestShard { - /** - * A positive integer between 1 and `total` that specifies the index of the shard to run. - */ - index: number; - /** - * A positive integer that specifies the total number of shards to split the test files to. - */ - total: number; - } - interface RunOptions { - /** - * If a number is provided, then that many test processes would run in parallel, where each process corresponds to one test file. - * If `true`, it would run `os.availableParallelism() - 1` test files in parallel. If `false`, it would only run one test file at a time. - * @default false - */ - concurrency?: number | boolean | undefined; - /** - * An array containing the list of files to run. If omitted, files are run according to the - * [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model). - */ - files?: readonly string[] | undefined; - /** - * Configures the test runner to exit the process once all known - * tests have finished executing even if the event loop would - * otherwise remain active. - * @default false - */ - forceExit?: boolean | undefined; - /** - * An array containing the list of glob patterns to match test files. - * This option cannot be used together with `files`. If omitted, files are run according to the - * [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model). - * @since v22.6.0 - */ - globPatterns?: readonly string[] | undefined; - /** - * Sets inspector port of test child process. - * This can be a number, or a function that takes no arguments and returns a - * number. If a nullish value is provided, each process gets its own port, - * incremented from the primary's `process.debugPort`. This option is ignored - * if the `isolation` option is set to `'none'` as no child processes are - * spawned. - * @default undefined - */ - inspectPort?: number | (() => number) | undefined; - /** - * Configures the type of test isolation. If set to - * `'process'`, each test file is run in a separate child process. If set to - * `'none'`, all test files run in the current process. - * @default 'process' - * @since v22.8.0 - */ - isolation?: "process" | "none" | undefined; - /** - * If truthy, the test context will only run tests that have the `only` option set - */ - only?: boolean | undefined; - /** - * A function that accepts the `TestsStream` instance and can be used to setup listeners before any tests are run. - * @default undefined - */ - setup?: ((reporter: TestsStream) => void | Promise) | undefined; - /** - * An array of CLI flags to pass to the `node` executable when - * spawning the subprocesses. This option has no effect when `isolation` is `'none`'. - * @since v22.10.0 - * @default [] - */ - execArgv?: readonly string[] | undefined; - /** - * An array of CLI flags to pass to each test file when spawning the - * subprocesses. This option has no effect when `isolation` is `'none'`. - * @since v22.10.0 - * @default [] - */ - argv?: readonly string[] | undefined; - /** - * Allows aborting an in-progress test execution. - */ - signal?: AbortSignal | undefined; - /** - * If provided, only run tests whose name matches the provided pattern. - * Strings are interpreted as JavaScript regular expressions. - * @default undefined - */ - testNamePatterns?: string | RegExp | ReadonlyArray | undefined; - /** - * A String, RegExp or a RegExp Array, that can be used to exclude running tests whose - * name matches the provided pattern. Test name patterns are interpreted as JavaScript - * regular expressions. For each test that is executed, any corresponding test hooks, - * such as `beforeEach()`, are also run. - * @default undefined - * @since v22.1.0 - */ - testSkipPatterns?: string | RegExp | ReadonlyArray | undefined; - /** - * The number of milliseconds after which the test execution will fail. - * If unspecified, subtests inherit this value from their parent. - * @default Infinity - */ - timeout?: number | undefined; - /** - * Whether to run in watch mode or not. - * @default false - */ - watch?: boolean | undefined; - /** - * Running tests in a specific shard. - * @default undefined - */ - shard?: TestShard | undefined; - /** - * enable [code coverage](https://nodejs.org/docs/latest-v22.x/api/test.html#collecting-code-coverage) collection. - * @since v22.10.0 - * @default false - */ - coverage?: boolean | undefined; - /** - * Excludes specific files from code coverage - * using a glob pattern, which can match both absolute and relative file paths. - * This property is only applicable when `coverage` was set to `true`. - * If both `coverageExcludeGlobs` and `coverageIncludeGlobs` are provided, - * files must meet **both** criteria to be included in the coverage report. - * @since v22.10.0 - * @default undefined - */ - coverageExcludeGlobs?: string | readonly string[] | undefined; - /** - * Includes specific files in code coverage - * using a glob pattern, which can match both absolute and relative file paths. - * This property is only applicable when `coverage` was set to `true`. - * If both `coverageExcludeGlobs` and `coverageIncludeGlobs` are provided, - * files must meet **both** criteria to be included in the coverage report. - * @since v22.10.0 - * @default undefined - */ - coverageIncludeGlobs?: string | readonly string[] | undefined; - /** - * Require a minimum percent of covered lines. If code - * coverage does not reach the threshold specified, the process will exit with code `1`. - * @since v22.10.0 - * @default 0 - */ - lineCoverage?: number | undefined; - /** - * Require a minimum percent of covered branches. If code - * coverage does not reach the threshold specified, the process will exit with code `1`. - * @since v22.10.0 - * @default 0 - */ - branchCoverage?: number | undefined; - /** - * Require a minimum percent of covered functions. If code - * coverage does not reach the threshold specified, the process will exit with code `1`. - * @since v22.10.0 - * @default 0 - */ - functionCoverage?: number | undefined; - } - /** - * A successful call to `run()` will return a new `TestsStream` object, streaming a series of events representing the execution of the tests. - * - * Some of the events are guaranteed to be emitted in the same order as the tests are defined, while others are emitted in the order that the tests execute. - * @since v18.9.0, v16.19.0 - */ - interface TestsStream extends Readable { - addListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this; - addListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this; - addListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this; - addListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this; - addListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this; - addListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this; - addListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this; - addListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this; - addListener(event: "test:start", listener: (data: EventData.TestStart) => void): this; - addListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this; - addListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this; - addListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this; - addListener(event: "test:watch:drained", listener: () => void): this; - addListener(event: string, listener: (...args: any[]) => void): this; - emit(event: "test:coverage", data: EventData.TestCoverage): boolean; - emit(event: "test:complete", data: EventData.TestComplete): boolean; - emit(event: "test:dequeue", data: EventData.TestDequeue): boolean; - emit(event: "test:diagnostic", data: EventData.TestDiagnostic): boolean; - emit(event: "test:enqueue", data: EventData.TestEnqueue): boolean; - emit(event: "test:fail", data: EventData.TestFail): boolean; - emit(event: "test:pass", data: EventData.TestPass): boolean; - emit(event: "test:plan", data: EventData.TestPlan): boolean; - emit(event: "test:start", data: EventData.TestStart): boolean; - emit(event: "test:stderr", data: EventData.TestStderr): boolean; - emit(event: "test:stdout", data: EventData.TestStdout): boolean; - emit(event: "test:summary", data: EventData.TestSummary): boolean; - emit(event: "test:watch:drained"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this; - on(event: "test:complete", listener: (data: EventData.TestComplete) => void): this; - on(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this; - on(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this; - on(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this; - on(event: "test:fail", listener: (data: EventData.TestFail) => void): this; - on(event: "test:pass", listener: (data: EventData.TestPass) => void): this; - on(event: "test:plan", listener: (data: EventData.TestPlan) => void): this; - on(event: "test:start", listener: (data: EventData.TestStart) => void): this; - on(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this; - on(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this; - on(event: "test:summary", listener: (data: EventData.TestSummary) => void): this; - on(event: "test:watch:drained", listener: () => void): this; - on(event: string, listener: (...args: any[]) => void): this; - once(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this; - once(event: "test:complete", listener: (data: EventData.TestComplete) => void): this; - once(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this; - once(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this; - once(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this; - once(event: "test:fail", listener: (data: EventData.TestFail) => void): this; - once(event: "test:pass", listener: (data: EventData.TestPass) => void): this; - once(event: "test:plan", listener: (data: EventData.TestPlan) => void): this; - once(event: "test:start", listener: (data: EventData.TestStart) => void): this; - once(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this; - once(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this; - once(event: "test:summary", listener: (data: EventData.TestSummary) => void): this; - once(event: "test:watch:drained", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this; - prependListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this; - prependListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this; - prependListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this; - prependListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this; - prependListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this; - prependListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this; - prependListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this; - prependListener(event: "test:start", listener: (data: EventData.TestStart) => void): this; - prependListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this; - prependListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this; - prependListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this; - prependListener(event: "test:watch:drained", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this; - prependOnceListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this; - prependOnceListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this; - prependOnceListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this; - prependOnceListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this; - prependOnceListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this; - prependOnceListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this; - prependOnceListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this; - prependOnceListener(event: "test:start", listener: (data: EventData.TestStart) => void): this; - prependOnceListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this; - prependOnceListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this; - prependOnceListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this; - prependOnceListener(event: "test:watch:drained", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - } - namespace EventData { - interface Error extends globalThis.Error { - cause: globalThis.Error; - } - interface LocationInfo { - /** - * The column number where the test is defined, or - * `undefined` if the test was run through the REPL. - */ - column?: number; - /** - * The path of the test file, `undefined` if test was run through the REPL. - */ - file?: string; - /** - * The line number where the test is defined, or `undefined` if the test was run through the REPL. - */ - line?: number; - } - interface TestDiagnostic extends LocationInfo { - /** - * The diagnostic message. - */ - message: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The severity level of the diagnostic message. - * Possible values are: - * * `'info'`: Informational messages. - * * `'warn'`: Warnings. - * * `'error'`: Errors. - */ - level: "info" | "warn" | "error"; - } - interface TestCoverage { - /** - * An object containing the coverage report. - */ - summary: { - /** - * An array of coverage reports for individual files. - */ - files: Array<{ - /** - * The absolute path of the file. - */ - path: string; - /** - * The total number of lines. - */ - totalLineCount: number; - /** - * The total number of branches. - */ - totalBranchCount: number; - /** - * The total number of functions. - */ - totalFunctionCount: number; - /** - * The number of covered lines. - */ - coveredLineCount: number; - /** - * The number of covered branches. - */ - coveredBranchCount: number; - /** - * The number of covered functions. - */ - coveredFunctionCount: number; - /** - * The percentage of lines covered. - */ - coveredLinePercent: number; - /** - * The percentage of branches covered. - */ - coveredBranchPercent: number; - /** - * The percentage of functions covered. - */ - coveredFunctionPercent: number; - /** - * An array of functions representing function coverage. - */ - functions: Array<{ - /** - * The name of the function. - */ - name: string; - /** - * The line number where the function is defined. - */ - line: number; - /** - * The number of times the function was called. - */ - count: number; - }>; - /** - * An array of branches representing branch coverage. - */ - branches: Array<{ - /** - * The line number where the branch is defined. - */ - line: number; - /** - * The number of times the branch was taken. - */ - count: number; - }>; - /** - * An array of lines representing line numbers and the number of times they were covered. - */ - lines: Array<{ - /** - * The line number. - */ - line: number; - /** - * The number of times the line was covered. - */ - count: number; - }>; - }>; - /** - * An object containing whether or not the coverage for - * each coverage type. - * @since v22.9.0 - */ - thresholds: { - /** - * The function coverage threshold. - */ - function: number; - /** - * The branch coverage threshold. - */ - branch: number; - /** - * The line coverage threshold. - */ - line: number; - }; - /** - * An object containing a summary of coverage for all files. - */ - totals: { - /** - * The total number of lines. - */ - totalLineCount: number; - /** - * The total number of branches. - */ - totalBranchCount: number; - /** - * The total number of functions. - */ - totalFunctionCount: number; - /** - * The number of covered lines. - */ - coveredLineCount: number; - /** - * The number of covered branches. - */ - coveredBranchCount: number; - /** - * The number of covered functions. - */ - coveredFunctionCount: number; - /** - * The percentage of lines covered. - */ - coveredLinePercent: number; - /** - * The percentage of branches covered. - */ - coveredBranchPercent: number; - /** - * The percentage of functions covered. - */ - coveredFunctionPercent: number; - }; - /** - * The working directory when code coverage began. This - * is useful for displaying relative path names in case - * the tests changed the working directory of the Node.js process. - */ - workingDirectory: string; - }; - /** - * The nesting level of the test. - */ - nesting: number; - } - interface TestComplete extends LocationInfo { - /** - * Additional execution metadata. - */ - details: { - /** - * Whether the test passed or not. - */ - passed: boolean; - /** - * The duration of the test in milliseconds. - */ - duration_ms: number; - /** - * An error wrapping the error thrown by the test if it did not pass. - */ - error?: Error; - /** - * The type of the test, used to denote whether this is a suite. - */ - type?: "suite"; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; - } - interface TestDequeue extends LocationInfo { - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The test type. Either `'suite'` or `'test'`. - * @since v22.15.0 - */ - type: "suite" | "test"; - } - interface TestEnqueue extends LocationInfo { - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The test type. Either `'suite'` or `'test'`. - * @since v22.15.0 - */ - type: "suite" | "test"; - } - interface TestFail extends LocationInfo { - /** - * Additional execution metadata. - */ - details: { - /** - * The duration of the test in milliseconds. - */ - duration_ms: number; - /** - * An error wrapping the error thrown by the test. - */ - error: Error; - /** - * The type of the test, used to denote whether this is a suite. - * @since v20.0.0, v19.9.0, v18.17.0 - */ - type?: "suite"; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; - } - interface TestPass extends LocationInfo { - /** - * Additional execution metadata. - */ - details: { - /** - * The duration of the test in milliseconds. - */ - duration_ms: number; - /** - * The type of the test, used to denote whether this is a suite. - * @since 20.0.0, 19.9.0, 18.17.0 - */ - type?: "suite"; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; - } - interface TestPlan extends LocationInfo { - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The number of subtests that have ran. - */ - count: number; - } - interface TestStart extends LocationInfo { - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - } - interface TestStderr { - /** - * The path of the test file. - */ - file: string; - /** - * The message written to `stderr`. - */ - message: string; - } - interface TestStdout { - /** - * The path of the test file. - */ - file: string; - /** - * The message written to `stdout`. - */ - message: string; - } - interface TestSummary { - /** - * An object containing the counts of various test results. - */ - counts: { - /** - * The total number of cancelled tests. - */ - cancelled: number; - /** - * The total number of passed tests. - */ - passed: number; - /** - * The total number of skipped tests. - */ - skipped: number; - /** - * The total number of suites run. - */ - suites: number; - /** - * The total number of tests run, excluding suites. - */ - tests: number; - /** - * The total number of TODO tests. - */ - todo: number; - /** - * The total number of top level tests and suites. - */ - topLevel: number; - }; - /** - * The duration of the test run in milliseconds. - */ - duration_ms: number; - /** - * The path of the test file that generated the - * summary. If the summary corresponds to multiple files, this value is - * `undefined`. - */ - file: string | undefined; - /** - * Indicates whether or not the test run is considered - * successful or not. If any error condition occurs, such as a failing test or - * unmet coverage threshold, this value will be set to `false`. - */ - success: boolean; - } - } - /** - * An instance of `TestContext` is passed to each test function in order to - * interact with the test runner. However, the `TestContext` constructor is not - * exposed as part of the API. - * @since v18.0.0, v16.17.0 - */ - interface TestContext { - /** - * An object containing assertion methods bound to the test context. - * The top-level functions from the `node:assert` module are exposed here for the purpose of creating test plans. - * - * **Note:** Some of the functions from `node:assert` contain type assertions. If these are called via the - * TestContext `assert` object, then the context parameter in the test's function signature **must be explicitly typed** - * (ie. the parameter must have a type annotation), otherwise an error will be raised by the TypeScript compiler: - * ```ts - * import { test, type TestContext } from 'node:test'; - * - * // The test function's context parameter must have a type annotation. - * test('example', (t: TestContext) => { - * t.assert.deepStrictEqual(actual, expected); - * }); - * - * // Omitting the type annotation will result in a compilation error. - * test('example', t => { - * t.assert.deepStrictEqual(actual, expected); // Error: 't' needs an explicit type annotation. - * }); - * ``` - * @since v22.2.0, v20.15.0 - */ - readonly assert: TestContextAssert; - /** - * This function is used to create a hook running before subtest of the current test. - * @param fn The hook function. The first argument to this function is a `TestContext` object. - * If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. - * @since v20.1.0, v18.17.0 - */ - before(fn?: TestContextHookFn, options?: HookOptions): void; - /** - * This function is used to create a hook running before each subtest of the current test. - * @param fn The hook function. The first argument to this function is a `TestContext` object. - * If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. - * @since v18.8.0 - */ - beforeEach(fn?: TestContextHookFn, options?: HookOptions): void; - /** - * This function is used to create a hook that runs after the current test finishes. - * @param fn The hook function. The first argument to this function is a `TestContext` object. - * If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. - * @since v18.13.0 - */ - after(fn?: TestContextHookFn, options?: HookOptions): void; - /** - * This function is used to create a hook running after each subtest of the current test. - * @param fn The hook function. The first argument to this function is a `TestContext` object. - * If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. - * @since v18.8.0 - */ - afterEach(fn?: TestContextHookFn, options?: HookOptions): void; - /** - * This function is used to write diagnostics to the output. Any diagnostic - * information is included at the end of the test's results. This function does - * not return a value. - * - * ```js - * test('top level test', (t) => { - * t.diagnostic('A diagnostic message'); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param message Message to be reported. - */ - diagnostic(message: string): void; - /** - * The absolute path of the test file that created the current test. If a test file imports - * additional modules that generate tests, the imported tests will return the path of the root test file. - * @since v22.6.0 - */ - readonly filePath: string | undefined; - /** - * The name of the test and each of its ancestors, separated by `>`. - * @since v22.3.0 - */ - readonly fullName: string; - /** - * The name of the test. - * @since v18.8.0, v16.18.0 - */ - readonly name: string; - /** - * This function is used to set the number of assertions and subtests that are expected to run - * within the test. If the number of assertions and subtests that run does not match the - * expected count, the test will fail. - * - * > Note: To make sure assertions are tracked, `t.assert` must be used instead of `assert` directly. - * - * ```js - * test('top level test', (t) => { - * t.plan(2); - * t.assert.ok('some relevant assertion here'); - * t.test('subtest', () => {}); - * }); - * ``` - * - * When working with asynchronous code, the `plan` function can be used to ensure that the - * correct number of assertions are run: - * - * ```js - * test('planning with streams', (t, done) => { - * function* generate() { - * yield 'a'; - * yield 'b'; - * yield 'c'; - * } - * const expected = ['a', 'b', 'c']; - * t.plan(expected.length); - * const stream = Readable.from(generate()); - * stream.on('data', (chunk) => { - * t.assert.strictEqual(chunk, expected.shift()); - * }); - * - * stream.on('end', () => { - * done(); - * }); - * }); - * ``` - * - * When using the `wait` option, you can control how long the test will wait for the expected assertions. - * For example, setting a maximum wait time ensures that the test will wait for asynchronous assertions - * to complete within the specified timeframe: - * - * ```js - * test('plan with wait: 2000 waits for async assertions', (t) => { - * t.plan(1, { wait: 2000 }); // Waits for up to 2 seconds for the assertion to complete. - * - * const asyncActivity = () => { - * setTimeout(() => { - * * t.assert.ok(true, 'Async assertion completed within the wait time'); - * }, 1000); // Completes after 1 second, within the 2-second wait time. - * }; - * - * asyncActivity(); // The test will pass because the assertion is completed in time. - * }); - * ``` - * - * Note: If a `wait` timeout is specified, it begins counting down only after the test function finishes executing. - * @since v22.2.0 - */ - plan(count: number, options?: TestContextPlanOptions): void; - /** - * If `shouldRunOnlyTests` is truthy, the test context will only run tests that - * have the `only` option set. Otherwise, all tests are run. If Node.js was not - * started with the `--test-only` command-line option, this function is a - * no-op. - * - * ```js - * test('top level test', (t) => { - * // The test context can be set to run subtests with the 'only' option. - * t.runOnly(true); - * return Promise.all([ - * t.test('this subtest is now skipped'), - * t.test('this subtest is run', { only: true }), - * ]); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param shouldRunOnlyTests Whether or not to run `only` tests. - */ - runOnly(shouldRunOnlyTests: boolean): void; - /** - * ```js - * test('top level test', async (t) => { - * await fetch('some/uri', { signal: t.signal }); - * }); - * ``` - * @since v18.7.0, v16.17.0 - */ - readonly signal: AbortSignal; - /** - * This function causes the test's output to indicate the test as skipped. If `message` is provided, it is included in the output. Calling `skip()` does - * not terminate execution of the test function. This function does not return a - * value. - * - * ```js - * test('top level test', (t) => { - * // Make sure to return here as well if the test contains additional logic. - * t.skip('this is skipped'); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param message Optional skip message. - */ - skip(message?: string): void; - /** - * This function adds a `TODO` directive to the test's output. If `message` is - * provided, it is included in the output. Calling `todo()` does not terminate - * execution of the test function. This function does not return a value. - * - * ```js - * test('top level test', (t) => { - * // This test is marked as `TODO` - * t.todo('this is a todo'); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param message Optional `TODO` message. - */ - todo(message?: string): void; - /** - * This function is used to create subtests under the current test. This function behaves in - * the same fashion as the top level {@link test} function. - * @since v18.0.0 - * @param name The name of the test, which is displayed when reporting test results. - * Defaults to the `name` property of `fn`, or `''` if `fn` does not have a name. - * @param options Configuration options for the test. - * @param fn The function under test. This first argument to this function is a {@link TestContext} object. - * If the test uses callbacks, the callback function is passed as the second argument. - * @returns A {@link Promise} resolved with `undefined` once the test completes. - */ - test: typeof test; - /** - * This method polls a `condition` function until that function either returns - * successfully or the operation times out. - * @since v22.14.0 - * @param condition An assertion function that is invoked - * periodically until it completes successfully or the defined polling timeout - * elapses. Successful completion is defined as not throwing or rejecting. This - * function does not accept any arguments, and is allowed to return any value. - * @param options An optional configuration object for the polling operation. - * @returns Fulfilled with the value returned by `condition`. - */ - waitFor(condition: () => T, options?: TestContextWaitForOptions): Promise>; - /** - * Each test provides its own MockTracker instance. - */ - readonly mock: MockTracker; - } - interface TestContextAssert extends Pick { - /** - * This function serializes `value` and writes it to the file specified by `path`. - * - * ```js - * test('snapshot test with default serialization', (t) => { - * t.assert.fileSnapshot({ value1: 1, value2: 2 }, './snapshots/snapshot.json'); - * }); - * ``` - * - * This function differs from `context.assert.snapshot()` in the following ways: - * - * * The snapshot file path is explicitly provided by the user. - * * Each snapshot file is limited to a single snapshot value. - * * No additional escaping is performed by the test runner. - * - * These differences allow snapshot files to better support features such as syntax - * highlighting. - * @since v22.14.0 - * @param value A value to serialize to a string. If Node.js was started with - * the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--test-update-snapshots) - * flag, the serialized value is written to - * `path`. Otherwise, the serialized value is compared to the contents of the - * existing snapshot file. - * @param path The file where the serialized `value` is written. - * @param options Optional configuration options. - */ - fileSnapshot(value: any, path: string, options?: AssertSnapshotOptions): void; - /** - * This function implements assertions for snapshot testing. - * ```js - * test('snapshot test with default serialization', (t) => { - * t.assert.snapshot({ value1: 1, value2: 2 }); - * }); - * - * test('snapshot test with custom serialization', (t) => { - * t.assert.snapshot({ value3: 3, value4: 4 }, { - * serializers: [(value) => JSON.stringify(value)] - * }); - * }); - * ``` - * @since v22.3.0 - * @param value A value to serialize to a string. If Node.js was started with - * the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--test-update-snapshots) - * flag, the serialized value is written to - * the snapshot file. Otherwise, the serialized value is compared to the - * corresponding value in the existing snapshot file. - */ - snapshot(value: any, options?: AssertSnapshotOptions): void; - /** - * A custom assertion function registered with `assert.register()`. - */ - [name: string]: (...args: any[]) => void; - } - interface AssertSnapshotOptions { - /** - * An array of synchronous functions used to serialize `value` into a string. - * `value` is passed as the only argument to the first serializer function. - * The return value of each serializer is passed as input to the next serializer. - * Once all serializers have run, the resulting value is coerced to a string. - * - * If no serializers are provided, the test runner's default serializers are used. - */ - serializers?: ReadonlyArray<(value: any) => any> | undefined; - } - interface TestContextPlanOptions { - /** - * The wait time for the plan: - * * If `true`, the plan waits indefinitely for all assertions and subtests to run. - * * If `false`, the plan performs an immediate check after the test function completes, - * without waiting for any pending assertions or subtests. - * Any assertions or subtests that complete after this check will not be counted towards the plan. - * * If a number, it specifies the maximum wait time in milliseconds - * before timing out while waiting for expected assertions and subtests to be matched. - * If the timeout is reached, the test will fail. - * @default false - */ - wait?: boolean | number | undefined; - } - interface TestContextWaitForOptions { - /** - * The number of milliseconds to wait after an unsuccessful - * invocation of `condition` before trying again. - * @default 50 - */ - interval?: number | undefined; - /** - * The poll timeout in milliseconds. If `condition` has not - * succeeded by the time this elapses, an error occurs. - * @default 1000 - */ - timeout?: number | undefined; - } - /** - * An instance of `SuiteContext` is passed to each suite function in order to - * interact with the test runner. However, the `SuiteContext` constructor is not - * exposed as part of the API. - * @since v18.7.0, v16.17.0 - */ - interface SuiteContext { - /** - * The absolute path of the test file that created the current suite. If a test file imports - * additional modules that generate suites, the imported suites will return the path of the root test file. - * @since v22.6.0 - */ - readonly filePath: string | undefined; - /** - * The name of the suite. - * @since v18.8.0, v16.18.0 - */ - readonly name: string; - /** - * Can be used to abort test subtasks when the test has been aborted. - * @since v18.7.0, v16.17.0 - */ - readonly signal: AbortSignal; - } - interface TestOptions { - /** - * If a number is provided, then that many tests would run in parallel. - * If truthy, it would run (number of cpu cores - 1) tests in parallel. - * For subtests, it will be `Infinity` tests in parallel. - * If falsy, it would only run one test at a time. - * If unspecified, subtests inherit this value from their parent. - * @default false - */ - concurrency?: number | boolean | undefined; - /** - * If truthy, and the test context is configured to run `only` tests, then this test will be - * run. Otherwise, the test is skipped. - * @default false - */ - only?: boolean | undefined; - /** - * Allows aborting an in-progress test. - * @since v18.8.0 - */ - signal?: AbortSignal | undefined; - /** - * If truthy, the test is skipped. If a string is provided, that string is displayed in the - * test results as the reason for skipping the test. - * @default false - */ - skip?: boolean | string | undefined; - /** - * A number of milliseconds the test will fail after. If unspecified, subtests inherit this - * value from their parent. - * @default Infinity - * @since v18.7.0 - */ - timeout?: number | undefined; - /** - * If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in - * the test results as the reason why the test is `TODO`. - * @default false - */ - todo?: boolean | string | undefined; - /** - * The number of assertions and subtests expected to be run in the test. - * If the number of assertions run in the test does not match the number - * specified in the plan, the test will fail. - * @default undefined - * @since v22.2.0 - */ - plan?: number | undefined; - } - /** - * This function creates a hook that runs before executing a suite. - * - * ```js - * describe('tests', async () => { - * before(() => console.log('about to run some test')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. - */ - function before(fn?: HookFn, options?: HookOptions): void; - /** - * This function creates a hook that runs after executing a suite. - * - * ```js - * describe('tests', async () => { - * after(() => console.log('finished running tests')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. - */ - function after(fn?: HookFn, options?: HookOptions): void; - /** - * This function creates a hook that runs before each test in the current suite. - * - * ```js - * describe('tests', async () => { - * beforeEach(() => console.log('about to run a test')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. - */ - function beforeEach(fn?: HookFn, options?: HookOptions): void; - /** - * This function creates a hook that runs after each test in the current suite. - * The `afterEach()` hook is run even if the test fails. - * - * ```js - * describe('tests', async () => { - * afterEach(() => console.log('finished running a test')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. - */ - function afterEach(fn?: HookFn, options?: HookOptions): void; - /** - * The hook function. The first argument is the context in which the hook is called. - * If the hook uses callbacks, the callback function is passed as the second argument. - */ - type HookFn = (c: TestContext | SuiteContext, done: (result?: any) => void) => any; - /** - * The hook function. The first argument is a `TestContext` object. - * If the hook uses callbacks, the callback function is passed as the second argument. - */ - type TestContextHookFn = (t: TestContext, done: (result?: any) => void) => any; - /** - * Configuration options for hooks. - * @since v18.8.0 - */ - interface HookOptions { - /** - * Allows aborting an in-progress hook. - */ - signal?: AbortSignal | undefined; - /** - * A number of milliseconds the hook will fail after. If unspecified, subtests inherit this - * value from their parent. - * @default Infinity - */ - timeout?: number | undefined; - } - interface MockFunctionOptions { - /** - * The number of times that the mock will use the behavior of `implementation`. - * Once the mock function has been called `times` times, - * it will automatically restore the behavior of `original`. - * This value must be an integer greater than zero. - * @default Infinity - */ - times?: number | undefined; - } - interface MockMethodOptions extends MockFunctionOptions { - /** - * If `true`, `object[methodName]` is treated as a getter. - * This option cannot be used with the `setter` option. - */ - getter?: boolean | undefined; - /** - * If `true`, `object[methodName]` is treated as a setter. - * This option cannot be used with the `getter` option. - */ - setter?: boolean | undefined; - } - type Mock = F & { - mock: MockFunctionContext; - }; - interface MockModuleOptions { - /** - * If false, each call to `require()` or `import()` generates a new mock module. - * If true, subsequent calls will return the same module mock, and the mock module is inserted into the CommonJS cache. - * @default false - */ - cache?: boolean | undefined; - /** - * The value to use as the mocked module's default export. - * - * If this value is not provided, ESM mocks do not include a default export. - * If the mock is a CommonJS or builtin module, this setting is used as the value of `module.exports`. - * If this value is not provided, CJS and builtin mocks use an empty object as the value of `module.exports`. - */ - defaultExport?: any; - /** - * An object whose keys and values are used to create the named exports of the mock module. - * - * If the mock is a CommonJS or builtin module, these values are copied onto `module.exports`. - * Therefore, if a mock is created with both named exports and a non-object default export, - * the mock will throw an exception when used as a CJS or builtin module. - */ - namedExports?: object | undefined; - } - /** - * The `MockTracker` class is used to manage mocking functionality. The test runner - * module provides a top level `mock` export which is a `MockTracker` instance. - * Each test also provides its own `MockTracker` instance via the test context's `mock` property. - * @since v19.1.0, v18.13.0 - */ - interface MockTracker { - /** - * This function is used to create a mock function. - * - * The following example creates a mock function that increments a counter by one - * on each invocation. The `times` option is used to modify the mock behavior such - * that the first two invocations add two to the counter instead of one. - * - * ```js - * test('mocks a counting function', (t) => { - * let cnt = 0; - * - * function addOne() { - * cnt++; - * return cnt; - * } - * - * function addTwo() { - * cnt += 2; - * return cnt; - * } - * - * const fn = t.mock.fn(addOne, addTwo, { times: 2 }); - * - * assert.strictEqual(fn(), 2); - * assert.strictEqual(fn(), 4); - * assert.strictEqual(fn(), 5); - * assert.strictEqual(fn(), 6); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param original An optional function to create a mock on. - * @param implementation An optional function used as the mock implementation for `original`. This is useful for creating mocks that exhibit one behavior for a specified number of calls and - * then restore the behavior of `original`. - * @param options Optional configuration options for the mock function. - * @return The mocked function. The mocked function contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the - * behavior of the mocked function. - */ - fn undefined>( - original?: F, - options?: MockFunctionOptions, - ): Mock; - fn undefined, Implementation extends Function = F>( - original?: F, - implementation?: Implementation, - options?: MockFunctionOptions, - ): Mock; - /** - * This function is used to create a mock on an existing object method. The - * following example demonstrates how a mock is created on an existing object - * method. - * - * ```js - * test('spies on an object method', (t) => { - * const number = { - * value: 5, - * subtract(a) { - * return this.value - a; - * }, - * }; - * - * t.mock.method(number, 'subtract'); - * assert.strictEqual(number.subtract.mock.calls.length, 0); - * assert.strictEqual(number.subtract(3), 2); - * assert.strictEqual(number.subtract.mock.calls.length, 1); - * - * const call = number.subtract.mock.calls[0]; - * - * assert.deepStrictEqual(call.arguments, [3]); - * assert.strictEqual(call.result, 2); - * assert.strictEqual(call.error, undefined); - * assert.strictEqual(call.target, undefined); - * assert.strictEqual(call.this, number); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param object The object whose method is being mocked. - * @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown. - * @param implementation An optional function used as the mock implementation for `object[methodName]`. - * @param options Optional configuration options for the mock method. - * @return The mocked method. The mocked method contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the - * behavior of the mocked method. - */ - method< - MockedObject extends object, - MethodName extends FunctionPropertyNames, - >( - object: MockedObject, - methodName: MethodName, - options?: MockFunctionOptions, - ): MockedObject[MethodName] extends Function ? Mock - : never; - method< - MockedObject extends object, - MethodName extends FunctionPropertyNames, - Implementation extends Function, - >( - object: MockedObject, - methodName: MethodName, - implementation: Implementation, - options?: MockFunctionOptions, - ): MockedObject[MethodName] extends Function ? Mock - : never; - method( - object: MockedObject, - methodName: keyof MockedObject, - options: MockMethodOptions, - ): Mock; - method( - object: MockedObject, - methodName: keyof MockedObject, - implementation: Function, - options: MockMethodOptions, - ): Mock; - /** - * This function is syntax sugar for `MockTracker.method` with `options.getter` set to `true`. - * @since v19.3.0, v18.13.0 - */ - getter< - MockedObject extends object, - MethodName extends keyof MockedObject, - >( - object: MockedObject, - methodName: MethodName, - options?: MockFunctionOptions, - ): Mock<() => MockedObject[MethodName]>; - getter< - MockedObject extends object, - MethodName extends keyof MockedObject, - Implementation extends Function, - >( - object: MockedObject, - methodName: MethodName, - implementation?: Implementation, - options?: MockFunctionOptions, - ): Mock<(() => MockedObject[MethodName]) | Implementation>; - /** - * This function is syntax sugar for `MockTracker.method` with `options.setter` set to `true`. - * @since v19.3.0, v18.13.0 - */ - setter< - MockedObject extends object, - MethodName extends keyof MockedObject, - >( - object: MockedObject, - methodName: MethodName, - options?: MockFunctionOptions, - ): Mock<(value: MockedObject[MethodName]) => void>; - setter< - MockedObject extends object, - MethodName extends keyof MockedObject, - Implementation extends Function, - >( - object: MockedObject, - methodName: MethodName, - implementation?: Implementation, - options?: MockFunctionOptions, - ): Mock<((value: MockedObject[MethodName]) => void) | Implementation>; - /** - * This function is used to mock the exports of ECMAScript modules, CommonJS modules, and Node.js builtin modules. - * Any references to the original module prior to mocking are not impacted. - * - * Only available through the [--experimental-test-module-mocks](https://nodejs.org/api/cli.html#--experimental-test-module-mocks) flag. - * @since v22.3.0 - * @experimental - * @param specifier A string identifying the module to mock. - * @param options Optional configuration options for the mock module. - */ - module(specifier: string | URL, options?: MockModuleOptions): MockModuleContext; - /** - * This function restores the default behavior of all mocks that were previously - * created by this `MockTracker` and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used, but the `MockTracker` instance can no longer be - * used to reset their behavior or - * otherwise interact with them. - * - * After each test completes, this function is called on the test context's `MockTracker`. If the global `MockTracker` is used extensively, calling this - * function manually is recommended. - * @since v19.1.0, v18.13.0 - */ - reset(): void; - /** - * This function restores the default behavior of all mocks that were previously - * created by this `MockTracker`. Unlike `mock.reset()`, `mock.restoreAll()` does - * not disassociate the mocks from the `MockTracker` instance. - * @since v19.1.0, v18.13.0 - */ - restoreAll(): void; - readonly timers: MockTimers; - } - const mock: MockTracker; - interface MockFunctionCall< - F extends Function, - ReturnType = F extends (...args: any) => infer T ? T - : F extends abstract new(...args: any) => infer T ? T - : unknown, - Args = F extends (...args: infer Y) => any ? Y - : F extends abstract new(...args: infer Y) => any ? Y - : unknown[], - > { - /** - * An array of the arguments passed to the mock function. - */ - arguments: Args; - /** - * If the mocked function threw then this property contains the thrown value. - */ - error: unknown | undefined; - /** - * The value returned by the mocked function. - * - * If the mocked function threw, it will be `undefined`. - */ - result: ReturnType | undefined; - /** - * An `Error` object whose stack can be used to determine the callsite of the mocked function invocation. - */ - stack: Error; - /** - * If the mocked function is a constructor, this field contains the class being constructed. - * Otherwise this will be `undefined`. - */ - target: F extends abstract new(...args: any) => any ? F : undefined; - /** - * The mocked function's `this` value. - */ - this: unknown; - } - /** - * The `MockFunctionContext` class is used to inspect or manipulate the behavior of - * mocks created via the `MockTracker` APIs. - * @since v19.1.0, v18.13.0 - */ - interface MockFunctionContext { - /** - * A getter that returns a copy of the internal array used to track calls to the - * mock. Each entry in the array is an object with the following properties. - * @since v19.1.0, v18.13.0 - */ - readonly calls: MockFunctionCall[]; - /** - * This function returns the number of times that this mock has been invoked. This - * function is more efficient than checking `ctx.calls.length` because `ctx.calls` is a getter that creates a copy of the internal call tracking array. - * @since v19.1.0, v18.13.0 - * @return The number of times that this mock has been invoked. - */ - callCount(): number; - /** - * This function is used to change the behavior of an existing mock. - * - * The following example creates a mock function using `t.mock.fn()`, calls the - * mock function, and then changes the mock implementation to a different function. - * - * ```js - * test('changes a mock behavior', (t) => { - * let cnt = 0; - * - * function addOne() { - * cnt++; - * return cnt; - * } - * - * function addTwo() { - * cnt += 2; - * return cnt; - * } - * - * const fn = t.mock.fn(addOne); - * - * assert.strictEqual(fn(), 1); - * fn.mock.mockImplementation(addTwo); - * assert.strictEqual(fn(), 3); - * assert.strictEqual(fn(), 5); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param implementation The function to be used as the mock's new implementation. - */ - mockImplementation(implementation: F): void; - /** - * This function is used to change the behavior of an existing mock for a single - * invocation. Once invocation `onCall` has occurred, the mock will revert to - * whatever behavior it would have used had `mockImplementationOnce()` not been - * called. - * - * The following example creates a mock function using `t.mock.fn()`, calls the - * mock function, changes the mock implementation to a different function for the - * next invocation, and then resumes its previous behavior. - * - * ```js - * test('changes a mock behavior once', (t) => { - * let cnt = 0; - * - * function addOne() { - * cnt++; - * return cnt; - * } - * - * function addTwo() { - * cnt += 2; - * return cnt; - * } - * - * const fn = t.mock.fn(addOne); - * - * assert.strictEqual(fn(), 1); - * fn.mock.mockImplementationOnce(addTwo); - * assert.strictEqual(fn(), 3); - * assert.strictEqual(fn(), 4); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param implementation The function to be used as the mock's implementation for the invocation number specified by `onCall`. - * @param onCall The invocation number that will use `implementation`. If the specified invocation has already occurred then an exception is thrown. - */ - mockImplementationOnce(implementation: F, onCall?: number): void; - /** - * Resets the call history of the mock function. - * @since v19.3.0, v18.13.0 - */ - resetCalls(): void; - /** - * Resets the implementation of the mock function to its original behavior. The - * mock can still be used after calling this function. - * @since v19.1.0, v18.13.0 - */ - restore(): void; - } - /** - * @since v22.3.0 - * @experimental - */ - interface MockModuleContext { - /** - * Resets the implementation of the mock module. - * @since v22.3.0 - */ - restore(): void; - } - interface MockTimersOptions { - apis: ReadonlyArray<"setInterval" | "setTimeout" | "setImmediate" | "Date">; - now?: number | Date | undefined; - } - /** - * Mocking timers is a technique commonly used in software testing to simulate and - * control the behavior of timers, such as `setInterval` and `setTimeout`, - * without actually waiting for the specified time intervals. - * - * The MockTimers API also allows for mocking of the `Date` constructor and - * `setImmediate`/`clearImmediate` functions. - * - * The `MockTracker` provides a top-level `timers` export - * which is a `MockTimers` instance. - * @since v20.4.0 - * @experimental - */ - interface MockTimers { - /** - * Enables timer mocking for the specified timers. - * - * **Note:** When you enable mocking for a specific timer, its associated - * clear function will also be implicitly mocked. - * - * **Note:** Mocking `Date` will affect the behavior of the mocked timers - * as they use the same internal clock. - * - * Example usage without setting initial time: - * - * ```js - * import { mock } from 'node:test'; - * mock.timers.enable({ apis: ['setInterval', 'Date'], now: 1234 }); - * ``` - * - * The above example enables mocking for the `Date` constructor, `setInterval` timer and - * implicitly mocks the `clearInterval` function. Only the `Date` constructor from `globalThis`, - * `setInterval` and `clearInterval` functions from `node:timers`, `node:timers/promises`, and `globalThis` will be mocked. - * - * Example usage with initial time set - * - * ```js - * import { mock } from 'node:test'; - * mock.timers.enable({ apis: ['Date'], now: 1000 }); - * ``` - * - * Example usage with initial Date object as time set - * - * ```js - * import { mock } from 'node:test'; - * mock.timers.enable({ apis: ['Date'], now: new Date() }); - * ``` - * - * Alternatively, if you call `mock.timers.enable()` without any parameters: - * - * All timers (`'setInterval'`, `'clearInterval'`, `'Date'`, `'setImmediate'`, `'clearImmediate'`, `'setTimeout'`, and `'clearTimeout'`) - * will be mocked. - * - * The `setInterval`, `clearInterval`, `setTimeout`, and `clearTimeout` functions from `node:timers`, `node:timers/promises`, - * and `globalThis` will be mocked. - * The `Date` constructor from `globalThis` will be mocked. - * - * If there is no initial epoch set, the initial date will be based on 0 in the Unix epoch. This is `January 1st, 1970, 00:00:00 UTC`. You can - * set an initial date by passing a now property to the `.enable()` method. This value will be used as the initial date for the mocked Date - * object. It can either be a positive integer, or another Date object. - * @since v20.4.0 - */ - enable(options?: MockTimersOptions): void; - /** - * You can use the `.setTime()` method to manually move the mocked date to another time. This method only accepts a positive integer. - * Note: This method will execute any mocked timers that are in the past from the new time. - * In the below example we are setting a new time for the mocked date. - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * test('sets the time of a date object', (context) => { - * // Optionally choose what to mock - * context.mock.timers.enable({ apis: ['Date'], now: 100 }); - * assert.strictEqual(Date.now(), 100); - * // Advance in time will also advance the date - * context.mock.timers.setTime(1000); - * context.mock.timers.tick(200); - * assert.strictEqual(Date.now(), 1200); - * }); - * ``` - */ - setTime(time: number): void; - /** - * This function restores the default behavior of all mocks that were previously - * created by this `MockTimers` instance and disassociates the mocks - * from the `MockTracker` instance. - * - * **Note:** After each test completes, this function is called on - * the test context's `MockTracker`. - * - * ```js - * import { mock } from 'node:test'; - * mock.timers.reset(); - * ``` - * @since v20.4.0 - */ - reset(): void; - /** - * Advances time for all mocked timers. - * - * **Note:** This diverges from how `setTimeout` in Node.js behaves and accepts - * only positive numbers. In Node.js, `setTimeout` with negative numbers is - * only supported for web compatibility reasons. - * - * The following example mocks a `setTimeout` function and - * by using `.tick` advances in - * time triggering all pending timers. - * - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * - * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { - * const fn = context.mock.fn(); - * - * context.mock.timers.enable({ apis: ['setTimeout'] }); - * - * setTimeout(fn, 9999); - * - * assert.strictEqual(fn.mock.callCount(), 0); - * - * // Advance in time - * context.mock.timers.tick(9999); - * - * assert.strictEqual(fn.mock.callCount(), 1); - * }); - * ``` - * - * Alternativelly, the `.tick` function can be called many times - * - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * - * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { - * const fn = context.mock.fn(); - * context.mock.timers.enable({ apis: ['setTimeout'] }); - * const nineSecs = 9000; - * setTimeout(fn, nineSecs); - * - * const twoSeconds = 3000; - * context.mock.timers.tick(twoSeconds); - * context.mock.timers.tick(twoSeconds); - * context.mock.timers.tick(twoSeconds); - * - * assert.strictEqual(fn.mock.callCount(), 1); - * }); - * ``` - * - * Advancing time using `.tick` will also advance the time for any `Date` object - * created after the mock was enabled (if `Date` was also set to be mocked). - * - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * - * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { - * const fn = context.mock.fn(); - * - * context.mock.timers.enable({ apis: ['setTimeout', 'Date'] }); - * setTimeout(fn, 9999); - * - * assert.strictEqual(fn.mock.callCount(), 0); - * assert.strictEqual(Date.now(), 0); - * - * // Advance in time - * context.mock.timers.tick(9999); - * assert.strictEqual(fn.mock.callCount(), 1); - * assert.strictEqual(Date.now(), 9999); - * }); - * ``` - * @since v20.4.0 - */ - tick(milliseconds: number): void; - /** - * Triggers all pending mocked timers immediately. If the `Date` object is also - * mocked, it will also advance the `Date` object to the furthest timer's time. - * - * The example below triggers all pending timers immediately, - * causing them to execute without any delay. - * - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * - * test('runAll functions following the given order', (context) => { - * context.mock.timers.enable({ apis: ['setTimeout', 'Date'] }); - * const results = []; - * setTimeout(() => results.push(1), 9999); - * - * // Notice that if both timers have the same timeout, - * // the order of execution is guaranteed - * setTimeout(() => results.push(3), 8888); - * setTimeout(() => results.push(2), 8888); - * - * assert.deepStrictEqual(results, []); - * - * context.mock.timers.runAll(); - * assert.deepStrictEqual(results, [3, 2, 1]); - * // The Date object is also advanced to the furthest timer's time - * assert.strictEqual(Date.now(), 9999); - * }); - * ``` - * - * **Note:** The `runAll()` function is specifically designed for - * triggering timers in the context of timer mocking. - * It does not have any effect on real-time system - * clocks or actual timers outside of the mocking environment. - * @since v20.4.0 - */ - runAll(): void; - /** - * Calls {@link MockTimers.reset()}. - */ - [Symbol.dispose](): void; - } - /** - * An object whose methods are used to configure available assertions on the - * `TestContext` objects in the current process. The methods from `node:assert` - * and snapshot testing functions are available by default. - * - * It is possible to apply the same configuration to all files by placing common - * configuration code in a module - * preloaded with `--require` or `--import`. - * @since v22.14.0 - */ - namespace assert { - /** - * Defines a new assertion function with the provided name and function. If an - * assertion already exists with the same name, it is overwritten. - * @since v22.14.0 - */ - function register(name: string, fn: (this: TestContext, ...args: any[]) => void): void; - } - /** - * @since v22.3.0 - */ - namespace snapshot { - /** - * This function is used to customize the default serialization mechanism used by the test runner. - * - * By default, the test runner performs serialization by calling `JSON.stringify(value, null, 2)` on the provided value. - * `JSON.stringify()` does have limitations regarding circular structures and supported data types. - * If a more robust serialization mechanism is required, this function should be used to specify a list of custom serializers. - * - * Serializers are called in order, with the output of the previous serializer passed as input to the next. - * The final result must be a string value. - * @since v22.3.0 - * @param serializers An array of synchronous functions used as the default serializers for snapshot tests. - */ - function setDefaultSnapshotSerializers(serializers: ReadonlyArray<(value: any) => any>): void; - /** - * This function is used to set a custom resolver for the location of the snapshot file used for snapshot testing. - * By default, the snapshot filename is the same as the entry point filename with `.snapshot` appended. - * @since v22.3.0 - * @param fn A function used to compute the location of the snapshot file. - * The function receives the path of the test file as its only argument. If the - * test is not associated with a file (for example in the REPL), the input is - * undefined. `fn()` must return a string specifying the location of the snapshot file. - */ - function setResolveSnapshotPath(fn: (path: string | undefined) => string): void; - } - } - type FunctionPropertyNames = { - [K in keyof T]: T[K] extends Function ? K : never; - }[keyof T]; - export = test; -} - -/** - * The `node:test/reporters` module exposes the builtin-reporters for `node:test`. - * To access it: - * - * ```js - * import test from 'node:test/reporters'; - * ``` - * - * This module is only available under the `node:` scheme. The following will not - * work: - * - * ```js - * import test from 'node:test/reporters'; - * ``` - * @since v19.9.0 - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test/reporters.js) - */ -declare module "node:test/reporters" { - import { Transform, TransformOptions } from "node:stream"; - import { EventData } from "node:test"; - - type TestEvent = - | { type: "test:coverage"; data: EventData.TestCoverage } - | { type: "test:complete"; data: EventData.TestComplete } - | { type: "test:dequeue"; data: EventData.TestDequeue } - | { type: "test:diagnostic"; data: EventData.TestDiagnostic } - | { type: "test:enqueue"; data: EventData.TestEnqueue } - | { type: "test:fail"; data: EventData.TestFail } - | { type: "test:pass"; data: EventData.TestPass } - | { type: "test:plan"; data: EventData.TestPlan } - | { type: "test:start"; data: EventData.TestStart } - | { type: "test:stderr"; data: EventData.TestStderr } - | { type: "test:stdout"; data: EventData.TestStdout } - | { type: "test:summary"; data: EventData.TestSummary } - | { type: "test:watch:drained"; data: undefined }; - type TestEventGenerator = AsyncGenerator; - - interface ReporterConstructorWrapper Transform> { - new(...args: ConstructorParameters): InstanceType; - (...args: ConstructorParameters): InstanceType; - } - - /** - * The `dot` reporter outputs the test results in a compact format, - * where each passing test is represented by a `.`, - * and each failing test is represented by a `X`. - * @since v20.0.0 - */ - function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>; - /** - * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format. - * @since v20.0.0 - */ - function tap(source: TestEventGenerator): AsyncGenerator; - class SpecReporter extends Transform { - constructor(); - } - /** - * The `spec` reporter outputs the test results in a human-readable format. - * @since v20.0.0 - */ - const spec: ReporterConstructorWrapper; - /** - * The `junit` reporter outputs test results in a jUnit XML format. - * @since v21.0.0 - */ - function junit(source: TestEventGenerator): AsyncGenerator; - class LcovReporter extends Transform { - constructor(opts?: Omit); - } - /** - * The `lcov` reporter outputs test coverage when used with the - * [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--experimental-test-coverage) flag. - * @since v22.0.0 - */ - const lcov: LcovReporter; - - export { dot, junit, lcov, spec, tap, TestEvent }; -} diff --git a/node_modules/@types/node/timers.d.ts b/node_modules/@types/node/timers.d.ts deleted file mode 100644 index 44bc977..0000000 --- a/node_modules/@types/node/timers.d.ts +++ /dev/null @@ -1,287 +0,0 @@ -/** - * The `timer` module exposes a global API for scheduling functions to - * be called at some future period of time. Because the timer functions are - * globals, there is no need to import `node:timers` to use the API. - * - * The timer functions within Node.js implement a similar API as the timers API - * provided by Web Browsers but use a different internal implementation that is - * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout). - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/timers.js) - */ -declare module "timers" { - import { Abortable } from "node:events"; - import * as promises from "node:timers/promises"; - export interface TimerOptions extends Abortable { - /** - * Set to `false` to indicate that the scheduled `Timeout` - * should not require the Node.js event loop to remain active. - * @default true - */ - ref?: boolean | undefined; - } - global { - namespace NodeJS { - /** - * This object is created internally and is returned from `setImmediate()`. It - * can be passed to `clearImmediate()` in order to cancel the scheduled - * actions. - * - * By default, when an immediate is scheduled, the Node.js event loop will continue - * running as long as the immediate is active. The `Immediate` object returned by - * `setImmediate()` exports both `immediate.ref()` and `immediate.unref()` - * functions that can be used to control this default behavior. - */ - interface Immediate extends RefCounted, Disposable { - /** - * If true, the `Immediate` object will keep the Node.js event loop active. - * @since v11.0.0 - */ - hasRef(): boolean; - /** - * When called, requests that the Node.js event loop _not_ exit so long as the - * `Immediate` is active. Calling `immediate.ref()` multiple times will have no - * effect. - * - * By default, all `Immediate` objects are "ref'ed", making it normally unnecessary - * to call `immediate.ref()` unless `immediate.unref()` had been called previously. - * @since v9.7.0 - * @returns a reference to `immediate` - */ - ref(): this; - /** - * When called, the active `Immediate` object will not require the Node.js event - * loop to remain active. If there is no other activity keeping the event loop - * running, the process may exit before the `Immediate` object's callback is - * invoked. Calling `immediate.unref()` multiple times will have no effect. - * @since v9.7.0 - * @returns a reference to `immediate` - */ - unref(): this; - /** - * Cancels the immediate. This is similar to calling `clearImmediate()`. - * @since v20.5.0, v18.18.0 - * @experimental - */ - [Symbol.dispose](): void; - _onImmediate(...args: any[]): void; - } - // Legacy interface used in Node.js v9 and prior - // TODO: remove in a future major version bump - /** @deprecated Use `NodeJS.Timeout` instead. */ - interface Timer extends RefCounted { - hasRef(): boolean; - refresh(): this; - [Symbol.toPrimitive](): number; - } - /** - * This object is created internally and is returned from `setTimeout()` and - * `setInterval()`. It can be passed to either `clearTimeout()` or - * `clearInterval()` in order to cancel the scheduled actions. - * - * By default, when a timer is scheduled using either `setTimeout()` or - * `setInterval()`, the Node.js event loop will continue running as long as the - * timer is active. Each of the `Timeout` objects returned by these functions - * export both `timeout.ref()` and `timeout.unref()` functions that can be used to - * control this default behavior. - */ - interface Timeout extends RefCounted, Disposable, Timer { - /** - * Cancels the timeout. - * @since v0.9.1 - * @legacy Use `clearTimeout()` instead. - * @returns a reference to `timeout` - */ - close(): this; - /** - * If true, the `Timeout` object will keep the Node.js event loop active. - * @since v11.0.0 - */ - hasRef(): boolean; - /** - * When called, requests that the Node.js event loop _not_ exit so long as the - * `Timeout` is active. Calling `timeout.ref()` multiple times will have no effect. - * - * By default, all `Timeout` objects are "ref'ed", making it normally unnecessary - * to call `timeout.ref()` unless `timeout.unref()` had been called previously. - * @since v0.9.1 - * @returns a reference to `timeout` - */ - ref(): this; - /** - * Sets the timer's start time to the current time, and reschedules the timer to - * call its callback at the previously specified duration adjusted to the current - * time. This is useful for refreshing a timer without allocating a new - * JavaScript object. - * - * Using this on a timer that has already called its callback will reactivate the - * timer. - * @since v10.2.0 - * @returns a reference to `timeout` - */ - refresh(): this; - /** - * When called, the active `Timeout` object will not require the Node.js event loop - * to remain active. If there is no other activity keeping the event loop running, - * the process may exit before the `Timeout` object's callback is invoked. Calling - * `timeout.unref()` multiple times will have no effect. - * @since v0.9.1 - * @returns a reference to `timeout` - */ - unref(): this; - /** - * Coerce a `Timeout` to a primitive. The primitive can be used to - * clear the `Timeout`. The primitive can only be used in the - * same thread where the timeout was created. Therefore, to use it - * across `worker_threads` it must first be passed to the correct - * thread. This allows enhanced compatibility with browser - * `setTimeout()` and `setInterval()` implementations. - * @since v14.9.0, v12.19.0 - */ - [Symbol.toPrimitive](): number; - /** - * Cancels the timeout. - * @since v20.5.0, v18.18.0 - * @experimental - */ - [Symbol.dispose](): void; - _onTimeout(...args: any[]): void; - } - } - /** - * Schedules the "immediate" execution of the `callback` after I/O events' - * callbacks. - * - * When multiple calls to `setImmediate()` are made, the `callback` functions are - * queued for execution in the order in which they are created. The entire callback - * queue is processed every event loop iteration. If an immediate timer is queued - * from inside an executing callback, that timer will not be triggered until the - * next event loop iteration. - * - * If `callback` is not a function, a `TypeError` will be thrown. - * - * This method has a custom variant for promises that is available using - * `timersPromises.setImmediate()`. - * @since v0.9.1 - * @param callback The function to call at the end of this turn of - * the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout) - * @param args Optional arguments to pass when the `callback` is called. - * @returns for use with `clearImmediate()` - */ - function setImmediate( - callback: (...args: TArgs) => void, - ...args: TArgs - ): NodeJS.Immediate; - // Allow a single void-accepting argument to be optional in arguments lists. - // Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258) - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - function setImmediate(callback: (_: void) => void): NodeJS.Immediate; - namespace setImmediate { - import __promisify__ = promises.setImmediate; - export { __promisify__ }; - } - /** - * Schedules repeated execution of `callback` every `delay` milliseconds. - * - * When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay` - * will be set to `1`. Non-integer delays are truncated to an integer. - * - * If `callback` is not a function, a `TypeError` will be thrown. - * - * This method has a custom variant for promises that is available using - * `timersPromises.setInterval()`. - * @since v0.0.1 - * @param callback The function to call when the timer elapses. - * @param delay The number of milliseconds to wait before calling the - * `callback`. **Default:** `1`. - * @param args Optional arguments to pass when the `callback` is called. - * @returns for use with `clearInterval()` - */ - function setInterval( - callback: (...args: TArgs) => void, - delay?: number, - ...args: TArgs - ): NodeJS.Timeout; - // Allow a single void-accepting argument to be optional in arguments lists. - // Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258) - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - function setInterval(callback: (_: void) => void, delay?: number): NodeJS.Timeout; - /** - * Schedules execution of a one-time `callback` after `delay` milliseconds. - * - * The `callback` will likely not be invoked in precisely `delay` milliseconds. - * Node.js makes no guarantees about the exact timing of when callbacks will fire, - * nor of their ordering. The callback will be called as close as possible to the - * time specified. - * - * When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay` - * will be set to `1`. Non-integer delays are truncated to an integer. - * - * If `callback` is not a function, a `TypeError` will be thrown. - * - * This method has a custom variant for promises that is available using - * `timersPromises.setTimeout()`. - * @since v0.0.1 - * @param callback The function to call when the timer elapses. - * @param delay The number of milliseconds to wait before calling the - * `callback`. **Default:** `1`. - * @param args Optional arguments to pass when the `callback` is called. - * @returns for use with `clearTimeout()` - */ - function setTimeout( - callback: (...args: TArgs) => void, - delay?: number, - ...args: TArgs - ): NodeJS.Timeout; - // Allow a single void-accepting argument to be optional in arguments lists. - // Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258) - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - function setTimeout(callback: (_: void) => void, delay?: number): NodeJS.Timeout; - namespace setTimeout { - import __promisify__ = promises.setTimeout; - export { __promisify__ }; - } - /** - * Cancels an `Immediate` object created by `setImmediate()`. - * @since v0.9.1 - * @param immediate An `Immediate` object as returned by `setImmediate()`. - */ - function clearImmediate(immediate: NodeJS.Immediate | undefined): void; - /** - * Cancels a `Timeout` object created by `setInterval()`. - * @since v0.0.1 - * @param timeout A `Timeout` object as returned by `setInterval()` - * or the primitive of the `Timeout` object as a string or a number. - */ - function clearInterval(timeout: NodeJS.Timeout | string | number | undefined): void; - /** - * Cancels a `Timeout` object created by `setTimeout()`. - * @since v0.0.1 - * @param timeout A `Timeout` object as returned by `setTimeout()` - * or the primitive of the `Timeout` object as a string or a number. - */ - function clearTimeout(timeout: NodeJS.Timeout | string | number | undefined): void; - /** - * The `queueMicrotask()` method queues a microtask to invoke `callback`. If - * `callback` throws an exception, the `process` object `'uncaughtException'` - * event will be emitted. - * - * The microtask queue is managed by V8 and may be used in a similar manner to - * the `process.nextTick()` queue, which is managed by Node.js. The - * `process.nextTick()` queue is always processed before the microtask queue - * within each turn of the Node.js event loop. - * @since v11.0.0 - * @param callback Function to be queued. - */ - function queueMicrotask(callback: () => void): void; - } - import clearImmediate = globalThis.clearImmediate; - import clearInterval = globalThis.clearInterval; - import clearTimeout = globalThis.clearTimeout; - import setImmediate = globalThis.setImmediate; - import setInterval = globalThis.setInterval; - import setTimeout = globalThis.setTimeout; - export { clearImmediate, clearInterval, clearTimeout, promises, setImmediate, setInterval, setTimeout }; -} -declare module "node:timers" { - export * from "timers"; -} diff --git a/node_modules/@types/node/timers/promises.d.ts b/node_modules/@types/node/timers/promises.d.ts deleted file mode 100644 index 05db90c..0000000 --- a/node_modules/@types/node/timers/promises.d.ts +++ /dev/null @@ -1,108 +0,0 @@ -/** - * The `timers/promises` API provides an alternative set of timer functions - * that return `Promise` objects. The API is accessible via - * `require('node:timers/promises')`. - * - * ```js - * import { - * setTimeout, - * setImmediate, - * setInterval, - * } from 'node:timers/promises'; - * ``` - * @since v15.0.0 - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/timers/promises.js) - */ -declare module "timers/promises" { - import { TimerOptions } from "node:timers"; - /** - * ```js - * import { - * setTimeout, - * } from 'node:timers/promises'; - * - * const res = await setTimeout(100, 'result'); - * - * console.log(res); // Prints 'result' - * ``` - * @since v15.0.0 - * @param delay The number of milliseconds to wait before fulfilling the - * promise. **Default:** `1`. - * @param value A value with which the promise is fulfilled. - */ - function setTimeout(delay?: number, value?: T, options?: TimerOptions): Promise; - /** - * ```js - * import { - * setImmediate, - * } from 'node:timers/promises'; - * - * const res = await setImmediate('result'); - * - * console.log(res); // Prints 'result' - * ``` - * @since v15.0.0 - * @param value A value with which the promise is fulfilled. - */ - function setImmediate(value?: T, options?: TimerOptions): Promise; - /** - * Returns an async iterator that generates values in an interval of `delay` ms. - * If `ref` is `true`, you need to call `next()` of async iterator explicitly - * or implicitly to keep the event loop alive. - * - * ```js - * import { - * setInterval, - * } from 'node:timers/promises'; - * - * const interval = 100; - * for await (const startTime of setInterval(interval, Date.now())) { - * const now = Date.now(); - * console.log(now); - * if ((now - startTime) > 1000) - * break; - * } - * console.log(Date.now()); - * ``` - * @since v15.9.0 - * @param delay The number of milliseconds to wait between iterations. - * **Default:** `1`. - * @param value A value with which the iterator returns. - */ - function setInterval(delay?: number, value?: T, options?: TimerOptions): NodeJS.AsyncIterator; - interface Scheduler { - /** - * An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification - * being developed as a standard Web Platform API. - * - * Calling `timersPromises.scheduler.wait(delay, options)` is roughly equivalent - * to calling `timersPromises.setTimeout(delay, undefined, options)` except that - * the `ref` option is not supported. - * - * ```js - * import { scheduler } from 'node:timers/promises'; - * - * await scheduler.wait(1000); // Wait one second before continuing - * ``` - * @since v17.3.0, v16.14.0 - * @experimental - * @param delay The number of milliseconds to wait before resolving the - * promise. - */ - wait(delay: number, options?: { signal?: AbortSignal }): Promise; - /** - * An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification - * being developed as a standard Web Platform API. - * - * Calling `timersPromises.scheduler.yield()` is equivalent to calling - * `timersPromises.setImmediate()` with no arguments. - * @since v17.3.0, v16.14.0 - * @experimental - */ - yield(): Promise; - } - const scheduler: Scheduler; -} -declare module "node:timers/promises" { - export * from "timers/promises"; -} diff --git a/node_modules/@types/node/tls.d.ts b/node_modules/@types/node/tls.d.ts deleted file mode 100644 index 5177032..0000000 --- a/node_modules/@types/node/tls.d.ts +++ /dev/null @@ -1,1319 +0,0 @@ -/** - * The `node:tls` module provides an implementation of the Transport Layer Security - * (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. - * The module can be accessed using: - * - * ```js - * import tls from 'node:tls'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/tls.js) - */ -declare module "tls" { - import { NonSharedBuffer } from "node:buffer"; - import { X509Certificate } from "node:crypto"; - import * as net from "node:net"; - import * as stream from "stream"; - const CLIENT_RENEG_LIMIT: number; - const CLIENT_RENEG_WINDOW: number; - interface Certificate extends NodeJS.Dict { - /** - * Country code. - */ - C?: string | string[]; - /** - * Street. - */ - ST?: string | string[]; - /** - * Locality. - */ - L?: string | string[]; - /** - * Organization. - */ - O?: string | string[]; - /** - * Organizational unit. - */ - OU?: string | string[]; - /** - * Common name. - */ - CN?: string | string[]; - } - interface PeerCertificate { - /** - * `true` if a Certificate Authority (CA), `false` otherwise. - * @since v18.13.0 - */ - ca: boolean; - /** - * The DER encoded X.509 certificate data. - */ - raw: NonSharedBuffer; - /** - * The certificate subject. - */ - subject: Certificate; - /** - * The certificate issuer, described in the same terms as the `subject`. - */ - issuer: Certificate; - /** - * The date-time the certificate is valid from. - */ - valid_from: string; - /** - * The date-time the certificate is valid to. - */ - valid_to: string; - /** - * The certificate serial number, as a hex string. - */ - serialNumber: string; - /** - * The SHA-1 digest of the DER encoded certificate. - * It is returned as a `:` separated hexadecimal string. - */ - fingerprint: string; - /** - * The SHA-256 digest of the DER encoded certificate. - * It is returned as a `:` separated hexadecimal string. - */ - fingerprint256: string; - /** - * The SHA-512 digest of the DER encoded certificate. - * It is returned as a `:` separated hexadecimal string. - */ - fingerprint512: string; - /** - * The extended key usage, a set of OIDs. - */ - ext_key_usage?: string[]; - /** - * A string containing concatenated names for the subject, - * an alternative to the `subject` names. - */ - subjectaltname?: string; - /** - * An array describing the AuthorityInfoAccess, used with OCSP. - */ - infoAccess?: NodeJS.Dict; - /** - * For RSA keys: The RSA bit size. - * - * For EC keys: The key size in bits. - */ - bits?: number; - /** - * The RSA exponent, as a string in hexadecimal number notation. - */ - exponent?: string; - /** - * The RSA modulus, as a hexadecimal string. - */ - modulus?: string; - /** - * The public key. - */ - pubkey?: NonSharedBuffer; - /** - * The ASN.1 name of the OID of the elliptic curve. - * Well-known curves are identified by an OID. - * While it is unusual, it is possible that the curve - * is identified by its mathematical properties, - * in which case it will not have an OID. - */ - asn1Curve?: string; - /** - * The NIST name for the elliptic curve, if it has one - * (not all well-known curves have been assigned names by NIST). - */ - nistCurve?: string; - } - interface DetailedPeerCertificate extends PeerCertificate { - /** - * The issuer certificate object. - * For self-signed certificates, this may be a circular reference. - */ - issuerCertificate: DetailedPeerCertificate; - } - interface CipherNameAndProtocol { - /** - * The cipher name. - */ - name: string; - /** - * SSL/TLS protocol version. - */ - version: string; - /** - * IETF name for the cipher suite. - */ - standardName: string; - } - interface EphemeralKeyInfo { - /** - * The supported types are 'DH' and 'ECDH'. - */ - type: string; - /** - * The name property is available only when type is 'ECDH'. - */ - name?: string | undefined; - /** - * The size of parameter of an ephemeral key exchange. - */ - size: number; - } - interface KeyObject { - /** - * Private keys in PEM format. - */ - pem: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string | undefined; - } - interface PxfObject { - /** - * PFX or PKCS12 encoded private key and certificate chain. - */ - buf: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string | undefined; - } - interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions { - /** - * If true the TLS socket will be instantiated in server-mode. - * Defaults to false. - */ - isServer?: boolean | undefined; - /** - * An optional net.Server instance. - */ - server?: net.Server | undefined; - /** - * An optional Buffer instance containing a TLS session. - */ - session?: Buffer | undefined; - /** - * If true, specifies that the OCSP status request extension will be - * added to the client hello and an 'OCSPResponse' event will be - * emitted on the socket before establishing a secure communication - */ - requestOCSP?: boolean | undefined; - } - /** - * Performs transparent encryption of written data and all required TLS - * negotiation. - * - * Instances of `tls.TLSSocket` implement the duplex `Stream` interface. - * - * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the - * connection is open. - * @since v0.11.4 - */ - class TLSSocket extends net.Socket { - /** - * Construct a new tls.TLSSocket object from an existing TCP socket. - */ - constructor(socket: net.Socket | stream.Duplex, options?: TLSSocketOptions); - /** - * This property is `true` if the peer certificate was signed by one of the CAs - * specified when creating the `tls.TLSSocket` instance, otherwise `false`. - * @since v0.11.4 - */ - authorized: boolean; - /** - * Returns the reason why the peer's certificate was not been verified. This - * property is set only when `tlsSocket.authorized === false`. - * @since v0.11.4 - */ - authorizationError: Error; - /** - * Always returns `true`. This may be used to distinguish TLS sockets from regular`net.Socket` instances. - * @since v0.11.4 - */ - encrypted: true; - /** - * String containing the selected ALPN protocol. - * Before a handshake has completed, this value is always null. - * When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false. - */ - alpnProtocol: string | false | null; - /** - * String containing the server name requested via SNI (Server Name Indication) TLS extension. - */ - servername: string | false | null; - /** - * Returns an object representing the local certificate. The returned object has - * some properties corresponding to the fields of the certificate. - * - * See {@link TLSSocket.getPeerCertificate} for an example of the certificate - * structure. - * - * If there is no local certificate, an empty object will be returned. If the - * socket has been destroyed, `null` will be returned. - * @since v11.2.0 - */ - getCertificate(): PeerCertificate | object | null; - /** - * Returns an object containing information on the negotiated cipher suite. - * - * For example, a TLSv1.2 protocol with AES256-SHA cipher: - * - * ```json - * { - * "name": "AES256-SHA", - * "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA", - * "version": "SSLv3" - * } - * ``` - * - * See [SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html) for more information. - * @since v0.11.4 - */ - getCipher(): CipherNameAndProtocol; - /** - * Returns an object representing the type, name, and size of parameter of - * an ephemeral key exchange in `perfect forward secrecy` on a client - * connection. It returns an empty object when the key exchange is not - * ephemeral. As this is only supported on a client socket; `null` is returned - * if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The `name` property is available only when type is `'ECDH'`. - * - * For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`. - * @since v5.0.0 - */ - getEphemeralKeyInfo(): EphemeralKeyInfo | object | null; - /** - * As the `Finished` messages are message digests of the complete handshake - * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can - * be used for external authentication procedures when the authentication - * provided by SSL/TLS is not desired or is not enough. - * - * Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used - * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). - * @since v9.9.0 - * @return The latest `Finished` message that has been sent to the socket as part of a SSL/TLS handshake, or `undefined` if no `Finished` message has been sent yet. - */ - getFinished(): NonSharedBuffer | undefined; - /** - * Returns an object representing the peer's certificate. If the peer does not - * provide a certificate, an empty object will be returned. If the socket has been - * destroyed, `null` will be returned. - * - * If the full certificate chain was requested, each certificate will include an`issuerCertificate` property containing an object representing its issuer's - * certificate. - * @since v0.11.4 - * @param detailed Include the full certificate chain if `true`, otherwise include just the peer's certificate. - * @return A certificate object. - */ - getPeerCertificate(detailed: true): DetailedPeerCertificate; - getPeerCertificate(detailed?: false): PeerCertificate; - getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; - /** - * As the `Finished` messages are message digests of the complete handshake - * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can - * be used for external authentication procedures when the authentication - * provided by SSL/TLS is not desired or is not enough. - * - * Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used - * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). - * @since v9.9.0 - * @return The latest `Finished` message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or `undefined` if there is no `Finished` message so - * far. - */ - getPeerFinished(): NonSharedBuffer | undefined; - /** - * Returns a string containing the negotiated SSL/TLS protocol version of the - * current connection. The value `'unknown'` will be returned for connected - * sockets that have not completed the handshaking process. The value `null` will - * be returned for server sockets or disconnected client sockets. - * - * Protocol versions are: - * - * * `'SSLv3'` - * * `'TLSv1'` - * * `'TLSv1.1'` - * * `'TLSv1.2'` - * * `'TLSv1.3'` - * - * See the OpenSSL [`SSL_get_version`](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html) documentation for more information. - * @since v5.7.0 - */ - getProtocol(): string | null; - /** - * Returns the TLS session data or `undefined` if no session was - * negotiated. On the client, the data can be provided to the `session` option of {@link connect} to resume the connection. On the server, it may be useful - * for debugging. - * - * See `Session Resumption` for more information. - * - * Note: `getSession()` works only for TLSv1.2 and below. For TLSv1.3, applications - * must use the `'session'` event (it also works for TLSv1.2 and below). - * @since v0.11.4 - */ - getSession(): NonSharedBuffer | undefined; - /** - * See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information. - * @since v12.11.0 - * @return List of signature algorithms shared between the server and the client in the order of decreasing preference. - */ - getSharedSigalgs(): string[]; - /** - * For a client, returns the TLS session ticket if one is available, or`undefined`. For a server, always returns `undefined`. - * - * It may be useful for debugging. - * - * See `Session Resumption` for more information. - * @since v0.11.4 - */ - getTLSTicket(): NonSharedBuffer | undefined; - /** - * See `Session Resumption` for more information. - * @since v0.5.6 - * @return `true` if the session was reused, `false` otherwise. - */ - isSessionReused(): boolean; - /** - * The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. - * Upon completion, the `callback` function will be passed a single argument - * that is either an `Error` (if the request failed) or `null`. - * - * This method can be used to request a peer's certificate after the secure - * connection has been established. - * - * When running as the server, the socket will be destroyed with an error after `handshakeTimeout` timeout. - * - * For TLSv1.3, renegotiation cannot be initiated, it is not supported by the - * protocol. - * @since v0.11.8 - * @param callback If `renegotiate()` returned `true`, callback is attached once to the `'secure'` event. If `renegotiate()` returned `false`, `callback` will be called in the next tick with - * an error, unless the `tlsSocket` has been destroyed, in which case `callback` will not be called at all. - * @return `true` if renegotiation was initiated, `false` otherwise. - */ - renegotiate( - options: { - rejectUnauthorized?: boolean | undefined; - requestCert?: boolean | undefined; - }, - callback: (err: Error | null) => void, - ): undefined | boolean; - /** - * The `tlsSocket.setKeyCert()` method sets the private key and certificate to use for the socket. - * This is mainly useful if you wish to select a server certificate from a TLS server's `ALPNCallback`. - * @since v22.5.0, v20.17.0 - * @param context An object containing at least `key` and `cert` properties from the {@link createSecureContext()} `options`, - * or a TLS context object created with {@link createSecureContext()} itself. - */ - setKeyCert(context: SecureContextOptions | SecureContext): void; - /** - * The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. - * Returns `true` if setting the limit succeeded; `false` otherwise. - * - * Smaller fragment sizes decrease the buffering latency on the client: larger - * fragments are buffered by the TLS layer until the entire fragment is received - * and its integrity is verified; large fragments can span multiple roundtrips - * and their processing can be delayed due to packet loss or reordering. However, - * smaller fragments add extra TLS framing bytes and CPU overhead, which may - * decrease overall server throughput. - * @since v0.11.11 - * @param [size=16384] The maximum TLS fragment size. The maximum value is `16384`. - */ - setMaxSendFragment(size: number): boolean; - /** - * Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts - * to renegotiate will trigger an `'error'` event on the `TLSSocket`. - * @since v8.4.0 - */ - disableRenegotiation(): void; - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * - * The format of the output is identical to the output of`openssl s_client -trace` or `openssl s_server -trace`. While it is produced by - * OpenSSL's `SSL_trace()` function, the format is undocumented, can change - * without notice, and should not be relied on. - * @since v12.2.0 - */ - enableTrace(): void; - /** - * Returns the peer certificate as an `X509Certificate` object. - * - * If there is no peer certificate, or the socket has been destroyed,`undefined` will be returned. - * @since v15.9.0 - */ - getPeerX509Certificate(): X509Certificate | undefined; - /** - * Returns the local certificate as an `X509Certificate` object. - * - * If there is no local certificate, or the socket has been destroyed,`undefined` will be returned. - * @since v15.9.0 - */ - getX509Certificate(): X509Certificate | undefined; - /** - * Keying material is used for validations to prevent different kind of attacks in - * network protocols, for example in the specifications of IEEE 802.1X. - * - * Example - * - * ```js - * const keyingMaterial = tlsSocket.exportKeyingMaterial( - * 128, - * 'client finished'); - * - * /* - * Example return value of keyingMaterial: - * - * - * ``` - * - * See the OpenSSL [`SSL_export_keying_material`](https://www.openssl.org/docs/man1.1.1/man3/SSL_export_keying_material.html) documentation for more - * information. - * @since v13.10.0, v12.17.0 - * @param length number of bytes to retrieve from keying material - * @param label an application specific label, typically this will be a value from the [IANA Exporter Label - * Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels). - * @param context Optionally provide a context. - * @return requested bytes of the keying material - */ - exportKeyingMaterial(length: number, label: string, context: Buffer): NonSharedBuffer; - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; - addListener(event: "secureConnect", listener: () => void): this; - addListener(event: "session", listener: (session: NonSharedBuffer) => void): this; - addListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "OCSPResponse", response: NonSharedBuffer): boolean; - emit(event: "secureConnect"): boolean; - emit(event: "session", session: NonSharedBuffer): boolean; - emit(event: "keylog", line: NonSharedBuffer): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; - on(event: "secureConnect", listener: () => void): this; - on(event: "session", listener: (session: NonSharedBuffer) => void): this; - on(event: "keylog", listener: (line: NonSharedBuffer) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; - once(event: "secureConnect", listener: () => void): this; - once(event: "session", listener: (session: NonSharedBuffer) => void): this; - once(event: "keylog", listener: (line: NonSharedBuffer) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; - prependListener(event: "secureConnect", listener: () => void): this; - prependListener(event: "session", listener: (session: NonSharedBuffer) => void): this; - prependListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; - prependOnceListener(event: "secureConnect", listener: () => void): this; - prependOnceListener(event: "session", listener: (session: NonSharedBuffer) => void): this; - prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this; - } - interface CommonConnectionOptions { - /** - * An optional TLS context object from tls.createSecureContext() - */ - secureContext?: SecureContext | undefined; - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * @default false - */ - enableTrace?: boolean | undefined; - /** - * If true the server will request a certificate from clients that - * connect and attempt to verify that certificate. Defaults to - * false. - */ - requestCert?: boolean | undefined; - /** - * An array of strings or a Buffer naming possible ALPN protocols. - * (Protocols should be ordered by their priority.) - */ - ALPNProtocols?: readonly string[] | NodeJS.ArrayBufferView | undefined; - /** - * SNICallback(servername, cb) A function that will be - * called if the client supports SNI TLS extension. Two arguments - * will be passed when called: servername and cb. SNICallback should - * invoke cb(null, ctx), where ctx is a SecureContext instance. - * (tls.createSecureContext(...) can be used to get a proper - * SecureContext.) If SNICallback wasn't provided the default callback - * with high-level API will be used (see below). - */ - SNICallback?: ((servername: string, cb: (err: Error | null, ctx?: SecureContext) => void) => void) | undefined; - /** - * If true the server will reject any connection which is not - * authorized with the list of supplied CAs. This option only has an - * effect if requestCert is true. - * @default true - */ - rejectUnauthorized?: boolean | undefined; - } - interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts { - /** - * Abort the connection if the SSL/TLS handshake does not finish in the - * specified number of milliseconds. A 'tlsClientError' is emitted on - * the tls.Server object whenever a handshake times out. Default: - * 120000 (120 seconds). - */ - handshakeTimeout?: number | undefined; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number | undefined; - /** - * 48-bytes of cryptographically strong pseudo-random data. - */ - ticketKeys?: Buffer | undefined; - /** - * @param socket - * @param identity identity parameter sent from the client. - * @return pre-shared key that must either be - * a buffer or `null` to stop the negotiation process. Returned PSK must be - * compatible with the selected cipher's digest. - * - * When negotiating TLS-PSK (pre-shared keys), this function is called - * with the identity provided by the client. - * If the return value is `null` the negotiation process will stop and an - * "unknown_psk_identity" alert message will be sent to the other party. - * If the server wishes to hide the fact that the PSK identity was not known, - * the callback must provide some random data as `psk` to make the connection - * fail with "decrypt_error" before negotiation is finished. - * PSK ciphers are disabled by default, and using TLS-PSK thus - * requires explicitly specifying a cipher suite with the `ciphers` option. - * More information can be found in the RFC 4279. - */ - pskCallback?: ((socket: TLSSocket, identity: string) => NodeJS.ArrayBufferView | null) | undefined; - /** - * hint to send to a client to help - * with selecting the identity during TLS-PSK negotiation. Will be ignored - * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be - * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code. - */ - pskIdentityHint?: string | undefined; - } - interface PSKCallbackNegotation { - psk: NodeJS.ArrayBufferView; - identity: string; - } - interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { - host?: string | undefined; - port?: number | undefined; - path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. - socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket - checkServerIdentity?: typeof checkServerIdentity | undefined; - servername?: string | undefined; // SNI TLS Extension - session?: Buffer | undefined; - minDHSize?: number | undefined; - lookup?: net.LookupFunction | undefined; - timeout?: number | undefined; - /** - * When negotiating TLS-PSK (pre-shared keys), this function is called - * with optional identity `hint` provided by the server or `null` - * in case of TLS 1.3 where `hint` was removed. - * It will be necessary to provide a custom `tls.checkServerIdentity()` - * for the connection as the default one will try to check hostname/IP - * of the server against the certificate but that's not applicable for PSK - * because there won't be a certificate present. - * More information can be found in the RFC 4279. - * - * @param hint message sent from the server to help client - * decide which identity to use during negotiation. - * Always `null` if TLS 1.3 is used. - * @returns Return `null` to stop the negotiation process. `psk` must be - * compatible with the selected cipher's digest. - * `identity` must use UTF-8 encoding. - */ - pskCallback?: ((hint: string | null) => PSKCallbackNegotation | null) | undefined; - } - /** - * Accepts encrypted connections using TLS or SSL. - * @since v0.3.2 - */ - class Server extends net.Server { - constructor(secureConnectionListener?: (socket: TLSSocket) => void); - constructor(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void); - /** - * The `server.addContext()` method adds a secure context that will be used if - * the client request's SNI name matches the supplied `hostname` (or wildcard). - * - * When there are multiple matching contexts, the most recently added one is - * used. - * @since v0.5.3 - * @param hostname A SNI host name or wildcard (e.g. `'*'`) - * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created - * with {@link createSecureContext} itself. - */ - addContext(hostname: string, context: SecureContextOptions | SecureContext): void; - /** - * Returns the session ticket keys. - * - * See `Session Resumption` for more information. - * @since v3.0.0 - * @return A 48-byte buffer containing the session ticket keys. - */ - getTicketKeys(): NonSharedBuffer; - /** - * The `server.setSecureContext()` method replaces the secure context of an - * existing server. Existing connections to the server are not interrupted. - * @since v11.0.0 - * @param options An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). - */ - setSecureContext(options: SecureContextOptions): void; - /** - * Sets the session ticket keys. - * - * Changes to the ticket keys are effective only for future server connections. - * Existing or currently pending server connections will use the previous keys. - * - * See `Session Resumption` for more information. - * @since v3.0.0 - * @param keys A 48-byte buffer containing the session ticket keys. - */ - setTicketKeys(keys: Buffer): void; - /** - * events.EventEmitter - * 1. tlsClientError - * 2. newSession - * 3. OCSPRequest - * 4. resumeSession - * 5. secureConnection - * 6. keylog - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - addListener( - event: "newSession", - listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, - ): this; - addListener( - event: "OCSPRequest", - listener: ( - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ) => void, - ): this; - addListener( - event: "resumeSession", - listener: ( - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ) => void, - ): this; - addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - addListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; - emit( - event: "newSession", - sessionId: NonSharedBuffer, - sessionData: NonSharedBuffer, - callback: () => void, - ): boolean; - emit( - event: "OCSPRequest", - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ): boolean; - emit( - event: "resumeSession", - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ): boolean; - emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; - emit(event: "keylog", line: NonSharedBuffer, tlsSocket: TLSSocket): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - on( - event: "newSession", - listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, - ): this; - on( - event: "OCSPRequest", - listener: ( - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ) => void, - ): this; - on( - event: "resumeSession", - listener: ( - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ) => void, - ): this; - on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - on(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - once( - event: "newSession", - listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, - ): this; - once( - event: "OCSPRequest", - listener: ( - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ) => void, - ): this; - once( - event: "resumeSession", - listener: ( - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ) => void, - ): this; - once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - once(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependListener( - event: "newSession", - listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, - ): this; - prependListener( - event: "OCSPRequest", - listener: ( - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ) => void, - ): this; - prependListener( - event: "resumeSession", - listener: ( - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ) => void, - ): this; - prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependOnceListener( - event: "newSession", - listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void, - ): this; - prependOnceListener( - event: "OCSPRequest", - listener: ( - certificate: NonSharedBuffer, - issuer: NonSharedBuffer, - callback: (err: Error | null, resp: Buffer | null) => void, - ) => void, - ): this; - prependOnceListener( - event: "resumeSession", - listener: ( - sessionId: NonSharedBuffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ) => void, - ): this; - prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: TLSSocket) => void): this; - } - /** - * @deprecated since v0.11.3 Use `tls.TLSSocket` instead. - */ - interface SecurePair { - encrypted: TLSSocket; - cleartext: TLSSocket; - } - type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1"; - interface SecureContextOptions { - /** - * If set, this will be called when a client opens a connection using the ALPN extension. - * One argument will be passed to the callback: an object containing `servername` and `protocols` fields, - * respectively containing the server name from the SNI extension (if any) and an array of - * ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`, - * which will be returned to the client as the selected ALPN protocol, or `undefined`, - * to reject the connection with a fatal alert. If a string is returned that does not match one of - * the client's ALPN protocols, an error will be thrown. - * This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error. - */ - ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined; - /** - * Treat intermediate (non-self-signed) - * certificates in the trust CA certificate list as trusted. - * @since v22.9.0, v20.18.0 - */ - allowPartialTrustChain?: boolean | undefined; - /** - * Optionally override the trusted CA certificates. Default is to trust - * the well-known CAs curated by Mozilla. Mozilla's CAs are completely - * replaced when CAs are explicitly specified using this option. - */ - ca?: string | Buffer | Array | undefined; - /** - * Cert chains in PEM format. One cert chain should be provided per - * private key. Each cert chain should consist of the PEM formatted - * certificate for a provided private key, followed by the PEM - * formatted intermediate certificates (if any), in order, and not - * including the root CA (the root CA must be pre-known to the peer, - * see ca). When providing multiple cert chains, they do not have to - * be in the same order as their private keys in key. If the - * intermediate certificates are not provided, the peer will not be - * able to validate the certificate, and the handshake will fail. - */ - cert?: string | Buffer | Array | undefined; - /** - * Colon-separated list of supported signature algorithms. The list - * can contain digest algorithms (SHA256, MD5 etc.), public key - * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g - * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512). - */ - sigalgs?: string | undefined; - /** - * Cipher suite specification, replacing the default. For more - * information, see modifying the default cipher suite. Permitted - * ciphers can be obtained via tls.getCiphers(). Cipher names must be - * uppercased in order for OpenSSL to accept them. - */ - ciphers?: string | undefined; - /** - * Name of an OpenSSL engine which can provide the client certificate. - * @deprecated - */ - clientCertEngine?: string | undefined; - /** - * PEM formatted CRLs (Certificate Revocation Lists). - */ - crl?: string | Buffer | Array | undefined; - /** - * `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy. - * If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available. - * ECDHE-based perfect forward secrecy will still be available. - */ - dhparam?: string | Buffer | undefined; - /** - * A string describing a named curve or a colon separated list of curve - * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key - * agreement. Set to auto to select the curve automatically. Use - * crypto.getCurves() to obtain a list of available curve names. On - * recent releases, openssl ecparam -list_curves will also display the - * name and description of each available elliptic curve. Default: - * tls.DEFAULT_ECDH_CURVE. - */ - ecdhCurve?: string | undefined; - /** - * Attempt to use the server's cipher suite preferences instead of the - * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be - * set in secureOptions - */ - honorCipherOrder?: boolean | undefined; - /** - * Private keys in PEM format. PEM allows the option of private keys - * being encrypted. Encrypted keys will be decrypted with - * options.passphrase. Multiple keys using different algorithms can be - * provided either as an array of unencrypted key strings or buffers, - * or an array of objects in the form {pem: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted keys will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - key?: string | Buffer | Array | undefined; - /** - * Name of an OpenSSL engine to get private key from. Should be used - * together with privateKeyIdentifier. - * @deprecated - */ - privateKeyEngine?: string | undefined; - /** - * Identifier of a private key managed by an OpenSSL engine. Should be - * used together with privateKeyEngine. Should not be set together with - * key, because both options define a private key in different ways. - * @deprecated - */ - privateKeyIdentifier?: string | undefined; - /** - * Optionally set the maximum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. - * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using - * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to - * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used. - */ - maxVersion?: SecureVersion | undefined; - /** - * Optionally set the minimum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. It is not recommended to use - * less than TLSv1.2, but it may be required for interoperability. - * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using - * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to - * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used. - */ - minVersion?: SecureVersion | undefined; - /** - * Shared passphrase used for a single private key and/or a PFX. - */ - passphrase?: string | undefined; - /** - * PFX or PKCS12 encoded private key and certificate chain. pfx is an - * alternative to providing key and cert individually. PFX is usually - * encrypted, if it is, passphrase will be used to decrypt it. Multiple - * PFX can be provided either as an array of unencrypted PFX buffers, - * or an array of objects in the form {buf: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted PFX will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - pfx?: string | Buffer | Array | undefined; - /** - * Optionally affect the OpenSSL protocol behavior, which is not - * usually necessary. This should be used carefully if at all! Value is - * a numeric bitmask of the SSL_OP_* options from OpenSSL Options - */ - secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options - /** - * Legacy mechanism to select the TLS protocol version to use, it does - * not support independent control of the minimum and maximum version, - * and does not support limiting the protocol to TLSv1.3. Use - * minVersion and maxVersion instead. The possible values are listed as - * SSL_METHODS, use the function names as strings. For example, use - * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow - * any TLS protocol version up to TLSv1.3. It is not recommended to use - * TLS versions less than 1.2, but it may be required for - * interoperability. Default: none, see minVersion. - */ - secureProtocol?: string | undefined; - /** - * Opaque identifier used by servers to ensure session state is not - * shared between applications. Unused by clients. - */ - sessionIdContext?: string | undefined; - /** - * 48-bytes of cryptographically strong pseudo-random data. - * See Session Resumption for more information. - */ - ticketKeys?: Buffer | undefined; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number | undefined; - } - interface SecureContext { - context: any; - } - /** - * Verifies the certificate `cert` is issued to `hostname`. - * - * Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on - * failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type). - * - * This function is intended to be used in combination with the`checkServerIdentity` option that can be passed to {@link connect} and as - * such operates on a `certificate object`. For other purposes, consider using `x509.checkHost()` instead. - * - * This function can be overwritten by providing an alternative function as the `options.checkServerIdentity` option that is passed to `tls.connect()`. The - * overwriting function can call `tls.checkServerIdentity()` of course, to augment - * the checks done with additional verification. - * - * This function is only called if the certificate passed all other checks, such as - * being issued by trusted CA (`options.ca`). - * - * Earlier versions of Node.js incorrectly accepted certificates for a given`hostname` if a matching `uniformResourceIdentifier` subject alternative name - * was present (see [CVE-2021-44531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44531)). Applications that wish to accept`uniformResourceIdentifier` subject alternative names can use - * a custom `options.checkServerIdentity` function that implements the desired behavior. - * @since v0.8.4 - * @param hostname The host name or IP address to verify the certificate against. - * @param cert A `certificate object` representing the peer's certificate. - */ - function checkServerIdentity(hostname: string, cert: PeerCertificate): Error | undefined; - /** - * Creates a new {@link Server}. The `secureConnectionListener`, if provided, is - * automatically set as a listener for the `'secureConnection'` event. - * - * The `ticketKeys` options is automatically shared between `node:cluster` module - * workers. - * - * The following illustrates a simple echo server: - * - * ```js - * import tls from 'node:tls'; - * import fs from 'node:fs'; - * - * const options = { - * key: fs.readFileSync('server-key.pem'), - * cert: fs.readFileSync('server-cert.pem'), - * - * // This is necessary only if using client certificate authentication. - * requestCert: true, - * - * // This is necessary only if the client uses a self-signed certificate. - * ca: [ fs.readFileSync('client-cert.pem') ], - * }; - * - * const server = tls.createServer(options, (socket) => { - * console.log('server connected', - * socket.authorized ? 'authorized' : 'unauthorized'); - * socket.write('welcome!\n'); - * socket.setEncoding('utf8'); - * socket.pipe(socket); - * }); - * server.listen(8000, () => { - * console.log('server bound'); - * }); - * ``` - * - * The server can be tested by connecting to it using the example client from {@link connect}. - * @since v0.3.2 - */ - function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server; - function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; - /** - * The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event. - * - * `tls.connect()` returns a {@link TLSSocket} object. - * - * Unlike the `https` API, `tls.connect()` does not enable the - * SNI (Server Name Indication) extension by default, which may cause some - * servers to return an incorrect certificate or reject the connection - * altogether. To enable SNI, set the `servername` option in addition - * to `host`. - * - * The following illustrates a client for the echo server example from {@link createServer}: - * - * ```js - * // Assumes an echo server that is listening on port 8000. - * import tls from 'node:tls'; - * import fs from 'node:fs'; - * - * const options = { - * // Necessary only if the server requires client certificate authentication. - * key: fs.readFileSync('client-key.pem'), - * cert: fs.readFileSync('client-cert.pem'), - * - * // Necessary only if the server uses a self-signed certificate. - * ca: [ fs.readFileSync('server-cert.pem') ], - * - * // Necessary only if the server's cert isn't for "localhost". - * checkServerIdentity: () => { return null; }, - * }; - * - * const socket = tls.connect(8000, options, () => { - * console.log('client connected', - * socket.authorized ? 'authorized' : 'unauthorized'); - * process.stdin.pipe(socket); - * process.stdin.resume(); - * }); - * socket.setEncoding('utf8'); - * socket.on('data', (data) => { - * console.log(data); - * }); - * socket.on('end', () => { - * console.log('server ends connection'); - * }); - * ``` - * @since v0.11.3 - */ - function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - function connect( - port: number, - host?: string, - options?: ConnectionOptions, - secureConnectListener?: () => void, - ): TLSSocket; - function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - /** - * Creates a new secure pair object with two streams, one of which reads and writes - * the encrypted data and the other of which reads and writes the cleartext data. - * Generally, the encrypted stream is piped to/from an incoming encrypted data - * stream and the cleartext one is used as a replacement for the initial encrypted - * stream. - * - * `tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and `encrypted` stream properties. - * - * Using `cleartext` has the same API as {@link TLSSocket}. - * - * The `tls.createSecurePair()` method is now deprecated in favor of`tls.TLSSocket()`. For example, the code: - * - * ```js - * pair = tls.createSecurePair(// ... ); - * pair.encrypted.pipe(socket); - * socket.pipe(pair.encrypted); - * ``` - * - * can be replaced by: - * - * ```js - * secureSocket = tls.TLSSocket(socket, options); - * ``` - * - * where `secureSocket` has the same API as `pair.cleartext`. - * @since v0.3.2 - * @deprecated Since v0.11.3 - Use {@link TLSSocket} instead. - * @param context A secure context object as returned by `tls.createSecureContext()` - * @param isServer `true` to specify that this TLS connection should be opened as a server. - * @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`. - * @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`. - */ - function createSecurePair( - context?: SecureContext, - isServer?: boolean, - requestCert?: boolean, - rejectUnauthorized?: boolean, - ): SecurePair; - /** - * `{@link createServer}` sets the default value of the `honorCipherOrder` option - * to `true`, other APIs that create secure contexts leave it unset. - * - * `{@link createServer}` uses a 128 bit truncated SHA1 hash value generated - * from `process.argv` as the default value of the `sessionIdContext` option, other - * APIs that create secure contexts have no default value. - * - * The `tls.createSecureContext()` method creates a `SecureContext` object. It is - * usable as an argument to several `tls` APIs, such as `server.addContext()`, - * but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option. - * - * A key is _required_ for ciphers that use certificates. Either `key` or `pfx` can be used to provide it. - * - * If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of - * CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt). - * - * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto' `option. When set to `'auto'`, well-known DHE parameters of sufficient strength - * will be selected automatically. Otherwise, if necessary, `openssl dhparam` can - * be used to create custom parameters. The key length must be greater than or - * equal to 1024 bits or else an error will be thrown. Although 1024 bits is - * permissible, use 2048 bits or larger for stronger security. - * @since v0.11.13 - */ - function createSecureContext(options?: SecureContextOptions): SecureContext; - /** - * Returns an array containing the CA certificates from various sources, depending on `type`: - * - * * `"default"`: return the CA certificates that will be used by the Node.js TLS clients by default. - * * When `--use-bundled-ca` is enabled (default), or `--use-openssl-ca` is not enabled, - * this would include CA certificates from the bundled Mozilla CA store. - * * When `--use-system-ca` is enabled, this would also include certificates from the system's - * trusted store. - * * When `NODE_EXTRA_CA_CERTS` is used, this would also include certificates loaded from the specified - * file. - * * `"system"`: return the CA certificates that are loaded from the system's trusted store, according - * to rules set by `--use-system-ca`. This can be used to get the certificates from the system - * when `--use-system-ca` is not enabled. - * * `"bundled"`: return the CA certificates from the bundled Mozilla CA store. This would be the same - * as `tls.rootCertificates`. - * * `"extra"`: return the CA certificates loaded from `NODE_EXTRA_CA_CERTS`. It's an empty array if - * `NODE_EXTRA_CA_CERTS` is not set. - * @since v22.15.0 - * @param type The type of CA certificates that will be returned. Valid values - * are `"default"`, `"system"`, `"bundled"` and `"extra"`. - * **Default:** `"default"`. - * @returns An array of PEM-encoded certificates. The array may contain duplicates - * if the same certificate is repeatedly stored in multiple sources. - */ - function getCACertificates(type?: "default" | "system" | "bundled" | "extra"): string[]; - /** - * Returns an array with the names of the supported TLS ciphers. The names are - * lower-case for historical reasons, but must be uppercased to be used in - * the `ciphers` option of `{@link createSecureContext}`. - * - * Not all supported ciphers are enabled by default. See - * [Modifying the default TLS cipher suite](https://nodejs.org/docs/latest-v22.x/api/tls.html#modifying-the-default-tls-cipher-suite). - * - * Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for - * TLSv1.2 and below. - * - * ```js - * console.log(tls.getCiphers()); // ['aes128-gcm-sha256', 'aes128-sha', ...] - * ``` - * @since v0.10.2 - */ - function getCiphers(): string[]; - /** - * Sets the default CA certificates used by Node.js TLS clients. If the provided - * certificates are parsed successfully, they will become the default CA - * certificate list returned by {@link getCACertificates} and used - * by subsequent TLS connections that don't specify their own CA certificates. - * The certificates will be deduplicated before being set as the default. - * - * This function only affects the current Node.js thread. Previous - * sessions cached by the HTTPS agent won't be affected by this change, so - * this method should be called before any unwanted cachable TLS connections are - * made. - * - * To use system CA certificates as the default: - * - * ```js - * import tls from 'node:tls'; - * tls.setDefaultCACertificates(tls.getCACertificates('system')); - * ``` - * - * This function completely replaces the default CA certificate list. To add additional - * certificates to the existing defaults, get the current certificates and append to them: - * - * ```js - * import tls from 'node:tls'; - * const currentCerts = tls.getCACertificates('default'); - * const additionalCerts = ['-----BEGIN CERTIFICATE-----\n...']; - * tls.setDefaultCACertificates([...currentCerts, ...additionalCerts]); - * ``` - * @since v22.19.0 - * @param certs An array of CA certificates in PEM format. - */ - function setDefaultCACertificates(certs: ReadonlyArray): void; - /** - * The default curve name to use for ECDH key agreement in a tls server. - * The default value is `'auto'`. See `{@link createSecureContext()}` for further - * information. - * @since v0.11.13 - */ - let DEFAULT_ECDH_CURVE: string; - /** - * The default value of the `maxVersion` option of `{@link createSecureContext()}`. - * It can be assigned any of the supported TLS protocol versions, - * `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. **Default:** `'TLSv1.3'`, unless - * changed using CLI options. Using `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using - * `--tls-max-v1.3` sets the default to `'TLSv1.3'`. If multiple of the options - * are provided, the highest maximum is used. - * @since v11.4.0 - */ - let DEFAULT_MAX_VERSION: SecureVersion; - /** - * The default value of the `minVersion` option of `{@link createSecureContext()}`. - * It can be assigned any of the supported TLS protocol versions, - * `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. **Default:** `'TLSv1.2'`, unless - * changed using CLI options. Using `--tls-min-v1.0` sets the default to - * `'TLSv1'`. Using `--tls-min-v1.1` sets the default to `'TLSv1.1'`. Using - * `--tls-min-v1.3` sets the default to `'TLSv1.3'`. If multiple of the options - * are provided, the lowest minimum is used. - * @since v11.4.0 - */ - let DEFAULT_MIN_VERSION: SecureVersion; - /** - * The default value of the `ciphers` option of `{@link createSecureContext()}`. - * It can be assigned any of the supported OpenSSL ciphers. - * Defaults to the content of `crypto.constants.defaultCoreCipherList`, unless - * changed using CLI options using `--tls-default-ciphers`. - * @since v19.8.0 - */ - let DEFAULT_CIPHERS: string; - /** - * An immutable array of strings representing the root certificates (in PEM format) - * from the bundled Mozilla CA store as supplied by the current Node.js version. - * - * The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store - * that is fixed at release time. It is identical on all supported platforms. - * @since v12.3.0 - */ - const rootCertificates: readonly string[]; -} -declare module "node:tls" { - export * from "tls"; -} diff --git a/node_modules/@types/node/trace_events.d.ts b/node_modules/@types/node/trace_events.d.ts deleted file mode 100644 index f334b0b..0000000 --- a/node_modules/@types/node/trace_events.d.ts +++ /dev/null @@ -1,197 +0,0 @@ -/** - * The `node:trace_events` module provides a mechanism to centralize tracing information - * generated by V8, Node.js core, and userspace code. - * - * Tracing can be enabled with the `--trace-event-categories` command-line flag - * or by using the `trace_events` module. The `--trace-event-categories` flag - * accepts a list of comma-separated category names. - * - * The available categories are: - * - * * `node`: An empty placeholder. - * * `node.async_hooks`: Enables capture of detailed [`async_hooks`](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html) trace data. - * The [`async_hooks`](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html) events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. - * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones. - * * `node.console`: Enables capture of `console.time()` and `console.count()` output. - * * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. - * * `node.threadpoolwork.async`: Enables capture of trace data for threadpool asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. - * * `node.dns.native`: Enables capture of trace data for DNS queries. - * * `node.net.native`: Enables capture of trace data for network. - * * `node.environment`: Enables capture of Node.js Environment milestones. - * * `node.fs.sync`: Enables capture of trace data for file system sync methods. - * * `node.fs_dir.sync`: Enables capture of trace data for file system sync directory methods. - * * `node.fs.async`: Enables capture of trace data for file system async methods. - * * `node.fs_dir.async`: Enables capture of trace data for file system async directory methods. - * * `node.perf`: Enables capture of [Performance API](https://nodejs.org/docs/latest-v22.x/api/perf_hooks.html) measurements. - * * `node.perf.usertiming`: Enables capture of only Performance API User Timing - * measures and marks. - * * `node.perf.timerify`: Enables capture of only Performance API timerify - * measurements. - * * `node.promises.rejections`: Enables capture of trace data tracking the number - * of unhandled Promise rejections and handled-after-rejections. - * * `node.vm.script`: Enables capture of trace data for the `node:vm` module's `runInNewContext()`, `runInContext()`, and `runInThisContext()` methods. - * * `v8`: The [V8](https://nodejs.org/docs/latest-v22.x/api/v8.html) events are GC, compiling, and execution related. - * * `node.http`: Enables capture of trace data for http request / response. - * - * By default the `node`, `node.async_hooks`, and `v8` categories are enabled. - * - * ```bash - * node --trace-event-categories v8,node,node.async_hooks server.js - * ``` - * - * Prior versions of Node.js required the use of the `--trace-events-enabled` flag to enable trace events. This requirement has been removed. However, the `--trace-events-enabled` flag _may_ still be - * used and will enable the `node`, `node.async_hooks`, and `v8` trace event categories by default. - * - * ```bash - * node --trace-events-enabled - * - * # is equivalent to - * - * node --trace-event-categories v8,node,node.async_hooks - * ``` - * - * Alternatively, trace events may be enabled using the `node:trace_events` module: - * - * ```js - * import trace_events from 'node:trace_events'; - * const tracing = trace_events.createTracing({ categories: ['node.perf'] }); - * tracing.enable(); // Enable trace event capture for the 'node.perf' category - * - * // do work - * - * tracing.disable(); // Disable trace event capture for the 'node.perf' category - * ``` - * - * Running Node.js with tracing enabled will produce log files that can be opened - * in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome. - * - * The logging file is by default called `node_trace.${rotation}.log`, where `${rotation}` is an incrementing log-rotation id. The filepath pattern can - * be specified with `--trace-event-file-pattern` that accepts a template - * string that supports `${rotation}` and `${pid}`: - * - * ```bash - * node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js - * ``` - * - * To guarantee that the log file is properly generated after signal events like `SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers - * in your code, such as: - * - * ```js - * process.on('SIGINT', function onSigint() { - * console.info('Received SIGINT.'); - * process.exit(130); // Or applicable exit code depending on OS and signal - * }); - * ``` - * - * The tracing system uses the same time source - * as the one used by `process.hrtime()`. - * However the trace-event timestamps are expressed in microseconds, - * unlike `process.hrtime()` which returns nanoseconds. - * - * The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html#class-worker) threads. - * @experimental - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/trace_events.js) - */ -declare module "trace_events" { - /** - * The `Tracing` object is used to enable or disable tracing for sets of - * categories. Instances are created using the - * `trace_events.createTracing()` method. - * - * When created, the `Tracing` object is disabled. Calling the - * `tracing.enable()` method adds the categories to the set of enabled trace - * event categories. Calling `tracing.disable()` will remove the categories - * from the set of enabled trace event categories. - */ - interface Tracing { - /** - * A comma-separated list of the trace event categories covered by this - * `Tracing` object. - * @since v10.0.0 - */ - readonly categories: string; - /** - * Disables this `Tracing` object. - * - * Only trace event categories _not_ covered by other enabled `Tracing` - * objects and _not_ specified by the `--trace-event-categories` flag - * will be disabled. - * - * ```js - * import trace_events from 'node:trace_events'; - * const t1 = trace_events.createTracing({ categories: ['node', 'v8'] }); - * const t2 = trace_events.createTracing({ categories: ['node.perf', 'node'] }); - * t1.enable(); - * t2.enable(); - * - * // Prints 'node,node.perf,v8' - * console.log(trace_events.getEnabledCategories()); - * - * t2.disable(); // Will only disable emission of the 'node.perf' category - * - * // Prints 'node,v8' - * console.log(trace_events.getEnabledCategories()); - * ``` - * @since v10.0.0 - */ - disable(): void; - /** - * Enables this `Tracing` object for the set of categories covered by - * the `Tracing` object. - * @since v10.0.0 - */ - enable(): void; - /** - * `true` only if the `Tracing` object has been enabled. - * @since v10.0.0 - */ - readonly enabled: boolean; - } - interface CreateTracingOptions { - /** - * An array of trace category names. Values included in the array are - * coerced to a string when possible. An error will be thrown if the - * value cannot be coerced. - */ - categories: string[]; - } - /** - * Creates and returns a `Tracing` object for the given set of `categories`. - * - * ```js - * import trace_events from 'node:trace_events'; - * const categories = ['node.perf', 'node.async_hooks']; - * const tracing = trace_events.createTracing({ categories }); - * tracing.enable(); - * // do stuff - * tracing.disable(); - * ``` - * @since v10.0.0 - */ - function createTracing(options: CreateTracingOptions): Tracing; - /** - * Returns a comma-separated list of all currently-enabled trace event - * categories. The current set of enabled trace event categories is determined - * by the _union_ of all currently-enabled `Tracing` objects and any categories - * enabled using the `--trace-event-categories` flag. - * - * Given the file `test.js` below, the command `node --trace-event-categories node.perf test.js` will print `'node.async_hooks,node.perf'` to the console. - * - * ```js - * import trace_events from 'node:trace_events'; - * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] }); - * const t2 = trace_events.createTracing({ categories: ['node.perf'] }); - * const t3 = trace_events.createTracing({ categories: ['v8'] }); - * - * t1.enable(); - * t2.enable(); - * - * console.log(trace_events.getEnabledCategories()); - * ``` - * @since v10.0.0 - */ - function getEnabledCategories(): string | undefined; -} -declare module "node:trace_events" { - export * from "trace_events"; -} diff --git a/node_modules/@types/node/ts5.6/buffer.buffer.d.ts b/node_modules/@types/node/ts5.6/buffer.buffer.d.ts deleted file mode 100644 index a5f67d7..0000000 --- a/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +++ /dev/null @@ -1,468 +0,0 @@ -declare module "buffer" { - global { - interface BufferConstructor { - // see ../buffer.d.ts for implementation shared with all TypeScript versions - - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. - */ - new(str: string, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). - */ - new(size: number): Buffer; - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - new(array: ArrayLike): Buffer; - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}/{SharedArrayBuffer}. - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. - */ - new(arrayBuffer: ArrayBufferLike): Buffer; - /** - * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. - * Array entries outside that range will be truncated to fit into it. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'. - * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); - * ``` - * - * If `array` is an `Array`-like object (that is, one with a `length` property of - * type `number`), it is treated as if it is an array, unless it is a `Buffer` or - * a `Uint8Array`. This means all other `TypedArray` variants get treated as an - * `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use - * `Buffer.copyBytesFrom()`. - * - * A `TypeError` will be thrown if `array` is not an `Array` or another type - * appropriate for `Buffer.from()` variants. - * - * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal - * `Buffer` pool like `Buffer.allocUnsafe()` does. - * @since v5.10.0 - */ - from(array: WithImplicitCoercion>): Buffer; - /** - * This creates a view of the `ArrayBuffer` without copying the underlying - * memory. For example, when passed a reference to the `.buffer` property of a - * `TypedArray` instance, the newly created `Buffer` will share the same - * allocated memory as the `TypedArray`'s underlying `ArrayBuffer`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const arr = new Uint16Array(2); - * - * arr[0] = 5000; - * arr[1] = 4000; - * - * // Shares memory with `arr`. - * const buf = Buffer.from(arr.buffer); - * - * console.log(buf); - * // Prints: - * - * // Changing the original Uint16Array changes the Buffer also. - * arr[1] = 6000; - * - * console.log(buf); - * // Prints: - * ``` - * - * The optional `byteOffset` and `length` arguments specify a memory range within - * the `arrayBuffer` that will be shared by the `Buffer`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const ab = new ArrayBuffer(10); - * const buf = Buffer.from(ab, 0, 2); - * - * console.log(buf.length); - * // Prints: 2 - * ``` - * - * A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer` or a - * `SharedArrayBuffer` or another type appropriate for `Buffer.from()` - * variants. - * - * It is important to remember that a backing `ArrayBuffer` can cover a range - * of memory that extends beyond the bounds of a `TypedArray` view. A new - * `Buffer` created using the `buffer` property of a `TypedArray` may extend - * beyond the range of the `TypedArray`: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements - * const arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements - * console.log(arrA.buffer === arrB.buffer); // true - * - * const buf = Buffer.from(arrB.buffer); - * console.log(buf); - * // Prints: - * ``` - * @since v5.10.0 - * @param arrayBuffer An `ArrayBuffer`, `SharedArrayBuffer`, for example the - * `.buffer` property of a `TypedArray`. - * @param byteOffset Index of first byte to expose. **Default:** `0`. - * @param length Number of bytes to expose. **Default:** - * `arrayBuffer.byteLength - byteOffset`. - */ - from( - arrayBuffer: WithImplicitCoercion, - byteOffset?: number, - length?: number, - ): Buffer; - /** - * Creates a new `Buffer` containing `string`. The `encoding` parameter identifies - * the character encoding to be used when converting `string` into bytes. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('this is a tést'); - * const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); - * - * console.log(buf1.toString()); - * // Prints: this is a tést - * console.log(buf2.toString()); - * // Prints: this is a tést - * console.log(buf1.toString('latin1')); - * // Prints: this is a tést - * ``` - * - * A `TypeError` will be thrown if `string` is not a string or another type - * appropriate for `Buffer.from()` variants. - * - * `Buffer.from(string)` may also use the internal `Buffer` pool like - * `Buffer.allocUnsafe()` does. - * @since v5.10.0 - * @param string A string to encode. - * @param encoding The encoding of `string`. **Default:** `'utf8'`. - */ - from(string: WithImplicitCoercion, encoding?: BufferEncoding): Buffer; - from(arrayOrString: WithImplicitCoercion | string>): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param values to create a new Buffer - */ - of(...items: number[]): Buffer; - /** - * Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together. - * - * If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned. - * - * If `totalLength` is not provided, it is calculated from the `Buffer` instances - * in `list` by adding their lengths. - * - * If `totalLength` is provided, it is coerced to an unsigned integer. If the - * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is - * truncated to `totalLength`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a single `Buffer` from a list of three `Buffer` instances. - * - * const buf1 = Buffer.alloc(10); - * const buf2 = Buffer.alloc(14); - * const buf3 = Buffer.alloc(18); - * const totalLength = buf1.length + buf2.length + buf3.length; - * - * console.log(totalLength); - * // Prints: 42 - * - * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength); - * - * console.log(bufA); - * // Prints: - * console.log(bufA.length); - * // Prints: 42 - * ``` - * - * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does. - * @since v0.7.11 - * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate. - * @param totalLength Total length of the `Buffer` instances in `list` when concatenated. - */ - concat(list: readonly Uint8Array[], totalLength?: number): Buffer; - /** - * Copies the underlying memory of `view` into a new `Buffer`. - * - * ```js - * const u16 = new Uint16Array([0, 0xffff]); - * const buf = Buffer.copyBytesFrom(u16, 1, 1); - * u16[1] = 0; - * console.log(buf.length); // 2 - * console.log(buf[0]); // 255 - * console.log(buf[1]); // 255 - * ``` - * @since v19.8.0 - * @param view The {TypedArray} to copy. - * @param [offset=0] The starting offset within `view`. - * @param [length=view.length - offset] The number of elements from `view` to copy. - */ - copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer; - /** - * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(5); - * - * console.log(buf); - * // Prints: - * ``` - * - * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. - * - * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(5, 'a'); - * - * console.log(buf); - * // Prints: - * ``` - * - * If both `fill` and `encoding` are specified, the allocated `Buffer` will be - * initialized by calling `buf.fill(fill, encoding)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); - * - * console.log(buf); - * // Prints: - * ``` - * - * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance - * contents will never contain sensitive data from previous allocations, including - * data that might not have been allocated for `Buffer`s. - * - * A `TypeError` will be thrown if `size` is not a number. - * @since v5.10.0 - * @param size The desired length of the new `Buffer`. - * @param [fill=0] A value to pre-fill the new `Buffer` with. - * @param [encoding='utf8'] If `fill` is a string, this is its encoding. - */ - alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. - * - * The underlying memory for `Buffer` instances created in this way is _not_ - * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(10); - * - * console.log(buf); - * // Prints (contents may vary): - * - * buf.fill(0); - * - * console.log(buf); - * // Prints: - * ``` - * - * A `TypeError` will be thrown if `size` is not a number. - * - * The `Buffer` module pre-allocates an internal `Buffer` instance of - * size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`, - * and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two). - * - * Use of this pre-allocated internal memory pool is a key difference between - * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. - * Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less - * than or equal to half `Buffer.poolSize`. The - * difference is subtle but can be important when an application requires the - * additional performance that `Buffer.allocUnsafe()` provides. - * @since v5.10.0 - * @param size The desired length of the new `Buffer`. - */ - allocUnsafe(size: number): Buffer; - /** - * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if - * `size` is 0. - * - * The underlying memory for `Buffer` instances created in this way is _not_ - * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize - * such `Buffer` instances with zeroes. - * - * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, - * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This - * allows applications to avoid the garbage collection overhead of creating many - * individually allocated `Buffer` instances. This approach improves both - * performance and memory usage by eliminating the need to track and clean up as - * many individual `ArrayBuffer` objects. - * - * However, in the case where a developer may need to retain a small chunk of - * memory from a pool for an indeterminate amount of time, it may be appropriate - * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and - * then copying out the relevant bits. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Need to keep around a few small chunks of memory. - * const store = []; - * - * socket.on('readable', () => { - * let data; - * while (null !== (data = readable.read())) { - * // Allocate for retained data. - * const sb = Buffer.allocUnsafeSlow(10); - * - * // Copy the data into the new allocation. - * data.copy(sb, 0, 0, 10); - * - * store.push(sb); - * } - * }); - * ``` - * - * A `TypeError` will be thrown if `size` is not a number. - * @since v5.12.0 - * @param size The desired length of the new `Buffer`. - */ - allocUnsafeSlow(size: number): Buffer; - } - interface Buffer extends Uint8Array { - // see ../buffer.d.ts for implementation shared with all TypeScript versions - - /** - * Returns a new `Buffer` that references the same memory as the original, but - * offset and cropped by the `start` and `end` indices. - * - * This method is not compatible with the `Uint8Array.prototype.slice()`, - * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * const copiedBuf = Uint8Array.prototype.slice.call(buf); - * copiedBuf[0]++; - * console.log(copiedBuf.toString()); - * // Prints: cuffer - * - * console.log(buf.toString()); - * // Prints: buffer - * - * // With buf.slice(), the original buffer is modified. - * const notReallyCopiedBuf = buf.slice(); - * notReallyCopiedBuf[0]++; - * console.log(notReallyCopiedBuf.toString()); - * // Prints: cuffer - * console.log(buf.toString()); - * // Also prints: cuffer (!) - * ``` - * @since v0.3.0 - * @deprecated Use `subarray` instead. - * @param [start=0] Where the new `Buffer` will start. - * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). - */ - slice(start?: number, end?: number): Buffer; - /** - * Returns a new `Buffer` that references the same memory as the original, but - * offset and cropped by the `start` and `end` indices. - * - * Specifying `end` greater than `buf.length` will return the same result as - * that of `end` equal to `buf.length`. - * - * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). - * - * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte - * // from the original `Buffer`. - * - * const buf1 = Buffer.allocUnsafe(26); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf1[i] = i + 97; - * } - * - * const buf2 = buf1.subarray(0, 3); - * - * console.log(buf2.toString('ascii', 0, buf2.length)); - * // Prints: abc - * - * buf1[0] = 33; - * - * console.log(buf2.toString('ascii', 0, buf2.length)); - * // Prints: !bc - * ``` - * - * Specifying negative indexes causes the slice to be generated relative to the - * end of `buf` rather than the beginning. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * console.log(buf.subarray(-6, -1).toString()); - * // Prints: buffe - * // (Equivalent to buf.subarray(0, 5).) - * - * console.log(buf.subarray(-6, -2).toString()); - * // Prints: buff - * // (Equivalent to buf.subarray(0, 4).) - * - * console.log(buf.subarray(-5, -2).toString()); - * // Prints: uff - * // (Equivalent to buf.subarray(1, 4).) - * ``` - * @since v3.0.0 - * @param [start=0] Where the new `Buffer` will start. - * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). - */ - subarray(start?: number, end?: number): Buffer; - } - /** - * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports - * TypeScript versions earlier than 5.7. - */ - type NonSharedBuffer = Buffer; - /** - * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports - * TypeScript versions earlier than 5.7. - */ - type AllowSharedBuffer = Buffer; - } - /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ - var SlowBuffer: { - /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ - new(size: number): Buffer; - prototype: Buffer; - }; -} diff --git a/node_modules/@types/node/ts5.6/globals.typedarray.d.ts b/node_modules/@types/node/ts5.6/globals.typedarray.d.ts deleted file mode 100644 index f1c444d..0000000 --- a/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -export {}; // Make this a module - -declare global { - namespace NodeJS { - type TypedArray = - | Uint8Array - | Uint8ClampedArray - | Uint16Array - | Uint32Array - | Int8Array - | Int16Array - | Int32Array - | BigUint64Array - | BigInt64Array - | Float32Array - | Float64Array; - type ArrayBufferView = TypedArray | DataView; - - type NonSharedUint8Array = Uint8Array; - type NonSharedUint8ClampedArray = Uint8ClampedArray; - type NonSharedUint16Array = Uint16Array; - type NonSharedUint32Array = Uint32Array; - type NonSharedInt8Array = Int8Array; - type NonSharedInt16Array = Int16Array; - type NonSharedInt32Array = Int32Array; - type NonSharedBigUint64Array = BigUint64Array; - type NonSharedBigInt64Array = BigInt64Array; - type NonSharedFloat32Array = Float32Array; - type NonSharedFloat64Array = Float64Array; - type NonSharedDataView = DataView; - type NonSharedTypedArray = TypedArray; - type NonSharedArrayBufferView = ArrayBufferView; - } -} diff --git a/node_modules/@types/node/ts5.6/index.d.ts b/node_modules/@types/node/ts5.6/index.d.ts deleted file mode 100644 index 5a5af42..0000000 --- a/node_modules/@types/node/ts5.6/index.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -/** - * License for programmatically and manually incorporated - * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc - * - * Copyright Node.js contributors. All rights reserved. - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -// NOTE: These definitions support Node.js and TypeScript 4.9 through 5.6. - -// Reference required TypeScript libs: -/// - -// TypeScript backwards-compatibility definitions: -/// - -// Definitions specific to TypeScript 4.9 through 5.6: -/// -/// - -// Definitions for Node.js modules that are not specific to any version of TypeScript: -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// diff --git a/node_modules/@types/node/tty.d.ts b/node_modules/@types/node/tty.d.ts deleted file mode 100644 index f567946..0000000 --- a/node_modules/@types/node/tty.d.ts +++ /dev/null @@ -1,208 +0,0 @@ -/** - * The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes. In most cases, it will not be necessary or possible to use this module - * directly. However, it can be accessed using: - * - * ```js - * import tty from 'node:tty'; - * ``` - * - * When Node.js detects that it is being run with a text terminal ("TTY") - * attached, `process.stdin` will, by default, be initialized as an instance of `tty.ReadStream` and both `process.stdout` and `process.stderr` will, by - * default, be instances of `tty.WriteStream`. The preferred method of determining - * whether Node.js is being run within a TTY context is to check that the value of - * the `process.stdout.isTTY` property is `true`: - * - * ```console - * $ node -p -e "Boolean(process.stdout.isTTY)" - * true - * $ node -p -e "Boolean(process.stdout.isTTY)" | cat - * false - * ``` - * - * In most cases, there should be little to no reason for an application to - * manually create instances of the `tty.ReadStream` and `tty.WriteStream` classes. - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/tty.js) - */ -declare module "tty" { - import * as net from "node:net"; - /** - * The `tty.isatty()` method returns `true` if the given `fd` is associated with - * a TTY and `false` if it is not, including whenever `fd` is not a non-negative - * integer. - * @since v0.5.8 - * @param fd A numeric file descriptor - */ - function isatty(fd: number): boolean; - /** - * Represents the readable side of a TTY. In normal circumstances `process.stdin` will be the only `tty.ReadStream` instance in a Node.js - * process and there should be no reason to create additional instances. - * @since v0.5.8 - */ - class ReadStream extends net.Socket { - constructor(fd: number, options?: net.SocketConstructorOpts); - /** - * A `boolean` that is `true` if the TTY is currently configured to operate as a - * raw device. - * - * This flag is always `false` when a process starts, even if the terminal is - * operating in raw mode. Its value will change with subsequent calls to `setRawMode`. - * @since v0.7.7 - */ - isRaw: boolean; - /** - * Allows configuration of `tty.ReadStream` so that it operates as a raw device. - * - * When in raw mode, input is always available character-by-character, not - * including modifiers. Additionally, all special processing of characters by the - * terminal is disabled, including echoing input - * characters. Ctrl+C will no longer cause a `SIGINT` when - * in this mode. - * @since v0.7.7 - * @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw` - * property will be set to the resulting mode. - * @return The read stream instance. - */ - setRawMode(mode: boolean): this; - /** - * A `boolean` that is always `true` for `tty.ReadStream` instances. - * @since v0.5.8 - */ - isTTY: boolean; - } - /** - * -1 - to the left from cursor - * 0 - the entire line - * 1 - to the right from cursor - */ - type Direction = -1 | 0 | 1; - /** - * Represents the writable side of a TTY. In normal circumstances, `process.stdout` and `process.stderr` will be the only`tty.WriteStream` instances created for a Node.js process and there - * should be no reason to create additional instances. - * @since v0.5.8 - */ - class WriteStream extends net.Socket { - constructor(fd: number); - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "resize", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "resize"): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "resize", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "resize", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "resize", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "resize", listener: () => void): this; - /** - * `writeStream.clearLine()` clears the current line of this `WriteStream` in a - * direction identified by `dir`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - clearLine(dir: Direction, callback?: () => void): boolean; - /** - * `writeStream.clearScreenDown()` clears this `WriteStream` from the current - * cursor down. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - clearScreenDown(callback?: () => void): boolean; - /** - * `writeStream.cursorTo()` moves this `WriteStream`'s cursor to the specified - * position. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - cursorTo(x: number, y?: number, callback?: () => void): boolean; - cursorTo(x: number, callback: () => void): boolean; - /** - * `writeStream.moveCursor()` moves this `WriteStream`'s cursor _relative_ to its - * current position. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - moveCursor(dx: number, dy: number, callback?: () => void): boolean; - /** - * Returns: - * - * * `1` for 2, - * * `4` for 16, - * * `8` for 256, - * * `24` for 16,777,216 colors supported. - * - * Use this to determine what colors the terminal supports. Due to the nature of - * colors in terminals it is possible to either have false positives or false - * negatives. It depends on process information and the environment variables that - * may lie about what terminal is used. - * It is possible to pass in an `env` object to simulate the usage of a specific - * terminal. This can be useful to check how specific environment settings behave. - * - * To enforce a specific color support, use one of the below environment settings. - * - * * 2 colors: `FORCE_COLOR = 0` (Disables colors) - * * 16 colors: `FORCE_COLOR = 1` - * * 256 colors: `FORCE_COLOR = 2` - * * 16,777,216 colors: `FORCE_COLOR = 3` - * - * Disabling color support is also possible by using the `NO_COLOR` and `NODE_DISABLE_COLORS` environment variables. - * @since v9.9.0 - * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal. - */ - getColorDepth(env?: object): number; - /** - * Returns `true` if the `writeStream` supports at least as many colors as provided - * in `count`. Minimum support is 2 (black and white). - * - * This has the same false positives and negatives as described in `writeStream.getColorDepth()`. - * - * ```js - * process.stdout.hasColors(); - * // Returns true or false depending on if `stdout` supports at least 16 colors. - * process.stdout.hasColors(256); - * // Returns true or false depending on if `stdout` supports at least 256 colors. - * process.stdout.hasColors({ TMUX: '1' }); - * // Returns true. - * process.stdout.hasColors(2 ** 24, { TMUX: '1' }); - * // Returns false (the environment setting pretends to support 2 ** 8 colors). - * ``` - * @since v11.13.0, v10.16.0 - * @param [count=16] The number of colors that are requested (minimum 2). - * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal. - */ - hasColors(count?: number): boolean; - hasColors(env?: object): boolean; - hasColors(count: number, env?: object): boolean; - /** - * `writeStream.getWindowSize()` returns the size of the TTY - * corresponding to this `WriteStream`. The array is of the type `[numColumns, numRows]` where `numColumns` and `numRows` represent the number - * of columns and rows in the corresponding TTY. - * @since v0.7.7 - */ - getWindowSize(): [number, number]; - /** - * A `number` specifying the number of columns the TTY currently has. This property - * is updated whenever the `'resize'` event is emitted. - * @since v0.7.7 - */ - columns: number; - /** - * A `number` specifying the number of rows the TTY currently has. This property - * is updated whenever the `'resize'` event is emitted. - * @since v0.7.7 - */ - rows: number; - /** - * A `boolean` that is always `true`. - * @since v0.5.8 - */ - isTTY: boolean; - } -} -declare module "node:tty" { - export * from "tty"; -} diff --git a/node_modules/@types/node/url.d.ts b/node_modules/@types/node/url.d.ts deleted file mode 100644 index 6a0effc..0000000 --- a/node_modules/@types/node/url.d.ts +++ /dev/null @@ -1,984 +0,0 @@ -/** - * The `node:url` module provides utilities for URL resolution and parsing. It can - * be accessed using: - * - * ```js - * import url from 'node:url'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/url.js) - */ -declare module "url" { - import { Blob as NodeBlob, NonSharedBuffer } from "node:buffer"; - import { ClientRequestArgs } from "node:http"; - import { ParsedUrlQuery, ParsedUrlQueryInput } from "node:querystring"; - // Input to `url.format` - interface UrlObject { - auth?: string | null | undefined; - hash?: string | null | undefined; - host?: string | null | undefined; - hostname?: string | null | undefined; - href?: string | null | undefined; - pathname?: string | null | undefined; - protocol?: string | null | undefined; - search?: string | null | undefined; - slashes?: boolean | null | undefined; - port?: string | number | null | undefined; - query?: string | null | ParsedUrlQueryInput | undefined; - } - // Output of `url.parse` - interface Url { - auth: string | null; - hash: string | null; - host: string | null; - hostname: string | null; - href: string; - path: string | null; - pathname: string | null; - protocol: string | null; - search: string | null; - slashes: boolean | null; - port: string | null; - query: string | null | ParsedUrlQuery; - } - interface UrlWithParsedQuery extends Url { - query: ParsedUrlQuery; - } - interface UrlWithStringQuery extends Url { - query: string | null; - } - interface FileUrlToPathOptions { - /** - * `true` if the `path` should be return as a windows filepath, `false` for posix, and `undefined` for the system default. - * @default undefined - * @since v22.1.0 - */ - windows?: boolean | undefined; - } - interface PathToFileUrlOptions { - /** - * `true` if the `path` should be return as a windows filepath, `false` for posix, and `undefined` for the system default. - * @default undefined - * @since v22.1.0 - */ - windows?: boolean | undefined; - } - /** - * The `url.parse()` method takes a URL string, parses it, and returns a URL - * object. - * - * A `TypeError` is thrown if `urlString` is not a string. - * - * A `URIError` is thrown if the `auth` property is present but cannot be decoded. - * - * `url.parse()` uses a lenient, non-standard algorithm for parsing URL - * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted - * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead. - * @since v0.1.25 - * @deprecated Use the WHATWG URL API instead. - * @param urlString The URL string to parse. - * @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property - * on the returned URL object will be an unparsed, undecoded string. - * @param [slashesDenoteHost=false] If `true`, the first token after the literal string `//` and preceding the next `/` will be interpreted as the `host`. For instance, given `//foo/bar`, the - * result would be `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`. - */ - function parse(urlString: string): UrlWithStringQuery; - function parse( - urlString: string, - parseQueryString: false | undefined, - slashesDenoteHost?: boolean, - ): UrlWithStringQuery; - function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; - function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url; - /** - * The `url.format()` method returns a formatted URL string derived from `urlObject`. - * - * ```js - * import url from 'node:url'; - * url.format({ - * protocol: 'https', - * hostname: 'example.com', - * pathname: '/some/path', - * query: { - * page: 1, - * format: 'json', - * }, - * }); - * - * // => 'https://example.com/some/path?page=1&format=json' - * ``` - * - * If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`. - * - * The formatting process operates as follows: - * - * * A new empty string `result` is created. - * * If `urlObject.protocol` is a string, it is appended as-is to `result`. - * * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown. - * * For all string values of `urlObject.protocol` that _do not end_ with an ASCII - * colon (`:`) character, the literal string `:` will be appended to `result`. - * * If either of the following conditions is true, then the literal string `//` will be appended to `result`: - * * `urlObject.slashes` property is true; - * * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`; - * * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string - * and appended to `result` followed by the literal string `@`. - * * If the `urlObject.host` property is `undefined` then: - * * If the `urlObject.hostname` is a string, it is appended to `result`. - * * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string, - * an `Error` is thrown. - * * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`: - * * The literal string `:` is appended to `result`, and - * * The value of `urlObject.port` is coerced to a string and appended to `result`. - * * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`. - * * If the `urlObject.pathname` property is a string that is not an empty string: - * * If the `urlObject.pathname` _does not start_ with an ASCII forward slash - * (`/`), then the literal string `'/'` is appended to `result`. - * * The value of `urlObject.pathname` is appended to `result`. - * * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown. - * * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result` followed by the output of calling the - * `querystring` module's `stringify()` method passing the value of `urlObject.query`. - * * Otherwise, if `urlObject.search` is a string: - * * If the value of `urlObject.search` _does not start_ with the ASCII question - * mark (`?`) character, the literal string `?` is appended to `result`. - * * The value of `urlObject.search` is appended to `result`. - * * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown. - * * If the `urlObject.hash` property is a string: - * * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`) - * character, the literal string `#` is appended to `result`. - * * The value of `urlObject.hash` is appended to `result`. - * * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a - * string, an `Error` is thrown. - * * `result` is returned. - * @since v0.1.25 - * @legacy Use the WHATWG URL API instead. - * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`. - */ - function format(urlObject: URL, options?: URLFormatOptions): string; - /** - * The `url.format()` method returns a formatted URL string derived from `urlObject`. - * - * ```js - * import url from 'node:url'; - * url.format({ - * protocol: 'https', - * hostname: 'example.com', - * pathname: '/some/path', - * query: { - * page: 1, - * format: 'json', - * }, - * }); - * - * // => 'https://example.com/some/path?page=1&format=json' - * ``` - * - * If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`. - * - * The formatting process operates as follows: - * - * * A new empty string `result` is created. - * * If `urlObject.protocol` is a string, it is appended as-is to `result`. - * * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown. - * * For all string values of `urlObject.protocol` that _do not end_ with an ASCII - * colon (`:`) character, the literal string `:` will be appended to `result`. - * * If either of the following conditions is true, then the literal string `//` will be appended to `result`: - * * `urlObject.slashes` property is true; - * * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`; - * * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string - * and appended to `result` followed by the literal string `@`. - * * If the `urlObject.host` property is `undefined` then: - * * If the `urlObject.hostname` is a string, it is appended to `result`. - * * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string, - * an `Error` is thrown. - * * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`: - * * The literal string `:` is appended to `result`, and - * * The value of `urlObject.port` is coerced to a string and appended to `result`. - * * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`. - * * If the `urlObject.pathname` property is a string that is not an empty string: - * * If the `urlObject.pathname` _does not start_ with an ASCII forward slash - * (`/`), then the literal string `'/'` is appended to `result`. - * * The value of `urlObject.pathname` is appended to `result`. - * * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown. - * * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result` followed by the output of calling the - * `querystring` module's `stringify()` method passing the value of `urlObject.query`. - * * Otherwise, if `urlObject.search` is a string: - * * If the value of `urlObject.search` _does not start_ with the ASCII question - * mark (`?`) character, the literal string `?` is appended to `result`. - * * The value of `urlObject.search` is appended to `result`. - * * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown. - * * If the `urlObject.hash` property is a string: - * * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`) - * character, the literal string `#` is appended to `result`. - * * The value of `urlObject.hash` is appended to `result`. - * * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a - * string, an `Error` is thrown. - * * `result` is returned. - * @since v0.1.25 - * @legacy Use the WHATWG URL API instead. - * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`. - */ - function format(urlObject: UrlObject | string): string; - /** - * The `url.resolve()` method resolves a target URL relative to a base URL in a - * manner similar to that of a web browser resolving an anchor tag. - * - * ```js - * import url from 'node:url'; - * url.resolve('/one/two/three', 'four'); // '/one/two/four' - * url.resolve('http://example.com/', '/one'); // 'http://example.com/one' - * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two' - * ``` - * - * To achieve the same result using the WHATWG URL API: - * - * ```js - * function resolve(from, to) { - * const resolvedUrl = new URL(to, new URL(from, 'resolve://')); - * if (resolvedUrl.protocol === 'resolve:') { - * // `from` is a relative URL. - * const { pathname, search, hash } = resolvedUrl; - * return pathname + search + hash; - * } - * return resolvedUrl.toString(); - * } - * - * resolve('/one/two/three', 'four'); // '/one/two/four' - * resolve('http://example.com/', '/one'); // 'http://example.com/one' - * resolve('http://example.com/one', '/two'); // 'http://example.com/two' - * ``` - * @since v0.1.25 - * @legacy Use the WHATWG URL API instead. - * @param from The base URL to use if `to` is a relative URL. - * @param to The target URL to resolve. - */ - function resolve(from: string, to: string): string; - /** - * Returns the [Punycode](https://tools.ietf.org/html/rfc5891#section-4.4) ASCII serialization of the `domain`. If `domain` is an - * invalid domain, the empty string is returned. - * - * It performs the inverse operation to {@link domainToUnicode}. - * - * ```js - * import url from 'node:url'; - * - * console.log(url.domainToASCII('español.com')); - * // Prints xn--espaol-zwa.com - * console.log(url.domainToASCII('中文.com')); - * // Prints xn--fiq228c.com - * console.log(url.domainToASCII('xn--iñvalid.com')); - * // Prints an empty string - * ``` - * @since v7.4.0, v6.13.0 - */ - function domainToASCII(domain: string): string; - /** - * Returns the Unicode serialization of the `domain`. If `domain` is an invalid - * domain, the empty string is returned. - * - * It performs the inverse operation to {@link domainToASCII}. - * - * ```js - * import url from 'node:url'; - * - * console.log(url.domainToUnicode('xn--espaol-zwa.com')); - * // Prints español.com - * console.log(url.domainToUnicode('xn--fiq228c.com')); - * // Prints 中文.com - * console.log(url.domainToUnicode('xn--iñvalid.com')); - * // Prints an empty string - * ``` - * @since v7.4.0, v6.13.0 - */ - function domainToUnicode(domain: string): string; - /** - * This function ensures the correct decodings of percent-encoded characters as - * well as ensuring a cross-platform valid absolute path string. - * - * ```js - * import { fileURLToPath } from 'node:url'; - * - * const __filename = fileURLToPath(import.meta.url); - * - * new URL('file:///C:/path/').pathname; // Incorrect: /C:/path/ - * fileURLToPath('file:///C:/path/'); // Correct: C:\path\ (Windows) - * - * new URL('file://nas/foo.txt').pathname; // Incorrect: /foo.txt - * fileURLToPath('file://nas/foo.txt'); // Correct: \\nas\foo.txt (Windows) - * - * new URL('file:///你好.txt').pathname; // Incorrect: /%E4%BD%A0%E5%A5%BD.txt - * fileURLToPath('file:///你好.txt'); // Correct: /你好.txt (POSIX) - * - * new URL('file:///hello world').pathname; // Incorrect: /hello%20world - * fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX) - * ``` - * @since v10.12.0 - * @param url The file URL string or URL object to convert to a path. - * @return The fully-resolved platform-specific Node.js file path. - */ - function fileURLToPath(url: string | URL, options?: FileUrlToPathOptions): string; - /** - * Like `url.fileURLToPath(...)` except that instead of returning a string - * representation of the path, a `Buffer` is returned. This conversion is - * helpful when the input URL contains percent-encoded segments that are - * not valid UTF-8 / Unicode sequences. - * @since v22.18.0 - * @param url The file URL string or URL object to convert to a path. - * @returns The fully-resolved platform-specific Node.js file path - * as a `Buffer`. - */ - function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): NonSharedBuffer; - /** - * This function ensures that `path` is resolved absolutely, and that the URL - * control characters are correctly encoded when converting into a File URL. - * - * ```js - * import { pathToFileURL } from 'node:url'; - * - * new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1 - * pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX) - * - * new URL('/some/path%.c', 'file:'); // Incorrect: file:///some/path%.c - * pathToFileURL('/some/path%.c'); // Correct: file:///some/path%25.c (POSIX) - * ``` - * @since v10.12.0 - * @param path The path to convert to a File URL. - * @return The file URL object. - */ - function pathToFileURL(path: string, options?: PathToFileUrlOptions): URL; - /** - * This utility function converts a URL object into an ordinary options object as - * expected by the `http.request()` and `https.request()` APIs. - * - * ```js - * import { urlToHttpOptions } from 'node:url'; - * const myURL = new URL('https://a:b@測試?abc#foo'); - * - * console.log(urlToHttpOptions(myURL)); - * /* - * { - * protocol: 'https:', - * hostname: 'xn--g6w251d', - * hash: '#foo', - * search: '?abc', - * pathname: '/', - * path: '/?abc', - * href: 'https://a:b@xn--g6w251d/?abc#foo', - * auth: 'a:b' - * } - * - * ``` - * @since v15.7.0, v14.18.0 - * @param url The `WHATWG URL` object to convert to an options object. - * @return Options object - */ - function urlToHttpOptions(url: URL): ClientRequestArgs; - interface URLFormatOptions { - /** - * `true` if the serialized URL string should include the username and password, `false` otherwise. - * @default true - */ - auth?: boolean | undefined; - /** - * `true` if the serialized URL string should include the fragment, `false` otherwise. - * @default true - */ - fragment?: boolean | undefined; - /** - * `true` if the serialized URL string should include the search query, `false` otherwise. - * @default true - */ - search?: boolean | undefined; - /** - * `true` if Unicode characters appearing in the host component of the URL string should be encoded directly as opposed to - * being Punycode encoded. - * @default false - */ - unicode?: boolean | undefined; - } - /** - * Browser-compatible `URL` class, implemented by following the WHATWG URL - * Standard. [Examples of parsed URLs](https://url.spec.whatwg.org/#example-url-parsing) may be found in the Standard itself. - * The `URL` class is also available on the global object. - * - * In accordance with browser conventions, all properties of `URL` objects - * are implemented as getters and setters on the class prototype, rather than as - * data properties on the object itself. Thus, unlike `legacy urlObject`s, - * using the `delete` keyword on any properties of `URL` objects (e.g. `delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still - * return `true`. - * @since v7.0.0, v6.13.0 - */ - class URL { - /** - * Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later. - * - * ```js - * import { - * Blob, - * resolveObjectURL, - * } from 'node:buffer'; - * - * const blob = new Blob(['hello']); - * const id = URL.createObjectURL(blob); - * - * // later... - * - * const otherBlob = resolveObjectURL(id); - * console.log(otherBlob.size); - * ``` - * - * The data stored by the registered `Blob` will be retained in memory until `URL.revokeObjectURL()` is called to remove it. - * - * `Blob` objects are registered within the current thread. If using Worker - * Threads, `Blob` objects registered within one Worker will not be available - * to other workers or the main thread. - * @since v16.7.0 - */ - static createObjectURL(blob: NodeBlob): string; - /** - * Removes the stored `Blob` identified by the given ID. Attempting to revoke a - * ID that isn't registered will silently fail. - * @since v16.7.0 - * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. - */ - static revokeObjectURL(id: string): void; - /** - * Checks if an `input` relative to the `base` can be parsed to a `URL`. - * - * ```js - * const isValid = URL.canParse('/foo', 'https://example.org/'); // true - * - * const isNotValid = URL.canParse('/foo'); // false - * ``` - * @since v19.9.0 - * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is - * `converted to a string` first. - * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first. - */ - static canParse(input: string, base?: string): boolean; - /** - * Parses a string as a URL. If `base` is provided, it will be used as the base - * URL for the purpose of resolving non-absolute `input` URLs. Returns `null` - * if the parameters can't be resolved to a valid URL. - * @since v22.1.0 - * @param input The absolute or relative input URL to parse. If `input` - * is relative, then `base` is required. If `input` is absolute, the `base` - * is ignored. If `input` is not a string, it is [converted to a string](https://tc39.es/ecma262/#sec-tostring) first. - * @param base The base URL to resolve against if the `input` is not - * absolute. If `base` is not a string, it is [converted to a string](https://tc39.es/ecma262/#sec-tostring) first. - */ - static parse(input: string, base?: string): URL | null; - constructor(input: string | { toString: () => string }, base?: string | URL); - /** - * Gets and sets the fragment portion of the URL. - * - * ```js - * const myURL = new URL('https://example.org/foo#bar'); - * console.log(myURL.hash); - * // Prints #bar - * - * myURL.hash = 'baz'; - * console.log(myURL.href); - * // Prints https://example.org/foo#baz - * ``` - * - * Invalid URL characters included in the value assigned to the `hash` property - * are `percent-encoded`. The selection of which characters to - * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. - */ - hash: string; - /** - * Gets and sets the host portion of the URL. - * - * ```js - * const myURL = new URL('https://example.org:81/foo'); - * console.log(myURL.host); - * // Prints example.org:81 - * - * myURL.host = 'example.com:82'; - * console.log(myURL.href); - * // Prints https://example.com:82/foo - * ``` - * - * Invalid host values assigned to the `host` property are ignored. - */ - host: string; - /** - * Gets and sets the host name portion of the URL. The key difference between`url.host` and `url.hostname` is that `url.hostname` does _not_ include the - * port. - * - * ```js - * const myURL = new URL('https://example.org:81/foo'); - * console.log(myURL.hostname); - * // Prints example.org - * - * // Setting the hostname does not change the port - * myURL.hostname = 'example.com'; - * console.log(myURL.href); - * // Prints https://example.com:81/foo - * - * // Use myURL.host to change the hostname and port - * myURL.host = 'example.org:82'; - * console.log(myURL.href); - * // Prints https://example.org:82/foo - * ``` - * - * Invalid host name values assigned to the `hostname` property are ignored. - */ - hostname: string; - /** - * Gets and sets the serialized URL. - * - * ```js - * const myURL = new URL('https://example.org/foo'); - * console.log(myURL.href); - * // Prints https://example.org/foo - * - * myURL.href = 'https://example.com/bar'; - * console.log(myURL.href); - * // Prints https://example.com/bar - * ``` - * - * Getting the value of the `href` property is equivalent to calling {@link toString}. - * - * Setting the value of this property to a new value is equivalent to creating a - * new `URL` object using `new URL(value)`. Each of the `URL` object's properties will be modified. - * - * If the value assigned to the `href` property is not a valid URL, a `TypeError` will be thrown. - */ - href: string; - /** - * Gets the read-only serialization of the URL's origin. - * - * ```js - * const myURL = new URL('https://example.org/foo/bar?baz'); - * console.log(myURL.origin); - * // Prints https://example.org - * ``` - * - * ```js - * const idnURL = new URL('https://測試'); - * console.log(idnURL.origin); - * // Prints https://xn--g6w251d - * - * console.log(idnURL.hostname); - * // Prints xn--g6w251d - * ``` - */ - readonly origin: string; - /** - * Gets and sets the password portion of the URL. - * - * ```js - * const myURL = new URL('https://abc:xyz@example.com'); - * console.log(myURL.password); - * // Prints xyz - * - * myURL.password = '123'; - * console.log(myURL.href); - * // Prints https://abc:123@example.com/ - * ``` - * - * Invalid URL characters included in the value assigned to the `password` property - * are `percent-encoded`. The selection of which characters to - * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. - */ - password: string; - /** - * Gets and sets the path portion of the URL. - * - * ```js - * const myURL = new URL('https://example.org/abc/xyz?123'); - * console.log(myURL.pathname); - * // Prints /abc/xyz - * - * myURL.pathname = '/abcdef'; - * console.log(myURL.href); - * // Prints https://example.org/abcdef?123 - * ``` - * - * Invalid URL characters included in the value assigned to the `pathname` property are `percent-encoded`. The selection of which characters - * to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. - */ - pathname: string; - /** - * Gets and sets the port portion of the URL. - * - * The port value may be a number or a string containing a number in the range `0` to `65535` (inclusive). Setting the value to the default port of the `URL` objects given `protocol` will - * result in the `port` value becoming - * the empty string (`''`). - * - * The port value can be an empty string in which case the port depends on - * the protocol/scheme: - * - * - * - * Upon assigning a value to the port, the value will first be converted to a - * string using `.toString()`. - * - * If that string is invalid but it begins with a number, the leading number is - * assigned to `port`. - * If the number lies outside the range denoted above, it is ignored. - * - * ```js - * const myURL = new URL('https://example.org:8888'); - * console.log(myURL.port); - * // Prints 8888 - * - * // Default ports are automatically transformed to the empty string - * // (HTTPS protocol's default port is 443) - * myURL.port = '443'; - * console.log(myURL.port); - * // Prints the empty string - * console.log(myURL.href); - * // Prints https://example.org/ - * - * myURL.port = 1234; - * console.log(myURL.port); - * // Prints 1234 - * console.log(myURL.href); - * // Prints https://example.org:1234/ - * - * // Completely invalid port strings are ignored - * myURL.port = 'abcd'; - * console.log(myURL.port); - * // Prints 1234 - * - * // Leading numbers are treated as a port number - * myURL.port = '5678abcd'; - * console.log(myURL.port); - * // Prints 5678 - * - * // Non-integers are truncated - * myURL.port = 1234.5678; - * console.log(myURL.port); - * // Prints 1234 - * - * // Out-of-range numbers which are not represented in scientific notation - * // will be ignored. - * myURL.port = 1e10; // 10000000000, will be range-checked as described below - * console.log(myURL.port); - * // Prints 1234 - * ``` - * - * Numbers which contain a decimal point, - * such as floating-point numbers or numbers in scientific notation, - * are not an exception to this rule. - * Leading numbers up to the decimal point will be set as the URL's port, - * assuming they are valid: - * - * ```js - * myURL.port = 4.567e21; - * console.log(myURL.port); - * // Prints 4 (because it is the leading number in the string '4.567e21') - * ``` - */ - port: string; - /** - * Gets and sets the protocol portion of the URL. - * - * ```js - * const myURL = new URL('https://example.org'); - * console.log(myURL.protocol); - * // Prints https: - * - * myURL.protocol = 'ftp'; - * console.log(myURL.href); - * // Prints ftp://example.org/ - * ``` - * - * Invalid URL protocol values assigned to the `protocol` property are ignored. - */ - protocol: string; - /** - * Gets and sets the serialized query portion of the URL. - * - * ```js - * const myURL = new URL('https://example.org/abc?123'); - * console.log(myURL.search); - * // Prints ?123 - * - * myURL.search = 'abc=xyz'; - * console.log(myURL.href); - * // Prints https://example.org/abc?abc=xyz - * ``` - * - * Any invalid URL characters appearing in the value assigned the `search` property will be `percent-encoded`. The selection of which - * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. - */ - search: string; - /** - * Gets the `URLSearchParams` object representing the query parameters of the - * URL. This property is read-only but the `URLSearchParams` object it provides - * can be used to mutate the URL instance; to replace the entirety of query - * parameters of the URL, use the {@link search} setter. See `URLSearchParams` documentation for details. - * - * Use care when using `.searchParams` to modify the `URL` because, - * per the WHATWG specification, the `URLSearchParams` object uses - * different rules to determine which characters to percent-encode. For - * instance, the `URL` object will not percent encode the ASCII tilde (`~`) - * character, while `URLSearchParams` will always encode it: - * - * ```js - * const myURL = new URL('https://example.org/abc?foo=~bar'); - * - * console.log(myURL.search); // prints ?foo=~bar - * - * // Modify the URL via searchParams... - * myURL.searchParams.sort(); - * - * console.log(myURL.search); // prints ?foo=%7Ebar - * ``` - */ - readonly searchParams: URLSearchParams; - /** - * Gets and sets the username portion of the URL. - * - * ```js - * const myURL = new URL('https://abc:xyz@example.com'); - * console.log(myURL.username); - * // Prints abc - * - * myURL.username = '123'; - * console.log(myURL.href); - * // Prints https://123:xyz@example.com/ - * ``` - * - * Any invalid URL characters appearing in the value assigned the `username` property will be `percent-encoded`. The selection of which - * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. - */ - username: string; - /** - * The `toString()` method on the `URL` object returns the serialized URL. The - * value returned is equivalent to that of {@link href} and {@link toJSON}. - */ - toString(): string; - /** - * The `toJSON()` method on the `URL` object returns the serialized URL. The - * value returned is equivalent to that of {@link href} and {@link toString}. - * - * This method is automatically called when an `URL` object is serialized - * with [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). - * - * ```js - * const myURLs = [ - * new URL('https://www.example.com'), - * new URL('https://test.example.org'), - * ]; - * console.log(JSON.stringify(myURLs)); - * // Prints ["https://www.example.com/","https://test.example.org/"] - * ``` - */ - toJSON(): string; - } - interface URLSearchParamsIterator extends NodeJS.Iterator { - [Symbol.iterator](): URLSearchParamsIterator; - } - /** - * The `URLSearchParams` API provides read and write access to the query of a `URL`. The `URLSearchParams` class can also be used standalone with one of the - * four following constructors. - * The `URLSearchParams` class is also available on the global object. - * - * The WHATWG `URLSearchParams` interface and the `querystring` module have - * similar purpose, but the purpose of the `querystring` module is more - * general, as it allows the customization of delimiter characters (`&` and `=`). - * On the other hand, this API is designed purely for URL query strings. - * - * ```js - * const myURL = new URL('https://example.org/?abc=123'); - * console.log(myURL.searchParams.get('abc')); - * // Prints 123 - * - * myURL.searchParams.append('abc', 'xyz'); - * console.log(myURL.href); - * // Prints https://example.org/?abc=123&abc=xyz - * - * myURL.searchParams.delete('abc'); - * myURL.searchParams.set('a', 'b'); - * console.log(myURL.href); - * // Prints https://example.org/?a=b - * - * const newSearchParams = new URLSearchParams(myURL.searchParams); - * // The above is equivalent to - * // const newSearchParams = new URLSearchParams(myURL.search); - * - * newSearchParams.append('a', 'c'); - * console.log(myURL.href); - * // Prints https://example.org/?a=b - * console.log(newSearchParams.toString()); - * // Prints a=b&a=c - * - * // newSearchParams.toString() is implicitly called - * myURL.search = newSearchParams; - * console.log(myURL.href); - * // Prints https://example.org/?a=b&a=c - * newSearchParams.delete('a'); - * console.log(myURL.href); - * // Prints https://example.org/?a=b&a=c - * ``` - * @since v7.5.0, v6.13.0 - */ - class URLSearchParams implements Iterable<[string, string]> { - constructor( - init?: - | URLSearchParams - | string - | Record - | Iterable<[string, string]> - | ReadonlyArray<[string, string]>, - ); - /** - * Append a new name-value pair to the query string. - */ - append(name: string, value: string): void; - /** - * If `value` is provided, removes all name-value pairs - * where name is `name` and value is `value`. - * - * If `value` is not provided, removes all name-value pairs whose name is `name`. - */ - delete(name: string, value?: string): void; - /** - * Returns an ES6 `Iterator` over each of the name-value pairs in the query. - * Each item of the iterator is a JavaScript `Array`. The first item of the `Array` is the `name`, the second item of the `Array` is the `value`. - * - * Alias for `urlSearchParams[Symbol.iterator]()`. - */ - entries(): URLSearchParamsIterator<[string, string]>; - /** - * Iterates over each name-value pair in the query and invokes the given function. - * - * ```js - * const myURL = new URL('https://example.org/?a=b&c=d'); - * myURL.searchParams.forEach((value, name, searchParams) => { - * console.log(name, value, myURL.searchParams === searchParams); - * }); - * // Prints: - * // a b true - * // c d true - * ``` - * @param fn Invoked for each name-value pair in the query - * @param thisArg To be used as `this` value for when `fn` is called - */ - forEach( - fn: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void, - thisArg?: TThis, - ): void; - /** - * Returns the value of the first name-value pair whose name is `name`. If there - * are no such pairs, `null` is returned. - * @return or `null` if there is no name-value pair with the given `name`. - */ - get(name: string): string | null; - /** - * Returns the values of all name-value pairs whose name is `name`. If there are - * no such pairs, an empty array is returned. - */ - getAll(name: string): string[]; - /** - * Checks if the `URLSearchParams` object contains key-value pair(s) based on `name` and an optional `value` argument. - * - * If `value` is provided, returns `true` when name-value pair with - * same `name` and `value` exists. - * - * If `value` is not provided, returns `true` if there is at least one name-value - * pair whose name is `name`. - */ - has(name: string, value?: string): boolean; - /** - * Returns an ES6 `Iterator` over the names of each name-value pair. - * - * ```js - * const params = new URLSearchParams('foo=bar&foo=baz'); - * for (const name of params.keys()) { - * console.log(name); - * } - * // Prints: - * // foo - * // foo - * ``` - */ - keys(): URLSearchParamsIterator; - /** - * Sets the value in the `URLSearchParams` object associated with `name` to `value`. If there are any pre-existing name-value pairs whose names are `name`, - * set the first such pair's value to `value` and remove all others. If not, - * append the name-value pair to the query string. - * - * ```js - * const params = new URLSearchParams(); - * params.append('foo', 'bar'); - * params.append('foo', 'baz'); - * params.append('abc', 'def'); - * console.log(params.toString()); - * // Prints foo=bar&foo=baz&abc=def - * - * params.set('foo', 'def'); - * params.set('xyz', 'opq'); - * console.log(params.toString()); - * // Prints foo=def&abc=def&xyz=opq - * ``` - */ - set(name: string, value: string): void; - /** - * The total number of parameter entries. - * @since v19.8.0 - */ - readonly size: number; - /** - * Sort all existing name-value pairs in-place by their names. Sorting is done - * with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs - * with the same name is preserved. - * - * This method can be used, in particular, to increase cache hits. - * - * ```js - * const params = new URLSearchParams('query[]=abc&type=search&query[]=123'); - * params.sort(); - * console.log(params.toString()); - * // Prints query%5B%5D=abc&query%5B%5D=123&type=search - * ``` - * @since v7.7.0, v6.13.0 - */ - sort(): void; - /** - * Returns the search parameters serialized as a string, with characters - * percent-encoded where necessary. - */ - toString(): string; - /** - * Returns an ES6 `Iterator` over the values of each name-value pair. - */ - values(): URLSearchParamsIterator; - [Symbol.iterator](): URLSearchParamsIterator<[string, string]>; - } - import { URL as _URL, URLSearchParams as _URLSearchParams } from "url"; - global { - interface URLSearchParams extends _URLSearchParams {} - interface URL extends _URL {} - interface Global { - URL: typeof _URL; - URLSearchParams: typeof _URLSearchParams; - } - /** - * `URL` class is a global reference for `import { URL } from 'url'` - * https://nodejs.org/api/url.html#the-whatwg-url-api - * @since v10.0.0 - */ - var URL: typeof globalThis extends { - onmessage: any; - URL: infer T; - } ? T - : typeof _URL; - /** - * `URLSearchParams` class is a global reference for `import { URLSearchParams } from 'node:url'` - * https://nodejs.org/api/url.html#class-urlsearchparams - * @since v10.0.0 - */ - var URLSearchParams: typeof globalThis extends { - onmessage: any; - URLSearchParams: infer T; - } ? T - : typeof _URLSearchParams; - } -} -declare module "node:url" { - export * from "url"; -} diff --git a/node_modules/@types/node/util.d.ts b/node_modules/@types/node/util.d.ts deleted file mode 100644 index a171f65..0000000 --- a/node_modules/@types/node/util.d.ts +++ /dev/null @@ -1,2606 +0,0 @@ -/** - * The `node:util` module supports the needs of Node.js internal APIs. Many of the - * utilities are useful for application and module developers as well. To access - * it: - * - * ```js - * import util from 'node:util'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/util.js) - */ -declare module "util" { - import * as types from "node:util/types"; - export interface InspectOptions { - /** - * If `true`, object's non-enumerable symbols and properties are included in the formatted result. - * `WeakMap` and `WeakSet` entries are also included as well as user defined prototype properties (excluding method properties). - * @default false - */ - showHidden?: boolean | undefined; - /** - * Specifies the number of times to recurse while formatting object. - * This is useful for inspecting large objects. - * To recurse up to the maximum call stack size pass `Infinity` or `null`. - * @default 2 - */ - depth?: number | null | undefined; - /** - * If `true`, the output is styled with ANSI color codes. Colors are customizable. - */ - colors?: boolean | undefined; - /** - * If `false`, `[util.inspect.custom](depth, opts, inspect)` functions are not invoked. - * @default true - */ - customInspect?: boolean | undefined; - /** - * If `true`, `Proxy` inspection includes the target and handler objects. - * @default false - */ - showProxy?: boolean | undefined; - /** - * Specifies the maximum number of `Array`, `TypedArray`, `WeakMap`, and `WeakSet` elements - * to include when formatting. Set to `null` or `Infinity` to show all elements. - * Set to `0` or negative to show no elements. - * @default 100 - */ - maxArrayLength?: number | null | undefined; - /** - * Specifies the maximum number of characters to - * include when formatting. Set to `null` or `Infinity` to show all elements. - * Set to `0` or negative to show no characters. - * @default 10000 - */ - maxStringLength?: number | null | undefined; - /** - * The length at which input values are split across multiple lines. - * Set to `Infinity` to format the input as a single line - * (in combination with `compact` set to `true` or any number >= `1`). - * @default 80 - */ - breakLength?: number | undefined; - /** - * Setting this to `false` causes each object key - * to be displayed on a new line. It will also add new lines to text that is - * longer than `breakLength`. If set to a number, the most `n` inner elements - * are united on a single line as long as all properties fit into - * `breakLength`. Short array elements are also grouped together. Note that no - * text will be reduced below 16 characters, no matter the `breakLength` size. - * For more information, see the example below. - * @default true - */ - compact?: boolean | number | undefined; - /** - * If set to `true` or a function, all properties of an object, and `Set` and `Map` - * entries are sorted in the resulting string. - * If set to `true` the default sort is used. - * If set to a function, it is used as a compare function. - */ - sorted?: boolean | ((a: string, b: string) => number) | undefined; - /** - * If set to `true`, getters are going to be - * inspected as well. If set to `'get'` only getters without setter are going - * to be inspected. If set to `'set'` only getters having a corresponding - * setter are going to be inspected. This might cause side effects depending on - * the getter function. - * @default false - */ - getters?: "get" | "set" | boolean | undefined; - /** - * If set to `true`, an underscore is used to separate every three digits in all bigints and numbers. - * @default false - */ - numericSeparator?: boolean | undefined; - } - export type Style = - | "special" - | "number" - | "bigint" - | "boolean" - | "undefined" - | "null" - | "string" - | "symbol" - | "date" - | "regexp" - | "module"; - export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => any; // TODO: , inspect: inspect - export interface InspectOptionsStylized extends InspectOptions { - stylize(text: string, styleType: Style): string; - } - export interface CallSiteObject { - /** - * Returns the name of the function associated with this call site. - */ - functionName: string; - /** - * Returns the name of the resource that contains the script for the - * function for this call site. - */ - scriptName: string; - /** - * Returns the unique id of the script, as in Chrome DevTools protocol - * [`Runtime.ScriptId`](https://chromedevtools.github.io/devtools-protocol/1-3/Runtime/#type-ScriptId). - * @since v22.14.0 - */ - scriptId: string; - /** - * Returns the number, 1-based, of the line for the associate function call. - */ - lineNumber: number; - /** - * Returns the 1-based column offset on the line for the associated function call. - */ - columnNumber: number; - } - export type DiffEntry = [operation: -1 | 0 | 1, value: string]; - /** - * `util.diff()` compares two string or array values and returns an array of difference entries. - * It uses the Myers diff algorithm to compute minimal differences, which is the same algorithm - * used internally by assertion error messages. - * - * If the values are equal, an empty array is returned. - * - * ```js - * const { diff } = require('node:util'); - * - * // Comparing strings - * const actualString = '12345678'; - * const expectedString = '12!!5!7!'; - * console.log(diff(actualString, expectedString)); - * // [ - * // [0, '1'], - * // [0, '2'], - * // [1, '3'], - * // [1, '4'], - * // [-1, '!'], - * // [-1, '!'], - * // [0, '5'], - * // [1, '6'], - * // [-1, '!'], - * // [0, '7'], - * // [1, '8'], - * // [-1, '!'], - * // ] - * // Comparing arrays - * const actualArray = ['1', '2', '3']; - * const expectedArray = ['1', '3', '4']; - * console.log(diff(actualArray, expectedArray)); - * // [ - * // [0, '1'], - * // [1, '2'], - * // [0, '3'], - * // [-1, '4'], - * // ] - * // Equal values return empty array - * console.log(diff('same', 'same')); - * // [] - * ``` - * @since v22.15.0 - * @experimental - * @param actual The first value to compare - * @param expected The second value to compare - * @returns An array of difference entries. Each entry is an array with two elements: - * * Index 0: `number` Operation code: `-1` for delete, `0` for no-op/unchanged, `1` for insert - * * Index 1: `string` The value associated with the operation - */ - export function diff(actual: string | readonly string[], expected: string | readonly string[]): DiffEntry[]; - /** - * The `util.format()` method returns a formatted string using the first argument - * as a `printf`-like format string which can contain zero or more format - * specifiers. Each specifier is replaced with the converted value from the - * corresponding argument. Supported specifiers are: - * - * If a specifier does not have a corresponding argument, it is not replaced: - * - * ```js - * util.format('%s:%s', 'foo'); - * // Returns: 'foo:%s' - * ``` - * - * Values that are not part of the format string are formatted using `util.inspect()` if their type is not `string`. - * - * If there are more arguments passed to the `util.format()` method than the - * number of specifiers, the extra arguments are concatenated to the returned - * string, separated by spaces: - * - * ```js - * util.format('%s:%s', 'foo', 'bar', 'baz'); - * // Returns: 'foo:bar baz' - * ``` - * - * If the first argument does not contain a valid format specifier, `util.format()` returns a string that is the concatenation of all arguments separated by spaces: - * - * ```js - * util.format(1, 2, 3); - * // Returns: '1 2 3' - * ``` - * - * If only one argument is passed to `util.format()`, it is returned as it is - * without any formatting: - * - * ```js - * util.format('%% %s'); - * // Returns: '%% %s' - * ``` - * - * `util.format()` is a synchronous method that is intended as a debugging tool. - * Some input values can have a significant performance overhead that can block the - * event loop. Use this function with care and never in a hot code path. - * @since v0.5.3 - * @param format A `printf`-like format string. - */ - export function format(format?: any, ...param: any[]): string; - /** - * This function is identical to {@link format}, except in that it takes - * an `inspectOptions` argument which specifies options that are passed along to {@link inspect}. - * - * ```js - * util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); - * // Returns 'See object { foo: 42 }', where `42` is colored as a number - * // when printed to a terminal. - * ``` - * @since v10.0.0 - */ - export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string; - interface GetCallSitesOptions { - /** - * Reconstruct the original location in the stacktrace from the source-map. - * Enabled by default with the flag `--enable-source-maps`. - */ - sourceMap?: boolean | undefined; - } - /** - * Returns an array of call site objects containing the stack of - * the caller function. - * - * ```js - * import { getCallSites } from 'node:util'; - * - * function exampleFunction() { - * const callSites = getCallSites(); - * - * console.log('Call Sites:'); - * callSites.forEach((callSite, index) => { - * console.log(`CallSite ${index + 1}:`); - * console.log(`Function Name: ${callSite.functionName}`); - * console.log(`Script Name: ${callSite.scriptName}`); - * console.log(`Line Number: ${callSite.lineNumber}`); - * console.log(`Column Number: ${callSite.column}`); - * }); - * // CallSite 1: - * // Function Name: exampleFunction - * // Script Name: /home/example.js - * // Line Number: 5 - * // Column Number: 26 - * - * // CallSite 2: - * // Function Name: anotherFunction - * // Script Name: /home/example.js - * // Line Number: 22 - * // Column Number: 3 - * - * // ... - * } - * - * // A function to simulate another stack layer - * function anotherFunction() { - * exampleFunction(); - * } - * - * anotherFunction(); - * ``` - * - * It is possible to reconstruct the original locations by setting the option `sourceMap` to `true`. - * If the source map is not available, the original location will be the same as the current location. - * When the `--enable-source-maps` flag is enabled, for example when using `--experimental-transform-types`, - * `sourceMap` will be true by default. - * - * ```ts - * import { getCallSites } from 'node:util'; - * - * interface Foo { - * foo: string; - * } - * - * const callSites = getCallSites({ sourceMap: true }); - * - * // With sourceMap: - * // Function Name: '' - * // Script Name: example.js - * // Line Number: 7 - * // Column Number: 26 - * - * // Without sourceMap: - * // Function Name: '' - * // Script Name: example.js - * // Line Number: 2 - * // Column Number: 26 - * ``` - * @param frameCount Number of frames to capture as call site objects. - * **Default:** `10`. Allowable range is between 1 and 200. - * @return An array of call site objects - * @since v22.9.0 - */ - export function getCallSites(frameCount?: number, options?: GetCallSitesOptions): CallSiteObject[]; - export function getCallSites(options: GetCallSitesOptions): CallSiteObject[]; - /** - * Returns the string name for a numeric error code that comes from a Node.js API. - * The mapping between error codes and error names is platform-dependent. - * See `Common System Errors` for the names of common errors. - * - * ```js - * fs.access('file/that/does/not/exist', (err) => { - * const name = util.getSystemErrorName(err.errno); - * console.error(name); // ENOENT - * }); - * ``` - * @since v9.7.0 - */ - export function getSystemErrorName(err: number): string; - /** - * Enable or disable printing a stack trace on `SIGINT`. The API is only available on the main thread. - * @since 22.19.0 - */ - export function setTraceSigInt(enable: boolean): void; - /** - * Returns a Map of all system error codes available from the Node.js API. - * The mapping between error codes and error names is platform-dependent. - * See `Common System Errors` for the names of common errors. - * - * ```js - * fs.access('file/that/does/not/exist', (err) => { - * const errorMap = util.getSystemErrorMap(); - * const name = errorMap.get(err.errno); - * console.error(name); // ENOENT - * }); - * ``` - * @since v16.0.0, v14.17.0 - */ - export function getSystemErrorMap(): Map; - /** - * Returns the string message for a numeric error code that comes from a Node.js - * API. - * The mapping between error codes and string messages is platform-dependent. - * - * ```js - * fs.access('file/that/does/not/exist', (err) => { - * const message = util.getSystemErrorMessage(err.errno); - * console.error(message); // no such file or directory - * }); - * ``` - * @since v22.12.0 - */ - export function getSystemErrorMessage(err: number): string; - /** - * The `util.log()` method prints the given `string` to `stdout` with an included - * timestamp. - * - * ```js - * import util from 'node:util'; - * - * util.log('Timestamped message.'); - * ``` - * @since v0.3.0 - * @deprecated Since v6.0.0 - Use a third party module instead. - */ - export function log(string: string): void; - /** - * Returns the `string` after replacing any surrogate code points - * (or equivalently, any unpaired surrogate code units) with the - * Unicode "replacement character" U+FFFD. - * @since v16.8.0, v14.18.0 - */ - export function toUSVString(string: string): string; - /** - * Creates and returns an `AbortController` instance whose `AbortSignal` is marked - * as transferable and can be used with `structuredClone()` or `postMessage()`. - * @since v18.11.0 - * @returns A transferable AbortController - */ - export function transferableAbortController(): AbortController; - /** - * Marks the given `AbortSignal` as transferable so that it can be used with`structuredClone()` and `postMessage()`. - * - * ```js - * const signal = transferableAbortSignal(AbortSignal.timeout(100)); - * const channel = new MessageChannel(); - * channel.port2.postMessage(signal, [signal]); - * ``` - * @since v18.11.0 - * @param signal The AbortSignal - * @returns The same AbortSignal - */ - export function transferableAbortSignal(signal: AbortSignal): AbortSignal; - /** - * Listens to abort event on the provided `signal` and returns a promise that resolves when the `signal` is aborted. - * If `resource` is provided, it weakly references the operation's associated object, - * so if `resource` is garbage collected before the `signal` aborts, - * then returned promise shall remain pending. - * This prevents memory leaks in long-running or non-cancelable operations. - * - * ```js - * import { aborted } from 'node:util'; - * - * // Obtain an object with an abortable signal, like a custom resource or operation. - * const dependent = obtainSomethingAbortable(); - * - * // Pass `dependent` as the resource, indicating the promise should only resolve - * // if `dependent` is still in memory when the signal is aborted. - * aborted(dependent.signal, dependent).then(() => { - * // This code runs when `dependent` is aborted. - * console.log('Dependent resource was aborted.'); - * }); - * - * // Simulate an event that triggers the abort. - * dependent.on('event', () => { - * dependent.abort(); // This will cause the `aborted` promise to resolve. - * }); - * ``` - * @since v19.7.0 - * @param resource Any non-null object tied to the abortable operation and held weakly. - * If `resource` is garbage collected before the `signal` aborts, the promise remains pending, - * allowing Node.js to stop tracking it. - * This helps prevent memory leaks in long-running or non-cancelable operations. - */ - export function aborted(signal: AbortSignal, resource: any): Promise; - /** - * The `util.inspect()` method returns a string representation of `object` that is - * intended for debugging. The output of `util.inspect` may change at any time - * and should not be depended upon programmatically. Additional `options` may be - * passed that alter the result. - * `util.inspect()` will use the constructor's name and/or `Symbol.toStringTag` - * property to make an identifiable tag for an inspected value. - * - * ```js - * class Foo { - * get [Symbol.toStringTag]() { - * return 'bar'; - * } - * } - * - * class Bar {} - * - * const baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } }); - * - * util.inspect(new Foo()); // 'Foo [bar] {}' - * util.inspect(new Bar()); // 'Bar {}' - * util.inspect(baz); // '[foo] {}' - * ``` - * - * Circular references point to their anchor by using a reference index: - * - * ```js - * import { inspect } from 'node:util'; - * - * const obj = {}; - * obj.a = [obj]; - * obj.b = {}; - * obj.b.inner = obj.b; - * obj.b.obj = obj; - * - * console.log(inspect(obj)); - * // { - * // a: [ [Circular *1] ], - * // b: { inner: [Circular *2], obj: [Circular *1] } - * // } - * ``` - * - * The following example inspects all properties of the `util` object: - * - * ```js - * import util from 'node:util'; - * - * console.log(util.inspect(util, { showHidden: true, depth: null })); - * ``` - * - * The following example highlights the effect of the `compact` option: - * - * ```js - * import { inspect } from 'node:util'; - * - * const o = { - * a: [1, 2, [[ - * 'Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, sed do ' + - * 'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.', - * 'test', - * 'foo']], 4], - * b: new Map([['za', 1], ['zb', 'test']]), - * }; - * console.log(inspect(o, { compact: true, depth: 5, breakLength: 80 })); - * - * // { a: - * // [ 1, - * // 2, - * // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line - * // 'test', - * // 'foo' ] ], - * // 4 ], - * // b: Map(2) { 'za' => 1, 'zb' => 'test' } } - * - * // Setting `compact` to false or an integer creates more reader friendly output. - * console.log(inspect(o, { compact: false, depth: 5, breakLength: 80 })); - * - * // { - * // a: [ - * // 1, - * // 2, - * // [ - * // [ - * // 'Lorem ipsum dolor sit amet,\n' + - * // 'consectetur adipiscing elit, sed do eiusmod \n' + - * // 'tempor incididunt ut labore et dolore magna aliqua.', - * // 'test', - * // 'foo' - * // ] - * // ], - * // 4 - * // ], - * // b: Map(2) { - * // 'za' => 1, - * // 'zb' => 'test' - * // } - * // } - * - * // Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a - * // single line. - * ``` - * - * The `showHidden` option allows `WeakMap` and `WeakSet` entries to be - * inspected. If there are more entries than `maxArrayLength`, there is no - * guarantee which entries are displayed. That means retrieving the same - * `WeakSet` entries twice may result in different output. Furthermore, entries - * with no remaining strong references may be garbage collected at any time. - * - * ```js - * import { inspect } from 'node:util'; - * - * const obj = { a: 1 }; - * const obj2 = { b: 2 }; - * const weakSet = new WeakSet([obj, obj2]); - * - * console.log(inspect(weakSet, { showHidden: true })); - * // WeakSet { { a: 1 }, { b: 2 } } - * ``` - * - * The `sorted` option ensures that an object's property insertion order does not - * impact the result of `util.inspect()`. - * - * ```js - * import { inspect } from 'node:util'; - * import assert from 'node:assert'; - * - * const o1 = { - * b: [2, 3, 1], - * a: '`a` comes before `b`', - * c: new Set([2, 3, 1]), - * }; - * console.log(inspect(o1, { sorted: true })); - * // { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } } - * console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) })); - * // { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' } - * - * const o2 = { - * c: new Set([2, 1, 3]), - * a: '`a` comes before `b`', - * b: [2, 3, 1], - * }; - * assert.strict.equal( - * inspect(o1, { sorted: true }), - * inspect(o2, { sorted: true }), - * ); - * ``` - * - * The `numericSeparator` option adds an underscore every three digits to all - * numbers. - * - * ```js - * import { inspect } from 'node:util'; - * - * const thousand = 1000; - * const million = 1000000; - * const bigNumber = 123456789n; - * const bigDecimal = 1234.12345; - * - * console.log(inspect(thousand, { numericSeparator: true })); - * // 1_000 - * console.log(inspect(million, { numericSeparator: true })); - * // 1_000_000 - * console.log(inspect(bigNumber, { numericSeparator: true })); - * // 123_456_789n - * console.log(inspect(bigDecimal, { numericSeparator: true })); - * // 1_234.123_45 - * ``` - * - * `util.inspect()` is a synchronous method intended for debugging. Its maximum - * output length is approximately 128 MiB. Inputs that result in longer output will - * be truncated. - * @since v0.3.0 - * @param object Any JavaScript primitive or `Object`. - * @return The representation of `object`. - */ - export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; - export function inspect(object: any, options?: InspectOptions): string; - export namespace inspect { - let colors: NodeJS.Dict<[number, number]>; - let styles: { - [K in Style]: string; - }; - let defaultOptions: InspectOptions; - /** - * Allows changing inspect settings from the repl. - */ - let replDefaults: InspectOptions; - /** - * That can be used to declare custom inspect functions. - */ - const custom: unique symbol; - } - /** - * Alias for [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray). - * - * Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isArray([]); - * // Returns: true - * util.isArray(new Array()); - * // Returns: true - * util.isArray({}); - * // Returns: false - * ``` - * @since v0.6.0 - * @deprecated Since v4.0.0 - Use `isArray` instead. - */ - export function isArray(object: unknown): object is unknown[]; - /** - * Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isRegExp(/some regexp/); - * // Returns: true - * util.isRegExp(new RegExp('another regexp')); - * // Returns: true - * util.isRegExp({}); - * // Returns: false - * ``` - * @since v0.6.0 - * @deprecated Since v4.0.0 - Deprecated - */ - export function isRegExp(object: unknown): object is RegExp; - /** - * Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isDate(new Date()); - * // Returns: true - * util.isDate(Date()); - * // false (without 'new' returns a String) - * util.isDate({}); - * // Returns: false - * ``` - * @since v0.6.0 - * @deprecated Since v4.0.0 - Use {@link types.isDate} instead. - */ - export function isDate(object: unknown): object is Date; - /** - * Returns `true` if the given `object` is an `Error`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isError(new Error()); - * // Returns: true - * util.isError(new TypeError()); - * // Returns: true - * util.isError({ name: 'Error', message: 'an error occurred' }); - * // Returns: false - * ``` - * - * This method relies on `Object.prototype.toString()` behavior. It is - * possible to obtain an incorrect result when the `object` argument manipulates `@@toStringTag`. - * - * ```js - * import util from 'node:util'; - * const obj = { name: 'Error', message: 'an error occurred' }; - * - * util.isError(obj); - * // Returns: false - * obj[Symbol.toStringTag] = 'Error'; - * util.isError(obj); - * // Returns: true - * ``` - * @since v0.6.0 - * @deprecated Since v4.0.0 - Use {@link types.isNativeError} instead. - */ - export function isError(object: unknown): object is Error; - /** - * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and - * `extends` keywords to get language level inheritance support. Also note - * that the two styles are [semantically incompatible](https://github.com/nodejs/node/issues/4179). - * - * Inherit the prototype methods from one - * [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) into another. The - * prototype of `constructor` will be set to a new object created from - * `superConstructor`. - * - * This mainly adds some input validation on top of - * `Object.setPrototypeOf(constructor.prototype, superConstructor.prototype)`. - * As an additional convenience, `superConstructor` will be accessible - * through the `constructor.super_` property. - * - * ```js - * const util = require('node:util'); - * const EventEmitter = require('node:events'); - * - * function MyStream() { - * EventEmitter.call(this); - * } - * - * util.inherits(MyStream, EventEmitter); - * - * MyStream.prototype.write = function(data) { - * this.emit('data', data); - * }; - * - * const stream = new MyStream(); - * - * console.log(stream instanceof EventEmitter); // true - * console.log(MyStream.super_ === EventEmitter); // true - * - * stream.on('data', (data) => { - * console.log(`Received data: "${data}"`); - * }); - * stream.write('It works!'); // Received data: "It works!" - * ``` - * - * ES6 example using `class` and `extends`: - * - * ```js - * import EventEmitter from 'node:events'; - * - * class MyStream extends EventEmitter { - * write(data) { - * this.emit('data', data); - * } - * } - * - * const stream = new MyStream(); - * - * stream.on('data', (data) => { - * console.log(`Received data: "${data}"`); - * }); - * stream.write('With ES6'); - * ``` - * @since v0.3.0 - * @legacy Use ES2015 class syntax and `extends` keyword instead. - */ - export function inherits(constructor: unknown, superConstructor: unknown): void; - export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void; - export interface DebugLogger extends DebugLoggerFunction { - /** - * The `util.debuglog().enabled` getter is used to create a test that can be used - * in conditionals based on the existence of the `NODE_DEBUG` environment variable. - * If the `section` name appears within the value of that environment variable, - * then the returned value will be `true`. If not, then the returned value will be - * `false`. - * - * ```js - * import { debuglog } from 'node:util'; - * const enabled = debuglog('foo').enabled; - * if (enabled) { - * console.log('hello from foo [%d]', 123); - * } - * ``` - * - * If this program is run with `NODE_DEBUG=foo` in the environment, then it will - * output something like: - * - * ```console - * hello from foo [123] - * ``` - */ - enabled: boolean; - } - /** - * The `util.debuglog()` method is used to create a function that conditionally - * writes debug messages to `stderr` based on the existence of the `NODE_DEBUG` - * environment variable. If the `section` name appears within the value of that - * environment variable, then the returned function operates similar to - * `console.error()`. If not, then the returned function is a no-op. - * - * ```js - * import { debuglog } from 'node:util'; - * const log = debuglog('foo'); - * - * log('hello from foo [%d]', 123); - * ``` - * - * If this program is run with `NODE_DEBUG=foo` in the environment, then - * it will output something like: - * - * ```console - * FOO 3245: hello from foo [123] - * ``` - * - * where `3245` is the process id. If it is not run with that - * environment variable set, then it will not print anything. - * - * The `section` supports wildcard also: - * - * ```js - * import { debuglog } from 'node:util'; - * const log = debuglog('foo'); - * - * log('hi there, it\'s foo-bar [%d]', 2333); - * ``` - * - * if it is run with `NODE_DEBUG=foo*` in the environment, then it will output - * something like: - * - * ```console - * FOO-BAR 3257: hi there, it's foo-bar [2333] - * ``` - * - * Multiple comma-separated `section` names may be specified in the `NODE_DEBUG` - * environment variable: `NODE_DEBUG=fs,net,tls`. - * - * The optional `callback` argument can be used to replace the logging function - * with a different function that doesn't have any initialization or - * unnecessary wrapping. - * - * ```js - * import { debuglog } from 'node:util'; - * let log = debuglog('internals', (debug) => { - * // Replace with a logging function that optimizes out - * // testing if the section is enabled - * log = debug; - * }); - * ``` - * @since v0.11.3 - * @param section A string identifying the portion of the application for which the `debuglog` function is being created. - * @param callback A callback invoked the first time the logging function is called with a function argument that is a more optimized logging function. - * @return The logging function - */ - export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger; - export { debuglog as debug }; - /** - * Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isBoolean(1); - * // Returns: false - * util.isBoolean(0); - * // Returns: false - * util.isBoolean(false); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `typeof value === 'boolean'` instead. - */ - export function isBoolean(object: unknown): object is boolean; - /** - * Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isBuffer({ length: 0 }); - * // Returns: false - * util.isBuffer([]); - * // Returns: false - * util.isBuffer(Buffer.from('hello world')); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `isBuffer` instead. - */ - export function isBuffer(object: unknown): object is Buffer; - /** - * Returns `true` if the given `object` is a `Function`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * function Foo() {} - * const Bar = () => {}; - * - * util.isFunction({}); - * // Returns: false - * util.isFunction(Foo); - * // Returns: true - * util.isFunction(Bar); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `typeof value === 'function'` instead. - */ - export function isFunction(object: unknown): boolean; - /** - * Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`. - * - * ```js - * import util from 'node:util'; - * - * util.isNull(0); - * // Returns: false - * util.isNull(undefined); - * // Returns: false - * util.isNull(null); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `value === null` instead. - */ - export function isNull(object: unknown): object is null; - /** - * Returns `true` if the given `object` is `null` or `undefined`. Otherwise, - * returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isNullOrUndefined(0); - * // Returns: false - * util.isNullOrUndefined(undefined); - * // Returns: true - * util.isNullOrUndefined(null); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead. - */ - export function isNullOrUndefined(object: unknown): object is null | undefined; - /** - * Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isNumber(false); - * // Returns: false - * util.isNumber(Infinity); - * // Returns: true - * util.isNumber(0); - * // Returns: true - * util.isNumber(NaN); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `typeof value === 'number'` instead. - */ - export function isNumber(object: unknown): object is number; - /** - * Returns `true` if the given `object` is strictly an `Object`**and** not a`Function` (even though functions are objects in JavaScript). - * Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isObject(5); - * // Returns: false - * util.isObject(null); - * // Returns: false - * util.isObject({}); - * // Returns: true - * util.isObject(() => {}); - * // Returns: false - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `value !== null && typeof value === 'object'` instead. - */ - export function isObject(object: unknown): boolean; - /** - * Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`. - * - * ```js - * import util from 'node:util'; - * - * util.isPrimitive(5); - * // Returns: true - * util.isPrimitive('foo'); - * // Returns: true - * util.isPrimitive(false); - * // Returns: true - * util.isPrimitive(null); - * // Returns: true - * util.isPrimitive(undefined); - * // Returns: true - * util.isPrimitive({}); - * // Returns: false - * util.isPrimitive(() => {}); - * // Returns: false - * util.isPrimitive(/^$/); - * // Returns: false - * util.isPrimitive(new Date()); - * // Returns: false - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. - */ - export function isPrimitive(object: unknown): boolean; - /** - * Returns `true` if the given `object` is a `string`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isString(''); - * // Returns: true - * util.isString('foo'); - * // Returns: true - * util.isString(String('foo')); - * // Returns: true - * util.isString(5); - * // Returns: false - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `typeof value === 'string'` instead. - */ - export function isString(object: unknown): object is string; - /** - * Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * util.isSymbol(5); - * // Returns: false - * util.isSymbol('foo'); - * // Returns: false - * util.isSymbol(Symbol('foo')); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `typeof value === 'symbol'` instead. - */ - export function isSymbol(object: unknown): object is symbol; - /** - * Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`. - * - * ```js - * import util from 'node:util'; - * - * const foo = undefined; - * util.isUndefined(5); - * // Returns: false - * util.isUndefined(foo); - * // Returns: true - * util.isUndefined(null); - * // Returns: false - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `value === undefined` instead. - */ - export function isUndefined(object: unknown): object is undefined; - /** - * The `util.deprecate()` method wraps `fn` (which may be a function or class) in - * such a way that it is marked as deprecated. - * - * ```js - * import { deprecate } from 'node:util'; - * - * export const obsoleteFunction = deprecate(() => { - * // Do something here. - * }, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.'); - * ``` - * - * When called, `util.deprecate()` will return a function that will emit a - * `DeprecationWarning` using the `'warning'` event. The warning will - * be emitted and printed to `stderr` the first time the returned function is - * called. After the warning is emitted, the wrapped function is called without - * emitting a warning. - * - * If the same optional `code` is supplied in multiple calls to `util.deprecate()`, - * the warning will be emitted only once for that `code`. - * - * ```js - * import { deprecate } from 'node:util'; - * - * const fn1 = deprecate( - * () => 'a value', - * 'deprecation message', - * 'DEP0001', - * ); - * const fn2 = deprecate( - * () => 'a different value', - * 'other dep message', - * 'DEP0001', - * ); - * fn1(); // Emits a deprecation warning with code DEP0001 - * fn2(); // Does not emit a deprecation warning because it has the same code - * ``` - * - * If either the `--no-deprecation` or `--no-warnings` command-line flags are - * used, or if the `process.noDeprecation` property is set to `true` _prior_ to - * the first deprecation warning, the `util.deprecate()` method does nothing. - * - * If the `--trace-deprecation` or `--trace-warnings` command-line flags are set, - * or the `process.traceDeprecation` property is set to `true`, a warning and a - * stack trace are printed to `stderr` the first time the deprecated function is - * called. - * - * If the `--throw-deprecation` command-line flag is set, or the - * `process.throwDeprecation` property is set to `true`, then an exception will be - * thrown when the deprecated function is called. - * - * The `--throw-deprecation` command-line flag and `process.throwDeprecation` - * property take precedence over `--trace-deprecation` and - * `process.traceDeprecation`. - * @since v0.8.0 - * @param fn The function that is being deprecated. - * @param msg A warning message to display when the deprecated function is invoked. - * @param code A deprecation code. See the `list of deprecated APIs` for a list of codes. - * @return The deprecated function wrapped to emit a warning. - */ - export function deprecate(fn: T, msg: string, code?: string): T; - /** - * Returns `true` if there is deep strict equality between `val1` and `val2`. - * Otherwise, returns `false`. - * - * See `assert.deepStrictEqual()` for more information about deep strict - * equality. - * @since v9.0.0 - */ - export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean; - /** - * Returns `str` with any ANSI escape codes removed. - * - * ```js - * console.log(util.stripVTControlCharacters('\u001B[4mvalue\u001B[0m')); - * // Prints "value" - * ``` - * @since v16.11.0 - */ - export function stripVTControlCharacters(str: string): string; - /** - * Takes an `async` function (or a function that returns a `Promise`) and returns a - * function following the error-first callback style, i.e. taking - * an `(err, value) => ...` callback as the last argument. In the callback, the - * first argument will be the rejection reason (or `null` if the `Promise` - * resolved), and the second argument will be the resolved value. - * - * ```js - * import { callbackify } from 'node:util'; - * - * async function fn() { - * return 'hello world'; - * } - * const callbackFunction = callbackify(fn); - * - * callbackFunction((err, ret) => { - * if (err) throw err; - * console.log(ret); - * }); - * ``` - * - * Will print: - * - * ```text - * hello world - * ``` - * - * The callback is executed asynchronously, and will have a limited stack trace. - * If the callback throws, the process will emit an `'uncaughtException'` - * event, and if not handled will exit. - * - * Since `null` has a special meaning as the first argument to a callback, if a - * wrapped function rejects a `Promise` with a falsy value as a reason, the value - * is wrapped in an `Error` with the original value stored in a field named - * `reason`. - * - * ```js - * function fn() { - * return Promise.reject(null); - * } - * const callbackFunction = util.callbackify(fn); - * - * callbackFunction((err, ret) => { - * // When the Promise was rejected with `null` it is wrapped with an Error and - * // the original value is stored in `reason`. - * err && Object.hasOwn(err, 'reason') && err.reason === null; // true - * }); - * ``` - * @since v8.2.0 - * @param fn An `async` function - * @return a callback style function - */ - export function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: () => Promise, - ): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; - export function callbackify( - fn: (arg1: T1) => Promise, - ): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: (arg1: T1) => Promise, - ): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2) => Promise, - ): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2) => Promise, - ): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise, - ): ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, - ) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, - ): ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, - ) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, - ): ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - callback: (err: NodeJS.ErrnoException) => void, - ) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, - ): ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, - ) => void; - export interface CustomPromisifyLegacy extends Function { - __promisify__: TCustom; - } - export interface CustomPromisifySymbol extends Function { - [promisify.custom]: TCustom; - } - export type CustomPromisify = - | CustomPromisifySymbol - | CustomPromisifyLegacy; - /** - * Takes a function following the common error-first callback style, i.e. taking - * an `(err, value) => ...` callback as the last argument, and returns a version - * that returns promises. - * - * ```js - * import { promisify } from 'node:util'; - * import { stat } from 'node:fs'; - * - * const promisifiedStat = promisify(stat); - * promisifiedStat('.').then((stats) => { - * // Do something with `stats` - * }).catch((error) => { - * // Handle the error. - * }); - * ``` - * - * Or, equivalently using `async function`s: - * - * ```js - * import { promisify } from 'node:util'; - * import { stat } from 'node:fs'; - * - * const promisifiedStat = promisify(stat); - * - * async function callStat() { - * const stats = await promisifiedStat('.'); - * console.log(`This directory is owned by ${stats.uid}`); - * } - * - * callStat(); - * ``` - * - * If there is an `original[util.promisify.custom]` property present, `promisify` - * will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-v22.x/api/util.html#custom-promisified-functions). - * - * `promisify()` assumes that `original` is a function taking a callback as its - * final argument in all cases. If `original` is not a function, `promisify()` - * will throw an error. If `original` is a function but its last argument is not - * an error-first callback, it will still be passed an error-first - * callback as its last argument. - * - * Using `promisify()` on class methods or other methods that use `this` may not - * work as expected unless handled specially: - * - * ```js - * import { promisify } from 'node:util'; - * - * class Foo { - * constructor() { - * this.a = 42; - * } - * - * bar(callback) { - * callback(null, this.a); - * } - * } - * - * const foo = new Foo(); - * - * const naiveBar = promisify(foo.bar); - * // TypeError: Cannot read properties of undefined (reading 'a') - * // naiveBar().then(a => console.log(a)); - * - * naiveBar.call(foo).then((a) => console.log(a)); // '42' - * - * const bindBar = naiveBar.bind(foo); - * bindBar().then((a) => console.log(a)); // '42' - * ``` - * @since v8.0.0 - */ - export function promisify(fn: CustomPromisify): TCustom; - export function promisify( - fn: (callback: (err: any, result: TResult) => void) => void, - ): () => Promise; - export function promisify(fn: (callback: (err?: any) => void) => void): () => Promise; - export function promisify( - fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1) => Promise; - export function promisify(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - export function promisify(fn: Function): Function; - export namespace promisify { - /** - * That can be used to declare custom promisified variants of functions. - */ - const custom: unique symbol; - } - /** - * Stability: 1.1 - Active development - * Given an example `.env` file: - * - * ```js - * import { parseEnv } from 'node:util'; - * - * parseEnv('HELLO=world\nHELLO=oh my\n'); - * // Returns: { HELLO: 'oh my' } - * ``` - * @param content The raw contents of a `.env` file. - * @since v20.12.0 - */ - export function parseEnv(content: string): NodeJS.Dict; - // https://nodejs.org/docs/latest/api/util.html#foreground-colors - type ForegroundColors = - | "black" - | "blackBright" - | "blue" - | "blueBright" - | "cyan" - | "cyanBright" - | "gray" - | "green" - | "greenBright" - | "grey" - | "magenta" - | "magentaBright" - | "red" - | "redBright" - | "white" - | "whiteBright" - | "yellow" - | "yellowBright"; - // https://nodejs.org/docs/latest/api/util.html#background-colors - type BackgroundColors = - | "bgBlack" - | "bgBlackBright" - | "bgBlue" - | "bgBlueBright" - | "bgCyan" - | "bgCyanBright" - | "bgGray" - | "bgGreen" - | "bgGreenBright" - | "bgGrey" - | "bgMagenta" - | "bgMagentaBright" - | "bgRed" - | "bgRedBright" - | "bgWhite" - | "bgWhiteBright" - | "bgYellow" - | "bgYellowBright"; - // https://nodejs.org/docs/latest/api/util.html#modifiers - type Modifiers = - | "blink" - | "bold" - | "dim" - | "doubleunderline" - | "framed" - | "hidden" - | "inverse" - | "italic" - | "none" - | "overlined" - | "reset" - | "strikethrough" - | "underline"; - export interface StyleTextOptions { - /** - * When true, `stream` is checked to see if it can handle colors. - * @default true - */ - validateStream?: boolean | undefined; - /** - * A stream that will be validated if it can be colored. - * @default process.stdout - */ - stream?: NodeJS.WritableStream | undefined; - } - /** - * This function returns a formatted text considering the `format` passed - * for printing in a terminal. It is aware of the terminal's capabilities - * and acts according to the configuration set via `NO_COLOR`, - * `NODE_DISABLE_COLORS` and `FORCE_COLOR` environment variables. - * - * ```js - * import { styleText } from 'node:util'; - * import { stderr } from 'node:process'; - * - * const successMessage = styleText('green', 'Success!'); - * console.log(successMessage); - * - * const errorMessage = styleText( - * 'red', - * 'Error! Error!', - * // Validate if process.stderr has TTY - * { stream: stderr }, - * ); - * console.error(errorMessage); - * ``` - * - * `util.inspect.colors` also provides text formats such as `italic`, and - * `underline` and you can combine both: - * - * ```js - * console.log( - * util.styleText(['underline', 'italic'], 'My italic underlined message'), - * ); - * ``` - * - * When passing an array of formats, the order of the format applied - * is left to right so the following style might overwrite the previous one. - * - * ```js - * console.log( - * util.styleText(['red', 'green'], 'text'), // green - * ); - * ``` - * - * The special format value `none` applies no additional styling to the text. - * - * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v22.x/api/util.html#modifiers). - * @param format A text format or an Array of text formats defined in `util.inspect.colors`. - * @param text The text to to be formatted. - * @since v20.12.0 - */ - export function styleText( - format: - | ForegroundColors - | BackgroundColors - | Modifiers - | Array, - text: string, - options?: StyleTextOptions, - ): string; - /** - * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API. - * - * ```js - * const decoder = new TextDecoder(); - * const u8arr = new Uint8Array([72, 101, 108, 108, 111]); - * console.log(decoder.decode(u8arr)); // Hello - * ``` - * @since v8.3.0 - */ - export class TextDecoder { - /** - * The encoding supported by the `TextDecoder` instance. - */ - readonly encoding: string; - /** - * The value will be `true` if decoding errors result in a `TypeError` being - * thrown. - */ - readonly fatal: boolean; - /** - * The value will be `true` if the decoding result will include the byte order - * mark. - */ - readonly ignoreBOM: boolean; - constructor( - encoding?: string, - options?: { - fatal?: boolean | undefined; - ignoreBOM?: boolean | undefined; - }, - ); - /** - * Decodes the `input` and returns a string. If `options.stream` is `true`, any - * incomplete byte sequences occurring at the end of the `input` are buffered - * internally and emitted after the next call to `textDecoder.decode()`. - * - * If `textDecoder.fatal` is `true`, decoding errors that occur will result in a `TypeError` being thrown. - * @param input An `ArrayBuffer`, `DataView`, or `TypedArray` instance containing the encoded data. - */ - decode( - input?: NodeJS.ArrayBufferView | ArrayBuffer | null, - options?: { - stream?: boolean | undefined; - }, - ): string; - } - export interface EncodeIntoResult { - /** - * The read Unicode code units of input. - */ - read: number; - /** - * The written UTF-8 bytes of output. - */ - written: number; - } - export { types }; - - //// TextEncoder/Decoder - /** - * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All - * instances of `TextEncoder` only support UTF-8 encoding. - * - * ```js - * const encoder = new TextEncoder(); - * const uint8array = encoder.encode('this is some data'); - * ``` - * - * The `TextEncoder` class is also available on the global object. - * @since v8.3.0 - */ - export class TextEncoder { - /** - * The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`. - */ - readonly encoding: string; - /** - * UTF-8 encodes the `input` string and returns a `Uint8Array` containing the - * encoded bytes. - * @param [input='an empty string'] The text to encode. - */ - encode(input?: string): NodeJS.NonSharedUint8Array; - /** - * UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object - * containing the read Unicode code units and written UTF-8 bytes. - * - * ```js - * const encoder = new TextEncoder(); - * const src = 'this is some data'; - * const dest = new Uint8Array(10); - * const { read, written } = encoder.encodeInto(src, dest); - * ``` - * @param src The text to encode. - * @param dest The array to hold the encode result. - */ - encodeInto(src: string, dest: Uint8Array): EncodeIntoResult; - } - import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util"; - global { - /** - * `TextDecoder` class is a global reference for `import { TextDecoder } from 'node:util'` - * https://nodejs.org/api/globals.html#textdecoder - * @since v11.0.0 - */ - var TextDecoder: typeof globalThis extends { - onmessage: any; - TextDecoder: infer TextDecoder; - } ? TextDecoder - : typeof _TextDecoder; - /** - * `TextEncoder` class is a global reference for `import { TextEncoder } from 'node:util'` - * https://nodejs.org/api/globals.html#textencoder - * @since v11.0.0 - */ - var TextEncoder: typeof globalThis extends { - onmessage: any; - TextEncoder: infer TextEncoder; - } ? TextEncoder - : typeof _TextEncoder; - } - - //// parseArgs - /** - * Provides a higher level API for command-line argument parsing than interacting - * with `process.argv` directly. Takes a specification for the expected arguments - * and returns a structured object with the parsed options and positionals. - * - * ```js - * import { parseArgs } from 'node:util'; - * const args = ['-f', '--bar', 'b']; - * const options = { - * foo: { - * type: 'boolean', - * short: 'f', - * }, - * bar: { - * type: 'string', - * }, - * }; - * const { - * values, - * positionals, - * } = parseArgs({ args, options }); - * console.log(values, positionals); - * // Prints: [Object: null prototype] { foo: true, bar: 'b' } [] - * ``` - * @since v18.3.0, v16.17.0 - * @param config Used to provide arguments for parsing and to configure the parser. `config` supports the following properties: - * @return The parsed command line arguments: - */ - export function parseArgs(config?: T): ParsedResults; - - /** - * Type of argument used in {@link parseArgs}. - */ - export type ParseArgsOptionsType = "boolean" | "string"; - - export interface ParseArgsOptionDescriptor { - /** - * Type of argument. - */ - type: ParseArgsOptionsType; - /** - * Whether this option can be provided multiple times. - * If `true`, all values will be collected in an array. - * If `false`, values for the option are last-wins. - * @default false. - */ - multiple?: boolean | undefined; - /** - * A single character alias for the option. - */ - short?: string | undefined; - /** - * The value to assign to - * the option if it does not appear in the arguments to be parsed. The value - * must match the type specified by the `type` property. If `multiple` is - * `true`, it must be an array. No default value is applied when the option - * does appear in the arguments to be parsed, even if the provided value - * is falsy. - * @since v18.11.0 - */ - default?: string | boolean | string[] | boolean[] | undefined; - } - export interface ParseArgsOptionsConfig { - [longOption: string]: ParseArgsOptionDescriptor; - } - export interface ParseArgsConfig { - /** - * Array of argument strings. - */ - args?: readonly string[] | undefined; - /** - * Used to describe arguments known to the parser. - */ - options?: ParseArgsOptionsConfig | undefined; - /** - * Should an error be thrown when unknown arguments are encountered, - * or when arguments are passed that do not match the `type` configured in `options`. - * @default true - */ - strict?: boolean | undefined; - /** - * Whether this command accepts positional arguments. - */ - allowPositionals?: boolean | undefined; - /** - * If `true`, allows explicitly setting boolean options to `false` by prefixing the option name with `--no-`. - * @default false - * @since v22.4.0 - */ - allowNegative?: boolean | undefined; - /** - * Return the parsed tokens. This is useful for extending the built-in behavior, - * from adding additional checks through to reprocessing the tokens in different ways. - * @default false - */ - tokens?: boolean | undefined; - } - /* - IfDefaultsTrue and IfDefaultsFalse are helpers to handle default values for missing boolean properties. - TypeScript does not have exact types for objects: https://github.com/microsoft/TypeScript/issues/12936 - This means it is impossible to distinguish between "field X is definitely not present" and "field X may or may not be present". - But we expect users to generally provide their config inline or `as const`, which means TS will always know whether a given field is present. - So this helper treats "not definitely present" (i.e., not `extends boolean`) as being "definitely not present", i.e. it should have its default value. - This is technically incorrect but is a much nicer UX for the common case. - The IfDefaultsTrue version is for things which default to true; the IfDefaultsFalse version is for things which default to false. - */ - type IfDefaultsTrue = T extends true ? IfTrue - : T extends false ? IfFalse - : IfTrue; - - // we put the `extends false` condition first here because `undefined` compares like `any` when `strictNullChecks: false` - type IfDefaultsFalse = T extends false ? IfFalse - : T extends true ? IfTrue - : IfFalse; - - type ExtractOptionValue = IfDefaultsTrue< - T["strict"], - O["type"] extends "string" ? string : O["type"] extends "boolean" ? boolean : string | boolean, - string | boolean - >; - - type ApplyOptionalModifiers> = ( - & { -readonly [LongOption in keyof O]?: V[LongOption] } - & { [LongOption in keyof O as O[LongOption]["default"] extends {} ? LongOption : never]: V[LongOption] } - ) extends infer P ? { [K in keyof P]: P[K] } : never; // resolve intersection to object - - type ParsedValues = - & IfDefaultsTrue - & (T["options"] extends ParseArgsOptionsConfig ? ApplyOptionalModifiers< - T["options"], - { - [LongOption in keyof T["options"]]: IfDefaultsFalse< - T["options"][LongOption]["multiple"], - Array>, - ExtractOptionValue - >; - } - > - : {}); - - type ParsedPositionals = IfDefaultsTrue< - T["strict"], - IfDefaultsFalse, - IfDefaultsTrue - >; - - type PreciseTokenForOptions< - K extends string, - O extends ParseArgsOptionDescriptor, - > = O["type"] extends "string" ? { - kind: "option"; - index: number; - name: K; - rawName: string; - value: string; - inlineValue: boolean; - } - : O["type"] extends "boolean" ? { - kind: "option"; - index: number; - name: K; - rawName: string; - value: undefined; - inlineValue: undefined; - } - : OptionToken & { name: K }; - - type TokenForOptions< - T extends ParseArgsConfig, - K extends keyof T["options"] = keyof T["options"], - > = K extends unknown - ? T["options"] extends ParseArgsOptionsConfig ? PreciseTokenForOptions - : OptionToken - : never; - - type ParsedOptionToken = IfDefaultsTrue, OptionToken>; - - type ParsedPositionalToken = IfDefaultsTrue< - T["strict"], - IfDefaultsFalse, - IfDefaultsTrue - >; - - type ParsedTokens = Array< - ParsedOptionToken | ParsedPositionalToken | { kind: "option-terminator"; index: number } - >; - - type PreciseParsedResults = IfDefaultsFalse< - T["tokens"], - { - values: ParsedValues; - positionals: ParsedPositionals; - tokens: ParsedTokens; - }, - { - values: ParsedValues; - positionals: ParsedPositionals; - } - >; - - type OptionToken = - | { kind: "option"; index: number; name: string; rawName: string; value: string; inlineValue: boolean } - | { - kind: "option"; - index: number; - name: string; - rawName: string; - value: undefined; - inlineValue: undefined; - }; - - type Token = - | OptionToken - | { kind: "positional"; index: number; value: string } - | { kind: "option-terminator"; index: number }; - - // If ParseArgsConfig extends T, then the user passed config constructed elsewhere. - // So we can't rely on the `"not definitely present" implies "definitely not present"` assumption mentioned above. - type ParsedResults = ParseArgsConfig extends T ? { - values: { - [longOption: string]: undefined | string | boolean | Array; - }; - positionals: string[]; - tokens?: Token[]; - } - : PreciseParsedResults; - - /** - * An implementation of [the MIMEType class](https://bmeck.github.io/node-proposal-mime-api/). - * - * In accordance with browser conventions, all properties of `MIMEType` objects - * are implemented as getters and setters on the class prototype, rather than as - * data properties on the object itself. - * - * A MIME string is a structured string containing multiple meaningful - * components. When parsed, a `MIMEType` object is returned containing - * properties for each of these components. - * @since v19.1.0, v18.13.0 - */ - export class MIMEType { - /** - * Creates a new MIMEType object by parsing the input. - * - * A `TypeError` will be thrown if the `input` is not a valid MIME. - * Note that an effort will be made to coerce the given values into strings. - * @param input The input MIME to parse. - */ - constructor(input: string | { toString: () => string }); - - /** - * Gets and sets the type portion of the MIME. - * - * ```js - * import { MIMEType } from 'node:util'; - * - * const myMIME = new MIMEType('text/javascript'); - * console.log(myMIME.type); - * // Prints: text - * myMIME.type = 'application'; - * console.log(myMIME.type); - * // Prints: application - * console.log(String(myMIME)); - * // Prints: application/javascript - * ``` - */ - type: string; - /** - * Gets and sets the subtype portion of the MIME. - * - * ```js - * import { MIMEType } from 'node:util'; - * - * const myMIME = new MIMEType('text/ecmascript'); - * console.log(myMIME.subtype); - * // Prints: ecmascript - * myMIME.subtype = 'javascript'; - * console.log(myMIME.subtype); - * // Prints: javascript - * console.log(String(myMIME)); - * // Prints: text/javascript - * ``` - */ - subtype: string; - /** - * Gets the essence of the MIME. This property is read only. - * Use `mime.type` or `mime.subtype` to alter the MIME. - * - * ```js - * import { MIMEType } from 'node:util'; - * - * const myMIME = new MIMEType('text/javascript;key=value'); - * console.log(myMIME.essence); - * // Prints: text/javascript - * myMIME.type = 'application'; - * console.log(myMIME.essence); - * // Prints: application/javascript - * console.log(String(myMIME)); - * // Prints: application/javascript;key=value - * ``` - */ - readonly essence: string; - /** - * Gets the `MIMEParams` object representing the - * parameters of the MIME. This property is read-only. See `MIMEParams` documentation for details. - */ - readonly params: MIMEParams; - /** - * The `toString()` method on the `MIMEType` object returns the serialized MIME. - * - * Because of the need for standard compliance, this method does not allow users - * to customize the serialization process of the MIME. - */ - toString(): string; - } - /** - * The `MIMEParams` API provides read and write access to the parameters of a `MIMEType`. - * @since v19.1.0, v18.13.0 - */ - export class MIMEParams { - /** - * Remove all name-value pairs whose name is `name`. - */ - delete(name: string): void; - /** - * Returns an iterator over each of the name-value pairs in the parameters. - * Each item of the iterator is a JavaScript `Array`. The first item of the array - * is the `name`, the second item of the array is the `value`. - */ - entries(): NodeJS.Iterator<[name: string, value: string]>; - /** - * Returns the value of the first name-value pair whose name is `name`. If there - * are no such pairs, `null` is returned. - * @return or `null` if there is no name-value pair with the given `name`. - */ - get(name: string): string | null; - /** - * Returns `true` if there is at least one name-value pair whose name is `name`. - */ - has(name: string): boolean; - /** - * Returns an iterator over the names of each name-value pair. - * - * ```js - * import { MIMEType } from 'node:util'; - * - * const { params } = new MIMEType('text/plain;foo=0;bar=1'); - * for (const name of params.keys()) { - * console.log(name); - * } - * // Prints: - * // foo - * // bar - * ``` - */ - keys(): NodeJS.Iterator; - /** - * Sets the value in the `MIMEParams` object associated with `name` to `value`. If there are any pre-existing name-value pairs whose names are `name`, - * set the first such pair's value to `value`. - * - * ```js - * import { MIMEType } from 'node:util'; - * - * const { params } = new MIMEType('text/plain;foo=0;bar=1'); - * params.set('foo', 'def'); - * params.set('baz', 'xyz'); - * console.log(params.toString()); - * // Prints: foo=def;bar=1;baz=xyz - * ``` - */ - set(name: string, value: string): void; - /** - * Returns an iterator over the values of each name-value pair. - */ - values(): NodeJS.Iterator; - /** - * Returns an iterator over each of the name-value pairs in the parameters. - */ - [Symbol.iterator](): NodeJS.Iterator<[name: string, value: string]>; - } -} -declare module "util/types" { - import { KeyObject, webcrypto } from "node:crypto"; - /** - * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or - * [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance. - * - * See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`. - * - * ```js - * util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true - * util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true - * ``` - * @since v10.0.0 - */ - function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike; - /** - * Returns `true` if the value is an `arguments` object. - * - * ```js - * function foo() { - * util.types.isArgumentsObject(arguments); // Returns true - * } - * ``` - * @since v10.0.0 - */ - function isArgumentsObject(object: unknown): object is IArguments; - /** - * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instance. - * This does _not_ include [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances. Usually, it is - * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that. - * - * ```js - * util.types.isArrayBuffer(new ArrayBuffer()); // Returns true - * util.types.isArrayBuffer(new SharedArrayBuffer()); // Returns false - * ``` - * @since v10.0.0 - */ - function isArrayBuffer(object: unknown): object is ArrayBuffer; - /** - * Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) views, such as typed - * array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to - * [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). - * - * ```js - * util.types.isArrayBufferView(new Int8Array()); // true - * util.types.isArrayBufferView(Buffer.from('hello world')); // true - * util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true - * util.types.isArrayBufferView(new ArrayBuffer()); // false - * ``` - * @since v10.0.0 - */ - function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView; - /** - * Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function). - * This only reports back what the JavaScript engine is seeing; - * in particular, the return value may not match the original source code if - * a transpilation tool was used. - * - * ```js - * util.types.isAsyncFunction(function foo() {}); // Returns false - * util.types.isAsyncFunction(async function foo() {}); // Returns true - * ``` - * @since v10.0.0 - */ - function isAsyncFunction(object: unknown): boolean; - /** - * Returns `true` if the value is a `BigInt64Array` instance. - * - * ```js - * util.types.isBigInt64Array(new BigInt64Array()); // Returns true - * util.types.isBigInt64Array(new BigUint64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isBigInt64Array(value: unknown): value is BigInt64Array; - /** - * Returns `true` if the value is a BigInt object, e.g. created - * by `Object(BigInt(123))`. - * - * ```js - * util.types.isBigIntObject(Object(BigInt(123))); // Returns true - * util.types.isBigIntObject(BigInt(123)); // Returns false - * util.types.isBigIntObject(123); // Returns false - * ``` - * @since v10.4.0 - */ - function isBigIntObject(object: unknown): object is BigInt; - /** - * Returns `true` if the value is a `BigUint64Array` instance. - * - * ```js - * util.types.isBigUint64Array(new BigInt64Array()); // Returns false - * util.types.isBigUint64Array(new BigUint64Array()); // Returns true - * ``` - * @since v10.0.0 - */ - function isBigUint64Array(value: unknown): value is BigUint64Array; - /** - * Returns `true` if the value is a boolean object, e.g. created - * by `new Boolean()`. - * - * ```js - * util.types.isBooleanObject(false); // Returns false - * util.types.isBooleanObject(true); // Returns false - * util.types.isBooleanObject(new Boolean(false)); // Returns true - * util.types.isBooleanObject(new Boolean(true)); // Returns true - * util.types.isBooleanObject(Boolean(false)); // Returns false - * util.types.isBooleanObject(Boolean(true)); // Returns false - * ``` - * @since v10.0.0 - */ - function isBooleanObject(object: unknown): object is Boolean; - /** - * Returns `true` if the value is any boxed primitive object, e.g. created - * by `new Boolean()`, `new String()` or `Object(Symbol())`. - * - * For example: - * - * ```js - * util.types.isBoxedPrimitive(false); // Returns false - * util.types.isBoxedPrimitive(new Boolean(false)); // Returns true - * util.types.isBoxedPrimitive(Symbol('foo')); // Returns false - * util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true - * util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true - * ``` - * @since v10.11.0 - */ - function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol; - /** - * Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance. - * - * ```js - * const ab = new ArrayBuffer(20); - * util.types.isDataView(new DataView(ab)); // Returns true - * util.types.isDataView(new Float64Array()); // Returns false - * ``` - * - * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). - * @since v10.0.0 - */ - function isDataView(object: unknown): object is DataView; - /** - * Returns `true` if the value is a built-in [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance. - * - * ```js - * util.types.isDate(new Date()); // Returns true - * ``` - * @since v10.0.0 - */ - function isDate(object: unknown): object is Date; - /** - * Returns `true` if the value is a native `External` value. - * - * A native `External` value is a special type of object that contains a - * raw C++ pointer (`void*`) for access from native code, and has no other - * properties. Such objects are created either by Node.js internals or native - * addons. In JavaScript, they are - * [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a - * `null` prototype. - * - * ```c - * #include - * #include - * napi_value result; - * static napi_value MyNapi(napi_env env, napi_callback_info info) { - * int* raw = (int*) malloc(1024); - * napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result); - * if (status != napi_ok) { - * napi_throw_error(env, NULL, "napi_create_external failed"); - * return NULL; - * } - * return result; - * } - * ... - * DECLARE_NAPI_PROPERTY("myNapi", MyNapi) - * ... - * ``` - * - * ```js - * import native from 'napi_addon.node'; - * import { types } from 'node:util'; - * - * const data = native.myNapi(); - * types.isExternal(data); // returns true - * types.isExternal(0); // returns false - * types.isExternal(new String('foo')); // returns false - * ``` - * - * For further information on `napi_create_external`, refer to - * [`napi_create_external()`](https://nodejs.org/docs/latest-v22.x/api/n-api.html#napi_create_external). - * @since v10.0.0 - */ - function isExternal(object: unknown): boolean; - /** - * Returns `true` if the value is a built-in `Float16Array` instance. - * - * ```js - * util.types.isFloat16Array(new ArrayBuffer()); // Returns false - * util.types.isFloat16Array(new Float16Array()); // Returns true - * util.types.isFloat16Array(new Float32Array()); // Returns false - * ``` - * @since v22.16.0 - */ - // This does NOT return a type predicate in v22.x. - // The Float16Array feature does not yet exist in this version of Node.js. - function isFloat16Array(object: unknown): boolean; - /** - * Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance. - * - * ```js - * util.types.isFloat32Array(new ArrayBuffer()); // Returns false - * util.types.isFloat32Array(new Float32Array()); // Returns true - * util.types.isFloat32Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isFloat32Array(object: unknown): object is Float32Array; - /** - * Returns `true` if the value is a built-in [`Float64Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) instance. - * - * ```js - * util.types.isFloat64Array(new ArrayBuffer()); // Returns false - * util.types.isFloat64Array(new Uint8Array()); // Returns false - * util.types.isFloat64Array(new Float64Array()); // Returns true - * ``` - * @since v10.0.0 - */ - function isFloat64Array(object: unknown): object is Float64Array; - /** - * Returns `true` if the value is a generator function. - * This only reports back what the JavaScript engine is seeing; - * in particular, the return value may not match the original source code if - * a transpilation tool was used. - * - * ```js - * util.types.isGeneratorFunction(function foo() {}); // Returns false - * util.types.isGeneratorFunction(function* foo() {}); // Returns true - * ``` - * @since v10.0.0 - */ - function isGeneratorFunction(object: unknown): object is GeneratorFunction; - /** - * Returns `true` if the value is a generator object as returned from a - * built-in generator function. - * This only reports back what the JavaScript engine is seeing; - * in particular, the return value may not match the original source code if - * a transpilation tool was used. - * - * ```js - * function* foo() {} - * const generator = foo(); - * util.types.isGeneratorObject(generator); // Returns true - * ``` - * @since v10.0.0 - */ - function isGeneratorObject(object: unknown): object is Generator; - /** - * Returns `true` if the value is a built-in [`Int8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) instance. - * - * ```js - * util.types.isInt8Array(new ArrayBuffer()); // Returns false - * util.types.isInt8Array(new Int8Array()); // Returns true - * util.types.isInt8Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isInt8Array(object: unknown): object is Int8Array; - /** - * Returns `true` if the value is a built-in [`Int16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) instance. - * - * ```js - * util.types.isInt16Array(new ArrayBuffer()); // Returns false - * util.types.isInt16Array(new Int16Array()); // Returns true - * util.types.isInt16Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isInt16Array(object: unknown): object is Int16Array; - /** - * Returns `true` if the value is a built-in [`Int32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) instance. - * - * ```js - * util.types.isInt32Array(new ArrayBuffer()); // Returns false - * util.types.isInt32Array(new Int32Array()); // Returns true - * util.types.isInt32Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isInt32Array(object: unknown): object is Int32Array; - /** - * Returns `true` if the value is a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance. - * - * ```js - * util.types.isMap(new Map()); // Returns true - * ``` - * @since v10.0.0 - */ - function isMap( - object: T | {}, - ): object is T extends ReadonlyMap ? (unknown extends T ? never : ReadonlyMap) - : Map; - /** - * Returns `true` if the value is an iterator returned for a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance. - * - * ```js - * const map = new Map(); - * util.types.isMapIterator(map.keys()); // Returns true - * util.types.isMapIterator(map.values()); // Returns true - * util.types.isMapIterator(map.entries()); // Returns true - * util.types.isMapIterator(map[Symbol.iterator]()); // Returns true - * ``` - * @since v10.0.0 - */ - function isMapIterator(object: unknown): boolean; - /** - * Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects). - * - * ```js - * import * as ns from './a.js'; - * - * util.types.isModuleNamespaceObject(ns); // Returns true - * ``` - * @since v10.0.0 - */ - function isModuleNamespaceObject(value: unknown): boolean; - /** - * Returns `true` if the value was returned by the constructor of a - * [built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects). - * - * ```js - * console.log(util.types.isNativeError(new Error())); // true - * console.log(util.types.isNativeError(new TypeError())); // true - * console.log(util.types.isNativeError(new RangeError())); // true - * ``` - * - * Subclasses of the native error types are also native errors: - * - * ```js - * class MyError extends Error {} - * console.log(util.types.isNativeError(new MyError())); // true - * ``` - * - * A value being `instanceof` a native error class is not equivalent to `isNativeError()` - * returning `true` for that value. `isNativeError()` returns `true` for errors - * which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false` - * for these errors: - * - * ```js - * import { createContext, runInContext } from 'node:vm'; - * import { types } from 'node:util'; - * - * const context = createContext({}); - * const myError = runInContext('new Error()', context); - * console.log(types.isNativeError(myError)); // true - * console.log(myError instanceof Error); // false - * ``` - * - * Conversely, `isNativeError()` returns `false` for all objects which were not - * returned by the constructor of a native error. That includes values - * which are `instanceof` native errors: - * - * ```js - * const myError = { __proto__: Error.prototype }; - * console.log(util.types.isNativeError(myError)); // false - * console.log(myError instanceof Error); // true - * ``` - * @since v10.0.0 - */ - function isNativeError(object: unknown): object is Error; - /** - * Returns `true` if the value is a number object, e.g. created - * by `new Number()`. - * - * ```js - * util.types.isNumberObject(0); // Returns false - * util.types.isNumberObject(new Number(0)); // Returns true - * ``` - * @since v10.0.0 - */ - function isNumberObject(object: unknown): object is Number; - /** - * Returns `true` if the value is a built-in [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). - * - * ```js - * util.types.isPromise(Promise.resolve(42)); // Returns true - * ``` - * @since v10.0.0 - */ - function isPromise(object: unknown): object is Promise; - /** - * Returns `true` if the value is a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) instance. - * - * ```js - * const target = {}; - * const proxy = new Proxy(target, {}); - * util.types.isProxy(target); // Returns false - * util.types.isProxy(proxy); // Returns true - * ``` - * @since v10.0.0 - */ - function isProxy(object: unknown): boolean; - /** - * Returns `true` if the value is a regular expression object. - * - * ```js - * util.types.isRegExp(/abc/); // Returns true - * util.types.isRegExp(new RegExp('abc')); // Returns true - * ``` - * @since v10.0.0 - */ - function isRegExp(object: unknown): object is RegExp; - /** - * Returns `true` if the value is a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance. - * - * ```js - * util.types.isSet(new Set()); // Returns true - * ``` - * @since v10.0.0 - */ - function isSet( - object: T | {}, - ): object is T extends ReadonlySet ? (unknown extends T ? never : ReadonlySet) : Set; - /** - * Returns `true` if the value is an iterator returned for a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance. - * - * ```js - * const set = new Set(); - * util.types.isSetIterator(set.keys()); // Returns true - * util.types.isSetIterator(set.values()); // Returns true - * util.types.isSetIterator(set.entries()); // Returns true - * util.types.isSetIterator(set[Symbol.iterator]()); // Returns true - * ``` - * @since v10.0.0 - */ - function isSetIterator(object: unknown): boolean; - /** - * Returns `true` if the value is a built-in [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance. - * This does _not_ include [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instances. Usually, it is - * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that. - * - * ```js - * util.types.isSharedArrayBuffer(new ArrayBuffer()); // Returns false - * util.types.isSharedArrayBuffer(new SharedArrayBuffer()); // Returns true - * ``` - * @since v10.0.0 - */ - function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer; - /** - * Returns `true` if the value is a string object, e.g. created - * by `new String()`. - * - * ```js - * util.types.isStringObject('foo'); // Returns false - * util.types.isStringObject(new String('foo')); // Returns true - * ``` - * @since v10.0.0 - */ - function isStringObject(object: unknown): object is String; - /** - * Returns `true` if the value is a symbol object, created - * by calling `Object()` on a `Symbol` primitive. - * - * ```js - * const symbol = Symbol('foo'); - * util.types.isSymbolObject(symbol); // Returns false - * util.types.isSymbolObject(Object(symbol)); // Returns true - * ``` - * @since v10.0.0 - */ - function isSymbolObject(object: unknown): object is Symbol; - /** - * Returns `true` if the value is a built-in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) instance. - * - * ```js - * util.types.isTypedArray(new ArrayBuffer()); // Returns false - * util.types.isTypedArray(new Uint8Array()); // Returns true - * util.types.isTypedArray(new Float64Array()); // Returns true - * ``` - * - * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). - * @since v10.0.0 - */ - function isTypedArray(object: unknown): object is NodeJS.TypedArray; - /** - * Returns `true` if the value is a built-in [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instance. - * - * ```js - * util.types.isUint8Array(new ArrayBuffer()); // Returns false - * util.types.isUint8Array(new Uint8Array()); // Returns true - * util.types.isUint8Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isUint8Array(object: unknown): object is Uint8Array; - /** - * Returns `true` if the value is a built-in [`Uint8ClampedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) instance. - * - * ```js - * util.types.isUint8ClampedArray(new ArrayBuffer()); // Returns false - * util.types.isUint8ClampedArray(new Uint8ClampedArray()); // Returns true - * util.types.isUint8ClampedArray(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray; - /** - * Returns `true` if the value is a built-in [`Uint16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) instance. - * - * ```js - * util.types.isUint16Array(new ArrayBuffer()); // Returns false - * util.types.isUint16Array(new Uint16Array()); // Returns true - * util.types.isUint16Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isUint16Array(object: unknown): object is Uint16Array; - /** - * Returns `true` if the value is a built-in [`Uint32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) instance. - * - * ```js - * util.types.isUint32Array(new ArrayBuffer()); // Returns false - * util.types.isUint32Array(new Uint32Array()); // Returns true - * util.types.isUint32Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isUint32Array(object: unknown): object is Uint32Array; - /** - * Returns `true` if the value is a built-in [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) instance. - * - * ```js - * util.types.isWeakMap(new WeakMap()); // Returns true - * ``` - * @since v10.0.0 - */ - function isWeakMap(object: unknown): object is WeakMap; - /** - * Returns `true` if the value is a built-in [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) instance. - * - * ```js - * util.types.isWeakSet(new WeakSet()); // Returns true - * ``` - * @since v10.0.0 - */ - function isWeakSet(object: unknown): object is WeakSet; - /** - * Returns `true` if `value` is a `KeyObject`, `false` otherwise. - * @since v16.2.0 - */ - function isKeyObject(object: unknown): object is KeyObject; - /** - * Returns `true` if `value` is a `CryptoKey`, `false` otherwise. - * @since v16.2.0 - */ - function isCryptoKey(object: unknown): object is webcrypto.CryptoKey; -} -declare module "node:util" { - export * from "util"; -} -declare module "node:util/types" { - export * from "util/types"; -} diff --git a/node_modules/@types/node/v8.d.ts b/node_modules/@types/node/v8.d.ts deleted file mode 100644 index 34006cd..0000000 --- a/node_modules/@types/node/v8.d.ts +++ /dev/null @@ -1,920 +0,0 @@ -/** - * The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using: - * - * ```js - * import v8 from 'node:v8'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/v8.js) - */ -declare module "v8" { - import { NonSharedBuffer } from "node:buffer"; - import { Readable } from "node:stream"; - interface HeapSpaceInfo { - space_name: string; - space_size: number; - space_used_size: number; - space_available_size: number; - physical_space_size: number; - } - // ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */ - type DoesZapCodeSpaceFlag = 0 | 1; - interface HeapInfo { - total_heap_size: number; - total_heap_size_executable: number; - total_physical_size: number; - total_available_size: number; - used_heap_size: number; - heap_size_limit: number; - malloced_memory: number; - peak_malloced_memory: number; - does_zap_garbage: DoesZapCodeSpaceFlag; - number_of_native_contexts: number; - number_of_detached_contexts: number; - total_global_handles_size: number; - used_global_handles_size: number; - external_memory: number; - } - interface HeapCodeStatistics { - code_and_metadata_size: number; - bytecode_and_metadata_size: number; - external_script_source_size: number; - } - interface HeapSnapshotOptions { - /** - * If true, expose internals in the heap snapshot. - * @default false - */ - exposeInternals?: boolean | undefined; - /** - * If true, expose numeric values in artificial fields. - * @default false - */ - exposeNumericValues?: boolean | undefined; - } - /** - * Returns an integer representing a version tag derived from the V8 version, - * command-line flags, and detected CPU features. This is useful for determining - * whether a `vm.Script` `cachedData` buffer is compatible with this instance - * of V8. - * - * ```js - * console.log(v8.cachedDataVersionTag()); // 3947234607 - * // The value returned by v8.cachedDataVersionTag() is derived from the V8 - * // version, command-line flags, and detected CPU features. Test that the value - * // does indeed update when flags are toggled. - * v8.setFlagsFromString('--allow_natives_syntax'); - * console.log(v8.cachedDataVersionTag()); // 183726201 - * ``` - * @since v8.0.0 - */ - function cachedDataVersionTag(): number; - /** - * Returns an object with the following properties: - * - * `does_zap_garbage` is a 0/1 boolean, which signifies whether the `--zap_code_space` option is enabled or not. This makes V8 overwrite heap - * garbage with a bit pattern. The RSS footprint (resident set size) gets bigger - * because it continuously touches all heap pages and that makes them less likely - * to get swapped out by the operating system. - * - * `number_of_native_contexts` The value of native\_context is the number of the - * top-level contexts currently active. Increase of this number over time indicates - * a memory leak. - * - * `number_of_detached_contexts` The value of detached\_context is the number - * of contexts that were detached and not yet garbage collected. This number - * being non-zero indicates a potential memory leak. - * - * `total_global_handles_size` The value of total\_global\_handles\_size is the - * total memory size of V8 global handles. - * - * `used_global_handles_size` The value of used\_global\_handles\_size is the - * used memory size of V8 global handles. - * - * `external_memory` The value of external\_memory is the memory size of array - * buffers and external strings. - * - * ```js - * { - * total_heap_size: 7326976, - * total_heap_size_executable: 4194304, - * total_physical_size: 7326976, - * total_available_size: 1152656, - * used_heap_size: 3476208, - * heap_size_limit: 1535115264, - * malloced_memory: 16384, - * peak_malloced_memory: 1127496, - * does_zap_garbage: 0, - * number_of_native_contexts: 1, - * number_of_detached_contexts: 0, - * total_global_handles_size: 8192, - * used_global_handles_size: 3296, - * external_memory: 318824 - * } - * ``` - * @since v1.0.0 - */ - function getHeapStatistics(): HeapInfo; - /** - * It returns an object with a structure similar to the - * [`cppgc::HeapStatistics`](https://v8docs.nodesource.com/node-22.4/d7/d51/heap-statistics_8h_source.html) - * object. See the [V8 documentation](https://v8docs.nodesource.com/node-22.4/df/d2f/structcppgc_1_1_heap_statistics.html) - * for more information about the properties of the object. - * - * ```js - * // Detailed - * ({ - * committed_size_bytes: 131072, - * resident_size_bytes: 131072, - * used_size_bytes: 152, - * space_statistics: [ - * { - * name: 'NormalPageSpace0', - * committed_size_bytes: 0, - * resident_size_bytes: 0, - * used_size_bytes: 0, - * page_stats: [{}], - * free_list_stats: {}, - * }, - * { - * name: 'NormalPageSpace1', - * committed_size_bytes: 131072, - * resident_size_bytes: 131072, - * used_size_bytes: 152, - * page_stats: [{}], - * free_list_stats: {}, - * }, - * { - * name: 'NormalPageSpace2', - * committed_size_bytes: 0, - * resident_size_bytes: 0, - * used_size_bytes: 0, - * page_stats: [{}], - * free_list_stats: {}, - * }, - * { - * name: 'NormalPageSpace3', - * committed_size_bytes: 0, - * resident_size_bytes: 0, - * used_size_bytes: 0, - * page_stats: [{}], - * free_list_stats: {}, - * }, - * { - * name: 'LargePageSpace', - * committed_size_bytes: 0, - * resident_size_bytes: 0, - * used_size_bytes: 0, - * page_stats: [{}], - * free_list_stats: {}, - * }, - * ], - * type_names: [], - * detail_level: 'detailed', - * }); - * ``` - * - * ```js - * // Brief - * ({ - * committed_size_bytes: 131072, - * resident_size_bytes: 131072, - * used_size_bytes: 128864, - * space_statistics: [], - * type_names: [], - * detail_level: 'brief', - * }); - * ``` - * @since v22.15.0 - * @param detailLevel **Default:** `'detailed'`. Specifies the level of detail in the returned statistics. - * Accepted values are: - * * `'brief'`: Brief statistics contain only the top-level - * allocated and used - * memory statistics for the entire heap. - * * `'detailed'`: Detailed statistics also contain a break - * down per space and page, as well as freelist statistics - * and object type histograms. - */ - function getCppHeapStatistics(detailLevel?: "brief" | "detailed"): object; - /** - * Returns statistics about the V8 heap spaces, i.e. the segments which make up - * the V8 heap. Neither the ordering of heap spaces, nor the availability of a - * heap space can be guaranteed as the statistics are provided via the - * V8 [`GetHeapSpaceStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4) function and may change from one V8 version to the - * next. - * - * The value returned is an array of objects containing the following properties: - * - * ```json - * [ - * { - * "space_name": "new_space", - * "space_size": 2063872, - * "space_used_size": 951112, - * "space_available_size": 80824, - * "physical_space_size": 2063872 - * }, - * { - * "space_name": "old_space", - * "space_size": 3090560, - * "space_used_size": 2493792, - * "space_available_size": 0, - * "physical_space_size": 3090560 - * }, - * { - * "space_name": "code_space", - * "space_size": 1260160, - * "space_used_size": 644256, - * "space_available_size": 960, - * "physical_space_size": 1260160 - * }, - * { - * "space_name": "map_space", - * "space_size": 1094160, - * "space_used_size": 201608, - * "space_available_size": 0, - * "physical_space_size": 1094160 - * }, - * { - * "space_name": "large_object_space", - * "space_size": 0, - * "space_used_size": 0, - * "space_available_size": 1490980608, - * "physical_space_size": 0 - * } - * ] - * ``` - * @since v6.0.0 - */ - function getHeapSpaceStatistics(): HeapSpaceInfo[]; - /** - * The `v8.setFlagsFromString()` method can be used to programmatically set - * V8 command-line flags. This method should be used with care. Changing settings - * after the VM has started may result in unpredictable behavior, including - * crashes and data loss; or it may simply do nothing. - * - * The V8 options available for a version of Node.js may be determined by running `node --v8-options`. - * - * Usage: - * - * ```js - * // Print GC events to stdout for one minute. - * import v8 from 'node:v8'; - * v8.setFlagsFromString('--trace_gc'); - * setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3); - * ``` - * @since v1.0.0 - */ - function setFlagsFromString(flags: string): void; - /** - * This is similar to the [`queryObjects()` console API](https://developer.chrome.com/docs/devtools/console/utilities#queryObjects-function) - * provided by the Chromium DevTools console. It can be used to search for objects that have the matching constructor on its prototype chain - * in the heap after a full garbage collection, which can be useful for memory leak regression tests. To avoid surprising results, users should - * avoid using this API on constructors whose implementation they don't control, or on constructors that can be invoked by other parties in the - * application. - * - * To avoid accidental leaks, this API does not return raw references to the objects found. By default, it returns the count of the objects - * found. If `options.format` is `'summary'`, it returns an array containing brief string representations for each object. The visibility provided - * in this API is similar to what the heap snapshot provides, while users can save the cost of serialization and parsing and directly filter the - * target objects during the search. - * - * Only objects created in the current execution context are included in the results. - * - * ```js - * import { queryObjects } from 'node:v8'; - * class A { foo = 'bar'; } - * console.log(queryObjects(A)); // 0 - * const a = new A(); - * console.log(queryObjects(A)); // 1 - * // [ "A { foo: 'bar' }" ] - * console.log(queryObjects(A, { format: 'summary' })); - * - * class B extends A { bar = 'qux'; } - * const b = new B(); - * console.log(queryObjects(B)); // 1 - * // [ "B { foo: 'bar', bar: 'qux' }" ] - * console.log(queryObjects(B, { format: 'summary' })); - * - * // Note that, when there are child classes inheriting from a constructor, - * // the constructor also shows up in the prototype chain of the child - * // classes's prototoype, so the child classes's prototoype would also be - * // included in the result. - * console.log(queryObjects(A)); // 3 - * // [ "B { foo: 'bar', bar: 'qux' }", 'A {}', "A { foo: 'bar' }" ] - * console.log(queryObjects(A, { format: 'summary' })); - * ``` - * @param ctor The constructor that can be used to search on the prototype chain in order to filter target objects in the heap. - * @since v20.13.0 - * @experimental - */ - function queryObjects(ctor: Function): number | string[]; - function queryObjects(ctor: Function, options: { format: "count" }): number; - function queryObjects(ctor: Function, options: { format: "summary" }): string[]; - /** - * Generates a snapshot of the current V8 heap and returns a Readable - * Stream that may be used to read the JSON serialized representation. - * This JSON stream format is intended to be used with tools such as - * Chrome DevTools. The JSON schema is undocumented and specific to the - * V8 engine. Therefore, the schema may change from one version of V8 to the next. - * - * Creating a heap snapshot requires memory about twice the size of the heap at - * the time the snapshot is created. This results in the risk of OOM killers - * terminating the process. - * - * Generating a snapshot is a synchronous operation which blocks the event loop - * for a duration depending on the heap size. - * - * ```js - * // Print heap snapshot to the console - * import v8 from 'node:v8'; - * const stream = v8.getHeapSnapshot(); - * stream.pipe(process.stdout); - * ``` - * @since v11.13.0 - * @return A Readable containing the V8 heap snapshot. - */ - function getHeapSnapshot(options?: HeapSnapshotOptions): Readable; - /** - * Generates a snapshot of the current V8 heap and writes it to a JSON - * file. This file is intended to be used with tools such as Chrome - * DevTools. The JSON schema is undocumented and specific to the V8 - * engine, and may change from one version of V8 to the next. - * - * A heap snapshot is specific to a single V8 isolate. When using `worker threads`, a heap snapshot generated from the main thread will - * not contain any information about the workers, and vice versa. - * - * Creating a heap snapshot requires memory about twice the size of the heap at - * the time the snapshot is created. This results in the risk of OOM killers - * terminating the process. - * - * Generating a snapshot is a synchronous operation which blocks the event loop - * for a duration depending on the heap size. - * - * ```js - * import { writeHeapSnapshot } from 'node:v8'; - * import { - * Worker, - * isMainThread, - * parentPort, - * } from 'node:worker_threads'; - * - * if (isMainThread) { - * const worker = new Worker(__filename); - * - * worker.once('message', (filename) => { - * console.log(`worker heapdump: ${filename}`); - * // Now get a heapdump for the main thread. - * console.log(`main thread heapdump: ${writeHeapSnapshot()}`); - * }); - * - * // Tell the worker to create a heapdump. - * worker.postMessage('heapdump'); - * } else { - * parentPort.once('message', (message) => { - * if (message === 'heapdump') { - * // Generate a heapdump for the worker - * // and return the filename to the parent. - * parentPort.postMessage(writeHeapSnapshot()); - * } - * }); - * } - * ``` - * @since v11.13.0 - * @param filename The file path where the V8 heap snapshot is to be saved. If not specified, a file name with the pattern `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be - * generated, where `{pid}` will be the PID of the Node.js process, `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from the main Node.js thread or the id of a - * worker thread. - * @return The filename where the snapshot was saved. - */ - function writeHeapSnapshot(filename?: string, options?: HeapSnapshotOptions): string; - /** - * Get statistics about code and its metadata in the heap, see - * V8 [`GetHeapCodeAndMetadataStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866) API. Returns an object with the - * following properties: - * - * ```js - * { - * code_and_metadata_size: 212208, - * bytecode_and_metadata_size: 161368, - * external_script_source_size: 1410794, - * cpu_profiler_metadata_size: 0, - * } - * ``` - * @since v12.8.0 - */ - function getHeapCodeStatistics(): HeapCodeStatistics; - /** - * V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string. - * If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true; - * otherwise, it returns false. - * - * If this method returns false, that does not mean that the string contains some characters not in `Latin-1/ISO-8859-1`. - * Sometimes a `Latin-1` string may also be represented as `UTF16`. - * - * ```js - * const { isStringOneByteRepresentation } = require('node:v8'); - * - * const Encoding = { - * latin1: 1, - * utf16le: 2, - * }; - * const buffer = Buffer.alloc(100); - * function writeString(input) { - * if (isStringOneByteRepresentation(input)) { - * buffer.writeUint8(Encoding.latin1); - * buffer.writeUint32LE(input.length, 1); - * buffer.write(input, 5, 'latin1'); - * } else { - * buffer.writeUint8(Encoding.utf16le); - * buffer.writeUint32LE(input.length * 2, 1); - * buffer.write(input, 5, 'utf16le'); - * } - * } - * writeString('hello'); - * writeString('你好'); - * ``` - * @since v22.15.0 - */ - function isStringOneByteRepresentation(content: string): boolean; - /** - * @since v8.0.0 - */ - class Serializer { - /** - * Writes out a header, which includes the serialization format version. - */ - writeHeader(): void; - /** - * Serializes a JavaScript value and adds the serialized representation to the - * internal buffer. - * - * This throws an error if `value` cannot be serialized. - */ - writeValue(val: any): boolean; - /** - * Returns the stored internal buffer. This serializer should not be used once - * the buffer is released. Calling this method results in undefined behavior - * if a previous write has failed. - */ - releaseBuffer(): NonSharedBuffer; - /** - * Marks an `ArrayBuffer` as having its contents transferred out of band. - * Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`. - * @param id A 32-bit unsigned integer. - * @param arrayBuffer An `ArrayBuffer` instance. - */ - transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; - /** - * Write a raw 32-bit unsigned integer. - * For use inside of a custom `serializer._writeHostObject()`. - */ - writeUint32(value: number): void; - /** - * Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. - * For use inside of a custom `serializer._writeHostObject()`. - */ - writeUint64(hi: number, lo: number): void; - /** - * Write a JS `number` value. - * For use inside of a custom `serializer._writeHostObject()`. - */ - writeDouble(value: number): void; - /** - * Write raw bytes into the serializer's internal buffer. The deserializer - * will require a way to compute the length of the buffer. - * For use inside of a custom `serializer._writeHostObject()`. - */ - writeRawBytes(buffer: NodeJS.ArrayBufferView): void; - } - /** - * A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only - * stores the part of their underlying `ArrayBuffer`s that they are referring to. - * @since v8.0.0 - */ - class DefaultSerializer extends Serializer {} - /** - * @since v8.0.0 - */ - class Deserializer { - constructor(data: NodeJS.TypedArray); - /** - * Reads and validates a header (including the format version). - * May, for example, reject an invalid or unsupported wire format. In that case, - * an `Error` is thrown. - */ - readHeader(): boolean; - /** - * Deserializes a JavaScript value from the buffer and returns it. - */ - readValue(): any; - /** - * Marks an `ArrayBuffer` as having its contents transferred out of band. - * Pass the corresponding `ArrayBuffer` in the serializing context to `serializer.transferArrayBuffer()` (or return the `id` from `serializer._getSharedArrayBufferId()` in the case of - * `SharedArrayBuffer`s). - * @param id A 32-bit unsigned integer. - * @param arrayBuffer An `ArrayBuffer` instance. - */ - transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; - /** - * Reads the underlying wire format version. Likely mostly to be useful to - * legacy code reading old wire format versions. May not be called before `.readHeader()`. - */ - getWireFormatVersion(): number; - /** - * Read a raw 32-bit unsigned integer and return it. - * For use inside of a custom `deserializer._readHostObject()`. - */ - readUint32(): number; - /** - * Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]` with two 32-bit unsigned integer entries. - * For use inside of a custom `deserializer._readHostObject()`. - */ - readUint64(): [number, number]; - /** - * Read a JS `number` value. - * For use inside of a custom `deserializer._readHostObject()`. - */ - readDouble(): number; - /** - * Read raw bytes from the deserializer's internal buffer. The `length` parameter - * must correspond to the length of the buffer that was passed to `serializer.writeRawBytes()`. - * For use inside of a custom `deserializer._readHostObject()`. - */ - readRawBytes(length: number): Buffer; - } - /** - * A subclass of `Deserializer` corresponding to the format written by `DefaultSerializer`. - * @since v8.0.0 - */ - class DefaultDeserializer extends Deserializer {} - /** - * Uses a `DefaultSerializer` to serialize `value` into a buffer. - * - * `ERR_BUFFER_TOO_LARGE` will be thrown when trying to - * serialize a huge object which requires buffer - * larger than `buffer.constants.MAX_LENGTH`. - * @since v8.0.0 - */ - function serialize(value: any): NonSharedBuffer; - /** - * Uses a `DefaultDeserializer` with default options to read a JS value - * from a buffer. - * @since v8.0.0 - * @param buffer A buffer returned by {@link serialize}. - */ - function deserialize(buffer: NodeJS.ArrayBufferView): any; - /** - * The `v8.takeCoverage()` method allows the user to write the coverage started by `NODE_V8_COVERAGE` to disk on demand. This method can be invoked multiple - * times during the lifetime of the process. Each time the execution counter will - * be reset and a new coverage report will be written to the directory specified - * by `NODE_V8_COVERAGE`. - * - * When the process is about to exit, one last coverage will still be written to - * disk unless {@link stopCoverage} is invoked before the process exits. - * @since v15.1.0, v14.18.0, v12.22.0 - */ - function takeCoverage(): void; - /** - * The `v8.stopCoverage()` method allows the user to stop the coverage collection - * started by `NODE_V8_COVERAGE`, so that V8 can release the execution count - * records and optimize code. This can be used in conjunction with {@link takeCoverage} if the user wants to collect the coverage on demand. - * @since v15.1.0, v14.18.0, v12.22.0 - */ - function stopCoverage(): void; - /** - * The API is a no-op if `--heapsnapshot-near-heap-limit` is already set from the command line or the API is called more than once. - * `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information. - * @since v18.10.0, v16.18.0 - */ - function setHeapSnapshotNearHeapLimit(limit: number): void; - /** - * This API collects GC data in current thread. - * @since v19.6.0, v18.15.0 - */ - class GCProfiler { - /** - * Start collecting GC data. - * @since v19.6.0, v18.15.0 - */ - start(): void; - /** - * Stop collecting GC data and return an object. The content of object - * is as follows. - * - * ```json - * { - * "version": 1, - * "startTime": 1674059033862, - * "statistics": [ - * { - * "gcType": "Scavenge", - * "beforeGC": { - * "heapStatistics": { - * "totalHeapSize": 5005312, - * "totalHeapSizeExecutable": 524288, - * "totalPhysicalSize": 5226496, - * "totalAvailableSize": 4341325216, - * "totalGlobalHandlesSize": 8192, - * "usedGlobalHandlesSize": 2112, - * "usedHeapSize": 4883840, - * "heapSizeLimit": 4345298944, - * "mallocedMemory": 254128, - * "externalMemory": 225138, - * "peakMallocedMemory": 181760 - * }, - * "heapSpaceStatistics": [ - * { - * "spaceName": "read_only_space", - * "spaceSize": 0, - * "spaceUsedSize": 0, - * "spaceAvailableSize": 0, - * "physicalSpaceSize": 0 - * } - * ] - * }, - * "cost": 1574.14, - * "afterGC": { - * "heapStatistics": { - * "totalHeapSize": 6053888, - * "totalHeapSizeExecutable": 524288, - * "totalPhysicalSize": 5500928, - * "totalAvailableSize": 4341101384, - * "totalGlobalHandlesSize": 8192, - * "usedGlobalHandlesSize": 2112, - * "usedHeapSize": 4059096, - * "heapSizeLimit": 4345298944, - * "mallocedMemory": 254128, - * "externalMemory": 225138, - * "peakMallocedMemory": 181760 - * }, - * "heapSpaceStatistics": [ - * { - * "spaceName": "read_only_space", - * "spaceSize": 0, - * "spaceUsedSize": 0, - * "spaceAvailableSize": 0, - * "physicalSpaceSize": 0 - * } - * ] - * } - * } - * ], - * "endTime": 1674059036865 - * } - * ``` - * - * Here's an example. - * - * ```js - * import { GCProfiler } from 'node:v8'; - * const profiler = new GCProfiler(); - * profiler.start(); - * setTimeout(() => { - * console.log(profiler.stop()); - * }, 1000); - * ``` - * @since v19.6.0, v18.15.0 - */ - stop(): GCProfilerResult; - } - interface GCProfilerResult { - version: number; - startTime: number; - endTime: number; - statistics: Array<{ - gcType: string; - cost: number; - beforeGC: { - heapStatistics: HeapStatistics; - heapSpaceStatistics: HeapSpaceStatistics[]; - }; - afterGC: { - heapStatistics: HeapStatistics; - heapSpaceStatistics: HeapSpaceStatistics[]; - }; - }>; - } - interface HeapStatistics { - totalHeapSize: number; - totalHeapSizeExecutable: number; - totalPhysicalSize: number; - totalAvailableSize: number; - totalGlobalHandlesSize: number; - usedGlobalHandlesSize: number; - usedHeapSize: number; - heapSizeLimit: number; - mallocedMemory: number; - externalMemory: number; - peakMallocedMemory: number; - } - interface HeapSpaceStatistics { - spaceName: string; - spaceSize: number; - spaceUsedSize: number; - spaceAvailableSize: number; - physicalSpaceSize: number; - } - /** - * Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will - * happen if a promise is created without ever getting a continuation. - * @since v17.1.0, v16.14.0 - * @param promise The promise being created. - * @param parent The promise continued from, if applicable. - */ - interface Init { - (promise: Promise, parent: Promise): void; - } - /** - * Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an await resuming. - * - * The before callback will be called 0 to N times. The before callback will typically be called 0 times if no continuation was ever made for the promise. - * The before callback may be called many times in the case where many continuations have been made from the same promise. - * @since v17.1.0, v16.14.0 - */ - interface Before { - (promise: Promise): void; - } - /** - * Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an await after another await. - * @since v17.1.0, v16.14.0 - */ - interface After { - (promise: Promise): void; - } - /** - * Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of {@link Promise.resolve()} or - * {@link Promise.reject()}. - * @since v17.1.0, v16.14.0 - */ - interface Settled { - (promise: Promise): void; - } - /** - * Key events in the lifetime of a promise have been categorized into four areas: creation of a promise, before/after a continuation handler is called or - * around an await, and when the promise resolves or rejects. - * - * Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and - * `settled()` callbacks must not be async functions as they create more promises which would produce an infinite loop. - * @since v17.1.0, v16.14.0 - */ - interface HookCallbacks { - init?: Init; - before?: Before; - after?: After; - settled?: Settled; - } - interface PromiseHooks { - /** - * The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. - * @since v17.1.0, v16.14.0 - * @param init The {@link Init | `init` callback} to call when a promise is created. - * @return Call to stop the hook. - */ - onInit: (init: Init) => Function; - /** - * The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. - * @since v17.1.0, v16.14.0 - * @param settled The {@link Settled | `settled` callback} to call when a promise is created. - * @return Call to stop the hook. - */ - onSettled: (settled: Settled) => Function; - /** - * The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. - * @since v17.1.0, v16.14.0 - * @param before The {@link Before | `before` callback} to call before a promise continuation executes. - * @return Call to stop the hook. - */ - onBefore: (before: Before) => Function; - /** - * The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. - * @since v17.1.0, v16.14.0 - * @param after The {@link After | `after` callback} to call after a promise continuation executes. - * @return Call to stop the hook. - */ - onAfter: (after: After) => Function; - /** - * Registers functions to be called for different lifetime events of each promise. - * The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime. - * All callbacks are optional. For example, if only promise creation needs to be tracked, then only the init callback needs to be passed. - * The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop. - * @since v17.1.0, v16.14.0 - * @param callbacks The {@link HookCallbacks | Hook Callbacks} to register - * @return Used for disabling hooks - */ - createHook: (callbacks: HookCallbacks) => Function; - } - /** - * The `promiseHooks` interface can be used to track promise lifecycle events. - * @since v17.1.0, v16.14.0 - */ - const promiseHooks: PromiseHooks; - type StartupSnapshotCallbackFn = (args: any) => any; - /** - * The `v8.startupSnapshot` interface can be used to add serialization and deserialization hooks for custom startup snapshots. - * - * ```bash - * $ node --snapshot-blob snapshot.blob --build-snapshot entry.js - * # This launches a process with the snapshot - * $ node --snapshot-blob snapshot.blob - * ``` - * - * In the example above, `entry.js` can use methods from the `v8.startupSnapshot` interface to specify how to save information for custom objects - * in the snapshot during serialization and how the information can be used to synchronize these objects during deserialization of the snapshot. - * For example, if the `entry.js` contains the following script: - * - * ```js - * 'use strict'; - * - * import fs from 'node:fs'; - * import zlib from 'node:zlib'; - * import path from 'node:path'; - * import assert from 'node:assert'; - * - * import v8 from 'node:v8'; - * - * class BookShelf { - * storage = new Map(); - * - * // Reading a series of files from directory and store them into storage. - * constructor(directory, books) { - * for (const book of books) { - * this.storage.set(book, fs.readFileSync(path.join(directory, book))); - * } - * } - * - * static compressAll(shelf) { - * for (const [ book, content ] of shelf.storage) { - * shelf.storage.set(book, zlib.gzipSync(content)); - * } - * } - * - * static decompressAll(shelf) { - * for (const [ book, content ] of shelf.storage) { - * shelf.storage.set(book, zlib.gunzipSync(content)); - * } - * } - * } - * - * // __dirname here is where the snapshot script is placed - * // during snapshot building time. - * const shelf = new BookShelf(__dirname, [ - * 'book1.en_US.txt', - * 'book1.es_ES.txt', - * 'book2.zh_CN.txt', - * ]); - * - * assert(v8.startupSnapshot.isBuildingSnapshot()); - * // On snapshot serialization, compress the books to reduce size. - * v8.startupSnapshot.addSerializeCallback(BookShelf.compressAll, shelf); - * // On snapshot deserialization, decompress the books. - * v8.startupSnapshot.addDeserializeCallback(BookShelf.decompressAll, shelf); - * v8.startupSnapshot.setDeserializeMainFunction((shelf) => { - * // process.env and process.argv are refreshed during snapshot - * // deserialization. - * const lang = process.env.BOOK_LANG || 'en_US'; - * const book = process.argv[1]; - * const name = `${book}.${lang}.txt`; - * console.log(shelf.storage.get(name)); - * }, shelf); - * ``` - * - * The resulted binary will get print the data deserialized from the snapshot during start up, using the refreshed `process.env` and `process.argv` of the launched process: - * - * ```bash - * $ BOOK_LANG=es_ES node --snapshot-blob snapshot.blob book1 - * # Prints content of book1.es_ES.txt deserialized from the snapshot. - * ``` - * - * Currently the application deserialized from a user-land snapshot cannot be snapshotted again, so these APIs are only available to applications that are not deserialized from a user-land snapshot. - * - * @since v18.6.0, v16.17.0 - */ - namespace startupSnapshot { - /** - * Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit. - * This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization. - * @since v18.6.0, v16.17.0 - */ - function addSerializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void; - /** - * Add a callback that will be called when the Node.js instance is deserialized from a snapshot. - * The `callback` and the `data` (if provided) will be serialized into the snapshot, they can be used to re-initialize the state of the application or - * to re-acquire resources that the application needs when the application is restarted from the snapshot. - * @since v18.6.0, v16.17.0 - */ - function addDeserializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void; - /** - * This sets the entry point of the Node.js application when it is deserialized from a snapshot. This can be called only once in the snapshot building script. - * If called, the deserialized application no longer needs an additional entry point script to start up and will simply invoke the callback along with the deserialized - * data (if provided), otherwise an entry point script still needs to be provided to the deserialized application. - * @since v18.6.0, v16.17.0 - */ - function setDeserializeMainFunction(callback: StartupSnapshotCallbackFn, data?: any): void; - /** - * Returns true if the Node.js instance is run to build a snapshot. - * @since v18.6.0, v16.17.0 - */ - function isBuildingSnapshot(): boolean; - } -} -declare module "node:v8" { - export * from "v8"; -} diff --git a/node_modules/@types/node/vm.d.ts b/node_modules/@types/node/vm.d.ts deleted file mode 100644 index a2609bf..0000000 --- a/node_modules/@types/node/vm.d.ts +++ /dev/null @@ -1,1000 +0,0 @@ -/** - * The `node:vm` module enables compiling and running code within V8 Virtual - * Machine contexts. - * - * **The `node:vm` module is not a security** - * **mechanism. Do not use it to run untrusted code.** - * - * JavaScript code can be compiled and run immediately or - * compiled, saved, and run later. - * - * A common use case is to run the code in a different V8 Context. This means - * invoked code has a different global object than the invoking code. - * - * One can provide the context by `contextifying` an - * object. The invoked code treats any property in the context like a - * global variable. Any changes to global variables caused by the invoked - * code are reflected in the context object. - * - * ```js - * import vm from 'node:vm'; - * - * const x = 1; - * - * const context = { x: 2 }; - * vm.createContext(context); // Contextify the object. - * - * const code = 'x += 40; var y = 17;'; - * // `x` and `y` are global variables in the context. - * // Initially, x has the value 2 because that is the value of context.x. - * vm.runInContext(code, context); - * - * console.log(context.x); // 42 - * console.log(context.y); // 17 - * - * console.log(x); // 1; y is not defined. - * ``` - * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/vm.js) - */ -declare module "vm" { - import { NonSharedBuffer } from "node:buffer"; - import { ImportAttributes } from "node:module"; - interface Context extends NodeJS.Dict {} - interface BaseOptions { - /** - * Specifies the filename used in stack traces produced by this script. - * @default '' - */ - filename?: string | undefined; - /** - * Specifies the line number offset that is displayed in stack traces produced by this script. - * @default 0 - */ - lineOffset?: number | undefined; - /** - * Specifies the column number offset that is displayed in stack traces produced by this script. - * @default 0 - */ - columnOffset?: number | undefined; - } - type DynamicModuleLoader = ( - specifier: string, - referrer: T, - importAttributes: ImportAttributes, - ) => Module | Promise; - interface ScriptOptions extends BaseOptions { - /** - * Provides an optional data with V8's code cache data for the supplied source. - */ - cachedData?: NodeJS.ArrayBufferView | undefined; - /** @deprecated in favor of `script.createCachedData()` */ - produceCachedData?: boolean | undefined; - /** - * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is - * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see - * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis). - */ - importModuleDynamically?: - | DynamicModuleLoader - -``` - -Open the above .html file in a browser and you should see - -Node Example - -**[Full online demo](http://kpdecker.github.com/jsdiff)** - -## Compatibility - -[![Sauce Test Status](https://saucelabs.com/browser-matrix/jsdiff.svg)](https://saucelabs.com/u/jsdiff) - -jsdiff supports all ES3 environments with some known issues on IE8 and below. Under these browsers some diff algorithms such as word diff and others may fail due to lack of support for capturing groups in the `split` operation. - -## License - -See [LICENSE](https://github.com/kpdecker/jsdiff/blob/master/LICENSE). diff --git a/node_modules/diff/dist/diff.js b/node_modules/diff/dist/diff.js deleted file mode 100644 index de800a3..0000000 --- a/node_modules/diff/dist/diff.js +++ /dev/null @@ -1,1548 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.Diff = {})); -}(this, function (exports) { 'use strict'; - - function Diff() {} - Diff.prototype = { - diff: function diff(oldString, newString) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var callback = options.callback; - - if (typeof options === 'function') { - callback = options; - options = {}; - } - - this.options = options; - var self = this; - - function done(value) { - if (callback) { - setTimeout(function () { - callback(undefined, value); - }, 0); - return true; - } else { - return value; - } - } // Allow subclasses to massage the input prior to running - - - oldString = this.castInput(oldString); - newString = this.castInput(newString); - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); - var newLen = newString.length, - oldLen = oldString.length; - var editLength = 1; - var maxEditLength = newLen + oldLen; - var bestPath = [{ - newPos: -1, - components: [] - }]; // Seed editLength = 0, i.e. the content starts with the same values - - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - - if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { - // Identity per the equality and tokenizer - return done([{ - value: this.join(newString), - count: newString.length - }]); - } // Main worker method. checks all permutations of a given edit length for acceptance. - - - function execEditLength() { - for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { - var basePath = void 0; - - var addPath = bestPath[diagonalPath - 1], - removePath = bestPath[diagonalPath + 1], - _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - - if (addPath) { - // No one else is going to attempt to use this value, clear it - bestPath[diagonalPath - 1] = undefined; - } - - var canAdd = addPath && addPath.newPos + 1 < newLen, - canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; - - if (!canAdd && !canRemove) { - // If this path is a terminal then prune - bestPath[diagonalPath] = undefined; - continue; - } // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin - // and does not pass the bounds of the diff graph - - - if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { - basePath = clonePath(removePath); - self.pushComponent(basePath.components, undefined, true); - } else { - basePath = addPath; // No need to clone, we've pulled it from the list - - basePath.newPos++; - self.pushComponent(basePath.components, true, undefined); - } - - _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done - - if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { - return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); - } else { - // Otherwise track this path as a potential candidate and continue. - bestPath[diagonalPath] = basePath; - } - } - - editLength++; - } // Performs the length of edit iteration. Is a bit fugly as this has to support the - // sync and async mode which is never fun. Loops over execEditLength until a value - // is produced. - - - if (callback) { - (function exec() { - setTimeout(function () { - // This should not happen, but we want to be safe. - - /* istanbul ignore next */ - if (editLength > maxEditLength) { - return callback(); - } - - if (!execEditLength()) { - exec(); - } - }, 0); - })(); - } else { - while (editLength <= maxEditLength) { - var ret = execEditLength(); - - if (ret) { - return ret; - } - } - } - }, - pushComponent: function pushComponent(components, added, removed) { - var last = components[components.length - 1]; - - if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length - 1] = { - count: last.count + 1, - added: added, - removed: removed - }; - } else { - components.push({ - count: 1, - added: added, - removed: removed - }); - } - }, - extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, - oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath, - commonCount = 0; - - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { - newPos++; - oldPos++; - commonCount++; - } - - if (commonCount) { - basePath.components.push({ - count: commonCount - }); - } - - basePath.newPos = newPos; - return oldPos; - }, - equals: function equals(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); - } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); - } - }, - removeEmpty: function removeEmpty(array) { - var ret = []; - - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - - return ret; - }, - castInput: function castInput(value) { - return value; - }, - tokenize: function tokenize(value) { - return value.split(''); - }, - join: function join(chars) { - return chars.join(''); - } - }; - - function buildValues(diff, components, newString, oldString, useLongestToken) { - var componentPos = 0, - componentLen = components.length, - newPos = 0, - oldPos = 0; - - for (; componentPos < componentLen; componentPos++) { - var component = components[componentPos]; - - if (!component.removed) { - if (!component.added && useLongestToken) { - var value = newString.slice(newPos, newPos + component.count); - value = value.map(function (value, i) { - var oldValue = oldString[oldPos + i]; - return oldValue.length > value.length ? oldValue : value; - }); - component.value = diff.join(value); - } else { - component.value = diff.join(newString.slice(newPos, newPos + component.count)); - } - - newPos += component.count; // Common case - - if (!component.added) { - oldPos += component.count; - } - } else { - component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; // Reverse add and remove so removes are output first to match common convention - // The diffing algorithm is tied to add then remove output and this is the simplest - // route to get the desired output with minimal overhead. - - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } - } - } // Special case handle for when one terminal is ignored (i.e. whitespace). - // For this case we merge the terminal into the prior string and drop the change. - // This is only available for string mode. - - - var lastComponent = components[componentLen - 1]; - - if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { - components[componentLen - 2].value += lastComponent.value; - components.pop(); - } - - return components; - } - - function clonePath(path) { - return { - newPos: path.newPos, - components: path.components.slice(0) - }; - } - - var characterDiff = new Diff(); - function diffChars(oldStr, newStr, options) { - return characterDiff.diff(oldStr, newStr, options); - } - - function generateOptions(options, defaults) { - if (typeof options === 'function') { - defaults.callback = options; - } else if (options) { - for (var name in options) { - /* istanbul ignore else */ - if (options.hasOwnProperty(name)) { - defaults[name] = options[name]; - } - } - } - - return defaults; - } - - // - // Ranges and exceptions: - // Latin-1 Supplement, 0080–00FF - // - U+00D7 × Multiplication sign - // - U+00F7 ÷ Division sign - // Latin Extended-A, 0100–017F - // Latin Extended-B, 0180–024F - // IPA Extensions, 0250–02AF - // Spacing Modifier Letters, 02B0–02FF - // - U+02C7 ˇ ˇ Caron - // - U+02D8 ˘ ˘ Breve - // - U+02D9 ˙ ˙ Dot Above - // - U+02DA ˚ ˚ Ring Above - // - U+02DB ˛ ˛ Ogonek - // - U+02DC ˜ ˜ Small Tilde - // - U+02DD ˝ ˝ Double Acute Accent - // Latin Extended Additional, 1E00–1EFF - - var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; - var reWhitespace = /\S/; - var wordDiff = new Diff(); - - wordDiff.equals = function (left, right) { - if (this.options.ignoreCase) { - left = left.toLowerCase(); - right = right.toLowerCase(); - } - - return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); - }; - - wordDiff.tokenize = function (value) { - var tokens = value.split(/(\s+|[()[\]{}'"]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. - - for (var i = 0; i < tokens.length - 1; i++) { - // If we have an empty string in the next field and we have only word chars before and after, merge - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; - } - } - - return tokens; - }; - - function diffWords(oldStr, newStr, options) { - options = generateOptions(options, { - ignoreWhitespace: true - }); - return wordDiff.diff(oldStr, newStr, options); - } - function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff.diff(oldStr, newStr, options); - } - - var lineDiff = new Diff(); - - lineDiff.tokenize = function (value) { - var retLines = [], - linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line - - if (!linesAndNewlines[linesAndNewlines.length - 1]) { - linesAndNewlines.pop(); - } // Merge the content and line separators into single tokens - - - for (var i = 0; i < linesAndNewlines.length; i++) { - var line = linesAndNewlines[i]; - - if (i % 2 && !this.options.newlineIsToken) { - retLines[retLines.length - 1] += line; - } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - - retLines.push(line); - } - } - - return retLines; - }; - - function diffLines(oldStr, newStr, callback) { - return lineDiff.diff(oldStr, newStr, callback); - } - function diffTrimmedLines(oldStr, newStr, callback) { - var options = generateOptions(callback, { - ignoreWhitespace: true - }); - return lineDiff.diff(oldStr, newStr, options); - } - - var sentenceDiff = new Diff(); - - sentenceDiff.tokenize = function (value) { - return value.split(/(\S.+?[.!?])(?=\s+|$)/); - }; - - function diffSentences(oldStr, newStr, callback) { - return sentenceDiff.diff(oldStr, newStr, callback); - } - - var cssDiff = new Diff(); - - cssDiff.tokenize = function (value) { - return value.split(/([{}:;,]|\s+)/); - }; - - function diffCss(oldStr, newStr, callback) { - return cssDiff.diff(oldStr, newStr, callback); - } - - function _typeof(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); - } - - function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); - } - - function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } - } - - function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); - } - - function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); - } - - var objectPrototypeToString = Object.prototype.toString; - var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a - // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - - jsonDiff.useLongestToken = true; - jsonDiff.tokenize = lineDiff.tokenize; - - jsonDiff.castInput = function (value) { - var _this$options = this.options, - undefinedReplacement = _this$options.undefinedReplacement, - _this$options$stringi = _this$options.stringifyReplacer, - stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) { - return typeof v === 'undefined' ? undefinedReplacement : v; - } : _this$options$stringi; - return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); - }; - - jsonDiff.equals = function (left, right) { - return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); - }; - - function diffJson(oldObj, newObj, options) { - return jsonDiff.diff(oldObj, newObj, options); - } // This function handles the presence of circular references by bailing out when encountering an - // object that is already on the "stack" of items being processed. Accepts an optional replacer - - function canonicalize(obj, stack, replacementStack, replacer, key) { - stack = stack || []; - replacementStack = replacementStack || []; - - if (replacer) { - obj = replacer(key, obj); - } - - var i; - - for (i = 0; i < stack.length; i += 1) { - if (stack[i] === obj) { - return replacementStack[i]; - } - } - - var canonicalizedObj; - - if ('[object Array]' === objectPrototypeToString.call(obj)) { - stack.push(obj); - canonicalizedObj = new Array(obj.length); - replacementStack.push(canonicalizedObj); - - for (i = 0; i < obj.length; i += 1) { - canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); - } - - stack.pop(); - replacementStack.pop(); - return canonicalizedObj; - } - - if (obj && obj.toJSON) { - obj = obj.toJSON(); - } - - if (_typeof(obj) === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - replacementStack.push(canonicalizedObj); - - var sortedKeys = [], - _key; - - for (_key in obj) { - /* istanbul ignore else */ - if (obj.hasOwnProperty(_key)) { - sortedKeys.push(_key); - } - } - - sortedKeys.sort(); - - for (i = 0; i < sortedKeys.length; i += 1) { - _key = sortedKeys[i]; - canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); - } - - stack.pop(); - replacementStack.pop(); - } else { - canonicalizedObj = obj; - } - - return canonicalizedObj; - } - - var arrayDiff = new Diff(); - - arrayDiff.tokenize = function (value) { - return value.slice(); - }; - - arrayDiff.join = arrayDiff.removeEmpty = function (value) { - return value; - }; - - function diffArrays(oldArr, newArr, callback) { - return arrayDiff.diff(oldArr, newArr, callback); - } - - function parsePatch(uniDiff) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], - list = [], - i = 0; - - function parseIndex() { - var index = {}; - list.push(index); // Parse diff metadata - - while (i < diffstr.length) { - var line = diffstr[i]; // File header found, end parsing diff metadata - - if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { - break; - } // Diff index - - - var headerMatch = /^(?:Index:|diff(?: -r \w+)+)\s+/.exec(line); - - if (headerMatch) { - index.index = line.substring(headerMatch[0].length).trim(); - } - - i++; - } // Parse file headers if they are defined. Unified diff requires them, but - // there's no technical issues to have an isolated hunk without file header - - - parseFileHeader(index); - parseFileHeader(index); // Parse hunks - - index.hunks = []; - - while (i < diffstr.length) { - var _line = diffstr[i]; - - if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { - break; - } else if (/^@@/.test(_line)) { - index.hunks.push(parseHunk()); - } else if (_line && options.strict) { - // Ignore unexpected content unless in strict mode - throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); - } else { - i++; - } - } - } // Parses the --- and +++ headers, if none are found, no lines - // are consumed. - - - function parseFileHeader(index) { - var fileHeaderMatch = /^(---|\+\+\+)\s+/.exec(diffstr[i]); - - if (fileHeaderMatch) { - var keyPrefix = fileHeaderMatch[1] === '---' ? 'old' : 'new'; - var data = diffstr[i].substring(3).trim().split('\t', 2); - var fileName = data[0].replace(/\\\\/g, '\\'); - - if (fileName.startsWith('"') && fileName.endsWith('"')) { - fileName = fileName.substr(1, fileName.length - 2); - } - - index[keyPrefix + 'FileName'] = fileName; - index[keyPrefix + 'Header'] = (data[1] || '').trim(); - i++; - } - } // Parses a hunk - // This assumes that we are at the start of a hunk. - - - function parseHunk() { - var chunkHeaderIndex = i, - chunkHeaderLine = diffstr[i++], - chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); - var hunk = { - oldStart: +chunkHeader[1], - oldLines: +chunkHeader[2] || 1, - newStart: +chunkHeader[3], - newLines: +chunkHeader[4] || 1, - lines: [], - linedelimiters: [] - }; - var addCount = 0, - removeCount = 0; - - for (; i < diffstr.length; i++) { - // Lines starting with '---' could be mistaken for the "remove line" operation - // But they could be the header for the next file. Therefore prune such cases out. - if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { - break; - } - - var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; - - if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { - hunk.lines.push(diffstr[i]); - hunk.linedelimiters.push(delimiters[i] || '\n'); - - if (operation === '+') { - addCount++; - } else if (operation === '-') { - removeCount++; - } else if (operation === ' ') { - addCount++; - removeCount++; - } - } else { - break; - } - } // Handle the empty block count case - - - if (!addCount && hunk.newLines === 1) { - hunk.newLines = 0; - } - - if (!removeCount && hunk.oldLines === 1) { - hunk.oldLines = 0; - } // Perform optional sanity checking - - - if (options.strict) { - if (addCount !== hunk.newLines) { - throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - - if (removeCount !== hunk.oldLines) { - throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - } - - return hunk; - } - - while (i < diffstr.length) { - parseIndex(); - } - - return list; - } - - // Iterator that traverses in the range of [min, max], stepping - // by distance from a given start position. I.e. for [0, 4], with - // start of 2, this will iterate 2, 3, 1, 4, 0. - function distanceIterator (start, minLine, maxLine) { - var wantForward = true, - backwardExhausted = false, - forwardExhausted = false, - localOffset = 1; - return function iterator() { - if (wantForward && !forwardExhausted) { - if (backwardExhausted) { - localOffset++; - } else { - wantForward = false; - } // Check if trying to fit beyond text length, and if not, check it fits - // after offset location (or desired location on first iteration) - - - if (start + localOffset <= maxLine) { - return localOffset; - } - - forwardExhausted = true; - } - - if (!backwardExhausted) { - if (!forwardExhausted) { - wantForward = true; - } // Check if trying to fit before text beginning, and if not, check it fits - // before offset location - - - if (minLine <= start - localOffset) { - return -localOffset++; - } - - backwardExhausted = true; - return iterator(); - } // We tried to fit hunk before text beginning and beyond text length, then - // hunk can't fit on the text. Return undefined - - }; - } - - function applyPatch(source, uniDiff) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - if (typeof uniDiff === 'string') { - uniDiff = parsePatch(uniDiff); - } - - if (Array.isArray(uniDiff)) { - if (uniDiff.length > 1) { - throw new Error('applyPatch only works with a single input.'); - } - - uniDiff = uniDiff[0]; - } // Apply the diff to the input - - - var lines = source.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], - hunks = uniDiff.hunks, - compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { - return line === patchContent; - }, - errorCount = 0, - fuzzFactor = options.fuzzFactor || 0, - minLine = 0, - offset = 0, - removeEOFNL, - addEOFNL; - /** - * Checks if the hunk exactly fits on the provided location - */ - - - function hunkFits(hunk, toPos) { - for (var j = 0; j < hunk.lines.length; j++) { - var line = hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line; - - if (operation === ' ' || operation === '-') { - // Context sanity check - if (!compareLine(toPos + 1, lines[toPos], operation, content)) { - errorCount++; - - if (errorCount > fuzzFactor) { - return false; - } - } - - toPos++; - } - } - - return true; - } // Search best fit offsets for each hunk based on the previous ones - - - for (var i = 0; i < hunks.length; i++) { - var hunk = hunks[i], - maxLine = lines.length - hunk.oldLines, - localOffset = 0, - toPos = offset + hunk.oldStart - 1; - var iterator = distanceIterator(toPos, minLine, maxLine); - - for (; localOffset !== undefined; localOffset = iterator()) { - if (hunkFits(hunk, toPos + localOffset)) { - hunk.offset = offset += localOffset; - break; - } - } - - if (localOffset === undefined) { - return false; - } // Set lower text limit to end of the current hunk, so next ones don't try - // to fit over already patched text - - - minLine = hunk.offset + hunk.oldStart + hunk.oldLines; - } // Apply patch hunks - - - var diffOffset = 0; - - for (var _i = 0; _i < hunks.length; _i++) { - var _hunk = hunks[_i], - _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; - - diffOffset += _hunk.newLines - _hunk.oldLines; - - if (_toPos < 0) { - // Creating a new file - _toPos = 0; - } - - for (var j = 0; j < _hunk.lines.length; j++) { - var line = _hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters[j]; - - if (operation === ' ') { - _toPos++; - } else if (operation === '-') { - lines.splice(_toPos, 1); - delimiters.splice(_toPos, 1); - /* istanbul ignore else */ - } else if (operation === '+') { - lines.splice(_toPos, 0, content); - delimiters.splice(_toPos, 0, delimiter); - _toPos++; - } else if (operation === '\\') { - var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; - - if (previousOperation === '+') { - removeEOFNL = true; - } else if (previousOperation === '-') { - addEOFNL = true; - } - } - } - } // Handle EOFNL insertion/removal - - - if (removeEOFNL) { - while (!lines[lines.length - 1]) { - lines.pop(); - delimiters.pop(); - } - } else if (addEOFNL) { - lines.push(''); - delimiters.push('\n'); - } - - for (var _k = 0; _k < lines.length - 1; _k++) { - lines[_k] = lines[_k] + delimiters[_k]; - } - - return lines.join(''); - } // Wrapper that supports multiple file patches via callbacks. - - function applyPatches(uniDiff, options) { - if (typeof uniDiff === 'string') { - uniDiff = parsePatch(uniDiff); - } - - var currentIndex = 0; - - function processIndex() { - var index = uniDiff[currentIndex++]; - - if (!index) { - return options.complete(); - } - - options.loadFile(index, function (err, data) { - if (err) { - return options.complete(err); - } - - var updatedContent = applyPatch(data, index, options); - options.patched(index, updatedContent, function (err) { - if (err) { - return options.complete(err); - } - - processIndex(); - }); - }); - } - - processIndex(); - } - - function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - if (!options) { - options = {}; - } - - if (typeof options.context === 'undefined') { - options.context = 4; - } - - var diff = diffLines(oldStr, newStr, options); - diff.push({ - value: '', - lines: [] - }); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function (entry) { - return ' ' + entry; - }); - } - - var hunks = []; - var oldRangeStart = 0, - newRangeStart = 0, - curRange = [], - oldLine = 1, - newLine = 1; - - var _loop = function _loop(i) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - var _curRange; - - // If we have previous context, start with that - if (!oldRangeStart) { - var prev = diff[i - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; - } - } // Output our changes - - - (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { - return (current.added ? '+' : '-') + entry; - }))); // Track the updated file position - - - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - // Identical context lines. Track line changes - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= options.context * 2 && i < diff.length - 2) { - var _curRange2; - - // Overlapping - (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); - } else { - var _curRange3; - - // end the range and output - var contextSize = Math.min(lines.length, options.context); - - (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); - - var hunk = { - oldStart: oldRangeStart, - oldLines: oldLine - oldRangeStart + contextSize, - newStart: newRangeStart, - newLines: newLine - newRangeStart + contextSize, - lines: curRange - }; - - if (i >= diff.length - 2 && lines.length <= options.context) { - // EOF is inside this hunk - var oldEOFNewline = /\n$/.test(oldStr); - var newEOFNewline = /\n$/.test(newStr); - var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; - - if (!oldEOFNewline && noNlBeforeAdds) { - // special case: old has no eol and no trailing context; no-nl can end up before adds - curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); - } - - if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { - curRange.push('\\ No newline at end of file'); - } - } - - hunks.push(hunk); - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; - } - } - - oldLine += lines.length; - newLine += lines.length; - } - }; - - for (var i = 0; i < diff.length; i++) { - _loop(i); - } - - return { - oldFileName: oldFileName, - newFileName: newFileName, - oldHeader: oldHeader, - newHeader: newHeader, - hunks: hunks - }; - } - function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); - var ret = []; - - if (oldFileName == newFileName) { - ret.push('Index: ' + oldFileName); - } - - ret.push('==================================================================='); - ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); - ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); - - for (var i = 0; i < diff.hunks.length; i++) { - var hunk = diff.hunks[i]; - ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); - ret.push.apply(ret, hunk.lines); - } - - return ret.join('\n') + '\n'; - } - function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { - return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); - } - - function arrayEqual(a, b) { - if (a.length !== b.length) { - return false; - } - - return arrayStartsWith(a, b); - } - function arrayStartsWith(array, start) { - if (start.length > array.length) { - return false; - } - - for (var i = 0; i < start.length; i++) { - if (start[i] !== array[i]) { - return false; - } - } - - return true; - } - - function calcLineCount(hunk) { - var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), - oldLines = _calcOldNewLineCount.oldLines, - newLines = _calcOldNewLineCount.newLines; - - if (oldLines !== undefined) { - hunk.oldLines = oldLines; - } else { - delete hunk.oldLines; - } - - if (newLines !== undefined) { - hunk.newLines = newLines; - } else { - delete hunk.newLines; - } - } - function merge(mine, theirs, base) { - mine = loadPatch(mine, base); - theirs = loadPatch(theirs, base); - var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. - // Leaving sanity checks on this to the API consumer that may know more about the - // meaning in their own context. - - if (mine.index || theirs.index) { - ret.index = mine.index || theirs.index; - } - - if (mine.newFileName || theirs.newFileName) { - if (!fileNameChanged(mine)) { - // No header or no change in ours, use theirs (and ours if theirs does not exist) - ret.oldFileName = theirs.oldFileName || mine.oldFileName; - ret.newFileName = theirs.newFileName || mine.newFileName; - ret.oldHeader = theirs.oldHeader || mine.oldHeader; - ret.newHeader = theirs.newHeader || mine.newHeader; - } else if (!fileNameChanged(theirs)) { - // No header or no change in theirs, use ours - ret.oldFileName = mine.oldFileName; - ret.newFileName = mine.newFileName; - ret.oldHeader = mine.oldHeader; - ret.newHeader = mine.newHeader; - } else { - // Both changed... figure it out - ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); - ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); - ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); - ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); - } - } - - ret.hunks = []; - var mineIndex = 0, - theirsIndex = 0, - mineOffset = 0, - theirsOffset = 0; - - while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { - var mineCurrent = mine.hunks[mineIndex] || { - oldStart: Infinity - }, - theirsCurrent = theirs.hunks[theirsIndex] || { - oldStart: Infinity - }; - - if (hunkBefore(mineCurrent, theirsCurrent)) { - // This patch does not overlap with any of the others, yay. - ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); - mineIndex++; - theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; - } else if (hunkBefore(theirsCurrent, mineCurrent)) { - // This patch does not overlap with any of the others, yay. - ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); - theirsIndex++; - mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; - } else { - // Overlap, merge as best we can - var mergedHunk = { - oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), - oldLines: 0, - newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), - newLines: 0, - lines: [] - }; - mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); - theirsIndex++; - mineIndex++; - ret.hunks.push(mergedHunk); - } - } - - return ret; - } - - function loadPatch(param, base) { - if (typeof param === 'string') { - if (/^@@/m.test(param) || /^Index:/m.test(param)) { - return parsePatch(param)[0]; - } - - if (!base) { - throw new Error('Must provide a base reference or pass in a patch'); - } - - return structuredPatch(undefined, undefined, base, param); - } - - return param; - } - - function fileNameChanged(patch) { - return patch.newFileName && patch.newFileName !== patch.oldFileName; - } - - function selectField(index, mine, theirs) { - if (mine === theirs) { - return mine; - } else { - index.conflict = true; - return { - mine: mine, - theirs: theirs - }; - } - } - - function hunkBefore(test, check) { - return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; - } - - function cloneHunk(hunk, offset) { - return { - oldStart: hunk.oldStart, - oldLines: hunk.oldLines, - newStart: hunk.newStart + offset, - newLines: hunk.newLines, - lines: hunk.lines - }; - } - - function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { - // This will generally result in a conflicted hunk, but there are cases where the context - // is the only overlap where we can successfully merge the content here. - var mine = { - offset: mineOffset, - lines: mineLines, - index: 0 - }, - their = { - offset: theirOffset, - lines: theirLines, - index: 0 - }; // Handle any leading content - - insertLeading(hunk, mine, their); - insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. - - while (mine.index < mine.lines.length && their.index < their.lines.length) { - var mineCurrent = mine.lines[mine.index], - theirCurrent = their.lines[their.index]; - - if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { - // Both modified ... - mutualChange(hunk, mine, their); - } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { - var _hunk$lines; - - // Mine inserted - (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); - } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { - var _hunk$lines2; - - // Theirs inserted - (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); - } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { - // Mine removed or edited - removal(hunk, mine, their); - } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { - // Their removed or edited - removal(hunk, their, mine, true); - } else if (mineCurrent === theirCurrent) { - // Context identity - hunk.lines.push(mineCurrent); - mine.index++; - their.index++; - } else { - // Context mismatch - conflict(hunk, collectChange(mine), collectChange(their)); - } - } // Now push anything that may be remaining - - - insertTrailing(hunk, mine); - insertTrailing(hunk, their); - calcLineCount(hunk); - } - - function mutualChange(hunk, mine, their) { - var myChanges = collectChange(mine), - theirChanges = collectChange(their); - - if (allRemoves(myChanges) && allRemoves(theirChanges)) { - // Special case for remove changes that are supersets of one another - if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { - var _hunk$lines3; - - (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); - - return; - } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { - var _hunk$lines4; - - (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); - - return; - } - } else if (arrayEqual(myChanges, theirChanges)) { - var _hunk$lines5; - - (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); - - return; - } - - conflict(hunk, myChanges, theirChanges); - } - - function removal(hunk, mine, their, swap) { - var myChanges = collectChange(mine), - theirChanges = collectContext(their, myChanges); - - if (theirChanges.merged) { - var _hunk$lines6; - - (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); - } else { - conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); - } - } - - function conflict(hunk, mine, their) { - hunk.conflict = true; - hunk.lines.push({ - conflict: true, - mine: mine, - theirs: their - }); - } - - function insertLeading(hunk, insert, their) { - while (insert.offset < their.offset && insert.index < insert.lines.length) { - var line = insert.lines[insert.index++]; - hunk.lines.push(line); - insert.offset++; - } - } - - function insertTrailing(hunk, insert) { - while (insert.index < insert.lines.length) { - var line = insert.lines[insert.index++]; - hunk.lines.push(line); - } - } - - function collectChange(state) { - var ret = [], - operation = state.lines[state.index][0]; - - while (state.index < state.lines.length) { - var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. - - if (operation === '-' && line[0] === '+') { - operation = '+'; - } - - if (operation === line[0]) { - ret.push(line); - state.index++; - } else { - break; - } - } - - return ret; - } - - function collectContext(state, matchChanges) { - var changes = [], - merged = [], - matchIndex = 0, - contextChanges = false, - conflicted = false; - - while (matchIndex < matchChanges.length && state.index < state.lines.length) { - var change = state.lines[state.index], - match = matchChanges[matchIndex]; // Once we've hit our add, then we are done - - if (match[0] === '+') { - break; - } - - contextChanges = contextChanges || change[0] !== ' '; - merged.push(match); - matchIndex++; // Consume any additions in the other block as a conflict to attempt - // to pull in the remaining context after this - - if (change[0] === '+') { - conflicted = true; - - while (change[0] === '+') { - changes.push(change); - change = state.lines[++state.index]; - } - } - - if (match.substr(1) === change.substr(1)) { - changes.push(change); - state.index++; - } else { - conflicted = true; - } - } - - if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { - conflicted = true; - } - - if (conflicted) { - return changes; - } - - while (matchIndex < matchChanges.length) { - merged.push(matchChanges[matchIndex++]); - } - - return { - merged: merged, - changes: changes - }; - } - - function allRemoves(changes) { - return changes.reduce(function (prev, change) { - return prev && change[0] === '-'; - }, true); - } - - function skipRemoveSuperset(state, removeChanges, delta) { - for (var i = 0; i < delta; i++) { - var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); - - if (state.lines[state.index + i] !== ' ' + changeContent) { - return false; - } - } - - state.index += delta; - return true; - } - - function calcOldNewLineCount(lines) { - var oldLines = 0; - var newLines = 0; - lines.forEach(function (line) { - if (typeof line !== 'string') { - var myCount = calcOldNewLineCount(line.mine); - var theirCount = calcOldNewLineCount(line.theirs); - - if (oldLines !== undefined) { - if (myCount.oldLines === theirCount.oldLines) { - oldLines += myCount.oldLines; - } else { - oldLines = undefined; - } - } - - if (newLines !== undefined) { - if (myCount.newLines === theirCount.newLines) { - newLines += myCount.newLines; - } else { - newLines = undefined; - } - } - } else { - if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { - newLines++; - } - - if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { - oldLines++; - } - } - }); - return { - oldLines: oldLines, - newLines: newLines - }; - } - - // See: http://code.google.com/p/google-diff-match-patch/wiki/API - function convertChangesToDMP(changes) { - var ret = [], - change, - operation; - - for (var i = 0; i < changes.length; i++) { - change = changes[i]; - - if (change.added) { - operation = 1; - } else if (change.removed) { - operation = -1; - } else { - operation = 0; - } - - ret.push([operation, change.value]); - } - - return ret; - } - - function convertChangesToXML(changes) { - var ret = []; - - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - - ret.push(escapeHTML(change.value)); - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - } - - return ret.join(''); - } - - function escapeHTML(s) { - var n = s; - n = n.replace(/&/g, '&'); - n = n.replace(//g, '>'); - n = n.replace(/"/g, '"'); - return n; - } - - /* See LICENSE file for terms of use */ - - exports.Diff = Diff; - exports.diffChars = diffChars; - exports.diffWords = diffWords; - exports.diffWordsWithSpace = diffWordsWithSpace; - exports.diffLines = diffLines; - exports.diffTrimmedLines = diffTrimmedLines; - exports.diffSentences = diffSentences; - exports.diffCss = diffCss; - exports.diffJson = diffJson; - exports.diffArrays = diffArrays; - exports.structuredPatch = structuredPatch; - exports.createTwoFilesPatch = createTwoFilesPatch; - exports.createPatch = createPatch; - exports.applyPatch = applyPatch; - exports.applyPatches = applyPatches; - exports.parsePatch = parsePatch; - exports.merge = merge; - exports.convertChangesToDMP = convertChangesToDMP; - exports.convertChangesToXML = convertChangesToXML; - exports.canonicalize = canonicalize; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/diff/dist/diff.min.js b/node_modules/diff/dist/diff.min.js deleted file mode 100644 index 0ece867..0000000 --- a/node_modules/diff/dist/diff.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).Diff={})}(this,function(e){"use strict";function t(){}function g(e,n,t,r,i){for(var o=0,s=n.length,l=0,a=0;oe.length?t:e}),u.value=e.join(d)}else u.value=e.join(t.slice(l,l+u.count));l+=u.count,u.added||(a+=u.count)}}var c=n[s-1];return 1=c&&h<=r+1)return d([{value:this.join(u),count:u.length}]);function i(){for(var e=-1*p;e<=p;e+=2){var n=void 0,t=v[e-1],r=v[e+1],i=(r?r.newPos:0)-e;t&&(v[e-1]=void 0);var o=t&&t.newPos+1=c&&h<=i+1)return d(g(f,n.components,u,a,f.useLongestToken));v[e]=n}else v[e]=void 0}var l;p++}if(n)!function e(){setTimeout(function(){if(t=v.length-2&&t.length<=p.context){var u=/\n$/.test(c),f=/\n$/.test(h),d=0==t.length&&x.length>a.oldLines;!u&&d&&x.splice(a.oldLines,0,"\\ No newline at end of file"),(u||d)&&f||x.push("\\ No newline at end of file")}m.push(a),y=w=0,x=[]}L+=t.length,S+=t.length}},o=0;oe.length)return!1;for(var t=0;t"):r.removed&&n.push(""),n.push((i=r.value,void 0,i.replace(/&/g,"&").replace(//g,">").replace(/"/g,"""))),r.added?n.push(""):r.removed&&n.push("")}var i;return n.join("")},e.canonicalize=v,Object.defineProperty(e,"__esModule",{value:!0})}); \ No newline at end of file diff --git a/node_modules/diff/lib/convert/dmp.js b/node_modules/diff/lib/convert/dmp.js deleted file mode 100644 index 91ff40a..0000000 --- a/node_modules/diff/lib/convert/dmp.js +++ /dev/null @@ -1,32 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.convertChangesToDMP = convertChangesToDMP; - -/*istanbul ignore end*/ -// See: http://code.google.com/p/google-diff-match-patch/wiki/API -function convertChangesToDMP(changes) { - var ret = [], - change, - operation; - - for (var i = 0; i < changes.length; i++) { - change = changes[i]; - - if (change.added) { - operation = 1; - } else if (change.removed) { - operation = -1; - } else { - operation = 0; - } - - ret.push([operation, change.value]); - } - - return ret; -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L2RtcC5qcyJdLCJuYW1lcyI6WyJjb252ZXJ0Q2hhbmdlc1RvRE1QIiwiY2hhbmdlcyIsInJldCIsImNoYW5nZSIsIm9wZXJhdGlvbiIsImkiLCJsZW5ndGgiLCJhZGRlZCIsInJlbW92ZWQiLCJwdXNoIiwidmFsdWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUFBO0FBQ08sU0FBU0EsbUJBQVQsQ0FBNkJDLE9BQTdCLEVBQXNDO0FBQzNDLE1BQUlDLEdBQUcsR0FBRyxFQUFWO0FBQUEsTUFDSUMsTUFESjtBQUFBLE1BRUlDLFNBRko7O0FBR0EsT0FBSyxJQUFJQyxDQUFDLEdBQUcsQ0FBYixFQUFnQkEsQ0FBQyxHQUFHSixPQUFPLENBQUNLLE1BQTVCLEVBQW9DRCxDQUFDLEVBQXJDLEVBQXlDO0FBQ3ZDRixJQUFBQSxNQUFNLEdBQUdGLE9BQU8sQ0FBQ0ksQ0FBRCxDQUFoQjs7QUFDQSxRQUFJRixNQUFNLENBQUNJLEtBQVgsRUFBa0I7QUFDaEJILE1BQUFBLFNBQVMsR0FBRyxDQUFaO0FBQ0QsS0FGRCxNQUVPLElBQUlELE1BQU0sQ0FBQ0ssT0FBWCxFQUFvQjtBQUN6QkosTUFBQUEsU0FBUyxHQUFHLENBQUMsQ0FBYjtBQUNELEtBRk0sTUFFQTtBQUNMQSxNQUFBQSxTQUFTLEdBQUcsQ0FBWjtBQUNEOztBQUVERixJQUFBQSxHQUFHLENBQUNPLElBQUosQ0FBUyxDQUFDTCxTQUFELEVBQVlELE1BQU0sQ0FBQ08sS0FBbkIsQ0FBVDtBQUNEOztBQUNELFNBQU9SLEdBQVA7QUFDRCIsInNvdXJjZXNDb250ZW50IjpbIi8vIFNlZTogaHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2dvb2dsZS1kaWZmLW1hdGNoLXBhdGNoL3dpa2kvQVBJXG5leHBvcnQgZnVuY3Rpb24gY29udmVydENoYW5nZXNUb0RNUChjaGFuZ2VzKSB7XG4gIGxldCByZXQgPSBbXSxcbiAgICAgIGNoYW5nZSxcbiAgICAgIG9wZXJhdGlvbjtcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBjaGFuZ2VzLmxlbmd0aDsgaSsrKSB7XG4gICAgY2hhbmdlID0gY2hhbmdlc1tpXTtcbiAgICBpZiAoY2hhbmdlLmFkZGVkKSB7XG4gICAgICBvcGVyYXRpb24gPSAxO1xuICAgIH0gZWxzZSBpZiAoY2hhbmdlLnJlbW92ZWQpIHtcbiAgICAgIG9wZXJhdGlvbiA9IC0xO1xuICAgIH0gZWxzZSB7XG4gICAgICBvcGVyYXRpb24gPSAwO1xuICAgIH1cblxuICAgIHJldC5wdXNoKFtvcGVyYXRpb24sIGNoYW5nZS52YWx1ZV0pO1xuICB9XG4gIHJldHVybiByZXQ7XG59XG4iXX0= diff --git a/node_modules/diff/lib/convert/xml.js b/node_modules/diff/lib/convert/xml.js deleted file mode 100644 index 69ec60c..0000000 --- a/node_modules/diff/lib/convert/xml.js +++ /dev/null @@ -1,42 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.convertChangesToXML = convertChangesToXML; - -/*istanbul ignore end*/ -function convertChangesToXML(changes) { - var ret = []; - - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - - ret.push(escapeHTML(change.value)); - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - } - - return ret.join(''); -} - -function escapeHTML(s) { - var n = s; - n = n.replace(/&/g, '&'); - n = n.replace(//g, '>'); - n = n.replace(/"/g, '"'); - return n; -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L3htbC5qcyJdLCJuYW1lcyI6WyJjb252ZXJ0Q2hhbmdlc1RvWE1MIiwiY2hhbmdlcyIsInJldCIsImkiLCJsZW5ndGgiLCJjaGFuZ2UiLCJhZGRlZCIsInB1c2giLCJyZW1vdmVkIiwiZXNjYXBlSFRNTCIsInZhbHVlIiwiam9pbiIsInMiLCJuIiwicmVwbGFjZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQU8sU0FBU0EsbUJBQVQsQ0FBNkJDLE9BQTdCLEVBQXNDO0FBQzNDLE1BQUlDLEdBQUcsR0FBRyxFQUFWOztBQUNBLE9BQUssSUFBSUMsQ0FBQyxHQUFHLENBQWIsRUFBZ0JBLENBQUMsR0FBR0YsT0FBTyxDQUFDRyxNQUE1QixFQUFvQ0QsQ0FBQyxFQUFyQyxFQUF5QztBQUN2QyxRQUFJRSxNQUFNLEdBQUdKLE9BQU8sQ0FBQ0UsQ0FBRCxDQUFwQjs7QUFDQSxRQUFJRSxNQUFNLENBQUNDLEtBQVgsRUFBa0I7QUFDaEJKLE1BQUFBLEdBQUcsQ0FBQ0ssSUFBSixDQUFTLE9BQVQ7QUFDRCxLQUZELE1BRU8sSUFBSUYsTUFBTSxDQUFDRyxPQUFYLEVBQW9CO0FBQ3pCTixNQUFBQSxHQUFHLENBQUNLLElBQUosQ0FBUyxPQUFUO0FBQ0Q7O0FBRURMLElBQUFBLEdBQUcsQ0FBQ0ssSUFBSixDQUFTRSxVQUFVLENBQUNKLE1BQU0sQ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yk7XG4gICAgfSBlbHNlIGlmIChjaGFuZ2UucmVtb3ZlZCkge1xuICAgICAgcmV0LnB1c2goJzxkZWw+Jyk7XG4gICAgfVxuXG4gICAgcmV0LnB1c2goZXNjYXBlSFRNTChjaGFuZ2UudmFsdWUpKTtcblxuICAgIGlmIChjaGFuZ2UuYWRkZWQpIHtcbiAgICAgIHJldC5wdXNoKCc8L2lucz4nKTtcbiAgICB9IGVsc2UgaWYgKGNoYW5nZS5yZW1vdmVkKSB7XG4gICAgICByZXQucHVzaCgnPC9kZWw+Jyk7XG4gICAgfVxuICB9XG4gIHJldHVybiByZXQuam9pbignJyk7XG59XG5cbmZ1bmN0aW9uIGVzY2FwZUhUTUwocykge1xuICBsZXQgbiA9IHM7XG4gIG4gPSBuLnJlcGxhY2UoLyYvZywgJyZhbXA7Jyk7XG4gIG4gPSBuLnJlcGxhY2UoLzwvZywgJyZsdDsnKTtcbiAgbiA9IG4ucmVwbGFjZSgvPi9nLCAnJmd0OycpO1xuICBuID0gbi5yZXBsYWNlKC9cIi9nLCAnJnF1b3Q7Jyk7XG5cbiAgcmV0dXJuIG47XG59XG4iXX0= diff --git a/node_modules/diff/lib/diff/array.js b/node_modules/diff/lib/diff/array.js deleted file mode 100644 index 81f42ea..0000000 --- a/node_modules/diff/lib/diff/array.js +++ /dev/null @@ -1,45 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.diffArrays = diffArrays; -exports.arrayDiff = void 0; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_base = _interopRequireDefault(require("./base")) -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/*istanbul ignore end*/ -var arrayDiff = new -/*istanbul ignore start*/ -_base -/*istanbul ignore end*/ -. -/*istanbul ignore start*/ -default -/*istanbul ignore end*/ -(); - -/*istanbul ignore start*/ -exports.arrayDiff = arrayDiff; - -/*istanbul ignore end*/ -arrayDiff.tokenize = function (value) { - return value.slice(); -}; - -arrayDiff.join = arrayDiff.removeEmpty = function (value) { - return value; -}; - -function diffArrays(oldArr, newArr, callback) { - return arrayDiff.diff(oldArr, newArr, callback); -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2FycmF5LmpzIl0sIm5hbWVzIjpbImFycmF5RGlmZiIsIkRpZmYiLCJ0b2tlbml6ZSIsInZhbHVlIiwic2xpY2UiLCJqb2luIiwicmVtb3ZlRW1wdHkiLCJkaWZmQXJyYXlzIiwib2xkQXJyIiwibmV3QXJyIiwiY2FsbGJhY2siLCJkaWZmIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTs7Ozs7QUFFTyxJQUFNQSxTQUFTLEdBQUc7QUFBSUM7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBSjtBQUFBLEVBQWxCOzs7Ozs7QUFDUEQsU0FBUyxDQUFDRSxRQUFWLEdBQXFCLFVBQVNDLEtBQVQsRUFBZ0I7QUFDbkMsU0FBT0EsS0FBSyxDQUFDQyxLQUFOLEVBQVA7QUFDRCxDQUZEOztBQUdBSixTQUFTLENBQUNLLElBQVYsR0FBaUJMLFNBQVMsQ0FBQ00sV0FBVixHQUF3QixVQUFTSCxLQUFULEVBQWdCO0FBQ3ZELFNBQU9BLEtBQVA7QUFDRCxDQUZEOztBQUlPLFNBQVNJLFVBQVQsQ0FBb0JDLE1BQXBCLEVBQTRCQyxNQUE1QixFQUFvQ0MsUUFBcEMsRUFBOEM7QUFBRSxTQUFPVixTQUFTLENBQUNXLElBQVYsQ0FBZUgsTUFBZixFQUF1QkMsTUFBdkIsRUFBK0JDLFFBQS9CLENBQVA7QUFBa0QiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgRGlmZiBmcm9tICcuL2Jhc2UnO1xuXG5leHBvcnQgY29uc3QgYXJyYXlEaWZmID0gbmV3IERpZmYoKTtcbmFycmF5RGlmZi50b2tlbml6ZSA9IGZ1bmN0aW9uKHZhbHVlKSB7XG4gIHJldHVybiB2YWx1ZS5zbGljZSgpO1xufTtcbmFycmF5RGlmZi5qb2luID0gYXJyYXlEaWZmLnJlbW92ZUVtcHR5ID0gZnVuY3Rpb24odmFsdWUpIHtcbiAgcmV0dXJuIHZhbHVlO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZBcnJheXMob2xkQXJyLCBuZXdBcnIsIGNhbGxiYWNrKSB7IHJldHVybiBhcnJheURpZmYuZGlmZihvbGRBcnIsIG5ld0FyciwgY2FsbGJhY2spOyB9XG4iXX0= diff --git a/node_modules/diff/lib/diff/base.js b/node_modules/diff/lib/diff/base.js deleted file mode 100644 index ea661fe..0000000 --- a/node_modules/diff/lib/diff/base.js +++ /dev/null @@ -1,304 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = Diff; - -/*istanbul ignore end*/ -function Diff() {} - -Diff.prototype = { - /*istanbul ignore start*/ - - /*istanbul ignore end*/ - diff: function diff(oldString, newString) { - /*istanbul ignore start*/ - var - /*istanbul ignore end*/ - options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var callback = options.callback; - - if (typeof options === 'function') { - callback = options; - options = {}; - } - - this.options = options; - var self = this; - - function done(value) { - if (callback) { - setTimeout(function () { - callback(undefined, value); - }, 0); - return true; - } else { - return value; - } - } // Allow subclasses to massage the input prior to running - - - oldString = this.castInput(oldString); - newString = this.castInput(newString); - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); - var newLen = newString.length, - oldLen = oldString.length; - var editLength = 1; - var maxEditLength = newLen + oldLen; - var bestPath = [{ - newPos: -1, - components: [] - }]; // Seed editLength = 0, i.e. the content starts with the same values - - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - - if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { - // Identity per the equality and tokenizer - return done([{ - value: this.join(newString), - count: newString.length - }]); - } // Main worker method. checks all permutations of a given edit length for acceptance. - - - function execEditLength() { - for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { - var basePath = - /*istanbul ignore start*/ - void 0 - /*istanbul ignore end*/ - ; - - var addPath = bestPath[diagonalPath - 1], - removePath = bestPath[diagonalPath + 1], - _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - - if (addPath) { - // No one else is going to attempt to use this value, clear it - bestPath[diagonalPath - 1] = undefined; - } - - var canAdd = addPath && addPath.newPos + 1 < newLen, - canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; - - if (!canAdd && !canRemove) { - // If this path is a terminal then prune - bestPath[diagonalPath] = undefined; - continue; - } // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin - // and does not pass the bounds of the diff graph - - - if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { - basePath = clonePath(removePath); - self.pushComponent(basePath.components, undefined, true); - } else { - basePath = addPath; // No need to clone, we've pulled it from the list - - basePath.newPos++; - self.pushComponent(basePath.components, true, undefined); - } - - _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done - - if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { - return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); - } else { - // Otherwise track this path as a potential candidate and continue. - bestPath[diagonalPath] = basePath; - } - } - - editLength++; - } // Performs the length of edit iteration. Is a bit fugly as this has to support the - // sync and async mode which is never fun. Loops over execEditLength until a value - // is produced. - - - if (callback) { - (function exec() { - setTimeout(function () { - // This should not happen, but we want to be safe. - - /* istanbul ignore next */ - if (editLength > maxEditLength) { - return callback(); - } - - if (!execEditLength()) { - exec(); - } - }, 0); - })(); - } else { - while (editLength <= maxEditLength) { - var ret = execEditLength(); - - if (ret) { - return ret; - } - } - } - }, - - /*istanbul ignore start*/ - - /*istanbul ignore end*/ - pushComponent: function pushComponent(components, added, removed) { - var last = components[components.length - 1]; - - if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length - 1] = { - count: last.count + 1, - added: added, - removed: removed - }; - } else { - components.push({ - count: 1, - added: added, - removed: removed - }); - } - }, - - /*istanbul ignore start*/ - - /*istanbul ignore end*/ - extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, - oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath, - commonCount = 0; - - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { - newPos++; - oldPos++; - commonCount++; - } - - if (commonCount) { - basePath.components.push({ - count: commonCount - }); - } - - basePath.newPos = newPos; - return oldPos; - }, - - /*istanbul ignore start*/ - - /*istanbul ignore end*/ - equals: function equals(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); - } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); - } - }, - - /*istanbul ignore start*/ - - /*istanbul ignore end*/ - removeEmpty: function removeEmpty(array) { - var ret = []; - - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - - return ret; - }, - - /*istanbul ignore start*/ - - /*istanbul ignore end*/ - castInput: function castInput(value) { - return value; - }, - - /*istanbul ignore start*/ - - /*istanbul ignore end*/ - tokenize: function tokenize(value) { - return value.split(''); - }, - - /*istanbul ignore start*/ - - /*istanbul ignore end*/ - join: function join(chars) { - return chars.join(''); - } -}; - -function buildValues(diff, components, newString, oldString, useLongestToken) { - var componentPos = 0, - componentLen = components.length, - newPos = 0, - oldPos = 0; - - for (; componentPos < componentLen; componentPos++) { - var component = components[componentPos]; - - if (!component.removed) { - if (!component.added && useLongestToken) { - var value = newString.slice(newPos, newPos + component.count); - value = value.map(function (value, i) { - var oldValue = oldString[oldPos + i]; - return oldValue.length > value.length ? oldValue : value; - }); - component.value = diff.join(value); - } else { - component.value = diff.join(newString.slice(newPos, newPos + component.count)); - } - - newPos += component.count; // Common case - - if (!component.added) { - oldPos += component.count; - } - } else { - component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; // Reverse add and remove so removes are output first to match common convention - // The diffing algorithm is tied to add then remove output and this is the simplest - // route to get the desired output with minimal overhead. - - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } - } - } // Special case handle for when one terminal is ignored (i.e. whitespace). - // For this case we merge the terminal into the prior string and drop the change. - // This is only available for string mode. - - - var lastComponent = components[componentLen - 1]; - - if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { - components[componentLen - 2].value += lastComponent.value; - components.pop(); - } - - return components; -} - -function clonePath(path) { - return { - newPos: path.newPos, - components: path.components.slice(0) - }; -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJpbmciLCJuZXdTdHJpbmciLCJvcHRpb25zIiwiY2FsbGJhY2siLCJzZWxmIiwiZG9uZSIsInZhbHVlIiwic2V0VGltZW91dCIsInVuZGVmaW5lZCIsImNhc3RJbnB1dCIsInJlbW92ZUVtcHR5IiwidG9rZW5pemUiLCJuZXdMZW4iLCJsZW5ndGgiLCJvbGRMZW4iLCJlZGl0TGVuZ3RoIiwibWF4RWRpdExlbmd0aCIsImJlc3RQYXRoIiwibmV3UG9zIiwiY29tcG9uZW50cyIsIm9sZFBvcyIsImV4dHJhY3RDb21tb24iLCJqb2luIiwiY291bnQiLCJleGVjRWRpdExlbmd0aCIsImRpY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BvbmVudExlbiAtIDJdLnZhbHVlICs9IGxhc3RDb21wb25lbnQudmFsdWU7XG4gICAgY29tcG9uZW50cy5wb3AoKTtcbiAgfVxuXG4gIHJldHVybiBjb21wb25lbnRzO1xufVxuXG5mdW5jdGlvbiBjbG9uZVBhdGgocGF0aCkge1xuICByZXR1cm4geyBuZXdQb3M6IHBhdGgubmV3UG9zLCBjb21wb25lbnRzOiBwYXRoLmNvbXBvbmVudHMuc2xpY2UoMCkgfTtcbn1cbiJdfQ== diff --git a/node_modules/diff/lib/diff/character.js b/node_modules/diff/lib/diff/character.js deleted file mode 100644 index 4722b16..0000000 --- a/node_modules/diff/lib/diff/character.js +++ /dev/null @@ -1,37 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.diffChars = diffChars; -exports.characterDiff = void 0; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_base = _interopRequireDefault(require("./base")) -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/*istanbul ignore end*/ -var characterDiff = new -/*istanbul ignore start*/ -_base -/*istanbul ignore end*/ -. -/*istanbul ignore start*/ -default -/*istanbul ignore end*/ -(); - -/*istanbul ignore start*/ -exports.characterDiff = characterDiff; - -/*istanbul ignore end*/ -function diffChars(oldStr, newStr, options) { - return characterDiff.diff(oldStr, newStr, options); -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2NoYXJhY3Rlci5qcyJdLCJuYW1lcyI6WyJjaGFyYWN0ZXJEaWZmIiwiRGlmZiIsImRpZmZDaGFycyIsIm9sZFN0ciIsIm5ld1N0ciIsIm9wdGlvbnMiLCJkaWZmIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTs7Ozs7QUFFTyxJQUFNQSxhQUFhLEdBQUc7QUFBSUM7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBSjtBQUFBLEVBQXRCOzs7Ozs7QUFDQSxTQUFTQyxTQUFULENBQW1CQyxNQUFuQixFQUEyQkMsTUFBM0IsRUFBbUNDLE9BQW5DLEVBQTRDO0FBQUUsU0FBT0wsYUFBYSxDQUFDTSxJQUFkLENBQW1CSCxNQUFuQixFQUEyQkMsTUFBM0IsRUFBbUNDLE9BQW5DLENBQVA7QUFBcUQiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgRGlmZiBmcm9tICcuL2Jhc2UnO1xuXG5leHBvcnQgY29uc3QgY2hhcmFjdGVyRGlmZiA9IG5ldyBEaWZmKCk7XG5leHBvcnQgZnVuY3Rpb24gZGlmZkNoYXJzKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKSB7IHJldHVybiBjaGFyYWN0ZXJEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIG9wdGlvbnMpOyB9XG4iXX0= diff --git a/node_modules/diff/lib/diff/css.js b/node_modules/diff/lib/diff/css.js deleted file mode 100644 index 69ba47e..0000000 --- a/node_modules/diff/lib/diff/css.js +++ /dev/null @@ -1,41 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.diffCss = diffCss; -exports.cssDiff = void 0; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_base = _interopRequireDefault(require("./base")) -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/*istanbul ignore end*/ -var cssDiff = new -/*istanbul ignore start*/ -_base -/*istanbul ignore end*/ -. -/*istanbul ignore start*/ -default -/*istanbul ignore end*/ -(); - -/*istanbul ignore start*/ -exports.cssDiff = cssDiff; - -/*istanbul ignore end*/ -cssDiff.tokenize = function (value) { - return value.split(/([{}:;,]|\s+)/); -}; - -function diffCss(oldStr, newStr, callback) { - return cssDiff.diff(oldStr, newStr, callback); -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Nzcy5qcyJdLCJuYW1lcyI6WyJjc3NEaWZmIiwiRGlmZiIsInRva2VuaXplIiwidmFsdWUiLCJzcGxpdCIsImRpZmZDc3MiLCJvbGRTdHIiLCJuZXdTdHIiLCJjYWxsYmFjayIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBOzs7OztBQUVPLElBQU1BLE9BQU8sR0FBRztBQUFJQztBQUFBQTtBQUFBQTtBQUFBQTtBQUFBQTtBQUFBQTtBQUFKO0FBQUEsRUFBaEI7Ozs7OztBQUNQRCxPQUFPLENBQUNFLFFBQVIsR0FBbUIsVUFBU0MsS0FBVCxFQUFnQjtBQUNqQyxTQUFPQSxLQUFLLENBQUNDLEtBQU4sQ0FBWSxlQUFaLENBQVA7QUFDRCxDQUZEOztBQUlPLFNBQVNDLE9BQVQsQ0FBaUJDLE1BQWpCLEVBQXlCQyxNQUF6QixFQUFpQ0MsUUFBakMsRUFBMkM7QUFBRSxTQUFPUixPQUFPLENBQUNTLElBQVIsQ0FBYUgsTUFBYixFQUFxQkMsTUFBckIsRUFBNkJDLFFBQTdCLENBQVA7QUFBZ0QiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgRGlmZiBmcm9tICcuL2Jhc2UnO1xuXG5leHBvcnQgY29uc3QgY3NzRGlmZiA9IG5ldyBEaWZmKCk7XG5jc3NEaWZmLnRva2VuaXplID0gZnVuY3Rpb24odmFsdWUpIHtcbiAgcmV0dXJuIHZhbHVlLnNwbGl0KC8oW3t9OjssXXxcXHMrKS8pO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZDc3Mob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7IHJldHVybiBjc3NEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKTsgfVxuIl19 diff --git a/node_modules/diff/lib/diff/json.js b/node_modules/diff/lib/diff/json.js deleted file mode 100644 index 715ef08..0000000 --- a/node_modules/diff/lib/diff/json.js +++ /dev/null @@ -1,163 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.diffJson = diffJson; -exports.canonicalize = canonicalize; -exports.jsonDiff = void 0; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_base = _interopRequireDefault(require("./base")) -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_line = require("./line") -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -/*istanbul ignore end*/ -var objectPrototypeToString = Object.prototype.toString; -var jsonDiff = new -/*istanbul ignore start*/ -_base -/*istanbul ignore end*/ -. -/*istanbul ignore start*/ -default -/*istanbul ignore end*/ -(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a -// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - -/*istanbul ignore start*/ -exports.jsonDiff = jsonDiff; - -/*istanbul ignore end*/ -jsonDiff.useLongestToken = true; -jsonDiff.tokenize = -/*istanbul ignore start*/ -_line -/*istanbul ignore end*/ -. -/*istanbul ignore start*/ -lineDiff -/*istanbul ignore end*/ -.tokenize; - -jsonDiff.castInput = function (value) { - /*istanbul ignore start*/ - var _this$options = - /*istanbul ignore end*/ - this.options, - undefinedReplacement = _this$options.undefinedReplacement, - _this$options$stringi = _this$options.stringifyReplacer, - stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) - /*istanbul ignore start*/ - { - return ( - /*istanbul ignore end*/ - typeof v === 'undefined' ? undefinedReplacement : v - ); - } : _this$options$stringi; - return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); -}; - -jsonDiff.equals = function (left, right) { - return ( - /*istanbul ignore start*/ - _base - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - default - /*istanbul ignore end*/ - .prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')) - ); -}; - -function diffJson(oldObj, newObj, options) { - return jsonDiff.diff(oldObj, newObj, options); -} // This function handles the presence of circular references by bailing out when encountering an -// object that is already on the "stack" of items being processed. Accepts an optional replacer - - -function canonicalize(obj, stack, replacementStack, replacer, key) { - stack = stack || []; - replacementStack = replacementStack || []; - - if (replacer) { - obj = replacer(key, obj); - } - - var i; - - for (i = 0; i < stack.length; i += 1) { - if (stack[i] === obj) { - return replacementStack[i]; - } - } - - var canonicalizedObj; - - if ('[object Array]' === objectPrototypeToString.call(obj)) { - stack.push(obj); - canonicalizedObj = new Array(obj.length); - replacementStack.push(canonicalizedObj); - - for (i = 0; i < obj.length; i += 1) { - canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); - } - - stack.pop(); - replacementStack.pop(); - return canonicalizedObj; - } - - if (obj && obj.toJSON) { - obj = obj.toJSON(); - } - - if ( - /*istanbul ignore start*/ - _typeof( - /*istanbul ignore end*/ - obj) === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - replacementStack.push(canonicalizedObj); - - var sortedKeys = [], - _key; - - for (_key in obj) { - /* istanbul ignore else */ - if (obj.hasOwnProperty(_key)) { - sortedKeys.push(_key); - } - } - - sortedKeys.sort(); - - for (i = 0; i < sortedKeys.length; i += 1) { - _key = sortedKeys[i]; - canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); - } - - stack.pop(); - replacementStack.pop(); - } else { - canonicalizedObj = obj; - } - - return canonicalizedObj; -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2pzb24uanMiXSwibmFtZXMiOlsib2JqZWN0UHJvdG90eXBlVG9TdHJpbmciLCJPYmplY3QiLCJwcm90b3R5cGUiLCJ0b1N0cmluZyIsImpzb25EaWZmIiwiRGlmZiIsInVzZUxvbmdlc3RUb2tlbiIsInRva2VuaXplIiwibGluZURpZmYiLCJjYXN0SW5wdXQiLCJ2YWx1ZSIsIm9wdGlvbnMiLCJ1bmRlZmluZWRSZXBsYWNlbWVudCIsInN0cmluZ2lmeVJlcGxhY2VyIiwiayIsInYiLCJKU09OIiwic3RyaW5naWZ5IiwiY2Fub25pY2FsaXplIiwiZXF1YWxzIiwibGVmdCIsInJpZ2h0IiwiY2FsbCIsInJlcGxhY2UiLCJkaWZmSnNvbiIsIm9sZE9iaiIsIm5ld09iaiIsImRpZmYiLCJvYmoiLCJzdGFjayIsInJlcGxhY2VtZW50U3RhY2siLCJyZXBsYWNlciIsImtleSIsImkiLCJsZW5ndGgiLCJjYW5vbmljYWxpemVkT2JqIiwicHVzaCIsIkFycmF5IiwicG9wIiwidG9KU09OIiwic29ydGVkS2V5cyIsImhhc093blByb3BlcnR5Iiwic29ydCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7Ozs7Ozs7QUFFQSxJQUFNQSx1QkFBdUIsR0FBR0MsTUFBTSxDQUFDQyxTQUFQLENBQWlCQyxRQUFqRDtBQUdPLElBQU1DLFFBQVEsR0FBRztBQUFJQztBQUFBQTtBQUFBQTtBQUFBQTtBQUFBQTtBQUFBQTtBQUFKO0FBQUEsRUFBakIsQyxDQUNQO0FB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mV0dXJuIGNhbm9uaWNhbGl6ZWRPYmo7XG59XG4iXX0= diff --git a/node_modules/diff/lib/diff/line.js b/node_modules/diff/lib/diff/line.js deleted file mode 100644 index f323f84..0000000 --- a/node_modules/diff/lib/diff/line.js +++ /dev/null @@ -1,89 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.diffLines = diffLines; -exports.diffTrimmedLines = diffTrimmedLines; -exports.lineDiff = void 0; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_base = _interopRequireDefault(require("./base")) -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_params = require("../util/params") -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/*istanbul ignore end*/ -var lineDiff = new -/*istanbul ignore start*/ -_base -/*istanbul ignore end*/ -. -/*istanbul ignore start*/ -default -/*istanbul ignore end*/ -(); - -/*istanbul ignore start*/ -exports.lineDiff = lineDiff; - -/*istanbul ignore end*/ -lineDiff.tokenize = function (value) { - var retLines = [], - linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line - - if (!linesAndNewlines[linesAndNewlines.length - 1]) { - linesAndNewlines.pop(); - } // Merge the content and line separators into single tokens - - - for (var i = 0; i < linesAndNewlines.length; i++) { - var line = linesAndNewlines[i]; - - if (i % 2 && !this.options.newlineIsToken) { - retLines[retLines.length - 1] += line; - } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - - retLines.push(line); - } - } - - return retLines; -}; - -function diffLines(oldStr, newStr, callback) { - return lineDiff.diff(oldStr, newStr, callback); -} - -function diffTrimmedLines(oldStr, newStr, callback) { - var options = - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _params - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - generateOptions) - /*istanbul ignore end*/ - (callback, { - ignoreWhitespace: true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aW0oKTtcbiAgICAgIH1cbiAgICAgIHJldExpbmVzLnB1c2gobGluZSk7XG4gICAgfVxuICB9XG5cbiAgcmV0dXJuIHJldExpbmVzO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZMaW5lcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHsgcmV0dXJuIGxpbmVEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKTsgfVxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZUcmltbWVkTGluZXMob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7XG4gIGxldCBvcHRpb25zID0gZ2VuZXJhdGVPcHRpb25zKGNhbGxiYWNrLCB7aWdub3JlV2hpdGVzcGFjZTogdHJ1ZX0pO1xuICByZXR1cm4gbGluZURpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucyk7XG59XG4iXX0= diff --git a/node_modules/diff/lib/diff/sentence.js b/node_modules/diff/lib/diff/sentence.js deleted file mode 100644 index 9ee96e9..0000000 --- a/node_modules/diff/lib/diff/sentence.js +++ /dev/null @@ -1,41 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.diffSentences = diffSentences; -exports.sentenceDiff = void 0; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_base = _interopRequireDefault(require("./base")) -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/*istanbul ignore end*/ -var sentenceDiff = new -/*istanbul ignore start*/ -_base -/*istanbul ignore end*/ -. -/*istanbul ignore start*/ -default -/*istanbul ignore end*/ -(); - -/*istanbul ignore start*/ -exports.sentenceDiff = sentenceDiff; - -/*istanbul ignore end*/ -sentenceDiff.tokenize = function (value) { - return value.split(/(\S.+?[.!?])(?=\s+|$)/); -}; - -function diffSentences(oldStr, newStr, callback) { - return sentenceDiff.di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GVuY2VzKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjaykgeyByZXR1cm4gc2VudGVuY2VEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKTsgfVxuIl19 diff --git a/node_modules/diff/lib/diff/word.js b/node_modules/diff/lib/diff/word.js deleted file mode 100644 index 0b952e0..0000000 --- a/node_modules/diff/lib/diff/word.js +++ /dev/null @@ -1,107 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.diffWords = diffWords; -exports.diffWordsWithSpace = diffWordsWithSpace; -exports.wordDiff = void 0; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_base = _interopRequireDefault(require("./base")) -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_params = require("../util/params") -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/*istanbul ignore end*/ -// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode -// -// Ranges and exceptions: -// Latin-1 Supplement, 0080–00FF -// - U+00D7 × Multiplication sign -// - U+00F7 ÷ Division sign -// Latin Extended-A, 0100–017F -// Latin Extended-B, 0180–024F -// IPA Extensions, 0250–02AF -// Spacing Modifier Letters, 02B0–02FF -// - U+02C7 ˇ ˇ Caron -// - U+02D8 ˘ ˘ Breve -// - U+02D9 ˙ ˙ Dot Above -// - U+02DA ˚ ˚ Ring Above -// - U+02DB ˛ ˛ Ogonek -// - U+02DC ˜ ˜ Small Tilde -// - U+02DD ˝ ˝ Double Acute Accent -// Latin Extended Additional, 1E00–1EFF -var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; -var reWhitespace = /\S/; -var wordDiff = new -/*istanbul ignore start*/ -_base -/*istanbul ignore end*/ -. -/*istanbul ignore start*/ -default -/*istanbul ignore end*/ -(); - -/*istanbul ignore start*/ -exports.wordDiff = wordDiff; - -/*istanbul ignore end*/ -wordDiff.equals = function (left, right) { - if (this.options.ignoreCase) { - left = left.toLowerCase(); - right = right.toLowerCase(); - } - - return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); -}; - -wordDiff.tokenize = function (value) { - var tokens = value.split(/(\s+|[()[\]{}'"]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. - - for (var i = 0; i < tokens.length - 1; i++) { - // If we have an empty string in the next field and we have only word chars before and after, merge - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; - } - } - - return tokens; -}; - -function diffWords(oldStr, newStr, options) { - options = - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _params - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - generateOptions) - /*istanbul ignore end*/ - (options, { - ignoreWhitespace: true - }); - return wordDiff.diff(oldStr, newStr, options); -} - -function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff.diff(oldStr, newStr, options); -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3dvcmQuanMiXSwibmFtZXMiOlsiZXh0ZW5kZWRXb3JkQ2hhcnMiLCJyZVdoaXRlc3BhY2UiLCJ3b3JkRGlmZiIsIkRpZmYiLCJlcXVhbHMiLCJsZWZ0IiwicmlnaHQiLCJvcHRpb25zIiwiaWdub3JlQ2FzZSIsInRvTG93ZXJDYXNlIiwiaWdub3JlV2hpdGVzcGFjZSIsInRlc3QiLCJ0b2tlbml6ZSIsInZhbHVlIiwidG9rZW5zIiwic3BsaXQiLCJpIiwibGVuZ3RoIiwic3BsaWNlIiwiZGlmZldvcmRzIiwib2xkU3RyIiwibmV3U3RyIiwiZ2Vu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cmllcy4gVGhpcyBpcyBwcmltYXJpbHkgdGhlIGV4dGVuZGVkIExhdGluIGNoYXJhY3RlciBzZXQuXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgdG9rZW5zLmxlbmd0aCAtIDE7IGkrKykge1xuICAgIC8vIElmIHdlIGhhdmUgYW4gZW1wdHkgc3RyaW5nIGluIHRoZSBuZXh0IGZpZWxkIGFuZCB3ZSBoYXZlIG9ubHkgd29yZCBjaGFycyBiZWZvcmUgYW5kIGFmdGVyLCBtZXJnZVxuICAgIGlmICghdG9rZW5zW2kgKyAxXSAmJiB0b2tlbnNbaSArIDJdXG4gICAgICAgICAgJiYgZXh0ZW5kZWRXb3JkQ2hhcnMudGVzdCh0b2tlbnNbaV0pXG4gICAgICAgICAgJiYgZXh0ZW5kZWRXb3JkQ2hhcnMudGVzdCh0b2tlbnNbaSArIDJdKSkge1xuICAgICAgdG9rZW5zW2ldICs9IHRva2Vuc1tpICsgMl07XG4gICAgICB0b2tlbnMuc3BsaWNlKGkgKyAxLCAyKTtcbiAgICAgIGktLTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gdG9rZW5zO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZXb3JkcyhvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucykge1xuICBvcHRpb25zID0gZ2VuZXJhdGVPcHRpb25zKG9wdGlvbnMsIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiB3b3JkRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZXb3Jkc1dpdGhTcGFjZShvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucykge1xuICByZXR1cm4gd29yZERpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucyk7XG59XG4iXX0= diff --git a/node_modules/diff/lib/index.es6.js b/node_modules/diff/lib/index.es6.js deleted file mode 100644 index 6dd2a6f..0000000 --- a/node_modules/diff/lib/index.es6.js +++ /dev/null @@ -1,1519 +0,0 @@ -function Diff() {} -Diff.prototype = { - diff: function diff(oldString, newString) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var callback = options.callback; - - if (typeof options === 'function') { - callback = options; - options = {}; - } - - this.options = options; - var self = this; - - function done(value) { - if (callback) { - setTimeout(function () { - callback(undefined, value); - }, 0); - return true; - } else { - return value; - } - } // Allow subclasses to massage the input prior to running - - - oldString = this.castInput(oldString); - newString = this.castInput(newString); - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); - var newLen = newString.length, - oldLen = oldString.length; - var editLength = 1; - var maxEditLength = newLen + oldLen; - var bestPath = [{ - newPos: -1, - components: [] - }]; // Seed editLength = 0, i.e. the content starts with the same values - - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - - if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { - // Identity per the equality and tokenizer - return done([{ - value: this.join(newString), - count: newString.length - }]); - } // Main worker method. checks all permutations of a given edit length for acceptance. - - - function execEditLength() { - for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { - var basePath = void 0; - - var addPath = bestPath[diagonalPath - 1], - removePath = bestPath[diagonalPath + 1], - _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - - if (addPath) { - // No one else is going to attempt to use this value, clear it - bestPath[diagonalPath - 1] = undefined; - } - - var canAdd = addPath && addPath.newPos + 1 < newLen, - canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; - - if (!canAdd && !canRemove) { - // If this path is a terminal then prune - bestPath[diagonalPath] = undefined; - continue; - } // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin - // and does not pass the bounds of the diff graph - - - if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { - basePath = clonePath(removePath); - self.pushComponent(basePath.components, undefined, true); - } else { - basePath = addPath; // No need to clone, we've pulled it from the list - - basePath.newPos++; - self.pushComponent(basePath.components, true, undefined); - } - - _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done - - if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { - return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); - } else { - // Otherwise track this path as a potential candidate and continue. - bestPath[diagonalPath] = basePath; - } - } - - editLength++; - } // Performs the length of edit iteration. Is a bit fugly as this has to support the - // sync and async mode which is never fun. Loops over execEditLength until a value - // is produced. - - - if (callback) { - (function exec() { - setTimeout(function () { - // This should not happen, but we want to be safe. - - /* istanbul ignore next */ - if (editLength > maxEditLength) { - return callback(); - } - - if (!execEditLength()) { - exec(); - } - }, 0); - })(); - } else { - while (editLength <= maxEditLength) { - var ret = execEditLength(); - - if (ret) { - return ret; - } - } - } - }, - pushComponent: function pushComponent(components, added, removed) { - var last = components[components.length - 1]; - - if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length - 1] = { - count: last.count + 1, - added: added, - removed: removed - }; - } else { - components.push({ - count: 1, - added: added, - removed: removed - }); - } - }, - extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, - oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath, - commonCount = 0; - - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { - newPos++; - oldPos++; - commonCount++; - } - - if (commonCount) { - basePath.components.push({ - count: commonCount - }); - } - - basePath.newPos = newPos; - return oldPos; - }, - equals: function equals(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); - } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); - } - }, - removeEmpty: function removeEmpty(array) { - var ret = []; - - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - - return ret; - }, - castInput: function castInput(value) { - return value; - }, - tokenize: function tokenize(value) { - return value.split(''); - }, - join: function join(chars) { - return chars.join(''); - } -}; - -function buildValues(diff, components, newString, oldString, useLongestToken) { - var componentPos = 0, - componentLen = components.length, - newPos = 0, - oldPos = 0; - - for (; componentPos < componentLen; componentPos++) { - var component = components[componentPos]; - - if (!component.removed) { - if (!component.added && useLongestToken) { - var value = newString.slice(newPos, newPos + component.count); - value = value.map(function (value, i) { - var oldValue = oldString[oldPos + i]; - return oldValue.length > value.length ? oldValue : value; - }); - component.value = diff.join(value); - } else { - component.value = diff.join(newString.slice(newPos, newPos + component.count)); - } - - newPos += component.count; // Common case - - if (!component.added) { - oldPos += component.count; - } - } else { - component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; // Reverse add and remove so removes are output first to match common convention - // The diffing algorithm is tied to add then remove output and this is the simplest - // route to get the desired output with minimal overhead. - - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } - } - } // Special case handle for when one terminal is ignored (i.e. whitespace). - // For this case we merge the terminal into the prior string and drop the change. - // This is only available for string mode. - - - var lastComponent = components[componentLen - 1]; - - if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { - components[componentLen - 2].value += lastComponent.value; - components.pop(); - } - - return components; -} - -function clonePath(path) { - return { - newPos: path.newPos, - components: path.components.slice(0) - }; -} - -var characterDiff = new Diff(); -function diffChars(oldStr, newStr, options) { - return characterDiff.diff(oldStr, newStr, options); -} - -function generateOptions(options, defaults) { - if (typeof options === 'function') { - defaults.callback = options; - } else if (options) { - for (var name in options) { - /* istanbul ignore else */ - if (options.hasOwnProperty(name)) { - defaults[name] = options[name]; - } - } - } - - return defaults; -} - -// -// Ranges and exceptions: -// Latin-1 Supplement, 0080–00FF -// - U+00D7 × Multiplication sign -// - U+00F7 ÷ Division sign -// Latin Extended-A, 0100–017F -// Latin Extended-B, 0180–024F -// IPA Extensions, 0250–02AF -// Spacing Modifier Letters, 02B0–02FF -// - U+02C7 ˇ ˇ Caron -// - U+02D8 ˘ ˘ Breve -// - U+02D9 ˙ ˙ Dot Above -// - U+02DA ˚ ˚ Ring Above -// - U+02DB ˛ ˛ Ogonek -// - U+02DC ˜ ˜ Small Tilde -// - U+02DD ˝ ˝ Double Acute Accent -// Latin Extended Additional, 1E00–1EFF - -var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; -var reWhitespace = /\S/; -var wordDiff = new Diff(); - -wordDiff.equals = function (left, right) { - if (this.options.ignoreCase) { - left = left.toLowerCase(); - right = right.toLowerCase(); - } - - return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); -}; - -wordDiff.tokenize = function (value) { - var tokens = value.split(/(\s+|[()[\]{}'"]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. - - for (var i = 0; i < tokens.length - 1; i++) { - // If we have an empty string in the next field and we have only word chars before and after, merge - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; - } - } - - return tokens; -}; - -function diffWords(oldStr, newStr, options) { - options = generateOptions(options, { - ignoreWhitespace: true - }); - return wordDiff.diff(oldStr, newStr, options); -} -function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff.diff(oldStr, newStr, options); -} - -var lineDiff = new Diff(); - -lineDiff.tokenize = function (value) { - var retLines = [], - linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line - - if (!linesAndNewlines[linesAndNewlines.length - 1]) { - linesAndNewlines.pop(); - } // Merge the content and line separators into single tokens - - - for (var i = 0; i < linesAndNewlines.length; i++) { - var line = linesAndNewlines[i]; - - if (i % 2 && !this.options.newlineIsToken) { - retLines[retLines.length - 1] += line; - } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - - retLines.push(line); - } - } - - return retLines; -}; - -function diffLines(oldStr, newStr, callback) { - return lineDiff.diff(oldStr, newStr, callback); -} -function diffTrimmedLines(oldStr, newStr, callback) { - var options = generateOptions(callback, { - ignoreWhitespace: true - }); - return lineDiff.diff(oldStr, newStr, options); -} - -var sentenceDiff = new Diff(); - -sentenceDiff.tokenize = function (value) { - return value.split(/(\S.+?[.!?])(?=\s+|$)/); -}; - -function diffSentences(oldStr, newStr, callback) { - return sentenceDiff.diff(oldStr, newStr, callback); -} - -var cssDiff = new Diff(); - -cssDiff.tokenize = function (value) { - return value.split(/([{}:;,]|\s+)/); -}; - -function diffCss(oldStr, newStr, callback) { - return cssDiff.diff(oldStr, newStr, callback); -} - -function _typeof(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); -} - -function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); -} - -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } -} - -function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); -} - -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); -} - -var objectPrototypeToString = Object.prototype.toString; -var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a -// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - -jsonDiff.useLongestToken = true; -jsonDiff.tokenize = lineDiff.tokenize; - -jsonDiff.castInput = function (value) { - var _this$options = this.options, - undefinedReplacement = _this$options.undefinedReplacement, - _this$options$stringi = _this$options.stringifyReplacer, - stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) { - return typeof v === 'undefined' ? undefinedReplacement : v; - } : _this$options$stringi; - return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); -}; - -jsonDiff.equals = function (left, right) { - return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); -}; - -function diffJson(oldObj, newObj, options) { - return jsonDiff.diff(oldObj, newObj, options); -} // This function handles the presence of circular references by bailing out when encountering an -// object that is already on the "stack" of items being processed. Accepts an optional replacer - -function canonicalize(obj, stack, replacementStack, replacer, key) { - stack = stack || []; - replacementStack = replacementStack || []; - - if (replacer) { - obj = replacer(key, obj); - } - - var i; - - for (i = 0; i < stack.length; i += 1) { - if (stack[i] === obj) { - return replacementStack[i]; - } - } - - var canonicalizedObj; - - if ('[object Array]' === objectPrototypeToString.call(obj)) { - stack.push(obj); - canonicalizedObj = new Array(obj.length); - replacementStack.push(canonicalizedObj); - - for (i = 0; i < obj.length; i += 1) { - canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); - } - - stack.pop(); - replacementStack.pop(); - return canonicalizedObj; - } - - if (obj && obj.toJSON) { - obj = obj.toJSON(); - } - - if (_typeof(obj) === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - replacementStack.push(canonicalizedObj); - - var sortedKeys = [], - _key; - - for (_key in obj) { - /* istanbul ignore else */ - if (obj.hasOwnProperty(_key)) { - sortedKeys.push(_key); - } - } - - sortedKeys.sort(); - - for (i = 0; i < sortedKeys.length; i += 1) { - _key = sortedKeys[i]; - canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); - } - - stack.pop(); - replacementStack.pop(); - } else { - canonicalizedObj = obj; - } - - return canonicalizedObj; -} - -var arrayDiff = new Diff(); - -arrayDiff.tokenize = function (value) { - return value.slice(); -}; - -arrayDiff.join = arrayDiff.removeEmpty = function (value) { - return value; -}; - -function diffArrays(oldArr, newArr, callback) { - return arrayDiff.diff(oldArr, newArr, callback); -} - -function parsePatch(uniDiff) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], - list = [], - i = 0; - - function parseIndex() { - var index = {}; - list.push(index); // Parse diff metadata - - while (i < diffstr.length) { - var line = diffstr[i]; // File header found, end parsing diff metadata - - if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { - break; - } // Diff index - - - var headerMatch = /^(?:Index:|diff(?: -r \w+)+)\s+/.exec(line); - - if (headerMatch) { - index.index = line.substring(headerMatch[0].length).trim(); - } - - i++; - } // Parse file headers if they are defined. Unified diff requires them, but - // there's no technical issues to have an isolated hunk without file header - - - parseFileHeader(index); - parseFileHeader(index); // Parse hunks - - index.hunks = []; - - while (i < diffstr.length) { - var _line = diffstr[i]; - - if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { - break; - } else if (/^@@/.test(_line)) { - index.hunks.push(parseHunk()); - } else if (_line && options.strict) { - // Ignore unexpected content unless in strict mode - throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); - } else { - i++; - } - } - } // Parses the --- and +++ headers, if none are found, no lines - // are consumed. - - - function parseFileHeader(index) { - var fileHeaderMatch = /^(---|\+\+\+)\s+/.exec(diffstr[i]); - - if (fileHeaderMatch) { - var keyPrefix = fileHeaderMatch[1] === '---' ? 'old' : 'new'; - var data = diffstr[i].substring(3).trim().split('\t', 2); - var fileName = data[0].replace(/\\\\/g, '\\'); - - if (fileName.startsWith('"') && fileName.endsWith('"')) { - fileName = fileName.substr(1, fileName.length - 2); - } - - index[keyPrefix + 'FileName'] = fileName; - index[keyPrefix + 'Header'] = (data[1] || '').trim(); - i++; - } - } // Parses a hunk - // This assumes that we are at the start of a hunk. - - - function parseHunk() { - var chunkHeaderIndex = i, - chunkHeaderLine = diffstr[i++], - chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); - var hunk = { - oldStart: +chunkHeader[1], - oldLines: +chunkHeader[2] || 1, - newStart: +chunkHeader[3], - newLines: +chunkHeader[4] || 1, - lines: [], - linedelimiters: [] - }; - var addCount = 0, - removeCount = 0; - - for (; i < diffstr.length; i++) { - // Lines starting with '---' could be mistaken for the "remove line" operation - // But they could be the header for the next file. Therefore prune such cases out. - if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { - break; - } - - var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; - - if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { - hunk.lines.push(diffstr[i]); - hunk.linedelimiters.push(delimiters[i] || '\n'); - - if (operation === '+') { - addCount++; - } else if (operation === '-') { - removeCount++; - } else if (operation === ' ') { - addCount++; - removeCount++; - } - } else { - break; - } - } // Handle the empty block count case - - - if (!addCount && hunk.newLines === 1) { - hunk.newLines = 0; - } - - if (!removeCount && hunk.oldLines === 1) { - hunk.oldLines = 0; - } // Perform optional sanity checking - - - if (options.strict) { - if (addCount !== hunk.newLines) { - throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - - if (removeCount !== hunk.oldLines) { - throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - } - - return hunk; - } - - while (i < diffstr.length) { - parseIndex(); - } - - return list; -} - -// Iterator that traverses in the range of [min, max], stepping -// by distance from a given start position. I.e. for [0, 4], with -// start of 2, this will iterate 2, 3, 1, 4, 0. -function distanceIterator (start, minLine, maxLine) { - var wantForward = true, - backwardExhausted = false, - forwardExhausted = false, - localOffset = 1; - return function iterator() { - if (wantForward && !forwardExhausted) { - if (backwardExhausted) { - localOffset++; - } else { - wantForward = false; - } // Check if trying to fit beyond text length, and if not, check it fits - // after offset location (or desired location on first iteration) - - - if (start + localOffset <= maxLine) { - return localOffset; - } - - forwardExhausted = true; - } - - if (!backwardExhausted) { - if (!forwardExhausted) { - wantForward = true; - } // Check if trying to fit before text beginning, and if not, check it fits - // before offset location - - - if (minLine <= start - localOffset) { - return -localOffset++; - } - - backwardExhausted = true; - return iterator(); - } // We tried to fit hunk before text beginning and beyond text length, then - // hunk can't fit on the text. Return undefined - - }; -} - -function applyPatch(source, uniDiff) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - if (typeof uniDiff === 'string') { - uniDiff = parsePatch(uniDiff); - } - - if (Array.isArray(uniDiff)) { - if (uniDiff.length > 1) { - throw new Error('applyPatch only works with a single input.'); - } - - uniDiff = uniDiff[0]; - } // Apply the diff to the input - - - var lines = source.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], - hunks = uniDiff.hunks, - compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { - return line === patchContent; - }, - errorCount = 0, - fuzzFactor = options.fuzzFactor || 0, - minLine = 0, - offset = 0, - removeEOFNL, - addEOFNL; - /** - * Checks if the hunk exactly fits on the provided location - */ - - - function hunkFits(hunk, toPos) { - for (var j = 0; j < hunk.lines.length; j++) { - var line = hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line; - - if (operation === ' ' || operation === '-') { - // Context sanity check - if (!compareLine(toPos + 1, lines[toPos], operation, content)) { - errorCount++; - - if (errorCount > fuzzFactor) { - return false; - } - } - - toPos++; - } - } - - return true; - } // Search best fit offsets for each hunk based on the previous ones - - - for (var i = 0; i < hunks.length; i++) { - var hunk = hunks[i], - maxLine = lines.length - hunk.oldLines, - localOffset = 0, - toPos = offset + hunk.oldStart - 1; - var iterator = distanceIterator(toPos, minLine, maxLine); - - for (; localOffset !== undefined; localOffset = iterator()) { - if (hunkFits(hunk, toPos + localOffset)) { - hunk.offset = offset += localOffset; - break; - } - } - - if (localOffset === undefined) { - return false; - } // Set lower text limit to end of the current hunk, so next ones don't try - // to fit over already patched text - - - minLine = hunk.offset + hunk.oldStart + hunk.oldLines; - } // Apply patch hunks - - - var diffOffset = 0; - - for (var _i = 0; _i < hunks.length; _i++) { - var _hunk = hunks[_i], - _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; - - diffOffset += _hunk.newLines - _hunk.oldLines; - - if (_toPos < 0) { - // Creating a new file - _toPos = 0; - } - - for (var j = 0; j < _hunk.lines.length; j++) { - var line = _hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters[j]; - - if (operation === ' ') { - _toPos++; - } else if (operation === '-') { - lines.splice(_toPos, 1); - delimiters.splice(_toPos, 1); - /* istanbul ignore else */ - } else if (operation === '+') { - lines.splice(_toPos, 0, content); - delimiters.splice(_toPos, 0, delimiter); - _toPos++; - } else if (operation === '\\') { - var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; - - if (previousOperation === '+') { - removeEOFNL = true; - } else if (previousOperation === '-') { - addEOFNL = true; - } - } - } - } // Handle EOFNL insertion/removal - - - if (removeEOFNL) { - while (!lines[lines.length - 1]) { - lines.pop(); - delimiters.pop(); - } - } else if (addEOFNL) { - lines.push(''); - delimiters.push('\n'); - } - - for (var _k = 0; _k < lines.length - 1; _k++) { - lines[_k] = lines[_k] + delimiters[_k]; - } - - return lines.join(''); -} // Wrapper that supports multiple file patches via callbacks. - -function applyPatches(uniDiff, options) { - if (typeof uniDiff === 'string') { - uniDiff = parsePatch(uniDiff); - } - - var currentIndex = 0; - - function processIndex() { - var index = uniDiff[currentIndex++]; - - if (!index) { - return options.complete(); - } - - options.loadFile(index, function (err, data) { - if (err) { - return options.complete(err); - } - - var updatedContent = applyPatch(data, index, options); - options.patched(index, updatedContent, function (err) { - if (err) { - return options.complete(err); - } - - processIndex(); - }); - }); - } - - processIndex(); -} - -function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - if (!options) { - options = {}; - } - - if (typeof options.context === 'undefined') { - options.context = 4; - } - - var diff = diffLines(oldStr, newStr, options); - diff.push({ - value: '', - lines: [] - }); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function (entry) { - return ' ' + entry; - }); - } - - var hunks = []; - var oldRangeStart = 0, - newRangeStart = 0, - curRange = [], - oldLine = 1, - newLine = 1; - - var _loop = function _loop(i) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - var _curRange; - - // If we have previous context, start with that - if (!oldRangeStart) { - var prev = diff[i - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; - } - } // Output our changes - - - (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { - return (current.added ? '+' : '-') + entry; - }))); // Track the updated file position - - - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - // Identical context lines. Track line changes - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= options.context * 2 && i < diff.length - 2) { - var _curRange2; - - // Overlapping - (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); - } else { - var _curRange3; - - // end the range and output - var contextSize = Math.min(lines.length, options.context); - - (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); - - var hunk = { - oldStart: oldRangeStart, - oldLines: oldLine - oldRangeStart + contextSize, - newStart: newRangeStart, - newLines: newLine - newRangeStart + contextSize, - lines: curRange - }; - - if (i >= diff.length - 2 && lines.length <= options.context) { - // EOF is inside this hunk - var oldEOFNewline = /\n$/.test(oldStr); - var newEOFNewline = /\n$/.test(newStr); - var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; - - if (!oldEOFNewline && noNlBeforeAdds) { - // special case: old has no eol and no trailing context; no-nl can end up before adds - curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); - } - - if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { - curRange.push('\\ No newline at end of file'); - } - } - - hunks.push(hunk); - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; - } - } - - oldLine += lines.length; - newLine += lines.length; - } - }; - - for (var i = 0; i < diff.length; i++) { - _loop(i); - } - - return { - oldFileName: oldFileName, - newFileName: newFileName, - oldHeader: oldHeader, - newHeader: newHeader, - hunks: hunks - }; -} -function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); - var ret = []; - - if (oldFileName == newFileName) { - ret.push('Index: ' + oldFileName); - } - - ret.push('==================================================================='); - ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); - ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); - - for (var i = 0; i < diff.hunks.length; i++) { - var hunk = diff.hunks[i]; - ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); - ret.push.apply(ret, hunk.lines); - } - - return ret.join('\n') + '\n'; -} -function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { - return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); -} - -function arrayEqual(a, b) { - if (a.length !== b.length) { - return false; - } - - return arrayStartsWith(a, b); -} -function arrayStartsWith(array, start) { - if (start.length > array.length) { - return false; - } - - for (var i = 0; i < start.length; i++) { - if (start[i] !== array[i]) { - return false; - } - } - - return true; -} - -function calcLineCount(hunk) { - var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), - oldLines = _calcOldNewLineCount.oldLines, - newLines = _calcOldNewLineCount.newLines; - - if (oldLines !== undefined) { - hunk.oldLines = oldLines; - } else { - delete hunk.oldLines; - } - - if (newLines !== undefined) { - hunk.newLines = newLines; - } else { - delete hunk.newLines; - } -} -function merge(mine, theirs, base) { - mine = loadPatch(mine, base); - theirs = loadPatch(theirs, base); - var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. - // Leaving sanity checks on this to the API consumer that may know more about the - // meaning in their own context. - - if (mine.index || theirs.index) { - ret.index = mine.index || theirs.index; - } - - if (mine.newFileName || theirs.newFileName) { - if (!fileNameChanged(mine)) { - // No header or no change in ours, use theirs (and ours if theirs does not exist) - ret.oldFileName = theirs.oldFileName || mine.oldFileName; - ret.newFileName = theirs.newFileName || mine.newFileName; - ret.oldHeader = theirs.oldHeader || mine.oldHeader; - ret.newHeader = theirs.newHeader || mine.newHeader; - } else if (!fileNameChanged(theirs)) { - // No header or no change in theirs, use ours - ret.oldFileName = mine.oldFileName; - ret.newFileName = mine.newFileName; - ret.oldHeader = mine.oldHeader; - ret.newHeader = mine.newHeader; - } else { - // Both changed... figure it out - ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); - ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); - ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); - ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); - } - } - - ret.hunks = []; - var mineIndex = 0, - theirsIndex = 0, - mineOffset = 0, - theirsOffset = 0; - - while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { - var mineCurrent = mine.hunks[mineIndex] || { - oldStart: Infinity - }, - theirsCurrent = theirs.hunks[theirsIndex] || { - oldStart: Infinity - }; - - if (hunkBefore(mineCurrent, theirsCurrent)) { - // This patch does not overlap with any of the others, yay. - ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); - mineIndex++; - theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; - } else if (hunkBefore(theirsCurrent, mineCurrent)) { - // This patch does not overlap with any of the others, yay. - ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); - theirsIndex++; - mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; - } else { - // Overlap, merge as best we can - var mergedHunk = { - oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), - oldLines: 0, - newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), - newLines: 0, - lines: [] - }; - mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); - theirsIndex++; - mineIndex++; - ret.hunks.push(mergedHunk); - } - } - - return ret; -} - -function loadPatch(param, base) { - if (typeof param === 'string') { - if (/^@@/m.test(param) || /^Index:/m.test(param)) { - return parsePatch(param)[0]; - } - - if (!base) { - throw new Error('Must provide a base reference or pass in a patch'); - } - - return structuredPatch(undefined, undefined, base, param); - } - - return param; -} - -function fileNameChanged(patch) { - return patch.newFileName && patch.newFileName !== patch.oldFileName; -} - -function selectField(index, mine, theirs) { - if (mine === theirs) { - return mine; - } else { - index.conflict = true; - return { - mine: mine, - theirs: theirs - }; - } -} - -function hunkBefore(test, check) { - return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; -} - -function cloneHunk(hunk, offset) { - return { - oldStart: hunk.oldStart, - oldLines: hunk.oldLines, - newStart: hunk.newStart + offset, - newLines: hunk.newLines, - lines: hunk.lines - }; -} - -function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { - // This will generally result in a conflicted hunk, but there are cases where the context - // is the only overlap where we can successfully merge the content here. - var mine = { - offset: mineOffset, - lines: mineLines, - index: 0 - }, - their = { - offset: theirOffset, - lines: theirLines, - index: 0 - }; // Handle any leading content - - insertLeading(hunk, mine, their); - insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. - - while (mine.index < mine.lines.length && their.index < their.lines.length) { - var mineCurrent = mine.lines[mine.index], - theirCurrent = their.lines[their.index]; - - if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { - // Both modified ... - mutualChange(hunk, mine, their); - } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { - var _hunk$lines; - - // Mine inserted - (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); - } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { - var _hunk$lines2; - - // Theirs inserted - (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); - } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { - // Mine removed or edited - removal(hunk, mine, their); - } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { - // Their removed or edited - removal(hunk, their, mine, true); - } else if (mineCurrent === theirCurrent) { - // Context identity - hunk.lines.push(mineCurrent); - mine.index++; - their.index++; - } else { - // Context mismatch - conflict(hunk, collectChange(mine), collectChange(their)); - } - } // Now push anything that may be remaining - - - insertTrailing(hunk, mine); - insertTrailing(hunk, their); - calcLineCount(hunk); -} - -function mutualChange(hunk, mine, their) { - var myChanges = collectChange(mine), - theirChanges = collectChange(their); - - if (allRemoves(myChanges) && allRemoves(theirChanges)) { - // Special case for remove changes that are supersets of one another - if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { - var _hunk$lines3; - - (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); - - return; - } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { - var _hunk$lines4; - - (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); - - return; - } - } else if (arrayEqual(myChanges, theirChanges)) { - var _hunk$lines5; - - (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); - - return; - } - - conflict(hunk, myChanges, theirChanges); -} - -function removal(hunk, mine, their, swap) { - var myChanges = collectChange(mine), - theirChanges = collectContext(their, myChanges); - - if (theirChanges.merged) { - var _hunk$lines6; - - (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); - } else { - conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); - } -} - -function conflict(hunk, mine, their) { - hunk.conflict = true; - hunk.lines.push({ - conflict: true, - mine: mine, - theirs: their - }); -} - -function insertLeading(hunk, insert, their) { - while (insert.offset < their.offset && insert.index < insert.lines.length) { - var line = insert.lines[insert.index++]; - hunk.lines.push(line); - insert.offset++; - } -} - -function insertTrailing(hunk, insert) { - while (insert.index < insert.lines.length) { - var line = insert.lines[insert.index++]; - hunk.lines.push(line); - } -} - -function collectChange(state) { - var ret = [], - operation = state.lines[state.index][0]; - - while (state.index < state.lines.length) { - var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. - - if (operation === '-' && line[0] === '+') { - operation = '+'; - } - - if (operation === line[0]) { - ret.push(line); - state.index++; - } else { - break; - } - } - - return ret; -} - -function collectContext(state, matchChanges) { - var changes = [], - merged = [], - matchIndex = 0, - contextChanges = false, - conflicted = false; - - while (matchIndex < matchChanges.length && state.index < state.lines.length) { - var change = state.lines[state.index], - match = matchChanges[matchIndex]; // Once we've hit our add, then we are done - - if (match[0] === '+') { - break; - } - - contextChanges = contextChanges || change[0] !== ' '; - merged.push(match); - matchIndex++; // Consume any additions in the other block as a conflict to attempt - // to pull in the remaining context after this - - if (change[0] === '+') { - conflicted = true; - - while (change[0] === '+') { - changes.push(change); - change = state.lines[++state.index]; - } - } - - if (match.substr(1) === change.substr(1)) { - changes.push(change); - state.index++; - } else { - conflicted = true; - } - } - - if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { - conflicted = true; - } - - if (conflicted) { - return changes; - } - - while (matchIndex < matchChanges.length) { - merged.push(matchChanges[matchIndex++]); - } - - return { - merged: merged, - changes: changes - }; -} - -function allRemoves(changes) { - return changes.reduce(function (prev, change) { - return prev && change[0] === '-'; - }, true); -} - -function skipRemoveSuperset(state, removeChanges, delta) { - for (var i = 0; i < delta; i++) { - var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); - - if (state.lines[state.index + i] !== ' ' + changeContent) { - return false; - } - } - - state.index += delta; - return true; -} - -function calcOldNewLineCount(lines) { - var oldLines = 0; - var newLines = 0; - lines.forEach(function (line) { - if (typeof line !== 'string') { - var myCount = calcOldNewLineCount(line.mine); - var theirCount = calcOldNewLineCount(line.theirs); - - if (oldLines !== undefined) { - if (myCount.oldLines === theirCount.oldLines) { - oldLines += myCount.oldLines; - } else { - oldLines = undefined; - } - } - - if (newLines !== undefined) { - if (myCount.newLines === theirCount.newLines) { - newLines += myCount.newLines; - } else { - newLines = undefined; - } - } - } else { - if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { - newLines++; - } - - if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { - oldLines++; - } - } - }); - return { - oldLines: oldLines, - newLines: newLines - }; -} - -// See: http://code.google.com/p/google-diff-match-patch/wiki/API -function convertChangesToDMP(changes) { - var ret = [], - change, - operation; - - for (var i = 0; i < changes.length; i++) { - change = changes[i]; - - if (change.added) { - operation = 1; - } else if (change.removed) { - operation = -1; - } else { - operation = 0; - } - - ret.push([operation, change.value]); - } - - return ret; -} - -function convertChangesToXML(changes) { - var ret = []; - - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - - ret.push(escapeHTML(change.value)); - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - } - - return ret.join(''); -} - -function escapeHTML(s) { - var n = s; - n = n.replace(/&/g, '&'); - n = n.replace(//g, '>'); - n = n.replace(/"/g, '"'); - return n; -} - -/* See LICENSE file for terms of use */ - -export { Diff, diffChars, diffWords, diffWordsWithSpace, diffLines, diffTrimmedLines, diffSentences, diffCss, diffJson, diffArrays, structuredPatch, createTwoFilesPatch, createPatch, applyPatch, applyPatches, parsePatch, merge, convertChangesToDMP, convertChangesToXML, canonicalize }; diff --git a/node_modules/diff/lib/index.js b/node_modules/diff/lib/index.js deleted file mode 100644 index ff8ae91..0000000 --- a/node_modules/diff/lib/index.js +++ /dev/null @@ -1,216 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "Diff", { - enumerable: true, - get: function get() { - return _base.default; - } -}); -Object.defineProperty(exports, "diffChars", { - enumerable: true, - get: function get() { - return _character.diffChars; - } -}); -Object.defineProperty(exports, "diffWords", { - enumerable: true, - get: function get() { - return _word.diffWords; - } -}); -Object.defineProperty(exports, "diffWordsWithSpace", { - enumerable: true, - get: function get() { - return _word.diffWordsWithSpace; - } -}); -Object.defineProperty(exports, "diffLines", { - enumerable: true, - get: function get() { - return _line.diffLines; - } -}); -Object.defineProperty(exports, "diffTrimmedLines", { - enumerable: true, - get: function get() { - return _line.diffTrimmedLines; - } -}); -Object.defineProperty(exports, "diffSentences", { - enumerable: true, - get: function get() { - return _sentence.diffSentences; - } -}); -Object.defineProperty(exports, "diffCss", { - enumerable: true, - get: function get() { - return _css.diffCss; - } -}); -Object.defineProperty(exports, "diffJson", { - enumerable: true, - get: function get() { - return _json.diffJson; - } -}); -Object.defineProperty(exports, "canonicalize", { - enumerable: true, - get: function get() { - return _json.canonicalize; - } -}); -Object.defineProperty(exports, "diffArrays", { - enumerable: true, - get: function get() { - return _array.diffArrays; - } -}); -Object.defineProperty(exports, "applyPatch", { - enumerable: true, - get: function get() { - return _apply.applyPatch; - } -}); -Object.defineProperty(exports, "applyPatches", { - enumerable: true, - get: function get() { - return _apply.applyPatches; - } -}); -Object.defineProperty(exports, "parsePatch", { - enumerable: true, - get: function get() { - return _parse.parsePatch; - } -}); -Object.defineProperty(exports, "merge", { - enumerable: true, - get: function get() { - return _merge.merge; - } -}); -Object.defineProperty(exports, "structuredPatch", { - enumerable: true, - get: function get() { - return _create.structuredPatch; - } -}); -Object.defineProperty(exports, "createTwoFilesPatch", { - enumerable: true, - get: function get() { - return _create.createTwoFilesPatch; - } -}); -Object.defineProperty(exports, "createPatch", { - enumerable: true, - get: function get() { - return _create.createPatch; - } -}); -Object.defineProperty(exports, "convertChangesToDMP", { - enumerable: true, - get: function get() { - return _dmp.convertChangesToDMP; - } -}); -Object.defineProperty(exports, "convertChangesToXML", { - enumerable: true, - get: function get() { - return _xml.convertChangesToXML; - } -}); - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_base = _interopRequireDefault(require("./diff/base")) -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_character = require("./diff/character") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_word = require("./diff/word") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_line = require("./diff/line") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_sentence = require("./diff/sentence") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_css = require("./diff/css") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_json = require("./diff/json") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_array = require("./diff/array") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_apply = require("./patch/apply") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_parse = require("./patch/parse") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_merge = require("./patch/merge") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_create = require("./patch/create") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_dmp = require("./convert/dmp") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_xml = require("./convert/xml") -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/*istanbul ignore end*/ -//# sourceMappingURL=data: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cHBseVBhdGNoZXN9IGZyb20gJy4vcGF0Y2gvYXBwbHknO1xuaW1wb3J0IHtwYXJzZVBhdGNofSBmcm9tICcuL3BhdGNoL3BhcnNlJztcbmltcG9ydCB7bWVyZ2V9IGZyb20gJy4vcGF0Y2gvbWVyZ2UnO1xuaW1wb3J0IHtzdHJ1Y3R1cmVkUGF0Y2gsIGNyZWF0ZVR3b0ZpbGVzUGF0Y2gsIGNyZWF0ZVBhdGNofSBmcm9tICcuL3BhdGNoL2NyZWF0ZSc7XG5cbmltcG9ydCB7Y29udmVydENoYW5nZXNUb0RNUH0gZnJvbSAnLi9jb252ZXJ0L2RtcCc7XG5pbXBvcnQge2NvbnZlcnRDaGFuZ2VzVG9YTUx9IGZyb20gJy4vY29udmVydC94bWwnO1xuXG5leHBvcnQge1xuICBEaWZmLFxuXG4gIGRpZmZDaGFycyxcbiAgZGlmZldvcmRzLFxuICBkaWZmV29yZHNXaXRoU3BhY2UsXG4gIGRpZmZMaW5lcyxcbiAgZGlmZlRyaW1tZWRMaW5lcyxcbiAgZGlmZlNlbnRlbmNlcyxcblxuICBkaWZmQ3NzLFxuICBkaWZmSnNvbixcblxuICBkaWZmQXJyYXlzLFxuXG4gIHN0cnVjdHVyZWRQYXRjaCxcbiAgY3JlYXRlVHdvRmlsZXNQYXRjaCxcbiAgY3JlYXRlUGF0Y2gsXG4gIGFwcGx5UGF0Y2gsXG4gIGFwcGx5UGF0Y2hlcyxcbiAgcGFyc2VQYXRjaCxcbiAgbWVyZ2UsXG4gIGNvbnZlcnRDaGFuZ2VzVG9ETVAsXG4gIGNvbnZlcnRDaGFuZ2VzVG9YTUwsXG4gIGNhbm9uaWNhbGl6ZVxufTtcbiJdfQ== diff --git a/node_modules/diff/lib/patch/apply.js b/node_modules/diff/lib/patch/apply.js deleted file mode 100644 index 19bddd8..0000000 --- a/node_modules/diff/lib/patch/apply.js +++ /dev/null @@ -1,243 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.applyPatch = applyPatch; -exports.applyPatches = applyPatches; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_parse = require("./parse") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_distanceIterator = _interopRequireDefault(require("../util/distance-iterator")) -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/*istanbul ignore end*/ -function applyPatch(source, uniDiff) { - /*istanbul ignore start*/ - var - /*istanbul ignore end*/ - options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - if (typeof uniDiff === 'string') { - uniDiff = - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _parse - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - parsePatch) - /*istanbul ignore end*/ - (uniDiff); - } - - if (Array.isArray(uniDiff)) { - if (uniDiff.length > 1) { - throw new Error('applyPatch only works with a single input.'); - } - - uniDiff = uniDiff[0]; - } // Apply the diff to the input - - - var lines = source.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], - hunks = uniDiff.hunks, - compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) - /*istanbul ignore start*/ - { - return ( - /*istanbul ignore end*/ - line === patchContent - ); - }, - errorCount = 0, - fuzzFactor = options.fuzzFactor || 0, - minLine = 0, - offset = 0, - removeEOFNL, - addEOFNL; - /** - * Checks if the hunk exactly fits on the provided location - */ - - - function hunkFits(hunk, toPos) { - for (var j = 0; j < hunk.lines.length; j++) { - var line = hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line; - - if (operation === ' ' || operation === '-') { - // Context sanity check - if (!compareLine(toPos + 1, lines[toPos], operation, content)) { - errorCount++; - - if (errorCount > fuzzFactor) { - return false; - } - } - - toPos++; - } - } - - return true; - } // Search best fit offsets for each hunk based on the previous ones - - - for (var i = 0; i < hunks.length; i++) { - var hunk = hunks[i], - maxLine = lines.length - hunk.oldLines, - localOffset = 0, - toPos = offset + hunk.oldStart - 1; - var iterator = - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _distanceIterator - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - default) - /*istanbul ignore end*/ - (toPos, minLine, maxLine); - - for (; localOffset !== undefined; localOffset = iterator()) { - if (hunkFits(hunk, toPos + localOffset)) { - hunk.offset = offset += localOffset; - break; - } - } - - if (localOffset === undefined) { - return false; - } // Set lower text limit to end of the current hunk, so next ones don't try - // to fit over already patched text - - - minLine = hunk.offset + hunk.oldStart + hunk.oldLines; - } // Apply patch hunks - - - var diffOffset = 0; - - for (var _i = 0; _i < hunks.length; _i++) { - var _hunk = hunks[_i], - _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; - - diffOffset += _hunk.newLines - _hunk.oldLines; - - if (_toPos < 0) { - // Creating a new file - _toPos = 0; - } - - for (var j = 0; j < _hunk.lines.length; j++) { - var line = _hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters[j]; - - if (operation === ' ') { - _toPos++; - } else if (operation === '-') { - lines.splice(_toPos, 1); - delimiters.splice(_toPos, 1); - /* istanbul ignore else */ - } else if (operation === '+') { - lines.splice(_toPos, 0, content); - delimiters.splice(_toPos, 0, delimiter); - _toPos++; - } else if (operation === '\\') { - var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; - - if (previousOperation === '+') { - removeEOFNL = true; - } else if (previousOperation === '-') { - addEOFNL = true; - } - } - } - } // Handle EOFNL insertion/removal - - - if (removeEOFNL) { - while (!lines[lines.length - 1]) { - lines.pop(); - delimiters.pop(); - } - } else if (addEOFNL) { - lines.push(''); - delimiters.push('\n'); - } - - for (var _k = 0; _k < lines.length - 1; _k++) { - lines[_k] = lines[_k] + delimiters[_k]; - } - - return lines.join(''); -} // Wrapper that supports multiple file patches via callbacks. - - -function applyPatches(uniDiff, options) { - if (typeof uniDiff === 'string') { - uniDiff = - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _parse - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - parsePatch) - /*istanbul ignore end*/ - (uniDiff); - } - - var currentIndex = 0; - - function processIndex() { - var index = uniDiff[currentIndex++]; - - if (!index) { - return options.complete(); - } - - options.loadFile(index, function (err, data) { - if (err) { - return options.complete(err); - } - - var updatedContent = applyPatch(data, index, options); - options.patched(index, updatedContent, function (err) { - if (err) { - return options.complete(err); - } - - processIndex(); - }); - }); - } - - processIndex(); -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJwYXJzZVBhdGNoIiwiQXJyYXkiLCJpc0FycmF5IiwibGVuZ3RoIiwiRXJyb3IiLCJsaW5lcyIsInNwbGl0IiwiZGVsaW1pdGVycyIsIm1hdGNoIiwiaHVua3MiLCJjb21wYXJlTGluZSIsImxpbmVOdW1iZXIiLCJsaW5lIiwib3BlcmF0aW9uIiwicGF0Y2hDb250ZW50IiwiZXJyb3JDb3VudCIsImZ1enpGYWN0b3IiLCJtaW5MaW5lIiwib2Zmc2V0IiwicmVtb3ZlRU9GTkwiLCJhZGRFT0ZOTCIsImh1bmtGaXRzIiwiaHVuayIsInRvUG9zIiwiaiIsImNvbnRlbnQiLCJzdWJzdHIiLCJpIiwibWF4TGluZSIsIm9sZExpbmVzIiwibG9jYWxPZmZzZXQiLCJvbGRTdGFydCIsIml0ZXJhdG9yIiwiZGlzdGFuY2VJdGVyYXRvciIsInVuZGVmaW5lZCIsImRpZmZPZmZzZXQiLCJuZXdMaW5lcyIsImR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BodW5rc1xuICBsZXQgZGlmZk9mZnNldCA9IDA7XG4gIGZvciAobGV0IGkgPSAwOyBpIDwgaHVua3MubGVuZ3RoOyBpKyspIHtcbiAgICBsZXQgaHVuayA9IGh1bmtzW2ldLFxuICAgICAgICB0b1BvcyA9IGh1bmsub2xkU3RhcnQgKyBodW5rLm9mZnNldCArIGRpZmZPZmZzZXQgLSAxO1xuICAgIGRpZmZPZmZzZXQgKz0gaHVuay5uZXdMaW5lcyAtIGh1bmsub2xkTGluZXM7XG5cbiAgICBpZiAodG9Qb3MgPCAwKSB7IC8vIENyZWF0aW5nIGEgbmV3IGZpbGVcbiAgICAgIHRvUG9zID0gMDtcbiAgICB9XG5cbiAgICBmb3IgKGxldCBqID0gMDsgaiA8IGh1bmsubGluZXMubGVuZ3RoOyBqKyspIHtcbiAgICAgIGxldCBsaW5lID0gaHVuay5saW5lc1tqXSxcbiAgICAgICAgICBvcGVyYXRpb24gPSAobGluZS5sZW5ndGggPiAwID8gbGluZVswXSA6ICcgJyksXG4gICAgICAgICAgY29udGVudCA9IChsaW5lLmxlbmd0aCA+IDAgPyBsaW5lLnN1YnN0cigxKSA6IGxpbmUpLFxuICAgICAgICAgIGRlbGltaXRlciA9IGh1bmsubGluZWRlbGltaXRlcnNbal07XG5cbiAgICAgIGlmIChvcGVyYXRpb24gPT09ICcgJykge1xuICAgICAgICB0b1BvcysrO1xuICAgICAgfSBlbHNlIGlmIChvcGVyYXRpb24gPT09ICctJykge1xuICAgICAgICBsaW5lcy5zcGxpY2UodG9Qb3MsIDEpO1xuICAgICAgICBkZWxpbWl0ZXJzLnNwbGljZSh0b1BvcywgMSk7XG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgfSBlbHNlIGlmIChvcGVyYXRpb24gPT09ICcrJykge1xuICAgICAgICBsaW5lcy5zcGxpY2UodG9Qb3MsIDAsIGNvbnRlbnQpO1xuICAgICAgICBkZWxpbWl0ZXJzLnNwbGljZSh0b1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ICBpZiAodHlwZW9mIHVuaURpZmYgPT09ICdzdHJpbmcnKSB7XG4gICAgdW5pRGlmZiA9IHBhcnNlUGF0Y2godW5pRGlmZik7XG4gIH1cblxuICBsZXQgY3VycmVudEluZGV4ID0gMDtcbiAgZnVuY3Rpb24gcHJvY2Vzc0luZGV4KCkge1xuICAgIGxldCBpbmRleCA9IHVuaURpZmZbY3VycmVudEluZGV4KytdO1xuICAgIGlmICghaW5kZXgpIHtcbiAgICAgIHJldHVybiBvcHRpb25zLmNvbXBsZXRlKCk7XG4gICAgfVxuXG4gICAgb3B0aW9ucy5sb2FkRmlsZShpbmRleCwgZnVuY3Rpb24oZXJyLCBkYXRhKSB7XG4gICAgICBpZiAoZXJyKSB7XG4gICAgICAgIHJldHVybiBvcHRpb25zLmNvbXBsZXRlKGVycik7XG4gICAgICB9XG5cbiAgICAgIGxldCB1cGRhdGVkQ29udGVudCA9IGFwcGx5UGF0Y2goZGF0YSwgaW5kZXgsIG9wdGlvbnMpO1xuICAgICAgb3B0aW9ucy5wYXRjaGVkKGluZGV4LCB1cGRhdGVkQ29udGVudCwgZnVuY3Rpb24oZXJyKSB7XG4gICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICByZXR1cm4gb3B0aW9ucy5jb21wbGV0ZShlcnIpO1xuICAgICAgICB9XG5cbiAgICAgICAgcHJvY2Vzc0luZGV4KCk7XG4gICAgICB9KTtcbiAgICB9KTtcbiAgfVxuICBwcm9jZXNzSW5kZXgoKTtcbn1cbiJdfQ== diff --git a/node_modules/diff/lib/patch/create.js b/node_modules/diff/lib/patch/create.js deleted file mode 100644 index d1717fe..0000000 --- a/node_modules/diff/lib/patch/create.js +++ /dev/null @@ -1,247 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.structuredPatch = structuredPatch; -exports.createTwoFilesPatch = createTwoFilesPatch; -exports.createPatch = createPatch; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_line = require("../diff/line") -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -/*istanbul ignore end*/ -function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - if (!options) { - options = {}; - } - - if (typeof options.context === 'undefined') { - options.context = 4; - } - - var diff = - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _line - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - diffLines) - /*istanbul ignore end*/ - (oldStr, newStr, options); - diff.push({ - value: '', - lines: [] - }); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function (entry) { - return ' ' + entry; - }); - } - - var hunks = []; - var oldRangeStart = 0, - newRangeStart = 0, - curRange = [], - oldLine = 1, - newLine = 1; - - /*istanbul ignore start*/ - var _loop = function _loop( - /*istanbul ignore end*/ - i) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - /*istanbul ignore start*/ - var _curRange; - - /*istanbul ignore end*/ - // If we have previous context, start with that - if (!oldRangeStart) { - var prev = diff[i - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; - } - } // Output our changes - - - /*istanbul ignore start*/ - (_curRange = - /*istanbul ignore end*/ - curRange).push. - /*istanbul ignore start*/ - apply - /*istanbul ignore end*/ - ( - /*istanbul ignore start*/ - _curRange - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - lines.map(function (entry) { - return (current.added ? '+' : '-') + entry; - }))); // Track the updated file position - - - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - // Identical context lines. Track line changes - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= options.context * 2 && i < diff.length - 2) { - /*istanbul ignore start*/ - var _curRange2; - - /*istanbul ignore end*/ - // Overlapping - - /*istanbul ignore start*/ - (_curRange2 = - /*istanbul ignore end*/ - curRange).push. - /*istanbul ignore start*/ - apply - /*istanbul ignore end*/ - ( - /*istanbul ignore start*/ - _curRange2 - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - contextLines(lines))); - } else { - /*istanbul ignore start*/ - var _curRange3; - - /*istanbul ignore end*/ - // end the range and output - var contextSize = Math.min(lines.length, options.context); - - /*istanbul ignore start*/ - (_curRange3 = - /*istanbul ignore end*/ - curRange).push. - /*istanbul ignore start*/ - apply - /*istanbul ignore end*/ - ( - /*istanbul ignore start*/ - _curRange3 - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - contextLines(lines.slice(0, contextSize)))); - - var hunk = { - oldStart: oldRangeStart, - oldLines: oldLine - oldRangeStart + contextSize, - newStart: newRangeStart, - newLines: newLine - newRangeStart + contextSize, - lines: curRange - }; - - if (i >= diff.length - 2 && lines.length <= options.context) { - // EOF is inside this hunk - var oldEOFNewline = /\n$/.test(oldStr); - var newEOFNewline = /\n$/.test(newStr); - var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; - - if (!oldEOFNewline && noNlBeforeAdds) { - // special case: old has no eol and no trailing context; no-nl can end up before adds - curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); - } - - if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { - curRange.push('\\ No newline at end of file'); - } - } - - hunks.push(hunk); - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; - } - } - - oldLine += lines.length; - newLine += lines.length; - } - }; - - for (var i = 0; i < diff.length; i++) { - /*istanbul ignore start*/ - _loop( - /*istanbul ignore end*/ - i); - } - - return { - oldFileName: oldFileName, - newFileName: newFileName, - oldHeader: oldHeader, - newHeader: newHeader, - hunks: hunks - }; -} - -function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); - var ret = []; - - if (oldFileName == newFileName) { - ret.push('Index: ' + oldFileName); - } - - ret.push('==================================================================='); - ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); - ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); - - for (var i = 0; i < diff.hunks.length; i++) { - var hunk = diff.hunks[i]; - ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); - ret.push.apply(ret, hunk.lines); - } - - return ret.join('\n') + '\n'; -} - -function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { - return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9jcmVhdGUuanMiXSwibmFtZXMiOlsic3RydWN0dXJlZFBhdGNoIiwib2xkRmlsZU5hbWUiLCJuZXdGaWxlTmFtZSIsIm9sZFN0ciIsIm5ld1N0ciIsIm9sZEhlYWRlciIsIm5ld0hlYWRlciIsIm9wdGlvbnMiLCJjb250ZXh0IiwiZGlmZiIsImRpZmZMaW5lcyIsInB1c2giLCJ2YWx1ZSIsImxpbmVzIiwiY29udGV4dExpbmVzIiwibWFwIi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cmV0LnB1c2goJy0tLSAnICsgZGlmZi5vbGRGaWxlTmFtZSArICh0eXBlb2YgZGlmZi5vbGRIZWFkZXIgPT09ICd1bmRlZmluZWQnID8gJycgOiAnXFx0JyArIGRpZmYub2xkSGVhZGVyKSk7XG4gIHJldC5wdXNoKCcrKysgJyArIGRpZmYubmV3RmlsZU5hbWUgKyAodHlwZW9mIGRpZmYubmV3SGVhZGVyID09PSAndW5kZWZpbmVkJyA/ICcnIDogJ1xcdCcgKyBkaWZmLm5ld0hlYWRlcikpO1xuXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgZGlmZi5odW5rcy5sZW5ndGg7IGkrKykge1xuICAgIGNvbnN0IGh1bmsgPSBkaWZmLmh1bmtzW2ldO1xuICAgIHJldC5wdXNoKFxuICAgICAgJ0BAIC0nICsgaHVuay5vbGRTdGFydCArICcsJyArIGh1bmsub2xkTGluZXNcbiAgICAgICsgJyArJyArIGh1bmsubmV3U3RhcnQgKyAnLCcgKyBodW5rLm5ld0xpbmVzXG4gICAgICArICcgQEAnXG4gICAgKTtcbiAgICByZXQucHVzaC5hcHBseShyZXQsIGh1bmsubGluZXMpO1xuICB9XG5cbiAgcmV0dXJuIHJldC5qb2luKCdcXG4nKSArICdcXG4nO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlUGF0Y2goZmlsZU5hbWUsIG9sZFN0ciwgbmV3U3RyLCBvbGRIZWFkZXIsIG5ld0hlYWRlciwgb3B0aW9ucykge1xuICByZXR1cm4gY3JlYXRlVHdvRmlsZXNQYXRjaChmaWxlTmFtZSwgZmlsZU5hbWUsIG9sZFN0ciwgbmV3U3RyLCBvbGRIZWFkZXIsIG5ld0hlYWRlciwgb3B0aW9ucyk7XG59XG4iXX0= diff --git a/node_modules/diff/lib/patch/merge.js b/node_modules/diff/lib/patch/merge.js deleted file mode 100644 index bbd429a..0000000 --- a/node_modules/diff/lib/patch/merge.js +++ /dev/null @@ -1,609 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.calcLineCount = calcLineCount; -exports.merge = merge; - -/*istanbul ignore end*/ -var -/*istanbul ignore start*/ -_create = require("./create") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_parse = require("./parse") -/*istanbul ignore end*/ -; - -var -/*istanbul ignore start*/ -_array = require("../util/array") -/*istanbul ignore end*/ -; - -/*istanbul ignore start*/ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -/*istanbul ignore end*/ -function calcLineCount(hunk) { - /*istanbul ignore start*/ - var _calcOldNewLineCount = - /*istanbul ignore end*/ - calcOldNewLineCount(hunk.lines), - oldLines = _calcOldNewLineCount.oldLines, - newLines = _calcOldNewLineCount.newLines; - - if (oldLines !== undefined) { - hunk.oldLines = oldLines; - } else { - delete hunk.oldLines; - } - - if (newLines !== undefined) { - hunk.newLines = newLines; - } else { - delete hunk.newLines; - } -} - -function merge(mine, theirs, base) { - mine = loadPatch(mine, base); - theirs = loadPatch(theirs, base); - var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. - // Leaving sanity checks on this to the API consumer that may know more about the - // meaning in their own context. - - if (mine.index || theirs.index) { - ret.index = mine.index || theirs.index; - } - - if (mine.newFileName || theirs.newFileName) { - if (!fileNameChanged(mine)) { - // No header or no change in ours, use theirs (and ours if theirs does not exist) - ret.oldFileName = theirs.oldFileName || mine.oldFileName; - ret.newFileName = theirs.newFileName || mine.newFileName; - ret.oldHeader = theirs.oldHeader || mine.oldHeader; - ret.newHeader = theirs.newHeader || mine.newHeader; - } else if (!fileNameChanged(theirs)) { - // No header or no change in theirs, use ours - ret.oldFileName = mine.oldFileName; - ret.newFileName = mine.newFileName; - ret.oldHeader = mine.oldHeader; - ret.newHeader = mine.newHeader; - } else { - // Both changed... figure it out - ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); - ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); - ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); - ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); - } - } - - ret.hunks = []; - var mineIndex = 0, - theirsIndex = 0, - mineOffset = 0, - theirsOffset = 0; - - while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { - var mineCurrent = mine.hunks[mineIndex] || { - oldStart: Infinity - }, - theirsCurrent = theirs.hunks[theirsIndex] || { - oldStart: Infinity - }; - - if (hunkBefore(mineCurrent, theirsCurrent)) { - // This patch does not overlap with any of the others, yay. - ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); - mineIndex++; - theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; - } else if (hunkBefore(theirsCurrent, mineCurrent)) { - // This patch does not overlap with any of the others, yay. - ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); - theirsIndex++; - mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; - } else { - // Overlap, merge as best we can - var mergedHunk = { - oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), - oldLines: 0, - newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), - newLines: 0, - lines: [] - }; - mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); - theirsIndex++; - mineIndex++; - ret.hunks.push(mergedHunk); - } - } - - return ret; -} - -function loadPatch(param, base) { - if (typeof param === 'string') { - if (/^@@/m.test(param) || /^Index:/m.test(param)) { - return ( - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _parse - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - parsePatch) - /*istanbul ignore end*/ - (param)[0] - ); - } - - if (!base) { - throw new Error('Must provide a base reference or pass in a patch'); - } - - return ( - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _create - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - structuredPatch) - /*istanbul ignore end*/ - (undefined, undefined, base, param) - ); - } - - return param; -} - -function fileNameChanged(patch) { - return patch.newFileName && patch.newFileName !== patch.oldFileName; -} - -function selectField(index, mine, theirs) { - if (mine === theirs) { - return mine; - } else { - index.conflict = true; - return { - mine: mine, - theirs: theirs - }; - } -} - -function hunkBefore(test, check) { - return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; -} - -function cloneHunk(hunk, offset) { - return { - oldStart: hunk.oldStart, - oldLines: hunk.oldLines, - newStart: hunk.newStart + offset, - newLines: hunk.newLines, - lines: hunk.lines - }; -} - -function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { - // This will generally result in a conflicted hunk, but there are cases where the context - // is the only overlap where we can successfully merge the content here. - var mine = { - offset: mineOffset, - lines: mineLines, - index: 0 - }, - their = { - offset: theirOffset, - lines: theirLines, - index: 0 - }; // Handle any leading content - - insertLeading(hunk, mine, their); - insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. - - while (mine.index < mine.lines.length && their.index < their.lines.length) { - var mineCurrent = mine.lines[mine.index], - theirCurrent = their.lines[their.index]; - - if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { - // Both modified ... - mutualChange(hunk, mine, their); - } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { - /*istanbul ignore start*/ - var _hunk$lines; - - /*istanbul ignore end*/ - // Mine inserted - - /*istanbul ignore start*/ - (_hunk$lines = - /*istanbul ignore end*/ - hunk.lines).push. - /*istanbul ignore start*/ - apply - /*istanbul ignore end*/ - ( - /*istanbul ignore start*/ - _hunk$lines - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - collectChange(mine))); - } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { - /*istanbul ignore start*/ - var _hunk$lines2; - - /*istanbul ignore end*/ - // Theirs inserted - - /*istanbul ignore start*/ - (_hunk$lines2 = - /*istanbul ignore end*/ - hunk.lines).push. - /*istanbul ignore start*/ - apply - /*istanbul ignore end*/ - ( - /*istanbul ignore start*/ - _hunk$lines2 - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - collectChange(their))); - } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { - // Mine removed or edited - removal(hunk, mine, their); - } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { - // Their removed or edited - removal(hunk, their, mine, true); - } else if (mineCurrent === theirCurrent) { - // Context identity - hunk.lines.push(mineCurrent); - mine.index++; - their.index++; - } else { - // Context mismatch - conflict(hunk, collectChange(mine), collectChange(their)); - } - } // Now push anything that may be remaining - - - insertTrailing(hunk, mine); - insertTrailing(hunk, their); - calcLineCount(hunk); -} - -function mutualChange(hunk, mine, their) { - var myChanges = collectChange(mine), - theirChanges = collectChange(their); - - if (allRemoves(myChanges) && allRemoves(theirChanges)) { - // Special case for remove changes that are supersets of one another - if ( - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _array - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - arrayStartsWith) - /*istanbul ignore end*/ - (myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { - /*istanbul ignore start*/ - var _hunk$lines3; - - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - (_hunk$lines3 = - /*istanbul ignore end*/ - hunk.lines).push. - /*istanbul ignore start*/ - apply - /*istanbul ignore end*/ - ( - /*istanbul ignore start*/ - _hunk$lines3 - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - myChanges)); - - return; - } else if ( - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _array - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - arrayStartsWith) - /*istanbul ignore end*/ - (theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { - /*istanbul ignore start*/ - var _hunk$lines4; - - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - (_hunk$lines4 = - /*istanbul ignore end*/ - hunk.lines).push. - /*istanbul ignore start*/ - apply - /*istanbul ignore end*/ - ( - /*istanbul ignore start*/ - _hunk$lines4 - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - theirChanges)); - - return; - } - } else if ( - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _array - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - arrayEqual) - /*istanbul ignore end*/ - (myChanges, theirChanges)) { - /*istanbul ignore start*/ - var _hunk$lines5; - - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - (_hunk$lines5 = - /*istanbul ignore end*/ - hunk.lines).push. - /*istanbul ignore start*/ - apply - /*istanbul ignore end*/ - ( - /*istanbul ignore start*/ - _hunk$lines5 - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - myChanges)); - - return; - } - - conflict(hunk, myChanges, theirChanges); -} - -function removal(hunk, mine, their, swap) { - var myChanges = collectChange(mine), - theirChanges = collectContext(their, myChanges); - - if (theirChanges.merged) { - /*istanbul ignore start*/ - var _hunk$lines6; - - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - (_hunk$lines6 = - /*istanbul ignore end*/ - hunk.lines).push. - /*istanbul ignore start*/ - apply - /*istanbul ignore end*/ - ( - /*istanbul ignore start*/ - _hunk$lines6 - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - theirChanges.merged)); - } else { - conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); - } -} - -function conflict(hunk, mine, their) { - hunk.conflict = true; - hunk.lines.push({ - conflict: true, - mine: mine, - theirs: their - }); -} - -function insertLeading(hunk, insert, their) { - while (insert.offset < their.offset && insert.index < insert.lines.length) { - var line = insert.lines[insert.index++]; - hunk.lines.push(line); - insert.offset++; - } -} - -function insertTrailing(hunk, insert) { - while (insert.index < insert.lines.length) { - var line = insert.lines[insert.index++]; - hunk.lines.push(line); - } -} - -function collectChange(state) { - var ret = [], - operation = state.lines[state.index][0]; - - while (state.index < state.lines.length) { - var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. - - if (operation === '-' && line[0] === '+') { - operation = '+'; - } - - if (operation === line[0]) { - ret.push(line); - state.index++; - } else { - break; - } - } - - return ret; -} - -function collectContext(state, matchChanges) { - var changes = [], - merged = [], - matchIndex = 0, - contextChanges = false, - conflicted = false; - - while (matchIndex < matchChanges.length && state.index < state.lines.length) { - var change = state.lines[state.index], - match = matchChanges[matchIndex]; // Once we've hit our add, then we are done - - if (match[0] === '+') { - break; - } - - contextChanges = contextChanges || change[0] !== ' '; - merged.push(match); - matchIndex++; // Consume any additions in the other block as a conflict to attempt - // to pull in the remaining context after this - - if (change[0] === '+') { - conflicted = true; - - while (change[0] === '+') { - changes.push(change); - change = state.lines[++state.index]; - } - } - - if (match.substr(1) === change.substr(1)) { - changes.push(change); - state.index++; - } else { - conflicted = true; - } - } - - if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { - conflicted = true; - } - - if (conflicted) { - return changes; - } - - while (matchIndex < matchChanges.length) { - merged.push(matchChanges[matchIndex++]); - } - - return { - merged: merged, - changes: changes - }; -} - -function allRemoves(changes) { - return changes.reduce(function (prev, change) { - return prev && change[0] === '-'; - }, true); -} - -function skipRemoveSuperset(state, removeChanges, delta) { - for (var i = 0; i < delta; i++) { - var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); - - if (state.lines[state.index + i] !== ' ' + changeContent) { - return false; - } - } - - state.index += delta; - return true; -} - -function calcOldNewLineCount(lines) { - var oldLines = 0; - var newLines = 0; - lines.forEach(function (line) { - if (typeof line !== 'string') { - var myCount = calcOldNewLineCount(line.mine); - var theirCount = calcOldNewLineCount(line.theirs); - - if (oldLines !== undefined) { - if (myCount.oldLines === theirCount.oldLines) { - oldLines += myCount.oldLines; - } else { - oldLines = undefined; - } - } - - if (newLines !== undefined) { - if (myCount.newLines === theirCount.newLines) { - newLines += myCount.newLines; - } else { - newLines = undefined; - } - } - } else { - if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { - newLines++; - } - - if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { - oldLines++; - } - } - }); - return { - oldLines: oldLines, - newLines: newLines - }; -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9tZXJnZS5qcyJdLCJuYW1lcyI6WyJjYWxjTGluZUNvdW50IiwiaHVuayIsImNhbGNPbGROZXdMaW5lQ291bnQiLCJsaW5lcyIsIm9sZExpbmVzIiwibmV3TGluZXMiLCJ1bmRlZmluZWQiLCJtZXJnZSIsIm1pbmUiLCJ0aGVpcnMiLCJiYXNlIiwibG9hZFBhdGNoIiwicmV0IiwiaW5kZXgiLCJuZXdGaWxlTmFtZSIsImZpbGVOYW1lQ2hhbmdlZCIsIm9sZEZpbGVOYW1lIiwib2xkSGVhZGVyIiwibmV3SGVhZGVyIiwic2VsZWN0RmllbGQiLCJodW5rcyIsIm1pbmVJbmRleCIsInRoZWlyc0luZGV4IiwibWluZU9mZnNldCIsInRoZWlyc09mZnNldCIsImxlbmd0aCIsIm1pbmVDdXJyZW50Iiwib2xkU3RhcnQiLCJJbmZpbml0eSIsInRoZWlyc0N1cnJlbnQiLCJodW5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mN0aW9uKGxpbmUpIHtcbiAgICBpZiAodHlwZW9mIGxpbmUgIT09ICdzdHJpbmcnKSB7XG4gICAgICBsZXQgbXlDb3VudCA9IGNhbGNPbGROZXdMaW5lQ291bnQobGluZS5taW5lKTtcbiAgICAgIGxldCB0aGVpckNvdW50ID0gY2FsY09sZE5ld0xpbmVDb3VudChsaW5lLnRoZWlycyk7XG5cbiAgICAgIGlmIChvbGRMaW5lcyAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGlmIChteUNvdW50Lm9sZExpbmVzID09PSB0aGVpckNvdW50Lm9sZExpbmVzKSB7XG4gICAgICAgICAgb2xkTGluZXMgKz0gbXlDb3VudC5vbGRMaW5lcztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBvbGRMaW5lcyA9IHVuZGVmaW5lZDtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBpZiAobmV3TGluZXMgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICBpZiAobXlDb3VudC5uZXdMaW5lcyA9PT0gdGhlaXJDb3VudC5uZXdMaW5lcykge1xuICAgICAgICAgIG5ld0xpbmVzICs9IG15Q291bnQubmV3TGluZXM7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgbmV3TGluZXMgPSB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgaWYgKG5ld0xpbmVzICE9PSB1bmRlZmluZWQgJiYgKGxpbmVbMF0gPT09ICcrJyB8fCBsaW5lWzBdID09PSAnICcpKSB7XG4gICAgICAgIG5ld0xpbmVzKys7XG4gICAgICB9XG4gICAgICBpZiAob2xkTGluZXMgIT09IHVuZGVmaW5lZCAmJiAobGluZVswXSA9PT0gJy0nIHx8IGxpbmVbMF0gPT09ICcgJykpIHtcbiAgICAgICAgb2xkTGluZXMrKztcbiAgICAgIH1cbiAgICB9XG4gIH0pO1xuXG4gIHJldHVybiB7b2xkTGluZXMsIG5ld0xpbmVzfTtcbn1cbiJdfQ== diff --git a/node_modules/diff/lib/patch/parse.js b/node_modules/diff/lib/patch/parse.js deleted file mode 100644 index 51bae56..0000000 --- a/node_modules/diff/lib/patch/parse.js +++ /dev/null @@ -1,156 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parsePatch = parsePatch; - -/*istanbul ignore end*/ -function parsePatch(uniDiff) { - /*istanbul ignore start*/ - var - /*istanbul ignore end*/ - options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], - list = [], - i = 0; - - function parseIndex() { - var index = {}; - list.push(index); // Parse diff metadata - - while (i < diffstr.length) { - var line = diffstr[i]; // File header found, end parsing diff metadata - - if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { - break; - } // Diff index - - - var headerMatch = /^(?:Index:|diff(?: -r \w+)+)\s+/.exec(line); - - if (headerMatch) { - index.index = line.substring(headerMatch[0].length).trim(); - } - - i++; - } // Parse file headers if they are defined. Unified diff requires them, but - // there's no technical issues to have an isolated hunk without file header - - - parseFileHeader(index); - parseFileHeader(index); // Parse hunks - - index.hunks = []; - - while (i < diffstr.length) { - var _line = diffstr[i]; - - if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { - break; - } else if (/^@@/.test(_line)) { - index.hunks.push(parseHunk()); - } else if (_line && options.strict) { - // Ignore unexpected content unless in strict mode - throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); - } else { - i++; - } - } - } // Parses the --- and +++ headers, if none are found, no lines - // are consumed. - - - function parseFileHeader(index) { - var fileHeaderMatch = /^(---|\+\+\+)\s+/.exec(diffstr[i]); - - if (fileHeaderMatch) { - var keyPrefix = fileHeaderMatch[1] === '---' ? 'old' : 'new'; - var data = diffstr[i].substring(3).trim().split('\t', 2); - var fileName = data[0].replace(/\\\\/g, '\\'); - - if (fileName.startsWith('"') && fileName.endsWith('"')) { - fileName = fileName.substr(1, fileName.length - 2); - } - - index[keyPrefix + 'FileName'] = fileName; - index[keyPrefix + 'Header'] = (data[1] || '').trim(); - i++; - } - } // Parses a hunk - // This assumes that we are at the start of a hunk. - - - function parseHunk() { - var chunkHeaderIndex = i, - chunkHeaderLine = diffstr[i++], - chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); - var hunk = { - oldStart: +chunkHeader[1], - oldLines: +chunkHeader[2] || 1, - newStart: +chunkHeader[3], - newLines: +chunkHeader[4] || 1, - lines: [], - linedelimiters: [] - }; - var addCount = 0, - removeCount = 0; - - for (; i < diffstr.length; i++) { - // Lines starting with '---' could be mistaken for the "remove line" operation - // But they could be the header for the next file. Therefore prune such cases out. - if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { - break; - } - - var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; - - if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { - hunk.lines.push(diffstr[i]); - hunk.linedelimiters.push(delimiters[i] || '\n'); - - if (operation === '+') { - addCount++; - } else if (operation === '-') { - removeCount++; - } else if (operation === ' ') { - addCount++; - removeCount++; - } - } else { - break; - } - } // Handle the empty block count case - - - if (!addCount && hunk.newLines === 1) { - hunk.newLines = 0; - } - - if (!removeCount && hunk.oldLines === 1) { - hunk.oldLines = 0; - } // Perform optional sanity checking - - - if (options.strict) { - if (addCount !== hunk.newLines) { - throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - - if (removeCount !== hunk.oldLines) { - throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - } - - return hunk; - } - - while (i < diffstr.length) { - parseIndex(); - } - - return list; -} -//# sourceMappingURL=data:application/json;char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GVuZ3RoKVxuICAgICAgICAgICAgJiYgZGlmZnN0cltpICsgMV0uaW5kZXhPZignKysrICcpID09PSAwXG4gICAgICAgICAgICAmJiBkaWZmc3RyW2kgKyAyXS5pbmRleE9mKCdAQCcpID09PSAwKSB7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgICBsZXQgb3BlcmF0aW9uID0gKGRpZmZzdHJbaV0ubGVuZ3RoID09IDAgJiYgaSAhPSAoZGlmZnN0ci5sZW5ndGggLSAxKSkgPyAnICcgOiBkaWZmc3RyW2ldWzBdO1xuXG4gICAgICBpZiAob3BlcmF0aW9uID09PSAnKycgfHwgb3BlcmF0aW9uID09PSAnLScgfHwgb3BlcmF0aW9uID09PSAnICcgfHwgb3BlcmF0aW9uID09PSAnXFxcXCcpIHtcbiAgICAgICAgaHVuay5saW5lcy5wdXNoKGRpZmZzdHJbaV0pO1xuICAgICAgICBodW5rLmxpbmVkZWxpbWl0ZXJzLnB1c2goZGVsaW1pdGVyc1tpXSB8fCAnXFxuJyk7XG5cbiAgICAgICAgaWYgKG9wZXJhdGlvbiA9PT0gJysnKSB7XG4gICAgICAgICAgYWRkQ291bnQrKztcbiAgICAgICAgfSBlbHNlIGlmIChvcGVyYXRpb24gPT09ICctJykge1xuICAgICAgICAgIHJlbW92ZUNvdW50Kys7XG4gICAgICAgIH0gZWxzZSBpZiAob3BlcmF0aW9uID09PSAnICcpIHtcbiAgICAgICAgICBhZGRDb3VudCsrO1xuICAgICAgICAgIHJlbW92ZUNvdW50Kys7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGJyZWFrO1xuICAgICAgfVxuICAgIH1cblxuICAgIC8vIEhhbmRsZSB0aGUgZW1wdHkgYmxvY2sgY291bnQgY2FzZVxuICAgIGlmICghYWRkQ291bnQgJiYgaHVuay5uZXdMaW5lcyA9PT0gMSkge1xuICAgICAgaHVuay5uZXdMaW5lcyA9IDA7XG4gICAgfVxuICAgIGlmICghcmVtb3ZlQ291bnQgJiYgaHVuay5vbGRMaW5lcyA9PT0gMSkge1xuICAgICAgaHVuay5vbGRMaW5lcyA9IDA7XG4gICAgfVxuXG4gICAgLy8gUGVyZm9ybSBvcHRpb25hbCBzYW5pdHkgY2hlY2tpbmdcbiAgICBpZiAob3B0aW9ucy5zdHJpY3QpIHtcbiAgICAgIGlmIChhZGRDb3VudCAhPT0gaHVuay5uZXdMaW5lcykge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0FkZGVkIGxpbmUgY291bnQgZGlkIG5vdCBtYXRjaCBmb3IgaHVuayBhdCBsaW5lICcgKyAoY2h1bmtIZWFkZXJJbmRleCArIDEpKTtcbiAgICAgIH1cbiAgICAgIGlmIChyZW1vdmVDb3VudCAhPT0gaHVuay5vbGRMaW5lcykge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1JlbW92ZWQgbGluZSBjb3VudCBkaWQgbm90IG1hdGNoIGZvciBodW5rIGF0IGxpbmUgJyArIChjaHVua0hlYWRlckluZGV4ICsgMSkpO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiBodW5rO1xuICB9XG5cbiAgd2hpbGUgKGkgPCBkaWZmc3RyLmxlbmd0aCkge1xuICAgIHBhcnNlSW5kZXgoKTtcbiAgfVxuXG4gIHJldHVybiBsaXN0O1xufVxuIl19 diff --git a/node_modules/diff/lib/util/array.js b/node_modules/diff/lib/util/array.js deleted file mode 100644 index aecf67a..0000000 --- a/node_modules/diff/lib/util/array.js +++ /dev/null @@ -1,32 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.arrayEqual = arrayEqual; -exports.arrayStartsWith = arrayStartsWith; - -/*istanbul ignore end*/ -function arrayEqual(a, b) { - if (a.length !== b.length) { - return false; - } - - return arrayStartsWith(a, b); -} - -function arrayStartsWith(array, start) { - if (start.length > array.length) { - return false; - } - - for (var i = 0; i < start.length; i++) { - if (start[i] !== array[i]) { - return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HVybiBmYWxzZTtcbiAgfVxuXG4gIHJldHVybiBhcnJheVN0YXJ0c1dpdGgoYSwgYik7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBhcnJheVN0YXJ0c1dpdGgoYXJyYXksIHN0YXJ0KSB7XG4gIGlmIChzdGFydC5sZW5ndGggPiBhcnJheS5sZW5ndGgpIHtcbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cblxuICBmb3IgKGxldCBpID0gMDsgaSA8IHN0YXJ0Lmxlbmd0aDsgaSsrKSB7XG4gICAgaWYgKHN0YXJ0W2ldICE9PSBhcnJheVtpXSkge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiB0cnVlO1xufVxuIl19 diff --git a/node_modules/diff/lib/util/distance-iterator.js b/node_modules/diff/lib/util/distance-iterator.js deleted file mode 100644 index 5edbaf8..0000000 --- a/node_modules/diff/lib/util/distance-iterator.js +++ /dev/null @@ -1,57 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _default; - -/*istanbul ignore end*/ -// Iterator that traverses in the range of [min, max], stepping -// by distance from a given start position. I.e. for [0, 4], with -// start of 2, this will iterate 2, 3, 1, 4, 0. -function -/*istanbul ignore start*/ -_default -/*istanbul ignore end*/ -(start, minLine, maxLine) { - var wantForward = true, - backwardExhausted = false, - forwardExhausted = false, - localOffset = 1; - return function iterator() { - if (wantForward && !forwardExhausted) { - if (backwardExhausted) { - localOffset++; - } else { - wantForward = false; - } // Check if trying to fit beyond text length, and if not, check it fits - // after offset location (or desired location on first iteration) - - - if (start + localOffset <= maxLine) { - return localOffset; - } - - forwardExhausted = true; - } - - if (!backwardExhausted) { - if (!forwardExhausted) { - wantForward = true; - } // Check if trying to fit before text beginning, and if not, check it fits - // before offset location - - - if (minLine <= start - localOffset) { - return -localOffset++; - } - - backwardExhausted = true; - return iterator(); - } // We tried to fit hunk before text beginning and beyond text length, then - // hunk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js deleted file mode 100644 index e838eb2..0000000 --- a/node_modules/diff/lib/util/params.js +++ /dev/null @@ -1,24 +0,0 @@ -/*istanbul ignore start*/ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.generateOptions = generateOptions; - -/*istanbul ignore end*/ -function generateOptions(options, defaults) { - if (typeof options === 'function') { - defaults.callback = options; - } else if (options) { - for (var name in options) { - /* istanbul ignore else */ - if (options.hasOwnProperty(name)) { - defaults[name] = options[name]; - } - } - } - - return defaults; -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3BhcmFtcy5qcyJdLCJuYW1lcyI6WyJnZW5lcmF0ZU9wdGlvbnMiLCJvcHRpb25zIiwiZGVmYXVsdHMiLCJjYWxsYmFjayIsIm5hbWUiLCJoYXNPd25Qcm9wZXJ0eSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQU8sU0FBU0EsZUFBVCxDQUF5QkMsT0FBekIsRUFBa0NDLFFBQWxDLEVBQTRDO0FBQ2pELE1BQUksT0FBT0QsT0FBUCxLQUFtQixVQUF2QixFQUFtQztBQUNqQ0MsSUFBQUEsUUFBUSxDQUFDQyxRQUFULEdBQW9CRixPQUFwQjtBQUNELEdBRkQsTUFFTyxJQUFJQSxPQUFKLEVBQWE7QUFDbEIsU0FBSyxJQUFJRyxJQUFULElBQWlCSCxPQUFqQixFQUEwQjtBQUN4QjtBQUNBLFVBQUlBLE9BQU8sQ0FBQ0ksY0FBUixDQUF1QkQsSUFBdkIsQ0FBSixFQUFrQztBQUNoQ0YsUUFBQUEsUUFBUSxDQUFDRSxJQUFELENBQVIsR0FBaUJILE9BQU8sQ0FBQ0csSUFBRCxDQUF4QjtBQUNEO0FBQ0Y7QUFDRjs7QUFDRCxTQUFPRixRQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gZ2VuZXJhdGVPcHRpb25zKG9wdGlvbnMsIGRlZmF1bHRzKSB7XG4gIGlmICh0eXBlb2Ygb3B0aW9ucyA9PT0gJ2Z1bmN0aW9uJykge1xuICAgIGRlZmF1bHRzLmNhbGxiYWNrID0gb3B0aW9ucztcbiAgfSBlbHNlIGlmIChvcHRpb25zKSB7XG4gICAgZm9yIChsZXQgbmFtZSBpbiBvcHRpb25zKSB7XG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgaWYgKG9wdGlvbnMuaGFzT3duUHJvcGVydHkobmFtZSkpIHtcbiAgICAgICAgZGVmYXVsdHNbbmFtZV0gPSBvcHRpb25zW25hbWVdO1xuICAgICAgfVxuICAgIH1cbiAgfVxuICByZXR1cm4gZGVmYXVsdHM7XG59XG4iXX0= diff --git a/node_modules/diff/package.json b/node_modules/diff/package.json deleted file mode 100644 index 2390039..0000000 --- a/node_modules/diff/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "diff", - "version": "4.0.4", - "description": "A javascript text diff implementation.", - "keywords": [ - "diff", - "javascript" - ], - "maintainers": [ - "Kevin Decker (http://incaseofstairs.com)" - ], - "bugs": { - "email": "kpdecker@gmail.com", - "url": "http://github.com/kpdecker/jsdiff/issues" - }, - "license": "BSD-3-Clause", - "repository": { - "type": "git", - "url": "git://github.com/kpdecker/jsdiff.git" - }, - "engines": { - "node": ">=0.3.1" - }, - "main": "./lib/index.js", - "module": "./lib/index.es6.js", - "browser": "./dist/diff.js", - "scripts": { - "clean": "rm -rf lib/ dist/", - "build:node": "yarn babel --out-dir lib --source-maps=inline src", - "test": "grunt" - }, - "devDependencies": { - "@babel/cli": "^7.2.3", - "@babel/core": "^7.2.2", - "@babel/plugin-transform-modules-commonjs": "^7.2.0", - "@babel/preset-env": "^7.2.3", - "@babel/register": "^7.0.0", - "babel-eslint": "^10.0.1", - "babel-loader": "^8.0.5", - "chai": "^4.2.0", - "colors": "^1.3.3", - "eslint": "^5.12.0", - "grunt": "^1.0.3", - "grunt-babel": "^8.0.0", - "grunt-clean": "^0.4.0", - "grunt-cli": "^1.3.2", - "grunt-contrib-clean": "^2.0.0", - "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-uglify": "^4.0.0", - "grunt-contrib-watch": "^1.1.0", - "grunt-eslint": "^21.0.0", - "grunt-exec": "^3.0.0", - "grunt-karma": "^3.0.1", - "grunt-mocha-istanbul": "^5.0.2", - "grunt-mocha-test": "^0.13.3", - "grunt-webpack": "^3.1.3", - "istanbul": "github:kpdecker/istanbul", - "karma": "^3.1.4", - "karma-chrome-launcher": "^2.2.0", - "karma-mocha": "^1.3.0", - "karma-mocha-reporter": "^2.0.0", - "karma-sauce-launcher": "^2.0.2", - "karma-sourcemap-loader": "^0.3.6", - "karma-webpack": "^3.0.5", - "mocha": "^5.2.0", - "rollup": "^1.0.2", - "rollup-plugin-babel": "^4.2.0", - "semver": "^5.6.0", - "webpack": "^4.28.3", - "webpack-dev-server": "^3.1.14" - }, - "optionalDependencies": {}, - "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610" -} diff --git a/node_modules/diff/release-notes.md b/node_modules/diff/release-notes.md deleted file mode 100644 index edc4cd3..0000000 --- a/node_modules/diff/release-notes.md +++ /dev/null @@ -1,261 +0,0 @@ -# Release Notes - -## Development - -[Commits](https://github.com/kpdecker/jsdiff/compare/v4.0.1...master) - -## v4.0.1 - January 6th, 2019 -- Fix main reference path - b826104 - -[Commits](https://github.com/kpdecker/jsdiff/compare/v4.0.0...v4.0.1) - -## v4.0.0 - January 5th, 2019 -- [#94](https://github.com/kpdecker/jsdiff/issues/94) - Missing "No newline at end of file" when comparing two texts that do not end in newlines ([@federicotdn](https://api.github.com/users/federicotdn)) -- [#227](https://github.com/kpdecker/jsdiff/issues/227) - Licence -- [#199](https://github.com/kpdecker/jsdiff/issues/199) - Import statement for jsdiff -- [#159](https://github.com/kpdecker/jsdiff/issues/159) - applyPatch affecting wrong line number with with new lines -- [#8](https://github.com/kpdecker/jsdiff/issues/8) - A new state "replace" -- Drop ie9 from karma targets - 79c31bd -- Upgrade deps. Convert from webpack to rollup - 2c1a29c -- Make ()[]"' as word boundaries between each other - f27b899 -- jsdiff: Replaced phantomJS by chrome - ec3114e -- Add yarn.lock to .npmignore - 29466d8 - -Compatibility notes: -- Bower and Component packages no longer supported - - -[Commits](https://github.com/kpdecker/jsdiff/compare/v3.5.0...v4.0.0) - -## v3.5.0 - March 4th, 2018 -- Omit redundant slice in join method of diffArrays - 1023590 -- Support patches with empty lines - fb0f208 -- Accept a custom JSON replacer function for JSON diffing - 69c7f0a -- Optimize parch header parser - 2aec429 -- Fix typos - e89c832 - -[Commits](https://github.com/kpdecker/jsdiff/compare/v3.4.0...v3.5.0) - -## v3.4.0 - October 7th, 2017 -- [#183](https://github.com/kpdecker/jsdiff/issues/183) - Feature request: ability to specify a custom equality checker for `diffArrays` -- [#173](https://github.com/kpdecker/jsdiff/issues/173) - Bug: diffArrays gives wrong result on array of booleans -- [#158](https://github.com/kpdecker/jsdiff/issues/158) - diffArrays will not compare the empty string in array? -- comparator for custom equality checks - 30e141e -- count oldLines and newLines when there are conflicts - 53bf384 -- Fix: diffArrays can compare falsey items - 9e24284 -- Docs: Replace grunt with npm test - 00e2f94 - -[Commits](https://github.com/kpdecker/jsdiff/compare/v3.3.1...v3.4.0) - -## v3.3.1 - September 3rd, 2017 -- [#141](https://github.com/kpdecker/jsdiff/issues/141) - Cannot apply patch because my file delimiter is "/r/n" instead of "/n" -- [#192](https://github.com/kpdecker/jsdiff/pull/192) - Fix: Bad merge when adding new files (#189) -- correct spelling mistake - 21fa478 - -[Commits](https://github.com/kpdecker/jsdiff/compare/v3.3.0...v3.3.1) - -## v3.3.0 - July 5th, 2017 -- [#114](https://github.com/kpdecker/jsdiff/issues/114) - /patch/merge not exported -- Gracefully accept invalid newStart in hunks, same as patch(1) does. - d8a3635 -- Use regex rather than starts/ends with for parsePatch - 6cab62c -- Add browser flag - e64f674 -- refactor: simplified code a bit more - 8f8e0f2 -- refactor: simplified code a bit - b094a6f -- fix: some corrections re ignoreCase option - 3c78fd0 -- ignoreCase option - 3cbfbb5 -- Sanitize filename while parsing patches - 2fe8129 -- Added better installation methods - aced50b -- Simple export of functionality - 8690f31 - -[Commits](https://github.com/kpdecker/jsdiff/compare/v3.2.0...v3.3.0) - -## v3.2.0 - December 26th, 2016 -- [#156](https://github.com/kpdecker/jsdiff/pull/156) - Add `undefinedReplacement` option to `diffJson` ([@ewnd9](https://api.github.com/users/ewnd9)) -- [#154](https://github.com/kpdecker/jsdiff/pull/154) - Add `examples` and `images` to `.npmignore`. ([@wtgtybhertgeghgtwtg](https://api.github.com/users/wtgtybhertgeghgtwtg)) -- [#153](https://github.com/kpdecker/jsdiff/pull/153) - feat(structuredPatch): Pass options to diffLines ([@Kiougar](https://api.github.com/users/Kiougar)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v3.1.0...v3.2.0) - -## v3.1.0 - November 27th, 2016 -- [#146](https://github.com/kpdecker/jsdiff/pull/146) - JsDiff.diffArrays to compare arrays ([@wvanderdeijl](https://api.github.com/users/wvanderdeijl)) -- [#144](https://github.com/kpdecker/jsdiff/pull/144) - Split file using all possible line delimiter instead of hard-coded "/n" and join lines back using the original delimiters ([@soulbeing](https://api.github.com/users/soulbeing)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v3.0.1...v3.1.0) - -## v3.0.1 - October 9th, 2016 -- [#139](https://github.com/kpdecker/jsdiff/pull/139) - Make README.md look nicer in npmjs.com ([@takenspc](https://api.github.com/users/takenspc)) -- [#135](https://github.com/kpdecker/jsdiff/issues/135) - parsePatch combines patches from multiple files into a single IUniDiff when there is no "Index" line ([@ramya-rao-a](https://api.github.com/users/ramya-rao-a)) -- [#124](https://github.com/kpdecker/jsdiff/issues/124) - IE7/IE8 failure since 2.0.0 ([@boneskull](https://api.github.com/users/boneskull)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v3.0.0...v3.0.1) - -## v3.0.0 - August 23rd, 2016 -- [#130](https://github.com/kpdecker/jsdiff/pull/130) - Add callback argument to applyPatches `patched` option ([@piranna](https://api.github.com/users/piranna)) -- [#120](https://github.com/kpdecker/jsdiff/pull/120) - Correctly handle file names containing spaces ([@adius](https://api.github.com/users/adius)) -- [#119](https://github.com/kpdecker/jsdiff/pull/119) - Do single reflow ([@wifiextender](https://api.github.com/users/wifiextender)) -- [#117](https://github.com/kpdecker/jsdiff/pull/117) - Make more usable with long strings. ([@abnbgist](https://api.github.com/users/abnbgist)) - -Compatibility notes: -- applyPatches patch callback now is async and requires the callback be called to continue operation - -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.3...v3.0.0) - -## v2.2.3 - May 31st, 2016 -- [#118](https://github.com/kpdecker/jsdiff/pull/118) - Add a fix for applying 0-length destination patches ([@chaaz](https://api.github.com/users/chaaz)) -- [#115](https://github.com/kpdecker/jsdiff/pull/115) - Fixed grammar in README ([@krizalys](https://api.github.com/users/krizalys)) -- [#113](https://github.com/kpdecker/jsdiff/pull/113) - fix typo ([@vmazare](https://api.github.com/users/vmazare)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.2...v2.2.3) - -## v2.2.2 - March 13th, 2016 -- [#102](https://github.com/kpdecker/jsdiff/issues/102) - diffJson with dates, returns empty curly braces ([@dr-dimitru](https://api.github.com/users/dr-dimitru)) -- [#97](https://github.com/kpdecker/jsdiff/issues/97) - Whitespaces & diffWords ([@faiwer](https://api.github.com/users/faiwer)) -- [#92](https://github.com/kpdecker/jsdiff/pull/92) - Fixes typo in the readme ([@bg451](https://api.github.com/users/bg451)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.1...v2.2.2) - -## v2.2.1 - November 12th, 2015 -- [#89](https://github.com/kpdecker/jsdiff/pull/89) - add in display selector to readme ([@FranDias](https://api.github.com/users/FranDias)) -- [#88](https://github.com/kpdecker/jsdiff/pull/88) - Split diffs based on file headers instead of 'Index:' metadata ([@piranna](https://api.github.com/users/piranna)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.0...v2.2.1) - -## v2.2.0 - October 29th, 2015 -- [#80](https://github.com/kpdecker/jsdiff/pull/80) - Fix a typo: applyPath -> applyPatch ([@fluxxu](https://api.github.com/users/fluxxu)) -- [#83](https://github.com/kpdecker/jsdiff/pull/83) - Add basic fuzzy matching to applyPatch ([@piranna](https://github.com/piranna)) -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.0...v2.2.0) - -## v2.2.0 - October 29th, 2015 -- [#80](https://github.com/kpdecker/jsdiff/pull/80) - Fix a typo: applyPath -> applyPatch ([@fluxxu](https://api.github.com/users/fluxxu)) -- [#83](https://github.com/kpdecker/jsdiff/pull/83) - Add basic fuzzy matching to applyPatch ([@piranna](https://github.com/piranna)) -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.3...v2.2.0) - -## v2.1.3 - September 30th, 2015 -- [#78](https://github.com/kpdecker/jsdiff/pull/78) - fix: error throwing when apply patch to empty string ([@21paradox](https://api.github.com/users/21paradox)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.2...v2.1.3) - -## v2.1.2 - September 23rd, 2015 -- [#76](https://github.com/kpdecker/jsdiff/issues/76) - diff headers give error ([@piranna](https://api.github.com/users/piranna)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.1...v2.1.2) - -## v2.1.1 - September 9th, 2015 -- [#73](https://github.com/kpdecker/jsdiff/issues/73) - Is applyPatches() exposed in the API? ([@davidparsson](https://api.github.com/users/davidparsson)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.0...v2.1.1) - -## v2.1.0 - August 27th, 2015 -- [#72](https://github.com/kpdecker/jsdiff/issues/72) - Consider using options object API for flag permutations ([@kpdecker](https://api.github.com/users/kpdecker)) -- [#70](https://github.com/kpdecker/jsdiff/issues/70) - diffWords treats \n at the end as significant whitespace ([@nesQuick](https://api.github.com/users/nesQuick)) -- [#69](https://github.com/kpdecker/jsdiff/issues/69) - Missing count ([@wfalkwallace](https://api.github.com/users/wfalkwallace)) -- [#68](https://github.com/kpdecker/jsdiff/issues/68) - diffLines seems broken ([@wfalkwallace](https://api.github.com/users/wfalkwallace)) -- [#60](https://github.com/kpdecker/jsdiff/issues/60) - Support multiple diff hunks ([@piranna](https://api.github.com/users/piranna)) -- [#54](https://github.com/kpdecker/jsdiff/issues/54) - Feature Request: 3-way merge ([@mog422](https://api.github.com/users/mog422)) -- [#42](https://github.com/kpdecker/jsdiff/issues/42) - Fuzz factor for applyPatch ([@stuartpb](https://api.github.com/users/stuartpb)) -- Move whitespace ignore out of equals method - 542063c -- Include source maps in babel output - 7f7ab21 -- Merge diff/line and diff/patch implementations - 1597705 -- Drop map utility method - 1ddc939 -- Documentation for parsePatch and applyPatches - 27c4b77 - -Compatibility notes: -- The undocumented ignoreWhitespace flag has been removed from the Diff equality check directly. This implementation may be copied to diff utilities if dependencies existed on this functionality. - -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.0.2...v2.1.0) - -## v2.0.2 - August 8th, 2015 -- [#67](https://github.com/kpdecker/jsdiff/issues/67) - cannot require from npm module in node ([@commenthol](https://api.github.com/users/commenthol)) -- Convert to chai since we don’t support IE8 - a96bbad - -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.0.1...v2.0.2) - -## v2.0.1 - August 7th, 2015 -- Add release build at proper step - 57542fd - -[Commits](https://github.com/kpdecker/jsdiff/compare/v2.0.0...v2.0.1) - -## v2.0.0 - August 7th, 2015 -- [#66](https://github.com/kpdecker/jsdiff/issues/66) - Add karma and sauce tests ([@kpdecker](https://api.github.com/users/kpdecker)) -- [#65](https://github.com/kpdecker/jsdiff/issues/65) - Create component repository for bower ([@kpdecker](https://api.github.com/users/kpdecker)) -- [#64](https://github.com/kpdecker/jsdiff/issues/64) - Automatically call removeEmpty for all tokenizer calls ([@kpdecker](https://api.github.com/users/kpdecker)) -- [#62](https://github.com/kpdecker/jsdiff/pull/62) - Allow access to structured object representation of patch data ([@bittrance](https://api.github.com/users/bittrance)) -- [#61](https://github.com/kpdecker/jsdiff/pull/61) - Use svg instead of png to get better image quality ([@PeterDaveHello](https://api.github.com/users/PeterDaveHello)) -- [#29](https://github.com/kpdecker/jsdiff/issues/29) - word tokenizer works only for 7 bit ascii ([@plasmagunman](https://api.github.com/users/plasmagunman)) - -Compatibility notes: -- `this.removeEmpty` is now called automatically for all instances. If this is not desired, this may be overridden on a per instance basis. -- The library has been refactored to use some ES6 features. The external APIs should remain the same, but bower projects that directly referenced the repository will now have to point to the [components/jsdiff](https://github.com/components/jsdiff) repository. - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.4.0...v2.0.0) - -## v1.4.0 - May 6th, 2015 -- [#57](https://github.com/kpdecker/jsdiff/issues/57) - createPatch -> applyPatch failed. ([@mog422](https://api.github.com/users/mog422)) -- [#56](https://github.com/kpdecker/jsdiff/pull/56) - Two files patch ([@rgeissert](https://api.github.com/users/rgeissert)) -- [#14](https://github.com/kpdecker/jsdiff/issues/14) - Flip added and removed order? ([@jakesandlund](https://api.github.com/users/jakesandlund)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.3.2...v1.4.0) - -## v1.3.2 - March 30th, 2015 -- [#53](https://github.com/kpdecker/jsdiff/pull/53) - Updated README.MD with Bower installation instructions ([@ofbriggs](https://api.github.com/users/ofbriggs)) -- [#49](https://github.com/kpdecker/jsdiff/issues/49) - Cannot read property 'oldlines' of undefined ([@nwtn](https://api.github.com/users/nwtn)) -- [#44](https://github.com/kpdecker/jsdiff/issues/44) - invalid-meta jsdiff is missing "main" entry in bower.json - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.3.1...v1.3.2) - -## v1.3.1 - March 13th, 2015 -- [#52](https://github.com/kpdecker/jsdiff/pull/52) - Fix for #51 Wrong result of JsDiff.diffLines ([@felicienfrancois](https://api.github.com/users/felicienfrancois)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.3.0...v1.3.1) - -## v1.3.0 - March 2nd, 2015 -- [#47](https://github.com/kpdecker/jsdiff/pull/47) - Adding Diff Trimmed Lines ([@JamesGould123](https://api.github.com/users/JamesGould123)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.2.2...v1.3.0) - -## v1.2.2 - January 26th, 2015 -- [#45](https://github.com/kpdecker/jsdiff/pull/45) - Fix AMD module loading ([@pedrocarrico](https://api.github.com/users/pedrocarrico)) -- [#43](https://github.com/kpdecker/jsdiff/pull/43) - added a bower file ([@nbrustein](https://api.github.com/users/nbrustein)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.2.1...v1.2.2) - -## v1.2.1 - December 26th, 2014 -- [#41](https://github.com/kpdecker/jsdiff/pull/41) - change condition of using node export system. ([@ironhee](https://api.github.com/users/ironhee)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.2.0...v1.2.1) - -## v1.2.0 - November 29th, 2014 -- [#37](https://github.com/kpdecker/jsdiff/pull/37) - Add support for sentences. ([@vmariano](https://api.github.com/users/vmariano)) -- [#28](https://github.com/kpdecker/jsdiff/pull/28) - Implemented diffJson ([@papandreou](https://api.github.com/users/papandreou)) -- [#27](https://github.com/kpdecker/jsdiff/issues/27) - Slow to execute over diffs with a large number of changes ([@termi](https://api.github.com/users/termi)) -- Allow for optional async diffing - 19385b9 -- Fix diffChars implementation - eaa44ed - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.1.0...v1.2.0) - -## v1.1.0 - November 25th, 2014 -- [#33](https://github.com/kpdecker/jsdiff/pull/33) - AMD and global exports ([@ovcharik](https://api.github.com/users/ovcharik)) -- [#32](https://github.com/kpdecker/jsdiff/pull/32) - Add support for component ([@vmariano](https://api.github.com/users/vmariano)) -- [#31](https://github.com/kpdecker/jsdiff/pull/31) - Don't rely on Array.prototype.map ([@papandreou](https://api.github.com/users/papandreou)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.8...v1.1.0) - -## v1.0.8 - December 22nd, 2013 -- [#24](https://github.com/kpdecker/jsdiff/pull/24) - Handle windows newlines on non windows machines. ([@benogle](https://api.github.com/users/benogle)) -- [#23](https://github.com/kpdecker/jsdiff/pull/23) - Prettied up the API formatting a little, and added basic node and web examples ([@airportyh](https://api.github.com/users/airportyh)) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.7...v1.0.8) - -## v1.0.7 - September 11th, 2013 - -- [#22](https://github.com/kpdecker/jsdiff/pull/22) - Added variant of WordDiff that doesn't ignore whitespace differences ([@papandreou](https://api.github.com/users/papandreou) - -- Add 0.10 to travis tests - 243a526 - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.6...v1.0.7) - -## v1.0.6 - August 30th, 2013 - -- [#19](https://github.com/kpdecker/jsdiff/pull/19) - Explicitly define contents of npm package ([@sindresorhus](https://api.github.com/users/sindresorhus) - -[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.5...v1.0.6) diff --git a/node_modules/diff/runtime.js b/node_modules/diff/runtime.js deleted file mode 100644 index 82ea7e6..0000000 --- a/node_modules/diff/runtime.js +++ /dev/null @@ -1,3 +0,0 @@ -require('@babel/register')({ - ignore: ['lib', 'node_modules'] -}); diff --git a/node_modules/dotenv/CHANGELOG.md b/node_modules/dotenv/CHANGELOG.md deleted file mode 100644 index 06ff71d..0000000 --- a/node_modules/dotenv/CHANGELOG.md +++ /dev/null @@ -1,605 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -## [Unreleased](https://github.com/motdotla/dotenv/compare/v17.2.4...master) - -## [17.2.4](https://github.com/motdotla/dotenv/compare/v17.2.3...v17.2.4) (2026-02-05) - -### Changed - -* Make `DotenvPopulateInput` accept `NodeJS.ProcessEnv` type ([#915](https://github.com/motdotla/dotenv/pull/915)) -- Give back to dotenv by checking out my newest project [vestauth](https://github.com/vestauth/vestauth). It is auth for agents. Thank you for using my software. - -## [17.2.3](https://github.com/motdotla/dotenv/compare/v17.2.2...v17.2.3) (2025-09-29) - -### Changed - -* Fixed typescript error definition ([#912](https://github.com/motdotla/dotenv/pull/912)) - -## [17.2.2](https://github.com/motdotla/dotenv/compare/v17.2.1...v17.2.2) (2025-09-02) - -### Added - -- 🙏 A big thank you to new sponsor [Tuple.app](https://tuple.app/dotenv) - *the premier screen sharing app for developers on macOS and Windows.* Go check them out. It's wonderful and generous of them to give back to open source by sponsoring dotenv. Give them some love back. - -## [17.2.1](https://github.com/motdotla/dotenv/compare/v17.2.0...v17.2.1) (2025-07-24) - -### Changed - -* Fix clickable tip links by removing parentheses ([#897](https://github.com/motdotla/dotenv/pull/897)) - -## [17.2.0](https://github.com/motdotla/dotenv/compare/v17.1.0...v17.2.0) (2025-07-09) - -### Added - -* Optionally specify `DOTENV_CONFIG_QUIET=true` in your environment or `.env` file to quiet the runtime log ([#889](https://github.com/motdotla/dotenv/pull/889)) -* Just like dotenv any `DOTENV_CONFIG_` environment variables take precedence over any code set options like `({quiet: false})` - -```ini -# .env -DOTENV_CONFIG_QUIET=true -HELLO="World" -``` -```js -// index.js -require('dotenv').config() -console.log(`Hello ${process.env.HELLO}`) -``` -```sh -$ node index.js -Hello World - -or - -$ DOTENV_CONFIG_QUIET=true node index.js -``` - -## [17.1.0](https://github.com/motdotla/dotenv/compare/v17.0.1...v17.1.0) (2025-07-07) - -### Added - -* Add additional security and configuration tips to the runtime log ([#884](https://github.com/motdotla/dotenv/pull/884)) -* Dim the tips text from the main injection information text - -```js -const TIPS = [ - '🔐 encrypt with dotenvx: https://dotenvx.com', - '🔐 prevent committing .env to code: https://dotenvx.com/precommit', - '🔐 prevent building .env in docker: https://dotenvx.com/prebuild', - '🛠️ run anywhere with `dotenvx run -- yourcommand`', - '⚙️ specify custom .env file path with { path: \'/custom/path/.env\' }', - '⚙️ enable debug logging with { debug: true }', - '⚙️ override existing env vars with { override: true }', - '⚙️ suppress all logs with { quiet: true }', - '⚙️ write to custom object with { processEnv: myObject }', - '⚙️ load multiple .env files with { path: [\'.env.local\', \'.env\'] }' -] -``` - -## [17.0.1](https://github.com/motdotla/dotenv/compare/v17.0.0...v17.0.1) (2025-07-01) - -### Changed - -* Patched injected log to count only populated/set keys to process.env ([#879](https://github.com/motdotla/dotenv/pull/879)) - -## [17.0.0](https://github.com/motdotla/dotenv/compare/v16.6.1...v17.0.0) (2025-06-27) - -### Changed - -- Default `quiet` to false - informational (file and keys count) runtime log message shows by default ([#875](https://github.com/motdotla/dotenv/pull/875)) - -## [16.6.1](https://github.com/motdotla/dotenv/compare/v16.6.0...v16.6.1) (2025-06-27) - -### Changed - -- Default `quiet` to true – hiding the runtime log message ([#874](https://github.com/motdotla/dotenv/pull/874)) -- NOTICE: 17.0.0 will be released with quiet defaulting to false. Use `config({ quiet: true })` to suppress. -- And check out the new [dotenvx](https://github.com/dotenvx/dotenvx). As coding workflows evolve and agents increasingly handle secrets, encrypted .env files offer a much safer way to deploy both agents and code together with secure secrets. Simply switch `require('dotenv').config()` for `require('@dotenvx/dotenvx').config()`. - -## [16.6.0](https://github.com/motdotla/dotenv/compare/v16.5.0...v16.6.0) (2025-06-26) - -### Added - -- Default log helpful message `[dotenv@16.6.0] injecting env (1) from .env` ([#870](https://github.com/motdotla/dotenv/pull/870)) -- Use `{ quiet: true }` to suppress -- Aligns dotenv more closely with [dotenvx](https://github.com/dotenvx/dotenvx). - -## [16.5.0](https://github.com/motdotla/dotenv/compare/v16.4.7...v16.5.0) (2025-04-07) - -### Added - -- 🎉 Added new sponsor [Graphite](https://graphite.dev/?utm_source=github&utm_medium=repo&utm_campaign=dotenv) - *the AI developer productivity platform helping teams on GitHub ship higher quality software, faster*. - -> [!TIP] -> **[Become a sponsor](https://github.com/sponsors/motdotla)** -> -> The dotenvx README is viewed thousands of times DAILY on GitHub and NPM. -> Sponsoring dotenv is a great way to get in front of developers and give back to the developer community at the same time. - -### Changed - -- Remove `_log` method. Use `_debug` [#862](https://github.com/motdotla/dotenv/pull/862) - -## [16.4.7](https://github.com/motdotla/dotenv/compare/v16.4.6...v16.4.7) (2024-12-03) - -### Changed - -- Ignore `.tap` folder when publishing. (oops, sorry about that everyone. - @motdotla) [#848](https://github.com/motdotla/dotenv/pull/848) - -## [16.4.6](https://github.com/motdotla/dotenv/compare/v16.4.5...v16.4.6) (2024-12-02) - -### Changed - -- Clean up stale dev dependencies [#847](https://github.com/motdotla/dotenv/pull/847) -- Various README updates clarifying usage and alternative solutions using [dotenvx](https://github.com/dotenvx/dotenvx) - -## [16.4.5](https://github.com/motdotla/dotenv/compare/v16.4.4...v16.4.5) (2024-02-19) - -### Changed - -- 🐞 Fix recent regression when using `path` option. return to historical behavior: do not attempt to auto find `.env` if `path` set. (regression was introduced in `16.4.3`) [#814](https://github.com/motdotla/dotenv/pull/814) - -## [16.4.4](https://github.com/motdotla/dotenv/compare/v16.4.3...v16.4.4) (2024-02-13) - -### Changed - -- 🐞 Replaced chaining operator `?.` with old school `&&` (fixing node 12 failures) [#812](https://github.com/motdotla/dotenv/pull/812) - -## [16.4.3](https://github.com/motdotla/dotenv/compare/v16.4.2...v16.4.3) (2024-02-12) - -### Changed - -- Fixed processing of multiple files in `options.path` [#805](https://github.com/motdotla/dotenv/pull/805) - -## [16.4.2](https://github.com/motdotla/dotenv/compare/v16.4.1...v16.4.2) (2024-02-10) - -### Changed - -- Changed funding link in package.json to [`dotenvx.com`](https://dotenvx.com) - -## [16.4.1](https://github.com/motdotla/dotenv/compare/v16.4.0...v16.4.1) (2024-01-24) - -- Patch support for array as `path` option [#797](https://github.com/motdotla/dotenv/pull/797) - -## [16.4.0](https://github.com/motdotla/dotenv/compare/v16.3.2...v16.4.0) (2024-01-23) - -- Add `error.code` to error messages around `.env.vault` decryption handling [#795](https://github.com/motdotla/dotenv/pull/795) -- Add ability to find `.env.vault` file when filename(s) passed as an array [#784](https://github.com/motdotla/dotenv/pull/784) - -## [16.3.2](https://github.com/motdotla/dotenv/compare/v16.3.1...v16.3.2) (2024-01-18) - -### Added - -- Add debug message when no encoding set [#735](https://github.com/motdotla/dotenv/pull/735) - -### Changed - -- Fix output typing for `populate` [#792](https://github.com/motdotla/dotenv/pull/792) -- Use subarray instead of slice [#793](https://github.com/motdotla/dotenv/pull/793) - -## [16.3.1](https://github.com/motdotla/dotenv/compare/v16.3.0...v16.3.1) (2023-06-17) - -### Added - -- Add missing type definitions for `processEnv` and `DOTENV_KEY` options. [#756](https://github.com/motdotla/dotenv/pull/756) - -## [16.3.0](https://github.com/motdotla/dotenv/compare/v16.2.0...v16.3.0) (2023-06-16) - -### Added - -- Optionally pass `DOTENV_KEY` to options rather than relying on `process.env.DOTENV_KEY`. Defaults to `process.env.DOTENV_KEY` [#754](https://github.com/motdotla/dotenv/pull/754) - -## [16.2.0](https://github.com/motdotla/dotenv/compare/v16.1.4...v16.2.0) (2023-06-15) - -### Added - -- Optionally write to your own target object rather than `process.env`. Defaults to `process.env`. [#753](https://github.com/motdotla/dotenv/pull/753) -- Add import type URL to types file [#751](https://github.com/motdotla/dotenv/pull/751) - -## [16.1.4](https://github.com/motdotla/dotenv/compare/v16.1.3...v16.1.4) (2023-06-04) - -### Added - -- Added `.github/` to `.npmignore` [#747](https://github.com/motdotla/dotenv/pull/747) - -## [16.1.3](https://github.com/motdotla/dotenv/compare/v16.1.2...v16.1.3) (2023-05-31) - -### Removed - -- Removed `browser` keys for `path`, `os`, and `crypto` in package.json. These were set to false incorrectly as of 16.1. Instead, if using dotenv on the front-end make sure to include polyfills for `path`, `os`, and `crypto`. [node-polyfill-webpack-plugin](https://github.com/Richienb/node-polyfill-webpack-plugin) provides these. - -## [16.1.2](https://github.com/motdotla/dotenv/compare/v16.1.1...v16.1.2) (2023-05-31) - -### Changed - -- Exposed private function `_configDotenv` as `configDotenv`. [#744](https://github.com/motdotla/dotenv/pull/744) - -## [16.1.1](https://github.com/motdotla/dotenv/compare/v16.1.0...v16.1.1) (2023-05-30) - -### Added - -- Added type definition for `decrypt` function - -### Changed - -- Fixed `{crypto: false}` in `packageJson.browser` - -## [16.1.0](https://github.com/motdotla/dotenv/compare/v16.0.3...v16.1.0) (2023-05-30) - -### Added - -- Add `populate` convenience method [#733](https://github.com/motdotla/dotenv/pull/733) -- Accept URL as path option [#720](https://github.com/motdotla/dotenv/pull/720) -- Add dotenv to `npm fund` command -- Spanish language README [#698](https://github.com/motdotla/dotenv/pull/698) -- Add `.env.vault` support. 🎉 ([#730](https://github.com/motdotla/dotenv/pull/730)) - -ℹ️ `.env.vault` extends the `.env` file format standard with a localized encrypted vault file. Package it securely with your production code deploys. It's cloud agnostic so that you can deploy your secrets anywhere – without [risky third-party integrations](https://techcrunch.com/2023/01/05/circleci-breach/). [read more](https://github.com/motdotla/dotenv#-deploying) - -### Changed - -- Fixed "cannot resolve 'fs'" error on tools like Replit [#693](https://github.com/motdotla/dotenv/pull/693) - -## [16.0.3](https://github.com/motdotla/dotenv/compare/v16.0.2...v16.0.3) (2022-09-29) - -### Changed - -- Added library version to debug logs ([#682](https://github.com/motdotla/dotenv/pull/682)) - -## [16.0.2](https://github.com/motdotla/dotenv/compare/v16.0.1...v16.0.2) (2022-08-30) - -### Added - -- Export `env-options.js` and `cli-options.js` in package.json for use with downstream [dotenv-expand](https://github.com/motdotla/dotenv-expand) module - -## [16.0.1](https://github.com/motdotla/dotenv/compare/v16.0.0...v16.0.1) (2022-05-10) - -### Changed - -- Minor README clarifications -- Development ONLY: updated devDependencies as recommended for development only security risks ([#658](https://github.com/motdotla/dotenv/pull/658)) - -## [16.0.0](https://github.com/motdotla/dotenv/compare/v15.0.1...v16.0.0) (2022-02-02) - -### Added - -- _Breaking:_ Backtick support 🎉 ([#615](https://github.com/motdotla/dotenv/pull/615)) - -If you had values containing the backtick character, please quote those values with either single or double quotes. - -## [15.0.1](https://github.com/motdotla/dotenv/compare/v15.0.0...v15.0.1) (2022-02-02) - -### Changed - -- Properly parse empty single or double quoted values 🐞 ([#614](https://github.com/motdotla/dotenv/pull/614)) - -## [15.0.0](https://github.com/motdotla/dotenv/compare/v14.3.2...v15.0.0) (2022-01-31) - -`v15.0.0` is a major new release with some important breaking changes. - -### Added - -- _Breaking:_ Multiline parsing support (just works. no need for the flag.) - -### Changed - -- _Breaking:_ `#` marks the beginning of a comment (UNLESS the value is wrapped in quotes. Please update your `.env` files to wrap in quotes any values containing `#`. For example: `SECRET_HASH="something-with-a-#-hash"`). - -..Understandably, (as some teams have noted) this is tedious to do across the entire team. To make it less tedious, we recommend using [dotenv cli](https://github.com/dotenv-org/cli) going forward. It's an optional plugin that will keep your `.env` files in sync between machines, environments, or team members. - -### Removed - -- _Breaking:_ Remove multiline option (just works out of the box now. no need for the flag.) - -## [14.3.2](https://github.com/motdotla/dotenv/compare/v14.3.1...v14.3.2) (2022-01-25) - -### Changed - -- Preserve backwards compatibility on values containing `#` 🐞 ([#603](https://github.com/motdotla/dotenv/pull/603)) - -## [14.3.1](https://github.com/motdotla/dotenv/compare/v14.3.0...v14.3.1) (2022-01-25) - -### Changed - -- Preserve backwards compatibility on exports by re-introducing the prior in-place exports 🐞 ([#606](https://github.com/motdotla/dotenv/pull/606)) - -## [14.3.0](https://github.com/motdotla/dotenv/compare/v14.2.0...v14.3.0) (2022-01-24) - -### Added - -- Add `multiline` option 🎉 ([#486](https://github.com/motdotla/dotenv/pull/486)) - -## [14.2.0](https://github.com/motdotla/dotenv/compare/v14.1.1...v14.2.0) (2022-01-17) - -### Added - -- Add `dotenv_config_override` cli option -- Add `DOTENV_CONFIG_OVERRIDE` command line env option - -## [14.1.1](https://github.com/motdotla/dotenv/compare/v14.1.0...v14.1.1) (2022-01-17) - -### Added - -- Add React gotcha to FAQ on README - -## [14.1.0](https://github.com/motdotla/dotenv/compare/v14.0.1...v14.1.0) (2022-01-17) - -### Added - -- Add `override` option 🎉 ([#595](https://github.com/motdotla/dotenv/pull/595)) - -## [14.0.1](https://github.com/motdotla/dotenv/compare/v14.0.0...v14.0.1) (2022-01-16) - -### Added - -- Log error on failure to load `.env` file ([#594](https://github.com/motdotla/dotenv/pull/594)) - -## [14.0.0](https://github.com/motdotla/dotenv/compare/v13.0.1...v14.0.0) (2022-01-16) - -### Added - -- _Breaking:_ Support inline comments for the parser 🎉 ([#568](https://github.com/motdotla/dotenv/pull/568)) - -## [13.0.1](https://github.com/motdotla/dotenv/compare/v13.0.0...v13.0.1) (2022-01-16) - -### Changed - -* Hide comments and newlines from debug output ([#404](https://github.com/motdotla/dotenv/pull/404)) - -## [13.0.0](https://github.com/motdotla/dotenv/compare/v12.0.4...v13.0.0) (2022-01-16) - -### Added - -* _Breaking:_ Add type file for `config.js` ([#539](https://github.com/motdotla/dotenv/pull/539)) - -## [12.0.4](https://github.com/motdotla/dotenv/compare/v12.0.3...v12.0.4) (2022-01-16) - -### Changed - -* README updates -* Minor order adjustment to package json format - -## [12.0.3](https://github.com/motdotla/dotenv/compare/v12.0.2...v12.0.3) (2022-01-15) - -### Changed - -* Simplified jsdoc for consistency across editors - -## [12.0.2](https://github.com/motdotla/dotenv/compare/v12.0.1...v12.0.2) (2022-01-15) - -### Changed - -* Improve embedded jsdoc type documentation - -## [12.0.1](https://github.com/motdotla/dotenv/compare/v12.0.0...v12.0.1) (2022-01-15) - -### Changed - -* README updates and clarifications - -## [12.0.0](https://github.com/motdotla/dotenv/compare/v11.0.0...v12.0.0) (2022-01-15) - -### Removed - -- _Breaking:_ drop support for Flow static type checker ([#584](https://github.com/motdotla/dotenv/pull/584)) - -### Changed - -- Move types/index.d.ts to lib/main.d.ts ([#585](https://github.com/motdotla/dotenv/pull/585)) -- Typescript cleanup ([#587](https://github.com/motdotla/dotenv/pull/587)) -- Explicit typescript inclusion in package.json ([#566](https://github.com/motdotla/dotenv/pull/566)) - -## [11.0.0](https://github.com/motdotla/dotenv/compare/v10.0.0...v11.0.0) (2022-01-11) - -### Changed - -- _Breaking:_ drop support for Node v10 ([#558](https://github.com/motdotla/dotenv/pull/558)) -- Patch debug option ([#550](https://github.com/motdotla/dotenv/pull/550)) - -## [10.0.0](https://github.com/motdotla/dotenv/compare/v9.0.2...v10.0.0) (2021-05-20) - -### Added - -- Add generic support to parse function -- Allow for import "dotenv/config.js" -- Add support to resolve home directory in path via ~ - -## [9.0.2](https://github.com/motdotla/dotenv/compare/v9.0.1...v9.0.2) (2021-05-10) - -### Changed - -- Support windows newlines with debug mode - -## [9.0.1](https://github.com/motdotla/dotenv/compare/v9.0.0...v9.0.1) (2021-05-08) - -### Changed - -- Updates to README - -## [9.0.0](https://github.com/motdotla/dotenv/compare/v8.6.0...v9.0.0) (2021-05-05) - -### Changed - -- _Breaking:_ drop support for Node v8 - -## [8.6.0](https://github.com/motdotla/dotenv/compare/v8.5.1...v8.6.0) (2021-05-05) - -### Added - -- define package.json in exports - -## [8.5.1](https://github.com/motdotla/dotenv/compare/v8.5.0...v8.5.1) (2021-05-05) - -### Changed - -- updated dev dependencies via npm audit - -## [8.5.0](https://github.com/motdotla/dotenv/compare/v8.4.0...v8.5.0) (2021-05-05) - -### Added - -- allow for `import "dotenv/config"` - -## [8.4.0](https://github.com/motdotla/dotenv/compare/v8.3.0...v8.4.0) (2021-05-05) - -### Changed - -- point to exact types file to work with VS Code - -## [8.3.0](https://github.com/motdotla/dotenv/compare/v8.2.0...v8.3.0) (2021-05-05) - -### Changed - -- _Breaking:_ drop support for Node v8 (mistake to be released as minor bump. later bumped to 9.0.0. see above.) - -## [8.2.0](https://github.com/motdotla/dotenv/compare/v8.1.0...v8.2.0) (2019-10-16) - -### Added - -- TypeScript types - -## [8.1.0](https://github.com/motdotla/dotenv/compare/v8.0.0...v8.1.0) (2019-08-18) - -### Changed - -- _Breaking:_ drop support for Node v6 ([#392](https://github.com/motdotla/dotenv/issues/392)) - -# [8.0.0](https://github.com/motdotla/dotenv/compare/v7.0.0...v8.0.0) (2019-05-02) - -### Changed - -- _Breaking:_ drop support for Node v6 ([#302](https://github.com/motdotla/dotenv/issues/392)) - -## [7.0.0] - 2019-03-12 - -### Fixed - -- Fix removing unbalanced quotes ([#376](https://github.com/motdotla/dotenv/pull/376)) - -### Removed - -- Removed `load` alias for `config` for consistency throughout code and documentation. - -## [6.2.0] - 2018-12-03 - -### Added - -- Support preload configuration via environment variables ([#351](https://github.com/motdotla/dotenv/issues/351)) - -## [6.1.0] - 2018-10-08 - -### Added - -- `debug` option for `config` and `parse` methods will turn on logging - -## [6.0.0] - 2018-06-02 - -### Changed - -- _Breaking:_ drop support for Node v4 ([#304](https://github.com/motdotla/dotenv/pull/304)) - -## [5.0.0] - 2018-01-29 - -### Added - -- Testing against Node v8 and v9 -- Documentation on trim behavior of values -- Documentation on how to use with `import` - -### Changed - -- _Breaking_: default `path` is now `path.resolve(process.cwd(), '.env')` -- _Breaking_: does not write over keys already in `process.env` if the key has a falsy value -- using `const` and `let` instead of `var` - -### Removed - -- Testing against Node v7 - -## [4.0.0] - 2016-12-23 - -### Changed - -- Return Object with parsed content or error instead of false ([#165](https://github.com/motdotla/dotenv/pull/165)). - -### Removed - -- `verbose` option removed in favor of returning result. - -## [3.0.0] - 2016-12-20 - -### Added - -- `verbose` option will log any error messages. Off by default. -- parses email addresses correctly -- allow importing config method directly in ES6 - -### Changed - -- Suppress error messages by default ([#154](https://github.com/motdotla/dotenv/pull/154)) -- Ignoring more files for NPM to make package download smaller - -### Fixed - -- False positive test due to case-sensitive variable ([#124](https://github.com/motdotla/dotenv/pull/124)) - -### Removed - -- `silent` option removed in favor of `verbose` - -## [2.0.0] - 2016-01-20 - -### Added - -- CHANGELOG to ["make it easier for users and contributors to see precisely what notable changes have been made between each release"](http://keepachangelog.com/). Linked to from README -- LICENSE to be more explicit about what was defined in `package.json`. Linked to from README -- Testing nodejs v4 on travis-ci -- added examples of how to use dotenv in different ways -- return parsed object on success rather than boolean true - -### Changed - -- README has shorter description not referencing ruby gem since we don't have or want feature parity - -### Removed - -- Variable expansion and escaping so environment variables are encouraged to be fully orthogonal - -## [1.2.0] - 2015-06-20 - -### Added - -- Preload hook to require dotenv without including it in your code - -### Changed - -- clarified license to be "BSD-2-Clause" in `package.json` - -### Fixed - -- retain spaces in string vars - -## [1.1.0] - 2015-03-31 - -### Added - -- Silent option to silence `console.log` when `.env` missing - -## [1.0.0] - 2015-03-13 - -### Removed - -- support for multiple `.env` files. should always use one `.env` file for the current environment - -[7.0.0]: https://github.com/motdotla/dotenv/compare/v6.2.0...v7.0.0 -[6.2.0]: https://github.com/motdotla/dotenv/compare/v6.1.0...v6.2.0 -[6.1.0]: https://github.com/motdotla/dotenv/compare/v6.0.0...v6.1.0 -[6.0.0]: https://github.com/motdotla/dotenv/compare/v5.0.0...v6.0.0 -[5.0.0]: https://github.com/motdotla/dotenv/compare/v4.0.0...v5.0.0 -[4.0.0]: https://github.com/motdotla/dotenv/compare/v3.0.0...v4.0.0 -[3.0.0]: https://github.com/motdotla/dotenv/compare/v2.0.0...v3.0.0 -[2.0.0]: https://github.com/motdotla/dotenv/compare/v1.2.0...v2.0.0 -[1.2.0]: https://github.com/motdotla/dotenv/compare/v1.1.0...v1.2.0 -[1.1.0]: https://github.com/motdotla/dotenv/compare/v1.0.0...v1.1.0 -[1.0.0]: https://github.com/motdotla/dotenv/compare/v0.4.0...v1.0.0 diff --git a/node_modules/dotenv/LICENSE b/node_modules/dotenv/LICENSE deleted file mode 100644 index c430ad8..0000000 --- a/node_modules/dotenv/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2015, Scott Motte -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/dotenv/README-es.md b/node_modules/dotenv/README-es.md deleted file mode 100644 index 0621461..0000000 --- a/node_modules/dotenv/README-es.md +++ /dev/null @@ -1,392 +0,0 @@ -
                          -🎉 new announcement vestauth: auth for agents–from the creator of dotenv and dotenvx. -
                          - -  - -# dotenv [![NPM version](https://img.shields.io/npm/v/dotenv.svg?style=flat-square)](https://www.npmjs.com/package/dotenv) - -dotenv - -Dotenv es un módulo de dependencia cero que carga las variables de entorno desde un archivo `.env` en [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). El almacenamiento de la configuración del entorno separado del código está basado en la metodología [The Twelve-Factor App](http://12factor.net/config). - -[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) -[![LICENSE](https://img.shields.io/github/license/motdotla/dotenv.svg)](LICENSE) - -## Instalación - -```bash -# instalación local (recomendado) -npm install dotenv --save -``` - -O installación con yarn? `yarn add dotenv` - -## Uso - -Cree un archivo `.env` en la raíz de su proyecto: - -```dosini -S3_BUCKET="YOURS3BUCKET" -SECRET_KEY="YOURSECRETKEYGOESHERE" -``` - -Tan prónto como sea posible en su aplicación, importe y configure dotenv: - -```javascript -require('dotenv').config() -console.log(process.env) // elimine esto después que haya confirmado que esta funcionando -``` - -.. o usa ES6? - -```javascript -import * as dotenv from 'dotenv' // vea en https://github.com/motdotla/dotenv#como-uso-dotenv-con-import -// REVISAR LINK DE REFERENCIA DE IMPORTACIÓN -dotenv.config() -import express from 'express' -``` - -Eso es todo. `process.env` ahora tiene las claves y los valores que definiste en tu archivo `.env`: - -```javascript -require('dotenv').config() - -... - -s3.getBucketCors({Bucket: process.env.S3_BUCKET}, function(err, data) {}) -``` - -### Valores multilínea - -Si necesita variables de varias líneas, por ejemplo, claves privadas, ahora se admiten en la versión (`>= v15.0.0`) con saltos de línea: - -```dosini -PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY----- -... -Kh9NV... -... ------END RSA PRIVATE KEY-----" -``` - -Alternativamente, puede usar comillas dobles y usar el carácter `\n`: - -```dosini -PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nKh9NV...\n-----END RSA PRIVATE KEY-----\n" -``` - -### Comentarios - -Los comentarios pueden ser agregados en tu archivo o en la misma línea: - -```dosini -# This is a comment -SECRET_KEY=YOURSECRETKEYGOESHERE # comment -SECRET_HASH="something-with-a-#-hash" -``` - -Los comentarios comienzan donde existe un `#`, entonces, si su valor contiene un `#`, enciérrelo entre comillas. Este es un cambio importante desde la versión `>= v15.0.0` en adelante. - -### Análisis - -El motor que analiza el contenido de su archivo que contiene variables de entorno está disponible para su uso. Este Acepta una Cadena o un Búfer y devolverá un Objeto con las claves y los valores analizados. - -```javascript -const dotenv = require('dotenv') -const buf = Buffer.from('BASICO=basico') -const config = dotenv.parse(buf) // devolverá un objeto -console.log(typeof config, config) // objeto { BASICO : 'basico' } -``` - -### Precarga - -Puede usar el `--require` (`-r`) [opción de línea de comando](https://nodejs.org/api/cli.html#-r---require-module) para precargar dotenv. Al hacer esto, no necesita requerir ni cargar dotnev en el código de su aplicación. - -```bash -$ node -r dotenv/config tu_script.js -``` - -Las opciones de configuración a continuación se admiten como argumentos de línea de comandos en el formato `dotenv_config_