Skip to content

Use async hypercore-encryption module#676

Merged
mafintosh merged 13 commits intomainfrom
encryption-provider
Mar 26, 2025
Merged

Use async hypercore-encryption module#676
mafintosh merged 13 commits intomainfrom
encryption-provider

Conversation

@chm-diederichs
Copy link
Copy Markdown
Contributor

No description provided.

@chm-diederichs
Copy link
Copy Markdown
Contributor Author

we need to publish https://github.com/holepunchto/hypercore-block-encryption once we're happy with it

index.js Outdated
}

function isEncryptionProvider (e) {
return !!(e && (e instanceof HypercoreEncryption || (e.encrypt && typeof e.encrypt === 'function')))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you can just do the instanceof check


if (this.encryption.compat !== this.core.compat) this._updateEncryption()

for (let i = 0; i < blocks.length; i++) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this maybe be done in parallel using something like await Promise.all(blocks.map(encrypt))? This seems like a major perf regression otherwise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same as today since sync right now, but we can adjust later. the async'ness is there for flexibility. for now lets keep it simple.

@chm-diederichs chm-diederichs changed the title Use async hypercore-block-encryption module Use async hypercore-encryption module Mar 25, 2025
@mafintosh mafintosh merged commit e922402 into main Mar 26, 2025
4 checks passed
@mafintosh mafintosh deleted the encryption-provider branch March 26, 2025 13:10
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.

3 participants