nestjs-cryptography 2.2.2 → 3.0.0

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 (64) hide show
  1. package/README.md +147 -0
  2. package/dist/cryptography.service.d.ts +21 -23
  3. package/dist/cryptography.service.js +82 -82
  4. package/dist/interfaces/cryptography-options.interface.d.ts +1 -1
  5. package/dist/interfaces/generic-options.interface.d.ts +5 -0
  6. package/dist/interfaces/generic-options.interface.js +2 -0
  7. package/dist/interfaces/index.d.ts +1 -0
  8. package/dist/interfaces/index.js +1 -0
  9. package/package.json +16 -15
  10. package/wiki/README.md +41 -0
  11. package/wiki/babel.config.js +3 -0
  12. package/wiki/docs/Internals/_category_.json +7 -0
  13. package/wiki/docs/Internals/create-safe-random-data.mdx +41 -0
  14. package/wiki/docs/Internals/create-secure-hmac.mdx +31 -0
  15. package/wiki/docs/Internals/symmetric-data-encrypt.mdx +103 -0
  16. package/wiki/docs/Internals/symmetric-secure-data-encrypt.mdx +161 -0
  17. package/wiki/docs/api-reference/_category_.json +7 -0
  18. package/wiki/docs/api-reference/settings.mdx +199 -0
  19. package/wiki/docs/guides/_category_.json +7 -0
  20. package/wiki/docs/guides/generics.mdx +170 -0
  21. package/wiki/docs/guides/hashing.mdx +258 -0
  22. package/wiki/docs/guides/hmac.mdx +271 -0
  23. package/wiki/docs/guides/key-derivation.mdx +101 -0
  24. package/wiki/docs/guides/password-hashing.mdx +136 -0
  25. package/wiki/docs/guides/symmetric-encryption.mdx +272 -0
  26. package/wiki/docs/intro.mdx +148 -0
  27. package/wiki/docusaurus.config.ts +138 -0
  28. package/wiki/package.json +48 -0
  29. package/wiki/sidebars.ts +20 -0
  30. package/wiki/src/common/timing-attack.mdx +3 -0
  31. package/wiki/src/common/tips.mdx +18 -0
  32. package/wiki/src/components/GenerateHexButton/index.tsx +35 -0
  33. package/wiki/src/components/GenerateHexButton/styles.module.css +10 -0
  34. package/wiki/src/components/GenericLabel/index.tsx +19 -0
  35. package/wiki/src/components/HomepageFeatures/index.tsx +70 -0
  36. package/wiki/src/components/HomepageFeatures/styles.module.css +11 -0
  37. package/wiki/src/components/RecommendedLabel/index.tsx +19 -0
  38. package/wiki/src/components/RequiredLabel/index.tsx +12 -0
  39. package/wiki/src/css/custom.css +30 -0
  40. package/wiki/src/pages/index.module.css +23 -0
  41. package/wiki/src/pages/index.tsx +43 -0
  42. package/wiki/src/pages/markdown-page.md +7 -0
  43. package/wiki/static/.nojekyll +0 -0
  44. package/wiki/static/img/gear_api.png +0 -0
  45. package/wiki/static/img/logo.svg +1 -0
  46. package/wiki/static/img/nestjs_favicon.ico +0 -0
  47. package/wiki/static/img/node_crypto.png +0 -0
  48. package/wiki/static/img/phc_logo.png +0 -0
  49. package/wiki/static/img/profile.png +0 -0
  50. package/wiki/versioned_docs/version-2.x/Internals/_category_.json +8 -0
  51. package/wiki/versioned_docs/version-2.x/Internals/create-secure-hmac.mdx +30 -0
  52. package/wiki/versioned_docs/version-2.x/Internals/symmetric-secure-data-encrypt.mdx +160 -0
  53. package/wiki/versioned_docs/version-2.x/api-reference/_category_.json +8 -0
  54. package/wiki/versioned_docs/version-2.x/api-reference/settings.mdx +197 -0
  55. package/wiki/versioned_docs/version-2.x/guides/_category_.json +7 -0
  56. package/wiki/versioned_docs/version-2.x/guides/generics.mdx +133 -0
  57. package/wiki/versioned_docs/version-2.x/guides/hashing.mdx +229 -0
  58. package/wiki/versioned_docs/version-2.x/guides/hmac.mdx +198 -0
  59. package/wiki/versioned_docs/version-2.x/guides/key-derivation.mdx +98 -0
  60. package/wiki/versioned_docs/version-2.x/guides/password-hashing.mdx +132 -0
  61. package/wiki/versioned_docs/version-2.x/guides/symmetric-encryption.mdx +107 -0
  62. package/wiki/versioned_docs/version-2.x/intro.mdx +148 -0
  63. package/wiki/versioned_sidebars/version-2.x-sidebars.json +8 -0
  64. package/wiki/versions.json +3 -0
