mailchain / mailchain-legacy

Using Mailchain, blockchain users can now send and receive rich-media HTML messages with attachments via a blockchain address.
https://mailchain.xyz
Apache License 2.0
143 stars 51 forks source link

Support sr25519 curve #327

Closed robdefeo closed 4 years ago

robdefeo commented 4 years ago

Is your feature request related to a problem? Please describe. Substrate uses SR25519

Describe the solution you'd like Implement sr25519 algorithm against the the PublicKey and PrivateKey interfaces

// PrivateKey definition usable in all mailchain crypto operations
type PrivateKey interface {
    // Bytes returns the byte representation of the private key
    Bytes() []byte
    // PublicKey from the PrivateKey
    PublicKey() PublicKey
        Sign(message []byte) (signature []byte, err error)
}

// PublicKey definition usable in all mailchain crypto operations
type PublicKey interface {
    // Bytes returns the byte representation of the public key
    Bytes() []byte
        Verify(data []byte) error
}

Additional items

Describe alternatives you've considered Using CGO to and calling https://github.com/Warchant/sr25519-crust C bindings exist against https://github.com/w3f/schnorrkel

Additional context

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 300.0 DAI (300.0 USD @ $1.0/DAI) attached to it.

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Workers have applied to start work.

These users each claimed they can complete the work by 3 weeks, 6 days from now. Please review their action plans below:

1) developerfred has applied to start work _(Funders only: approve worker | reject worker)_.

I will go create Elliptic Curve algorithm with pokadot docs and ristretto docs. This math struct nG = Hn* P dot P dot

base [1]Decaf: Eliminating cofactors though point compression - Mike Hamburg

Learn more on the Gitcoin Issue Details page.

gitcoinbot commented 4 years ago

@developerfred Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

@developerfred Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

@developerfred Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

@developerfred Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

@developerfred Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

@developerfred Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

@developerfred Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

@developerfred Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Workers have applied to start work.

These users each claimed they can complete the work by 1 day, 9 hours from now. Please review their action plans below:

1) developerfred has applied to start work _(Funders only: approve worker | reject worker)_.

I'm trying to submit my pull request and I'm not getting here is the link https://github.com/mailchain/mailchain/pull/360

Learn more on the Gitcoin Issue Details page.

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 3 weeks, 1 day ago. Please review their action plans below:

1) developerfred has been approved to start work.

I'm trying to submit my pull request and I'm not getting here is the link https://github.com/mailchain/mailchain/pull/360 2) developerfred has been approved to start work.

I'm trying to submit my pull request and I'm not getting here is the link https://github.com/mailchain/mailchain/pull/360

Learn more on the Gitcoin Issue Details page.

developerfred commented 4 years ago

Is your feature request related to a problem? Please describe. Substrate uses SR25519

Describe the solution you'd like Implement sr25519 algorithm against the the PublicKey and PrivateKey interfaces

// PrivateKey definition usable in all mailchain crypto operations
type PrivateKey interface {
  // Bytes returns the byte representation of the private key
  Bytes() []byte
  // PublicKey from the PrivateKey
  PublicKey() PublicKey
        Sign(message []byte) (signature []byte, err error)
}

// PublicKey definition usable in all mailchain crypto operations
type PublicKey interface {
  // Bytes returns the byte representation of the public key
  Bytes() []byte
        Verify(data []byte) error
}

Additional items

  • [x] Test package sr25519test with sofia
  Secret seed: 0x5c6d7adf75bda1180c225d25f3aa8dc174bbfb3cddee11ae9a85982f6faf791a
  Public key (hex): 0x169a11721851f5dff3541dd5c4b0b478ac1cd092c9d5976e83daa0d03f26620c
  Address (SS58): 5CaLgJUDdDRxw6KQXJY2f5hFkMEEGHvtUPQYDWdSbku42Dv2
  • [x] Test package sr25519test with charlotte
  Secret seed: 0x23b063a581fd8e5e847c4e2b9c494247298791530f5293be369e8bf23a45d2bd
  Public key (hex): 0x84623e7252e41138af6904e1b02304c941625f39e5762589125dc1a2f2cf2e30
  Address (SS58): 5F4HMyes8GNWzpSDjTPSh61Aw6RTaWmZKwKvszocwqbsdn4h
  • [x ] Test under the nacl package to test encryption with sofia and charlotte keys
  • [x] PrivateKeyFromBytes(privKey []byte) takes seed or full private key bytes
  • [x] PublicKeyFromBytes
  • [ ]

Describe alternatives you've considered Using CGO to and calling https://github.com/Warchant/sr25519-crust C bindings exist against https://github.com/w3f/schnorrkel

Additional context

  • Useful information about the keys
const (
  chainCodeSize  = 32
  keyPairSize    = 96
  publicKeySize     = 32
  privateKeySize     = 64
  seedSize       = 32
  signatureSize  = 64
  vrfOutputSize = 32
  vrfProofSize  = 64
)
gitcoinbot commented 4 years ago

@developerfred Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

@developerfred Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 300.0 SAI (300.0 USD @ $1.0/SAI) has been submitted by:

  1. @developerfred

@Web3Foundation please take a look at the submitted work:


Web3Foundation commented 4 years ago

@robdefeo what's the latest on the PR with this issue? Feel free to ping me on @chris:web3.foundation on riot if we need to discuss further than here.

robdefeo commented 4 years ago

@Web3Foundation I have been working with @developerfred and we are really close to resolving this PR. It had some complications but I believe they have now been overcome. Thanks

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 300.0 SAI (300.0 USD @ $1.0/SAI) attached to this issue has been approved & issued to @developerfred.