Skip to content

Commit

Permalink
Remove LdProofs.VerifyProof (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
fundthmcalculus authored May 18, 2022
1 parent 2abe3bc commit 7a35aef
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 78 deletions.
11 changes: 2 additions & 9 deletions dart/lib/okapi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,10 @@ class LdProofs {
static final _ldproofsCreateProof = OkapiNative.library
.lookupFunction<OkapiFunctionNative, OkapiFunction>(
'ldproofs_create_proof');
static final _ldproofsVerifyProof = OkapiNative.library
.lookupFunction<OkapiFunctionNative, OkapiFunction>(
'ldproofs_verify_proof');

static CreateProofResponse createProof(CreateProofRequest request) =>
OkapiNative.nativeCall(
_ldproofsCreateProof, request, CreateProofResponse());

static VerifyProofResponse verifyProof(VerifyProofRequest request) =>
OkapiNative.nativeCall(
_ldproofsVerifyProof, request, VerifyProofResponse());
}

class Oberon {
Expand All @@ -76,7 +69,7 @@ class Oberon {
'oberon_unblind_token');
static final _oberonVerifyToken = OkapiNative.library
.lookupFunction<OkapiFunctionNative, OkapiFunction>(
'oberon_verify_token');
'oberon_verify_token');
static final _oberonVerifyProof = OkapiNative.library
.lookupFunction<OkapiFunctionNative, OkapiFunction>(
'oberon_verify_proof');
Expand All @@ -101,7 +94,7 @@ class Oberon {
OkapiNative.nativeCall(
_oberonUnBlindToken, request, UnBlindOberonTokenResponse());
static VerifyOberonTokenResponse VerifyToken(
VerifyOberonTokenRequest request) =>
VerifyOberonTokenRequest request) =>
OkapiNative.nativeCall(
_oberonVerifyToken, request, VerifyOberonTokenResponse());
static VerifyOberonProofResponse VerifyProof(
Expand Down
5 changes: 0 additions & 5 deletions dotnet/Library/Okapi/LDProofs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ public static CreateProofResponse CreateProof(CreateProofRequest request)
{
return Native.Call<CreateProofRequest, CreateProofResponse>(request, Native.ldproofs_create_proof);
}

public static VerifyProofResponse VerifyProof(VerifyProofRequest request)
{
return Native.Call<VerifyProofRequest, VerifyProofResponse>(request, Native.ldproofs_verify_proof);
}
}
6 changes: 1 addition & 5 deletions dotnet/Library/Okapi/Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ internal static TResponse Call<TRequest, TResponse>(TRequest request, NativeMeth
[DllImport(LibraryName, CharSet = CharSet.Auto, BestFitMapping = false, ThrowOnUnmappableChar = true)]
internal static extern int
ldproofs_create_proof(ByteBuffer request, out ByteBuffer response, out ExternError error);

[DllImport(LibraryName, CharSet = CharSet.Auto, BestFitMapping = false, ThrowOnUnmappableChar = true)]
internal static extern int
ldproofs_verify_proof(ByteBuffer request, out ByteBuffer response, out ExternError error);


#endregion

#region Oberon
Expand Down
7 changes: 0 additions & 7 deletions go/okapi/ldproofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import "github.com/trinsic-id/okapi/go/okapiproto"
// LdProofer implements Linked-Data Proofs
type LdProofer interface {
CreateProof(request *okapiproto.CreateProofRequest) (*okapiproto.CreateProofResponse, error)
VerifyProof(request *okapiproto.VerifyProofRequest) (*okapiproto.VerifyProofResponse, error)
}

// LdProofs implements Linked-Data Proofs
Expand All @@ -20,9 +19,3 @@ func (l *ldProofs) CreateProof(request *okapiproto.CreateProofRequest) (*okapipr
err := callOkapiNative(request, &response, "ldproofs_create_proof")
return &response, err
}

func (l *ldProofs) VerifyProof(request *okapiproto.VerifyProofRequest) (*okapiproto.VerifyProofResponse, error) {
response := okapiproto.VerifyProofResponse{}
err := callOkapiNative(request, &response, "ldproofs_verify_proof")
return &response, err
}
9 changes: 0 additions & 9 deletions java/src/main/java/trinsic/okapi/LdProofs.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,4 @@ public static Proofs.CreateProofResponse createProof(Proofs.CreateProofRequest r
errBuffer.raiseError(result);
return Proofs.CreateProofResponse.parseFrom(bufferToByteArray(responseBuffer));
}

public static Proofs.VerifyProofResponse verifyProof(Proofs.VerifyProofRequest request) throws DidException, InvalidProtocolBufferException {
OkapiByteBuffer.ByValue requestBuffer = messageToBuffer(request);
OkapiByteBuffer responseBuffer = new OkapiByteBuffer();
ExternError errBuffer = new ExternError();
var result = getNativeLibrary().ldproofs_verify_proof(requestBuffer, responseBuffer, errBuffer);
errBuffer.raiseError(result);
return Proofs.VerifyProofResponse.parseFrom(bufferToByteArray(responseBuffer));
}
}
2 changes: 0 additions & 2 deletions java/src/main/java/trinsic/okapi/OkapiNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ public interface IOkapiC extends com.sun.jna.Library {

int blake3_derive_key(OkapiByteBuffer.ByValue request, OkapiByteBuffer response, ExternError err);

int ldproofs_verify_proof(OkapiByteBuffer.ByValue request, OkapiByteBuffer response, ExternError err);

int oberon_create_key(OkapiByteBuffer.ByValue request, OkapiByteBuffer response, ExternError err);

int oberon_create_token(OkapiByteBuffer.ByValue request, OkapiByteBuffer response, ExternError err);
Expand Down
7 changes: 1 addition & 6 deletions native/src/ffi/ldproofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,4 @@ use ffi_support::{ByteBuffer, ExternError};
#[no_mangle]
pub extern "C" fn ldproofs_create_proof(request: ByteBuffer, response: &mut ByteBuffer, err: &mut ExternError) -> i32 {
c_impl!(CreateProofRequest, LdProofs, create_proof, request, response, err)
}

#[no_mangle]
pub extern "C" fn ldproofs_verify_proof(request: ByteBuffer, response: &mut ByteBuffer, err: &mut ExternError) -> i32 {
c_impl!(VerifyProofRequest, LdProofs, verify_proof, request, response, err)
}
}
4 changes: 0 additions & 4 deletions native/src/ldproofs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ impl crate::LdProofs {
signed_document: Some(unsigned_document.into()),
})
}

