MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / tryParseIntegritySuffix

Function tryParseIntegritySuffix

lib/validator/component_name.cpp:288–305  ·  view source on GitHub ↗

hashname ::= 'integrity=<' '>' Parses optional ',integrity=<...>' suffix from Next. If Next is empty, returns true with empty Integrity. On success, Next is consumed and Integrity is set.

Source from the content-addressed store, hash-verified

286// If Next is empty, returns true with empty Integrity.
287// On success, Next is consumed and Integrity is set.
288Expect<void> tryParseIntegritySuffix(std::string_view &Next,
289 std::string_view &Integrity) {
290 if (Next.empty()) {
291 Integrity = {};
292 return {};
293 }
294 if (!tryRead(",integrity=<"sv, Next))
295 return reportError("expected ',integrity=<' after "sv);
296 std::string_view IntegrityData;
297 if (!readUntil(Next, '>', IntegrityData))
298 return reportError("expected '>' closing integrity"sv);
299 if (!isIntegrityMetadata(IntegrityData))
300 return reportError("invalid integrity metadata"sv);
301 if (!isEOF(Next))
302 return reportError("unexpected trailing content after integrity"sv);
303 Integrity = IntegrityData;
304 return {};
305}
306
307// pkgpath ::= <namespace> <words>
308// Parses 'namespace:package' from Next, stopping at delimiters in StopChars.

Callers 1

parseMethod · 0.85

Calls 6

tryReadFunction · 0.85
reportErrorFunction · 0.85
readUntilFunction · 0.85
isIntegrityMetadataFunction · 0.85
isEOFFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected