All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ecwid.apiclient.v3.util.SecurePatterns.kt Maven / Gradle / Ivy

There is a newer version: 0.347.0
Show newest version
package com.ecwid.apiclient.v3.util

private const val PARAM_VALUE_PATTERN = "([^;,)]+)"

private val GLOBAL_SECURE_PATTERNS = listOf(
	createKeyValueSecurePattern("email"),
	createJsonSecurePattern("email"),
	createJsonSecurePattern("name"),
	createJsonSecurePattern("firstName"),
	createJsonSecurePattern("lastName"),
	createJsonSecurePattern("street"),
	createJsonSecurePattern("city"),
	createJsonSecurePattern("postalCode"),
	createJsonSecurePattern("phone"),
)

fun createKeyValueSecurePattern(paramName: String) = SecurePattern(
	regex = Regex("$paramName=$PARAM_VALUE_PATTERN"),
	unmaskedLength = 6
)

fun createJsonSecurePattern(paramName: String) = SecurePattern(
	regex = Regex(""""$paramName":\s*"([^"]*)""""),
	unmaskedLength = 6
)

fun createSecurePatterns() = mutableListOf().apply {
	addAll(GLOBAL_SECURE_PATTERNS)
}.toList()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy