Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) Close()
- func (c *Client) DocumentGet(did string) (*core.Document, string, int32)
- func (c *Client) FindCompanyNameByDid(req *module.DidInfo) (*module.CompanyInfo, string, int32)
- func (c *Client) FindDidByCompanyName(req *module.CompanyInfo) (*module.DidInfo, string, int32)
- func (c *Client) Health() (*response.Health, string, int32)
- func (c *Client) Login(phoneNumber, password string) (*response.Login, string, int32)
- func (c *Client) MsgDecrypt(req *module.Ciphertext) (*module.Plaintext, string, int32)
- func (c *Client) MsgEncrypt(req *module.Plaintext) (*module.Ciphertext, string, int32)
- func (c *Client) MsgSign(req *module.Plaintext) (*module.Plaintext, string, int32)
- func (c *Client) MsgVerify(req *module.Plaintext) (bool, string, int32)
- func (c *Client) VcGet(id string) (*response.VcInfo, string, int32)
- func (c *Client) VcIssue(req *request.VcIssue) (*core.VerifiableCredential, string, int32)
- func (c *Client) VcList(req *core.VerifiablePresentation) (*response.VcPage, string, int32)
- func (c *Client) VcListIssued(req *request.Holder) (*response.VcPage, string, int32)
- func (c *Client) VcListLatest(issuer string, limit int) (bool, string, int32)
- func (c *Client) VcListLocal(req *request.VcListLocal) (*response.VcPage, string, int32)
- func (c *Client) VcListRevoked(req *request.Holder) (*response.VcPage, string, int32)
- func (c *Client) VcRevoke(id string) (bool, string, int32)
- func (c *Client) VcTemplateCreate(req *request.VctCreate) (*response.VctId, string, int32)
- func (c *Client) VcTemplateList(req *request.VctList) (*response.VctList, string, int32)
- func (c *Client) VpCreateApplyBusinessLicense(req *core.VerifiablePresentation) (*core.VerifiablePresentation, string, int32)
- func (c *Client) VpCreateApplyLogin(req *core.VerifiablePresentation) (*core.VerifiablePresentation, string, int32)
- func (c *Client) VpSign(req *core.VerifiablePresentation) (*core.VerifiablePresentation, string, int32)
- func (c *Client) VpVerify(vp *core.VerifiablePresentation) (bool, string, int32)
- func (c *Client) VpVerifyString(vp string) (bool, string, int32)
- type ClientConfig
- type ClientInterface
- type ClientOption
Constants ¶
const ( // DefaultConnTimeout 默认连接超时时间 5s DefaultConnTimeout = 5000 // DefaultRespTimeout 默认响应超时时间 10s DefaultRespTimeout = 10000 // DefaultDisableRequestLog 默认是否关闭打印请求日志 DefaultDisableRequestLog = false )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewDIDClient ¶
func NewDIDClient(opts ...ClientOption) (*Client, error)
func (*Client) DocumentGet ¶
DocumentGet - 查询Did @param did did名称 @return *core.Document Did文档 @return string 错误信息 @return int 错误码
func (*Client) FindCompanyNameByDid ¶
FindCompanyNameByDid - 根据DID精确匹配企业信息,获取企业名称 @param *module.DidInfo 企业DID @return *module.CompanyInfo 企业名称 @return string 错误信息 @return int 错误码
func (*Client) FindDidByCompanyName ¶
FindDidByCompanyName - 根据企业名称精确匹配企业信息,获取DID @param *module.CompanyInfo 企业名称 @return *module.DidInfo 企业DID @return string 错误信息 @return int 错误码
func (*Client) Health ¶
Health - 健康检查 @return *response.Health 包含版本号和系统名称 @return string 错误信息 @return int 错误码
func (*Client) Login ¶
Login - 登录 @param phoneNumber手机号 password密码 @return *response.Login 登录信息 @return string 错误信息 @return int 错误码
func (*Client) MsgDecrypt ¶
MsgDecrypt - 私钥解密 @param *module.Ciphertext 密文信息 @return *module.Plaintext 明文 @return string 错误信息 @return int 错误码
func (*Client) MsgEncrypt ¶
MsgEncrypt - 公钥加密 @param plaintext *module.Plaintext 明文信息 @return *module.Cipher 密文 @return string 错误信息 @return int 错误码
func (*Client) MsgSign ¶
MsgSign - 签名 @param *module.Plaintext 明文 @return *module.Plaintext 签名信息 @return string 错误信息 @return int 错误码
func (*Client) MsgVerify ¶
MsgVerify - 验证签名 @param plaintext 明文信息 @return bool 是否验证通过 @return string 错误信息 @return int 错误码
func (*Client) VcGet ¶
VcGet - 根据ID查询VC @param id VcId @return *response.VcInfo 凭证以及凭证状态 @return string 错误信息 @return int 错误码
func (*Client) VcIssue ¶
VcIssue - 颁发凭证 @param *request.VcIssue 凭证信息 @return *core.VerifiableCredential 凭证信息 @return string 错误信息 @return int 错误码
func (*Client) VcList ¶
VcList - 查询VC列表 @param *core.VerifiablePresentation VP @return *response.VcPage VC列表 @return string 错误信息 @return int 错误码
func (*Client) VcListIssued ¶
VcListIssued - 查询已颁发的凭证 @param req *request.Holder 持有人信息 @return *response.VcPage 已颁发的凭证列表 @return string 错误信息 @return int 错误码
func (*Client) VcListLatest ¶
VcListLatest - 更新VC列表 @param issuer 发证人, limit 限制条数 @return bool 是否更新成功 @return string 错误信息 @return int 错误码
func (*Client) VcListLocal ¶
VcListLocal - 查询本地VC列表 @param *request.VcListLocal 请求信息 @return *response.VcPage VC列表 @return string 错误信息 @return int 错误码
func (*Client) VcListRevoked ¶
VcListRevoked - 查询已撤销的凭证 @param req *request.Holder 持有人信息 @return *response.VcPage 已颁发的凭证列表 @return string 错误信息 @return int 错误码
func (*Client) VcRevoke ¶
VcRevoke - 撤销凭证 @param id 凭证ID @return bool 是否撤销成功 @return string 错误信息 @return int 错误码
func (*Client) VcTemplateCreate ¶
VcTemplateCreate - 申请VC模板 @param *request.VctCreate 请求信息 @return *response.VctCreate VC模板信息 @return string 错误信息 @return int 错误码
func (*Client) VcTemplateList ¶
VcTemplateList - 查询VC模板列表 @param *request.VctList 请求信息 @return *response.VctList VC模板列表 @return string 错误信息 @return int 错误码
func (*Client) VpCreateApplyBusinessLicense ¶
func (c *Client) VpCreateApplyBusinessLicense(req *core.VerifiablePresentation) (*core.VerifiablePresentation, string, int32)
VpCreateApplyBusinessLicense - 生成请求企业实名VP @param *core.VerifiablePresentation 请求信息 @return *core.VerifiablePresentation VP信息 @return string 错误信息 @return int 错误码
func (*Client) VpCreateApplyLogin ¶
func (c *Client) VpCreateApplyLogin(req *core.VerifiablePresentation) (*core.VerifiablePresentation, string, int32)
VpCreateApplyLogin - 生成请求登录VP @param *core.VerifiablePresentation 请求信息 @return *core.VerifiablePresentation VP信息 @return string 错误信息 @return int 错误码
func (*Client) VpSign ¶
func (c *Client) VpSign(req *core.VerifiablePresentation) (*core.VerifiablePresentation, string, int32)
VpSign - 签名VP @param *core.VerifiablePresentation VP信息 @return *core.VerifiablePresentation VP @return string 错误信息 @return int 错误码
func (*Client) VpVerify ¶
VpVerify - 验证VP @param vp VP信息 @return bool 是否验证通过 @return string 错误信息 @return int 错误码
type ClientConfig ¶
type ClientConfig struct {
// contains filtered or unexported fields
}
type ClientInterface ¶
type ClientInterface interface { Close() // Login - 使用用户名密码登录获取token Login(phoneNumber, password string) (*response.Login, string, int32) // DocumentGet - 根据did查询文档 DocumentGet(did string) (*core.Document, string, int32) // MsgVerify - 使用公钥验签 MsgVerify(req *module.Plaintext) (bool, string, int32) // VpVerify - 传入VP验证签名是否合法 VpVerify(vp *core.VerifiablePresentation) (bool, string, int32) // Health - 健康检查 Health() (*response.Health, string, int32) // VcIssue - 给某DID颁发一个凭证 VcIssue(req *request.VcIssue) (*core.VerifiableCredential, string, int32) // VcRevoke - 吊销本机构颁发的VC VcRevoke(id string) (bool, string, int32) // VcListIssued - 内部调用查询本DID颁发的VC VcListIssued(req *request.Holder) (*response.VcPage, string, int32) // VcListRevoked - 内部调用查询本DID已吊销的VC VcListRevoked(req *request.Holder) (*response.VcPage, string, int32) // VcGet - 根据ID查询VC VcGet(id string) (*response.VcInfo, string, int32) // VcList - 查询该DID拥有的VC凭证 VcList(req *core.VerifiablePresentation) (*response.VcPage, string, int32) // VcTemplateCreate - 申请VCT VcTemplateCreate(req *request.VctCreate) (*response.VctId, string, int32) // VcTemplateList - VcTemplateList(req *request.VctList) (*response.VctList, string, int32) // VpSign - 根据入参,生成一个VP对象 VpSign(req *core.VerifiablePresentation) (*core.VerifiablePresentation, string, int32) // MsgSign - 使用DID的私钥签名 MsgSign(req *module.Plaintext) (*module.Plaintext, string, int32) // MsgEncrypt - 使用公钥加密 MsgEncrypt(req *module.Plaintext) (*module.Ciphertext, string, int32) // MsgDecrypt - 使用私钥解密 MsgDecrypt(req *module.Ciphertext) (*module.Plaintext, string, int32) // VcListLatest - 更新拥有的VC列表 VcListLatest(issuer string, limit int) (bool, string, int32) // VcListLocal - 本地查询拥有VC VcListLocal(req *request.VcListLocal) (*response.VcPage, string, int32) // VpCreateApplyLogin - 生成请求登录VP VpCreateApplyLogin(req *core.VerifiablePresentation) (*core.VerifiablePresentation, string, int32) // VpCreateApplyBusinessLicense - 生成请求企业实名VP VpCreateApplyBusinessLicense(req *core.VerifiablePresentation) (*core.VerifiablePresentation, string, int32) // FindDidByCompanyName - 根据企业名称精确匹配企业信息,获取DID FindDidByCompanyName(req *module.CompanyInfo) (*module.DidInfo, string, int32) // FindCompanyNameByDid - 根据DID精确匹配企业信息,获取企业名称 FindCompanyNameByDid(req *module.DidInfo) (*module.CompanyInfo, string, int32) }
type ClientOption ¶
type ClientOption func(config *ClientConfig)
ClientOption define client option func