Documentation
¶
Overview ¶
Package sigs dispatches Filecoin signature verification to the appropriate backend by signature type: BLS (BLS12-381), secp256k1, or delegated (Ethereum f4 addresses).
The interface mirrors Lotus' lib/sigs/sigs.go so wallet and chain validation code can be ported with minimal churn. Each backend lives in a subpackage (bls, secp, delegated) that registers itself via init() with the dispatcher.
Unlike Lotus, the BLS backend here is pure Go (gnark-crypto), so the entire crypto/sigs tree builds with CGO_ENABLED=0.
Copied from github.com/filecoin-project/lotus/lib/sigs/sigs.go at commit a0ecb8687f1c60d5e66040b6de364dbc9cc4d253. See LICENSE.
Modifications:
- import path for chain/types updated to github.com/Reiers/lantern/chain/types
- go.opencensus.io/trace usage stripped (we don't ship opencensus)
Index ¶
- func CheckBlockSignature(ctx context.Context, blk *types.BlockHeader, worker address.Address) error
- func Generate(sigType crypto.SigType) ([]byte, error)
- func RegisterSignature(typ crypto.SigType, vs SigShim)
- func Sign(sigType crypto.SigType, privkey []byte, msg []byte) (*crypto.Signature, error)
- func ToPublic(sigType crypto.SigType, pk []byte) ([]byte, error)
- func Verify(sig *crypto.Signature, addr address.Address, msg []byte) error
- type SigShim
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckBlockSignature ¶
CheckBlockSignature verifies the BlockSig field of a BlockHeader against the expected worker address. Mirrors the Lotus helper of the same name (minus opencensus tracing, which Lantern does not ship).
func RegisterSignature ¶
RegisterSignature should be only used during init
func Sign ¶
Sign takes in signature type, private key and message. Returns a signature for that message. Valid sigTypes are: "secp256k1" and "bls"
Types ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bls implements Filecoin BLS12-381 signature verification using github.com/consensys/gnark-crypto/ecc/bls12-381.
|
Package bls implements Filecoin BLS12-381 signature verification using github.com/consensys/gnark-crypto/ecc/bls12-381. |
|
Package delegated implements verification for Filecoin "delegated" (f4) signatures: Ethereum-style secp256k1 over Keccak-256 of an RLP-encoded payload.
|
Package delegated implements verification for Filecoin "delegated" (f4) signatures: Ethereum-style secp256k1 over Keccak-256 of an RLP-encoded payload. |
|
Package secp implements Filecoin secp256k1 signature verification.
|
Package secp implements Filecoin secp256k1 signature verification. |