Skip to content

Commit c846f53

Browse files
mstoykovppcano
andauthored
Update k6/crypto to recommend the webcrypto API (#1224)
Co-authored-by: Pepe Cano <[email protected]>
1 parent d23d470 commit c846f53

18 files changed

+57
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Blockquote from 'components/shared/blockquote';
2+
import React from 'react';
3+
4+
const CryptoBlockquote = () => (
5+
<Blockquote mod="info">
6+
<h4>A module with a better and standard API exists</h4>
7+
<p>
8+
The new{' '}
9+
<a href="https://k6.io/docs/javascript-api/k6-experimental/webcrypto/">
10+
k6/experimental/webcrypto API
11+
</a>{' '}
12+
partially implements the{' '}
13+
<a href="https://www.w3.org/TR/WebCryptoAPI/">WebCryptoAPI</a>, supporting
14+
more features than{' '}
15+
<a href="https://k6.io/docs/javascript-api/k6-crypto/">k6/crypto</a>.
16+
</p>
17+
</Blockquote>
18+
);
19+
20+
export default CryptoBlockquote;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import CryptoBlockquote from './crypto-blockquote.view';
2+
3+
export default CryptoBlockquote;

src/components/templates/doc-page/doc-page-content/doc-page-content.view.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import BrowserDocsWIP from 'components/shared/browser-docs-wip';
99
import BrowserWIP from 'components/shared/browser-wip';
1010
import { Code, CodeInline, CodeGroup } from 'components/shared/code';
1111
import Collapsible from 'components/shared/collapsible';
12+
import CryptoBlockquote from 'components/shared/crypto-blockquote';
1213
import DescriptionList from 'components/shared/description-list';
1314
import ExperimentalBlockquote from 'components/shared/experimental-blockquote';
1415
import { HeadingLandmark } from 'components/shared/heading';
@@ -42,6 +43,7 @@ const componentsForNativeReplacement = {
4243
BrowserWIP,
4344
ExperimentalBlockquote,
4445
BlockingAwsBlockquote,
46+
CryptoBlockquote,
4547
WsBlockquote,
4648
InstallationInstructions,
4749
Tooltip,

src/data/markdown/docs/02 javascript api/03 k6-crypto.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
title: "k6/crypto"
33
excerpt: "The k6/crypto module provides common hashing functionality available in the GoLang crypto."
44
---
5-
The k6/crypto module provides common hashing functionality available in the GoLang [crypto](https://golang.org/pkg/crypto/) package.
5+
6+
<CryptoBlockquote />
7+
8+
The k6/crypto `module` provides common hashing functionality available in the GoLang [crypto](https://golang.org/pkg/crypto/) package.
69

710
| Function | Description |
811
| -------- | ----------- |

src/data/markdown/docs/02 javascript api/03 k6-crypto/01-createHash- algorithm -.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: 'Create a Hasher object, allowing the user to add data to hash mult
44
excerpt: 'Create a Hasher object, allowing the user to add data to hash multiple times, and extract hash digests along the way.'
55
---
66

7+
<CryptoBlockquote />
8+
79
Creates a hashing object that can then be fed with data repeatedly, and from which you can extract a hash digest whenever you want.
810

911
| Parameter | Type | Description |

src/data/markdown/docs/02 javascript api/03 k6-crypto/02-createHMAC- algorithm- secret -.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: 'Create an HMAC hashing object, allowing the user to add data to ha
44
excerpt: 'Create an HMAC hashing object, allowing the user to add data to hash multiple times, and extract hash digests along the way.'
55
---
66

7+
<CryptoBlockquote />
8+
79
Creates a HMAC hashing object that can then be fed with data repeatedly, and from which you can extract a signed hash digest whenever you want.
810

911
| Parameter | Type | Description |

src/data/markdown/docs/02 javascript api/03 k6-crypto/03-hmac- algorithm- secret- data- outputEncoding -.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: 'Use HMAC to sign input data.'
44
excerpt: 'Use HMAC to sign input data.'
55
---
66

7+
<CryptoBlockquote />
8+
79
Use [HMAC](https://en.wikipedia.org/wiki/Hash-based_message_authentication_code) to sign a piece of data using a shared secret.
810

911
| Parameter | Type | Description |

src/data/markdown/docs/02 javascript api/03 k6-crypto/04-md4- input- outputEncoding -.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: 'Use MD4 to hash input data.'
44
excerpt: 'Use MD4 to hash input data.'
55
---
66

7+
<CryptoBlockquote />
8+
79
Use [md4](https://pkg.go.dev/golang.org/x/crypto/md4) to hash input data.
810

911
| Parameter | Type | Description |

src/data/markdown/docs/02 javascript api/03 k6-crypto/05-md5- input- outputEncoding -.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: 'Use MD5 to hash input data.'
44
excerpt: 'Use MD5 to hash input data.'
55
---
66

7+
<CryptoBlockquote />
8+
79
Use [md5](https://golang.org/pkg/crypto/md5/) to hash input data.
810

911
| Parameter | Type | Description |

src/data/markdown/docs/02 javascript api/03 k6-crypto/06-randomBytes- int -.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: 'randomBytes.'
44
excerpt: 'randomBytes.'
55
---
66

7+
<CryptoBlockquote />
8+
79
Return an ArrayBuffer object with a number of cryptographically random bytes. It will either return exactly the amount of bytes requested or will throw an exception if something went wrong.
810

911
| Parameter | Type | Description |

0 commit comments

Comments
 (0)