The podcast:integrity of an alternate enclosure, and a check of a file against it.
The integrity is Subresource Integrity metadata of the W3C, e.g. sha384-…, or a PGP signature. Subresource Integrity is at https://www.w3.org/TR/sri/
The podcast:integrity of an alternate enclosure, and a check of a file against it. The integrity is Subresource Integrity metadata of the W3C, e.g. sha384-…, or a PGP signature. Subresource Integrity is at https://www.w3.org/TR/sri/
(sri s)The strongest hashes of the SRI integrity metadata s, as Subresource
Integrity of the W3C selects them. It's nil when s names no hash of
sha256, sha384 or sha512.
The result is a map of the strongest :algorithm that s names, e.g.
"sha384", and the set of its base64 :digests.
The strongest hashes of the SRI integrity metadata `s`, as Subresource Integrity of the W3C selects them. It's nil when `s` names no hash of sha256, sha384 or sha512. The result is a map of the strongest :algorithm that `s` names, e.g. "sha384", and the set of its base64 :digests.
(verify! url integrity)(verify! url {:keys [type value] :as integrity} {:keys [send] :as opts})Check whether the file at url is what integrity says, with opts.
On the JVM it gives the result, and in ClojureScript a promise of it.
The integrity is the podcast:integrity of an alternate enclosure, a
map of :type and :value. The result has :valid? true and the :algorithm
when the digest of the whole file is one of the strongest hashes of
integrity. Otherwise, :valid? is false.
The result has :valid? nil and a diagnostic under :error when no check was made:
Nothing that the network or the server does throws. On the JVM, the file
streams through the digest. In ClojureScript, or with :send, the file
comes whole, up to the :max-bytes of a request. The opts are these:
Check whether the file at `url` is what `integrity` says, with `opts`. On the JVM it gives the result, and in ClojureScript a promise of it. The `integrity` is the podcast:integrity of an alternate enclosure, a map of :type and :value. The result has :valid? true and the :algorithm when the digest of the whole file is one of the strongest hashes of `integrity`. Otherwise, :valid? is false. The result has :valid? nil and a diagnostic under :error when no check was made: - :file/unverifiable for a PGP signature, which needs the key of the publisher, or for a value that names no hash of Subresource Integrity - :file/unreachable when the file didn't come Nothing that the network or the server does throws. On the JVM, the file streams through the digest. In ClojureScript, or with :send, the file comes whole, up to the :max-bytes of a request. The `opts` are these: - :send, a function that sends a request map in place of client/send! - :headers, :timeout-seconds, :allow-pred and :user-agent, as http/send! takes them, with a timeout of 600 seconds by default
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |