Documentation ¶
Index ¶
- Constants
- Variables
- type Authentication
- type BJJSignatureProof2021
- type CommonProof
- type CommonVerificationMethod
- type CredentialProof
- type CredentialProofs
- type CredentialSchema
- type CredentialStatus
- type CredentialStatusType
- type DIDDocument
- type DeviceMetadata
- type EncryptedDeviceMetadata
- type Iden3SparseMerkleProofdeprecated
- type Iden3SparseMerkleTreeProof
- type IssuerData
- type ProofData
- type ProofPurpose
- type ProofType
- type PushMetadata
- type PushService
- type RHSCredentialStatus
- type RevocationStatus
- type Service
- type State
- type W3CCredential
- type ZKProof
Constants ¶
const ( // TypeW3CVerifiableCredential is of the w3c verifiable credential standard TypeW3CVerifiableCredential = "VerifiableCredential" // JSONLDSchemaIden3Credential is a schema for context with W3CCredential type JSONLDSchemaIden3Credential = "https://schema.iden3.io/core/jsonld/iden3proofs.jsonld" // JSONLDSchemaW3CCredential2018 is a schema for context with VerifiableCredential type JSONLDSchemaW3CCredential2018 = "https://www.w3.org/2018/credentials/v1" // SparseMerkleTreeProof is CredentialStatusType for standard MTP result handlers SparseMerkleTreeProof CredentialStatusType = "SparseMerkleTreeProof" // Iden3ReverseSparseMerkleTreeProof is CredentialStatusType for reverse iden3 algorithm Iden3ReverseSparseMerkleTreeProof CredentialStatusType = "Iden3ReverseSparseMerkleTreeProof" // JSONSchemaValidator2018 JSON schema for verification of W3CCredential // Deprecated: https://www.w3.org/2018/credentials/#JsonSchemaValidator2018 JSONSchemaValidator2018 = "JsonSchemaValidator2018" // JSONSchema2023 JSON schema for verification of W3CCredential (https://www.w3.org/TR/vc-json-schema/#jsonschema2023) JSONSchema2023 = "JsonSchema2023" // BJJSignatureProofType is a proof type for BJJ signature proofs BJJSignatureProofType ProofType = "BJJSignature2021" // Iden3SparseMerkleProofType is a proof type for MTP proofs with iden3 metadata // // Deprecated: Iden3SparseMerkleProofType is not correct semantically and replaced by Iden3SparseMerkleTreeProofType Iden3SparseMerkleProofType ProofType = "Iden3SparseMerkleProof" // Iden3SparseMerkleTreeProofType is a proof type for MTP proofs with iden3 metadata. Context is defined here: https://schema.iden3.io/core/jsonld/iden3proofs.jsonld Iden3SparseMerkleTreeProofType ProofType = "Iden3SparseMerkleTreeProof" // SparseMerkleTreeProofType ia a standard SMT proof type SparseMerkleTreeProofType ProofType = "SparseMerkleTreeProof" // ProofPurposeAuthentication defines a proof for authentication ProofPurposeAuthentication ProofPurpose = "Authentication" // Iden3CommServiceType is service type for iden3comm protocol Iden3CommServiceType = "iden3-communication" // PushNotificationServiceType is service type for delivering push notifications to identity PushNotificationServiceType = "push-notification" // CredentialMerklizedRootPositionIndex is merklized root position of W3CCredential in the IndexDataSlotA (core claim) CredentialMerklizedRootPositionIndex = "index" // CredentialMerklizedRootPositionValue is merklized root position of W3CCredential in the ValueDataSlotA (core claim) CredentialMerklizedRootPositionValue = "value" // CredentialMerklizedRootPositionNone is for non-merklized W3CCredential CredentialMerklizedRootPositionNone = "" // CredentialSubjectPositionIndex is subject position of W3CCredential in index (core claim) CredentialSubjectPositionIndex = "index" // CredentialSubjectPositionValue is subject position of W3CCredential in value (core claim) CredentialSubjectPositionValue = "value" // CredentialSubjectRootPositionValue is subject position of W3CCredential in value (core claim) // Deprecated: use CredentialSubjectPositionValue instead CredentialSubjectRootPositionValue = "value" // Iden3commRevocationStatusV1 is CredentialStatusType for iden3comm revocation status Iden3commRevocationStatusV1 CredentialStatusType = "Iden3commRevocationStatusV1.0" // Iden3OnсhainSparseMerkleTreeProof2023 is a proof type for MTP proofs with iden3 metadata from blockchain Iden3OnchainSparseMerkleTreeProof2023 CredentialStatusType = "Iden3OnchainSparseMerkleTreeProof2023" )
const ( // DIDDocumentJSONSchema is a basic schema of did document DIDDocumentJSONSchema = `` /* 4391-byte string literal not displayed */ )
Variables ¶
var ErrProofNotFound = errors.New("proof not found")
ErrProofNotFound is an error when specific proof is not found in the credential
Functions ¶
This section is empty.
Types ¶
type Authentication ¶ added in v1.1.6
type Authentication struct { CommonVerificationMethod // contains filtered or unexported fields }
func (*Authentication) DID ¶ added in v1.1.6
func (a *Authentication) DID() string
func (*Authentication) IsDID ¶ added in v1.1.6
func (a *Authentication) IsDID() bool
func (*Authentication) MarshalJSON ¶ added in v1.1.6
func (a *Authentication) MarshalJSON() ([]byte, error)
func (*Authentication) UnmarshalJSON ¶ added in v1.1.6
func (a *Authentication) UnmarshalJSON(b []byte) error
type BJJSignatureProof2021 ¶ added in v0.0.23
type BJJSignatureProof2021 struct { Type ProofType `json:"type"` IssuerData IssuerData `json:"issuerData"` CoreClaim string `json:"coreClaim"` Signature string `json:"signature"` }
BJJSignatureProof2021 JSON-LD BBJJSignatureProof
func (*BJJSignatureProof2021) GetCoreClaim ¶ added in v1.0.0
func (p *BJJSignatureProof2021) GetCoreClaim() (*core.Claim, error)
func (*BJJSignatureProof2021) ProofType ¶ added in v1.0.0
func (p *BJJSignatureProof2021) ProofType() ProofType
func (*BJJSignatureProof2021) UnmarshalJSON ¶ added in v1.0.0
func (p *BJJSignatureProof2021) UnmarshalJSON(in []byte) error
type CommonProof ¶ added in v1.0.0
type CommonProof jsonObj
func (*CommonProof) GetCoreClaim ¶ added in v1.0.0
func (p *CommonProof) GetCoreClaim() (*core.Claim, error)
func (*CommonProof) ProofType ¶ added in v1.0.0
func (p *CommonProof) ProofType() ProofType
func (*CommonProof) UnmarshalJSON ¶ added in v1.0.0
func (p *CommonProof) UnmarshalJSON(bytes []byte) error
type CommonVerificationMethod ¶ added in v1.1.6
type CommonVerificationMethod struct { ID string `json:"id"` Type string `json:"type"` Controller string `json:"controller"` PublicKeyJwk map[string]interface{} `json:"publicKeyJwk"` PublicKeyMultibase string `json:"publicKeyMultibase,omitempty"` PublicKeyHex string `json:"publicKeyHex,omitempty"` PublicKeyBase58 string `json:"publicKeyBase58,omitempty"` EthereumAddress string `json:"ethereumAddress,omitempty"` BlockchainAccountID string `json:"blockchainAccountId,omitempty"` }
CommonVerificationMethod DID doc verification method.
type CredentialProof ¶ added in v1.0.0
type CredentialProofs ¶ added in v1.0.0
type CredentialProofs []CredentialProof
func (*CredentialProofs) UnmarshalJSON ¶ added in v1.0.0
func (cps *CredentialProofs) UnmarshalJSON(bs []byte) error
type CredentialSchema ¶ added in v1.0.0
CredentialSchema represent the information about credential schema
type CredentialStatus ¶
type CredentialStatus struct { ID string `json:"id"` Type CredentialStatusType `json:"type"` RevocationNonce uint64 `json:"revocationNonce"` StatusIssuer *CredentialStatus `json:"statusIssuer,omitempty"` }
CredentialStatus represents the URL to fetch claim revocation info directly from the issuer.
type CredentialStatusType ¶
type CredentialStatusType string
CredentialStatusType type for understanding revocation type
type DIDDocument ¶ added in v0.2.0
type DIDDocument struct { Context interface{} `json:"@context"` ID string `json:"id"` Service []interface{} `json:"service,omitempty"` VerificationMethod []CommonVerificationMethod `json:"verificationMethod,omitempty"` Authentication []Authentication `json:"authentication,omitempty"` KeyAgreement []interface{} `json:"keyAgreement,omitempty"` }
DIDDocument defines current supported did doc model.
type DeviceMetadata ¶ added in v0.2.0
DeviceMetadata describes the structure of device metadata
type EncryptedDeviceMetadata ¶ added in v0.2.0
type EncryptedDeviceMetadata struct { Ciphertext string `json:"ciphertext"` // base64 encoded Alg string `json:"alg"` }
EncryptedDeviceMetadata describes the structure of encrypted device metadata
type Iden3SparseMerkleProof
deprecated
type Iden3SparseMerkleProof struct { Type ProofType `json:"type"` IssuerData IssuerData `json:"issuerData"` CoreClaim string `json:"coreClaim"` MTP *mt.Proof `json:"mtp"` }
Iden3SparseMerkleProof JSON-LD structure
Deprecated: replaced with Iden3SparseMerkleTreeProof
func (*Iden3SparseMerkleProof) GetCoreClaim ¶ added in v1.0.0
func (p *Iden3SparseMerkleProof) GetCoreClaim() (*core.Claim, error)
func (*Iden3SparseMerkleProof) ProofType ¶ added in v1.0.0
func (p *Iden3SparseMerkleProof) ProofType() ProofType
func (*Iden3SparseMerkleProof) UnmarshalJSON ¶ added in v1.0.0
func (p *Iden3SparseMerkleProof) UnmarshalJSON(in []byte) error
type Iden3SparseMerkleTreeProof ¶ added in v1.1.1
type Iden3SparseMerkleTreeProof struct { Type ProofType `json:"type"` IssuerData IssuerData `json:"issuerData"` CoreClaim string `json:"coreClaim"` MTP *mt.Proof `json:"mtp"` }
Iden3SparseMerkleTreeProof JSON-LD structure
func (*Iden3SparseMerkleTreeProof) GetCoreClaim ¶ added in v1.1.1
func (p *Iden3SparseMerkleTreeProof) GetCoreClaim() (*core.Claim, error)
func (*Iden3SparseMerkleTreeProof) ProofType ¶ added in v1.1.1
func (p *Iden3SparseMerkleTreeProof) ProofType() ProofType
func (*Iden3SparseMerkleTreeProof) UnmarshalJSON ¶ added in v1.1.1
func (p *Iden3SparseMerkleTreeProof) UnmarshalJSON(in []byte) error
type IssuerData ¶ added in v0.0.23
type IssuerData struct { ID string `json:"id,omitempty"` State State `json:"state,omitempty"` AuthCoreClaim string `json:"authCoreClaim,omitempty"` MTP *mt.Proof `json:"mtp,omitempty"` CredentialStatus interface{} `json:"credentialStatus,omitempty"` }
IssuerData is the data that is used to create a proof
type ProofData ¶ added in v0.0.19
type ProofData struct { A []string `json:"pi_a"` B [][]string `json:"pi_b"` C []string `json:"pi_c"` Protocol string `json:"protocol"` }
ProofData is structure that represents SnarkJS library result of proof generation
type ProofPurpose ¶
type ProofPurpose string
ProofPurpose is alias for string, represents proof purpose
type PushMetadata ¶ added in v0.2.0
type PushMetadata struct {
Devices []EncryptedDeviceMetadata `json:"devices"`
}
PushMetadata describes the structure of the data for push notifications
type PushService ¶ added in v0.2.0
type PushService struct { Service Metadata PushMetadata `json:"metadata"` }
PushService describes the services of push notifications
type RHSCredentialStatus ¶ added in v1.0.0
type RHSCredentialStatus struct { ID string `json:"id"` Type CredentialStatusType `json:"type"` RevocationNonce uint64 `json:"revocationNonce"` StatusIssuer *CredentialStatus `json:"statusIssuer,omitempty"` }
RHSCredentialStatus contains type, url to fetch RHS info, issuer ID and revocation nonce and backup option to fetch credential status Deprecated: use CredentialStatus instead
type RevocationStatus ¶ added in v0.0.19
type RevocationStatus struct { Issuer struct { State *string `json:"state,omitempty"` RootOfRoots *string `json:"rootOfRoots,omitempty"` ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` } `json:"issuer"` MTP mt.Proof `json:"mtp"` }
RevocationStatus status of revocation nonce. Info required to check revocation state of claim in circuits
type Service ¶ added in v0.2.0
type Service struct { ID string `json:"id"` Type string `json:"type"` ServiceEndpoint string `json:"serviceEndpoint"` }
Service describes standard DID document service field.
type State ¶ added in v0.0.23
type State struct { TxID *string `json:"txId,omitempty"` BlockTimestamp *int `json:"blockTimestamp,omitempty"` BlockNumber *int `json:"blockNumber,omitempty"` RootOfRoots *string `json:"rootOfRoots,omitempty"` ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` RevocationTreeRoot *string `json:"revocationTreeRoot,omitempty"` Value *string `json:"value,omitempty"` Status string `json:"status,omitempty"` }
State represents the state of the issuer
type W3CCredential ¶ added in v1.0.0
type W3CCredential struct { ID string `json:"id"` Context []string `json:"@context"` Type []string `json:"type"` Expiration *time.Time `json:"expirationDate,omitempty"` IssuanceDate *time.Time `json:"issuanceDate,omitempty"` CredentialSubject map[string]interface{} `json:"credentialSubject"` CredentialStatus interface{} `json:"credentialStatus,omitempty"` Issuer string `json:"issuer"` CredentialSchema CredentialSchema `json:"credentialSchema"` Proof CredentialProofs `json:"proof,omitempty"` }
W3CCredential is struct that represents claim json-ld document
func (*W3CCredential) GetCoreClaimFromProof ¶ added in v1.0.0
func (vc *W3CCredential) GetCoreClaimFromProof(proofType ProofType) (*core.Claim, error)
GetCoreClaimFromProof returns core claim from given proof
func (*W3CCredential) Merklize ¶ added in v1.0.0
func (vc *W3CCredential) Merklize(ctx context.Context, opts ...merklize.MerklizeOption) (*merklize.Merklizer, error)
Merklize merklizes verifiable credential