Skip to content

Commit

Permalink
feat: use new faster auth function (#483)
Browse files Browse the repository at this point in the history
* update `@web3-storage/access` dep to make the minimum version the one
that has this new auth function
* use new polling-based auth function - auth feels muuuuuch faster in
local testing
  • Loading branch information
travis authored Mar 30, 2023
1 parent b9445e3 commit 372f249
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/keyring-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"dependencies": {
"@ucanto/interface": "^6.2.0",
"@ucanto/principal": "^5.1.0",
"@web3-storage/access": "^11.0.0"
"@web3-storage/access": "^11.2.0"
},
"eslintConfig": {
"extends": [
Expand Down
2 changes: 1 addition & 1 deletion packages/react-keyring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@testing-library/user-event": "^14.4.3",
"@ucanto/interface": "^6.2.0",
"@ucanto/principal": "^5.1.0",
"@web3-storage/access": "^11.0.0"
"@web3-storage/access": "^11.2.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/react-keyring/src/providers/Keyring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
} from '@w3ui/keyring-core'
import type { Agent } from '@web3-storage/access'
import type { Abilities } from '@web3-storage/access/types'
import { authorizeWithSocket } from '@web3-storage/access/agent'
import { authorizeWaitAndClaim } from '@web3-storage/access/agent'
import type {
Capability,
Delegation,
Expand Down Expand Up @@ -100,7 +100,7 @@ export function KeyringProvider ({
setRegisterAbortController(controller)

try {
await authorizeWithSocket(agent, email, { signal: controller.signal })
await authorizeWaitAndClaim(agent, email, { signal: controller.signal })
// TODO is there other state that needs to be initialized?
setAccount(email)
const newSpaces = getSpaces(agent)
Expand Down
2 changes: 1 addition & 1 deletion packages/solid-keyring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@ucanto/interface": "^6.2.0",
"@ucanto/principal": "^5.1.0",
"@w3ui/keyring-core": "workspace:^",
"@web3-storage/access": "^11.0.0"
"@web3-storage/access": "^11.2.0"
},
"peerDependencies": {
"solid-js": "^1.5.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/solid-keyring/src/providers/Keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
} from '@w3ui/keyring-core'
import type { Agent } from '@web3-storage/access'
import type { Abilities } from '@web3-storage/access/types'
import { authorizeWithSocket } from '@web3-storage/access/agent'
import { authorizeWaitAndClaim } from '@web3-storage/access/agent'

import type { Delegation, Capability, DID, Principal } from '@ucanto/interface'

Expand Down Expand Up @@ -95,7 +95,7 @@ export const KeyringProvider: ParentComponent<KeyringProviderProps> = (
setRegisterAbortController(controller)

try {
await authorizeWithSocket(agent, email, { signal: controller.signal })
await authorizeWaitAndClaim(agent, email, { signal: controller.signal })
// TODO is there other state that needs to be initialized?
setState('account', email)
const newSpaces = getSpaces(agent)
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-keyring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"devDependencies": {
"@ucanto/interface": "^6.2.0",
"@ucanto/principal": "^5.1.0",
"@web3-storage/access": "^11.0.0"
"@web3-storage/access": "^11.2.0"
},
"eslintConfig": {
"extends": [
Expand Down
33 changes: 20 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 372f249

Please sign in to comment.