Proof
import { Proof } from "https://raw.githubusercontent.com/marigold-dev/tzstamp/0.3.4/proof/mod.ts";
Cryptographic timestamp proof
class Proof { }
constructor({ hash, operations }: ProofOptions);
readonly derivation: Uint8Array;
readonly hash: Uint8Array;
concat(proof: AnyProof);
isAffixed(): this is AffixedProof;
isUnresolved(): this is UnresolvedProof;
toJSON(): ProofTemplate;
static create(options: AnyProofOptions);
§Constructors
§
new Proof({ hash, operations }: ProofOptions)
[src]§Properties
§Methods
§
concat(proof: AffixedProof): AffixedProof
[src]Concatenates another proof's operations to the current one.
Throws MismatchedHashError
if the derivation of the current proof does not match
the stored hash of the passed proof.
const proofA = Proof.create({ ... });
const proofB = Proof.create({ ... });
const proofAB = proofA.concat(proofB);
// Hash of proofA
// Operations of proofA + proofB
// Calculates new derivation
The AffixedProof
and UnresolvedProof
subclasses are viral.
Concatenating to instances of these classes will produce a new
instance of the same subclass:
const affixedProof = new AffixedProof({ ... });
proof.concat(affixedProof);
// AffixedProof {}
// Retains extra fields of affixedProof
const unresolvedProof = new UnresolvedProof({ ... });
proof.concat(unresolvedProof);
// UnresolvedProof {}
// Retains extra fields of unresolvedProof
The AffixedProof
subclass represents the end of a proof
and cannot be concatenated to:
affixedProof.concat(proof);
// TypeError: Cannot concatenate to an affixed proof
@param proof
Proof to append
concat(proof: UnresolvedProof): UnresolvedProof
[src]concat(proof: AnyProof)
[src]§
isAffixed(): this is AffixedProof
[src]Narrows the proof to the affixed subclass.
§
isUnresolved(): this is UnresolvedProof
[src]Narrows the proof to the unresolved subclass.
§
toJSON(): ProofTemplate
[src]Converts the proof to a JSON-serializable template.
JSON.stringify(myProof);
// `myProof.toJSON` is called implicitly
§Static Methods
§
create(options: AffixedProofOptions): AffixedProof
[src]Creates an automatically subclassed proof.
Proof.create({
hash: ...,
operations: [...],
remote: "...",
});
// UnresolvedProof{}
@param options
Proof constructor options
create(options: UnresolvedProofOptions): UnresolvedProof
[src]create(options: ProofOptions): Proof
[src]create(options: AnyProofOptions)
[src]