UCAN + signing with keys

This is re-posted from the discord –

What is the API for working with the private key (as opposed to the UCAN API)?

There’s the WebCrypto API (which is a standard browser API). We also have a wrapper for key management called keystore-idb.

I’m wondering, is it expected to use the same private key for the UCAN as you use to sign application-specific messages? I was looking at the keystore-idb API, and you have operations that sign a message and verify , but how to get the keystore that is used by the UCAN API?

  const ks1 = await keystore.init({
    storeName: 'keystore'
  })

Likewise, looking at the SubtleCrypto.sign() API, it takes a key parameter, which I’m not sure how to get. Sorry this is kind of getting into the weeds. I’m trying to make a little demo page that shows how you would use DID/UCAN in an application.

await webnative.keystore.get()

is what you would use to get webnative’s keystore instance.
Docs: keystore | Fission SDK

Regarding last question, I think you’d use keystoreInstance.sign instead. That said, you can get the private key by doing (await keystoreInstance.writeKey()).privateKey