copy the other repo and make packages install.

This commit is contained in:
fiatjaf
2023-09-18 16:29:38 -03:00
commit 0b433cd95a
18 changed files with 2042 additions and 0 deletions

26
commands.go Normal file
View File

@@ -0,0 +1,26 @@
package opentimestamps
import (
"crypto/sha256"
"io"
"os"
)
func CreateDetachedTimestampForFile(
path string, cal *RemoteCalendar,
) (*DetachedTimestamp, error) {
f, err := os.Open(path)
if err != nil {
return nil, err
}
hasher := sha256.New()
if _, err := io.Copy(hasher, f); err != nil {
return nil, err
}
digest := hasher.Sum([]byte{})
ts, err := cal.Submit(digest)
if err != nil {
return nil, err
}
return NewDetachedTimestamp(*opSHA256, digest, ts)
}