Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Mar 28, 2017
1 parent 8929240 commit a95040e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ Precompiled binary wheels is available for Python 2.7, 3.3, 3.4, and 3.5 on Linu

## API

#### class `secp256k1.PrivateKey(privkey, raw, flags)`
#### class `coincurve.PrivateKey(privkey, raw, flags)`

The `PrivateKey` class loads or creates a private key by obtaining 32 bytes from urandom and operates over it.

##### Instantiation parameters

- `privkey=None` - generate a new private key if None, otherwise load a private key.
- `raw=True` - if `True`, it is assumed that `privkey` is just a sequence of bytes, otherwise it is assumed that it is in the DER format. This is not used when `privkey` is not specified.
- `flags=secp256k1.ALL_FLAGS` - see Constants.
- `flags=coincurve.ALL_FLAGS` - see Constants.

##### Methods and instance attributes

- `pubkey`: an instance of `secp256k1.PublicKey`.
- `pubkey`: an instance of `coincurve.PublicKey`.
- `private_key`: raw bytes for the private key.

- `set_raw_privkey(privkey)`<br/>
Expand Down Expand Up @@ -78,15 +78,15 @@ To combine pubnonces, use `PublicKey.combine`.<br/><br/>
Do not pass the pubnonce produced for the respective privnonce; combine the pubnonces from other signers and pass that instead.


#### class `secp256k1.PublicKey(pubkey, raw, flags)`
#### class `coincurve.PublicKey(pubkey, raw, flags)`

The `PublicKey` class loads an existing public key and operates over it.

##### Instantiation parameters

- `pubkey=None` - do not load a public key if None, otherwise do.
- `raw=False` - if `False`, it is assumed that `pubkey` has gone through `PublicKey.deserialize` already, otherwise it must be specified as bytes.
- `flags=secp256k1.FLAG_VERIFY` - see Constants.
- `flags=coincurve.FLAG_VERIFY` - see Constants.

##### Methods and instance attributes

Expand Down Expand Up @@ -119,9 +119,9 @@ compute an EC Diffie-Hellman secret in constant time. The instance `public_key`
> NOTE: `ecdh` can only be used if the `secp256k1` C library is compiled with support for it. If there is no support, an Exception will be raised when calling it.

#### class `secp256k1.ECDSA`
#### class `coincurve.ECDSA`

The `ECDSA` class is intended to be used as a mix in. Its methods can be accessed from any `secp256k1.PrivateKey` or `secp256k1.PublicKey` instances.
The `ECDSA` class is intended to be used as a mix in. Its methods can be accessed from any `coincurve.PrivateKey` or `coincurve.PublicKey` instances.

##### Methods

Expand All @@ -143,7 +143,7 @@ This function always return a tuple containing a boolean (True if not previously

- `ecdsa_recover(msg, recover_sig, raw=False, digest=hashlib.sha256)` -> internal object<br/>
recover an ECDSA public key from a signature generated by `ecdsa_sign_recoverable`. `recover_sig` is expected to be an object returned from `ecdsa_sign_recoverable` (or if it was serialized using `ecdsa_recoverable_serialize`, then first run it through `ecdsa_recoverable_deserialize`). `msg`, `raw`, and `digest` are used as described in `ecdsa_sign`.<br/><br/>
In order to call `ecdsa_recover` from a `PublicKey` instance, it's necessary to create the instance by settings `flags` to `ALL_FLAGS`: `secp256k1.PublicKey(..., flags=secp256k1.ALL_FLAGS)`.
In order to call `ecdsa_recover` from a `PublicKey` instance, it's necessary to create the instance by settings `flags` to `ALL_FLAGS`: `coincurve.PublicKey(..., flags=coincurve.ALL_FLAGS)`.

- `ecdsa_recoverable_serialize(recover_sig)` -> (bytes, int)<br/>
convert the result from `ecdsa_sign_recoverable` to a tuple composed of 65 bytesand an integer denominated as recovery id.
Expand All @@ -159,9 +159,9 @@ convert a recoverable signature to a normal signature, i.e. one that can be used

#### Constants

##### `secp256k1.FLAG_SIGN`
##### `secp256k1.FLAG_VERIFY`
##### `secp256k1.ALL_FLAGS`
##### `coincurve.FLAG_SIGN`
##### `coincurve.FLAG_VERIFY`
##### `coincurve.ALL_FLAGS`

`ALL_FLAGS` combines `FLAG_SIGN` and `FLAG_VERIFY` using bitwise OR.

Expand Down

0 comments on commit a95040e

Please sign in to comment.