Skip to content
This repository was archived by the owner on Aug 9, 2021. It is now read-only.

Commit 3aff199

Browse files
committed
fix: destructured jwt, ordering payload
1 parent aff58ff commit 3aff199

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"homepage": "https://github.com/3box/3box-js#readme",
4646
"dependencies": {
47-
"3box-orbitdb-plugins": "^2.0.0",
47+
"3box-orbitdb-plugins": "^2.1.0",
4848
"3id-blockchain-utils": "^0.4.0",
4949
"3id-connect": "^0.1.0",
5050
"3id-resolver": "^1.0.0",

readme-template.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,10 @@ console.log(profile)
5454
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`.
5555

5656
#### 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. This is best to call on page load, so it can begin intializing and connecting services like IPFS in background.
58-
59-
60-
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)).
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.
6158

6259
```js
63-
const box = await Box.create(provider)
60+
const box = await Box.create()
6461
```
6562

6663
#### 2. Authenticate user

src/3id/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ class ThreeId {
153153
doc.addCustomProperty('space', spaceName)
154154
doc.addCustomProperty('root', this.DID)
155155
const payload = {
156+
iat: null,
156157
subSigningKey: pubkeys.signingKey,
157158
subEncryptionKey: pubkeys.asymEncryptionKey,
158-
space: spaceName,
159-
iat: null
159+
space: spaceName
160160
}
161161
const signature = (await this.signJWT(payload, { use3ID: true })).split('.')[2]
162162
doc.addCustomProperty('proof', { alg: 'ES256K', signature })

0 commit comments

Comments
 (0)