Skip to content

Commit

Permalink
Add Card.cert_url for retrieving certificate URL
Browse files Browse the repository at this point in the history
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
  • Loading branch information
wiktor-k committed Nov 23, 2023
1 parent 5648b91 commit fea9f91
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion NEXT.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Next version changes
## This file contains changes that will be included in the next version that is released
v0.2.0
v0.1.21

New:
- `Card.cert_url` - for retrieving certificate URL stored on the card, note that the URL returned can be empty or invalid,

Changed:

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ sh /start.sh
echo 12345678 > pin
opgpcard admin --card 0000:00000000 --admin-pin pin import no-passwd.pgp
opgpcard admin --card 0000:00000000 --admin-pin pin name "John Doe"
opgpcard admin --card 0000:00000000 --admin-pin pin url "https://example.com/key.pgp"
```

## Functions
Expand Down Expand Up @@ -408,6 +409,7 @@ card = Card.open("0000:00000000")

print(f"Card ident: {card.ident}")
assert card.cardholder == "John Doe"
assert card.cert_url == "https://example.com/key.pgp"
```

Cards can be used for signing data:
Expand Down
6 changes: 6 additions & 0 deletions src/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ impl Card {
.map(|name| String::from_utf8_lossy(name).into()))
}

#[getter]
pub fn cert_url(&mut self) -> anyhow::Result<String> {
let mut transaction = self.open.transaction()?;
Ok(transaction.url()?)
}

#[getter]
pub fn ident(&mut self) -> anyhow::Result<String> {
let transaction = self.open.transaction()?;
Expand Down

0 comments on commit fea9f91

Please sign in to comment.