Skip to content

Commit

Permalink
introduce wallet connect (#713)
Browse files Browse the repository at this point in the history
* add back examples

* add back authServer.js

* add back json-rpc changes

* add back rpcserver

* add back utils

* add back agent exports

* add back ws-rpc-server

* add back auth-api

* add back level.js

* add back crypto randompin

* add back test for randomPin

* simplify request-uri

* make testharness setup a little more readable

* add pollWithTTL

* add abort to pollWithTTL

* add jsdoc to pollWithTTL

* WIP

* fix a couple of docs

* param style nit

* fix signing and migrate kms code to newer agent code

* use the word "claims" rather than payload

* format authServer and update code

* push up latest WIP

* remove dead code

* bump types/node

* cleanup

* fix eslint

* format test file

* format with eslint

* cleanup

* format eslint config

* Update authServer.js

* Update tsconfig.json

* check in wip

* add correct wallet uri

* comment

* updates

* cleanup

* cleanup

* add nearly finished latest wip

* cleanup. add walletUri.

* feedback

* feedback

* feedback

* refactor out nonce

* feedback

* feedback: add better docs for walletUri

* remove unnecessary clientUri

* feedback

* resolve merge conflict

* feedback: client_id should contain the did

* improve comment about walletconnectoptions

* feedback: unabstract nonce creation

* remove unused imports

* feedback: slim down queryparams

* merged lockfile

* clarify comment about the grants

* feedback: fail fast and let users catch errors

* feedback

* push up finalizations

* bump crypto

* examples

* bump sinon

* fix dependabot mess

* try to fix builds

* try to fix builds

* use v9 lockfile

* Revert "try to fix builds"

This reverts commit d63c468.

* Revert "try to fix builds"

This reverts commit 3a58665.

* Create flat-students-compare.md

* fix ci

* fix lockfile

* Revert "fix lockfile"

This reverts commit 775d15a.

* fix lockfile

* cleanup

* fix ci

* Delete authServer.js

* test ci

* fix build order

* fix cve

* fix eslint

* bump lockfile

* feedback

* use dwn server default port

* Update flat-students-compare.md

* Update docs-ci.yml

* Update flat-students-compare.md

* stub globalthis fetch

* Update tests-ci.yml

* fix regex

* cleanup

* cleanup

* add some patch tests

* cleanup some changes

* satisfy codecov patch

* fix codecov bot

* Update tests-ci.yml

* latest

* prettier fmt

* Update wallet-connect.html

* Update codecov.yml

* add wallet connect example. change to portableDid data structure and delegateDid naming.

* add connectedDid

* cleanup example

* cleanup

* Update wallet-connect.html

* add word wrap and viewport sizing

* remove conditional returns in buildOidcUrl

* timeout

* feedback

* Update oidc.ts

* Update connect.ts

* Update connect.ts

* only one did for selection

* feedback

* Update packages/crypto/tests/utils.spec.ts

Co-authored-by: Liran Cohen <[email protected]>

* Update packages/crypto/tests/utils.spec.ts

Co-authored-by: Liran Cohen <[email protected]>

* fix flakes

* Update connect.ts

* Update connect.ts

* run prettier and eslint

* remove corepack

* delegate did should use a did jwk

* client should use a did jwk

* better comments

* Update oidc.ts

* add comments

* Update oidc.ts

* cleanup comments

* add some coverage

* reorganize

* Update web5.spec.ts

* feedback: dont encrypt with the code challenge

* feedback disable code challenge

* clean out todo

* Update connect.spec.ts

* feedback didjwk

* cleanup crypto utils (#830)

* cleanup crypto utils

* changeset

* Update index.ts

* finish: delete package.json utils export

* add docs errors back

* disable rule until typedoc is bumped

* Revert "cleanup crypto utils (#830)"

This reverts commit fc234c3.

* renable typedoc

* Update docs-ci.yml

* update codeowners

* Update CODEOWNERS

---------

Co-authored-by: Liran Cohen <[email protected]>
  • Loading branch information
shamilovtim and LiranCohen authored Aug 13, 2024
1 parent 1fee7a2 commit 5ed8798
Show file tree
Hide file tree
Showing 35 changed files with 3,671 additions and 2,121 deletions.
14 changes: 14 additions & 0 deletions .changeset/flat-students-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@web5/agent": minor
"@web5/api": patch
"@web5/credentials": patch
"@web5/crypto": patch
"@web5/crypto-aws-kms": patch
"@web5/dids": patch
"@web5/identity-agent": patch
"@web5/proxy-agent": patch
"@web5/user-agent": patch
---

introduce initial web5 connect implementation
bump crypto
4 changes: 2 additions & 2 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
report_changed_scope_only: false
fail_on_warnings: true
fail_on_error: true
fail_on_warnings: false
fail_on_error: false
group_docs: true
entry_points: |
- file: packages/api/src/index.ts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
echo "DWN_SERVER_BACKGROUND_PROCESS=$!" >> $GITHUB_ENV
- name: Build tests for all packages
run: pnpm --recursive --stream --sequential build:tests:node
run: pnpm --recursive --stream build:tests:node

- name: Run tests for all packages
run: pnpm --recursive --stream exec c8 mocha -- --color --reporter mocha-junit-reporter --reporter-options mochaFile=./results.xml
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/tests-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- name: Run dwn-server (background)
run: |
node node_modules/@web5/dwn-server/dist/esm/src/main.js &
npx @web5/dwn-server &
echo "DWN_SERVER_BACKGROUND_PROCESS=$!" >> $GITHUB_ENV
- name: Build tests for all packages
Expand Down Expand Up @@ -106,12 +106,6 @@ jobs:
with:
cache: "true"

- name: Print Node.js, npm, & pnpm versions for debugging if needed
run: |
node -v
npm -v
pnpm -v
- name: Install dependencies
run: pnpm install --no-frozen-lockfile

Expand Down
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"npm.packageManager": "pnpm"
"npm.packageManager": "pnpm",
"editor.formatOnSave":true,
"eslint.useFlatConfig": true,
"eslint.lintTask.enable": true,
"eslint.workingDirectories": [{ "mode": "auto" }],
"eslint.format.enable": true,
"[javascript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" },
"[typescript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" },
}
22 changes: 11 additions & 11 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@

