Documentation ¶
Index ¶
- Constants
- func EnsureRequiredContexts(context []any, requiredContexts []string) []any
- func GetContextsFromProvable(p WithEmbeddedProof) ([]any, error)
- type CryptoSuite
- type CryptoSuiteInfo
- type CryptoSuiteProofType
- type GenericProvable
- type LDKeyType
- type PayloadFormat
- type ProofOptions
- type ProofPurpose
- type SignatureType
- type Signer
- type Verifier
- type WithEmbeddedProof
Constants ¶
const ( W3CSecurityContext string = "https://w3id.org/security/v2" Ed25519VerificationKey2020Context string = "https://w3id.org/security/suites/ed25519-2020/v1" X25519KeyAgreementKey2020Context string = "https://w3id.org/security/suites/x25519-2020/v1" SECP256k1VerificationKey2019Context string = "https://w3id.org/security/suites/secp256k1-2019/v1" JSONWebKey2020Context string = "https://w3id.org/security/suites/jws-2020/v1" Multikey2021Context string = "https://w3id.org/security/suites/multikey-2021/v1" BLS12381G2Key2020Context string = "https://w3id.org/security/suites/bls12381-2020/v1" AssertionMethod ProofPurpose = "assertionMethod" Authentication ProofPurpose = "authentication" JWTFormat PayloadFormat = "jwt" LDPFormat PayloadFormat = "ldp" )
Variables ¶
This section is empty.
Functions ¶
func EnsureRequiredContexts ¶
EnsureRequiredContexts attempt to verify that string context(s) exist in the context interface
func GetContextsFromProvable ¶
func GetContextsFromProvable(p WithEmbeddedProof) ([]any, error)
GetContextsFromProvable searches from a Linked Data `@context` property in the document and returns the value associated with the context, if it exists.
Types ¶
type CryptoSuite ¶
type CryptoSuite interface { CryptoSuiteInfo // Sign https://w3c-ccg.github.io/data-integrity-spec/#proof-algorithm // this method mutates the provided provable object, adding a `proof` block` Sign(s Signer, p WithEmbeddedProof) error // Verify https://w3c-ccg.github.io/data-integrity-spec/#proof-verification-algorithm Verify(v Verifier, p WithEmbeddedProof) error }
CryptoSuite encapsulates the behavior of a proof type as per the W3C specification on data integrity https://w3c-ccg.github.io/data-integrity-spec/#creating-new-proof-types
type CryptoSuiteInfo ¶
type CryptoSuiteProofType ¶
type CryptoSuiteProofType interface { Marshal(data any) ([]byte, error) Canonicalize(marshaled []byte) (*string, error) // CreateVerifyHash https://www.w3.org/community/reports/credentials/CG-FINAL-data-integrity-20220722/#create-verify-hash-algorithm CreateVerifyHash(doc map[string]any, proof crypto.Proof, proofOptions *ProofOptions) ([]byte, error) // Digest runs a given digest algorithm https://www.w3.org/community/reports/credentials/CG-FINAL-data-integrity-20220722/#dfn-message-digest-algorithm // on a canonizliaed document prior to signing. Sometimes implementations will be a no-op as digesting is handled // by the signature algorithm itself. Digest(tbd []byte) ([]byte, error) }
CryptoSuiteProofType is an interface that defines functionality needed to sign and verify data It encapsulates the functionality defined by the data integrity proof type specification https://www.w3.org/community/reports/credentials/CG-FINAL-data-integrity-20220722/#creating-new-proof-types
type GenericProvable ¶
GenericProvable represents a provable that is not constrained by a specific type
func (*GenericProvable) GetProof ¶
func (g *GenericProvable) GetProof() *crypto.Proof
func (*GenericProvable) SetProof ¶
func (g *GenericProvable) SetProof(p *crypto.Proof)
type LDKeyType ¶
type LDKeyType string
const ( JSONWebKey2020Type LDKeyType = "JsonWebKey2020" X25519KeyAgreementKey2020 LDKeyType = "X25519KeyAgreementKey2020" Ed25519VerificationKey2020 LDKeyType = "Ed25519VerificationKey2020" X25519KeyAgreementKey2019 LDKeyType = "X25519KeyAgreementKey2019" Ed25519VerificationKey2018 LDKeyType = "Ed25519VerificationKey2018" ECDSASECP256k1VerificationKey2019 LDKeyType = "EcdsaSecp256k1VerificationKey2019" MultikeyType LDKeyType = "Multikey" P256Key2021 LDKeyType = "P256Key2021" P384Key2021 LDKeyType = "P384Key2021" P521Key2021 LDKeyType = "P521Key2021" BLS12381G1Key2020 LDKeyType = "Bls12381G1Key2020" BLS12381G2Key2020 LDKeyType = "Bls12381G2Key2020" )
type PayloadFormat ¶
type PayloadFormat string
type ProofOptions ¶
type ProofPurpose ¶
type ProofPurpose string
type SignatureType ¶
type SignatureType string
type Signer ¶
type Signer interface { Sign(tbs []byte) ([]byte, error) GetKeyID() string GetSignatureType() SignatureType GetSigningAlgorithm() string SetProofPurpose(purpose ProofPurpose) GetProofPurpose() ProofPurpose SetPayloadFormat(format PayloadFormat) GetPayloadFormat() PayloadFormat }