Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/coupon
Browse files Browse the repository at this point in the history
  • Loading branch information
Gozala committed Nov 15, 2023
2 parents d9c66c5 + a6590fe commit 5b470b3
Show file tree
Hide file tree
Showing 18 changed files with 217 additions and 64 deletions.
12 changes: 6 additions & 6 deletions .github/release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"packages/access-client": "17.0.0",
"packages/filecoin-api": "4.1.0",
"packages/filecoin-client": "3.1.0",
"packages/capabilities": "11.4.0",
"packages/upload-api": "7.3.1",
"packages/access-client": "17.1.0",
"packages/filecoin-api": "4.1.1",
"packages/filecoin-client": "3.1.1",
"packages/capabilities": "11.4.1",
"packages/upload-api": "7.3.2",
"packages/upload-client": "12.0.0",
"packages/w3up-client": "10.2.0",
"packages/w3up-client": "10.3.0",
"packages/did-mailto": "2.0.2"
}
17 changes: 5 additions & 12 deletions readme.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# w3up UCAN Protocol
# Contributing

Implementation of the w3up UCAN protocols.
Join in. All welcome! web3.storage is open-source. The code is dual-licensed under [MIT + Apache 2.0](license.md)

## Contributing

Feel free to join in. All welcome. [Open an issue](https://github.com/web3-storage/w3-protocol/issues/new)!
This project uses node v18 and `pnpm`. It's a monorepo that use [pnpm workspaces](https://pnpm.io/workspaces) to handle resolving dependencies between the local `packages/*` folders.

If you're opening a pull request, please see the [guidelines](#how-should-i-write-my-commits) on structuring your commit messages so that your PR will be compatible with our [release process](#release-process).

### Setup a development environment
## Setup a development environment

We use `pnpm` in this project and commit the `pnpm-lock.yaml` file.

Expand Down Expand Up @@ -45,9 +43,7 @@ Add these lines to your vscode workspace settings at `.vscode/settings.json`

## Release Process

[Release Please](https://github.com/googleapis/release-please) automates CHANGELOG generation, the creation of GitHub releases,
and version bumps for our packages. Release Please does so by parsing your
git history, looking for [Conventional Commit messages](https://www.conventionalcommits.org/),
[Release Please](https://github.com/googleapis/release-please) automates CHANGELOG generation, the creation of GitHub releases, and version bumps for our packages. Release Please does so by parsing your git history, looking for [Conventional Commit messages](https://www.conventionalcommits.org/),
and creating release PRs.

### What's a Release PR?
Expand All @@ -72,6 +68,3 @@ The most important prefixes you should have in mind are:
- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change
(indicated by the `!`) and will result in a SemVer major.

## License

Dual-licensed under [MIT + Apache 2.0](license.md)
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# `w3up`

This repo implements the web3.storage UCAN protocol [specifications](https://github.com/web3-storage/specs).

It's the core of the web3.storage server and client implementations.

## Usage

Store your files with web3.storage and retrieve them via their unique Content ID. Our tools make it simple to hash your content locally, so you can verify the service only ever stores the exact bytes you asked us to. Pick the method of using web3.storage that works for you!

### Website

Visit https://console.web3.storage and upload right from the website.

Under the hood it uses the web3.storage client that we publish to npm to chunk and hash your files to calculate the root IPFS CID **in your browser** before sending them to https://up.web3.storage.

Once uploaded you can fetch your data from any IPFS gateway via [`https://w3s.link/ipfs/<root cid>`](https://w3s.link/ipfs/bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy)

### JS Client

Add the [`@web3-storage/w3up-client`](https://www.npmjs.com/package/@web3-storage/w3up-client) module into your project, authorize the agent to act on your behalf, create and register a Space, and start uploading files from node.js or the browser.

**node.js**
```js
import { getFilesFromPaths } from 'files-from-path'
import { create } from '@web3-storage/w3up-client'

// authorize your local agent to act on your behalf
const client = await create()
await client.authorize('you@example.org')

// create a Space, a decentralized bucket for your files
const space = await client.createSpace('my-awesome-space')
await client.setCurrentSpace(space.did())

// lets go!
const files = await getFilesFromPaths(process.env.PATH_TO_ADD)
const cid = await client.uploadDirectory(files)

console.log(`Space DID: ${space.did()}`)
console.log(`IPFS CID: ${cid}`)
console.log(`Gateway URL: https://w3s.link/ipfs/${cid}`)
```

See https://web3.storage/docs/w3up-client for a guide to using the js client for the first time.

### Command Line

Install [`@web3-storage/w3cli`](https://github.com/web3-storage/w3cli#readme) globally, authorize it to act on your behalf, create a space and upload your files. It calculates the root CID for your files locally before sending them to web3.storage.

**shell**
```shell
# install from npm. don't forget -g
$ npm install -g @web3-storage/w3cli

# verify your email
$ w3 authorize alice@example.com

# create a Space, a DID namespace for your files... like a bucket.
$ w3 space create Documents

# lets go!
$ w3 up ~/Pictures/ayy-lamo.jpg
⁂ Stored 1 file
⁂ https://w3s.link/ipfs/bafybeid6gpbsqkpfrsx6b6ywrt24je4xqe4eo4y2wldisl6sk7byny5uky
```

Run `w3 --help` or have a look at https://github.com/web3-storage/w3cli to find out everything it can do.

## Contributing

All welcome! web3.storage is open-source. See the [contributing guide](./CONTRIBUTING.md)

This project uses node v18 and `pnpm`. It's a monorepo that uses [pnpm workspaces](https://pnpm.io/workspaces) to handle resolving dependencies between the local [`packages`](https://github.com/web3-storage/w3up/tree/main/packages)

## License

Dual-licensed under [MIT + Apache 2.0](license.md)
7 changes: 7 additions & 0 deletions packages/access-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [17.1.0](https://github.com/web3-storage/w3up/compare/access-v17.0.0...access-v17.1.0) (2023-11-14)


### Features

* w3up client login ([#1120](https://github.com/web3-storage/w3up/issues/1120)) ([8279bf6](https://github.com/web3-storage/w3up/commit/8279bf6371182709b46e83e5ac86d89ed1f292e8))

## [17.0.0](https://github.com/web3-storage/w3up/compare/access-v16.4.0...access-v17.0.0) (2023-11-09)


Expand Down
4 changes: 2 additions & 2 deletions packages/access-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-storage/access",
"version": "17.0.0",
"version": "17.1.0",
"description": "w3access client",
"homepage": "https://github.com/web3-storage/w3-protocol/tree/main/packages/access-client",
"repository": {
Expand Down Expand Up @@ -100,7 +100,7 @@
"@ipld/car": "^5.1.1",
"@ipld/dag-ucan": "^3.4.0",
"@ucanto/client": "^9.0.0",
"@ucanto/core": "^9.0.0",
"@ucanto/core": "^9.0.1",
"@ucanto/interface": "^9.0.0",
"@ucanto/principal": "^9.0.0",
"@ucanto/transport": "^9.0.0",
Expand Down
41 changes: 41 additions & 0 deletions packages/access-client/src/space.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,47 @@ class OwnedSpace {
}

/**
* Saves account in the agent store so it can be accessed across sessions.
*
* @param {object} input
* @param {API.Agent} [input.agent]
* @returns {Promise<API.Result<API.Unit, Error>>}
*/
async save({ agent = this.model.agent } = {}) {
if (!agent) {
<<<<<<< HEAD
return fail('Please provide an agent to save the space into')
=======
return {
error: new Error('Please provide an agent to save the space into'),
}
>>>>>>> origin/main
}
const proof = await createAuthorization(this, { agent })
await agent.importSpaceFromDelegation(proof)
agent.setCurrentSpace(this.did())
return { ok: {} }
}
/**
<<<<<<< HEAD
* @param {Authorization} authorization
* @param {object} options
* @param {API.Agent} [options.agent]
*/
provision({ proofs }, { agent = this.model.agent } = {}) {
if (!agent) {
return fail('Please provide an agent to save the space into')
}

return provision(this, { proofs, agent })
}

/**
=======
>>>>>>> origin/main
* Creates a (UCAN) delegation that gives full access to the space to the
* specified `account`. At the moment we only allow `did:mailto` principal
* to be used as an `account`.
Expand Down
7 changes: 7 additions & 0 deletions packages/capabilities/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [11.4.1](https://github.com/web3-storage/w3up/compare/capabilities-v11.4.0...capabilities-v11.4.1) (2023-11-15)


### Bug Fixes

* upgrade ucanto core ([#1127](https://github.com/web3-storage/w3up/issues/1127)) ([5ce4d22](https://github.com/web3-storage/w3up/commit/5ce4d2292d7e980da4a2ea0f1583f608a81157d2))

## [11.4.0](https://github.com/web3-storage/w3up/compare/capabilities-v11.3.1...capabilities-v11.4.0) (2023-11-09)


Expand Down
4 changes: 2 additions & 2 deletions packages/capabilities/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-storage/capabilities",
"version": "11.4.0",
"version": "11.4.1",
"description": "Capabilities provided by web3.storage",
"homepage": "https://github.com/web3-storage/w3protocol/tree/main/packages/capabilities",
"repository": {
Expand Down Expand Up @@ -83,7 +83,7 @@
"dist/src/**/*.d.ts.map"
],
"dependencies": {
"@ucanto/core": "^9.0.0",
"@ucanto/core": "^9.0.1",
"@ucanto/interface": "^9.0.0",
"@ucanto/principal": "^9.0.0",
"@ucanto/transport": "^9.0.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/filecoin-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [4.1.1](https://github.com/web3-storage/w3up/compare/filecoin-api-v4.1.0...filecoin-api-v4.1.1) (2023-11-15)


### Bug Fixes

* upgrade ucanto core ([#1127](https://github.com/web3-storage/w3up/issues/1127)) ([5ce4d22](https://github.com/web3-storage/w3up/commit/5ce4d2292d7e980da4a2ea0f1583f608a81157d2))

## [4.1.0](https://github.com/web3-storage/w3up/compare/filecoin-api-v4.0.6...filecoin-api-v4.1.0) (2023-11-08)


Expand Down
4 changes: 2 additions & 2 deletions packages/filecoin-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-storage/filecoin-api",
"version": "4.1.0",
"version": "4.1.1",
"type": "module",
"main": "./src/lib.js",
"files": [
Expand Down Expand Up @@ -148,7 +148,7 @@
"dependencies": {
"@ipld/dag-ucan": "^3.4.0",
"@ucanto/client": "^9.0.0",
"@ucanto/core": "^9.0.0",
"@ucanto/core": "^9.0.1",
"@ucanto/interface": "^9.0.0",
"@ucanto/server": "^9.0.1",
"@ucanto/transport": "^9.0.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/filecoin-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [3.1.1](https://github.com/web3-storage/w3up/compare/filecoin-client-v3.1.0...filecoin-client-v3.1.1) (2023-11-15)


### Bug Fixes

* upgrade ucanto core ([#1127](https://github.com/web3-storage/w3up/issues/1127)) ([5ce4d22](https://github.com/web3-storage/w3up/commit/5ce4d2292d7e980da4a2ea0f1583f608a81157d2))

## [3.1.0](https://github.com/web3-storage/w3up/compare/filecoin-client-v3.0.2...filecoin-client-v3.1.0) (2023-11-08)


Expand Down
4 changes: 2 additions & 2 deletions packages/filecoin-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-storage/filecoin-client",
"version": "3.1.0",
"version": "3.1.1",
"description": "The w3filecoin client for web3.storage",
"homepage": "https://github.com/web3-storage/w3up/tree/main/packages/filecoin-client",
"repository": {
Expand Down Expand Up @@ -55,7 +55,7 @@
"dependencies": {
"@ipld/dag-ucan": "^3.4.0",
"@ucanto/client": "^9.0.0",
"@ucanto/core": "^9.0.0",
"@ucanto/core": "^9.0.1",
"@ucanto/interface": "^9.0.0",
"@ucanto/transport": "^9.0.0",
"@web3-storage/capabilities": "workspace:^"
Expand Down
7 changes: 7 additions & 0 deletions packages/upload-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [7.3.2](https://github.com/web3-storage/w3up/compare/upload-api-v7.3.1...upload-api-v7.3.2) (2023-11-15)


### Bug Fixes

* upgrade ucanto core ([#1127](https://github.com/web3-storage/w3up/issues/1127)) ([5ce4d22](https://github.com/web3-storage/w3up/commit/5ce4d2292d7e980da4a2ea0f1583f608a81157d2))

## [7.3.1](https://github.com/web3-storage/w3up/compare/upload-api-v7.3.0...upload-api-v7.3.1) (2023-11-09)


Expand Down
4 changes: 2 additions & 2 deletions packages/upload-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-storage/upload-api",
"version": "7.3.1",
"version": "7.3.2",
"type": "module",
"main": "./src/lib.js",
"files": [
Expand Down Expand Up @@ -125,7 +125,7 @@
"@ipld/car": "^5.1.1",
"@ipld/dag-ucan": "^3.4.0",
"@types/mocha": "^10.0.1",
"@ucanto/core": "^9.0.0",
"@ucanto/core": "^9.0.1",
"@web-std/blob": "^3.0.5",
"@web3-storage/eslint-config-w3up": "workspace:^",
"@web3-storage/sigv4": "^1.0.2",
Expand Down
12 changes: 12 additions & 0 deletions packages/w3up-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [10.3.0](https://github.com/web3-storage/w3up/compare/w3up-client-v10.2.0...w3up-client-v10.3.0) (2023-11-15)


### Features

* w3up client login ([#1120](https://github.com/web3-storage/w3up/issues/1120)) ([8279bf6](https://github.com/web3-storage/w3up/commit/8279bf6371182709b46e83e5ac86d89ed1f292e8))


### Bug Fixes

* authorize renamed to login in docs ([#1125](https://github.com/web3-storage/w3up/issues/1125)) ([1c3e773](https://github.com/web3-storage/w3up/commit/1c3e773b7e2572d68a8c64bdefc08f8839f17670))

## [10.2.0](https://github.com/web3-storage/w3up/compare/w3up-client-v10.1.0...w3up-client-v10.2.0) (2023-11-14)


Expand Down
Loading

0 comments on commit 5b470b3

Please sign in to comment.