---
# System prepended metadata

title: 2020-01-11 CoBox <-> Ahau Integration 5

---

# 2020-01-11 CoBox <-> Ahau Integration 5

**Previous meetings:**
- [meeting 1](/_0z3hbA9R3y4kdIP2rAlCw)
- [meeting 2](/a8lPz7OxT2G-FDiwuYJAlA)
- [meeting 3](/j5ozmSIxQE-48LhY2BUYmg)
- [meeting 4](/XGR4-JbMTeCjXCE8iWnMcw)

[**Module code on gitlab**](https://gitlab.com/coboxcoop/artifact-store)

## Agenda

- current state:
  - humans!
  - code
  - hours
- invoicing
- next steps


## Current state

Hours/ budget
- $5k NZD, hourly rate $80 NZD/hr
- 15 hours a week * ~3 weeks
- ~3 * 15 * 80 = 3600

Next steps (from last time): 
- [x] mu and peg to continue development - getting the DHT networking part working, and writing tests for the clear method
  - [x] wrote tests for clearing (check storage before + after)
  - [x] networking DHT part
    - [x] worked on connecting to peers from last time
      - persisting state not necessary but speeds things up a lot
    - [x] connection management
      - avoid making new connections unless needed
    - [ ] some optimisations may need close attention
- [~] mix (optionally) to try using this in an electron app: https://www.npmjs.com/package/render-media
- [~] open question about sending drive addresses to pataka - current proposal - this is handled on the SSB side - with RPC on connect (mix’s to look at this)


## What functionality exists now

- Each file is encrypted with a given encryption key
- Part of a file can be retrieved, and the encryption stream offset behaves appropriately
- Individual files can be removed locally 
- The amount of local storage space used by a particular peer can be displayed.
- On restarting the application, previously known peers are connected to automatically, reducing the time taken to download files from them (as the connection is already established and ready).
- Optimised to resolve DHT lookups quickly.
- Sparse replication
- all documented
- refactored to use async/ await


## Remaining TODOS

- [x] pataka (mu to have a go)
  - [x] simpler, non-sparse version for running on Pataka
  - [x] a method for registering a drive to replicate
- [ ] write documentation for pataka
- [ ] write tests for pataka
- [ ] figure out how to communicate the existence of a new 'user' to pataka
- [x] error handling of `createWriteStream` (mu)
- [x] `encrypt.test.js` is incomplete
- [x] update `example.js`
- [x] refactor `networker.configure`, to speed up tests
- [x] add a test to show that `loadDrives` works correctly (mu)
- [x] DHT bootstrap nodes - add option for custom nodes
- [x] provide a way of knowing when a drive has 'updated' after writing a file (either by emitting an event, or having a method which returns a promise)
- [x] method to get the size of a given file in a given drive
- [x] write test for fileSize
- [ ] write test for driveSize
- [ ] change to using sodium 3
- [ ] use Standard linter
- [ ] publish to npm (and generally sort out our package.json beforehand)


**Nice to haves**
- [ ] tests - could have a `streamToString` function to DRY up
- [ ] `toString` / `tobuffer` helper functions

**Next module**
- [ ] media server module
  - `<video>` tag can request a range and this module figures out how to stream that ... decrypted
  
  
## Minimal test

1. write a demo.js app
  - actions:
    - add a file on computer A
    - view it on computer B
  - try with:
    - .txt
    - .mp4 file (large)

2. seeking behaviour to stream media
  - actions:
    - computer A adds a large video
    - compyter B starts watching video as they receive it.
  - possible code:
    - render-media module for front end
    https://gitlab.com/coboxcoop/try-render-media
    - backend? perhaps an express server connected to artifactStore
    https://gitlab.com/coboxcoop/encrypt-files/-/blob/master/streamVideo.js


## Next steps:

- ahau team test module - at least min test 1
- mu + peg to complete things in todos
- either to start min test 2: communicate if so
- track time
  - report state at next meeting / if close to 5K
- future: discuss infrastructure dependencies if e.g. Hyper* goes down

## [Next meeting NZDT Tuesday 19th 8pm // CET Tuesday 19th 8am](https://www.worldtimebuddy.com/?qm=1&lid=2879139,2179537,8&h=2879139&date=2021-2-2&sln=8-9&hf=0)
pencilled in!
