Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gbs-downloader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
PrivateStorage
gbs-downloader
Commits
a6103eae
Commit
a6103eae
authored
1 year ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
Add a demo app that downloads SDMF
parent
5c2384ff
No related branches found
No related tags found
1 merge request
!5
Support SDMF in the `download` API
Pipeline
#4691
failed
1 year ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-2
2 additions, 2 deletions
README.md
download-sdmf/Main.hs
+34
-0
34 additions, 0 deletions
download-sdmf/Main.hs
gbs-downloader.cabal
+20
-0
20 additions, 0 deletions
gbs-downloader.cabal
with
56 additions
and
2 deletions
README.md
+
2
−
2
View file @
a6103eae
...
...
@@ -7,8 +7,8 @@ It aims for bit-for-bit compatibility with the original Python implementation.
### What is the current state?
It's just starting
.
It can
't do much
.
*
It can download immutable and mutable shares from Great Black Swamp storage servers
.
*
It can
interpret, decode, and decrypt the data for CHK- and SDMF-encoded shares to recover the plaintext
.
## Why does it exist?
...
...
This diff is collapsed.
Click to expand it.
download-sdmf/Main.hs
0 → 100644
+
34
−
0
View file @
a6103eae
module
Main
where
import
qualified
Data.ByteString
as
B
import
qualified
Data.ByteString.Char8
as
C8
import
qualified
Data.ByteString.Lazy
as
BL
import
qualified
Data.Text
as
T
import
Data.Yaml
(
decodeEither'
)
import
System.Environment
(
getArgs
)
import
Tahoe.Announcement
(
Announcements
(
..
))
import
Tahoe.Download
(
announcementToMutableStorageServer
,
download
)
import
Tahoe.SDMF
(
SDMF
(
..
),
pCapability
,
writerReader
)
import
Text.Megaparsec
(
parse
)
main
::
IO
()
main
=
do
[
announcementPath
,
readCap
]
<-
getArgs
-- Load server announcements
announcementsBytes
<-
B
.
readFile
announcementPath
let
Right
(
Announcements
announcements
)
=
decodeEither'
announcementsBytes
-- Accept & parse read capability
case
parse
pCapability
"<argv>"
(
T
.
pack
readCap
)
of
Left
e
->
print
$
"Failed to parse cap: "
<>
show
e
Right
(
SDMFVerifier
_
)
->
C8
.
putStrLn
"Nothing currently implemented for verifier caps."
Right
(
SDMFWriter
rwcap
)
->
go
announcements
(
writerReader
rwcap
)
Right
(
SDMFReader
rocap
)
->
go
announcements
rocap
where
go
announcements
cap
=
do
-- Download & decode the shares
result
<-
download
announcements
cap
announcementToMutableStorageServer
-- Show the result
putStrLn
"Your result:"
either
print
(
C8
.
putStrLn
.
BL
.
toStrict
)
result
This diff is collapsed.
Click to expand it.
gbs-downloader.cabal
+
20
−
0
View file @
a6103eae
...
...
@@ -155,6 +155,26 @@ executable gbs-download-chk
-- Base language which the package is written in.
default-language: Haskell2010
executable gbs-download-sdmf
import:
warnings
, language
main-is: Main.hs
build-depends:
, aeson
, base
, bytestring
, containers
, gbs-downloader
, megaparsec
, tahoe-ssk
, text
, yaml
hs-source-dirs: download-sdmf
default-language: Haskell2010
test-suite gbs-downloader-test
-- Import common warning flags.
import:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment