You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 9, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+16-10Lines changed: 16 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,19 +54,19 @@ console.log(profile)
54
54
3Box allows applications to create, read, update, and delete public and private data stored in a user's 3Box. To enable this functionality, applications must first authenticate the user's 3Box by calling the `auth` method. This method prompts the user to authenticate (sign-in) to your dapp and returns a promise with a threeBox instance. You can only update (set, get, remove) data for users that have authenticated to and are currently interacting with your dapp. Below `ethereumProvider` refers to the object that you would get from `web3.currentProvider`, or `window.ethereum`.
55
55
56
56
#### 1. Create a 3Box instance
57
-
To create a 3Box session you call the `create` method. This creates an instance of the Box class which can be used to openThreads and authenticate the user in any order. In order to create a 3Box session a `provider` needs to be passed. This can be an `ethereum provider` (from `web3.currentProvider`, or `window.ethereum`) or a `3ID Provider` (from [IdentityWallet](https://github.com/3box/identity-wallet-js)). It is now suggested to use the 3ID Connect Provider, which is a 3ID provider that wraps available `ethereum providers`and will manage/permission 3ID keys, authentication and blockchain account links inside an iframe. This will become the default soon and will overide passed `ethereum providers`. You can get the 3ID Connect Provider as follows.
57
+
To create a 3Box session you call the `create` method. This creates an instance of the Box class which can be used to openThreads and authenticate the user in any order. This is best to call on page load, so it can begin initializing and connecting services like IPFS in background.
58
58
59
59
```js
60
-
constprovider=awaitBox.get3idConnectProvider()
61
-
constbox=awaitBox.create(provider)
60
+
constbox=awaitBox.create()
62
61
```
63
62
64
63
#### 2. Authenticate user
65
-
Calling the `auth` method will authenticate the user. If you want to authenticate the user to one or multiple spaces you can specify this here. If when you created the 3Box session you used an ethereum provider you need to pass an ethereum address to the `auth` method. If the user does not have an existing 3Box account, this method will automatically create one for them in the background.
64
+
Calling the `auth` method will authenticate the user. If you want to authenticate the user to one or multiple spaces you can specify this here. A provider needs to be passed, this can be an `ethereum provider` (from `web3.currentProvider`, or `window.ethereum`) or a `3ID Provider` (from [IdentityWallet](https://github.com/3box/identity-wallet-js)). If using an ethereum provider you need to pass an ethereum address to the `auth` method as well. If the user does not have an existing 3Box account, this method will automatically create one for them in the background.
65
+
66
66
```js
67
67
constaddress='0x12345abcde'
68
68
constspaces= ['myDapp']
69
-
awaitbox.auth(spaces, { address })
69
+
awaitbox.auth(spaces, { address, provider })
70
70
```
71
71
72
72
#### 3. Sync user's available 3Box data from the network
| opts.address | <code>String</code> | An ethereum address |
446
+
| opts.provider | <code>String</code> | A 3ID provider, or ethereum provider |
443
447
| opts.consentCallback | <code>function</code> | A function that will be called when the user has consented to opening the box |
444
448
445
449
<a name="Box+openSpace"></a>
@@ -608,14 +612,15 @@ Creates an instance of 3Box
608
612
| opts.pinningNode | <code>String</code> | A string with an ipfs multi-address to a 3box pinning node |
609
613
| opts.ipfs | <code>Object</code> | A js-ipfs ipfs object |
610
614
| opts.addressServer | <code>String</code> | URL of the Address Server |
615
+
| opts.ghostPinbot | <code>String</code> | MultiAddress of a Ghost Pinbot node |
616
+
| opts.supportCheck | <code>String</code> | Gives browser alert if 3boxjs/ipfs not supported in browser env, defaults to true. You can also set to false to implement your own alert and call Box.support to check if supported. |
Copy file name to clipboardExpand all lines: RELEASE-NOTES.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,23 @@
1
1
# Release Notes
2
2
3
+
## v1.20.0 - 2020-06-15
4
+
This release brings new IPFS features/performance in 0.44.0, and decreases bundled size by 1mb. Based on feedback from our first 3ID-Connect release, this brings a new more lightweight version and refactor. With these changes you need to pass a provider (as before) when creating or authenticating. The function get3idConnectProvider() is no longer available, when passing a provider we create a 3ID-Connect provider in the background. The recommended way to initialize a session is now as follows.
0 commit comments