Skip to content

Commit

Permalink
added functions for confirm,verify 2fa and mint 2fa
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronk-bixly committed Nov 7, 2022
1 parent 105ea50 commit 9648aa5
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/common/rest/confirm-2fa/index.ts
@@ -0,0 +1,51 @@
import { MethodMetadata, Parameter } from '..';

import { Headers } from '../../helpers/axios';
import { useMasaMutation, useRestCall } from '../../helpers/rest-calls';

const path = 'session/confirm2FA';

export function useMethod({ body }: any) {
const { data, error, loading, getData } = useRestCall({
headers: Headers,
metadata,
body,
});

return { data, error, loading, getData };
}

export function useSimpleMethod({ pathParameters, body, settings }: any) {
const masaQuery = useMasaMutation(
'confirm-2fa',
{
pathParameters,
headers: Headers,
body,
metadata,
},
settings
);
return masaQuery;
}

const parameters: Parameter[] = [
{
key: 1,
name: 'Phone Number',
description: 'Phone number used for 2FA',
required: 'yes',
default: 'Identity',
dataType: 'string',
},
];

export const metadata: MethodMetadata = {
author: 'Aaron Knott',
authorPicture: '',
description:
'Confirm 2FA using a phonenumber',
name: path,
method: 'POST',
parameters,
};
4 changes: 4 additions & 0 deletions src/common/rest/index.ts
Expand Up @@ -10,6 +10,7 @@ export * as getNodeOperators from './get-node-operators';
export * as postNodeOperators from './post-node-operators';

export * as mintCreditScore from './mint-credit-score';
export * as mint2FA from './mint-2fa';

export * as getVezgoLink from './vezgo/get-link';
export * as listVezgoProviders from './vezgo/list-providers';
Expand Down Expand Up @@ -37,6 +38,9 @@ export * as getSession from './get-session';
export * as checkSignatureChallenge from './check-challenge-signature';
export * as sessionLogout from './session-logout';

export * as confirm2FA from './confirm-2fa';
export * as verify2FA from './verify-2fa';

export * as storeMetadata from './store-metadata';

export * from './interfaces';
67 changes: 67 additions & 0 deletions src/common/rest/mint-2fa/index.ts
@@ -0,0 +1,67 @@
import { MethodMetadata, Parameter } from '..';

import { Headers } from '../../helpers/axios';
import { useMasaMutation, useRestCall } from '../../helpers/rest-calls';

const path = 'contracts/2fa/mint"';

export function useMethod({ body }: any) {
const { data, error, loading, getData } = useRestCall({
headers: Headers,
metadata,
body,
});

return { data, error, loading, getData };
}

export function useSimpleMethod({ pathParameters, body, settings }: any) {
const masaQuery = useMasaMutation(
'mint-2fa',
{
pathParameters,
headers: Headers,
body,
metadata,
},
settings
);
return masaQuery;
}

const parameters: Parameter[] = [
{
key: 1,
name: 'address',
description: 'The receiver address of the Soul Bound Token',
required: 'yes',
default: '0x8ba2D360323e3cA85b94c6F7720B70aAc8D37a7a',
dataType: 'string',
},
{
key: 2,
name: 'phone number',
description: 'Phone number that has been verified with 2FA',
required: 'yes',
default: '5551234567',
dataType: 'string',
},
{
key: 3,
name: 'signature',
description: 'The signature of the Users wallet',
required: 'yes',
default:
'0x2e3d358b8f61064f7b998f9bb629fed0bcea2883192b1690a56b5c8bc978d4bb3f9ae4b7bccab04a786bd85157fbb2c261c5bfe5f0dd588c9ed7983f0f3fc8231b',
dataType: 'string',
},
];

export const metadata: MethodMetadata = {
author: 'Aaron Knott',
authorPicture: '',
description: 'Mint a 2FA SBT',
name: path,
method: 'POST',
parameters,
};
59 changes: 59 additions & 0 deletions src/common/rest/verify-2fa/index.ts
@@ -0,0 +1,59 @@
import { MethodMetadata, Parameter } from '..';

import { Headers } from '../../helpers/axios';
import { useMasaMutation, useRestCall } from '../../helpers/rest-calls';

const path = 'session/verify2FA';

export function useMethod({ body }: any) {
const { data, error, loading, getData } = useRestCall({
headers: Headers,
metadata,
body,
});

return { data, error, loading, getData };
}

export function useSimpleMethod({ pathParameters, body, settings }: any) {
const masaQuery = useMasaMutation(
'verify-2fa',
{
pathParameters,
headers: Headers,
body,
metadata,
},
settings
);
return masaQuery;
}

const parameters: Parameter[] = [
{
key: 1,
name: 'Code',
description: 'The 2FA code sent to the user',
required: 'yes',
default: 'Identity',
dataType: 'string',
},
{
key: 2,
name: 'Phone Number',
description: 'Phone number used for 2FA',
required: 'yes',
default: 'Identity',
dataType: 'string',
},
];

export const metadata: MethodMetadata = {
author: 'Aaron Knott',
authorPicture: '',
description:
'Verify 2FA using a code and associated phonenumber',
name: path,
method: 'POST',
parameters,
};

0 comments on commit 9648aa5

Please sign in to comment.