Documentation
¶
Overview ¶
Package jcs implements the EdDSA Cryptosuite using JSON Canonicalization Scheme (JCS) as defined in the W3C Data Integrity EdDSA Cryptosuites v1.0 specification.
This implements the eddsa-jcs-2022 cryptosuite which uses: - JSON Canonicalization Scheme (RFC 8785) for document canonicalization - SHA-256 for hashing - Ed25519 for signatures
Reference: https://www.w3.org/TR/vc-di-eddsa/#eddsa-jcs-2022
Index ¶
Constants ¶
const ( // CryptosuiteEdDSAJCS2022 is the identifier for the eddsa-jcs-2022 cryptosuite CryptosuiteEdDSAJCS2022 = "eddsa-jcs-2022" // ProofTypeDataIntegrity is the W3C Data Integrity proof type ProofTypeDataIntegrity = "DataIntegrityProof" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DataIntegrityProof ¶
type DataIntegrityProof struct {
Type string `json:"type"`
Cryptosuite string `json:"cryptosuite"`
VerificationMethod string `json:"verificationMethod"`
ProofPurpose string `json:"proofPurpose"`
Created string `json:"created"`
ProofValue string `json:"proofValue"`
Domain string `json:"domain,omitempty"`
Challenge string `json:"challenge,omitempty"`
}
DataIntegrityProof represents a W3C Data Integrity proof.
type SignOptions ¶
type SignOptions struct {
VerificationMethod string
ProofPurpose string
Created time.Time
Domain string
Challenge string
}
SignOptions contains options for creating a Data Integrity proof.
type Suite ¶
type Suite struct{}
Suite implements the eddsa-jcs-2022 cryptosuite for W3C Data Integrity proofs.
func (*Suite) Sign ¶
func (s *Suite) Sign(document any, key ed25519.PrivateKey, opts *SignOptions) (map[string]any, error)
Sign creates a Data Integrity proof for a JSON document using eddsa-jcs-2022.