2022-06-25 22:43:28 +02:00
#shellcheck shell=sh
set -eu
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
CRED_FILE = " ${ SHELLSPEC_TMPBASE } /credentials "
DUBP_FILE = " ${ SHELLSPEC_TMPBASE } /mnemonic "
2022-09-23 11:33:13 +02:00
EWIF_FILE = " ${ SHELLSPEC_TMPBASE } /username.ewif "
2022-09-27 16:33:07 +02:00
JWK_FILE = " ${ SHELLSPEC_TMPBASE } /username.jwk "
2022-09-23 11:33:13 +02:00
NACL_FILE = " ${ SHELLSPEC_TMPBASE } /username.nacl "
PB2_FILE = " ${ SHELLSPEC_TMPBASE } /username.pb2 "
PEM_FILE = " ${ SHELLSPEC_TMPBASE } /username.pem "
PUBSEC_FILE = " ${ SHELLSPEC_TMPBASE } /username.pubsec "
SEED_FILE = " ${ SHELLSPEC_TMPBASE } /username.seed "
SSB_FILE = " ${ SHELLSPEC_TMPBASE } /username.ssb "
WIF_FILE = " ${ SHELLSPEC_TMPBASE } /username.wif "
2022-09-12 12:22:48 +02:00
gpg( ) {
2022-09-18 13:55:41 +02:00
GNUPGHOME = " ${ SHELLSPEC_TMPBASE } " command gpg " $@ "
2022-09-12 12:22:48 +02:00
}
2022-06-25 22:43:28 +02:00
keygen( ) {
if [ -x ./keygen ] ; then
2022-09-18 13:55:41 +02:00
GNUPGHOME = " ${ SHELLSPEC_TMPBASE } " ./keygen " $@ "
2022-06-25 22:43:28 +02:00
elif [ -x ./bin/keygen ] ; then
2022-09-18 13:55:41 +02:00
GNUPGHOME = " ${ SHELLSPEC_TMPBASE } " ./bin/keygen " $@ "
2022-06-25 22:43:28 +02:00
else
2022-09-18 13:55:41 +02:00
GNUPGHOME = " ${ SHELLSPEC_TMPBASE } " command keygen " $@ "
2022-06-25 22:43:28 +02:00
fi
}
Describe 'Dependency'
2022-08-31 18:01:15 +02:00
Describe 'pinentry:'
It 'is available'
When run pinentry --help
2022-09-12 12:22:48 +02:00
The output should include 'pinentry'
2022-08-31 18:01:15 +02:00
The status should be success
The stderr should be present
End
End
2022-06-25 22:43:28 +02:00
Describe 'python3:'
It 'is available'
When run python3 --help
2022-09-12 12:22:48 +02:00
The output should include 'python3'
2022-06-25 22:43:28 +02:00
The status should be success
The stderr should equal ""
End
End
End
Describe 'keygen'
Describe '--help:'
It 'prints help'
When run keygen --help
The output should include 'usage:'
The status should be success
The stderr should equal ""
End
End
Describe '--version:'
It 'prints version'
When run keygen --version
2022-09-27 16:33:07 +02:00
The output should include 'v0.0.5'
2022-06-25 22:43:28 +02:00
The status should be success
The stderr should equal ""
End
End
2022-09-12 14:19:05 +02:00
Describe 'username password:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints base58 public key for user "username" and password "password"'
2022-09-12 14:19:05 +02:00
When run keygen username password
The output should include '4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The status should be success
The stderr should equal ""
End
End
Describe '-p username password:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed base58 public key for user "username" and password "password"'
2022-09-12 14:19:05 +02:00
When run keygen -p username password
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The status should be success
The stderr should equal ""
End
End
Describe '-s username password:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints base58 secret key for user "username" and password "password"'
2022-09-12 14:19:05 +02:00
When run keygen -s username password
The output should include 'K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should equal ""
End
End
Describe '-ps username password:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed base58 secret key for user "username" and password "password"'
2022-09-12 14:19:05 +02:00
When run keygen -ps username password
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should equal ""
End
End
Describe '-k username password:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints base58 public and secret keys for user "username" and password "password"'
2022-09-12 14:19:05 +02:00
When run keygen -k username password
The output should include '4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should equal ""
End
End
Describe '-pk username password:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed base58 public and secret keys for user "username" and password "password"'
2022-09-12 14:19:05 +02:00
When run keygen -pk username password
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should equal ""
End
End
2022-09-23 11:33:13 +02:00
Describe '-pkt b58mh username password:'
It 'prints prefixed base58 multihash public and secret keys for user "username" and password "password"'
When run keygen -pkt b58mh username password
The output should include 'pub: 12D3KooWDMhdm5yrvtrbkshXFjkqLedHieUnPioczy9wzdnzquHC'
The output should include 'sec: 23jhTarm17VAHUwPkHD2Kv5sPfuQrsXSZUzKUrRkP2oP8bgnLjVExhG4AVoayCLxbXN4g2pjVG5qiJRucUtogbj7zGapz'
The status should be success
The stderr should equal ""
End
End
Describe '-pkt b64mh username password:'
It 'prints prefixed base64 multihash public and secret keys for user "username" and password "password"'
When run keygen -pkt b64mh username password
The output should include 'pub: ACQIARIgNJoTbvcP+m51+XwxrmWqHaOpI1ZD0USwLjqAmV8Boas='
The output should include 'sec: CAESQA+XqCWjRqCjNe9oU3QA796bEH+T+rxgyPQ/EkXvE2MvNJoTbvcP+m51+XwxrmWqHaOpI1ZD0USwLjqAmV8Boas='
The status should be success
The stderr should equal ""
End
End
Describe '-pkt base58 username password:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed base58 public and secret keys for user "username" and password "password"'
2022-09-23 11:33:13 +02:00
When run keygen -pkt base58 username password
2022-06-25 22:43:28 +02:00
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should equal ""
End
End
2022-09-23 11:33:13 +02:00
Describe '-pkt base64 username password:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed base64 public and secret keys for user "username" and password "password"'
2022-09-23 11:33:13 +02:00
When run keygen -pkt base64 username password
2022-09-18 13:55:41 +02:00
The output should include 'pub: NJoTbvcP+m51+XwxrmWqHaOpI1ZD0USwLjqAmV8Boas='
The output should include 'sec: D5eoJaNGoKM172hTdADv3psQf5P6vGDI9D8SRe8TYy80mhNu9w/6bnX5fDGuZaodo6kjVkPRRLAuOoCZXwGhqw=='
The status should be success
The stderr should equal ""
End
End
2022-09-23 11:33:13 +02:00
Describe '-pkt duniter username password:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed duniter public and secret keys for user "username" and password "password"'
2022-09-23 11:33:13 +02:00
When run keygen -pkt duniter username password
2022-09-18 13:55:41 +02:00
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
2022-06-25 22:43:28 +02:00
The status should be success
The stderr should equal ""
End
End
2022-09-23 11:33:13 +02:00
Describe '-pkt ipfs username password:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed ipfs public and secret keys for user "username" and password "password"'
2022-09-23 11:33:13 +02:00
When run keygen -pkt ipfs username password
2022-06-25 22:43:28 +02:00
The output should include 'PeerID: 12D3KooWDMhdm5yrvtrbkshXFjkqLedHieUnPioczy9wzdnzquHC'
The output should include 'PrivKEY: CAESQA+XqCWjRqCjNe9oU3QA796bEH+T+rxgyPQ/EkXvE2MvNJoTbvcP+m51+XwxrmWqHaOpI1ZD0USwLjqAmV8Boas='
The status should be success
The stderr should equal ""
End
End
2022-09-27 16:33:07 +02:00
Describe '-pkt jwk username password:'
It 'prints prefixed jwk public and secret keys for user "username" and password "password"'
When run keygen -pkt jwk username password
The output should include 'pub: {"crv":"Ed25519","kty":"OKP","x":"NJoTbvcP-m51-XwxrmWqHaOpI1ZD0USwLjqAmV8Boas"}'
The output should include 'sec: {"crv":"Ed25519","d":"D5eoJaNGoKM172hTdADv3psQf5P6vGDI9D8SRe8TYy8","kty":"OKP","x":"NJoTbvcP-m51-XwxrmWqHaOpI1ZD0USwLjqAmV8Boas"}'
The status should be success
The stderr should equal ""
End
End
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
Describe '-pkm "tongue cute mail ...":'
It 'prints prefixed base58 public and secret keys for mnemonic "tongue cute mail ..."'
When run keygen -pkm "tongue cute mail fossil great frozen same social weasel impact brush kind"
The output should include 'pub: 732SSfuwjB7jkt9th1zerGhphs6nknaCBCTozxUcPWPU'
The output should include 'sec: 4NHNg9KSp81nXAN4Gmwx4EZ9bCdahnJ9jozJa1cGj9oDvzx9kCtNSvasqTZVm6VJXBQxyakZ5uZnj8AS6g87kK3x'
The status should be success
The stderr should equal ""
End
End
Describe " -pki ${ CRED_FILE } "
printf 'username\npassword\n' > " ${ CRED_FILE } "
It 'prints prefixed base58 public and secret keys for username and password read from credentials file"'
When run keygen -pki " ${ CRED_FILE } " -v
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should include 'input file format detected: credentials'
End
rm -f " ${ CRED_FILE } "
End
Describe " -pki ${ DUBP_FILE } "
printf 'tongue cute mail fossil great frozen same social weasel impact brush kind\n' > " ${ DUBP_FILE } "
It 'prints prefixed base58 public and secret keys for mnemonic read from dubp file"'
When run keygen -pki " ${ DUBP_FILE } " -v
The output should include 'pub: 732SSfuwjB7jkt9th1zerGhphs6nknaCBCTozxUcPWPU'
The output should include 'sec: 4NHNg9KSp81nXAN4Gmwx4EZ9bCdahnJ9jozJa1cGj9oDvzx9kCtNSvasqTZVm6VJXBQxyakZ5uZnj8AS6g87kK3x'
The status should be success
The stderr should include 'input file format detected: mnemonic'
End
rm -f " ${ DUBP_FILE } "
End
2022-09-27 16:33:07 +02:00
Describe " -f jwk -o ${ JWK_FILE } username password: "
rm -f " ${ JWK_FILE } "
It 'writes secret key to a JWK file for user "username" and password "password"'
When run keygen -f jwk -o " ${ JWK_FILE } " username password
The path " ${ JWK_FILE } " should exist
The contents of file " ${ JWK_FILE } " should include '{"crv":"Ed25519","d":"D5eoJaNGoKM172hTdADv3psQf5P6vGDI9D8SRe8TYy8","kty":"OKP","x":"NJoTbvcP-m51-XwxrmWqHaOpI1ZD0USwLjqAmV8Boas"}'
The status should be success
The stderr should equal ""
End
End
Describe " -pki ${ JWK_FILE } : "
It 'prints prefixed base58 public and secret keys for ed25519 key read from JWK file"'
When run keygen -pki " ${ JWK_FILE } " -v
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should include 'input file format detected: jwk'
End
rm -f " ${ JWK_FILE } "
End
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
Describe " -f nacl -o ${ NACL_FILE } username password: "
rm -f " ${ NACL_FILE } "
It 'writes secret key to a libnacl file for user "username" and password "password"'
When run keygen -f nacl -o " ${ NACL_FILE } " username password
The path " ${ NACL_FILE } " should exist
The contents of file " ${ NACL_FILE } " should include '{"priv": "0f97a825a346a0a335ef68537400efde9b107f93fabc60c8f43f1245ef13632f349a136ef70ffa6e75f97c31ae65aa1da3a9235643d144b02e3a80995f01a1ab", "verify": "349a136ef70ffa6e75f97c31ae65aa1da3a9235643d144b02e3a80995f01a1ab", "sign": "0f97a825a346a0a335ef68537400efde9b107f93fabc60c8f43f1245ef13632f"}'
The status should be success
The stderr should equal ""
End
End
Describe " -pki ${ NACL_FILE } : "
It 'prints prefixed base58 public and secret keys for ed25519 key read from libnacl file"'
When run keygen -pki " ${ NACL_FILE } " -v
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should include 'input file format detected: nacl'
End
rm -f " ${ NACL_FILE } "
End
Describe " -f ewif -o ${ EWIF_FILE } username password: "
rm -f " ${ EWIF_FILE } "
It 'writes encrypted secret key to a ewif file for user "username" and password "password"'
When run keygen -f ewif -o " ${ EWIF_FILE } " username password
The path " ${ EWIF_FILE } " should exist
The contents of file " ${ EWIF_FILE } " should include 'Type: EWIF'
The contents of file " ${ EWIF_FILE } " should include 'Version: 1'
The contents of file " ${ EWIF_FILE } " should include 'Data: 2w6iPHHjrfGT3HWvNV1cw3ZpGXAAQtfYzRxDXUkyW2y5WBorLtDUY'
The status should be success
The stderr should equal ""
End
End
Describe " -pki ${ EWIF_FILE } : "
It 'prints prefixed base58 public and secret keys for ed25519 key read from EWIF file"'
When run keygen -pki " ${ EWIF_FILE } " -v username password
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should include 'input file format detected: ewif'
End
rm -f " ${ EWIF_FILE } "
End
2022-09-18 13:55:41 +02:00
Describe " -o ${ PEM_FILE } username password: "
rm -f " ${ PEM_FILE } "
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'writes pkcs8 secret key to a pem file for user "username" and password "password"'
2022-09-18 13:55:41 +02:00
When run keygen -o " ${ PEM_FILE } " -t ipfs username password
The path " ${ PEM_FILE } " should exist
The contents of file " ${ PEM_FILE } " should include '-----BEGIN PRIVATE KEY-----'
The contents of file " ${ PEM_FILE } " should include 'MC4CAQAwBQYDK2VwBCIEIA+XqCWjRqCjNe9oU3QA796bEH+T+rxgyPQ/EkXvE2Mv'
The contents of file " ${ PEM_FILE } " should include '-----END PRIVATE KEY-----'
2022-06-25 22:43:28 +02:00
The status should be success
The stderr should equal ""
End
End
2022-09-18 13:55:41 +02:00
Describe " -f pem -o ${ PEM_FILE } username password: "
rm -f " ${ PEM_FILE } "
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'writes pkcs8 secret key to a pem file for user "username" and password "password"'
2022-09-18 13:55:41 +02:00
When run keygen -f pem -o " ${ PEM_FILE } " -t ipfs username password
The path " ${ PEM_FILE } " should exist
The contents of file " ${ PEM_FILE } " should include '-----BEGIN PRIVATE KEY-----'
The contents of file " ${ PEM_FILE } " should include 'MC4CAQAwBQYDK2VwBCIEIA+XqCWjRqCjNe9oU3QA796bEH+T+rxgyPQ/EkXvE2Mv'
The contents of file " ${ PEM_FILE } " should include '-----END PRIVATE KEY-----'
2022-09-12 14:19:05 +02:00
The status should be success
The stderr should equal ""
End
End
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
Describe " -pki ${ PEM_FILE } : "
It 'prints prefixed base58 public and secret keys for ed25519 key read from pkcs8 pem file"'
When run keygen -pki " ${ PEM_FILE } " -v
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should include 'input file format detected: pem'
End
rm -f " ${ PEM_FILE } "
End
2022-09-18 13:55:41 +02:00
Describe " -f pb2 -o ${ PB2_FILE } username password: "
rm -f " ${ PB2_FILE } "
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'writes protobuf2 secret key to a pb2 file for user "username" and password "password"'
2022-09-18 13:55:41 +02:00
decode_pb2( ) {
2022-09-27 16:33:07 +02:00
xxd -p " ${ PB2_FILE } "
2022-09-18 13:55:41 +02:00
}
not_xxd( ) {
! which xxd >/dev/null 2>& 1
}
Skip if 'You should install xxd' not_xxd
When run keygen -f pb2 -o " ${ PB2_FILE } " username password
The path " ${ PB2_FILE } " should exist
The result of function decode_pb2 should include '080112400f97a825a346a0a335ef68537400efde9b107f93fabc60c8f43f'
The result of function decode_pb2 should include '1245ef13632f349a136ef70ffa6e75f97c31ae65aa1da3a9235643d144b0'
The result of function decode_pb2 should include '2e3a80995f01a1ab'
2022-09-12 14:19:05 +02:00
The status should be success
The stderr should equal ""
End
2022-09-23 11:33:13 +02:00
End
Describe " -pki ${ PB2_FILE } : "
It 'prints prefixed base58 public and secret keys for ed25519 key read from pb2 file"'
When run keygen -pki " ${ PB2_FILE } " -v
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should include 'input file format detected: pb2'
End
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
rm -f " ${ PB2_FILE } "
2022-09-12 14:19:05 +02:00
End
2022-09-18 13:55:41 +02:00
Describe " -f pubsec -o ${ PUBSEC_FILE } username password: "
rm -f " ${ PUBSEC_FILE } "
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'writes base58 public and secret keys to a pubsec file for user "username" and password "password"'
2022-09-18 13:55:41 +02:00
When run keygen -f pubsec -o " ${ PUBSEC_FILE } " username password
The path " ${ PUBSEC_FILE } " should exist
The contents of file " ${ PUBSEC_FILE } " should include 'Type: PubSec'
The contents of file " ${ PUBSEC_FILE } " should include 'Version: 1'
The contents of file " ${ PUBSEC_FILE } " should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The contents of file " ${ PUBSEC_FILE } " should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
2022-06-25 22:43:28 +02:00
The status should be success
The stderr should equal ""
End
End
2022-09-18 13:55:41 +02:00
Describe " -o ${ PUBSEC_FILE } -t duniter username password: "
rm -f " ${ PUBSEC_FILE } "
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'writes duniter public and secret keys to a pubsec file for user "username" and password "password"'
2022-09-18 13:55:41 +02:00
When run keygen -o " ${ PUBSEC_FILE } " -t duniter username password
The path " ${ PUBSEC_FILE } " should exist
The contents of file " ${ PUBSEC_FILE } " should include 'Type: PubSec'
The contents of file " ${ PUBSEC_FILE } " should include 'Version: 1'
The contents of file " ${ PUBSEC_FILE } " should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The contents of file " ${ PUBSEC_FILE } " should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
2022-09-15 19:32:01 +02:00
The status should be success
The stderr should equal ""
End
End
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
Describe " -pki ${ PUBSEC_FILE } -t ipfs: "
2022-09-18 13:55:41 +02:00
It 'prints prefixed ipfs public and secret keys for base58 keys read in a pubsec file'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
When run keygen -pki " ${ PUBSEC_FILE } " -t ipfs -v
2022-09-18 13:55:41 +02:00
The output should include 'PeerID: 12D3KooWDMhdm5yrvtrbkshXFjkqLedHieUnPioczy9wzdnzquHC'
The output should include 'PrivKEY: CAESQA+XqCWjRqCjNe9oU3QA796bEH+T+rxgyPQ/EkXvE2MvNJoTbvcP+m51+XwxrmWqHaOpI1ZD0USwLjqAmV8Boas='
2022-06-25 22:43:28 +02:00
The status should be success
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
The stderr should include 'input file format detected: pubsec'
End
rm -f " ${ PUBSEC_FILE } "
End
Describe " -pki ${ SSB_FILE } : "
printf '{ "curve": "ed25519", "public": "cFVodZoKwLcmXbM6UeASdl8+7+Uo8PNOuFnlcqk7qUc=.ed25519", "private": "lUqlXYxjkM0/ljtGnwoM0CfP6ORA2DKZnzsQ4dJ1tKJwVWh1mgrAtyZdszpR4BJ2Xz7v5Sjw8064WeVyqTupRw==.ed25519", "id": "@cFVodZoKwLcmXbM6UeASdl8+7+Uo8PNOuFnlcqk7qUc=.ed25519" }\n' > " ${ SSB_FILE } "
It 'prints prefixed base58 public and secret keys for ed25519 key read from ssb file"'
When run keygen -pki " ${ SSB_FILE } " -v
The output should include 'pub: 8ZWCTFBUczYRucyvTgJL6oefj28u243LYU4ZjYKn4XDG'
The output should include 'sec: 3z7vcMHQhnVPTEEaFQ5gxn2NHkmJsFHkZ4W2aoAvt3Jt5ZYhFV1M6NEkm7Lr75pEF61oSkQVsaih9cQWBP2JmbVQ'
The status should be success
The stderr should include 'input file format detected: ssb'
End
rm -f " ${ SSB_FILE } "
End
Describe " -f seed -o ${ SEED_FILE } username password: "
rm -f " ${ SEED_FILE } "
It 'writes encoded secret key to a wif file for user "username" and password "password"'
When run keygen -f seed -o " ${ SEED_FILE } " username password
The path " ${ SEED_FILE } " should exist
The contents of file " ${ SEED_FILE } " should include '0f97a825a346a0a335ef68537400efde9b107f93fabc60c8f43f1245ef13632f'
The status should be success
The stderr should equal ""
End
End
Describe " -pki ${ SEED_FILE } : "
It 'prints prefixed base58 public and secret keys for ed25519 key read from seed file"'
When run keygen -pki " ${ SEED_FILE } " -v
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should include 'input file format detected: seed'
End
rm -f " ${ SEED_FILE } "
End
Describe " -f wif -o ${ WIF_FILE } username password: "
rm -f " ${ WIF_FILE } "
It 'writes encoded secret key to a wif file for user "username" and password "password"'
When run keygen -f wif -o " ${ WIF_FILE } " username password
The path " ${ WIF_FILE } " should exist
The contents of file " ${ WIF_FILE } " should include 'Type: WIF'
The contents of file " ${ WIF_FILE } " should include 'Version: 1'
The contents of file " ${ WIF_FILE } " should include 'Data: 7972e1McMMURp9R1MDCH1UMEEnF2bKAjc2WtEW3JyAVwMVT'
The status should be success
2022-06-25 22:43:28 +02:00
The stderr should equal ""
End
End
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
Describe " -pki ${ WIF_FILE } : "
It 'prints prefixed base58 public and secret keys for ed25519 key read from WIF file"'
When run keygen -pki " ${ WIF_FILE } " -v
The output should include 'pub: 4YLU1xQ9jzb7LzC6d91VZrYTEKS9N2j93Nnvcee6wxZG'
The output should include 'sec: K5heSX4xGUPtRbxcZh6zbgaKbDv8FeVc9JuSNWtUs7C1oGNKqv7kQJ3DHdouTPzoW4duKKnuLQK8LbHKfN9fkjC'
The status should be success
The stderr should include 'input file format detected: wif'
End
rm -f " ${ WIF_FILE } "
End
2022-09-18 13:55:41 +02:00
Describe '-t gpg username password birthday:'
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'creates a password protected gpg key for user "username"'
2022-06-25 22:43:28 +02:00
Skip "You should implement it !"
2022-08-28 23:26:59 +02:00
When run keygen -t pgp username password birthday
2022-06-25 22:43:28 +02:00
The status should be success
End
End
2022-09-18 13:55:41 +02:00
Describe '-pkg username:'
gpg --batch --import --quiet specs/username.asc
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed base58 public and secret keys for ed25519 gpg key matching uid "username"'
2022-09-18 13:55:41 +02:00
When run keygen -pkg username
2022-06-25 22:43:28 +02:00
The output should include 'pub: 2g5UL2zhkn5i7oNYDpWo3fBuWvRYVU1AbMtdVmnGzPNv'
The output should include 'sec: 5WtYFfA26nTfG496gAKhkrLYUMMnwXexmE1E8Q7PvtQEyscHfirsdMzW34zDp7WEkt3exNEVwoG4ajZYrm62wpi2'
The status should be success
The stderr should equal ""
End
2022-09-18 13:55:41 +02:00
gpg --batch --delete-secret-and-public-key --yes 4D1CDB77E91FFCD81B10F9A7079E5BF4721944FB
2022-06-25 22:43:28 +02:00
End
2022-09-18 13:55:41 +02:00
Describe '-pkg username@protected password:'
gpg --batch --import --quiet specs/username_protected.asc
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed public and secret keys for ed25519 gpg key matching uid "username@protected" and locked with password "password"'
2022-09-18 13:55:41 +02:00
When run keygen -pkg username@protected password
2022-08-28 23:26:59 +02:00
The output should include 'pub: C1cRu7yb5rZhsmRHQkeZxusAhtYYJypcnXpY3HycEKsU'
The output should include 'sec: VWaEdDroSCoagJDsBnDNUtXJtKAJYdqL6XKNiomz8DtiyF44FvpiMmhidXt2j8HhDBKPZ67xBGcZPnj4Myk6cB8'
The status should be success
The stderr should equal ""
End
2022-09-18 13:55:41 +02:00
gpg --batch --delete-secret-and-public-key --yes 6AF574897D4979B7956AC31B6222A29CBC31A087
2022-08-28 23:26:59 +02:00
End
2022-09-18 13:55:41 +02:00
Describe '-pkg usersame:'
gpg --batch --import --quiet specs/usersame.asc
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed base58 public and secret keys for rsa gpg key matching uid "usersame"'
2022-09-18 13:55:41 +02:00
When run keygen -pkg usersame
The output should include 'pub: 4NxSjjys6bo8mhM919MkvNkNPFu4zpFyxu1r7yJ39K87'
The output should include 'sec: 2cLFNeXiqcKKv5BF9JVTwtWmFHLvjDkJkrCyQbST9oYbsQLHsVaUAzbwrv5YfzQcPHu6e6XUzdstKy4kLhgDSGiw'
2022-06-25 22:43:28 +02:00
The status should be success
The stderr should equal ""
End
2022-09-18 13:55:41 +02:00
gpg --batch --delete-secret-and-public-key --yes 845E099CFD17FD07346F9D26CAB2E65557C656DF
2022-06-25 22:43:28 +02:00
End
2022-09-18 13:55:41 +02:00
Describe '-pkg usersame@protected password:'
gpg --batch --import --quiet specs/usersame_protected.asc
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
It 'prints prefixed public and secret keys for rsa gpg key matching uid "usersame@protected" and locked with password "password"'
2022-09-18 13:55:41 +02:00
When run keygen -pkg usersame@protected password
The output should include 'pub: 5kh2uqNTuYsLN7fwSRP3JWM4Hotcpdkb7frRNZwo9BPp'
The output should include 'sec: LdWjjkP7gRzH4k4gNkQs2er26bE2Dhz7cGPE8fMNixe1Uv2ZHbo1QtyZxmDeTP77y6HVLbHNoXdMTHdo6ip9PHk'
2022-08-28 23:26:59 +02:00
The status should be success
The stderr should equal ""
End
2022-09-18 13:55:41 +02:00
gpg --batch --delete-secret-and-public-key --yes 78BC5CD37664E5C1AA85AC97ABC22BF0C070C9AD
2022-08-28 23:26:59 +02:00
End
add multiple input/output file formats
* input: credentials, dubp mnemonic, ewif, nacl, pem pksc8, pubsec, seed, ssb, wif
* output: ewif, nacl, pb2, pem pksc8, pubsec, seed, wif
* bump version 0.0.4
2022-09-18 22:55:16 +02:00
Describe " -g -o ${ PUBSEC_FILE } -t duniter username: "
rm -f " ${ PUBSEC_FILE } "
gpg --batch --import --quiet specs/username.asc
It 'writes duniter public and secret keys to a pubsec file for gpg key matching uid "username"'
When run keygen -g -o " ${ PUBSEC_FILE } " -t duniter username
The path " ${ PUBSEC_FILE } " should exist
The contents of file " ${ PUBSEC_FILE } " should include 'Type: PubSec'
The contents of file " ${ PUBSEC_FILE } " should include 'Version: 1'
The contents of file " ${ PUBSEC_FILE } " should include 'pub: 2g5UL2zhkn5i7oNYDpWo3fBuWvRYVU1AbMtdVmnGzPNv'
The contents of file " ${ PUBSEC_FILE } " should include 'sec: 5WtYFfA26nTfG496gAKhkrLYUMMnwXexmE1E8Q7PvtQEyscHfirsdMzW34zDp7WEkt3exNEVwoG4ajZYrm62wpi2'
The status should be success
The stderr should equal ""
End
gpg --batch --delete-secret-and-public-key --yes 4D1CDB77E91FFCD81B10F9A7079E5BF4721944FB
End
2022-06-25 22:43:28 +02:00
End