Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| feae15740a |
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,7 +8,9 @@ cancer
|
|||||||
erl_crash.dump
|
erl_crash.dump
|
||||||
ebin/*.beam
|
ebin/*.beam
|
||||||
doc/*.html
|
doc/*.html
|
||||||
|
doc/*.css
|
||||||
doc/edoc-info
|
doc/edoc-info
|
||||||
|
doc/erlang.png
|
||||||
rel/example_project
|
rel/example_project
|
||||||
.concrete/DEV_MODE
|
.concrete/DEV_MODE
|
||||||
.rebar
|
.rebar
|
||||||
|
|||||||
BIN
doc/erlang.png
BIN
doc/erlang.png
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB |
@ -1,75 +0,0 @@
|
|||||||
/* standard EDoc style sheet */
|
|
||||||
body {
|
|
||||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
|
||||||
margin-left: .25in;
|
|
||||||
margin-right: .2in;
|
|
||||||
margin-top: 0.2in;
|
|
||||||
margin-bottom: 0.2in;
|
|
||||||
color: #696969;
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
a:link{
|
|
||||||
color: #000000;
|
|
||||||
}
|
|
||||||
a:visited{
|
|
||||||
color: #000000;
|
|
||||||
}
|
|
||||||
a:hover{
|
|
||||||
color: #d8613c;
|
|
||||||
}
|
|
||||||
h1,h2 {
|
|
||||||
margin-left: -0.2in;
|
|
||||||
}
|
|
||||||
div.navbar {
|
|
||||||
background-color: #000000;
|
|
||||||
padding: 0.2em;
|
|
||||||
}
|
|
||||||
h2.indextitle {
|
|
||||||
padding: 0.4em;
|
|
||||||
color: #dfdfdf;
|
|
||||||
background-color: #000000;
|
|
||||||
}
|
|
||||||
div.navbar a:link {
|
|
||||||
color: #dfdfdf;
|
|
||||||
}
|
|
||||||
div.navbar a:visited {
|
|
||||||
color: #dfdfdf;
|
|
||||||
}
|
|
||||||
div.navbar a:hover {
|
|
||||||
color: #d8613c;
|
|
||||||
}
|
|
||||||
h3.function,h3.typedecl {
|
|
||||||
background-color: #000000;
|
|
||||||
color: #dfdfdf;
|
|
||||||
padding-left: 1em;
|
|
||||||
}
|
|
||||||
div.spec {
|
|
||||||
margin-left: 2em;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
}
|
|
||||||
a.module {
|
|
||||||
text-decoration:none
|
|
||||||
}
|
|
||||||
a.module:hover {
|
|
||||||
background-color: #eeeeee;
|
|
||||||
}
|
|
||||||
ul.definitions {
|
|
||||||
list-style-type: none;
|
|
||||||
}
|
|
||||||
ul.index {
|
|
||||||
list-style-type: none;
|
|
||||||
background-color: #eeeeee;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Minor style tweaks
|
|
||||||
*/
|
|
||||||
ul {
|
|
||||||
list-style-type: square;
|
|
||||||
}
|
|
||||||
table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
td {
|
|
||||||
padding: 3
|
|
||||||
}
|
|
||||||
13
src/hz.erl
13
src/hz.erl
@ -2461,6 +2461,19 @@ spend3(DSenderID,
|
|||||||
hz:post_tx(Encoded).
|
hz:post_tx(Encoded).
|
||||||
|
|
||||||
|
|
||||||
|
-spec sign(Scheme, Target, SecKey) -> Sig
|
||||||
|
when Scheme :: message | binary | bitcoin,
|
||||||
|
Target :: binary(),
|
||||||
|
SecKey :: binary(),
|
||||||
|
Sig :: binary().
|
||||||
|
|
||||||
|
sign(message, Target, SecKey) -> sign_message(Message, SecKey);
|
||||||
|
sign(binary, Target, SecKey) -> sign_binary(Target, SecKey);
|
||||||
|
sign(bitcoin, Target, SecKey) -> sign_bitcoin(Target, SecKey).
|
||||||
|
|
||||||
|
sign(bitcoin, Target, SecKey) -> sign_message(Target, SecKey).
|
||||||
|
|
||||||
|
|
||||||
-spec sign_message(Message, SecKey) -> Sig
|
-spec sign_message(Message, SecKey) -> Sig
|
||||||
when Message :: binary(),
|
when Message :: binary(),
|
||||||
SecKey :: binary(),
|
SecKey :: binary(),
|
||||||
|
|||||||
@ -190,16 +190,48 @@ l_to_i(S) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
-spec req(Type, Message) -> RequestMap
|
||||||
|
when Type :: {sign, message | binary | bitcoin}
|
||||||
|
| tx
|
||||||
|
| ack
|
||||||
|
| sign,
|
||||||
|
Message :: binary(),
|
||||||
|
RequestMap :: map().
|
||||||
|
%% @doc
|
||||||
|
%% GRIDS maps always contain the following keys:
|
||||||
|
%% ```
|
||||||
|
%% #{"grids" => 1,
|
||||||
|
%% "chain" => "gajumaru",
|
||||||
|
%% "network_id" => "groot.mainnet.gajumaru.io",
|
||||||
|
%% "type" => "message" | "binary" | "binary" | "tx" | "ack"
|
||||||
|
%% "public_id" => term(),
|
||||||
|
%% "payload" => string()};
|
||||||
|
%% '''
|
||||||
|
|
||||||
req(Type, Message) ->
|
req(Type, Message) ->
|
||||||
req(Type, Message, false).
|
req(Type, Message, false).
|
||||||
|
|
||||||
req(sign, Message, ID) ->
|
req({sign, message}, Message, ID) ->
|
||||||
#{"grids" => 1,
|
#{"grids" => 1,
|
||||||
"chain" => "gajumaru",
|
"chain" => "gajumaru",
|
||||||
"network_id" => hz:network_id(),
|
"network_id" => hz:network_id(),
|
||||||
"type" => "message",
|
"type" => "message",
|
||||||
"public_id" => ID,
|
"public_id" => ID,
|
||||||
"payload" => Message};
|
"payload" => Message};
|
||||||
|
req({sign, binary}, Binary, ID) ->
|
||||||
|
#{"grids" => 1,
|
||||||
|
"chain" => "gajumaru",
|
||||||
|
"network_id" => hz:network_id(),
|
||||||
|
"type" => "binary",
|
||||||
|
"public_id" => ID,
|
||||||
|
"payload" => base64:encode(Binary)};
|
||||||
|
req({sign, bitcoin}, Binary, ID) ->
|
||||||
|
#{"grids" => 1,
|
||||||
|
"chain" => "gajumaru",
|
||||||
|
"network_id" => hz:network_id(),
|
||||||
|
"type" => "bitcoin",
|
||||||
|
"public_id" => ID,
|
||||||
|
"payload" => base64:encode(Binary)};
|
||||||
req(tx, Data, ID) ->
|
req(tx, Data, ID) ->
|
||||||
#{"grids" => 1,
|
#{"grids" => 1,
|
||||||
"chain" => "gajumaru",
|
"chain" => "gajumaru",
|
||||||
@ -213,4 +245,6 @@ req(ack, Message, ID) ->
|
|||||||
"network_id" => hz:network_id(),
|
"network_id" => hz:network_id(),
|
||||||
"type" => "ack",
|
"type" => "ack",
|
||||||
"public_id" => ID,
|
"public_id" => ID,
|
||||||
"payload" => Message}.
|
"payload" => Message};
|
||||||
|
req(sign, Message, ID) ->
|
||||||
|
req({sign, message}, Message, ID).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user