verify
Verifies one or more cryptographic signatures on a document.
verifydeclarationis-valid
name | type | description |
---|---|---|
declaration | Wrapper for a digital signature. | |
is-valid |
|
sign
is a generic function accepting a Declaration
to return a boolean result on its integrity. verify
and its counterpart sign
form a pair of opposing operations.
verify
throws without an instance of Declaration
. You may instantiate one from a serialized form with the static method Declaration.from
.
verify
returns true
if all ed25519 signatures can be verified with their corresponding public keys. Otherwise, verify
returns false
.
Warning: Everything needed to verify the signatures exists within a
Declaration
, but it is up to you to verify the authenticity of the public keys withinsignatories
.
Example
import {confidential} from "panda-confidential"
{verify, convert, Declaration} = confidential()
import {receive, process} from "my-library"
do ->
# You may hydrate a Declaration instance with the static method `from`
greeting = Declaration.from "base64", receive "Alice"
if verify greeting
# do something with the verified data.
process convert from: "btyes", to: "utf8", greeting.data
else
throw new Error "Unable to verify data signatures."