Skip to content

Commit 781b898

Browse files
MOB-862 #comment updated example app with new APIs
1 parent 286fc5a commit 781b898

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

example/src/App.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default class App extends React.Component<any, State> {
8080

8181
private signTransaction = async (username: string): Promise<void> => {
8282
try {
83-
const response = await TSAuthenticationSDKModule.signTransaction(username);
83+
const response = await TSAuthenticationSDKModule.signWebauthnTransaction(username);
8484
const accessToken = await this.mockServer.getAccessToken();
8585
const success = await this.mockServer.completeAuthentication(accessToken.token, response.result); // should change???
8686
if (success) {
@@ -117,7 +117,7 @@ export default class App extends React.Component<any, State> {
117117

118118
private register = async (username: string, displayName: string): Promise<void> => {
119119
try {
120-
const response = await TSAuthenticationSDKModule.register(username, displayName);
120+
const response = await TSAuthenticationSDKModule.registerWebAuthn(username, displayName);
121121
const accessToken = await this.mockServer.getAccessToken();
122122
const success = await this.mockServer.completeRegistration(accessToken.token, response.result, username);
123123
if (success) {
@@ -135,7 +135,7 @@ export default class App extends React.Component<any, State> {
135135

136136
private authenticate = async (username: string): Promise<void> => {
137137
try {
138-
const response = await TSAuthenticationSDKModule.authenticate(username);
138+
const response = await TSAuthenticationSDKModule.authenticateWebAuthn(username);
139139
const accessToken = await this.mockServer.getAccessToken();
140140
const success = await this.mockServer.completeAuthentication(accessToken.token, response.result);
141141
if (success) {
@@ -173,8 +173,6 @@ export default class App extends React.Component<any, State> {
173173
secret: config.secret
174174
}
175175
this.configureExampleApp(appConfiguration);
176-
} else {
177-
// this.showAppConfigurationDialog()
178176
}
179177
}
180178

@@ -185,6 +183,14 @@ export default class App extends React.Component<any, State> {
185183
appConfiguration.secret
186184
);
187185

186+
if (!TSAuthenticationSDKModule.isWebAuthnSupported()) {
187+
this.setState({ errorMessage: 'WebAuthn is not supported on this device' });
188+
return;
189+
}
190+
191+
const deviceInfo = await TSAuthenticationSDKModule.getDeviceInfo();
192+
console.log("Device Info: ", deviceInfo);
193+
188194
TSAuthenticationSDKModule.initialize(
189195
appConfiguration.clientId,
190196
appConfiguration.domain,

ios/TsAuthentication.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ class TsAuthentication: NSObject {
9898

9999
switch deviceInfo {
100100
case .success(let response):
101-
resolve(["result": response])
101+
let info = ["result": [
102+
"publicKeyId": response.publicKeyId,
103+
"publicKey": response.publicKey
104+
]]
105+
resolve(info)
102106
case .failure(let error):
103107
reject(self.kTag, error.localizedDescription, error)
104108
}

0 commit comments

Comments
 (0)