nestjs-cryptography 3.0.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/SECURITY.md +14 -0
  2. package/dist/constants.d.ts +15 -0
  3. package/dist/constants.js +16 -1
  4. package/dist/cryptography.service.d.ts +3 -2
  5. package/dist/cryptography.service.js +101 -21
  6. package/dist/interfaces/cryptography-options.interface.d.ts +20 -16
  7. package/package.json +23 -16
  8. package/wiki/README.md +0 -41
  9. package/wiki/babel.config.js +0 -3
  10. package/wiki/docs/Internals/_category_.json +0 -7
  11. package/wiki/docs/Internals/create-safe-random-data.mdx +0 -41
  12. package/wiki/docs/Internals/create-secure-hmac.mdx +0 -31
  13. package/wiki/docs/Internals/symmetric-data-encrypt.mdx +0 -103
  14. package/wiki/docs/Internals/symmetric-secure-data-encrypt.mdx +0 -161
  15. package/wiki/docs/api-reference/_category_.json +0 -7
  16. package/wiki/docs/api-reference/settings.mdx +0 -199
  17. package/wiki/docs/guides/_category_.json +0 -7
  18. package/wiki/docs/guides/generics.mdx +0 -170
  19. package/wiki/docs/guides/hashing.mdx +0 -258
  20. package/wiki/docs/guides/hmac.mdx +0 -271
  21. package/wiki/docs/guides/key-derivation.mdx +0 -101
  22. package/wiki/docs/guides/password-hashing.mdx +0 -136
  23. package/wiki/docs/guides/symmetric-encryption.mdx +0 -272
  24. package/wiki/docs/intro.mdx +0 -148
  25. package/wiki/docusaurus.config.ts +0 -138
  26. package/wiki/package.json +0 -48
  27. package/wiki/sidebars.ts +0 -20
  28. package/wiki/src/common/timing-attack.mdx +0 -3
  29. package/wiki/src/common/tips.mdx +0 -18
  30. package/wiki/src/components/GenerateHexButton/index.tsx +0 -35
  31. package/wiki/src/components/GenerateHexButton/styles.module.css +0 -10
  32. package/wiki/src/components/GenericLabel/index.tsx +0 -19
  33. package/wiki/src/components/HomepageFeatures/index.tsx +0 -70
  34. package/wiki/src/components/HomepageFeatures/styles.module.css +0 -11
  35. package/wiki/src/components/RecommendedLabel/index.tsx +0 -19
  36. package/wiki/src/components/RequiredLabel/index.tsx +0 -12
  37. package/wiki/src/css/custom.css +0 -30
  38. package/wiki/src/pages/index.module.css +0 -23
  39. package/wiki/src/pages/index.tsx +0 -43
  40. package/wiki/src/pages/markdown-page.md +0 -7
  41. package/wiki/static/.nojekyll +0 -0
  42. package/wiki/static/img/gear_api.png +0 -0
  43. package/wiki/static/img/logo.svg +0 -1
  44. package/wiki/static/img/nestjs_favicon.ico +0 -0
  45. package/wiki/static/img/node_crypto.png +0 -0
  46. package/wiki/static/img/phc_logo.png +0 -0
  47. package/wiki/static/img/profile.png +0 -0
  48. package/wiki/versioned_docs/version-2.x/Internals/_category_.json +0 -8
  49. package/wiki/versioned_docs/version-2.x/Internals/create-secure-hmac.mdx +0 -30
  50. package/wiki/versioned_docs/version-2.x/Internals/symmetric-secure-data-encrypt.mdx +0 -160
  51. package/wiki/versioned_docs/version-2.x/api-reference/_category_.json +0 -8
  52. package/wiki/versioned_docs/version-2.x/api-reference/settings.mdx +0 -197
  53. package/wiki/versioned_docs/version-2.x/guides/_category_.json +0 -7
  54. package/wiki/versioned_docs/version-2.x/guides/generics.mdx +0 -133
  55. package/wiki/versioned_docs/version-2.x/guides/hashing.mdx +0 -229
  56. package/wiki/versioned_docs/version-2.x/guides/hmac.mdx +0 -198
  57. package/wiki/versioned_docs/version-2.x/guides/key-derivation.mdx +0 -98
  58. package/wiki/versioned_docs/version-2.x/guides/password-hashing.mdx +0 -132
  59. package/wiki/versioned_docs/version-2.x/guides/symmetric-encryption.mdx +0 -107
  60. package/wiki/versioned_docs/version-2.x/intro.mdx +0 -148
  61. package/wiki/versioned_sidebars/version-2.x-sidebars.json +0 -8
  62. package/wiki/versions.json +0 -3
