function · Browser and Node

# signCose1

`@toip-tools/cose` · [View source](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/cose/src/sign1.ts#L34)

Import:

```ts
import { signCose1 } from "@toip-tools/cose";
```

## Declaration

Signature:

```ts
signCose1(payload: Uint8Array, signer: AsyncSigner, opts?: SignOptions): Promise<Uint8Array>;
```

### Parameters

**`payload` (required)**

`Uint8Array<ArrayBufferLike>`

**`signer` (required)**

`AsyncSigner`

**`opts` (optional)**

`SignOptions`

Default: `{}`

**Fields of `opts`**

**`contentType` (optional)**

`string | number | undefined`

Header 3: a media type, or a CoAP content-format number.

**`omitKid` (optional)**

`boolean | undefined`

Leave the kid out of the protected header (radio frames).

**`unprotected` (optional)**

`Map<number, unknown> | undefined`

Unprotected header parameters. Default: none.

**`externalAad` (optional)**

`Uint8Array<ArrayBufferLike> | undefined`

Bound into the signature but not sent (RFC 9052 §4.3).

### Returns

`Promise<Uint8Array<ArrayBufferLike>>`

[Usage guide](https://toip.tools/toolkit/cose/#usage) · [Error handling](https://toip.tools/toolkit/cose/#errors) · [All exports](https://toip.tools/toolkit/cose/api/)

---

This is the Markdown version of https://toip.tools/toolkit/cose/api/signCose1/. An index of the documentation for AI assistants is at https://toip.tools/llms.txt.
