aboutsummaryrefslogtreecommitdiffstats
path: root/license-generator/aquatic-prime/Cargo.toml
AgeCommit message (Collapse)Author
2018-11-21aquatic-prime: Switch to my public fork of `rust-plist`Teddy Wing
Published my local fork publicly with the base64 format change.
2018-11-08aquatic-prime: Move 'base64' and 'serde_derive' crates to dev depsTeddy Wing
As these crates are only used in tests, move them to the `dev-dependencies` section, and add `cfg(test)` to 'base64'.
2018-11-07AquaticPrime::plist(): Fix signatureTeddy Wing
When I updated the plist function tests, I discovered that the `data` field for "Signature" was incorrect. Turns out that the 'plist' crate takes it upon itself to base64 encode the input Vec it gets: https://github.com/ebarnard/rust-plist/blob/v0.3.0/src/xml/writer.rs#L171-L174 This meant I was double-base64 encoding the signature. To fix this, I removed base64 encoding from the `sign()` method, and return the `[u8]` array directly. I thought this would be the end of it, but I ran into another problem where my tests failed. It turns out that the 'plist' crate base64 encodes using the `base64::MIME` config, which wraps the base64-encoded string to 76 characters and uses CRLF line endings. But my XML string uses plain LF line endings, so I ended up with useless CRs in the `<data>` tag. To solve this, I ended up having to fork the 'plist' crate and change it to use the `base64::STANDARD` config, which doesn't line wrap the base64 string. For now the fork is a local copy. I'll publish it when I'm ready to publish the rest.
2018-11-07AquaticPrime: Add `plist` methodTeddy Wing
Working version of a function that generates a license plist XML string from input data. Made a complete and utter mess of the code, and the two tests in this commit aren't really tests, they're just a way of executing the function. The function takes a serializable data type, sends the data to the `sign` function, and produces an XML plist string of the input data plus a field for the signature. In order to accomplish this, I ended up with a kind of roundabout data manipulation. 1. We start with the user data type. 2. That then gets serialised to an XML plist using the 'plist' crate's 'serde' serializer. 3. The serialized XML is then deserialized to a `Plist` instance. 4. The dict is extracted from the `Plist` and fed to `sign()` get a signature from the data. 5. We add the signature to the dict as a `Plist::Data`, in accordance with the Aquatic Prime license file format. 6. The full dict including the signature entry is serialized to XML and returned from the function. I ended up with this circuitous manipulation because I wanted to be able to accept an arbitrary struct as input data, and serializing it seemed to be the easiest way to get a plist dict from it. But we can't just use that serialized result, because it doesn't contain the signature. Getting a `Plist` from the data seemed to be the right way to go, as the signature entry needs to be a plist `data` type, so we can't just insert it into a `<String, String>` `HashMap`. Now that it works, I'll be cleaning all of this up in further commits.
2018-11-06aquatic-prime: Add 'error-chain' crateTeddy Wing
2018-11-06aquatic-prime: Base64 encode the signatureTeddy Wing
2018-11-05Add 'aquatic-prime' sub-crateTeddy Wing
We'll use this new library crate to generate licenses in the Aquatic Prime format. Planning on just porting the C code directly to Rust.