generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#359 - fixed unauthorized access of data through dataCid reference in…
… RecordsWrite
- Loading branch information
1 parent
f8c0fa7
commit 03bcb1c
Showing
15 changed files
with
448 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
|
||
/** | ||
* Asynchronously iterates an {AsyncGenerator} to return all the values in an array. | ||
* Array utility methods. | ||
*/ | ||
export async function asyncGeneratorToArray<T>(iterator: AsyncGenerator<T>): Promise<Array<T>> { | ||
const array: Array<T> = [ ]; | ||
for await (const value of iterator) { | ||
array.push(value); | ||
export class ArrayUtility { | ||
/** | ||
* Returns `true` if content of the two given byte arrays are equal; `false` otherwise. | ||
*/ | ||
public static byteArraysEqual(array1: Uint8Array, array2:Uint8Array): boolean { | ||
const equal = array1.length === array2.length && array1.every((value, index) => value === array2[index]); | ||
return equal; | ||
} | ||
|
||
/** | ||
* Asynchronously iterates an {AsyncGenerator} to return all the values in an array. | ||
*/ | ||
public static async fromAsyncGenerator<T>(iterator: AsyncGenerator<T>): Promise<Array<T>> { | ||
const array: Array<T> = [ ]; | ||
for await (const value of iterator) { | ||
array.push(value); | ||
} | ||
return array; | ||
} | ||
return array; | ||
} | ||
} |
Oops, something went wrong.