2.2.4 • Published 15 days ago

@did-connect/react v2.2.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
15 days ago

@did-connect/react

Client side library to work with DID Connect by ArcBlock.

Usage

yarn add @did-connect/react

Then:

import axios from 'axios';

// import each module individually
import DidConnect from '@did-connect/react/Connect';
import DidButton from '@did-connect/react/Button';
import { SessionProvider, SessionConsumer } from '@did-connect/react/Session';

// or use ES6 named imports
import {
  Connect as DidConnect,
  Button as DidButton,
  Session,
} from '@did-connect/react';

DidConnect

<DidConnect
  popup
  open={open}
  action="login"
  checkFn={axios.get}
  onClose={() => handleOnClose()}
  onSuccess={() => (window.location.href = '/profile')}
  messages={{
    title: 'login',
    scan: 'Scan QR code with DID Wallet',
    confirm: 'Confirm login on your DID Wallet',
    success: 'You have successfully signed in!',
  }}
/>

Note: DidConnect component has a built-in instance of WebWalletSWKeeper that embeds a wallet iframe in the DOM to keep the service worker of the web wallet alive. When the DidConnect component is destroyed, WebWalletSWKeeper will also be destroyed, so avoid using it like the following:

{open && (
  <DidConnect
    popup
    action="login"
    ...
  />
)}

display DidConnect in popup

const [open, setOpen] = React.useState(false);
const handleOnClose = () => {
  // ...
  setOpen(false);
};

...

<button type="button" onClick={() => setOpen(true)}>
  Open DidConnect
</button>

<DidConnect
  popup
  open={open}
  action="login"
  checkFn={axios.get}
  onClose={() => handleOnClose()}
  onSuccess={() => (window.location.href = '/profile')}
  messages={{
    title: 'login',
    scan: 'Scan QR code with DID Wallet',
    confirm: 'Confirm login on your DID Wallet',
    success: 'You have successfully signed in!',
  }}
  webWalletUrl={webWalletUrl}
/>

DidButton

<ConnectButton size="large" />
<ConnectButton size="medium" />
<ConnectButton size="small" />
<ConnectButton>Custom Text</ConnectButton>
2.2.4

15 days ago

2.2.3

18 days ago

2.2.2

19 days ago

2.2.1

6 months ago

2.2.0

10 months ago

2.1.58

11 months ago

2.1.59

11 months ago

2.1.57

12 months ago

2.1.54

12 months ago

2.1.52

1 year ago

2.1.53

1 year ago

2.1.51

1 year ago

2.1.49

1 year ago

2.1.50

1 year ago

2.1.47

1 year ago

2.1.45

1 year ago

2.1.46

1 year ago

2.1.43

1 year ago

2.1.44

1 year ago

2.1.41

1 year ago

2.1.42

1 year ago

2.1.40

1 year ago

2.1.38

1 year ago

2.1.39

1 year ago

2.1.36

1 year ago

2.1.37

1 year ago

2.1.35

1 year ago

2.1.34

1 year ago

2.1.33

1 year ago

2.1.28

1 year ago

2.1.29

1 year ago

2.1.32

1 year ago

2.1.30

1 year ago

2.1.31

1 year ago

2.1.25

1 year ago

2.1.26

1 year ago

2.1.23

2 years ago

2.1.24

2 years ago

2.1.21

2 years ago

2.1.22

2 years ago

2.1.18

2 years ago

2.1.19

2 years ago

2.1.20

2 years ago

2.1.16

2 years ago

2.1.14

2 years ago

2.1.15

2 years ago

2.1.12

2 years ago

2.1.13

2 years ago

2.1.11

2 years ago

2.1.10

2 years ago

2.1.9

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.1.6

2 years ago

2.1.5

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.2

2 years ago

2.1.0

2 years ago

2.0.18

2 years ago

2.0.17

2 years ago

2.0.16

2 years ago

2.0.15

2 years ago

2.0.14

2 years ago

2.0.13

2 years ago

2.0.12

2 years ago

2.0.11

2 years ago

2.0.10

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago