Skip to content

Commit ab093d3

Browse files
authored
Merge pull request #152 from eclipse-biscuit/push-zymuutommvuo
doc(cli): update CLI examples
2 parents e8475e4 + d2a8d34 commit ab093d3

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

docs/src/usage/command-line.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,51 @@ cargo install --path .
2626
$ # this will output the keypair, you can then copy/paste the components
2727
$ biscuit keypair
2828
> Generating a new random keypair
29-
> Private key: 4aa4bae701c6eb05cfe0bdd68d5fab236fc0d0d3dcb2a9b582a0d87b23e04500
30-
> Public key: 687b536c502f10f5978eee2d0c04f2869d15cf7858983dc50b6729b15e203809
29+
> Private key: ed25519-private/4aa4bae701c6eb05cfe0bdd68d5fab236fc0d0d3dcb2a9b582a0d87b23e04500
30+
> Public key: ed25519/687b536c502f10f5978eee2d0c04f2869d15cf7858983dc50b6729b15e203809
3131
3232
$ # this will save the private key to a file so you can use it later
3333
$ biscuit keypair --only-private-key > private-key-file
3434
$ cat private-key-file
35-
> e4d17ae4fd444ace42ab0a813c242643cf9b4ef96ca07c502e8e72142a3e8a2e
35+
> ed25519-private/e4d17ae4fd444ace42ab0a813c242643cf9b4ef96ca07c502e8e72142a3e8a2e
3636
```
3737

3838
### Generate a public key from a private key
3939

4040
```
41-
$ biscuit keypair --from-private-key-file private-key-file --only-public-key
42-
> 51c20fb821f7d6a3939fba5c80f0915d80087799de6988a3259c6782bea93d7f
41+
$ biscuit keypair --from-file private-key-file --only-public-key
42+
> ed25519/51c20fb821f7d6a3939fba5c80f0915d80087799de6988a3259c6782bea93d7f
4343
44-
$ biscuit keypair --from-private-key-file private-key-file --only-public-key > public-key-file
44+
$ biscuit keypair --from-file private-key-file --only-public-key > public-key-file
45+
```
46+
47+
#### Choose the algorithm and format
48+
49+
```
50+
# custom algorithm (default is ed25519)
51+
$ biscuit keypair --key-algorithm secp256r1
52+
> Generating a new random keypair
53+
> Private key: secp256r1-private/189ce3147fe28b8875ae5478ecc514cfd6ab3fd020fcd2386432e93150f0e6eb
54+
> Public key: secp256r1/0332b24b4008ea3efb281a92d65f19987b577f6ed90e398abdf7df1dad53de13c9
55+
56+
# custom output format
57+
$ biscuit keypair --key-output-format pem
58+
> Generating a new random keypair
59+
> -----BEGIN PRIVATE KEY-----
60+
> MFECAQEwBQYDK2VwBCIEIEY1832SSOdspf07T3ZGEAmFevrMpibm4en68Jw/tX8S
61+
> gSEA/dNHKD50Enh9Y0QpsvN8zttpojIo8Gf4KTFphsU2VbE=
62+
> -----END PRIVATE KEY-----
63+
> -----BEGIN PUBLIC KEY-----
64+
> MCowBQYDK2VwAyEA/dNHKD50Enh9Y0QpsvN8zttpojIo8Gf4KTFphsU2VbE=
65+
> -----END PUBLIC KEY-----
66+
67+
# raw storage is possible, but the key algorithm must be provided explicitly
68+
# be extra careful
69+
$ biscuit keypair --key-algorithm secp256r1 --key-output-format raw --only-private-key > raw-private-key
70+
$ biscuit keypair --from-file raw-private-key --from-format raw --from-algorithm secp256r1
71+
> Generating a keypair from the provided private key
72+
> Private key: secp256r1-private/abeac86b0716818871e876dd893437450ca987bbc6015f040c5c6084744bc875
73+
> Public key: secp256r1/022b6b37557cbd2c522f36fd37899de8022f55ac4f73ca2e1489692fd56cd34990
4574
```
4675

4776
## Create a token
@@ -72,7 +101,7 @@ $ echo 'right("file1");' | biscuit generate --raw --private-key-file private-key
72101
$ biscuit inspect --raw-input biscuit-file.bc --public-key-file public-key-file
73102
> Open biscuit
74103
> Authority block:
75-
> == Datalog ==
104+
> == Datalog v3.0 ==
76105
> right("file1");
77106
>
78107
> == Revocation id ==
@@ -93,7 +122,7 @@ $ biscuit inspect --raw-input biscuit-file.bc \
93122
--include-time
94123
> Open biscuit
95124
> Authority block:
96-
> == Datalog ==
125+
> == Datalog v3.0 ==
97126
> right("file1");
98127
>
99128
> == Revocation id ==

0 commit comments

Comments
 (0)