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

Implement TezosSignature2021 (TezosMethod2021) #170

Merged
merged 2 commits into from
Apr 14, 2021
Merged

Implement TezosSignature2021 (TezosMethod2021) #170

merged 2 commits into from
Apr 14, 2021

Conversation

clehner
Copy link
Contributor

@clehner clehner commented Apr 6, 2021

Create a linked data signature suite (verification method type and proof type) for signed Tezos messages.

Temple (madfish-solutions/templewallet-extension#238) and Kukai (kukai-wallet/kukai#65) allow signing messages, either as raw bytes or as a string Micheline expression beginning with prefix "Tezos Signed Message". We use the Micheline option, since that enables the user to see a string in the signing request instead of only bytes.

Similar to the Eip712Signature2021, this attempts to create a verification method for using with existing wallet applications, allowing the user to see data being signed in a richer format than a byte string. The signing format implemented here is a string containing NQuads of the URDNA2015-normalized linked data document (VC/VP) and the linked data proof options. This is as done in
existing suites such as Ed25519 Signature 2018 and JSON Web Signature 2020 but with the Create Verify Hash Algorithm modified in order to present the user with unhashed data.

Since this proof type is intended for use with Tezos accounts, which are identified by public key hashes, this signature suite will support including the public key in the proof object instead of in the verification method, and using the blockchainAccountId property of the verification method to validate the public key included in the proof. This is to enable use with signing algorithms that do not support public key recovery, as done in the existing proof types Ed25519BLAKE2BDigestSize20Base58CheckEncodedSignature2021 and P256BLAKE2BDigestSize20Base58CheckEncodedSignature2021 (which are being considered for renaming in #152).

The jwk_from_tezos_key function I copied from @chunningham and add it here since it will be needed in DIDKit in the browser in order to convert the wallet's edpk into a JWK to pass to DIDKit. This function only supports edpk currently, not yet p2pk or sppk.

I found an odd thing with spsig which is that unlike edsig and p2sig, the prefix bytes do not match the base58: it results in "4sLJ" instead. I am following the bytes ("4sLJ") rather than the ASCII. I have not tested this with an actual Tezos implementation so I don't know if this is correct. Only edpk/edsig here has been used externally (with Temple wallet).

  • Initial draft of ProofSuite implementation
  • Add the verification method to DID documents: added to did:pkh
  • Test signing with tz1, tz2, and tz3
  • Add demo app using Kukai and/or Temple for VC/VP issuance: Add initial implementation didkit-tezos-wallet-example#1 (Temple)
  • Create specification for signature suite

@clehner clehner marked this pull request as ready for review April 7, 2021 20:46
@clehner clehner changed the title WIP: TezosSignature2021 Implement TezosSignature2021 (TezosMethod2021) Apr 7, 2021
@wyc wyc requested a review from chunningham April 12, 2021 21:46
Copy link
Contributor

@wyc wyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay merging this, but we should make an issue to modularize verification methods into optional crates. Ideally, someone should be able to use ssi with zero blockchain dependencies (or all of them!) if they so choose.

src/ldp.rs Show resolved Hide resolved
src/ldp.rs Show resolved Hide resolved
clehner and others added 2 commits April 14, 2021 14:12
Test TezosMethod2021 in did:pkh
Co-authored-by: Charles Cunningham <c.a.cunningham6@gmail.com>
@clehner
Copy link
Contributor Author

clehner commented Apr 14, 2021

Rebasing...

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

Successfully merging this pull request may close these issues.

None yet

4 participants