Evolution SDK
ModulesMessage signing

message-signing/CoseSign1.ts

CoseSign1 overview

COSE_Sign1 structures (RFC 8152).

Added in v2.0.0


Table of contents


Constructors

coseSign1BuilderNew

Create a new COSESign1Builder.

Signature

export declare const coseSign1BuilderNew: (
  headers: Headers,
  payload: Uint8Array,
  isPayloadExternal: boolean
) => COSESign1Builder

Added in v2.0.0

Conversion

coseSign1FromCBORBytes

Decode COSESign1 from CBOR bytes.

Signature

export declare const coseSign1FromCBORBytes: (bytes: Uint8Array, options?: CBOR.CodecOptions) => COSESign1

Added in v2.0.0

coseSign1FromCBORHex

Decode COSESign1 from CBOR hex.

Signature

export declare const coseSign1FromCBORHex: (hex: string, options?: CBOR.CodecOptions) => COSESign1

Added in v2.0.0

coseSign1ToCBORBytes

Encode COSESign1 to CBOR bytes.

Signature

export declare const coseSign1ToCBORBytes: (coseSign1: COSESign1, options?: CBOR.CodecOptions) => Uint8Array

Added in v2.0.0

coseSign1ToCBORHex

Encode COSESign1 to CBOR hex.

Signature

export declare const coseSign1ToCBORHex: (coseSign1: COSESign1, options?: CBOR.CodecOptions) => string

Added in v2.0.0

Model

COSESign1 (class)

COSE_Sign1 structure (RFC 8152) - signed message.

Signature

export declare class COSESign1

Added in v2.0.0

fromUserFacingEncoding (static method)

Parse from user-facing encoding format (cms_<base64url>).

Signature

static fromUserFacingEncoding(encoded: string): COSESign1

Added in v2.0.0

toJSON (method)

Signature

toJSON()

toString (method)

Signature

toString(): string

[Inspectable.NodeInspectSymbol] (method)

Signature

[Inspectable.NodeInspectSymbol](): unknown

[Equal.symbol] (method)

Signature

[Equal.symbol](that: unknown): boolean

[Hash.symbol] (method)

Signature

[Hash.symbol](): number

signedData (method)

Get the signed data (Sig_structure as per RFC 8152).

Signature

signedData(externalAad: Uint8Array = new Uint8Array(), externalPayload?: Uint8Array): Uint8Array

Added in v2.0.0

toUserFacingEncoding (method)

Convert to user-facing encoding format (cms_<base64url>). Includes checksum for data integrity verification.

Signature

toUserFacingEncoding(): string

Added in v2.0.0

COSESign1Builder (class)

Builder for creating COSE_Sign1 structures.

Signature

export declare class COSESign1Builder

Added in v2.0.0

toJSON (method)

Signature

toJSON()

toString (method)

Signature

toString(): string

[Inspectable.NodeInspectSymbol] (method)

Signature

[Inspectable.NodeInspectSymbol](): unknown

[Equal.symbol] (method)

Signature

[Equal.symbol](that: unknown): boolean

[Hash.symbol] (method)

Signature

[Hash.symbol](): number

setExternalAad (method)

Set external additional authenticated data.

Signature

setExternalAad(aad: Uint8Array): this

Added in v2.0.0

hashPayloadWith224 (method)

Hash the payload with blake2b-224 and update headers. Sets the "hashed" header to true in unprotected headers.

Signature

hashPayloadWith224(): this

Added in v2.0.0

makeDataToSign (method)

Create the data that needs to be signed (Sig_structure).

Signature

makeDataToSign(): Uint8Array

Added in v2.0.0

build (method)

Build the final COSESign1 structure with the provided signature.

Signature

build(signature: Ed25519Signature.Ed25519Signature): COSESign1

Added in v2.0.0

Schemas

COSESign1FromCBORBytes

CBOR bytes transformation schema for COSESign1.

Signature

export declare const COSESign1FromCBORBytes: (
  options?: CBOR.CodecOptions
) => Schema.transformOrFail<
  Schema.transformOrFail<
    typeof Schema.Uint8ArrayFromSelf,
    Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
    never
  >,
  Schema.SchemaClass<COSESign1, COSESign1, never>,
  never
>

Added in v2.0.0

COSESign1FromCBORHex

CBOR hex transformation schema for COSESign1.

Signature

export declare const COSESign1FromCBORHex: (
  options?: CBOR.CodecOptions
) => Schema.transform<
  Schema.Schema<Uint8Array, string, never>,
  Schema.transformOrFail<
    Schema.transformOrFail<
      typeof Schema.Uint8ArrayFromSelf,
      Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
      never
    >,
    Schema.SchemaClass<COSESign1, COSESign1, never>,
    never
  >
>

Added in v2.0.0