libp2p/crypto/secp

    Dark Mode
Search:
Group by:
  Source   Edit

Types

SkKeyPair = distinct secp256k1.SkKeyPair
  Source   Edit
SkPrivateKey = distinct secp256k1.SkSecretKey
  Source   Edit
SkPublicKey = distinct secp256k1.SkPublicKey
  Source   Edit
SkSignature = distinct secp256k1.SkSignature
  Source   Edit

Consts

SkRawPrivateKeySize = 32
Size of private key in octets (bytes)   Source   Edit
SkRawPublicKeySize = 33
Size of public key in octets (bytes)   Source   Edit
SkRawSignatureSize = 65
Size of signature in octets (bytes)   Source   Edit

Procs

func `$`(key: SkKeyPair): string {....raises: [], tags: [].}
  Source   Edit
func `$`(key: SkPrivateKey): string {....raises: [], tags: [].}
  Source   Edit
func `$`(key: SkPublicKey): string {....raises: [], tags: [].}
  Source   Edit
func `$`(key: SkSignature): string {....raises: [], tags: [].}
  Source   Edit
func `==`(a, b: SkKeyPair): bool {....raises: [], tags: [].}
  Source   Edit
func `==`(a, b: SkPrivateKey): bool {....raises: [], tags: [].}
  Source   Edit
func `==`(a, b: SkPublicKey): bool {....raises: [], tags: [].}
  Source   Edit
func `==`(a, b: SkSignature): bool {....raises: [], tags: [].}
  Source   Edit
func clear(key: var SkPrivateKey) {....raises: [], tags: [].}
  Source   Edit
proc getBytes(key: SkPrivateKey): seq[byte] {.inline, ...raises: [], tags: [].}
Serialize Secp256k1 private key and return it.   Source   Edit
proc getBytes(key: SkPublicKey): seq[byte] {.inline, ...raises: [], tags: [].}
Serialize Secp256k1 public key and return it.   Source   Edit
proc getBytes(sig: SkSignature): seq[byte] {.inline, ...raises: [], tags: [].}
Serialize Secp256k1 signature and return it.   Source   Edit
proc getPublicKey(key: SkPrivateKey): SkPublicKey {....raises: [], tags: [].}
Calculate and return Secp256k1 public key from private key key.   Source   Edit
proc init(key: var SkPrivateKey; data: openArray[byte]): SkResult[void] {.
    ...raises: [], tags: [].}
Initialize Secp256k1 private key key from raw binary representation data.   Source   Edit
proc init(key: var SkPrivateKey; data: string): SkResult[void] {....raises: [],
    tags: [].}
Initialize Secp256k1 private key key from hexadecimal string representation data.   Source   Edit
proc init(key: var SkPublicKey; data: openArray[byte]): SkResult[void] {.
    ...raises: [], tags: [].}
Initialize Secp256k1 public key key from raw binary representation data.   Source   Edit
proc init(key: var SkPublicKey; data: string): SkResult[void] {....raises: [],
    tags: [].}
Initialize Secp256k1 public key key from hexadecimal string representation data.   Source   Edit
proc init(sig: var SkSignature; data: openArray[byte]): SkResult[void] {.
    ...raises: [], tags: [].}
Initialize Secp256k1 signature sig from raw binary representation data.   Source   Edit
proc init(sig: var SkSignature; data: string): SkResult[void] {....raises: [],
    tags: [].}
Initialize Secp256k1 signature sig from hexadecimal string representation data.   Source   Edit
proc init(t: typedesc[SkPrivateKey]; data: openArray[byte]): SkResult[
    SkPrivateKey] {....raises: [].}

Initialize Secp256k1 private key from raw binary representation data.

Procedure returns private key on success.

  Source   Edit
proc init(t: typedesc[SkPrivateKey]; data: string): SkResult[SkPrivateKey] {.
    ...raises: [].}

Initialize Secp256k1 private key from hexadecimal string representation data.

Procedure returns private key on success.

  Source   Edit
proc init(t: typedesc[SkPublicKey]; data: openArray[byte]): SkResult[SkPublicKey] {.
    ...raises: [].}

Initialize Secp256k1 public key from raw binary representation data.

Procedure returns public key on success.

  Source   Edit
proc init(t: typedesc[SkPublicKey]; data: string): SkResult[SkPublicKey] {.
    ...raises: [].}

Initialize Secp256k1 public key from hexadecimal string representation data.

Procedure returns public key on success.

  Source   Edit
proc init(t: typedesc[SkSignature]; data: openArray[byte]): SkResult[SkSignature] {.
    ...raises: [].}

Initialize Secp256k1 signature from raw binary representation data.

Procedure returns signature on success.

  Source   Edit
proc init(t: typedesc[SkSignature]; data: string): SkResult[SkSignature] {.
    ...raises: [].}

Initialize Secp256k1 signature from hexadecimal string representation data.

Procedure returns signature on success.

  Source   Edit
proc random(t: typedesc[SkKeyPair]; rng: rng.Rng): SkKeyPair {....raises: [].}
  Source   Edit
proc random(t: typedesc[SkPrivateKey]; rng: rng.Rng): SkPrivateKey {....raises: [].}
  Source   Edit
proc sign[T: byte | char](key: SkPrivateKey; msg: openArray[T]): SkSignature {.
    ...raises: [].}
Sign message msg using private key key and return signature object.   Source   Edit
proc toBytes(key: SkPrivateKey; data: var openArray[byte]): SkResult[int] {.
    ...raises: [], tags: [].}

Serialize Secp256k1 private key key to raw binary form and store it to data.

Procedure returns number of bytes (octets) needed to store Secp256k1 private key.

  Source   Edit
proc toBytes(key: SkPublicKey; data: var openArray[byte]): SkResult[int] {.
    ...raises: [], tags: [].}

Serialize Secp256k1 public key key to raw binary form and store it to data.

Procedure returns number of bytes (octets) needed to store Secp256k1 public key.

  Source   Edit
proc toBytes(sig: SkSignature; data: var openArray[byte]): int {....raises: [],
    tags: [].}

Serialize Secp256k1 signature sig to raw binary form and store it to data.

Procedure returns number of bytes (octets) needed to store Secp256k1 signature.

  Source   Edit
proc verify[T: byte | char](sig: SkSignature; msg: openArray[T];
                            key: SkPublicKey): bool {....raises: [].}
  Source   Edit

Templates

template pubkey(v: SkKeyPair): SkPublicKey
  Source   Edit
template seckey(v: SkKeyPair): SkPrivateKey
  Source   Edit