in runtimes/runtimes/auth/auth.ts [179:198]
private async decodeCredentialsRequestToken<T>(request: UpdateCredentialsParams): Promise<T> {
this.connection.console.info('Runtime: Decoding encrypted credentials token')
if (!this.key) {
throw new Error('No encryption key')
}
if (this.credentialsEncoding === 'JWT') {
this.connection.console.info('Decoding JWT token')
const result = await jwtDecrypt(request.data as string, this.key, {
clockTolerance: 60, // Allow up to 60 seconds to account for clock differences
contentEncryptionAlgorithms: ['A256GCM'],
keyManagementAlgorithms: ['dir'],
})
if (!result.payload.data) {
throw new Error('JWT payload not found')
}
return result.payload.data as T
}
throw new Error('Encoding mode not implemented')
}