We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0dd0369 commit 9edd53dCopy full SHA for 9edd53d
1 file changed
src/index.ts
@@ -758,6 +758,28 @@ export class BunnyCdnStream {
758
};
759
}
760
761
+ /**
762
+ * Generate an embed token for an iframe
763
+ *
764
+ * @param videoId
765
+ * @param tokenSecurityKey
766
+ * @param expirationTime
767
+ * @returns A sha256 hash string
768
+ */
769
+ public async generateEmbedToken(
770
+ videoId: string,
771
+ tokenSecurityKey: string,
772
+ expirationTime: number,
773
+ ) {
774
+ return createHash("sha256")
775
+ .update(
776
+ tokenSecurityKey.toString() +
777
+ videoId.toString() +
778
+ expirationTime.toString(),
779
+ )
780
+ .digest("hex");
781
+ }
782
+
783
private generateTUSHash(videoId: string, expirationTime: number) {
784
// sha256(library_id + api_key + expiration_time + video_id)
785
return createHash("sha256")
0 commit comments