身份
Go SDK [身份] 模块(../../../core_modules/identity.md)实现了身份的创建、更新和查询。
导入
导入 Go SDK 身份模块:
Copy
import (
"github.com/bianjieai/irita-sdk-go/modules/identity"
)
接口
创建身份
接口:
Copy
client.Identity.CreateIdentity(request CreateIdentityRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error)
参数:
request:创建身份请求对象
Copy
type CreateIdentityRequest struct {
ID string
PubkeyInfo *PubkeyInfo
Certificate string
Credentials string
}
type PubkeyInfo struct {
PubKey string
PubKeyAlgo PubKeyAlgorithm
}
type PubKeyAlgorithm int32
更新身份
接口:
Copy
client.Identity.UpdateIdentity(request UpdateIdentityRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error)
参数:
request:更新身份请求对象
Copy
type UpdateIdentityRequest struct {
ID string
PubkeyInfo *PubkeyInfo
Certificate string
Credentials *string
}
查询身份
接口:
Copy
client.Identity.QueryIdentity(id string) (QueryIdentityResponse, sdk.Error)
参数:
返回值:
查询身份响应
Copy
type QueryIdentityResponse struct {
ID string
PubkeyInfos []PubkeyInfo
Certificates []string
Credentials string
Owner string
}