POST /:project/utils/hash
# Utilities
Directus comes with various utility endpoints you can use to simplify your development flow.
# Create a Hash
Create a hash for a given string.
# Parameters
# project required
The project you're targetting.
# Attributes
# string required
String you want to hash.
# Query
No query parameters available.
# Returns
Returns the hash for the string.
{
"string": "Directus"
}
{
"data": {
"hash": "$2y$10$yBKRgLWmGnrPxi4WXec/0eVkoJNZoNGufbmD38qSZMZnVtq47.tBi"
}
}
# Verify a Hashed String
Check if a hash is valid for a given string.
# Parameters
# project required
The project you're targetting.
# Attributes
# Query
No query parameters available.
# Returns
Returns a boolean called valid
.
POST /:project/utils/hash/match
{
"hash": "$2y$10$yBKRgLWmGnrPxi4WXec/0eVkoJNZoNGufbmD38qSZMZnVtq47.tBi",
"string": "Directus"
}
{
"data": {
"valid": true
}
}
# Generate a Random String
Returns a random string of given length.
# Parameters
# project required
The project you're targetting.
# Attributes
# length optional
How long the string should be. Defaults to 32.
# Query
No query parameters available.
# Returns
Returns a boolean called valid
.
POST /:project/utils/random/string
{
"length": 10
}
{
"data": {
"random": "1>M3+4oh.S"
}
}
# Generate a 2FA Secret
Returns a random string that can be used as a 2FA secret
# Parameters
# project required
The project you're targetting.
# Query
No query parameters available.
# Returns
Returns a boolean called valid
.
GET /:project/utils/2fa_secret
{
"data": {
"2fa_secret": "NWLNVDRK7VKMG3VY"
}
}
← Users Introduction →