Skip to content

Commit

Permalink
standardize casing for key pair
Browse files Browse the repository at this point in the history
  • Loading branch information
jshawl committed Feb 16, 2024
1 parent 900af11 commit 15022a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/dpop.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ const KEY_OPTIONS = {
usages: ["sign", "verify"],
};

let keypair;
let keyPair;
export const generateKeyPair: GenerateKeyPair = async () => {
if (!keypair) {
if (!keyPair) {
const { create, extractable, usages } = KEY_OPTIONS;
const { publicKey, privateKey } = await window.crypto.subtle.generateKey(
create,
extractable,
usages
);

keypair = keypair || { publicKey, privateKey };
keyPair = keyPair || { publicKey, privateKey };
}

return keypair;
return keyPair;
};

export const stringToBytes = (string: string): Uint8Array => {
Expand Down
4 changes: 2 additions & 2 deletions src/dpop.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ describe("DPoP", () => {
expect.assertions(1);
});
});
describe("keypair generation", () => {
it("memoizes the keypair", async () => {
describe("key pair generation", () => {
it("memoizes the key pair", async () => {
const { publicKey: publicKey1 } = await generateKeyPair();
const jwk1 = await window.crypto.subtle.exportKey("jwk", publicKey1);
const { publicKey: publicKey2 } = await generateKeyPair();
Expand Down

0 comments on commit 15022a0

Please sign in to comment.