crypto

package module
v0.0.0-...-72bc2f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

README

Mailchain - Crypto

Mailchain

Mailchain is a multi-chain communication protocol that helps you communicate with your users across any protocol. It provides end-to-end encryption by default, and supports 1:1, 1:many and group messaging.

Using Mailchain you can easily send messages to any blockchain address on different protocols.

Crypto

Mailchain supports messaging across multiple chains. Each blockchain protocol uses a predefined elliptic curve usage. Mailchain needs to support signatures and encryption for all blockchain protocols. This repository contains Mailchain crypto functionality.

Find out more

We'd ❤ for you to join our growing community and get involved.

Follow @mailchain_xyz on Twitter to hear about new releases and updates.

Other channels to reach us can be found here: https://docs.mailchain.com/getting-help/.

License

Copyright 2022, Mailchain Ltd. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

View Source
const (
	// KindSECP256K1 string identifier for secp256k1 keys.
	KindSECP256K1 = "secp256k1"
	// KindSECP256R1 string identifier for secp256r1 keys.
	KindSECP256R1 = "secp256r1"
	// KindED25519 string identifier for ed25519 keys.
	KindED25519 = "ed25519"
	// KindSR25519 string identifier for sr25519 keys.
	KindSR25519 = "sr25519"
)
View Source
const (
	// IDUnknown byte identifier for unknown keys.
	IDUnknown = 0x0
	// IDSECP256K1 byte identifier for secp256k1 keys.
	IDSECP256K1 = 0xe1
	// IDED25519 byte identifier for ed25519 keys.
	IDED25519 = 0xe2
	// IDSR25519 byte identifier for sr25519 keys.
	IDSR25519 = 0xe3
	// IDSECP256R1 Id identifier for secp256r1 keys.
	IDSECP256R1 = 0xe4
	// IDNonSpecified Id identifier for non specified secret keys.
	IDNonSpecified = 0xee
)

Variables

Functions

func KeyTypes

func KeyTypes() map[string]bool

KeyTypes available key types.

Types

type ExtendedPrivateKey

type ExtendedPrivateKey interface {
	Bytes() []byte
	PrivateKey() PrivateKey
	Derive(index uint32) (ExtendedPrivateKey, error)
	ExtendedPublicKey() (ExtendedPublicKey, error)
}

type ExtendedPublicKey

type ExtendedPublicKey interface {
	Bytes() []byte
	PublicKey() PublicKey
	Derive(index uint32) (ExtendedPublicKey, error)
}

type PrivateKey

type PrivateKey interface {
	// Bytes returns the byte representation of the private key
	Bytes() []byte
	// PublicKey from the PrivateKey
	PublicKey() PublicKey
	// Sign signs the message with the key and returns the signature.
	Sign(message []byte) ([]byte, error)
}

PrivateKey definition usable in all mailchain crypto operations

type PublicKey

type PublicKey interface {
	// Bytes returns the raw bytes representation of the public key.
	//
	// The returned bytes are used for encrypting, verifying a signature, and locating an address.
	Bytes() []byte
	// Verify verifies whether sig is a valid signature of message.
	Verify(message, sig []byte) bool
}

PublicKey definition usable in all mailchain crypto operations

Directories

Path Synopsis
Package cipher collects common cryptographic constants and interfaces.
Package cipher collects common cryptographic constants and interfaces.
aes256cbc
Package aes256cbc implements Advanced Encryption Standard with a 256 bit key length, using Chain Block Cipher mode (AES-256-CBC).
Package aes256cbc implements Advanced Encryption Standard with a 256 bit key length, using Chain Block Cipher mode (AES-256-CBC).
ciphertest
Package ciphertest is a generated GoMock package.
Package ciphertest is a generated GoMock package.
ecdh
Package ecdh has implementations for different asymmetric key exchange.
Package ecdh has implementations for different asymmetric key exchange.
noop
Package noop is a no operation encryption algorithm for use when the message is intended to be publically readable.
Package noop is a no operation encryption algorithm for use when the message is intended to be publically readable.
Package cryptotest is a generated GoMock package.
Package cryptotest is a generated GoMock package.
internal
secp256k1test
Package secp256k1test contains keys that are used to ease testing of Mailchain functionality.
Package secp256k1test contains keys that are used to ease testing of Mailchain functionality.
secp256r1test
Package secp256k1test contains keys that are used to ease testing of Mailchain functionality.
Package secp256k1test contains keys that are used to ease testing of Mailchain functionality.
sr25519test
Package sr25519test contains keys that are used to ease testing of Mailchain functionality.
Package sr25519test contains keys that are used to ease testing of Mailchain functionality.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL