API Reference
Index
NewOntLoginSdk
NewOntLoginSdkCreates an OntLoginSdk instance.
Parameters
conf *SDKConfig
SDK configuration
type SDKConfig struct {
Chain []string // Supported chain, e.g."ONT","ETH","BSC"
Alg []string // Signature scheme such as "ES256","Ed25519"
ServerInfo *modules.ServerInfo // Server configuration info, see details below
VCFilters map[int][]*modules.VCFilter // VCFilter info for authentication/authorization, see details belowtype ServerInfo struct {
Name string `json:"name"` // Server name
Icon string `json:"icon,omitempty"` // Icon, optional
Url string `json:"url"` // Server URL
Did string `json:"did,omitempty"` // Server DID, optional
VerificationMethod string `json:"verificationMethod,omitempty"` // Verification method, optional
}processors map[string]did.DidProcessor
DID processor map
nonceFunc func(int) string
Function to generate nonce
getActionByNonce func(string) (int,error)
Gets action by nonce
Returns
Field
Description
*OntLoginSdk
Instantiation successful
error
Instantiation failed
GenerateChallenge
Generates the challenge.
Parameters
Returns
*modules.ServerHello
ValidateClientResponse
Validates the response from the client.
Parameters
Returns
Field
Description
null
Validation successful
error
Validation failed
Validation Process:
Verify the validity of parameters
Verify if the nonce is the same as the one generated by the server
verify the signature
Verify the validity of VP and VC
Check if the provided VC meets the requirement
GetCredentialJson
Gets JSON string of VC from VP.
Parameters
Parameter
Description
chain
Chain name
presentation
VP string
Returns
Field
Description
[]string
JSON string of VC
error
Fail to get VC string
Last updated