code: function validateKey(key, flags, version) {
    assert(Buffer.isBuffer(key));
    assert(typeof flags === 'number');
    assert(typeof version === 'number');
  
    if (flags & Script.flags.VERIFY_STRICTENC) {
      if (!common.isKeyEncoding(key))
        throw new ScriptError('PUBKEYTYPE');
    }
  
    if (version === 1) {
      if (flags & Script.flags.VERIFY_WITNESS_PUBKEYTYPE) {
        if (!common.isCompressedEncoding(key))
          throw new ScriptError('WITNESS_PUBKEYTYPE');
      }
    }
  
    return true;
  }
docs: Test whether the data element is a valid key if VERIFY_STRICTENC is enabled.
  @param {Buffer} key
  @param {VerifyFlags?} flags
  @returns {Boolean}
  @throws {ScriptError}