Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .changeset/cold-cows-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
"@evolution-sdk/evolution": minor
---

Add CIP-30 message signing support with modular architecture

This release introduces comprehensive CIP-30 `signData` and `verifyData` support, implementing the complete COSE Sign1 specification with a clean, modular structure:

**New Features:**
- Full CIP-30 message signing (`signData`) and verification (`verifyData`) implementation
- COSE (CBOR Object Signing and Encryption) primitives per RFC 8152
- Support for Ed25519 signatures with proper COSE key structures
- Message hashing with BLAKE2b-256 for payload integrity
- CIP-8 compliant address field handling
- Complete test coverage with CSL compatibility tests

**Module Structure:**
- `message-signing/SignData.ts` - Main CIP-30 signData/verifyData API
- `message-signing/Header.ts` - COSE header structures and operations
- `message-signing/Label.ts` - COSE label types and algorithm identifiers
- `message-signing/CoseSign1.ts` - COSE_Sign1 structure implementation
- `message-signing/CoseKey.ts` - COSE key format support
- `message-signing/Ed25519Key.ts` - Ed25519 key operations
- `message-signing/Utils.ts` - Encoding and conversion utilities

**Breaking Changes:**
- Refactored `Bytes` module API:
- Renamed `bytesEquals` to `equals` with stricter type signature (no longer accepts undefined)
- Removed `Bytes.FromHex` schema in favor of Effect's built-in `Schema.Uint8ArrayFromHex`
- Updated `fromHex`/`toHex` to use Effect's native schemas

**Internal Improvements:**
- Removed unused `Bytes` imports across 32 files
- Updated all modules to use new Bytes API
- Improved CBOR encoding/decoding with proper codec options
- Enhanced type safety with Effect Schema compositions
12 changes: 7 additions & 5 deletions docs/content/docs/modules/core/Address.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Handles both BaseAddress (57 bytes) and EnterpriseAddress (29 bytes)

```ts
export declare const FromBytes: Schema.transformOrFail<
Schema.Union<[Schema.filter<typeof Schema.Uint8ArrayFromSelf>, Schema.filter<typeof Schema.Uint8ArrayFromSelf>]>,
Schema.Union<[Schema.SchemaClass<Uint8Array, Uint8Array, never>, Schema.SchemaClass<Uint8Array, Uint8Array, never>]>,
Schema.SchemaClass<Address, Address, never>,
never
>
Expand All @@ -163,9 +163,11 @@ Transform from hex string to AddressStructure

```ts
export declare const FromHex: Schema.transform<
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
Schema.Schema<Uint8Array, string, never>,
Schema.transformOrFail<
Schema.Union<[Schema.filter<typeof Schema.Uint8ArrayFromSelf>, Schema.filter<typeof Schema.Uint8ArrayFromSelf>]>,
Schema.Union<
[Schema.SchemaClass<Uint8Array, Uint8Array, never>, Schema.SchemaClass<Uint8Array, Uint8Array, never>]
>,
Schema.SchemaClass<Address, Address, never>,
never
>
Expand Down Expand Up @@ -219,7 +221,7 @@ Added in v1.0.0
**Signature**

```ts
export declare const fromBytes: (i: any, overrideOptions?: ParseOptions) => Address
export declare const fromBytes: (i: Uint8Array, overrideOptions?: ParseOptions) => Address
```

## fromHex
Expand All @@ -243,7 +245,7 @@ export declare const toBech32: (a: Address, overrideOptions?: ParseOptions) => s
**Signature**

```ts
export declare const toBytes: (a: Address, overrideOptions?: ParseOptions) => any
export declare const toBytes: (a: Address, overrideOptions?: ParseOptions) => Uint8Array
```

## toHex
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/core/AddressEras.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ Schema for encoding/decoding addresses as hex strings.

