File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -78,17 +78,19 @@ export class CID {
78
78
/** @readonly */
79
79
this . bytes = bytes
80
80
81
- // ArrayBufferView
82
- /** @readonly */
83
- this . byteOffset = bytes . byteOffset
84
- /** @readonly */
85
- this . byteLength = bytes . byteLength
86
-
87
81
// Circular reference
88
82
/** @readonly */
89
83
this . asCID = this
90
84
}
91
85
86
+ get byteOffset ( ) {
87
+ return this . bytes . byteOffset
88
+ }
89
+
90
+ get byteLength ( ) {
91
+ return this . bytes . byteLength
92
+ }
93
+
92
94
/**
93
95
* @returns {CID<Data, API.DAG_PB, API.SHA_256, 0> }
94
96
*/
@@ -274,6 +276,10 @@ export class CID {
274
276
throw new Error ( 'String codecs are no longer supported' )
275
277
}
276
278
279
+ if ( ! ( digest . bytes instanceof Uint8Array ) ) {
280
+ throw new Error ( 'Invalid multihash digest was passed' )
281
+ }
282
+
277
283
switch ( version ) {
278
284
case 0 : {
279
285
if ( code !== DAG_PB_CODE ) {
You can’t perform that action at this time.
0 commit comments