From e03d557a53654bd7e50314bed64d5f78cb929f8d Mon Sep 17 00:00:00 2001 From: cpb8010 Date: Tue, 19 Nov 2024 09:26:18 -0800 Subject: [PATCH 1/2] fix: disable user verification (#180) We have a user who is getting this error even when it defaults to preferred, and we're discouraging it in other places. Also attempting to block Winodws Hello before hasn't been successful, as Chrome thinks we should be able to support it. --- packages/sdk/src/client/actions/passkey.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/sdk/src/client/actions/passkey.ts b/packages/sdk/src/client/actions/passkey.ts index 5efa55da..c63cafa6 100644 --- a/packages/sdk/src/client/actions/passkey.ts +++ b/packages/sdk/src/client/actions/passkey.ts @@ -40,7 +40,9 @@ export const generatePasskeyRegistrationOptions = async (args: GeneratePasskeyRe // See "Guiding use of authenticators via authenticatorSelection" below authenticatorSelection: { residentKey: "required", + userVerification: "discouraged", }, + supportedAlgorithmIDs: [-7], // only supports ES256 (no windows hello) }; const params: GenerateRegistrationOptionsOpts = Object.assign({}, defaultOptions, args); const options = await generateRegistrationOptions(params); From 632ff944e910f1710432e5631fb6c6e60c7bb14f Mon Sep 17 00:00:00 2001 From: Jack Hamer <47187316+JackHamer09@users.noreply.github.com> Date: Tue, 19 Nov 2024 19:56:33 +0200 Subject: [PATCH 2/2] fix: update zksync account to sso, sdk package deployment workflow, remove verdaccio (#186) --- .github/workflows/deploy-package.yml | 46 + .verdaccio/config.yml | 28 - README.md | 35 +- cspell-config/cspell-misc.txt | 1 - docs/sdk/client-auth-server/README.md | 4 +- docs/verdaccio.md | 51 - examples/demo-app/pages/index.vue | 4 +- examples/nft-quest/stores/connector.ts | 4 +- package.json | 2 - packages/contracts/test/sdk/PasskeyClient.ts | 92 -- packages/sdk/.npmignore | 17 + packages/sdk/README.md | 4 +- packages/sdk/package.json | 3 +- packages/sdk/prepare-package.mjs | 39 + packages/sdk/src/client-auth-server/Signer.ts | 4 +- .../src/client-auth-server/WalletProvider.ts | 2 +- packages/sdk/src/client/clients/passkey.ts | 22 +- packages/sdk/src/client/clients/session.ts | 26 +- packages/sdk/src/client/decorators/passkey.ts | 8 +- packages/sdk/src/client/decorators/session.ts | 8 +- .../src/client/decorators/session_wallet.ts | 10 +- .../sdk/src/communicator/PopupCommunicator.ts | 2 +- packages/sdk/src/connector/index.ts | 4 +- pnpm-lock.yaml | 1356 +---------------- project.json | 14 - 25 files changed, 233 insertions(+), 1553 deletions(-) create mode 100644 .github/workflows/deploy-package.yml delete mode 100644 .verdaccio/config.yml delete mode 100644 docs/verdaccio.md delete mode 100644 packages/contracts/test/sdk/PasskeyClient.ts create mode 100644 packages/sdk/.npmignore create mode 100644 packages/sdk/prepare-package.mjs delete mode 100644 project.json diff --git a/.github/workflows/deploy-package.yml b/.github/workflows/deploy-package.yml new file mode 100644 index 00000000..3b00fa26 --- /dev/null +++ b/.github/workflows/deploy-package.yml @@ -0,0 +1,46 @@ +name: Deploy NPM Package + +on: + workflow_dispatch: + inputs: + version: + description: "Version to publish (e.g., 1.0.0)" + default: "1.0.0" + required: true + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.11.0 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/Iron + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install -r --frozen-lockfile + + - name: Build the package + run: pnpm nx build sdk + + - name: Prepare package.json + working-directory: packages/sdk + run: node prepare-package.mjs + env: + INPUT_VERSION: ${{ github.event.inputs.version }} + + - name: Create .npmrc + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }}" > ~/.npmrc + + - name: Publish to NPM + working-directory: packages/sdk + run: npm publish --access public \ No newline at end of file diff --git a/.verdaccio/config.yml b/.verdaccio/config.yml deleted file mode 100644 index 591a20dd..00000000 --- a/.verdaccio/config.yml +++ /dev/null @@ -1,28 +0,0 @@ -# path to a directory with all packages -storage: ../tmp/local-registry/storage - -# a list of other known repositories we can talk to -uplinks: - npmjs: - url: https://registry.npmjs.org - maxage: 60m - -packages: - "**": - # give all users (including non-authenticated users) full access - # because it is a local registry - access: $all - publish: $all - unpublish: $all - - # if package is not available locally, proxy requests to npm registry - proxy: npmjs - -# log settings -logs: - type: stdout - format: pretty - level: warn - -publish: - allow_offline: true # set offline to true to allow publish offline diff --git a/README.md b/README.md index 5c704373..e9a1d5c2 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,9 @@ Add ZKsync SSO connector to your app (using `wagmi`): ```ts import { zksyncSepoliaTestnet } from "viem/chains"; import { createConfig, connect } from "@wagmi/core"; -import { zksyncAccountConnector } from "zksync-sso/connector"; +import { zksyncSsoConnector } from "zksync-sso/connector"; -const ssoConnector = zksyncAccountConnector({ +const ssoConnector = zksyncSsoConnector({ // Optional session configuration, if omitted user will have to sign every transaction via Auth Server session: { // Allow up to 0.1 ETH to be spend in gas fees @@ -117,34 +117,9 @@ This monorepo is comprised of the following packages, products, and examples: pnpm install ``` -You have two options for using the SDK in the monorepo workspaces, via PNPM -workspace protocol or using Verdaccio. The project is currently configured to -use the SDK package via PNPM. If you want to use the SDK outside of the monorepo -in another local project, setup the Verdaccio option to easily use the SDK -package. - -### Using the SDK package via PNPM - -PNPM provides a way to "link" workspaces together via `package.json` -dependencies using the -[Workspace protocol](https://pnpm.io/workspaces#workspace-protocol-workspace). - -### Using the SDK package locally via Verdaccio - -2. Start up the Verdaccio proxy registry. - - ```bash - pnpm run registry - ``` - -3. Publish the SDK package to your proxy registry. - - ```bash - pnpm nx publish:local sdk - ``` - -4. Edit the respective `package.json` dependency for the SDK to use the version - that is published to Verdaccio. +2. If creating new packages: use pnpm and + [workspace protocol](https://pnpm.io/workspaces#workspace-protocol-workspace) + to link SDK in the new folder. ## Running commands diff --git a/cspell-config/cspell-misc.txt b/cspell-config/cspell-misc.txt index c6a7ce73..4890947e 100644 --- a/cspell-config/cspell-misc.txt +++ b/cspell-config/cspell-misc.txt @@ -8,7 +8,6 @@ nuxt Nuxt nuxtjs testid -verdaccio vueuse // examples/bank-demo diff --git a/docs/sdk/client-auth-server/README.md b/docs/sdk/client-auth-server/README.md index 6dcdfff3..1dcbf2fe 100644 --- a/docs/sdk/client-auth-server/README.md +++ b/docs/sdk/client-auth-server/README.md @@ -9,9 +9,9 @@ your application. It's built on top of [client SDK](../client/README.md) and ```ts import { zksync } from "viem/chains"; import { createConfig, connect } from "@wagmi/core"; -import { zksyncAccountConnector } from "zksync-sso/connector"; +import { zksyncSsoConnector } from "zksync-sso/connector"; -const ssoConnector = zksyncAccountConnector({ +const ssoConnector = zksyncSsoConnector({ // Optional session configuration session: { feeLimit: parseEther("0.1"), diff --git a/docs/verdaccio.md b/docs/verdaccio.md deleted file mode 100644 index 73a7e745..00000000 --- a/docs/verdaccio.md +++ /dev/null @@ -1,51 +0,0 @@ -# Verdaccio - -[Verdaccio](https://verdaccio.org/) - -Verdaccio is a local proxy registry that helps with publishing npm packages to a -non production or private environment. - -## Run Verdaccio via the monorepo - -Verdaccio is installed in this project from an NX plugin `@nx/js`, you do not -need to install the package globally. Open up a terminal within the monorepo -directory and run the following command. - -```bash -pnpm run registry -``` - -## How it works - -Verdaccio is a proxy that will intercept npm registry calls and determine if it -has a cached version of the package you're downloading or if it should allow it -through to the official registry. On the first download from the official -registry, it will take that package and cache it locally. - -All NPM/PNPM/Yarn commands will work as normal but calls through to a registry -will be managed via Verdaccio. - -When publishing a package, Verdaccio will instead take that package and set it -up locally within its own registry. You can access the dashboard for Verdaccio -and view packages at [http://localhost:4873/](http://localhost:4873/). - -## Troubleshooting - -### Keep Verdaccio running - -With the way Verdaccio is setup and how it proxies the NPM registry, it's -probably best practice to always keep Verdaccio running on your machine. How you -do that is up to you. - -The quickest and simplest way to run Verdaccio on your machine is open up a -separate terminal and run `pnpm verdaccio`. - -### Unable to access NPM registry when installing packages - -Check your Verdaccio and make sure it's running. Some configuration somewhere, -either in your global configuration for NPM registry URL, a project's `.npmrc` -or a `package.json` `publishConfig` might be pointing to the Verdaccio URL. -Without Verdaccio running it will not proxy to the official NPM registry. - -This monorepo project is setup with Verdaccio through NX. It has its own -configuration defined within `.verdaccio/config.yml`. diff --git a/examples/demo-app/pages/index.vue b/examples/demo-app/pages/index.vue index fd58fb7e..7a16c725 100644 --- a/examples/demo-app/pages/index.vue +++ b/examples/demo-app/pages/index.vue @@ -41,13 +41,13 @@