Documentation ¶
Index ¶
- Constants
- Variables
- func CheckSignature(iDateContainer interfaces.IDataContainer, ...) error
- func CreateCRIDContractByCode(code []byte) (*contract.Contract, error)
- func EncodeVerifiableCredentialData(p *VerifiableCredentialData) ([]byte, error)
- func GetCodeByPubKey(publicKey []byte) ([]byte, error)
- func GetController(uriPublic string) (string, string)
- func GetDIDAddress(publicKey []byte) (string, error)
- func GetDIDFromUri(idURI string) string
- func IsCompact(target string) bool
- func IsDID(ID string, publicKey []DIDPublicKeyInfo) bool
- func IsMatched(publicKey []byte, did string) bool
- func IsPublickDIDMatched(PublicKeyBase58 string, did string) bool
- func JSONMarshal(t interface{}) ([]byte, error)
- func MarshalAuthentication(auth interface{}, buf *bytes.Buffer) error
- func MarshalCredentialSubject(credentialSubject interface{}, buf *bytes.Buffer) error
- func MarshalDIDPayloadData(p *DIDPayloadData) ([]byte, error)
- func MarshalDocData(doc *DIDDoc) ([]byte, error)
- func MarshalService(service interface{}, buf *bytes.Buffer) error
- func MarshalVerifiableCredential(p VerifiableCredential, buf *bytes.Buffer) error
- func MarshalVerifiableCredentialData(p *VerifiableCredentialData, buf *bytes.Buffer) error
- func VerifyByVM(iDateContainer interfaces.IDataContainer, code []byte, signature []byte) (bool, error)
- type ControllerSlice
- type CredentialProof
- type CustomIDTicket
- type CustomIDTicketData
- type DIDDoc
- type DIDParams
- type DIDPayload
- type DIDPayloadData
- type DIDPublicKeyInfo
- type DIDTransactionData
- type DocProof
- type Header
- type ListDIDVerifCreentials
- type Proof
- type PublicKeysSlice
- type Service
- type ServiceSlice
- type TicketProof
- type VerifiableCredential
- type VerifiableCredentialData
- type VerifiableCredentialDoc
- type VerifiableCredentialSlice
- type VerifiableCredentialTxData
Constants ¶
View Source
const ( Create_DID_Operation = "create" Update_DID_Operation = "update" Transfer_DID_Operation = "transfer" Deactivate_DID_Operation = "deactivate" Declare_Verifiable_Credential_Operation = "declare" Revoke_Verifiable_Credential_Operation = "revoke" DID_ELASTOS_PREFIX = "did:elastos:" ID_STRING = "id" )
View Source
const DIDVersion = 0x00
View Source
const FeeRate int64 = 10000000000
View Source
const PrefixCRDID contract.PrefixType = 0x67
View Source
const VerifiableCredentialVersion = 0x00
Variables ¶
View Source
var MainNetDIDParams = DIDParams{
CustomIDFeeRate: 50000,
}
View Source
var RegNetDIDParams = DIDParams{
CustomIDFeeRate: 50000,
}
View Source
var TestNetDIDParams = DIDParams{
CustomIDFeeRate: 50000,
}
Functions ¶
func CheckSignature ¶
func CheckSignature(iDateContainer interfaces.IDataContainer, publickBase58, signatureBase64 string) error
func EncodeVerifiableCredentialData ¶ added in v0.2.3
func EncodeVerifiableCredentialData(p *VerifiableCredentialData) ([]byte, error)
func GetCodeByPubKey ¶
func GetController ¶
URI Public string like verification method and creator and so on
func GetDIDAddress ¶
func GetDIDFromUri ¶
func IsDID ¶
func IsDID(ID string, publicKey []DIDPublicKeyInfo) bool
func IsPublickDIDMatched ¶
func JSONMarshal ¶ added in v0.2.0
func MarshalAuthentication ¶ added in v0.2.0
func MarshalCredentialSubject ¶ added in v0.2.0
func MarshalDIDPayloadData ¶ added in v0.2.0
func MarshalDIDPayloadData(p *DIDPayloadData) ([]byte, error)
func MarshalDocData ¶ added in v0.2.0
func MarshalService ¶ added in v0.2.0
func MarshalVerifiableCredential ¶ added in v0.2.0
func MarshalVerifiableCredential(p VerifiableCredential, buf *bytes.Buffer) error
func MarshalVerifiableCredentialData ¶ added in v0.2.0
func MarshalVerifiableCredentialData(p *VerifiableCredentialData, buf *bytes.Buffer) error
func VerifyByVM ¶
func VerifyByVM(iDateContainer interfaces.IDataContainer, code []byte, signature []byte) (bool, error)
Types ¶
type ControllerSlice ¶ added in v0.2.0
type ControllerSlice []interface{}
func (ControllerSlice) Len ¶ added in v0.2.0
func (s ControllerSlice) Len() int
func (ControllerSlice) Less ¶ added in v0.2.0
func (s ControllerSlice) Less(i, j int) bool
func (ControllerSlice) Swap ¶ added in v0.2.0
func (s ControllerSlice) Swap(i, j int)
type CredentialProof ¶
type CredentialProof struct { Type string `json:"type,omitempty"` Created string `json:"created,omitempty"` VerificationMethod string `json:"verificationMethod"` Nonce string `json:"nonce,omitempty"` Realm string `json:"realm,omitempty"` Signature string `json:"signature"` }
Proof of DID transaction payload
type CustomIDTicket ¶
type CustomIDTicket struct { *CustomIDTicketData Proof interface{} `json:"proof"` }
func (*CustomIDTicket) GetData ¶
func (c *CustomIDTicket) GetData() []byte
type CustomIDTicketData ¶
type CustomIDTicketData struct { CustomID string `json:"id"` To string `json:"to"` TransactionID string `json:"txid"` }
func (*CustomIDTicketData) GetData ¶
func (c *CustomIDTicketData) GetData() []byte
type DIDDoc ¶
type DIDDoc struct { *DIDPayloadData Proof interface{} `json:"proof,omitempty"` }
payload in DID transaction payload
type DIDPayload ¶
type DIDPayload struct { Header Header `json:"header"` Payload string `json:"payload"` Proof Proof `json:"proof"` DIDDoc *DIDDoc `json:"-"` CredentialDoc *VerifiableCredentialDoc `json:"-"` Ticket *CustomIDTicket `json:"ticket,omitempty"` }
payload of DID transaction
func (*DIDPayload) Data ¶
func (p *DIDPayload) Data(version byte) []byte
func (*DIDPayload) Deserialize ¶
func (p *DIDPayload) Deserialize(r io.Reader, version byte) error
func (*DIDPayload) GetDIDDoc ¶
func (p *DIDPayload) GetDIDDoc() *DIDDoc
func (*DIDPayload) GetData ¶
func (p *DIDPayload) GetData() []byte
type DIDPayloadData ¶
type DIDPayloadData struct { Context []string `json:"@context,omitempty"` ID string `json:"id"` Controller interface{} `json:"controller,omitempty"` MultiSig string `json:"multisig,omitempty"` PublicKey []DIDPublicKeyInfo `json:"publicKey,omitempty"` Authentication []interface{} `json:"authentication,omitempty"` Authorization []interface{} `json:"authorization,omitempty"` VerifiableCredential []VerifiableCredential `json:"verifiableCredential,omitempty"` Service []interface{} `json:"service,omitempty"` Expires string `json:"expires"` }
func (*DIDPayloadData) GetData ¶
func (c *DIDPayloadData) GetData() []byte
type DIDPublicKeyInfo ¶
type DIDPublicKeyInfo struct { ID string `json:"id"` Type string `json:"type,omitempty"` Controller string `json:"controller"` PublicKeyBase58 string `json:"publicKeyBase58"` }
public keys of payload in DID transaction payload
func (*DIDPublicKeyInfo) Deserialize ¶
func (p *DIDPublicKeyInfo) Deserialize(r io.Reader, version byte) error
type DIDTransactionData ¶
type DIDTransactionData struct { TXID string `json:"txid"` Timestamp string `json:"timestamp"` Operation DIDPayload `json:"operation"` }
type DocProof ¶
type DocProof struct { Type string `json:"type,omitempty"` Created string `json:"created"` Creator string `json:"creator"` SignatureValue string `json:"signatureValue"` }
Proof of DID transaction doc
type Header ¶
type Header struct { Specification string `json:"specification"` Operation string `json:"operation"` PreviousTxid string `json:"previousTxid,omitempty"` Ticket string `json:"ticket,omitempty"` }
header of Customized DID transaction payload
type ListDIDVerifCreentials ¶ added in v0.2.0
type Proof ¶
type Proof struct { Type string `json:"type,omitempty"` VerificationMethod string `json:"verificationMethod"` Signature string `json:"signature"` }
Proof of DID transaction payload
type PublicKeysSlice ¶ added in v0.1.3
type PublicKeysSlice []DIDPublicKeyInfo
func (PublicKeysSlice) Len ¶ added in v0.1.3
func (a PublicKeysSlice) Len() int
func (PublicKeysSlice) Less ¶ added in v0.1.3
func (a PublicKeysSlice) Less(i, j int) bool
func (PublicKeysSlice) Swap ¶ added in v0.1.3
func (a PublicKeysSlice) Swap(i, j int)
type ServiceSlice ¶ added in v0.1.3
type ServiceSlice []interface{}
func (ServiceSlice) Len ¶ added in v0.1.3
func (s ServiceSlice) Len() int
func (ServiceSlice) Less ¶ added in v0.1.3
func (s ServiceSlice) Less(i, j int) bool
func (ServiceSlice) Swap ¶ added in v0.1.3
func (s ServiceSlice) Swap(i, j int)
type TicketProof ¶
type TicketProof struct { Type string `json:"type,omitempty"` Created string `json:"created"` VerificationMethod string `json:"verificationMethod"` Signature string `json:"signature"` }
Proof of DID transaction ticket
type VerifiableCredential ¶
type VerifiableCredential struct { *VerifiableCredentialData Proof CredentialProof `json:"proof,omitempty"` }
func (*VerifiableCredential) CompleteCompact ¶
func (p *VerifiableCredential) CompleteCompact(did string)
func (*VerifiableCredential) GetDIDProofInfo ¶
func (p *VerifiableCredential) GetDIDProofInfo() *CredentialProof
type VerifiableCredentialData ¶
type VerifiableCredentialData struct { Context []string `json:"@context,omitempty"` ID string `json:"id"` Type []string `json:"type,omitempty"` Issuer string `json:"issuer,omitempty"` IssuanceDate string `json:"issuanceDate,omitempty"` ExpirationDate string `json:"expirationDate,omitempty"` CredentialSubject interface{} `json:"credentialSubject,omitempty"` }
func (*VerifiableCredentialData) GetData ¶
func (p *VerifiableCredentialData) GetData() []byte
type VerifiableCredentialDoc ¶
type VerifiableCredentialDoc struct { *VerifiableCredentialData Proof CredentialProof `json:"proof,omitempty"` }
func (*VerifiableCredentialDoc) CompleteCompact ¶ added in v0.2.0
func (p *VerifiableCredentialDoc) CompleteCompact(did string)
type VerifiableCredentialSlice ¶ added in v0.1.3
type VerifiableCredentialSlice []VerifiableCredential
func (VerifiableCredentialSlice) Len ¶ added in v0.1.3
func (v VerifiableCredentialSlice) Len() int
func (VerifiableCredentialSlice) Less ¶ added in v0.1.3
func (v VerifiableCredentialSlice) Less(i, j int) bool
func (VerifiableCredentialSlice) Swap ¶ added in v0.1.3
func (v VerifiableCredentialSlice) Swap(i, j int)
type VerifiableCredentialTxData ¶
type VerifiableCredentialTxData struct { TXID string `json:"txid"` Timestamp string `json:"timestamp"` Operation DIDPayload `json:"operation"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.