typeSDKConfigstruct { 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 below
typeServerInfostruct { 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}
typeVCFilterstruct { Type string`json:"type"`// Type of VC, e.g. "DegreeCredential" Express []string`json:"express,omitempty"`// List of expressions for zero-knowledge proof TrustRoots []string`json:"trust_roots"`// List of trusted VC issuer DIDs Required bool`json:"required"`// If it's required
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
typeClientHellostruct { Ver string`json:"ver"`// Version number Type string`json:"type"`// "ClientHello" for this message Action int`json:"action"`// 0: Authentication, 1: Authorization ClientChallenge *ClientChallenge`json:"ClientChallenge,omitempty"`// Challenge sent from the client for mutual authentication, optional}
Returns
*modules.ServerHello
typeServerHellostruct { Ver string`json:"ver"`// Version number Type string`json:"type"`// "ServerHello" for this message Nonce string`json:"nonce"`// String of nonce Server *ServerInfo`json:"server"`// Server info Chain []string`json:"chain"`// List of supported chains Alg []string`json:"alg"`// List of supported signature schemes VCFilters []*VCFilter`json:"VCFilters,omitempty"`// List of VCFilters, optional ServerProof *ServerProof`json:"ServerProof,omitempty"`// Challenge response sent from the server for mutual authentication, optional Extension *Extension`json:"extension,omitempty"`// Extension, optional}
ValidateClientResponse
Validates the response from the client.
Parameters
typeClientResponsestruct { Ver string`json:"ver"`// Version number Type string`json:"type"`// "ClientResponse" for this message Did string`json:"did"`// User DID Nonce string`json:"nonce"`// String of nonce generated by the server Proof *Proof`json:"proof"`// Signature info sent from the client, see details below VPs []string`json:"VPs,omitempty"`// List of verifiable presentations, optional}
typeProofstruct { Type string`json:"type"`// Signature scheme VerificationMethod string`json:"verificationMethod"`// DID & key index,e.g."did:ont:alice#key-1" Created uint64`json:"created"`// Unix timestamp Value string`json:"value"`// HEX string of signature}
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