Skip to content

Commit

Permalink
Merge pull request #21 from coinbase/patrick/construction-api
Browse files Browse the repository at this point in the history
Add Construction API (formerly Wallet API)
  • Loading branch information
patrick-ogrady authored Jun 26, 2020
2 parents 439b881 + bae09da commit 671d8df
Show file tree
Hide file tree
Showing 9 changed files with 1,354 additions and 45 deletions.
232 changes: 224 additions & 8 deletions README.md

Large diffs are not rendered by default.

589 changes: 569 additions & 20 deletions api.json

Large diffs are not rendered by default.

426 changes: 409 additions & 17 deletions api.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ OUTPUT_FILE=api.json
swagger-cli bundle api.yaml -o "${OUTPUT_FILE}";

# Remove newlines from descriptions
sed "${SED_IFLAG[@]}" 's/\\n\\n/\\n/g' "${OUTPUT_FILE}";
sed "${SED_IFLAG[@]}" 's/\\n/ /g' "${OUTPUT_FILE}";
sed "${SED_IFLAG[@]}" 's/ "/"/g' "${OUTPUT_FILE}";
23 changes: 23 additions & 0 deletions models/CurveType.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2020 Coinbase, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file 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.

description: |
CurveType is the type of cryptographic curve associated with a PublicKey.
* secp256k1 = SEC compressed 33-bytes.
* edwards25519 = y (255-bits) || x-sign-bit (32-bytes).
type: string
enum:
- secp256k1
- edwards25519
32 changes: 32 additions & 0 deletions models/PublicKey.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2020 Coinbase, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file 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.

description: |
PublicKey contains a public key byte array
for a particular CurveType encoded in hex.
Note that there is no PrivateKey struct as this
is NEVER the concern of an implementation.
type: object
required:
- hex_bytes
- curve_type
properties:
hex_bytes:
type: string
description: |
Hex-encoded public key bytes in the format
specified by the CurveType.
curve_type:
$ref: "CurveType.yaml"
36 changes: 36 additions & 0 deletions models/Signature.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2020 Coinbase, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file 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.

description: |
Signature contains the payload that was signed, the public keys of the
keypairs used to produce the signature, the signature (encoded in hex),
and the SignatureType.
PublicKey is often times not known during construction of the signing payloads
but may be needed to combine signatures properly.
type: object
required:
- signing_payload
- public_key
- signature_type
- hex_bytes
properties:
signing_payload:
$ref: "SigningPayload.yaml"
public_key:
$ref: "PublicKey.yaml"
signature_type:
$ref: "SignatureType.yaml"
hex_bytes:
type: string
25 changes: 25 additions & 0 deletions models/SignatureType.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 Coinbase, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file 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.

description: |
SignatureType is the type of a cryptographic signature.
* ecdsa = r (32-bytes) || s (32-bytes)
* ecdsa_recovery = r (32-bytes) || s (32-bytes) || v (1-byte)
* ed25519 = R (32-byte) || s (32-bytes)
type: string
enum:
- ecdsa
- ecdsa_recovery
- ed25519
35 changes: 35 additions & 0 deletions models/SigningPayload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2020 Coinbase, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file 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.

description: |
SigningPayload is signed by the client with the keypair associated
with an address using the specified SignatureType.
SignatureType can be optionally populated if there is
a restriction on the signature scheme that can be
used to sign the payload.
type: object
required:
- address
- hex_bytes
properties:
address:
type: string
description: |
The network-specific address of the account that should sign
the payload.
hex_bytes:
type: string
signature_type:
$ref: "SignatureType.yaml"

0 comments on commit 671d8df

Please sign in to comment.