Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
chore(ci): update mainnet example
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Jul 4, 2024
1 parent 0d25f33 commit 3c57418
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

# TODO: Use variables when GH supports it for forks. See https://github.com/orgs/community/discussions/44322
env:
RPC_PROVIDER_URL: "https://rpc-mainnet.maticvigil.com"
RPC_PROVIDER_URL: 'https://rpc-amoy.polygon.technology'
ENCRYPTOR_PRIVATE_KEY: ${{ secrets.MAINNET_ENCRYPTOR_PRIVATE_KEY }}
CONSUMER_PRIVATE_KEY: ${{ secrets.MAINNET_CONSUMER_PRIVATE_KEY }}
RITUAL_ID: "9"
Expand Down
12 changes: 12 additions & 0 deletions examples/taco/nodejs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
fromBytes,
getPorterUri,
initialize,
isAuthorized,
ThresholdMessageKit,
toBytes,
toHexString,
Expand Down Expand Up @@ -72,6 +73,17 @@ const encryptToBytes = async (messageString: string) => {
encryptorSigner,
);

// Calling it after the encryption because we need material from messageKit
const isEncryptorAuthenticated = await isAuthorized(
provider,
domain,
messageKit,
ritualId,
);
if (!isEncryptorAuthenticated) {
throw new Error('Not authorized');
}

return messageKit.toBytes();
};

Expand Down

0 comments on commit 3c57418

Please sign in to comment.