mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
add collection for development keys
This commit is contained in:
parent
af3dc25e2c
commit
03000c3ad0
6 changed files with 106 additions and 5 deletions
|
|
@ -4808,6 +4808,107 @@ $consoleCollections = array_merge([
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'developmentKeys' => [
|
||||||
|
'$collection' => ID::custom(Database::METADATA),
|
||||||
|
'$id' => ID::custom('developmentKeys'),
|
||||||
|
'name' => 'keys',
|
||||||
|
'attributes' => [
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('projectInternalId'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'signed' => true,
|
||||||
|
'required' => true,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => [],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('projectId'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'signed' => true,
|
||||||
|
'required' => false,
|
||||||
|
'default' => 0,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => [],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('name'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'signed' => true,
|
||||||
|
'required' => true,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => [],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('secret'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => 512, // var_dump of \bin2hex(\random_bytes(128)) => string(256) doubling for encryption
|
||||||
|
'signed' => true,
|
||||||
|
'required' => true,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => ['encrypt'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('expire'),
|
||||||
|
'type' => Database::VAR_DATETIME,
|
||||||
|
'format' => '',
|
||||||
|
'size' => 0,
|
||||||
|
'signed' => false,
|
||||||
|
'required' => false,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => ['datetime'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('accessedAt'),
|
||||||
|
'type' => Database::VAR_DATETIME,
|
||||||
|
'format' => '',
|
||||||
|
'size' => 0,
|
||||||
|
'signed' => false,
|
||||||
|
'required' => false,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => ['datetime'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('sdks'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'signed' => true,
|
||||||
|
'required' => true,
|
||||||
|
'default' => null,
|
||||||
|
'array' => true,
|
||||||
|
'filters' => [],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'indexes' => [
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_project'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['projectInternalId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => '_key_accessedAt',
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['accessedAt'],
|
||||||
|
'lengths' => [],
|
||||||
|
'orders' => [],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
'webhooks' => [
|
'webhooks' => [
|
||||||
'$collection' => ID::custom(Database::METADATA),
|
'$collection' => ID::custom(Database::METADATA),
|
||||||
'$id' => ID::custom('webhooks'),
|
'$id' => ID::custom('webhooks'),
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ class Create extends Action
|
||||||
'secret' => API_KEY_STANDARD . '_' . \bin2hex(\random_bytes(128)),
|
'secret' => API_KEY_STANDARD . '_' . \bin2hex(\random_bytes(128)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$key = $dbForConsole->createDocument('development_keys', $key);
|
$key = $dbForConsole->createDocument('developmentKeys', $key);
|
||||||
|
|
||||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class Delete extends Action
|
||||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = $dbForConsole->findOne('development_keys', [
|
$key = $dbForConsole->findOne('developmentKeys', [
|
||||||
Query::equal('$id', [$keyId]),
|
Query::equal('$id', [$keyId]),
|
||||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class Get extends Action
|
||||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = $dbForConsole->findOne('development_keys', [
|
$key = $dbForConsole->findOne('developmentKeys', [
|
||||||
Query::equal('$id', [$keyId]),
|
Query::equal('$id', [$keyId]),
|
||||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class Update extends Action
|
||||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = $dbForConsole->findOne('development_keys', [
|
$key = $dbForConsole->findOne('developmentKeys', [
|
||||||
Query::equal('$id', [$keyId]),
|
Query::equal('$id', [$keyId]),
|
||||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class XList extends Action
|
||||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
$keys = $dbForConsole->find('development_keys', [
|
$keys = $dbForConsole->find('developmentKeys', [
|
||||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||||
Query::limit(5000),
|
Query::limit(5000),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue