Skip to content

Commit

Permalink
feat: Remove okapi package requirements everywhere (#1376)
Browse files Browse the repository at this point in the history
  • Loading branch information
fundthmcalculus committed Apr 18, 2023
1 parent bd5daab commit 50180c9
Show file tree
Hide file tree
Showing 34 changed files with 214 additions and 247 deletions.
3 changes: 1 addition & 2 deletions docs/android/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ The Trinsic Android sample application makes it easy to interact with the Trinsi
```java
dependencies {
// other dependencies
implementation urlFile('https://github.com/trinsic-id/okapi/releases/download/v1.4.0/trinsic-okapi-1.4.0.jar', 'trinsic-okapi-1.4.0')
implementation urlFile('https://github.com/trinsic-id/sdk/releases/download/v1.4.0/trinsic-services-1.4.1.jar', 'trinsic-services-1.4.1')
implementation urlFile('https://github.com/trinsic-id/sdk/releases/download/v1.10.0/trinsic-services-1.10.0.jar', 'trinsic-services-1.10.0')
}
```

Expand Down
1 change: 0 additions & 1 deletion docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ The Trinsic CLI makes it easy to interact with the Trinsic API from your termina
=== "Windows"
The CLI can be installed using [Winget](https://docs.microsoft.com/en-us/windows/package-manager/winget/)
```
winget install trinsic.okapi
winget install trinsic.cli
```

Expand Down
11 changes: 2 additions & 9 deletions docs/java/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ The Trinsic Java / Kotlin SDK makes it easy to interact with the Trinsic API fro
3. Run `gradle build` to download the required jar files. This can take some time.

## Configuration
1. Okapi binaries are now included with the server `.jar` or the corresponding android `.aar` file. The gradle include process is essentially similar (see below).
2. If you install to a different location for debugging, use the environment variable `LD_LIBRARY_PATH`, even on Windows.
3. For Android, the okapi binaries must be copied (currently manually) to a [specific location with a specific folder structure](https://github.com/trinsic-id/sdk-examples/tree/main/android/app/src/main/jniLibs). [The complete sample application is here](https://github.com/trinsic-id/sdk-examples/tree/main/android)

!!! note Jar Download Note

If you want to include the two required Trinsic `.jar` files in your own application (android or other java), be sure to copy the following lines. They allow you to specify a remote file location as a gradle `implementation` target as shown below:
If you want to include the required Trinsic `.jar` file in your own application (android or other java), be sure to copy the following lines. They allow you to specify a remote file location as a gradle `implementation` target as shown below:

<!--codeinclude-->
```java
Expand All @@ -24,11 +21,7 @@ The Trinsic Java / Kotlin SDK makes it easy to interact with the Trinsic API fro

```java
dependencies {
// other dependencies
implementation urlFile('https://github.com/trinsic-id/okapi/releases/download/v1.6.0/trinsic-okapi-1.6.2.jar', 'trinsic-okapi-1.6.2')
// android version:
// implementation urlFile('https://github.com/trinsic-id/okapi/releases/download/v1.6.0/trinsic-okapi-1.6.1.aar', 'trinsic-okapi-1.6.1')
implementation urlFile('https://github.com/trinsic-id/sdk/releases/download/v1.8.0/trinsic-services-1.8.1.jar', 'trinsic-services-1.8.1')
implementation urlFile('https://github.com/trinsic-id/sdk/releases/download/v1.10.0/trinsic-services-1.10.0.jar', 'trinsic-services-1.10.0')
}
```

Expand Down
24 changes: 12 additions & 12 deletions docs/node/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The Trinsic Javascript / Typescript Node SDK

The Trinsic Node SDK makes it easy to interact with the Trinsic API from any backend javascript application. The most recent version of the library can be found on npm. You can find the SDKs source on [Github](https://github.com/trinsic-id/sdk/tree/main/web). The @trinsic/trinsic package comes with Typescript bindings.
The Trinsic Node/Web SDK makes it easy to interact with the Trinsic API from any backend javascript application. The most recent version of the library can be found on npm. You can find the SDKs source on [Github](https://github.com/trinsic-id/sdk/tree/main/web). The @trinsic/trinsic package comes with Typescript bindings.
## Installation
Install the package for Node from [npmjs.com <small>:material-open-in-new:</small>](https://www.npmjs.com/package/@trinsic/trinsic){target=_blank}

Expand All @@ -12,37 +12,37 @@ Install the package for Node from [npmjs.com <small>:material-open-in-new:</smal
## Javascript


To import the Trinsic SDK in ES6:
To import the Trinsic SDK:
```js
import { TrinsicService } from "@trinsic/trinsic";
```

To import the Trinsic SDK in CommonJS:
```js
let { TrinsicService } = require("@trinsic/trinsic/browser");
For CommonJS:
```typescript
let { TrinsicService } = require("@trinsic/trinsic");
```

You must instantiate the trinsic service first:
```js
const trinsicService = new TrinsicService({
/** Trinsic API endpoint. Defaults to `prod.trinsic.cloud` */
serverEndpoint: "prod.trinsic.cloud";
serverEndpoint: "prod.trinsic.cloud",
/** Trinsic API port; defaults to `443` */
serverPort: 443;
serverPort: 443,
/** Whether TLS is enabled between SDK and Trinsic API; defaults to `true` */
serverUseTls: true;
serverUseTls: true,
/** Authentication token for SDK calls; defaults to empty string (unauthenticated) */
authToken: "<Your auth token>";
authToken: "<Your auth token>"
});
```

Now you can use the SDK:
```js
const accountInfo = await trinsicService.account().getInfo();
console.log(JSON.stringify(accountInfo, null, 4));
const newWallet = await trinsicService.wallet().createWallet();
console.log(JSON.stringify(newWallet, null, 4));
```

You can find all of the SDK methods documented [here](/reference/)
You can find all the SDK methods documented [here](/reference/)


## Next Steps
Expand Down
2 changes: 0 additions & 2 deletions docs/python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
The Trinsic Python SDK makes it easy to interact with the Trinsic API from any Python application. The most recent version of the library can be found on PyPi. You can find the SDKs source on [Github](https://github.com/trinsic-id/sdk/python).

## Installation and Configuration
* Make sure you have the okapi native binaries installed on your machine. Default installation instructions are in the [readme.md here](https://github.com/trinsic-id/okapi/)
* If you install to a different location for debugging, use the environment variable `LD_LIBRARY_PATH`, even on Windows.
* Recommended: [Create a virtual environment](https://docs.python.org/3/library/venv.html#creating-virtual-environments)
* Install the trinsic package
```bash
Expand Down
24 changes: 12 additions & 12 deletions docs/web/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ Install the package for Node or Browser from [npmjs.com <small>:material-open-in
npm install @trinsic/trinsic
```

To import the Trinsic SDK in ES6:
To import the Trinsic SDK:
```js
import { TrinsicService } from "@trinsic/trinsic/browser";
import { TrinsicService } from "@trinsic/trinsic";
```

To import the Trinsic SDK in CommonJS:
```js
let { TrinsicService } = require("@trinsic/trinsic/browser");
For CommonJS:
```typescript
let { TrinsicService } = require("@trinsic/trinsic");
```

You must instantiate the trinsic service first:
```js
const trinsicService = new TrinsicService({
/** Trinsic API endpoint. Defaults to `prod.trinsic.cloud` */
serverEndpoint: "prod.trinsic.cloud";
serverEndpoint: "prod.trinsic.cloud",
/** Trinsic API port; defaults to `443` */
serverPort: 443;
serverPort: 443,
/** Whether TLS is enabled between SDK and Trinsic API; defaults to `true` */
serverUseTls: true;
serverUseTls: true,
/** Authentication token for SDK calls; defaults to empty string (unauthenticated) */
authToken: "<Your auth token>";
authToken: "<Your auth token>"
});
```

Now you can use the SDK:
```js
const accountInfo = await trinsicService.account().getInfo();
console.log(JSON.stringify(accountInfo, null, 4));
const newWallet = await trinsicService.wallet().createWallet();
console.log(JSON.stringify(newWallet, null, 4));
```

You can find all of the SDK methods documented [here](/reference/)
You can find all the SDK methods documented [here](/reference/)


<!-- prettier-ignore-start -->
Expand Down
2 changes: 0 additions & 2 deletions java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ dependencies {
implementation 'io.grpc:grpc-protobuf:1.49.2'
// This has to match the version of protoc-gen-grpc-java used in `sdk/devops/generate_proto_files.py`
implementation 'io.grpc:grpc-stub:1.49.2'
implementation urlFile('https://github.com/trinsic-id/okapi/releases/download/v1.6.0/trinsic-okapi-1.6.2.jar', 'trinsic-okapi-1.6.2.jar')
// implementation files("C:\\work\\okapi\\java\\build\\libs\\trinsic-okapi-1.6.1.jar")
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.common.util.concurrent.ListenableFuture;
import com.google.protobuf.InvalidProtocolBufferException;
import trinsic.okapi.DidException;
import trinsic.sdk.options.v1.Options;
import trinsic.services.provider.v1.*;

Expand All @@ -25,21 +24,21 @@ public AccessManagementService(Options.TrinsicOptions.Builder options) {
/** This method is experimental Adds a role assignment to an account */
@Deprecated(since = "This method is experimental")
public ListenableFuture<AddRoleAssignmentResponse> addRoleAssignment(
AddRoleAssignmentRequest request) throws InvalidProtocolBufferException, DidException {
AddRoleAssignmentRequest request) throws InvalidProtocolBufferException {

return withMetadata(stub, request).addRoleAssignment(request);
}
/** This method is experimental Removes a role assignment from the account */
@Deprecated(since = "This method is experimental")
public ListenableFuture<RemoveRoleAssignmentResponse> removeRoleAssignment(
RemoveRoleAssignmentRequest request) throws InvalidProtocolBufferException, DidException {
RemoveRoleAssignmentRequest request) throws InvalidProtocolBufferException {

return withMetadata(stub, request).removeRoleAssignment(request);
}
/** This method is experimental List the role assignments for the given account */
@Deprecated(since = "This method is experimental")
public ListenableFuture<ListRoleAssignmentsResponse> listRoleAssignments(
ListRoleAssignmentsRequest request) throws InvalidProtocolBufferException, DidException {
ListRoleAssignmentsRequest request) throws InvalidProtocolBufferException {

return withMetadata(stub, request).listRoleAssignments(request);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package trinsic.services

import com.google.protobuf.InvalidProtocolBufferException
import trinsic.okapi.DidException
import trinsic.sdk.options.v1.Options
import trinsic.services.provider.v1.*

Expand All @@ -12,21 +11,21 @@ class AccessManagementServiceKt(options: Options.TrinsicOptions.Builder?) : Serv
// target:
// /home/runner/work/sdk/sdk/java/src/main/java/trinsic/services/AccessManagementServiceKt.kt

@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
@Deprecated("This method is experimental")
suspend fun addRoleAssignment(request: AddRoleAssignmentRequest): AddRoleAssignmentResponse {
/** This method is experimental Adds a role assignment to an account */
return withMetadata(stub, request).addRoleAssignment(request)
}
@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
@Deprecated("This method is experimental")
suspend fun removeRoleAssignment(
request: RemoveRoleAssignmentRequest
): RemoveRoleAssignmentResponse {
/** This method is experimental Removes a role assignment from the account */
return withMetadata(stub, request).removeRoleAssignment(request)
}
@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
@Deprecated("This method is experimental")
suspend fun listRoleAssignments(
request: ListRoleAssignmentsRequest
Expand Down
15 changes: 7 additions & 8 deletions java/src/main/java/trinsic/services/CredentialService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.common.util.concurrent.ListenableFuture;
import com.google.protobuf.InvalidProtocolBufferException;
import trinsic.okapi.DidException;
import trinsic.sdk.options.v1.Options;
import trinsic.services.verifiablecredentials.v1.*;

Expand All @@ -28,7 +27,7 @@ public CredentialService(Options.TrinsicOptions.Builder options) {
*/
@Deprecated(since = "This endpoint will be removed around June 1, 2023")
public ListenableFuture<IssueResponse> issue(IssueRequest request)
throws InvalidProtocolBufferException, DidException {
throws InvalidProtocolBufferException {

return withMetadata(stub, request).issue(request);
}
Expand All @@ -37,19 +36,19 @@ public ListenableFuture<IssueResponse> issue(IssueRequest request)
* schema validation and revocation registry values to the credential.
*/
public ListenableFuture<IssueFromTemplateResponse> issueFromTemplate(
IssueFromTemplateRequest request) throws InvalidProtocolBufferException, DidException {
IssueFromTemplateRequest request) throws InvalidProtocolBufferException {

return withMetadata(stub, request).issueFromTemplate(request);
}
/** Check credential status in the revocation registry */
public ListenableFuture<CheckStatusResponse> checkStatus(CheckStatusRequest request)
throws InvalidProtocolBufferException, DidException {
throws InvalidProtocolBufferException {

return withMetadata(stub, request).checkStatus(request);
}
/** Update credential status by setting the revocation value */
public ListenableFuture<UpdateStatusResponse> updateStatus(UpdateStatusRequest request)
throws InvalidProtocolBufferException, DidException {
throws InvalidProtocolBufferException {

return withMetadata(stub, request).updateStatus(request);
}
Expand All @@ -58,7 +57,7 @@ public ListenableFuture<UpdateStatusResponse> updateStatus(UpdateStatusRequest r
* signature from which a proof can be derived.
*/
public ListenableFuture<CreateProofResponse> createProof(CreateProofRequest request)
throws InvalidProtocolBufferException, DidException {
throws InvalidProtocolBufferException {

return withMetadata(stub, request).createProof(request);
}
Expand All @@ -67,13 +66,13 @@ public ListenableFuture<CreateProofResponse> createProof(CreateProofRequest requ
* status, and issuer status against a trust registry
*/
public ListenableFuture<VerifyProofResponse> verifyProof(VerifyProofRequest request)
throws InvalidProtocolBufferException, DidException {
throws InvalidProtocolBufferException {

return withMetadata(stub, request).verifyProof(request);
}
/** Sends a document directly to a user's email within the given ecosystem */
public ListenableFuture<SendResponse> send(SendRequest request)
throws InvalidProtocolBufferException, DidException {
throws InvalidProtocolBufferException {

return withMetadata(stub, request).send(request);
}
Expand Down
17 changes: 8 additions & 9 deletions java/src/main/java/trinsic/services/CredentialServiceKt.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
package trinsic.services

import com.google.protobuf.InvalidProtocolBufferException
import trinsic.okapi.DidException
import trinsic.sdk.options.v1.Options
import trinsic.services.verifiablecredentials.v1.*
import trinsic.services.verifiablecredentials.v1.VerifiableCredentialGrpcKt

class CredentialServiceKt(options: Options.TrinsicOptions.Builder?) : ServiceBase(options) {
var stub = VerifiableCredentialGrpcKt.VerifiableCredentialCoroutineStub(this.channel)

@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
suspend fun issueCredential(request: IssueRequest): IssueResponse {
require(!request.documentJson.isBlank()) { "document json must not be empty" }
return withMetadata(stub, request).issue(request)
}
// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
// target: /home/runner/work/sdk/sdk/java/src/main/java/trinsic/services/CredentialServiceKt.kt

@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
@Deprecated("This endpoint will be removed around June 1, 2023")
suspend fun issue(request: IssueRequest): IssueResponse {
/**
Expand All @@ -27,41 +26,41 @@ class CredentialServiceKt(options: Options.TrinsicOptions.Builder?) : ServiceBas
*/
return withMetadata(stub, request).issue(request)
}
@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
suspend fun issueFromTemplate(request: IssueFromTemplateRequest): IssueFromTemplateResponse {
/**
* Sign and issue a verifiable credential from a pre-defined template. This process will also
* add schema validation and revocation registry values to the credential.
*/
return withMetadata(stub, request).issueFromTemplate(request)
}
@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
suspend fun checkStatus(request: CheckStatusRequest): CheckStatusResponse {
/** Check credential status in the revocation registry */
return withMetadata(stub, request).checkStatus(request)
}
@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
suspend fun updateStatus(request: UpdateStatusRequest): UpdateStatusResponse {
/** Update credential status by setting the revocation value */
return withMetadata(stub, request).updateStatus(request)
}
@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
suspend fun createProof(request: CreateProofRequest): CreateProofResponse {
/**
* Create a proof from a signed document that is a valid verifiable credential and contains a
* signature from which a proof can be derived.
*/
return withMetadata(stub, request).createProof(request)
}
@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
suspend fun verifyProof(request: VerifyProofRequest): VerifyProofResponse {
/**
* Verifies a proof by checking the signature value, and if possible schema validation,
* revocation status, and issuer status against a trust registry
*/
return withMetadata(stub, request).verifyProof(request)
}
@Throws(InvalidProtocolBufferException::class, DidException::class)
@Throws(InvalidProtocolBufferException::class)
suspend fun send(request: SendRequest): SendResponse {
/** Sends a document directly to a user's email within the given ecosystem */
return withMetadata(stub, request).send(request)
Expand Down
Loading

0 comments on commit 50180c9

Please sign in to comment.