Documentation ¶
Overview ¶
Package ddc implements Digital document card specification (https://github.com/kaarkz/ddcard)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractAttachments ¶
func ExtractAttachments(ddcPdf io.ReadSeeker) (documentOriginal *AttachedFile, signatures []AttachedFile, err error)
ExtractAttachments from DDC and return them as structures
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder builds Digital Document Card
func NewBuilder ¶
func NewBuilder(di *DocumentInfo) (*Builder, error)
NewBuilder creates a new DDC Builder
func (*Builder) Build ¶
func (ddc *Builder) Build(visualizeDocument, visualizeSignatures bool, creationDate, builderName, howToVerify string, w io.Writer) error
Build DDC and write it's bytes to w
type DocumentInfo ¶
type DocumentInfo struct { // Title of the document Title string `json:"title"` // Optional description of the document Description string `json:"description"` // Optional id of the document ID string `json:"id"` // Optional qr code with the id of the document, should be set if id is set IDQRCode []byte `json:"idQRCode"` // Signatures information Signatures []SignatureInfo `json:"signatures"` // The language to build DDC in ["ru", "kk", "kk/ru"] Language string `json:"language"` }
DocumentInfo contains information about the digital document and signatures
type SignatureInfo ¶
type SignatureInfo struct { // Signature body bytes Body []byte `json:"body"` // File name for attachment FileName string `json:"fileName"` // Signer name to build attachment description (optional, required if SignatureVisualization is not provided) SignerName string `json:"signerName"` // Signature visualization information (optional, required for signatures visualization) SignatureVisualization *SignatureVisualization `json:"signatureVisualization"` }
SignatureInfo used to embed signature in DDC and optionally to construct visualization
type SignatureVisualization ¶
type SignatureVisualization struct { // Signers full name SubjectName string `json:"subjectName"` // Signers identification number such as IIN or passport number SubjectID string `json:"subjectID"` // In case if the subject signed as an employee, name of the employer SubjectOrgName string `json:"subjectOrgName"` // In case if the subject signed as an employee, identification number of the employer, such as BIN or tax number SubjectOrgID string `json:"subjectOrgID"` // Subjects full RDN in RFC 4514 format Subject string `json:"subject"` // Subjects alternative names from subjectAltName certificate extension SubjectAltName string `json:"subjectAltName"` // Serial number of the signers certificate SerialNumber string `json:"serialNumber"` // From value from certificate in format "19.05.2021 04:01:52 UTC+6" From string `json:"from"` // Until value from certificate in format "19.05.2021 04:01:52 UTC+6" Until string `json:"until"` // Certificate policies (aka certificate templates) in the following format "Human readable name (OID)" Policies []string `json:"policies"` // Key usages in the following format "Human readable name (const from https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.3)" KeyUsage []string `json:"keyUsage"` // Extended key usages in the following format "Human readable name (OID)" ExtKeyUsage []string `json:"extKeyUsage"` // Certificate issuers full RDN in RFC 4514 format Issuer string `json:"issuer"` // Signature algorithm in the following format "Human readable name (OID)" SignatureAlgorithm string `json:"signatureAlgorithm"` // Time stamp imformation TSP struct { // Time stamp from TSP response in format "19.05.2021 04:01:52 UTC+6" // converted to time zone of Nur-Sultan GeneratedAt string `json:"generatedAt"` // Serial number of the TSP signers certificate SerialNumber string `json:"serialNumber"` // TSP signers certificate subject full RDN in RFC 4514 format Subject string `json:"subject"` // TSP signers certificate issuer full RDN in RFC 4514 format Issuer string `json:"issuer"` } `json:"tsp"` // OCSP response information OCSP struct { // ThisUpdate value from OCSP response in format "19.05.2021 04:01:52 UTC+6" // converted to time zone of Nur-Sultan GeneratedAt string `json:"generatedAt"` // CertStatus from OCSP response as a string (one of "good", "revoked", or "unknown") CertStatus string `json:"certStatus"` // Serial number of the OCSP signers certificate SerialNumber string `json:"serialNumber"` // OCSP signers certificate subject full RDN in RFC 4514 format Subject string `json:"subject"` // OCSP signers certificate issuer full RDN in RFC 4514 format Issuer string `json:"issuer"` } `json:"ocsp"` // Signature body encoded as a sey of QR codes and stored as PNG images (optional) QRCodes [][]byte `json:"qrCodes"` }
SignatureVisualization information used to construct signature visualization page
Click to show internal directories.
Click to hide internal directories.