(value: number)
| 30 | |
| 31 | // Variable-length quantity encoding aka. base-128 encoding |
| 32 | function encodeBase128(value: number): Buffer { |
| 33 | const bytes = []; |
| 34 | do { |
| 35 | let byte = value & 0x7f; |
| 36 | value >>>= 7; |
| 37 | if (bytes.length > 0) |
| 38 | byte |= 0x80; |
| 39 | bytes.push(byte); |
| 40 | } while (value > 0); |
| 41 | return Buffer.from(bytes.reverse()); |
| 42 | } |
| 43 | |
| 44 | // ASN1/DER Speficiation: https://www.itu.int/rec/T-REC-X.680-X.693-202102-I/en |
| 45 | class DER { |
no test coverage detected
searching dependent graphs…