Comparing version 0.10.4 to 0.11.0
@@ -16,4 +16,4 @@ import type { KeyPair } from "./index.js"; | ||
sign(privateKey: ArrayBufferLike, data: ArrayBufferLike): Promise<ArrayBuffer>; | ||
generateKey(modulusLength?: 2048 | 4096): Promise<KeyPair>; | ||
generateKeyPair(modulusLength?: 2048 | 4096): Promise<KeyPair>; | ||
} | ||
export {}; |
@@ -75,3 +75,3 @@ export class RSASSAPKCS1v1_5 { | ||
} | ||
async generateKey(modulusLength) { | ||
async generateKeyPair(modulusLength) { | ||
const cryptoKeyPair = await crypto.subtle.generateKey({ | ||
@@ -78,0 +78,0 @@ name: "RSA-PSS", |
{ | ||
"name": "oslo", | ||
"type": "module", | ||
"version": "0.10.4", | ||
"version": "0.11.0", | ||
"description": "A collection of auth-related utilities", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
@@ -81,6 +81,6 @@ # `oslo` | ||
const es256 = new ECDSA("SHA-256", "P-256"); | ||
const key = await es256.generateKey(); | ||
const { privateKey, publicKey } = await es256.generateKeyPair(); | ||
const data = new TextEncoder().encode("Hello world"); | ||
const signature = await es256.sign(key, data); | ||
const validSignature = await es256.verify(key, signature, data); | ||
const signature = await es256.sign(privateKey, data); | ||
const validSignature = await es256.verify(publicKey, signature, data); | ||
``` | ||
@@ -92,6 +92,6 @@ | ||
const rs256 = new RSASSAPKCS1v1_5("SHA-256"); | ||
const key = await rs256.generateKey(); | ||
const { privateKey, publicKey } = await rs256.generateKeyPair(); | ||
const data = new TextEncoder().encode("Hello world"); | ||
const signature = await rs256.sign(key, data); | ||
const validSignature = await rs256.verify(key, signature, data); | ||
const signature = await rs256.sign(privateKey, data); | ||
const validSignature = await rs256.verify(publicKey, signature, data); | ||
``` | ||
@@ -102,7 +102,7 @@ | ||
const rsaPSS256 = new RSAPSS("SHA-256"); | ||
const key = await rsaPSS256.generateKey(); | ||
const ps256 = new RSAPSS("SHA-256"); | ||
const { privateKey, publicKey } = await ps256.generateKeyPair(); | ||
const data = new TextEncoder().encode("Hello world"); | ||
const signature = await rsaPSS256.sign(key, data); | ||
const validSignature = await rsaPSS256.verify(key, signature, data); | ||
const signature = await ps256.sign(privateKey, data); | ||
const validSignature = await ps256.verify(publicKey, signature, data); | ||
``` | ||
@@ -109,0 +109,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91839