Documentation
¶
Overview ¶
Package verifiable provides functionality managing verifiable credentials.
Index ¶
- Constants
- func Canonicalize(data any, ldProc *ld.JsonLdProcessor, ldOptions *ld.JsonLdOptions) ([]byte, error)
- func DefaultDocumentLoader() (ld.DocumentLoader, error)
- func DefaultLdOptions() (*ld.JsonLdOptions, error)
- func EncodeList(data []byte) (string, error)
- func HashData(transformedData, proofConfig []byte) ([]byte, error)
- func MustEncodeList(data []byte) string
- type BitstringStatusListSubject
- type Config
- type Credential
- type CredentialStatus
- type Issuer
- type MultiKey
- type Proof
- type ProofOptions
- type ProofOptionsWithContext
- type VINSubject
- type VerificationControlDocument
Constants ¶
const ( Format = "application/n-quads" AlgorithmURDNA2015 = "URDNA2015" )
Variables ¶
This section is empty.
Functions ¶
func Canonicalize ¶
func Canonicalize(data any, ldProc *ld.JsonLdProcessor, ldOptions *ld.JsonLdOptions) ([]byte, error)
Canonicalize canonicalizes the data using the given processor and options.
func DefaultDocumentLoader ¶
func DefaultDocumentLoader() (ld.DocumentLoader, error)
func DefaultLdOptions ¶
func DefaultLdOptions() (*ld.JsonLdOptions, error)
DefaultLdOptions returns the default JSON-LD options.
func EncodeList ¶
EncodeList compresses and base64 encodes a list of bytes.
func MustEncodeList ¶
MustEncodeList compresses and base64 encodes a list of bytes.
Types ¶
type BitstringStatusListSubject ¶
type BitstringStatusListSubject struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
StatusPurpose string `json:"statusPurpose,omitempty"`
EncodedList string `json:"encodedList,omitempty"`
}
BitstringStatusListSubject represents the subject of the bitstring status list verifiable credential.
type Config ¶
type Config struct {
PrivateKey []byte
ChainID *big.Int
VehicleNFTAddress common.Address
BaseStatusURL string
BaseKeyURL string
}
Config contains the configuration for a Issuer.
type Credential ¶
type Credential struct {
Context []string `json:"@context,omitempty"`
ID string `json:"id,omitempty"`
Type []string `json:"type,omitempty"`
Issuer string `json:"issuer,omitempty"`
IssuanceDate string `json:"issuanceDate,omitempty"`
ValidFrom string `json:"validFrom,omitempty"`
ExpirationDate string `json:"expirationDate,omitempty"`
CredentialSubject json.RawMessage `json:"credentialSubject,omitempty"`
CredentialStatus CredentialStatus `json:"credentialStatus,omitempty"`
Proof Proof `json:"proof,omitempty"`
}
Credential represents a verifiable credential.
type CredentialStatus ¶
type CredentialStatus struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
StatusPurpose string `json:"statusPurpose,omitempty"`
StatusListIndex uint `json:"statusListIndex"`
StatusListCredential string `json:"statusListCredential,omitempty"`
}
CredentialStatus represents the status of the verifiable credential.
type Issuer ¶
type Issuer struct {
// contains filtered or unexported fields
}
Issuer issues various Verifiable Credentials.
func (*Issuer) CreateBitstringStatusListVC ¶
func (*Issuer) CreateKeyControlDoc ¶ added in v0.0.3
CreateKeyControlDoc creates a key control document for the issuer. This document is used to get the public key of the issuer.
type Proof ¶
type Proof struct {
ProofOptions
ProofValue string `json:"proofValue,omitempty"`
}
Proof contains the signed proof value and options.
func CreateProof ¶
func CreateProof(unsecuredDocument Credential, options ProofOptions, privateKey *ecdsa.PrivateKey, ldProcessor *ld.JsonLdProcessor, ldOptions *ld.JsonLdOptions) (Proof, error)
CreateProof creates a proof for a document using ecdsa-rdfc-2019.
type ProofOptions ¶
type ProofOptions struct {
Type string `json:"type,omitempty"`
Cryptosuite string `json:"cryptosuite,omitempty"`
VerificationMethod string `json:"verificationMethod,omitempty"`
Created string `json:"created,omitempty"`
ProofPurpose string `json:"proofPurpose,omitempty"`
}
ProofOptions contains the options for generating a proof.
type ProofOptionsWithContext ¶
type ProofOptionsWithContext struct {
Context []string `json:"@context,omitempty"`
ProofOptions
}
proofOptionsWithContext contains the proof options with the context. this is used for canonicalization.
type VINSubject ¶
type VINSubject struct {
ID string `json:"id,omitempty"`
VehicleIdentificationNumber string `json:"vehicleIdentificationNumber,omitempty"`
CountryCode string `json:"countryCode,omitempty"`
}
VINSubject represents the subject of the VIN verifiable credential.
type VerificationControlDocument ¶ added in v0.0.3
type VerificationControlDocument struct {
Context []string `json:"@context,omitempty"`
ID string `json:"id,omitempty"`
VerificationMethod []MultiKey `json:"verificationMethod,omitempty"`
Authentication []string `json:"authentication,omitempty"`
AssertionMethod []string `json:"assertionMethod,omitempty"`
CapabilityDelegation []string `json:"capabilityDelegation,omitempty"`
CapabilityInvocation []string `json:"capabilityInvocation,omitempty"`
}