Skip to content

Commit

Permalink
fix: add crypto globally to fix pkijs initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jtary committed Dec 20, 2023
1 parent a18595f commit 31a69d2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
5 changes: 2 additions & 3 deletions examples/create_deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import { MsgCreateLease } from '../build/protobuf/akash/market/v1beta4/lease';
import { BidID } from "../build/protobuf/akash/market/v1beta4/bid";

// update this with your wallet mnemonic
const mnemonic = "your wallet mnemonic here";

const rpcEndpoint = "https://rpc.akashnet.net:443";
const mnemonic = fs.readFileSync("./fixtures/mnemonic.txt", "utf8").trim();
const rawSDL = fs.readFileSync("./fixtures/example.sdl.yaml", "utf8");
const certificatePath = "./fixtures/cert.json";

Expand Down Expand Up @@ -415,7 +414,7 @@ async function deploy() {
console.log("Sending manifest...");
const status: any = await sendManifest(sdl, lease, wallet, certificate);


return status;
}

deploy().catch(console.error);
1 change: 1 addition & 0 deletions examples/fixtures/mnemonic.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
your mnemonic here
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"json-stable-stringify": "^1.0.2",
"keytar": "^7.7.0",
"node-fetch": "2",
"pkijs": "^2.1.95",
"pkijs": "^3.0.0",
"process": "^0.11.10",
"pvutils": "^1.0.17",
"simple-jsonrpc-js": "^1.2.0"
Expand Down
2 changes: 2 additions & 0 deletions src/certificates/generate509.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
global.crypto = require("node:crypto");

const {
getCrypto,
getAlgorithmParameters,
Expand Down
40 changes: 24 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ asn1js@^2.1.1:
dependencies:
pvutils "^1.1.3"

asn1js@^3.0.3:
asn1js@^3.0.5:
version "3.0.5"
resolved "https://registry.yarnpkg.com/asn1js/-/asn1js-3.0.5.tgz#5ea36820443dbefb51cc7f88a2ebb5b462114f38"
integrity sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ==
Expand Down Expand Up @@ -1531,10 +1531,10 @@ builtin-status-codes@^3.0.0:
resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8"
integrity sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==

bytestreamjs@^1.0.29:
version "1.1.3"
resolved "https://registry.yarnpkg.com/bytestreamjs/-/bytestreamjs-1.1.3.tgz#754f43495dab0e480af8dc174bf978c503ff8da8"
integrity sha512-JDGoiJ+yt+4Ui1e/vMWx5TRvmnErBBbsOkprXgbe1fRp2XZzI8MoknoiR/ZVCya9aWJbOhrJ5Heon1wrAdftkg==
bytestreamjs@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/bytestreamjs/-/bytestreamjs-2.0.1.tgz#a32947c7ce389a6fa11a09a9a563d0a45889535e"
integrity sha512-U1Z/ob71V/bXfVABvNr/Kumf5VyeQRBEm6Txb0PQ6S7V5GpBM3w4Cbqz/xPDicR5tN0uvDifng8C+5qECeGwyQ==

caching-transform@^4.0.0:
version "4.0.0"
Expand Down Expand Up @@ -3589,14 +3589,16 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0:
dependencies:
find-up "^4.0.0"

pkijs@^2.1.95:
version "2.4.0"
resolved "https://registry.yarnpkg.com/pkijs/-/pkijs-2.4.0.tgz#ae5babf89c94f4606a4b9c89b9a7d4e57862445a"
integrity sha512-cjJP/mYuGyMrjJ49jI04khId5Oufd3nFTUYBzQTIIVNI7/oAWdwXEfpwTF8HELFV/gz+WGYUBHCe3KHWD8rYvg==
pkijs@^3.0.0:
version "3.0.15"
resolved "https://registry.yarnpkg.com/pkijs/-/pkijs-3.0.15.tgz#d6a3f6e11ae8c8aa1ebd1daf4501e9ac49f61916"
integrity sha512-n7nAl9JpqdeQsjy+rPmswkmZ3oO/Fu5uN9me45PPQVdWjd0X7HKfL8+HYwfxihqoDSSPUIajkOcqFxEUxMqhwQ==
dependencies:
asn1js "^3.0.3"
bytestreamjs "^1.0.29"
asn1js "^3.0.5"
bytestreamjs "^2.0.0"
pvtsutils "^1.3.2"
pvutils "^1.1.3"
tslib "^2.4.0"

prebuild-install@^7.0.1:
version "7.1.1"
Expand Down Expand Up @@ -3693,11 +3695,11 @@ punycode@^2.1.0:
integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==

pvtsutils@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.2.tgz#9f8570d132cdd3c27ab7d51a2799239bf8d8d5de"
integrity sha512-+Ipe2iNUyrZz+8K/2IOo+kKikdtfhRKzNpQbruF2URmqPtoqAs8g3xS7TJvFF2GcPXjh7DkqMnpVveRFq4PgEQ==
version "1.3.5"
resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.5.tgz#b8705b437b7b134cd7fd858f025a23456f1ce910"
integrity sha512-ARvb14YB9Nm2Xi6nBq1ZX6dAM0FsJnuk+31aUp4TrcZEdKUlSqOqsxJHUPJDNE3qiIp+iUPEIeR6Je/tgV7zsA==
dependencies:
tslib "^2.4.0"
tslib "^2.6.1"

pvutils@^1.0.17, pvutils@^1.1.3:
version "1.1.3"
Expand Down Expand Up @@ -4511,11 +4513,16 @@ tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tslib@^2.0.1, tslib@^2.4.0:
tslib@^2.0.1:
version "2.4.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==

tslib@^2.4.0, tslib@^2.6.1:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==

tty-browserify@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811"
Expand Down Expand Up @@ -4787,6 +4794,7 @@ wildcard@^2.0.0:
integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
name wrap-ansi-cjs
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down

0 comments on commit 31a69d2

Please sign in to comment.