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

Extend package API with features usefule for existing apps #479

Merged
merged 4 commits into from
Aug 4, 2023

Commits on Aug 4, 2023

  1. crypto: Extend Signature type

    Provide getters of signature scheme, public key and value. Make
    `WriteToV2` method to decode public key from binary to assert scheme
    format.
    
    New API will allow to avoid `WriteToV2` calls in user space. New unit
    test checks and shows client-to-server transport over NeoFS API V2
    protocol.
    
    Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
    cthulhu-rider committed Aug 4, 2023
    Configuration menu
    Copy the full SHA
    2224127 View commit details
    Browse the repository at this point in the history
  2. crypto: Add helper to encode PublicKey

    Encoding methods of `PublicKey` interface require buffer pre-allocation.
    In cases where the user does not have a buffer prepared in advance, he
    has to explicitly create it and encode the key. Helper function
    `PublicKeyBytes` is added to make code easier.
    
    Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
    cthulhu-rider committed Aug 4, 2023
    Configuration menu
    Copy the full SHA
    d65d8d7 View commit details
    Browse the repository at this point in the history
  3. user: Refactor constructors of Signer instances

    Previously, package provided constructors for `Signer` instances with
    RFC 6979 signature scheme only. User may need to construct any `Signer`
    instance (other scheme or even custom implementation).
    
    Add generic constructor `NewSigner` accepting split `neofscrypto.Signer`
    and `user.ID`. Add two constructors from standard `ecdsa.PrivateKey`
    with an explanation that the user ID is resolved automatically.
    
    Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
    cthulhu-rider committed Aug 4, 2023
    Configuration menu
    Copy the full SHA
    da9b0b3 View commit details
    Browse the repository at this point in the history
  4. session: Add getter of binary-encoded public key from signature

    Signature is used for user authentication so access to public key is
    required. Digital signature bytes may still be unexported because they
    are only useful for `VerifySignature` method.
    
    Add `IssuerPublicKeyBytes` method returning binary-encoded public key of
    the session issuer.
    
    Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
    cthulhu-rider committed Aug 4, 2023
    Configuration menu
    Copy the full SHA
    577b2d6 View commit details
    Browse the repository at this point in the history