Skip to content

Commit

Permalink
fix: decode arweave wallet in permaweb deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobinstein committed Jul 30, 2024
1 parent b15bcf7 commit a1f7d8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/arweave-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
build-and-deploy:
Arweave-build-and-deploy:
runs-on: ubuntu-latest

steps:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/scripts/arweave-deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ const { Readable } = require("stream");
async function main() {
const mime = (await import("mime")).default;

const jwk = JSON.parse(process.env.DEPLOY_KEY);
const jwkBase64 = process.env.DEPLOY_KEY;
if (!jwk) {
throw new Error(
"The Arweave wallet key (DEPLOY_KEY) is missing or not accessible. Please ensure it is set as an environment variable."
);
}
const turbo = TurboFactory.authenticated({ privateKey: jwk });

// Decode the Base64 string
const decodedJwk = Buffer.from(jwkBase64, "base64").toString("utf8");

// Parse the decoded string as JSON
const parsedKey = JSON.parse(decodedJwk);
const turbo = TurboFactory.authenticated({ privateKey: parsedKey });

const distPath = path.join(__dirname, "../../../docs/src/.vuepress/dist");

Expand Down

0 comments on commit a1f7d8d

Please sign in to comment.