mirror of
https://github.com/Blah-IM/typescript-core.git
synced 2025-04-30 16:21:10 +00:00
feat(crypto): allow generating non extractable keypair with additional usage
This commit is contained in:
parent
ae146c8ab2
commit
49d0079e46
1 changed files with 6 additions and 2 deletions
|
@ -28,13 +28,17 @@ export class BlahKeyPair {
|
|||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
static async generate(): Promise<BlahKeyPair> {
|
||||
static async generate(
|
||||
extractable: boolean = true,
|
||||
additionalUsage: KeyUsage[] = [],
|
||||
): Promise<BlahKeyPair> {
|
||||
const { publicKey, privateKey } = await crypto.subtle.generateKey(
|
||||
"Ed25519",
|
||||
true,
|
||||
extractable,
|
||||
[
|
||||
"sign",
|
||||
"verify",
|
||||
...additionalUsage,
|
||||
],
|
||||
) as CryptoKeyPair;
|
||||
const publicIdentity = await BlahPublicKey.fromPublicKey(publicKey);
|
||||
|
|
Loading…
Add table
Reference in a new issue