Documentation
¶
Index ¶
- Constants
- func CreateExpirationDate() string
- func CreateId() string
- func NewApplyBusinessLicenseVP(vc []*core.VerifiableCredential, proof []*core.Proof, ...) *core.VerifiablePresentation
- func NewApplyLoginVP(vc []*core.VerifiableCredential, proof []*core.Proof, extend interface{}) *core.VerifiablePresentation
- func NewSignProof(proofType, created, verificationMethod string) *core.Proof
- func NewSignVP(vc []*core.VerifiableCredential, proof []*core.Proof, extend interface{}) *core.VerifiablePresentation
- type ApplyBusinessLicenseExtend
- func (e *ApplyBusinessLicenseExtend) GetAuthorizedName() string
- func (e *ApplyBusinessLicenseExtend) GetAuthorizedNameEn() string
- func (e *ApplyBusinessLicenseExtend) GetCallBackUrl() string
- func (e *ApplyBusinessLicenseExtend) GetIssuer() []string
- func (e *ApplyBusinessLicenseExtend) GetMethod() string
- func (e *ApplyBusinessLicenseExtend) GetRequestId() string
- func (e *ApplyBusinessLicenseExtend) GetVctId() []string
- func (e *ApplyBusinessLicenseExtend) SetAuthorizedName(authorizedName string)
- func (e *ApplyBusinessLicenseExtend) SetAuthorizedNameEn(authorizedNameEn string)
- func (e *ApplyBusinessLicenseExtend) SetCallBackUrl(callBackUrl string)
- func (e *ApplyBusinessLicenseExtend) SetIssuer(issuer []string)
- func (e *ApplyBusinessLicenseExtend) SetMethod(method string)
- func (e *ApplyBusinessLicenseExtend) SetRequestId(requestId string)
- func (e *ApplyBusinessLicenseExtend) SetVctId(vctId []string)
- type ApplyLoginExtend
- func (e *ApplyLoginExtend) GetAuthorizedName() string
- func (e *ApplyLoginExtend) GetAuthorizedNameEn() string
- func (e *ApplyLoginExtend) GetCallBackUrl() string
- func (e *ApplyLoginExtend) GetMethod() string
- func (e *ApplyLoginExtend) GetRequestId() string
- func (e *ApplyLoginExtend) SetAuthorizedName(authorizedName string)
- func (e *ApplyLoginExtend) SetAuthorizedNameEn(authorizedNameEn string)
- func (e *ApplyLoginExtend) SetCallBackUrl(callbackUrl string)
- func (e *ApplyLoginExtend) SetMethod(method string)
- func (e *ApplyLoginExtend) SetRequestId(requestId string)
- type Ciphertext
- func (c *Ciphertext) GetCiphertext() string
- func (c *Ciphertext) GetCreated() string
- func (c *Ciphertext) GetType() string
- func (c *Ciphertext) GetVerificationMethod() string
- func (c *Ciphertext) SetCiphertext(ciphertext string)
- func (c *Ciphertext) SetCreated(created string)
- func (c *Ciphertext) SetType(t string)
- func (c *Ciphertext) SetVerificationMethod(verificationMethod string)
- type CompanyInfo
- type DidInfo
- type Page
- type Plaintext
- func NewMsgEncrypt(plaintext, verificationMethod, encryptType string) *Plaintext
- func NewMsgEncryptWithBase64(plaintext, verificationMethod, encryptType string) *Plaintext
- func NewMsgSign(plaintext, verificationMethod, signType string) *Plaintext
- func NewMsgSignWithBase64(plaintext, verificationMethod, signType string) *Plaintext
- func NewMsgVerifyReq(plaintext, signature, verificationMethod, verifyType string) *Plaintext
- func (p *Plaintext) GetCreated() string
- func (p *Plaintext) GetPlaintext() string
- func (p *Plaintext) GetSignature() string
- func (p *Plaintext) GetType() string
- func (p *Plaintext) GetVerificationMethod() string
- func (p *Plaintext) SetCreated(created string)
- func (p *Plaintext) SetPlaintext(plaintext string)
- func (p *Plaintext) SetSignature(signature string)
- func (p *Plaintext) SetType(t string)
- func (p *Plaintext) SetVerificationMethod(verificationMethod string)
- type VcListExtend
- func (e *VcListExtend) GetIssuer() string
- func (e *VcListExtend) GetPage() *Page
- func (e *VcListExtend) GetStatus() string
- func (e *VcListExtend) GetTemplateId() string
- func (e *VcListExtend) SetIssuer(issuer string)
- func (e *VcListExtend) SetPage(page *Page)
- func (e *VcListExtend) SetStatus(status string)
- func (e *VcListExtend) SetTemplateId(templateId string)
Constants ¶
const ( // SUCCESS is the success code SUCCESS = 200000 // ErrorParamNullCode is the error code for null parameter ErrorParamNullCode = 301000 // ErrorParamNullMsg is the error message for null parameter ErrorParamNullMsg = "param is null" // ErrorParamFmtCode is the error code for parameter format error ErrorParamFmtCode = 301001 // ErrorParamFmtMsg is the error message for parameter format error ErrorParamFmtMsg = "param fmt error" // ErrorDataExpirationCode is the error code for time expiration error ErrorDataExpirationCode = 301002 // ErrorDataExpirationMsg is the error message for time expiration error ErrorDataExpirationMsg = "The expiration time has passed" // ErrorNetworkCode is the error code for network error ErrorNetworkCode = 303000 // ErrorNetworkMsg is the error message for network error ErrorNetworkMsg = "network error" )
const ( // SM2VerificationKey2023 is the default msgVerify algorithm SM2VerificationKey2023 = "SM2VerificationKey2023" // SM2Signature is the default msgSign algorithm SM2Signature = "SM2Signature" // SM2C1C3C2 is the default msgEncrypt and msgDecrypt algorithm SM2C1C3C2 = "SM2C1C3C2" )
const ( ProofPurpose = "authentication" VPType = "VerifiablePresentation" BusinessLicenseVCTCode = "100001" ApplyLoginUsage = "DID_LOGIN_REQUEST" LoginResp = "DID_LOGIN_RESPONSE" GetVcReq = "DID_GET_VC_REQUEST" GetVcResp = "DID_GET_VC_RESPONSE" ApplyBusinessLicenseUsage = "DID_GET_IDENTITY_VC_REQUEST" GetIdentityVcResp = "DID_GET_IDENTITY_VC_RESPONSE" TdhApplyAuth = "TDH_APPLY_AUTH_REQUEST" TdhGetAuthTo = "TDH_GET_AUTH_TO_REQUEST" ApplyInvitationCodeCallback = "DID_APPLY_INVITATION_CODE_CALLBACK" )
const ( LoginUrl = apiPrefix + "/login" DocumentGetUrl = apiPrefix + "/document/get" MsgVerifyUrl = apiPrefix + "/msg/verify" VpVerifyUrl = apiPrefix + "/vp/verify" HealthUrl = apiPrefix + "/health" VcIssueUrl = apiPrefix + "/vc/issue" VcRevokeUrl = apiPrefix + "/vc/revoke" VcListIssuedUrl = apiPrefix + "/vc/list/issued" VcListRevokedUrl = apiPrefix + "/vc/list/revoked" VcGetUrl = apiPrefix + "/vc/get" VcListUrl = apiPrefix + "/vc/list" VcTemplateCreateUrl = apiPrefix + "/vctemplate/create" VcTemplateListUrl = apiPrefix + "/vctemplate/list" VpSignUrl = apiPrefix + "/vp/sign" MsgSignUrl = apiPrefix + "/msg/sign" MsgEncryptUrl = apiPrefix + "/msg/encrypt" MsgDecryptUrl = apiPrefix + "/msg/decrypt" VcListLatestUrl = apiPrefix + "/vc/list/latest" VcListLocalUrl = apiPrefix + "/vc/list/local" FindDidByCompanyName = apiDidPrefix + "/vc/find-did-by-company-name" FindCompanyNameByDid = apiDidPrefix + "/vc/find-company-name-by-did" )
const (
// IdentityCredential is the default type of VCTemplate
IdentityCredential = "IdentityCredential"
)
Variables ¶
This section is empty.
Functions ¶
func CreateExpirationDate ¶
func CreateExpirationDate() string
CreateExpirationDate create expiration date, the default expiration time is 5 minutes
func CreateId ¶
func CreateId() string
CreateId create id, the default id is the current time + 8 random characters
func NewApplyBusinessLicenseVP ¶
func NewApplyBusinessLicenseVP(vc []*core.VerifiableCredential, proof []*core.Proof, extend *ApplyBusinessLicenseExtend) *core.VerifiablePresentation
NewApplyBusinessLicenseVP create a new VerifiablePresentation for the ApplyBusinessLicense request.
func NewApplyLoginVP ¶
func NewApplyLoginVP(vc []*core.VerifiableCredential, proof []*core.Proof, extend interface{}) *core.VerifiablePresentation
NewApplyLoginVP create a new VerifiablePresentation for the ApplyLogin request.
func NewSignProof ¶
NewSignProof create a new Proof with the given type, created, creator and domain.
func NewSignVP ¶
func NewSignVP(vc []*core.VerifiableCredential, proof []*core.Proof, extend interface{}) *core.VerifiablePresentation
NewSignVP create a new VerifiablePresentation with the given VerifiableCredential and Proof.
Types ¶
type ApplyBusinessLicenseExtend ¶
type ApplyBusinessLicenseExtend struct { AuthorizedName string `json:"authorizedName"` // 请求授权的平台的名称 AuthorizedNameEn string `json:"authorizedNameEn"` // 请求授权的平台的名称 CallbackUrl string `json:"callbackUrl"` // 回调地址 Issuer []string `json:"issuer,omitempty"` // 发行者 Method string `json:"method"` // http方式, GET/POST 默认GET RequestId string `json:"requestId"` // 请求ID VctId []string `json:"vctId,omitempty"` // 凭证类型ID }
ApplyBusinessLicenseExtend is the extend field of the VerifiablePresentation for the ApplyBusinessLicense request.
func NewApplyBusinessLicenseExtend ¶
func NewApplyBusinessLicenseExtend(vctId, issuer []string, authorizedName, authorizedNameEn, requestId, method, callbackUrl string) *ApplyBusinessLicenseExtend
NewApplyBusinessLicenseExtend create a new ApplyBusinessLicenseExtend with the given vctId, issuer, callbackUrl and requestId.
func (*ApplyBusinessLicenseExtend) GetAuthorizedName ¶
func (e *ApplyBusinessLicenseExtend) GetAuthorizedName() string
GetAuthorizedName get the authorizedName field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) GetAuthorizedNameEn ¶
func (e *ApplyBusinessLicenseExtend) GetAuthorizedNameEn() string
GetAuthorizedNameEn get the authorizedNameEn field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) GetCallBackUrl ¶
func (e *ApplyBusinessLicenseExtend) GetCallBackUrl() string
GetCallBackUrl get the callBackUrl field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) GetIssuer ¶
func (e *ApplyBusinessLicenseExtend) GetIssuer() []string
GetIssuer get the issuer field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) GetMethod ¶
func (e *ApplyBusinessLicenseExtend) GetMethod() string
GetMethod get the method field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) GetRequestId ¶
func (e *ApplyBusinessLicenseExtend) GetRequestId() string
GetRequestId get the requestId field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) GetVctId ¶
func (e *ApplyBusinessLicenseExtend) GetVctId() []string
GetVctId get the vctId field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) SetAuthorizedName ¶
func (e *ApplyBusinessLicenseExtend) SetAuthorizedName(authorizedName string)
SetAuthorizedName set the authorizedName field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) SetAuthorizedNameEn ¶
func (e *ApplyBusinessLicenseExtend) SetAuthorizedNameEn(authorizedNameEn string)
SetAuthorizedNameEn set the authorizedNameEn field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) SetCallBackUrl ¶
func (e *ApplyBusinessLicenseExtend) SetCallBackUrl(callBackUrl string)
SetCallBackUrl set the callBackUrl field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) SetIssuer ¶
func (e *ApplyBusinessLicenseExtend) SetIssuer(issuer []string)
SetIssuer set the issuer field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) SetMethod ¶
func (e *ApplyBusinessLicenseExtend) SetMethod(method string)
SetMethod set the method field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) SetRequestId ¶
func (e *ApplyBusinessLicenseExtend) SetRequestId(requestId string)
SetRequestId set the requestId field of the ApplyBusinessLicenseExtend.
func (*ApplyBusinessLicenseExtend) SetVctId ¶
func (e *ApplyBusinessLicenseExtend) SetVctId(vctId []string)
SetVctId set the vctId field of the ApplyBusinessLicenseExtend.
type ApplyLoginExtend ¶
type ApplyLoginExtend struct { AuthorizedName string `json:"authorizedName"` // 请求授权的平台的名称 AuthorizedNameEn string `json:"authorizedNameEn"` // 请求授权的平台的名称 CallbackUrl string `json:"callbackUrl,omitempty"` // 回调地址 Method string `json:"method"` // http方式, GET/POST 默认GET RequestId string `json:"requestId,omitempty"` // 请求ID }
ApplyLoginExtend is the extend field of the VerifiablePresentation for the ApplyLogin request.
func NewApplyLoginExtend ¶
func NewApplyLoginExtend(authorizedName, authorizedNameEn, requestId, method, callbackUrl string) *ApplyLoginExtend
NewApplyLoginExtend create a new ApplyLoginExtend with the given requestId, method and callbackUrl.
func (*ApplyLoginExtend) GetAuthorizedName ¶
func (e *ApplyLoginExtend) GetAuthorizedName() string
GetAuthorizedName get the authorizedName field of the ApplyLoginExtend.
func (*ApplyLoginExtend) GetAuthorizedNameEn ¶
func (e *ApplyLoginExtend) GetAuthorizedNameEn() string
GetAuthorizedNameEn get the authorizedNameEn field of the ApplyLoginExtend.
func (*ApplyLoginExtend) GetCallBackUrl ¶
func (e *ApplyLoginExtend) GetCallBackUrl() string
GetCallBackUrl get the callBackUrl field of the ApplyLoginExtend.
func (*ApplyLoginExtend) GetMethod ¶
func (e *ApplyLoginExtend) GetMethod() string
GetMethod get the method field of the ApplyLoginExtend.
func (*ApplyLoginExtend) GetRequestId ¶
func (e *ApplyLoginExtend) GetRequestId() string
GetRequestId get the requestId field of the ApplyLoginExtend.
func (*ApplyLoginExtend) SetAuthorizedName ¶
func (e *ApplyLoginExtend) SetAuthorizedName(authorizedName string)
SetAuthorizedName set the authorizedName field of the ApplyLoginExtend.
func (*ApplyLoginExtend) SetAuthorizedNameEn ¶
func (e *ApplyLoginExtend) SetAuthorizedNameEn(authorizedNameEn string)
SetAuthorizedNameEn set the authorizedNameEn field of the ApplyLoginExtend.
func (*ApplyLoginExtend) SetCallBackUrl ¶
func (e *ApplyLoginExtend) SetCallBackUrl(callbackUrl string)
SetCallBackUrl set the callBackUrl field of the ApplyLoginExtend.
func (*ApplyLoginExtend) SetMethod ¶
func (e *ApplyLoginExtend) SetMethod(method string)
SetMethod set the method field of the ApplyLoginExtend.
func (*ApplyLoginExtend) SetRequestId ¶
func (e *ApplyLoginExtend) SetRequestId(requestId string)
SetRequestId set the requestId field of the ApplyLoginExtend.
type Ciphertext ¶
type Ciphertext struct { Ciphertext string `json:"ciphertext"` // 密文 VerificationMethod string `json:"verificationMethod"` // 公钥地址 Type string `json:"type,omitempty"` // 算法类型 Created string `json:"created,omitempty"` // 创建时间 }
Ciphertext define Ciphertext
func NewMsgDecrypt ¶
func NewMsgDecrypt(ciphertext, verificationMethod, decryptType string) *Ciphertext
NewMsgDecrypt return Ciphertext, the default Type is SM2C1C3C2
func (*Ciphertext) GetCiphertext ¶
func (c *Ciphertext) GetCiphertext() string
GetCiphertext return ciphertext
func (*Ciphertext) GetVerificationMethod ¶
func (c *Ciphertext) GetVerificationMethod() string
GetVerificationMethod return verification method
func (*Ciphertext) SetCiphertext ¶
func (c *Ciphertext) SetCiphertext(ciphertext string)
SetCiphertext set ciphertext
func (*Ciphertext) SetCreated ¶
func (c *Ciphertext) SetCreated(created string)
SetCreated set created
func (*Ciphertext) SetVerificationMethod ¶
func (c *Ciphertext) SetVerificationMethod(verificationMethod string)
SetVerificationMethod set verification method
type CompanyInfo ¶
type CompanyInfo struct {
CompanyName string `json:"companyName"` // companyName
}
CompanyInfo define the request structure of DocumentGet, used to get did
func (*CompanyInfo) GetCompanyName ¶
func (c *CompanyInfo) GetCompanyName() string
GetCompanyName return companyName
func (*CompanyInfo) SetCompanyName ¶
func (c *CompanyInfo) SetCompanyName(companyName string)
SetCompanyName set companyName
type DidInfo ¶
type DidInfo struct {
Did string `json:"did"` // DID
}
DidInfo define the request structure of DocumentGet, used to get companyName
type Page ¶
type Page struct { Page int `json:"page,omitempty"` // 页数,从1开始 默认1 Size int `json:"size,omitempty"` // 每页数量 1~100 默认20 Total int `json:"total,omitempty"` // 总数 }
Page define the structure of page
type Plaintext ¶
type Plaintext struct { Plaintext string `json:"plaintext"` // 明文,签名原文 Signature string `json:"signature"` // 签名 VerificationMethod string `json:"verificationMethod"` // 公钥地址 Type string `json:"type,omitempty"` // 算法类型 Created string `json:"created,omitempty"` // 创建时间 }
Plaintext define Plaintext
func NewMsgEncrypt ¶
NewMsgEncrypt create MsgEncrypt, the default Type is SM2C1C3C2
func NewMsgEncryptWithBase64 ¶
NewMsgEncryptWithBase64 create MsgEncrypt, the default Type is SM2C1C3C2
func NewMsgSign ¶
NewMsgSign create MsgSign, the default Type is SM2Signature
func NewMsgSignWithBase64 ¶
NewMsgSignWithBase64 create MsgSign, the default Type is SM2Signature
func NewMsgVerifyReq ¶
NewMsgVerifyReq create MsgVerifyReq, the default Type is SM2VerificationKey2023
func (*Plaintext) GetPlaintext ¶
GetPlaintext return plaintext
func (*Plaintext) GetSignature ¶
GetSignature return signature
func (*Plaintext) GetVerificationMethod ¶
GetVerificationMethod return verification method
func (*Plaintext) SetCreated ¶
SetCreated set created
func (*Plaintext) SetPlaintext ¶
SetPlaintext set plaintext
func (*Plaintext) SetSignature ¶
SetSignature set signature
type VcListExtend ¶
type VcListExtend struct { Issuer string `json:"issuer,omitempty"` // 发行者 Page *Page `json:"page,omitempty"` // 分页结构 Status string `json:"status"` // 状态 TemplateId string `json:"templateId,omitempty"` // 模板ID }
VcListExtend is the extend field of the VerifiablePresentation for the VC list request.
func NewVcListExtend ¶
func NewVcListExtend(page *Page, issuer, templateId, status string) *VcListExtend
NewVcListExtend create a new VcListExtend with the given Page, issuer, templateId and status.
func (*VcListExtend) GetIssuer ¶
func (e *VcListExtend) GetIssuer() string
GetIssuer get the issuer field of the VcListExtend.
func (*VcListExtend) GetPage ¶
func (e *VcListExtend) GetPage() *Page
GetPage get the page field of the VcListExtend.
func (*VcListExtend) GetStatus ¶
func (e *VcListExtend) GetStatus() string
GetStatus get the status field of the VcListExtend.
func (*VcListExtend) GetTemplateId ¶
func (e *VcListExtend) GetTemplateId() string
GetTemplateId get the templateId field of the VcListExtend.
func (*VcListExtend) SetIssuer ¶
func (e *VcListExtend) SetIssuer(issuer string)
SetIssuer set the issuer field of the VcListExtend.
func (*VcListExtend) SetPage ¶
func (e *VcListExtend) SetPage(page *Page)
SetPage set the page field of the VcListExtend.
func (*VcListExtend) SetStatus ¶
func (e *VcListExtend) SetStatus(status string)
SetStatus set the status field of the VcListExtend.
func (*VcListExtend) SetTemplateId ¶
func (e *VcListExtend) SetTemplateId(templateId string)
SetTemplateId set the templateId field of the VcListExtend.