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

[lib] Export cipher and cli functions to be reused via libskycoin #968

Closed
olemis opened this issue Feb 9, 2018 · 3 comments · Fixed by #1639
Closed

[lib] Export cipher and cli functions to be reused via libskycoin #968

olemis opened this issue Feb 9, 2018 · 3 comments · Fixed by #1639
Assignees
Labels
libc stdev wip Work in progress

Comments

@olemis
Copy link
Contributor

olemis commented Feb 9, 2018

Cipher and CLI functionality will be needed elsewhere . It should be available for reuse in libskycoin .

Cc @gz-c feel free to highlight functions to be exported this way

@olemis olemis changed the title Export cipher and cli functions to be reused via libskycoin [lib] Export cipher and cli functions to be reused via libskycoin Feb 9, 2018
@olemis olemis self-assigned this Feb 9, 2018
@olemis olemis added wip Work in progress stdev labels Feb 9, 2018
@gz-c
Copy link
Member

gz-c commented Feb 10, 2018

It depends on how much you want to export versus how much you want to implement in the code using libskycoin.

At minimum you will want to export the cipher methods. You could potentially reimplement the CLI methods as needed.

Looking at the teller code, which uses the cli library natively to sign transactions:

cli.CreateRawTxFromWallet would be the main cli method to export.

For cipher:

cipher.GenerateKeyPair
cipher.DecodeBase58Address
cipher.GenerateDeterministicKeyPairs

But likely most of the public methods in cipher/address.go, cipher/hash.go, cipher/crypto.go should be exported.

