Skip to content

Commit

Permalink
fix README, add license tags, fix CI action
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Huseby <[email protected]>
  • Loading branch information
dhuseby committed Apr 7, 2024
1 parent 4dbfde8 commit 967e817
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
Expand Down
82 changes: 42 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Multisig
[![](https://img.shields.io/badge/made%20by-Cryptid%20Technologies-gold.svg?style=flat-square)][CRYPTID]
[![](https://img.shields.io/badge/project-provenance-purple.svg?style=flat-square)][PROVENANCE]
[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)][MULTIFORMATS]
![](https://github.com/cryptidtech/multicid/actions/workflows/rust.yml/badge.svg)

[![](https://img.shields.io/badge/made%20by-Cryptid%20Technologies-gold.svg?style=flat-square)][0]
[![](https://img.shields.io/badge/project-provenance-purple.svg?style=flat-square)][1]
[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)][2]
# Multisig

A Rust implementation of the [multiformats][2] [multisig specification][3].
A Rust implementation of the [multiformats][MULTIFORMATS] [multisig specification][MULTISIG].

## Current Status

Expand All @@ -17,14 +18,15 @@ It currently supports the following digital signature protocols.
The BLS curve implementation also supports threshold signatures.

This crate also supports converting to/from SSH format digital signatures using
the [`ssh-key`][4] crate. This gives full OpenSSH compatibility for reading in
OpenSSH serialized signatures and converting them to Multisig format. This even
includes non-standard SSH key protocols such as Es256K and BBLS12-381 G1/G2
signatures through the use of [RFC 4251][5] standard for "additional
algorithms" names using the "@multisig" domain suffix. For instance, using this
crate, an Es256K Multisig converted to an SSH format signature has the
algorithm name "secp256k1@multisig". A BLS12-381 G1 signature share converted
to SSH format has the algorithm name "bls12_381-g1-share@multsig".
the [`ssh-key`][SSHKEY] crate. This gives full OpenSSH compatibility for
reading in OpenSSH serialized signatures and converting them to Multisig
format. This even includes non-standard SSH key protocols such as Es256K and
BBLS12-381 G1/G2 signatures through the use of [RFC 4251][RFC4251] standard for
"additional algorithms" names using the "@multisig" domain suffix. For
instance, using this crate, an Es256K Multisig converted to an SSH format
signature has the algorithm name "secp256k1@multisig". A BLS12-381 G1 signature
share converted to SSH format has the algorithm name
"bls12_381-g1-share@multsig".

## Introduction

Expand All @@ -43,21 +45,21 @@ needed.
The only operations that can be executed on a Multisig object are those that
return the attribute data and the threshold signature operations for
accumulating and combining signature shares. Any operation that involves a
cryptographic key (e.g. signing, verifying) is found in the [`Multikey`][6]
companion crate.
cryptographic key (e.g. signing, verifying) is found in the
[`Multikey`][MULTIKEY] companion crate.

## Views on the Multisig Data

To provide an abstract interface to digital signatures of all schemes and
formats, this Multisig crate provides "views" on the Multisig data. These are
read-only abstract interfaces to the Multisig that have implementations for
the different supporting signature protocols.
To provide an abstract interface to digital signatures of all schemes and
formats, this Multisig crate provides "views" on the Multisig data. These are
read-only abstract interfaces to the Multisig that have implementations for the
different supporting signature protocols.

Currently the set of views provide generic access to the "payload encoding"
codec (`multisig::AttrView`), the signature data (`multisig::SigDataView`),
the threshold signing attributes if the protocol supports it
(`multisig::ThresholdAttrView`) and the interface for doing threshold signature
operations such as accessing and adding shares as well as combining shares
codec (`multisig::AttrView`), the signature data (`multisig::SigDataView`), the
threshold signing attributes if the protocol supports it
(`multisig::ThresholdAttrView`) and the interface for doing threshold signature
operations such as accessing and adding shares as well as combining shares
(`multisig::ThresholdView`).

It is important to note that the functions in the various views that seem to
Expand All @@ -82,9 +84,9 @@ for share in &shares {
### What about Varsig?

There already exists a multicodec signature format called Varsig but it has
some serious deficiencies in design. Here is the Varsig ["spec"][7]. The
greatest failing of Varsig is that it fails to meet [the requirements][8] for
all Multicodec data types:
some serious deficiencies in design. Here is the Varsig ["spec"][VARSIG]. The
greatest failing of Varsig is that it fails to meet [the
requirements][WHATAREMULTIFORMATS] for all Multicodec data types:

* They MUST be in-band (with the value); not out-of-band (in context).
* They MUST avoid lock-in and promote extensibility.
Expand Down Expand Up @@ -119,22 +121,22 @@ sigil signature specific of signature data
values octets
```

The Varsig format unfortunately has a variable number of signature-specific
The Varsig format unfortunately has a variable number of signature-specific
values immediately following the key codec and before the encoding codec. This
makes it impossible for a tool to decode the encoding codec when it doesn't
recognize the key codec. Since there are no counts or lengths encoded in the
recognize the key codec. Since there are no counts or lengths encoded in the
Varsig data, it is impossible to know the full length of any Varsig without
having complete support for every key codec. Multisig format seeks to fix that
by adding counts for the variable number of varuints and a length to the
variable number of octets (i.e. [`Varbytes`][9]).

[0]: https://cryptid.tech
[1]: https://github.com/cryptidtech/provenance-specifications/
[2]: https://github.com/multiformats/multiformats
[3]: https://github.com/cryptidtech/provenance-specifications/blob/main/specifications/multisig.md
[4]: https://crates.io/crates/ssh-key
[5]: https://www.rfc-editor.org/rfc/rfc4251.html#page-11
[6]: https://github.com/cryptidtech/multikey.git
[7]: https://github.com/ChainAgnostic/varsig
[8]: https://multiformats.io/#what-are-multiformats
[9]: https://github.com/cryptidtech/multiutil/blob/main/src/varbytes.rs
variable number of octets (i.e. [`Varbytes`][VARBYTES]).

[CRYPTID]: https://cryptid.tech
[PROVENANCE]: https://github.com/cryptidtech/provenance-specifications/
[MULTIFORMATS]: https://github.com/multiformats/multiformats
[MULTISIG]: https://github.com/cryptidtech/provenance-specifications/blob/main/specifications/multisig.md
[SSHKEY]: https://crates.io/crates/ssh-key
[RFC4251]: https://www.rfc-editor.org/rfc/rfc4251.html#page-11
[MULTIKEY]: https://github.com/cryptidtech/multikey.git
[VARSIG]: https://github.com/ChainAgnostic/varsig
[WHATAREMULTIFORMATS]: https://multiformats.io/#what-are-multiformats
[VARBYTES]: https://github.com/cryptidtech/multiutil/blob/main/src/varbytes.rs
1 change: 1 addition & 0 deletions src/attrid.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{error::AttributesError, Error};
use multitrait::{EncodeInto, TryDecodeFrom};
use std::fmt;
Expand Down
1 change: 1 addition & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
/// Errors created by this library
#[derive(Clone, Debug, thiserror::Error)]
#[non_exhaustive]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
//!
#![warn(missing_docs)]
#![deny(
Expand Down
1 change: 1 addition & 0 deletions src/ms.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{
error::AttributesError,
views::{
Expand Down
1 change: 1 addition & 0 deletions src/serde/de.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{
ms::{self, Attributes},
AttrId, Multisig,
Expand Down
1 change: 1 addition & 0 deletions src/serde/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
//! Serde (de)serialization for [`crate::Varsig`].
mod de;
mod ser;
Expand Down
1 change: 1 addition & 0 deletions src/serde/ser.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{ms, AttrId, Multisig};
use multiutil::{EncodedVarbytes, EncodingInfo, Varbytes};
use serde::ser::{self, SerializeStruct};
Expand Down
1 change: 1 addition & 0 deletions src/views.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{Error, Multisig};
use multicodec::Codec;

Expand Down
1 change: 1 addition & 0 deletions src/views/bls12381.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{
error::{AttributesError, ConversionsError, SharesError},
AttrId, AttrView, Builder, ConvView, DataView, Error, Multisig, ThresholdAttrView,
Expand Down
1 change: 1 addition & 0 deletions src/views/ed25519.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{
error::{AttributesError, ConversionsError},
AttrId, AttrView, ConvView, DataView, Error, Multisig, Views,
Expand Down
1 change: 1 addition & 0 deletions src/views/secp256k1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Idnetifier: Apache-2.0
use crate::{
error::{AttributesError, ConversionsError},
AttrId, AttrView, ConvView, DataView, Error, Multisig, Views,
Expand Down

0 comments on commit 967e817

Please sign in to comment.