service: implement a function for signing data

This commit is contained in:
Leonard Lyubich 2020-05-04 18:52:56 +03:00
parent eb94cf7549
commit 0ffb1bd61d
4 changed files with 189 additions and 0 deletions

View file

@ -171,3 +171,19 @@ type SessionToken interface {
SessionTokenInfo
SignatureContainer
}
// SignedDataSource is an interface of the container of a data for signing.
type SignedDataSource interface {
// Must return the required for signature byte slice.
// A non-nil error indicates that the data is not ready for signature.
SignedData() ([]byte, error)
}
// SignedDataReader is an interface of signed data reader.
type SignedDataReader interface {
// Must return the minimum length of the slice for full reading.
SignedDataSize() int
// Must behave like Read method of io.Reader and differ only in the reading of the signed data.
ReadSignedData([]byte) (int, error)
}