feat: added secure random URL option
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Jef Roosens 2022-11-21 21:02:33 +01:00
parent b66c0f0e00
commit 22a7b5b3fc
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
4 changed files with 101 additions and 52 deletions

View file

@ -14,7 +14,8 @@ static const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW
static const size_t charset_len = sizeof(charset) - 1;
// Length of randomly generated keys
#define RANDOM_KEY_LENGTH 4
#define RANDOM_KEY_LENGTH_SHORT 4
#define RANDOM_KEY_LENGTH_LONG 16
/**
* Type definition for the struct representing the current Trie.
@ -83,9 +84,10 @@ bool ternarytrie_add(TernaryTrie* trie, const char* key, Entry *entry);
*
* @param trie
* @param entry entry to add
* @param secure whether to generate a longer, more secure random key
* @return the generated key
*/
char *ternarytrie_add_random(TernaryTrie *trie, Entry *entry);
char *ternarytrie_add_random(TernaryTrie *trie, Entry *entry, bool secure);
/**
* Remove an entry from this trie given its key.