MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / getBitString

Method getBitString

modules/crypt/etc/ber.js:99–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97 }
98 }
99 getBitString() {
100 let result;
101 if (this.getTag() != 3)
102 throw new Error("BER: not a bit string");
103 let length = this.getLength();
104 let pad = this.#a[this.#i++];
105 if (pad) {
106 result = new Uint8Array(length - 1);
107 for (let i = 0; i < length - 1; i++)
108 result[i] = this.#a[this.#i++] >>> pad;
109 }
110 else {
111 result = this.#a.subarray(this.#i, this.#i + length - 1);
112 this.#i += length;
113 }
114 return result;
115 }
116 getOctetString() {
117 if (this.getTag() != 0x04)
118 throw new Error("BER: not a octet string");

Callers 2

decodeFunction · 0.95
getSPKFunction · 0.80

Calls 2

getTagMethod · 0.95
getLengthMethod · 0.95

Tested by

no test coverage detected