Skip to content

Commit

Permalink
[EPIC] Auth (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
derekpierre authored Jul 30, 2024
2 parents 74770d2 + 8cb3e9e commit b976284
Show file tree
Hide file tree
Showing 100 changed files with 3,817 additions and 2,166 deletions.
7 changes: 1 addition & 6 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [
[
"@nucypher/shared",
"@nucypher/taco"
]
],
"fixed": [["@nucypher/shared", "@nucypher/taco"]],
"linked": [],
"access": "public",
"baseBranch": "main",
Expand Down
37 changes: 17 additions & 20 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,51 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
'root': true,
'parser': '@typescript-eslint/parser',
'env': {
'es6': true,
root: true,
parser: '@typescript-eslint/parser',
env: {
es6: true,
},
'ignorePatterns': [
ignorePatterns: [
'node_modules',
'build',
'coverage',
'src/contracts/ethers-typechain',
],
'plugins': [
'import',
'eslint-comments',
],
'extends': [
plugins: ['import', 'eslint-comments'],
extends: [
'eslint:recommended',
'plugin:eslint-comments/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
'prettier',
],
'globals': {
'BigInt': true,
'console': true,
'WebAssembly': true,
globals: {
BigInt: true,
console: true,
WebAssembly: true,
},
'rules': {
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'eslint-comments/disable-enable-pair': [
'error',
{
'allowWholeFile': true,
allowWholeFile: true,
},
],
'import/order': [
'error',
{
'newlines-between': 'always',
'alphabetize': {
'order': 'asc',
alphabetize: {
order: 'asc',
},
},
],
'sort-imports': [
'error',
{
'ignoreDeclarationSort': true,
'ignoreCase': true,
ignoreDeclarationSort: true,
ignoreCase: true,
},
],
},
Expand Down
18 changes: 11 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@

- [ ] 1
- [ ] 2
- [X] 3
- [x] 3

**What this does:**
> High-level idea of the changes introduced in this PR.
> List relevant API changes (if any), as well as related PRs and issues.

> High-level idea of the changes introduced in this PR. List relevant API
> changes (if any), as well as related PRs and issues.
**Issues fixed/closed:**

> - Fixes #...
**Why it's needed:**
> Explain how this PR fits in the greater context of the NuCypher Network.
> E.g., if this PR address a `nucypher/productdev` issue, let reviewers know!

> Explain how this PR fits in the greater context of the NuCypher Network. E.g.,
> if this PR address a `nucypher/productdev` issue, let reviewers know!
**Notes for reviewers:**
> What should reviewers focus on?
> Is there a particular commit/function/section of your PR that requires more attention from reviewers?

> What should reviewers focus on? Is there a particular commit/function/section
> of your PR that requires more attention from reviewers?
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "monthly"
interval: 'monthly'
open-pull-requests-limit: 5
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "monthly"
interval: 'monthly'
open-pull-requests-limit: 5
17 changes: 9 additions & 8 deletions .github/workflows/lynx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@ name: '🔎 Lynx Testnet Example'

on:
schedule:
- cron: "0 * * * *" # Every hour
- cron: '0 * * * *' # Every hour
pull_request:
workflow_dispatch:

# TODO: Use variables when GH supports it for forks. See https://github.com/orgs/community/discussions/44322
env:
RPC_PROVIDER_URL: "https://rpc-amoy.polygon.technology"
ENCRYPTOR_PRIVATE_KEY: "0x900edb9e8214b2353f82aa195e915128f419a92cfb8bbc0f4784f10ef4112b86"
CONSUMER_PRIVATE_KEY: "0xf307e165339cb5deb2b8ec59c31a5c0a957b8e8453ce7fe8a19d9a4c8acf36d4"
RITUAL_ID: "0"
RPC_PROVIDER_URL: 'https://rpc-amoy.polygon.technology'
ENCRYPTOR_PRIVATE_KEY: '0x900edb9e8214b2353f82aa195e915128f419a92cfb8bbc0f4784f10ef4112b86'
CONSUMER_PRIVATE_KEY: '0xf307e165339cb5deb2b8ec59c31a5c0a957b8e8453ce7fe8a19d9a4c8acf36d4'
RITUAL_ID: '0'

jobs:
networks:
name: '🔎 Lynx Testnet Example on Node ${{ matrix.node }} and ${{ matrix.os }}'
name:
'🔎 Lynx Testnet Example on Node ${{ matrix.node }} and ${{ matrix.os }}'

runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [ '18.x' ]
os: [ ubuntu-latest ]
node: ['18.x']
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CI
on: [ push, pull_request ]
on: [push, pull_request]

concurrency: ${{ github.workflow }}-${{ github.ref }}

Expand All @@ -9,8 +9,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [ '18.x', '20.x', '22.x' ]
os: [ ubuntu-latest ]
node: ['18.x', '20.x', '22.x']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -41,7 +41,6 @@ jobs:
with:
# https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954/21
fail_ci_if_error: false

# TODO: Fix or replace bundlemon on CI
# - name: Analyze bundle size
# uses: lironer/bundlemon-action@v1
10 changes: 5 additions & 5 deletions .github/workflows/mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: '🔎 Mainnet Example'

on:
schedule:
- cron: "0 * * * *" # Every hour
- cron: '0 * * * *' # Every hour
workflow_dispatch:

# TODO: Use variables when GH supports it for forks. See https://github.com/orgs/community/discussions/44322
env:
RPC_PROVIDER_URL: "https://polygon.llamarpc.com"
RPC_PROVIDER_URL: 'https://polygon.llamarpc.com'
ENCRYPTOR_PRIVATE_KEY: ${{ secrets.MAINNET_ENCRYPTOR_PRIVATE_KEY }}
CONSUMER_PRIVATE_KEY: ${{ secrets.MAINNET_CONSUMER_PRIVATE_KEY }}
RITUAL_ID: "9"
RITUAL_ID: '9'

jobs:
networks:
Expand All @@ -19,8 +19,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [ '18.x' ]
os: [ ubuntu-latest ]
node: ['18.x']
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: 'Test npmjs.com package'

on:
schedule:
- cron: "0 * * * *" # Every hour
- cron: '0 * * * *' # Every hour
workflow_dispatch:

jobs:
npm:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '18.x' ]
version: [ 'latest', 'mainnet', 'devnet', 'testnet' ]
node: ['18.x']
version: ['latest', 'mainnet', 'devnet', 'testnet']

steps:
- uses: pnpm/action-setup@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Release
on:
push:
branches:
- "main"
- 'main'

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
publish:
name: Publish NPM package using changesets
runs-on: "ubuntu-latest"
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/tapir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@ name: '🔎 Tapir Testnet Example'

on:
schedule:
- cron: "0 * * * *" # Every hour
- cron: '0 * * * *' # Every hour
pull_request:
branches:
- main
workflow_dispatch:

# TODO: Use variables when GH supports it for forks. See https://github.com/orgs/community/discussions/44322
env:
RPC_PROVIDER_URL: "https://rpc-amoy.polygon.technology"
ENCRYPTOR_PRIVATE_KEY: "0x900edb9e8214b2353f82aa195e915128f419a92cfb8bbc0f4784f10ef4112b86"
CONSUMER_PRIVATE_KEY: "0xf307e165339cb5deb2b8ec59c31a5c0a957b8e8453ce7fe8a19d9a4c8acf36d4"
RITUAL_ID: "0"
RPC_PROVIDER_URL: 'https://rpc-amoy.polygon.technology'
ENCRYPTOR_PRIVATE_KEY: '0x900edb9e8214b2353f82aa195e915128f419a92cfb8bbc0f4784f10ef4112b86'
CONSUMER_PRIVATE_KEY: '0xf307e165339cb5deb2b8ec59c31a5c0a957b8e8453ce7fe8a19d9a4c8acf36d4'
RITUAL_ID: '0'

jobs:
networks:
name: '🔎 Tapir Testnet Example on Node ${{ matrix.node }} and ${{ matrix.os }}'
name:
'🔎 Tapir Testnet Example on Node ${{ matrix.node }} and ${{ matrix.os }}'

runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [ '18.x' ]
os: [ ubuntu-latest ]
node: ['18.x']
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 4 additions & 2 deletions demos/taco-demo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ export default function App() {
setDecryptedMessage('');
setDecryptionErrors([]);

const encryptedMessageHex = await downloadData(encryptedMessageId) as string;
const encryptedMessageHex = (await downloadData(
encryptedMessageId,
)) as string;
const encryptedMessage = ThresholdMessageKit.fromBytes(
Buffer.from(encryptedMessageHex, 'hex'),
);
Expand Down Expand Up @@ -119,7 +121,7 @@ export default function App() {
<h2>Notice</h2>
<p>
In production (mainnet domain), your wallet address (encryptor) will also have
to be allow-listed for this specific ritual. However, we have
to be allow-listed for this specific ritual. However, we have
<a href={'https://docs.threshold.network/app-development/threshold-access-control-tac/integration-guide/get-started-with-tac#testnet-configuration'}>publicly available testnet rituals</a>
for use when developing your apps.
</p>
Expand Down
3 changes: 1 addition & 2 deletions demos/taco-nft-demo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import { useEthers } from '@usedapp/core';
import { ethers } from 'ethers';
import React, { useEffect, useState } from 'react';

import { DEFAULT_DOMAIN, DEFAULT_RITUAL_ID } from './config';
import { Decrypt } from './Decrypt';
import { Encrypt } from './Encrypt';
import { NFTConditionBuilder } from './NFTConditionBuilder';
import { Spinner } from './Spinner';
import { DEFAULT_DOMAIN, DEFAULT_RITUAL_ID } from './config';

const chainIdForDomain = {
[domains.DEVNET]: 80002,
Expand Down Expand Up @@ -43,7 +43,6 @@ export default function App() {
switchNetwork(chainId);
}, [chainId]);


const encryptMessage = async (message: string) => {
if (!condition) {
return;
Expand Down
6 changes: 3 additions & 3 deletions demos/taco-nft-demo/src/NFTConditionBuilder.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { conditions } from '@nucypher/taco';
import { Sepolia, useEthers} from '@usedapp/core';
import { Sepolia, useEthers } from '@usedapp/core';
import React, { useState } from 'react';

interface Props {
Expand Down Expand Up @@ -97,8 +97,8 @@ export const NFTConditionBuilder = ({
<div>
<p>
You can mint an NFT{' '}
<a href="https://nfts2me.com/create/generative/">here</a> or use your own
contract.
<a href="https://nfts2me.com/create/generative/">here</a> or use
your own contract.
</p>
</div>
<div>
Expand Down
8 changes: 4 additions & 4 deletions demos/taco-nft-demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"noEmit": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"skipLibCheck": true
"skipLibCheck": true,
},
"references": [
{
"path": "../../packages/taco/tsconfig.es.json"
}
]
"path": "../../packages/taco/tsconfig.es.json",
},
],
}
4 changes: 2 additions & 2 deletions demos/taco-nft-demo/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ module.exports = {
DEFAULT_RITUAL_ID: JSON.stringify(process.env.DEFAULT_RITUAL_ID),
DEFAULT_DOMAIN: JSON.stringify(process.env.DEFAULT_DOMAIN),
},
}
})
},
}),
].filter(Boolean),
module: {
rules: [
Expand Down
2 changes: 1 addition & 1 deletion examples/pre/nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
toHexString,
} from '@nucypher/pre';
import { ethers } from 'ethers';
import { hexlify } from "ethers/lib/utils";
import { hexlify } from 'ethers/lib/utils';
import { useEffect, useState } from 'react';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
Loading

0 comments on commit b976284

Please sign in to comment.