Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could I generate a Secret from a CryptoKit Key? #3

Open
ralvarez-airata opened this issue Apr 4, 2024 · 3 comments
Open

Could I generate a Secret from a CryptoKit Key? #3

ralvarez-airata opened this issue Apr 4, 2024 · 3 comments

Comments

@ralvarez-airata
Copy link

I am trying to implement peer-did with this library and I am trying to generate the keys on runtime. Is it possible? I saw that you have jose-swift, is it posible with these libraries?

@goncalo-frade-iohk
Copy link

goncalo-frade-iohk commented Apr 5, 2024

To answer your question, you can generate the keys in runtime, but you generate them upon creating a DID.

And then you use the DID to send the message, the library will request the private key (secret).

This library is agnostic to the did method.

But the way it works is (let's use peer did).

A did has verification methods and each method has an ID, now as an example let's say you want to send signed didcomm message from a DID (did:peer:bobDID) to a DID (did:peer:aliceDID).

Upon resolving bobDID, that has a verification method of type authentication with a public key with an ID "did:peer:bobDID#0".

The didcomm library will require from you the private key (secret) that is pair with the public key "did:peer:bobDID#0".

Then it will prepare and sign the message with this secret.

When aliceDID receives the message, DIDcomm library will resolve bobDID on her Alice side and verify if the message was sent by bob, using the public key "did:peer:bobDID#0".

@goncalo-frade-iohk
Copy link

Btw you have this peer-did library as well. You can use them together.

https://github.com/beatt83/peerdid-swift

@beatt83
Copy link
Owner

beatt83 commented Apr 8, 2024

@ralvarez-airata you can create the keys needed with CryptoKit that is Apple framework. Curve25519.Signing.PrivateKey and Curve25519.Agreement.PrivateKey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants