diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 436cc43f2..f22b3ab4f 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -33,7 +33,7 @@ jobs:
- name: Test
run: pnpm test
- - name: Check examples
+ - name: Check examples & demos
run: pnpm check-examples
- name: Upload coverage to Codecov
diff --git a/demos/taco-demo/package.json b/demos/taco-demo/package.json
index 369c67c7d..1c0efad42 100644
--- a/demos/taco-demo/package.json
+++ b/demos/taco-demo/package.json
@@ -6,7 +6,10 @@
"author": "Piotr Rosłaniec
",
"scripts": {
"start": "webpack serve --mode development",
- "build": "tsc --noEmit && rimraf build && webpack --mode production --progress"
+ "build": "pnpm clean && webpack --mode production --progress",
+ "clean": "rimraf build",
+ "check": "pnpm typecheck && pnpm build",
+ "typecheck": "tsc --noEmit"
},
"dependencies": {
"@nucypher/taco": "workspace:*",
diff --git a/demos/taco-demo/src/App.tsx b/demos/taco-demo/src/App.tsx
index 6cf0eb981..b8f18db9f 100644
--- a/demos/taco-demo/src/App.tsx
+++ b/demos/taco-demo/src/App.tsx
@@ -1,6 +1,7 @@
import {
conditions,
decrypt,
+ domains,
encrypt,
getPorterUri,
initialize,
@@ -43,6 +44,7 @@ export default function App() {
const provider = new ethers.providers.Web3Provider(window.ethereum);
const encryptedMessage = await encrypt(
provider,
+ domains.DEV,
message,
condition,
ritualId,
@@ -62,12 +64,12 @@ export default function App() {
setDecryptionErrors([]);
const provider = new ethers.providers.Web3Provider(window.ethereum);
- const porterUri = getPorterUri('lynx');
const decryptedMessage = await decrypt(
provider,
+ domains.DEV,
encryptedMessage,
+ getPorterUri(domains.DEV),
provider.getSigner(),
- porterUri,
);
setDecryptedMessage(new TextDecoder().decode(decryptedMessage));
diff --git a/demos/taco-nft-demo/package.json b/demos/taco-nft-demo/package.json
index 7dedd890c..7f47fee2f 100644
--- a/demos/taco-nft-demo/package.json
+++ b/demos/taco-nft-demo/package.json
@@ -6,7 +6,10 @@
"author": "Piotr Rosłaniec ",
"scripts": {
"start": "webpack serve --mode development",
- "build": "tsc --noEmit && rimraf build && webpack --mode production --progress"
+ "build": "pnpm clean && webpack --mode production --progress",
+ "clean": "rimraf build",
+ "check": "pnpm typecheck && pnpm build",
+ "typecheck": "tsc --noEmit"
},
"dependencies": {
"@nucypher/taco": "workspace:*",
diff --git a/demos/taco-nft-demo/src/App.tsx b/demos/taco-nft-demo/src/App.tsx
index b4df8c3ee..01b86b29f 100644
--- a/demos/taco-nft-demo/src/App.tsx
+++ b/demos/taco-nft-demo/src/App.tsx
@@ -1,6 +1,7 @@
import {
conditions,
decrypt,
+ domains,
encrypt,
getPorterUri,
initialize,
@@ -42,6 +43,7 @@ export default function App() {
const provider = new ethers.providers.Web3Provider(window.ethereum);
const encryptedMessage = await encrypt(
provider,
+ domains.DEV,
message,
condition,
ritualId,
@@ -61,12 +63,12 @@ export default function App() {
setDecryptionErrors([]);
const provider = new ethers.providers.Web3Provider(window.ethereum);
- const porterUri = getPorterUri('lynx');
const decryptedMessage = await decrypt(
provider,
+ domains.DEV,
encryptedMessage,
+ getPorterUri(domains.DEV),
provider.getSigner(),
- porterUri,
);
setDecryptedMessage(new TextDecoder().decode(decryptedMessage));
diff --git a/package.json b/package.json
index 701b8f278..2d43ef7cb 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,7 @@
"exports:lint": "pnpm run --parallel --aggregate-output --reporter append-only --filter './packages/**' exports:lint",
"fix": "pnpm format:fix && pnpm lint:fix && pnpm packages:sort",
"ci:lint": "run-p lint type-check package:check packages:lint exports:lint",
- "check-examples": "pnpm run --parallel --aggregate-output --reporter append-only --filter './examples/**' check"
+ "check-examples": "pnpm run --parallel --aggregate-output --reporter append-only --filter './examples/**' --filter './demos/**' check"
},
"dependencies": {
"@nucypher/nucypher-core": "0.13.0-alpha.1"
diff --git a/packages/shared/abis/GlobalAllowList.json b/packages/shared/abis/GlobalAllowList.json
deleted file mode 100644
index 414fb653f..000000000
--- a/packages/shared/abis/GlobalAllowList.json
+++ /dev/null
@@ -1,522 +0,0 @@
-[
- {
- "inputs": [
- {
- "internalType": "contract Coordinator",
- "name": "_coordinator",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "_admin",
- "type": "address"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [],
- "name": "DefaultAdminDelayChangeCanceled",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": false,
- "internalType": "uint48",
- "name": "newDelay",
- "type": "uint48"
- },
- {
- "indexed": false,
- "internalType": "uint48",
- "name": "effectSchedule",
- "type": "uint48"
- }
- ],
- "name": "DefaultAdminDelayChangeScheduled",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [],
- "name": "DefaultAdminTransferCanceled",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "newAdmin",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint48",
- "name": "acceptSchedule",
- "type": "uint48"
- }
- ],
- "name": "DefaultAdminTransferScheduled",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "bytes32",
- "name": "role",
- "type": "bytes32"
- },
- {
- "indexed": true,
- "internalType": "bytes32",
- "name": "previousAdminRole",
- "type": "bytes32"
- },
- {
- "indexed": true,
- "internalType": "bytes32",
- "name": "newAdminRole",
- "type": "bytes32"
- }
- ],
- "name": "RoleAdminChanged",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "bytes32",
- "name": "role",
- "type": "bytes32"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "sender",
- "type": "address"
- }
- ],
- "name": "RoleGranted",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "bytes32",
- "name": "role",
- "type": "bytes32"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "sender",
- "type": "address"
- }
- ],
- "name": "RoleRevoked",
- "type": "event"
- },
- {
- "inputs": [],
- "name": "DEFAULT_ADMIN_ROLE",
- "outputs": [
- {
- "internalType": "bytes32",
- "name": "",
- "type": "bytes32"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "acceptDefaultAdminTransfer",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint32",
- "name": "ritualId",
- "type": "uint32"
- },
- {
- "internalType": "address[]",
- "name": "addresses",
- "type": "address[]"
- }
- ],
- "name": "authorize",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "newAdmin",
- "type": "address"
- }
- ],
- "name": "beginDefaultAdminTransfer",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "cancelDefaultAdminTransfer",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint48",
- "name": "newDelay",
- "type": "uint48"
- }
- ],
- "name": "changeDefaultAdminDelay",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "coordinator",
- "outputs": [
- {
- "internalType": "contract Coordinator",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint32",
- "name": "ritualId",
- "type": "uint32"
- },
- {
- "internalType": "address[]",
- "name": "addresses",
- "type": "address[]"
- }
- ],
- "name": "deauthorize",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "defaultAdmin",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "defaultAdminDelay",
- "outputs": [
- {
- "internalType": "uint48",
- "name": "",
- "type": "uint48"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "defaultAdminDelayIncreaseWait",
- "outputs": [
- {
- "internalType": "uint48",
- "name": "",
- "type": "uint48"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes32",
- "name": "role",
- "type": "bytes32"
- }
- ],
- "name": "getRoleAdmin",
- "outputs": [
- {
- "internalType": "bytes32",
- "name": "",
- "type": "bytes32"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes32",
- "name": "role",
- "type": "bytes32"
- },
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- }
- ],
- "name": "grantRole",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes32",
- "name": "role",
- "type": "bytes32"
- },
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- }
- ],
- "name": "hasRole",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint32",
- "name": "ritualId",
- "type": "uint32"
- },
- {
- "internalType": "address",
- "name": "encryptor",
- "type": "address"
- }
- ],
- "name": "isAddressAuthorized",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint32",
- "name": "ritualId",
- "type": "uint32"
- },
- {
- "internalType": "bytes",
- "name": "evidence",
- "type": "bytes"
- },
- {
- "internalType": "bytes",
- "name": "ciphertextHeader",
- "type": "bytes"
- }
- ],
- "name": "isAuthorized",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "pendingDefaultAdmin",
- "outputs": [
- {
- "internalType": "address",
- "name": "newAdmin",
- "type": "address"
- },
- {
- "internalType": "uint48",
- "name": "schedule",
- "type": "uint48"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "pendingDefaultAdminDelay",
- "outputs": [
- {
- "internalType": "uint48",
- "name": "newDelay",
- "type": "uint48"
- },
- {
- "internalType": "uint48",
- "name": "schedule",
- "type": "uint48"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes32",
- "name": "role",
- "type": "bytes32"
- },
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- }
- ],
- "name": "renounceRole",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes32",
- "name": "role",
- "type": "bytes32"
- },
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- }
- ],
- "name": "revokeRole",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "rollbackDefaultAdminDelay",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "contract Coordinator",
- "name": "_coordinator",
- "type": "address"
- }
- ],
- "name": "setCoordinator",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes4",
- "name": "interfaceId",
- "type": "bytes4"
- }
- ],
- "name": "supportsInterface",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }
-]
diff --git a/packages/taco/src/taco.ts b/packages/taco/src/taco.ts
index 89d45a58e..09e4890d0 100644
--- a/packages/taco/src/taco.ts
+++ b/packages/taco/src/taco.ts
@@ -9,6 +9,7 @@ import {
DkgCoordinatorAgent,
Domain,
fromHexString,
+ getPorterUri,
GlobalAllowListAgent,
toBytes,
} from '@nucypher/shared';
@@ -81,9 +82,13 @@ export const decrypt = async (
provider: ethers.providers.Provider,
domain: Domain,
messageKit: ThresholdMessageKit,
- porterUri: string,
+ porterUri?: string,
signer?: ethers.Signer,
): Promise => {
+ if (!porterUri) {
+ porterUri = getPorterUri(domain)
+ }
+
const ritualId = await DkgCoordinatorAgent.getRitualIdFromPublicKey(
provider,
domain,