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

Parse manifest #426

Merged
merged 59 commits into from
Sep 6, 2023
Merged

Parse manifest #426

merged 59 commits into from
Sep 6, 2023

Conversation

chm-diederichs
Copy link
Contributor

No description provided.

Base automatically changed from add-manifest to main August 29, 2023 15:10
lib/manifest.js Outdated Show resolved Hide resolved
index.js Outdated
@@ -74,10 +75,11 @@ module.exports = class Hypercore extends EventEmitter {
this.writable = false
this.opened = false
this.closed = false
this.sign = null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont think this is used

index.js Outdated
this.crypto = o.crypto
this.id = o.id
this.key = o.key
this.core = o.core
this.replicator = o.replicator
this.encryption = o.encryption
this.writable = !this._readonly && !!this.auth && !!this.auth.sign
this.writable = !this._readonly || !!(this.keyPair && this.keyPair.secretKey)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be &&

@mafintosh mafintosh merged commit 6821151 into main Sep 6, 2023
3 checks passed
@mafintosh mafintosh deleted the parse-manifest branch September 6, 2023 13:23
mafintosh added a commit that referenced this pull request Sep 6, 2023
* add auth section to upgrade

* exchange auth definitions through a manifest

* fix a ton of stuff

* skip custom keypair tests for now

* allow explicit compat mode

* no need to special case keypair

* actually fix preload test

* make manifest explicit

* also set compat mode when replicating manifest

* very explicit manifest exchange

* verifyBatch -> verifyBatchUpgraded

* tweak namespacing and add explicit default ns

* add preliminary functions for parsing manifest

* typo on imports

* add encodings and entropy/namespacing

* add compat signer and more tests

* lib/core uses manifest createAuth function

* default to compat mode

* make signers classes and update tests

* correctly set compat on sessions/clones/upgrade

* fix bad merge

* need to specify compat for clone

* replace auth with manifest

* update clone and ensure that key is different

* update tests to manifest api

* load new auth if secret key is provided

* remove custom auth test

* support passing a sign function

* remove auth tests

* manifest renamed to multipleSigners

* properly set compat and keyPair

* pass batch to patched verify

* port tests from hypercore-crypto-multisig

* include file for multisig helpers

* rename to verifiers and add explicit compat verifier

* split out signing and verification

* remove sign option and just pass keyPair or signature

* only set keyPair after openCapabilities

* clarify code around creating a manifest

* conflict test now works

* fix core copyFrom and core clone tests

* fix clone and clone tests

* standardise opts across append and truncate

* tidy up

* add multisig lib file

* expose helper

* fix batch flush api

* fix noManifest logic

* fix some typos/missing apis

* set signature on tree only after verification

* rename static helpers

* rename defaultAuth to verifier

* rename defaultAuth to verifier

* remove static createVerifier method

* review by @mafintosh

* move manifestHash to lib/manifest

---------

Co-authored-by: Mathias Buus <mathiasbuus@gmail.com>
mafintosh added a commit that referenced this pull request Sep 7, 2023
* Initial manifest support (#426)

* add auth section to upgrade

* exchange auth definitions through a manifest

* fix a ton of stuff

* skip custom keypair tests for now

* allow explicit compat mode

* no need to special case keypair

* actually fix preload test

* make manifest explicit

* also set compat mode when replicating manifest

* very explicit manifest exchange

* verifyBatch -> verifyBatchUpgraded

* tweak namespacing and add explicit default ns

* add preliminary functions for parsing manifest

* typo on imports

* add encodings and entropy/namespacing

* add compat signer and more tests

* lib/core uses manifest createAuth function

* default to compat mode

* make signers classes and update tests

* correctly set compat on sessions/clones/upgrade

* fix bad merge

* need to specify compat for clone

* replace auth with manifest

* update clone and ensure that key is different

* update tests to manifest api

* load new auth if secret key is provided

* remove custom auth test

* support passing a sign function

* remove auth tests

* manifest renamed to multipleSigners

* properly set compat and keyPair

* pass batch to patched verify

* port tests from hypercore-crypto-multisig

* include file for multisig helpers

* rename to verifiers and add explicit compat verifier

* split out signing and verification

* remove sign option and just pass keyPair or signature

* only set keyPair after openCapabilities

* clarify code around creating a manifest

* conflict test now works

* fix core copyFrom and core clone tests

* fix clone and clone tests

* standardise opts across append and truncate

* tidy up

* add multisig lib file

* expose helper

* fix batch flush api

* fix noManifest logic

* fix some typos/missing apis

* set signature on tree only after verification

* rename static helpers

* rename defaultAuth to verifier

* rename defaultAuth to verifier

* remove static createVerifier method

* review by @mafintosh

* move manifestHash to lib/manifest

---------

Co-authored-by: Mathias Buus <mathiasbuus@gmail.com>

* last part of the constructor should be openSession

* simplify key handler

* fix keypair handler

* define writable condition in one place

* fix typo in manifestHash

* pass manifest directly to createVerifier

* no need to dbl copy manifest now

* tweak manifest construction

* consistent errors

* add manifest getter

* tweak manifest checks on load

* review by @chm-diederichs

* set keypair in constructor if possible

* simplify core append signature

* tweak batch flush

* simplify compat option

* update batch test

* move compat default to lib/core

* move compat check to a single func

* no manifesthash in caps

---------

Co-authored-by: Christophe Diederichs <45171645+chm-diederichs@users.noreply.github.com>
Co-authored-by: Christophe Diederichs <chm-diederichs@protonmail.com>
mafintosh added a commit that referenced this pull request Sep 7, 2023
* Initial manifest support (#426)

* add auth section to upgrade

* exchange auth definitions through a manifest

* fix a ton of stuff

* skip custom keypair tests for now

* allow explicit compat mode

* no need to special case keypair

* actually fix preload test

* make manifest explicit

* also set compat mode when replicating manifest

* very explicit manifest exchange

* verifyBatch -> verifyBatchUpgraded

* tweak namespacing and add explicit default ns

* add preliminary functions for parsing manifest

* typo on imports

* add encodings and entropy/namespacing

* add compat signer and more tests

* lib/core uses manifest createAuth function

* default to compat mode

* make signers classes and update tests

* correctly set compat on sessions/clones/upgrade

* fix bad merge

* need to specify compat for clone

* replace auth with manifest

* update clone and ensure that key is different

* update tests to manifest api

* load new auth if secret key is provided

* remove custom auth test

* support passing a sign function

* remove auth tests

* manifest renamed to multipleSigners

* properly set compat and keyPair

* pass batch to patched verify

* port tests from hypercore-crypto-multisig

* include file for multisig helpers

* rename to verifiers and add explicit compat verifier

* split out signing and verification

* remove sign option and just pass keyPair or signature

* only set keyPair after openCapabilities

* clarify code around creating a manifest

* conflict test now works

* fix core copyFrom and core clone tests

* fix clone and clone tests

* standardise opts across append and truncate

* tidy up

* add multisig lib file

* expose helper

* fix batch flush api

* fix noManifest logic

* fix some typos/missing apis

* set signature on tree only after verification

* rename static helpers

* rename defaultAuth to verifier

* rename defaultAuth to verifier

* remove static createVerifier method

* review by @mafintosh

* move manifestHash to lib/manifest

---------

Co-authored-by: Mathias Buus <mathiasbuus@gmail.com>

* last part of the constructor should be openSession

* simplify key handler

* fix keypair handler

* define writable condition in one place

* fix typo in manifestHash

* pass manifest directly to createVerifier

* no need to dbl copy manifest now

* tweak manifest construction

* consistent errors

* add manifest getter

* tweak manifest checks on load

* review by @chm-diederichs

* set keypair in constructor if possible

* simplify core append signature

* tweak batch flush

* simplify compat option

* update batch test

* move compat default to lib/core

* move compat check to a single func

* no manifesthash in caps

---------

Co-authored-by: Christophe Diederichs <45171645+chm-diederichs@users.noreply.github.com>
Co-authored-by: Christophe Diederichs <chm-diederichs@protonmail.com>

Manifest tweaks (#431)

* more tests for now truncate/append options

* move more manifest functinality into manifest.js

* move isCompat to manifest and simplify clone options

* enable all tests

* pass batches to verifiers and move namespace support to batch

* fix storage test
mafintosh added a commit that referenced this pull request Sep 7, 2023
* Initial manifest support (#426)

* add auth section to upgrade

* exchange auth definitions through a manifest

* fix a ton of stuff

* skip custom keypair tests for now

* allow explicit compat mode

* no need to special case keypair

* actually fix preload test

* make manifest explicit

* also set compat mode when replicating manifest

* very explicit manifest exchange

* verifyBatch -> verifyBatchUpgraded

* tweak namespacing and add explicit default ns

* add preliminary functions for parsing manifest

* typo on imports

* add encodings and entropy/namespacing

* add compat signer and more tests

* lib/core uses manifest createAuth function

* default to compat mode

* make signers classes and update tests

* correctly set compat on sessions/clones/upgrade

* fix bad merge

* need to specify compat for clone

* replace auth with manifest

* update clone and ensure that key is different

* update tests to manifest api

* load new auth if secret key is provided

* remove custom auth test

* support passing a sign function

* remove auth tests

* manifest renamed to multipleSigners

* properly set compat and keyPair

* pass batch to patched verify

* port tests from hypercore-crypto-multisig

* include file for multisig helpers

* rename to verifiers and add explicit compat verifier

* split out signing and verification

* remove sign option and just pass keyPair or signature

* only set keyPair after openCapabilities

* clarify code around creating a manifest

* conflict test now works

* fix core copyFrom and core clone tests

* fix clone and clone tests

* standardise opts across append and truncate

* tidy up

* add multisig lib file

* expose helper

* fix batch flush api

* fix noManifest logic

* fix some typos/missing apis

* set signature on tree only after verification

* rename static helpers

* rename defaultAuth to verifier

* rename defaultAuth to verifier

* remove static createVerifier method

* review by @mafintosh

* move manifestHash to lib/manifest

---------

Co-authored-by: Mathias Buus <mathiasbuus@gmail.com>

* last part of the constructor should be openSession

* simplify key handler

* fix keypair handler

* define writable condition in one place

* fix typo in manifestHash

* pass manifest directly to createVerifier

* no need to dbl copy manifest now

* tweak manifest construction

* consistent errors

* add manifest getter

* tweak manifest checks on load

* review by @chm-diederichs

* set keypair in constructor if possible

* simplify core append signature

* tweak batch flush

* simplify compat option

* update batch test

* move compat default to lib/core

* move compat check to a single func

* no manifesthash in caps

---------

Co-authored-by: Christophe Diederichs <45171645+chm-diederichs@users.noreply.github.com>
Co-authored-by: Christophe Diederichs <chm-diederichs@protonmail.com>

Manifest tweaks (#431)

* more tests for now truncate/append options

* move more manifest functinality into manifest.js

* move isCompat to manifest and simplify clone options

* enable all tests

* pass batches to verifiers and move namespace support to batch

* fix storage test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants