Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
parity-signer
Commits
18dd4fc4
Commit
18dd4fc4
authored
Feb 20, 2017
by
Marek Kotewicz
Browse files
ethkey works in release mode on device
parent
f870ff57
Changes
8
Show whitespace changes
Inline
Side-by-side
ios/EthkeyBridge.swift
View file @
18dd4fc4
...
...
@@ -14,11 +14,13 @@ class EthkeyBridge: NSObject {
NSLog
(
"%@"
,
name
);
}
@objc
func
brainWallet
(
_
seed
:
String
,
callback
:
RCTResponseSenderBlock
)
->
Void
{
@objc
func
brainWallet
Address
(
_
seed
:
String
,
callback
:
RCTResponseSenderBlock
)
->
Void
{
var
seed_ptr
=
seed
.
asPtr
()
let
keypair
=
ethkey_keypair_brainwallet
(
&
seed_ptr
)
let
address_ptr
=
ethkey_keypair_address
(
keypair
)
let
keypair
_ptr
=
ethkey_keypair_brainwallet
(
&
seed_ptr
)
let
address_ptr
=
ethkey_keypair_address
(
keypair
_ptr
)
let
address
=
String
.
fromStringPtr
(
ptr
:
address_ptr
!.
pointee
)
ethkey_keypair_destroy
(
keypair_ptr
)
ethkey_string_destroy
(
address_ptr
)
callback
([
address
])
}
}
ios/NativeSigner.xcodeproj/project.pbxproj
View file @
18dd4fc4
...
...
@@ -965,6 +965,7 @@
DEAD_CODE_STRIPPING
=
NO
;
DEFINES_MODULE
=
YES
;
DEVELOPMENT_TEAM
=
T4ZYEBHX9P
;
ENABLE_BITCODE
=
NO
;
INFOPLIST_FILE
=
NativeSigner/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
LIBRARY_SEARCH_PATHS
=
../rust/signer
;
...
...
@@ -989,6 +990,7 @@
CURRENT_PROJECT_VERSION
=
1
;
DEFINES_MODULE
=
YES
;
DEVELOPMENT_TEAM
=
T4ZYEBHX9P
;
ENABLE_BITCODE
=
NO
;
INFOPLIST_FILE
=
NativeSigner/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
LIBRARY_SEARCH_PATHS
=
../rust/signer
;
...
...
ios/NativeSigner/AppDelegate.m
View file @
18dd4fc4
...
...
@@ -16,10 +16,6 @@
-
(
BOOL
)
application
:(
UIApplication
*
)
application
didFinishLaunchingWithOptions
:(
NSDictionary
*
)
launchOptions
{
EthkeyBridge
*
bridge
;
[
bridge
brainWallet
:@[]
callback
:
^
(
NSArray
*
cb
)
{
}];
NSURL
*
jsCodeLocation
;
jsCodeLocation
=
[[
RCTBundleURLProvider
sharedSettings
]
jsBundleURLForBundleRoot
:
@"index.ios"
fallbackResource
:
nil
];
...
...
ios/NativeSigner/EthkeyBridge.m
View file @
18dd4fc4
...
...
@@ -11,6 +11,6 @@
@interface
RCT_EXTERN_MODULE
(
EthkeyBridge
,
NSObject
)
RCT_EXTERN_METHOD
(
show
:
(
NSString
*
)
name
)
RCT_EXTERN_METHOD
(
brainWallet
:
(
NSString
*
)
seed
callback
:
(
RCTResponseSenderBlock
)
callback
)
RCT_EXTERN_METHOD
(
brainWallet
Address
:
(
NSString
*
)
seed
callback
:
(
RCTResponseSenderBlock
)
callback
)
@end
rust/signer/Cargo.toml
View file @
18dd4fc4
...
...
@@ -10,3 +10,7 @@ ethkey = { git = "https://github.com/ethcore/parity" }
[lib]
name
=
"signer"
crate-type
=
["staticlib"]
# https://github.com/DaGenix/rust-crypto/issues/383
[replace]
"rust-crypto:0.2.36"
=
{
git
=
"https://github.com/debris/rust-crypto"
}
rust/signer/Makefile
View file @
18dd4fc4
...
...
@@ -5,7 +5,7 @@ all: $(LIB)
.PHONY
:
$(ARCHS)
$(ARCHS)
:
%:
cargo build
--target
$@
cargo build
--target
$@
--release
$(LIB)
:
$(ARCHS)
lipo
-create
-output
$@
$(
foreach
arch
,
$(ARCHS)
,
$(
wildcard
target/
$(arch)
/
debug
/
$(LIB)
))
lipo
-create
-output
$@
$(
foreach
arch
,
$(ARCHS)
,
$(
wildcard
target/
$(arch)
/
release
/
$(LIB)
))
src/containers/NewAccount.js
View file @
18dd4fc4
...
...
@@ -5,15 +5,15 @@ import { Actions } from 'react-native-router-flux'
import
debounce
from
'
debounce
'
import
NewAccountInput
from
'
../components/NewAccountInput
'
import
{
words
}
from
'
../util/random
'
import
{
keypairFromPhrase
,
toAddress
,
to
Address
Async
}
from
'
../util/crypto
'
import
{
brainWallet
Address
}
from
'
../util/crypto
'
import
{
selectAccount
}
from
'
../actions/accounts
'
const
mapDispatchToProps
=
(
dispatch
)
=>
{
return
{
addAccount
:
(
account
)
=>
{
const
address
=
toAddress
(
account
.
keypair
)
dispatch
(
selectAccount
({
address
:
address
,
seed
:
account
.
seed
,
address
:
account
.
address
,
name
:
account
.
name
,
}))
Actions
.
setPin
()
...
...
@@ -29,10 +29,15 @@ export class NewAccount extends Component {
this
.
state
=
{
seed
:
seed
,
keypair
:
keypairFromPhrase
(
seed
),
address
:
''
,
name
:
''
,
}
brainWalletAddress
(
seed
,
(
address
)
=>
{
this
.
setState
({
address
:
address
,
})
})
}
render
()
{
...
...
@@ -55,20 +60,20 @@ export class NewAccount extends Component {
<
Text
style
=
{
styles
.
hint
}
>
brain
wallet
seed
<
/Text
>
<
NewAccountInput
seed
=
{
this
.
state
.
seed
}
onChangeText
=
{
debounce
((
text
)
=>
{
//var keypair = keypairFromPhrase(text)
toAddressAsync
(
text
,
(
address
)
=>
{
brainWalletAddress
(
text
,
(
address
)
=>
{
self
.
setState
({
//keypair:
seed
:
text
,
address
:
address
,
})
})
},
100
)}
/
>
<
Text
style
=
{
styles
.
hint
}
adjustsFontSizeToFit
=
{
true
}
>
0
x
{
this
.
state
.
address
}
<
/Text
>
<
Text
style
=
{
styles
.
address
}
>
0
x
{
this
.
state
.
address
}
<
/Text
>
<
Button
onPress
=
{()
=>
this
.
props
.
addAccount
({
keypair
:
this
.
state
.
keypair
,
name
:
this
.
state
.
name
seed
:
this
.
state
.
seed
,
address
:
this
.
state
.
address
,
name
:
this
.
state
.
name
,
})}
title
=
"
Add Account
"
color
=
"
green
"
...
...
@@ -89,6 +94,9 @@ const styles = StyleSheet.create({
hint
:
{
marginBottom
:
20
,
},
address
:
{
marginBottom
:
20
,
},
input
:
{
height
:
20
,
marginBottom
:
20
,
...
...
src/util/crypto.js
View file @
18dd4fc4
...
...
@@ -13,8 +13,6 @@ export function keypairFromPhrase(phrase) {
export
function
toAddress
(
kp
)
{
return
keccak_256
(
kp
.
getPublic
(
'
buffer
'
).
slice
(
1
)).
substr
(
24
);
}
export
function
toAddressAsync
(
kp
,
callback
)
{
//EthkeyBridge.show("hello")
EthkeyBridge
.
brainWallet
(
""
+
1
,
callback
)
//return
export
function
brainWalletAddress
(
seed
,
callback
)
{
EthkeyBridge
.
brainWalletAddress
(
seed
,
callback
)
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment