mirror of
https://github.com/selfxyz/self.git
synced 2026-04-05 03:00:53 -04:00
generate scope from dns (#495)
* generate scope from dns * switch between api and staging api according to document type * add poland passport to mockdatascreen * yarn nice * bump sdk version * bump app version * Feat/update sdk (#496) * export castFromScope * export proof conversion * publish new package * update package * update package * add hashEndpointWithScope to export member --------- Co-authored-by: nicoshark <i.am.nicoshark@gmail.com>
This commit is contained in:
committed by
GitHub
parent
effafe9ab0
commit
fafc765af7
@@ -152,6 +152,7 @@ const MockDataScreen: React.FC<MockDataScreenProps> = ({}) => {
|
||||
'sha512',
|
||||
'ecdsa_sha512_brainpoolP384r1_384',
|
||||
],
|
||||
'sha512 poland': ['sha512', 'sha512', 'rsa_sha256_65537_4096'],
|
||||
} as const;
|
||||
|
||||
const handleGenerate = useCallback(async () => {
|
||||
|
||||
@@ -18,6 +18,7 @@ import LottieView from 'lottie-react-native';
|
||||
import { Image, Text, View, YStack } from 'tamagui';
|
||||
|
||||
import { SelfAppDisclosureConfig } from '../../../../common/src/utils/appType';
|
||||
import { formatEndpoint } from '../../../../common/src/utils/scope';
|
||||
import miscAnimation from '../../assets/animations/loading/misc.json';
|
||||
import Disclosures from '../../components/Disclosures';
|
||||
import { HeldPrimaryButton } from '../../components/buttons/PrimaryButtonLongHold';
|
||||
@@ -108,10 +109,7 @@ const ProveScreen: React.FC = () => {
|
||||
if (!selectedApp?.endpoint) {
|
||||
return null;
|
||||
}
|
||||
const urlFormatted = selectedApp.endpoint
|
||||
.replace(/^https?:\/\//, '')
|
||||
.split('/')[0];
|
||||
return urlFormatted;
|
||||
return formatEndpoint(selectedApp.endpoint);
|
||||
}, [selectedApp?.endpoint]);
|
||||
|
||||
const onVerify = useCallback(
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
generateCircuitInputsRegister,
|
||||
generateCircuitInputsVCandDisclose,
|
||||
} from '../../../../common/src/utils/circuits/generateInputs';
|
||||
import { hashEndpointWithScope } from '../../../../common/src/utils/scope';
|
||||
import {
|
||||
getCSCATree,
|
||||
getCommitmentTree,
|
||||
@@ -63,8 +64,8 @@ export async function generateTeeInputsVCAndDisclose(
|
||||
passportData: PassportData,
|
||||
selfApp: SelfApp,
|
||||
) {
|
||||
const { scope, userId, disclosures } = selfApp;
|
||||
|
||||
const { scope, userId, disclosures, endpoint } = selfApp;
|
||||
const scope_hash = hashEndpointWithScope(endpoint, scope);
|
||||
const selector_dg1 = Array(88).fill('0');
|
||||
|
||||
Object.entries(disclosures).forEach(([attribute, reveal]) => {
|
||||
@@ -102,7 +103,7 @@ export async function generateTeeInputsVCAndDisclose(
|
||||
secret,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
passportData,
|
||||
scope,
|
||||
scope_hash,
|
||||
selector_dg1,
|
||||
selector_older_than,
|
||||
tree,
|
||||
|
||||
@@ -52,7 +52,7 @@ export async function checkPassportSupported(
|
||||
passportData,
|
||||
'register',
|
||||
);
|
||||
const deployedCircuits = await getDeployedCircuits();
|
||||
const deployedCircuits = await getDeployedCircuits(passportData.documentType);
|
||||
console.log('circuitNameRegister', circuitNameRegister);
|
||||
if (
|
||||
!circuitNameRegister ||
|
||||
@@ -263,9 +263,15 @@ export async function registerPassport(
|
||||
);
|
||||
}
|
||||
|
||||
export async function getDeployedCircuits() {
|
||||
export async function getDeployedCircuits(documentType: string) {
|
||||
console.log('Fetching deployed circuits from api');
|
||||
const response = await fetch(`${API_URL}/deployed-circuits/`);
|
||||
const baseUrl =
|
||||
!documentType ||
|
||||
typeof documentType !== 'string' ||
|
||||
documentType === 'passport'
|
||||
? API_URL
|
||||
: API_URL_STAGING;
|
||||
const response = await fetch(`${baseUrl}/deployed-circuits/`);
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
`API server error: ${response.status} ${response.statusText}`,
|
||||
|
||||
Reference in New Issue
Block a user