Skip to content

Comments

docs(SubtleCrypto): fix example code#14446

Merged
wbamberg merged 1 commit intomdn:mainfrom
considine:patch-1
Mar 29, 2022
Merged

docs(SubtleCrypto): fix example code#14446
wbamberg merged 1 commit intomdn:mainfrom
considine:patch-1

Conversation

@considine
Copy link
Contributor

generateKey returns a Promise. The variable names (key and keyPair) seem to indicate that these are actual values, but unawaited they are promises. Adding an await makes that more clear.

Summary

I'm fixing the example code in the SubtleCrypto generateKey docs; this method returns a Promise, but the example snippets suggest (at least implicitly) that they resolve immediately.

Motivation

It will help people reading the SubtleCrypto docs.

Supporting details

Related issues

Metadata

  • Adds a new document
  • Rewrites (or significantly expands) a document
  • Fixes a typo, bug, or other error

`generateKey` returns a Promise. The variable names (`key` and `keyPair`) seem to indicate that these are actual values, but unawaited they are promises. Adding an await makes that more clear.
@considine considine requested a review from a team as a code owner March 29, 2022 21:29
@considine considine requested review from wbamberg and removed request for a team March 29, 2022 21:29
@github-actions github-actions bot added the Content:WebAPI Web API docs label Mar 29, 2022
@github-actions
Copy link
Contributor

Preview URLs

Flaws

URL: /en-US/docs/Web/API/SubtleCrypto/generateKey
Title: SubtleCrypto.generateKey()
on GitHub
Flaw count: 1

  • macros:
    • wrong xref macro used (consider changing which macro you use)

External URLs

URL: /en-US/docs/Web/API/SubtleCrypto/generateKey
Title: SubtleCrypto.generateKey()
on GitHub

No new external URLs

Copy link
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thank you @considine !

@wbamberg wbamberg merged commit 4c6dbfb into mdn:main Mar 29, 2022
@considine considine deleted the patch-1 branch March 30, 2022 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants