class_docstr: A class for computing and verifying notebook signatures.
class_docstr_tok: ["A","class","for","computing","and","verifying","notebook","signatures","."]
docstr: Check a notebook's stored signature
  
  If a signature is stored in the notebook's metadata,
  a new signature is computed and compared with the stored value.
  
  Returns True if the signature is found and matches, False otherwise.
  
  The following conditions must all be met for a notebook to be trusted:
  - a signature is stored in the form 'scheme:hexdigest'
  - the stored scheme matches the requested scheme
  - the requested scheme is available from hashlib
  - the computed hash from notebook_signature matches the stored hash
docstr_tok: ["Check","a","notebook","'s","stored","signature","If","a","signature","is","stored","in","the","notebook","'s","metadata",",","a","new","signature","is","computed","and","compared","with","the","stored","value",".","Returns","True","if","the","signature","is","found","and","matches",",","False","otherwise",".","The","following","conditions","must","all","be","met","for","a","notebook","to","be","trusted",":","-","a","signature","is","stored","in","the","form","'scheme",":","hexdigest'","-","the","stored","scheme","matches","the","requested","scheme","-","the","requested","scheme","is","available","from","hashlib","-","the","computed","hash","from","notebook_signature","matches","the","stored","hash"]
code: def check_signature(self, nb):
      """Check a notebook's stored signature
  
      If a signature is stored in the notebook's metadata,
      a new signature is computed and compared with the stored value.
  
      Returns True if the signature is found and matches, False otherwise.
  
      The following conditions must all be met for a notebook to be trusted:
      - a signature is stored in the form 'scheme:hexdigest'
      - the stored scheme matches the requested scheme
      - the requested scheme is available from hashlib
      - the computed hash from notebook_signature matches the stored hash
      """
      if nb.nbformat < 3:
          return False
      signature = self.compute_signature(nb)
      return self.store.check_signature(signature, self.algorithm)
  
imports: from __future__ import annotations
  import hashlib
  import os
  import sys
  import typing
  from collections import OrderedDict
  from contextlib import contextmanager
  from datetime import datetime, timezone
  from hmac import HMAC
  from pathlib import Path
  from jupyter_core.paths import jupyter_data_dir
  from base64 import encodebytes
  from jupyter_core.application import JupyterApp, base_flags
  from traitlets import Any, Bool, Bytes, Callable, Enum, Instance, Integer, Unicode, default, observe
  from traitlets.config import LoggingConfigurable
  from .None import NO_CONVERT, __version__, read, reads
label_desc: Use image node_id 11 for calling the NotebookNotary obj's underlying member method code with example usage: obj.check_signature(nb) and returns: self, False