Skip to content

Commit

Permalink
Merge pull request #12 from ceramicnetwork/docusaurus-v3
Browse files Browse the repository at this point in the history
Update to Docusaurus v3
  • Loading branch information
JustinaPetr authored Nov 14, 2023
2 parents 9ceec72 + a679b0c commit f85b4f1
Show file tree
Hide file tree
Showing 8 changed files with 5,863 additions and 2,445 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import { ComposeClient } from '@composedb/client'

//... Reference above and `@composedb` docs for additional configuration here

const client = new ComposeClient({ceramic, definition})
const client = new ComposeClient({ ceramic, definition })
const resources = client.resources
const session = await DIDSession.authorize(authMethod, { resources })
client.setDID(session.did)
Expand Down Expand Up @@ -153,17 +153,17 @@ if (session.isExpired) {

// continue to write
```

## Upgrading from `[email protected]` to `[email protected]`

AuthProviders change to AuthMethod interfaces. Similarly you can import the auth libraries you need. How you configure and manage
## Upgrading from `[email protected]` to `[email protected]`

AuthProviders change to AuthMethod interfaces. Similarly you can import the auth libraries you need. How you configure and manage
these AuthMethods may differ, but each will return an AuthMethod function to be used with did-session.

```ts
// Before with v0.x.x
//...
import { EthereumAuthProvider } from '@ceramicnetwork/blockchain-utils-linking'

const ethProvider = // import/get your web3 eth provider
const addresses = await ethProvider.enable()
const authProvider = new EthereumAuthProvider(ethProvider, addresses[0])
Expand All @@ -173,7 +173,7 @@ const did = await session.authorize()
// Now [email protected]
...
import { EthereumWebAuth, getAccountId } from '@didtools/pkh-ethereum'

const ethProvider = // import/get your web3 eth provider
const addresses = await ethProvider.enable()
const accountId = await getAccountId(ethProvider, addresses[0])
Expand All @@ -197,12 +197,12 @@ const did = session.did
```

Requesting resources are required now when authorizing, before wildcard (access all) was the default. You can continue to use
wildcard by passing the following * below. Wildcard is typically only used with `@glazed` libraries and/or tile documents and
it is best to switch over when possible, as the wildcard option may be * deprecated in the future. When using with
wildcard by passing the following _ below. Wildcard is typically only used with `@glazed` libraries and/or tile documents and
it is best to switch over when possible, as the wildcard option may be _ deprecated in the future. When using with
composites/models you should request the minimum needed resources instead.

```ts
const session = await DIDSession.authorize(authMethod, { resources: [`ceramic://*`]})
const session = await DIDSession.authorize(authMethod, { resources: [`ceramic://*`] })
const did = session.did
```

Expand All @@ -216,8 +216,8 @@ const did = session.did

#### Parameters

| Name | Type |
| :------ | :------ |
| Name | Type |
| :------- | :-------------- |
| `params` | `SessionParams` |

## Accessors
Expand All @@ -232,7 +232,7 @@ Get the list of resources a session is authorized for

`string`[]

___
---

### cacao

Expand All @@ -244,7 +244,7 @@ Get the session CACAO

`Cacao`

___
---

### did

Expand All @@ -256,7 +256,7 @@ Get DID instance, if authorized

`DID`

___
---

### expireInSecs

Expand All @@ -268,7 +268,7 @@ Number of seconds until a session expires

`number`

___
---

### hasSession

Expand All @@ -278,7 +278,7 @@ ___

`boolean`

___
---

### id

Expand All @@ -290,7 +290,7 @@ DID string associated to the session instance. session.id == session.getDID().pa

`string`

___
---

### isExpired

Expand All @@ -312,15 +312,15 @@ Determine if session is available and optionally if authorized for given resourc

#### Parameters

| Name | Type |
| :------ | :------ |
| Name | Type |
| :----------- | :--------- |
| `resources?` | `string`[] |

#### Returns

`boolean`

___
---

### serialize

Expand All @@ -332,56 +332,56 @@ Serialize session into string, can store and initalize the same session again wh

`string`

___
---

### authorize

`Static` **authorize**(`authMethod`, `authOpts?`): `Promise`<`DIDSession`\>
`Static` **authorize**(`authMethod`, `authOpts?`): `Promise`\<`DIDSession`\>

Request authorization for session

#### Parameters

| Name | Type |
| :------ | :------ |
| Name | Type |
| :----------- | :----------- |
| `authMethod` | `AuthMethod` |
| `authOpts` | `AuthOpts` |
| `authOpts` | `AuthOpts` |

#### Returns

`Promise`<`DIDSession`>
`Promise`\<`DIDSession`\>

___
---

### fromSession

`Static` **fromSession**(`session`): `Promise`<`DIDSession`\>
`Static` **fromSession**(`session`): `Promise`\<`DIDSession`\>

Initialize a session from a serialized session string

#### Parameters

| Name | Type |
| :------ | :------ |
| Name | Type |
| :-------- | :------- |
| `session` | `string` |

#### Returns

`Promise`<`DIDSession`\>
`Promise`\<`DIDSession`\>

___
---

### initDID

`Static` **initDID**(`didKey`, `cacao`): `Promise`<`DID`\>
`Static` **initDID**(`didKey`, `cacao`): `Promise`\<`DID`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `didKey` | `DID` |
| `cacao` | `Cacao` |
| Name | Type |
| :------- | :------ |
| `didKey` | `DID` |
| `cacao` | `Cacao` |

#### Returns

`Promise`<`DID`\>
`Promise`\<`DID`\>
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ The Ceramic command line interface provides an easy way to start a JS Ceramic no

---

Installing the CLI requires a console, [Node.js](https://nodejs.org/en/){:target="\_blank"} v16, and [npm](https://www.npmjs.com/get-npm){:target="\_blank"} v6. Make sure to have these installed on your machine.
Installing the CLI requires a console, [Node.js](https://nodejs.org/en/) v16, and [npm](https://www.npmjs.com/get-npm) v6. Make sure to have these installed on your machine.

:::caution

While npm v7 is not officially supported, you may still be able to get it to work. You will need to install the `node-pre-gyp` package globally. This is required until `node-webrtc` which IPFS depends on [is upgraded](https://github.com/node-webrtc/node-webrtc/pull/694){:target="_blank"}.
While npm v7 is not officially supported, you may still be able to get it to work. You will need to install the `node-pre-gyp` package globally. This is required until `node-webrtc` which IPFS depends on [is upgraded](https://github.com/node-webrtc/node-webrtc/pull/694).



npm install -g node-pre-gyp

:::


## Installation and usage

---
Expand Down Expand Up @@ -50,4 +49,4 @@ ceramic daemon

```bash
ceramic config set ceramicHost 'https://yourceramicnode.com'
```
```
Loading

0 comments on commit f85b4f1

Please sign in to comment.