pub fn verify_proof<'a>(_request: &VerifyProofRequest) -> Result<VerifyProofResponse, Error<'a>> {
todo!()
}
}

impl From<&Struct> for JcsEd25519Signature2020 {
Expand Down
7 changes: 0 additions & 7 deletions python/trinsicokapi/ldproofs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,3 @@ def create(request: CreateProofRequest) -> CreateProofResponse:
"ldproofs_create_proof", request, CreateProofResponse
)
return response


def verify(request: VerifyProofRequest) -> VerifyProofResponse:
response = _typed_wrap_and_call(
"ldproofs_verify_proof", request, VerifyProofResponse
)
return response
1 change: 0 additions & 1 deletion ruby/lib/okapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def self.load_native_library
attach_function :didcomm_verify, [ByteBuffer.by_value, ByteBuffer.by_ref, ExternError.by_ref], :int

attach_function :ldproofs_create_proof, [ByteBuffer.by_value, ByteBuffer.by_ref, ExternError.by_ref], :int
attach_function :ldproofs_verify_proof, [ByteBuffer.by_value, ByteBuffer.by_ref, ExternError.by_ref], :int

attach_function :oberon_create_key, [ByteBuffer.by_value, ByteBuffer.by_ref, ExternError.by_ref], :int
attach_function :oberon_create_token, [ByteBuffer.by_value, ByteBuffer.by_ref, ExternError.by_ref], :int
Expand Down
5 changes: 0 additions & 5 deletions ruby/lib/okapi/ld_proofs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,5 @@ def self.create(request)
Okapi.verify_type(request, Okapi::Proofs::V1::CreateProofRequest)
Okapi.ffi_call('ldproofs_create_proof', request, Okapi::Proofs::V1::CreateProofResponse)
end

def self.verify(request)
Okapi.verify_type(request, Okapi::Proofs::V1::VerifyProofRequest)
Okapi.ffi_call('ldproofs_verify_proof', request, Okapi::Proofs::V1::VerifyProofResponse)
end
end
end
14 changes: 1 addition & 13 deletions wasm/packages/okapi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class DIDComm {
}

export class LdProofs {
static async generate(
static async createProof(
request: proto.CreateProofRequest
): Promise<proto.CreateProofResponse> {
await initialize();
Expand All @@ -87,18 +87,6 @@ export class LdProofs {
)
);
}

static async convert(
request: proto.VerifyProofRequest
): Promise<proto.VerifyProofResponse> {
await initialize();

return proto.VerifyProofResponse.decode(
native.ldproofs_verify_proof(
proto.VerifyProofRequest.encode(request).finish()
)
);
}
}

export class Oberon {
Expand Down
5 changes: 0 additions & 5 deletions wasm/src/ldproofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ use wasm_bindgen::prelude::*;
pub fn ldproofs_create_proof(request: Uint8Array) -> Result<Uint8Array, JsValue> {
impl_invoke!(CreateProofRequest, LdProofs, create_proof, request)
}

#[wasm_bindgen]
pub fn ldproofs_verify_proof(request: Uint8Array) -> Result<Uint8Array, JsValue> {
impl_invoke!(VerifyProofRequest, LdProofs, create_proof, request)
}

0 comments on commit 7a35aef

Please sign in to comment.