diff --git a/build/2.0/mkdocs/search_index.json b/build/2.0/mkdocs/search_index.json index ef3409af..19c9c3a4 100644 --- a/build/2.0/mkdocs/search_index.json +++ b/build/2.0/mkdocs/search_index.json @@ -572,7 +572,7 @@ }, { "location": "/vapor/hash/", - "text": "Hash\n\n\nHashing is a one way method of converting arbitrary data into a fixed size format. Unlike ciphers, data that is hashed cannot be retrieved from the resulting digest. Hashes can be used to create keys, file identifiers, or store credentials.\n\n\n\n\n\n\nHash function diagram from \nWikipedia\n.\n\n\n\n\n\n\nWarning\n\n\nAvoid storing password hashes if possible. If you must, please make sure to research the state of the art before continuing.\n\n\n\n\nMake\n\n\nTo hash a string, use the \nhash\n property on \nDroplet\n.\n\n\nlet\n \ndigest\n \n=\n \ntry\n \ndrop\n.\nhash\n.\nmake\n(\nvapor\n)\n\n\nprint\n(\ndigest\n.\nstring\n)\n\n\n\n\n\n\nChecking\n\n\nSome hashing algorithms create different hash digests for the same message. Because of this, it is necessary to check your hashes using the \ncheck\n method.\n\n\nlet\n \nmatches\n \n=\n \ntry\n \ndrop\n.\nhash\n.\ncheck\n(\nvapor\n,\n \nmatchesHash\n:\n \ndigest\n)\n\n\n\n\n\n\nCryptoHasher\n\n\nBy default, Vapor uses a SHA-256 hasher. You can change this in the configuration files or by giving the \nDroplet\n a different hasher.\n\n\nConfiguration\n\n\nConfig/droplet.json\n\n\n{\n\n \n...,\n\n \nhash\n:\n \ncrypto\n,\n\n \n...\n\n\n}\n\n\n\n\n\n\nConfig/crypto.json\n\n\n{\n\n \nhash\n:\n \n{\n\n \nmethod\n:\n \nsha256\n,\n\n \nencoding\n:\n \nhex\n,\n\n \nkey\n:\n \npassword\n\n \n},\n\n \n...\n\n\n}\n\n\n\n\n\n\nEncoding\n\n\nThe CryptoHasher supports three methods of encoding.\n\n\n\n\nhex\n\n\nbase64\n\n\nplain\n\n\n\n\nKey\n\n\nSupplying a key will cause the hasher to produce \nkeyed\n hashes using HMAC. Some hashers require a key.\n\n\nSupported\n\n\n\n\n\n\n\n\nName\n\n\nMethod\n\n\nRequires Key\n\n\n\n\n\n\n\n\n\n\nSHA-1\n\n\nsha1\n\n\nno\n\n\n\n\n\n\nSHA-224\n\n\nsha224\n\n\nno\n\n\n\n\n\n\nSHA-256\n\n\nsha256\n\n\nno\n\n\n\n\n\n\nSHA-384\n\n\nsha384\n\n\nno\n\n\n\n\n\n\nSHA-512\n\n\nsha512\n\n\nno\n\n\n\n\n\n\nMD4\n\n\nmd4\n\n\nno\n\n\n\n\n\n\nMD5\n\n\nmd5\n\n\nno\n\n\n\n\n\n\nRIPEMD-160\n\n\nripemd160\n\n\nno\n\n\n\n\n\n\nWhirlpool\n\n\nwhirlpool\n\n\nyes\n\n\n\n\n\n\nStreebog-256\n\n\nstreebog256\n\n\nyes\n\n\n\n\n\n\nStreebog-512\n\n\nstreebog512\n\n\nyes\n\n\n\n\n\n\nGostR341194\n\n\ngostr341194\n\n\nyes\n\n\n\n\n\n\n\n\nManual\n\n\nHashers can be swapped without the use of configuration files.\n\n\nHash\n\n\nlet\n \nhash\n \n=\n \nCryptoHasher\n(\n\n \nhash\n:\n \n.\nsha256\n,\n\n \nencoding\n:\n \n.\nhex\n\n\n)\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nhash\n:\n \nhash\n)\n\n\n\n\n\n\nHMAC\n\n\nlet\n \nhash\n \n=\n \nCryptoHasher\n(\n\n \nhmac\n:\n \n.\nsha256\n,\n\n \nencoding\n:\n \n.\nhex\n,\n\n \nkey\n:\n \npassword\n.\nmakeBytes\n()\n\n\n)\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nhash\n:\n \nhash\n)\n\n\n\n\n\n\nBCryptHasher\n\n\nBCrypt is a password hashing function that automatically incorporates salts and offers a configurable work factor. The work factor can be used to increase the computation required to generate a hash.\n\n\n\n\nSeealso\n\n\nLearn more about \nkey stretching\n on Wikipedia.\n\n\n\n\nConfiguration\n\n\nTo use the BCryptHasher change the \n\"hash\"\n key in the \ndroplet.json\n configuration file.\n\n\nConfig/droplet.json\n\n\n{\n\n \n...,\n\n \nhash\n:\n \nbcrypt\n,\n\n \n...\n\n\n}\n\n\n\n\n\n\nTo configure the work factor, add a \nbcrypt.json\n file.\n\n\nConfig/bcrypt.json\n\n\n{\n\n \nworkFactor\n:\n \n8\n\n\n}\n\n\n\n\n\n\n\n\nTip\n\n\nYou can use different BCrypt work factors for production and development modes to keep password hashing fast while working on a project.\n\n\n\n\nManual\n\n\nYou can manually assign a \nBCryptHasher\n to \ndrop.hash\n.\n\n\nlet\n \nhash\n \n=\n \nBCryptHasher\n(\nworkFactor\n:\n \n8\n)\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nhash\n:\n \nhash\n)\n\n\n\n\n\n\nAdvanced\n\n\nCustom\n\n\nYou can also create your own hasher. You just need to conform to the \nHash\n protocol.\n\n\n/// Creates hash digests\n\n\npublic\n \nprotocol\n \nHashProtocol\n \n{\n\n \n/// Given a message, this method\n\n \n/// returns a hashed digest of that message.\n\n \nfunc\n \nmake\n(\n_\n \nmessage\n:\n \nBytes\n)\n \nthrows\n \n-\n \nBytes\n\n\n \n/// Checks whether a given digest was created\n\n \n/// by the supplied message.\n\n \n///\n\n \n/// Returns true if the digest was created\n\n \n/// by the supplied message, false otherwise.\n\n \nfunc\n \ncheck\n(\n_\n \nmessage\n:\n \nBytes\n,\n \nmatchesHash\n:\n \nBytes\n)\n \nthrows\n \n-\n \nBool\n\n\n}", + "text": "Hash\n\n\nHashing is a one way method of converting arbitrary data into a fixed size format. Unlike ciphers, data that is hashed cannot be retrieved from the resulting digest. Hashes can be used to create keys, file identifiers, or store credentials.\n\n\n\n\n\n\nHash function diagram from \nWikipedia\n.\n\n\n\n\n\n\nWarning\n\n\nAvoid storing password hashes if possible. If you must, please make sure to research the state of the art before continuing.\n\n\n\n\nMake\n\n\nTo hash a string, use the \nhash\n property on \nDroplet\n.\n\n\nlet\n \ndigest\n \n=\n \ntry\n \ndrop\n.\nhash\n.\nmake\n(\nvapor\n)\n\n\nprint\n(\ndigest\n.\nstring\n)\n\n\n\n\n\n\nChecking\n\n\nSome hashing algorithms create different hash digests for the same message. Because of this, it is necessary to check your hashes using the \ncheck\n method.\n\n\nlet\n \nmatches\n \n=\n \ntry\n \ndrop\n.\nhash\n.\ncheck\n(\nvapor\n,\n \nmatchesHash\n:\n \ndigest\n)\n\n\n\n\n\n\nCryptoHasher\n\n\nBy default, Vapor uses a SHA-256 hasher. You can change this in the configuration files or by giving the \nDroplet\n a different hasher.\n\n\nConfiguration\n\n\nConfig/droplet.json\n\n\n{\n\n \n...,\n\n \nhash\n:\n \ncrypto\n,\n\n \n...\n\n\n}\n\n\n\n\n\n\nConfig/crypto.json\n\n\n{\n\n \nhash\n:\n \n{\n\n \nmethod\n:\n \nsha256\n,\n\n \nencoding\n:\n \nhex\n,\n\n \nkey\n:\n \npassword\n\n \n},\n\n \n...\n\n\n}\n\n\n\n\n\n\nEncoding\n\n\nThe CryptoHasher supports three methods of encoding.\n\n\n\n\nhex\n\n\nbase64\n\n\nplain\n\n\n\n\nKey\n\n\nSupplying a key will cause the hasher to produce \nkeyed\n hashes using HMAC. Some hashers require a key.\n\n\nSupported\n\n\n\n\n\n\n\n\nName\n\n\nMethod\n\n\nRequires Key\n\n\n\n\n\n\n\n\n\n\nSHA-1\n\n\nsha1\n\n\nno\n\n\n\n\n\n\nSHA-224\n\n\nsha224\n\n\nno\n\n\n\n\n\n\nSHA-256\n\n\nsha256\n\n\nno\n\n\n\n\n\n\nSHA-384\n\n\nsha384\n\n\nno\n\n\n\n\n\n\nSHA-512\n\n\nsha512\n\n\nno\n\n\n\n\n\n\nMD4\n\n\nmd4\n\n\nno\n\n\n\n\n\n\nMD5\n\n\nmd5\n\n\nno\n\n\n\n\n\n\nRIPEMD-160\n\n\nripemd160\n\n\nno\n\n\n\n\n\n\nWhirlpool\n\n\nwhirlpool\n\n\nyes\n\n\n\n\n\n\nStreebog-256\n\n\nstreebog256\n\n\nyes\n\n\n\n\n\n\nStreebog-512\n\n\nstreebog512\n\n\nyes\n\n\n\n\n\n\nGostR341194\n\n\ngostr341194\n\n\nyes\n\n\n\n\n\n\n\n\nManual\n\n\nHashers can be swapped without the use of configuration files.\n\n\nHash\n\n\nlet\n \nhash\n \n=\n \nCryptoHasher\n(\n\n \nhash\n:\n \n.\nsha256\n,\n\n \nencoding\n:\n \n.\nhex\n\n\n)\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nhash\n:\n \nhash\n)\n\n\n\n\n\n\nHMAC\n\n\nlet\n \nhash\n \n=\n \nCryptoHasher\n(\n\n \nhmac\n:\n \n.\nsha256\n,\n\n \nencoding\n:\n \n.\nhex\n,\n\n \nkey\n:\n \npassword\n.\nmakeBytes\n()\n\n\n)\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nhash\n:\n \nhash\n)\n\n\n\n\n\n\nBCryptHasher\n\n\nBCrypt is a password hashing function that automatically incorporates salts and offers a configurable cost. The cost can be used to increase the computation required to generate a hash.\n\n\n\n\nSeealso\n\n\nLearn more about \nkey stretching\n on Wikipedia.\n\n\n\n\nConfiguration\n\n\nTo use the BCryptHasher change the \n\"hash\"\n key in the \ndroplet.json\n configuration file.\n\n\nConfig/droplet.json\n\n\n{\n\n \n...,\n\n \nhash\n:\n \nbcrypt\n,\n\n \n...\n\n\n}\n\n\n\n\n\n\nTo configure the cost, add a \nbcrypt.json\n file.\n\n\nConfig/bcrypt.json\n\n\n{\n\n \ncost\n:\n \n8\n\n\n}\n\n\n\n\n\n\n\n\nTip\n\n\nYou can use different BCrypt costs for production and development modes to keep password hashing fast while working on a project.\n\n\n\n\nManual\n\n\nYou can manually assign a \nBCryptHasher\n to \ndrop.hash\n.\n\n\nlet\n \nhash\n \n=\n \nBCryptHasher\n(\ncost\n:\n \n8\n)\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nhash\n:\n \nhash\n)\n\n\n\n\n\n\nAdvanced\n\n\nCustom\n\n\nYou can also create your own hasher. You just need to conform to the \nHash\n protocol.\n\n\n/// Creates hash digests\n\n\npublic\n \nprotocol\n \nHashProtocol\n \n{\n\n \n/// Given a message, this method\n\n \n/// returns a hashed digest of that message.\n\n \nfunc\n \nmake\n(\n_\n \nmessage\n:\n \nBytes\n)\n \nthrows\n \n-\n \nBytes\n\n\n \n/// Checks whether a given digest was created\n\n \n/// by the supplied message.\n\n \n///\n\n \n/// Returns true if the digest was created\n\n \n/// by the supplied message, false otherwise.\n\n \nfunc\n \ncheck\n(\n_\n \nmessage\n:\n \nBytes\n,\n \nmatchesHash\n:\n \nBytes\n)\n \nthrows\n \n-\n \nBool\n\n\n}", "title": "Hash" }, { @@ -632,17 +632,17 @@ }, { "location": "/vapor/hash/#bcrypthasher", - "text": "BCrypt is a password hashing function that automatically incorporates salts and offers a configurable work factor. The work factor can be used to increase the computation required to generate a hash. Seealso Learn more about key stretching on Wikipedia.", + "text": "BCrypt is a password hashing function that automatically incorporates salts and offers a configurable cost. The cost can be used to increase the computation required to generate a hash. Seealso Learn more about key stretching on Wikipedia.", "title": "BCryptHasher" }, { "location": "/vapor/hash/#configuration_1", - "text": "To use the BCryptHasher change the \"hash\" key in the droplet.json configuration file. Config/droplet.json { \n ..., \n hash : bcrypt , \n ... } To configure the work factor, add a bcrypt.json file. Config/bcrypt.json { \n workFactor : 8 } Tip You can use different BCrypt work factors for production and development modes to keep password hashing fast while working on a project.", + "text": "To use the BCryptHasher change the \"hash\" key in the droplet.json configuration file. Config/droplet.json { \n ..., \n hash : bcrypt , \n ... } To configure the cost, add a bcrypt.json file. Config/bcrypt.json { \n cost : 8 } Tip You can use different BCrypt costs for production and development modes to keep password hashing fast while working on a project.", "title": "Configuration" }, { "location": "/vapor/hash/#manual_1", - "text": "You can manually assign a BCryptHasher to drop.hash . let hash = BCryptHasher ( workFactor : 8 ) let drop = try Droplet ( hash : hash )", + "text": "You can manually assign a BCryptHasher to drop.hash . let hash = BCryptHasher ( cost : 8 ) let drop = try Droplet ( hash : hash )", "title": "Manual" }, { diff --git a/build/2.0/routing/parameters/index.html b/build/2.0/routing/parameters/index.html index b1e12488..6ff90c4e 100644 --- a/build/2.0/routing/parameters/index.html +++ b/build/2.0/routing/parameters/index.html @@ -1622,7 +1622,7 @@

Traditional web frameworks leave room for error in routing by using strings for route parameter names and types. Vapor takes advantage of Swift's closures to provide a safer and more intuitive method for accessing route parameters.

Seealso

-

Route parameters refer to segments of the URL path (e.g., /users/:id). For query parameters (e.g., ?foo=bar) see request query parameters.

+

Route parameters refer to segments of the URL path (e.g., /users/:id). For query parameters (e.g., ?foo=bar) see request query parameters.

Type Safe

To create a type safe route simply replace one of the parts of your path with a Type.

diff --git a/build/2.0/sitemap.xml b/build/2.0/sitemap.xml index d0a00e90..1fb482cf 100644 --- a/build/2.0/sitemap.xml +++ b/build/2.0/sitemap.xml @@ -4,7 +4,7 @@ / - 2017-05-19 + 2017-05-22 daily @@ -13,37 +13,37 @@ /getting-started/install-on-macos/ - 2017-05-19 + 2017-05-22 daily /getting-started/install-on-ubuntu/ - 2017-05-19 + 2017-05-22 daily /getting-started/toolbox/ - 2017-05-19 + 2017-05-22 daily /getting-started/hello-world/ - 2017-05-19 + 2017-05-22 daily /getting-started/manual/ - 2017-05-19 + 2017-05-22 daily /getting-started/xcode/ - 2017-05-19 + 2017-05-22 daily @@ -53,49 +53,49 @@ /vapor/folder-structure/ - 2017-05-19 + 2017-05-22 daily /vapor/droplet/ - 2017-05-19 + 2017-05-22 daily /vapor/views/ - 2017-05-19 + 2017-05-22 daily /vapor/controllers/ - 2017-05-19 + 2017-05-22 daily /vapor/provider/ - 2017-05-19 + 2017-05-22 daily /vapor/hash/ - 2017-05-19 + 2017-05-22 daily /vapor/log/ - 2017-05-19 + 2017-05-22 daily /vapor/commands/ - 2017-05-19 + 2017-05-22 daily @@ -105,7 +105,7 @@ /configs/config/ - 2017-05-19 + 2017-05-22 daily @@ -115,13 +115,13 @@ /json/package/ - 2017-05-19 + 2017-05-22 daily /json/overview/ - 2017-05-19 + 2017-05-22 daily @@ -131,31 +131,31 @@ /routing/package/ - 2017-05-19 + 2017-05-22 daily /routing/overview/ - 2017-05-19 + 2017-05-22 daily /routing/parameters/ - 2017-05-19 + 2017-05-22 daily /routing/group/ - 2017-05-19 + 2017-05-22 daily /routing/collection/ - 2017-05-19 + 2017-05-22 daily @@ -165,37 +165,37 @@ /fluent/package/ - 2017-05-19 + 2017-05-22 daily /fluent/getting-started/ - 2017-05-19 + 2017-05-22 daily /fluent/model/ - 2017-05-19 + 2017-05-22 daily /fluent/database/ - 2017-05-19 + 2017-05-22 daily /fluent/query/ - 2017-05-19 + 2017-05-22 daily /fluent/relations/ - 2017-05-19 + 2017-05-22 daily @@ -205,13 +205,13 @@ /cache/package/ - 2017-05-19 + 2017-05-22 daily /cache/overview/ - 2017-05-19 + 2017-05-22 daily @@ -221,19 +221,19 @@ /mysql/package/ - 2017-05-19 + 2017-05-22 daily /mysql/provider/ - 2017-05-19 + 2017-05-22 daily /mysql/driver/ - 2017-05-19 + 2017-05-22 daily @@ -243,13 +243,13 @@ /redis/package/ - 2017-05-19 + 2017-05-22 daily /redis/provider/ - 2017-05-19 + 2017-05-22 daily @@ -259,37 +259,37 @@ /auth/package/ - 2017-05-19 + 2017-05-22 daily /auth/provider/ - 2017-05-19 + 2017-05-22 daily /auth/getting-started/ - 2017-05-19 + 2017-05-22 daily /auth/helper/ - 2017-05-19 + 2017-05-22 daily /auth/password/ - 2017-05-19 + 2017-05-22 daily /auth/persist/ - 2017-05-19 + 2017-05-22 daily @@ -299,13 +299,13 @@ /sessions/package/ - 2017-05-19 + 2017-05-22 daily /sessions/sessions/ - 2017-05-19 + 2017-05-22 daily @@ -315,61 +315,61 @@ /http/package/ - 2017-05-19 + 2017-05-22 daily /http/request/ - 2017-05-19 + 2017-05-22 daily /http/response/ - 2017-05-19 + 2017-05-22 daily /http/middleware/ - 2017-05-19 + 2017-05-22 daily /http/body/ - 2017-05-19 + 2017-05-22 daily /http/response-representable/ - 2017-05-19 + 2017-05-22 daily /http/responder/ - 2017-05-19 + 2017-05-22 daily /http/client/ - 2017-05-19 + 2017-05-22 daily /http/server/ - 2017-05-19 + 2017-05-22 daily /http/cors/ - 2017-05-19 + 2017-05-22 daily @@ -379,19 +379,19 @@ /leaf/package/ - 2017-05-19 + 2017-05-22 daily /leaf/provider/ - 2017-05-19 + 2017-05-22 daily /leaf/leaf/ - 2017-05-19 + 2017-05-22 daily @@ -400,7 +400,7 @@ /validation/overview/ - 2017-05-19 + 2017-05-22 daily @@ -409,13 +409,13 @@ /node/package/ - 2017-05-19 + 2017-05-22 daily /node/getting-started/ - 2017-05-19 + 2017-05-22 daily @@ -425,13 +425,13 @@ /core/package/ - 2017-05-19 + 2017-05-22 daily /core/overview/ - 2017-05-19 + 2017-05-22 daily @@ -441,13 +441,13 @@ /bits/package/ - 2017-05-19 + 2017-05-22 daily /bits/overview/ - 2017-05-19 + 2017-05-22 daily @@ -457,13 +457,13 @@ /debugging/package/ - 2017-05-19 + 2017-05-22 daily /debugging/overview/ - 2017-05-19 + 2017-05-22 daily @@ -473,13 +473,13 @@ /deploy/nginx/ - 2017-05-19 + 2017-05-22 daily /deploy/supervisor/ - 2017-05-19 + 2017-05-22 daily @@ -489,19 +489,19 @@ /version/1_5/ - 2017-05-19 + 2017-05-22 daily /version/2_0/ - 2017-05-19 + 2017-05-22 daily /version/support/ - 2017-05-19 + 2017-05-22 daily diff --git a/build/2.0/vapor/hash/index.html b/build/2.0/vapor/hash/index.html index 08b57c7f..3f24bc11 100644 --- a/build/2.0/vapor/hash/index.html +++ b/build/2.0/vapor/hash/index.html @@ -1984,7 +1984,7 @@

BCryptHasher

-

BCrypt is a password hashing function that automatically incorporates salts and offers a configurable work factor. The work factor can be used to increase the computation required to generate a hash.

+

BCrypt is a password hashing function that automatically incorporates salts and offers a configurable cost. The cost can be used to increase the computation required to generate a hash.

Seealso

Learn more about key stretching on Wikipedia.

@@ -2000,21 +2000,21 @@
-

To configure the work factor, add a bcrypt.json file.

+

To configure the cost, add a bcrypt.json file.

Config/bcrypt.json

{
-    "workFactor": 8
+    "cost": 8
 }
 

Tip

-

You can use different BCrypt work factors for production and development modes to keep password hashing fast while working on a project.

+

You can use different BCrypt costs for production and development modes to keep password hashing fast while working on a project.

Manual

You can manually assign a BCryptHasher to drop.hash.

-
let hash = BCryptHasher(workFactor: 8)
+
let hash = BCryptHasher(cost: 8)
 
 let drop = try Droplet(hash: hash)