Return a mapping of {alogo: checksum in hex} given a prefixed checksum from an npm manifest.
(checksum)
| 1436 | |
| 1437 | |
| 1438 | def get_algo_hexsum(checksum): |
| 1439 | """ |
| 1440 | Return a mapping of {alogo: checksum in hex} given a prefixed checksum from |
| 1441 | an npm manifest. |
| 1442 | """ |
| 1443 | if not checksum or '-' not in checksum: |
| 1444 | return {} |
| 1445 | |
| 1446 | algo, _, checksum = checksum.partition('-') |
| 1447 | # value is base64 encoded: we convert to hex |
| 1448 | checksum = base64.b64decode(checksum.encode('ascii')).hex() |
| 1449 | return {algo: checksum} |
| 1450 | |
| 1451 | |
| 1452 | def npm_homepage_url(namespace, name, registry='https://www.npmjs.com/package'): |
no test coverage detected