Skip to content

Commit

Permalink
add credential api (#114)
Browse files Browse the repository at this point in the history
* add claim api

* update

* update claim

* update

* add jwt

* rename from claim to credential

* update

* update

* update gas price
  • Loading branch information
siovanus committed Jul 2, 2020
1 parent 0c08928 commit a3cd172
Show file tree
Hide file tree
Showing 12 changed files with 1,848 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cscope*
vendor/*
glide.lock
.idea/
.idea/
wallet.dat
106 changes: 106 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,112 @@ ontSdk.Native.OntId.GetDocumentJson(ontId string) ([]byte, error)
```
`ontId`: ONT ID

### 2.6 Credential API

#### 2.6.1 GenSignReq

```
ontSdk.Credential.GenSignReq(credentialSubject interface{}, ontId string, signer *Account) (*Request, error)
```
`credentialSubject`: [credentialSubject of Credential](https://www.w3.org/TR/vc-data-model/#credential-subject)

`ontId`: holder ONT ID

`signer`: signer account

#### 2.6.2 VerifySignReq

```
ontSdk.Credential.VerifySignReq(request *Request) error
```
`request`: result of GenSignReq

#### 2.6.3 CreateCredential

```
ontSdk.Credential.CreateCredential(contexts []string, types []string, credentialSubject interface{}, issuerId string, expirationDateTimestamp int64, signer *Account) (*VerifiableCredential, uint32, error)
```
`contexts`: [definition](https://www.w3.org/TR/vc-data-model/#contexts)

`types`: [definition](https://www.w3.org/TR/vc-data-model/#types)

`credentialSubject`: [credentialSubject of Credential](https://www.w3.org/TR/vc-data-model/#credential-subject)

`issuerId`: ONT ID of issuer

`expirationDateTimestamp`: unix of expiration date timestamp

`signer`: signer account

#### 2.6.4 CommitCredential

```
ontSdk.Credential.CommitCredential(gasPrice, gasLimit uint64, credentialId, issuerId, holderId string, index uint32, signer, payer *Account) (common.Uint256, error)
```
`credentialId`: Id of credential

`issuerId`: ONT ID of issuer

`holderId`: ONT ID of holder

`index`: key index of issuer used to sign tx

`signer`: signer account

#### 2.6.5 VerifyCredibleOntId

```
ontSdk.Credential.VerifyCredibleOntId(credibleOntIds []string, credential *VerifiableCredential) error
```
`credibleOntIds`: credible ONT ID list

`credential`: [definition](https://www.w3.org/TR/vc-data-model/)

#### 2.6.6 VerifyNotExpired

```
ontSdk.Credential.VerifyNotExpired(credential *VerifiableCredential) error
```
`credential`: [definition](https://www.w3.org/TR/vc-data-model/)

#### 2.6.7 VerifyIssuerSignature

```
ontSdk.Credential.VerifyIssuerSignature(credential *VerifiableCredential) error
```
`credential`: [definition](https://www.w3.org/TR/vc-data-model/)

#### 2.6.8 VerifyStatus

```
ontSdk.Credential.VerifyStatus(credential *VerifiableCredential) error
```
`credential`: [definition](https://www.w3.org/TR/vc-data-model/)

#### 2.6.9 CreatePresentation

```
ontSdk.Credential.CreatePresentation(credentials []*VerifiableCredential, contexts, types []string, holder string, signers []*Account) (*Presentation, error)
```
`credentials`: credential list

`contexts`: [definition](https://www.w3.org/TR/vc-data-model/#contexts)

`types`: [definition](https://www.w3.org/TR/vc-data-model/#types)

`holder`: ONTID of holder

`signers`: signer accounts

#### 2.6.10 VerifyPresentation

```
ontSdk.Credential.VerifyPresentation(presentation *Presentation, credibleOntIds []string) error
```
`presentation`: [definition](https://www.w3.org/TR/vc-data-model/#presentations-0)

`credibleOntIds`: credible ONT ID list

# Contributing

Can I contribute patches to the Ontology project?
Expand Down
Loading

0 comments on commit a3cd172

Please sign in to comment.