(
options: {
userId: string;
displayName: string;
roomId: string;
clientId?: string;
channelId?: string;
connectionId: string;
},
secret: string,
ttlSeconds = 30,
)
| 45 | }; |
| 46 | |
| 47 | export const signTranscriptSfuRelayStartToken = async ( |
| 48 | options: { |
| 49 | userId: string; |
| 50 | displayName: string; |
| 51 | roomId: string; |
| 52 | clientId?: string; |
| 53 | channelId?: string; |
| 54 | connectionId: string; |
| 55 | }, |
| 56 | secret: string, |
| 57 | ttlSeconds = 30, |
| 58 | ): Promise<{ token: string; expiresAt: number }> => { |
| 59 | const nowSeconds = Math.floor(Date.now() / 1000); |
| 60 | const expiresAt = (nowSeconds + ttlSeconds) * 1000; |
| 61 | const token = await signHs256Jwt( |
| 62 | { |
| 63 | iss: "conclave-transcript-worker", |
| 64 | aud: "conclave-sfu", |
| 65 | sub: options.userId, |
| 66 | tokenUse: "transcript:sfuRelayStart", |
| 67 | userId: options.userId, |
| 68 | displayName: options.displayName, |
| 69 | roomId: options.roomId, |
| 70 | clientId: options.clientId, |
| 71 | channelId: options.channelId, |
| 72 | connectionId: options.connectionId, |
| 73 | sessionStatus: "live", |
| 74 | transportMode: "sfu", |
| 75 | exp: nowSeconds + ttlSeconds, |
| 76 | }, |
| 77 | secret, |
| 78 | ); |
| 79 | return { token, expiresAt }; |
| 80 | }; |
| 81 | |
| 82 | export const verifyTranscriptToken = async ( |
| 83 | token: string, |
no test coverage detected