Skip to content

Commit

Permalink
feat(psc): expose setOidcTestNonce
Browse files Browse the repository at this point in the history
  • Loading branch information
JMounier committed Apr 29, 2022
1 parent 1b98c1e commit 0070294
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ class ClientReactNativeModule(reactContext: ReactApplicationContext) :
return getTanker(handle).createOidcNonce().bridge(promise)
}

@ReactMethod()
fun setOidcTestNonce(handle: TankerHandle, nonce: String, promise: Promise) {
return getTanker(handle).setOidcTestNonce(nonce).bridge(promise)
}

@ReactMethod()
fun registerIdentity(
handle: TankerHandle,
Expand Down
13 changes: 13 additions & 0 deletions ios/ClientReactNative.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,19 @@ -(void) stopObserving {
}];
}

RCT_REMAP_METHOD(setOidcTestNonce, setOidcTestNonceWithTankerHandle:(nonnull NSNumber*)handle nonce:(nonnull NSString*)nonce resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
{
TKRTanker* tanker = [self.tankerInstanceMap objectForKey:handle];
if (!tanker)
return rejectInvalidHandle(reject, handle);

[tanker setOidcTestNonce:nonce completionHandler:^(NSError * _Nullable err) {
if (err != nil)
return rejectWithError(reject, err);
resolve(nil);
}];
}

RCT_REMAP_METHOD(registerIdentity,
registerIdentityWithTankerHandle:(nonnull NSNumber*)handle
verification:(nonnull NSDictionary<NSString*, id>*)verificationDict
Expand Down
1 change: 1 addition & 0 deletions src/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type ClientReactNativeType = {
start(instance: NativeTanker, identity: String): Promise<Status>;
stop(instance: NativeTanker): Promise<void>;
createOidcNonce(instance: NativeTanker): Promise<string>;
setOidcTestNonce(instance: NativeTanker, nonce: string): Promise<void>;
registerIdentity(
instance: NativeTanker,
verification: Verification,
Expand Down
6 changes: 6 additions & 0 deletions src/nativeWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ export class Tanker {
return bridgeAsyncExceptions(Native.createOidcNonce(this.getInstance()));
}

async setOidcTestNonce(nonce: string): Promise<void> {
return bridgeAsyncExceptions(
Native.setOidcTestNonce(this.getInstance(), nonce)
);
}

async registerIdentity(
verification: Verification,
options?: VerificationOptions
Expand Down

0 comments on commit 0070294

Please sign in to comment.