```ts
export declare const FromHex: Schema.transform<
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
Schema.Schema<Uint8Array, string, never>,
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Schema.SchemaClass<
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/core/Anchor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ CBOR hex transformation schema for Anchor.
export declare const FromCBORHex: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
Schema.Schema<Uint8Array, string, never>,
Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/core/Assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ CBOR hex transformation schema for Assets.
export declare const FromCBORHex: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
Schema.Schema<Uint8Array, string, never>,
Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/core/AuxiliaryData.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ Transforms between CBOR hex string and AuxiliaryData using CDDL format.
export declare const FromCBORHex: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
Schema.Schema<Uint8Array, string, never>,
Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Expand Down
8 changes: 4 additions & 4 deletions docs/content/docs/modules/core/BaseAddress.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Convert a BaseAddress to bytes.
**Signature**

```ts
export declare const toBytes: (data: BaseAddress) => any
export declare const toBytes: (data: BaseAddress) => Uint8Array
```

Added in v2.0.0
Expand Down Expand Up @@ -150,7 +150,7 @@ toString(): string

```ts
export declare const FromBytes: Schema.transformOrFail<
Schema.filter<typeof Schema.Uint8ArrayFromSelf>,
Schema.SchemaClass<Uint8Array, Uint8Array, never>,
Schema.SchemaClass<BaseAddress, BaseAddress, never>,
never
>
Expand All @@ -162,9 +162,9 @@ export declare const FromBytes: Schema.transformOrFail<

```ts
export declare const FromHex: Schema.transform<
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
Schema.Schema<Uint8Array, string, never>,
Schema.transformOrFail<
Schema.filter<typeof Schema.Uint8ArrayFromSelf>,
Schema.SchemaClass<Uint8Array, Uint8Array, never>,
Schema.SchemaClass<BaseAddress, BaseAddress, never>,
never
>
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/core/Bech32.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export declare const FromBytes: (
export declare const FromHex: (
prefix?: string
) => Schema.transform<
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
Schema.Schema<Uint8Array, string, never>,
Schema.transformOrFail<typeof Schema.Uint8ArrayFromSelf, typeof Schema.String, never>
>
```
15 changes: 9 additions & 6 deletions docs/content/docs/modules/core/Bip32PrivateKey.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Convert a Bip32PrivateKey to raw bytes.
**Signature**

```ts
export declare const toBytes: (a: Bip32PrivateKey, overrideOptions?: ParseOptions) => any
export declare const toBytes: (a: Bip32PrivateKey, overrideOptions?: ParseOptions) => Uint8Array
```

Added in v2.0.0
Expand Down Expand Up @@ -204,7 +204,7 @@ Parse a Bip32PrivateKey from raw bytes.
**Signature**

```ts
export declare const fromBytes: (i: any, overrideOptions?: ParseOptions) => Bip32PrivateKey
export declare const fromBytes: (i: Uint8Array, overrideOptions?: ParseOptions) => Bip32PrivateKey
```

Added in v2.0.0
Expand Down Expand Up @@ -285,8 +285,8 @@ Schema for transforming between Uint8Array and Bip32PrivateKey.

```ts
export declare const FromBytes: Schema.transform<
Schema.filter<typeof Schema.Uint8ArrayFromSelf>,
typeof Bip32PrivateKey
Schema.SchemaClass<Uint8Array, Uint8Array, never>,
Schema.SchemaClass<Bip32PrivateKey, Bip32PrivateKey, never>
>
```

Expand All @@ -300,8 +300,11 @@ Schema for transforming between hex string and Bip32PrivateKey.

```ts
export declare const FromHex: Schema.transform<
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
Schema.transform<Schema.filter<typeof Schema.Uint8ArrayFromSelf>, typeof Bip32PrivateKey>
Schema.filter<Schema.Schema<Uint8Array, string, never>>,
Schema.transform<
Schema.SchemaClass<Uint8Array, Uint8Array, never>,
Schema.SchemaClass<Bip32PrivateKey, Bip32PrivateKey, never>
>
>
```

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/core/BootstrapWitness.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Transforms between hex string and BootstrapWitness using CBOR encoding.
export declare const FromCBORHex: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
Schema.Schema<Uint8Array, string, never>,
Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/core/ByronAddress.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Schema for encoding/decoding Byron addresses as hex strings.

```ts
export declare const FromHex: Schema.transform<
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
Schema.Schema<Uint8Array, string, never>,
Schema.transformOrFail<typeof Schema.Uint8ArrayFromSelf, typeof ByronAddress, never>
>
```
Expand Down
Loading