Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: import space from base64 string #122

Closed
wants to merge 2 commits into from
Closed

Commits on Nov 11, 2023

  1. feat: import space from base64 string

    tweak w3cli to make it easier to use in CI where you want to provide state via env vars... aka what if this flow could all be done from w3cli https://gist.github.com/alanshaw/e949abfcf6728f590ac9fa083dba5648
    
    Service suggestion:
    
    1. Create a keypair for the server
    
        ```sh
        npx ucan-key ed --json
        ```
    
        Note down `did` and `key` values!
    
    1. Install the w3cli:
    
        ```sh
        npm i -g @web3-storage/w3cli
        ```
    
    1. Authorize your agent to use spaces owned by your email address:
    
        ```sh
        w3 authorize [email protected]
        ```
    
    1. Create a space for where the uploads will be registered:
    
        ```sh
        w3 space create myspacename
        w3 space register
        ```
    
    1. Delegate from your local machine to the server:
    
        ```sh
        w3 delegation create <did_from_ucan-key_command_above> --can 'store/add' --can 'upload/add' | base64
        ```
    
    1. Set up environment variables `W3_PRINCIPAL` with the output of `key` from step 1 and `SPACE_PROOF_BASE64` with the output of step 4.
    1. Install w3cli in your CI workflow, import the space from `SPACE_PROOF_BASE64` and upload your files
       ```sh
       w3cli space add --base64 $SPACE_PROOF_BASE64
       w3cli up <./path to your file>
       ```
    DONE!
    
    by setting `W3_PRINCIPAL` you w3cli in ci will use the key you generated, and the new w3cli space add --base64 <proof string> flag lets you import and use a space proof from a string.
    
    License: MIT
    Signed-off-by: Oli Evans <[email protected]>
    olizilla committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    4ac13bd View commit details
    Browse the repository at this point in the history
  2. chore: fix error handling. fix test

    License: MIT
    Signed-off-by: Oli Evans <[email protected]>
    olizilla committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    0bc8a13 View commit details
    Browse the repository at this point in the history