Skip to content

Commit 0071730

Browse files
committed
fix: avoid libsodium.mjs runtime error in bundled action
1 parent 3bff4bc commit 0071730

7 files changed

Lines changed: 30 additions & 13 deletions

File tree

dist/index.js.cache

-16 Bytes
Binary file not shown.

dist/index.js.cache.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@octokit/auth-app": "^4.0.13",
3939
"@octokit/core": "^4.2.4",
4040
"is-base64": "^1.1.0",
41-
"libsodium-wrappers": "^0.7.10"
41+
"libsodium-wrappers-sumo": "^0.7.10"
4242
},
4343
"devDependencies": {
4444
"@bubkoo/commitlint-config": "^1.2.2",

src/libsodium-wrappers-sumo.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
declare module 'libsodium-wrappers-sumo' {
2+
interface SodiumBase64Variants {
3+
ORIGINAL: number
4+
}
5+
6+
interface Sodium {
7+
ready: Promise<void>
8+
base64_variants: SodiumBase64Variants
9+
from_base64(input: string, variant: number): Uint8Array
10+
from_string(input: string): Uint8Array
11+
crypto_box_seal(message: Uint8Array, publicKey: Uint8Array): Uint8Array
12+
to_base64(input: Uint8Array, variant: number): string
13+
}
14+
15+
const sodium: Sodium
16+
export default sodium
17+
}

src/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as core from '@actions/core'
22
import * as github from '@actions/github'
33
import isBase64 from 'is-base64'
4-
import sodium from 'libsodium-wrappers'
4+
import sodium from 'libsodium-wrappers-sumo'
55
import { Octokit } from '@octokit/core'
66
import { createAppAuth } from '@octokit/auth-app'
77

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "@bubkoo/tsconfig",
3-
"include": ["src/**/*.ts"]
3+
"include": ["src/**/*.ts", "src/**/*.d.ts"]
44
}

0 commit comments

Comments
 (0)