Comments (5)
Ok, sorry, I have just seen your new Readme and there I have found what I'm looking for! Thanks a lot!
from secp256k1.swift.
As I read Public Key(65 bits) should be longer then private (32 bits)
from secp256k1.swift.
Hey @Dimius555 👋
It seems you're looking for the .uncompressed
public key format. Using the different format looks something like this:
secp256k1.Signing.PrivateKey(rawRepresentation: privateBytes, format: .uncompressed)
Here is a test I created with broader usage of the uncompressed public key format based on the data you provided.
let privateBytes = try! "703d3b63e84421e59f9359f8b27c25365df9d85b6b1566e3168412fa599c12f4".bytes
let privateKey = try! secp256k1.Signing.PrivateKey(rawRepresentation: privateBytes, format: .uncompressed)
XCTAssertEqual(privateKey.publicKey.format, .uncompressed)
XCTAssertEqual(privateKey.publicKey.rawRepresentation.count, secp256k1.Format.uncompressed.length)
let expectedPublicKeyString = """
04c9c68596824505dd6cd1993a16452b4b1a13bacde56f80e9049fd03850cce137c1fa4acb7bef7edcc04f4fa29e071ea17e34fa07fa5d87b5ebf6340df6558498
"""
// Define the expected public key
let expectedPublicKey = try! expectedPublicKeyString.bytes
// Verify the generated public key matches the expected public key
XCTAssertEqual(expectedPublicKey, privateKey.publicKey.rawRepresentation.bytes)
XCTAssertEqual(expectedPublicKeyString, String(bytes: privateKey.publicKey.rawRepresentation.bytes))
from secp256k1.swift.
Thank you @csjones!
But here is another issue, I see you are using secp256k1.Signing.PrivateKey
, I'm trying to use secp256k1.KeyAgreement.PrivateKey
and how can I create SharedSecret in this case?
from secp256k1.swift.
from secp256k1.swift.
Related Issues (20)
- nvm I need the podspec for this, i'm so sorry... HOT 2
- Contructing a PublicKey with rawRepresentation fails with incorrect size HOT 3
- value of type `secp256k1_surjectionproof` has no member `data` HOT 13
- Differenct signature result with other libraries HOT 2
- Do you have any examples of how you would sign a taproot input using this library? HOT 1
- Did library already support sign a taproot input? HOT 4
- Taproot address format HOT 9
- Cannot install package via SPM when importing it from another package HOT 3
- Is it possible to generate an invalid PrivateKey when no secret it passed? HOT 9
- How to use secp256k1_ec_pubkey_combine HOT 10
- How to create PrivateKey by importing pem private key? HOT 7
- Test/Example for `sharedSecretFromKeyAgreement` with `handler`? HOT 8
- xcodebuild fails for 0.13.0 HOT 1
- secp256k1/ECDH.swift:180:20 Value of type 'UnsafeMutablePointer<UInt8>' has no member 'update' HOT 1
- #include "./secp256k1.h" Report an error './secp256k1.h' file not found HOT 6
- Is there really a random k injected when calculating an ECDSA signature ? HOT 2
- Recovery of pubic key when manually building signature HOT 11
- Please use semver for release tags HOT 1
- Add support for VisionOS HOT 4
- BitcoinSign Transaction HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from secp256k1.swift.