LIT-Protocol / LitGrants

Apply for a Lit grant and be part of the Lit ecosystem!
22 stars 2 forks source link

Small Grants: Lit-Suiet, The First Sui base wallet with PKP #52

Closed yhl125 closed 11 months ago

yhl125 commented 1 year ago

1. What is your project? (max 100 words)

pkp-sui sdk and sui wallet with pkp webauthn

https://github.com/yhl125/pkp-sui https://github.com/yhl125/lit-suiet demo: https://youtu.be/IhUsXxZzumE

2. How is Lit used for this project? (max 100 words)

We used PKP and Lit action to build pkp-sui sdk And will use pkp-sui sdk, Lit Relayer to build WebAuthn login wallet

3. How will you improve your project with this grant? What steps will you take to meet this objective? (max 200 words)

With this grant, we aim to develop a seedless wallet on sui

pkp-sui sdk - typescript PKPSuiWallet sdk and test codes

lit-suiet - Add google login using lit relayer and pkp-sui. Change core to work with PKPSuiWallet for sign transaction and message.

we tried to use webauthn in chrome extension but we failed. Our first issue was @simplewebauthn/browser startRegistration is not compatible with chrome extension. Chrome extension should leave the RP ID fields in WebAuthn structures blank.

https://chromium.googlesource.com/chromium/src/+/main/content/browser/webauth/origins.md

So we changed to @github/webauthn-json create, then we got 'Unable to verify registration: Unexpected RP ID hash (code: -1)'. To resolve this issue, we used verifyAndMintPKPThroughRelayer js-sdk in feature/lit-462-remove-verification-steps-from-relayer and deploy and use feature/lit-462-remove-verification-steps-from-relayer-required-before relay-server. We successfully minted pkp. But we failed to fetchPKPs. we tried both @simplewebauthn/browser startAuthentication and @github/webauthn-json/browser-ponyfill get. But we received same error from serrano node signSessionKey

{ "errorKind": "Unexpected", "status": 500, "message": "An unexpected has occured.", "correlationId": "lit_071c04dcbebd", "details": [ "parser error: Unable to decode credential public key CBOR: parser error: Failed to decode CBOR encoded COSE key: Io(Error { kind: UnexpectedEof, message: \"failed to fill whole buffer\" })" ] }

So we decided to change the authentication method to Google Login.

4. Is this project open source?

Apache-2.0 for sdk and GPL-3.0 for wallet

5. Do you agree to share grant reports upon request, including a final grant report at the end of the two month period?

Yes

6. Links and submissions

We will apply for Sui x KuCoin Labs Summer Hackathon. But we didn't participated any hackathon yet.

7. Total Budget Requested

Our Goal is to get $2,500 but we are not familiar with setting up a milestone with funds. So with a little help would help us a lot.

Additional questions:

Yoon Hyoung Lee, yoonhlee98@gmail.com, https://github.com/yhl125, pkp-sui sdk and sui wallet

Minseok Kim, altpd13@gmail.com, https://github.com/altpd13, sui wallet

Discord

Sui x KuCoin Labs Summer Hackathon https://hack.sui.io/

debbly commented 1 year ago

Hi @yhl125, thanks for opening up with grant!

A clarifcation question from our end - Sui is not currently a supported chain with PKPs - can you explain more about your implementation of it?

For milestone breakdown - we like to see 2-3 milestones breaking down the project into smaller parts that we can validate and test at each step. This is to make sure we can pay you incrementally and keep track of project goals.

yhl125 commented 1 year ago

@debbly You can find the implementation in https://github.com/yhl125/pkp-sui and it's published on npm at https://www.npmjs.com/package/@yhl125/pkp-sui.

In pkp-sui.ts, I've implemented PKPSuiWallet which extends PKPBase for PKP compatibility. I copied the code from SignerWithProvider in the MystenLabs/sui TypeScript SDK (@mysten/sui.js's original code repository). I wrote the constructor, getAddress, signData, and connect methods. For signData I've seen implementation in MystenLabs/sui RawSigner, Secp256k1Keypair. It used noble/curves to sign and return it to toSerializedSignature. So I converted the signature of runLitAction to the CompactRawBytes signature of noble/curves/secp256k1 and return it toSerializedSignature.

For testing, I referred to https://github.com/LIT-Protocol/js-sdk-pr-56-cosmos-signer. You can test it as described in the README.

Milestone 1: pkp-sui SDK (done) Milestone 2: wallet's frontend implementation Milestone 3: integrate pkp-sui to LIT-Protocol/js-sdk

debbly commented 1 year ago

hey @yhl125 - we're actively reviewing your sui PR into the js-sdk and will be testing it on our end!

On the milestone end, we want to see a working wallet implementation so I can see the milestone breakdown as:

Milestone 1: pkp-sui SDK - with tests and a video showing the PKP wallet able to hold and transfer SUI assets $1k

Milestone 2: integrate pkp-sui to LIT-Protocol/js-sdk $1k

Milestone 3: documentation - technical write up and explanation of how the integration was possible and how a developer can use your code to create a SUI PKP wallet. $500

Let me know what you think about this breakdown!

yhl125 commented 1 year ago

@debbly Thank you for reviewing my PR. BreakDown is perfect! However, I would like to know more details about Milestone 3. Specifically, where should we write the documentation, and do we need to follow a particular format? Thank you

yhl125 commented 1 year ago

Hi @debbly We are thrilled to announce that we secured 2nd place in the Best Overall category!!! https://twitter.com/SuiNetwork/status/1683659790243987456 https://blog.sui.io/hackathon-winners/

demo day presentation: https://www.youtube.com/live/m-7_pCV4QyQ?feature=share&t=4293