Documentation
¶
Index ¶
- Constants
- Variables
- func Complement(vs []string, ts []string) []string
- func Contains(vs []string, t string) bool
- func ContainsFragment(didUrl string) bool
- func ContainsModule(didUrl string) bool
- func ContainsPath(didUrl string) bool
- func ContainsQuery(didUrl string) bool
- func ContainsString(s string, t string) bool
- func ConvertAccAddressToDid(address interface{}) string
- func ConvertDidToAccAddress(did string) (sdk.AccAddress, error)
- func CreateChallenge() (challenge protocol.URLEncodedBase64, err error)
- func ExtractBase(did string) (bool, string)
- func ExtractFragment(didUrl string) (bool, string)
- func ExtractIdentifier(did string) (bool, string)
- func ExtractPath(didUrl string) (bool, string)
- func ExtractQuery(didUrl string) (bool, string)
- func Filter(vs []string, f func(string) bool) []string
- func IndexOf(vs []string, t string) int
- func IsFragment(didUrl string) bool
- func IsPath(didUrl string) bool
- func IsQuery(didUrl string) bool
- func IsValidDid(did string) bool
- func MakeCredentialFromAssertionData(c *protocol.ParsedCredentialAssertionData) *types.WebauthnCredential
- func MakeCredentialFromCreationData(c *protocol.ParsedCredentialCreationData) *types.WebauthnCredential
- func ToFragment(str string) string
- func ToIdentifier(str string) string
- func ToNetwork(str string) string
- func ToQuery(str string) string
Constants ¶
const ( // Minimum length of base colon separated DID MIN_BASE_PART_LENGTH = 3 // Maximum length of base colon separated DID MAX_BASE_PART_LENGTH = 4 // Minimum length of method specific ID ChallengeLength = 32 )
Variables ¶
var ( ErrBaseNotFound = errors.New("Unable to determine base did of provided string.") ErrFragmentAndQuery = errors.New("Unable to create new DID. Fragment and Query are mutually exclusive") ErrParseInvalid = errors.New("Unable to parse string into DID, invalid format.") DidForbiddenSymbolsRegexp, _ = regexp.Compile(`^[^&\\]+$`) )
Functions ¶
func Complement ¶
Complement returns a new slice containing all strings from the slice that do not satisfy the predicate
func ContainsFragment ¶
ContainsFragment checks if a DID has a fragment in the full string
func ContainsModule ¶
ContainsModule checks if a core service module is present in the DID
func ContainsPath ¶
ContainsPath returns true if a DID has a path in the full string
func ContainsQuery ¶
ContainsQuery checks if a DID has a query in the full string
func ContainsString ¶
ContainsString returns true if this string contains target string
func ConvertAccAddressToDid ¶
func ConvertAccAddressToDid(address interface{}) string
WARNING: This method is used only for module simulation tests. Do not implement this method across different types in the package. ConvertAccAddressToDid converts an AccAddress to a DID
func ConvertDidToAccAddress ¶
func ConvertDidToAccAddress(did string) (sdk.AccAddress, error)
WARNING: This method is used only for module simulation tests. Do not implement this method across different types in the package. ConvertDidToAccAddress converts a DID to an AccAddress
func CreateChallenge ¶
func CreateChallenge() (challenge protocol.URLEncodedBase64, err error)
CreateChallenge creates a new challenge that should be signed and returned by the authenticator. The spec recommends using at least 16 bytes with 100 bits of entropy. We use 32 bytes.
func ExtractBase ¶
ExtractBase extracts the did base (did:snr:<network>:<address>) or (did:snr:address)
func ExtractFragment ¶
ExtractFragment splits a DID URL and pulls the fragment
func ExtractIdentifier ¶
ExtractIdentifier extracts the identifier from a DID
func ExtractPath ¶
ExtractPath splits a DID URL and pulls the path
func ExtractQuery ¶
ExtractQuery splits a DID URL and pulls the query
func Filter ¶
Filter returns a new slice containing all strings from the slice that satisfy the predicate
func MakeCredentialFromAssertionData ¶
func MakeCredentialFromAssertionData(c *protocol.ParsedCredentialAssertionData) *types.WebauthnCredential
MakeCredentialFromAssertionData creates a new WebauthnCredential from a ParsedCredentialAssertionData and contains all needed information about a WebAuthn credential for storage. This is then used to create a VerificationMethod for the DID Document.
func MakeCredentialFromCreationData ¶
func MakeCredentialFromCreationData(c *protocol.ParsedCredentialCreationData) *types.WebauthnCredential
MakeCredentialFromCreationData creates a new WebauthnCredential from a ParsedCredentialCreationData and contains all needed information about a WebAuthn credential for storage. This is then used to create a VerificationMethod for the DID Document.
func ToFragment ¶
func ToIdentifier ¶
Types ¶
This section is empty.