as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
Ring
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

HmacContext

Represents an HMAC (Hash-based Message Authentication Code) context. This class provides functionality for creating and verifying HMAC signatures.

Extends

  • BaseCryptoClass

Constructors

new HmacContext()

new HmacContext(): HmacContext

Returns

HmacContext

Methods

sign()

sign(message: ArrayBuffer): Promise<ArrayBuffer>

Sign a message using the HMAC context.

Parameters

message

ArrayBuffer

The message to be signed.

Throws

  • If the key lacks the purpose.

Returns

Promise<ArrayBuffer>

Promise A promise that resolves to the HMAC signature as an ArrayBuffer.


verify()

verify(message: ArrayBuffer, tag: ArrayBuffer): Promise<boolean>

Verify the authenticity of a message using the HMAC context.

Parameters

message

ArrayBuffer

The original message to verify.

tag

ArrayBuffer

The HMAC tag (signature) to verify against the message.

Throws

  • If the key lacks the purpose.

Returns

Promise<boolean>

Promise A promise that resolves to true if the message is authentic, false otherwise.


Last updated: Jul 22, 2026