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

Implement validateExportStream function #22

Closed
dmitrizagidulin opened this issue Jan 7, 2025 · 4 comments
Closed

Implement validateExportStream function #22

dmitrizagidulin opened this issue Jan 7, 2025 · 4 comments
Assignees
Labels

Comments

@dmitrizagidulin
Copy link

dmitrizagidulin commented Jan 7, 2025

Implement (and export from the npm library) a validateExportStream function.

  • Takes a readable stream (of the tarball) as input
  • Unpacks it (extract the code from importActorProfile function)
  • Validates it
    • ensure it has a manifest.yaml file (later on we're gonna check the schema on that file too)
    • has an activitypub top level folder
    • the folder has the files activitypub/actor.json and outbox.json
    • the contents of those two JSON files can be parsed as valid JSON (so, JSON.parse() doesn't throw error)

See spec at https://codeberg.org/fediverse/fep/src/branch/main/fep/6fcd/fep-6fcd.md#activitypub-export-example

@gobengo
Copy link

gobengo commented Jan 7, 2025

(Export endpoint defined in FEP https://codeberg.org/fediverse/fep/src/branch/main/fep/9091/fep-9091.md, implemented in Hollo already by @0marSalah )

import { validateExport } from '@interop/wallet-export-ts'

const exportEndpoint = process.env.EXPORT_ENDPOINT
const exportResponse = await fetch(exportEndpoint, {
  headers: { 'accept': 'application/x-tar' }
})
await validateExport(exportResponse.blob())  // note blob() is async, so this is taking a Promise as input
// { valid: true, errors: [] }

@0marSalah
Copy link
Collaborator

Dev PR: interop-alliance/wallet-export-ts#7

@dmitrizagidulin dmitrizagidulin self-assigned this Jan 14, 2025
@dmitrizagidulin
Copy link
Author

Assigning to myself to publish to npm.

@0marSalah
Copy link
Collaborator

Published and the function is active in https://hollo.socialweb.coop

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

No branches or pull requests

3 participants