package/wiki/package.json DELETED
@@ -1,48 +0,0 @@
1
- {
2
- "name": "nestjs-cryptography",
3
- "version": "0.0.0",
4
- "private": true,
5
- "scripts": {
6
- "docusaurus": "docusaurus",
7
- "start": "docusaurus start",
8
- "build": "docusaurus build",
9
- "swizzle": "docusaurus swizzle",
10
- "deploy": "docusaurus deploy",
11
- "clear": "docusaurus clear",
12
- "serve": "docusaurus serve",
13
- "write-translations": "docusaurus write-translations",
14
- "write-heading-ids": "docusaurus write-heading-ids",
15
- "typecheck": "tsc"
16
- },
17
- "dependencies": {
18
- "@docusaurus/core": "3.5.2",
19
- "@docusaurus/preset-classic": "3.5.2",
20
- "@docusaurus/theme-mermaid": "^3.5.2",
21
- "@mdx-js/react": "^3.0.1",
22
- "clsx": "^2.1.1",
23
- "prism-react-renderer": "^2.4.0",
24
- "react": "^18.3.1",
25
- "react-dom": "^18.3.1"
26
- },
27
- "devDependencies": {
28
- "@docusaurus/module-type-aliases": "3.5.2",
29
- "@docusaurus/tsconfig": "3.5.2",
30
- "@docusaurus/types": "3.5.2",
31
- "typescript": "~5.5.2"
32
- },
33
- "browserslist": {
34
- "production": [
35
- ">0.5%",
36
- "not dead",
37
- "not op_mini all"
38
- ],
39
- "development": [
40
- "last 3 chrome version",
41
- "last 3 firefox version",
42
- "last 5 safari version"
43
- ]
44
- },
45
- "engines": {
46
- "node": ">=18.0"
47
- }
48
- }
package/wiki/sidebars.ts DELETED
@@ -1,20 +0,0 @@
1
- import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
2
-
3
- const sidebars: SidebarsConfig = {
4
- tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
5
-
6
- // But you can create a sidebar manually
7
- /*
8
- tutorialSidebar: [
9
- 'intro',
10
- 'hello',
11
- {
12
- type: 'category',
13
- label: 'Tutorial',
14
- items: ['tutorial-basics/create-a-document'],
15
- },
16
- ],
17
- */
18
- };
19
-
20
- export default sidebars;
@@ -1,3 +0,0 @@
1
- > _This method uses a time-safe comparison function to prevent [timing attacks][1]_
2
-
3
- [1]: https://en.wikipedia.org/wiki/Timing_attack
@@ -1,18 +0,0 @@
1
- ## 🛟 Tips
2
-
3
- <details>
4
- <summary>Remember that...</summary>
5
- <div>
6
- :::info
7
- Remember that buffers could be transformed to `utf8, hex, base64, latin,...` using the `toString()` [method][1].
8
- ```typescript
9
- let passwordAsBuffer: Buffer = someMethodThatReturnsABuffer();
10
-
11
- console.log(passwordAsBuffer.toString('hex')) // f32.....4ee
12
- console.log(passwordAsBuffer.toString('base64')) // 8OI.....ZQ=
13
- ```
14
- :::
15
- </div>
16
- </details>
17
-
18
- [1]: https://nodejs.org/api/buffer.html#buftostringencoding-start-end
@@ -1,35 +0,0 @@
1
- // src/components/GenerateHexButton.js
2
-
3
- import React, { useState } from 'react';
4
- import clsx from 'clsx';
5
- import styles from './styles.module.css';
6
-
7
- const GenerateHexButton = () => {
8
- const [hexValue, setHexValue] = useState('');
9
-
10
- const generateSecureHexValues = (size: number) => {
11
- const array = new Uint8Array(size);
12
- window.crypto.getRandomValues(array);
13
- return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join('');
14
- };
15
-
16
- const handleClick = () => {
17
- const hex = generateSecureHexValues(32);
18
- setHexValue(hex);
19
- };
20
-
21
- return (
22
- <div className={clsx('text--center')}>
23
- <button className={clsx('button button--primary button', styles.button)} onClick={handleClick}>
24
- Generate Hex Values
25
- </button>
26
- {hexValue && (
27
- <div className={styles.result}>
28
- <code>{hexValue}</code>
29
- </div>
30
- )}
31
- </div>
32
- );
33
- };
34
-
35
- export default GenerateHexButton;
@@ -1,10 +0,0 @@
1
- .button {
2
- margin-top: 10px;
3
- margin-bottom: 10px;
4
- width: 100%;
5
- }
6
-
7
- .result {
8
- margin-top: 5px;
9
- border-radius: 4px;
10
- }
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
-
4
- const GenericLabel = () => {
5
- return (
6
- <span
7
- className={clsx(
8
- 'badge',
9
- 'badge--info',
10
- 'font-weight-bold',
11
- 'margin-left--sm',
12
- )}
13
- >
14
- Generic
15
- </span>
16
- );
17
- };
18
-
19
- export default GenericLabel;
@@ -1,70 +0,0 @@
1
- import clsx from 'clsx';
2
- import Heading from '@theme/Heading';
3
- import styles from './styles.module.css';
4
-
5
- type FeatureItem = {
6
- title: string;
7
- img: string;
8
- description: JSX.Element;
9
- };
10
-
11
- const FeatureList: FeatureItem[] = [
12
- {
13
- title: 'Uses node:crypto',
14
- img: require('@site/static/img/node_crypto.png').default,
15
- description: (
16
- <>
17
- Under the hood, it uses the native crypto nodejs library.
18
- So the wheel hasn't been reinvented, it's just been given a layer.
19
- </>
20
- ),
21
- },
22
- {
23
- title: 'Uses Argon2',
24
- img: require('@site/static/img/phc_logo.png').default,
25
- description: (
26
- <>
27
- As a derivation function or password hashing algorithm, it uses
28
- Argon2. The winner of the PHC Password Hashing Competition.
29
- </>
30
- ),
31
- },
32
- {
33
- title: 'High Level API',
34
- img: require('@site/static/img/gear_api.png').default,
35
- description: (
36
- <>
37
- It offers a high level API so you don't have to worry about using
38
- a good cryptographic implementation. This library take care of this
39
- </>
40
- ),
41
- },
42
- ];
43
-
44
- function Feature({title, img, description}: FeatureItem) {
45
- return (
46
- <div className={clsx('col col--4')}>
47
- <div className="text--center">
48
- <img height={150} src={img} />
49
- </div>
50
- <div className="text--center padding-horiz--md">
51
- <Heading as="h3">{title}</Heading>
52
- <p>{description}</p>
53
- </div>
54
- </div>
55
- );
56
- }
57
-
58
- export default function HomepageFeatures(): JSX.Element {
59
- return (
60
- <section className={styles.features}>
61
- <div className="container">
62
- <div className="row">
63
- {FeatureList.map((props, idx) => (
64
- <Feature key={idx} {...props} />
65
- ))}
66
- </div>
67
- </div>
68
- </section>
69
- );
70
- }
@@ -1,11 +0,0 @@
1
- .features {
2
- display: flex;
3
- align-items: center;
4
- padding: 2rem 0;
5
- width: 100%;
6
- }
7
-
8
- .featureSvg {
9
- height: 100px;
10
- width: 100px;
11
- }
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
-
4
- const RecommendedLabel = () => {
5
- return (
6
- <span
7
- className={clsx(
8
- 'badge',
9
- 'badge--success',
10
- 'font-weight-bold',
11
- 'margin-left--sm',
12
- )}
13
- >
14
- Recommended
15
- </span>
16
- );
17
- };
18
-
19
- export default RecommendedLabel;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
-
4
- const RequiredLabel = () => {
5
- return (
6
- <span className={clsx('badge', 'badge--danger', 'font-weight-bold', 'margin-left--sm')}>
7
- Required
8
- </span>
9
- );
10
- };
11
-
12
- export default RequiredLabel;
@@ -1,30 +0,0 @@
1
- /**
2
- * Any CSS included here will be global. The classic template
3
- * bundles Infima by default. Infima is a CSS framework designed to
4
- * work well for content-centric websites.
5
- */
6
-
7
- /* You can override the default Infima variables here. */
8
- :root {
9
- --ifm-color-primary: #2e8555;
10
- --ifm-color-primary-dark: #29784c;
11
- --ifm-color-primary-darker: #277148;
12
- --ifm-color-primary-darkest: #205d3b;
13
- --ifm-color-primary-light: #33925d;
14
- --ifm-color-primary-lighter: #359962;
15
- --ifm-color-primary-lightest: #3cad6e;
16
- --ifm-code-font-size: 95%;
17
- --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
18
- }
19
-
20
- /* For readability concerns, you should choose a lighter palette in dark mode. */
21
- [data-theme='dark'] {
22
- --ifm-color-primary: #25c2a0;
23
- --ifm-color-primary-dark: #21af90;
24
- --ifm-color-primary-darker: #1fa588;
25
- --ifm-color-primary-darkest: #1a8870;
26
- --ifm-color-primary-light: #29d5b0;
27
- --ifm-color-primary-lighter: #32d8b4;
28
- --ifm-color-primary-lightest: #4fddbf;
29
- --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
30
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * CSS files with the .module.css suffix will be treated as CSS modules
3
- * and scoped locally.
4
- */
5
-
6
- .heroBanner {
7
- padding: 4rem 0;
8
- text-align: center;
9
- position: relative;
10
- overflow: hidden;
11
- }
12
-
13
- @media screen and (max-width: 996px) {
14
- .heroBanner {
15
- padding: 2rem;
16
- }
17
- }
18
-
19
- .buttons {
20
- display: flex;
21
- align-items: center;
22
- justify-content: center;
23
- }
@@ -1,43 +0,0 @@
1
- import clsx from 'clsx';
2
- import Link from '@docusaurus/Link';
3
- import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
4
- import Layout from '@theme/Layout';
5
- import HomepageFeatures from '@site/src/components/HomepageFeatures';
6
- import Heading from '@theme/Heading';
7
-
8
- import styles from './index.module.css';
9
-
10
- function HomepageHeader() {
11
- const {siteConfig} = useDocusaurusContext();
12
- return (
13
- <header className={clsx('hero', styles.heroBanner)}>
14
- <div className="container">
15
- <Heading as="h1" className="hero__title">
16
- {siteConfig.title}
17
- </Heading>
18
- <p className="hero__subtitle">{siteConfig.tagline}</p>
19
- <div className={styles.buttons}>
20
- <Link
21
- className="button button--primary button--lg"
22
- to="/docs/intro">
23
- Getting Started
24
- </Link>
25
- </div>
26
- </div>
27
- </header>
28
- );
29
- }
30
-
31
- export default function Home(): JSX.Element {
32
- const {siteConfig} = useDocusaurusContext();
33
- return (
34
- <Layout
35
- title={`Hello from ${siteConfig.title}`}
36
- description="Description will go into a meta tag in <head />">
37
- <HomepageHeader />
38
- <main>
39
- <HomepageFeatures />
40
- </main>
41
- </Layout>
42
- );
43
- }
@@ -1,7 +0,0 @@
1
- ---
2
- title: Markdown page example
3
- ---
4
-
5
- # Markdown page example
6
-
7
- You don't need React to write simple standalone pages.
File without changes
Binary file
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264.583 255.588" height="966" width="1000"><path d="M153.338 4.24c-1.809 0-3.489.388-5.04.905 3.296 2.197 5.105 5.105 6.01 8.4.065.453.194.776.258 1.228.065.388.13.775.13 1.163.258 5.687-1.487 6.397-2.715 9.758-1.874 4.33-1.357 8.982.905 12.73.194.452.452.969.776 1.421-2.456-16.348 11.179-18.804 13.699-23.909.194-4.459-3.49-7.431-6.397-9.499-2.78-1.68-5.3-2.197-7.626-2.197zm20.55 3.683c-.26 1.487-.065 1.099-.13 1.874-.064.517-.064 1.163-.129 1.68-.129.517-.258 1.034-.452 1.551-.13.517-.323 1.034-.517 1.551-.259.517-.452.97-.71 1.486-.195.259-.324.517-.518.776l-.388.581a22.32 22.32 0 01-.969 1.293c-.388.388-.71.84-1.163 1.163v.065c-.388.323-.775.71-1.228 1.034-1.357 1.033-2.908 1.809-4.33 2.778-.452.323-.904.582-1.292.97-.452.323-.84.646-1.227 1.033-.453.388-.776.776-1.164 1.228-.323.388-.71.84-.969 1.293-.323.452-.646.904-.905 1.357-.258.517-.452.969-.71 1.486-.194.517-.388.97-.517 1.486a20.921 20.921 0 00-.453 1.616c-.064.258-.064.581-.129.84-.065.258-.065.517-.129.775 0 .517-.065 1.099-.065 1.616 0 .387 0 .775.065 1.163 0 .517.065 1.034.194 1.615.065.517.194 1.034.323 1.551.194.517.323 1.034.517 1.55.13.324.323.647.452.906l-14.862-5.752c-2.52-.71-4.976-1.357-7.496-1.938l-4.071-.97a119.971 119.971 0 00-11.76-1.744c-.13 0-.195-.065-.324-.065-3.877-.388-7.69-.581-11.567-.581-2.843 0-5.686.129-8.465.323-3.942.258-7.884.775-11.825 1.421-.97.13-1.94.323-2.908.517-2.004.388-3.942.84-5.816 1.293l-2.908.775c-.97.388-1.874.84-2.779 1.228l-2.132.97c-.13.064-.259.064-.323.128-.646.323-1.228.582-1.81.905-.193.065-.323.13-.452.194-.71.323-1.421.71-2.003 1.034-.452.194-.905.452-1.292.646-.194.13-.453.259-.582.323-.582.323-1.163.646-1.68.97a15.97 15.97 0 00-1.551.969c-.452.323-.905.581-1.292.904-.065.065-.13.065-.194.13-.388.258-.84.581-1.228.904l-.13.13-.968.775c-.13.064-.26.194-.388.258-.323.259-.646.582-.97.84-.064.13-.193.194-.258.259-.388.388-.775.71-1.163 1.098-.065 0-.065.065-.13.13-.387.323-.775.71-1.163 1.098-.064.065-.064.13-.129.13a15.16 15.16 0 00-.969 1.033c-.13.13-.323.259-.452.388-.323.388-.711.775-1.099 1.163-.065.13-.194.194-.258.323-.517.517-.97 1.034-1.487 1.551l-.193.194c-1.034 1.098-2.133 2.197-3.296 3.166a36.732 36.732 0 01-3.619 2.843 48.856 48.856 0 01-3.877 2.456 39.382 39.382 0 01-4.071 1.939 46.55 46.55 0 01-4.2 1.55c-2.714.582-5.493 1.68-7.884 1.874-.517 0-1.098.13-1.615.194-.582.13-1.099.259-1.616.388l-1.55.582c-.518.193-1.035.452-1.552.71-.452.323-.969.582-1.421.905-.453.323-.905.71-1.293 1.099-.452.323-.904.775-1.292 1.163-.388.452-.775.84-1.099 1.292-.323.517-.71.97-.969 1.486-.323.453-.646.97-.904 1.487-.26.581-.517 1.098-.711 1.68a49.803 49.803 0 00-.582 1.68c-.129.517-.258 1.034-.323 1.55 0 .066-.065.13-.065.195-.129.581-.129 1.357-.194 1.744-.064.453-.129.84-.129 1.293 0 .258 0 .581.065.84.065.452.13.84.259 1.228.129.387.258.775.452 1.163v.064c.194.388.452.776.71 1.164.26.387.518.775.84 1.163.324.323.712.71 1.1 1.034.387.387.775.71 1.227 1.034 1.551 1.357 1.939 1.809 3.942 2.843.323.194.646.323 1.034.517.065 0 .129.064.194.064 0 .13 0 .194.064.324.065.517.194 1.034.324 1.55a8.71 8.71 0 00.516 1.551c.194.388.324.776.517 1.164.065.129.13.258.194.323.259.517.517.969.776 1.421l.969 1.357c.323.388.71.84 1.099 1.228.387.388.775.71 1.227 1.099 0 0 .065.064.13.064.387.323.775.647 1.163.905.452.323.904.582 1.421.84.453.259.97.517 1.487.71.387.195.84.324 1.292.453.065.065.129.065.258.13.26.064.582.129.84.193-.193 3.49-.258 6.785.26 7.948.58 1.293 3.424-2.649 6.267-7.172-.388 4.458-.646 9.693 0 11.243.711 1.616 4.588-3.424 7.948-8.982C88.397 104.336 130.206 136 134.6 180.716c-.84-6.979-9.435-10.856-13.377-9.887-1.938 4.782-5.234 10.921-10.533 14.734a41.434 41.434 0 00-.646-12.924c-1.421 5.945-4.2 11.502-8.013 16.284-6.138.452-12.277-2.52-15.508-6.98-.259-.193-.323-.58-.517-.84-.194-.452-.388-.904-.517-1.356a5.365 5.365 0 01-.388-1.357c-.065-.453-.065-.905-.065-1.422v-.97c.065-.452.194-.904.323-1.356.13-.453.259-.905.453-1.357.258-.453.452-.905.775-1.357 1.099-3.102 1.099-5.622-.904-7.108a7.36 7.36 0 00-1.228-.647c-.259-.064-.582-.193-.84-.258-.194-.065-.323-.13-.517-.194-.453-.13-.905-.259-1.357-.323a4.923 4.923 0 00-1.357-.194c-.453-.065-.97-.13-1.422-.13-.323 0-.646.066-.97.066a5.04 5.04 0 00-1.42.193c-.453.065-.905.13-1.358.259-.452.13-.905.259-1.357.452-.452.194-.84.388-1.292.582-.388.194-.776.452-1.228.646-15.056 9.822-6.074 32.827 4.2 39.483-3.877.71-7.819 1.55-8.917 2.39l-.13.13c2.78 1.68 5.687 3.102 8.724 4.33a214.507 214.507 0 0010.469 3.101v.065a62.516 62.516 0 0016.284 1.163c28.626-2.003 52.083-23.78 56.348-52.471.13.581.259 1.098.388 1.68.194 1.163.452 2.39.581 3.619v.064c.13.582.194 1.164.259 1.68v.26c.065.58.13 1.162.13 1.68.064.71.128 1.42.128 2.132v1.034c0 .323.065.71.065 1.033 0 .388-.065.776-.065 1.164v.904c0 .453-.065.84-.065 1.293 0 .258 0 .517-.064.84 0 .452-.065.904-.065 1.421-.065.194-.065.388-.065.582-.064.517-.129.97-.194 1.486 0 .194 0 .388-.064.582-.065.646-.194 1.228-.259 1.874v.129c-.129.582-.258 1.228-.388 1.81v.193l-.387 1.745c0 .065-.065.194-.065.259-.13.581-.259 1.163-.452 1.744v.194c-.194.647-.388 1.228-.517 1.81-.065.064-.065.129-.065.129l-.582 1.938c-.258.647-.452 1.228-.71 1.874-.259.647-.453 1.293-.711 1.874-.259.647-.517 1.228-.776 1.874h-.064c-.26.582-.517 1.228-.84 1.81-.065.194-.13.323-.194.452-.065.065-.065.13-.13.194-4.2 8.465-10.403 15.896-18.158 21.712-.517.323-1.034.71-1.55 1.099-.13.129-.324.193-.453.323a27.34 27.34 0 01-1.421.969l.193.388h.065l2.714-.388h.065c1.68-.259 3.36-.582 5.04-.905.452-.065.97-.194 1.422-.323.323-.065.581-.129.904-.194.453-.064.905-.194 1.357-.258.388-.13.776-.194 1.164-.323 6.462-1.551 12.73-3.684 18.74-6.204-10.275 14.023-24.04 25.331-40.13 32.762 7.432-.517 14.863-1.744 22.036-3.812 26.042-7.69 47.948-25.202 61.065-48.788a103.145 103.145 0 01-17.382 41.55 101.732 101.732 0 0017.253-14.345c14.475-15.121 23.974-34.313 27.205-54.927a102.9 102.9 0 011.874 31.147c46.655-65.072 3.877-132.535-14.023-150.305-.064-.13-.129-.194-.129-.323-.064.064-.064.064-.064.129 0-.065 0-.065-.065-.13 0 .776-.065 1.551-.13 2.327-.193 1.486-.387 2.908-.646 4.33-.323 1.421-.71 2.843-1.098 4.264a53.747 53.747 0 01-1.55 4.136 55.49 55.49 0 01-1.94 3.942c-.71 1.227-1.486 2.52-2.326 3.683a49.368 49.368 0 01-2.65 3.49c-.969 1.163-2.002 2.197-3.036 3.23a41.646 41.646 0 01-1.874 1.616c-.517.452-.97.84-1.487 1.292-1.163.905-2.326 1.745-3.618 2.52-1.228.776-2.52 1.551-3.813 2.198-1.357.646-2.714 1.227-4.07 1.809-1.358.517-2.78.97-4.201 1.357a52.05 52.05 0 01-4.33.97c-1.486.258-2.972.387-4.394.516-1.034.065-2.068.13-3.102.13-1.486 0-2.972-.13-4.394-.26-1.486-.128-2.972-.322-4.394-.645-1.486-.26-2.908-.647-4.33-1.099h-.064c1.422-.13 2.843-.259 4.265-.517a46.84 46.84 0 004.33-.97 45.495 45.495 0 004.2-1.356c1.421-.517 2.778-1.163 4.07-1.81 1.358-.646 2.586-1.357 3.878-2.132 1.228-.84 2.455-1.68 3.619-2.585a35.333 35.333 0 003.295-2.908c1.099-.97 2.068-2.068 3.037-3.166a63.86 63.86 0 002.714-3.49c.13-.193.259-.452.388-.646.646-1.034 1.292-2.068 1.874-3.102a44.537 44.537 0 001.939-3.941 45.28 45.28 0 001.55-4.136c.453-1.357.776-2.779 1.099-4.2.259-1.486.517-2.908.646-4.33.13-1.486.259-2.972.259-4.394 0-1.034-.065-2.068-.13-3.102-.128-1.486-.322-2.907-.516-4.33a46.844 46.844 0 00-.97-4.329c-.452-1.357-.904-2.778-1.421-4.135-.517-1.357-1.163-2.714-1.81-4.007-.71-1.292-1.421-2.584-2.197-3.812a71.347 71.347 0 00-2.584-3.554 136.72 136.72 0 00-2.973-3.296 40.422 40.422 0 00-1.68-1.615 118.979 118.979 0 00-8.982-6.333c-.452-.259-.84-.452-1.293-.646-2.132-1.357-4.135-2.068-6.138-2.714z" fill="#e0234e" fill-rule="evenodd"/></svg>
Binary file
Binary file
Binary file
Binary file
@@ -1,8 +0,0 @@
1
- {
2
- "label": "Internals",
3
- "position": 4,
4
- "link": {
5
- "type": "generated-index",
6
- "description": "5 minutes to learn the most important Docusaurus concepts."
7
- }
8
- }
@@ -1,30 +0,0 @@
1
- ---
2
- title: Create Secure HMAC
3
- sidebar_label: Create Secure HMAC
4
- sidebar_position: 1
5
- ---
6
-
7
- In the following section, you will see a diagram of the cryptographic operations performed when calling the method [`createSecureHmac`][1]
8
-
9
- This method performs several cryptographic operations, including generating a salt,
10
- deriving a secure key using HKDF with the sha3-256 hashing algorithm, creating an HMAC,
11
- and returning the concatenated salt and HMAC result. The diagram will illustrate these steps clearly.
12
-
13
- <div style={{ textAlign: 'center' }}>
14
- ```mermaid
15
- graph TD
16
- A[Input Data: data] --> B[Generate Master Key from Options]
17
- B --> C[Generate Random Salt: 16 bytes]
18
- C --> D[Use HKDF with sha3-256, Master Key, and Salt]
19
- D --> E[Generate Secure Key: 64 bytes]
20
- E --> F[Create HMAC with sha3-256, Secure Key, and Data]
21
- F --> G[Concatenate Salt and HMAC]
22
- G --> H[Return Combined Buffer: Salt + HMAC]
23
-
24
- style B fill:#f9f,stroke:#333,stroke-width:2px
25
- style D fill:#bbf,stroke:#333,stroke-width:2px
26
- style F fill:#bfb,stroke:#333,stroke-width:2px
27
- ```
28
- </div>
29
-
30
- [1]: ../guides/hmac#create-a-secure-hmac
@@ -1,160 +0,0 @@
1
- ---
2
- title: Symmetric Secure Data Encrypt
3
- sidebar_label: Symmetric Secure Data Encrypt
4
- sidebar_position: 2
5
- ---
6
-
7
- In the following section, you will see a diagram of the cryptographic operations performed when calling the method [`symmetricSecureDataEncrypt`][1]
8
-
9
- This method securely encrypts input data by first generating a random 32-byte Data Encryption Key (DEK)
10
- using a cryptographically secure method. It then encrypts the data using AES-256-GCM with the DEK,
11
- producing an output that includes the initialization vector (IV), salt, authentication tag, and ciphertext.
12
- After encrypting the data, the method also encrypts the DEK itself using a master key, and finally,
13
- it concatenates the encrypted DEK and the encrypted data, returning the complete encrypted result for secure storage or transmission.
14
-
15
- ## **Diagram**
16
-
17
- <div style={{ textAlign: 'center' }}>
18
- ```mermaid
19
- graph TD
20
- A[Input: Data] --> ID
21
-
22
- DEK{Generate DEK} --> SG1
23
-
24
- subgraph SG1[Generate DEK]
25
- SG1A1[Generate 64 bytes of random data] --> SG1A1A2[Create Secret Key from random data]
26
- SG1A1A2 --> SG1A1A3[Generate another 64 bytes of random data]
27
- SG1A1A3 --> SG1A1A4[Use HKDF with sha3-256 to derive IV]
28
- end
29
-
30
-
31
- subgraph ED[Encrypt Data]
32
- SG1A1A4 --> DEK1[DEK]
33
-
34
- ID(DATA)
35
-
36
- IV1[IV] --> IV1A1{Generate IV}
37
- SALT1[SALT] --> SALT1A1{Generate SALT}
38
-
39
- IV1A1 --> SGIV1
40
- SALT1A1 --> SGSALT1
41
-
42
- subgraph SGIV1["Generate IV (12 bytes)"]
43
- SGIV1A1[Generate 64 bytes of random data] --> SGIV1A1A2[Create Secret Key from random data]
44
- SGIV1A1A2 --> SGIV1A1A3[Generate another 64 bytes of random data]
45
- SGIV1A1A3 --> SGIV1A1A4[Use HKDF with sha3-256 to derive IV]
46
- end
47
-
48
- subgraph SGSALT1["Generate Salt (64 bytes)"]
49
- SGSSALT1A1[Generate 64 bytes of random data] --> SGSSALT1A1A2[Create Secret Key from random data]
50
- SGSSALT1A1A2 --> SGSSALT1A1A3[Generate another 64 bytes of random data]
51
- SGSSALT1A1A3 --> SGSSALT1A1A4[Use HKDF with sha3-256 to derive SALT]
52
- end
53
-
54
- DEK1 --> DERIVEDEK[Securely derive DEK using Argon2 + Salt]
55
- DERIVEDEK --> EK1(Encryption Key)
56
- SGSSALT1A1A4 --> DERIVEDEK
57
-
58
- SGIV1A1A4 --> FIV1(IV)
59
- FIV1 ==> FED{Encrypt Data using AES-256-GCM with Encryption Key + IV}
60
- EK1 ==> FED
61
- ID ==> FED
62
-
63
- FED -.- FFED["Encrypted Data [IV + Salt + AuthTag + CipherText]"]
64
- end
65
-
66
-
67
- subgraph EDEK[Encrypt DEK]
68
- SG1A1A4 --> DEK2(DEK)
69
-
70
- IV2[IV] --> IV2A1{Generate IV}
71
- SALT2[SALT] --> SALT2A1{Generate SALT}
72
-
73
- IV2A1 --> SGIV2
74
- SALT2A1 --> SGSALT2
75
-
76
- subgraph SGIV2["Generate IV (12 bytes)"]
77
- SGIV2A1[Generate 64 bytes of random data] --> SGIV2A1A2[Create Secret Key from random data]
78
- SGIV2A1A2 --> SGIV2A1A3[Generate another 64 bytes of random data]
79
- SGIV2A1A3 --> SGIV2A1A4[Use HKDF with sha3-256 to derive IV]
80
- end
81
-
82
- subgraph SGSALT2["Generate Salt (64 bytes)"]
83
- SGSSALT2A1[Generate 64 bytes of random data] --> SGSSALT2A1A2[Create Secret Key from random data]
84
- SGSSALT2A1A2 --> SGSSALT2A1A3[Generate another 64 bytes of random data]
85
- SGSSALT2A1A3 --> SGSSALT2A1A4[Use HKDF with sha3-256 to derive SALT]
86
- end
87
-
88
- MK[MASTER KEY] --> DERIVEMK[Securely derive Master Key using Argon2 + Salt]
89
- DERIVEMK --> EK2(Encryption Key)
90
- SGSSALT2A1A4 --> DERIVEMK
91
-
92
- SGIV2A1A4 --> FIV2(IV)
93
-
94
- EK2 ==> FEDEK{Encrypt DEK using AES-256-GCM with Encryption Key + IV}
95
- DEK2 ==> FEDEK
96
- FIV2 ==> FEDEK
97
-
98
- FEDEK -.- FFEDEK["Encrypted DEK [IV + Salt + AuthTag + CipherText]"]
99
- end
100
-
101
- FFEDEK -.-> FFDD(["Concatenate Encrypted DEK + Encrypted Data"])
102
- FFED -.-> FFDD
103
-
104
-
105
- %% -----------------
106
-
107
- A:::inputDataStyle
108
-
109
- MK:::masterKeyStyle
110
-
111
- DEK:::dekStyle
112
-
113
- SALT1A1:::saltStyle
114
- SALT2A1:::saltStyle
115
-
116
- IV1A1:::ivStyle
117
- IV2A1:::ivStyle
118
-
119
- FEDEK:::encryptionStyle
120
- FED:::encryptionStyle
121
-
122
- FFEDEK:::resultStyle
123
- FFED:::resultStyle
124
-
125
- FFDD:::finalResultStyle
126
-
127
- %% Style definitions
128
- classDef inputDataStyle fill:#00ff00,stroke:#333,stroke-width:2px;
129
- classDef masterKeyStyle fill:#ff0000,stroke:#333,stroke-width:2px;
130
- classDef dekStyle fill:#BCD3A3,stroke:#333,stroke-width:2px;
131
- classDef ivStyle fill:#ffcc00,stroke:#333,stroke-width:2px;
132
- classDef saltStyle fill:#ff6666,stroke:#333,stroke-width:2px;
133
- classDef deriveKeyStyle fill:#66ccff,stroke:#333,stroke-width:2px;
134
- classDef secureKeyStyle fill:#66ff66,stroke:#333,stroke-width:2px;
135
- classDef encryptionStyle fill:#cc99ff,stroke:#333,stroke-width:2px;
136
- classDef resultStyle fill:#ff9966,stroke:#333,stroke-width:2px;
137
- classDef finalResultStyle fill:#66ffcc,stroke:#333,stroke-width:2px;
138
- ```
139
- </div>
140
-
141
-
142
- ## **Explanation of the Diagram**
143
- 1) Generate DEK:
144
- - The internal `createSaferRandomData` method generates a 32-byte **DEK** (Data Encryption Key) using `HKDF(sha3-256 + random_key + random_salt)`.
145
- 2) Encrypt the Input Data:
146
- - **Generate IV (12 bytes)**: A 12-byte IV is generated using `HKDF(sha3-256 + random_key + random_salt)`.
147
- - **Generate Salt (64 bytes)**: A 64-byte salt is generated, also using `HKDF(sha3-256 + random_key + random_salt)`.
148
- - **Derive Secure Encryption Key**: A secure encryption key is derived using **Argon2** with the DEK and salt.
149
- - **Encrypt Data**: The input data is encrypted using **AES-256-GCM** with the derived secure encryption key, producing the encrypted result: _IV + Salt + AuthTag + CipherText_.
150
- 3) Encrypt the DEK:
151
- - The DEK itself is encrypted using the master key:
152
- - **Generate IV (12 bytes)**: A 12-byte IV is generated using `HKDF(sha3-256 + random_key + random_salt)`.
153
- - **Generate Salt (64 bytes)**: A 64-byte salt is generated, also using `HKDF(sha3-256 + random_key + random_salt)`.
154
- - **Derive Master Key**: A secure encryption key is derived using **Argon2** with the [**MasterKey**][2] and salt.
155
- - **Encrypt DEK**: The DEK is encrypted using AES-256-GCM, resulting in the encrypted DEK: _IV + Salt + AuthTag + CipherText_.
156
- 4) Concatenate and Return:
157
- - The encrypted DEK and the encrypted input data are concatenated to form the final output, which is then returned.
158
-
159
- [1]: ../guides/symmetric-encryption#symmetricsecuredataencrypt
160
- [2]: ../api-reference/settings#masterkey-1
@@ -1,8 +0,0 @@
1
- {
2
- "label": "API Reference",
3
- "position": 2,
4
- "link": {
5
- "type": "generated-index",
6
- "description": "5 minutes to learn the most important Docusaurus concepts."
7
- }
8
- }