SignedHttpRequest class

方法

generatePublicKeyThumbprint()

为给定的请求选项生成并缓存密钥对。

removeKeys(string)

从浏览器中删除给定公钥指纹的缓存密钥

signRequest(string, string, object)

使用给定密钥为给定有效负载生成已签名的 http 请求。

构造函数详细信息

SignedHttpRequest(SignedHttpRequestParameters, SignedHttpRequestOptions)

new SignedHttpRequest(shrParameters: SignedHttpRequestParameters, shrOptions?: SignedHttpRequestOptions)

参数

方法详细信息

generatePublicKeyThumbprint()

为给定的请求选项生成并缓存密钥对。

function generatePublicKeyThumbprint(): Promise<string>

返回

Promise<string>

公钥摘要,应将其发送到令牌颁发者。

removeKeys(string)

从浏览器中删除给定公钥指纹的缓存密钥

function removeKeys(publicKeyThumbprint: string): Promise<boolean>

参数

publicKeyThumbprint

string

公钥摘要(来自 generatePublicKeyThumbprint API)

返回

Promise<boolean>

如果正确删除了密钥

signRequest(string, string, object)

使用给定密钥为给定有效负载生成已签名的 http 请求。

function signRequest(payload: string, publicKeyThumbprint: string, claims?: object): Promise<string>

参数

payload

string

要签名的有效负载(例如访问令牌)

publicKeyThumbprint

string

公钥摘要(来自 generatePublicKeyThumbprint API)

claims

object

用于在已签名的 JWT 中包含/重写的其他声明

返回

Promise<string>

使用相应的私钥签名的 Pop 令牌