olemis added a commit to simelo/skycoin that referenced this issue Feb 15, 2018
lib/cgo/cipher.address.go:41:// export SKY_Cipher_AddressFromPubKey
lib/cgo/cipher.address.go:49:// export SKY_Cipher_AddressFromSecKey
lib/cgo/cipher.address.go:57:// export SKY_Cipher_BitcoinDecodeBase58Address
olemis added a commit to simelo/skycoin that referenced this issue Feb 16, 2018
…Address => SKY_Cipher_DecodeBase58Address
olemis added a commit to simelo/skycoin that referenced this issue Feb 19, 2018
olemis added a commit to simelo/skycoin that referenced this issue Feb 19, 2018
olemis added a commit to simelo/skycoin that referenced this issue Feb 19, 2018
+func SKY_Cipher_Address_BitcoinBytes(_addr *C.Address, _ret *C.uchar) {
+func SKY_Cipher_Address_Verify(_addr *C.Address, _key *C.PubKey) C.uint {
+func SKY_Cipher_Address_String(_addr *C.Address) string {
+func SKY_Cipher_Address_BitcoinString(_addr *C.Address) string {
+func SKY_Cipher_Address_Checksum(_addr *C.Address, _ret *C.Checksum) {
+func SKY_Cipher_Address_BitcoinChecksum(_addr *C.Address, _ret *C.Checksum) {
olemis added a commit to simelo/skycoin that referenced this issue Feb 19, 2018
+func SKY_Cipher_DecodeBase58Address(_strAddr string, _retAddr *C.Address) C.uint {
+func SKY_Cipher_AddressFromPubKey(_pubKey *C.PubKey, _retAddr *C.Address) {
+func SKY_Cipher_AddressFromSecKey(_secKey *C.SecKey, _retAddr *C.Address) {
+func SKY_Cipher_BitcoinDecodeBase58Address(_strAddr string, _retAddr *C.Address) C.uint {
+func SKY_Cipher_BitcoinAddressFromPubkey(_pubkey *C.PubKey) string {
+func SKY_Cipher_BitcoinWalletImportFormatFromSeckey(_seckey *C.SecKey) string {
+func SKY_Cipher_BitcoinAddressFromBytes(_b *C.uchar, _sz C.size_t, _retAddr *C.Address) C.uint {
+func SKY_Cipher_SecKeyFromWalletImportFormat(_input string, _seckey *C.SecKey) C.uint {
@samuelvisscher
Copy link
Contributor

This would also be great for the Java, Objective-C and Javascript libraries produced through GopherJS and GoMobile.

olemis added a commit to simelo/skycoin that referenced this issue Feb 21, 2018
@olemis
Copy link
Contributor Author

olemis commented Feb 22, 2018

@samuelvisscher do you need client libs for those languages ? We could build some as well (and test'em).

olemis added a commit to simelo/skycoin that referenced this issue Feb 23, 2018
+extern unsigned int SKY_CLI_CreateRawTxFromWallet(Handle p0, GoString p1, GoString p2, _GoSlice* p3, Transaction* p4);
+extern unsigned int SKY_CLI_CreateRawTxFromAddress(Handle p0, GoString p1, GoString p2, GoString p3, _GoSlice p4, Transaction* p5);
+extern void SKY_CLI_CreateRawTx(Handle p0, Wallet* p1, _GoSlice p2, GoString p3, _GoSlice p4, Transaction* p5);
+extern void SKY_CLI_NewTransaction(_GoSlice* p0, GoSlice p1, GoSlice p2, Transaction* p3);
olemis added a commit to simelo/skycoin that referenced this issue Feb 23, 2018
olemis added a commit to simelo/skycoin that referenced this issue Feb 24, 2018
…ty' in LDFLAGS for test_libskycoin_static
olemis added a commit to simelo/skycoin that referenced this issue Mar 11, 2018
olemis added a commit to simelo/skycoin that referenced this issue Mar 11, 2018
…segfault in test_address_wrong

[====] Synthesis: Tested: 3 | Passing: 2 | Failing: 1 | Crashing: 0
olemis added a commit to simelo/skycoin that referenced this issue Mar 12, 2018
…types.h

Fixes error in GNU/Linux : Go type not supported in export: [4]_Ctype_uchar
olemis pushed a commit to simelo/skycoin that referenced this issue Mar 13, 2018
…n cipher address API

[====] Synthesis: Tested: 3 | Passing: 2 | Failing: 1 | Crashing: 0
olemis pushed a commit to simelo/skycoin that referenced this issue Mar 13, 2018
olemis pushed a commit to simelo/skycoin that referenced this issue Mar 13, 2018
olemis added a commit to simelo/skycoin that referenced this issue Mar 13, 2018
TODO: lots of compilation warnings array type 'SHA256' (aka 'unsigned char [32]') is not assignable
olemis added a commit to simelo/skycoin that referenced this issue Mar 13, 2018
…tests

[====] Synthesis: Tested: 3 | Passing: 2 | Failing: 1 | Crashing: 0
olemis added a commit to simelo/skycoin that referenced this issue Mar 17, 2018
olemis pushed a commit to simelo/skycoin that referenced this issue Mar 17, 2018
…returned as uint32

TODO: Standardize use of libErrorCode function
TODO: Define useful error codes
olemis pushed a commit to simelo/skycoin that referenced this issue Mar 17, 2018
olemis added a commit to simelo/skycoin that referenced this issue Mar 17, 2018
…tdevHan_t922_libskycoin_test' into olemis_t968_libskycoin_cipher_cli
olemis added a commit to simelo/skycoin that referenced this issue Mar 17, 2018
…crypto.go

Inplace memory C-to-go type casts.

TODO: Error codes

[====] Synthesis: Tested: 2 | Passing: 2 | Failing: 0 | Crashing: 0
@olemis olemis added the libc label Jun 11, 2018
@gz-c gz-c closed this as completed in #1639 Nov 6, 2018
gz-c added a commit that referenced this issue Nov 6, 2018
…her_and_coin

[lib] Fixes #968 fixes #1191 fixes #1628 fixes #1661 - Added libc and tests for cipher and coin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc stdev wip Work in progress
Projects
None yet
3 participants