Skip to content

Commit a3cd172

Browse files
authored
add credential api (#114)
* add claim api * update * update claim * update * add jwt * rename from claim to credential * update * update * update gas price
1 parent 0c08928 commit a3cd172

File tree

12 files changed

+1848
-19
lines changed

12 files changed

+1848
-19
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cscope*
22
vendor/*
33
glide.lock
4-
.idea/
4+
.idea/
5+
wallet.dat

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,112 @@ ontSdk.Native.OntId.GetDocumentJson(ontId string) ([]byte, error)
10551055
```
10561056
`ontId`: ONT ID
10571057

1058+
### 2.6 Credential API
1059+
1060+
#### 2.6.1 GenSignReq
1061+
1062+
```
1063+
ontSdk.Credential.GenSignReq(credentialSubject interface{}, ontId string, signer *Account) (*Request, error)
1064+
```
1065+
`credentialSubject`: [credentialSubject of Credential](https://www.w3.org/TR/vc-data-model/#credential-subject)
1066+
1067+
`ontId`: holder ONT ID
1068+
1069+
`signer`: signer account
1070+
1071+
#### 2.6.2 VerifySignReq
1072+
1073+
```
1074+
ontSdk.Credential.VerifySignReq(request *Request) error
1075+
```
1076+
`request`: result of GenSignReq
1077+
1078+
#### 2.6.3 CreateCredential
1079+
1080+
```
1081+
ontSdk.Credential.CreateCredential(contexts []string, types []string, credentialSubject interface{}, issuerId string, expirationDateTimestamp int64, signer *Account) (*VerifiableCredential, uint32, error)
1082+
```
1083+
`contexts`: [definition](https://www.w3.org/TR/vc-data-model/#contexts)
1084+
1085+
`types`: [definition](https://www.w3.org/TR/vc-data-model/#types)
1086+
1087+
`credentialSubject`: [credentialSubject of Credential](https://www.w3.org/TR/vc-data-model/#credential-subject)
1088+
1089+
`issuerId`: ONT ID of issuer
1090+
1091+
`expirationDateTimestamp`: unix of expiration date timestamp
1092+
1093+
`signer`: signer account
1094+
1095+
#### 2.6.4 CommitCredential
1096+
1097+
```
1098+
ontSdk.Credential.CommitCredential(gasPrice, gasLimit uint64, credentialId, issuerId, holderId string, index uint32, signer, payer *Account) (common.Uint256, error)
1099+
```
1100+
`credentialId`: Id of credential
1101+
1102+
`issuerId`: ONT ID of issuer
1103+
1104+
`holderId`: ONT ID of holder
1105+
1106+
`index`: key index of issuer used to sign tx
1107+
1108+
`signer`: signer account
1109+
1110+
#### 2.6.5 VerifyCredibleOntId
1111+
1112+
```
1113+
ontSdk.Credential.VerifyCredibleOntId(credibleOntIds []string, credential *VerifiableCredential) error
1114+
```
1115+
`credibleOntIds`: credible ONT ID list
1116+
1117+
`credential`: [definition](https://www.w3.org/TR/vc-data-model/)
1118+
1119+
#### 2.6.6 VerifyNotExpired
1120+
1121+
```
1122+
ontSdk.Credential.VerifyNotExpired(credential *VerifiableCredential) error
1123+
```
1124+
`credential`: [definition](https://www.w3.org/TR/vc-data-model/)
1125+
1126+
#### 2.6.7 VerifyIssuerSignature
1127+
1128+
```
1129+
ontSdk.Credential.VerifyIssuerSignature(credential *VerifiableCredential) error
1130+
```
1131+
`credential`: [definition](https://www.w3.org/TR/vc-data-model/)
1132+
1133+
#### 2.6.8 VerifyStatus
1134+
1135+
```
1136+
ontSdk.Credential.VerifyStatus(credential *VerifiableCredential) error
1137+
```
1138+
`credential`: [definition](https://www.w3.org/TR/vc-data-model/)
1139+
1140+
#### 2.6.9 CreatePresentation
1141+
1142+
```
1143+
ontSdk.Credential.CreatePresentation(credentials []*VerifiableCredential, contexts, types []string, holder string, signers []*Account) (*Presentation, error)
1144+
```
1145+
`credentials`: credential list
1146+
1147+
`contexts`: [definition](https://www.w3.org/TR/vc-data-model/#contexts)
1148+
1149+
`types`: [definition](https://www.w3.org/TR/vc-data-model/#types)
1150+
1151+
`holder`: ONTID of holder
1152+
1153+
`signers`: signer accounts
1154+
1155+
#### 2.6.10 VerifyPresentation
1156+
1157+
```
1158+
ontSdk.Credential.VerifyPresentation(presentation *Presentation, credibleOntIds []string) error
1159+
```
1160+
`presentation`: [definition](https://www.w3.org/TR/vc-data-model/#presentations-0)
1161+
1162+
`credibleOntIds`: credible ONT ID list
1163+
10581164
# Contributing
10591165

10601166
Can I contribute patches to the Ontology project?

0 commit comments

Comments
 (0)