123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)letscheme="unencrypted"lettitle="Built-in signer using raw unencrypted keys."letdescription="Please DO NOT USE this signer outside of test environments.\n\
Valid secret key URIs are of the form\n\
\ - unencrypted:<key>\n\
where <key> is the secret key in Tezos_crypto.Base58.\n\
Valid public key URIs are of the form\n\
\ - unencrypted:<public_key>\n\
where <public_key> is the public key in Tezos_crypto.Base58."letmake_sapling_keysk=letpath=Tezos_crypto.Base58.simple_encodeTezos_sapling.Core.Wallet.Spending_key.b58check_encodingskinClient_keys.make_sapling_uri(Uri.make~scheme~path())moduleMake_common(S:sigincludeTezos_crypto.Intfs.COMMON_SIGNATUREtypepublic_key_hash=Public_key_hash.ttypepublic_key=Public_key.ttypesecret_key=Secret_key.ttypesignature=ttypesk_uri=privateUri.ttypepk_uri=privateUri.tvalmake_sk_uri:Uri.t->sk_uritzresultvalmake_pk_uri:Uri.t->pk_uritzresultvalscheme:stringend)=structincludeSletscheme=S.schemelettitle=titleletdescription=descriptionletsecret_keysk_uri=Secret_key.of_b58check(Uri.path(sk_uri:sk_uri:>Uri.t))|>Lwt.returnletmake_sksk:sk_uritzresult=make_sk_uri(Uri.make~scheme~path:(S.Secret_key.to_b58checksk)())letpublic_keypk_uri=Public_key.of_b58check(Uri.path(pk_uri:pk_uri:>Uri.t))|>Lwt.returnletmake_pkpk:pk_uritzresult=make_pk_uri(Uri.make~scheme~path:(Public_key.to_b58checkpk)())letneuterizesk_uri=letopenLwt_result_syntaxinlet*sk=secret_keysk_uriinlet*?v=make_pk(Secret_key.to_public_keysk)inreturnvletpublic_key_hashpk_uri=letopenLwt_result_syntaxinlet*pk=public_keypk_uriinreturn(Public_key.hashpk,Somepk)letimport_secret_key~io:_=public_key_hashendincludeMake_common(structincludeTezos_crypto.SignatureincludeClient_keys.Signature_typeletmake_sk_uri=Client_keys.make_sk_uriletmake_pk_uri=Client_keys.make_pk_uriletscheme=schemeend)letsign?watermarksk_uribuf=letopenLwt_result_syntaxinlet*sk=secret_keysk_uriinreturn(Tezos_crypto.Signature.sign?watermarkskbuf)letdeterministic_noncesk_uribuf=letopenLwt_result_syntaxinlet*sk=secret_keysk_uriinreturn(Tezos_crypto.Signature.deterministic_nonceskbuf)letdeterministic_nonce_hashsk_uribuf=letopenLwt_result_syntaxinlet*sk=secret_keysk_uriinreturn(Tezos_crypto.Signature.deterministic_nonce_hashskbuf)letsupports_deterministic_nonces_=Lwt_result_syntax.return_truemoduleAggregate=structincludeMake_common(structincludeTezos_crypto.Aggregate_signatureincludeClient_keys.Aggregate_typeletmake_sk_uri=Client_keys.make_aggregate_sk_uriletmake_pk_uri=Client_keys.make_aggregate_pk_uriletscheme="aggregate_"^schemeend)letsignsk_uribuf=letopenLwt_result_syntaxinlet+sk=secret_keysk_uriinTezos_crypto.Aggregate_signature.signskbufend