@@ -0,0 +1,138 @@
1
+ import { themes as prismThemes } from 'prism-react-renderer';
2
+ import type { Config } from '@docusaurus/types';
3
+ import type * as Preset from '@docusaurus/preset-classic';
4
+
5
+ const config: Config = {
6
+ title: 'NestJS - Cryptography',
7
+ tagline: 'Secure NestJS cryptography module 🔐',
8
+ favicon: 'img/nestjs_favicon.ico',
9
+
10
+ url: 'https://nestjs-cryptography.thewolfx41.dev',
11
+ baseUrl: '/',
12
+
13
+ organizationName: 'mjorgegulab',
14
+ projectName: 'nestjs-cryptography',
15
+
16
+ onBrokenLinks: 'warn',
17
+ onBrokenMarkdownLinks: 'warn',
18
+
19
+ i18n: {
20
+ defaultLocale: 'en',
21
+ locales: ['en'],
22
+ },
23
+
24
+ presets: [
25
+ [
26
+ 'classic',
27
+ {
28
+ docs: {
29
+ sidebarPath: './sidebars.ts',
30
+ editUrl: 'https://github.com/mjorgegulab/nestjs-cryptography',
31
+ lastVersion: 'current',
32
+ versions: {
33
+ current: {
34
+ label: '3.x',
35
+ },
36
+ },
37
+ },
38
+ theme: {
39
+ customCss: './src/css/custom.css',
40
+ },
41
+ } satisfies Preset.Options,
42
+ ],
43
+ ],
44
+
45
+ markdown: {
46
+ mermaid: true,
47
+ },
48
+ themes: ['@docusaurus/theme-mermaid'],
49
+
50
+ themeConfig: {
51
+ image: 'img/profile.png',
52
+ colorMode: {
53
+ defaultMode: 'dark',
54
+ disableSwitch: false,
55
+ respectPrefersColorScheme: false,
56
+ },
57
+ navbar: {
58
+ title: 'NestJS - Cryptography',
59
+ logo: {
60
+ alt: 'NestJS Logo',
61
+ src: 'img/logo.svg',
62
+ },
63
+ items: [
64
+ {
65
+ type: 'docSidebar',
66
+ sidebarId: 'tutorialSidebar',
67
+ position: 'left',
68
+ label: 'Docs',
69
+ },
70
+ {
71
+ type: 'docsVersionDropdown',
72
+ position: 'right',
73
+ },
74
+ {
75
+ href: 'https://github.com/mjorgegulab/nestjs-cryptography',
76
+ label: 'GitHub',
77
+ position: 'right',
78
+ },
79
+ ],
80
+ },
81
+ footer: {
82
+ style: 'dark',
83
+ links: [
84
+ {
85
+ title: 'Docs',
86
+ items: [
87
+ {
88
+ label: 'Getting Started',
89
+ to: '/docs/intro',
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ title: 'Project',
95
+ items: [
96
+ {
97
+ label: 'Issues',
98
+ href: 'https://github.com/mjorgegulab/nestjs-cryptography/issues',
99
+ },
100
+ {
101
+ label: 'Contribute',
102
+ href: 'https://github.com/mjorgegulab/nestjs-cryptography/issues',
103
+ },
104
+ ],
105
+ },
106
+ {
107
+ title: 'Community',
108
+ items: [
109
+ {
110
+ label: 'Stack Overflow',
111
+ href: 'https://stackoverflow.com/questions/tagged/nestjs',
112
+ },
113
+ ],
114
+ },
115
+ {
116
+ title: 'More',
117
+ items: [
118
+ {
119
+ label: 'GitHub',
120
+ href: 'https://github.com/mjorgegulab',
121
+ },
122
+ ],
123
+ },
124
+ ],
125
+ copyright: `Copyright © ${new Date().getFullYear()} Marc Jorge`,
126
+ },
127
+ prism: {
128
+ theme: prismThemes.github,
129
+ darkTheme: prismThemes.dracula,
130
+ defaultLanguage: 'typescript',
131
+ },
132
+ mermaid: {
133
+ theme: { dark: 'neutral' },
134
+ },
135
+ } satisfies Preset.ThemeConfig,
136
+ };
137
+
138
+ export default config;
@@ -0,0 +1,48 @@
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
+ }
@@ -0,0 +1,20 @@
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;
@@ -0,0 +1,3 @@
1
+ > _This method uses a time-safe comparison function to prevent [timing attacks][1]_
2
+
3
+ [1]: https://en.wikipedia.org/wiki/Timing_attack
@@ -0,0 +1,18 @@
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
@@ -0,0 +1,35 @@
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;
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,19 @@
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;
@@ -0,0 +1,70 @@
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
+ }
@@ -0,0 +1,11 @@
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
+ }
@@ -0,0 +1,19 @@
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;
@@ -0,0 +1,12 @@
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;
@@ -0,0 +1,30 @@
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
+ }
@@ -0,0 +1,23 @@
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
+ }
@@ -0,0 +1,43 @@
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
+ }
@@ -0,0 +1,7 @@
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
@@ -0,0 +1 @@
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
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,30 @@
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