This is what I've got so far to export a public and private key from a keypair:
let pub = await crypto.subtle.exportKey("spki", keyPair.publicKey);
let prv = await crypto.subtle.exportKey("spki", keyPair.privateKey);
This results in two individual array buffers holding my public and private key.
I would like to find out how to export the entire keypair at once into a single array buffer?
Something like this:
let pair = await crypto.subtle.exportKeyPair("spki", keyPair);
Is there a web api and a format for this?
Otherwise is there a safe way to concatenate the two array buffers (the exported public and private key) together in such a way that I can split them up again when importing? I would then need to have some mechanism to handle malformed input when importing the exported key pair.
I must do this because my interface requires me to return a single array buffer.