Documentation ¶
Overview ¶
Created by guoxin in 2024/2/28 14:04
Index ¶
- Constants
- type CMDID
- type CMDIDOption
- type CMDIDOptionService
- func (cmDidOption CMDIDOptionService) AddBlackList(dids []string) error
- func (cmDidOption CMDIDOptionService) AddTrustIssuer(dids []string) error
- func (cmDidOption CMDIDOptionService) Delegate(delegateeDid string, resource string, action string, expiration int64) error
- func (cmDidOption CMDIDOptionService) DeleteBlackList(dids []string) error
- func (cmDidOption CMDIDOptionService) DeleteTrustIssuer(dids []string) error
- func (cmDidOption CMDIDOptionService) EmitAddBlackListEvent(dids []string)
- func (cmDidOption CMDIDOptionService) EmitAddTrustIssuerEvent(dids []string)
- func (cmDidOption CMDIDOptionService) EmitDelegateEvent(delegatorDid string, delegateeDid string, resource string, action string, ...)
- func (cmDidOption CMDIDOptionService) EmitDeleteBlackListEvent(dids []string)
- func (cmDidOption CMDIDOptionService) EmitDeleteTrustIssuerEvent(dids []string)
- func (cmDidOption CMDIDOptionService) EmitRevokeDelegateEvent(delegatorDid string, delegateeDid string, resource string, action string)
- func (cmDidOption CMDIDOptionService) EmitSetTrustRootListEvent(dids []string)
- func (cmDidOption CMDIDOptionService) EmitSetVcTemplateEvent(templateID string, templateName string, version string, vcTemplate string)
- func (cmDidOption CMDIDOptionService) EmitVcIssueLogEvent(issuer string, did string, templateID string, vcID string)
- func (cmDidOption CMDIDOptionService) GetBlackList(didSearch string, start int, count int) ([]string, error)
- func (cmDidOption CMDIDOptionService) GetDelegateList(delegatorDid, delegateeDid string, resource string, action string, start int, ...) ([]*DelegateInfo, error)
- func (cmDidOption CMDIDOptionService) GetTrustIssuer(didSearch string, start int, count int) ([]string, error)
- func (cmDidOption CMDIDOptionService) GetTrustRootList() (dids []string, err error)
- func (cmDidOption CMDIDOptionService) GetVcIssueLogs(issuer string, did string, templateID string, start int, count int) ([]*VcIssueLog, error)
- func (cmDidOption CMDIDOptionService) GetVcIssuers(did string) (issuerDid []string, err error)
- func (cmDidOption CMDIDOptionService) GetVcTemplate(id string, verison string) (*VcTemplate, error)
- func (cmDidOption CMDIDOptionService) GetVcTemplateList(nameSearch string, start int, count int) ([]*VcTemplate, error)
- func (cmDidOption CMDIDOptionService) RevokeDelegate(delegateeDid string, resource string, action string) error
- func (cmDidOption CMDIDOptionService) SetTrustRootList(dids []string) error
- func (cmDidOption CMDIDOptionService) SetVcTemplate(id string, name string, version string, vcType string, template string) error
- func (cmDidOption CMDIDOptionService) UpdateDidDocument(didDocument string) error
- func (cmDidOption CMDIDOptionService) VcIssueLog(issuer string, did string, templateID string, vcID string, issueTime string) error
- type CMDIDService
- func (cmDid CMDIDService) AddDidDocument(didDocument string) error
- func (cmDid CMDIDService) DidMethod() string
- func (cmDid CMDIDService) EmitRevokeVcEvent(vcID string)
- func (cmDid CMDIDService) EmitSetDidDocumentEvent(did string, didDocument string)
- func (cmDid CMDIDService) GetDidByAddress(address string) (string, error)
- func (cmDid CMDIDService) GetDidByPubkey(pk string) (string, error)
- func (cmDid CMDIDService) GetDidDocument(did string) (string, error)
- func (cmDid CMDIDService) GetRevokedVcList(vcIDSearch string, start int, count int) ([]string, error)
- func (cmDid CMDIDService) IsValidDid(did string) (bool, error)
- func (cmDid CMDIDService) RevokeVc(vcID string) error
- func (cmDid CMDIDService) VerifyVc(vcJson string) (bool, error)
- func (cmDid CMDIDService) VerifyVp(vpJson string) (bool, error)
- type DelegateInfo
- type VcIssueLog
- type VcTemplate
Constants ¶
const (
TRUE = "true"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CMDID ¶
type CMDID interface { // DidMethod 获取DID方法 DidMethod() string // IsValidDid 判断DID URL是否合法 IsValidDid(did string) (bool, error) // AddDidDocument 添加DID文档 AddDidDocument(didDocument string) error // GetDidDocument 根据DID URL获取DID文档 GetDidDocument(did string) (string, error) // GetDidByPubkey 根据公钥获取DID URL GetDidByPubkey(pk string) (string, error) // GetDidByAddress 根据地址获取DID URL GetDidByAddress(address string) (string, error) // VerifyVc 验证vc VerifyVc(vcJson string) (bool, error) // VerifyVp 验证vp VerifyVp(vpJson string) (bool, error) // EmitSetDidDocumentEvent 发送添加DID文档事件 EmitSetDidDocumentEvent(did string, didDocument string) // RevokeVc 撤销vc,撤销后的vc vp不能再被验证 RevokeVc(vcID string) error // GetRevokedVcList 获取撤销vc列表 GetRevokedVcList(vcIDSearch string, start int, count int) ([]string, error) // EmitRevokeVcEvent 发送撤销vc事件 EmitRevokeVcEvent(vcID string) }
CMDID 长安链DID https://git.chainmaker.org.cn/contracts/standard/-/blob/master/draft/CM-CS-221221-Identity.md
func NewCMDIDService ¶
func NewCMDIDService(cmClient sdk.SDKInterface, contractName string) CMDID
type CMDIDOption ¶
type CMDIDOption interface { // UpdateDidDocument 更新DID文档 UpdateDidDocument(didDocument string) error // AddBlackList 添加黑名单 AddBlackList(dids []string) error // DeleteBlackList 删除黑名单 DeleteBlackList(dids []string) error // GetBlackList 获取黑名单 GetBlackList(didSearch string, start int, count int) ([]string, error) // EmitAddBlackListEvent 发送添加黑名单事件 EmitAddBlackListEvent(dids []string) // EmitDeleteBlackListEvent 发送删除黑名单事件 EmitDeleteBlackListEvent(dids []string) // SetTrustRootList 设置信任根列表 SetTrustRootList(dids []string) error // GetTrustRootList 获取信任根列表 GetTrustRootList() (dids []string, err error) // EmitSetTrustRootListEvent 发送设置信任根列表事件 EmitSetTrustRootListEvent(dids []string) // AddTrustIssuer 添加信任的发行者 AddTrustIssuer(dids []string) error // DeleteTrustIssuer 删除信任的发行者 DeleteTrustIssuer(dids []string) error // GetTrustIssuer 获取信任的发行者 GetTrustIssuer(didSearch string, start int, count int) ([]string, error) // EmitAddTrustIssuerEvent 发送添加信任的发行者事件 EmitAddTrustIssuerEvent(dids []string) // EmitDeleteTrustIssuerEvent 发送删除信任的发行者事件 EmitDeleteTrustIssuerEvent(dids []string) // Delegate 给delegateeDid授权delegatorDid的资源代理权限,在有效期内,delegateeDid可以代理delegatorDid对resource的action操作 // @param delegateeDid 被授权者DID // @param resource 资源,一般是VcID // @param action 操作,一般是"issue"或"verify" // @param expiration 有效期,unix时间戳,0表示永久 Delegate(delegateeDid string, resource string, action string, expiration int64) error // EmitDelegateEvent 发送授权事件 EmitDelegateEvent(delegatorDid string, delegateeDid string, resource string, action string, start int64, expiration int64) // RevokeDelegate 撤销授权 RevokeDelegate(delegateeDid string, resource string, action string) error // EmitRevokeDelegateEvent 发送撤销授权事件 EmitRevokeDelegateEvent(delegatorDid string, delegateeDid string, resource string, action string) // GetDelegateList 查询授权列表 GetDelegateList(delegatorDid, delegateeDid string, resource string, action string, start int, count int) ([]*DelegateInfo, error) // SetVcTemplate 设置vc模板 SetVcTemplate(id string, name string, version string, vcType string, template string) error // GetVcTemplate 获取vc模板 GetVcTemplate(id string, version string) (*VcTemplate, error) // GetVcTemplateList 获取vc模板列表 GetVcTemplateList(nameSearch string, start int, count int) ([]*VcTemplate, error) // EmitSetVcTemplateEvent 发送设置vc模板事件 EmitSetVcTemplateEvent(templateID string, templateName string, version string, vcTemplate string) // VcIssueLog 记录vc发行日志 // @param issuer 必填,发行者DID // @param did 必填,vc持有者DID // @param templateID 选填,vc模板ID // @param vcID 必填,vcID或者vc hash VcIssueLog(issuer string, did string, templateID string, vcID string, issueTime string) error // GetVcIssueLogs 获取vc发行日志 GetVcIssueLogs(issuer string, did string, templateID string, start int, count int) ([]*VcIssueLog, error) // GetVcIssuers 根据持证人DID获取vc发行者DID列表 GetVcIssuers(did string) (issuerDid []string, err error) // EmitVcIssueLogEvent 发送vc发行日志事件 EmitVcIssueLogEvent(issuer string, did string, templateID string, vcID string) }
func NewCMDIDOptionService ¶
func NewCMDIDOptionService(cmClient sdk.SDKInterface, contractName string) CMDIDOption
type CMDIDOptionService ¶
type CMDIDOptionService struct {
// contains filtered or unexported fields
}
func (CMDIDOptionService) AddBlackList ¶
func (cmDidOption CMDIDOptionService) AddBlackList(dids []string) error
AddBlackList @Description 添加黑名单 @Author Oberl-Fitzgerald 2024-01-18 14:21:37 @Param dids []string @Return error
func (CMDIDOptionService) AddTrustIssuer ¶
func (cmDidOption CMDIDOptionService) AddTrustIssuer(dids []string) error
AddTrustIssuer @Description 添加信任的发行者 @Author Oberl-Fitzgerald 2024-01-17 16:28:33 @Param dids []string @Return error
func (CMDIDOptionService) Delegate ¶
func (cmDidOption CMDIDOptionService) Delegate(delegateeDid string, resource string, action string, expiration int64) error
Delegate @Description 给delegateeDid授权delegatorDid的资源代理权限,在有效期内,delegateeDid可以代理delegatorDid对resource的action操作 @Author Oberl-Fitzgerald 2024-01-18 14:32:45 @Param delegateeDid string @Param resource string @Param action string @Param expiration int64 @Return error
func (CMDIDOptionService) DeleteBlackList ¶
func (cmDidOption CMDIDOptionService) DeleteBlackList(dids []string) error
DeleteBlackList @Description 删除黑名单 @Author Oberl-Fitzgerald 2024-01-18 14:27:18 @Param dids []string @Return error
func (CMDIDOptionService) DeleteTrustIssuer ¶
func (cmDidOption CMDIDOptionService) DeleteTrustIssuer(dids []string) error
DeleteTrustIssuer @Description 删除信任的发行者 @Author Oberl-Fitzgerald 2024-01-17 16:43:07 @Param dids []string @Return error
func (CMDIDOptionService) EmitAddBlackListEvent ¶
func (cmDidOption CMDIDOptionService) EmitAddBlackListEvent(dids []string)
func (CMDIDOptionService) EmitAddTrustIssuerEvent ¶
func (cmDidOption CMDIDOptionService) EmitAddTrustIssuerEvent(dids []string)
func (CMDIDOptionService) EmitDelegateEvent ¶
func (CMDIDOptionService) EmitDeleteBlackListEvent ¶
func (cmDidOption CMDIDOptionService) EmitDeleteBlackListEvent(dids []string)
func (CMDIDOptionService) EmitDeleteTrustIssuerEvent ¶
func (cmDidOption CMDIDOptionService) EmitDeleteTrustIssuerEvent(dids []string)
func (CMDIDOptionService) EmitRevokeDelegateEvent ¶
func (cmDidOption CMDIDOptionService) EmitRevokeDelegateEvent(delegatorDid string, delegateeDid string, resource string, action string)
func (CMDIDOptionService) EmitSetTrustRootListEvent ¶
func (cmDidOption CMDIDOptionService) EmitSetTrustRootListEvent(dids []string)
func (CMDIDOptionService) EmitSetVcTemplateEvent ¶
func (cmDidOption CMDIDOptionService) EmitSetVcTemplateEvent(templateID string, templateName string, version string, vcTemplate string)
func (CMDIDOptionService) EmitVcIssueLogEvent ¶
func (cmDidOption CMDIDOptionService) EmitVcIssueLogEvent(issuer string, did string, templateID string, vcID string)
func (CMDIDOptionService) GetBlackList ¶
func (cmDidOption CMDIDOptionService) GetBlackList(didSearch string, start int, count int) ([]string, error)
GetBlackList @Description 获取黑名单 @Author Oberl-Fitzgerald 2024-01-18 14:25:04 @Param didSearch string @Param start int @Param count int @Return []string @Return error
func (CMDIDOptionService) GetDelegateList ¶
func (cmDidOption CMDIDOptionService) GetDelegateList(delegatorDid, delegateeDid string, resource string, action string, start int, count int) ([]*DelegateInfo, error)
GetDelegateList @Description 查询授权列表 @Author Oberl-Fitzgerald 2024-01-18 14:38:11 @Param delegatorDid string @Param delegateeDid string @Param resource string @Param action string @Param start int @Param count int @Return []*DelegateInfo @Return error
func (CMDIDOptionService) GetTrustIssuer ¶
func (cmDidOption CMDIDOptionService) GetTrustIssuer(didSearch string, start int, count int) ( []string, error)
GetTrustIssuer @Description 获取信任的发行者 @Author Oberl-Fitzgerald 2024-01-17 16:43:02 @Param didSearch string @Param start int @Param count int @Return []string @Return error
func (CMDIDOptionService) GetTrustRootList ¶
func (cmDidOption CMDIDOptionService) GetTrustRootList() (dids []string, err error)
GetTrustRootList @Description 获取信任根列表 @Author Oberl-Fitzgerald 2024-01-18 14:31:30 @Return dids @Return err
func (CMDIDOptionService) GetVcIssueLogs ¶
func (cmDidOption CMDIDOptionService) GetVcIssueLogs(issuer string, did string, templateID string, start int, count int) ([]*VcIssueLog, error)
GetVcIssueLogs @Description 获取vc发行日志 @Author Oberl-Fitzgerald 2024-01-18 15:13:32 @Param issuer string @Param did string @Param templateID string @Param start int @Param count int @Return []*VcIssueLog @Return error
func (CMDIDOptionService) GetVcIssuers ¶
func (cmDidOption CMDIDOptionService) GetVcIssuers(did string) (issuerDid []string, err error)
GetVcIssuers @Description 根据持证人DID获取vc发行者DID列表 @Author Oberl-Fitzgerald 2024-01-18 15:24:22 @Param did string @Return issuerDid @Return err
func (CMDIDOptionService) GetVcTemplate ¶
func (cmDidOption CMDIDOptionService) GetVcTemplate(id string, verison string) (*VcTemplate, error)
GetVcTemplate @Description 获取vc模板 @Author Oberl-Fitzgerald 2024-01-16 17:29:42 @Param id string @Return *VcTemplate @Return error
func (CMDIDOptionService) GetVcTemplateList ¶
func (cmDidOption CMDIDOptionService) GetVcTemplateList(nameSearch string, start int, count int) ( []*VcTemplate, error)
GetVcTemplateList @Description 获取vc模板列表 @Author Oberl-Fitzgerald 2024-01-17 17:31:33 @Param nameSearch string @Param start int @Param count int @Return []*VcTemplate @Return error
func (CMDIDOptionService) RevokeDelegate ¶
func (cmDidOption CMDIDOptionService) RevokeDelegate(delegateeDid string, resource string, action string) error
RevokeDelegate @Description 撤销授权 @Author Oberl-Fitzgerald 2024-01-18 15:31:46 @Param delegateeDid string @Param resource string @Param action string @Return error
func (CMDIDOptionService) SetTrustRootList ¶
func (cmDidOption CMDIDOptionService) SetTrustRootList(dids []string) error
SetTrustRootList @Description 设置信任根列表 @Author Oberl-Fitzgerald 2024-01-18 14:30:23 @Param dids []string @Return error
func (CMDIDOptionService) SetVcTemplate ¶
func (cmDidOption CMDIDOptionService) SetVcTemplate(id string, name string, version string, vcType string, template string) error
SetVcTemplate @Description 设置vc模板 @Author Oberl-Fitzgerald 2024-01-16 17:29:38 @Param id string @Param name string @Param version string @Param template string @Return error
func (CMDIDOptionService) UpdateDidDocument ¶
func (cmDidOption CMDIDOptionService) UpdateDidDocument(didDocument string) error
UpdateDidDocument @Description 更新DID文档 @Author Oberl-Fitzgerald 2024-01-17 09:53:01 @Param didDocument string @Return error
func (CMDIDOptionService) VcIssueLog ¶
func (cmDidOption CMDIDOptionService) VcIssueLog(issuer string, did string, templateID string, vcID string, issueTime string) error
VcIssueLog @Description 记录vc发行日志 @Author Oberl-Fitzgerald 2024-01-18 14:04:04 @Param issuer string @Param did string @Param templateID string @Param vcID string @Return error
type CMDIDService ¶
type CMDIDService struct {
// contains filtered or unexported fields
}
func (CMDIDService) AddDidDocument ¶
func (cmDid CMDIDService) AddDidDocument(didDocument string) error
AddDidDocument @Description 添加DID文档 @Author Oberl-Fitzgerald 2024-01-16 15:03:33 @Param didDocument string @Return error
func (CMDIDService) DidMethod ¶
func (cmDid CMDIDService) DidMethod() string
DidMethod @Description 获取DID Method @Author Oberl-Fitzgerald 2024-01-16 14:57:26 @Return string
func (CMDIDService) EmitRevokeVcEvent ¶
func (cmDid CMDIDService) EmitRevokeVcEvent(vcID string)
func (CMDIDService) EmitSetDidDocumentEvent ¶
func (cmDid CMDIDService) EmitSetDidDocumentEvent(did string, didDocument string)
func (CMDIDService) GetDidByAddress ¶
func (cmDid CMDIDService) GetDidByAddress(address string) (string, error)
GetDidByAddress @Description 根据地址获取DID URL @Author Oberl-Fitzgerald 2024-01-16 17:03:05 @Param address string @Return string @Return error
func (CMDIDService) GetDidByPubkey ¶
func (cmDid CMDIDService) GetDidByPubkey(pk string) (string, error)
GetDidByPubkey @Description 根据公钥获取DID URL @Author Oberl-Fitzgerald 2024-01-16 17:03:40 @Param pk string @Return string @Return error
func (CMDIDService) GetDidDocument ¶
func (cmDid CMDIDService) GetDidDocument(did string) (string, error)
GetDidDocument @Description 根据DID URL获取DID文档 @Author Oberl-Fitzgerald 2024-01-16 15:57:18 @Param did string @Return string @Return error
func (CMDIDService) GetRevokedVcList ¶
func (cmDid CMDIDService) GetRevokedVcList(vcIDSearch string, start int, count int) ([]string, error)
GetRevokedVcList @Description 获取撤销vc列表 @Author Oberl-Fitzgerald 2024-01-18 11:36:31 @Param vcIDSearch string @Param start int @Param count int @Return []string @Return error
func (CMDIDService) IsValidDid ¶
func (cmDid CMDIDService) IsValidDid(did string) (bool, error)
IsValidDid @Description 判断DID URL是否合法 @Author Oberl-Fitzgerald 2024-01-16 14:57:31 @Param did string @Return bool @Return error
func (CMDIDService) RevokeVc ¶
func (cmDid CMDIDService) RevokeVc(vcID string) error
RevokeVc @Description 撤销vc,撤销后的vc vp不能再被验证 @Author Oberl-Fitzgerald 2024-01-18 11:29:25 @Param vcID string @Return error
func (CMDIDService) VerifyVc ¶
func (cmDid CMDIDService) VerifyVc(vcJson string) (bool, error)
VerifyVc @Description 验证vc @Author Oberl-Fitzgerald 2024-01-18 11:05:21 @Param vcJson string @Return bool @Return error
func (CMDIDService) VerifyVp ¶
func (cmDid CMDIDService) VerifyVp(vpJson string) (bool, error)
VerifyVp @Description 验证vp @Author Oberl-Fitzgerald 2024-01-18 11:05:49 @Param vpJson string @Return bool @Return error
type DelegateInfo ¶
type DelegateInfo struct { // DelegatorDid 授权者DID DelegatorDid string `json:"delegatorDid"` // DelegateeDid 被授权者DID DelegateeDid string `json:"delegateeDid"` // Resource 资源,一般是VcID Resource string `json:"resource"` // Action 操作,一般是"issue"或"verify" Action string `json:"action"` // StartTime 授权开始时间 StartTime int64 `json:"startTime"` // Expiration 授权结束时间 Expiration int64 `json:"expiration"` }
DelegateInfo 授权信息
type VcIssueLog ¶
type VcIssueLog struct { // Issuer 发行者DID Issuer string `json:"issuer"` // Did vc持有者DID Did string `json:"did"` // TemplateId vc模板ID TemplateId string `json:"templateID"` // VcID vcID或者vc hash VcID string `json:"vcID"` // IssueTime 发行上链时间 IssueTime int64 `json:"issueTime"` }
VcIssueLog 记录vc发行日志
Directories ¶
Path | Synopsis |
---|---|
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |