This commit is contained in:
+2
-2
@@ -17,11 +17,11 @@ export class PrivateWrap {
|
||||
private readonly pubkey: CryptoKey,
|
||||
) {}
|
||||
|
||||
public static gen_keypair() : Promise<CryptoKeyPair> {
|
||||
public static gen_keypair(extractable : boolean = true) : Promise<CryptoKeyPair> {
|
||||
log.trace("generate keypair")
|
||||
return crypto.subtle.generateKey(
|
||||
algorithm,
|
||||
true,
|
||||
extractable,
|
||||
["deriveKey"],
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -9,14 +9,14 @@ export class SecretBox {
|
||||
private readonly cipher: Uint8Array,
|
||||
) {}
|
||||
|
||||
public static gen_key() : Promise<CryptoKey> {
|
||||
public static gen_key(extractable : boolean = true) : Promise<CryptoKey> {
|
||||
log.trace("generate key")
|
||||
return crypto.subtle.generateKey(
|
||||
{
|
||||
name: "AES-GCM",
|
||||
length: 256,
|
||||
},
|
||||
true,
|
||||
extractable,
|
||||
["encrypt", "decrypt"],
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,14 +12,14 @@ export class SecretWrap {
|
||||
private readonly iv: Uint8Array,
|
||||
) {}
|
||||
|
||||
public static gen_key() : Promise<CryptoKey> {
|
||||
public static gen_key(extractable : boolean = true) : Promise<CryptoKey> {
|
||||
log.trace("generate key")
|
||||
return crypto.subtle.generateKey(
|
||||
{
|
||||
name: "AES-GCM",
|
||||
length: 256,
|
||||
},
|
||||
true,
|
||||
extractable,
|
||||
["wrapKey", "unwrapKey"],
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
import logger from 'log'
|
||||
const log = logger('crypto:signature')
|
||||
|
||||
export async function gen_keypair() : Promise<CryptoKeyPair> {
|
||||
export async function gen_keypair(extractable : boolean = true) : Promise<CryptoKeyPair> {
|
||||
return crypto.subtle.generateKey(
|
||||
{
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-521",
|
||||
},
|
||||
true,
|
||||
extractable,
|
||||
["sign", "verify"]
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user