# These are owners who can approve folders under the root directory and other CICD and QoL directories.
# Should be the union list of all owners of sub-directories, optionally minus the default owners.
/* @csuwildcat @lirancohen @thehenrytsai @diehuxx @shamilovtim @nitro-neal
/.changeset @csuwildcat @lirancohen @thehenrytsai @diehuxx @shamilovtim @nitro-neal
/.codesandbox @csuwildcat @lirancohen @thehenrytsai @diehuxx @shamilovtim @nitro-neal
/.github @csuwildcat @lirancohen @thehenrytsai @diehuxx @shamilovtim @nitro-neal
/.vscode @csuwildcat @lirancohen @thehenrytsai @diehuxx @shamilovtim @nitro-neal
/scripts @csuwildcat @lirancohen @thehenrytsai @diehuxx @shamilovtim @nitro-neal
/* @csuwildcat @lirancohen @thehenrytsai @shamilovtim @nitro-neal
/.changeset @csuwildcat @lirancohen @thehenrytsai @shamilovtim @nitro-neal
/.codesandbox @csuwildcat @lirancohen @thehenrytsai @shamilovtim @nitro-neal
/.github @csuwildcat @lirancohen @thehenrytsai @shamilovtim @nitro-neal
/.vscode @csuwildcat @lirancohen @thehenrytsai @shamilovtim @nitro-neal
/scripts @csuwildcat @lirancohen @thehenrytsai @shamilovtim @nitro-neal

# These are owners of any file in the `common`, `crypto`, `crypto-aws-kms`, `dids`, and
# `credentials` packages and their sub-directories.
/packages/common @csuwildcat @diehuxx @thehenrytsai @nitro-neal
/packages/crypto @csuwildcat @diehuxx @thehenrytsai
/packages/crypto-aws-kms @csuwildcat @diehuxx @thehenrytsai
/packages/dids @csuwildcat @diehuxx @thehenrytsai @nitro-neal
/packages/credentials @csuwildcat @diehuxx @thehenrytsai @nitro-neal
/packages/common @csuwildcat @thehenrytsai @nitro-neal
/packages/crypto @csuwildcat @thehenrytsai @nitro-neal
/packages/crypto-aws-kms @csuwildcat @thehenrytsai @nitro-neal
/packages/dids @csuwildcat @thehenrytsai @nitro-neal
/packages/credentials @csuwildcat @thehenrytsai @nitro-neal

# These are owners of any file in the `agent`, `user-agent`, `proxy-agent`, `identity-agent`, and
# `api` packages and their sub-directories.
Expand Down
1 change: 0 additions & 1 deletion bin/corepack

This file was deleted.

3 changes: 2 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ component_management:
target: auto # auto compares coverage to the previous base commit
threshold: 5% # allows a 5% drop from the previous base commit coverage
- type: patch
target: 90 # every PR opened should strive for at least 90% coverage
target: 90

individual_components:
- component_id: package-agent
Expand Down Expand Up @@ -59,3 +59,4 @@ coverage:
patch:
default:
informational: true # Don't gate PRs based on Codecov passing thresholds
if_ci_failed: success
158 changes: 76 additions & 82 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -1,92 +1,86 @@
const eslint = require('@eslint/js');
const globals = require('globals');
const tsParser = require('@typescript-eslint/parser');
const tsPlugin = require('@typescript-eslint/eslint-plugin');
const mochaPlugin = require('eslint-plugin-mocha');
const eslint = require("@eslint/js");
const globals = require("globals");
const tsParser = require("@typescript-eslint/parser");
const tsPlugin = require("@typescript-eslint/eslint-plugin");
const mochaPlugin = require("eslint-plugin-mocha");

/** @type {import('eslint').ESLint.ConfigData} */
module.exports = [
eslint.configs.recommended,
mochaPlugin.configs.flat.recommended,
// tsPlugin.configs.flat.recommended, // @typescript-eslint v7.9.0 doesn't have a recommended config yet, v8 alpha build has it, so should be available soon.
{
// extends : ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: { modules: true },
ecmaVersion: '2022',
project: [
'tests/tsconfig.json'// this is the config that includes both `src` and `tests` directories
]
// extends : ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: { modules: true },
ecmaVersion: "2022",
project: [
"tests/tsconfig.json", // this is the config that includes both `src` and `tests` directories
],
},
globals: {
...globals.node,
...globals.es2021,
...globals.browser,
console: "readonly",
},
},
plugins: {
"@typescript-eslint": tsPlugin,
mocha: mochaPlugin,
},
files: ["**/*.ts"],
// IMPORTANT and confusing: `ignores` only exclude files from the `files` setting.
// To exclude *.js files entirely, you need to have a separate config object altogether. (See another `ignores` below.)
ignores: ["**/*.d.ts"],
rules: {
"no-undef": "off",
"no-redeclare": "off",
"key-spacing": [
"error",
{
align: {
afterColon: true,
beforeColon: true,
on: "colon",
},
},
],
quotes: ["error", "single", { allowTemplateLiterals: true }],
semi: ["error", "always"],
indent: ["error", 2, { SwitchCase: 1 }],
"no-unused-vars": "off",
"prefer-const": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
vars: "all",
args: "after-used",
ignoreRestSiblings: true,
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"no-dupe-class-members": "off",
"no-trailing-spaces": ["error"],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": "off",
// TODO: Revisit new default mocha rules that were disabled in #579 - https://github.com/TBD54566975/web5-js/issues/580
"mocha/no-exclusive-tests": "warn",
"mocha/no-setup-in-describe": "off",
"mocha/no-mocha-arrows": "off",
"mocha/max-top-level-suites": "off",
"mocha/no-identical-title": "off",
"mocha/no-pending-tests": "off",
"mocha/no-skipped-tests": "off",
"mocha/no-sibling-hooks": "off",
},
globals: {
...globals.node,
...globals.es2021,
...globals.browser
}
},
plugins: {
'@typescript-eslint': tsPlugin,
'mocha': mochaPlugin
{
ignores: ["**/*.js", "**/*.cjs", "**/*.mjs"],
},
files: [
'**/*.ts'
],
// IMPORTANT and confusing: `ignores` only exclude files from the `files` setting.
// To exclude *.js files entirely, you need to have a separate config object altogether. (See another `ignores` below.)
ignores: [
'**/*.d.ts',
],
rules: {
'key-spacing': [
'error',
{
'align': {
'afterColon' : true,
'beforeColon' : true,
'on' : 'colon'
}
}
],
'quotes': [
'error',
'single',
{ 'allowTemplateLiterals': true }
],
'semi' : ['error', 'always'],
'indent' : ['error', 2, { 'SwitchCase': 1 }],
'no-unused-vars' : 'off',
'prefer-const' : 'off',
'@typescript-eslint/no-unused-vars' : [
'error',
{
'vars' : 'all',
'args' : 'after-used',
'ignoreRestSiblings' : true,
'argsIgnorePattern' : '^_',
'varsIgnorePattern' : '^_'
}
],
'no-dupe-class-members' : 'off',
'no-trailing-spaces' : ['error'],
'@typescript-eslint/no-explicit-any' : 'off',
'@typescript-eslint/no-non-null-assertion' : 'off',
'@typescript-eslint/ban-ts-comment' : 'off',
// TODO: Revisit new default mocha rules that were disabled in #579 - https://github.com/TBD54566975/web5-js/issues/580
'mocha/no-exclusive-tests' : 'warn',
'mocha/no-setup-in-describe' : 'off',
'mocha/no-mocha-arrows' : 'off',
'mocha/max-top-level-suites' : 'off',
'mocha/no-identical-title' : 'off',
'mocha/no-pending-tests' : 'off',
'mocha/no-skipped-tests' : 'off',
'mocha/no-sibling-hooks' : 'off',
}
}, {
ignores: [
'**/*.js',
'**/*.cjs',
'**/*.mjs',
],
}];
];
Loading

0 comments on commit 5ed8798

Please sign in to comment.